hexsha stringlengths 40 40 | size int64 5 1.05M | ext stringclasses 588
values | lang stringclasses 305
values | max_stars_repo_path stringlengths 3 363 | max_stars_repo_name stringlengths 5 118 | max_stars_repo_head_hexsha stringlengths 40 40 | 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:00:35 2022-03-31 23:43:49 ⌀ | max_stars_repo_stars_event_max_datetime stringdate 2015-01-01 12:37:38 2022-03-31 23:59:52 ⌀ | max_issues_repo_path stringlengths 3 363 | max_issues_repo_name stringlengths 5 118 | max_issues_repo_head_hexsha stringlengths 40 40 | 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 363 | max_forks_repo_name stringlengths 5 135 | max_forks_repo_head_hexsha stringlengths 40 40 | 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:02 2022-03-31 23:27:27 ⌀ | max_forks_repo_forks_event_max_datetime stringdate 2015-01-03 08:55:07 2022-03-31 23:59:24 ⌀ | content stringlengths 5 1.05M | avg_line_length float64 1.13 1.04M | max_line_length int64 1 1.05M | alphanum_fraction float64 0 1 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
c37b8781fd3aad44bc0138bc8a57593cde91c6bb | 188 | h | C | bridge.h | hxverygood/GCDWebServerExample | 050c74872e0e9fa5676c7cc08ed71eeaf2d59b8b | [
"MIT"
] | null | null | null | bridge.h | hxverygood/GCDWebServerExample | 050c74872e0e9fa5676c7cc08ed71eeaf2d59b8b | [
"MIT"
] | null | null | null | bridge.h | hxverygood/GCDWebServerExample | 050c74872e0e9fa5676c7cc08ed71eeaf2d59b8b | [
"MIT"
] | null | null | null | //
// bridge.h
// hangge_1563
//
// Created by hangge on 2017/2/20.
// Copyright © 2017年 hangge. All rights reserved.
//
#import "GCDWebServer.h"
#import "GCDWebServerDataResponse.h"
| 17.090909 | 50 | 0.68617 |
c7d1536afbabaf92872b41fe0d4c6d51ef9d41b0 | 1,532 | h | C | src/jd-sync/common/Request.h | 02JanDal/jd-sync | f7f6ae262736911aff84214605b9cf417380ab73 | [
"Apache-2.0"
] | null | null | null | src/jd-sync/common/Request.h | 02JanDal/jd-sync | f7f6ae262736911aff84214605b9cf417380ab73 | [
"Apache-2.0"
] | null | null | null | src/jd-sync/common/Request.h | 02JanDal/jd-sync | f7f6ae262736911aff84214605b9cf417380ab73 | [
"Apache-2.0"
] | null | null | null | #pragma once
#include <QObject>
#include "AbstractActor.h"
#include "Message.h"
#include <functional>
#include <memory>
class TimeoutTimer;
class RequestWaiter;
class Request : public AbstractActor
{
INTROSPECTION
public:
explicit Request(MessageHub *hub, const Message &msg);
~Request();
template <typename... Args>
using Callback = std::function<void(Args...)>;
Request &then(const Callback<Message> &func);
Request &error(const Callback<ErrorMessage> &func);
Request &timeout(const Callback<> &func);
Request &throwOnError();
Request &setTimeout(const int secs, const int retries = 0);
Request &deleteOnFinished();
Request &send();
void sendAndWait();
static Request &create(MessageHub *hub, const Message &msg);
private:
Q_DISABLE_COPY(Request)
friend class TimeoutTimer;
Message m_message;
Callback<Message> m_then;
Callback<ErrorMessage> m_error;
Callback<> m_timeout;
int m_timeoutSecs = -1;
int m_retriesOnTimeout = 0;
bool m_deleteOnFinish = false;
TimeoutTimer *m_timer = nullptr;
bool m_done = false;
friend class RequestWaiter;
RequestWaiter *m_waiter = nullptr;
void receive(const Message &message) override;
void reset() override;
};
class RequestObject : public QObject
{
Q_OBJECT
public:
explicit RequestObject(MessageHub *hub, const Message &message, QObject *parent = nullptr);
public slots:
void send();
signals:
void reply(const Message &msg);
void error(const Message &msg);
void timeout();
void finished();
private:
std::unique_ptr<Request> m_request;
};
| 20.157895 | 92 | 0.743473 |
685b6fb4bbb7355b3b4ff8bfd59f5583fe03a1b7 | 4,050 | h | C | ns-3-dev/src/wifi/model/interference-helper.h | maxvonhippel/snake | 0805773dc34e1480dffaae40174aa1f82d1c6ce8 | [
"BSD-3-Clause"
] | 11 | 2015-11-24T11:07:28.000Z | 2021-12-23T04:10:29.000Z | ns-3-dev/src/wifi/model/interference-helper.h | maxvonhippel/snake | 0805773dc34e1480dffaae40174aa1f82d1c6ce8 | [
"BSD-3-Clause"
] | null | null | null | ns-3-dev/src/wifi/model/interference-helper.h | maxvonhippel/snake | 0805773dc34e1480dffaae40174aa1f82d1c6ce8 | [
"BSD-3-Clause"
] | 6 | 2016-03-01T06:32:21.000Z | 2022-03-24T19:31:41.000Z | /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
* Copyright (c) 2005,2006 INRIA
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation;
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
* Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
*/
#ifndef INTERFERENCE_HELPER_H
#define INTERFERENCE_HELPER_H
#include <stdint.h>
#include <vector>
#include <list>
#include "wifi-mode.h"
#include "wifi-preamble.h"
#include "wifi-phy-standard.h"
#include "ns3/nstime.h"
#include "ns3/simple-ref-count.h"
namespace ns3 {
class ErrorRateModel;
/**
* \ingroup wifi
* \brief handles interference calculations
*/
class InterferenceHelper
{
public:
class Event : public SimpleRefCount<InterferenceHelper::Event>
{
public:
Event (uint32_t size, WifiMode payloadMode,
enum WifiPreamble preamble,
Time duration, double rxPower);
~Event ();
Time GetDuration (void) const;
Time GetStartTime (void) const;
Time GetEndTime (void) const;
double GetRxPowerW (void) const;
uint32_t GetSize (void) const;
WifiMode GetPayloadMode (void) const;
enum WifiPreamble GetPreambleType (void) const;
private:
uint32_t m_size;
WifiMode m_payloadMode;
enum WifiPreamble m_preamble;
Time m_startTime;
Time m_endTime;
double m_rxPowerW;
};
struct SnrPer
{
double snr;
double per;
};
InterferenceHelper ();
~InterferenceHelper ();
void SetNoiseFigure (double value);
void SetErrorRateModel (Ptr<ErrorRateModel> rate);
double GetNoiseFigure (void) const;
Ptr<ErrorRateModel> GetErrorRateModel (void) const;
/**
* \param energyW the minimum energy (W) requested
* \returns the expected amount of time the observed
* energy on the medium will be higher than
* the requested threshold.
*/
Time GetEnergyDuration (double energyW);
Ptr<InterferenceHelper::Event> Add (uint32_t size, WifiMode payloadMode,
enum WifiPreamble preamble,
Time duration, double rxPower);
struct InterferenceHelper::SnrPer CalculateSnrPer (Ptr<InterferenceHelper::Event> event);
void NotifyRxStart ();
void NotifyRxEnd ();
void EraseEvents (void);
private:
class NiChange
{
public:
NiChange (Time time, double delta);
Time GetTime (void) const;
double GetDelta (void) const;
bool operator < (const NiChange& o) const;
private:
Time m_time;
double m_delta;
};
typedef std::vector <NiChange> NiChanges;
typedef std::list<Ptr<Event> > Events;
InterferenceHelper (const InterferenceHelper &o);
InterferenceHelper &operator = (const InterferenceHelper &o);
void AppendEvent (Ptr<Event> event);
double CalculateNoiseInterferenceW (Ptr<Event> event, NiChanges *ni) const;
double CalculateSnr (double signal, double noiseInterference, WifiMode mode) const;
double CalculateChunkSuccessRate (double snir, Time delay, WifiMode mode) const;
double CalculatePer (Ptr<const Event> event, NiChanges *ni) const;
double m_noiseFigure; /**< noise figure (linear) */
Ptr<ErrorRateModel> m_errorRateModel;
///Experimental: needed for energy duration calculation
NiChanges m_niChanges;
double m_firstPower;
bool m_rxing;
/// Returns an iterator to the first nichange, which is later than moment
NiChanges::iterator GetPosition (Time moment);
void AddNiChangeEvent (NiChange change);
};
} // namespace ns3
#endif /* INTERFERENCE_HELPER_H */
| 29.779412 | 91 | 0.711111 |
7e332c369f4d32993962f7987f5ff51381c80d2a | 232 | c | C | src/interpreter/tests/SAFETY/foo1-unsafe.c | tracer-x/tracer | c91fa7dae8f4fd92f9cefa842e2d2a4e67c95a19 | [
"RSA-MD"
] | 21 | 2016-08-20T16:44:01.000Z | 2019-10-08T12:16:55.000Z | src/interpreter/tests/SAFETY/foo1-unsafe.c | tracer-x/TRACER | c91fa7dae8f4fd92f9cefa842e2d2a4e67c95a19 | [
"RSA-MD"
] | 1 | 2020-06-16T03:45:51.000Z | 2020-06-16T03:45:51.000Z | src/interpreter/tests/SAFETY/foo1-unsafe.c | tracer-x/tracer | c91fa7dae8f4fd92f9cefa842e2d2a4e67c95a19 | [
"RSA-MD"
] | 6 | 2016-11-27T04:07:40.000Z | 2018-04-22T01:54:15.000Z | // UNSAFE
extern int unknown();
int main(){
int x = 0;
if (unknown()) x = x+1;
_TRACER_abort(x > 1);
if (unknown()) x = x+2;
_TRACER_abort(x > 3);
if (unknown()) x = x+4;
_TRACER_abort(x >= 7);
return x;
}
| 11.6 | 26 | 0.525862 |
4651304769acd5cdbe9c002c7345d5d88e8b09b2 | 3,721 | h | C | src/OpcUaStackCore/ServiceSet/ApplicationDescription.h | gianricardo/OpcUaStack | ccdef574175ffe8b7e82b886abc5e5403968b280 | [
"Apache-2.0"
] | 108 | 2018-10-08T17:03:32.000Z | 2022-03-21T00:52:26.000Z | src/OpcUaStackCore/ServiceSet/ApplicationDescription.h | gianricardo/OpcUaStack | ccdef574175ffe8b7e82b886abc5e5403968b280 | [
"Apache-2.0"
] | 287 | 2018-09-18T14:59:12.000Z | 2022-01-13T12:28:23.000Z | src/OpcUaStackCore/ServiceSet/ApplicationDescription.h | gianricardo/OpcUaStack | ccdef574175ffe8b7e82b886abc5e5403968b280 | [
"Apache-2.0"
] | 32 | 2018-10-19T14:35:03.000Z | 2021-11-12T09:36:46.000Z | /*
Copyright 2015-2017 Kai Huebl (kai@huebl-sgh.de)
Lizenziert gemäß Apache Licence Version 2.0 (die „Lizenz“); Nutzung dieser
Datei nur in Übereinstimmung mit der Lizenz erlaubt.
Eine Kopie der Lizenz erhalten Sie auf http://www.apache.org/licenses/LICENSE-2.0.
Sofern nicht gemäß geltendem Recht vorgeschrieben oder schriftlich vereinbart,
erfolgt die Bereitstellung der im Rahmen der Lizenz verbreiteten Software OHNE
GEWÄHR ODER VORBEHALTE – ganz gleich, ob ausdrücklich oder stillschweigend.
Informationen über die jeweiligen Bedingungen für Genehmigungen und Einschränkungen
im Rahmen der Lizenz finden Sie in der Lizenz.
Autor: Kai Huebl (kai@huebl-sgh.de)
*/
#ifndef __OpcUaStackCore_ApplicationDescription_h__
#define __OpcUaStackCore_ApplicationDescription_h__
#include "OpcUaStackCore/Base/ObjectPool.h"
#include "OpcUaStackCore/Base/os.h"
#include "OpcUaStackCore/BuildInTypes/Xmlns.h"
#include "OpcUaStackCore/BuildInTypes/BuildInTypes.h"
#include "OpcUaStackCore/BuildInTypes/OpcUaString.h"
#include "OpcUaStackCore/BuildInTypes/OpcUaLocalizedText.h"
#include "OpcUaStackCore/BuildInTypes/OpcUaArray.h"
#include "OpcUaStackCore/ServiceSet/ApplicationType.h"
namespace OpcUaStackCore
{
class DLLEXPORT ApplicationDescription
: public Object
, public ExtensionObjectBase
{
public:
typedef boost::shared_ptr<ApplicationDescription> SPtr;
typedef std::vector<ApplicationDescription::SPtr> Vec;
ApplicationDescription(void);
virtual ~ApplicationDescription(void);
void applicationUri(const std::string& applicationUri);
std::string applicationUri(void) const;
OpcUaString& getApplicationUri(void);
void productUri(const std::string& productUri);
std::string productUri(void) const;
OpcUaString& getProductUri(void);
void applicationName(OpcUaLocalizedText applicationName);
OpcUaLocalizedText& applicationName(void);
void applicationType(ApplicationType applicationType);
ApplicationType applicationType(void) const;
void gatewayServerUri(const std::string& gatewayServerUri);
std::string gatewayServerUri(void) const;
OpcUaString& getGatewayServerUri(void);
void discoveryProfileUri(const std::string& discoveryProfileUri);
std::string discoveryProfileUri(void) const;
OpcUaString& getDiscoveryProfileUri(void);
void discoveryUrls(OpcUaStringArray::SPtr discoveryUrls);
OpcUaStringArray::SPtr discoveryUrls(void) const;
void copyTo(ApplicationDescription& applicationDescription);
bool operator==(const ApplicationDescription& applicationDescription) const;
//- ExtensionObjectBase -----------------------------------------------
ExtensionObjectBase::SPtr factory(void);
void opcUaBinaryEncode(std::ostream& os) const;
void opcUaBinaryDecode(std::istream& is);
bool xmlEncode(boost::property_tree::ptree& pt, const std::string& element, Xmlns& xmlns);
bool xmlEncode(boost::property_tree::ptree& pt, Xmlns& xmlns);
bool xmlDecode(boost::property_tree::ptree& pt, Xmlns& xmlns);
void copyTo(ExtensionObjectBase& extensionObjectBase);
bool equal(ExtensionObjectBase& extensionObjectBase) const;
void out(std::ostream& os);
//- ExtensionObjectBase -----------------------------------------------
private:
OpcUaString applicationUri_;
OpcUaString productUri_;
OpcUaLocalizedText applicationName_;
ApplicationType applicationType_;
OpcUaString gatewayServerUri_;
OpcUaString discoveryProfileUri_;
OpcUaStringArray::SPtr discoveryUrls_;
};
class ApplicationDescriptionArray
: public OpcUaArray<ApplicationDescription::SPtr, SPtrTypeCoder<ApplicationDescription> >
, public Object
{
public:
typedef boost::shared_ptr<ApplicationDescriptionArray> SPtr;
};
}
#endif
| 37.585859 | 92 | 0.779092 |
01a6d444d3e0be7f2ba23b8419f60eaaa955f2e1 | 4,366 | c | C | examples/example3.c | petershh/TinySoundFont | e763bd93badbd390945a3d0ee25d75e54e4fb8eb | [
"MIT"
] | 405 | 2017-01-06T22:18:42.000Z | 2022-03-26T13:46:35.000Z | examples/example3.c | petershh/TinySoundFont | e763bd93badbd390945a3d0ee25d75e54e4fb8eb | [
"MIT"
] | 67 | 2017-08-21T13:08:30.000Z | 2021-12-11T22:16:08.000Z | examples/example3.c | petershh/TinySoundFont | e763bd93badbd390945a3d0ee25d75e54e4fb8eb | [
"MIT"
] | 54 | 2017-03-07T04:33:57.000Z | 2022-02-25T08:40:24.000Z | #include "minisdl_audio.h"
#define TSF_IMPLEMENTATION
#include "../tsf.h"
#define TML_IMPLEMENTATION
#include "../tml.h"
// Holds the global instance pointer
static tsf* g_TinySoundFont;
// Holds global MIDI playback state
static double g_Msec; //current playback time
static tml_message* g_MidiMessage; //next message to be played
// Callback function called by the audio thread
static void AudioCallback(void* data, Uint8 *stream, int len)
{
//Number of samples to process
int SampleBlock, SampleCount = (len / (2 * sizeof(float))); //2 output channels
for (SampleBlock = TSF_RENDER_EFFECTSAMPLEBLOCK; SampleCount; SampleCount -= SampleBlock, stream += (SampleBlock * (2 * sizeof(float))))
{
//We progress the MIDI playback and then process TSF_RENDER_EFFECTSAMPLEBLOCK samples at once
if (SampleBlock > SampleCount) SampleBlock = SampleCount;
//Loop through all MIDI messages which need to be played up until the current playback time
for (g_Msec += SampleBlock * (1000.0 / 44100.0); g_MidiMessage && g_Msec >= g_MidiMessage->time; g_MidiMessage = g_MidiMessage->next)
{
switch (g_MidiMessage->type)
{
case TML_PROGRAM_CHANGE: //channel program (preset) change (special handling for 10th MIDI channel with drums)
tsf_channel_set_presetnumber(g_TinySoundFont, g_MidiMessage->channel, g_MidiMessage->program, (g_MidiMessage->channel == 9));
break;
case TML_NOTE_ON: //play a note
tsf_channel_note_on(g_TinySoundFont, g_MidiMessage->channel, g_MidiMessage->key, g_MidiMessage->velocity / 127.0f);
break;
case TML_NOTE_OFF: //stop a note
tsf_channel_note_off(g_TinySoundFont, g_MidiMessage->channel, g_MidiMessage->key);
break;
case TML_PITCH_BEND: //pitch wheel modification
tsf_channel_set_pitchwheel(g_TinySoundFont, g_MidiMessage->channel, g_MidiMessage->pitch_bend);
break;
case TML_CONTROL_CHANGE: //MIDI controller messages
tsf_channel_midi_control(g_TinySoundFont, g_MidiMessage->channel, g_MidiMessage->control, g_MidiMessage->control_value);
break;
}
}
// Render the block of audio samples in float format
tsf_render_float(g_TinySoundFont, (float*)stream, SampleBlock, 0);
}
}
int main(int argc, char *argv[])
{
tml_message* TinyMidiLoader = NULL;
// Define the desired audio output format we request
SDL_AudioSpec OutputAudioSpec;
OutputAudioSpec.freq = 44100;
OutputAudioSpec.format = AUDIO_F32;
OutputAudioSpec.channels = 2;
OutputAudioSpec.samples = 4096;
OutputAudioSpec.callback = AudioCallback;
// Initialize the audio system
if (SDL_AudioInit(TSF_NULL) < 0)
{
fprintf(stderr, "Could not initialize audio hardware or driver\n");
return 1;
}
//Venture (Original WIP) by Ximon
//https://musescore.com/user/2391686/scores/841451
//License: Creative Commons copyright waiver (CC0)
TinyMidiLoader = tml_load_filename("venture.mid");
if (!TinyMidiLoader)
{
fprintf(stderr, "Could not load MIDI file\n");
return 1;
}
//Set up the global MidiMessage pointer to the first MIDI message
g_MidiMessage = TinyMidiLoader;
// Load the SoundFont from a file
g_TinySoundFont = tsf_load_filename("florestan-subset.sf2");
if (!g_TinySoundFont)
{
fprintf(stderr, "Could not load SoundFont\n");
return 1;
}
//Initialize preset on special 10th MIDI channel to use percussion sound bank (128) if available
tsf_channel_set_bank_preset(g_TinySoundFont, 9, 128, 0);
// Set the SoundFont rendering output mode
tsf_set_output(g_TinySoundFont, TSF_STEREO_INTERLEAVED, OutputAudioSpec.freq, 0.0f);
// Request the desired audio output format
if (SDL_OpenAudio(&OutputAudioSpec, TSF_NULL) < 0)
{
fprintf(stderr, "Could not open the audio hardware or the desired audio output format\n");
return 1;
}
// Start the actual audio playback here
// The audio thread will begin to call our AudioCallback function
SDL_PauseAudio(0);
//Wait until the entire MIDI file has been played back (until the end of the linked message list is reached)
while (g_MidiMessage != NULL) SDL_Delay(100);
// We could call tsf_close(g_TinySoundFont) and tml_free(TinyMidiLoader)
// here to free the memory and resources but we just let the OS clean up
// because the process ends here.
return 0;
}
| 36.689076 | 138 | 0.72973 |
4a4039f32e0baed40fe26a602b5328803fcbc01a | 5,006 | c | C | components/lwip/port/esp8266/freertos/udp_sync.c | piluex/ESP8266_RTOS_SDK | e409678ccc6399a1b1ca4656267f507f6a116fc5 | [
"Apache-2.0"
] | 1 | 2018-11-22T05:58:25.000Z | 2018-11-22T05:58:25.000Z | components/lwip/port/esp8266/freertos/udp_sync.c | piluex/ESP8266_RTOS_SDK | e409678ccc6399a1b1ca4656267f507f6a116fc5 | [
"Apache-2.0"
] | null | null | null | components/lwip/port/esp8266/freertos/udp_sync.c | piluex/ESP8266_RTOS_SDK | e409678ccc6399a1b1ca4656267f507f6a116fc5 | [
"Apache-2.0"
] | 3 | 2019-01-17T09:48:41.000Z | 2022-03-31T11:07:33.000Z | // Copyright 2018-2019 Espressif Systems (Shanghai) PTE LTD
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#include <stddef.h>
#include <string.h>
#include <stdbool.h>
#include <sys/errno.h>
#include "lwip/udp.h"
#include "lwip/priv/api_msg.h"
#include "lwip/priv/tcp_priv.h"
#include "esp_log.h"
#if ESP_UDP && LWIP_NETIF_TX_SINGLE_PBUF
#define UDP_SYNC_MAX MEMP_NUM_NETCONN
#define UDP_SYNC_RETRY_MAX CONFIG_ESP_UDP_SYNC_RETRY_MAX
/*
* All function has no mutex, so they must put into one task(LWIP main task).
*/
#if LWIP_TCPIP_CORE_LOCKING
#define TCPIP_APIMSG_ACK(m) NETCONN_SET_SAFE_ERR((m)->conn, (m)->err)
#else /* LWIP_TCPIP_CORE_LOCKING */
#define TCPIP_APIMSG_ACK(m) do { NETCONN_SET_SAFE_ERR((m)->conn, (m)->err); sys_sem_signal(LWIP_API_MSG_SEM(m)); } while(0)
#endif /* LWIP_TCPIP_CORE_LOCKING */
typedef struct udp_sync {
struct api_msg *msg;
struct netif *netif;
int8_t ret;
uint8_t retry;
} udp_sync_t;
static const char *TAG = "udp_sync";
static size_t s_udp_sync_num;
static udp_sync_t s_udp_sync[UDP_SYNC_MAX];
static struct api_msg *s_cur_msg;
/*
* @brief initialize UDP sync module
*/
void udp_sync_init(void)
{
memset(s_udp_sync, 0, sizeof(s_udp_sync));
s_udp_sync_num = 0;
}
/*
* @brief register a UDP API message(struct api_msg) to module
*/
void udp_sync_regitser(void *in_msg)
{
s_cur_msg = in_msg;
struct api_msg *msg = (struct api_msg *)in_msg;
int s = msg->conn->socket;
if (s < 0 || s >= UDP_SYNC_MAX) {
ESP_LOGE(TAG, "UDP sync register error, socket is %d", s);
} else if (s_udp_sync[s].msg) {
ESP_LOGE(TAG, "UDP sync register error, msg is %p", s_udp_sync[s].msg);
}
s_udp_sync_num++;
s_udp_sync[s].ret = ERR_OK;
s_udp_sync[s].retry = 0;
s_udp_sync[s].msg = msg;
}
static void _udp_sync_ack_ret(int s, struct api_msg *msg)
{
/* Only cache when low-level has no buffer to send packet */
if (s_udp_sync[s].ret != ERR_MEM || s_udp_sync[s].retry >= UDP_SYNC_RETRY_MAX) {
ESP_LOGD(TAG, "UDP sync ret %d retry %d", s_udp_sync[s].ret, s_udp_sync[s].retry);
s_udp_sync[s].msg = NULL;
s_udp_sync[s].retry = 0;
s_udp_sync[s].ret = ERR_OK;
s_udp_sync_num--;
TCPIP_APIMSG_ACK(msg);
} else {
s_udp_sync[s].retry++;
ESP_LOGD(TAG, "UDP sync ack error, errno %d", s_udp_sync[s].ret);
}
}
/*
* @brief ack the message
*/
void udp_sync_ack(void *in_msg)
{
struct api_msg *msg = (struct api_msg *)in_msg;
int s = msg->conn->socket;
if (s < 0 || s >= UDP_SYNC_MAX) {
ESP_LOGE(TAG, "UDP sync ack error, socket is %d", s);
} else if (!s_udp_sync[s].msg) {
ESP_LOGE(TAG, "UDP sync ack error, msg is NULL");
}
_udp_sync_ack_ret(s, msg);
s_cur_msg = NULL;
}
/*
* @brief set the current message send result
*/
void udp_sync_set_ret(void *netif, int ret)
{
/* Only poll and regitser can set current message */
if (!s_cur_msg || !sys_current_task_is_tcpip()) {
/* You may use it to debug */
//ESP_LOGE(TAG, "UDP sync ack error, current message is %p, task name is %s", s_cur_msg, sys_current_task_name());
return ;
}
struct api_msg *msg = s_cur_msg;
int s = msg->conn->socket;
if (s < 0 || s >= UDP_SYNC_MAX) {
ESP_LOGE(TAG, "UDP sync ack error, socket is %d", s);
} else if (!s_udp_sync[s].msg) {
ESP_LOGE(TAG, "UDP sync ack error, msg is NULL");
}
s_udp_sync[s].netif = netif;
s_udp_sync[s].ret = ret;
}
static void udp_sync_send(struct api_msg *msg)
{
struct pbuf *p = msg->msg.b->p;
int s = msg->conn->socket;
struct netif *netif = s_udp_sync[s].netif;
s_cur_msg = msg;
netif->linkoutput(netif, p);
_udp_sync_ack_ret(s, msg);
s_cur_msg = NULL;
}
/*
* @brief process the sync
*/
void udp_sync_proc(void)
{
if (!s_udp_sync_num)
return ;
for (int i = 0; i < UDP_SYNC_MAX; i++) {
if (!s_udp_sync[i].msg)
continue;
udp_sync_send(s_udp_sync[i].msg);
if (s_udp_sync[i].ret == ERR_MEM)
break;
}
}
/*
* @brief NULL function and just as sync message
*/
static void udp_sync_trigger_null(void *p)
{
}
/*
* @brief trigger a UDP sync process
*/
void udp_sync_trigger(void)
{
if (!s_udp_sync_num)
return ;
tcpip_callback_with_block((tcpip_callback_fn)udp_sync_trigger_null, NULL, 0);
}
#endif /* ESP_UDP */
| 24.782178 | 125 | 0.648022 |
9a24c7bdc051e3d6dbacd4abc5ab618992736ece | 2,243 | h | C | Application.h | Denisdrk6/Ignition-Engine | bd23fa119452356fce5047236b09b2243346be3e | [
"MIT"
] | 1 | 2021-09-29T14:50:17.000Z | 2021-09-29T14:50:17.000Z | Application.h | Denisdrk6/Ignition-Engine | bd23fa119452356fce5047236b09b2243346be3e | [
"MIT"
] | null | null | null | Application.h | Denisdrk6/Ignition-Engine | bd23fa119452356fce5047236b09b2243346be3e | [
"MIT"
] | null | null | null | #pragma once
#include "Globals.h"
#include "Timer.h"
#include "Log.h"
// Include libraries
#include "SDL.h"
#include "GLEW/include/glew.h"
#include "SDL_opengl.h"
#include <gl/GL.h>
#include <gl/GLU.h>
#include "imgui.h"
#include "imgui_impl_sdl.h"
#include "imgui_impl_opengl2.h"
#include <stdio.h>
#include <list>
#include <vector>
#include "PugiXml/src/pugixml.hpp"
// Modules
class ModuleWindow;
class ModuleInput;
class ModuleSceneIntro;
class Editor;
class ModuleRenderer3D;
class ModuleCamera3D;
class ModulePhysics3D;
class Logger;
class FbxLoader;
class FileSystem;
#define CONFIG_FILNAME "config.xml"
class Application
{
public:
ModuleWindow* window;
ModuleInput* input;
ModuleSceneIntro* scene_intro;
Editor* editor;
ModuleRenderer3D* renderer3D;
ModuleCamera3D* camera;
ModulePhysics3D* physics;
Logger* log;
FbxLoader* fbx;
FileSystem* fileSystem;
SDL_GLContext gl_context;
// App info
std::vector<float> fps_log;
std::vector<float> ms_log;
int maxFPS = 60;
std::string appTitle = "Ignition engine";
std::string orgName = "CITM Students";
// Hardware info
int cpuCount = 0;
int cpuCacheSize = 0;
float ram = 0.0f;
SDL_version SDLversion;
int GLverMajor = 0;
int GLverMinor = 0;
std::string glewVersion = "";
std::string caps = "";
std::string gpuIntegratedVendor = "";
std::string gpuIntegratedModel = "";
//OpenGL options
bool GLdepthTest = true;
bool GLcullFace = true;
bool GLlightning = true;
bool GLcolorMaterial = true;
bool GLtexture2D = true;
bool GLlineSmooth = false;
bool GLfog = true;
bool fogLinear = true;
bool fogExpo = false;
float fogR = 0.8f;
float fogG = 0.8f;
float fogB = 0.8f;
float fogStart = 10.0f;
float fogEnd = 40.0f;
float fogDensity = 1.0f;
private:
Timer ms_timer;
float dt;
float delayTime = 0.0f; //Used for capping fps
std::list<Module*> list_modules;
int vectorAllocator = 0;
public:
Application();
~Application();
bool Init();
update_status Update();
bool CleanUp();
void RequestBrowser(const char* link);
private:
void AddModule(Module* mod);
void PrepareUpdate();
void FinishUpdate();
// Load/Save config file
bool LoadConfig();
bool SaveConfig();
pugi::xml_document configFile;
pugi::xml_node config;
}; | 18.235772 | 47 | 0.721801 |
78a9c1a7ca5a9cc3a5b5615ac3261d27cbc36e73 | 1,208 | h | C | LYChatUI/LYChatUI/Session/LYSessionCell.h | luoyuant/LYChatUI | 809deacc39aafce1ee86d9b7d2487d19dbb151b0 | [
"MIT"
] | null | null | null | LYChatUI/LYChatUI/Session/LYSessionCell.h | luoyuant/LYChatUI | 809deacc39aafce1ee86d9b7d2487d19dbb151b0 | [
"MIT"
] | null | null | null | LYChatUI/LYChatUI/Session/LYSessionCell.h | luoyuant/LYChatUI | 809deacc39aafce1ee86d9b7d2487d19dbb151b0 | [
"MIT"
] | null | null | null | //
// LYSessionCell.h
// LYChatUI
//
// Created by luoyuan on 2021/1/2.
//
#import <UIKit/UIKit.h>
#import "LYSessionContentView.h"
#import "LYSessionMessageModel.h"
#import "LYLabel.h"
NS_ASSUME_NONNULL_BEGIN
@protocol LYSessionCellDelegate <NSObject>
@required
/**
* 头像获取
*/
- (void)avatarImageView:(UIImageView *)avatarImageView imageForMessage:(LYSessionMessageModel *)message;
@optional
/**
* 点击了头像
*/
- (void)didTapAvatar:(UIImageView *)avatarImageView message:(LYSessionMessageModel *)message;
@end
@interface LYSessionCell : UITableViewCell
/**
* 头像
*/
@property (nonatomic, strong) UIImageView *avatarImageView;
/**
* 头像圆角layer
*/
@property (nonatomic, strong) CAShapeLayer *avatarMaskLayer;
/**
* 昵称
*/
@property (nonatomic, strong) UILabel *nicknameLabel;
/**
* 内容区域
*/
@property (nonatomic, strong) LYSessionContentView *sessionContentView;
/**
* 消息
*/
@property (nonatomic, strong) LYSessionMessageModel *message;
@property (nonatomic, weak) id<LYSessionCellDelegate> delegate;
@property (nonatomic, weak) id<LYLabelSelectionDelegate> textSelectionDelegate;
/**
* 更新布局
*/
- (void)updateLayout;
/**
* 数据刷新
*/
- (void)refresh;
@end
NS_ASSUME_NONNULL_END
| 15.291139 | 104 | 0.72351 |
78f87624c55b2d49a270317a9392983be018e7ae | 723 | h | C | src/MulleTextLayer+Selection.h | mulle-kybernetik-tv/MulleUIKit | 95406324abdb71c973dbec2816f0f0f9e1a80949 | [
"BSD-3-Clause"
] | 2 | 2020-02-13T16:07:40.000Z | 2020-02-20T15:09:48.000Z | src/MulleTextLayer+Selection.h | mulle-kybernetik-tv/MulleUI | 95406324abdb71c973dbec2816f0f0f9e1a80949 | [
"BSD-3-Clause"
] | null | null | null | src/MulleTextLayer+Selection.h | mulle-kybernetik-tv/MulleUI | 95406324abdb71c973dbec2816f0f0f9e1a80949 | [
"BSD-3-Clause"
] | null | null | null | //
// Copyright (c) 2020 Nat!, Mulle kybernetiK
//
// prefer a local MulleTextLayer over one in import.h
#ifdef __has_include
# if __has_include( "MulleTextLayer.h")
# import "MulleTextLayer.h"
# endif
#endif
// we want "import.h" always anyway
#import "import.h"
/*
* Selection is a NSRange in the cString. The selection does not
* interpret UTF8 characters. The ranges must be set correctly
* already.
*/
@interface MulleTextLayer( Selection)
- (void) drawSelectionWithNVGContext:(NVGcontext *) vg
textRange:(NSRange) textRange
row:(NSUInteger) i;
- (void) startSelectionAtPoint:(CGPoint) point;
- (void) adjustSelectionToPoint:(CGPoint) point;
@end
| 24.1 | 64 | 0.677732 |
cd60e54dcf05424513e2991ed543283b00387ea7 | 1,844 | h | C | flight-vehicle/drivers/Algorithm/Algorithm_math/Algorithm_math.h | K-G-1/TM4C123GXL | 6c867a20c50b6ceda8e894d1139b81886ba3302d | [
"MIT"
] | null | null | null | flight-vehicle/drivers/Algorithm/Algorithm_math/Algorithm_math.h | K-G-1/TM4C123GXL | 6c867a20c50b6ceda8e894d1139b81886ba3302d | [
"MIT"
] | null | null | null | flight-vehicle/drivers/Algorithm/Algorithm_math/Algorithm_math.h | K-G-1/TM4C123GXL | 6c867a20c50b6ceda8e894d1139b81886ba3302d | [
"MIT"
] | null | null | null | #ifndef __Algorithm_math_H
#define __Algorithm_math_H
#include <stdint.h>
#define __I volatile /*!< defines 'read only' permissions */
#define __O volatile /*!< defines 'write only' permissions */
#define __IO volatile /*!< defines 'read / write' permissions */
typedef int32_t s32;
typedef int16_t s16;
typedef int8_t s8;
typedef const int32_t sc32; /*!< Read Only */
typedef const int16_t sc16; /*!< Read Only */
typedef const int8_t sc8; /*!< Read Only */
typedef __IO int32_t vs32;
typedef __IO int16_t vs16;
typedef __IO int8_t vs8;
typedef __I int32_t vsc32; /*!< Read Only */
typedef __I int16_t vsc16; /*!< Read Only */
typedef __I int8_t vsc8; /*!< Read Only */
typedef uint32_t u32;
typedef uint16_t u16;
typedef uint8_t u8;
typedef const uint32_t uc32; /*!< Read Only */
typedef const uint16_t uc16; /*!< Read Only */
typedef const uint8_t uc8; /*!< Read Only */
typedef __IO uint32_t vu32;
typedef __IO uint16_t vu16;
typedef __IO uint8_t vu8;
typedef __I uint32_t vuc32; /*!< Read Only */
typedef __I uint16_t vuc16; /*!< Read Only */
typedef __I uint8_t vuc8; /*!< Read Only */
#define M_PI (float)3.1415926535
#define squa( Sq ) (((float)Sq)*((float)Sq))
#define toRad( Math_D ) ((float)(Math_D)*0.0174532925f)
#define toDeg( Math_R ) ((float)(Math_R)*57.2957795f)
#define absu16( Math_X ) (Math_X<0? -Math_X:Math_X)
#define absFloat( Math_X )(Math_X<0? -Math_X:Math_X)
int16_t int_ABS(int x);
float COS(float x);
float SIN(float y);
float Q_rsqrt(float number);
float VariableParameter(float error);
void array_assign(s16 *array,s16 value);
void array_astrict(s16 *array,s16 lower,s16 upper);
void data_limit(float data,float toplimit,float lowerlimit);
#endif /* __Algorithm_math_H */
| 30.733333 | 90 | 0.67462 |
fad36b5486ba9b1482ec65e88136ebfd57d136e8 | 1,281 | h | C | PrivateFrameworks/CommerceKit/CKDialogContext.h | phatblat/macOSPrivateFrameworks | 9047371eb80f925642c8a7c4f1e00095aec66044 | [
"MIT"
] | 17 | 2018-11-13T04:02:58.000Z | 2022-01-20T09:27:13.000Z | PrivateFrameworks/CommerceKit/CKDialogContext.h | phatblat/macOSPrivateFrameworks | 9047371eb80f925642c8a7c4f1e00095aec66044 | [
"MIT"
] | 3 | 2018-04-06T02:02:27.000Z | 2018-10-02T01:12:10.000Z | PrivateFrameworks/CommerceKit/CKDialogContext.h | phatblat/macOSPrivateFrameworks | 9047371eb80f925642c8a7c4f1e00095aec66044 | [
"MIT"
] | 1 | 2018-09-28T13:54:23.000Z | 2018-09-28T13:54:23.000Z | //
// Generated by class-dump 3.5 (64 bit).
//
// class-dump is Copyright (C) 1997-1998, 2000-2001, 2004-2013 by Steve Nygard.
//
#import "NSObject.h"
#import "AMSRequestPresentationDelegate.h"
#import "NSCopying.h"
@class NSImage, NSString, NSURL, NSWindow;
@interface CKDialogContext : NSObject <NSCopying, AMSRequestPresentationDelegate>
{
int _proxyPID;
NSURL *_proxyBundleURL;
NSWindow *_hostWindow;
NSImage *_icon;
}
@property(retain) NSImage *icon; // @synthesize icon=_icon;
@property __weak NSWindow *hostWindow; // @synthesize hostWindow=_hostWindow;
- (void).cxx_destruct;
- (id)_viewController;
- (void)handleDialogRequest:(id)arg1 completion:(CDUnknownBlockType)arg2;
- (void)handleAuthenticateRequest:(id)arg1 completion:(CDUnknownBlockType)arg2;
- (id)copyWithZone:(struct _NSZone *)arg1;
- (BOOL)_clickedButtonForModalResponse:(long long)arg1;
- (id)_alertForDialog:(id)arg1;
- (void)displayDialog:(id)arg1 withCompletionHandler:(CDUnknownBlockType)arg2;
@property(copy) NSURL *proxyBundleURL;
@property int proxyPID;
// Remaining properties
@property(readonly, copy) NSString *debugDescription;
@property(readonly, copy) NSString *description;
@property(readonly) unsigned long long hash;
@property(readonly) Class superclass;
@end
| 29.790698 | 83 | 0.761905 |
280e5ad35e9673559b42c266cf53307b48b0cbd5 | 9,116 | h | C | Oem/DWFTK/develop/global/src/dwf/presentation/ContentPresentationView.h | achilex/MgDev | f7baf680a88d37659af32ee72b9a2046910b00d8 | [
"PHP-3.0"
] | 2 | 2017-04-19T01:38:30.000Z | 2020-07-31T03:05:32.000Z | Oem/DWFTK/develop/global/src/dwf/presentation/ContentPresentationView.h | achilex/MgDev | f7baf680a88d37659af32ee72b9a2046910b00d8 | [
"PHP-3.0"
] | null | null | null | Oem/DWFTK/develop/global/src/dwf/presentation/ContentPresentationView.h | achilex/MgDev | f7baf680a88d37659af32ee72b9a2046910b00d8 | [
"PHP-3.0"
] | 1 | 2021-12-29T10:46:12.000Z | 2021-12-29T10:46:12.000Z | //
// Copyright (c) 2006 by Autodesk, Inc.
//
// By using this code, you are agreeing to the terms and conditions of
// the License Agreement included in the documentation for this code.
//
// AUTODESK MAKES NO WARRANTIES, EXPRESS OR IMPLIED, AS TO THE CORRECTNESS
// OF THIS CODE OR ANY DERIVATIVE WORKS WHICH INCORPORATE IT. AUTODESK
// PROVIDES THE CODE ON AN "AS-IS" BASIS AND EXPLICITLY DISCLAIMS ANY
// LIABILITY, INCLUDING CONSEQUENTIAL AND INCIDENTAL DAMAGES FOR ERRORS,
// OMISSIONS, AND OTHER PROBLEMS IN THE CODE.
//
// Use, duplication, or disclosure by the U.S. Government is subject to
// restrictions set forth in FAR 52.227-19 (Commercial Computer Software
// Restricted Rights) and DFAR 252.227-7013(c)(1)(ii) (Rights in Technical
// Data and Computer Software), as applicable.
//
// $Header: //DWF/Development/Components/Internal/DWF Toolkit/v7.7/develop/global/src/dwf/presentation/ContentPresentationView.h#1 $
// $DateTime: 2011/02/14 01:16:30 $
// $Author: caos $
// $Change: 197964 $
#ifndef _DWFTK_CONTENT_PRESENTATION_VIEW_H
#define _DWFTK_CONTENT_PRESENTATION_VIEW_H
///
///\file dwf/presentation/ContentPresentationView.h
///\brief This file contains the DWFPresentationView class declaration.
///
#include "dwfcore/STL.h"
#include "dwfcore/DWFXMLSerializer.h"
#include "dwfcore/Vector.h"
using namespace DWFCore;
#include "dwf/Toolkit.h"
#include "dwf/presentation/ContentPresentationNode.h"
#include "dwf/presentation/utility/PropertyReferenceContainer.h"
#include "dwf/presentation/utility/ContentPresentationNodeContainer.h"
namespace DWFToolkit
{
//
// fwd declarations
//
class DWFContentPresentationViewContainer;
///
///\ingroup dwfpresentation
///
///\class DWFContentPresentationView dwf/package/ContentPresentationView.h "dwf/package/ContentPresentationView.h"
///\brief The DWFContentPresentationView class supports alternate views of a presentation.
///\since 7.2
///
/// The DWFContentPresentationView class supports alternate views of a presentation.
///
class DWFContentPresentationView : public DWFPropertyReferenceContainer
, public DWFContentPresentationNodeContainer
, public DWFXMLBuildable
#ifndef DWFTK_READ_ONLY
, public DWFXMLSerializable
#endif
_DWFTK_EXPORT_API_MEMORY_CONTROL_BASE_MEMBER
{
friend class DWFContentPresentationViewContainer;
public:
///
///\brief This type defines a list of DWFContentPresentationView pointers.
///
typedef DWFOrderedVector<DWFContentPresentationView*> tList;
///
///\brief This type defines a mapped collection of DWFContentPresentationView pointers.
///
typedef DWFStringKeySkipList<DWFContentPresentationView*> tMap;
public:
///
/// Constructor
///
///\param zID An optional identifier used when referencing this view.
///\param zLabel An optional user-friendly label for this view.
///\throw None
///
_DWFTK_API
DWFContentPresentationView( const DWFString& zLabel = /*NOXLATE*/L"",
const DWFString& zID = /*NOXLATE*/L"" )
throw();
///
/// Destructor
///
///
///\throw None
///
_DWFTK_API
virtual ~DWFContentPresentationView()
throw();
///
/// Sets an id for this view.
///
///\param zID A string that specifies the id.
///\throw DWFException
///
_DWFTK_API
virtual void setID( const DWFString& zID )
throw( DWFException );
///
/// Returns the ID for this view.
/// If no label has been set, returns the null string.
///
///\return The label for this view
///\throw None
///
_DWFTK_API
virtual const DWFString& id() const
throw();
///
/// Sets a user-friendly label for this view.
///
///\param zLabel A string that specifies the label.
///\throw None
///
_DWFTK_API
virtual void setLabel( const DWFString& zLabel )
throw();
///
/// Returns the label for this view
/// If no label has been set, returns the null string
///
///\return The label for this view
///\throw None
///
_DWFTK_API
virtual const DWFString& label() const
throw();
///
/// Sets a property set id to be used to scope property references in this view.
///
///\param zPropertySetID The property set id.
///\param bUseDefaultIfNotFound If \e true and the property referred to in a property reference
/// is missing, the content element will be queried for the property
/// directly.
///\throw None
///
_DWFTK_API
virtual void setPropertySetID( const DWFString& zPropertySetID,
bool bUseDefaultIfNotFound = true )
throw( DWFException );
///
/// Returns the property set id to be used to scope property references in this view.
///
///\return The property set id.
///\throw None
///
_DWFTK_API
virtual const DWFString& propertySetID() const
throw();
///
/// Sets a property schema id to be used to scope property references in this view
///
///\param zPropertySchemaID The property schema id.
///\param bUseDefaultIfNotFound If \e true and the property referred to in a property reference
/// is missing, the content element will be queried for the property.
///\throw None
///
_DWFTK_API
virtual void setPropertySchemaID( const DWFString& zPropertySchemaID,
bool bUseDefaultIfNotFound = false )
throw( DWFException );
///
/// Returns the schema id of the property set to be used to scope property references in this view.
///
///\return The schema id of the property set.
///\throw None
///
_DWFTK_API
virtual const DWFString& propertySchemaID() const
throw();
///
/// Returns whether the default property must be used if it does
/// not exist in the specified set.
///
///\return If \e true and the property referred to in a property reference
/// is missing, the content element will be queried for the property.
///\throw None
///
_DWFTK_API
virtual bool useDefaultPropertyIfNotFoundInSet() const
throw()
{
return _bUseDefaultIfNotFound;
}
///
/// Specifies whether this view is hidden or not.
///
///\param bHidden If \e true, this view will be marked as hidden.
///\throw None
///
_DWFTK_API
virtual void setHidden( bool bHidden )
throw()
{
_bHidden = bHidden;
}
///
/// Returns whether this view is hidden or not.
///
///\return Returns whether this view is hidden or not.
///\throw None
///
_DWFTK_API
virtual bool hidden() const
throw()
{
return _bHidden;
}
///
/// Returns the parent of this view - the container which holds it.
///
///\return The parent, or NULL if one has not yet been set.
///\throw None
///
_DWFTK_API
virtual DWFContentPresentationViewContainer* parent() const
throw()
{
return _pParent;
}
///
///\copydoc DWFCore::DWFXMLBuildable::parseAttributeList()
///
_DWFTK_API
virtual void parseAttributeList( const char** ppAttributeList )
throw( DWFException );
#ifndef DWFTK_READ_ONLY
///
///\copydoc DWFXMLSerializable::serializeXML()
///
_DWFTK_API
virtual void serializeXML( DWFXMLSerializer& rSerializer, unsigned int nFlags )
throw( DWFException );
#endif
private:
DWFContentPresentationView( const DWFContentPresentationView& );
DWFContentPresentationView& operator=( const DWFContentPresentationView& );
void setParent( DWFContentPresentationViewContainer* pParent )
{
_pParent = pParent;
}
private:
DWFString _zID;
DWFString _zLabel;
DWFString _zPropertySetID;
DWFString _zPropertySchemaID;
bool _bUseDefaultIfNotFound;
bool _bHidden;
DWFContentPresentationViewContainer* _pParent;
};
}
#endif
| 31.434483 | 134 | 0.589184 |
ff46c0174c4a1f04792cfb9af8b19c9c716e6421 | 519 | h | C | ChartDemo/ChartDemo/Controller/Chart/CoreplotChart_Default/CPTScatterPlotViewController.h | dvlproad/CJChart | a13b02d939bc696d9cf3c766304047dfe9f9e1ae | [
"MIT"
] | null | null | null | ChartDemo/ChartDemo/Controller/Chart/CoreplotChart_Default/CPTScatterPlotViewController.h | dvlproad/CJChart | a13b02d939bc696d9cf3c766304047dfe9f9e1ae | [
"MIT"
] | null | null | null | ChartDemo/ChartDemo/Controller/Chart/CoreplotChart_Default/CPTScatterPlotViewController.h | dvlproad/CJChart | a13b02d939bc696d9cf3c766304047dfe9f9e1ae | [
"MIT"
] | null | null | null | //
// CPTScatterPlotViewController.h
// Lee
//
// Created by lichq on 14-11-19.
// Copyright (c) 2014年 lichq. All rights reserved.
//
#import <UIKit/UIKit.h>
#import "CorePlot-CocoaTouch.h"
@interface CPTScatterPlotViewController : UIViewController<CPTPlotDataSource, CPTAxisDelegate>{
}
@property (nonatomic, strong) IBOutlet CPTGraphHostingView *graphHostingView;
@property (nonatomic, readwrite, strong) CPTXYGraph *lineGraph;
@property (nonatomic, readwrite, strong) NSMutableArray *dataForPlot;
@end
| 23.590909 | 95 | 0.761079 |
7faa5436452757debfe1abc7746c50f8dc16fda9 | 46,659 | h | C | src/modules/RF69/RF69.h | marcinczeczko/RadioLib | 1bceb90d42dbc5e326783a0ae495fd4388536565 | [
"MIT"
] | 1 | 2022-03-25T03:15:40.000Z | 2022-03-25T03:15:40.000Z | src/modules/RF69/RF69.h | marcinczeczko/RadioLib | 1bceb90d42dbc5e326783a0ae495fd4388536565 | [
"MIT"
] | null | null | null | src/modules/RF69/RF69.h | marcinczeczko/RadioLib | 1bceb90d42dbc5e326783a0ae495fd4388536565 | [
"MIT"
] | null | null | null | #if !defined(_RADIOLIB_RF69_H)
#define _RADIOLIB_RF69_H
#include "../../TypeDef.h"
#if !defined(RADIOLIB_EXCLUDE_RF69)
#include "../../Module.h"
#include "../../protocols/PhysicalLayer/PhysicalLayer.h"
// RF69 physical layer properties
#define RF69_FREQUENCY_STEP_SIZE 61.03515625
#define RF69_MAX_PACKET_LENGTH 64
#define RF69_CRYSTAL_FREQ 32.0
#define RF69_DIV_EXPONENT 19
// RF69 register map
#define RF69_REG_FIFO 0x00
#define RF69_REG_OP_MODE 0x01
#define RF69_REG_DATA_MODUL 0x02
#define RF69_REG_BITRATE_MSB 0x03
#define RF69_REG_BITRATE_LSB 0x04
#define RF69_REG_FDEV_MSB 0x05
#define RF69_REG_FDEV_LSB 0x06
#define RF69_REG_FRF_MSB 0x07
#define RF69_REG_FRF_MID 0x08
#define RF69_REG_FRF_LSB 0x09
#define RF69_REG_OSC_1 0x0A
#define RF69_REG_AFC_CTRL 0x0B
#define RF69_REG_LISTEN_1 0x0D
#define RF69_REG_LISTEN_2 0x0E
#define RF69_REG_LISTEN_3 0x0F
#define RF69_REG_VERSION 0x10
#define RF69_REG_PA_LEVEL 0x11
#define RF69_REG_PA_RAMP 0x12
#define RF69_REG_OCP 0x13
#define RF69_REG_LNA 0x18
#define RF69_REG_RX_BW 0x19
#define RF69_REG_AFC_BW 0x1A
#define RF69_REG_OOK_PEAK 0x1B
#define RF69_REG_OOK_AVG 0x1C
#define RF69_REG_OOK_FIX 0x1D
#define RF69_REG_AFC_FEI 0x1E
#define RF69_REG_AFC_MSB 0x1F
#define RF69_REG_AFC_LSB 0x20
#define RF69_REG_FEI_MSB 0x21
#define RF69_REG_FEI_LSB 0x22
#define RF69_REG_RSSI_CONFIG 0x23
#define RF69_REG_RSSI_VALUE 0x24
#define RF69_REG_DIO_MAPPING_1 0x25
#define RF69_REG_DIO_MAPPING_2 0x26
#define RF69_REG_IRQ_FLAGS_1 0x27
#define RF69_REG_IRQ_FLAGS_2 0x28
#define RF69_REG_RSSI_THRESH 0x29
#define RF69_REG_RX_TIMEOUT_1 0x2A
#define RF69_REG_RX_TIMEOUT_2 0x2B
#define RF69_REG_PREAMBLE_MSB 0x2C
#define RF69_REG_PREAMBLE_LSB 0x2D
#define RF69_REG_SYNC_CONFIG 0x2E
#define RF69_REG_SYNC_VALUE_1 0x2F
#define RF69_REG_SYNC_VALUE_2 0x30
#define RF69_REG_SYNC_VALUE_3 0x31
#define RF69_REG_SYNC_VALUE_4 0x32
#define RF69_REG_SYNC_VALUE_5 0x33
#define RF69_REG_SYNC_VALUE_6 0x34
#define RF69_REG_SYNC_VALUE_7 0x35
#define RF69_REG_SYNC_VALUE_8 0x36
#define RF69_REG_PACKET_CONFIG_1 0x37
#define RF69_REG_PAYLOAD_LENGTH 0x38
#define RF69_REG_NODE_ADRS 0x39
#define RF69_REG_BROADCAST_ADRS 0x3A
#define RF69_REG_AUTO_MODES 0x3B
#define RF69_REG_FIFO_THRESH 0x3C
#define RF69_REG_PACKET_CONFIG_2 0x3D
#define RF69_REG_AES_KEY_1 0x3E
#define RF69_REG_AES_KEY_2 0x3F
#define RF69_REG_AES_KEY_3 0x40
#define RF69_REG_AES_KEY_4 0x41
#define RF69_REG_AES_KEY_5 0x42
#define RF69_REG_AES_KEY_6 0x43
#define RF69_REG_AES_KEY_7 0x44
#define RF69_REG_AES_KEY_8 0x45
#define RF69_REG_AES_KEY_9 0x46
#define RF69_REG_AES_KEY_10 0x47
#define RF69_REG_AES_KEY_11 0x48
#define RF69_REG_AES_KEY_12 0x49
#define RF69_REG_AES_KEY_13 0x4A
#define RF69_REG_AES_KEY_14 0x4B
#define RF69_REG_AES_KEY_15 0x4C
#define RF69_REG_AES_KEY_16 0x4D
#define RF69_REG_TEMP_1 0x4E
#define RF69_REG_TEMP_2 0x4F
#define RF69_REG_TEST_PA1 0x5A
#define RF69_REG_TEST_PA2 0x5C
#define RF69_REG_TEST_DAGC 0x6F
// RF69 modem settings
// RF69_REG_OP_MODE MSB LSB DESCRIPTION
#define RF69_SEQUENCER_OFF 0b00000000 // 7 7 disable automatic sequencer
#define RF69_SEQUENCER_ON 0b10000000 // 7 7 enable automatic sequencer
#define RF69_LISTEN_OFF 0b00000000 // 6 6 disable Listen mode
#define RF69_LISTEN_ON 0b01000000 // 6 6 enable Listen mode
#define RF69_LISTEN_ABORT 0b00100000 // 5 5 abort Listen mode (has to be set together with RF69_LISTEN_OFF)
#define RF69_SLEEP 0b00000000 // 4 2 sleep
#define RF69_STANDBY 0b00000100 // 4 2 standby
#define RF69_FS 0b00001000 // 4 2 frequency synthesis
#define RF69_TX 0b00001100 // 4 2 transmit
#define RF69_RX 0b00010000 // 4 2 receive
// RF69_REG_DATA_MODUL
#define RF69_PACKET_MODE 0b00000000 // 6 5 packet mode (default)
#define RF69_CONTINUOUS_MODE_WITH_SYNC 0b01000000 // 6 5 continuous mode with bit synchronizer
#define RF69_CONTINUOUS_MODE 0b01100000 // 6 5 continuous mode without bit synchronizer
#define RF69_FSK 0b00000000 // 4 3 modulation: FSK (default)
#define RF69_OOK 0b00001000 // 4 3 OOK
#define RF69_NO_SHAPING 0b00000000 // 1 0 modulation shaping: no shaping (default)
#define RF69_FSK_GAUSSIAN_1_0 0b00000001 // 1 0 FSK modulation Gaussian filter, BT = 1.0
#define RF69_FSK_GAUSSIAN_0_5 0b00000010 // 1 0 FSK modulation Gaussian filter, BT = 0.5
#define RF69_FSK_GAUSSIAN_0_3 0b00000011 // 1 0 FSK modulation Gaussian filter, BT = 0.3
#define RF69_OOK_FILTER_BR 0b00000001 // 1 0 OOK modulation filter, f_cutoff = BR
#define RF69_OOK_FILTER_2BR 0b00000010 // 1 0 OOK modulation filter, f_cutoff = 2*BR
// RF69_REG_BITRATE_MSB + REG_BITRATE_LSB
#define RF69_BITRATE_MSB 0x1A // 7 0 bit rate setting: rate = F(XOSC) / BITRATE
#define RF69_BITRATE_LSB 0x0B // 7 0 default value: 4.8 kbps 0x40 // 7 0
// RF69_REG_FDEV_MSB + REG_FDEV_LSB
#define RF69_FDEV_MSB 0x00 // 5 0 frequency deviation: f_dev = f_step * FDEV
#define RF69_FDEV_LSB 0x52 // 7 0 default value: 5 kHz
// RF69_REG_FRF_MSB + REG_FRF_MID + REG_FRF_LSB
#define RF69_FRF_MSB 0xE4 // 7 0 carrier frequency setting: f_RF = (F(XOSC) * FRF)/2^19
#define RF69_FRF_MID 0xC0 // 7 0 where F(XOSC) = 32 MHz
#define RF69_FRF_LSB 0x00 // 7 0 default value: 915 MHz
// RF69_REG_OSC_1
#define RF69_RC_CAL_START 0b10000000 // 7 7 force RC oscillator calibration
#define RF69_RC_CAL_RUNNING 0b00000000 // 6 6 RC oscillator calibration is still running
#define RF69_RC_CAL_DONE 0b00000000 // 5 5 RC oscillator calibration has finished
// RF69_REG_AFC_CTRL
#define RF69_AFC_LOW_BETA_OFF 0b00000000 // 5 5 standard AFC routine
#define RF69_AFC_LOW_BETA_ON 0b00100000 // 5 5 improved AFC routine for signals with modulation index less than 2
// RF69_REG_LISTEN_1
#define RF69_LISTEN_RES_IDLE_64_US 0b01000000 // 7 6 resolution of Listen mode idle time: 64 us
#define RF69_LISTEN_RES_IDLE_4_1_MS 0b10000000 // 7 6 4.1 ms (default)
#define RF69_LISTEN_RES_IDLE_262_MS 0b11000000 // 7 6 262 ms
#define RF69_LISTEN_RES_RX_64_US 0b00010000 // 5 4 resolution of Listen mode rx time: 64 us (default)
#define RF69_LISTEN_RES_RX_4_1_MS 0b00100000 // 5 4 4.1 ms
#define RF69_LISTEN_RES_RX_262_MS 0b00110000 // 5 4 262 ms
#define RF69_LISTEN_ACCEPT_ABOVE_RSSI_THRESH 0b00000000 // 3 3 packet acceptance criteria: RSSI above threshold
#define RF69_LISTEN_ACCEPT_MATCH_SYNC_ADDRESS 0b00001000 // 3 3 RSSI above threshold AND sync address matched
#define RF69_LISTEN_END_KEEP_RX 0b00000000 // 2 1 action after packet acceptance: stay in Rx mode
#define RF69_LISTEN_END_KEEP_RX_TIMEOUT 0b00000010 // 2 1 stay in Rx mode until timeout (default)
#define RF69_LISTEN_END_KEEP_RX_TIMEOUT_RESUME 0b00000100 // 2 1 stay in Rx mode until timeout, Listen mode will resume
// RF69_REG_LISTEN_2
#define RF69_LISTEN_COEF_IDLE 0xF5 // 7 0 duration of idle phase in Listen mode
// RF69_REG_LISTEN_3
#define RF69_LISTEN_COEF_RX 0x20 // 7 0 duration of Rx phase in Listen mode
// RF69_REG_VERSION
#define RF69_CHIP_VERSION 0x24 // 7 0
// RF69_REG_PA_LEVEL
#define RF69_PA0_OFF 0b00000000 // 7 7 PA0 disabled
#define RF69_PA0_ON 0b10000000 // 7 7 PA0 enabled (default)
#define RF69_PA1_OFF 0b00000000 // 6 6 PA1 disabled (default)
#define RF69_PA1_ON 0b01000000 // 6 6 PA1 enabled
#define RF69_PA2_OFF 0b00000000 // 5 5 PA2 disabled (default)
#define RF69_PA2_ON 0b00100000 // 5 5 PA2 enabled
#define RF69_OUTPUT_POWER 0b00011111 // 4 0 output power: P_out = -18 + OUTPUT_POWER
// RF69_REG_PA_RAMP
#define RF69_PA_RAMP_3_4_MS 0b00000000 // 3 0 PA ramp rise/fall time: 3.4 ms
#define RF69_PA_RAMP_2_MS 0b00000001 // 3 0 2 ms
#define RF69_PA_RAMP_1_MS 0b00000010 // 3 0 1 ms
#define RF69_PA_RAMP_500_US 0b00000011 // 3 0 500 us
#define RF69_PA_RAMP_250_US 0b00000100 // 3 0 250 us
#define RF69_PA_RAMP_125_US 0b00000101 // 3 0 125 us
#define RF69_PA_RAMP_100_US 0b00000110 // 3 0 100 us
#define RF69_PA_RAMP_62_US 0b00000111 // 3 0 62 us
#define RF69_PA_RAMP_50_US 0b00001000 // 3 0 50 us
#define RF69_PA_RAMP_40_US 0b00001001 // 3 0 40 us (default)
#define RF69_PA_RAMP_31_US 0b00001010 // 3 0 31 us
#define RF69_PA_RAMP_25_US 0b00001011 // 3 0 25 us
#define RF69_PA_RAMP_20_US 0b00001100 // 3 0 20 us
#define RF69_PA_RAMP_15_US 0b00001101 // 3 0 15 us
#define RF69_PA_RAMP_12_US 0b00001110 // 3 0 12 us
#define RF69_PA_RAMP_10_US 0b00001111 // 3 0 10 us
// RF69_REG_OCP
#define RF69_OCP_OFF 0b00000000 // 4 4 PA overload current protection disabled
#define RF69_OCP_ON 0b00010000 // 4 4 PA overload current protection enabled
#define RF69_OCP_TRIM 0b00001010 // 3 0 OCP current: I_max(OCP_TRIM = 0b1010) = 95 mA
// RF69_REG_LNA
#define RF69_LNA_Z_IN_50_OHM 0b00000000 // 7 7 LNA input impedance: 50 ohm
#define RF69_LNA_Z_IN_200_OHM 0b10000000 // 7 7 200 ohm
#define RF69_LNA_CURRENT_GAIN 0b00001000 // 5 3 manually set LNA current gain
#define RF69_LNA_GAIN_AUTO 0b00000000 // 2 0 LNA gain setting: set automatically by AGC
#define RF69_LNA_GAIN_MAX 0b00000001 // 2 0 max gain
#define RF69_LNA_GAIN_MAX_6_DB 0b00000010 // 2 0 max gain - 6 dB
#define RF69_LNA_GAIN_MAX_12_DB 0b00000011 // 2 0 max gain - 12 dB
#define RF69_LNA_GAIN_MAX_24_DB 0b00000100 // 2 0 max gain - 24 dB
#define RF69_LNA_GAIN_MAX_36_DB 0b00000101 // 2 0 max gain - 36 dB
#define RF69_LNA_GAIN_MAX_48_DB 0b00000110 // 2 0 max gain - 48 dB
// RF69_REG_RX_BW
#define RF69_DCC_FREQ 0b01000000 // 7 5 DC offset canceller cutoff frequency (4% Rx BW by default)
#define RF69_RX_BW_MANT_16 0b00000000 // 4 3 Channel filter bandwidth FSK: RxBw = F(XOSC)/(RxBwMant * 2^(RxBwExp + 2))
#define RF69_RX_BW_MANT_20 0b00001000 // 4 3 OOK: RxBw = F(XOSC)/(RxBwMant * 2^(RxBwExp + 3))
#define RF69_RX_BW_MANT_24 0b00010000 // 4 3
#define RF69_RX_BW_EXP 0b00000101 // 2 0 default RxBwExp value = 5
// RF69_REG_AFC_BW
#define RF69_DCC_FREQ_AFC 0b10000000 // 7 5 default DccFreq parameter for AFC
#define RF69_DCC_RX_BW_MANT_AFC 0b00001000 // 4 3 default RxBwMant parameter for AFC
#define RF69_DCC_RX_BW_EXP_AFC 0b00000011 // 2 0 default RxBwExp parameter for AFC
// RF69_REG_OOK_PEAK
#define RF69_OOK_THRESH_FIXED 0b00000000 // 7 6 OOK threshold type: fixed
#define RF69_OOK_THRESH_PEAK 0b01000000 // 7 6 peak (default)
#define RF69_OOK_THRESH_AVERAGE 0b10000000 // 7 6 average
#define RF69_OOK_PEAK_THRESH_STEP_0_5_DB 0b00000000 // 5 3 OOK demodulator step size: 0.5 dB (default)
#define RF69_OOK_PEAK_THRESH_STEP_1_0_DB 0b00001000 // 5 3 1.0 dB
#define RF69_OOK_PEAK_THRESH_STEP_1_5_DB 0b00010000 // 5 3 1.5 dB
#define RF69_OOK_PEAK_THRESH_STEP_2_0_DB 0b00011000 // 5 3 2.0 dB
#define RF69_OOK_PEAK_THRESH_STEP_3_0_DB 0b00100000 // 5 3 3.0 dB
#define RF69_OOK_PEAK_THRESH_STEP_4_0_DB 0b00101000 // 5 3 4.0 dB
#define RF69_OOK_PEAK_THRESH_STEP_5_0_DB 0b00110000 // 5 3 5.0 dB
#define RF69_OOK_PEAK_THRESH_STEP_6_0_DB 0b00111000 // 5 3 6.0 dB
#define RF69_OOK_PEAK_THRESH_DEC_1_1_CHIP 0b00000000 // 2 0 OOK demodulator step period: once per chip (default)
#define RF69_OOK_PEAK_THRESH_DEC_1_2_CHIP 0b00000001 // 2 0 once every 2 chips
#define RF69_OOK_PEAK_THRESH_DEC_1_4_CHIP 0b00000010 // 2 0 once every 4 chips
#define RF69_OOK_PEAK_THRESH_DEC_1_8_CHIP 0b00000011 // 2 0 once every 8 chips
#define RF69_OOK_PEAK_THRESH_DEC_2_1_CHIP 0b00000100 // 2 0 2 times per chip
#define RF69_OOK_PEAK_THRESH_DEC_4_1_CHIP 0b00000101 // 2 0 4 times per chip
#define RF69_OOK_PEAK_THRESH_DEC_8_1_CHIP 0b00000110 // 2 0 8 times per chip
#define RF69_OOK_PEAK_THRESH_DEC_16_1_CHIP 0b00000111 // 2 0 16 times per chip
// RF69_REG_OOK_AVG
#define RF69_OOK_AVG_THRESH_FILT_32_PI 0b00000000 // 7 6 OOK average filter coefficient: chip rate / 32*pi
#define RF69_OOK_AVG_THRESH_FILT_8_PI 0b01000000 // 7 6 chip rate / 8*pi
#define RF69_OOK_AVG_THRESH_FILT_4_PI 0b10000000 // 7 6 chip rate / 4*pi (default)
#define RF69_OOK_AVG_THRESH_FILT_2_PI 0b11000000 // 7 6 chip rate / 2*pi
// RF69_REG_OOK_FIX
#define RF69_OOK_FIXED_THRESH 0b00000110 // 7 0 default OOK fixed threshold (6 dB)
// RF69_REG_AFC_FEI
#define RF69_FEI_RUNNING 0b00000000 // 6 6 FEI status: on-going
#define RF69_FEI_DONE 0b01000000 // 6 6 done
#define RF69_FEI_START 0b00100000 // 5 5 force new FEI measurement
#define RF69_AFC_RUNNING 0b00000000 // 4 4 AFC status: on-going
#define RF69_AFC_DONE 0b00010000 // 4 4 done
#define RF69_AFC_AUTOCLEAR_OFF 0b00000000 // 3 3 AFC register autoclear disabled
#define RF69_AFC_AUTOCLEAR_ON 0b00001000 // 3 3 AFC register autoclear enabled
#define RF69_AFC_AUTO_OFF 0b00000000 // 2 2 perform AFC only manually
#define RF69_AFC_AUTO_ON 0b00000100 // 2 2 perform AFC each time Rx mode is started
#define RF69_AFC_CLEAR 0b00000010 // 1 1 clear AFC register
#define RF69_AFC_START 0b00000001 // 0 0 start AFC
// RF69_REG_RSSI_CONFIG
#define RF69_RSSI_RUNNING 0b00000000 // 1 1 RSSI status: on-going
#define RF69_RSSI_DONE 0b00000010 // 1 1 done
#define RF69_RSSI_START 0b00000001 // 0 0 start RSSI measurement
// RF69_REG_DIO_MAPPING_1
#define RF69_DIO0_CONT_MODE_READY 0b11000000 // 7 6
#define RF69_DIO0_CONT_PLL_LOCK 0b00000000 // 7 6
#define RF69_DIO0_CONT_SYNC_ADDRESS 0b00000000 // 7 6
#define RF69_DIO0_CONT_TIMEOUT 0b01000000 // 7 6
#define RF69_DIO0_CONT_RSSI 0b10000000 // 7 6
#define RF69_DIO0_CONT_TX_READY 0b01000000 // 7 6
#define RF69_DIO0_PACK_PLL_LOCK 0b11000000 // 7 6
#define RF69_DIO0_PACK_CRC_OK 0b00000000 // 7 6
#define RF69_DIO0_PACK_PAYLOAD_READY 0b01000000 // 7 6
#define RF69_DIO0_PACK_SYNC_ADDRESS 0b10000000 // 7 6
#define RF69_DIO0_PACK_RSSI 0b11000000 // 7 6
#define RF69_DIO0_PACK_PACKET_SENT 0b00000000 // 7 6
#define RF69_DIO0_PACK_TX_READY 0b01000000 // 7 6
#define RF69_DIO1_CONT_PLL_LOCK 0b00110000 // 5 4
#define RF69_DIO1_CONT_DCLK 0b00000000 // 5 4
#define RF69_DIO1_CONT_RX_READY 0b00010000 // 5 4
#define RF69_DIO1_CONT_SYNC_ADDRESS 0b00110000 // 5 4
#define RF69_DIO1_CONT_TX_READY 0b00010000 // 5 4
#define RF69_DIO1_PACK_FIFO_LEVEL 0b00000000 // 5 4
#define RF69_DIO1_PACK_FIFO_FULL 0b00010000 // 5 4
#define RF69_DIO1_PACK_FIFO_NOT_EMPTY 0b00100000 // 5 4
#define RF69_DIO1_PACK_PLL_LOCK 0b00110000 // 5 4
#define RF69_DIO1_PACK_TIMEOUT 0b00110000 // 5 4
#define RF69_DIO2_CONT_DATA 0b00000000 // 3 2
// RF69_REG_DIO_MAPPING_2
#define RF69_CLK_OUT_FXOSC 0b00000000 // 2 0 ClkOut frequency: F(XOSC)
#define RF69_CLK_OUT_FXOSC_2 0b00000001 // 2 0 F(XOSC) / 2
#define RF69_CLK_OUT_FXOSC_4 0b00000010 // 2 0 F(XOSC) / 4
#define RF69_CLK_OUT_FXOSC_8 0b00000011 // 2 0 F(XOSC) / 8
#define RF69_CLK_OUT_FXOSC_16 0b00000100 // 2 0 F(XOSC) / 16
#define RF69_CLK_OUT_FXOSC_32 0b00000101 // 2 0 F(XOSC) / 31
#define RF69_CLK_OUT_RC 0b00000110 // 2 0 RC
#define RF69_CLK_OUT_OFF 0b00000111 // 2 0 disabled (default)
// RF69_REG_IRQ_FLAGS_1
#define RF69_IRQ_MODE_READY 0b10000000 // 7 7 requested mode was set
#define RF69_IRQ_RX_READY 0b01000000 // 6 6 Rx mode ready
#define RF69_IRQ_TX_READY 0b00100000 // 5 5 Tx mode ready
#define RF69_IRQ_PLL_LOCK 0b00010000 // 4 4 PLL is locked
#define RF69_IRQ_RSSI 0b00001000 // 3 3 RSSI value exceeded RssiThreshold
#define RF69_IRQ_TIMEOUT 0b00000100 // 2 2 timeout occurred
#define RF69_IRQ_AUTO_MODE 0b00000010 // 1 1 entered intermediate mode
#define RF69_SYNC_ADDRESS_MATCH 0b00000001 // 0 0 sync address detected
// RF69_REG_IRQ_FLAGS_2
#define RF69_IRQ_FIFO_FULL 0b10000000 // 7 7 FIFO is full
#define RF69_IRQ_FIFO_NOT_EMPTY 0b01000000 // 6 6 FIFO contains at least 1 byte
#define RF69_IRQ_FIFO_LEVEL 0b00100000 // 5 5 FIFO contains more than FifoThreshold bytes
#define RF69_IRQ_FIFO_OVERRUN 0b00010000 // 4 4 FIFO overrun occurred
#define RF69_IRQ_PACKET_SENT 0b00001000 // 3 3 packet was sent
#define RF69_IRQ_PAYLOAD_READY 0b00000100 // 2 2 last payload byte received and CRC check passed
#define RF69_IRQ_CRC_OK 0b00000010 // 1 1 CRC check passed
// RF69_REG_RSSI_THRESH
#define RF69_RSSI_THRESHOLD 0xE4 // 7 0 RSSI threshold level (2 dB by default)
// RF69_REG_RX_TIMEOUT_1
#define RF69_TIMEOUT_RX_START_OFF 0x00 // 7 0 RSSI interrupt timeout disabled (default)
#define RF69_TIMEOUT_RX_START 0xFF // 7 0 timeout will occur if RSSI interrupt is not received
// RF69_REG_RX_TIMEOUT_2
#define RF69_TIMEOUT_RSSI_THRESH_OFF 0x00 // 7 0 PayloadReady interrupt timeout disabled (default)
#define RF69_TIMEOUT_RSSI_THRESH 0xFF // 7 0 timeout will occur if PayloadReady interrupt is not received
// RF69_REG_PREAMBLE_MSB + REG_PREAMBLE_MSB
#define RF69_PREAMBLE_MSB 0x00 // 7 0 2-byte preamble size value
#define RF69_PREAMBLE_LSB 0x03 // 7 0
// RF69_REG_SYNC_CONFIG
#define RF69_SYNC_OFF 0b00000000 // 7 7 sync word detection off
#define RF69_SYNC_ON 0b10000000 // 7 7 sync word detection on (default)
#define RF69_FIFO_FILL_CONDITION_SYNC 0b00000000 // 6 6 FIFO fill condition: on SyncAddress interrupt (default)
#define RF69_FIFO_FILL_CONDITION 0b01000000 // 6 6 as long as the bit is set
#define RF69_SYNC_SIZE 0b00001000 // 5 3 size of sync word: SyncSize + 1 bytes
#define RF69_SYNC_TOL 0b00000000 // 2 0 number of tolerated errors in sync word
// RF69_REG_SYNC_VALUE_1 - SYNC_VALUE_8
#define RF69_SYNC_BYTE_1 0x01 // 7 0 sync word: 1st byte (MSB)
#define RF69_SYNC_BYTE_2 0x01 // 7 0 2nd byte
#define RF69_SYNC_BYTE_3 0x01 // 7 0 3rd byte
#define RF69_SYNC_BYTE_4 0x01 // 7 0 4th byte
#define RF69_SYNC_BYTE_5 0x01 // 7 0 5th byte
#define RF69_SYNC_BYTE_6 0x01 // 7 0 6th byte
#define RF69_SYNC_BYTE_7 0x01 // 7 0 7th byte
#define RF69_SYNC_BYTE_8 0x01 // 7 0 8th byte (LSB)
// RF69_REG_PACKET_CONFIG_1
#define RF69_PACKET_FORMAT_FIXED 0b00000000 // 7 7 fixed packet length (default)
#define RF69_PACKET_FORMAT_VARIABLE 0b10000000 // 7 7 variable packet length
#define RF69_DC_FREE_NONE 0b00000000 // 6 5 DC-free encoding: none (default)
#define RF69_DC_FREE_MANCHESTER 0b00100000 // 6 5 Manchester
#define RF69_DC_FREE_WHITENING 0b01000000 // 6 5 Whitening
#define RF69_CRC_OFF 0b00000000 // 4 4 CRC disabled
#define RF69_CRC_ON 0b00010000 // 4 4 CRC enabled (default)
#define RF69_CRC_AUTOCLEAR_ON 0b00000000 // 3 3 discard packet when CRC check fails (default)
#define RF69_CRC_AUTOCLEAR_OFF 0b00001000 // 3 3 keep packet when CRC check fails
#define RF69_ADDRESS_FILTERING_OFF 0b00000000 // 2 1 address filtering: none (default)
#define RF69_ADDRESS_FILTERING_NODE 0b00000010 // 2 1 node
#define RF69_ADDRESS_FILTERING_NODE_BROADCAST 0b00000100 // 2 1 node or broadcast
// RF69_REG_PAYLOAD_LENGTH
#define RF69_PAYLOAD_LENGTH 0xFF // 7 0 payload length
// RF69_REG_AUTO_MODES
#define RF69_ENTER_COND_NONE 0b00000000 // 7 5 condition for entering intermediate mode: none, AutoModes disabled (default)
#define RF69_ENTER_COND_FIFO_NOT_EMPTY 0b00100000 // 7 5 FifoNotEmpty rising edge
#define RF69_ENTER_COND_FIFO_LEVEL 0b01000000 // 7 5 FifoLevel rising edge
#define RF69_ENTER_COND_CRC_OK 0b01100000 // 7 5 CrcOk rising edge
#define RF69_ENTER_COND_PAYLOAD_READY 0b10000000 // 7 5 PayloadReady rising edge
#define RF69_ENTER_COND_SYNC_ADDRESS 0b10100000 // 7 5 SyncAddress rising edge
#define RF69_ENTER_COND_PACKET_SENT 0b11000000 // 7 5 PacketSent rising edge
#define RF69_ENTER_COND_FIFO_EMPTY 0b11100000 // 7 5 FifoNotEmpty falling edge
#define RF69_EXIT_COND_NONE 0b00000000 // 4 2 condition for exiting intermediate mode: none, AutoModes disabled (default)
#define RF69_EXIT_COND_FIFO_EMPTY 0b00100000 // 4 2 FifoNotEmpty falling edge
#define RF69_EXIT_COND_FIFO_LEVEL 0b01000000 // 4 2 FifoLevel rising edge
#define RF69_EXIT_COND_CRC_OK 0b01100000 // 4 2 CrcOk rising edge
#define RF69_EXIT_COND_PAYLOAD_READY 0b10000000 // 4 2 PayloadReady rising edge
#define RF69_EXIT_COND_SYNC_ADDRESS 0b10100000 // 4 2 SyncAddress rising edge
#define RF69_EXIT_COND_PACKET_SENT 0b11000000 // 4 2 PacketSent rising edge
#define RF69_EXIT_COND_TIMEOUT 0b11100000 // 4 2 timeout rising edge
#define RF69_INTER_MODE_SLEEP 0b00000000 // 1 0 intermediate mode: sleep (default)
#define RF69_INTER_MODE_STANDBY 0b00000001 // 1 0 standby
#define RF69_INTER_MODE_RX 0b00000010 // 1 0 Rx
#define RF69_INTER_MODE_TX 0b00000011 // 1 0 Tx
// RF69_REG_FIFO_THRESH
#define RF69_TX_START_CONDITION_FIFO_LEVEL 0b00000000 // 7 7 packet transmission start condition: FifoLevel
#define RF69_TX_START_CONDITION_FIFO_NOT_EMPTY 0b10000000 // 7 7 FifoNotEmpty (default)
#define RF69_FIFO_THRESHOLD 0b00001111 // 6 0 default threshold to trigger FifoLevel interrupt
// RF69_REG_PACKET_CONFIG_2
#define RF69_INTER_PACKET_RX_DELAY 0b00000000 // 7 4 delay between FIFO empty and start of new RSSI phase
#define RF69_RESTART_RX 0b00000100 // 2 2 force receiver into wait mode
#define RF69_AUTO_RX_RESTART_OFF 0b00000000 // 1 1 auto Rx restart disabled
#define RF69_AUTO_RX_RESTART_ON 0b00000010 // 1 1 auto Rx restart enabled (default)
#define RF69_AES_OFF 0b00000000 // 0 0 AES encryption disabled (default)
#define RF69_AES_ON 0b00000001 // 0 0 AES encryption enabled, payload size limited to 66 bytes
// RF69_REG_TEMP_1
#define RF69_TEMP_MEAS_START 0b00001000 // 3 3 trigger temperature measurement
#define RF69_TEMP_MEAS_RUNNING 0b00000100 // 2 2 temperature measurement status: on-going
#define RF69_TEMP_MEAS_DONE 0b00000000 // 2 2 done
// RF69_REG_TEST_DAGC
#define RF69_CONTINUOUS_DAGC_NORMAL 0x00 // 7 0 fading margin improvement: normal mode
#define RF69_CONTINUOUS_DAGC_LOW_BETA_ON 0x20 // 7 0 improved mode for AfcLowBetaOn
#define RF69_CONTINUOUS_DAGC_LOW_BETA_OFF 0x30 // 7 0 improved mode for AfcLowBetaOff (default)
// RF69_REG_TEST_PA1
#define RF69_PA1_NORMAL 0x55 // 7 0 PA_BOOST: none
#define RF69_PA1_20_DBM 0x5D // 7 0 +20 dBm
// RF69_REG_TEST_PA2
#define RF69_PA2_NORMAL 0x70 // 7 0 PA_BOOST: none
#define RF69_PA2_20_DBM 0x7C // 7 0 +20 dBm
/*!
\class RF69
\brief Control class for %RF69 module. Also serves as base class for SX1231.
*/
class RF69: public PhysicalLayer {
public:
// introduce PhysicalLayer overloads
using PhysicalLayer::transmit;
using PhysicalLayer::receive;
using PhysicalLayer::startTransmit;
using PhysicalLayer::readData;
/*!
\brief Default constructor.
\param mod Instance of Module that will be used to communicate with the radio.
*/
RF69(Module* module);
// basic methods
/*!
\brief Initialization method.
\param freq Carrier frequency in MHz. Defaults to 434.0 MHz.
\param br Bit rate to be used in kbps. Defaults to 48.0 kbps.
\param freqDev Frequency deviation from carrier frequency in kHz Defaults to 50.0 kHz.
\param rxBw Receiver bandwidth in kHz. Defaults to 125.0 kHz.
\param power Output power in dBm. Defaults to 10 dBm.
\param preambleLen Preamble Length in bits. Defaults to 16 bits.
\returns \ref status_codes
*/
int16_t begin(float freq = 434.0, float br = 48.0, float freqDev = 50.0, float rxBw = 125.0, int8_t power = 10, uint8_t preambleLen = 16);
/*!
\brief Reset method. Will reset the chip to the default state using RST pin.
*/
void reset();
/*!
\brief Blocking binary transmit method.
Overloads for string-based transmissions are implemented in PhysicalLayer.
\param data Binary data to be sent.
\param len Number of bytes to send.
\param addr Address to send the data to. Will only be added if address filtering was enabled.
\returns \ref status_codes
*/
int16_t transmit(uint8_t* data, size_t len, uint8_t addr = 0) override;
/*!
\brief Blocking binary receive method.
Overloads for string-based transmissions are implemented in PhysicalLayer.
\param data Binary data to be sent.
\param len Number of bytes to send.
\returns \ref status_codes
*/
int16_t receive(uint8_t* data, size_t len) override;
/*!
\brief Sets the module to sleep mode.
\returns \ref status_codes
*/
int16_t sleep();
/*!
\brief Sets the module to standby mode.
\returns \ref status_codes
*/
int16_t standby() override;
/*!
\brief Starts direct mode transmission.
\param frf Raw RF frequency value. Defaults to 0, required for quick frequency shifts in RTTY.
\returns \ref status_codes
*/
int16_t transmitDirect(uint32_t frf = 0) override;
/*!
\brief Starts direct mode reception.
\returns \ref status_codes
*/
int16_t receiveDirect() override;
/*!
\brief Stops direct mode. It is required to call this method to switch from direct transmissions to packet-based transmissions.
*/
int16_t packetMode();
// hardware AES support
/*!
\brief Sets AES key.
\param Key to be used for AES encryption. Must be exactly 16 bytes long.
*/
void setAESKey(uint8_t* key);
/*!
\brief Enables AES encryption.
\returns \ref status_codes
*/
int16_t enableAES();
/*!
\brief Disables AES encryption.
\returns \ref status_codes
*/
int16_t disableAES();
// interrupt methods
/*!
\brief Sets interrupt service routine to call when DIO0 activates.
\param func ISR to call.
*/
void setDio0Action(void (*func)(void));
/*!
\brief Clears interrupt service routine to call when DIO0 activates.
*/
void clearDio0Action();
/*!
\brief Sets interrupt service routine to call when DIO1 activates.
\param func ISR to call.
*/
void setDio1Action(void (*func)(void));
/*!
\brief Clears interrupt service routine to call when DIO1 activates.
*/
void clearDio1Action();
/*!
\brief Interrupt-driven binary transmit method.
Overloads for string-based transmissions are implemented in PhysicalLayer.
\param data Binary data to be sent.
\param len Number of bytes to send.
\param addr Address to send the data to. Will only be added if address filtering was enabled.
\returns \ref status_codes
*/
int16_t startTransmit(uint8_t* data, size_t len, uint8_t addr = 0) override;
/*!
\brief Interrupt-driven receive method. GDO0 will be activated when full packet is received.
\returns \ref status_codes
*/
int16_t startReceive();
/*!
\brief Reads data received after calling startReceive method.
\param data Pointer to array to save the received binary data.
\param len Number of bytes that will be received. Must be known in advance for binary transmissions.
\returns \ref status_codes
*/
int16_t readData(uint8_t* data, size_t len) override;
// configuration methods
/*!
\brief Sets carrier frequency. Allowed values are in bands 290.0 to 340.0 MHz, 431.0 to 510.0 MHz and 862.0 to 1020.0 MHz.
\param freq Carrier frequency to be set in MHz.
\returns \ref status_codes
*/
int16_t setFrequency(float freq);
/*!
\brief Sets bit rate. Allowed values range from 1.2 to 300.0 kbps.
\param br Bit rate to be set in kbps.
\returns \ref status_codes
*/
int16_t setBitRate(float br);
/*!
\brief Sets receiver bandwidth. Allowed values are 2.6, 3.1, 3.9, 5.2, 6.3, 7.8, 10.4, 12.5, 15.6, 20.8, 25.0, 31.3, 41.7, 50.0, 62.5, 83.3, 100.0, 125.0, 166.7, 200.0, 250.0, 333.3, 400.0 and 500.0 kHz.
\param rxBw Receiver bandwidth to be set in kHz.
\returns \ref status_codes
*/
int16_t setRxBandwidth(float rxBw);
/*!
\brief Sets frequency deviation.
\param freqDev Frequency deviation to be set in kHz.
\returns \ref status_codes
*/
int16_t setFrequencyDeviation(float freqDev) override;
/*!
\brief Sets output power. Allowed values range from -18 to 13 dBm for low power modules (RF69C/CW) or -2 to 20 dBm (RF69H/HC/HCW).
\param power Output power to be set in dBm.
\param highPower Set to true when using modules high power port (RF69H/HC/HCW). Defaults to false (models without high power port - RF69C/CW).
\returns \ref status_codes
*/
int16_t setOutputPower(int8_t power, bool highPower = false);
/*!
\brief Sets sync word. Up to 8 bytes can be set as sync word.
\param syncWord Pointer to the array of sync word bytes.
\param len Sync word length in bytes.
\param maxErrBits Maximum allowed number of bit errors in received sync word. Defaults to 0.
*/
int16_t setSyncWord(uint8_t* syncWord, size_t len, uint8_t maxErrBits = 0);
/*!
\brief Sets preamble length.
\param preambleLen Preamble length to be set (in bits), allowed values: 16, 24, 32, 48, 64, 96, 128 and 192.
\returns \ref status_codes
*/
int16_t setPreambleLength(uint8_t preambleLen);
/*!
\brief Sets node address. Calling this method will also enable address filtering for node address only.
\param nodeAddr Node address to be set.
\returns \ref status_codes
*/
int16_t setNodeAddress(uint8_t nodeAddr);
/*!
\brief Sets broadcast address. Calling this method will also enable address filtering for node and broadcast address.
\param broadAddr Node address to be set.
\returns \ref status_codes
*/
int16_t setBroadcastAddress(uint8_t broadAddr);
/*!
\brief Disables address filtering. Calling this method will also erase previously set addresses.
\returns \ref status_codes
*/
int16_t disableAddressFiltering();
// measurement methods
/*!
\brief Sets ambient temperature. Required to correct values from on-board temperature sensor.
\param tempAmbient Ambient temperature in degrees Celsius.
*/
void setAmbientTemperature(int16_t tempAmbient);
/*!
\brief Measures temperature.
\returns Measured temperature in degrees Celsius.
*/
int16_t getTemperature();
/*!
\brief Query modem for the packet length of received payload.
\param update Update received packet length. Will return cached value when set to false.
\returns Length of last received packet in bytes.
*/
size_t getPacketLength(bool update = true) override;
/*!
\brief Set modem in fixed packet length mode.
\param len Packet length.
\returns \ref status_codes
*/
int16_t fixedPacketLengthMode(uint8_t len = RF69_MAX_PACKET_LENGTH);
/*!
\brief Set modem in variable packet length mode.
\param len Maximum packet length.
\returns \ref status_codes
*/
int16_t variablePacketLengthMode(uint8_t maxLen = RF69_MAX_PACKET_LENGTH);
/*!
\brief Enable sync word filtering and generation.
\param numBits Sync word length in bits.
\returns \ref status_codes
*/
int16_t enableSyncWordFiltering(uint8_t maxErrBits = 0);
/*!
\brief Disable preamble and sync word filtering and generation.
\returns \ref status_codes
*/
int16_t disableSyncWordFiltering();
/*!
\brief Enable CRC filtering and generation.
\param crcOn Set or unset CRC filtering.
\returns \ref status_codes
*/
int16_t setCrcFiltering(bool crcOn = true);
/*!
\brief Set modem in "sniff" mode: no packet filtering (e.g., no preamble, sync word, address, CRC).
\param promiscuous Set or unset promiscuous mode.
\returns \ref status_codes
*/
int16_t setPromiscuousMode(bool promiscuous = true);
/*!
\brief Sets Gaussian filter bandwidth-time product that will be used for data shaping.
Allowed values are RADIOLIB_SHAPING_0_3, RADIOLIB_SHAPING_0_5 or RADIOLIB_SHAPING_1_0. Set to RADIOLIB_SHAPING_NONE to disable data shaping.
\param sh Gaussian shaping bandwidth-time product that will be used for data shaping
\returns \ref status_codes
*/
int16_t setDataShaping(uint8_t sh) override;
/*!
\brief Sets transmission encoding.
Allowed values are RADIOLIB_ENCODING_NRZ, RADIOLIB_ENCODING_MANCHESTER and RADIOLIB_ENCODING_WHITENING.
\param encoding Encoding to be used.
\returns \ref status_codes
*/
int16_t setEncoding(uint8_t encoding) override;
/*!
\brief Gets RSSI (Recorded Signal Strength Indicator) of the last received packet.
\returns Last packet RSSI in dBm.
*/
float getRSSI();
/*!
\brief Some modules contain external RF switch controlled by two pins. This function gives RadioLib control over those two pins to automatically switch Rx and Tx state.
When using automatic RF switch control, DO NOT change the pin mode of rxEn or txEn from Arduino sketch!
\param rxEn RX enable pin.
\param txEn TX enable pin.
*/
void setRfSwitchPins(RADIOLIB_PIN_TYPE rxEn, RADIOLIB_PIN_TYPE txEn);
/*!
\brief Get one truly random byte from RSSI noise.
\returns TRNG byte.
*/
uint8_t random();
/*!
\brief Read version SPI register. Should return RF69_CHIP_VERSION (0x24) if SX127x is connected and working.
\returns Version register contents or \ref status_codes
*/
int16_t getChipVersion();
#ifndef RADIOLIB_GODMODE
protected:
#endif
Module* _mod;
float _br = 0;
float _rxBw = 0;
int16_t _tempOffset = 0;
int8_t _power = 0;
size_t _packetLength = 0;
bool _packetLengthQueried = false;
uint8_t _packetLengthConfig = RF69_PACKET_FORMAT_VARIABLE;
bool _promiscuous = false;
uint8_t _syncWordLength = 2;
int16_t config();
int16_t directMode();
int16_t setPacketMode(uint8_t mode, uint8_t len);
#ifndef RADIOLIB_GODMODE
private:
#endif
int16_t setMode(uint8_t mode);
void clearIRQFlags();
};
#endif
#endif
| 53.508028 | 209 | 0.541803 |
d21d09cd18aa5c730d56608a2c79bfaf783f8568 | 54 | h | C | ObjCDesignPatterns/FactoryPatterns/AbstractFactory/Tomate.h | rbaumbach/ObjCDesignPatterns | 391c9287f4987659bcbc03761318ce78eb111d6a | [
"MIT"
] | 51 | 2015-06-21T09:41:05.000Z | 2021-11-13T17:35:50.000Z | ObjCDesignPatterns/FactoryPatterns/AbstractFactory/Tomate.h | rbaumbach/ObjCDesignPatterns | 391c9287f4987659bcbc03761318ce78eb111d6a | [
"MIT"
] | null | null | null | ObjCDesignPatterns/FactoryPatterns/AbstractFactory/Tomate.h | rbaumbach/ObjCDesignPatterns | 391c9287f4987659bcbc03761318ce78eb111d6a | [
"MIT"
] | 14 | 2015-04-28T14:01:45.000Z | 2022-02-19T14:09:45.000Z | #import "Vedura.h"
@interface Tomate : Vedura
@end
| 7.714286 | 26 | 0.685185 |
d24b4efb4331a3d1c1002439873f18890cd2e514 | 2,921 | h | C | BLEDragonBoat/BLEDragonBoat.framework/Headers/BLEDragon.h | iwown/BLEDragonBoat | 22903bda3ced2002fa017f5f211c41ae79176b5c | [
"MIT"
] | null | null | null | BLEDragonBoat/BLEDragonBoat.framework/Headers/BLEDragon.h | iwown/BLEDragonBoat | 22903bda3ced2002fa017f5f211c41ae79176b5c | [
"MIT"
] | 1 | 2019-03-18T06:56:42.000Z | 2019-03-21T06:13:09.000Z | BLEDragonBoat/BLEDragonBoat.framework/Headers/BLEDragon.h | iwown/BLEDragonBoat | 22903bda3ced2002fa017f5f211c41ae79176b5c | [
"MIT"
] | null | null | null | //
// BLEDragon.h
// DNBSolstice
//
// Created by A$CE on 2017/10/9.
// Copyright © 2017年 A$CE. All rights reserved.
//
#define BLE_MAIN_RESTORE_IDENTIFIER @"com.iwown.dragon"
#define BLE_MID_AUTUMN_PLIST @"dragonBoat" //Config file name in @"dragonBoat.plist";
#import "DNBSolstice.h"
#import "DNBQuinox.h"
#import <Foundation/Foundation.h>
/**
Core class, management search and connection, is also the entrance to the SDK.
Sample @code{self.BLEDragon = [BLEDragon dragonBoat];
self.BLEDragon.discoverDelegate = self;
self.BLEDragon.connectDelegate = self;}@endcode
*/
@interface BLEDragon : NSObject
@property (nonatomic ,weak) id<DnbDiscoverDelegate>discoverDelegate;
@property (nonatomic ,weak) id<DnbConnectDelegate>connectDelegate;
/**
Represents the current state of a CBManager. <CBManagerState> <CBCentralManagerState> used for below iOS10.
@return Return to the state of the central manager, you can determine the status of Bluetooth.
*/
- (NSInteger)readManagerPowerState;
/**
Scan device. You will get the discovered devices in the callback method of discoverDelegate @see solsticeDidDiscoverDeviceWithMAC:
@param seconds Enter a number of seconds that you want to stop searching after later
@param uuids The uuids you want to specify when searching
@param options Same with options in @method scanForPeripheralsWithServices:options:
*/
- (void)startScanForTimeInternal:(NSTimeInterval)seconds
andServiceUuids:(NSArray <NSString *>*)uuids
andOptions:(NSDictionary<NSString *, id> *)options;
/**
@see startScanForTimeInternal:andServiceUuids:andOptions:
Default options is nil.
@param seconds The uuids you want to specify when searching
@param uuids Same with options in @method scanForPeripheralsWithServices:options:
*/
- (void)startScanForTimeInternal:(NSTimeInterval)seconds
andServiceUuids:(NSArray <NSString *>*)uuids;
/**
@see startScanForTimeInternal:andServiceUuids:
Default seconds is 10, uuids is nil, The SDK will choose the correct uuids for the <BLEProtocol>.
*/
- (void)startScan;
/**
Stop scan.
The SDK calls the @see solsticeStopScan method if you have already implemented it.
*/
- (void)stopScan;
/**
Connectted only. For scenarios with short-term connections, the SDK does not implement the binding mechanism, so there is no need to reconnect. For example, body fat scale products.*/
- (void)connectDevice:(DNBBlePeripheral *)device;
/**! Cancel a connect*/
- (void)cancelConnectBy:(id<DNBSolstice>)solstice;
/**! Recover connect device by uuidString.*/
- (void)recoverConnect:(NSString *)uuidString;
/*Class Method ,use @CODE{[[BLEDragon alloc] init];}*/
+ (instancetype)dragonBoat;
/**! Init a dragon boat without backMode. Dragon instance would initinal a centralManger with a nil option paramatter. see as initWithDelegate:queue:options: */
+ (instancetype)dragonBoatWithOutBackMode;
@end
| 38.434211 | 184 | 0.757617 |
9a7153b77429463739f1a4ed047b3c5d0013db21 | 5,175 | c | C | plat/brcm/common/brcm_bl2_setup.c | Nuvoton-Israel/arm-trusted-firmware | 469101d48a1b0cb6c93ea5fe3bd3b32b46bd047e | [
"MIT"
] | 1,408 | 2015-01-26T17:15:15.000Z | 2022-03-31T12:54:11.000Z | plat/brcm/common/brcm_bl2_setup.c | Nuvoton-Israel/arm-trusted-firmware | 469101d48a1b0cb6c93ea5fe3bd3b32b46bd047e | [
"MIT"
] | 1,177 | 2015-01-07T12:55:46.000Z | 2022-01-19T10:49:12.000Z | plat/brcm/common/brcm_bl2_setup.c | Nuvoton-Israel/arm-trusted-firmware | 469101d48a1b0cb6c93ea5fe3bd3b32b46bd047e | [
"MIT"
] | 959 | 2015-01-08T09:12:45.000Z | 2022-03-28T03:07:50.000Z | /*
* Copyright (c) 2019-2020, ARM Limited and Contributors. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
#include <assert.h>
#include <string.h>
#include <arch_helpers.h>
#include <common/bl_common.h>
#include <common/debug.h>
#include <common/desc_image_load.h>
#include <drivers/arm/sp804_delay_timer.h>
#include <lib/mmio.h>
#include <bcm_console.h>
#include <platform_def.h>
#include <plat/brcm/common/plat_brcm.h>
/* Data structure which holds the extents of the trusted SRAM for BL2 */
static meminfo_t bl2_tzram_layout __aligned(CACHE_WRITEBACK_GRANULE);
/* Weak definitions may be overridden in specific BRCM platform */
#pragma weak plat_bcm_bl2_platform_setup
#pragma weak plat_bcm_bl2_plat_arch_setup
#pragma weak plat_bcm_security_setup
#pragma weak plat_bcm_bl2_plat_handle_scp_bl2
#pragma weak plat_bcm_bl2_early_platform_setup
void plat_bcm_bl2_early_platform_setup(void)
{
}
void plat_bcm_bl2_platform_setup(void)
{
}
void plat_bcm_bl2_plat_arch_setup(void)
{
}
void plat_bcm_security_setup(void)
{
}
void bcm_bl2_early_platform_setup(uintptr_t tb_fw_config,
meminfo_t *mem_layout)
{
/* Initialize the console to provide early debug support */
bcm_console_boot_init();
/* Setup the BL2 memory layout */
bl2_tzram_layout = *mem_layout;
/* Initialise the IO layer and register platform IO devices */
plat_brcm_io_setup();
/* Log HW reset event */
INFO("RESET: 0x%x\n",
mmio_read_32(CRMU_RESET_EVENT_LOG));
}
void bl2_early_platform_setup2(u_register_t arg0, u_register_t arg1,
u_register_t arg2, u_register_t arg3)
{
/* SoC specific setup */
plat_bcm_bl2_early_platform_setup();
/* Initialize delay timer driver using SP804 dual timer 0 */
sp804_timer_init(SP804_TIMER0_BASE,
SP804_TIMER0_CLKMULT, SP804_TIMER0_CLKDIV);
/* BRCM platforms generic setup */
bcm_bl2_early_platform_setup((uintptr_t)arg0, (meminfo_t *)arg1);
}
/*
* Perform Broadcom platform setup.
*/
void bcm_bl2_platform_setup(void)
{
/* Initialize the secure environment */
plat_bcm_security_setup();
}
void bl2_platform_setup(void)
{
bcm_bl2_platform_setup();
plat_bcm_bl2_platform_setup();
}
/*******************************************************************************
* Perform the very early platform specific architectural setup here. At the
* moment this is only initializes the mmu in a quick and dirty way.
******************************************************************************/
void bcm_bl2_plat_arch_setup(void)
{
#ifndef MMU_DISABLED
if (!(read_sctlr_el1() & SCTLR_M_BIT)) {
const mmap_region_t bl_regions[] = {
MAP_REGION_FLAT(bl2_tzram_layout.total_base,
bl2_tzram_layout.total_size,
MT_MEMORY | MT_RW | MT_SECURE),
MAP_REGION_FLAT(BL_CODE_BASE,
BL_CODE_END - BL_CODE_BASE,
MT_CODE | MT_SECURE),
MAP_REGION_FLAT(BL_RO_DATA_BASE,
BL_RO_DATA_END - BL_RO_DATA_BASE,
MT_RO_DATA | MT_SECURE),
#if USE_COHERENT_MEM
MAP_REGION_FLAT(BL_COHERENT_RAM_BASE,
BL_COHERENT_RAM_END -
BL_COHERENT_RAM_BASE,
MT_DEVICE | MT_RW | MT_SECURE),
#endif
{0}
};
setup_page_tables(bl_regions, plat_brcm_get_mmap());
enable_mmu_el1(0);
}
#endif
}
void bl2_plat_arch_setup(void)
{
#ifdef ENA_MMU_BEFORE_DDR_INIT
/*
* Once MMU is enabled before DDR, MEMORY TESTS
* get affected as read/write transaction might occures from
* caches. So For running memory test, one should not set this
* flag.
*/
bcm_bl2_plat_arch_setup();
plat_bcm_bl2_plat_arch_setup();
#else
plat_bcm_bl2_plat_arch_setup();
bcm_bl2_plat_arch_setup();
#endif
}
int bcm_bl2_handle_post_image_load(unsigned int image_id)
{
int err = 0;
bl_mem_params_node_t *bl_mem_params = get_bl_mem_params_node(image_id);
assert(bl_mem_params);
switch (image_id) {
case BL32_IMAGE_ID:
bl_mem_params->ep_info.spsr = brcm_get_spsr_for_bl32_entry();
break;
case BL33_IMAGE_ID:
/* BL33 expects to receive the primary CPU MPID (through r0) */
bl_mem_params->ep_info.args.arg0 = 0xffff & read_mpidr();
bl_mem_params->ep_info.spsr = brcm_get_spsr_for_bl33_entry();
break;
#ifdef SCP_BL2_BASE
case SCP_BL2_IMAGE_ID:
/* The subsequent handling of SCP_BL2 is platform specific */
err = bcm_bl2_handle_scp_bl2(&bl_mem_params->image_info);
if (err)
WARN("Failure in platform-specific handling of SCP_BL2 image.\n");
break;
#endif
default:
/* Do nothing in default case */
break;
}
return err;
}
/*******************************************************************************
* This function can be used by the platforms to update/use image
* information for given `image_id`.
******************************************************************************/
int bcm_bl2_plat_handle_post_image_load(unsigned int image_id)
{
return bcm_bl2_handle_post_image_load(image_id);
}
int bl2_plat_handle_post_image_load(unsigned int image_id)
{
return bcm_bl2_plat_handle_post_image_load(image_id);
}
#ifdef SCP_BL2_BASE
int plat_bcm_bl2_plat_handle_scp_bl2(image_info_t *scp_bl2_image_info)
{
return 0;
}
int bcm_bl2_handle_scp_bl2(image_info_t *scp_bl2_image_info)
{
return plat_bcm_bl2_plat_handle_scp_bl2(scp_bl2_image_info);
}
#endif
| 25.492611 | 80 | 0.722126 |
304ce3b495f2096cae2c8b60023ba4e5f65df309 | 6,789 | h | C | WKC/WebCore/platform/network/WKC/ResourceHandleManager.h | s1rcheese/nintendo-3ds-internetbrowser-sourcecode | 3dd05f035e0a5fc9723300623e9b9b359be64e11 | [
"Unlicense"
] | 15 | 2016-01-05T12:43:41.000Z | 2022-03-15T10:34:47.000Z | WKC/WebCore/platform/network/WKC/ResourceHandleManager.h | s1rcheese/nintendo-3ds-internetbrowser-sourcecode | 3dd05f035e0a5fc9723300623e9b9b359be64e11 | [
"Unlicense"
] | null | null | null | WKC/WebCore/platform/network/WKC/ResourceHandleManager.h | s1rcheese/nintendo-3ds-internetbrowser-sourcecode | 3dd05f035e0a5fc9723300623e9b9b359be64e11 | [
"Unlicense"
] | 2 | 2020-11-30T18:36:01.000Z | 2021-02-05T23:20:24.000Z | /*
ResourceHandleManager.oneshot.h
*/
/*
* Copyright (C) 2006 Apple Computer, Inc. All rights reserved.
* Copyright (C) 2006 Michael Emmel mike.emmel@gmail.com
* All rights reserved.
* Copyright (c) 2010, 2011 ACCESS CO., LTD. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef ResourceHandleManager_h
#define ResourceHandleManager_h
#include "CString.h"
#include "Frame.h"
#include "PlatformString.h"
#include "Timer.h"
#include "ResourceHandleClient.h"
#if PLATFORM(WIN)
#include <winsock2.h>
#include <windows.h>
#endif
#include <curl/curl.h>
#include <wtf/Vector.h>
namespace WebCore {
class ResourceHandleManager {
public:
enum ProxyType {
HTTP = CURLPROXY_HTTP,
HTTP10 = CURLPROXY_HTTP_1_0,
Socks4 = CURLPROXY_SOCKS4, // not support
Socks4A = CURLPROXY_SOCKS4A, // not support
Socks5 = CURLPROXY_SOCKS5, // not support
Socks5Hostname = CURLPROXY_SOCKS5_HOSTNAME // not support
};
enum ProxyAuth {
Basic = CURLAUTH_BASIC,
Digest = CURLAUTH_DIGEST,
NTLM = CURLAUTH_NTLM,
NONE = CURLAUTH_NONE // not use proxy auth
};
// For Singleton
static bool createSharedInstance();
static ResourceHandleManager* sharedInstance();
static void deleteSharedInstance();
static bool isExistSharedInstance();
static void forceTerminateInstance();
void add(ResourceHandle*);
void cancel(ResourceHandle*);
void setCookieJarFileName(const char* cookieJarFileName);
void setMaxTCPConnections(long number);
void setMaxCookieEntries(long number);
void doAuthChallenge(ResourceHandle*);
void cancelAuthChallenge(ResourceHandle*);
void dispatchSynchronousJob(ResourceHandle*);
void setProxyInfo(const String& host = "",
unsigned long port = 0,
ProxyType type = HTTP,
const String& username = "",
const String& password = "",
ProxyAuth auth = Basic);
void setProxyUserPass(const String& username = "", const String& password = "");
void didReceiveProxyAuthChallenge(ResourceHandle* job, ResourceHandleInternal* d);
static bool hasProxyUserPass();
void cookieSerializeStart();
int cookieSerializeProgress(char*, unsigned int, unsigned int*);
void cookieSerializeEnd();
void cookieDeserializeStart(bool);
int cookieDeserializeProgress(const char*, unsigned int);
void cookieDeserializeEnd();
void clearCookies();
void setCookie(const String &domain, const String &path, const String &cookie);
String getCookie(const String &domain, const String &path, bool secure);
// Shared Cookie Manipulation
static void sharedCookieSerializeStart();
static int sharedCookieSerializeProgress(char*, unsigned int, unsigned int*);
static void sharedCookieSerializeEnd();
static void sharedCookieDeserializeStart(bool);
static int sharedCookieDeserializeProgress(const char*, unsigned int);
static void sharedCookieDeserializeEnd();
static void sharedCookieSet(const String &domain, const String &path, const String &cookie);
static String sharedCookieGet(const String &domain, const String &path, bool secure);
// Add Cookie
static bool addCookie(const String &domain, const String &path, const String &cookie);
static void resetVariables();
CURLSH* sharehandle() {return m_curlShareHandle;}
private:
ResourceHandleManager();
~ResourceHandleManager();
static ResourceHandleManager* create();
bool construct();
void downloadTimerCallback(Timer<ResourceHandleManager>*);
void removeFromCurl(ResourceHandle*);
void startJob(ResourceHandle*);
bool startScheduledJobs();
void cancelScheduledJobs();
void initializeHandle(ResourceHandle*);
void setupPOST(ResourceHandle*, struct curl_slist**);
void setupPUT(ResourceHandle*, struct curl_slist**);
Timer<ResourceHandleManager> m_downloadTimer;
CURLM* m_curlMultiHandle;
CURLSH* m_curlShareHandle;
char* m_cookieJarFileName;
char m_curlErrorBuffer[CURL_ERROR_SIZE];
// from add() to startScheduledJobs() or cancel()
Vector<ResourceHandle*> m_scheduledJobList;
void appendScheduledJob(ResourceHandle*);
bool removeScheduledJob(ResourceHandle*); // from cancel()
ResourceHandle* shiftScheduledJob();
void removeAllScheduledJobs();
// from curl_multi_add_handle() to curl_multi_remove_handle()/curl_easy_cleanup()
// max is m_tcpConnections
Vector<ResourceHandle*> m_runningJobList;
void appendRunningJob(ResourceHandle* job);
bool removeRunningJob(ResourceHandle* job);
ResourceHandle* shiftRunningJob(); // for deleteing all jobs
void removeAllRunningJobs();
String m_proxy;
String m_proxyHost;
int m_proxyPort;
ProxyType m_proxyType;
String m_proxyUser;
String m_proxyPass;
ProxyAuth m_proxyAuth;
String m_proxyUserCache;
String m_proxyPassCache;
bool m_willChallengeProxyAuth;
struct curl_slist* m_cookieInfo;
struct curl_slist* m_nextCookie;
bool m_serializeEnd;
bool m_cookiesDeleting;
bool m_CookieRestartDeserialize;
int m_cookieMaxEntries;
// For Singleton
void forceTerminate();
static ResourceHandleManager *m_sharedInstance;
static bool m_forceTerminating;
// TCP connections
int m_tcpConnections;
// JavaScript Sequential
bool m_jsSequential;
};
}
#endif
| 34.287879 | 96 | 0.72264 |
a95e19ea06d6d3b410fee4702029677e5893cde4 | 3,601 | h | C | src/media/playback/mediaplayer/fidl/fidl_audio_renderer.h | yanyushr/fuchsia | 98e70672a81a206d235503e398f37b7b65581f79 | [
"BSD-3-Clause"
] | 1 | 2019-10-09T10:50:57.000Z | 2019-10-09T10:50:57.000Z | src/media/playback/mediaplayer/fidl/fidl_audio_renderer.h | bootingman/fuchsia2 | 04012f0aa1edd1d4108a2ac647a65e59730fc4c2 | [
"BSD-3-Clause"
] | null | null | null | src/media/playback/mediaplayer/fidl/fidl_audio_renderer.h | bootingman/fuchsia2 | 04012f0aa1edd1d4108a2ac647a65e59730fc4c2 | [
"BSD-3-Clause"
] | null | null | null | // Copyright 2018 The Fuchsia 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 SRC_MEDIA_PLAYBACK_MEDIAPLAYER_FIDL_FIDL_AUDIO_RENDERER_H_
#define SRC_MEDIA_PLAYBACK_MEDIAPLAYER_FIDL_FIDL_AUDIO_RENDERER_H_
#include <fuchsia/media/cpp/fidl.h>
#include <lib/async/cpp/task.h>
#include "src/lib/fxl/synchronization/thread_annotations.h"
#include "src/lib/fxl/synchronization/thread_checker.h"
#include "src/media/playback/mediaplayer/metrics/packet_timing_tracker.h"
#include "src/media/playback/mediaplayer/render/audio_renderer.h"
namespace media_player {
// AudioRenderer that renders audio via FIDL services.
//
// This class run single-threaded.
class FidlAudioRenderer : public AudioRenderer {
public:
static std::shared_ptr<FidlAudioRenderer> Create(
fuchsia::media::AudioRendererPtr audio_renderer);
FidlAudioRenderer(fuchsia::media::AudioRendererPtr audio_renderer);
~FidlAudioRenderer() override;
// AudioRenderer implementation.
const char* label() const override;
void Dump(std::ostream& os) const override;
void OnInputConnectionReady(size_t input_index) override;
void FlushInput(bool hold_frame, size_t input_index,
fit::closure callback) override;
void PutInputPacket(PacketPtr packet, size_t input_index) override;
const std::vector<std::unique_ptr<StreamTypeSet>>& GetSupportedStreamTypes()
override {
return supported_stream_types_;
}
void SetStreamType(const StreamType& stream_type) override;
void Prime(fit::closure callback) override;
void SetTimelineFunction(media::TimelineFunction timeline_function,
fit::closure callback) override;
void BindGainControl(
fidl::InterfaceRequest<fuchsia::media::audio::GainControl>
gain_control_request) override;
protected:
// Renderer overrides.
void OnTimelineTransition() override;
private:
FXL_DECLARE_THREAD_CHECKER(thread_checker_);
// Determines if more packets are needed.
bool NeedMorePackets();
// Signals current demand via the stage's |RequestInputPacket| if we need
// more packets. Return value indicates whether an input packet was requested.
bool SignalCurrentDemand();
// Converts a pts in |pts_rate_| units to ns.
int64_t to_ns(int64_t pts) {
return pts * (media::TimelineRate::NsPerSecond / pts_rate_);
}
// Converts a pts in ns to |pts_rate_| units.
int64_t from_ns(int64_t pts) {
return pts * (pts_rate_ / media::TimelineRate::NsPerSecond);
}
std::vector<std::unique_ptr<StreamTypeSet>> supported_stream_types_;
fuchsia::media::AudioRendererPtr audio_renderer_;
bool renderer_responding_ = false;
media::TimelineRate pts_rate_;
int64_t last_supplied_pts_ns_ = Packet::kNoPts;
int64_t last_departed_pts_ns_ = Packet::kNoPts;
int64_t next_pts_to_assign_ = Packet::kNoPts;
bool input_packet_request_outstanding_ = false;
fit::closure prime_callback_;
uint32_t bytes_per_frame_;
bool flushed_ = true;
int64_t min_lead_time_ns_;
int64_t target_lead_time_ns_;
async::TaskClosure demand_task_;
PacketTimingTracker arrivals_;
PacketTimingTracker departures_;
// Disallow copy, assign and move.
FidlAudioRenderer(const FidlAudioRenderer&) = delete;
FidlAudioRenderer(FidlAudioRenderer&&) = delete;
FidlAudioRenderer& operator=(const FidlAudioRenderer&) = delete;
FidlAudioRenderer& operator=(FidlAudioRenderer&&) = delete;
};
} // namespace media_player
#endif // SRC_MEDIA_PLAYBACK_MEDIAPLAYER_FIDL_FIDL_AUDIO_RENDERER_H_
| 32.736364 | 80 | 0.770064 |
a991350995966b2aebd685f99872990e841ce6fd | 1,629 | h | C | protocolstatus.h | marcielazevedo/ll | aa23a126586a433194c5a24122d80667fbcca465 | [
"MIT"
] | null | null | null | protocolstatus.h | marcielazevedo/ll | aa23a126586a433194c5a24122d80667fbcca465 | [
"MIT"
] | null | null | null | protocolstatus.h | marcielazevedo/ll | aa23a126586a433194c5a24122d80667fbcca465 | [
"MIT"
] | null | null | null | /**
* The Forgotten Server - a free and open-source MMORPG server emulator
* Copyright (C) 2015 Mark Samman <mark.samman@gmail.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.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#ifndef FS_STATUS_H_8B28B354D65B4C0483E37AD1CA316EB4
#define FS_STATUS_H_8B28B354D65B4C0483E37AD1CA316EB4
#include "networkmessage.h"
#include "protocol.h"
class ProtocolStatus final : public Protocol
{
public:
// static protocol information
enum {server_sends_first = false};
enum {protocol_identifier = 0xFF};
enum {use_checksum = false};
static const char* protocol_name() {
return "status protocol";
}
explicit ProtocolStatus(Connection_ptr connection) : Protocol(connection) {}
void onRecvFirstMessage(NetworkMessage& msg) final;
void sendStatusString();
void sendInfo(uint16_t requestedInfo, const std::string& characterName);
static const uint64_t start;
protected:
static std::map<uint32_t, int64_t> ipConnectMap;
};
#endif
| 31.941176 | 78 | 0.758748 |
6570e5ba297fb4b67b03c689d71073439a5524d9 | 53 | h | C | depends/work/build/i686-w64-mingw32/qt/5.9.7-f2560c1efa6/qtbase/include/QtWidgets/qfontcombobox.h | GrinCash/Grinc-core | 1377979453ba84082f70f9c128be38e57b65a909 | [
"MIT"
] | 1 | 2020-04-30T15:47:35.000Z | 2020-04-30T15:47:35.000Z | HBTwithKICPP/QtWidgets/qfontcombobox.h | i-zro/HBTwithKI | 4942a3d46e1a7fc56374ef6b57fba0cd4697c2b3 | [
"MIT"
] | null | null | null | HBTwithKICPP/QtWidgets/qfontcombobox.h | i-zro/HBTwithKI | 4942a3d46e1a7fc56374ef6b57fba0cd4697c2b3 | [
"MIT"
] | null | null | null | #include "../../src/widgets/widgets/qfontcombobox.h"
| 26.5 | 52 | 0.716981 |
456e3a37d1f102540e68041127fd4c7daba19bb5 | 606 | h | C | channeld/watchtower.h | rsouvik/bitblue | a205fb77695a26512c7eb9ba33a7379f246ec357 | [
"MIT"
] | 4 | 2019-12-08T21:02:32.000Z | 2020-08-06T12:14:37.000Z | channeld/watchtower.h | rsouvik/bitblue | a205fb77695a26512c7eb9ba33a7379f246ec357 | [
"MIT"
] | 5 | 2021-02-20T02:41:55.000Z | 2021-06-01T20:04:08.000Z | channeld/watchtower.h | rsouvik/bitblue | a205fb77695a26512c7eb9ba33a7379f246ec357 | [
"MIT"
] | 7 | 2019-10-07T23:53:49.000Z | 2021-11-23T18:26:30.000Z | #ifndef LIGHTNING_CHANNELD_WATCHTOWER_H
#define LIGHTNING_CHANNELD_WATCHTOWER_H
#include "config.h"
#include <ccan/short_types/short_types.h>
#include <ccan/tal/tal.h>
#include <common/derive_basepoints.h>
#include <common/initial_channel.h>
const struct bitcoin_tx *
penalty_tx_create(const tal_t *ctx,
const struct channel *channel,
u32 penalty_feerate,
u8 *final_scriptpubkey,
const struct secret *revocation_preimage,
const struct bitcoin_txid *commitment_txid,
s16 to_them_outnum, struct amount_sat to_them_sats,
int hsm_fd);
#endif /* LIGHTNING_CHANNELD_WATCHTOWER_H */
| 30.3 | 55 | 0.788779 |
4577e6af7d3dc3ba5f9e94c4b694da6b5ef9483e | 18,820 | c | C | sdk-6.5.20/src/examples/ltsw/trident4/dna_4_6_6/qos/td4_hsdk_qos_l3_dscp_ecn_remark.c | copslock/broadcom_cpri | 8e2767676e26faae270cf485591902a4c50cf0c5 | [
"Spencer-94"
] | null | null | null | sdk-6.5.20/src/examples/ltsw/trident4/dna_4_6_6/qos/td4_hsdk_qos_l3_dscp_ecn_remark.c | copslock/broadcom_cpri | 8e2767676e26faae270cf485591902a4c50cf0c5 | [
"Spencer-94"
] | null | null | null | sdk-6.5.20/src/examples/ltsw/trident4/dna_4_6_6/qos/td4_hsdk_qos_l3_dscp_ecn_remark.c | copslock/broadcom_cpri | 8e2767676e26faae270cf485591902a4c50cf0c5 | [
"Spencer-94"
] | null | null | null | /*
* This license is set out in https://raw.githubusercontent.com/Broadcom-Network-Switching-Software/OpenBCM/master/Legal/LICENSE file.
*
* Copyright 2007-2020 Broadcom Inc. All rights reserved.
*/
/*
* Feature : DSCP+ECN remarking for L3 Ipv4 packets
*
* Usage : BCM.0> cint td4_hsdk_qos_l3_dscp_ecn_remark.c
*
* config : bcm56880_a0-generic-l2.config.yml
*
* Log file : td4_hsdk_qos_l3_dscp_ecn_remark_log.txt
*
* Test Topology :
*
* +------------------------------+
* | |
* | |
* ingress_vlan 5 | | egress vlan 10
* ingress_port cd0 | | egress_port cd1
* +----------------+ SWITCH-TD4 +-----------------+
* src_mac 0x01 | | src_mac 0x11
* dst_mac 0x02 | | dst_mac 0x22
* DIP 10.10.10.10 | |
* SIP 20.20.20.20 | |
* | |
* +------------------------------+
*
* Summary:
* ========
* Cint example to show the qos configuration for L3 packets DSCP+ECN remarking
*
* Detailed steps done in the CINT script:
* =======================================
* 1) Step1 - Test Setup (Done in test_setup()):
* =============================================
* a) Selects two ports and configure them in Loopback mode. Out of these
* two ports, one port is used as ingress_port and the other as
* egress_port.
*
* b) Install an IFP rule to copy incoming and outgoing packets to CPU and
* start packet watcher to display packet contents.
*
* Note: IFP rule is meant for a testing purpose only (Internal) and it is
* nothing to do with an actual functional test.
*
* 2) Step2 - Configuration (Done in configure_ipuc_forwarding()):
* =========================================================
* a) Configure a basic IPv4 host entry functional scenario. This adds the
* host entry in L3 table and does the necessary configurations of vlan, L3_IIF,
* egress interface and next hop.
*
* 3) Step3 - Verification (Done in verify()):
* ===========================================
* a) Check the configurations by 'vlan show', 'l3 intf show',
* 'l3 egress show' and 'l3 host show'
*
* b) Transmit the known IPv4 unicast packet. The contents of the packet
* are printed on screen. The packet used matches the route configured
* through script.
*
* c) Expected Result:
* ===================
* We can see that dmac, smac, TTL and vlan are all changed as the packet is
* routed through the egress port and 'show c' to check the Tx/Rx packet
* stats/counters.
*/
/* Reset C interpreter*/
cint_reset();
bcm_port_t ingress_port;
bcm_port_t egress_port;
bcm_gport_t ingress_gport;
bcm_gport_t egress_gport;
/*
* This function is written so that hardcoding of port
* numbers in Cint scripts is removed. This function gives
* required number of ports
*/
bcm_error_t
portNumbersGet(int unit, int *port_list, int num_ports)
{
int i = 0, port = 0, rv = 0;
bcm_port_config_t configP;
bcm_pbmp_t ports_pbmp;
rv = bcm_port_config_get(unit, &configP);
if (BCM_FAILURE(rv)) {
printf("\nError in retrieving port configuration: %s.\n",bcm_errmsg(rv));
return rv;
}
ports_pbmp = configP.e;
for (i= 1; i < BCM_PBMP_PORT_MAX; i++) {
if (BCM_PBMP_MEMBER(&ports_pbmp, i) && (port < num_ports)) {
port_list[port] = i;
port++;
}
}
if ((0 == port) || (port != num_ports)) {
printf("portNumbersGet() failed \n");
return -1;
}
return BCM_E_NONE;
}
/*
* Configures the port in loopback mode and installs
* an IFP rule. This IFP rule copies the packets ingressing
* on the specified port to CPU.
*/
bcm_error_t
ingress_port_setup(int unit, bcm_port_t port)
{
bcm_field_entry_t entry;
bcm_field_group_config_t group_config;
BCM_IF_ERROR_RETURN(bcm_port_loopback_set(unit, port, BCM_PORT_LOOPBACK_MAC));
bcm_field_group_config_t_init(&group_config);
BCM_FIELD_QSET_INIT(group_config.qset);
BCM_FIELD_QSET_ADD(group_config.qset, bcmFieldQualifyStageIngress);
BCM_FIELD_QSET_ADD(group_config.qset, bcmFieldQualifyInPort);
BCM_FIELD_ASET_ADD(group_config.aset, bcmFieldActionCopyToCpu);
group_config.priority = 1;
BCM_IF_ERROR_RETURN(bcm_field_group_config_create(unit, &group_config));
BCM_IF_ERROR_RETURN(bcm_field_entry_create(unit, group_config.group, &entry));
BCM_IF_ERROR_RETURN(bcm_field_qualify_InPort(unit, entry, port, BCM_FIELD_EXACT_MATCH_MASK));
BCM_IF_ERROR_RETURN(bcm_field_action_add(unit, entry, bcmFieldActionCopyToCpu, 0, 0));
BCM_IF_ERROR_RETURN(bcm_field_entry_install(unit, entry));
printf("ingress_port_setup configured for ingress_port : %d\n", port);
return BCM_E_NONE;
}
/*
* Configures the port in loopback mode and installs
* an IFP rule. This IFP rule copies the packets ingressing
* on the specified port to CPU. Port is also configured
* to discard all packets. This is to avoid continuous
* loopback of the packet.
*/
bcm_error_t
egress_port_setup(int unit, bcm_port_t port)
{
bcm_field_entry_t entry;
bcm_field_group_config_t group_config;
BCM_IF_ERROR_RETURN(bcm_port_loopback_set(unit, port, BCM_PORT_LOOPBACK_MAC));
bcm_field_group_config_t_init(&group_config);
BCM_FIELD_QSET_INIT(group_config.qset);
BCM_FIELD_QSET_ADD(group_config.qset, bcmFieldQualifyStageIngress);
BCM_FIELD_QSET_ADD(group_config.qset, bcmFieldQualifyInPort);
BCM_FIELD_ASET_ADD(group_config.aset, bcmFieldActionCopyToCpu);
BCM_FIELD_ASET_ADD(group_config.aset, bcmFieldActionDrop);
group_config.priority = 2;
BCM_IF_ERROR_RETURN(bcm_field_group_config_create(unit, &group_config));
BCM_IF_ERROR_RETURN(bcm_field_entry_create(unit, group_config.group, &entry));
BCM_IF_ERROR_RETURN(bcm_field_qualify_InPort(unit, entry, port, BCM_FIELD_EXACT_MATCH_MASK));
BCM_IF_ERROR_RETURN(bcm_field_action_add(unit, entry, bcmFieldActionCopyToCpu, 0, 0));
BCM_IF_ERROR_RETURN(bcm_field_action_add(unit, entry, bcmFieldActionDrop, 0, 0));
BCM_IF_ERROR_RETURN(bcm_field_entry_install(unit, entry));
printf("egress_port_setup configured for egress_port : %d\n", port);
return BCM_E_NONE;
}
/*
* Test Setup:
* This functions gets the port numbers and sets up ingress and
* egress ports. Check ingress_port_setup() and egress_port_setup().
*/
bcm_error_t
test_setup(int unit)
{
int port_list[2];
if (BCM_E_NONE != portNumbersGet(unit, port_list, 2)) {
printf("portNumbersGet() failed\n");
return -1;
}
ingress_port = port_list[0];
egress_port = port_list[1];
if (BCM_E_NONE != ingress_port_setup(unit, ingress_port)) {
printf("ingress_port_setup() failed for port %d\n", ingress_port);
return -1;
}
if (BCM_E_NONE != egress_port_setup(unit, egress_port)) {
printf("egress_port_setup() failed for port %d\n", egress_port);
return -1;
}
bshell(unit, "pw start report +raw +decode +pmd");
return BCM_E_NONE;
}
/*
* Verification:
* In Packet:
* ----------
* 0000 0000 0002 0000 0000 0001 8100 0005
* 0800 4500 002e 0000 0000 40ff 3d96 1414
* 1414 0a0a 0a0a 0000 0000 0000 0000 0000
* 0000 0000 0000 0000 0000 0000 0000 0000
* f3b4 2e69
*
* Out Packet:
* -----------
* 0000 0000 0022 0000 0000 0011 8100 000a
* 0800 4517 002e 0000 0000 3fff 3e7f 1414
* 1414 0a0a 0a0a 0000 0000 0000 0000 0000
* 0000 0000 0000 0000 0000 0000 0000 0000
* f3b4 2e69
*/
void
verify(int unit)
{
char str[512];
bshell(unit, "vlan show");
bshell(unit, "l3 intf show");
bshell(unit, "l3 egress show");
bshell(unit, "l3 host show");
bshell(unit, "clear c");
printf("\nSending IPv4 unicast packet to ingress_port : %d\n", ingress_port);
snprintf(str, 512, "tx 1 pbm=%d data=0x0000000000020000000000018100000508004500002e0000000040ff3d96141414140a0a0a0a0000000000000000000000000000000000000000000000000000f3b42e69; sleep quiet 1", ingress_port);
bshell(unit, str);
bshell(unit, "l3 host show");
bshell(unit, "show c");
return;
}
/* Create vlan and add port to vlan */
int
create_vlan_add_port(int unit, bcm_vlan_t vlan, bcm_port_t port)
{
bcm_error_t rv = BCM_E_NONE;
bcm_pbmp_t pbmp, ubmp;
BCM_PBMP_CLEAR(ubmp);
BCM_PBMP_CLEAR(pbmp);
BCM_PBMP_PORT_ADD(pbmp, port);
rv = bcm_vlan_create(unit, vlan);
if ((BCM_FAILURE(rv)) & (rv != BCM_E_EXISTS)) {
printf("Error in configuring vlan : %s.\n", bcm_errmsg(rv));
return rv;
}
BCM_IF_ERROR_RETURN(bcm_vlan_port_add(unit, vlan, pbmp, ubmp));
return BCM_E_NONE;
}
/* Create L3 Ingress Interface */
int
create_l3_iif(int unit, bcm_vrf_t vrf, bcm_if_t ingress_if, int qos_map_id)
{
bcm_error_t rv = BCM_E_NONE;
bcm_l3_ingress_t l3_ingress;
bcm_l3_ingress_t_init(&l3_ingress);
l3_ingress.flags = BCM_L3_INGRESS_WITH_ID |BCM_L3_INGRESS_DSCP_TRUST;
l3_ingress.vrf = vrf;
l3_ingress.qos_map_id = qos_map_id;
rv = bcm_l3_ingress_create(unit, &l3_ingress, &ingress_if);
if (BCM_FAILURE(rv)) {
printf("Error in configuring L3_IIF : %s.\n", bcm_errmsg(rv));
return rv;
}
return BCM_E_NONE;
}
/* Config vlan_id to l3_iif mapping. */
int
configure_l3_iif_binding(int unit, bcm_vlan_t vlan, bcm_if_t ingress_if)
{
bcm_error_t rv = BCM_E_NONE;
bcm_vlan_control_vlan_t vlan_ctrl;
bcm_vlan_control_vlan_t_init(&vlan_ctrl);
vlan_ctrl.ingress_if = ingress_if;
rv = bcm_vlan_control_vlan_selective_set(unit, vlan, BCM_VLAN_CONTROL_VLAN_INGRESS_IF_MASK, &vlan_ctrl);
if (BCM_FAILURE(rv)) {
printf("Error in configuring L3_IIF binding : %s.\n", bcm_errmsg(rv));
return rv;
}
return BCM_E_NONE;
}
/* Create L3 interface */
int
create_l3_intf(int unit, bcm_mac_t mac, bcm_vlan_t vlan, bcm_if_t *l3_intf_id)
{
bcm_error_t rv = BCM_E_NONE;
bcm_l3_intf_t l3_intf;
bcm_l3_intf_t_init(&l3_intf);
l3_intf.l3a_vid = vlan;
sal_memcpy(l3_intf.l3a_mac_addr, mac, sizeof(mac));
rv = bcm_l3_intf_create(unit, &l3_intf);
if (BCM_FAILURE(rv)) {
printf("Error in configuring L3 interface : %s.\n", bcm_errmsg(rv));
return rv;
}
*l3_intf_id = l3_intf.l3a_intf_id;
return BCM_E_NONE;
}
/* Create L3 egress object */
int
create_egr_obj(int unit, bcm_if_t l3_if, bcm_mac_t mac, bcm_gport_t gport,
bcm_if_t *egr_if, int qos_map_id)
{
bcm_error_t rv = BCM_E_NONE;
bcm_l3_egress_t l3_egr;
bcm_l3_egress_t_init(&l3_egr);
l3_egr.intf = l3_if;
l3_egr.port = gport;
l3_egr.qos_map_id = qos_map_id;
sal_memcpy(l3_egr.mac_addr, mac, sizeof(mac));
rv = bcm_l3_egress_create(unit, 0, &l3_egr, egr_if);
if (BCM_FAILURE(rv)) {
printf("Error in configuring L3 egress object : %s.\n", bcm_errmsg(rv));
return rv;
}
printf("egress object id : %d created\n", *egr_if);
return BCM_E_NONE;
}
/* Configure my station */
int
configure_my_station_tcam(int unit, bcm_mac_t mac)
{
bcm_error_t rv = BCM_E_NONE;
bcm_mac_t mac_mask={0xff, 0xff, 0xff, 0xff, 0xff, 0xff};
bcm_l2_station_t l2_station;
int station_id;
bcm_l2_station_t_init(&l2_station);
sal_memcpy(l2_station.dst_mac, mac, sizeof(mac));
sal_memcpy(l2_station.dst_mac_mask, mac_mask, sizeof(mac_mask));
rv = bcm_l2_station_add(unit, &station_id, &l2_station);
if (BCM_FAILURE(rv)) {
printf("Error in configuring L3 station : %s.\n", bcm_errmsg(rv));
return rv;
}
return BCM_E_NONE;
}
/* Adding subnet address to L3 Host table */
int
configure_host(int unit, bcm_ip_t ip_address, bcm_if_t egr_if, bcm_vrf_t vrf)
{
bcm_error_t rv = BCM_E_NONE;
bcm_l3_host_t host;
bcm_l3_host_t_init(&host);
host.l3a_ip_addr = ip_address;
host.l3a_intf = egr_if;
host.l3a_vrf = vrf;
rv = bcm_l3_host_add(unit, &host);
if (BCM_FAILURE(rv)) {
printf("Error in configuring L3 Host table : %s.\n", bcm_errmsg(rv));
return rv;
}
return BCM_E_NONE;
}
bcm_error_t
dscp_ecn_remark_config_set(int unit, int *in_map, int *eg_map)
{
bcm_ecn_traffic_map_info_t ecn_map;
bcm_ecn_traffic_action_config_t ecn_action;
bcm_qos_map_t map;
int ing_map, egr_map;
bcm_error_t rv = BCM_E_NONE;
uint32 flags;
bcm_ecn_traffic_map_info_t_init(&ecn_map);
ecn_map.tunnel_type = bcmEcnTrafficMapNonTunnel;
ecn_map.ecn = 0;
ecn_map.int_cn = 0;
rv = bcm_ecn_traffic_map_set(unit, &ecn_map);
if (BCM_FAILURE(rv)) {
printf("\nError in bcm_ecn_traffic_map_set: %s\n", bcm_errmsg(rv));
return rv;
}
bcm_ecn_traffic_action_config_t_init(&ecn_action);
ecn_action.action_type = BCM_ECN_TRAFFIC_ACTION_TYPE_DEQUEUE;
ecn_action.action_flags = BCM_ECN_TRAFFIC_ACTION_DEQUEUE_NON_CONGESTION_INT_CN_UPDATE;
ecn_action.int_cn = 0;
ecn_action.color = bcmColorGreen;
ecn_action.non_congested_int_cn = 1;
rv = bcm_ecn_traffic_action_config_set(unit, &ecn_action);
if (BCM_FAILURE(rv)) {
printf("\nError in bcm_ecn_traffic_action_config_set: %s\n", bcm_errmsg(rv));
return rv;
}
flags = BCM_QOS_MAP_L3 | BCM_QOS_MAP_INGRESS;
rv = bcm_qos_map_create(unit, flags, &ing_map);
if (BCM_FAILURE(rv)) {
printf("\nError in bcm_qos_map_create: %s\n", bcm_errmsg(rv));
return rv;
}
bcm_qos_map_t_init(&map);
map.dscp = 0;
map.int_pri = 1;
map.color = bcmColorGreen;
rv = bcm_qos_map_add(unit, flags, &map, ing_map);
if (BCM_FAILURE(rv)) {
printf("\nError in bcm_qos_map_add: %s\n", bcm_errmsg(rv));
return rv;
}
flags = BCM_QOS_MAP_L3 | BCM_QOS_MAP_ECN | BCM_QOS_MAP_EGRESS;
rv = bcm_qos_map_create(unit, flags, &egr_map);
if (BCM_FAILURE(rv)) {
printf("\nError in bcm_qos_map_create: %s\n", bcm_errmsg(rv));
return rv;
}
bcm_qos_map_t_init(&map);
map.int_cn = 1;
map.int_pri = 1;
map.pkt_ecn = 3;
map.dscp = 5;
rv = bcm_qos_map_add(unit, flags, &map, egr_map);
if (BCM_FAILURE(rv)) {
printf("\nError in bcm_qos_map_add: %s\n", bcm_errmsg(rv));
return rv;
}
*in_map = ing_map;
*eg_map = egr_map;
return BCM_E_NONE;
}
/* Steps to configure IPUC forwarding*/
int
configure_ipuc_forwarding(int unit)
{
bcm_error_t rv = BCM_E_NONE;
bcm_vlan_t ingress_vlan = 5;
bcm_vlan_t egress_vlan = 10;
bcm_if_t ingress_if = 100;
bcm_if_t egr_if;
bcm_if_t egr_l3_if;
bcm_vrf_t vrf = 1;
bcm_mac_t router_mac = {0x00, 0x00, 0x00, 0x00, 0x00, 0x02};
bcm_mac_t src_mac = {0x00, 0x00, 0x00, 0x0, 0x00, 0x11};
bcm_mac_t dst_mac = {0x00, 0x00, 0x00, 0x0, 0x00, 0x22};
bcm_ip_t dip = 0x0a0a0a0a;
int ing_map, egr_map;
/* Cretae ingress vlan and add ingress port as member */
rv = create_vlan_add_port(unit, ingress_vlan, ingress_port);
if (BCM_FAILURE(rv)) {
printf("create_vlan_add_port return error : %s.\n", bcm_errmsg(rv));
return rv;
}
/* Cretae egress vlan and add egress port as member */
rv = create_vlan_add_port(unit, egress_vlan, egress_port);
if (BCM_FAILURE(rv)) {
printf("create_vlan_add_port return error : %s.\n", bcm_errmsg(rv));
return rv;
}
/* dscp+ecn remarking */
rv = dscp_ecn_remark_config_set(unit , &ing_map, &egr_map);
if (BCM_FAILURE(rv)) {
printf("\nError in ecn_config_set: %s\n", bcm_errmsg(rv));
return rv;
}
BCM_IF_ERROR_RETURN(bcm_port_control_set(unit, egress_port, bcmPortControlEgressVlanPriSrc, bcmPortEgressVlanPriSrcIntPri));
/* Cretae L3 ingress interface called l3_iif */
rv = create_l3_iif(unit, vrf, ingress_if, ing_map);
if (BCM_FAILURE(rv)) {
printf("create_l3_iif return error : %s.\n", bcm_errmsg(rv));
return rv;
}
/* VLAN to L3_IIF binding */
rv = configure_l3_iif_binding(unit, ingress_vlan, ingress_if);
if (BCM_FAILURE(rv)) {
printf("configure_l3_iif_binding return error : %s.\n", bcm_errmsg(rv));
return rv;
}
/* Cretae L3 egress interface */
rv = create_l3_intf(unit, src_mac, egress_vlan, &egr_l3_if);
if (BCM_FAILURE(rv)) {
printf("create_l3_intf return error : %s.\n", bcm_errmsg(rv));
return rv;
}
BCM_IF_ERROR_RETURN(bcm_port_gport_get(unit, egress_port, &egress_gport));
/* Cretae L3 egress object */
rv = create_egr_obj(unit, egr_l3_if, dst_mac, egress_gport, egr_if, egr_map);
if (BCM_FAILURE(rv)) {
printf("create_egr_obj return error : %s.\n", bcm_errmsg(rv));
return rv;
}
/* Configure MY_STATION TCAM for router MAC */
rv = configure_my_station_tcam(unit, router_mac);
if (BCM_FAILURE(rv)) {
printf("configure_my_station_tcam return error : %s.\n", bcm_errmsg(rv));
return rv;
}
/* Program Host L3 table */
rv = configure_host(unit, dip, egr_if, vrf);
if (BCM_FAILURE(rv)) {
printf("configure_host return error : %s.\n", bcm_errmsg(rv));
return rv;
}
return BCM_E_NONE;
}
/*
* execute:
* This function does the following
* a) test setup
* b) actual configuration (Done in configure_ipuc_forwarding())
* c) demonstrates the functionality(done in verify()).
*/
bcm_error_t
execute(void)
{
bcm_error_t rv;
int unit = 0;
print "config show; attach; version";
bshell(unit, "config show; a ; version");
print "~~~ #1) test_setup(): ** start **";
if (BCM_FAILURE((rv = test_setup(unit)))) {
printf("test_setup() failed.\n");
return -1;
}
print "~~~ #1) test_setup(): ** end **";
print "~~~ #2) configure_ipuc_forwarding(): ** start **";
if (BCM_FAILURE((rv = configure_ipuc_forwarding(unit)))) {
printf("configure_ipuc_forwarding() failed.\n");
return -1;
}
print "~~~ #2) configure_ipuc_forwarding(): ** end **";
print "~~~ #3) verify(): ** start **";
verify(unit);
print "~~~ #3) verify(): ** end **";
return BCM_E_NONE;
}
const char *auto_execute = (ARGC == 1) ? ARGV[0] : "YES";
if (!sal_strcmp(auto_execute, "YES")) {
print "execute(): Start";
print execute();
print "execute(): End";
}
| 31.366667 | 211 | 0.646281 |
a9ac25a8ae7c4f17d2d959f03cc8cc6892fd3a74 | 760 | h | C | PC VC Examples/KMotionCNC/ResumeDlg.h | parhansson/KMotionX | 9e827917572fee477fe7971f67709c4c2ee4f97a | [
"BSD-3-Clause"
] | 17 | 2015-01-04T19:58:54.000Z | 2020-12-15T07:01:14.000Z | PC VC Examples/KMotionCNC/ResumeDlg.h | parhansson/KMotionX | 9e827917572fee477fe7971f67709c4c2ee4f97a | [
"BSD-3-Clause"
] | 6 | 2015-12-10T21:24:01.000Z | 2020-02-27T23:35:24.000Z | PC VC Examples/KMotionCNC/ResumeDlg.h | parhansson/KMotionX | 9e827917572fee477fe7971f67709c4c2ee4f97a | [
"BSD-3-Clause"
] | 16 | 2015-02-07T23:42:53.000Z | 2022-01-22T06:09:43.000Z | #pragma once
// CResumeDlg dialog
class CResumeDlg : public CDialog
{
DECLARE_DYNAMIC(CResumeDlg)
public:
CResumeDlg(CWnd* pParent = NULL); // standard constructor
virtual ~CResumeDlg();
// Dialog Data
enum { IDD = IDD_Resume };
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
DECLARE_MESSAGE_MAP()
public:
double m_SafeZ;
BOOL m_MoveToSafeZ;
BOOL m_SafeRelAbs;
BOOL m_TraverseXY;
double m_TraverseSafeX;
double m_TraverseSafeY;
BOOL m_SafeStartSpindle;
int m_SafeSpindleCWCCW;
BOOL m_DoSafeFeedZ;
double m_FeedSafeZ;
double m_ZFeedRate;
BOOL m_RestoreFeedRate;
double m_ResumeFeedRate;
virtual BOOL OnInitDialog();
void DoMetric(int ID);
bool m_Metric;
};
| 19.487179 | 72 | 0.728947 |
ecea4776ecddfdac89f2f64b1e1e22c7c76ade1f | 1,887 | h | C | components/dom_distiller/content/renderer/distiller_native_javascript.h | zipated/src | 2b8388091c71e442910a21ada3d97ae8bc1845d3 | [
"BSD-3-Clause"
] | 2,151 | 2020-04-18T07:31:17.000Z | 2022-03-31T08:39:18.000Z | components/dom_distiller/content/renderer/distiller_native_javascript.h | cangulcan/src | 2b8388091c71e442910a21ada3d97ae8bc1845d3 | [
"BSD-3-Clause"
] | 395 | 2020-04-18T08:22:18.000Z | 2021-12-08T13:04:49.000Z | components/dom_distiller/content/renderer/distiller_native_javascript.h | cangulcan/src | 2b8388091c71e442910a21ada3d97ae8bc1845d3 | [
"BSD-3-Clause"
] | 338 | 2020-04-18T08:03:10.000Z | 2022-03-29T12:33:22.000Z | // 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 COMPONENTS_DOM_DISTILLER_CONTENT_RENDERER_DISTILLER_NATIVE_JAVASCRIPT_H_
#define COMPONENTS_DOM_DISTILLER_CONTENT_RENDERER_DISTILLER_NATIVE_JAVASCRIPT_H_
#include "components/dom_distiller/content/common/distiller_javascript_service.mojom.h"
#include "content/public/renderer/render_frame.h"
#include "content/public/renderer/render_frame_observer.h"
#include "v8/include/v8.h"
namespace dom_distiller {
// This class is the primary interface for custom JavaScript introduced by the
// dom-distiller. Callbacks for JavaScript functionality and the communication
// channel to the browser process are maintained here.
class DistillerNativeJavaScript {
public:
explicit DistillerNativeJavaScript(content::RenderFrame* render_frame);
~DistillerNativeJavaScript();
// Add the "distiller" JavaScript object and its functions to the current
// |RenderFrame|.
void AddJavaScriptObjectToFrame(v8::Local<v8::Context> context);
private:
// Add a function to the provided object.
template <typename Sig>
void BindFunctionToObject(v8::Isolate* isolate,
v8::Local<v8::Object> javascript_object,
const std::string& name,
const base::Callback<Sig> callback);
// Make sure the mojo service is connected.
void EnsureServiceConnected();
content::RenderFrame* render_frame_;
mojom::DistillerJavaScriptServicePtr distiller_js_service_;
};
// static
v8::Local<v8::Object> GetOrCreateDistillerObject(v8::Isolate* isolate,
v8::Local<v8::Object> global);
} // namespace dom_distiller
#endif // COMPONENTS_DOM_DISTILLER_CONTENT_RENDERER_DISTILLER_NATIVE_JAVASCRIPT_H_
| 39.3125 | 87 | 0.748278 |
3181aa03afb1225a26a63cd525a070464cc03b63 | 1,632 | h | C | planning/motion/waypoint_maker/include/waypoint_saver.h | project-aslan/autoware.ai | d8ee1bfb4f36fb7f789f6f90b10c2f6007128d8b | [
"Apache-2.0"
] | 2 | 2021-01-29T18:07:18.000Z | 2021-08-16T16:11:22.000Z | planning/motion/waypoint_maker/include/waypoint_saver.h | project-aslan/autoware.ai | d8ee1bfb4f36fb7f789f6f90b10c2f6007128d8b | [
"Apache-2.0"
] | 1 | 2020-09-25T14:15:25.000Z | 2020-10-12T12:15:22.000Z | planning/motion/waypoint_maker/include/waypoint_saver.h | project-aslan/autoware.ai | d8ee1bfb4f36fb7f789f6f90b10c2f6007128d8b | [
"Apache-2.0"
] | null | null | null | #include <ros/ros.h>
#include <geometry_msgs/PoseStamped.h>
#include <visualization_msgs/Marker.h>
#include <visualization_msgs/MarkerArray.h>
#include <message_filters/subscriber.h>
#include <message_filters/synchronizer.h>
#include <message_filters/sync_policies/approximate_time.h>
#include <std_msgs/Float32.h>
#include <tf/transform_datatypes.h>
#include <fstream>
#include "waypoint_follower/libwaypoint_follower.h"
static const int SYNC_FRAMES = 50;
typedef message_filters::sync_policies::ApproximateTime<geometry_msgs::TwistStamped, geometry_msgs::PoseStamped>
TwistPoseSync;
class WaypointSaver
{
public:
WaypointSaver(const ros::NodeHandle& nh, const ros::NodeHandle& private_nh);
~WaypointSaver();
int RUN(int argc, char **argv);
private:
// functions
void TwistPoseCallback(const geometry_msgs::TwistStampedConstPtr &twist_msg,
const geometry_msgs::PoseStampedConstPtr &pose_msg) const;
void poseCallback(const geometry_msgs::PoseStampedConstPtr &pose_msg) const;
void displayMarker(geometry_msgs::Pose pose, double velocity) const;
void outputProcessing(geometry_msgs::Pose current_pose, double velocity) const;
// handle
ros::NodeHandle nh_;
ros::NodeHandle private_nh_;
// publisher
ros::Publisher waypoint_saver_pub_;
// subscriber
message_filters::Subscriber<geometry_msgs::TwistStamped> *twist_sub_;
message_filters::Subscriber<geometry_msgs::PoseStamped> *pose_sub_;
message_filters::Synchronizer<TwistPoseSync> *sync_tp_;
// variables
bool save_velocity_;
double interval_;
std::string filename_, pose_topic_, velocity_topic_;
}; | 31.384615 | 112 | 0.782475 |
2efe585257835fba669ca8577e1e40fb1ce5273b | 11,079 | h | C | 25mt/tpl/XMLDocument2.h | johnoel/tagest | be0a6b164683c448c90f0c3952343f5963eece3d | [
"BSD-2-Clause"
] | 3 | 2015-08-26T17:14:02.000Z | 2015-11-17T04:18:56.000Z | 25mt/tpl/XMLDocument2.h | johnoel/tagest | be0a6b164683c448c90f0c3952343f5963eece3d | [
"BSD-2-Clause"
] | 10 | 2015-08-20T00:51:05.000Z | 2016-11-16T19:14:48.000Z | 25mt/tpl/XMLDocument2.h | johnoel/tagest | be0a6b164683c448c90f0c3952343f5963eece3d | [
"BSD-2-Clause"
] | 3 | 2016-11-16T00:52:23.000Z | 2021-09-10T02:17:40.000Z | /*
* $Id: XMLDocument2.h 2624 2009-10-29 02:19:27Z jsibert $
* Copyright©2005 University of Hawaii, Pelagic Fisheries Research Program
*/
#ifndef __XMLDocument2_h__
#define __XMLDocument2_h__
#include <fvar.hpp>
#include <iostream>
#include <string>
#include <stdexcept>
#include <cstdlib>
#include <sstream>
#include <iomanip>
#include "trace.h"
/// @cond TellsDoxygenToSkipThese
using std::cout;
using std::cerr;
using std::endl;
using std::string;
using std::atoi;
//using std::atof;
using std::strtod;
using std::runtime_error;
using std::istringstream;
using std::setprecision;
/// @endcond
#include <libxml/tree.h>
#include <libxml/parser.h>
#include <libxml/xpath.h>
#include <libxml/xpathInternals.h>
class XMLDocument2 {
public:
/**
\author Johnoel Ancheta
*/
XMLDocument2() {
doc = 0;
context = 0;
xmlInitParser();
}
/**
*
*/
XMLDocument2(const XMLDocument2& p) {
cerr << "Error: " << __FILE__ << ':' << __LINE__ << '\n';
}
/**
*
*/
virtual ~XMLDocument2() {
if (doc != 0) {
xmlFreeDoc(doc);
doc = 0;
}
if (context != 0) {
xmlXPathFreeContext(context);
context = 0;
}
xmlCleanupParser();
}
public:
/**
* import a parfile into document
* @param parfile filename
*/
int read(const char* parfile) throw (runtime_error) {
if (parfile == 0) {
return -1;
}
doc = xmlParseFile(parfile);
if (doc == NULL) {
throw runtime_error("Error: \n");
}
context = xmlXPathNewContext(doc);
if (context == 0) {
throw runtime_error("Error: \n");
}
return 1;
}
/**
* @param xpath absolute element xpath
* @param value set xpath with the values in this dvector
*/
bool set(const string& xpath, const dvector& value)
{
std::ostringstream ostr;
ostr << endl;
for (int i = value.indexmin(); i <= value.indexmax(); i++)
{
ostr << " " << setprecision(16) << value(i);
//if ((i>1) && (i%4 == 1))
if (i%4 == 0)
ostr << endl;
}
ostr << endl;
return set(xpath,ostr.str());
}
/**
* @param xpath absolute element xpath
* @param value set xpath with this value
*/
bool set(const string& xpath, const string& value) {
string xpathfull = "/par" + xpath;
TRACE(xpathfull)
xmlXPathObject* xpathObj = xmlXPathEvalExpression((xmlChar*)xpathfull.c_str(), context);
if (xpathObj == 0) {
return false;
}
if (xpathObj->type == XPATH_NODESET) {
xmlNodeSet* xmlnodeset = xpathObj->nodesetval;
const int max = xmlnodeset->nodeNr;
for (int i = 0; i < max; i++) {
xmlNode* xmlnode = xmlnodeset->nodeTab[i];
if (xmlnode != 0 && xmlnode->children) {
if (xmlnode->children->content != 0) {
delete xmlnode->children->content;
xmlnode->children->content = 0;
}
xmlnode->children->content = xmlCharStrdup(value.c_str());
}
}
}
return true;
}
/**
* @param xpath absolute element xpath
* @param attribute name of attribute
* @param value set xpath with this value
*/
bool set(const string& xpath, const string& attribute, const int value) {
std::ostringstream ostr;
ostr << setprecision(6) << value;
return set(xpath, attribute, ostr.str());
}
/**
* @param xpath absolute element xpath
* @param value set xpath with this value
*/
bool set(const string& name, const double value)
{
TTRACE(name,value)
std::ostringstream ostr;
ostr << setprecision(16) << value;
return setContent(name, ostr.str());
}
/**
* @param xpath absolute element xpath
* @param value set xpath with this value
*/
bool setContent(const string& name, const string& value)
{
TTRACE(name,value)
string xpathfull = "/FIT/" + name + "/value";
TRACE(xpathfull)
xmlXPathObject* xpathObj = xmlXPathEvalExpression((xmlChar*)xpathfull.c_str(), context);
if (xpathObj == 0) {
return false;
}
if (xpathObj->type == XPATH_NODESET)
{
xmlNodeSet* xmlnodeset = xpathObj->nodesetval;
const int max = xmlnodeset->nodeNr;
for (int i = 0; i < max; i++)
{
xmlNode* xmlnode = xmlnodeset->nodeTab[i];
TTRACE(i,(const xmlChar*)xmlnode->name)
TTRACE(i,(char*)xmlnode->children->content)
if (xmlnode != 0 && xmlnode->children)
{
xmlnode->children->content = xmlCharStrdup(value.c_str());
}
TTRACE(i,(char*)xmlnode->children->content)
TTRACE(i,(const xmlChar*)xmlnode->name)
}
}
xmlXPathFreeObject(xpathObj);
return true;
}
/**
* @param xpath absolute element xpath
* @param attribute name of attribute
* @param value set xpath with this value
*/
bool set(const string& xpath, const string& attribute, const string& value) {
string xpathfull = "/par" + xpath;
xmlXPathObject* xpathObj = xmlXPathEvalExpression((xmlChar*)xpathfull.c_str(), context);
if (xpathObj == 0) {
return false;
}
if (xpathObj->type == XPATH_NODESET) {
xmlNodeSet* xmlnodeset = xpathObj->nodesetval;
const int max = xmlnodeset->nodeNr;
for (int i = 0; i < max; i++) {
xmlNode* xmlnode = xmlnodeset->nodeTab[i];
if (xmlnode != 0) {
for (xmlAttr *attributenode = xmlnode->properties; attributenode != 0; attributenode = attributenode->next) {
if (attribute.compare(string((char*)attributenode->name)) == 0) {
attributenode->children->content = xmlCharStrdup(value.c_str());
}
}
}
}
}
xmlXPathFreeObject(xpathObj);
return true;
}
string itoa(const int i) const {
string s;
return s;
}
/**
* @param xpath absolute element xpath
* @param array index
*/
int getInteger(const string& xpath, const int idx) const throw (runtime_error) {
int i = 0;
string value = get(xpath, idx);
if (!value.empty()) {
i = atoi(value.c_str());
} else {
throw runtime_error("Error: XPath=\"" + xpath + "\" with index=\"" + string(itoa(idx)) + "\" does not exist.\n");
}
return i;
}
/**
* @param xpath absolute element xpath
* @param array index
*/
double getDouble(const string& name, const int idx) const throw (runtime_error) {
string xpath = string("/variable/name/")+name;
TRACE(xpath)
double d = 0;
string value = get(xpath, idx);
if (!value.empty()) {
//d = atof(value.c_str());
d = strtod(value.c_str(),0);
} else {
throw runtime_error("Error: XPath=\"" + xpath + "\" with index=\"" + string(itoa(idx)) + "\" does not exist.\n");
}
return d;
}
/**
* @param xpath absolute element xpath
* @param lb minimum valid index of dvector
* @param ub maximum valid index of dvector
* @return dvector
*/
dvector getDvector(const string& xpath, const int lb, const int ub) const throw (runtime_error)
{
dvector d(lb,ub);
for (int i = lb; i <= ub; i++)
{
d(i) = getDouble(xpath, i-lb);
}
return d;
}
/**
* @param xpath absolute element xpath
* @param array index
*/
string get(const string& xpath, const int idx) const {
string value;
istringstream is(get(xpath));
for (int count = 0; is && count <= idx; count++) {
value.clear();
is >> value;
}
return value;
}
/**
* @param xpath absolute element xpath
*/
string get(const string& xpath) const {
string value;
string xpathfull = "/FIT" + xpath;
TRACE(xpathfull)
xmlXPathObject* xpathObj = xmlXPathEvalExpression((xmlChar*)xpathfull.c_str(), context);
TRACE(xpathObj)
if (xpathObj == 0) {
return value;
}
if (xpathObj->type == XPATH_NODESET) {
xmlNodeSet* xmlnodeset = xpathObj->nodesetval;
const int max = xmlnodeset->nodeNr;
for (int i = 0; i < max; i++) {
xmlNode* xmlnode = xmlnodeset->nodeTab[i];
if (xmlnode != 0 && xmlnode->children)
{
TTRACE(i,(const xmlChar*)xmlnode->name)
TTRACE(i,(char*)xmlnode->children->content)
value += (char*)xmlnode->children->content;
//value = string((char*)xmlnode->children);
//TTRACE(i,(char*)xmlnode->children
//value = string((char*)xmlnode->children->content);
}
}
}
return value;
}
/**
* @param xpath absolute element xpath
* @param attribute name of attribute
*/
string get(const string& xpath, const string& attribute) const {
string value;
string xpathfull = "/par" + xpath;
xmlXPathObject* xpathObj = xmlXPathEvalExpression((xmlChar*)xpathfull.c_str(), context);
if (xpathObj == 0) {
return value;
}
if (xpathObj->type == XPATH_NODESET) {
xmlNodeSet* xmlnodeset = xpathObj->nodesetval;
const int max = xmlnodeset->nodeNr;
for (int i = 0; i < max; i++) {
xmlNode* xmlnode = xmlnodeset->nodeTab[i];
if (xmlnode != 0) {
for (xmlAttr *attributenode = xmlnode->properties; attributenode != 0; attributenode = attributenode->next) {
if (attribute.compare(string((char*)attributenode->name)) == 0 && attributenode->children != 0) {
value += string((char*)attributenode->children->content);
}
}
}
}
}
xmlXPathFreeObject(xpathObj);
return value;
}
/**
* @param xpath absolute element xpath
*/
double getDouble(const string& name) const throw (runtime_error) {
string xpath = "/"+name+"/value";
TRACE(xpath)
double d = 0;
string s = get(xpath);
if (!s.empty()) {
//d = atof(s.c_str());
d = strtod(s.c_str(),0);
} else {
throw runtime_error("Error: XPath=\"" + xpath + "\" does not exist.\n");
}
return d;
}
/**
* @param xpath absolute element xpath
*/
double getDouble(const string& xpath, const string& attribute) const throw (runtime_error) {
double d = 0;
string s = get(xpath, attribute);
if (!s.empty()) {
//d = atof(s.c_str());
d = strtod(s.c_str(),0);
} else {
throw runtime_error("Error: XPath=\"" + xpath + "\" with attribute=\"" + attribute + "\" does not exist.\n");
}
return d;
}
/**
* @param xpath absolute element xpath
*/
int getInteger(const string& xpath) const throw (runtime_error) {
int integer = 0;
string s = get(xpath);
if (!s.empty()) {
integer = atoi(s.c_str());
} else {
throw runtime_error("Error: XPath=\"" + xpath + "\" does not exist.\n");
}
return integer;
}
/**
* @param xpath absolute element xpath
*/
int getInteger(const string& xpath, const string& attribute) const throw (runtime_error) {
int integer = 0;
string s = get(xpath, attribute);
if (!s.empty()) {
integer = atoi(s.c_str());
} else {
throw runtime_error("Error: XPath=\"" + xpath + "\" with attribute=\"" + attribute + "\" does not exist.\n");
}
return integer;
}
/**
* write the contents of doc to parfile
* @param xpath absolute element xpath
*/
int write(const char* parfile)
{
const int nbyte = xmlSaveFile(parfile, doc);
return nbyte;
}
private:
xmlDoc* doc;
xmlXPathContext* context;
};
#endif
| 24.511062 | 121 | 0.606192 |
c8435839b07c96fc26308857e5fb81ba6e4f1df3 | 803 | h | C | src/Infrastructure/src/Emulator/Cores/tlib/include/osdep.h | UPBIoT/renode-iot | 397603b4921af29d67ff94526c88dc02c47dea32 | [
"MIT"
] | 3 | 2020-11-30T08:22:04.000Z | 2020-12-01T00:57:12.000Z | src/Infrastructure/src/Emulator/Cores/tlib/include/osdep.h | UPBIoT/renode-iot | 397603b4921af29d67ff94526c88dc02c47dea32 | [
"MIT"
] | null | null | null | src/Infrastructure/src/Emulator/Cores/tlib/include/osdep.h | UPBIoT/renode-iot | 397603b4921af29d67ff94526c88dc02c47dea32 | [
"MIT"
] | null | null | null | #ifndef QEMU_OSDEP_H
#define QEMU_OSDEP_H
#include <stdarg.h>
#include <stddef.h>
#include <stdint.h>
#include <stdbool.h>
#include <math.h>
#include <string.h>
#include <sys/time.h>
#ifndef glue
#define xglue(x, y) x ## y
#define glue(x, y) xglue(x, y)
#define stringify(s) tostring(s)
#define tostring(s) #s
#endif
#ifndef likely
#ifdef __GNUC__
#define __builtin_expect(x, n) (x)
#endif
#define likely(x) __builtin_expect(!!(x), 1)
#define unlikely(x) __builtin_expect(!!(x), 0)
#endif
#ifdef CONFIG_NEED_OFFSETOF
#define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *) 0)->MEMBER)
#error
#endif
#ifndef ARRAY_SIZE
#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
#endif
#ifdef __i386__
#define REGPARM __attribute((regparm(3)))
#else
#define REGPARM
#endif
#endif
| 17.844444 | 63 | 0.683686 |
083724331d43760876f34cd7ef0cb305a39597fb | 11,575 | c | C | tools/font/build/single_font_files/u8g2_font_cu12_hf.c | HendryKaak/u8g2 | 731eecdd8a0863561ee354128e92566f1e63774b | [
"BSD-2-Clause"
] | 1 | 2022-01-13T18:50:55.000Z | 2022-01-13T18:50:55.000Z | tools/font/build/single_font_files/u8g2_font_cu12_hf.c | HendryKaak/u8g2 | 731eecdd8a0863561ee354128e92566f1e63774b | [
"BSD-2-Clause"
] | null | null | null | tools/font/build/single_font_files/u8g2_font_cu12_hf.c | HendryKaak/u8g2 | 731eecdd8a0863561ee354128e92566f1e63774b | [
"BSD-2-Clause"
] | 1 | 2019-01-08T22:17:51.000Z | 2019-01-08T22:17:51.000Z | /*
Fontname: -MUTT-ClearlyU-Medium-R-Normal--17-120-100-100-P-123-ISO10646-1
Copyright: 2001 Computing Research Lab, New Mexico State University.
Glyphs: 191/8453
BBX Build Mode: 1
*/
const uint8_t u8g2_font_cu12_hf[3911] U8G2_FONT_SECTION("u8g2_font_cu12_hf") =
"\277\1\4\2\5\5\1\3\6\21\24\0\374\13\374\14\375\2\134\5?\17. \7\205F\371|\12!\14"
"\205F\371\60\215\337c\354q\0\42\21\207\306\371\4\221L$\23\311D\62\221<o\0#$\214\6\373"
",#\301H.\22\214\4#\241\301A*\22\214\4#\251\301A(\22\214\4#\271H\60\222\307\0$"
"\34\210\6\372\340\330(Q\223\250I\324$b:Y\42\223\250I\324$\212fy\64\0%#\216\206\373"
"\254e\241\210&\25I\14R\221L,R\250\11\327\10#e\231H*\24I\205\42\241\230\236\1&!"
"\215F\373l\245\221d$\31I&\242\222AJ\23KdR\231D,\223\210i\212\6\211=S\0'"
"\10\204\6\371\230\336\63(\17\206\206\371\360PU(\325g\251X\31\0)\17\206\206\371\320XU,\325"
"G\251P)\0*\21\207\306\371\24\231HE\233M\242IM\236\63\0+\16\213\306\372|\24m\66\70"
"\213\266\247\3,\13\205F\371\334jD\65A\0-\12\207\306\371\274\35\344Y\1.\12\205F\371\334j"
"\364\70\0/\20\210\6\372\204\271X\256Y\256Y\256Y.\5\60\27\207\306\371t\243D\246$\23\311D"
"\62\221L$\23\311T\204\366\4\61\15\207\306\371\204\241Y\64\320\303\1\62\25\207\306\371t\233\222L"
"$\23K\305R%\231Hd\240\207\3\63\23\207\306\371t\233\222L\254H\27\213d\42\231\314\236\0\64"
"\27\211F\372\214t\262D,\221\212\204$\241\301 \26,\33\350\351\0\65\25\207\306\371d\231\310 \23"
"\213\15\62\222XI&R\244\247\0\66\25\207\306\371\204\242H&\25\33dJ\62\221L$S\21\332\23"
"\67\22\210\6\372\64\271\301$\24\311\304re\271\356\311\0\70\25\207\306\371t\233\222L$S\21\332\224"
"d\42\231H&\263'\71\27\207\306\371t\243D\246$\23\311D\62\231A,\225\211\204\364\24\0:\14"
"\207\306\371\234\251\364X\225\236\0;\14\205F\371,\64z\214QM\20<\12\206\206\371\264\241\316\272'"
"=\17\215F\373\374|p\220'\36\34\344y\4>\13\206\206\371t\261\216\272'\2?\20\210\6\372D"
"\243L\263\272\230\236@\246'\3@)\214\6\373\354\6\271P*\42\311D\42\212H\42\224\210$B\211"
"H\42\224\210$B\211H\211\42\23Q\250R\252\201\236\31\0A\33\213\306\372\34D\223\211`\42\230\310"
"eb\231\330@U\224\212\14\62\203<\71\0B\35\212\206\372\254\6\3Q*\23\213\304\42\251\314`\224"
"\312\304\42\261H*\61\30\350\211\1C\30\212\206\372,\7\211LH\22K\344\22\311v\221X&\224\32"
"\344\211\1D\35\212\206\372\254\6\203TH\223\312\304\42\261H,\22\213\304\42\251LH\61\30\344\251\1"
"E\35\213\306\372l\7G\251P*\224I\204\62\261\201,\23\311\224dR\241Tdp\317\0F\31\212"
"\206\372\314\6\67\251L*S\221\251\32\250\62\251L*\231\33\350\311\1G\32\213\306\372\314\7\211PH"
"\23\213\344\42\321\252A\42\227\211\205R\251\301\236\1H\26\214\6\373\134\14\24\3M\252_\15\6\251\376"
"f\240\30\350\331\0I\16\206\206\371\24\3M\252\277\31\350\221\0J\17\207\306\371t\3Q\254\337D\62"
"{\12\0K\36\214\6\373\134\14$\203L\252(\226\311E\202\211\235$\27\212\205b\251\314@\62\310\263"
"\1L\24\210\6\372\244\3U\256G\221P$\24\311\14\16\362$\0M'\217\306\373\274\30\304\6\31\231"
"J\246J\204\22\251D(\221Jd\42\251H\253H\253\214&\225\321d\6\12\305@\317\1N!\214\6"
"\373\134l\6\32QJ\224JdR\211L*R\225I\244\62\211TH\25\322\14\64yV\0O\32\213"
"\306\372\314\7\261PY$\230\10&\202\211`\42\30\211\205\312\6y&\0P\27\212\206\372\314\6\3Q"
"H\223\312\244\62!\315`\224l\67\320\223\3Q\35\213\306\372\314\7\261PY$\230\10&\202\211`\42"
"\30ILB\22\331 Z\22\24\3R\33\214\6\373\134\14\6\271P,\325Ql\240\313\310B\261P,"
"\24\32h\366l\0S\26\207\306\371t\3E(\21J\344r\272\212P\42\224\30\350\341\0T\23\212\206"
"\372\314\6\27\231\212LE\246*\331\273\201\236\30U\22\214\6\373\134\14\24\3M\252\377\237e\202{v"
"\0V\32\214\6\373\134\14\62\203L\252Y&\227\311e\202\211d\42\231\210f\363\14\1W$\221F\374"
"\274\35d&\203LH\224\12\211R\231H&\26i\27i\27i\227\10%\202\42\245H\31\313s\14X"
"\35\214\6\373\134\14\42\203T&\27I&\222\332h\42\250\10fb\251\314 \63\310\263\1Y\27\214\6"
"\373\134\14\62\203L*\226\311e\202\211\344\64\333r\240g\6Z\31\210\6\372\264\203AB\23\11E\62"
"\271XM\223P$\243\30\14\362$\0[\14\205F\371\260I\250\377G\13\0\134\20\210\6\372D\271`"
"\256a\256a\256a.\1]\13\205F\371\250Q\377\237L\0^\14\206\206\371\340\320$\223\347\15\0_"
"\14\214\6\373\374?\35\34\350\221\0`\13\206\206\371\340\224*\226\347\30a\22\207\306\371\134m\312\62\203"
"H&\222\311\14\364h\0b\25\207\306\371pYg\203LI&\222\211d\42\231\310 \17\7c\16\206"
"\206\371l'\231D\252Md\17\5d\26\207\306\371$\262n\6\221L$\23\311D\62\221Lf\240G"
"\3e\20\206\206\371l'\231\304@\221\252\211\354\241\0f\17\206\206\371\340I\253\242A&\325\321\36\13"
"g\27\210\6\372<\30H\62\275\31\204r\3I*\221J\244\42\3\5\0h\20\210\6\372\64\272\356\6"
"\241L\377d\261'\1i\14\204\6\371\60\211T\323\223=\2j\16\205F\371`\215Z\324/\42\211\35"
"\0k\25\210\6\372\64\272^\14\42E\211\324*!\212d\26{\22\0l\13\204\6\371\20M\377\311\36"
"\1m\20\214\6\373\374h\240\30e\372\377dq\317\6n\16\210\6\372\134\17D\231\376\311bO\2o"
"\22\206\206\371l'\231D&\221Id\22\231\310\36\12p\25\207\306\371\34\15\64%\231H&\222\211d"
"\42\203L,\65\5q\25\207\306\371\134\15\42\231H&\222\211d\42\231\314 V\265\3r\17\206\206\371"
"L\25\31E$\325h\220\207\2s\21\206\206\371l\7\211L\42\66Kd\22\203<\24t\21\207\306\371"
"\14bE\3Q\254I&\22\322\303\1u\16\210\6\372\134K\64\375G\3=\11\0v\21\211F\372\274"
"\233l\42\251H*\22\323\331S\2w\25\213\306\372|\271\70i\224h\224h\224h\245\220e\362L\0"
"x\21\211F\372\274\233l\42\61\235Y$\63\331\223\1y\24\211F\372\274\233l\42\251H*\22\323\331"
"\245\42\251\71\0z\17\206\206\371L\7\212H\243\222\26\3=\22{\15\206\206\371hM\252\67\262T\237"
"\11|\10\203\306\350\221\376}\16\205F\371(U\250W\222P\237h\0~\16\210\6\372D\221L\242"
"&\222\347'\0\240\7\205F\371|\12\241\13\205F\371d\32=\306\337\1\242\26\207\306\371\14c\241M"
"\242$\21J\204\22!If\24\313c\0\243\30\211F\372\304\262H(\23\12\306\6\262`Y\42\223H"
"H\42\366\204\0\244\24\211F\372LS\231\201(\23\312\204\62\241\201&\225\347\10\245\32\214\6\373\34\14"
"\62\203L*\226\11&b\203\263inp\227M\16\364\354\0\246\12\203\306\350\221>\214\364\1\247\23\206"
"\206\371(M\244*\246\211\364F\226\212\324\350\261\0\250\11\206\206\371 \205{>\251\34\212\206\372\64\3"
"Q*\22\31$\332$\332$Z%j\22%\223\252\320@\317\61\0\252\17\205F\371\20Ud\21\211,"
"\6y\246\0\253\24\211F\372<\215\204\42!\205F\241R\250\42\261H\236\16\254\13\210\6\372<\33\354"
"\332\63\2\255\11\205F\371\34\354\351\0\256\36\212\206\372\64\3Q*\222\30D\22\221\212\222\212\222I\42"
"RQ\261(I\205\6z\216\1\257\12\207\306\371\360\201\236_\0\260\14\206\206\371`M\244\215\236k\0"
"\261\20\211F\372\314\203U\203A*X>\30\344\31\262\15\205F\371\20IQM\315 \317\12\263\17\205"
"F\371\20IQ&\225\210D\364\314\0\264\12\206\206\271!Q=\237\0\265\17\210\6\372\134g\372\67\12"
"E\223\272r\0\266$\210\6\372\324\3\311\42\62HD\6\211\310 \221Y\204\24\251D*\221J\244\22"
"\251D*\221J\244\22\11\0\267\12\204\6\371\204\22=\31\0\270\12\207\306\371\374\64\27Z\2\271\13\204"
"\6\351\21M'{R\0\272\20\205F\371\20IE$\21\211H\6y\246\0\273\24\210\6\372\134GR"
"\221\220B\244\220(\64\221L$O\5\274\35\214\6\373\234D\65\271L.\223\313\224,\62\262H\42\226"
"\210\304\22\3Q\252h\317\6\275\33\214\6\373\234D\65\271L.\223\313\304\26\31Y\244\252Q*\24\313"
"\14\362l\0\276\36\215F\373\334I#\225\221`&\31\311D*\62&\25\271D$\227\30\250\312B{"
"v\0\277\20\210\6\372\314ez\2Y.V\227\11m\1\300\36\213\306JQi\66\217\212&\23\301D"
"\60\221\313\304\62\261\201\252(\25\31d\6yr\0\301\35\213\306jIe=.\232L\4\23\301D."
"\23\313\304\6\252\242Td\220\31\344\311\1\302\37\213\306\372\210\344.\223\7E\223\211`\42\230\310eb"
"\231\330@U\224\212\14\62\203<\71\0\303 \213\306\372\200H,Q\26\311\243\242\311D\60\21L\344\62"
"\261Ll\240*JE\6\231A\236\34\304\37\213\306\372P\205L\241\7E\223\211`\42\230\310eb\231"
"\330@U\224\212\14\62\203<\71\0\305\37\213\306\372\10a$\27\11*\243\311D\60\21L\344\62\261L"
"l\240*JE\6\231A\236\34\306(\217\306\373<\32\234%B\262D*\226\310$R\221Ln\60\320"
"E\62\221P$\23\311T\205\62\251\310 \61\30\350\71\1\307\32\212\206\372,\7\211LH\22K\344\22"
"\311v\221X&\224\32\344\242\271\65\0\310!\213\306:Qi\66\217\30\34\245B\251P&\21\312\304\6"
"\262L$S\222I\205R\221\301=\13\0\311 \213\306ZIe=fp\224\12\245B\231D(\23\33"
"\310\62\221LI&\25JE\6\367,\0\312!\213\306\372\200\344.\223\7<J\205R\241L\42\224\211"
"\15d\231H\246$\223\12\245\42\203{\26\0\313!\213\306\372H\205L\241\7<J\205R\241L\42\224"
"\211\15d\231H\246$\223\12\245\42\203{\26\0\314\20\206\206))U,\70\320\244\372\233\201\36\11\315"
"\20\206\206I!Q\351@\223\352o\6z$\0\316\20\206\206\231\241I&\67\320\244\372\233\201\36\11\317"
"\17\206\206\331\12w\3M\252\277\31\350\221\0\320\36\213\306\372L\7\203XH\224\12\305\62\261\304@\224"
"\211eb\231T($\31\14\362l\0\321'\214\6\373\210H.Q\27\311C\66\3\215(%J%\62"
"\251D&\25\251\312$R\231D*\244\12i\6\232<\63\0\322\37\214\6KYm\70\17\33\344B\251"
"X&\30\11F\202\221`$\230\211\245B\271A\236\35\0\323\36\214\6{Qi=n\220\13\245b\231"
"`$\30\11F\202\221`&\226\12\345\6yv\0\324\37\214\6\373\220\350\60\223G\15r\241T,\23"
"\214\4#\301H\60\22\314\304R\241\334 \317\16\325!\214\6\373\210H.Q\27\311\303\6\271P*\226"
"\11F\202\221`$\30\11fb\251Pn\220g\7\326\37\214\6\373`\205N\241G\15r\241T,\23"
"\214\4#\301H\60\22\314\304R\241\334 \317\16\327\21\211F\372\274Ke\252\22\271\212T\246*O\7"
"\330!\214\6\373\214c\3Y(\25JdR\221\242L$\243\211dB\221\252L\42\224\12\305\6\262<"
"\3\331\25\214\6[Ym\70\17\31(\6\232T\377?\313\4\367\354\0\332\24\214\6{Qi=h\240"
"\30hR\375\377,\23\334\263\3\333\26\214\6\373\230\350\60\223G\14\24\3M\252\377\237e\202{v\0"
"\334\26\214\6\373h\205N\241G\14\24\3M\252\377\237e\202{v\0\335\32\214\6kQi=h\220"
"\31dR\261L.\23L$\247\331\226\3=;\0\336\30\212\206\372\254\6\272\344@\25\252\312\244\62\251"
"L(\64P\345\6z\6\337\32\207\306\371\24\242H&\222\211d\42\21\205&\222)\311D\62\221L\302"
"\36\16\340\25\207\306\371\4\61Y.\273)\313\14\42\231H&\63\320\243\1\341\24\207\306\371$)U\365"
"\246,\63\210d\42\231\314@\217\6\342\24\207\306\371\204\251M\351\246,\63\210d\42\231\314@\217\6\343"
"\25\207\306\371t\221\212\222\332MYf\20\311D\62\231\201\36\15\344\25\207\306\371\324\12\211B\272)\313"
"\14\42\231H&\63\320\243\1\345\27\207\306\371\204\242H&\22\22m\312\62\203H&\222\311\14\364h\0"
"\346\25\213\306\372|;\231d\64\251\301d\20\313\304\62\232\310=\3\347\20\206\206\371l'\231D\252M"
"d\24\313\354\0\350\23\206\206\371\330\224*\226\234d\22\3E\252&\262\207\2\351\22\206\206\371\350\220\250"
"v\222I\14\24\251\232\310\36\12\352\23\206\206\371\64\241I&\70\311$\6\212TMd\17\5\353\22\206"
"\206\371t\12\207\223Lb\240H\325D\366P\0\354\16\204\6\371\210\214&\24\323\364d\217\0\355\15\205"
"F\371\310\214\246P\324\233=\14\356\16\205F\371\340\314\42\23\23\365f\17\3\357\15\206\206\371d\12\207"
"\252\36\355\261\0\360\30\206\206\371\330Df\62Ke\6\211L\42\223\310$\62\211Ld\17\5\361\23\210"
"\6\372\304\221L\242&\22\36\210\62\375\223\305\236\4\362\26\206\206\371\330\224*\226\234d\22\231D&\221"
"Id\42{(\0\363\25\206\206\371\350\220\250v\222Id\22\231D&\221\211\354\241\0\364\26\206\206\371"
"\64\241I&\70\311$\62\211L\42\223\310D\366P\0\365\25\206\206\371$\25\235$'\231D&\221I"
"d\22\231\310\36\12\366\24\206\206\371t\12\207\223L\42\223\310$\62\211Ld\17\5\367\20\213\306\372|"
"\36\315C\6\367\220h\236\21\0\370\22\206\206\371LB\231ID\321\277\220D\66\241<\2\371\21\210\6"
"\372D\71]\60,\321\364\37\15\364$\0\372\20\210\6\372t\61Y\265D\323\64\320\223\0\373\21\210"
"\6\372\344\261Q&*\321\364\37\15\364$\0\374\21\210\6\372\254\24\32\205T\242\351?\32\350I\0\375"
"\26\211F\372\304\71]\371d\23IER\221\230\316.\25I\315\1\376\27\207\306\371pYg\203LI"
"&\222\211d\42\231\310 \23KM\1\377\27\211F\372\214\25\42\205v\262\211\244\42\251HLg\227\212"
"\244\346\0\0\0\0";
| 88.358779 | 107 | 0.672484 |
aecf580e93a37201518ce4661b59583db43c430d | 2,686 | h | C | src/pack.h | acured/Test | 765a62975b8933e35be70105fd14043ee336e958 | [
"Apache-2.0"
] | null | null | null | src/pack.h | acured/Test | 765a62975b8933e35be70105fd14043ee336e958 | [
"Apache-2.0"
] | null | null | null | src/pack.h | acured/Test | 765a62975b8933e35be70105fd14043ee336e958 | [
"Apache-2.0"
] | null | null | null | /*
* Copyright (C) 2009-2011 the libgit2 contributors
*
* This file is part of libgit2, distributed under the GNU GPL v2 with
* a Linking Exception. For full terms see the included COPYING file.
*/
#ifndef INCLUDE_pack_h__
#define INCLUDE_pack_h__
#include "git2/oid.h"
#include "common.h"
#include "map.h"
#include "mwindow.h"
#include "odb.h"
#define GIT_PACK_FILE_MODE 0444
#define PACK_SIGNATURE 0x5041434b /* "PACK" */
#define PACK_VERSION 2
#define pack_version_ok(v) ((v) == htonl(2) || (v) == htonl(3))
struct git_pack_header {
uint32_t hdr_signature;
uint32_t hdr_version;
uint32_t hdr_entries;
};
/*
* The first four bytes of index formats later than version 1 should
* start with this signature, as all older git binaries would find this
* value illegal and abort reading the file.
*
* This is the case because the number of objects in a packfile
* cannot exceed 1,431,660,000 as every object would need at least
* 3 bytes of data and the overall packfile cannot exceed 4 GiB with
* version 1 of the index file due to the offsets limited to 32 bits.
* Clearly the signature exceeds this maximum.
*
* Very old git binaries will also compare the first 4 bytes to the
* next 4 bytes in the index and abort with a "non-monotonic index"
* error if the second 4 byte word is smaller than the first 4
* byte word. This would be true in the proposed future index
* format as idx_signature would be greater than idx_version.
*/
#define PACK_IDX_SIGNATURE 0xff744f63 /* "\377tOc" */
struct git_pack_idx_header {
uint32_t idx_signature;
uint32_t idx_version;
};
struct git_pack_file {
git_mwindow_file mwf;
git_map index_map;
uint32_t num_objects;
uint32_t num_bad_objects;
git_oid *bad_object_sha1; /* array of git_oid */
int index_version;
git_time_t mtime;
unsigned pack_local:1, pack_keep:1, has_cache:1;
git_oid sha1;
git_vector cache;
/* something like ".git/objects/pack/xxxxx.pack" */
char pack_name[GIT_FLEX_ARRAY]; /* more */
};
struct git_pack_entry {
off_t offset;
git_oid sha1;
struct git_pack_file *p;
};
int git_packfile_unpack_header(
size_t *size_p,
git_otype *type_p,
git_mwindow_file *mwf,
git_mwindow **w_curs,
off_t *curpos);
int git_packfile_unpack(git_rawobj *obj, struct git_pack_file *p, off_t *obj_offset);
off_t get_delta_base(struct git_pack_file *p, git_mwindow **w_curs,
off_t *curpos, git_otype type,
off_t delta_obj_offset);
void packfile_free(struct git_pack_file *p);
int git_packfile_check(struct git_pack_file **pack_out, const char *path);
int git_pack_entry_find(
struct git_pack_entry *e,
struct git_pack_file *p,
const git_oid *short_oid,
unsigned int len);
#endif
| 26.86 | 85 | 0.753537 |
83a344b0509a1e328e80f5172f4178a5156ceeba | 2,613 | h | C | Source/Widgets/VirtualPad.h | AndiPhotonen/eXaDrums | eb46a59dd12037812cfa041e964c9595350f62d3 | [
"BSD-3-Clause"
] | 22 | 2017-06-05T06:26:32.000Z | 2022-03-21T17:44:04.000Z | Source/Widgets/VirtualPad.h | AndiPhotonen/eXaDrums | eb46a59dd12037812cfa041e964c9595350f62d3 | [
"BSD-3-Clause"
] | 3 | 2019-01-01T19:08:07.000Z | 2021-04-24T20:21:38.000Z | Source/Widgets/VirtualPad.h | AndiPhotonen/eXaDrums | eb46a59dd12037812cfa041e964c9595350f62d3 | [
"BSD-3-Clause"
] | 5 | 2018-05-10T06:54:26.000Z | 2022-03-30T01:00:41.000Z | /*
* VirtualInstrument.h
*
* Created on: 13 Jan 2019
* Author: jeremy
*/
#ifndef SOURCE_WIDGETS_VIRTUALPAD_H_
#define SOURCE_WIDGETS_VIRTUALPAD_H_
#include <gtkmm/grid.h>
#include <gtkmm/button.h>
#include <gtkmm/entry.h>
#include <gtkmm/label.h>
#include <string>
#include <functional>
#include <algorithm>
#include <memory>
namespace Widgets
{
class VirtualPad : public Gtk::Grid
{
public:
VirtualPad(std::string const& name, std::vector<std::function<void()>>&& soundsVec)
{
// Register functions that play sounds
for(auto&& f : soundsVec)
{
sounds.emplace_back(std::move(f));
}
const size_t nbTrigs = sounds.size();
// Prepare keys vector
keys.resize(nbTrigs);
// Create buttons and entries
for(size_t i = 0; i < nbTrigs; ++i)
{
// Add button to vector
if(nbTrigs > 1)
{
buttons.emplace_back(name + " (Trig." + std::to_string(i) + ")");
}
else
{
buttons.emplace_back(name);
}
// Connect button signal
buttons.back().signal_clicked().connect(sounds[i], false);
// Add entry to vector
shortcuts.emplace_back();
// Connect entry signal
shortcuts.back().signal_changed().connect([&, i]{ keys[i] = shortcuts[i].get_text(); });
}
// Attach buttons and entries
for(size_t i = 0; i < buttons.size(); ++i)
{
buttons[i].set_hexpand();
shortcuts[i].set_tooltip_text("Keyboard shortcuts (2 max) for this trigger.");
shortcuts[i].set_max_width_chars(3);
shortcuts[i].set_max_length(2);
shortcuts[i].set_width_chars(3);
if(i == 0)
{
this->attach(buttons[i], 0, 0, 1, 1);
this->attach_next_to(shortcuts[i], buttons[i], Gtk::PositionType::POS_RIGHT, 1, 1);
}
else
{
this->attach_next_to(buttons[i], buttons[i-1], Gtk::PositionType::POS_BOTTOM, 1, 1);
this->attach_next_to(shortcuts[i], buttons[i], Gtk::PositionType::POS_RIGHT, 1, 1);
}
}
this->set_halign(Gtk::Align::ALIGN_FILL);
this->show_all();
}
virtual ~VirtualPad() = default;
void PlaySound(char k) const
{
auto kIt = std::find_if(keys.begin(), keys.end(), [&] (const auto& key) { return key.find(k) != std::string::npos; });
if(kIt != keys.end())
{
const size_t index = kIt - keys.begin();
if(sounds[index])
{
sounds[index]();
}
}
}
private:
std::vector<std::function<void()>> sounds;
std::vector<Gtk::Button> buttons;
std::vector<Gtk::Entry> shortcuts;
std::vector<std::string> keys;
};
using VirtualPadPtr = std::unique_ptr<VirtualPad>;
}
#endif /* SOURCE_WIDGETS_VIRTUALPAD_H_ */
| 20.904 | 121 | 0.628396 |
265e5786295b517469c710f6f2ca37ff261f5015 | 22,865 | c | C | generic/json_types.c | mpcjanssen/rl_json | d0923adb69168b956a8de8770d8759814632e6e1 | [
"TCL"
] | 34 | 2015-03-05T21:40:02.000Z | 2022-02-05T18:12:07.000Z | generic/json_types.c | mpcjanssen/rl_json | d0923adb69168b956a8de8770d8759814632e6e1 | [
"TCL"
] | 36 | 2015-04-13T06:47:19.000Z | 2021-11-25T09:11:54.000Z | generic/json_types.c | mpcjanssen/rl_json | d0923adb69168b956a8de8770d8759814632e6e1 | [
"TCL"
] | 12 | 2016-11-27T01:03:26.000Z | 2021-10-31T08:54:33.000Z | #include "rl_jsonInt.h"
#include "parser.h"
static void free_internal_rep(Tcl_Obj* obj, Tcl_ObjType* objtype);
static void dup_internal_rep(Tcl_Obj* src, Tcl_Obj* dest, Tcl_ObjType* objtype);
static void update_string_rep(Tcl_Obj* obj, Tcl_ObjType* objtype);
static int set_from_any(Tcl_Interp* interp, Tcl_Obj* obj, Tcl_ObjType** objtype, enum json_types* type);
extern Tcl_ObjType json_object;
extern Tcl_ObjType json_array;
extern Tcl_ObjType json_string;
extern Tcl_ObjType json_number;
extern Tcl_ObjType json_bool;
extern Tcl_ObjType json_null;
extern Tcl_ObjType json_dyn_string;
extern Tcl_ObjType json_dyn_number;
extern Tcl_ObjType json_dyn_bool;
extern Tcl_ObjType json_dyn_json;
extern Tcl_ObjType json_dyn_template;
extern Tcl_ObjType json_dyn_literal;
static void free_internal_rep_object(Tcl_Obj* obj) { free_internal_rep(obj, &json_object); }
static void dup_internal_rep_object(Tcl_Obj* src, Tcl_Obj* dest) { dup_internal_rep(src, dest, &json_object); }
static void update_string_rep_object(Tcl_Obj* obj) { update_string_rep(obj, &json_object); }
static void free_internal_rep_array(Tcl_Obj* obj) { free_internal_rep(obj, &json_array); }
static void dup_internal_rep_array(Tcl_Obj* src, Tcl_Obj* dest) { dup_internal_rep(src, dest, &json_array); }
static void update_string_rep_array(Tcl_Obj* obj) { update_string_rep(obj, &json_array); }
static void free_internal_rep_string(Tcl_Obj* obj) { free_internal_rep(obj, &json_string); }
static void dup_internal_rep_string(Tcl_Obj* src, Tcl_Obj* dest) { dup_internal_rep(src, dest, &json_string); }
static void update_string_rep_string(Tcl_Obj* obj);
static void free_internal_rep_number(Tcl_Obj* obj) { free_internal_rep(obj, &json_number); }
static void dup_internal_rep_number(Tcl_Obj* src, Tcl_Obj* dest) { dup_internal_rep(src, dest, &json_number); }
static void update_string_rep_number(Tcl_Obj* obj);
static void free_internal_rep_bool(Tcl_Obj* obj) { free_internal_rep(obj, &json_bool); }
static void dup_internal_rep_bool(Tcl_Obj* src, Tcl_Obj* dest) { dup_internal_rep(src, dest, &json_bool); }
static void update_string_rep_bool(Tcl_Obj* obj);
static void free_internal_rep_null(Tcl_Obj* obj) { free_internal_rep(obj, &json_null); }
static void dup_internal_rep_null(Tcl_Obj* src, Tcl_Obj* dest) { dup_internal_rep(src, dest, &json_null); }
static void update_string_rep_null(Tcl_Obj* obj);
static void free_internal_rep_dyn_string(Tcl_Obj* obj) { free_internal_rep(obj, &json_dyn_string); }
static void dup_internal_rep_dyn_string(Tcl_Obj* src, Tcl_Obj* dest) { dup_internal_rep(src, dest, &json_dyn_string); }
static void update_string_rep_dyn_string(Tcl_Obj* obj) { update_string_rep(obj, &json_dyn_string); }
static void free_internal_rep_dyn_number(Tcl_Obj* obj) { free_internal_rep(obj, &json_dyn_number); }
static void dup_internal_rep_dyn_number(Tcl_Obj* src, Tcl_Obj* dest) { dup_internal_rep(src, dest, &json_dyn_number); }
static void update_string_rep_dyn_number(Tcl_Obj* obj) { update_string_rep(obj, &json_dyn_number); }
static void free_internal_rep_dyn_bool(Tcl_Obj* obj) { free_internal_rep(obj, &json_dyn_bool); }
static void dup_internal_rep_dyn_bool(Tcl_Obj* src, Tcl_Obj* dest) { dup_internal_rep(src, dest, &json_dyn_bool); }
static void update_string_rep_dyn_bool(Tcl_Obj* obj) { update_string_rep(obj, &json_dyn_bool); }
static void free_internal_rep_dyn_json(Tcl_Obj* obj) { free_internal_rep(obj, &json_dyn_json); }
static void dup_internal_rep_dyn_json(Tcl_Obj* src, Tcl_Obj* dest) { dup_internal_rep(src, dest, &json_dyn_json); }
static void update_string_rep_dyn_json(Tcl_Obj* obj) { update_string_rep(obj, &json_dyn_json); }
static void free_internal_rep_dyn_template(Tcl_Obj* obj) { free_internal_rep(obj, &json_dyn_template); }
static void dup_internal_rep_dyn_template(Tcl_Obj* src, Tcl_Obj* dest) { dup_internal_rep(src, dest, &json_dyn_template); }
static void update_string_rep_dyn_template(Tcl_Obj* obj) { update_string_rep(obj, &json_dyn_template); }
static void free_internal_rep_dyn_literal(Tcl_Obj* obj) { free_internal_rep(obj, &json_dyn_literal); }
static void dup_internal_rep_dyn_literal(Tcl_Obj* src, Tcl_Obj* dest) { dup_internal_rep(src, dest, &json_dyn_literal); }
static void update_string_rep_dyn_literal(Tcl_Obj* obj);
Tcl_ObjType json_object = {
"JSON_object",
free_internal_rep_object,
dup_internal_rep_object,
update_string_rep_object,
NULL
};
Tcl_ObjType json_array = {
"JSON_array",
free_internal_rep_array,
dup_internal_rep_array,
update_string_rep_array,
NULL
};
Tcl_ObjType json_string = {
"JSON_string",
free_internal_rep_string,
dup_internal_rep_string,
update_string_rep_string,
NULL
};
Tcl_ObjType json_number = {
"JSON_number",
free_internal_rep_number,
dup_internal_rep_number,
update_string_rep_number,
NULL
};
Tcl_ObjType json_bool = {
"JSON_bool",
free_internal_rep_bool,
dup_internal_rep_bool,
update_string_rep_bool,
NULL
};
Tcl_ObjType json_null = {
"JSON_null",
free_internal_rep_null,
dup_internal_rep_null,
update_string_rep_null,
NULL
};
Tcl_ObjType json_dyn_string = {
"JSON_dyn_string",
free_internal_rep_dyn_string,
dup_internal_rep_dyn_string,
update_string_rep_dyn_string,
NULL
};
Tcl_ObjType json_dyn_number = {
"JSON_dyn_number",
free_internal_rep_dyn_number,
dup_internal_rep_dyn_number,
update_string_rep_dyn_number,
NULL
};
Tcl_ObjType json_dyn_bool = {
"JSON_dyn_bool",
free_internal_rep_dyn_bool,
dup_internal_rep_dyn_bool,
update_string_rep_dyn_bool,
NULL
};
Tcl_ObjType json_dyn_json = {
"JSON_dyn_json",
free_internal_rep_dyn_json,
dup_internal_rep_dyn_json,
update_string_rep_dyn_json,
NULL
};
Tcl_ObjType json_dyn_template = {
"JSON_dyn_template",
free_internal_rep_dyn_template,
dup_internal_rep_dyn_template,
update_string_rep_dyn_template,
NULL
};
Tcl_ObjType json_dyn_literal = {
"JSON_dyn_literal",
free_internal_rep_dyn_literal,
dup_internal_rep_dyn_literal,
update_string_rep_dyn_literal,
NULL
};
Tcl_ObjType* g_objtype_for_type[JSON_TYPE_MAX];
int JSON_IsJSON(Tcl_Obj* obj, enum json_types* type, Tcl_ObjIntRep** ir) //{{{
{
enum json_types t;
Tcl_ObjIntRep* _ir = NULL;
for (t=JSON_OBJECT; t<JSON_TYPE_MAX && _ir==NULL; t++)
_ir = Tcl_FetchIntRep(obj, g_objtype_for_type[t]);
t--;
if (_ir == NULL)
return 0;
*ir = _ir;
*type = t;
return 1;
}
//}}}
int JSON_GetIntrepFromObj(Tcl_Interp* interp, Tcl_Obj* obj, enum json_types* type, Tcl_ObjIntRep** ir) //{{{
{
enum json_types t;
Tcl_ObjIntRep* _ir = NULL;
Tcl_ObjType* objtype = NULL;
if (!JSON_IsJSON(obj, &t, &_ir)) {
TEST_OK(set_from_any(interp, obj, &objtype, &t));
_ir = Tcl_FetchIntRep(obj, objtype);
if (_ir == NULL) Tcl_Panic("Could not retrieve the intrep we just created");
}
*type = t;
*ir = _ir;
return TCL_OK;
}
//}}}
int JSON_GetJvalFromObj(Tcl_Interp* interp, Tcl_Obj* obj, enum json_types* type, Tcl_Obj** val) //{{{
{
Tcl_ObjIntRep* ir = NULL;
TEST_OK(JSON_GetIntrepFromObj(interp, obj, type, &ir));
*val = ir->twoPtrValue.ptr1;
return TCL_OK;
}
//}}}
int JSON_SetIntRep(Tcl_Obj* target, enum json_types type, Tcl_Obj* replacement) //{{{
{
Tcl_ObjIntRep intrep;
Tcl_ObjType* objtype = NULL;
if (Tcl_IsShared(target))
Tcl_Panic("Called JSON_SetIntRep on a shared object");
objtype = g_objtype_for_type[type];
Tcl_FreeIntRep(target);
intrep.twoPtrValue.ptr1 = replacement; // ptr1 is the Tcl_Obj holding the Tcl structure for this value
if (replacement) Tcl_IncrRefCount((Tcl_Obj*)intrep.twoPtrValue.ptr1);
intrep.twoPtrValue.ptr2 = NULL; // ptr2 holds the template actions, if any have been generated for this value
Tcl_StoreIntRep(target, objtype, &intrep);
Tcl_InvalidateStringRep(target);
return TCL_OK;
}
//}}}
#ifdef TCL_MEM_DEBUG
Tcl_Obj* JSON_DbNewJvalObj(enum json_types type, Tcl_Obj* val, const char* file, int line)
#else
Tcl_Obj* JSON_NewJvalObj(enum json_types type, Tcl_Obj* val)
#endif
{ //{{{
#ifdef TCL_MEM_DEBUG
Tcl_Obj* res = Tcl_DbNewObj(file, line);
#else
Tcl_Obj* res = Tcl_NewObj();
#endif
/*
switch (type) {
case JSON_OBJECT:
case JSON_ARRAY:
case JSON_STRING:
case JSON_NUMBER:
case JSON_BOOL:
case JSON_NULL:
case JSON_DYN_STRING:
case JSON_DYN_NUMBER:
case JSON_DYN_BOOL:
case JSON_DYN_JSON:
case JSON_DYN_TEMPLATE:
case JSON_DYN_LITERAL:
break;
default:
Tcl_Panic("JSON_NewJvalObj, unhandled type: %d", type);
}
*/
if (JSON_SetIntRep(res, type, val) != TCL_OK)
Tcl_Panic("Couldn't set JSON intrep");
return res;
}
//}}}
static void free_internal_rep(Tcl_Obj* obj, Tcl_ObjType* objtype) //{{{
{
Tcl_ObjIntRep* ir = NULL;
ir = Tcl_FetchIntRep(obj, objtype);
if (ir != NULL) {
release_tclobj((Tcl_Obj**)&ir->twoPtrValue.ptr1);
release_tclobj((Tcl_Obj**)&ir->twoPtrValue.ptr2);
#if 0
//Tcl_Obj* ir_obj = ir->twoPtrValue.ptr1;
Tcl_Obj* actions = ir->twoPtrValue.ptr2;
if (ir->twoPtrValue.ptr1) {
/*
fprintf(stderr, "%s Releasing ptr1 %p, refcount %d, which is %s\n",
objtype->name, ir->twoPtrValue.ptr1, ir_obj == NULL ? -42 : ir_obj->refCount,
ir_obj->typePtr ? ir_obj->typePtr->name : "pure string"
);
*/
Tcl_DecrRefCount((Tcl_Obj*)ir->twoPtrValue.ptr1); ir->twoPtrValue.ptr1 = NULL;}
if (ir->twoPtrValue.ptr2 && actions->refCount > 0) {
/*
fprintf(stderr, "%s Releasing ptr2 %p, refcount %d, which is %s\n",
objtype->name, ir->twoPtrValue.ptr2, actions == NULL ? -42 : actions->refCount,
actions->typePtr ? actions->typePtr->name : "pure string"
);
*/
Tcl_DecrRefCount((Tcl_Obj*)ir->twoPtrValue.ptr2); ir->twoPtrValue.ptr2 = NULL;}
#endif
}
}
//}}}
static void dup_internal_rep(Tcl_Obj* src, Tcl_Obj* dest, Tcl_ObjType* objtype) //{{{
{
Tcl_ObjIntRep* srcir = NULL;
Tcl_ObjIntRep destir;
srcir = Tcl_FetchIntRep(src, objtype);
if (srcir == NULL)
Tcl_Panic("dup_internal_rep asked to duplicate for type, but that type wasn't available on the src object");
if (src == srcir->twoPtrValue.ptr1) {
int len;
const char* str = Tcl_GetStringFromObj((Tcl_Obj*)srcir->twoPtrValue.ptr1, &len);
// Don't know how this happens yet, but it's bad news - we get into an endless recursion of duplicateobj calls until the stack blows up
// Panic and go via the string rep
Tcl_IncrRefCount((Tcl_Obj*)(destir.twoPtrValue.ptr1 = Tcl_NewStringObj(str, len)));
} else {
destir.twoPtrValue.ptr1 = srcir->twoPtrValue.ptr1;
}
destir.twoPtrValue.ptr2 = srcir->twoPtrValue.ptr2;
if (destir.twoPtrValue.ptr1) Tcl_IncrRefCount((Tcl_Obj*)destir.twoPtrValue.ptr1);
if (destir.twoPtrValue.ptr2) Tcl_IncrRefCount((Tcl_Obj*)destir.twoPtrValue.ptr2);
Tcl_StoreIntRep(dest, objtype, &destir);
}
//}}}
static void update_string_rep(Tcl_Obj* obj, Tcl_ObjType* objtype) //{{{
{
Tcl_ObjIntRep* ir = Tcl_FetchIntRep(obj, objtype);
struct serialize_context scx;
Tcl_DString ds;
if (ir == NULL)
Tcl_Panic("dup_internal_rep asked to duplicate for type, but that type wasn't available on the src object");
Tcl_DStringInit(&ds);
scx.ds = &ds;
scx.serialize_mode = SERIALIZE_NORMAL;
scx.fromdict = NULL;
scx.l = NULL;
scx.allow_null = 1;
serialize(NULL, &scx, obj);
obj->length = Tcl_DStringLength(&ds);
obj->bytes = ckalloc(obj->length + 1);
memcpy(obj->bytes, Tcl_DStringValue(&ds), obj->length);
obj->bytes[obj->length] = 0;
Tcl_DStringFree(&ds); scx.ds = NULL;
}
//}}}
static void update_string_rep_string(Tcl_Obj* obj) //{{{
{
update_string_rep(obj, &json_string);
/*
Tcl_ObjIntRep* ir = Tcl_FetchIntRep(obj, &json_string);
const char* str;
int len;
str = Tcl_GetStringFromObj((Tcl_Obj*)ir->twoPtrValue.ptr1, &len);
obj->bytes = ckalloc(len+3);
obj->bytes[0] = '"';
memcpy(obj->bytes+1, str, len);
obj->bytes[len+1] = '"';
obj->bytes[len+2] = 0;
obj->length = len+2;
*/
}
//}}}
static void update_string_rep_number(Tcl_Obj* obj) //{{{
{
Tcl_ObjIntRep* ir = Tcl_FetchIntRep(obj, &json_number);
const char* str;
int len;
if (ir->twoPtrValue.ptr1 == obj)
Tcl_Panic("Turtles all the way down!");
str = Tcl_GetStringFromObj((Tcl_Obj*)ir->twoPtrValue.ptr1, &len);
obj->bytes = ckalloc(len+1);
memcpy(obj->bytes, str, len+1);
obj->length = len;
}
//}}}
static void update_string_rep_bool(Tcl_Obj* obj) //{{{
{
Tcl_ObjIntRep* ir = Tcl_FetchIntRep(obj, &json_bool);
int boolval;
if (Tcl_GetBooleanFromObj(NULL, (Tcl_Obj*)ir->twoPtrValue.ptr1, &boolval) != TCL_OK)
Tcl_Panic("json_bool's intrep tclobj is not a boolean");
if (boolval) {
obj->bytes = ckalloc(5);
memcpy(obj->bytes, "true", 5);
obj->length = 4;
} else {
obj->bytes = ckalloc(6);
memcpy(obj->bytes, "false", 6);
obj->length = 5;
}
}
//}}}
static void update_string_rep_null(Tcl_Obj* obj) //{{{
{
obj->bytes = ckalloc(5);
memcpy(obj->bytes, "null", 5);
obj->length = 4;
}
//}}}
static void update_string_rep_dyn_literal(Tcl_Obj* obj) //{{{
{
update_string_rep(obj, &json_dyn_literal);
/*
Tcl_ObjIntRep* ir = Tcl_FetchIntRep(obj, &json_dyn_literal);
const char* str;
int len;
str = Tcl_GetStringFromObj((Tcl_Obj*)ir->twoPtrValue.ptr1, &len);
obj->bytes = ckalloc(len+6);
obj->bytes[0] = '"';
obj->bytes[1] = '~';
obj->bytes[2] = 'L';
obj->bytes[3] = ':';
memcpy(obj->bytes+4, str, len);
obj->bytes[len+4] = '"';
obj->bytes[len+5] = 0;
obj->length = len+5;
*/
}
//}}}
static int set_from_any(Tcl_Interp* interp, Tcl_Obj* obj, Tcl_ObjType** objtype, enum json_types* out_type) //{{{
{
struct interp_cx* l = NULL;
const unsigned char* err_at = NULL;
const char* errmsg = "Illegal character";
size_t char_adj = 0; // Offset addjustment to account for multibyte UTF-8 sequences
const unsigned char* doc;
enum json_types type;
Tcl_Obj* val = NULL;
const unsigned char* p;
const unsigned char* e;
const unsigned char* val_start;
int len;
struct parse_context cx[CX_STACK_SIZE];
enum extensions extensions = EXT_COMMENTS;
struct parse_error details = {};
if (interp)
l = Tcl_GetAssocData(interp, "rl_json", NULL);
#if 1
// Snoop on the intrep for clues on optimized conversions {{{
{
if (
l && (
(l->typeInt && Tcl_FetchIntRep(obj, l->typeInt) != NULL) ||
(l->typeDouble && Tcl_FetchIntRep(obj, l->typeDouble) != NULL) ||
(l->typeBignum && Tcl_FetchIntRep(obj, l->typeBignum) != NULL)
)
) {
Tcl_ObjIntRep ir = {.twoPtrValue = {}};
// Must dup because obj will soon be us, creating a circular ref
replace_tclobj((Tcl_Obj**)&ir.twoPtrValue.ptr1, Tcl_DuplicateObj(obj));
release_tclobj((Tcl_Obj**)&ir.twoPtrValue.ptr2);
*out_type = JSON_NUMBER;
*objtype = g_objtype_for_type[JSON_NUMBER];
Tcl_StoreIntRep(obj, *objtype, &ir);
return TCL_OK;
}
}
// Snoop on the intrep for clues on optimized conversions }}}
#endif
cx[0].prev = NULL;
cx[0].last = cx;
cx[0].hold_key = NULL;
cx[0].container = JSON_UNDEF;
cx[0].val = NULL;
cx[0].char_ofs = 0;
cx[0].closed = 0;
cx[0].l = l;
cx[0].mode = PARSE;
p = doc = (const unsigned char*)Tcl_GetStringFromObj(obj, &len);
e = p + len;
// Skip BOM
if (
len >= 3 &&
p[0] == 0xef &&
p[1] == 0xbb &&
p[2] == 0xbf
) {
p += 3;
}
// Skip leading whitespace and comments
if (skip_whitespace(&p, e, &errmsg, &err_at, &char_adj, extensions) != 0) goto whitespace_err;
while (p < e) {
if (cx[0].last->container == JSON_OBJECT) { // Read the key if in object mode {{{
const unsigned char* key_start = p;
size_t key_start_char_adj = char_adj;
if (value_type(l, doc, p, e, &char_adj, &p, &type, &val, &details) != TCL_OK) goto err;
switch (type) {
case JSON_DYN_STRING:
case JSON_DYN_NUMBER:
case JSON_DYN_BOOL:
case JSON_DYN_JSON:
case JSON_DYN_TEMPLATE:
case JSON_DYN_LITERAL:
/* Add back the template format prefix, since we can't store the type
* in the dict key. The template generation code reparses it later.
*/
{
Tcl_Obj* new = Tcl_ObjPrintf("~%c:%s", key_start[2], Tcl_GetString(val));
replace_tclobj(&val, new);
// Can do this because val's ref is on loan from new_stringobj_dedup
//val = Tcl_ObjPrintf("~%c:%s", key_start[2], Tcl_GetString(val));
}
// Falls through
case JSON_STRING:
replace_tclobj(&cx[0].last->hold_key, val);
break;
default:
parse_error(&details, "Object key is not a string", doc, (key_start-doc) - key_start_char_adj);
goto err;
}
if (unlikely(skip_whitespace(&p, e, &errmsg, &err_at, &char_adj, extensions) != 0)) goto whitespace_err;
if (unlikely(*p != ':')) {
parse_error(&details, "Expecting : after object key", doc, (p-doc) - char_adj);
goto err;
}
p++;
if (unlikely(skip_whitespace(&p, e, &errmsg, &err_at, &char_adj, extensions) != 0)) goto whitespace_err;
}
//}}}
val_start = p;
if (value_type(l, doc, p, e, &char_adj, &p, &type, &val, &details) != TCL_OK) goto err;
switch (type) {
case JSON_OBJECT:
push_parse_context(cx, JSON_OBJECT, (val_start - doc) - char_adj);
if (unlikely(skip_whitespace(&p, e, &errmsg, &err_at, &char_adj, extensions) != 0)) goto whitespace_err;
if (*p == '}') {
pop_parse_context(cx);
p++;
goto after_value;
}
continue;
case JSON_ARRAY:
push_parse_context(cx, JSON_ARRAY, (val_start - doc) - char_adj);
if (unlikely(skip_whitespace(&p, e, &errmsg, &err_at, &char_adj, extensions) != 0)) goto whitespace_err;
if (*p == ']') {
pop_parse_context(cx);
p++;
goto after_value;
}
continue;
case JSON_DYN_STRING:
case JSON_DYN_NUMBER:
case JSON_DYN_BOOL:
case JSON_DYN_JSON:
case JSON_DYN_TEMPLATE:
case JSON_DYN_LITERAL:
case JSON_STRING:
case JSON_BOOL:
case JSON_NULL:
case JSON_NUMBER:
append_to_cx(cx->last, JSON_NewJvalObj(type, val));
if (unlikely(cx->last->container != JSON_OBJECT && cx->last->container != JSON_ARRAY))
cx->last->container = type; // Record our type (at the document top-level)
break;
default:
Tcl_SetObjResult(interp, Tcl_ObjPrintf("Unexpected json value type: %d", type));
goto err;
}
after_value: // Yeah, goto. But the alternative abusing loops was worse
if (unlikely(skip_whitespace(&p, e, &errmsg, &err_at, &char_adj, extensions) != 0)) goto whitespace_err;
if (p >= e) break;
if (unlikely(cx[0].last->closed)) {
parse_error(&details, "Trailing garbage after value", doc, (p-doc) - char_adj);
goto err;
}
switch (cx[0].last->container) { // Handle eof and end-of-context or comma for array and object {{{
case JSON_OBJECT:
if (*p == '}') {
pop_parse_context(cx);
p++;
goto after_value;
} else if (unlikely(*p != ',')) {
parse_error(&details, "Expecting } or ,", doc, (p-doc) - char_adj);
goto err;
}
p++;
break;
case JSON_ARRAY:
if (*p == ']') {
pop_parse_context(cx);
p++;
goto after_value;
} else if (unlikely(*p != ',')) {
parse_error(&details, "Expecting ] or ,", doc, (p-doc) - char_adj);
goto err;
}
p++;
break;
default:
if (unlikely(p < e)) {
parse_error(&details, "Trailing garbage after value", doc, (p - doc) - char_adj);
goto err;
}
}
if (unlikely(skip_whitespace(&p, e, &errmsg, &err_at, &char_adj, extensions) != 0)) goto whitespace_err;
//}}}
}
if (unlikely(cx != cx[0].last || !cx[0].closed)) { // Unterminated object or array context {{{
switch (cx[0].last->container) {
case JSON_OBJECT:
parse_error(&details, "Unterminated object", doc, cx[0].last->char_ofs);
goto err;
case JSON_ARRAY:
parse_error(&details, "Unterminated array", doc, cx[0].last->char_ofs);
goto err;
default: // Suppress compiler warning
break;
}
}
//}}}
if (unlikely(cx[0].val == NULL)) {
err_at = doc;
errmsg = "No JSON value found";
goto whitespace_err;
}
//Tcl_FreeIntRep(obj);
{
Tcl_ObjType* top_objtype = g_objtype_for_type[cx[0].container];
Tcl_ObjIntRep* top_ir = Tcl_FetchIntRep(cx[0].val, top_objtype);
Tcl_ObjIntRep ir = {.twoPtrValue = {}};
if (unlikely(top_ir == NULL))
Tcl_Panic("Can't get intrep for the top container");
// We're transferring the ref from cx[0].val to our intrep
replace_tclobj((Tcl_Obj**)&ir.twoPtrValue.ptr1, top_ir->twoPtrValue.ptr1);
release_tclobj((Tcl_Obj**)&ir.twoPtrValue.ptr2);
release_tclobj(&cx[0].val);
Tcl_StoreIntRep(obj, top_objtype, &ir);
*objtype = top_objtype;
*out_type = cx[0].container;
}
release_tclobj(&val);
return TCL_OK;
whitespace_err:
parse_error(&details, errmsg, doc, (err_at - doc) - char_adj);
err:
if (details.errmsg)
throw_parse_error(interp, &details);
release_tclobj(&val);
free_cx(cx);
return TCL_ERROR;
}
//}}}
int type_is_dynamic(const enum json_types type) //{{{
{
switch (type) {
case JSON_DYN_STRING:
case JSON_DYN_NUMBER:
case JSON_DYN_BOOL:
case JSON_DYN_JSON:
case JSON_DYN_TEMPLATE:
case JSON_DYN_LITERAL:
return 1;
default:
return 0;
}
}
//}}}
Tcl_Obj* get_unshared_val(Tcl_ObjIntRep* ir) //{{{
{
if (ir->twoPtrValue.ptr1 != NULL && Tcl_IsShared((Tcl_Obj*)ir->twoPtrValue.ptr1))
replace_tclobj((Tcl_Obj**)&ir->twoPtrValue.ptr1, Tcl_DuplicateObj(ir->twoPtrValue.ptr1));
if (ir->twoPtrValue.ptr2) {
// The caller wants val unshared, which implies that they intend to
// change it, which would invalidate our cached template actions, so
// release those if we have them
release_tclobj((Tcl_Obj**)&ir->twoPtrValue.ptr2);
}
return ir->twoPtrValue.ptr1;
}
//}}}
int init_types(Tcl_Interp* interp) //{{{
{
// We don't define set_from_any callbacks for our types, so they must not be Tcl_RegisterObjType'ed
g_objtype_for_type[JSON_UNDEF] = NULL;
g_objtype_for_type[JSON_OBJECT] = &json_object;
g_objtype_for_type[JSON_ARRAY] = &json_array;
g_objtype_for_type[JSON_STRING] = &json_string;
g_objtype_for_type[JSON_NUMBER] = &json_number;
g_objtype_for_type[JSON_BOOL] = &json_bool;
g_objtype_for_type[JSON_NULL] = &json_null;
g_objtype_for_type[JSON_DYN_STRING] = &json_dyn_string;
g_objtype_for_type[JSON_DYN_NUMBER] = &json_dyn_number;
g_objtype_for_type[JSON_DYN_BOOL] = &json_dyn_bool;
g_objtype_for_type[JSON_DYN_JSON] = &json_dyn_json;
g_objtype_for_type[JSON_DYN_TEMPLATE] = &json_dyn_template;
g_objtype_for_type[JSON_DYN_LITERAL] = &json_dyn_literal;
return TCL_OK;
}
//}}}
/* Local Variables: */
/* tab-width: 4 */
/* c-basic-offset: 4 */
/* End: */
// vim: foldmethod=marker foldmarker={{{,}}} ts=4 shiftwidth=4
| 29.427284 | 137 | 0.69473 |
649e321f670fc57c2a3453a5f7daebcef1d8ea84 | 1,560 | h | C | LTSDK/sdk/ltrendererstats.h | crskycode/msLTBImporter | be8a04c5365746c46a1d7804909e04a741d86b44 | [
"MIT"
] | 3 | 2021-03-02T15:55:01.000Z | 2021-10-21T07:11:17.000Z | LTSDK/sdk/ltrendererstats.h | crskycode/msLTBImporter | be8a04c5365746c46a1d7804909e04a741d86b44 | [
"MIT"
] | 1 | 2021-09-27T02:38:49.000Z | 2021-11-06T16:09:21.000Z | LTSDK/sdk/ltrendererstats.h | crskycode/msLTBImporter | be8a04c5365746c46a1d7804909e04a741d86b44 | [
"MIT"
] | 1 | 2021-04-26T13:22:51.000Z | 2021-04-26T13:22:51.000Z | #ifndef __LTRENDERERSTATS_H__
#define __LTRENDERERSTATS_H__
struct LTRendererStats {
int TextureChanges;
int TextureChangeSaves;
//texture memory amounts
int WorldBaseTexMemory;
int WorldEnvMapTexMemory;
int WorldDetailTexMemory;
int WorldBumpMapTexMemory;
int WorldLightMapTexMemory;
int ModelTexMemory;
int SpriteTexMemory;
int ParticleTexMemory;
int PolyGridBaseTexMemory;
int PolyGridEnvMapTexMemory;
int PolyGridBumpMapTexMemory;
int VolumeEffectTexMemory;
int DrawPrimTexMemory;
int TotalUncompressedTexMemory;
int ModelRender_NumSkeletalRenderObjects;
int ModelRender_NumSkeletalPieces;
int ModelRender_NumRigidPieces;
int ModelRender_NumVertexAnimatedPieces;
int ModelRender_RenderStyleSets;
int ModelRender_TextureSets;
int ModelRender_LightingSets;
int ModelRender_ReallyCloseSets;
int ModelRender_ScaleSets;
//cull statistics
int ObjectsCullTested;
int ObjectsCulled;
int WorldBlocksCullTested;
int WorldBlocksCulled;
int InsideBoxCullCount;
int FrustumCulledCount;
int OccluderCulledCount;
int ModelTriangles;
int ParticleTriangles;
int WorldTriangles;
int SpriteTriangles;
int PolyGridTriangles;
int VolumeEffectTriangles;
int ModelShadowTriangles;
int DynamicLightTriangles;
int WorldTextureMem;
int ModelTextureMem;
int ParticleTextureMem;
int SpriteTextureMem;
int PolyGridTextureMem;
//scene counts
int SkyPortals;
int HardwareBlocks;
int Occluders;
int VisibleLights;
int RBSections;
//CRenderShader stats
int ShaderTris;
int ShaderVerts;
int ShaderDrawPrim;
int ShaderBatched;
};
#endif //! __LTRENDERERSTATS_H__
| 17.142857 | 41 | 0.854487 |
d94440bc5d3c34937015ff475456f8a8a6279999 | 1,504 | h | C | source/INIFileSettings.h | artur00231/INIFile | 009c8691bc2f323808aa69d84b1ac7657051537d | [
"MIT"
] | 1 | 2017-06-29T18:12:58.000Z | 2017-06-29T18:12:58.000Z | source/INIFileSettings.h | artur00231/INIFile | 009c8691bc2f323808aa69d84b1ac7657051537d | [
"MIT"
] | null | null | null | source/INIFileSettings.h | artur00231/INIFile | 009c8691bc2f323808aa69d84b1ac7657051537d | [
"MIT"
] | null | null | null | #ifndef INIFILESETTINGS_H
#define INIFILESETTINGS_H
#include <string>
#include <string_view>
#include "TextConversion.h"
namespace ini
{
struct INIFileSettings
{
using ConversionFuncion = std::string(*)(std::string_view);
INIFileSettings() {};
INIFileSettings(bool case_sensitivity, bool inline_section, bool type_identification, bool advanced_save_layout, ConversionFuncion tolower) :
case_sensitivity{ case_sensitivity },
inline_section{ inline_section },
type_identification{ type_identification },
advanced_save_layout{ advanced_save_layout },
tolower{ tolower } {};
INIFileSettings(bool case_sensitivity, bool inline_section, bool type_identification, bool advanced_save_layout) :
case_sensitivity{ case_sensitivity },
inline_section{ inline_section },
type_identification{ type_identification },
advanced_save_layout{ advanced_save_layout } {};
INIFileSettings(const INIFileSettings&) = default;
INIFileSettings& operator=(const INIFileSettings&) = default;
INIFileSettings(INIFileSettings&&) = default;
INIFileSettings& operator=(INIFileSettings&&) = default;
bool case_sensitivity{ true };
bool inline_section{ true }; // Enable array like section definition
bool type_identification{ true }; // Automatically cast property value
bool advanced_save_layout{ true }; // Add tabulators to show level of nesting
ConversionFuncion tolower = &DefaultTextConversion::tolower;
~INIFileSettings() {};
};
}
#endif // !INIFILESETTINGS_H
| 32 | 143 | 0.774601 |
83fafbe74502994ee344d5785a1df1b65fadab29 | 221 | h | C | Pods/Headers/Public/Braintree/Braintree-API.h | intelliot/BuyfromX | f7a1b04ea10f2aa3bfdd5cf2163c4e6e15b59881 | [
"MIT"
] | 1 | 2015-03-09T05:02:52.000Z | 2015-03-09T05:02:52.000Z | Pods/Headers/Public/Braintree/Braintree-API.h | intelliot/BuyfromX | f7a1b04ea10f2aa3bfdd5cf2163c4e6e15b59881 | [
"MIT"
] | 1 | 2015-03-08T06:47:01.000Z | 2015-03-08T07:03:21.000Z | Pods/Headers/Public/Braintree/Braintree-API.h | intelliot/BuyfromX | f7a1b04ea10f2aa3bfdd5cf2163c4e6e15b59881 | [
"MIT"
] | null | null | null | /// All-in-one import for the Braintree iOS SDK
#import <Braintree/BTClient.h>
#import <Braintree/BTLogger.h>
#import <Braintree/BTPaymentMethod.h>
#import <Braintree/BTErrors.h>
#import <Braintree/BTAppSwitchErrors.h>
| 27.625 | 48 | 0.773756 |
2fdac496e06d140b1c376ec4db214052fbd13aa1 | 1,527 | c | C | src/shell_cmd.c | onelife/Arduino_RT-Thread_Library | a56779a313d572b0ebc36fba3be5b4ff957b1be1 | [
"Apache-2.0"
] | null | null | null | src/shell_cmd.c | onelife/Arduino_RT-Thread_Library | a56779a313d572b0ebc36fba3be5b4ff957b1be1 | [
"Apache-2.0"
] | null | null | null | src/shell_cmd.c | onelife/Arduino_RT-Thread_Library | a56779a313d572b0ebc36fba3be5b4ff957b1be1 | [
"Apache-2.0"
] | null | null | null | /*
* Copyright (c) 2006-2018, RT-Thread Development Team
*
* SPDX-License-Identifier: Apache-2.0
*
* Change Logs:
* Date Author Notes
* 2010-03-22 Bernard first version
*/
#include "include/rtthread.h"
#ifdef RT_USING_FINSH
#include "components/finsh/finsh.h"
#if defined(CONFIG_ARDUINO)
# ifdef ADD_SHELL_CMD
# undef ADD_SHELL_CMD
# endif
// extern const syscall_func __fsym_##fn##_ptr = fn;
// insert function prototype
# ifdef FINSH_USING_DESCRIPTION
# define ADD_SHELL_CMD(fn) \
extern long fn(void); \
extern const char __fsym_##fn##_name[]; \
extern const char __fsym_##fn##_desc[];
# else /* FINSH_USING_DESCRIPTION */
# define ADD_SHELL_CMD(fn) \
extern long fn(void); \
extern const char __fsym_##fn##_name[];
# endif /* FINSH_USING_DESCRIPTION */
# include "shell_cmd.h"
# undef ADD_SHELL_CMD
// insert function table entry
# ifdef FINSH_USING_DESCRIPTION
# define ADD_SHELL_CMD(fn) \
{__fsym_##fn##_name, __fsym_##fn##_desc, (syscall_func)fn},
# else /* FINSH_USING_DESCRIPTION */
# define ADD_SHELL_CMD(fn) \
{__fsym_##fn##_name, (syscall_func)#fn},
# endif /* FINSH_USING_DESCRIPTION */
static struct finsh_syscall _syscall_table[] = {
#include "shell_cmd.h"
};
# undef ADD_SHELL_CMD
struct finsh_syscall *_syscall_table_begin = &_syscall_table[0];
struct finsh_syscall *_syscall_table_end = \
&_syscall_table[sizeof(_syscall_table) / sizeof(struct finsh_syscall)];
#endif /* CONFIG_ARDUINO */
#endif /* RT_USING_FINSH */
| 25.881356 | 75 | 0.705305 |
26d46f91ea2ae67f69f03a1ada44cb9262c728d6 | 4,326 | h | C | ExplorerXP/Sizebar/SizableReBar.h | avrionov/explorerxp | c68bf161bb77bf5c9b3476be0e795d23bb0b6b5f | [
"Apache-2.0"
] | 12 | 2016-11-10T01:21:48.000Z | 2022-02-16T00:03:50.000Z | ExplorerXP/Sizebar/SizableReBar.h | avrionov/explorerxp | c68bf161bb77bf5c9b3476be0e795d23bb0b6b5f | [
"Apache-2.0"
] | 4 | 2021-05-28T03:58:27.000Z | 2022-01-02T13:13:36.000Z | ExplorerXP/Sizebar/SizableReBar.h | avrionov/explorerxp | c68bf161bb77bf5c9b3476be0e795d23bb0b6b5f | [
"Apache-2.0"
] | 2 | 2016-12-21T15:06:39.000Z | 2022-01-26T08:43:44.000Z | /////////////////////////////////////////////////////////////////////////////
// SizableReBar.h: interface for the CSizableReBar class.
//
/////////////////////////////////////////////////////////////////////////////
// Copyright (c) 2001 by Nikolay Denisov. All rights reserved.
//
// This code is free for personal and commercial use, providing this
// notice remains intact in the source files and all eventual changes are
// clearly marked with comments.
//
// You must obtain the author's consent before you can include this code
// in a software library.
//
// No warrantee of any kind, express or implied, is included with this
// software; use at your own risk, responsibility for damages (if any) to
// anyone resulting from the use of this software rests entirely with the
// user.
//
// Please email bug reports, bug fixes, enhancements, requests and
// comments to: nick@actor.ru
/////////////////////////////////////////////////////////////////////////////
#ifndef __SIZABLEREBAR_H__
#define __SIZABLEREBAR_H__
#if _MSC_VER >= 1000
#pragma once
#endif // _MSC_VER >= 1000
#include "GlobalData.h"
/////////////////////////////////////////////////////////////////////////////
// CSizableReBar
class CSizableReBar : public CControlBar
{
// Construction
public:
CSizableReBar();
~CSizableReBar();
// Operations
public:
bool Create( CWnd* pParentWnd, UINT nID, DWORD dwStyle );
bool AddBar( CWnd* pBar, LPCTSTR pszText = 0, CBitmap* pbmp = 0,
DWORD dwStyle = RBBS_GRIPPERALWAYS | RBBS_FIXEDBMP,
LPCTSTR lpszTitle = 0, bool bAlwaysVisible = true );
bool AddBar( CWnd* pBar, COLORREF clrFore, COLORREF clrBack, LPCTSTR pszText = 0,
DWORD dwStyle = RBBS_GRIPPERALWAYS,
LPCTSTR lpszTitle = 0, bool bAlwaysVisible = true );
bool SetBkImage( CBitmap* pbmp );
void EnableContextMenu( bool bCommonPart = true, bool bCustomPart = true );
void LoadState( LPCTSTR lpszProfileName );
void SaveState( LPCTSTR lpszProfileName );
CReBarCtrl& GetReBarCtrl() const;
// Overrides
// ClassWizard generated virtual function overrides
//{{AFX_VIRTUAL(CSizableReBar)
public:
virtual CSize CalcFixedLayout(BOOL bStretch, BOOL bHorz);
virtual CSize CalcDynamicLayout(int nLength, DWORD dwMode);
protected:
virtual BOOL OnNotify(WPARAM wParam, LPARAM lParam, LRESULT* pResult);
//}}AFX_VIRTUAL
virtual void OnUpdateCmdUI( CFrameWnd* pTarget, BOOL bDisableIfNoHandler );
// Implementation
protected:
bool PostAddBar( CWnd* pBar, LPCTSTR lpszTitle, bool bAlwaysVisible );
UINT GetSizingEdgeHitCode() const;
bool GetSizingEdgeRect( const CRect& rcBar, CRect& rcEdge, UINT nHitTest ) const;
void StartTracking( UINT nHitTest, CPoint pt );
void StopTracking();
void OnTrackUpdateSize( CPoint pt );
// Implementation data
protected:
CReBar m_wndReBar;
UINT m_htEdge;
CSize m_szCurrent;
CSize m_szOld;
CPoint m_ptOld;
bool m_bTracking;
int m_cxEdge;
int m_cyEdge;
HBITMAP m_hbmBack;
bool m_bCommonPart;
bool m_bCustomPart;
struct BARINFO
{
UINT nID;
TCHAR szTitle[ MAX_PATH ];
bool bAlwaysVisible;
};
CArray< BARINFO, BARINFO& > m_aBars;
static LPCTSTR m_lpszStateInfoFormat;
static LPCTSTR m_lpszStateInfoEntry;
// Generated message map functions
protected:
//{{AFX_MSG(CSizableReBar)
afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
afx_msg void OnNcPaint();
afx_msg void OnNcCalcSize(BOOL bCalcValidRects, NCCALCSIZE_PARAMS FAR* lpncsp);
#if _MSC_VER >= 1400
afx_msg LRESULT OnNcHitTest(CPoint point);
#else
afx_msg UINT OnNcHitTest(CPoint point);
#endif
afx_msg void OnCaptureChanged(CWnd *pWnd);
afx_msg void OnMouseMove(UINT nFlags, CPoint point);
afx_msg void OnLButtonUp(UINT nFlags, CPoint point);
afx_msg void OnNcLButtonDown(UINT nHitTest, CPoint point);
afx_msg void OnSize(UINT nType, int cx, int cy);
afx_msg void OnContextMenu(CWnd* pWnd, CPoint point);
//}}AFX_MSG
DECLARE_MESSAGE_MAP();
};
/////////////////////////////////////////////////////////////////////////////
#endif // !__SIZABLEREBAR_H__
| 32.772727 | 85 | 0.63338 |
6c3bb8804f3e851dbac0121aac71cc9814aee11d | 4,035 | h | C | Modules/PhysX/RNPhysXInternals.h | uberpixel/Rayne | 94f601561aedfc3200e67ff9522f64fbc5ca4d8c | [
"MIT"
] | 13 | 2020-08-08T11:57:05.000Z | 2022-03-10T17:29:19.000Z | Modules/PhysX/RNPhysXInternals.h | uberpixel/Rayne | 94f601561aedfc3200e67ff9522f64fbc5ca4d8c | [
"MIT"
] | 1 | 2022-03-10T17:35:28.000Z | 2022-03-10T18:21:57.000Z | Modules/PhysX/RNPhysXInternals.h | uberpixel/Rayne | 94f601561aedfc3200e67ff9522f64fbc5ca4d8c | [
"MIT"
] | 3 | 2020-08-08T14:22:34.000Z | 2021-05-15T21:12:17.000Z | //
// RNPhysXInternals.h
// Rayne-PhysX
//
// Copyright 2017 by Überpixel. All rights reserved.
// Unauthorized use is punishable by torture, mutilation, and vivisection.
//
#ifndef __RAYNE_PHYSXINTERNALS_H_
#define __RAYNE_PHYSXINTERNALS_H_
#include "RNPhysX.h"
#include "PxPhysicsAPI.h"
namespace RN
{
class PhysXCompoundShape;
class PhysXCallback
{
public:
static physx::PxFilterFlags CollisionFilterShader(
physx::PxFilterObjectAttributes attributes0, physx::PxFilterData filterData0,
physx::PxFilterObjectAttributes attributes1, physx::PxFilterData filterData1,
physx::PxPairFlags& pairFlags, const void* constantBlock, physx::PxU32 constantBlockSize);
static physx::PxFilterFlags VehicleFilterShader(physx::PxFilterObjectAttributes attributes0, physx::PxFilterData filterData0, physx::PxFilterObjectAttributes attributes1, physx::PxFilterData filterData1, physx::PxPairFlags& pairFlags, const void* constantBlock, physx::PxU32 constantBlockSize);
static physx::PxQueryHitType::Enum VehicleQueryPreFilter(physx::PxFilterData filterData0, physx::PxFilterData filterData1, const void* constantBlock, physx::PxU32 constantBlockSize, physx::PxHitFlags& queryFlags);
};
class PhysXQueryFilterCallback : public physx::PxQueryFilterCallback
{
physx::PxQueryHitType::Enum preFilter(const physx::PxFilterData& filterData, const physx::PxShape* shape, const physx::PxRigidActor* actor, physx::PxHitFlags& queryFlags) final;
physx::PxQueryHitType::Enum postFilter(const physx::PxFilterData& filterData, const physx::PxQueryHit& hit) final;
};
class PhysXSimulationCallback : public physx::PxSimulationEventCallback
{
public:
void onConstraintBreak(physx::PxConstraintInfo* constraints, physx::PxU32 count) final {}
void onWake(physx::PxActor** actors, physx::PxU32 count) final {}
void onSleep(physx::PxActor** actors, physx::PxU32 count) final {}
void onContact(const physx::PxContactPairHeader& pairHeader, const physx::PxContactPair* pairs, physx::PxU32 nbPairs) final;
void onTrigger(physx::PxTriggerPair* pairs, physx::PxU32 count) final {}
void onAdvance(const physx::PxRigidBody*const* bodyBuffer, const physx::PxTransform* poseBuffer, const physx::PxU32 count) final {}
};
class PhysXKinematicControllerCallback : public physx::PxUserControllerHitReport, public physx::PxControllerFilterCallback, public physx::PxControllerBehaviorCallback
{
public:
void onShapeHit(const physx::PxControllerShapeHit &hit) final;
void onControllerHit(const physx::PxControllersHit& hit) final;
void onObstacleHit(const physx::PxControllerObstacleHit &hit) final;
bool filter(const physx::PxController& a, const physx::PxController& b) final;
physx::PxControllerBehaviorFlags getBehaviorFlags(const physx::PxShape& shape, const physx::PxActor& actor) final;
physx::PxControllerBehaviorFlags getBehaviorFlags(const physx::PxController& controller) final;
physx::PxControllerBehaviorFlags getBehaviorFlags(const physx::PxObstacle& obstacle) final;
};
/* class PhysXRaycastCallback : public physx::PxRaycastCallback
{
}*/
class PhysXVehicleInternal
{
public:
static void SetupWheelsSimulationData(const float wheelMass, PhysXCompoundShape *compoundShape, const float numWheels, const physx::PxVec3* wheelCenterActorOffsets, const physx::PxVec3& chassisCMOffset, const float chassisMass, physx::PxVehicleWheelsSimData* wheelsSimData, uint32 wheelRaycastGroup, uint32 wheelRaycastMask);
static void SetupDriveSimData4W(physx::PxVehicleDriveSimData4W *driveSimData, physx::PxVehicleWheelsSimData* wheelsSimData);
static void SetupVehicleActor(PhysXCompoundShape *compoundShape, const uint32 numWheels, const physx::PxVehicleChassisData& chassisData, const physx::PxFilterData& wheelSimFilterData, const physx::PxFilterData& chassisSimFilterData, physx::PxRigidDynamic *vehActor);
static physx::PxVehicleDrivableSurfaceToTireFrictionPairs* CreateFrictionPairs(const physx::PxMaterial* defaultMaterial);
};
}
#endif /* defined(__RAYNE_PHYSXINTERNALS_H_) */
| 51.730769 | 327 | 0.806196 |
88ae88132faf93bdc7af080c51a2a8b7f68a20c7 | 1,518 | h | C | engine/source/kernel/shell/event/shell_event_code.h | skarab/coffee-master | 6c3ff71b7f15735e41c9859b6db981b94414c783 | [
"MIT"
] | null | null | null | engine/source/kernel/shell/event/shell_event_code.h | skarab/coffee-master | 6c3ff71b7f15735e41c9859b6db981b94414c783 | [
"MIT"
] | null | null | null | engine/source/kernel/shell/event/shell_event_code.h | skarab/coffee-master | 6c3ff71b7f15735e41c9859b6db981b94414c783 | [
"MIT"
] | null | null | null | #ifndef _COFFEE_SHELL_EVENT_CODE_H_
#define _COFFEE_SHELL_EVENT_CODE_H_
#include "coffee_includes.h"
#include "kernel/meta/meta_object.h"
namespace coffee
{
namespace shell
{
//--------------------------------------------------------------------------------------------//
/// Event code
///
/// Event code is a pair of custom code and meta type, this allow one code list (enum) per
/// meta type, so custom event code can be defined everywhere.
///
/// @see coffee::shell::EventHandler
//--------------------------------------------------------------------------------------------//
class COFFEE_API EventCode
{
public:
//-CONSTRUCTORS---------------------------------------------------------------------------//
EventCode();
EventCode(const EventCode & code);
EventCode(uint32 identifier, const meta::Class & type);
~EventCode();
//-OPERATORS------------------------------------------------------------------------------//
EventCode& operator = (const EventCode & code);
bool operator ==(const EventCode & code) const;
//-ACCESSORS------------------------------------------------------------------------------//
uint32 GetIdentifier() const;
const meta::Class & GetType() const;
private:
//-ATTRIBUTES-----------------------------------------------------------------------------//
uint32 _Identifier;
const meta::Class * _Type;
};
}
}
#endif
| 30.36 | 100 | 0.409091 |
63c453900aa5a67ef65a25b6935569f396a33d35 | 2,285 | h | C | StRoot/StPxlRawHitMaker/StPxlRawHit.h | xiaohaijin/RHIC-STAR | a305cb0a6ac15c8165bd8f0d074d7075d5e58752 | [
"MIT"
] | 2 | 2018-12-24T19:37:00.000Z | 2022-02-28T06:57:20.000Z | StRoot/StPxlRawHitMaker/StPxlRawHit.h | xiaohaijin/RHIC-STAR | a305cb0a6ac15c8165bd8f0d074d7075d5e58752 | [
"MIT"
] | null | null | null | StRoot/StPxlRawHitMaker/StPxlRawHit.h | xiaohaijin/RHIC-STAR | a305cb0a6ac15c8165bd8f0d074d7075d5e58752 | [
"MIT"
] | null | null | null | /*!
* \class StPxlRawHit
* \author Qiu Hao, Jan 2013
* \Initial Revision.
*/
/***************************************************************************
*
* $Id: StPxlRawHit.h,v 1.4 2014/08/06 11:43:34 jeromel Exp $
*
* Author: Qiu Hao, Jan 2013
***************************************************************************
*
* Description:
* pixel raw hit before clustering. One raw hit is one fired pixel.
* More information at
* https://www.star.bnl.gov/protected/heavy/qiuh/HFT/software/PXL_software.pdf
*
***************************************************************************
*
* $Log: StPxlRawHit.h,v $
* Revision 1.4 2014/08/06 11:43:34 jeromel
* Suffix on literals need to be space (later gcc compiler makes it an error) - first wave of fixes
*
* Revision 1.3 2014/01/28 19:29:44 qiuh
* *** empty log message ***
*
*
**************************************************************************/
#ifndef StPxlRawHit_hh
#define StPxlRawHit_hh
#include "Rtypes.h"
#include "TObject.h"
class StPxlRawHit: public TObject
{
public:
StPxlRawHit();
StPxlRawHit(Int_t sector, Int_t ladder, Int_t sensor, Int_t row, Int_t column, Int_t idTruth);
Int_t sector() const; ///< sector 1-10
Int_t ladder() const; ///< ladder 1-4
Int_t sensor() const; ///< sensor 1-10
Int_t row() const; ///< row 0-927
Int_t column() const; ///< column 0-959
Int_t idTruth() const; ///< for embedding, 0 as background
void setSector(Int_t sector); ///< set sector
void setLadder(Int_t ladder); ///< set ladder
void setSensor(Int_t sensor); ///< set sensor
void setRow(Int_t row); ///< set row
void setColumn(Int_t column); ///< set column
void setIdTruth(Int_t idTruth); ///< set idTruth
void print(); ///< print all information
virtual const char *GetCVS() const {
static const char cvs[] = "Tag $Name: SL18c $ $Id: StPxlRawHit.h,v 1.4 2014/08/06 11:43:34 jeromel Exp $ built " __DATE__ " " __TIME__ ;
return cvs;
}
protected:
Char_t mSector; ///< sector 1-10
Char_t mLadder; ///< ladder 1-4
Char_t mSensor; ///< sensor 1-10
Short_t mRow; ///< row 0-927
Short_t mColumn; ///< column 0-959
UShort_t mIdTruth; ///< for embedding, 0 as background
ClassDef(StPxlRawHit, 1)
};
#endif
| 31.30137 | 142 | 0.568053 |
af87ac8911f8fc7fcf2e757660c423bc0195146d | 200 | h | C | HybridProject/Cordova/Plugins/value-plugin-toolbar/ValueToolbar.h | iFindTA/HybridDemo | b76dbe8770688c4eb589aa1d88961063db37195c | [
"MIT"
] | 1 | 2019-05-06T10:19:12.000Z | 2019-05-06T10:19:12.000Z | HybridProject/Cordova/Plugins/value-plugin-toolbar/ValueToolbar.h | iFindTA/HybridDemo | b76dbe8770688c4eb589aa1d88961063db37195c | [
"MIT"
] | null | null | null | HybridProject/Cordova/Plugins/value-plugin-toolbar/ValueToolbar.h | iFindTA/HybridDemo | b76dbe8770688c4eb589aa1d88961063db37195c | [
"MIT"
] | null | null | null | #import <Foundation/Foundation.h>
#import <Cordova/CDVPlugin.h>
@interface ValueToolbar : CDVPlugin {
}
//接口方法, command.arguments[0]获取前端传递的参数
- (void)doShared:(CDVInvokedUrlCommand*)command;
@end
| 16.666667 | 48 | 0.76 |
17d2508370de04c302325b2747ba362e492aa1f4 | 551 | h | C | Classes/Boom.h | PhamDinhTri/Bomberman | 66d73167c42a05efb5829f4db244d1ffad0bb083 | [
"MIT"
] | null | null | null | Classes/Boom.h | PhamDinhTri/Bomberman | 66d73167c42a05efb5829f4db244d1ffad0bb083 | [
"MIT"
] | null | null | null | Classes/Boom.h | PhamDinhTri/Bomberman | 66d73167c42a05efb5829f4db244d1ffad0bb083 | [
"MIT"
] | 1 | 2021-10-20T14:22:57.000Z | 2021-10-20T14:22:57.000Z | #pragma once
#include "cocos2d.h"
#include "Fire.h"
#include "GameScene.h"
USING_NS_CC;
class GameScene;
class Fire;
class Boom : public Node
{
public:
static Boom* nodeWithTheGame(GameScene* game,Point location);
bool initWithTheGame(GameScene* game, Point location);
void update(float dt);
void updatetime(float dt);
void boomfire();
CC_SYNTHESIZE(int, time, Time);
CC_SYNTHESIZE(GameScene*, _theGame, TheGame);
CC_SYNTHESIZE(Sprite*, _mySprite, MySprite);
private:
LabelTTF *time_lb;
Fire *_fire;
int range;
};
| 22.04 | 63 | 0.716878 |
179753a50b4575e9ecf7ac0b558482b628156404 | 2,209 | h | C | xpdf/GHash.h | haephrati/SG_PDF2Text | 393ba8b500de6d10ab7c38936c009a5c44fa4189 | [
"Apache-2.0"
] | 1 | 2018-02-11T15:33:04.000Z | 2018-02-11T15:33:04.000Z | xpdf/GHash.h | haephrati/SG_PDF2Text | 393ba8b500de6d10ab7c38936c009a5c44fa4189 | [
"Apache-2.0"
] | 1 | 2018-11-13T17:41:46.000Z | 2018-11-13T20:54:38.000Z | xpdf/GHash.h | haephrati/SG_PDF2Text | 393ba8b500de6d10ab7c38936c009a5c44fa4189 | [
"Apache-2.0"
] | 1 | 2018-11-13T16:43:10.000Z | 2018-11-13T16:43:10.000Z | //========================================================================
//
// GHash.h
//
// Copyright 2001-2003 Glyph & Cog, LLC
//
//========================================================================
#ifndef GHASH_H
#define GHASH_H
#include <aconf.h>
#ifdef USE_GCC_PRAGMAS
#pragma interface
#endif
#include "gtypes.h"
class GString;
struct GHashBucket;
struct GHashIter;
//------------------------------------------------------------------------
class GHash {
public:
GHash(GBool deleteKeysA = gFalse);
~GHash();
void add(GString *key, void *val);
void add(GString *key, int val);
void replace(GString *key, void *val);
void replace(GString *key, int val);
void *lookup(GString *key);
int lookupInt(GString *key);
void *lookup(const char *key);
int lookupInt(const char *key);
void *remove(GString *key);
int removeInt(GString *key);
void *remove(const char *key);
int removeInt(const char *key);
int getLength() { return len; }
void startIter(GHashIter **iter);
GBool getNext(GHashIter **iter, GString **key, void **val);
GBool getNext(GHashIter **iter, GString **key, int *val);
void killIter(GHashIter **iter);
private:
void expand();
GHashBucket *find(GString *key, int *h);
GHashBucket *find(const char *key, int *h);
int hash(GString *key);
int hash(const char *key);
GBool deleteKeys; // set if key strings should be deleted
int size; // number of buckets
int len; // number of entries
GHashBucket **tab;
};
#define deleteGHash(hash, T) \
do { \
GHash *_hash = (hash); \
{ \
GHashIter *_iter; \
GString *_key; \
void *_p; \
_hash->startIter(&_iter); \
while (_hash->getNext(&_iter, &_key, &_p)) { \
delete (T*)_p; \
} \
delete _hash; \
} \
} while(0)
#endif
| 27.962025 | 74 | 0.459031 |
3ee64940e6ad1d678de6350d3aab1df1b60f908c | 10,266 | c | C | src/heapbufobjs.c | alexsmith1612/hadoofus | 8e79a44e4978f369b0c189297af9462d9408a0fa | [
"MIT"
] | 3 | 2019-02-26T19:11:47.000Z | 2021-05-12T07:36:07.000Z | src/heapbufobjs.c | alexsmith1612/hadoofus | 8e79a44e4978f369b0c189297af9462d9408a0fa | [
"MIT"
] | 7 | 2019-12-20T19:47:27.000Z | 2020-01-23T19:48:14.000Z | src/heapbufobjs.c | alexsmith1612/hadoofus | 8e79a44e4978f369b0c189297af9462d9408a0fa | [
"MIT"
] | 2 | 2020-06-04T10:20:08.000Z | 2020-09-10T23:35:49.000Z | #include <stdlib.h>
#include <hadoofus/lowlevel.h>
#include "heapbuf.h"
#include "heapbufobjs.h"
#include "objects-internal.h"
#include "util.h"
struct hdfs_object *
_hdfs_oslurp_null(struct hdfs_heap_buf *b)
{
char *t;
enum hdfs_object_type rt;
struct hdfs_object *res = NULL;
t = _hdfs_bslurp_string(b);
if (b->used < 0)
return res;
if (streq(t, "void")) {
res = hdfs_void_new();
} else {
rt = _hdfs_string_to_type(t);
if (rt == _H_INVALID)
b->used = _H_PARSE_ERROR;
else
res = hdfs_null_new(rt);
}
free(t);
return res;
}
struct hdfs_object *
_hdfs_oslurp_boolean(struct hdfs_heap_buf *b)
{
bool v;
v = _hdfs_bslurp_s8(b);
if (b->used < 0)
return NULL;
return hdfs_boolean_new(v);
}
struct hdfs_object *
_hdfs_oslurp_short(struct hdfs_heap_buf *b)
{
int16_t v;
v = _hdfs_bslurp_s16(b);
if (b->used < 0)
return NULL;
return hdfs_short_new(v);
}
struct hdfs_object *
_hdfs_oslurp_int(struct hdfs_heap_buf *b)
{
int32_t v;
v = _hdfs_bslurp_s32(b);
if (b->used < 0)
return NULL;
return hdfs_int_new(v);
}
struct hdfs_object *
_hdfs_oslurp_long(struct hdfs_heap_buf *b)
{
int64_t v;
v = _hdfs_bslurp_s64(b);
if (b->used < 0)
return NULL;
return hdfs_long_new(v);
}
struct hdfs_object *
_hdfs_oslurp_array_long(struct hdfs_heap_buf *b)
{
struct hdfs_object *res = NULL;
int64_t *longs = NULL;
int32_t n;
n = _hdfs_bslurp_s32(b);
if (b->used < 0)
return NULL;
if (n < 0) {
b->used = _H_PARSE_ERROR;
return NULL;
}
if (n > 0) {
longs = malloc(n * sizeof *longs);
ASSERT(longs);
for (int32_t i = 0; i < n; i++) {
bool eq;
char *s = _hdfs_bslurp_string(b);
if (b->used < 0)
goto out;
eq = streq(s, LONG_TYPE);
free(s);
if (!eq) {
b->used = _H_PARSE_ERROR;
goto out;
}
longs[i] = _hdfs_bslurp_s64(b);
if (b->used < 0)
goto out;
}
}
res = hdfs_array_long_new(n, longs);
out:
if (longs)
free(longs);
return res;
}
struct hdfs_object *
_hdfs_oslurp_token(struct hdfs_heap_buf *b)
{
char *s[4] = { 0 };
int32_t lens[2];
struct hdfs_object *res = NULL;
unsigned i;
for (i = 0; i < 2; i++) {
lens[i] = _hdfs_bslurp_vlint(b);
if (b->used < 0)
goto out;
ASSERT(lens[i] >= 0);
_hdfs_bslurp_mem1(b, lens[i], &s[i]);
if (b->used < 0)
goto out;
}
for (i = 2; i < 4; i++) {
s[i] = _hdfs_bslurp_text(b);
if (b->used < 0)
goto out;
}
res = hdfs_token_new_nulsafe(s[0], lens[0], s[1], lens[1], s[2], s[3]);
out:
for (i = 0; i < nelem(s); i++)
free(s[i]);
return res;
}
struct hdfs_object *
_hdfs_oslurp_block(struct hdfs_heap_buf *b)
{
int64_t values[3]; // blkid, len, generation
for (unsigned i = 0; i < nelem(values); i++) {
values[i] = _hdfs_bslurp_s64(b);
if (b->used < 0)
return NULL;
}
return hdfs_block_new(values[0], values[1], values[2]);
}
struct hdfs_object *
_hdfs_oslurp_located_block(struct hdfs_heap_buf *b)
{
struct hdfs_object *token = NULL, *block = NULL, *di = NULL,
*res = NULL;
bool corrupt;
int64_t offset,
blkid, len, generation;
int32_t n_datanodes;
token = _hdfs_oslurp_token(b);
if (b->used < 0)
return NULL;
corrupt = _hdfs_bslurp_s8(b);
if (b->used < 0)
return NULL;
ASSERT(!corrupt); // TODO keep corrupt info around
offset = _hdfs_bslurp_s64(b);
if (b->used < 0)
return NULL;
if (offset < 0) {
b->used = _H_PARSE_ERROR;
return NULL;
}
block = _hdfs_oslurp_block(b);
if (b->used < 0)
return NULL;
blkid = block->ob_val._block._blkid;
len = block->ob_val._block._length;
generation = block->ob_val._block._generation;
hdfs_object_free(block);
block = NULL;
n_datanodes = _hdfs_bslurp_s32(b);
if (b->used < 0)
return NULL;
if (n_datanodes < 0) {
b->used = _H_PARSE_ERROR;
return NULL;
}
res = hdfs_located_block_new(blkid, len, generation, offset);
for (int i = 0; i < n_datanodes; i++) {
di = _hdfs_oslurp_datanode_info(b);
if (b->used < 0) {
hdfs_object_free(res);
return NULL;
}
hdfs_located_block_append_datanode_info(res, di);
}
hdfs_object_free(res->ob_val._located_block._token);
res->ob_val._located_block._token = token;
return res;
}
struct hdfs_object *
_hdfs_oslurp_located_blocks(struct hdfs_heap_buf *b)
{
int64_t size;
bool under_construction;
int32_t nblocks;
struct hdfs_object *res = NULL;
size = _hdfs_bslurp_s64(b);
if (b->used < 0)
return NULL;
under_construction = _hdfs_bslurp_s8(b);
if (b->used < 0)
return NULL;
// raw located_block[]
nblocks = _hdfs_bslurp_s32(b);
if (b->used < 0)
return NULL;
res = hdfs_located_blocks_new(under_construction, size);
for (int i = 0; i < nblocks; i++) {
struct hdfs_object *located_block;
located_block = _hdfs_oslurp_located_block(b);
if (b->used < 0) {
hdfs_object_free(res);
return NULL;
}
hdfs_located_blocks_append_located_block(res, located_block);
}
return res;
}
struct hdfs_object *
_hdfs_oslurp_datanode_info(struct hdfs_heap_buf *b)
{
struct hdfs_object *res = NULL;
const char *port;
char *name = NULL,
*sid = NULL,
*location = NULL,
*hostname = NULL,
*adminstate = NULL;
uint16_t rpcport, infoport;
/* datanodeId {{{ */
name = _hdfs_bslurp_string(b);
if (b->used < 0)
goto out;
sid = _hdfs_bslurp_string(b);
if (b->used < 0)
goto out;
infoport = (uint16_t)_hdfs_bslurp_s16(b);
if (b->used < 0)
goto out;
/* }}} */
rpcport = (uint16_t)_hdfs_bslurp_s16(b);
if (b->used < 0)
goto out;
/*capacity = */_hdfs_bslurp_s64(b);
if (b->used < 0)
goto out;
/*dfsused = */_hdfs_bslurp_s64(b);
if (b->used < 0)
goto out;
/*remaining = */_hdfs_bslurp_s64(b);
if (b->used < 0)
goto out;
/*lastupdate = */_hdfs_bslurp_s64(b);
if (b->used < 0)
goto out;
/*xceivercount = */_hdfs_bslurp_s32(b);
if (b->used < 0)
goto out;
location = _hdfs_bslurp_text(b);
if (b->used < 0)
goto out;
hostname = _hdfs_bslurp_text(b);
if (b->used < 0)
goto out;
// most enums are "string"s on the wire; adminstate is a "text" for
// some reason.
adminstate = _hdfs_bslurp_text(b);
if (b->used < 0)
goto out;
port = strchr(name, ':');
if (!port) {
b->used = _H_PARSE_ERROR;
goto out;
}
port++;
// For simplicity, use hostname for ipaddr (in the v1 implementation hadoofus
// was originally tested with, the hostname was an ipaddr anyways)
res = hdfs_datanode_info_new(hostname/*ipaddr*/, hostname, port, location,
""/*uuid*/, rpcport, infoport);
out:
if (name)
free(name);
if (sid)
free(sid);
if (location)
free(location);
if (hostname)
free(hostname);
if (adminstate)
free(adminstate);
return res;
}
struct hdfs_object *
_hdfs_oslurp_directory_listing(struct hdfs_heap_buf *b)
{
struct hdfs_object *res;
int32_t len, remaining;
len = _hdfs_bslurp_s32(b);
if (b->used < 0)
return NULL;
if (len < 0) {
b->used = _H_PARSE_ERROR;
return NULL;
}
res = hdfs_directory_listing_new();
for (int i = 0; i < len; i++) {
struct hdfs_object *fs;
fs = _hdfs_oslurp_file_status(b);
if (b->used < 0) {
hdfs_object_free(res);
return NULL;
}
hdfs_directory_listing_append_file_status(res, fs, NULL);
}
remaining = _hdfs_bslurp_s32(b);
if (b->used < 0) {
hdfs_object_free(res);
return NULL;
}
ASSERT(remaining >= 0);
res->ob_val._directory_listing._remaining_entries =
(uint32_t)remaining;
return res;
}
struct hdfs_object *
_hdfs_oslurp_file_status(struct hdfs_heap_buf *b)
{
struct hdfs_object *res = NULL;
char *path = NULL,
*owner = NULL,
*group = NULL;
int64_t size, blocksize, mtime, atime;
int16_t replication, perms;
bool isdir;
path = _hdfs_bslurp_string32(b);
if (b->used < 0)
goto out;
size = _hdfs_bslurp_s64(b);
if (b->used < 0)
goto out;
isdir = _hdfs_bslurp_s8(b);
if (b->used < 0)
goto out;
replication = _hdfs_bslurp_s16(b);
if (b->used < 0)
goto out;
blocksize = _hdfs_bslurp_s64(b);
if (b->used < 0)
goto out;
mtime = _hdfs_bslurp_s64(b);
if (b->used < 0)
goto out;
atime = _hdfs_bslurp_s64(b);
if (b->used < 0)
goto out;
perms = _hdfs_bslurp_s16(b);
if (b->used < 0)
goto out;
if (perms < 0) {
b->used = _H_PARSE_ERROR;
goto out;
}
owner = _hdfs_bslurp_text(b);
if (b->used < 0)
goto out;
group = _hdfs_bslurp_text(b);
if (b->used < 0)
goto out;
res = hdfs_file_status_new_ex(path, size, isdir, replication,
blocksize, mtime, atime, perms, owner, group);
out:
if (path)
free(path);
if (owner)
free(owner);
if (group)
free(group);
return res;
}
struct hdfs_object *
_hdfs_oslurp_array_datanode_info(struct hdfs_heap_buf *b)
{
struct hdfs_object *res = NULL;
int32_t len;
char *tstring = NULL;
len = _hdfs_bslurp_s32(b);
if (b->used < 0)
return NULL;
if (len < 0) {
b->used = _H_PARSE_ERROR;
return NULL;
}
res = hdfs_array_datanode_info_new();
for (int i = 0; i < len; i++) {
// DatanodeInfo is an "object" type, thus the type string is
// encoded twice... theoretically there could be a null here
// but I'm pretty sure the Apache API doesn't produce/expect it.
struct hdfs_object *di;
for (int j = 0; j < 2; j++) {
tstring = _hdfs_bslurp_string(b);
if (b->used < 0)
goto err;
if (!streq(tstring, DATANODEINFO_TYPE))
goto err;
free(tstring);
tstring = NULL;
}
di = _hdfs_oslurp_datanode_info(b);
if (b->used < 0)
goto err;
hdfs_array_datanode_info_append_datanode_info(res, di);
}
return res;
err:
if (tstring)
free(tstring);
if (res)
hdfs_object_free(res);
return NULL;
}
struct hdfs_object *
_hdfs_oslurp_content_summary(struct hdfs_heap_buf *b)
{
int64_t v[6];
for (unsigned i = 0; i < nelem(v); i++) {
v[i] = _hdfs_bslurp_s64(b);
if (b->used < 0)
return NULL;
}
return hdfs_content_summary_new(v[0]/*length*/, v[1]/*files*/,
v[2]/*dirs*/, v[5]/*quota*/);
}
struct hdfs_object *
_hdfs_oslurp_fsperms(struct hdfs_heap_buf *b)
{
int16_t perms;
perms = _hdfs_bslurp_s16(b);
if (b->used < 0)
return NULL;
return hdfs_fsperms_new(perms);
}
struct hdfs_object *
_hdfs_oslurp_upgrade_status_report(struct hdfs_heap_buf *b)
{
int32_t version;
int16_t status;
version = _hdfs_bslurp_s32(b);
if (b->used < 0)
return NULL;
status = _hdfs_bslurp_s16(b);
if (b->used < 0)
return NULL;
return hdfs_upgrade_status_report_new(version, status);
}
| 19.117318 | 78 | 0.659166 |
85ad1f09d9a92bb2a359200583f3bfb6a4e14a59 | 194 | h | C | src/open_kattis/quadrant_selection.h | zweimach/wiyata.c | fa3db88b7f94d8a4e7ae672c4f15a8cc249d8e9f | [
"MIT"
] | null | null | null | src/open_kattis/quadrant_selection.h | zweimach/wiyata.c | fa3db88b7f94d8a4e7ae672c4f15a8cc249d8e9f | [
"MIT"
] | null | null | null | src/open_kattis/quadrant_selection.h | zweimach/wiyata.c | fa3db88b7f94d8a4e7ae672c4f15a8cc249d8e9f | [
"MIT"
] | null | null | null | #ifndef WIYATA_OPEN_KATTIS_QUADRANT_SELECTION_H
#define WIYATA_OPEN_KATTIS_QUADRANT_SELECTION_H
unsigned quadrant_selection(int x, int y);
#endif /* WIYATA_OPEN_KATTIS_QUADRANT_SELECTION_H */
| 27.714286 | 52 | 0.865979 |
85dd3cf983b544019266d5f3f30d5841d46127ce | 1,499 | h | C | base/ntsetup/winnt32/fsfilter/fsfilter.h | npocmaka/Windows-Server-2003 | 5c6fe3db626b63a384230a1aa6b92ac416b0765f | [
"Unlicense"
] | 17 | 2020-11-13T13:42:52.000Z | 2021-09-16T09:13:13.000Z | base/ntsetup/winnt32/fsfilter/fsfilter.h | sancho1952007/Windows-Server-2003 | 5c6fe3db626b63a384230a1aa6b92ac416b0765f | [
"Unlicense"
] | 2 | 2020-10-19T08:02:06.000Z | 2020-10-19T08:23:18.000Z | base/ntsetup/winnt32/fsfilter/fsfilter.h | sancho1952007/Windows-Server-2003 | 5c6fe3db626b63a384230a1aa6b92ac416b0765f | [
"Unlicense"
] | 14 | 2020-11-14T09:43:20.000Z | 2021-08-28T08:59:57.000Z | #define REGKEY_SERVICES L"System\\CurrentControlSet\\Services"
#define REGVAL_GROUP L"Group"
#define DRIVER_DIRECTORY L"%SystemRoot%\\system32\\drivers\\"
#define DRIVER_SUFFIX L".sys"
#define REGVAL_START L"Start"
#define REGVAL_SETUPCHECKED L"SetupChecked"
#define SIZE_STRINGBUF 256
#define SIZE_SECTIONBUF 128
//
//
// Data structure used for storing lists of strings. Note that
// some strings are in ansi and others in unicode (thus the VOID
// pointer to String). It's up to the user to keep track of whether
// a list is ansi or Unicode
//
//
typedef struct _STRING_LIST_ENTRY
{
LPVOID String;
struct _STRING_LIST_ENTRY *Next;
} STRING_LIST_ENTRY, *PSTRING_LIST_ENTRY;
//
//
// PSTRING_LIST_ENTRY
// PopEntryList(
// PSTRING_LIST_ENTRY ListHead
// );
//
#define PopEntryList(ListHead) \
(ListHead)->Next;\
{\
PSTRING_LIST_ENTRY FirstEntry;\
FirstEntry = (ListHead)->Next;\
if (FirstEntry != NULL) { \
(ListHead)->Next = FirstEntry->Next;\
} \
}
//
// VOID
// PushEntryList(
// PSTRING_LIST_ENTRY ListHead,
// PSTRING_LIST_ENTRY Entry
// );
//
#define PushEntryList(ListHead,Entry) \
(Entry)->Next = (ListHead)->Next; \
(ListHead)->Next = (Entry)
#define InitializeList(ListHead)\
(ListHead)->Next = NULL;
| 23.061538 | 71 | 0.597732 |
12538354dae247fdb98b6102d954b3a80e615448 | 227 | c | C | multiplicationOfTwoNumber.c | anishmo99/CPP | a9e7f8e8a7a2cca7fe8ab2f6f4d1dff8e6cc2c49 | [
"MIT"
] | 2 | 2020-08-09T02:09:50.000Z | 2020-08-09T07:07:47.000Z | multiplicationOfTwoNumber.c | anishmo99/CPP | a9e7f8e8a7a2cca7fe8ab2f6f4d1dff8e6cc2c49 | [
"MIT"
] | null | null | null | multiplicationOfTwoNumber.c | anishmo99/CPP | a9e7f8e8a7a2cca7fe8ab2f6f4d1dff8e6cc2c49 | [
"MIT"
] | 4 | 2020-05-25T10:24:14.000Z | 2021-05-03T07:52:35.000Z | #include<stdio.h>
int main()
{
int num1,num2,mul;
printf("Enter two number : ");
scanf("%d %d",&num1, &num2);
mul = num1 * num2;
printf("Multiplication of two number is : %d",mul);
return 0;
}
| 20.636364 | 56 | 0.546256 |
6abb94e937e667c67a68a642c4db57fbc42e6f2b | 4,246 | h | C | src/quantadb/DSSNServiceMonitor.h | nliao6622/QuantaDB-1 | e5db80c7b9e9f5b3c2c6715ce77c56d56e4c4c94 | [
"Apache-2.0"
] | 12 | 2021-01-20T23:20:27.000Z | 2021-12-10T12:14:26.000Z | src/quantadb/DSSNServiceMonitor.h | nliao6622/QuantaDB-1 | e5db80c7b9e9f5b3c2c6715ce77c56d56e4c4c94 | [
"Apache-2.0"
] | null | null | null | src/quantadb/DSSNServiceMonitor.h | nliao6622/QuantaDB-1 | e5db80c7b9e9f5b3c2c6715ce77c56d56e4c4c94 | [
"Apache-2.0"
] | 2 | 2021-01-13T02:03:32.000Z | 2022-01-20T17:26:55.000Z | /* Copyright 2020 Futurewei Technologies, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#pragma once
#include <prometheus/counter.h>
#include <prometheus/histogram.h>
#include <prometheus/gauge.h>
#include <prometheus/exposer.h>
#include <prometheus/registry.h>
#include "OpTrace.h"
namespace QDB {
class DSSNService;
enum DSSNServiceOp {
DSSNServiceCommit,
DSSNServiceRead,
DSSNServiceReadKV,
DSSNServiceReadMulti,
DSSNServiceSendTxReply,
DSSNServiceSendDSSNInfo,
DSSNServiceRecvDSSNInfo,
DSSNServiceSendDSSNInfoReq,
DSSNServiceRecvDSSNInfoReq,
DSSNServiceWrite,
DSSNServiceWriteMulti,
DSSNServiceOpsMax
};
static const char* DssnOpLabels[] = {
"commit",
"read",
"read_kv",
"read_multiops",
"send_txreply",
"send_dssninfo",
"recv_dssninfo",
"send_dssninfo_request",
"recv_dssninfo_request",
"write",
"write_multiops",
"invalid"
};
class DSSNServiceMonitor {
public:
DSSNServiceMonitor(DSSNService *service, prometheus::Exposer* exposer);
Metric* getOpMetric(DSSNServiceOp op) {
return &mOps[op];
}
void collectDxMetrics();
void collectPfMetrics();
void collectTcMetrics();
void collectDistTxLatency(uint64_t latency);
void clearMetrics();
bool isEnabled() { return mEnabled; }
/**
* Function for the sampling thread to execute. Sample the DSSNService metrics periodically
*/
static void sample(DSSNServiceMonitor* mon);
DSSNService* getDSSNService() { return mService; }
private:
/**
* Helper function to add a diagnostic metric
*/
void addDxMetric(DSSNServiceOp type) {
mPDxCounterHandle[type] = &mPDxCounters->Add({{"label", DssnOpLabels[type]}});
}
/**
* Helper function to add a performane metric
*/
void addPfMetric(DSSNServiceOp type) {
mPPfCounterHandle[type] = &mPPfCounters->Add({{"label", DssnOpLabels[type]}});
}
/**
* Helper function to add a tracing histogram
*/
void addTcMetric(DSSNServiceOp type) {
prometheus::Histogram::BucketBoundaries bucketsInMicroSec{0.1, 1, 2.5, 5, 10, 20, 40, 60, 80, 100,
130, 160, 200};
mPTcCounterHandle[type] = &mPTcCounters->Add({{"label", DssnOpLabels[type]}}, bucketsInMicroSec);
}
/**
* Helper function to add a tracing histogram
*/
void addDistLatency() {
prometheus::Histogram::BucketBoundaries bucketsInMicroSec{10, 50, 100, 200, 300, 400, 500, 750, 1000, 5000, 10000, 50000, 100000, 500000};
mPDlHandle = &mPDlCounter->Add({{"label", "DistTxLatency"}}, bucketsInMicroSec);
}
/**
* The Diagnostic related counter
*/
std::shared_ptr<prometheus::Registry> mPDxRegistry;
prometheus::Family<prometheus::Gauge>* mPDxCounters = nullptr;
prometheus::Gauge* mPDxCounterHandle[DSSNServiceOpsMax];
/**
* The Performance related counter
*/
std::shared_ptr<prometheus::Registry> mPPfRegistry;
prometheus::Family<prometheus::Gauge>* mPPfCounters = nullptr;
prometheus::Gauge* mPPfCounterHandle[DSSNServiceOpsMax];
/**
* The Tracing related counter
*/
std::shared_ptr<prometheus::Registry> mPTcRegistry;
prometheus::Family<prometheus::Histogram>* mPTcCounters = nullptr;
prometheus::Histogram* mPTcCounterHandle[DSSNServiceOpsMax];
/*
* The latency tracing for Dist Tx.
*/
std::shared_ptr<prometheus::Registry> mPDlRegistry;
prometheus::Family<prometheus::Histogram>* mPDlCounter = nullptr;
prometheus::Histogram* mPDlHandle = nullptr;
DSSNService* mService;
Metric mOps[DSSNServiceOpsMax];
std::thread* mSampler;
bool mEnabled;
};
}
| 30.768116 | 146 | 0.688648 |
ac1e50fb767c6f9ced9af9a58d633a4328422096 | 509 | h | C | division.h | WolfWings/faster-x86-64-div-mod | 007ab31a0a4be14c4039d8a081ca3fa8e25b5ed1 | [
"Unlicense"
] | 2 | 2021-01-21T06:57:46.000Z | 2021-01-21T06:57:48.000Z | division.h | WolfWings/faster-x86-64-div-mod | 007ab31a0a4be14c4039d8a081ca3fa8e25b5ed1 | [
"Unlicense"
] | null | null | null | division.h | WolfWings/faster-x86-64-div-mod | 007ab31a0a4be14c4039d8a081ca3fa8e25b5ed1 | [
"Unlicense"
] | null | null | null | #include <stdint.h>
void calc_magic( uint64_t *magic_hi, uint64_t *magic_lo, const uint64_t unused, const uint64_t divisor );
uint8_t fast_divisible( const uint64_t magic_hi, const uint64_t magic_lo, const uint64_t unused, const uint64_t base );
uint64_t fast_division( const uint64_t magic_hi, const uint64_t magic_lo, const uint64_t unused, const uint64_t base );
uint64_t fast_modulo( const uint64_t magic_hi, const uint64_t magic_lo, const uint64_t unused, const uint64_t base, const uint64_t divisor );
| 72.714286 | 141 | 0.81336 |
ac42ea960d631c2d60cc167f72fb133649f09ac3 | 1,004 | c | C | CodeWars/Validation/ValidBraces/ValidBraces.c | CajetanP/programming-exercises | aee01ff3208ab14e7d0e0a7077798342123bc3e6 | [
"MIT"
] | 1 | 2017-06-23T16:39:17.000Z | 2017-06-23T16:39:17.000Z | CodeWars/Validation/ValidBraces/ValidBraces.c | CajetanP/coding-exercises | aee01ff3208ab14e7d0e0a7077798342123bc3e6 | [
"MIT"
] | 10 | 2021-05-09T00:06:22.000Z | 2021-09-02T12:07:41.000Z | CodeWars/Validation/ValidBraces/ValidBraces.c | mrkajetanp/programming-exercises | aee01ff3208ab14e7d0e0a7077798342123bc3e6 | [
"MIT"
] | null | null | null | #include <stdio.h>
#include <string.h>
#include <assert.h>
#include <stdbool.h>
bool valid_braces(char* str) {
int size = 0;
char bracket_stack[strlen(str)+1];
for (size_t i = 0 ; i < strlen(str) ; ++i) {
switch (str[i]) {
case '(': case '{': case '[':
bracket_stack[size++] = str[i];
break;
case ')':
if (size == 0 || bracket_stack[(size--)-1] != '(')
return false;
break;
case '}':
if (size == 0 || bracket_stack[(size--)-1] != '{')
return false;
break;
case ']':
if (size == 0 || bracket_stack[(size--)-1] != '[')
return false;
break;
}
}
return size == 0;
}
int main() {
assert(valid_braces("()"));
assert(!valid_braces("[(])"));
assert(valid_braces("(){}[]"));
assert(!valid_braces("(}"));
assert(!valid_braces("[(])"));
assert(valid_braces("([{}])"));
}
| 22.311111 | 62 | 0.443227 |
5ffc653ee68405b6f9ed4fb167278c97e12ce4ae | 505 | c | C | helloWorldModule/__src/hello.c | Finomnis/PythonCModule | d1d47bdfe7c8fbe613067456c00898aeff0cea76 | [
"CC0-1.0"
] | 21 | 2019-03-28T12:15:41.000Z | 2021-09-30T04:22:00.000Z | helloWorldModule/__src/hello.c | Finomnis/PythonCModule | d1d47bdfe7c8fbe613067456c00898aeff0cea76 | [
"CC0-1.0"
] | null | null | null | helloWorldModule/__src/hello.c | Finomnis/PythonCModule | d1d47bdfe7c8fbe613067456c00898aeff0cea76 | [
"CC0-1.0"
] | 1 | 2020-09-22T16:04:34.000Z | 2020-09-22T16:04:34.000Z | // In all C files, include its corresponding header file in the very first line.
// No need to include <Python.h> as we did that already in the header file.
// Just make sure that <Python.h> is included BEFORE any other header file.
#include "hello.h"
// Our function implementation
PyObject* hello(PyObject *self, PyObject *args) {
const char* name;
if (!PyArg_ParseTuple(args, "s", &name)) {
return NULL;
}
printf("Hello, %s!\n", name);
return PyLong_FromLong(42);
}
| 28.055556 | 80 | 0.671287 |
2706efa750a246cf4808eee137beaeff3a80ab53 | 25,236 | h | C | u-boot-2019.01+gitAUTOINC+333c3e72d3-g333c3e72d3/arch/arm/include/asm/arch-mxs/iomux-mx23.h | rlourette/TI_SDK_u-boot-2019.01 | 3000a07c021e84d717e6792a74efcf895a7d7188 | [
"MIT"
] | 1,144 | 2018-12-18T09:46:47.000Z | 2022-03-07T14:51:46.000Z | u-boot-2019.01+gitAUTOINC+333c3e72d3-g333c3e72d3/arch/arm/include/asm/arch-mxs/iomux-mx23.h | rlourette/TI_SDK_u-boot-2019.01 | 3000a07c021e84d717e6792a74efcf895a7d7188 | [
"MIT"
] | 16 | 2019-01-28T06:08:40.000Z | 2019-12-04T10:26:41.000Z | u-boot-2019.01+gitAUTOINC+333c3e72d3-g333c3e72d3/arch/arm/include/asm/arch-mxs/iomux-mx23.h | rlourette/TI_SDK_u-boot-2019.01 | 3000a07c021e84d717e6792a74efcf895a7d7188 | [
"MIT"
] | 129 | 2018-12-18T09:46:50.000Z | 2022-03-30T07:30:13.000Z | /* SPDX-License-Identifier: GPL-2.0+ */
/*
* Copyright (C) 2009-2010 Amit Kucheria <amit.kucheria@canonical.com>
* Copyright (C) 2010 Freescale Semiconductor, Inc.
*/
#ifndef __MACH_IOMUX_MX23_H__
#define __MACH_IOMUX_MX23_H__
#include <asm/arch/iomux.h>
/*
* The naming convention for the pad modes is MX23_PAD_<padname>__<padmode>
* If <padname> or <padmode> refers to a GPIO, it is named GPIO_<unit>_<num>
* See also iomux.h
*
* BANK PIN MUX
*/
/* MUXSEL_0 */
#define MX23_PAD_GPMI_D00__GPMI_D00 MXS_IOMUX_PAD_NAKED(0, 0, PAD_MUXSEL_0)
#define MX23_PAD_GPMI_D01__GPMI_D01 MXS_IOMUX_PAD_NAKED(0, 1, PAD_MUXSEL_0)
#define MX23_PAD_GPMI_D02__GPMI_D02 MXS_IOMUX_PAD_NAKED(0, 2, PAD_MUXSEL_0)
#define MX23_PAD_GPMI_D03__GPMI_D03 MXS_IOMUX_PAD_NAKED(0, 3, PAD_MUXSEL_0)
#define MX23_PAD_GPMI_D04__GPMI_D04 MXS_IOMUX_PAD_NAKED(0, 4, PAD_MUXSEL_0)
#define MX23_PAD_GPMI_D05__GPMI_D05 MXS_IOMUX_PAD_NAKED(0, 5, PAD_MUXSEL_0)
#define MX23_PAD_GPMI_D06__GPMI_D06 MXS_IOMUX_PAD_NAKED(0, 6, PAD_MUXSEL_0)
#define MX23_PAD_GPMI_D07__GPMI_D07 MXS_IOMUX_PAD_NAKED(0, 7, PAD_MUXSEL_0)
#define MX23_PAD_GPMI_D08__GPMI_D08 MXS_IOMUX_PAD_NAKED(0, 8, PAD_MUXSEL_0)
#define MX23_PAD_GPMI_D09__GPMI_D09 MXS_IOMUX_PAD_NAKED(0, 9, PAD_MUXSEL_0)
#define MX23_PAD_GPMI_D10__GPMI_D10 MXS_IOMUX_PAD_NAKED(0, 10, PAD_MUXSEL_0)
#define MX23_PAD_GPMI_D11__GPMI_D11 MXS_IOMUX_PAD_NAKED(0, 11, PAD_MUXSEL_0)
#define MX23_PAD_GPMI_D12__GPMI_D12 MXS_IOMUX_PAD_NAKED(0, 12, PAD_MUXSEL_0)
#define MX23_PAD_GPMI_D13__GPMI_D13 MXS_IOMUX_PAD_NAKED(0, 13, PAD_MUXSEL_0)
#define MX23_PAD_GPMI_D14__GPMI_D14 MXS_IOMUX_PAD_NAKED(0, 14, PAD_MUXSEL_0)
#define MX23_PAD_GPMI_D15__GPMI_D15 MXS_IOMUX_PAD_NAKED(0, 15, PAD_MUXSEL_0)
#define MX23_PAD_GPMI_CLE__GPMI_CLE MXS_IOMUX_PAD_NAKED(0, 16, PAD_MUXSEL_0)
#define MX23_PAD_GPMI_ALE__GPMI_ALE MXS_IOMUX_PAD_NAKED(0, 17, PAD_MUXSEL_0)
#define MX23_PAD_GPMI_CE2N__GPMI_CE2N MXS_IOMUX_PAD_NAKED(0, 18, PAD_MUXSEL_0)
#define MX23_PAD_GPMI_RDY0__GPMI_RDY0 MXS_IOMUX_PAD_NAKED(0, 19, PAD_MUXSEL_0)
#define MX23_PAD_GPMI_RDY1__GPMI_RDY1 MXS_IOMUX_PAD_NAKED(0, 20, PAD_MUXSEL_0)
#define MX23_PAD_GPMI_RDY2__GPMI_RDY2 MXS_IOMUX_PAD_NAKED(0, 21, PAD_MUXSEL_0)
#define MX23_PAD_GPMI_RDY3__GPMI_RDY3 MXS_IOMUX_PAD_NAKED(0, 22, PAD_MUXSEL_0)
#define MX23_PAD_GPMI_WPN__GPMI_WPN MXS_IOMUX_PAD_NAKED(0, 23, PAD_MUXSEL_0)
#define MX23_PAD_GPMI_WRN__GPMI_WRN MXS_IOMUX_PAD_NAKED(0, 24, PAD_MUXSEL_0)
#define MX23_PAD_GPMI_RDN__GPMI_RDN MXS_IOMUX_PAD_NAKED(0, 25, PAD_MUXSEL_0)
#define MX23_PAD_AUART1_CTS__AUART1_CTS MXS_IOMUX_PAD_NAKED(0, 26, PAD_MUXSEL_0)
#define MX23_PAD_AUART1_RTS__AUART1_RTS MXS_IOMUX_PAD_NAKED(0, 27, PAD_MUXSEL_0)
#define MX23_PAD_AUART1_RX__AUART1_RX MXS_IOMUX_PAD_NAKED(0, 28, PAD_MUXSEL_0)
#define MX23_PAD_AUART1_TX__AUART1_TX MXS_IOMUX_PAD_NAKED(0, 29, PAD_MUXSEL_0)
#define MX23_PAD_I2C_SCL__I2C_SCL MXS_IOMUX_PAD_NAKED(0, 30, PAD_MUXSEL_0)
#define MX23_PAD_I2C_SDA__I2C_SDA MXS_IOMUX_PAD_NAKED(0, 31, PAD_MUXSEL_0)
#define MX23_PAD_LCD_D00__LCD_D00 MXS_IOMUX_PAD_NAKED(1, 0, PAD_MUXSEL_0)
#define MX23_PAD_LCD_D01__LCD_D01 MXS_IOMUX_PAD_NAKED(1, 1, PAD_MUXSEL_0)
#define MX23_PAD_LCD_D02__LCD_D02 MXS_IOMUX_PAD_NAKED(1, 2, PAD_MUXSEL_0)
#define MX23_PAD_LCD_D03__LCD_D03 MXS_IOMUX_PAD_NAKED(1, 3, PAD_MUXSEL_0)
#define MX23_PAD_LCD_D04__LCD_D04 MXS_IOMUX_PAD_NAKED(1, 4, PAD_MUXSEL_0)
#define MX23_PAD_LCD_D05__LCD_D05 MXS_IOMUX_PAD_NAKED(1, 5, PAD_MUXSEL_0)
#define MX23_PAD_LCD_D06__LCD_D06 MXS_IOMUX_PAD_NAKED(1, 6, PAD_MUXSEL_0)
#define MX23_PAD_LCD_D07__LCD_D07 MXS_IOMUX_PAD_NAKED(1, 7, PAD_MUXSEL_0)
#define MX23_PAD_LCD_D08__LCD_D08 MXS_IOMUX_PAD_NAKED(1, 8, PAD_MUXSEL_0)
#define MX23_PAD_LCD_D09__LCD_D09 MXS_IOMUX_PAD_NAKED(1, 9, PAD_MUXSEL_0)
#define MX23_PAD_LCD_D10__LCD_D10 MXS_IOMUX_PAD_NAKED(1, 10, PAD_MUXSEL_0)
#define MX23_PAD_LCD_D11__LCD_D11 MXS_IOMUX_PAD_NAKED(1, 11, PAD_MUXSEL_0)
#define MX23_PAD_LCD_D12__LCD_D12 MXS_IOMUX_PAD_NAKED(1, 12, PAD_MUXSEL_0)
#define MX23_PAD_LCD_D13__LCD_D13 MXS_IOMUX_PAD_NAKED(1, 13, PAD_MUXSEL_0)
#define MX23_PAD_LCD_D14__LCD_D14 MXS_IOMUX_PAD_NAKED(1, 14, PAD_MUXSEL_0)
#define MX23_PAD_LCD_D15__LCD_D15 MXS_IOMUX_PAD_NAKED(1, 15, PAD_MUXSEL_0)
#define MX23_PAD_LCD_D16__LCD_D16 MXS_IOMUX_PAD_NAKED(1, 16, PAD_MUXSEL_0)
#define MX23_PAD_LCD_D17__LCD_D17 MXS_IOMUX_PAD_NAKED(1, 17, PAD_MUXSEL_0)
#define MX23_PAD_LCD_RESET__LCD_RESET MXS_IOMUX_PAD_NAKED(1, 18, PAD_MUXSEL_0)
#define MX23_PAD_LCD_RS__LCD_RS MXS_IOMUX_PAD_NAKED(1, 19, PAD_MUXSEL_0)
#define MX23_PAD_LCD_WR__LCD_WR MXS_IOMUX_PAD_NAKED(1, 20, PAD_MUXSEL_0)
#define MX23_PAD_LCD_CS__LCD_CS MXS_IOMUX_PAD_NAKED(1, 21, PAD_MUXSEL_0)
#define MX23_PAD_LCD_DOTCK__LCD_DOTCK MXS_IOMUX_PAD_NAKED(1, 22, PAD_MUXSEL_0)
#define MX23_PAD_LCD_ENABLE__LCD_ENABLE MXS_IOMUX_PAD_NAKED(1, 23, PAD_MUXSEL_0)
#define MX23_PAD_LCD_HSYNC__LCD_HSYNC MXS_IOMUX_PAD_NAKED(1, 24, PAD_MUXSEL_0)
#define MX23_PAD_LCD_VSYNC__LCD_VSYNC MXS_IOMUX_PAD_NAKED(1, 25, PAD_MUXSEL_0)
#define MX23_PAD_PWM0__PWM0 MXS_IOMUX_PAD_NAKED(1, 26, PAD_MUXSEL_0)
#define MX23_PAD_PWM1__PWM1 MXS_IOMUX_PAD_NAKED(1, 27, PAD_MUXSEL_0)
#define MX23_PAD_PWM2__PWM2 MXS_IOMUX_PAD_NAKED(1, 28, PAD_MUXSEL_0)
#define MX23_PAD_PWM3__PWM3 MXS_IOMUX_PAD_NAKED(1, 29, PAD_MUXSEL_0)
#define MX23_PAD_PWM4__PWM4 MXS_IOMUX_PAD_NAKED(1, 30, PAD_MUXSEL_0)
#define MX23_PAD_SSP1_CMD__SSP1_CMD MXS_IOMUX_PAD_NAKED(2, 0, PAD_MUXSEL_0)
#define MX23_PAD_SSP1_DETECT__SSP1_DETECT MXS_IOMUX_PAD_NAKED(2, 1, PAD_MUXSEL_0)
#define MX23_PAD_SSP1_DATA0__SSP1_DATA0 MXS_IOMUX_PAD_NAKED(2, 2, PAD_MUXSEL_0)
#define MX23_PAD_SSP1_DATA1__SSP1_DATA1 MXS_IOMUX_PAD_NAKED(2, 3, PAD_MUXSEL_0)
#define MX23_PAD_SSP1_DATA2__SSP1_DATA2 MXS_IOMUX_PAD_NAKED(2, 4, PAD_MUXSEL_0)
#define MX23_PAD_SSP1_DATA3__SSP1_DATA3 MXS_IOMUX_PAD_NAKED(2, 5, PAD_MUXSEL_0)
#define MX23_PAD_SSP1_SCK__SSP1_SCK MXS_IOMUX_PAD_NAKED(2, 6, PAD_MUXSEL_0)
#define MX23_PAD_ROTARYA__ROTARYA MXS_IOMUX_PAD_NAKED(2, 7, PAD_MUXSEL_0)
#define MX23_PAD_ROTARYB__ROTARYB MXS_IOMUX_PAD_NAKED(2, 8, PAD_MUXSEL_0)
#define MX23_PAD_EMI_A00__EMI_A00 MXS_IOMUX_PAD_NAKED(2, 9, PAD_MUXSEL_0)
#define MX23_PAD_EMI_A01__EMI_A01 MXS_IOMUX_PAD_NAKED(2, 10, PAD_MUXSEL_0)
#define MX23_PAD_EMI_A02__EMI_A02 MXS_IOMUX_PAD_NAKED(2, 11, PAD_MUXSEL_0)
#define MX23_PAD_EMI_A03__EMI_A03 MXS_IOMUX_PAD_NAKED(2, 12, PAD_MUXSEL_0)
#define MX23_PAD_EMI_A04__EMI_A04 MXS_IOMUX_PAD_NAKED(2, 13, PAD_MUXSEL_0)
#define MX23_PAD_EMI_A05__EMI_A05 MXS_IOMUX_PAD_NAKED(2, 14, PAD_MUXSEL_0)
#define MX23_PAD_EMI_A06__EMI_A06 MXS_IOMUX_PAD_NAKED(2, 15, PAD_MUXSEL_0)
#define MX23_PAD_EMI_A07__EMI_A07 MXS_IOMUX_PAD_NAKED(2, 16, PAD_MUXSEL_0)
#define MX23_PAD_EMI_A08__EMI_A08 MXS_IOMUX_PAD_NAKED(2, 17, PAD_MUXSEL_0)
#define MX23_PAD_EMI_A09__EMI_A09 MXS_IOMUX_PAD_NAKED(2, 18, PAD_MUXSEL_0)
#define MX23_PAD_EMI_A10__EMI_A10 MXS_IOMUX_PAD_NAKED(2, 19, PAD_MUXSEL_0)
#define MX23_PAD_EMI_A11__EMI_A11 MXS_IOMUX_PAD_NAKED(2, 20, PAD_MUXSEL_0)
#define MX23_PAD_EMI_A12__EMI_A12 MXS_IOMUX_PAD_NAKED(2, 21, PAD_MUXSEL_0)
#define MX23_PAD_EMI_BA0__EMI_BA0 MXS_IOMUX_PAD_NAKED(2, 22, PAD_MUXSEL_0)
#define MX23_PAD_EMI_BA1__EMI_BA1 MXS_IOMUX_PAD_NAKED(2, 23, PAD_MUXSEL_0)
#define MX23_PAD_EMI_CASN__EMI_CASN MXS_IOMUX_PAD_NAKED(2, 24, PAD_MUXSEL_0)
#define MX23_PAD_EMI_CE0N__EMI_CE0N MXS_IOMUX_PAD_NAKED(2, 25, PAD_MUXSEL_0)
#define MX23_PAD_EMI_CE1N__EMI_CE1N MXS_IOMUX_PAD_NAKED(2, 26, PAD_MUXSEL_0)
#define MX23_PAD_GPMI_CE1N__GPMI_CE1N MXS_IOMUX_PAD_NAKED(2, 27, PAD_MUXSEL_0)
#define MX23_PAD_GPMI_CE0N__GPMI_CE0N MXS_IOMUX_PAD_NAKED(2, 28, PAD_MUXSEL_0)
#define MX23_PAD_EMI_CKE__EMI_CKE MXS_IOMUX_PAD_NAKED(2, 29, PAD_MUXSEL_0)
#define MX23_PAD_EMI_RASN__EMI_RASN MXS_IOMUX_PAD_NAKED(2, 30, PAD_MUXSEL_0)
#define MX23_PAD_EMI_WEN__EMI_WEN MXS_IOMUX_PAD_NAKED(2, 31, PAD_MUXSEL_0)
#define MX23_PAD_EMI_D00__EMI_D00 MXS_IOMUX_PAD_NAKED(3, 0, PAD_MUXSEL_0)
#define MX23_PAD_EMI_D01__EMI_D01 MXS_IOMUX_PAD_NAKED(3, 1, PAD_MUXSEL_0)
#define MX23_PAD_EMI_D02__EMI_D02 MXS_IOMUX_PAD_NAKED(3, 2, PAD_MUXSEL_0)
#define MX23_PAD_EMI_D03__EMI_D03 MXS_IOMUX_PAD_NAKED(3, 3, PAD_MUXSEL_0)
#define MX23_PAD_EMI_D04__EMI_D04 MXS_IOMUX_PAD_NAKED(3, 4, PAD_MUXSEL_0)
#define MX23_PAD_EMI_D05__EMI_D05 MXS_IOMUX_PAD_NAKED(3, 5, PAD_MUXSEL_0)
#define MX23_PAD_EMI_D06__EMI_D06 MXS_IOMUX_PAD_NAKED(3, 6, PAD_MUXSEL_0)
#define MX23_PAD_EMI_D07__EMI_D07 MXS_IOMUX_PAD_NAKED(3, 7, PAD_MUXSEL_0)
#define MX23_PAD_EMI_D08__EMI_D08 MXS_IOMUX_PAD_NAKED(3, 8, PAD_MUXSEL_0)
#define MX23_PAD_EMI_D09__EMI_D09 MXS_IOMUX_PAD_NAKED(3, 9, PAD_MUXSEL_0)
#define MX23_PAD_EMI_D10__EMI_D10 MXS_IOMUX_PAD_NAKED(3, 10, PAD_MUXSEL_0)
#define MX23_PAD_EMI_D11__EMI_D11 MXS_IOMUX_PAD_NAKED(3, 11, PAD_MUXSEL_0)
#define MX23_PAD_EMI_D12__EMI_D12 MXS_IOMUX_PAD_NAKED(3, 12, PAD_MUXSEL_0)
#define MX23_PAD_EMI_D13__EMI_D13 MXS_IOMUX_PAD_NAKED(3, 13, PAD_MUXSEL_0)
#define MX23_PAD_EMI_D14__EMI_D14 MXS_IOMUX_PAD_NAKED(3, 14, PAD_MUXSEL_0)
#define MX23_PAD_EMI_D15__EMI_D15 MXS_IOMUX_PAD_NAKED(3, 15, PAD_MUXSEL_0)
#define MX23_PAD_EMI_DQM0__EMI_DQM0 MXS_IOMUX_PAD_NAKED(3, 16, PAD_MUXSEL_0)
#define MX23_PAD_EMI_DQM1__EMI_DQM1 MXS_IOMUX_PAD_NAKED(3, 17, PAD_MUXSEL_0)
#define MX23_PAD_EMI_DQS0__EMI_DQS0 MXS_IOMUX_PAD_NAKED(3, 18, PAD_MUXSEL_0)
#define MX23_PAD_EMI_DQS1__EMI_DQS1 MXS_IOMUX_PAD_NAKED(3, 19, PAD_MUXSEL_0)
#define MX23_PAD_EMI_CLK__EMI_CLK MXS_IOMUX_PAD_NAKED(3, 20, PAD_MUXSEL_0)
#define MX23_PAD_EMI_CLKN__EMI_CLKN MXS_IOMUX_PAD_NAKED(3, 21, PAD_MUXSEL_0)
/* MUXSEL_1 */
#define MX23_PAD_GPMI_D00__LCD_D8 MXS_IOMUX_PAD_NAKED(0, 0, PAD_MUXSEL_1)
#define MX23_PAD_GPMI_D01__LCD_D9 MXS_IOMUX_PAD_NAKED(0, 1, PAD_MUXSEL_1)
#define MX23_PAD_GPMI_D02__LCD_D10 MXS_IOMUX_PAD_NAKED(0, 2, PAD_MUXSEL_1)
#define MX23_PAD_GPMI_D03__LCD_D11 MXS_IOMUX_PAD_NAKED(0, 3, PAD_MUXSEL_1)
#define MX23_PAD_GPMI_D04__LCD_D12 MXS_IOMUX_PAD_NAKED(0, 4, PAD_MUXSEL_1)
#define MX23_PAD_GPMI_D05__LCD_D13 MXS_IOMUX_PAD_NAKED(0, 5, PAD_MUXSEL_1)
#define MX23_PAD_GPMI_D06__LCD_D14 MXS_IOMUX_PAD_NAKED(0, 6, PAD_MUXSEL_1)
#define MX23_PAD_GPMI_D07__LCD_D15 MXS_IOMUX_PAD_NAKED(0, 7, PAD_MUXSEL_1)
#define MX23_PAD_GPMI_D08__LCD_D18 MXS_IOMUX_PAD_NAKED(0, 8, PAD_MUXSEL_1)
#define MX23_PAD_GPMI_D09__LCD_D19 MXS_IOMUX_PAD_NAKED(0, 9, PAD_MUXSEL_1)
#define MX23_PAD_GPMI_D10__LCD_D20 MXS_IOMUX_PAD_NAKED(0, 10, PAD_MUXSEL_1)
#define MX23_PAD_GPMI_D11__LCD_D21 MXS_IOMUX_PAD_NAKED(0, 11, PAD_MUXSEL_1)
#define MX23_PAD_GPMI_D12__LCD_D22 MXS_IOMUX_PAD_NAKED(0, 12, PAD_MUXSEL_1)
#define MX23_PAD_GPMI_D13__LCD_D23 MXS_IOMUX_PAD_NAKED(0, 13, PAD_MUXSEL_1)
#define MX23_PAD_GPMI_D14__AUART2_RX MXS_IOMUX_PAD_NAKED(0, 14, PAD_MUXSEL_1)
#define MX23_PAD_GPMI_D15__AUART2_TX MXS_IOMUX_PAD_NAKED(0, 15, PAD_MUXSEL_1)
#define MX23_PAD_GPMI_CLE__LCD_D16 MXS_IOMUX_PAD_NAKED(0, 16, PAD_MUXSEL_1)
#define MX23_PAD_GPMI_ALE__LCD_D17 MXS_IOMUX_PAD_NAKED(0, 17, PAD_MUXSEL_1)
#define MX23_PAD_GPMI_CE2N__ATA_A2 MXS_IOMUX_PAD_NAKED(0, 18, PAD_MUXSEL_1)
#define MX23_PAD_AUART1_RTS__IR_CLK MXS_IOMUX_PAD_NAKED(0, 27, PAD_MUXSEL_1)
#define MX23_PAD_AUART1_RX__IR_RX MXS_IOMUX_PAD_NAKED(0, 28, PAD_MUXSEL_1)
#define MX23_PAD_AUART1_TX__IR_TX MXS_IOMUX_PAD_NAKED(0, 29, PAD_MUXSEL_1)
#define MX23_PAD_I2C_SCL__GPMI_RDY2 MXS_IOMUX_PAD_NAKED(0, 30, PAD_MUXSEL_1)
#define MX23_PAD_I2C_SDA__GPMI_CE2N MXS_IOMUX_PAD_NAKED(0, 31, PAD_MUXSEL_1)
#define MX23_PAD_LCD_D00__ETM_DA8 MXS_IOMUX_PAD_NAKED(1, 0, PAD_MUXSEL_1)
#define MX23_PAD_LCD_D01__ETM_DA9 MXS_IOMUX_PAD_NAKED(1, 1, PAD_MUXSEL_1)
#define MX23_PAD_LCD_D02__ETM_DA10 MXS_IOMUX_PAD_NAKED(1, 2, PAD_MUXSEL_1)
#define MX23_PAD_LCD_D03__ETM_DA11 MXS_IOMUX_PAD_NAKED(1, 3, PAD_MUXSEL_1)
#define MX23_PAD_LCD_D04__ETM_DA12 MXS_IOMUX_PAD_NAKED(1, 4, PAD_MUXSEL_1)
#define MX23_PAD_LCD_D05__ETM_DA13 MXS_IOMUX_PAD_NAKED(1, 5, PAD_MUXSEL_1)
#define MX23_PAD_LCD_D06__ETM_DA14 MXS_IOMUX_PAD_NAKED(1, 6, PAD_MUXSEL_1)
#define MX23_PAD_LCD_D07__ETM_DA15 MXS_IOMUX_PAD_NAKED(1, 7, PAD_MUXSEL_1)
#define MX23_PAD_LCD_D08__ETM_DA0 MXS_IOMUX_PAD_NAKED(1, 8, PAD_MUXSEL_1)
#define MX23_PAD_LCD_D09__ETM_DA1 MXS_IOMUX_PAD_NAKED(1, 9, PAD_MUXSEL_1)
#define MX23_PAD_LCD_D10__ETM_DA2 MXS_IOMUX_PAD_NAKED(1, 10, PAD_MUXSEL_1)
#define MX23_PAD_LCD_D11__ETM_DA3 MXS_IOMUX_PAD_NAKED(1, 11, PAD_MUXSEL_1)
#define MX23_PAD_LCD_D12__ETM_DA4 MXS_IOMUX_PAD_NAKED(1, 12, PAD_MUXSEL_1)
#define MX23_PAD_LCD_D13__ETM_DA5 MXS_IOMUX_PAD_NAKED(1, 13, PAD_MUXSEL_1)
#define MX23_PAD_LCD_D14__ETM_DA6 MXS_IOMUX_PAD_NAKED(1, 14, PAD_MUXSEL_1)
#define MX23_PAD_LCD_D15__ETM_DA7 MXS_IOMUX_PAD_NAKED(1, 15, PAD_MUXSEL_1)
#define MX23_PAD_LCD_RESET__ETM_TCTL MXS_IOMUX_PAD_NAKED(1, 18, PAD_MUXSEL_1)
#define MX23_PAD_LCD_RS__ETM_TCLK MXS_IOMUX_PAD_NAKED(1, 19, PAD_MUXSEL_1)
#define MX23_PAD_LCD_DOTCK__GPMI_RDY3 MXS_IOMUX_PAD_NAKED(1, 22, PAD_MUXSEL_1)
#define MX23_PAD_LCD_ENABLE__I2C_SCL MXS_IOMUX_PAD_NAKED(1, 23, PAD_MUXSEL_1)
#define MX23_PAD_LCD_HSYNC__I2C_SDA MXS_IOMUX_PAD_NAKED(1, 24, PAD_MUXSEL_1)
#define MX23_PAD_LCD_VSYNC__LCD_BUSY MXS_IOMUX_PAD_NAKED(1, 25, PAD_MUXSEL_1)
#define MX23_PAD_PWM0__ROTARYA MXS_IOMUX_PAD_NAKED(1, 26, PAD_MUXSEL_1)
#define MX23_PAD_PWM1__ROTARYB MXS_IOMUX_PAD_NAKED(1, 27, PAD_MUXSEL_1)
#define MX23_PAD_PWM2__GPMI_RDY3 MXS_IOMUX_PAD_NAKED(1, 28, PAD_MUXSEL_1)
#define MX23_PAD_PWM3__ETM_TCTL MXS_IOMUX_PAD_NAKED(1, 29, PAD_MUXSEL_1)
#define MX23_PAD_PWM4__ETM_TCLK MXS_IOMUX_PAD_NAKED(1, 30, PAD_MUXSEL_1)
#define MX23_PAD_SSP1_DETECT__GPMI_CE3N MXS_IOMUX_PAD_NAKED(2, 1, PAD_MUXSEL_1)
#define MX23_PAD_SSP1_DATA1__I2C_SCL MXS_IOMUX_PAD_NAKED(2, 3, PAD_MUXSEL_1)
#define MX23_PAD_SSP1_DATA2__I2C_SDA MXS_IOMUX_PAD_NAKED(2, 4, PAD_MUXSEL_1)
#define MX23_PAD_ROTARYA__AUART2_RTS MXS_IOMUX_PAD_NAKED(2, 7, PAD_MUXSEL_1)
#define MX23_PAD_ROTARYB__AUART2_CTS MXS_IOMUX_PAD_NAKED(2, 8, PAD_MUXSEL_1)
/* MUXSEL_2 */
#define MX23_PAD_GPMI_D00__SSP2_DATA0 MXS_IOMUX_PAD_NAKED(0, 0, PAD_MUXSEL_2)
#define MX23_PAD_GPMI_D01__SSP2_DATA1 MXS_IOMUX_PAD_NAKED(0, 1, PAD_MUXSEL_2)
#define MX23_PAD_GPMI_D02__SSP2_DATA2 MXS_IOMUX_PAD_NAKED(0, 2, PAD_MUXSEL_2)
#define MX23_PAD_GPMI_D03__SSP2_DATA3 MXS_IOMUX_PAD_NAKED(0, 3, PAD_MUXSEL_2)
#define MX23_PAD_GPMI_D04__SSP2_DATA4 MXS_IOMUX_PAD_NAKED(0, 4, PAD_MUXSEL_2)
#define MX23_PAD_GPMI_D05__SSP2_DATA5 MXS_IOMUX_PAD_NAKED(0, 5, PAD_MUXSEL_2)
#define MX23_PAD_GPMI_D06__SSP2_DATA6 MXS_IOMUX_PAD_NAKED(0, 6, PAD_MUXSEL_2)
#define MX23_PAD_GPMI_D07__SSP2_DATA7 MXS_IOMUX_PAD_NAKED(0, 7, PAD_MUXSEL_2)
#define MX23_PAD_GPMI_D08__SSP1_DATA4 MXS_IOMUX_PAD_NAKED(0, 8, PAD_MUXSEL_2)
#define MX23_PAD_GPMI_D09__SSP1_DATA5 MXS_IOMUX_PAD_NAKED(0, 9, PAD_MUXSEL_2)
#define MX23_PAD_GPMI_D10__SSP1_DATA6 MXS_IOMUX_PAD_NAKED(0, 10, PAD_MUXSEL_2)
#define MX23_PAD_GPMI_D11__SSP1_DATA7 MXS_IOMUX_PAD_NAKED(0, 11, PAD_MUXSEL_2)
#define MX23_PAD_GPMI_D15__GPMI_CE3N MXS_IOMUX_PAD_NAKED(0, 15, PAD_MUXSEL_2)
#define MX23_PAD_GPMI_RDY0__SSP2_DETECT MXS_IOMUX_PAD_NAKED(0, 19, PAD_MUXSEL_2)
#define MX23_PAD_GPMI_RDY1__SSP2_CMD MXS_IOMUX_PAD_NAKED(0, 20, PAD_MUXSEL_2)
#define MX23_PAD_GPMI_WRN__SSP2_SCK MXS_IOMUX_PAD_NAKED(0, 24, PAD_MUXSEL_2)
#define MX23_PAD_AUART1_CTS__SSP1_DATA4 MXS_IOMUX_PAD_NAKED(0, 26, PAD_MUXSEL_2)
#define MX23_PAD_AUART1_RTS__SSP1_DATA5 MXS_IOMUX_PAD_NAKED(0, 27, PAD_MUXSEL_2)
#define MX23_PAD_AUART1_RX__SSP1_DATA6 MXS_IOMUX_PAD_NAKED(0, 28, PAD_MUXSEL_2)
#define MX23_PAD_AUART1_TX__SSP1_DATA7 MXS_IOMUX_PAD_NAKED(0, 29, PAD_MUXSEL_2)
#define MX23_PAD_I2C_SCL__AUART1_TX MXS_IOMUX_PAD_NAKED(0, 30, PAD_MUXSEL_2)
#define MX23_PAD_I2C_SDA__AUART1_RX MXS_IOMUX_PAD_NAKED(0, 31, PAD_MUXSEL_2)
#define MX23_PAD_LCD_D08__SAIF2_SDATA0 MXS_IOMUX_PAD_NAKED(1, 8, PAD_MUXSEL_2)
#define MX23_PAD_LCD_D09__SAIF1_SDATA0 MXS_IOMUX_PAD_NAKED(1, 9, PAD_MUXSEL_2)
#define MX23_PAD_LCD_D10__SAIF_MCLK_BITCLK MXS_IOMUX_PAD_NAKED(1, 10, PAD_MUXSEL_2)
#define MX23_PAD_LCD_D11__SAIF_LRCLK MXS_IOMUX_PAD_NAKED(1, 11, PAD_MUXSEL_2)
#define MX23_PAD_LCD_D12__SAIF2_SDATA1 MXS_IOMUX_PAD_NAKED(1, 12, PAD_MUXSEL_2)
#define MX23_PAD_LCD_D13__SAIF2_SDATA2 MXS_IOMUX_PAD_NAKED(1, 13, PAD_MUXSEL_2)
#define MX23_PAD_LCD_D14__SAIF1_SDATA2 MXS_IOMUX_PAD_NAKED(1, 14, PAD_MUXSEL_2)
#define MX23_PAD_LCD_D15__SAIF1_SDATA1 MXS_IOMUX_PAD_NAKED(1, 15, PAD_MUXSEL_2)
#define MX23_PAD_LCD_D16__SAIF_ALT_BITCLK MXS_IOMUX_PAD_NAKED(1, 16, PAD_MUXSEL_2)
#define MX23_PAD_LCD_RESET__GPMI_CE3N MXS_IOMUX_PAD_NAKED(1, 18, PAD_MUXSEL_2)
#define MX23_PAD_PWM0__DUART_RX MXS_IOMUX_PAD_NAKED(1, 26, PAD_MUXSEL_2)
#define MX23_PAD_PWM1__DUART_TX MXS_IOMUX_PAD_NAKED(1, 27, PAD_MUXSEL_2)
#define MX23_PAD_PWM3__AUART1_CTS MXS_IOMUX_PAD_NAKED(1, 29, PAD_MUXSEL_2)
#define MX23_PAD_PWM4__AUART1_RTS MXS_IOMUX_PAD_NAKED(1, 30, PAD_MUXSEL_2)
#define MX23_PAD_SSP1_CMD__JTAG_TDO MXS_IOMUX_PAD_NAKED(2, 0, PAD_MUXSEL_2)
#define MX23_PAD_SSP1_DETECT__USB_OTG_ID MXS_IOMUX_PAD_NAKED(2, 1, PAD_MUXSEL_2)
#define MX23_PAD_SSP1_DATA0__JTAG_TDI MXS_IOMUX_PAD_NAKED(2, 2, PAD_MUXSEL_2)
#define MX23_PAD_SSP1_DATA1__JTAG_TCLK MXS_IOMUX_PAD_NAKED(2, 3, PAD_MUXSEL_2)
#define MX23_PAD_SSP1_DATA2__JTAG_RTCK MXS_IOMUX_PAD_NAKED(2, 4, PAD_MUXSEL_2)
#define MX23_PAD_SSP1_DATA3__JTAG_TMS MXS_IOMUX_PAD_NAKED(2, 5, PAD_MUXSEL_2)
#define MX23_PAD_SSP1_SCK__JTAG_TRST MXS_IOMUX_PAD_NAKED(2, 6, PAD_MUXSEL_2)
#define MX23_PAD_ROTARYA__SPDIF MXS_IOMUX_PAD_NAKED(2, 7, PAD_MUXSEL_2)
#define MX23_PAD_ROTARYB__GPMI_CE3N MXS_IOMUX_PAD_NAKED(2, 8, PAD_MUXSEL_2)
/* MUXSEL_GPIO */
#define MX23_PAD_GPMI_D00__GPIO_0_0 MXS_IOMUX_PAD_NAKED(0, 0, PAD_MUXSEL_GPIO)
#define MX23_PAD_GPMI_D01__GPIO_0_1 MXS_IOMUX_PAD_NAKED(0, 1, PAD_MUXSEL_GPIO)
#define MX23_PAD_GPMI_D02__GPIO_0_2 MXS_IOMUX_PAD_NAKED(0, 2, PAD_MUXSEL_GPIO)
#define MX23_PAD_GPMI_D03__GPIO_0_3 MXS_IOMUX_PAD_NAKED(0, 3, PAD_MUXSEL_GPIO)
#define MX23_PAD_GPMI_D04__GPIO_0_4 MXS_IOMUX_PAD_NAKED(0, 4, PAD_MUXSEL_GPIO)
#define MX23_PAD_GPMI_D05__GPIO_0_5 MXS_IOMUX_PAD_NAKED(0, 5, PAD_MUXSEL_GPIO)
#define MX23_PAD_GPMI_D06__GPIO_0_6 MXS_IOMUX_PAD_NAKED(0, 6, PAD_MUXSEL_GPIO)
#define MX23_PAD_GPMI_D07__GPIO_0_7 MXS_IOMUX_PAD_NAKED(0, 7, PAD_MUXSEL_GPIO)
#define MX23_PAD_GPMI_D08__GPIO_0_8 MXS_IOMUX_PAD_NAKED(0, 8, PAD_MUXSEL_GPIO)
#define MX23_PAD_GPMI_D09__GPIO_0_9 MXS_IOMUX_PAD_NAKED(0, 9, PAD_MUXSEL_GPIO)
#define MX23_PAD_GPMI_D10__GPIO_0_10 MXS_IOMUX_PAD_NAKED(0, 10, PAD_MUXSEL_GPIO)
#define MX23_PAD_GPMI_D11__GPIO_0_11 MXS_IOMUX_PAD_NAKED(0, 11, PAD_MUXSEL_GPIO)
#define MX23_PAD_GPMI_D12__GPIO_0_12 MXS_IOMUX_PAD_NAKED(0, 12, PAD_MUXSEL_GPIO)
#define MX23_PAD_GPMI_D13__GPIO_0_13 MXS_IOMUX_PAD_NAKED(0, 13, PAD_MUXSEL_GPIO)
#define MX23_PAD_GPMI_D14__GPIO_0_14 MXS_IOMUX_PAD_NAKED(0, 14, PAD_MUXSEL_GPIO)
#define MX23_PAD_GPMI_D15__GPIO_0_15 MXS_IOMUX_PAD_NAKED(0, 15, PAD_MUXSEL_GPIO)
#define MX23_PAD_GPMI_CLE__GPIO_0_16 MXS_IOMUX_PAD_NAKED(0, 16, PAD_MUXSEL_GPIO)
#define MX23_PAD_GPMI_ALE__GPIO_0_17 MXS_IOMUX_PAD_NAKED(0, 17, PAD_MUXSEL_GPIO)
#define MX23_PAD_GPMI_CE2N__GPIO_0_18 MXS_IOMUX_PAD_NAKED(0, 18, PAD_MUXSEL_GPIO)
#define MX23_PAD_GPMI_RDY0__GPIO_0_19 MXS_IOMUX_PAD_NAKED(0, 19, PAD_MUXSEL_GPIO)
#define MX23_PAD_GPMI_RDY1__GPIO_0_20 MXS_IOMUX_PAD_NAKED(0, 20, PAD_MUXSEL_GPIO)
#define MX23_PAD_GPMI_RDY2__GPIO_0_21 MXS_IOMUX_PAD_NAKED(0, 21, PAD_MUXSEL_GPIO)
#define MX23_PAD_GPMI_RDY3__GPIO_0_22 MXS_IOMUX_PAD_NAKED(0, 22, PAD_MUXSEL_GPIO)
#define MX23_PAD_GPMI_WPN__GPIO_0_23 MXS_IOMUX_PAD_NAKED(0, 23, PAD_MUXSEL_GPIO)
#define MX23_PAD_GPMI_WRN__GPIO_0_24 MXS_IOMUX_PAD_NAKED(0, 24, PAD_MUXSEL_GPIO)
#define MX23_PAD_GPMI_RDN__GPIO_0_25 MXS_IOMUX_PAD_NAKED(0, 25, PAD_MUXSEL_GPIO)
#define MX23_PAD_AUART1_CTS__GPIO_0_26 MXS_IOMUX_PAD_NAKED(0, 26, PAD_MUXSEL_GPIO)
#define MX23_PAD_AUART1_RTS__GPIO_0_27 MXS_IOMUX_PAD_NAKED(0, 27, PAD_MUXSEL_GPIO)
#define MX23_PAD_AUART1_RX__GPIO_0_28 MXS_IOMUX_PAD_NAKED(0, 28, PAD_MUXSEL_GPIO)
#define MX23_PAD_AUART1_TX__GPIO_0_29 MXS_IOMUX_PAD_NAKED(0, 29, PAD_MUXSEL_GPIO)
#define MX23_PAD_I2C_SCL__GPIO_0_30 MXS_IOMUX_PAD_NAKED(0, 30, PAD_MUXSEL_GPIO)
#define MX23_PAD_I2C_SDA__GPIO_0_31 MXS_IOMUX_PAD_NAKED(0, 31, PAD_MUXSEL_GPIO)
#define MX23_PAD_LCD_D00__GPIO_1_0 MXS_IOMUX_PAD_NAKED(1, 0, PAD_MUXSEL_GPIO)
#define MX23_PAD_LCD_D01__GPIO_1_1 MXS_IOMUX_PAD_NAKED(1, 1, PAD_MUXSEL_GPIO)
#define MX23_PAD_LCD_D02__GPIO_1_2 MXS_IOMUX_PAD_NAKED(1, 2, PAD_MUXSEL_GPIO)
#define MX23_PAD_LCD_D03__GPIO_1_3 MXS_IOMUX_PAD_NAKED(1, 3, PAD_MUXSEL_GPIO)
#define MX23_PAD_LCD_D04__GPIO_1_4 MXS_IOMUX_PAD_NAKED(1, 4, PAD_MUXSEL_GPIO)
#define MX23_PAD_LCD_D05__GPIO_1_5 MXS_IOMUX_PAD_NAKED(1, 5, PAD_MUXSEL_GPIO)
#define MX23_PAD_LCD_D06__GPIO_1_6 MXS_IOMUX_PAD_NAKED(1, 6, PAD_MUXSEL_GPIO)
#define MX23_PAD_LCD_D07__GPIO_1_7 MXS_IOMUX_PAD_NAKED(1, 7, PAD_MUXSEL_GPIO)
#define MX23_PAD_LCD_D08__GPIO_1_8 MXS_IOMUX_PAD_NAKED(1, 8, PAD_MUXSEL_GPIO)
#define MX23_PAD_LCD_D09__GPIO_1_9 MXS_IOMUX_PAD_NAKED(1, 9, PAD_MUXSEL_GPIO)
#define MX23_PAD_LCD_D10__GPIO_1_10 MXS_IOMUX_PAD_NAKED(1, 10, PAD_MUXSEL_GPIO)
#define MX23_PAD_LCD_D11__GPIO_1_11 MXS_IOMUX_PAD_NAKED(1, 11, PAD_MUXSEL_GPIO)
#define MX23_PAD_LCD_D12__GPIO_1_12 MXS_IOMUX_PAD_NAKED(1, 12, PAD_MUXSEL_GPIO)
#define MX23_PAD_LCD_D13__GPIO_1_13 MXS_IOMUX_PAD_NAKED(1, 13, PAD_MUXSEL_GPIO)
#define MX23_PAD_LCD_D14__GPIO_1_14 MXS_IOMUX_PAD_NAKED(1, 14, PAD_MUXSEL_GPIO)
#define MX23_PAD_LCD_D15__GPIO_1_15 MXS_IOMUX_PAD_NAKED(1, 15, PAD_MUXSEL_GPIO)
#define MX23_PAD_LCD_D16__GPIO_1_16 MXS_IOMUX_PAD_NAKED(1, 16, PAD_MUXSEL_GPIO)
#define MX23_PAD_LCD_D17__GPIO_1_17 MXS_IOMUX_PAD_NAKED(1, 17, PAD_MUXSEL_GPIO)
#define MX23_PAD_LCD_RESET__GPIO_1_18 MXS_IOMUX_PAD_NAKED(1, 18, PAD_MUXSEL_GPIO)
#define MX23_PAD_LCD_RS__GPIO_1_19 MXS_IOMUX_PAD_NAKED(1, 19, PAD_MUXSEL_GPIO)
#define MX23_PAD_LCD_WR__GPIO_1_20 MXS_IOMUX_PAD_NAKED(1, 20, PAD_MUXSEL_GPIO)
#define MX23_PAD_LCD_CS__GPIO_1_21 MXS_IOMUX_PAD_NAKED(1, 21, PAD_MUXSEL_GPIO)
#define MX23_PAD_LCD_DOTCK__GPIO_1_22 MXS_IOMUX_PAD_NAKED(1, 22, PAD_MUXSEL_GPIO)
#define MX23_PAD_LCD_ENABLE__GPIO_1_23 MXS_IOMUX_PAD_NAKED(1, 23, PAD_MUXSEL_GPIO)
#define MX23_PAD_LCD_HSYNC__GPIO_1_24 MXS_IOMUX_PAD_NAKED(1, 24, PAD_MUXSEL_GPIO)
#define MX23_PAD_LCD_VSYNC__GPIO_1_25 MXS_IOMUX_PAD_NAKED(1, 25, PAD_MUXSEL_GPIO)
#define MX23_PAD_PWM0__GPIO_1_26 MXS_IOMUX_PAD_NAKED(1, 26, PAD_MUXSEL_GPIO)
#define MX23_PAD_PWM1__GPIO_1_27 MXS_IOMUX_PAD_NAKED(1, 27, PAD_MUXSEL_GPIO)
#define MX23_PAD_PWM2__GPIO_1_28 MXS_IOMUX_PAD_NAKED(1, 28, PAD_MUXSEL_GPIO)
#define MX23_PAD_PWM3__GPIO_1_29 MXS_IOMUX_PAD_NAKED(1, 29, PAD_MUXSEL_GPIO)
#define MX23_PAD_PWM4__GPIO_1_30 MXS_IOMUX_PAD_NAKED(1, 30, PAD_MUXSEL_GPIO)
#define MX23_PAD_SSP1_CMD__GPIO_2_0 MXS_IOMUX_PAD_NAKED(2, 0, PAD_MUXSEL_GPIO)
#define MX23_PAD_SSP1_DETECT__GPIO_2_1 MXS_IOMUX_PAD_NAKED(2, 1, PAD_MUXSEL_GPIO)
#define MX23_PAD_SSP1_DATA0__GPIO_2_2 MXS_IOMUX_PAD_NAKED(2, 2, PAD_MUXSEL_GPIO)
#define MX23_PAD_SSP1_DATA1__GPIO_2_3 MXS_IOMUX_PAD_NAKED(2, 3, PAD_MUXSEL_GPIO)
#define MX23_PAD_SSP1_DATA2__GPIO_2_4 MXS_IOMUX_PAD_NAKED(2, 4, PAD_MUXSEL_GPIO)
#define MX23_PAD_SSP1_DATA3__GPIO_2_5 MXS_IOMUX_PAD_NAKED(2, 5, PAD_MUXSEL_GPIO)
#define MX23_PAD_SSP1_SCK__GPIO_2_6 MXS_IOMUX_PAD_NAKED(2, 6, PAD_MUXSEL_GPIO)
#define MX23_PAD_ROTARYA__GPIO_2_7 MXS_IOMUX_PAD_NAKED(2, 7, PAD_MUXSEL_GPIO)
#define MX23_PAD_ROTARYB__GPIO_2_8 MXS_IOMUX_PAD_NAKED(2, 8, PAD_MUXSEL_GPIO)
#define MX23_PAD_EMI_A00__GPIO_2_9 MXS_IOMUX_PAD_NAKED(2, 9, PAD_MUXSEL_GPIO)
#define MX23_PAD_EMI_A01__GPIO_2_10 MXS_IOMUX_PAD_NAKED(2, 10, PAD_MUXSEL_GPIO)
#define MX23_PAD_EMI_A02__GPIO_2_11 MXS_IOMUX_PAD_NAKED(2, 11, PAD_MUXSEL_GPIO)
#define MX23_PAD_EMI_A03__GPIO_2_12 MXS_IOMUX_PAD_NAKED(2, 12, PAD_MUXSEL_GPIO)
#define MX23_PAD_EMI_A04__GPIO_2_13 MXS_IOMUX_PAD_NAKED(2, 13, PAD_MUXSEL_GPIO)
#define MX23_PAD_EMI_A05__GPIO_2_14 MXS_IOMUX_PAD_NAKED(2, 14, PAD_MUXSEL_GPIO)
#define MX23_PAD_EMI_A06__GPIO_2_15 MXS_IOMUX_PAD_NAKED(2, 15, PAD_MUXSEL_GPIO)
#define MX23_PAD_EMI_A07__GPIO_2_16 MXS_IOMUX_PAD_NAKED(2, 16, PAD_MUXSEL_GPIO)
#define MX23_PAD_EMI_A08__GPIO_2_17 MXS_IOMUX_PAD_NAKED(2, 17, PAD_MUXSEL_GPIO)
#define MX23_PAD_EMI_A09__GPIO_2_18 MXS_IOMUX_PAD_NAKED(2, 18, PAD_MUXSEL_GPIO)
#define MX23_PAD_EMI_A10__GPIO_2_19 MXS_IOMUX_PAD_NAKED(2, 19, PAD_MUXSEL_GPIO)
#define MX23_PAD_EMI_A11__GPIO_2_20 MXS_IOMUX_PAD_NAKED(2, 20, PAD_MUXSEL_GPIO)
#define MX23_PAD_EMI_A12__GPIO_2_21 MXS_IOMUX_PAD_NAKED(2, 21, PAD_MUXSEL_GPIO)
#define MX23_PAD_EMI_BA0__GPIO_2_22 MXS_IOMUX_PAD_NAKED(2, 22, PAD_MUXSEL_GPIO)
#define MX23_PAD_EMI_BA1__GPIO_2_23 MXS_IOMUX_PAD_NAKED(2, 23, PAD_MUXSEL_GPIO)
#define MX23_PAD_EMI_CASN__GPIO_2_24 MXS_IOMUX_PAD_NAKED(2, 24, PAD_MUXSEL_GPIO)
#define MX23_PAD_EMI_CE0N__GPIO_2_25 MXS_IOMUX_PAD_NAKED(2, 25, PAD_MUXSEL_GPIO)
#define MX23_PAD_EMI_CE1N__GPIO_2_26 MXS_IOMUX_PAD_NAKED(2, 26, PAD_MUXSEL_GPIO)
#define MX23_PAD_GPMI_CE1N__GPIO_2_27 MXS_IOMUX_PAD_NAKED(2, 27, PAD_MUXSEL_GPIO)
#define MX23_PAD_GPMI_CE0N__GPIO_2_28 MXS_IOMUX_PAD_NAKED(2, 28, PAD_MUXSEL_GPIO)
#define MX23_PAD_EMI_CKE__GPIO_2_29 MXS_IOMUX_PAD_NAKED(2, 29, PAD_MUXSEL_GPIO)
#define MX23_PAD_EMI_RASN__GPIO_2_30 MXS_IOMUX_PAD_NAKED(2, 30, PAD_MUXSEL_GPIO)
#define MX23_PAD_EMI_WEN__GPIO_2_31 MXS_IOMUX_PAD_NAKED(2, 31, PAD_MUXSEL_GPIO)
#endif /* __MACH_IOMUX_MX23_H__ */
| 72.102857 | 83 | 0.851046 |
5c35b2d18e20f74d300c701e71d8c381c750b365 | 2,215 | c | C | concurrency/time.c | santoshmano/cbricks | 924bbb5ddef585a7e3f22f25449cc4b04291e9fe | [
"MIT"
] | null | null | null | concurrency/time.c | santoshmano/cbricks | 924bbb5ddef585a7e3f22f25449cc4b04291e9fe | [
"MIT"
] | null | null | null | concurrency/time.c | santoshmano/cbricks | 924bbb5ddef585a7e3f22f25449cc4b04291e9fe | [
"MIT"
] | null | null | null | #include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <pthread.h>
#include <math.h>
#include <errno.h>
#include <sys/time.h>
#define handle_error(msg, en) \
do { \
errno = en; \
perror(msg); \
exit(EXIT_FAILURE); \
} while(0)
#define ONE_MIL 1000000
float get_timelag(
struct timeval start,
struct timeval end)
{
//printf("%ld, %d\n", start.tv_sec, start.tv_usec);
//printf("%ld, %d\n", end.tv_sec, end.tv_usec);
return (float)((end.tv_sec*ONE_MIL + end.tv_usec) \
- (start.tv_sec*ONE_MIL + start.tv_usec)) / ONE_MIL;
}
typedef struct __targs_t {
int a;
int b;
}targs_t;
typedef struct __tret_t {
int tid;
int val;
}tret_t;
void * func(void *arg) {
tret_t *ret = (tret_t *)malloc(sizeof(tret_t));
if (ret == NULL) {
handle_error("malloc", errno);
}
sleep(2);
printf("In Thread %d, targs{a, b} = {%d, %d}\n",
(int)pthread_self(),
((targs_t *)arg)->a, ((targs_t *)arg)->b);
ret->val = 1;
return ret;
}
int main(int argc, char *argv[])
{
struct timeval start_time, end_time;
int ret;
pthread_t t1, t2;
targs_t targs1 = {0,0};
targs_t targs2 = {pow(2,16), pow(2,16)};
tret_t *tret1, *tret2;
if ((ret = gettimeofday(&start_time, NULL))) {
handle_error("getimeofday", ret);
}
if ((ret = pthread_create(&t1, NULL, &func, &targs1))) {
handle_error("pthread_create", ret);
}
if ((ret = pthread_create(&t2, NULL, &func, &targs2))) {
handle_error("pthread_create", ret);
}
if ((ret = pthread_join(t1, (void **)&tret1))) {
handle_error("pthread_join", ret);
}
if ((ret = pthread_join(t2, (void **)&tret2))) {
handle_error("pthread_join", ret);
}
if ((ret = gettimeofday(&end_time, NULL))) {
handle_error("getimeofday", ret);
}
printf("Time consumed : %f secs\n", get_timelag(start_time, end_time));
printf("Thread %d retval = %d\n", (int)t1, tret1->val);
printf("Thread %d retval = %d\n", (int)t2, tret2->val);
return 0;
}
| 22.835052 | 75 | 0.546727 |
55ed84b0def007dcfc4866a926e7cb947d5b4359 | 290 | c | C | basic/tppp.c | downstreamfish/C---- | 3f5711daa300b2113d26e382b0c7a810f8b6635d | [
"MIT"
] | null | null | null | basic/tppp.c | downstreamfish/C---- | 3f5711daa300b2113d26e382b0c7a810f8b6635d | [
"MIT"
] | null | null | null | basic/tppp.c | downstreamfish/C---- | 3f5711daa300b2113d26e382b0c7a810f8b6635d | [
"MIT"
] | null | null | null | #include <stdio.h>
int main()
{
int num = 520;
const int cnum = 1024;
const int *const p = &cnum;
const int *const *pp = &p;
printf("pp: %p, &p: %p\n", pp, &p);
printf("*pp: %p, p: %p\n", *pp, p);
printf("**pp: %d, *p: %d, cnum: %d\n", **pp, *p, cnum);
return 0;
}
| 20.714286 | 58 | 0.482759 |
0e88511de85275b1cdcc8a9908dbd7116f0923dc | 6,901 | h | C | js_airsim_to_ros_library/include/js_airsim_to_ros_library/airsim_to_ros_class.h | JonathanSchmalhofer/RecursiveStereoUAV | 005642f5afbfe719c632ce81411af9ac5e8522f5 | [
"MIT"
] | 15 | 2018-04-07T18:07:23.000Z | 2022-02-14T11:48:34.000Z | js_airsim_to_ros_library/include/js_airsim_to_ros_library/airsim_to_ros_class.h | JonathanSchmalhofer/RecursiveStereoUAV | 005642f5afbfe719c632ce81411af9ac5e8522f5 | [
"MIT"
] | 1 | 2017-10-21T12:55:07.000Z | 2017-10-21T14:33:09.000Z | js_airsim_to_ros_library/include/js_airsim_to_ros_library/airsim_to_ros_class.h | JonathanSchmalhofer/RecursiveStereoUAV | 005642f5afbfe719c632ce81411af9ac5e8522f5 | [
"MIT"
] | 8 | 2017-10-11T09:10:51.000Z | 2021-05-04T06:28:24.000Z | ///
/// @file
/// @copyright Copyright (C) 2017-2018, Jonathan Bryan Schmalhofer
///
/// @brief Class to receive Data from AirSim and make available in ROS as ROS-Message
///
#ifndef JS_AIRSIM_TO_ROS_LIBRARY_AIRSIM_TO_ROS_CLASS_H_
#define JS_AIRSIM_TO_ROS_LIBRARY_AIRSIM_TO_ROS_CLASS_H_
#include <cstdint>
#include <zeromq_cpp/zmq.hpp>
//#include <js_messages/Image_generated.h>
//#include <js_messages/PoseMessageRoot_generated.h>
#include <js_messages/StereoImagePose_generated.h>
namespace js_airsim_to_ros_library
{
class AirSimToRosClass
{
public:
/// @brief Initializes a AirSimToRos class instance.
AirSimToRosClass(std::string const& addr);
/// @brief Default Destructor to free dynamically allocated memory of received messages.
~AirSimToRosClass();
/// @brief Connect to addr - useful to "reconnect" if connection was lost or could not be established on creation of object
void Connect(std::string const& addr);
// @brief Returns true if a new, full message was received via ZeroMq, false otherwise
int8_t ReceivedMessage();
// @brief Returns the attribute StereoImagePose.Header.seq
uint32_t GetHeaderSeq();
// @brief Returns the attribute StereoImagePose.stamp.sec
uint32_t GetHeaderStampSec();
// @brief Returns the attribute StereoImagePose.stamp.nsec
uint32_t GetHeaderStampNsec();
// @brief Returns the attribute StereoImagePose.frame_id
std::string GetHeaderFrameid();
// @brief Returns the attribute StereoImagePose.leftheight
uint32_t GetLeftHeight();
// @brief Returns the attribute StereoImagePose.leftwidth
uint32_t GetLeftWidth();
// @brief Returns the attribute StereoImagePose.leftencoding
std::string GetLeftEncoding();
// @brief Returns the attribute StereoImagePose.leftis_bigendian
uint8_t GetLeftIsBigendian();
// @brief Returns the attribute StereoImagePose.leftstep
uint32_t GetLeftStep();
// @brief Returns pointer to the attribute StereoImagePose.leftdata
std::uint8_t* GetLeftData();
// @brief Returns the size of the left image data.
size_t GetLeftDataSize();
// @brief Returns the attribute StereoImagePose.right.height
uint32_t GetRightHeight();
// @brief Returns the attribute StereoImagePose.right.width
uint32_t GetRightWidth();
// @brief Returns the attribute StereoImagePose.right.encoding
std::string GetRightEncoding();
// @brief Returns the attribute StereoImagePose.right.is_bigendian
uint8_t GetRightIsBigendian();
// @brief Returns the attribute StereoImagePose.right.step
uint32_t GetRightStep();
// @brief Returns pointer to the attribute StereoImagePose.right.data
std::uint8_t* GetRightData();
// @brief Returns the size of the StereoImagePose.right data.
size_t GetRightDataSize();
// @brief Returns the attribute PoseMessage.position.x
double GetPosePositionX();
// @brief Returns the attribute PoseMessage.position.y
double GetPosePositionY();
// @brief Returns the attribute PoseMessage.position.z
double GetPosePositionZ();
// @brief Returns the attribute PoseMessage.orientation.roll
double GetPoseOrientationRoll();
// @brief Returns the attribute PoseMessage.orientation.pitch
double GetPoseOrientationPitch();
// @brief Returns the attribute PoseMessage.orientation.yaw
double GetPoseOrientationYaw();
private:
/// @brief A ZeroMq context object encapsulating functionality dealing with the initialisation and termination.
zmq::context_t zmq_context_;
/// @brief A ZeroMq socket for subscribing to incoming messages.
zmq::socket_t zmq_subscriber_;
/// @brief Holds the attribute StereoImagePose.Header.seq of the last received message.
uint32_t header_seq_;
/// @brief Holds the attribute StereoImagePose.Header.stamp.sec of the last received message.
uint32_t header_stamp_sec_;
/// @brief Holds the attribute StereoImagePose.Header.stamp.sec of the last received message.
uint32_t header_stamp_nsec_;
/// @brief Holds the attribute StereoImagePose.Header.frame_id of the last received message.
std::string header_frame_id_;
/// @brief Holds the attribute StereoImagePose.left.height of the last received message.
uint32_t left_height_;
/// @brief Holds the attribute StereoImagePose.left.width of the last received message.
uint32_t left_width_;
/// @brief Holds the attribute StereoImagePose.left.encoding of the last received message.
std::string left_encoding_;
/// @brief Holds the attribute StereoImagePose.left.is_bigendian of the last received message.
uint8_t left_is_bigendian_;
/// @brief Holds the attribute StereoImagePose.left.step of the last received message.
uint32_t left_step_;
/// @brief Holds the attribute StereoImagePose.left.data of the last received message.
std::uint8_t* left_data_;
/// @brief Holds the size of the StereoImagePose.left data (which is step * height).
size_t left_data_size_;
/// @brief Holds the attribute StereoImagePose.right.height of the last received message.
uint32_t right_height_;
/// @brief Holds the attribute StereoImagePose.right.width of the last received message.
uint32_t right_width_;
/// @brief Holds the attribute StereoImagePose.right.encoding of the last received message.
std::string right_encoding_;
/// @brief Holds the attribute StereoImagePose.right.is_bigendian of the last received message.
uint8_t right_is_bigendian_;
/// @brief Holds the attribute StereoImagePose.right.step of the last received message.
uint32_t right_step_;
/// @brief Holds the attribute StereoImagePose.right.data of the last received message.
std::uint8_t* right_data_;
/// @brief Holds the size of the StereoImagePose.right data (which is step * height).
size_t right_data_size_;
/// @brief Holds the attribute PoseMessage.position.x of the last received message.
double pose_position_x_;
/// @brief Holds the attribute PoseMessage.position.y of the last received message.
double pose_position_y_;
/// @brief Holds the attribute PoseMessage.position.z of the last received message.
double pose_position_z_;
/// @brief Holds the attribute PoseMessage.orientation.roll of the last received message.
double pose_orientation_roll_;
/// @brief Holds the attribute PoseMessage.orientation.pitch of the last received message.
double pose_orientation_pitch_;
/// @brief Holds the attribute PoseMessage.orientation.yaw of the last received message.
double pose_orientation_yaw_;
};
} // namespace js_airsim_to_ros_library
#endif // JS_AIRSIM_TO_ROS_LIBRARY_AIRSIM_TO_ROS_CLASS_H_
| 36.707447 | 127 | 0.735835 |
d9bf6538170c5ddc84463ed6806dd2bb17fc9eaa | 443 | h | C | vendors/FRPreferences/FRPrefs.h | mashaalAl3nizy/Sco_source | 2e4dff18d21f6fdb711df3099aec3e06cbd05b26 | [
"MIT"
] | 19 | 2018-04-29T09:04:19.000Z | 2021-10-30T21:20:10.000Z | vendors/FRPreferences/FRPrefs.h | mashaalAl3nizy/Sco_source | 2e4dff18d21f6fdb711df3099aec3e06cbd05b26 | [
"MIT"
] | 1 | 2018-05-09T17:52:41.000Z | 2018-05-11T20:49:14.000Z | vendors/FRPreferences/FRPrefs.h | mashaalAl3nizy/Sco_source | 2e4dff18d21f6fdb711df3099aec3e06cbd05b26 | [
"MIT"
] | 12 | 2018-04-27T00:59:39.000Z | 2021-10-30T21:14:07.000Z | //
// FRPrefs.h
// FRPreferences
//
// Created by Fouad Raheb on 7/3/15.
// Copyright (c) 2015 F0u4d. All rights reserved.
//
#import "FRPreferences.h"
#import "FRPSettings.h"
#import "FRPViewSection.h"
#import "FRPSection.h"
#import "FRPSwitchCell.h"
#import "FRPTextFieldCell.h"
#import "FRPLinkCell.h"
#import "FRPSliderCell.h"
#import "FRPListCell.h"
#import "FRPSegmentCell.h"
#import "FRPValueCell.h"
#import "FRPDeveloperCell.h"
| 19.26087 | 50 | 0.722348 |
8a7a39d64c553b55f40f3014f64a6ef48ab4df10 | 589 | h | C | include/HandySenseSHT20.h | Farm1-Tech/kbide-farm1-handysense | 55eaa878412c8ac82a4e82eae842b4086a07ab80 | [
"MIT"
] | null | null | null | include/HandySenseSHT20.h | Farm1-Tech/kbide-farm1-handysense | 55eaa878412c8ac82a4e82eae842b4086a07ab80 | [
"MIT"
] | null | null | null | include/HandySenseSHT20.h | Farm1-Tech/kbide-farm1-handysense | 55eaa878412c8ac82a4e82eae842b4086a07ab80 | [
"MIT"
] | null | null | null | #ifndef __HANDYSENSE_SHT20__
#define __HANDYSENSE_SHT20__
#include <Arduino.h>
#include <Wire.h>
#define SHT20_ADDR 0x40
class Artron_SHT20 {
private:
TwoWire *_wire;
int write(uint8_t command, uint8_t *data = NULL, uint8_t len = 0) ;
int read(uint8_t command, uint8_t *data = NULL, int len = 0, int stop = 100) ;
public:
Artron_SHT20(TwoWire*);
bool begin() ;
float readTemperature() ;
float readHumidity() ;
};
// External use
int handySenseSHT20TempRead(float*) ;
int handySenseSHT20HumiRead(float*) ;
#endif
| 19.633333 | 86 | 0.65365 |
cddd230e933a1b75d16fd4d98e0a64c74b96478a | 2,963 | h | C | components/download/public/background_service/download_metadata.h | sarang-apps/darshan_browser | 173649bb8a7c656dc60784d19e7bb73e07c20daa | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | 575 | 2015-06-18T23:58:20.000Z | 2022-03-23T09:32:39.000Z | components/download/public/background_service/download_metadata.h | sarang-apps/darshan_browser | 173649bb8a7c656dc60784d19e7bb73e07c20daa | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | 113 | 2015-05-04T09:58:14.000Z | 2022-01-31T19:35:03.000Z | components/download/public/background_service/download_metadata.h | sarang-apps/darshan_browser | 173649bb8a7c656dc60784d19e7bb73e07c20daa | [
"BSD-3-Clause-No-Nuclear-License-2014",
"BSD-3-Clause"
] | 52 | 2015-07-14T10:40:50.000Z | 2022-03-15T01:11:49.000Z | // Copyright 2017 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 COMPONENTS_DOWNLOAD_PUBLIC_BACKGROUND_SERVICE_DOWNLOAD_METADATA_H_
#define COMPONENTS_DOWNLOAD_PUBLIC_BACKGROUND_SERVICE_DOWNLOAD_METADATA_H_
#include <vector>
#include "base/files/file_path.h"
#include "base/memory/scoped_refptr.h"
#include "base/optional.h"
#include "net/http/http_response_headers.h"
#include "storage/browser/blob/blob_data_handle.h"
#include "url/gurl.h"
namespace download {
// Struct that contains information about successfully completed downloads.
struct CompletionInfo {
// The file path for the download file. In incognito mode, use |blob_handle_|
// to retrieve data.
base::FilePath path;
// The blob data handle that contains download data.
// Will be available after the download is completed in incognito mode.
base::Optional<storage::BlobDataHandle> blob_handle;
// Download file size in bytes.
uint64_t bytes_downloaded = 0u;
// The url chain of the download. Download may encounter redirects, and
// fetches the content from the last url in the chain.
// This will reflect the initial request's chain and does not take into
// account changed values during retries/resumptions.
std::vector<GURL> url_chain;
// The response headers for the download request.
// This will reflect the initial response's headers and does not take into
// account changed values during retries/resumptions.
scoped_refptr<const net::HttpResponseHeaders> response_headers;
// An optional base::HexEncoded SHA-256 hash (if available) of the file
// contents. If empty there is no available hash value.
std::string hash256;
CompletionInfo();
CompletionInfo(
const base::FilePath& path,
uint64_t bytes_downloaded,
const std::vector<GURL>& url_chain,
scoped_refptr<const net::HttpResponseHeaders> response_headers);
CompletionInfo(const base::FilePath& path, uint64_t bytes_downloaded);
CompletionInfo(const CompletionInfo& other);
~CompletionInfo();
bool operator==(const CompletionInfo& other) const;
};
// Struct to describe general download status.
struct DownloadMetaData {
// The GUID of the download.
std::string guid;
// Data that has been fetched. Can be used to get the current size of
// uncompleted download.
uint64_t current_size;
// Whether the entry is currently paused by the client.
bool paused;
// Info about successfully completed download, or null for in-progress
// download. Failed download will not be persisted and exposed as meta data.
base::Optional<CompletionInfo> completion_info;
DownloadMetaData();
~DownloadMetaData();
DownloadMetaData(const DownloadMetaData& other);
bool operator==(const DownloadMetaData& other) const;
};
} // namespace download
#endif // COMPONENTS_DOWNLOAD_PUBLIC_BACKGROUND_SERVICE_DOWNLOAD_METADATA_H_
| 35.27381 | 79 | 0.765778 |
e0273d2697f770702187f9474d7b202aac3eb83a | 766 | h | C | Dom/include/page.h | void4/KeyKOS | 06f5aa20f1e5dd58958aa9b5db2b3f0cbb2fa0aa | [
"MIT"
] | 6 | 2019-10-10T00:39:52.000Z | 2022-01-10T15:41:54.000Z | Dom/include/page.h | TheMetalMage/KeyKos | 372b71fb658936e0dddd22aa01decbca830bd4f7 | [
"MIT"
] | null | null | null | Dom/include/page.h | TheMetalMage/KeyKos | 372b71fb658936e0dddd22aa01decbca830bd4f7 | [
"MIT"
] | 1 | 2021-06-25T17:28:14.000Z | 2021-06-25T17:28:14.000Z | /* Copyright (c) 2005 Agorics; see MIT_License in this directory
or http://www.opensource.org/licenses/mit-license.html */
/****************************************************************
Page Defines
KC (Page,Page_MakeReadOnlyKey) KEYSTO(PageRO) - Weaken
KC (Page,Page_Clear) - Clear
KC (Page,Page_WriteData+offset) CHARFROM (char,len) - Write
KC (Page,Page_TestForZeros)
****************************************************************/
#ifndef _H_page
#define _H_page
#define Page_AKT 0x202
#define Page_ROAKT 0x1202
#define Page_MakeReadOnlyKey 0
#define Page_Clear 39
#define Page_TestForZeroes 41
#define Page_WriteData 4096
#endif
| 29.461538 | 65 | 0.530026 |
d4561aa9487c255832aac113d0ae6783f356d08d | 1,082 | h | C | ios/versioned-react-native/ABI33_0_0/React/CxxBridge/ABI33_0_0RCTMessageThread.h | briefjudofox/expo | 1c9b7a5c547d3b707e690137123dd5e1597c1eaf | [
"Apache-2.0",
"MIT"
] | 2 | 2020-01-02T06:07:18.000Z | 2021-09-30T11:09:41.000Z | ios/versioned-react-native/ABI33_0_0/React/CxxBridge/ABI33_0_0RCTMessageThread.h | briefjudofox/expo | 1c9b7a5c547d3b707e690137123dd5e1597c1eaf | [
"Apache-2.0",
"MIT"
] | 16 | 2021-03-01T21:18:59.000Z | 2022-02-27T08:18:52.000Z | ios/versioned-react-native/ABI33_0_0/React/CxxBridge/ABI33_0_0RCTMessageThread.h | briefjudofox/expo | 1c9b7a5c547d3b707e690137123dd5e1597c1eaf | [
"Apache-2.0",
"MIT"
] | 1 | 2020-07-26T03:57:59.000Z | 2020-07-26T03:57:59.000Z | /**
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
#import <string>
#import <Foundation/Foundation.h>
#import <ReactABI33_0_0/ABI33_0_0RCTJavaScriptExecutor.h>
#import <cxxReactABI33_0_0/ABI33_0_0MessageQueueThread.h>
namespace ABI33_0_0facebook {
namespace ReactABI33_0_0 {
class ABI33_0_0RCTMessageThread : public MessageQueueThread {
public:
ABI33_0_0RCTMessageThread(NSRunLoop *runLoop, ABI33_0_0RCTJavaScriptCompleteBlock errorBlock);
~ABI33_0_0RCTMessageThread() override;
void runOnQueue(std::function<void()>&&) override;
void runOnQueueSync(std::function<void()>&&) override;
void quitSynchronous() override;
void setRunLoop(NSRunLoop *runLoop);
private:
void tryFunc(const std::function<void()>& func);
void runAsync(std::function<void()> func);
void runSync(std::function<void()> func);
CFRunLoopRef m_cfRunLoop;
ABI33_0_0RCTJavaScriptCompleteBlock m_errorBlock;
std::atomic_bool m_shutdown;
};
}
}
| 27.74359 | 96 | 0.771719 |
723f65a94fa40a009eeef747b47b7c2ad8881393 | 869 | h | C | code/libs/ffmpeg/FFmpegContext.h | marek-g/freespace2_vr3d | 60047116fd2ed49002e101d1cb7358d8b16bcd1e | [
"Unlicense"
] | null | null | null | code/libs/ffmpeg/FFmpegContext.h | marek-g/freespace2_vr3d | 60047116fd2ed49002e101d1cb7358d8b16bcd1e | [
"Unlicense"
] | null | null | null | code/libs/ffmpeg/FFmpegContext.h | marek-g/freespace2_vr3d | 60047116fd2ed49002e101d1cb7358d8b16bcd1e | [
"Unlicense"
] | 1 | 2021-05-22T16:37:50.000Z | 2021-05-22T16:37:50.000Z | #pragma once
#include "globalincs/pstypes.h"
#include "cfile/cfile.h"
#include "FFmpeg.h"
#include "FFmpegHeaders.h"
#include <memory>
namespace libs {
namespace ffmpeg {
/**
* @brief Contains a FFmpeg context
*
* This should be used for making sure a FFmpeg context is always deallocated even if an exception is throws.
* createContex can be used for opening a specific file for FFmpeg decoding
*/
class FFmpegContext {
private:
AVFormatContext* m_ctx;
CFILE* m_file;
FFmpegContext(CFILE* file);
public:
~FFmpegContext();
FFmpegContext(const FFmpegContext&) = delete;
FFmpegContext& operator=(const FFmpegContext&) = delete;
inline AVFormatContext* ctx() { return m_ctx; }
static std::unique_ptr<FFmpegContext> createContext(CFILE* mediaFile);
static std::unique_ptr<FFmpegContext> createContext(const SCP_string& path, int dir_type);
};
}
} | 21.725 | 109 | 0.750288 |
edd5ca5af2508fe059cc3db45690fa4ad74cf409 | 2,635 | h | C | rock/external/mpp/mpp/hal/vpu/h264e/hal_h264e_vepu.h | NovasomIndustries/Utils-2019.01 | ab6d48edc03363f3ee4f1e9efc5269fdecfe35a8 | [
"MIT"
] | 2 | 2019-04-20T14:21:56.000Z | 2019-06-14T07:17:22.000Z | rock/external/mpp/mpp/hal/vpu/h264e/hal_h264e_vepu.h | NovasomIndustries/Utils-2019.07 | 4a41062e0f50c1f97cb37df91457672ce386516d | [
"MIT"
] | null | null | null | rock/external/mpp/mpp/hal/vpu/h264e/hal_h264e_vepu.h | NovasomIndustries/Utils-2019.07 | 4a41062e0f50c1f97cb37df91457672ce386516d | [
"MIT"
] | 1 | 2021-07-11T14:36:00.000Z | 2021-07-11T14:36:00.000Z | /*
* Copyright 2017 Rockchip Electronics Co. LTD
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef __HAL_H264E_VEPU_H__
#define __HAL_H264E_VEPU_H__
#include "hal_h264e_com.h"
#define HAL_VPU_H264E_DBG_FUNCTION (0x00000001)
#define HAL_VPU_H264E_DBG_QP (0x00000010)
#define hal_vpu_h264e_dbg(flag, fmt, ...) \
_mpp_dbg(hal_vpu_h264e_debug, flag, fmt, ## __VA_ARGS__)
#define hal_vpu_h264e_dbg_f(flag, fmt, ...) \
_mpp_dbg_f(hal_vpu_h264e_debug, flag, fmt, ## __VA_ARGS__)
#define hal_vpu_h264e_dbg_func(fmt, ...) \
hal_vpu_h264e_dbg_f(HAL_VPU_H264E_DBG_FUNCTION, fmt, ## __VA_ARGS__)
#define hal_vpu_h264e_dbg_qp(fmt, ...) \
hal_vpu_h264e_dbg(HAL_VPU_H264E_DBG_QP, fmt, ## __VA_ARGS__)
#define BIT(n) (1<<(n))
#define H264E_CABAC_TABLE_BUF_SIZE (52*2*464)
typedef enum H264eVpuFrameType_t {
H264E_VPU_FRAME_P = 0,
H264E_VPU_FRAME_I = 1
} H264eVpuFrameType;
/* struct for assemble bitstream */
typedef struct H264eVpuStream_t {
RK_U8 *buffer; /* point to first byte of stream */
RK_U8 *stream; /* Pointer to next byte of stream */
RK_U32 size; /* Byte size of stream buffer */
RK_U32 byte_cnt; /* Byte counter */
RK_U32 bit_cnt; /* Bit counter */
RK_U32 byte_buffer; /* Byte buffer */
RK_U32 buffered_bits; /* Amount of bits in byte buffer, [0-7] */
RK_U32 zero_bytes; /* Amount of consecutive zero bytes */
RK_S32 overflow; /* This will signal a buffer overflow */
RK_U32 emul_cnt; /* Counter for emulation_3_byte, needed in SEI */
} H264eVpuStream;
typedef struct H264eVpuExtraInfo_t {
H264eVpuStream sps_stream;
H264eVpuStream pps_stream;
H264eVpuStream sei_stream;
H264eSps sps;
H264ePps pps;
H264eSei sei;
RK_U8 *sei_buf;
RK_U32 sei_change_flg;
} H264eVpuExtraInfo;
typedef struct h264e_hal_vpu_buffers_t {
RK_S32 cabac_init_idc;
RK_S32 align_width;
RK_S32 align_height;
MppBufferGroup hw_buf_grp;
MppBuffer hw_rec_buf[2];
MppBuffer hw_cabac_table_buf;
MppBuffer hw_nal_size_table_buf;
} h264e_hal_vpu_buffers;
#endif
| 32.530864 | 75 | 0.719165 |
606c4c5589ea85d24a971e5456b7157c5a2adebe | 21,217 | c | C | benchmarks/source/superh/libsfpthread/spthr_internals.c | rhudson2802/sunflower-simulator | 9f55e03c9d80c024a75029d0e842cc5c92f31c82 | [
"BSD-3-Clause"
] | 7 | 2016-05-07T13:38:33.000Z | 2019-07-08T03:42:24.000Z | benchmarks/source/superh/libsfpthread/spthr_internals.c | rhudson2802/sunflower-simulator | 9f55e03c9d80c024a75029d0e842cc5c92f31c82 | [
"BSD-3-Clause"
] | 80 | 2019-08-27T14:43:46.000Z | 2020-12-16T11:56:19.000Z | benchmarks/source/superh/libsfpthread/spthr_internals.c | rhudson2802/sunflower-simulator | 9f55e03c9d80c024a75029d0e842cc5c92f31c82 | [
"BSD-3-Clause"
] | 98 | 2019-08-30T14:29:16.000Z | 2020-11-21T18:22:13.000Z | #include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "spthr_all.h"
#include "devmtsp.h"
#include "devrtc.h"
#include "devrand.h"
#include "spthr_error.h"
#include "spthr_staticmtable.h"
// !!!
// !!!
//TODO: thread creation is not sequential in general. All global
// structures need to be locked!!!
// Make all the globals unnamed structs with a lock field.
// !!!
// !!!
//TODO: we have two places where we cache the HW map table in SW:
// the maplist (spthr_maplist[hd,tl]) and the mapstats[]
// array in each thread state. We should unify these.
ThreadState *spthr_threadqhd = nil;
ThreadState *spthr_threadqtl = nil;
RegionMap *spthr_maplisthd = nil;
RegionMap *spthr_maplisttl = nil;
int spthr_nthreads = 0;
char spthr_initdone = 0;
Maddr spthr_loweststack;
LibMode spthr_mode = MODEFLAG;
ulong spthr_lastmapupdate;
int spthr_windowsize = SPTHR_MAPUPDATE_USECS;
/* */
/* Array of pointers to register save stacks of all */
/* threads. This is a tradeoff in implementation */
/* complexity vs. generality: The interrupt handler */
/* assembler code can quickly locate its register save */
/* area, but (1) we statically allocate this large array */
/* (2) An artificial limit is imposed on # of threads. */
/* */
Maddr spthr_regstackptrs[MAX_NTHREADS];
struct
{
Maddr addr;
uchar lock;
} spthr_mallocmutex;
struct
{
int max;
int who;
int oldwho;
} spthr_mapcounts[MAX_MAPCOUNT];
static void hdlr_install(void);
static void install_numaregion(ulong, ulong, char *, int, int, int, int, int, int);
static void printq(Sleepq *q);
static int findhome(char *name);
/* For informational purposes, to track mapping over time: */
char time_map[MAX_MAPCOUNT][8192];
int time_mapcount = 0;
void
spthr_addglobalstomap(void)
{
spthr_maptbl_add((Maddr)spthr_regstackptrs,
sizeof(spthr_regstackptrs), "Maddr spthr_regstackptrs[]",
SPTHR_MAP_PUBLIC, -1);
spthr_maptbl_add((Maddr)spthr_staticmaptable,
sizeof(spthr_staticmaptable), "StaticMap spthr_staticmaptable[]",
SPTHR_MAP_PUBLIC, -1);
spthr_maptbl_add((Maddr)&spthr_mallocmutex,
sizeof(spthr_mallocmutex), "struct spthr_mallocmutex",
SPTHR_MAP_PUBLIC, -1);
spthr_maptbl_add((Maddr)&spthr_mapcounts,
sizeof(spthr_mapcounts), "struct spthr_mapcounts",
SPTHR_MAP_PUBLIC, -1);
spthr_maptbl_add((Maddr)&spthr_threadqhd,
sizeof(spthr_threadqhd), "ThreadState *spthr_threadqhd",
SPTHR_MAP_PUBLIC, -1);
spthr_maptbl_add((Maddr)&spthr_threadqtl,
sizeof(spthr_threadqtl), "ThreadState *spthr_threadqtl",
SPTHR_MAP_PUBLIC, -1);
spthr_maptbl_add((Maddr)&spthr_maplisthd,
sizeof(spthr_maplisthd), "RegionMap *spthr_maplisthd",
SPTHR_MAP_PUBLIC, -1);
spthr_maptbl_add((Maddr)&spthr_maplisttl,
sizeof(spthr_maplisttl), "RegionMap *spthr_maplisttl",
SPTHR_MAP_PUBLIC, -1);
spthr_maptbl_add((Maddr)&spthr_nthreads,
sizeof(spthr_nthreads), "int spthr_nthreads",
SPTHR_MAP_PUBLIC, -1);
spthr_maptbl_add((Maddr)&spthr_initdone,
sizeof(spthr_initdone), "char spthr_initdone",
SPTHR_MAP_PUBLIC, -1);
spthr_maptbl_add((Maddr)&spthr_loweststack,
sizeof(spthr_loweststack), "Maddr spthr_loweststack",
SPTHR_MAP_PUBLIC, -1);
spthr_maptbl_add((Maddr)&spthr_mode,
sizeof(spthr_mode), "LibMode spthr_mode",
SPTHR_MAP_PUBLIC, -1);
spthr_maptbl_add((Maddr)&spthr_windowsize,
sizeof(spthr_windowsize), "int spthr_windowsize",
SPTHR_MAP_PUBLIC, -1);
return;
}
ThreadState *
spthr_allocthread(Maddr startpc, Maddr argaddr)
{
if (spthr_nthreads == MAX_NTHREADS)
{
return nil;
}
/* Need things like maxnread in MapStat to be zeroed */
ThreadState *new = (ThreadState*)calloc(1, sizeof(ThreadState));
if (new == nil)
{
return nil;
}
/* */
/* New thread's stack is STKSIZE bytes below the lowest */
/* thread stack in this shared address space. */
/* */
//more general, but linear in # threads:
//new->stkaddr = spthr_getloweststk() - STKSIZE;
//less general, but constant time:
new->stkaddr = spthr_loweststack - STKSIZE;
spthr_loweststack = new->stkaddr;
new->stksize = STKSIZE;
new->id = spthr_nthreads;
new->status = STATUS_ACTIVE;
new->fnaddr = startpc;
new->fnargaddr = argaddr;
new->privaddr = 0;
new->next = nil;
//TODO: need a way to ensure that a thread's id field is what is
// read from THREADID register
spthr_regstackptrs[new->id] = (Maddr)new->registers;
if (DEBUG)
{
print("new thread id=%d, regsavestack @ %x\n",
new->id, (Maddr)new->registers);
}
snprintf(new->name, NAMELEN, "ThreadState *ThreadState0x%lx.%d",
startpc, spthr_nthreads);
spthr_nthreads++;
/* */
/* Threadstate *new is added to map table by thread's */
/* own trampoline. */
/* */
return new;
}
void
spthr_addthread(ThreadState *new)
{
if (spthr_threadqtl == nil)
{
spthr_threadqtl = spthr_threadqhd = new;
return;
}
spthr_threadqtl->next = new;
spthr_threadqtl = new;
return;
}
void
spthr_init(void)
{
ThreadState *t;
hdlr_install();
/* Need things like maxnread in MapStat to be zeroed */
t = calloc(1, sizeof(ThreadState));
if (t == nil)
{
spthr_threadfatal(Emalloc);
}
t->id = spthr_nthreads;
t->status = STATUS_ACTIVE;
t->stksize = STKSIZE;
/* */
/* The main thread ends up having the amount of stack */
/* space at the time of the call to spthr_init, plus */
/* STKSIZE */
/* */
t->stkaddr = spthr_getcallerstk();
spthr_loweststack = t->stkaddr;
t->fnaddr = 0;
t->fnargaddr = 0;
t->privaddr = 0;
t->next = nil;
spthr_addthread(t);
snprintf(t->name, NAMELEN, "ThreadState *init0x%lx.%d",
spthr_getcallerpc(), spthr_nthreads);
spthr_maptbl_add((Maddr)t, sizeof(ThreadState), t->name,
SPTHR_MAP_PRIVATE, -1);
spthr_addglobalstomap();
spthr_nthreads++;
//TODO: need a way to ensure that a thread's id field is what is
// read from THREADID register
spthr_regstackptrs[t->id] = (Maddr)t->registers;
if (DEBUG)
{
print("done spthr_init, init thread has ID=%d, regsavestack at %x...\n",
t->id, spthr_regstackptrs[t->id]);
}
spthr_tas(&spthr_initdone);
spthr_spllo();
return;
}
void
spthr_threadfatal(const char *error)
{
enum {BUFLEN = 256};
char buf[BUFLEN];
snprintf(buf, BUFLEN, "sfatal \"%s\"", error);
spthr_simcmd(buf);
return;
}
Maddr
spthr_getloweststk(void)
{
Maddr stkaddr;
ThreadState *t;
if (spthr_threadqhd == nil)
{
spthr_threadfatal(Ethreadq);
}
t = spthr_threadqhd;
stkaddr = spthr_threadqhd->stkaddr;
t = t->next;
while (t != nil)
{
stkaddr = min(t->stkaddr, stkaddr);
t = t->next;
}
return stkaddr;
}
void
spthr_sleep(Sleepq **q, pthread_mutex_t *mutex)
{
Sleepq *tmp;
Sleepq *s;
s = (Sleepq *) malloc(sizeof(Sleepq));
if (s == nil)
{
spthr_threadfatal(Emalloc);
}
s->threadid = spthr_myid();
spthr_maptbl_add((Maddr)s, sizeof(Sleepq), "Sleepq *s",
SPTHR_MAP_PUBLIC, -1);
if (*q != nil)
{
printq(*q);
spthr_threadfatal("sleeping on a non-empty queue");
}
/* Add to front of list */
tmp = *q;
*q = s;
s->next = tmp;
/* */
/* We'll be awoken by timer interrupts */
/* The rdy flag is set when someone */
/* unlocks the object on whose Sleepq */
/* we are dozing. */
/* */
s->rdy = 0;
if (DEBUG)
{
print("\tsleeping on queue [0x%x], *q = [0x%x], (*q)->next = [0x%x]\n",
(ulong)q, (ulong)(*q), (ulong)(*q)->next);
}
/* */
/* If a mutex was passed in, unlock it */
/* before dozing. */
/* */
if (mutex != nil)
{
pthread_mutex_unlock(mutex);
}
while (!s->rdy)
{
spthr_dosleep();
}
if (DEBUG)
{
print("\tAwoken from sleep on item at addr [0x%x]...\n", (ulong)s);
}
spthr_maptbl_del((Maddr)s);
free((void *)s);
return;
}
void
spthr_wakeup(Sleepq **q)
{
Sleepq *o = nil;
Sleepq *p;
p = *q;
if (DEBUG)
{
print("\tin spthr_wakeup(): q=[0x%x], *q=[0x%x]...\n",
(ulong)q, (ulong)p);
printq(p);
}
if (p == nil)
{
return;
}
/* */
/* Wake + del the sole item on queue: */
/* It gets free()'d in spthr_sleep() */
/* */
if (p->next == nil)
{
p->rdy = 1;
/* */
/* NOTE: p is a copy. */
/* Clear actual queue ptr */
/* */
*q = nil;
return;
}
printq(p);
spthr_threadfatal("debug: more than one sleeper!");
/* */
/* Wake + del the oldest item on queue. */
/* free()'ing and removal from map table */
/* is done by sleeper, after waking up. */
/* */
while (p->next != nil)
{
o = p;
p = p->next;
}
o->next = nil;
p->rdy = 1;
return;
}
void
spthr_maptbl_add(Maddr addr, int size, char *name, int scope, int homenode)
{
RegionMap *m;
int lrlat = -1, lwlat = -1;
//TODO: these really shouldnt be hard coded here like this.
// instead, we need a more flexible numaregion in sim
// (along with the flexible-multi-memory) so that we rather
// just specify which of the device's memories we want to
// map this into.
// for static-all-memory-local, set both to -1
int rrlat = 100, rwlat = 100;
int myid = spthr_myid();
int mapid = myid;
m = (RegionMap*)malloc(sizeof(RegionMap));
if (m == nil)
{
spthr_threadfatal(Emalloc);
}
m->id = devmtsp_getcount();
m->addr = addr;
m->size = size;
m->next = nil;
if (spthr_maplisthd == nil)
{
spthr_maplisthd = spthr_maplisttl = m;
}
else
{
spthr_maplisttl->next = m;
spthr_maplisttl = m;
}
if (spthr_mode == SPTHR_LIB_STATIC)
{
int where;
if (homenode < 0)
{
where = findhome(name);
}
else
{
where = homenode;
}
if (where == SPTHR_MAP_INVALID)
{
printf("Sfpthr Lib: No entry for \"%s\" in static map table\n", name);
spthr_threadfatal("Bad static map table");
}
if (where == SPTHR_MAP_LOCAL)
{
mapid = myid;
}
else
{
mapid = where;
}
}
if (scope == SPTHR_MAP_PRIVATE)
{
install_numaregion(addr, size, name, mapid,
lrlat, lwlat, rrlat, rwlat, 1);
}
else if (scope == SPTHR_MAP_PUBLIC)
{
install_numaregion(addr, size, name, mapid,
lrlat, lwlat, rrlat, rwlat, 0);
}
else
{
spthr_threadfatal(Ebadscope);
}
return;
}
void
spthr_maptbl_del(Maddr addr)
{
RegionMap *m = spthr_maplisthd, *p = nil;
return;
while (m != nil)
{
if (m->addr == addr)
{
if (p == nil)
{
p = spthr_maplisthd;
spthr_maplisthd = spthr_maplisttl = nil;
free(p);
return;
}
p->next = m->next;
free(m);
return;
}
p = m;
m = m->next;
}
return;
}
RegionMap*
spthr_maptbl_getmapbyid(int id)
{
RegionMap *m = spthr_maplisthd;
while (m != nil)
{
if (m->id == id)
{
return m;
}
m = m->next;
}
return nil;
}
int
spthr_maptbl_isvalid(Maddr addr)
{
RegionMap *m = spthr_maplisthd;
return 1;
while (m != nil)
{
if (m->addr == addr)
{
return 1;
}
m = m->next;
}
return 0;
}
int
spthr_myid(void)
{
return *((volatile ulong *)THREADID_ADDR);
}
ThreadState *
spthr_getthreadstate(int threadid)
{
ThreadState *p;
p = spthr_threadqhd;
while (p != NULL)
{
if (p->id == threadid)
{
return p;
}
p = p->next;
}
return NULL;
}
void
install_numaregion(ulong start, ulong size, char *name, int id,
int lrlat, int lwlat, int rrlat, int rwlat, int private)
{
enum {buflen = 256};
uchar buf[buflen];
snprintf(buf, buflen, "numaregion \"%.128s\" 0x%lx 0x%lx %d %d %d %d %d 0 %d\n",
name, start, start+size, lrlat, lwlat, rrlat, rwlat, id, private);
spthr_simcmd(buf);
return;
}
void
local_mapstats(void)
{
int i;
ThreadState *me;
int count = devmtsp_getcount();
if (count >= MAX_MAPCOUNT)
{
spthr_threadfatal(Emaxmaps);
}
me = spthr_getthreadstate(spthr_myid());
if (me == NULL)
{
spthr_threadfatal(Ethreadidstate);
}
for (i = 0; i < count; i++)
{
me->mapstats[i].nreads = devmtsp_clearrdcnt(i);
me->mapstats[i].nwrites = devmtsp_clearwrcnt(i);
me->mapstats[i].maxnreads =
max(me->mapstats[i].maxnreads, me->mapstats[i].nreads);
me->mapstats[i].maxnwrites =
max(me->mapstats[i].maxnwrites, me->mapstats[i].nwrites);
}
me->mapstats_timestamp = devrtc_getusecs();
return;
}
/* */
/* updatewindow() and updatepred() work in tandem. updatewindow() */
/* tries to keep the update window to be the largest such that we */
/* still correctly track the changes in optimal mapping at the */
/* granularity at which they happen. This is the fine grained window; */
/* The granularity with which we actually change the mapping will be */
/* much larger. */
/* */
/* Given that we are tracking the changes in optimum mapping at the */
/* granularity at which they occur, updatepred() tries to track the */
/* distribution of duration of mapping of each map object to each CPU. */
/* e.g., map object A one run of duration 0-50ms, 12 runs of duration */
/* 50-100ms and 19 runs of duration >100ms (we could further break this */
/* up by which cpu the map-run corresponds to, but for now we dont). */
/* These statistics give us a "relative frequency" model for the */
/* probability distribution of run lengths. We can then use this */
/* distribution to predict which of the mappings from the previous */
/* window will ... (we thus need to track how long a given mapping */
/* has been the best mapping) */
/* Similarly, maintaining the distribution on number of accesses for */
/* which a given mapping is the optimum lets us predict the number of */
/* accesses that will be made in determining the reconf cost vs benefit */
/* tradeoff. */
/* In using both of the above dists, be random pick from a bag of */
/* colored balls, with the number of balls of each color prop to the */
/* probability */
/* */
void
updatewindow(void)
{
}
void
updatepred(ThreadState *t, int i, int nreads, int nwrites)
{
int coin, naccesses, maxaccesses, minaccesses, scaledrand;
ulong rand = devrand_getrand();
if (spthr_mode == SPTHR_LIB_DYNAMIC_1)
{
/* */
/* Alternative 1: prediction for next window */
/* is the results from the current window. */
/* This would fit well with lifetimes of maps */
/* being heavy tailed */
/* */
/* old behavior continues */
t->mapstats[i].prednreads = nreads;
t->mapstats[i].prednwrites = nwrites;
}
else if (spthr_mode == SPTHR_LIB_DYNAMIC_2)
{
/* */
/* Alternative 2: assuming number of accesses */
/* during a window is either high or low, then */
/* for each prediction, we flip a coin, and if */
/* it comes up heads, we use either the high */
/* (max so far) if naccesses in previos window */
/* was close to the low (min so far) and vice */
/* versa. This mimics the coin-flipping binomial */
/* basis for exponential. */
/* */
coin = rand & 1;
if (!coin)
{
/* old behavior continues */
t->mapstats[i].prednreads = nreads;
t->mapstats[i].prednwrites = nwrites;
}
else
{
/* old behavior ends */
naccesses = nreads + nwrites;
maxaccesses = t->mapstats[i].maxnreads + t->mapstats[i].maxnwrites;
if (naccesses > maxaccesses/2)
{
t->mapstats[i].prednreads = t->mapstats[i].minnreads;
t->mapstats[i].prednwrites = t->mapstats[i].minnwrites;
}
else
{
t->mapstats[i].prednreads = t->mapstats[i].maxnreads;
t->mapstats[i].prednwrites = t->mapstats[i].maxnwrites;
}
}
}
else if (spthr_mode == SPTHR_LIB_DYNAMIC_3)
{
/* */
/* Alternative 3: assuming the duration of map */
/* lifetimes/#accesses is uniform, predict a */
/* number of accesses for next period uniformly */
/* at random between the min # accesses seen and */
/* max seen to date. */
/* */
maxaccesses = t->mapstats[i].maxnreads + t->mapstats[i].maxnwrites;
minaccesses = t->mapstats[i].minnreads + t->mapstats[i].minnwrites;
scaledrand = (rand/(~0L)) * (maxaccesses - minaccesses) + minaccesses;
t->mapstats[i].prednreads = scaledrand;
t->mapstats[i].prednwrites = scaledrand;
}
else
{
spthr_threadfatal(Ebaddynamicmode);
}
return;
}
void
map_update(void)
{
/* BUG: these shouldnt be hardcoded like this */
int localweight = 0, remoteweight = 100;
int i, j, oldnaccesses, prednaccesses, hwcount;
float oldcost, newcost;
ThreadState *t;
char buf[128];
hwcount = devmtsp_getcount();
for (i = 0; i < hwcount; i++)
{
RegionMap *map = spthr_maptbl_getmapbyid(i);
if (map == nil)
{
/* Not in library map table; Skip. */
continue;
}
spthr_mapcounts[i].oldwho = spthr_mapcounts[i].who;
spthr_mapcounts[i].who = spthr_mapcounts[i].max = -1;
oldcost = 0;
t = spthr_threadqhd;
while (t != NULL)
{
updatepred(t, i, t->mapstats[i].nreads, t->mapstats[i].nwrites);
oldnaccesses =
t->mapstats[i].nreads + t->mapstats[i].nwrites;
prednaccesses =
t->mapstats[i].prednreads + t->mapstats[i].prednwrites;
if (t->id == spthr_mapcounts[i].oldwho)
{
oldcost += (float)oldnaccesses*(float)localweight
/(float)spthr_windowsize;
}
else
{
oldcost += (float)oldnaccesses*(float)remoteweight
/(float)spthr_windowsize;
}
if (prednaccesses > spthr_mapcounts[i].max)
{
spthr_mapcounts[i].max = prednaccesses;
spthr_mapcounts[i].who = t->id;
}
t = t->next;
}
updatewindow();
newcost = 0;
t = spthr_threadqhd;
while (t != NULL)
{
prednaccesses = t->mapstats[i].prednreads + t->mapstats[i].prednwrites;
if (t->id == spthr_mapcounts[i].who)
{
newcost += (float)prednaccesses*(float)localweight
/(float)spthr_windowsize;
}
else
{
newcost += (float)prednaccesses*(float)remoteweight
/(float)spthr_windowsize;
if (t->id == spthr_mapcounts[i].oldwho)
{
/* */
/* Overhead of DMA'ing set to */
/* size * cost of remote access */
/* */
newcost += (float)map->size*(float)remoteweight
/(float)spthr_windowsize;
}
}
t = t->next;
}
printf("map entry %d,\toldcost = %f, newcost = %f ", i, oldcost, newcost);
if ((newcost < oldcost) && (spthr_mapcounts[i].who != spthr_mapcounts[i].oldwho))
{
printf("(size %ld, moving from %d->%d)",
map->size, spthr_mapcounts[i].oldwho, spthr_mapcounts[i].who);
/* Update the mapping; Locks bus in process */
snprintf(buf, sizeof(buf), "numasetmapid %d %d", i, spthr_mapcounts[i].who);
spthr_simcmd(buf);
}
printf("\n");
}
for (i = 0; i < hwcount; i++)
{
time_map[i][time_mapcount] = spthr_mapcounts[i].who;
}
if (time_mapcount == 100) for (i = 0; i < hwcount; i++)
{
lprint("\t\tentry%d: ", i);
for (j = 0; j < time_mapcount; j++)
{
lprint("%d ", time_map[i][j]);
}
lprint("\n");
}
time_mapcount++;
return;
}
void
intr_hdlr(void)
{
ulong now;
ThreadState *me;
if (spthr_mode == SPTHR_LIB_STATIC)
{
return;
}
now = devrtc_getusecs();
me = spthr_getthreadstate(spthr_myid());
if (me == NULL)
{
spthr_threadfatal(Ethreadidstate);
}
/* */
/* Ideally we'd like the map_update computation to be */
/* parallelized across all CPUs. Each CPU's intr hdlr */
/* (i.e., us) reads its specific entries in the MTSP, */
/* into its thread state structure. */
/* */
/* Need to ensure that these snapshots are synchronized */
/* */
/* One of the CPUs then scans all the thread state */
/* structures to compute the new map table. */
/* */
//TODO: preliminary study (mapping vs time plot) show it may
// sometimes be beneficial to have the window sizes be per-
// map table object
if ((now - me->mapstats_timestamp) > spthr_windowsize)
{
local_mapstats();
/* For now, hard coded that map maintainance runs on CPU0 */
if (spthr_myid() == 0)
{
map_update();
}
return;
}
return;
}
int
findhome(char *name)
{
int i, matchlen;
for (i = 0; spthr_staticmaptable[i].homenode != SPTHR_MAP_END; i++)
{
matchlen = strlen(spthr_staticmaptable[i].name);
if (!strncmp(name, spthr_staticmaptable[i].name, matchlen))
{
return spthr_staticmaptable[i].homenode;
}
}
return SPTHR_MAP_INVALID;
}
void
hdlr_install(void)
{
extern uchar intr_vec_stub_begin, intr_vec_stub_end;
uchar *dstptr;
uchar *srcptr;
/* Interrupts */
dstptr = (uchar *)0x8000600;
srcptr = &intr_vec_stub_begin;
while (srcptr < &intr_vec_stub_end)
{
*dstptr++ = *srcptr++;
}
/* Exceptions */
/*
dstptr = (uchar *)0x8000100;
srcptr = &excp_vec_stub_begin;
while (srcptr < &excp_vec_stub_end)
{
*dstptr++ = *srcptr++;
}
*/
return;
}
void
printq(Sleepq *q)
{
Sleepq *p = q;
while (p != nil)
{
printf("\tQueue item, addr = [0x%lx] rdy=%d, thread=%d...\n",
(ulong)p, p->rdy, p->threadid);
p = p->next;
}
}
/* */
/* These two functions must be provided so that newlib will */
/* lock the memory pool during malloc(). They spin-lock to */
/* provide global mutual exclusion. */
/* */
void
__malloc_lock(void *addr)
{
/* */
/* Some C libraries require recursive locks, */
/* i.e., do not block on an attempt to lock */
/* an addr (supplied) to which one already owns */
/* the lock, but not newlib: */
/*
if ((Maddr)addr == spthr_mallocmutex.addr)
{
return;
}
*/
while (!spthr_tas(&(spthr_mallocmutex.lock)))
{
spthr_dosleep();
}
spthr_mallocmutex.addr = (Maddr)addr;
return;
}
void
__malloc_unlock(void)
{
spthr_mallocmutex.lock = 0;
spthr_mallocmutex.addr = -1;
}
| 20.86234 | 83 | 0.647264 |
c2727ef2832dabe2a31bcf81e57e04fc092bf3bb | 107 | h | C | crc32.h | kitserver/kitserver4 | 7b3f19dfe96a51b9b018b636263b10d707b58b50 | [
"BSD-3-Clause"
] | 1 | 2019-08-31T18:20:10.000Z | 2019-08-31T18:20:10.000Z | crc32.h | kitserver/kitserver4 | 7b3f19dfe96a51b9b018b636263b10d707b58b50 | [
"BSD-3-Clause"
] | null | null | null | crc32.h | kitserver/kitserver4 | 7b3f19dfe96a51b9b018b636263b10d707b58b50 | [
"BSD-3-Clause"
] | 1 | 2021-10-11T03:45:47.000Z | 2021-10-11T03:45:47.000Z | #ifndef _JUCE_CRC32_
#define _JUCE_CRC32_
#include <windows.h>
DWORD Sign(BYTE* buffer);
#endif
| 11.888889 | 26 | 0.700935 |
885592022e3eec26e8c77a07507e526146ca1e3e | 1,496 | h | C | wireshark-2.0.13/plugins/ethercat/packet-ethercat-frame.h | mahrukhfida/mi | 7187765aa225e71983969ef5285771ac77c8309a | [
"Apache-2.0"
] | null | null | null | wireshark-2.0.13/plugins/ethercat/packet-ethercat-frame.h | mahrukhfida/mi | 7187765aa225e71983969ef5285771ac77c8309a | [
"Apache-2.0"
] | null | null | null | wireshark-2.0.13/plugins/ethercat/packet-ethercat-frame.h | mahrukhfida/mi | 7187765aa225e71983969ef5285771ac77c8309a | [
"Apache-2.0"
] | null | null | null | /* paket-ethercat-frame.h
*
* Copyright (c) 2007 by Beckhoff Automation GmbH
*
* Wireshark - Network traffic analyzer
* By Gerald Combs <gerald@wireshark.org>
* Copyright 1998 Gerald Combs
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#ifndef _PACKET_ETHERCAT_FRAME_H
#define _PACKET_ETHERCAT_FRAME_H
#include <wsutil/ws_diag_control.h>
/* structure for decoding the header -----------------------------------------*/
DIAG_OFF(pedantic)
typedef union _EtherCATFrameParser
{
struct
{
guint16 length : 11;
guint16 reserved : 1;
guint16 protocol : 4;
} v;
guint16 hdr;
} EtherCATFrameParserHDR;
DIAG_ON(pedantic)
typedef EtherCATFrameParserHDR *PEtherCATFrameParserHDR;
#define EtherCATFrameParserHDR_Len (int)sizeof(EtherCATFrameParserHDR)
#endif /* _PACKET_ETHERCAT_FRAME_H */
| 32.521739 | 80 | 0.733289 |
88564ac2d4801b28b66c04a424548a814c34a76e | 2,896 | h | C | include/c/shell.h | cpl/classic.kernel | 3e5bbaa85afe7b38d6de977853c0777ce106c7d2 | [
"Apache-2.0"
] | 4 | 2019-06-06T09:16:28.000Z | 2020-12-12T23:33:55.000Z | include/c/shell.h | thee-engineer/classic.kernel | 3e5bbaa85afe7b38d6de977853c0777ce106c7d2 | [
"Apache-2.0"
] | null | null | null | include/c/shell.h | thee-engineer/classic.kernel | 3e5bbaa85afe7b38d6de977853c0777ce106c7d2 | [
"Apache-2.0"
] | 1 | 2021-06-25T17:30:54.000Z | 2021-06-25T17:30:54.000Z | /*
Copyright 2018-2019 Alexandru-Paul Copil
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 _INC_SHELL_H
#define _INC_SHELL_H
#include "types.h"
#include "sched.h"
extern task _SHELL_TASK;
#define SHELL_BUFFER_SIZE 512
#define SHELL_SYMBOL "\r$."
#define SHELL_END "\n"
#define SHELL_SPLIT_SYMBOL ':'
#define SHELL_MAX_ARGC 16
#define SHELL_CMD_MAX_LEN 64
#define ASCII_NULL 0x00
#define ASCII_BS 0x08
#define ASCII_HT 0x09
#define ASCII_LF 0x0A
#define ASCII_CR 0x0D
extern void shell_init(void);
extern void shell_refresh(const char* buf);
extern void shell_handlecmd(char* buf);
extern void _shell_arg_debug(u32 argc, char* argv[]);
// CMD
// cmd function format
typedef void (*cmd_ptr)(u32 argc, char* argv[]);
extern void _cmd_undefined(u32 argc, char* argv[]);
extern void _cmd_help(u32 argc, char* argv[]);
extern void _cmd_clear(u32 argc, char* argv[]);
extern void _cmd_time(u32 argc, char* argv[]);
extern void _cmd_gpio(u32 argc, char* argv[]);
extern void _cmd_mem(u32 argc, char* argv[]);
extern void _cmd_notfound();
#define _CMD_ID_HELP 0
#define _CMD_ID_CLEAR 1
#define _CMD_ID_REBOOT 2
#define _CMD_ID_TIME 3
#define _CMD_ID_GPIO 4
#define _CMD_ID_MEM 5
static const char SHELL_CMDID_CMDSTR[][SHELL_BUFFER_SIZE] = {
[_CMD_ID_HELP] = "help",
[_CMD_ID_CLEAR] = "clear",
[_CMD_ID_REBOOT] = "reboot",
[_CMD_ID_TIME] = "time",
[_CMD_ID_GPIO] = "gpio",
[_CMD_ID_MEM] = "mem",
};
static const char SHELL_CMDID_CMDINS[][SHELL_CMD_MAX_LEN] = {
[_CMD_ID_HELP] = "display this help message",
[_CMD_ID_CLEAR] = "clear the framebuffer using the background color",
[_CMD_ID_REBOOT] = "restart the operating system",
[_CMD_ID_TIME] = "display the system time",
[_CMD_ID_GPIO] = "control LOW/HIGH and FN SEL of GPIO",
[_CMD_ID_MEM] = "allows for on memory operations",
};
static const cmd_ptr SHELL_CMDID_CMDFN[] = {
[_CMD_ID_HELP] = _cmd_help,
[_CMD_ID_CLEAR] = _cmd_clear,
[_CMD_ID_REBOOT] = _cmd_undefined,
[_CMD_ID_TIME] = _cmd_time,
[_CMD_ID_GPIO] = _cmd_gpio,
[_CMD_ID_MEM] = _cmd_mem,
};
#define SHELL_CMD_LIMIT (sizeof(SHELL_CMDID_CMDSTR)/(SHELL_BUFFER_SIZE))
#define SHELL_CMD_MAX SHELL_CMD_LIMIT-1
#endif
| 27.580952 | 77 | 0.690262 |
32b97758a03a7c31298259d5441ab3ba55b6976f | 6,306 | h | C | compression/include/cudaCompress/CompressVolume.h | shamanDevel/fV-SRN | 966926ee678a0db0f1c67661537c4bb7eec0c56f | [
"MIT"
] | 13 | 2021-12-06T05:08:09.000Z | 2022-03-07T15:11:06.000Z | compression/include/cudaCompress/CompressVolume.h | shamanDevel/fV-SRN | 966926ee678a0db0f1c67661537c4bb7eec0c56f | [
"MIT"
] | 1 | 2022-02-07T10:07:44.000Z | 2022-02-24T14:13:50.000Z | compression/include/cudaCompress/CompressVolume.h | shamanDevel/fV-SRN | 966926ee678a0db0f1c67661537c4bb7eec0c56f | [
"MIT"
] | 5 | 2021-12-13T07:02:23.000Z | 2022-01-12T15:46:44.000Z | #ifndef __TUM3D__COMPRESS_VOLUME_H__
#define __TUM3D__COMPRESS_VOLUME_H__
#include "global.h"
#include <vector>
#include <cuda_runtime.h>
#include <cudaCompress/Instance.h>
#include <cudaCompress/util/CudaTimer.h>
namespace cudaCompress
{
inline size_t getAlignedSize(size_t size, size_t numBytes = 128)
{
return (size + numBytes - 1) / numBytes * numBytes;
}
template<typename T>
inline void align(T*& pData, size_t numBytes = 128)
{
pData = (T*)getAlignedSize(size_t(pData), numBytes);
}
// Helper class to manage shared GPU resources (scratch buffers and cudaCompress instance).
// Usage: Fill a Config (use merge to build max required sizes etc over all clients), then call create() to initialize.
class GPUResources
{
public:
GPUResources();
~GPUResources();
struct Config
{
Config();
int cudaDevice; // set to -1 (default) to use the current one
uint blockCountMax;
uint elemCountPerBlockMax;
uint codingBlockSize;
uint log2HuffmanDistinctSymbolCountMax;
size_t bufferSize;
void merge(const Config& other);
};
bool create(const Config& config);
void destroy();
const Config& getConfig() const { return m_config; }
cudaCompress::Instance* m_pCuCompInstance;
// get a buffer of the specified size in GPU memory
byte* getByteBuffer(size_t bytes);
template<typename T>
T* getBuffer(size_t count) { return (T*)getByteBuffer(count * sizeof(T)); }
// release the last buffer(s) returned from getBuffer
void releaseBuffer();
void releaseBuffers(uint bufferCount);
private:
Config m_config;
byte* m_dpBuffer;
size_t m_bufferOffset;
std::vector<size_t> m_allocatedSizes;
};
struct CompressVolumeResources
{
CompressVolumeResources()
: pUpload(nullptr), syncEventUpload(0) {}
static GPUResources::Config getRequiredResources(uint sizeX, uint sizeY, uint sizeZ, uint channelCount, uint log2HuffmanDistinctSymbolCountMax = 0);
bool create(const GPUResources::Config& config);
void destroy();
byte* pUpload;
cudaEvent_t syncEventUpload;
cudaCompress::util::CudaTimerResources timerEncode;
cudaCompress::util::CudaTimerResources timerDecode;
};
// helper struct for multi-channel compression functions
struct VolumeChannel
{
float* dpImage;
const uint* pBits;
uint bitCount;
float quantizationStepLevel0;
};
// Compress one level of a scalar volume (lossless):
// - perform integer (reversible) DWT
// - encode highpass coefficients into bitstream
// - return lowpass coefficients
// The input is assumed to be roughly zero-centered.
// Decompress works analogously.
bool compressVolumeLosslessOneLevel(GPUResources& shared, CompressVolumeResources& resources, const short* dpImage, uint sizeX, uint sizeY, uint sizeZ, short* dpLowpass, std::vector<uint>& highpassBitStream);
void decompressVolumeLosslessOneLevel(GPUResources& shared, CompressVolumeResources& resources, short* dpImage, uint sizeX, uint sizeY, uint sizeZ, const short* dpLowpass, const std::vector<uint>& highpassBitStream);
// Convenience functions for multi-level lossless compression
bool compressVolumeLossless(GPUResources& shared, CompressVolumeResources& resources, const short* dpImage, uint sizeX, uint sizeY, uint sizeZ, uint numLevels, std::vector<uint>& bits);
void decompressVolumeLossless(GPUResources& shared, CompressVolumeResources& resources, short* dpImage, uint sizeX, uint sizeY, uint sizeZ, uint numLevels, const std::vector<uint>& bits);
// Compress a volume (lossy):
// - perform numLevels DWT
// - quantize coefficients and encode into bitstream
// The input is assumed to be roughly zero-centered.
// Decompress works analogously.
bool compressVolumeFloat(GPUResources& shared, CompressVolumeResources& resources, const float* dpImage, uint sizeX, uint sizeY, uint sizeZ, uint numLevels, std::vector<uint>& bitStream, float quantizationStepLevel0, bool doRLEOnlyOnLvl0 = false);
void decompressVolumeFloat(GPUResources& shared, CompressVolumeResources& resources, float* dpImage, uint sizeX, uint sizeY, uint sizeZ, uint numLevels, const std::vector<uint>& bitStream, float quantizationStepLevel0, bool doRLEOnlyOnLvl0 = false);
void decompressVolumeFloat(GPUResources& shared, CompressVolumeResources& resources, float* dpImage, uint sizeX, uint sizeY, uint sizeZ, uint numLevels, const uint* pBits, uint bitCount, float quantizationStepLevel0, bool doRLEOnlyOnLvl0 = false);
void decompressVolumeFloatMultiChannel(GPUResources& shared, CompressVolumeResources& resources, const VolumeChannel* pChannels, uint channelCount, uint sizeX, uint sizeY, uint sizeZ, uint numLevels, bool doRLEOnlyOnLvl0 = false);
// Compress a volume (lossy):
// - quantize first
// - perform numLevels integers DWT
// - encode coefficients into bitstream
// This ensures a maximum error <= quantStep / 2
bool compressVolumeFloatQuantFirst(GPUResources& shared, CompressVolumeResources& resources, const float* dpImage, uint sizeX, uint sizeY, uint sizeZ, uint numLevels, std::vector<uint>& bitStream, float quantizationStep, bool doRLEOnlyOnLvl0 = false);
bool decompressVolumeFloatQuantFirst(GPUResources& shared, CompressVolumeResources& resources, float* dpImage, uint sizeX, uint sizeY, uint sizeZ, uint numLevels, const std::vector<uint>& bitStream, float quantizationStep, bool doRLEOnlyOnLvl0 = false);
bool decompressVolumeFloatQuantFirst(GPUResources& shared, CompressVolumeResources& resources, float* dpImage, uint sizeX, uint sizeY, uint sizeZ, uint numLevels, const uint* pBits, uint bitCount, float quantizationStep, bool doRLEOnlyOnLvl0 = false);
bool decompressVolumeFloatQuantFirstMultiChannel(GPUResources& shared, CompressVolumeResources& resources, const VolumeChannel* pChannels, uint channelCount, uint sizeX, uint sizeY, uint sizeZ, uint numLevels, bool doRLEOnlyOnLvl0 = false);
}
#endif
| 43.191781 | 257 | 0.720901 |
b83b1d4aed7f52fed73190991c74e61910c2cb8c | 196 | h | C | headers/skyfun_plane.h | M1TDoPHOT/DoPHOT_C | d434662e918854d96eb8d607506a433cd2ff7a48 | [
"MIT"
] | 2 | 2019-01-22T08:51:29.000Z | 2020-06-28T01:48:50.000Z | headers/skyfun_plane.h | M1TDoPHOT/DoPHOT_C | d434662e918854d96eb8d607506a433cd2ff7a48 | [
"MIT"
] | null | null | null | headers/skyfun_plane.h | M1TDoPHOT/DoPHOT_C | d434662e918854d96eb8d607506a433cd2ff7a48 | [
"MIT"
] | 1 | 2019-01-22T08:51:32.000Z | 2019-01-22T08:51:32.000Z | #ifndef _SKYFUN_PLANE_H_
#define _SKYFUN_PLANE_H_
/* dophot function converted to C function 01-20-2012 */
double skyfun_(short int* IX, float* A, float* FA, int* M_ptr, int* MMAX_ptr);
#endif
| 21.777778 | 78 | 0.744898 |
f126428c22ffdac794393598c034a4bdb0bd2e6f | 2,435 | h | C | src/iqrf/DPAProtocol.h | jozhalaj/gateway | 49168dcbcf833da690048880bb33542ffbc90ce3 | [
"BSD-3-Clause"
] | 7 | 2018-06-09T05:55:59.000Z | 2021-01-05T05:19:02.000Z | src/iqrf/DPAProtocol.h | jozhalaj/gateway | 49168dcbcf833da690048880bb33542ffbc90ce3 | [
"BSD-3-Clause"
] | 1 | 2019-12-25T10:39:06.000Z | 2020-01-03T08:35:29.000Z | src/iqrf/DPAProtocol.h | jozhalaj/gateway | 49168dcbcf833da690048880bb33542ffbc90ce3 | [
"BSD-3-Clause"
] | 11 | 2018-05-10T08:29:05.000Z | 2020-01-22T20:49:32.000Z | #pragma once
#include <list>
#include <string>
#include <vector>
#include <Poco/SharedPtr.h>
#include "iqrf/DPAMessage.h"
#include "iqrf/DPARequest.h"
#include "model/ModuleType.h"
#include "model/SensorData.h"
namespace BeeeOn {
/**
* @brief The class provides interface for obtaining of measured
* data, for detecting of supported modules that can be specific
* for general or some own protocol.
*/
class DPAProtocol {
public:
typedef Poco::SharedPtr<DPAProtocol> Ptr;
/**
* @brief Vendor and product name for each paired device. It can be
* filled from IQRF repository or statically from code.
*/
struct ProductInfo {
const std::string vendorName;
const std::string productName;
};
virtual ~DPAProtocol();
/**
* @brief DPA request for detecting that specific device communicates
* using the same protocols as implemented protocol.
*
* @returns DPARequest that can be used as a ping message.
*/
virtual DPARequest::Ptr pingRequest(
DPAMessage::NetworkAddress address) const = 0;
/**
* @returns DPA request for detecting of product info about specific
* device (vendor name and product name).
*/
virtual DPARequest::Ptr dpaProductInfoRequest(
DPAMessage::NetworkAddress address) const = 0;
/**
* @brief Obtaining of information from received response on the
* dpaProductInfoRequest().
*
* @returns product information as encoded in the given message
*/
virtual ProductInfo extractProductInfo(
const std::vector<uint8_t> &msg,
uint16_t hwPID) const = 0;
/**
* @returns DPA request to detect available modules on the
* specific device.
*/
virtual DPARequest::Ptr dpaModulesRequest(
DPAMessage::NetworkAddress node) const = 0;
/**
* @returns list of module types encoded in the given message
*/
virtual std::list<ModuleType> extractModules(
const std::vector<uint8_t> &message) const = 0;
/**
* @returns DPA request to obtain measured values from a specific
* IQRF node.
*/
virtual DPARequest::Ptr dpaValueRequest(
DPAMessage::NetworkAddress node,
const std::list<ModuleType> &type) const = 0;
/**
* @brief Obtains measured values from the given byte message.
* The contents of the message must conform with the list of
* module types.
*
* @returns measured values encoded in the given message
*/
virtual SensorData parseValue(
const std::list<ModuleType> &modules,
const std::vector<uint8_t> &msg) const = 0;
};
}
| 25.364583 | 70 | 0.722382 |
6926ee08b8946c31ed3c4013cea739d77f02f012 | 4,979 | h | C | PhotoLibraryServices.framework/PLAssetsSaver.h | reels-research/iOS-Private-Frameworks | 9a4f4534939310a51fdbf5a439dd22487efb0f01 | [
"MIT"
] | 4 | 2021-10-06T12:15:26.000Z | 2022-02-21T02:26:00.000Z | PhotoLibraryServices.framework/PLAssetsSaver.h | reels-research/iOS-Private-Frameworks | 9a4f4534939310a51fdbf5a439dd22487efb0f01 | [
"MIT"
] | null | null | null | PhotoLibraryServices.framework/PLAssetsSaver.h | reels-research/iOS-Private-Frameworks | 9a4f4534939310a51fdbf5a439dd22487efb0f01 | [
"MIT"
] | 1 | 2021-10-08T07:40:53.000Z | 2021-10-08T07:40:53.000Z | /* Generated by RuntimeBrowser
Image: /System/Library/PrivateFrameworks/PhotoLibraryServices.framework/PhotoLibraryServices
*/
@interface PLAssetsSaver : NSObject {
NSMutableArray * __pendingSaveAssetJobs;
}
@property (nonatomic, retain) NSMutableArray *_pendingSaveAssetJobs;
+ (id)publicAssetsLibraryErrorFromPrivateDomain:(id)arg1 withPrivateCode:(long long)arg2;
+ (id)publicAssetsLibraryErrorFromPrivateError:(id)arg1;
+ (id)sharedAssetsSaver;
- (id)_addCameraAssetToLibraryWithPath:(id)arg1 thumbnailImage:(id)arg2 assetUUID:(id)arg3 metadata:(id)arg4 assetType:(short)arg5 kind:(short)arg6 kindSubtype:(short)arg7 avalancheUUID:(id)arg8 completionHandler:(id /* block */)arg9;
- (id /* block */)_createWriteImageCompletionBlockWithImage:(id)arg1 target:(id)arg2 selector:(SEL)arg3 contextInfo:(void*)arg4;
- (id /* block */)_createWriteVideoCompletionBlockWithVideoPath:(id)arg1 target:(id)arg2 selector:(SEL)arg3 contextInfo:(void*)arg4;
- (id)_pendingSaveAssetJobs;
- (void)_requestAccess;
- (void)_saveImage:(id)arg1 imageData:(id)arg2 properties:(id)arg3 completionBlock:(id /* block */)arg4;
- (id)_saveIsolationQueue;
- (void)_saveVideoAtPath:(id)arg1 properties:(id)arg2 completionBlock:(id /* block */)arg3;
- (void)_setIsTakingPhoto:(bool)arg1;
- (void)batchSavePendingAssetJobs;
- (void)dealloc;
- (void)deletePhotoStreamAssetsWithUUIDs:(id)arg1 streamID:(id)arg2;
- (void)deletePhotoStreamDataForStreamID:(id)arg1;
- (void)importFilesWithMasterPath:(id)arg1 sidecarFileInfo:(id)arg2 importSessionIdentifier:(id)arg3 importedBy:(short)arg4 alternateImportImageDate:(id)arg5 isPhotoStreamsPublishCandidate:(bool)arg6 avalancheUUID:(id)arg7 destinationAlbumUUID:(id)arg8 completionHandler:(id /* block */)arg9;
- (void)importFilesWithMasterPath:(id)arg1 sidecarFileInfo:(id)arg2 intoEventWithName:(id)arg3 importSessionIdentifier:(id)arg4 isPhotoStreamsPublishCandidate:(bool)arg5 avalancheUUID:(id)arg6;
- (id)init;
- (id)pathForNewAssetOfType:(short)arg1 extension:(id)arg2;
- (void)queueJobDictionary:(id)arg1 asset:(id)arg2 requestEnqueuedBlock:(id /* block */)arg3 completionBlock:(id /* block */)arg4 imageSurface:(struct __IOSurface { }*)arg5 previewImageSurface:(struct __IOSurface { }*)arg6;
- (void)queueJobDictionary:(id)arg1 completionBlock:(id /* block */)arg2;
- (void)reenqueueAssetUUIDsForPhotoStreamPublication:(id)arg1;
- (void)regenerateVideoThumbnailsForVideo:(id)arg1 withCreationDate:(id)arg2 progressStack:(id)arg3 completionBlock:(id /* block */)arg4;
- (void)requestAsynchronousImageForAssetOID:(id)arg1 withFormat:(int)arg2 allowPlaceholder:(bool)arg3 wantURLOnly:(bool)arg4 networkAccessAllowed:(bool)arg5 trackCPLDownload:(bool)arg6 completionBlock:(id /* block */)arg7;
- (id)requestSynchronousImageForAssetOID:(id)arg1 withFormat:(int)arg2 allowPlaceholder:(bool)arg3 wantURLOnly:(bool)arg4 networkAccessAllowed:(bool)arg5 trackCPLDownload:(bool)arg6 outImageDataInfo:(id*)arg7 outCPLDownloadContext:(id*)arg8;
- (void)saveCameraAvalancheWithUUID:(id)arg1 allAssetUUIDs:(id)arg2 allAssets:(id)arg3 stackAsset:(id)arg4 completionBlock:(id /* block */)arg5;
- (id)saveCameraImage:(id)arg1 metadata:(id)arg2 additionalProperties:(id)arg3 diagnostics:(id)arg4 previouslyPendingAsset:(id)arg5 requestEnqueuedBlock:(id /* block */)arg6;
- (void)saveCameraImage:(id)arg1 metadata:(id)arg2 additionalProperties:(id)arg3 requestEnqueuedBlock:(id /* block */)arg4;
- (void)saveCameraVideoAtPath:(id)arg1 withMetadata:(id)arg2 thumbnailImage:(id)arg3 createPreviewWellImage:(bool)arg4 progressStack:(id)arg5 isSlalom:(bool)arg6 assetAdjustments:(id)arg7 videoHandler:(id /* block */)arg8 requestEnqueuedBlock:(id /* block */)arg9 completionBlock:(id /* block */)arg10;
- (void)saveImage:(id)arg1 imageData:(id)arg2 properties:(id)arg3 completionTarget:(id)arg4 completionSelector:(SEL)arg5 contextInfo:(void*)arg6;
- (void)saveImage:(id)arg1 properties:(id)arg2 completionBlock:(id /* block */)arg3;
- (void)saveImageData:(id)arg1 properties:(id)arg2 completionBlock:(id /* block */)arg3;
- (void)saveImageRef:(struct CGImage { }*)arg1 orientation:(long long)arg2 imageData:(id)arg3 properties:(id)arg4 completionBlock:(id /* block */)arg5;
- (void)saveOneWayATCSyncedImage:(id)arg1 imageData:(id)arg2 eventUUID:(id)arg3 properties:(id)arg4 completionBlock:(id /* block */)arg5;
- (void)savePhotoStreamImage:(id)arg1 imageData:(id)arg2 properties:(id)arg3 completionBlock:(id /* block */)arg4;
- (void)savePhotoStreamVideoAtPath:(id)arg1 properties:(id)arg2 completionBlock:(id /* block */)arg3;
- (void)saveSyncedAssets:(id)arg1 completionBlock:(id /* block */)arg2;
- (void)saveVideoAtPath:(id)arg1 properties:(id)arg2 completionBlock:(id /* block */)arg3;
- (void)saveVideoAtPath:(id)arg1 properties:(id)arg2 completionTarget:(id)arg3 completionSelector:(SEL)arg4 contextInfo:(void*)arg5;
- (void)setAvalancheInProgress:(bool)arg1 uuid:(id)arg2;
- (void)set_pendingSaveAssetJobs:(id)arg1;
- (id)validateAvalanches:(id)arg1;
@end
| 87.350877 | 302 | 0.787508 |
61f8b1590b0f73c48d8de2b6dd827efe794bdb2c | 5,609 | h | C | blinky/common/services/sensors/drivers/bosch/bma_axis.inc.h | femtoio/femtousb-blink-example | 5e166bdee500f67142d0ee83a1a169bab57fe142 | [
"MIT"
] | null | null | null | blinky/common/services/sensors/drivers/bosch/bma_axis.inc.h | femtoio/femtousb-blink-example | 5e166bdee500f67142d0ee83a1a169bab57fe142 | [
"MIT"
] | null | null | null | blinky/common/services/sensors/drivers/bosch/bma_axis.inc.h | femtoio/femtousb-blink-example | 5e166bdee500f67142d0ee83a1a169bab57fe142 | [
"MIT"
] | null | null | null | /**
* \file
*
* \brief Bosch Digital, triaxial acceleration sensor axis format
*
* This module defines accelerometer axis data types and utility routines
* used in multiple Bosch sensor drivers, including BMA020, BMA150, BMA180,
* BMA220, BMA222, and BMA250 devices.
*
* The module relies upon conditionally compiled types and functions to
* generate functions specialized for a particular driver module. Driver
* source modules include this module directly via the C-preprocessor
* with a #include directive.
*
* Copyright (c) 2014 Atmel Corporation. All rights reserved.
*
* \asf_license_start
*
* \page License
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* 3. The name of Atmel may not be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* 4. This software may only be redistributed and used in connection with an
* Atmel microcontroller product.
*
* THIS SOFTWARE IS PROVIDED BY ATMEL "AS IS" AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE
* EXPRESSLY AND SPECIFICALLY DISCLAIMED. IN NO EVENT SHALL ATMEL 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.
*
* \asf_license_stop
*
*/
/**
* Support and FAQ: visit <a href="http://www.atmel.com/design-support/">Atmel Support</a>
*/
#ifndef _BMA_AXIS_H_
#define _BMA_AXIS_H_
#include <asf.h>
#ifdef __cplusplus
extern "C" {
#endif
/**
* @name Bosch Accelerometer Driver Axis Types
* @{
*/
/**
* @brief Bosch 8-bit Axis Data Format
*
* The BMA222 stores 2's-complement 8-bit axis data samples split across
* two contiguous 8-bit device locations where the lower address in the
* device register space stores a 1-bit "new data" flag and the next
* higher address stores the 8 most significant bits of the axis data.
*/
typedef union {
int16_t word;
struct {
uint16_t unused : 7;
uint16_t new_data : 1;
int16_t acc_msb : 8;
} field;
} bma_axis8_t;
/**
* @brief Bosch 10-bit Axis Data Format
*
* The BMA020, BMA150, and BMA250 store 2's-complement 10-bit axis data
* samples split across two contiguous 8-bit device locations where the
* lower address in the device register space stores a 1-bit "new data"
* flag and the next higher locations store the 10 most significant bits
* of the axis data.
*/
typedef union {
int16_t word;
struct {
uint16_t acc_lsb : 2;
uint16_t unused : 5;
uint16_t new_data : 1;
int16_t acc_msb : 8;
} field;
} bma_axis10_t;
/**
* @brief Bosch 14-bit Axis Data Format
*
* The BMA180 stores 2's-complement 14-bit axis data samples split across
* two contiguous 8-bit device locations where the lower address in the
* device register space stores the 6 least significant bits and the next
* higher address stores the 8 most significant bits of the axis data.
*/
typedef union {
int16_t word;
struct {
uint16_t acc_lsb : 6;
uint16_t unused : 1;
uint16_t new_data : 1;
int16_t acc_msb : 8;
} field;
} bma_axis14_t;
/** @} */
/**
* @name Bosch Accelerometer Driver Axis Value (type conversion)
* @{
*/
/**
* @brief Construct a signed value from a raw axis sample.
*
* The BMA222 returns little-endian 2's-complement 8-bit axis values
* stored within a 16-bit word.
*
* @param axis An bma_axis8_t type storing a raw sensor axis sample.
* @return The aligned and sign-extended axis data value.
*/
static inline int16_t bma_axis8_val(const bma_axis8_t axis)
{
#if UC3
return axis.field.acc_msb;
#elif XMEGA
return (axis.word >> 8);
#endif
}
/**
* @brief Construct a signed value from a raw axis sample.
*
* The BMA020, BMA150, and BMA250 return little-endian 2's-complement
* 10-bit axis values stored within a 16-bit word.
*
* @param axis An bma_axis10_t type storing a raw sensor axis sample.
* @return The aligned and sign-extended axis data value.
*/
static inline int16_t bma_axis10_val(const bma_axis10_t axis)
{
#if UC3
return (axis.field.acc_msb << 2) | (axis.field.acc_lsb);
#elif XMEGA
return (axis.word >> 6);
#endif
}
/**
* @brief Construct a signed value from a raw axis sample.
*
* The BMA180 returns little-endian 2's-complement 14-bit axis values
* stored within a 16-bit word.
*
* @param axis An bma_axis14_t type storing a raw sensor axis sample.
* @return The aligned and sign-extended axis data value.
*/
static inline int16_t bma_axis14_val(const bma_axis14_t axis)
{
#if UC3
return (axis.field.acc_msb << 6) | (axis.field.acc_lsb);
#elif XMEGA
return (axis.word >> 2);
#endif
}
/** @} */
#ifdef __cplusplus
}
#endif
#endif
| 28.912371 | 90 | 0.722767 |
50c844c1e6da30552c7057fd138ba456e34cd8a8 | 619 | h | C | epitome-core/src/EPITOME-CORE/init.h | smo-key/Epitome3D | b4296bf6bbf6c86823168181009c88cc99ae3816 | [
"MIT"
] | 3 | 2015-02-27T13:50:17.000Z | 2015-06-21T20:30:26.000Z | epitome-core/src/EPITOME-CORE/init.h | epitome3d/Epitome3D | b4296bf6bbf6c86823168181009c88cc99ae3816 | [
"MIT"
] | 13 | 2015-06-22T15:54:35.000Z | 2015-06-22T15:54:35.000Z | epitome-core/src/EPITOME-CORE/init.h | epitome3d/Epitome3D | b4296bf6bbf6c86823168181009c88cc99ae3816 | [
"MIT"
] | null | null | null | #pragma once
#include <GL/glew.h>
#include <GL/glut.h>
#include <GLFW/glfw3.h>
#include "system.h"
#include "keyboard.h"
#include "error.h"
namespace EPITOME
{
//Initializes Epitome3D components.
void Initialize();
//Updates the values of all Epitome3D components.
//This function is to be called at the end of every event loop (frame).
void Update();
//Destroys all Epitome3D components and exits with error code SUCCESS.
void Exit();
//Destroys all Epitome3D components and exits with a custom Error instance.
//Will attempt to send Error to the error function and logger.
void Exit(Error errorcode);
} | 24.76 | 76 | 0.743134 |
1324275c26d28520e07142211b6806e4931a11fc | 1,318 | h | C | tools/cpp/src/qt/qt_sensors/zedtab.h | mindThomas/JetsonCar | 74636d4da1f7f71ca9f2315a1b2347393b081eda | [
"MIT"
] | 4 | 2020-11-09T08:52:37.000Z | 2021-07-06T15:18:36.000Z | tools/cpp/src/qt/qt_sensors/zedtab.h | mindThomas/JetsonCar | 74636d4da1f7f71ca9f2315a1b2347393b081eda | [
"MIT"
] | null | null | null | tools/cpp/src/qt/qt_sensors/zedtab.h | mindThomas/JetsonCar | 74636d4da1f7f71ca9f2315a1b2347393b081eda | [
"MIT"
] | 1 | 2021-07-06T15:18:41.000Z | 2021-07-06T15:18:41.000Z | #ifndef ZEDTAB_H
#define ZEDTAB_H
#ifdef WITH_ZED_CAMERA
#include <QWidget>
#include <QSettings>
#include <QDesktopWidget>
#include <QFileDialog>
#include <QMessageBox>
#include <QComboBox>
#include <thread>
#include <Eigen/Core>
#include <Eigen/Geometry>
#include <math.h>
#include <float.h>
#include <iostream>
#include "cvimage.h"
#include "zed/zed.h"
#define deg2rad(angleDegrees) ((angleDegrees) * M_PI / 180.0)
#define rad2deg(angleRadians) ((angleRadians) * 180.0 / M_PI)
namespace Ui {
class ZedTab;
}
class ZedTab : public QWidget
{
Q_OBJECT
public:
explicit ZedTab(ZED * zed_, QWidget *parent = nullptr);
~ZedTab();
private slots:
void on_getOrientationBtn_clicked();
private slots:
void on_getViewBtn_clicked();
void on_resetOriginBtn_clicked();
void on_resetViewBtn_clicked();
private:
void ResetView();
void PoseUpdate(ZED::Pose pose);
void ImageUpdate(uint8_t side, cv::Mat image);
void SaveImage(bool side);
Eigen::Vector3f GetEulerAnglesZYX(Eigen::Matrix<float, 3, 3> rotm);
Eigen::Vector3f GetEulerAnglesZYX(Eigen::Matrix<float, 4, 4> transform);
private:
Ui::ZedTab *ui;
QComboBox * rectificationSetting;
cvImage leftImage;
cvImage rightImage;
ZED * zed;
};
#endif // ZED enabled
#endif // ZEDTAB_H
| 18.305556 | 76 | 0.703338 |
d36db88d5d7633c23109e63b349b25165ad5f7a2 | 1,309 | c | C | deploy/gethostbyname.c | DD-L/g.D-L.top | 85de26e165fc89bd477eaee06dbe131de7bc5755 | [
"MIT"
] | 1 | 2015-09-20T16:58:55.000Z | 2015-09-20T16:58:55.000Z | deploy/gethostbyname.c | DD-L/g.D-L.top | 85de26e165fc89bd477eaee06dbe131de7bc5755 | [
"MIT"
] | 1 | 2015-09-22T16:41:30.000Z | 2015-09-23T03:48:51.000Z | deploy/gethostbyname.c | DD-L/g.D-L.top | 85de26e165fc89bd477eaee06dbe131de7bc5755 | [
"MIT"
] | null | null | null | /*************************************************************************
> File Name: gethostbyname.c
> Author: D_L
> Mail: deel@d-l.top
> Created Time: 2015/9/18 8:24:54
> usage: ./gethostbyname $hostname
> eg. ./gethostbyname www.google.com
************************************************************************/
#include <netdb.h>
#include <sys/socket.h>
#include <stdio.h>
int main(int argc, char **argv) {
char *ptr, **pptr;
struct hostent *hptr;
char str[32];
ptr = argv[1];
if((hptr = gethostbyname(ptr)) == NULL) {
printf(" gethostbyname error for host:%s\n", ptr);
return 0;
}
printf("official hostname:%s\n", hptr->h_name);
for(pptr = hptr->h_aliases; *pptr != NULL; pptr++)
printf(" alias:%s\n",*pptr);
switch(hptr->h_addrtype) {
case AF_INET:
case AF_INET6:
pptr=hptr->h_addr_list;
for(; *pptr!=NULL; pptr++)
printf(" address:%s\n",
inet_ntop(hptr->h_addrtype,
*pptr, str, sizeof(str)));
printf(" first address: %s\n",
inet_ntop(hptr->h_addrtype,
hptr->h_addr, str, sizeof(str)));
break;
default:
printf("unknown address type\n");
break;
}
return 0;
}
| 26.18 | 74 | 0.478992 |
59ed72de2455f3f37fb5f41a07fb2cf3cc48c5d0 | 320 | c | C | engine/main.c | askhabchic/own_shell | d4e2dc4e11cb54ec2d65ed65bc9a0eaf2203436e | [
"MIT"
] | null | null | null | engine/main.c | askhabchic/own_shell | d4e2dc4e11cb54ec2d65ed65bc9a0eaf2203436e | [
"MIT"
] | null | null | null | engine/main.c | askhabchic/own_shell | d4e2dc4e11cb54ec2d65ed65bc9a0eaf2203436e | [
"MIT"
] | null | null | null | #include "../headers/engine.h"
#include<stdio.h>
#include<stdlib.h>
#include<unistd.h>
#include<readline/readline.h>
#include<readline/history.h>
int main(int argc, const char **argv)
{
char *line;
while ((line = readline("bash: ")))
{
if (line && *line)
add_history(line);
}
argc++;
argv++;
return (0);
}
| 15.238095 | 37 | 0.640625 |
e395bae53b4bea748ff5b73c8a241775567732cb | 376 | h | C | logic/src/dialogue.h | edvinhansson/openmv | 3390942cf76aa8b36eed1ac49a48ca618e6275c4 | [
"MIT"
] | 44 | 2021-11-20T08:53:12.000Z | 2022-03-16T11:45:49.000Z | logic/src/dialogue.h | edvinhansson/openmv | 3390942cf76aa8b36eed1ac49a48ca618e6275c4 | [
"MIT"
] | null | null | null | logic/src/dialogue.h | edvinhansson/openmv | 3390942cf76aa8b36eed1ac49a48ca618e6275c4 | [
"MIT"
] | 7 | 2021-11-06T08:23:57.000Z | 2022-03-16T11:44:50.000Z | #pragma once
#include "common.h"
#include "table.h"
#include "video.h"
typedef void (*on_dialogue_next_func)();
typedef void (*on_dialogue_play_func)(void* ctx);
struct dialogue {
struct rect rect;
on_dialogue_next_func on_next;
on_dialogue_play_func on_play;
bool want_next;
};
void init_dialogue();
void deinit_dialogue();
void* get_dialogue_fun(const char* name);
| 17.904762 | 49 | 0.763298 |
2d323c7a5f9a9f919f90a279fa2dcbb470fa0c3f | 279 | h | C | Homework/GraphingCalculator/GraphingCalculator/include/Utility.h | benjaminmao123/PCC_CS003A | 0339d83ebab7536952644517a99dc46702035b2b | [
"MIT"
] | null | null | null | Homework/GraphingCalculator/GraphingCalculator/include/Utility.h | benjaminmao123/PCC_CS003A | 0339d83ebab7536952644517a99dc46702035b2b | [
"MIT"
] | null | null | null | Homework/GraphingCalculator/GraphingCalculator/include/Utility.h | benjaminmao123/PCC_CS003A | 0339d83ebab7536952644517a99dc46702035b2b | [
"MIT"
] | null | null | null | #pragma once
#include <string>
#include <SFML\Graphics.hpp>
#include "Vector.h"
namespace Utility
{
int RandomNumber(int start, int end);
void ClearConsole();
std::string mouse_pos_string(sf::RenderWindow &window);
Vector<std::string> Tokenize(const std::string &input);
} | 19.928571 | 56 | 0.741935 |
492c834c4363c2ec09c9781f65601bbb1b0be536 | 16,422 | c | C | move-slp/src/e_mod_move_indicator_controller.c | tizenorg/framework.uifw.e17-extra-modules | 9632650b16a377f80d107aaa9c7f06677799da32 | [
"BSD-2-Clause"
] | null | null | null | move-slp/src/e_mod_move_indicator_controller.c | tizenorg/framework.uifw.e17-extra-modules | 9632650b16a377f80d107aaa9c7f06677799da32 | [
"BSD-2-Clause"
] | null | null | null | move-slp/src/e_mod_move_indicator_controller.c | tizenorg/framework.uifw.e17-extra-modules | 9632650b16a377f80d107aaa9c7f06677799da32 | [
"BSD-2-Clause"
] | null | null | null | #include "e_mod_move_shared_types.h"
#include "e_mod_move_debug.h"
#include "e_mod_move.h"
/* local subsystem functions */
static Eina_Bool _e_mod_move_indi_ctl_event_clear(E_Move_Indicator_Controller *mic);
static Eina_Bool _e_mod_move_indi_ctl_cb_motion_start(void *data, void *event_info);
static Eina_Bool _e_mod_move_indi_ctl_cb_motion_move(void *data, void *event_info);
static Eina_Bool _e_mod_move_indi_ctl_cb_motion_end(void *data, void *event_info);
static void _e_mod_move_indi_ctl_obj_event_setup(E_Move_Indicator_Controller *mic, E_Move_Evas_Object *meo);
/* local subsystem functions */
static Eina_Bool
_e_mod_move_indi_ctl_event_clear(E_Move_Indicator_Controller *mic)
{
Eina_Bool click = EINA_FALSE;
E_Move_Evas_Object *meo = NULL;
Eina_List *l;
E_CHECK_RETURN(mic, EINA_FALSE);
EINA_LIST_FOREACH(mic->objs, l, meo)
{
if (!meo) continue;
click = e_mod_move_event_click_get(meo->event);
}
E_CHECK_RETURN(click, EINA_FALSE);
EINA_LIST_FOREACH(mic->objs, l, meo)
{
if (!meo) continue;
e_mod_move_event_data_clear(meo->event);
e_mod_move_event_click_set(meo->event, EINA_FALSE);
}
return EINA_TRUE;
}
static Eina_Bool
_e_mod_move_indi_ctl_cb_motion_start(void *data,
void *event_info)
{
E_Move *m = NULL;
E_Move_Border *indi_mb = NULL;
E_Move_Border *target_mb = NULL;
E_Move_Indicator_Controller *mic = (E_Move_Indicator_Controller *)data;
E_Move_Event_Motion_Info *info;
E_Move_Evas_Object *meo = NULL;
Eina_List *l;
info = (E_Move_Event_Motion_Info *)event_info;
m = e_mod_move_util_get();
if (!mic || !info || !m) return EINA_FALSE;
L(LT_EVENT_OBJ,
"[MOVE] ev:%15.15s (%d,%d) %s()\n", "EVAS_OBJ",
info->coord.x, info->coord.y, __func__);
// check indicator and if indicator does not exist, then destroy data, and hide
target_mb = e_mod_move_border_client_find(mic->target_win);
if (!target_mb)
{
// event clear
_e_mod_move_indi_ctl_event_clear(mic);
e_mod_move_evas_objs_del(mic->objs);
memset(mic, 0, sizeof(E_Move_Indicator_Controller));
E_FREE(mic);
m->indicator_controller = NULL;
return EINA_FALSE;
}
indi_mb = e_mod_move_indicator_find();
if (!indi_mb)
{
//e_mod_move_indicator_controller_unset(m);
return EINA_FALSE;
}
// position check & and if position is not at indicator then destroy data, and hide
if (!E_INSIDE(info->coord.x, info->coord.y,
indi_mb->x, indi_mb->y, indi_mb->w, indi_mb->h))
{
//e_mod_move_indicator_controller_unset(m);
if (indi_mb->visible)
{
e_border_hide(indi_mb->bd,2);
e_mod_move_evas_objs_move(mic->objs, indi_mb->x, indi_mb->y);
e_mod_move_evas_objs_resize(mic->objs, indi_mb->w, indi_mb->h);
e_mod_move_border_shape_input_rect_set(target_mb,
indi_mb->x,
indi_mb->y,
indi_mb->w,
indi_mb->h);
}
return EINA_FALSE;
}
EINA_LIST_FOREACH(mic->objs, l, meo)
{
if (!meo) continue;
e_mod_move_event_click_set(meo->event, EINA_TRUE);
}
return EINA_TRUE;
}
static Eina_Bool
_e_mod_move_indi_ctl_cb_motion_move(void *data,
void *event_info)
{
E_Move *m = NULL;
E_Move_Indicator_Controller *mic = (E_Move_Indicator_Controller *)data;
E_Move_Event_Motion_Info *info;
E_Move_Evas_Object *meo = NULL;
E_Move_Border *indi_mb = NULL;
E_Move_Border *target_mb = NULL;
Eina_List *l;
Eina_Bool click = EINA_FALSE;
int angle = 0;
int d0, d1;
E_Zone *zone = NULL;
info = (E_Move_Event_Motion_Info *)event_info;
m = e_mod_move_util_get();
if (!mic || !info || !m) return EINA_FALSE;
L(LT_EVENT_OBJ,
"[MOVE] ev:%15.15s (%d,%d) %s()\n", "EVAS_OBJ",
info->coord.x, info->coord.y, __func__);
EINA_LIST_FOREACH(mic->objs, l, meo)
{
if (!meo) continue;
click = e_mod_move_event_click_get(meo->event);
}
E_CHECK_RETURN(click, EINA_FALSE);
// check indicator and if indicator does not exist, then destroy data, and hide
target_mb = e_mod_move_border_client_find(mic->target_win);
if (!target_mb)
{
// event clear
_e_mod_move_indi_ctl_event_clear(mic);
e_mod_move_evas_objs_del(mic->objs);
memset(mic, 0, sizeof(E_Move_Indicator_Controller));
E_FREE(mic);
m->indicator_controller = NULL;
return EINA_FALSE;
}
indi_mb = e_mod_move_indicator_find();
if (!indi_mb)
{
return EINA_FALSE;
}
EINA_LIST_FOREACH(mic->objs, l, meo)
{
if (!meo) continue;
angle = e_mod_move_event_angle_get(meo->event);
}
zone = indi_mb->bd->zone;
d0 = d1 = 0;
switch (angle)
{
case 90:
d0 = info->coord.x;
d1 = indi_mb->w*2;
break;
case 180:
d0 = zone->h - (indi_mb->h*2);
d1 = info->coord.y;
break;
case 270:
d0 = zone->w - (indi_mb->w*2);
d1 = info->coord.x;
break;
case 0:
default :
d0 = info->coord.y;
d1 = indi_mb->h*2;
break;
}
if (d0 > d1)
{
e_border_show(indi_mb->bd);
e_mod_move_evas_objs_move(mic->objs, target_mb->x, target_mb->y);
e_mod_move_evas_objs_resize(mic->objs, target_mb->w, target_mb->h);
e_mod_move_border_shape_input_rect_set(target_mb,
0,
0,
target_mb->w,
target_mb->h);
}
return EINA_TRUE;
}
static Eina_Bool
_e_mod_move_indi_ctl_cb_motion_end(void *data,
void *event_info)
{
E_Move *m = NULL;
E_Move_Indicator_Controller *mic = (E_Move_Indicator_Controller *)data;
E_Move_Event_Motion_Info *info;
E_Move_Evas_Object *meo = NULL;
E_Move_Border *indi_mb = NULL;
E_Move_Border *target_mb = NULL;
Eina_List *l;
Eina_Bool click = EINA_FALSE;
int angle = 0;
int d0, d1;
E_Zone *zone = NULL;
Eina_Bool ret = EINA_FALSE;
info = (E_Move_Event_Motion_Info *)event_info;
m = e_mod_move_util_get();
if (!mic || !info || !m) return EINA_FALSE;
L(LT_EVENT_OBJ,
"[MOVE] ev:%15.15s (%d,%d) %s()\n", "EVAS_OBJ",
info->coord.x, info->coord.y, __func__);
EINA_LIST_FOREACH(mic->objs, l, meo)
{
if (!meo) continue;
click = e_mod_move_event_click_get(meo->event);
}
E_CHECK_RETURN(click, EINA_FALSE);
// check indicator and if indicator does not exist, then destroy data, and hide
target_mb = e_mod_move_border_client_find(mic->target_win);
if (!target_mb)
{
// event clear
_e_mod_move_indi_ctl_event_clear(mic);
e_mod_move_evas_objs_del(mic->objs);
memset(mic, 0, sizeof(E_Move_Indicator_Controller));
E_FREE(mic);
m->indicator_controller = NULL;
return EINA_FALSE;
}
indi_mb = e_mod_move_indicator_find();
E_CHECK_GOTO(indi_mb, finish);
EINA_LIST_FOREACH(mic->objs, l, meo)
{
if (!meo) continue;
angle = e_mod_move_event_angle_get(meo->event);
}
zone = indi_mb->bd->zone;
d0 = d1 = 0;
switch (angle)
{
case 90:
d0 = info->coord.x;
d1 = indi_mb->w*2;
break;
case 180:
d0 = zone->h - (indi_mb->h*2);
d1 = info->coord.y;
break;
case 270:
d0 = zone->w - (indi_mb->w*2);
d1 = info->coord.x;
break;
case 0:
default :
d0 = info->coord.y;
d1 = indi_mb->h*2;
break;
}
if (d0 > d1)
{
if (!indi_mb->visible)
{
e_border_show(indi_mb->bd);
e_mod_move_evas_objs_move(mic->objs, target_mb->x, target_mb->y);
e_mod_move_evas_objs_resize(mic->objs, target_mb->w, target_mb->h);
e_mod_move_border_shape_input_rect_set(target_mb,
0,
0,
target_mb->w,
target_mb->h);
ret = EINA_TRUE;
}
}
else
{
if (indi_mb->visible)
{
e_border_hide(indi_mb->bd,2);
//e_mod_move_indicator_controller_unset(m);
e_mod_move_evas_objs_move(mic->objs, indi_mb->x, indi_mb->y);
e_mod_move_evas_objs_resize(mic->objs, indi_mb->w, indi_mb->h);
e_mod_move_border_shape_input_rect_set(target_mb,
indi_mb->x,
indi_mb->y,
indi_mb->w,
indi_mb->h);
}
}
finish:
EINA_LIST_FOREACH(mic->objs, l, meo)
{
if (!meo) continue;
e_mod_move_event_click_set(meo->event, EINA_FALSE);
}
return ret;
}
static void
_e_mod_move_indi_ctl_obj_event_setup(E_Move_Indicator_Controller *mic,
E_Move_Evas_Object *meo)
{
E_CHECK(mic);
E_CHECK(meo);
meo->event = e_mod_move_event_new(mic->target_win, meo->obj);
E_CHECK(meo->event);
e_mod_move_event_angle_cb_set(meo->event,
e_mod_move_util_win_prop_angle_get);
e_mod_move_event_cb_set(meo->event, E_MOVE_EVENT_TYPE_MOTION_START,
_e_mod_move_indi_ctl_cb_motion_start, mic);
e_mod_move_event_cb_set(meo->event, E_MOVE_EVENT_TYPE_MOTION_MOVE,
_e_mod_move_indi_ctl_cb_motion_move, mic);
e_mod_move_event_cb_set(meo->event, E_MOVE_EVENT_TYPE_MOTION_END,
_e_mod_move_indi_ctl_cb_motion_end, mic);
e_mod_move_event_send_all_set(meo->event, EINA_TRUE);
}
/* externally accessible functions */
EINTERN Eina_Bool
e_mod_move_indicator_controller_set(E_Move_Border *target_mb)
{
E_Move *m = NULL;
E_Move_Border *indi_mb = NULL;
Ecore_X_Window win;
E_Move_Indicator_Controller *mic = NULL;
E_Move_Evas_Object *meo = NULL;
Eina_List *l;
E_CHECK_RETURN(target_mb, EINA_FALSE);
indi_mb = e_mod_move_indicator_find();
E_CHECK_RETURN(indi_mb, EINA_FALSE);
m = e_mod_move_util_get();
E_CHECK_RETURN(m, EINA_FALSE);
if (e_mod_move_indicator_controller_state_get(m, &win))
e_mod_move_indicator_controller_unset(m);
mic = E_NEW(E_Move_Indicator_Controller, 1);
E_CHECK_RETURN(mic, EINA_FALSE);
mic->target_win = target_mb->bd->client.win;
mic->objs = e_mod_move_evas_objs_add(m);
if (mic->objs)
{
e_mod_move_evas_objs_move(mic->objs, indi_mb->x, indi_mb->y);
e_mod_move_evas_objs_resize(mic->objs, indi_mb->w, indi_mb->h);
e_mod_move_evas_objs_layer_set(mic->objs, EVAS_LAYER_MAX - 1);
e_mod_move_evas_objs_color_set(mic->objs, 0, 0, 0, 0);
e_mod_move_evas_objs_show(mic->objs);
e_mod_move_evas_objs_raise(mic->objs);
// Set Input Shape Mask
if (e_mod_move_border_shape_input_new(target_mb))
{
e_mod_move_border_shape_input_rect_set(target_mb,
indi_mb->x,
indi_mb->y,
indi_mb->w,
indi_mb->h);
}
// Set Event Handler
EINA_LIST_FOREACH(mic->objs, l, meo)
{
if (!meo) continue;
_e_mod_move_indi_ctl_obj_event_setup(mic, meo);
}
m->indicator_controller = mic;
}
else
{
memset(mic, 0, sizeof(E_Move_Indicator_Controller));
E_FREE(mic);
return EINA_FALSE;
}
return EINA_TRUE;
}
EINTERN Eina_Bool
e_mod_move_indicator_controller_unset(E_Move *m)
{
Ecore_X_Window win;
E_Move_Indicator_Controller *mic = NULL;
E_Move_Border *target_mb = NULL;
E_CHECK_RETURN(m, EINA_FALSE);
E_CHECK_RETURN(e_mod_move_indicator_controller_state_get(m, &win),
EINA_FALSE);
mic = m->indicator_controller;
E_CHECK_RETURN(mic, EINA_FALSE);
_e_mod_move_indi_ctl_event_clear(mic);
e_mod_move_evas_objs_del(mic->objs);
// input shape mask clear
if ((target_mb = e_mod_move_border_client_find(mic->target_win)))
{
if (target_mb->shape_input)
{
e_mod_move_border_shape_input_rect_set(target_mb, 0, 0, 0, 0);
e_mod_move_border_shape_input_free(target_mb);
}
}
memset(mic, 0, sizeof(E_Move_Indicator_Controller));
E_FREE(mic);
m->indicator_controller = NULL;
return EINA_TRUE;
}
EINTERN Eina_Bool
e_mod_move_indicator_controller_update(E_Move *m)
{
Ecore_X_Window win;
E_Move_Indicator_Controller *mic = NULL;
E_Move_Border *indi_mb = NULL;
E_Move_Border *target_mb = NULL;
E_CHECK_RETURN(m, EINA_FALSE);
E_CHECK_RETURN(e_mod_move_indicator_controller_state_get(m, &win),
EINA_FALSE);
mic = m->indicator_controller;
E_CHECK_RETURN(mic, EINA_FALSE);
indi_mb = e_mod_move_indicator_find();
E_CHECK_RETURN(indi_mb, EINA_FALSE);
if (indi_mb->visible) return EINA_FALSE;
e_mod_move_evas_objs_move(mic->objs, indi_mb->x, indi_mb->y);
e_mod_move_evas_objs_resize(mic->objs, indi_mb->w, indi_mb->h);
if ((target_mb = e_mod_move_border_client_find(mic->target_win)))
{
e_mod_move_border_shape_input_rect_set(target_mb,
indi_mb->x,
indi_mb->y,
indi_mb->w,
indi_mb->h);
}
else
{
L(LT_EVENT_OBJ,
"[MOVE] ev:%15.15s w:0x%08x %s %s()\n", "EVAS_OBJ",
mic->target_win,
"Indicator Controller Target Window doest not exist!!!!!",
__func__);
return EINA_FALSE;
}
return EINA_TRUE;
}
EINTERN Eina_Bool
e_mod_move_indicator_controller_state_get(E_Move *m,
Ecore_X_Window *win)
{
E_Move_Indicator_Controller *mic = NULL;
E_CHECK_RETURN(m, EINA_FALSE);
E_CHECK_RETURN(win, EINA_FALSE);
mic = m->indicator_controller;
E_CHECK_RETURN(mic, EINA_FALSE);
*win = mic->target_win;
return EINA_TRUE;
}
EINTERN Eina_Bool
e_mod_move_indicator_controller_set_policy_check(E_Move_Border *target_mb)
{
E_Move_Border *indi_mb = NULL;
E_Zone *zone = NULL;
E_CHECK_RETURN(target_mb, EINA_FALSE);
if (TYPE_QUICKPANEL_CHECK(target_mb)) return EINA_FALSE;
if (TYPE_APPTRAY_CHECK(target_mb)) return EINA_FALSE;
if (TYPE_INDICATOR_CHECK(target_mb)) return EINA_FALSE;
if (target_mb->visibility != E_MOVE_VISIBILITY_STATE_VISIBLE)
return EINA_FALSE;
indi_mb = e_mod_move_indicator_find();
E_CHECK_RETURN(indi_mb, EINA_FALSE);
//if (indi_mb->visible)
if (target_mb->indicator_state != E_MOVE_INDICATOR_STATE_OFF)
return EINA_FALSE;
zone = indi_mb->bd->zone;
if (target_mb->bd->zone != zone)
return EINA_FALSE;
if ( (zone->x != target_mb->x)
|| (zone->y != target_mb->y)
|| (zone->w != target_mb->w)
|| (zone->h != target_mb->h))
return EINA_FALSE;
return EINA_TRUE;
}
EINTERN Eina_Bool
e_mod_move_indicator_controller_unset_policy_check(E_Move_Border *target_mb)
{
E_Move *m = NULL;
Ecore_X_Window win;
Eina_Bool ret = EINA_FALSE;
E_CHECK_RETURN(target_mb, EINA_FALSE);
m = e_mod_move_util_get();
E_CHECK_RETURN(m, EINA_FALSE);
if (e_mod_move_indicator_controller_state_get(m, &win))
{
if (win == target_mb->bd->client.win)
ret = EINA_TRUE;
}
return ret;
}
| 30.1875 | 113 | 0.596882 |
0b65885b3a4b20e50e2e17fe9320d982cb942300 | 912 | c | C | src/lib/ansi/tmpnam.c | macminix/MacMinix | 12262051184fb2fe10ad0a2156546454e38a3e57 | [
"BSD-3-Clause"
] | 30 | 2015-02-17T23:26:16.000Z | 2022-02-22T19:40:04.000Z | src/lib/ansi/tmpnam.c | macminix/MacMinix | 12262051184fb2fe10ad0a2156546454e38a3e57 | [
"BSD-3-Clause"
] | null | null | null | src/lib/ansi/tmpnam.c | macminix/MacMinix | 12262051184fb2fe10ad0a2156546454e38a3e57 | [
"BSD-3-Clause"
] | 7 | 2016-07-02T20:33:49.000Z | 2022-02-23T14:03:58.000Z | /* author: Monty Walls written: 4/17/89
* Copyright: Copyright (c) 1989 by Monty Walls.
* Not derived from licensed software.
*
* Permission to copy and/or distribute granted under the
* following conditions:
*
* 1). This notice must remain intact.
* 2). The author is not responsible for the consequences of use
* this software, no matter how awful, even if they
* arise from defects in it.
* 3). Altered version must not be represented as being the
* original software.
*/
#include <lib.h>
#include <unistd.h>
#include <string.h>
#include <stdio.h>
#ifndef P_tmpdir
#define P_tmpdir "/tmp"
#define L_tmpnam 14
#endif
extern char *mktemp( /* template */ );
char *tmpnam(buf)
char *buf;
{
PRIVATE char our_buf[2 * L_tmpnam];
register char *dest;
dest = (buf == (char *) NULL ? our_buf : buf);
strcpy(dest, P_tmpdir);
strcat(dest, "/tmp.XXXXXX");
return(mktemp(dest));
}
| 24 | 65 | 0.682018 |
3ce05394cf1d2f8ed72141e5a6a03c5b0e8272c7 | 1,300 | h | C | xinu/include/testsuite.h | rrjha/dosp | 21f3624abfec815434007f76504488896a091f6d | [
"BSD-3-Clause"
] | 2 | 2022-02-04T15:49:22.000Z | 2022-02-05T13:38:43.000Z | xinu/include/testsuite.h | rrjha/dosp | 21f3624abfec815434007f76504488896a091f6d | [
"BSD-3-Clause"
] | 1 | 2017-06-14T23:36:20.000Z | 2017-06-14T23:36:29.000Z | xinu/include/testsuite.h | rrjha/dosp | 21f3624abfec815434007f76504488896a091f6d | [
"BSD-3-Clause"
] | null | null | null | /* testsuite.h - failif */
process test_addargs(bool8);
process test_bigargs(bool8);
process test_schedule(bool8 verbose);
process test_preempt(bool8 verbose);
process test_recursion(bool8 verbose);
process test_semaphore(bool8 verbose);
process test_semaphore2(bool8 verbose);
process test_semaphore3(bool8 verbose);
process test_semaphore4(bool8 verbose);
process test_semaphore5(bool8 verbose);
process test_libStdio(bool8 verbose);
void testPass(bool8, const char *);
void testFail(bool8, const char *);
void testSkip(bool8, const char *);
void testPrint(bool8, const char *);
/*------------------------------------------------------------------------
* failif - report failure by displaying a message is condition is met
*------------------------------------------------------------------------
*/
#define failif(cond, failmsg) \
if ( cond ) { testFail(verbose, failmsg); passed = FALSE; } \
else { testPass(verbose, ""); }
/* Define the strcuture of an entry in the table of test cases */
struct testcase {
char *name; /* Name of test case */
process (*test) (bool8);/* Test case function */
};
extern int ntests; /* total number of tests */
extern struct testcase testtab[]; /* table of test cases */
#define TESTSTK 8192 /* size of process stack used for test */
| 33.333333 | 74 | 0.646154 |
4cac6adcaa3ef7bcd06a436febcdc35995c1753a | 358 | h | C | RootConvert/Recon/CalXtalsParamsConvert.h | fermi-lat/RootConvert | c819499fb0da36acabdde545d20f5a080178bc15 | [
"BSD-3-Clause"
] | null | null | null | RootConvert/Recon/CalXtalsParamsConvert.h | fermi-lat/RootConvert | c819499fb0da36acabdde545d20f5a080178bc15 | [
"BSD-3-Clause"
] | null | null | null | RootConvert/Recon/CalXtalsParamsConvert.h | fermi-lat/RootConvert | c819499fb0da36acabdde545d20f5a080178bc15 | [
"BSD-3-Clause"
] | null | null | null | #ifndef RootConvert_CalXtalsParamsConvert_H
#define RootConvert_CalXtalsParamsConvert_H 1
#include <Event/Recon/CalRecon/CalXtalsParams.h>
#include <reconRootData/CalXtalsParams.h>
namespace RootPersistence {
void convert( const Event::CalXtalsParams &, CalXtalsParams & ) ;
void convert( const CalXtalsParams &, Event::CalXtalsParams & ) ;
}
#endif
| 23.866667 | 65 | 0.796089 |
ada1e0bd86a456b737f5eff02d7dbdaa3309930f | 10,121 | h | C | extension/trapezoidal/function.h | krzysztof-miemiec/fuzzybase | b9847d55bcc55109a083d24932ba17583122e336 | [
"MIT"
] | null | null | null | extension/trapezoidal/function.h | krzysztof-miemiec/fuzzybase | b9847d55bcc55109a083d24932ba17583122e336 | [
"MIT"
] | null | null | null | extension/trapezoidal/function.h | krzysztof-miemiec/fuzzybase | b9847d55bcc55109a083d24932ba17583122e336 | [
"MIT"
] | null | null | null | #ifndef TRAPEZOIDAL_FUNCTION_H
#define TRAPEZOIDAL_FUNCTION_H
#include "postgres.h"
#include <stdlib.h>
#include "../general/utils.h"
#include "../general/extension.h"
// Prototypes
typedef struct {
float8 a, m, dm, b;
} trapezoidal_function;
typedef struct {
float8 ext;
trapezoidal_function f;
char op[4];
} trapezoidal_function_extended;
trapezoidal_function *new_trapezoidal_function(void);
trapezoidal_function_extended *new_trapezoidal_function_extended(void);
void trapezoidal_function_clear(trapezoidal_function *f);
void trapezoidal_function_assign(trapezoidal_function *s, trapezoidal_function *d);
trapezoidal_function *trapezoidal_function_in(char *str);
char *trapezoidal_function_out(trapezoidal_function *t);
trapezoidal_function_extended *trapezoidal_function_extended_in(char *str);
char *trapezoidal_function_extended_out(trapezoidal_function_extended *t);
trapezoidal_function *about_r(float8 l, float8 m, float8 n, float8 o);
trapezoidal_function_extended *to_fext(trapezoidal_function *ft, float8 ext, char op[4]);
trapezoidal_function *trapezoidal_function_ext_to_trapezoidal_function(trapezoidal_function_extended *last_state);
trapezoidal_function *new_trapezoidal_function() {
return (trapezoidal_function *) palloc(sizeof(trapezoidal_function));
}
trapezoidal_function_extended *new_trapezoidal_function_extended() {
return (trapezoidal_function_extended *) palloc(sizeof(trapezoidal_function_extended));
}
trapezoidal_function_extended *to_fext_equal(trapezoidal_function *ft, float8 ext);
trapezoidal_function_extended *to_fext_not_equal(trapezoidal_function *ft, float8 ext);
trapezoidal_function_extended *to_fext_greater(trapezoidal_function *ft, float8 ext);
trapezoidal_function_extended *to_fext_greater_equal(trapezoidal_function *ft, float8 ext);
trapezoidal_function_extended *to_fext_lower(trapezoidal_function *ft, float8 ext);
trapezoidal_function_extended *to_fext_lower_equal(trapezoidal_function *ft, float8 ext);
/**
* Resets the structure.
* @param f trapezoidal function
*/
void trapezoidal_function_clear(trapezoidal_function *f) {
f->a = 0;
f->m = 0;
f->dm = 0;
f->b = 0;
}
/**
* Assigns one trapezoidal function to another
* @param s source
* @param d destination
*/
void trapezoidal_function_assign(trapezoidal_function *s, trapezoidal_function *d) {
if (s == NULL) {
d = NULL;
} else {
d->a = s->a;
d->m = s->m;
d->dm = s->dm;
d->b = s->b;
}
}
trapezoidal_function *trapezoidal_function_in(char *str) {
if (str == NULL) {
return NULL;
}
float8 l, m, n, o;
trapezoidal_function *result = new_trapezoidal_function();
int slashPosition = charpos(str, '/');
int tildePosition = charpos(str, '~');
int backslashPosition = charpos(str, '\\');
bool existsL = slashPosition >= 0;
bool existsN = tildePosition >= 0;
bool existsO = backslashPosition >= 0;
// Left bound
if (existsL) {
sscanf(str, "%lf", &l);
};
// Lefthand side 100%
sscanf(str + slashPosition + 1, "%lf", &m);
if (!existsL) {
l = m;
}
// Right-hand side 100%
if (existsN) {
sscanf(str + tildePosition + 1, "%lf", &n);
} else {
n = m;
}
// Right bound
if (existsO) {
sscanf(str + backslashPosition + 1, "%lf", &o);
} else {
o = n;
}
result->a = m - l;
result->m = m;
result->dm = n - m;
result->b = o - n;
return result;
}
PG_FUNC_1(trapezoidal_function_in, trapezoidal_function*, POINTER, char*, CSTRING);
char *trapezoidal_function_out(trapezoidal_function *f) {
if (f == NULL) {
return NULL;
}
char *result = (char *) palloc(512);
strcpy(result, "");
sprintf(result, "%.2f/%.2f~%.2f\\%.2f",
f->m - f->a,
f->m,
f->m + f->dm,
f->m + f->dm + f->b
);
return result;
}
PG_FUNC_1(trapezoidal_function_out, char*, CSTRING, trapezoidal_function*, POINTER);
/**
* Converts the extended trapezoidal function string representation to a structure
* @param str Input string in ext|l/m~n\o format
* @return Extended trapezoidal function
*/
trapezoidal_function_extended *trapezoidal_function_extended_in(char *str) {
if (str == NULL) {
return NULL;
}
trapezoidal_function_extended *result = new_trapezoidal_function_extended();
float8 l, m, n, o;
sscanf(str, "%lf/%lf~%lf\\%lf %s %lf", &l, &m, &n, &o, result->op, &result->ext);
trapezoidal_function *f = about_r(l, m, n, o);
trapezoidal_function_assign(f, &result->f);
pfree(f);
return result;
}
PG_FUNC_1(trapezoidal_function_extended_in, trapezoidal_function_extended*, POINTER, char*, CSTRING);
/**
* Converts an extended trapezoidal function to it's string representation
*
* @param f trapezoidal function
* @return Trapezoidal function string in l/m~n\o op ext format
*/
char *trapezoidal_function_extended_out(trapezoidal_function_extended *x) {
if (x == NULL) {
return NULL;
}
char *result = trapezoidal_function_out(&x->f);
sprintf(result + strlen(result), " %s %.2f", x->op, x->ext);
return result;
}
PG_FUNC_1(trapezoidal_function_extended_out, char*, CSTRING, trapezoidal_function_extended*, POINTER);
/**
* trapezoidal_function *trapezoidal_function_ext_to_trapezoidal_function(trapezoidal_function_extended *last_state)
* Extracts trapezoidal function out of extended trapezoidal function
* @param last_state
* @return trapezoidal function
*/
trapezoidal_function *trapezoidal_function_ext_to_trapezoidal_function(trapezoidal_function_extended *last_state) {
if (last_state == NULL) {
return NULL;
}
return &(last_state->f);
};
PG_FUNC_1(trapezoidal_function_ext_to_trapezoidal_function, trapezoidal_function*, POINTER,
trapezoidal_function_extended*, POINTER);
/**
* Converts parameters to trapezoidal function
*
* @return trapezoidal function
*/
trapezoidal_function *about_r(float8 l, float8 m, float8 n, float8 o) {
trapezoidal_function *f = new_trapezoidal_function();
f->a = m - l;
f->m = m;
f->dm = n - m;
f->b = o - n;
return f;
}
/**
* Converts parameter pointers to trapezoidal function
*
* @return trapezoidal function
*/
WindowsDllExport(pg_about);
PG_FUNCTION_INFO_V1(pg_about);
Datum pg_about(PG_FUNCTION_ARGS) {
float8 l = PG_GETARG_FLOAT8(0);
float8 m = PG_GETARG_FLOAT8(1);
float8 n = PG_GETARG_FLOAT8(2);
float8 o = PG_GETARG_FLOAT8(3);
trapezoidal_function *result = about_r(l, m, n, o);
PG_RETURN_POINTER(result);
}
/**
* Creates an extended trapezoidal function out of trapezoidal function, extension and operator
* @param ft pointer to trapezoidal function
* @param ext extension
* @param op operator
* @return a pointer to a new extended trapezoidal function (with an extension and operator)
*/
trapezoidal_function_extended *to_fext(trapezoidal_function *ft, float8 ext, char op[4]) {
if (ft == NULL || op == NULL) {
return NULL;
}
trapezoidal_function_extended *result = new_trapezoidal_function_extended();
result->ext = ext;
trapezoidal_function_assign(ft, &result->f);
strncpy(result->op, op, 4);
return result;
}
/**
* Creates an extended trapezoidal function with equal operator
* @param ft pointer to trapezoidal function
* @param ext pointer to extension
* @return a pointer to a new extended trapezoidal function (with an extension and operator)
*/
trapezoidal_function_extended *to_fext_equal(trapezoidal_function *ft, float8 ext) {
return to_fext(ft, ext, "*=");
};
PG_FUNC_2_POINTER(to_fext_equal, trapezoidal_function*, POINTER, float8, FLOAT8);
/**
* Creates an extended trapezoidal function with not equal operator
* @param ft pointer to trapezoidal function
* @param ext pointer to extension
* @return a pointer to a new extended trapezoidal function (with an extension and operator)
*/
trapezoidal_function_extended *to_fext_not_equal(trapezoidal_function *ft, float8 ext) {
return to_fext(ft, ext, "*<>");
};
PG_FUNC_2_POINTER(to_fext_not_equal, trapezoidal_function*, POINTER, float8, FLOAT8);
/**
* Creates an extended trapezoidal function with greater operator
* @param ft pointer to trapezoidal function
* @param ext pointer to extension
* @return a pointer to a new extended trapezoidal function (with an extension and operator)
*/
trapezoidal_function_extended *to_fext_greater(trapezoidal_function *ft, float8 ext) {
return to_fext(ft, ext, "*>");
};
PG_FUNC_2_POINTER(to_fext_greater, trapezoidal_function*, POINTER, float8, FLOAT8);
/**
* Creates an extended trapezoidal function with greater or equal operator
* @param ft pointer to trapezoidal function
* @param ext pointer to extension
* @return a pointer to a new extended trapezoidal function (with an extension and operator)
*/
trapezoidal_function_extended *to_fext_greater_equal(trapezoidal_function *ft, float8 ext) {
return to_fext(ft, ext, "*>=");
};
PG_FUNC_2_POINTER(to_fext_greater_equal, trapezoidal_function*, POINTER, float8, FLOAT8);
/**
* Creates an extended trapezoidal function with lower operator
* @param ft pointer to trapezoidal function
* @param ext pointer to extension
* @return a pointer to a new extended trapezoidal function (with an extension and operator)
*/
trapezoidal_function_extended *to_fext_lower(trapezoidal_function *ft, float8 ext) {
return to_fext(ft, ext, "*<");
};
PG_FUNC_2_POINTER(to_fext_lower, trapezoidal_function*, POINTER, float8, FLOAT8);
/**
* Creates an extended trapezoidal function with lower or equal operator
* @param ft pointer to trapezoidal function
* @param ext pointer to extension
* @return a pointer to a new extended trapezoidal function (with an extension and operator)
*/
trapezoidal_function_extended *to_fext_lower_equal(trapezoidal_function *ft, float8 ext) {
return to_fext(ft, ext, "*<=");
};
PG_FUNC_2_POINTER(to_fext_lower_equal, trapezoidal_function*, POINTER, float8, FLOAT8);
#endif
| 29.680352 | 116 | 0.717716 |
51a1797235bf2285147d3eb2a0919cd013d64b34 | 7,447 | h | C | sysutils/screen/window.h | ibara/LiteBSD-Ports | fd99e3b6884ff5ba30ab6b6eedc5ada812dcb733 | [
"MIT"
] | 14 | 2015-12-22T03:17:48.000Z | 2021-07-31T00:02:26.000Z | sysutils/screen/window.h | ibara/LiteBSD-Ports | fd99e3b6884ff5ba30ab6b6eedc5ada812dcb733 | [
"MIT"
] | 3 | 2016-01-19T05:24:47.000Z | 2018-01-21T19:41:53.000Z | sysutils/screen/window.h | ibara/LiteBSD-Ports | fd99e3b6884ff5ba30ab6b6eedc5ada812dcb733 | [
"MIT"
] | 6 | 2016-01-19T05:07:17.000Z | 2022-01-12T03:25:39.000Z | /* Copyright (c) 1993
* Juergen Weigert (jnweiger@immd4.informatik.uni-erlangen.de)
* Michael Schroeder (mlschroe@immd4.informatik.uni-erlangen.de)
* Copyright (c) 1987 Oliver Laumann
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program (see the file COPYING); if not, write to the
* Free Software Foundation, Inc.,
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*
****************************************************************
* $Id: window.h,v 1.11 1994/05/31 12:33:27 mlschroe Exp $ FAU
*/
#ifndef MAXWIN
# define MAXWIN 10
#endif
struct NewWindow
{
int StartAt; /* where to start the search for the slot */
char *aka; /* aka string */
char **args; /* argv vector */
char *dir; /* directory for chdir */
char *term; /* TERM to be set instead of "screen" */
int aflag;
int flowflag;
int lflag;
int histheight;
int monitor;
int wlock; /* default writelock setting */
int wrap;
int c1;
int gr;
int kanji;
char *hstatus;
char *charset;
};
#ifdef PSEUDOS
struct pseudowin
{
int fdpat;
int p_pid;
int p_ptyfd;
char p_cmd[MAXSTR];
char p_tty[MAXSTR];
char p_inbuf[IOSIZE]; /* buffered writing to p_ptyfd */
int p_inlen;
};
/* bits for fdpat: */
#define F_PMASK 0x0003
#define F_PSHIFT 2
#define F_PFRONT 0x0001 /* . */
#define F_PBACK 0x0002 /* ! */
#define F_PBOTH (F_PFRONT | F_PBACK) /* : */
#define F_UWP 0x1000 /* | */
/* The screen process ...)
* ... wants to write to pseudo */
#define W_WP(w) ((w)->w_pwin && ((w)->w_pwin->fdpat & F_PFRONT))
/* ... wants to write to window: user writes to window
* or stdout/stderr of pseudo are duplicated to window */
#define W_WW(w) (!((w)->w_pwin) || \
(((w)->w_pwin->fdpat & F_PMASK) == F_PBACK) || \
((((w)->w_pwin->fdpat >> F_PSHIFT) & F_PMASK) == F_PBOTH) || \
((((w)->w_pwin->fdpat >> (F_PSHIFT * 2)) & F_PMASK) == F_PBOTH))
/* ... wants to read from pseudowin */
#define W_RP(w) ((w)->w_pwin && ((w)->w_pwin->fdpat & \
((F_PFRONT << (F_PSHIFT * 2)) | (F_PFRONT << F_PSHIFT)) ))
/* ... wants to read from window */
#define W_RW(w) (!((w)->w_pwin) || ((w)->w_pwin->fdpat & F_PFRONT))
/* user input is written to pseudo */
#define W_UWP(w) ((w)->w_pwin && ((w)->w_pwin->fdpat & F_UWP))
/* pseudo output has to be stuffed in window */
#define W_PTOW(w) (\
((w)->w_pwin->fdpat & F_PMASK << F_PSHIFT) == F_PBOTH << F_PSHIFT || \
((w)->w_pwin->fdpat & F_PMASK << F_PSHIFT * 2) == F_PBOTH << F_PSHIFT * 2 )
/* window output has to be stuffed in pseudo */
#define W_WTOP(w) (((w)->w_pwin->fdpat & F_PMASK) == F_PBOTH)
#endif /* PSEUDOS */
struct win
{
struct win *w_next; /* next window */
#ifdef PSEUDOS
struct pseudowin *w_pwin; /* ptr to pseudo */
#endif
struct display *w_display; /* pointer to our display */
struct display *w_pdisplay; /* display for printer relay */
int w_number; /* window number */
int w_active; /* is window fore and has no layer? */
struct layer *w_lay; /* the layer of the window */
struct layer w_winlay; /* the layer of the window */
int w_pid; /* process at the other end of ptyfd */
char *w_cmdargs[MAXARGS]; /* command line argument vector */
int w_ptyfd; /* fd of the master pty */
int w_aflag; /* (used for DUMP_TERMCAP) */
char w_inbuf[IOSIZE];
int w_inlen;
char w_outbuf[IOSIZE];
int w_outlen;
char *w_title; /* name of the window */
char *w_akachange; /* autoaka hack */
int w_autoaka; /* autoaka hack */
char w_akabuf[MAXSTR]; /* aka buffer */
char w_tty[MAXSTR];
struct tty_attr w_t;
int w_intermediate; /* char used while parsing ESC-seq */
int w_args[MAXARGS];
int w_NumArgs;
slot_t w_slot; /* utmp slot */
#if defined (UTMPOK)
struct utmp w_savut; /* utmp entry of this window */
#endif
struct mline *w_mlines;
int w_x, w_y; /* Cursor position */
int w_width, w_height; /* window size */
struct mchar w_rend; /* current rendition */
char w_FontL; /* character font GL */
char w_FontR; /* character font GR */
int w_Charset; /* charset number GL */
int w_CharsetR; /* charset number GR */
int w_charsets[4]; /* Font = charsets[Charset] */
int w_ss;
int w_saved;
int w_Saved_x, w_Saved_y;
struct mchar w_SavedRend;
int w_SavedCharset;
int w_SavedCharsetR;
int w_SavedCharsets[4];
int w_top, w_bot; /* scrollregion */
int w_wrap; /* autowrap */
int w_origin; /* origin mode */
int w_insert; /* window is in insert mode */
int w_keypad; /* keypad mode */
int w_cursorkeys; /* appl. cursorkeys mode */
int w_revvid; /* reverse video */
int w_curinv; /* cursor invisible */
int w_curvvis; /* cursor very visible */
int w_autolf; /* automatic linefeed */
char *w_hstatus; /* hardstatus line */
#ifdef COPY_PASTE
char *w_pastebuf; /* this gets pasted in the window */
char *w_pasteptr; /* pointer in pastebuf */
int w_pastelen; /* bytes left to paste */
int w_histheight; /* all histbases are malloced with width * histheight */
int w_histidx; /* 0 <= histidx < histheight; where we insert lines */
struct mline *w_hlines; /* history buffer */
#else
int w_histheight; /* always 0 */
#endif
enum state_t w_state; /* parser state */
enum string_t w_StringType;
int w_gr; /* enable GR flag */
int w_c1; /* enable C1 flag */
#ifdef KANJI
int w_kanji; /* for input and paste */
int w_mbcs; /* saved char for multibytes charset */
#endif
char w_string[MAXSTR];
char *w_stringp;
char *w_tabs; /* line with tabs */
int w_bell; /* bell status of this window */
int w_flow; /* flow flags */
FILE *w_logfp; /* log to file */
int w_monitor; /* monitor status */
struct lastio_s
{
time_t lastio; /* timestamp of last filedescriptor activity */
int seconds; /* tell us when lastio + seconds < time() */
} w_tstamp;
char w_norefresh; /* dont redisplay when switching to that win */
char w_wlock; /* WLOCK_AUTO, WLOCK_OFF, WLOCK_ON */
struct user *w_wlockuser; /* NULL when unlocked or user who writes */
#ifdef MULTIUSER
AclBits w_userbits[ACL_BITS_PER_WIN];
#endif
};
/* definitions for wlocktype */
#define WLOCK_OFF 0 /* all who are in w_userbits can write */
#define WLOCK_AUTO 1 /* who selects first, can write */
#define WLOCK_ON 2 /* w_wlockuser writes even if deselected */
/*
* Definitions for flow
* 000 -(-)
* 001 +(-)
* 010 -(+)
* 011 +(+)
* 100 -(a)
* 111 +(a)
*/
#define FLOW_NOW (1<<0)
#define FLOW_AUTO (1<<1)
#define FLOW_AUTOFLAG (1<<2)
/*
* WIN gives us a reference to line y of the *whole* image
* where line 0 is the oldest line in our history.
* y must be in whole image coordinate system, not in display.
*/
#define WIN(y) ((y < fore->w_histheight) ? \
&fore->w_hlines[(fore->w_histidx + y) % fore->w_histheight] \
: &fore->w_mlines[y - fore->w_histheight])
| 31.824786 | 78 | 0.641332 |
799b8a89de731d0dc06c71825387c80e4d4d8027 | 511 | c | C | source/lib/Xrandr/test.c | binaryblob01/zfree86 | e80ea992d87501b8e3e2d7c07a414591c2e11c70 | [
"Xnet",
"X11"
] | 1 | 2021-09-08T21:13:25.000Z | 2021-09-08T21:13:25.000Z | source/lib/Xrandr/test.c | binaryblob01/zfree86 | e80ea992d87501b8e3e2d7c07a414591c2e11c70 | [
"Xnet",
"X11"
] | null | null | null | source/lib/Xrandr/test.c | binaryblob01/zfree86 | e80ea992d87501b8e3e2d7c07a414591c2e11c70 | [
"Xnet",
"X11"
] | 1 | 2021-01-22T00:19:47.000Z | 2021-01-22T00:19:47.000Z | /* $XFree86: xc/lib/Xrandr/test.c,v 1.3 2005/10/14 15:16:00 tsi Exp $ */
#include <stdio.h>
#include <X11/Xlib.h>
#include <X11/extensions/Xrandr.h>
main (int argc, char **argv)
{
char *display_name = ":0";
Display *display;
int major, minor, status;
if ((display = XOpenDisplay (display_name)) == NULL) {
fprintf(stderr, "Can't open display!\n");
}
status = XRRQueryVersion (display, &major, &minor);
fprintf(stderr, "status = %d, major = %d, minor = %d\n,
status, major, minor");
}
| 23.227273 | 72 | 0.632094 |
795c8f10bb47bf0cd89d0e873ae9cc8db043e8cd | 387 | h | C | production/include/executor/version.h | Lewerow/Autoencoders | 09c2ca0d3099407f77c177270cf2a80ffdea794f | [
"MIT"
] | null | null | null | production/include/executor/version.h | Lewerow/Autoencoders | 09c2ca0d3099407f77c177270cf2a80ffdea794f | [
"MIT"
] | null | null | null | production/include/executor/version.h | Lewerow/Autoencoders | 09c2ca0d3099407f77c177270cf2a80ffdea794f | [
"MIT"
] | null | null | null | #ifndef VERSION_H_fji043j9f89rtmkflvmdsfmoiergnjvkfljewfjoewifjweiofjewiofjorgruigtbincvkmdsckldscsmd
#define VERSION_H_fji043j9f89rtmkflvmdsfmoiergnjvkfljewfjoewifjweiofjewiofjorgruigtbincvkmdsckldscsmd
const char* APPLICATION_NAME = "MasterProject";
const unsigned int VERSION_MAJOR = 0;
const unsigned int VERSION_MINOR = 0;
const unsigned int VERSION_SUBMINOR = 1;
#endif | 38.7 | 102 | 0.863049 |
796773f2ed50272f547a2eaa81949adbf61c1e11 | 10,237 | h | C | usr/libexec/tccd/TCCDService.h | lechium/iOS1351Headers | 6bed3dada5ffc20366b27f7f2300a24a48a6284e | [
"MIT"
] | 2 | 2021-11-02T09:23:27.000Z | 2022-03-28T08:21:57.000Z | usr/libexec/tccd/TCCDService.h | lechium/iOS1351Headers | 6bed3dada5ffc20366b27f7f2300a24a48a6284e | [
"MIT"
] | null | null | null | usr/libexec/tccd/TCCDService.h | lechium/iOS1351Headers | 6bed3dada5ffc20366b27f7f2300a24a48a6284e | [
"MIT"
] | 1 | 2022-03-28T08:21:59.000Z | 2022-03-28T08:21:59.000Z | //
// Generated by classdumpios 1.0.1 (64 bit) (iOS port by DreamDevLost)(Debug version compiled Sep 26 2020 13:48:20).
//
// Copyright (C) 1997-2019 Steve Nygard.
//
#import <objc/NSObject.h>
@class NSArray, NSDictionary, NSNumber, NSSet, NSString;
@interface TCCDService : NSObject
{
_Bool _shouldTreatAsDeprecated; // 8 = 0x8
_Bool _mdm_isAuthorizationDenyOnly; // 9 = 0x9
_Bool _mdm_macos_allowedInPayloadDefition; // 10 = 0xa
_Bool _shouldUseADefaultDescriptionString; // 11 = 0xb
_Bool _shouldIssueSandboxExtension; // 12 = 0xc
_Bool _isRevocable; // 13 = 0xd
_Bool _shouldDisableAlert; // 14 = 0xe
_Bool _useExternalNotificationOfDenial; // 15 = 0xf
_Bool _isAccessAllowedByDefault; // 16 = 0x10
_Bool _isAccessDeniedByDefault; // 17 = 0x11
_Bool _allowPromptForPlatformBinaries; // 18 = 0x12
_Bool _shouldAllowUnrestrictedCheckAuditToken; // 19 = 0x13
_Bool _hasParanoidSecurityPolicy; // 20 = 0x14
_Bool _hasAdditionalPromptText; // 21 = 0x15
_Bool _doNotStoreDefaultAllowAccess; // 22 = 0x16
_Bool _expireOnlyAllowedEntries; // 23 = 0x17
_Bool _saveExpiredEntries; // 24 = 0x18
_Bool _applyDevelopmentAuthoriationPolicy; // 25 = 0x19
_Bool _checkAllowEntitlementOnResponsibleProcess; // 26 = 0x1a
_Bool _useAlternateStringsForSubsequentRequests; // 27 = 0x1b
_Bool _macos_pardonMissingUsage; // 28 = 0x1c
_Bool _macos_isPerSystem; // 29 = 0x1d
_Bool _macos_compositionPromoteChildAuthoriationToParent; // 30 = 0x1e
_Bool _macos_hasIndirectObject; // 31 = 0x1f
_Bool _macos_shouldAllowSameTeam; // 32 = 0x20
NSDictionary *_platformAvailability; // 40 = 0x28
NSSet *_validOnPlatformNames; // 48 = 0x30
NSString *_name; // 56 = 0x38
NSString *_externalName; // 64 = 0x40
NSString *_usageDescriptionKeyName; // 72 = 0x48
NSString *_secondaryUsageDescriptionKeyName; // 80 = 0x50
NSArray *_disallowedOnPlatformSubtypeNameList; // 88 = 0x58
NSString *_sandboxOperationForDelegation; // 96 = 0x60
NSArray *_defaultAllowedIdentifiersList; // 104 = 0x68
NSNumber *_expirySeconds; // 112 = 0x70
long long _defaultDevelopmentAuthorizationValue; // 120 = 0x78
NSString *_allowAuthorizationButtonTitleLocalizationKey; // 128 = 0x80
NSString *_denyAuthorizationButtonTitleLocalizationKey; // 136 = 0x88
NSNumber *_ios_watchKitUserNotificationNumber; // 144 = 0x90
NSNumber *_iOS_minimumSDKVersionNumber; // 152 = 0x98
NSNumber *_watchOS_minimumSDKVersionNumber; // 160 = 0xa0
NSNumber *_tvOS_minimumSDKVersionNumber; // 168 = 0xa8
NSNumber *_macos_minimumSDKVersionNumber; // 176 = 0xb0
NSString *_macos_helpAnchor; // 184 = 0xb8
TCCDService *_macos_compositionChildService; // 192 = 0xc0
TCCDService *_macos_compositionParentService; // 200 = 0xc8
NSString *_macos_hardenedRuntimeEntitlementName; // 208 = 0xd0
long long _macos_AXControlComputerAccessType; // 216 = 0xd8
}
+ (id)versionStringFromDYLDVersionNumber:(id)arg1; // IMP=0x0000000100033d10
+ (id)tccdPlatformNameForDYLDPlatformName:(id)arg1; // IMP=0x0000000100033c3c
+ (id)serviceDescriptionsForPlatformName:(id)arg1; // IMP=0x0000000100033970
+ (id)serviceAll; // IMP=0x00000001000338d0
+ (id)allServices; // IMP=0x000000010002f288
- (void).cxx_destruct; // IMP=0x0000000100034e18
@property(nonatomic) long long macos_AXControlComputerAccessType; // @synthesize macos_AXControlComputerAccessType=_macos_AXControlComputerAccessType;
@property(retain, nonatomic) NSString *macos_hardenedRuntimeEntitlementName; // @synthesize macos_hardenedRuntimeEntitlementName=_macos_hardenedRuntimeEntitlementName;
@property(nonatomic) _Bool macos_shouldAllowSameTeam; // @synthesize macos_shouldAllowSameTeam=_macos_shouldAllowSameTeam;
@property(nonatomic) _Bool macos_hasIndirectObject; // @synthesize macos_hasIndirectObject=_macos_hasIndirectObject;
@property(nonatomic) __weak TCCDService *macos_compositionParentService; // @synthesize macos_compositionParentService=_macos_compositionParentService;
@property(nonatomic) _Bool macos_compositionPromoteChildAuthoriationToParent; // @synthesize macos_compositionPromoteChildAuthoriationToParent=_macos_compositionPromoteChildAuthoriationToParent;
@property(nonatomic) __weak TCCDService *macos_compositionChildService; // @synthesize macos_compositionChildService=_macos_compositionChildService;
@property(nonatomic) _Bool macos_isPerSystem; // @synthesize macos_isPerSystem=_macos_isPerSystem;
@property(retain, nonatomic) NSString *macos_helpAnchor; // @synthesize macos_helpAnchor=_macos_helpAnchor;
@property(nonatomic) _Bool macos_pardonMissingUsage; // @synthesize macos_pardonMissingUsage=_macos_pardonMissingUsage;
@property(retain, nonatomic) NSNumber *macos_minimumSDKVersionNumber; // @synthesize macos_minimumSDKVersionNumber=_macos_minimumSDKVersionNumber;
@property(retain, nonatomic) NSNumber *tvOS_minimumSDKVersionNumber; // @synthesize tvOS_minimumSDKVersionNumber=_tvOS_minimumSDKVersionNumber;
@property(retain, nonatomic) NSNumber *watchOS_minimumSDKVersionNumber; // @synthesize watchOS_minimumSDKVersionNumber=_watchOS_minimumSDKVersionNumber;
@property(retain, nonatomic) NSNumber *iOS_minimumSDKVersionNumber; // @synthesize iOS_minimumSDKVersionNumber=_iOS_minimumSDKVersionNumber;
@property(retain) NSNumber *ios_watchKitUserNotificationNumber; // @synthesize ios_watchKitUserNotificationNumber=_ios_watchKitUserNotificationNumber;
@property(nonatomic) _Bool useAlternateStringsForSubsequentRequests; // @synthesize useAlternateStringsForSubsequentRequests=_useAlternateStringsForSubsequentRequests;
@property(retain, nonatomic) NSString *denyAuthorizationButtonTitleLocalizationKey; // @synthesize denyAuthorizationButtonTitleLocalizationKey=_denyAuthorizationButtonTitleLocalizationKey;
@property(retain, nonatomic) NSString *allowAuthorizationButtonTitleLocalizationKey; // @synthesize allowAuthorizationButtonTitleLocalizationKey=_allowAuthorizationButtonTitleLocalizationKey;
@property(nonatomic) _Bool checkAllowEntitlementOnResponsibleProcess; // @synthesize checkAllowEntitlementOnResponsibleProcess=_checkAllowEntitlementOnResponsibleProcess;
@property(nonatomic) long long defaultDevelopmentAuthorizationValue; // @synthesize defaultDevelopmentAuthorizationValue=_defaultDevelopmentAuthorizationValue;
@property(nonatomic) _Bool applyDevelopmentAuthoriationPolicy; // @synthesize applyDevelopmentAuthoriationPolicy=_applyDevelopmentAuthoriationPolicy;
@property(nonatomic) _Bool saveExpiredEntries; // @synthesize saveExpiredEntries=_saveExpiredEntries;
@property(nonatomic) _Bool expireOnlyAllowedEntries; // @synthesize expireOnlyAllowedEntries=_expireOnlyAllowedEntries;
@property(retain, nonatomic) NSNumber *expirySeconds; // @synthesize expirySeconds=_expirySeconds;
@property(nonatomic) _Bool doNotStoreDefaultAllowAccess; // @synthesize doNotStoreDefaultAllowAccess=_doNotStoreDefaultAllowAccess;
@property(retain, nonatomic) NSArray *defaultAllowedIdentifiersList; // @synthesize defaultAllowedIdentifiersList=_defaultAllowedIdentifiersList;
@property(retain, nonatomic) NSString *sandboxOperationForDelegation; // @synthesize sandboxOperationForDelegation=_sandboxOperationForDelegation;
@property(nonatomic) _Bool hasAdditionalPromptText; // @synthesize hasAdditionalPromptText=_hasAdditionalPromptText;
@property(nonatomic) _Bool hasParanoidSecurityPolicy; // @synthesize hasParanoidSecurityPolicy=_hasParanoidSecurityPolicy;
@property(nonatomic) _Bool shouldAllowUnrestrictedCheckAuditToken; // @synthesize shouldAllowUnrestrictedCheckAuditToken=_shouldAllowUnrestrictedCheckAuditToken;
@property(nonatomic) _Bool allowPromptForPlatformBinaries; // @synthesize allowPromptForPlatformBinaries=_allowPromptForPlatformBinaries;
@property(nonatomic) _Bool isAccessDeniedByDefault; // @synthesize isAccessDeniedByDefault=_isAccessDeniedByDefault;
@property(nonatomic) _Bool isAccessAllowedByDefault; // @synthesize isAccessAllowedByDefault=_isAccessAllowedByDefault;
@property(nonatomic) _Bool useExternalNotificationOfDenial; // @synthesize useExternalNotificationOfDenial=_useExternalNotificationOfDenial;
@property(nonatomic) _Bool shouldDisableAlert; // @synthesize shouldDisableAlert=_shouldDisableAlert;
@property(nonatomic) _Bool isRevocable; // @synthesize isRevocable=_isRevocable;
@property(nonatomic) _Bool shouldIssueSandboxExtension; // @synthesize shouldIssueSandboxExtension=_shouldIssueSandboxExtension;
@property(retain, nonatomic) NSArray *disallowedOnPlatformSubtypeNameList; // @synthesize disallowedOnPlatformSubtypeNameList=_disallowedOnPlatformSubtypeNameList;
@property(nonatomic) _Bool shouldUseADefaultDescriptionString; // @synthesize shouldUseADefaultDescriptionString=_shouldUseADefaultDescriptionString;
@property(retain, nonatomic) NSString *secondaryUsageDescriptionKeyName; // @synthesize secondaryUsageDescriptionKeyName=_secondaryUsageDescriptionKeyName;
@property(retain, nonatomic) NSString *usageDescriptionKeyName; // @synthesize usageDescriptionKeyName=_usageDescriptionKeyName;
@property(nonatomic) _Bool mdm_macos_allowedInPayloadDefition; // @synthesize mdm_macos_allowedInPayloadDefition=_mdm_macos_allowedInPayloadDefition;
@property(nonatomic) _Bool mdm_isAuthorizationDenyOnly; // @synthesize mdm_isAuthorizationDenyOnly=_mdm_isAuthorizationDenyOnly;
@property(nonatomic) _Bool shouldTreatAsDeprecated; // @synthesize shouldTreatAsDeprecated=_shouldTreatAsDeprecated;
@property(retain, nonatomic) NSString *externalName; // @synthesize externalName=_externalName;
@property(retain, nonatomic) NSString *name; // @synthesize name=_name;
@property(retain, nonatomic) NSSet *validOnPlatformNames; // @synthesize validOnPlatformNames=_validOnPlatformNames;
@property(retain, nonatomic) NSDictionary *platformAvailability; // @synthesize platformAvailability=_platformAvailability;
- (long long)developmentAuthorizationValue; // IMP=0x000000010003493c
@property(readonly, nonatomic) _Bool pardonMissingUsage;
- (long long)compare:(id)arg1; // IMP=0x0000000100034898
- (id)descriptionDictionary; // IMP=0x000000010003402c
- (id)description; // IMP=0x0000000100034020
- (id)initWithName:(id)arg1 availability:(id)arg2; // IMP=0x0000000100033d88
@end
| 81.246032 | 194 | 0.831884 |
66b0995d70278242f68fd1303f5a4468abdaed56 | 778 | h | C | components/esp-wolfssl/wolfssl/wolfssl/wolfcrypt/port/af_alg/afalg_hash.h | waldo22/esp-at | f5a37d9dfb397eb63eac7791df0fbebc96c74056 | [
"MIT-0"
] | 3 | 2020-05-17T10:07:59.000Z | 2022-02-22T16:44:04.000Z | components/esp-wolfssl/wolfssl/wolfssl/wolfcrypt/port/af_alg/afalg_hash.h | yaming116/esp-at | 00ceef74736db78eb7e257016f226c455ed4913b | [
"MIT-0"
] | null | null | null | components/esp-wolfssl/wolfssl/wolfssl/wolfcrypt/port/af_alg/afalg_hash.h | yaming116/esp-at | 00ceef74736db78eb7e257016f226c455ed4913b | [
"MIT-0"
] | null | null | null | /* afalg_hash.h
*
* Copyright (C) 2006-2019 wolfSSL Inc. All rights reserved.
*
* This file is part of wolfSSL.
*
* Contact licensing@wolfssl.com with any questions or comments.
*
* https://www.wolfssl.com
*/
#ifndef WOLF_CRYPT_AFALG_HASH_H
#define WOLF_CRYPT_AFALG_HASH_H
#include <wolfssl/wolfcrypt/types.h>
#undef WOLFSSL_NO_HASH_RAW
#define WOLFSSL_NO_HASH_RAW
typedef struct {
byte* msg;
void* heap;
word32 used;
word32 len;
int alFd;
int rdFd;
} wolfssl_AFALG_Hash;
#if !defined(NO_SHA256) && defined(WOLFSSL_AFALG_HASH)
typedef wolfssl_AFALG_Hash wc_Sha256;
#endif
#if defined(WOLFSSL_SHA3) && defined(WOLFSSL_AFALG_XILINX_SHA3)
typedef wolfssl_AFALG_Hash wc_Sha3;
#endif
#endif /* WOLF_CRYPT_AFALG_HASH_H */
| 18.97561 | 64 | 0.724936 |
66ec45c6b5571104ac5edb8e01579a235e34dce8 | 14,032 | h | C | scv-2.0.0a/src/scv/_scv_ext_type.h | EajksEajks/SystemC | edab85ca637668173f262f3488e51f75f2cb1a7e | [
"Apache-2.0"
] | 2 | 2021-11-19T02:29:01.000Z | 2022-03-14T12:59:42.000Z | scv-2.0.0a/src/scv/_scv_ext_type.h | EajksEajks/SystemC | edab85ca637668173f262f3488e51f75f2cb1a7e | [
"Apache-2.0"
] | null | null | null | scv-2.0.0a/src/scv/_scv_ext_type.h | EajksEajks/SystemC | edab85ca637668173f262f3488e51f75f2cb1a7e | [
"Apache-2.0"
] | null | null | null | // -*- C++ -*- <this line is for emacs to recognize it as C++ code>
/*****************************************************************************
Licensed to Accellera Systems Initiative Inc. (Accellera)
under one or more contributor license agreements. See the
NOTICE file distributed with this work for additional
information regarding copyright ownership. Accellera licenses
this file to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
*****************************************************************************/
/*****************************************************************************
_scv_ext_type.h -- The implementation for the extension component "type".
Original Authors (Cadence Design Systems, Inc):
Norris Ip, Dean Shea, John Rose, Jasvinder Singh, William Paulsen,
John Pierce, Rachida Kebichi, Ted Elkind, David Bailey, Samir Agrawal
2002-09-23
*****************************************************************************/
/*****************************************************************************
MODIFICATION LOG - modifiers, enter your name, affiliation, date and
changes you are making here.
Name, Affiliation, Date:
Description of Modification:
*****************************************************************************/
// ----------------------------------------
// specialization for records
// ----------------------------------------
template<typename T>
class scv_extension_type
: public _SCV_INTROSPECTION_BASE {
public:
scv_extension_type() {}
virtual ~scv_extension_type() {}
virtual scv_extension_type_if::data_type get_type() const { return scv_extension_type_if::RECORD; }
virtual int get_enum_size() const { return 0; }
virtual void get_enum_details(std::list<const char *>&, std::list<int>&) const {}
virtual const char * get_enum_string(int) const { return "_error"; }
virtual int get_num_fields() const { return this->_get_num_fields(); }
virtual scv_extensions_if * get_field(unsigned i) { return this->_get_field(i); }
virtual const scv_extensions_if * get_field(unsigned i) const { return this->_get_field(i); }
virtual scv_extensions_if * get_pointer() { return 0; }
virtual const scv_extensions_if * get_pointer() const { return 0; }
virtual int get_array_size() const { return 0; }
virtual scv_extensions_if * get_array_elt(int) { return 0; }
virtual const scv_extensions_if * get_array_elt(int) const { return 0; }
virtual int get_bitwidth() const {
std::list<_scv_extension_util*>::const_iterator f;
int size = 0;
for (f = this->_fields.begin(); f!= this->_fields.end(); ++f)
{ size += (*f)->get_bitwidth(); }
return size;
}
virtual scv_extensions_if * get_parent() { return this->_parent; }
virtual const scv_extensions_if * get_parent() const { return this->_parent; }
};
// ----------------------------------------
// specialization for array
// ----------------------------------------
template<typename T, int N>
class scv_extension_type<T[N]>
: public _SCV_INTROSPECTION_BASE2 {
public:
scv_extension_type() {}
virtual ~scv_extension_type() {}
virtual const char * get_type_name() const {
static const char * s = _scv_ext_util_get_name("%s[%d]",
scv_extensions<T>().get_type_name(), N);
return s;
}
virtual scv_extension_type_if::data_type get_type() const { return scv_extension_type_if::ARRAY; }
virtual int get_enum_size() const { return 0; }
virtual void get_enum_details(std::list<const char *>&, std::list<int>&) const {}
virtual const char * get_enum_string(int) const { return "_error"; }
virtual int get_num_fields() const { return 0; }
virtual scv_extensions_if * get_field(unsigned i) { return 0; }
virtual const scv_extensions_if * get_field(unsigned i) const { return 0; }
virtual scv_extensions_if * get_pointer() { return 0; }
virtual const scv_extensions_if * get_pointer() const { return 0; }
virtual int get_array_size() const { return N; }
virtual scv_extensions_if * get_array_elt(int i) { return this->_get_array_elt(i); }
virtual const scv_extensions_if * get_array_elt(int i) const { return this->_get_array_elt(i); }
virtual int get_bitwidth() const { return get_array_elt(0)->get_bitwidth() * get_array_size(); }
virtual scv_extensions_if * get_parent() { return this->_parent; }
virtual const scv_extensions_if * get_parent() const { return this->_parent; }
};
// ----------------------------------------
// specialization for pointers
// ----------------------------------------
template<typename T>
class scv_extension_type<T*>
: public _SCV_INTROSPECTION_BASE1 {
public:
scv_extension_type() {}
virtual ~scv_extension_type() {}
virtual const char* get_type_name() const {
static const char* s = _scv_ext_util_get_name("%s*",
scv_extensions<T>().get_type_name());
return s;
}
virtual scv_extension_type_if::data_type get_type() const { return scv_extension_type_if::POINTER; }
virtual int get_enum_size() const { return 0; }
virtual void get_enum_details(std::list<const char *>&, std::list<int>&) const {}
virtual const char * get_enum_string(int) const { return "_error"; }
virtual int get_num_fields() const { return 0; }
virtual scv_extensions_if * get_field(unsigned i) { return 0; }
virtual const scv_extensions_if * get_field(unsigned i) const { return 0; }
virtual scv_extensions_if * get_pointer() { return this->_get_pointer(); }
virtual const scv_extensions_if * get_pointer() const { return this->_get_pointer(); }
virtual int get_array_size() const { return 0; }
virtual scv_extensions_if * get_array_elt(int) { return 0; }
virtual const scv_extensions_if * get_array_elt(int) const { return 0; }
virtual int get_bitwidth() const { return sizeof(T*); }
virtual scv_extensions_if * get_parent() { return this->_parent; }
virtual const scv_extensions_if * get_parent() const { return this->_parent; }
};
// ----------------------------------------
// specialization for enums
// ----------------------------------------
class _scv_extension_type_enum
: public _SCV_INTROSPECTION_BASE_ENUM {
public:
_scv_extension_type_enum() {}
virtual ~_scv_extension_type_enum() {}
// implemented in leaf classes
// virtual const char *get_type_name() const;
virtual scv_extension_type_if::data_type get_type() const;
virtual int get_enum_size() const;
virtual void get_enum_details(std::list<const char *>&, std::list<int>&) const;
virtual const char * get_enum_string(int) const;
virtual int get_num_fields() const;
virtual scv_extensions_if * get_field(unsigned);
virtual const scv_extensions_if * get_field(unsigned) const;
virtual scv_extensions_if * get_pointer();
virtual const scv_extensions_if * get_pointer() const;
virtual int get_array_size() const;
virtual scv_extensions_if * get_array_elt(int);
virtual const scv_extensions_if * get_array_elt(int) const;
// implemented in leaf classes
// virtual int get_bitwidth() const;
virtual scv_extensions_if * get_parent() { return this->_parent; }
virtual const scv_extensions_if * get_parent() const { return this->_parent; }
public:
void _set_enum(int e, const char * name) {
_get_names().push_back(name);
_get_values().push_back(e);
}
};
// ----------------------------------------
// specialization for basic types
// ----------------------------------------
#define _SCV_EXT_TYPE_FC_D(type_name,type_id) \
class _scv_extension_type_ ## type_id \
: public scv_extension_util<type_name> { \
public: \
_scv_extension_type_ ## type_id() { } \
virtual ~_scv_extension_type_ ## type_id() { } \
\
virtual int get_enum_size() const; \
virtual void get_enum_details(std::list<const char *>&, std::list<int>&) const; \
virtual const char * get_enum_string(int) const; \
virtual int get_num_fields() const; \
virtual scv_extensions_if * get_field(unsigned); \
virtual const scv_extensions_if * get_field(unsigned) const; \
virtual scv_extensions_if * get_pointer(); \
virtual const scv_extensions_if * get_pointer() const; \
virtual int get_array_size() const; \
virtual scv_extensions_if * get_array_elt(int); \
virtual const scv_extensions_if * get_array_elt(int) const; \
virtual scv_extensions_if * get_parent(); \
virtual const scv_extensions_if * get_parent() const; \
\
virtual const char* get_type_name() const; \
virtual scv_extension_type_if::data_type get_type() const; \
virtual int get_bitwidth() const; \
}; \
\
template<> \
class scv_extension_type<type_name> \
: public _scv_extension_type_ ## type_id { \
public: \
scv_extension_type() {} \
virtual ~scv_extension_type() {} \
}; \
#define _SCV_EXT_TYPE_1_FC_D(type_name,type_id) \
_SCV_EXT_TYPE_FC_D(type_name,type_id) \
#define _SCV_EXT_TYPE_N_FC_D(type_name,id) \
template<int N> \
class scv_extension_type<type_name > \
: public scv_extension_util<type_name > { \
public: \
scv_extension_type() {} \
virtual ~scv_extension_type() {} \
\
virtual int get_enum_size() const { return 0; } \
virtual void get_enum_details(std::list<const char *>&, std::list<int>&) const {} \
virtual const char * get_enum_string(int) const { return "_error"; } \
virtual int get_num_fields() const { return 0; } \
virtual scv_extensions_if * get_field(unsigned) { return 0; } \
virtual const scv_extensions_if * get_field(unsigned) const { return 0; } \
virtual scv_extensions_if * get_pointer() { return 0; } \
virtual const scv_extensions_if * get_pointer() const { return 0; } \
virtual int get_array_size() const { return 0; } \
virtual scv_extensions_if * get_array_elt(int) { return 0; } \
virtual const scv_extensions_if * get_array_elt(int) const { return 0; } \
virtual scv_extensions_if * get_parent() { return this->_parent; } \
virtual const scv_extensions_if * get_parent() const { return this->_parent; } \
\
virtual const char* get_type_name() const { \
static const char* s = _scv_ext_util_get_name("%s<%d>",#type_name, N); \
return s; \
} \
virtual scv_extension_type_if::data_type get_type() const { \
return scv_extensions_if::id; \
} \
virtual int get_bitwidth() const { return N; } \
}; \
#define _SCV_EXT_TYPE_D_FC_D(type_name,type_id) \
class _scv_extension_type_ ## type_id \
: public scv_extension_util<type_name> { \
public: \
_scv_extension_type_ ## type_id(); \
virtual ~_scv_extension_type_ ## type_id(); \
\
virtual int get_enum_size() const; \
virtual void get_enum_details(std::list<const char *>&, std::list<int>&) const; \
virtual const char * get_enum_string(int) const; \
virtual int get_num_fields() const; \
virtual scv_extensions_if * get_field(unsigned); \
virtual const scv_extensions_if * get_field(unsigned) const; \
virtual scv_extensions_if * get_pointer(); \
virtual const scv_extensions_if * get_pointer() const; \
virtual int get_array_size() const; \
virtual scv_extensions_if * get_array_elt(int); \
virtual const scv_extensions_if * get_array_elt(int) const; \
virtual scv_extensions_if * get_parent(); \
virtual const scv_extensions_if * get_parent() const; \
\
virtual const char* get_type_name() const; \
virtual scv_extension_type_if::data_type get_type() const; \
virtual int get_bitwidth() const; \
int _bitwidth; \
}; \
\
template<> \
class scv_extension_type<type_name> \
: public _scv_extension_type_ ## type_id { \
public: \
scv_extension_type() {} \
virtual ~scv_extension_type() {} \
}; \
_SCV_EXT_TYPE_FC_D(bool,bool);
_SCV_EXT_TYPE_FC_D(char,char);
_SCV_EXT_TYPE_FC_D(short,short);
_SCV_EXT_TYPE_FC_D(int,int);
_SCV_EXT_TYPE_FC_D(long,long);
_SCV_EXT_TYPE_FC_D(long long,long_long);
_SCV_EXT_TYPE_FC_D(unsigned char,unsigned_char);
_SCV_EXT_TYPE_FC_D(unsigned short,unsigned_short);
_SCV_EXT_TYPE_FC_D(unsigned int,unsigned_int);
_SCV_EXT_TYPE_FC_D(unsigned long,unsigned_long);
_SCV_EXT_TYPE_FC_D(unsigned long long,unsigned_long_long);
_SCV_EXT_TYPE_FC_D(float,float);
_SCV_EXT_TYPE_FC_D(double,double);
_SCV_EXT_TYPE_FC_D(std::string,string);
#ifdef TEST_NEST_TEMPLATE
_SCV_EXT_TYPE_N_FC_D(test_uint<N>,UNSIGNED);
#endif
#if defined(SYSTEMC_INCLUDED) || defined(IEEE_1666_SYSTEMC)
_SCV_EXT_TYPE_N_FC_D(sc_int<N>,INTEGER);
_SCV_EXT_TYPE_N_FC_D(sc_bigint<N>,INTEGER);
_SCV_EXT_TYPE_N_FC_D(sc_uint<N>,UNSIGNED);
_SCV_EXT_TYPE_N_FC_D(sc_biguint<N>,UNSIGNED);
_SCV_EXT_TYPE_1_FC_D(sc_bit,sc_bit);
_SCV_EXT_TYPE_N_FC_D(sc_bv<N>,BIT_VECTOR);
_SCV_EXT_TYPE_1_FC_D(sc_logic,sc_logic);
_SCV_EXT_TYPE_N_FC_D(sc_lv<N>,LOGIC_VECTOR);
// SCV_EXT_TYPE_N_FC_D(sc_fixed,FIXED_POINTER_INTEGER);
// SCV_EXT_TYPE_N_FC_D(sc_ufixed,UNSIGNED_FIXED_POINTER_INTEGER);
_SCV_EXT_TYPE_D_FC_D(sc_signed,sc_signed);
_SCV_EXT_TYPE_D_FC_D(sc_unsigned,sc_unsigned);
_SCV_EXT_TYPE_D_FC_D(sc_int_base,sc_int_base);
_SCV_EXT_TYPE_D_FC_D(sc_uint_base,sc_uint_base);
_SCV_EXT_TYPE_D_FC_D(sc_lv_base,sc_lv_base);
_SCV_EXT_TYPE_D_FC_D(sc_bv_base,sc_bv_base);
#endif
#undef _SCV_EXT_TYPE_FC_D
#undef _SCV_EXT_TYPE_N_FC_D
#undef _SCV_EXT_TYPE_1_FC_D
// ----------------------------------------
// wrap up this component
// ----------------------------------------
#undef _SCV_INTROSPECTION_BASE
#define _SCV_INTROSPECTION_BASE scv_extension_type<T>
#undef _SCV_INTROSPECTION_BASE1
#define _SCV_INTROSPECTION_BASE1 scv_extension_type<T*>
#undef _SCV_INTROSPECTION_BASE2
#define _SCV_INTROSPECTION_BASE2 scv_extension_type<T[N]>
#undef _SCV_INTROSPECTION_BASE_ENUM
#define _SCV_INTROSPECTION_BASE_ENUM _scv_extension_type_enum
| 37.72043 | 102 | 0.693201 |
d7bf9bfd3d03d0942fe02041565841787b658644 | 4,520 | h | C | src/taesooLib/BaseLib/utility/TUGL.h | jackthgu/K-AR_HYU_Deform_Simulation | e7c275c8948e1fe3e800ab37b17aa8406b147277 | [
"MIT"
] | null | null | null | src/taesooLib/BaseLib/utility/TUGL.h | jackthgu/K-AR_HYU_Deform_Simulation | e7c275c8948e1fe3e800ab37b17aa8406b147277 | [
"MIT"
] | null | null | null | src/taesooLib/BaseLib/utility/TUGL.h | jackthgu/K-AR_HYU_Deform_Simulation | e7c275c8948e1fe3e800ab37b17aa8406b147277 | [
"MIT"
] | null | null | null | #ifndef _TUGL_HPP_
#define _TUGL_HPP_
#pragma once
#include "tugl_impl.h"
namespace TUGL
{
// undirected graph
struct EmptyEdge
{
};
template <class NodeType, class EdgeType>
class edge;
template <class NodeType, class EdgeType=EmptyEdge>
class node
{
public:
// always reference
node_struct* _ptr;
node(): _ptr(NULL){}
node(node_struct* p):_ptr(p){}
int index() const { return _ptr->_index;}
NodeType& data() const { return *((NodeType*)_ptr->_data);}
NodeType* operator->() const { return &data();}
TUGL::edge<NodeType, EdgeType> edge(int index) const;
edge_struct* getEdgePtr(int index) const { return _edge()[index];}
int degree() const { return _edge().size(); }
inline operator node_struct*() { return _ptr;}
friend bool operator==(node const& a, node const& b)
{
return a._ptr==b._ptr;
}
// almost private:
const std::vector<edge_struct*>& _edge() const { return _ptr->_aE;}
};
template <class NodeType, class EdgeType=EmptyEdge>
class edge
{
public:
edge():_ptr(NULL){}
edge(edge_struct* ptr):_ptr(ptr){}
edge_struct* _ptr;
node<NodeType, EdgeType> v1() const { return _ptr->_s;}
node<NodeType, EdgeType> v2() const { return _ptr->_t;}
node<NodeType, EdgeType> target(node<NodeType, EdgeType> v) {return node<NodeType, EdgeType>(_ptr->target(v._ptr)); }
int index() const { return _ptr->_index;}
EdgeType& data() const { return *((EdgeType*)_ptr->_data);}
EdgeType* operator->() const { return &data();}
inline operator edge_struct*() { return _ptr;}
friend bool operator==(edge const& a, edge const& b)
{
return a._ptr==b._ptr;
}
};
template <class NodeType, class EdgeType>
edge<NodeType, EdgeType> node<NodeType, EdgeType>::edge(int index) const
{
TUGL::edge<NodeType, EdgeType> e;
e._ptr=getEdgePtr(index);
return e;
}
/** 가정: 에지나 node가 추가로 생길수는 있지만 중간에 지워지지는 않는다. 그래프 자료구조에서는 상관없지만, node_array나 edge_array의 구현에서 빠른 indexing 속도와 쉬운 구현을 위해 array를 사용했기 때문. 나중에 이 가정을 없앨 필요가 있으면 아마도 interface는 유지한채로 재구현이 가능할 것이다.
*/
template <class NodeType, class EdgeType=EmptyEdge>
class graph {
graph_impl mG;
public:
graph() {}
virtual ~graph() { clear(); }
virtual void clear()
{
for(int i=0; i<mG.m_aV.size(); i++)
{
delete (NodeType*)mG.m_aV[i]->_data;
}
for(int i=0; i<mG.m_aE.size();i++)
{
delete (EdgeType*)mG.m_aE[i]->_data;
}
mG.clear();
}
int numNodes() const { return mG.m_aV.size(); }
int numEdges() const { return mG.m_aE.size(); }
// if you know the number of nodes to be created, please reserve NodeArray for efficiency
void reserveNodeArray(int numNodes) { mG.m_aV.reserve(numNodes);}
void reserveEdgeArray(int numEdges) { mG.m_aE.reserve(numEdges); }
/// 새 노드생성과 edge생성은 반드시 newNode, newEdge를 사용할것.
node<NodeType, EdgeType> newNode()
{ return node<NodeType, EdgeType>(mG.newNode(new NodeType()));}
edge<NodeType, EdgeType> newEdge(node<NodeType, EdgeType> v, node<NodeType, EdgeType> w)
{ return edge<NodeType, EdgeType>(mG.newEdge(v._ptr, w._ptr,new EdgeType()));}
edge<NodeType, EdgeType> findEdge(node<NodeType, EdgeType> v, node<NodeType, EdgeType> w)
{
return edge<NodeType, EdgeType>(mG.findEdge(v._ptr, w._ptr));
}
edge<NodeType, EdgeType> findEdge(int index) const { return edge<NodeType, EdgeType>(mG.edge(index));}
node<NodeType, EdgeType> findNode(int index) const { return node<NodeType, EdgeType>(mG.node(index));}
inline node_struct* getNodePtr(int index) const { return mG.node(index);}
inline edge_struct* getEdgePtr(int index) const { return mG.edge(index);}
};
}// end namespace
#define TUGL_for_all_node TUGL_for_all_nodes
#define TUGL_forall_nodes TUGL_for_all_nodes
#define TUGL_for_all_edge TUGL_for_all_edges
#define TUGL_for_all_nodes(v,g)\
for(int _tugl_i=0; _tugl_i<(g).numNodes() &&((v)._ptr=(g).getNodePtr(_tugl_i))!=NULL; _tugl_i++)
#define TUGL_for_all_edges(e,g)\
for(int _tugl_i=0; _tugl_i<(g).numEdges() && ((e)._ptr=(g).getEdgePtr(_tugl_i))!=NULL; _tugl_i++)
#define TUGL_for_adj_edges(e,v)\
for(int _tugl_i=0; _tugl_i<(v).degree() && ((e)._ptr=(v).getEdgePtr(_tugl_i))!=NULL; _tugl_i++)
/*
forall_adj_nodes(v, w) { ... }
iterates over all nodes v that are adjacent to the node w. In the case of a directed graph, these are all v for which there is an edge (w,v) in the graph. In the undirected case, these are all v for which there is an edge (w,v) or an edge (v,w). */
#define TUGL_forall_adj_nodes(v,w)\
for(int _tugl_i=0; _tugl_i<(w).outdeg() && ((v)._ptr=(w).getOutEdgePtr(0)->_t)!=NULL; _tugl_i++)
#endif
| 30.133333 | 248 | 0.697566 |
ec0238c4a04b37cc2e21f5c19c385c56d9a0293e | 2,102 | h | C | query.h | nmrr/wikiLinking | 80c4b76b89a9d6ada6fa00744c4d879763ed050b | [
"MIT"
] | null | null | null | query.h | nmrr/wikiLinking | 80c4b76b89a9d6ada6fa00744c4d879763ed050b | [
"MIT"
] | null | null | null | query.h | nmrr/wikiLinking | 80c4b76b89a9d6ada6fa00744c4d879763ed050b | [
"MIT"
] | null | null | null | /*
The MIT License (MIT)
Copyright (c) 2016 https://github.com/nmrr
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#ifndef __QUERY_H
#define __QUERY_H
#include <curl/curl.h>
#include <map>
using namespace std;
class Query
{
private :
string wikiURL;
string article;
unsigned int timeout;
string error;
bool success;
string resolution;
string useragent;
public :
Query()
{
}
Query(string wikiURL, string article, string resolution, string useragent, unsigned int timeout=30)
{
newQuery(wikiURL, article, resolution, useragent, timeout);
}
~Query()
{
}
void newQuery(string wikiURL, string article, string resolution, string useragent, unsigned int timeout=30);
string getAddress();
bool getSuccess();
string getFailure();
void getLink(map<string, uint32_t> &linkMap, uint32_t attemptMaximum=5);
private :
static size_t curlCallbackString(void *contents, size_t size, size_t nmemb, void *userp);
bool curlGET(string url, string &output, string &error, string resolution, string useragent, unsigned int timeout);
char hexa(char letter);
string decodeURL(string URL);
};
#endif
| 30.911765 | 460 | 0.769743 |
b9ac83aaf0f1e02935867b8ae3d2913003d828cb | 2,867 | c | C | gnutls/nettle/pkcs1-rsa-sha1.c | TheShellLand/crossover-source | 247b5591f1b059b95553352adb56c45b775c0c24 | [
"MIT"
] | null | null | null | gnutls/nettle/pkcs1-rsa-sha1.c | TheShellLand/crossover-source | 247b5591f1b059b95553352adb56c45b775c0c24 | [
"MIT"
] | null | null | null | gnutls/nettle/pkcs1-rsa-sha1.c | TheShellLand/crossover-source | 247b5591f1b059b95553352adb56c45b775c0c24 | [
"MIT"
] | null | null | null | /* pkcs1-rsa-sha1.c
PKCS stuff for rsa-sha1.
Copyright (C) 2001, 2003 Niels Möller
This file is part of GNU Nettle.
GNU Nettle is free software: you can redistribute it and/or
modify it under the terms of either:
* the GNU Lesser General Public License as published by the Free
Software Foundation; either version 3 of the License, or (at your
option) any later version.
or
* 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.
or both in parallel, as here.
GNU Nettle 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 copies of the GNU General Public License and
the GNU Lesser General Public License along with this program. If
not, see http://www.gnu.org/licenses/.
*/
#if HAVE_CONFIG_H
# include "config.h"
#endif
#include <assert.h>
#include <stdlib.h>
#include <string.h>
#include "rsa.h"
#include "bignum.h"
#include "pkcs1.h"
#include "hogweed-internal.h"
#include "gmp-glue.h"
/* From pkcs-1v2
*
* id-sha1 OBJECT IDENTIFIER ::=
* {iso(1) identified-organization(3) oiw(14) secsig(3)
* algorithms(2) 26}
*
* The default hash function is SHA-1:
* sha1Identifier ::= AlgorithmIdentifier {id-sha1, NULL}
*/
static const uint8_t
sha1_prefix[] =
{
/* 15 octets prefix, 20 octets hash, total 35 */
0x30, 33, /* SEQUENCE */
0x30, 9, /* SEQUENCE */
0x06, 5, /* OBJECT IDENTIFIER */
0x2b, 0x0e, 0x03, 0x02, 0x1a,
0x05, 0, /* NULL */
0x04, 20 /* OCTET STRING */
/* Here comes the raw hash value */
};
int
pkcs1_rsa_sha1_encode(mpz_t m, size_t key_size, struct sha1_ctx *hash)
{
uint8_t *p;
TMP_GMP_DECL(em, uint8_t);
TMP_GMP_ALLOC(em, key_size);
p = _pkcs1_signature_prefix(key_size, em,
sizeof(sha1_prefix),
sha1_prefix,
SHA1_DIGEST_SIZE);
if (p)
{
sha1_digest(hash, SHA1_DIGEST_SIZE, p);
nettle_mpz_set_str_256_u(m, key_size, em);
TMP_GMP_FREE(em);
return 1;
}
else
{
TMP_GMP_FREE(em);
return 0;
}
}
int
pkcs1_rsa_sha1_encode_digest(mpz_t m, size_t key_size, const uint8_t *digest)
{
uint8_t *p;
TMP_GMP_DECL(em, uint8_t);
TMP_GMP_ALLOC(em, key_size);
p = _pkcs1_signature_prefix(key_size, em,
sizeof(sha1_prefix),
sha1_prefix,
SHA1_DIGEST_SIZE);
if (p)
{
memcpy(p, digest, SHA1_DIGEST_SIZE);
nettle_mpz_set_str_256_u(m, key_size, em);
TMP_GMP_FREE(em);
return 1;
}
else
{
TMP_GMP_FREE(em);
return 0;
}
}
| 23.120968 | 77 | 0.651203 |
7e2038cddd6dffc2e99c82f6a2270b0a7440b9ef | 1,667 | h | C | virusCrusader/KSCell.h | object-kazu/Objective-C_samples | 21b3243c6a4b9231aba60c586172a3a5f31b751e | [
"MIT"
] | null | null | null | virusCrusader/KSCell.h | object-kazu/Objective-C_samples | 21b3243c6a4b9231aba60c586172a3a5f31b751e | [
"MIT"
] | null | null | null | virusCrusader/KSCell.h | object-kazu/Objective-C_samples | 21b3243c6a4b9231aba60c586172a3a5f31b751e | [
"MIT"
] | null | null | null | //
// KSCell.h
// virusCrusader
//
// Created by 清水 一征 on 11/06/23.
// Copyright 2011 momiji-mac.com. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface KSCell : UITableViewCell {
UILabel *number;
UILabel *gvValue;
UILabel *rvValue;
UIImageView *level1;
UIImageView *level2;
UIImageView *level3;
UIImageView *level4;
UIImageView *level5;
UILabel *resSValue;
UILabel *resPValue;
UILabel *resKValue;
UILabel *resCValue;
UILabel *resLValue;
UIImageView *cellSelectView;
UIImageView *cellColor;
UIImageView *KinCondition;
UIImageView *CellCondition;
}
@property (nonatomic, retain) IBOutlet UIImageView *KinCondition;
@property (nonatomic, retain) IBOutlet UIImageView *CellCondition;
@property (nonatomic, retain) IBOutlet UILabel *number;
@property (nonatomic, retain) IBOutlet UILabel *gvValue;
@property (nonatomic, retain) IBOutlet UILabel *rvValue;
@property (nonatomic, retain) IBOutlet UIImageView *level1;
@property (nonatomic, retain) IBOutlet UIImageView *level2;
@property (nonatomic, retain) IBOutlet UIImageView *level3;
@property (nonatomic, retain) IBOutlet UIImageView *level4;
@property (nonatomic, retain) IBOutlet UIImageView *level5;
@property (nonatomic, retain) IBOutlet UILabel *resSValue;
@property (nonatomic, retain) IBOutlet UILabel *resPValue;
@property (nonatomic, retain) IBOutlet UILabel *resKValue;
@property (nonatomic, retain) IBOutlet UILabel *resCValue;
@property (nonatomic, retain) IBOutlet UILabel *resLValue;
@property (nonatomic, retain) IBOutlet UIImageView *cellSelectView;
@property (nonatomic, retain) IBOutlet UIImageView *cellColor;
@end
| 32.686275 | 67 | 0.753449 |
beec69511a7e21da8c7a9f6a71a0896566a951b5 | 3,408 | c | C | lib/ipc.c | s3lph/daliserver | 0ca0d3cce770fcbb51fe0ad0f902356fc3b5e6a7 | [
"BSD-2-Clause"
] | 51 | 2015-01-11T08:16:16.000Z | 2022-03-25T05:39:40.000Z | lib/ipc.c | s3lph/daliserver | 0ca0d3cce770fcbb51fe0ad0f902356fc3b5e6a7 | [
"BSD-2-Clause"
] | 24 | 2015-01-05T17:09:12.000Z | 2021-06-27T21:02:54.000Z | lib/ipc.c | s3lph/daliserver | 0ca0d3cce770fcbb51fe0ad0f902356fc3b5e6a7 | [
"BSD-2-Clause"
] | 24 | 2015-01-18T14:42:31.000Z | 2022-02-28T18:57:49.000Z | /* Copyright (c) 2011, onitake <onitake@gmail.com>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> 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 <stdlib.h>
#include <string.h>
#include <errno.h>
#include <unistd.h>
#include <poll.h>
#include <fcntl.h>
#include <stdint.h>
#include <sys/socket.h>
#include "ipc.h"
#include "log.h"
struct Ipc {
int sockets[2];
DispatchPtr dispatch;
};
static void ipc_read_zero(void *arg);
IpcPtr ipc_new() {
IpcPtr ret = malloc(sizeof(struct Ipc));
if (!ret) {
log_error("Error allocating memory for socket pair: %s", strerror(errno));
return NULL;
}
ret->dispatch = NULL;
// SOCK_STREAM delivers data in the same chunks as they were sent, at least on Mach.
// If this is not the case in your OS, SOCK_DGRAM must be used, but this has
// the implication that sockets can't be closed. Termination must be signalled some other way.
if (socketpair(PF_LOCAL, SOCK_STREAM, 0, ret->sockets) == -1) {
log_error("Error creating socket pair: %s", strerror(errno));
return NULL;
}
return ret;
}
void ipc_free(IpcPtr ipc) {
if (ipc) {
if (ipc->dispatch) {
dispatch_remove_fd(ipc->dispatch, ipc_read_socket(ipc));
}
close(ipc->sockets[0]);
close(ipc->sockets[1]);
free(ipc);
}
}
void ipc_register(IpcPtr ipc, DispatchPtr dispatch) {
if (ipc) {
if (ipc->dispatch) {
dispatch_remove_fd(ipc->dispatch, ipc_read_socket(ipc));
}
ipc->dispatch = dispatch;
dispatch_add(ipc->dispatch, ipc_read_socket(ipc), POLLIN, ipc_read_zero, NULL, NULL, ipc);
}
}
void ipc_notify(IpcPtr ipc) {
if (ipc) {
uint8_t dummy = 0;
ssize_t wrbytes = write(ipc_write_socket(ipc), &dummy, sizeof(dummy));
if (wrbytes < 0) {
log_error("Error notifying IPC pipe");
}
}
}
int ipc_read_socket(IpcPtr ipc) {
if (ipc) {
return ipc->sockets[0];
}
return -1;
}
int ipc_write_socket(IpcPtr ipc) {
if (ipc) {
return ipc->sockets[0];
}
return -1;
}
static void ipc_read_zero(void *arg) {
IpcPtr ipc = (IpcPtr) arg;
if (ipc) {
uint8_t dummy = 0;
ssize_t rdbytes = read(ipc_read_socket(ipc), &dummy, sizeof(dummy));
if (rdbytes < 0) {
log_error("Error reading IPC pipe signal");
}
}
}
| 29.37931 | 95 | 0.709507 |
7de0f61f861063c08a425c3bc6e4a22fa7050f6b | 999 | c | C | programowanie-podstawowe/book-excercises/11-9-4.c | kpagacz/software-engineering | 6ac3965848919d7fe7350842ae9d59d65d213ef6 | [
"MIT"
] | 1 | 2022-01-17T07:50:54.000Z | 2022-01-17T07:50:54.000Z | programowanie-podstawowe/book-excercises/11-9-4.c | kpagacz/software-engineering | 6ac3965848919d7fe7350842ae9d59d65d213ef6 | [
"MIT"
] | null | null | null | programowanie-podstawowe/book-excercises/11-9-4.c | kpagacz/software-engineering | 6ac3965848919d7fe7350842ae9d59d65d213ef6 | [
"MIT"
] | 2 | 2021-02-02T18:13:35.000Z | 2021-05-10T13:31:40.000Z | #include<stdio.h>
int solveLinear(int a1, int b1, int c1, int a2, int b2, int c2, double* x1, double* x2) {
int w = a1 * b2 - a2 * b1;
int wx = c1 * b2 - c2 * b1;
int wy = a1 * c2 - a2 * c1;
if(w == 0) {
if(wx == 0 && wy == 0) {
return 0;
} else {
return -1;
}
} else {
*x1 = 1.0 * wx / w;
*x2 = 1.0 * wy / w;
return 1;
}
}
int main(void) {
int a1, b1, a2, b2, c2, c1;
double x, y;
double* x_ptr = &x;
double* y_ptr = &y;
printf("Input integers a1 b1 c1 a2 b2 c2\n");
scanf("%i %i %i %i %i %i", &a1, &b1, &c1, &a2, &b2, &c2);
switch (solveLinear(a1, b1, c1, a2, b2, c2, x_ptr, y_ptr))
{
case -1:
printf("Zero solutions.");
break;
case 0:
printf("Infinetely many solutions.");
break;
case 1:
printf("One solution: x=%lf y=%lf", *x_ptr, *y_ptr);
break;
default:
break;
}
return 0;
} | 21.255319 | 89 | 0.448448 |
478e8bce56e9a28b6e8d88a5cac1b0b4775bf283 | 1,921 | h | C | src/Aura.h | jingai/xiv-sim | 074b86cb6ccd00149c08e89be7c02f1a7c05ed93 | [
"MIT"
] | 9 | 2015-01-27T11:48:28.000Z | 2020-12-02T16:58:13.000Z | src/Aura.h | jingai/xiv-sim | 074b86cb6ccd00149c08e89be7c02f1a7c05ed93 | [
"MIT"
] | 21 | 2015-01-03T08:56:42.000Z | 2016-01-01T13:43:42.000Z | src/Aura.h | ccbrown/xiv-sim | 074b86cb6ccd00149c08e89be7c02f1a7c05ed93 | [
"MIT"
] | 8 | 2015-01-25T04:31:51.000Z | 2017-03-03T17:29:42.000Z | #pragma once
#include "common.h"
#include <chrono>
#include <string>
class Actor;
struct Damage;
class Aura {
public:
Aura(const char* identifier) : _identifier(identifier), _identifierHash(identifier) {}
virtual ~Aura() = default;
FNV1AHash identifierHash() const { return _identifierHash; }
virtual const std::string& identifier() const { return _identifier; }
virtual bool isHidden() const { return false; }
virtual bool isSharedBetweenSources() const { return !tickDamage(); }
virtual std::chrono::microseconds duration() const = 0;
virtual int maximumCount() const { return 1; }
virtual int tickDamage() const { return 0; }
virtual int additionalStrikesPerAutoAttack() const { return 0; }
virtual bool shouldCancel(Actor* actor, Actor* source, int count) const { return false; }
virtual void tick(Actor* actor, Actor* source, int count, bool isCritical) const {}
virtual void afterEffect(Actor* actor, Actor* source, int count) const {}
virtual double mpRegenMultiplier() const { return 1.0; }
virtual double increasedDamage() const { return 0.0; }
virtual double increasedAutoAttackSpeed() const { return 0.0; }
virtual double reducedGlobalCooldown() const { return 0.0; }
virtual double additionalCriticalHitChance() const { return 0.0; }
virtual void transformIncomingDamage(Damage* damage) const {}
virtual bool providesImmunity(const Aura* aura) const { return false; }
struct StatsMultiplier {
double strength = 1.0;
double dexterity = 1.0;
double intelligence = 1.0;
double piety = 1.0;
double skillSpeed = 1.0;
double spellSpeed = 1.0;
double criticalHitRate = 1.0;
double determination = 1.0;
};
virtual const StatsMultiplier& statsMultiplier() const { return _statsMultiplier; }
protected:
StatsMultiplier _statsMultiplier;
private:
const std::string _identifier;
const FNV1AHash _identifierHash;
}; | 30.015625 | 91 | 0.723581 |
f19b6ae4bbf8f977b801f484005e92cbeabb62c5 | 8,005 | h | C | ObitSystem/Obit/include/ObitFArrayClassDef.h | sarrvesh/Obit | e4ce6029e9beb2a8c0316ee81ea710b66b2b7986 | [
"Linux-OpenIB"
] | 5 | 2019-08-26T06:53:08.000Z | 2020-10-20T01:08:59.000Z | ObitSystem/Obit/include/ObitFArrayClassDef.h | sarrvesh/Obit | e4ce6029e9beb2a8c0316ee81ea710b66b2b7986 | [
"Linux-OpenIB"
] | null | null | null | ObitSystem/Obit/include/ObitFArrayClassDef.h | sarrvesh/Obit | e4ce6029e9beb2a8c0316ee81ea710b66b2b7986 | [
"Linux-OpenIB"
] | 8 | 2017-08-29T15:12:32.000Z | 2022-03-31T12:16:08.000Z | /* $Id$ */
/*--------------------------------------------------------------------*/
/*; Copyright (C) 2002-2018 */
/*; Associated Universities, Inc. Washington DC, USA. */
/*; This program is free software; you can redistribute it and/or */
/*; modify it under the terms of the GNU General Public License as */
/*; published by the Free Software Foundation; either version 2 of */
/*; the License, or (at your option) any later version. */
/*; */
/*; This program is distributed in the hope that it will be useful, */
/*; but WITHOUT ANY WARRANTY; without even the implied warranty of */
/*; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
/*; GNU General Public License for more details. */
/*; */
/*; You should have received a copy of the GNU General Public */
/*; License along with this program; if not, write to the Free */
/*; Software Foundation, Inc., 675 Massachusetts Ave, Cambridge, */
/*; MA 02139, USA. */
/*; */
/*;Correspondence about this software should be addressed as follows: */
/*; Internet email: bcotton@nrao.edu. */
/*; Postal address: William Cotton */
/*; National Radio Astronomy Observatory */
/*; 520 Edgemont Road */
/*; Charlottesville, VA 22903-2475 USA */
/*--------------------------------------------------------------------*/
/* Define the basic components of the ObitUV ClassInfo structure */
/* This is intended to be included in a classInfo structure definition*/
#include "ObitClassDef.h" /* Parent class ClassInfo definition file */
/** Function pointer to Constructor. */
ObitFArrayCreateFP ObitFArrayCreate;
/** Function pointer to subarray constructor. */
ObitFArraySubArrFP ObitFArraySubArr;
/** Function pointer to transpose constructor. */
ObitFArrayTransposeFP ObitFArrayTranspose;
/** Function pointer to compatability checker. */
ObitFArrayIsCompatableFP ObitFArrayIsCompatable;
/** Function pointer to reallocate structures. */
ObitFArrayReallocFP ObitFArrayRealloc;
/** Function pointer to return index. */
ObitFArrayIndexFP ObitFArrayIndex;
/** Function pointer to find maximum. */
ObitFArrayMaxFP ObitFArrayMax;
/** Function pointer to find maximum abs. value. */
ObitFArrayMaxAbsFP ObitFArrayMaxAbs;
/** Function pointer to find minimum. */
ObitFArrayMinFP ObitFArrayMin;
/** Function pointer to deblank. */
ObitFArrayDeblankFP ObitFArrayDeblank;
/** Function pointer to find RMS of pixel distribution from histogram.*/
ObitFArrayRMSFP ObitFArrayRMS;
/** Function pointer to find RMS of pixel distribution.*/
ObitFArrayRawRMSFP ObitFArrayRawRMS;
/** Function pointer to find RMS about zero*/
ObitFArrayRMS0FP ObitFArrayRMS0;
/** Function pointer to find RMS with possible quantization */
ObitFArrayRMSQuantFP ObitFArrayRMSQuant;
/** Function pointer to find Mode of pixel distribution.*/
ObitFArrayModeFP ObitFArrayMode;
/** Function pointer to find Mean of pixel distribution */
ObitFArrayMeanFP ObitFArrayMean;
/** Function pointer to fill elements of an FArray */
ObitFArrayFillFP ObitFArrayFill;
/** Function pointer to negate elements of an FArray */
ObitFArrayNegFP ObitFArrayNeg;
/** Function pointer to taks abs value of elements of an FArray */
ObitFArrayAbsFP ObitFArrayAbs;
/** Function pointer to sine of elements of an FArray */
ObitFArraySinFP ObitFArraySin;
/** Function pointer to cosine of elements of an FArray */
ObitFArrayCosFP ObitFArrayCos;
/** Function pointer to sine/cosine of elements of an FArray */
ObitFArraySinCosFP ObitFArraySinCos;
/** Function pointer to square root of elements of an FArray */
ObitFArrayCosFP ObitFArraySqrt;
/** Function pointer to sum elements of an FArray */
ObitFArraySumFP ObitFArraySum;
/** Function pointer to number of valid elements in an FArray */
ObitFArrayCountFP ObitFArrayCount;
/** Function pointer to Add a scalar to elements of an FArray */
ObitFArraySAddFP ObitFArraySAdd;
/** Function pointer to Multiply elements of an FArray by a scalar*/
ObitFArraySMulFP ObitFArraySMul;
/** Function pointer to divide elements of an FArray into a scalar*/
ObitFArraySDivFP ObitFArraySDiv;
/** Function pointer to Clip elements of an FArray outside of a given range */
ObitFArrayClipFP ObitFArrayClip;
/** Function pointer to Clip elements of an FArray inside of a given range */
ObitFArrayInClipFP ObitFArrayInClip;
/** Function pointer to Blank elements of an array where another is blanked */
ObitFArrayBlankFP ObitFArrayBlank;
/** Function pointer to get larger elements of two FArrays */
ObitFArrayMaxArrFP ObitFArrayMaxArr;
/** Function pointer to get lesser elements of two FArrays */
ObitFArrayMinArrFP ObitFArrayMinArr;
/** Function pointer to get more extreme elements of two FArrays */
ObitFArrayExtArrFP ObitFArrayExtArr;
/** Function pointer to Add nonblanked elements of two FArrays */
ObitFArraySumArrFP ObitFArraySumArr;
/** Function pointer to average nonblanked elements of two FArrays */
ObitFArrayAvgArrFP ObitFArrayAvgArr;
/** Function pointer to Add elements of two FArrays */
ObitFArrayAddFP ObitFArrayAdd;
/** Function pointer to Abs Add elements of two FArrays */
ObitFArrayAddAbsFP ObitFArrayAddAbs;
/** Function pointer to Copy elements from one FArray to another */
ObitFArrayCopyDataFP ObitFArrayCopyData;
/** Function pointer to Subtract elements of two FArrays */
ObitFArraySubFP ObitFArraySub;
/** Function pointer to Give the elements of one array the sign of the other */
ObitFArraySignFP ObitFArraySign;
/** Function pointer to Multiply elements of two FArrays */
ObitFArrayMulFP ObitFArrayMul;
/** Function pointer to Divide elements of two FArrays */
ObitFArrayDivFP ObitFArrayDiv;
/** Function pointer to Divide elements of two FArrays with clipping */
ObitFArrayDivClipFP ObitFArrayDivClip;
/** Function pointer to "dot" product of two FArrays */
ObitFArrayDotFP ObitFArrayDot;
/** Function pointer to multiple 2D by row, col vector */
ObitFArrayMulColRowFP ObitFArrayMulColRow;
/** Function pointer to determine quantization */
ObitFArrayQuantFP ObitFArrayQuant;
/** Function pointer to Convert a 1D "center at edges" array to proper order */
ObitFArray1DCenterFP ObitFArray1DCenter;
/** Function pointer to Convert a 2D "center at edges" array to proper order */
ObitFArray2DCenterFP ObitFArray2DCenter;
/** Function pointer to inplace invert a symmetric 2D array */
ObitFArray2DSymInvFP ObitFArray2DSymInv;
/** Function pointer to Make 2-D Circular Gaussian */
ObitFArray2DCGaussFP ObitFArray2DCGauss;
/** Function pointer to Make 2-D Elliptical Gaussian */
ObitFArray2DCGaussFP ObitFArray2DEGauss;
/** Function pointer to Shift and Add scaled array */
ObitFArrayShiftAddFP ObitFArrayShiftAdd;
/** Function pointer to Zero pad an array */
ObitFArrayPadFP ObitFArrayPad;
/** Function pointer to Convolve a list of Gaussians onto an FArray */
ObitFArrayConvGausFP ObitFArrayConvGaus;
/** Function pointer to Select elements in an FArray by increment */
ObitFArraySelIncFP ObitFArraySelInc;
/** Function pointer to return histogram of elements in an FArray */
ObitFArrayHistoFP ObitFArrayHisto;
/** Function pointer to exponentiate an FArray */
ObitFArrayExpFP ObitFArrayExp;
/** Function pointer to natural logrithm of an FArray */
ObitFArrayLogFP ObitFArrayLog;
/** Function pointer to x^y of FArrays */
ObitFArrayPowFP ObitFArrayPow;
/** Function pointer to Gaussian distributed random number */
ObitFArrayRandomFP ObitFArrayRandom;
/** Function pointer to fill with Gaussian distributed random numbers */
ObitFArrayRandomFillFP ObitFArrayRandomFill;
| 51.980519 | 81 | 0.713429 |
f1a8d1f115e5ba3d23cdd9ba2c1d1b7103ae206a | 2,394 | h | C | drivers/inc/stm32f407xx_gpio_driver.h | rostislav-nikitin/edu.mcu.stm32xx.drivers | 522aad9ede298fdcf8fc9f4c85e83792ead0d829 | [
"MIT"
] | null | null | null | drivers/inc/stm32f407xx_gpio_driver.h | rostislav-nikitin/edu.mcu.stm32xx.drivers | 522aad9ede298fdcf8fc9f4c85e83792ead0d829 | [
"MIT"
] | null | null | null | drivers/inc/stm32f407xx_gpio_driver.h | rostislav-nikitin/edu.mcu.stm32xx.drivers | 522aad9ede298fdcf8fc9f4c85e83792ead0d829 | [
"MIT"
] | null | null | null | /*
* stm32f407xx_gpio_driver.h
*
* Created on: Aug 27, 2020
* Author: s0lid
*/
#include <stdint.h>
#include "stm32f407xx.h"
#ifndef INC_STM32F407XX_GPIO_DRIVER_H_
#define INC_STM32F407XX_GPIO_DRIVER_H_
typedef struct
{
uint8_t GPIO_PinNumber; /*<! Possible values from @GPIO_PIN_NO >*/
uint8_t GPIO_PinMode; /*<! Possible values from @GPIO_MODE >*/
uint8_t GPIO_PinSpeed; /*<! Possible values from @GPIO_SPEED >*/
uint8_t GPIO_PinPuPdControl;
uint8_t GPIO_PinOPType;
uint8_t GPIO_PinAltFunMode;
} GPIO_PinConfig_t;
typedef struct
{
GPIO_RegDef_t *pGPIOx;
GPIO_PinConfig_t GPIO_PinConfig;
} GPIO_Handle_t;
/*
* @GPIO_PIN_NO
* GPIO Pin Number
*/
#define GPIO_PIN_NO_0 0
#define GPIO_PIN_NO_1 1
#define GPIO_PIN_NO_2 2
#define GPIO_PIN_NO_3 3
#define GPIO_PIN_NO_4 4
#define GPIO_PIN_NO_5 5
#define GPIO_PIN_NO_6 6
#define GPIO_PIN_NO_7 7
#define GPIO_PIN_NO_8 8
#define GPIO_PIN_NO_9 9
#define GPIO_PIN_NO_10 10
#define GPIO_PIN_NO_11 11
#define GPIO_PIN_NO_12 12
#define GPIO_PIN_NO_13 13
#define GPIO_PIN_NO_14 14
#define GPIO_PIN_NO_15 15
/*
* @GPIO_MODE
* GPIO possbile modes
*/
#define GPIO_MODE_IN 0
#define GPIO_MODE_OUT 1
#define GPIO_MODE_ALTFN 2
#define GPIO_MODE_ANALOG 3
#define GPIO_MODE_IT_FT 4
#define GPIO_MODE_IT_RT 5
#define GPIO_MODE_IT_RFT 6
// GPIO output types (Push-Pull/Open-Drain)
#define GPIO_OP_TYPE_PP 0
#define GPIO_OP_TYPE_OD 1
/*
* @GPIO_SPEED
* GPIO output speed
*/
#define GPIO_SPEED_LOW 0
#define GPIO_SPEED_MEDIUM 1
#define GPIO_SPEED_FAST 2
#define GPIO_SPEED_HIGH 3
// GPIO pin pull-up pull-down
#define GPIO_NO_PUPD 0
#define GPIO_PIN_PU 1
#define GPIO_PIN_PD 2
/*
* API
*/
void GPIO_PeriClockControl(GPIO_RegDef_t *pGIOx, uint8_t EnOrDi);
void GPIO_Init(GPIO_Handle_t *pGPIOHandle);
void GPIO_DeInit(GPIO_RegDef_t *pGIOx);
uint8_t GPIO_ReadFromInputPin(GPIO_RegDef_t *pGIOx, uint8_t pinNumber);
uint16_t GPIO_ReadFromInputPort(GPIO_RegDef_t *pGIOx);
void GPIO_WriteToOutputPin(GPIO_RegDef_t *pGIOx, uint8_t pinNumber, uint8_t value);
void GPIO_WriteToOutputPort(GPIO_RegDef_t *pGIOx, uint16_t value);
void GPIO_ToggleOutputPin(GPIO_RegDef_t *pGIOx, uint8_t pinNumber);
void GPIO_IRQInterruptConfig(uint8_t irqNumber, uint8_t EnOrDi);
void GPIO_IRQPriorityConfig(uint8_t irqNumber, uint32_t irqPriority);
void GPIO_IRQHandling(uint8_t pinNumber);
#endif /* INC_STM32F407XX_GPIO_DRIVER_H_ */
| 22.166667 | 83 | 0.789474 |
4a8239293b36c5f4156bf454ab4e601de80ba356 | 856 | h | C | WSLoginSDK/WSLoginSDK/impl/WSLoginDef.h | SammyLan/WSPods | c4b418f34157f60994dd1a297a023bd9ac5f6f91 | [
"MIT"
] | null | null | null | WSLoginSDK/WSLoginSDK/impl/WSLoginDef.h | SammyLan/WSPods | c4b418f34157f60994dd1a297a023bd9ac5f6f91 | [
"MIT"
] | null | null | null | WSLoginSDK/WSLoginSDK/impl/WSLoginDef.h | SammyLan/WSPods | c4b418f34157f60994dd1a297a023bd9ac5f6f91 | [
"MIT"
] | null | null | null | //
// WSLoginDef.h
// WSLoginSDK
//
// Created by 蓝秀文 on 2018/12/30.
// Copyright © 2018 蓝秀文. All rights reserved.
//
#ifndef WSLoginDef_h
#define WSLoginDef_h
#pragma mark - SINGLETON
#define DECL_SINGLETON(className) +(className *) sharedInstance
#define IMPL_SINGLETON(className) +(className *) sharedInstance{ \
static className *sharedInstance = nil; \
static dispatch_once_t onceToken; \
dispatch_once(&onceToken, ^{ \
sharedInstance = [[className alloc] init]; \
}); \
return sharedInstance; \
}
#define KStringID(x) x
#endif /* WSLoginDef_h */
| 31.703704 | 77 | 0.473131 |
0102baa9bd5ff549559fffce80f29d44b820837a | 1,271 | h | C | include/junos/driver.h | menqgingyu/JunOS-V0.5 | a2227042d0a3133abcfbb674c332598d8db7215e | [
"MIT"
] | 1 | 2018-03-04T03:01:56.000Z | 2018-03-04T03:01:56.000Z | include/junos/driver.h | menqgingyu/JunOS-V0.5 | a2227042d0a3133abcfbb674c332598d8db7215e | [
"MIT"
] | null | null | null | include/junos/driver.h | menqgingyu/JunOS-V0.5 | a2227042d0a3133abcfbb674c332598d8db7215e | [
"MIT"
] | null | null | null | /*
* junos/driver.h -- kernel driver interface.
*
* This file is part of JunOS Operating System.
*
* Copyright (C) 2016, Liu Xiaofeng <lxf.junos@aliyun.com>
* Licensed under MIT, http://opensource.org/licenses/MIT.
*/
#ifndef _JUNOS_DRIVER_H
#define _JUNOS_DRIVER_H
#define DEV(major,minor) (((major<<8)&0xff00) |((minor)&0xff))
#define MAJOR(dev) (((dev)>>8)&0xff)
#define MINOR(dev) ((dev)&0xff)
#define DEV_CHAR_MAX 3
#define DEV_CHAR_MEM 1
#define DEV_CHAR_TTY 2
#define DEV_BLK_MAX 3
#define DEV_BLK_RAMDISK 1
#define DEV_BLK_FLOPPY 2
#define DEV_BLK_ATAPI 3
#define ROOT_DEV DEV(DEV_BLK_RAMDISK,0)
struct char_device {
char *name;
int (*open)(dev_t dev);
int (*close)(dev_t dev);
int (*read)(dev_t dev, char *buf, off_t off,size_t size);
int (*write)(dev_t dev, char *buf, off_t off,size_t size);
int (*ioctl)(dev_t dev, int cmd, long arg);
};
struct block_device {
char *name;
int (*open)(dev_t dev);
int (*close)(dev_t dev);
void (*read)(struct buffer *buffer);
void (*write)(struct buffer *buffer);
int (*ioctl)(dev_t dev, int cmd, long arg);
};
extern struct char_device *char_table[];
extern struct block_device *blk_table[];
#endif /* _JUNOS_DRIVER_H */
| 25.42 | 63 | 0.66247 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.