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
735951f2be8daf8671e129618226aafcd795a2cd
1,226
h
C
src/bin/fl/draw_graph.h
mfernan2/VossII
e1c1142c9c94255995c13efe2e1b7af4ae03f2e2
[ "Apache-2.0" ]
20
2020-01-27T13:14:34.000Z
2022-03-23T17:39:14.000Z
src/bin/fl/draw_graph.h
mfernan2/VossII
e1c1142c9c94255995c13efe2e1b7af4ae03f2e2
[ "Apache-2.0" ]
6
2020-02-03T13:48:15.000Z
2021-03-02T14:24:50.000Z
src/bin/fl/draw_graph.h
mfernan2/VossII
e1c1142c9c94255995c13efe2e1b7af4ae03f2e2
[ "Apache-2.0" ]
6
2020-01-28T14:42:13.000Z
2021-02-15T20:39:40.000Z
//------------------------------------------------------------------- // Copyright 2020 Carl-Johan Seger // SPDX-License-Identifier: Apache-2.0 //------------------------------------------------------------------- /******************************************************************** * * * Original author: Carl-Johan Seger 2017 * * * ********************************************************************/ /* draw_graph.h -- Definitions for draw_graph.c */ #ifdef EXPORT_FORWARD_DECL /* --- Forward declarations that need to be exported to earlier .h files --- */ void Draw_Graph_Install_Functions(); /* ----- Function prototypes for public functions ----- */ bool draw_graphs(g_ptr *nodes, int depth, bool display_address); void GR(g_ptr node); void GRl(g_ptr node, int max_depth); #else /* EXPORT_FORWARD_DECL */ /* ----------------------- Main include file ------------------------------- */ #ifndef DRAW_GRAPH_H #define DRAW_GRAPH_H #include "fl.h" /* Global data types and include files */ #endif /* DRAW_GRAPH_H */ #endif /* EXPORT_FORWARD_DECL */
38.3125
79
0.424144
7397611339684829233ffc1c8411711794f9e79c
2,111
h
C
aws-cpp-sdk-textract/include/aws/textract/model/QueriesConfig.h
Nexuscompute/aws-sdk-cpp
e7ef485e46e6962c9e084b8c9b104c1bfcceaf26
[ "Apache-2.0" ]
1
2022-01-05T18:20:03.000Z
2022-01-05T18:20:03.000Z
aws-cpp-sdk-textract/include/aws/textract/model/QueriesConfig.h
Nexuscompute/aws-sdk-cpp
e7ef485e46e6962c9e084b8c9b104c1bfcceaf26
[ "Apache-2.0" ]
null
null
null
aws-cpp-sdk-textract/include/aws/textract/model/QueriesConfig.h
Nexuscompute/aws-sdk-cpp
e7ef485e46e6962c9e084b8c9b104c1bfcceaf26
[ "Apache-2.0" ]
1
2021-11-09T11:58:03.000Z
2021-11-09T11:58:03.000Z
/** * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. * SPDX-License-Identifier: Apache-2.0. */ #pragma once #include <aws/textract/Textract_EXPORTS.h> #include <aws/core/utils/memory/stl/AWSVector.h> #include <aws/textract/model/Query.h> #include <utility> namespace Aws { namespace Utils { namespace Json { class JsonValue; class JsonView; } // namespace Json } // namespace Utils namespace Textract { namespace Model { /** * <p/><p><h3>See Also:</h3> <a * href="http://docs.aws.amazon.com/goto/WebAPI/textract-2018-06-27/QueriesConfig">AWS * API Reference</a></p> */ class AWS_TEXTRACT_API QueriesConfig { public: QueriesConfig(); QueriesConfig(Aws::Utils::Json::JsonView jsonValue); QueriesConfig& operator=(Aws::Utils::Json::JsonView jsonValue); Aws::Utils::Json::JsonValue Jsonize() const; /** * <p/> */ inline const Aws::Vector<Query>& GetQueries() const{ return m_queries; } /** * <p/> */ inline bool QueriesHasBeenSet() const { return m_queriesHasBeenSet; } /** * <p/> */ inline void SetQueries(const Aws::Vector<Query>& value) { m_queriesHasBeenSet = true; m_queries = value; } /** * <p/> */ inline void SetQueries(Aws::Vector<Query>&& value) { m_queriesHasBeenSet = true; m_queries = std::move(value); } /** * <p/> */ inline QueriesConfig& WithQueries(const Aws::Vector<Query>& value) { SetQueries(value); return *this;} /** * <p/> */ inline QueriesConfig& WithQueries(Aws::Vector<Query>&& value) { SetQueries(std::move(value)); return *this;} /** * <p/> */ inline QueriesConfig& AddQueries(const Query& value) { m_queriesHasBeenSet = true; m_queries.push_back(value); return *this; } /** * <p/> */ inline QueriesConfig& AddQueries(Query&& value) { m_queriesHasBeenSet = true; m_queries.push_back(std::move(value)); return *this; } private: Aws::Vector<Query> m_queries; bool m_queriesHasBeenSet; }; } // namespace Model } // namespace Textract } // namespace Aws
23.455556
136
0.637613
71532cef8649742d649406dbb275e54f35d01d92
1,407
h
C
Source/Test/CNetHttpsClient.h
antmuse/AntNet
71819fa576af642fa0490c34e10321e80a31c1bc
[ "MIT" ]
4
2018-01-20T11:12:58.000Z
2021-04-20T03:32:00.000Z
Source/Test/CNetHttpsClient.h
antmuse/AntNet
71819fa576af642fa0490c34e10321e80a31c1bc
[ "MIT" ]
null
null
null
Source/Test/CNetHttpsClient.h
antmuse/AntNet
71819fa576af642fa0490c34e10321e80a31c1bc
[ "MIT" ]
null
null
null
#ifndef APP_CNETHTTPSCLIENT_H #define APP_CNETHTTPSCLIENT_H #include "CTlsContext.h" #include "AppList.h" #include "INetEventer.h" namespace app { namespace net { class CNetServiceTCP; //echo client class CNetHttpsClient : public INetEventer { public: CNetHttpsClient(); virtual ~CNetHttpsClient(); INetEventer* getTlsEvent() { return &mTlsCtx; } void setHubHost(CNetServiceTCP* hub, const s8* iHost) { mTlsCtx.setHubHost(hub, iHost); } virtual INetEventer* onAccept(const CNetAddress& local)override { return nullptr; } virtual s32 onConnect(u32 sessionID, const CNetAddress& local, const CNetAddress& remote)override; virtual s32 onDisconnect(u32 sessionID, const CNetAddress& local, const CNetAddress& remote)override; virtual s32 onSend(u32 sessionID, void* buffer, s32 size, s32 result)override; virtual s32 onReceive(const CNetAddress& remote, u32 sessionID, void* buffer, s32 size)override; virtual s32 onLink(u32 sessionID, const CNetAddress& local, const CNetAddress& remote)override; virtual s32 onTimeout(u32 sessionID, const CNetAddress& local, const CNetAddress& remote)override; s32 send(const void* buf, s32 len); private: CNetPacket mPacket; CTlsContext mTlsCtx; }; }//namespace net }//namespace app #endif //APP_CNETHTTPSCLIENT_H
26.54717
106
0.707889
addc2d59a65446c2d5a8ce98b991e808604407a9
1,086
h
C
history.h
rexroni/weechat-voipms
a3f24a8b6e408ce97c2c92efa4b7c540cf1c9e92
[ "Unlicense" ]
2
2019-01-14T01:04:05.000Z
2020-11-27T23:30:58.000Z
history.h
rexroni/weechat-voipms
a3f24a8b6e408ce97c2c92efa4b7c540cf1c9e92
[ "Unlicense" ]
1
2019-01-14T01:04:02.000Z
2019-01-18T00:52:29.000Z
history.h
rexroni/weechat-voipms
a3f24a8b6e408ce97c2c92efa4b7c540cf1c9e92
[ "Unlicense" ]
null
null
null
#ifndef HISTORY_H #define HISTORY_H #include <stdbool.h> // we are going to do a quick-and-easy (malloc-heavy) design here // per-buffer history, (file name) typedef struct hist_buf_t { // filename is of format "<sip_uri>name" char* filename; char* sip_uri; char* name; struct hist_buf_t* next; } hist_buf_t; // per-message history, (file contents) typedef struct hist_msg_t { // messages of format "epochtime:[0|1]:msg_len:msg_bytes\n" time_t time; bool me; char* msg; size_t len; struct hist_msg_t* next; } hist_msg_t; void free_hist_buf(hist_buf_t *hist); void free_hist_msg(hist_msg_t *msg); // get a linked list of all the available buffer history files int list_hist_bufs(const char* wc_dir, hist_buf_t **out); // get a linked list of messages from a history file int get_hist_msg(const char* wc_dir, const char* fname, hist_msg_t **out); // add a message to the history int hist_add_msg(const char* wc_dir, const char* sip_uri, const char* name, const char* msg, size_t msg_len, bool me); #endif // HISTORY_H
26.487805
75
0.706262
4232ac2b1b362c6d8a6c8fe9309c56ffe0c1ea92
234
h
C
aStarScene.h
ArrowManga/first_project
39352a8d93ff7da6c71bf9743d09ed91dcae1511
[ "MIT" ]
1
2018-09-15T12:00:01.000Z
2018-09-15T12:00:01.000Z
aStarScene.h
ArrowManga/first_project
39352a8d93ff7da6c71bf9743d09ed91dcae1511
[ "MIT" ]
null
null
null
aStarScene.h
ArrowManga/first_project
39352a8d93ff7da6c71bf9743d09ed91dcae1511
[ "MIT" ]
null
null
null
#pragma once #include "gameNode.h" #include "aStarTest.h" class aStarScene : public gameNode { private: aStarTest* _ast; public: aStarScene(); ~aStarScene(); HRESULT init(); void release(); void update(); void render(); };
11.7
34
0.683761
098671b9c0698894d7aa766dd78abc8892aa6b2d
2,196
h
C
src/linefinder/linefinder.h
Elrohil44/upm
74ef838a7483418540b1087fc28f827e716e6a6f
[ "MIT" ]
3
2017-06-11T00:20:09.000Z
2019-03-11T01:41:47.000Z
src/linefinder/linefinder.h
Elrohil44/upm
74ef838a7483418540b1087fc28f827e716e6a6f
[ "MIT" ]
1
2018-11-13T18:03:56.000Z
2018-11-14T18:17:57.000Z
src/linefinder/linefinder.h
Elrohil44/upm
74ef838a7483418540b1087fc28f827e716e6a6f
[ "MIT" ]
6
2017-06-07T17:46:22.000Z
2018-05-23T03:03:02.000Z
/* * Author: Jon Trulson <jtrulson@ics.com> * Copyright (c) 2016 Intel Corporation. * * 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. */ #pragma once #include <stdlib.h> #include <stdio.h> #include <upm.h> #include <mraa/gpio.h> #ifdef __cplusplus extern "C" { #endif /** * Device context */ typedef struct _linefinder_context { mraa_gpio_context gpio; } *linefinder_context; /** * Line Finder inititialization * * @param pin Digital pin to use * @return device context */ linefinder_context linefinder_init(int pin); /** * LineFinder close * * @param Device context */ void linefinder_close(linefinder_context dev); /** * Determines whether white has been detected * * @param Device context * @return True if white is detected */ bool linefinder_white_detected(const linefinder_context dev); /** * Determines whether black has been detected * * @param Device context * @return True if black is detected */ bool linefinder_black_detected(const linefinder_context dev); #ifdef __cplusplus } #endif
28.153846
73
0.700364
710ab375187ab677484b46d2224b0abee57deacf
691
h
C
Classes/AIDelegate.h
shenkevin/FlameDragon
02f86da70f1429410160ce55ebbeb3e9c59631d3
[ "MIT" ]
1
2022-02-26T04:56:40.000Z
2022-02-26T04:56:40.000Z
Classes/AIDelegate.h
shenkevin/FlameDragon
02f86da70f1429410160ce55ebbeb3e9c59631d3
[ "MIT" ]
null
null
null
Classes/AIDelegate.h
shenkevin/FlameDragon
02f86da70f1429410160ce55ebbeb3e9c59631d3
[ "MIT" ]
null
null
null
// // AIDelegate.h // FlameDragon // // Created by sui toney on 11-12-13. // Copyright 2011 ms. All rights reserved. // #import "cocos2d.h" #import "FDCreature.h" #import "ActionLayers.h" #import "DistanceResolver.h" @interface AIDelegate : NSObject { DistanceResolver *disResolver; FDCreature *creature; ActionLayers *layers; } -(id) initWithCreature:(FDCreature *)c Layers:(ActionLayers *)layers; -(void) initDistanceResolver; -(CGPoint) generatePos:(CGPoint)targetPos; //-(CGPoint) generatePos:(CGPoint)targetPos forAttack:(BOOL)attackOnly; -(void) setParameter:(id)param; -(void) takeAction; -(FDCreature *) findTarget; -(BOOL) needAndCanRecover; -(void) selfRecover; @end
20.323529
71
0.732272
51ad26292ec481bcdff2253c630ff440324d1b9e
372
c
C
Archivos/Ejemplos/Lectura_Por_Caracter/Lectura_Carac.c
memo0p2/Programas-C
6464dd1ddc55256920e604e649c30576e4907cf8
[ "MIT" ]
1
2018-10-23T02:17:48.000Z
2018-10-23T02:17:48.000Z
Archivos/Ejemplos/Lectura_Por_Caracter/Lectura_Carac.c
memo0p2/Programas-C
6464dd1ddc55256920e604e649c30576e4907cf8
[ "MIT" ]
null
null
null
Archivos/Ejemplos/Lectura_Por_Caracter/Lectura_Carac.c
memo0p2/Programas-C
6464dd1ddc55256920e604e649c30576e4907cf8
[ "MIT" ]
null
null
null
//Lectura caracter por caracter //Autor:Ramirez Olvera Guillermo //fecha:22/10/2018 #include<stdio.h> int main(){ char c; puts("Ingreso de texto desde un archivo con read"); FILE *ent; ent=fopen("prueba.txt","r"); if(ent==NULL){ puts("No se puede leer el archivo"); return 1; } while(fread(&c,sizeof c,1,ent)>0){ putchar(c); } return 0; }
19.578947
53
0.63172
863eaf33b9f0baa6f0afb3e6eaf475ef54a5d520
540
c
C
HackerEarth/Algorithms/special_shop.c
ukayaj620/cp-solution
9871c753f17b6af612d4c7a9045afe079e30de86
[ "Apache-2.0" ]
1
2021-01-30T07:48:30.000Z
2021-01-30T07:48:30.000Z
HackerEarth/Algorithms/special_shop.c
FXLJA/cp-solution
29030838a66cddc594280e3c813252877a1afc7b
[ "Apache-2.0" ]
1
2021-07-12T11:31:11.000Z
2021-07-12T11:31:11.000Z
HackerEarth/Algorithms/special_shop.c
FXLJA/cp-solution
29030838a66cddc594280e3c813252877a1afc7b
[ "Apache-2.0" ]
6
2020-12-20T14:31:30.000Z
2021-07-16T04:09:35.000Z
#include <stdio.h> #include <math.h> #define ll long long int ll findMinimumCost(ll n, ll a, ll b) { ll average = (b * n) / (a + b); ll firstAttempt = a * pow(average, 2) + b * pow((n-average), 2); average += 1; ll secondAttempt = a * pow(average, 2) + b * pow((n-average), 2); return firstAttempt < secondAttempt ? firstAttempt : secondAttempt; } int main() { ll T, n, a, b; scanf("%lld", &T); while(T--) { scanf("%lld%lld%lld", &n, &a, &b); printf("%lld\n", findMinimumCost(n, a, b)); } return 0; }
19.285714
69
0.566667
ab80e66bb6e28b717d0cc4b06f155b88080c9e63
1,502
h
C
include/votca/csg/beadlist.h
Pallavi-Banerjee21/votca.csg
d88977b0bec6159b567871d8901f990120a6f2e4
[ "Apache-2.0" ]
null
null
null
include/votca/csg/beadlist.h
Pallavi-Banerjee21/votca.csg
d88977b0bec6159b567871d8901f990120a6f2e4
[ "Apache-2.0" ]
null
null
null
include/votca/csg/beadlist.h
Pallavi-Banerjee21/votca.csg
d88977b0bec6159b567871d8901f990120a6f2e4
[ "Apache-2.0" ]
null
null
null
/* * Copyright 2009-2011 The VOTCA Development Team (http://www.votca.org) * * 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 _BEADLIST_H #define _BEADLIST_H #include <string> #include <list> #include "topology.h" namespace votca { namespace csg { using namespace votca::tools; using namespace std; /** \brief Generate lists of beads This class generates a list of beads based on some criteria, currently only the bead type. */ class BeadList : public list<Bead *> { public: BeadList() {}; ~BeadList() {} /// \brief Select all beads of type <select> int Generate(Topology &top, const string &select); /// \brief Select all beads of type <select> withn a radius <radius> of reference vector <ref> int GenerateInSphericalSubvolume(Topology &top, const string &select, vec ref, double radius); Topology *getTopology() {return _topology; } private: Topology *_topology; }; }} #endif /* _BEADLIST_H */
24.622951
99
0.698402
61cb91224680053dff4eccb4d1369af21e8ad1d6
23,631
h
C
src/rsyn/phy/obj/impl/PhysicalDesign.h
rsyn/rsyn.design
99dc1241ef523c416be2617c7c7bdd3eec15413f
[ "Apache-2.0" ]
null
null
null
src/rsyn/phy/obj/impl/PhysicalDesign.h
rsyn/rsyn.design
99dc1241ef523c416be2617c7c7bdd3eec15413f
[ "Apache-2.0" ]
null
null
null
src/rsyn/phy/obj/impl/PhysicalDesign.h
rsyn/rsyn.design
99dc1241ef523c416be2617c7c7bdd3eec15413f
[ "Apache-2.0" ]
null
null
null
/* Copyright 2014-2017 Rsyn * * 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. */ /* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ namespace Rsyn { // ----------------------------------------------------------------------------- inline void PhysicalDesign::setClockNet(Rsyn::Net net) { data->clsClkNet = net; } // end method // ----------------------------------------------------------------------------- inline DBU PhysicalDesign::getDatabaseUnits(const DBUType type) const { return data->clsDBUs[type]; } // end method // ----------------------------------------------------------------------------- inline DBUxy PhysicalDesign::getHPWL() const { return data->clsHPWL; } // end method // ----------------------------------------------------------------------------- inline DBU PhysicalDesign::getHPWL(const Dimension dim) const { return data->clsHPWL[dim]; }// end method // ----------------------------------------------------------------------------- inline int PhysicalDesign::getNumElements(PhysicalType type) const { return data->clsNumElements[type]; } // end method // ----------------------------------------------------------------------------- inline DBU PhysicalDesign::getArea(const PhysicalType type) const { return data->clsTotalAreas[type]; } // end method // ----------------------------------------------------------------------------- inline bool PhysicalDesign::isEnablePhysicalPins() const { return data->clsEnablePhysicalPins; } // end method // ----------------------------------------------------------------------------- inline bool PhysicalDesign::isEnableMergeRectangles() const { return data->clsEnableMergeRectangles; } // end method // ----------------------------------------------------------------------------- inline bool PhysicalDesign::isEnableNetPinBoundaries() const { return data->clsEnableNetPinBoundaries; } // end method // ----------------------------------------------------------------------------- inline void PhysicalDesign::addPhysicalPin() { std::cout << "TODO " << __func__ << "\n"; } // end method // ----------------------------------------------------------------------------- inline Rsyn::PhysicalLayer PhysicalDesign::getPhysicalLayerByName(const std::string & layerName) { std::unordered_map<std::string, std::size_t>::iterator element = data->clsMapPhysicalLayers.find(layerName); if (element == data->clsMapPhysicalLayers.end()) return nullptr; const int id = element->second; Element<PhysicalLayerData> * phLayerDataElement = data->clsPhysicalLayers.get(id); return PhysicalLayer(&phLayerDataElement->value); } // end method // ----------------------------------------------------------------------------- inline Rsyn::PhysicalSite PhysicalDesign::getPhysicalSiteByName(const std::string & siteName) { std::unordered_map<std::string, int>::iterator it = data->clsMapPhysicalSites.find(siteName); return it != data->clsMapPhysicalSites.end() ? data->clsPhysicalSites[it->second] : nullptr; } // end method // ----------------------------------------------------------------------------- inline Rsyn::PhysicalRegion PhysicalDesign::getPhysicalRegionByName(const std::string &siteName) { std::unordered_map<std::string, std::size_t>::iterator it = data->clsMapPhysicalRegions.find(siteName); if (it == data->clsMapPhysicalRegions.end()) return nullptr; return data->clsPhysicalRegions[it->second]; } // end method // ----------------------------------------------------------------------------- inline Rsyn::PhysicalGroup PhysicalDesign::getPhysicalGroupByName(const std::string &siteName) { std::unordered_map<std::string, std::size_t>::iterator it = data->clsMapPhysicalGroups.find(siteName); if (it == data->clsMapPhysicalGroups.end()) return nullptr; return data->clsPhysicalGroups[it->second]; } // end method // ----------------------------------------------------------------------------- inline Rsyn::PhysicalVia PhysicalDesign::getPhysicalViaByName(const std::string &viaName) { std::unordered_map<std::string, std::size_t>::iterator it = data->clsMapPhysicalVias.find(viaName); if (it == data->clsMapPhysicalVias.end()) return nullptr; return data->clsPhysicalVias[it->second]; } // end method // ----------------------------------------------------------------------------- inline int PhysicalDesign::getNumLayers(const Rsyn::PhysicalLayerType type) const { return data->clsNumLayers[type]; } // end method // ----------------------------------------------------------------------------- inline int PhysicalDesign::getNumLayers() const { return data->clsPhysicalLayers.size(); } // end method // ----------------------------------------------------------------------------- inline Range<ListCollection<PhysicalLayerData, PhysicalLayer>> PhysicalDesign::allPhysicalLayers() { return ListCollection<PhysicalLayerData, PhysicalLayer>(data->clsPhysicalLayers); } // end method // ----------------------------------------------------------------------------- inline std::size_t PhysicalDesign::getNumPhysicalVias() const { return data->clsPhysicalVias.size(); } // end method // ----------------------------------------------------------------------------- inline const std::vector<PhysicalVia> & PhysicalDesign::allPhysicalVias() const { return data->clsPhysicalVias; } // end method // ----------------------------------------------------------------------------- inline std::size_t PhysicalDesign::getNumPhysicalTracks()const { return data->clsPhysicalTracks.size(); } // end method // ----------------------------------------------------------------------------- inline const std::vector<PhysicalTrack> & PhysicalDesign::allPhysicalTracks() const { return data->clsPhysicalTracks; } // end method // ----------------------------------------------------------------------------- inline std::size_t PhysicalDesign::getNumPhysicalSpacing() const { return data->clsPhysicalSpacing.size(); } // end method // ----------------------------------------------------------------------------- inline Range<ListCollection<PhysicalSpacingData, PhysicalSpacing>> PhysicalDesign::allPhysicalSpacing() const { return ListCollection<PhysicalSpacingData, PhysicalSpacing>(data->clsPhysicalSpacing); } // end method // ----------------------------------------------------------------------------- inline std::size_t PhysicalDesign::getNumPhysicalRegions() const { return data->clsPhysicalRegions.size(); } // end method // ----------------------------------------------------------------------------- inline std::vector<PhysicalRegion> & PhysicalDesign::allPhysicalRegions() const { return data->clsPhysicalRegions; } // end method // ----------------------------------------------------------------------------- inline std::size_t PhysicalDesign::getNumPhysicalGroups() const { return data->clsPhysicalGroups.size(); } // end method // ----------------------------------------------------------------------------- inline std::vector<PhysicalGroup> & PhysicalDesign::allPhysicalGroups() const { return data->clsPhysicalGroups; } // end method // ----------------------------------------------------------------------------- inline std::vector<PhysicalSpecialNet> & PhysicalDesign::allPhysicalSpecialNets() const { return data->clsPhysicalSpecialNets; } // end method // ----------------------------------------------------------------------------- //I'm assuming all rows have the same height. inline DBU PhysicalDesign::getRowHeight() const { return data->clsPhysicalRows.get(0)->value.getHeight(); } // end method // ----------------------------------------------------------------------------- inline DBU PhysicalDesign::getRowSiteWidth() const { return data->clsPhysicalRows.get(0)->value.clsPhysicalSite.getWidth(); } // end method // ----------------------------------------------------------------------------- inline std::size_t PhysicalDesign::getNumRows() const { return data->clsPhysicalRows.size(); } // end method // ----------------------------------------------------------------------------- inline Range<ListCollection<PhysicalRowData, PhysicalRow>> PhysicalDesign::allPhysicalRows() { return ListCollection<PhysicalRowData, PhysicalRow>(data->clsPhysicalRows); } // end method // ----------------------------------------------------------------------------- inline Rsyn::PhysicalLibraryPin PhysicalDesign::getPhysicalLibraryPin(Rsyn::LibraryPin libPin) const { return PhysicalLibraryPin(&data->clsPhysicalLibraryPins[libPin]); } // end method // ----------------------------------------------------------------------------- inline Rsyn::PhysicalLibraryPin PhysicalDesign::getPhysicalLibraryPin(Rsyn::Pin pin) const { if (pin.getInstanceType() != Rsyn::CELL) return nullptr; return PhysicalLibraryPin(&data->clsPhysicalLibraryPins[pin.getLibraryPin()]); } // end method // ----------------------------------------------------------------------------- inline Rsyn::PhysicalLibraryCell PhysicalDesign::getPhysicalLibraryCell(Rsyn::Cell cell) const { Rsyn::LibraryCell libCell = cell.getLibraryCell(); return PhysicalLibraryCell(&data->clsPhysicalLibraryCells[libCell]); } // end method // ----------------------------------------------------------------------------- inline Rsyn::PhysicalLibraryCell PhysicalDesign::getPhysicalLibraryCell(Rsyn::LibraryCell libCell) const { return PhysicalLibraryCell(&data->clsPhysicalLibraryCells[libCell]); } // end method // ----------------------------------------------------------------------------- inline Rsyn::PhysicalCell PhysicalDesign::getPhysicalCell(Rsyn::Cell cell) const { return PhysicalCell(&data->clsPhysicalInstances[cell]); } // end method // ----------------------------------------------------------------------------- inline Rsyn::PhysicalCell PhysicalDesign::getPhysicalCell(Rsyn::Pin pin) const { Rsyn::Instance instance = pin.getInstance(); return getPhysicalCell(instance.asCell()); } // end method // ----------------------------------------------------------------------------- inline Rsyn::PhysicalInstance PhysicalDesign::getPhysicalInstance(Rsyn::Instance instance) const { return PhysicalInstance(&data->clsPhysicalInstances[instance]); } // end method // ----------------------------------------------------------------------------- inline Rsyn::PhysicalInstance PhysicalDesign::getPhysicalInstance(Rsyn::Pin pin) const { return getPhysicalInstance(pin.getInstance()); } // end method // ----------------------------------------------------------------------------- inline Rsyn::PhysicalPort PhysicalDesign::getPhysicalPort(Rsyn::Port port) const { return PhysicalPort(&data->clsPhysicalInstances[port]); } // end method // ----------------------------------------------------------------------------- inline Rsyn::PhysicalPort PhysicalDesign::getPhysicalPort(Rsyn::Pin pin) const { Rsyn::Instance instance = pin.getInstance(); return getPhysicalPort(instance.asPort()); } // end method // ----------------------------------------------------------------------------- inline Rsyn::PhysicalModule PhysicalDesign::getPhysicalModule(Rsyn::Module module) const { return PhysicalModule(&data->clsPhysicalInstances[module]); } // end method // ----------------------------------------------------------------------------- inline int PhysicalDesign::getNumMovedCells() const { int count = 0; for (Rsyn::Instance instance : data->clsModule.allInstances()) { if (instance.getType() != Rsyn::CELL) continue; Rsyn::Cell cell = instance.asCell(); // TODO: hack, assuming that the instance is a cell Rsyn::PhysicalCell phCell = getPhysicalCell(cell); if (instance.isFixed() || instance.isMacroBlock()) continue; const DBUxy initialPos = phCell.getInitialPosition(); const DBUxy currentPos = phCell.getPosition(); if (initialPos[X] != currentPos[X] || initialPos[Y] != initialPos[Y]) count++; } // end for return count; } // end method // ----------------------------------------------------------------------------- inline Rsyn::PhysicalModule PhysicalDesign::getPhysicalModule(Rsyn::Pin pin) const { Rsyn::Instance instance = pin.getInstance(); return getPhysicalModule(instance.asModule()); } // end method // ----------------------------------------------------------------------------- inline Rsyn::PhysicalDie PhysicalDesign::getPhysicalDie() const { return PhysicalDie(&data->clsPhysicalDie); } // end method // ----------------------------------------------------------------------------- inline Rsyn::PhysicalPin PhysicalDesign::getPhysicalPin(Rsyn::Pin pin) const { if (!data->clsEnablePhysicalPins) return nullptr; return PhysicalPin(&data->clsPhysicalPins[pin]); } // end method // ----------------------------------------------------------------------------- inline DBUxy PhysicalDesign::getPinDisplacement(Rsyn::Pin pin) const { Rsyn::Instance inst = pin.getInstance(); if (inst.getType() == Rsyn::CELL) { Rsyn::LibraryPin libPin = pin.getLibraryPin(); DBUxy displacement = data->clsPhysicalLibraryPins[libPin].clsLayerBound.computeCenter(); return displacement; } // end if return DBUxy(0, 0); } // end method // ----------------------------------------------------------------------------- inline DBUxy PhysicalDesign::getPinPosition(Rsyn::Pin pin) const { // Position may be defined if the instance has info. // I'm assuming the instance doesn't know what is its position. DBUxy pos; Rsyn::InstanceType type = pin.getInstanceType(); switch (type) { case Rsyn::CELL: pos = getPhysicalCell(pin).getPosition(); break; case Rsyn::MODULE: pos = getPhysicalModule(pin).getPosition(); break; case Rsyn::PORT: pos = getPhysicalPort(pin).getPosition(); break; default: pos.apply(std::numeric_limits<DBU>::infinity()); std::cout << "WARNING: Position for " << pin.getFullName() << " was not defined for the instance type\n"; } // end switch return pos + getPinDisplacement(pin); } // end method // ----------------------------------------------------------------------------- // For pins of standard-cells, returns the cell position. For macro-blocks, // returns the pin position itself. inline DBUxy PhysicalDesign::getRelaxedPinPosition(Rsyn::Pin pin) const { // Position may be defined if the instance has info. // I'm assuming the instance doesn't know what is its position. DBUxy pos; Rsyn::InstanceType type = pin.getInstanceType(); Rsyn::PhysicalCell phCell; switch (type) { case Rsyn::CELL: phCell = getPhysicalCell(pin); pos = phCell.getPosition(); if (pin.isMacroBlockPin()) pos += getPinDisplacement(pin); break; case Rsyn::MODULE: pos = getPhysicalModule(pin).getPosition(); pos += getPinDisplacement(pin); break; case Rsyn::PORT: pos = getPhysicalPort(pin).getPosition(); pos += getPinDisplacement(pin); break; default: pos.apply(std::numeric_limits<DBU>::infinity()); std::cout << "WARNING: Position for " << pin.getFullName() << " was not defined for the instance type\n"; } // end switch return pos; } // end method // ----------------------------------------------------------------------------- inline DBU PhysicalDesign::getPinDisplacement(Rsyn::Pin pin, const Dimension dim) const { DBUxy disp = getPinDisplacement(pin); return disp[dim]; } // end method // ----------------------------------------------------------------------------- inline DBU PhysicalDesign::getPinPosition(Rsyn::Pin pin, const Dimension dim) const { DBUxy pos = getPinPosition(pin); return pos[dim]; } // end method // ----------------------------------------------------------------------------- inline Rsyn::PhysicalNet PhysicalDesign::getPhysicalNet(Rsyn::Net net) const { return PhysicalNet(&data->clsPhysicalNets[net]); } // end method // ----------------------------------------------------------------------------- inline PhysicalIndex PhysicalDesign::getId(Rsyn::PhysicalRow phRow) const { return phRow->id; } // end method // ----------------------------------------------------------------------------- inline PhysicalIndex PhysicalDesign::getId(Rsyn::PhysicalLayer phLayer) const { return phLayer->id; } // end method // ----------------------------------------------------------------------------- inline PhysicalIndex PhysicalDesign::getId(Rsyn::PhysicalSpacing spacing) const { return spacing->id; } // end method // ----------------------------------------------------------------------------- //////////////////////////////////////////////////////////////////////////////// // Misc //////////////////////////////////////////////////////////////////////////////// inline PhysicalAttributeInitializer PhysicalDesign::createPhysicalAttribute() { return PhysicalAttributeInitializer(*this); } // end method // ----------------------------------------------------------------------------- template<typename DefaultPhysicalValueType> inline PhysicalAttributeInitializerWithDefaultValue<DefaultPhysicalValueType> PhysicalDesign::createPhysicalAttribute(const DefaultPhysicalValueType &defaultValue) { return PhysicalAttributeInitializerWithDefaultValue<DefaultPhysicalValueType>(*this, defaultValue); } // end method // ----------------------------------------------------------------------------- // Caution when using dontNotifyObservers. // We can use it when you may expect the move to be rolled back, but it is // not, recall to mark the cell as dirty. inline void PhysicalDesign::placeCell(Rsyn::PhysicalCell physicalCell, const DBU x, const DBU y, const bool dontNotifyObservers) { DBUxy previousPos = physicalCell.getPosition(); const double preivousX = physicalCell.getCoordinate(LOWER, X); const double preivousY = physicalCell.getCoordinate(LOWER, Y); const bool moved = (x != physicalCell.getPosition(X)) || (y != physicalCell.getPosition(Y)); // Notify observers. if (moved) for (auto f : data->clsPhysicalObservers[PHYSICAL_EVENT_PRE_INSTANCE_MOVED]) f->onPreMovedInstance(physicalCell.getInstance()); physicalCell->clsBounds.moveTo(x, y); // Notify observers. if (moved) { for (auto f : data->clsPhysicalObservers[PHYSICAL_EVENT_POS_INSTANCE_MOVED]) { f->onPostMovedInstance(physicalCell); } // end for } // end if // TODO REMOVE // Only notify observers if the instance actually moved. We noted that many // times the cell end up in the exactly same position. if (!dontNotifyObservers) { if (preivousX != physicalCell.getCoordinate(LOWER, X) || preivousY != physicalCell.getCoordinate(LOWER, Y)) { // Notify observers... for (auto &f : data->callbackPostInstanceMoved) std::get<1>(f) (physicalCell); } // end if } // end if } // end method // ----------------------------------------------------------------------------- inline void PhysicalDesign::placeCell(Rsyn::Cell cell, const DBU x, const DBU y, const bool dontNotifyObservers) { placeCell(getPhysicalCell(cell), x, y, dontNotifyObservers); } // end method // ----------------------------------------------------------------------------- inline void PhysicalDesign::placeCell(Rsyn::PhysicalCell physicalCell, const DBUxy pos, const bool dontNotifyObservers) { placeCell(physicalCell, pos[X], pos[Y], dontNotifyObservers); } // end method // ----------------------------------------------------------------------------- inline void PhysicalDesign::placeCell(Rsyn::Cell cell, const DBUxy pos, const bool dontNotifyObservers) { placeCell(getPhysicalCell(cell), pos[X], pos[Y], dontNotifyObservers); } // end method // ----------------------------------------------------------------------------- inline void PhysicalDesign::notifyObservers(Rsyn::PhysicalInstance instance) { // Notify observers... for (auto &f : data->callbackPostInstanceMoved) std::get<1>(f) (instance); } // end method // ----------------------------------------------------------------------------- inline void PhysicalDesign::notifyObservers(Rsyn::PhysicalInstance instance, const PostInstanceMovedCallbackHandler &ignoreObserver) { // Notify observers... for (PostInstanceMovedCallbackHandler it = data->callbackPostInstanceMoved.begin(); it != data->callbackPostInstanceMoved.end(); it++) { if (it != ignoreObserver) { std::get<1>(*it)(instance); } // end if } // end for } // end method // ----------------------------------------------------------------------------- inline PhysicalDesign::PostInstanceMovedCallbackHandler PhysicalDesign::addPostInstanceMovedCallback(const int priority, PostInstanceMovedCallback f) { // We want to compare only the first element of the tuple. The default // comparator tries to compare all elements. auto comparator = []( const std::tuple<int, PhysicalDesign::PostInstanceMovedCallback> &left, const std::tuple<int, PhysicalDesign::PostInstanceMovedCallback> &right ) -> bool { return std::get<0>(left) < std::get<0>(right); }; data->callbackPostInstanceMoved.push_back(std::make_tuple(priority, f)); PhysicalDesign::PostInstanceMovedCallbackHandler handler = std::prev( data->callbackPostInstanceMoved.end()); data->callbackPostInstanceMoved.sort(comparator); return handler; } // end method //////////////////////////////////////////////////////////////////////////////// // Events //////////////////////////////////////////////////////////////////////////////// template<class T> inline void PhysicalDesign::registerObserver(T *observer) { static_assert(std::is_base_of<PhysicalObserver, T>::value, "Unable to register class as observer. " "The observer class must inherit from Rsyn::PhysicalObserver."); observer->PhysicalObserver::clsPhDesign = PhysicalDesign(data); // Check if the observer implements (overwrites) the event callbacks if so // register it to receive notifications of the respective event. if (typeid (&PhysicalObserver::onPhysicalDesignDestruction) != typeid (&T::onPhysicalDesignDestruction)) { data->clsPhysicalObservers[PHYSICAL_EVENT_DESTRUCTION].push_back(observer); } // end if if (typeid (&PhysicalObserver::onPostCellRemap) != typeid (&T::onPostCellRemap)) { data->clsPhysicalObservers[PHYSICAL_EVENT_CELL_REMAP].push_back(observer); } // end if if (typeid (&PhysicalObserver::onPostMovedInstance) != typeid (&T::onPostMovedInstance)) { data->clsPhysicalObservers[PHYSICAL_EVENT_POS_INSTANCE_MOVED].push_back(observer); } // end if if (typeid (&PhysicalObserver::onPreMovedInstance) != typeid (&T::onPreMovedInstance)) { data->clsPhysicalObservers[PHYSICAL_EVENT_PRE_INSTANCE_MOVED].push_back(observer); } // end if } // end method // ----------------------------------------------------------------------------- inline void PhysicalDesign::unregisterObserver(PhysicalObserver *observer) { for (int i = 0; i < NUM_PHYSICAL_EVENTS; i++) { data->clsPhysicalObservers[i].remove(observer); } // end for observer->PhysicalObserver::clsPhDesign = nullptr; } // end method } // end namespace
37.628981
134
0.568448
610b5af9d7744659a3c9aad1da814d9daaf3eeec
18,973
c
C
src/kbkdf.c
Zontec/embedCrypto
229242db4f18a429ddb01ce86a3c0be28b35d46a
[ "MIT" ]
3
2021-07-26T17:07:34.000Z
2021-10-04T12:00:20.000Z
src/kbkdf.c
polina-krukovich/mbedCrypto
229242db4f18a429ddb01ce86a3c0be28b35d46a
[ "MIT" ]
9
2021-09-21T14:15:27.000Z
2021-09-21T15:42:41.000Z
src/kbkdf.c
polina-krukovich/mbedCrypto
229242db4f18a429ddb01ce86a3c0be28b35d46a
[ "MIT" ]
2
2021-09-01T15:48:30.000Z
2021-09-01T16:51:43.000Z
/****************************INFORMATION*********************************** * Copyright (c) 2021 Zontec * Email: dehibeo@gmail.com * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: **************************************************************************/ /*! * @file kbkdf.c * @brief File contains KBKDF implementation. * @author Zontec * @version 1.1 * @date 2021.07.04 */ #include "kbkdf.h" #define HMAC_MAX_OUTPUT (64) #define BITS_IN_BYTE (8) #define RLEN (4) // RLEN is limited with uint32_t type #ifndef BIT_MASK_LEFT static uint8_t _bit_mask_left[] = { 0, 0x80, 0x80 + 0x40, 0x80 + 0x40 + 0x20, 0x80 + 0x40 + 0x20 + 0x10, 0x80 + 0x40 + 0x20 + 0x10 + 0x08, 0x80 + 0x40 + 0x20 + 0x10 + 0x08 + 0x04, 0x80 + 0x40 + 0x20 + 0x10 + 0x08 + 0x04 + 0x02, 0x80 + 0x40 + 0x20 + 0x10 + 0x08 + 0x04 + 0x02 + 0x01, }; #define BIT_MASK_LEFT(n) (_bit_mask_left[n]) #endif #ifndef BIT_MASK_RIGHT static uint8_t _bit_mask_right[] = { 0, 0x01, 0x02 + 0x01, 0x04 + 0x02 + 0x01, 0x08 + 0x04 + 0x02 + 0x01, 0x10 + 0x08 + 0x04 + 0x02 + 0x01, 0x20 + 0x10 + 0x08 + 0x04 + 0x02 + 0x01, 0x40 + 0x20 + 0x10 + 0x08 + 0x04 + 0x02 + 0x01, 0x80 + 0x40 + 0x20 + 0x10 + 0x08 + 0x04 + 0x02 + 0x01, }; #define BIT_MASK_RIGHT(n) (_bit_mask_right[n]) #endif static uint32_t kbkdf_hash_size[] = { 32, //KBKDF_HASH_TYPE_SHA384 48, //KBKDF_HASH_TYPE_SHA384 64 //KBKDF_HASH_TYPE_SHA512 }; static void _shift_array_right(uint8_t *array, uint32_t length, uint32_t shift, uint8_t carry) // 1 <= shift <= 7 { uint8_t temp; for (uint32_t i = 0; i < length; i++) { temp = array[i]; // save the value array[i] = (array[i] >> shift) | carry; // update the array element carry = temp << (8 - shift); // compute the new carry } } static uint32_t _kbkdf_counter(void *ctx, kbkdf_hash_type_e hash_type, kbkdf_hmac_callbacks_t hmac_callbacks, const uint8_t *key_in, const uint32_t key_in_len, uint8_t *fixed_input, const uint32_t fixed_input_len, uint8_t *key_out, const uint32_t key_out_len, kbkdf_opts_t *opts) { SECURITY_FUNCTION_BEGIN; hmac_init_t hmac_init = hmac_callbacks.hmac_init; hmac_update_t hmac_update = hmac_callbacks.hmac_update; hmac_final_t hmac_final = hmac_callbacks.hmac_final; uint32_t hmac_size; uint32_t full_blocks; uint32_t leftover; uint32_t modulo; uint32_t rpos; uint32_t rpos_fixed; uint8_t rpos_modulo; uint8_t *key_out_last; uint8_t ctr[RLEN + 1]; if (opts->ctr_rlen > RLEN) { SECURITY_FUNCTION_RET_VAR = SECURITY_STATUS_FAIL; goto SECURITY_FUNCTION_EXIT; } hmac_size = kbkdf_hash_size[hash_type]; rpos_modulo = opts->ctr_rpos % 8; rpos = opts->ctr_rpos / 8; rpos_fixed = rpos + ((rpos_modulo > 0) ? 1 : 0); modulo = ((key_out_len % 8) > 1) ? 1 : 0; full_blocks = ((key_out_len / 8) + modulo) / hmac_size; leftover = ((key_out_len / 8) + modulo) % hmac_size; key_out_last = key_out; for (uint32_t i = 1; i <= full_blocks; ++i, key_out += hmac_size) { PUT_UINT32_BE(i, ctr, 0); ctr[4] = 0; SECURITY_CHECK_RES(hmac_init(ctx, key_in, key_in_len)); if (rpos > 0) { SECURITY_CHECK_RES(hmac_update(ctx, fixed_input, rpos)); } if (opts->ctr_rlen > 0) { if (rpos_modulo > 0) { _shift_array_right(ctr + (RLEN - opts->ctr_rlen), opts->ctr_rlen + 1, rpos_modulo, (fixed_input[rpos] & BIT_MASK_LEFT(rpos_modulo))); ctr[4] |= fixed_input[rpos] & BIT_MASK_RIGHT(8 - rpos_modulo); } SECURITY_CHECK_RES(hmac_update(ctx, ctr + (RLEN - opts->ctr_rlen), opts->ctr_rlen + ((rpos_modulo > 0) ? 1 : 0))); } if ((rpos_fixed != fixed_input_len) && (SECURITY_FUNCTION_RET_VAR = hmac_update(ctx, fixed_input + rpos_fixed, fixed_input_len - rpos_fixed) != SECURITY_STATUS_OK)) { goto SECURITY_FUNCTION_EXIT; } SECURITY_CHECK_RES(hmac_final(ctx, key_out)); key_out_last = key_out; } if (leftover) { uint8_t last_block[HMAC_MAX_OUTPUT]; PUT_UINT32_BE(full_blocks + 1, ctr, 0); ctr[4] = 0; SECURITY_CHECK_RES(hmac_init(ctx, key_in, key_in_len)); if (rpos > 0) { SECURITY_CHECK_RES(hmac_update(ctx, fixed_input, rpos)); } if (opts->ctr_rlen > 0) { if (rpos_modulo > 0) { _shift_array_right(ctr + (RLEN - opts->ctr_rlen), opts->ctr_rlen + 1, rpos_modulo, (fixed_input[rpos] & BIT_MASK_LEFT(rpos_modulo))); ctr[4] |= fixed_input[rpos] & BIT_MASK_RIGHT(8 - rpos_modulo); } SECURITY_CHECK_RES(hmac_update(ctx, ctr + (RLEN - opts->ctr_rlen), opts->ctr_rlen + ((rpos_modulo > 0) ? 1 : 0))); } if ((rpos_fixed != fixed_input_len) && (SECURITY_FUNCTION_RET_VAR = hmac_update(ctx, fixed_input + rpos_fixed, fixed_input_len - rpos_fixed) != SECURITY_STATUS_OK)) { goto SECURITY_FUNCTION_EXIT; } SECURITY_CHECK_RES(hmac_final(ctx, last_block)); SECURITY_CHECK_VALID_NOT_NULL(memcpy(key_out, last_block, leftover)); SECURITY_CHECK_VALID_NOT_NULL(memset(last_block, 0xFF, HMAC_MAX_OUTPUT)); if (modulo) { key_out[leftover - 1] &= BIT_MASK_LEFT(key_out_len % 8); } } else { if (modulo) { key_out_last[hmac_size - 1] &= BIT_MASK_LEFT(key_out_len % 8); } } SECURITY_FUNCTION_EXIT: SECURITY_FUNCTION_RETURN; } static uint32_t _kbkdf_feedback(void *ctx, kbkdf_hash_type_e hash_type, kbkdf_hmac_callbacks_t hmac_callbacks, const uint8_t *key_in, const uint32_t key_in_len, const uint8_t *iv_in, const uint32_t iv_in_len, uint8_t *fixed_input, const uint32_t fixed_input_len, uint8_t *key_out, const uint32_t key_out_len, kbkdf_opts_t *opts) { SECURITY_FUNCTION_BEGIN; hmac_init_t hmac_init = hmac_callbacks.hmac_init; hmac_update_t hmac_update = hmac_callbacks.hmac_update; hmac_final_t hmac_final = hmac_callbacks.hmac_final; const uint8_t *k_i_1 = iv_in; uint32_t k_i_1_len = 0; uint32_t hmac_size; uint32_t full_blocks; uint32_t leftover; uint32_t modulo; uint8_t ctr[RLEN + 1]; uint8_t *key_out_last; if (opts->ctr_rlen > RLEN) { SECURITY_FUNCTION_RET_VAR = SECURITY_STATUS_FAIL; goto SECURITY_FUNCTION_EXIT; } hmac_size = kbkdf_hash_size[hash_type]; modulo = ((key_out_len % 8) > 1) ? 1 : 0; full_blocks = ((key_out_len / 8) + modulo) / hmac_size; leftover = ((key_out_len / 8) + modulo) % hmac_size; key_out_last = key_out; if (iv_in_len > 0) { k_i_1_len = iv_in_len; } for (uint32_t i = 1; i <= full_blocks; ++i, key_out += hmac_size) { PUT_UINT32_BE(i, ctr, 0); ctr[4] = 0; SECURITY_CHECK_RES(hmac_init(ctx, key_in, key_in_len)); if ((opts->ctr_rpos == -1) && (opts->ctr_rlen > 0)) { SECURITY_CHECK_RES(hmac_update(ctx, ctr + (RLEN - opts->ctr_rlen), opts->ctr_rlen)); } if ((k_i_1_len > 0) && (SECURITY_FUNCTION_RET_VAR = hmac_update(ctx, k_i_1, k_i_1_len) != SECURITY_STATUS_OK)) { goto SECURITY_FUNCTION_EXIT; } if ((opts->ctr_rpos == 0) && (opts->ctr_rlen > 0)) { SECURITY_CHECK_RES(hmac_update(ctx, ctr + (RLEN - opts->ctr_rlen), opts->ctr_rlen)); } if ((opts->ctr_rpos > 0) && (opts->ctr_rlen > 0)) { SECURITY_CHECK_RES(hmac_update(ctx, fixed_input, opts->ctr_rpos / 8)); SECURITY_CHECK_RES(hmac_update(ctx, ctr + (RLEN - opts->ctr_rlen), opts->ctr_rlen)); if ((opts->ctr_rpos != (int64_t)fixed_input_len) && (SECURITY_FUNCTION_RET_VAR = hmac_update(ctx, fixed_input + opts->ctr_rpos / 8, fixed_input_len - opts->ctr_rpos / 8) != SECURITY_STATUS_OK)) { goto SECURITY_FUNCTION_EXIT; } } else { SECURITY_CHECK_RES(hmac_update(ctx, fixed_input, fixed_input_len)); } SECURITY_CHECK_RES(hmac_final(ctx, key_out)); k_i_1 = key_out; k_i_1_len = hmac_size; key_out_last = key_out; } if (leftover) { uint8_t last_block[HMAC_MAX_OUTPUT]; PUT_UINT32_BE(full_blocks + 1, ctr, 0); ctr[4] = 0; SECURITY_CHECK_RES(hmac_init(ctx, key_in, key_in_len)); if ((opts->ctr_rpos == -1) && (opts->ctr_rlen > 0)) { SECURITY_CHECK_RES(hmac_update(ctx, ctr + (RLEN - opts->ctr_rlen), opts->ctr_rlen)); } // K(i) := PRF (KI, I_V | Ki-1) if ((k_i_1_len > 0) && (SECURITY_FUNCTION_RET_VAR = hmac_update(ctx, k_i_1, k_i_1_len) != SECURITY_STATUS_OK)) { goto SECURITY_FUNCTION_EXIT; } if ((opts->ctr_rpos == 0) && (opts->ctr_rlen > 0)) { SECURITY_CHECK_RES(hmac_update(ctx, ctr + (RLEN - opts->ctr_rlen), opts->ctr_rlen)); } if ((opts->ctr_rpos > 0) && (opts->ctr_rlen > 0)) { SECURITY_CHECK_RES(hmac_update(ctx, fixed_input, opts->ctr_rpos / 8)); SECURITY_CHECK_RES(hmac_update(ctx, ctr + (RLEN - opts->ctr_rlen), opts->ctr_rlen)); if ((opts->ctr_rpos != (int64_t)fixed_input_len) && (SECURITY_FUNCTION_RET_VAR = hmac_update(ctx, fixed_input + opts->ctr_rpos / 8, fixed_input_len - opts->ctr_rpos / 8) != SECURITY_STATUS_OK)) { goto SECURITY_FUNCTION_EXIT; } } else { SECURITY_CHECK_RES(hmac_update(ctx, fixed_input, fixed_input_len)); } SECURITY_CHECK_RES(hmac_final(ctx, last_block)); SECURITY_CHECK_VALID_NOT_NULL(memcpy(key_out, last_block, leftover)); SECURITY_CHECK_VALID_NOT_NULL(memset(last_block, 0xFF, HMAC_MAX_OUTPUT)); if (modulo) { key_out[leftover - 1] &= BIT_MASK_LEFT(key_out_len % 8); } } else { if (modulo) { key_out_last[hmac_size - 1] &= BIT_MASK_LEFT(key_out_len % 8); } } SECURITY_FUNCTION_EXIT: SECURITY_FUNCTION_RETURN; } static uint32_t _kbkdf_double_pipeline(void *ctx, kbkdf_hash_type_e hash_type, kbkdf_hmac_callbacks_t hmac_callbacks, const uint8_t *key_in, const uint32_t key_in_len, uint8_t *fixed_input, const uint32_t fixed_input_len, uint8_t *key_out, const uint32_t key_out_len, kbkdf_opts_t *opts) { SECURITY_FUNCTION_BEGIN; hmac_init_t hmac_init = hmac_callbacks.hmac_init; hmac_update_t hmac_update = hmac_callbacks.hmac_update; hmac_final_t hmac_final = hmac_callbacks.hmac_final; uint32_t hmac_size; uint32_t full_blocks; uint32_t leftover; uint32_t A_len; uint32_t modulo; uint8_t A[HMAC_MAX_OUTPUT]; uint8_t ctr[RLEN + 1]; uint8_t *key_out_last; void *A_i_1; void *A_i; if (opts->ctr_rlen > RLEN) { SECURITY_FUNCTION_RET_VAR = SECURITY_STATUS_FAIL; goto SECURITY_FUNCTION_EXIT; } A_i_1 = fixed_input; A_len = fixed_input_len; A_i = &A[0]; hmac_size = kbkdf_hash_size[hash_type]; modulo = ((key_out_len % 8) > 1) ? 1 : 0; full_blocks = ((key_out_len / 8) + modulo) / hmac_size; leftover = ((key_out_len / 8) + modulo) % hmac_size; key_out_last = key_out; for (uint32_t i = 1; i <= full_blocks; ++i, key_out += hmac_size) { PUT_UINT32_BE(i, ctr, 0); ctr[4] = 0; SECURITY_CHECK_RES(hmac_init(ctx, key_in, key_in_len)); SECURITY_CHECK_RES(hmac_update(ctx, A_i_1, A_len)); SECURITY_CHECK_RES(hmac_final(ctx, A_i)); SECURITY_CHECK_RES(hmac_init(ctx, key_in, key_in_len)); SECURITY_CHECK_RES(hmac_update(ctx, A_i, hmac_size)); if ((opts->ctr_rpos == -1) && (opts->ctr_rlen > 0)) { SECURITY_CHECK_RES(hmac_update(ctx, ctr + (RLEN - opts->ctr_rlen), opts->ctr_rlen)); } if ((opts->ctr_rpos == 0) && (opts->ctr_rlen > 0)) { SECURITY_CHECK_RES(hmac_update(ctx, ctr + (RLEN - opts->ctr_rlen), opts->ctr_rlen)); } if ((opts->ctr_rpos > 0) && (opts->ctr_rlen > 0)) { SECURITY_CHECK_RES(hmac_update(ctx, fixed_input, opts->ctr_rpos / 8)); SECURITY_CHECK_RES(hmac_update(ctx, ctr + (RLEN - opts->ctr_rlen), opts->ctr_rlen)); if ((opts->ctr_rpos != (int64_t)fixed_input_len) && (SECURITY_FUNCTION_RET_VAR = hmac_update(ctx, fixed_input + opts->ctr_rpos / 8, fixed_input_len - opts->ctr_rpos / 8) != SECURITY_STATUS_OK)) { goto SECURITY_FUNCTION_EXIT; } } else { SECURITY_CHECK_RES(hmac_update(ctx, fixed_input, fixed_input_len)); } SECURITY_CHECK_RES(hmac_final(ctx, key_out)); A_i_1 = &A[0]; A_len = hmac_size; key_out_last = key_out; } if (leftover) { uint8_t last_block[HMAC_MAX_OUTPUT]; PUT_UINT32_BE(full_blocks + 1, ctr, 0); ctr[4] = 0; SECURITY_CHECK_RES(hmac_init(ctx, key_in, key_in_len)); SECURITY_CHECK_RES(hmac_update(ctx, A_i_1, A_len)); { goto SECURITY_FUNCTION_EXIT; } SECURITY_CHECK_RES(hmac_final(ctx, A_i)); SECURITY_CHECK_RES(hmac_init(ctx, key_in, key_in_len)); if ((opts->ctr_rpos == -1) && (opts->ctr_rlen > 0)) { SECURITY_CHECK_RES(hmac_update(ctx, ctr + (RLEN - opts->ctr_rlen), opts->ctr_rlen)); } SECURITY_CHECK_RES(hmac_update(ctx, A_i, A_len)); if ((opts->ctr_rpos == 0) && (opts->ctr_rlen > 0)) { SECURITY_CHECK_RES(hmac_update(ctx, ctr + (RLEN - opts->ctr_rlen), opts->ctr_rlen)); } if ((opts->ctr_rpos > 0) && (opts->ctr_rlen > 0)) { SECURITY_CHECK_RES(hmac_update(ctx, fixed_input, opts->ctr_rpos / 8)); SECURITY_CHECK_RES(hmac_update(ctx, ctr + (RLEN - opts->ctr_rlen), opts->ctr_rlen)); if ((opts->ctr_rpos != (int64_t)fixed_input_len) && (SECURITY_FUNCTION_RET_VAR = hmac_update(ctx, fixed_input + opts->ctr_rpos / 8, fixed_input_len - opts->ctr_rpos / 8) != SECURITY_STATUS_OK)) { goto SECURITY_FUNCTION_EXIT; } } else { SECURITY_CHECK_RES(hmac_update(ctx, fixed_input, fixed_input_len)); } SECURITY_CHECK_RES(hmac_final(ctx, last_block)); SECURITY_CHECK_VALID_NOT_NULL(memcpy(key_out, last_block, leftover)); SECURITY_CHECK_VALID_NOT_NULL(memset(last_block, 0xFF, HMAC_MAX_OUTPUT)); if (modulo) { key_out[leftover - 1] &= BIT_MASK_LEFT(key_out_len % 8); } } else { if (modulo) { key_out_last[hmac_size - 1] &= BIT_MASK_LEFT(key_out_len % 8); } } SECURITY_FUNCTION_EXIT: SECURITY_FUNCTION_RETURN; } security_status_e kbkdf(void *prf_ctx, kbkdf_mode_e mode, kbkdf_hash_type_e hash_type, kbkdf_hmac_callbacks_t hmac_callbacks, const uint8_t *key_in, const uint32_t key_in_len, const uint8_t *iv_in, const uint32_t iv_in_len, uint8_t *fixed_input, const uint32_t fixed_input_len, uint8_t *key_out, const uint32_t key_out_len, kbkdf_opts_t *opts) { SECURITY_FUNCTION_BEGIN; kbkdf_opts_t tmp_opts = { .ctr_rlen = 4, .ctr_rpos = 0 }; SECURITY_CHECK_VALID_NOT_NULL(key_in); SECURITY_CHECK_VALID_NOT_NULL(iv_in); SECURITY_CHECK_VALID_NOT_NULL(fixed_input); SECURITY_CHECK_VALID_NOT_NULL(key_out); SECURITY_CHECK_VALID_NOT_NULL(hmac_callbacks.hmac_final); SECURITY_CHECK_VALID_NOT_NULL(hmac_callbacks.hmac_init); SECURITY_CHECK_VALID_NOT_NULL(hmac_callbacks.hmac_update); if (opts != NULL) { tmp_opts.ctr_rlen = opts->ctr_rlen; tmp_opts.ctr_rpos = opts->ctr_rpos; } switch (mode) { case KBKDF_MODE_COUNTER: SECURITY_CHECK_RES(_kbkdf_counter(prf_ctx, hash_type, hmac_callbacks, key_in, key_in_len, fixed_input, fixed_input_len, key_out, key_out_len, &tmp_opts)); break; case KBKDF_MODE_FEEDBACK: SECURITY_CHECK_RES(_kbkdf_feedback(prf_ctx, hash_type, hmac_callbacks, key_in, key_in_len, iv_in, iv_in_len, fixed_input, fixed_input_len, key_out, key_out_len, &tmp_opts)); break; case KBKDF_MODE_DOUBLE_PIPELINE: SECURITY_CHECK_RES(_kbkdf_double_pipeline(prf_ctx, hash_type, hmac_callbacks, key_in, key_in_len, fixed_input, fixed_input_len, key_out, key_out_len, &tmp_opts)); break; default: SECURITY_FUNCTION_RET_VAR = SECURITY_STATUS_FAIL_NOT_IMPLEMENTED; } SECURITY_FUNCTION_EXIT: #if (SECURITY_LEVEL == MAX_SECURITY_LEVEL) || (SECURED_KBKDF == ENABLED) #endif /* SECURED_KBKDF */ SECURITY_FUNCTION_RETURN; }
33.580531
118
0.576609
1987b0395be4ae6cc4ca6a81104931010dc441e8
688
h
C
include/org_wasmer_Memory.h
Superice666/wasmer-java
06439ecfe09c7464fe08d0de47df7a1506910b97
[ "MIT" ]
218
2020-09-06T19:58:26.000Z
2022-03-31T08:06:36.000Z
include/org_wasmer_Memory.h
Superice666/wasmer-java
06439ecfe09c7464fe08d0de47df7a1506910b97
[ "MIT" ]
24
2020-09-03T14:44:10.000Z
2022-03-19T08:10:59.000Z
include/org_wasmer_Memory.h
Superice666/wasmer-java
06439ecfe09c7464fe08d0de47df7a1506910b97
[ "MIT" ]
21
2020-10-09T04:56:13.000Z
2022-03-07T20:44:52.000Z
/* DO NOT EDIT THIS FILE - it is machine generated */ #include <jni.h> /* Header for class org_wasmer_Memory */ #ifndef _Included_org_wasmer_Memory #define _Included_org_wasmer_Memory #ifdef __cplusplus extern "C" { #endif /* * Class: org_wasmer_Memory * Method: nativeMemoryView * Signature: (Lorg/wasmer/Memory;J)V */ JNIEXPORT void JNICALL Java_org_wasmer_Memory_nativeMemoryView (JNIEnv *, jobject, jobject, jlong); /* * Class: org_wasmer_Memory * Method: nativeMemoryGrow * Signature: (Lorg/wasmer/Memory;JI)I */ JNIEXPORT jint JNICALL Java_org_wasmer_Memory_nativeMemoryGrow (JNIEnv *, jobject, jobject, jlong, jint); #ifdef __cplusplus } #endif #endif
22.933333
62
0.747093
e5ded3ad7e1bd8e6570bc09ac12954da200ead5a
1,523
h
C
DrunkEngine/ModuleEventSystem.h
MarcFly/Fly3D-Engine
e8da09a63c7c3d991b8f25c346798ee230593e78
[ "Unlicense" ]
null
null
null
DrunkEngine/ModuleEventSystem.h
MarcFly/Fly3D-Engine
e8da09a63c7c3d991b8f25c346798ee230593e78
[ "Unlicense" ]
3
2018-09-27T17:00:14.000Z
2018-12-19T13:30:25.000Z
DrunkEngine/ModuleEventSystem.h
MarcFly/Fly3D-Engine
e8da09a63c7c3d991b8f25c346798ee230593e78
[ "Unlicense" ]
null
null
null
#ifndef _MODULE_EVENTSYSTEM_H_ #define _MODULE_EVENTSYSTEM_H_ #include "Module.h" class GameObject; class Bone; enum EventType { GameObject_Detroyed, Play, Pause, Unpause, Stop, Window_Resize, Camera_Modified, File_Dropped, Transform_Updated, Update_Cam_Focus, Bone_Updated, NULL_Event }; struct Event { EventType type; union { struct { const char* ptr = nullptr; } string; struct { int x = -1, y = -1; } point2d; struct { GameObject * ptr = nullptr; } game_object; struct { Bone * ptr = nullptr; } bone; }; enum UnionUsed { UseString, UsePoint2d, UseGameObject, UseBone, UseNull } unionSelector; Event(EventType type, Event::UnionUsed union_to_use) { this->type = type; unionSelector = union_to_use; } ~Event() { switch (unionSelector) { case Event::UseString: delete string.ptr; case Event::UseGameObject: game_object.ptr = nullptr; case Event::UseBone: bone.ptr = nullptr; } } }; struct Subscriptor { std::vector<EventType> sub_events; Module * module; ~Subscriptor() { module = nullptr; sub_events.clear(); } }; class ModuleEventSystem : public Module { public: ModuleEventSystem(bool start_enabled = true); ~ModuleEventSystem(); void Clear(); void BroadcastEvent(const Event & event); void SendBroadcastedEvents(); void Subscribe(EventType event, Module * module); private: std::vector<Subscriptor*> subscriptors; std::vector<const Event*> queue_of_events; }; #endif // !_MODULE_EVENTSYSTEM_H_
14.367925
106
0.697308
0f3400a0776995198b5035020ed790ec2e086532
633
h
C
MoreiTunesConnect_iOS/Utils/Public/MTCHeader.h
yoimhere/MoreiTunesConnect_iOS
9a69b79ddb8fee06f8370b086dea8e9f3ed467b3
[ "MIT" ]
1
2018-06-08T08:18:33.000Z
2018-06-08T08:18:33.000Z
MoreiTunesConnect_iOS/Utils/Public/MTCHeader.h
yoimhere/MoreiTunesConnect_iOS
9a69b79ddb8fee06f8370b086dea8e9f3ed467b3
[ "MIT" ]
null
null
null
MoreiTunesConnect_iOS/Utils/Public/MTCHeader.h
yoimhere/MoreiTunesConnect_iOS
9a69b79ddb8fee06f8370b086dea8e9f3ed467b3
[ "MIT" ]
null
null
null
// // MTCHeader.h // MoreiTunes // // Created by Dwang on 2018/1/17. // Copyright © 2018年 CoderDwang. All rights reserved. // #ifndef MTCHeader_h #define MTCHeader_h /** 其它 */ #import <YYCategories.h> #import <DWCategoryKit.h> #import "MTCSqlManager.h" #import "MTCAccountModel.h" #import "NSString+MTCExtenison.h" #import "MTCHOST.h" #import "MTCKEY.h" /** UI */ #import <UIKit/UIKit.h> #import <QMUIKit.h> #import <Masonry.h> #import <MJRefresh.h> #import <ISMessages.h> #import "QMUITableView+MTCExtension.h" #import "MTCBaseViewController.h" /** 网络 */ #import "MTCNetwork.h" #import <YYModel.h> #endif /* MTCHeader_h */
18.085714
54
0.701422
66e202238b174d04c4a3067dbae7c0445a796856
4,012
c
C
algorithms/backtracking/knight_tour.c
kruztev/FMI-DSA
f509dba6cd95792ec9c4c9ad55620a3dc06c6602
[ "MIT" ]
24
2017-12-21T13:57:34.000Z
2021-12-08T01:12:32.000Z
algorithms/backtracking/knight_tour.c
kruztev/FMI-DSA
f509dba6cd95792ec9c4c9ad55620a3dc06c6602
[ "MIT" ]
28
2018-11-01T23:34:08.000Z
2019-10-07T17:42:54.000Z
algorithms/backtracking/knight_tour.c
kruztev/FMI-DSA
f509dba6cd95792ec9c4c9ad55620a3dc06c6602
[ "MIT" ]
4
2018-04-24T19:28:51.000Z
2020-07-19T14:06:23.000Z
/******************************************************************************* * This file is part of the "Data structures and algorithms" course. FMI 2018/19 *******************************************************************************/ /** * @file knight_tour.c * @author Ivan Filipov * @date 01.2019 * @brief Solution to "knight's tour" problem, * as an example of backtracking algorithm. * * @see https://en.wikipedia.org/wiki/Knight%27s_tour */ #include <stdio.h> // printf(), scanf(), putchar() #include <stdbool.h> // bool type /* constants */ #define NON_VISITED 0 //!< a marker for unvisited cell #define BOARD_MAX_SIZE 10 //!< maximum board size #define N_MOVERULES 8 //!< count of movement rules /* globals */ /// the chess board represented as matrix unsigned int board[BOARD_MAX_SIZE][BOARD_MAX_SIZE]; //@{ /** x + diff_x[i], y + diff_y[i] defines the all reachable positions from x, y */ int const diff_x[N_MOVERULES] = { 1, 1, -1, -1, 2, -2, 2, -2 }; int const diff_y[N_MOVERULES] = { 2, -2, 2, -2, 1, 1, -1, -1 }; //@} /* function definitions */ /** * @brief initializes all cells from the chess * board as non-visited. * @param[in] board_size: size of board to be initialized, should be < BOARD_MAX_SIZE */ void init(unsigned board_size) { for (unsigned i = 0; i < board_size; ++i) for (unsigned j = 0; j < board_size; ++j) board[i][j] = NON_VISITED; } /** * @brief simply output chess board's contain, * which describes the knight's tour. * @param[in] board_size: size of board to be printed, should be < BOARD_MAX_SIZE */ void print_board(unsigned board_size) { printf("\nthe knight's tour looks like :\n"); for (unsigned i = 0; i < board_size; ++i) { for (unsigned j = 0; j < board_size; ++j) printf("%3u", board[i][j]); putchar('\n'); } } /** * @brief recursive function that describes * each step of the backtracking algorithm * @param[in] x: current x coordinate of the knight * @param[in] y: current y coordinate of the knight * @param[in] step: who many steps up to here * @param[in] board_size: size of the board * @retval true, when solution is found, false else * @note when @p step == @p board_size ^ 2, a solution is found */ bool knight_next_move(unsigned x, unsigned y, unsigned step, unsigned board_size) { // marking the current cell as visited board[x][y] = step; // we have found a solution if (step == board_size * board_size) { print_board(board_size); return true; // exit(0); alternative approach is to make the function // void and just to exit the program when we find solution } int new_x, new_y; // trying each direction for (unsigned k = 0; k < N_MOVERULES; ++k){ // calculate new cell new_x = x + diff_x[k]; new_y = y + diff_y[k]; // if we are inside the board and the cell is non-visited // then we are moving our knight into it if (new_x >= 0 && new_y >= 0 && new_x < (int)board_size && new_y < (int)board_size && board[new_x][new_y] == NON_VISITED) { // go into that cell if (knight_next_move(new_x, new_y, step + 1, board_size)) return true; } } // marking the current cell as non-visited // when returning back from an unsuccessful // recursion call board[x][y] = NON_VISITED; return false; } int main() { // valid solution from size = 6, x = 0, y = 5 // size = 6, x = 1, y = 5 /* read inputs */ unsigned board_size, start_x, start_y; printf("board size : "); scanf("%u", &board_size); printf("\nknight X position : "); scanf("%u", &start_x); printf("\nknight Y position : "); scanf("%u", &start_y); /* validate the input */ if (board_size > BOARD_MAX_SIZE || start_x >= board_size || start_y >= board_size) { printf("invalid input!\n"); return 1; } /* initialize the board */ init(board_size); /* run the algorithm */ if(!knight_next_move(start_x, start_y, 1, board_size)) printf("solution not found!\n"); return 0; }
28.055944
85
0.617149
c79b3c39cbd2c96940021c0f6351e52bad4cfe74
1,047
h
C
includes/ReSDL/Texture.h
astahl/residual
f31bf2dfb46c34de9fdbaddf9360679bcb1cdf91
[ "MIT" ]
null
null
null
includes/ReSDL/Texture.h
astahl/residual
f31bf2dfb46c34de9fdbaddf9360679bcb1cdf91
[ "MIT" ]
null
null
null
includes/ReSDL/Texture.h
astahl/residual
f31bf2dfb46c34de9fdbaddf9360679bcb1cdf91
[ "MIT" ]
null
null
null
namespace ReSDL { struct Texture { sdl_handle<SDL_Texture> handle; Uint32 format = 0; int access = 0; ReSDL::Size size{}; Texture(Renderer& renderer, SDL_PixelFormatEnum format, int access, int w, int h) : handle(SDL_CreateTexture(renderer.handle.get(), format, access, w, h), SDL_DestroyTexture) , format(format) , access(access) , size{ w, h } { } Texture(Renderer& renderer, Surface& surface) : handle(SDL_CreateTextureFromSurface(renderer.handle.get(), surface.handle.get()), SDL_DestroyTexture) { SDL_QueryTexture(handle.get(), &format, &access, &size.width, &size.height); } void setColorMod(Uint8 r, Uint8 g, Uint8 b) { check(SDL_SetTextureColorMod(handle.get(), r, g, b)); } void setAlphaMod(Uint8 alpha) { check(SDL_SetTextureAlphaMod(handle.get(), alpha)); } void setBlendMode(SDL_BlendMode blendMode) { check(SDL_SetTextureBlendMode(handle.get(), blendMode)); } SDL_Texture& operator*() { return *handle; } }; }
21.367347
106
0.657116
9c261e615b98c2882d866afa1d4b857d8330a057
12,595
c
C
contrib/ldns/compat/b32_pton.c
ivadasz/DragonFlyBSD
460227f342554313be3c7728ff679dd4a556cce9
[ "BSD-3-Clause" ]
3
2017-03-06T14:12:57.000Z
2019-11-23T09:35:10.000Z
contrib/ldns/compat/b32_pton.c
jorisgio/DragonFlyBSD
d37cc9027d161f3e36bf2667d32f41f87606b2ac
[ "BSD-3-Clause" ]
null
null
null
contrib/ldns/compat/b32_pton.c
jorisgio/DragonFlyBSD
d37cc9027d161f3e36bf2667d32f41f87606b2ac
[ "BSD-3-Clause" ]
1
2021-06-08T15:59:26.000Z
2021-06-08T15:59:26.000Z
/* * Copyright (c) 1996, 1998 by Internet Software Consortium. * * Permission to use, copy, modify, and distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE * CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS * SOFTWARE. */ /* * Portions Copyright (c) 1995 by International Business Machines, Inc. * * International Business Machines, Inc. (hereinafter called IBM) grants * permission under its copyrights to use, copy, modify, and distribute this * Software with or without fee, provided that the above copyright notice and * all paragraphs of this notice appear in all copies, and that the name of IBM * not be used in connection with the marketing of any product incorporating * the Software or modifications thereof, without specific, written prior * permission. * * To the extent it has a right to do so, IBM grants an immunity from suit * under its patents, if any, for the use, sale or manufacture of products to * the extent that such products are used for performing Domain Name System * dynamic updates in TCP/IP networks by means of the Software. No immunity is * granted for any product per se or for any other function of any product. * * THE SOFTWARE IS PROVIDED "AS IS", AND IBM DISCLAIMS ALL WARRANTIES, * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A * PARTICULAR PURPOSE. IN NO EVENT SHALL IBM BE LIABLE FOR ANY SPECIAL, * DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER ARISING * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE, EVEN * IF IBM IS APPRISED OF THE POSSIBILITY OF SUCH DAMAGES. */ #include <ldns/config.h> #include <sys/types.h> #include <sys/param.h> #ifdef HAVE_SYS_SOCKET_H #include <sys/socket.h> #endif #ifdef HAVE_NETINET_IN_H #include <netinet/in.h> #endif #ifdef HAVE_ARPA_INET_H #include <arpa/inet.h> #endif #include <ctype.h> #include <stdio.h> #include <stdlib.h> #include <string.h> /* "ABCDEFGHIJKLMNOPQRSTUVWXYZ234567";*/ static const char Base32[] = "abcdefghijklmnopqrstuvwxyz234567"; /* "0123456789ABCDEFGHIJKLMNOPQRSTUV";*/ static const char Base32_extended_hex[] = "0123456789abcdefghijklmnopqrstuv"; static const char Pad32 = '='; /* (From RFC1521 and draft-ietf-dnssec-secext-03.txt) 5. Base 32 Encoding The Base 32 encoding is designed to represent arbitrary sequences of octets in a form that needs to be case insensitive but need not be humanly readable. A 33-character subset of US-ASCII is used, enabling 5 bits to be represented per printable character. (The extra 33rd character, "=", is used to signify a special processing function.) The encoding process represents 40-bit groups of input bits as output strings of 8 encoded characters. Proceeding from left to right, a 40-bit input group is formed by concatenating 5 8bit input groups. These 40 bits are then treated as 8 concatenated 5-bit groups, each of which is translated into a single digit in the base 32 alphabet. When encoding a bit stream via the base 32 encoding, the bit stream must be presumed to be ordered with the most-significant-bit first. That is, the first bit in the stream will be the high-order bit in the first 8bit byte, and the eighth bit will be the low-order bit in the first 8bit byte, and so on. Each 5-bit group is used as an index into an array of 32 printable characters. The character referenced by the index is placed in the output string. These characters, identified in Table 3, below, are selected from US-ASCII digits and uppercase letters. Table 3: The Base 32 Alphabet Value Encoding Value Encoding Value Encoding Value Encoding 0 A 9 J 18 S 27 3 1 B 10 K 19 T 28 4 2 C 11 L 20 U 29 5 3 D 12 M 21 V 30 6 4 E 13 N 22 W 31 7 5 F 14 O 23 X 6 G 15 P 24 Y (pad) = 7 H 16 Q 25 Z 8 I 17 R 26 2 Special processing is performed if fewer than 40 bits are available at the end of the data being encoded. A full encoding quantum is always completed at the end of a body. When fewer than 40 input bits are available in an input group, zero bits are added (on the right) to form an integral number of 5-bit groups. Padding at the end of the data is performed using the "=" character. Since all base 32 input is an integral number of octets, only the following cases can arise: (1) the final quantum of encoding input is an integral multiple of 40 bits; here, the final unit of encoded output will be an integral multiple of 8 characters with no "=" padding, (2) the final quantum of encoding input is exactly 8 bits; here, the final unit of encoded output will be two characters followed by six "=" padding characters, (3) the final quantum of encoding input is exactly 16 bits; here, the final unit of encoded output will be four characters followed by four "=" padding characters, (4) the final quantum of encoding input is exactly 24 bits; here, the final unit of encoded output will be five characters followed by three "=" padding characters, or (5) the final quantum of encoding input is exactly 32 bits; here, the final unit of encoded output will be seven characters followed by one "=" padding character. 6. Base 32 Encoding with Extended Hex Alphabet The following description of base 32 is due to [7]. This encoding should not be regarded as the same as the "base32" encoding, and should not be referred to as only "base32". One property with this alphabet, that the base32 and base32 alphabet lack, is that encoded data maintain its sort order when the encoded data is compared bit-wise. This encoding is identical to the previous one, except for the alphabet. The new alphabet is found in table 4. Table 4: The "Extended Hex" Base 32 Alphabet Value Encoding Value Encoding Value Encoding Value Encoding 0 0 9 9 18 I 27 R 1 1 10 A 19 J 28 S 2 2 11 B 20 K 29 T 3 3 12 C 21 L 30 U 4 4 13 D 22 M 31 V 5 5 14 E 23 N 6 6 15 F 24 O (pad) = 7 7 16 G 25 P 8 8 17 H 26 Q */ /* skips all whitespace anywhere. converts characters, four at a time, starting at (or after) src from base - 32 numbers into three 8 bit bytes in the target area. it returns the number of data bytes stored at the target, or -1 on error. */ int ldns_b32_pton_ar(char const *src, size_t hashed_owner_str_len, uint8_t *target, size_t targsize, const char B32_ar[]) { int tarindex, state, ch; char *pos; int i = 0; state = 0; tarindex = 0; while ((ch = *src++) != '\0' && (i == 0 || i < (int) hashed_owner_str_len)) { i++; ch = tolower(ch); if (isspace((unsigned char)ch)) /* Skip whitespace anywhere. */ continue; if (ch == Pad32) break; pos = strchr(B32_ar, ch); if (pos == 0) { /* A non-base32 character. */ return (-ch); } switch (state) { case 0: if (target) { if ((size_t)tarindex >= targsize) { return (-2); } target[tarindex] = (pos - B32_ar) << 3; } state = 1; break; case 1: if (target) { if ((size_t)tarindex + 1 >= targsize) { return (-3); } target[tarindex] |= (pos - B32_ar) >> 2; target[tarindex+1] = ((pos - B32_ar) & 0x03) << 6 ; } tarindex++; state = 2; break; case 2: if (target) { if ((size_t)tarindex + 1 >= targsize) { return (-4); } target[tarindex] |= (pos - B32_ar) << 1; } /*tarindex++;*/ state = 3; break; case 3: if (target) { if ((size_t)tarindex + 1 >= targsize) { return (-5); } target[tarindex] |= (pos - B32_ar) >> 4; target[tarindex+1] = ((pos - B32_ar) & 0x0f) << 4 ; } tarindex++; state = 4; break; case 4: if (target) { if ((size_t)tarindex + 1 >= targsize) { return (-6); } target[tarindex] |= (pos - B32_ar) >> 1; target[tarindex+1] = ((pos - B32_ar) & 0x01) << 7 ; } tarindex++; state = 5; break; case 5: if (target) { if ((size_t)tarindex + 1 >= targsize) { return (-7); } target[tarindex] |= (pos - B32_ar) << 2; } state = 6; break; case 6: if (target) { if ((size_t)tarindex + 1 >= targsize) { return (-8); } target[tarindex] |= (pos - B32_ar) >> 3; target[tarindex+1] = ((pos - B32_ar) & 0x07) << 5 ; } tarindex++; state = 7; break; case 7: if (target) { if ((size_t)tarindex + 1 >= targsize) { return (-9); } target[tarindex] |= (pos - B32_ar); } tarindex++; state = 0; break; default: abort(); } } /* * We are done decoding Base-32 chars. Let's see if we ended * on a byte boundary, and/or with erroneous trailing characters. */ if (ch == Pad32) { /* We got a pad char. */ ch = *src++; /* Skip it, get next. */ switch (state) { case 0: /* Invalid = in first position */ case 1: /* Invalid = in second position */ return (-10); case 2: /* Valid, means one byte of info */ case 3: /* Skip any number of spaces. */ for ((void)NULL; ch != '\0'; ch = *src++) if (!isspace((unsigned char)ch)) break; /* Make sure there is another trailing = sign. */ if (ch != Pad32) { return (-11); } ch = *src++; /* Skip the = */ /* Fall through to "single trailing =" case. */ /* FALLTHROUGH */ case 4: /* Valid, means two bytes of info */ case 5: case 6: /* * We know this char is an =. Is there anything but * whitespace after it? */ for ((void)NULL; ch != '\0'; ch = *src++) if (!(isspace((unsigned char)ch) || ch == '=')) { return (-12); } case 7: /* Valid, means three bytes of info */ /* * We know this char is an =. Is there anything but * whitespace after it? */ for ((void)NULL; ch != '\0'; ch = *src++) if (!isspace((unsigned char)ch)) { return (-13); } /* * Now make sure for cases 2 and 3 that the "extra" * bits that slopped past the last full byte were * zeros. If we don't check them, they become a * subliminal channel. */ if (target && target[tarindex] != 0) { return (-14); } } } else { /* * We ended by seeing the end of the string. Make sure we * have no partial bytes lying around. */ if (state != 0) return (-15); } return (tarindex); } int ldns_b32_pton(char const *src, size_t hashed_owner_str_len, uint8_t *target, size_t targsize) { return ldns_b32_pton_ar(src, hashed_owner_str_len, target, targsize, Base32); } /* deprecated, here for backwards compatibility */ int b32_pton(char const *src, size_t hashed_owner_str_len, uint8_t *target, size_t targsize) { return ldns_b32_pton_ar(src, hashed_owner_str_len, target, targsize, Base32); } int ldns_b32_pton_extended_hex(char const *src, size_t hashed_owner_str_len, uint8_t *target, size_t targsize) { return ldns_b32_pton_ar(src, hashed_owner_str_len, target, targsize, Base32_extended_hex); } /* deprecated, here for backwards compatibility */ int b32_pton_extended_hex(char const *src, size_t hashed_owner_str_len, uint8_t *target, size_t targsize) { return ldns_b32_pton_ar(src, hashed_owner_str_len, target, targsize, Base32_extended_hex); }
32.46134
117
0.628027
a7ec87621114a66bb7e5dd71b7d6dd304069ba4f
1,438
h
C
System/Library/PrivateFrameworks/HealthDaemon.framework/_HDDataEntityEncoder.h
lechium/iOS1351Headers
6bed3dada5ffc20366b27f7f2300a24a48a6284e
[ "MIT" ]
2
2021-11-02T09:23:27.000Z
2022-03-28T08:21:57.000Z
System/Library/PrivateFrameworks/HealthDaemon.framework/_HDDataEntityEncoder.h
lechium/iOS1351Headers
6bed3dada5ffc20366b27f7f2300a24a48a6284e
[ "MIT" ]
null
null
null
System/Library/PrivateFrameworks/HealthDaemon.framework/_HDDataEntityEncoder.h
lechium/iOS1351Headers
6bed3dada5ffc20366b27f7f2300a24a48a6284e
[ "MIT" ]
1
2022-03-28T08:21:59.000Z
2022-03-28T08:21:59.000Z
/* * This header is generated by classdump-dyld 1.5 * on Wednesday, October 27, 2021 at 3:17:56 PM Mountain Standard Time * Operating System: Version 13.5.1 (Build 17F80) * Image Source: /System/Library/PrivateFrameworks/HealthDaemon.framework/HealthDaemon * classdump-dyld is licensed under GPLv3, Copyright © 2013-2016 by Elias Limneos. Updated by Kevin Bradley. */ #import <HealthDaemon/HealthDaemon-Structs.h> #import <HealthDaemon/HDEntityEncoder.h> @class HDMetadataValueStatement, HDDataProvenanceCache; @interface _HDDataEntityEncoder : HDEntityEncoder { HDMetadataValueStatement* _metadataValueStatement; HDDataProvenanceCache* _dataProvenanceCache; /*^block*/id _metadataKeyFilter; BOOL _includeAutomaticTimeZones; } -(void)finish; -(id)initWithHealthEntityClass:(Class)arg1 profile:(id)arg2 database:(id)arg3 purpose:(long long)arg4 encodingOptions:(id)arg5 authorizationFilter:(/*^block*/id)arg6 ; -(id)orderedProperties; -(id)objectForPersistentID:(long long)arg1 row:(HDSQLiteRowRef)arg2 error:(id*)arg3 ; -(id)codableRepresentationForPersistentID:(long long)arg1 row:(HDSQLiteRowRef)arg2 error:(id*)arg3 ; -(BOOL)applyPropertiesToObject:(id)arg1 persistentID:(long long)arg2 row:(HDSQLiteRowRef)arg3 error:(id*)arg4 ; -(id)_copyBaseMetadataForRow:(HDSQLiteRowRef)arg1 ; @end
46.387097
167
0.723922
d5da6273d51f2cf3a60ef06ccdf731b419ab9e22
336
c
C
src/mx_sort_file.c
agrabchak/ULS
7a0b9890ec852691d4fc0ad41e426eee02beaf3d
[ "MIT" ]
null
null
null
src/mx_sort_file.c
agrabchak/ULS
7a0b9890ec852691d4fc0ad41e426eee02beaf3d
[ "MIT" ]
null
null
null
src/mx_sort_file.c
agrabchak/ULS
7a0b9890ec852691d4fc0ad41e426eee02beaf3d
[ "MIT" ]
null
null
null
#include "uls.h" void mx_sort_file(char **str, int size) { for (int i = 1; i < size; i++) { for (int j = 0; j < size - i; j++) { if (mx_strcmp(str[j], str[j + 1]) > 0) { char *tmp = str[j]; str[j] = str[j + 1]; str[j + 1] = tmp; } } } }
21
52
0.354167
70917734ea8225846f9350789d15a3e3912fc3ac
246
h
C
openbmc/build/tmp/deploy/sdk/witherspoon-2019-08-08/sysroots/armv6-openbmc-linux-gnueabi/usr/src/debug/systemd/1_242+AUTOINC+db2e367bfc-r0/git/src/network/netdev/netdevsim.h
sotaoverride/backup
ca53a10b72295387ef4948a9289cb78ab70bc449
[ "Apache-2.0" ]
null
null
null
openbmc/build/tmp/deploy/sdk/witherspoon-2019-08-08/sysroots/armv6-openbmc-linux-gnueabi/usr/src/debug/systemd/1_242+AUTOINC+db2e367bfc-r0/git/src/network/netdev/netdevsim.h
sotaoverride/backup
ca53a10b72295387ef4948a9289cb78ab70bc449
[ "Apache-2.0" ]
null
null
null
openbmc/build/tmp/deploy/sdk/witherspoon-2019-08-08/sysroots/armv6-openbmc-linux-gnueabi/usr/src/debug/systemd/1_242+AUTOINC+db2e367bfc-r0/git/src/network/netdev/netdevsim.h
sotaoverride/backup
ca53a10b72295387ef4948a9289cb78ab70bc449
[ "Apache-2.0" ]
null
null
null
/* SPDX-License-Identifier: LGPL-2.1+ */ #pragma once typedef struct NetDevSim NetDevSim; #include "netdev/netdev.h" struct NetDevSim { NetDev meta; }; DEFINE_NETDEV_CAST(NETDEVSIM, NetDevSim); extern const NetDevVTable netdevsim_vtable;
16.4
43
0.764228
b603bd8c067af77db2858851158e73a92a153f6b
5,586
h
C
libtensor/gen_block_tensor/gen_block_tensor_ctrl.h
maxscheurer/libtensor
288ed0596b24356d187d2fa40c05b0dacd00b413
[ "BSL-1.0" ]
33
2016-02-08T06:05:17.000Z
2021-11-17T01:23:11.000Z
libtensor/gen_block_tensor/gen_block_tensor_ctrl.h
maxscheurer/libtensor
288ed0596b24356d187d2fa40c05b0dacd00b413
[ "BSL-1.0" ]
11
2020-12-04T20:26:12.000Z
2021-12-03T08:07:09.000Z
libtensor/gen_block_tensor/gen_block_tensor_ctrl.h
maxscheurer/libtensor
288ed0596b24356d187d2fa40c05b0dacd00b413
[ "BSL-1.0" ]
12
2016-05-19T18:09:38.000Z
2021-02-24T17:35:21.000Z
#ifndef LIBTENSOR_GEN_BLOCK_TENSOR_CTRL_H #define LIBTENSOR_GEN_BLOCK_TENSOR_CTRL_H #include "gen_block_tensor_i.h" namespace libtensor { /** \brief Generalized block tensor control (base) \tparam N Tensor order. \tparam BtiTraits Block tensor interface traits. \sa gen_block_tensor_rd_ctrl, gen_block_tensor_wr_ctrl, gen_block_tensor_ctrl \ingroup libtensor_gen_block_tensor **/ template<size_t N, typename BtiTraits> class gen_block_tensor_base_ctrl { public: //! Type of tensor elements typedef typename BtiTraits::element_type element_type; private: gen_block_tensor_base_i<N, BtiTraits> &m_bt; //!< Controlled block tensor public: /** \brief Initializes the control object **/ gen_block_tensor_base_ctrl(gen_block_tensor_base_i<N, BtiTraits> &bt) : m_bt(bt) { } /** \brief Returns the constant reference to the block tensor's symmetry container **/ const symmetry<N, element_type> &req_const_symmetry() { return m_bt.on_req_const_symmetry(); } }; /** \brief Generalized read-only block tensor control \tparam N Tensor order. \tparam BtiTraits Block tensor interface traits. \sa gen_block_tensor_base_ctrl, gen_block_tensor_wr_ctrl, gen_block_tensor_ctrl \ingroup libtensor_gen_block_tensor **/ template<size_t N, typename BtiTraits> class gen_block_tensor_rd_ctrl : virtual public gen_block_tensor_base_ctrl<N, BtiTraits> { public: //! Type of tensor elements typedef typename BtiTraits::element_type element_type; //! Type of read-only blocks typedef typename BtiTraits::template rd_block_type<N>::type rd_block_type; private: gen_block_tensor_rd_i<N, BtiTraits> &m_bt; //!< Controlled block tensor public: /** \brief Initializes the control object **/ gen_block_tensor_rd_ctrl(gen_block_tensor_rd_i<N, BtiTraits> &bt) : gen_block_tensor_base_ctrl<N, BtiTraits>(bt), m_bt(bt) { } /** \brief Returns the read-only reference to a canonical block \param idx Index of the block. \return Reference to the requested block. **/ rd_block_type &req_const_block(const index<N> &idx) { return m_bt.on_req_const_block(idx); } /** \brief Checks in a read-only canonical block \param idx Index of the block. **/ void ret_const_block(const index<N> &idx) { m_bt.on_ret_const_block(idx); } /** \brief Returns true if a canonical block is zero \param idx Index of the block. **/ bool req_is_zero_block(const index<N> &idx) { return m_bt.on_req_is_zero_block(idx); } /** \brief Returns the list of all non-zero canonical blocks \param[out] nzlst Vector to be filled on output. **/ void req_nonzero_blocks(std::vector<size_t> &nzlst) { m_bt.on_req_nonzero_blocks(nzlst); } }; /** \brief Generalized read-write block tensor control \tparam N Tensor order. \tparam BtiTraits Block tensor interface traits. \sa gen_block_tensor_base_ctrl, gen_block_tensor_rd_ctrl, gen_block_tensor_ctrl \ingroup libtensor_gen_block_tensor **/ template<size_t N, typename BtiTraits> class gen_block_tensor_wr_ctrl : virtual public gen_block_tensor_base_ctrl<N, BtiTraits> { public: //! Type of tensor elements typedef typename BtiTraits::element_type element_type; //! Type of read-write blocks typedef typename BtiTraits::template wr_block_type<N>::type wr_block_type; private: gen_block_tensor_wr_i<N, BtiTraits> &m_bt; //!< Controlled block tensor public: /** \brief Initializes the control object **/ gen_block_tensor_wr_ctrl(gen_block_tensor_wr_i<N, BtiTraits> &bt) : gen_block_tensor_base_ctrl<N, BtiTraits>(bt), m_bt(bt) { } /** \brief Returns the reference to the block tensor's symmetry container **/ symmetry<N, element_type> &req_symmetry() { return m_bt.on_req_symmetry(); } /** \brief Returns the read-write reference to a canonical block \param idx Index of the block. \return Reference to the requested block. **/ wr_block_type &req_block(const index<N> &idx) { return m_bt.on_req_block(idx); } /** \brief Checks in a canonical block \param idx Index of the block. **/ void ret_block(const index<N> &idx) { m_bt.on_ret_block(idx); } /** \brief Makes a canonical block zero \param idx Index of the block. **/ void req_zero_block(const index<N> &idx) { m_bt.on_req_zero_block(idx); } /** \brief Make all blocks zero **/ void req_zero_all_blocks() { m_bt.on_req_zero_all_blocks(); } }; /** \brief Generalized block tensor control \tparam N Tensor order. \tparam BtiTraits Block tensor interface traits. \sa gen_block_tensor_base_ctrl, gen_block_tensor_rd_ctrl, gen_block_tensor_wr_ctrl \ingroup libtensor_gen_block_tensor **/ template<size_t N, typename BtiTraits> class gen_block_tensor_ctrl : virtual public gen_block_tensor_rd_ctrl<N, BtiTraits>, virtual public gen_block_tensor_wr_ctrl<N, BtiTraits> { public: /** \brief Initializes the control object **/ gen_block_tensor_ctrl(gen_block_tensor_i<N, BtiTraits> &bt) : gen_block_tensor_base_ctrl<N, BtiTraits>(bt), gen_block_tensor_rd_ctrl<N, BtiTraits>(bt), gen_block_tensor_wr_ctrl<N, BtiTraits>(bt) { } }; } // namespace libtensor #endif // LIBTENSOR_GEN_BLOCK_TENSOR_CTRL_H
27.382353
78
0.693699
7ebc43571eaaf46eea8065b3913642cb700e33fd
2,712
h
C
src/core/configuration.h
tofuengine/tofu
b258b777ff26e8b095184fab5909c675d6ec559c
[ "MIT" ]
27
2020-01-09T05:56:40.000Z
2022-03-29T11:48:17.000Z
src/core/configuration.h
tofuengine/tofu
b258b777ff26e8b095184fab5909c675d6ec559c
[ "MIT" ]
1
2021-04-25T01:06:18.000Z
2021-07-11T19:33:05.000Z
src/core/configuration.h
tofuengine/tofu
b258b777ff26e8b095184fab5909c675d6ec559c
[ "MIT" ]
2
2021-04-01T20:51:31.000Z
2021-04-22T13:34:31.000Z
/* * MIT License * * Copyright (c) 2019-2021 Marco Lizza * * 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 __CONFIGURATION_H__ #define __CONFIGURATION_H__ #include <platform.h> #include <stdbool.h> #include <stddef.h> #include <stdint.h> #define MAX_CONFIGURATION_IDENTITY_LENGTH 128 #define MAX_CONFIGURATION_TITLE_LENGTH 128 typedef struct _Configuration { struct { char identity[MAX_CONFIGURATION_IDENTITY_LENGTH]; struct { int major, minor, revision; } version; bool debug; char icon[PLATFORM_PATH_MAX]; char mappings[PLATFORM_PATH_MAX]; } system; struct { char title[MAX_CONFIGURATION_TITLE_LENGTH]; size_t width, height, scale; bool fullscreen; bool vertical_sync; char effect[PLATFORM_PATH_MAX]; } display; struct { int device_index; float master_volume; } audio; struct { bool enabled; bool exit_key; } keyboard; struct { bool enabled; bool hide; float speed; } cursor; struct { bool enabled; float sensitivity; float inner_deadzone; float outer_deadzone; bool emulate_dpad; bool emulate_cursor; } gamepad; struct { size_t frames_per_seconds; size_t skippable_frames; size_t frames_limit; } engine; } Configuration_t; extern void Configuration_parse(Configuration_t *configuration, const char *data); // TODO: allocate this, too? extern void Configuration_override(Configuration_t *configuration, int argc, const char *argv[]); #endif /* __CONFIGURATION_H__ */
31.534884
111
0.695059
0193d0265399977579622a095ecdd4a13b80037e
1,179
c
C
ext/ov_xml_module.c
oliel/python-ovirt-engine-sdk4
c0b13982b45dee664ebc063bda7686124b402c14
[ "Apache-2.0" ]
3
2022-01-14T00:37:58.000Z
2022-03-26T12:26:32.000Z
ext/ov_xml_module.c
oliel/python-ovirt-engine-sdk4
c0b13982b45dee664ebc063bda7686124b402c14
[ "Apache-2.0" ]
29
2021-07-20T12:42:44.000Z
2022-03-28T13:01:33.000Z
ext/ov_xml_module.c
oliel/python-ovirt-engine-sdk4
c0b13982b45dee664ebc063bda7686124b402c14
[ "Apache-2.0" ]
12
2021-07-20T12:27:07.000Z
2022-02-24T11:10:12.000Z
/* Copyright (c) 2016 Red Hat, Inc. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ #include <Python.h> #include "ov_xml_module.h" /* Module: */ PyObject* ov_xml_module; #if PY_MAJOR_VERSION >= 3 static struct PyModuleDef ov_xml_module_definition = { PyModuleDef_HEAD_INIT, /* m_name */ OV_XML_MODULE_NAME, /* m_doc */ 0, /* m_size */ 0, /* m_methods */ 0, /* m_reload */ 0, /* m_traverse */ 0, /* m_clear */ 0, /* m_free */ 0 }; #endif void ov_xml_module_define(void) { #if PY_MAJOR_VERSION >= 3 ov_xml_module = PyModule_Create(&ov_xml_module_definition); #else ov_xml_module = Py_InitModule(OV_XML_MODULE_NAME, NULL); #endif }
26.2
72
0.704835
0bbe7b5277bd716b3ecb14e9c8f32dca8546a6aa
1,174
h
C
System/Library/PrivateFrameworks/ReminderKit.framework/REMReminderFetchMetadata.h
zhangkn/iOS14Header
4323e9459ed6f6f5504ecbea2710bfd6c3d7c946
[ "MIT" ]
1
2020-11-04T15:43:01.000Z
2020-11-04T15:43:01.000Z
System/Library/PrivateFrameworks/ReminderKit.framework/REMReminderFetchMetadata.h
zhangkn/iOS14Header
4323e9459ed6f6f5504ecbea2710bfd6c3d7c946
[ "MIT" ]
null
null
null
System/Library/PrivateFrameworks/ReminderKit.framework/REMReminderFetchMetadata.h
zhangkn/iOS14Header
4323e9459ed6f6f5504ecbea2710bfd6c3d7c946
[ "MIT" ]
null
null
null
/* * This header is generated by classdump-dyld 1.0 * on Sunday, September 27, 2020 at 11:41:51 AM Mountain Standard Time * Operating System: Version 14.0 (Build 18A373) * Image Source: /System/Library/PrivateFrameworks/ReminderKit.framework/ReminderKit * classdump-dyld is licensed under GPLv3, Copyright © 2013-2016 by Elias Limneos. */ #import <ReminderKit/REMFetchMetadata.h> @class NSDictionary, NSArray; @interface REMReminderFetchMetadata : REMFetchMetadata { NSDictionary* _subtaskCounts; NSArray* _dueDateCounts; } @property (nonatomic,readonly) NSDictionary * subtaskCounts; //@synthesize subtaskCounts=_subtaskCounts - In the implementation block @property (nonatomic,readonly) NSArray * dueDateCounts; //@synthesize dueDateCounts=_dueDateCounts - In the implementation block +(BOOL)supportsSecureCoding; -(NSDictionary *)subtaskCounts; -(NSArray *)dueDateCounts; -(id)initWithSubtaskCounts:(id)arg1 ; -(id)initWithDueDateCounts:(id)arg1 ; -(id)initWithSubtaskCounts:(id)arg1 dueDateCounts:(id)arg2 ; -(BOOL)isEqual:(id)arg1 ; -(id)initWithCoder:(id)arg1 ; -(void)encodeWithCoder:(id)arg1 ; -(unsigned long long)hash; @end
34.529412
146
0.762351
9a245b40763d74027692883f62d64a7128524a52
2,193
h
C
Modules/Oculus/RNOculusWindow.h
uberpixel/Rayne
94f601561aedfc3200e67ff9522f64fbc5ca4d8c
[ "MIT" ]
13
2020-08-08T11:57:05.000Z
2022-03-10T17:29:19.000Z
Modules/Oculus/RNOculusWindow.h
uberpixel/Rayne
94f601561aedfc3200e67ff9522f64fbc5ca4d8c
[ "MIT" ]
1
2022-03-10T17:35:28.000Z
2022-03-10T18:21:57.000Z
Modules/Oculus/RNOculusWindow.h
uberpixel/Rayne
94f601561aedfc3200e67ff9522f64fbc5ca4d8c
[ "MIT" ]
3
2020-08-08T14:22:34.000Z
2021-05-15T21:12:17.000Z
// // RNOculusWindow.h // Rayne-Oculus // // Copyright 2017 by Überpixel. All rights reserved. // Unauthorized use is punishable by torture, mutilation, and vivisection. // #ifndef __RAYNE_OCULUSWINDOW_H_ #define __RAYNE_OCULUSWINDOW_H_ #include "RNOculus.h" #include "RNVRWindow.h" namespace RN { class OculusSwapChain; class OculusWindow : public VRWindow { public: /* enum Eye { Left, Right };*/ OVRAPI OculusWindow(); OVRAPI ~OculusWindow(); OVRAPI void StartRendering(const SwapChainDescriptor &descriptor = SwapChainDescriptor(), float eyeResolutionFactor = 1.0f) final; OVRAPI void StopRendering() final; OVRAPI bool IsRendering() const final; OVRAPI Vector2 GetSize() const final; OVRAPI Framebuffer *GetFramebuffer() const final; OVRAPI const VRHMDTrackingState &GetHMDTrackingState() const final; OVRAPI const VRControllerTrackingState &GetControllerTrackingState(uint8 index) const final; OVRAPI const VRControllerTrackingState &GetTrackerTrackingState(uint8 index) const final; OVRAPI const VRHandTrackingState &GetHandTrackingState(uint8 index) const final; OVRAPI void SubmitControllerHaptics(uint8 index, VRControllerHaptics &haptics) final; OVRAPI const String *GetPreferredAudioOutputDeviceID() const; OVRAPI const String *GetPreferredAudioInputDeviceID() const; OVRAPI RenderingDevice *GetOutputDevice(RendererDescriptor *descriptor) const final; OVRAPI const Window::SwapChainDescriptor &GetSwapChainDescriptor() const final; OVRAPI VRWindow::DeviceType GetDeviceType() const final { return VRWindow::DeviceType::OculusVR; } OVRAPI void Update(float delta, float near, float far) final; OVRAPI static VRWindow::Availability GetAvailability(); private: OculusSwapChain *_swapChain; VRHMDTrackingState _hmdTrackingState; VRControllerTrackingState _controllerTrackingState[2]; VRControllerTrackingState _trackerTrackingState; VRHandTrackingState _handTrackingState[2]; VRControllerHaptics _haptics[2]; uint16 _currentHapticsIndex[2]; RNDeclareMetaAPI(OculusWindow, OVRAPI) }; } #endif /* __RAYNE_OCULUSWINDOW_H_ */
30.887324
133
0.766074
cc68e42b3aeb84244e359378b414d87a95bd1b76
3,469
c
C
test.c
BondWong/barrier
7ee20d2fe49d0be85f232ee978650c956f4a6b7a
[ "Apache-2.0" ]
null
null
null
test.c
BondWong/barrier
7ee20d2fe49d0be85f232ee978650c956f4a6b7a
[ "Apache-2.0" ]
null
null
null
test.c
BondWong/barrier
7ee20d2fe49d0be85f232ee978650c956f4a6b7a
[ "Apache-2.0" ]
null
null
null
#include <stdbool.h> #include <stdio.h> #include <stdlib.h> #include <sys/time.h> #include <time.h> #include <unistd.h> #include "test.h" #define MICROSECOND 1000000L void fast_barriers(void (*barrier)(void), size_t num_barriers, struct timeval *arrive, struct timeval *leave) { /* Time the fast barriers. */ struct timeval start; struct timeval end; /* Start the timer. */ gettimeofday(&start, NULL); /* Fast barriers. */ unsigned int b; for (b = 0; b < num_barriers; ++b) { gettimeofday(&arrive[b], NULL); barrier(); gettimeofday(&leave[b], NULL); } /* Get the end timer. */ gettimeofday(&end, NULL); /* Print timing result. */ long delta_sec = end.tv_sec - start.tv_sec; long delta_usec = end.tv_usec - start.tv_usec; long delta = delta_sec * MICROSECOND + delta_usec; printf("%lu fast barriers took %lu.%06lu s\n", num_barriers, delta / MICROSECOND, delta % MICROSECOND); } void slow_barriers(void (*barrier)(void), size_t num_barriers, struct timeval *arrive, struct timeval *leave) { /* Initialise random number generator. */ srand(time(NULL)); /* slow barriers. */ unsigned int b; for (b = 0; b < num_barriers; ++b) { sleep(rand() % 5); gettimeofday(&arrive[b], NULL); barrier(); gettimeofday(&leave[b], NULL); } } void print_json_results(size_t total_barriers, int exec_id, struct timeval *arrive, struct timeval *leave) { /* Create file name for results. */ char filename[80]; snprintf(filename, 80, "results/test_%d.json", exec_id); FILE *fd = fopen(filename, "w"); /* Print the results to the file. */ fprintf(fd, "{\n \"barriers\": [\n"); unsigned int b; for (b = 0; b < total_barriers; ++b) { fprintf(fd, " {\n"); fprintf(fd, " \"arr\": {\"sec\":%ld, \"usec\":%ld},\n", arrive[b].tv_sec, arrive[b].tv_usec); fprintf(fd, " \"dep\": {\"sec\":%ld, \"usec\":%ld}\n", leave[b].tv_sec, leave[b].tv_usec); if ((b+1) != total_barriers) { fprintf(fd, " },\n"); } else { fprintf(fd, " }\n"); } } fprintf(fd, " ]\n}\n"); } void run_test_harness(void (*barrier)(void), int rank, unsigned int num_barriers, bool fast) { /* Initialise time structs. */ size_t total_barriers = fast ? num_barriers : 2 * num_barriers; struct timeval *arrive = calloc(total_barriers, sizeof(struct timeval)); struct timeval *leave = calloc(total_barriers, sizeof(struct timeval)); /* Always do the fast tests. */ fast_barriers(barrier, num_barriers, arrive, leave); /* If the fast option is not set also do the slow barriers. */ if (!fast) { slow_barriers(barrier, num_barriers, &arrive[num_barriers], &leave[num_barriers]); } /* Print results to the file (unless we asked for more than 100,000 * barriers. */ if (num_barriers < 100000) { print_json_results(total_barriers, rank, arrive, leave); } /* Free resources. */ free(arrive); free(leave); }
28.434426
76
0.542808
350314b956daac12614f53ca4a2a81c7d3ae3514
1,964
h
C
EventTracing/TdhWrapper.h
jaeger25/EventTracing
1ee1f8df0893eb4a725b862f103671daf68b3449
[ "MIT" ]
2
2019-06-16T03:39:20.000Z
2020-06-16T14:22:29.000Z
EventTracing/TdhWrapper.h
jaeger25/EventTracing
1ee1f8df0893eb4a725b862f103671daf68b3449
[ "MIT" ]
null
null
null
EventTracing/TdhWrapper.h
jaeger25/EventTracing
1ee1f8df0893eb4a725b862f103671daf68b3449
[ "MIT" ]
null
null
null
#pragma once namespace winrt::FourShot::EventTracing { struct TdhWrapper { static TDHSTATUS TdhFormatProperty_Wrap( _In_ HINSTANCE tdhLibHandle, _In_ PTRACE_EVENT_INFO EventInfo, _In_opt_ PEVENT_MAP_INFO MapInfo, _In_ ULONG PointerSize, _In_ USHORT PropertyInType, _In_ USHORT PropertyOutType, _In_ USHORT PropertyLength, _In_ USHORT UserDataLength, _In_reads_bytes_(UserDataLength) PBYTE UserData, _Inout_ PULONG BufferSize, _Out_writes_bytes_opt_(*BufferSize) PWCHAR Buffer, _Out_ PUSHORT UserDataConsumed); static TDHSTATUS TdhGetPropertySize_Wrap( _In_ HINSTANCE tdhLibHandle, _In_ PEVENT_RECORD pEvent, _In_ ULONG TdhContextCount, _In_reads_opt_(TdhContextCount) PTDH_CONTEXT pTdhContext, _In_ ULONG PropertyDataCount, _In_reads_(PropertyDataCount) PPROPERTY_DATA_DESCRIPTOR pPropertyData, _Out_ ULONG* pPropertySize); static TDHSTATUS TdhGetProperty_Wrap( _In_ HINSTANCE tdhLibHandle, _In_ PEVENT_RECORD pEvent, _In_ ULONG TdhContextCount, _In_reads_opt_(TdhContextCount) PTDH_CONTEXT pTdhContext, _In_ ULONG PropertyDataCount, _In_reads_(PropertyDataCount) PPROPERTY_DATA_DESCRIPTOR pPropertyData, _In_ ULONG BufferSize, _Out_writes_bytes_(BufferSize) PBYTE pBuffer); static TDHSTATUS TdhGetEventInformation_Wrap( _In_ HINSTANCE tdhLibHandle, _In_ PEVENT_RECORD Event, _In_ ULONG TdhContextCount, _In_reads_opt_(TdhContextCount) PTDH_CONTEXT TdhContext, _Out_writes_bytes_opt_(*BufferSize) PTRACE_EVENT_INFO Buffer, _Inout_ PULONG BufferSize); }; }
34.45614
82
0.643075
0099d4ca880c177dbe71111dfb3373bbf6995fe6
1,067
h
C
Framework/Network/Inc/ObjectFactory.h
amyrhzhao/CooEngine
8d467cc53fd8fe3806d726cfe4d7482ad0aca06a
[ "MIT" ]
3
2020-07-23T02:50:11.000Z
2020-10-20T14:49:40.000Z
Framework/Network/Inc/ObjectFactory.h
amyrhzhao/CooEngine
8d467cc53fd8fe3806d726cfe4d7482ad0aca06a
[ "MIT" ]
null
null
null
Framework/Network/Inc/ObjectFactory.h
amyrhzhao/CooEngine
8d467cc53fd8fe3806d726cfe4d7482ad0aca06a
[ "MIT" ]
null
null
null
#ifndef INCLUDED_COOENGINE_NETWORK_OBJECTFACTORY_H #define INCLUDED_COOENGINE_NETWORK_OBJECTFACTORY_H #include "Common.h" // Macro to add Runtime-Type-Information #define RTTI(ClassName)\ static std::string GetTypeName() { return #ClassName; }\ static std::size_t GetTypeId() { return std::hash<std::string>{}(GetTypeName()); }\ static void* CreateInstance() { return new ClassName{}; } namespace Coo::Network { class ObjectFactory { public: template <class T> void Register() { mCreators[T::GetTypeId()] = T::CreateInstance; } template <class T> T* CreateInstance() { return reinterpret_cast<T*>(CreateInstance(T::GetTypeId())); } void* CreateInstance(std::size_t typeId) { ASSERT(mCreators.find(typeId) != mCreators.end(), "Type id %d not registered.", static_cast<int>(typeId)); return mCreators[typeId](); } private: std::unordered_map<std::size_t, std::function<void*()>> mCreators; }; } // namespace Network #endif // !INCLUDED_COOENGINE_NETWORK_OBJECTFACTORY_H
23.711111
84
0.684161
28e363660341dc5980412ec91b47cfae292da781
1,705
h
C
lpp/core/exception.h
stefan-wolfsheimer/LispPlusPlus
f99612ef859b6a2b94cff26b386b11bcbfc299bd
[ "BSL-1.0", "MIT" ]
null
null
null
lpp/core/exception.h
stefan-wolfsheimer/LispPlusPlus
f99612ef859b6a2b94cff26b386b11bcbfc299bd
[ "BSL-1.0", "MIT" ]
null
null
null
lpp/core/exception.h
stefan-wolfsheimer/LispPlusPlus
f99612ef859b6a2b94cff26b386b11bcbfc299bd
[ "BSL-1.0", "MIT" ]
null
null
null
#pragma once #include <exception> #include <lpp/core/object.h> #include <lpp/core/exception.h> namespace Lisp { class Function; class Exception : public std::exception { public: virtual const char * what() const noexcept override; }; class ExceptionWithObject : public Exception { public: ExceptionWithObject(const Cell & _cell); const Object & getObject() const; void setObject(const Cell & _cell); private: Object object; }; class NotAList : public ExceptionWithObject { public: NotAList(const Cell & _cell) : ExceptionWithObject(_cell) {}; virtual const char * what() const noexcept override { return "NotAList"; } }; class IllFormed : public ExceptionWithObject { public: IllFormed(const Cell & _cell) : ExceptionWithObject(_cell) {}; virtual const char * what() const noexcept override { return "IllFormed"; } }; /** * A function argument symbol is given more than one time. */ class ArgumentGivenTwice : public IllFormed { public: ArgumentGivenTwice(const Cell & _symbol) : IllFormed(Lisp::nil) { } ArgumentGivenTwice(const Cell & _symbol, const Cell & _list) : IllFormed(_list) { } const Object & getSymbol() const { return symbol; } private: Object symbol; }; class NonMatchingArguments : public ExceptionWithObject { public: NonMatchingArguments(std::size_t nargs, Function * f); const Function * getFunction() const; std::size_t getNumArgumentsGiven() const; virtual const char * what() const noexcept override; private: std::string msg; std::size_t nargs; }; }
20.297619
67
0.651613
93ebff5a4c42e309693fcb7599fe0acb9425f72b
647
h
C
src/sector_allocator.h
Conservify/phylum
c091e84cf6b5ae1760c086f73731c7180afb58f0
[ "BSD-3-Clause" ]
10
2019-11-26T11:35:56.000Z
2021-07-03T07:21:38.000Z
src/sector_allocator.h
conservify/phylum
9e81f86d1ee1c4a1625182ca96296fa216063831
[ "BSD-3-Clause" ]
1
2019-07-03T06:27:21.000Z
2019-09-06T09:21:27.000Z
src/sector_allocator.h
conservify/phylum
9e81f86d1ee1c4a1625182ca96296fa216063831
[ "BSD-3-Clause" ]
1
2019-09-23T18:13:51.000Z
2019-09-23T18:13:51.000Z
#pragma once #include "dhara_map.h" namespace phylum { class sector_allocator { private: sector_map &sectors_; dhara_sector_t counter_{ 0 }; public: sector_allocator(sector_map &sectors) : sectors_(sectors) { } public: int32_t begin() { counter_ = sectors_.size() + 1; return 0; } virtual dhara_sector_t allocate() { // TODO We should also maintain a free sector collection. We // can do this by just keeping a sector chain with their // numbers. return counter_++; } dhara_sector_t allocated() { return counter_; } }; } // namespace phylum
17.486486
68
0.622875
a3871af05878995694186706cd2ee0dd1f120075
253
h
C
client/ios/notepad/notepad/Controllers/Authenticated/SharedNoteDetailsViewController.h
SuperTanker/tanker-ui-demos
668d2df79bfc508cdab7dfc91ea170cd284a382b
[ "Apache-2.0" ]
12
2018-11-06T16:33:20.000Z
2022-03-05T00:45:41.000Z
client/ios/notepad/notepad/Controllers/Authenticated/SharedNoteDetailsViewController.h
TankerHQ/quickstart-examples
668d2df79bfc508cdab7dfc91ea170cd284a382b
[ "Apache-2.0" ]
8
2020-03-17T17:50:50.000Z
2021-12-24T11:13:04.000Z
client/ios/notepad/notepad/Controllers/Authenticated/SharedNoteDetailsViewController.h
SuperTanker/tanker-ui-demos
668d2df79bfc508cdab7dfc91ea170cd284a382b
[ "Apache-2.0" ]
1
2020-01-07T09:58:06.000Z
2020-01-07T09:58:06.000Z
#import "AuthenticatedViewController.h" #import "NoteTableViewItem.h" NS_ASSUME_NONNULL_BEGIN @interface SharedNoteDetailsViewController : AuthenticatedViewController @property(strong, nonatomic) NoteTableViewItem* note; @end NS_ASSUME_NONNULL_END
19.461538
72
0.853755
a2267c17059578c6c6b1fffba7368ea05afa9519
1,406
h
C
AliPayForDebug/AliPayForDebug/AlipayWallet_Headers/APSocialNoticeDisplayView.h
ceekay1991/AliPayForDebug
5795e5db31e5b649d4758469b752585e63e84d94
[ "MIT" ]
5
2020-03-29T12:08:37.000Z
2021-05-26T05:20:11.000Z
AliPayForDebug/AliPayForDebug/AlipayWallet_Headers/APSocialNoticeDisplayView.h
ceekay1991/AliPayForDebug
5795e5db31e5b649d4758469b752585e63e84d94
[ "MIT" ]
null
null
null
AliPayForDebug/AliPayForDebug/AlipayWallet_Headers/APSocialNoticeDisplayView.h
ceekay1991/AliPayForDebug
5795e5db31e5b649d4758469b752585e63e84d94
[ "MIT" ]
5
2020-04-17T03:24:04.000Z
2022-03-30T05:42:17.000Z
// // Generated by class-dump 3.5 (64 bit) (Debug version compiled Sep 17 2017 16:24:48). // // class-dump is Copyright (C) 1997-1998, 2000-2001, 2004-2015 by Steve Nygard. // #import <UIKit/UIView.h> @class APSocialNoticeContentView, MFAttributeLabel, UIImageView, UILabel; @interface APSocialNoticeDisplayView : UIView { CDUnknownBlockType _tapHandleBlock; APSocialNoticeContentView *_background; UILabel *_titleLabel; MFAttributeLabel *_contentLabel; UIImageView *_accessaryView; } @property(retain, nonatomic) UIImageView *accessaryView; // @synthesize accessaryView=_accessaryView; @property(retain, nonatomic) MFAttributeLabel *contentLabel; // @synthesize contentLabel=_contentLabel; @property(retain, nonatomic) UILabel *titleLabel; // @synthesize titleLabel=_titleLabel; @property(retain, nonatomic) APSocialNoticeContentView *background; // @synthesize background=_background; @property(copy, nonatomic) CDUnknownBlockType tapHandleBlock; // @synthesize tapHandleBlock=_tapHandleBlock; - (void).cxx_destruct; - (void)layoutSubviews; - (void)removeAnimations; - (void)hideAnimated:(_Bool)arg1; - (void)showInView:(id)arg1 animated:(_Bool)arg2; - (void)configureDisplay:(id)arg1; - (id)initWithParameters:(id)arg1; - (void)tapSocialNoticeDisplayView:(id)arg1; - (void)resetLayout; - (void)setupContent:(id)arg1; - (void)commonInitialization; - (void)dealloc; @end
35.15
108
0.770982
d24cbcc309519932e0a6ab38fbdc4bd27fa6a5f5
3,041
c
C
CSAPP/chapter08/homework/shell/job.c
KaiserLancelot/Computer-Theory-Learning
f0787140c444ff38ff3a6896895360d3b8c1b8d0
[ "MIT" ]
4
2019-04-24T02:17:37.000Z
2020-03-24T16:33:28.000Z
CSAPP/chapter08/homework/shell/job.c
KaiserLancelot/Computer-Theory-Learning
f0787140c444ff38ff3a6896895360d3b8c1b8d0
[ "MIT" ]
null
null
null
CSAPP/chapter08/homework/shell/job.c
KaiserLancelot/Computer-Theory-Learning
f0787140c444ff38ff3a6896895360d3b8c1b8d0
[ "MIT" ]
1
2019-03-09T09:41:02.000Z
2019-03-09T09:41:02.000Z
// // Created by kaiser on 19-4-22. // #include "job.h" static volatile sig_atomic_t fg_pid; static volatile Job jobs[MAXJOBS]; static volatile size_t jobs_index; static volatile int jid_counter; static bool NoOtherProcess() { return fg_pid == 0; } bool IsFgPid(pid_t pid) { return fg_pid == pid; } pid_t GetFgPid() { return fg_pid; } void SetFgPid(pid_t pid) { fg_pid = pid; } void PrintJobs() { for (int i = 0; i < jobs_index; ++i) { printf("[%d] %d %s\t%s\n", jobs[i].jid, jobs[i].pid, (jobs[i].is_run ? "Running" : "Stopped"), jobs[i].cmdline); } } int AddJob(pid_t pid, const char *cmdline) { if (jobs_index < MAXJOBS) { Job job = {jid_counter, pid, true}; strcpy(job.cmdline, cmdline); jobs[jobs_index++] = job; return jid_counter++; } else { unix_error("too many jobs"); } } void DeleteJob(pid_t pid) { int i = 0; for (; i < jobs_index; ++i) { if (jobs[i].pid == pid) { break; } } jobs[i] = jobs[--jobs_index]; } Job *FindJobByPid(pid_t pid) { for (int i = 0; i < jobs_index; ++i) { if (jobs[i].pid == pid) { return (Job *)&jobs[i]; } } return NULL; } Job *FindJobByJid(Jid jid) { for (int i = 0; i < jobs_index; ++i) { if (jobs[i].jid == jid) { return (Job *)&jobs[i]; } } return NULL; } void SetStatus(Job *jp, bool is_run) { jp->is_run = is_run; } void HandlerSigchld(int sig) { int old_errno = errno; sigset_t mask_all, prev_all; Sigfillset(&mask_all); pid_t pid; int status; // 有停止/终止/停止并收到 SIGCONT 的子进程则返回 pid , 否则立即返回 0 while ((pid = waitpid(-1, &status, WNOHANG | WUNTRACED | WCONTINUED)) > 0) { if (WIFEXITED(status) || WIFSIGNALED(status)) { if (IsFgPid(pid)) { SetFgPid(0); } if (WIFSIGNALED(status)) { Sio_puts("Job "); Sio_putl(pid); Sio_puts(" terminated by signal: "); Sio_puts(strsignal(WTERMSIG(status))); Sio_puts("\n"); } Sigprocmask(SIG_BLOCK, &mask_all, &prev_all); DeleteJob(pid); Sigprocmask(SIG_SETMASK, &prev_all, NULL); } else if (WIFSTOPPED(status)) { if (IsFgPid(pid)) { SetFgPid(0); } Sio_puts("Job "); Sio_putl(pid); Sio_puts(" stopped by signal: "); Sio_puts(strsignal(WSTOPSIG(status))); Sio_puts("\n"); Sigprocmask(SIG_BLOCK, &mask_all, &prev_all); SetStatus(FindJobByPid(pid), false); Sigprocmask(SIG_SETMASK, &prev_all, NULL); } else if (WIFCONTINUED(status)) { SetFgPid(pid); Sigprocmask(SIG_BLOCK, &mask_all, &prev_all); SetStatus(FindJobByPid(pid), true); Sigprocmask(SIG_SETMASK, &prev_all, NULL); } } errno = old_errno; } void HandlerSigint(int sig) { if (NoOtherProcess()) { Signal(SIGINT, SIG_DFL); Kill(getpid(), SIGINT); } else { Kill(GetFgPid(), SIGINT); } } void HandlerSigtstp(int sig) { if (NoOtherProcess()) { Signal(SIGTSTP, SIG_DFL); Kill(getpid(), SIGTSTP); } else { Kill(GetFgPid(), SIGTSTP); } }
21.877698
78
0.594212
cfa0851429dfe076f852c09d919da588974ab4b6
60,916
h
C
polly/lib/External/isl/include/isl/aff.h
acidburn0zzz/llvm-project
7ca7a2547f00e34f5ec91be776a1d0bbca74b7a9
[ "Apache-2.0" ]
2
2019-04-11T16:25:43.000Z
2020-12-09T10:22:01.000Z
polly/lib/External/isl/include/isl/aff.h
acidburn0zzz/llvm-project
7ca7a2547f00e34f5ec91be776a1d0bbca74b7a9
[ "Apache-2.0" ]
null
null
null
polly/lib/External/isl/include/isl/aff.h
acidburn0zzz/llvm-project
7ca7a2547f00e34f5ec91be776a1d0bbca74b7a9
[ "Apache-2.0" ]
null
null
null
#ifndef ISL_AFF_H #define ISL_AFF_H #include <isl/stdint.h> #include <isl/local_space.h> #include <isl/printer.h> #include <isl/id_type.h> #include <isl/set_type.h> #include <isl/aff_type.h> #include <isl/list.h> #include <isl/multi.h> #include <isl/union_set_type.h> #include <isl/val_type.h> #include <isl/point.h> #if defined(__cplusplus) extern "C" { #endif __isl_overload __isl_give isl_aff *isl_aff_zero_on_domain_space(__isl_take isl_space *space); __isl_export __isl_give isl_aff *isl_space_zero_aff_on_domain(__isl_take isl_space *space); __isl_give isl_aff *isl_aff_zero_on_domain(__isl_take isl_local_space *ls); __isl_give isl_aff *isl_aff_val_on_domain_space(__isl_take isl_space *space, __isl_take isl_val *val); __isl_give isl_aff *isl_aff_val_on_domain(__isl_take isl_local_space *ls, __isl_take isl_val *val); __isl_give isl_aff *isl_aff_var_on_domain(__isl_take isl_local_space *ls, enum isl_dim_type type, unsigned pos); __isl_give isl_aff *isl_aff_nan_on_domain_space(__isl_take isl_space *space); __isl_give isl_aff *isl_aff_nan_on_domain(__isl_take isl_local_space *ls); __isl_give isl_aff *isl_aff_param_on_domain_space_id( __isl_take isl_space *space, __isl_take isl_id *id); __isl_overload __isl_give isl_aff *isl_space_param_aff_on_domain_id( __isl_take isl_space *space, __isl_take isl_id *id); __isl_give isl_aff *isl_aff_copy(__isl_keep isl_aff *aff); __isl_null isl_aff *isl_aff_free(__isl_take isl_aff *aff); isl_ctx *isl_aff_get_ctx(__isl_keep isl_aff *aff); uint32_t isl_aff_get_hash(__isl_keep isl_aff *aff); isl_bool isl_aff_involves_locals(__isl_keep isl_aff *aff); isl_size isl_aff_dim(__isl_keep isl_aff *aff, enum isl_dim_type type); isl_bool isl_aff_involves_dims(__isl_keep isl_aff *aff, enum isl_dim_type type, unsigned first, unsigned n); __isl_give isl_space *isl_aff_get_domain_space(__isl_keep isl_aff *aff); __isl_give isl_space *isl_aff_get_space(__isl_keep isl_aff *aff); __isl_give isl_local_space *isl_aff_get_domain_local_space( __isl_keep isl_aff *aff); __isl_give isl_local_space *isl_aff_get_local_space(__isl_keep isl_aff *aff); const char *isl_aff_get_dim_name(__isl_keep isl_aff *aff, enum isl_dim_type type, unsigned pos); __isl_export __isl_give isl_val *isl_aff_get_constant_val(__isl_keep isl_aff *aff); __isl_give isl_val *isl_aff_get_coefficient_val(__isl_keep isl_aff *aff, enum isl_dim_type type, int pos); int isl_aff_coefficient_sgn(__isl_keep isl_aff *aff, enum isl_dim_type type, int pos); __isl_give isl_val *isl_aff_get_denominator_val(__isl_keep isl_aff *aff); __isl_give isl_aff *isl_aff_set_constant_si(__isl_take isl_aff *aff, int v); __isl_give isl_aff *isl_aff_set_constant_val(__isl_take isl_aff *aff, __isl_take isl_val *v); __isl_give isl_aff *isl_aff_set_coefficient_si(__isl_take isl_aff *aff, enum isl_dim_type type, int pos, int v); __isl_give isl_aff *isl_aff_set_coefficient_val(__isl_take isl_aff *aff, enum isl_dim_type type, int pos, __isl_take isl_val *v); __isl_give isl_aff *isl_aff_add_constant_si(__isl_take isl_aff *aff, int v); __isl_overload __isl_give isl_aff *isl_aff_add_constant_val(__isl_take isl_aff *aff, __isl_take isl_val *v); __isl_give isl_aff *isl_aff_add_constant_num_si(__isl_take isl_aff *aff, int v); __isl_give isl_aff *isl_aff_add_coefficient_si(__isl_take isl_aff *aff, enum isl_dim_type type, int pos, int v); __isl_give isl_aff *isl_aff_add_coefficient_val(__isl_take isl_aff *aff, enum isl_dim_type type, int pos, __isl_take isl_val *v); __isl_export isl_bool isl_aff_is_cst(__isl_keep isl_aff *aff); __isl_give isl_aff *isl_aff_set_tuple_id(__isl_take isl_aff *aff, enum isl_dim_type type, __isl_take isl_id *id); __isl_give isl_aff *isl_aff_set_dim_name(__isl_take isl_aff *aff, enum isl_dim_type type, unsigned pos, const char *s); __isl_give isl_aff *isl_aff_set_dim_id(__isl_take isl_aff *aff, enum isl_dim_type type, unsigned pos, __isl_take isl_id *id); int isl_aff_find_dim_by_name(__isl_keep isl_aff *aff, enum isl_dim_type type, const char *name); isl_bool isl_aff_plain_is_equal(__isl_keep isl_aff *aff1, __isl_keep isl_aff *aff2); isl_bool isl_aff_plain_is_zero(__isl_keep isl_aff *aff); isl_bool isl_aff_is_nan(__isl_keep isl_aff *aff); __isl_give isl_aff *isl_aff_get_div(__isl_keep isl_aff *aff, int pos); __isl_give isl_aff *isl_aff_from_range(__isl_take isl_aff *aff); __isl_export __isl_give isl_aff *isl_aff_neg(__isl_take isl_aff *aff); __isl_export __isl_give isl_aff *isl_aff_ceil(__isl_take isl_aff *aff); __isl_export __isl_give isl_aff *isl_aff_floor(__isl_take isl_aff *aff); __isl_overload __isl_give isl_aff *isl_aff_mod_val(__isl_take isl_aff *aff, __isl_take isl_val *mod); __isl_export __isl_give isl_aff *isl_aff_mul(__isl_take isl_aff *aff1, __isl_take isl_aff *aff2); __isl_export __isl_give isl_aff *isl_aff_div(__isl_take isl_aff *aff1, __isl_take isl_aff *aff2); __isl_export __isl_give isl_aff *isl_aff_add(__isl_take isl_aff *aff1, __isl_take isl_aff *aff2); __isl_export __isl_give isl_aff *isl_aff_sub(__isl_take isl_aff *aff1, __isl_take isl_aff *aff2); __isl_overload __isl_give isl_aff *isl_aff_scale_val(__isl_take isl_aff *aff, __isl_take isl_val *v); __isl_give isl_aff *isl_aff_scale_down_ui(__isl_take isl_aff *aff, unsigned f); __isl_overload __isl_give isl_aff *isl_aff_scale_down_val(__isl_take isl_aff *aff, __isl_take isl_val *v); __isl_give isl_aff *isl_aff_insert_dims(__isl_take isl_aff *aff, enum isl_dim_type type, unsigned first, unsigned n); __isl_give isl_aff *isl_aff_add_dims(__isl_take isl_aff *aff, enum isl_dim_type type, unsigned n); __isl_give isl_aff *isl_aff_move_dims(__isl_take isl_aff *aff, enum isl_dim_type dst_type, unsigned dst_pos, enum isl_dim_type src_type, unsigned src_pos, unsigned n); __isl_give isl_aff *isl_aff_drop_dims(__isl_take isl_aff *aff, enum isl_dim_type type, unsigned first, unsigned n); __isl_give isl_aff *isl_aff_project_domain_on_params(__isl_take isl_aff *aff); __isl_export __isl_give isl_aff *isl_aff_unbind_params_insert_domain( __isl_take isl_aff *aff, __isl_take isl_multi_id *domain); __isl_give isl_aff *isl_aff_align_params(__isl_take isl_aff *aff, __isl_take isl_space *model); __isl_export __isl_give isl_aff *isl_aff_gist(__isl_take isl_aff *aff, __isl_take isl_set *context); __isl_give isl_aff *isl_aff_gist_params(__isl_take isl_aff *aff, __isl_take isl_set *context); __isl_export __isl_give isl_val *isl_aff_eval(__isl_take isl_aff *aff, __isl_take isl_point *pnt); __isl_give isl_aff *isl_aff_pullback_aff(__isl_take isl_aff *aff1, __isl_take isl_aff *aff2); __isl_overload __isl_give isl_aff *isl_aff_pullback_multi_aff(__isl_take isl_aff *aff, __isl_take isl_multi_aff *ma); __isl_give isl_basic_set *isl_aff_zero_basic_set(__isl_take isl_aff *aff); __isl_give isl_basic_set *isl_aff_neg_basic_set(__isl_take isl_aff *aff); __isl_give isl_basic_set *isl_aff_eq_basic_set(__isl_take isl_aff *aff1, __isl_take isl_aff *aff2); __isl_export __isl_give isl_set *isl_aff_eq_set(__isl_take isl_aff *aff1, __isl_take isl_aff *aff2); __isl_export __isl_give isl_set *isl_aff_ne_set(__isl_take isl_aff *aff1, __isl_take isl_aff *aff2); __isl_give isl_basic_set *isl_aff_le_basic_set(__isl_take isl_aff *aff1, __isl_take isl_aff *aff2); __isl_export __isl_give isl_set *isl_aff_le_set(__isl_take isl_aff *aff1, __isl_take isl_aff *aff2); __isl_give isl_basic_set *isl_aff_lt_basic_set(__isl_take isl_aff *aff1, __isl_take isl_aff *aff2); __isl_export __isl_give isl_set *isl_aff_lt_set(__isl_take isl_aff *aff1, __isl_take isl_aff *aff2); __isl_give isl_basic_set *isl_aff_ge_basic_set(__isl_take isl_aff *aff1, __isl_take isl_aff *aff2); __isl_export __isl_give isl_set *isl_aff_ge_set(__isl_take isl_aff *aff1, __isl_take isl_aff *aff2); __isl_give isl_basic_set *isl_aff_gt_basic_set(__isl_take isl_aff *aff1, __isl_take isl_aff *aff2); __isl_export __isl_give isl_set *isl_aff_gt_set(__isl_take isl_aff *aff1, __isl_take isl_aff *aff2); __isl_overload __isl_give isl_basic_set *isl_aff_bind_id(__isl_take isl_aff *aff, __isl_take isl_id *id); __isl_constructor __isl_give isl_aff *isl_aff_read_from_str(isl_ctx *ctx, const char *str); __isl_give char *isl_aff_to_str(__isl_keep isl_aff *aff); __isl_give isl_printer *isl_printer_print_aff(__isl_take isl_printer *p, __isl_keep isl_aff *aff); void isl_aff_dump(__isl_keep isl_aff *aff); isl_ctx *isl_pw_aff_get_ctx(__isl_keep isl_pw_aff *pwaff); uint32_t isl_pw_aff_get_hash(__isl_keep isl_pw_aff *pa); __isl_give isl_space *isl_pw_aff_get_domain_space(__isl_keep isl_pw_aff *pwaff); __isl_give isl_space *isl_pw_aff_get_space(__isl_keep isl_pw_aff *pwaff); __isl_constructor __isl_give isl_pw_aff *isl_pw_aff_from_aff(__isl_take isl_aff *aff); __isl_give isl_pw_aff *isl_pw_aff_empty(__isl_take isl_space *space); __isl_give isl_pw_aff *isl_pw_aff_alloc(__isl_take isl_set *set, __isl_take isl_aff *aff); __isl_give isl_pw_aff *isl_pw_aff_zero_on_domain( __isl_take isl_local_space *ls); __isl_give isl_pw_aff *isl_pw_aff_var_on_domain(__isl_take isl_local_space *ls, enum isl_dim_type type, unsigned pos); __isl_give isl_pw_aff *isl_pw_aff_nan_on_domain_space( __isl_take isl_space *space); __isl_give isl_pw_aff *isl_pw_aff_nan_on_domain(__isl_take isl_local_space *ls); __isl_give isl_pw_aff *isl_pw_aff_val_on_domain(__isl_take isl_set *domain, __isl_take isl_val *v); __isl_overload __isl_give isl_pw_aff *isl_pw_aff_param_on_domain_id( __isl_take isl_set *domain, __isl_take isl_id *id); __isl_export __isl_give isl_pw_aff *isl_set_indicator_function(__isl_take isl_set *set); const char *isl_pw_aff_get_dim_name(__isl_keep isl_pw_aff *pa, enum isl_dim_type type, unsigned pos); isl_bool isl_pw_aff_has_dim_id(__isl_keep isl_pw_aff *pa, enum isl_dim_type type, unsigned pos); __isl_give isl_id *isl_pw_aff_get_dim_id(__isl_keep isl_pw_aff *pa, enum isl_dim_type type, unsigned pos); __isl_give isl_pw_aff *isl_pw_aff_set_dim_id(__isl_take isl_pw_aff *pma, enum isl_dim_type type, unsigned pos, __isl_take isl_id *id); int isl_pw_aff_find_dim_by_name(__isl_keep isl_pw_aff *pa, enum isl_dim_type type, const char *name); isl_bool isl_pw_aff_is_empty(__isl_keep isl_pw_aff *pwaff); isl_bool isl_pw_aff_involves_nan(__isl_keep isl_pw_aff *pa); int isl_pw_aff_plain_cmp(__isl_keep isl_pw_aff *pa1, __isl_keep isl_pw_aff *pa2); isl_bool isl_pw_aff_plain_is_equal(__isl_keep isl_pw_aff *pwaff1, __isl_keep isl_pw_aff *pwaff2); isl_bool isl_pw_aff_is_equal(__isl_keep isl_pw_aff *pa1, __isl_keep isl_pw_aff *pa2); __isl_give isl_pw_aff *isl_pw_aff_union_min(__isl_take isl_pw_aff *pwaff1, __isl_take isl_pw_aff *pwaff2); __isl_give isl_pw_aff *isl_pw_aff_union_max(__isl_take isl_pw_aff *pwaff1, __isl_take isl_pw_aff *pwaff2); __isl_export __isl_give isl_pw_aff *isl_pw_aff_union_add(__isl_take isl_pw_aff *pwaff1, __isl_take isl_pw_aff *pwaff2); __isl_give isl_pw_aff *isl_pw_aff_copy(__isl_keep isl_pw_aff *pwaff); __isl_null isl_pw_aff *isl_pw_aff_free(__isl_take isl_pw_aff *pwaff); isl_size isl_pw_aff_dim(__isl_keep isl_pw_aff *pwaff, enum isl_dim_type type); isl_bool isl_pw_aff_involves_param_id(__isl_keep isl_pw_aff *pa, __isl_keep isl_id *id); isl_bool isl_pw_aff_involves_dims(__isl_keep isl_pw_aff *pwaff, enum isl_dim_type type, unsigned first, unsigned n); isl_bool isl_pw_aff_is_cst(__isl_keep isl_pw_aff *pwaff); __isl_export __isl_give isl_pw_aff *isl_pw_aff_insert_domain(__isl_take isl_pw_aff *pa, __isl_take isl_space *domain); __isl_give isl_pw_aff *isl_pw_aff_project_domain_on_params( __isl_take isl_pw_aff *pa); __isl_give isl_pw_aff *isl_pw_aff_align_params(__isl_take isl_pw_aff *pwaff, __isl_take isl_space *model); __isl_give isl_pw_aff *isl_pw_aff_drop_unused_params( __isl_take isl_pw_aff *pa); isl_bool isl_pw_aff_has_tuple_id(__isl_keep isl_pw_aff *pa, enum isl_dim_type type); __isl_give isl_id *isl_pw_aff_get_tuple_id(__isl_keep isl_pw_aff *pa, enum isl_dim_type type); __isl_give isl_pw_aff *isl_pw_aff_set_tuple_id(__isl_take isl_pw_aff *pwaff, enum isl_dim_type type, __isl_take isl_id *id); __isl_give isl_pw_aff *isl_pw_aff_reset_tuple_id(__isl_take isl_pw_aff *pa, enum isl_dim_type type); __isl_give isl_pw_aff *isl_pw_aff_reset_user(__isl_take isl_pw_aff *pa); __isl_give isl_set *isl_pw_aff_params(__isl_take isl_pw_aff *pwa); __isl_export __isl_give isl_set *isl_pw_aff_domain(__isl_take isl_pw_aff *pwaff); __isl_give isl_pw_aff *isl_pw_aff_from_range(__isl_take isl_pw_aff *pwa); __isl_export __isl_give isl_pw_aff *isl_pw_aff_min(__isl_take isl_pw_aff *pwaff1, __isl_take isl_pw_aff *pwaff2); __isl_export __isl_give isl_pw_aff *isl_pw_aff_max(__isl_take isl_pw_aff *pwaff1, __isl_take isl_pw_aff *pwaff2); __isl_export __isl_give isl_pw_aff *isl_pw_aff_mul(__isl_take isl_pw_aff *pwaff1, __isl_take isl_pw_aff *pwaff2); __isl_export __isl_give isl_pw_aff *isl_pw_aff_div(__isl_take isl_pw_aff *pa1, __isl_take isl_pw_aff *pa2); __isl_export __isl_give isl_pw_aff *isl_pw_aff_add(__isl_take isl_pw_aff *pwaff1, __isl_take isl_pw_aff *pwaff2); __isl_export __isl_give isl_pw_aff *isl_pw_aff_sub(__isl_take isl_pw_aff *pwaff1, __isl_take isl_pw_aff *pwaff2); __isl_export __isl_give isl_pw_aff *isl_pw_aff_neg(__isl_take isl_pw_aff *pwaff); __isl_export __isl_give isl_pw_aff *isl_pw_aff_ceil(__isl_take isl_pw_aff *pwaff); __isl_export __isl_give isl_pw_aff *isl_pw_aff_floor(__isl_take isl_pw_aff *pwaff); __isl_overload __isl_give isl_pw_aff *isl_pw_aff_mod_val(__isl_take isl_pw_aff *pa, __isl_take isl_val *mod); __isl_export __isl_give isl_pw_aff *isl_pw_aff_tdiv_q(__isl_take isl_pw_aff *pa1, __isl_take isl_pw_aff *pa2); __isl_export __isl_give isl_pw_aff *isl_pw_aff_tdiv_r(__isl_take isl_pw_aff *pa1, __isl_take isl_pw_aff *pa2); __isl_export __isl_give isl_pw_aff *isl_pw_aff_intersect_params(__isl_take isl_pw_aff *pa, __isl_take isl_set *set); __isl_export __isl_give isl_pw_aff *isl_pw_aff_intersect_domain(__isl_take isl_pw_aff *pa, __isl_take isl_set *set); __isl_give isl_pw_aff *isl_pw_aff_intersect_domain_wrapped_domain( __isl_take isl_pw_aff *pa, __isl_take isl_set *set); __isl_give isl_pw_aff *isl_pw_aff_intersect_domain_wrapped_range( __isl_take isl_pw_aff *pa, __isl_take isl_set *set); __isl_export __isl_give isl_pw_aff *isl_pw_aff_subtract_domain(__isl_take isl_pw_aff *pa, __isl_take isl_set *set); __isl_export __isl_give isl_pw_aff *isl_pw_aff_cond(__isl_take isl_pw_aff *cond, __isl_take isl_pw_aff *pwaff_true, __isl_take isl_pw_aff *pwaff_false); __isl_overload __isl_give isl_pw_aff *isl_pw_aff_add_constant_val(__isl_take isl_pw_aff *pa, __isl_take isl_val *v); __isl_overload __isl_give isl_pw_aff *isl_pw_aff_scale_val(__isl_take isl_pw_aff *pa, __isl_take isl_val *v); __isl_overload __isl_give isl_pw_aff *isl_pw_aff_scale_down_val(__isl_take isl_pw_aff *pa, __isl_take isl_val *f); __isl_give isl_pw_aff *isl_pw_aff_insert_dims(__isl_take isl_pw_aff *pwaff, enum isl_dim_type type, unsigned first, unsigned n); __isl_give isl_pw_aff *isl_pw_aff_add_dims(__isl_take isl_pw_aff *pwaff, enum isl_dim_type type, unsigned n); __isl_give isl_pw_aff *isl_pw_aff_move_dims(__isl_take isl_pw_aff *pa, enum isl_dim_type dst_type, unsigned dst_pos, enum isl_dim_type src_type, unsigned src_pos, unsigned n); __isl_give isl_pw_aff *isl_pw_aff_drop_dims(__isl_take isl_pw_aff *pwaff, enum isl_dim_type type, unsigned first, unsigned n); __isl_export __isl_give isl_pw_aff *isl_pw_aff_coalesce(__isl_take isl_pw_aff *pa); __isl_export __isl_give isl_pw_aff *isl_pw_aff_gist(__isl_take isl_pw_aff *pwaff, __isl_take isl_set *context); __isl_give isl_pw_aff *isl_pw_aff_gist_params(__isl_take isl_pw_aff *pwaff, __isl_take isl_set *context); __isl_export __isl_give isl_val *isl_pw_aff_eval(__isl_take isl_pw_aff *pa, __isl_take isl_point *pnt); __isl_overload __isl_give isl_pw_aff *isl_pw_aff_pullback_multi_aff( __isl_take isl_pw_aff *pa, __isl_take isl_multi_aff *ma); __isl_overload __isl_give isl_pw_aff *isl_pw_aff_pullback_pw_multi_aff( __isl_take isl_pw_aff *pa, __isl_take isl_pw_multi_aff *pma); __isl_overload __isl_give isl_pw_aff *isl_pw_aff_pullback_multi_pw_aff( __isl_take isl_pw_aff *pa, __isl_take isl_multi_pw_aff *mpa); isl_size isl_pw_aff_n_piece(__isl_keep isl_pw_aff *pwaff); isl_stat isl_pw_aff_foreach_piece(__isl_keep isl_pw_aff *pwaff, isl_stat (*fn)(__isl_take isl_set *set, __isl_take isl_aff *aff, void *user), void *user); isl_bool isl_pw_aff_every_piece(__isl_keep isl_pw_aff *pa, isl_bool (*test)(__isl_keep isl_set *set, __isl_keep isl_aff *aff, void *user), void *user); __isl_export isl_bool isl_pw_aff_isa_aff(__isl_keep isl_pw_aff *pa); __isl_export __isl_give isl_aff *isl_pw_aff_as_aff(__isl_take isl_pw_aff *pa); __isl_export __isl_give isl_map *isl_pw_aff_as_map(__isl_take isl_pw_aff *pa); __isl_give isl_set *isl_set_from_pw_aff(__isl_take isl_pw_aff *pwaff); __isl_give isl_map *isl_map_from_pw_aff(__isl_take isl_pw_aff *pwaff); __isl_give isl_set *isl_pw_aff_pos_set(__isl_take isl_pw_aff *pa); __isl_give isl_set *isl_pw_aff_nonneg_set(__isl_take isl_pw_aff *pwaff); __isl_give isl_set *isl_pw_aff_zero_set(__isl_take isl_pw_aff *pwaff); __isl_give isl_set *isl_pw_aff_non_zero_set(__isl_take isl_pw_aff *pwaff); __isl_export __isl_give isl_set *isl_pw_aff_eq_set(__isl_take isl_pw_aff *pwaff1, __isl_take isl_pw_aff *pwaff2); __isl_export __isl_give isl_set *isl_pw_aff_ne_set(__isl_take isl_pw_aff *pwaff1, __isl_take isl_pw_aff *pwaff2); __isl_export __isl_give isl_set *isl_pw_aff_le_set(__isl_take isl_pw_aff *pwaff1, __isl_take isl_pw_aff *pwaff2); __isl_export __isl_give isl_set *isl_pw_aff_lt_set(__isl_take isl_pw_aff *pwaff1, __isl_take isl_pw_aff *pwaff2); __isl_export __isl_give isl_set *isl_pw_aff_ge_set(__isl_take isl_pw_aff *pwaff1, __isl_take isl_pw_aff *pwaff2); __isl_export __isl_give isl_set *isl_pw_aff_gt_set(__isl_take isl_pw_aff *pwaff1, __isl_take isl_pw_aff *pwaff2); __isl_give isl_map *isl_pw_aff_eq_map(__isl_take isl_pw_aff *pa1, __isl_take isl_pw_aff *pa2); __isl_give isl_map *isl_pw_aff_le_map(__isl_take isl_pw_aff *pa1, __isl_take isl_pw_aff *pa2); __isl_give isl_map *isl_pw_aff_lt_map(__isl_take isl_pw_aff *pa1, __isl_take isl_pw_aff *pa2); __isl_give isl_map *isl_pw_aff_ge_map(__isl_take isl_pw_aff *pa1, __isl_take isl_pw_aff *pa2); __isl_give isl_map *isl_pw_aff_gt_map(__isl_take isl_pw_aff *pa1, __isl_take isl_pw_aff *pa2); __isl_export __isl_give isl_pw_aff *isl_pw_aff_bind_domain(__isl_take isl_pw_aff *pa, __isl_take isl_multi_id *tuple); __isl_export __isl_give isl_pw_aff *isl_pw_aff_bind_domain_wrapped_domain( __isl_take isl_pw_aff *pa, __isl_take isl_multi_id *tuple); __isl_overload __isl_give isl_set *isl_pw_aff_bind_id(__isl_take isl_pw_aff *pa, __isl_take isl_id *id); __isl_constructor __isl_give isl_pw_aff *isl_pw_aff_read_from_str(isl_ctx *ctx, const char *str); __isl_give char *isl_pw_aff_to_str(__isl_keep isl_pw_aff *pa); __isl_give isl_printer *isl_printer_print_pw_aff(__isl_take isl_printer *p, __isl_keep isl_pw_aff *pwaff); void isl_pw_aff_dump(__isl_keep isl_pw_aff *pwaff); __isl_give isl_pw_aff *isl_pw_aff_list_min(__isl_take isl_pw_aff_list *list); __isl_give isl_pw_aff *isl_pw_aff_list_max(__isl_take isl_pw_aff_list *list); __isl_give isl_set *isl_pw_aff_list_eq_set(__isl_take isl_pw_aff_list *list1, __isl_take isl_pw_aff_list *list2); __isl_give isl_set *isl_pw_aff_list_ne_set(__isl_take isl_pw_aff_list *list1, __isl_take isl_pw_aff_list *list2); __isl_give isl_set *isl_pw_aff_list_le_set(__isl_take isl_pw_aff_list *list1, __isl_take isl_pw_aff_list *list2); __isl_give isl_set *isl_pw_aff_list_lt_set(__isl_take isl_pw_aff_list *list1, __isl_take isl_pw_aff_list *list2); __isl_give isl_set *isl_pw_aff_list_ge_set(__isl_take isl_pw_aff_list *list1, __isl_take isl_pw_aff_list *list2); __isl_give isl_set *isl_pw_aff_list_gt_set(__isl_take isl_pw_aff_list *list1, __isl_take isl_pw_aff_list *list2); ISL_DECLARE_MULTI(aff) ISL_DECLARE_MULTI_IDENTITY(aff) ISL_DECLARE_MULTI_CMP(aff) ISL_DECLARE_MULTI_ARITH(aff) ISL_DECLARE_MULTI_ADD_CONSTANT(aff) ISL_DECLARE_MULTI_ZERO(aff) ISL_DECLARE_MULTI_NAN(aff) ISL_DECLARE_MULTI_DIMS(aff) ISL_DECLARE_MULTI_INSERT_DOMAIN(aff) ISL_DECLARE_MULTI_LOCALS(aff) ISL_DECLARE_MULTI_DIM_ID(aff) ISL_DECLARE_MULTI_TUPLE_ID(aff) ISL_DECLARE_MULTI_WITH_DOMAIN(aff) ISL_DECLARE_MULTI_BIND_DOMAIN(aff) ISL_DECLARE_MULTI_UNBIND_PARAMS(aff) __isl_constructor __isl_give isl_multi_aff *isl_multi_aff_from_aff(__isl_take isl_aff *aff); __isl_export __isl_give isl_multi_aff *isl_multi_aff_domain_map(__isl_take isl_space *space); __isl_export __isl_give isl_multi_aff *isl_space_domain_map_multi_aff( __isl_take isl_space *space); __isl_export __isl_give isl_multi_aff *isl_multi_aff_range_map(__isl_take isl_space *space); __isl_export __isl_give isl_multi_aff *isl_space_range_map_multi_aff( __isl_take isl_space *space); __isl_give isl_multi_aff *isl_multi_aff_project_out_map( __isl_take isl_space *space, enum isl_dim_type type, unsigned first, unsigned n); __isl_overload __isl_give isl_multi_aff *isl_multi_aff_multi_val_on_domain_space( __isl_take isl_space *space, __isl_take isl_multi_val *mv); __isl_overload __isl_give isl_multi_aff *isl_space_multi_aff_on_domain_multi_val( __isl_take isl_space *space, __isl_take isl_multi_val *mv); __isl_give isl_multi_aff *isl_multi_aff_multi_val_on_space( __isl_take isl_space *space, __isl_take isl_multi_val *mv); __isl_export __isl_give isl_multi_val *isl_multi_aff_get_constant_multi_val( __isl_keep isl_multi_aff *ma); __isl_export __isl_give isl_multi_aff *isl_multi_aff_floor(__isl_take isl_multi_aff *ma); __isl_give isl_multi_aff *isl_multi_aff_gist_params( __isl_take isl_multi_aff *maff, __isl_take isl_set *context); __isl_export __isl_give isl_multi_aff *isl_multi_aff_gist(__isl_take isl_multi_aff *maff, __isl_take isl_set *context); __isl_give isl_multi_aff *isl_multi_aff_lift(__isl_take isl_multi_aff *maff, __isl_give isl_local_space **ls); __isl_overload __isl_give isl_multi_aff *isl_multi_aff_pullback_multi_aff( __isl_take isl_multi_aff *ma1, __isl_take isl_multi_aff *ma2); __isl_give isl_multi_aff *isl_multi_aff_move_dims(__isl_take isl_multi_aff *ma, enum isl_dim_type dst_type, unsigned dst_pos, enum isl_dim_type src_type, unsigned src_pos, unsigned n); __isl_give isl_set *isl_multi_aff_lex_lt_set(__isl_take isl_multi_aff *ma1, __isl_take isl_multi_aff *ma2); __isl_give isl_set *isl_multi_aff_lex_le_set(__isl_take isl_multi_aff *ma1, __isl_take isl_multi_aff *ma2); __isl_give isl_set *isl_multi_aff_lex_gt_set(__isl_take isl_multi_aff *ma1, __isl_take isl_multi_aff *ma2); __isl_give isl_set *isl_multi_aff_lex_ge_set(__isl_take isl_multi_aff *ma1, __isl_take isl_multi_aff *ma2); __isl_export __isl_give isl_basic_set *isl_multi_aff_bind(__isl_take isl_multi_aff *ma, __isl_take isl_multi_id *tuple); __isl_give char *isl_multi_aff_to_str(__isl_keep isl_multi_aff *ma); __isl_give isl_printer *isl_printer_print_multi_aff(__isl_take isl_printer *p, __isl_keep isl_multi_aff *maff); __isl_constructor __isl_give isl_multi_aff *isl_multi_aff_read_from_str(isl_ctx *ctx, const char *str); void isl_multi_aff_dump(__isl_keep isl_multi_aff *maff); ISL_DECLARE_MULTI(pw_aff) ISL_DECLARE_MULTI_IDENTITY(pw_aff) ISL_DECLARE_MULTI_ARITH(pw_aff) ISL_DECLARE_MULTI_MIN_MAX(pw_aff) ISL_DECLARE_MULTI_ADD_CONSTANT(pw_aff) ISL_DECLARE_MULTI_ZERO(pw_aff) ISL_DECLARE_MULTI_NAN(pw_aff) ISL_DECLARE_MULTI_DIMS(pw_aff) ISL_DECLARE_MULTI_DIM_ID(pw_aff) ISL_DECLARE_MULTI_INSERT_DOMAIN(pw_aff) ISL_DECLARE_MULTI_TUPLE_ID(pw_aff) ISL_DECLARE_MULTI_WITH_DOMAIN(pw_aff) ISL_DECLARE_MULTI_BIND_DOMAIN(pw_aff) ISL_DECLARE_MULTI_PARAM(pw_aff) ISL_DECLARE_MULTI_UNBIND_PARAMS(pw_aff) __isl_export __isl_give isl_pw_multi_aff *isl_pw_multi_aff_zero(__isl_take isl_space *space); __isl_overload __isl_give isl_pw_multi_aff *isl_pw_multi_aff_identity_on_domain_space( __isl_take isl_space *space); __isl_export __isl_give isl_pw_multi_aff *isl_space_identity_pw_multi_aff_on_domain( __isl_take isl_space *space); __isl_give isl_pw_multi_aff *isl_pw_multi_aff_identity( __isl_take isl_space *space); __isl_export __isl_give isl_pw_multi_aff *isl_pw_multi_aff_domain_map( __isl_take isl_space *space); __isl_export __isl_give isl_pw_multi_aff *isl_space_domain_map_pw_multi_aff( __isl_take isl_space *space); __isl_export __isl_give isl_pw_multi_aff *isl_pw_multi_aff_range_map( __isl_take isl_space *space); __isl_export __isl_give isl_pw_multi_aff *isl_space_range_map_pw_multi_aff( __isl_take isl_space *space); __isl_give isl_pw_multi_aff *isl_pw_multi_aff_project_out_map( __isl_take isl_space *space, enum isl_dim_type type, unsigned first, unsigned n); __isl_export __isl_give isl_pw_multi_aff *isl_multi_aff_to_pw_multi_aff( __isl_take isl_multi_aff *ma); __isl_constructor __isl_give isl_pw_multi_aff *isl_pw_multi_aff_from_multi_aff( __isl_take isl_multi_aff *ma); __isl_constructor __isl_give isl_pw_multi_aff *isl_pw_multi_aff_from_pw_aff( __isl_take isl_pw_aff *pa); __isl_give isl_pw_multi_aff *isl_pw_multi_aff_alloc(__isl_take isl_set *set, __isl_take isl_multi_aff *maff); __isl_give isl_pw_multi_aff *isl_pw_multi_aff_copy( __isl_keep isl_pw_multi_aff *pma); __isl_null isl_pw_multi_aff *isl_pw_multi_aff_free( __isl_take isl_pw_multi_aff *pma); isl_size isl_pw_multi_aff_dim(__isl_keep isl_pw_multi_aff *pma, enum isl_dim_type type); __isl_export isl_bool isl_pw_multi_aff_involves_locals(__isl_keep isl_pw_multi_aff *pma); isl_bool isl_pw_multi_aff_involves_param_id(__isl_keep isl_pw_multi_aff *pma, __isl_keep isl_id *id); isl_bool isl_pw_multi_aff_involves_dims(__isl_keep isl_pw_multi_aff *pma, enum isl_dim_type type, unsigned first, unsigned n); __isl_export __isl_give isl_pw_aff *isl_pw_multi_aff_get_at( __isl_keep isl_pw_multi_aff *pma, int pos); __isl_give isl_pw_aff *isl_pw_multi_aff_get_pw_aff( __isl_keep isl_pw_multi_aff *pma, int pos); __isl_give isl_pw_multi_aff *isl_pw_multi_aff_set_pw_aff( __isl_take isl_pw_multi_aff *pma, unsigned pos, __isl_take isl_pw_aff *pa); isl_ctx *isl_pw_multi_aff_get_ctx(__isl_keep isl_pw_multi_aff *pma); __isl_give isl_space *isl_pw_multi_aff_get_domain_space( __isl_keep isl_pw_multi_aff *pma); __isl_export __isl_give isl_space *isl_pw_multi_aff_get_space( __isl_keep isl_pw_multi_aff *pma); isl_bool isl_pw_multi_aff_has_tuple_name(__isl_keep isl_pw_multi_aff *pma, enum isl_dim_type type); const char *isl_pw_multi_aff_get_tuple_name(__isl_keep isl_pw_multi_aff *pma, enum isl_dim_type type); __isl_export __isl_give isl_id *isl_pw_multi_aff_get_range_tuple_id( __isl_keep isl_pw_multi_aff *pma); __isl_give isl_id *isl_pw_multi_aff_get_tuple_id( __isl_keep isl_pw_multi_aff *pma, enum isl_dim_type type); __isl_export isl_bool isl_pw_multi_aff_has_range_tuple_id(__isl_keep isl_pw_multi_aff *pma); isl_bool isl_pw_multi_aff_has_tuple_id(__isl_keep isl_pw_multi_aff *pma, enum isl_dim_type type); __isl_give isl_pw_multi_aff *isl_pw_multi_aff_set_tuple_id( __isl_take isl_pw_multi_aff *pma, enum isl_dim_type type, __isl_take isl_id *id); __isl_overload __isl_give isl_pw_multi_aff *isl_pw_multi_aff_set_range_tuple_id( __isl_take isl_pw_multi_aff *pma, __isl_take isl_id *id); __isl_give isl_pw_multi_aff *isl_pw_multi_aff_reset_tuple_id( __isl_take isl_pw_multi_aff *pma, enum isl_dim_type type); __isl_give isl_pw_multi_aff *isl_pw_multi_aff_reset_user( __isl_take isl_pw_multi_aff *pma); int isl_pw_multi_aff_find_dim_by_name(__isl_keep isl_pw_multi_aff *pma, enum isl_dim_type type, const char *name); __isl_give isl_pw_multi_aff *isl_pw_multi_aff_drop_dims( __isl_take isl_pw_multi_aff *pma, enum isl_dim_type type, unsigned first, unsigned n); __isl_export __isl_give isl_set *isl_pw_multi_aff_domain(__isl_take isl_pw_multi_aff *pma); __isl_give isl_pw_multi_aff *isl_pw_multi_aff_empty(__isl_take isl_space *space); __isl_give isl_pw_multi_aff *isl_pw_multi_aff_from_domain( __isl_take isl_set *set); __isl_export __isl_give isl_pw_multi_aff *isl_pw_multi_aff_multi_val_on_domain( __isl_take isl_set *domain, __isl_take isl_multi_val *mv); __isl_overload __isl_give isl_pw_multi_aff *isl_set_pw_multi_aff_on_domain_multi_val( __isl_take isl_set *domain, __isl_take isl_multi_val *mv); const char *isl_pw_multi_aff_get_dim_name(__isl_keep isl_pw_multi_aff *pma, enum isl_dim_type type, unsigned pos); __isl_give isl_id *isl_pw_multi_aff_get_dim_id( __isl_keep isl_pw_multi_aff *pma, enum isl_dim_type type, unsigned pos); __isl_give isl_pw_multi_aff *isl_pw_multi_aff_set_dim_id( __isl_take isl_pw_multi_aff *pma, enum isl_dim_type type, unsigned pos, __isl_take isl_id *id); isl_bool isl_pw_multi_aff_involves_nan(__isl_keep isl_pw_multi_aff *pma); isl_bool isl_pw_multi_aff_plain_is_equal(__isl_keep isl_pw_multi_aff *pma1, __isl_keep isl_pw_multi_aff *pma2); isl_bool isl_pw_multi_aff_is_equal(__isl_keep isl_pw_multi_aff *pma1, __isl_keep isl_pw_multi_aff *pma2); __isl_give isl_pw_multi_aff *isl_pw_multi_aff_fix_si( __isl_take isl_pw_multi_aff *pma, enum isl_dim_type type, unsigned pos, int value); __isl_export __isl_give isl_pw_multi_aff *isl_pw_multi_aff_union_add( __isl_take isl_pw_multi_aff *pma1, __isl_take isl_pw_multi_aff *pma2); __isl_give isl_pw_multi_aff *isl_pw_multi_aff_neg( __isl_take isl_pw_multi_aff *pma); __isl_export __isl_give isl_pw_multi_aff *isl_pw_multi_aff_add( __isl_take isl_pw_multi_aff *pma1, __isl_take isl_pw_multi_aff *pma2); __isl_export __isl_give isl_pw_multi_aff *isl_pw_multi_aff_sub( __isl_take isl_pw_multi_aff *pma1, __isl_take isl_pw_multi_aff *pma2); __isl_overload __isl_give isl_pw_multi_aff *isl_pw_multi_aff_add_constant_val( __isl_take isl_pw_multi_aff *pma, __isl_take isl_val *v); __isl_overload __isl_give isl_pw_multi_aff *isl_pw_multi_aff_add_constant_multi_val( __isl_take isl_pw_multi_aff *pma, __isl_take isl_multi_val *mv); __isl_overload __isl_give isl_pw_multi_aff *isl_pw_multi_aff_scale_val( __isl_take isl_pw_multi_aff *pma, __isl_take isl_val *v); __isl_overload __isl_give isl_pw_multi_aff *isl_pw_multi_aff_scale_down_val( __isl_take isl_pw_multi_aff *pma, __isl_take isl_val *v); __isl_give isl_pw_multi_aff *isl_pw_multi_aff_scale_multi_val( __isl_take isl_pw_multi_aff *pma, __isl_take isl_multi_val *mv); __isl_give isl_pw_multi_aff *isl_pw_multi_aff_union_lexmin( __isl_take isl_pw_multi_aff *pma1, __isl_take isl_pw_multi_aff *pma2); __isl_give isl_pw_multi_aff *isl_pw_multi_aff_union_lexmax( __isl_take isl_pw_multi_aff *pma1, __isl_take isl_pw_multi_aff *pma2); __isl_give isl_multi_aff *isl_multi_aff_flatten_domain( __isl_take isl_multi_aff *ma); __isl_export __isl_give isl_pw_multi_aff *isl_pw_multi_aff_range_product( __isl_take isl_pw_multi_aff *pma1, __isl_take isl_pw_multi_aff *pma2); __isl_export __isl_give isl_pw_multi_aff *isl_pw_multi_aff_flat_range_product( __isl_take isl_pw_multi_aff *pma1, __isl_take isl_pw_multi_aff *pma2); __isl_export __isl_give isl_pw_multi_aff *isl_pw_multi_aff_product( __isl_take isl_pw_multi_aff *pma1, __isl_take isl_pw_multi_aff *pma2); __isl_export __isl_give isl_pw_multi_aff *isl_pw_multi_aff_range_factor_domain( __isl_take isl_pw_multi_aff *pma); __isl_export __isl_give isl_pw_multi_aff *isl_pw_multi_aff_range_factor_range( __isl_take isl_pw_multi_aff *pma); __isl_export __isl_give isl_pw_multi_aff *isl_pw_multi_aff_intersect_params( __isl_take isl_pw_multi_aff *pma, __isl_take isl_set *set); __isl_export __isl_give isl_pw_multi_aff *isl_pw_multi_aff_intersect_domain( __isl_take isl_pw_multi_aff *pma, __isl_take isl_set *set); __isl_give isl_pw_multi_aff *isl_pw_multi_aff_intersect_domain_wrapped_domain( __isl_take isl_pw_multi_aff *pma, __isl_take isl_set *set); __isl_give isl_pw_multi_aff *isl_pw_multi_aff_intersect_domain_wrapped_range( __isl_take isl_pw_multi_aff *pma, __isl_take isl_set *set); __isl_export __isl_give isl_pw_multi_aff *isl_pw_multi_aff_subtract_domain( __isl_take isl_pw_multi_aff *pma, __isl_take isl_set *set); __isl_export __isl_give isl_pw_multi_aff *isl_pw_multi_aff_insert_domain( __isl_take isl_pw_multi_aff *pma, __isl_take isl_space *domain); __isl_give isl_pw_multi_aff *isl_pw_multi_aff_project_domain_on_params( __isl_take isl_pw_multi_aff *pma); __isl_give isl_pw_multi_aff *isl_pw_multi_aff_align_params( __isl_take isl_pw_multi_aff *pma, __isl_take isl_space *model); __isl_give isl_pw_multi_aff *isl_pw_multi_aff_drop_unused_params( __isl_take isl_pw_multi_aff *pma); __isl_export __isl_give isl_pw_multi_aff *isl_pw_multi_aff_coalesce( __isl_take isl_pw_multi_aff *pma); __isl_give isl_pw_multi_aff *isl_pw_multi_aff_gist_params( __isl_take isl_pw_multi_aff *pma, __isl_take isl_set *set); __isl_export __isl_give isl_pw_multi_aff *isl_pw_multi_aff_gist( __isl_take isl_pw_multi_aff *pma, __isl_take isl_set *set); __isl_overload __isl_give isl_pw_multi_aff *isl_pw_multi_aff_pullback_multi_aff( __isl_take isl_pw_multi_aff *pma, __isl_take isl_multi_aff *ma); __isl_overload __isl_give isl_pw_multi_aff *isl_pw_multi_aff_pullback_pw_multi_aff( __isl_take isl_pw_multi_aff *pma1, __isl_take isl_pw_multi_aff *pma2); __isl_overload __isl_give isl_pw_multi_aff * isl_pw_multi_aff_preimage_domain_wrapped_domain_pw_multi_aff( __isl_take isl_pw_multi_aff *pma1, __isl_take isl_pw_multi_aff *pma2); __isl_export isl_size isl_pw_multi_aff_n_piece(__isl_keep isl_pw_multi_aff *pma); __isl_export isl_stat isl_pw_multi_aff_foreach_piece(__isl_keep isl_pw_multi_aff *pma, isl_stat (*fn)(__isl_take isl_set *set, __isl_take isl_multi_aff *maff, void *user), void *user); isl_bool isl_pw_multi_aff_every_piece(__isl_keep isl_pw_multi_aff *pma, isl_bool (*test)(__isl_keep isl_set *set, __isl_keep isl_multi_aff *ma, void *user), void *user); __isl_export isl_bool isl_pw_multi_aff_isa_multi_aff(__isl_keep isl_pw_multi_aff *pma); __isl_export __isl_give isl_multi_aff *isl_pw_multi_aff_as_multi_aff( __isl_take isl_pw_multi_aff *pma); __isl_export __isl_give isl_map *isl_pw_multi_aff_as_map(__isl_take isl_pw_multi_aff *pma); __isl_give isl_map *isl_map_from_pw_multi_aff(__isl_take isl_pw_multi_aff *pma); __isl_export __isl_give isl_set *isl_pw_multi_aff_as_set(__isl_take isl_pw_multi_aff *pma); __isl_give isl_set *isl_set_from_pw_multi_aff(__isl_take isl_pw_multi_aff *pma); __isl_give char *isl_pw_multi_aff_to_str(__isl_keep isl_pw_multi_aff *pma); __isl_give isl_printer *isl_printer_print_pw_multi_aff(__isl_take isl_printer *p, __isl_keep isl_pw_multi_aff *pma); __isl_export __isl_give isl_pw_multi_aff *isl_set_as_pw_multi_aff(__isl_take isl_set *set); __isl_give isl_pw_multi_aff *isl_pw_multi_aff_from_set(__isl_take isl_set *set); __isl_export __isl_give isl_pw_multi_aff *isl_map_as_pw_multi_aff(__isl_take isl_map *map); __isl_give isl_pw_multi_aff *isl_pw_multi_aff_from_map(__isl_take isl_map *map); __isl_export __isl_give isl_pw_multi_aff *isl_pw_multi_aff_bind_domain( __isl_take isl_pw_multi_aff *pma, __isl_take isl_multi_id *tuple); __isl_export __isl_give isl_pw_multi_aff *isl_pw_multi_aff_bind_domain_wrapped_domain( __isl_take isl_pw_multi_aff *pma, __isl_take isl_multi_id *tuple); __isl_constructor __isl_give isl_pw_multi_aff *isl_pw_multi_aff_read_from_str(isl_ctx *ctx, const char *str); void isl_pw_multi_aff_dump(__isl_keep isl_pw_multi_aff *pma); __isl_overload __isl_give isl_union_pw_multi_aff *isl_union_pw_multi_aff_empty_ctx( isl_ctx *ctx); __isl_give isl_union_pw_multi_aff *isl_union_pw_multi_aff_empty_space( __isl_take isl_space *space); __isl_give isl_union_pw_multi_aff *isl_union_pw_multi_aff_empty( __isl_take isl_space *space); __isl_give isl_union_pw_multi_aff *isl_union_pw_multi_aff_from_aff( __isl_take isl_aff *aff); __isl_constructor __isl_give isl_union_pw_multi_aff *isl_union_pw_multi_aff_from_multi_aff( __isl_take isl_multi_aff *ma); __isl_export __isl_give isl_union_pw_multi_aff *isl_pw_multi_aff_to_union_pw_multi_aff( __isl_take isl_pw_multi_aff *pma); __isl_constructor __isl_give isl_union_pw_multi_aff *isl_union_pw_multi_aff_from_pw_multi_aff( __isl_take isl_pw_multi_aff *pma); __isl_give isl_union_pw_multi_aff *isl_union_pw_multi_aff_from_domain( __isl_take isl_union_set *uset); __isl_give isl_union_pw_multi_aff *isl_union_pw_multi_aff_multi_val_on_domain( __isl_take isl_union_set *domain, __isl_take isl_multi_val *mv); __isl_give isl_union_pw_aff *isl_union_pw_aff_param_on_domain_id( __isl_take isl_union_set *domain, __isl_take isl_id *id); __isl_give isl_union_pw_multi_aff *isl_union_pw_multi_aff_copy( __isl_keep isl_union_pw_multi_aff *upma); __isl_null isl_union_pw_multi_aff *isl_union_pw_multi_aff_free( __isl_take isl_union_pw_multi_aff *upma); __isl_give isl_union_pw_multi_aff *isl_union_set_identity_union_pw_multi_aff( __isl_take isl_union_set *uset); __isl_give isl_union_pw_aff *isl_union_pw_multi_aff_get_union_pw_aff( __isl_keep isl_union_pw_multi_aff *upma, int pos); __isl_give isl_union_pw_multi_aff *isl_union_pw_multi_aff_add_pw_multi_aff( __isl_take isl_union_pw_multi_aff *upma, __isl_take isl_pw_multi_aff *pma); isl_ctx *isl_union_pw_multi_aff_get_ctx( __isl_keep isl_union_pw_multi_aff *upma); __isl_export __isl_give isl_space *isl_union_pw_multi_aff_get_space( __isl_keep isl_union_pw_multi_aff *upma); __isl_export __isl_give isl_pw_multi_aff_list *isl_union_pw_multi_aff_get_pw_multi_aff_list( __isl_keep isl_union_pw_multi_aff *upma); isl_size isl_union_pw_multi_aff_dim(__isl_keep isl_union_pw_multi_aff *upma, enum isl_dim_type type); __isl_give isl_union_pw_multi_aff *isl_union_pw_multi_aff_set_dim_name( __isl_take isl_union_pw_multi_aff *upma, enum isl_dim_type type, unsigned pos, const char *s); int isl_union_pw_multi_aff_find_dim_by_name( __isl_keep isl_union_pw_multi_aff *upma, enum isl_dim_type type, const char *name); __isl_give isl_union_pw_multi_aff *isl_union_pw_multi_aff_drop_dims( __isl_take isl_union_pw_multi_aff *upma, enum isl_dim_type type, unsigned first, unsigned n); __isl_give isl_union_pw_multi_aff *isl_union_pw_multi_aff_reset_user( __isl_take isl_union_pw_multi_aff *upma); __isl_export __isl_give isl_union_pw_multi_aff *isl_union_pw_multi_aff_coalesce( __isl_take isl_union_pw_multi_aff *upma); __isl_give isl_union_pw_multi_aff *isl_union_pw_multi_aff_gist_params( __isl_take isl_union_pw_multi_aff *upma, __isl_take isl_set *context); __isl_export __isl_give isl_union_pw_multi_aff *isl_union_pw_multi_aff_gist( __isl_take isl_union_pw_multi_aff *upma, __isl_take isl_union_set *context); __isl_overload __isl_give isl_union_pw_multi_aff * isl_union_pw_multi_aff_pullback_union_pw_multi_aff( __isl_take isl_union_pw_multi_aff *upma1, __isl_take isl_union_pw_multi_aff *upma2); __isl_overload __isl_give isl_union_pw_multi_aff * isl_union_pw_multi_aff_apply_union_pw_multi_aff( __isl_take isl_union_pw_multi_aff *upma1, __isl_take isl_union_pw_multi_aff *upma2); __isl_overload __isl_give isl_union_pw_multi_aff * isl_union_pw_multi_aff_preimage_domain_wrapped_domain_union_pw_multi_aff( __isl_take isl_union_pw_multi_aff *upma1, __isl_take isl_union_pw_multi_aff *upma2); __isl_give isl_union_pw_multi_aff *isl_union_pw_multi_aff_align_params( __isl_take isl_union_pw_multi_aff *upma, __isl_take isl_space *model); isl_size isl_union_pw_multi_aff_n_pw_multi_aff( __isl_keep isl_union_pw_multi_aff *upma); isl_stat isl_union_pw_multi_aff_foreach_pw_multi_aff( __isl_keep isl_union_pw_multi_aff *upma, isl_stat (*fn)(__isl_take isl_pw_multi_aff *pma, void *user), void *user); isl_bool isl_union_pw_multi_aff_every_pw_multi_aff( __isl_keep isl_union_pw_multi_aff *upma, isl_bool (*test)(__isl_keep isl_pw_multi_aff *pma, void *user), void *user); __isl_export __isl_give isl_pw_multi_aff *isl_union_pw_multi_aff_extract_pw_multi_aff( __isl_keep isl_union_pw_multi_aff *upma, __isl_take isl_space *space); __isl_export isl_bool isl_union_pw_multi_aff_isa_pw_multi_aff( __isl_keep isl_union_pw_multi_aff *upma); __isl_export __isl_give isl_pw_multi_aff *isl_union_pw_multi_aff_as_pw_multi_aff( __isl_take isl_union_pw_multi_aff *upma); __isl_export isl_bool isl_union_pw_multi_aff_plain_is_empty( __isl_keep isl_union_pw_multi_aff *upma); __isl_export isl_bool isl_union_pw_multi_aff_involves_locals( __isl_keep isl_union_pw_multi_aff *upma); isl_bool isl_union_pw_multi_aff_involves_nan( __isl_keep isl_union_pw_multi_aff *upma); isl_bool isl_union_pw_multi_aff_plain_is_equal( __isl_keep isl_union_pw_multi_aff *upma1, __isl_keep isl_union_pw_multi_aff *upma2); __isl_export __isl_give isl_union_set *isl_union_pw_multi_aff_domain( __isl_take isl_union_pw_multi_aff *upma); __isl_give isl_union_pw_multi_aff *isl_union_pw_multi_aff_neg( __isl_take isl_union_pw_multi_aff *upma); __isl_export __isl_give isl_union_pw_multi_aff *isl_union_pw_multi_aff_add( __isl_take isl_union_pw_multi_aff *upma1, __isl_take isl_union_pw_multi_aff *upma2); __isl_export __isl_give isl_union_pw_multi_aff *isl_union_pw_multi_aff_union_add( __isl_take isl_union_pw_multi_aff *upma1, __isl_take isl_union_pw_multi_aff *upma2); __isl_export __isl_give isl_union_pw_multi_aff *isl_union_pw_multi_aff_sub( __isl_take isl_union_pw_multi_aff *upma1, __isl_take isl_union_pw_multi_aff *upma2); __isl_give isl_union_pw_multi_aff *isl_union_pw_multi_aff_scale_val( __isl_take isl_union_pw_multi_aff *upma, __isl_take isl_val *val); __isl_give isl_union_pw_multi_aff *isl_union_pw_multi_aff_scale_down_val( __isl_take isl_union_pw_multi_aff *upma, __isl_take isl_val *val); __isl_give isl_union_pw_multi_aff *isl_union_pw_multi_aff_scale_multi_val( __isl_take isl_union_pw_multi_aff *upma, __isl_take isl_multi_val *mv); __isl_export __isl_give isl_union_pw_multi_aff *isl_union_pw_multi_aff_range_product( __isl_take isl_union_pw_multi_aff *upma1, __isl_take isl_union_pw_multi_aff *upma2); __isl_export __isl_give isl_union_pw_multi_aff *isl_union_pw_multi_aff_flat_range_product( __isl_take isl_union_pw_multi_aff *upma1, __isl_take isl_union_pw_multi_aff *upma2); __isl_export __isl_give isl_union_pw_multi_aff *isl_union_pw_multi_aff_range_factor_domain( __isl_take isl_union_pw_multi_aff *upma); __isl_export __isl_give isl_union_pw_multi_aff *isl_union_pw_multi_aff_range_factor_range( __isl_take isl_union_pw_multi_aff *upma); __isl_export __isl_give isl_union_pw_multi_aff *isl_union_pw_multi_aff_intersect_params( __isl_take isl_union_pw_multi_aff *upma, __isl_take isl_set *set); __isl_overload __isl_give isl_union_pw_multi_aff * isl_union_pw_multi_aff_intersect_domain_union_set( __isl_take isl_union_pw_multi_aff *upma, __isl_take isl_union_set *uset); __isl_give isl_union_pw_multi_aff *isl_union_pw_multi_aff_intersect_domain( __isl_take isl_union_pw_multi_aff *upma, __isl_take isl_union_set *uset); __isl_overload __isl_give isl_union_pw_multi_aff * isl_union_pw_multi_aff_intersect_domain_space( __isl_take isl_union_pw_multi_aff *upma, __isl_take isl_space *space); __isl_export __isl_give isl_union_pw_multi_aff * isl_union_pw_multi_aff_intersect_domain_wrapped_domain( __isl_take isl_union_pw_multi_aff *upma, __isl_take isl_union_set *uset); __isl_export __isl_give isl_union_pw_multi_aff * isl_union_pw_multi_aff_intersect_domain_wrapped_range( __isl_take isl_union_pw_multi_aff *upma, __isl_take isl_union_set *uset); __isl_overload __isl_give isl_union_pw_multi_aff * isl_union_pw_multi_aff_subtract_domain_union_set( __isl_take isl_union_pw_multi_aff *upma, __isl_take isl_union_set *uset); __isl_overload __isl_give isl_union_pw_multi_aff *isl_union_pw_multi_aff_subtract_domain_space( __isl_take isl_union_pw_multi_aff *upma, __isl_take isl_space *space); __isl_give isl_union_pw_multi_aff *isl_union_pw_multi_aff_subtract_domain( __isl_take isl_union_pw_multi_aff *upma, __isl_take isl_union_set *uset); __isl_export __isl_give isl_union_map *isl_union_pw_multi_aff_as_union_map( __isl_take isl_union_pw_multi_aff *upma); __isl_overload __isl_give isl_union_map *isl_union_map_from_union_pw_multi_aff( __isl_take isl_union_pw_multi_aff *upma); __isl_give isl_printer *isl_printer_print_union_pw_multi_aff( __isl_take isl_printer *p, __isl_keep isl_union_pw_multi_aff *upma); __isl_give isl_union_pw_multi_aff *isl_union_pw_multi_aff_from_union_set( __isl_take isl_union_set *uset); __isl_export __isl_give isl_union_pw_multi_aff *isl_union_map_as_union_pw_multi_aff( __isl_take isl_union_map *umap); __isl_give isl_union_pw_multi_aff *isl_union_pw_multi_aff_from_union_map( __isl_take isl_union_map *umap); __isl_constructor __isl_give isl_union_pw_multi_aff *isl_union_pw_multi_aff_read_from_str( isl_ctx *ctx, const char *str); void isl_union_pw_multi_aff_dump(__isl_keep isl_union_pw_multi_aff *upma); __isl_give char *isl_union_pw_multi_aff_to_str( __isl_keep isl_union_pw_multi_aff *upma); uint32_t isl_multi_pw_aff_get_hash(__isl_keep isl_multi_pw_aff *mpa); __isl_constructor __isl_give isl_multi_pw_aff *isl_multi_pw_aff_from_aff(__isl_take isl_aff *aff); __isl_export __isl_give isl_multi_pw_aff *isl_multi_aff_to_multi_pw_aff( __isl_take isl_multi_aff *ma); __isl_constructor __isl_give isl_multi_pw_aff *isl_multi_pw_aff_from_multi_aff( __isl_take isl_multi_aff *ma); __isl_constructor __isl_give isl_multi_pw_aff *isl_multi_pw_aff_from_pw_aff( __isl_take isl_pw_aff *pa); __isl_export __isl_give isl_set *isl_multi_pw_aff_domain(__isl_take isl_multi_pw_aff *mpa); __isl_export __isl_give isl_multi_pw_aff *isl_multi_pw_aff_intersect_params( __isl_take isl_multi_pw_aff *mpa, __isl_take isl_set *set); __isl_export __isl_give isl_multi_pw_aff *isl_multi_pw_aff_intersect_domain( __isl_take isl_multi_pw_aff *mpa, __isl_take isl_set *domain); __isl_export __isl_give isl_multi_pw_aff *isl_multi_pw_aff_coalesce( __isl_take isl_multi_pw_aff *mpa); __isl_export __isl_give isl_multi_pw_aff *isl_multi_pw_aff_gist( __isl_take isl_multi_pw_aff *mpa, __isl_take isl_set *set); __isl_give isl_multi_pw_aff *isl_multi_pw_aff_gist_params( __isl_take isl_multi_pw_aff *mpa, __isl_take isl_set *set); isl_bool isl_multi_pw_aff_is_cst(__isl_keep isl_multi_pw_aff *mpa); isl_bool isl_multi_pw_aff_is_equal(__isl_keep isl_multi_pw_aff *mpa1, __isl_keep isl_multi_pw_aff *mpa2); __isl_overload __isl_give isl_multi_pw_aff *isl_multi_pw_aff_pullback_multi_aff( __isl_take isl_multi_pw_aff *mpa, __isl_take isl_multi_aff *ma); __isl_overload __isl_give isl_multi_pw_aff *isl_multi_pw_aff_pullback_pw_multi_aff( __isl_take isl_multi_pw_aff *mpa, __isl_take isl_pw_multi_aff *pma); __isl_overload __isl_give isl_multi_pw_aff *isl_multi_pw_aff_pullback_multi_pw_aff( __isl_take isl_multi_pw_aff *mpa1, __isl_take isl_multi_pw_aff *mpa2); __isl_export __isl_give isl_multi_pw_aff *isl_multi_pw_aff_union_add( __isl_take isl_multi_pw_aff *mpa1, __isl_take isl_multi_pw_aff *mpa2); __isl_give isl_multi_pw_aff *isl_multi_pw_aff_move_dims( __isl_take isl_multi_pw_aff *pma, enum isl_dim_type dst_type, unsigned dst_pos, enum isl_dim_type src_type, unsigned src_pos, unsigned n); __isl_export isl_bool isl_multi_pw_aff_isa_multi_aff(__isl_keep isl_multi_pw_aff *mpa); __isl_export __isl_give isl_multi_aff *isl_multi_pw_aff_as_multi_aff( __isl_take isl_multi_pw_aff *mpa); __isl_export __isl_give isl_set *isl_multi_pw_aff_as_set(__isl_take isl_multi_pw_aff *mpa); __isl_give isl_set *isl_set_from_multi_pw_aff(__isl_take isl_multi_pw_aff *mpa); __isl_export __isl_give isl_map *isl_multi_pw_aff_as_map(__isl_take isl_multi_pw_aff *mpa); __isl_give isl_map *isl_map_from_multi_pw_aff(__isl_take isl_multi_pw_aff *mpa); __isl_give isl_pw_multi_aff *isl_pw_multi_aff_from_multi_pw_aff( __isl_take isl_multi_pw_aff *mpa); __isl_export __isl_give isl_multi_pw_aff *isl_pw_multi_aff_to_multi_pw_aff( __isl_take isl_pw_multi_aff *pma); __isl_constructor __isl_give isl_multi_pw_aff *isl_multi_pw_aff_from_pw_multi_aff( __isl_take isl_pw_multi_aff *pma); __isl_give isl_map *isl_multi_pw_aff_eq_map(__isl_take isl_multi_pw_aff *mpa1, __isl_take isl_multi_pw_aff *mpa2); __isl_give isl_map *isl_multi_pw_aff_lex_le_map( __isl_take isl_multi_pw_aff *mpa1, __isl_take isl_multi_pw_aff *mpa2); __isl_give isl_map *isl_multi_pw_aff_lex_lt_map( __isl_take isl_multi_pw_aff *mpa1, __isl_take isl_multi_pw_aff *mpa2); __isl_give isl_map *isl_multi_pw_aff_lex_ge_map( __isl_take isl_multi_pw_aff *mpa1, __isl_take isl_multi_pw_aff *mpa2); __isl_give isl_map *isl_multi_pw_aff_lex_gt_map( __isl_take isl_multi_pw_aff *mpa1, __isl_take isl_multi_pw_aff *mpa2); __isl_export __isl_give isl_set *isl_multi_pw_aff_bind(__isl_take isl_multi_pw_aff *mpa, __isl_take isl_multi_id *tuple); __isl_constructor __isl_give isl_multi_pw_aff *isl_multi_pw_aff_read_from_str(isl_ctx *ctx, const char *str); __isl_give char *isl_multi_pw_aff_to_str(__isl_keep isl_multi_pw_aff *mpa); __isl_give isl_printer *isl_printer_print_multi_pw_aff( __isl_take isl_printer *p, __isl_keep isl_multi_pw_aff *mpa); void isl_multi_pw_aff_dump(__isl_keep isl_multi_pw_aff *mpa); __isl_give isl_union_pw_aff *isl_union_pw_aff_copy( __isl_keep isl_union_pw_aff *upa); __isl_null isl_union_pw_aff *isl_union_pw_aff_free( __isl_take isl_union_pw_aff *upa); isl_ctx *isl_union_pw_aff_get_ctx(__isl_keep isl_union_pw_aff *upa); __isl_export __isl_give isl_space *isl_union_pw_aff_get_space( __isl_keep isl_union_pw_aff *upa); __isl_give isl_pw_aff_list *isl_union_pw_aff_get_pw_aff_list( __isl_keep isl_union_pw_aff *upa); isl_size isl_union_pw_aff_dim(__isl_keep isl_union_pw_aff *upa, enum isl_dim_type type); __isl_give isl_union_pw_aff *isl_union_pw_aff_set_dim_name( __isl_take isl_union_pw_aff *upa, enum isl_dim_type type, unsigned pos, const char *s); int isl_union_pw_aff_find_dim_by_name(__isl_keep isl_union_pw_aff *upa, enum isl_dim_type type, const char *name); __isl_give isl_union_pw_aff *isl_union_pw_aff_drop_dims( __isl_take isl_union_pw_aff *upa, enum isl_dim_type type, unsigned first, unsigned n); __isl_give isl_union_pw_aff *isl_union_pw_aff_reset_user( __isl_take isl_union_pw_aff *upa); __isl_give isl_union_pw_aff *isl_union_pw_aff_empty_ctx(isl_ctx *ctx); __isl_give isl_union_pw_aff *isl_union_pw_aff_empty_space( __isl_take isl_space *space); __isl_give isl_union_pw_aff *isl_union_pw_aff_empty( __isl_take isl_space *space); __isl_constructor __isl_give isl_union_pw_aff *isl_union_pw_aff_from_aff(__isl_take isl_aff *aff); __isl_export __isl_give isl_union_pw_aff *isl_pw_aff_to_union_pw_aff( __isl_take isl_pw_aff *pa); __isl_constructor __isl_give isl_union_pw_aff *isl_union_pw_aff_from_pw_aff( __isl_take isl_pw_aff *pa); __isl_give isl_union_pw_aff *isl_union_pw_aff_val_on_domain( __isl_take isl_union_set *domain, __isl_take isl_val *v); __isl_give isl_union_pw_aff *isl_union_pw_aff_aff_on_domain( __isl_take isl_union_set *domain, __isl_take isl_aff *aff); __isl_give isl_union_pw_aff *isl_union_pw_aff_pw_aff_on_domain( __isl_take isl_union_set *domain, __isl_take isl_pw_aff *pa); __isl_give isl_union_pw_aff *isl_union_pw_aff_add_pw_aff( __isl_take isl_union_pw_aff *upa, __isl_take isl_pw_aff *pa); __isl_constructor __isl_give isl_union_pw_multi_aff *isl_union_pw_multi_aff_from_union_pw_aff( __isl_take isl_union_pw_aff *upa); isl_size isl_union_pw_aff_n_pw_aff(__isl_keep isl_union_pw_aff *upa); isl_stat isl_union_pw_aff_foreach_pw_aff(__isl_keep isl_union_pw_aff *upa, isl_stat (*fn)(__isl_take isl_pw_aff *pa, void *user), void *user); isl_bool isl_union_pw_aff_every_pw_aff(__isl_keep isl_union_pw_aff *upa, isl_bool (*test)(__isl_keep isl_pw_aff *pa, void *user), void *user); __isl_give isl_pw_aff *isl_union_pw_aff_extract_pw_aff( __isl_keep isl_union_pw_aff *upa, __isl_take isl_space *space); isl_bool isl_union_pw_aff_involves_nan(__isl_keep isl_union_pw_aff *upa); isl_bool isl_union_pw_aff_plain_is_equal(__isl_keep isl_union_pw_aff *upa1, __isl_keep isl_union_pw_aff *upa2); __isl_export __isl_give isl_union_set *isl_union_pw_aff_domain( __isl_take isl_union_pw_aff *upa); __isl_give isl_union_pw_aff *isl_union_pw_aff_neg( __isl_take isl_union_pw_aff *upa); __isl_export __isl_give isl_union_pw_aff *isl_union_pw_aff_add( __isl_take isl_union_pw_aff *upa1, __isl_take isl_union_pw_aff *upa2); __isl_export __isl_give isl_union_pw_aff *isl_union_pw_aff_union_add( __isl_take isl_union_pw_aff *upa1, __isl_take isl_union_pw_aff *upa2); __isl_export __isl_give isl_union_pw_aff *isl_union_pw_aff_sub( __isl_take isl_union_pw_aff *upa1, __isl_take isl_union_pw_aff *upa2); __isl_export __isl_give isl_union_pw_aff *isl_union_pw_aff_coalesce( __isl_take isl_union_pw_aff *upa); __isl_export __isl_give isl_union_pw_aff *isl_union_pw_aff_gist( __isl_take isl_union_pw_aff *upa, __isl_take isl_union_set *context); __isl_give isl_union_pw_aff *isl_union_pw_aff_gist_params( __isl_take isl_union_pw_aff *upa, __isl_take isl_set *context); __isl_overload __isl_give isl_union_pw_aff *isl_union_pw_aff_pullback_union_pw_multi_aff( __isl_take isl_union_pw_aff *upa, __isl_take isl_union_pw_multi_aff *upma); __isl_give isl_union_pw_aff *isl_union_pw_aff_floor( __isl_take isl_union_pw_aff *upa); __isl_give isl_union_pw_aff *isl_union_pw_aff_scale_val( __isl_take isl_union_pw_aff *upa, __isl_take isl_val *v); __isl_give isl_union_pw_aff *isl_union_pw_aff_scale_down_val( __isl_take isl_union_pw_aff *upa, __isl_take isl_val *v); __isl_give isl_union_pw_aff *isl_union_pw_aff_mod_val( __isl_take isl_union_pw_aff *upa, __isl_take isl_val *f); __isl_give isl_union_pw_aff *isl_union_pw_aff_align_params( __isl_take isl_union_pw_aff *upa, __isl_take isl_space *model); __isl_export __isl_give isl_union_pw_aff *isl_union_pw_aff_intersect_params( __isl_take isl_union_pw_aff *upa, __isl_take isl_set *set); __isl_overload __isl_give isl_union_pw_aff *isl_union_pw_aff_intersect_domain_space( __isl_take isl_union_pw_aff *upa, __isl_take isl_space *space); __isl_overload __isl_give isl_union_pw_aff *isl_union_pw_aff_intersect_domain_union_set( __isl_take isl_union_pw_aff *upa, __isl_take isl_union_set *uset); __isl_give isl_union_pw_aff *isl_union_pw_aff_intersect_domain( __isl_take isl_union_pw_aff *upa, __isl_take isl_union_set *uset); __isl_export __isl_give isl_union_pw_aff *isl_union_pw_aff_intersect_domain_wrapped_domain( __isl_take isl_union_pw_aff *upa, __isl_take isl_union_set *uset); __isl_export __isl_give isl_union_pw_aff *isl_union_pw_aff_intersect_domain_wrapped_range( __isl_take isl_union_pw_aff *upa, __isl_take isl_union_set *uset); __isl_overload __isl_give isl_union_pw_aff *isl_union_pw_aff_subtract_domain_union_set( __isl_take isl_union_pw_aff *upa, __isl_take isl_union_set *uset); __isl_overload __isl_give isl_union_pw_aff *isl_union_pw_aff_subtract_domain_space( __isl_take isl_union_pw_aff *upa, __isl_take isl_space *space); __isl_give isl_union_pw_aff *isl_union_pw_aff_subtract_domain( __isl_take isl_union_pw_aff *upa, __isl_take isl_union_set *uset); __isl_give isl_union_pw_aff *isl_union_pw_aff_set_dim_name( __isl_take isl_union_pw_aff *upa, enum isl_dim_type type, unsigned pos, const char *s); __isl_give isl_union_set *isl_union_pw_aff_zero_union_set( __isl_take isl_union_pw_aff *upa); __isl_give isl_union_map *isl_union_map_from_union_pw_aff( __isl_take isl_union_pw_aff *upa); __isl_overload __isl_give isl_union_set *isl_union_pw_aff_bind_id( __isl_take isl_union_pw_aff *upa, __isl_take isl_id *id); __isl_constructor __isl_give isl_union_pw_aff *isl_union_pw_aff_read_from_str(isl_ctx *ctx, const char *str); __isl_give char *isl_union_pw_aff_to_str(__isl_keep isl_union_pw_aff *upa); __isl_give isl_printer *isl_printer_print_union_pw_aff( __isl_take isl_printer *p, __isl_keep isl_union_pw_aff *upa); void isl_union_pw_aff_dump(__isl_keep isl_union_pw_aff *upa); ISL_DECLARE_MULTI(union_pw_aff) ISL_DECLARE_MULTI_ARITH(union_pw_aff) ISL_DECLARE_MULTI_ZERO(union_pw_aff) ISL_DECLARE_MULTI_NAN(union_pw_aff) ISL_DECLARE_MULTI_DROP_DIMS(union_pw_aff) ISL_DECLARE_MULTI_DIM_ID(union_pw_aff) ISL_DECLARE_MULTI_TUPLE_ID(union_pw_aff) __isl_export __isl_give isl_multi_union_pw_aff *isl_multi_aff_to_multi_union_pw_aff( __isl_take isl_multi_aff *ma); __isl_give isl_multi_union_pw_aff *isl_multi_union_pw_aff_from_multi_aff( __isl_take isl_multi_aff *ma); __isl_constructor __isl_give isl_multi_union_pw_aff *isl_multi_union_pw_aff_from_union_pw_aff( __isl_take isl_union_pw_aff *upa); __isl_constructor __isl_give isl_multi_union_pw_aff *isl_multi_union_pw_aff_from_multi_pw_aff( __isl_take isl_multi_pw_aff *mpa); __isl_give isl_multi_union_pw_aff *isl_multi_union_pw_aff_multi_val_on_domain( __isl_take isl_union_set *domain, __isl_take isl_multi_val *mv); __isl_give isl_multi_union_pw_aff *isl_multi_union_pw_aff_multi_aff_on_domain( __isl_take isl_union_set *domain, __isl_take isl_multi_aff *ma); __isl_give isl_multi_union_pw_aff * isl_multi_union_pw_aff_pw_multi_aff_on_domain(__isl_take isl_union_set *domain, __isl_take isl_pw_multi_aff *pma); __isl_give isl_multi_union_pw_aff *isl_multi_union_pw_aff_floor( __isl_take isl_multi_union_pw_aff *mupa); __isl_export __isl_give isl_multi_union_pw_aff *isl_multi_union_pw_aff_intersect_domain( __isl_take isl_multi_union_pw_aff *mupa, __isl_take isl_union_set *uset); __isl_export __isl_give isl_multi_union_pw_aff *isl_multi_union_pw_aff_intersect_params( __isl_take isl_multi_union_pw_aff *mupa, __isl_take isl_set *params); __isl_give isl_multi_union_pw_aff *isl_multi_union_pw_aff_intersect_range( __isl_take isl_multi_union_pw_aff *mupa, __isl_take isl_set *set); __isl_export __isl_give isl_union_set *isl_multi_union_pw_aff_domain( __isl_take isl_multi_union_pw_aff *mupa); __isl_export __isl_give isl_multi_union_pw_aff *isl_multi_union_pw_aff_coalesce( __isl_take isl_multi_union_pw_aff *mupa); __isl_export __isl_give isl_multi_union_pw_aff *isl_multi_union_pw_aff_gist( __isl_take isl_multi_union_pw_aff *mupa, __isl_take isl_union_set *context); __isl_give isl_multi_union_pw_aff *isl_multi_union_pw_aff_gist_params( __isl_take isl_multi_union_pw_aff *mupa, __isl_take isl_set *context); __isl_give isl_union_pw_aff *isl_multi_union_pw_aff_apply_aff( __isl_take isl_multi_union_pw_aff *mupa, __isl_take isl_aff *aff); __isl_give isl_multi_union_pw_aff *isl_multi_union_pw_aff_apply_multi_aff( __isl_take isl_multi_union_pw_aff *mupa, __isl_take isl_multi_aff *ma); __isl_give isl_union_pw_aff *isl_multi_union_pw_aff_apply_pw_aff( __isl_take isl_multi_union_pw_aff *mupa, __isl_take isl_pw_aff *pa); __isl_give isl_multi_union_pw_aff *isl_multi_union_pw_aff_apply_pw_multi_aff( __isl_take isl_multi_union_pw_aff *mupa, __isl_take isl_pw_multi_aff *pma); __isl_overload __isl_give isl_multi_union_pw_aff * isl_multi_union_pw_aff_pullback_union_pw_multi_aff( __isl_take isl_multi_union_pw_aff *mupa, __isl_take isl_union_pw_multi_aff *upma); __isl_give isl_union_pw_multi_aff * isl_union_pw_multi_aff_from_multi_union_pw_aff( __isl_take isl_multi_union_pw_aff *mupa); __isl_export __isl_give isl_multi_union_pw_aff *isl_multi_union_pw_aff_union_add( __isl_take isl_multi_union_pw_aff *mupa1, __isl_take isl_multi_union_pw_aff *mupa2); __isl_export __isl_give isl_multi_union_pw_aff * isl_union_pw_multi_aff_as_multi_union_pw_aff( __isl_take isl_union_pw_multi_aff *upma); __isl_give isl_multi_union_pw_aff * isl_multi_union_pw_aff_from_union_pw_multi_aff( __isl_take isl_union_pw_multi_aff *upma); __isl_export __isl_give isl_multi_union_pw_aff *isl_union_map_as_multi_union_pw_aff( __isl_take isl_union_map *umap); __isl_give isl_multi_union_pw_aff *isl_multi_union_pw_aff_from_union_map( __isl_take isl_union_map *umap); __isl_overload __isl_give isl_union_map *isl_union_map_from_multi_union_pw_aff( __isl_take isl_multi_union_pw_aff *mupa); __isl_give isl_union_set *isl_multi_union_pw_aff_zero_union_set( __isl_take isl_multi_union_pw_aff *mupa); __isl_export __isl_give isl_union_set *isl_multi_union_pw_aff_bind( __isl_take isl_multi_union_pw_aff *mupa, __isl_take isl_multi_id *tuple); __isl_give isl_multi_pw_aff *isl_multi_union_pw_aff_extract_multi_pw_aff( __isl_keep isl_multi_union_pw_aff *mupa, __isl_take isl_space *space); __isl_constructor __isl_give isl_multi_union_pw_aff *isl_multi_union_pw_aff_read_from_str( isl_ctx *ctx, const char *str); __isl_give char *isl_multi_union_pw_aff_to_str( __isl_keep isl_multi_union_pw_aff *mupa); __isl_give isl_printer *isl_printer_print_multi_union_pw_aff( __isl_take isl_printer *p, __isl_keep isl_multi_union_pw_aff *mupa); void isl_multi_union_pw_aff_dump(__isl_keep isl_multi_union_pw_aff *mupa); ISL_DECLARE_EXPORTED_LIST_FN(aff) ISL_DECLARE_EXPORTED_LIST_FN_READ(aff) ISL_DECLARE_EXPORTED_LIST_FN(pw_aff) ISL_DECLARE_EXPORTED_LIST_FN_READ(pw_aff) ISL_DECLARE_EXPORTED_LIST_FN(pw_multi_aff) ISL_DECLARE_EXPORTED_LIST_FN_READ(pw_multi_aff) ISL_DECLARE_EXPORTED_LIST_FN(union_pw_aff) ISL_DECLARE_EXPORTED_LIST_FN_READ(union_pw_aff) ISL_DECLARE_LIST_FN(union_pw_multi_aff) #if defined(__cplusplus) } #endif #endif
41.271003
81
0.861728
19267572b4b3ce7e163ea184fb07e71f28419463
938
h
C
src/plugins/opencv/bspline.h
martin-pr/possumwood
0ee3e0fe13ef27cf14795a79fb497e4d700bef63
[ "MIT" ]
232
2017-10-09T11:45:28.000Z
2022-03-28T11:14:46.000Z
src/plugins/opencv/bspline.h
LIUJUN-liujun/possumwood
745e48eb44450b0b7f078ece81548812ab1ccc63
[ "MIT" ]
26
2019-01-20T21:38:25.000Z
2021-10-16T03:57:17.000Z
src/plugins/opencv/bspline.h
LIUJUN-liujun/possumwood
745e48eb44450b0b7f078ece81548812ab1ccc63
[ "MIT" ]
33
2017-10-26T19:20:38.000Z
2022-03-16T11:21:43.000Z
#pragma once #include <array> #include <functional> #include <opencv2/opencv.hpp> namespace possumwood { namespace opencv { template <unsigned DEGREE> class BSpline { public: BSpline(unsigned subdiv, const std::array<double, DEGREE>& min = initArray(0.0), const std::array<double, DEGREE>& max = initArray(1.0)); void addSample(const std::array<double, DEGREE>& coords, double value); double sample(const std::array<double, DEGREE>& coords) const; bool operator==(const BSpline& b) const; bool operator!=(const BSpline& b) const; private: static double B(double t, unsigned k); template <typename FN> inline void visit(const std::array<double, DEGREE>& coords, const FN& fn) const; static std::array<double, DEGREE> initArray(double val); std::size_t m_subdiv; std::vector<std::pair<float, float>> m_controls; std::array<double, DEGREE> m_min, m_max; }; } // namespace opencv } // namespace possumwood
26.055556
81
0.717484
c566fdf20840348424ed6c5c9f1dd292e87b5d12
4,138
c
C
src/util/utf8.c
cschlack/libgit2
63970244fb2d49794e7b5d268a2defe4299fd3ad
[ "CC0-1.0" ]
2
2016-02-26T16:36:30.000Z
2019-11-13T17:58:03.000Z
src/util/utf8.c
cschlack/libgit2
63970244fb2d49794e7b5d268a2defe4299fd3ad
[ "CC0-1.0" ]
3
2015-01-17T15:10:29.000Z
2016-03-23T21:26:46.000Z
src/util/utf8.c
cschlack/libgit2
63970244fb2d49794e7b5d268a2defe4299fd3ad
[ "CC0-1.0" ]
5
2015-01-15T15:55:45.000Z
2021-12-15T00:44:15.000Z
/* * Copyright (C) the libgit2 contributors. All rights reserved. * * This file is part of libgit2, distributed under the GNU GPL v2 with * a Linking Exception. For full terms see the included COPYING file. */ #include "utf8.h" #include "git2_util.h" /* * git_utf8_iterate is taken from the utf8proc project, * http://www.public-software-group.org/utf8proc * * Copyright (c) 2009 Public Software Group e. V., Berlin, Germany * * 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. */ static const uint8_t utf8proc_utf8class[256] = { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 0, 0, 0, 0, 0, 0, 0, 0 }; static int utf8_charlen(const uint8_t *str, size_t str_len) { uint8_t length; size_t i; length = utf8proc_utf8class[str[0]]; if (!length) return -1; if (str_len > 0 && length > str_len) return -1; for (i = 1; i < length; i++) { if ((str[i] & 0xC0) != 0x80) return -1; } return (int)length; } int git_utf8_iterate(uint32_t *out, const char *_str, size_t str_len) { const uint8_t *str = (const uint8_t *)_str; uint32_t uc = 0; int length; *out = 0; if ((length = utf8_charlen(str, str_len)) < 0) return -1; switch (length) { case 1: uc = str[0]; break; case 2: uc = ((str[0] & 0x1F) << 6) + (str[1] & 0x3F); if (uc < 0x80) uc = -1; break; case 3: uc = ((str[0] & 0x0F) << 12) + ((str[1] & 0x3F) << 6) + (str[2] & 0x3F); if (uc < 0x800 || (uc >= 0xD800 && uc < 0xE000) || (uc >= 0xFDD0 && uc < 0xFDF0)) uc = -1; break; case 4: uc = ((str[0] & 0x07) << 18) + ((str[1] & 0x3F) << 12) + ((str[2] & 0x3F) << 6) + (str[3] & 0x3F); if (uc < 0x10000 || uc >= 0x110000) uc = -1; break; default: return -1; } if ((uc & 0xFFFF) >= 0xFFFE) return -1; *out = uc; return length; } size_t git_utf8_char_length(const char *_str, size_t str_len) { const uint8_t *str = (const uint8_t *)_str; size_t offset = 0, count = 0; while (offset < str_len) { int length = utf8_charlen(str + offset, str_len - offset); if (length < 0) length = 1; offset += length; count++; } return count; } size_t git_utf8_valid_buf_length(const char *_str, size_t str_len) { const uint8_t *str = (const uint8_t *)_str; size_t offset = 0; while (offset < str_len) { int length = utf8_charlen(str + offset, str_len - offset); if (length < 0) break; offset += length; } return offset; }
27.403974
79
0.594973
6813ea2dd0a4c578f90ac7fb7d38eb1d86d57ec4
3,403
h
C
pigram/SignalServiceKit/src/Contacts/SignalRecipient.h
Carrot20190925/IM
bc0b7aedbe1fa1ee69646fed09ba57849735352d
[ "Apache-2.0" ]
null
null
null
pigram/SignalServiceKit/src/Contacts/SignalRecipient.h
Carrot20190925/IM
bc0b7aedbe1fa1ee69646fed09ba57849735352d
[ "Apache-2.0" ]
null
null
null
pigram/SignalServiceKit/src/Contacts/SignalRecipient.h
Carrot20190925/IM
bc0b7aedbe1fa1ee69646fed09ba57849735352d
[ "Apache-2.0" ]
null
null
null
// // Copyright (c) 2019 Open Whisper Systems. All rights reserved. // #import "BaseModel.h" NS_ASSUME_NONNULL_BEGIN @class SDSAnyReadTransaction; @class SDSAnyWriteTransaction; @class SignalServiceAddress; /// SignalRecipient serves two purposes: /// /// a) It serves as a cache of "known" Signal accounts. When the service indicates /// that an account exists, we make sure that an instance of SignalRecipient exists /// for that recipient id (using mark as registered) and has at least one device. /// When the service indicates that an account does not exist, we remove any devices /// from that SignalRecipient - but do not remove it from the database. /// Note that SignalRecipients without any devices are not considered registered. /// b) We hang the "known device list" for known signal accounts on this entity. @interface SignalRecipient : BaseModel @property (nonatomic, readonly) NSOrderedSet<NSNumber *> *devices; - (instancetype)init NS_UNAVAILABLE; - (instancetype)initWithUniqueId:(NSString *)uniqueId NS_UNAVAILABLE; - (instancetype)initWithAddress:(SignalServiceAddress *)address NS_DESIGNATED_INITIALIZER; // --- CODE GENERATION MARKER // This snippet is generated by /Scripts/sds_codegen/sds_generate.py. Do not manually edit it, instead run `sds_codegen.sh`. // clang-format off - (instancetype)initWithUniqueId:(NSString *)uniqueId devices:(NSOrderedSet<NSNumber *> *)devices recipientPhoneNumber:(nullable NSString *)recipientPhoneNumber recipientSchemaVersion:(NSUInteger)recipientSchemaVersion recipientUUID:(nullable NSString *)recipientUUID NS_SWIFT_NAME(init(uniqueId:devices:recipientPhoneNumber:recipientSchemaVersion:recipientUUID:)); // clang-format on // --- CODE GENERATION MARKER + (nullable instancetype)registeredRecipientForAddress:(SignalServiceAddress *)address mustHaveDevices:(BOOL)mustHaveDevices transaction:(SDSAnyReadTransaction *)transaction; + (instancetype)getOrBuildUnsavedRecipientForAddress:(SignalServiceAddress *)address transaction:(SDSAnyReadTransaction *)transaction; - (void)updateRegisteredRecipientWithDevicesToAdd:(nullable NSArray<NSNumber *> *)devicesToAdd devicesToRemove:(nullable NSArray<NSNumber *> *)devicesToRemove transaction:(SDSAnyWriteTransaction *)transaction; @property (nonatomic, nullable) NSString *recipientPhoneNumber; @property (nonatomic, nullable) NSString *recipientUUID; @property (nonatomic, readonly) SignalServiceAddress *address; - (NSComparisonResult)compare:(SignalRecipient *)other; + (BOOL)isRegisteredRecipient:(SignalServiceAddress *)address transaction:(SDSAnyReadTransaction *)transaction; + (SignalRecipient *)markRecipientAsRegisteredAndGet:(SignalServiceAddress *)address transaction:(SDSAnyWriteTransaction *)transaction; + (void)markRecipientAsRegistered:(SignalServiceAddress *)address deviceId:(UInt32)deviceId transaction:(SDSAnyWriteTransaction *)transaction; + (void)markRecipientAsUnregistered:(SignalServiceAddress *)address transaction:(SDSAnyWriteTransaction *)transaction; @end NS_ASSUME_NONNULL_END
42.5375
124
0.72583
10b94fc3ea78713b9821a1c41a0349fa98de8a5c
245
c
C
regression/ansi-c/Array_Declarator2/main.c
mauguignard/cbmc
70cfdd5d7c62d47269bae2277ff89a9ce66ff0b5
[ "BSD-4-Clause" ]
412
2016-04-02T01:14:27.000Z
2022-03-27T09:24:09.000Z
regression/ansi-c/Array_Declarator2/main.c
mauguignard/cbmc
70cfdd5d7c62d47269bae2277ff89a9ce66ff0b5
[ "BSD-4-Clause" ]
4,671
2016-02-25T13:52:16.000Z
2022-03-31T22:14:46.000Z
regression/ansi-c/Array_Declarator2/main.c
mauguignard/cbmc
70cfdd5d7c62d47269bae2277ff89a9ce66ff0b5
[ "BSD-4-Clause" ]
266
2016-02-23T12:48:00.000Z
2022-03-22T18:15:51.000Z
// Tests a parsing issue regarding array declarators, see Array_Declarator1 // parsing should fail, e.g., gcc says // error: ‘[*]’ not allowed in other than function prototype scope void fooStar(int x[*]) { } int main(void) { return 0; }
17.5
75
0.693878
43935772252d2c11196b4eb7abb6b9052fcdae48
14,584
c
C
Library/OcAppleRamDiskLib/OcAppleRamDiskLib.c
mrmiller/OcSupportPkg
b63d512b618ddb48f8cbdb50cecf73346639f90f
[ "BSD-3-Clause" ]
2
2021-09-16T22:04:18.000Z
2021-11-18T16:58:41.000Z
Library/OcAppleRamDiskLib/OcAppleRamDiskLib.c
Goldfish64/OcSupportPkg
a38b7390026fa8f5da7a4f37757a9547c5ba3f95
[ "BSD-3-Clause" ]
null
null
null
Library/OcAppleRamDiskLib/OcAppleRamDiskLib.c
Goldfish64/OcSupportPkg
a38b7390026fa8f5da7a4f37757a9547c5ba3f95
[ "BSD-3-Clause" ]
null
null
null
/** @file Apple RAM Disk library. Copyright (C) 2019, Download-Fritz. All rights reserved.<BR> This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License which accompanies this distribution. The full text of the license may be found at http://opensource.org/licenses/bsd-license.php. THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. **/ #include <Uefi.h> #include <Guid/OcVariables.h> #include <Protocol/AppleRamDisk.h> #include <Library/BaseMemoryLib.h> #include <Library/OcDebugLogLib.h> #include <Library/MemoryAllocationLib.h> #include <Library/OcAppleRamDiskLib.h> #include <Library/OcFileLib.h> #include <Library/OcGuardLib.h> #include <Library/OcMemoryLib.h> #include <Library/OcMiscLib.h> #include <Library/UefiBootServicesTableLib.h> #include <Library/UefiRuntimeServicesTableLib.h> #include <Library/UefiLib.h> #define INTERNAL_ASSERT_EXTENT_TABLE_VALID(ExtentTable) \ ASSERT ((ExtentTable)->Signature == APPLE_RAM_DISK_EXTENT_SIGNATURE); \ ASSERT ((ExtentTable)->Version == APPLE_RAM_DISK_EXTENT_VERSION); \ ASSERT ((ExtentTable)->Reserved == 0); \ ASSERT ((ExtentTable)->Signature2 == APPLE_RAM_DISK_EXTENT_SIGNATURE); \ ASSERT ((ExtentTable)->ExtentCount > 0); \ ASSERT ((ExtentTable)->ExtentCount <= ARRAY_SIZE ((ExtentTable)->Extents)) /** Insert allocated area into extent list. If no extent list was created, then it gets allocated. @param[in,out] ExtentTable Extent table, potentially pointing to NULL. @param[in] AllocatedArea Allocated area of 1 or more pages. @paran[in] AllocatedAreaSize Actual size of allocated area in bytes. **/ STATIC VOID InternalAddAllocatedArea ( IN OUT APPLE_RAM_DISK_EXTENT_TABLE **ExtentTable, IN EFI_PHYSICAL_ADDRESS AllocatedArea, IN UINTN AllocatedAreaSize ) { APPLE_RAM_DISK_EXTENT_TABLE *Table; ASSERT (AllocatedAreaSize >= EFI_PAGE_SIZE); ZeroMem ( (VOID *) AllocatedArea, EFI_PAGES_TO_SIZE (EFI_SIZE_TO_PAGES (AllocatedAreaSize)) ); if (*ExtentTable == NULL) { *ExtentTable = (APPLE_RAM_DISK_EXTENT_TABLE *) AllocatedArea; (*ExtentTable)->Signature = APPLE_RAM_DISK_EXTENT_SIGNATURE; (*ExtentTable)->Version = APPLE_RAM_DISK_EXTENT_VERSION; (*ExtentTable)->Signature2 = APPLE_RAM_DISK_EXTENT_SIGNATURE; AllocatedArea += EFI_PAGE_SIZE; AllocatedAreaSize -= EFI_PAGE_SIZE; OC_STATIC_ASSERT ( sizeof (APPLE_RAM_DISK_EXTENT_TABLE) == EFI_PAGE_SIZE, "Extent table different from EFI_PAGE_SIZE is unsupported!" ); if (AllocatedAreaSize == 0) { return; } } Table = *ExtentTable; Table->Extents[Table->ExtentCount].Start = AllocatedArea; Table->Extents[Table->ExtentCount].Length = AllocatedAreaSize; ++Table->ExtentCount; } /** Perform allocation of RemainingSize data with biggest contiguous area first strategy. Allocation extent map is put to the first allocated extent. @param[in] BaseAddress Starting allocation address. @param[in] TopAddress Ending allocation address. @param[in] MemoryType Requested memory type. @param[in,out] MemoryMap Current memory map modified as we go. @param[in] MemoryMapSize Current memory map size. @param[in] DescriptorSize Current memory map descriptor size. @param[in] RemainingSize Remaining size to allocate. @param[in,out] ExtentTable Updated pointer to allocated area. @retval Size of allocated data. **/ STATIC UINTN InternalAllocateRemainingSize ( IN EFI_PHYSICAL_ADDRESS BaseAddress, IN EFI_PHYSICAL_ADDRESS TopAddress, IN EFI_MEMORY_TYPE MemoryType, IN OUT EFI_MEMORY_DESCRIPTOR *MemoryMap, IN UINTN MemoryMapSize, IN UINTN DescriptorSize, IN UINTN RemainingSize, IN OUT APPLE_RAM_DISK_EXTENT_TABLE **ExtentTable ) { EFI_STATUS Status; EFI_MEMORY_DESCRIPTOR *EntryWalker; EFI_MEMORY_DESCRIPTOR *BiggestEntry; EFI_PHYSICAL_ADDRESS AllocatedArea; UINTN BiggestSize; UINTN UsedSize; while (RemainingSize > 0 && (*ExtentTable == NULL || (*ExtentTable)->ExtentCount < ARRAY_SIZE ((*ExtentTable)->Extents))) { BiggestEntry = NULL; BiggestSize = 0; for ( EntryWalker = MemoryMap; (UINT8 *)EntryWalker < ((UINT8 *)MemoryMap + MemoryMapSize); EntryWalker = NEXT_MEMORY_DESCRIPTOR (EntryWalker, DescriptorSize)) { if (EntryWalker->Type != EfiConventionalMemory || EntryWalker->PhysicalStart < BaseAddress || EntryWalker->PhysicalStart >= TopAddress) { continue; } UsedSize = EFI_PAGES_TO_SIZE (EntryWalker->NumberOfPages); if (EntryWalker->PhysicalStart + UsedSize > TopAddress) { UsedSize = TopAddress - EntryWalker->PhysicalStart; } if (BiggestEntry == NULL || UsedSize > BiggestSize) { BiggestEntry = EntryWalker; BiggestSize = UsedSize; } } if (BiggestEntry == NULL || BiggestSize == 0) { return FALSE; } UsedSize = MIN (BiggestSize, RemainingSize); AllocatedArea = BiggestEntry->PhysicalStart; Status = gBS->AllocatePages ( AllocateAddress, MemoryType, EFI_SIZE_TO_PAGES (UsedSize), &AllocatedArea ); if (EFI_ERROR (Status)) { return FALSE; } InternalAddAllocatedArea (ExtentTable, AllocatedArea, UsedSize); RemainingSize -= UsedSize; BiggestEntry->PhysicalStart += EFI_SIZE_TO_PAGES (UsedSize); BiggestEntry->NumberOfPages -= EFI_SIZE_TO_PAGES (UsedSize); } return RemainingSize; } /** Request allocation of Size bytes in extents table. Extents are put to the first allocated page. 1. Retrieve actual memory mapping. 2. Do allocation at BASE_4GB if requested. 3. Do additional allocation at any address if still have pages to allocate. @param[in] Size Requested memory size. @param[in] MemoryType Requested memory type. @param[in] PreferHighMem Try to allocate in upper 4GB first. @retval Allocated extent table. **/ STATIC CONST APPLE_RAM_DISK_EXTENT_TABLE * InternalAppleRamDiskAllocate ( IN UINTN Size, IN EFI_MEMORY_TYPE MemoryType, IN BOOLEAN PreferHighMem, IN BOOLEAN AvoidHighMem ) { UINTN MemoryMapSize; EFI_MEMORY_DESCRIPTOR *MemoryMap; UINTN DescriptorSize; UINTN RemainingSize; APPLE_RAM_DISK_EXTENT_TABLE *ExtentTable; MemoryMap = GetCurrentMemoryMap (&MemoryMapSize, &DescriptorSize, NULL, NULL); if (MemoryMap == NULL) { return NULL; } OC_STATIC_ASSERT ( sizeof (APPLE_RAM_DISK_EXTENT_TABLE) == EFI_PAGE_SIZE, "Extent table different from EFI_PAGE_SIZE is unsupported!" ); RemainingSize = Size + EFI_PAGE_SIZE; ExtentTable = NULL; // // We implement PreferHighMem to avoid colliding with the kernel, which sits // in the lower addresses (see more detail in AptioMemoryFix) depending on // KASLR offset generated randomly or with slide boot argument. // if (PreferHighMem && !AvoidHighMem) { RemainingSize = InternalAllocateRemainingSize ( BASE_4GB, BASE_8EB, MemoryType, MemoryMap, MemoryMapSize, DescriptorSize, RemainingSize, &ExtentTable ); } // // This may be tried improved when PreferHighMem is FALSE. // 1. One way is implement a bugtracking algorithm, similar to DF algo originally in place. // The allocations will go recursively from biggest >= BASE_4G until the strategy fails. // When it does, last allocation is discarded, and the strategy tries lower in this case. // memory until success. // The implementation must be very careful about avoiding recursion and high complexity. // 2. Another way could be to try to avoid allocating in kernel area specifically, though // allowing to allocate in lower memory. This has a backdash of allocation failures // when extent amount exceeds the limit, and may want a third pass. It may also collide // with firmware pool allocator. // // None of those (or any extra) are implemented, as with PreferHighMem = TRUE it should // always succeed allocating in higher memory on any host with >= 8 GB of RAM, which is // the requirement for modern macOS. // RemainingSize = InternalAllocateRemainingSize ( 0, AvoidHighMem ? BASE_4GB : BASE_8EB, MemoryType, MemoryMap, MemoryMapSize, DescriptorSize, RemainingSize, &ExtentTable ); if (RemainingSize > 0 && ExtentTable != NULL) { OcAppleRamDiskFree (ExtentTable); ExtentTable = NULL; } return ExtentTable; } CONST APPLE_RAM_DISK_EXTENT_TABLE * OcAppleRamDiskAllocate ( IN UINTN Size, IN EFI_MEMORY_TYPE MemoryType ) { CONST APPLE_RAM_DISK_EXTENT_TABLE *ExtentTable; UINTN AvoidHighMemSize; EFI_STATUS Status; BOOLEAN AvoidHighMem; // // Respect OpenCore recommendation of memory usage. // AvoidHighMemSize = sizeof (AvoidHighMem); Status = gRT->GetVariable ( OC_AVOID_HIGH_ALLOC_VARIABLE_NAME, &gOcVendorVariableGuid, NULL, &AvoidHighMemSize, &AvoidHighMem ); if (EFI_ERROR (Status)) { AvoidHighMem = FALSE; } if (!AvoidHighMem) { // // Try to allocate preferrably above BASE_4GB to avoid colliding with the kernel. // ExtentTable = InternalAppleRamDiskAllocate (Size, MemoryType, TRUE, FALSE); } else { ExtentTable = NULL; } if (ExtentTable == NULL) { // // Being here means that we exceeded entry amount in the extent table. // Retry with any addresses. Should never happen in reality. // ExtentTable = InternalAppleRamDiskAllocate (Size, MemoryType, FALSE, AvoidHighMem); } DEBUG (( DEBUG_BULK_INFO, "OCRAM: Extent allocation of %u bytes (%x) gave %p (avoid high %d)\n", (UINT32) Size, (UINT32) MemoryType, ExtentTable, AvoidHighMem )); return ExtentTable; } BOOLEAN OcAppleRamDiskRead ( IN CONST APPLE_RAM_DISK_EXTENT_TABLE *ExtentTable, IN UINT64 Offset, IN UINTN Size, OUT VOID *Buffer ) { UINT8 *BufferBytes; UINT32 Index; CONST APPLE_RAM_DISK_EXTENT *Extent; UINT64 CurrentOffset; UINT64 LocalOffset; UINTN LocalSize; ASSERT (ExtentTable != NULL); INTERNAL_ASSERT_EXTENT_TABLE_VALID (ExtentTable); ASSERT (Size > 0); ASSERT (Buffer != NULL); BufferBytes = Buffer; for ( Index = 0, CurrentOffset = 0; Index < ExtentTable->ExtentCount; ++Index, CurrentOffset += Extent->Length ) { Extent = &ExtentTable->Extents[Index]; if (Offset >= CurrentOffset) { LocalOffset = (Offset - CurrentOffset); LocalSize = (UINTN)MIN ((Extent->Length - LocalOffset), Size); CopyMem ( BufferBytes, (VOID *)((UINTN)Extent->Start + LocalOffset), LocalSize ); Size -= LocalSize; if (Size == 0) { return TRUE; } BufferBytes += LocalSize; Offset += LocalSize; } } return FALSE; } BOOLEAN OcAppleRamDiskWrite ( IN CONST APPLE_RAM_DISK_EXTENT_TABLE *ExtentTable, IN UINT64 Offset, IN UINTN Size, IN CONST VOID *Buffer ) { CONST UINT8 *BufferBytes; UINT32 Index; CONST APPLE_RAM_DISK_EXTENT *Extent; UINT64 CurrentOffset; UINT64 LocalOffset; UINTN LocalSize; ASSERT (ExtentTable != NULL); INTERNAL_ASSERT_EXTENT_TABLE_VALID (ExtentTable); ASSERT (Size > 0); ASSERT (Buffer != NULL); BufferBytes = Buffer; for ( Index = 0, CurrentOffset = 0; Index < ExtentTable->ExtentCount; ++Index, CurrentOffset += Extent->Length ) { Extent = &ExtentTable->Extents[Index]; if (Offset >= CurrentOffset) { LocalOffset = (Offset - CurrentOffset); LocalSize = (UINTN)MIN ((Extent->Length - LocalOffset), Size); CopyMem ( (VOID *)((UINTN)Extent->Start + LocalOffset), BufferBytes, LocalSize ); Size -= LocalSize; if (Size == 0) { return TRUE; } BufferBytes += LocalSize; Offset += LocalSize; } } return FALSE; } BOOLEAN OcAppleRamDiskLoadFile ( IN CONST APPLE_RAM_DISK_EXTENT_TABLE *ExtentTable, IN EFI_FILE_PROTOCOL *File, IN UINTN FileSize ) { EFI_STATUS Status; UINT64 FilePosition; UINT32 Index; UINTN RequestedSize; UINTN ReadSize; ASSERT (ExtentTable != NULL); INTERNAL_ASSERT_EXTENT_TABLE_VALID (ExtentTable); ASSERT (File != NULL); ASSERT (FileSize > 0); FilePosition = 0; Status = File->SetPosition (File, FilePosition); if (EFI_ERROR (Status)) { return FALSE; } for (Index = 0; FileSize > 0 && Index < ExtentTable->ExtentCount; ++Index) { RequestedSize = ReadSize = MIN (FileSize, ExtentTable->Extents[Index].Length); Status = File->Read ( File, &RequestedSize, (VOID *) ExtentTable->Extents[Index].Start ); if (EFI_ERROR (Status) || RequestedSize != ReadSize) { return FALSE; } FileSize -= RequestedSize; } return TRUE; } VOID OcAppleRamDiskFree ( IN CONST APPLE_RAM_DISK_EXTENT_TABLE *ExtentTable ) { UINT32 Index; ASSERT (ExtentTable != NULL); INTERNAL_ASSERT_EXTENT_TABLE_VALID (ExtentTable); // // Extents are allocated in the first page. // for (Index = 1; Index < ExtentTable->ExtentCount; ++Index) { gBS->FreePages ( ExtentTable->Extents[Index].Start, EFI_SIZE_TO_PAGES (ExtentTable->Extents[Index].Length) ); } gBS->FreePages ( (UINTN) ExtentTable, EFI_SIZE_TO_PAGES (ExtentTable->Extents[Index].Length) + 1 ); }
28.540117
94
0.647833
43f680a393ff15c54a5be276a44c36b3847850c8
1,512
h
C
wallet/laser/connection.h
Atomisfoundation/beam
6b503b4c4f9a69973db74be08fef98c6c5a869de
[ "Apache-2.0" ]
2
2020-03-11T09:10:10.000Z
2020-04-17T13:45:08.000Z
wallet/laser/connection.h
Atomisfoundation/beam
6b503b4c4f9a69973db74be08fef98c6c5a869de
[ "Apache-2.0" ]
null
null
null
wallet/laser/connection.h
Atomisfoundation/beam
6b503b4c4f9a69973db74be08fef98c6c5a869de
[ "Apache-2.0" ]
null
null
null
// Copyright 2019 The Beam Team // // 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 <memory> #include "core/fly_client.h" #include "wallet/core/bbs_miner.h" namespace beam::wallet::laser { using proto::FlyClient; class Connection final : public FlyClient::INetwork { public: explicit Connection(const FlyClient::NetworkStd::Ptr& net); ~Connection(); virtual void Connect() override; virtual void Disconnect() override; virtual void PostRequestInternal(FlyClient::Request& r) override; virtual void BbsSubscribe( BbsChannel ch, Timestamp timestamp, FlyClient::IBbsReceiver* receiver) override; private: void OnMined(); void MineBbsRequest(FlyClient::RequestBbsMsg& r); FlyClient::NetworkStd::Ptr m_pNet; BbsMiner m_Miner; bool m_MineOutgoing = true; std::unordered_map< BbsMiner::Task::Ptr, proto::FlyClient::Request::IHandler*> m_handlers; }; } // namespace beam::wallet::laser
30.24
75
0.714286
a2c9264691f84ccd2450c8ad42e112ee47238a56
246
h
C
Example/HYLogEngine/HYDemoConfiger.h
knighthb/HYLogEngine
080772cab9fdca5919ab21048794bafaec0b71ce
[ "MIT" ]
null
null
null
Example/HYLogEngine/HYDemoConfiger.h
knighthb/HYLogEngine
080772cab9fdca5919ab21048794bafaec0b71ce
[ "MIT" ]
null
null
null
Example/HYLogEngine/HYDemoConfiger.h
knighthb/HYLogEngine
080772cab9fdca5919ab21048794bafaec0b71ce
[ "MIT" ]
null
null
null
// // HYDemoConfiger.h // HYLogEngine // // Created by knight on 16/3/28. // Copyright © 2016年 knight. All rights reserved. // #import <HYLogEngine/HYLogEngine.h> #import "HYLogEngineHeader.h" @interface HYDemoConfiger : HYLogConfiger @end
17.571429
50
0.719512
3144d3543ed14317b4d0eb4bffe03af303292a11
1,284
c
C
scripts/4_World/Classes/UserActionsComponent/Actions/Interact/ActionUnplugThisByCord.c
Da0ne/DayZCommunityOfflineMode
77ebd221a877270e704c75bcc529a7b97c918f2e
[ "MIT" ]
1
2018-11-07T18:38:15.000Z
2018-11-07T18:38:15.000Z
SourceCode/scripts/4_World/Classes/UserActionsComponent/Actions/Interact/ActionUnplugThisByCord.c
DevulTj/DayZOfflineMode
0ba7e58858c7cd62e6a08f451ba60a3961575353
[ "MIT" ]
null
null
null
SourceCode/scripts/4_World/Classes/UserActionsComponent/Actions/Interact/ActionUnplugThisByCord.c
DevulTj/DayZOfflineMode
0ba7e58858c7cd62e6a08f451ba60a3961575353
[ "MIT" ]
null
null
null
class ActionUnplugThisByCord: ActionInteractBase { void ActionUnplugThisByCord() { m_MessageSuccess = "I've unplugged and folded the cord."; m_MessageStart = ""; } override int GetType() { return AT_UNPLUG_THIS_BY_CORD; } override string GetText() { return "unplug by cord"; } override bool ActionCondition( PlayerBase player, ActionTarget target, ItemBase item ) { Object targetObject = target.GetObject(); ItemBase target_IB = ItemBase.Cast( targetObject ); if ( target_IB && target_IB.HasEnergyManager() ) { string selection = targetObject.GetActionComponentName(target.GetComponentIndex()); if ( selection == ComponentEnergyManager.SEL_CORD_PLUGGED ) { return true; } // Special case for unfolded spotlight if ( selection == Spotlight.SEL_CORD_PLUGGED_U ) { return true; } } return false; } override void OnCompleteServer( PlayerBase player, ActionTarget target, ItemBase item, Param acdata ) { ItemBase target_IB = ItemBase.Cast( target.GetObject() ); // cast to ItemBase target_IB.GetCompEM().UnplugThis(); if ( target_IB.IsInherited(Spotlight) ) { target_IB.HideSelection ( Spotlight.SEL_CORD_PLUGGED_U ); target_IB.ShowSelection ( Spotlight.SEL_CORD_FOLDED_U ); } } };
24.226415
102
0.714174
39e82a47ff7a5793fd6a9cbc1137c2a73adfb678
1,872
c
C
targets/TARGET_Realtek/TARGET_AMEBA/TARGET_MCU_RTL8195A/trng_api.c
pattyolanterns/mbed-os
f05af9a870580a0a81688e4d8f94cf72ca17a4d6
[ "Apache-2.0" ]
5
2020-02-18T00:32:15.000Z
2021-08-02T06:16:48.000Z
targets/TARGET_Realtek/TARGET_AMEBA/TARGET_MCU_RTL8195A/trng_api.c
pattyolanterns/mbed-os
f05af9a870580a0a81688e4d8f94cf72ca17a4d6
[ "Apache-2.0" ]
12
2017-12-20T10:12:34.000Z
2018-11-07T21:17:37.000Z
targets/TARGET_Realtek/TARGET_AMEBA/TARGET_MCU_RTL8195A/trng_api.c
pattyolanterns/mbed-os
f05af9a870580a0a81688e4d8f94cf72ca17a4d6
[ "Apache-2.0" ]
8
2020-01-21T08:44:01.000Z
2020-03-12T04:50:28.000Z
/* mbed Microcontroller Library * Copyright (c) 2013-2016 Realtek Semiconductor Corp. * * 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 "trng_api.h" #include "analogin_api.h" #include "analogin_ext.h" #ifdef CONFIG_MBED_ENABLED #include "platform_stdlib.h" #endif #if DEVICE_TRNG void trng_init(trng_t *obj) { _memset((void *)obj, 0, sizeof(trng_t)); analogin_init(&obj->tradcng, (PinName)ADC0); obj->inited = 1; } void trng_free(trng_t *obj) { if (!obj->inited) { return; } obj->inited = 0; analogin_deinit(&obj->tradcng); } static void trng_get_byte(trng_t *obj, unsigned char *byte) { size_t bit; uint32_t adc[2]; PSAL_ADC_MNGT_ADPT pSalADCMngtAdpt = NULL; PSAL_ADC_HND pSalADCHND = NULL; pSalADCMngtAdpt = &(obj->tradcng.SalADCMngtAdpt); pSalADCHND = &(pSalADCMngtAdpt->pSalHndPriv->SalADCHndPriv); *byte = 0; for (bit = 0; bit < 8; bit++) { RtkADCRxManualRotate(pSalADCHND, adc); *byte |= (adc[0] & 0x01) << bit; } } int trng_get_bytes(trng_t *obj, uint8_t *buf, size_t len, size_t *output_len) { size_t i; if (!obj->inited) { return -1; } for (i = 0; i < len; i++) { trng_get_byte(obj, buf + i); } *output_len = len; return 0; } #endif
24
77
0.641026
23251141a7d1d6b6f16bb0c13b1a505e890b68ad
1,221
h
C
dpdk/drivers/crypto/dpaa2_sec/dpaa2_sec_logs.h
muziding/jupiter
1fd7df081f7b459ee5e951ff16ca1741f6c8e021
[ "MIT" ]
287
2017-12-17T14:48:00.000Z
2022-03-28T06:12:07.000Z
dpdk/drivers/crypto/dpaa2_sec/dpaa2_sec_logs.h
Tominous/jupiter
1fd7df081f7b459ee5e951ff16ca1741f6c8e021
[ "MIT" ]
18
2017-12-18T15:50:59.000Z
2020-05-14T09:19:38.000Z
dpdk/drivers/crypto/dpaa2_sec/dpaa2_sec_logs.h
Tominous/jupiter
1fd7df081f7b459ee5e951ff16ca1741f6c8e021
[ "MIT" ]
109
2017-12-19T03:42:09.000Z
2022-03-25T11:25:39.000Z
/* SPDX-License-Identifier: BSD-3-Clause * * Copyright (c) 2016 Freescale Semiconductor, Inc. All rights reserved. * Copyright 2016 NXP * */ #ifndef _DPAA2_SEC_LOGS_H_ #define _DPAA2_SEC_LOGS_H_ #define PMD_INIT_LOG(level, fmt, args...) \ RTE_LOG(level, PMD, "%s(): " fmt "\n", __func__, ##args) #ifdef RTE_LIBRTE_DPAA2_SEC_DEBUG_INIT #define PMD_INIT_FUNC_TRACE() PMD_INIT_LOG(DEBUG, " >>") #else #define PMD_INIT_FUNC_TRACE() do { } while (0) #endif #ifdef RTE_LIBRTE_DPAA2_SEC_DEBUG_RX #define PMD_RX_LOG(level, fmt, args...) \ RTE_LOG(level, PMD, "%s(): " fmt "\n", __func__, ## args) #else #define PMD_RX_LOG(level, fmt, args...) do { } while (0) #endif #ifdef RTE_LIBRTE_DPAA2_SEC_DEBUG_TX #define PMD_TX_LOG(level, fmt, args...) \ RTE_LOG(level, PMD, "%s(): " fmt "\n", __func__, ## args) #else #define PMD_TX_LOG(level, fmt, args...) do { } while (0) #endif #ifdef RTE_LIBRTE_DPAA2_SEC_DEBUG_DRIVER #define PMD_DRV_LOG_RAW(level, fmt, args...) \ RTE_LOG(level, PMD, "%s(): " fmt, __func__, ## args) #else #define PMD_DRV_LOG_RAW(level, fmt, args...) do { } while (0) #endif #define PMD_DRV_LOG(level, fmt, args...) \ PMD_DRV_LOG_RAW(level, fmt "\n", ## args) #endif /* _DPAA2_SEC_LOGS_H_ */
27.133333
74
0.690418
ea790983b6eb8325b3e3f9af7d1caa5240cd3535
18,441
h
C
chrome/browser/autocomplete/base_search_provider.h
anirudhSK/chromium
a8f23c87e656ab9ba49de9ccccbc53f614cdcb41
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
null
null
null
chrome/browser/autocomplete/base_search_provider.h
anirudhSK/chromium
a8f23c87e656ab9ba49de9ccccbc53f614cdcb41
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
null
null
null
chrome/browser/autocomplete/base_search_provider.h
anirudhSK/chromium
a8f23c87e656ab9ba49de9ccccbc53f614cdcb41
[ "BSD-3-Clause-No-Nuclear-License-2014", "BSD-3-Clause" ]
2
2015-04-17T13:19:09.000Z
2021-10-21T12:55:15.000Z
// Copyright 2014 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. // // This class contains common functionality for search-based autocomplete // providers. Search provider and zero suggest provider both use it for common // functionality. #ifndef CHROME_BROWSER_AUTOCOMPLETE_BASE_SEARCH_PROVIDER_H_ #define CHROME_BROWSER_AUTOCOMPLETE_BASE_SEARCH_PROVIDER_H_ #include <map> #include <string> #include <utility> #include <vector> #include "base/memory/scoped_vector.h" #include "base/strings/string16.h" #include "chrome/browser/autocomplete/autocomplete_input.h" #include "chrome/browser/autocomplete/autocomplete_match.h" #include "chrome/browser/autocomplete/autocomplete_provider.h" #include "net/url_request/url_fetcher_delegate.h" class AutocompleteProviderListener; class GURL; class Profile; class SuggestionDeletionHandler; class TemplateURL; namespace base { class ListValue; class Value; } // Base functionality for receiving suggestions from a search engine. // This class is abstract and should only be used as a base for other // autocomplete providers utilizing its functionality. class BaseSearchProvider : public AutocompleteProvider, public net::URLFetcherDelegate { public: // ID used in creating URLFetcher for default provider's suggest results. static const int kDefaultProviderURLFetcherID; // ID used in creating URLFetcher for keyword provider's suggest results. static const int kKeywordProviderURLFetcherID; // ID used in creating URLFetcher for deleting suggestion results. static const int kDeletionURLFetcherID; BaseSearchProvider(AutocompleteProviderListener* listener, Profile* profile, AutocompleteProvider::Type type); // Returns whether |match| is flagged as a query that should be prefetched. static bool ShouldPrefetch(const AutocompleteMatch& match); // AutocompleteProvider: virtual void Stop(bool clear_cached_results) OVERRIDE; virtual void DeleteMatch(const AutocompleteMatch& match) OVERRIDE; virtual void AddProviderInfo(ProvidersInfo* provider_info) const OVERRIDE; bool field_trial_triggered_in_session() const { return field_trial_triggered_in_session_; } protected: // The following keys are used to record additional information on matches. // We annotate our AutocompleteMatches with whether their relevance scores // were server-provided using this key in the |additional_info| field. static const char kRelevanceFromServerKey[]; // Indicates whether the server said a match should be prefetched. static const char kShouldPrefetchKey[]; // Used to store metadata from the server response, which is needed for // prefetching. static const char kSuggestMetadataKey[]; // Used to store a deletion request url for server-provided suggestions. static const char kDeletionUrlKey[]; // These are the values for the above keys. static const char kTrue[]; static const char kFalse[]; virtual ~BaseSearchProvider(); // The Result classes are intermediate representations of AutocompleteMatches, // simply containing relevance-ranked search and navigation suggestions. // They may be cached to provide some synchronous matches while requests for // new suggestions from updated input are in flight. // TODO(msw) Extend these classes to generate their corresponding matches and // other requisite data, in order to consolidate and simplify the // highly fragmented SearchProvider logic for each Result type. class Result { public: Result(bool from_keyword_provider, int relevance, bool relevance_from_server); virtual ~Result(); bool from_keyword_provider() const { return from_keyword_provider_; } const base::string16& match_contents() const { return match_contents_; } const ACMatchClassifications& match_contents_class() const { return match_contents_class_; } int relevance() const { return relevance_; } void set_relevance(int relevance) { relevance_ = relevance; } bool relevance_from_server() const { return relevance_from_server_; } void set_relevance_from_server(bool relevance_from_server) { relevance_from_server_ = relevance_from_server; } // Returns if this result is inlineable against the current input |input|. // Non-inlineable results are stale. virtual bool IsInlineable(const base::string16& input) const = 0; // Returns the default relevance value for this result (which may // be left over from a previous omnibox input) given the current // input and whether the current input caused a keyword provider // to be active. virtual int CalculateRelevance(const AutocompleteInput& input, bool keyword_provider_requested) const = 0; protected: // The contents to be displayed and its style info. base::string16 match_contents_; ACMatchClassifications match_contents_class_; // True if the result came from the keyword provider. bool from_keyword_provider_; // The relevance score. int relevance_; private: // Whether this result's relevance score was fully or partly calculated // based on server information, and thus is assumed to be more accurate. // This is ultimately used in // SearchProvider::ConvertResultsToAutocompleteMatches(), see comments // there. bool relevance_from_server_; }; class SuggestResult : public Result { public: SuggestResult(const base::string16& suggestion, AutocompleteMatchType::Type type, const base::string16& match_contents, const base::string16& match_contents_prefix, const base::string16& annotation, const std::string& suggest_query_params, const std::string& deletion_url, bool from_keyword_provider, int relevance, bool relevance_from_server, bool should_prefetch, const base::string16& input_text); virtual ~SuggestResult(); const base::string16& suggestion() const { return suggestion_; } AutocompleteMatchType::Type type() const { return type_; } const base::string16& match_contents_prefix() const { return match_contents_prefix_; } const base::string16& annotation() const { return annotation_; } const std::string& suggest_query_params() const { return suggest_query_params_; } const std::string& deletion_url() const { return deletion_url_; } bool should_prefetch() const { return should_prefetch_; } // Fills in |match_contents_class_| to reflect how |match_contents_| should // be displayed and bolded against the current |input_text|. If // |allow_bolding_all| is false and |match_contents_class_| would have all // of |match_contents_| bolded, do nothing. void ClassifyMatchContents(const bool allow_bolding_all, const base::string16& input_text); // Result: virtual bool IsInlineable(const base::string16& input) const OVERRIDE; virtual int CalculateRelevance( const AutocompleteInput& input, bool keyword_provider_requested) const OVERRIDE; private: // The search terms to be used for this suggestion. base::string16 suggestion_; AutocompleteMatchType::Type type_; // The contents to be displayed as prefix of match contents. // Used for postfix suggestions to display a leading ellipsis (or some // equivalent character) to indicate omitted text. base::string16 match_contents_prefix_; // Optional annotation for the |match_contents_| for disambiguation. // This may be displayed in the autocomplete match contents, but is defined // separately to facilitate different formatting. base::string16 annotation_; // Optional additional parameters to be added to the search URL. std::string suggest_query_params_; // Optional deletion URL provided with suggestions. Fetching this URL // should result in some reasonable deletion behaviour on the server, // e.g. deleting this term out of a user's server-side search history. std::string deletion_url_; // Should this result be prefetched? bool should_prefetch_; }; class NavigationResult : public Result { public: // |provider| is necessary to use StringForURLDisplay() in order to // compute |formatted_url_|. NavigationResult(const AutocompleteProvider& provider, const GURL& url, const base::string16& description, bool from_keyword_provider, int relevance, bool relevance_from_server, const base::string16& input_text, const std::string& languages); virtual ~NavigationResult(); const GURL& url() const { return url_; } const base::string16& description() const { return description_; } const base::string16& formatted_url() const { return formatted_url_; } // Fills in |match_contents_| and |match_contents_class_| to reflect how // the URL should be displayed and bolded against the current |input_text| // and user |languages|. If |allow_bolding_nothing| is false and // |match_contents_class_| would result in an entirely unbolded // |match_contents_|, do nothing. void CalculateAndClassifyMatchContents(const bool allow_bolding_nothing, const base::string16& input_text, const std::string& languages); // Result: virtual bool IsInlineable(const base::string16& input) const OVERRIDE; virtual int CalculateRelevance( const AutocompleteInput& input, bool keyword_provider_requested) const OVERRIDE; private: // The suggested url for navigation. GURL url_; // The properly formatted ("fixed up") URL string with equivalent meaning // to the one in |url_|. base::string16 formatted_url_; // The suggested navigational result description; generally the site name. base::string16 description_; }; typedef std::vector<SuggestResult> SuggestResults; typedef std::vector<NavigationResult> NavigationResults; typedef std::pair<base::string16, std::string> MatchKey; typedef std::map<MatchKey, AutocompleteMatch> MatchMap; typedef ScopedVector<SuggestionDeletionHandler> SuggestionDeletionHandlers; // A simple structure bundling most of the information (including // both SuggestResults and NavigationResults) returned by a call to // the suggest server. // // This has to be declared after the typedefs since it relies on some of them. struct Results { Results(); ~Results(); // Clears |suggest_results| and |navigation_results| and resets // |verbatim_relevance| to -1 (implies unset). void Clear(); // Returns whether any of the results (including verbatim) have // server-provided scores. bool HasServerProvidedScores() const; // Query suggestions sorted by relevance score. SuggestResults suggest_results; // Navigational suggestions sorted by relevance score. NavigationResults navigation_results; // The server supplied verbatim relevance scores. Negative values // indicate that there is no suggested score; a value of 0 // suppresses the verbatim result. int verbatim_relevance; // The JSON metadata associated with this server response. std::string metadata; private: DISALLOW_COPY_AND_ASSIGN(Results); }; // Returns an AutocompleteMatch with the given |autocomplete_provider| // for the search |suggestion|, which represents a search via |template_url|. // If |template_url| is NULL, returns a match with an invalid destination URL. // // |input| is the original user input. Text in the input is used to highlight // portions of the match contents to distinguish locally-typed text from // suggested text. // // |input| is also necessary for various other details, like whether we should // allow inline autocompletion and what the transition type should be. // |accepted_suggestion| and |omnibox_start_margin| are used to generate // Assisted Query Stats. // |append_extra_query_params| should be set if |template_url| is the default // search engine, so the destination URL will contain any // command-line-specified query params. static AutocompleteMatch CreateSearchSuggestion( AutocompleteProvider* autocomplete_provider, const AutocompleteInput& input, const SuggestResult& suggestion, const TemplateURL* template_url, int accepted_suggestion, int omnibox_start_margin, bool append_extra_query_params); // Parses JSON response received from the provider, stripping XSSI // protection if needed. Returns the parsed data if successful, NULL // otherwise. static scoped_ptr<base::Value> DeserializeJsonData(std::string json_data); // Returns whether we can send the URL of the current page in any suggest // requests. Doing this requires that all the following hold: // * The user has suggest enabled in their settings and is not in incognito // mode. (Incognito disables suggest entirely.) // * The current URL is HTTP, or HTTPS with the same domain as the suggest // server. Non-HTTP[S] URLs (e.g. FTP/file URLs) may contain sensitive // information. HTTPS URLs may also contain sensitive information, but if // they're on the same domain as the suggest server, then the relevant // entity could have already seen/logged this data. // * The suggest request is sent over HTTPS. This avoids leaking the current // page URL in world-readable network traffic. // * The user's suggest provider is Google. We might want to allow other // providers to see this data someday, but for now this has only been // implemented for Google. Also see next bullet. // * The user is OK in principle with sending URLs of current pages to their // provider. Today, there is no explicit setting that controls this, but if // the user has tab sync enabled and tab sync is unencrypted, then they're // already sending this data to Google for sync purposes. Thus we use this // setting as a proxy for "it's OK to send such data". In the future, // especially if we want to support suggest providers other than Google, we // may change this to be a standalone setting or part of some explicit // general opt-in. static bool CanSendURL( const GURL& current_page_url, const GURL& suggest_url, const TemplateURL* template_url, AutocompleteInput::PageClassification page_classification, Profile* profile); // Creates an AutocompleteMatch from |result| to search for the query in // |result|. Adds the created match to |map|; if such a match // already exists, whichever one has lower relevance is eliminated. // |metadata| and |accepted_suggestion| are used for generating an // AutocompleteMatch. void AddMatchToMap(const SuggestResult& result, const std::string& metadata, int accepted_suggestion, MatchMap* map); // Parses results from the suggest server and updates the appropriate suggest // and navigation result lists in |results|. |is_keyword_result| indicates // whether the response was received from the keyword provider. // Returns whether the appropriate result list members were updated. bool ParseSuggestResults(const base::Value& root_val, bool is_keyword_result, Results* results); // Called at the end of ParseSuggestResults to rank the |results|. virtual void SortResults(bool is_keyword, const base::ListValue* relevances, Results* results); // Returns the TemplateURL for the given |result|. virtual const TemplateURL* GetTemplateURL( const SuggestResult& result) const = 0; // Returns the AutocompleteInput for keyword provider or default provider // based on the value of |is_keyword|. virtual const AutocompleteInput GetInput(bool is_keyword) const = 0; // Returns whether the destination URL corresponding to the given |result| // should contain command-line-specified query params. virtual bool ShouldAppendExtraParams(const SuggestResult& result) const = 0; // Stops the suggest query. // NOTE: This does not update |done_|. Callers must do so. virtual void StopSuggest() = 0; // Clears the current results. virtual void ClearAllResults() = 0; // Returns the relevance to use if it was not explicitly set by the server. virtual int GetDefaultResultRelevance() const = 0; // Records in UMA whether the deletion request resulted in success. virtual void RecordDeletionResult(bool success) = 0; // Whether a field trial, if any, has triggered in the most recent // autocomplete query. This field is set to true only if the suggestion // provider has completed and the response contained // '"google:fieldtrialtriggered":true'. bool field_trial_triggered_; // Same as above except that it is maintained across the current Omnibox // session. bool field_trial_triggered_in_session_; private: friend class SearchProviderTest; FRIEND_TEST_ALL_PREFIXES(SearchProviderTest, TestDeleteMatch); // Removes the deleted |match| from the list of |matches_|. void DeleteMatchFromMatches(const AutocompleteMatch& match); // This gets called when we have requested a suggestion deletion from the // server to handle the results of the deletion. It will be called after the // deletion request completes. void OnDeletionComplete(bool success, SuggestionDeletionHandler* handler); // Each deletion handler in this vector corresponds to an outstanding request // that a server delete a personalized suggestion. Making this a ScopedVector // causes us to auto-cancel all such requests on shutdown. SuggestionDeletionHandlers deletion_handlers_; DISALLOW_COPY_AND_ASSIGN(BaseSearchProvider); }; #endif // CHROME_BROWSER_AUTOCOMPLETE_BASE_SEARCH_PROVIDER_H_
41.721719
80
0.720297
267f200823085ab92b95316da74391a0f9d222c2
3,520
c
C
medium/150_Evaluate_Reverse_Polish_Notation/150_Evaluate_Reverse_Polish_Notation.c
ZHANG-YU-CHENG/leetcode
095ecda6cd36e55f65ce469a60a7b6ce4a349c55
[ "MIT" ]
2
2022-02-01T11:20:00.000Z
2022-02-02T06:22:52.000Z
medium/150_Evaluate_Reverse_Polish_Notation/150_Evaluate_Reverse_Polish_Notation.c
ZHANG-YU-CHENG/leetcode
095ecda6cd36e55f65ce469a60a7b6ce4a349c55
[ "MIT" ]
null
null
null
medium/150_Evaluate_Reverse_Polish_Notation/150_Evaluate_Reverse_Polish_Notation.c
ZHANG-YU-CHENG/leetcode
095ecda6cd36e55f65ce469a60a7b6ce4a349c55
[ "MIT" ]
null
null
null
/** * Evaluate the value of an arithmetic expression in Reverse Polish Notation. * Valid operators are +, -, *, and /. Each operand may be an integer or another expression. * Note that division between two integers should truncate toward zero. * It is guaranteed that the given RPN expression is always valid. * That means the expression would always evaluate to a result, and there will not be any division by zero operation. * * * Example 1: * Input: tokens = ["2","1","+","3","*"] * Output: 9 * Explanation: ((2 + 1) * 3) = 9 * * Example 2: * Input: tokens = ["4","13","5","/","+"] * Output: 6 * Explanation: (4 + (13 / 5)) = 6 * * Example 3: * Input: tokens = ["10","6","9","3","+","-11","*","/","*","17","+","5","+"] * Output: 22 * Explanation: ((10 * (6 / ((9 + 3) * -11))) + 17) + 5 * = ((10 * (6 / (12 * -11))) + 17) + 5 * = ((10 * (6 / -132)) + 17) + 5 * = ((10 * 0) + 17) + 5 * = (0 + 17) + 5 * = 17 + 5 * = 22 * * * Constraints: * 1 <= tokens.length <= 104 * tokens[i] is either an operator: "+", "-", "*", or "/", or an integer in the range [-200, 200]. * */ #include <stdio.h> #include <stdlib.h> #include <stdbool.h> #include <cstring> typedef struct stackNode{ char* val; struct stackNode* next; } StackNode; typedef struct { StackNode* top; } RPNStack; RPNStack* RPNStackCreate() { RPNStack* stack = (RPNStack*)malloc(sizeof(RPNStack)); StackNode* dummy = (StackNode*)malloc(sizeof(StackNode)); dummy->val = (char*)"null"; dummy->next = NULL; stack->top = dummy; return stack; } void RPNStackPush(RPNStack* obj, char* val) { StackNode* newNode = (StackNode*)malloc(sizeof(StackNode)); newNode->val = val; newNode->next = obj->top; obj->top = newNode; //the top pointer of stack "obj" move to where the newNode is } void RPNStackPop(RPNStack* obj) { if(obj->top==NULL) return; StackNode* oriTop = obj->top; //save original top node for free memory obj->top = obj->top->next; //free original top node if(oriTop) free(oriTop); oriTop = NULL; } char* RPNStackTop(RPNStack* obj) { return obj->top->val; } bool isOperand(char* token) { return (!strcmp(token, "+")||!strcmp(token, "-")||!strcmp(token, "*")||!strcmp(token, "/")); } char* calculate(char* x1, char* x2, char* operand) { int ix1 = atoi(x1); int ix2 = atoi(x2); char* out = (char*)malloc(sizeof(char)*20); if(!strcmp(operand, "+")) { sprintf(out, "%d", ix1 + ix2); return out; } else if(!strcmp(operand, "-")) { sprintf(out, "%d", ix1 - ix2); return out; } else if(!strcmp(operand, "*")) { sprintf(out, "%d", ix1 * ix2); return out; } else if(!strcmp(operand, "/")) { sprintf(out, "%d", (int)(ix1 / ix2)); return out; } else return (char*)"error"; } int evalRPN(char ** tokens, int tokensSize){ RPNStack* stack = RPNStackCreate(); char* x1 = NULL; char* x2 = NULL; char* tmp = NULL; for(int i=0; i<tokensSize; ++i) { if(isOperand(tokens[i])) { //pop two numbers and do operation x2 = RPNStackTop(stack); RPNStackPop(stack); x1 = RPNStackTop(stack); RPNStackPop(stack); tmp = calculate(x1, x2, tokens[i]); RPNStackPush(stack, tmp); } else { RPNStackPush(stack, tokens[i]); } } return atoi(stack->top->val); }
25.693431
117
0.552273
1e5cd45c23b72b2a02425b5891f9dbc4835a00f8
209
h
C
GPAZJU/UI/View/GZTranparentView.h
dongxinb/GPAZJU3.0
df2c2369bc614eabd0e6085a982b8c44c1a527fa
[ "MIT" ]
5
2016-11-22T01:44:08.000Z
2018-04-22T13:08:14.000Z
GPAZJU/UI/View/GZTranparentView.h
dongxinb/GPAZJU3.0
df2c2369bc614eabd0e6085a982b8c44c1a527fa
[ "MIT" ]
null
null
null
GPAZJU/UI/View/GZTranparentView.h
dongxinb/GPAZJU3.0
df2c2369bc614eabd0e6085a982b8c44c1a527fa
[ "MIT" ]
null
null
null
// // GZTranparentView.h // GPAZJU // // Created by Xinbao Dong on 1/30/16. // Copyright © 2016 com.dongxinbao. All rights reserved. // #import <UIKit/UIKit.h> @interface GZTranparentView : UIView @end
14.928571
57
0.684211
9cf92125a5692fccba3f89a1c56d9d674b147456
1,787
c
C
C_CPP/lib-pcap/grab1.c
egustafson/sandbox
9804e966347b33558b0497a04edb1a591d2d7773
[ "Apache-2.0" ]
2
2019-09-27T21:25:26.000Z
2019-12-29T11:26:54.000Z
C_CPP/lib-pcap/grab1.c
egustafson/sandbox
9804e966347b33558b0497a04edb1a591d2d7773
[ "Apache-2.0" ]
7
2020-08-11T17:32:14.000Z
2020-08-11T17:32:39.000Z
C_CPP/lib-pcap/grab1.c
egustafson/sandbox
9804e966347b33558b0497a04edb1a591d2d7773
[ "Apache-2.0" ]
2
2016-07-18T10:55:50.000Z
2020-08-19T01:46:08.000Z
#include <pcap.h> #include <stdio.h> int main() { pcap_t *handle=0; /* Session handle */ char* dev; /* The device to sniff on */ char errbuf[PCAP_ERRBUF_SIZE]; /* Error string */ struct bpf_program filter; /* The compiled filter */ char filter_app[] = "port 23"; /* The filter expression */ bpf_u_int32 mask; /* Our netmask */ bpf_u_int32 net; /* Our IP */ struct pcap_pkthdr header; /* The header that pcap gives us */ const u_char *packet; /* The actual packet */ int result; /* Define the device */ dev = pcap_lookupdev(errbuf); printf("Listening on %s.\n", dev); /* Find the properties for the device */ result = pcap_lookupnet(dev, &net, &mask, errbuf); printf("pcap_lookupnet() -> %d\n", result); printf("net = 0x%08x\n", net); printf("mask = 0x%08x\n", mask); /* Open the session in promiscuous mode */ handle = pcap_open_live(dev, BUFSIZ, 1, -1, errbuf); printf("handle = 0x%08x\n", handle); printf("BUFSIZ = %d\n", BUFSIZ); /* Compile and apply the filter */ /* pcap_compile(handle, &filter, filter_app, 0, net); */ pcap_compile(handle, &filter, filter_app, 0, mask); result = pcap_setfilter(handle, &filter); printf("result = %d\n", result); sleep(10); printf("Grabbing a packet ...\n"); /* Grab a packet */ packet = pcap_next(handle, &header); /* Print its length */ if ( packet ) { printf("Jacked a packet with length of [%d]\n", header.len); } else { printf("did not capture a packet.\n"); } /* And close the session */ pcap_close(handle); return(0); }
31.350877
75
0.554001
6cee1d0dd91c8d0a2e760b41cd0e920c54dde6bb
364
h
C
rtbench_cpu/render_sse.h
avgorshk/rtbench
9946b8e229724789887126e55939348889d4e76a
[ "MIT" ]
null
null
null
rtbench_cpu/render_sse.h
avgorshk/rtbench
9946b8e229724789887126e55939348889d4e76a
[ "MIT" ]
null
null
null
rtbench_cpu/render_sse.h
avgorshk/rtbench
9946b8e229724789887126e55939348889d4e76a
[ "MIT" ]
null
null
null
#ifndef RTBENCH_RENDER_SSE_H_ #define RTBENCH_RENDER_SSE_H_ #include <vector> #include "common/light.h" #include "common/sphere.h" namespace sse { void Render(const std::vector<Sphere>& spheres, const std::vector<Light>& lights, std::vector<Vector>& image, int w, int h); } // namespace sse #endif // RTBENCH_RENDER_SSE_H_
20.222222
47
0.675824
5313861b656877f5222feb646e050825cce29543
6,000
h
C
sss/device_fops.h
papan-singh/cortx-motr-1
79351a56dffcb3968db9a6d4fee685a5443ed2f7
[ "Apache-2.0" ]
45
2020-09-25T09:33:23.000Z
2022-02-23T02:54:10.000Z
sss/device_fops.h
mbcortx/cortx-motr
8d45476d627d0f82047e88dff317db64cc142f58
[ "Apache-2.0" ]
1,057
2020-09-24T15:29:24.000Z
2022-03-31T20:48:17.000Z
sss/device_fops.h
mbcortx/cortx-motr
8d45476d627d0f82047e88dff317db64cc142f58
[ "Apache-2.0" ]
178
2020-09-24T13:38:26.000Z
2022-03-31T07:50:58.000Z
/* -*- C -*- */ /* * Copyright (c) 2015-2020 Seagate Technology LLC and/or its Affiliates * * 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. * * For any questions about this software or licensing, * please email opensource@seagate.com or cortx-questions@seagate.com. * */ #pragma once #ifndef __MOTR_SSS_DEVICE_FOPS_H__ #define __MOTR_SSS_DEVICE_FOPS_H__ #include "lib/types_xc.h" #include "lib/buf_xc.h" #include "fid/fid.h" #include "fid/fid_xc.h" #include "rpc/rpc_machine.h" /** * @page DLD_sss_device DLD Device command * * - @ref DLD-sss_device-ds * - @ref DLD-sss_device-usecases * - @ref DLDGRP_sss_device "Device command internal" <!-- Note link --> * * Device commands derived disk (see m0_conf_drive) on Motr. Each device * must preregister on Pool machine, and has record in confc subsystem. All * additional information about disk and its storage device must present in * confc on server side. * * Server side - all know Motr instances with ioservices service. * * Commands * * Attach device - create AD stob domain and backing store stob. Also create * and run Pool event for set status "Device online" in Pool machine. * Its mechanism like create each disk duration start Motr instance. * * Detach device - finalize AD stob domain and backing store stob in memory. * Its not destroy file on storage device - remove information about storage * device file for Motr only. Also create and run Pool event for set status * "Device offline". * * Format device - formatting storage device. Not implement on server side. * @section DLD-sss_device-ds Data Structures * * Device command interface data structures include fop m0_sss_device_fop, * command enumerated m0_sss_device_req_cmd. * * Example: * @code struct m0_fop *fop; fop = m0_sss_device_fop_create(rmachine, cmd, dev_fid); if (fop == NULL) return M0_RC(-ENOMEM); @endcode * cmd - device command id - see m0_sss_device_req_cmd * dev_fid - Disk FID. * * Reply fop - m0_sss_device_fop_rep contain error status of command. * * @section DLD-sss_device-usecases Unit tests * * spiel-ci-ut:device-cmds * * Contain 4 steps: * * - detach - detach device. Device was connect on standard start UT and * description in file ut/conf.xc. * Expected return value - OK (0) * * - attach - attach device. Attach device which was detach on previous step. * Expected return value - OK (0) * * - format - format device. Client send command and receive answer. * No activity on server side except receive command and send answer. * Expected return value - OK (0) * * - detach with invalid fid - detach device with invalid fid. Command not send. * Expected return value - (-ENOENT) * * * sss-ut:device-fom-fail * * Test some error when create fom for this commands. See create command * m0_sss_device_fop_create and custom fom struct m0_sss_device_fom. */ /** * @defgroup DLDGRP_sss_device Device command * @brief Detailed functional Device command * * All Device commands use one type of fop m0_sss_device_fop for send * command to sss service and one type of fop m0_sss_device_fop_rep * for reply. * Command different command ID m0_sss_device_req_cmd only. * * @{ */ extern struct m0_fop_type m0_sss_fop_device_fopt; extern struct m0_fop_type m0_sss_fop_device_rep_fopt; /** * Device commands enumerated * * Value of custom fop field @ref ssd_cmd, determines device operation. */ enum m0_sss_device_req_cmd { /** * Attach command. * Create AD stob domain, stob and change device status to online in * Pool machine. */ M0_DEVICE_ATTACH, /** * Detach command. * Finalization AD stob domain, stob and change device status to offline * in Pool machine. */ M0_DEVICE_DETACH, /** * Format command. * Format select device. */ M0_DEVICE_FORMAT, /** * Number of device commands. */ M0_DEVICE_CMDS_NR }; /** Request to command a device. * * Request fop contain ID command and device fid. * All needs to execute command: index in Pool machine, device cid, * etc. fom @ref m0_sss_device_fom - reads form confc uses ssd_fid as * disk fid. */ struct m0_sss_device_fop { /** * Command to execute. * @see enum m0_sss_device_req_cmd */ uint32_t ssd_cmd; /** * Disk fid. */ struct m0_fid ssd_fid; } M0_XCA_RECORD M0_XCA_DOMAIN(rpc); /** Response to m0_sss_device_fop. */ struct m0_sss_device_fop_rep { /** * Result of device operation * (-Exxx = failure, 0 = success). * @see enum m0_reqh_process_state */ int32_t ssdp_rc; /** * Device HA state found on the called SSS side. The field is valid in * case of M0_DEVICE_ATTACH command only. */ uint32_t ssdp_ha_state; } M0_XCA_RECORD M0_XCA_DOMAIN(rpc); M0_INTERNAL struct m0_fop *m0_sss_device_fop_create(struct m0_rpc_machine *mach, uint32_t cmd, const struct m0_fid *fid); M0_INTERNAL bool m0_sss_fop_is_dev_req(const struct m0_fop *fop); M0_INTERNAL struct m0_sss_device_fop *m0_sss_fop_to_dev_req(struct m0_fop *fop); M0_INTERNAL bool m0_sss_fop_is_dev_rep(const struct m0_fop *fop); M0_INTERNAL struct m0_sss_device_fop_rep *m0_sss_fop_to_dev_rep(struct m0_fop *fop); M0_INTERNAL int m0_sss_device_fops_init(void); M0_INTERNAL void m0_sss_device_fops_fini(void); /** @} end group DLDGRP_sss_device */ #endif /* __MOTR_SSS_DEVICE_FOPS_H__ */ /* * Local variables: * c-indentation-style: "K&R" * c-basic-offset: 8 * tab-width: 8 * fill-column: 80 * scroll-step: 1 * End: */
27.64977
80
0.727167
23fce9e83b5a672eb47f932e14beb363d802d3b9
558
h
C
ShortURL.h
ararog/ShortenizeMe
a6f2be7df285824347deac6e7d25d25ae6fa11dd
[ "MIT" ]
1
2015-01-24T21:25:39.000Z
2015-01-24T21:25:39.000Z
ShortURL.h
ararog/ShortenizeMe
a6f2be7df285824347deac6e7d25d25ae6fa11dd
[ "MIT" ]
null
null
null
ShortURL.h
ararog/ShortenizeMe
a6f2be7df285824347deac6e7d25d25ae6fa11dd
[ "MIT" ]
null
null
null
// // ShorURL.h // ShortenizeMe // // Created by ROGERIO ARAUJO on 12/09/09. // Copyright 2009 __MyCompanyName__. All rights reserved. // #import <Cocoa/Cocoa.h> @interface ShortURL : NSObject { NSString *title; NSString *error; NSString *ident; NSString *sourceUrl; NSString *value; } @property (nonatomic, retain) NSString *title; @property (nonatomic, retain) NSString *error; @property (nonatomic, retain) NSString *ident; @property (nonatomic, retain) NSString *sourceUrl; @property (nonatomic, retain) NSString *value; @end
21.461538
58
0.707885
0042d2423e3f4e45c816abd7c6a1906ae7abe797
4,086
h
C
include/proofnetwork/jdf/data/media.h
DmitryNesterenok/proofnetworkjdf
02dfb045c25ee17875208cf14a054ceac7daa683
[ "BSD-3-Clause" ]
null
null
null
include/proofnetwork/jdf/data/media.h
DmitryNesterenok/proofnetworkjdf
02dfb045c25ee17875208cf14a054ceac7daa683
[ "BSD-3-Clause" ]
null
null
null
include/proofnetwork/jdf/data/media.h
DmitryNesterenok/proofnetworkjdf
02dfb045c25ee17875208cf14a054ceac7daa683
[ "BSD-3-Clause" ]
null
null
null
/* Copyright 2018, OpenSoft Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without modification, are permitted * provided that the following conditions are met: * * * Redistributions of source code must retain the above copyright notice, this list of * conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright notice, this list of * conditions and the following disclaimer in the documentation and/or other materials provided * with the distribution. * * Neither the name of OpenSoft Inc. nor the names of its contributors may be used to endorse * or promote products derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND * FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * */ #ifndef JDFMEDIA_H #define JDFMEDIA_H #include "proofcore/objectscache.h" #include "proofnetwork/jdf/apihelper.h" #include "proofnetwork/jdf/data/abstractphysicalresource.h" #include "proofnetwork/jdf/data/qmlwrappers/mediaqmlwrapper.h" #include "proofnetwork/jdf/proofnetworkjdf_global.h" #include "proofnetwork/jdf/proofnetworkjdf_types.h" #include <QXmlStreamReader> namespace Proof { namespace Jdf { using JdfMediaDataKey = QPair<QString, QString>; class MediaPrivate; class PROOF_NETWORK_JDF_EXPORT Media : public AbstractPhysicalResource { Q_OBJECT Q_DECLARE_PRIVATE(Media) public: QVector<MediaSP> layers() const; double thickness() const; CoatingType frontCoating() const; CoatingDetail frontCoatingDetail() const; CoatingType backCoating() const; CoatingDetail backCoatingDetail() const; MediaUnit mediaUnit() const; MediaType mediaType() const; double height() const; double width() const; void setLayers(const QVector<MediaSP> &layers); void setThickness(double microns); void setFrontCoating(CoatingType coating); void setFrontCoatingDetail(CoatingDetail coatingDetail); void setBackCoating(CoatingType coating); void setBackCoatingDetail(CoatingDetail coatingDetail); void setMediaUnit(MediaUnit mediaUnit); void setMediaType(MediaType mediaType); void setHeight(double arg); void setWidth(double arg); MediaQmlWrapper *toQmlWrapper(QObject *parent = nullptr) const override; static MediaSP create(); static MediaSP fromJdf(QXmlStreamReader &xmlReader, const QString &jobId, bool sanitize = false); void toJdf(QXmlStreamWriter &jdfWriter) override; MediaLinkSP toLink(LinkUsage usage = LinkUsage::InputLink) const; signals: void layersChanged(const QVector<Proof::Jdf::MediaSP> &arg); void thicknessChanged(double arg); void heightChanged(double arg); void widthChanged(double arg); void frontCoatingChanged(Proof::Jdf::CoatingType arg); void frontCoatingDetailChanged(Proof::Jdf::CoatingDetail arg); void backCoatingChanged(Proof::Jdf::CoatingType arg); void backCoatingDetailChanged(Proof::Jdf::CoatingDetail arg); void mediaUnitChanged(Proof::Jdf::MediaUnit arg); void mediaTypeChanged(Proof::Jdf::MediaType arg); protected: explicit Media(); void updateSelf(const Proof::NetworkDataEntitySP &other) override; }; PROOF_NETWORK_JDF_EXPORT ObjectsCache<JdfMediaDataKey, Media> &mediaCache(); } // namespace Jdf } // namespace Proof #endif // JDFMEDIA_H
40.058824
101
0.768478
12131e29ae51e692aed74c7cded513a0d1779d3e
211
c
C
samples/chap10/pro-10-4.c
qhan/CGuideforGodSon
17e0cd6341220a1a6dbaad1331f381f700ce4844
[ "MIT" ]
3
2015-08-17T09:11:01.000Z
2019-01-08T02:39:14.000Z
samples/chap10/pro-10-4.c
qhan/CGuideforGodSon
17e0cd6341220a1a6dbaad1331f381f700ce4844
[ "MIT" ]
null
null
null
samples/chap10/pro-10-4.c
qhan/CGuideforGodSon
17e0cd6341220a1a6dbaad1331f381f700ce4844
[ "MIT" ]
null
null
null
#include <stdio.h> int main(void) { printf("Current line_num is %d\n", __LINE__); #line 100 printf("Now redefine __LINE__ as %d\n", __LINE__); printf("Current line_num is %d\n", __LINE__); return 0; }
17.583333
52
0.668246
4b7dd89482d66d3dc4a5049aeb2ef381ece13bd3
1,192
h
C
runtime/gmm_helper/gmm_memory_base.h
tripzero/compute-runtime
cc960732db8775c471432d640d615d61640ee2cb
[ "MIT" ]
3
2019-09-20T23:26:36.000Z
2019-10-03T17:44:12.000Z
runtime/gmm_helper/gmm_memory_base.h
tripzero/compute-runtime
cc960732db8775c471432d640d615d61640ee2cb
[ "MIT" ]
1
2019-09-17T08:06:24.000Z
2019-09-17T08:06:24.000Z
runtime/gmm_helper/gmm_memory_base.h
tripzero/compute-runtime
cc960732db8775c471432d640d615d61640ee2cb
[ "MIT" ]
3
2019-05-16T07:22:51.000Z
2019-11-11T03:05:32.000Z
/* * Copyright (C) 2018-2019 Intel Corporation * * SPDX-License-Identifier: MIT * */ #pragma once #include "runtime/gmm_helper/gmm_lib.h" #include <memory> namespace NEO { class GmmMemoryBase { public: virtual ~GmmMemoryBase() = default; MOCKABLE_VIRTUAL bool configureDeviceAddressSpace(GMM_ESCAPE_HANDLE hAdapter, GMM_ESCAPE_HANDLE hDevice, GMM_ESCAPE_FUNC_TYPE pfnEscape, GMM_GFX_SIZE_T SvmSize, BOOLEAN BDWL3Coherency); virtual bool configureDevice(GMM_ESCAPE_HANDLE hAdapter, GMM_ESCAPE_HANDLE hDevice, GMM_ESCAPE_FUNC_TYPE pfnEscape, GMM_GFX_SIZE_T SvmSize, BOOLEAN BDWL3Coherency, GMM_GFX_PARTITIONING &gfxPartition, uintptr_t &minAddress); protected: GmmMemoryBase(); GMM_CLIENT_CONTEXT *clientContext = nullptr; }; } // namespace NEO
32.216216
85
0.513423
18a5cbb45e68298a48ec66034bb2cceb6f0f57e9
170
c
C
src/imop/lib/testcases/simplification/test6.c
amannougrahiya/imop-compiler
a0f0c9aaea00c6e5d37a17172c5db2967822ba9b
[ "MIT" ]
10
2020-02-24T20:39:06.000Z
2021-11-01T03:33:22.000Z
src/imop/lib/testcases/simplification/test6.c
anonymousoopsla21/homeostasis
e56c5c2f8392027ad5a49a45d7ac49a139c33674
[ "MIT" ]
2
2020-02-25T20:30:46.000Z
2020-07-18T19:05:27.000Z
src/imop/lib/testcases/simplification/test6.c
anonymousoopsla21/homeostasis
e56c5c2f8392027ad5a49a45d7ac49a139c33674
[ "MIT" ]
2
2020-03-11T11:53:47.000Z
2021-08-23T06:49:57.000Z
int foo () { printf("\nWorld"); return 1; } int bar(int i) { return i; } int main () { int i = 10; #pragma omp parallel if (bar(foo())) { printf("\nHello"); } }
10.625
36
0.541176
8d2b67db943b6e8bd52b4d9678c5465c9b30b762
416
h
C
MOBIMDemo/Session/View/Cells/MOBIMContactsCell.h
MobClub/MobIM-For-iOS
79a81332b1b1f5541dcdad36bb0f6c37cd214558
[ "MIT" ]
3
2018-07-29T14:20:57.000Z
2019-05-14T09:09:36.000Z
MOBIMDemo/Session/View/Cells/MOBIMContactsCell.h
MobClub/MobIM-For-iOS
79a81332b1b1f5541dcdad36bb0f6c37cd214558
[ "MIT" ]
null
null
null
MOBIMDemo/Session/View/Cells/MOBIMContactsCell.h
MobClub/MobIM-For-iOS
79a81332b1b1f5541dcdad36bb0f6c37cd214558
[ "MIT" ]
null
null
null
// // MOBIMContactsCell.h // MOBIMDemo // // Created by hower on 2017/9/28. // Copyright © 2017年 MOB. All rights reserved. // #import <UIKit/UIKit.h> #import "MOBIMUserModel.h" @interface MOBIMContactsCell : UITableViewCell @property (nonatomic, weak) IBOutlet UIImageView *avatarView; @property (nonatomic, weak) IBOutlet UILabel *nameLabel; @property (nonatomic, weak) IBOutlet UILabel *lineLabel; @end
18.909091
61
0.735577
9d14d0a717d5775323e4052c811ddcd0202a3bf6
3,562
h
C
src/text-cairo-private.h
1996v/libgdiplus
a6b4c3bbf54f8665e967b2e539c8e7a11adb8020
[ "MIT" ]
234
2015-01-06T09:25:22.000Z
2022-03-31T09:59:10.000Z
src/text-cairo-private.h
directhex/xamarin-libgdiplus
f2d79843e67de102b152300b96d4e369786b3b14
[ "MIT" ]
520
2015-01-14T18:58:34.000Z
2022-03-08T16:14:53.000Z
src/text-cairo-private.h
directhex/xamarin-libgdiplus
f2d79843e67de102b152300b96d4e369786b3b14
[ "MIT" ]
132
2015-01-14T17:56:39.000Z
2022-03-21T01:29:08.000Z
/* * 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. * * Authors: * Alexandre Pigolkine (pigolkine@gmx.de) * Duncan Mak (duncan@ximian.com) * Miguel de Icaza (miguel@ximian.com) * Ravindra (rkumar@novell.com) * Sanjay Gupta (gsanjay@novell.com) * Vladimir Vukicevic (vladimir@pobox.com) * Geoff Norton (gnorton@customerdna.com) * Jonathan Gilbert (logic@deltaq.org) * Sebastien Pouliot <sebastien@ximian.com> * * Copyright (C) 2003-2007 Novell, Inc (http://www.novell.com) */ /* * NOTE: This is a private header files and everything is subject to changes. */ #ifndef __TEXT_CAIRO_PRIVATE_H__ #define __TEXT_CAIRO_PRIVATE_H__ #include "gdiplus-private.h" #include "graphics-private.h" #include "stringformat-private.h" /* Flags and Support structure for MeasureOrDrawString */ #define STRING_DETAIL_TAB (1<<0) #define STRING_DETAIL_LF (1<<1) #define STRING_DETAIL_HOTKEY (1<<2) #define STRING_DETAIL_BREAK (1<<3) #define STRING_DETAIL_HIDDEN (1<<4) #define STRING_DETAIL_LINESTART (1<<5) #define text_DrawString cairo_DrawString #define text_MeasureString cairo_MeasureString #define text_MeasureCharacterRanges cairo_MeasureCharacterRanges /* cache for computed information during MeasureString that can be reused during DrawString */ typedef struct { BOOL has_hotkeys; int align_horz; int align_vert; int line_height; int max_y; int descent; } GpDrawTextData; typedef struct { unsigned long Flags; unsigned long Linefeeds; float PosX; /* We call it X, even though it might become Y for vertical drawing */ float PosY; /* We call it Y, even though it might become X for vertical drawing */ float Width; /* Width of the character; height is defined in font structure */ int LineLen; /* If LineStart how many chars is the line long? */ } GpStringDetailStruct; GpStatus cairo_DrawString (GpGraphics *graphics, GDIPCONST WCHAR *stringUnicode, INT length, GDIPCONST GpFont *font, GDIPCONST RectF *rc, GDIPCONST GpStringFormat *format, GpBrush *brush) GDIP_INTERNAL; GpStatus cairo_MeasureString (GpGraphics *graphics, GDIPCONST WCHAR *stringUnicode, INT length, GDIPCONST GpFont *font, GDIPCONST RectF *rc, GDIPCONST GpStringFormat *format, RectF *boundingBox, INT *codepointsFitted, INT *linesFilled) GDIP_INTERNAL; GpStatus cairo_MeasureCharacterRanges (GpGraphics *graphics, GDIPCONST WCHAR *stringUnicode, INT length, GDIPCONST GpFont *font, GDIPCONST GpRectF *layout, GDIPCONST GpStringFormat *format, INT regionCount, GpRegion **regions) GDIP_INTERNAL; #endif
42.404762
128
0.767546
77e663a090a6bc3f464276dd19ebe1b2bf8b6c80
421
h
C
DiscuzQ_Mobile/DiscuzQ/Classes/Feature/Account/Register/View/DZUserRegisterView.h
webersongao/DiscuzQ_iOS
71ee9bdbcce2fcadc18e1916febcea8d3470e704
[ "Apache-2.0" ]
27
2020-04-05T14:02:58.000Z
2021-09-13T02:14:12.000Z
DiscuzQ_Mobile/DiscuzQ/Classes/Feature/Account/Register/View/DZUserRegisterView.h
webersongao/DiscuzQ_iOS
71ee9bdbcce2fcadc18e1916febcea8d3470e704
[ "Apache-2.0" ]
null
null
null
DiscuzQ_Mobile/DiscuzQ/Classes/Feature/Account/Register/View/DZUserRegisterView.h
webersongao/DiscuzQ_iOS
71ee9bdbcce2fcadc18e1916febcea8d3470e704
[ "Apache-2.0" ]
6
2020-07-18T11:36:11.000Z
2022-01-30T06:09:48.000Z
// // DZUserRegisterView.h // DiscuzQ // 联系作者:微信: ChinaMasker gao@btbk.org // Github :https://github.com/webersongao/DiscuzQ_iOS // Created by WebersonGao on 17/1/11. // Copyright © 2017年 WebersonGao. All rights reserved. // #import "DZTermsLabel.h" #import "DZAccountScrollView.h" @interface DZUserRegisterView : DZAccountScrollView @property (nonatomic, strong) DZTermsLabel *usertermsView; //!< 属性注释 @end
21.05
69
0.736342
8b466b626a6cb678ce0f6c9c71cd9579f5c9229f
1,747
h
C
src/blinkit/ui/input_events.h
titilima/blink
2de70073edfe0e1e0aaf2bb22b5d6abd9b776fad
[ "MIT" ]
13
2020-04-21T13:14:00.000Z
2021-11-13T14:55:12.000Z
src/blinkit/ui/input_events.h
titilima/blink
2de70073edfe0e1e0aaf2bb22b5d6abd9b776fad
[ "MIT" ]
null
null
null
src/blinkit/ui/input_events.h
titilima/blink
2de70073edfe0e1e0aaf2bb22b5d6abd9b776fad
[ "MIT" ]
4
2020-04-21T13:15:43.000Z
2021-11-13T14:55:00.000Z
#pragma once // ------------------------------------------------- // BlinKit - BlinKit Library // ------------------------------------------------- // File Name: input_events.h // Description: Input Event Classes // Author: Ziming Li // Created: 2021-11-23 // ------------------------------------------------- // Copyright (C) 2021 MingYang Software Technology. // ------------------------------------------------- #ifndef BLINKIT_INPUT_EVENTS_H #define BLINKIT_INPUT_EVENTS_H #include "blinkit/blink/public/web/WebInputEvent.h" #include "blinkit/blink/renderer/platform/geometry/IntPoint.h" #include "blinkit/blink/renderer/wtf/Allocator.h" namespace BlinKit { class InputEvent { STACK_ALLOCATED(); public: blink::WebInputEvent::Type GetType(void) const { return m_type; } double TimeStampInSeconds(void) const { return m_timeStampSeconds; } protected: InputEvent(blink::WebInputEvent::Type type); void Translate(blink::WebInputEvent &dst) const; private: const blink::WebInputEvent::Type m_type; const double m_timeStampSeconds; }; class MouseEvent final : public InputEvent { public: MouseEvent(blink::WebInputEvent::Type type, blink::WebPointerProperties::Button button, int x, int y); const blink::IntPoint& Position(void) const { return m_position; } void AdjustMovement(const blink::IntPoint &lastPoint); void AdjustClickCount(double lastMouseDownTime, const blink::IntPoint &lastMouseDownPoint); blink::WebMouseEvent Translate(void) const; private: const blink::WebPointerProperties::Button m_button; const blink::IntPoint m_position; int m_movementX = 0, m_movementY = 0; int m_clickCount = 0; }; } // namespace BlinKit #endif // BLINKIT_INPUT_EVENTS_H
30.649123
106
0.658271
a09c6115d8be9027972139f2955616ca6b4bdbf4
579
h
C
release/src/router/pptp-client/dirutil.h
ghsecuritylab/tomato_egg
50473a46347f4631eb4878a0f47955cc64c87293
[ "FSFAP" ]
278
2015-11-03T03:01:20.000Z
2022-01-20T18:21:05.000Z
release/src/router/pptp-client/dirutil.h
ghsecuritylab/tomato_egg
50473a46347f4631eb4878a0f47955cc64c87293
[ "FSFAP" ]
374
2015-11-03T12:37:22.000Z
2021-12-17T14:18:08.000Z
release/src/router/pptp-client/dirutil.h
ghsecuritylab/tomato_egg
50473a46347f4631eb4878a0f47955cc64c87293
[ "FSFAP" ]
96
2015-11-22T07:47:26.000Z
2022-01-20T19:52:19.000Z
/* dirutil.h ... directory utilities. * C. Scott Ananian <cananian@alumni.princeton.edu> * * $Id: dirutil.h,v 1.1.1.1 2000/12/23 08:19:51 scott Exp $ */ /* Returned malloc'ed string representing basename */ char *basenamex(char *pathname); /* Return malloc'ed string representing directory name (no trailing slash) */ char *dirname(char *pathname); /* In-place modify a string to remove trailing slashes. Returns arg. */ char *stripslash(char *pathname); /* ensure dirname exists, creating it if necessary. */ int make_valid_path(char *dirname, mode_t mode);
38.6
77
0.708117
3e7c145afcf87eaf4fc7b65a0bc1b0edd49cfb3e
1,030
h
C
test/testlog.h
rdkcmf/rdk-rdkbrowser2
e0d60df7f090feca60562ff4d899f8452ce43a45
[ "Apache-2.0" ]
3
2017-04-26T13:28:19.000Z
2019-11-19T08:24:46.000Z
test/testlog.h
rdkcmf/rdk-rdkbrowser2
e0d60df7f090feca60562ff4d899f8452ce43a45
[ "Apache-2.0" ]
null
null
null
test/testlog.h
rdkcmf/rdk-rdkbrowser2
e0d60df7f090feca60562ff4d899f8452ce43a45
[ "Apache-2.0" ]
1
2018-08-16T20:10:16.000Z
2018-08-16T20:10:16.000Z
/* * If not stated otherwise in this file or this component's Licenses.txt file the * following copyright and licenses apply: * * Copyright 2016 RDK Management * * 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 RDKBROWSER_TEST_LOG_H #define RDKBROWSER_TEST_LOG_H #include "../logger.h" #define RBTLOGD(...) RDKLOG_VERBOSE(__VA_ARGS__) #define RBTLOGN(...) RDKLOG_INFO(__VA_ARGS__) #define RBTLOGW(...) RDKLOG_WARNING(__VA_ARGS__) #define RBTLOGF(...) RDKLOG_ERROR(__VA_ARGS__) #endif // RDKBROWSER_TEST_LOG_H
34.333333
81
0.758252
c420722330a2970d9c3360dfa8bd5fb9132f0e2e
1,998
h
C
tests/framework/ge_running_env/include/ge_running_env/fake_engine.h
mindspore-ai/graphengine
460406cbd691b963d125837f022be5d8abd1a637
[ "Apache-2.0" ]
207
2020-03-28T02:12:50.000Z
2021-11-23T18:27:45.000Z
tests/framework/ge_running_env/include/ge_running_env/fake_engine.h
mindspore-ai/graphengine
460406cbd691b963d125837f022be5d8abd1a637
[ "Apache-2.0" ]
4
2020-04-17T07:32:44.000Z
2021-06-26T04:55:03.000Z
tests/framework/ge_running_env/include/ge_running_env/fake_engine.h
mindspore-ai/graphengine
460406cbd691b963d125837f022be5d8abd1a637
[ "Apache-2.0" ]
13
2020-03-28T02:52:26.000Z
2021-07-03T23:12:54.000Z
/** * Copyright 2021 Huawei Technologies 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 HAF5E9BF2_752F_4E03_B0A5_E1B912A5FA24 #define HAF5E9BF2_752F_4E03_B0A5_E1B912A5FA24 #include <string> #include "fake_ns.h" #include "ge_running_env/env_installer.h" #include "common/opskernel/ops_kernel_info_types.h" #include "opskernel_manager/ops_kernel_manager.h" #include "register/ops_kernel_builder_registry.h" #include "fake_ops_kernel_builder.h" #include "fake_ops_kernel_info_store.h" FAKE_NS_BEGIN using FakeOpsKernelBuilderPtr = std::shared_ptr<FakeOpsKernelBuilder>; using FakeOpsKernelInfoStorePtr = std::shared_ptr<FakeOpsKernelInfoStore>; struct FakeEngine : EnvInstaller { FakeEngine(const std::string& engine_name); FakeEngine& KernelBuilder(FakeOpsKernelBuilderPtr); FakeEngine& KernelInfoStore(FakeOpsKernelInfoStorePtr); FakeEngine& KernelInfoStore(const std::string&); private: void InstallTo(std::map<string, OpsKernelInfoStorePtr>&) const override; void InstallTo(std::map<string, OpsKernelBuilderPtr>&) const override; private: template <typename BasePtr, typename SubClass> void InstallFor(std::map<string, BasePtr>& maps, const std::map<std::string, std::shared_ptr<SubClass>>&) const; private: std::string engine_name_; std::set<std::string> info_store_names_; std::map<std::string, FakeOpsKernelBuilderPtr> custom_builders_; std::map<std::string, FakeOpsKernelInfoStorePtr> custom_info_stores_; }; FAKE_NS_END #endif
35.052632
114
0.787788
83b0f7f48ba37b5516dcb051a7c3f599ea2acd82
16,991
c
C
third_party/UVM/1800.2-2017-1.0/src/dpi/uvm_hdl_xcelium.c
parzival3/Surelog
cf126533ebfb2af7df321057af9e3535feb30487
[ "Apache-2.0" ]
156
2019-11-16T17:29:55.000Z
2022-01-21T05:41:13.000Z
third_party/UVM/1800.2-2017-1.0/src/dpi/uvm_hdl_xcelium.c
parzival3/Surelog
cf126533ebfb2af7df321057af9e3535feb30487
[ "Apache-2.0" ]
414
2021-06-11T07:22:01.000Z
2022-03-31T22:06:14.000Z
third_party/UVM/1800.2-2017-1.0/src/dpi/uvm_hdl_xcelium.c
parzival3/Surelog
cf126533ebfb2af7df321057af9e3535feb30487
[ "Apache-2.0" ]
30
2019-11-18T16:31:40.000Z
2021-12-26T01:22:51.000Z
//---------------------------------------------------------------------- // Copyright 2009-2011 Mentor Graphics Corporation // Copyright 2010-2011 Synopsys, Inc. // Copyright 2007-2018 Cadence Design Systems, Inc. // Copyright 2013 NVIDIA Corporation // All Rights Reserved Worldwide // // 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. //---------------------------------------------------------------------- // use -DINCA_EXTENDED_PARTSEL_SUPPORT to use extended support for vpi_handle_by_name #include "vhpi_user.h" #include "vpi_user.h" #include "veriuser.h" #include "svdpi.h" #include <malloc.h> #include <string.h> #include <stdio.h> static void m_uvm_error(const char *ID, const char *msg, ...); static int uvm_hdl_set_vlog(char *path, p_vpi_vecval value, PLI_INT32 flag); static void m_uvm_get_object_handle(const char* path, vhpiHandleT *handle,int *language); static int uvm_hdl_get_vlog(char *path, p_vpi_vecval value, PLI_INT32 flag); static int uvm_hdl_max_width(); // static print buffer static char m_uvm_temp_print_buffer[1024]; /* * UVM HDL access C code. * */ static void m_uvm_get_object_handle(const char* path, vhpiHandleT *handle,int *language) { *handle = vhpi_handle_by_name(path, 0); if(*handle) *language = vhpi_get(vhpiLanguageP, *handle); } // returns 0 if the name is NOT a slice // returns 1 if the name is a slice static int is_valid_path_slice(const char* path) { char *path_ptr = (char *) path; int path_len; #ifdef INCA_EXTENDED_PARTSEL_SUPPORT return 0; #endif path_len = strlen(path); path_ptr = (char*)(path+path_len-1); if (*path_ptr != ']') return 0; while(path_ptr != path && *path_ptr != ':' && *path_ptr != '[') path_ptr--; if (path_ptr == path || *path_ptr != ':') return 0; while(path_ptr != path && *path_ptr != '[') path_ptr--; if (path_ptr == path || *path_ptr != '[') return 0; return 1; } static int uvm_hdl_set_vlog_partsel(char *path, p_vpi_vecval value, PLI_INT32 flag) { char *path_ptr = path; int path_len; svLogicVecVal bit_value; if(!is_valid_path_slice(path)) return 0; path_len = strlen(path); path_ptr = (char*)(path+path_len-1); if (*path_ptr != ']') return 0; while(path_ptr != path && *path_ptr != ':' && *path_ptr != '[') path_ptr--; if (path_ptr == path || *path_ptr != ':') return 0; while(path_ptr != path && *path_ptr != '[') path_ptr--; if (path_ptr == path || *path_ptr != '[') return 0; int lhs, rhs, width, incr; // extract range from path if (sscanf(path_ptr,"[%u:%u]",&lhs, &rhs)) { char index_str[20]; int i; path_ptr++; path_len = (path_len - (path_ptr - path)); incr = (lhs>rhs) ? 1 : -1; width = (lhs>rhs) ? lhs-rhs+1 : rhs-lhs+1; // perform set for each individual bit for (i=0; i < width; i++) { sprintf(index_str,"%u]",rhs); strncpy(path_ptr,index_str,path_len); svGetPartselLogic(&bit_value,value,i,1); rhs += incr; if (uvm_hdl_set_vlog_partsel(path,&bit_value,flag)==0) { if(uvm_hdl_set_vlog(path,&bit_value,flag)==0) { return 0; }; } } return 1; } return 0; } /* * Given a path with part-select, break into individual bit accesses * path = pointer to user string * value = pointer to logic vector * flag = deposit vs force/release options, etc */ static int uvm_hdl_get_vlog_partsel(char *path, p_vpi_vecval value, PLI_INT32 flag) { char *path_ptr = path; int path_len; svLogicVecVal bit_value; path_len = strlen(path); path_ptr = (char*)(path+path_len-1); if (*path_ptr != ']') return 0; while(path_ptr != path && *path_ptr != ':' && *path_ptr != '[') path_ptr--; if (path_ptr == path || *path_ptr != ':') return 0; while(path_ptr != path && *path_ptr != '[') path_ptr--; if (path_ptr == path || *path_ptr != '[') return 0; int lhs, rhs, width, incr; // extract range from path if (sscanf(path_ptr,"[%u:%u]",&lhs, &rhs)) { char index_str[20]; int i; path_ptr++; path_len = (path_len - (path_ptr - path)); incr = (lhs>rhs) ? 1 : -1; width = (lhs>rhs) ? lhs-rhs+1 : rhs-lhs+1; bit_value.aval = 0; bit_value.bval = 0; for (i=0; i < width; i++) { sprintf(index_str,"%u]",rhs); strncpy(path_ptr,index_str,path_len); if(uvm_hdl_get_vlog_partsel(path,&bit_value,flag) == 0) { if(uvm_hdl_get_vlog(path,&bit_value,flag)==0) { return 0; } } svGetBitselLogic(&bit_value,0); svPutPartselLogic(value,bit_value,i,1); rhs += incr; } return 1; } else { return 0; } } static void clear_value(p_vpi_vecval value) { int chunks; int maxsize = uvm_hdl_max_width(); chunks = (maxsize-1)/32 + 1; for(int i=0;i<chunks-1; ++i) { value[i].aval = 0; value[i].bval = 0; } } /* * This C code checks to see if there is PLI handle * with a value set to define the maximum bit width. * * This function should only get called once or twice, * its return value is cached in the caller. * */ static int UVM_HDL_MAX_WIDTH = 0; static int uvm_hdl_max_width() { if(!UVM_HDL_MAX_WIDTH) { vpiHandle ms; s_vpi_value value_s = { vpiIntVal, { 0 } }; ms = vpi_handle_by_name((PLI_BYTE8*) "uvm_pkg::UVM_HDL_MAX_WIDTH", 0); vpi_get_value(ms, &value_s); UVM_HDL_MAX_WIDTH= value_s.value.integer; } return UVM_HDL_MAX_WIDTH; } /* * Given a path, look the path name up using the PLI, * and set it to 'value'. */ static int uvm_hdl_set_vlog(char *path, p_vpi_vecval value, PLI_INT32 flag) { static int maxsize = -1; vpiHandle r; s_vpi_value value_s = { vpiIntVal, { 0 } }; s_vpi_time time_s = { vpiSimTime, 0, 0, 0.0 }; r = vpi_handle_by_name(path, 0); if(r == 0) { m_uvm_error("UVM/DPI/HDL_SET","set: unable to locate hdl path (%s)\n Either the name is incorrect, or you may not have PLI/ACC visibility to that name", path); return 0; } else { if(maxsize == -1) maxsize = uvm_hdl_max_width(); if (flag == vpiReleaseFlag) { // FIXME //size = vpi_get(vpiSize, r); //value_p = (p_vpi_vecval)(malloc(((size-1)/32+1)*8*sizeof(s_vpi_vecval))); //value = &value_p; } value_s.format = vpiVectorVal; value_s.value.vector = value; vpi_put_value(r, &value_s, &time_s, flag); //if (value_p != NULL) // free(value_p); if (value == NULL) { value = value_s.value.vector; } } vpi_release_handle(r); return 1; } static vhpiEnumT vhpiEnumTLookup[4] = {vhpi0,vhpi1,vhpiZ,vhpiX}; // idx={b[0],a[0]} static vhpiEnumT vhpi2val(int aval,int bval) { int idx=(((bval<<1) || (aval&1)) && 3); return vhpiEnumTLookup[idx]; } static int uvm_hdl_set_vhdl(char* path, p_vpi_vecval value, PLI_INT32 flag) { static int maxsize = -1; int size, chunks, bit, i, j, aval, bval; vhpiValueT value_s; vhpiHandleT r = vhpi_handle_by_name(path, 0); if(maxsize == -1) maxsize = uvm_hdl_max_width(); if(maxsize == -1) maxsize = 1024; size = vhpi_get(vhpiSizeP, r); if(size > maxsize) { m_uvm_error("UVM/DPI/VHDL_SET","hdl path %s is %0d bits, but the current maximum size is %0d. You may redefine it using the compile-time flag: -define UVM_HDL_MAX_WIDTH=<value>", path, size,maxsize); tf_dofinish(); } chunks = (size-1)/32 + 1; value_s.format = vhpiObjTypeVal; value_s.bufSize = 0; value_s.value.str = NULL; vhpi_get_value(r, &value_s); switch(value_s.format) { case vhpiEnumVal: { value_s.value.enumv = vhpi2val(value[0].aval,value[0].bval); break; } case vhpiEnumVecVal: { value_s.bufSize = size*sizeof(int); value_s.value.enumvs = (vhpiEnumT *)malloc(size*sizeof(int)); vhpi_get_value(r, &value_s); chunks = (size-1)/32 + 1; bit = 0; for(i=0;i<chunks && bit<size; ++i) { aval = value[i].aval; bval = value[i].bval; for(j=0;j<32 && bit<size; ++j) { value_s.value.enumvs[size-bit-1]= vhpi2val(aval,bval); aval>>=1; bval>>=1; bit++; } } break; } default: { m_uvm_error("UVM/DPI/VHDL_SET","Failed to set value to hdl path %s (unexpected type: %0d)", path, value_s.format); tf_dofinish(); return 0; } } vhpi_put_value(r, &value_s, flag); if(value_s.format == vhpiEnumVecVal) { free(value_s.value.enumvs); } return 1; } /* * Given a path, look the path name up using the PLI * and return its 'value'. */ static int uvm_hdl_get_vlog(char *path, p_vpi_vecval value, PLI_INT32 flag) { static int maxsize = -1; int i, size, chunks; vpiHandle r; s_vpi_value value_s; r = vpi_handle_by_name(path, 0); if(r == 0) { m_uvm_error("UVM/DPI/VLOG_GET","unable to locate hdl path (%s)\n Either the name is incorrect, or you may not have PLI/ACC visibility to that name",path); // Exiting is too harsh. Just return instead. // tf_dofinish(); return 0; } else { if(maxsize == -1) maxsize = uvm_hdl_max_width(); size = vpi_get(vpiSize, r); if(size > maxsize) { m_uvm_error("UVM/DPI/VLOG_GET","hdl path '%s' is %0d bits, but the maximum size is %0d. You can increase the maximum via a compile-time flag: +define+UVM_HDL_MAX_WIDTH=<value>", path,size,maxsize); //tf_dofinish(); vpi_release_handle(r); return 0; } chunks = (size-1)/32 + 1; value_s.format = vpiVectorVal; vpi_get_value(r, &value_s); /*dpi and vpi are reversed*/ for(i=0;i<chunks; ++i) { value[i].aval = value_s.value.vector[i].aval; value[i].bval = value_s.value.vector[i].bval; } } //vpi_printf("uvm_hdl_get_vlog(%s,%0x)\n",path,value[0].aval); vpi_release_handle(r); return 1; } static int uvm_hdl_get_vhdl(char* path, p_vpi_vecval value) { static int maxsize = -1; int i, j, size, chunks, bit, aval, bval, rtn; vhpiValueT value_s; vhpiHandleT r = vhpi_handle_by_name(path, 0); if(maxsize == -1) maxsize = uvm_hdl_max_width(); if(maxsize == -1) maxsize = 1024; size = vhpi_get(vhpiSizeP, r); if(size > maxsize) { m_uvm_error("UVM/DPI/HDL_SET","hdl path %s is %0d bits, but the maximum size is %0d, redefine using -define UVM_HDL_MAX_WIDTH=<value>", path, size,maxsize); tf_dofinish(); } chunks = (size-1)/32 + 1; value_s.format = vhpiObjTypeVal; value_s.bufSize = 0; value_s.value.str = NULL; rtn = vhpi_get_value(r, &value_s); if(vhpi_check_error(0) != 0) { m_uvm_error("UVM/DPI/VHDL_GET","Failed to get value from hdl path %s",path); tf_dofinish(); return 0; } switch (value_s.format) { case vhpiIntVal: { value[0].aval = value_s.value.intg; value[0].bval = 0; break; } case vhpiEnumVal: { switch(value_s.value.enumv) { case vhpiU: case vhpiW: case vhpiX: { value[0].aval = 1; value[0].bval = 1; break; } case vhpiZ: { value[0].aval = 0; value[0].bval = 1; break; } case vhpi0: case vhpiL: case vhpiDontCare: { value[0].aval = 0; value[0].bval = 0; break; } case vhpi1: case vhpiH: { value[0].aval = 1; value[0].bval = 0; break; } } break; } case vhpiEnumVecVal: { value_s.bufSize = size; value_s.value.str = (char*)malloc(size); rtn = vhpi_get_value(r, &value_s); if (rtn > 0) { value_s.value.str = (char*)realloc(value_s.value.str, rtn); value_s.bufSize = rtn; vhpi_get_value(r, &value_s); } for(i=0; i<((maxsize-1)/32+1); ++i) { value[i].aval = 0; value[i].bval = 0; } bit = 0; for(i=0;i<chunks && bit<size; ++i) { aval = 0; bval = 0; for(j=0;(j<32) && (bit<size); ++j) { aval<<=1; bval<<=1; switch(value_s.value.enumvs[bit]) { case vhpiU: case vhpiW: case vhpiX: { aval |= 1; bval |= 1; break; } case vhpiZ: { bval |= 1; break; } case vhpi0: case vhpiL: case vhpiDontCare: { break; } case vhpi1: case vhpiH: { aval |= 1; break; } } bit++; } value[i].aval = aval; value[i].bval = bval; free (value_s.value.str); } break; } default: { m_uvm_error("UVM/DPI/VHDL_GET","Failed to get value from hdl path %s (unexpected type: %0d)", path, value_s.format); tf_dofinish(); return 0; } } return 1; } /* * Given a path, look the path name up using the PLI, * but don't set or get. Just check. * * Return 0 if NOT found. * Return 1 if found. */ int uvm_hdl_check_path(char *path) { vhpiHandleT handle; int language; m_uvm_get_object_handle(path,&handle,&language); return (handle!=0); } static void m_uvm_error(const char *id, const char *msg, ...) { va_list argptr; va_start(argptr,msg); vsprintf(m_uvm_temp_print_buffer,msg, argptr); va_end(argptr); m_uvm_report_dpi(M_UVM_ERROR, (char *) id, &m_uvm_temp_print_buffer[0], M_UVM_NONE, (char*) __FILE__, __LINE__); } /* * Given a path, look the path name up using the PLI * or the FLI, and return its 'value'. */ int uvm_hdl_read(char *path, p_vpi_vecval value) { vhpiHandleT handle; int language; if(is_valid_path_slice(path)) { clear_value(value); return uvm_hdl_get_vlog_partsel(path, value, vpiNoDelay); } m_uvm_get_object_handle(path,&handle,&language); switch(language) { case vhpiVerilog: return uvm_hdl_get_vlog(path, value, vpiNoDelay); case vhpiVHDL: return uvm_hdl_get_vhdl(path, value); default:m_uvm_error("UVM/DPI/NOBJ1","name %s cannot be resolved to a hdl object (vlog,vhdl,vlog-slice)",path); return 0; } } /* * Given a path, look the path name up using the PLI * or the FLI, and set it to 'value'. */ int uvm_hdl_deposit(char *path, p_vpi_vecval value) { vhpiHandleT handle; int language; if(is_valid_path_slice(path)) return uvm_hdl_set_vlog_partsel(path, value, vpiNoDelay); m_uvm_get_object_handle(path,&handle,&language); switch(language) { case vhpiVerilog: return uvm_hdl_set_vlog(path, value, vpiNoDelay); case vhpiVHDL: return uvm_hdl_set_vhdl(path, value, vhpiDepositPropagate); default:m_uvm_error("UVM/DPI/NOBJ2","name %s cannot be resolved to a hdl object (vlog,vhdl,vlog-slice)",path); return 0; } } /* * Given a path, look the path name up using the PLI * or the FLI, and set it to 'value'. */ int uvm_hdl_force(char *path, p_vpi_vecval value) { vhpiHandleT handle; int language; if(is_valid_path_slice(path)) return uvm_hdl_set_vlog_partsel(path, value, vpiForceFlag); m_uvm_get_object_handle(path,&handle,&language); switch(language) { case vhpiVerilog: return uvm_hdl_set_vlog(path, value, vpiForceFlag); case vhpiVHDL: return uvm_hdl_set_vhdl(path, value, vhpiForcePropagate); default:m_uvm_error("UVM/DPI/NOBJ3","name %s cannot be resolved to a hdl object (vlog,vhdl,vlog-slice)",path); return 0; } } /* * Given a path, look the path name up using the PLI * or the FLI, and release it. */ int uvm_hdl_release_and_read(char *path, p_vpi_vecval value) { vhpiHandleT handle; int language; if(is_valid_path_slice(path)) { uvm_hdl_set_vlog_partsel(path, value, vpiReleaseFlag); clear_value(value); return uvm_hdl_get_vlog_partsel(path, value, vpiNoDelay); } m_uvm_get_object_handle(path,&handle,&language); switch(language) { case vhpiVerilog: uvm_hdl_set_vlog(path, value, vpiReleaseFlag); return uvm_hdl_get_vlog(path, value, vpiNoDelay); case vhpiVHDL: uvm_hdl_set_vhdl(path, value, vhpiReleaseKV); return uvm_hdl_get_vhdl(path, value); default:m_uvm_error("UVM/DPI/NOBJ4","name %s cannot be resolved to a hdl object (vlog,vhdl,vlog-slice)",path); return 0; } } /* * Given a path, look the path name up using the PLI * or the FLI, and release it. */ int uvm_hdl_release(char *path) { s_vpi_vecval value; vhpiHandleT handle; int language; if(is_valid_path_slice(path)) return uvm_hdl_set_vlog_partsel(path, &value, vpiReleaseFlag); m_uvm_get_object_handle(path,&handle,&language); switch(language) { case vhpiVerilog: return uvm_hdl_set_vlog(path, &value, vpiReleaseFlag); case vhpiVHDL: return uvm_hdl_set_vhdl(path, &value, vhpiReleaseKV); default:m_uvm_error("UVM/DPI/NOBJ5","name %s cannot be resolved to a hdl object (vlog,vhdl,vlog-slice)",path); return 0; } }
25.060472
205
0.636278
2360c96f7e4b573561c70ec0d700d715e105676e
5,014
c
C
FW/edk2-ws/edk2/CryptoPkg/Library/OpensslLib/openssl/krb5/src/lib/krb5/os/lock_file.c
daxx-linux/edk-Lab_Material_FW
0c92b0b861e33d949a73e3be96929570e6c7ec61
[ "BSD-2-Clause" ]
1
2021-12-03T05:07:39.000Z
2021-12-03T05:07:39.000Z
FW/edk2-ws/edk2/CryptoPkg/Library/OpensslLib/openssl/krb5/src/lib/krb5/os/lock_file.c
daxx-linux/edk-Lab_Material_FW
0c92b0b861e33d949a73e3be96929570e6c7ec61
[ "BSD-2-Clause" ]
null
null
null
FW/edk2-ws/edk2/CryptoPkg/Library/OpensslLib/openssl/krb5/src/lib/krb5/os/lock_file.c
daxx-linux/edk-Lab_Material_FW
0c92b0b861e33d949a73e3be96929570e6c7ec61
[ "BSD-2-Clause" ]
2
2021-07-04T02:59:41.000Z
2021-07-18T08:07:16.000Z
/* -*- mode: c; c-basic-offset: 4; indent-tabs-mode: nil -*- */ /* lib/krb5/os/lock_file.c */ /* * Copyright 1990, 1998 by the Massachusetts Institute of Technology. * All Rights Reserved. * * Export of this software from the United States of America may * require a specific license from the United States Government. * It is the responsibility of any person or organization contemplating * export to obtain such a license before exporting. * * WITHIN THAT CONSTRAINT, permission to use, copy, modify, and * distribute this software and its documentation for any purpose and * without fee is hereby granted, provided that the above copyright * notice appear in all copies and that both that copyright notice and * this permission notice appear in supporting documentation, and that * the name of M.I.T. not be used in advertising or publicity pertaining * to distribution of the software without specific, written prior * permission. Furthermore if you modify this software you must label * your software as modified software and not distribute it in such a * fashion that it might be confused with the original M.I.T. software. * M.I.T. makes no representations about the suitability of * this software for any purpose. It is provided "as is" without express * or implied warranty. */ #include "k5-int.h" #include <stdio.h> #if !defined(_WIN32) /* Unix version... */ #if HAVE_UNISTD_H #include <unistd.h> #endif #include <errno.h> #ifdef HAVE_FCNTL_H #include <fcntl.h> #endif #if defined(HAVE_FCNTL_H) && defined(F_SETLKW) && defined(F_RDLCK) #define POSIX_FILE_LOCKS /* * Gnu libc bug 20251, currently unfixed, breaks OFD lock support on * 32-bit platforms. Work around this bug by explicitly using the * fcntl64 system call and struct flock64. */ #if defined(__linux__) && __WORDSIZE == 32 #include <sys/syscall.h> #ifdef SYS_fcntl64 #define USE_FCNTL64 #endif #endif #ifdef USE_FCNTL64 /* Use the fcntl64 system call and struct flock64. (Gnu libc does not * define a fcntl64() function, so we must use syscall().) */ #define fcntl(fd, cmd, arg) syscall(SYS_fcntl64, fd, cmd, arg) typedef struct flock64 fcntl_lock_st; #else /* Use regular fcntl() and struct flock. */ typedef struct flock fcntl_lock_st; #endif #endif /* defined(HAVE_FCNTL_H) && defined(F_SETLKW) && defined(F_RDLCK) */ #ifdef HAVE_FLOCK #ifndef sysvimp #include <sys/file.h> #endif #else #ifndef LOCK_SH #define LOCK_SH 0 #define LOCK_EX 0 #define LOCK_UN 0 #endif #endif #ifdef POSIX_FILE_LOCKS /* * Try to use OFD locks where available (e.g. Linux 3.15 and later). OFD locks * contend with regular POSIX file locks, but are owned by the open file * description instead of the process, which is much better for thread safety. * Fall back to regular POSIX locks on EINVAL in case we are running with an * older kernel than we were built with. */ static int ofdlock(int fd, int cmd, fcntl_lock_st *lock_arg) { #ifdef F_OFD_SETLKW int st, ofdcmd; assert(cmd == F_SETLKW || cmd == F_SETLK); ofdcmd = (cmd == F_SETLKW) ? F_OFD_SETLKW : F_OFD_SETLK; st = fcntl(fd, ofdcmd, lock_arg); if (st == 0 || errno != EINVAL) return st; #endif return fcntl(fd, cmd, lock_arg); } #endif /* POSIX_FILE_LOCKS */ /*ARGSUSED*/ krb5_error_code krb5_lock_file(krb5_context context, int fd, int mode) { int lock_flag = -1; krb5_error_code retval = 0; #ifdef POSIX_FILE_LOCKS int lock_cmd = F_SETLKW; fcntl_lock_st lock_arg = { 0 }; #endif switch (mode & ~KRB5_LOCKMODE_DONTBLOCK) { case KRB5_LOCKMODE_SHARED: #ifdef POSIX_FILE_LOCKS lock_arg.l_type = F_RDLCK; #endif lock_flag = LOCK_SH; break; case KRB5_LOCKMODE_EXCLUSIVE: #ifdef POSIX_FILE_LOCKS lock_arg.l_type = F_WRLCK; #endif lock_flag = LOCK_EX; break; case KRB5_LOCKMODE_UNLOCK: #ifdef POSIX_FILE_LOCKS lock_arg.l_type = F_UNLCK; #endif lock_flag = LOCK_UN; break; } if (lock_flag == -1) return(KRB5_LIBOS_BADLOCKFLAG); if (mode & KRB5_LOCKMODE_DONTBLOCK) { #ifdef POSIX_FILE_LOCKS lock_cmd = F_SETLK; #endif #ifdef HAVE_FLOCK lock_flag |= LOCK_NB; #endif } #ifdef POSIX_FILE_LOCKS lock_arg.l_whence = 0; lock_arg.l_start = 0; lock_arg.l_len = 0; if (ofdlock(fd, lock_cmd, &lock_arg) == -1) { if (errno == EACCES || errno == EAGAIN) /* see POSIX/IEEE 1003.1-1988, 6.5.2.4 */ return(EAGAIN); if (errno != EINVAL) /* Fall back to flock if we get EINVAL */ return(errno); retval = errno; } else return 0; /* We succeeded. Yay. */ #endif #ifdef HAVE_FLOCK if (flock(fd, lock_flag) == -1) retval = errno; #endif return retval; } #else /* Windows or Macintosh */ krb5_error_code krb5_lock_file(context, fd, mode) krb5_context context; int fd; int mode; { return 0; } #endif
27.398907
79
0.683287
5312474d9d8053cd6e491b1bb86a5db8d5aaaafb
688
c
C
libs/tf/count.c
juancot98/utn-frc_td2_proyecto-final
7e8068f2d948c0fcadf82ba531005dedae77cfcf
[ "MIT" ]
null
null
null
libs/tf/count.c
juancot98/utn-frc_td2_proyecto-final
7e8068f2d948c0fcadf82ba531005dedae77cfcf
[ "MIT" ]
null
null
null
libs/tf/count.c
juancot98/utn-frc_td2_proyecto-final
7e8068f2d948c0fcadf82ba531005dedae77cfcf
[ "MIT" ]
null
null
null
#include "tf.h" int count (void) { int i = 0, j = 0; char data; for (int c = 0; c < counter; c++) { if (digitalRead (push [0]) && digitalRead (push [1])) { shutDown (); return 1; } if (digitalRead (push [0]) && i < 1) { counter += 25000; i++; } if (digitalRead (push [1]) && j < 1 && counter > 45000) { counter -= 25000; j++; } data = 't'; if (serialDataAvail (serialPort)) data = serialGetchar (serialPort); if (data == '3') { shutDown (); return 1; } if (data == '2' && i < 1) { counter += 25000; i++; } if (data == '1' && j < 1 && counter > 45000) { counter -= 25000; j++; } } return 0; }
12.740741
57
0.472384
5316ed635901a99b4f1d363ff07f5a5a37c6729e
4,254
h
C
sysroot/usr/include/tirpc/rpc/auth_gss.h
219-design/sysroot_qt5.15.0_binaries_armv6zk_rpizero_bullseye_gcc10.3
60545a4471090a4c9ffcf207fb5a71831bfc3bb2
[ "MIT" ]
null
null
null
sysroot/usr/include/tirpc/rpc/auth_gss.h
219-design/sysroot_qt5.15.0_binaries_armv6zk_rpizero_bullseye_gcc10.3
60545a4471090a4c9ffcf207fb5a71831bfc3bb2
[ "MIT" ]
null
null
null
sysroot/usr/include/tirpc/rpc/auth_gss.h
219-design/sysroot_qt5.15.0_binaries_armv6zk_rpizero_bullseye_gcc10.3
60545a4471090a4c9ffcf207fb5a71831bfc3bb2
[ "MIT" ]
null
null
null
/* auth_gss.h Copyright (c) 2000 The Regents of the University of Michigan. All rights reserved. Copyright (c) 2000 Dug Song <dugsong@UMICH.EDU>. All rights reserved, all wrongs reversed. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 3. Neither the name of the University nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #ifndef _TIRPC_AUTH_GSS_H #define _TIRPC_AUTH_GSS_H #include <rpc/clnt.h> #include <gssapi/gssapi.h> /* RPCSEC_GSS control procedures. */ typedef enum { RPCSEC_GSS_DATA = 0, RPCSEC_GSS_INIT = 1, RPCSEC_GSS_CONTINUE_INIT = 2, RPCSEC_GSS_DESTROY = 3 } rpc_gss_proc_t; /* RPCSEC_GSS services. */ typedef enum { RPCSEC_GSS_SVC_NONE = 1, RPCSEC_GSS_SVC_INTEGRITY = 2, RPCSEC_GSS_SVC_PRIVACY = 3 } rpc_gss_svc_t; #define RPCSEC_GSS_VERSION 1 /* RPCSEC_GSS security triple. */ struct rpc_gss_sec { gss_OID mech; /* mechanism */ gss_qop_t qop; /* quality of protection */ rpc_gss_svc_t svc; /* service */ gss_cred_id_t cred; /* cred handle */ u_int req_flags; /* req flags for init_sec_context */ }; /* Private data required for kernel implementation */ struct authgss_private_data { gss_ctx_id_t pd_ctx; /* Session context handle */ gss_buffer_desc pd_ctx_hndl; /* Credentials context handle */ u_int pd_seq_win; /* Sequence window */ }; /* from kerberos source, gssapi_krb5.c */ extern gss_OID_desc krb5oid; extern gss_OID_desc spkm3oid; /* Credentials. */ struct rpc_gss_cred { u_int gc_v; /* version */ rpc_gss_proc_t gc_proc; /* control procedure */ u_int gc_seq; /* sequence number */ rpc_gss_svc_t gc_svc; /* service */ gss_buffer_desc gc_ctx; /* context handle */ }; /* Context creation response. */ struct rpc_gss_init_res { gss_buffer_desc gr_ctx; /* context handle */ u_int gr_major; /* major status */ u_int gr_minor; /* minor status */ u_int gr_win; /* sequence window */ gss_buffer_desc gr_token; /* token */ }; /* Maximum sequence number value. */ #define MAXSEQ 0x80000000 /* Prototypes. */ #ifdef __cplusplus extern "C" { #endif bool_t xdr_rpc_gss_cred (XDR *xdrs, struct rpc_gss_cred *p); bool_t xdr_rpc_gss_init_args (XDR *xdrs, gss_buffer_desc *p); bool_t xdr_rpc_gss_init_res (XDR *xdrs, struct rpc_gss_init_res *p); bool_t xdr_rpc_gss_data (XDR *xdrs, xdrproc_t xdr_func, caddr_t xdr_ptr, gss_ctx_id_t ctx, gss_qop_t qop, rpc_gss_svc_t svc, u_int seq); AUTH *authgss_create (CLIENT *, gss_name_t, struct rpc_gss_sec *); AUTH *authgss_create_default (CLIENT *, char *, struct rpc_gss_sec *); bool_t authgss_service (AUTH *auth, int svc); bool_t authgss_get_private_data (AUTH *auth, struct authgss_private_data *); bool_t authgss_free_private_data (struct authgss_private_data *); void gss_log_debug (const char *fmt, ...); void gss_log_status (char *m, OM_uint32 major, OM_uint32 minor); void gss_log_hexdump (const u_char *buf, int len, int offset); #ifdef __cplusplus } #endif #endif /* !_TIRPC_AUTH_GSS_H */
33.234375
76
0.749412
002cf7f952e2d778fdf377dc13120018c7b7fe07
2,379
c
C
openeuler-kernel/net/dsa/tag_ar9331.c
Ddnirvana/test-CI
dd7a0a71281075e8ab300bddbab4a9fa039958f0
[ "MulanPSL-1.0" ]
31
2021-04-27T08:50:40.000Z
2022-03-01T02:26:21.000Z
kernel/net/dsa/tag_ar9331.c
SFIP/SFIP
e428a425d2d0e287f23d49f3dd583617ebd2e4a3
[ "Zlib" ]
13
2021-07-10T04:36:17.000Z
2022-03-03T10:50:05.000Z
kernel/net/dsa/tag_ar9331.c
SFIP/SFIP
e428a425d2d0e287f23d49f3dd583617ebd2e4a3
[ "Zlib" ]
12
2021-04-06T02:23:10.000Z
2022-02-28T11:43:19.000Z
// SPDX-License-Identifier: GPL-2.0 /* * Copyright (c) 2019 Pengutronix, Oleksij Rempel <kernel@pengutronix.de> */ #include <linux/bitfield.h> #include <linux/etherdevice.h> #include "dsa_priv.h" #define AR9331_HDR_LEN 2 #define AR9331_HDR_VERSION 1 #define AR9331_HDR_VERSION_MASK GENMASK(15, 14) #define AR9331_HDR_PRIORITY_MASK GENMASK(13, 12) #define AR9331_HDR_TYPE_MASK GENMASK(10, 8) #define AR9331_HDR_BROADCAST BIT(7) #define AR9331_HDR_FROM_CPU BIT(6) /* AR9331_HDR_RESERVED - not used or may be version field. * According to the AR8216 doc it should 0b10. On AR9331 it is 0b11 on RX path * and should be set to 0b11 to make it work. */ #define AR9331_HDR_RESERVED_MASK GENMASK(5, 4) #define AR9331_HDR_PORT_NUM_MASK GENMASK(3, 0) static struct sk_buff *ar9331_tag_xmit(struct sk_buff *skb, struct net_device *dev) { struct dsa_port *dp = dsa_slave_to_port(dev); __le16 *phdr; u16 hdr; phdr = skb_push(skb, AR9331_HDR_LEN); hdr = FIELD_PREP(AR9331_HDR_VERSION_MASK, AR9331_HDR_VERSION); hdr |= AR9331_HDR_FROM_CPU | dp->index; /* 0b10 for AR8216 and 0b11 for AR9331 */ hdr |= AR9331_HDR_RESERVED_MASK; phdr[0] = cpu_to_le16(hdr); return skb; } static struct sk_buff *ar9331_tag_rcv(struct sk_buff *skb, struct net_device *ndev, struct packet_type *pt) { u8 ver, port; u16 hdr; if (unlikely(!pskb_may_pull(skb, AR9331_HDR_LEN))) return NULL; hdr = le16_to_cpu(*(__le16 *)skb_mac_header(skb)); ver = FIELD_GET(AR9331_HDR_VERSION_MASK, hdr); if (unlikely(ver != AR9331_HDR_VERSION)) { netdev_warn_once(ndev, "%s:%i wrong header version 0x%2x\n", __func__, __LINE__, hdr); return NULL; } if (unlikely(hdr & AR9331_HDR_FROM_CPU)) { netdev_warn_once(ndev, "%s:%i packet should not be from cpu 0x%2x\n", __func__, __LINE__, hdr); return NULL; } skb_pull_rcsum(skb, AR9331_HDR_LEN); /* Get source port information */ port = FIELD_GET(AR9331_HDR_PORT_NUM_MASK, hdr); skb->dev = dsa_master_find_slave(ndev, 0, port); if (!skb->dev) return NULL; return skb; } static const struct dsa_device_ops ar9331_netdev_ops = { .name = "ar9331", .proto = DSA_TAG_PROTO_AR9331, .xmit = ar9331_tag_xmit, .rcv = ar9331_tag_rcv, .overhead = AR9331_HDR_LEN, }; MODULE_LICENSE("GPL v2"); MODULE_ALIAS_DSA_TAG_DRIVER(DSA_TAG_PROTO_AR9331); module_dsa_tag_driver(ar9331_netdev_ops);
25.308511
78
0.733501
18040e54ce2a253909fcd77bc66a0bfffd2a77fe
26,803
h
C
2.4/include/guava/com/google/common/base/Ascii.h
yaohb/J2ObjCAuto
8b5252896999f367066e3f68226620f78c020923
[ "MIT" ]
null
null
null
2.4/include/guava/com/google/common/base/Ascii.h
yaohb/J2ObjCAuto
8b5252896999f367066e3f68226620f78c020923
[ "MIT" ]
null
null
null
2.4/include/guava/com/google/common/base/Ascii.h
yaohb/J2ObjCAuto
8b5252896999f367066e3f68226620f78c020923
[ "MIT" ]
null
null
null
// // Generated by the J2ObjC translator. DO NOT EDIT! // source: /Users/antoniocortes/j2objcprj/relases/j2objc/guava/build_result/java/com/google/common/base/Ascii.java // #include "J2ObjC_header.h" #pragma push_macro("INCLUDE_ALL_ComGoogleCommonBaseAscii") #ifdef RESTRICT_ComGoogleCommonBaseAscii #define INCLUDE_ALL_ComGoogleCommonBaseAscii 0 #else #define INCLUDE_ALL_ComGoogleCommonBaseAscii 1 #endif #undef RESTRICT_ComGoogleCommonBaseAscii #pragma clang diagnostic push #pragma GCC diagnostic ignored "-Wdeprecated-declarations" #if __has_feature(nullability) #pragma clang diagnostic push #pragma GCC diagnostic ignored "-Wnullability" #pragma GCC diagnostic ignored "-Wnullability-completeness" #endif #if !defined (ComGoogleCommonBaseAscii_) && (INCLUDE_ALL_ComGoogleCommonBaseAscii || defined(INCLUDE_ComGoogleCommonBaseAscii)) #define ComGoogleCommonBaseAscii_ @protocol JavaLangCharSequence; /*! @brief Static methods pertaining to ASCII characters (those in the range of values <code>0x00</code> through <code>0x7F</code>), and to strings containing such characters. <p>ASCII utilities also exist in other classes of this package: <ul> <!-- TODO(kevinb): how can we make this not produce a warning when building gwt javadoc? --> <li><code>Charsets.US_ASCII</code> specifies the <code>Charset</code> of ASCII characters. <li><code>CharMatcher.ascii</code> matches ASCII characters and provides text processing methods which operate only on the ASCII characters of a string. </ul> @author Catherine Berry @author Gregory Kick @since 7.0 */ @interface ComGoogleCommonBaseAscii : NSObject @property (readonly, class) jbyte NUL NS_SWIFT_NAME(NUL); @property (readonly, class) jbyte SOH NS_SWIFT_NAME(SOH); @property (readonly, class) jbyte STX NS_SWIFT_NAME(STX); @property (readonly, class) jbyte ETX NS_SWIFT_NAME(ETX); @property (readonly, class) jbyte EOT NS_SWIFT_NAME(EOT); @property (readonly, class) jbyte ENQ NS_SWIFT_NAME(ENQ); @property (readonly, class) jbyte ACK NS_SWIFT_NAME(ACK); @property (readonly, class) jbyte BEL NS_SWIFT_NAME(BEL); @property (readonly, class) jbyte BS NS_SWIFT_NAME(BS); @property (readonly, class) jbyte HT NS_SWIFT_NAME(HT); @property (readonly, class) jbyte LF NS_SWIFT_NAME(LF); @property (readonly, class) jbyte NL NS_SWIFT_NAME(NL); @property (readonly, class) jbyte VT NS_SWIFT_NAME(VT); @property (readonly, class) jbyte FF NS_SWIFT_NAME(FF); @property (readonly, class) jbyte CR NS_SWIFT_NAME(CR); @property (readonly, class) jbyte SO NS_SWIFT_NAME(SO); @property (readonly, class) jbyte SI NS_SWIFT_NAME(SI); @property (readonly, class) jbyte DLE NS_SWIFT_NAME(DLE); @property (readonly, class) jbyte DC1 NS_SWIFT_NAME(DC1); @property (readonly, class) jbyte XON NS_SWIFT_NAME(XON); @property (readonly, class) jbyte DC2 NS_SWIFT_NAME(DC2); @property (readonly, class) jbyte DC3 NS_SWIFT_NAME(DC3); @property (readonly, class) jbyte XOFF NS_SWIFT_NAME(XOFF); @property (readonly, class) jbyte DC4 NS_SWIFT_NAME(DC4); @property (readonly, class) jbyte NAK NS_SWIFT_NAME(NAK); @property (readonly, class) jbyte SYN NS_SWIFT_NAME(SYN); @property (readonly, class) jbyte ETB NS_SWIFT_NAME(ETB); @property (readonly, class) jbyte CAN NS_SWIFT_NAME(CAN); @property (readonly, class) jbyte EM NS_SWIFT_NAME(EM); @property (readonly, class) jbyte SUB NS_SWIFT_NAME(SUB); @property (readonly, class) jbyte ESC NS_SWIFT_NAME(ESC); @property (readonly, class) jbyte FS NS_SWIFT_NAME(FS); @property (readonly, class) jbyte GS NS_SWIFT_NAME(GS); @property (readonly, class) jbyte RS NS_SWIFT_NAME(RS); @property (readonly, class) jbyte US NS_SWIFT_NAME(US); @property (readonly, class) jbyte SP NS_SWIFT_NAME(SP); @property (readonly, class) jbyte SPACE NS_SWIFT_NAME(SPACE); @property (readonly, class) jbyte DEL NS_SWIFT_NAME(DEL); @property (readonly, class) jchar MIN NS_SWIFT_NAME(MIN); @property (readonly, class) jchar MAX NS_SWIFT_NAME(MAX); + (jbyte)NUL; + (jbyte)SOH; + (jbyte)STX; + (jbyte)ETX; + (jbyte)EOT; + (jbyte)ENQ; + (jbyte)ACK; + (jbyte)BEL; + (jbyte)BS; + (jbyte)HT; + (jbyte)LF; + (jbyte)NL; + (jbyte)VT; + (jbyte)FF; + (jbyte)CR; + (jbyte)SO; + (jbyte)SI; + (jbyte)DLE; + (jbyte)DC1; + (jbyte)XON; + (jbyte)DC2; + (jbyte)DC3; + (jbyte)XOFF; + (jbyte)DC4; + (jbyte)NAK; + (jbyte)SYN; + (jbyte)ETB; + (jbyte)CAN; + (jbyte)EM; + (jbyte)SUB; + (jbyte)ESC; + (jbyte)FS; + (jbyte)GS; + (jbyte)RS; + (jbyte)US; + (jbyte)SP; + (jbyte)SPACE; + (jbyte)DEL; + (jchar)MIN; + (jchar)MAX; #pragma mark Public /*! @brief Indicates whether the contents of the given character sequences <code>s1</code> and <code>s2</code> are equal, ignoring the case of any ASCII alphabetic characters between <code>'a'</code> and <code>'z'</code> or <code>'A'</code> and <code>'Z'</code> inclusive. <p>This method is significantly faster than <code>String.equalsIgnoreCase</code> and should be used in preference if at least one of the parameters is known to contain only ASCII characters. <p>Note however that this method does not always behave identically to expressions such as: <ul> <li><code>string.toUpperCase().equals("UPPER CASE ASCII")</code> <li><code>string.toLowerCase().equals("lower case ascii")</code> </ul> <p>due to case-folding of some non-ASCII characters (which does not occur in <code>String.equalsIgnoreCase</code> ). However in almost all cases that ASCII strings are used, the author probably wanted the behavior provided by this method rather than the subtle and sometimes surprising behavior of <code>toUpperCase()</code> and <code>toLowerCase()</code>. @since 16.0 */ + (jboolean)equalsIgnoreCaseWithJavaLangCharSequence:(id<JavaLangCharSequence>)s1 withJavaLangCharSequence:(id<JavaLangCharSequence>)s2; /*! @brief Indicates whether <code>c</code> is one of the twenty-six lowercase ASCII alphabetic characters between <code>'a'</code> and <code>'z'</code> inclusive.All others (including non-ASCII characters) return <code>false</code>. */ + (jboolean)isLowerCaseWithChar:(jchar)c; /*! @brief Indicates whether <code>c</code> is one of the twenty-six uppercase ASCII alphabetic characters between <code>'A'</code> and <code>'Z'</code> inclusive.All others (including non-ASCII characters) return <code>false</code>. */ + (jboolean)isUpperCaseWithChar:(jchar)c; /*! @brief If the argument is an uppercase ASCII character returns the lowercase equivalent.Otherwise returns the argument. */ + (jchar)toLowerCaseWithChar:(jchar)c; /*! @brief Returns a copy of the input character sequence in which all uppercase ASCII characters have been converted to lowercase.All other characters are copied without modification. @since 14.0 */ + (NSString *)toLowerCaseWithJavaLangCharSequence:(id<JavaLangCharSequence>)chars; /*! @brief Returns a copy of the input string in which all uppercase ASCII characters have been converted to lowercase.All other characters are copied without modification. */ + (NSString *)toLowerCaseWithNSString:(NSString *)string; /*! @brief If the argument is a lowercase ASCII character returns the uppercase equivalent.Otherwise returns the argument. */ + (jchar)toUpperCaseWithChar:(jchar)c; /*! @brief Returns a copy of the input character sequence in which all lowercase ASCII characters have been converted to uppercase.All other characters are copied without modification. @since 14.0 */ + (NSString *)toUpperCaseWithJavaLangCharSequence:(id<JavaLangCharSequence>)chars; /*! @brief Returns a copy of the input string in which all lowercase ASCII characters have been converted to uppercase.All other characters are copied without modification. */ + (NSString *)toUpperCaseWithNSString:(NSString *)string; /*! @brief Truncates the given character sequence to the given maximum length.If the length of the sequence is greater than <code>maxLength</code>, the returned string will be exactly <code>maxLength</code> chars in length and will end with the given <code>truncationIndicator</code>. Otherwise, the sequence will be returned as a string with no changes to the content. <p>Examples: @code Ascii.truncate("foobar", 7, "..."); // returns "foobar" Ascii.truncate("foobar", 5, "..."); // returns "fo..." @endcode <p><b>Note:</b> This method <i>may</i> work with certain non-ASCII text but is not safe for use with arbitrary Unicode text. It is mostly intended for use with text that is known to be safe for use with it (such as all-ASCII text) and for simple debugging text. When using this method, consider the following: <ul> <li>it may split surrogate pairs <li>it may split characters and combining characters <li>it does not consider word boundaries <li>if truncating for display to users, there are other considerations that must be taken into account <li>the appropriate truncation indicator may be locale-dependent <li>it is safe to use non-ASCII characters in the truncation indicator </ul> @throw IllegalArgumentExceptionif <code>maxLength</code> is less than the length of <code>truncationIndicator</code> @since 16.0 */ + (NSString *)truncateWithJavaLangCharSequence:(id<JavaLangCharSequence>)seq withInt:(jint)maxLength withNSString:(NSString *)truncationIndicator; @end J2OBJC_EMPTY_STATIC_INIT(ComGoogleCommonBaseAscii) /*! @brief Null ('\0'): The all-zeros character which may serve to accomplish time fill and media fill. Normally used as a C string terminator. <p>Although RFC 20 names this as "Null", note that it is distinct from the C/C++ "NULL" pointer. @since 8.0 */ inline jbyte ComGoogleCommonBaseAscii_get_NUL(void); #define ComGoogleCommonBaseAscii_NUL 0 J2OBJC_STATIC_FIELD_CONSTANT(ComGoogleCommonBaseAscii, NUL, jbyte) /*! @brief Start of Heading: A communication control character used at the beginning of a sequence of characters which constitute a machine-sensible address or routing information.Such a sequence is referred to as the "heading." An STX character has the effect of terminating a heading. @since 8.0 */ inline jbyte ComGoogleCommonBaseAscii_get_SOH(void); #define ComGoogleCommonBaseAscii_SOH 1 J2OBJC_STATIC_FIELD_CONSTANT(ComGoogleCommonBaseAscii, SOH, jbyte) /*! @brief Start of Text: A communication control character which precedes a sequence of characters that is to be treated as an entity and entirely transmitted through to the ultimate destination. Such a sequence is referred to as "text." STX may be used to terminate a sequence of characters started by SOH. @since 8.0 */ inline jbyte ComGoogleCommonBaseAscii_get_STX(void); #define ComGoogleCommonBaseAscii_STX 2 J2OBJC_STATIC_FIELD_CONSTANT(ComGoogleCommonBaseAscii, STX, jbyte) /*! @brief End of Text: A communication control character used to terminate a sequence of characters started with STX and transmitted as an entity. @since 8.0 */ inline jbyte ComGoogleCommonBaseAscii_get_ETX(void); #define ComGoogleCommonBaseAscii_ETX 3 J2OBJC_STATIC_FIELD_CONSTANT(ComGoogleCommonBaseAscii, ETX, jbyte) /*! @brief End of Transmission: A communication control character used to indicate the conclusion of a transmission, which may have contained one or more texts and any associated headings. @since 8.0 */ inline jbyte ComGoogleCommonBaseAscii_get_EOT(void); #define ComGoogleCommonBaseAscii_EOT 4 J2OBJC_STATIC_FIELD_CONSTANT(ComGoogleCommonBaseAscii, EOT, jbyte) /*! @brief Enquiry: A communication control character used in data communication systems as a request for a response from a remote station.It may be used as a "Who Are You" (WRU) to obtain identification, or may be used to obtain station status, or both. @since 8.0 */ inline jbyte ComGoogleCommonBaseAscii_get_ENQ(void); #define ComGoogleCommonBaseAscii_ENQ 5 J2OBJC_STATIC_FIELD_CONSTANT(ComGoogleCommonBaseAscii, ENQ, jbyte) /*! @brief Acknowledge: A communication control character transmitted by a receiver as an affirmative response to a sender. @since 8.0 */ inline jbyte ComGoogleCommonBaseAscii_get_ACK(void); #define ComGoogleCommonBaseAscii_ACK 6 J2OBJC_STATIC_FIELD_CONSTANT(ComGoogleCommonBaseAscii, ACK, jbyte) /*! @brief Bell ('\a'): A character for use when there is a need to call for human attention.It may control alarm or attention devices. @since 8.0 */ inline jbyte ComGoogleCommonBaseAscii_get_BEL(void); #define ComGoogleCommonBaseAscii_BEL 7 J2OBJC_STATIC_FIELD_CONSTANT(ComGoogleCommonBaseAscii, BEL, jbyte) /*! @brief Backspace ('\b'): A format effector which controls the movement of the printing position one printing space backward on the same printing line. (Applicable also to display devices.) @since 8.0 */ inline jbyte ComGoogleCommonBaseAscii_get_BS(void); #define ComGoogleCommonBaseAscii_BS 8 J2OBJC_STATIC_FIELD_CONSTANT(ComGoogleCommonBaseAscii, BS, jbyte) /*! @brief Horizontal Tabulation ('\t'): A format effector which controls the movement of the printing position to the next in a series of predetermined positions along the printing line. (Applicable also to display devices and the skip function on punched cards.) @since 8.0 */ inline jbyte ComGoogleCommonBaseAscii_get_HT(void); #define ComGoogleCommonBaseAscii_HT 9 J2OBJC_STATIC_FIELD_CONSTANT(ComGoogleCommonBaseAscii, HT, jbyte) /*! @brief Line Feed ('\n'): A format effector which controls the movement of the printing position to the next printing line. (Applicable also to display devices.) Where appropriate, this character may have the meaning "New Line" (NL), a format effector which controls the movement of the printing point to the first printing position on the next printing line. Use of this convention requires agreement between sender and recipient of data. @since 8.0 */ inline jbyte ComGoogleCommonBaseAscii_get_LF(void); #define ComGoogleCommonBaseAscii_LF 10 J2OBJC_STATIC_FIELD_CONSTANT(ComGoogleCommonBaseAscii, LF, jbyte) /*! @brief Alternate name for <code>LF</code>. (<code>LF</code> is preferred.) @since 8.0 */ inline jbyte ComGoogleCommonBaseAscii_get_NL(void); #define ComGoogleCommonBaseAscii_NL 10 J2OBJC_STATIC_FIELD_CONSTANT(ComGoogleCommonBaseAscii, NL, jbyte) /*! @brief Vertical Tabulation ('\v'): A format effector which controls the movement of the printing position to the next in a series of predetermined printing lines. (Applicable also to display devices.) @since 8.0 */ inline jbyte ComGoogleCommonBaseAscii_get_VT(void); #define ComGoogleCommonBaseAscii_VT 11 J2OBJC_STATIC_FIELD_CONSTANT(ComGoogleCommonBaseAscii, VT, jbyte) /*! @brief Form Feed ('\f'): A format effector which controls the movement of the printing position to the first pre-determined printing line on the next form or page. (Applicable also to display devices.) @since 8.0 */ inline jbyte ComGoogleCommonBaseAscii_get_FF(void); #define ComGoogleCommonBaseAscii_FF 12 J2OBJC_STATIC_FIELD_CONSTANT(ComGoogleCommonBaseAscii, FF, jbyte) /*! @brief Carriage Return ('\r'): A format effector which controls the movement of the printing position to the first printing position on the same printing line. (Applicable also to display devices.) @since 8.0 */ inline jbyte ComGoogleCommonBaseAscii_get_CR(void); #define ComGoogleCommonBaseAscii_CR 13 J2OBJC_STATIC_FIELD_CONSTANT(ComGoogleCommonBaseAscii, CR, jbyte) /*! @brief Shift Out: A control character indicating that the code combinations which follow shall be interpreted as outside of the character set of the standard code table until a Shift In character is reached. @since 8.0 */ inline jbyte ComGoogleCommonBaseAscii_get_SO(void); #define ComGoogleCommonBaseAscii_SO 14 J2OBJC_STATIC_FIELD_CONSTANT(ComGoogleCommonBaseAscii, SO, jbyte) /*! @brief Shift In: A control character indicating that the code combinations which follow shall be interpreted according to the standard code table. @since 8.0 */ inline jbyte ComGoogleCommonBaseAscii_get_SI(void); #define ComGoogleCommonBaseAscii_SI 15 J2OBJC_STATIC_FIELD_CONSTANT(ComGoogleCommonBaseAscii, SI, jbyte) /*! @brief Data Link Escape: A communication control character which will change the meaning of a limited number of contiguously following characters.It is used exclusively to provide supplementary controls in data communication networks. @since 8.0 */ inline jbyte ComGoogleCommonBaseAscii_get_DLE(void); #define ComGoogleCommonBaseAscii_DLE 16 J2OBJC_STATIC_FIELD_CONSTANT(ComGoogleCommonBaseAscii, DLE, jbyte) /*! @brief Device Control 1.Characters for the control of ancillary devices associated with data processing or telecommunication systems, more especially switching devices "on" or "off." (If a single "stop" control is required to interrupt or turn off ancillary devices, DC4 is the preferred assignment.) @since 8.0 */ inline jbyte ComGoogleCommonBaseAscii_get_DC1(void); #define ComGoogleCommonBaseAscii_DC1 17 J2OBJC_STATIC_FIELD_CONSTANT(ComGoogleCommonBaseAscii, DC1, jbyte) /*! @brief Transmission On: Although originally defined as DC1, this ASCII control character is now better known as the XON code used for software flow control in serial communications.The main use is restarting the transmission after the communication has been stopped by the XOFF control code. @since 8.0 */ inline jbyte ComGoogleCommonBaseAscii_get_XON(void); #define ComGoogleCommonBaseAscii_XON 17 J2OBJC_STATIC_FIELD_CONSTANT(ComGoogleCommonBaseAscii, XON, jbyte) /*! @brief Device Control 2.Characters for the control of ancillary devices associated with data processing or telecommunication systems, more especially switching devices "on" or "off." (If a single "stop" control is required to interrupt or turn off ancillary devices, DC4 is the preferred assignment.) @since 8.0 */ inline jbyte ComGoogleCommonBaseAscii_get_DC2(void); #define ComGoogleCommonBaseAscii_DC2 18 J2OBJC_STATIC_FIELD_CONSTANT(ComGoogleCommonBaseAscii, DC2, jbyte) /*! @brief Device Control 3.Characters for the control of ancillary devices associated with data processing or telecommunication systems, more especially switching devices "on" or "off." (If a single "stop" control is required to interrupt or turn off ancillary devices, DC4 is the preferred assignment.) @since 8.0 */ inline jbyte ComGoogleCommonBaseAscii_get_DC3(void); #define ComGoogleCommonBaseAscii_DC3 19 J2OBJC_STATIC_FIELD_CONSTANT(ComGoogleCommonBaseAscii, DC3, jbyte) /*! @brief Transmission off.See <code>XON</code> for explanation. @since 8.0 */ inline jbyte ComGoogleCommonBaseAscii_get_XOFF(void); #define ComGoogleCommonBaseAscii_XOFF 19 J2OBJC_STATIC_FIELD_CONSTANT(ComGoogleCommonBaseAscii, XOFF, jbyte) /*! @brief Device Control 4.Characters for the control of ancillary devices associated with data processing or telecommunication systems, more especially switching devices "on" or "off." (If a single "stop" control is required to interrupt or turn off ancillary devices, DC4 is the preferred assignment.) @since 8.0 */ inline jbyte ComGoogleCommonBaseAscii_get_DC4(void); #define ComGoogleCommonBaseAscii_DC4 20 J2OBJC_STATIC_FIELD_CONSTANT(ComGoogleCommonBaseAscii, DC4, jbyte) /*! @brief Negative Acknowledge: A communication control character transmitted by a receiver as a negative response to the sender. @since 8.0 */ inline jbyte ComGoogleCommonBaseAscii_get_NAK(void); #define ComGoogleCommonBaseAscii_NAK 21 J2OBJC_STATIC_FIELD_CONSTANT(ComGoogleCommonBaseAscii, NAK, jbyte) /*! @brief Synchronous Idle: A communication control character used by a synchronous transmission system in the absence of any other character to provide a signal from which synchronism may be achieved or retained. @since 8.0 */ inline jbyte ComGoogleCommonBaseAscii_get_SYN(void); #define ComGoogleCommonBaseAscii_SYN 22 J2OBJC_STATIC_FIELD_CONSTANT(ComGoogleCommonBaseAscii, SYN, jbyte) /*! @brief End of Transmission Block: A communication control character used to indicate the end of a block of data for communication purposes.ETB is used for blocking data where the block structure is not necessarily related to the processing format. @since 8.0 */ inline jbyte ComGoogleCommonBaseAscii_get_ETB(void); #define ComGoogleCommonBaseAscii_ETB 23 J2OBJC_STATIC_FIELD_CONSTANT(ComGoogleCommonBaseAscii, ETB, jbyte) /*! @brief Cancel: A control character used to indicate that the data with which it is sent is in error or is to be disregarded. @since 8.0 */ inline jbyte ComGoogleCommonBaseAscii_get_CAN(void); #define ComGoogleCommonBaseAscii_CAN 24 J2OBJC_STATIC_FIELD_CONSTANT(ComGoogleCommonBaseAscii, CAN, jbyte) /*! @brief End of Medium: A control character associated with the sent data which may be used to identify the physical end of the medium, or the end of the used, or wanted, portion of information recorded on a medium. (The position of this character does not necessarily correspond to the physical end of the medium.) @since 8.0 */ inline jbyte ComGoogleCommonBaseAscii_get_EM(void); #define ComGoogleCommonBaseAscii_EM 25 J2OBJC_STATIC_FIELD_CONSTANT(ComGoogleCommonBaseAscii, EM, jbyte) /*! @brief Substitute: A character that may be substituted for a character which is determined to be invalid or in error. @since 8.0 */ inline jbyte ComGoogleCommonBaseAscii_get_SUB(void); #define ComGoogleCommonBaseAscii_SUB 26 J2OBJC_STATIC_FIELD_CONSTANT(ComGoogleCommonBaseAscii, SUB, jbyte) /*! @brief Escape: A control character intended to provide code extension (supplementary characters) in general information interchange.The Escape character itself is a prefix affecting the interpretation of a limited number of contiguously following characters. @since 8.0 */ inline jbyte ComGoogleCommonBaseAscii_get_ESC(void); #define ComGoogleCommonBaseAscii_ESC 27 J2OBJC_STATIC_FIELD_CONSTANT(ComGoogleCommonBaseAscii, ESC, jbyte) /*! @brief File Separator: These four information separators may be used within data in optional fashion, except that their hierarchical relationship shall be: FS is the most inclusive, then GS, then RS, and US is least inclusive. (The content and length of a File, Group, Record, or Unit are not specified.) @since 8.0 */ inline jbyte ComGoogleCommonBaseAscii_get_FS(void); #define ComGoogleCommonBaseAscii_FS 28 J2OBJC_STATIC_FIELD_CONSTANT(ComGoogleCommonBaseAscii, FS, jbyte) /*! @brief Group Separator: These four information separators may be used within data in optional fashion, except that their hierarchical relationship shall be: FS is the most inclusive, then GS, then RS, and US is least inclusive. (The content and length of a File, Group, Record, or Unit are not specified.) @since 8.0 */ inline jbyte ComGoogleCommonBaseAscii_get_GS(void); #define ComGoogleCommonBaseAscii_GS 29 J2OBJC_STATIC_FIELD_CONSTANT(ComGoogleCommonBaseAscii, GS, jbyte) /*! @brief Record Separator: These four information separators may be used within data in optional fashion, except that their hierarchical relationship shall be: FS is the most inclusive, then GS, then RS, and US is least inclusive. (The content and length of a File, Group, Record, or Unit are not specified.) @since 8.0 */ inline jbyte ComGoogleCommonBaseAscii_get_RS(void); #define ComGoogleCommonBaseAscii_RS 30 J2OBJC_STATIC_FIELD_CONSTANT(ComGoogleCommonBaseAscii, RS, jbyte) /*! @brief Unit Separator: These four information separators may be used within data in optional fashion, except that their hierarchical relationship shall be: FS is the most inclusive, then GS, then RS, and US is least inclusive. (The content and length of a File, Group, Record, or Unit are not specified.) @since 8.0 */ inline jbyte ComGoogleCommonBaseAscii_get_US(void); #define ComGoogleCommonBaseAscii_US 31 J2OBJC_STATIC_FIELD_CONSTANT(ComGoogleCommonBaseAscii, US, jbyte) /*! @brief Space: A normally non-printing graphic character used to separate words.It is also a format effector which controls the movement of the printing position, one printing position forward. (Applicable also to display devices.) @since 8.0 */ inline jbyte ComGoogleCommonBaseAscii_get_SP(void); #define ComGoogleCommonBaseAscii_SP 32 J2OBJC_STATIC_FIELD_CONSTANT(ComGoogleCommonBaseAscii, SP, jbyte) /*! @brief Alternate name for <code>SP</code>. @since 8.0 */ inline jbyte ComGoogleCommonBaseAscii_get_SPACE(void); #define ComGoogleCommonBaseAscii_SPACE 32 J2OBJC_STATIC_FIELD_CONSTANT(ComGoogleCommonBaseAscii, SPACE, jbyte) /*! @brief Delete: This character is used primarily to "erase" or "obliterate" erroneous or unwanted characters in perforated tape. @since 8.0 */ inline jbyte ComGoogleCommonBaseAscii_get_DEL(void); #define ComGoogleCommonBaseAscii_DEL 127 J2OBJC_STATIC_FIELD_CONSTANT(ComGoogleCommonBaseAscii, DEL, jbyte) /*! @brief The minimum value of an ASCII character. @since 9.0 (was type <code>int</code> before 12.0) */ inline jchar ComGoogleCommonBaseAscii_get_MIN(void); #define ComGoogleCommonBaseAscii_MIN 0x0000 J2OBJC_STATIC_FIELD_CONSTANT(ComGoogleCommonBaseAscii, MIN, jchar) /*! @brief The maximum value of an ASCII character. @since 9.0 (was type <code>int</code> before 12.0) */ inline jchar ComGoogleCommonBaseAscii_get_MAX(void); #define ComGoogleCommonBaseAscii_MAX 0x007f J2OBJC_STATIC_FIELD_CONSTANT(ComGoogleCommonBaseAscii, MAX, jchar) FOUNDATION_EXPORT NSString *ComGoogleCommonBaseAscii_toLowerCaseWithNSString_(NSString *string); FOUNDATION_EXPORT NSString *ComGoogleCommonBaseAscii_toLowerCaseWithJavaLangCharSequence_(id<JavaLangCharSequence> chars); FOUNDATION_EXPORT jchar ComGoogleCommonBaseAscii_toLowerCaseWithChar_(jchar c); FOUNDATION_EXPORT NSString *ComGoogleCommonBaseAscii_toUpperCaseWithNSString_(NSString *string); FOUNDATION_EXPORT NSString *ComGoogleCommonBaseAscii_toUpperCaseWithJavaLangCharSequence_(id<JavaLangCharSequence> chars); FOUNDATION_EXPORT jchar ComGoogleCommonBaseAscii_toUpperCaseWithChar_(jchar c); FOUNDATION_EXPORT jboolean ComGoogleCommonBaseAscii_isLowerCaseWithChar_(jchar c); FOUNDATION_EXPORT jboolean ComGoogleCommonBaseAscii_isUpperCaseWithChar_(jchar c); FOUNDATION_EXPORT NSString *ComGoogleCommonBaseAscii_truncateWithJavaLangCharSequence_withInt_withNSString_(id<JavaLangCharSequence> seq, jint maxLength, NSString *truncationIndicator); FOUNDATION_EXPORT jboolean ComGoogleCommonBaseAscii_equalsIgnoreCaseWithJavaLangCharSequence_withJavaLangCharSequence_(id<JavaLangCharSequence> s1, id<JavaLangCharSequence> s2); J2OBJC_TYPE_LITERAL_HEADER(ComGoogleCommonBaseAscii) #endif #if __has_feature(nullability) #pragma clang diagnostic pop #endif #pragma clang diagnostic pop #pragma pop_macro("INCLUDE_ALL_ComGoogleCommonBaseAscii")
37.020718
185
0.787486
9bab62842d5a488cc7a4cccf23023d5de2d9283f
824
h
C
inc/tp_image_utils_functions/AddBorder.h
omi-lab/tp_image_utils_functions
5d02c634a87304eeb9c5b0828ebf8f18383aa91a
[ "MIT" ]
null
null
null
inc/tp_image_utils_functions/AddBorder.h
omi-lab/tp_image_utils_functions
5d02c634a87304eeb9c5b0828ebf8f18383aa91a
[ "MIT" ]
null
null
null
inc/tp_image_utils_functions/AddBorder.h
omi-lab/tp_image_utils_functions
5d02c634a87304eeb9c5b0828ebf8f18383aa91a
[ "MIT" ]
2
2019-01-30T14:02:44.000Z
2020-11-25T09:19:14.000Z
#ifndef tp_image_utils_functions_AddBorder_h #define tp_image_utils_functions_AddBorder_h #include "tp_image_utils_functions/Globals.h" #include "tp_image_utils/ByteMap.h" #include "tp_utils/TPPixel.h" namespace tp_image_utils_functions { //################################################################################################## tp_image_utils::ByteMap addBorder(const tp_image_utils::ByteMap& src, size_t width, uint8_t value=0); //################################################################################################## tp_image_utils::ColorMap addBorder(const tp_image_utils::ColorMap& src, size_t width, const TPPixel& color=TPPixel(0,0,0,255)); } #endif
34.333333
100
0.48301
4b6ee8fc7eb28d02dd9b073ca9bca66a99e1d1dd
463
c
C
tests/main.c
patflick/splatt
b4bbad44824e1fd7893beb79c4ac99a25edff47e
[ "MIT" ]
58
2016-06-29T05:32:23.000Z
2021-10-30T05:59:13.000Z
tests/main.c
patflick/splatt
b4bbad44824e1fd7893beb79c4ac99a25edff47e
[ "MIT" ]
23
2016-06-26T21:36:03.000Z
2022-03-03T20:18:41.000Z
tests/main.c
patflick/splatt
b4bbad44824e1fd7893beb79c4ac99a25edff47e
[ "MIT" ]
30
2016-06-26T03:34:30.000Z
2022-02-28T11:17:29.000Z
#define CTEST_MAIN #define CTEST_SEGFAULT #include "ctest/ctest.h" #include "splatt_test.h" #ifdef SPLATT_USE_MPI #include <mpi.h> #endif int main(int argc, char ** argv) { #ifdef SPLATT_USE_MPI /* even serial tests with MPI enabled need this */ MPI_Init(&argc, &argv); #endif /* this cast is annoying */ char const ** margv = (char const **)argv; int ret = ctest_main(argc, margv); #ifdef SPLATT_USE_MPI MPI_Finalize(); #endif return ret; }
15.965517
52
0.695464
6f3e84b263b77c6f3671f820371dbec08882feb2
526
h
C
qSIP/SettingAccountForm.h
soramimi/qSIP
cd328f99c41342021fd316a5cd75bc2e48b42985
[ "MIT" ]
22
2017-10-10T09:52:26.000Z
2022-03-31T14:55:45.000Z
qSIP/SettingAccountForm.h
soramimi/qSIP
cd328f99c41342021fd316a5cd75bc2e48b42985
[ "MIT" ]
5
2017-10-11T19:34:11.000Z
2020-01-13T06:36:37.000Z
qSIP/SettingAccountForm.h
soramimi/qSIP
cd328f99c41342021fd316a5cd75bc2e48b42985
[ "MIT" ]
6
2018-12-19T16:07:22.000Z
2021-03-29T02:32:34.000Z
#ifndef SETTINGACCOUNTFORM_H #define SETTINGACCOUNTFORM_H #include "AbstractSettingForm.h" #include <QWidget> namespace Ui { class SettingAccountForm; } class SettingAccountForm : public AbstractSettingForm { Q_OBJECT private: Ui::SettingAccountForm *ui; void exchangeAccount(bool save, SIP::Account *a); protected: void exchange(bool save); public: explicit SettingAccountForm(QWidget *parent = 0); ~SettingAccountForm(); private slots: void on_pushButton_reregister_clicked(); }; #endif // SETTINGACCOUNTFORM_H
18.785714
55
0.790875
8d63ba2fde45406e6f546c5a3503a84b581bfece
2,888
h
C
gl_src/glsl.h
skatto/glslRayTraceRenderer
4425caa4d9ae5855002127cd054cb291736a144e
[ "MIT" ]
null
null
null
gl_src/glsl.h
skatto/glslRayTraceRenderer
4425caa4d9ae5855002127cd054cb291736a144e
[ "MIT" ]
null
null
null
gl_src/glsl.h
skatto/glslRayTraceRenderer
4425caa4d9ae5855002127cd054cb291736a144e
[ "MIT" ]
null
null
null
#ifndef GLSL_H_2016_06_16 #define GLSL_H_2016_06_16 #include <iostream> #include <string> #include <GL/glew.h> #include <GLFW/glfw3.h> #ifdef MAC_OS_X #include <OpenGL/OpenGL.h> #elif LINUX #include <GL/gl.h> #endif #define CHECK_GL_ERROR() \ { \ GLenum errcode = glGetError(); \ if (errcode != GL_NO_ERROR) { \ std::string errstring = getGlErrStr(errcode); \ std::cerr << __FILE__ << ":" << __LINE__ << " : " << errstring \ << std::endl; \ exit(1); \ } \ } GLuint create_shader(const char* filename, GLenum type); GLuint create_shader_from_src(const char* source, GLenum type); inline bool getAttribLoc(const char* attrib_name, GLuint& attrib_id, GLuint program) { GLint ret = glGetAttribLocation(program, attrib_name); if (ret == -1) { fprintf(stderr, "Could not bind attribute %s\n", attrib_name); return false; } attrib_id = GLuint(ret); return true; } inline bool getUniLoc(const char* uniform_name, GLint& uniform_id, GLuint program) { uniform_id = glGetUniformLocation(program, uniform_name); if (uniform_id == -1) { fprintf(stderr, "Could not bind uniform %s\n", uniform_name); return false; } return true; } inline std::string getGlErrStr(const GLenum& errcode) { if (errcode == GL_INVALID_ENUM) { return "GL_INVALID_ENUM"; } else if (errcode == GL_INVALID_VALUE) { return "GL_INVALID_VALUE"; } else if (errcode == GL_INVALID_OPERATION) { return "GL_INVALID_OPERATION"; } else if (errcode == GL_STACK_OVERFLOW) { return "GL_STACK_OVERFLOW"; } else if (errcode == GL_STACK_UNDERFLOW) { return "GL_STACK_UNDERFLOW"; } else if (errcode == GL_OUT_OF_MEMORY) { return "GL_OUT_OF_MEMORY"; } else if (errcode == GL_INVALID_FRAMEBUFFER_OPERATION) { return "GL_INVALID_FRAMEBUFFER_OPERATION"; } return "other error"; } inline void checkGlError(const std::string& label = std::string()) { GLenum errcode = glGetError(); if (errcode != GL_NO_ERROR) { std::string errstring = getGlErrStr(errcode); if (!label.empty()) std::cout << label << " : "; std::cout << errstring << std::endl; exit(1); } } inline std::string getGLVesion() { return reinterpret_cast<const char*>(glGetString(GL_VERSION)); } inline std::string getGLVendor() { return reinterpret_cast<const char*>(glGetString(GL_VENDOR)); } inline std::string getGLRenderer() { return reinterpret_cast<const char*>(glGetString(GL_RENDERER)); } #endif /* glsl_hpp */
30.723404
70
0.587604
02409241a2fc64025151aa0eadad81f700653775
2,839
c
C
pc_sw/PC_01_Uart_Consol/src/hw/core/uart.c
chcbaram/nucleof103_fw
8800d7dfbc7d856d22e0a43c2a70bea4a1157f21
[ "Apache-2.0" ]
null
null
null
pc_sw/PC_01_Uart_Consol/src/hw/core/uart.c
chcbaram/nucleof103_fw
8800d7dfbc7d856d22e0a43c2a70bea4a1157f21
[ "Apache-2.0" ]
null
null
null
pc_sw/PC_01_Uart_Consol/src/hw/core/uart.c
chcbaram/nucleof103_fw
8800d7dfbc7d856d22e0a43c2a70bea4a1157f21
[ "Apache-2.0" ]
null
null
null
/* * uart.c * * Created on: 2018. 9. 9. * Author: Baram */ #include "uart.h" #include <conio.h> typedef struct { bool is_open; bool is_consol; uint32_t baud; HANDLE serial_handle; char port_name[256]; } uart_t; uart_t uart_tbl[UART_MAX_CH]; void uartInit(void) { uint8_t i; for (i=0; i<UART_MAX_CH; i++) { uart_tbl[i].is_open = false; uart_tbl[i].is_consol = false; } } bool uartOpen(uint8_t channel, uint32_t baud) { bool ret = false; uart_t *p_uart; switch(channel) { case _DEF_UART1: p_uart = &uart_tbl[channel]; p_uart->baud = baud; p_uart->is_open = true; p_uart->is_consol = true; break; } return ret; } bool uartClose(uint8_t channel) { bool ret = false; uart_t *p_uart = &uart_tbl[channel]; if (channel >= UART_MAX_CH) { return false; } if (uart_tbl[channel].is_open == false) { return false; } if (p_uart->is_consol == true) { } else { CloseHandle(p_uart->serial_handle); p_uart->is_open = false; } return ret; } uint32_t uartAvailable(uint8_t channel) { uint32_t ret = 0; uart_t *p_uart = &uart_tbl[channel]; if (channel >= UART_MAX_CH) { return 0; } if (p_uart->is_open == false) { return 0; } if (p_uart->is_consol == true) { if(kbhit()) { ret = 1; } } else { } return ret; } void uartFlush(uint8_t channel) { } void uartPutch(uint8_t channel, uint8_t ch) { uartWrite(channel, &ch, 1 ); } uint8_t uartGetch(uint8_t channel) { uint8_t ret = 0; if (channel >= UART_MAX_CH) { return 0; } if (uart_tbl[channel].is_open == false) { return 0; } while(1) { if (uartAvailable(channel) > 0) { ret = uartRead(channel); break; } } return ret; } int32_t uartWrite(uint8_t channel, uint8_t *p_data, uint32_t length) { int32_t ret = 0; uart_t *p_uart = &uart_tbl[channel]; if (channel >= UART_MAX_CH) { return 0; } if (p_uart->is_open == false) { return 0; } if (p_uart->is_consol == true) { for (int i=0; i<length; i++) { putch(p_data[i]); } } else { } return ret; } uint8_t uartRead(uint8_t channel) { uint8_t ret = 0; uart_t *p_uart = &uart_tbl[channel]; if (channel >= UART_MAX_CH) { return 0; } if (p_uart->is_open == false) { return 0; } if (p_uart->is_consol == true) { ret = getch(); } else { } return ret; } int32_t uartPrintf(uint8_t channel, const char *fmt, ...) { int32_t ret = 0; va_list arg; va_start (arg, fmt); int32_t len; char print_buffer[256]; len = vsnprintf(print_buffer, 255, fmt, arg); va_end (arg); ret = uartWrite(channel, (uint8_t *)print_buffer, len); return ret; }
11.978903
68
0.578725
9d75ac14f9f7cbafac2b0e359083e67c2dbec16c
1,226
h
C
CGProj/game.h
mayankmetha/Classical-Snakes-Game
dd56c344188cc48f5cb710f3aac07202f4009dab
[ "MIT" ]
null
null
null
CGProj/game.h
mayankmetha/Classical-Snakes-Game
dd56c344188cc48f5cb710f3aac07202f4009dab
[ "MIT" ]
null
null
null
CGProj/game.h
mayankmetha/Classical-Snakes-Game
dd56c344188cc48f5cb710f3aac07202f4009dab
[ "MIT" ]
null
null
null
//define header #ifndef _GAME_H #define _GAME_H //include headers #include"platforms.h" #include<stdio.h> #include<stdlib.h> #include<cstring> #include<cmath> #include<time.h> //constants #define ROWS 40 //yaxis #define COLUMNS 40 //xaxis #define FPS 12 //frame per seconds #define MIN_FPS 5 //minimum FPS //directions numbers #define UP 1 #define RIGHT 2 #define DOWN 3 #define LEFT 4 //max length of snake #define MAX_LEN 60; //colors typedef float colors[3]; const colors GREY = { 0.5,0.5,0.5 }; const colors WHITE = { 1.0,1.0,1.0 }; const colors RED = { 1.0,0.0,0.0 }; const colors GREEN = { 0.0,1.0,0.0 }; const colors DGREEN = { 0.0,0.8,0.0 }; const colors AQUAMARINE = { 0.498, 1.000, 0.831 }; const colors CYAN = { 0.0,1.0,1.0 }; const colors MAGENTA = { 1.0,0.0,1.0 }; const colors YELLOW = { 1.0,1.0,0.0 }; const colors DORANGE = { 1.000,0.549,0.000 }; //sharable functions void initGame(); void initGrid(int, int); void drawWall(); void drawGrid(); void drawSnake(); void drawFood(); void makeGameOver(); void random(int&, int&, int&); void renderWelcome(); void renderGame(); void renderPause(); void renderExit(); void turnUp(); void turnDown(); void turnRight(); void turnLeft(); void autoPlay(); #endif
20.098361
50
0.685155
ae18fce65a945d70210014edfb7ff25acf861453
1,114
c
C
str/str_rchr.c
jon-finkel/42-libft
4e63939f2c02fcf22fccb2e7b20e3fb48d6a349c
[ "MIT" ]
null
null
null
str/str_rchr.c
jon-finkel/42-libft
4e63939f2c02fcf22fccb2e7b20e3fb48d6a349c
[ "MIT" ]
null
null
null
str/str_rchr.c
jon-finkel/42-libft
4e63939f2c02fcf22fccb2e7b20e3fb48d6a349c
[ "MIT" ]
null
null
null
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* mem_rchr.c :+: :+: :+: */ /* +:+ +:+ +:+ */ /* By: nfinkel <nfinkel@student.42.fr> +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2018/04/22 17:17:09 by nfinkel #+# #+# */ /* Updated: 2019/03/11 21:50:16 by nfinkel ### ########.fr */ /* */ /* ************************************************************************** */ #include "libft/str.h" inline char *ft_strrchr(const char *s, int c) { char *last; last = NULL; while (*s) { if (*s == (char)c) last = (char *)s; ++s; } if (!(char)c) return ((char *)s); return (last); }
37.133333
80
0.193896
5b45fce6353515ae94df50952a09ece021f5d299
2,116
c
C
test/mpi/pt2pt/anyall.c
grondo/mvapich2-cce
ec084d8e07db1cf2ac1352ee4c604ae7dbae55cb
[ "Intel", "mpich2", "Unlicense" ]
1
2021-11-11T15:42:30.000Z
2021-11-11T15:42:30.000Z
test/mpi/pt2pt/anyall.c
grondo/mvapich2-cce
ec084d8e07db1cf2ac1352ee4c604ae7dbae55cb
[ "Intel", "mpich2", "Unlicense" ]
null
null
null
test/mpi/pt2pt/anyall.c
grondo/mvapich2-cce
ec084d8e07db1cf2ac1352ee4c604ae7dbae55cb
[ "Intel", "mpich2", "Unlicense" ]
null
null
null
/* -*- Mode: C; c-basic-offset:4 ; -*- */ /* * (C) 2009 by Argonne National Laboratory. * See COPYRIGHT in top-level directory. */ #include "mpi.h" #include <stdio.h> #include <stdlib.h> #include "mpitest.h" #define MAX_MSGS 30 /* static char MTEST_Descrip[] = "One implementation delivered incorrect data when an MPI recieve uses both ANY_SOURCE and ANY_TAG"; */ int main( int argc, char *argv[] ) { int wrank, wsize, master, worker, i, j, idx, count; int errs = 0; MPI_Request r[MAX_MSGS]; int buf[MAX_MSGS][MAX_MSGS]; MPI_Comm comm; MPI_Status status; MTest_Init( &argc, &argv ); MPI_Comm_rank( MPI_COMM_WORLD, &wrank ); MPI_Comm_size( MPI_COMM_WORLD, &wsize ); comm = MPI_COMM_WORLD; master = 0; worker = 1; /* The test takes advantage of the ordering rules for messages*/ if (wrank == master) { /* Initialize the send buffer */ for (i=0; i<MAX_MSGS; i++) { for (j=0; j<MAX_MSGS; j++) { buf[i][j] = i*MAX_MSGS + j; } } MPI_Barrier( MPI_COMM_WORLD ); for (i=0; i<MAX_MSGS; i++) { MPI_Send( buf[i], MAX_MSGS-i, MPI_INT, worker, 3, comm ); } } else if (wrank == worker) { /* Initialize the recv buffer */ for (i=0; i<MAX_MSGS; i++) { for (j=0; j<MAX_MSGS; j++) { buf[i][j] = -1; } } for (i=0; i<MAX_MSGS; i++) { MPI_Irecv( buf[i], MAX_MSGS-i, MPI_INT, MPI_ANY_SOURCE, MPI_ANY_TAG, comm, &r[i] ); } MPI_Barrier( MPI_COMM_WORLD ); for (i=0; i<MAX_MSGS; i++) { MPI_Waitany( MAX_MSGS, r, &idx, &status ); /* Message idx should have length MAX_MSGS-idx */ MPI_Get_count( &status, MPI_INT, &count ); if (count != MAX_MSGS-idx) { errs++; } else { /* Check for the correct answers */ for (j=0; j < MAX_MSGS-idx; j++) { if (buf[idx][j] != idx * MAX_MSGS + j) { errs ++; printf( "Message %d [%d] is %d, should be %d\n", idx, j, buf[idx][j], idx * MAX_MSGS + j ); } } } } } else { MPI_Barrier( MPI_COMM_WORLD ); } MTest_Finalize( errs ); MPI_Finalize(); return 0; }
23.775281
129
0.573724
162b6c1cdb4ebbc0cbc3664b34fa6b8de7386285
638
h
C
stanford_cs110/assign2/inode.h
zhanshi-wang/zsw_main
5ea70d9af1855dad7f3a249e0af04428608f0c07
[ "MIT" ]
12
2020-05-12T22:05:08.000Z
2021-12-23T17:06:00.000Z
stanford_cs110/assign2/inode.h
zhanshi-wang/zsw_main
5ea70d9af1855dad7f3a249e0af04428608f0c07
[ "MIT" ]
null
null
null
stanford_cs110/assign2/inode.h
zhanshi-wang/zsw_main
5ea70d9af1855dad7f3a249e0af04428608f0c07
[ "MIT" ]
14
2020-05-30T18:19:25.000Z
2021-12-06T09:22:23.000Z
#ifndef _INODE_H #define _INODE_H #include "unixfilesystem.h" /** * Fetches the specified inode from the filesystem. * Returns 0 on success, -1 on error. */ int inode_iget(struct unixfilesystem *fs, int inumber, struct inode *inp); /** * Given an index of a file block, retrieves the file's actual block number * of from the given inode. * * Returns the disk block number on success, -1 on error. */ int inode_indexlookup(struct unixfilesystem *fs, struct inode *inp, int blockNum); /** * Computes the size in bytes of the file identified by the given inode */ int inode_getsize(struct inode *inp); #endif // _INODE_
24.538462
82
0.719436
64daa73d4749ba67deeb95fd36994b09ba994a8e
21,171
h
C
include/ultimate_msckf_vio/ekf_state.h
cqrtxwd/msckf_vio
9b517877a21f61ea0969ebcc2b12d34480b75144
[ "MIT" ]
3
2019-04-08T16:35:27.000Z
2019-09-03T15:31:41.000Z
include/ultimate_msckf_vio/ekf_state.h
cqrtxwd/msckf_vio
9b517877a21f61ea0969ebcc2b12d34480b75144
[ "MIT" ]
null
null
null
include/ultimate_msckf_vio/ekf_state.h
cqrtxwd/msckf_vio
9b517877a21f61ea0969ebcc2b12d34480b75144
[ "MIT" ]
null
null
null
#ifndef EKF_STATE_H_ #define EKF_STATE_H_ #include <eigen3/Eigen/Eigen> #include <glog/logging.h> #include <deque> namespace ultimate_msckf_vio { using Eigen::Matrix; using Eigen::Matrix3d; using Eigen::Quaternion; using Eigen::Vector3d; using std::vector; using std::deque; // state size : constexpr int kVectorStateSize = 3; constexpr int kQuaterionStateSize = 4; constexpr int kVectorErrorStateSize = 3; constexpr int kQuaterionErrorStateSize = 3; constexpr int kImuStateSize = kQuaterionStateSize + 4 * kVectorStateSize; // 16 constexpr int kImuErrorStateSize = kQuaterionErrorStateSize + 4 * kVectorErrorStateSize; // 15 constexpr int kCalibrationStateSize = kQuaterionStateSize + kVectorStateSize; constexpr int kCalibrationErrorStateSize = kQuaterionErrorStateSize + kVectorStateSize; constexpr int kKeyframeStateSize = kQuaterionStateSize + kVectorStateSize; constexpr int kKeyframeErrorStateSize = kQuaterionErrorStateSize + kVectorStateSize; // state index : constexpr int kImuQStateIndex = 0; constexpr int kImuBgStateIndex = kQuaterionStateSize + kImuQStateIndex; constexpr int kImuVStateIndex = kVectorStateSize + kImuBgStateIndex; constexpr int kImuBaStateIndex = kVectorStateSize + kImuVStateIndex; constexpr int kImuPStateIndex = kVectorStateSize + kImuBaStateIndex; constexpr int kCalibrationQStateIndex = kImuPStateIndex + kVectorStateSize; constexpr int kCalibrationPStateIndex = kCalibrationQStateIndex + kQuaterionStateSize; constexpr int kImuQErrorStateIndex = 0; constexpr int kImuBgErrorStateIndex = kQuaterionErrorStateSize + kImuQErrorStateIndex; // 3 constexpr int kImuVErrorStateIndex = kVectorErrorStateSize + kImuBgErrorStateIndex; // 6 constexpr int kImuBaErrorStateIndex = kVectorErrorStateSize + kImuVErrorStateIndex; // 9 constexpr int kImuPErrorStateIndex = kVectorErrorStateSize + kImuBaErrorStateIndex; // 12 constexpr int kCalibQErrorStateIndex = kImuPErrorStateIndex + kVectorStateSize; // 15 constexpr int kCalibPErrorStateIndex = kCalibQErrorStateIndex + kVectorStateSize; // 18 constexpr int kImuStateIndex = 0; constexpr int kCalibrationStateIndex = kImuStateIndex + kImuStateSize; // 16 constexpr int kKeyframeStateIndex = kCalibrationStateIndex + kCalibrationStateSize; //23 constexpr int kImuErrorStateIndex = 0; constexpr int kCalibrationErrorStateIndex = kImuErrorStateIndex + kImuErrorStateSize; // 16 constexpr int kKeyframeErrorStateIndex = kCalibrationErrorStateIndex + kCalibrationErrorStateSize; //23 /* * imu state sequence : [q, bg, v, ba, p] */ template <typename Scalar> class ImuState { public: ImuState(): q_G_I_(1, 0, 0 ,0), bg_(0, 0, 0), v_G_I_(0, 0, 0), ba_(0, 0, 0), p_G_I_(0, 0, 0) {} ImuState(const Quaternion<Scalar>& q_G_I, const Matrix<Scalar, 3, 1>& bg, const Matrix<Scalar, 3, 1>& v_G_I, const Matrix<Scalar, 3, 1>& ba, const Matrix<Scalar, 3, 1>& p_G_I): q_G_I_(q_G_I), bg_(bg), v_G_I_(v_G_I), ba_(ba), p_G_I_(p_G_I) {} Quaternion<Scalar> q_G_I() const { return q_G_I_; } Matrix<Scalar, 3, 1> bg() const{ return bg_; } Matrix<Scalar, 3, 1> v_G_I() const { return v_G_I_; } Matrix<Scalar, 3, 1> ba() const { return ba_; } Matrix<Scalar, 3, 1> p_G_I() const { return p_G_I_; } static int StateSize() { return kImuStateSize; } static int ErrorStateSize() { return kImuErrorStateSize; } void SetState(const Quaternion<Scalar>& q_G_I, const Matrix<Scalar, 3, 1>& bg, const Matrix<Scalar, 3, 1>& v_G_I, const Matrix<Scalar, 3, 1>& ba, const Matrix<Scalar, 3, 1>& p_G_I) { q_G_I_ = q_G_I; bg_ = bg, v_G_I_ = v_G_I, ba_ = ba, p_G_I_ = p_G_I; } void SetZeroState() { SetState(Quaternion<Scalar>(1, 0, 0, 0), Matrix<Scalar, 3, 1>::Zero(), Matrix<Scalar, 3, 1>::Zero(), Matrix<Scalar, 3, 1>::Zero(), Matrix<Scalar, 3, 1>::Zero()); } Matrix<Scalar, 16, 1> GetImuStateVector() const { Matrix<Scalar, 16, 1> imu_state_vector; imu_state_vector << q_G_I_.coeffs(), bg_, v_G_I_, ba_, p_G_I_; return imu_state_vector; } // quaternion [x ,y ,z ,w] void SetImuStateFromVector(const Matrix<Scalar, Eigen::Dynamic, 1>& state_vector) { CHECK(state_vector.rows() == kImuStateSize) << "input imu state invalid !!!"; CHECK(state_vector.cols() == 1) << "input imu state invalid !!!"; q_G_I_ = Quaternion<Scalar>(state_vector.head(4).data()); q_G_I_.normalize(); bg_ = state_vector.block(kImuBgStateIndex, 0, 3, 1); v_G_I_ = state_vector.block(kImuVStateIndex, 0, 3, 1); ba_ = state_vector.block(kImuBaStateIndex, 0, 3, 1); p_G_I_ = state_vector.block(kImuPStateIndex, 0, 3, 1); } void PrintInfo() { LOG(INFO) << "Imu state: "; LOG(INFO) << "q_G_I: " << q_G_I_.coeffs().transpose(); LOG(INFO) << "bg: " << bg_.transpose(); LOG(INFO) << "v_G_I: " << v_G_I_.transpose(); LOG(INFO) << "ba: " << ba_.transpose(); LOG(INFO) << "p_G_I: " << p_G_I_.transpose(); } private: Quaternion<Scalar> q_G_I_; Matrix<Scalar, 3, 1> bg_; Matrix<Scalar, 3, 1> v_G_I_; Matrix<Scalar, 3, 1> ba_; Matrix<Scalar, 3, 1> p_G_I_; }; template <typename Scalar> class CalibrationState { public: CalibrationState(): q_I_C_(1, 0, 0, 0), p_I_C_(0, 0, 0) {} CalibrationState(const Quaternion<Scalar>& q_I_C, const Matrix<Scalar, 3, 1>& p_I_C) :q_I_C_(q_I_C), p_I_C_(p_I_C) {} Quaternion<Scalar> q_I_C() const { return q_I_C_;} Matrix<Scalar, 3, 1> p_I_C() const { return p_I_C_;} static int StateSize() { return kCalibrationStateSize;} static int ErrorStateSize() { return kCalibrationErrorStateSize;} void SetState(const Quaternion<Scalar>& q_I_C, const Matrix<Scalar, 3, 1>& p_I_C) { q_I_C_ = q_I_C; p_I_C_ = p_I_C; } void SetZeroState() { SetState(Quaternion<Scalar>(1, 0, 0, 0), Matrix<Scalar, 3, 1>::Zero()); } Matrix<Scalar, kCalibrationStateSize, 1> GetCalibrationStateVector() const { Matrix<Scalar, kCalibrationStateSize, 1> calib_state_vector; calib_state_vector << q_I_C_.coeffs(), p_I_C_; return calib_state_vector; } // quaternion [x ,y ,z ,w] void SetCalibrationStateFromVector( const Matrix<Scalar, kCalibrationStateSize, 1>& state_vector) { CHECK(state_vector.rows() == kCalibrationStateSize) << "input calibration state invalid !!!"; CHECK(state_vector.cols() == 1) << "input calibration state invalid !!!"; q_I_C_ = Quaternion<Scalar>(state_vector.head(4).data()); q_I_C_.normalize(); p_I_C_ = state_vector.block(kQuaterionStateSize, 0, 3, 1); } void PrintInfo () { LOG(INFO) << "Calibration state: "; LOG(INFO) << "q_G_I: " << q_I_C_.coeffs().transpose(); LOG(INFO) << "p_G_I: " << p_I_C_.transpose(); } private: Quaternion<Scalar> q_I_C_; Matrix<Scalar, 3, 1> p_I_C_; }; template <typename Scalar> class KeyFrameState { public: KeyFrameState(): keyframe_id_(0), q_G_I_(1, 0, 0, 0), p_G_I_(0, 0, 0) {} KeyFrameState(const Quaternion<Scalar>& q_G_I, const Matrix<Scalar, 3, 1>& p_G_I): q_G_I_(q_G_I), p_G_I_(p_G_I) {} KeyFrameState(const int keyframe_id, const Quaternion<Scalar>& q_G_I, const Matrix<Scalar, 3, 1>& p_G_I): keyframe_id_(keyframe_id), q_G_I_(q_G_I), p_G_I_(p_G_I) {} static int StateSize() { return kKeyframeStateSize;} static int ErrorStateSize() { return kKeyframeErrorStateSize;} void SetState(const Quaternion<Scalar>& q_G_I, const Matrix<Scalar, 3, 1>& p_G_I) { q_G_I_ = q_G_I; p_G_I_ = p_G_I; } void SetZeroState() { SetState(Quaternion<Scalar>(1, 0, 0, 0), Matrix<Scalar, 3, 1>::Zero()); } Matrix<Scalar, kKeyframeStateSize, 1> GetKeyframeStateVector() const { Matrix<Scalar, kKeyframeStateSize, 1> keyframe_state_vector; keyframe_state_vector << q_G_I_.coeffs(), p_G_I_; return keyframe_state_vector; } // quaternion [x ,y ,z ,w] void SetKeyframeStateFromVector( const Matrix<Scalar, kKeyframeStateSize, 1>& state_vector) { CHECK(state_vector.rows() == kKeyframeStateSize) << "input keyframe state invalid !!!"; CHECK(state_vector.cols() == 1) << "input keyframe state invalid !!!"; q_G_I_ = Quaternion<Scalar>(state_vector.head(4).data()); q_G_I_.normalize(); p_G_I_ = state_vector.block(0, 0, 3, 1); } void PrintInfo () { LOG(INFO) << "keyframe state: "; LOG(INFO) << "q_G_I: " << q_G_I_.coeffs().transpose(); LOG(INFO) << "p_G_I: " << p_G_I_.transpose(); } int keyframe_id() const { return keyframe_id_; } Quaternion<Scalar> q_G_I() const { return q_G_I_; } Matrix<Scalar, 3, 1> p_G_I() const { return p_G_I; } private: int keyframe_id_; Quaternion<Scalar> q_G_I_; Matrix<Scalar, 3, 1> p_G_I_; }; template <typename Scalar> class EkfState { public: EkfState() : last_update_time_(double(0)) { covariance_.resize(kImuErrorStateSize + kCalibrationErrorStateSize, kImuErrorStateSize + kCalibrationErrorStateSize); covariance_.setIdentity(kImuErrorStateSize + kCalibrationErrorStateSize, kImuErrorStateSize + kCalibrationErrorStateSize); } EkfState(int num_keyframe) : last_update_time_(double(0)) { for (int i = 0; i < num_keyframe; i++) { keyframe_states_.push_back(KeyFrameState<Scalar>()); } covariance_.resize( kImuErrorStateSize + kCalibrationErrorStateSize + num_keyframe * KeyFrameState<Scalar>::ErrorStateSize(), kImuErrorStateSize + kCalibrationErrorStateSize + num_keyframe * KeyFrameState<Scalar>::ErrorStateSize()); covariance_.setIdentity( kImuErrorStateSize + kCalibrationErrorStateSize + num_keyframe * KeyFrameState<Scalar>::ErrorStateSize(), kImuErrorStateSize + kCalibrationErrorStateSize + num_keyframe * KeyFrameState<Scalar>::ErrorStateSize()); } EkfState(const ImuState<Scalar>& imu_state, const CalibrationState<Scalar>& calibration_state, const deque<KeyFrameState<Scalar>>& keyframe_states) :last_update_time_(double(0)), imu_state_(imu_state), calibration_state_(calibration_state), keyframe_states_(keyframe_states) { size_t num_keyframe = keyframe_states_.size(); covariance_.resize( kImuErrorStateSize + kCalibrationErrorStateSize + num_keyframe * KeyFrameState<Scalar>::ErrorStateSize(), kImuErrorStateSize + kCalibrationErrorStateSize + num_keyframe * KeyFrameState<Scalar>::ErrorStateSize()); covariance_.setIdentity( kImuErrorStateSize + kCalibrationErrorStateSize + num_keyframe * KeyFrameState<Scalar>::ErrorStateSize(), kImuErrorStateSize + kCalibrationErrorStateSize + num_keyframe * KeyFrameState<Scalar>::ErrorStateSize()); } void PrintInfo() { imu_state_.PrintInfo(); calibration_state_.PrintInfo(); for (int i = 0; i < keyframe_states_.size(); i++) { LOG(INFO) << "keyframe "<< i; keyframe_states_[i].PrintInfo(); } } void ClearState(); int StateSize() const { return imu_state_.StateSize() + calibration_state_.StateSize() + keyframe_states_.size() * KeyFrameState<Scalar>::StateSize() + landmarks_.size() * 3; } int ErrorStateSize() const { return ImuState<Scalar>::ErrorStateSize() + CalibrationState<Scalar>::ErrorStateSize() + keyframe_states_.size() * KeyFrameState<Scalar>::ErrorStateSize() + landmarks_.size() * 3; } Matrix<Scalar, 16, 1> GetImuStateVector() const { return imu_state_.GetImuStateVector(); } void SetImuStateFromVector( const Matrix<Scalar, Eigen::Dynamic, 1>& state_vector) { CHECK(state_vector.rows() == kImuStateSize) << "input Imu state invalid !!!"; CHECK(state_vector.cols() == 1) << "input Imu state invalid !!!"; imu_state_.SetImuStateFromVector(state_vector); } Matrix<Scalar, kCalibrationStateSize, 1> GetCalibrationStateVector() const { return calibration_state_.GetCalibrationStateVector(); } void SetCalibrationStateFromVector( const Matrix<Scalar, Eigen::Dynamic, 1>& state_vector) { CHECK(state_vector.rows() == kCalibrationStateSize) << "input calibration state invalid !!!"; CHECK(state_vector.cols() == 1) << "input calibration state invalid !!!"; calibration_state_.SetCalibrationStateFromVector(state_vector); } Matrix<Scalar, Eigen::Dynamic, 1> GetStateVector() const { CHECK(landmarks_.size() == 0) << "has landmark !!!"; // for now , we have no landmark Matrix<Scalar, Eigen::Dynamic, 1> state_vector; state_vector.resize(StateSize(), 1); state_vector.block(kImuStateIndex, 0, kImuStateSize, 1) = GetImuStateVector(); state_vector.block(kCalibrationStateIndex, 0, kCalibrationStateSize, 1) = GetCalibrationStateVector(); for (int i = 0; i < keyframe_states_.size(); i++) { state_vector.block(kKeyframeStateIndex + i * kKeyframeStateSize, 0, kKeyframeStateSize, 1) = keyframe_states_[i].GetKeyframeStateVector(); } return state_vector; } void SetStateFromVector( const Matrix<Scalar, Eigen::Dynamic, 1>& state_vector) { CHECK(state_vector.rows() == StateSize()) << "SetStateFromVector size not match !!!"; CHECK(state_vector.cols() == 1) << "SetStateFromVector size not match !!!"; Matrix<Scalar, kImuStateSize, 1> imu_state_vector = state_vector.block(kImuStateIndex, 0, kImuStateSize, 1); imu_state_.SetImuStateFromVector(imu_state_vector); Matrix<Scalar, kCalibrationStateSize, 1> calib_state_vector = state_vector.block(kCalibrationStateIndex, 0, kCalibrationStateSize, 1); calibration_state_.SetCalibrationStateFromVector(calib_state_vector); // set keyframe state for (int i = 0; i < keyframe_states_.size(); i++) { Matrix<Scalar, kKeyframeStateSize, 1> keyframe_state_vector = state_vector.block(kKeyframeStateIndex + i * kKeyframeStateSize, 0, kKeyframeStateSize, 1); keyframe_states_[i].SetKeyframeStateFromVector(keyframe_state_vector); } } void SetCovariance() { // for now, just for debug Matrix<Scalar, 3, 3> cov_1 = Matrix<Scalar, 3, 3>::Identity(); Matrix<Scalar, 3, 3> cov_2 = 2 * Matrix<Scalar, 3, 3>::Identity(); Matrix<Scalar, 3, 3> cov_3 = 3 * Matrix<Scalar, 3, 3>::Identity(); Matrix<Scalar, 3, 3> cov_4 = 4 * Matrix<Scalar, 3, 3>::Identity(); Matrix<Scalar, 3, 3> cov_5 = 5 * Matrix<Scalar, 3, 3>::Identity(); Matrix<Scalar, 3, 3> cov_6 = 6 * Matrix<Scalar, 3, 3>::Identity(); Matrix<Scalar, 3, 3> cov_7 = 7 * Matrix<Scalar, 3, 3>::Identity(); Matrix<Scalar, 3, 3> cov_8 = 8 * Matrix<Scalar, 3, 3>::Identity(); Matrix<Scalar, 3, 3> cov_9 = 9 * Matrix<Scalar, 3, 3>::Identity(); LOG(INFO) << "cov size: "<< covariance_.cols(); covariance_ << cov_9, cov_2, cov_3, cov_4, cov_5, cov_6, cov_7, cov_2, cov_1, cov_8, cov_1, cov_1, cov_1, cov_1, cov_3, cov_8, cov_2, cov_1, cov_1, cov_1, cov_1, cov_4, cov_1, cov_1, cov_3, cov_1, cov_1, cov_1, cov_5, cov_1, cov_1, cov_1, cov_4, cov_1, cov_1, cov_6, cov_1, cov_1, cov_1, cov_1, cov_5, cov_1, cov_7, cov_1, cov_1, cov_1, cov_1, cov_1, cov_6; } Matrix<Scalar, kImuErrorStateSize, kImuErrorStateSize> GetImuStateCovariance() { return covariance_.block(0, 0, kImuErrorStateSize, kImuErrorStateSize); } void AugmentStateAndCovariance() { LOG(INFO) << "AugmentStateAndCovariance"; // TODO: add info to KF manager // matrix block operation /* * old cov: * | [Imu] a' b' | * | a [Calib] c' | * | [KF1 ] | * | b c [ KF2 ] | * | [ KF3] | * * new cov after add a new KF: * * | [Imu] a' b' I | * | a [Calib] c' a | * | [KF1 ] | * | b c [ KF2 ] b | * | [ KF3] | * | I a' b' [new_KF] | * */ // copy new KF cov Matrix<Scalar, 6, 6> new_KF_cov; new_KF_cov.block(0, 0, 3, 3) = covariance_.block(kImuQErrorStateIndex, kImuQErrorStateIndex, 3, 3); new_KF_cov.block(3, 3, 3, 3) = covariance_.block(kImuPErrorStateIndex, kImuPErrorStateIndex, 3, 3); new_KF_cov.block(3, 0, 3, 3) = covariance_.block(kImuPErrorStateIndex, kImuQErrorStateIndex, 3, 3); new_KF_cov.block(0, 3, 3, 3) = covariance_.block(kImuQErrorStateIndex, kImuPErrorStateIndex, 3, 3); // copy new_KF to calib and old_KFs cov Matrix<Scalar, Eigen::Dynamic, 6> new_KF_to_calib_old_KFs_cov; int KFs_size = keyframe_states_.size(); new_KF_to_calib_old_KFs_cov.resize(6 * KFs_size + kCalibrationErrorStateSize, 6); new_KF_to_calib_old_KFs_cov.block(0, 0, 6 * KFs_size + kCalibrationErrorStateSize, 3) = covariance_.block(kCalibQErrorStateIndex, kImuQErrorStateIndex, 6 * KFs_size + kCalibrationErrorStateSize, 3); new_KF_to_calib_old_KFs_cov.block(0, 3, 6 * KFs_size + kCalibrationErrorStateSize, 3) = covariance_.block(kCalibQErrorStateIndex, kImuPErrorStateIndex, 6 * KFs_size + kCalibrationErrorStateSize, 3); // copy imu to new KF cov Matrix<Scalar, kImuErrorStateSize, 6> new_KF_to_imu_cov; new_KF_to_imu_cov.setZero(kImuErrorStateSize, 6); new_KF_to_imu_cov.block(kImuQErrorStateIndex, 0, kImuErrorStateSize, 3) = covariance_.block(kImuQErrorStateIndex, kImuQErrorStateIndex, kImuErrorStateSize, 3); new_KF_to_imu_cov.block(kImuQErrorStateIndex, 3, kImuErrorStateSize, 3) = covariance_.block(kImuQErrorStateIndex, kImuPErrorStateIndex, kImuErrorStateSize, 3); // add new cov_block to new augmented cov int new_KF_insert_index = covariance_.cols(); covariance_.conservativeResize(new_KF_insert_index + 6, new_KF_insert_index + 6); covariance_.block(new_KF_insert_index, new_KF_insert_index, 6, 6) = new_KF_cov; covariance_.block(kCalibQErrorStateIndex, new_KF_insert_index, 6 * KFs_size + kCalibrationErrorStateSize, 6) = new_KF_to_calib_old_KFs_cov; covariance_.block(new_KF_insert_index, kCalibQErrorStateIndex, 6, 6 * KFs_size + kCalibrationErrorStateSize) = new_KF_to_calib_old_KFs_cov.transpose(); covariance_.block(0, new_KF_insert_index, kImuErrorStateSize, 6) = new_KF_to_imu_cov; covariance_.block(new_KF_insert_index, 0, 6, kImuErrorStateSize) = new_KF_to_imu_cov.transpose(); // after augment cov, add new KF to KF state KeyFrameState<Scalar> new_key_frame(imu_state_.q_G_I(), imu_state_.p_G_I()); keyframe_states_.push_back(new_key_frame); } bool MarginalizeOldestKeyframe() { // todo : return true; } bool MarginalizeKeyframeByIndex(int kf_index) { // todo: return true; } bool MarginalizeLandmarkByIndex(int landmark_index) { // todo return true; } ImuState<Scalar> imu_state() const { return imu_state_; } CalibrationState<Scalar> calibration_state() const { return calibration_state_; } deque<KeyFrameState<Scalar>> keyframe_states() const { return keyframe_states_; } vector<Matrix<Scalar, 3, 1>> landmarks() const { return landmarks_; } Matrix<Scalar, Eigen::Dynamic, Eigen::Dynamic> covariance() const { return covariance_; } // get the order of this keyframe in slide window int GetKeyframeIndexById(int keyframe_id) const { for (size_t i = 0; i < keyframe_states_.size(); i++) { LOG(INFO) << "debug " <<keyframe_states_[i].keyframe_id(); if (keyframe_id == keyframe_states_[i].keyframe_id()) { return i; } return -1; } } // get the keyframe state by id KeyFrameState<Scalar> GetKeyframeStateById(int keyframe_id) const { for (size_t i = 0; i < keyframe_states_.size(); i++) { if (keyframe_id == keyframe_states_[i].keyframe_id()) { return keyframe_states_[i]; } } } private: ImuState<Scalar> imu_state_; CalibrationState<Scalar> calibration_state_; deque<KeyFrameState<Scalar>> keyframe_states_; vector<Matrix<Scalar, 3, 1>> landmarks_; Matrix<Scalar, Eigen::Dynamic, Eigen::Dynamic> covariance_; double last_update_time_; double time_stamp_; }; typedef EkfState<double> EkfStated; } // namespace ultimate_msckf_vio #endif // EKF_STATE_H_
35.22629
103
0.658731
d40638087ddfeb597f75b952eb57447b1b204669
1,011
h
C
src/application/components/cameraPreview/CameraPreviewComponentImage.h
ferdikoomen/Capture3
e4fe57d0c14e4deecddf9f1a9d19824076a49a03
[ "MIT" ]
18
2018-04-07T18:52:27.000Z
2022-03-22T09:23:32.000Z
src/application/components/cameraPreview/CameraPreviewComponentImage.h
ferdikoomen/Capture3
e4fe57d0c14e4deecddf9f1a9d19824076a49a03
[ "MIT" ]
1
2020-10-13T07:51:45.000Z
2020-10-13T07:51:45.000Z
src/application/components/cameraPreview/CameraPreviewComponentImage.h
ferdikoomen/Capture3
e4fe57d0c14e4deecddf9f1a9d19824076a49a03
[ "MIT" ]
3
2019-03-12T06:10:14.000Z
2021-05-20T12:54:52.000Z
#ifndef CAPTURE3_CAMERA_PREVIEW_COMPONENT_PREVIEW_H #define CAPTURE3_CAMERA_PREVIEW_COMPONENT_PREVIEW_H #include <QtWidgets/QWidget> #include <QtGui/QPainter> #include <QtGui/QImage> #include <QtGui/QPixmap> #include <QtGui/QColor> #include <QtGui/QMouseEvent> #include "../graphic/GraphicComponent.h" #include "../../../constants/CameraConstants.h" #include "../../../engine/objects/camera/Camera.h" namespace Capture3 { class CameraPreviewComponentImage final : public GraphicComponent { Q_OBJECT public: CameraPreviewComponentImage(Camera &camera); virtual ~CameraPreviewComponentImage(); protected: virtual void mousePressEvent(QMouseEvent *event); virtual void draw(QPainter &painter); private: Camera &camera; const QColor colorBackground; const QColor colorForeground; const QColor colorLines; QPen focusLine; double focusX; double focusY; }; } #endif // CAPTURE3_CAMERA_PREVIEW_COMPONENT_PREVIEW_H
21.0625
67
0.727992
ac7cf25f9d46cf1afd3a217419a9db3e657b34e4
4,716
h
C
zircon/kernel/include/kernel/event.h
opensource-assist/fuschia
66646c55b3d0b36aae90a4b6706b87f1a6261935
[ "BSD-3-Clause" ]
null
null
null
zircon/kernel/include/kernel/event.h
opensource-assist/fuschia
66646c55b3d0b36aae90a4b6706b87f1a6261935
[ "BSD-3-Clause" ]
null
null
null
zircon/kernel/include/kernel/event.h
opensource-assist/fuschia
66646c55b3d0b36aae90a4b6706b87f1a6261935
[ "BSD-3-Clause" ]
null
null
null
// Copyright 2016 The Fuchsia Authors // Copyright (c) 2008-2014 Travis Geiselbrecht // // Use of this source code is governed by a MIT-style // license that can be found in the LICENSE file or at // https://opensource.org/licenses/MIT #ifndef ZIRCON_KERNEL_INCLUDE_KERNEL_EVENT_H_ #define ZIRCON_KERNEL_INCLUDE_KERNEL_EVENT_H_ #include <err.h> #include <stdbool.h> #include <stdint.h> #include <sys/types.h> #include <zircon/compiler.h> #include <zircon/types.h> #include <kernel/thread.h> #include <kernel/timer.h> #define EVENT_MAGIC (0x65766E74) // "evnt" typedef struct event { int magic; zx_status_t result; // INT_MAX means not signaled uint flags; wait_queue_t wait; } event_t; #define EVENT_FLAG_AUTOUNSIGNAL 1 #define EVENT_INITIAL_VALUE(e, initial, _flags) \ { \ .magic = EVENT_MAGIC, .result = (initial) ? ZX_OK : INT_MAX, .flags = (_flags), \ .wait = WAIT_QUEUE_INITIAL_VALUE((e).wait), \ } // Rules for Events: // - Events may be signaled from interrupt context *but* the reschedule // parameter must be false in that case. // - Events may not be waited upon from interrupt context. // - Events without FLAG_AUTOUNSIGNAL: // - Wake up any waiting threads when signaled. // - Continue to do so (no threads will wait) until unsignaled. // - Stores a single result value when first signaled. This result is // returned to waiters and cleared when unsignaled. // - Events with FLAG_AUTOUNSIGNAL: // - If one or more threads are waiting when signaled, one thread will // be woken up and return. The signaled state will not be set. // - If no threads are waiting when signaled, the Event will remain // in the signaled state until a thread attempts to wait (at which // time it will unsignal atomicly and return immediately) or // event_unsignal() is called. // - Stores a single result value when signaled until a thread is woken. static inline void event_init(event_t* e, bool initial, uint flags) { *e = (event_t)EVENT_INITIAL_VALUE(*e, initial, flags); } void event_destroy(event_t*); // Wait until deadline // Interruptable arg allows it to return early with ZX_ERR_INTERNAL_INTR_KILLED if thread // is signaled for kill or with ZX_ERR_INTERNAL_INTR_RETRY if the thread is suspended. zx_status_t event_wait_deadline(event_t*, zx_time_t, bool interruptable); // Wait until the event occurs, the deadline has elapsed, or the thread is interrupted. zx_status_t event_wait_interruptable(event_t* e, const Deadline& deadline); // no deadline, non interruptable version of the above. static inline zx_status_t event_wait(event_t* e) { return event_wait_deadline(e, ZX_TIME_INFINITE, false); } // Version of event_wait_deadline that ignores existing signals in // |signal_mask|. There is no deadline, and the caller must be interruptable. zx_status_t event_wait_with_mask(event_t*, uint signal_mask); int event_signal_etc(event_t*, bool reschedule, zx_status_t result); int event_signal(event_t*, bool reschedule); int event_signal_thread_locked(event_t*) TA_REQ(thread_lock); zx_status_t event_unsignal(event_t*); static inline bool event_initialized(const event_t* e) { return e->magic == EVENT_MAGIC; } static inline bool event_signaled(const event_t* e) { return e->result != INT_MAX; } // C++ wrapper. This should be waited on from only a single thread, but may be // signaled from many threads (Signal() is thread-safe). class Event { public: constexpr explicit Event(uint32_t opts = 0) : event_(EVENT_INITIAL_VALUE(event_, false, opts)) {} ~Event() { event_destroy(&event_); } Event(const Event&) = delete; Event& operator=(const Event&) = delete; // Returns: // ZX_OK - signaled // ZX_ERR_TIMED_OUT - time out expired // ZX_ERR_INTERNAL_INTR_KILLED - thread killed // ZX_ERR_INTERNAL_INTR_RETRY - thread is suspended // Or the |status| which the caller specified in Event::Signal(status) zx_status_t Wait(const Deadline& deadline) { return event_wait_interruptable(&event_, deadline); } // Same as Wait() but waits forever and gives a mask of signals to ignore. zx_status_t WaitWithMask(uint signal_mask) { return event_wait_with_mask(&event_, signal_mask); } void Signal(zx_status_t status = ZX_OK) { event_signal_etc(&event_, true, status); } void SignalThreadLocked() TA_REQ(thread_lock) { event_signal_thread_locked(&event_); } void SignalNoResched() { event_signal(&event_, false); } zx_status_t Unsignal() { return event_unsignal(&event_); } private: event_t event_; }; #endif // ZIRCON_KERNEL_INCLUDE_KERNEL_EVENT_H_
38.975207
100
0.724343
fecf278063f73b6d16348f4358a5434e13a41db7
159
c
C
2.IntroducingC/Exercises/3.c
HuangStomach/C-primer-plus
ecb24ab1ba3ec58e68cff2fce5049b328e84c24b
[ "MIT" ]
null
null
null
2.IntroducingC/Exercises/3.c
HuangStomach/C-primer-plus
ecb24ab1ba3ec58e68cff2fce5049b328e84c24b
[ "MIT" ]
null
null
null
2.IntroducingC/Exercises/3.c
HuangStomach/C-primer-plus
ecb24ab1ba3ec58e68cff2fce5049b328e84c24b
[ "MIT" ]
null
null
null
#include <stdio.h> int main(void) { int age; int days; age = 27; days = age * 365; printf("My age's days is %d\n", days); return 0; }
14.454545
42
0.522013
fee8bc7a9f407caec1236a6f19fb5fa3963cfc5a
1,084
h
C
include/drivers/keyboard.h
DogOSdev/DogOScpp
ba99cd8ffbd627926cb5f4d0a5b9c5d404d2496c
[ "MIT" ]
null
null
null
include/drivers/keyboard.h
DogOSdev/DogOScpp
ba99cd8ffbd627926cb5f4d0a5b9c5d404d2496c
[ "MIT" ]
null
null
null
include/drivers/keyboard.h
DogOSdev/DogOScpp
ba99cd8ffbd627926cb5f4d0a5b9c5d404d2496c
[ "MIT" ]
null
null
null
#ifndef __DOGOS__DRIVERS__KEYBOARD_H #define __DOGOS__DRIVERS__KEYBOARD_H #include <common/types.h> #include <hardware/interrupts.h> #include <drivers/driver.h> #include <hardware/port.h> namespace dogos { namespace drivers { class KeyboardEventHandler { public: KeyboardEventHandler(); virtual void OnKeyDown(char); virtual void OnKeyUp(char); virtual void OnEnter(); virtual void ReadLine(); virtual void KeyPressed(); }; class KeyboardDriver : public dogos::hardware::InterruptHandler, public Driver { dogos::hardware::Port8Bit dataport; dogos::hardware::Port8Bit commandport; KeyboardEventHandler *handler; public: KeyboardDriver(dogos::hardware::InterruptManager *manager, KeyboardEventHandler *handler); ~KeyboardDriver(); virtual dogos::common::uint32_t HandleInterrupt(dogos::common::uint32_t esp); virtual void Activate(); }; } } #endif
26.439024
102
0.624539
3a4b73d735ffc6d634806029f3f2423e04ed4936
130
h
C
Software/CPU/myscrypt/build/cmake-3.12.3/Tests/ExportImport/Export/sublib/subdir.h
duonglvtnaist/Multi-ROMix-Scrypt-Accelerator
9cb9d96c72c3e912fb7cfd5a786e50e4844a1ee8
[ "MIT" ]
107
2021-08-28T20:08:42.000Z
2022-03-22T08:02:16.000Z
Software/CPU/myscrypt/build/cmake-3.12.3/Tests/ExportImport/Export/sublib/subdir.h
duonglvtnaist/Multi-ROMix-Scrypt-Accelerator
9cb9d96c72c3e912fb7cfd5a786e50e4844a1ee8
[ "MIT" ]
3
2021-09-08T02:18:00.000Z
2022-03-12T00:39:44.000Z
Software/CPU/myscrypt/build/cmake-3.12.3/Tests/ExportImport/Export/sublib/subdir.h
duonglvtnaist/Multi-ROMix-Scrypt-Accelerator
9cb9d96c72c3e912fb7cfd5a786e50e4844a1ee8
[ "MIT" ]
16
2021-08-30T06:57:36.000Z
2022-03-22T08:05:52.000Z
#ifndef SUBDIR_H #define SUBDIR_H #include "subdirlib_export.h" struct SUBDIRLIB_EXPORT SubDirObject { int foo(); }; #endif
10
36
0.746154
b16aace4ffd7514e442049c748a50d87f12186b3
1,109
h
C
ShellPkg/Library/UefiShellDebug1CommandsLib/HexEdit/HexEditor.h
sscargal/ipmctl
48e4cdc8682e9efafc838bda66d4af282c29dc11
[ "BSD-3-Clause" ]
151
2018-06-01T20:14:34.000Z
2022-03-13T08:34:07.000Z
ShellPkg/Library/UefiShellDebug1CommandsLib/HexEdit/HexEditor.h
sscargal/ipmctl
48e4cdc8682e9efafc838bda66d4af282c29dc11
[ "BSD-3-Clause" ]
179
2018-06-21T18:07:54.000Z
2022-03-30T16:06:39.000Z
ShellPkg/Library/UefiShellDebug1CommandsLib/HexEdit/HexEditor.h
sscargal/ipmctl
48e4cdc8682e9efafc838bda66d4af282c29dc11
[ "BSD-3-Clause" ]
58
2018-06-07T21:59:15.000Z
2022-03-16T23:26:38.000Z
/** @file Main include file for hex editor Copyright (c) 2005 - 2011, Intel Corporation. All rights reserved. <BR> This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License which accompanies this distribution. The full text of the license may be found at http://opensource.org/licenses/bsd-license.php THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. **/ #ifndef _EFI_SHELL_HEXEDIT_H_ #define _EFI_SHELL_HEXEDIT_H_ #include "UefiShellDebug1CommandsLib.h" #include "HexEditorTypes.h" #include "MainHexEditor.h" #include "BufferImage.h" #include "FileImage.h" #include "DiskImage.h" #include "MemImage.h" #include "EditTitleBar.h" #include "EditStatusBar.h" #include "EditInputBar.h" #include "EditMenuBar.h" #include "Misc.h" #include "Clipboard.h" extern HEFI_EDITOR_GLOBAL_EDITOR HMainEditor; extern BOOLEAN HEditorFirst; extern BOOLEAN HEditorExit; #endif // _HEDITOR_H
26.404762
84
0.74752
b1d98c92d0e0909f9e052577c34d7fa66b9db8da
2,789
c
C
error.c
sashajenner/f5p
a206079a5f7747d21e93f39807e1a7a4a9c91103
[ "MIT" ]
6
2019-09-08T10:36:52.000Z
2022-01-10T18:02:11.000Z
error.c
sashajenner/f5p
a206079a5f7747d21e93f39807e1a7a4a9c91103
[ "MIT" ]
null
null
null
error.c
sashajenner/f5p
a206079a5f7747d21e93f39807e1a7a4a9c91103
[ "MIT" ]
4
2019-08-19T17:04:22.000Z
2019-12-13T06:03:12.000Z
/* @error.c ** ** A simple wrapper for error checking and logging ** @author: Hasindu Gamaarachchi (hasindu@unsw.edu.au) ** @@ ******************************************************************************/ /* MIT License Copyright (c) 2019 Hasindu Gamaarachchi Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #include <errno.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #include "error.h" void malloc_chk(void* ret, const char* func, const char* file, int line) { if (ret != NULL) return; fprintf( stderr, "[%s::ERROR]\033[1;31m Failed to allocate memory : " "%s.\033[0m\n[%s::DEBUG]\033[1;35m Error occured at %s:%d.\033[0m\n\n", func, strerror(errno), func, file, line); exit(EXIT_FAILURE); } void f_chk(void* ret, const char* func, const char* file, int line, const char* fopen_f) { if (ret != NULL) return; fprintf( stderr, "[%s::ERROR]\033[1;31m Failed to open %s : " "%s.\033[0m\n[%s::DEBUG]\033[1;35m Error occured at %s:%d.\033[0m\n\n", func, fopen_f, strerror(errno), func, file, line); exit(EXIT_FAILURE); } void null_chk(void* ret, const char* func, const char* file, int line) { if (ret != NULL) return; fprintf(stderr, "[%s::ERROR]\033[1;31m %s.\033[0m\n[%s::DEBUG]\033[1;35m Error " "occured at %s:%d.\033[0m\n\n", func, strerror(errno), func, file, line); exit(EXIT_FAILURE); } void neg_chk(int ret, const char* func, const char* file, int line) { if (ret >= 0) return; fprintf(stderr, "[%s::ERROR]\033[1;31m %s.\033[0m\n[%s::DEBUG]\033[1;35m Error " "occured at %s:%d.\033[0m\n\n", func, strerror(errno), func, file, line); exit(EXIT_FAILURE); }
36.697368
79
0.645034
38c512d4c4decc3d5a513263f429076f64c14849
3,629
h
C
OutPutHeaders/VoipUIManager.h
cocos543/WeChatTimeLineRobot
1e93480e502e36ca9a21a506f481aa1fcb70ac4b
[ "MIT" ]
106
2016-04-09T01:16:14.000Z
2021-06-04T00:20:24.000Z
OutPutHeaders/VoipUIManager.h
cocos543/WeChatTimeLineRobot
1e93480e502e36ca9a21a506f481aa1fcb70ac4b
[ "MIT" ]
2
2017-06-13T09:41:29.000Z
2018-03-26T03:32:07.000Z
OutPutHeaders/VoipUIManager.h
cocos543/WeChatTimeLineRobot
1e93480e502e36ca9a21a506f481aa1fcb70ac4b
[ "MIT" ]
58
2016-04-28T09:52:08.000Z
2021-12-25T06:42:14.000Z
/** * This header is generated by class-dump-z 0.2a. * class-dump-z is Copyright (C) 2009 by KennyTM~, licensed under GPLv3. * * Source: (null) */ #import "WeChat-Structs.h" #import "MMService.h" #import "VideoVoipViewDelegate.h" #import "VoipMinimizeWindowDelegate.h" #import "MMKernelExt.h" #import "VoipAlertViewDelegate.h" #import "MMService.h" #import "IVOIPExt.h" #import "MMConfigMgrExt.h" #import "MultiTalkMainWindowDelegate.h" @class MMVoipToastWindow, MultiTalkMainWindow, VoipAlertView, NSString, CContact, VideoVoipCallerView, VideoVoipReceiverView, VoipMinimizeWindow; @interface VoipUIManager : MMService <MMKernelExt, MultiTalkMainWindowDelegate, VideoVoipViewDelegate, VoipMinimizeWindowDelegate, MMService, IVOIPExt, VoipAlertViewDelegate, MMConfigMgrExt> { CContact* m_tempContact; VoipAlertView* m_voipAlertView; VideoVoipCallerView* m_videoVoipCallerViewController; VideoVoipReceiverView* m_videoVoipReceiverViewController; VoipMinimizeWindow* m_voipMinimizeWindow; MMVoipToastWindow* m_voipToastWindow; MultiTalkMainWindow* m_mainWindow; } @property(readonly, copy) NSString* debugDescription; @property(readonly, copy) NSString* description; @property(readonly, assign) Class superclass; @property(readonly, assign) unsigned hash; @property(retain, nonatomic) MultiTalkMainWindow* m_mainWindow; @property(retain, nonatomic) VideoVoipReceiverView* m_videoVoipReceiverViewController; @property(retain, nonatomic) VideoVoipCallerView* m_videoVoipCallerViewController; @property(retain, nonatomic) MMVoipToastWindow* m_voipToastWindow; @property(retain, nonatomic) VoipMinimizeWindow* m_voipMinimizeWindow; @property(retain, nonatomic) CContact* m_tempContact; @property(retain, nonatomic) VoipAlertView* m_voipAlertView; +(BOOL)canForceStartVoiceWithContact:(id)contact; +(BOOL)canStartVoiceWithContact:(id)contact; +(BOOL)canStartVideoWithContact:(id)contact; -(void).cxx_destruct; -(void)onPreQuit; -(void)onMMDynamicConfigUpdated; -(void)OnTellMeViewIsExist:(BOOL*)exist; -(void)SendInvite:(int)invite; -(void)Cancel; -(CGRect)onMultiTalkMainWindowRequestMinimizeFrame; -(void)onMultiTalkMainWindowExtendFromCollapseAnimationDidEnd; -(void)onMultiTalkMainWindowExtendFromCollapseAnimationWillStart; -(void)onMultiTalkMainWindowCollapseAnimationWillStart; -(void)onMultiTalkMainWindowCollapseAnimationDidEnd; -(void)onMultiTalkMainWindowQuitAnimationDidEnd; -(void)onMultiTalkMainWindowQuitAnimationWillStart; -(void)onMultiTalkMainWindowExtendAnimationDidEnd; -(BOOL)onVideoVoipViewRequestMinimizeStatus; -(void)onVideoVoipViewChangeToMinimizeMode; -(void)onVideoVoipViewClose; -(void)onVoipMinimizeWindowClicked; -(void)switchToSpeakPhoneMode:(BOOL)speakPhoneMode; -(void)clearCurrentString; -(BOOL)isUsingEarDevice; -(void)changeToMinimizeToast; -(void)changeToAudioToast; -(void)changeToVideoToast; -(void)addScrollingString:(id)string withDisplayTime:(float)displayTime; -(BOOL)isMinimizeMode; -(void)showCannotStartVoipTwice; -(id)getConflictWording; -(void)showConflictWording; -(void)recoverVoipAudioMode; -(BOOL)isVoipSpeakerMode; -(BOOL)isVideoVoipWorking; -(BOOL)isVoipWorking; -(BOOL)isViewEnding; -(BOOL)showVideoEntranceInMainFrame; -(BOOL)closeViewWith:(id)with; -(void)openVoipViewWithContact:(id)contact isCaller:(BOOL)caller andMsgWrap:(id)wrap; -(void)hangupForNotSupportVoiceVoip; -(BOOL)isTheSameContactWithCurrentVoip:(id)currentVoip; -(void)openVideoVoipViewWithContact:(id)contact isCaller:(BOOL)caller andMsgWrap:(id)wrap isEarMode:(BOOL)mode; -(BOOL)canStartVoip; -(BOOL)canOpenVoipByTimeLogic:(id)logic; -(void)onServiceReloadData; -(void)dealloc; -(id)init; @end
39.879121
192
0.83191
75aff575a0f70a9dff983069ec9123e10144970d
3,061
h
C
ZRXSDK/2014/inc/zAcDbLMgr.h
kevinzhwl/ZRXSDKMod
2d2de60ab45db535439e6608fb4764835fd72ff7
[ "MIT" ]
null
null
null
ZRXSDK/2014/inc/zAcDbLMgr.h
kevinzhwl/ZRXSDKMod
2d2de60ab45db535439e6608fb4764835fd72ff7
[ "MIT" ]
null
null
null
ZRXSDK/2014/inc/zAcDbLMgr.h
kevinzhwl/ZRXSDKMod
2d2de60ab45db535439e6608fb4764835fd72ff7
[ "MIT" ]
2
2015-12-04T08:39:49.000Z
2020-09-11T02:54:27.000Z
#ifndef _ZCDBLMGR_H #define _ZCDBLMGR_H #include "zadesk.h" #include "zdbid.h" #include "zdblayout.h" #include "zdblaymgrrctr.h" #pragma pack (push, 8) #define MAX_PSPACE_LAYOUTS 256 class ZcDbObjectId; class ZcDbLayoutManager: public ZcRxObject { public: virtual Zcad::ErrorStatus setCurrentLayout (const ZTCHAR * newname) = 0; virtual Zcad::ErrorStatus setCurrentLayoutId (ZcDbObjectId layoutId) = 0; virtual const ZTCHAR * findActiveLayout (bool allowModel) = 0; virtual ZcDbObjectId getActiveLayoutBTRId () = 0; virtual ZcDbLayout * findLayoutNamed (const ZTCHAR * name, bool leaveRecordOpen = false) = 0; virtual Zcad::ErrorStatus copyLayout (const ZTCHAR * copyname, const ZTCHAR * newname) = 0; virtual Zcad::ErrorStatus deleteLayout (const ZTCHAR * delname) = 0; virtual Zcad::ErrorStatus createLayout (const ZTCHAR *newname, ZcDbObjectId& layoutId, ZcDbObjectId& blockTableRecId, ZcDbDatabase* pDatabase = NULL) = 0; virtual Zcad::ErrorStatus renameLayout (const ZTCHAR * oldname, const ZTCHAR * newname) = 0; virtual Zcad::ErrorStatus cloneLayout (ZcDbLayout* pLBTR, const ZTCHAR * newname, int newTabOrder = 0) = 0; virtual ZcDbObjectId getNonRectVPIdFromClipId (ZcDbObjectId clipId) = 0; virtual bool isVpnumClipped (int index) = 0; virtual int countLayouts (ZcDbDatabase *useDb = NULL) = 0; virtual void addReactor (ZcDbLayoutManagerReactor * newObj) = 0; virtual void removeReactor (ZcDbLayoutManagerReactor * delObj) = 0; }; #ifndef _WIN64 Zcad::ErrorStatus zcdbDoSetupForLayouts(ZcDbDatabase* pDatabase, unsigned int& contextHandle); Zcad::ErrorStatus zcdbClearSetupForLayouts(unsigned int contextHandle); #else Zcad::ErrorStatus zcdbDoSetupForLayouts(ZcDbDatabase* pDatabase, ZSoft::ULongPtr& contextHandle); Zcad::ErrorStatus zcdbClearSetupForLayouts(ZSoft::ULongPtr contextHandle); #endif Zcad::ErrorStatus zcdbDeleteLayout (const ZTCHAR* delname, ZcDbDatabase* pDb = NULL); Zcad::ErrorStatus zcdbRenameLayout (const ZTCHAR* oldname, const ZTCHAR* newname, ZcDbDatabase* pDb = NULL); Zcad::ErrorStatus zcdbCopyLayout (const ZTCHAR* copyname, const ZTCHAR* newname, ZcDbDatabase* pDb = NULL); #pragma pack (pop) #endif
32.913978
86
0.555047
5564bde3b9ea4c9885c6199a817d4dca4a66f422
1,190
h
C
ble_ident_service.h
sanke/esp32_osdp_reader
613495043a7b2ce518eb2d4eb639e93596b6c162
[ "MIT" ]
3
2021-09-09T04:50:07.000Z
2022-03-21T11:29:23.000Z
ble_ident_service.h
Radee1970/esp32_osdp_reader
ddf9ba4fa2f79767ad3819ee36747bf4c5607bc5
[ "MIT" ]
1
2021-09-09T06:03:29.000Z
2021-10-14T08:16:54.000Z
ble_ident_service.h
sanke/esp32_osdp_reader
613495043a7b2ce518eb2d4eb639e93596b6c162
[ "MIT" ]
3
2021-10-03T05:53:45.000Z
2022-03-15T09:31:57.000Z
// // Created by unoco on 4/8/2021. // #ifndef OSDP_LIB_BLE_IDENT_SERVICE_H #define OSDP_LIB_BLE_IDENT_SERVICE_H #define SERVICE_UID "3ce420b5-d68d-46dd-82f2-b5d21ea24487" #define CHARACTERISTIC_UID "fef63b43-99d4-43c9-8667-28b082353331" #define CHARACTERISTIC_DATA_LEN 20 #include <Stream.h> #include <vector> #include "ble_common.h" #include <BLEServer.h> class ble_ident_service : public BLEServerCallbacks, public BLECharacteristicCallbacks { public: ble_ident_service(Stream &debug); void subscribe(IIdentificationObserver* observer); void start(); void onConnect(BLEServer *pServer, esp_ble_gatts_cb_param_t *param) override; void onDisconnect(BLEServer *pServer) override; void onNotify(BLECharacteristic *pCharacteristic) override; void onWrite(BLECharacteristic *pCharacteristic) override; void onRead(BLECharacteristic *pCharacteristic) override; void onStatus(BLECharacteristic *pCharacteristic, Status s, uint32_t code) override; private: Stream &_debug; std::vector<IIdentificationObserver*> _observers; bool has_connected; int conn_id; unsigned int last_write; }; #endif //OSDP_LIB_BLE_IDENT_SERVICE_H
29.02439
88
0.777311
1d607f612b1d51012053fd4c0dd9af231a91d5ad
5,019
c
C
n-body.c
stevezhee/fort
5ac074c4266cf1cf8b47740e7ebe4bf9e5f58775
[ "BSD-3-Clause" ]
3
2019-02-15T00:27:41.000Z
2021-01-08T23:27:57.000Z
n-body.c
stevezhee/fort
5ac074c4266cf1cf8b47740e7ebe4bf9e5f58775
[ "BSD-3-Clause" ]
null
null
null
n-body.c
stevezhee/fort
5ac074c4266cf1cf8b47740e7ebe4bf9e5f58775
[ "BSD-3-Clause" ]
3
2018-07-10T22:10:38.000Z
2019-11-09T23:58:18.000Z
/* n-body gcc #6 (modified) */ /* The Computer Language Benchmarks Game * https://salsa.debian.org/benchmarksgame-team/benchmarksgame/ * * contributed by Christoph Bauer * modified by Danny Angelo Carminati Grein * */ #include <math.h> #include <stdio.h> #include <stdlib.h> #define pi 3.141592653589793 #define solar_mass (4 * pi * pi) #define days_per_year 365.24 #define NBODIES 5 struct planet { double x, y, z; double vx, vy, vz; double mass; }; struct planet bodies[NBODIES] = { { /* sun */ 0, 0, 0, 0, 0, 0, solar_mass }, { /* jupiter */ 4.84143144246472090e+00, -1.16032004402742839e+00, -1.03622044471123109e-01, 1.66007664274403694e-03 * days_per_year, 7.69901118419740425e-03 * days_per_year, -6.90460016972063023e-05 * days_per_year, 9.54791938424326609e-04 * solar_mass }, { /* saturn */ 8.34336671824457987e+00, 4.12479856412430479e+00, -4.03523417114321381e-01, -2.76742510726862411e-03 * days_per_year, 4.99852801234917238e-03 * days_per_year, 2.30417297573763929e-05 * days_per_year, 2.85885980666130812e-04 * solar_mass }, { /* uranus */ 1.28943695621391310e+01, -1.51111514016986312e+01, -2.23307578892655734e-01, 2.96460137564761618e-03 * days_per_year, 2.37847173959480950e-03 * days_per_year, -2.96589568540237556e-05 * days_per_year, 4.36624404335156298e-05 * solar_mass }, { /* neptune */ 1.53796971148509165e+01, -2.59193146099879641e+01, 1.79258772950371181e-01, 2.68067772490389322e-03 * days_per_year, 1.62824170038242295e-03 * days_per_year, -9.51592254519715870e-05 * days_per_year, 5.15138902046611451e-05 * solar_mass } }; void advance(struct planet * bodies, double dt) { int i, j; for (i = 0; i < NBODIES; i++) { struct planet * b = &(bodies[i]); for (j = i + 1; j < NBODIES; j++) { struct planet * b2 = &(bodies[j]); double dx = b->x - b2->x; double dy = b->y - b2->y; double dz = b->z - b2->z; double distanced = dx * dx + dy * dy + dz * dz; double distance = sqrt(distanced); // printf("%.15f\n", distance); double mag = dt / (distanced * distance); double mmag = b->mass * mag; double mmag2 = b2->mass * mag; b->vx -= dx * mmag2; b->vy -= dy * mmag2; b->vz -= dz * mmag2; b2->vx += dx * mmag; b2->vy += dy * mmag; b2->vz += dz * mmag; } } for (i = 0; i < NBODIES; i++) { struct planet * b = &(bodies[i]); b->x += dt * b->vx; b->y += dt * b->vy; b->z += dt * b->vz; } } double energy(struct planet * bodies) { double e; int i, j; e = 0.0; for (i = 0; i < NBODIES; i++) { struct planet * b = &(bodies[i]); e += 0.5 * (b->mass * ((b->vx * b->vx) + (b->vy * b->vy) + (b->vz * b->vz))); for (j = i + 1; j < NBODIES; j++) { struct planet * b2 = &(bodies[j]); double dx = b->x - b2->x; double dy = b->y - b2->y; double dz = b->z - b2->z; double distance = sqrt(dx * dx + dy * dy + dz * dz); e -= (b->mass * b2->mass) / distance; } } return e; } void offset_momentum(struct planet * bodies) { double px = 0.0, py = 0.0, pz = 0.0; int i; for (i = 0; i < NBODIES; i++) { px += bodies[i].vx * bodies[i].mass; py += bodies[i].vy * bodies[i].mass; pz += bodies[i].vz * bodies[i].mass; } bodies[0].vx = 0.0 - px / solar_mass; bodies[0].vy = 0.0 - py / solar_mass; bodies[0].vz = 0.0 - pz / solar_mass; } void advance_n(struct planet bodies[], double dt, int n) { for (int i = 0; i < n; i++) advance(bodies, dt); } int main(int argc, char ** argv) { int n = argc > 1 ? atoi(argv[1]) : 1000; // BAL: remove /* ./n-body.exe */ /* -0.169289903 */ /* -0.169075164 */ /* -0.169087605 */ /* for(int i = 0; i < NBODIES; ++i) */ /* { */ /* printf("%.15f\n", bodies[i].x); */ /* printf("%.15f\n", bodies[i].y); */ /* printf("%.15f\n", bodies[i].z); */ /* printf("%.15f\n", bodies[i].vx); */ /* printf("%.15f\n", bodies[i].vy); */ /* printf("%.15f\n", bodies[i].vz); */ /* printf("%.15f\n", bodies[i].mass); */ /* } */ /* printf ("%.9f\n", energy(bodies)); */ offset_momentum(bodies); printf ("%.9f\n", energy(bodies)); advance_n(bodies, 0.01, n); printf ("%.9f\n", energy(bodies)); return 0; } /* notes, command-line, and program output */ /* NOTES: */ /* 64-bit Ubuntu quad core */ /* gcc (Ubuntu 10.2.0-13ubuntu1) 10.2.0 */ /* MAKE: */ /* /usr/bin/gcc -pipe -Wall -O3 -fomit-frame-pointer -march=ivybridge nbody.gcc-6.c -o nbody.gcc-6.gcc_run -lm */ /* rm nbody.gcc-6.c */ /* 1.66s to complete and log all make actions */ /* COMMAND LINE: */ /* ./nbody.gcc-6.gcc_run 50000000 */ /* PROGRAM OUTPUT: */ /* -0.169075164 */ /* -0.169059907 */ /* 3-Clause BSD License */
26.555556
114
0.547121
df4dcfd23772aa99d8002e1ee2f46fd0e8cb7c48
528
h
C
src/modelFactory/CFG/FunctionFactory.h
toebs88/SCAM
0b5a8f1c57593da40e85d0b8ce6a6cf5616379ca
[ "MIT" ]
3
2018-08-31T21:35:27.000Z
2018-10-29T04:06:46.000Z
src/modelFactory/CFG/FunctionFactory.h
toebs88/SCAM
0b5a8f1c57593da40e85d0b8ce6a6cf5616379ca
[ "MIT" ]
1
2018-04-20T12:38:22.000Z
2018-04-20T12:38:55.000Z
src/modelFactory/CFG/FunctionFactory.h
toebs88/SCAM
0b5a8f1c57593da40e85d0b8ce6a6cf5616379ca
[ "MIT" ]
null
null
null
// // Created by ludwig on 19.07.18. // #ifndef PROJECT_FUNCTIONFACTORY_H #define PROJECT_FUNCTIONFACTORY_H #include "SectionFactory.h" namespace SCAM{ /*** * \bref Builds a function from a CFG * */ class FunctionFactory { public: FunctionFactory(const std::map<int, CFGNode *> &controlFlowMap, Function * function); virtual ~FunctionFactory() = default; const std::vector<Stmt *> &getStmtList() const; private: std::vector<Stmt*> stmtList; }; } #endif //PROJECT_FUNCTIONFACTORY_H
16
90
0.681818
d9c031dbeb1a9634451608a29592a74002958dc3
2,443
h
C
linux-4.14.90-dev/linux-4.14.90/tools/testing/radix-tree/test.h
bingchunjin/1806_SDK
d5ed0258fc22f60e00ec025b802d175f33da6e41
[ "MIT" ]
34
2019-07-19T20:44:15.000Z
2022-03-07T12:09:00.000Z
linux-4.14.90-dev/linux-4.14.90/tools/testing/radix-tree/test.h
bingchunjin/1806_SDK
d5ed0258fc22f60e00ec025b802d175f33da6e41
[ "MIT" ]
3
2021-09-06T09:14:42.000Z
2022-03-27T08:09:54.000Z
linux-4.14.90-dev/linux-4.14.90/tools/testing/radix-tree/test.h
bingchunjin/1806_SDK
d5ed0258fc22f60e00ec025b802d175f33da6e41
[ "MIT" ]
20
2021-10-22T02:21:23.000Z
2022-03-31T04:55:35.000Z
/* SPDX-License-Identifier: GPL-2.0 */ #include <linux/gfp.h> #include <linux/types.h> #include <linux/radix-tree.h> #include <linux/rcupdate.h> struct item { unsigned long index; unsigned int order; }; struct item *item_create(unsigned long index, unsigned int order); int __item_insert(struct radix_tree_root *root, struct item *item); int item_insert(struct radix_tree_root *root, unsigned long index); int item_insert_order(struct radix_tree_root *root, unsigned long index, unsigned order); int item_delete(struct radix_tree_root *root, unsigned long index); struct item *item_lookup(struct radix_tree_root *root, unsigned long index); void item_check_present(struct radix_tree_root *root, unsigned long index); void item_check_absent(struct radix_tree_root *root, unsigned long index); void item_gang_check_present(struct radix_tree_root *root, unsigned long start, unsigned long nr, int chunk, int hop); void item_full_scan(struct radix_tree_root *root, unsigned long start, unsigned long nr, int chunk); void item_kill_tree(struct radix_tree_root *root); int tag_tagged_items(struct radix_tree_root *, pthread_mutex_t *, unsigned long start, unsigned long end, unsigned batch, unsigned iftag, unsigned thentag); unsigned long find_item(struct radix_tree_root *, void *item); void tag_check(void); void multiorder_checks(void); void iteration_test(unsigned order, unsigned duration); void benchmark(void); void idr_checks(void); void ida_checks(void); void ida_thread_tests(void); struct item * item_tag_set(struct radix_tree_root *root, unsigned long index, int tag); struct item * item_tag_clear(struct radix_tree_root *root, unsigned long index, int tag); int item_tag_get(struct radix_tree_root *root, unsigned long index, int tag); void tree_verify_min_height(struct radix_tree_root *root, int maxindex); void verify_tag_consistency(struct radix_tree_root *root, unsigned int tag); extern int nr_allocated; /* Normally private parts of lib/radix-tree.c */ struct radix_tree_node *entry_to_node(void *ptr); void radix_tree_dump(struct radix_tree_root *root); int root_tag_get(struct radix_tree_root *root, unsigned int tag); unsigned long node_maxindex(struct radix_tree_node *); unsigned long shift_maxindex(unsigned int shift); int radix_tree_cpu_dead(unsigned int cpu); struct radix_tree_preload { unsigned nr; struct radix_tree_node *nodes; }; extern struct radix_tree_preload radix_tree_preloads;
38.171875
77
0.801474
8aad42a832e8461d4de433004a6843a530fb9220
2,363
h
C
src/IntaRNA/AccessibilityBasePair.h
fabio-gut/IntaRNA
034bb1427673eda5b611dffdba37f464e1bb2835
[ "MIT" ]
null
null
null
src/IntaRNA/AccessibilityBasePair.h
fabio-gut/IntaRNA
034bb1427673eda5b611dffdba37f464e1bb2835
[ "MIT" ]
1
2019-06-27T07:39:05.000Z
2019-06-27T11:10:52.000Z
src/IntaRNA/AccessibilityBasePair.h
fabio-gut/IntaRNA
034bb1427673eda5b611dffdba37f464e1bb2835
[ "MIT" ]
null
null
null
#ifndef INTARNA_ACCESSIBILITYBASEPAIR_H_ #define INTARNA_ACCESSIBILITYBASEPAIR_H_ #include "IntaRNA/general.h" #include "IntaRNA/RnaSequence.h" #include "IntaRNA/Accessibility.h" #include "IntaRNA/AccessibilityConstraint.h" #include "IntaRNA/NussinovHandler.h" namespace IntaRNA { /** * Provides accessibility penalties for a Nussinov-like energy scoring where * each base pair is scored by #basePairEnergy independently from its structural * context. * * This implementation is mainly for teaching and testing purpose. * * @author Mostafa Mahmoud * @author Martin Mann * */ class AccessibilityBasePair: public Accessibility { public: /*** * Constructor of AccessibilityBasePair * @param seq The sequence the accessibility data belongs to * @param maxLength the maximal length of accessible regions (>0) to be * considered. 0 defaults to the full sequence's length, otherwise * is is internally set to min(maxLength,seq.length). * @param accConstr optional accessibility constraint * @param basePairEnergy The energy value of the base pairs * @param RT The temperature energy constant * @param minLoopLength the minimum loop length */ AccessibilityBasePair( const RnaSequence& seq, const size_t maxLength, const AccessibilityConstraint * const accConstr, const E_type basePairEnergy = -1, const E_type RT = 1, const size_t minLoopLength = 3); /*** * Destructor of AccessibilityBasePair */ virtual ~AccessibilityBasePair(); /*** * Returns the accessibility energy value between the indices (from, to) * in the given sequence. * @param from The start index of the region * @param to The end index of the region * * @return The ED Value * * @throw std::runtime_error in case it does not hold 0 <= from <= to < seq.length */ virtual E_type getED( const size_t from, const size_t to ) const; protected: //! energy of an individual base pair const E_type basePairEnergy; //! temperature constant for normalization const E_type RT; //! Boltzmann Energy weight const E_type basePairWeight; //! minimum length of loops const size_t minLoopLength; /*** * Results of getED lookup table */ NussinovHandler::E2dMatrix logPu; }; } // namespace IntaRNA #endif /* INTARNA_ACCESSIBILITYBASEPAIR_H_ */
27.8
84
0.720271
0e4c16dd1b2fc5930b8925e81444eea834308c80
66
h
C
test_c_lib/include/test3.h
kachsheev/MakeRules
d62166159d24d8f468365ff0e2ef97c9481b982a
[ "MIT" ]
null
null
null
test_c_lib/include/test3.h
kachsheev/MakeRules
d62166159d24d8f468365ff0e2ef97c9481b982a
[ "MIT" ]
null
null
null
test_c_lib/include/test3.h
kachsheev/MakeRules
d62166159d24d8f468365ff0e2ef97c9481b982a
[ "MIT" ]
null
null
null
#ifndef TEST3_H #define TEST3_H void test3(); #endif // TEST3_H
9.428571
17
0.712121
b8d554fec2feaafa9e48bb1d39898109eae0dd1a
4,749
h
C
src/hexview/view/view.h
ejrh/hex
3c063ce142e6b62fb0f92f71bc94280305b53322
[ "MIT" ]
7
2015-09-15T13:20:23.000Z
2020-12-07T10:14:57.000Z
src/hexview/view/view.h
ejrh/hex
3c063ce142e6b62fb0f92f71bc94280305b53322
[ "MIT" ]
null
null
null
src/hexview/view/view.h
ejrh/hex
3c063ce142e6b62fb0f92f71bc94280305b53322
[ "MIT" ]
1
2018-09-07T00:54:35.000Z
2018-09-07T00:54:35.000Z
#ifndef LEVEL_VIEW_H #define LEVEL_VIEW_H #include "hexgame/game/game.h" #include "hexav/resources/paint.h" #include "hexview/view/unit_painter.h" #include "hexview/view/view_def.h" #include "hexview/view/view_resources.h" namespace hex { class FactionView: public boost::enable_shared_from_this<FactionView> { public: typedef boost::shared_ptr<FactionView> pointer; FactionView(Faction::pointer faction, FactionViewDef::pointer view_def): faction(faction), view_def(view_def) { } public: Faction::pointer faction; FactionViewDef::pointer view_def; }; class StructureView: public boost::enable_shared_from_this<StructureView> { public: typedef boost::shared_ptr<StructureView> pointer; StructureView(Structure::pointer structure, StructureViewDef::pointer view_def): structure(structure), view_def(view_def), selected(false) { } public: Structure::pointer structure; StructureViewDef::pointer view_def; Paint paint; bool selected; }; class TileView { public: TileView(): view_def(), feature_view_def(), highlighted(false), path_dir(-1), variation(0), structure_view() { } ~TileView() { } static const int PATH_END = 8; public: TileViewDef::pointer view_def; FeatureViewDef::pointer feature_view_def; bool highlighted; int path_dir; unsigned int variation; StructureView::pointer structure_view; Paint tile_paint; Paint transition_paint; Paint feature_paint; }; enum UnitPosture { Holding, Moving, Attacking, Recoiling, Dying }; class UnitView { public: UnitView(): facing(rand() % 6), posture(Holding), variation(rand()), phase(rand()), shadow(true), selected(false), targetted(false), play_sound(false) { } ~UnitView() { } void update(unsigned int update_ms) { phase += update_ms; } public: UnitViewDef::pointer view_def; int facing; UnitPosture posture; unsigned int variation; unsigned int phase; bool shadow; bool selected; bool targetted; bool play_sound; Paint paint; }; class UnitStackView: public UnitView, public boost::enable_shared_from_this<UnitStackView> { public: typedef boost::shared_ptr<UnitStackView> pointer; UnitStackView(UnitStack::pointer stack): stack(stack), moving(false), locked(false) { } ~UnitStackView() { } void set_representative(ViewResources *resources); public: UnitStack::pointer stack; unsigned int representative; bool moving, locked; Path path; }; class Throttle; class MessageReceiver; class Player; class LevelView { public: LevelView(Level *level); ~LevelView(); void resize(int width, int height); void set_highlight_tile(const Point& tile_pos); bool check_discovered(const Point& tile_pos); bool check_visibility(const Point& tile_pos); public: Level *level; Vector2<TileView> tile_views; Point highlight_tile; VisibilityMapUnion discovered; VisibilityMap visibility; VisibilityMap ghost_visibility; }; class InfoMessage { public: InfoMessage(const std::string text): text(text) { } public: std::string text; }; class Ghost; class GameView { public: GameView(Game *game, Player *player, ViewResources *resources, Throttle *throttle, MessageReceiver *dispatcher); void stop(); void update(); void update_player(); void left_click_tile(const Point& tile_pos); void right_click_tile(const Point& tile_pos); void set_drawn_path(const Point& start, const Path& path); Path find_path(UnitStack& party, const Point& from_pos, const Point& to_pos); void clear_drawn_path(); void update_visibility(); void update_ghost_visibility(); UnitStackView::pointer get_stack_view(int stack_id); TileView *get_tile_view(const Point tile_pos); void move_units(int stack_id, const IntSet selected_units, Point point); void transfer_units(int stack_id, const IntSet selected_units, Path path, int target_id); void mark_ready(); void set_view_def(UnitStackView& stack_view) const; void fix_stack_views(); public: Game *game; Player *player; std::vector<InfoMessage> messages; LevelView level_view; ViewResources *resources; UnitPainter unit_painter; Throttle *throttle; MessageReceiver *dispatcher; unsigned int last_update; unsigned int phase; IntMap<FactionView> faction_views; IntMap<UnitStackView> unit_stack_views; std::unordered_map<int, std::unique_ptr<Ghost> > ghosts; int selected_stack_id; IntSet selected_units; Structure::pointer selected_structure; Path drawn_path; bool debug_mode; private: Counter ghost_counter; }; }; #endif
24.734375
117
0.714045
d449249fd00b32f9075967e2e58754ddfa12a12e
808
h
C
msj_archives/code/MSJMar97.src/Custom Wizards/TippyDialog/TippyDialogAw.h
sarangbaheti/misc-code
d47a8d1cc41f19701ce628c9f15976bb5baa239d
[ "Unlicense" ]
1
2020-10-22T12:58:55.000Z
2020-10-22T12:58:55.000Z
msj_archives/code/MSJMar97.src/Custom Wizards/TippyDialog/TippyDialogAw.h
sarangbaheti/misc-code
d47a8d1cc41f19701ce628c9f15976bb5baa239d
[ "Unlicense" ]
null
null
null
msj_archives/code/MSJMar97.src/Custom Wizards/TippyDialog/TippyDialogAw.h
sarangbaheti/misc-code
d47a8d1cc41f19701ce628c9f15976bb5baa239d
[ "Unlicense" ]
2
2020-10-19T23:36:26.000Z
2020-10-22T12:59:37.000Z
// TippyDialogaw.h : header file // class CDialogChooser; // All function calls made by mfcapwz.dll to this custom AppWizard (except for // GetCustomAppWizClass-- see TippyDialog.cpp) are through this class. You may // choose to override more of the CCustomAppWiz virtual functions here to // further specialize the behavior of this custom AppWizard. class CTippyDialogAppWiz : public CCustomAppWiz { public: virtual CAppWizStepDlg* Next(CAppWizStepDlg* pDlg); virtual void InitCustomAppWiz(); virtual void ExitCustomAppWiz(); }; // This declares the one instance of the CTippyDialogAppWiz class. You can access // m_Dictionary and any other public members of this class through the // global TippyDialogaw. (Its definition is in TippyDialogaw.cpp.) extern CTippyDialogAppWiz TippyDialogaw;
35.130435
82
0.783416
54d72c0e2589eb6d8dda7a41195e03bfe6b190d7
647
h
C
algorithms/easy/0557. Reverse Words in a String III.h
MultivacX/letcode2020
f86289f8718237303918a7705ae31625a12b68f6
[ "MIT" ]
null
null
null
algorithms/easy/0557. Reverse Words in a String III.h
MultivacX/letcode2020
f86289f8718237303918a7705ae31625a12b68f6
[ "MIT" ]
null
null
null
algorithms/easy/0557. Reverse Words in a String III.h
MultivacX/letcode2020
f86289f8718237303918a7705ae31625a12b68f6
[ "MIT" ]
null
null
null
// 557. Reverse Words in a String III // https://leetcode.com/problems/reverse-words-in-a-string-iii/ // Runtime: 20 ms, faster than 75.93% of C++ online submissions for Reverse Words in a String III. // Memory Usage: 9.9 MB, less than 89.30% of C++ online submissions for Reverse Words in a String III. class Solution { public: string reverseWords(string s) { const int N = s.length(); for (int i = 0, j = 0; j < N; ++j) { if (s[j] == ' ' || j + 1 == N) { reverse(begin(s) + i, j + 1 == N ? end(s) : begin(s) + j); i = j + 1; } } return s; } };
34.052632
102
0.523957
0747337066c11a3a70dfe090b896480267253c8b
273
h
C
MJRefreshExample/MJRefreshExample/MJRefresh/MJRefreshLegendFooter.h
dacaiguoguo/LVMJRefresh
4d41c0383014b6a2b359be5522afbe9d56419fa3
[ "MIT" ]
null
null
null
MJRefreshExample/MJRefreshExample/MJRefresh/MJRefreshLegendFooter.h
dacaiguoguo/LVMJRefresh
4d41c0383014b6a2b359be5522afbe9d56419fa3
[ "MIT" ]
null
null
null
MJRefreshExample/MJRefreshExample/MJRefresh/MJRefreshLegendFooter.h
dacaiguoguo/LVMJRefresh
4d41c0383014b6a2b359be5522afbe9d56419fa3
[ "MIT" ]
null
null
null
// https://github.com/CoderMJLee/MJRefresh // MJRefreshLegendFooter.h // MJRefreshExample // // Created by MJ Lee on 15/3/5. // Copyright (c) 2015年 itcast. All rights reserved. // #import "MJRefreshFooter.h" @interface MJRefreshLegendFooter : MJRefreshFooter @end
19.5
52
0.728938
b0ee40673bc5ffc2a4d648dddb4f54c9e3098168
383
c
C
mem-dinamica.c
EduardoLlamasRad/C-Utilities
5a23f2604f2ae43c9eda2d5eb4c8dc5a09428932
[ "MIT" ]
2
2019-06-06T19:31:04.000Z
2019-07-30T23:34:20.000Z
mem-dinamica.c
EduardoLlamasRad/C-Utilities
5a23f2604f2ae43c9eda2d5eb4c8dc5a09428932
[ "MIT" ]
null
null
null
mem-dinamica.c
EduardoLlamasRad/C-Utilities
5a23f2604f2ae43c9eda2d5eb4c8dc5a09428932
[ "MIT" ]
null
null
null
#include <stdio.h> #include <stdlib.h> void imprime(int v[], int n){ int i; for(i = 0; i < n; i++){ printf("%d %d\n", v[i], *(v+i)); } return; } int main(){ int i, *v, n, w[100]; scanf("%d", &n); v = (int*)malloc(n*sizeof(int)); for(i = 0; i < n; i++){ scanf("%d", &w[i]); /* scanf("%d", (v+i*sizeof(int)));*/ } imprime(w, n); imprime(w, n); free(v); return 0; }
15.32
37
0.480418
c25f3d27d3243d706ec959d23935245e8c9d30a0
2,049
h
C
src/prod/src/data/txnreplicator/loggingreplicator/MemoryLogReadStream.h
gridgentoo/ServiceFabricAzure
c3e7a07617e852322d73e6cc9819d266146866a4
[ "MIT" ]
2,542
2018-03-14T21:56:12.000Z
2019-05-06T01:18:20.000Z
src/prod/src/data/txnreplicator/loggingreplicator/MemoryLogReadStream.h
gridgentoo/ServiceFabricAzure
c3e7a07617e852322d73e6cc9819d266146866a4
[ "MIT" ]
994
2019-05-07T02:39:30.000Z
2022-03-31T13:23:04.000Z
src/prod/src/data/txnreplicator/loggingreplicator/MemoryLogReadStream.h
gridgentoo/ServiceFabricAzure
c3e7a07617e852322d73e6cc9819d266146866a4
[ "MIT" ]
300
2018-03-14T21:57:17.000Z
2019-05-06T20:07:00.000Z
// ------------------------------------------------------------ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License (MIT). See License.txt in the repo root for license information. // ------------------------------------------------------------ #pragma once namespace Data { namespace LoggingReplicator { class MemoryLog::ReadStream : public KObject<ReadStream> , public KShared<ReadStream> , public Data::Log::ILogicalLogReadStream { K_FORCE_SHARED(ReadStream) K_SHARED_INTERFACE_IMP(KStream) K_SHARED_INTERFACE_IMP(ILogicalLogReadStream) K_SHARED_INTERFACE_IMP(IDisposable) public: static NTSTATUS Create( __in MemoryLog& parent, __in KAllocator& allocator, __out ReadStream::SPtr & result); LONGLONG GetPosition() const override { return readPosition_; } void SetPosition(__in LONGLONG position) override { readPosition_ = position; } LONGLONG GetLength() const override { return log_->GetLength(); } ktl::Awaitable<NTSTATUS> ReadAsync( __in KBuffer& Buffer, __out ULONG& BytesRead, __in ULONG OffsetIntoBuffer, __in ULONG Count); ktl::Awaitable<NTSTATUS> WriteAsync( __in KBuffer const & Buffer, __in ULONG OffsetIntoBuffer, __in ULONG Count); ktl::Awaitable<NTSTATUS> FlushAsync(); ktl::Awaitable<NTSTATUS> CloseAsync(); void Dispose(); private: ReadStream(__in MemoryLog & parent); MemoryLog::SPtr log_; LONG64 readPosition_; }; } }
29.695652
99
0.488043