hexsha stringlengths 40 40 | size int64 5 2.72M | ext stringclasses 5
values | lang stringclasses 1
value | max_stars_repo_path stringlengths 3 976 | max_stars_repo_name stringlengths 5 113 | max_stars_repo_head_hexsha stringlengths 40 78 | max_stars_repo_licenses listlengths 1 10 | max_stars_count float64 1 191k ⌀ | max_stars_repo_stars_event_min_datetime stringdate 2015-01-01 00:01:43 2022-03-31 23:59:48 ⌀ | max_stars_repo_stars_event_max_datetime stringdate 2015-01-01 00:06:24 2022-03-31 23:59:53 ⌀ | max_issues_repo_path stringlengths 3 976 | max_issues_repo_name stringlengths 5 116 | max_issues_repo_head_hexsha stringlengths 40 78 | max_issues_repo_licenses listlengths 1 10 | max_issues_count float64 1 134k ⌀ | 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 976 | max_forks_repo_name stringlengths 5 116 | max_forks_repo_head_hexsha stringlengths 40 78 | max_forks_repo_licenses listlengths 1 10 | max_forks_count float64 1 105k ⌀ | max_forks_repo_forks_event_min_datetime stringdate 2015-01-01 00:01:19 2022-03-31 23:59:49 ⌀ | max_forks_repo_forks_event_max_datetime stringdate 2015-01-03 12:00:57 2022-03-31 23:59:49 ⌀ | content stringlengths 5 2.72M | avg_line_length float64 1.38 573k | max_line_length int64 2 1.01M | alphanum_fraction float64 0 1 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
d3fd6ac315ff86494f78f8dcc23d611fdce5d7d7 | 233 | h | C | HowToSpendTime/Controllers/HomeViewController/HTHomeViewController.h | badmafioso/HowToSpendTime | ef1a8b3b02e7716f1bf804b5f86c5befc11545c8 | [
"MIT"
] | null | null | null | HowToSpendTime/Controllers/HomeViewController/HTHomeViewController.h | badmafioso/HowToSpendTime | ef1a8b3b02e7716f1bf804b5f86c5befc11545c8 | [
"MIT"
] | null | null | null | HowToSpendTime/Controllers/HomeViewController/HTHomeViewController.h | badmafioso/HowToSpendTime | ef1a8b3b02e7716f1bf804b5f86c5befc11545c8 | [
"MIT"
] | null | null | null | //
// ViewController.h
// HowToSpendTime
//
// Created by Сергей Фролов on 08.01.18.
// Copyright © 2018 Smart Capitan. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface HTHomeViewController : UIViewController
@end
| 14.5625 | 56 | 0.708155 |
d3fd85a7adff019961e0a6cff604ba8a21f4d6c0 | 479 | c | C | gurba/lib/domains/sewer/rooms/1-n.c | DEFCON-MUD/defcon-28-mud-source | b25b5bd15fee6a4acda5119ea864bde4dff62714 | [
"Unlicense"
] | 4 | 2021-07-21T17:49:01.000Z | 2022-03-11T20:50:59.000Z | gurba/lib/domains/sewer/rooms/1-n.c | DEFCON-MUD/defcon-28-mud-source | b25b5bd15fee6a4acda5119ea864bde4dff62714 | [
"Unlicense"
] | null | null | null | gurba/lib/domains/sewer/rooms/1-n.c | DEFCON-MUD/defcon-28-mud-source | b25b5bd15fee6a4acda5119ea864bde4dff62714 | [
"Unlicense"
] | 1 | 2021-12-31T00:55:05.000Z | 2021-12-31T00:55:05.000Z | inherit "/std/room";
#include "../domain.h"
void setup( void ) {
add_area( "sewer" );
set_short( "Sewer Passage - 1-n" );
set_objects( DIR+"/monsters/mediocre_snake_4.c");
set_exits( ([
"south" : DIR+"/rooms/2-n.c"
]) );
set_long( "This is a cramped hallway, illuminated only by the green glow of the sediment in this hellhole. The walls and floors are covered with liquid. The smell is outright dreadful.%^RESET%^\n\nThe sewer continues to the south.%^RESET%^");
}
| 34.214286 | 244 | 0.68476 |
d3fdb6e80319568cb23e833121509e5287f4d39f | 1,513 | h | C | packages/Windows API Code Pack 1.1/source/WindowsAPICodePack/DirectX/DirectX/Stdafx.h | protechdm/CompareCloudware | 9c316339717d21ccc6c272bb3b0845e4b41aad5f | [
"MIT"
] | 17 | 2019-06-29T04:10:41.000Z | 2022-03-23T01:07:07.000Z | packages/Windows API Code Pack 1.1/source/WindowsAPICodePack/DirectX/DirectX/Stdafx.h | protechdm/CompareCloudware | 9c316339717d21ccc6c272bb3b0845e4b41aad5f | [
"MIT"
] | 27 | 2019-09-19T08:06:02.000Z | 2022-03-06T15:29:01.000Z | packages/Windows API Code Pack 1.1/source/WindowsAPICodePack/DirectX/DirectX/Stdafx.h | protechdm/CompareCloudware | 9c316339717d21ccc6c272bb3b0845e4b41aad5f | [
"MIT"
] | 8 | 2019-09-13T18:21:25.000Z | 2022-03-19T16:32:21.000Z | // Copyright (c) Microsoft Corporation. All rights reserved.
// stdafx.h : include file for standard system include files,
// or project specific include files that are used frequently,
// but are changed infrequently
#pragma once
// Exclude rarely used parts of the windows headers
#define WIN32_LEAN_AND_MEAN
#if _MSC_VER < 1600
#define SYSTEM_CORE_DLL_WORKAROUND
#endif
//Define Unicode
#ifndef UNICODE
#define UNICODE
#endif
// smart pointer definitions for use in Texture utilities
#include <comdef.h>
#undef INTSAFE_E_ARITHMETIC_OVERFLOW
// Common Public Headers
#include <vcclr.h>
#include <Windows.h>
#include <msclr\marshal.h>
// Common DirectX Headers
#include <D3D10_1.h>
#include <D3D10.h>
#include <D3D11.h>
#include <DXGI.h>
#include <DXGIType.h>
#include <wincodec.h>
#include <d2d1.h>
#include <dwrite.h>
#include <D3DCommon.h>
// Common Includes
#include "AutoPointer.h"
#include "AutoIUnknown.h"
#include "Direct3DCommon/Direct3DException.h"
#include "DXGI/DXGIException.h"
#include "Direct2D/D2DException.h"
#include "WIC/WICException.h"
#include "CommonUtils.h"
#include "Convert.h"
#include "Validate.h"
// Common Types
#include "CommonEnums.h"
#include "Direct3DCommon/D3DCommonEnums.h"
#include "Direct3DCommon/D3DCommonStructs.h"
#include "DXGI/DXGIEnums.h"
#include "DXGI/DXGIStructs.h"
#include "Direct3D11/D3D11Enums.h"
#include "Direct3D11/D3D11Structs.h"
#include "Direct3D10/D3D10Enums.h"
#include "Direct3D10/D3D10Structs.h"
// Direct 2D
#include "Direct2D/D2Dcommon.h"
| 23.276923 | 62 | 0.769993 |
d3fe5869cdbdb5a4da1c9eb4176dc50b6b636963 | 1,790 | h | C | src/esp_v3/pid.h | ic1414/esp_quad | 6fe75cfdf925af299e4325e609fb1fb2ed70c189 | [
"MIT"
] | 18 | 2022-01-24T03:20:53.000Z | 2022-03-22T01:29:02.000Z | src/esp_v3/pid.h | ic1414/esp_quad | 6fe75cfdf925af299e4325e609fb1fb2ed70c189 | [
"MIT"
] | 2 | 2022-01-22T15:34:21.000Z | 2022-03-01T12:46:37.000Z | src/esp_v3/pid.h | ic1414/esp_quad | 6fe75cfdf925af299e4325e609fb1fb2ed70c189 | [
"MIT"
] | 4 | 2022-01-23T04:55:51.000Z | 2022-03-12T14:09:12.000Z | #ifndef _pid_h_
#define _pid_h_
#include "Arduino.h"
// https://zh.wikipedia.org/wiki/PID%E6%8E%A7%E5%88%B6%E5%99%A8
class PID {
private:
// output limit
int limitP;
int limitI;
int limitD;
float integral = 0;
float pre_error = 0;
float pre_derivative_out = 0;
public:
// constant
// functions
float kp;
float ki;
float kd;
PID(float p, float i, float d, int lp, int li, int ld);
int _calculate(float set_point, float measure, float dt);
float get_integral();
void integral_reset();
void set_pid(float, float, float);
};
PID::PID(float p, float i, float d, int lp, int li, int ld){
kp = p;
ki = i;
kd = d;
limitP = lp;
limitI = li;
limitD = ld;
}
void PID::integral_reset(){
integral = 0;
}
void PID::set_pid(float p, float i, float d){
kp = p;
ki = i;
kd = d;
}
float PID::get_integral(){
return integral;
}
int PID::_calculate(float set_point, float measure, float dt){
// error
float cur_error = set_point - measure;
// propotion
float propotion_out = cur_error * kp;
propotion_out = constrain(propotion_out, -limitP, limitP);
// intergral
integral = integral + (cur_error / 1000 * dt);
integral = constrain(integral, (float)-limitI/ki, (float)limitI/ki);
float integral_out = integral * ki;
// derivative
// ...
float derivative_out = (cur_error - pre_error) * kd / dt;
derivative_out = derivative_out * 0.90 + pre_derivative_out * 0.10;
derivative_out = constrain(derivative_out, -limitD, limitD);
pre_derivative_out = derivative_out;
pre_error = cur_error;
// out
float out = (propotion_out + integral_out + derivative_out);
return out;
}
#endif
| 20.813953 | 71 | 0.618994 |
d3fe8132da5def5b86ea7fa799cb294894bedc42 | 319 | h | C | Core/Shaders/Lighting_common.h | guoxx/ProtoLab | fe9678e6ee85bb5fabb9896544e797f4d086e0cd | [
"MIT"
] | 2 | 2016-10-08T07:08:24.000Z | 2018-04-19T14:59:12.000Z | Core/Shaders/Lighting_common.h | guoxx/ProtoLab | fe9678e6ee85bb5fabb9896544e797f4d086e0cd | [
"MIT"
] | null | null | null | Core/Shaders/Lighting_common.h | guoxx/ProtoLab | fe9678e6ee85bb5fabb9896544e797f4d086e0cd | [
"MIT"
] | null | null | null | #include "FilterIdentity_common.h"
ConstantsBuffer(View, ps, 0)
{
float4 g_vCameraPosition;
float4x4 g_mProjInv;
float4x4 g_mViewInv;
};
ConstantsBuffer(PointLightParam, ps, 1)
{
float4 g_LightPosition;
float4 g_LightIntensity;
float4 g_RadiusStart;
float4 g_RadiusEnd;
float4x4 g_mViewProjInLightSpace[6];
}; | 18.764706 | 39 | 0.796238 |
31002045f32ee99777d0e0ba7e9099c225ebdc6c | 1,048 | h | C | OnionBrowser/TorController.h | Th3Ya0vi/The-Onion-Browser | 3bcd4bf49f907bddcf420fa6ee21cd2a823bbc00 | [
"MIT"
] | 5 | 2019-06-05T14:54:58.000Z | 2021-09-16T08:21:03.000Z | OnionBrowser/TorController.h | Th3Ya0vi/The-Onion-Browser | 3bcd4bf49f907bddcf420fa6ee21cd2a823bbc00 | [
"MIT"
] | null | null | null | OnionBrowser/TorController.h | Th3Ya0vi/The-Onion-Browser | 3bcd4bf49f907bddcf420fa6ee21cd2a823bbc00 | [
"MIT"
] | null | null | null | //
// TorController.h
// OnionBrowser
//
// Created by Mike Tigas on 9/5/12.
//
//
#import <Foundation/Foundation.h>
#import "TorWrapper.h"
#import "ULINetSocket.h"
@interface TorController : NSObject
#define CONN_STATUS_NONE 0
#define CONN_STATUS_CONNECTED 1
@property (nonatomic) unsigned int controllerIsAuthenticated;
@property (nonatomic) Boolean didFirstConnect;
@property (nonatomic) unsigned int connectionStatus;
@property (nonatomic) TorWrapper *torThread;
@property (nonatomic) NSTimer *torCheckLoopTimer;
@property (nonatomic) NSTimer *torStatusTimeoutTimer;
@property (nonatomic) ULINetSocket *mSocket;
@property (nonatomic) NSString *msgIn;
@property (nonatomic) unsigned int torSocksPort;
@property (nonatomic) unsigned int torControlPort;
- (id)init;
- (void)startTor;
- (void)hupTor;
- (void)requestNewTorIdentity;
- (void)activateTorCheckLoop;
- (void)disableTorCheckLoop;
- (void)checkTor;
- (void)checkTorStatusTimeout;
- (void)reachabilityChanged;
- (void)appDidEnterBackground;
- (void)appDidBecomeActive;
@end
| 21.833333 | 61 | 0.772901 |
31006e58fd184dec5b19bc7862aa45e5076fe56c | 1,189 | h | C | qt/QML/ListModel/v1/cpp/todolist.h | ArboreusSystems/arboreus_examples | 17d39e18f4b2511c19f97d4e6c07ec9d7087fae8 | [
"BSD-3-Clause"
] | 17 | 2019-02-19T21:29:22.000Z | 2022-01-29T11:03:45.000Z | qt/QML/ListModel/v1/cpp/todolist.h | MbohBless/arboreus_examples | 97f0e25182bbc4b5ffab37c6157514332002aeee | [
"BSD-3-Clause"
] | null | null | null | qt/QML/ListModel/v1/cpp/todolist.h | MbohBless/arboreus_examples | 97f0e25182bbc4b5ffab37c6157514332002aeee | [
"BSD-3-Clause"
] | 9 | 2021-02-21T05:32:23.000Z | 2022-02-26T07:51:52.000Z | // ----------------------------------------------------------
/*!
\headerfile ToDoList
\title
\brief Template file wizard/classes/cpp/file.h
\list
\li @notice Template file classes/file.h
\li @copyright Arboreus (http://arboreus.systems)
\li @author Alexandr Kirilov (http://alexandr.kirilov.me)
\li @created 27/06/2020 at 12:12:33
\endlist
*/
// ----------------------------------------------------------
#ifndef TODOLIST_H
#define TODOLIST_H
// System includes
#include <QObject>
#include <QString>
#include <QVector>
// Application includes
// Constants and definitions
struct ToDoItem {
bool done = false;
QString description;
};
// Class definitions
class ToDoList : public QObject {
Q_OBJECT
public:
QVector<ToDoItem> pItems;
explicit ToDoList(QObject *parent = nullptr);
virtual ~ToDoList(void);
QVector<ToDoItem> mItems(void) const;
bool mSetItemAt(int inIndex,const ToDoItem &inItem);
signals:
void sgPreItemAppended(void);
void sgPostItemAppended(void);
void sgPreItemRemoved(int inIndex);
void sgPostItemRemoved();
public slots:
void mAppendItem(void);
void mRemoveCompletedItems(void);
private:
};
#endif // TODOLIST_H
| 18.015152 | 61 | 0.656854 |
3100bc8d90fb9888380d2ad099a7f3e47c4242d9 | 899 | h | C | include/testRunner.h | IgnacioPomar/TinyCppUnit | 4c13d54f779dcad6333194cee7e660714cfb4df3 | [
"Unlicense"
] | null | null | null | include/testRunner.h | IgnacioPomar/TinyCppUnit | 4c13d54f779dcad6333194cee7e660714cfb4df3 | [
"Unlicense"
] | null | null | null | include/testRunner.h | IgnacioPomar/TinyCppUnit | 4c13d54f779dcad6333194cee7e660714cfb4df3 | [
"Unlicense"
] | null | null | null | /*********************************************************************************************
* Name : testRunner.h
* Description :
* Copyright (C) 2019 Ignacio Pomar Ballestero
* License : see unlicense.txt
********************************************************************************************/
#pragma once
#ifndef _TEST_RUNNER_H_
#define _TEST_RUNNER_H_
#include <chrono> //MEasure execution time
#include <string>
#include "TinyCppUnit_cfg.h"
#include "TestResults.h"
#include "testCase.h"
class TINYCPPUNIT_LOCAL TestRunner
{
private:
TestResults results;
size_t basePathSize;
void runTest (std::string, TestCase*);
void echoCaseIdentifier (std::string caseName, TestCase * testCase);
void setBasePathSize ();
public:
static void runAllTests ();
TestRunner ();
void runSingleTest (const char * caseName);
void endAndShowResults ();
};
#endif //_TEST_RUNNER_H_
| 19.977778 | 95 | 0.588432 |
31034c07d15dc0f7de67e00a766de74d42d9dc18 | 1,130 | h | C | src/runtime_src/core/pcie/windows/alveo/system_windows.h | mariodruiz/XRT | c2fe15ff3c3b3d329645d40073cf9f71b8222e15 | [
"Apache-2.0"
] | 359 | 2018-10-05T03:05:08.000Z | 2022-03-31T06:28:16.000Z | src/runtime_src/core/pcie/windows/alveo/system_windows.h | mariodruiz/XRT | c2fe15ff3c3b3d329645d40073cf9f71b8222e15 | [
"Apache-2.0"
] | 5,832 | 2018-10-02T22:43:29.000Z | 2022-03-31T22:28:05.000Z | src/runtime_src/core/pcie/windows/alveo/system_windows.h | mariodruiz/XRT | c2fe15ff3c3b3d329645d40073cf9f71b8222e15 | [
"Apache-2.0"
] | 442 | 2018-10-02T23:06:29.000Z | 2022-03-21T08:34:44.000Z | /*
* SPDX-License-Identifier: Apache-2.0
* Copyright (C) 2019-2021 Xilinx, Inc. All rights reserved.
*/
#ifndef SYSTEM_WINDOWS_ALVEO_H
#define SYSTEM_WINDOWS_ALVEO_H
#include "pcie/common/system_pcie.h"
namespace xrt_core {
class system_windows : public system_pcie
{
public:
void
get_xrt_info(boost::property_tree::ptree &pt);
void
get_os_info(boost::property_tree::ptree &pt);
std::pair<device::id_type, device::id_type>
get_total_devices(bool is_user) const;
void
scan_devices(bool verbose, bool json) const;
std::shared_ptr<device>
get_userpf_device(device::id_type id) const;
std::shared_ptr<device>
get_userpf_device(device::handle_type device_handle, device::id_type id) const;
std::shared_ptr<device>
get_mgmtpf_device(device::id_type id) const;
void
program_plp(const device* dev, const std::vector<char> &buffer, bool force) const;
void
mem_read(const device* dev, long long addr, long long size, const std::string& output_file) const;
void
mem_write(const device* device, long long addr, long long size, unsigned int pattern) const;
};
} // host,xrt_core
#endif
| 23.061224 | 100 | 0.746018 |
3104bc784075bc892ad24382b08c9559f47fe4d7 | 242 | h | C | libs/anari/include/anari/detail/Helpers.h | Twinklebear/ANARI-SDK | d40eef6a8fb3bab65991f0ec1a347d7fcf7579e1 | [
"Apache-2.0"
] | 1 | 2022-03-29T10:48:12.000Z | 2022-03-29T10:48:12.000Z | libs/anari/include/anari/detail/Helpers.h | Twinklebear/ANARI-SDK | d40eef6a8fb3bab65991f0ec1a347d7fcf7579e1 | [
"Apache-2.0"
] | null | null | null | libs/anari/include/anari/detail/Helpers.h | Twinklebear/ANARI-SDK | d40eef6a8fb3bab65991f0ec1a347d7fcf7579e1 | [
"Apache-2.0"
] | null | null | null | // Copyright 2021 The Khronos Group
// SPDX-License-Identifier: Apache-2.0
#pragma once
#include "anari/anari.h"
// std
#include <cstddef>
namespace anari {
ANARI_INTERFACE size_t sizeOfDataType(ANARIDataType type);
} // namespace anari
| 16.133333 | 58 | 0.752066 |
3104e4ceda4e474e45477f9f4b4346ab0cba798a | 4,227 | h | C | Source/Services/Multiplayer/WinRT/MultiplayerGetSessionsRequest_WinRT.h | claytonv/xbox-live-api | d8db86cf930085c7547ae95999c9b301506de343 | [
"MIT"
] | 3 | 2020-07-15T17:50:24.000Z | 2021-11-17T11:15:11.000Z | Source/Services/Multiplayer/WinRT/MultiplayerGetSessionsRequest_WinRT.h | CameronGoodwin/xbox-live-api | ee0c3ee2413f2fed6a373df4b26035792e922fe2 | [
"MIT"
] | null | null | null | Source/Services/Multiplayer/WinRT/MultiplayerGetSessionsRequest_WinRT.h | CameronGoodwin/xbox-live-api | ee0c3ee2413f2fed6a373df4b26035792e922fe2 | [
"MIT"
] | 1 | 2017-06-22T21:17:58.000Z | 2017-06-22T21:17:58.000Z | // Copyright (c) Microsoft Corporation
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
#pragma once
#include "shared_macros.h"
#include "xsapi/multiplayer.h"
#include "MultiplayerSessionVisibility_WinRT.h"
NAMESPACE_MICROSOFT_XBOX_SERVICES_MULTIPLAYER_BEGIN
/// <summary>
/// Defines the search filters for retrieveing a collection of discoverable sessions. Used in MultiplayerService::GetSessionsAsync().
/// </summary>
public ref class MultiplayerGetSessionsRequest sealed
{
public:
/// <summary>
/// Constructs a new MultiplayerGetSessionsRequest object.
/// </summary>
/// <param name="serviceConfigurationId">The service configuration id associated with the sessions.</param>
/// <param name="maxItems">The maximum number of sessions to return.</param>
MultiplayerGetSessionsRequest(
_In_ Platform::String^ serviceConfigurationId,
_In_ uint32 maxItems
);
/// <summary>
/// The service configuration id that the sessions are part of.
/// </summary>
DEFINE_PROP_GET_STR_OBJ(ServiceConfigurationId, service_configuration_id);
/// <summary>
/// The maximum number of sessions to return.
/// </summary>
DEFINE_PROP_GET_OBJ(MaxItems, max_items, uint32);
/// <summary>
/// Indicates if private sessions are included in the results.
/// </summary>
DEFINE_PROP_GETSET_OBJ(IncludePrivateSessions, include_private_sessions, bool);
/// <summary>
/// Indicates if sessions that the user hasn't accepted are included in the results. You must specify xboxUserIdFilter if this value is set to true.
/// </summary>
DEFINE_PROP_GETSET_OBJ(IncludeReservations, include_reservations, bool);
/// <summary>
/// Indicates if inactive sessions are included in the results. You must specify xboxUserIdFilter if this value is set to true.
/// </summary>
DEFINE_PROP_GETSET_OBJ(IncludeInactiveSessions, include_inactive_sessions, bool);
/// <summary>
/// Optional. Filter results to just sessions that contain this Xbox User ID.
/// You must specify one of XboxUserIdFilter, XboxUserIdsFilter, or KeywordFilter.
/// </summary>
DEFINE_PROP_GETSET_STR_OBJ(XboxUserIdFilter, xbox_user_id_filter);
/// <summary>
/// Optional. Filter results to just sessions that contains these Xbox User IDs.
/// You must specify one of XboxUserIdFilter, XboxUserIdsFilter, or KeywordFilter.
/// </summary>
property Windows::Foundation::Collections::IVectorView<Platform::String^>^ XboxUserIdsFilter {
Windows::Foundation::Collections::IVectorView<Platform::String^>^ get();
void set(_In_ Windows::Foundation::Collections::IVectorView<Platform::String^>^ xboxUserIds);
}
/// <summary>
/// Optional. Filter results to just sessions with this keyword.
/// You must specify one of XboxUserIdFilter, XboxUserIdsFilter, or KeywordFilter.
/// </summary>
DEFINE_PROP_GETSET_STR_OBJ(KeywordFilter, keyword_filter);
/// <summary>
/// Optional. The name of the template for the multiplayer session to filter on.
/// </summary>
DEFINE_PROP_GETSET_STR_OBJ(SessionTemplateNameFilter, session_template_name_filter);
/// <summary>
/// Filter results to just sessions with the specified visibility.
/// </summary>
DEFINE_PROP_GETSET_ENUM_OBJ(VisibilityFilter, visibility_filter, MultiplayerSessionVisibility, xbox::services::multiplayer::multiplayer_session_visibility);
/// <summary>
/// Filter results to just sessions with this major version, or less, of the contract. Set to 0 to ignore the contract version.
/// </summary>
DEFINE_PROP_GETSET_OBJ(ContractVersionFilter, contract_version_filter, uint32);
internal:
MultiplayerGetSessionsRequest(
_In_ xbox::services::multiplayer::multiplayer_get_sessions_request cppObj
);
xbox::services::multiplayer::multiplayer_get_sessions_request GetCppObj();
private:
xbox::services::multiplayer::multiplayer_get_sessions_request m_cppObj;
Windows::Foundation::Collections::IVectorView<Platform::String^>^ m_xboxUserIds;
};
NAMESPACE_MICROSOFT_XBOX_SERVICES_MULTIPLAYER_END | 42.69697 | 160 | 0.735983 |
3104e87da49841e030b835cd4e3a5b689b7651d5 | 3,636 | c | C | netbsd/sys/arch/macppc/dev/abtn.c | shisa/kame-shisa | 25dfcf220c0cd8192e475a602501206ccbd9263e | [
"BSD-3-Clause"
] | 1 | 2019-10-15T06:29:32.000Z | 2019-10-15T06:29:32.000Z | netbsd/sys/arch/macppc/dev/abtn.c | shisa/kame-shisa | 25dfcf220c0cd8192e475a602501206ccbd9263e | [
"BSD-3-Clause"
] | null | null | null | netbsd/sys/arch/macppc/dev/abtn.c | shisa/kame-shisa | 25dfcf220c0cd8192e475a602501206ccbd9263e | [
"BSD-3-Clause"
] | 3 | 2017-01-09T02:15:36.000Z | 2019-10-15T06:30:25.000Z | /* $NetBSD: abtn.c,v 1.3 2001/06/08 00:32:01 matt Exp $ */
/*-
* Copyright (C) 1999 Tsubai Masanari. 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. The name of the author may not be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include <sys/param.h>
#include <sys/device.h>
#include <sys/systm.h>
#include <macppc/dev/adbvar.h>
#include <macppc/dev/pm_direct.h>
#define NVRAM_BRIGHTNESS 0x140e
#define ABTN_HANDLER_ID 31
struct abtn_softc {
struct device sc_dev;
int origaddr; /* ADB device type */
int adbaddr; /* current ADB address */
int handler_id;
int brightness; /* backlight brightness */
int volume; /* speaker volume (not yet) */
};
static int abtn_match __P((struct device *, struct cfdata *, void *));
static void abtn_attach __P((struct device *, struct device *, void *));
static void abtn_adbcomplete __P((caddr_t, caddr_t, int));
struct cfattach abtn_ca = {
sizeof(struct abtn_softc), abtn_match, abtn_attach
};
int
abtn_match(parent, cf, aux)
struct device *parent;
struct cfdata *cf;
void *aux;
{
struct adb_attach_args *aa = aux;
if (aa->origaddr == ADBADDR_MISC &&
aa->handler_id == ABTN_HANDLER_ID)
return 1;
return 0;
}
void
abtn_attach(parent, self, aux)
struct device *parent, *self;
void *aux;
{
struct abtn_softc *sc = (struct abtn_softc *)self;
struct adb_attach_args *aa = aux;
ADBSetInfoBlock adbinfo;
int bright;
printf("brightness/volume button\n");
bright = pm_read_nvram(NVRAM_BRIGHTNESS);
if (bright != 0)
pm_set_brightness(bright);
sc->brightness = bright;
sc->origaddr = aa->origaddr;
sc->adbaddr = aa->adbaddr;
sc->handler_id = aa->handler_id;
adbinfo.siServiceRtPtr = (Ptr)abtn_adbcomplete;
adbinfo.siDataAreaAddr = (caddr_t)sc;
SetADBInfo(&adbinfo, sc->adbaddr);
}
void
abtn_adbcomplete(buffer, data, adb_command)
caddr_t buffer, data;
int adb_command;
{
struct abtn_softc *sc = (struct abtn_softc *)data;
u_int cmd;
cmd = buffer[1];
switch (cmd) {
case 0x0a:
sc->brightness -= 8;
if (sc->brightness < 8)
sc->brightness = 8;
pm_set_brightness(sc->brightness);
pm_write_nvram(NVRAM_BRIGHTNESS, sc->brightness);
break;
case 0x09:
sc->brightness += 8;
if (sc->brightness > 0x78)
sc->brightness = 0x78;
pm_set_brightness(sc->brightness);
pm_write_nvram(NVRAM_BRIGHTNESS, sc->brightness);
break;
}
}
| 28.40625 | 76 | 0.729098 |
310539792275da0201da56dea119e650be489c0e | 21,144 | h | C | src/svg/zoom_fit_svg.h | colinw7/CQIllustrator | 4e730054353e62b111bbef38de5faf4e3eea7fbb | [
"MIT"
] | 7 | 2016-04-24T23:15:34.000Z | 2021-12-23T02:21:09.000Z | src/svg/zoom_fit_svg.h | colinw7/CQIllustrator | 4e730054353e62b111bbef38de5faf4e3eea7fbb | [
"MIT"
] | 1 | 2019-12-21T21:24:48.000Z | 2019-12-22T00:32:25.000Z | src/svg/zoom_fit_svg.h | colinw7/CQIllustrator | 4e730054353e62b111bbef38de5faf4e3eea7fbb | [
"MIT"
] | 3 | 2019-04-01T13:19:42.000Z | 2021-09-18T07:52:56.000Z | #ifndef ZOOM_FIT_pixmap_H
#define ZOOM_FIT_pixmap_H
#include <CQPixmapCache.h>
class ZOOM_FIT_pixmap {
private:
uchar data_[3923] = {
0x3c,0x3f,0x78,0x6d,0x6c,0x20,0x76,0x65,0x72,0x73,0x69,0x6f,0x6e,0x3d,0x22,0x31,
0x2e,0x30,0x22,0x20,0x65,0x6e,0x63,0x6f,0x64,0x69,0x6e,0x67,0x3d,0x22,0x55,0x54,
0x46,0x2d,0x38,0x22,0x20,0x73,0x74,0x61,0x6e,0x64,0x61,0x6c,0x6f,0x6e,0x65,0x3d,
0x22,0x6e,0x6f,0x22,0x3f,0x3e,0x0a,0x3c,0x21,0x2d,0x2d,0x20,0x43,0x72,0x65,0x61,
0x74,0x65,0x64,0x20,0x77,0x69,0x74,0x68,0x20,0x49,0x6e,0x6b,0x73,0x63,0x61,0x70,
0x65,0x20,0x28,0x68,0x74,0x74,0x70,0x3a,0x2f,0x2f,0x77,0x77,0x77,0x2e,0x69,0x6e,
0x6b,0x73,0x63,0x61,0x70,0x65,0x2e,0x6f,0x72,0x67,0x2f,0x29,0x20,0x2d,0x2d,0x3e,
0x0a,0x0a,0x3c,0x73,0x76,0x67,0x0a,0x20,0x20,0x20,0x78,0x6d,0x6c,0x6e,0x73,0x3a,
0x64,0x63,0x3d,0x22,0x68,0x74,0x74,0x70,0x3a,0x2f,0x2f,0x70,0x75,0x72,0x6c,0x2e,
0x6f,0x72,0x67,0x2f,0x64,0x63,0x2f,0x65,0x6c,0x65,0x6d,0x65,0x6e,0x74,0x73,0x2f,
0x31,0x2e,0x31,0x2f,0x22,0x0a,0x20,0x20,0x20,0x78,0x6d,0x6c,0x6e,0x73,0x3a,0x63,
0x63,0x3d,0x22,0x68,0x74,0x74,0x70,0x3a,0x2f,0x2f,0x63,0x72,0x65,0x61,0x74,0x69,
0x76,0x65,0x63,0x6f,0x6d,0x6d,0x6f,0x6e,0x73,0x2e,0x6f,0x72,0x67,0x2f,0x6e,0x73,
0x23,0x22,0x0a,0x20,0x20,0x20,0x78,0x6d,0x6c,0x6e,0x73,0x3a,0x72,0x64,0x66,0x3d,
0x22,0x68,0x74,0x74,0x70,0x3a,0x2f,0x2f,0x77,0x77,0x77,0x2e,0x77,0x33,0x2e,0x6f,
0x72,0x67,0x2f,0x31,0x39,0x39,0x39,0x2f,0x30,0x32,0x2f,0x32,0x32,0x2d,0x72,0x64,
0x66,0x2d,0x73,0x79,0x6e,0x74,0x61,0x78,0x2d,0x6e,0x73,0x23,0x22,0x0a,0x20,0x20,
0x20,0x78,0x6d,0x6c,0x6e,0x73,0x3a,0x73,0x76,0x67,0x3d,0x22,0x68,0x74,0x74,0x70,
0x3a,0x2f,0x2f,0x77,0x77,0x77,0x2e,0x77,0x33,0x2e,0x6f,0x72,0x67,0x2f,0x32,0x30,
0x30,0x30,0x2f,0x73,0x76,0x67,0x22,0x0a,0x20,0x20,0x20,0x78,0x6d,0x6c,0x6e,0x73,
0x3d,0x22,0x68,0x74,0x74,0x70,0x3a,0x2f,0x2f,0x77,0x77,0x77,0x2e,0x77,0x33,0x2e,
0x6f,0x72,0x67,0x2f,0x32,0x30,0x30,0x30,0x2f,0x73,0x76,0x67,0x22,0x0a,0x20,0x20,
0x20,0x78,0x6d,0x6c,0x6e,0x73,0x3a,0x73,0x6f,0x64,0x69,0x70,0x6f,0x64,0x69,0x3d,
0x22,0x68,0x74,0x74,0x70,0x3a,0x2f,0x2f,0x73,0x6f,0x64,0x69,0x70,0x6f,0x64,0x69,
0x2e,0x73,0x6f,0x75,0x72,0x63,0x65,0x66,0x6f,0x72,0x67,0x65,0x2e,0x6e,0x65,0x74,
0x2f,0x44,0x54,0x44,0x2f,0x73,0x6f,0x64,0x69,0x70,0x6f,0x64,0x69,0x2d,0x30,0x2e,
0x64,0x74,0x64,0x22,0x0a,0x20,0x20,0x20,0x78,0x6d,0x6c,0x6e,0x73,0x3a,0x69,0x6e,
0x6b,0x73,0x63,0x61,0x70,0x65,0x3d,0x22,0x68,0x74,0x74,0x70,0x3a,0x2f,0x2f,0x77,
0x77,0x77,0x2e,0x69,0x6e,0x6b,0x73,0x63,0x61,0x70,0x65,0x2e,0x6f,0x72,0x67,0x2f,
0x6e,0x61,0x6d,0x65,0x73,0x70,0x61,0x63,0x65,0x73,0x2f,0x69,0x6e,0x6b,0x73,0x63,
0x61,0x70,0x65,0x22,0x0a,0x20,0x20,0x20,0x77,0x69,0x64,0x74,0x68,0x3d,0x22,0x34,
0x35,0x30,0x2e,0x35,0x32,0x38,0x30,0x35,0x22,0x0a,0x20,0x20,0x20,0x68,0x65,0x69,
0x67,0x68,0x74,0x3d,0x22,0x34,0x34,0x36,0x2e,0x34,0x38,0x37,0x34,0x33,0x22,0x0a,
0x20,0x20,0x20,0x69,0x64,0x3d,0x22,0x73,0x76,0x67,0x32,0x22,0x0a,0x20,0x20,0x20,
0x76,0x65,0x72,0x73,0x69,0x6f,0x6e,0x3d,0x22,0x31,0x2e,0x31,0x22,0x0a,0x20,0x20,
0x20,0x69,0x6e,0x6b,0x73,0x63,0x61,0x70,0x65,0x3a,0x76,0x65,0x72,0x73,0x69,0x6f,
0x6e,0x3d,0x22,0x30,0x2e,0x39,0x31,0x20,0x72,0x22,0x0a,0x20,0x20,0x20,0x73,0x6f,
0x64,0x69,0x70,0x6f,0x64,0x69,0x3a,0x64,0x6f,0x63,0x6e,0x61,0x6d,0x65,0x3d,0x22,
0x7a,0x6f,0x6f,0x6d,0x5f,0x66,0x69,0x74,0x2e,0x73,0x76,0x67,0x22,0x3e,0x0a,0x20,
0x20,0x3c,0x64,0x65,0x66,0x73,0x0a,0x20,0x20,0x20,0x20,0x20,0x69,0x64,0x3d,0x22,
0x64,0x65,0x66,0x73,0x34,0x22,0x20,0x2f,0x3e,0x0a,0x20,0x20,0x3c,0x73,0x6f,0x64,
0x69,0x70,0x6f,0x64,0x69,0x3a,0x6e,0x61,0x6d,0x65,0x64,0x76,0x69,0x65,0x77,0x0a,
0x20,0x20,0x20,0x20,0x20,0x69,0x64,0x3d,0x22,0x62,0x61,0x73,0x65,0x22,0x0a,0x20,
0x20,0x20,0x20,0x20,0x70,0x61,0x67,0x65,0x63,0x6f,0x6c,0x6f,0x72,0x3d,0x22,0x23,
0x66,0x66,0x66,0x66,0x66,0x66,0x22,0x0a,0x20,0x20,0x20,0x20,0x20,0x62,0x6f,0x72,
0x64,0x65,0x72,0x63,0x6f,0x6c,0x6f,0x72,0x3d,0x22,0x23,0x36,0x36,0x36,0x36,0x36,
0x36,0x22,0x0a,0x20,0x20,0x20,0x20,0x20,0x62,0x6f,0x72,0x64,0x65,0x72,0x6f,0x70,
0x61,0x63,0x69,0x74,0x79,0x3d,0x22,0x31,0x2e,0x30,0x22,0x0a,0x20,0x20,0x20,0x20,
0x20,0x69,0x6e,0x6b,0x73,0x63,0x61,0x70,0x65,0x3a,0x70,0x61,0x67,0x65,0x6f,0x70,
0x61,0x63,0x69,0x74,0x79,0x3d,0x22,0x30,0x2e,0x30,0x22,0x0a,0x20,0x20,0x20,0x20,
0x20,0x69,0x6e,0x6b,0x73,0x63,0x61,0x70,0x65,0x3a,0x70,0x61,0x67,0x65,0x73,0x68,
0x61,0x64,0x6f,0x77,0x3d,0x22,0x32,0x22,0x0a,0x20,0x20,0x20,0x20,0x20,0x69,0x6e,
0x6b,0x73,0x63,0x61,0x70,0x65,0x3a,0x7a,0x6f,0x6f,0x6d,0x3d,0x22,0x31,0x2e,0x34,
0x22,0x0a,0x20,0x20,0x20,0x20,0x20,0x69,0x6e,0x6b,0x73,0x63,0x61,0x70,0x65,0x3a,
0x63,0x78,0x3d,0x22,0x32,0x30,0x33,0x2e,0x36,0x36,0x34,0x34,0x38,0x22,0x0a,0x20,
0x20,0x20,0x20,0x20,0x69,0x6e,0x6b,0x73,0x63,0x61,0x70,0x65,0x3a,0x63,0x79,0x3d,
0x22,0x32,0x32,0x39,0x2e,0x38,0x34,0x30,0x34,0x33,0x22,0x0a,0x20,0x20,0x20,0x20,
0x20,0x69,0x6e,0x6b,0x73,0x63,0x61,0x70,0x65,0x3a,0x64,0x6f,0x63,0x75,0x6d,0x65,
0x6e,0x74,0x2d,0x75,0x6e,0x69,0x74,0x73,0x3d,0x22,0x70,0x78,0x22,0x0a,0x20,0x20,
0x20,0x20,0x20,0x69,0x6e,0x6b,0x73,0x63,0x61,0x70,0x65,0x3a,0x63,0x75,0x72,0x72,
0x65,0x6e,0x74,0x2d,0x6c,0x61,0x79,0x65,0x72,0x3d,0x22,0x6c,0x61,0x79,0x65,0x72,
0x31,0x22,0x0a,0x20,0x20,0x20,0x20,0x20,0x73,0x68,0x6f,0x77,0x67,0x72,0x69,0x64,
0x3d,0x22,0x66,0x61,0x6c,0x73,0x65,0x22,0x0a,0x20,0x20,0x20,0x20,0x20,0x69,0x6e,
0x6b,0x73,0x63,0x61,0x70,0x65,0x3a,0x77,0x69,0x6e,0x64,0x6f,0x77,0x2d,0x77,0x69,
0x64,0x74,0x68,0x3d,0x22,0x31,0x39,0x36,0x35,0x22,0x0a,0x20,0x20,0x20,0x20,0x20,
0x69,0x6e,0x6b,0x73,0x63,0x61,0x70,0x65,0x3a,0x77,0x69,0x6e,0x64,0x6f,0x77,0x2d,
0x68,0x65,0x69,0x67,0x68,0x74,0x3d,0x22,0x31,0x34,0x33,0x31,0x22,0x0a,0x20,0x20,
0x20,0x20,0x20,0x69,0x6e,0x6b,0x73,0x63,0x61,0x70,0x65,0x3a,0x77,0x69,0x6e,0x64,
0x6f,0x77,0x2d,0x78,0x3d,0x22,0x31,0x37,0x38,0x22,0x0a,0x20,0x20,0x20,0x20,0x20,
0x69,0x6e,0x6b,0x73,0x63,0x61,0x70,0x65,0x3a,0x77,0x69,0x6e,0x64,0x6f,0x77,0x2d,
0x79,0x3d,0x22,0x31,0x35,0x30,0x22,0x0a,0x20,0x20,0x20,0x20,0x20,0x69,0x6e,0x6b,
0x73,0x63,0x61,0x70,0x65,0x3a,0x77,0x69,0x6e,0x64,0x6f,0x77,0x2d,0x6d,0x61,0x78,
0x69,0x6d,0x69,0x7a,0x65,0x64,0x3d,0x22,0x30,0x22,0x0a,0x20,0x20,0x20,0x20,0x20,
0x66,0x69,0x74,0x2d,0x6d,0x61,0x72,0x67,0x69,0x6e,0x2d,0x74,0x6f,0x70,0x3d,0x22,
0x30,0x22,0x0a,0x20,0x20,0x20,0x20,0x20,0x66,0x69,0x74,0x2d,0x6d,0x61,0x72,0x67,
0x69,0x6e,0x2d,0x6c,0x65,0x66,0x74,0x3d,0x22,0x30,0x22,0x0a,0x20,0x20,0x20,0x20,
0x20,0x66,0x69,0x74,0x2d,0x6d,0x61,0x72,0x67,0x69,0x6e,0x2d,0x72,0x69,0x67,0x68,
0x74,0x3d,0x22,0x30,0x22,0x0a,0x20,0x20,0x20,0x20,0x20,0x66,0x69,0x74,0x2d,0x6d,
0x61,0x72,0x67,0x69,0x6e,0x2d,0x62,0x6f,0x74,0x74,0x6f,0x6d,0x3d,0x22,0x30,0x22,
0x20,0x2f,0x3e,0x0a,0x20,0x20,0x3c,0x6d,0x65,0x74,0x61,0x64,0x61,0x74,0x61,0x0a,
0x20,0x20,0x20,0x20,0x20,0x69,0x64,0x3d,0x22,0x6d,0x65,0x74,0x61,0x64,0x61,0x74,
0x61,0x37,0x22,0x3e,0x0a,0x20,0x20,0x20,0x20,0x3c,0x72,0x64,0x66,0x3a,0x52,0x44,
0x46,0x3e,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x3c,0x63,0x63,0x3a,0x57,0x6f,0x72,
0x6b,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x72,0x64,0x66,0x3a,0x61,
0x62,0x6f,0x75,0x74,0x3d,0x22,0x22,0x3e,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,
0x20,0x3c,0x64,0x63,0x3a,0x66,0x6f,0x72,0x6d,0x61,0x74,0x3e,0x69,0x6d,0x61,0x67,
0x65,0x2f,0x73,0x76,0x67,0x2b,0x78,0x6d,0x6c,0x3c,0x2f,0x64,0x63,0x3a,0x66,0x6f,
0x72,0x6d,0x61,0x74,0x3e,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x3c,0x64,
0x63,0x3a,0x74,0x79,0x70,0x65,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,
0x20,0x20,0x72,0x64,0x66,0x3a,0x72,0x65,0x73,0x6f,0x75,0x72,0x63,0x65,0x3d,0x22,
0x68,0x74,0x74,0x70,0x3a,0x2f,0x2f,0x70,0x75,0x72,0x6c,0x2e,0x6f,0x72,0x67,0x2f,
0x64,0x63,0x2f,0x64,0x63,0x6d,0x69,0x74,0x79,0x70,0x65,0x2f,0x53,0x74,0x69,0x6c,
0x6c,0x49,0x6d,0x61,0x67,0x65,0x22,0x20,0x2f,0x3e,0x0a,0x20,0x20,0x20,0x20,0x20,
0x20,0x20,0x20,0x3c,0x64,0x63,0x3a,0x74,0x69,0x74,0x6c,0x65,0x3e,0x3c,0x2f,0x64,
0x63,0x3a,0x74,0x69,0x74,0x6c,0x65,0x3e,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x3c,
0x2f,0x63,0x63,0x3a,0x57,0x6f,0x72,0x6b,0x3e,0x0a,0x20,0x20,0x20,0x20,0x3c,0x2f,
0x72,0x64,0x66,0x3a,0x52,0x44,0x46,0x3e,0x0a,0x20,0x20,0x3c,0x2f,0x6d,0x65,0x74,
0x61,0x64,0x61,0x74,0x61,0x3e,0x0a,0x20,0x20,0x3c,0x67,0x0a,0x20,0x20,0x20,0x20,
0x20,0x69,0x6e,0x6b,0x73,0x63,0x61,0x70,0x65,0x3a,0x6c,0x61,0x62,0x65,0x6c,0x3d,
0x22,0x4c,0x61,0x79,0x65,0x72,0x20,0x31,0x22,0x0a,0x20,0x20,0x20,0x20,0x20,0x69,
0x6e,0x6b,0x73,0x63,0x61,0x70,0x65,0x3a,0x67,0x72,0x6f,0x75,0x70,0x6d,0x6f,0x64,
0x65,0x3d,0x22,0x6c,0x61,0x79,0x65,0x72,0x22,0x0a,0x20,0x20,0x20,0x20,0x20,0x69,
0x64,0x3d,0x22,0x6c,0x61,0x79,0x65,0x72,0x31,0x22,0x0a,0x20,0x20,0x20,0x20,0x20,
0x74,0x72,0x61,0x6e,0x73,0x66,0x6f,0x72,0x6d,0x3d,0x22,0x74,0x72,0x61,0x6e,0x73,
0x6c,0x61,0x74,0x65,0x28,0x34,0x2e,0x37,0x38,0x36,0x36,0x38,0x39,0x36,0x2c,0x37,
0x2e,0x35,0x33,0x33,0x36,0x33,0x32,0x33,0x29,0x22,0x3e,0x0a,0x20,0x20,0x20,0x20,
0x3c,0x72,0x65,0x63,0x74,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x73,0x74,0x79,
0x6c,0x65,0x3d,0x22,0x63,0x6f,0x6c,0x6f,0x72,0x3a,0x23,0x30,0x30,0x30,0x30,0x30,
0x30,0x3b,0x63,0x6c,0x69,0x70,0x2d,0x72,0x75,0x6c,0x65,0x3a,0x6e,0x6f,0x6e,0x7a,
0x65,0x72,0x6f,0x3b,0x64,0x69,0x73,0x70,0x6c,0x61,0x79,0x3a,0x69,0x6e,0x6c,0x69,
0x6e,0x65,0x3b,0x6f,0x76,0x65,0x72,0x66,0x6c,0x6f,0x77,0x3a,0x76,0x69,0x73,0x69,
0x62,0x6c,0x65,0x3b,0x76,0x69,0x73,0x69,0x62,0x69,0x6c,0x69,0x74,0x79,0x3a,0x76,
0x69,0x73,0x69,0x62,0x6c,0x65,0x3b,0x6f,0x70,0x61,0x63,0x69,0x74,0x79,0x3a,0x31,
0x3b,0x69,0x73,0x6f,0x6c,0x61,0x74,0x69,0x6f,0x6e,0x3a,0x61,0x75,0x74,0x6f,0x3b,
0x6d,0x69,0x78,0x2d,0x62,0x6c,0x65,0x6e,0x64,0x2d,0x6d,0x6f,0x64,0x65,0x3a,0x6e,
0x6f,0x72,0x6d,0x61,0x6c,0x3b,0x63,0x6f,0x6c,0x6f,0x72,0x2d,0x69,0x6e,0x74,0x65,
0x72,0x70,0x6f,0x6c,0x61,0x74,0x69,0x6f,0x6e,0x3a,0x73,0x52,0x47,0x42,0x3b,0x63,
0x6f,0x6c,0x6f,0x72,0x2d,0x69,0x6e,0x74,0x65,0x72,0x70,0x6f,0x6c,0x61,0x74,0x69,
0x6f,0x6e,0x2d,0x66,0x69,0x6c,0x74,0x65,0x72,0x73,0x3a,0x6c,0x69,0x6e,0x65,0x61,
0x72,0x52,0x47,0x42,0x3b,0x73,0x6f,0x6c,0x69,0x64,0x2d,0x63,0x6f,0x6c,0x6f,0x72,
0x3a,0x23,0x30,0x30,0x30,0x30,0x30,0x30,0x3b,0x73,0x6f,0x6c,0x69,0x64,0x2d,0x6f,
0x70,0x61,0x63,0x69,0x74,0x79,0x3a,0x31,0x3b,0x66,0x69,0x6c,0x6c,0x3a,0x23,0x66,
0x66,0x66,0x66,0x66,0x66,0x3b,0x66,0x69,0x6c,0x6c,0x2d,0x6f,0x70,0x61,0x63,0x69,
0x74,0x79,0x3a,0x31,0x3b,0x66,0x69,0x6c,0x6c,0x2d,0x72,0x75,0x6c,0x65,0x3a,0x65,
0x76,0x65,0x6e,0x6f,0x64,0x64,0x3b,0x73,0x74,0x72,0x6f,0x6b,0x65,0x3a,0x23,0x30,
0x30,0x30,0x30,0x30,0x30,0x3b,0x73,0x74,0x72,0x6f,0x6b,0x65,0x2d,0x77,0x69,0x64,
0x74,0x68,0x3a,0x32,0x30,0x3b,0x73,0x74,0x72,0x6f,0x6b,0x65,0x2d,0x6c,0x69,0x6e,
0x65,0x63,0x61,0x70,0x3a,0x73,0x71,0x75,0x61,0x72,0x65,0x3b,0x73,0x74,0x72,0x6f,
0x6b,0x65,0x2d,0x6c,0x69,0x6e,0x65,0x6a,0x6f,0x69,0x6e,0x3a,0x6d,0x69,0x74,0x65,
0x72,0x3b,0x73,0x74,0x72,0x6f,0x6b,0x65,0x2d,0x6d,0x69,0x74,0x65,0x72,0x6c,0x69,
0x6d,0x69,0x74,0x3a,0x34,0x3b,0x73,0x74,0x72,0x6f,0x6b,0x65,0x2d,0x64,0x61,0x73,
0x68,0x61,0x72,0x72,0x61,0x79,0x3a,0x6e,0x6f,0x6e,0x65,0x3b,0x73,0x74,0x72,0x6f,
0x6b,0x65,0x2d,0x64,0x61,0x73,0x68,0x6f,0x66,0x66,0x73,0x65,0x74,0x3a,0x33,0x30,
0x30,0x3b,0x73,0x74,0x72,0x6f,0x6b,0x65,0x2d,0x6f,0x70,0x61,0x63,0x69,0x74,0x79,
0x3a,0x31,0x3b,0x63,0x6f,0x6c,0x6f,0x72,0x2d,0x72,0x65,0x6e,0x64,0x65,0x72,0x69,
0x6e,0x67,0x3a,0x61,0x75,0x74,0x6f,0x3b,0x69,0x6d,0x61,0x67,0x65,0x2d,0x72,0x65,
0x6e,0x64,0x65,0x72,0x69,0x6e,0x67,0x3a,0x61,0x75,0x74,0x6f,0x3b,0x73,0x68,0x61,
0x70,0x65,0x2d,0x72,0x65,0x6e,0x64,0x65,0x72,0x69,0x6e,0x67,0x3a,0x61,0x75,0x74,
0x6f,0x3b,0x74,0x65,0x78,0x74,0x2d,0x72,0x65,0x6e,0x64,0x65,0x72,0x69,0x6e,0x67,
0x3a,0x61,0x75,0x74,0x6f,0x3b,0x65,0x6e,0x61,0x62,0x6c,0x65,0x2d,0x62,0x61,0x63,
0x6b,0x67,0x72,0x6f,0x75,0x6e,0x64,0x3a,0x61,0x63,0x63,0x75,0x6d,0x75,0x6c,0x61,
0x74,0x65,0x22,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x69,0x64,0x3d,0x22,0x72,
0x65,0x63,0x74,0x34,0x31,0x34,0x30,0x22,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,
0x77,0x69,0x64,0x74,0x68,0x3d,0x22,0x33,0x39,0x38,0x2e,0x35,0x37,0x31,0x34,0x31,
0x22,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x68,0x65,0x69,0x67,0x68,0x74,0x3d,
0x22,0x33,0x34,0x35,0x2e,0x37,0x31,0x34,0x32,0x39,0x22,0x0a,0x20,0x20,0x20,0x20,
0x20,0x20,0x20,0x78,0x3d,0x22,0x32,0x30,0x2e,0x32,0x31,0x33,0x33,0x31,0x22,0x0a,
0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x79,0x3d,0x22,0x31,0x39,0x2e,0x36,0x36,0x38,
0x30,0x38,0x31,0x22,0x20,0x2f,0x3e,0x0a,0x20,0x20,0x20,0x20,0x3c,0x65,0x6c,0x6c,
0x69,0x70,0x73,0x65,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x72,0x79,0x3d,0x22,
0x31,0x32,0x38,0x2e,0x32,0x38,0x35,0x30,0x32,0x22,0x0a,0x20,0x20,0x20,0x20,0x20,
0x20,0x20,0x72,0x78,0x3d,0x22,0x31,0x33,0x36,0x2e,0x38,0x33,0x37,0x33,0x36,0x22,
0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x63,0x79,0x3d,0x22,0x31,0x39,0x39,0x2e,
0x30,0x34,0x38,0x35,0x35,0x22,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x63,0x78,
0x3d,0x22,0x31,0x39,0x36,0x2e,0x32,0x36,0x36,0x35,0x36,0x22,0x0a,0x20,0x20,0x20,
0x20,0x20,0x20,0x20,0x73,0x74,0x79,0x6c,0x65,0x3d,0x22,0x66,0x69,0x6c,0x6c,0x3a,
0x6e,0x6f,0x6e,0x65,0x3b,0x73,0x74,0x72,0x6f,0x6b,0x65,0x3a,0x23,0x32,0x38,0x32,
0x38,0x64,0x63,0x3b,0x73,0x74,0x72,0x6f,0x6b,0x65,0x2d,0x77,0x69,0x64,0x74,0x68,
0x3a,0x34,0x32,0x2e,0x33,0x33,0x31,0x38,0x39,0x37,0x37,0x34,0x3b,0x73,0x74,0x72,
0x6f,0x6b,0x65,0x2d,0x6c,0x69,0x6e,0x65,0x63,0x61,0x70,0x3a,0x72,0x6f,0x75,0x6e,
0x64,0x3b,0x73,0x74,0x72,0x6f,0x6b,0x65,0x2d,0x6d,0x69,0x74,0x65,0x72,0x6c,0x69,
0x6d,0x69,0x74,0x3a,0x34,0x3b,0x73,0x74,0x72,0x6f,0x6b,0x65,0x2d,0x64,0x61,0x73,
0x68,0x61,0x72,0x72,0x61,0x79,0x3a,0x6e,0x6f,0x6e,0x65,0x3b,0x73,0x74,0x72,0x6f,
0x6b,0x65,0x2d,0x64,0x61,0x73,0x68,0x6f,0x66,0x66,0x73,0x65,0x74,0x3a,0x30,0x3b,
0x73,0x74,0x72,0x6f,0x6b,0x65,0x2d,0x6f,0x70,0x61,0x63,0x69,0x74,0x79,0x3a,0x31,
0x3b,0x6d,0x61,0x72,0x6b,0x65,0x72,0x2d,0x73,0x74,0x61,0x72,0x74,0x3a,0x6e,0x6f,
0x6e,0x65,0x22,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x69,0x64,0x3d,0x22,0x70,
0x61,0x74,0x68,0x32,0x39,0x38,0x35,0x22,0x20,0x2f,0x3e,0x0a,0x20,0x20,0x20,0x20,
0x3c,0x70,0x61,0x74,0x68,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x73,0x6f,0x64,
0x69,0x70,0x6f,0x64,0x69,0x3a,0x6e,0x6f,0x64,0x65,0x74,0x79,0x70,0x65,0x73,0x3d,
0x22,0x63,0x63,0x22,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x73,0x74,0x79,0x6c,
0x65,0x3d,0x22,0x66,0x69,0x6c,0x6c,0x3a,0x6e,0x6f,0x6e,0x65,0x3b,0x73,0x74,0x72,
0x6f,0x6b,0x65,0x3a,0x23,0x32,0x38,0x32,0x38,0x64,0x63,0x3b,0x73,0x74,0x72,0x6f,
0x6b,0x65,0x2d,0x77,0x69,0x64,0x74,0x68,0x3a,0x34,0x32,0x2e,0x33,0x33,0x31,0x38,
0x39,0x37,0x37,0x34,0x3b,0x73,0x74,0x72,0x6f,0x6b,0x65,0x2d,0x6c,0x69,0x6e,0x65,
0x63,0x61,0x70,0x3a,0x72,0x6f,0x75,0x6e,0x64,0x3b,0x73,0x74,0x72,0x6f,0x6b,0x65,
0x2d,0x6c,0x69,0x6e,0x65,0x6a,0x6f,0x69,0x6e,0x3a,0x6d,0x69,0x74,0x65,0x72,0x3b,
0x73,0x74,0x72,0x6f,0x6b,0x65,0x2d,0x6d,0x69,0x74,0x65,0x72,0x6c,0x69,0x6d,0x69,
0x74,0x3a,0x34,0x3b,0x73,0x74,0x72,0x6f,0x6b,0x65,0x2d,0x64,0x61,0x73,0x68,0x61,
0x72,0x72,0x61,0x79,0x3a,0x6e,0x6f,0x6e,0x65,0x3b,0x73,0x74,0x72,0x6f,0x6b,0x65,
0x2d,0x6f,0x70,0x61,0x63,0x69,0x74,0x79,0x3a,0x31,0x22,0x0a,0x20,0x20,0x20,0x20,
0x20,0x20,0x20,0x64,0x3d,0x22,0x6d,0x20,0x32,0x39,0x30,0x2e,0x33,0x34,0x32,0x32,
0x33,0x2c,0x32,0x39,0x31,0x2e,0x34,0x31,0x33,0x37,0x39,0x20,0x31,0x30,0x34,0x2e,
0x39,0x37,0x38,0x36,0x35,0x2c,0x39,0x39,0x2e,0x38,0x32,0x38,0x31,0x34,0x22,0x0a,
0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x69,0x64,0x3d,0x22,0x70,0x61,0x74,0x68,0x33,
0x37,0x35,0x35,0x22,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x69,0x6e,0x6b,0x73,
0x63,0x61,0x70,0x65,0x3a,0x63,0x6f,0x6e,0x6e,0x65,0x63,0x74,0x6f,0x72,0x2d,0x63,
0x75,0x72,0x76,0x61,0x74,0x75,0x72,0x65,0x3d,0x22,0x30,0x22,0x20,0x2f,0x3e,0x0a,
0x20,0x20,0x20,0x20,0x3c,0x67,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x69,0x64,
0x3d,0x22,0x67,0x33,0x39,0x34,0x31,0x22,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,
0x74,0x72,0x61,0x6e,0x73,0x66,0x6f,0x72,0x6d,0x3d,0x22,0x6d,0x61,0x74,0x72,0x69,
0x78,0x28,0x30,0x2e,0x38,0x34,0x36,0x36,0x33,0x37,0x39,0x32,0x2c,0x30,0x2c,0x30,
0x2c,0x30,0x2e,0x38,0x34,0x36,0x36,0x33,0x37,0x39,0x32,0x2c,0x2d,0x34,0x36,0x2e,
0x36,0x31,0x39,0x37,0x34,0x38,0x2c,0x2d,0x31,0x37,0x30,0x2e,0x32,0x32,0x38,0x37,
0x36,0x29,0x22,0x3e,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x3c,0x70,0x61,0x74,0x68,
0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x69,0x6e,0x6b,0x73,0x63,0x61,
0x70,0x65,0x3a,0x63,0x6f,0x6e,0x6e,0x65,0x63,0x74,0x6f,0x72,0x2d,0x63,0x75,0x72,
0x76,0x61,0x74,0x75,0x72,0x65,0x3d,0x22,0x30,0x22,0x0a,0x20,0x20,0x20,0x20,0x20,
0x20,0x20,0x20,0x20,0x69,0x64,0x3d,0x22,0x70,0x61,0x74,0x68,0x33,0x39,0x33,0x37,
0x22,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x64,0x3d,0x22,0x6d,0x20,
0x32,0x39,0x30,0x2e,0x39,0x32,0x33,0x39,0x33,0x2c,0x33,0x37,0x36,0x2e,0x35,0x38,
0x35,0x31,0x20,0x30,0x2c,0x31,0x31,0x36,0x2e,0x39,0x34,0x34,0x37,0x31,0x22,0x0a,
0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x73,0x74,0x79,0x6c,0x65,0x3d,0x22,
0x66,0x69,0x6c,0x6c,0x3a,0x6e,0x6f,0x6e,0x65,0x3b,0x73,0x74,0x72,0x6f,0x6b,0x65,
0x3a,0x23,0x30,0x30,0x30,0x30,0x30,0x30,0x3b,0x73,0x74,0x72,0x6f,0x6b,0x65,0x2d,
0x77,0x69,0x64,0x74,0x68,0x3a,0x34,0x30,0x3b,0x73,0x74,0x72,0x6f,0x6b,0x65,0x2d,
0x6c,0x69,0x6e,0x65,0x63,0x61,0x70,0x3a,0x73,0x71,0x75,0x61,0x72,0x65,0x3b,0x73,
0x74,0x72,0x6f,0x6b,0x65,0x2d,0x6c,0x69,0x6e,0x65,0x6a,0x6f,0x69,0x6e,0x3a,0x6d,
0x69,0x74,0x65,0x72,0x3b,0x73,0x74,0x72,0x6f,0x6b,0x65,0x2d,0x6d,0x69,0x74,0x65,
0x72,0x6c,0x69,0x6d,0x69,0x74,0x3a,0x34,0x3b,0x73,0x74,0x72,0x6f,0x6b,0x65,0x2d,
0x64,0x61,0x73,0x68,0x61,0x72,0x72,0x61,0x79,0x3a,0x6e,0x6f,0x6e,0x65,0x3b,0x73,
0x74,0x72,0x6f,0x6b,0x65,0x2d,0x6f,0x70,0x61,0x63,0x69,0x74,0x79,0x3a,0x31,0x22,
0x20,0x2f,0x3e,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x3c,0x70,0x61,0x74,0x68,0x0a,
0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x69,0x6e,0x6b,0x73,0x63,0x61,0x70,
0x65,0x3a,0x63,0x6f,0x6e,0x6e,0x65,0x63,0x74,0x6f,0x72,0x2d,0x63,0x75,0x72,0x76,
0x61,0x74,0x75,0x72,0x65,0x3d,0x22,0x30,0x22,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,
0x20,0x20,0x20,0x69,0x64,0x3d,0x22,0x70,0x61,0x74,0x68,0x33,0x39,0x33,0x39,0x22,
0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x64,0x3d,0x22,0x6d,0x20,0x32,
0x33,0x30,0x2e,0x31,0x36,0x39,0x39,0x36,0x2c,0x34,0x33,0x36,0x2e,0x31,0x34,0x38,
0x38,0x32,0x20,0x31,0x31,0x35,0x2e,0x35,0x36,0x38,0x38,0x38,0x2c,0x30,0x22,0x0a,
0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x73,0x74,0x79,0x6c,0x65,0x3d,0x22,
0x66,0x69,0x6c,0x6c,0x3a,0x6e,0x6f,0x6e,0x65,0x3b,0x73,0x74,0x72,0x6f,0x6b,0x65,
0x3a,0x23,0x30,0x30,0x30,0x30,0x30,0x30,0x3b,0x73,0x74,0x72,0x6f,0x6b,0x65,0x2d,
0x77,0x69,0x64,0x74,0x68,0x3a,0x34,0x30,0x3b,0x73,0x74,0x72,0x6f,0x6b,0x65,0x2d,
0x6c,0x69,0x6e,0x65,0x63,0x61,0x70,0x3a,0x73,0x71,0x75,0x61,0x72,0x65,0x3b,0x73,
0x74,0x72,0x6f,0x6b,0x65,0x2d,0x6c,0x69,0x6e,0x65,0x6a,0x6f,0x69,0x6e,0x3a,0x6d,
0x69,0x74,0x65,0x72,0x3b,0x73,0x74,0x72,0x6f,0x6b,0x65,0x2d,0x6d,0x69,0x74,0x65,
0x72,0x6c,0x69,0x6d,0x69,0x74,0x3a,0x34,0x3b,0x73,0x74,0x72,0x6f,0x6b,0x65,0x2d,
0x64,0x61,0x73,0x68,0x61,0x72,0x72,0x61,0x79,0x3a,0x6e,0x6f,0x6e,0x65,0x3b,0x73,
0x74,0x72,0x6f,0x6b,0x65,0x2d,0x6f,0x70,0x61,0x63,0x69,0x74,0x79,0x3a,0x31,0x22,
0x20,0x2f,0x3e,0x0a,0x20,0x20,0x20,0x20,0x3c,0x2f,0x67,0x3e,0x0a,0x20,0x20,0x20,
0x20,0x3c,0x72,0x65,0x63,0x74,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x73,0x74,
0x79,0x6c,0x65,0x3d,0x22,0x66,0x69,0x6c,0x6c,0x3a,0x6e,0x6f,0x6e,0x65,0x3b,0x73,
0x74,0x72,0x6f,0x6b,0x65,0x3a,0x6e,0x6f,0x6e,0x65,0x22,0x0a,0x20,0x20,0x20,0x20,
0x20,0x20,0x20,0x69,0x64,0x3d,0x22,0x72,0x65,0x63,0x74,0x32,0x39,0x38,0x38,0x22,
0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x77,0x69,0x64,0x74,0x68,0x3d,0x22,0x34,
0x35,0x30,0x2e,0x35,0x32,0x38,0x30,0x35,0x22,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,
0x20,0x68,0x65,0x69,0x67,0x68,0x74,0x3d,0x22,0x34,0x34,0x36,0x2e,0x34,0x38,0x37,
0x34,0x33,0x22,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x78,0x3d,0x22,0x2d,0x32,
0x30,0x2e,0x32,0x30,0x33,0x30,0x35,0x31,0x22,0x0a,0x20,0x20,0x20,0x20,0x20,0x20,
0x20,0x79,0x3d,0x22,0x2d,0x32,0x30,0x2e,0x36,0x38,0x37,0x37,0x36,0x31,0x22,0x0a,
0x20,0x20,0x20,0x20,0x20,0x20,0x20,0x74,0x72,0x61,0x6e,0x73,0x66,0x6f,0x72,0x6d,
0x3d,0x22,0x74,0x72,0x61,0x6e,0x73,0x6c,0x61,0x74,0x65,0x28,0x31,0x35,0x2e,0x34,
0x31,0x36,0x33,0x36,0x31,0x2c,0x31,0x33,0x2e,0x31,0x35,0x34,0x31,0x32,0x39,0x29,
0x22,0x20,0x2f,0x3e,0x0a,0x20,0x20,0x3c,0x2f,0x67,0x3e,0x0a,0x3c,0x2f,0x73,0x76,
0x67,0x3e,0x0a,
};
public:
ZOOM_FIT_pixmap() {
CQPixmapCache::instance()->addData("ZOOM_FIT", data_, 3923);
}
};
static ZOOM_FIT_pixmap s_ZOOM_FIT_pixmap;
#endif
| 79.488722 | 84 | 0.752412 |
310694a9bb6219923450b42c81808ad8471d3139 | 74 | h | C | utils/knox_manager.h | esc0rtd3w/android_root | 2048c75ef4fdd6019f05784c670f925bb90c1a69 | [
"MIT"
] | 1 | 2021-11-15T06:36:54.000Z | 2021-11-15T06:36:54.000Z | utils/knox_manager.h | dizzydezz/android_root | 2048c75ef4fdd6019f05784c670f925bb90c1a69 | [
"MIT"
] | null | null | null | utils/knox_manager.h | dizzydezz/android_root | 2048c75ef4fdd6019f05784c670f925bb90c1a69 | [
"MIT"
] | 3 | 2019-01-25T06:12:55.000Z | 2021-07-27T20:05:53.000Z | int is_knox_present(void);
int remove_knox(void);
int restore_knox(void);
| 18.5 | 26 | 0.797297 |
3106baca1efe1f8eb7c7eb164175c14d717a4f03 | 288 | h | C | DelegateExample/AppDelegate.h | harshal-wani/SwiftFrameworkDelegateExample | acffbb17f907339c3765da04e6cdcf61fe41da27 | [
"Apache-2.0"
] | null | null | null | DelegateExample/AppDelegate.h | harshal-wani/SwiftFrameworkDelegateExample | acffbb17f907339c3765da04e6cdcf61fe41da27 | [
"Apache-2.0"
] | null | null | null | DelegateExample/AppDelegate.h | harshal-wani/SwiftFrameworkDelegateExample | acffbb17f907339c3765da04e6cdcf61fe41da27 | [
"Apache-2.0"
] | null | null | null | //
// AppDelegate.h
// DelegateExample
//
// Created by Harshal Wani on 22/08/19.
// Copyright © 2019 Harshal Wani. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface AppDelegate : UIResponder <UIApplicationDelegate>
@property (strong, nonatomic) UIWindow *window;
@end
| 16 | 60 | 0.711806 |
3109a4bf1bd36e27001df513f65d458588341a63 | 10,386 | h | C | MK4duo/src/platform/HAL_DUE/HAL_timers.h | DapDeveloper/MK4duo | 385fdcd3cda94e73396dd12f23ff570c86d2eab5 | [
"RSA-MD"
] | null | null | null | MK4duo/src/platform/HAL_DUE/HAL_timers.h | DapDeveloper/MK4duo | 385fdcd3cda94e73396dd12f23ff570c86d2eab5 | [
"RSA-MD"
] | null | null | null | MK4duo/src/platform/HAL_DUE/HAL_timers.h | DapDeveloper/MK4duo | 385fdcd3cda94e73396dd12f23ff570c86d2eab5 | [
"RSA-MD"
] | null | null | null | /**
* MK4duo Firmware for 3D Printer, Laser and CNC
*
* Based on Marlin, Sprinter and grbl
* Copyright (C) 2011 Camiel Gubbels / Erik van der Zalm
* Copyright (C) 2019 Alberto Cotronei @MagoKimbra
*
* 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 3 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, see <http://www.gnu.org/licenses/>.
*
*/
/**
* This is the main Hardware Abstraction Layer (HAL).
* To make the firmware work with different processors and toolchains,
* all hardware related code should be packed into the hal files.
*
* 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 3 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, see <http://www.gnu.org/licenses/>.
*
*
* Description: HAL for Arduino Due and compatible (SAM3X8E)
*
* Contributors:
* Copyright (c) 2014 Bob Cousins bobcousins42@googlemail.com
* Nico Tonnhofer wurstnase.reprap@gmail.com
*
* Copyright (c) 2019 Alberto Cotronei @MagoKimbra
*
* ARDUINO_ARCH_SAM
*/
#pragma once
// --------------------------------------------------------------------------
// Includes
// --------------------------------------------------------------------------
#include <stdint.h>
// --------------------------------------------------------------------------
// Defines
// --------------------------------------------------------------------------
#define NUM_HARDWARE_TIMERS 9
#define NvicPriorityUart 1
#define NvicPrioritySystick 15
#define HAL_TIMER_RATE ((F_CPU) / 2) // 42 MHz
#define HAL_ACCELERATION_RATE (4096.0 * 4096.0 * 256.0 / (HAL_TIMER_RATE))
#define STEPPER_TC (TC1)
#define STEPPER_TIMER 4
#define STEPPER_TIMER_ISR() void TC4_Handler()
#define STEPPER_TIMER_RATE HAL_TIMER_RATE
#define STEPPER_TIMER_TICKS_PER_US ((STEPPER_TIMER_RATE) / 1000000) // 42 - stepper timer ticks per µs
#define STEPPER_TIMER_PRESCALE ((F_CPU / 1000000UL) / STEPPER_TIMER_TICKS_PER_US) // 2
#define STEPPER_TIMER_MIN_INTERVAL 1 // minimum time in µs between stepper interrupts
#define STEPPER_TIMER_MAX_INTERVAL (STEPPER_TIMER_TICKS_PER_US * STEPPER_TIMER_MIN_INTERVAL) // maximum time in µs between stepper interrupts
#define STEPPER_CLOCK_RATE ((F_CPU) / 128) // frequency of the clock used for stepper pulse timing
#define PULSE_TIMER_PRESCALE STEPPER_TIMER_PRESCALE
#define AD_PRESCALE_FACTOR 84 // 500 kHz ADC clock
#define AD_TRACKING_CYCLES 4 // 0 - 15 + 1 adc clock cycles
#define AD_TRANSFER_CYCLES 1 // 0 - 3 * 2 + 3 adc clock cycles
#define ADC_ISR_EOC(channel) (0x1u << channel)
#define ENABLE_STEPPER_INTERRUPT() HAL_timer_enable_interrupt(STEPPER_TIMER)
#define DISABLE_STEPPER_INTERRUPT() HAL_timer_disable_interrupt(STEPPER_TIMER)
#define STEPPER_ISR_ENABLED() HAL_timer_interrupt_is_enabled(STEPPER_TIMER)
// Estimate the amount of time the ISR will take to execute
// The base ISR takes 792 cycles
#define ISR_BASE_CYCLES 792UL
// Linear advance base time is 64 cycles
#if ENABLED(LIN_ADVANCE)
#define ISR_LA_BASE_CYCLES 64UL
#else
#define ISR_LA_BASE_CYCLES 0UL
#endif
// Bezier interpolation adds 40 cycles
#if ENABLED(BEZIER_JERK_CONTROL)
#define ISR_BEZIER_CYCLES 40UL
#else
#define ISR_BEZIER_CYCLES 0UL
#endif
// Stepper Loop base cycles
#define ISR_LOOP_BASE_CYCLES 4UL
// To start the step pulse, in the worst case takes
#define ISR_START_STEPPER_CYCLES 13UL
// And each stepper (start + stop pulse) takes in worst case
#define ISR_STEPPER_CYCLES 16UL
// For each stepper, we add its time
#if HAS_X_STEP
#define ISR_START_X_STEPPER_CYCLES ISR_START_STEPPER_CYCLES
#define ISR_X_STEPPER_CYCLES ISR_STEPPER_CYCLES
#else
#define ISR_START_X_STEPPER_CYCLES 0UL
#define ISR_X_STEPPER_CYCLES 0UL
#endif
#if HAS_Y_STEP
#define ISR_START_Y_STEPPER_CYCLES ISR_START_STEPPER_CYCLES
#define ISR_Y_STEPPER_CYCLES ISR_STEPPER_CYCLES
#else
#define ISR_START_Y_STEPPER_CYCLES 0UL
#define ISR_Y_STEPPER_CYCLES 0UL
#endif
#if HAS_Z_STEP
#define ISR_START_Z_STEPPER_CYCLES ISR_START_STEPPER_CYCLES
#define ISR_Z_STEPPER_CYCLES ISR_STEPPER_CYCLES
#else
#define ISR_START_Z_STEPPER_CYCLES 0UL
#define ISR_Z_STEPPER_CYCLES 0UL
#endif
// E is always interpolated
#define ISR_START_E_STEPPER_CYCLES ISR_START_STEPPER_CYCLES
#define ISR_E_STEPPER_CYCLES ISR_STEPPER_CYCLES
// If linear advance is disabled, then the loop also handles them
#if DISABLED(LIN_ADVANCE) && ENABLED(COLOR_MIXING_EXTRUDER)
#define ISR_START_MIXING_STEPPER_CYCLES ((MIXING_STEPPERS) * 13UL)
#define ISR_MIXING_STEPPER_CYCLES ((MIXING_STEPPERS) * 16UL)
#else
#define ISR_START_MIXING_STEPPER_CYCLES 0UL
#define ISR_MIXING_STEPPER_CYCLES 0UL
#endif
// Calculate the minimum time to start all stepper pulses in the ISR loop
#define MIN_ISR_START_LOOP_CYCLES (ISR_START_X_STEPPER_CYCLES + ISR_START_Y_STEPPER_CYCLES + ISR_START_Z_STEPPER_CYCLES + ISR_START_E_STEPPER_CYCLES + ISR_START_MIXING_STEPPER_CYCLES)
// And the total minimum loop time is, without including the base
#define MIN_ISR_LOOP_CYCLES (ISR_X_STEPPER_CYCLES + ISR_Y_STEPPER_CYCLES + ISR_Z_STEPPER_CYCLES + ISR_E_STEPPER_CYCLES + ISR_MIXING_STEPPER_CYCLES)
// But the user could be enforcing a minimum time, so the loop time is
#define ISR_LOOP_CYCLES (ISR_LOOP_BASE_CYCLES + MAX(HAL_min_pulse_cycle, MIN_ISR_LOOP_CYCLES))
// If linear advance is enabled, then it is handled separately
#if ENABLED(LIN_ADVANCE)
// Estimate the minimum LA loop time
#if ENABLED(COLOR_MIXING_EXTRUDER)
#define MIN_ISR_LA_LOOP_CYCLES ((MIXING_STEPPERS) * 16UL)
#else
#define MIN_ISR_LA_LOOP_CYCLES 16UL
#endif
// And the real loop time
#define ISR_LA_LOOP_CYCLES MAX(HAL_min_pulse_cycle, MIN_ISR_LA_LOOP_CYCLES)
#else
#define ISR_LA_LOOP_CYCLES 0UL
#endif
// Tone for due
#define TONE_TIMER_NUM 3 // index of timer to use for beeper tones
#define HAL_TONE_TIMER_ISR() void TC3_Handler()
// --------------------------------------------------------------------------
// Types
// --------------------------------------------------------------------------
typedef struct {
Tc *pTimerRegs;
uint16_t channel;
IRQn_Type IRQ_Id;
uint8_t priority;
} tTimerConfig;
// --------------------------------------------------------------------------
// Public Variables
// --------------------------------------------------------------------------
extern const tTimerConfig TimerConfig[];
extern uint32_t HAL_min_pulse_cycle,
HAL_min_pulse_tick,
HAL_add_pulse_ticks,
HAL_frequency_limit[8];
// --------------------------------------------------------------------------
// Private Variables
// --------------------------------------------------------------------------
// --------------------------------------------------------------------------
// Public functions
// --------------------------------------------------------------------------
void HAL_timer_start(const uint8_t timer_num, const uint32_t frequency);
void HAL_calc_pulse_cycle();
uint32_t HAL_calc_timer_interval(uint32_t step_rate, uint8_t* loops, uint8_t scale);
FORCE_INLINE static void HAL_timer_enable_interrupt(const uint8_t timer_num) {
IRQn_Type IRQn = TimerConfig[timer_num].IRQ_Id;
NVIC_EnableIRQ(IRQn);
}
FORCE_INLINE static void HAL_timer_disable_interrupt(const uint8_t timer_num) {
IRQn_Type IRQn = TimerConfig[timer_num].IRQ_Id;
NVIC_DisableIRQ(IRQn);
// We NEED memory barriers to ensure Interrupts are actually disabled!
// ( https://dzone.com/articles/nvic-disabling-interrupts-on-arm-cortex-m-and-the )
__DSB();
__ISB();
}
FORCE_INLINE static bool HAL_timer_interrupt_is_enabled(const uint8_t timer_num) {
IRQn_Type IRQn = TimerConfig[timer_num].IRQ_Id;
return (NVIC->ISER[(uint32_t)(IRQn) >> 5] & (1 << ((uint32_t)(IRQn) & 0x1F)));
}
FORCE_INLINE static uint32_t HAL_timer_get_count(const uint8_t timer_num) {
const tTimerConfig * const pConfig = &TimerConfig[timer_num];
return pConfig->pTimerRegs->TC_CHANNEL[pConfig->channel].TC_RC;
}
FORCE_INLINE static void HAL_timer_set_count(const uint8_t timer_num, const uint32_t count) {
const tTimerConfig * const pConfig = &TimerConfig[timer_num];
pConfig->pTimerRegs->TC_CHANNEL[pConfig->channel].TC_RC = count;
}
FORCE_INLINE static uint32_t HAL_timer_get_current_count(const uint8_t timer_num) {
const tTimerConfig * const pConfig = &TimerConfig[timer_num];
return pConfig->pTimerRegs->TC_CHANNEL[pConfig->channel].TC_CV;
}
FORCE_INLINE static void HAL_timer_restricts(const uint8_t timer_num, const uint16_t interval_ticks) {
const uint32_t mincmp = HAL_timer_get_current_count(timer_num) + interval_ticks;
if (HAL_timer_get_count(timer_num) < mincmp) HAL_timer_set_count(timer_num, mincmp);
}
FORCE_INLINE static void HAL_timer_isr_prologue(const uint8_t timer_num) {
const tTimerConfig * const pConfig = &TimerConfig[timer_num];
// Reading the status register clears the interrupt flag
pConfig->pTimerRegs->TC_CHANNEL[pConfig->channel].TC_SR;
}
| 39.192453 | 187 | 0.676199 |
3109debff4316b35f2ddb4147fa8751a7dbf73fa | 740 | h | C | Dockerfiles/agent/windows/entrypoint/Service.h | rajesh-ibm-power/datadog-agent | 1d45fa32d4b9b9d8aa021fdeb3b8f5e10d6bcd85 | [
"Apache-2.0"
] | 1 | 2021-11-15T23:30:38.000Z | 2021-11-15T23:30:38.000Z | Dockerfiles/agent/windows/entrypoint/Service.h | rajesh-ibm-power/datadog-agent | 1d45fa32d4b9b9d8aa021fdeb3b8f5e10d6bcd85 | [
"Apache-2.0"
] | 3 | 2020-11-28T18:07:27.000Z | 2021-03-24T17:23:50.000Z | Dockerfiles/agent/windows/entrypoint/Service.h | rajesh-ibm-power/datadog-agent | 1d45fa32d4b9b9d8aa021fdeb3b8f5e10d6bcd85 | [
"Apache-2.0"
] | 1 | 2021-06-24T06:41:48.000Z | 2021-06-24T06:41:48.000Z | // Unless explicitly stated otherwise all files in this repository are licensed
// under the Apache License Version 2.0.
// This product includes software developed at Datadog
// (https://www.datadoghq.com/).
// Copyright 2019-2020 Datadog, Inc.
#pragma once
#include <Windows.h>
#include <string>
#include <chrono>
class Service
{
private:
Service(Service const&) = delete;
SC_HANDLE _scManagerHandle;
SC_HANDLE _serviceHandle;
DWORD _processId;
public:
Service(std::wstring const& name);
Service(Service&&) = default;
~Service();
DWORD PID();
void Start(std::chrono::milliseconds timeout = std::chrono::seconds(60));
void Stop(std::chrono::milliseconds timeout = std::chrono::seconds(30));
};
| 24.666667 | 79 | 0.706757 |
310a6fc0559e607ab120df9c429348018e859d1a | 8,182 | h | C | SMZ80_SDK/V1/tools/windows/sdcc/include/mcs51/p89c66x.h | alfreedom/smz80-SDK | cd14e7d077c53f1e17fc52e5adbea9ed3aa8eb8e | [
"MIT"
] | 1 | 2020-05-10T03:14:52.000Z | 2020-05-10T03:14:52.000Z | tools/Linux/sdcc-4.1.0/share/sdcc/include/mcs51/p89c66x.h | ryanplusplus/sdcc-stm8-tools | 528bcce4da955daae23c2feaf435dcfb72f4f13d | [
"MIT"
] | null | null | null | tools/Linux/sdcc-4.1.0/share/sdcc/include/mcs51/p89c66x.h | ryanplusplus/sdcc-stm8-tools | 528bcce4da955daae23c2feaf435dcfb72f4f13d | [
"MIT"
] | null | null | null | /*-------------------------------------------------------------------------
p89c66x.h - This header allows to use the microcontroler Philips P89c66x
with the compiler SDCC.
Copyright (C), 2007 Gudjon I. Gudjonsson <gudjon AT gudjon.org>
This library 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 library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this library; see the file COPYING. If not, write to the
Free Software Foundation, 51 Franklin Street, Fifth Floor, Boston,
MA 02110-1301, USA.
As a special exception, if you link this library with other files,
some of which are compiled with SDCC, to produce an executable,
this library does not by itself cause the resulting executable to
be covered by the GNU General Public License. This exception does
not however invalidate any other reasons why the executable file
might be covered by the GNU General Public License.
-------------------------------------------------------------------------*/
/*-------------------------------------------------------------------------
The registered are ordered in the same way as in the NXP data sheet
P89C660_662_664_3.PDF, see http://www.nxp.com
-------------------------------------------------------------------------*/
#ifndef __P89c66x_H__
#define __P89c66x_H__
#include <compiler.h>
/*BYTE Registers*/
SFR(ACC, 0xE0); // Accumulator
SBIT(ACC_7, 0xE0, 7);
SBIT(ACC_6, 0xE0, 6);
SBIT(ACC_5, 0xE0, 5);
SBIT(ACC_4, 0xE0, 4);
SBIT(ACC_3, 0xE0, 3);
SBIT(ACC_2, 0xE0, 2);
SBIT(ACC_1, 0xE0, 1);
SBIT(ACC_0, 0xE0, 0);
SFR(AUXR, 0x8E); // Auxiliary
#define EXTRAM 0x02
#define AO 0x01
SFR(AUXR1, 0xA2); // Auxiliary 1
#define ENBOOT 0x20
#define GF2 0x08
// Bit 2 must be 0
#define DPS 0x01
SFR(B, 0xF0); // B register
SBIT(B7, 0xF0, 7);
SBIT(B6, 0xF0, 6);
SBIT(B5, 0xF0, 5);
SBIT(B4, 0xF0, 4);
SBIT(B3, 0xF0, 3);
SBIT(B2, 0xF0, 2);
SBIT(B1, 0xF0, 1);
SBIT(B0, 0xF0, 0);
SFR(CCAP0H, 0xFA); // Module 0 Capture High
SFR(CCAP1H, 0xFB); // Module 1 Capture High
SFR(CCAP2H, 0xFC); // Module 2 Capture High
SFR(CCAP3H, 0xFD); // Module 3 Capture High
SFR(CCAP4H, 0xFE); // Module 4 Capture High
SFR(CCAP0L, 0xEA); // Module 0 Capture Low
SFR(CCAP1L, 0xEB); // Module 1 Capture Low
SFR(CCAP2L, 0xEC); // Module 2 Capture Low
SFR(CCAP3L, 0xED); // Module 3 Capture Low
SFR(CCAP4L, 0xEE); // Module 4 Capture Low
SFR(CCAPM0, 0xC2); // Module 0 Mode
SFR(CCAPM1, 0xC3); // Module 1 Mode
SFR(CCAPM2, 0xC4); // Module 2 Mode
SFR(CCAPM3, 0xC5); // Module 3 Mode
SFR(CCAPM4, 0xC6); // Module 4 Mode
#define ECOM 0x40
#define CAPP 0x20
#define CAPN 0x10
#define MAT 0x08
#define TOG 0x04
#define PWM 0x02
#define ECCF 0x01
SFR(CCON, 0xC0); // PCA Counter Control
SBIT(CF, 0xC0, 7);
SBIT(CR, 0xC0, 6);
SBIT(CCF4, 0xC0, 4);
SBIT(CCF3, 0xC0, 3);
SBIT(CCF2, 0xC0, 2);
SBIT(CCF1, 0xC0, 1);
SBIT(CCF0, 0xC0, 0);
SFR(CH, 0xF9); // PCA Counter High
SFR(CL, 0xE9); // PCA Counter Low
SFR(CMOD, 0xC1); // PCA Counter Mode
#define CIDL 0x80
#define WDTE 0x40
#define CPS1 0x04
#define CPS0 0x02
#define ECF 0x01
SFR(DPH, 0x83); // Data Pointer High
SFR(DPL, 0x82); // Data Pointer Low
SFR(IEN0, 0xA8); // Interrupt Enable 0
SBIT(EA, 0xA8, 7);
SBIT(EC, 0xA8, 6);
SBIT(ES1, 0xA8, 5);
SBIT(ES0, 0xA8, 4);
SBIT(ET1, 0xA8, 3);
SBIT(EX1, 0xA8, 2);
SBIT(ET0, 0xA8, 1);
SBIT(EX0, 0xA8, 0);
SFR(IEN1, 0xE8); // Interrupt Enable 1
SBIT(ET2, 0xE8, 0);
SFR(IP, 0xB8); // Interrupt Priority
SBIT(PT2, 0xB8, 7);
SBIT(PPC, 0xB8, 6);
SBIT(PS1, 0xB8, 5);
SBIT(PS0, 0xB8, 4);
SBIT(PT1, 0xB8, 3);
SBIT(PX1, 0xB8, 2);
SBIT(PT0, 0xB8, 1);
SBIT(PX0, 0xB8, 0);
SFR(IPH, 0xB7); // Interrupt Priority High
#define PT2H 0x80
#define PPCH 0x40
#define PS1H 0x20
#define PS0H 0x10
#define PT1H 0x08
#define PX1H 0x04
#define PT0H 0x02
#define PX0H 0x01
SFR(P0, 0x80); // Port 0
SBIT(AD7, 0x80, 7);
SBIT(P0_7, 0x80, 7);
SBIT(AD6, 0x80, 6);
SBIT(P0_6, 0x80, 6);
SBIT(AD5, 0x80, 5);
SBIT(P0_5, 0x80, 5);
SBIT(AD4, 0x80, 4);
SBIT(P0_4, 0x80, 4);
SBIT(AD3, 0x80, 3);
SBIT(P0_3, 0x80, 3);
SBIT(AD2, 0x80, 2);
SBIT(P0_2, 0x80, 2);
SBIT(AD1, 0x80, 1);
SBIT(P0_1, 0x80, 1);
SBIT(AD0, 0x80, 0);
SBIT(P0_0, 0x80, 0);
SFR(P1, 0x90); // Port 1
SBIT(T1_CEX4, 0x90, 7);
SBIT(P1_7, 0x90, 7);
SBIT(T0_CEX3, 0x90, 6);
SBIT(P1_6, 0x90, 6);
SBIT(CEX2, 0x90, 5);
SBIT(P1_5, 0x90, 5);
SBIT(CEX1, 0x90, 4);
SBIT(P1_4, 0x90, 4);
SBIT(CEX0, 0x90, 3);
SBIT(P1_3, 0x90, 3);
SBIT(ECI, 0x90, 2);
SBIT(P1_2, 0x90, 2);
SBIT(T2EX, 0x90, 1);
SBIT(P1_1, 0x90, 1);
SBIT(T2, 0x90, 0);
SBIT(P1_0, 0x90, 0);
SFR(P2, 0xA0); // Port 2
SBIT(AD15, 0xA0, 7);
SBIT(P2_7, 0xA0, 7);
SBIT(AD14, 0xA0, 6);
SBIT(P2_6, 0xA0, 6);
SBIT(AD13, 0xA0, 5);
SBIT(P2_5, 0xA0, 5);
SBIT(AD12, 0xA0, 4);
SBIT(P2_4, 0xA0, 4);
SBIT(AD11, 0xA0, 3);
SBIT(P2_3, 0xA0, 3);
SBIT(AD10, 0xA0, 2);
SBIT(P2_2, 0xA0, 2);
SBIT(AD9, 0xA0, 1);
SBIT(P2_1, 0xA0, 1);
SBIT(AD8, 0xA0, 0);
SBIT(P2_0, 0xA0, 0);
SFR(P3, 0xB0); // Port 3
SBIT(RD, 0xB0, 7);
SBIT(P3_7, 0xB0, 7);
SBIT(WR, 0xB0, 6);
SBIT(P3_6, 0xB0, 6);
SBIT(T1, 0xB0, 5);
SBIT(P3_5, 0xB0, 5);
SBIT(T0, 0xB0, 4);
SBIT(P3_4, 0xB0, 4);
SBIT(INT1, 0xB0, 3);
SBIT(P3_3, 0xB0, 3);
SBIT(INT0, 0xB0, 2);
SBIT(P3_2, 0xB0, 2);
SBIT(TXD, 0xB0, 1);
SBIT(P3_1, 0xB0, 1);
SBIT(RXD, 0xB0, 0);
SBIT(P3_0, 0xB0, 0);
SFR(PCON, 0x87); // Power Control
#define SMOD1 0x80
#define SMOD0 0x40
#define POF 0x10
#define GF1 0x80
#define GF0 0x40
#define PD 0x20
#define IDL 0x10
SFR(PSW, 0xD0); // Program Status Word
SBIT(CY, 0xD0, 7);
SBIT(AC, 0xD0, 6);
SBIT(F0, 0xD0, 5);
SBIT(RS1, 0xD0, 4);
SBIT(RS0, 0xD0, 3);
SBIT(OV, 0xD0, 2);
SBIT(F1, 0xD0, 1);
SBIT(P, 0xD0, 0);
SFR(RCAP2H, 0xCB); // Timer 2 Capture High
SFR(RCAP2L, 0xCA); // Timer 2 Capture Low
SFR(SADDR, 0xA9); // I2C Slave Address
SFR(SADEN, 0xB9); // I2C Slave Address Mask
SFR(S0BUF, 0x99); // Serial Data Buffer
SFR(S0CON, 0x98); // Serial Control
SBIT(SM0_FE, 0x98, 7);
SBIT(SM1, 0x98, 6);
SBIT(SM2, 0x98, 5);
SBIT(REN, 0x98, 4);
SBIT(TB8, 0x98, 3);
SBIT(RB8, 0x98, 2);
SBIT(TI, 0x98, 1);
SBIT(RI, 0x98, 0);
SFR(SP, 0x81); // Stack Pointer
SFR(S1DAT, 0xDA); // I2C Serial 1 Data
SFR(S1IST, 0xDC); // I2C Serial 1 Internal Status
SFR(S1ADR, 0xDB); // I2C Serial 1 Address
#define GC 0x01
SFR(S1STA, 0xD9); // I2C Serial 1 Status
#define SC4 0x80
#define SC3 0x40
#define SC2 0x20
#define SC1 0x10
#define SC0 0x08
SFR(S1CON, 0xD8); // I2C Serial 1 Control
SBIT(CR2, 0xD8, 7);
SBIT(ENS1, 0xD8, 6);
SBIT(STA, 0xD8, 5);
SBIT(STO, 0xD8, 4);
SBIT(SI, 0xD8, 3);
SBIT(AA, 0xD8, 2);
SBIT(CR1, 0xD8, 1);
SBIT(CR0, 0xD8, 0);
SFR(TCON, 0x88); // Timer Control
SBIT(TF1, 0x88, 7);
SBIT(TR1, 0x88, 6);
SBIT(TF0, 0x88, 5);
SBIT(TR0, 0x88, 4);
SBIT(IE1, 0x88, 3);
SBIT(IT1, 0x88, 2);
SBIT(IE0, 0x88, 1);
SBIT(IT0, 0x88, 0);
SFR(T2CON, 0xC8); // Timer 2 Control
SBIT(TF2, 0xC8, 7);
SBIT(EXF2, 0xC8, 6);
SBIT(RCLK, 0xC8, 5);
SBIT(TCLK, 0xC8, 4);
SBIT(EXEN2, 0xC8, 3);
SBIT(TR2, 0xC8, 2);
SBIT(C_T2, 0xC8, 1);
SBIT(CP_RL2, 0xC8, 0);
SFR(T2MOD, 0xC9); // Timer 2 Mode Control
#define T2OE 0x02
#define DCEN 0x01
SFR(TH0 , 0x8C); // Timer High 0
SFR(TH1, 0x8D); // Timer High 1
SFR(TH2, 0xCD); // Timer High 2
SFR(TL0, 0x8A); // Timer Low 0
SFR(TL1, 0x8B); // Timer Low 1
SFR(TL2, 0xCC); // Timer Low 2
SFR(TMOD, 0x89); // Timer Mode
#define GATE_1 0x80
#define C_T_1 0x40
#define M1_1 0x20
#define M0_1 0x10
#define GATE_0 0x08
#define C_T_0 0x04
#define M1_0 0x02
#define M0_0 0x01
SFR(WDTRST, 0xA6); // Watchdog Timer Reset
#endif
| 27.924915 | 75 | 0.618064 |
310b1a99b40054da0376df073469b241a09d2aac | 556 | h | C | Manage Conky/MCFilesystem.h | Conky-for-macOS/Manage-Conky | 52ea1e8095e850bf3b54096a690ffbe6c90e5992 | [
"MIT"
] | 30 | 2018-03-06T19:03:11.000Z | 2020-11-29T11:18:35.000Z | Manage Conky/MCFilesystem.h | Cloudxtreme/Manage-Conky | 7c2f78c6b01c44fad2fe7c2836781a7b686aa176 | [
"MIT"
] | 28 | 2018-03-17T14:50:40.000Z | 2020-10-28T15:02:29.000Z | Manage Conky/MCFilesystem.h | Cloudxtreme/Manage-Conky | 7c2f78c6b01c44fad2fe7c2836781a7b686aa176 | [
"MIT"
] | 4 | 2018-12-19T22:03:36.000Z | 2019-06-22T23:03:10.000Z | //
// MCFilesystem.h
// Manage Conky
//
// Created by Nickolas Pylarinos on 08/08/2018.
// Copyright © 2018 Nickolas Pylarinos. All rights reserved.
//
#ifndef MCFilesystem_h
#define MCFilesystem_h
#import <Foundation/Foundation.h>
/**
* Return ManageConky directory path in ~/Library
*/
NSString *MCDirectory(void);
/**
* Create ManageConky directory in ~/Library
*/
void createMCDirectory(void);
/**
* Custom-Normalise a path for usage in MCObjects (Widgets / Themes)
*/
NSString* MCNormalise(NSString *path);
#endif /* MCFilesystem_h */
| 18.533333 | 68 | 0.715827 |
310b458be063cd25e061294c97baefd4c170fd1d | 2,403 | c | C | ckpt.c | rahulbahal7/Checkpoint-Recovery-System | 018b1793f85fd9c23c41b5d79bdd693702578c86 | [
"MIT"
] | null | null | null | ckpt.c | rahulbahal7/Checkpoint-Recovery-System | 018b1793f85fd9c23c41b5d79bdd693702578c86 | [
"MIT"
] | null | null | null | ckpt.c | rahulbahal7/Checkpoint-Recovery-System | 018b1793f85fd9c23c41b5d79bdd693702578c86 | [
"MIT"
] | null | null | null | #include <signal.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <unistd.h>
#include <fcntl.h>
#include <ucontext.h>
#include <stdbool.h>
// Header section for the memory sections
struct section{
long long start_addr;
long long end_addr;
bool isContext;
}h1;
// Context variable for the register(s)
ucontext_t s;
char low[20], high[20];
unsigned long long low_value, high_value;
// Parse the memory maps and get the start, end addresses for
// each of the section.
void readmaps(FILE *fp) {
char line[1000];
int i, j, size_struct;
size_struct = sizeof(h1);
if (fgets(line, 1000, fp) != NULL) {
// Parse the Low address
for (i = 0, j = 0; line[i]!= '-'; i++, j++)
low[j]= line[i];
low[j]='\0';
// Parse the High address
for (j = 0, i++; line[i] != ' '; i++, j++)
high[j]= line[i];
high[j]='\0';
// Convert addresses to hex
low_value = strtoll(low, NULL, 16);
high_value= strtoll(high, NULL, 16);
h1.start_addr=low_value;
h1.end_addr=high_value;
h1.isContext = false;
return;
}
}
void checkpoint() {
FILE *proc_file = fopen("/proc/self/maps", "r");
char line[1000];
int l=0;
while (fgets(line, 1000, proc_file) != NULL) l++;
int checkpoint_image = open("myckpt", O_RDWR|O_CREAT,0777);
rewind(proc_file);
// Write the memory sections line by line by reading the process memory
// maps.
while(l--) {
readmaps(proc_file);
write(checkpoint_image, &h1, sizeof(h1));
write(checkpoint_image, (char *) low_value, high_value-low_value);
}
close(checkpoint_image);
}
// Create the checkpoint and get the register context at the point of
// receiving the signal
void checkpoint_handler(int signum) {
//Checkpoint the memory sections
checkpoint();
// Get the register context
int a =getcontext(&s);
// The following check is to see if we are following the program
// execution from the above getcontext() statement or returning
// from setcontext() as it will set the registers back to this state
if (!(access("context_ckpt", F_OK)!=-1))
{
int context_file = open("context_ckpt", O_RDWR|O_CREAT, 0777);
int bytes_written = write(context_file, &s, sizeof(s));
close(context_file);
exit(0);
}
return;
}
//Custom signal handler defined as __attribute__((constructor)) so that it
//executes before the main function
__attribute__((constructor)) void init_signal() {
signal(SIGUSR2, checkpoint_handler);
}
| 25.294737 | 75 | 0.68789 |
310ba280ac0c74e014da1688bd735850659a8ac5 | 515 | h | C | landscaper/src/vblur_stage.h | llGuy/landscaper | 7b9874c73bd7f5f07a340b9043fdeace032b6c49 | [
"MIT"
] | null | null | null | landscaper/src/vblur_stage.h | llGuy/landscaper | 7b9874c73bd7f5f07a340b9043fdeace032b6c49 | [
"MIT"
] | null | null | null | landscaper/src/vblur_stage.h | llGuy/landscaper | 7b9874c73bd7f5f07a340b9043fdeace032b6c49 | [
"MIT"
] | null | null | null | #pragma once
#include "post_proc_stage.h"
// test speed
class vblur_stage : public postproc_stage
{
public:
vblur_stage(i32 scale);
auto create(i32 w, i32 h) -> void override;
auto bind(void) -> void override;
auto render(quad_2D & quad, texture & prev) -> void override;
inline auto width(void) -> i32 { return w; };
inline auto height(void) -> i32 { return h; };
protected:
auto create_texture(i32 w, i32 h) -> void override;
auto create_depth(i32 w, i32 h) -> void override;
private:
i32 scale;
}; | 22.391304 | 62 | 0.695146 |
310baf0158e65725b09f8603739ba4c27eed7311 | 509 | h | C | PFXAppleDoc/PFXAppleDoc/PFXAppleDoc.h | PFXStudio/PFXAppleDoc | 309751e5f2bef3a923b7577393c38f9f18f27499 | [
"MIT"
] | 1 | 2016-03-21T08:39:37.000Z | 2016-03-21T08:39:37.000Z | PFXAppleDoc/PFXAppleDoc/PFXAppleDoc.h | PFXStudio/PFXAppleDoc | 309751e5f2bef3a923b7577393c38f9f18f27499 | [
"MIT"
] | null | null | null | PFXAppleDoc/PFXAppleDoc/PFXAppleDoc.h | PFXStudio/PFXAppleDoc | 309751e5f2bef3a923b7577393c38f9f18f27499 | [
"MIT"
] | null | null | null | //
// PFXAppleDoc.h
// PFXAppleDoc
//
// Created by succorer on 2016. 2. 16..
// Copyright © 2016년 succorer. All rights reserved.
//
#import <UIKit/UIKit.h>
//! Project version number for PFXAppleDoc.
FOUNDATION_EXPORT double PFXAppleDocVersionNumber;
//! Project version string for PFXAppleDoc.
FOUNDATION_EXPORT const unsigned char PFXAppleDocVersionString[];
// In this header, you should import all the public headers of your framework using statements like #import <PFXAppleDoc/PublicHeader.h>
| 25.45 | 136 | 0.762279 |
310bc67672fbbddef91a9b5088b89b6944434179 | 1,842 | c | C | ioctl_kernel_poc/ioctl_user_test.c | kaiwan/L3_dd_trg | 0ffb8c951f0dde4adfa7bfdbc91a83b2b4b716cf | [
"MIT"
] | 1 | 2020-11-03T09:38:37.000Z | 2020-11-03T09:38:37.000Z | ioctl_kernel_poc/ioctl_user_test.c | kaiwan/L3_dd_trg | 0ffb8c951f0dde4adfa7bfdbc91a83b2b4b716cf | [
"MIT"
] | null | null | null | ioctl_kernel_poc/ioctl_user_test.c | kaiwan/L3_dd_trg | 0ffb8c951f0dde4adfa7bfdbc91a83b2b4b716cf | [
"MIT"
] | 2 | 2020-11-27T13:07:41.000Z | 2021-01-12T10:47:15.000Z | /*
* ioctl_user_test.c
* Test ioctl_kdrv a bit -- /dev/ioctlkdrv
* Note that the user (as root) must create the device file.
*
*TODO - use inlines..
*/
#include <stdio.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <signal.h>
#include <stdlib.h>
#include <sys/ioctl.h>
#include "ioctl_kdrv.h"
#define FLGS O_RDWR
#define DMODE 0
int main(int argc, char **argv)
{
int fd, power;
if (argc < 2) {
fprintf(stderr, "Usage: %s device_file\n\
If device_file does not exist, create it using mknod(1) (as root)\n", argv[0]);
exit(1);
}
if ((fd = open(argv[1], FLGS, DMODE)) == -1)
perror("open"), exit(1);
printf("device opened: fd=%d\n", fd);
printf("IOCTL_KDRV_IOCRESET = 0x%x IOCTL_KDRV_IOCQPOWER= 0x%x IOCTL_KDRV_IOCSPOWER=0x%x\n",
IOCTL_KDRV_IOCRESET, (unsigned int)IOCTL_KDRV_IOCQPOWER,
(unsigned int)IOCTL_KDRV_IOCSPOWER);
// test ioctl's ...
if (ioctl(fd, IOCTL_KDRV_IOCRESET, 0) == -1) {
perror("ioctl IOCTL_KDRV_IOCRESET failed");
close(fd);
exit(1);
}
printf("%s: device reset.\n", argv[0]);
if (ioctl(fd, IOCTL_KDRV_IOCQPOWER, &power) == -1) {
perror("ioctl IOCTL_KDRV_IOCQPOWER failed");
close(fd);
exit(1);
}
printf("%s: power=%d\n", argv[0], power);
if (!power) {
printf("Device OFF, powering it on in 3s...\n");
sleep(3); /* yes, careful here of sleep & signals! */
if (ioctl(fd, IOCTL_KDRV_IOCSPOWER, 1) == -1) {
perror("ioctl IOCTL_KDRV_IOCSPOWER failed");
close(fd);
exit(1);
}
printf("%s: power ON now.\n", argv[0]);
} else {
printf("%s: powering OFF now..\n", argv[0]);
if (ioctl(fd, IOCTL_KDRV_IOCSPOWER, 0) == -1) {
perror("ioctl IOCTL_KDRV_IOCSPOWER failed");
close(fd);
exit(1);
}
printf("%s: power OFF ok, exiting..\n", argv[0]);
}
close(fd);
exit(0);
}
// end user_test.c
| 23.316456 | 92 | 0.638436 |
310c1d6840b84c05a998e5cacbaecb2a3d9b6d9f | 5,165 | h | C | Direct2DNet/Direct2DNet/ID2D1RadialGradientBrush.h | SansyHuman/Direct2DNet | 345d981a07fd8cbdf7cf7e6ca9d7b493439dbd17 | [
"MIT"
] | null | null | null | Direct2DNet/Direct2DNet/ID2D1RadialGradientBrush.h | SansyHuman/Direct2DNet | 345d981a07fd8cbdf7cf7e6ca9d7b493439dbd17 | [
"MIT"
] | null | null | null | Direct2DNet/Direct2DNet/ID2D1RadialGradientBrush.h | SansyHuman/Direct2DNet | 345d981a07fd8cbdf7cf7e6ca9d7b493439dbd17 | [
"MIT"
] | null | null | null | #pragma once
#include "IDirect2DObject.h"
#include "D2DNetHeaders.h"
#include "D2DSettings.h"
#include "ID2D1Brush.h"
#include "ID2D1GradientStopCollection.h"
namespace D2DNet
{
namespace Direct2DNet
{
ref class ID2D1RenderTarget;
// Done.
/// <summary>
/// Paints an area with a radial gradient.
/// </summary>
[System::Runtime::InteropServices::GuidAttribute("2cd906ac-12e2-11dc-9fed-001143a055f9")]
public ref class ID2D1RadialGradientBrush : Direct2DNet::ID2D1Brush
{
private:
Direct2DNet::ID2D1GradientStopCollection ^m_collection;
internal:
ID2D1RadialGradientBrush() : Direct2DNet::ID2D1Brush() {}
ID2D1RadialGradientBrush(
Direct2DNet::ID2D1RenderTarget ^renderTarget,
Direct2DNet::D2D1_RADIAL_GRADIENT_BRUSH_PROPERTIES %properties,
Direct2DNet::ID2D1GradientStopCollection ^collection
);
public:
virtual void HandleCOMInterface(void *obj) override;
/// <summary>
/// Gets and sets the center of the radial gradient in local coordinate space.
/// </summary>
property Direct2DNet::D2D1_POINT_2F Center
{
Direct2DNet::D2D1_POINT_2F get()
{
return static_cast<Direct2DNet::D2D1_POINT_2F>(
((::ID2D1RadialGradientBrush *)m_pResource)->GetCenter()
);
}
void set(Direct2DNet::D2D1_POINT_2F value)
{
((::ID2D1RadialGradientBrush *)m_pResource)->SetCenter(
static_cast<::D2D1_POINT_2F>(value)
);
}
}
/// <summary>
/// Gets and sets the offset of the origin relative to the radial gradient center.
/// </summary>
property Direct2DNet::D2D1_POINT_2F GradientOriginOffset
{
Direct2DNet::D2D1_POINT_2F get()
{
return static_cast<Direct2DNet::D2D1_POINT_2F>(
((::ID2D1RadialGradientBrush *)m_pResource)->GetGradientOriginOffset()
);
}
void set(Direct2DNet::D2D1_POINT_2F value)
{
((::ID2D1RadialGradientBrush *)m_pResource)->SetGradientOriginOffset(
static_cast<::D2D1_POINT_2F>(value)
);
}
}
/// <summary>
/// Gets and sets the x-radius of the gradient ellipse.
/// </summary>
property float RadiusX
{
float get()
{
return ((::ID2D1RadialGradientBrush *)m_pResource)->GetRadiusX();
}
void set(float value)
{
((::ID2D1RadialGradientBrush *)m_pResource)->SetRadiusX(value);
}
}
/// <summary>
/// Gets and sets the y-radius of the gradient ellipse.
/// </summary>
property float RadiusY
{
float get()
{
return ((::ID2D1RadialGradientBrush *)m_pResource)->GetRadiusY();
}
void set(float value)
{
((::ID2D1RadialGradientBrush *)m_pResource)->SetRadiusY(value);
}
}
/// <summary>
/// Gets and sets the gradient ellipse.
/// </summary>
property Direct2DNet::D2D1_ELLIPSE GradientEllipse
{
Direct2DNet::D2D1_ELLIPSE get()
{
Direct2DNet::D2D1_ELLIPSE value;
value.point = static_cast<Direct2DNet::D2D1_POINT_2F>(((::ID2D1RadialGradientBrush *)m_pResource)->GetCenter());
value.radiusX = ((::ID2D1RadialGradientBrush *)m_pResource)->GetRadiusX();
value.radiusY = ((::ID2D1RadialGradientBrush *)m_pResource)->GetRadiusY();
return value;
}
void set(Direct2DNet::D2D1_ELLIPSE value)
{
((::ID2D1RadialGradientBrush *)m_pResource)->SetCenter(static_cast<::D2D1_POINT_2F>(value.point));
((::ID2D1RadialGradientBrush *)m_pResource)->SetRadiusX(value.radiusX);
((::ID2D1RadialGradientBrush *)m_pResource)->SetRadiusY(value.radiusY);
}
}
/// <summary>
/// Gets the <see cref="Direct2DNet::ID2D1GradientStopCollection"/> instance
/// associated with this radial gradient brush object.
/// </summary>
property Direct2DNet::ID2D1GradientStopCollection ^GradientStopCollection
{
Direct2DNet::ID2D1GradientStopCollection ^get()
{
return m_collection;
}
}
};
}
} | 35.376712 | 132 | 0.511133 |
310f594a2e95bbe9caf6cd5ed429c5c556c1eb62 | 1,708 | h | C | INET_EC/linklayer/ieee80211/mac/blockack/RecipientBlockAckProcedure.h | LarryNguyen/ECSim- | 0d3f848642e49845ed7e4c7b97dd16bd3d65ede5 | [
"Apache-2.0"
] | 12 | 2020-11-30T08:04:23.000Z | 2022-03-23T11:49:26.000Z | INET_EC/linklayer/ieee80211/mac/blockack/RecipientBlockAckProcedure.h | LarryNguyen/ECSim- | 0d3f848642e49845ed7e4c7b97dd16bd3d65ede5 | [
"Apache-2.0"
] | 1 | 2021-01-26T10:49:56.000Z | 2021-01-31T16:58:52.000Z | INET_EC/linklayer/ieee80211/mac/blockack/RecipientBlockAckProcedure.h | LarryNguyen/ECSim- | 0d3f848642e49845ed7e4c7b97dd16bd3d65ede5 | [
"Apache-2.0"
] | 8 | 2021-03-15T02:05:51.000Z | 2022-03-21T13:14:02.000Z | //
// Copyright (C) 2016 OpenSim Ltd.
//
// 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
// 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/.
//
#ifndef __INET_RECIPIENTBLOCKACKPROCEDURE_H
#define __INET_RECIPIENTBLOCKACKPROCEDURE_H
#include "inet/linklayer/ieee80211/mac/contract/IRecipientBlockAckProcedure.h"
namespace inet {
namespace ieee80211 {
/*
* This class implements 9.3.2.9 BlockAck procedure
*/
class INET_API RecipientBlockAckProcedure : public IRecipientBlockAckProcedure
{
protected:
int numReceivedBlockAckReq = 0;
int numSentBlockAck = 0;
protected:
virtual Ieee80211BlockAck* buildBlockAck(Ieee80211BlockAckReq *blockAckReq, RecipientBlockAckAgreement *agreement);
public:
virtual void processReceivedBlockAckReq(Ieee80211BlockAckReq *blockAckReq, IRecipientQoSAckPolicy *ackPolicy, IRecipientBlockAckAgreementHandler* blockAckAgreementHandler, IProcedureCallback *callback) override;
virtual void processTransmittedBlockAck(Ieee80211BlockAck *blockAck) override;
};
} /* namespace ieee80211 */
} /* namespace inet */
#endif // __INET_RECIPIENTBLOCKACKPROCEDURE_H
| 36.340426 | 219 | 0.775761 |
310fb18720af615bfa95a0cf41ea7a11068b28d0 | 1,214 | h | C | rwt/lib/inc/rwt_init.h | edward-reehorst/On_RED | 483ad0c03f82f37061318c9fd9ec617d0f9da962 | [
"Apache-2.0"
] | 15 | 2019-03-27T04:41:58.000Z | 2022-03-24T14:15:33.000Z | rwt/lib/inc/rwt_init.h | edward-reehorst/On_RED | 483ad0c03f82f37061318c9fd9ec617d0f9da962 | [
"Apache-2.0"
] | null | null | null | rwt/lib/inc/rwt_init.h | edward-reehorst/On_RED | 483ad0c03f82f37061318c9fd9ec617d0f9da962 | [
"Apache-2.0"
] | 7 | 2019-07-03T07:16:42.000Z | 2021-07-16T11:24:34.000Z | /*! \file rwt_init.h
\brief Header for matlab init functions in init.c
*/
#ifndef RWT_INIT_H_
#define RWT_INIT_H_
#include "rwt_platform.h"
#if defined(MATLAB_MEX_FILE) || defined(OCTAVE_MEX_FILE)
#include "mex.h"
#ifndef OCTAVE_MEX_FILE
#include "matrix.h"
#endif
typedef struct {
size_t nrows; /*!< The number of rows in the input matrix. Output matrix will match. */
size_t ncols; /*!< The number of columns in the input matrix. Output matrix will match. */
int levels; /*!< L, the number of levels for the transform. */
int ncoeff; /*!< Length of h / the number of scaling coefficients */
double *scalings; /*!< Wavelet scaling coefficients */
} rwt_init_params;
typedef enum {NORMAL_DWT, REDUNDANT_DWT, INVERSE_DWT, INVERSE_REDUNDANT_DWT} transform_t;
#endif
#ifdef __cplusplus
extern "C" {
#endif
#if defined(MATLAB_MEX_FILE) || defined(OCTAVE_MEX_FILE)
rwt_init_params rwt_matlab_init(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[], transform_t dwtType);
#else
int rwt_find_levels(size_t m, size_t n);
int rwt_check_levels(int levels, size_t rows, size_t cols);
#endif
#ifdef __cplusplus
}
#endif
#endif /* RWT_INIT_H_ */
| 30.35 | 115 | 0.710049 |
3112a3e16a6046889e986b3c62042b3f613e387b | 529 | h | C | Core/Inc/DO.h | martinkresta/TECHM | b37525ba34148aa68bc5270c4a93aa3775b05b00 | [
"MIT"
] | null | null | null | Core/Inc/DO.h | martinkresta/TECHM | b37525ba34148aa68bc5270c4a93aa3775b05b00 | [
"MIT"
] | null | null | null | Core/Inc/DO.h | martinkresta/TECHM | b37525ba34148aa68bc5270c4a93aa3775b05b00 | [
"MIT"
] | null | null | null | /*
* DO.h
*
* Created on: 15. 7. 2021
* Author: Martin
*/
#include "main.h"
#ifndef INC_DO_H_
#define INC_DO_H_
#define TIM_SERVOS &htim1
#define CHANNEL_RAD TIM_CHANNEL_2
#define CHANNEL_WALL TIM_CHANNEL_1
#define PUMP_BOILER 0x01
#define PUMP_WALL 0x02
#define PUMP_RAD 0x04
void DO_Init();
void DO_SetElHeaters(uint8_t heaterMask);
void DO_SetPumps(uint8_t pumps);
void DO_SetElv(uint8_t elv);
void DO_SetServoRad(int16_t pct);
void DO_SetServoWall(int16_t pct);
#endif /* INC_DO_H_ */
| 13.921053 | 41 | 0.720227 |
3112bdf3c8915e0fc442be697f8cd6a4586be4eb | 12,800 | c | C | SRC shell/msh.c | BirajSinghGCUTA/Fat-32-File-System | ed08930066d7094a586819c1aaea10a718d00182 | [
"MIT"
] | null | null | null | SRC shell/msh.c | BirajSinghGCUTA/Fat-32-File-System | ed08930066d7094a586819c1aaea10a718d00182 | [
"MIT"
] | null | null | null | SRC shell/msh.c | BirajSinghGCUTA/Fat-32-File-System | ed08930066d7094a586819c1aaea10a718d00182 | [
"MIT"
] | null | null | null | // The MIT License (MIT)
//
// Copyright (c) 2016, 2017, 2021 Trevor Bakker
//
// 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.
/*
Name: Biraj Singh G C
ID: 1001867347
*/
#define _GNU_SOURCE
#include <stdio.h>
#include <unistd.h>
#include <sys/wait.h>
#include <stdlib.h>
#include <errno.h>
#include <string.h>
#include <signal.h>
#define WHITESPACE " \t\n" // We want to split our command line up into tokens
// so we need to define what delimits our tokens.
// In this case white space
// will separate the tokens on our command line
#define MAX_COMMAND_SIZE 255 // The maximum command-line size
#define MAX_NUM_ARGUMENTS 10 // Mav shell only supports ten arguments
#define MAX_RECORD_SIZE 15 // The maximum pid and command stored in history
#define false 0 // Boolean value for false
#define true 1 // Boolean value for true
/*FUNCTION DECLATARIONS*/
/*Record the command line*/
void record_history(char command_history[MAX_RECORD_SIZE][MAX_COMMAND_SIZE],
int* history_index, char* command_input );
/*Record the pid of process created*/
void record_pid(int pid_history[MAX_RECORD_SIZE], int* pid_index, int pid );
/*Print the command history*/
void print_history(char command_history[MAX_RECORD_SIZE][MAX_COMMAND_SIZE],
int* history_index);
/*Print the pid of process created*/
void print_pids(int pid_history[MAX_RECORD_SIZE],
int* pid_index);
/*Acces command from history*/
void acess_history(char command_history[MAX_RECORD_SIZE][MAX_COMMAND_SIZE],
int *history_accessed, char* cmd_str, int* history_index);
/*Change the Directory*/
void change_directory(char *dir_path);
/*MAIN FUNCTION*/
int main(){
/*VARIABLE DECLARATIONS*/
//List to store history of command line
char command_history[MAX_RECORD_SIZE][MAX_COMMAND_SIZE];
//List to store the history of pid of processes executed from command line
int pid_history[MAX_RECORD_SIZE];
//Track the position of the command_history
//Helps to find the next position to store the command
//initialize it to 0, since no history has been stored yet
int history_index =0;
//Track the position of the pid_history
//Helps to find the next position to store the pid of process
//initialize it to 0, since no process has been created yet
int pid_index = 0;
//boolean value to check if the history was acessed
int history_accessed = false;
// Char string to store the commands before parsing
char * cmd_str = (char*) malloc( MAX_COMMAND_SIZE );
//used to execute waitpid function.
int status;
while( 1 ){
//if history acessed, dont prompt the user
//use the command from the command history
if(!history_accessed){
// Print out the msh prompt
printf ("msh> ");
// Read the command from the commandline. The
// maximum command that will be read is MAX_COMMAND_SIZE
// This while command will wait here until the user
// inputs something since fgets returns NULL when there
// is no input
while( !fgets (cmd_str, MAX_COMMAND_SIZE, stdin) );
}
/* Parse input */
char *token[MAX_NUM_ARGUMENTS];
int token_count = 0;
// Pointer to point to the token
// parsed by strsep
char *argument_ptr;
char *working_str = strdup( cmd_str );
// we are going to move the working_str pointer so
// keep track of its original value so we can deallocate
// the correct amount at the end
char *working_root = working_str;
// Tokenize the input strings with whitespace used as the delimiter
while ( ( (argument_ptr = strsep(&working_str, WHITESPACE ) ) != NULL) &&
(token_count<MAX_NUM_ARGUMENTS)){
token[token_count] = strndup( argument_ptr, MAX_COMMAND_SIZE );
if( strlen( token[token_count] ) == 0 )
token[token_count] = NULL;
token_count++;
}
/* SHELL FUNCTIONALITY */
// Continue to print "msh" in new line and recive new input.
if(token[0] == NULL)
continue;
//STORE COMMAND INTO MEMORY
//Use function Recordhistory();
//only recored history if the command is not null of does not start with "!"
//if command is not null, user has not typed anything
//if command starts with !, the user has repeated the command
if(cmd_str[0] != '!')
record_history(command_history, &history_index, cmd_str);
else{
//ACESS HISTORY
//if user begins command with '!', means user wants to
//use previous commands.
//use function acess_history to acces the history of the user.
acess_history(command_history, &history_accessed, cmd_str, &history_index);
continue;
}
//EXIT OR QUIT MSH
//Compare the token with key words "exit and quit"
//return the program, if the true.
if(strcmp(token[0], "exit") == 0 || strcmp(token[0], "quit") == 0)
return 0;
//PRINTING HISTORY
//if the user commands "history"
//use function print_history to print the last 15 history till date
else if(strcmp(token[0], "history") == 0)
print_history(command_history, &history_index);
//PRINT PID HISTORY
//if the user commands "showpids"
//use function print_pids to print the last 15 history till date
else if(strcmp(token[0], "showpids") == 0)
print_pids(pid_history, &pid_index);
//CHANGE DIRECTORY CD
//if user commands cd 'path' change dir to path
//if user commands cd .. move one dir back
//use change_directory functon
else if(strcmp(token[0], "cd") == 0)
change_directory(token[1]);
else{
//SYSTEM CALLS
//we will now implement exec calls
//commands shall be searched in following order
//Current working directory
// /usr/local/bin
// /usr/bin
// /bin
//Fork the process and store it in pid_t --> could land into
//child process or parent process
pid_t pid_0 = fork();
//if pid_0 lands on child it will have a value of 0
if(pid_0 == 0){
//execute the exec function using arguments token[0] for the commands
//token includes all the arguments following command
//execvp takes the command and an array of argumens
//it returns -1 if it could not execute or invalid command
if(execvp(token[0], token) == -1){
//print the error and offer help
//perror is a global variable that stores the recent error
perror(*token);
}
//make sure we kill runnin child process before we continue into the parent
return 0;
}
//else it will have the value of the child process
else{
//record the pid value.
//if the pid is not zero than it will contain the pid for
//the child process that is why we use parent process to store child pid.
record_pid(pid_history, &pid_index, pid_0);
//make sure child process executes first
//wait pid waits for the input pid to execute
waitpid(pid_0, &status, 0);
}
}
//set hitory accesed to false to continue msh input
history_accessed = false;
free( working_root );
}
return 0;
}
/*FUNCTION DEFINITIONS*/
//Record the history of input of command line into command_history
//Keep track of history_index and increase it by one at the end of the function
void record_history(char command_history[MAX_RECORD_SIZE][MAX_COMMAND_SIZE],
int* history_index, char* command_input ){
//copy the command into history directly if history recorded is less thab max size
if(*history_index < MAX_RECORD_SIZE)
strcpy(command_history[*history_index], command_input);
//move the history of records by one and add the new record at the end.
else{
//Say i is row of records and j is column of records.
int i, j;
for (i = 0; i < MAX_RECORD_SIZE; i++)
for (j = 0; j < MAX_COMMAND_SIZE; j++)
command_history[i][j] = command_history[i + 1][j];
strcpy(command_history[MAX_RECORD_SIZE - 1], command_input);
}
//increase the tracker by one for next record.
*history_index = *history_index + 1;
}
//Record the history of pid of processed created in msh
//Keep track of pid_index and increase it by one at the end of the function
void record_pid(int pid_history[MAX_RECORD_SIZE], int* pid_index, int pid ){
//copy the pid into pid_history directly if pid created is less thab max size
if(*pid_index < MAX_RECORD_SIZE)
pid_history[*pid_index] = pid;
//move the pid record by one and add the new record at the end.
else{
int i;
for (i = 0; i < MAX_RECORD_SIZE; i++)
{
pid_history[i] = pid_history[i + 1];
}
pid_history[MAX_RECORD_SIZE - 1] = pid;
}
//increase the tracker by one for next record.
*pid_index = *pid_index + 1;
}
//print the history of the commands inputed.
//if the history if less the Max allowed it must only print whats in there
// if the history is greater than Max allowd, only print the max allowed
void print_history(char command_history[MAX_RECORD_SIZE][MAX_COMMAND_SIZE],
int* history_index){
int i, max_index = *history_index;;
//Make sure the history index is less than 15 before printing hstory
if(*history_index > 15)
*history_index = 15;
for (i = 0; i < *history_index; i++)
printf("%d: %s", i + 1, command_history[i]);
//keep track of all the command executed
*history_index = max_index;
}
//print the history of the pids of process created.
//if the history is less the Max allowed it must only print whats in there
//if the history is greater than Max allowd, only print the max allowed
void print_pids(int pid_history[MAX_RECORD_SIZE],
int* pid_index){
int i, max_index = *pid_index;
//Make sure the history index is less than 15 before printing hstory
if(*pid_index > 15)
*pid_index = 15;
for (i = 0; i < *pid_index; i++)
printf("%d: %d\n", i + 1, pid_history[i]);
//keep track of all the process executed
*pid_index = max_index;
}
//parse the input begining with ! to find the index in history
//Use the comman_history array to find the index pointed command
//return if given index is greater than the record
//copy the record into cmd_str if the index is valid.
void acess_history(char command_history[MAX_RECORD_SIZE][MAX_COMMAND_SIZE],
int *history_accessed, char* cmd_str, int* history_index){
//parse the string
int index = atoi(&cmd_str[1]);
//Invalid command if index is greater than the size of the 2d array
if(index > MAX_RECORD_SIZE || index > *history_index || index <= 0){
printf("Command not in history.\n");
*history_accessed = false;
return;
}
//if valid use the command by coppying it into cmd_str
else
strcpy(cmd_str, command_history[index-1]);
//update the history accesed boolean value
*history_accessed = true;
}
//Change the directory using chdir function
//Make sure empty path is not provided
//Prompt the user that directory is not found if given path is not valid
void change_directory(char *dir_path){
//check if path is provided
if(dir_path == NULL)
printf("Invalid Directory Path.\n");
//change the directory --> works with cd ..
else if(chdir(dir_path) == -1)
printf("%s: Directory not found.\n", dir_path);
}
| 33.952255 | 102 | 0.663672 |
31167e6e662eefd52e75e8758b6d747366d60db0 | 945 | h | C | firmware/middlewares/id3v2lib/utils.h | zephray/Fobu | 3f07281cd1dac7ee6ae7304d7b9e5b996f14dd4a | [
"MIT"
] | 11 | 2020-11-04T01:57:07.000Z | 2022-03-19T16:56:39.000Z | firmware/middlewares/id3v2lib/utils.h | zephray/Fobu | 3f07281cd1dac7ee6ae7304d7b9e5b996f14dd4a | [
"MIT"
] | null | null | null | firmware/middlewares/id3v2lib/utils.h | zephray/Fobu | 3f07281cd1dac7ee6ae7304d7b9e5b996f14dd4a | [
"MIT"
] | 3 | 2021-02-24T10:41:43.000Z | 2021-09-02T21:15:23.000Z | /*
* This file is part of the id3v2lib library
*
* Copyright (c) 2013, Lorenzo Ruiz
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
#ifndef id3v2lib_utils_h
#define id3v2lib_utils_h
#include "types.h"
unsigned int btoi(char* bytes, int size, int offset);
char* itob(int integer);
int syncint_encode(int value);
int syncint_decode(int value);
void add_to_list(ID3v2_frame_list* list, ID3v2_frame* frame);
ID3v2_frame* get_from_list(ID3v2_frame_list* list, char* frame_id);
void free_tag(ID3v2_tag* tag);
char* get_mime_type_from_filename(const char* filename);
void genre_num_string(char* dest, char *genre_data);
char* convert_genre_number(int number);
// String functions
int has_bom(uint16_t* string);
uint16_t* char_to_utf16(char* string, int size);
void println_utf16(uint16_t* string, int size);
char* get_path_to_file(const char* file);
#endif
| 27.794118 | 74 | 0.773545 |
311759b14ff1217078a44e4ce0d32c515b564e04 | 1,131 | h | C | source/mesh_renderer.h | yorung/dx11bvh | e7b1a7fe3a91f23148cebcfd05a150693ea03db6 | [
"MIT"
] | 3 | 2015-03-17T07:30:46.000Z | 2020-02-28T20:22:43.000Z | source/mesh_renderer.h | yorung/dx11bvh | e7b1a7fe3a91f23148cebcfd05a150693ea03db6 | [
"MIT"
] | 1 | 2016-08-07T12:41:10.000Z | 2016-08-07T12:41:10.000Z | source/mesh_renderer.h | yorung/dx11bvh | e7b1a7fe3a91f23148cebcfd05a150693ea03db6 | [
"MIT"
] | null | null | null | struct Block;
struct MeshVertex;
struct MeshColor;
struct MeshSkin;
typedef int MMID;
class Material
{
public:
Material() {}
Material(const Material& r) { *this = r; }
const Material& operator=(const Material& r);
bool operator==(const Material& r) const;
Vec4 faceColor;
Vec3 specular;
float power = 0;
Vec3 emissive;
SRVID texture;
};
class MatMan
{
std::vector<Material> mats;
public:
~MatMan();
MMID Create(const Material& mat);
void Destroy();
const Material* Get(MMID id);
};
extern MatMan matMan;
class MeshRenderer
{
UBOID uboId;
ID3D11Buffer* posBuffer;
VBOID colorBuffer;
ID3D11Buffer* skinBuffer;
ID3D11Buffer* skinnedPosBuffer;
IBOID iboId;
SAMPLERID sampler;
ShaderMan::SMID shaderId;
VAOID vao;
public:
MeshRenderer();
~MeshRenderer();
void Destroy();
void Init(int numVertices, const MeshVertex* vertices, const MeshColor* color, const MeshSkin* skin, int numIndices, const AFIndex* indices);
void Init(const Block& block);
void Calc(const Mat BoneMatrices[BONE_MAX], const Block& block) const;
void Draw(const Mat BoneMatrices[BONE_MAX], int nBones, const Block& block) const;
};
| 20.944444 | 142 | 0.740937 |
3118e398b85ef9a3bd082934fa0cfc006cf90e58 | 626 | h | C | OutPutHeaders/UnifyAuthResponse.h | cocos543/WeChatTimeLineRobot | 1e93480e502e36ca9a21a506f481aa1fcb70ac4b | [
"MIT"
] | 106 | 2016-04-09T01:16:14.000Z | 2021-06-04T00:20:24.000Z | OutPutHeaders/UnifyAuthResponse.h | cocos543/WeChatTimeLineRobot | 1e93480e502e36ca9a21a506f481aa1fcb70ac4b | [
"MIT"
] | 2 | 2017-06-13T09:41:29.000Z | 2018-03-26T03:32:07.000Z | OutPutHeaders/UnifyAuthResponse.h | cocos543/WeChatTimeLineRobot | 1e93480e502e36ca9a21a506f481aa1fcb70ac4b | [
"MIT"
] | 58 | 2016-04-28T09:52:08.000Z | 2021-12-25T06:42:14.000Z | /**
* This header is generated by class-dump-z 0.2a.
* class-dump-z is Copyright (C) 2009 by KennyTM~, licensed under GPLv3.
*
* Source: (null)
*/
#import "WXPBGeneratedMessage.h"
@class NetworkSectResp, AuthSectResp, AcctSectResp, BaseResponse;
@interface UnifyAuthResponse : WXPBGeneratedMessage {
}
@property(retain, nonatomic) NetworkSectResp* networkSectResp;
@property(retain, nonatomic) AcctSectResp* acctSectResp;
@property(retain, nonatomic) AuthSectResp* authSectResp;
@property(assign, nonatomic) unsigned unifyAuthSectFlag;
@property(retain, nonatomic) BaseResponse* baseResponse;
+(void)initialize;
@end
| 28.454545 | 72 | 0.777955 |
311a35bf79867aa220a15a8b23c2f1077f475782 | 1,648 | h | C | options/posix/include/sched.h | StartForKillerMC/temprep | 73d1135b891a0fa55d6c6537c94ad9c0bcb657ab | [
"MIT"
] | null | null | null | options/posix/include/sched.h | StartForKillerMC/temprep | 73d1135b891a0fa55d6c6537c94ad9c0bcb657ab | [
"MIT"
] | null | null | null | options/posix/include/sched.h | StartForKillerMC/temprep | 73d1135b891a0fa55d6c6537c94ad9c0bcb657ab | [
"MIT"
] | null | null | null |
#ifndef _SCHED_H
#define _SCHED_H
#include <bits/posix/pid_t.h>
#include <bits/size_t.h>
// MISSING: time_t, struct timespec
// MISSING: POSIX [PS], [SS] and [TSP] options
#define CLONE_VM 0x00000100
#define CLONE_FS 0x00000200
#define CLONE_FILES 0x00000400
#define CLONE_SIGHAND 0x00000800
#define CLONE_PTRACE 0x00002000
#define CLONE_VFORK 0x00004000
#define CLONE_PARENT 0x00008000
#define CLONE_THREAD 0x00010000
#define CLONE_NEWNS 0x00020000
#define CLONE_SYSVSEM 0x00040000
#define CLONE_SETTLS 0x00080000
#define CLONE_PARENT_SETTID 0x00100000
#define CLONE_CHILD_CLEARTID 0x00200000
#define CLONE_DETACHED 0x00400000
#define CLONE_UNTRACED 0x00800000
#define CLONE_CHILD_SETTID 0x01000000
#define CLONE_NEWCGROUP 0x02000000
#define CLONE_NEWUTS 0x04000000
#define CLONE_NEWIPC 0x08000000
#define CLONE_NEWUSER 0x10000000
#define CLONE_NEWPID 0x20000000
#define CLONE_NEWNET 0x40000000
#define CLONE_IO 0x80000000
#define CPU_SETSIZE 128
#define CPU_ISSET __mlibc_cpu_isset
#define CPU_COUNT __mlibc_cpu_count
#ifdef __cplusplus
extern "C" {
#endif
#define SCHED_OTHER 0
#define SCHED_FIFO 1
#define SCHED_RR 2
#define SCHED_BATCH 3
#define SCHED_IDLE 5
#define SCHED_DEADLINE 6
#define SCHED_RESET_ON_FORK 0x40000000
struct sched_param {
int sched_priority;
};
int sched_yield();
struct __mlibc_cpu_set {
unsigned long __bits[128/sizeof(long)];
};
typedef struct __mlibc_cpu_set cpu_set_t;
int sched_getaffinity(pid_t pid, size_t cpusetsize, cpu_set_t *mask);
int unshare(int flags);
int __mlibc_cpu_isset(int cpu, cpu_set_t *set);
int __mlibc_cpu_count(cpu_set_t *set);
#ifdef __cplusplus
}
#endif
#endif // _SCHED_H
| 21.684211 | 69 | 0.820995 |
311acef0d260df7a49f611914c9581544bc3a298 | 1,839 | h | C | sources/Platform/MacOS/MacOSWindow.h | underdoeg/LLGL | d1dc3fcb1ea3c49744649552bbe198f05ccde085 | [
"BSD-3-Clause"
] | null | null | null | sources/Platform/MacOS/MacOSWindow.h | underdoeg/LLGL | d1dc3fcb1ea3c49744649552bbe198f05ccde085 | [
"BSD-3-Clause"
] | null | null | null | sources/Platform/MacOS/MacOSWindow.h | underdoeg/LLGL | d1dc3fcb1ea3c49744649552bbe198f05ccde085 | [
"BSD-3-Clause"
] | null | null | null | /*
* MacOSWindow.h
*
* This file is part of the "LLGL" project (Copyright (c) 2015-2019 by Lukas Hermanns)
* See "LICENSE.txt" for license information.
*/
#ifndef LLGL_MACOS_WINDOW_H
#define LLGL_MACOS_WINDOW_H
#include <Cocoa/Cocoa.h>
#include <LLGL/Window.h>
namespace LLGL
{
class MacOSWindow : public Window
{
public:
MacOSWindow(const WindowDescriptor& desc);
bool GetNativeHandle(void* nativeHandle, std::size_t nativeHandleSize) const override;
void ResetPixelFormat() override;
Extent2D GetContentSize() const override;
void SetPosition(const Offset2D& position) override;
Offset2D GetPosition() const override;
void SetSize(const Extent2D& size, bool useClientArea = true) override;
Extent2D GetSize(bool useClientArea = true) const override;
void SetTitle(const std::wstring& title) override;
std::wstring GetTitle() const override;
void Show(bool show = true) override;
bool IsShown() const override;
void SetDesc(const WindowDescriptor& desc) override;
WindowDescriptor GetDesc() const override;
// Returns the native NSWindow* object.
inline NSWindow* GetNSWindow() const
{
return wnd_;
}
private:
void OnProcessEvents() override;
void ProcessKeyEvent(NSEvent* event, bool down);
void ProcessMouseKeyEvent(Key key, bool down);
void ProcessMouseMoveEvent(NSEvent* event);
void ProcessMouseWheelEvent(NSEvent* event);
NSWindow* CreateNSWindow(const WindowDescriptor& desc);
NSWindow* wnd_ = nullptr;
Offset2D prevMotionOffset_;
};
} // /namespace LLGL
#endif
// ================================================================================
| 23.278481 | 94 | 0.632953 |
311b4f9a51323a7eda3c35ea16a2ab3a9a61cc06 | 8,533 | c | C | linux-3.16/drivers/phy/phy-omap-control.c | jj1232727/system_call | 145315cdf532c45b6aa753d98260d2b1c0b63abc | [
"Unlicense"
] | null | null | null | linux-3.16/drivers/phy/phy-omap-control.c | jj1232727/system_call | 145315cdf532c45b6aa753d98260d2b1c0b63abc | [
"Unlicense"
] | null | null | null | linux-3.16/drivers/phy/phy-omap-control.c | jj1232727/system_call | 145315cdf532c45b6aa753d98260d2b1c0b63abc | [
"Unlicense"
] | null | null | null | /*
* omap-control-phy.c - The PHY part of control module.
*
* Copyright (C) 2013 Texas Instruments Incorporated - http://www.ti.com
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* Author: Kishon Vijay Abraham I <kishon@ti.com>
*
* 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.
*
*/
#include <linux/module.h>
#include <linux/platform_device.h>
#include <linux/slab.h>
#include <linux/of.h>
#include <linux/of_device.h>
#include <linux/err.h>
#include <linux/io.h>
#include <linux/clk.h>
#include <linux/phy/omap_control_phy.h>
/**
* omap_control_phy_power - power on/off the phy using control module reg
* @dev: the control module device
* @on: 0 or 1, based on powering on or off the PHY
*/
void omap_control_phy_power(struct device *dev, int on)
{
u32 val;
unsigned long rate;
struct omap_control_phy *control_phy;
if (IS_ERR(dev) || !dev) {
pr_err("%s: invalid device\n", __func__);
return;
}
control_phy = dev_get_drvdata(dev);
if (!control_phy) {
dev_err(dev, "%s: invalid control phy device\n", __func__);
return;
}
if (control_phy->type == OMAP_CTRL_TYPE_OTGHS)
return;
val = readl(control_phy->power);
switch (control_phy->type) {
case OMAP_CTRL_TYPE_USB2:
if (on)
val &= ~OMAP_CTRL_DEV_PHY_PD;
else
val |= OMAP_CTRL_DEV_PHY_PD;
break;
case OMAP_CTRL_TYPE_PIPE3:
rate = clk_get_rate(control_phy->sys_clk);
rate = rate/1000000;
if (on) {
val &= ~(OMAP_CTRL_PIPE3_PHY_PWRCTL_CLK_CMD_MASK |
OMAP_CTRL_PIPE3_PHY_PWRCTL_CLK_FREQ_MASK);
val |= OMAP_CTRL_PIPE3_PHY_TX_RX_POWERON <<
OMAP_CTRL_PIPE3_PHY_PWRCTL_CLK_CMD_SHIFT;
val |= rate <<
OMAP_CTRL_PIPE3_PHY_PWRCTL_CLK_FREQ_SHIFT;
} else {
val &= ~OMAP_CTRL_PIPE3_PHY_PWRCTL_CLK_CMD_MASK;
val |= OMAP_CTRL_PIPE3_PHY_TX_RX_POWEROFF <<
OMAP_CTRL_PIPE3_PHY_PWRCTL_CLK_CMD_SHIFT;
}
break;
case OMAP_CTRL_TYPE_DRA7USB2:
if (on)
val &= ~OMAP_CTRL_USB2_PHY_PD;
else
val |= OMAP_CTRL_USB2_PHY_PD;
break;
case OMAP_CTRL_TYPE_AM437USB2:
if (on) {
val &= ~(AM437X_CTRL_USB2_PHY_PD |
AM437X_CTRL_USB2_OTG_PD);
val |= (AM437X_CTRL_USB2_OTGVDET_EN |
AM437X_CTRL_USB2_OTGSESSEND_EN);
} else {
val &= ~(AM437X_CTRL_USB2_OTGVDET_EN |
AM437X_CTRL_USB2_OTGSESSEND_EN);
val |= (AM437X_CTRL_USB2_PHY_PD |
AM437X_CTRL_USB2_OTG_PD);
}
break;
default:
dev_err(dev, "%s: type %d not recognized\n",
__func__, control_phy->type);
break;
}
writel(val, control_phy->power);
}
EXPORT_SYMBOL_GPL(omap_control_phy_power);
/**
* omap_control_usb_host_mode - set AVALID, VBUSVALID and ID pin in grounded
* @ctrl_phy: struct omap_control_phy *
*
* Writes to the mailbox register to notify the usb core that a usb
* device has been connected.
*/
static void omap_control_usb_host_mode(struct omap_control_phy *ctrl_phy)
{
u32 val;
val = readl(ctrl_phy->otghs_control);
val &= ~(OMAP_CTRL_DEV_IDDIG | OMAP_CTRL_DEV_SESSEND);
val |= OMAP_CTRL_DEV_AVALID | OMAP_CTRL_DEV_VBUSVALID;
writel(val, ctrl_phy->otghs_control);
}
/**
* omap_control_usb_device_mode - set AVALID, VBUSVALID and ID pin in high
* impedance
* @ctrl_phy: struct omap_control_phy *
*
* Writes to the mailbox register to notify the usb core that it has been
* connected to a usb host.
*/
static void omap_control_usb_device_mode(struct omap_control_phy *ctrl_phy)
{
u32 val;
val = readl(ctrl_phy->otghs_control);
val &= ~OMAP_CTRL_DEV_SESSEND;
val |= OMAP_CTRL_DEV_IDDIG | OMAP_CTRL_DEV_AVALID |
OMAP_CTRL_DEV_VBUSVALID;
writel(val, ctrl_phy->otghs_control);
}
/**
* omap_control_usb_set_sessionend - Enable SESSIONEND and IDIG to high
* impedance
* @ctrl_phy: struct omap_control_phy *
*
* Writes to the mailbox register to notify the usb core it's now in
* disconnected state.
*/
static void omap_control_usb_set_sessionend(struct omap_control_phy *ctrl_phy)
{
u32 val;
val = readl(ctrl_phy->otghs_control);
val &= ~(OMAP_CTRL_DEV_AVALID | OMAP_CTRL_DEV_VBUSVALID);
val |= OMAP_CTRL_DEV_IDDIG | OMAP_CTRL_DEV_SESSEND;
writel(val, ctrl_phy->otghs_control);
}
/**
* omap_control_usb_set_mode - Calls to functions to set USB in one of host mode
* or device mode or to denote disconnected state
* @dev: the control module device
* @mode: The mode to which usb should be configured
*
* This is an API to write to the mailbox register to notify the usb core that
* a usb device has been connected.
*/
void omap_control_usb_set_mode(struct device *dev,
enum omap_control_usb_mode mode)
{
struct omap_control_phy *ctrl_phy;
if (IS_ERR(dev) || !dev)
return;
ctrl_phy = dev_get_drvdata(dev);
if (!ctrl_phy) {
dev_err(dev, "Invalid control phy device\n");
return;
}
if (ctrl_phy->type != OMAP_CTRL_TYPE_OTGHS)
return;
switch (mode) {
case USB_MODE_HOST:
omap_control_usb_host_mode(ctrl_phy);
break;
case USB_MODE_DEVICE:
omap_control_usb_device_mode(ctrl_phy);
break;
case USB_MODE_DISCONNECT:
omap_control_usb_set_sessionend(ctrl_phy);
break;
default:
dev_vdbg(dev, "invalid omap control usb mode\n");
}
}
EXPORT_SYMBOL_GPL(omap_control_usb_set_mode);
#ifdef CONFIG_OF
static const enum omap_control_phy_type otghs_data = OMAP_CTRL_TYPE_OTGHS;
static const enum omap_control_phy_type usb2_data = OMAP_CTRL_TYPE_USB2;
static const enum omap_control_phy_type pipe3_data = OMAP_CTRL_TYPE_PIPE3;
static const enum omap_control_phy_type dra7usb2_data = OMAP_CTRL_TYPE_DRA7USB2;
static const enum omap_control_phy_type am437usb2_data = OMAP_CTRL_TYPE_AM437USB2;
static const struct of_device_id omap_control_phy_id_table[] = {
{
.compatible = "ti,control-phy-otghs",
.data = &otghs_data,
},
{
.compatible = "ti,control-phy-usb2",
.data = &usb2_data,
},
{
.compatible = "ti,control-phy-pipe3",
.data = &pipe3_data,
},
{
.compatible = "ti,control-phy-usb2-dra7",
.data = &dra7usb2_data,
},
{
.compatible = "ti,control-phy-usb2-am437",
.data = &am437usb2_data,
},
{},
};
MODULE_DEVICE_TABLE(of, omap_control_phy_id_table);
#endif
static int omap_control_phy_probe(struct platform_device *pdev)
{
struct resource *res;
const struct of_device_id *of_id;
struct omap_control_phy *control_phy;
of_id = of_match_device(of_match_ptr(omap_control_phy_id_table),
&pdev->dev);
if (!of_id)
return -EINVAL;
control_phy = devm_kzalloc(&pdev->dev, sizeof(*control_phy),
GFP_KERNEL);
if (!control_phy) {
dev_err(&pdev->dev, "unable to alloc memory for control phy\n");
return -ENOMEM;
}
control_phy->dev = &pdev->dev;
control_phy->type = *(enum omap_control_phy_type *)of_id->data;
if (control_phy->type == OMAP_CTRL_TYPE_OTGHS) {
res = platform_get_resource_byname(pdev, IORESOURCE_MEM,
"otghs_control");
control_phy->otghs_control = devm_ioremap_resource(
&pdev->dev, res);
if (IS_ERR(control_phy->otghs_control))
return PTR_ERR(control_phy->otghs_control);
} else {
res = platform_get_resource_byname(pdev, IORESOURCE_MEM,
"power");
control_phy->power = devm_ioremap_resource(&pdev->dev, res);
if (IS_ERR(control_phy->power)) {
dev_err(&pdev->dev, "Couldn't get power register\n");
return PTR_ERR(control_phy->power);
}
}
if (control_phy->type == OMAP_CTRL_TYPE_PIPE3) {
control_phy->sys_clk = devm_clk_get(control_phy->dev,
"sys_clkin");
if (IS_ERR(control_phy->sys_clk)) {
pr_err("%s: unable to get sys_clkin\n", __func__);
return -EINVAL;
}
}
dev_set_drvdata(control_phy->dev, control_phy);
return 0;
}
static struct platform_driver omap_control_phy_driver = {
.probe = omap_control_phy_probe,
.driver = {
.name = "omap-control-phy",
.owner = THIS_MODULE,
.of_match_table = of_match_ptr(omap_control_phy_id_table),
},
};
static int __init omap_control_phy_init(void)
{
return platform_driver_register(&omap_control_phy_driver);
}
subsys_initcall(omap_control_phy_init);
static void __exit omap_control_phy_exit(void)
{
platform_driver_unregister(&omap_control_phy_driver);
}
module_exit(omap_control_phy_exit);
MODULE_ALIAS("platform: omap_control_phy");
MODULE_AUTHOR("Texas Instruments Inc.");
MODULE_DESCRIPTION("OMAP Control Module PHY Driver");
MODULE_LICENSE("GPL v2");
| 26.582555 | 82 | 0.741826 |
311b6161e486785a1e134b7beb296fa00847c1ce | 6,498 | c | C | usr/src/sys/arch/sh/sh/db_trace.c | sizeofvoid/ifconfigd | bdff4b2cec6d572c1450cb44f32c0bdab1b49e5f | [
"BSD-2-Clause"
] | 2 | 2020-04-15T13:39:01.000Z | 2020-08-28T01:27:00.000Z | usr/src/sys/arch/sh/sh/db_trace.c | sizeofvoid/ifconfigd | bdff4b2cec6d572c1450cb44f32c0bdab1b49e5f | [
"BSD-2-Clause"
] | null | null | null | usr/src/sys/arch/sh/sh/db_trace.c | sizeofvoid/ifconfigd | bdff4b2cec6d572c1450cb44f32c0bdab1b49e5f | [
"BSD-2-Clause"
] | 1 | 2020-08-28T01:25:41.000Z | 2020-08-28T01:25:41.000Z | /* $OpenBSD: db_trace.c,v 1.5 2008/06/22 21:02:11 miod Exp $ */
/* $NetBSD: db_trace.c,v 1.19 2006/01/21 22:10:59 uwe Exp $ */
/*-
* Copyright (c) 2000 Tsubai Masanari. 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. The name of the author may not be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include <sys/param.h>
#include <sys/systm.h>
#include <machine/db_machdep.h>
#include <ddb/db_access.h>
#include <ddb/db_interface.h>
#include <ddb/db_output.h>
#include <ddb/db_sym.h>
#include <ddb/db_variables.h>
#ifdef TRACE_DEBUG
# define DPRINTF printf
#else
# define DPRINTF while (/* CONSTCOND */ 0) printf
#endif
extern char start[], etext[];
void db_nextframe(db_addr_t, db_addr_t *, db_addr_t *);
struct db_variable db_regs[] = {
{ "r0", (long *)&ddb_regs.tf_r0, FCN_NULL },
{ "r1", (long *)&ddb_regs.tf_r1, FCN_NULL },
{ "r2", (long *)&ddb_regs.tf_r2, FCN_NULL },
{ "r3", (long *)&ddb_regs.tf_r3, FCN_NULL },
{ "r4", (long *)&ddb_regs.tf_r4, FCN_NULL },
{ "r5", (long *)&ddb_regs.tf_r5, FCN_NULL },
{ "r6", (long *)&ddb_regs.tf_r6, FCN_NULL },
{ "r7", (long *)&ddb_regs.tf_r7, FCN_NULL },
{ "r8", (long *)&ddb_regs.tf_r8, FCN_NULL },
{ "r9", (long *)&ddb_regs.tf_r9, FCN_NULL },
{ "r10", (long *)&ddb_regs.tf_r10, FCN_NULL },
{ "r11", (long *)&ddb_regs.tf_r11, FCN_NULL },
{ "r12", (long *)&ddb_regs.tf_r12, FCN_NULL },
{ "r13", (long *)&ddb_regs.tf_r13, FCN_NULL },
{ "r14", (long *)&ddb_regs.tf_r14, FCN_NULL },
{ "r15", (long *)&ddb_regs.tf_r15, FCN_NULL },
{ "pr", (long *)&ddb_regs.tf_pr, FCN_NULL },
{ "spc", (long *)&ddb_regs.tf_spc, FCN_NULL },
{ "ssr", (long *)&ddb_regs.tf_ssr, FCN_NULL },
{ "mach", (long *)&ddb_regs.tf_mach, FCN_NULL },
{ "macl", (long *)&ddb_regs.tf_macl, FCN_NULL },
};
struct db_variable *db_eregs =
db_regs + sizeof(db_regs)/sizeof(db_regs[0]);
void
db_stack_trace_print(db_expr_t addr, int have_addr, db_expr_t count,
char *modif, int (*print)(const char *, ...))
{
db_addr_t callpc, frame, lastframe;
uint32_t vbr;
if (have_addr) {
(*print)("sh trace requires a trap frame... giving up\n");
return;
}
__asm volatile("stc vbr, %0" : "=r"(vbr));
frame = ddb_regs.tf_r14;
callpc = ddb_regs.tf_spc;
if (count == 0 || count == -1)
count = INT_MAX;
lastframe = 0;
while (count > 0 && frame != 0) {
/* Are we crossing a trap frame? */
if ((callpc & ~PAGE_MASK) == vbr) {
struct trapframe *tf = (void *)frame;
frame = tf->tf_r14;
callpc = tf->tf_spc;
(*print)("(EXPEVT %03x; SSR=%08x) at ",
tf->tf_expevt, tf->tf_ssr);
db_printsym(callpc, DB_STGY_PROC, print);
(*print)("\n");
/* XXX: don't venture into the userland yet */
if ((tf->tf_ssr & PSL_MD) == 0)
break;
} else {
char *name;
db_expr_t offset;
db_sym_t sym;
DPRINTF(" (1)newpc 0x%lx, newfp 0x%lx\n",
callpc, frame);
sym = db_search_symbol(callpc, DB_STGY_ANY, &offset);
db_symbol_values(sym, &name, NULL);
(*print)("%s() at ", name ? name : "");
db_printsym(callpc, DB_STGY_PROC, print);
(*print)("\n");
if (lastframe == 0 && offset == 0) {
callpc = ddb_regs.tf_pr;
continue;
}
db_nextframe(callpc - offset, &frame, &callpc);
DPRINTF(" (2)newpc 0x%lx, newfp 0x%lx\n",
callpc, frame);
if (callpc == 0 && lastframe == 0)
callpc = (db_addr_t)ddb_regs.tf_pr;
DPRINTF(" (3)newpc 0x%lx, newfp 0x%lx\n",
callpc, frame);
}
count--;
lastframe = frame;
}
}
void
db_nextframe(
db_addr_t pc, /* in: entry address of current function */
db_addr_t *fp, /* in: current fp, out: parent fp */
db_addr_t *pr) /* out: parent pr */
{
int *frame = (void *)*fp;
int i, inst;
int depth, prdepth, fpdepth;
depth = 0;
prdepth = fpdepth = -1;
if (pc < (db_addr_t)start || pc > (db_addr_t)etext)
goto out;
for (i = 0; i < 30; i++) {
inst = db_get_value(pc, 2, FALSE);
pc += 2;
if (inst == 0x6ef3) /* mov r15,r14 -- end of prologue */
break;
if (inst == 0x4f22) { /* sts.l pr,@-r15 */
prdepth = depth;
depth++;
continue;
}
if (inst == 0x2fe6) { /* mov.l r14,@-r15 */
fpdepth = depth;
depth++;
continue;
}
if ((inst & 0xff0f) == 0x2f06) { /* mov.l r?,@-r15 */
depth++;
continue;
}
if ((inst & 0xff00) == 0x7f00) { /* add #n,r15 */
int8_t n = inst & 0xff;
if (n >= 0) {
printf("add #n,r15 (n > 0)\n");
break;
}
depth += -n/4;
continue;
}
if ((inst & 0xf000) == 0x9000) {
if (db_get_value(pc, 2, FALSE) == 0x3f38) {
/* "mov #n,r3; sub r3,r15" */
unsigned int disp = (int)(inst & 0xff);
int r3;
r3 = db_get_value(pc + 4 - 2 + (disp << 1),
2, FALSE);
if ((r3 & 0x00008000) == 0)
r3 &= 0x0000ffff;
else
r3 |= 0xffff0000;
depth += (r3 / 4);
pc += 2;
continue;
}
}
#ifdef TRACE_DEBUG
printf("unknown instruction in prologue\n");
db_disasm(pc - 2, 0);
#endif
}
out:
#ifdef TRACE_DEBUG
printf("depth=%x fpdepth=0x%x prdepth=0x%x\n", depth, fpdepth, prdepth);
#endif
if (fpdepth != -1)
*fp = frame[depth - fpdepth - 1];
else
*fp = 0;
if (prdepth != -1)
*pr = frame[depth - prdepth - 1];
else
*pr = 0;
}
| 27.417722 | 76 | 0.622191 |
311cae3d3e80c4ff315d1e8dcd4b46c1fcd8a41d | 4,167 | h | C | src/libc/tinymath/tinymath.h | nicholatian/cosmo-cstar | 3d4d050346c34374679f19c3f39fc555502a0f72 | [
"0BSD"
] | 2 | 2021-02-13T19:26:06.000Z | 2021-03-03T12:28:34.000Z | src/libc/tinymath/tinymath.h | nicholatian/cosmo-cstar | 3d4d050346c34374679f19c3f39fc555502a0f72 | [
"0BSD"
] | null | null | null | src/libc/tinymath/tinymath.h | nicholatian/cosmo-cstar | 3d4d050346c34374679f19c3f39fc555502a0f72 | [
"0BSD"
] | null | null | null | #ifndef COSMOPOLITAN_LIBC_TINYMATH_TINYMATH_H_
#define COSMOPOLITAN_LIBC_TINYMATH_TINYMATH_H_
#if !(__ASSEMBLER__ + __LINKER__ + 0)
COSMOPOLITAN_C_START_
float tinymath_powf(float, float) libcesque pureconst;
double tinymath_pow(double, double) libcesque pureconst;
long double tinymath_powl(long double, long double) libcesque pureconst;
float tinymath_expf(float) libcesque pureconst;
double tinymath_exp(double) libcesque pureconst;
long double tinymath_expl(long double) libcesque pureconst;
float tinymath_exp10f(float) libcesque pureconst;
double tinymath_exp10(double) libcesque pureconst;
long double tinymath_exp10l(long double) libcesque pureconst;
float tinymath_logf(float) libcesque pureconst;
double tinymath_log(double) libcesque pureconst;
long double tinymath_logl(long double) libcesque pureconst;
float tinymath_log10f(float) libcesque pureconst;
double tinymath_log10(double) libcesque pureconst;
long double tinymath_log10l(long double) libcesque pureconst;
float tinymath_ldexpf(float, int) libcesque pureconst;
double tinymath_ldexp(double, int) libcesque pureconst;
long double tinymath_ldexpl(long double, int) libcesque pureconst;
float tinymath_asinf(float) libcesque pureconst;
double tinymath_asin(double) libcesque pureconst;
long double tinymath_asinl(long double) libcesque pureconst;
float tinymath_acosf(float) libcesque pureconst;
double tinymath_acos(double) libcesque pureconst;
long double tinymath_acosl(long double) libcesque pureconst;
float tinymath_atanf(float) libcesque pureconst;
double tinymath_atan(double) libcesque pureconst;
long double tinymath_atanl(long double) libcesque pureconst;
float tinymath_atan2f(float, float) libcesque pureconst;
double tinymath_atan2(double, double) libcesque pureconst;
long double tinymath_atan2l(long double, long double) libcesque pureconst;
float tinymath_sinf(float) libcesque pureconst;
double tinymath_sin(double) libcesque pureconst;
long double tinymath_sinl(long double) libcesque pureconst;
float tinymath_cosf(float) libcesque pureconst;
double tinymath_cos(double) libcesque pureconst;
long double tinymath_cosl(long double) libcesque pureconst;
float tinymath_tanf(float) libcesque pureconst;
double tinymath_tan(double) libcesque pureconst;
long double tinymath_tanl(long double) libcesque pureconst;
void tinymath_sincosf(float, float *, float *) libcesque;
void tinymath_sincos(double, double *, double *) libcesque;
void tinymath_sincosl(long double, long double *, long double *) libcesque;
long tinymath_lroundf(float) libcesque pureconst;
long tinymath_lround(double) libcesque pureconst;
long tinymath_lroundl(long double) libcesque pureconst;
float tinymath_roundf(float) libcesque pureconst;
double tinymath_round(double) libcesque pureconst;
long double tinymath_roundl(long double) libcesque pureconst;
float tinymath_rintf(float) libcesque pureconst;
double tinymath_rint(double) libcesque pureconst;
long double tinymath_rintl(long double) libcesque pureconst;
float tinymath_nearbyintf(float) libcesque pureconst;
double tinymath_nearbyint(double) libcesque pureconst;
long double tinymath_nearbyintl(long double) libcesque pureconst;
float tinymath_truncf(float) libcesque pureconst;
double tinymath_trunc(double) libcesque pureconst;
long double tinymath_truncl(long double) libcesque pureconst;
float tinymath_floorf(float) libcesque pureconst;
double tinymath_floor(double) libcesque pureconst;
long double tinymath_floorl(long double) libcesque pureconst;
float tinymath_ceilf(float) libcesque pureconst;
double tinymath_ceil(double) libcesque pureconst;
long double tinymath_ceill(long double) libcesque pureconst;
float tinymath_remainderf(float, float) libcesque pureconst;
double tinymath_remainder(double, double) libcesque pureconst;
long double tinymath_remainderl(long double, long double) libcesque pureconst;
float tinymath_fmodf(float, float) libcesque pureconst;
double tinymath_fmod(double, double) libcesque pureconst;
long double tinymath_fmodl(long double, long double) libcesque pureconst;
COSMOPOLITAN_C_END_
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */
#endif /* COSMOPOLITAN_LIBC_TINYMATH_TINYMATH_H_ */
| 41.257426 | 78 | 0.842813 |
311dd15373e3b209bd957f1608157ed82bfe5d82 | 51 | c | C | inetsrv/msmq/src/qm/qmmgmt_s_.c | npocmaka/Windows-Server-2003 | 5c6fe3db626b63a384230a1aa6b92ac416b0765f | [
"Unlicense"
] | 17 | 2020-11-13T13:42:52.000Z | 2021-09-16T09:13:13.000Z | inetsrv/msmq/src/qm/qmmgmt_s_.c | sancho1952007/Windows-Server-2003 | 5c6fe3db626b63a384230a1aa6b92ac416b0765f | [
"Unlicense"
] | 2 | 2020-10-19T08:02:06.000Z | 2020-10-19T08:23:18.000Z | inetsrv/msmq/src/qm/qmmgmt_s_.c | sancho1952007/Windows-Server-2003 | 5c6fe3db626b63a384230a1aa6b92ac416b0765f | [
"Unlicense"
] | 14 | 2020-11-14T09:43:20.000Z | 2021-08-28T08:59:57.000Z | #pragma warning(push, 3)
#include <qmmgmt_s.c>
| 12.75 | 25 | 0.666667 |
311e3db6ee3efe6465b46d2dc6e98af7a261c947 | 7,269 | h | C | smb-ec/smbus_ec.h | llmike/smbus | fa3c7bbff27fd1157bbbb9b6cc69edc0696267d5 | [
"Apache-2.0"
] | 1 | 2017-07-20T11:04:29.000Z | 2017-07-20T11:04:29.000Z | smb-ec/smbus_ec.h | llmike/smbus | fa3c7bbff27fd1157bbbb9b6cc69edc0696267d5 | [
"Apache-2.0"
] | null | null | null | smb-ec/smbus_ec.h | llmike/smbus | fa3c7bbff27fd1157bbbb9b6cc69edc0696267d5 | [
"Apache-2.0"
] | 6 | 2016-03-22T07:01:03.000Z | 2021-07-23T07:48:12.000Z | /*
* $QNXLicenseC:
* Copyright 2011-2012, QNX Software Systems.
*
* Licensed under the Apache License, Version 2.0 (the "License"). You
* may not reproduce, modify or distribute this software 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 OF ANY KIND, either express or implied.
*
* This file may contain contributions from others, either as
* contributors under the License or as licensors under other terms.
* Please review this entire file for other proprietary rights or license
* notices, as well as the QNX Development Suite License Guide at
* http://licensing.qnx.com/license-guide/ for other information.
* $
*/
#ifndef __SMBUS_EC_H_INCLUDED
#define __SMBUS_EC_H_INCLUDED
#include "proto.h"
/****************************************************************/
/* Embedded Controller registers, i/o aperture */
/****************************************************************/
#define EC_DATA 0x00000062
#define EC_SC 0x00000066
#define EC_SC_SMI_EVT 0x00000040
#define EC_SC_SCI_EVT 0x00000020
#define EC_SC_BURST 0x00000010
#define EC_SC_CMD 0x00000008
#define EC_SC_IBF 0x00000002
#define EC_SC_OBF 0x00000001
/****************************************************************/
/* Embedded Controller command set, ACPI specification, ch 12.3 */
/****************************************************************/
/* Read Embedded Controller */
#define RD_EC 0x00000080
/* Write Embedded Controller */
#define WR_EC 0x00000081
/* Burst Enable Embedded Controller */
#define BE_EC 0x00000082
/* Burst Disable Embedded Controller */
#define BD_EC 0x00000083
/* Query Embedded Contoller */
#define QR_EC 0x00000084
/****************************************************************/
/* SMBus Controller registers, i/o aperture */
/****************************************************************/
#define SMB_PRTCL 0x00000000
#define SMB_PRTCL_PEC_EN 0x00000080
#define SMB_PRTCL_CONTROLLER_NOT_IN_USE 0x00000000
#define SMB_PRTCL_RESERVED 0x00000001
#define SMB_PRTCL_WRITE_QUICK_COMMAND 0x00000002
#define SMB_PRTCL_READ_QUICK_COMMAND 0x00000003
#define SMB_PRTCL_SEND_BYTE 0x00000004
#define SMB_PRTCL_RECEIVE_BYTE 0x00000005
#define SMB_PRTCL_WRITE_BYTE 0x00000006
#define SMB_PRTCL_READ_BYTE 0x00000007
#define SMB_PRTCL_WRITE_WORD 0x00000008
#define SMB_PRTCL_READ_WORD 0x00000009
#define SMB_PRTCL_WRITE_BLOCK 0x0000000A
#define SMB_PRTCL_READ_BLOCK 0x0000000B
#define SMB_PRTCL_PROCESS_CALL 0x0000000C
#define SMB_PRTCL_BLOCK_PROCESS_CALL 0x0000000D
#define SMB_STS 0x00000001
#define SMB_STS_DONE 0x00000080
#define SMB_STS_ALRM 0x00000040
#define SMB_STS_RES 0x00000020
#define SMB_STS_STATUS_MASK 0x0000001F
#define SMB_STATUS_OK 0x00000000
#define SMB_STATUS_UKNOWN_FAILURE 0x00000007
#define SMB_STATUS_DEVICE_ADDRESS_NOT_ACK 0x00000010
#define SMB_STATUS_DEVICE_ERROR 0x00000011
#define SMB_STATUS_DEVICE_CMD_ACCESS_DEN 0x00000012
#define SMB_STATUS_SMBUS_UNKNOWN_ERROR 0x00000013
#define SMB_STATUS_DEVICE_ADDR_ACCESS_DEN 0x00000017
#define SMB_STATUS_SMBUS_TIMEOUT 0x00000018
#define SMB_STATUS_HOST_UNSUPP_PROTOCOL 0x00000019
#define SMB_STATUS_SMBUS_BUSY 0x0000001A
#define SMB_STATUS_SMBUS_PEC_ERROR 0x0000001F
#define SMB_ADDR 0x00000002
#define SMB_CMD 0x00000003
#define SMB_DATA0 0x00000004
#define SMB_DATA1 0x00000005
#define SMB_DATA2 0x00000006
#define SMB_DATA3 0x00000007
#define SMB_DATA4 0x00000008
#define SMB_DATA5 0x00000009
#define SMB_DATA6 0x0000000A
#define SMB_DATA7 0x0000000B
#define SMB_DATA8 0x0000000C
#define SMB_DATA9 0x0000000D
#define SMB_DATA10 0x0000000E
#define SMB_DATA11 0x0000000F
#define SMB_DATA12 0x00000010
#define SMB_DATA13 0x00000011
#define SMB_DATA14 0x00000012
#define SMB_DATA15 0x00000013
#define SMB_DATA16 0x00000014
#define SMB_DATA17 0x00000015
#define SMB_DATA18 0x00000016
#define SMB_DATA19 0x00000017
#define SMB_DATA20 0x00000018
#define SMB_DATA21 0x00000019
#define SMB_DATA22 0x0000001A
#define SMB_DATA23 0x0000001B
#define SMB_DATA24 0x0000001C
#define SMB_DATA25 0x0000001D
#define SMB_DATA26 0x0000001E
#define SMB_DATA27 0x0000001F
#define SMB_DATA28 0x00000020
#define SMB_DATA29 0x00000021
#define SMB_DATA30 0x00000022
#define SMB_DATA31 0x00000023
#define SMB_BCNT 0x00000024
#define SMB_ALRM_ADDR 0x00000025
#define SMB_ALRM_DATA0 0x00000026
#define SMB_ALRM_DATA1 0x00000027
/****************************************************************/
/* Function prototypes */
/****************************************************************/
void write_ec_sc(ec_dev_t* dev, uint8_t data);
uint8_t read_ec_sc(ec_dev_t* dev);
void write_ec_data(ec_dev_t* dev, uint8_t data);
uint8_t read_ec_data(ec_dev_t* dev);
void write_ec(ec_dev_t* dev, uint8_t reg, uint8_t data);
uint8_t read_ec(ec_dev_t* dev, uint8_t reg);
void write_smbus(ec_dev_t* dev, uint8_t reg, uint8_t data);
uint8_t read_smbus(ec_dev_t* dev, uint8_t reg);
#endif /* __SMBUS_EC_H_INCLUDED */
| 46.596154 | 73 | 0.524281 |
311f1c3d0518020bdf5250766833230dd7185ab5 | 4,368 | h | C | src/lib/datatypes/include/sol-arena.h | undeadinu/soletta | 5ca6d6a70bead00caf154b445755be94f3f68099 | [
"ECL-2.0",
"Apache-2.0"
] | 266 | 2015-06-11T00:21:02.000Z | 2022-03-27T20:45:17.000Z | src/lib/datatypes/include/sol-arena.h | undeadinu/soletta | 5ca6d6a70bead00caf154b445755be94f3f68099 | [
"ECL-2.0",
"Apache-2.0"
] | 2,224 | 2015-06-17T17:29:50.000Z | 2018-07-20T23:43:40.000Z | src/lib/datatypes/include/sol-arena.h | undeadinu/soletta | 5ca6d6a70bead00caf154b445755be94f3f68099 | [
"ECL-2.0",
"Apache-2.0"
] | 151 | 2015-06-17T14:42:54.000Z | 2022-01-27T17:01:35.000Z | /*
* This file is part of the Soletta (TM) Project
*
* Copyright (C) 2015 Intel Corporation. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#pragma once
#include <sol-str-slice.h>
#include <sol-vector.h>
#include <sol-macros.h>
#ifdef __cplusplus
extern "C" {
#endif
/**
* @file
* @brief These are routines that Soletta provides for its arena implementation.
*/
/**
* @defgroup Arena Arena
* @ingroup Datatypes
*
* @brief An arena is an object that does allocation on user's behalf and can
* deallocate all at once.
*
* @see Str_Slice
*
* @{
*/
/**
* @typedef sol_arena
*
* @brief Sol Arena type.
*
* See also @ref sol_buffer if you just need a single re-sizable buffer.
*/
struct sol_arena;
typedef struct sol_arena sol_arena;
/**
* @brief Creates an Arena.
*
* @return The new arena, @c NULL in case of error
*/
struct sol_arena *sol_arena_new(void);
/**
* @brief Delete the Arena.
*
* Delete the arena and all it's contents. Frees all the memory previously
* allocated by the arena.
*
* @param arena Arena to be deleted
*/
void sol_arena_del(struct sol_arena *arena);
/**
* @brief Store a copy of a given string in the arena.
*
* Also, outputs a slice to the stored string in @c dst.
*
* @param arena The arena
* @param dst String slice of the recently added string
* @param src String to copy and store
*
* @return @c 0 on success, error code (always negative) otherwise
*/
int sol_arena_slice_dup_str(struct sol_arena *arena, struct sol_str_slice *dst, const char *src);
/**
* @brief Store a copy of at most @c n characters of a given string in the arena.
*
* Also, outputs a slice to the stored string in @c dst.
*
* @param arena The arena
* @param dst String slice of the recently added string
* @param src String to copy and store
* @param n Maximum number of characters to copy
*
* @return @c 0 on success, error code (always negative) otherwise
*/
int sol_arena_slice_dup_str_n(struct sol_arena *arena, struct sol_str_slice *dst, const char *src, size_t n);
/**
* @brief Store a copy of a given string slice in the arena.
*
* Also, outputs the recently stored string src in @c dst.
*
* @param arena The arena
* @param dst String slice of the recently added string slice
* @param src String slice to copy and store
*
* @return @c 0 on success, error code (always negative) otherwise
*/
int sol_arena_slice_dup(struct sol_arena *arena, struct sol_str_slice *dst, struct sol_str_slice src);
/**
* @brief Store the output of 'sprintf()' in the arena.
*
* Also, outputs a slice to the stored string in @c dst.
*
* @param arena The arena
* @param dst String slice of the recently added string
* @param fmt A standard 'printf()' format string
* @param ... The arguments for 'sprintf()'
*
* @return @c 0 on success, error code (always negative) otherwise
*/
int sol_arena_slice_sprintf(struct sol_arena *arena, struct sol_str_slice *dst, const char *fmt, ...) SOL_ATTR_PRINTF(3, 4);
/**
* @brief Store a copy of a given string in the arena.
*
* @param arena The arena
* @param str String to copy and store
*
* @return The stored string
*/
char *sol_arena_strdup(struct sol_arena *arena, const char *str);
/**
* @brief Store a copy of at most @c n characters of a given string in the arena.
*
* @param arena The arena
* @param str String to copy and store
* @param n Maximum number of characters to copy
*
* @return The stored string
*/
char *sol_arena_str_dup_n(struct sol_arena *arena, const char *str, size_t n);
/**
* @brief Store a copy of a given string slice in the arena.
*
* @param arena The arena
* @param slice String slice to copy and store
*
* @return The stored string
*/
char *sol_arena_strdup_slice(struct sol_arena *arena, const struct sol_str_slice slice);
/**
* @}
*/
#ifdef __cplusplus
}
#endif
| 26.472727 | 124 | 0.706502 |
311fd1dee560a96164eaa9389f626df2cae9aef5 | 240 | h | C | WLObjCKit/Classes/WLObjCKit.h | 0624pdy/WLObjCKit | 3aa63085f53fbbd9e0409b096a769c9a57c410a3 | [
"MIT"
] | null | null | null | WLObjCKit/Classes/WLObjCKit.h | 0624pdy/WLObjCKit | 3aa63085f53fbbd9e0409b096a769c9a57c410a3 | [
"MIT"
] | null | null | null | WLObjCKit/Classes/WLObjCKit.h | 0624pdy/WLObjCKit | 3aa63085f53fbbd9e0409b096a769c9a57c410a3 | [
"MIT"
] | null | null | null | //
// WLObjCKit.h
// Pods
//
// Created by jzjy on 2020/12/5.
//
#ifndef WLObjCKit_h
#define WLObjCKit_h
#import <WLObjCKit/WLTypeDefines.h>
#import <WLObjCKit/WLDefines.h>
#import <WLObjCKit/WLNetworking.h>
#endif /* WLObjCKit_h */
| 14.117647 | 35 | 0.7 |
312074f94700f7041b55486242f5ee1a4d0556c5 | 711 | h | C | include/linked_lists/kth_tolast.h | TusharChugh/algorithms-practice | 15c4ee9e9b9d4c94ff8b9f087d5d4eca16bd40c1 | [
"MIT"
] | 4 | 2018-09-27T01:29:21.000Z | 2020-02-13T11:33:10.000Z | include/linked_lists/kth_tolast.h | TusharChugh/algorithms-practice | 15c4ee9e9b9d4c94ff8b9f087d5d4eca16bd40c1 | [
"MIT"
] | 1 | 2018-07-05T17:43:02.000Z | 2018-07-05T17:43:02.000Z | include/linked_lists/kth_tolast.h | TusharChugh/algorithms-practice | 15c4ee9e9b9d4c94ff8b9f087d5d4eca16bd40c1 | [
"MIT"
] | 3 | 2018-05-18T17:48:36.000Z | 2019-08-09T17:11:43.000Z | /**
* @brief Return Kth to Last
* Implement an algorithm to find the kth to last element of a singly linked list
*
* @file kth_tolast.h
* @author Tushar Chugh
*/
#pragma once
#include "forward_list.h"
namespace algorithm {
template<class T>
std::shared_ptr<Forward_List_Node<T>> kth_tolast_runner( Forward_List<T>& input, size_t k ) {
auto runner1 = input.front();
auto runner2 = input.front();
for ( size_t index = 0; index < k; ++index ) {
if ( runner2 == nullptr ) return nullptr;
runner2 = runner2->next_;
}
while ( runner2 != nullptr ) {
runner2 = runner2->next_;
runner1 = runner1->next_;
}
return runner1;
}
} // namespace algorithm | 22.935484 | 93 | 0.639944 |
3120ac1840280d39e8c3d4154985193042d6a8b3 | 300 | h | C | v0100/srclib/mm.h | domesticmouse/SmallerC | 177650342af56c873155817e48d3385672931b90 | [
"BSD-2-Clause"
] | 1,130 | 2015-01-04T21:42:32.000Z | 2022-03-27T23:07:26.000Z | v0100/srclib/mm.h | st127/SmallerC | 2a180411235df39bc9df7782b00ed199bedb1fd8 | [
"BSD-2-Clause"
] | 175 | 2018-05-30T03:06:15.000Z | 2019-02-06T23:54:24.000Z | v0100/srclib/mm.h | st127/SmallerC | 2a180411235df39bc9df7782b00ed199bedb1fd8 | [
"BSD-2-Clause"
] | 173 | 2015-01-04T21:42:48.000Z | 2022-01-10T15:46:02.000Z | /*
Copyright (c) 2014, Alexey Frunze
2-clause BSD license.
*/
#ifndef __MM_H
#define __MM_H
#ifdef __SMALLER_C_16__
extern char _stop_alldata__;
extern char _start_stack__;
#endif
#define HEADER_FOOTER_SZ (2*sizeof(unsigned))
extern unsigned __heap_start;
extern unsigned __heap_stop;
#endif
| 15.789474 | 45 | 0.783333 |
312281b0bdaeb6151afe910b355941b0487b274b | 563 | h | C | XB/Classes/XBLogin/XBPublish/MR.wang/ShootVideo/RecordButton.h | shuaiwang007/privateDemo | ca953d05c31bb89810f53156a7033c86acf90dde | [
"Apache-2.0"
] | null | null | null | XB/Classes/XBLogin/XBPublish/MR.wang/ShootVideo/RecordButton.h | shuaiwang007/privateDemo | ca953d05c31bb89810f53156a7033c86acf90dde | [
"Apache-2.0"
] | null | null | null | XB/Classes/XBLogin/XBPublish/MR.wang/ShootVideo/RecordButton.h | shuaiwang007/privateDemo | ca953d05c31bb89810f53156a7033c86acf90dde | [
"Apache-2.0"
] | null | null | null | //
// RecordButton.h
// whqFor
//
// Created by Mr.Wang on 2017/3/1.
// Copyright © 2017年 Mr.wang. All rights reserved.
//
#import <UIKit/UIKit.h>
@protocol RecordButtonDelegate <NSObject>
//did touch delegateAction
-(void)recordButtonDidTouchDown;
//did move delegateAction
-(void)recordButtonDidMove:(CGPoint)point;
//did ended delegateAction
-(void)recordButtonDidEnded:(CGPoint)point;
@end
@interface RecordButton : UIButton
/** delegate*/
@property (nonatomic,weak) id<RecordButtonDelegate> delegate;
//开始动画
- (void)startAnimation:(BOOL)top;
@end
| 18.766667 | 61 | 0.744227 |
31248fb8cecb6a78b7e456ea12b7037182c5dc23 | 552 | h | C | YLCleaner/Xcode-RuntimeHeaders/IDEInterfaceBuilderKit/IBClassRenameRefactoringOperation.h | liyong03/YLCleaner | 7453187a884c8e783bda1af82cbbb51655ec41c6 | [
"MIT"
] | 1 | 2019-02-15T02:16:35.000Z | 2019-02-15T02:16:35.000Z | YLCleaner/Xcode-RuntimeHeaders/IDEInterfaceBuilderKit/IBClassRenameRefactoringOperation.h | liyong03/YLCleaner | 7453187a884c8e783bda1af82cbbb51655ec41c6 | [
"MIT"
] | null | null | null | YLCleaner/Xcode-RuntimeHeaders/IDEInterfaceBuilderKit/IBClassRenameRefactoringOperation.h | liyong03/YLCleaner | 7453187a884c8e783bda1af82cbbb51655ec41c6 | [
"MIT"
] | null | null | null | /*
* Generated by class-dump 3.3.4 (64 bit).
*
* class-dump is Copyright (C) 1997-1998, 2000-2001, 2004-2011 by Steve Nygard.
*/
#import <IDEInterfaceBuilderKit/IBRefactoringOperation.h>
@class NSString;
@interface IBClassRenameRefactoringOperation : IBRefactoringOperation
{
NSString *oldClassName;
NSString *newClassName;
}
- (void).cxx_destruct;
- (BOOL)refactorObject:(id)arg1 inDocument:(id)arg2 error:(id *)arg3;
- (id)newClassName;
- (id)oldClassName;
- (id)initWithOldClassName:(id)arg1 andNewClassName:(id)arg2;
@end
| 22.08 | 83 | 0.726449 |
3124947f0015e0a5b546c5467334f85fd1b4a804 | 782 | c | C | src/text/ascii/isdigit.c | LexouDuck/libft | af06b5b8f0ac51e1a461cbe58a7be6410c4348d5 | [
"MIT"
] | 6 | 2021-02-09T08:50:35.000Z | 2021-09-15T14:29:31.000Z | src/text/ascii/isdigit.c | LexouDuck/libccc | 73a923a484ceb1fa6eaa863a151614d1327b4af8 | [
"MIT"
] | 16 | 2021-03-13T23:13:35.000Z | 2022-03-29T08:42:14.000Z | src/text/ascii/isdigit.c | LexouDuck/libccc | 73a923a484ceb1fa6eaa863a151614d1327b4af8 | [
"MIT"
] | 2 | 2020-06-09T03:10:56.000Z | 2020-11-04T12:40:04.000Z |
#include "libccc/bool.h"
#include "libccc/char.h"
#if LIBCONFIG_USE_STD_FUNCTIONS_ALWAYS
#include <ctype.h>
#endif
#include LIBCONFIG_ERROR_INCLUDE
#if LIBCONFIG_USE_STD_FUNCTIONS_ALWAYS
inline
t_bool ASCII_IsDigit_Dec(t_ascii c)
{ return (isdigit(c)); }
#else
inline
t_bool ASCII_IsDigit_Dec(t_ascii c)
{
return ('0' <= c && c <= '9');
}
#endif
#if LIBCONFIG_USE_STD_FUNCTIONS_ALWAYS
inline
t_bool ASCII_IsDigit_Hex(t_ascii c)
{ return (isxdigit(c)); }
#else
inline
t_bool ASCII_IsDigit_Hex(t_ascii c)
{
return (('0' <= c && c <= '9') ||
('A' <= c && c <= 'F') ||
('a' <= c && c <= 'f'));
}
#endif
inline
t_bool ASCII_IsDigit_Oct(t_ascii c)
{
return (('0' <= c && c <= '7'));
}
inline
t_bool ASCII_IsDigit_Bin(t_ascii c)
{
return (c == '0' || c == '1');
}
| 13.964286 | 38 | 0.650895 |
3125007117b9b931a67bd79a963eb67c0759e8c9 | 251 | h | C | iOSDevTemplate/Base/BaseTableViewController.h | sinofake/iOSDevTemplate | b91d8fd8b954624e159686de10e99a5929e5ed8f | [
"MIT"
] | 5 | 2015-07-05T09:22:04.000Z | 2016-08-31T09:23:14.000Z | iOSDevTemplate/Base/BaseTableViewController.h | sinofake/iOSDevTemplate | b91d8fd8b954624e159686de10e99a5929e5ed8f | [
"MIT"
] | null | null | null | iOSDevTemplate/Base/BaseTableViewController.h | sinofake/iOSDevTemplate | b91d8fd8b954624e159686de10e99a5929e5ed8f | [
"MIT"
] | null | null | null | //
// BaseTableViewController.h
// iOSDevTemplate
//
// Created by zhucuirong on 15/7/6.
// Copyright (c) 2015年 SINOFAKE SINEP. All rights reserved.
//
#import "BaseViewController.h"
@interface BaseTableViewController : BaseViewController
@end
| 17.928571 | 60 | 0.741036 |
312704f28c1fb05c44c7c52871162cc100cf1dfa | 2,931 | c | C | openbmc/build/tmp/deploy/sdk/witherspoon-2019-08-08/sysroots/armv6-openbmc-linux-gnueabi/usr/src/debug/kmod/26-r0/git/tools/lsmod.c | sotaoverride/backup | ca53a10b72295387ef4948a9289cb78ab70bc449 | [
"Apache-2.0"
] | null | null | null | openbmc/build/tmp/deploy/sdk/witherspoon-2019-08-08/sysroots/armv6-openbmc-linux-gnueabi/usr/src/debug/kmod/26-r0/git/tools/lsmod.c | sotaoverride/backup | ca53a10b72295387ef4948a9289cb78ab70bc449 | [
"Apache-2.0"
] | null | null | null | openbmc/build/tmp/deploy/sdk/witherspoon-2019-08-08/sysroots/armv6-openbmc-linux-gnueabi/usr/src/debug/kmod/26-r0/git/tools/lsmod.c | sotaoverride/backup | ca53a10b72295387ef4948a9289cb78ab70bc449 | [
"Apache-2.0"
] | null | null | null | /*
* kmod-lsmod - list modules from linux kernel using libkmod.
*
* Copyright (C) 2011-2013 ProFUSION embedded systems
*
* 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, see <http://www.gnu.org/licenses/>.
*/
#include <errno.h>
#include <libkmod/libkmod.h>
#include <stddef.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include "kmod.h"
static int do_lsmod(int argc, char* argv[])
{
struct kmod_ctx* ctx;
const char* null_config = NULL;
struct kmod_list *list, *itr;
int err;
if (argc != 1)
{
fprintf(stderr, "Usage: %s\n", argv[0]);
return EXIT_FAILURE;
}
ctx = kmod_new(NULL, &null_config);
if (ctx == NULL)
{
fputs("Error: kmod_new() failed!\n", stderr);
return EXIT_FAILURE;
}
err = kmod_module_new_from_loaded(ctx, &list);
if (err < 0)
{
fprintf(stderr, "Error: could not get list of modules: %s\n",
strerror(-err));
kmod_unref(ctx);
return EXIT_FAILURE;
}
puts("Module Size Used by");
kmod_list_foreach(itr, list)
{
struct kmod_module* mod = kmod_module_get_module(itr);
const char* name = kmod_module_get_name(mod);
int use_count = kmod_module_get_refcnt(mod);
long size = kmod_module_get_size(mod);
struct kmod_list *holders, *hitr;
int first = 1;
printf("%-19s %8ld %d", name, size, use_count);
holders = kmod_module_get_holders(mod);
kmod_list_foreach(hitr, holders)
{
struct kmod_module* hm = kmod_module_get_module(hitr);
if (!first)
{
putchar(',');
}
else
{
putchar(' ');
first = 0;
}
fputs(kmod_module_get_name(hm), stdout);
kmod_module_unref(hm);
}
putchar('\n');
kmod_module_unref_list(holders);
kmod_module_unref(mod);
}
kmod_module_unref_list(list);
kmod_unref(ctx);
return EXIT_SUCCESS;
}
const struct kmod_cmd kmod_cmd_compat_lsmod = {
.name = "lsmod",
.cmd = do_lsmod,
.help = "compat lsmod command",
};
const struct kmod_cmd kmod_cmd_list = {
.name = "list",
.cmd = do_lsmod,
.help = "list currently loaded modules",
};
| 26.645455 | 72 | 0.60696 |
31271ddd0d4026e5313e4c6bd50470c77a49fe3b | 4,418 | h | C | variants/DISCO_F100RB/variant.h | kirschmackey/Arduino_Core_STM32 | 633ae0f3f8e72e4e0ee5951aed706f71ab8eced8 | [
"Apache-2.0"
] | 3 | 2019-08-31T14:44:38.000Z | 2021-07-07T11:41:09.000Z | variants/DISCO_F100RB/variant.h | kirschmackey/Arduino_Core_STM32 | 633ae0f3f8e72e4e0ee5951aed706f71ab8eced8 | [
"Apache-2.0"
] | 1 | 2018-11-14T12:18:30.000Z | 2018-11-14T12:18:30.000Z | variants/DISCO_F100RB/variant.h | kirschmackey/Arduino_Core_STM32 | 633ae0f3f8e72e4e0ee5951aed706f71ab8eced8 | [
"Apache-2.0"
] | 1 | 2019-11-26T02:48:04.000Z | 2019-11-26T02:48:04.000Z | /*
Copyright (c) 2011 Arduino. All right reserved.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef _VARIANT_ARDUINO_STM32_
#define _VARIANT_ARDUINO_STM32_
#ifdef __cplusplus
extern "C" {
#endif // __cplusplus
/*----------------------------------------------------------------------------
* Pins
*----------------------------------------------------------------------------*/
// P1 connector
#define PC13 0
#define PC0 A0
#define PC1 A1
#define PC2 A2
#define PC3 A3
#define PA0 A4 // User button
#define PA1 A5
#define PA2 A6
#define PA3 A7
#define PA4 A8
#define PA5 A9
#define PA6 A10
#define PA7 A11
#define PC4 A12
#define PC5 A13
#define PB0 A14
#define PB1 A15
#define PB2 17
// P2 connector
#define PC6 18
#define PC7 19
#define PC8 20 // LED blue
#define PC9 21 // LED green
#define PA8 22
#define PA9 23
#define PA10 24
#define PA11 25
#define PA12 26
#define PA13 27
#define PA14 28
#define PA15 29
#define PC10 30
#define PC11 31
#define PC12 32
#define PD2 33
#define PB3 34
#define PB4 35
#define PB5 36 // I2C SCL
#define PB6 37 // I2C SDA
#define PB7 38
#define PB8 39
#define PB9 40
// P3 connector
#define PB10 41
#define PB11 42
#define PB12 43 // SPI SS
#define PB13 44 // SPI SCLK
#define PB14 45 // SPI MISO
#define PB15 46 // SPI MOSI
// This must be a literal
#define NUM_DIGITAL_PINS 47
// This must be a literal with a value less than or equal to to MAX_ANALOG_INPUTS
#define NUM_ANALOG_INPUTS 16
// On-board LED pin number
#define LED_BUILTIN PC9
#define LED_GREEN LED_BUILTIN
#define LED_BLUE PC8
// On-board user button
#define USER_BTN 5
// SPI Definitions
#define PIN_SPI_SS PB12
#define PIN_SPI_SS1 PB9
#define PIN_SPI_SS2 PB10
#define PIN_SPI_SS3 PB11
#define PIN_SPI_MOSI PB15
#define PIN_SPI_MISO PB14
#define PIN_SPI_SCK PB13
// I2C Definitions
#define PIN_WIRE_SDA PB7
#define PIN_WIRE_SCL PB6
// Timer Definitions
// Use TIM6/TIM7 when possible as servo and tone don't need GPIO output pin
#define TIMER_TONE TIM6
#define TIMER_SERVO TIM7
// UART Definitions
#define SERIAL_UART_INSTANCE 2 //Connected to ST-Link
// Default pin used for 'Serial' instance (ex: ST-Link)
// Mandatory for Firmata
#define PIN_SERIAL_RX 8
#define PIN_SERIAL_TX 7
/* Extra HAL modules */
#define HAL_DAC_MODULE_ENABLED
#ifdef __cplusplus
} // extern "C"
#endif
/*----------------------------------------------------------------------------
* Arduino objects - C++ only
*----------------------------------------------------------------------------*/
#ifdef __cplusplus
// These serial port names are intended to allow libraries and architecture-neutral
// sketches to automatically default to the correct port name for a particular type
// of use. For example, a GPS module would normally connect to SERIAL_PORT_HARDWARE_OPEN,
// the first hardware serial port whose RX/TX pins are not dedicated to another use.
//
// SERIAL_PORT_MONITOR Port which normally prints to the Arduino Serial Monitor
//
// SERIAL_PORT_USBVIRTUAL Port which is USB virtual serial
//
// SERIAL_PORT_LINUXBRIDGE Port which connects to a Linux system via Bridge library
//
// SERIAL_PORT_HARDWARE Hardware serial port, physical RX & TX pins.
//
// SERIAL_PORT_HARDWARE_OPEN Hardware serial ports which are open for use. Their RX & TX
// pins are NOT connected to anything by default.
#define SERIAL_PORT_MONITOR Serial
#define SERIAL_PORT_HARDWARE Serial
#endif
#endif /* _VARIANT_ARDUINO_STM32_ */
| 29.453333 | 90 | 0.654142 |
312a5fd2c3beeb74a0d128ba20c0e278e4f39bd3 | 4,193 | h | C | Modules/Filtering/QuadEdgeMeshFiltering/include/itkDiscreteCurvatureQuadEdgeMeshFilter.h | Kronephon/itktest | a34e46226638c08bba315a257e33550a68203d97 | [
"Apache-2.0"
] | null | null | null | Modules/Filtering/QuadEdgeMeshFiltering/include/itkDiscreteCurvatureQuadEdgeMeshFilter.h | Kronephon/itktest | a34e46226638c08bba315a257e33550a68203d97 | [
"Apache-2.0"
] | null | null | null | Modules/Filtering/QuadEdgeMeshFiltering/include/itkDiscreteCurvatureQuadEdgeMeshFilter.h | Kronephon/itktest | a34e46226638c08bba315a257e33550a68203d97 | [
"Apache-2.0"
] | null | null | null | /*=========================================================================
*
* Copyright Insight Software Consortium
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0.txt
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*=========================================================================*/
#ifndef itkDiscreteCurvatureQuadEdgeMeshFilter_h
#define itkDiscreteCurvatureQuadEdgeMeshFilter_h
#include "itkQuadEdgeMeshToQuadEdgeMeshFilter.h"
#include "itkConceptChecking.h"
#include "itkTriangleHelper.h"
namespace itk
{
/**
* \class DiscreteCurvatureQuadEdgeMeshFilter
*
* \brief FIXME
*
* \ingroup ITKQuadEdgeMeshFiltering
*/
template< typename TInputMesh, typename TOutputMesh=TInputMesh >
class DiscreteCurvatureQuadEdgeMeshFilter:
public QuadEdgeMeshToQuadEdgeMeshFilter< TInputMesh, TOutputMesh >
{
public:
ITK_DISALLOW_COPY_AND_ASSIGN(DiscreteCurvatureQuadEdgeMeshFilter);
using Self = DiscreteCurvatureQuadEdgeMeshFilter;
using Pointer = SmartPointer< Self >;
using ConstPointer = SmartPointer< const Self >;
using Superclass = QuadEdgeMeshToQuadEdgeMeshFilter< TInputMesh, TOutputMesh >;
using InputMeshType = TInputMesh;
using InputMeshPointer = typename InputMeshType::Pointer;
using OutputMeshType = TOutputMesh;
using OutputMeshPointer = typename OutputMeshType::Pointer;
using OutputPointsContainerPointer = typename OutputMeshType::PointsContainerPointer;
using OutputPointsContainerIterator = typename OutputMeshType::PointsContainerIterator;
using OutputPointType = typename OutputMeshType::PointType;
using OutputCoordType = typename OutputPointType::CoordRepType;
using OutputPointIdentifier = typename OutputMeshType::PointIdentifier;
using OutputCellIdentifier = typename OutputMeshType::CellIdentifier;
using OutputQEType = typename OutputMeshType::QEType;
using OutputMeshTraits = typename OutputMeshType::MeshTraits;
using OutputCurvatureType = typename OutputMeshTraits::PixelType;
using TriangleType = TriangleHelper< OutputPointType >;
/** Run-time type information (and related methods). */
itkTypeMacro(DiscreteCurvatureQuadEdgeMeshFilter, QuadEdgeMeshToQuadEdgeMeshFilter);
#ifdef ITK_USE_CONCEPT_CHECKING
// Begin concept checking
itkConceptMacro( OutputIsFloatingPointCheck,
( Concept::IsFloatingPoint< OutputCurvatureType > ) );
// End concept checking
#endif
protected:
DiscreteCurvatureQuadEdgeMeshFilter() : m_OutputMesh(nullptr) {}
~DiscreteCurvatureQuadEdgeMeshFilter() override {}
virtual OutputCurvatureType EstimateCurvature(const OutputPointType & iP) = 0;
OutputCurvatureType ComputeMixedArea(OutputQEType *iQE1, OutputQEType *iQE2)
{
OutputPointIdentifier id[3];
id[0] = iQE1->GetOrigin();
id[1] = iQE1->GetDestination();
id[2] = iQE2->GetDestination();
OutputPointType p[3];
for ( int i = 0; i < 3; i++ )
{
p[i] = this->m_OutputMesh->GetPoint(id[i]);
}
return static_cast< OutputCurvatureType >( TriangleType::ComputeMixedArea( p[0], p[1], p[2] ) );
}
void GenerateData() override
{
this->CopyInputMeshToOutputMesh();
OutputMeshPointer output = this->GetOutput();
OutputPointsContainerPointer points = output->GetPoints();
OutputPointsContainerIterator p_it = points->Begin();
OutputCurvatureType curvature;
this->m_OutputMesh = this->GetOutput();
while ( p_it != points->End() )
{
curvature = this->EstimateCurvature( p_it->Value() );
output->SetPointData(p_it->Index(), curvature);
++p_it;
}
}
private:
/** Cache output pointer to avoid calls in inner loop to GetOutput() */
OutputMeshType *m_OutputMesh;
};
} // end namespace itk
#endif
| 33.544 | 100 | 0.724779 |
312a751e50cccc6d6598f72f49c2d0618512792f | 279 | h | C | Calibration/EcalTBTools/src/classes.h | ckamtsikis/cmssw | ea19fe642bb7537cbf58451dcf73aa5fd1b66250 | [
"Apache-2.0"
] | 852 | 2015-01-11T21:03:51.000Z | 2022-03-25T21:14:00.000Z | Calibration/EcalTBTools/src/classes.h | ckamtsikis/cmssw | ea19fe642bb7537cbf58451dcf73aa5fd1b66250 | [
"Apache-2.0"
] | 30,371 | 2015-01-02T00:14:40.000Z | 2022-03-31T23:26:05.000Z | Calibration/EcalTBTools/src/classes.h | ckamtsikis/cmssw | ea19fe642bb7537cbf58451dcf73aa5fd1b66250 | [
"Apache-2.0"
] | 3,240 | 2015-01-02T05:53:18.000Z | 2022-03-31T17:24:21.000Z | #include "Calibration/EcalTBTools/interface/TB06Reco.h"
#include "Calibration/EcalTBTools/interface/TB06RecoH2.h"
#include "TFile.h"
#include "TTree.h"
#include "TClonesArray.h"
namespace Calibration_EcalTBTools {
struct dictionary {};
} // namespace Calibration_EcalTBTools
| 27.9 | 57 | 0.795699 |
312a98acb7f610c24cd1dc724a5132594872a8fb | 193 | h | C | server/Qt5.12.8.static/include/QtNfc/qtnfcversion.h | parasharrajat/qml-tools | 987df72b40d65726ddbb1549860ab481e699be8e | [
"MIT"
] | null | null | null | server/Qt5.12.8.static/include/QtNfc/qtnfcversion.h | parasharrajat/qml-tools | 987df72b40d65726ddbb1549860ab481e699be8e | [
"MIT"
] | 1 | 2021-05-11T14:25:32.000Z | 2021-05-11T14:25:32.000Z | server/Qt5.12.8.static/include/QtNfc/qtnfcversion.h | parasharrajat/qml-tools | 987df72b40d65726ddbb1549860ab481e699be8e | [
"MIT"
] | null | null | null | /* This file was generated by syncqt. */
#ifndef QT_QTNFC_VERSION_H
#define QT_QTNFC_VERSION_H
#define QTNFC_VERSION_STR "5.12.8"
#define QTNFC_VERSION 0x050C08
#endif // QT_QTNFC_VERSION_H
| 19.3 | 40 | 0.792746 |
312cccf68e0e870b34f4bea38cd379e4956afaf8 | 121,959 | c | C | src/ref_metric.c | nasa/REFINE_v1 | 5e64cebf58064f02c6e917d473621a008e61f340 | [
"Apache-2.0"
] | null | null | null | src/ref_metric.c | nasa/REFINE_v1 | 5e64cebf58064f02c6e917d473621a008e61f340 | [
"Apache-2.0"
] | null | null | null | src/ref_metric.c | nasa/REFINE_v1 | 5e64cebf58064f02c6e917d473621a008e61f340 | [
"Apache-2.0"
] | null | null | null |
/* Copyright 2014 United States Government as represented by the
* Administrator of the National Aeronautics and Space
* Administration. No copyright is claimed in the United States under
* Title 17, U.S. Code. All Other Rights Reserved.
*
* The refine platform is licensed under the Apache License, Version
* 2.0 (the "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
* http://www.apache.org/licenses/LICENSE-2.0.
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
* implied. See the License for the specific language governing
* permissions and limitations under the License.
*/
#include "ref_metric.h"
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "ref_cell.h"
#include "ref_dict.h"
#include "ref_edge.h"
#include "ref_egads.h"
#include "ref_grid.h"
#include "ref_interp.h"
#include "ref_malloc.h"
#include "ref_math.h"
#include "ref_matrix.h"
#include "ref_meshlink.h"
#include "ref_node.h"
#include "ref_phys.h"
#include "ref_sort.h"
#define REF_METRIC_MAX_DEGREE (1000)
REF_STATUS ref_metric_show(REF_DBL *m) {
printf(" %18.10e %18.10e %18.10e\n", m[0], m[1], m[2]);
printf(" %18.10e %18.10e %18.10e\n", m[1], m[3], m[4]);
printf(" %18.10e %18.10e %18.10e\n", m[2], m[4], m[5]);
return REF_SUCCESS;
}
REF_STATUS ref_metric_inspect(REF_NODE ref_node) {
REF_INT node;
REF_DBL m[6];
each_ref_node_valid_node(ref_node, node) {
RSS(ref_node_metric_get(ref_node, node, m), "get");
RSS(ref_metric_show(m), "show it");
}
return REF_SUCCESS;
}
REF_STATUS ref_metric_from_node(REF_DBL *metric, REF_NODE ref_node) {
REF_INT node;
each_ref_node_valid_node(ref_node, node) {
RSS(ref_node_metric_get(ref_node, node, &(metric[6 * node])), "get");
}
return REF_SUCCESS;
}
REF_STATUS ref_metric_to_node(REF_DBL *metric, REF_NODE ref_node) {
REF_INT node;
each_ref_node_valid_node(ref_node, node) {
RSS(ref_node_metric_set(ref_node, node, &(metric[6 * node])), "set");
}
return REF_SUCCESS;
}
REF_STATUS ref_metric_olympic_node(REF_NODE ref_node, REF_DBL h) {
REF_INT node;
REF_DBL hh;
each_ref_node_valid_node(ref_node, node) {
hh = h + (0.1 - h) * ABS(ref_node_xyz(ref_node, 2, node) - 0.5) / 0.5;
RSS(ref_node_metric_form(ref_node, node, 1.0 / (0.1 * 0.1), 0, 0,
1.0 / (0.1 * 0.1), 0, 1.0 / (hh * hh)),
"set node met");
}
return REF_SUCCESS;
}
REF_STATUS ref_metric_side_node(REF_NODE ref_node) {
REF_INT node;
REF_DBL h0 = 0.1;
REF_DBL h = 0.01;
REF_DBL hh;
each_ref_node_valid_node(ref_node, node) {
hh = h + (h0 - h) * ABS(ref_node_xyz(ref_node, 2, node));
RSS(ref_node_metric_form(ref_node, node, 1.0 / (0.1 * 0.1), 0, 0,
1.0 / (0.1 * 0.1), 0, 1.0 / (hh * hh)),
"set node met");
}
return REF_SUCCESS;
}
REF_STATUS ref_metric_ring_node(REF_NODE ref_node) {
REF_INT node;
REF_DBL hh;
REF_DBL h = 0.01;
REF_DBL x;
each_ref_node_valid_node(ref_node, node) {
x = ref_node_xyz(ref_node, 0, node);
hh = h + (0.1 - h) * MIN(2 * ABS(x - 1.0), 1);
RSS(ref_node_metric_form(ref_node, node, 1.0 / (hh * hh), 0, 0,
1.0 / (0.1 * 0.1), 0, 1.0 / (0.1 * 0.1)),
"set node met");
}
return REF_SUCCESS;
}
REF_STATUS ref_metric_twod_analytic_node(REF_NODE ref_node,
const char *version) {
REF_INT node;
REF_DBL x = 0, y = 0, r, t;
REF_DBL h_z = 1, h_t = 1, h_r = 1, h0, h, hh, hy, hx, c, k1, d0;
REF_DBL d[12], m[6];
REF_BOOL metric_recognized = REF_FALSE;
each_ref_node_valid_node(ref_node, node) {
if (strcmp(version, "iso01") == 0) {
metric_recognized = REF_TRUE;
h = 0.1;
RSS(ref_node_metric_form(ref_node, node, 1.0 / (h * h), 0, 0,
1.0 / (h * h), 0, 1.0),
"set node met");
continue;
}
if (strcmp(version, "isorad") == 0) {
metric_recognized = REF_TRUE;
r = sqrt(pow(ref_node_xyz(ref_node, 0, node), 2) +
pow(ref_node_xyz(ref_node, 1, node), 2) +
pow(ref_node_xyz(ref_node, 2, node), 2));
h = 0.1 + 0.1 * r;
RSS(ref_node_metric_form(ref_node, node, 1.0 / (h * h), 0, 0,
1.0 / (h * h), 0, 1.0),
"set node met");
continue;
}
if (strcmp(version, "masabl-1") == 0) {
metric_recognized = REF_TRUE;
hx = 0.01 +
0.2 * cos(ref_math_pi * (ref_node_xyz(ref_node, 0, node) - 0.5));
c = 0.001;
k1 = 6.0;
hy = c * exp(k1 * ref_node_xyz(ref_node, 1, node));
RSS(ref_node_metric_form(ref_node, node, 1.0 / (hx * hx), 0, 0,
1.0 / (hy * hy), 0, 1.0),
"set node met");
continue;
}
if (strcmp(version, "side") == 0) {
metric_recognized = REF_TRUE;
h0 = 0.1;
h = 0.01;
hh = h + (h0 - h) * ref_node_xyz(ref_node, 1, node);
RSS(ref_node_metric_form(ref_node, node, 1.0 / (0.1 * 0.1), 0, 0,
1.0 / (hh * hh), 0, 1.0),
"set node met");
continue;
}
if (strcmp(version, "linear-0001") == 0) {
metric_recognized = REF_TRUE;
h0 = 0.1;
h = 0.0001;
hh = h + (0.1 - h) * ABS(ref_node_xyz(ref_node, 1, node) - 0.5) / 0.5;
RSS(ref_node_metric_form(ref_node, node, 1.0 / (0.1 * 0.1), 0, 0,
1.0 / (hh * hh), 0, 1.0),
"set node met");
continue;
}
if (strcmp(version, "linear-01") == 0) {
metric_recognized = REF_TRUE;
h0 = 0.1;
h = 0.01;
hh = h + (0.1 - h) * ABS(ref_node_xyz(ref_node, 1, node) - 0.5) / 0.5;
RSS(ref_node_metric_form(ref_node, node, 1.0 / (0.1 * 0.1), 0, 0,
1.0 / (hh * hh), 0, 1.0),
"set node met");
continue;
}
if (strcmp(version, "polar-2") == 0) {
metric_recognized = REF_TRUE;
x = ref_node_xyz(ref_node, 0, node);
y = ref_node_xyz(ref_node, 1, node);
r = sqrt(x * x + y * y);
h_z = 1.0;
h_t = 0.1;
h0 = 0.001;
h_r = h0 + 2 * (0.1 - h0) * ABS(r - 0.5);
d0 = MIN(10.0 * ABS(r - 0.5), 1.0);
h_t = 0.1 * d0 + 0.025 * (1.0 - d0);
}
if (strcmp(version, "radial-1") == 0) {
metric_recognized = REF_TRUE;
x = ref_node_xyz(ref_node, 0, node) + 0.5;
y = ref_node_xyz(ref_node, 1, node) - 0.5;
t = atan2(y, x);
h_z = 1.0;
h_t = 0.1;
h_r = 0.01;
}
if (strcmp(version, "circle-1") == 0) {
metric_recognized = REF_TRUE;
x = ref_node_xyz(ref_node, 0, node) + 0.5;
y = ref_node_xyz(ref_node, 1, node) - 0.5;
r = sqrt(x * x + y * y);
t = atan2(y, x);
h_z = 1.0;
h_r = 0.0005 + 1.5 * ABS(1.0 - r);
h_t = 0.1 * r + 1.5 * ABS(1.0 - r);
}
t = atan2(y, x);
ref_matrix_eig(d, 0) = 1.0 / (h_r * h_r);
ref_matrix_eig(d, 1) = 1.0 / (h_t * h_t);
ref_matrix_eig(d, 2) = 1.0 / (h_z * h_z);
ref_matrix_vec(d, 0, 0) = cos(t);
ref_matrix_vec(d, 1, 0) = sin(t);
ref_matrix_vec(d, 2, 0) = 0.0;
ref_matrix_vec(d, 0, 1) = -sin(t);
ref_matrix_vec(d, 1, 1) = cos(t);
ref_matrix_vec(d, 2, 1) = 0.0;
ref_matrix_vec(d, 0, 2) = 0.0;
ref_matrix_vec(d, 1, 2) = 0.0;
ref_matrix_vec(d, 2, 2) = 1.0;
ref_matrix_form_m(d, m);
RSS(ref_node_metric_set(ref_node, node, m), "set node met");
}
RAS(metric_recognized, "metric unknown");
return REF_SUCCESS;
}
REF_STATUS ref_metric_ugawg_node(REF_NODE ref_node, REF_INT version) {
REF_INT node;
REF_DBL x, y, r, t;
REF_DBL h_z, h_t, h_r, h0, d0;
REF_DBL d[12], m[6];
if (1 == version || 2 == version) {
each_ref_node_valid_node(ref_node, node) {
x = ref_node_xyz(ref_node, 0, node);
y = ref_node_xyz(ref_node, 1, node);
r = sqrt(x * x + y * y);
t = atan2(y, x);
h_z = 0.1;
h_t = 0.1;
h0 = 0.001;
h_r = h0 + 2 * (0.1 - h0) * ABS(r - 0.5);
if (2 == version) {
d0 = MIN(10.0 * ABS(r - 0.5), 1.0);
h_t = 0.1 * d0 + 0.025 * (1.0 - d0);
}
ref_matrix_eig(d, 0) = 1.0 / (h_r * h_r);
ref_matrix_eig(d, 1) = 1.0 / (h_t * h_t);
ref_matrix_eig(d, 2) = 1.0 / (h_z * h_z);
ref_matrix_vec(d, 0, 0) = cos(t);
ref_matrix_vec(d, 1, 0) = sin(t);
ref_matrix_vec(d, 2, 0) = 0.0;
ref_matrix_vec(d, 0, 1) = -sin(t);
ref_matrix_vec(d, 1, 1) = cos(t);
ref_matrix_vec(d, 2, 1) = 0.0;
ref_matrix_vec(d, 0, 2) = 0.0;
ref_matrix_vec(d, 1, 2) = 0.0;
ref_matrix_vec(d, 2, 2) = 1.0;
ref_matrix_form_m(d, m);
RSS(ref_node_metric_set(ref_node, node, m), "set node met");
}
return REF_SUCCESS;
}
return REF_IMPLEMENT;
}
REF_STATUS ref_metric_masabl_node(REF_NODE ref_node) {
REF_INT node;
REF_DBL hx, hz, c, k1;
each_ref_node_valid_node(ref_node, node) {
hx =
0.01 + 0.2 * cos(ref_math_pi * (ref_node_xyz(ref_node, 0, node) - 0.5));
c = 0.001;
k1 = 6.0;
hz = c * exp(k1 * ref_node_xyz(ref_node, 2, node));
RSS(ref_node_metric_form(ref_node, node, 1.0 / (hx * hx), 0, 0,
1.0 / (0.1 * 0.1), 0, 1.0 / (hz * hz)),
"set node met");
}
return REF_SUCCESS;
}
REF_STATUS ref_metric_circle_node(REF_NODE ref_node) {
REF_INT node;
REF_DBL x, z, r, t;
REF_DBL hy, h1, h2;
REF_DBL d[12], m[6];
each_ref_node_valid_node(ref_node, node) {
x = ref_node_xyz(ref_node, 0, node);
z = ref_node_xyz(ref_node, 2, node);
r = sqrt(x * x + z * z);
t = atan2(z, x);
hy = 1.0;
h1 = 0.0005 + 1.5 * ABS(1.0 - r);
h2 = 0.1 * r + 1.5 * ABS(1.0 - r);
ref_matrix_eig(d, 0) = 1.0 / (h1 * h1);
ref_matrix_eig(d, 1) = 1.0 / (h2 * h2);
ref_matrix_eig(d, 2) = 1.0 / (hy * hy);
ref_matrix_vec(d, 0, 0) = cos(t);
ref_matrix_vec(d, 1, 0) = 0.0;
ref_matrix_vec(d, 2, 0) = sin(t);
ref_matrix_vec(d, 0, 1) = -sin(t);
ref_matrix_vec(d, 1, 1) = 0.0;
ref_matrix_vec(d, 2, 1) = cos(t);
ref_matrix_vec(d, 0, 2) = 0.0;
ref_matrix_vec(d, 1, 2) = 1.0;
ref_matrix_vec(d, 2, 2) = 0.0;
ref_matrix_form_m(d, m);
RSS(ref_node_metric_set(ref_node, node, m), "set node met");
}
return REF_SUCCESS;
}
REF_STATUS ref_metric_twod_node(REF_NODE ref_node) {
REF_INT node;
REF_DBL m[6];
each_ref_node_valid_node(ref_node, node) {
RSS(ref_node_metric_get(ref_node, node, m), "get");
m[2] = 0.0;
m[4] = 0.0;
m[5] = 1.0;
RSS(ref_node_metric_set(ref_node, node, m), "set");
}
return REF_SUCCESS;
}
REF_STATUS ref_metric_delta_box_node(REF_GRID ref_grid) {
REF_NODE ref_node = ref_grid_node(ref_grid);
REF_INT node;
REF_DBL m[6], m_int[6], m_target[6];
REF_DBL radius, h;
REF_DBL factor = 1.0;
REF_DBL n[3], dot;
each_ref_node_valid_node(ref_node, node) {
RSS(ref_node_metric_get(ref_node, node, m), "get");
n[0] = 0.90631;
n[1] = 0.42262;
n[2] = 0.0;
dot = ref_math_dot(n, ref_node_xyz_ptr(ref_node, node));
radius = sqrt(pow(ref_node_xyz(ref_node, 0, node) - dot * n[0], 2) +
pow(ref_node_xyz(ref_node, 1, node) - dot * n[1], 2) +
pow(ref_node_xyz(ref_node, 2, node) - dot * n[2], 2));
h = MIN(0.0003 + 0.002 * radius / (0.15 * 0.42262), 0.007);
h *= factor;
m_target[0] = 1.0 / (h * h);
m_target[1] = 0;
m_target[2] = 0;
m_target[3] = 1.0 / (h * h);
m_target[4] = 0;
m_target[5] = 1.0 / (h * h);
if (ref_node_xyz(ref_node, 0, node) > 1.1) {
REF_DBL ht, s, hx;
ht = 0.007;
s = (ref_node_xyz(ref_node, 0, node) - 1.1) / 3.9;
s = MIN(1.0, MAX(0.0, s));
hx = ht * (1.0 - s) + 10 * ht * s;
hx *= factor;
ht *= factor;
m_target[0] = 1.0 / (hx * hx);
m_target[1] = 0;
m_target[2] = 0;
m_target[3] = 1.0 / (ht * ht);
m_target[4] = 0;
m_target[5] = 1.0 / (ht * ht);
}
if (0.1 < ref_node_xyz(ref_node, 2, node) ||
-0.1 > ref_node_xyz(ref_node, 2, node) ||
1.0 < ref_node_xyz(ref_node, 1, node) ||
-0.1 > ref_node_xyz(ref_node, 0, node)) {
h = 0.1 + ABS(ref_node_xyz(ref_node, 2, node)) / 5.0 +
ABS(ref_node_xyz(ref_node, 1, node)) / 5.0 +
ABS(ref_node_xyz(ref_node, 0, node)) / 5.0;
h *= factor;
m_target[0] = 1.0 / (h * h);
m_target[1] = 0;
m_target[2] = 0;
m_target[3] = 1.0 / (h * h);
m_target[4] = 0;
m_target[5] = 1.0 / (h * h);
}
RSS(ref_matrix_intersect(m_target, m, m_int), "intersect");
RSS(ref_node_metric_set(ref_node, node, m_int), "set node met");
}
return REF_SUCCESS;
}
REF_STATUS ref_metric_interpolate_node(REF_GRID ref_grid, REF_INT node) {
REF_MPI ref_mpi = ref_grid_mpi(ref_grid);
REF_INTERP ref_interp;
REF_GRID from_grid;
REF_NODE from_node;
REF_CELL from_cell;
REF_DBL log_parent_m[4][6], log_m[6], bary[4];
REF_INT ibary, im;
REF_INT nodes[REF_CELL_MAX_SIZE_PER];
if (NULL == ref_grid_interp(ref_grid)) {
return REF_SUCCESS;
}
ref_interp = ref_grid_interp(ref_grid);
from_grid = ref_interp_from_grid(ref_interp);
from_node = ref_grid_node(from_grid);
if (ref_grid_twod(from_grid)) {
from_cell = ref_interp_from_tri(ref_interp);
} else {
from_cell = ref_interp_from_tet(ref_interp);
}
if (!ref_interp_continuously(ref_interp)) {
ref_interp_cell(ref_interp, node) = REF_EMPTY; /* mark moved */
return REF_SUCCESS;
}
RAISE(ref_interp_locate_node(ref_interp, node));
/* location unsuccessful */
if (REF_EMPTY == ref_interp_cell(ref_interp, node) ||
ref_mpi_rank(ref_mpi) != ref_interp->part[node])
return REF_SUCCESS;
RSS(ref_cell_nodes(from_cell, ref_interp_cell(ref_interp, node), nodes),
"node needs to be localized");
RSS(ref_node_clip_bary4(&ref_interp_bary(ref_interp, 0, node), bary), "clip");
for (ibary = 0; ibary < ref_cell_node_per(from_cell); ibary++)
RSS(ref_node_metric_get_log(from_node, nodes[ibary], log_parent_m[ibary]),
"log(parentM)");
for (im = 0; im < 6; im++) log_m[im] = 0.0;
for (im = 0; im < 6; im++) {
for (ibary = 0; ibary < ref_cell_node_per(from_cell); ibary++) {
log_m[im] += bary[ibary] * log_parent_m[ibary][im];
}
}
RSS(ref_node_metric_set_log(ref_grid_node(ref_grid), node, log_m),
"set interp log met");
return REF_SUCCESS;
}
REF_STATUS ref_metric_interpolate_between(REF_GRID ref_grid, REF_INT node0,
REF_INT node1, REF_INT new_node) {
REF_MPI ref_mpi = ref_grid_mpi(ref_grid);
REF_INTERP ref_interp;
REF_GRID from_grid;
REF_NODE from_node;
REF_CELL from_cell;
REF_NODE to_node;
REF_DBL log_parent_m[4][6], log_m[6], bary[4];
REF_INT ibary, im;
REF_INT nodes[REF_CELL_MAX_SIZE_PER];
/* skip null interp */
if (NULL == ref_grid_interp(ref_grid)) return REF_SUCCESS;
ref_interp = ref_grid_interp(ref_grid);
from_grid = ref_interp_from_grid(ref_interp);
from_node = ref_grid_node(from_grid);
from_node = ref_grid_node(from_grid);
if (ref_grid_twod(from_grid)) {
from_cell = ref_interp_from_tri(ref_interp);
} else {
from_cell = ref_interp_from_tet(ref_interp);
}
to_node = ref_grid_node(ref_interp_to_grid(ref_interp));
if (new_node >= ref_interp_max(ref_interp)) {
RSS(ref_interp_resize(ref_interp, ref_node_max(to_node)), "resize");
}
if (!ref_interp_continuously(ref_interp)) {
ref_interp->cell[new_node] = REF_EMPTY; /* initialize new_node locate */
return REF_SUCCESS;
}
RAISE(ref_interp_locate_between(ref_interp, node0, node1, new_node));
/* location unsuccessful or off-part don't interpolate */
if (REF_EMPTY == ref_interp_cell(ref_interp, new_node) ||
ref_mpi_rank(ref_mpi) != ref_interp_part(ref_interp, new_node))
return REF_SUCCESS;
RSS(ref_cell_nodes(from_cell, ref_interp_cell(ref_interp, new_node), nodes),
"new_node needs to be localized");
RSS(ref_node_clip_bary4(&ref_interp_bary(ref_interp, 0, new_node), bary),
"clip");
for (ibary = 0; ibary < ref_cell_node_per(from_cell); ibary++)
RSS(ref_node_metric_get_log(from_node, nodes[ibary], log_parent_m[ibary]),
"log(parentM)");
for (im = 0; im < 6; im++) log_m[im] = 0.0;
for (im = 0; im < 6; im++) {
for (ibary = 0; ibary < ref_cell_node_per(from_cell); ibary++) {
log_m[im] += bary[ibary] * log_parent_m[ibary][im];
}
}
RSS(ref_node_metric_set_log(ref_grid_node(ref_grid), new_node, log_m),
"set interp log met");
return REF_SUCCESS;
}
REF_STATUS ref_metric_interpolate(REF_INTERP ref_interp) {
REF_GRID to_grid = ref_interp_to_grid(ref_interp);
REF_GRID from_grid = ref_interp_from_grid(ref_interp);
REF_NODE to_node = ref_grid_node(to_grid);
REF_NODE from_node = ref_grid_node(from_grid);
REF_CELL from_cell;
REF_MPI ref_mpi = ref_interp_mpi(ref_interp);
REF_INT node, ibary, im;
REF_INT nodes[REF_CELL_MAX_SIZE_PER];
REF_DBL log_parent_m[4][6];
REF_INT receptor, n_recept, donation, n_donor;
REF_DBL *recept_log_m, *donor_log_m, *recept_bary, *donor_bary;
REF_INT *donor_node, *donor_ret, *donor_cell;
REF_INT *recept_proc, *recept_ret, *recept_node, *recept_cell;
if (ref_grid_twod(from_grid)) {
from_cell = ref_interp_from_tri(ref_interp);
} else {
from_cell = ref_interp_from_tet(ref_interp);
}
n_recept = 0;
each_ref_node_valid_node(to_node, node) {
if (ref_node_owned(to_node, node)) {
n_recept++;
}
}
ref_malloc(recept_bary, 4 * n_recept, REF_DBL);
ref_malloc(recept_cell, n_recept, REF_INT);
ref_malloc(recept_node, n_recept, REF_INT);
ref_malloc(recept_ret, n_recept, REF_INT);
ref_malloc(recept_proc, n_recept, REF_INT);
n_recept = 0;
each_ref_node_valid_node(to_node, node) {
if (ref_node_owned(to_node, node)) {
RUS(REF_EMPTY, ref_interp->cell[node], "node needs to be localized");
RSS(ref_node_clip_bary4(&(ref_interp->bary[4 * node]),
&(recept_bary[4 * n_recept])),
"clip");
recept_proc[n_recept] = ref_interp->part[node];
recept_cell[n_recept] = ref_interp->cell[node];
recept_node[n_recept] = node;
recept_ret[n_recept] = ref_mpi_rank(ref_mpi);
n_recept++;
}
}
RSS(ref_mpi_blindsend(ref_mpi, recept_proc, (void *)recept_cell, 1, n_recept,
(void **)(&donor_cell), &n_donor, REF_INT_TYPE),
"blind send cell");
RSS(ref_mpi_blindsend(ref_mpi, recept_proc, (void *)recept_ret, 1, n_recept,
(void **)(&donor_ret), &n_donor, REF_INT_TYPE),
"blind send ret");
RSS(ref_mpi_blindsend(ref_mpi, recept_proc, (void *)recept_node, 1, n_recept,
(void **)(&donor_node), &n_donor, REF_INT_TYPE),
"blind send node");
RSS(ref_mpi_blindsend(ref_mpi, recept_proc, (void *)recept_bary, 4, n_recept,
(void **)(&donor_bary), &n_donor, REF_DBL_TYPE),
"blind send bary");
ref_free(recept_proc);
ref_free(recept_ret);
ref_free(recept_node);
ref_free(recept_cell);
ref_free(recept_bary);
ref_malloc(donor_log_m, 6 * n_donor, REF_DBL);
for (donation = 0; donation < n_donor; donation++) {
RSS(ref_cell_nodes(from_cell, donor_cell[donation], nodes),
"node needs to be localized");
for (ibary = 0; ibary < 4; ibary++)
RSS(ref_node_metric_get_log(from_node, nodes[ibary], log_parent_m[ibary]),
"log(parentM)");
for (im = 0; im < 6; im++) {
donor_log_m[im + 6 * donation] = 0.0;
for (ibary = 0; ibary < 4; ibary++) {
donor_log_m[im + 6 * donation] +=
donor_bary[ibary + 4 * donation] * log_parent_m[ibary][im];
}
}
}
ref_free(donor_cell);
ref_free(donor_bary);
RSS(ref_mpi_blindsend(ref_mpi, donor_ret, (void *)donor_log_m, 6, n_donor,
(void **)(&recept_log_m), &n_recept, REF_DBL_TYPE),
"blind send bary");
RSS(ref_mpi_blindsend(ref_mpi, donor_ret, (void *)donor_node, 1, n_donor,
(void **)(&recept_node), &n_recept, REF_INT_TYPE),
"blind send node");
ref_free(donor_log_m);
ref_free(donor_node);
ref_free(donor_ret);
for (receptor = 0; receptor < n_recept; receptor++) {
node = recept_node[receptor];
RSS(ref_node_metric_set_log(to_node, node, &(recept_log_m[6 * receptor])),
"set received log met");
}
ref_free(recept_node);
ref_free(recept_log_m);
return REF_SUCCESS;
}
REF_STATUS ref_metric_synchronize(REF_GRID to_grid) {
REF_INTERP ref_interp = ref_grid_interp(to_grid);
REF_MPI ref_mpi;
REF_INT node;
REF_DBL max_error, tol = 1.0e-8;
REF_BOOL report_interp_error = REF_FALSE;
if (NULL == ref_interp) return REF_SUCCESS;
ref_mpi = ref_interp_mpi(ref_interp);
if (ref_mpi_para(ref_mpi)) {
/* parallel can miss on partition boundaries, refresh interp */
RSS(ref_interp_locate_warm(ref_interp), "map from existing");
RSS(ref_metric_interpolate(ref_interp), "interp");
} else {
/* sequential should always localized unless mixed, assert */
each_ref_node_valid_node(ref_grid_node(to_grid), node) {
if (!ref_cell_node_empty(ref_grid_tri(to_grid), node) &&
!ref_cell_node_empty(ref_grid_tet(to_grid), node)) {
RUS(REF_EMPTY, ref_interp_cell(ref_interp, node), "should be located");
}
}
}
if (report_interp_error) {
RSS(ref_interp_max_error(ref_interp, &max_error), "err");
if (max_error > tol && ref_mpi_once(ref_mpi)) {
printf("warning: %e max_error greater than %e tol\n", max_error, tol);
}
}
return REF_SUCCESS;
}
REF_STATUS ref_metric_metric_space_gradation(REF_DBL *metric, REF_GRID ref_grid,
REF_DBL r) {
REF_NODE ref_node = ref_grid_node(ref_grid);
REF_EDGE ref_edge;
REF_DBL *metric_orig;
REF_DBL ratio, enlarge, log_r;
REF_DBL direction[3];
REF_DBL limit_metric[6], limited[6];
REF_INT node, i;
REF_INT edge, node0, node1;
log_r = log(r);
RSS(ref_edge_create(&ref_edge, ref_grid), "orig edges");
ref_malloc(metric_orig, 6 * ref_node_max(ref_grid_node(ref_grid)), REF_DBL);
each_ref_node_valid_node(ref_grid_node(ref_grid), node) {
for (i = 0; i < 6; i++) metric_orig[i + 6 * node] = metric[i + 6 * node];
}
/* F. Alauzet doi:10.1016/j.finel.2009.06.028 equation (9) */
each_ref_edge(ref_edge, edge) {
node0 = ref_edge_e2n(ref_edge, 0, edge);
node1 = ref_edge_e2n(ref_edge, 1, edge);
direction[0] =
(ref_node_xyz(ref_node, 0, node1) - ref_node_xyz(ref_node, 0, node0));
direction[1] =
(ref_node_xyz(ref_node, 1, node1) - ref_node_xyz(ref_node, 1, node0));
direction[2] =
(ref_node_xyz(ref_node, 2, node1) - ref_node_xyz(ref_node, 2, node0));
ratio = ref_matrix_sqrt_vt_m_v(&(metric_orig[6 * node1]), direction);
enlarge = pow(1.0 + ratio * log_r, -2.0);
for (i = 0; i < 6; i++)
limit_metric[i] = metric_orig[i + 6 * node1] * enlarge;
if (REF_SUCCESS != ref_matrix_intersect(&(metric_orig[6 * node0]),
limit_metric, limited)) {
REF_WHERE("limit m0 with enlarged m1");
ref_node_location(ref_node, node0);
printf("ratio %24.15e enlarge %24.15e \n", ratio, enlarge);
printf("RECOVER ref_metric_metric_space_gradation\n");
continue;
}
if (REF_SUCCESS != ref_matrix_intersect(&(metric[6 * node0]), limited,
&(metric[6 * node0]))) {
REF_WHERE("update m0");
ref_node_location(ref_node, node0);
printf("ratio %24.15e enlarge %24.15e \n", ratio, enlarge);
printf("RECOVER ref_metric_metric_space_gradation\n");
continue;
}
ratio = ref_matrix_sqrt_vt_m_v(&(metric_orig[6 * node0]), direction);
enlarge = pow(1.0 + ratio * log_r, -2.0);
for (i = 0; i < 6; i++)
limit_metric[i] = metric_orig[i + 6 * node0] * enlarge;
if (REF_SUCCESS != ref_matrix_intersect(&(metric_orig[6 * node1]),
limit_metric, limited)) {
REF_WHERE("limit m1 with enlarged m0");
ref_node_location(ref_node, node1);
printf("ratio %24.15e enlarge %24.15e \n", ratio, enlarge);
printf("RECOVER ref_metric_metric_space_gradation\n");
continue;
}
if (REF_SUCCESS != ref_matrix_intersect(&(metric[6 * node1]), limited,
&(metric[6 * node1]))) {
REF_WHERE("update m1");
ref_node_location(ref_node, node1);
printf("ratio %24.15e enlarge %24.15e \n", ratio, enlarge);
printf("RECOVER ref_metric_metric_space_gradation\n");
continue;
}
}
ref_free(metric_orig);
ref_edge_free(ref_edge);
RSS(ref_node_ghost_dbl(ref_grid_node(ref_grid), metric, 6), "update ghosts");
return REF_SUCCESS;
}
REF_STATUS ref_metric_mixed_space_gradation(REF_DBL *metric, REF_GRID ref_grid,
REF_DBL r, REF_DBL t) {
REF_NODE ref_node = ref_grid_node(ref_grid);
REF_EDGE ref_edge;
REF_DBL *metric_orig;
REF_DBL dist, ratio, enlarge, log_r;
REF_DBL direction[3];
REF_DBL limit_metric[6], limited[6];
REF_INT node, i;
REF_INT edge, node0, node1;
REF_DBL diag_system[12];
REF_DBL metric_space, phys_space;
if (r < 1.0) r = 1.5;
if (t < 0.0 || 1.0 > t) t = 1.0 / 8.0;
log_r = log(r);
RSS(ref_edge_create(&ref_edge, ref_grid), "orig edges");
ref_malloc(metric_orig, 6 * ref_node_max(ref_grid_node(ref_grid)), REF_DBL);
each_ref_node_valid_node(ref_grid_node(ref_grid), node) {
for (i = 0; i < 6; i++) metric_orig[i + 6 * node] = metric[i + 6 * node];
}
/* F. Alauzet doi:10.1016/j.finel.2009.06.028
* 6.2.1. Mixed-space homogeneous gradation */
each_ref_edge(ref_edge, edge) {
node0 = ref_edge_e2n(ref_edge, 0, edge);
node1 = ref_edge_e2n(ref_edge, 1, edge);
direction[0] =
(ref_node_xyz(ref_node, 0, node1) - ref_node_xyz(ref_node, 0, node0));
direction[1] =
(ref_node_xyz(ref_node, 1, node1) - ref_node_xyz(ref_node, 1, node0));
direction[2] =
(ref_node_xyz(ref_node, 2, node1) - ref_node_xyz(ref_node, 2, node0));
dist = sqrt(ref_math_dot(direction, direction));
ratio = ref_matrix_sqrt_vt_m_v(&(metric_orig[6 * node1]), direction);
RSB(ref_matrix_diag_m(&(metric_orig[6 * node1]), diag_system), "decomp",
{ ref_metric_show(&(metric_orig[6 * node1])); });
for (i = 0; i < 3; i++) {
metric_space = 1.0 + log_r * ratio;
phys_space = 1.0 + sqrt(ref_matrix_eig(diag_system, i)) * dist * log_r;
enlarge = pow(pow(phys_space, t) * pow(metric_space, 1.0 - t), -2.0);
ref_matrix_eig(diag_system, i) *= enlarge;
}
RSS(ref_matrix_form_m(diag_system, limit_metric), "reform limit");
if (REF_SUCCESS == ref_matrix_intersect(&(metric_orig[6 * node0]),
limit_metric, limited)) {
RSS(ref_matrix_intersect(&(metric[6 * node0]), limited,
&(metric[6 * node0])),
"update m0");
} else {
ref_node_location(ref_node, node0);
printf("dist %24.15e ratio %24.15e\n", dist, ratio);
printf("RECOVER ref_metric_mixed_space_gradation\n");
}
ratio = ref_matrix_sqrt_vt_m_v(&(metric_orig[6 * node0]), direction);
RSB(ref_matrix_diag_m(&(metric_orig[6 * node0]), diag_system), "decomp",
{ ref_metric_show(&(metric_orig[6 * node0])); });
for (i = 0; i < 3; i++) {
metric_space = 1.0 + log_r * ratio;
phys_space = 1.0 + sqrt(ref_matrix_eig(diag_system, i)) * dist * log_r;
enlarge = pow(pow(phys_space, t) * pow(metric_space, 1.0 - t), -2.0);
ref_matrix_eig(diag_system, i) *= enlarge;
}
RSS(ref_matrix_form_m(diag_system, limit_metric), "reform limit");
if (REF_SUCCESS == ref_matrix_intersect(&(metric_orig[6 * node1]),
limit_metric, limited)) {
RSS(ref_matrix_intersect(&(metric[6 * node1]), limited,
&(metric[6 * node1])),
"update m1");
} else {
ref_node_location(ref_node, node1);
printf("dist %24.15e ratio %24.15e\n", dist, ratio);
printf("RECOVER ref_metric_mixed_space_gradation\n");
}
}
ref_free(metric_orig);
ref_edge_free(ref_edge);
RSS(ref_node_ghost_dbl(ref_grid_node(ref_grid), metric, 6), "update ghosts");
return REF_SUCCESS;
}
REF_STATUS ref_metric_hessian_gradation(REF_DBL *metric, REF_GRID ref_grid,
REF_DBL r) {
REF_NODE ref_node = ref_grid_node(ref_grid);
REF_EDGE ref_edge;
REF_DBL *metric_orig;
REF_DBL limit_metric[6], limited[6];
REF_INT node, i;
REF_INT edge, node0, node1;
if (r < 1.0) r = 10.0;
RSS(ref_edge_create(&ref_edge, ref_grid), "orig edges");
ref_malloc(metric_orig, 6 * ref_node_max(ref_grid_node(ref_grid)), REF_DBL);
each_ref_node_valid_node(ref_grid_node(ref_grid), node) {
for (i = 0; i < 6; i++) metric_orig[i + 6 * node] = metric[i + 6 * node];
}
each_ref_edge(ref_edge, edge) {
node0 = ref_edge_e2n(ref_edge, 0, edge);
node1 = ref_edge_e2n(ref_edge, 1, edge);
for (i = 0; i < 6; i++) {
limit_metric[i] = metric_orig[i + 6 * node1] * r;
}
if (REF_SUCCESS ==
ref_matrix_bound(&(metric_orig[6 * node0]), limit_metric, limited)) {
RSS(ref_matrix_bound(&(metric[6 * node0]), limited, &(metric[6 * node0])),
"update m0");
} else {
ref_node_location(ref_node, node0);
printf("RECOVER %s\n", __func__);
}
for (i = 0; i < 6; i++) {
limit_metric[i] = metric_orig[i + 6 * node0] * r;
}
if (REF_SUCCESS ==
ref_matrix_bound(&(metric_orig[6 * node1]), limit_metric, limited)) {
RSS(ref_matrix_bound(&(metric[6 * node1]), limited, &(metric[6 * node1])),
"update m1");
} else {
ref_node_location(ref_node, node1);
printf("RECOVER %s\n", __func__);
}
}
ref_free(metric_orig);
ref_edge_free(ref_edge);
RSS(ref_node_ghost_dbl(ref_grid_node(ref_grid), metric, 6), "update ghosts");
return REF_SUCCESS;
}
REF_STATUS ref_metric_interpolation_error(REF_DBL *metric, REF_DBL *hess,
REF_GRID ref_grid,
REF_DBL *interpolation_error) {
/* Corollary 3.4 CONTINUOUS MESH FRAMEWORK PART I DOI:10.1137/090754078 */
REF_NODE ref_node = ref_grid_node(ref_grid);
REF_INT node;
REF_DBL error[6], m1half[6], m1neghalf[6], det, sqrt_det;
REF_DBL constant = 1.0 / 10.0;
if (ref_grid_twod(ref_grid)) {
constant = 1.0 / 8.0;
}
each_ref_node_valid_node(ref_node, node) {
if (ref_node_owned(ref_node, node)) {
RSS(ref_matrix_sqrt_m(&(metric[6 * node]), m1half, m1neghalf), "m^-1/2");
RSS(ref_matrix_mult_m0m1m0(m1neghalf, &(hess[6 * node]), error),
"error=m1half*hess*m1half");
RSS(ref_matrix_det_m(&(metric[6 * node]), &det), "det");
if (ref_grid_twod(ref_grid)) {
interpolation_error[node] = constant * (error[0] + error[3]);
} else {
interpolation_error[node] = constant * (error[0] + error[3] + error[5]);
}
if (det >= 0.0) {
sqrt_det = sqrt(det);
if (ref_math_divisible(interpolation_error[node], sqrt_det)) {
interpolation_error[node] /= sqrt_det;
} else {
interpolation_error[node] = 0.0;
}
} else {
interpolation_error[node] = 0.0;
}
}
}
RSS(ref_node_ghost_dbl(ref_node, interpolation_error, 1), "update ghosts");
return REF_SUCCESS;
}
REF_STATUS ref_metric_integrate_error(REF_GRID ref_grid,
REF_DBL *interpolation_error,
REF_DBL *total_error) {
REF_NODE ref_node = ref_grid_node(ref_grid);
REF_CELL ref_cell;
REF_INT cell_node, cell, nodes[REF_CELL_MAX_SIZE_PER];
REF_DBL volume;
REF_BOOL have_tet;
REF_LONG ntet;
RSS(ref_cell_ncell(ref_grid_tet(ref_grid), ref_node, &ntet), "count");
have_tet = (0 < ntet);
if (have_tet) {
ref_cell = ref_grid_tet(ref_grid);
} else {
ref_cell = ref_grid_tri(ref_grid);
}
*total_error = 0.0;
each_ref_cell_valid_cell_with_nodes(ref_cell, cell, nodes) {
if (have_tet) {
RSS(ref_node_tet_vol(ref_node, nodes, &volume), "vol");
} else {
RSS(ref_node_tri_area(ref_node, nodes, &volume), "area");
}
for (cell_node = 0; cell_node < ref_cell_node_per(ref_cell); cell_node++) {
if (ref_node_owned(ref_node, nodes[cell_node])) {
(*total_error) += interpolation_error[nodes[cell_node]] * volume /
((REF_DBL)ref_cell_node_per(ref_cell));
}
}
}
RSS(ref_mpi_allsum(ref_grid_mpi(ref_grid), total_error, 1, REF_DBL_TYPE),
"dbl sum");
return REF_SUCCESS;
}
REF_STATUS ref_metric_gradation_at_complexity(REF_DBL *metric,
REF_GRID ref_grid,
REF_DBL gradation,
REF_DBL complexity) {
REF_NODE ref_node = ref_grid_node(ref_grid);
REF_INT relaxations;
REF_DBL current_complexity;
REF_DBL complexity_scale;
REF_INT node, i;
complexity_scale = 2.0 / 3.0;
if (ref_grid_twod(ref_grid)) {
complexity_scale = 1.0;
}
for (relaxations = 0; relaxations < 20; relaxations++) {
RSS(ref_metric_complexity(metric, ref_grid, ¤t_complexity), "cmp");
if (!ref_math_divisible(complexity, current_complexity)) {
return REF_DIV_ZERO;
}
each_ref_node_valid_node(ref_node, node) {
for (i = 0; i < 6; i++) {
metric[i + 6 * node] *=
pow(complexity / current_complexity, complexity_scale);
}
if (ref_grid_twod(ref_grid)) {
metric[2 + 6 * node] = 0.0;
metric[4 + 6 * node] = 0.0;
metric[5 + 6 * node] = 1.0;
}
}
if (gradation < 1.0) {
RSS(ref_metric_mixed_space_gradation(metric, ref_grid, -1.0, -1.0),
"gradation");
} else {
RSS(ref_metric_metric_space_gradation(metric, ref_grid, gradation),
"gradation");
}
if (ref_grid_twod(ref_grid)) {
each_ref_node_valid_node(ref_node, node) {
metric[2 + 6 * node] = 0.0;
metric[4 + 6 * node] = 0.0;
metric[5 + 6 * node] = 1.0;
}
}
}
RSS(ref_metric_complexity(metric, ref_grid, ¤t_complexity), "cmp");
if (!ref_math_divisible(complexity, current_complexity)) {
return REF_DIV_ZERO;
}
each_ref_node_valid_node(ref_node, node) {
for (i = 0; i < 6; i++) {
metric[i + 6 * node] *=
pow(complexity / current_complexity, complexity_scale);
}
if (ref_grid_twod(ref_grid)) {
metric[2 + 6 * node] = 0.0;
metric[4 + 6 * node] = 0.0;
metric[5 + 6 * node] = 1.0;
}
}
return REF_SUCCESS;
}
REF_STATUS ref_metric_gradation_at_complexity_mixed(REF_DBL *metric,
REF_GRID ref_grid,
REF_DBL gradation,
REF_DBL complexity) {
REF_NODE ref_node = ref_grid_node(ref_grid);
REF_INT relaxations;
REF_DBL current_complexity;
REF_DBL complexity_scale;
REF_INT node, i;
REF_DBL *metric_imply;
ref_malloc(metric_imply, 6 * ref_node_max(ref_grid_node(ref_grid)), REF_DBL);
complexity_scale = 2.0 / 3.0;
if (ref_grid_twod(ref_grid)) {
complexity_scale = 1.0;
}
for (relaxations = 0; relaxations < 20; relaxations++) {
RSS(ref_metric_complexity(metric, ref_grid, ¤t_complexity), "cmp");
if (!ref_math_divisible(complexity, current_complexity)) {
return REF_DIV_ZERO;
}
each_ref_node_valid_node(ref_node, node) {
for (i = 0; i < 6; i++) {
metric[i + 6 * node] *=
pow(complexity / current_complexity, complexity_scale);
}
if (ref_grid_twod(ref_grid)) {
metric[2 + 6 * node] = 0.0;
metric[4 + 6 * node] = 0.0;
metric[5 + 6 * node] = 1.0;
}
}
RSS(ref_metric_imply_non_tet(metric, ref_grid), "imply non tet");
if (gradation < 1.0) {
RSS(ref_metric_mixed_space_gradation(metric, ref_grid, -1.0, -1.0),
"gradation");
} else {
RSS(ref_metric_metric_space_gradation(metric, ref_grid, gradation),
"gradation");
}
if (ref_grid_twod(ref_grid)) {
each_ref_node_valid_node(ref_node, node) {
metric[2 + 6 * node] = 0.0;
metric[4 + 6 * node] = 0.0;
metric[5 + 6 * node] = 1.0;
}
}
}
RSS(ref_metric_complexity(metric, ref_grid, ¤t_complexity), "cmp");
if (!ref_math_divisible(complexity, current_complexity)) {
return REF_DIV_ZERO;
}
each_ref_node_valid_node(ref_node, node) {
for (i = 0; i < 6; i++) {
metric[i + 6 * node] *=
pow(complexity / current_complexity, complexity_scale);
}
if (ref_grid_twod(ref_grid)) {
metric[2 + 6 * node] = 0.0;
metric[4 + 6 * node] = 0.0;
metric[5 + 6 * node] = 1.0;
}
}
ref_free(metric_imply) return REF_SUCCESS;
}
REF_STATUS ref_metric_sanitize(REF_GRID ref_grid) {
if (ref_grid_twod(ref_grid)) {
RSS(ref_metric_sanitize_twod(ref_grid), "threed");
} else {
RSS(ref_metric_sanitize_threed(ref_grid), "threed");
}
return REF_SUCCESS;
}
REF_STATUS ref_metric_sanitize_threed(REF_GRID ref_grid) {
REF_DBL *metric_orig;
REF_DBL *metric_imply;
REF_DBL *metric;
ref_malloc(metric_orig, 6 * ref_node_max(ref_grid_node(ref_grid)), REF_DBL);
ref_malloc(metric_imply, 6 * ref_node_max(ref_grid_node(ref_grid)), REF_DBL);
ref_malloc(metric, 6 * ref_node_max(ref_grid_node(ref_grid)), REF_DBL);
RSS(ref_metric_from_node(metric_orig, ref_grid_node(ref_grid)), "from");
RSS(ref_metric_imply_from(metric_imply, ref_grid), "imply");
RSS(ref_metric_smr(metric_imply, metric_orig, metric, ref_grid), "smr");
RSS(ref_metric_imply_non_tet(metric, ref_grid), "imply non tet");
RSS(ref_metric_to_node(metric, ref_grid_node(ref_grid)), "to");
ref_free(metric);
ref_free(metric_imply);
ref_free(metric_orig);
return REF_SUCCESS;
}
REF_STATUS ref_metric_sanitize_twod(REF_GRID ref_grid) {
REF_NODE ref_node = ref_grid_node(ref_grid);
REF_DBL *metric_orig;
REF_DBL *metric_imply;
REF_DBL *metric;
REF_INT node;
ref_malloc(metric_orig, 6 * ref_node_max(ref_grid_node(ref_grid)), REF_DBL);
ref_malloc(metric_imply, 6 * ref_node_max(ref_grid_node(ref_grid)), REF_DBL);
ref_malloc(metric, 6 * ref_node_max(ref_grid_node(ref_grid)), REF_DBL);
RSS(ref_metric_from_node(metric_orig, ref_grid_node(ref_grid)), "from");
for (node = 0; node < ref_node_max(ref_node); node++) {
metric_orig[2 + 6 * node] = 0.0;
metric_orig[4 + 6 * node] = 0.0;
metric_orig[5 + 6 * node] = 1.0;
}
RSS(ref_metric_imply_from(metric_imply, ref_grid), "imply");
for (node = 0; node < ref_node_max(ref_node); node++) {
metric_imply[1 + 6 * node] = 0.0;
metric_imply[3 + 6 * node] = 1.0;
metric_imply[4 + 6 * node] = 0.0;
}
RSS(ref_metric_smr(metric_imply, metric_orig, metric, ref_grid), "smr");
RSS(ref_metric_to_node(metric, ref_grid_node(ref_grid)), "to");
ref_free(metric);
ref_free(metric_imply);
ref_free(metric_orig);
return REF_SUCCESS;
}
REF_STATUS ref_metric_interpolated_curvature(REF_GRID ref_grid) {
REF_NODE ref_node = ref_grid_node(ref_grid);
REF_DBL *metric;
REF_INT gradation;
ref_malloc(metric, 6 * ref_node_max(ref_node), REF_DBL);
RSS(ref_metric_from_curvature(metric, ref_grid), "curve");
for (gradation = 0; gradation < 20; gradation++) {
RSS(ref_metric_mixed_space_gradation(metric, ref_grid, -1.0, -1.0), "grad");
}
RSS(ref_metric_to_node(metric, ref_node), "to node");
ref_free(metric);
return REF_SUCCESS;
}
REF_STATUS ref_metric_constrain_curvature(REF_GRID ref_grid) {
REF_NODE ref_node = ref_grid_node(ref_grid);
REF_DBL *curvature_metric;
REF_DBL m[6], m_constrained[6];
REF_INT node, gradation;
ref_malloc(curvature_metric, 6 * ref_node_max(ref_node), REF_DBL);
RSS(ref_metric_from_curvature(curvature_metric, ref_grid), "curve");
for (gradation = 0; gradation < 20; gradation++) {
RSS(ref_metric_mixed_space_gradation(curvature_metric, ref_grid, -1.0,
-1.0),
"grad");
}
each_ref_node_valid_node(ref_node, node) {
RSS(ref_node_metric_get(ref_node, node, m), "get");
RSS(ref_matrix_intersect(&(curvature_metric[6 * node]), m, m_constrained),
"intersect");
if (ref_grid_twod(ref_grid))
RSS(ref_matrix_twod_m(m_constrained), "enforce twod");
RSS(ref_node_metric_set(ref_node, node, m_constrained), "set node met");
}
ref_free(curvature_metric);
return REF_SUCCESS;
}
REF_STATUS ref_metric_from_curvature(REF_DBL *metric, REF_GRID ref_grid) {
REF_NODE ref_node = ref_grid_node(ref_grid);
REF_GEOM ref_geom = ref_grid_geom(ref_grid);
REF_INT geom, node, face;
REF_DBL kr, r[3], ks, s[3], n[3];
REF_DBL diagonal_system[12];
REF_DBL previous_metric[6], curvature_metric[6];
REF_INT i;
REF_DBL delta_radian; /* 1/segments per radian */
REF_DBL hmax = REF_DBL_MAX;
REF_DBL rlimit;
REF_DBL hr, hs, hn, slop;
REF_DBL aspect_ratio, curvature_ratio, norm_ratio;
REF_DBL crease_dot_prod, ramp, scale;
if (ref_geom_model_loaded(ref_geom)) {
RSS(ref_egads_diagonal(ref_geom, REF_EMPTY, &hmax), "egads bbox diag");
} else if (ref_geom_meshlinked(ref_geom)) {
RSS(ref_node_bounding_box_diagonal(ref_node, &hmax), "bbox diag");
} else {
printf("\nNo geometry model, did you forget to load it?\n\n");
RSS(REF_IMPLEMENT, "...or implement non-CAD curvature estimate");
}
/* normal spacing and max tangential spacing */
hmax /= MAX(1.0, ref_geom_segments_per_bounding_box_diagonal(ref_geom));
/* limit aspect ratio via curvature */
aspect_ratio = 20.0;
curvature_ratio = 1.0 / aspect_ratio;
/* limit normal direction to a factor of surface spacing */
norm_ratio = 2.0;
each_ref_node_valid_node(ref_node, node) {
if (ref_node_owned(ref_node, node)) {
if (ref_geom_model_loaded(ref_geom)) {
RSS(ref_egads_feature_size(ref_grid, node, &hr, r, &hs, s, &hn, n),
"feature size");
hs = MIN(hs, hr * aspect_ratio);
hn = MIN(hn, norm_ratio * hr);
hn = MIN(hn, norm_ratio * hs);
for (i = 0; i < 3; i++) ref_matrix_vec(diagonal_system, i, 0) = r[i];
ref_matrix_eig(diagonal_system, 0) = 1.0 / hr / hr;
for (i = 0; i < 3; i++) ref_matrix_vec(diagonal_system, i, 1) = s[i];
ref_matrix_eig(diagonal_system, 1) = 1.0 / hs / hs;
for (i = 0; i < 3; i++) ref_matrix_vec(diagonal_system, i, 2) = n[i];
ref_matrix_eig(diagonal_system, 2) = 1.0 / hn / hn;
RSS(ref_matrix_form_m(diagonal_system, &(metric[6 * node])), "form m");
} else {
metric[0 + 6 * node] = 1.0 / hmax / hmax;
metric[1 + 6 * node] = 0.0;
metric[2 + 6 * node] = 0.0;
metric[3 + 6 * node] = 1.0 / hmax / hmax;
metric[4 + 6 * node] = 0.0;
metric[5 + 6 * node] = 1.0 / hmax / hmax;
}
}
}
each_ref_geom_face(ref_geom, geom) {
node = ref_geom_node(ref_geom, geom);
if (ref_node_owned(ref_node, node)) {
face = ref_geom_id(ref_geom, geom) - 1;
RSS(ref_geom_radian_request(ref_geom, geom, &delta_radian), "drad");
rlimit = hmax / delta_radian; /* h = r*drad, r = h/drad */
if (ref_geom_model_loaded(ref_geom)) {
RXS(ref_egads_face_curvature(ref_geom, geom, &kr, r, &ks, s),
REF_FAILURE, "curve");
} else if (ref_geom_meshlinked(ref_geom)) {
RSS(ref_meshlink_face_curvature(ref_grid, geom, &kr, r, &ks, s),
"curve");
} else {
continue;
}
/* ignore sign, curvature is 1 / radius */
kr = ABS(kr);
ks = ABS(ks);
/* limit the aspect ratio of the metric by reducing the largest radius */
kr = MAX(kr, curvature_ratio * ks);
ks = MAX(ks, curvature_ratio * kr);
hr = hmax;
if (1.0 / rlimit < kr) hr = delta_radian / kr;
hs = hmax;
if (1.0 / rlimit < ks) hs = delta_radian / ks;
if (ref_geom_model_loaded(ref_geom)) {
REF_BOOL usable;
RSS(ref_geom_usable(ref_geom, geom, &usable), "useable curvature");
if (!usable) continue;
RSS(ref_geom_reliability(ref_geom, geom, &slop), "edge tol");
} else if (ref_geom_meshlinked(ref_geom)) {
RSS(ref_meshlink_gap(ref_grid, node, &slop), "edge tol");
slop *= ref_geom_gap_protection(ref_geom);
} else {
slop = 1.0e-5 * hmax;
}
if (hr < slop || hs < slop) continue;
if (0.0 < ref_geom_face_min_length(ref_geom, face)) {
if (hr < ref_geom_face_min_length(ref_geom, face) ||
hs < ref_geom_face_min_length(ref_geom, face))
continue;
}
hn = hmax;
if (0.0 < ref_geom_face_initial_cell_height(ref_geom, face))
hn = ref_geom_face_initial_cell_height(ref_geom, face);
hn = MIN(hn, norm_ratio * hr);
hn = MIN(hn, norm_ratio * hs);
/* cross the tangent vectors to get the (inward or outward) normal */
ref_math_cross_product(r, s, n);
for (i = 0; i < 3; i++) ref_matrix_vec(diagonal_system, i, 0) = r[i];
ref_matrix_eig(diagonal_system, 0) = 1.0 / hr / hr;
for (i = 0; i < 3; i++) ref_matrix_vec(diagonal_system, i, 1) = s[i];
ref_matrix_eig(diagonal_system, 1) = 1.0 / hs / hs;
for (i = 0; i < 3; i++) ref_matrix_vec(diagonal_system, i, 2) = n[i];
ref_matrix_eig(diagonal_system, 2) = 1.0 / hn / hn;
/* form and intersect with previous */
RSS(ref_matrix_form_m(diagonal_system, curvature_metric), "reform m");
for (i = 0; i < 6; i++) previous_metric[i] = metric[i + 6 * node];
RSS(ref_matrix_intersect(previous_metric, curvature_metric,
&(metric[6 * node])),
"intersect to update metric");
}
}
each_ref_geom_edge(ref_geom, geom) {
node = ref_geom_node(ref_geom, geom);
if (ref_node_owned(ref_node, node)) {
RSS(ref_geom_radian_request(ref_geom, geom, &delta_radian), "drad");
rlimit = hmax / delta_radian; /* h = r*drad, r = h/drad */
if (ref_geom_model_loaded(ref_geom)) {
RSS(ref_egads_edge_curvature(ref_geom, geom, &kr, r), "curve");
} else if (ref_geom_meshlinked(ref_geom)) {
RSS(ref_meshlink_edge_curvature(ref_grid, geom, &kr, r), "curve");
} else {
continue;
}
/* ignore sign, curvature is 1 / radius */
kr = ABS(kr);
hr = hmax;
if (1.0 / rlimit < kr) hr = delta_radian / kr;
if (ref_geom_model_loaded(ref_geom)) {
RSS(ref_geom_reliability(ref_geom, geom, &slop), "edge tol");
} else if (ref_geom_meshlinked(ref_geom)) {
RSS(ref_meshlink_gap(ref_grid, node, &slop), "edge tol");
slop *= ref_geom_gap_protection(ref_geom);
} else {
slop = 1.0e-5 * hmax;
}
if (hr < slop) continue;
if (ref_geom_model_loaded(ref_geom)) {
RSS(ref_geom_crease(ref_grid, node, &crease_dot_prod), "crease");
if (crease_dot_prod < -0.8) {
ramp = (-crease_dot_prod - 0.8) / 0.2;
scale = 0.25 * ramp + 1.0 * (1.0 - ramp);
hr *= scale;
}
}
ref_matrix_vec(diagonal_system, 0, 0) = 1.0;
ref_matrix_vec(diagonal_system, 1, 0) = 0.0;
ref_matrix_vec(diagonal_system, 2, 0) = 0.0;
ref_matrix_eig(diagonal_system, 0) = 1.0 / hr / hr;
ref_matrix_vec(diagonal_system, 0, 1) = 0.0;
ref_matrix_vec(diagonal_system, 1, 1) = 1.0;
ref_matrix_vec(diagonal_system, 2, 1) = 0.0;
ref_matrix_eig(diagonal_system, 1) = 1.0 / hr / hr;
ref_matrix_vec(diagonal_system, 0, 2) = 0.0;
ref_matrix_vec(diagonal_system, 1, 2) = 0.0;
ref_matrix_vec(diagonal_system, 2, 2) = 1.0;
ref_matrix_eig(diagonal_system, 2) = 1.0 / hr / hr;
/* form and intersect with previous */
RSS(ref_matrix_form_m(diagonal_system, curvature_metric), "reform m");
for (i = 0; i < 6; i++) previous_metric[i] = metric[i + 6 * node];
RSS(ref_matrix_intersect(previous_metric, curvature_metric,
&(metric[6 * node])),
"intersect to update metric");
}
}
if (ref_grid_twod(ref_grid)) {
each_ref_node_valid_node(ref_node, node) {
if (ref_node_owned(ref_node, node)) {
RSS(ref_matrix_twod_m(&(metric[6 * node])), "enforce twod");
}
}
}
RSS(ref_node_ghost_dbl(ref_node, metric, 6), "update ghosts");
return REF_SUCCESS;
}
static REF_STATUS add_sub_tet(REF_INT n0, REF_INT n1, REF_INT n2, REF_INT n3,
REF_INT *nodes, REF_DBL *metric,
REF_DBL *total_node_volume, REF_NODE ref_node,
REF_CELL ref_cell) {
REF_INT tet_nodes[REF_CELL_MAX_SIZE_PER];
REF_DBL m[6], log_m[6];
REF_DBL tet_volume;
REF_INT node, im;
REF_STATUS status;
tet_nodes[0] = nodes[(n0)];
tet_nodes[1] = nodes[(n1)];
tet_nodes[2] = nodes[(n2)];
tet_nodes[3] = nodes[(n3)];
RSS(ref_node_tet_vol(ref_node, tet_nodes, &tet_volume), "vol");
status = ref_matrix_imply_m(m, ref_node_xyz_ptr(ref_node, tet_nodes[0]),
ref_node_xyz_ptr(ref_node, tet_nodes[1]),
ref_node_xyz_ptr(ref_node, tet_nodes[2]),
ref_node_xyz_ptr(ref_node, tet_nodes[3]));
if (tet_volume > 0.0 && REF_SUCCESS == status) {
RSS(ref_matrix_log_m(m, log_m), "log");
for (node = 0; node < ref_cell_node_per(ref_cell); node++) {
total_node_volume[nodes[node]] += tet_volume;
for (im = 0; im < 6; im++)
metric[im + 6 * nodes[node]] += tet_volume * log_m[im];
}
} else {
/* silently skip singular contribution */
}
return REF_SUCCESS;
}
static REF_STATUS add_sub_tri(REF_INT n0, REF_INT n1, REF_INT n2,
REF_INT *nodes, REF_DBL *metric,
REF_DBL *total_node_volume, REF_NODE ref_node,
REF_CELL ref_cell) {
REF_INT tri_nodes[REF_CELL_MAX_SIZE_PER];
REF_DBL m[6], log_m[6];
REF_DBL tri_area;
REF_INT node, im;
REF_STATUS status;
tri_nodes[0] = nodes[(n0)];
tri_nodes[1] = nodes[(n1)];
tri_nodes[2] = nodes[(n2)];
status = ref_matrix_imply_m3(m, ref_node_xyz_ptr(ref_node, tri_nodes[0]),
ref_node_xyz_ptr(ref_node, tri_nodes[1]),
ref_node_xyz_ptr(ref_node, tri_nodes[2]));
if (REF_SUCCESS == status) {
RSS(ref_matrix_log_m(m, log_m), "log");
RSS(ref_node_tri_area(ref_node, tri_nodes, &tri_area), "area");
for (node = 0; node < ref_cell_node_per(ref_cell); node++) {
total_node_volume[nodes[node]] += tri_area;
for (im = 0; im < 6; im++)
metric[im + 6 * nodes[node]] += tri_area * log_m[im];
}
} else {
/* silently skip singular contribution */
}
return REF_SUCCESS;
}
REF_STATUS ref_metric_imply_from(REF_DBL *metric, REF_GRID ref_grid) {
REF_NODE ref_node = ref_grid_node(ref_grid);
REF_DBL m[6], log_m[6];
REF_DBL *total_node_volume;
REF_INT node, im;
REF_INT cell;
REF_CELL ref_cell;
REF_INT nodes[REF_CELL_MAX_SIZE_PER];
ref_malloc_init(total_node_volume, ref_node_max(ref_node), REF_DBL, 0.0);
for (node = 0; node < ref_node_max(ref_node); node++)
for (im = 0; im < 6; im++) metric[im + 6 * node] = 0.0;
if (ref_grid_twod(ref_grid)) {
ref_cell = ref_grid_tri(ref_grid);
each_ref_cell_valid_cell_with_nodes(ref_cell, cell, nodes) {
RSS(add_sub_tri(0, 1, 2, nodes, metric, total_node_volume, ref_node,
ref_cell),
"tet sub tet");
}
}
ref_cell = ref_grid_tet(ref_grid);
each_ref_cell_valid_cell_with_nodes(ref_cell, cell, nodes) {
RSS(add_sub_tet(0, 1, 2, 3, nodes, metric, total_node_volume, ref_node,
ref_cell),
"tet sub tet");
}
ref_cell = ref_grid_pri(ref_grid);
each_ref_cell_valid_cell_with_nodes(ref_cell, cell, nodes) {
RSS(add_sub_tet(0, 4, 5, 3, nodes, metric, total_node_volume, ref_node,
ref_cell),
"pri sub tet");
RSS(add_sub_tet(0, 1, 5, 4, nodes, metric, total_node_volume, ref_node,
ref_cell),
"pri sub tet");
RSS(add_sub_tet(0, 1, 2, 5, nodes, metric, total_node_volume, ref_node,
ref_cell),
"pri sub tet");
}
ref_cell = ref_grid_pyr(ref_grid);
each_ref_cell_valid_cell_with_nodes(ref_cell, cell, nodes) {
RSS(add_sub_tet(0, 4, 1, 2, nodes, metric, total_node_volume, ref_node,
ref_cell),
"pyr sub tet");
RSS(add_sub_tet(0, 3, 4, 2, nodes, metric, total_node_volume, ref_node,
ref_cell),
"pyr sub tet");
}
ref_cell = ref_grid_hex(ref_grid);
each_ref_cell_valid_cell_with_nodes(ref_cell, cell, nodes) {
RSS(add_sub_tet(0, 5, 7, 4, nodes, metric, total_node_volume, ref_node,
ref_cell),
"hex sub tet");
RSS(add_sub_tet(0, 1, 7, 5, nodes, metric, total_node_volume, ref_node,
ref_cell),
"hex sub tet");
RSS(add_sub_tet(1, 6, 7, 5, nodes, metric, total_node_volume, ref_node,
ref_cell),
"hex sub tet");
RSS(add_sub_tet(0, 7, 2, 3, nodes, metric, total_node_volume, ref_node,
ref_cell),
"hex sub tet");
RSS(add_sub_tet(0, 7, 1, 2, nodes, metric, total_node_volume, ref_node,
ref_cell),
"hex sub tet");
RSS(add_sub_tet(1, 7, 6, 2, nodes, metric, total_node_volume, ref_node,
ref_cell),
"hex sub tet");
}
each_ref_node_valid_node(ref_node, node) {
if (ref_node_owned(ref_node, node)) {
RAS(0.0 < total_node_volume[node], "zero metric contributions");
for (im = 0; im < 6; im++) {
if (!ref_math_divisible(metric[im + 6 * node], total_node_volume[node]))
RSS(REF_DIV_ZERO, "zero volume");
log_m[im] = metric[im + 6 * node] / total_node_volume[node];
}
RSS(ref_matrix_exp_m(log_m, m), "exp");
for (im = 0; im < 6; im++) metric[im + 6 * node] = m[im];
total_node_volume[node] = 0.0;
}
}
ref_free(total_node_volume);
RSS(ref_node_ghost_dbl(ref_node, metric, 6), "update ghosts");
return REF_SUCCESS;
}
REF_STATUS ref_metric_imply_non_tet(REF_DBL *metric, REF_GRID ref_grid) {
REF_NODE ref_node = ref_grid_node(ref_grid);
REF_DBL *total_node_volume;
REF_DBL m[6], log_m[6];
REF_INT node, im;
REF_INT cell;
REF_CELL ref_cell;
REF_INT nodes[REF_CELL_MAX_SIZE_PER];
REF_DBL *backup;
ref_malloc(backup, 6 * ref_node_max(ref_node), REF_DBL);
each_ref_node_valid_node(ref_node, node) {
for (im = 0; im < 6; im++) backup[im + 6 * node] = metric[im + 6 * node];
}
ref_malloc_init(total_node_volume, ref_node_max(ref_node), REF_DBL, 0.0);
each_ref_node_valid_node(ref_node, node) {
if (ref_adj_valid(
ref_adj_first(ref_cell_adj(ref_grid_pyr(ref_grid)), node)) ||
ref_adj_valid(
ref_adj_first(ref_cell_adj(ref_grid_pri(ref_grid)), node)) ||
ref_adj_valid(
ref_adj_first(ref_cell_adj(ref_grid_hex(ref_grid)), node))) {
for (im = 0; im < 6; im++) {
metric[im + 6 * node] = 0.0;
}
}
}
ref_cell = ref_grid_pri(ref_grid);
each_ref_cell_valid_cell_with_nodes(ref_cell, cell, nodes) {
RSS(add_sub_tet(0, 4, 5, 3, nodes, metric, total_node_volume, ref_node,
ref_cell),
"pri sub tet");
RSS(add_sub_tet(0, 1, 5, 4, nodes, metric, total_node_volume, ref_node,
ref_cell),
"pri sub tet");
RSS(add_sub_tet(0, 1, 2, 5, nodes, metric, total_node_volume, ref_node,
ref_cell),
"pri sub tet");
}
ref_cell = ref_grid_pyr(ref_grid);
each_ref_cell_valid_cell_with_nodes(ref_cell, cell, nodes) {
RSS(add_sub_tet(0, 4, 1, 2, nodes, metric, total_node_volume, ref_node,
ref_cell),
"pyr sub tet");
RSS(add_sub_tet(0, 3, 4, 2, nodes, metric, total_node_volume, ref_node,
ref_cell),
"pyr sub tet");
}
/*
VI1 VI6 VI8 VI5 VI1 VI2 VI8 VI6 VI2 VI7 VI8 VI6
VI1 VI8 VI3 VI4 VI1 VI8 VI2 VI3 VI2 VI8 VI7 VI3
*/
ref_cell = ref_grid_hex(ref_grid);
each_ref_cell_valid_cell_with_nodes(ref_cell, cell, nodes) {
RSS(add_sub_tet(0, 5, 7, 4, nodes, metric, total_node_volume, ref_node,
ref_cell),
"hex sub tet");
RSS(add_sub_tet(0, 1, 7, 5, nodes, metric, total_node_volume, ref_node,
ref_cell),
"hex sub tet");
RSS(add_sub_tet(1, 6, 7, 5, nodes, metric, total_node_volume, ref_node,
ref_cell),
"hex sub tet");
RSS(add_sub_tet(0, 7, 2, 3, nodes, metric, total_node_volume, ref_node,
ref_cell),
"hex sub tet");
RSS(add_sub_tet(0, 7, 1, 2, nodes, metric, total_node_volume, ref_node,
ref_cell),
"hex sub tet");
RSS(add_sub_tet(1, 7, 6, 2, nodes, metric, total_node_volume, ref_node,
ref_cell),
"hex sub tet");
}
each_ref_node_valid_node(ref_node, node) {
if (ref_adj_valid(
ref_adj_first(ref_cell_adj(ref_grid_pyr(ref_grid)), node)) ||
ref_adj_valid(
ref_adj_first(ref_cell_adj(ref_grid_pri(ref_grid)), node)) ||
ref_adj_valid(
ref_adj_first(ref_cell_adj(ref_grid_hex(ref_grid)), node))) {
if (ref_node_owned(ref_node, node)) {
if (0.0 < total_node_volume[node]) {
for (im = 0; im < 6; im++) {
if (!ref_math_divisible(metric[im + 6 * node],
total_node_volume[node]))
RSS(REF_DIV_ZERO, "zero volume");
log_m[im] = metric[im + 6 * node] / total_node_volume[node];
}
RSS(ref_matrix_exp_m(log_m, m), "exp");
for (im = 0; im < 6; im++) metric[im + 6 * node] = m[im];
total_node_volume[node] = 0.0;
for (im = 0; im < 6; im++)
RAS(isfinite(metric[im + 6 * node]), "infer not finite");
} else {
for (im = 0; im < 6; im++)
metric[im + 6 * node] = backup[im + 6 * node];
for (im = 0; im < 6; im++)
RAS(isfinite(metric[im + 6 * node]), "backup not finite");
}
}
} else {
for (im = 0; im < 6; im++)
RAS(isfinite(metric[im + 6 * node]), "orig,tet not finite");
}
}
ref_free(total_node_volume);
ref_free(backup);
RSS(ref_node_ghost_dbl(ref_node, metric, 6), "update ghosts");
return REF_SUCCESS;
}
REF_STATUS ref_metric_smr(REF_DBL *metric0, REF_DBL *metric1, REF_DBL *metric,
REF_GRID ref_grid) {
REF_INT node;
REF_DBL metric_inv[6];
REF_DBL inv_m1_m2[9];
REF_DBL n_values[3], n_vectors[9], inv_n_vectors[9];
REF_DBL diagonal_system[12];
REF_DBL h0, h1, h, hmax, hmin, h2;
REF_DBL eig;
REF_INT i;
each_ref_node_valid_node(ref_grid_node(ref_grid), node) {
RSS(ref_matrix_inv_m(&(metric0[6 * node]), metric_inv), "inv");
RSS(ref_matrix_mult_m(metric_inv, &(metric1[6 * node]), inv_m1_m2), "mult");
RSS(ref_matrix_diag_gen(3, inv_m1_m2, n_values, n_vectors), "gen eig");
for (i = 0; i < 3; i++) {
h0 = ref_matrix_sqrt_vt_m_v(&(metric0[6 * node]), &(n_vectors[i * 3]));
if (!ref_math_divisible(1.0, h0)) RSS(REF_DIV_ZERO, "inf h0");
h0 = 1.0 / h0;
h1 = ref_matrix_sqrt_vt_m_v(&(metric1[6 * node]), &(n_vectors[i * 3]));
if (!ref_math_divisible(1.0, h1)) RSS(REF_DIV_ZERO, "inf h1");
h1 = 1.0 / h1;
hmax = 4.00 * h0;
hmin = 0.25 * h0;
h = MIN(hmax, MAX(hmin, h1));
h2 = h * h;
if (!ref_math_divisible(1.0, h2)) RSS(REF_DIV_ZERO, "zero h^2");
eig = 1.0 / h2;
ref_matrix_eig(diagonal_system, i) = eig;
}
if (REF_SUCCESS != ref_matrix_inv_gen(3, n_vectors, inv_n_vectors)) {
printf(" unable to invert eigenvectors:\n");
printf(" %f %f %f\n", n_vectors[0], n_vectors[1], n_vectors[2]);
printf(" %f %f %f\n", n_vectors[3], n_vectors[4], n_vectors[5]);
printf(" %f %f %f\n", n_vectors[6], n_vectors[7], n_vectors[8]);
RSS(REF_FAILURE, "gen eig");
}
RSS(ref_matrix_transpose_gen(3, inv_n_vectors, &(diagonal_system[3])),
"gen eig");
RSS(ref_matrix_form_m(diagonal_system, &(metric[6 * node])), "reform m");
}
return REF_SUCCESS;
}
REF_STATUS ref_metric_complexity(REF_DBL *metric, REF_GRID ref_grid,
REF_DBL *complexity) {
REF_NODE ref_node = ref_grid_node(ref_grid);
REF_CELL ref_cell;
REF_INT cell_node, cell, nodes[REF_CELL_MAX_SIZE_PER];
REF_DBL volume, det;
REF_BOOL have_tet;
REF_LONG ntet;
RSS(ref_cell_ncell(ref_grid_tet(ref_grid), ref_node, &ntet), "count");
have_tet = (0 < ntet);
if (have_tet) {
ref_cell = ref_grid_tet(ref_grid);
} else {
ref_cell = ref_grid_tri(ref_grid);
}
*complexity = 0.0;
each_ref_cell_valid_cell_with_nodes(ref_cell, cell, nodes) {
if (have_tet) {
RSS(ref_node_tet_vol(ref_node, nodes, &volume), "vol");
} else {
RSS(ref_node_tri_area(ref_node, nodes, &volume), "area");
}
for (cell_node = 0; cell_node < ref_cell_node_per(ref_cell); cell_node++) {
if (ref_node_owned(ref_node, nodes[cell_node])) {
RSS(ref_matrix_det_m(&(metric[6 * nodes[cell_node]]), &det), "det");
if (det > 0.0) {
(*complexity) +=
sqrt(det) * volume / ((REF_DBL)ref_cell_node_per(ref_cell));
}
}
}
}
RSS(ref_mpi_allsum(ref_grid_mpi(ref_grid), complexity, 1, REF_DBL_TYPE),
"dbl sum");
return REF_SUCCESS;
}
REF_STATUS ref_metric_set_complexity(REF_DBL *metric, REF_GRID ref_grid,
REF_DBL target_complexity) {
REF_NODE ref_node = ref_grid_node(ref_grid);
REF_INT i, node;
REF_DBL current_complexity;
REF_DBL complexity_scale;
complexity_scale = 2.0 / 3.0;
if (ref_grid_twod(ref_grid)) {
complexity_scale = 1.0;
}
RSS(ref_metric_complexity(metric, ref_grid, ¤t_complexity), "cmp");
if (!ref_math_divisible(target_complexity, current_complexity)) {
return REF_DIV_ZERO;
}
each_ref_node_valid_node(ref_node, node) {
for (i = 0; i < 6; i++) {
metric[i + 6 * node] *=
pow(target_complexity / current_complexity, complexity_scale);
}
if (ref_grid_twod(ref_grid)) {
metric[2 + 6 * node] = 0.0;
metric[4 + 6 * node] = 0.0;
metric[5 + 6 * node] = 1.0;
}
}
return REF_SUCCESS;
}
REF_STATUS ref_metric_limit_aspect_ratio(REF_DBL *metric, REF_GRID ref_grid,
REF_DBL aspect_ratio) {
REF_DBL diag_system[12];
REF_DBL max_eig, limit_eig;
REF_INT node;
if (ref_grid_twod(ref_grid)) {
each_ref_node_valid_node(ref_grid_node(ref_grid), node) {
RSS(ref_matrix_diag_m(&(metric[6 * node]), diag_system), "eigen decomp");
RSS(ref_matrix_ascending_eig_twod(diag_system), "2D eig sort");
max_eig = ref_matrix_eig(diag_system, 0);
max_eig = MAX(ref_matrix_eig(diag_system, 1), max_eig);
RAS(ref_math_divisible(max_eig, (aspect_ratio * aspect_ratio)),
"AR div zero");
limit_eig = max_eig / (aspect_ratio * aspect_ratio);
ref_matrix_eig(diag_system, 0) =
MAX(ref_matrix_eig(diag_system, 0), limit_eig);
ref_matrix_eig(diag_system, 1) =
MAX(ref_matrix_eig(diag_system, 1), limit_eig);
RSS(ref_matrix_form_m(diag_system, &(metric[6 * node])), "reform m");
RSS(ref_matrix_twod_m(&(metric[6 * node])), "enforce 2D m for roundoff");
}
} else {
each_ref_node_valid_node(ref_grid_node(ref_grid), node) {
RSS(ref_matrix_diag_m(&(metric[6 * node]), diag_system), "eigen decomp");
max_eig = ref_matrix_eig(diag_system, 0);
max_eig = MAX(ref_matrix_eig(diag_system, 1), max_eig);
max_eig = MAX(ref_matrix_eig(diag_system, 2), max_eig);
RAS(ref_math_divisible(max_eig, (aspect_ratio * aspect_ratio)),
"AR div zero");
limit_eig = max_eig / (aspect_ratio * aspect_ratio);
ref_matrix_eig(diag_system, 0) =
MAX(ref_matrix_eig(diag_system, 0), limit_eig);
ref_matrix_eig(diag_system, 1) =
MAX(ref_matrix_eig(diag_system, 1), limit_eig);
ref_matrix_eig(diag_system, 2) =
MAX(ref_matrix_eig(diag_system, 2), limit_eig);
RSS(ref_matrix_form_m(diag_system, &(metric[6 * node])), "reform m");
}
}
return REF_SUCCESS;
}
REF_STATUS ref_metric_limit_h(REF_DBL *metric, REF_GRID ref_grid, REF_DBL hmin,
REF_DBL hmax) {
REF_DBL diag_system[12];
REF_DBL eig;
REF_INT node;
each_ref_node_valid_node(ref_grid_node(ref_grid), node) {
RSS(ref_matrix_diag_m(&(metric[6 * node]), diag_system), "eigen decomp");
if (hmin > 0.0) {
eig = 1.0 / (hmin * hmin);
ref_matrix_eig(diag_system, 0) = MIN(ref_matrix_eig(diag_system, 0), eig);
ref_matrix_eig(diag_system, 1) = MIN(ref_matrix_eig(diag_system, 1), eig);
ref_matrix_eig(diag_system, 2) = MIN(ref_matrix_eig(diag_system, 2), eig);
}
if (hmax > 0.0) {
eig = 1.0 / (hmax * hmax);
ref_matrix_eig(diag_system, 0) = MAX(ref_matrix_eig(diag_system, 0), eig);
ref_matrix_eig(diag_system, 1) = MAX(ref_matrix_eig(diag_system, 1), eig);
ref_matrix_eig(diag_system, 2) = MAX(ref_matrix_eig(diag_system, 2), eig);
}
RSS(ref_matrix_form_m(diag_system, &(metric[6 * node])), "reform m");
}
return REF_SUCCESS;
}
REF_STATUS ref_metric_limit_h_at_complexity(REF_DBL *metric, REF_GRID ref_grid,
REF_DBL hmin, REF_DBL hmax,
REF_DBL target_complexity) {
REF_NODE ref_node = ref_grid_node(ref_grid);
REF_INT i, node, relaxations;
REF_DBL current_complexity;
/* global scaling and h limits */
for (relaxations = 0; relaxations < 10; relaxations++) {
RSS(ref_metric_complexity(metric, ref_grid, ¤t_complexity), "cmp");
if (!ref_math_divisible(target_complexity, current_complexity)) {
return REF_DIV_ZERO;
}
each_ref_node_valid_node(ref_node, node) for (i = 0; i < 6; i++) {
metric[i + 6 * node] *=
pow(target_complexity / current_complexity, 2.0 / 3.0);
}
RSS(ref_metric_limit_h(metric, ref_grid, hmin, hmax), "limit h");
}
return REF_SUCCESS;
}
REF_STATUS ref_metric_buffer(REF_DBL *metric, REF_GRID ref_grid) {
REF_MPI ref_mpi = ref_grid_mpi(ref_grid);
REF_NODE ref_node = ref_grid_node(ref_grid);
REF_DBL diag_system[12];
REF_DBL eig;
REF_INT node;
REF_DBL r, rmax, x, xmax, exponent, hmin, s, t, smin, smax, emin, emax;
xmax = -1.0e-100;
rmax = 0.0;
each_ref_node_valid_node(ref_grid_node(ref_grid), node) {
r = sqrt(ref_node_xyz(ref_node, 0, node) * ref_node_xyz(ref_node, 0, node) +
ref_node_xyz(ref_node, 1, node) * ref_node_xyz(ref_node, 1, node) +
ref_node_xyz(ref_node, 2, node) * ref_node_xyz(ref_node, 2, node));
rmax = MAX(rmax, r);
xmax = MAX(xmax, ref_node_xyz(ref_node, 0, node));
}
r = rmax;
RSS(ref_mpi_max(ref_mpi, &r, &rmax, REF_DBL_TYPE), "mpi max");
RSS(ref_mpi_bcast(ref_mpi, &rmax, 1, REF_DBL_TYPE), "bcast");
x = xmax;
RSS(ref_mpi_max(ref_mpi, &x, &xmax, REF_DBL_TYPE), "mpi max");
RSS(ref_mpi_bcast(ref_mpi, &xmax, 1, REF_DBL_TYPE), "bcast");
each_ref_node_valid_node(ref_grid_node(ref_grid), node) {
RSS(ref_matrix_diag_m(&(metric[6 * node]), diag_system), "eigen decomp");
r = sqrt(ref_node_xyz(ref_node, 0, node) * ref_node_xyz(ref_node, 0, node) +
ref_node_xyz(ref_node, 1, node) * ref_node_xyz(ref_node, 1, node) +
ref_node_xyz(ref_node, 2, node) * ref_node_xyz(ref_node, 2, node));
smin = 0.5;
smax = 0.9;
emin = -4.0;
emax = -1.0;
s = MIN(1.0, r / xmax);
t = MIN(s / smin, 1.0);
exponent = -15.0 * (1.0 - t) + emin * t;
if (smin < s && s < smax) {
t = (s - smin) / (smax - smin);
exponent = (emin) * (1.0 - t) + (emax) * (t);
}
if (smax <= s) {
exponent = emax;
}
hmin = rmax * pow(10.0, exponent);
if (ref_math_divisible(1.0, hmin * hmin)) {
eig = 1.0 / (hmin * hmin);
ref_matrix_eig(diag_system, 0) = MIN(ref_matrix_eig(diag_system, 0), eig);
ref_matrix_eig(diag_system, 1) = MIN(ref_matrix_eig(diag_system, 1), eig);
ref_matrix_eig(diag_system, 2) = MIN(ref_matrix_eig(diag_system, 2), eig);
}
RSS(ref_matrix_form_m(diag_system, &(metric[6 * node])), "reform m");
}
return REF_SUCCESS;
}
REF_STATUS ref_metric_buffer_at_complexity(REF_DBL *metric, REF_GRID ref_grid,
REF_DBL target_complexity) {
REF_NODE ref_node = ref_grid_node(ref_grid);
REF_INT i, node, relaxations;
REF_DBL current_complexity;
/* global scaling and buffer */
for (relaxations = 0; relaxations < 10; relaxations++) {
RSS(ref_metric_buffer(metric, ref_grid), "buffer");
RSS(ref_metric_complexity(metric, ref_grid, ¤t_complexity), "cmp");
if (!ref_math_divisible(target_complexity, current_complexity)) {
return REF_DIV_ZERO;
}
each_ref_node_valid_node(ref_node, node) for (i = 0; i < 6; i++) {
metric[i + 6 * node] *=
pow(target_complexity / current_complexity, 2.0 / 3.0);
}
}
return REF_SUCCESS;
}
REF_STATUS ref_metric_lp(REF_DBL *metric, REF_GRID ref_grid, REF_DBL *scalar,
REF_DBL *weight,
REF_RECON_RECONSTRUCTION reconstruction,
REF_INT p_norm, REF_DBL gradation,
REF_DBL target_complexity) {
RSS(ref_recon_hessian(ref_grid, scalar, metric, reconstruction), "recon");
RSS(ref_recon_roundoff_limit(metric, ref_grid),
"floor metric eigenvalues based on grid size and solution jitter");
RSS(ref_metric_local_scale(metric, weight, ref_grid, p_norm),
"local scale lp norm");
RSS(ref_metric_gradation_at_complexity(metric, ref_grid, gradation,
target_complexity),
"gradation at complexity");
return REF_SUCCESS;
}
REF_STATUS ref_metric_lp_mixed(REF_DBL *metric, REF_GRID ref_grid,
REF_DBL *scalar,
REF_RECON_RECONSTRUCTION reconstruction,
REF_INT p_norm, REF_DBL gradation,
REF_DBL target_complexity) {
RSS(ref_recon_hessian(ref_grid, scalar, metric, reconstruction), "recon");
RSS(ref_recon_roundoff_limit(metric, ref_grid),
"floor metric eigenvalues based on grid size and solution jitter");
RSS(ref_metric_local_scale(metric, NULL, ref_grid, p_norm),
"local scale lp norm");
RSS(ref_metric_gradation_at_complexity_mixed(metric, ref_grid, gradation,
target_complexity),
"gradation at complexity");
return REF_SUCCESS;
}
REF_STATUS ref_metric_multigrad(REF_DBL *metric, REF_GRID ref_grid,
REF_DBL *grad, REF_INT p_norm,
REF_DBL gradation, REF_DBL target_complexity) {
REF_NODE ref_node = ref_grid_node(ref_grid);
REF_INT i, node;
REF_DBL *dsdx, *gradx, *grady, *gradz;
ref_malloc_init(dsdx, ref_node_max(ref_node), REF_DBL, 0.0);
ref_malloc_init(gradx, 3 * ref_node_max(ref_node), REF_DBL, 0.0);
ref_malloc_init(grady, 3 * ref_node_max(ref_node), REF_DBL, 0.0);
ref_malloc_init(gradz, 3 * ref_node_max(ref_node), REF_DBL, 0.0);
i = 0;
each_ref_node_valid_node(ref_node, node) dsdx[node] = grad[i + 3 * node];
RSS(ref_recon_l2_projection_grad(ref_grid, dsdx, gradx), "gradx");
i = 1;
each_ref_node_valid_node(ref_node, node) dsdx[node] = grad[i + 3 * node];
RSS(ref_recon_l2_projection_grad(ref_grid, dsdx, grady), "grady");
i = 2;
each_ref_node_valid_node(ref_node, node) dsdx[node] = grad[i + 3 * node];
RSS(ref_recon_l2_projection_grad(ref_grid, dsdx, gradz), "gradz");
/* average off-diagonals */
each_ref_node_valid_node(ref_node, node) {
metric[0 + 6 * node] = gradx[0 + 3 * node];
metric[1 + 6 * node] = 0.5 * (gradx[1 + 3 * node] + grady[0 + 3 * node]);
metric[2 + 6 * node] = 0.5 * (gradx[2 + 3 * node] + gradz[0 + 3 * node]);
metric[3 + 6 * node] = grady[1 + 3 * node];
metric[4 + 6 * node] = 0.5 * (grady[2 + 3 * node] + gradz[1 + 3 * node]);
metric[5 + 6 * node] = gradz[2 + 3 * node];
}
ref_free(gradz);
ref_free(grady);
ref_free(gradx);
ref_free(dsdx);
RSS(ref_recon_abs_value_hessian(ref_grid, metric), "abs");
RSS(ref_recon_roundoff_limit(metric, ref_grid),
"floor metric eigenvalues based on grid size and solution jitter");
RSS(ref_metric_local_scale(metric, NULL, ref_grid, p_norm),
"local scale lp norm");
RSS(ref_metric_gradation_at_complexity(metric, ref_grid, gradation,
target_complexity),
"gradation at complexity");
return REF_SUCCESS;
}
REF_STATUS ref_metric_moving_multiscale(REF_DBL *metric, REF_GRID ref_grid,
REF_DBL *displaced, REF_DBL *scalar,
REF_RECON_RECONSTRUCTION reconstruction,
REF_INT p_norm, REF_DBL gradation,
REF_DBL complexity) {
REF_NODE ref_node = ref_grid_node(ref_grid);
REF_DBL *jac, *x, *grad, *hess, *xyz, det;
REF_INT i, j, node;
ref_malloc(hess, 6 * ref_node_max(ref_grid_node(ref_grid)), REF_DBL);
ref_malloc(jac, 9 * ref_node_max(ref_grid_node(ref_grid)), REF_DBL);
ref_malloc(x, ref_node_max(ref_grid_node(ref_grid)), REF_DBL);
ref_malloc(grad, 3 * ref_node_max(ref_grid_node(ref_grid)), REF_DBL);
for (j = 0; j < 3; j++) {
each_ref_node_valid_node(ref_grid_node(ref_grid), node) {
x[node] = displaced[j + 3 * node];
}
RSS(ref_recon_gradient(ref_grid, x, grad, reconstruction), "recon x");
if (ref_grid_twod(ref_grid)) {
each_ref_node_valid_node(ref_grid_node(ref_grid), node) {
grad[2 + 3 * node] = 1.0;
}
}
each_ref_node_valid_node(ref_grid_node(ref_grid), node) {
for (i = 0; i < 3; i++) {
jac[i + 3 * j + 9 * node] = grad[i + 3 * node];
}
}
}
ref_free(grad);
ref_free(x);
ref_malloc(xyz, 3 * ref_node_max(ref_grid_node(ref_grid)), REF_DBL);
each_ref_node_valid_node(ref_grid_node(ref_grid), node) {
for (i = 0; i < 3; i++) {
xyz[i + 3 * node] = ref_node_xyz(ref_node, i, node);
ref_node_xyz(ref_node, i, node) = displaced[i + 3 * node];
}
}
RSS(ref_recon_hessian(ref_grid, scalar, hess, reconstruction), "recon");
each_ref_node_valid_node(ref_grid_node(ref_grid), node) {
for (i = 0; i < 3; i++) {
ref_node_xyz(ref_node, i, node) = xyz[i + 3 * node];
}
}
ref_free(xyz);
RSS(ref_recon_roundoff_limit(hess, ref_grid),
"floor metric eigenvalues based on grid size and solution jitter");
each_ref_node_valid_node(ref_grid_node(ref_grid), node) {
RSS(ref_matrix_jac_m_jact(&(jac[9 * node]), &(hess[6 * node]),
&(metric[6 * node])),
"J M J^t");
RSS(ref_matrix_det_gen(3, &(jac[9 * node]), &det), "gen det");
for (i = 0; i < 6; i++) {
metric[i + 6 * node] *= pow(ABS(det), 1.0 / (REF_DBL)p_norm);
}
}
ref_free(jac);
ref_free(hess);
RSS(ref_metric_local_scale(metric, NULL, ref_grid, p_norm),
"local scale lp norm");
RSS(ref_metric_gradation_at_complexity(metric, ref_grid, gradation,
complexity),
"gradation at complexity");
return REF_SUCCESS;
}
REF_STATUS ref_metric_eig_bal(REF_DBL *metric, REF_GRID ref_grid,
REF_DBL *scalar,
REF_RECON_RECONSTRUCTION reconstruction,
REF_INT p_norm, REF_DBL gradation,
REF_DBL target_complexity) {
RSS(ref_recon_hessian(ref_grid, scalar, metric, reconstruction), "recon");
RSS(ref_recon_roundoff_limit(metric, ref_grid),
"floor metric eigenvalues based on grid size and solution jitter");
RSS(ref_metric_histogram(metric, ref_grid, "hess.tec"), "histogram");
RSS(ref_metric_local_scale(metric, NULL, ref_grid, p_norm),
"local scale lp norm");
RSS(ref_metric_gradation_at_complexity(metric, ref_grid, gradation,
target_complexity),
"gradation at complexity");
return REF_SUCCESS;
}
REF_STATUS ref_metric_local_scale(REF_DBL *metric, REF_DBL *weight,
REF_GRID ref_grid, REF_INT p_norm) {
REF_NODE ref_node = ref_grid_node(ref_grid);
REF_INT i, node;
REF_INT dimension;
REF_DBL det, exponent;
dimension = 3;
if (ref_grid_twod(ref_grid)) {
dimension = 2;
}
if (ref_grid_twod(ref_grid)) {
each_ref_node_valid_node(ref_node, node) {
metric[2 + 6 * node] = 0.0;
metric[4 + 6 * node] = 0.0;
metric[5 + 6 * node] = 1.0;
}
}
/* local scaling */
exponent = -1.0 / ((REF_DBL)(2 * p_norm + dimension));
each_ref_node_valid_node(ref_node, node) {
RSS(ref_matrix_det_m(&(metric[6 * node]), &det), "det_m local hess scale");
if (det > 0.0) {
for (i = 0; i < 6; i++) metric[i + 6 * node] *= pow(det, exponent);
}
}
if (ref_grid_twod(ref_grid)) {
each_ref_node_valid_node(ref_node, node) {
metric[2 + 6 * node] = 0.0;
metric[4 + 6 * node] = 0.0;
metric[5 + 6 * node] = 1.0;
}
}
/* weight in now length scale, convert to eigenvalue */
if (NULL != weight) {
each_ref_node_valid_node(ref_node, node) {
if (weight[node] > 0.0) {
for (i = 0; i < 6; i++)
metric[i + 6 * node] /= (weight[node] * weight[node]);
}
}
}
return REF_SUCCESS;
}
REF_STATUS ref_metric_opt_goal(REF_DBL *metric, REF_GRID ref_grid,
REF_INT nequations, REF_DBL *solution,
REF_RECON_RECONSTRUCTION reconstruction,
REF_INT p_norm, REF_DBL gradation,
REF_DBL target_complexity) {
REF_NODE ref_node = ref_grid_node(ref_grid);
REF_INT i, node;
REF_INT ldim;
REF_INT var, dir;
ldim = 4 * nequations;
each_ref_node_valid_node(ref_node, node) {
for (i = 0; i < 6; i++) metric[i + 6 * node] = 0.0;
}
for (var = 0; var < nequations; var++) {
REF_DBL *lam, *grad_lam, *flux, *hess_flux;
ref_malloc_init(lam, ref_node_max(ref_node), REF_DBL, 0.0);
ref_malloc_init(grad_lam, 3 * ref_node_max(ref_node), REF_DBL, 0.0);
ref_malloc_init(flux, ref_node_max(ref_node), REF_DBL, 0.0);
ref_malloc_init(hess_flux, 6 * ref_node_max(ref_node), REF_DBL, 0.0);
each_ref_node_valid_node(ref_node, node) {
lam[node] = solution[var + ldim * node];
}
RSS(ref_recon_gradient(ref_grid, lam, grad_lam, reconstruction),
"grad_lam");
for (dir = 0; dir < 3; dir++) {
each_ref_node_valid_node(ref_node, node) {
flux[node] = solution[var + nequations * (1 + dir) + ldim * node];
}
RSS(ref_recon_hessian(ref_grid, flux, hess_flux, reconstruction), "hess");
each_ref_node_valid_node(ref_node, node) {
for (i = 0; i < 6; i++)
metric[i + 6 * node] +=
ABS(grad_lam[dir + 3 * node]) * hess_flux[i + 6 * node];
}
}
ref_free(hess_flux);
ref_free(flux);
ref_free(grad_lam);
ref_free(lam);
}
if (ref_grid_twod(ref_grid)) {
each_ref_node_valid_node(ref_node, node) {
metric[2 + 6 * node] = 0.0;
metric[4 + 6 * node] = 0.0;
metric[5 + 6 * node] = 1.0;
}
}
RSS(ref_recon_roundoff_limit(metric, ref_grid),
"floor metric eigenvalues based on grid size and solution jitter");
RSS(ref_metric_local_scale(metric, NULL, ref_grid, p_norm),
"local scale lp norm");
RSS(ref_metric_gradation_at_complexity(metric, ref_grid, gradation,
target_complexity),
"gradation at complexity");
return REF_SUCCESS;
}
REF_STATUS ref_metric_belme_gfe(REF_DBL *metric, REF_GRID ref_grid,
REF_INT ldim, REF_DBL *prim_dual,
REF_RECON_RECONSTRUCTION reconstruction) {
REF_NODE ref_node = ref_grid_node(ref_grid);
REF_INT var, dir, node, i;
REF_INT nequ;
REF_DBL state[5], node_flux[5], direction[3];
REF_DBL *lam, *grad_lam, *flux, *hess_flux;
ref_malloc_init(lam, ref_node_max(ref_node), REF_DBL, 0.0);
ref_malloc_init(grad_lam, 3 * ref_node_max(ref_node), REF_DBL, 0.0);
ref_malloc_init(flux, ref_node_max(ref_node), REF_DBL, 0.0);
ref_malloc_init(hess_flux, 6 * ref_node_max(ref_node), REF_DBL, 0.0);
nequ = ldim / 2;
for (var = 0; var < 5; var++) {
each_ref_node_valid_node(ref_node, node) {
lam[node] = prim_dual[var + 1 * nequ + ldim * node];
}
RSS(ref_recon_gradient(ref_grid, lam, grad_lam, reconstruction),
"grad_lam");
for (dir = 0; dir < 3; dir++) {
each_ref_node_valid_node(ref_node, node) {
direction[0] = 0.0;
direction[1] = 0.0;
direction[2] = 0.0;
direction[dir] = 1.0;
for (i = 0; i < 5; i++) {
state[i] = prim_dual[i + 0 * nequ + ldim * node];
}
RSS(ref_phys_euler(state, direction, node_flux), "euler");
flux[node] = node_flux[var];
}
RSS(ref_recon_hessian(ref_grid, flux, hess_flux, reconstruction), "hess");
each_ref_node_valid_node(ref_node, node) {
for (i = 0; i < 6; i++) {
metric[i + 6 * node] +=
ABS(grad_lam[dir + 3 * node]) * hess_flux[i + 6 * node];
}
}
}
}
each_ref_node_valid_node(ref_node, node) {
RSS(ref_matrix_healthy_m(&(metric[6 * node])), "euler-opt-goal");
}
ref_free(hess_flux);
ref_free(flux);
ref_free(grad_lam);
ref_free(lam);
return REF_SUCCESS;
}
REF_STATUS ref_metric_belme_gu(REF_DBL *metric, REF_GRID ref_grid, REF_INT ldim,
REF_DBL *prim_dual, REF_DBL mach, REF_DBL re,
REF_DBL reference_temp,
REF_RECON_RECONSTRUCTION reconstruction) {
REF_NODE ref_node = ref_grid_node(ref_grid);
REF_INT var, node, i, dir;
REF_INT nequ;
REF_DBL *lam, *hess_lam, *grad_lam, *sr_lam, *u, *hess_u, *grad_u;
REF_DBL *omega;
REF_DBL u1, u2, u3;
REF_DBL w1, w2, w3;
REF_DBL diag_system[12];
REF_DBL weight;
REF_DBL gamma = 1.4;
REF_DBL sutherland_constant = 110.56;
REF_DBL sutherland_temp;
REF_DBL t, mu;
REF_DBL pr = 0.72;
REF_DBL turbulent_pr = 0.90;
REF_DBL thermal_conductivity;
REF_DBL rho, turb, mu_t;
nequ = ldim / 2;
ref_malloc_init(lam, ref_node_max(ref_node), REF_DBL, 0.0);
ref_malloc_init(hess_lam, 6 * ref_node_max(ref_node), REF_DBL, 0.0);
ref_malloc_init(grad_lam, 3 * ref_node_max(ref_node), REF_DBL, 0.0);
ref_malloc_init(sr_lam, 5 * ref_node_max(ref_node), REF_DBL, 0.0);
ref_malloc_init(u, ref_node_max(ref_node), REF_DBL, 0.0);
ref_malloc_init(hess_u, 6 * ref_node_max(ref_node), REF_DBL, 0.0);
ref_malloc_init(grad_u, 3 * ref_node_max(ref_node), REF_DBL, 0.0);
ref_malloc_init(omega, 9 * ref_node_max(ref_node), REF_DBL, 0.0);
for (var = 0; var < 5; var++) {
each_ref_node_valid_node(ref_node, node) {
lam[node] = prim_dual[var + 1 * nequ + ldim * node];
}
RSS(ref_recon_hessian(ref_grid, lam, hess_lam, reconstruction), "hess_lam");
each_ref_node_valid_node(ref_node, node) {
RSS(ref_matrix_diag_m(&(hess_lam[6 * node]), diag_system), "decomp");
sr_lam[var + 5 * node] = MAX(MAX(ABS(ref_matrix_eig(diag_system, 0)),
ABS(ref_matrix_eig(diag_system, 1))),
ABS(ref_matrix_eig(diag_system, 2)));
}
} /* SR MAX (eig, min(1e-30*max(det^-1/3)) for all lambda of var */
var = 4;
each_ref_node_valid_node(ref_node, node) {
lam[node] = prim_dual[var + 1 * nequ + ldim * node];
}
RSS(ref_recon_gradient(ref_grid, lam, grad_lam, reconstruction), "grad_u");
for (dir = 0; dir < 3; dir++) {
var = 1 + dir;
each_ref_node_valid_node(ref_node, node) {
u[node] = prim_dual[var + 0 * nequ + ldim * node];
}
RSS(ref_recon_gradient(ref_grid, u, grad_u, reconstruction), "grad_u");
each_ref_node_valid_node(ref_node, node) {
ref_math_cross_product(&(grad_u[3 * node]), &(grad_lam[3 * node]),
&(omega[3 * dir + 9 * node]));
}
}
var = 1;
w1 = 20.0;
w2 = 2.0;
w3 = 2.0;
each_ref_node_valid_node(ref_node, node) {
u[node] = prim_dual[var + 0 * nequ + ldim * node];
}
RSS(ref_recon_hessian(ref_grid, u, hess_u, reconstruction), "hess_u");
each_ref_node_valid_node(ref_node, node) {
u1 = ABS(prim_dual[1 + ldim * node]);
u2 = ABS(prim_dual[2 + ldim * node]);
u3 = ABS(prim_dual[3 + ldim * node]);
weight = 0.0;
weight += w1 * sr_lam[1 + 5 * node];
weight += w2 * sr_lam[2 + 5 * node];
weight += w3 * sr_lam[3 + 5 * node];
weight += (w1 * u1 + w2 * u2 + w3 * u3) * sr_lam[4 + 5 * node];
weight += (5.0 / 3.0) *
ABS(omega[1 + 2 * 3 + 9 * node] - omega[2 + 1 * 3 + 9 * node]);
t = gamma * prim_dual[4 + ldim * node] / prim_dual[0 + ldim * node];
mu = 1.0;
if (reference_temp > 0.0) {
sutherland_temp = sutherland_constant / reference_temp;
mu = (1.0 + sutherland_temp) / (t + sutherland_temp) * t * sqrt(t);
}
if (6 == nequ) {
rho = prim_dual[0 + ldim * node];
turb = prim_dual[5 + ldim * node];
RSS(ref_phys_mut_sa(turb, rho, mu / rho, &mu_t), "eddy viscosity");
mu += mu_t;
}
weight *= mach / re * mu;
RAS(weight >= 0.0, "negative weight u1");
for (i = 0; i < 6; i++) {
metric[i + 6 * node] += weight * hess_u[i + 6 * node];
}
RSS(ref_matrix_healthy_m(&(metric[6 * node])), "u1");
}
var = 2;
w1 = 2.0;
w2 = 20.0;
w3 = 2.0;
each_ref_node_valid_node(ref_node, node) {
u[node] = prim_dual[var + ldim * node];
}
RSS(ref_recon_hessian(ref_grid, u, hess_u, reconstruction), "hess_u");
each_ref_node_valid_node(ref_node, node) {
u1 = ABS(prim_dual[1 + ldim * node]);
u2 = ABS(prim_dual[2 + ldim * node]);
u3 = ABS(prim_dual[3 + ldim * node]);
weight = 0.0;
weight += w1 * sr_lam[1 + 5 * node];
weight += w2 * sr_lam[2 + 5 * node];
weight += w3 * sr_lam[3 + 5 * node];
weight += (w1 * u1 + w2 * u2 + w3 * u3) * sr_lam[4 + 5 * node];
weight += (5.0 / 3.0) *
ABS(omega[2 + 0 * 3 + 9 * node] - omega[0 + 2 * 3 + 9 * node]);
t = gamma * prim_dual[4 + ldim * node] / prim_dual[0 + ldim * node];
mu = 1.0;
if (reference_temp > 0.0) {
sutherland_temp = sutherland_constant / reference_temp;
mu = (1.0 + sutherland_temp) / (t + sutherland_temp) * t * sqrt(t);
}
if (6 == nequ) {
rho = prim_dual[0 + ldim * node];
turb = prim_dual[5 + ldim * node];
RSS(ref_phys_mut_sa(turb, rho, mu / rho, &mu_t), "eddy viscosity");
mu += mu_t;
}
weight *= mach / re * mu;
RAS(weight >= 0.0, "negative weight u2");
for (i = 0; i < 6; i++) {
metric[i + 6 * node] += weight * hess_u[i + 6 * node];
}
RSS(ref_matrix_healthy_m(&(metric[6 * node])), "u2");
}
var = 3;
w1 = 2.0;
w2 = 2.0;
w3 = 20.0;
each_ref_node_valid_node(ref_node, node) {
u[node] = prim_dual[var + ldim * node];
}
RSS(ref_recon_hessian(ref_grid, u, hess_u, reconstruction), "hess_u");
each_ref_node_valid_node(ref_node, node) {
u1 = ABS(prim_dual[1 + ldim * node]);
u2 = ABS(prim_dual[2 + ldim * node]);
u3 = ABS(prim_dual[3 + ldim * node]);
weight = 0.0;
weight += w1 * sr_lam[1 + 5 * node];
weight += w2 * sr_lam[2 + 5 * node];
weight += w3 * sr_lam[3 + 5 * node];
weight += (w1 * u1 + w2 * u2 + w3 * u3) * sr_lam[4 + 5 * node];
weight += (5.0 / 3.0) *
ABS(omega[0 + 1 * 3 + 9 * node] - omega[1 + 0 * 3 + 9 * node]);
t = gamma * prim_dual[4 + ldim * node] / prim_dual[0 + ldim * node];
mu = 1.0;
if (reference_temp > 0.0) {
sutherland_temp = sutherland_constant / reference_temp;
mu = (1.0 + sutherland_temp) / (t + sutherland_temp) * t * sqrt(t);
}
if (6 == nequ) {
rho = prim_dual[0 + ldim * node];
turb = prim_dual[5 + ldim * node];
RSS(ref_phys_mut_sa(turb, rho, mu / rho, &mu_t), "eddy viscosity");
mu += mu_t;
}
weight *= mach / re * mu;
RAS(weight >= 0.0, "negative weight u2");
for (i = 0; i < 6; i++) {
metric[i + 6 * node] += weight * hess_u[i + 6 * node];
}
RSS(ref_matrix_healthy_m(&(metric[6 * node])), "u3");
}
each_ref_node_valid_node(ref_node, node) {
t = gamma * prim_dual[4 + ldim * node] / prim_dual[0 + ldim * node];
u[node] = t;
}
RSS(ref_recon_hessian(ref_grid, u, hess_u, reconstruction), "hess_u");
each_ref_node_valid_node(ref_node, node) {
t = gamma * prim_dual[4 + ldim * node] / prim_dual[0 + ldim * node];
mu = 1.0;
if (reference_temp > 0.0) {
sutherland_temp = sutherland_constant / reference_temp;
mu = (1.0 + sutherland_temp) / (t + sutherland_temp) * t * sqrt(t);
}
thermal_conductivity = mu / (pr * (gamma - 1.0));
if (6 == nequ) {
rho = prim_dual[0 + ldim * node];
turb = prim_dual[5 + ldim * node];
RSS(ref_phys_mut_sa(turb, rho, mu / rho, &mu_t), "eddy viscosity");
thermal_conductivity =
(mu / (pr * (gamma - 1.0)) + mu_t / (turbulent_pr * (gamma - 1.0)));
mu += mu_t;
}
for (i = 0; i < 6; i++) {
metric[i + 6 * node] += 18.0 * mach / re * thermal_conductivity *
sr_lam[4 + 5 * node] * hess_u[i + 6 * node];
}
}
ref_free(omega);
ref_free(grad_u);
ref_free(hess_u);
ref_free(u);
ref_free(sr_lam);
ref_free(grad_lam);
ref_free(hess_lam);
ref_free(lam);
return REF_SUCCESS;
}
REF_STATUS ref_metric_cons_euler_g(REF_DBL *g, REF_GRID ref_grid, REF_INT ldim,
REF_DBL *prim_dual,
REF_RECON_RECONSTRUCTION reconstruction) {
REF_NODE ref_node = ref_grid_node(ref_grid);
REF_INT var, dir, node, i;
REF_INT nequ;
REF_DBL state[5], dflux_dcons[25], direction[3];
REF_DBL *lam, *grad_lam;
REF_BOOL debug_export = REF_FALSE;
nequ = ldim / 2;
ref_malloc_init(lam, ref_node_max(ref_node), REF_DBL, 0.0);
ref_malloc_init(grad_lam, 3 * ref_node_max(ref_node), REF_DBL, 0.0);
for (var = 0; var < 5; var++) {
each_ref_node_valid_node(ref_node, node) {
lam[node] = prim_dual[var + 1 * nequ + ldim * node];
}
RSS(ref_recon_gradient(ref_grid, lam, grad_lam, reconstruction),
"grad_lam");
for (dir = 0; dir < 3; dir++) {
each_ref_node_valid_node(ref_node, node) {
direction[0] = 0.0;
direction[1] = 0.0;
direction[2] = 0.0;
direction[dir] = 1.0;
for (i = 0; i < 5; i++) {
state[i] = prim_dual[i + 0 * nequ + ldim * node];
}
RSS(ref_phys_euler_jac(state, direction, dflux_dcons), "euler");
for (i = 0; i < 5; i++) {
g[i + 5 * node] +=
dflux_dcons[var + i * 5] * grad_lam[dir + 3 * node];
}
}
}
if (debug_export) {
char filename[20];
sprintf(filename, "gradlam%d.tec", var);
ref_gather_scalar_by_extension(ref_grid, 3, grad_lam, NULL, filename);
}
}
ref_free(grad_lam);
ref_free(lam);
if (debug_export) {
RSS(ref_gather_scalar_by_extension(ref_grid, 5, g, NULL, "g.tec"),
"dump g");
}
return REF_SUCCESS;
}
REF_STATUS ref_metric_cons_viscous_g(REF_DBL *g, REF_GRID ref_grid,
REF_INT ldim, REF_DBL *prim_dual,
REF_DBL mach, REF_DBL re,
REF_DBL reference_temp,
REF_RECON_RECONSTRUCTION reconstruction) {
REF_NODE ref_node = ref_grid_node(ref_grid);
REF_INT var, node;
REF_INT nequ;
REF_DBL *lam, *rhou1star, *rhou2star, *rhou3star, *rhoestar;
REF_DBL gamma = 1.4;
REF_DBL sutherland_constant = 110.56;
REF_DBL sutherland_temp;
REF_DBL t, mu, u1, u2, u3, q2, e;
REF_DBL pr = 0.72;
REF_DBL turbulent_pr = 0.90;
REF_DBL thermal_conductivity;
REF_DBL rho, turb, mu_t;
REF_DBL frhou1, frhou2, frhou3, frhoe;
REF_INT xx = 0, xy = 1, xz = 2, yy = 3, yz = 4, zz = 5;
nequ = ldim / 2;
ref_malloc_init(rhou1star, 6 * ref_node_max(ref_node), REF_DBL, 0.0);
ref_malloc_init(rhou2star, 6 * ref_node_max(ref_node), REF_DBL, 0.0);
ref_malloc_init(rhou3star, 6 * ref_node_max(ref_node), REF_DBL, 0.0);
ref_malloc_init(rhoestar, 6 * ref_node_max(ref_node), REF_DBL, 0.0);
ref_malloc_init(lam, ref_node_max(ref_node), REF_DBL, 0.0);
var = 1;
each_ref_node_valid_node(ref_node, node) {
lam[node] = prim_dual[var + 1 * nequ + ldim * node];
}
RSS(ref_recon_signed_hessian(ref_grid, lam, rhou1star, reconstruction), "h1");
var = 2;
each_ref_node_valid_node(ref_node, node) {
lam[node] = prim_dual[var + 1 * nequ + ldim * node];
}
RSS(ref_recon_signed_hessian(ref_grid, lam, rhou2star, reconstruction), "h2");
var = 3;
each_ref_node_valid_node(ref_node, node) {
lam[node] = prim_dual[var + 1 * nequ + ldim * node];
}
RSS(ref_recon_signed_hessian(ref_grid, lam, rhou3star, reconstruction), "h3");
var = 4;
each_ref_node_valid_node(ref_node, node) {
lam[node] = prim_dual[var + 1 * nequ + ldim * node];
}
RSS(ref_recon_signed_hessian(ref_grid, lam, rhoestar, reconstruction), "h4");
ref_free(lam);
each_ref_node_valid_node(ref_node, node) {
rho = prim_dual[0 + ldim * node];
u1 = prim_dual[1 + ldim * node];
u2 = prim_dual[2 + ldim * node];
u3 = prim_dual[3 + ldim * node];
q2 = u1 * u1 + u2 * u2 + u3 * u3;
e = prim_dual[4 + ldim * node] / (gamma - 1.0) + 0.5 * rho * q2;
t = gamma * prim_dual[4 + ldim * node] / prim_dual[0 + ldim * node];
mu = 1.0;
if (reference_temp > 0.0) {
sutherland_temp = sutherland_constant / reference_temp;
mu = (1.0 + sutherland_temp) / (t + sutherland_temp) * t * sqrt(t);
}
thermal_conductivity = mu / (pr * (gamma - 1.0));
if (6 == nequ) {
turb = prim_dual[5 + ldim * node];
RSS(ref_phys_mut_sa(turb, rho, mu / rho, &mu_t), "eddy viscosity");
thermal_conductivity =
(mu / (pr * (gamma - 1.0)) + mu_t / (turbulent_pr * (gamma - 1.0)));
mu += mu_t;
}
mu *= mach / re;
thermal_conductivity *= mach / re;
frhou1 = 4.0 * rhou1star[xx + 6 * node] + 3.0 * rhou1star[yy + 6 * node] +
3.0 * rhou1star[zz + 6 * node] + rhou2star[xy + 6 * node] +
rhou3star[xz + 6 * node];
frhou1 += 4.0 * u1 * rhoestar[xx + 6 * node] +
3.0 * u1 * rhoestar[yy + 6 * node] +
3.0 * u1 * rhoestar[zz + 6 * node] +
u2 * rhoestar[xy + 6 * node] + u3 * rhoestar[xz + 6 * node];
frhou1 *= (1.0 / 3.0) * mu / rho;
frhou2 = rhou1star[xy + 6 * node] + 3.0 * rhou2star[xx + 6 * node] +
4.0 * rhou2star[yy + 6 * node] + 3.0 * rhou2star[zz + 6 * node] +
rhou3star[yz + 6 * node];
frhou2 += u1 * rhoestar[xy + 6 * node] +
3.0 * u2 * rhoestar[xx + 6 * node] +
4.0 * u2 * rhoestar[yy + 6 * node] +
3.0 * u2 * rhoestar[zz + 6 * node] + u3 * rhoestar[yz + 6 * node];
frhou2 *= (1.0 / 3.0) * mu / rho;
frhou3 = rhou1star[xz + 6 * node] + rhou2star[yz + 6 * node] +
3.0 * rhou3star[xx + 6 * node] + 3.0 * rhou3star[yy + 6 * node] +
4.0 * rhou3star[zz + 6 * node];
frhou3 += u1 * rhoestar[xz + 6 * node] + u2 * rhoestar[yz + 6 * node] +
3.0 * u3 * rhoestar[xx + 6 * node] +
3.0 * u3 * rhoestar[yy + 6 * node] +
4.0 * u3 * rhoestar[zz + 6 * node];
frhou3 *= (1.0 / 3.0) * mu / rho;
frhoe = rhoestar[xx + 6 * node] + rhoestar[yy + 6 * node] +
rhoestar[zz + 6 * node];
frhoe *= thermal_conductivity / rho;
/* fun3d e has density in it */
g[0 + 5 * node] +=
-u1 * frhou1 - u2 * frhou2 - u3 * frhou3 + (q2 - e / rho) * frhoe;
g[1 + 5 * node] += frhou1 - u1 * frhoe;
g[2 + 5 * node] += frhou2 - u2 * frhoe;
g[3 + 5 * node] += frhou3 - u3 * frhoe;
g[4 + 5 * node] += frhoe;
}
ref_free(rhoestar);
ref_free(rhou3star);
ref_free(rhou2star);
ref_free(rhou1star);
return REF_SUCCESS;
}
REF_STATUS ref_metric_cons_assembly(REF_DBL *metric, REF_DBL *g,
REF_GRID ref_grid, REF_INT ldim,
REF_DBL *prim_dual,
REF_RECON_RECONSTRUCTION reconstruction) {
REF_NODE ref_node = ref_grid_node(ref_grid);
REF_INT var, node, i;
REF_DBL state[5], conserved[5];
REF_DBL *cons, *hess_cons;
ref_malloc_init(cons, ref_node_max(ref_node), REF_DBL, 0.0);
ref_malloc_init(hess_cons, 6 * ref_node_max(ref_node), REF_DBL, 0.0);
for (var = 0; var < 5; var++) {
each_ref_node_valid_node(ref_node, node) {
for (i = 0; i < 5; i++) {
state[i] = prim_dual[i + ldim * node];
}
RSS(ref_phys_make_conserved(state, conserved), "prim2cons");
cons[node] = conserved[var];
}
RSS(ref_recon_hessian(ref_grid, cons, hess_cons, reconstruction), "hess");
each_ref_node_valid_node(ref_node, node) {
for (i = 0; i < 6; i++) {
metric[i + 6 * node] +=
ABS(g[var + 5 * node]) * hess_cons[i + 6 * node];
RAS(isfinite(ABS(g[var + 5 * node])), "g not finite");
RAS(isfinite(hess_cons[i + 6 * node]), "hess not finite");
RAS(isfinite(metric[i + 6 * node]), "metric not finite");
}
}
}
ref_free(hess_cons);
ref_free(cons);
return REF_SUCCESS;
}
REF_STATUS ref_metric_histogram(REF_DBL *metric, REF_GRID ref_grid,
const char *filename) {
REF_NODE ref_node = ref_grid_node(ref_grid);
REF_DBL *eig, diag_system[12];
REF_INT i, node, n, *sorted_index;
FILE *file;
ref_malloc_init(eig, ref_node_n(ref_node), REF_DBL, 0.0);
ref_malloc_init(sorted_index, ref_node_n(ref_node), REF_INT, REF_EMPTY);
n = 0;
each_ref_node_valid_node(ref_node, node) {
RSS(ref_matrix_diag_m(&(metric[6 * node]), diag_system), "decomp");
eig[n] = MAX(MAX(ABS(ref_matrix_eig(diag_system, 0)),
ABS(ref_matrix_eig(diag_system, 1))),
ABS(ref_matrix_eig(diag_system, 2)));
n++;
}
REIS(ref_node_n(ref_node), n, "node count");
RSS(ref_sort_heap_dbl(n, eig, sorted_index), "sort");
file = fopen(filename, "w");
if (NULL == (void *)file) printf("unable to open %s\n", filename);
RNS(file, "unable to open file");
fprintf(file, "title=\"tecplot ordered max eig\"\n");
fprintf(file, "variables = \"i\" \"e\"\n");
fprintf(file, "zone t=\"eig\"\n");
for (i = 0; i < n; i++) {
fprintf(file, "%d %e\n", i, eig[sorted_index[i]]);
}
fclose(file);
ref_free(sorted_index);
ref_free(eig);
return REF_SUCCESS;
}
/*
* h2 ----
* h1 /----
* h0 ---/
* 0 s1 s2
*/
REF_STATUS ref_metric_step_exp(REF_DBL s, REF_DBL *h, REF_DBL h0, REF_DBL h1,
REF_DBL h2, REF_DBL s1, REF_DBL s2,
REF_DBL width) {
REF_DBL blend, x, e;
blend = 0.5 * (1.0 + tanh((s - s1) / width));
x = (s - s1) / (s2 - s1);
e = h1 + (h2 - h1) * (exp(x) - 1.0) / (exp(1.0) - 1.0);
*h = (1.0 - blend) * h0 + (blend)*e;
/* printf("s %f blend %f x %f e %f h %f\n",s,blend,x,e,*h); */
return REF_SUCCESS;
}
/*
@article{barbier-galin-fast-dist-cyl-cone-swept-sphere,
author = {Aurelien Barbier and Eric Galin},
title = {Fast Distance Computation Between a Point and
Cylinders, Cones, Line-Swept Spheres and Cone-Spheres},
journal = {Journal of Graphics Tools},
volume = 9,
number = 2,
pages = {11--19},
year = 2004,
publisher = {Taylor & Francis},
doi = {10.1080/10867651.2004.10504892}
} % https://liris.cnrs.fr/Documents/Liris-1297.pdf
*/
static void ref_metric_tattle_truncated_cone_dist(REF_DBL *cone_geom,
REF_DBL *p) {
printf("p %.18e %.18e %.18e\n", p[0], p[1], p[2]);
printf("x1 %.18e %.18e %.18e\n", cone_geom[0], cone_geom[1], cone_geom[2]);
printf("x2 %.18e %.18e %.18e\n", cone_geom[3], cone_geom[4], cone_geom[5]);
printf("r1 %.18e r2 %.18e\n", cone_geom[6], cone_geom[7]);
}
REF_STATUS ref_metric_truncated_cone_dist(REF_DBL *cone_geom, REF_DBL *p,
REF_DBL *dist) {
REF_INT d;
REF_DBL a[3], b[3], ba[3], u[3], pa[3], l, x, y, y2, n, ra, rb, delta, s;
REF_DBL xprime, yprime;
REF_BOOL verbose = REF_FALSE;
if (verbose) printf("\np %f %f %f\n", p[0], p[1], p[2]);
if (ABS(cone_geom[6]) >= ABS(cone_geom[7])) {
ra = ABS(cone_geom[6]);
rb = ABS(cone_geom[7]);
for (d = 0; d < 3; d++) {
a[d] = cone_geom[d];
b[d] = cone_geom[d + 3];
}
if (verbose) printf("forward ra %f rb %f\n", ra, rb);
} else {
ra = ABS(cone_geom[7]);
rb = ABS(cone_geom[6]);
for (d = 0; d < 3; d++) {
a[d] = cone_geom[d + 3];
b[d] = cone_geom[d];
}
if (verbose) printf("reverse ra %f rb %f\n", ra, rb);
}
if (verbose) printf("a %f %f %f\n", a[0], a[1], a[2]);
if (verbose) printf("b %f %f %f\n", b[0], b[1], b[2]);
for (d = 0; d < 3; d++) {
ba[d] = b[d] - a[d];
u[d] = ba[d];
pa[d] = p[d] - a[d]; /* direction flip, error in paper? */
}
l = sqrt(ref_math_dot(ba, ba));
if (!ref_math_divisible(u[0], l) || !ref_math_divisible(u[1], l) ||
!ref_math_divisible(u[2], l)) { /* assume sphere */
REF_DBL r;
r = sqrt(pa[0] * pa[0] + pa[1] * pa[1] + pa[2] * pa[2]);
*dist = MAX(0, r - MAX(ra, rb));
return REF_SUCCESS;
}
RSB(ref_math_normalize(u), "axis length zero",
{ ref_metric_tattle_truncated_cone_dist(cone_geom, p); });
x = ref_math_dot(pa, u); /* sign flip, error in paper? */
n = sqrt(ref_math_dot(pa, pa));
y2 = n * n - x * x;
if (verbose) printf("n2 %f x2 %f y2 %f\n", n * n, x * x, y2);
if (y2 <= 0) {
y = 0;
} else {
y = sqrt(y2);
}
if (verbose) printf("x %f y %f l %f\n", x, y, l);
if (x < 0) {
if (y2 < ra * ra) {
*dist = -x;
return REF_SUCCESS;
} else {
*dist = sqrt((y - ra) * (y - ra) + x * x);
return REF_SUCCESS;
}
}
if (y2 < rb * rb) {
if (x > l) {
*dist = x - l;
return REF_SUCCESS;
} else {
*dist = 0;
return REF_SUCCESS;
}
}
delta = ra - rb;
s = sqrt(l * l + delta * delta);
RAB(ref_math_divisible(delta, s) && ref_math_divisible(l, s),
"div zero forming i and j",
{ ref_metric_tattle_truncated_cone_dist(cone_geom, p); });
if (verbose) printf("l/s %f delta/s %f\n", l / s, delta / s);
xprime = x * (l / s) - (y - ra) * (delta / s);
yprime = x * (delta / s) + (y - ra) * (l / s);
if (verbose) printf("xprime %f yprime %f\n", xprime, yprime);
if (xprime <= 0) {
*dist = sqrt((y - ra) * (y - ra) + x * x);
return REF_SUCCESS;
}
if (xprime >= s) {
*dist = sqrt(yprime * yprime + (xprime - s) * (xprime - s));
return REF_SUCCESS;
}
*dist = MAX(0, yprime);
return REF_SUCCESS;
}
static REF_STATUS ref_metric_cart_box_dist(REF_DBL *box_geom, REF_DBL *p,
REF_DBL *dist) {
REF_INT i;
/* distance to box, zero inside box */
*dist = 0;
for (i = 0; i < 3; i++) {
if (p[i] < box_geom[i]) (*dist) += pow(p[i] - box_geom[i], 2);
if (p[i] > box_geom[i + 3]) (*dist) += pow(p[i] - box_geom[i + 3], 2);
}
(*dist) = sqrt(*dist);
return REF_SUCCESS;
}
REF_STATUS ref_metric_parse(REF_DBL *metric, REF_GRID ref_grid, int narg,
char *args[]) {
REF_INT i, node, pos;
REF_DBL diag_system[12];
REF_DBL h0, decay_distance;
REF_DBL geom[8];
REF_DBL r, h;
REF_BOOL ceil;
pos = 0;
while (pos < narg) {
if (strncmp(args[pos], "--uniform", 9) != 0) {
pos++;
} else {
pos++;
if (pos < narg && strncmp(args[pos], "box", 3) == 0) {
pos++;
RAS(pos + 8 < narg,
"not enough arguments for\n"
" --uniform box {ceil,floor} h0 decay_distance xmin ymin zmin "
"xmax ymax zmax");
RAS(strncmp(args[pos], "ceil", 4) == 0 ||
strncmp(args[pos], "floor", 5) == 0,
"ceil or floor is missing\n"
" --uniform box {ceil,floor} h0 decay_distance xmin ymin zmin "
"xmax ymax zmax");
ceil = (strncmp(args[pos], "ceil", 4) == 0);
pos++;
h0 = atof(args[pos]);
pos++;
decay_distance = atof(args[pos]);
pos++;
h0 = ABS(h0); /* metric must be semi-positive definite */
for (i = 0; i < 6; i++) {
geom[i] = atof(args[pos]);
pos++;
}
if (ceil) {
if (ref_mpi_once(ref_grid_mpi(ref_grid)))
printf("--uniform box ceil h0=%f decay=%f [%f %f %f %f %f %f]\n",
h0, decay_distance, geom[0], geom[1], geom[2], geom[3],
geom[4], geom[5]);
} else {
if (ref_mpi_once(ref_grid_mpi(ref_grid)))
printf("--uniform box floor h0=%f decay=%f [%f %f %f %f %f %f]\n",
h0, decay_distance, geom[0], geom[1], geom[2], geom[3],
geom[4], geom[5]);
}
each_ref_node_valid_node(ref_grid_node(ref_grid), node) {
RSS(ref_metric_cart_box_dist(
geom, ref_node_xyz_ptr(ref_grid_node(ref_grid), node), &r),
"box dist");
h = h0;
if (ref_math_divisible(-r, decay_distance)) {
h = h0 * pow(2, -r / decay_distance);
}
RSS(ref_matrix_diag_m(&(metric[6 * node]), diag_system), "decomp");
if (ceil) {
ref_matrix_eig(diag_system, 0) =
MAX(1.0 / (h * h), ref_matrix_eig(diag_system, 0));
ref_matrix_eig(diag_system, 1) =
MAX(1.0 / (h * h), ref_matrix_eig(diag_system, 1));
ref_matrix_eig(diag_system, 2) =
MAX(1.0 / (h * h), ref_matrix_eig(diag_system, 2));
} else {
ref_matrix_eig(diag_system, 0) =
MIN(1.0 / (h * h), ref_matrix_eig(diag_system, 0));
ref_matrix_eig(diag_system, 1) =
MIN(1.0 / (h * h), ref_matrix_eig(diag_system, 1));
ref_matrix_eig(diag_system, 2) =
MIN(1.0 / (h * h), ref_matrix_eig(diag_system, 2));
}
RSS(ref_matrix_form_m(diag_system, &(metric[6 * node])), "reform");
if (ref_grid_twod(ref_grid)) {
metric[2 + 6 * node] = 0.0;
metric[4 + 6 * node] = 0.0;
metric[5 + 6 * node] = 1.0;
}
}
continue;
}
if (pos < narg && strncmp(args[pos], "cyl", 3) == 0) {
pos++;
RAS(pos + 10 < narg,
"not enough arguments for\n"
" --uniform cyl {ceil,floor} h0 decay_distance x1 y1 z1 "
"x2 y2 z2 r1 r2");
RAS(strncmp(args[pos], "ceil", 4) == 0 ||
strncmp(args[pos], "floor", 5) == 0,
"ceil or floor is missing\n"
" --uniform cyl {ceil,floor} h0 decay_distance x1 y1 z1 "
"x2 y2 z2 r1 r2");
ceil = (strncmp(args[pos], "ceil", 4) == 0);
pos++;
h0 = atof(args[pos]);
pos++;
decay_distance = atof(args[pos]);
pos++;
h0 = ABS(h0); /* metric must be semi-positive definite */
for (i = 0; i < 8; i++) {
geom[i] = atof(args[pos]);
pos++;
}
each_ref_node_valid_node(ref_grid_node(ref_grid), node) {
RSS(ref_metric_truncated_cone_dist(
geom, ref_node_xyz_ptr(ref_grid_node(ref_grid), node), &r),
"trunc cone dist");
h = h0;
if (ref_math_divisible(-r, decay_distance)) {
h = h0 * pow(2, -r / decay_distance);
}
RSS(ref_matrix_diag_m(&(metric[6 * node]), diag_system), "decomp");
if (ceil) {
ref_matrix_eig(diag_system, 0) =
MAX(1.0 / (h * h), ref_matrix_eig(diag_system, 0));
ref_matrix_eig(diag_system, 1) =
MAX(1.0 / (h * h), ref_matrix_eig(diag_system, 1));
ref_matrix_eig(diag_system, 2) =
MAX(1.0 / (h * h), ref_matrix_eig(diag_system, 2));
} else {
ref_matrix_eig(diag_system, 0) =
MIN(1.0 / (h * h), ref_matrix_eig(diag_system, 0));
ref_matrix_eig(diag_system, 1) =
MIN(1.0 / (h * h), ref_matrix_eig(diag_system, 1));
ref_matrix_eig(diag_system, 2) =
MIN(1.0 / (h * h), ref_matrix_eig(diag_system, 2));
}
RSS(ref_matrix_form_m(diag_system, &(metric[6 * node])), "reform");
if (ref_grid_twod(ref_grid)) {
metric[2 + 6 * node] = 0.0;
metric[4 + 6 * node] = 0.0;
metric[5 + 6 * node] = 1.0;
}
}
continue;
}
}
}
return REF_SUCCESS;
}
REF_STATUS ref_metric_isotropic(REF_DBL *metric, REF_GRID ref_grid,
REF_DBL *hh) {
REF_NODE ref_node = ref_grid_node(ref_grid);
REF_INT node;
REF_DBL *metric_imply;
ref_malloc(metric_imply, 6 * ref_node_max(ref_grid_node(ref_grid)), REF_DBL);
RSS(ref_metric_imply_from(metric_imply, ref_grid), "imply");
each_ref_node_valid_node(ref_node, node) {
REF_DBL e, d_imply[12], hmin, hmax, d_met[12], h;
REF_DBL ar;
RSS(ref_matrix_diag_m(&(metric_imply[6 * node]), d_imply), "eigen decomp");
e = MAX(MAX(ref_matrix_eig(d_imply, 0), ref_matrix_eig(d_imply, 1)),
ref_matrix_eig(d_imply, 1));
RAS(e >= 0, "neg eig");
RAS(ref_math_divisible(1.0, sqrt(e)), "div zero");
hmin = 1.0 / sqrt(e);
e = MIN(MIN(ref_matrix_eig(d_imply, 0), ref_matrix_eig(d_imply, 1)),
ref_matrix_eig(d_imply, 1));
RAS(e >= 0, "neg eig");
RAS(ref_math_divisible(1.0, sqrt(e)), "div zero");
hmax = 1.0 / sqrt(e);
RAS(ref_math_divisible(hmin, hmax), "div zero");
ar = hmin / hmax;
RSS(ref_matrix_diag_m(&(metric[6 * node]), d_met), "eigen decomp");
RSS(ref_matrix_ascending_eig(d_met), "really descend?");
if (ar < 0.5) {
e = ref_matrix_eig(d_met, 1);
} else {
e = ref_matrix_eig(d_met, 0);
}
RAS(e >= 0, "neg eig");
RAS(ref_math_divisible(1.0, sqrt(e)), "div zero");
h = 1.0 / sqrt(e);
hh[0 + 2 * node] = h;
hh[1 + 2 * node] = 0.5; /* CADENCE/Pointwise typical decay rate */
}
RSS(ref_node_ghost_dbl(ref_node, hh, 2), "update ghosts");
ref_free(metric_imply);
return REF_SUCCESS;
}
static REF_INT nq = 20;
static REF_DBL tq[] = {
-0.9931285991850949247861224, -0.9639719272779137912676661,
-0.9122344282513259058677524, -0.8391169718222188233945291,
-0.7463319064601507926143051, -0.6360536807265150254528367,
-0.5108670019508270980043641, -0.3737060887154195606725482,
-0.2277858511416450780804962, -0.0765265211334973337546404,
0.0765265211334973337546404, 0.2277858511416450780804962,
0.3737060887154195606725482, 0.5108670019508270980043641,
0.6360536807265150254528367, 0.7463319064601507926143051,
0.8391169718222188233945291, 0.9122344282513259058677524,
0.9639719272779137912676661, 0.9931285991850949247861224};
static REF_DBL wq[] = {
0.0176140071391521183118620, 0.0406014298003869413310400,
0.0626720483341090635695065, 0.0832767415767047487247581,
0.1019301198172404350367501, 0.1181945319615184173123774,
0.1316886384491766268984945, 0.1420961093183820513292983,
0.1491729864726037467878287, 0.152753387130725850698084,
0.1527533871307258506980843, 0.1491729864726037467878287,
0.1420961093183820513292983, 0.1316886384491766268984945,
0.1181945319615184173123774, 0.1019301198172404350367501,
0.0832767415767047487247581, 0.0626720483341090635695065,
0.0406014298003869413310400, 0.0176140071391521183118620};
/*
static REF_INT nq = 10;
static REF_DBL tq[] = {-0.9739065285171717200779640,
-0.8650633666889845107320967,
-0.6794095682990244062343274,
-0.4333953941292471907992659,
-0.1488743389816312108848260,
0.1488743389816312108848260,
0.4333953941292471907992659,
0.6794095682990244062343274,
0.8650633666889845107320967,
0.9739065285171717200779640};
static REF_DBL wq[] = {0.0666713443086881375935688,
0.1494513491505805931457763,
0.2190863625159820439955349,
0.2692667193099963550912269,
0.2955242247147528701738930,
0.2955242247147528701738930,
0.2692667193099963550912269,
0.2190863625159820439955349,
0.1494513491505805931457763,
0.0666713443086881375935688};
*/
/*
static REF_INT nq = 5;
static REF_DBL tq[] = {-9.061798459386640e-01, -5.384693101056830e-01, 0.0,
5.384693101056830e-01, 9.061798459386640e-01};
static REF_DBL wq[] = {2.369268850561891e-01, 4.786286704993665e-01,
5.688888888888889e-01, 4.786286704993665e-01,
2.369268850561891e-01};
*/
/*
static REF_DBL tq[] = {-(1.0 / 3.0) * sqrt(5.0 + 2.0 * sqrt(10.0 / 7.0)),
-(1.0 / 3.0) * sqrt(5.0 - 2.0 * sqrt(10.0 / 7.0)), 0.0,
(1.0 / 3.0) * sqrt(5.0 - 2.0 * sqrt(10.0 / 7.0)),
(1.0 / 3.0) * sqrt(5.0 + 2.0 * sqrt(10.0 / 7.0))};
static REF_DBL wq[] = {(322.0 - 13.0 * sqrt(70)) / 900.0,
(322.0 + 13.0 * sqrt(70)) / 900.0, 128.0 / 225.0,
(322.0 + 13.0 * sqrt(70)) / 900.0,
(322.0 - 13.0 * sqrt(70)) / 900.0};
*/
REF_STATUS ref_metric_integrate(ref_metric_integrand integrand, void *state,
REF_DBL *integral) {
REF_INT i;
REF_DBL t;
REF_DBL value;
*integral = 0.0;
for (i = 0; i < nq; i++) {
t = 0.5 * tq[i] + 0.5;
RSS(integrand(state, t, &value), "eval");
*integral += 0.5 * wq[i] * value;
}
return REF_SUCCESS;
}
REF_STATUS ref_metric_integrand_err2(void *void_m_diag_sys_hess,
REF_DBL theta_over_2pi,
REF_DBL *radial_error) {
REF_DBL *m_diag_sys_hess = void_m_diag_sys_hess;
REF_DBL theta = 2.0 * ref_math_pi * theta_over_2pi;
REF_DBL xx, yy;
REF_DBL h0, h1;
REF_DBL xyz[3];
REF_DBL *hess;
REF_DBL err, r, derr_dr2;
xx = cos(theta);
yy = sin(theta);
h0 = 1.0 / sqrt(m_diag_sys_hess[0]);
h1 = 1.0 / sqrt(m_diag_sys_hess[1]);
xyz[0] = h0 * m_diag_sys_hess[3] * xx + h1 * m_diag_sys_hess[6] * yy;
xyz[1] = h0 * m_diag_sys_hess[4] * xx + h1 * m_diag_sys_hess[7] * yy;
xyz[2] = 0.0;
hess = &(m_diag_sys_hess[12]);
err = ref_matrix_vt_m_v(hess, xyz);
r = sqrt(ref_math_dot(xyz, xyz));
/* assume error = derr_dr2 * r * r */
derr_dr2 = err / r / r;
/* integrate 2 * pi * r * error or 2 * pi * r^4/4 * derr_dr2 */
*radial_error = 2 * ref_math_pi * derr_dr2 * pow(r, 4) / 4.0;
/* printf("theta %f r %f derr_dr2 %f\n",theta,r,derr_dr2); */
return REF_SUCCESS;
}
/*
static REF_INT nq2 = 7;
static REF_DBL baryq2[7][3] = {
{1.0 / 3.0, 1.0 / 3.0, 1.0 / 3.0},
{0.797426985353087, 0.101286507323456, 0.101286507323456},
{0.101286507323456, 0.797426985353087, 0.101286507323456},
{0.101286507323456, 0.101286507323456, 0.797426985353087},
{0.470142064105115, 0.470142064105115, 0.059715871789770},
{0.470142064105115, 0.059715871789770, 0.470142064105115},
{0.059715871789770, 0.470142064105115, 0.470142064105115}};
static REF_DBL weightq2[7] = {
0.225000000000000, 0.125939180544827, 0.125939180544827, 0.125939180544827,
0.132394152785506, 0.132394152785506, 0.132394152785506};
*/
static REF_INT nq2 = 25;
static REF_DBL baryq2[25][3] = {
{0.3333333333333333, 0.3333333333333333, 0.3333333333333334},
{0.4272731788467755, 0.1454536423064490, 0.4272731788467755},
{0.1454536423064490, 0.4272731788467755, 0.4272731788467755},
{0.4272731788467755, 0.4272731788467755, 0.1454536423064490},
{0.1830992224486750, 0.6338015551026499, 0.1830992224486750},
{0.6338015551026499, 0.1830992224486750, 0.1830992224486751},
{0.1830992224486750, 0.1830992224486750, 0.6338015551026499},
{0.4904340197011306, 0.0191319605977388, 0.4904340197011307},
{0.0191319605977388, 0.4904340197011306, 0.4904340197011306},
{0.4904340197011306, 0.4904340197011306, 0.0191319605977389},
{0.0125724455515805, 0.9748551088968389, 0.0125724455515805},
{0.9748551088968389, 0.0125724455515805, 0.0125724455515806},
{0.0125724455515805, 0.0125724455515805, 0.9748551088968389},
{0.3080460016852477, 0.0376853303946862, 0.6542686679200660},
{0.0376853303946862, 0.3080460016852477, 0.6542686679200660},
{0.6542686679200661, 0.0376853303946862, 0.3080460016852477},
{0.0376853303946862, 0.6542686679200661, 0.3080460016852477},
{0.6542686679200661, 0.3080460016852477, 0.0376853303946862},
{0.3080460016852477, 0.6542686679200661, 0.0376853303946861},
{0.0333718337393048, 0.8438235891921360, 0.1228045770685593},
{0.8438235891921360, 0.0333718337393048, 0.1228045770685593},
{0.1228045770685593, 0.8438235891921360, 0.0333718337393047},
{0.8438235891921360, 0.1228045770685593, 0.0333718337393048},
{0.1228045770685593, 0.0333718337393048, 0.8438235891921360},
{0.0333718337393048, 0.1228045770685593, 0.8438235891921360}};
static REF_DBL weightq2[25] = {
0.0809374287976229, 0.0772985880029631, 0.0772985880029631,
0.0772985880029631, 0.0784576386123717, 0.0784576386123717,
0.0784576386123717, 0.0174691679959295, 0.0174691679959295,
0.0174691679959295, 0.0042923741848328, 0.0042923741848328,
0.0042923741848328, 0.0374688582104676, 0.0374688582104676,
0.0374688582104676, 0.0374688582104676, 0.0374688582104676,
0.0374688582104676, 0.0269493525918800, 0.0269493525918800,
0.0269493525918800, 0.0269493525918800, 0.0269493525918800,
0.0269493525918800};
REF_STATUS ref_metric_integrate2(ref_metric_integrand2 integrand, void *state,
REF_DBL *integral) {
REF_INT i;
REF_DBL value;
*integral = 0.0;
for (i = 0; i < nq2; i++) {
RSS(integrand(state, baryq2[i], &value), "eval");
*integral += weightq2[i] * value;
}
return REF_SUCCESS;
}
static REF_STATUS ref_metric_integrand_quad_err2(void *void_node_area,
REF_DBL *bary,
REF_DBL *error) {
REF_DBL *node_area = void_node_area;
REF_DBL shape[REF_CELL_MAX_SIZE_PER];
REF_INT i;
REF_DBL quadratic, linear;
REF_INT p = 1;
RSS(ref_cell_shape(REF_CELL_TR3, bary, shape), "shape");
quadratic = 0.0;
for (i = 0; i < 6; i++) {
quadratic += shape[i] * node_area[i];
}
linear = 0.0;
for (i = 0; i < 3; i++) {
linear += bary[i] * node_area[i];
}
*error = pow(ABS(quadratic - linear), p) * node_area[6];
return REF_SUCCESS;
}
REF_STATUS ref_metric_interpolation_error2(REF_GRID ref_grid, REF_DBL *scalar) {
REF_NODE ref_node = ref_grid_node(ref_grid);
REF_CELL ref_cell = ref_grid_tr2(ref_grid);
REF_INT cell, cell_node;
REF_INT nodes[REF_CELL_MAX_SIZE_PER];
REF_DBL node_area[7];
REF_DBL integral;
REF_DBL error;
REF_DBL *dist;
ref_malloc_init(dist, ref_node_max(ref_node), REF_DBL, 0.0);
error = 0.0;
each_ref_cell_valid_cell_with_nodes(ref_cell, cell, nodes) {
each_ref_cell_cell_node(ref_cell, cell_node) {
node_area[cell_node] = scalar[nodes[cell_node]];
}
RSS(ref_node_tri_area(ref_node, nodes, &(node_area[6])), "area");
RSS(ref_metric_integrate2(ref_metric_integrand_quad_err2, node_area,
&integral),
"intg");
error += integral;
{
REF_CELL tri_cell = ref_grid_tri(ref_grid);
REF_INT tri_nodes[REF_CELL_MAX_SIZE_PER], new_cell;
tri_nodes[0] = nodes[0];
tri_nodes[1] = nodes[1];
tri_nodes[2] = nodes[2];
tri_nodes[3] = nodes[6];
RSS(ref_cell_add(tri_cell, tri_nodes, &new_cell), "add tri");
dist[tri_nodes[0]] += integral / 3.0;
dist[tri_nodes[1]] += integral / 3.0;
dist[tri_nodes[2]] += integral / 3.0;
}
}
printf("interpolation error %e\n", error);
RSS(ref_gather_scalar_by_extension(ref_grid, 1, dist, NULL,
"ref_metric_test_dist.plt"),
"dump");
return REF_SUCCESS;
}
| 35.954894 | 80 | 0.603686 |
312ced8b7cb07811081785b0277eee4a34797b15 | 657 | h | C | src/handles/factory-handles.h | lazyparser/v8 | 5ce1ded10dc130c67e3933772815718c95a14074 | [
"BSD-3-Clause"
] | null | null | null | src/handles/factory-handles.h | lazyparser/v8 | 5ce1ded10dc130c67e3933772815718c95a14074 | [
"BSD-3-Clause"
] | null | null | null | src/handles/factory-handles.h | lazyparser/v8 | 5ce1ded10dc130c67e3933772815718c95a14074 | [
"BSD-3-Clause"
] | null | null | null | // Copyright 2020 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef V8_HANDLES_FACTORY_HANDLES_H_
#define V8_HANDLES_FACTORY_HANDLES_H_
namespace v8 {
namespace internal {
template <typename Impl>
struct FactoryTraits;
template <typename Impl, typename T>
using FactoryHandle = typename FactoryTraits<Impl>::template HandleType<T>;
template <typename Impl, typename T>
using FactoryMaybeHandle =
typename FactoryTraits<Impl>::template MaybeHandleType<T>;
} // namespace internal
} // namespace v8
#endif // V8_HANDLES_FACTORY_HANDLES_H_
| 27.375 | 75 | 0.78691 |
312d31c551bdefaabea4bd5ea9e2ceb082322229 | 316 | h | C | apps/cc3o3/combat/Team.h | max-delta/retrofit-public | 5447fd6399fd74ffbb75494c103940751000db12 | [
"X11"
] | 3 | 2019-10-27T22:32:44.000Z | 2020-05-21T04:00:46.000Z | apps/cc3o3/combat/Team.h | max-delta/retrofit-public | 5447fd6399fd74ffbb75494c103940751000db12 | [
"X11"
] | null | null | null | apps/cc3o3/combat/Team.h | max-delta/retrofit-public | 5447fd6399fd74ffbb75494c103940751000db12 | [
"X11"
] | null | null | null | #pragma once
#include "project.h"
#include "cc3o3/combat/CombatFwd.h"
namespace RF::cc::combat {
///////////////////////////////////////////////////////////////////////////////
struct Team
{
// No team-related data currently
};
///////////////////////////////////////////////////////////////////////////////
}
| 18.588235 | 79 | 0.341772 |
312d76b31e53aa53a92ab89b1a7463cbbdfaf605 | 21,011 | c | C | test/src/bl/getopt/getopt_long_test.c | RafaGago/base_library | 3d08c1ccbecc4ab26495999fc6692978b490e40f | [
"BSD-3-Clause"
] | 5 | 2016-08-05T07:25:51.000Z | 2021-10-02T22:09:27.000Z | test/src/bl/getopt/getopt_long_test.c | RafaGago/base_library | 3d08c1ccbecc4ab26495999fc6692978b490e40f | [
"BSD-3-Clause"
] | null | null | null | test/src/bl/getopt/getopt_long_test.c | RafaGago/base_library | 3d08c1ccbecc4ab26495999fc6692978b490e40f | [
"BSD-3-Clause"
] | null | null | null | #include <bl/base/utility.h>
#include <bl/base/platform.h>
#include <bl/cmocka_pre.h>
#include <bl/getopt/getopt.h>
/*---------------------------------------------------------------------------*/
static void getopt_long_no_long_arg_empty (void **state)
{
bl_getopt_state s = BL_GETOPT_STATE_INITIALIZER;
char* argv[] = {"foo.exe"};
bl_arg_option o[] = {{ 0 },};
assert_true (
-1 == bl_getopt_long (&s, bl_arr_elems (argv), argv, "abc", o, nullptr)
);
}
/*---------------------------------------------------------------------------*/
static void getopt_long_no_long_arg_simple (void **state)
{
bl_getopt_state s = BL_GETOPT_STATE_INITIALIZER;
char* argv[] = {"foo.exe", "-a"};
bl_arg_option o[] = {{ 0 },};
assert_true(
'a' == bl_getopt_long (&s, bl_arr_elems (argv), argv, "a", o, nullptr)
);
}
/*---------------------------------------------------------------------------*/
static void getopt_long_no_long_arg_unrecognized (void **state)
{
bl_getopt_state s = BL_GETOPT_STATE_INITIALIZER;
char* argv[] = {"foo.exe", "-a"};
bl_arg_option o[] = {{ 0 },};
assert_true(
'?' == bl_getopt_long (&s, bl_arr_elems (argv), argv, "cde", o, nullptr)
);
}
/*---------------------------------------------------------------------------*/
static void getopt_long_no_long_arg_only_nonoptions (void **state)
{
bl_getopt_state s = BL_GETOPT_STATE_INITIALIZER;
char* argv[] = {"foo.exe", "nonoption"};
bl_arg_option o[] = {{ 0 },};
assert_true(
-1 == bl_getopt_long (&s, bl_arr_elems (argv), argv, "cde", o, nullptr)
);
}
/*---------------------------------------------------------------------------*/
static void getopt_long_no_long_arg_consume_subset (void **state)
{
bl_getopt_state s = BL_GETOPT_STATE_INITIALIZER;
char* argv[] = {"foo.exe", "-f", "-g", "-h"};
bl_arg_option o[] = {{ 0 },};
assert_true(
'f' == bl_getopt_long (&s, bl_arr_elems (argv), argv, "fgh", o, nullptr)
);
assert_true(
'g' == bl_getopt_long (&s, bl_arr_elems (argv), argv, "fgh", o, nullptr)
);
}
/*---------------------------------------------------------------------------*/
static void getopt_long_no_long_arg_multiple_options_diff_argv (void **state)
{
bl_getopt_state s = BL_GETOPT_STATE_INITIALIZER;
char* argv[] = {"foo.exe", "-b", "-a"};
bl_arg_option o[] = {{ 0 },};
assert_true(
'b' == bl_getopt_long (&s, bl_arr_elems (argv), argv, "ab", o, nullptr)
);
assert_true(
'a' == bl_getopt_long (&s, bl_arr_elems (argv), argv, "ab", o, nullptr)
);
}
/*---------------------------------------------------------------------------*/
static void getopt_long_no_long_arg_multiple_options_same_argv (void **state)
{
bl_getopt_state s = BL_GETOPT_STATE_INITIALIZER;
char* argv[] = {"foo.exe", "-ba"};
bl_arg_option o[] = {{ 0 },};
assert_true(
'b' == bl_getopt_long (&s, bl_arr_elems (argv), argv, "ab", o, nullptr)
);
assert_true(
'a' == bl_getopt_long (&s, bl_arr_elems (argv), argv, "ab", o, nullptr)
);
}
/*---------------------------------------------------------------------------*/
static void getopt_long_no_long_arg_embedded_nonoptions (void **state)
{
bl_getopt_state s = BL_GETOPT_STATE_INITIALIZER;
char* argv[] = {"foo.exe", "-a", "nonoption", "-b"};
bl_arg_option o[] = {{ 0 },};
assert_true(
'a' == bl_getopt_long (&s, bl_arr_elems (argv), argv, "ab", o, nullptr)
);
/* The non-option argument "nonoption1" terminates the scan */
assert_true(
-1 == bl_getopt_long (&s, bl_arr_elems (argv), argv, "ab", o, nullptr)
);
}
/*---------------------------------------------------------------------------*/
static void getopt_long_no_long_arg_argument_same_argv (void **state)
{
bl_getopt_state s = BL_GETOPT_STATE_INITIALIZER;
char* argv[] = {"foo.exe", "-aarg"};
bl_arg_option o[] = {{ 0 },};
assert_true(
'a' == bl_getopt_long (&s, bl_arr_elems (argv), argv, "a:", o, nullptr)
);
assert_string_equal ("arg", bl_getopt_optarg (&s));
}
/*---------------------------------------------------------------------------*/
static void getopt_long_no_long_arg_argument_diff_argv (void **state)
{
bl_getopt_state s = BL_GETOPT_STATE_INITIALIZER;
char* argv[] = {"foo.exe", "-a", "arg"};
bl_arg_option o[] = {{ 0 },};
assert_true(
'a' == bl_getopt_long (&s, bl_arr_elems (argv), argv, "a:", o, nullptr)
);
assert_string_equal ("arg", bl_getopt_optarg (&s));
}
/*---------------------------------------------------------------------------*/
static void getopt_long_no_long_arg_required_arg_missing (void **state)
{
bl_getopt_state s = BL_GETOPT_STATE_INITIALIZER;
char* argv[] = {"foo.exe", "-a"};
bl_arg_option o[] = {{ 0 },};
assert_true(
'?' == bl_getopt_long (&s, bl_arr_elems (argv), argv, "a:", o, nullptr)
);
assert_true ('a' == bl_getopt_optopt (&s));
assert_true (nullptr == bl_getopt_optarg (&s));
assert_true (3 == bl_getopt_optind (&s));
}
/*---------------------------------------------------------------------------*/
static void getopt_long_no_long_arg_optstring_starts_w_colon (void **state)
{
bl_getopt_state s = BL_GETOPT_STATE_INITIALIZER;
char* argv[] = {"foo.exe", "-a"};
bl_arg_option o[] = {{ 0 },};
assert_true(
':' == bl_getopt_long (&s, bl_arr_elems (argv), argv, ":a:", o, nullptr)
);
assert_true ('a' == bl_getopt_optopt (&s));
assert_true (nullptr == bl_getopt_optarg (&s));
assert_true (3 == bl_getopt_optind (&s));
}
/*---------------------------------------------------------------------------*/
static void getopt_long_no_long_arg_optional_arg_present (void **state)
{
bl_getopt_state s = BL_GETOPT_STATE_INITIALIZER;
char* argv[] = {"foo.exe", "-aarg"};
bl_arg_option o[] = {{ 0 },};
assert_true(
'a' == bl_getopt_long (&s, bl_arr_elems (argv), argv, "a::", o, nullptr)
);
assert_string_equal ("arg", bl_getopt_optarg (&s));
}
/*---------------------------------------------------------------------------*/
static void getopt_long_no_long_arg_optional_arg_missing (void **state)
{
bl_getopt_state s = BL_GETOPT_STATE_INITIALIZER;
char* argv[] = {"foo.exe", "-a"};
bl_arg_option o[] = {{ 0 },};
assert_true(
'a' == bl_getopt_long (&s, bl_arr_elems (argv), argv, "a::", o, nullptr)
);
assert_true (nullptr == bl_getopt_optarg (&s));
}
/*---------------------------------------------------------------------------*/
static void getopt_long_no_long_arg_test_optopt (void **state)
{
bl_getopt_state s = BL_GETOPT_STATE_INITIALIZER;
char* argv[] = {"foo.exe", "-a", "-b"};
bl_arg_option o[] = {{ 0 },};
assert_true(
'a' == bl_getopt_long (&s, bl_arr_elems (argv), argv, "a", o, nullptr)
);
assert_true ('a' == bl_getopt_optopt (&s));
assert_true(
'?' == bl_getopt_long (&s, bl_arr_elems (argv), argv, "a", o, nullptr)
);
assert_true ('b' == bl_getopt_optopt (&s));
}
/*---------------------------------------------------------------------------*/
static void getopt_long_mixed_options (void **state)
{
bl_getopt_state s = BL_GETOPT_STATE_INITIALIZER;
char* argv[] = {"foo.exe", "--aa", "-a"};
bl_arg_option o[] = {{ "aa", bl_no_argument, nullptr, 'x' }, { 0 }, };
assert_true(
'x' == bl_getopt_long (&s, bl_arr_elems (argv), argv, "a", o, nullptr)
);
assert_true(
'a' == bl_getopt_long (&s, bl_arr_elems (argv), argv, "a", o, nullptr)
);
}
/*---------------------------------------------------------------------------*/
static void getopt_long_only_long_options (void **state)
{
bl_getopt_state s = BL_GETOPT_STATE_INITIALIZER;
char* argv[] = {"foo.exe", "--aa", "--bb"};
bl_arg_option o[] = {
{ "aa", bl_no_argument, nullptr, 'a' },
{ "bb", bl_no_argument, nullptr, 'b' },
{ 0 },
};
assert_true(
'a' == bl_getopt_long (&s, bl_arr_elems (argv), argv, nullptr, o, nullptr)
);
assert_true(
'b' == bl_getopt_long (&s, bl_arr_elems (argv), argv, nullptr, o, nullptr)
);
}
/*---------------------------------------------------------------------------*/
static void getopt_long_wrong_long_option (void **state)
{
bl_getopt_state s = BL_GETOPT_STATE_INITIALIZER;
char* argv[] = {"foo.exe", "-bb"};
bl_arg_option o[] = {
{ "aa", bl_no_argument, nullptr, 'a' },
{ "bb", bl_no_argument, nullptr, 'b' },
{ 0 },
};
assert_true(
-1 == bl_getopt_long (&s, bl_arr_elems (argv), argv, nullptr, o, nullptr)
);
}
/*---------------------------------------------------------------------------*/
static void getopt_long_wrong_long_abbreviation (void **state)
{
bl_getopt_state s = BL_GETOPT_STATE_INITIALIZER;
char* argv[] = {"foo.exe", "--b", "--a"};
bl_arg_option o[] = {
{ "aa", bl_no_argument, nullptr, 'a' },
{ "bb", bl_no_argument, nullptr, 'b' },
{ 0 },
};
assert_true(
'b' == bl_getopt_long (&s, bl_arr_elems (argv), argv, nullptr, o, nullptr)
);
assert_true(
'a' == bl_getopt_long (&s, bl_arr_elems (argv), argv, nullptr, o, nullptr)
);
assert_true(
-1 == bl_getopt_long (&s, bl_arr_elems (argv), argv, nullptr, o, nullptr)
);
}
/*---------------------------------------------------------------------------*/
static void getopt_long_wrong_long_param_abbreviation_eq (void **state)
{
bl_getopt_state s = BL_GETOPT_STATE_INITIALIZER;
char* argv[] = {"foo.exe", "--b=123", "--a=321"};
bl_arg_option o[] = {
{ "aa", bl_required_argument, nullptr, 'a' },
{ "bb", bl_required_argument, nullptr, 'b' },
{ 0 },
};
assert_true(
'b' == bl_getopt_long (&s, bl_arr_elems (argv), argv, nullptr, o, nullptr)
);
assert_string_equal ("123", bl_getopt_optarg (&s));
assert_true(
'a' == bl_getopt_long (&s, bl_arr_elems (argv), argv, nullptr, o, nullptr)
);
assert_string_equal ("321", bl_getopt_optarg (&s));
assert_true(
-1 == bl_getopt_long (&s, bl_arr_elems (argv), argv, nullptr, o, nullptr)
);
}
/*---------------------------------------------------------------------------*/
static void getopt_long_wrong_long_param_abbreviation_diff_arg (void **state)
{
bl_getopt_state s = BL_GETOPT_STATE_INITIALIZER;
char* argv[] = {"foo.exe", "--b", "123", "--a", "321"};
bl_arg_option o[] = {
{ "aa", bl_required_argument, nullptr, 'a' },
{ "bb", bl_required_argument, nullptr, 'b' },
{ 0 },
};
assert_true(
'b' == bl_getopt_long (&s, bl_arr_elems (argv), argv, nullptr, o, nullptr)
);
assert_string_equal ("123", bl_getopt_optarg (&s));
assert_true(
'a' == bl_getopt_long (&s, bl_arr_elems (argv), argv, nullptr, o, nullptr)
);
assert_string_equal ("321", bl_getopt_optarg (&s));
assert_true(
-1 == bl_getopt_long (&s, bl_arr_elems (argv), argv, nullptr, o, nullptr)
);
}
/*---------------------------------------------------------------------------*/
static void getopt_long_wrong_long_ambiguous_abbrev (void **state)
{
bl_getopt_state s = BL_GETOPT_STATE_INITIALIZER;
char* argv[] = {"foo.exe", "--a"};
bl_arg_option o[] = {
{ "aa", bl_no_argument, nullptr, 'a' },
{ "ab", bl_no_argument, nullptr, 'b' },
{ 0 },
};
assert_true(
'?' == bl_getopt_long (&s, bl_arr_elems (argv), argv, nullptr, o, nullptr)
);
}
/*---------------------------------------------------------------------------*/
static void getopt_long_using_longindex (void **state)
{
bl_getopt_state s = BL_GETOPT_STATE_INITIALIZER;
char* argv[] = {"foo.exe", "--cc", "--aa", "--bb"};
bl_arg_option o[] = {
{ "aa", bl_no_argument, nullptr, 'a' },
{ "bb", bl_no_argument, nullptr, 'b' },
{ "cc", bl_no_argument, nullptr, 'c' },
{ 0 },
};
int longindex = -1;
assert_true(
'c'
== bl_getopt_long (&s, bl_arr_elems (argv), argv, nullptr, o, &longindex)
);
assert_true (2 == longindex);
assert_true(
'a'
== bl_getopt_long (&s, bl_arr_elems (argv), argv, nullptr, o, &longindex)
);
assert_true (0 == longindex);
assert_true(
'b' == bl_getopt_long (&s, bl_arr_elems (argv), argv, nullptr, o, &longindex)
);
assert_true (1 == longindex);
assert_true(
-1 == bl_getopt_long (&s, bl_arr_elems (argv), argv, nullptr, o, &longindex)
);
}
/*---------------------------------------------------------------------------*/
static void getopt_long_using_long_flag (void **state)
{
bl_getopt_state s = BL_GETOPT_STATE_INITIALIZER;
char* argv[] = {"foo.exe", "--aa", "--bb"};
int flag = 99;
bl_arg_option o[] = {
{ "aa", bl_no_argument, &flag, 'a' },
{ "bb", bl_no_argument, nullptr, 'b' },
{ 0 },
};
assert_true(
0 == bl_getopt_long (&s, bl_arr_elems (argv), argv, nullptr, o, nullptr)
);
assert_true ('a' == flag);
assert_true(
'b' == bl_getopt_long (&s, bl_arr_elems (argv), argv, nullptr, o, nullptr)
);
}
/*---------------------------------------------------------------------------*/
static void getopt_long_unknown (void **state)
{
bl_getopt_state s = BL_GETOPT_STATE_INITIALIZER;
char* argv[] = {"foo.exe", "--wtf"};
int flag = 99;
bl_arg_option o[] = {
{ "aa", bl_no_argument, &flag, 'a' },
{ "bb", bl_no_argument, nullptr, 'b' },
{ 0 },
};
assert_true(
'?' == bl_getopt_long (&s, bl_arr_elems (argv), argv, "ab", o, nullptr)
);
assert_true (2 == bl_getopt_optind (&s));
}
/*---------------------------------------------------------------------------*/
static void getopt_long_missing_required_arg (void **state)
{
bl_getopt_state s = BL_GETOPT_STATE_INITIALIZER;
char* argv[] = {"foo.exe", "--aa"};
bl_arg_option o[] = {
{ "aa", bl_required_argument, nullptr, 'a' },
{ 0 },
};
assert_true(
':' == bl_getopt_long (&s, bl_arr_elems (argv), argv, nullptr, o, nullptr)
);
assert_true (3 == bl_getopt_optind (&s));
assert_true (nullptr == bl_getopt_optarg (&s));
}
/*---------------------------------------------------------------------------*/
static void getopt_long_missing_required_arg_by_equal (void **state)
{
bl_getopt_state s = BL_GETOPT_STATE_INITIALIZER;
char* argv[] = {"foo.exe", "--aa="};
bl_arg_option o[] = {
{ "aa", bl_required_argument, nullptr, 'a' },
{ 0 },
};
assert_true(
'a' == bl_getopt_long (&s, bl_arr_elems (argv), argv, nullptr, o, nullptr)
);
assert_string_equal ("", bl_getopt_optarg (&s));
}
/*---------------------------------------------------------------------------*/
static void getopt_long_optional_arg (void **state)
{
bl_getopt_state s = BL_GETOPT_STATE_INITIALIZER;
char* argv[] = {"foo.exe", "--aa", "123"};
bl_arg_option o[] = {
{ "aa", bl_optional_argument, nullptr, 'a' },
{ 0 },
};
assert_true(
'a' == bl_getopt_long (&s, bl_arr_elems (argv), argv, nullptr, o, nullptr)
);
assert_true (nullptr == bl_getopt_optarg (&s));
}
/*---------------------------------------------------------------------------*/
static void getopt_long_optional_arg_by_equal (void **state)
{
bl_getopt_state s = BL_GETOPT_STATE_INITIALIZER;
char* argv[] = {"foo.exe", "--aa=123"};
bl_arg_option o[] = {
{ "aa", bl_optional_argument, nullptr, 'a' },
{ 0 },
};
assert_true(
'a' == bl_getopt_long (&s, bl_arr_elems (argv), argv, nullptr, o, nullptr)
);
assert_string_equal ("123", bl_getopt_optarg (&s));
}
/*---------------------------------------------------------------------------*/
static void getopt_long_missing_optional_arg (void **state)
{
bl_getopt_state s = BL_GETOPT_STATE_INITIALIZER;
char* argv[] = {"foo.exe", "--aa"};
bl_arg_option o[] = {
{ "aa", bl_optional_argument, nullptr, 'a' },
{ 0 },
};
assert_true(
'a' == bl_getopt_long (&s, bl_arr_elems (argv), argv, nullptr, o, nullptr)
);
assert_true (nullptr == bl_getopt_optarg (&s));
assert_true (2 == bl_getopt_optind (&s));
}
/*---------------------------------------------------------------------------*/
static void getopt_long_empty_optional_arg_by_equal (void **state)
{
bl_getopt_state s = BL_GETOPT_STATE_INITIALIZER;
char* argv[] = {"foo.exe", "--aa="};
bl_arg_option o[] = {
{ "aa", bl_optional_argument, nullptr, 'a' },
{ 0 },
};
assert_true(
'a' == bl_getopt_long (&s, bl_arr_elems (argv), argv, nullptr, o, nullptr)
);
assert_string_equal ("", bl_getopt_optarg (&s));
}
/*---------------------------------------------------------------------------*/
#if BL_OS_IS_MOSTLY_POSIX && 0
/*Check some weird behaviors*/
#undef bl_no_argument
#undef bl_optional_argument
#undef bl_required_argument
#include <getopt.h>
/*---------------------------------------------------------------------------*/
static void real_getopt_long_missing_required_arg (void **state)
{
char* argv[] = {"foo.exe", "--aa"};
struct option o[] = {
{ "aa", bl_required_argument, nullptr, 'a' },
{ 0 },
};
optind = 1;
int res = getopt_long (bl_arr_elems (argv), argv, "a", o, nullptr);
assert_true ((':' == res && 3 == optind)|| ('?' == res && 2 == optind));
assert_true (nullptr == optarg);
}
/*---------------------------------------------------------------------------*/
static void real_getopt_long_missing_required_arg_by_equal (void **state)
{
char* argv[] = {"foo.exe", "--aa="};
struct option o[] = {
{ "aa", bl_required_argument, nullptr, 'a' },
{ 0 },
};
optind = 1;
assert_true(
'a' == getopt_long (bl_arr_elems (argv), argv, "a", o, nullptr)
);
assert_string_equal ("", optarg);
}
/*---------------------------------------------------------------------------*/
static void real_getopt_long_missing_optional_arg (void **state)
{
char* argv[] = {"foo.exe", "--aa"};
struct option o[] = {
{ "aa", bl_optional_argument, nullptr, 'a' },
{ 0 },
};
optind = 1;
assert_true(
'a' == getopt_long (bl_arr_elems (argv), argv, "a", o, nullptr)
);
assert_true (nullptr == optarg);
assert_true (2 == optind);
}
/*---------------------------------------------------------------------------*/
static void real_getopt_long_empty_optional_arg_by_equal (void **state)
{
char* argv[] = {"foo.exe", "--aa="};
struct option o[] = {
{ "aa", bl_optional_argument, nullptr, 'a' },
{ 0 },
};
optind = 1;
assert_true(
'a' == getopt_long (bl_arr_elems (argv), argv, "a", o, nullptr)
);
assert_string_equal ("", optarg);
}
/*---------------------------------------------------------------------------*/
#endif
/*---------------------------------------------------------------------------*/
static const struct CMUnitTest tests[] = {
cmocka_unit_test (getopt_long_no_long_arg_empty),
cmocka_unit_test (getopt_long_no_long_arg_simple),
cmocka_unit_test (getopt_long_no_long_arg_unrecognized),
cmocka_unit_test (getopt_long_no_long_arg_only_nonoptions),
cmocka_unit_test (getopt_long_no_long_arg_consume_subset),
cmocka_unit_test (getopt_long_no_long_arg_multiple_options_diff_argv),
cmocka_unit_test (getopt_long_no_long_arg_multiple_options_same_argv),
cmocka_unit_test (getopt_long_no_long_arg_embedded_nonoptions),
cmocka_unit_test (getopt_long_no_long_arg_argument_same_argv),
cmocka_unit_test (getopt_long_no_long_arg_argument_diff_argv),
cmocka_unit_test (getopt_long_no_long_arg_required_arg_missing),
cmocka_unit_test (getopt_long_no_long_arg_optstring_starts_w_colon),
cmocka_unit_test (getopt_long_no_long_arg_optional_arg_present),
cmocka_unit_test (getopt_long_no_long_arg_optional_arg_missing),
cmocka_unit_test (getopt_long_no_long_arg_test_optopt),
cmocka_unit_test (getopt_long_mixed_options),
cmocka_unit_test (getopt_long_only_long_options),
cmocka_unit_test (getopt_long_wrong_long_option),
cmocka_unit_test (getopt_long_wrong_long_abbreviation),
cmocka_unit_test (getopt_long_wrong_long_param_abbreviation_eq),
cmocka_unit_test (getopt_long_wrong_long_param_abbreviation_diff_arg),
cmocka_unit_test (getopt_long_wrong_long_ambiguous_abbrev),
cmocka_unit_test (getopt_long_using_longindex),
cmocka_unit_test (getopt_long_using_long_flag),
cmocka_unit_test (getopt_long_unknown),
cmocka_unit_test (getopt_long_missing_required_arg),
cmocka_unit_test (getopt_long_missing_required_arg_by_equal),
cmocka_unit_test (getopt_long_optional_arg),
cmocka_unit_test (getopt_long_optional_arg_by_equal),
cmocka_unit_test (getopt_long_missing_optional_arg),
cmocka_unit_test (getopt_long_empty_optional_arg_by_equal),
#if BL_OS_IS_MOSTLY_POSIX && 0
cmocka_unit_test (real_getopt_long_missing_required_arg),
cmocka_unit_test (real_getopt_long_missing_required_arg_by_equal),
cmocka_unit_test (real_getopt_long_missing_optional_arg),
cmocka_unit_test (real_getopt_long_empty_optional_arg_by_equal),
#endif
};
/*---------------------------------------------------------------------------*/
int bl_getopt_long_tests (void)
{
return cmocka_run_group_tests (tests, nullptr, nullptr);
}
/*---------------------------------------------------------------------------*/
| 36.732517 | 81 | 0.556185 |
312d7b127583ecbedd702e02f4f35e14fe19d3e7 | 4,064 | h | C | targets/TARGET_ARM_SSG/TARGET_MUSCA_B1/device/device_cfg.h | Nakul93/mbed-os | a107a4de46fb56792bb5107f110bbb37e4796dd3 | [
"Apache-2.0"
] | 1 | 2020-03-06T02:02:37.000Z | 2020-03-06T02:02:37.000Z | targets/TARGET_ARM_SSG/TARGET_MUSCA_B1/device/device_cfg.h | Nakul93/mbed-os | a107a4de46fb56792bb5107f110bbb37e4796dd3 | [
"Apache-2.0"
] | 4 | 2019-09-17T07:30:20.000Z | 2019-11-27T14:22:23.000Z | targets/TARGET_ARM_SSG/TARGET_MUSCA_B1/device/device_cfg.h | Nakul93/mbed-os | a107a4de46fb56792bb5107f110bbb37e4796dd3 | [
"Apache-2.0"
] | 2 | 2019-07-10T17:24:36.000Z | 2020-03-18T13:23:58.000Z | /*
* Copyright (c) 2017-2020 Arm Limited
*
* SPDX-License-Identifier: Apache-2.0
*
* 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 __MUSCA_B1_DEVICE_CFG_H__
#define __MUSCA_B1_DEVICE_CFG_H__
/**
* \file device_cfg.h
* \brief Configuration file native driver re-targeting
*
* \details This file can be used to add native driver specific macro
* definitions to select which peripherals are available in the build.
*
* This is a default device configuration file with all peripherals enabled.
*/
#if defined(TARGET_MUSCA_B1_S)
/* ARM SCC */
#define MUSCA_B1_SCC_S
#define MUSCA_B1_SCC_DEV MUSCA_B1_SCC_DEV_S
/* ARM Memory Protection Controller (MPC) SIE 200 */
#define MPC_ISRAM0_S
#define MPC_ISRAM1_S
#define MPC_ISRAM2_S
#define MPC_ISRAM3_S
#define MPC_CODE_SRAM_S
#define MPC_CODE_SRAM_NS
#define MPC_QSPI_S
#define MPC_QSPI_NS
#define MPC_EFLASH0_S
#define MPC_EFLASH1_S
/* ARM Peripheral Protection Controllers (PPC) */
#define AHB_PPC0_S
#define AHB_PPCEXP0_S
#define AHB_PPCEXP1_S
#define AHB_PPCEXP2_S
#define AHB_PPCEXP3_S
#define APB_PPC0_S
#define APB_PPC1_S
#define APB_PPCEXP0_S
#define APB_PPCEXP1_S
#define APB_PPCEXP2_S
#define APB_PPCEXP3_S
/* Cadence QSPI Flash Controller */
#define QSPI_IP6514E_S
/* MT25QL Flash memory library */
#define MT25QL_S
/* GPIO */
#define GPIO0_CMSDK_S
#define GPIO0_CMSDK_DEV GPIO0_CMSDK_DEV_S
#endif // defined(TARGET_MUSCA_B1_S)
#if defined(TARGET_MUSCA_B1_NS)
/*ARM UART Controller PL011*/
#define UART0_PL011_NS
#define UART0_PL011_DEV UART0_PL011_DEV_NS
#define uart0_tx_irq_handler UARTTX0_Handler
#define uart0_rx_irq_handler UARTRX0_Handler
#define uart0_rx_timeout_irq_handler UART0_RxTimeout_IRQHandler
#define UART1_PL011_NS
#define UART1_PL011_DEV UART1_PL011_DEV_NS
#define uart1_tx_irq_handler UARTTX1_Handler
#define uart1_rx_irq_handler UARTRX1_Handler
#define uart1_rx_timeout_irq_handler UART1_RxTimeout_IRQHandler
/* CMSDK Timers */
#define CMSDK_TIMER0_NS
#define CMSDK_TIMER0_DEV CMSDK_TIMER0_DEV_NS
#define CMSDK_TIMER1_NS
/* GPIO */
#define GPIO0_CMSDK_NS
#define GPIO0_CMSDK_DEV GPIO0_CMSDK_DEV_NS;
/* GP Timer */
#define GP_TIMER_NS
#define GP_TIMER_DEV GP_TIMER_DEV_NS
#define GP_TIMER_ALARM0_IRQ GpTimer0_IRQn
#define GP_TIMER_IRQ0_HANDLER GpTimer0_IRQHandler
#define GP_TIMER_ALARM_NR TIMER_GP_READ_ALARM_0
#define GP_TIMER_FREQ_HZ 32768UL /* System Ref Clock */
#define GP_TIMER_BIT_WIDTH 32U
/**
* mbed usec high-resolution ticker configuration
*/
#define USEC_TIMER_DEV CMSDK_TIMER0_DEV_NS
#define usec_interval_irq_handler TIMER0_IRQHandler
#define USEC_INTERVAL_IRQ TIMER0_IRQn
/** Timer frequency is equal to SYSTEM_CLOCK, defined in system_core_clk.c */
#define TIMER_FREQ_HZ 40960000U
/** The us Ticker uses CMSDK Timer, that does not have HW prescaler.
* The reported shift define is necessary for the software emulated
* prescaler behavior, so the ticker works as if it was ticking on a
* virtually slower frequency. The value 5 sets up the ticker to work
* properly in the specified frequency interval.
*/
#define USEC_REPORTED_SHIFT 6
#define USEC_REPORTED_FREQ_HZ (TIMER_FREQ_HZ >> USEC_REPORTED_SHIFT)
#define USEC_REPORTED_BITS (32 - USEC_REPORTED_SHIFT)
#define UART_DEFAULT_BAUD_RATE 9600U
#endif // TARGET_MUSCA_B1_NS
#endif /* __ARM_LTD_DEVICE_CFG_H__ */
| 30.556391 | 79 | 0.756398 |
313148cd25f2f21ad9de38539fef653810e35ea0 | 6,828 | h | C | Read Only/gdb-6.8/opcodes/mcore-opc.h | samyvic/OS-Project | 1622bc1641876584964effd91d65ef02e92728e1 | [
"Apache-2.0"
] | null | null | null | Read Only/gdb-6.8/opcodes/mcore-opc.h | samyvic/OS-Project | 1622bc1641876584964effd91d65ef02e92728e1 | [
"Apache-2.0"
] | null | null | null | Read Only/gdb-6.8/opcodes/mcore-opc.h | samyvic/OS-Project | 1622bc1641876584964effd91d65ef02e92728e1 | [
"Apache-2.0"
] | null | null | null | /* Assembler instructions for Motorola's Mcore processor
Copyright 1999, 2000, 2002, 2007 Free Software Foundation, Inc.
This file is part of the GNU opcodes library.
This library 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 3, or (at your option)
any later version.
It is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
MA 02110-1301, USA. */
#include "ansidecl.h"
typedef enum
{
O0, OT, O1, OC, O2, X1, OI, OB,
OMa, SI, I7, LS, BR, BL, LR, LJ,
RM, RQ, JSR, JMP, OBRa, OBRb, OBRc, OBR2,
O1R1, OMb, OMc, SIa,
MULSH, OPSR,
JC, JU, JL, RSI, DO21, OB2
}
mcore_opclass;
typedef struct inst
{
char * name;
mcore_opclass opclass;
unsigned char transfer;
unsigned short inst;
}
mcore_opcode_info;
#ifdef DEFINE_TABLE
const mcore_opcode_info mcore_table[] =
{
{ "bkpt", O0, 0, 0x0000 },
{ "sync", O0, 0, 0x0001 },
{ "rte", O0, 1, 0x0002 },
{ "rfe", O0, 1, 0x0002 },
{ "rfi", O0, 1, 0x0003 },
{ "stop", O0, 0, 0x0004 },
{ "wait", O0, 0, 0x0005 },
{ "doze", O0, 0, 0x0006 },
{ "idly4", O0, 0, 0x0007 },
{ "trap", OT, 0, 0x0008 },
/* SPACE: 0x000C - 0x000F */
/* SPACE: 0x0010 - 0x001F */
{ "mvc", O1, 0, 0x0020 },
{ "mvcv", O1, 0, 0x0030 },
{ "ldq", RQ, 0, 0x0040 },
{ "stq", RQ, 0, 0x0050 },
{ "ldm", RM, 0, 0x0060 },
{ "stm", RM, 0, 0x0070 },
{ "dect", O1, 0, 0x0080 },
{ "decf", O1, 0, 0x0090 },
{ "inct", O1, 0, 0x00A0 },
{ "incf", O1, 0, 0x00B0 },
{ "jmp", JMP, 2, 0x00C0 },
#define MCORE_INST_JMP 0x00C0
{ "jsr", JSR, 0, 0x00D0 },
#define MCORE_INST_JSR 0x00E0
{ "ff1", O1, 0, 0x00E0 },
{ "brev", O1, 0, 0x00F0 },
{ "xtrb3", X1, 0, 0x0100 },
{ "xtrb2", X1, 0, 0x0110 },
{ "xtrb1", X1, 0, 0x0120 },
{ "xtrb0", X1, 0, 0x0130 },
{ "zextb", O1, 0, 0x0140 },
{ "sextb", O1, 0, 0x0150 },
{ "zexth", O1, 0, 0x0160 },
{ "sexth", O1, 0, 0x0170 },
{ "declt", O1, 0, 0x0180 },
{ "tstnbz", O1, 0, 0x0190 },
{ "decgt", O1, 0, 0x01A0 },
{ "decne", O1, 0, 0x01B0 },
{ "clrt", O1, 0, 0x01C0 },
{ "clrf", O1, 0, 0x01D0 },
{ "abs", O1, 0, 0x01E0 },
{ "not", O1, 0, 0x01F0 },
{ "movt", O2, 0, 0x0200 },
{ "mult", O2, 0, 0x0300 },
{ "loopt", BL, 0, 0x0400 },
{ "subu", O2, 0, 0x0500 },
{ "sub", O2, 0, 0x0500 }, /* Official alias. */
{ "addc", O2, 0, 0x0600 },
{ "subc", O2, 0, 0x0700 },
/* SPACE: 0x0800-0x08ff for a diadic operation */
/* SPACE: 0x0900-0x09ff for a diadic operation */
{ "movf", O2, 0, 0x0A00 },
{ "lsr", O2, 0, 0x0B00 },
{ "cmphs", O2, 0, 0x0C00 },
{ "cmplt", O2, 0, 0x0D00 },
{ "tst", O2, 0, 0x0E00 },
{ "cmpne", O2, 0, 0x0F00 },
{ "mfcr", OC, 0, 0x1000 },
{ "psrclr", OPSR, 0, 0x11F0 },
{ "psrset", OPSR, 0, 0x11F8 },
{ "mov", O2, 0, 0x1200 },
{ "bgenr", O2, 0, 0x1300 },
{ "rsub", O2, 0, 0x1400 },
{ "ixw", O2, 0, 0x1500 },
{ "and", O2, 0, 0x1600 },
{ "xor", O2, 0, 0x1700 },
{ "mtcr", OC, 0, 0x1800 },
{ "asr", O2, 0, 0x1A00 },
{ "lsl", O2, 0, 0x1B00 },
{ "addu", O2, 0, 0x1C00 },
{ "add", O2, 0, 0x1C00 }, /* Official alias. */
{ "ixh", O2, 0, 0x1D00 },
{ "or", O2, 0, 0x1E00 },
{ "andn", O2, 0, 0x1F00 },
{ "addi", OI, 0, 0x2000 },
#define MCORE_INST_ADDI 0x2000
{ "cmplti", OI, 0, 0x2200 },
{ "subi", OI, 0, 0x2400 },
/* SPACE: 0x2600-0x27ff open for a register+immediate operation */
{ "rsubi", OB, 0, 0x2800 },
{ "cmpnei", OB, 0, 0x2A00 },
{ "bmaski", OMa, 0, 0x2C00 },
{ "divu", O1R1, 0, 0x2C10 },
/* SPACE: 0x2c20 - 0x2c7f */
{ "bmaski", OMb, 0, 0x2C80 },
{ "bmaski", OMc, 0, 0x2D00 },
{ "andi", OB, 0, 0x2E00 },
{ "bclri", OB, 0, 0x3000 },
/* SPACE: 0x3200 - 0x320f */
{ "divs", O1R1, 0, 0x3210 },
/* SPACE: 0x3220 - 0x326f */
{ "bgeni", OBRa, 0, 0x3270 },
{ "bgeni", OBRb, 0, 0x3280 },
{ "bgeni", OBRc, 0, 0x3300 },
{ "bseti", OB, 0, 0x3400 },
{ "btsti", OB, 0, 0x3600 },
{ "xsr", O1, 0, 0x3800 },
{ "rotli", SIa, 0, 0x3800 },
{ "asrc", O1, 0, 0x3A00 },
{ "asri", SIa, 0, 0x3A00 },
{ "lslc", O1, 0, 0x3C00 },
{ "lsli", SIa, 0, 0x3C00 },
{ "lsrc", O1, 0, 0x3E00 },
{ "lsri", SIa, 0, 0x3E00 },
/* SPACE: 0x4000 - 0x5fff */
{ "movi", I7, 0, 0x6000 },
#define MCORE_INST_BMASKI_ALT 0x6000
#define MCORE_INST_BGENI_ALT 0x6000
{ "mulsh", MULSH, 0, 0x6800 },
{ "muls.h", MULSH, 0, 0x6800 },
/* SPACE: 0x6900 - 0x6FFF */
{ "jmpi", LJ, 1, 0x7000 },
{ "jsri", LJ, 0, 0x7F00 },
#define MCORE_INST_JMPI 0x7000
{ "lrw", LR, 0, 0x7000 },
#define MCORE_INST_JSRI 0x7F00
{ "ld", LS, 0, 0x8000 },
{ "ldw", LS, 0, 0x8000 },
{ "ld.w", LS, 0, 0x8000 },
{ "st", LS, 0, 0x9000 },
{ "stw", LS, 0, 0x9000 },
{ "st.w", LS, 0, 0x9000 },
{ "ldb", LS, 0, 0xA000 },
{ "ld.b", LS, 0, 0xA000 },
{ "stb", LS, 0, 0xB000 },
{ "st.b", LS, 0, 0xB000 },
{ "ldh", LS, 0, 0xC000 },
{ "ld.h", LS, 0, 0xC000 },
{ "sth", LS, 0, 0xD000 },
{ "st.h", LS, 0, 0xD000 },
{ "bt", BR, 0, 0xE000 },
{ "bf", BR, 0, 0xE800 },
{ "br", BR, 1, 0xF000 },
#define MCORE_INST_BR 0xF000
{ "bsr", BR, 0, 0xF800 },
#define MCORE_INST_BSR 0xF800
/* The following are relaxable branches */
{ "jbt", JC, 0, 0xE000 },
{ "jbf", JC, 0, 0xE800 },
{ "jbr", JU, 1, 0xF000 },
{ "jbsr", JL, 0, 0xF800 },
/* The following are aliases for other instructions */
{ "rts", O0, 2, 0x00CF }, /* jmp r15 */
{ "rolc", DO21, 0, 0x0600 }, /* addc rd,rd */
{ "rotlc", DO21, 0, 0x0600 }, /* addc rd,rd */
{ "setc", O0, 0, 0x0C00 }, /* cmphs r0,r0 */
{ "clrc", O0, 0, 0x0F00 }, /* cmpne r0,r0 */
{ "tstle", O1, 0, 0x2200 }, /* cmplti rd,1 */
{ "cmplei", OB, 0, 0x2200 }, /* cmplei rd,X -> cmplti rd,X+1 */
{ "neg", O1, 0, 0x2800 }, /* rsubi rd,0 */
{ "tstne", O1, 0, 0x2A00 }, /* cmpnei rd,0 */
{ "tstlt", O1, 0, 0x37F0 }, /* btsti rx,31 */
{ "mclri", OB2, 0, 0x3000 }, /* bclri rx,log2(imm) */
{ "mgeni", OBR2, 0, 0x3200 }, /* bgeni rx,log2(imm) */
{ "mseti", OB2, 0, 0x3400 }, /* bseti rx,log2(imm) */
{ "mtsti", OB2, 0, 0x3600 }, /* btsti rx,log2(imm) */
{ "rori", RSI, 0, 0x3800 },
{ "rotri", RSI, 0, 0x3800 },
{ "nop", O0, 0, 0x1200 }, /* mov r0, r0 */
{ 0, 0, 0, 0 }
};
#endif
| 32.207547 | 71 | 0.52065 |
313247443738c31881619f9a1c04f0ac3df14d5a | 411 | h | C | Phoenix/SearchNeighbourFactory.h | satypro/Phoenix | e8a99d9511c8358a46885d5da261660af55f6208 | [
"MIT"
] | 1 | 2021-01-22T14:24:08.000Z | 2021-01-22T14:24:08.000Z | Phoenix/SearchNeighbourFactory.h | satypro/Phoenix | e8a99d9511c8358a46885d5da261660af55f6208 | [
"MIT"
] | null | null | null | Phoenix/SearchNeighbourFactory.h | satypro/Phoenix | e8a99d9511c8358a46885d5da261660af55f6208 | [
"MIT"
] | null | null | null | #pragma once
#include<map>
#include "SearchNeighbour.h"
#include "SearchStructure.h"
class SearchNeighbourFactory
{
public:
SearchNeighbourFactory();
~SearchNeighbourFactory();
static SearchNeighbour* GetNeighbourSearchDataStructure(SearchStructure option);
private:
static std::map<SearchStructure, SearchNeighbour*> _neighbourSearchMap;
static SearchNeighbour* GetInstance(SearchStructure structure);
}; | 27.4 | 81 | 0.827251 |
3132fdff179261af86fa064f5187e0020ca6c6eb | 688 | h | C | historical implementations/TWOS/TWOS Source Code/tape-contents/twcur/applications/warpnet/warpnet.h | rebcabin/colliding-pucks | 14661d4411fb5a25d52df43f21badd9895d53301 | [
"MIT"
] | 6 | 2018-08-06T17:37:01.000Z | 2019-04-12T17:20:32.000Z | historical implementations/TWOS/TWOS Source Code/tape-contents/twcur/applications/warpnet/warpnet.h | rebcabin/colliding-pucks | 14661d4411fb5a25d52df43f21badd9895d53301 | [
"MIT"
] | 2 | 2018-08-01T03:01:42.000Z | 2018-08-08T05:44:34.000Z | historical implementations/TWOS/TWOS Source Code/tape-contents/twcur/applications/warpnet/warpnet.h | rebcabin/colliding-pucks | 14661d4411fb5a25d52df43f21badd9895d53301 | [
"MIT"
] | null | null | null | /* warpnet.h -- header file for the warpnet object */
/* This uses "warpconst.h" and "warpmsg.h" */
#define init i_warpnet
#define event e_warpnet
#define query q_warpnet
#define term t_warpnet
/* functions used by the event section */
int i_warpnet(), e_warpnet(), q_warpnet(), t_warpnet();
void panic();
Int set_line_pointer();
typedef struct State {
Name_object myself;
Int mynum;
Vtime now1;
Int number_msgs;
Int message_count;
Int creation_count;
Int infobu;
Vtime Seed;
Vtime Creation_Delay;
Int Max_Packet_Size;
Node_Description Node_Map[NUMBER_NODES];
Line_Description Line_Map[NUMBER_LINES];
} State;
| 22.193548 | 56 | 0.686047 |
31343109f08fb938af1e47899da25e8c9720a541 | 329 | h | C | OpenCLFilterPipeline/DeviceWidget.h | SebGrenier/OpenCLFilterPipeline | dbdf08142f211cc4ba6d08fbf07c22ecd6bb872b | [
"MIT"
] | null | null | null | OpenCLFilterPipeline/DeviceWidget.h | SebGrenier/OpenCLFilterPipeline | dbdf08142f211cc4ba6d08fbf07c22ecd6bb872b | [
"MIT"
] | null | null | null | OpenCLFilterPipeline/DeviceWidget.h | SebGrenier/OpenCLFilterPipeline | dbdf08142f211cc4ba6d08fbf07c22ecd6bb872b | [
"MIT"
] | null | null | null | #pragma once
#include <QWidget>
#include <QComboBox>
#include <QLayout>
class DeviceWidget : public QWidget
{
Q_OBJECT
public:
explicit DeviceWidget(QWidget *parent = 0);
virtual ~DeviceWidget();
private slots:
void OnDeviceListActivated(int index);
private:
QComboBox *_device_list;
QVBoxLayout *_vertical_layout;
};
| 15.666667 | 44 | 0.762918 |
3134f117f024d4fc585af07f16e9056954d6960f | 1,399 | c | C | lib/my/my_getnbr_base.c | rectoria/2016_corewar | fe52c44acf8cd97a8481ed5a458db0139fb2153a | [
"MIT"
] | null | null | null | lib/my/my_getnbr_base.c | rectoria/2016_corewar | fe52c44acf8cd97a8481ed5a458db0139fb2153a | [
"MIT"
] | null | null | null | lib/my/my_getnbr_base.c | rectoria/2016_corewar | fe52c44acf8cd97a8481ed5a458db0139fb2153a | [
"MIT"
] | 1 | 2018-10-02T18:35:01.000Z | 2018-10-02T18:35:01.000Z | /*
** my_getnbr_base.c for my_getnbr_base in /home/thibrex/delivery/CPool_Day06/tests
**
** Made by Cornolti Thibaut
** Login <thibrex@epitech.net>
**
** Started on Mon Oct 10 22:15:13 2016 Cornolti Thibaut
** Last update Sun Nov 6 22:20:34 2016 yann probst
*/
#include "my.h"
static int contains_char(char c, char *str)
{
int i;
i = 0;
while (str[i] != 0)
{
if (str[i] == c)
return (1);
i += 1;
}
return (0);
}
static int power(int i, int p)
{
if (p == 0)
return (1);
if (p < 0)
return (0);
return (i * power(i, p - 1));
}
static int my_getnbr_base_rec(char *str, char *base, int wh, int len)
{
int nbr;
int i;
i = 0;
nbr = 0;
if (*str == 0)
return (0);
while (base[i] != 0)
{
if (base[i] == *str)
{
nbr = i * power(len, wh - 1);
return (nbr + my_getnbr_base_rec(str + 1, base, wh - 1, len));
}
else if (base[i + 1] == 0)
return (0);
i += 1;
}
return (nbr + my_getnbr_base_rec(str + 1, base, wh - 1, len));
}
int my_getnbr_base(char *str, char *base)
{
int len;
int i;
int neg;
neg = 1;
i = 0;
while (*str != 0 && (*str == '-' || *str == '+'))
{
if (*str == '-')
neg *= -1;
str += 1;
}
len = 0;
while (base[len] != 0)
len += 1;
while (contains_char(str[i], base) == 1)
i += 1;
return (neg * my_getnbr_base_rec(str, base, i, len));
}
| 17.4875 | 82 | 0.518227 |
31366b53baf99f7ce3bf66717bd8fe3085a3efcb | 1,210 | h | C | cpp/cuts/Cut_hypotour/Cut_hypotour.h | michieluithetbroek/A-MDVRP | fe7739f3961ddb25db8f64ec20472915d3c95168 | [
"MIT"
] | 23 | 2020-04-09T16:33:23.000Z | 2022-03-21T16:41:11.000Z | cpp/cuts/Cut_hypotour/Cut_hypotour.h | michieluithetbroek/A-MDVRP | fe7739f3961ddb25db8f64ec20472915d3c95168 | [
"MIT"
] | 2 | 2020-04-10T11:55:28.000Z | 2020-04-10T12:11:51.000Z | cpp/cuts/Cut_hypotour/Cut_hypotour.h | michieluithetbroek/A-MDVRP | fe7739f3961ddb25db8f64ec20472915d3c95168 | [
"MIT"
] | 10 | 2020-05-28T18:59:52.000Z | 2022-03-10T13:32:44.000Z | #pragma once
#include "./../cut.h"
#include <cvrpsep.h>
class Cut_hypotour: public Cut
{
int const d_nDepots;
int const d_nCustomers;
int const d_nNodes;
int const d_vehicleCap;
std::vector<size_t> const d_iDepots;
std::vector<int> d_lysgard_demand;
public:
Cut_hypotour (int priority, bool lazy, bool user,
bool stopIfFound, bool onlyRootNode, Data const &data)
:
Cut (priority, lazy, user, stopIfFound, onlyRootNode, std::string("hypotour")),
d_nDepots (data.d_nDepots),
d_nCustomers (data.d_nCustomers),
d_nNodes (data.d_nNodes),
d_vehicleCap (data.d_vehicleCap),
d_iDepots (data.d_iDepots),
d_lysgard_demand (data.lysgard_demand())
{};
private:
// ----------------------------
// --- Virtual function ---
// ----------------------------
std::vector<CutReturn> findCuts(std::vector<std::vector<double>> const &x);
// ----------------------------
// --- Helper functions ---
// ----------------------------
CnstrMgrPointer call_lysgard_hypotour(std::vector<std::vector<double>> const &x);
}; | 25.744681 | 98 | 0.539669 |
3137b1b728c90f80291f2c0a6007f1a42d8069e9 | 4,411 | h | C | CacheLoader/cache.h | gallenmu/sheep | 38cea61224e72716d6f3db552c75a19d5bf9ff99 | [
"BSD-2-Clause"
] | 3 | 2017-11-18T11:28:33.000Z | 2020-01-16T18:25:41.000Z | CacheLoader/cache.h | gallenmu/sheep | 38cea61224e72716d6f3db552c75a19d5bf9ff99 | [
"BSD-2-Clause"
] | null | null | null | CacheLoader/cache.h | gallenmu/sheep | 38cea61224e72716d6f3db552c75a19d5bf9ff99 | [
"BSD-2-Clause"
] | null | null | null | #include <stdio.h>
#include <stdlib.h>
#include <inttypes.h>
#include <math.h>
#include <sys/types.h>
#include <unistd.h>
#include <fcntl.h>
#include <sys/stat.h>
#include <sys/mman.h>
#define PADDING 6
/**
* @brief Element of list.
*
* Element of single linked list containing:
* - pointer to next element
* - position of element in array
* - padding to simulate different element sizes
*/
typedef struct element {
struct element* n;
uint64_t position;
uint64_t pad[PADDING];
} element;
/**
* Values for the linear congruential generator
* used for generating randomly connected circular list.
*
* m is chosen to be the size of the list.
* Conditions [http://en.wikipedia.org/wiki/Linear_congruential_generator]:
* 1. b & m coprime
* 2. a - 1 divisable by all prime factors of m
* 3. a - 1 is multiple of 4, if m is multiple of 4
*/
static uint64_t a = 5;
static uint64_t b = 13681;
/* forward declaration */
element* generate_list(uint64_t size_in_kb, uint8_t use_hugepages);
static element* prepare_list(uint32_t power, uint8_t use_hugepages);
static uint64_t fill_list(element* list, uint64_t size);
static void randomly_connect_list(element* list, uint64_t size, uint64_t seed);
uint64_t iterate_over_list(element* list, uint64_t iter);
uint64_t iterate_over_list_from(element* list, uint64_t start, uint64_t iter);
/**
* @brief Generate a list.
*
* Generate a list with n^2 KB size.
*
* @param size_in_kb size of list in KB
* @param use_hugepages to allocate list in hugepages
*
* @return pointer to list.
*/
element* generate_list(uint64_t size_in_kb, uint8_t use_hugepages) {
/* convert size to exponent and generate list */
size_in_kb *= 1024;
size_in_kb = (uint64_t) log2(size_in_kb);
if (size_in_kb >= 6) {
return prepare_list(size_in_kb - 6, use_hugepages);
} else {
return prepare_list(0, use_hugepages);
}
}
/**
* @brief Build the list.
*
* Allocating memory, filling array with data and randomly connect list.
*
* @param power 2^power specifying size of memory region
* @param use_hugepages to allocate list in hugepages
*
* @return pointer to list
*/
static element* prepare_list(uint32_t power, uint8_t use_hugepages) {
uint64_t size = pow(2, power);
uint64_t memsize = sizeof(element) * size;
printf ("Allocating list with %lu elements of size %lu B using a total memory of %lu B.\n", size, sizeof(element), memsize);
element* list = mmap(NULL, memsize, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0);
if (use_hugepages) {
printf("Allocating memory in hugepages.\n");
madvise(list, memsize, MADV_HUGEPAGE);
} else {
printf("Allocating memory in default sized pages.\n");
madvise(list, memsize, MADV_NORMAL);
}
fill_list(list, size);
randomly_connect_list(list, size, 0);
return list;
}
/**
* @brief Fill list with data.
*
* @param list to fill
* @param size of list
*
* @return sum over all array elements
*/
static uint64_t fill_list(element* list, uint64_t size) {
uint64_t sum = 0;
uint64_t i;
for (i = 0; i < size; ++i) {
list[i].position = i;
sum += list[i].position;
}
return sum;
}
/**
* @brief Connecting a list circular and randomly.
*
* @param list to connect
* @param size of list
* @param seed of random number generator
*/
static void randomly_connect_list(element* list, uint64_t size, uint64_t seed) {
if (seed > size) seed = 0;
uint64_t i = 0;
uint64_t x0 = seed;
for(i = 0; i < size; ++i) {
uint64_t tmp = ((a * x0) + b) % size;
list[x0].n = &list[tmp];
x0 = tmp;
}
}
/**
* @brief Iterate n elements over list.
*
* @param list to iterate
* @param iter number of elements to iterate
*
* @return sum of position value of travelled list elements
*/
inline uint64_t iterate_over_list(element* list, uint64_t iter) {
uint64_t sum = 0;
uint64_t i;
for (i = 0; i < iter; ++i) {
sum += list[i].position;
}
return sum;
}
/**
* @brief Iterate n elements over list starting at specified element.
*
* @param list to iterate
* @param start element to begin iteration
* @param iter number of element to iterate
*
* @return position value of current list element
*/
inline uint64_t iterate_over_list_from(element* list, uint64_t start, uint64_t iter) {
uint64_t i;
element* currentElement = &list[start];
for (i = 0; i < iter; ++i) {
currentElement = currentElement->n;
}
return currentElement->position;
}
| 24.370166 | 125 | 0.697801 |
3138498807d7647347905d4578c7d7252eb89a32 | 528 | h | C | FitBuddyCommon/FitBuddyCommon.h | jneyer/fitbuddy-common | 0f0b002e9b90c25086da36291473f3516db2a739 | [
"Apache-2.0"
] | null | null | null | FitBuddyCommon/FitBuddyCommon.h | jneyer/fitbuddy-common | 0f0b002e9b90c25086da36291473f3516db2a739 | [
"Apache-2.0"
] | null | null | null | FitBuddyCommon/FitBuddyCommon.h | jneyer/fitbuddy-common | 0f0b002e9b90c25086da36291473f3516db2a739 | [
"Apache-2.0"
] | null | null | null | //
// FitBuddyCommon.h
// FitBuddyCommon
//
// Created by John Neyer on 4/23/16.
// Copyright © 2016 John Neyer. All rights reserved.
//
#import <UIKit/UIKit.h>
//! Project version number for FitBuddyCommon.
FOUNDATION_EXPORT double FitBuddyCommonVersionNumber;
//! Project version string for FitBuddyCommon.
FOUNDATION_EXPORT const unsigned char FitBuddyCommonVersionString[];
// In this header, you should import all the public headers of your framework using statements like #import <FitBuddyCommon/PublicHeader.h>
| 26.4 | 139 | 0.772727 |
ebd6932c7bde5b408f8cf253f805b01dee0920db | 1,095 | h | C | fldserver/base/task/sequence_manager/task_queue_selector_logic.h | Hussam-Turjman/FLDServer | eb72efdf99a0f1c5138adcc94970b8d6df3e9536 | [
"BSD-3-Clause"
] | 2 | 2022-03-04T18:34:21.000Z | 2022-03-04T18:34:33.000Z | fldserver/base/task/sequence_manager/task_queue_selector_logic.h | Hussam-Turjman/FLDServer | eb72efdf99a0f1c5138adcc94970b8d6df3e9536 | [
"BSD-3-Clause"
] | null | null | null | fldserver/base/task/sequence_manager/task_queue_selector_logic.h | Hussam-Turjman/FLDServer | eb72efdf99a0f1c5138adcc94970b8d6df3e9536 | [
"BSD-3-Clause"
] | null | null | null | // Copyright 2015 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 BASE_TASK_SEQUENCE_MANAGER_TASK_QUEUE_SELECTOR_LOGIC_H_
#define BASE_TASK_SEQUENCE_MANAGER_TASK_QUEUE_SELECTOR_LOGIC_H_
namespace base
{
namespace sequence_manager
{
namespace internal
{
// Used to describe the logic trigerred when a task queue is selected to
// service.
// This enum is used for histograms and should not be renumbered.
enum class TaskQueueSelectorLogic
{
// Selected due to priority rules.
kControlPriorityLogic = 0,
kHighestPriorityLogic = 1,
kHighPriorityLogic = 2,
kNormalPriorityLogic = 3,
kLowPriorityLogic = 4,
kBestEffortPriorityLogic = 5,
// Selected due to starvation logic.
kHighPriorityStarvationLogic = 6,
kNormalPriorityStarvationLogic = 7,
kLowPriorityStarvationLogic = 8,
kCount = 9,
};
} // namespace internal
} // namespace sequence_manager
} // namespace base
#endif // BASE_TASK_SEQUENCE_MANAGER_TASK_QUEUE_SELECTOR_LOGIC_H_
| 26.707317 | 73 | 0.76621 |
ebd71bcd79e3be288ec2402b8de1e4263bce5d34 | 5,704 | h | C | include/fastrtps/rtps/security/accesscontrol/AccessControl.h | grcanosa/Fast-RTPS | a81a5b177cc25cd82efaf710bf7fe2b05d91ffa8 | [
"Apache-2.0"
] | 2 | 2019-03-08T17:38:46.000Z | 2019-07-25T15:01:49.000Z | include/fastrtps/rtps/security/accesscontrol/AccessControl.h | grcanosa/Fast-RTPS | a81a5b177cc25cd82efaf710bf7fe2b05d91ffa8 | [
"Apache-2.0"
] | 3 | 2019-11-14T12:20:06.000Z | 2020-08-07T13:51:10.000Z | include/fastrtps/rtps/security/accesscontrol/AccessControl.h | grcanosa/Fast-RTPS | a81a5b177cc25cd82efaf710bf7fe2b05d91ffa8 | [
"Apache-2.0"
] | 3 | 2018-12-20T17:38:24.000Z | 2019-04-12T07:48:37.000Z | // Copyright 2018 Proyectos y Sistemas de Mantenimiento SL (eProsima).
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
/*!
* @file AccessControl.h
*/
#ifndef __RTPS_SECURITY_ACCESSCONTROL_ACCESSCONTROL_H__
#define __RTPS_SECURITY_ACCESSCONTROL_ACCESSCONTROL_H__
#include "../common/Handle.h"
#include "../../common/Token.h"
namespace eprosima {
namespace fastrtps {
class PartitionQosPolicy;
class ReaderQos;
class WriterQos;
namespace rtps {
class RTPSParticipantAttributes;
class ParticipantProxyData;
class WriterProxyData;
class ReaderProxyData;
namespace security {
class Authentication;
class SecurityException;
struct ParticipantSecurityAttributes;
struct EndpointSecurityAttributes;
class AccessControl
{
public:
virtual ~AccessControl() = default;
virtual PermissionsHandle* validate_local_permissions(Authentication& auth_plugin,
const IdentityHandle& identity,
const uint32_t domain_id,
const RTPSParticipantAttributes& participant_attr,
SecurityException& exception) = 0;
virtual bool get_permissions_token(PermissionsToken** permissions_token, const PermissionsHandle& handle,
SecurityException& exception) = 0;
virtual bool return_permissions_token(PermissionsToken* token, SecurityException& exception) = 0;
virtual bool get_permissions_credential_token(PermissionsCredentialToken** permissions_credential_token,
const PermissionsHandle& handle, SecurityException& exception) = 0;
virtual bool return_permissions_credential_token(PermissionsCredentialToken* token,
SecurityException& exception) = 0;
virtual bool return_permissions_handle(PermissionsHandle* permissions_handle,
SecurityException& exception) = 0;
virtual PermissionsHandle* validate_remote_permissions(Authentication& auth_plugin,
const IdentityHandle& local_identity_handle,
const PermissionsHandle& local_permissions_handle,
const IdentityHandle& remote_identity_handle,
const PermissionsToken& remote_permissions_token,
const PermissionsCredentialToken& remote_credential_token,
SecurityException& exception) = 0;
virtual bool check_create_participant(const PermissionsHandle& local_handle, const uint32_t domain_id,
const RTPSParticipantAttributes& qos, SecurityException& exception) = 0;
virtual bool check_remote_participant(const PermissionsHandle& remote_handle, const uint32_t domain_id,
const ParticipantProxyData&, SecurityException& exception) = 0;
//TODO (Ricardo) Future
/*
virtual bool check_create_datawriter(const PermissionsHandle& local_handle,
const uint32_t domain_id, const std::string& topic_name,
const WriterQos& qos, const PartitionQosPolicy& partition,
SecurityException& exception) = 0;
virtual bool check_create_datareader(const PermissionsHandle& local_handle,
const uint32_t domain_id, const std::string& topic_name,
const ReaderQos& qos, const PartitionQosPolicy& partition,
SecurityException& exception) = 0;
*/
virtual bool check_create_datawriter(const PermissionsHandle& local_handle,
const uint32_t domain_id, const std::string& topic_name,
const std::vector<std::string>& partitions, SecurityException& exception) = 0;
virtual bool check_create_datareader(const PermissionsHandle& local_handle,
const uint32_t domain_id, const std::string& topic_name,
const std::vector<std::string>& partitions, SecurityException& exception) = 0;
virtual bool check_remote_datawriter(const PermissionsHandle& remote_handle,
const uint32_t domain_id, const WriterProxyData& publication_data,
SecurityException& exception) = 0;
virtual bool check_remote_datareader(const PermissionsHandle& remote_handle,
const uint32_t domain_id, const ReaderProxyData& subscription_data,
bool& relay_only, SecurityException& exception) = 0;
virtual bool get_participant_sec_attributes(const PermissionsHandle& local_handle,
ParticipantSecurityAttributes& attributes, SecurityException& exception) = 0;
virtual bool get_datawriter_sec_attributes(const PermissionsHandle& permissions_handle,
const std::string& topic_name, const std::vector<std::string>& partitions,
EndpointSecurityAttributes& attributes, SecurityException& exception) = 0;
virtual bool get_datareader_sec_attributes(const PermissionsHandle& permissions_handle,
const std::string& topic_name, const std::vector<std::string>& partitions,
EndpointSecurityAttributes& attributes, SecurityException& exception) = 0;
};
} //namespace security
} //namespace rtps
} //namespace fastrtps
} //namespace eprosima
#endif // __RTPS_SECURITY_ACCESSCONTROL_ACCESSCONTROL_H__
| 42.887218 | 113 | 0.720021 |
ebd79db42ea88f30bf167b1bcdc5e80f5c4daada | 836 | h | C | http_server/event_loop/http_response.h | linqinghuang/posix_learning | 1a22739eda04286475adac99651dd6b1ddfb7e0d | [
"MIT"
] | 1 | 2021-04-18T09:13:41.000Z | 2021-04-18T09:13:41.000Z | http_server/event_loop/http_response.h | linqinghuang/posix_learning | 1a22739eda04286475adac99651dd6b1ddfb7e0d | [
"MIT"
] | null | null | null | http_server/event_loop/http_response.h | linqinghuang/posix_learning | 1a22739eda04286475adac99651dd6b1ddfb7e0d | [
"MIT"
] | 1 | 2021-04-18T09:13:45.000Z | 2021-04-18T09:13:45.000Z | //
// Created by lin on 2020/10/6.
//
#ifndef LINS_HTTP_SERVER_HTTP_RESPONSE_H
#define LINS_HTTP_SERVER_HTTP_RESPONSE_H
#include "common.h"
#include "buffer.h"
#define INIT_RESPONSE_HEADER_SIZE 128
struct response_header {
char *key;
char *value;
};
enum HttpStatusCode {
Unknown,
OK = 200,
MovedPermanently = 301,
BadRequest = 400,
NotFound = 404,
};
struct http_response {
enum HttpStatusCode statusCode;
char *statusMessage;
char *contentType;
char *body;
struct response_header *response_headers;
int response_headers_number;
int keep_connected;
};
struct http_response *http_response_new();
void http_response_encode_buffer(struct http_response *httpResponse, struct buffer *buffer);
#endif //LINS_HTTP_SERVER_HTTP_RESPONSE_H
| 20.390244 | 93 | 0.704545 |
ebd7f26094a7d215e0edadca4e3e39b0f1c01079 | 17,659 | c | C | head/lib/libdwarf/dwarf_init.c | dplbsd/soc2013 | c134f5e2a5725af122c94005c5b1af3720706ce3 | [
"BSD-2-Clause"
] | null | null | null | head/lib/libdwarf/dwarf_init.c | dplbsd/soc2013 | c134f5e2a5725af122c94005c5b1af3720706ce3 | [
"BSD-2-Clause"
] | null | null | null | head/lib/libdwarf/dwarf_init.c | dplbsd/soc2013 | c134f5e2a5725af122c94005c5b1af3720706ce3 | [
"BSD-2-Clause"
] | null | null | null | /*-
* Copyright (c) 2007 John Birrell (jb@freebsd.org)
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $FreeBSD: soc2013/dpl/head/lib/libdwarf/dwarf_init.c 243024 2012-10-22 03:00:37Z eadler $
*/
#include <stdlib.h>
#include <string.h>
#include "_libdwarf.h"
static const char *debug_snames[DWARF_DEBUG_SNAMES] = {
".debug_abbrev",
".debug_aranges",
".debug_frame",
".debug_info",
".debug_line",
".debug_pubnames",
".eh_frame",
".debug_macinfo",
".debug_str",
".debug_loc",
".debug_pubtypes",
".debug_ranges",
".debug_static_func",
".debug_static_vars",
".debug_types",
".debug_weaknames",
".symtab",
".strtab"
};
static uint64_t (*dwarf_read) (Elf_Data **, uint64_t *, int);
static void (*dwarf_write) (Elf_Data **, uint64_t *, uint64_t, int);
static uint64_t
dwarf_read_lsb(Elf_Data **dp, uint64_t *offsetp, int bytes_to_read)
{
uint64_t ret = 0;
uint8_t *src = (uint8_t *) (*dp)->d_buf + *offsetp;
switch (bytes_to_read) {
case 8:
ret |= ((uint64_t) src[4]) << 32 | ((uint64_t) src[5]) << 40;
ret |= ((uint64_t) src[6]) << 48 | ((uint64_t) src[7]) << 56;
case 4:
ret |= ((uint64_t) src[2]) << 16 | ((uint64_t) src[3]) << 24;
case 2:
ret |= ((uint64_t) src[1]) << 8;
case 1:
ret |= src[0];
break;
default:
return 0;
break;
}
*offsetp += bytes_to_read;
return ret;
}
static uint64_t
dwarf_read_msb(Elf_Data **dp, uint64_t *offsetp, int bytes_to_read)
{
uint64_t ret = 0;
uint8_t *src = (uint8_t *) (*dp)->d_buf + *offsetp;
switch (bytes_to_read) {
case 1:
ret = src[0];
break;
case 2:
ret = src[1] | ((uint64_t) src[0]) << 8;
break;
case 4:
ret = src[3] | ((uint64_t) src[2]) << 8;
ret |= ((uint64_t) src[1]) << 16 | ((uint64_t) src[0]) << 24;
break;
case 8:
ret = src[7] | ((uint64_t) src[6]) << 8;
ret |= ((uint64_t) src[5]) << 16 | ((uint64_t) src[4]) << 24;
ret |= ((uint64_t) src[3]) << 32 | ((uint64_t) src[2]) << 40;
ret |= ((uint64_t) src[1]) << 48 | ((uint64_t) src[0]) << 56;
break;
default:
return 0;
break;
}
*offsetp += bytes_to_read;
return ret;
}
static void
dwarf_write_lsb(Elf_Data **dp, uint64_t *offsetp, uint64_t value, int bytes_to_write)
{
uint8_t *dst = (uint8_t *) (*dp)->d_buf + *offsetp;
switch (bytes_to_write) {
case 8:
dst[7] = (value >> 56) & 0xff;
dst[6] = (value >> 48) & 0xff;
dst[5] = (value >> 40) & 0xff;
dst[4] = (value >> 32) & 0xff;
case 4:
dst[3] = (value >> 24) & 0xff;
dst[2] = (value >> 16) & 0xff;
case 2:
dst[1] = (value >> 8) & 0xff;
case 1:
dst[0] = value & 0xff;
break;
default:
return;
break;
}
*offsetp += bytes_to_write;
}
static void
dwarf_write_msb(Elf_Data **dp, uint64_t *offsetp, uint64_t value, int bytes_to_write)
{
uint8_t *dst = (uint8_t *) (*dp)->d_buf + *offsetp;
switch (bytes_to_write) {
case 8:
dst[7] = value & 0xff;
dst[6] = (value >> 8) & 0xff;
dst[5] = (value >> 16) & 0xff;
dst[4] = (value >> 24) & 0xff;
value >>= 32;
case 4:
dst[3] = value & 0xff;
dst[2] = (value >> 8) & 0xff;
value >>= 16;
case 2:
dst[1] = value & 0xff;
value >>= 8;
case 1:
dst[0] = value & 0xff;
break;
default:
return;
break;
}
*offsetp += bytes_to_write;
}
static int64_t
dwarf_read_sleb128(Elf_Data **dp, uint64_t *offsetp)
{
int64_t ret = 0;
uint8_t b;
int shift = 0;
uint8_t *src = (uint8_t *) (*dp)->d_buf + *offsetp;
do {
b = *src++;
ret |= ((b & 0x7f) << shift);
(*offsetp)++;
shift += 7;
} while ((b & 0x80) != 0);
if (shift < 32 && (b & 0x40) != 0)
ret |= (-1 << shift);
return ret;
}
static uint64_t
dwarf_read_uleb128(Elf_Data **dp, uint64_t *offsetp)
{
uint64_t ret = 0;
uint8_t b;
int shift = 0;
uint8_t *src = (uint8_t *) (*dp)->d_buf + *offsetp;
do {
b = *src++;
ret |= ((b & 0x7f) << shift);
(*offsetp)++;
shift += 7;
} while ((b & 0x80) != 0);
return ret;
}
static const char *
dwarf_read_string(Elf_Data **dp, uint64_t *offsetp)
{
char *ret;
char *src = (char *) (*dp)->d_buf + *offsetp;
ret = src;
while (*src != '\0' && *offsetp < (*dp)->d_size) {
src++;
(*offsetp)++;
}
if (*src == '\0' && *offsetp < (*dp)->d_size)
(*offsetp)++;
return ret;
}
static uint8_t *
dwarf_read_block(Elf_Data **dp, uint64_t *offsetp, uint64_t length)
{
uint8_t *ret;
uint8_t *src = (char *) (*dp)->d_buf + *offsetp;
ret = src;
(*offsetp) += length;
return ret;
}
static int
dwarf_apply_relocations(Dwarf_Debug dbg, Elf_Data *reld, int secindx)
{
Elf_Data *d;
GElf_Rela rela;
int indx = 0;
int ret = DWARF_E_NONE;
uint64_t offset;
/* Point to the data to be relocated: */
d = dbg->dbg_s[secindx].s_data;
/* Enter a loop to process each relocation addend: */
while (gelf_getrela(reld, indx++, &rela) != NULL) {
GElf_Sym sym;
Elf64_Xword symindx = ELF64_R_SYM(rela.r_info);
if (gelf_getsym(dbg->dbg_s[DWARF_symtab].s_data, symindx, &sym) == NULL) {
printf("Couldn't find symbol index %lu for relocation\n",(u_long) symindx);
continue;
}
offset = rela.r_offset;
dwarf_write(&d, &offset, rela.r_addend, dbg->dbg_offsize);
}
return ret;
}
static int
dwarf_relocate(Dwarf_Debug dbg, Dwarf_Error *error)
{
Elf_Scn *scn = NULL;
GElf_Shdr shdr;
int i;
int ret = DWARF_E_NONE;
/* Look for sections which relocate the debug sections. */
while ((scn = elf_nextscn(dbg->dbg_elf, scn)) != NULL) {
if (gelf_getshdr(scn, &shdr) == NULL) {
DWARF_SET_ELF_ERROR(error, elf_errno());
return DWARF_E_ELF;
}
if (shdr.sh_type != SHT_RELA || shdr.sh_size == 0)
continue;
for (i = 0; i < DWARF_DEBUG_SNAMES; i++) {
if (dbg->dbg_s[i].s_shnum == shdr.sh_info &&
dbg->dbg_s[DWARF_symtab].s_shnum == shdr.sh_link) {
Elf_Data *rd;
/* Get the relocation data. */
if ((rd = elf_getdata(scn, NULL)) == NULL) {
DWARF_SET_ELF_ERROR(error, elf_errno());
return DWARF_E_ELF;
}
/* Apply the relocations. */
dwarf_apply_relocations(dbg, rd, i);
break;
}
}
}
return ret;
}
static int
dwarf_init_attr(Dwarf_Debug dbg, Elf_Data **dp, uint64_t *offsetp,
Dwarf_CU cu, Dwarf_Die die, Dwarf_Attribute at, uint64_t form,
Dwarf_Error *error)
{
int ret = DWARF_E_NONE;
struct _Dwarf_AttrValue avref;
memset(&avref, 0, sizeof(avref));
avref.av_attrib = at->at_attrib;
avref.av_form = at->at_form;
switch (form) {
case DW_FORM_addr:
avref.u[0].u64 = dwarf_read(dp, offsetp, cu->cu_pointer_size);
break;
case DW_FORM_block:
avref.u[0].u64 = dwarf_read_uleb128(dp, offsetp);
avref.u[1].u8p = dwarf_read_block(dp, offsetp, avref.u[0].u64);
break;
case DW_FORM_block1:
avref.u[0].u64 = dwarf_read(dp, offsetp, 1);
avref.u[1].u8p = dwarf_read_block(dp, offsetp, avref.u[0].u64);
break;
case DW_FORM_block2:
avref.u[0].u64 = dwarf_read(dp, offsetp, 2);
avref.u[1].u8p = dwarf_read_block(dp, offsetp, avref.u[0].u64);
break;
case DW_FORM_block4:
avref.u[0].u64 = dwarf_read(dp, offsetp, 4);
avref.u[1].u8p = dwarf_read_block(dp, offsetp, avref.u[0].u64);
break;
case DW_FORM_data1:
case DW_FORM_flag:
case DW_FORM_ref1:
avref.u[0].u64 = dwarf_read(dp, offsetp, 1);
break;
case DW_FORM_data2:
case DW_FORM_ref2:
avref.u[0].u64 = dwarf_read(dp, offsetp, 2);
break;
case DW_FORM_data4:
case DW_FORM_ref4:
avref.u[0].u64 = dwarf_read(dp, offsetp, 4);
break;
case DW_FORM_data8:
case DW_FORM_ref8:
avref.u[0].u64 = dwarf_read(dp, offsetp, 8);
break;
case DW_FORM_indirect:
form = dwarf_read_uleb128(dp, offsetp);
return dwarf_init_attr(dbg, dp, offsetp, cu, die, at, form, error);
case DW_FORM_ref_addr:
if (cu->cu_version == 2)
avref.u[0].u64 = dwarf_read(dp, offsetp, cu->cu_pointer_size);
else if (cu->cu_version == 3)
avref.u[0].u64 = dwarf_read(dp, offsetp, dbg->dbg_offsize);
break;
case DW_FORM_ref_udata:
case DW_FORM_udata:
avref.u[0].u64 = dwarf_read_uleb128(dp, offsetp);
break;
case DW_FORM_sdata:
avref.u[0].s64 = dwarf_read_sleb128(dp, offsetp);
break;
case DW_FORM_string:
avref.u[0].s = dwarf_read_string(dp, offsetp);
break;
case DW_FORM_strp:
avref.u[0].u64 = dwarf_read(dp, offsetp, dbg->dbg_offsize);
avref.u[1].s = elf_strptr(dbg->dbg_elf,
dbg->dbg_s[DWARF_debug_str].s_shnum, avref.u[0].u64);
break;
case DW_FORM_flag_present:
/* This form has no value encoded in the DIE. */
avref.u[0].u64 = 1;
break;
default:
DWARF_SET_ERROR(error, DWARF_E_NOT_IMPLEMENTED);
ret = DWARF_E_NOT_IMPLEMENTED;
break;
}
if (ret == DWARF_E_NONE)
ret = dwarf_attrval_add(die, &avref, NULL, error);
return ret;
}
static int
dwarf_init_abbrev(Dwarf_Debug dbg, Dwarf_CU cu, Dwarf_Error *error)
{
Dwarf_Abbrev a;
Elf_Data *d;
int ret = DWARF_E_NONE;
uint64_t attr;
uint64_t entry;
uint64_t form;
uint64_t offset;
uint64_t tag;
u_int8_t children;
d = dbg->dbg_s[DWARF_debug_abbrev].s_data;
offset = cu->cu_abbrev_offset;
while (offset < d->d_size) {
entry = dwarf_read_uleb128(&d, &offset);
/* Check if this is the end of the data: */
if (entry == 0)
break;
tag = dwarf_read_uleb128(&d, &offset);
children = dwarf_read(&d, &offset, 1);
if ((ret = dwarf_abbrev_add(cu, entry, tag, children, &a, error)) != DWARF_E_NONE)
break;
do {
attr = dwarf_read_uleb128(&d, &offset);
form = dwarf_read_uleb128(&d, &offset);
if (attr != 0)
if ((ret = dwarf_attr_add(a, attr, form, NULL, error)) != DWARF_E_NONE)
return ret;
} while (attr != 0);
}
return ret;
}
static int
dwarf_init_info(Dwarf_Debug dbg, Dwarf_Error *error)
{
Dwarf_CU cu;
Elf_Data *d = NULL;
Elf_Scn *scn;
int i;
int level = 0;
int relocated = 0;
int ret = DWARF_E_NONE;
uint64_t length;
uint64_t next_offset;
uint64_t offset = 0;
scn = dbg->dbg_s[DWARF_debug_info].s_scn;
d = dbg->dbg_s[DWARF_debug_info].s_data;
while (offset < d->d_size) {
/* Allocate memory for the first compilation unit. */
if ((cu = calloc(sizeof(struct _Dwarf_CU), 1)) == NULL) {
DWARF_SET_ERROR(error, DWARF_E_MEMORY);
return DWARF_E_MEMORY;
}
/* Save the offet to this compilation unit: */
cu->cu_offset = offset;
length = dwarf_read(&d, &offset, 4);
if (length == 0xffffffff) {
length = dwarf_read(&d, &offset, 8);
dbg->dbg_offsize = 8;
} else
dbg->dbg_offsize = 4;
/*
* Check if there is enough ELF data for this CU.
* This assumes that libelf gives us the entire
* section in one Elf_Data object.
*/
if (length > d->d_size - offset) {
free(cu);
DWARF_SET_ERROR(error, DWARF_E_INVALID_CU);
return DWARF_E_INVALID_CU;
}
/* Relocate the DWARF sections if necessary: */
if (!relocated) {
if ((ret = dwarf_relocate(dbg, error)) != DWARF_E_NONE)
return ret;
relocated = 1;
}
/* Compute the offset to the next compilation unit: */
next_offset = offset + length;
/* Initialise the compilation unit. */
cu->cu_length = length;
cu->cu_header_length = (dbg->dbg_offsize == 4) ? 4 : 12;
cu->cu_version = dwarf_read(&d, &offset, 2);
cu->cu_abbrev_offset = dwarf_read(&d, &offset, dbg->dbg_offsize);
cu->cu_pointer_size = dwarf_read(&d, &offset, 1);
cu->cu_next_offset = next_offset;
/* Initialise the list of abbrevs. */
STAILQ_INIT(&cu->cu_abbrev);
/* Initialise the list of dies. */
STAILQ_INIT(&cu->cu_die);
/* Initialise the hash table of dies. */
for (i = 0; i < DWARF_DIE_HASH_SIZE; i++)
STAILQ_INIT(&cu->cu_die_hash[i]);
/* Add the compilation unit to the list. */
STAILQ_INSERT_TAIL(&dbg->dbg_cu, cu, cu_next);
if (cu->cu_version != 2 && cu->cu_version != 3) {
DWARF_SET_ERROR(error, DWARF_E_CU_VERSION);
ret = DWARF_E_CU_VERSION;
break;
}
/* Parse the .debug_abbrev info for this CU: */
if ((ret = dwarf_init_abbrev(dbg, cu, error)) != DWARF_E_NONE)
break;
level = 0;
while (offset < next_offset && offset < d->d_size) {
Dwarf_Abbrev a;
Dwarf_Attribute at;
Dwarf_Die die;
uint64_t abnum;
uint64_t die_offset = offset;
abnum = dwarf_read_uleb128(&d, &offset);
if (abnum == 0) {
level--;
continue;
}
if ((a = dwarf_abbrev_find(cu, abnum)) == NULL) {
DWARF_SET_ERROR(error, DWARF_E_MISSING_ABBREV);
return DWARF_E_MISSING_ABBREV;
}
if ((ret = dwarf_die_add(cu, level, die_offset,
abnum, a, &die, error)) != DWARF_E_NONE)
return ret;
STAILQ_FOREACH(at, &a->a_attrib, at_next) {
if ((ret = dwarf_init_attr(dbg, &d, &offset,
cu, die, at, at->at_form, error)) != DWARF_E_NONE)
return ret;
}
if (a->a_children == DW_CHILDREN_yes)
level++;
}
offset = next_offset;
}
/* Build the function table. */
dwarf_build_function_table(dbg);
return ret;
}
static int
dwarf_elf_read(Dwarf_Debug dbg, Dwarf_Error *error)
{
GElf_Shdr shdr;
Elf_Scn *scn = NULL;
char *sname;
int i;
int ret = DWARF_E_NONE;
/* Get a copy of the ELF header. */
if (gelf_getehdr(dbg->dbg_elf, &dbg->dbg_ehdr) == NULL) {
DWARF_SET_ELF_ERROR(error, elf_errno());
return DWARF_E_ELF;
}
/* Check the ELF data format: */
switch (dbg->dbg_ehdr.e_ident[EI_DATA]) {
case ELFDATA2MSB:
dwarf_read = dwarf_read_msb;
dwarf_write = dwarf_write_msb;
break;
case ELFDATA2LSB:
case ELFDATANONE:
default:
dwarf_read = dwarf_read_lsb;
dwarf_write = dwarf_write_lsb;
break;
}
/* Get the section index to the string table. */
if (elf_getshstrndx(dbg->dbg_elf, &dbg->dbg_stnum) == 0) {
DWARF_SET_ELF_ERROR(error, elf_errno());
return DWARF_E_ELF;
}
/* Look for the debug sections. */
while ((scn = elf_nextscn(dbg->dbg_elf, scn)) != NULL) {
/* Get a copy of the section header: */
if (gelf_getshdr(scn, &shdr) == NULL) {
DWARF_SET_ELF_ERROR(error, elf_errno());
return DWARF_E_ELF;
}
/* Get a pointer to the section name: */
if ((sname = elf_strptr(dbg->dbg_elf, dbg->dbg_stnum, shdr.sh_name)) == NULL) {
DWARF_SET_ELF_ERROR(error, elf_errno());
return DWARF_E_ELF;
}
/*
* Look up the section name to check if it's
* one we need for DWARF.
*/
for (i = 0; i < DWARF_DEBUG_SNAMES; i++) {
if (strcmp(sname, debug_snames[i]) == 0) {
dbg->dbg_s[i].s_sname = sname;
dbg->dbg_s[i].s_shnum = elf_ndxscn(scn);
dbg->dbg_s[i].s_scn = scn;
memcpy(&dbg->dbg_s[i].s_shdr, &shdr, sizeof(shdr));
if ((dbg->dbg_s[i].s_data = elf_getdata(scn, NULL)) == NULL) {
DWARF_SET_ELF_ERROR(error, elf_errno());
return DWARF_E_ELF;
}
break;
}
}
}
/* Check if any of the required sections are missing: */
if (dbg->dbg_s[DWARF_debug_abbrev].s_scn == NULL ||
dbg->dbg_s[DWARF_debug_info].s_scn == NULL) {
/* Missing debug information. */
DWARF_SET_ERROR(error, DWARF_E_DEBUG_INFO);
return DWARF_E_DEBUG_INFO;
}
/* Initialise the compilation-units: */
ret = dwarf_init_info(dbg, error);
return ret;
}
int
dwarf_elf_init(Elf *elf, int mode, Dwarf_Debug *ret_dbg, Dwarf_Error *error)
{
Dwarf_Debug dbg;
int ret = DWARF_E_NONE;
if (error == NULL)
/* Can only return a generic error. */
return DWARF_E_ERROR;
if (elf == NULL || ret_dbg == NULL) {
DWARF_SET_ERROR(error, DWARF_E_ARGUMENT);
ret = DWARF_E_ARGUMENT;
} else if ((dbg = calloc(sizeof(struct _Dwarf_Debug), 1)) == NULL) {
DWARF_SET_ERROR(error, DWARF_E_MEMORY);
ret = DWARF_E_MEMORY;
} else {
dbg->dbg_elf = elf;
dbg->dbg_elf_close = 0;
dbg->dbg_mode = mode;
STAILQ_INIT(&dbg->dbg_cu);
STAILQ_INIT(&dbg->dbg_func);
*ret_dbg = dbg;
/* Read the ELF sections. */
ret = dwarf_elf_read(dbg, error);
}
return ret;
}
int
dwarf_init(int fd, int mode, Dwarf_Debug *ret_dbg, Dwarf_Error *error)
{
Dwarf_Error lerror;
Elf *elf;
Elf_Cmd c;
int ret;
if (error == NULL)
/* Can only return a generic error. */
return DWARF_E_ERROR;
if (fd < 0 || ret_dbg == NULL) {
DWARF_SET_ERROR(error, DWARF_E_ARGUMENT);
return DWARF_E_ERROR;
}
/* Translate the DWARF mode to ELF mode. */
switch (mode) {
default:
case DW_DLC_READ:
c = ELF_C_READ;
break;
}
if (elf_version(EV_CURRENT) == EV_NONE) {
DWARF_SET_ELF_ERROR(error, elf_errno());
return DWARF_E_ERROR;
}
if ((elf = elf_begin(fd, c, NULL)) == NULL) {
DWARF_SET_ELF_ERROR(error, elf_errno());
return DWARF_E_ERROR;
}
ret = dwarf_elf_init(elf, mode, ret_dbg, error);
if (*ret_dbg != NULL)
/* Remember to close the ELF file. */
(*ret_dbg)->dbg_elf_close = 1;
if (ret != DWARF_E_NONE) {
if (*ret_dbg != NULL) {
dwarf_finish(ret_dbg, &lerror);
} else
elf_end(elf);
}
return ret;
}
| 23.327609 | 92 | 0.65502 |
ebd8ead1bb63e52a81fc73eb847fbb9cf5861273 | 345 | h | C | linsched-linsched-alpha/include/linux/netfilter_ipv6/ip6t_HL.h | usenixatc2021/SoftRefresh_Scheduling | 589ba06c8ae59538973c22edf28f74a59d63aa14 | [
"MIT"
] | 1,178 | 2020-09-10T17:15:42.000Z | 2022-03-31T14:59:35.000Z | linsched-linsched-alpha/include/linux/netfilter_ipv6/ip6t_HL.h | usenixatc2021/SoftRefresh_Scheduling | 589ba06c8ae59538973c22edf28f74a59d63aa14 | [
"MIT"
] | 5 | 2020-04-04T09:24:09.000Z | 2020-04-19T12:33:55.000Z | linsched-linsched-alpha/include/linux/netfilter_ipv6/ip6t_HL.h | usenixatc2021/SoftRefresh_Scheduling | 589ba06c8ae59538973c22edf28f74a59d63aa14 | [
"MIT"
] | 107 | 2020-09-10T17:29:30.000Z | 2022-03-18T09:00:14.000Z | /* Hop Limit modification module for ip6tables
* Maciej Soltysiak <solt@dns.toxicfilms.tv>
* Based on HW's TTL module */
#ifndef _IP6T_HL_H
#define _IP6T_HL_H
#include <linux/types.h>
enum {
IP6T_HL_SET = 0,
IP6T_HL_INC,
IP6T_HL_DEC
};
#define IP6T_HL_MAXMODE IP6T_HL_DEC
struct ip6t_HL_info {
__u8 mode;
__u8 hop_limit;
};
#endif
| 13.8 | 46 | 0.73913 |
ebda21fc64f25f2521a8d32d21db445f9e8fd8b8 | 47,171 | h | C | include/goinglogging.h | ember91/goinglogging | 1f95585773fdb80b07c1ab0684d233e2d200dbd7 | [
"MIT"
] | null | null | null | include/goinglogging.h | ember91/goinglogging | 1f95585773fdb80b07c1ab0684d233e2d200dbd7 | [
"MIT"
] | null | null | null | include/goinglogging.h | ember91/goinglogging | 1f95585773fdb80b07c1ab0684d233e2d200dbd7 | [
"MIT"
] | null | null | null | /** \mainpage
* \brief Lightweight logging library.
*
* \section section_description Description
*
* \e goinglogging is an open source, lightweight, multiplatform, single header
* C++11 library that logs information to command line or file. This is useful
* when debugging realtime systems where compiling with debug symbols and/or a
* low optimization level will slow down the program too much. This library is
* designed to make it as effortless as possible to output the name and value
* of a variable.
*
* \note goinglogging is a logging library for debugging when a debugger is a
* worse alternative. It is not for heavy logging. Use a proper library for
* that.
*
* goinglogging is MIT-licensed.
*
* \author Emil Berg
*
* \section section_usage Usage
*
* \code
* #include "goinglogging.h"
* \endcode
*
* \subsection section_a_variable A variable
* \code
* int i = 1;
* l(i);
* \endcode
* Which outputs:
* \code
* i = 1
* \endcode
* \sa l()
*
* \subsection section_multiple_variables Multiple variables
* \code
* int i = 1;
* const char* s = "s";
* l(i, s);
* \endcode
* Which outputs:
* \code
* i = 1, s = "s"
* \endcode
* \sa l()
*
* \subsection section_array Array
* \code
* int i[] = {0, 1, 2};
* l_arr(i, 3);
* \endcode
* \sa l_arr()
*
* \subsection section_matrix Matrix
* \code
* int i[][] = {{0, 11}, {22, 33}};
* l_mat(i, 2, 2);
* \endcode
* \sa l_mat()
*
* \subsection section_custom_objects Custom objects
* Can output any object with an overloaded << operator.
*
* \subsection section_prefixes Prefixes
* Output file, line, and other information by using:
* \code
* gl::set_prefixes(gl::prefix::FILE | gl::prefix::LINE);
* int i = 1;
* l(i);
* \endcode
* Which outputs:
* \code
* my_file:68: i = 1
* \endcode
* \sa set_prefixes()
*
* \subsection section_disabled_output Disable output
* \code
* gl::set_output_enabled(false);
* \endcode
* \sa set_output_enabled()
*
* \subsection section_flush_output Flush output
* goinglogging will not flush output by default. To ensure it flushes, use:
* \code
* #define GL_NEWLINE std::endl
* #include "goinglogging.h"
* \endcode
*
* \subsection section_redirect Redirect
* Redirect output to file:
* \code
* std::ofstream f("f.txt");
* std::cout.rdbuf(f.rdbuf());
* \endcode
*
* \subsection section_color Color
* Enable colored output in terminals that support ANSI control sequences:
* \code
* gl::set_color_enabled(true);
* \endcode
* \sa set_color_enabled()
*
*/
/** \file
*
* \brief Lightweight logging library.
*
*/
#ifndef INCLUDE_GOINGLOGGING_H_
#define INCLUDE_GOINGLOGGING_H_
#include <array>
#include <chrono>
#include <codecvt>
#include <complex>
#include <cstring>
#include <ctime>
#include <deque>
#include <forward_list>
#include <iomanip>
#include <ios>
#include <iostream>
#include <list>
#include <map>
#include <memory>
#include <ostream>
#include <queue>
#include <ratio>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <thread>
#include <unordered_map>
#include <unordered_set>
#include <valarray>
#include <vector>
#ifdef __GNUC__
#include <cxxabi.h>
#endif // __GNUC__
/**
* \brief Log variables.
*
* Use as:
* \code
* int i = 1;
* l(i);
* std::string s("s");
* l(i, s);
* \endcode
* Which outputs:
* \code
* i = 1, s = "s"
* \endcode
*
* \note Supports up to 16 variables as parameters.
* \note Uses prefix information set with \ref set_prefixes().
*
* \sa l_arr() \sa l_mat() \sa set_prefixes()
*
*/
#define l(...) \
do { \
if (::gl::internal::outputEnabled) { \
std::cout << gl::internal::color_start \
<< gl::internal::PrefixFormatter( \
__FILE__, __LINE__, __func__) \
<< GL_INTERNAL_L_DISPATCH(__VA_ARGS__, GL_INTERNAL_L16, \
GL_INTERNAL_L15, GL_INTERNAL_L14, \
GL_INTERNAL_L13, GL_INTERNAL_L12, \
GL_INTERNAL_L11, GL_INTERNAL_L10, GL_INTERNAL_L9, \
GL_INTERNAL_L8, GL_INTERNAL_L7, GL_INTERNAL_L6, \
GL_INTERNAL_L5, GL_INTERNAL_L4, GL_INTERNAL_L3, \
GL_INTERNAL_L2, GL_INTERNAL_L1, )(__VA_ARGS__) \
<< gl::internal::color_end << (GL_NEWLINE); \
} \
} while (false)
/**
* \brief Log array.
*
* \param v Array to print [\p len].
* \param len Number of elements.
*
* Used as:
* \code
* int a[] = {0, 1, 2};
* l_arr(a, 3);
* \endcode
*
* Which outputs:
* \code
* a = {0, 1, 2}
* \endcode
*
* \note Uses prefix information set with \ref set_prefixes().
* \note Unlike \ref l(), this does not support multiple varaibles as
* parameters.
*
* \warning Behaviour is undefined if \p len is larger than the
* allocated array.
*
* \sa l() \sa l_mat() \sa set_prefixes()
*
*/
#define l_arr(v, len) \
do { \
std::cout << ::gl::internal::make_array((#v), (v), (len), \
::gl::internal::PrefixFormatter(__FILE__, __LINE__, __func__)); \
} while (false)
/**
* \brief Log matrix.
*
* \param m Matrix to print [\p rows x \p cols].
* \param cols Number of columns in matrix.
* \param rows Number of rows in matrix.
*
* Used as:
* \code
* int m[][] = {{11, 12}, {21, 22}};
* l_mat(m, 2, 2);
* \endcode
*
* Which outputs:
* \code
* m: [0,0] = 11, [0,1] = 12, [1,0] = 21, [1,1] = 22
* \endcode
*
* \note Uses prefix information set with \ref set_prefixes().
* \note Unlike \ref l(), this does not support multiple variables
* as parameters.
*
* \warning Behaviour is undefined if \p c or \p r is larger than
* the allocated matrix.
*
* \sa l() \sa l_arr() \sa set_prefixes()
*
*/
#define l_mat(m, cols, rows) \
do { \
std::cout << ::gl::internal::make_matrix((#m), (m), (cols), (rows), \
::gl::internal::PrefixFormatter(__FILE__, __LINE__, __func__)); \
} while (false)
#ifndef GL_NEWLINE
/**
* \brief Newline character to use after each logging message.
*
* May e.g. be changed to std::endl to enable flush after each
* logging message:
* \code
* #define GL_NEWLINE std::endl
* #include "goinglogging.h"
* \endcode
*
* \note Defaults to \\n, i.e. no flushing.
*
* \sa l() \sa l_arr() \sa l_mat()
*
*/
#define GL_NEWLINE '\n'
#endif // GL_NEWLINE
/**
* \brief goinglogging namespace. */
namespace gl {
/**
* \brief Prefix of logging output.
*
* Use bitwise \c or for multiple prefixes at the same time:
* \code
* gl::set_prefixes(gl::prefix::FILE | gl::prefix::LINE);
* \endcode
* Bitwise \c and as well as \c xor are also supported.
*
* \sa set_prefixes() \sa get_prefixes()
*
*/
enum class prefix : uint32_t {
NONE = 0, /**< No prefix. */
FILE = 1 << 0, /**< File name. For example 'main.cpp'. */
LINE = 1 << 1, /**< Line number in file. For example 'Line:
16'. */
FUNCTION = 1 << 2, /**< Function name. For example 'calculate()'. */
TIME = 1 << 3, /**< Current local time as
* hour:minute:second.millisecond.
* For example '10:02:13.057'. */
THREAD = 1 << 4, /**< ID of current thread. For example
'TID: 12'. */
TYPE_NAME = 1 << 5 /**< Name of type. For example 'int'. */
};
/**
* \brief Bitwise \c and of logging prefix settings.
*
* \param lhs First element.
* \param rhs Second element.
* \return Bitwise \c and of \p lhs and \p rhs.
*
* \sa prefix \sa set_prefixes()
*
*/
inline prefix operator&(prefix lhs, prefix rhs) noexcept {
return static_cast<prefix>(
static_cast<uint32_t>(lhs) & static_cast<uint32_t>(rhs));
}
/**
* \brief Bitwise \c and of logging prefix settings.
*
* \param lhs First element.
* \param rhs Second element.
* \return Bitwise \c and of \p lhs and \p rhs.
*
* \sa prefix \sa set_prefixes()
*
*/
inline prefix& operator&=(prefix& lhs, prefix rhs) noexcept {
return lhs = lhs & rhs;
}
/**
* \brief Bitwise \c or of logging prefix settings.
*
* \param lhs First element.
* \param rhs Second element.
* \return Bitwise \c or of \p lhs and \p rhs.
*
* \sa prefix \sa set_prefixes()
*
*/
inline prefix operator|(prefix lhs, prefix rhs) noexcept {
return static_cast<prefix>(
static_cast<uint32_t>(lhs) | static_cast<uint32_t>(rhs));
}
/**
* \brief Bitwise \c or of logging prefix settings.
*
* \param lhs First element.
* \param rhs Second element.
* \return Bitwise \c or of \p lhs and \p rhs.
*
* \sa prefix \sa set_prefixes()
*
*/
inline prefix& operator|=(prefix& lhs, prefix rhs) noexcept {
return lhs = lhs | rhs;
}
/**
* \brief Bitwise \c xor of logging prefix settings.
*
* \param lhs First element.
* \param rhs Second element.
* \return Bitwise \c xor of \p lhs and \p rhs.
*
* \sa prefix \sa set_prefixes()
*
*/
inline prefix operator^(prefix lhs, prefix rhs) noexcept {
return static_cast<prefix>(
static_cast<uint32_t>(lhs) ^ static_cast<uint32_t>(rhs));
}
/**
* \brief Bitwise \c xor of logging prefix settings.
*
* \param lhs First element.
* \param rhs Second element.
* \return Bitwise \c xor of \p lhs and \p rhs.
*
* \sa prefix \sa set_prefixes()
*
*/
inline prefix& operator^=(prefix& lhs, prefix rhs) noexcept {
return lhs = lhs ^ rhs;
}
/**
* \brief Hide this section from doxygen */
#ifndef DOXYGEN_HIDDEN
/**
* \brief Functionality in this namespace is for internal use
*/
namespace internal {
#ifdef __GNUC__
/**
* \brief Demangler of variable type names.
*/
class Demangler {
public:
/**
* \brief Constructor.
*/
Demangler() : m_buf(nullptr), m_buf_len(0) {
}
/**
* \brief Destructor. Free any allocated memory.
*/
~Demangler() {
// OK even if buf = nullptr
free(m_buf);
}
/**
* \brief Demangle type name.
*
* \param type_name Mangled type name.
* \return Demangled type name.
*/
const char* demangle(const char* type_name) {
// Demangle name
int status = 0;
m_buf = abi::__cxa_demangle(type_name, m_buf, &m_buf_len, &status);
// Check success
switch (status) {
case 0:
// Success. Do nothing.
break;
case -1: {
m_buf = nullptr;
m_buf_len = 0;
std::stringstream ss;
ss << "Demangle: Invalid type name '" << type_name << '\'';
throw std::runtime_error(ss.str());
break;
}
case -2:
m_buf = nullptr;
m_buf_len = 0;
throw std::runtime_error("Demangle: Memory allocation failure");
break;
case -3:
m_buf = nullptr;
m_buf_len = 0;
throw std::runtime_error("Demangle: Invalid argument");
break;
default:
m_buf = nullptr;
m_buf_len = 0;
throw std::runtime_error("Demangle: Unknown error");
break;
}
return m_buf;
}
private:
char* m_buf; /**< Demangle name buffer. Allocated with malloc. */
size_t m_buf_len; /**< Demangle name buffer length. */
};
#endif // __GNUC__
/** Current prefixes */
static prefix curPrefixes = prefix::FILE | prefix::LINE;
/** \c true if output is enabled */
static bool outputEnabled = true;
/** \c true if colored output is enabled */
static bool colorEnabled = false;
#ifdef __GNUC__
static Demangler demangler;
#endif // __GNUC__
/**
* \brief Prefix formatter. */
class PrefixFormatter {
public:
/**
* \brief Constructor.
*
* \param file_path File path including name.
* \param file_line Line number in file.
* \param func Function name.
*
*/
PrefixFormatter(
const char* file_path, long file_line, const char* func) noexcept :
m_file_path(file_path),
m_file_line(file_line), m_func(func) {
}
friend std::ostream& operator<<(
std::ostream& os, const PrefixFormatter& p) noexcept;
/**
* \return File path including name.
*/
const char* get_file_path() const noexcept {
return m_file_path;
}
/**
* \return Line number in file.
*/
long get_file_line_number() const noexcept {
return m_file_line;
}
/**
* \return Function name.
*/
const char* get_function_name() const noexcept {
return m_func;
}
private:
const char* m_file_path; /**< File path including name. */
const long m_file_line; /**< Line number in file. */
const char* m_func; /**< Function name. */
};
/**
* \brief Write to stream.
*
* \param os Output stream.
* \param p PrefixFormatter to output.
* \return Output stream.
*
*/
std::ostream& operator<<(std::ostream& os, const PrefixFormatter& p) noexcept {
/** Number of prefixes written */
uint32_t cnt = 0;
// FILE
if ((curPrefixes & prefix::FILE) != prefix::NONE) {
/** Platform dependent path separator */
const char sep =
#ifdef _WIN32
'\\';
#else
'/';
#endif // _WIN32
/** File path */
const char* path = p.get_file_path();
// Get index of last file path separator
/** Length of string */
size_t str_len = std::strlen(path);
/** File path separator index */
size_t sep_idx = std::numeric_limits<size_t>::max();
// No need to check for str_len = 0 here, since that
// will stop the for loop anyway
for (size_t i = str_len - 1; i != std::numeric_limits<size_t>::max();
--i) {
if (path[i] == sep) {
sep_idx = i;
break;
}
}
// Output
os << (sep_idx == std::numeric_limits<size_t>::max() ?
path :
path + sep_idx + 1);
++cnt;
}
// LINE
if ((curPrefixes & prefix::LINE) != prefix::NONE) {
// Output 'Line' prefix only if file name has not been
// output
if (cnt == 0) {
os << "Line: ";
} else {
os << ":";
}
os << p.get_file_line_number();
++cnt;
}
// FUNCTION
if ((curPrefixes & prefix::FUNCTION) != prefix::NONE) {
if (cnt != 0) {
os << ", ";
}
os << p.get_function_name() << "()";
++cnt;
}
// TIME
if ((curPrefixes & prefix::TIME) != prefix::NONE) {
// Get time
auto now = std::chrono::system_clock::now();
// Convert
std::time_t sinceEpoch = std::chrono::system_clock::to_time_t(now);
auto ms = std::chrono::duration_cast<std::chrono::milliseconds>(
now.time_since_epoch()) %
1000;
std::tm* local = std::localtime(&sinceEpoch);
if (local != nullptr) {
if (cnt != 0) {
os << ", ";
}
// Format and output
os << std::put_time(local, "%H:%M:%S") << '.' << std::setfill('0')
<< std::setw(3) << ms.count();
++cnt;
}
}
// THREAD
if ((curPrefixes & prefix::THREAD) != prefix::NONE) {
if (cnt != 0) {
os << ", ";
}
os << "TID: " << std::this_thread::get_id();
++cnt;
}
// Final separator, if any
if (cnt != 0) {
os << ": ";
}
return os;
}
/**
* \brief Variable value formatter.
*
* \tparam T Value type.
*
*/
template<class T>
class ValueFormatter {
public:
/**
* \brief Constructor.
*
* \param val Value.
*
*/
explicit ValueFormatter(T& val) noexcept : m_val(val) {
}
// Container value helper functions.
std::ostream& sequence(std::ostream& os) const noexcept;
std::ostream& map(std::ostream& os) const noexcept;
std::ostream& stack(std::ostream& os) const noexcept;
std::ostream& queue(std::ostream& os) const noexcept;
template<class U>
friend std::ostream& operator<<(
std::ostream& os, const ValueFormatter<U>& f) noexcept;
/**
* \return Value to format.
*/
T& get_value() const {
return m_val;
}
private:
T& m_val; /**< Value to format. Use non-const reference in case operator<<
isn't const. */
};
/**
* \brief Create ValueFormatter with the right template type.
* This solves the error "cannot refer to class template
* 'ValueFormatter' without a template argument list".
*
* \tparam T Value type.
* \param val Value.
* \return New ValueFormatter.
*/
template<class T>
ValueFormatter<T> format_value(T& val) {
return ValueFormatter<T>(val);
};
/**
* \brief Write a sequence, defined by begin() and end(), to stream.
*
* \tparam T Value type.
* \param os Output stream.
* \return Output stream.
*
*/
template<class T>
std::ostream& ValueFormatter<T>::sequence(std::ostream& os) const noexcept {
os << '{';
// Print first object without comma
auto it = std::begin(m_val);
if (it != std::end(m_val)) {
os << format_value(*it);
++it;
}
// Print the rest
for (; it != std::end(m_val); ++it) {
os << ", " << format_value(*it);
}
os << '}';
return os;
}
/**
* \brief Write a map, defined by begin() and end(), to stream.
*
* \tparam T Value type.
* \param os Output stream.
* \return Output stream.
*
*/
template<class T>
std::ostream& ValueFormatter<T>::map(std::ostream& os) const noexcept {
os << '{';
// Print first object without comma
auto it = m_val.begin();
if (it != m_val.end()) {
os << format_value(it->first) << ": " << format_value(it->second);
++it;
}
// Print the rest
for (; it != m_val.end(); ++it) {
os << ", " << format_value(it->first) << ": "
<< format_value(it->second);
}
os << '}';
return os;
}
/**
* \brief Write a stack, defined by top(), to stream.
*
* \tparam T Value type.
* \param os Output stream.
* \return Output stream.
*
*/
template<class T>
std::ostream& ValueFormatter<T>::stack(std::ostream& os) const noexcept {
// Only print first element, if available
os << '{';
if (m_val.size() == 1) {
os << format_value(m_val.top());
} else if (!m_val.empty()) {
os << format_value(m_val.top()) << ", ...";
}
os << '}';
return os;
}
/**
* \brief Write a queue, defined by front() and back(), to stream.
*
* \tparam T Value type.
* \param os Output stream.
* \return Output stream.
*
*/
template<class T>
std::ostream& ValueFormatter<T>::queue(std::ostream& os) const noexcept {
// Only print first element, if available
os << '{';
if (m_val.size() == 1) {
os << format_value(m_val.front());
} else if (m_val.size() == 2) {
os << format_value(m_val.front()) << ", " << format_value(m_val.back());
} else if (!m_val.empty() != 0) {
os << format_value(m_val.front()) << ", ..., "
<< format_value(m_val.back());
}
os << '}';
return os;
}
/**
* \brief General value formatter.
*
* \tparam T Value type.
* \param os Output stream.
* \param f ValueFormatter.
* \return Output stream.
*
*/
template<class T>
std::ostream& operator<<(
std::ostream& os, const ValueFormatter<T>& f) noexcept {
return os << f.m_val;
}
/**
* \brief Format std::pair.
*
* \tparam U First type of pair.
* \tparam V Second type of pair.
* \param os Output stream.
* \param f ValueFormatter.
* \return Output stream.
*
*/
template<class U, class V>
std::ostream& operator<<(
std::ostream& os, const ValueFormatter<std::pair<U, V>>& f) noexcept {
return os << '{' << format_value(f.get_value().first) << ", "
<< format_value(f.get_value().second) << '}';
}
/**
* \brief Format std::tuple.
*
* \tparam U First type of tuple.
* \tparam V Second type of tuple.
* \param os Output stream.
* \param f ValueFormatter.
* \return Output stream.
*
*/
template<class U, class V>
std::ostream& operator<<(
std::ostream& os, const ValueFormatter<std::tuple<U, V>>& f) noexcept {
return os << '{' << format_value(std::get<0>(f.get_value())) << ", "
<< format_value(std::get<1>(f.get_value())) << '}';
}
/**
* \brief Format std::unique_ptr.
*
* \tparam U Pointer type.
* \param os Output stream.
* \param f ValueFormatter.
* \return Output stream.
*
*/
template<class U>
std::ostream& operator<<(
std::ostream& os, const ValueFormatter<std::unique_ptr<U>>& f) noexcept {
return os << f.get_value().get();
}
/**
* \brief Format std::shared_ptr.
*
* \tparam U Pointer type.
* \param os Output stream.
* \param f ValueFormatter.
* \return Output stream.
*
*/
template<class U>
std::ostream& operator<<(
std::ostream& os, const ValueFormatter<std::shared_ptr<U>>& f) noexcept {
return os << f.get_value().get();
}
/**
* \brief Format std::weak_ptr.
*
* \tparam U Pointer type.
* \param os Output stream.
* \param f ValueFormatter.
* \return Output stream.
*
*/
template<class U>
std::ostream& operator<<(
std::ostream& os, const ValueFormatter<std::weak_ptr<U>>& f) noexcept {
// Convert to temporary shared_ptr in order to get value.
std::shared_ptr<U> tmp = f.get_value().lock();
return os << tmp.get();
}
/**
* \brief Format std::complex.
*
* \tparam U Pointer type.
* \param os Output stream.
* \param f ValueFormatter.
* \return Output stream.
*
*/
template<class U>
std::ostream& operator<<(
std::ostream& os, const ValueFormatter<std::complex<U>>& f) noexcept {
os << f.get_value().real();
if (f.get_value().imag() >= 0) {
os << " + " << f.get_value().imag();
} else {
os << " - " << -f.get_value().imag();
}
return os << 'i';
}
/**
* \brief Format std::valarray.
*
* \tparam U Element type.
* \param os Output stream.
* \param f ValueFormatter.
* \return Output stream.
*
*/
template<class U>
std::ostream& operator<<(
std::ostream& os, const ValueFormatter<std::valarray<U>>& f) noexcept {
return f.sequence(os);
}
/**
* \brief Format bool.
*
* \param os Output stream.
* \param f ValueFormatter.
* \return Output stream.
*
*/
template<>
std::ostream& operator<<(
std::ostream& os, const ValueFormatter<bool>& f) noexcept {
return os << (f.m_val ? "true" : "false");
}
// 3.9.1 in C++ standard: Plain char, signed char, and unsigned
// char are three distinct types
/**
* \brief Format char.
*
* \param os Output stream.
* \param f ValueFormatter.
* \return Output stream.
*
*/
template<>
std::ostream& operator<<(
std::ostream& os, const ValueFormatter<char>& f) noexcept {
return os << '\'' << f.m_val << '\'';
}
/**
* \brief Format unsigned char.
*
* \param os Output stream.
* \param f ValueFormatter.
* \return Output stream.
*
*/
template<>
std::ostream& operator<<(
std::ostream& os, const ValueFormatter<unsigned char>& f) noexcept {
return os << '\'' << f.m_val << '\'';
}
/**
* \brief Format signed char.
*
* \param os Output stream.
* \param f ValueFormatter.
* \return Output stream.
*
*/
template<>
std::ostream& operator<<(
std::ostream& os, const ValueFormatter<signed char>& f) noexcept {
return os << '\'' << f.m_val << '\'';
}
/**
* \brief Format char*.
*
* \param os Output stream.
* \param f ValueFormatter.
* \return Output stream.
*
*/
template<>
std::ostream& operator<<(
std::ostream& os, const ValueFormatter<char*>& f) noexcept {
return os << '\"' << f.m_val << '\"';
}
/**
* \brief Format const char*.
*
* \param os Output stream.
* \param f ValueFormatter.
* \return Output stream.
*
*/
template<>
std::ostream& operator<<(
std::ostream& os, const ValueFormatter<const char*>& f) noexcept {
return os << '\"' << f.m_val << '\"';
}
/**
* \brief Format std::tm.
*
* \param os Output stream.
* \param f ValueFormatter.
* \return Output stream.
*
*/
template<>
std::ostream& operator<<(
std::ostream& os, const ValueFormatter<std::tm>& f) noexcept {
// Format as "YYYY-MM-DD HH:MM:SS", including null pointer
char buf[20];
if (std::strftime(buf, sizeof(buf), "%F %T", &f.m_val) == 0) {
os << "std::tm format error";
} else {
os << buf;
}
return os;
}
/**
* \brief Format std::div_t.
*
* \param os Output stream.
* \param f ValueFormatter.
* \return Output stream.
*
*/
template<>
std::ostream& operator<<(
std::ostream& os, const ValueFormatter<std::div_t>& f) noexcept {
return os << "{quot = " << f.m_val.quot << ", rem = " << f.m_val.rem << '}';
}
/**
* \brief Format std::ldiv_t.
*
* \param os Output stream.
* \param f ValueFormatter.
* \return Output stream.
*
*/
template<>
std::ostream& operator<<(
std::ostream& os, const ValueFormatter<std::ldiv_t>& f) noexcept {
return os << "{quot = " << f.m_val.quot << ", rem = " << f.m_val.rem << '}';
}
/**
* \brief Format std::lldiv_t.
*
* \param os Output stream.
* \param f ValueFormatter.
* \return Output stream.
*
*/
template<>
std::ostream& operator<<(
std::ostream& os, const ValueFormatter<std::lldiv_t>& f) noexcept {
return os << "{quot = " << f.m_val.quot << ", rem = " << f.m_val.rem << '}';
}
/**
* \brief Format std::ratio.
*
* \param os Output stream.
* \param f ValueFormatter.
* \return Output stream.
*
*/
template<std::intmax_t U, std::intmax_t V>
std::ostream& operator<<(
std::ostream& os, const ValueFormatter<std::ratio<U, V>>& f) noexcept {
return os << f.get_value().num << " / " << f.get_value().den;
}
/**
* \brief Format std::stringbuf.
*
* \param os Output stream.
* \param f ValueFormatter.
* \return Output stream.
*
*/
template<>
std::ostream& operator<<(
std::ostream& os, const ValueFormatter<std::stringbuf>& f) noexcept {
return os << '\"' << f.m_val.str() << '\"';
}
/**
* \brief Format std::wstringbuf.
*
* \param os Output stream.
* \param f ValueFormatter.
* \return Output stream.
*
*/
template<>
std::ostream& operator<<(
std::ostream& os, const ValueFormatter<std::wstringbuf>& f) noexcept {
std::wstring_convert<std::codecvt_utf8<wchar_t>, wchar_t> converter;
return os << '\"' << converter.to_bytes(f.m_val.str()) << '\"';
}
/**
* \brief Format std::ostringstream.
*
* \param os Output stream.
* \param f ValueFormatter.
* \return Output stream.
*
*/
template<>
std::ostream& operator<<(
std::ostream& os, const ValueFormatter<std::ostringstream>& f) noexcept {
return os << '\"' << f.m_val.str() << '\"';
}
/**
* \brief Format std::wostringstream.
*
* \param os Output stream.
* \param f ValueFormatter.
* \return Output stream.
*
*/
template<>
std::ostream& operator<<(
std::ostream& os, const ValueFormatter<std::wostringstream>& f) noexcept {
std::wstring_convert<std::codecvt_utf8<wchar_t>, wchar_t> converter;
return os << '\"' << converter.to_bytes(f.m_val.str()) << '\"';
}
/**
* \brief Format std::stringstream.
*
* \param os Output stream.
* \param f ValueFormatter.
* \return Output stream.
*
*/
template<>
std::ostream& operator<<(
std::ostream& os, const ValueFormatter<std::stringstream>& f) noexcept {
return os << '\"' << f.m_val.str() << '\"';
}
/**
* \brief Format std::wstringstream.
*
* \param os Output stream.
* \param f ValueFormatter.
* \return Output stream.
*
*/
template<>
std::ostream& operator<<(
std::ostream& os, const ValueFormatter<std::wstringstream>& f) noexcept {
std::wstring_convert<std::codecvt_utf8<wchar_t>, wchar_t> converter;
return os << '\"' << converter.to_bytes(f.m_val.str()) << '\"';
}
/**
* \brief Format std::locale.
*
* \param os Output stream.
* \param f ValueFormatter.
* \return Output stream.
*
*/
template<>
std::ostream& operator<<(
std::ostream& os, const ValueFormatter<std::locale>& f) noexcept {
return os << '"' << f.m_val.name() << '"';
}
/**
* \brief Format std::string.
*
* \param os Output stream.
* \param f ValueFormatter.
* \return Output stream.
*
*/
template<>
std::ostream& operator<<(
std::ostream& os, const ValueFormatter<std::string>& f) noexcept {
return os << '\"' << f.m_val << '\"';
}
/**
* \brief Format std::u16string.
*
* \param os Output stream.
* \param f ValueFormatter.
* \return Output stream.
*
*/
template<>
std::ostream& operator<<(
std::ostream& os, const ValueFormatter<std::u16string>& f) noexcept {
std::wstring_convert<std::codecvt_utf8<char16_t>, char16_t> converter;
return os << '\"' << converter.to_bytes(f.m_val) << '\"';
}
/**
* \brief Format std::u32string.
*
* \param os Output stream.
* \param f ValueFormatter.
* \return Output stream.
*
*/
template<>
std::ostream& operator<<(
std::ostream& os, const ValueFormatter<std::u32string>& f) noexcept {
std::wstring_convert<std::codecvt_utf8<char32_t>, char32_t> converter;
return os << '\"' << converter.to_bytes(f.m_val) << '\"';
}
/**
* \brief Format std::wstring.
*
* \param os Output stream.
* \param f ValueFormatter.
* \return Output stream.
*
*/
template<>
std::ostream& operator<<(
std::ostream& os, const ValueFormatter<std::wstring>& f) noexcept {
std::wstring_convert<std::codecvt_utf8<wchar_t>, wchar_t> converter;
return os << '\"' << converter.to_bytes(f.m_val) << '\"';
}
/**
* \brief Format std::array.
*
* \tparam U Value type.
* \tparam N Number of elements.
* \param os Output stream.
* \param f ValueFormatter.
* \return Output stream.
*
*/
template<class U, size_t N>
std::ostream& operator<<(
std::ostream& os, const ValueFormatter<std::array<U, N>>& f) noexcept {
return f.sequence(os);
}
/**
* \brief Format std::vector.
*
* \tparam U Value type.
* \param os Output stream.
* \param f ValueFormatter.
* \return Output stream.
*
*/
template<class U>
std::ostream& operator<<(
std::ostream& os, const ValueFormatter<std::vector<U>>& f) noexcept {
return f.sequence(os);
}
/**
* \brief Format std::deque.
*
* \tparam U Value type.
* \param os Output stream.
* \param f ValueFormatter.
* \return Output stream.
*
*/
template<class U>
std::ostream& operator<<(
std::ostream& os, const ValueFormatter<std::deque<U>>& f) noexcept {
return f.sequence(os);
}
/**
* \brief Format std::forward_list.
*
* \tparam U Value type.
* \param os Output stream.
* \param f ValueFormatter.
* \return Output stream.
*
*/
template<class U>
std::ostream& operator<<(
std::ostream& os, const ValueFormatter<std::forward_list<U>>& f) noexcept {
return f.sequence(os);
}
/**
* \brief Format std::list.
*
* \tparam U Value type.
* \param os Output stream.
* \param f ValueFormatter.
* \return Output stream.
*
*/
template<class U>
std::ostream& operator<<(
std::ostream& os, const ValueFormatter<std::list<U>>& f) noexcept {
return f.sequence(os);
}
/**
* \brief Format std::set.
*
* \tparam U Value type.
* \param os Output stream.
* \param f ValueFormatter.
* \return Output stream.
*
*/
template<class U>
std::ostream& operator<<(
std::ostream& os, const ValueFormatter<std::set<U>>& f) noexcept {
return f.sequence(os);
}
/**
* \brief Format std::map.
*
* \tparam U Key type.
* \tparam V Value type.
* \param os Output stream.
* \param f ValueFormatter.
* \return Output stream.
*
*/
template<class U, class V>
std::ostream& operator<<(
std::ostream& os, const ValueFormatter<std::map<U, V>>& f) noexcept {
return f.map(os);
}
/**
* \brief Format std::multiset.
*
* \tparam U Value type.
* \param os Output stream.
* \param f ValueFormatter.
* \return Output stream.
*
*/
template<class U>
std::ostream& operator<<(
std::ostream& os, const ValueFormatter<std::multiset<U>>& f) noexcept {
return f.sequence(os);
}
/**
* \brief Format std::multimap.
*
* \tparam U Key type.
* \tparam V Value type.
* \param os Output stream.
* \param f ValueFormatter.
* \return Output stream.
*
*/
template<class U, class V>
std::ostream& operator<<(
std::ostream& os, const ValueFormatter<std::multimap<U, V>>& f) noexcept {
return f.map(os);
}
/**
* \brief Format std::unordered_set.
*
* \tparam U Value type.
* \param os Output stream.
* \param f ValueFormatter.
* \return Output stream.
*
*/
template<class U>
std::ostream& operator<<(
std::ostream& os, const ValueFormatter<std::unordered_set<U>>& f) noexcept {
return f.sequence(os);
}
/**
* \brief Format std::unordered_map.
*
* \tparam U Key type.
* \tparam V Value type.
* \param os Output stream.
* \param f ValueFormatter.
* \return Output stream.
*
*/
template<class U, class V>
std::ostream& operator<<(std::ostream& os,
const ValueFormatter<std::unordered_map<U, V>>& f) noexcept {
return f.map(os);
}
/**
* \brief Format std::unordered_multiset.
*
* \tparam U Value type.
* \param os Output stream.
* \param f ValueFormatter.
* \return Output stream.
*
*/
template<class U>
std::ostream& operator<<(std::ostream& os,
const ValueFormatter<std::unordered_multiset<U>>& f) noexcept {
return f.sequence(os);
}
/**
* \brief Format std::unordered_multimap.
*
* \tparam U Key type.
* \tparam V Value type.
* \param os Output stream.
* \param f ValueFormatter.
* \return Output stream.
*
*/
template<class U, class V>
std::ostream& operator<<(std::ostream& os,
const ValueFormatter<std::unordered_multimap<U, V>>& f) noexcept {
return f.map(os);
}
/**
* \brief Format std::stack.
*
* \tparam U Value type.
* \param os Output stream.
* \param f ValueFormatter.
* \return Output stream.
*
*/
template<class U>
std::ostream& operator<<(
std::ostream& os, const ValueFormatter<std::stack<U>>& f) noexcept {
return f.stack(os);
}
/**
* \brief Format std::queue.
*
* \tparam U Value type.
* \param os Output stream.
* \param f ValueFormatter.
* \return Output stream.
*
*/
template<class U>
std::ostream& operator<<(
std::ostream& os, const ValueFormatter<std::queue<U>>& f) noexcept {
return f.queue(os);
}
/**
* \brief Format std::priority_queue.
*
* \tparam U Value type.
* \param os Output stream.
* \param f ValueFormatter.
* \return Output stream.
*
*/
template<class U>
std::ostream& operator<<(std::ostream& os,
const ValueFormatter<std::priority_queue<U>>& f) noexcept {
return f.stack(os);
}
/**
* \brief Write ANSI color start code to stream, if color is enabled.
*
* \param os Output stream.
* \return Output stream.
*
*/
std::ostream& color_start(std::ostream& os) noexcept {
if (colorEnabled) {
// Red
os << "\033[0;31m";
}
return os;
}
/**
* \brief Write ANSI color end code to stream, if color is enabled.
*
* \param os Output stream.
* \return Output stream.
*
*/
std::ostream& color_end(std::ostream& os) noexcept {
if (colorEnabled) {
os << "\033[0m";
}
return os;
}
/**
* \brief Variable type formatter.
*
* \tparam T Variable type.
* \param os Output stream.
* \return Output stream.
*/
template<class T>
std::ostream& type_name(std::ostream& os) {
if ((curPrefixes & prefix::TYPE_NAME) == prefix::TYPE_NAME) {
const char* tn = typeid(T).name();
const char* output = nullptr;
#ifndef __GNUC__
output = tn;
#else
output = demangler.demangle(tn);
#endif // __GNUC__
os << output << ' ';
}
return os;
}
/**
* \brief Array.
*
* \tparam T Value type.
*
*/
template<class T>
class Array {
public:
/**
* \brief Constructor.
*
* \param name Name.
* \param val Values [\p len].
* \param len Number of values.
* \param prefixFmt PrefixFormatter.
*
*/
explicit Array(const char* name, T& val, size_t len,
const PrefixFormatter& prefixFmt) noexcept :
m_name(name),
m_val(val), m_len(len), m_prefixFmt(prefixFmt) {
}
template<class U>
friend std::ostream& operator<<(
std::ostream& os, const Array<U>& a) noexcept;
/**
* \return Name.
*/
const char* get_name() const noexcept {
return m_name;
}
/**
* \return Values.
*/
T& get_values() const noexcept {
return m_val;
}
/**
* \return Number of values.
*/
size_t get_number_of_values() const noexcept {
return m_len;
}
/**
* \return PrefixFormatter.
*/
const PrefixFormatter& get_prefix_formatter() const noexcept {
return m_prefixFmt;
}
private:
const char* m_name; /**< Name. */
T& m_val; /**< Values. */
const size_t m_len; /**< Number of values. */
const PrefixFormatter& m_prefixFmt; /**< PrefixFormatter. */
};
/**
* \brief Write Array to stream.
*
* \tparam U Value type.
* \param os Output stream.
* \param a Array.
* \return Output stream.
*
*/
template<class U>
std::ostream& operator<<(std::ostream& os, const Array<U>& a) noexcept {
if (outputEnabled) {
os << color_start << a.get_prefix_formatter()
<< type_name<U> << a.get_name() << " = {";
// Print first object without comma
if (a.get_number_of_values() > 0) {
os << format_value(a.get_values()[0]);
}
// Print the rest
for (size_t i = 1; i < a.get_number_of_values(); ++i) {
os << ", " << format_value(a.get_values()[i]);
}
os << '}' << color_end << GL_NEWLINE;
}
return os;
}
/**
* \brief Create array.
* This solves the error "cannot refer to class template 'Array' without a
* template argument list".
*
* \tparam T Value type.
* \param name Name.
* \param val Values.
* \param len Number of values.
* \param prefixFmt PrefixFormatter.
* \return Array.
*
*/
template<class T>
Array<T> make_array(
const char* name, T& val, size_t len, const PrefixFormatter& prefixFmt) {
return Array<T>(name, val, len, prefixFmt);
};
/**
* \brief Matrix.
*
* \tparam T Value type.
*
*/
template<class T>
class Matrix {
public:
/**
* \brief Constructor.
*
* \param name Name.
* \param val Values [\p cols x \p rows].
* \param cols Number of columns.
* \param rows Number of rows.
* \param prefixFmt PrefixFormatter.
*
*/
explicit Matrix(const char* name, T& val, size_t cols, size_t rows,
const PrefixFormatter& prefixFmt) noexcept :
m_name(name),
m_val(val), m_cols(cols), m_rows(rows), m_prefixFmt(prefixFmt) {
}
template<class U>
friend std::ostream& operator<<(
std::ostream& os, const Matrix<U>& a) noexcept;
/**
* \return Name.
*/
const char* get_name() const noexcept {
return m_name;
}
/**
* \return Values.
*/
T& get_values() const noexcept {
return m_val;
}
/**
* \return Number of columns.
*/
size_t get_number_of_columns() const noexcept {
return m_cols;
}
/**
* \return Number of rows.
*/
size_t get_number_of_rows() const noexcept {
return m_rows;
}
/**
* \return PrefixFormatter.
*/
const PrefixFormatter& get_prefix_formatter() const noexcept {
return m_prefixFmt;
}
private:
const char* m_name; /**< Name. */
T& m_val; /**< Values. */
const size_t m_cols; /**< Number of columns. */
const size_t m_rows; /**< Number of rows. */
const PrefixFormatter& m_prefixFmt; /**< PrefixFormatter. */
};
/**
* \brief Write Matrix to stream.
*
* \tparam U Value type.
* \param os Output stream.
* \param m Matrix.
* \return Output stream.
*
*/
template<class U>
std::ostream& operator<<(std::ostream& os, const Matrix<U>& m) noexcept {
if (outputEnabled) {
os << color_start << m.get_prefix_formatter()
<< type_name<U> << m.get_name() << ": ";
if (m.get_number_of_columns() <= 0 || m.get_number_of_rows() <= 0) {
os << "{}";
} else {
os << "[0,0] = " << format_value(m.get_values()[0][0]);
for (size_t j = 1; j < m.get_number_of_columns(); ++j) {
os << ", "
<< "[0," << j
<< "] = " << format_value(m.get_values()[0][j]);
}
for (size_t i = 1; i < m.get_number_of_rows(); ++i) {
for (size_t j = 0; j < m.get_number_of_columns(); ++j) {
os << ", "
<< "[" << i << ',' << j
<< "] = " << format_value(m.get_values()[i][j]);
}
}
}
os << color_end << GL_NEWLINE;
}
return os;
}
/**
* \brief Create matrix.
* This solves the error "cannot refer to class template 'Matrix' without a
* template argument list".
*
* \tparam T Value type.
* \param name Name.
* \param val Values.
* \param cols Number of columns.
* \param rows Number of rows.
* \param prefixFmt PrefixFormatter.
*
* \return New matrix.
*
*/
template<class T>
Matrix<T> make_matrix(const char* name, T& val, size_t cols, size_t rows,
const PrefixFormatter& prefixFmt) {
return Matrix<T>(name, val, cols, rows, prefixFmt);
};
} // namespace internal
#endif // DOXYGEN_HIDDEN
/**
*
* \return Bitwise \c or of prefix settings.
*
* \sa prefix \sa set_prefixes()
*
*/
prefix get_prefixes() noexcept {
return internal::curPrefixes;
}
/**
* \brief Set prefixes of logging output.
*
* Alters the output of \ref l(), \ref l_arr(), and \ref l_mat().
*
* \param p Bitwise \c or of prefix settings.
*
* Used as:
* \code
* gl::set_prefixes(gl::prefix::FILE | gl::prefix::LINE);
* \endcode
* to also log current file and line number.
*
* \note Defaults to prefix::FILE | prefix::LINE.
*
* \sa prefix \sa get_prefixes()
*
*/
void set_prefixes(prefix p) noexcept {
internal::curPrefixes = p;
}
/**
*
* \return \c true if output is enabled.
*
* \sa set_output_enabled()
*
*/
bool is_output_enabled() noexcept {
return internal::outputEnabled;
}
/**
* \brief Enable or disable output.
*
* \param e \c true if output shall be enabled.
*
* \note Defaults to enabled.
*
* \sa is_output_enabled()
*
*/
void set_output_enabled(bool e) noexcept {
internal::outputEnabled = e;
}
/**
* \brief Enable or disable ANSI color output.
*
* \param e \c true if output shall be colored.
*
* \note Defaults to disabled.
*
* \sa is_color_enabled()
*
*/
void set_color_enabled(bool e) noexcept {
internal::colorEnabled = e;
}
/**
*
* \return \c true if ANSI color output is enabled.
*
* \sa set_color_enabled()
*
*/
bool is_color_enabled() noexcept {
return internal::colorEnabled;
}
#ifndef DOXYGEN_HIDDEN
/**
* \brief Helper function for l(). Dispatch to the right macro depending on
* number of arguments.
*
*/
#define GL_INTERNAL_L_DISPATCH(_1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, \
_12, _13, _14, _15, _16, NAME, ...) \
NAME
/**
* \brief Output variable name and value. */
#define GL_INTERNAL_LX(v) \
gl::internal::type_name<decltype(v)> << (#v) << " = " \
<< ::gl::internal::format_value((v))
#define GL_INTERNAL_L1(v1) GL_INTERNAL_LX(v1)
#define GL_INTERNAL_L2(v1, v2) GL_INTERNAL_L1(v1) << ", " << GL_INTERNAL_LX(v2)
#define GL_INTERNAL_L3(v1, v2, v3) \
GL_INTERNAL_L2(v1, v2) << ", " << GL_INTERNAL_LX(v3)
#define GL_INTERNAL_L4(v1, v2, v3, v4) \
GL_INTERNAL_L3(v1, v2, v3) << ", " << GL_INTERNAL_LX(v4)
#define GL_INTERNAL_L5(v1, v2, v3, v4, v5) \
GL_INTERNAL_L4(v1, v2, v3, v4) << ", " << GL_INTERNAL_LX(v5)
#define GL_INTERNAL_L6(v1, v2, v3, v4, v5, v6) \
GL_INTERNAL_L5(v1, v2, v3, v4, v5) << ", " << GL_INTERNAL_LX(v6)
#define GL_INTERNAL_L7(v1, v2, v3, v4, v5, v6, v7) \
GL_INTERNAL_L6(v1, v2, v3, v4, v5, v6) << ", " << GL_INTERNAL_LX(v7)
#define GL_INTERNAL_L8(v1, v2, v3, v4, v5, v6, v7, v8) \
GL_INTERNAL_L7(v1, v2, v3, v4, v5, v6, v7) << ", " << GL_INTERNAL_LX(v8)
#define GL_INTERNAL_L9(v1, v2, v3, v4, v5, v6, v7, v8, v9) \
GL_INTERNAL_L8(v1, v2, v3, v4, v5, v6, v7, v8) << ", " << GL_INTERNAL_LX(v9)
#define GL_INTERNAL_L10(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10) \
GL_INTERNAL_L9(v1, v2, v3, v4, v5, v6, v7, v8, v9) \
<< ", " << GL_INTERNAL_LX(v10)
#define GL_INTERNAL_L11(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11) \
GL_INTERNAL_L10(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10) \
<< ", " << GL_INTERNAL_LX(v11)
#define GL_INTERNAL_L12(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12) \
GL_INTERNAL_L11(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11) \
<< ", " << GL_INTERNAL_LX(v12)
#define GL_INTERNAL_L13( \
v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13) \
GL_INTERNAL_L12(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12) \
<< ", " << GL_INTERNAL_LX(v13)
#define GL_INTERNAL_L14( \
v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14) \
GL_INTERNAL_L13(v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13) \
<< ", " << GL_INTERNAL_LX(v14)
#define GL_INTERNAL_L15( \
v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15) \
GL_INTERNAL_L14( \
v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14) \
<< ", " << GL_INTERNAL_LX(v15)
#define GL_INTERNAL_L16( \
v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16) \
GL_INTERNAL_L15( \
v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15) \
<< ", " << GL_INTERNAL_LX(v16)
#endif // DOXYGEN_HIDDEN
} // namespace gl
#endif // INCLUDE_GOINGLOGGING_H_
| 24.153098 | 80 | 0.573594 |
ebdaa1abc3bacdc46fdd5e48074f7ffdaffbaeb2 | 5,374 | c | C | libipt/src/pt_section_file.c | andikleen/processor-trace | 6f3f993a121a14ea922ce390af412875469ac2ae | [
"BSD-3-Clause"
] | 1 | 2020-02-03T11:46:23.000Z | 2020-02-03T11:46:23.000Z | libipt/src/pt_section_file.c | andikleen/processor-trace | 6f3f993a121a14ea922ce390af412875469ac2ae | [
"BSD-3-Clause"
] | null | null | null | libipt/src/pt_section_file.c | andikleen/processor-trace | 6f3f993a121a14ea922ce390af412875469ac2ae | [
"BSD-3-Clause"
] | 2 | 2015-08-02T23:59:13.000Z | 2022-02-02T03:54:15.000Z | /*
* Copyright (c) 2013-2015, Intel Corporation
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* * Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
* * Neither the name of Intel Corporation nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
#include "pt_section.h"
#include "pt_section_file.h"
#include "intel-pt.h"
#include <stdlib.h>
#include <string.h>
static int fmap_init(struct pt_sec_file_mapping *mapping)
{
if (!mapping)
return -pte_internal;
memset(mapping, 0, sizeof(*mapping));
#if defined(FEATURE_THREADS)
{
int errcode;
errcode = mtx_init(&mapping->lock, mtx_plain);
if (errcode != thrd_success)
return -pte_bad_lock;
}
#endif /* defined(FEATURE_THREADS) */
return 0;
}
static void fmap_fini(struct pt_sec_file_mapping *mapping)
{
if (!mapping)
return;
fclose(mapping->file);
#if defined(FEATURE_THREADS)
mtx_destroy(&mapping->lock);
#endif /* defined(FEATURE_THREADS) */
}
static int fmap_lock(struct pt_sec_file_mapping *mapping)
{
if (!mapping)
return -pte_internal;
#if defined(FEATURE_THREADS)
{
int errcode;
errcode = mtx_lock(&mapping->lock);
if (errcode != thrd_success)
return -pte_bad_lock;
}
#endif /* defined(FEATURE_THREADS) */
return 0;
}
static int fmap_unlock(struct pt_sec_file_mapping *mapping)
{
if (!mapping)
return -pte_internal;
#if defined(FEATURE_THREADS)
{
int errcode;
errcode = mtx_unlock(&mapping->lock);
if (errcode != thrd_success)
return -pte_bad_lock;
}
#endif /* defined(FEATURE_THREADS) */
return 0;
}
int pt_sec_file_map(struct pt_section *section, FILE *file)
{
struct pt_sec_file_mapping *mapping;
uint64_t offset, size;
long begin, end, fsize;
int errcode;
if (!section)
return -pte_internal;
mapping = section->mapping;
if (mapping)
return -pte_internal;
offset = section->offset;
size = section->size;
begin = (long) offset;
end = begin + (long) size;
/* Check for overflows. */
if ((uint64_t) begin != offset)
return -pte_bad_image;
if ((uint64_t) end != (offset + size))
return -pte_bad_image;
if (end < begin)
return -pte_bad_image;
/* Validate that the section lies within the file. */
errcode = fseek(file, 0, SEEK_END);
if (errcode)
return -pte_bad_image;
fsize = ftell(file);
if (fsize < 0)
return -pte_bad_image;
if (fsize < end)
return -pte_bad_image;
mapping = malloc(sizeof(*mapping));
if (!mapping)
return -pte_nomem;
errcode = fmap_init(mapping);
if (errcode < 0) {
free(mapping);
return errcode;
}
mapping->file = file;
mapping->begin = begin;
mapping->end = end;
section->mapping = mapping;
section->unmap = pt_sec_file_unmap;
section->read = pt_sec_file_read;
return 0;
}
int pt_sec_file_unmap(struct pt_section *section)
{
struct pt_sec_file_mapping *mapping;
if (!section)
return -pte_internal;
mapping = section->mapping;
if (!mapping || !section->unmap || !section->read)
return -pte_internal;
section->mapping = NULL;
section->unmap = NULL;
section->read = NULL;
fmap_fini(mapping);
free(mapping);
return 0;
}
int pt_sec_file_read(const struct pt_section *section, uint8_t *buffer,
uint16_t size, uint64_t offset)
{
struct pt_sec_file_mapping *mapping;
FILE *file;
long begin, end, fbegin, fend;
size_t read;
int errcode;
if (!buffer || !section)
return -pte_invalid;
mapping = section->mapping;
if (!mapping)
return -pte_internal;
file = mapping->file;
begin = mapping->begin;
end = mapping->end;
fbegin = (long) offset;
if (((uint64_t) fbegin) != offset)
return -pte_nomap;
fbegin += begin;
fend = fbegin + size;
if (fend < fbegin)
return -pte_nomap;
if (end <= fbegin)
return -pte_nomap;
if (fbegin < begin)
return -pte_nomap;
errcode = fmap_lock(mapping);
if (errcode < 0)
return errcode;
errcode = fseek(file, fbegin, SEEK_SET);
if (errcode)
goto out_unlock;
read = fread(buffer, 1, size, file);
errcode = fmap_unlock(mapping);
if (errcode < 0)
return errcode;
return (int) read;
out_unlock:
(void) fmap_unlock(mapping);
return -pte_nomap;
}
| 21.582329 | 79 | 0.714365 |
ebdb0b26a125dd8bdda39558753c1219f2830192 | 522 | h | C | ShareFileSDK/ShareFileSDK/Requests/Filters/SFATypeFilter.h | NickNichollsCitrix/ShareFile-ObjectiveC | 59c21fc5ab7288d83f3de64a34f1f6516ab7b7ba | [
"MIT"
] | 2 | 2015-12-20T16:53:46.000Z | 2018-09-13T14:16:47.000Z | ShareFileSDK/ShareFileSDK/Requests/Filters/SFATypeFilter.h | NickNichollsCitrix/ShareFile-ObjectiveC | 59c21fc5ab7288d83f3de64a34f1f6516ab7b7ba | [
"MIT"
] | 2 | 2019-12-23T23:22:35.000Z | 2020-01-13T14:47:30.000Z | ShareFileSDK/ShareFileSDK/Requests/Filters/SFATypeFilter.h | NickNichollsCitrix/ShareFile-ObjectiveC | 59c21fc5ab7288d83f3de64a34f1f6516ab7b7ba | [
"MIT"
] | 4 | 2016-01-22T18:08:35.000Z | 2020-01-13T12:50:26.000Z | #import "SFAEqualToFilter.h"
/**
* Filter query results by SFA model type. eg. Folder, File, etc.
*/
@interface SFATypeFilter : SFAEqualToFilter
/**
* Model type to filter by
*/
@property (nonatomic, strong, readonly) NSString *type;
/**
* OData isof expression, if any
*/
@property (nonatomic, strong, readonly) NSString *expression;
/**
* @param sfType Model type
* @param expression OData isof expression
*/
- (instancetype)initWithType:(NSString *)sfType expression:(NSString *)expression;
@end
| 20.88 | 82 | 0.701149 |
ebdd116a50e80bc7901896b5677117dff63f4963 | 7,363 | h | C | release/src-rt-6.x.4708/router/samba-3.5.8/source4/heimdal/lib/roken/resolve.h | afeng11/tomato-arm | 1ca18a88480b34fd495e683d849f46c2d47bb572 | [
"FSFAP"
] | 4 | 2017-05-17T11:27:04.000Z | 2020-05-24T07:23:26.000Z | release/src-rt-6.x.4708/router/samba-3.5.8/source4/heimdal/lib/roken/resolve.h | afeng11/tomato-arm | 1ca18a88480b34fd495e683d849f46c2d47bb572 | [
"FSFAP"
] | 1 | 2018-08-21T03:43:09.000Z | 2018-08-21T03:43:09.000Z | release/src-rt-6.x.4708/router/samba-3.5.8/source4/heimdal/lib/roken/resolve.h | afeng11/tomato-arm | 1ca18a88480b34fd495e683d849f46c2d47bb572 | [
"FSFAP"
] | 5 | 2017-10-11T08:09:11.000Z | 2020-10-14T04:10:13.000Z | /*
* Copyright (c) 1995 - 2002 Kungliga Tekniska Högskolan
* (Royal Institute of Technology, Stockholm, Sweden).
* 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 Institute 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 INSTITUTE 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 INSTITUTE 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.
*/
/* $Id: resolve.h,v 1.1.1.1 2011/06/10 09:34:42 andrew Exp $ */
#ifndef __RESOLVE_H__
#define __RESOLVE_H__
#ifndef ROKEN_LIB_FUNCTION
#ifdef _WIN32
#define ROKEN_LIB_FUNCTION _stdcall
#else
#define ROKEN_LIB_FUNCTION
#endif
#endif
enum {
rk_ns_c_in = 1
};
enum {
rk_ns_t_invalid = 0, /* Cookie. */
rk_ns_t_a = 1, /* Host address. */
rk_ns_t_ns = 2, /* Authoritative server. */
rk_ns_t_md = 3, /* Mail destination. */
rk_ns_t_mf = 4, /* Mail forwarder. */
rk_ns_t_cname = 5, /* Canonical name. */
rk_ns_t_soa = 6, /* Start of authority zone. */
rk_ns_t_mb = 7, /* Mailbox domain name. */
rk_ns_t_mg = 8, /* Mail group member. */
rk_ns_t_mr = 9, /* Mail rename name. */
rk_ns_t_null = 10, /* Null resource record. */
rk_ns_t_wks = 11, /* Well known service. */
rk_ns_t_ptr = 12, /* Domain name pointer. */
rk_ns_t_hinfo = 13, /* Host information. */
rk_ns_t_minfo = 14, /* Mailbox information. */
rk_ns_t_mx = 15, /* Mail routing information. */
rk_ns_t_txt = 16, /* Text strings. */
rk_ns_t_rp = 17, /* Responsible person. */
rk_ns_t_afsdb = 18, /* AFS cell database. */
rk_ns_t_x25 = 19, /* X_25 calling address. */
rk_ns_t_isdn = 20, /* ISDN calling address. */
rk_ns_t_rt = 21, /* Router. */
rk_ns_t_nsap = 22, /* NSAP address. */
rk_ns_t_nsap_ptr = 23, /* Reverse NSAP lookup (deprecated). */
rk_ns_t_sig = 24, /* Security signature. */
rk_ns_t_key = 25, /* Security key. */
rk_ns_t_px = 26, /* X.400 mail mapping. */
rk_ns_t_gpos = 27, /* Geographical position (withdrawn). */
rk_ns_t_aaaa = 28, /* Ip6 Address. */
rk_ns_t_loc = 29, /* Location Information. */
rk_ns_t_nxt = 30, /* Next domain (security). */
rk_ns_t_eid = 31, /* Endpoint identifier. */
rk_ns_t_nimloc = 32, /* Nimrod Locator. */
rk_ns_t_srv = 33, /* Server Selection. */
rk_ns_t_atma = 34, /* ATM Address */
rk_ns_t_naptr = 35, /* Naming Authority PoinTeR */
rk_ns_t_kx = 36, /* Key Exchange */
rk_ns_t_cert = 37, /* Certification record */
rk_ns_t_a6 = 38, /* IPv6 address (deprecates AAAA) */
rk_ns_t_dname = 39, /* Non-terminal DNAME (for IPv6) */
rk_ns_t_sink = 40, /* Kitchen sink (experimentatl) */
rk_ns_t_opt = 41, /* EDNS0 option (meta-RR) */
rk_ns_t_apl = 42, /* Address prefix list (RFC 3123) */
rk_ns_t_ds = 43, /* Delegation Signer (RFC 3658) */
rk_ns_t_sshfp = 44, /* SSH fingerprint */
rk_ns_t_tkey = 249, /* Transaction key */
rk_ns_t_tsig = 250, /* Transaction signature. */
rk_ns_t_ixfr = 251, /* Incremental zone transfer. */
rk_ns_t_axfr = 252, /* Transfer zone of authority. */
rk_ns_t_mailb = 253, /* Transfer mailbox records. */
rk_ns_t_maila = 254, /* Transfer mail agent records. */
rk_ns_t_any = 255, /* Wildcard match. */
rk_ns_t_zxfr = 256, /* BIND-specific, nonstandard. */
rk_ns_t_max = 65536
};
#ifndef MAXDNAME
#define MAXDNAME 1025
#endif
#define mx_record rk_mx_record
#define srv_record rk_srv_record
#define key_record rk_key_record
#define sig_record rk_sig_record
#define cert_record rk_cert_record
#define sshfp_record rk_sshfp_record
struct rk_dns_query{
char *domain;
unsigned type;
unsigned class;
};
struct rk_mx_record{
unsigned preference;
char domain[1];
};
struct rk_srv_record{
unsigned priority;
unsigned weight;
unsigned port;
char target[1];
};
struct rk_key_record {
unsigned flags;
unsigned protocol;
unsigned algorithm;
size_t key_len;
u_char key_data[1];
};
struct rk_sig_record {
unsigned type;
unsigned algorithm;
unsigned labels;
unsigned orig_ttl;
unsigned sig_expiration;
unsigned sig_inception;
unsigned key_tag;
char *signer;
unsigned sig_len;
char sig_data[1]; /* also includes signer */
};
struct rk_cert_record {
unsigned type;
unsigned tag;
unsigned algorithm;
size_t cert_len;
u_char cert_data[1];
};
struct rk_sshfp_record {
unsigned algorithm;
unsigned type;
size_t sshfp_len;
u_char sshfp_data[1];
};
struct rk_ds_record {
unsigned key_tag;
unsigned algorithm;
unsigned digest_type;
unsigned digest_len;
u_char digest_data[1];
};
struct rk_resource_record{
char *domain;
unsigned type;
unsigned class;
unsigned ttl;
unsigned size;
union {
void *data;
struct rk_mx_record *mx;
struct rk_mx_record *afsdb; /* mx and afsdb are identical */
struct rk_srv_record *srv;
struct in_addr *a;
char *txt;
struct rk_key_record *key;
struct rk_cert_record *cert;
struct rk_sig_record *sig;
struct rk_sshfp_record *sshfp;
struct rk_ds_record *ds;
}u;
struct rk_resource_record *next;
};
#define rk_DNS_MAX_PACKET_SIZE 0xffff
struct rk_dns_header {
unsigned id;
unsigned flags;
#define rk_DNS_HEADER_RESPONSE_FLAG 1
#define rk_DNS_HEADER_AUTHORITIVE_ANSWER 2
#define rk_DNS_HEADER_TRUNCATED_MESSAGE 4
#define rk_DNS_HEADER_RECURSION_DESIRED 8
#define rk_DNS_HEADER_RECURSION_AVAILABLE 16
#define rk_DNS_HEADER_AUTHENTIC_DATA 32
#define rk_DNS_HEADER_CHECKING_DISABLED 64
unsigned opcode;
unsigned response_code;
unsigned qdcount;
unsigned ancount;
unsigned nscount;
unsigned arcount;
};
struct rk_dns_reply{
struct rk_dns_header h;
struct rk_dns_query q;
struct rk_resource_record *head;
};
#ifdef __cplusplus
extern "C" {
#endif
struct rk_dns_reply* ROKEN_LIB_FUNCTION
rk_dns_lookup(const char *, const char *);
void ROKEN_LIB_FUNCTION
rk_dns_free_data(struct rk_dns_reply *);
int ROKEN_LIB_FUNCTION
rk_dns_string_to_type(const char *name);
const char *ROKEN_LIB_FUNCTION
rk_dns_type_to_string(int type);
void ROKEN_LIB_FUNCTION
rk_dns_srv_order(struct rk_dns_reply*);
#ifdef __cplusplus
}
#endif
#endif /* __RESOLVE_H__ */
| 29.452 | 77 | 0.715198 |
ebdd34371d24f9f1a3c08eb3e2f1aa649ea7e7a8 | 17,697 | h | C | infostat/include/sqlitestore.h | boubad/CygProjects | cdc0dc2cb6e34b94d1bafbf3fd216b32c320985d | [
"Apache-2.0"
] | null | null | null | infostat/include/sqlitestore.h | boubad/CygProjects | cdc0dc2cb6e34b94d1bafbf3fd216b32c320985d | [
"Apache-2.0"
] | null | null | null | infostat/include/sqlitestore.h | boubad/CygProjects | cdc0dc2cb6e34b94d1bafbf3fd216b32c320985d | [
"Apache-2.0"
] | null | null | null | #pragma once
#ifndef __SQLITESTORE_H__
#define __SQLITESTORE_H__
/////////////////////////////////////
#include "istatstore.h"
#include "stringconvert.h"
/////////////////////////////////////////
#include <infosqlitestore.h>
/////////////////////////////////////////
namespace info {
/////////////////////////////////
template <typename IDTYPE, typename INTTYPE, typename STRINGTYPE, typename WEIGHTYPE>
class SQLiteStore : public IStatStore<IDTYPE, INTTYPE, STRINGTYPE, WEIGHTYPE>, private boost::noncopyable {
using IDTYPE_BASE = unsigned long;
using INTTYPE_BASE = unsigned long;
using STRINGTYPE_BASE = std::string;
using WEIGHTYPE_BASE = double;
//
using strings_vector_base = std::vector<STRINGTYPE_BASE>;
using ints_vector_base = std::vector<IDTYPE_BASE>;
using ints_string_map_base = std::map<IDTYPE_BASE, STRINGTYPE_BASE>;
using DatasetType_base = StatDataset<IDTYPE_BASE, INTTYPE_BASE, STRINGTYPE_BASE>;
using datasets_vector_base = std::vector<DatasetType_base>;
using VariableType_base = StatVariable<IDTYPE_BASE, INTTYPE_BASE, STRINGTYPE_BASE, WEIGHTYPE_BASE>;
using variables_vector_base = std::vector<VariableType_base>;
using IndivType_base = StatIndiv<IDTYPE_BASE, INTTYPE_BASE, STRINGTYPE_BASE, WEIGHTYPE_BASE>;
using indivs_vector_base = std::vector<IndivType_base>;
using ValueType_base = StatValue<IDTYPE_BASE, INTTYPE_BASE, STRINGTYPE_BASE>;
using values_vector_base = std::vector<ValueType_base>;
public:
using StoreType = IStatStore<IDTYPE, INTTYPE, STRINGTYPE, WEIGHTYPE>;
using strings_vector = std::vector<STRINGTYPE>;
using ints_vector = std::vector<IDTYPE>;
using ints_string_map = std::map<IDTYPE, STRINGTYPE>;
using DatasetType = StatDataset<IDTYPE, INTTYPE, STRINGTYPE>;
using datasets_vector = std::vector<DatasetType>;
using VariableType = StatVariable<IDTYPE, INTTYPE, STRINGTYPE, WEIGHTYPE>;
using variables_vector = std::vector<VariableType>;
using IndivType = StatIndiv<IDTYPE, INTTYPE, STRINGTYPE, WEIGHTYPE>;
using indivs_vector = std::vector<IndivType>;
using ValueType = StatValue<IDTYPE, INTTYPE, STRINGTYPE>;
using values_vector = std::vector<ValueType>;
private:
std::unique_ptr<SQLiteStatHelper> m_helper;
public:
SQLiteStore() {
this->m_helper.reset(new SQLiteStatHelper());
assert(this->m_helper.get() != nullptr);
assert(this->m_helper->is_valid());
}
SQLiteStore(const STRINGTYPE &sDatabaseName) {
this->m_helper.reset(new SQLiteStatHelper(sDatabaseName));
assert(this->m_helper.get() != nullptr);
assert(this->m_helper->is_valid());
}
virtual ~SQLiteStore() {}
private:
template <typename SOURCE, typename DEST>
static void convert_value(const SOURCE &src, DEST &dest, bool bIn = false) {
if (bIn) {
dest.id((IDTYPE_BASE)src.id());
dest.version((INTTYPE_BASE)src.version());
dest.variable_id((IDTYPE_BASE)src.variable_id());
dest.indiv_id((IDTYPE_BASE)src.indiv_id());
dest.dataset_id((IDTYPE_BASE)src.dataset_id());
STRINGTYPE_BASE s;
info_convert_string(src.status(), s);
dest.status(s);
}
else {
dest.id((IDTYPE)src.id());
dest.version((INTTYPE)src.version());
dest.variable_id((IDTYPE)src.variable_id());
dest.indiv_id((IDTYPE)src.indiv_id());
dest.dataset_id((IDTYPE)src.dataset_id());
STRINGTYPE s;
info_convert_string(src.status(), s);
dest.status(s);
}
dest.value(src.value());
}// convert_value
template <typename SOURCE, typename DEST>
static void convert_variable(const SOURCE &src, DEST &dest, bool bIn = false) {
if (bIn) {
dest.id((IDTYPE_BASE)src.id());
dest.version((INTTYPE_BASE)src.version());
dest.dataset_id((IDTYPE_BASE)src.dataset_id());
dest.weight((WEIGHTYPE_BASE)src.weight());
STRINGTYPE_BASE s;
info_convert_string(src.status(), s);
dest.status(s);
info_convert_string(src.sigle(), s);
dest.sigle(s);
info_convert_string(src.name(), s);
dest.name(s);
info_convert_string(src.description(), s);
dest.description(s);
info_convert_string(src.vartype(), s);
dest.vartype(s);
info_convert_string(src.genre(), s);
dest.genre(s);
}
else {
dest.id((IDTYPE)src.id());
dest.version((INTTYPE)src.version());
dest.dataset_id((IDTYPE)src.dataset_id());
dest.weight((WEIGHTYPE)src.weight());
STRINGTYPE s;
std::string sx = src.status();
info_convert_string(sx, s);
dest.status(s);
info_convert_string(src.sigle(), s);
dest.sigle(s);
info_convert_string(src.name(), s);
dest.name(s);
info_convert_string(src.description(), s);
dest.description(s);
info_convert_string(src.vartype(), s);
dest.vartype(s);
info_convert_string(src.genre(), s);
dest.genre(s);
}
dest.is_categ(src.is_categ());
dest.modalites_count(src.modalites_count());
}// convert_variable
template <typename SOURCE, typename DEST>
static void convert_indiv(const SOURCE &src, DEST &dest, bool bIn = false) {
if (bIn) {
dest.id((IDTYPE_BASE)src.id());
dest.version((INTTYPE_BASE)src.version());
dest.dataset_id((IDTYPE_BASE)src.dataset_id());
dest.weight((WEIGHTYPE_BASE)src.weight());
STRINGTYPE_BASE s;
info_convert_string(src.status(), s);
dest.status(s);
info_convert_string(src.sigle(), s);
dest.sigle(s);
info_convert_string(src.name(), s);
dest.name(s);
info_convert_string(src.description(), s);
dest.description(s);
}
else {
dest.id((IDTYPE)src.id());
dest.version((INTTYPE)src.version());
dest.dataset_id((IDTYPE)src.dataset_id());
dest.weight((WEIGHTYPE)src.weight());
STRINGTYPE s;
info_convert_string(src.status(), s);
dest.status(s);
info_convert_string(src.sigle(), s);
dest.sigle(s);
info_convert_string(src.name(), s);
dest.name(s);
info_convert_string(src.description(), s);
dest.description(s);
}
}// convert_indiv
template <typename SOURCE, typename DEST>
static void convert_dataset(const SOURCE &src, DEST &dest, bool bIn = false) {
if (bIn) {
dest.id((IDTYPE_BASE)src.id());
dest.version((INTTYPE_BASE)src.version());
STRINGTYPE_BASE s;
info_convert_string(src.status(), s);
dest.status(s);
info_convert_string(src.sigle(), s);
dest.sigle(s);
info_convert_string(src.name(), s);
dest.name(s);
info_convert_string(src.description(), s);
dest.description(s);
}
else {
dest.id((IDTYPE)src.id());
dest.version((INTTYPE)src.version());
STRINGTYPE s;
info_convert_string(src.status(), s);
dest.status(s);
info_convert_string(src.sigle(), s);
dest.sigle(s);
info_convert_string(src.name(), s);
dest.name(s);
info_convert_string(src.description(), s);
dest.description(s);
}
}// convert_dataset
//
static void convert_v(const std::vector<IDTYPE_BASE> &src, std::vector<IDTYPE> &dest) {
const size_t n = src.size();
dest.resize(n);
for (size_t i = 0; i < n; ++i) {
dest[i] = (IDTYPE)src[i];
}
}
static void convert_v(const ints_string_map_base &src, ints_string_map &dest) {
dest.clear();
for (auto &p : src) {
IDTYPE key = (IDTYPE)p.first;
STRINGTYPE s;
info_convert_string(p.second, s);
dest[key] = s;
}// p
}
static void convert_v(const strings_vector_base &src, strings_vector &dest) {
const size_t n = src.size();
dest.resize(n);
for (size_t i = 0; i < n; ++i) {
STRINGTYPE s;
info_convert_string(src[i], s);
dest[i] = s;
}
}
template <typename SOURCE, typename DEST>
static void convert_values(const std::vector<SOURCE> &src, std::vector<DEST> &dest, bool bIn = false) {
dest.clear();
for (auto &p : src) {
DEST r;
convert_value(p, r, bIn);
dest.push_back(r);
}
}// convert_v
template <typename SOURCE, typename DEST>
static void convert_variables(const std::vector<SOURCE> &src, std::vector<DEST> &dest, bool bIn = false) {
dest.clear();
for (auto &p : src) {
DEST r;
convert_variable(p, r, bIn);
dest.push_back(r);
}
}// convert_v
template <typename SOURCE, typename DEST>
static void convert_indivs(const std::vector<SOURCE> &src, std::vector<DEST> &dest, bool bIn = false) {
dest.clear();
for (auto &p : src) {
DEST r;
convert_indiv(p, r, bIn);
dest.push_back(r);
}
}// convert_v
template <typename SOURCE, typename DEST>
static void convert_datasets(const std::vector<SOURCE> &src, std::vector<DEST> &dest, bool bIn = false) {
dest.clear();
for (auto &p : src) {
DEST r;
convert_dataset(p, r, bIn);
dest.push_back(r);
}
}// convert_v
public:
// overrides
virtual bool is_valid(void) {
return (this->m_helper->is_valid());
}
virtual void begin_transaction(void) {
this->m_helper->begin_transaction();
}
virtual void commit_transaction(void) {
this->m_helper->commit_transaction();
}
virtual void rollback_transaction(void) {
this->m_helper->rollback_transaction();
}
//
virtual bool find_all_datasets_count(size_t &nCount) {
return (this->m_helper->find_all_datasets_count(nCount));
}
virtual bool find_all_datasets(datasets_vector &oList, size_t skip = 0, size_t count = StoreType::DATATRANSFER_CHUNK_SIZE) {
datasets_vector_base dest;
if (!this->m_helper->find_all_datasets(dest, skip, count)) {
return (false);
}
convert_datasets(dest, oList);
return (true);
}
virtual bool find_all_datasets_ids(ints_vector &oList, size_t skip = 0, size_t count = StoreType::DATATRANSFER_CHUNK_SIZE) {
ints_vector_base dest;
if (!this->m_helper->find_all_datasets_ids(dest, skip, count)) {
return (false);
}
convert_v(dest, oList);
return (true);
}
virtual bool find_dataset(DatasetType &cur) {
DatasetType_base dest;
convert_dataset(cur, dest, true);
if (!this->m_helper->find_dataset(dest)) {
return (false);
}
convert_dataset(dest, cur);
return (true);
}
virtual bool maintains_dataset(DatasetType &cur, bool bCommit = true) {
DatasetType_base dest;
convert_dataset(cur, dest, true);
if (!this->m_helper->maintains_dataset(dest, bCommit)) {
return (false);
}
convert_dataset(dest, cur);
return (true);
}
virtual bool remove_dataset(const DatasetType &cur, bool bCommit = true) {
DatasetType_base dest;
convert_dataset(cur, dest, true);
if (!this->m_helper->remove_dataset(dest, bCommit)) {
return (false);
}
return (true);
}
//
virtual bool find_dataset_variables_types(const DatasetType &oSet, ints_string_map &oMap) {
DatasetType_base dest;
convert_dataset(oSet, dest, true);
ints_string_map_base temp;
if (!this->m_helper->find_dataset_variables_types(dest, temp)) {
return (false);
}
convert_v(temp, oMap);
return (true);
}
virtual bool find_dataset_variables_count(const DatasetType &oSet, size_t &nCount) {
DatasetType_base dest;
convert_dataset(oSet, dest, true);
if (!this->m_helper->find_dataset_variables_count(dest, nCount)) {
return (false);
}
return (true);
}
virtual bool find_dataset_variables_ids(const DatasetType &oSet, ints_vector &oList,
size_t skip = 0, size_t count = StoreType::DATATRANSFER_CHUNK_SIZE) {
DatasetType_base dest;
convert_dataset(oSet, dest, true);
ints_vector_base temp;
if (!this->m_helper->find_dataset_variables_ids(dest, temp, skip, count)) {
return (false);
}
convert_v(temp, oList);
return (true);
}
virtual bool find_dataset_variables(const DatasetType &oSet, variables_vector &oList,
size_t skip = 0, size_t count = StoreType::DATATRANSFER_CHUNK_SIZE) {
DatasetType_base dest;
convert_dataset(oSet, dest, true);
variables_vector_base temp;
if (!this->m_helper->find_dataset_variables(dest, temp, skip, count)) {
return (false);
}
convert_variables(temp, oList);
return (true);
}
virtual bool find_variable(VariableType &cur) {
VariableType_base dest;
convert_variable(cur, dest, true);
if (!this->m_helper->find_variable(dest)) {
return (false);
}
convert_variable(dest, cur);
return (true);
}
virtual bool maintains_variables(const variables_vector &oVars, bool bCommit = true,
bool bRemove = false) {
variables_vector_base dest;
convert_variables(oVars, dest, true);
if (!this->m_helper->maintains_variables(dest, bCommit, bRemove)) {
return (false);
}
return (true);
}
virtual bool remove_variable(const VariableType &oVar, bool bCommit = true) {
VariableType_base dest;
convert_variable(oVar, dest, true);
if (!this->m_helper->remove_variable(dest, bCommit)) {
return (false);
}
return (true);
}
//
virtual bool find_dataset_indivs_count(const DatasetType &oSet, size_t &nCount) {
DatasetType_base dest;
convert_dataset(oSet, dest, true);
if (!this->m_helper->find_dataset_indivs_count(dest, nCount)) {
return (false);
}
return (true);
}
virtual bool find_dataset_indivs_ids(const DatasetType &oSet, ints_vector &oList,
size_t skip = 0, size_t count = StoreType::DATATRANSFER_CHUNK_SIZE) {
DatasetType_base dest;
convert_dataset(oSet, dest);
ints_vector_base temp;
if (!this->m_helper->find_dataset_indivs_ids(dest, temp, skip, count)) {
return (false);
}
convert_v(temp, oList);
return (true);
}
virtual bool find_dataset_indivs(const DatasetType &oSet, indivs_vector &oList,
size_t skip = 0, size_t count = StoreType::DATATRANSFER_CHUNK_SIZE) {
DatasetType_base dest;
convert_dataset(oSet, dest, true);
indivs_vector_base temp;
if (!this->m_helper->find_dataset_indivs(dest, temp, skip, count)) {
return (false);
}
convert_indivs(temp, oList);
return (true);
}
virtual bool find_indiv(IndivType &cur) {
IndivType_base dest;
convert_indiv(cur, dest);
if (!this->m_helper->find_indiv(dest)) {
return (false);
}
convert_indiv(dest, cur);
return (true);
}
virtual bool maintains_indivs(const indivs_vector &oInds, bool bCommit = true,
bool bRemove = false) {
indivs_vector_base dest;
convert_indivs(oInds, dest, true);
if (!this->m_helper->maintains_indivs(dest, bCommit, bRemove)) {
return (false);
}
return (true);
}
virtual bool remove_indiv(const IndivType &oInd, bool bCommit = true) {
IndivType_base dest;
convert_indiv(oInd, dest);
if (!this->m_helper->remove_indiv(dest, bCommit)) {
return (false);
}
return (true);
}
//
virtual bool find_value(ValueType &cur) {
ValueType_base dest;
convert_value(cur, dest, true);
if (!this->m_helper->find_value(dest)) {
return (false);
}
convert_value(dest, cur);
return (true);
}
virtual bool maintains_values(const values_vector &oVals, bool bCommit = true,
bool bRemove = false) {
values_vector_base dest;
convert_values(oVals, dest, true);
if (!this->m_helper->maintains_values(dest, bCommit, bRemove)) {
return (false);
}
return (true);
}
virtual bool find_dataset_values_count(const DatasetType &oSet, size_t &nCount) {
DatasetType_base dest;
convert_dataset(oSet, dest, true);
if (!this->m_helper->find_dataset_values_count(dest, nCount)) {
return (false);
}
return (true);
}
virtual bool find_dataset_values(const DatasetType &oSet, values_vector &oList,
size_t skip = 0, size_t count = StoreType::DATATRANSFER_CHUNK_SIZE) {
DatasetType_base dest;
convert_dataset(oSet, dest, true);
values_vector_base temp;
if (!this->m_helper->find_dataset_values(dest, temp, skip, count)) {
return (false);
}
convert_values(temp, oList);
return (true);
}
virtual bool find_variable_values(VariableType &oVar, values_vector &oList,
size_t skip = 0, size_t count = StoreType::DATATRANSFER_CHUNK_SIZE) {
VariableType_base dest;
convert_variable(oVar, dest, true);
values_vector_base temp;
if (!this->m_helper->find_variable_values(dest, temp, skip, count)) {
return (false);
}
convert_variable(dest, oVar);
convert_values(temp, oList);
return (true);
}
virtual bool find_variable_distinct_values(VariableType &oVar, strings_vector &oList,
size_t skip = 0, size_t count = StoreType::DATATRANSFER_CHUNK_SIZE) {
VariableType_base dest;
convert_variable(oVar, dest, true);
strings_vector_base temp;
if (!this->m_helper->find_variable_distinct_values(dest, temp, skip, count)) {
return (false);
}
convert_variable(dest, oVar);
convert_v(temp, oList);
return (true);
}
virtual bool find_indiv_values(IndivType &oInd, values_vector &oList,
size_t skip = 0, size_t count = StoreType::DATATRANSFER_CHUNK_SIZE) {
IndivType_base dest;
convert_indiv(oInd, dest, true);
values_vector_base temp;
if (!this->m_helper->find_indiv_values(dest, temp, skip, count)) {
return (false);
}
convert_indiv(dest, oInd);
convert_values(temp, oList);
return (true);
}
virtual bool find_indiv_values_count(IndivType &oInd, size_t &nc) {
IndivType_base dest;
convert_indiv(oInd, dest, true);
if (!this->m_helper->find_indiv_values_count(dest, nc)) {
return (false);
}
convert_indiv(dest, oInd);
return (true);
}
virtual bool find_variable_values_count(VariableType &oVar, size_t &nc) {
VariableType_base dest;
convert_variable(oVar, dest, true);
if (!this->m_helper->find_variable_values_count(dest, nc)) {
return (false);
}
convert_variable(dest, oVar);
return (true);
}
};// class SQLiteStore<IDTYPE,INTTYPE,STRINGTYPE,WEIGHTYPE>
///////////////////////////////////
}// namespace info
////////////////////////////////////////
#endif // !__SQLITESTORE_H__
| 33.265038 | 126 | 0.683336 |
ebdf9a41359e6f789acac810950cc7181db5e5db | 631 | h | C | SEETools/Example/SEETools/Tools/Addition/UICollectionViewFlowLayout+SEEQuick.h | CalierSee/SEETools | e336648df1384e9b6f771f93bed8f82477ca245a | [
"MIT"
] | null | null | null | SEETools/Example/SEETools/Tools/Addition/UICollectionViewFlowLayout+SEEQuick.h | CalierSee/SEETools | e336648df1384e9b6f771f93bed8f82477ca245a | [
"MIT"
] | null | null | null | SEETools/Example/SEETools/Tools/Addition/UICollectionViewFlowLayout+SEEQuick.h | CalierSee/SEETools | e336648df1384e9b6f771f93bed8f82477ca245a | [
"MIT"
] | null | null | null | //
// UICollectionViewFlowLayout+SEEQuick.h
// SEEQuick
//
// Created by 景彦铭 on 16/9/12.
// Copyright © 2016年 景彦铭. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface UICollectionViewFlowLayout (SEEQuick)
/// 创建flowlayout对象
///
/// @param minimumLineSpacing 行间距
/// @param minimumInteritemSpacing item间距
/// @param scrollDirection 滚动方向
/// @param cla 自定义FlowLayout类
+ (instancetype)see_createWithClassName:(Class)cla minimumLineSpacing:(CGFloat)minimumLineSpacing minimumInteritemSpacing:(CGFloat)minimumInteritemSpacing scrollDirection:(UICollectionViewScrollDirection)scrollDirection;
@end
| 31.55 | 220 | 0.759113 |
ebe086fa577a75d133851576b03018768b489ec6 | 5,259 | h | C | Classes/Native/System_System_Net_FileWebRequest1571840111.h | AkishinoShiame/Virtual-Elderly-Chatbot-IOS-Project-IOS-12 | a834966bdb705a2e71db67f9d6db55e7e60065aa | [
"Apache-2.0"
] | null | null | null | Classes/Native/System_System_Net_FileWebRequest1571840111.h | AkishinoShiame/Virtual-Elderly-Chatbot-IOS-Project-IOS-12 | a834966bdb705a2e71db67f9d6db55e7e60065aa | [
"Apache-2.0"
] | null | null | null | Classes/Native/System_System_Net_FileWebRequest1571840111.h | AkishinoShiame/Virtual-Elderly-Chatbot-IOS-Project-IOS-12 | a834966bdb705a2e71db67f9d6db55e7e60065aa | [
"Apache-2.0"
] | null | null | null | #pragma once
#include "il2cpp-config.h"
#ifndef _MSC_VER
# include <alloca.h>
#else
# include <malloc.h>
#endif
#include <stdint.h>
#include "System_System_Net_WebRequest1365124353.h"
#include "mscorlib_System_IO_FileAccess4282042064.h"
// System.Uri
struct Uri_t19570940;
// System.Net.WebHeaderCollection
struct WebHeaderCollection_t3028142837;
// System.String
struct String_t;
// System.Net.IWebProxy
struct IWebProxy_t3916853445;
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
#pragma clang diagnostic ignored "-Wunused-variable"
#endif
// System.Net.FileWebRequest
struct FileWebRequest_t1571840111 : public WebRequest_t1365124353
{
public:
// System.Uri System.Net.FileWebRequest::uri
Uri_t19570940 * ___uri_6;
// System.Net.WebHeaderCollection System.Net.FileWebRequest::webHeaders
WebHeaderCollection_t3028142837 * ___webHeaders_7;
// System.String System.Net.FileWebRequest::connectionGroup
String_t* ___connectionGroup_8;
// System.Int64 System.Net.FileWebRequest::contentLength
int64_t ___contentLength_9;
// System.IO.FileAccess System.Net.FileWebRequest::fileAccess
int32_t ___fileAccess_10;
// System.String System.Net.FileWebRequest::method
String_t* ___method_11;
// System.Net.IWebProxy System.Net.FileWebRequest::proxy
Il2CppObject * ___proxy_12;
// System.Boolean System.Net.FileWebRequest::preAuthenticate
bool ___preAuthenticate_13;
// System.Int32 System.Net.FileWebRequest::timeout
int32_t ___timeout_14;
public:
inline static int32_t get_offset_of_uri_6() { return static_cast<int32_t>(offsetof(FileWebRequest_t1571840111, ___uri_6)); }
inline Uri_t19570940 * get_uri_6() const { return ___uri_6; }
inline Uri_t19570940 ** get_address_of_uri_6() { return &___uri_6; }
inline void set_uri_6(Uri_t19570940 * value)
{
___uri_6 = value;
Il2CppCodeGenWriteBarrier(&___uri_6, value);
}
inline static int32_t get_offset_of_webHeaders_7() { return static_cast<int32_t>(offsetof(FileWebRequest_t1571840111, ___webHeaders_7)); }
inline WebHeaderCollection_t3028142837 * get_webHeaders_7() const { return ___webHeaders_7; }
inline WebHeaderCollection_t3028142837 ** get_address_of_webHeaders_7() { return &___webHeaders_7; }
inline void set_webHeaders_7(WebHeaderCollection_t3028142837 * value)
{
___webHeaders_7 = value;
Il2CppCodeGenWriteBarrier(&___webHeaders_7, value);
}
inline static int32_t get_offset_of_connectionGroup_8() { return static_cast<int32_t>(offsetof(FileWebRequest_t1571840111, ___connectionGroup_8)); }
inline String_t* get_connectionGroup_8() const { return ___connectionGroup_8; }
inline String_t** get_address_of_connectionGroup_8() { return &___connectionGroup_8; }
inline void set_connectionGroup_8(String_t* value)
{
___connectionGroup_8 = value;
Il2CppCodeGenWriteBarrier(&___connectionGroup_8, value);
}
inline static int32_t get_offset_of_contentLength_9() { return static_cast<int32_t>(offsetof(FileWebRequest_t1571840111, ___contentLength_9)); }
inline int64_t get_contentLength_9() const { return ___contentLength_9; }
inline int64_t* get_address_of_contentLength_9() { return &___contentLength_9; }
inline void set_contentLength_9(int64_t value)
{
___contentLength_9 = value;
}
inline static int32_t get_offset_of_fileAccess_10() { return static_cast<int32_t>(offsetof(FileWebRequest_t1571840111, ___fileAccess_10)); }
inline int32_t get_fileAccess_10() const { return ___fileAccess_10; }
inline int32_t* get_address_of_fileAccess_10() { return &___fileAccess_10; }
inline void set_fileAccess_10(int32_t value)
{
___fileAccess_10 = value;
}
inline static int32_t get_offset_of_method_11() { return static_cast<int32_t>(offsetof(FileWebRequest_t1571840111, ___method_11)); }
inline String_t* get_method_11() const { return ___method_11; }
inline String_t** get_address_of_method_11() { return &___method_11; }
inline void set_method_11(String_t* value)
{
___method_11 = value;
Il2CppCodeGenWriteBarrier(&___method_11, value);
}
inline static int32_t get_offset_of_proxy_12() { return static_cast<int32_t>(offsetof(FileWebRequest_t1571840111, ___proxy_12)); }
inline Il2CppObject * get_proxy_12() const { return ___proxy_12; }
inline Il2CppObject ** get_address_of_proxy_12() { return &___proxy_12; }
inline void set_proxy_12(Il2CppObject * value)
{
___proxy_12 = value;
Il2CppCodeGenWriteBarrier(&___proxy_12, value);
}
inline static int32_t get_offset_of_preAuthenticate_13() { return static_cast<int32_t>(offsetof(FileWebRequest_t1571840111, ___preAuthenticate_13)); }
inline bool get_preAuthenticate_13() const { return ___preAuthenticate_13; }
inline bool* get_address_of_preAuthenticate_13() { return &___preAuthenticate_13; }
inline void set_preAuthenticate_13(bool value)
{
___preAuthenticate_13 = value;
}
inline static int32_t get_offset_of_timeout_14() { return static_cast<int32_t>(offsetof(FileWebRequest_t1571840111, ___timeout_14)); }
inline int32_t get_timeout_14() const { return ___timeout_14; }
inline int32_t* get_address_of_timeout_14() { return &___timeout_14; }
inline void set_timeout_14(int32_t value)
{
___timeout_14 = value;
}
};
#ifdef __clang__
#pragma clang diagnostic pop
#endif
| 37.834532 | 151 | 0.801103 |
ebe1eaa2af923741c81a604d98572d97d9c34230 | 4,284 | h | C | src/imaging/public/aeon/imaging/converters/convert_pixel.h | aeon-engine/libaeon | e42b39e621dcd0a0fba05e1c166fc688288fb69b | [
"BSD-2-Clause"
] | 7 | 2017-02-19T16:22:16.000Z | 2021-03-02T05:47:39.000Z | src/imaging/public/aeon/imaging/converters/convert_pixel.h | aeon-engine/libaeon | e42b39e621dcd0a0fba05e1c166fc688288fb69b | [
"BSD-2-Clause"
] | 61 | 2017-05-29T06:11:17.000Z | 2021-03-28T21:51:44.000Z | src/imaging/public/aeon/imaging/converters/convert_pixel.h | aeon-engine/libaeon | e42b39e621dcd0a0fba05e1c166fc688288fb69b | [
"BSD-2-Clause"
] | 2 | 2017-05-28T17:17:40.000Z | 2017-07-14T21:45:16.000Z | // Distributed under the BSD 2-Clause License - Copyright 2012-2021 Robin Degen
#pragma once
#include <aeon/imaging/pixel_encoding.h>
namespace aeon::imaging::convert
{
template <typename pixel_type_t>
struct pixel final
{
[[nodiscard]] static auto to_rgb24(const pixel_type_t pixel) noexcept -> rgb24
{
constexpr auto shift = (sizeof(pixel_type_t) * 8) - 8;
if constexpr (shift != 0)
{
const auto rgb_pixel = static_cast<std::uint8_t>(pixel << shift);
return {rgb_pixel, rgb_pixel, rgb_pixel};
}
else
{
return {pixel, pixel, pixel};
}
}
[[nodiscard]] static auto to_rgba32(const pixel_type_t pixel) noexcept -> rgba32
{
const auto rgb = to_rgb24(pixel);
return {rgb.r, rgb.g, rgb.b, 255};
}
[[nodiscard]] static auto to_bgr24(const pixel_type_t pixel) noexcept -> bgr24
{
const auto rgb = to_rgb24(pixel);
return {rgb.b, rgb.g, rgb.r};
}
[[nodiscard]] static auto to_bgra32(const pixel_type_t pixel) noexcept -> bgra32
{
const auto rgb = to_rgb24(pixel);
return {rgb.b, rgb.g, rgb.r, 255};
}
};
template <>
struct pixel<float> final
{
[[nodiscard]] static auto to_rgb24(const float pixel) noexcept -> rgb24
{
const auto rgb_pixel = static_cast<std::uint8_t>(pixel * 255.0f);
return {rgb_pixel, rgb_pixel, rgb_pixel};
}
[[nodiscard]] static auto to_rgba32(const float pixel) noexcept -> rgba32
{
const auto rgb = to_rgb24(pixel);
return {rgb.r, rgb.g, rgb.b, 255};
}
[[nodiscard]] static auto to_bgr24(const float pixel) noexcept -> bgr24
{
const auto rgb = to_rgb24(pixel);
return {rgb.b, rgb.g, rgb.r};
}
[[nodiscard]] static auto to_bgra32(const float pixel) noexcept -> bgra32
{
const auto rgb = to_rgb24(pixel);
return {rgb.b, rgb.g, rgb.r, 255};
}
};
template <>
struct pixel<rgb24> final
{
[[nodiscard]] static auto to_rgb24(const rgb24 pixel) noexcept -> rgb24
{
return pixel;
}
[[nodiscard]] static auto to_rgba32(const rgb24 pixel) noexcept -> rgba32
{
return {pixel.r, pixel.g, pixel.b, 255};
}
[[nodiscard]] static auto to_bgr24(const rgb24 pixel) noexcept -> bgr24
{
return {pixel.b, pixel.g, pixel.r};
}
[[nodiscard]] static auto to_bgra32(const rgb24 pixel) noexcept -> bgra32
{
return {pixel.b, pixel.g, pixel.r, 255};
}
};
template <>
struct pixel<rgba32> final
{
[[nodiscard]] static auto to_rgb24(const rgba32 pixel) noexcept -> rgb24
{
return {pixel.r, pixel.g, pixel.b};
}
[[nodiscard]] static auto to_rgba32(const rgba32 pixel) noexcept -> rgba32
{
return pixel;
}
[[nodiscard]] static auto to_bgr24(const rgba32 pixel) noexcept -> bgr24
{
return {pixel.b, pixel.g, pixel.r};
}
[[nodiscard]] static auto to_bgra32(const rgba32 pixel) noexcept -> bgra32
{
return {pixel.b, pixel.g, pixel.r, pixel.a};
}
};
template <>
struct pixel<bgr24> final
{
[[nodiscard]] static auto to_rgb24(const bgr24 pixel) noexcept -> rgb24
{
return {pixel.r, pixel.g, pixel.b};
}
[[nodiscard]] static auto to_rgba32(const bgr24 pixel) noexcept -> rgba32
{
return {pixel.r, pixel.g, pixel.b, 255};
}
[[nodiscard]] static auto to_bgr24(const bgr24 pixel) noexcept -> bgr24
{
return pixel;
}
[[nodiscard]] static auto to_bgra32(const bgr24 pixel) noexcept -> bgra32
{
return {pixel.b, pixel.g, pixel.r, 255};
}
};
template <>
struct pixel<bgra32> final
{
[[nodiscard]] static auto to_rgb24(const bgra32 pixel) noexcept -> rgb24
{
return {pixel.r, pixel.g, pixel.b};
}
[[nodiscard]] static auto to_rgba32(const bgra32 pixel) noexcept -> rgba32
{
return {pixel.r, pixel.g, pixel.b, pixel.a};
}
[[nodiscard]] static auto to_bgr24(const bgra32 pixel) noexcept -> bgr24
{
return {pixel.b, pixel.g, pixel.r};
}
[[nodiscard]] static auto to_bgra32(const bgra32 pixel) noexcept -> bgra32
{
return pixel;
}
};
} // namespace aeon::imaging::convert
| 24.906977 | 84 | 0.607143 |
ebe22219d37866da348af62808408f3f77c983f0 | 19,669 | c | C | code/gnutls/tests/suite/ecore/src/lib/ecore_events.c | timkingh/FFmpeg_VS | 993b14dc146731d782cf4b5fffc6a0f4b9aeea0c | [
"MIT"
] | null | null | null | code/gnutls/tests/suite/ecore/src/lib/ecore_events.c | timkingh/FFmpeg_VS | 993b14dc146731d782cf4b5fffc6a0f4b9aeea0c | [
"MIT"
] | null | null | null | code/gnutls/tests/suite/ecore/src/lib/ecore_events.c | timkingh/FFmpeg_VS | 993b14dc146731d782cf4b5fffc6a0f4b9aeea0c | [
"MIT"
] | null | null | null | #ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include <stdlib.h>
#include "Ecore.h"
#include "ecore_private.h"
static int inpurge = 0;
struct _Ecore_Event_Handler {
EINA_INLIST;
ECORE_MAGIC;
int type;
Ecore_Event_Handler_Cb func;
void *data;
int references;
Eina_Bool delete_me:1;
};
struct _Ecore_Event_Filter {
EINA_INLIST;
ECORE_MAGIC;
Ecore_Data_Cb func_start;
Ecore_Filter_Cb func_filter;
Ecore_End_Cb func_end;
void *loop_data;
void *data;
int references;
Eina_Bool delete_me:1;
};
struct _Ecore_Event {
EINA_INLIST;
ECORE_MAGIC;
int type;
void *event;
Ecore_End_Cb func_free;
void *data;
int references;
Eina_Bool delete_me:1;
};
static int events_num = 0;
static Ecore_Event *events = NULL;
static Ecore_Event *event_current = NULL;
static Ecore_Event *purge_events = NULL;
static Ecore_Event_Handler **event_handlers = NULL;
static Ecore_Event_Handler *event_handler_current = NULL;
static int event_handlers_num = 0;
static int event_handlers_alloc_num = 0;
static Eina_List *event_handlers_delete_list = NULL;
static Ecore_Event_Filter *event_filters = NULL;
static Ecore_Event_Filter *event_filter_current = NULL;
static Ecore_Event *event_filter_event_current = NULL;
static int event_filters_delete_me = 0;
static int event_id_max = ECORE_EVENT_COUNT;
static int ecore_raw_event_type = ECORE_EVENT_NONE;
static void *ecore_raw_event_event = NULL;
static void _ecore_event_purge_deleted(void);
static void *_ecore_event_del(Ecore_Event * event);
/**
* Add an event handler.
* @param type The type of the event this handler will get called for
* @param func The function to call when the event is found in the queue
* @param data A data pointer to pass to the called function @p func
* @return A new Event handler, or NULL on failure
*
* Add an event handler to the list of handlers. This will, on success, return
* a handle to the event handler object that was created, that can be used
* later to remove the handler using ecore_event_handler_del(). The @p type
* parameter is the integer of the event type that will trigger this callback
* to be called. The callback @p func is called when this event is processed
* and will be passed the event type, a pointer to the private event
* structure that is specific to that event type, and a data pointer that is
* provided in this call as the @p data parameter.
*
* When the callback @p func is called, it must return 1 or 0. If it returns
* 1 (or ECORE_CALLBACK_RENEW), It will keep being called as per normal, for
* each handler set up for that event type. If it returns 0 (or
* ECORE_CALLBACK_CANCEL), it will cease processing handlers for that particular
* event, so all handler set to handle that event type that have not already
* been called, will not be.
*/
EAPI Ecore_Event_Handler *ecore_event_handler_add(int type,
Ecore_Event_Handler_Cb
func, const void *data)
{
Ecore_Event_Handler *eh;
if (!func)
return NULL;
if ((type <= ECORE_EVENT_NONE) || (type >= event_id_max))
return NULL;
eh = calloc(1, sizeof(Ecore_Event_Handler));
if (!eh)
return NULL;
ECORE_MAGIC_SET(eh, ECORE_MAGIC_EVENT_HANDLER);
eh->type = type;
eh->func = func;
eh->data = (void *) data;
if (type >= (event_handlers_num - 1)) {
int p_alloc_num;
p_alloc_num = event_handlers_alloc_num;
event_handlers_num = type + 1;
if (event_handlers_num > event_handlers_alloc_num) {
Ecore_Event_Handler **new_handlers;
int i;
event_handlers_alloc_num =
((event_handlers_num + 16) / 16) * 16;
new_handlers =
realloc(event_handlers,
event_handlers_alloc_num *
sizeof(Ecore_Event_Handler *));
if (!new_handlers) {
free(eh);
return NULL;
}
event_handlers = new_handlers;
for (i = p_alloc_num; i < event_handlers_alloc_num;
i++)
event_handlers[i] = NULL;
}
}
event_handlers[type] =
(Ecore_Event_Handler *)
eina_inlist_append(EINA_INLIST_GET(event_handlers[type]),
EINA_INLIST_GET(eh));
return eh;
}
/**
* Delete an event handler.
* @param event_handler Event handler handle to delete
* @return Data passed to handler
*
* Delete a specified event handler from the handler list. On success this will
* delete the event handler and return the pointer passed as @p data when the
* handler was added by ecore_event_handler_add(). On failure NULL will be
* returned. Once a handler is deleted it will no longer be called.
*/
EAPI void *ecore_event_handler_del(Ecore_Event_Handler * event_handler)
{
if (!ECORE_MAGIC_CHECK(event_handler, ECORE_MAGIC_EVENT_HANDLER)) {
ECORE_MAGIC_FAIL(event_handler, ECORE_MAGIC_EVENT_HANDLER,
"ecore_event_handler_del");
return NULL;
}
EINA_SAFETY_ON_TRUE_RETURN_VAL(event_handler->delete_me, NULL);
event_handler->delete_me = 1;
event_handlers_delete_list =
eina_list_append(event_handlers_delete_list, event_handler);
return event_handler->data;
}
static void _ecore_event_generic_free(void *data __UNUSED__, void *event)
{
free(event);
}
/**
* Add an event to the event queue.
* @param type The event type to add to the end of the event queue
* @param ev The private data structure for this event type
* @param func_free The function to be called to free this private structure
* @param data The data pointer to be passed to the free function
* @return A Handle for that event
*
* On success this function returns a handle to an event on the event queue, or
* NULL if it fails. If it succeeds, an event of type @p type will be added
* to the queue for processing by event handlers added by
* ecore_event_handler_add(). The @p ev parameter will be a pointer to the event
* private data that is specific to that event type. When the event is no
* longer needed, @p func_free will be called and passed the private structure
* pointer for cleaning up. If @p func_free is NULL, free() will be called
* with the private structure pointer.
* func_free is passed @p data as its data parameter.
*/
EAPI Ecore_Event *ecore_event_add(int type, void *ev,
Ecore_End_Cb func_free, void *data)
{
/* if (!ev) return NULL;*/
if (type <= ECORE_EVENT_NONE)
return NULL;
if (type >= event_id_max)
return NULL;
if ((ev) && (!func_free))
func_free = _ecore_event_generic_free;
return _ecore_event_add(type, ev, func_free, data);
}
/**
* Delete an event from the queue.
* @param event The event handle to delete
* @return The data pointer originally set for the event free function
*
* This deletes the event @p event from the event queue, and returns the
* @p data parameer originally set when adding it with ecore_event_add(). This
* does not immediately call the free function, and it may be called later on
* cleanup, and so if the free function depends on the data pointer to work,
* you should defer cleaning of this till the free function is called later.
*/
EAPI void *ecore_event_del(Ecore_Event * event)
{
if (!ECORE_MAGIC_CHECK(event, ECORE_MAGIC_EVENT)) {
ECORE_MAGIC_FAIL(event, ECORE_MAGIC_EVENT,
"ecore_event_del");
return NULL;
}
EINA_SAFETY_ON_TRUE_RETURN_VAL(event->delete_me, NULL);
event->delete_me = 1;
return event->data;
}
/**
* Allocate a new event type id sensibly and return the new id.
* @return A new event type id.
*
* This function allocates a new event type id and returns it. Once an event
* type has been allocated it can never be de-allocated during the life of
* the program. There is no guarantee of the contents of this event ID, or how
* it is calculated, except that the ID will be unique to the current instance
* of the process.
*/
EAPI int ecore_event_type_new(void)
{
event_id_max++;
return event_id_max - 1;
}
/**
* Add a filter the current event queue.
* @param func_start Function to call just before filtering and return data
* @param func_filter Function to call on each event
* @param func_end Function to call after the queu has been filtered
* @param data Data to pass to the filter functions
* @return A filter handle
*
* This adds a filter to call callbacks to loop through the event queue and
* filter events out of the queue. On failure NULL is returned. On success a
* Filter handle is returned. Filters are called on the queue just before
* Event handler processing to try and remove redundant events. Just as
* processing starts @p func_start is called and passed the @p data pointer.
* This function returns a pointer that is used as loop_data that is now passed to
* @p func_filter as loop_data. @p func_filter is also passed @p data and the
* event type and private event structure. If this callback returns 0, the
* event is removed from the queue. If it returns 1, the event is kept. When
* processing is finished @p func_end is called and is passed the loop_data
* and @p data pointer to clean up.
*/
EAPI Ecore_Event_Filter *ecore_event_filter_add(Ecore_Data_Cb func_start,
Ecore_Filter_Cb
func_filter,
Ecore_End_Cb func_end,
const void *data)
{
Ecore_Event_Filter *ef;
if (!func_filter)
return NULL;
ef = calloc(1, sizeof(Ecore_Event_Filter));
if (!ef)
return NULL;
ECORE_MAGIC_SET(ef, ECORE_MAGIC_EVENT_FILTER);
ef->func_start = func_start;
ef->func_filter = func_filter;
ef->func_end = func_end;
ef->data = (void *) data;
event_filters =
(Ecore_Event_Filter *)
eina_inlist_append(EINA_INLIST_GET(event_filters),
EINA_INLIST_GET(ef));
return ef;
}
/**
* Delete an event filter.
* @param ef The event filter handle
* @return The data set for the filter
*
* Delete a filter that has been added by its @p ef handle. On success this
* will return the data pointer set when this filter was added. On failure
* NULL is returned.
*/
EAPI void *ecore_event_filter_del(Ecore_Event_Filter * ef)
{
if (!ECORE_MAGIC_CHECK(ef, ECORE_MAGIC_EVENT_FILTER)) {
ECORE_MAGIC_FAIL(ef, ECORE_MAGIC_EVENT_FILTER,
"ecore_event_filter_del");
return NULL;
}
EINA_SAFETY_ON_TRUE_RETURN_VAL(ef->delete_me, NULL);
ef->delete_me = 1;
event_filters_delete_me = 1;
return ef->data;
}
/**
* Return the current event type being handled.
* @return The current event type being handled if inside a handler callback
*
* If the program is currently inside an Ecore event handler callback this
* will return the type of the current event being processed. If Ecore is
* not inside an event handler, ECORE_EVENT_NONE is returned.
*
* This is useful when certain Ecore modules such as Ecore_Evas "swallow"
* events and not all the original information is passed on. In special cases
* this extra information may be useful or needed and using this call can let
* the program know if the event type being handled is one it wants to get more
* information about.
*/
EAPI int ecore_event_current_type_get(void)
{
return ecore_raw_event_type;
}
/**
* Return the current event type pointer handled.
* @return The current event pointer being handled if inside a handler callback
*
* If the program is currently inside an Ecore event handler callback this
* will return the pointer of the current event being processed. If Ecore is
* not inside an event handler, NULL will be returned.
*
* This is useful when certain Ecore modules such as Ecore_Evas "swallow"
* events and not all the original information is passed on. In special cases
* this extra information may be useful or needed and using this call can let
* the program access the event data if the type of the event is handled by
* the program.
*/
EAPI void *ecore_event_current_event_get(void)
{
return ecore_raw_event_event;
}
void _ecore_event_shutdown(void)
{
int i;
Ecore_Event_Handler *eh;
Ecore_Event_Filter *ef;
while (events)
_ecore_event_del(events);
event_current = NULL;
for (i = 0; i < event_handlers_num; i++) {
while ((eh = event_handlers[i])) {
event_handlers[i] =
(Ecore_Event_Handler *)
eina_inlist_remove(EINA_INLIST_GET
(event_handlers[i]),
EINA_INLIST_GET
(event_handlers[i]));
ECORE_MAGIC_SET(eh, ECORE_MAGIC_NONE);
if (!eh->delete_me)
free(eh);
}
}
EINA_LIST_FREE(event_handlers_delete_list, eh)
free(eh);
if (event_handlers)
free(event_handlers);
event_handlers = NULL;
event_handlers_num = 0;
event_handlers_alloc_num = 0;
while ((ef = event_filters)) {
event_filters =
(Ecore_Event_Filter *)
eina_inlist_remove(EINA_INLIST_GET(event_filters),
EINA_INLIST_GET(event_filters));
ECORE_MAGIC_SET(ef, ECORE_MAGIC_NONE);
free(ef);
}
event_filters_delete_me = 0;
event_filter_current = NULL;
event_filter_event_current = NULL;
}
int _ecore_event_exist(void)
{
Ecore_Event *e;
EINA_INLIST_FOREACH(events, e)
if (!e->delete_me)
return 1;
return 0;
}
Ecore_Event *_ecore_event_add(int type, void *ev, Ecore_End_Cb func_free,
void *data)
{
Ecore_Event *e;
e = calloc(1, sizeof(Ecore_Event));
if (!e)
return NULL;
ECORE_MAGIC_SET(e, ECORE_MAGIC_EVENT);
e->type = type;
e->event = ev;
e->func_free = func_free;
e->data = data;
if (inpurge > 0) {
purge_events =
(Ecore_Event *)
eina_inlist_append(EINA_INLIST_GET(purge_events),
EINA_INLIST_GET(e));
events_num++;
} else {
events =
(Ecore_Event *)
eina_inlist_append(EINA_INLIST_GET(events),
EINA_INLIST_GET(e));
events_num++;
}
return e;
}
void *_ecore_event_del(Ecore_Event * event)
{
void *data;
data = event->data;
if (event->func_free)
event->func_free(event->data, event->event);
events =
(Ecore_Event *) eina_inlist_remove(EINA_INLIST_GET(events),
EINA_INLIST_GET(event));
ECORE_MAGIC_SET(event, ECORE_MAGIC_NONE);
free(event);
events_num--;
return data;
}
static void _ecore_event_purge_deleted(void)
{
Ecore_Event *itr = events;
inpurge++;
while (itr) {
Ecore_Event *next =
(Ecore_Event *) EINA_INLIST_GET(itr)->next;
if ((!itr->references) && (itr->delete_me))
_ecore_event_del(itr);
itr = next;
}
inpurge--;
while (purge_events) {
Ecore_Event *e = purge_events;
purge_events =
(Ecore_Event *)
eina_inlist_remove(EINA_INLIST_GET(purge_events),
EINA_INLIST_GET(purge_events));
events =
(Ecore_Event *)
eina_inlist_append(EINA_INLIST_GET(events),
EINA_INLIST_GET(e));
}
}
static inline void _ecore_event_filters_apply()
{
if (!event_filter_current) {
/* regular main loop, start from head */
event_filter_current = event_filters;
} else {
/* recursive main loop, continue from where we were */
event_filter_current =
(Ecore_Event_Filter *)
EINA_INLIST_GET(event_filter_current)->next;
}
while (event_filter_current) {
Ecore_Event_Filter *ef = event_filter_current;
if (!ef->delete_me) {
ef->references++;
if (ef->func_start)
ef->loop_data = ef->func_start(ef->data);
if (!event_filter_event_current) {
/* regular main loop, start from head */
event_filter_event_current = events;
} else {
/* recursive main loop, continue from where we were */
event_filter_event_current =
(Ecore_Event *)
EINA_INLIST_GET
(event_filter_event_current)->next;
}
while (event_filter_event_current) {
Ecore_Event *e =
event_filter_event_current;
if (!ef->
func_filter(ef->data, ef->loop_data,
e->type, e->event)) {
ecore_event_del(e);
}
if (event_filter_event_current) /* may have changed in recursive main loops */
event_filter_event_current =
(Ecore_Event *)
EINA_INLIST_GET
(event_filter_event_current)->
next;
}
if (ef->func_end)
ef->func_end(ef->data, ef->loop_data);
ef->references--;
}
if (event_filter_current) /* may have changed in recursive main loops */
event_filter_current =
(Ecore_Event_Filter *)
EINA_INLIST_GET(event_filter_current)->next;
}
if (event_filters_delete_me) {
int deleted_in_use = 0;
Ecore_Event_Filter *l;
for (l = event_filters; l;) {
Ecore_Event_Filter *ef = l;
l = (Ecore_Event_Filter *) EINA_INLIST_GET(l)->
next;
if (ef->delete_me) {
if (ef->references) {
deleted_in_use++;
continue;
}
event_filters =
(Ecore_Event_Filter *)
eina_inlist_remove(EINA_INLIST_GET
(event_filters),
EINA_INLIST_GET
(ef));
ECORE_MAGIC_SET(ef, ECORE_MAGIC_NONE);
free(ef);
}
}
if (!deleted_in_use)
event_filters_delete_me = 0;
}
}
void _ecore_event_call(void)
{
Eina_List *l, *l_next;
Ecore_Event_Handler *eh;
_ecore_event_filters_apply();
if (!event_current) {
/* regular main loop, start from head */
event_current = events;
event_handler_current = NULL;
}
while (event_current) {
Ecore_Event *e = event_current;
int handle_count = 0;
if (e->delete_me) {
event_current =
(Ecore_Event *)
EINA_INLIST_GET(event_current)->next;
continue;
}
ecore_raw_event_type = e->type;
ecore_raw_event_event = e->event;
e->references++;
if ((e->type >= 0) && (e->type < event_handlers_num)) {
if (!event_handler_current) {
/* regular main loop, start from head */
event_handler_current =
event_handlers[e->type];
} else {
/* recursive main loop, continue from where we were */
event_handler_current =
(Ecore_Event_Handler *)
EINA_INLIST_GET
(event_handler_current)->next;
}
while ((event_handler_current) && (!e->delete_me)) {
Ecore_Event_Handler *eh =
event_handler_current;
if (!eh->delete_me) {
Eina_Bool ret;
handle_count++;
eh->references++;
ret =
eh->func(eh->data, e->type,
e->event);
eh->references--;
if (!ret) {
event_handler_current =
NULL;
break; /* 0 == "call no further handlers" */
}
}
if (event_handler_current) /* may have changed in recursive main loops */
event_handler_current =
(Ecore_Event_Handler *)
EINA_INLIST_GET
(event_handler_current)->next;
}
}
/* if no handlers were set for EXIT signal - then default is */
/* to quit the main loop */
if ((e->type == ECORE_EVENT_SIGNAL_EXIT)
&& (handle_count == 0))
ecore_main_loop_quit();
e->references--;
e->delete_me = 1;
if (event_current) /* may have changed in recursive main loops */
event_current =
(Ecore_Event *)
EINA_INLIST_GET(event_current)->next;
}
ecore_raw_event_type = ECORE_EVENT_NONE;
ecore_raw_event_event = NULL;
_ecore_event_purge_deleted();
EINA_LIST_FOREACH_SAFE(event_handlers_delete_list, l, l_next, eh) {
if (eh->references)
continue;
event_handlers_delete_list =
eina_list_remove_list(event_handlers_delete_list, l);
event_handlers[eh->type] =
(Ecore_Event_Handler *)
eina_inlist_remove(EINA_INLIST_GET
(event_handlers[eh->type]),
EINA_INLIST_GET(eh));
ECORE_MAGIC_SET(eh, ECORE_MAGIC_NONE);
free(eh);
}
}
EAPI void *_ecore_event_signal_user_new(void)
{
Ecore_Event_Signal_User *e;
e = calloc(1, sizeof(Ecore_Event_Signal_User));
return e;
}
void *_ecore_event_signal_hup_new(void)
{
Ecore_Event_Signal_Hup *e;
e = calloc(1, sizeof(Ecore_Event_Signal_Hup));
return e;
}
void *_ecore_event_signal_exit_new(void)
{
Ecore_Event_Signal_Exit *e;
e = calloc(1, sizeof(Ecore_Event_Signal_Exit));
return e;
}
void *_ecore_event_signal_power_new(void)
{
Ecore_Event_Signal_Power *e;
e = calloc(1, sizeof(Ecore_Event_Signal_Power));
return e;
}
void *_ecore_event_signal_realtime_new(void)
{
return calloc(1, sizeof(Ecore_Event_Signal_Realtime));
}
| 28.219512 | 82 | 0.713458 |
ebe333394c8606fbb146977e2246c3846efd5eba | 67,272 | c | C | software/edisplay/host/lv_edisplay/font_lib24.c | mbouyer/marine_chartplotter | ecaa4ad40ac0b437fadb88284b750e5894f5630c | [
"BSD-2-Clause"
] | 3 | 2017-02-18T20:54:59.000Z | 2019-12-09T16:43:38.000Z | software/edisplay/host/lv_edisplay/font_lib24.c | mbouyer/marine_chartplotter | ecaa4ad40ac0b437fadb88284b750e5894f5630c | [
"BSD-2-Clause"
] | null | null | null | software/edisplay/host/lv_edisplay/font_lib24.c | mbouyer/marine_chartplotter | ecaa4ad40ac0b437fadb88284b750e5894f5630c | [
"BSD-2-Clause"
] | 1 | 2021-09-18T11:58:00.000Z | 2021-09-18T11:58:00.000Z | #include "lvgl/lvgl.h"
#include "lv_edisplay/edisplay_font.h"
/*******************************************************************************
* Size: 24 px
* Bpp: 2
* Opts:
******************************************************************************/
#ifndef LIB24
#define LIB24 1
#endif
#if LIB24
/*-----------------
* BITMAPS
*----------------*/
/*Store the image of the glyphs*/
static LV_ATTRIBUTE_LARGE_CONST const uint8_t gylph_bitmap[] = {
/* U+20 " " */
/* U+21 "!" */
0xf7, 0xdf, 0x7d, 0xf7, 0xdf, 0x7d, 0xf7, 0xcf,
0x0, 0x0, 0xf, 0x7d,
/* U+22 "\"" */
0xfc, 0x2f, 0x2f, 0x7, 0xcb, 0xc1, 0xf2, 0xe0,
0x7c, 0xb8, 0x1f, 0x1e, 0x3, 0xc7, 0x80, 0xf0,
/* U+23 "#" */
0x0, 0x38, 0x3, 0x0, 0x3, 0x40, 0x70, 0x0,
0x30, 0xa, 0x0, 0x7, 0x0, 0xe0, 0x0, 0xb0,
0xd, 0x3, 0xff, 0xff, 0xff, 0x5, 0xd5, 0x6d,
0x40, 0xc, 0x2, 0x80, 0x1, 0xc0, 0x34, 0x0,
0x28, 0x3, 0x40, 0x7f, 0xff, 0xff, 0xd1, 0x75,
0x5b, 0x54, 0x7, 0x0, 0xe0, 0x0, 0xb0, 0xd,
0x0, 0xa, 0x0, 0xc0, 0x0, 0xd0, 0x1c, 0x0,
/* U+24 "$" */
0x0, 0xb, 0x0, 0x0, 0x0, 0xb0, 0x0, 0x1,
0xbf, 0xe4, 0x0, 0x7f, 0xfb, 0xf0, 0xf, 0xb,
0xb, 0x81, 0xe0, 0xb0, 0x3c, 0x2e, 0xb, 0x0,
0x1, 0xf0, 0xb0, 0x0, 0xf, 0xdb, 0x0, 0x0,
0x3f, 0xf9, 0x0, 0x0, 0x2f, 0xfe, 0x0, 0x0,
0xb2, 0xfc, 0x0, 0xb, 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0, 0x0,
0x1e, 0x0, 0x0, 0x3, 0xc0, 0x0, 0xe, 0xf4,
0x0, 0x0, 0xfd, 0x0, 0x0
};
/*---------------------
* GLYPH DESCRIPTION
*--------------------*/
static const lv_font_fmt_txt_glyph_dsc_t glyph_dsc[] = {
{.bitmap_index = 0, .adv_w = 0, .box_h = 0, .box_w = 0, .ofs_x = 0, .ofs_y = 0} /* id = 0 reserved */,
{.bitmap_index = 0, .adv_w = 230, .box_h = 0, .box_w = 0, .ofs_x = 0, .ofs_y = 0},
{.bitmap_index = 0, .adv_w = 230, .box_h = 16, .box_w = 3, .ofs_x = 6, .ofs_y = 0},
{.bitmap_index = 12, .adv_w = 230, .box_h = 7, .box_w = 9, .ofs_x = 3, .ofs_y = 10},
{.bitmap_index = 28, .adv_w = 230, .box_h = 16, .box_w = 14, .ofs_x = 0, .ofs_y = 0},
{.bitmap_index = 84, .adv_w = 230, .box_h = 20, .box_w = 14, .ofs_x = 0, .ofs_y = -2},
{.bitmap_index = 154, .adv_w = 230, .box_h = 16, .box_w = 15, .ofs_x = 0, .ofs_y = 0},
{.bitmap_index = 214, .adv_w = 230, .box_h = 16, .box_w = 14, .ofs_x = 0, .ofs_y = 0},
{.bitmap_index = 270, .adv_w = 230, .box_h = 7, .box_w = 3, .ofs_x = 6, .ofs_y = 10},
{.bitmap_index = 276, .adv_w = 230, .box_h = 22, .box_w = 7, .ofs_x = 4, .ofs_y = -5},
{.bitmap_index = 315, .adv_w = 230, .box_h = 22, .box_w = 7, .ofs_x = 4, .ofs_y = -5},
{.bitmap_index = 354, .adv_w = 230, .box_h = 8, .box_w = 9, .ofs_x = 3, .ofs_y = 9},
{.bitmap_index = 372, .adv_w = 230, .box_h = 12, .box_w = 12, .ofs_x = 1, .ofs_y = 2},
{.bitmap_index = 408, .adv_w = 230, .box_h = 8, .box_w = 5, .ofs_x = 3, .ofs_y = -4},
{.bitmap_index = 418, .adv_w = 230, .box_h = 2, .box_w = 8, .ofs_x = 3, .ofs_y = 5},
{.bitmap_index = 422, .adv_w = 230, .box_h = 4, .box_w = 4, .ofs_x = 5, .ofs_y = 0},
{.bitmap_index = 426, .adv_w = 230, .box_h = 17, .box_w = 12, .ofs_x = 1, .ofs_y = 0},
{.bitmap_index = 477, .adv_w = 230, .box_h = 16, .box_w = 12, .ofs_x = 1, .ofs_y = 0},
{.bitmap_index = 525, .adv_w = 230, .box_h = 16, .box_w = 13, .ofs_x = 1, .ofs_y = 0},
{.bitmap_index = 577, .adv_w = 230, .box_h = 16, .box_w = 12, .ofs_x = 1, .ofs_y = 0},
{.bitmap_index = 625, .adv_w = 230, .box_h = 16, .box_w = 12, .ofs_x = 1, .ofs_y = 0},
{.bitmap_index = 673, .adv_w = 230, .box_h = 16, .box_w = 13, .ofs_x = 1, .ofs_y = 0},
{.bitmap_index = 725, .adv_w = 230, .box_h = 16, .box_w = 12, .ofs_x = 1, .ofs_y = 0},
{.bitmap_index = 773, .adv_w = 230, .box_h = 16, .box_w = 12, .ofs_x = 1, .ofs_y = 0},
{.bitmap_index = 821, .adv_w = 230, .box_h = 16, .box_w = 12, .ofs_x = 1, .ofs_y = 0},
{.bitmap_index = 869, .adv_w = 230, .box_h = 16, .box_w = 12, .ofs_x = 1, .ofs_y = 0},
{.bitmap_index = 917, .adv_w = 230, .box_h = 16, .box_w = 12, .ofs_x = 1, .ofs_y = 0},
{.bitmap_index = 965, .adv_w = 230, .box_h = 13, .box_w = 4, .ofs_x = 5, .ofs_y = 0},
{.bitmap_index = 978, .adv_w = 230, .box_h = 17, .box_w = 6, .ofs_x = 4, .ofs_y = -4},
{.bitmap_index = 1004, .adv_w = 230, .box_h = 12, .box_w = 12, .ofs_x = 1, .ofs_y = 2},
{.bitmap_index = 1040, .adv_w = 230, .box_h = 8, .box_w = 12, .ofs_x = 1, .ofs_y = 4},
{.bitmap_index = 1064, .adv_w = 230, .box_h = 12, .box_w = 12, .ofs_x = 1, .ofs_y = 2},
{.bitmap_index = 1100, .adv_w = 230, .box_h = 16, .box_w = 12, .ofs_x = 1, .ofs_y = 0},
{.bitmap_index = 1148, .adv_w = 230, .box_h = 20, .box_w = 14, .ofs_x = 0, .ofs_y = -3},
{.bitmap_index = 1218, .adv_w = 230, .box_h = 16, .box_w = 15, .ofs_x = 0, .ofs_y = 0},
{.bitmap_index = 1278, .adv_w = 230, .box_h = 16, .box_w = 12, .ofs_x = 2, .ofs_y = 0},
{.bitmap_index = 1326, .adv_w = 230, .box_h = 16, .box_w = 13, .ofs_x = 1, .ofs_y = 0},
{.bitmap_index = 1378, .adv_w = 230, .box_h = 16, .box_w = 12, .ofs_x = 2, .ofs_y = 0},
{.bitmap_index = 1426, .adv_w = 230, .box_h = 16, .box_w = 12, .ofs_x = 2, .ofs_y = 0},
{.bitmap_index = 1474, .adv_w = 230, .box_h = 16, .box_w = 11, .ofs_x = 2, .ofs_y = 0},
{.bitmap_index = 1518, .adv_w = 230, .box_h = 16, .box_w = 12, .ofs_x = 1, .ofs_y = 0},
{.bitmap_index = 1566, .adv_w = 230, .box_h = 16, .box_w = 11, .ofs_x = 2, .ofs_y = 0},
{.bitmap_index = 1610, .adv_w = 230, .box_h = 16, .box_w = 10, .ofs_x = 2, .ofs_y = 0},
{.bitmap_index = 1650, .adv_w = 230, .box_h = 16, .box_w = 10, .ofs_x = 2, .ofs_y = 0},
{.bitmap_index = 1690, .adv_w = 230, .box_h = 16, .box_w = 13, .ofs_x = 2, .ofs_y = 0},
{.bitmap_index = 1742, .adv_w = 230, .box_h = 16, .box_w = 11, .ofs_x = 2, .ofs_y = 0},
{.bitmap_index = 1786, .adv_w = 230, .box_h = 16, .box_w = 12, .ofs_x = 1, .ofs_y = 0},
{.bitmap_index = 1834, .adv_w = 230, .box_h = 16, .box_w = 11, .ofs_x = 2, .ofs_y = 0},
{.bitmap_index = 1878, .adv_w = 230, .box_h = 16, .box_w = 13, .ofs_x = 1, .ofs_y = 0},
{.bitmap_index = 1930, .adv_w = 230, .box_h = 16, .box_w = 11, .ofs_x = 2, .ofs_y = 0},
{.bitmap_index = 1974, .adv_w = 230, .box_h = 21, .box_w = 13, .ofs_x = 1, .ofs_y = -5},
{.bitmap_index = 2043, .adv_w = 230, .box_h = 16, .box_w = 12, .ofs_x = 2, .ofs_y = 0},
{.bitmap_index = 2091, .adv_w = 230, .box_h = 16, .box_w = 13, .ofs_x = 1, .ofs_y = 0},
{.bitmap_index = 2143, .adv_w = 230, .box_h = 16, .box_w = 13, .ofs_x = 1, .ofs_y = 0},
{.bitmap_index = 2195, .adv_w = 230, .box_h = 16, .box_w = 12, .ofs_x = 1, .ofs_y = 0},
{.bitmap_index = 2243, .adv_w = 230, .box_h = 16, .box_w = 15, .ofs_x = 0, .ofs_y = 0},
{.bitmap_index = 2303, .adv_w = 230, .box_h = 16, .box_w = 15, .ofs_x = 0, .ofs_y = 0},
{.bitmap_index = 2363, .adv_w = 230, .box_h = 16, .box_w = 14, .ofs_x = 0, .ofs_y = 0},
{.bitmap_index = 2419, .adv_w = 230, .box_h = 16, .box_w = 14, .ofs_x = 0, .ofs_y = 0},
{.bitmap_index = 2475, .adv_w = 230, .box_h = 16, .box_w = 14, .ofs_x = 0, .ofs_y = 0},
{.bitmap_index = 2531, .adv_w = 230, .box_h = 22, .box_w = 8, .ofs_x = 4, .ofs_y = -5},
{.bitmap_index = 2575, .adv_w = 230, .box_h = 17, .box_w = 12, .ofs_x = 1, .ofs_y = 0},
{.bitmap_index = 2626, .adv_w = 230, .box_h = 22, .box_w = 7, .ofs_x = 3, .ofs_y = -5},
{.bitmap_index = 2665, .adv_w = 230, .box_h = 11, .box_w = 12, .ofs_x = 1, .ofs_y = 5},
{.bitmap_index = 2698, .adv_w = 230, .box_h = 2, .box_w = 16, .ofs_x = -1, .ofs_y = -3},
{.bitmap_index = 2706, .adv_w = 230, .box_h = 3, .box_w = 6, .ofs_x = 4, .ofs_y = 14},
{.bitmap_index = 2711, .adv_w = 230, .box_h = 13, .box_w = 13, .ofs_x = 1, .ofs_y = 0},
{.bitmap_index = 2754, .adv_w = 230, .box_h = 17, .box_w = 11, .ofs_x = 2, .ofs_y = 0},
{.bitmap_index = 2801, .adv_w = 230, .box_h = 13, .box_w = 12, .ofs_x = 1, .ofs_y = 0},
{.bitmap_index = 2840, .adv_w = 230, .box_h = 17, .box_w = 12, .ofs_x = 1, .ofs_y = 0},
{.bitmap_index = 2891, .adv_w = 230, .box_h = 13, .box_w = 12, .ofs_x = 1, .ofs_y = 0},
{.bitmap_index = 2930, .adv_w = 230, .box_h = 17, .box_w = 12, .ofs_x = 1, .ofs_y = 0},
{.bitmap_index = 2981, .adv_w = 230, .box_h = 18, .box_w = 12, .ofs_x = 1, .ofs_y = -5},
{.bitmap_index = 3035, .adv_w = 230, .box_h = 17, .box_w = 11, .ofs_x = 2, .ofs_y = 0},
{.bitmap_index = 3082, .adv_w = 230, .box_h = 17, .box_w = 13, .ofs_x = 1, .ofs_y = 0},
{.bitmap_index = 3138, .adv_w = 230, .box_h = 22, .box_w = 9, .ofs_x = 1, .ofs_y = -5},
{.bitmap_index = 3188, .adv_w = 230, .box_h = 17, .box_w = 11, .ofs_x = 2, .ofs_y = 0},
{.bitmap_index = 3235, .adv_w = 230, .box_h = 17, .box_w = 12, .ofs_x = 1, .ofs_y = 0},
{.bitmap_index = 3286, .adv_w = 230, .box_h = 13, .box_w = 13, .ofs_x = 1, .ofs_y = 0},
{.bitmap_index = 3329, .adv_w = 230, .box_h = 13, .box_w = 11, .ofs_x = 2, .ofs_y = 0},
{.bitmap_index = 3365, .adv_w = 230, .box_h = 13, .box_w = 12, .ofs_x = 1, .ofs_y = 0},
{.bitmap_index = 3404, .adv_w = 230, .box_h = 18, .box_w = 11, .ofs_x = 2, .ofs_y = -5},
{.bitmap_index = 3454, .adv_w = 230, .box_h = 18, .box_w = 12, .ofs_x = 1, .ofs_y = -5},
{.bitmap_index = 3508, .adv_w = 230, .box_h = 13, .box_w = 11, .ofs_x = 2, .ofs_y = 0},
{.bitmap_index = 3544, .adv_w = 230, .box_h = 13, .box_w = 11, .ofs_x = 2, .ofs_y = 0},
{.bitmap_index = 3580, .adv_w = 230, .box_h = 16, .box_w = 10, .ofs_x = 2, .ofs_y = 0},
{.bitmap_index = 3620, .adv_w = 230, .box_h = 13, .box_w = 11, .ofs_x = 2, .ofs_y = 0},
{.bitmap_index = 3656, .adv_w = 230, .box_h = 13, .box_w = 14, .ofs_x = 0, .ofs_y = 0},
{.bitmap_index = 3702, .adv_w = 230, .box_h = 13, .box_w = 15, .ofs_x = 0, .ofs_y = 0},
{.bitmap_index = 3751, .adv_w = 230, .box_h = 13, .box_w = 13, .ofs_x = 1, .ofs_y = 0},
{.bitmap_index = 3794, .adv_w = 230, .box_h = 18, .box_w = 14, .ofs_x = 0, .ofs_y = -5},
{.bitmap_index = 3857, .adv_w = 230, .box_h = 13, .box_w = 12, .ofs_x = 1, .ofs_y = 0},
{.bitmap_index = 3896, .adv_w = 230, .box_h = 22, .box_w = 11, .ofs_x = 2, .ofs_y = -5},
{.bitmap_index = 3957, .adv_w = 230, .box_h = 22, .box_w = 3, .ofs_x = 6, .ofs_y = -5},
{.bitmap_index = 3974, .adv_w = 230, .box_h = 22, .box_w = 10, .ofs_x = 2, .ofs_y = -5},
{.bitmap_index = 4029, .adv_w = 230, .box_h = 4, .box_w = 13, .ofs_x = 1, .ofs_y = 6},
{.bitmap_index = 4042, .adv_w = 230, .box_h = 7, .box_w = 8, .ofs_x = 3, .ofs_y = 9},
{.bitmap_index = 4056, .adv_w = 230, .box_h = 20, .box_w = 15, .ofs_x = 0, .ofs_y = 0},
{.bitmap_index = 4131, .adv_w = 230, .box_h = 20, .box_w = 15, .ofs_x = 0, .ofs_y = 0},
{.bitmap_index = 4206, .adv_w = 230, .box_h = 20, .box_w = 15, .ofs_x = 0, .ofs_y = 0},
{.bitmap_index = 4281, .adv_w = 230, .box_h = 20, .box_w = 15, .ofs_x = 0, .ofs_y = 0},
{.bitmap_index = 4356, .adv_w = 230, .box_h = 20, .box_w = 15, .ofs_x = 0, .ofs_y = 0},
{.bitmap_index = 4431, .adv_w = 230, .box_h = 20, .box_w = 15, .ofs_x = 0, .ofs_y = 0},
{.bitmap_index = 4506, .adv_w = 230, .box_h = 16, .box_w = 14, .ofs_x = 0, .ofs_y = 0},
{.bitmap_index = 4562, .adv_w = 230, .box_h = 21, .box_w = 13, .ofs_x = 1, .ofs_y = -5},
{.bitmap_index = 4631, .adv_w = 230, .box_h = 20, .box_w = 12, .ofs_x = 2, .ofs_y = 0},
{.bitmap_index = 4691, .adv_w = 230, .box_h = 20, .box_w = 12, .ofs_x = 2, .ofs_y = 0},
{.bitmap_index = 4751, .adv_w = 230, .box_h = 20, .box_w = 12, .ofs_x = 2, .ofs_y = 0},
{.bitmap_index = 4811, .adv_w = 230, .box_h = 20, .box_w = 12, .ofs_x = 2, .ofs_y = 0},
{.bitmap_index = 4871, .adv_w = 230, .box_h = 20, .box_w = 10, .ofs_x = 2, .ofs_y = 0},
{.bitmap_index = 4921, .adv_w = 230, .box_h = 20, .box_w = 10, .ofs_x = 2, .ofs_y = 0},
{.bitmap_index = 4971, .adv_w = 230, .box_h = 20, .box_w = 10, .ofs_x = 2, .ofs_y = 0},
{.bitmap_index = 5021, .adv_w = 230, .box_h = 20, .box_w = 10, .ofs_x = 2, .ofs_y = 0},
{.bitmap_index = 5071, .adv_w = 230, .box_h = 16, .box_w = 14, .ofs_x = 0, .ofs_y = 0},
{.bitmap_index = 5127, .adv_w = 230, .box_h = 20, .box_w = 11, .ofs_x = 2, .ofs_y = 0},
{.bitmap_index = 5182, .adv_w = 230, .box_h = 20, .box_w = 13, .ofs_x = 1, .ofs_y = 0},
{.bitmap_index = 5247, .adv_w = 230, .box_h = 20, .box_w = 13, .ofs_x = 1, .ofs_y = 0},
{.bitmap_index = 5312, .adv_w = 230, .box_h = 20, .box_w = 13, .ofs_x = 1, .ofs_y = 0},
{.bitmap_index = 5377, .adv_w = 230, .box_h = 20, .box_w = 13, .ofs_x = 1, .ofs_y = 0},
{.bitmap_index = 5442, .adv_w = 230, .box_h = 20, .box_w = 13, .ofs_x = 1, .ofs_y = 0},
{.bitmap_index = 5507, .adv_w = 230, .box_h = 11, .box_w = 12, .ofs_x = 1, .ofs_y = 3},
{.bitmap_index = 5540, .adv_w = 230, .box_h = 17, .box_w = 14, .ofs_x = 0, .ofs_y = 0},
{.bitmap_index = 5600, .adv_w = 230, .box_h = 20, .box_w = 12, .ofs_x = 1, .ofs_y = 0},
{.bitmap_index = 5660, .adv_w = 230, .box_h = 20, .box_w = 12, .ofs_x = 1, .ofs_y = 0},
{.bitmap_index = 5720, .adv_w = 230, .box_h = 20, .box_w = 12, .ofs_x = 1, .ofs_y = 0},
{.bitmap_index = 5780, .adv_w = 230, .box_h = 20, .box_w = 12, .ofs_x = 1, .ofs_y = 0},
{.bitmap_index = 5840, .adv_w = 230, .box_h = 20, .box_w = 14, .ofs_x = 0, .ofs_y = 0},
{.bitmap_index = 5910, .adv_w = 230, .box_h = 16, .box_w = 11, .ofs_x = 2, .ofs_y = 0},
{.bitmap_index = 5954, .adv_w = 230, .box_h = 17, .box_w = 13, .ofs_x = 1, .ofs_y = 0},
{.bitmap_index = 6010, .adv_w = 230, .box_h = 17, .box_w = 13, .ofs_x = 1, .ofs_y = 0},
{.bitmap_index = 6066, .adv_w = 230, .box_h = 17, .box_w = 13, .ofs_x = 1, .ofs_y = 0},
{.bitmap_index = 6122, .adv_w = 230, .box_h = 17, .box_w = 13, .ofs_x = 1, .ofs_y = 0},
{.bitmap_index = 6178, .adv_w = 230, .box_h = 17, .box_w = 13, .ofs_x = 1, .ofs_y = 0},
{.bitmap_index = 6234, .adv_w = 230, .box_h = 17, .box_w = 13, .ofs_x = 1, .ofs_y = 0},
{.bitmap_index = 6290, .adv_w = 230, .box_h = 19, .box_w = 13, .ofs_x = 1, .ofs_y = 0},
{.bitmap_index = 6352, .adv_w = 230, .box_h = 13, .box_w = 15, .ofs_x = 0, .ofs_y = 0},
{.bitmap_index = 6401, .adv_w = 230, .box_h = 18, .box_w = 12, .ofs_x = 1, .ofs_y = -5},
{.bitmap_index = 6455, .adv_w = 230, .box_h = 17, .box_w = 12, .ofs_x = 1, .ofs_y = 0},
{.bitmap_index = 6506, .adv_w = 230, .box_h = 17, .box_w = 12, .ofs_x = 1, .ofs_y = 0},
{.bitmap_index = 6557, .adv_w = 230, .box_h = 17, .box_w = 12, .ofs_x = 1, .ofs_y = 0},
{.bitmap_index = 6608, .adv_w = 230, .box_h = 17, .box_w = 12, .ofs_x = 1, .ofs_y = 0},
{.bitmap_index = 6659, .adv_w = 230, .box_h = 17, .box_w = 13, .ofs_x = 1, .ofs_y = 0},
{.bitmap_index = 6715, .adv_w = 230, .box_h = 17, .box_w = 13, .ofs_x = 1, .ofs_y = 0},
{.bitmap_index = 6771, .adv_w = 230, .box_h = 17, .box_w = 13, .ofs_x = 1, .ofs_y = 0},
{.bitmap_index = 6827, .adv_w = 230, .box_h = 17, .box_w = 13, .ofs_x = 1, .ofs_y = 0},
{.bitmap_index = 6883, .adv_w = 230, .box_h = 17, .box_w = 12, .ofs_x = 1, .ofs_y = 0},
{.bitmap_index = 6934, .adv_w = 230, .box_h = 17, .box_w = 11, .ofs_x = 2, .ofs_y = 0},
{.bitmap_index = 6981, .adv_w = 230, .box_h = 17, .box_w = 12, .ofs_x = 1, .ofs_y = 0},
{.bitmap_index = 7032, .adv_w = 230, .box_h = 17, .box_w = 12, .ofs_x = 1, .ofs_y = 0},
{.bitmap_index = 7083, .adv_w = 230, .box_h = 17, .box_w = 12, .ofs_x = 1, .ofs_y = 0},
{.bitmap_index = 7134, .adv_w = 230, .box_h = 17, .box_w = 12, .ofs_x = 1, .ofs_y = 0},
{.bitmap_index = 7185, .adv_w = 230, .box_h = 17, .box_w = 12, .ofs_x = 1, .ofs_y = 0},
{.bitmap_index = 7236, .adv_w = 230, .box_h = 12, .box_w = 12, .ofs_x = 1, .ofs_y = 2},
{.bitmap_index = 7272, .adv_w = 230, .box_h = 13, .box_w = 12, .ofs_x = 1, .ofs_y = 0},
{.bitmap_index = 7311, .adv_w = 230, .box_h = 17, .box_w = 11, .ofs_x = 2, .ofs_y = 0},
{.bitmap_index = 7358, .adv_w = 230, .box_h = 17, .box_w = 11, .ofs_x = 2, .ofs_y = 0},
{.bitmap_index = 7405, .adv_w = 230, .box_h = 17, .box_w = 11, .ofs_x = 2, .ofs_y = 0},
{.bitmap_index = 7452, .adv_w = 230, .box_h = 17, .box_w = 11, .ofs_x = 2, .ofs_y = 0},
{.bitmap_index = 7499, .adv_w = 230, .box_h = 22, .box_w = 14, .ofs_x = 0, .ofs_y = -5},
{.bitmap_index = 7576, .adv_w = 230, .box_h = 22, .box_w = 11, .ofs_x = 2, .ofs_y = -5},
{.bitmap_index = 7637, .adv_w = 230, .box_h = 22, .box_w = 14, .ofs_x = 0, .ofs_y = -5}
};
/*---------------------
* CHARACTER MAPPING
*--------------------*/
/*Collect the unicode lists and glyph_id offsets*/
static const lv_font_fmt_txt_cmap_t cmaps[] =
{
{
.range_start = 32, .range_length = 95, .type = LV_FONT_FMT_TXT_CMAP_FORMAT0_TINY,
.glyph_id_start = 1, .unicode_list = NULL, .glyph_id_ofs_list = NULL, .list_length = 0
},
{
.range_start = 176, .range_length = 1, .type = LV_FONT_FMT_TXT_CMAP_FORMAT0_TINY,
.glyph_id_start = 96, .unicode_list = NULL, .glyph_id_ofs_list = NULL, .list_length = 0
},
{
.range_start = 192, .range_length = 64, .type = LV_FONT_FMT_TXT_CMAP_FORMAT0_TINY,
.glyph_id_start = 97, .unicode_list = NULL, .glyph_id_ofs_list = NULL, .list_length = 0
}
};
/*--------------------
* ALL CUSTOM DATA
*--------------------*/
/*Store all the custom data of the font*/
static lv_font_fmt_txt_dsc_t font_dsc = {
.glyph_bitmap = gylph_bitmap,
.glyph_dsc = glyph_dsc,
.cmaps = cmaps,
.cmap_num = 3,
.bpp = 2,
.kern_scale = 0,
.kern_dsc = NULL,
.kern_classes = 0,
};
/*-----------------
* PUBLIC FONT
*----------------*/
/*Initialize a public general font descriptor*/
lv_font_t lib24 = {
.dsc = &font_dsc, /*The custom font data. Will be accessed by `get_glyph_bitmap/dsc` */
.get_glyph_bitmap = lv_font_get_bitmap_fmt_txt, /*Function pointer to get glyph's bitmap*/
.get_glyph_dsc = lv_font_get_glyph_dsc_fmt_txt, /*Function pointer to get glyph's data*/
.line_height = 26, /*The maximum line height required by the font*/
.base_line = 6, /*Baseline measured from the bottom of the line*/
};
#endif /*#if LIB24*/
| 42.256281 | 106 | 0.554837 |
ebe44bbc78141c495047861d86bf80b6b32b345d | 598 | h | C | HyperBidiOS/HyperBidMyTargetAdapter.framework/Headers/HyperBidMyTargetAdapter.h | hyperbid/hyperbid-ios-sdk | d23a9a4f4c0732e2dedb89ea08b8a59bd3e72b44 | [
"MIT"
] | null | null | null | HyperBidiOS/HyperBidMyTargetAdapter.framework/Headers/HyperBidMyTargetAdapter.h | hyperbid/hyperbid-ios-sdk | d23a9a4f4c0732e2dedb89ea08b8a59bd3e72b44 | [
"MIT"
] | null | null | null | HyperBidiOS/HyperBidMyTargetAdapter.framework/Headers/HyperBidMyTargetAdapter.h | hyperbid/hyperbid-ios-sdk | d23a9a4f4c0732e2dedb89ea08b8a59bd3e72b44 | [
"MIT"
] | null | null | null | //
// HyperBidMyTargetAdapter.h
// HyperBidMyTargetAdapter
//
// Created by HyperBid on 12/29/20.
// Copyright © 2020 HyperBid. All rights reserved.
//
#import <Foundation/Foundation.h>
//! Project version number for HyperBidMyTargetAdapter.
FOUNDATION_EXPORT double HyperBidMyTargetAdapterVersionNumber;
//! Project version string for HyperBidMyTargetAdapter.
FOUNDATION_EXPORT const unsigned char HyperBidMyTargetAdapterVersionString[];
// In this header, you should import all the public headers of your framework using statements like #import <HyperBidMyTargetAdapter/PublicHeader.h>
| 29.9 | 148 | 0.802676 |
ebe551e89d44b14d6ab5aae8a58075e0a6f885fc | 710 | h | C | LQTBaseProject/Category/WTSDK/Category/UI/UIButton+WT.h | liqiantu/LQTBaseProject | 11a89f704aecdc05e9fa11824128f50ac683dd3b | [
"MIT"
] | 268 | 2016-01-24T11:37:51.000Z | 2022-01-12T06:14:58.000Z | LQTBaseProject/Category/WTSDK/Category/UI/UIButton+WT.h | liqiantu/LQTBaseProject | 11a89f704aecdc05e9fa11824128f50ac683dd3b | [
"MIT"
] | 1 | 2016-08-28T08:06:26.000Z | 2016-08-28T08:46:43.000Z | LQTBaseProject/Category/WTSDK/Category/UI/UIButton+WT.h | liqiantu/LQTBaseProject | 11a89f704aecdc05e9fa11824128f50ac683dd3b | [
"MIT"
] | 45 | 2016-09-06T07:03:53.000Z | 2019-04-18T08:28:12.000Z | // GitHub: https://github.com/Tate-zwt/WTSDK
// UIButton+WT.h
// ShopApp
//
// Created by 张威庭 on 16/1/18.
// Copyright © 2016年 cong. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface UIButton (WT)
/** 创建一个Button */
+ (UIButton *)frame:(CGRect)frame title:(NSString *)title font:(UIFont *)font color:(UIColor *)color addView:(UIView *)addView;
/*
* 倒计时按钮
* @param timeLine 倒计时总时间
* @param title 还没倒计时的title
* @param subTitle 倒计时的子名字 如:时、分
* @param mColor 还没倒计时的颜色
* @param color 倒计时的颜色
*/
- (void)startWithTime:(NSInteger)timeLine title:(NSString *)title countDownTitle:(NSString *)subTitle mainColor:(UIColor *)mColor countColor:(UIColor *)color;
@end
| 25.357143 | 158 | 0.669014 |
ebe5b9b7b95453e00a79b01a8c39c5d012b80016 | 318 | h | C | Pod/Classes/Categories/UIFont+CRBoost.h | gushaokun/CRBoost | 8f1b38b0ddc503877ad43a7ac7949c56198017d8 | [
"MIT"
] | null | null | null | Pod/Classes/Categories/UIFont+CRBoost.h | gushaokun/CRBoost | 8f1b38b0ddc503877ad43a7ac7949c56198017d8 | [
"MIT"
] | null | null | null | Pod/Classes/Categories/UIFont+CRBoost.h | gushaokun/CRBoost | 8f1b38b0ddc503877ad43a7ac7949c56198017d8 | [
"MIT"
] | null | null | null | //
// UIFont+CRBoost.h
// TED
//
// Created by RoundTu on 2/18/14.
// Copyright (c) 2014 Cocoa. All rights reserved.
//
#import <UIKit/UIKit.h>
static NSString *const kFontArialRoundedBold = @"ArialRoundedMTBold";
@interface UIFont (CRBoost)
+ (UIFont *)helvetica14;
+ (UIFont *)helvetica:(CGFloat)fontSize;
@end | 21.2 | 69 | 0.701258 |
ebe6447af6013cd9b75a4650e6aa6bd36282cd10 | 53 | c | C | src/main/resources/templates/c/exercise/rotX.c | nicolasruscher/Artemis | 20d0b25fd690913dcb4c7a04bcd5f8f6e1d89d75 | [
"MIT"
] | 1 | 2020-12-06T12:46:51.000Z | 2020-12-06T12:46:51.000Z | src/main/resources/templates/c/exercise/rotX.c | nicolasruscher/Artemis | 20d0b25fd690913dcb4c7a04bcd5f8f6e1d89d75 | [
"MIT"
] | 1 | 2020-11-18T17:36:19.000Z | 2020-11-18T17:36:19.000Z | src/main/resources/templates/c/exercise/rotX.c | nicolasruscher/Artemis | 20d0b25fd690913dcb4c7a04bcd5f8f6e1d89d75 | [
"MIT"
] | null | null | null | // Do magic and implement your "Rot X" programm here. | 53 | 53 | 0.735849 |
ebe71294c45cf176120839aa13d651dc2d7aad45 | 3,474 | h | C | example/test_case_builder.h | walterfan/gtest2md | 80986406f463814246d0a93fa4f4ccd589a85b95 | [
"Apache-2.0"
] | null | null | null | example/test_case_builder.h | walterfan/gtest2md | 80986406f463814246d0a93fa4f4ccd589a85b95 | [
"Apache-2.0"
] | null | null | null | example/test_case_builder.h | walterfan/gtest2md | 80986406f463814246d0a93fa4f4ccd589a85b95 | [
"Apache-2.0"
] | null | null | null | #ifndef __WFAN_TEST_CASE_H__
#define __WFAN_TEST_CASE_H__
#include <iostream>
#include <string>
#include <map>
#include "time.h"
#include "gtest/gtest.h"
#include "gmock/gmock.h"
#include "json/json.h"
namespace wfan {
#ifndef TEST_TRACE
#define TEST_TRACE(msg) std::cout <<"["<<time(NULL)<<", TEST --"<< __FILE__ << "," << std::dec << __LINE__ << " ]\t"<< msg << std::endl
#endif
#if !defined( SAFE_DELETE )
#define SAFE_DELETE( p ) { if(( p ) != NULL) { delete ( p ); (p)=NULL; } }
#endif
struct TestCase {
std::string name;
std::string feature;
std::string scenario;
std::string given;
std::string when;
std::string then;
std::string checkpoints;
bool result;
int Serialize(std::ostream& os) const;
int Deserialize(Json::Value root) ;
};
class TestCaseBuilder
{
public:
TestCaseBuilder():m_pTestCase(NULL)
{
m_pTestCase = new TestCase();
}
virtual ~TestCaseBuilder()
{
SAFE_DELETE(m_pTestCase);
}
TestCaseBuilder* name(std::string name)
{
m_pTestCase->name = name ;
return this;
}
TestCaseBuilder* feature(std::string feature)
{
m_pTestCase->feature = feature ;
return this;
}
TestCaseBuilder* scenario(std::string scenario)
{
m_pTestCase->scenario = scenario ;
return this;
}
TestCaseBuilder* given(std::string given)
{
m_pTestCase->given = given ;
return this;
}
TestCaseBuilder* when(std::string when)
{
m_pTestCase->when = when ;
return this;
}
TestCaseBuilder* then(std::string then)
{
m_pTestCase->then = then ;
return this;
}
TestCaseBuilder* checkpoints(std::string checkpoints)
{
m_pTestCase->checkpoints = checkpoints ;
return this;
}
TestCase* getTestCase()
{
return m_pTestCase;
}
virtual void record()
{
testing::Test::RecordProperty("feature", m_pTestCase->feature);
testing::Test::RecordProperty("scenario", m_pTestCase->scenario);
testing::Test::RecordProperty("given", m_pTestCase->given);
testing::Test::RecordProperty("when", m_pTestCase->when);
testing::Test::RecordProperty("then", m_pTestCase->then);
testing::Test::RecordProperty("checkpoints", m_pTestCase->checkpoints);
}
protected:
TestCase * m_pTestCase;
};
class CBaseTestCase : public testing::Test
{
public:
CBaseTestCase();
virtual ~CBaseTestCase() ;
virtual void SetUp();
virtual void TearDown();
protected:
std::string m_strFeature;
std::string m_strTestName;
TestCaseBuilder* m_pTestCaseBuilder;
};
struct TestSuite {
std::string name;
std::map<std::string, TestCase> testcases;
void PutTestCase(std::string caseName, TestCase testCase);
int Serialize(std::ostream& os) const;
friend std::ostream& operator<<(std::ostream&, const TestSuite& obj);
};
class TestSuitLoader {
public:
TestSuitLoader(std::string fileName);
virtual ~TestSuitLoader();
int Load();
int Serialize(std::ostream& os) const;
friend std::ostream& operator<<(std::ostream&, const TestSuitLoader& obj);
const std::map<std::string, TestSuite>& GetTestsuites() const;
private:
Json::Value m_jsonRoot;
std::string m_strFileName;
std::map<std::string, TestSuite> m_testsuites;
};
}//end of namespace
#endif | 21.7125 | 135 | 0.630973 |
ebe81d914cb226256730bece027cc6fceb28dc68 | 1,952 | h | C | include/exports.h | shell832/QBoot | f5b5169b7463670cb24d223e1c374da33d3d4457 | [
"Unlicense"
] | 1,144 | 2018-12-18T09:46:47.000Z | 2022-03-07T14:51:46.000Z | boot/rpi/include/exports.h | Rokid/YodaOS | d0d7bbc277c0fc1c64e2e0a1c82fe6e63f6eb954 | [
"Apache-2.0"
] | 16 | 2019-01-28T06:08:40.000Z | 2019-12-04T10:26:41.000Z | boot/rpi/include/exports.h | Rokid/YodaOS | d0d7bbc277c0fc1c64e2e0a1c82fe6e63f6eb954 | [
"Apache-2.0"
] | 129 | 2018-12-18T09:46:50.000Z | 2022-03-30T07:30:13.000Z | #ifndef __EXPORTS_H__
#define __EXPORTS_H__
#ifndef __ASSEMBLY__
#ifdef CONFIG_PHY_AQUANTIA
#include <miiphy.h>
#include <phy.h>
#endif
struct spi_slave;
/* These are declarations of exported functions available in C code */
unsigned long get_version(void);
int getc(void);
int tstc(void);
void putc(const char);
void puts(const char*);
int printf(const char* fmt, ...);
void install_hdlr(int, interrupt_handler_t, void*);
void free_hdlr(int);
void *malloc(size_t);
#if !CONFIG_IS_ENABLED(SYS_MALLOC_SIMPLE)
void free(void*);
#endif
void __udelay(unsigned long);
unsigned long get_timer(unsigned long);
int vprintf(const char *, va_list);
unsigned long simple_strtoul(const char *cp, char **endp, unsigned int base);
int strict_strtoul(const char *cp, unsigned int base, unsigned long *res);
char *env_get(const char *name);
int env_set(const char *varname, const char *value);
long simple_strtol(const char *cp, char **endp, unsigned int base);
int strcmp(const char *cs, const char *ct);
unsigned long ustrtoul(const char *cp, char **endp, unsigned int base);
unsigned long long ustrtoull(const char *cp, char **endp, unsigned int base);
#if defined(CONFIG_CMD_I2C) && \
(!defined(CONFIG_DM_I2C) || defined(CONFIG_DM_I2C_COMPAT))
int i2c_write (uchar, uint, int , uchar* , int);
int i2c_read (uchar, uint, int , uchar* , int);
#endif
#ifdef CONFIG_PHY_AQUANTIA
struct mii_dev *mdio_get_current_dev(void);
struct phy_device *phy_find_by_mask(struct mii_dev *bus, unsigned phy_mask,
phy_interface_t interface);
struct phy_device *mdio_phydev_for_ethname(const char *ethname);
int miiphy_set_current_dev(const char *devname);
#endif
void app_startup(char * const *);
#endif /* ifndef __ASSEMBLY__ */
struct jt_funcs {
#define EXPORT_FUNC(impl, res, func, ...) res(*func)(__VA_ARGS__);
#include <_exports.h>
#undef EXPORT_FUNC
};
#define XF_VERSION 9
#if defined(CONFIG_X86)
extern gd_t *global_data;
#endif
#endif /* __EXPORTS_H__ */
| 29.134328 | 77 | 0.757172 |
ebeb0f579ca62896e8d9b7313d875aa3518a655d | 4,960 | c | C | mame/src/mame/video/lsasquad.c | nitrologic/emu | be2c9b72d81c3aea85ad4fd18fa4f731b31f338a | [
"Unlicense"
] | null | null | null | mame/src/mame/video/lsasquad.c | nitrologic/emu | be2c9b72d81c3aea85ad4fd18fa4f731b31f338a | [
"Unlicense"
] | null | null | null | mame/src/mame/video/lsasquad.c | nitrologic/emu | be2c9b72d81c3aea85ad4fd18fa4f731b31f338a | [
"Unlicense"
] | null | null | null | #include "driver.h"
#include "includes/lsasquad.h"
UINT8 *lsasquad_scrollram;
static void draw_layer(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect, UINT8 *scrollram)
{
int offs,scrollx,scrolly;
scrollx = scrollram[3];
scrolly = -scrollram[0];
for (offs = 0;offs < 0x080;offs += 4)
{
int base,y,sx,sy,code,color;
base = 64 * scrollram[offs+1];
sx = 8*(offs/4) + scrollx;
if (flip_screen_get(machine)) sx = 248 - sx;
sx &= 0xff;
for (y = 0;y < 32;y++)
{
int attr;
sy = 8*y + scrolly;
if (flip_screen_get(machine)) sy = 248 - sy;
sy &= 0xff;
attr = videoram[base + 2*y + 1];
code = videoram[base + 2*y] + ((attr & 0x0f) << 8);
color = attr >> 4;
drawgfx_transpen(bitmap,cliprect,machine->gfx[0],
code,
color,
flip_screen_get(machine),flip_screen_get(machine),
sx,sy,15);
if (sx > 248) /* wraparound */
drawgfx_transpen(bitmap,cliprect,machine->gfx[0],
code,
color,
flip_screen_get(machine),flip_screen_get(machine),
sx-256,sy,15);
}
}
}
static int draw_layer_daikaiju(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect, int offs, int * previd, int type)
{
int id,scrollx,scrolly,initoffs, globalscrollx;
int stepx=0;
initoffs=offs;
globalscrollx=0;
id=lsasquad_scrollram[offs+2];
for(;offs < 0x400; offs+=4)
{
int base,y,sx,sy,code,color;
//id change
if(id!=lsasquad_scrollram[offs+2])
{
*previd = id;
return offs;
}
else
{
id=lsasquad_scrollram[offs+2];
}
//skip empty (??) column, potential probs with 1st column in scrollram (scroll 0, tile 0, id 0)
if( (lsasquad_scrollram[offs+0]|lsasquad_scrollram[offs+1]|lsasquad_scrollram[offs+2]|lsasquad_scrollram[offs+3])==0)
continue;
//local scroll x/y
scrolly = -lsasquad_scrollram[offs+0];
scrollx = lsasquad_scrollram[offs+3];
//check for global x scroll used in bg layer in game (starts at offset 0 in scrollram
// and game name/logo on title screen (starts in the middle of scrollram, but with different
// (NOT unique )id than prev coulmn(s)
if( *previd!=1 )
{
if(offs!=initoffs)
{
scrollx+=globalscrollx;
}
else
{
//global scroll init
globalscrollx=scrollx;
}
}
base = 64 * lsasquad_scrollram[offs+1];
sx = scrollx+stepx;
if (flip_screen_get(machine)) sx = 248 - sx;
sx &= 0xff;
for (y = 0;y < 32;y++)
{
int attr;
sy = 8*y + scrolly;
if (flip_screen_get(machine)) sy = 248 - sy;
sy &= 0xff;
attr = videoram[base + 2*y + 1];
code = videoram[base + 2*y] + ((attr & 0x0f) << 8);
color = attr >> 4;
if((type==0 && color!=0x0d) || (type !=0 && color==0x0d))
{
drawgfx_transpen(bitmap,cliprect,machine->gfx[0],
code,
color,
flip_screen_get(machine),flip_screen_get(machine),
sx,sy,15);
if (sx > 248) /* wraparound */
drawgfx_transpen(bitmap,cliprect,machine->gfx[0],
code,
color,
flip_screen_get(machine),flip_screen_get(machine),
sx-256,sy,15);
}
}
}
return offs;
}
static void drawbg(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect, int type)
{
int i=0;
int id=-1;
while(i<0x400)
{
if(!(lsasquad_scrollram[i+2]&1))
{
i=draw_layer_daikaiju(machine, bitmap, cliprect, i, &id,type);
}
else
{
id=lsasquad_scrollram[i+2];
i+=4;
}
}
}
static void draw_sprites(running_machine *machine, bitmap_t *bitmap, const rectangle *cliprect)
{
int offs;
for (offs = spriteram_size-4;offs >= 0;offs -= 4)
{
int sx,sy,attr,code,color,flipx,flipy;
sx = spriteram[offs+3];
sy = 240 - spriteram[offs];
attr = spriteram[offs+1];
code = spriteram[offs+2] + ((attr & 0x30) << 4);
color = attr & 0x0f;
flipx = attr & 0x40;
flipy = attr & 0x80;
if (flip_screen_get(machine))
{
sx = 240 - sx;
sy = 240 - sy;
flipx = !flipx;
flipy = !flipy;
}
drawgfx_transpen(bitmap,cliprect,machine->gfx[1],
code,
color,
flipx,flipy,
sx,sy,15);
/* wraparound */
drawgfx_transpen(bitmap,cliprect,machine->gfx[1],
code,
color,
flipx,flipy,
sx-256,sy,15);
}
}
VIDEO_UPDATE( lsasquad )
{
bitmap_fill(bitmap,cliprect,511);
draw_layer(screen->machine,bitmap,cliprect,lsasquad_scrollram + 0x000);
draw_layer(screen->machine,bitmap,cliprect,lsasquad_scrollram + 0x080);
draw_sprites(screen->machine,bitmap,cliprect);
draw_layer(screen->machine,bitmap,cliprect,lsasquad_scrollram + 0x100);
return 0;
}
VIDEO_UPDATE( daikaiju )
{
bitmap_fill(bitmap,cliprect,511);
drawbg(screen->machine,bitmap,cliprect,0); // bottom
draw_sprites(screen->machine,bitmap,cliprect);
drawbg(screen->machine,bitmap,cliprect,1); // top = pallete $d ?
return 0;
}
| 22.857143 | 137 | 0.618548 |
ebeb7c8464c759062c5b8b06f0437bbc8d7c8511 | 259 | h | C | HJImagePopMenu/Classes/HJImagePopMenu.h | cocoadogs/HJImagePopMenu | db1e02f0c0a8da909dfd4a6a21ee927c011b75ce | [
"MIT"
] | null | null | null | HJImagePopMenu/Classes/HJImagePopMenu.h | cocoadogs/HJImagePopMenu | db1e02f0c0a8da909dfd4a6a21ee927c011b75ce | [
"MIT"
] | null | null | null | HJImagePopMenu/Classes/HJImagePopMenu.h | cocoadogs/HJImagePopMenu | db1e02f0c0a8da909dfd4a6a21ee927c011b75ce | [
"MIT"
] | null | null | null | //
// HJImagePopMenu.h
// HJImagePopMenu
//
// Created by xujunhao on 2018/9/11.
//
#if __has_include(<HJImagePopMenu/HJImagePopMenu.h>)
#import<HJImagePopMenu/UIView+ImagePopMenu.h>
#else
#import "UIView+ImagePopMenu.h"
#endif /* HJImagePopMenu_h */
| 15.235294 | 52 | 0.725869 |
ebeba1324c88e687a78a0c8488d6d94c6cd141fc | 16,632 | c | C | Ymodem.c | redocCheng/Ymodem-rotate-state-machine | 40e58faef892bee164b2aee272672e2aea9005c4 | [
"MIT"
] | 1 | 2019-09-19T03:02:51.000Z | 2019-09-19T03:02:51.000Z | Ymodem.c | redocCheng/Ymodem-rotate-state-machine | 40e58faef892bee164b2aee272672e2aea9005c4 | [
"MIT"
] | null | null | null | Ymodem.c | redocCheng/Ymodem-rotate-state-machine | 40e58faef892bee164b2aee272672e2aea9005c4 | [
"MIT"
] | 1 | 2022-01-27T12:57:08.000Z | 2022-01-27T12:57:08.000Z | /**************************************************************************************************
* INCLUDES
**************************************************************************************************/
#include "ymodem.h"
/*********************************************************************
* CONSTANTS
*/
#define YMODEM_DATA_SIZE_128 128
#define YMODEM_DATA_SIZE_1024 1024
#define YMODEM_RX_IDLE 0
#define YMODEM_RX_ACK 1
#define YMODEM_RX_EOT 2
#define YMODEM_RX_OVER 3
#define YMODEM_RX_ERR 4
#define YMODEM_RX_EXIT 5
#define YMODEM_TX_IDLE 0
#define YMODEM_TX_IDLE_ACK 1
#define YMODEM_TX_DATA 2
#define YMODEM_TX_DATA_ACK 3
#define YMODEM_TX_EOT 4
#define YMODEM_TX_OVER 5
#define YMODEM_TX_ERR 6
#define YMODEM_TX_EXIT 7
/*********************************************************************
* GLOBAL VARIABLES
*/
static uint8_t ym_rx_status = YMODEM_RX_IDLE;
static uint8_t ym_tx_status = YMODEM_TX_IDLE;
static size_t pac_size;
static size_t seek;
static size_t ym_tx_fil_sz;
static uint8_t ym_cyc; //发送时的轮转变量
char ym_pbuf[PACKET_OVERHEAD + PACKET_1K_SIZE];
/*********************************************************************
* EXTERNAL VARIABLES
*/
/*********************************************************************
* EXTERNAL FUNCTIONS
*********************************************************************/
/*********************************************************************
* TYPE_DEFS
*/
/*********************************************************************
* FUNCTIONS
*********************************************************************/
uint8_t ymodem_rx_header( char* fil_nm, size_t fil_sz );
uint8_t ymodem_rx_finish( uint8_t status );
uint8_t ymodem_rx_pac_get( char *buf, size_t seek, size_t size );
uint8_t ymodem_tx_header( char **fil_nm, size_t *fil_sz );
uint8_t ymodem_tx_finish( uint8_t status );
uint8_t ymodem_tx_pac_get( char *buf, size_t seek, size_t size );
void __putchar( char ch );
void __putbuf( char* buf, size_t len );
void ymodem_tx_rx_reset(void)
{
ym_rx_status = YMODEM_RX_IDLE;
ym_tx_status = YMODEM_TX_IDLE;
seek = 0;
}
//核心函数
uint16_t ymodem_crc16(const uint8_t *buf, uint16_t count)
{
uint16_t crc = 0;
uint32_t i;
while(count--) {
crc = crc ^ *buf++ << 8;
for (i=0; i<8; i++) {
if (crc & 0x8000) {
crc = crc << 1 ^ 0x1021;
} else {
crc = crc << 1;
}
}
}
return crc;
}
static const char *ymodem_u32_to_str(uint32_t val)
{
/* Maximum number of decimal digits in u32 is 10 */
static char num_str[11];
uint32_t pos = 10;
num_str[10] = 0;
if (val == 0) {
/* If already zero then just return zero */
return "0";
}
while ((val != 0) && (pos > 0)) {
num_str[--pos] = (val % 10) + '0';
val /= 10;
}
return &num_str[pos];
}
static unsigned long ymodem_str_to_u32(char* str)
{
const char *s = str;
unsigned long acc;
uint32_t c;
/* strip leading spaces if any */
do {
c = *s++;
} while (c == ' ');
for (acc = 0; (c >= '0') && (c <= '9'); c = *s++) {
c -= '0';
acc *= 10;
acc += c;
}
return acc;
}
//返回包的类型
uint8_t ymodem_rx_pac_check( char* buf, size_t sz )
{
char ch;
ch = buf[0];
if( sz < 128 ) //是个指令包
{
if( ch==EOT || ch==ACK || ch==NAK || ch==CAN || ch==CNC )
{
uint32_t i=1;
while( i<sz && buf[i++]==ch ); //判断包中所有内容是否一样
if( sz == i ) //是全部一样的话,则认为此命令包有效
return ch;
else
return 0xff;
}
else
return 0xff; //错误的指令码
}
else
{
if( ch==SOH || ch==STX )
{
uint16_t crc1 = ymodem_crc16( (uint8_t*)(buf+PACKET_HEADER), sz-PACKET_OVERHEAD );
uint16_t crc2 = ((uint16_t)(buf[sz-2]))*256+buf[sz-1];
if( crc1 == crc2 && 0xff == (uint8_t)buf[1]+(uint8_t)buf[2] )
{
return ch;
}
else
{
return 0xff; //数据包校验为错
}
}
else
{
return 0xff; //错误的指令码
}
}
}
/***********************接收部分*********************/
//包是否为空
uint8_t ymodem_rx_pac_if_empty( char *buf, size_t sz )
{
size_t offset=0;
while( buf[offset]==0x00 && ++offset<sz );
if( offset==sz )
{
return true;
}
else
{
return false;
}
}
//解析出头包中的文件名和大小
uint8_t ymodem_rx_prepare( char *buf, size_t sz )
{
uint8_t ans = YMODEM_OK;
char *fil_nm;
uint8_t fil_nm_len;
size_t fil_sz;
fil_nm = buf;
fil_nm_len = strlen( fil_nm );
fil_sz = (size_t)ymodem_str_to_u32( buf+fil_nm_len+1 );
ans = ymodem_rx_header( fil_nm, fil_sz );
return ans;
}
/*********************************************************************
* @fn ymodem_tx_put : Ymodem接收时,逻辑轮转调用函数
* @param buf : 数据缓冲区 buf : 数据大小
*/
uint8_t ymodem_rx_put( char *buf, size_t rx_sz )
{
if( 0 == rx_sz ) //超时,从而得到的长度为0,则尝试发送“C”,并返回
{
if(YMODEM_RX_IDLE == ym_rx_status)
{
__putchar( 'C' );
}
return YMODEM_NULL;
}
switch( ym_rx_status )
{
case YMODEM_RX_IDLE:
switch( ymodem_rx_pac_check( buf, rx_sz ) ) //检查当前包是否合法,并返回包的类型
{
case SOH:
case STX:
pac_size = (uint8_t)(buf[0])==SOH? PACKET_SIZE:PACKET_1K_SIZE;
if( true == ymodem_rx_pac_if_empty( buf+PACKET_HEADER, pac_size ) ) //判断是否是空包
{
__putchar( ACK );
ym_rx_status = YMODEM_RX_EXIT;
goto exit_rx; //这是在本循环必须完成的操作,所以需要用到 goto 语句
}
else //如果不是空包,则认为是第一个包(包含文件名和文件大小)
{
if( pac_size==128 && YMODEM_OK == ymodem_rx_prepare( buf+PACKET_HEADER, pac_size ) )
{
__putchar( ACK );
seek = 0; //初始化变量,用于接收新文件
__putchar( 'C' );
ym_rx_status = YMODEM_RX_ACK;
}
else
{
ym_rx_status = YMODEM_RX_ERR;
goto err_rx; //在IDLE中接收到一个1024的数据包,则肯定是状态有问题
}
}
break;
case EOT:
ym_rx_status = YMODEM_RX_EXIT;
goto exit_rx; //这是在本循环必须完成的操作,所以需要用到 goto 语句
default:
// __putchar( NAK ); //不正常的状态,调试用
ym_rx_status = YMODEM_RX_ERR;
goto err_rx; //这儿暂时认为,包有误,就退出
}
break;
case YMODEM_RX_ACK: //1级——文件接收状态中
switch( ymodem_rx_pac_check( buf, rx_sz ) ) //检查当前包是否合法,并返回包的类型
{
case SOH:
case STX:
__putchar( ACK );
pac_size = (uint8_t)(buf[0])==SOH? PACKET_SIZE:PACKET_1K_SIZE;
ymodem_rx_pac_get( buf+PACKET_HEADER, seek, pac_size ); //将接收的包保存
seek += pac_size;
break;
//指令包
case EOT:
__putchar( NAK );
ym_rx_status = YMODEM_RX_EOT;
break;
case CAN:
ym_rx_status = YMODEM_RX_ERR;
goto err_rx;
default:
ym_rx_status = YMODEM_RX_ERR;
goto err_rx; //这儿暂时认为,包有误,就重发
}
break;
case YMODEM_RX_EOT: //在这里保存文件
{
switch( ymodem_rx_pac_check( buf, rx_sz ) ) //检查当前包是否合法,并返回包的类型
{
//指令包
case EOT:
__putchar( ACK );
__putchar( 'C' );
ymodem_rx_finish( YMODEM_OK );
ym_rx_status = YMODEM_RX_OVER;
break;
default:
ym_rx_status = YMODEM_RX_ERR;
goto err_rx;
}
}
break;
case YMODEM_RX_OVER: //在这里保存文件
{
if(rx_sz > 133)
{
rx_sz = 133;
}
switch( ymodem_rx_pac_check( buf, rx_sz ) ) //检查当前包是否合法,并返回包的类型
{
case SOH:
__putchar( ACK );
ym_rx_status = YMODEM_RX_IDLE;
return YMODEM_TX_RX_OVER;
default:
ym_rx_status = YMODEM_RX_EXIT;
goto exit_rx;
}
}
err_rx:
case YMODEM_RX_ERR: //在这里放弃保存文件,终止传输
__putchar( CAN );
ymodem_rx_finish( YMODEM_ERR );
exit_rx:
case YMODEM_RX_EXIT: //到这里,就收拾好,然后退出
ym_rx_status = YMODEM_RX_IDLE;
return YMODEM_TX_RX_OVER;
default:
break;
}
return YMODEM_OK;
}
/**************************************发送部分********************************/
//pbuf 是指向缓冲区的最开始的地方, pac_sz 是数据区的大小
uint8_t ymodem_tx_make_pac_data( char *pbuf, size_t pac_sz )
{
uint8_t ans = YMODEM_ERR;
uint16_t crc;
pbuf[0] = pac_sz==128 ? SOH:STX;
pbuf[1] = ym_cyc;
pbuf[2] = ~ym_cyc;
crc = ymodem_crc16( (unsigned char const*)(pbuf + PACKET_HEADER), pac_sz );
pbuf[PACKET_HEADER+pac_sz] = (uint8_t)(crc/256);
pbuf[PACKET_HEADER+pac_sz+1] = (uint8_t)(crc&0x00ff);
ym_cyc++;
ans = YMODEM_OK;
return ans;
}
//制作包头
uint8_t ymodem_tx_make_pac_header( char *pbuf, char *fil_nm, size_t fil_sz )
{
uint8_t ans = YMODEM_ERR;
uint8_t nm_len;
memset( pbuf+PACKET_HEADER, 0, 128);
if( fil_nm )
{
nm_len = strlen( fil_nm );
strcpy( pbuf+PACKET_HEADER, fil_nm );
strcpy( pbuf+PACKET_HEADER+nm_len+1, ymodem_u32_to_str( fil_sz ) );
}
ym_cyc = 0x00;
ymodem_tx_make_pac_data( pbuf, 128 );
return ans;
}
/*********************************************************************
* @fn ymodem_tx_put : Ymodem发送时,逻辑轮转调用函数
* @param buf : 数据缓冲区 buf : 数据大小
* 说明:
* 1.发送 [包 头] 状态:如果没有文件名,则发送空包,否则发送封装的头包
* 2.发送 [数据包] 状态:发送数据包,出现问题或结束,则进入结束状态
* 3.发送 [结 束] 状态:处理发送完成的相关事情
*/
uint8_t ymodem_tx_put( char *buf, size_t rx_sz )
{
char *fil_nm = NULL;
size_t fil_sz = NULL;
if( 0 == rx_sz )
{
return YMODEM_NULL;
}
switch( ym_tx_status )
{
case YMODEM_TX_IDLE:
switch( ymodem_rx_pac_check( buf, rx_sz ) ) //检查当前包是否合法,并返回包的类型
{
case CNC:
{
if( YMODEM_OK == ymodem_tx_header( &fil_nm, &fil_sz ) ) //得到 文件名和大小
{ //封装一个包头,然后发送出去
ym_tx_fil_sz = fil_sz;
ymodem_tx_make_pac_header( ym_pbuf, fil_nm, fil_sz );
__putbuf( ym_pbuf, PACKET_OVERHEAD+PACKET_SIZE );
ym_tx_status = YMODEM_TX_IDLE_ACK;
}
else //封装一个空包,然后发出去
{
ymodem_tx_make_pac_header( ym_pbuf, NULL, NULL );
__putbuf( ym_pbuf, PACKET_OVERHEAD+PACKET_SIZE );
}
}
break;
case CAN:
ym_tx_status = YMODEM_TX_ERR;
goto err_tx;
default:
//这儿暂时认为,包有误,就退出
break;
}
break;
case YMODEM_TX_IDLE_ACK:
{
switch( ymodem_rx_pac_check( buf, rx_sz ) ) //检查当前包是否合法,并返回包的类型
{
case ACK://准备发数据包
ym_tx_status = YMODEM_TX_DATA;
//ACK C连发
if(CNC == ymodem_rx_pac_check( buf+1, rx_sz-1 ))
{
buf[0] = buf[1];
rx_sz-=1;
goto dt_tx;
}
break;
case NAK://准备重发包头
ym_tx_status = YMODEM_TX_IDLE;
break;
case CAN:
ym_tx_status = YMODEM_TX_ERR;
goto err_tx;
default://啥也不做
ym_tx_status = YMODEM_TX_ERR;
goto err_tx;
}
}
break;
dt_tx:
case YMODEM_TX_DATA: //1级——文件发送状态中
switch( ymodem_rx_pac_check( buf, rx_sz ) ) //检查当前包是否合法,并返回包的类型
{
case CNC:
if( YMODEM_OK == ymodem_tx_pac_get( ym_pbuf+PACKET_HEADER, seek, PACKET_1K_SIZE ) ) //读取下一组数据
{
if( YMODEM_OK == ymodem_tx_make_pac_data( ym_pbuf, PACKET_1K_SIZE ) )
{
__putbuf( ym_pbuf, PACKET_OVERHEAD+PACKET_1K_SIZE );
ym_tx_status = YMODEM_TX_DATA_ACK;
}
else //读取数据出错,结束传输
{
ym_tx_status = YMODEM_TX_ERR;
goto err_tx;
}
}
break;
case CAN:
ym_tx_status = YMODEM_TX_ERR;
goto err_tx;
default: //暂时啥也不做
ym_tx_status = YMODEM_TX_ERR;
goto err_tx;
}
break;
case YMODEM_TX_DATA_ACK:
{
switch( ymodem_rx_pac_check( buf, rx_sz ) ) //检查当前包是否合法,并返回包的类型
{
case ACK:
seek += PACKET_1K_SIZE;
if( seek < ym_tx_fil_sz ) //数据未发送完(不能加‘=’!)
{
ym_tx_status = YMODEM_TX_DATA_ACK;
if( YMODEM_OK == ymodem_tx_pac_get( ym_pbuf+PACKET_HEADER, seek, PACKET_1K_SIZE ) ) //读取下一组数据
{
if( YMODEM_OK == ymodem_tx_make_pac_data( ym_pbuf, PACKET_1K_SIZE ) )
{
__putbuf( ym_pbuf, PACKET_OVERHEAD+PACKET_1K_SIZE );
ym_tx_status = YMODEM_TX_DATA_ACK;
}
else //读取数据出错,结束传输
{
ym_tx_status = YMODEM_TX_ERR;
goto err_tx;
}
}
}
else //数据发送完
{
ym_tx_status = YMODEM_TX_EOT;
__putchar( EOT );
}
break;
case CNC: //如果接收方不先应答[ACK]而是直接发'C'在这里处理
seek += PACKET_1K_SIZE;
if( seek < ym_tx_fil_sz ) //数据未发送完(不能加‘=’!)
{
ym_tx_status = YMODEM_TX_DATA_ACK;
//下面的状态,因为我需要马上回复,所以用goto
goto dt_tx; //发送下一个数据包
}
else //数据发送完
{
ym_tx_status = YMODEM_TX_EOT;
__putchar( EOT );
}
break;
case CAN:
ym_tx_status = YMODEM_TX_ERR;
goto err_tx;
default:
ym_tx_status = YMODEM_TX_ERR;
goto err_tx;
}
}
break;
case YMODEM_TX_EOT:
{
switch( ymodem_rx_pac_check( buf, rx_sz ) ) //检查当前包是否合法,并返回包的类型
{
//指令包
case NAK:
__putchar( EOT );
break;
case ACK:
//ACK C连发
if(CNC == ymodem_rx_pac_check( buf+1, rx_sz-1 ))
{
buf[0] = buf[1];
rx_sz-=1;
goto over_tx;
}
ym_tx_status = YMODEM_TX_OVER;
break;
case CAN:
ym_tx_status = YMODEM_TX_ERR;
goto err_tx;
default:
ym_tx_status = YMODEM_TX_ERR;
goto err_tx;
}
}
break;
over_tx:
case YMODEM_TX_OVER:
{
switch( ymodem_rx_pac_check( buf, rx_sz ) ) //检查当前包是否合法,并返回包的类型
{
//指令包
case CNC:
ymodem_tx_make_pac_header( ym_pbuf, NULL, NULL );
__putbuf( ym_pbuf, PACKET_OVERHEAD+PACKET_SIZE );
ymodem_tx_finish( YMODEM_OK );
seek = 0;
ym_tx_status = YMODEM_TX_IDLE;
return YMODEM_TX_RX_OVER;
case CAN:
ym_tx_status = YMODEM_TX_EXIT;
goto err_tx;
default:
ym_tx_status = YMODEM_TX_EXIT;
goto err_tx;
}
}
err_tx:
case YMODEM_TX_ERR: //在这里放弃保存文件,终止传输
__putchar( CAN );
ymodem_rx_finish( YMODEM_ERR );
case YMODEM_TX_EXIT: //到这里,就收拾好,然后退出
ym_tx_status = YMODEM_TX_IDLE;
seek = 0;
return YMODEM_TX_RX_OVER;
default:
break;
}
return YMODEM_OK;
}
| 26.825806 | 110 | 0.461099 |
ebec3e01706c341aab666744956ca1465e229d47 | 3,094 | h | C | bot/src/cpp/config/EntityInfo.h | Bots-United/whichbot | c5db2a6cc3f90930139503b344074376a9cdaabb | [
"BSD-2-Clause"
] | null | null | null | bot/src/cpp/config/EntityInfo.h | Bots-United/whichbot | c5db2a6cc3f90930139503b344074376a9cdaabb | [
"BSD-2-Clause"
] | null | null | null | bot/src/cpp/config/EntityInfo.h | Bots-United/whichbot | c5db2a6cc3f90930139503b344074376a9cdaabb | [
"BSD-2-Clause"
] | 1 | 2020-04-06T02:02:28.000Z | 2020-04-06T02:02:28.000Z | //
// $Id: EntityInfo.h,v 1.2 2005/02/18 00:57:34 clamatius Exp $
// Copyright (c) 2003, WhichBot Project
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
// * 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 WhichBot Project nor the names of its
// contributors may be used to endorse or promote products derived from
// this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
// IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
// THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
// NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#ifndef __CONFIG_ENTITYINFO_H
#define __CONFIG_ENTITYINFO_H
#include "BotTypedefs.h"
typedef enum {
kInvalidEntity = 0,
kPlayer = 1,
kCommandChair = 2,
kTurretFactory = 3,
kTurret = 4,
kArmsLab = 5,
kPrototypeLab =6,
kInfantryPortal = 7,
kObservatory = 8,
kArmory = 9,
kResourceTower = 10,
kHiveLoc = 11,
kResourceLoc = 12,
kOffenseChamber = 13,
kDefenseChamber = 14,
kMovementChamber = 15,
kSensoryChamber = 16,
kAlienResourceTower = 17,
kPhaseGate = 18,
kLandMine = 19,
kTripMine = 20,
kSiegeTurret = 21,
kHive = 22
} eEntityType;
class EntityInfo
{
public:
EntityInfo();
EntityInfo(eEntityType type, int team, const string& classname, int defaultInfluence,
bool isBuilding, int attackValue = 0);
EntityInfo(const EntityInfo& other);
inline int getTeam() const { return _team; }
int getTeam(edict_t* pEdict) const;
inline int getDefaultInfluence() const { return _defaultInfluence; }
inline int getAttackValue() const { return _attackValue; }
inline eEntityType getType() const { return _type; }
inline bool isBuilding() const { return _isBuilding; }
const string& getClassname() const { return _classname; }
protected:
eEntityType _type;
int _team;
string _classname;
int _defaultInfluence;
bool _isBuilding;
int _attackValue;
};
#endif // __CONFIG_ENTITYINFO_H
| 30.038835 | 90 | 0.720103 |
ebece32f123d9726c831b096b145facbf365a545 | 10,974 | h | C | firmware/coreboot/src/mainboard/google/chell/gpio.h | fabiojna02/OpenCellular | 45b6a202d6b2e2485c89955b9a6da920c4d56ddb | [
"CC-BY-4.0",
"BSD-3-Clause"
] | 1 | 2019-11-04T07:11:25.000Z | 2019-11-04T07:11:25.000Z | firmware/coreboot/src/mainboard/google/chell/gpio.h | fabiojna02/OpenCellular | 45b6a202d6b2e2485c89955b9a6da920c4d56ddb | [
"CC-BY-4.0",
"BSD-3-Clause"
] | 13 | 2018-10-12T21:29:09.000Z | 2018-10-25T20:06:51.000Z | firmware/coreboot/src/mainboard/google/chell/gpio.h | fabiojna02/OpenCellular | 45b6a202d6b2e2485c89955b9a6da920c4d56ddb | [
"CC-BY-4.0",
"BSD-3-Clause"
] | null | null | null | /*
* This file is part of the coreboot project.
*
* Copyright (C) 2015 Google Inc.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 2 of the License.
*
* 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.
*/
#ifndef MAINBOARD_GPIO_H
#define MAINBOARD_GPIO_H
#include <soc/gpe.h>
#include <soc/gpio.h>
/* EC in RW */
#define GPIO_EC_IN_RW GPP_C6
/* BIOS Flash Write Protect */
#define GPIO_PCH_WP GPP_C23
/* Memory configuration board straps */
#define GPIO_MEM_CONFIG_0 GPP_C12
#define GPIO_MEM_CONFIG_1 GPP_C13
#define GPIO_MEM_CONFIG_2 GPP_C14
#define GPIO_MEM_CONFIG_3 GPP_C15
/* EC wake is LAN_WAKE# which is a special DeepSX wake pin */
#define GPE_EC_WAKE GPE0_LAN_WAK
/* GPP_B16 is WLAN_WAKE. GPP_B group is routed to DW0 in the GPE0 block */
#define GPE_WLAN_WAKE GPE0_DW0_16
/* GPP_B5 is TOUCHPAD WAKE. GPP_B group is routed to DW0 in the GPE0 block */
#define GPE_TOUCHPAD_WAKE GPE0_DW0_05
/* Input device interrupt configuration */
#define TOUCHPAD_INT_L GPP_B3_IRQ
#define TOUCHSCREEN_INT_L GPP_E7_IRQ
#define MIC_INT_L GPP_F10_IRQ
/* GPP_E16 is EC_SCI_L. GPP_E group is routed to DW2 in the GPE0 block */
#define EC_SCI_GPI GPE0_DW2_16
#define EC_SMI_GPI GPP_E15
/* Power rail control signals. */
#define EN_PP3300_KEPLER GPP_C11
#define EN_PP3300_DX_TOUCH GPP_C22
#define EN_PP3300_DX_EMMC GPP_D5
#define EN_PP1800_DX_EMMC GPP_D6
#define EN_PP3300_DX_CAM GPP_D12
#ifndef __ACPI__
/* Pad configuration in ramstage. */
static const struct pad_config gpio_table[] = {
/* RCIN# */ PAD_CFG_NF(GPP_A0, NONE, DEEP, NF1),
/* LAD0 */ PAD_CFG_NF(GPP_A1, 20K_PU, DEEP, NF1),
/* LAD1 */ PAD_CFG_NF(GPP_A2, 20K_PU, DEEP, NF1),
/* LAD2 */ PAD_CFG_NF(GPP_A3, 20K_PU, DEEP, NF1),
/* LAD3 */ PAD_CFG_NF(GPP_A4, 20K_PU, DEEP, NF1),
/* LFRAME# */ PAD_CFG_NF(GPP_A5, NONE, DEEP, NF1),
/* SERIRQ */ PAD_CFG_NF(GPP_A6, NONE, DEEP, NF1),
/* PIRQA# */ PAD_CFG_NC(GPP_A7),
/* CLKRUN# */ PAD_CFG_NF(GPP_A8, NONE, DEEP, NF1),
/* CLKOUT_LPC0 */ PAD_CFG_NF(GPP_A9, NONE, DEEP, NF1),
/* CLKOUT_LPC1 */ PAD_CFG_NC(GPP_A10),
/* PME# */ PAD_CFG_GPO(GPP_A11, 0, DEEP),
/* BM_BUSY# */ PAD_CFG_NC(GPP_A12),
/* SUSWARN# */ PAD_CFG_NF(GPP_A13, NONE, DEEP, NF1),
/* SUS_STAT# */ PAD_CFG_GPO(GPP_A14, 0, DEEP),
/* SUSACK# */ PAD_CFG_NF(GPP_A15, NONE, DEEP, NF1),
/* SD_1P8_SEL */ PAD_CFG_NC(GPP_A16),
/* SD_PWR_EN# */ PAD_CFG_NC(GPP_A17),
/* ISH_GP0 */ PAD_CFG_NC(GPP_A18),
/* ISH_GP1 */ PAD_CFG_NC(GPP_A19),
/* ISH_GP2 */ PAD_CFG_NC(GPP_A20),
/* ISH_GP3 */ PAD_CFG_NC(GPP_A21),
/* ISH_GP4 */ PAD_CFG_NC(GPP_A22),
/* ISH_GP5 */ PAD_CFG_NC(GPP_A23),
/* CORE_VID0 */ PAD_CFG_GPO(GPP_B0, 0, DEEP),
/* CORE_VID1 */ PAD_CFG_GPO(GPP_B1, 0, DEEP),
/* VRALERT# */ PAD_CFG_NC(GPP_B2),
/* CPU_GP2 */ PAD_CFG_GPI_APIC(GPP_B3, NONE, PLTRST), /* TRACKPAD_INT_L */
/* CPU_GP3 */ PAD_CFG_GPO(GPP_B4, 1, DEEP), /* TOUCHSCREEN_EN */
/* SRCCLKREQ0# */ PAD_CFG_GPI_ACPI_SCI(GPP_B5, NONE, DEEP, YES), /* TRACKPAD WAKE */
/* SRCCLKREQ1# */ PAD_CFG_NF(GPP_B6, NONE, DEEP, NF1), /* WLAN CKLREQ */
/* SRCCLKREQ2# */ PAD_CFG_NF(GPP_B7, NONE, DEEP, NF1), /* KEPLER CLKREQ */
/* SRCCLKREQ3# */ PAD_CFG_NC(GPP_B8),
/* SRCCLKREQ4# */ PAD_CFG_NC(GPP_B9),
/* SRCCLKREQ5# */ PAD_CFG_NC(GPP_B10),
/* EXT_PWR_GATE# */ PAD_CFG_NC(GPP_B11),
/* SLP_S0# */ PAD_CFG_NF(GPP_B12, NONE, DEEP, NF1),
/* PLTRST# */ PAD_CFG_NF(GPP_B13, NONE, DEEP, NF1),
/* SPKR */ PAD_CFG_GPO(GPP_B14, 0, DEEP),
/* GSPI0_CS# */ PAD_CFG_NC(GPP_B15),
/* GSPI0_CLK */ PAD_CFG_GPI_ACPI_SCI(GPP_B16, NONE, DEEP, YES), /* WLAN WAKE */
/* GSPI0_MISO */ PAD_CFG_NC(GPP_B17),
/* GSPI0_MOSI */ PAD_CFG_GPO(GPP_B18, 0, DEEP),
/* GSPI1_CS# */ PAD_CFG_NC(GPP_B19),
/* GSPI1_CLK */ PAD_CFG_NC(GPP_B20),
/* GSPI1_MISO */ PAD_CFG_NC(GPP_B21),
/* GSPI1_MOSI */ PAD_CFG_GPO(GPP_B22, 0, DEEP),
/* SM1ALERT# */ PAD_CFG_GPI_GPIO_DRIVER(GPP_B23, NONE, DEEP), /* UNUSED */
/* SMBCLK */ PAD_CFG_NF(GPP_C0, NONE, DEEP, NF1), /* XDP */
/* SMBDATA */ PAD_CFG_NF(GPP_C1, NONE, DEEP, NF1), /* XDP */
/* SMBALERT# */ PAD_CFG_GPO(GPP_C2, 0, DEEP),
/* SML0CLK */ PAD_CFG_GPI_GPIO_DRIVER(GPP_C3, NONE, DEEP), /* UNUSED */
/* SML0DATA */ PAD_CFG_GPI_GPIO_DRIVER(GPP_C4, NONE, DEEP), /* UNUSED */
/* SML0ALERT# */ PAD_CFG_GPI_GPIO_DRIVER(GPP_C5, NONE, DEEP), /* UNUSED */
/* SM1CLK */ PAD_CFG_GPI_GPIO_DRIVER(GPP_C6, 20K_PU, DEEP), /* EC_IN_RW */
/* SM1DATA */ PAD_CFG_GPI_GPIO_DRIVER(GPP_C7, NONE, DEEP), /* UNUSED */
/* UART0_RXD */ PAD_CFG_NC(GPP_C8),
/* UART0_TXD */ PAD_CFG_NC(GPP_C9),
/* UART0_RTS# */ PAD_CFG_NC(GPP_C10),
/* UART0_CTS# */ PAD_CFG_GPO(GPP_C11, 0, DEEP), /* EN_PP3300_KEPLER */
/* UART1_RXD */ PAD_CFG_GPI_GPIO_DRIVER(GPP_C12, NONE, DEEP), /* MEM_CONFIG[0] */
/* UART1_TXD */ PAD_CFG_GPI_GPIO_DRIVER(GPP_C13, NONE, DEEP), /* MEM_CONFIG[1] */
/* UART1_RTS# */ PAD_CFG_GPI_GPIO_DRIVER(GPP_C14, NONE, DEEP), /* MEM_CONFIG[2] */
/* UART1_CTS# */ PAD_CFG_GPI_GPIO_DRIVER(GPP_C15, NONE, DEEP), /* MEM_CONFIG[3] */
/* I2C0_SDA */ PAD_CFG_NF(GPP_C16, NONE, DEEP, NF1), /* TOUCHSCREEN */
/* I2C0_SCL */ PAD_CFG_NF(GPP_C17, NONE, DEEP, NF1), /* TOUCHSCREEN */
/* I2C1_SDA */ PAD_CFG_NF(GPP_C18, NONE, DEEP, NF1), /* TRACKPAD */
/* I2C1_SCL */ PAD_CFG_NF(GPP_C19, NONE, DEEP, NF1), /* TRACKPAD */
/* UART2_RXD */ PAD_CFG_NF(GPP_C20, NONE, DEEP, NF1), /* SERVO */
/* UART2_TXD */ PAD_CFG_NF(GPP_C21, NONE, DEEP, NF1), /* SERVO */
/* UART2_RTS# */ PAD_CFG_GPO(GPP_C22, 1, DEEP), /* EN_PP3300_DX_TOUCH */
/* UART2_CTS# */ PAD_CFG_GPI_GPIO_DRIVER(GPP_C23, 20K_PU, DEEP), /* PCH_WP */
/* SPI1_CS# */ PAD_CFG_GPO(GPP_D0, 0, DEEP),
/* SPI1_CLK */ PAD_CFG_GPO(GPP_D1, 0, DEEP),
/* SPI1_MISO */ PAD_CFG_GPO(GPP_D2, 0, DEEP),
/* SPI1_MOSI */ PAD_CFG_GPO(GPP_D3, 0, DEEP),
/* FASHTRIG */ PAD_CFG_NC(GPP_D4),
/* ISH_I2C0_SDA */ PAD_CFG_GPO(GPP_D5, 1, DEEP), /* EN_PP3300_DX_EMMC */
/* ISH_I2C0_SCL */ PAD_CFG_GPO(GPP_D6, 1, DEEP), /* EN_PP1800_DX_EMMC */
/* ISH_I2C1_SDA */ PAD_CFG_NC(GPP_D7),
/* ISH_I2C1_SCL */ PAD_CFG_NC(GPP_D8),
/* ISH_SPI_CS# */ PAD_CFG_NC(GPP_D9),
/* ISH_SPI_CLK */ PAD_CFG_GPO(GPP_D10, 0, DEEP), /* USBA_1_ILIM_SEL_L */
/* ISH_SPI_MISO */ PAD_CFG_NC(GPP_D11),
/* ISH_SPI_MOSI */ PAD_CFG_GPO(GPP_D12, 1, DEEP), /* EN_PP3300_DX_CAM */
/* ISH_UART0_RXD */ PAD_CFG_NC(GPP_D13),
/* ISH_UART0_TXD */ PAD_CFG_NC(GPP_D14),
/* ISH_UART0_RTS# */ PAD_CFG_NC(GPP_D15),
/* ISH_UART0_CTS# */ PAD_CFG_NC(GPP_D16),
/* DMIC_CLK1 */ PAD_CFG_NC(GPP_D17),
/* DMIC_DATA1 */ PAD_CFG_NC(GPP_D18),
/* DMIC_CLK0 */ PAD_CFG_NF(GPP_D19, NONE, DEEP, NF1),
/* DMIC_DATA0 */ PAD_CFG_NF(GPP_D20, NONE, DEEP, NF1),
/* SPI1_IO2 */ PAD_CFG_GPO(GPP_D21, 0, DEEP),
/* SPI1_IO3 */ PAD_CFG_GPO(GPP_D22, 0, DEEP), /* I2S2 BUFFER */
/* I2S_MCLK */ PAD_CFG_NF(GPP_D23, NONE, DEEP, NF1),
/* SATAXPCI0 */ PAD_CFG_GPI_APIC(GPP_E0, NONE, PLTRST), /* TPM_PIRQ_L */
/* SATAXPCIE1 */ PAD_CFG_NC(GPP_E1),
/* SATAXPCIE2 */ PAD_CFG_NC(GPP_E2),
/* CPU_GP0 */ PAD_CFG_GPO(GPP_E3, 1, DEEP), /* TOUCHSCREEN_RST_L */
/* SATA_DEVSLP0 */ PAD_CFG_NC(GPP_E4),
/* SATA_DEVSLP1 */ PAD_CFG_NC(GPP_E5),
/* SATA_DEVSLP2 */ PAD_CFG_NC(GPP_E6),
/* CPU_GP1 */ PAD_CFG_GPI_APIC(GPP_E7, NONE, PLTRST), /* TOUCHSCREEN_INT_L */
/* SATALED# */ PAD_CFG_NC(GPP_E8),
/* USB2_OCO# */ PAD_CFG_NF(GPP_E9, NONE, DEEP, NF1), /* USBA_OC0_L */
/* USB2_OC1# */ PAD_CFG_NC(GPP_E10),
/* USB2_OC2# */ PAD_CFG_NF(GPP_E11, NONE, DEEP, NF1), /* USBC_OC2_L */
/* USB2_OC3# */ PAD_CFG_NF(GPP_E12, NONE, DEEP, NF1), /* USBC_OC3_L */
/* DDPB_HPD0 */ PAD_CFG_NF(GPP_E13, NONE, DEEP, NF1), /* USB_C0_DP_HPD */
/* DDPC_HPD1 */ PAD_CFG_NF(GPP_E14, NONE, DEEP, NF1), /* USB_C1_DP_HPD */
/* DDPD_HPD2 */ PAD_CFG_GPI_ACPI_SMI(GPP_E15, NONE, DEEP, YES), /* EC_SMI_L */
/* DDPE_HPD3 */ PAD_CFG_GPI_ACPI_SCI(GPP_E16, NONE, DEEP, YES), /* EC_SCI_L */
/* EDP_HPD */ PAD_CFG_NF(GPP_E17, NONE, DEEP, NF1),
/* DDPB_CTRLCLK */ PAD_CFG_GPO(GPP_E18, 0, DEEP),
/* DDPB_CTRLDATA */ PAD_CFG_NC(GPP_E19), /* External pullup */
/* DDPC_CTRLCLK */ PAD_CFG_NC(GPP_E20),
/* DDPC_CTRLDATA */ PAD_CFG_NC(GPP_E21), /* External pullup. */
/* DDPD_CTRLCLK */ PAD_CFG_NC(GPP_E22),
/* DDPD_CTRLDATA */ PAD_CFG_NC(GPP_E23),
/*
* The next 4 pads are for bit banging the amplifiers. They are connected
* together with i2s0 signals. For default behavior of i2s make these
* gpio inputs.
*/
/* I2S2_SCLK */ PAD_CFG_GPI_GPIO_DRIVER(GPP_F0, NONE, DEEP),
/* I2S2_SFRM */ PAD_CFG_GPI_GPIO_DRIVER(GPP_F1, NONE, DEEP),
/* I2S2_TXD */ PAD_CFG_GPI_GPIO_DRIVER(GPP_F2, NONE, DEEP),
/* I2S2_RXD */ PAD_CFG_GPI_GPIO_DRIVER(GPP_F3, NONE, DEEP),
/* I2C2_SDA */ PAD_CFG_NC(GPP_F4),
/* I2C2_SCL */ PAD_CFG_NC(GPP_F5),
/* I2C3_SDA */ PAD_CFG_NC(GPP_F6),
/* I2C3_SCL */ PAD_CFG_NC(GPP_F7),
/* I2C4_SDA */ PAD_CFG_NF_1V8(GPP_F8, NONE, DEEP, NF1), /* AUDIO1V8_SDA */
/* I2C4_SCL */ PAD_CFG_NF_1V8(GPP_F9, NONE, DEEP, NF1), /* AUDIO1V8_SCL */
/* I2C5_SDA */ PAD_CFG_GPI_APIC(GPP_F10, NONE, PLTRST), /* MIC_INT_L */
/* I2C5_SCL */ PAD_CFG_GPO(GPP_F11, 0, DEEP),
/* EMMC_CMD */ PAD_CFG_NF(GPP_F12, NONE, DEEP, NF1),
/* EMMC_DATA0 */ PAD_CFG_NF(GPP_F13, NONE, DEEP, NF1),
/* EMMC_DATA1 */ PAD_CFG_NF(GPP_F14, NONE, DEEP, NF1),
/* EMMC_DATA2 */ PAD_CFG_NF(GPP_F15, NONE, DEEP, NF1),
/* EMMC_DATA3 */ PAD_CFG_NF(GPP_F16, NONE, DEEP, NF1),
/* EMMC_DATA4 */ PAD_CFG_NF(GPP_F17, NONE, DEEP, NF1),
/* EMMC_DATA5 */ PAD_CFG_NF(GPP_F18, NONE, DEEP, NF1),
/* EMMC_DATA6 */ PAD_CFG_NF(GPP_F19, NONE, DEEP, NF1),
/* EMMC_DATA7 */ PAD_CFG_NF(GPP_F20, NONE, DEEP, NF1),
/* EMMC_RCLK */ PAD_CFG_NF(GPP_F21, NONE, DEEP, NF1),
/* EMMC_CLK */ PAD_CFG_NF(GPP_F22, NONE, DEEP, NF1),
/* RSVD */ PAD_CFG_NC(GPP_F23),
/* SD_CMD */ PAD_CFG_NC(GPP_G0),
/* SD_DATA0 */ PAD_CFG_NC(GPP_G1),
/* SD_DATA1 */ PAD_CFG_NC(GPP_G2),
/* SD_DATA2 */ PAD_CFG_NC(GPP_G3),
/* SD_DATA3 */ PAD_CFG_NC(GPP_G4),
/* SD_CD# */ PAD_CFG_NC(GPP_G5),
/* SD_CLK */ PAD_CFG_NC(GPP_G6),
/* SD_WP */ PAD_CFG_NC(GPP_G7),
/* BATLOW# */ PAD_CFG_NF(GPD0, NONE, DEEP, NF1),
/* ACPRESENT */ PAD_CFG_NF(GPD1, NONE, DEEP, NF1),
/* LAN_WAKE# */ PAD_CFG_NF(GPD2, NONE, DEEP, NF1), /* EC_PCH_WAKE_L */
/* PWRBTN# */ PAD_CFG_NF(GPD3, NONE, DEEP, NF1),
/* SLP_S3# */ PAD_CFG_NF(GPD4, NONE, DEEP, NF1),
/* SLP_S4# */ PAD_CFG_NF(GPD5, NONE, DEEP, NF1),
/* SLP_A# */ PAD_CFG_GPO(GPD6, 0, DEEP),
/* RSVD */ PAD_CFG_NC(GPD7),
/* SUSCLK */ PAD_CFG_NF(GPD8, NONE, DEEP, NF1),
/* SLP_WLAN# */ PAD_CFG_GPO(GPD9, 0, DEEP),
/* SLP_S5# */ PAD_CFG_GPO(GPD10, 0, DEEP),
/* LANPHYC */ PAD_CFG_NC(GPD11),
};
/* Early pad configuration in romstage. */
static const struct pad_config early_gpio_table[] = {
/* SRCCLKREQ2# */ PAD_CFG_NF(GPP_B7, NONE, DEEP, NF1), /* KEPLER */
/* UART0_CTS# */ PAD_CFG_GPO(GPP_C11, 0, DEEP), /* EN_PP3300_KEPLER */
/* UART2_CTS# */ PAD_CFG_GPI_GPIO_DRIVER(GPP_C23, 20K_PU, DEEP), /* PCH_WP */
};
#endif
#endif
| 45.160494 | 84 | 0.690724 |
ebed9d7893cf1ef0bc7f8a75f54bd9ac469a658e | 284 | h | C | Game/Source/TestSuite/TestSuiteGameInstance.h | improbable/UnrealGDKTestSuite | b2c3dc256f303600e2a91a4891a98b65fdd3e8e5 | [
"MIT"
] | 4 | 2018-07-31T16:12:15.000Z | 2020-04-16T05:50:06.000Z | Game/Source/TestSuite/TestSuiteGameInstance.h | improbable/UnrealGDKTestSuite | b2c3dc256f303600e2a91a4891a98b65fdd3e8e5 | [
"MIT"
] | 7 | 2018-08-01T21:47:08.000Z | 2019-04-17T15:51:55.000Z | Game/Source/TestSuite/TestSuiteGameInstance.h | improbable/UnrealGDKTestSuite | b2c3dc256f303600e2a91a4891a98b65fdd3e8e5 | [
"MIT"
] | 2 | 2020-08-30T13:59:41.000Z | 2021-08-06T08:54:49.000Z | // Copyright (c) Improbable Worlds Ltd, All Rights Reserved
#pragma once
#include "CoreMinimal.h"
#include "SpatialGameInstance.h"
#include "TestSuiteGameInstance.generated.h"
UCLASS()
class TESTSUITE_API UTestSuiteGameInstance : public USpatialGameInstance
{
GENERATED_BODY()
};
| 20.285714 | 72 | 0.795775 |
ebeda9f0e34fbdb9f92ee42bc27ba89f6ff3e9d5 | 3,942 | c | C | src/set.c | NekoMale/DataStructures | dfb9a64eedfb0443461736f15b59a81d25d91382 | [
"MIT"
] | null | null | null | src/set.c | NekoMale/DataStructures | dfb9a64eedfb0443461736f15b59a81d25d91382 | [
"MIT"
] | 1 | 2022-01-07T11:24:02.000Z | 2022-01-09T21:04:09.000Z | src/set.c | NekoMale/DataStructures | dfb9a64eedfb0443461736f15b59a81d25d91382 | [
"MIT"
] | null | null | null | #include <stddef.h> // required for NULL
#include <stdlib.h>
#include "..\inc\set.h"
#include "..\inc\linked_list.h"
size_t djb33x_hash(const void* key, const size_t key_length)
{
size_t hash = 5381;
const char* c_key = key;
for (size_t i = 0; i < key_length; i++)
{
hash = ((hash << 5) + hash) ^ c_key[i];
}
return hash;
}
ng_set __ng_set_new(int(*compare_function)(const void* v1, const void* v2)) {
return __ng_set_new_hashed(10, djb33x_hash, compare_function);
}
ng_set __ng_set_new_hashed(const size_t hashmap_size, size_t(*hash_function)(const void* key, size_t key_length), int(*compare_function)(const void* v1, const void* v2))
{
ng_set set = (ng_set)malloc(sizeof(ng_t_set));
if (!set)
{
return NULL;
}
set->hashmap_size = hashmap_size;
set->hash_function = hash_function;
set->nodes = (ng_list*)malloc(sizeof(ng_t_list) * hashmap_size);
if (!set->nodes)
{
free(set);
return NULL;
}
for (int i = 0; i < hashmap_size; ++i)
{
set->nodes[i] = ng_list_new(ng_key_set, compare_function);
if (!set->nodes) {
free(set->nodes);
set->nodes = NULL;
free(set);
return NULL;
}
}
return set;
}
int __ng_set_add(ng_set set, const void* value, const size_t key_length)
{
size_t hash = set->hash_function(value, key_length);
size_t index = hash % set->hashmap_size;
ng_node_list new_element = (ng_node_list)malloc(sizeof(ng_t_node_list));
if (!new_element)
{
return -1;
}
ng_key_set set_element = (ng_key_set)malloc(sizeof(ng_t_key_set));
if (!set_element)
{
return -1;
}
set_element->key_length = key_length;
set_element->key = value;
new_element->data = set_element;
new_element->next = NULL;
size_t node_length = 1;
ng_node_list head = *set->nodes[index]->nodes;
if (!head)
{
*(set->nodes[index]->nodes) = new_element;
}
else
{
ng_node_list tail;
do
{
if ((*set->nodes)->compare_function(((ng_key_set)(head->data))->key, value) == 0)
{
free(new_element);
return -1;
}
tail = head;
head = head->next;
++node_length;
} while (head);
tail->next = new_element;
}
if (node_length > (size_t)(set->hashmap_size * 0.5f))
{
size_t increase_size = set->hashmap_size;
if (increase_size < 4) increase_size = 4;
__ng_set_increase_hashmap_size(set, increase_size);
}
return 0;
}
int __ng_set_exists(ng_set set, void* value, const size_t key_length)
{
size_t hash = set->hash_function(value, key_length);
size_t index = hash % set->hashmap_size;
ng_node_list head = *set->nodes[index]->nodes;
while (head)
{
if ((*set->nodes)->compare_function(((ng_key_set)(head->data))->key, value) == 0)
{
return 0;
}
head = head->next;
}
return -1;
}
int __ng_set_remove(ng_set set, void* value, const size_t key_length)
{
size_t hash = set->hash_function(value, key_length);
size_t index = hash % set->hashmap_size;
ng_node_list lastNode;
ng_node_list node = *set->nodes[index]->nodes;
while (node)
{
if ((*set->nodes)->compare_function(((ng_key_set)(node->data))->key, value) == 0)
{
if (lastNode)
{
lastNode->next = node->next;
}
else {
*set->nodes[index]->nodes = node->next;
}
node->data = NULL;
return 0;
}
lastNode = node;
node = node->next;
}
return -1;
}
int __ng_set_increase_hashmap_size(ng_set set, const size_t size_increase_amount)
{
if (size_increase_amount > 0)
{
ng_set larger_set = __ng_set_new_hashed(set->hashmap_size + size_increase_amount, set->hash_function, (*set->nodes)->compare_function);
if (!larger_set)
{
return -1;
}
const size_t current_set_size = set->hashmap_size;
for (size_t i = 0; i < current_set_size; ++i)
{
ng_node_list current_node = *(set->nodes[i]->nodes);
while (current_node)
{
ng_key_set node_value = (ng_key_set)(current_node->data);
__ng_set_add(larger_set, node_value->key, node_value->key_length);
current_node = current_node->next;
}
}
*set = *larger_set;
}
return 0;
}
| 22.786127 | 170 | 0.672755 |
ebefa1e4750b888ed3941302ef529c3e08df6bda | 2,990 | c | C | vga-test4/multiplane.c | boochow/pico_test_projects | 5424d9b919b471bdbbd042cfc434722acbd218b1 | [
"MIT"
] | 40 | 2021-02-23T21:23:35.000Z | 2022-03-19T04:18:10.000Z | vga-test4/multiplane.c | boochow/pico_test_projects | 5424d9b919b471bdbbd042cfc434722acbd218b1 | [
"MIT"
] | 1 | 2021-08-12T08:18:32.000Z | 2021-08-19T14:35:05.000Z | vga-test4/multiplane.c | boochow/pico_test_projects | 5424d9b919b471bdbbd042cfc434722acbd218b1 | [
"MIT"
] | 3 | 2021-08-17T01:43:04.000Z | 2021-12-29T01:16:09.000Z | #include <stdio.h>
#include <stdlib.h>
#include "pico/stdlib.h"
#include "pico.h"
#include "pico/scanvideo.h"
#include "pico/scanvideo/composable_scanline.h"
#define VGA_MODE vga_mode_640x480_60
#define MIN_RUN 3
// background animation
static int graylevel = 0;
// moving box
static int box_x = 4;
static int delta_x = 5;
static int box_y = 0;
static int delta_y = 5;
static int box_color = 0;
#define BOX_SIZE 40
#define W_MINUS_BOX (VGA_MODE.width - BOX_SIZE)
#define IS_BETWEEN(x,a,b) ((a <= x) && (x <= b))
void box_step() {
box_x += delta_x;
if (!IS_BETWEEN(box_x, 0, VGA_MODE.width - BOX_SIZE)) {
delta_x = -delta_x;
box_x += delta_x;
}
box_y += delta_y;
if (!IS_BETWEEN(box_y, 0, VGA_MODE.height - BOX_SIZE)) {
delta_y = -delta_y;
box_y += delta_y;
}
}
int32_t single_color_line(uint32_t *buf, size_t buf_length, uint16_t color) {
assert(buf_length >= 3);
buf[0] = COMPOSABLE_COLOR_RUN | (color << 16);
buf[1] = VGA_MODE.width - MIN_RUN | (COMPOSABLE_RAW_1P << 16);
buf[2] = 0 | (COMPOSABLE_EOL_ALIGN << 16);
return 3;
}
int32_t box(uint32_t *buf, size_t buf_length, uint16_t line_num, uint16_t color) {
assert(buf_length >= 5);
if (!IS_BETWEEN(line_num, box_y, box_y + BOX_SIZE)) {
return single_color_line(buf, buf_length, 0);
} else {
buf[0] = COMPOSABLE_COLOR_RUN | 0;
buf[1] = box_x - MIN_RUN | (COMPOSABLE_COLOR_RUN << 16);
buf[2] = color | (BOX_SIZE - MIN_RUN)<< 16;
buf[3] = COMPOSABLE_RAW_1P | 0;
buf[4] = COMPOSABLE_EOL_SKIP_ALIGN;
return 5;
}
}
void render_scanline(struct scanvideo_scanline_buffer *dest) {
uint32_t *buf = dest->data;
size_t buf_length = dest->data_max;
int l = scanvideo_scanline_number(dest->scanline_id);
uint16_t c = (graylevel + (l > 240 ? 480 - l : l)) / 3;
c = PICO_SCANVIDEO_PIXEL_FROM_RGB8(c, c, c);
dest->data_used = single_color_line(buf, buf_length, c);
buf = dest->data2;
buf_length = dest->data2_max;
dest->data2_used = box(buf, buf_length, l, box_color);
dest->status = SCANLINE_OK;
}
// update the scene
void frame_update_logic(int num) {
num = num % 960;
graylevel = num > 480 ? 960 - num : num;
box_step();
box_color = (rand() & 0xffff) | PICO_SCANVIDEO_ALPHA_MASK;
}
// main loop
void render_loop() {
static uint32_t last_frame_num = 0;
while (true) {
struct scanvideo_scanline_buffer *scanline_buffer = scanvideo_begin_scanline_generation(true);
uint32_t frame_num = scanvideo_frame_number(scanline_buffer->scanline_id);
if (frame_num != last_frame_num) {
last_frame_num = frame_num;
frame_update_logic(frame_num);
}
render_scanline(scanline_buffer);
scanvideo_end_scanline_generation(scanline_buffer);
}
}
int main(void) {
stdio_init_all();
scanvideo_setup(&VGA_MODE);
scanvideo_timing_enable(true);
render_loop();
return 0;
}
| 26.936937 | 102 | 0.658194 |
ebf018364cd3b158566e0c92de9ab4ebb2d67291 | 12,414 | c | C | netbsdsrc/sbin/fsck_ffs/utilities.c | tharindusathis/sourcecodes-of-CodeReadingTheOpenSourcePerspective | 1b0172cdb78757fd17898503aaf6ce03d940ef28 | [
"Apache-1.1"
] | 46 | 2015-12-04T17:12:58.000Z | 2022-03-11T04:30:49.000Z | netbsdsrc/sbin/fsck_ffs/utilities.c | tharindusathis/sourcecodes-of-CodeReadingTheOpenSourcePerspective | 1b0172cdb78757fd17898503aaf6ce03d940ef28 | [
"Apache-1.1"
] | null | null | null | netbsdsrc/sbin/fsck_ffs/utilities.c | tharindusathis/sourcecodes-of-CodeReadingTheOpenSourcePerspective | 1b0172cdb78757fd17898503aaf6ce03d940ef28 | [
"Apache-1.1"
] | 23 | 2016-10-24T09:18:14.000Z | 2022-02-25T02:11:35.000Z | /* $NetBSD: utilities.c,v 1.22 1997/09/24 09:24:24 lukem Exp $ */
/*
* Copyright (c) 1980, 1986, 1993
* The Regents of the University of California. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
#include <sys/cdefs.h>
#ifndef lint
#if 0
static char sccsid[] = "@(#)utilities.c 8.6 (Berkeley) 5/19/95";
#else
__RCSID("$NetBSD: utilities.c,v 1.22 1997/09/24 09:24:24 lukem Exp $");
#endif
#endif /* not lint */
#include <sys/param.h>
#include <sys/time.h>
#include <ufs/ufs/dinode.h>
#include <ufs/ufs/dir.h>
#include <ufs/ffs/fs.h>
#include <ctype.h>
#include <err.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include "fsutil.h"
#include "fsck.h"
#include "extern.h"
long diskreads, totalreads; /* Disk cache statistics */
static void rwerror __P((char *, ufs_daddr_t));
int
ftypeok(dp)
struct dinode *dp;
{
switch (dp->di_mode & IFMT) {
case IFDIR:
case IFREG:
case IFBLK:
case IFCHR:
case IFLNK:
case IFSOCK:
case IFIFO:
return (1);
default:
if (debug)
printf("bad file type 0%o\n", dp->di_mode);
return (0);
}
}
int
reply(question)
char *question;
{
int persevere;
char c;
if (preen)
pfatal("INTERNAL ERROR: GOT TO reply()");
persevere = !strcmp(question, "CONTINUE");
printf("\n");
if (!persevere && (nflag || fswritefd < 0)) {
printf("%s? no\n\n", question);
return (0);
}
if (yflag || (persevere && nflag)) {
printf("%s? yes\n\n", question);
return (1);
}
do {
printf("%s? [yn] ", question);
(void) fflush(stdout);
c = getc(stdin);
while (c != '\n' && getc(stdin) != '\n')
if (feof(stdin))
return (0);
} while (c != 'y' && c != 'Y' && c != 'n' && c != 'N');
printf("\n");
if (c == 'y' || c == 'Y')
return (1);
return (0);
}
/*
* Malloc buffers and set up cache.
*/
void
bufinit()
{
struct bufarea *bp;
long bufcnt, i;
char *bufp;
pbp = pdirbp = (struct bufarea *)0;
bufp = malloc((unsigned int)sblock.fs_bsize);
if (bufp == 0)
errx(EEXIT, "cannot allocate buffer pool");
cgblk.b_un.b_buf = bufp;
initbarea(&cgblk);
bufhead.b_next = bufhead.b_prev = &bufhead;
bufcnt = MAXBUFSPACE / sblock.fs_bsize;
if (bufcnt < MINBUFS)
bufcnt = MINBUFS;
for (i = 0; i < bufcnt; i++) {
bp = (struct bufarea *)malloc(sizeof(struct bufarea));
bufp = malloc((unsigned int)sblock.fs_bsize);
if (bp == NULL || bufp == NULL) {
if (i >= MINBUFS)
break;
errx(EEXIT, "cannot allocate buffer pool");
}
bp->b_un.b_buf = bufp;
bp->b_prev = &bufhead;
bp->b_next = bufhead.b_next;
bufhead.b_next->b_prev = bp;
bufhead.b_next = bp;
initbarea(bp);
}
bufhead.b_size = i; /* save number of buffers */
}
/*
* Manage a cache of directory blocks.
*/
struct bufarea *
getdatablk(blkno, size)
ufs_daddr_t blkno;
long size;
{
struct bufarea *bp;
for (bp = bufhead.b_next; bp != &bufhead; bp = bp->b_next)
if (bp->b_bno == fsbtodb(&sblock, blkno))
goto foundit;
for (bp = bufhead.b_prev; bp != &bufhead; bp = bp->b_prev)
if ((bp->b_flags & B_INUSE) == 0)
break;
if (bp == &bufhead)
errx(EEXIT, "deadlocked buffer pool");
getblk(bp, blkno, size);
/* fall through */
foundit:
totalreads++;
bp->b_prev->b_next = bp->b_next;
bp->b_next->b_prev = bp->b_prev;
bp->b_prev = &bufhead;
bp->b_next = bufhead.b_next;
bufhead.b_next->b_prev = bp;
bufhead.b_next = bp;
bp->b_flags |= B_INUSE;
return (bp);
}
void
getblk(bp, blk, size)
struct bufarea *bp;
ufs_daddr_t blk;
long size;
{
ufs_daddr_t dblk;
dblk = fsbtodb(&sblock, blk);
if (bp->b_bno != dblk) {
flush(fswritefd, bp);
diskreads++;
bp->b_errs = bread(fsreadfd, bp->b_un.b_buf, dblk, size);
bp->b_bno = dblk;
bp->b_size = size;
}
}
void
flush(fd, bp)
int fd;
struct bufarea *bp;
{
int i, j;
if (!bp->b_dirty)
return;
if (bp->b_errs != 0)
pfatal("WRITING %sZERO'ED BLOCK %d TO DISK\n",
(bp->b_errs == bp->b_size / dev_bsize) ? "" : "PARTIALLY ",
bp->b_bno);
bp->b_dirty = 0;
bp->b_errs = 0;
bwrite(fd, bp->b_un.b_buf, bp->b_bno, (long)bp->b_size);
if (bp != &sblk)
return;
for (i = 0, j = 0; i < sblock.fs_cssize; i += sblock.fs_bsize, j++) {
bwrite(fswritefd, (char *)sblock.fs_csp[j],
fsbtodb(&sblock, sblock.fs_csaddr + j * sblock.fs_frag),
sblock.fs_cssize - i < sblock.fs_bsize ?
sblock.fs_cssize - i : sblock.fs_bsize);
}
}
static void
rwerror(mesg, blk)
char *mesg;
ufs_daddr_t blk;
{
if (preen == 0)
printf("\n");
pfatal("CANNOT %s: BLK %d", mesg, blk);
if (reply("CONTINUE") == 0)
exit(EEXIT);
}
void
ckfini(markclean)
int markclean;
{
struct bufarea *bp, *nbp;
int ofsmodified, cnt = 0;
if (fswritefd < 0) {
(void)close(fsreadfd);
return;
}
flush(fswritefd, &sblk);
if (havesb && sblk.b_bno != SBOFF / dev_bsize &&
!preen && reply("UPDATE STANDARD SUPERBLOCK")) {
sblk.b_bno = SBOFF / dev_bsize;
sbdirty();
flush(fswritefd, &sblk);
}
flush(fswritefd, &cgblk);
free(cgblk.b_un.b_buf);
for (bp = bufhead.b_prev; bp && bp != &bufhead; bp = nbp) {
cnt++;
flush(fswritefd, bp);
nbp = bp->b_prev;
free(bp->b_un.b_buf);
free((char *)bp);
}
if (bufhead.b_size != cnt)
errx(EEXIT, "Panic: lost %d buffers", bufhead.b_size - cnt);
pbp = pdirbp = (struct bufarea *)0;
if (markclean && (sblock.fs_clean & FS_ISCLEAN) == 0) {
/*
* Mark the file system as clean, and sync the superblock.
*/
if (preen)
pwarn("MARKING FILE SYSTEM CLEAN\n");
else if (!reply("MARK FILE SYSTEM CLEAN"))
markclean = 0;
if (markclean) {
sblock.fs_clean = FS_ISCLEAN;
sbdirty();
ofsmodified = fsmodified;
flush(fswritefd, &sblk);
#if LITE2BORKEN
fsmodified = ofsmodified;
#endif
if (!preen)
printf(
"\n***** FILE SYSTEM MARKED CLEAN *****\n");
}
}
if (debug)
printf("cache missed %ld of %ld (%d%%)\n", diskreads,
totalreads, (int)(diskreads * 100 / totalreads));
(void)close(fsreadfd);
(void)close(fswritefd);
}
int
bread(fd, buf, blk, size)
int fd;
char *buf;
ufs_daddr_t blk;
long size;
{
char *cp;
int i, errs;
off_t offset;
offset = blk;
offset *= dev_bsize;
if (lseek(fd, offset, 0) < 0)
rwerror("SEEK", blk);
else if (read(fd, buf, (int)size) == size)
return (0);
rwerror("READ", blk);
if (lseek(fd, offset, 0) < 0)
rwerror("SEEK", blk);
errs = 0;
memset(buf, 0, (size_t)size);
printf("THE FOLLOWING DISK SECTORS COULD NOT BE READ:");
for (cp = buf, i = 0; i < size; i += secsize, cp += secsize) {
if (read(fd, cp, (int)secsize) != secsize) {
(void)lseek(fd, offset + i + secsize, 0);
if (secsize != dev_bsize && dev_bsize != 1)
printf(" %ld (%ld),",
(blk * dev_bsize + i) / secsize,
blk + i / dev_bsize);
else
printf(" %ld,", blk + i / dev_bsize);
errs++;
}
}
printf("\n");
return (errs);
}
void
bwrite(fd, buf, blk, size)
int fd;
char *buf;
ufs_daddr_t blk;
long size;
{
int i;
char *cp;
off_t offset;
if (fd < 0)
return;
offset = blk;
offset *= dev_bsize;
if (lseek(fd, offset, 0) < 0)
rwerror("SEEK", blk);
else if (write(fd, buf, (int)size) == size) {
fsmodified = 1;
return;
}
rwerror("WRITE", blk);
if (lseek(fd, offset, 0) < 0)
rwerror("SEEK", blk);
printf("THE FOLLOWING SECTORS COULD NOT BE WRITTEN:");
for (cp = buf, i = 0; i < size; i += dev_bsize, cp += dev_bsize)
if (write(fd, cp, (int)dev_bsize) != dev_bsize) {
(void)lseek(fd, offset + i + dev_bsize, 0);
printf(" %ld,", blk + i / dev_bsize);
}
printf("\n");
return;
}
/*
* allocate a data block with the specified number of fragments
*/
ufs_daddr_t
allocblk(frags)
long frags;
{
int i, j, k;
if (frags <= 0 || frags > sblock.fs_frag)
return (0);
for (i = 0; i < maxfsblock - sblock.fs_frag; i += sblock.fs_frag) {
for (j = 0; j <= sblock.fs_frag - frags; j++) {
if (testbmap(i + j))
continue;
for (k = 1; k < frags; k++)
if (testbmap(i + j + k))
break;
if (k < frags) {
j += k;
continue;
}
for (k = 0; k < frags; k++)
setbmap(i + j + k);
n_blks += frags;
return (i + j);
}
}
return (0);
}
/*
* Free a previously allocated block
*/
void
freeblk(blkno, frags)
ufs_daddr_t blkno;
long frags;
{
struct inodesc idesc;
idesc.id_blkno = blkno;
idesc.id_numfrags = frags;
(void)pass4check(&idesc);
}
/*
* Find a pathname
*/
void
getpathname(namebuf, curdir, ino)
char *namebuf;
ino_t curdir, ino;
{
int len;
char *cp;
struct inodesc idesc;
static int busy = 0;
if (curdir == ino && ino == ROOTINO) {
(void)strcpy(namebuf, "/");
return;
}
if (busy ||
(statemap[curdir] != DSTATE && statemap[curdir] != DFOUND)) {
(void)strcpy(namebuf, "?");
return;
}
busy = 1;
memset(&idesc, 0, sizeof(struct inodesc));
idesc.id_type = DATA;
idesc.id_fix = IGNORE;
cp = &namebuf[MAXPATHLEN - 1];
*cp = '\0';
if (curdir != ino) {
idesc.id_parent = curdir;
goto namelookup;
}
while (ino != ROOTINO) {
idesc.id_number = ino;
idesc.id_func = findino;
idesc.id_name = "..";
if ((ckinode(ginode(ino), &idesc) & FOUND) == 0)
break;
namelookup:
idesc.id_number = idesc.id_parent;
idesc.id_parent = ino;
idesc.id_func = findname;
idesc.id_name = namebuf;
if ((ckinode(ginode(idesc.id_number), &idesc)&FOUND) == 0)
break;
len = strlen(namebuf);
cp -= len;
memmove(cp, namebuf, (size_t)len);
*--cp = '/';
if (cp < &namebuf[MAXNAMLEN])
break;
ino = idesc.id_number;
}
busy = 0;
if (ino != ROOTINO)
*--cp = '?';
memmove(namebuf, cp, (size_t)(&namebuf[MAXPATHLEN] - cp));
}
void
catch(sig)
int sig;
{
if (!doinglevel2)
ckfini(0);
exit(12);
}
/*
* When preening, allow a single quit to signal
* a special exit after filesystem checks complete
* so that reboot sequence may be interrupted.
*/
void
catchquit(sig)
int sig;
{
extern returntosingle;
printf("returning to single-user after filesystem check\n");
returntosingle = 1;
(void)signal(SIGQUIT, SIG_DFL);
}
/*
* Ignore a single quit signal; wait and flush just in case.
* Used by child processes in preen.
*/
void
voidquit(sig)
int sig;
{
sleep(1);
(void)signal(SIGQUIT, SIG_IGN);
(void)signal(SIGQUIT, SIG_DFL);
}
/*
* determine whether an inode should be fixed.
*/
int
dofix(idesc, msg)
struct inodesc *idesc;
char *msg;
{
switch (idesc->id_fix) {
case DONTKNOW:
if (idesc->id_type == DATA)
direrror(idesc->id_number, msg);
else
pwarn(msg);
if (preen) {
printf(" (SALVAGED)\n");
idesc->id_fix = FIX;
return (ALTERED);
}
if (reply("SALVAGE") == 0) {
idesc->id_fix = NOFIX;
return (0);
}
idesc->id_fix = FIX;
return (ALTERED);
case FIX:
return (ALTERED);
case NOFIX:
case IGNORE:
return (0);
default:
errx(EEXIT, "UNKNOWN INODESC FIX MODE %d", idesc->id_fix);
}
/* NOTREACHED */
return (0);
}
| 21.971681 | 77 | 0.634767 |
ebf1ec2bd3bda3267f895d886deaa1c4ee9d67c6 | 2,654 | c | C | src/downloader/downloader.c | uel-aspire-fp7/code_mobility | 38ed83d89792e1b0371694ee919a2c75d6233060 | [
"BSD-2-Clause"
] | null | null | null | src/downloader/downloader.c | uel-aspire-fp7/code_mobility | 38ed83d89792e1b0371694ee919a2c75d6233060 | [
"BSD-2-Clause"
] | null | null | null | src/downloader/downloader.c | uel-aspire-fp7/code_mobility | 38ed83d89792e1b0371694ee919a2c75d6233060 | [
"BSD-2-Clause"
] | null | null | null | /* This research is supported by the European Union Seventh Framework Programme (FP7/2007-2013), project ASPIRE (Advanced Software Protection: Integration, Research, and Exploitation), under grant agreement no. 609734; on-line at https://aspire-fp7.eu/. */
#include "downloader.h"
//#include <accl.h>
/*
Code Mobility Downloader
[in] unsigned int block_index
[out] unsigned int *block_length
Returns a pointer to the downloaded mobile block. The first 4 bytes of
this blocks represent the program base address.
*/
void* DIABLO_Mobility_DownloadByIndex(
unsigned int block_index,
unsigned int *block_length) {
LOG("Downloader[index: %d]: Block requested\n", block_index);
unsigned int page_size, buffer_size, ret, full_pages;
void *temp_buffer, *out_buffer;
page_size = getpagesize();
buffer_size = page_size * 2;
// invoke ACCL
ret = acclExchange (
ACCL_TID_CODE_MOBILITY,
(int)sizeof(unsigned int),
(char*)&block_index,
&buffer_size,
(char**)&temp_buffer);
if (ACCL_SUCCESS == ret) {
LOG("Downloader[index: %d]: Block retrieved (%d bytes) from server.\n", block_index, buffer_size);
// if the return size is valid the downloader returns received data
if (buffer_size > 0) {
// see https://aspire-fp7.eu/bugtracker/view.php?id=73
// each mobile block should take one or more complete memory
// pages so that subsequent heap memory allocations are not
// affected by writing restrictions
full_pages = buffer_size / page_size
+ (buffer_size % page_size > 0 ? 1 : 0);
LOG("Downloader[index: %d]: %d memory pages of %d bytes are being allocated.\n", block_index, full_pages, page_size);
// allocates a page aligned buffer
#ifndef __ANDROID__
if (0 != posix_memalign(&out_buffer,
page_size, full_pages * page_size)) {
free(temp_buffer);
return CODE_MOBILITY_ERROR;
}
#else
// since posix_memalign is not available on Android we need to
// rely on the obsolete function memalign
out_buffer = memalign(page_size, full_pages * page_size);
if (NULL == out_buffer){
free(temp_buffer);
return CODE_MOBILITY_ERROR;
}
#endif
// pass actual buffer length
memcpy(block_length, &buffer_size, sizeof(unsigned int));
// this is not so efficient... is it possible to avoid this copy?
memcpy(out_buffer, temp_buffer, buffer_size);
LOG("Downloader[index: %d]: mobile code block trasferred and allocated at %p.\n", block_index, out_buffer);
} else {
free(temp_buffer);
return CODE_MOBILITY_ERROR;
}
} else {
free(temp_buffer);
return CODE_MOBILITY_ERROR;
}
free(temp_buffer);
return out_buffer;
} | 29.488889 | 257 | 0.712509 |
ebf3e798b18c85284197ddbeb459311cc487d259 | 1,561 | h | C | peerd/mock_peer_manager.h | doitmovin/chromiumos-platform2 | 6462aaf43072307b5a40eb045a89e473381b5fda | [
"BSD-3-Clause"
] | 5 | 2019-01-19T15:38:48.000Z | 2021-10-06T03:59:46.000Z | peerd/mock_peer_manager.h | doitmovin/chromiumos-platform2 | 6462aaf43072307b5a40eb045a89e473381b5fda | [
"BSD-3-Clause"
] | null | null | null | peerd/mock_peer_manager.h | doitmovin/chromiumos-platform2 | 6462aaf43072307b5a40eb045a89e473381b5fda | [
"BSD-3-Clause"
] | 2 | 2021-01-26T12:37:19.000Z | 2021-05-18T13:37:57.000Z | // Copyright 2014 The Chromium OS 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 PEERD_MOCK_PEER_MANAGER_H_
#define PEERD_MOCK_PEER_MANAGER_H_
#include <string>
#include <base/time/time.h>
#include <gmock/gmock.h>
#include "peerd/peer_manager_interface.h"
#include "peerd/service.h"
#include "peerd/technologies.h"
namespace peerd {
class MockPeerManager : public PeerManagerInterface {
public:
MOCK_METHOD3(OnPeerDiscovered,
void(const std::string& peer_id,
const base::Time& last_seen,
technologies::Technology which_technology));
MOCK_METHOD6(OnServiceDiscovered,
void(const std::string& peer_id,
const std::string& service_id,
const Service::ServiceInfo& info,
const Service::IpAddresses& addresses,
const base::Time& last_seen,
technologies::Technology which_technology));
MOCK_METHOD2(OnPeerRemoved,
void(const std::string& peer_id,
technologies::Technology which_technology));
MOCK_METHOD3(OnServiceRemoved,
void(const std::string& peer_id,
const std::string& service_id,
technologies::Technology which_technology));
MOCK_METHOD1(OnTechnologyShutdown,
void(technologies::Technology which_technology));
};
} // namespace peerd
#endif // PEERD_MOCK_PEER_MANAGER_H_
| 33.934783 | 73 | 0.654709 |
ebf450a13578eff16bb047c6cdbd526a9fb81f49 | 544 | h | C | ExpressionEvaluatorLib/Operators/Binary/MulOperator.h | DrA1ex/ExpressionEvaluatorLib | 8024bc7c647204077e0987d9618ebe0d1cb406d3 | [
"MIT"
] | 1 | 2020-05-02T18:42:40.000Z | 2020-05-02T18:42:40.000Z | ExpressionEvaluatorLib/Operators/Binary/MulOperator.h | DrA1ex/FEEL | 8024bc7c647204077e0987d9618ebe0d1cb406d3 | [
"MIT"
] | null | null | null | ExpressionEvaluatorLib/Operators/Binary/MulOperator.h | DrA1ex/FEEL | 8024bc7c647204077e0987d9618ebe0d1cb406d3 | [
"MIT"
] | null | null | null | #ifndef MulOperator_h__
#define MulOperator_h__
#include "Base/BinaryOperatorBase.h"
class MulOperator : public BinaryOperatorBase
{
public:
ExpressionBytes GetBytes(ValueType *operand1, ValueType *operand2, ValueType *result) const override
{
Assembler assembler;
assembler.Load(operand1)
.Mul(operand2)
.Store(result);
return assembler.GetData();
}
const char * OperatorName() const override
{
return "*";
}
OperatorPriority Priority() const override
{
return OperatorBase::High;
}
};
#endif // MulOperator_h__
| 17.548387 | 101 | 0.744485 |
ebf4753b59b66e20b2b0ad786508b52e7be12913 | 202 | h | C | Example/Pods/PYUtil/PYUtil/Classes/PYHeader.h | yunhe-lin/PYBase | d919aba41579be720e70583b9b4311466ac38387 | [
"MIT"
] | 1 | 2016-07-29T06:59:40.000Z | 2016-07-29T06:59:40.000Z | Example/Pods/PYUtil/PYUtil/Classes/PYHeader.h | yunhe-lin/PYBase | d919aba41579be720e70583b9b4311466ac38387 | [
"MIT"
] | null | null | null | Example/Pods/PYUtil/PYUtil/Classes/PYHeader.h | yunhe-lin/PYBase | d919aba41579be720e70583b9b4311466ac38387 | [
"MIT"
] | null | null | null | //
// PYHeader.h
// Pods
//
// Created by yunhe.lin on 16/7/26.
//
//
#ifndef PYHeader_h
#define PYHeader_h
#import "PYCategoryHeader.h"
#import "PYDateFormatterHelper.h"
#endif /* PYHeader_h */
| 11.882353 | 36 | 0.668317 |
ebf4d590c253c85547503d56aaf7bd6de8a1e84b | 5,021 | c | C | 3rd-party/dparser/make_dparser.c | Noxsense/mCRL2 | dd2fcdd6eb8b15af2729633041c2dbbd2216ad24 | [
"BSL-1.0"
] | 61 | 2018-05-24T13:14:05.000Z | 2022-03-29T11:35:03.000Z | 3rd-party/dparser/make_dparser.c | Noxsense/mCRL2 | dd2fcdd6eb8b15af2729633041c2dbbd2216ad24 | [
"BSL-1.0"
] | 229 | 2018-05-28T08:31:09.000Z | 2022-03-21T11:02:41.000Z | 3rd-party/dparser/make_dparser.c | Noxsense/mCRL2 | dd2fcdd6eb8b15af2729633041c2dbbd2216ad24 | [
"BSL-1.0"
] | 28 | 2018-04-11T14:09:39.000Z | 2022-02-25T15:57:39.000Z | /*
Copyright 2002-2004 John Plevyak, All Rights Reserved
*/
#include "gramgram.h"
#include "d.h"
#include "mkdparse.h"
static void help(ArgumentState *arg_state, char *arg_unused);
static int set_op_priority_from_rule = 0;
static int right_recursive_BNF = 0;
static int states_for_whitespace = 1;
static int states_for_all_nterms = 0;
static int tokenizer = 0;
static int longest_match = 0;
static char grammar_ident[256] = "gram";
static int ident_from_filename = 0;
static int scanner_blocks = 4;
static int scanner_block_size;
static int write_line_directives = 1;
static int write_header = -1;
static int token_type = 0;
static char write_extension[256] = "c";
static char output_file [1024] = "";
static ArgumentDescription arg_desc[] = {
{"output", 'o', "Output file name", "S1024",
&output_file[0], "D_MAKE_PARSER_OUTPUT", NULL},
{"longest_match", 'l', "Use Longest Match Rule for Tokens", "T",
&longest_match, "D_MAKE_LONGEST_MATCH", NULL},
{"tokenizer", 'T', "Tokenizer for START", "T", &tokenizer,
"D_MAKE_PARSER_TOKENIZER", NULL},
{"write_header", 'H', "Write Header (-1:if not empty)", "I", &write_header,
"D_MAKE_PARSER_HEADER", NULL},
{"token_type", 't', "Token Type (0:define, 1:enum)", "I", &token_type,
"D_MAKE_PARSER_TOKEN", NULL},
{"whitespace_states", 'C', "Compute Whitespace States", "T",
&states_for_whitespace, "D_MAKE_PARSER_WHITESPACE", NULL},
{"all_states", 'A', "Compute States For All NTERMs", "T",
&states_for_all_nterms, "D_MAKE_PARSER_ALL_NTERMS", NULL},
{"grammar_ident", 'i', "Grammar Identifier", "S255", grammar_ident,
"D_MAKE_PARSER_GRAMMAR_IDENT", NULL},
{"filename_ident", 'I', "Use Filename as Identifier", "T", &ident_from_filename,
"D_MAKE_PARSER_IDENT_FROM_FILENAME", NULL},
{"scanner_blocks", 'b', "Scanner Blocks", "I", &scanner_blocks,
"D_MAKE_PARSER_SCANNER_BLOCKS", NULL},
{"op_pri_from_rule", 'p', "Set Operator Priority From Rule", "T",
&set_op_priority_from_rule, "D_MAKE_PARSER_SET_PRIORITY", NULL},
{"right_recurse_BNF", 'r', "Use Right Recursion For */+", "T",
&right_recursive_BNF, "D_MAKE_PARSER_RIGHT_RECURSIVE_BNF", NULL},
{"write_lines", 'L', "Write #line(s)", "T",
&write_line_directives, "D_MAKE_PARSER_WRITE_LINE_DIRECTIVES", NULL},
{"ext", 'X', "Code file extension (e.g. cpp)", "S256",
&write_extension[0], "D_MAKE_PARSER_WRITE_EXT", NULL},
{"verbose", 'v', "Verbose", "+", &d_verbose_level,
"D_MAKE_PARSER_VERBOSE", NULL},
{"debug", 'd', "Debug", "+", &d_debug_level,
"D_MAKE_PARSER_DEBUG", NULL},
{"rdebug_grammar", 'R', "Replace actions with ones printing productions", "+",
&d_rdebug_grammar_level, "D_MAKE_RDEBUG_GRAMMAR", NULL},
{"help", 'h', "Help", NULL, NULL, NULL, help},
{NULL, 0, NULL, NULL, NULL, NULL, NULL}
};
static ArgumentState arg_state = {
0, 0,
"program",
arg_desc
};
extern D_ParserTables parser_tables_dparser_gram;
static void
help(ArgumentState *arg_state, char *arg_unused) {
char ver[30];
d_version(ver);
fprintf(stderr, "Make DParser Version %s ", ver);
fprintf(stderr, "Copyright (c) 2002-2004 John Plevyak\n");
usage(arg_state, arg_unused);
}
int
main(int argc, char *argv[]) {
char *grammar_pathname;
Grammar *g;
(void)argc;
process_args(&arg_state, argv);
if (arg_state.nfile_arguments != 1)
help(&arg_state, NULL);
grammar_pathname = arg_state.file_argument[0];
g = new_D_Grammar(grammar_pathname);
/* grammar construction options */
g->set_op_priority_from_rule = set_op_priority_from_rule;
g->right_recursive_BNF = right_recursive_BNF;
g->states_for_whitespace = states_for_whitespace;
g->states_for_all_nterms = states_for_all_nterms;
g->tokenizer = tokenizer;
g->longest_match = longest_match;
/* grammar writing options */
strcpy(g->grammar_ident, grammar_ident);
if (ident_from_filename) {
char *n = strrchr(grammar_pathname, '/'), *e;
n = n ? n : grammar_pathname;
e = strchr(n, '.');
e = e ? e : n + strlen(n);
memcpy(g->grammar_ident, n, e-n);
g->grammar_ident[e-n] = 0;
}
g->scanner_blocks = scanner_blocks;
g->scanner_block_size = scanner_block_size;
g->write_line_directives = write_line_directives;
g->write_header = write_header;
g->token_type = token_type;
strcpy(g->write_extension, write_extension);
if (!output_file[0]) {
strncpy(output_file, grammar_pathname, sizeof(output_file)-1);
strncat(output_file, ".d_parser.", sizeof(output_file)-strlen(output_file)-1);
strncat(output_file, g->write_extension, sizeof(output_file)-strlen(output_file)-1);
}
g->write_pathname = output_file;
/* don't print anything to stdout, when the grammar is printed there */
if (d_rdebug_grammar_level > 0)
d_verbose_level = 0;
mkdparse(g, grammar_pathname);
if (d_rdebug_grammar_level == 0) {
if (write_c_tables(g) < 0)
d_fail("unable to write C tables '%s'", grammar_pathname);
} else
print_rdebug_grammar(g, grammar_pathname);
free_args(&arg_state);
free_D_Grammar(g);
g = 0;
return 0;
}
| 35.111888 | 88 | 0.705437 |
ebf53d1aa10675a941f97362faee211c9cdcb2e9 | 5,963 | c | C | src/heapy/horizon.c | odidev/guppy3 | d51838c57220ec80e4f8bb43ae0d325d6438e788 | [
"MIT"
] | 251 | 2019-08-18T17:19:19.000Z | 2022-03-31T20:38:20.000Z | src/heapy/horizon.c | odidev/guppy3 | d51838c57220ec80e4f8bb43ae0d325d6438e788 | [
"MIT"
] | 37 | 2019-09-05T08:03:00.000Z | 2022-01-27T12:49:50.000Z | src/heapy/horizon.c | odidev/guppy3 | d51838c57220ec80e4f8bb43ae0d325d6438e788 | [
"MIT"
] | 20 | 2019-09-01T15:29:56.000Z | 2022-01-27T03:03:18.000Z | /* Implementation of the Horizon type */
char horizon_doc[]=
"Horizon(X:iterable)\n"
"\n"
"Create a new Horizon object from X. \n"
"\n"
"The objects in X will be used to initialize a set of objects within\n"
"the Horizon object. There are no official references to these objects,\n"
"but as some of these objects become deallocated, they will be removed\n"
"from the set of objects within the Horizon object. The objects within\n"
"the set of objects within the Horizon object can be compared to\n"
"another set of objects via the news() method. This can be used to see\n"
"what objects have been allocated but not deallocated since the Horizon\n"
"object was created.\n"
;
typedef struct _NyHorizonObject {
PyObject_HEAD
struct _NyHorizonObject *next;
NyNodeSetObject *hs;
} NyHorizonObject;
/* Horizon Management
The struct rm must be a static/global singleton, since it is intimately bound to patching
*/
static struct {
NyHorizonObject *horizons;
PyObject *types;
} rm;
static void horizon_patched_dealloc(PyObject *v);
static destructor
horizon_get_org_dealloc(PyTypeObject *t)
{
if (!rm.types && t->tp_dealloc != horizon_patched_dealloc)
return t->tp_dealloc;
PyObject *d = PyDict_GetItem(rm.types, (PyObject *)t);
if (d)
return (destructor)PyLong_AsSsize_t(d);
Py_FatalError("horizon_get_org_dealloc: no original destructor found");
}
static void
horizon_remove(NyHorizonObject *v)
{
NyHorizonObject **p;
for (p = &rm.horizons; *p != v; p = &((*p)->next)) {
if (!*p)
Py_FatalError("horizon_remove: no such horizon found");
}
*p = v->next;
if (!rm.horizons && rm.types) {
Py_ssize_t i = 0;
PyObject *pk, *pv;
while (PyDict_Next(rm.types, &i, &pk, &pv)) {
((PyTypeObject *)pk)->tp_dealloc = (destructor)PyLong_AsSsize_t(pv);
}
Py_DECREF(rm.types);
rm.types = 0;
}
}
static void
horizon_dealloc(NyHorizonObject *rg)
{
horizon_remove(rg);
Py_XDECREF(rg->hs);
Py_TYPE(rg)->tp_free((PyObject *)rg);
}
static PyTypeObject *
horizon_base(PyObject *v)
{
PyTypeObject *t = Py_TYPE(v);
while (t->tp_flags & Py_TPFLAGS_HEAPTYPE) {
assert(t->tp_base);
assert(Py_TYPE(t) == Py_TYPE(t->tp_base) ||
PyObject_IsSubclass((PyObject *)Py_TYPE(t), (PyObject *)Py_TYPE(t->tp_base)));
t = t->tp_base;
}
return t;
}
static void
horizon_patched_dealloc(PyObject *v)
{
NyHorizonObject *r;
for (r = rm.horizons; r; r = r->next) {
if (NyNodeSet_clrobj(r->hs, v) == -1)
Py_FatalError("horizon_patched_dealloc: could not clear object in nodeset");
}
horizon_get_org_dealloc(horizon_base(v))(v);
}
static int
horizon_patch_dealloc(PyTypeObject *t)
{
PyObject *org;
if (!rm.types) {
rm.types = PyDict_New();
if (!rm.types)
return -1;
}
if (!(org = PyLong_FromSsize_t((Py_ssize_t)t->tp_dealloc)))
return -1;
if (PyDict_SetItem(rm.types, (PyObject *)t, org) == -1) {
Py_DECREF(org);
return -1;
}
t->tp_dealloc = horizon_patched_dealloc;
Py_DECREF(org);
return 0;
}
static int
horizon_update_trav(PyObject *obj, NyHorizonObject *ta) {
int r;
r = NyNodeSet_setobj(ta->hs, obj);
if (!r) {
PyTypeObject *t = horizon_base(obj);
if (t->tp_dealloc != horizon_patched_dealloc) {
if (horizon_patch_dealloc(t) == -1) {
return -1;
}
}
}
if (r == -1)
return -1;
return 0;
}
PyObject *
horizon_new(PyTypeObject *type, PyObject *args, PyObject *kwds)
{
PyObject *X;
NyHorizonObject *hz = 0;
static char *kwlist[] = {"X", 0};
if (!PyArg_ParseTupleAndKeywords(args, kwds, "O:Horizon.__new__",
kwlist,
&X))
goto err;
hz = (NyHorizonObject *)type->tp_alloc(type, 1);
if (!hz)
goto err;
hz->next = rm.horizons;
rm.horizons = hz;
hz->hs = NyMutNodeSet_NewFlags(0); /* I.E. not NS_HOLDOBJECTS */
if (!hz->hs)
goto err;
if (iterable_iterate((PyObject *)X, (visitproc)horizon_update_trav, hz) == -1 ||
horizon_update_trav((PyObject *)hz, hz) == -1)
goto err;
return (PyObject *)hz;
err:
Py_XDECREF(hz);
return 0;
}
typedef struct {
NyHorizonObject *rg;
NyNodeSetObject *result;
} NewsTravArg;
static int
horizon_news_trav(PyObject *obj, NewsTravArg *ta)
{
if (!(NyNodeSet_hasobj(ta->rg->hs, obj)))
if (NyNodeSet_setobj(ta->result, obj) == -1)
return -1;
return 0;
}
static char news_doc[] =
"H.news(X:iterable) -> NodeSet\n"
"\n"
"Return the set of objects in X that is not in the set of objects of H.\n"
"\n"
"If H was created from the contents of the heap at a particular time,\n"
"H.news(X) will return the set of objects in X that were allocated\n"
"after H was created.\n"
;
static PyObject *
horizon_news(NyHorizonObject *self, PyObject *arg)
{
NewsTravArg ta;
ta.rg = self;
ta.result = NyMutNodeSet_New();
if (!(ta.result))
goto err;
if (iterable_iterate(arg, (visitproc)horizon_news_trav, &ta) == -1)
goto err;
return (PyObject *)ta.result;
err:
Py_XDECREF(ta.result);
return 0;
}
static PyMethodDef horizon_methods[] = {
{"news", (PyCFunction)horizon_news, METH_O, news_doc},
{0} /* sentinel */
};
PyTypeObject NyHorizon_Type = {
PyVarObject_HEAD_INIT(NULL, 0)
.tp_name = "guppy.heapy.heapyc.Horizon",
.tp_basicsize = sizeof(NyHorizonObject),
.tp_dealloc = (destructor)horizon_dealloc,
.tp_getattro = PyObject_GenericGetAttr,
.tp_flags = Py_TPFLAGS_DEFAULT,
.tp_doc = horizon_doc,
.tp_methods = horizon_methods,
.tp_alloc = PyType_GenericAlloc,
.tp_new = horizon_new,
.tp_free = PyObject_Del,
};
| 25.702586 | 92 | 0.62804 |