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
7d645ed377ccfb478b5b88aefbe16f89fb2a5c5b
6,034
h
C
ns-3-dev/src/internet/model/nsc-tcp-socket-impl.h
maxvonhippel/snake
0805773dc34e1480dffaae40174aa1f82d1c6ce8
[ "BSD-3-Clause" ]
11
2015-11-24T11:07:28.000Z
2021-12-23T04:10:29.000Z
ns-3-dev/src/internet/model/nsc-tcp-socket-impl.h
maxvonhippel/snake
0805773dc34e1480dffaae40174aa1f82d1c6ce8
[ "BSD-3-Clause" ]
null
null
null
ns-3-dev/src/internet/model/nsc-tcp-socket-impl.h
maxvonhippel/snake
0805773dc34e1480dffaae40174aa1f82d1c6ce8
[ "BSD-3-Clause" ]
6
2016-03-01T06:32:21.000Z
2022-03-24T19:31:41.000Z
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ /* * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as * published by the Free Software Foundation; * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef NSC_TCP_SOCKET_IMPL_H #define NSC_TCP_SOCKET_IMPL_H #include <stdint.h> #include <queue> #include <vector> #include "ns3/callback.h" #include "ns3/traced-value.h" #include "ns3/tcp-socket.h" #include "ns3/ptr.h" #include "ns3/ipv4-address.h" #include "ns3/inet-socket-address.h" #include "ns3/event-id.h" #include "pending-data.h" #include "ns3/sequence-number.h" struct INetStreamSocket; namespace ns3 { class Ipv4EndPoint; class Node; class Packet; class NscTcpL4Protocol; class TcpHeader; /** * \ingroup socket * \ingroup nsctcp * * \brief Socket logic for the NSC TCP sockets. * * Most of the TCP internal * logic is handled by the NSC tcp library itself; this class maps ns3::Socket * calls to the NSC TCP library. */ class NscTcpSocketImpl : public TcpSocket { public: static TypeId GetTypeId (void); /** * Create an unbound tcp socket. */ NscTcpSocketImpl (); NscTcpSocketImpl (const NscTcpSocketImpl& sock); virtual ~NscTcpSocketImpl (); void SetNode (Ptr<Node> node); void SetTcp (Ptr<NscTcpL4Protocol> tcp); virtual enum SocketErrno GetErrno (void) const; virtual enum SocketType GetSocketType (void) const; virtual Ptr<Node> GetNode (void) const; virtual int Bind (void); virtual int Bind (const Address &address); virtual int Close (void); virtual int ShutdownSend (void); virtual int ShutdownRecv (void); virtual int Connect (const Address &address); virtual int Listen (void); virtual uint32_t GetTxAvailable (void) const; virtual int Send (Ptr<Packet> p, uint32_t flags); virtual int SendTo (Ptr<Packet> p, uint32_t flags, const Address &toAddress); virtual uint32_t GetRxAvailable (void) const; virtual Ptr<Packet> Recv (uint32_t maxSize, uint32_t flags); virtual Ptr<Packet> RecvFrom (uint32_t maxSize, uint32_t flags, Address &fromAddress); virtual int GetSockName (Address &address) const; virtual bool SetAllowBroadcast (bool allowBroadcast); virtual bool GetAllowBroadcast () const; private: void NSCWakeup (void); friend class Tcp; // invoked by Tcp class int FinishBind (void); void ForwardUp (Ptr<Packet> p, Ipv4Header header, uint16_t port, Ptr<Ipv4Interface> incomingInterface); void Destroy (void); //methods for state bool SendPendingData (void); bool ReadPendingData (void); bool Accept (void); void CompleteFork (void); void ConnectionSucceeded (); // Manage data tx/rx // XXX This should be virtual and overridden Ptr<NscTcpSocketImpl> Copy (); // attribute related virtual void SetSndBufSize (uint32_t size); virtual uint32_t GetSndBufSize (void) const; virtual void SetRcvBufSize (uint32_t size); virtual uint32_t GetRcvBufSize (void) const; virtual void SetSegSize (uint32_t size); virtual uint32_t GetSegSize (void) const; virtual void SetAdvWin (uint32_t window); virtual uint32_t GetAdvWin (void) const; virtual void SetSSThresh (uint32_t threshold); virtual uint32_t GetSSThresh (void) const; virtual void SetInitialCwnd (uint32_t cwnd); virtual uint32_t GetInitialCwnd (void) const; virtual void SetConnTimeout (Time timeout); virtual Time GetConnTimeout (void) const; virtual void SetConnCount (uint32_t count); virtual uint32_t GetConnCount (void) const; virtual void SetDelAckTimeout (Time timeout); virtual Time GetDelAckTimeout (void) const; virtual void SetDelAckMaxCount (uint32_t count); virtual uint32_t GetDelAckMaxCount (void) const; virtual void SetPersistTimeout (Time timeout); virtual Time GetPersistTimeout (void) const; enum Socket::SocketErrno GetNativeNs3Errno (int err) const; uint32_t m_delAckMaxCount; Time m_delAckTimeout; Ipv4EndPoint *m_endPoint; Ptr<Node> m_node; Ptr<NscTcpL4Protocol> m_tcp; Ipv4Address m_remoteAddress; uint16_t m_remotePort; //these two are so that the socket/endpoint cloning works Ipv4Address m_localAddress; uint16_t m_localPort; InetSocketAddress m_peerAddress; enum SocketErrno m_errno; bool m_shutdownSend; bool m_shutdownRecv; bool m_connected; //manage the state information TracedValue<TcpStates_t> m_state; bool m_closeOnEmpty; //needed to queue data when in SYN_SENT state std::queue<Ptr<Packet> > m_txBuffer; uint32_t m_txBufferSize; // Window management uint32_t m_segmentSize; //SegmentSize uint32_t m_rxWindowSize; uint32_t m_advertisedWindowSize; //Window to advertise TracedValue<uint32_t> m_cWnd; //Congestion window uint32_t m_ssThresh; //Slow Start Threshold uint32_t m_initialCWnd; //Initial cWnd value // Round trip time estimation Time m_lastMeasuredRtt; // Timer-related members Time m_cnTimeout; uint32_t m_cnCount; Time m_persistTimeout; // Temporary queue for delivering data to application std::queue<Ptr<Packet> > m_deliveryQueue; uint32_t m_rxAvailable; INetStreamSocket* m_nscTcpSocket; // Attributes uint32_t m_sndBufSize; // buffer limit for the outgoing queue uint32_t m_rcvBufSize; // maximum receive socket buffer size }; } // namespace ns3 #endif /* NSC_TCP_SOCKET_IMPL_H */
32.44086
79
0.720749
47f9f011044207758b3a34fa2034f440f02bdea4
1,809
h
C
Individual.h
hayatigonultas/sos_hybridization
645f11d5b4b7b879796d0e62691ca2d8e28a59a5
[ "MIT" ]
1
2020-06-27T22:06:23.000Z
2020-06-27T22:06:23.000Z
Individual.h
hayatigonultas/sos_hybridization
645f11d5b4b7b879796d0e62691ca2d8e28a59a5
[ "MIT" ]
null
null
null
Individual.h
hayatigonultas/sos_hybridization
645f11d5b4b7b879796d0e62691ca2d8e28a59a5
[ "MIT" ]
1
2020-06-27T22:06:26.000Z
2020-06-27T22:06:26.000Z
#ifndef EVOLUTIONARYLIB_INDIVIDUAL_H #define EVOLUTIONARYLIB_INDIVIDUAL_H #include <stddef.h> class Population; class Individual { public: Individual(); Individual(const Individual& ind); virtual ~Individual(); Individual& operator=(const Individual& ind); bool operator==(const Individual& ind) const; inline bool operator!=(const Individual& ind) const { return !(*this == ind); } static void setDimension(size_t dimension); static size_t getDimension(); static void setHyperMutationEnabled(bool enabled); static bool isHyperMutationEnabled(); double* getValues() const; void display() const; double getFitness(); void updateFitness(); void gaussianMutate(double std = 3.3); bool isFitnessCalculated() const; void setFitnessCalculated(bool fitnessCalculated); double getEuclideanDistanceToIndividual(const Individual &individual) const; double getMutation() const { return mutation; } void setMutation(double mutation) { Individual::mutation = mutation; } Population *getPopulation() const { return population; } void setPopulation(Population *population) { Individual::population = population; } int getRank() const { return rank; } void setRank(int rank) { Individual::rank = rank; } double getLinRank() const { return linRank; } void setLinRank(double linRank) { Individual::linRank = linRank; } private: static size_t Dimension; static bool HyperMutationEnabled; double* values; double fitness; bool fitnessCalculated; double mutation; Population* population; int rank; double linRank; }; #endif //EVOLUTIONARYLIB_INDIVIDUAL_H
19.879121
80
0.670536
f2ea186a8caea0243ac0978d72e30e37a28f409c
529
h
C
include/filter/direction_strategy.h
NeurotechLtd/dsp
1ebcdc65f4eb1bee217084de25ab3f9f09f745fc
[ "MIT" ]
null
null
null
include/filter/direction_strategy.h
NeurotechLtd/dsp
1ebcdc65f4eb1bee217084de25ab3f9f09f745fc
[ "MIT" ]
null
null
null
include/filter/direction_strategy.h
NeurotechLtd/dsp
1ebcdc65f4eb1bee217084de25ab3f9f09f745fc
[ "MIT" ]
1
2019-12-12T08:49:49.000Z
2019-12-12T08:49:49.000Z
#ifndef DIRECTION_STRATEGY_H #define DIRECTION_STRATEGY_H namespace DSP { template <typename FilterAlgorithm> class ForwardFiltering : private FilterAlgorithm { protected: template <typename T> T performFiltering(T sample){ return this->filter(sample); } }; template <typename FilterAlgorithm> class ReverseFiltering : private FilterAlgorithm { protected: template <typename T> T performFiltering(T sample){ return sample - this->filter(sample); } }; } #endif // DIRECTION_STRATEGY_H
19.592593
50
0.731569
7894483de476c45e165290fbeefb583563320f2f
301
h
C
jober.h
mengzhaofeng2016/qredisclient
1e6b632347622801cceba38365710a44883f6e11
[ "Apache-2.0" ]
1
2021-03-06T02:52:23.000Z
2021-03-06T02:52:23.000Z
jober.h
mengzhaofeng2016/qredisclient
1e6b632347622801cceba38365710a44883f6e11
[ "Apache-2.0" ]
null
null
null
jober.h
mengzhaofeng2016/qredisclient
1e6b632347622801cceba38365710a44883f6e11
[ "Apache-2.0" ]
null
null
null
#ifndef JOBER_H #define JOBER_H #include <QRunnable> #include "redisadapter.h" class Jober : public QRunnable { public: explicit Jober(std::function<void (void*)>& job, RedisMeta *meta); void run(); private: std::function<void (void*)> job; RedisMeta* meta; }; #endif // JOBER_H
14.333333
70
0.671096
7a53d0fcd5805fd1c2096422431764a01df1020b
3,372
h
C
include/apsis/sprite/thing.h
wilkie/apsis
9e6a37ad9dfc8931b25b9429d7e4a770b4e760bf
[ "WTFPL" ]
2
2015-11-05T03:47:29.000Z
2020-01-24T18:48:09.000Z
include/apsis/sprite/thing.h
wilkie/apsis
9e6a37ad9dfc8931b25b9429d7e4a770b4e760bf
[ "WTFPL" ]
null
null
null
include/apsis/sprite/thing.h
wilkie/apsis
9e6a37ad9dfc8931b25b9429d7e4a770b4e760bf
[ "WTFPL" ]
null
null
null
#ifndef APSIS_SPRITE_THING_H #define APSIS_SPRITE_THING_H #include "apsis/engine/object.h" #include "apsis/sprite/sheet.h" #include "apsis/sprite/animation.h" #include "apsis/rules/update_function.h" #include "apsis/rules/collide_function.h" #include "apsis/world/object.h" #include "apsis/world/rule_set.h" #include "apsis/sync/reference_counter.h" #include <string> #include <vector> #include <json/json.h> namespace Apsis { namespace Sprite { class Thing { public: /* * Constructs a Thing from the given thing file. */ Thing(const char* path, const Engine::Object& loader); /* * Loads a Thing from the thing info represented by the given file. */ static const Apsis::Sprite::Thing& load(const char* path, const Engine::Object& object); /* * Retrieves an already loaded Thing of the given id. */ static const Apsis::Sprite::Thing& get(unsigned int id); /* * Returns the sprite sheet associated with this Thing. */ const Apsis::Sprite::Sheet& sheet() const; /* * Returns the animation represented by the given name. */ const Apsis::Sprite::Animation& animation(const char* name) const; /* * Returns the id of the animation represented by the given name. */ unsigned int animationId(const char* name) const; /* * Returns the animation represented by the given id. */ const Apsis::Sprite::Animation& animationById(unsigned int id) const; /* * Returns the number of animations known to this Thing. */ unsigned int animationCount() const; /* * Returns the unique id of this Thing. */ unsigned int id() const; /* * Returns the Object representation of this Thing. */ const World::Object& object() const; /* * Returns the set of rules attached to this Thing. */ const Apsis::World::RuleSet& rules() const; /* * Returns the name of this thing. */ const char* name() const; private: // Keeps track of Things system-wide. static std::vector<std::string> _ids; static std::vector<Apsis::Sprite::Thing*> _things; const Engine::Object& _loader; // The path to the thing description. std::string _path; // Parses the given json via the path given in jsonFile. void _openJSONFile(); // Whether or not the JSON has been loaded bool _jsonLoaded; const Apsis::Sprite::Thing* _inherited; // Name std::string _name; // Load sprite sheet from JSON const Apsis::Sprite::Sheet& _loadSpriteSheet(); // Parse JSON void _parseJSONFile(); // JSON value; Json::Value _value; // The default object representation. World::Object _object; // Animations std::vector<Apsis::Sprite::Animation> _animations; // Sprite sheet const Sprite::Sheet& _sheet; // Thing id unsigned int _id; // For garbage collection Sync::ReferenceCounter _counter; // Before Move Agents std::vector<Apsis::Rules::CollideFunction> _collideFunctions; // RuleSet Apsis::World::RuleSet _rules; }; } } #endif
23.914894
76
0.607058
2b467c068d233e6dc57893507c60bd08692eaa06
7,587
c
C
src/c/lib/xml.c
Proximify/publication-importer
2b93e1c737fc81827411d03099637e0b3c20d4d1
[ "MIT" ]
1
2021-09-17T03:07:36.000Z
2021-09-17T03:07:36.000Z
src/c/lib/xml.c
Inncee81/publication-fetcher
2b93e1c737fc81827411d03099637e0b3c20d4d1
[ "MIT" ]
null
null
null
src/c/lib/xml.c
Inncee81/publication-fetcher
2b93e1c737fc81827411d03099637e0b3c20d4d1
[ "MIT" ]
1
2021-09-17T03:07:33.000Z
2021-09-17T03:07:33.000Z
/* * xml.c * * Copyright (c) Chris Putnam 2004-8 * * Source code released under the GPL * */ #include <stdio.h> #include <stdlib.h> #include <string.h> #include "is_ws.h" #include "strsearch.h" #include "newstr.h" #include "xml.h" char *xml_pns = NULL; static xml_attrib * xmlattrib_new( void ) { xml_attrib *a = (xml_attrib *) malloc( sizeof( xml_attrib ) ); if ( a ) { lists_init( &(a->attrib) ); lists_init( &(a->value) ); } return a; } static void xmlattrib_add( xml_attrib *a, char *attrib, char *value ) { lists_add( &(a->attrib), attrib ); lists_add( &(a->value), value ); } static void xmlattrib_free( xml_attrib *a ) { lists_free( &(a->attrib) ); lists_free( &(a->value ) ); } static xml * xml_new( void ) { xml *x = ( xml * ) malloc( sizeof( xml ) ); if ( x ) xml_init( x ); return x; } void xml_free( xml *x ) { if ( x->tag ) newstr_free( x->tag ); if ( x->value ) newstr_free( x->value ); if ( x->a ) xmlattrib_free( x->a ); if ( x->down ) xml_free( x->down ); if ( x->next ) xml_free( x->next ); } void xml_init( xml *x ) { x->tag = newstr_new(); x->value = newstr_new(); x->a = NULL; x->down = NULL; x->next = NULL; if ( !(x->tag) || !(x->value) ) { fprintf(stderr,"xml_init: memory error.\n"); exit( EXIT_FAILURE ); } } enum { XML_DESCRIPTOR, XML_COMMENT, XML_OPEN, XML_CLOSE, XML_OPENCLOSE }; static int xml_terminator( char *p, int *type ) { if ( *p=='>' ) { return 1; } else if ( *p=='/' && *(p+1)=='>' ) { if ( *type==XML_OPENCLOSE ) return 1; else if ( *type==XML_OPEN ) { *type = XML_OPENCLOSE; return 1; } } else if ( *p=='?' && *(p+1)=='>' && *type==XML_DESCRIPTOR ) { return 1; } else if ( *p=='!' && *(p+1)=='>' && *type==XML_COMMENT ) { return 1; } return 0; } static char * xml_processattrib( char *p, xml_attrib **ap, int *type ) { xml_attrib *a = NULL; char quote_character = '\"'; int inquotes = 0; newstr aname, aval; newstr_init( &aname ); newstr_init( &aval ); while ( *p && !xml_terminator(p,type) ) { /* get attribute name */ while ( *p==' ' || *p=='\t' ) p++; while ( *p && !strchr( "= \t", *p ) && !xml_terminator(p,type)){ newstr_addchar( &aname, *p ); p++; } while ( *p==' ' || *p=='\t' ) p++; if ( *p=='=' ) p++; /* get attribute value */ while ( *p==' ' || *p=='\t' ) p++; if ( *p=='\"' || *p=='\'' ) { if ( *p=='\'' ) quote_character = *p; inquotes=1; p++; } while ( *p && ((!xml_terminator(p,type) && !strchr("= \t", *p ))||inquotes)){ if ( *p==quote_character ) inquotes=0; else newstr_addchar( &aval, *p ); p++; } if ( aname.len ) { if ( !a ) a = xmlattrib_new(); xmlattrib_add( a, aname.data, aval.data ); } newstr_empty( &aname ); newstr_empty( &aval ); } newstr_free( &aname ); newstr_free( &aval ); *ap = a; return p; } /* * xml_processtag * * XML_COMMENT <!-- .... --> * XML_DESCRIPTOR <?.....> * XML_OPEN <A> * XML_CLOSE </A> * XML_OPENCLOSE <A/> */ static char * xml_processtag( char *p, newstr *tag, xml_attrib **attrib, int *type ) { *attrib = NULL; if ( *p=='<' ) p++; if ( *p=='!' ) { while ( *p && *p!='>' ) newstr_addchar( tag, *p++ ); *type = XML_COMMENT; } else if ( *p=='?' ) { *type = XML_DESCRIPTOR; p++; /* skip '?' */ while ( *p && !strchr( " \t", *p ) && !xml_terminator(p,type) ) newstr_addchar( tag, *p++ ); if ( *p==' ' || *p=='\t' ) p = xml_processattrib( p, attrib, type ); } else if ( *p=='/' ) { while ( *p && !strchr( " \t", *p ) && !xml_terminator(p,type) ) newstr_addchar( tag, *p++ ); *type = XML_CLOSE; if ( *p==' ' || *p=='\t' ) p = xml_processattrib( p, attrib, type ); } else { *type = XML_OPEN; while ( *p && !strchr( " \t", *p ) && !xml_terminator(p,type) ) newstr_addchar( tag, *p++ ); if ( *p==' ' || *p=='\t' ) p = xml_processattrib( p, attrib, type ); } while ( *p && *p!='>' ) p++; if ( *p=='>' ) p++; return p; } static void xml_appendnode( xml *onode, xml *nnode ) { if ( !onode->down ) onode->down = nnode; else { xml *p = onode->down; while ( p->next ) p = p->next; p->next = nnode; } } char * xml_tree( char *p, xml *onode ) { newstr tag; xml_attrib *attrib; int type, is_style = 0; newstr_init( &tag ); while ( *p ) { /* retain white space for <style> tags in endnote xml */ if ( onode->tag && onode->tag->data && !strcasecmp(onode->tag->data,"style") ) is_style=1; while ( *p && *p!='<' ) { if ( onode->value->len>0 || is_style || !is_ws( *p ) ) newstr_addchar( onode->value, *p ); p++; } if ( *p=='<' ) { newstr_empty( &tag ); p = xml_processtag( p, &tag, &attrib, &type ); if ( type==XML_OPEN || type==XML_OPENCLOSE || type==XML_DESCRIPTOR ) { xml *nnode = xml_new(); newstr_newstrcpy( nnode->tag, &tag ); nnode->a = attrib; xml_appendnode( onode, nnode ); if ( type==XML_OPEN ) p = xml_tree( p, nnode ); } else if ( type==XML_CLOSE ) { /*check to see if it's closing for this one*/ return p; /* assume it's right for now*/ } } } newstr_free( &tag ); return p; } void xml_draw( xml *x, int n ) { int i,j; if ( !x ) return; for ( i=0; i<n; ++i ) printf( " " ); printf("n=%d tag='%s' value='%s'\n", n, x->tag->data, x->value->data ); if ( x->a ) { for ( j=0; j<x->a->value.n; ++j ) { for ( i=0; i<n; ++i ) printf( " " ); printf(" attrib='%s' value='%s'\n", (x->a)->attrib.str[j].data, (x->a)->value.str[j].data ); } } if ( x->down ) xml_draw( x->down, n+1 ); if ( x->next ) xml_draw( x->next, n ); } char * xml_findstart( char *buffer, char *tag ) { newstr starttag; char *p; newstr_init( &starttag ); newstr_addchar( &starttag, '<' ); newstr_strcat( &starttag, tag ); newstr_addchar( &starttag, ' ' ); p = strsearch( buffer, starttag.data ); if ( !p ) { starttag.data[ starttag.len-1 ] = '>'; p = strsearch( buffer, starttag.data ); } newstr_free( &starttag ); return p; } char * xml_findend( char *buffer, char *tag ) { newstr endtag; char *p; newstr_init( &endtag ); newstr_strcpy( &endtag, "</" ); if ( xml_pns ) { newstr_strcat( &endtag, xml_pns ); newstr_addchar( &endtag, ':' ); } newstr_strcat( &endtag, tag ); newstr_addchar( &endtag, '>' ); p = strsearch( buffer, endtag.data ); if ( p && *p ) { if ( *p ) p++; /* skip <random_tag></end> combo */ while ( *p && *(p-1)!='>' ) p++; } newstr_free( &endtag ); return p; } int xml_tagexact( xml *node, char *s ) { newstr tag; int found = 0; if ( xml_pns ) { newstr_init( &tag ); newstr_strcpy( &tag, xml_pns ); newstr_addchar( &tag, ':' ); newstr_strcat( &tag, s ); if ( node->tag->len==tag.len && !strcasecmp( node->tag->data, tag.data ) ) found = 1; newstr_free( &tag ); } else { if ( node->tag->len==strlen( s ) && !strcasecmp( node->tag->data, s ) ) found = 1; } return found; } int xml_tag_attrib( xml *node, char *s, char *attrib, char *value ) { xml_attrib *na = node->a; int i; if ( !na || !xml_tagexact( node, s ) ) return 0; for ( i=0; i<na->attrib.n; ++i ) { if ( !na->attrib.str[i].data || !na->value.str[i].data ) continue; if ( !strcasecmp( na->attrib.str[i].data, attrib ) && !strcasecmp( na->value.str[i].data, value ) ) return 1; } return 0; } newstr * xml_getattrib( xml *node, char *attrib ) { newstr *ns = NULL; xml_attrib *na = node->a; int i, nattrib; if ( na ) { nattrib = na->attrib.n; for ( i=0; i<nattrib; ++i ) if ( !strcasecmp( na->attrib.str[i].data, attrib ) ) ns = &(na->value.str[i]); } return ns; }
21.075
79
0.544616
1a52095b0ebd7d1e7582a5f9afa3fadf1a8c833f
342
h
C
visualizer/graphics_engine/shadow_map.h
cuauv/software
5ad4d52d603f81a7f254f365d9b0fe636d03a260
[ "BSD-3-Clause" ]
70
2015-11-16T18:04:01.000Z
2022-03-05T09:04:02.000Z
visualizer/graphics_engine/shadow_map.h
cuauv/software
5ad4d52d603f81a7f254f365d9b0fe636d03a260
[ "BSD-3-Clause" ]
1
2016-08-03T05:13:19.000Z
2016-08-03T06:19:39.000Z
visualizer/graphics_engine/shadow_map.h
cuauv/software
5ad4d52d603f81a7f254f365d9b0fe636d03a260
[ "BSD-3-Clause" ]
34
2015-12-15T17:29:23.000Z
2021-11-18T14:15:12.000Z
#ifndef _SHADOW_MAP_H_ #define _SHADOW_MAP_H_ #include <GL/gl.h> class ShadowMap { public: ShadowMap(GLenum texture_unit); int init(); void bind_for_writing(); void bind_for_reading(); GLenum texture_unit; unsigned int width; unsigned int height; private: GLuint fbo; GLuint shadow_map; }; #endif
14.869565
35
0.684211
ff55251ae6e64c6f82b0e9ab9c36c67936056642
642
h
C
src/JSPlatform.h
darwin/stpyv8
b7c3ba2569a12c8a8dac0fdab1f74a6338ec74ca
[ "Apache-2.0" ]
1
2020-06-21T06:00:03.000Z
2020-06-21T06:00:03.000Z
src/JSPlatform.h
darwin/naga
b7c3ba2569a12c8a8dac0fdab1f74a6338ec74ca
[ "Apache-2.0" ]
null
null
null
src/JSPlatform.h
darwin/naga
b7c3ba2569a12c8a8dac0fdab1f74a6338ec74ca
[ "Apache-2.0" ]
null
null
null
#ifndef NAGA_JSPLATFORM_H_ #define NAGA_JSPLATFORM_H_ #include "Base.h" class JSPlatform { private: bool m_initialized{false}; std::unique_ptr<v8::Platform> m_v8_platform; // CPlatform is a singleton => make the constructor private, disable copy/move private: JSPlatform() = default; public: JSPlatform(const JSPlatform&) = delete; JSPlatform& operator=(const JSPlatform&) = delete; JSPlatform(JSPlatform&&) = delete; JSPlatform& operator=(JSPlatform&&) = delete; static JSPlatform* Instance(); bool Initialized() const { return m_initialized; } bool Init(std::string argv); }; #endif
23.777778
81
0.700935
366f917c5c580ebd4fcd0b65401b5299321ada13
2,897
h
C
isis/src/base/objs/StripPolygonSeeder/StripPolygonSeeder.h
kdl222/ISIS3
aab0e63088046690e6c031881825596c1c2cc380
[ "CC0-1.0" ]
134
2018-01-18T00:16:24.000Z
2022-03-24T03:53:33.000Z
isis/src/base/objs/StripPolygonSeeder/StripPolygonSeeder.h
kdl222/ISIS3
aab0e63088046690e6c031881825596c1c2cc380
[ "CC0-1.0" ]
3,825
2017-12-11T21:27:34.000Z
2022-03-31T21:45:20.000Z
isis/src/base/objs/StripPolygonSeeder/StripPolygonSeeder.h
jlaura/isis3
2c40e08caed09968ea01d5a767a676172ad20080
[ "CC0-1.0" ]
164
2017-11-30T21:15:44.000Z
2022-03-23T10:22:29.000Z
#ifndef StripPolygonSeeder_h #define StripPolygonSeeder_h /** This is free and unencumbered software released into the public domain. The authors of ISIS do not claim copyright on the contents of this file. For more details about the LICENSE terms and the AUTHORS, you will find files of those names at the top level of this repository. **/ /* SPDX-License-Identifier: CC0-1.0 */ #include "geos/geom/Point.h" #include "geos/geom/MultiPolygon.h" #include "PolygonSeeder.h" namespace Isis { class Pvl; /** * @brief Seed points using a grid with a staggered pattern * * This class seeds the polygon with Control Points by creating a grid, * centered on the overlap polygon. In each grid square two points are checked * to see if they are inside the overlap polygon. One of these points lies 1/6 * of a grid square up and left from the grid's center point, while the other * point lies 1/6 down and right. Each point found that is within the overlap * polygon is returned as a point. * * @ingroup PatternMatching * * @author 2006-01-20 Stuart Sides * * @internal * @history 2007-05-09 Tracie Sucharski, Changed a single spacing value * to a separate value for x and y. * @history 2008-02-29 Steven Lambright - Created SubGrid capabilities, * cleaned up Seed methods * @history 2008-04-17 Steven Lambright - Fixed naming conventions for seeders * @history 2008-08-18 Christopher Austin - Upgraded to geos3.0.0 * @history 2008-11-12 Steven Lambright - Fixed documentation * @history 2008-11-25 Steven Lambright - Added error checking * @history 2009-02-01 Steven Lambright - Fixed problem with calculating * starting position in the top left corner of the polygon * @history 2009-08-05 Travis Addair - Encapsulated group * creation for seed definition group * @history 2010-04-15 Eric Hyer - Now updates parent's invalidInput * variable (see PolygonSeeder) * @history 2010-04-20 Christopher Austin - adapted for generic/unitless * seeding * @history 2010-05-05 Christopher Austin - Fixed major bug where the strip * was not a strip. */ class StripPolygonSeeder : public PolygonSeeder { public: StripPolygonSeeder(Pvl &pvl); //! Destructor virtual ~StripPolygonSeeder() {}; std::vector<geos::geom::Point *> Seed(const geos::geom::MultiPolygon *mp); virtual PvlGroup PluginParameters(QString grpName); protected: virtual void Parse(Pvl &pvl); private: double p_Xspacing; //!<The spacing in the x direction between points double p_Yspacing; //!<The spacing in the y direction between points }; }; #endif
40.236111
82
0.661719
82b67918cd8c564f4b5eff2388c3eb8ee9e909e0
407
h
C
smacc_sm_examples/sm_dance_bot/include/sm_dance_bot/superstate_routines/f_pattern/ssr_fpattern_return_1.h
NEU-ZJX/SMACC
cac82a606a5456194e2ca1e404cf9fef66e78e6e
[ "BSD-3-Clause" ]
null
null
null
smacc_sm_examples/sm_dance_bot/include/sm_dance_bot/superstate_routines/f_pattern/ssr_fpattern_return_1.h
NEU-ZJX/SMACC
cac82a606a5456194e2ca1e404cf9fef66e78e6e
[ "BSD-3-Clause" ]
null
null
null
smacc_sm_examples/sm_dance_bot/include/sm_dance_bot/superstate_routines/f_pattern/ssr_fpattern_return_1.h
NEU-ZJX/SMACC
cac82a606a5456194e2ca1e404cf9fef66e78e6e
[ "BSD-3-Clause" ]
1
2020-04-30T00:10:52.000Z
2020-04-30T00:10:52.000Z
struct SsrFPatternReturn1 : smacc::SmaccState<SsrFPatternReturn1, SS> { using SmaccState::SmaccState; typedef smacc::transition<EvActionSucceded<smacc::SmaccMoveBaseActionClient>, SsrFPatternRotate2> reactions; static void onDefinition() { static_configure<NavigationOrthogonal, SbUndoPathBackwards>(); static_configure<ToolOrthogonal, SbToolStart>(); } void onInitialize() { } };
25.4375
110
0.769042
82d21044097b3da9949dde331ad795ef868df176
3,077
h
C
src/tracks/playabletrack/notetrack/ui/StretchHandle.h
amedayo/audacity
c3aee46a01afb8f8a1f4929f03616af5482e43dd
[ "CC-BY-3.0" ]
null
null
null
src/tracks/playabletrack/notetrack/ui/StretchHandle.h
amedayo/audacity
c3aee46a01afb8f8a1f4929f03616af5482e43dd
[ "CC-BY-3.0" ]
null
null
null
src/tracks/playabletrack/notetrack/ui/StretchHandle.h
amedayo/audacity
c3aee46a01afb8f8a1f4929f03616af5482e43dd
[ "CC-BY-3.0" ]
null
null
null
/********************************************************************** Audacity: A Digital Audio Editor StretchHandle.h Paul Licameli split from TrackPanel.cpp **********************************************************************/ #ifndef __AUDACITY_STRETCH_HANDLE__ #define __AUDACITY_STRETCH_HANDLE__ #include "../../../../UIHandle.h" #include "../../../../MemoryX.h" class Alg_seq; class NoteTrack; class Track; class ViewInfo; class StretchHandle : public UIHandle { public: enum StretchEnum { stretchNone = 0, // false value! stretchLeft, stretchCenter, stretchRight }; // Stretching applies to a selected region after quantizing the // region to beat boundaries (subbeat stretching is not supported, // but maybe it should be enabled with shift or ctrl or something) // Stretching can drag the left boundary (the right stays fixed), // the right boundary (the left stays fixed), or the center (splits // the selection into two parts: when left part grows, the right // part shrinks, keeping the leftmost and rightmost boundaries // fixed. struct StretchState { StretchEnum mMode { stretchCenter }; // remembers what to drag using QuantizedTimeAndBeat = std::pair< double, double >; QuantizedTimeAndBeat mBeatCenter { 0, 0 }; QuantizedTimeAndBeat mBeat0 { 0, 0 }; QuantizedTimeAndBeat mBeat1 { 0, 0 }; double mLeftBeats {}; // how many beats from left to cursor double mRightBeats {}; // how many beats from cursor to right double mOrigSel0Quantized { -1 }, mOrigSel1Quantized { -1 }; }; private: StretchHandle(const StretchHandle&); static HitTestPreview HitPreview(StretchEnum stretchMode, bool unsafe); public: explicit StretchHandle ( const std::shared_ptr<NoteTrack> &pTrack, const StretchState &stretchState ); StretchHandle &operator=(const StretchHandle&) = default; static UIHandlePtr HitTest (std::weak_ptr<StretchHandle> &holder, const TrackPanelMouseState &state, const AudacityProject *pProject, const std::shared_ptr<NoteTrack> &pTrack ); virtual ~StretchHandle(); Result Click (const TrackPanelMouseEvent &event, AudacityProject *pProject) override; Result Drag (const TrackPanelMouseEvent &event, AudacityProject *pProject) override; HitTestPreview Preview (const TrackPanelMouseState &state, const AudacityProject *pProject) override; Result Release (const TrackPanelMouseEvent &event, AudacityProject *pProject, wxWindow *pParent) override; Result Cancel(AudacityProject *pProject) override; bool StopsOnKeystroke() override { return true; } private: static double GetT0(const Track &track, const ViewInfo &viewInfo); static double GetT1(const Track &track, const ViewInfo &viewInfo); void Stretch (AudacityProject *pProject, int mouseXCoordinate, int trackLeftEdge, Track *pTrack); std::shared_ptr<NoteTrack> mpTrack{}; int mLeftEdge{ -1 }; StretchState mStretchState{}; }; #endif
29.304762
90
0.679558
89d7a64f3618a6d1be5ca2eda67436668bca20ed
1,507
h
C
src/Binance/Signer.h
dappstore123/wallet-core
f885df47d4837ae43773447dac58a31713d90d67
[ "MIT" ]
7
2019-05-29T02:56:59.000Z
2021-08-31T16:58:29.000Z
src/Binance/Signer.h
dappstore123/wallet-core
f885df47d4837ae43773447dac58a31713d90d67
[ "MIT" ]
2
2019-08-31T22:56:54.000Z
2021-08-10T12:07:44.000Z
src/Binance/Signer.h
dappstore123/wallet-core
f885df47d4837ae43773447dac58a31713d90d67
[ "MIT" ]
5
2020-03-07T14:54:39.000Z
2021-09-25T03:27:31.000Z
// Copyright © 2017-2019 Trust Wallet. // // This file is part of Trust. The full Trust copyright notice, including // terms governing use, modification, and redistribution, is contained in the // file LICENSE at the root of the source code distribution tree. #pragma once #include "../proto/Binance.pb.h" #include <cstdint> #include <vector> namespace TW::Binance { /// Helper class that performs Binance transaction signing. class Signer { public: Proto::SigningInput input; /// Initializes a transaction signer. explicit Signer(Proto::SigningInput&& input) : input(input) {} /// Builds a signed transaction. /// /// \returns the signed transaction data or an empty vector if there is an /// error. std::vector<uint8_t> build() const; /// Signs the transaction. /// /// \returns the transaction signature or an empty vector if there is an /// error. std::vector<uint8_t> sign() const; private: std::string signaturePreimage() const; std::vector<uint8_t> encodeTransaction(const std::vector<uint8_t>& signature) const; std::vector<uint8_t> encodeOrder() const; std::vector<uint8_t> encodeSignature(const std::vector<uint8_t>& signature) const; std::vector<uint8_t> aminoWrap(const std::string& raw, const std::vector<uint8_t>& typePrefix, bool isPrefixLength) const; }; } // namespace TW::Binance /// Wrapper for C interface. struct TWBinanceSigner { TW::Binance::Signer impl; };
29.54902
98
0.684804
d2a1eddc81904497f800c6553981231d653d6da3
5,446
h
C
cwp/include/tencentcloud/cwp/v20180228/model/WeeklyReportBruteAttack.h
sinjoywong/tencentcloud-sdk-cpp
1b931d20956a90b15a6720f924e5c69f8786f9f4
[ "Apache-2.0" ]
null
null
null
cwp/include/tencentcloud/cwp/v20180228/model/WeeklyReportBruteAttack.h
sinjoywong/tencentcloud-sdk-cpp
1b931d20956a90b15a6720f924e5c69f8786f9f4
[ "Apache-2.0" ]
null
null
null
cwp/include/tencentcloud/cwp/v20180228/model/WeeklyReportBruteAttack.h
sinjoywong/tencentcloud-sdk-cpp
1b931d20956a90b15a6720f924e5c69f8786f9f4
[ "Apache-2.0" ]
null
null
null
/* * Copyright (c) 2017-2019 THL A29 Limited, a Tencent company. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef TENCENTCLOUD_CWP_V20180228_MODEL_WEEKLYREPORTBRUTEATTACK_H_ #define TENCENTCLOUD_CWP_V20180228_MODEL_WEEKLYREPORTBRUTEATTACK_H_ #include <string> #include <vector> #include <map> #include <tencentcloud/core/utils/rapidjson/document.h> #include <tencentcloud/core/utils/rapidjson/writer.h> #include <tencentcloud/core/utils/rapidjson/stringbuffer.h> #include <tencentcloud/core/AbstractModel.h> namespace TencentCloud { namespace Cwp { namespace V20180228 { namespace Model { /** * 专业周报密码破解数据。 */ class WeeklyReportBruteAttack : public AbstractModel { public: WeeklyReportBruteAttack(); ~WeeklyReportBruteAttack() = default; void ToJsonObject(rapidjson::Value &value, rapidjson::Document::AllocatorType& allocator) const; CoreInternalOutcome Deserialize(const rapidjson::Value &value); /** * 获取主机IP。 * @return MachineIp 主机IP。 */ std::string GetMachineIp() const; /** * 设置主机IP。 * @param MachineIp 主机IP。 */ void SetMachineIp(const std::string& _machineIp); /** * 判断参数 MachineIp 是否已赋值 * @return MachineIp 是否已赋值 */ bool MachineIpHasBeenSet() const; /** * 获取被破解用户名。 * @return Username 被破解用户名。 */ std::string GetUsername() const; /** * 设置被破解用户名。 * @param Username 被破解用户名。 */ void SetUsername(const std::string& _username); /** * 判断参数 Username 是否已赋值 * @return Username 是否已赋值 */ bool UsernameHasBeenSet() const; /** * 获取源IP。 * @return SrcIp 源IP。 */ std::string GetSrcIp() const; /** * 设置源IP。 * @param SrcIp 源IP。 */ void SetSrcIp(const std::string& _srcIp); /** * 判断参数 SrcIp 是否已赋值 * @return SrcIp 是否已赋值 */ bool SrcIpHasBeenSet() const; /** * 获取尝试次数。 * @return Count 尝试次数。 */ uint64_t GetCount() const; /** * 设置尝试次数。 * @param Count 尝试次数。 */ void SetCount(const uint64_t& _count); /** * 判断参数 Count 是否已赋值 * @return Count 是否已赋值 */ bool CountHasBeenSet() const; /** * 获取攻击时间。 * @return AttackTime 攻击时间。 */ std::string GetAttackTime() const; /** * 设置攻击时间。 * @param AttackTime 攻击时间。 */ void SetAttackTime(const std::string& _attackTime); /** * 判断参数 AttackTime 是否已赋值 * @return AttackTime 是否已赋值 */ bool AttackTimeHasBeenSet() const; private: /** * 主机IP。 */ std::string m_machineIp; bool m_machineIpHasBeenSet; /** * 被破解用户名。 */ std::string m_username; bool m_usernameHasBeenSet; /** * 源IP。 */ std::string m_srcIp; bool m_srcIpHasBeenSet; /** * 尝试次数。 */ uint64_t m_count; bool m_countHasBeenSet; /** * 攻击时间。 */ std::string m_attackTime; bool m_attackTimeHasBeenSet; }; } } } } #endif // !TENCENTCLOUD_CWP_V20180228_MODEL_WEEKLYREPORTBRUTEATTACK_H_
30.595506
116
0.418472
d07dc8cd86bd2a83b99c96ac8c86080403da47c1
241
h
C
chapter-5-symbol-table/value.h
ShaneDean/ooc
6f841fdfb0211fe0bc106514d36ddaac4a8bf865
[ "MIT" ]
null
null
null
chapter-5-symbol-table/value.h
ShaneDean/ooc
6f841fdfb0211fe0bc106514d36ddaac4a8bf865
[ "MIT" ]
null
null
null
chapter-5-symbol-table/value.h
ShaneDean/ooc
6f841fdfb0211fe0bc106514d36ddaac4a8bf865
[ "MIT" ]
null
null
null
#ifndef VALUE_H #define VALUE_H const void *Minus; const void *Value; const void *Mult; const void *Div; const void *Add; const void *Sub; void *new (const void *type, ...); void process(const void *tree); void delete (void *tree); #endif
16.066667
34
0.705394
655bffbd55c0b10737f79e09ff6e995128e85730
7,053
c
C
suricata-3.2/src/util-cpu.c
wenze1367/suricata-3.2-read-anotaion
0c63a9a4ed1b7654cc74490a9748eb3e33951952
[ "BSD-2-Clause" ]
1
2021-11-26T08:12:42.000Z
2021-11-26T08:12:42.000Z
suricata-3.2/src/util-cpu.c
wenze1367/suricata-3.2-read-anotaion
0c63a9a4ed1b7654cc74490a9748eb3e33951952
[ "BSD-2-Clause" ]
null
null
null
suricata-3.2/src/util-cpu.c
wenze1367/suricata-3.2-read-anotaion
0c63a9a4ed1b7654cc74490a9748eb3e33951952
[ "BSD-2-Clause" ]
1
2021-11-26T08:12:47.000Z
2021-11-26T08:12:47.000Z
/* Copyright (C) 2007-2013 Open Information Security Foundation * * You can copy, redistribute or modify this Program under the terms of * the GNU General Public License version 2 as published by the Free * Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * version 2 along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 02110-1301, USA. */ /** * \file * * \author Pablo Rincon Crespo <pablo.rincon.crespo@gmail.com> * * Retrieve CPU information (configured CPUs, online CPUs) */ #include "suricata-common.h" #include "util-error.h" #include "util-debug.h" /** * Ok, if they should use sysconf, check that they have the macro's * (syscalls) defined; * * Note: For windows it's different; Check the following: * SYSTEM_INFO info; * GetSystemInfo(&info); * -> info.dwNumberOfProcessors; */ #ifdef _SC_NPROCESSORS_CONF #define SYSCONF_NPROCESSORS_CONF_COMPAT #endif #ifdef _SC_NPROCESSORS_ONLN #define SYSCONF_NPROCESSORS_ONLN_COMPAT #endif /* This one is available on Solaris 10 */ #ifdef _SC_NPROCESSORS_MAX #define SYSCONF_NPROCESSORS_MAX_COMPAT #endif /** * \brief Get the number of cpus configured in the system * \retval 0 if the syscall is not available or we have an error; * otherwise it will return the number of cpus configured */ uint16_t UtilCpuGetNumProcessorsConfigured() { #ifdef SYSCONF_NPROCESSORS_CONF_COMPAT long nprocs = -1; nprocs = sysconf(_SC_NPROCESSORS_CONF); if (nprocs < 1) { SCLogError(SC_ERR_SYSCALL, "Couldn't retrieve the number of cpus " "configured (%s)", strerror(errno)); return 0; } if (nprocs > UINT16_MAX) { SCLogDebug("It seems that there are more than %"PRIu16" CPUs " "configured on this system. You can modify util-cpu.{c,h} " "to use uint32_t to support it", UINT16_MAX); return UINT16_MAX; } return (uint16_t)nprocs; #elif OS_WIN32 long nprocs = -1; const char* envvar = getenv("NUMBER_OF_PROCESSORS"); nprocs = (NULL != envvar) ? atoi(envvar) : 0; if (nprocs < 1) { SCLogError(SC_ERR_SYSCALL, "Couldn't retrieve the number of cpus " "configured from the NUMBER_OF_PROCESSORS environment variable"); return 0; } return (uint16_t)nprocs; #else SCLogError(SC_ERR_SYSCONF, "Couldn't retrieve the number of cpus " "configured, sysconf macro unavailable"); return 0; #endif } /** * \brief Get the number of cpus online in the system * \retval 0 if the syscall is not available or we have an error; * otherwise it will return the number of cpus online */ uint16_t UtilCpuGetNumProcessorsOnline() { #ifdef SYSCONF_NPROCESSORS_ONLN_COMPAT long nprocs = -1; nprocs = sysconf(_SC_NPROCESSORS_ONLN); if (nprocs < 1) { SCLogError(SC_ERR_SYSCALL, "Couldn't retrieve the number of cpus " "online (%s)", strerror(errno)); return 0; } if (nprocs > UINT16_MAX) { SCLogDebug("It seems that there are more than %"PRIu16" CPUs online. " "You can modify util-cpu.{c,h} to use uint32_t to " "support it", UINT16_MAX); return UINT16_MAX; } return nprocs; #elif OS_WIN32 return UtilCpuGetNumProcessorsConfigured(); #else SCLogError(SC_ERR_SYSCONF, "Couldn't retrieve the number of cpus online, " "synconf macro unavailable"); return 0; #endif } /** * \brief Get the maximum number of cpus allowed in the system * This syscall is present on Solaris, but it's not on linux * or macosx. Maybe you should look at UtilCpuGetNumProcessorsConfigured() * \retval 0 if the syscall is not available or we have an error; * otherwise it will return the number of cpus allowed */ uint16_t UtilCpuGetNumProcessorsMax() { #ifdef SYSCONF_NPROCESSORS_MAX_COMPAT long nprocs = -1; nprocs = sysconf(_SC_NPROCESSORS_MAX); if (nprocs < 1) { SCLogError(SC_ERR_SYSCALL, "Couldn't retrieve the maximum number of cpus " "allowed by the system (%s)", strerror(errno)); return 0; } if (nprocs > UINT16_MAX) { SCLogDebug("It seems that the system support more that %"PRIu16" CPUs. You " "can modify util-cpu.{c,h} to use uint32_t to support it", UINT16_MAX); return UINT16_MAX; } return (uint16_t)nprocs; #else SCLogError(SC_ERR_SYSCONF, "Couldn't retrieve the maximum number of cpus allowed by " "the system, synconf macro unavailable"); return 0; #endif } /** * \brief Print a summary of CPUs detected (configured and online) */ void UtilCpuPrintSummary() { uint16_t cpus_conf = UtilCpuGetNumProcessorsConfigured(); uint16_t cpus_online = UtilCpuGetNumProcessorsOnline(); SCLogDebug("CPUs Summary: "); if (cpus_conf > 0) SCLogDebug("CPUs configured: %"PRIu16, cpus_conf); if (cpus_online > 0) SCLogInfo("CPUs/cores online: %"PRIu16, cpus_online); if (cpus_online == 0 && cpus_conf == 0) SCLogInfo("Couldn't retireve any information of CPU's, please, send your operating " "system info and check util-cpu.{c,h}"); } /** * Get the current number of ticks from the CPU. * * \todo We'll have to deal with removig ticks from the extra cpuids inbetween * 2 calls. */ #if defined(__tile__) #include <arch/cycle.h> uint64_t UtilCpuGetTicks(void) { return get_cycle_count(); } #else uint64_t UtilCpuGetTicks(void) { uint64_t val; #if defined(__GNUC__) && (defined(__x86_64) || defined(_X86_64_) || defined(ia_64) || defined(__i386__)) #if defined(__x86_64) || defined(_X86_64_) || defined(ia_64) __asm__ __volatile__ ( "xorl %%eax,%%eax\n\t" "cpuid\n\t" ::: "%rax", "%rbx", "%rcx", "%rdx"); #else __asm__ __volatile__ ( "xorl %%eax,%%eax\n\t" "pushl %%ebx\n\t" "cpuid\n\t" "popl %%ebx\n\t" ::: "%eax", "%ecx", "%edx"); #endif uint32_t a, d; __asm__ __volatile__ ("rdtsc" : "=a" (a), "=d" (d)); val = ((uint64_t)a) | (((uint64_t)d) << 32); #if defined(__x86_64) || defined(_X86_64_) || defined(ia_64) __asm__ __volatile__ ( "xorl %%eax,%%eax\n\t" "cpuid\n\t" ::: "%rax", "%rbx", "%rcx", "%rdx"); #else __asm__ __volatile__ ( "xorl %%eax,%%eax\n\t" "pushl %%ebx\n\t" "cpuid\n\t" "popl %%ebx\n\t" ::: "%eax", "%ecx", "%edx"); #endif #else /* #if defined(__GNU__) */ //#warning Using inferior version of UtilCpuGetTicks struct timeval now; gettimeofday(&now, NULL); val = (now.tv_sec * 1000000) + now.tv_usec; #endif return val; } #endif /* __tile__ */
30.400862
104
0.654473
45734b08aa3bd7be4e9290d84266e25bbac0f497
1,221
h
C
c/bindings/message.h
ttyangf/mojo
ca344f878ae23db0289644d78d58aa4b77108e08
[ "BSD-3-Clause" ]
null
null
null
c/bindings/message.h
ttyangf/mojo
ca344f878ae23db0289644d78d58aa4b77108e08
[ "BSD-3-Clause" ]
null
null
null
c/bindings/message.h
ttyangf/mojo
ca344f878ae23db0289644d78d58aa4b77108e08
[ "BSD-3-Clause" ]
null
null
null
// Copyright 2016 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef MOJO_PUBLIC_C_BINDINGS_MESSAGE_H_ #define MOJO_PUBLIC_C_BINDINGS_MESSAGE_H_ #include <stdbool.h> #include <stddef.h> #include <stdint.h> #include "mojo/public/c/bindings/struct.h" // These bits may be set in the |flags| field of a Mojo message header. #define MOJO_MESSAGE_HEADER_FLAGS_EXPECTS_RESPONSE (1 << 0u) #define MOJO_MESSAGE_HEADER_FLAGS_IS_RESPONSE (1 << 1u) #ifdef __cplusplus extern "C" { #endif // Validates that the buffer started at a (validated) mojo_struct_header with a // given size contains a valid mojo message header. bool mojo_validate_message_header(const mojo_struct_header_t* header, size_t size); typedef struct mojo_message_header { mojo_struct_header_t struct_header; uint32_t name; uint32_t flags; } mojo_message_header_t; typedef struct mojo_message_header_with_request_id { mojo_message_header_t message_header; uint64_t request_id; } mojo_message_header_with_request_id_t; #ifdef __cplusplus } // extern "C" #endif #endif // MOJO_PUBLIC_C_BINDINGS_MESSAGE_H_
28.395349
79
0.776413
805ea4af3aab302936902e463323d7db206e49a1
6,790
c
C
usd/heap.c
poftwaresatent/dtrans
eba834e1b0d7d7b28c69dfeafde7cf139c29ad45
[ "BSD-3-Clause" ]
1
2020-04-09T10:15:00.000Z
2020-04-09T10:15:00.000Z
usd/heap.c
poftwaresatent/dtrans
eba834e1b0d7d7b28c69dfeafde7cf139c29ad45
[ "BSD-3-Clause" ]
null
null
null
usd/heap.c
poftwaresatent/dtrans
eba834e1b0d7d7b28c69dfeafde7cf139c29ad45
[ "BSD-3-Clause" ]
null
null
null
/* * Copyright (c) 2012 Roland Philippsen <roland DOT philippsen AT gmx DOT net> * * BSD license: * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. Neither the name of the copyright holder nor the names of * contributors to this software may be used to endorse or promote * products derived from this software without specific prior written * permission. * * THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT * HOLDER OR THE CONTRIBUTORS TO THIS SOFTWARE BE LIABLE FOR ANY * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include "heap.h" #include <string.h> double heap_keycmp_more (double lhs, double rhs) { return lhs - rhs; } double heap_keycmp_less (double lhs, double rhs) { return rhs - lhs; } heap_t * heap_create (size_t capacity, heap_keycmp_t keycmp) { heap_t * heap; if ( ! (heap = calloc (capacity + 1, sizeof(heap_t)))) { goto fail_heap; } if ( ! (heap->key = calloc (capacity + 1, sizeof(double)))) { goto fail_key; } if ( ! (heap->value = calloc (capacity + 1, sizeof(void*)))) { goto fail_value; } heap->keycmp = keycmp; heap->capacity = capacity; heap->length = 0; return heap; fail_value: free (heap->key); fail_key: free (heap); fail_heap: return NULL; } heap_t * heap_clone (heap_t * heap) { heap_t * clone; if ( ! (clone = heap_create (heap->length, heap->keycmp))) { return NULL; } clone->length = heap->length; memcpy (clone->key + 1, heap->key + 1, heap->length * sizeof(double)); memcpy (clone->value + 1, heap->value + 1, heap->length * sizeof(void*)); return clone; } heap_t * maxheap_create (size_t capacity) { return heap_create (capacity, heap_keycmp_more); } heap_t * minheap_create (size_t capacity) { return heap_create (capacity, heap_keycmp_less); } void heap_destroy (heap_t * heap) { free (heap->value); free (heap->key); free (heap); } int heap_grow (heap_t * heap) { double * kk; void * vv; size_t cc; cc = heap->capacity * 2 + 1; /* one extra element at the beginning... */ if ( ! (kk = realloc (heap->key, cc * sizeof(double)))) { return -1; } if ( ! (vv = realloc (heap->value, cc * sizeof(void*)))) { #warning 'I think there is a memleak here.' return -1; } heap->capacity = cc - 1; /* remember to remove the +1 for the extra element */ heap->key = kk; heap->value = vv; return 0; } void heap_swap (heap_t * heap, size_t ii, size_t jj) { double kk; const void * vv; kk = heap->key[ii]; vv = heap->value[ii]; heap->key[ii] = heap->key[jj]; heap->value[ii] = heap->value[jj]; heap->key[jj] = kk; heap->value[jj] = vv; } void heap_bubble_up (heap_t * heap, size_t index) { size_t parent; parent = index / 2; while ((parent > 0) && (heap->keycmp(heap->key[index], heap->key[parent]) > 0.0)) { heap_swap (heap, index, parent); index = parent; parent = index / 2; } } int heap_insert (heap_t * heap, double key, const void * value) { if (heap->length == heap->capacity) { if (0 != heap_grow (heap)) { return -1; } } ++heap->length; /* remember, arrays start at index 1 to simplify arithmetic */ heap->key[heap->length] = key; heap->value[heap->length] = value; heap_bubble_up (heap, heap->length); return 0; } size_t heap_find_element (heap_t * heap, double key, const void * value, size_t root) { size_t subtree, guess; if (root > heap->length) { return 0; /* out of bounds */ } if (heap->keycmp(heap->key[root], key) < 0.0) { return 0; /* key cannot be in this subtree due to heap property */ } if ((heap->key[root] == key) && (heap->value[root] == value)) { return root; /* found */ } subtree = 2 * root; guess = heap_find_element (heap, key, value, subtree); if (0 != guess) { return guess; /* found in left subtree */ } ++subtree; return heap_find_element (heap, key, value, subtree); /* try right subtree */ } int heap_change_key (heap_t * heap, double old_key, double new_key, const void * value) { size_t index; index = heap_find_element (heap, old_key, value, 1); if (0 == index) { return -1; /* no such element */ } if (heap->keycmp == heap_keycmp_more) { /* this is a max heap */ heap->key[index] = new_key; if (new_key > old_key) { heap_bubble_up (heap, index); } else if (new_key < old_key) { heap_bubble_down (heap, index); } /* else no change */ return 0; } else if (heap->keycmp == heap_keycmp_less) { /* this is a min heap */ heap->key[index] = new_key; if (new_key < old_key) { heap_bubble_up (heap, index); } else if (new_key > old_key) { heap_bubble_down (heap, index); } /* else no change */ return 0; } /* else this is an unsopprted kind of heap */ return -2; } void heap_bubble_down (heap_t * heap, size_t index) { size_t left, right, target; target = index; for (;;) { left = 2 * index; right = left + 1; if ((left <= heap->length) && (heap->keycmp(heap->key[left], heap->key[target]) > 0.0)) { target = left; } if ((right <= heap->length) && (heap->keycmp(heap->key[right], heap->key[target]) > 0.0)) { target = right; } if (target == index) { return; } heap_swap (heap, target, index); index = target; } } void * heap_pop (heap_t * heap) { const void * vv; if (0 == heap->length) { return NULL; } vv = heap->value[1]; heap->key[1] = heap->key[heap->length]; heap->value[1] = heap->value[heap->length]; --heap->length; heap_bubble_down (heap, 1); return (void*) vv; }
24.25
87
0.632253
a10a92d078618a7023f1639340f5cc01e592bcb0
840
h
C
tools/ifaceed/ifaceed/core/typeconverters/qstringtosadstring.h
mamontov-cpp/saddy
f20a0030e18af9e0714fe56c19407fbeacc529a7
[ "BSD-2-Clause" ]
58
2015-08-09T14:56:35.000Z
2022-01-15T22:06:58.000Z
tools/ifaceed/ifaceed/core/typeconverters/qstringtosadstring.h
mamontov-cpp/saddy-graphics-engine-2d
e25a6637fcc49cb26614bf03b70e5d03a3a436c7
[ "BSD-2-Clause" ]
245
2015-08-08T08:44:22.000Z
2022-01-04T09:18:08.000Z
tools/ifaceed/ifaceed/core/typeconverters/qstringtosadstring.h
mamontov-cpp/saddy
f20a0030e18af9e0714fe56c19407fbeacc529a7
[ "BSD-2-Clause" ]
23
2015-12-06T03:57:49.000Z
2020-10-12T14:15:50.000Z
/*! \file qstringtosadstring.h Defines a converter from QString to sad::String, used in conversion table */ #pragma once #include <QString> #include <sadstring.h> #include <db/dbconversiontable.h> namespace core { namespace typeconverters { /*! Defines a conversion from QString to sad::String */ class QStringToSadString: public sad::db::AbstractTypeConverter { public: /*! Creates new converter */ inline QStringToSadString() = default; /*! Converts source value from another and to another type \param[in] source a pointer to sad::String value \param[in] dest a pointer to QString value */ virtual void convert(void * source, void * dest) override; /*! Can be inherited */ virtual ~QStringToSadString() override; }; } }
20.487805
78
0.64881
316ba3484bd3cc2642c6ccd2939641d0bfcc7d81
1,112
h
C
include/cr_timer.h
raptoravis/cr19
4f5e7a1d44aadbb75160e64563e53c418cd330a6
[ "MIT" ]
1
2015-04-30T14:18:45.000Z
2015-04-30T14:18:45.000Z
include/cr_timer.h
raptoravis/cr19
4f5e7a1d44aadbb75160e64563e53c418cd330a6
[ "MIT" ]
null
null
null
include/cr_timer.h
raptoravis/cr19
4f5e7a1d44aadbb75160e64563e53c418cd330a6
[ "MIT" ]
null
null
null
#ifndef CR_TIMER_H #define CR_TIMER_H #ifndef WINDOWS #include <sys/time.h> #if defined (IRIX) || defined( IRIX64 ) typedef unsigned long long iotimer64_t; typedef unsigned int iotimer32_t; #endif #else #include <windows.h> #endif #ifdef __cplusplus extern "C" { #endif typedef struct Timer { double time0, elapsed; char running; int fd; #if defined (IRIX) || defined( IRIX64 ) unsigned long long counter64; unsigned int counter32; unsigned int cycleval; volatile iotimer64_t *iotimer_addr64; volatile iotimer32_t *iotimer_addr32; void *unmapLocation; int unmapSize; #elif defined(WINDOWS) LARGE_INTEGER performance_counter, performance_frequency; double one_over_frequency; #elif defined( Linux ) || defined( FreeBSD ) || defined(DARWIN) || defined(AIX) || defined (SunOS) || defined(OSF1) struct timeval timeofday; #endif } CRTimer; CRTimer *crTimerNewTimer( void ); void crDestroyTimer( CRTimer *t ); void crStartTimer( CRTimer *t ); void crStopTimer( CRTimer *t ); void crResetTimer( CRTimer *t ); double crTimerTime( CRTimer *t ); #ifdef __cplusplus } #endif #endif /* CR_TIMER_H */
20.218182
115
0.748201
0c18a9088c53ad078b2e15f6062ea11376783c9a
5,863
c
C
deps/picotls/t/minicrypto.c
VidAngel/h2o
23c46e5f9849284ff185dfdbb29c85a4e45ca396
[ "MIT" ]
3
2019-12-07T00:53:29.000Z
2019-12-10T05:09:35.000Z
deps/picotls/t/minicrypto.c
VidAngel/h2o
23c46e5f9849284ff185dfdbb29c85a4e45ca396
[ "MIT" ]
16
2019-03-08T08:38:05.000Z
2019-04-30T08:35:33.000Z
deps/picotls/t/minicrypto.c
VidAngel/h2o
23c46e5f9849284ff185dfdbb29c85a4e45ca396
[ "MIT" ]
4
2018-07-09T23:41:22.000Z
2021-03-19T22:32:42.000Z
/* * Copyright (c) 2016 DeNA Co., Ltd., Kazuho Oku * * 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 _XOPEN_SOURCE #define _XOPEN_SOURCE 700 /* required for glibc to use getaddrinfo, etc. */ #endif #include <assert.h> #include <stdio.h> #include <string.h> #include "../deps/picotest/picotest.h" #include "../lib/cifra.c" #include "../lib/uecc.c" #include "test.h" static void test_secp256r1_key_exchange(void) { test_key_exchange(&ptls_minicrypto_secp256r1); } static void test_x25519_key_exchange(void) { test_key_exchange(&ptls_minicrypto_x25519); } static void test_secp256r1_sign(void) { const char *msg = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdef"; ptls_minicrypto_secp256r1sha256_sign_certificate_t signer = {{secp256r1sha256_sign}}; uint8_t pub[SECP256R1_PUBLIC_KEY_SIZE]; uint16_t selected; ptls_buffer_t sigbuf; uint32_t sigbuf_small[128]; uECC_make_key(pub, signer.key, uECC_secp256r1()); ptls_buffer_init(&sigbuf, sigbuf_small, sizeof(sigbuf_small)); ok(secp256r1sha256_sign(&signer.super, NULL, &selected, &sigbuf, ptls_iovec_init(msg, 32), (uint16_t[]){PTLS_SIGNATURE_ECDSA_SECP256R1_SHA256}, 1) == 0); ok(selected == PTLS_SIGNATURE_ECDSA_SECP256R1_SHA256); /* FIXME verify sign */ ptls_buffer_dispose(&sigbuf); } static void test_hrr(void) { ptls_key_exchange_algorithm_t *client_keyex[] = {&ptls_minicrypto_x25519, &ptls_minicrypto_secp256r1, NULL}; ptls_context_t client_ctx = {ptls_minicrypto_random_bytes, &ptls_get_time, client_keyex, ptls_minicrypto_cipher_suites}; ptls_t *client, *server; ptls_buffer_t cbuf, sbuf, decbuf; uint8_t cbuf_small[16384], sbuf_small[16384], decbuf_small[16384]; size_t consumed; int ret; assert(ctx_peer->key_exchanges[0] != NULL && ctx_peer->key_exchanges[0]->id == PTLS_GROUP_SECP256R1); assert(ctx_peer->key_exchanges[1] == NULL); client = ptls_new(&client_ctx, 0); server = ptls_new(ctx_peer, 1); ptls_buffer_init(&cbuf, cbuf_small, sizeof(cbuf_small)); ptls_buffer_init(&sbuf, sbuf_small, sizeof(sbuf_small)); ptls_buffer_init(&decbuf, decbuf_small, sizeof(decbuf_small)); ret = ptls_handshake(client, &cbuf, NULL, NULL, NULL); ok(ret == PTLS_ERROR_IN_PROGRESS); consumed = cbuf.off; ret = ptls_handshake(server, &sbuf, cbuf.base, &consumed, NULL); ok(ret == PTLS_ERROR_IN_PROGRESS); ok(consumed == cbuf.off); cbuf.off = 0; ok(sbuf.off > 5 + 4); ok(sbuf.base[5] == 2 /* PTLS_HANDSHAKE_TYPE_SERVER_HELLO (RETRY_REQUEST) */); consumed = sbuf.off; ret = ptls_handshake(client, &cbuf, sbuf.base, &consumed, NULL); ok(ret == PTLS_ERROR_IN_PROGRESS); ok(consumed == sbuf.off); sbuf.off = 0; ok(cbuf.off >= 5 + 4); ok(cbuf.base[5] == 1 /* PTLS_HANDSHAKE_TYPE_CLIENT_HELLO */); consumed = cbuf.off; ret = ptls_handshake(server, &sbuf, cbuf.base, &consumed, NULL); ok(ret == 0); ok(consumed == cbuf.off); cbuf.off = 0; ok(sbuf.off >= 5 + 4); ok(sbuf.base[5] == 2 /* PTLS_HANDSHAKE_TYPE_SERVER_HELLO */); consumed = sbuf.off; ret = ptls_handshake(client, &cbuf, sbuf.base, &consumed, NULL); ok(ret == 0); ok(consumed == sbuf.off); sbuf.off = 0; ret = ptls_send(client, &cbuf, "hello world", 11); ok(ret == 0); consumed = cbuf.off; ret = ptls_receive(server, &decbuf, cbuf.base, &consumed); ok(ret == 0); ok(consumed == cbuf.off); cbuf.off = 0; ok(decbuf.off == 11); ok(memcmp(decbuf.base, "hello world", 11) == 0); ptls_buffer_dispose(&decbuf); ptls_buffer_dispose(&sbuf); ptls_buffer_dispose(&cbuf); ptls_free(client); ptls_free(server); } int main(int argc, char **argv) { subtest("secp256r1", test_secp256r1_key_exchange); subtest("x25519", test_x25519_key_exchange); subtest("secp256r1-sign", test_secp256r1_sign); ptls_iovec_t cert = ptls_iovec_init(SECP256R1_CERTIFICATE, sizeof(SECP256R1_CERTIFICATE) - 1); ptls_minicrypto_secp256r1sha256_sign_certificate_t sign_certificate; ptls_minicrypto_init_secp256r1sha256_sign_certificate(&sign_certificate, ptls_iovec_init(SECP256R1_PRIVATE_KEY, SECP256R1_PRIVATE_KEY_SIZE)); ptls_context_t ctxbuf = {ptls_minicrypto_random_bytes, &ptls_get_time, ptls_minicrypto_key_exchanges, ptls_minicrypto_cipher_suites, {&cert, 1}, NULL, NULL, &sign_certificate.super}; ctx = ctx_peer = &ctxbuf; subtest("picotls", test_picotls); subtest("hrr", test_hrr); return done_testing(); return done_testing(); }
35.319277
126
0.68088
bd4cd8fb21a71ad4c756db45e9032e9ad94cb48d
346
c
C
c-intro-gb/C8.c
andreitsy/problem-solutions
366423ae1976bbf2d2d24934a439e7bc23c84b1a
[ "MIT" ]
null
null
null
c-intro-gb/C8.c
andreitsy/problem-solutions
366423ae1976bbf2d2d24934a439e7bc23c84b1a
[ "MIT" ]
null
null
null
c-intro-gb/C8.c
andreitsy/problem-solutions
366423ae1976bbf2d2d24934a439e7bc23c84b1a
[ "MIT" ]
null
null
null
#include <stdio.h> #define MAX_LENGTH 1000 char to_upper_f(char x) { if ((x >= 97) && (x <= 122)) { return x - 32; } else { return x; } } int main() { char c, str[MAX_LENGTH] = {'\0'}; int i = 0; while((c = getchar()) != '.') { str[i] = to_upper_f(c); i++; } printf("%s", str); }
16.47619
37
0.436416
bd966a59b8d4aa687864eaf657c06cc296102699
1,604
h
C
qemu/linux-user/hppa/target_fcntl.h
WUSTL-CSPL/RT-TEE
aafb3e9ff6c6e744c6bce1e42bcb198e1063efcc
[ "MIT" ]
55
2019-12-20T03:25:14.000Z
2022-01-16T07:19:47.000Z
qemu/linux-user/hppa/target_fcntl.h
WUSTL-CSPL/RT-TEE
aafb3e9ff6c6e744c6bce1e42bcb198e1063efcc
[ "MIT" ]
3
2021-07-27T19:36:05.000Z
2021-12-31T02:20:53.000Z
qemu/linux-user/hppa/target_fcntl.h
WUSTL-CSPL/RT-TEE
aafb3e9ff6c6e744c6bce1e42bcb198e1063efcc
[ "MIT" ]
11
2020-08-06T03:59:45.000Z
2022-02-25T02:31:59.000Z
/* * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as * published by the Free Software Foundation, or (at your option) any * later version. See the COPYING file in the top-level directory. */ #ifndef HPPA_TARGET_FCNTL_H #define HPPA_TARGET_FCNTL_H #define TARGET_O_NONBLOCK 000200004 /* HPUX has separate NDELAY & NONBLOCK */ #define TARGET_O_APPEND 000000010 #define TARGET_O_CREAT 000000400 /* not fcntl */ #define TARGET_O_EXCL 000002000 /* not fcntl */ #define TARGET_O_NOCTTY 000400000 /* not fcntl */ #define TARGET_O_DSYNC 001000000 #define TARGET_O_LARGEFILE 000004000 #define TARGET_O_DIRECTORY 000010000 /* must be a directory */ #define TARGET_O_NOFOLLOW 000000200 /* don't follow links */ #define TARGET_O_NOATIME 004000000 #define TARGET_O_CLOEXEC 010000000 #define TARGET___O_SYNC 000100000 #define TARGET_O_PATH 020000000 #define TARGET_F_RDLCK 1 #define TARGET_F_WRLCK 2 #define TARGET_F_UNLCK 3 #define TARGET_F_GETLK64 8 /* using 'struct flock64' */ #define TARGET_F_SETLK64 9 #define TARGET_F_SETLKW64 10 #define TARGET_F_GETLK 5 #define TARGET_F_SETLK 6 #define TARGET_F_SETLKW 7 #define TARGET_F_GETOWN 11 /* for sockets. */ #define TARGET_F_SETOWN 12 /* for sockets. */ #define TARGET_F_SETSIG 13 /* for sockets. */ #define TARGET_F_GETSIG 14 /* for sockets. */ #include "../generic/fcntl.h" #endif
37.302326
80
0.695761
64717049588c67a447a1d7ac05ea34c18bf01929
54,966
c
C
common/mbeprom.c
luvitred/dallas-sdk
fa2d7aedf79d5977dfadd63696a2a753640ab7a0
[ "MIT" ]
null
null
null
common/mbeprom.c
luvitred/dallas-sdk
fa2d7aedf79d5977dfadd63696a2a753640ab7a0
[ "MIT" ]
null
null
null
common/mbeprom.c
luvitred/dallas-sdk
fa2d7aedf79d5977dfadd63696a2a753640ab7a0
[ "MIT" ]
null
null
null
//--------------------------------------------------------------------------- // Copyright (C) 2000 Dallas Semiconductor Corporation, All Rights Reserved. // // 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 DALLAS SEMICONDUCTOR 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. // // Except as contained in this notice, the name of Dallas Semiconductor // shall not be used except as stated in the Dallas Semiconductor // Branding Policy. //--------------------------------------------------------------------------- // // mbEPROM.c - Include memory bank EPROM functions. // // Version: 2.10 // // Include Files #include "ownet.h" #include "mbeprom.h" // general command defines #define READ_MEMORY_COMMAND_EPROM 0xF0 #define MAIN_READ_PAGE_COMMAND_EPROM 0xA5 #define STATUS_READ_PAGE_COMMAND_EPROM 0xAA #define MAIN_WRITE_COMMAND_EPROM 0x0F #define STATUS_WRITE_COMMAND_EPROM 0x55 // Local defines #define SIZE_EPROM 2048 #define PAGE_LENGTH_EPROM 32 // Global variables char *bankDescription_eprom = "Main Memory"; SMALLINT writeVerification_eprom = TRUE; SMALLINT generalPurposeMemory_eprom = TRUE; SMALLINT readWrite_eprom = FALSE; SMALLINT writeOnce_eprom = TRUE; SMALLINT readOnly_eprom = FALSE; SMALLINT nonVolatile_eprom = TRUE; SMALLINT needsProgramPulse_eprom = TRUE; SMALLINT needsPowerDelivery_eprom = FALSE; SMALLINT hasExtraInfo_eprom = TRUE; SMALLINT extraInfoLength_eprom = 1; char *extraInfoDesc_eprom = "Inverted redirection page"; SMALLINT pageAutoCRC_eprom = TRUE; SMALLINT lockOffset = 0; SMALLINT lockRedirectOffset = 0; SMALLINT canredirectPage = FALSE; SMALLINT canlockPage = FALSE; SMALLINT canlockRedirectPage = FALSE; SMALLINT numPages = 64; SMALLINT CRCbytes = 2; /** * Read memory in the current bank with no CRC checking (device or * data). The resulting data from this API may or may not be what is on * the 1-Wire device. It is recommends that the data contain some kind * of checking (CRC) like in the readPagePacketEPROM() method or have * the 1-Wire device provide the CRC as in readPageCRCEPROM(). readPageCRCEPROM() * however is not supported on all memory types, see 'hasPageAutoCRCEPROM()'. * If neither is an option then this method could be called more * then once to at least verify that the same thing is read consistantly. * * bank to tell what memory bank of the ibutton to use. * portnum the port number of the port being used for the * 1-Wire Network. * SNum the serial number for the part that the read is * to be done on. * str_add starting physical address * rd_cont if 'true' then device read is continued without * re-selecting. This can only be used if the new * read() continious where the last one led off * and it is inside a 'beginExclusive/endExclusive' * block. * buff byte array to place read data into * len length in bytes to read * * @return 'true' if the read was complete */ SMALLINT readEPROM(SMALLINT bank, int portnum, uchar *SNum, int str_add, SMALLINT rd_cont, uchar *buff, int len) { int i; int start_pg, end_pg, num_bytes, pg; uchar raw_buf[256]; // check if read exceeds memory if ((str_add + len) > getSizeEPROM(bank,SNum)) { OWERROR(OWERROR_READ_OUT_OF_RANGE); return FALSE; } // check if status memory if(readPageWithCRC(bank,SNum) == STATUS_READ_PAGE_COMMAND_EPROM) { // no regular read memory so must use readPageCRC start_pg = str_add / getPageLengthEPROM(bank,SNum); end_pg = ((str_add + len) / getPageLengthEPROM(bank,SNum)) - 1; if (((str_add + len) % getPageLengthEPROM(bank,SNum)) > 0) end_pg++; // loop to read the pages for (pg = start_pg; pg <= end_pg; pg++) if(!readPageCRCEPROM(bank,portnum,SNum,pg, &raw_buf[(pg-start_pg)*getPageLengthEPROM(bank,SNum)])) { return FALSE; } // extract out the data for(i=0;i<len;i++) buff[i] = raw_buf[i]; } // regular memory so use standard read memory command else { // see if need to access the device if (!rd_cont) { // select the device if (!owAccess(portnum)) { OWERROR(OWERROR_DEVICE_SELECT_FAIL); return FALSE; } // build start reading memory block raw_buf[0] = READ_MEMORY_COMMAND_EPROM; raw_buf[1] = (str_add + getStartingAddressEPROM(bank,SNum)) & 0xFF; raw_buf[2] = (((str_add + getStartingAddressEPROM(bank,SNum)) & 0xFFFF) >> 8) & 0xFF; raw_buf[3] = 0xFF; // check if get a 1 byte crc in a normal read. if(SNum[0] == 0x09) num_bytes = 4; else num_bytes = 3; // do the first block for command, address if(!owBlock(portnum,FALSE,raw_buf,num_bytes)) { OWERROR(OWERROR_BLOCK_FAILED); return FALSE; } } // pre-fill readBuf with 0xFF for (i=0;i<len;i++) buff[i] = 0xFF; // send second block to read data, return result if(!owBlock(portnum,FALSE,buff,len)) { OWERROR(OWERROR_DEVICE_SELECT_FAIL); return FALSE; } } return TRUE; } /** * Write memory in the current bank. It is recommended that * when writing data that some structure in the data is created * to provide error free reading back with readEPROM(). Or the * method 'writePagePacketEPROM()' could be used which automatically * wraps the data in a length and CRC. * * When using on Write-Once devices care must be taken to write into * into empty space. If write() is used to write over an unlocked * page on a Write-Once device it will fail. * * bank to tell what memory bank of the ibutton to use. * portnum the port number of the port being used for the * 1-Wire Network. * SNum the serial number for the part that the write is * to be done on. * str_add starting address * buff byte array containing data to write * len length in bytes to write * * @return 'true' if the write was complete. */ SMALLINT writeEPROM(SMALLINT bank, int portnum, uchar *SNum, int str_add, uchar *buff, int len) { int i; int result; SMALLINT write_continue; int crc_type; int verify[256]; // return if nothing to do if (len == 0) return TRUE; // check if power delivery is available if(!owHasProgramPulse(portnum)) { OWERROR(OWERROR_NO_PROGRAM_PULSE); return FALSE; } // check if trying to write read only bank if(isReadOnlyEPROM(bank,portnum,SNum)) { OWERROR(OWERROR_READ_ONLY); return FALSE; } for(i=0;i<len;i++) { verify[0] = writeVerify(bank,portnum,SNum, ((str_add+i+getStartingAddressEPROM(bank,SNum))/getPageLengthEPROM(bank,SNum))); if(isPageLocked(bank,portnum,SNum,(str_add+i+getStartingAddressEPROM(bank,SNum))/ getPageLengthEPROM(bank,SNum))) { OWERROR(OWERROR_PAGE_LOCKED); return FALSE; } } // check if write exceeds memory if((str_add + len) > (getPageLengthEPROM(bank,SNum) * getNumberPagesEPROM(bank,SNum))) { OWERROR(OWERROR_WRITE_OUT_OF_RANGE); return FALSE; } // loop while still have bytes to write write_continue = TRUE; crc_type = numCRCbytes(bank,SNum) - 1; for (i=0;i<len;i++) { result = owProgramByte(portnum,buff[i],str_add+i+getStartingAddressEPROM(bank,SNum), writeMemCmd(bank,SNum),crc_type,write_continue); if(verify[i]) { if((result == -1) || ((uchar) result != buff[i])) { OWERROR(OWERROR_READBACK_EPROM_FAILED); return FALSE; } else write_continue = FALSE; } } return TRUE; } /** * Read page in the current bank with no * CRC checking (device or data). The resulting data from this API * may or may not be what is on the 1-Wire device. It is recommends * that the data contain some kind of checking (CRC) like in the * readPagePacketEPROM() method or have the 1-Wire device provide the * CRC as in readPageCRCEPROM(). readPageCRCEPROM() however is not * supported on all memory types, see 'hasPageAutoCRCEPROM()'. * If neither is an option then this method could be called more * then once to at least verify that the same thing is read consistantly. * * bank to tell what memory bank of the ibutton to use. * portnum the port number of the port being used for the * 1-Wire Network. * SNum the serial number for the part. * page the page to read * rd_cont if 'true' then device read is continued without * re-selecting. This can only be used if the new * read() continious where the last one led off * and it is inside a 'beginExclusive/endExclusive' * block. * buff byte array containing data that was read. * * @return - returns '0' if the read page wasn't completed. * '1' if the operation is complete. */ SMALLINT readPageEPROM(SMALLINT bank, int portnum, uchar *SNum, int page, SMALLINT rd_cont, uchar *buff) { uchar extra[1]; if(hasPageAutoCRCEPROM(bank,SNum)) { if(!readPageExtraCRCEPROM(bank,portnum,SNum,page,buff,extra)) return FALSE; } else { if(!readEPROM(bank,portnum,SNum,(page*getPageLengthEPROM(bank,SNum)),FALSE, buff,getPageLengthEPROM(bank,SNum))) return FALSE; } return TRUE; } /** * Read page with extra information in the current bank with no * CRC checking (device or data). The resulting data from this API * may or may not be what is on the 1-Wire device. It is recommends * that the data contain some kind of checking (CRC) like in the * readPagePacketEPROM() method or have the 1-Wire device provide the * CRC as in readPageCRCEPROM(). readPageCRCEPROM() however is not * supported on all memory types, see 'hasPageAutoCRCEPROM()'. * If neither is an option then this method could be called more * then once to at least verify that the same thing is read consistantly. * See the method 'hasExtraInfoEPROM()' for a description of the optional * extra information some devices have. * * bank to tell what memory bank of the ibutton to use. * portnum the port number of the port being used for the * 1-Wire Network. * SNum the serial number for the part. * page the page to read * rd_cont if 'true' then device read is continued without * re-selecting. This can only be used if the new * read() continious where the last one led off * and it is inside a 'beginExclusive/endExclusive' * block. * buff byte array containing data that was read * extra the extra information * * @return - returns '0' if the read page wasn't completed with extra info. * '1' if the operation is complete. */ SMALLINT readPageExtraEPROM(SMALLINT bank, int portnum, uchar *SNum, int page, SMALLINT rd_cont, uchar *buff, uchar *extra) { // check if current bank is not scratchpad bank, or not page 0 if(!hasExtraInfoEPROM(bank,SNum)) { OWERROR(OWERROR_EXTRA_INFO_NOT_SUPPORTED); return FALSE; } return readPageExtraCRCEPROM(bank,portnum,SNum,page,buff,extra); } /** * Read a complete memory page with CRC verification provided by the * device with extra information. Not supported by all devices. * See the method 'hasPageAutoCRCEPROM()'. * See the method 'haveExtraInfoEPROM()' for a description of the optional * extra information. * * bank to tell what memory bank of the ibutton to use. * portnum the port number of the port being used for the * 1-Wire Network. * SNum the serial number for the part. * page the page to read * read_buff byte array containing data that was read. * extra the extra information * * @return - returns '0' if the read page wasn't completed with extra info. * '1' if the operation is complete. */ SMALLINT readPageExtraCRCEPROM(SMALLINT bank, int portnum, uchar *SNum, int page, uchar *read_buff, uchar *extra) { int i, len = 0, lastcrc = 0, addr, extractPnt; uchar raw_buf[PAGE_LENGTH_EPROM + 6]; owSerialNum(portnum,SNum,FALSE); // only needs to be implemented if supported by hardware if(!hasPageAutoCRCEPROM(bank,SNum)) { OWERROR(OWERROR_CRC_NOT_SUPPORTED); return FALSE; } // check if read exceeds memory if(page > (getNumberPagesEPROM(bank,SNum))) { OWERROR(OWERROR_READ_OUT_OF_RANGE); return FALSE; } // select the device if (!owAccess(portnum)) { OWERROR(OWERROR_DEVICE_SELECT_FAIL); return FALSE; } // build start reading memory block with: command, address, (extraInfo?), (crc?) len = 3 + getExtraInfoLengthEPROM(bank,SNum); if(crcAfterAdd(bank,SNum)) { len += numCRCbytes(bank,SNum); } for(i=0;i<len;i++) raw_buf[i] = 0xFF; raw_buf[0] = readPageWithCRC(bank,SNum); addr = page * getPageLengthEPROM(bank,SNum) + getStartingAddressEPROM(bank,SNum); raw_buf[1] = addr & 0xFF; raw_buf[2] = ((addr & 0xFFFF) >> 8) & 0xFF; // do the first block if(!owBlock(portnum,FALSE,&raw_buf[0],len)) { OWERROR(OWERROR_BLOCK_FAILED); return FALSE; } // check CRC if (numCRCbytes(bank,SNum) == 2) { setcrc16(portnum,0); for(i=0;i<len;i++) lastcrc = docrc16(portnum,raw_buf[i]); } else { setcrc8(portnum,0); for(i=0;i<len;i++) lastcrc = docrc8(portnum,raw_buf[i]); } if((getExtraInfoLengthEPROM(bank,SNum) > 0) || (crcAfterAdd(bank,SNum))) { // check CRC if(numCRCbytes(bank,SNum) == 2) { if (lastcrc != 0xB001) { OWERROR(OWERROR_CRC_FAILED); return FALSE; } } else { if (lastcrc != 0) { return FALSE; } } lastcrc = 0; // extract the extra information extractPnt = len - getExtraInfoLengthEPROM(bank,SNum) - numCRCbytes(bank,SNum); if(getExtraInfoLengthEPROM(bank,SNum)) for(i=extractPnt;i<(extractPnt+getExtraInfoLengthEPROM(bank,SNum));i++) extra[i-extractPnt] = raw_buf[i]; } // pre-fill with 0xFF for(i=0;i<(getPageLengthEPROM(bank,SNum) + numCRCbytes(bank,SNum));i++) raw_buf[i] = 0xFF; // send block to read data + crc if(!owBlock(portnum,FALSE,&raw_buf[0],(getPageLengthEPROM(bank,SNum)+numCRCbytes(bank,SNum)))) { OWERROR(OWERROR_BLOCK_FAILED); return FALSE; } // check the CRC if (numCRCbytes(bank,SNum) == 2) { setcrc16(portnum, (ushort) lastcrc); for(i=0;i<(getPageLengthEPROM(bank,SNum)+numCRCbytes(bank,SNum));i++) lastcrc = docrc16(portnum,raw_buf[i]); if (lastcrc != 0xB001) { OWERROR(OWERROR_CRC_FAILED); return FALSE; } } else { setcrc8(portnum, (uchar) lastcrc); for(i=0;i<(getPageLengthEPROM(bank,SNum)+numCRCbytes(bank,SNum));i++) lastcrc = docrc8(portnum,raw_buf[i]); if (lastcrc != 0) { OWERROR(OWERROR_CRC_FAILED); return FALSE; } } // extract the page data for(i=0;i<getPageLengthEPROM(bank,SNum);i++) { read_buff[i] = raw_buf[i]; } return TRUE; } /** * Read a complete memory page with CRC verification provided by the * device. Not supported by all devices. See the method * 'hasPageAutoCRCEPROM()'. * * bank to tell what memory bank of the ibutton to use. * portnum the port number of the port being used for the * 1-Wire Network. * SNum the serial number for the part. * page the page to read * buff byte array containing data that was read * * @return - returns '0' if the read page wasn't completed. * '1' if the operation is complete. */ SMALLINT readPageCRCEPROM(SMALLINT bank, int portnum, uchar *SNum, int page, uchar *buff) { uchar extra[1]; return readPageExtraCRCEPROM(bank,portnum,SNum,page,buff,extra); } /** * Read a Universal Data Packet. * * The Universal Data Packet always starts on page boundaries but * can end anywhere in the page. The structure specifies the length of * data bytes not including the length byte and the CRC16 bytes. * There is one length byte. The CRC16 is first initialized to * the page number. This provides a check to verify the page that * was intended is being read. The CRC16 is then calculated over * the length and data bytes. The CRC16 is then inverted and stored * low byte first followed by the high byte. This is structure is * used by this method to verify the data but is not returned, only * the data payload is returned. * * bank to tell what memory bank of the ibutton to use. * portnum the port number of the port being used for the * 1-Wire Network. * SNum the serial number for the part. * page the page to read * rd_cont if 'true' then device read is continued without * re-selecting. This can only be used if the new * read() continious where the last one led off * and it is inside a 'beginExclusive/endExclusive' * block. * buff byte array containing data that was read. * len length of the packet * * @return - returns '0' if the read page packet wasn't completed * '1' if the operation is complete. */ SMALLINT readPagePacketEPROM(SMALLINT bank, int portnum, uchar *SNum, int page, SMALLINT rd_cont, uchar *buff, int *len) { uchar raw_buf[PAGE_LENGTH_EPROM]; uchar extra[1]; ushort lastcrc16; int i; // read entire page with read page CRC if(!readPageExtraCRCEPROM(bank,portnum,SNum,page,&raw_buf[0],&extra[0])) return FALSE; // check if length is realistic if ((raw_buf[0] & 0xFF) > getMaxPacketDataLengthEPROM(bank,SNum)) { OWERROR(OWERROR_INVALID_PACKET_LENGTH); return FALSE; } // verify the CRC is correct setcrc16(portnum,(ushort) ((getStartingAddressEPROM(bank,SNum)/PAGE_LENGTH_EPROM) + page)); for(i=0;i<(raw_buf[0]+3);i++) lastcrc16 = docrc16(portnum,raw_buf[i]); if(lastcrc16 == 0xB001) { // extract the data out of the packet for(i=0;i<raw_buf[0];i++) buff[i] = raw_buf[i+1]; // return the length *len = raw_buf[0]; } else { OWERROR(OWERROR_CRC_FAILED); return FALSE; } return TRUE; } /** * Read a Universal Data Packet and extra information. See the * method 'readPagePacketEPROM()' for a description of the packet structure. * See the method 'hasExtraInfoEPROM()' for a description of the optional * extra information some devices have. * * bank to tell what memory bank of the ibutton to use. * portnum the port number of the port being used for the * 1-Wire Network. * SNum the serial number for the part. * page the page to read * rd_cont if 'true' then device read is continued without * re-selecting. This can only be used if the new * read() continious where the last one led off * and it is inside a 'beginExclusive/endExclusive' * block. * buff byte array containing data that was read. * len length of the packet * extra extra information * * @return - returns '0' if the read page packet wasn't completed * '1' if the operation is complete. */ SMALLINT readPagePacketExtraEPROM(SMALLINT bank, int portnum, uchar *SNum, int page, SMALLINT rd_cont, uchar *buff, int *len, uchar *extra) { uchar raw_buf[PAGE_LENGTH_EPROM]; ushort lastcrc16; int i; // check if current bank is not scratchpad bank, or not page 0 if (!hasExtraInfoEPROM(bank,SNum)) { OWERROR(OWERROR_EXTRA_INFO_NOT_SUPPORTED); return FALSE; } // read entire page with read page CRC if(!readPageExtraCRCEPROM(bank,portnum,SNum,page,raw_buf,extra)) return FALSE; // check if length is realistic if ((raw_buf[0] & 0xFF) > getMaxPacketDataLengthEPROM(bank,SNum)) { OWERROR(OWERROR_INVALID_PACKET_LENGTH); return FALSE; } // verify the CRC is correct setcrc16(portnum,(ushort) ((getStartingAddressEPROM(bank,SNum)/PAGE_LENGTH_EPROM) + page)); for(i=0;i<(raw_buf[0]+3);i++) lastcrc16 = docrc16(portnum,raw_buf[i]); if(lastcrc16 == 0xB001) { // extract the data out of the packet for(i=0;i<raw_buf[0];i++) buff[i] = raw_buf[i+1]; // return the length *len = raw_buf [0]; } else { OWERROR(OWERROR_CRC_FAILED); return FALSE; } return TRUE; } /** * Write a Universal Data Packet. See the method 'readPagePacketEPROM()' * for a description of the packet structure. * * bank to tell what memory bank of the ibutton to use. * portnum the port number of the port being used for the * 1-Wire Network. * SNum the serial number for the part. * page the page the packet is being written to. * buff byte array containing data that to write. * len length of the packet * * @return - returns '0' if the write page packet wasn't completed * '1' if the operation is complete. */ SMALLINT writePagePacketEPROM(SMALLINT bank, int portnum, uchar *SNum, int page, uchar *buff, int len) { uchar raw_buf[PAGE_LENGTH_EPROM]; int crc, i; // make sure length does not exceed max if (len > getMaxPacketDataLengthEPROM(bank,SNum)) { OWERROR(OWERROR_INVALID_PACKET_LENGTH); return FALSE; } // see if this bank is general read/write if (!isGeneralPurposeMemoryEPROM(bank,SNum)) { OWERROR(OWERROR_NOT_GENERAL_PURPOSE); return FALSE; } // construct the packet to write raw_buf[0] = (uchar) len; for(i=0;i<len;i++) raw_buf[i+1] = buff[i]; setcrc16(portnum,(ushort) ((getStartingAddressEPROM(bank,SNum)/PAGE_LENGTH_EPROM) + page)); for(i=0;i<len+1;i++) crc = docrc16(portnum,raw_buf[i]); raw_buf[len + 1] = ~crc & 0xFF; raw_buf[len + 2] = ((~crc & 0xFFFF) >> 8) & 0xFF; // write the packet, return result if(!writeEPROM(bank,portnum,SNum,page*getPageLengthEPROM(bank,SNum)+ getStartingAddressEPROM(bank,SNum),&raw_buf[0],len+3)) return FALSE; return TRUE; } /** * Query to get the number of pages in current memory bank. * * bank to tell what memory bank of the ibutton to use. * SNum the serial number for the part. * * @return number of pages in current memory bank */ SMALLINT getNumberPagesEPROM(SMALLINT bank, uchar *SNum) { int pages = numPages; switch(SNum[0]) { case 0x09: if(bank == 0) pages = 4; else if(bank == 1) pages = 1; break; case 0x0B: if((bank == 1) || (bank == 2) || (bank == 3)) pages = 1; else if(bank == 4) pages = 8; break; case 0x0F: if(bank == 0) pages = 256; else if((bank == 1) || (bank == 2)) pages = 4; else if(bank == 3) pages = 3; else if(bank == 4) pages = 32; break; case 0x12: if(bank == 0) pages = 4; else if(bank == 1) pages = 1; break; case 0x13: if(bank == 0) pages = 16; else if(bank == 4) pages = 2; else if((bank == 1) || (bank == 2) || (bank == 3)) pages = 1; break; default: pages = numPages; break; } return pages; } /** * Query to get the memory bank size in bytes. * * bank to tell what memory bank of the ibutton to use. * SNum the serial number for the part. * * @return memory bank size in bytes. */ int getSizeEPROM(SMALLINT bank, uchar *SNum) { int size = SIZE_EPROM; switch(SNum[0]) { case 0x09: if(bank == 0) size = 128; else if(bank == 1) size = 8; break; case 0x0B: if((bank == 1) || (bank == 2) || (bank == 3)) size = 8; else if(bank == 4) size = 64; break; case 0x0F: if(bank == 0) size = 8192; else if((bank == 1) || (bank == 2)) size = 32; else if(bank == 3) size = 24; else if(bank == 4) size = 256; break; case 0x12: if(bank == 0) size = 128; else if(bank == 1) size = 8; break; case 0x13: if(bank == 0) size = 512; else if(bank == 4) size = 16; else if((bank == 1) || (bank == 2) || (bank == 3)) size = 8; break; default: size = SIZE_EPROM; break; } return size; } /** * Query to get the starting physical address of this bank. Physical * banks are sometimes sub-divided into logical banks due to changes * in attributes. * * bank to tell what memory bank of the ibutton to use. * SNum the serial number for the part. * * @return physical starting address of this logical bank. */ int getStartingAddressEPROM(SMALLINT bank, uchar *SNum) { int addr = 0; switch(SNum[0]) { case 0x0B: if(bank == 2) addr = 32; else if(bank == 3) addr = 64; else if(bank == 4) addr = 256; break; case 0x0F: if(bank == 2) addr = 32; else if(bank == 3) addr = 64; else if(bank == 4) addr = 256; break; case 0x13: if(bank == 2) addr = 32; else if(bank == 3) addr = 64; else if(bank == 4) addr = 256; break; default: addr = 0; break; } return addr; } /** * Query to get page length in bytes in current memory bank. * * bank to tell what memory bank of the ibutton to use. * SNum the serial number for the part. * * @return page length in bytes in current memory bank */ SMALLINT getPageLengthEPROM(SMALLINT bank, uchar *SNum) { int len = PAGE_LENGTH_EPROM; switch(SNum[0]) { case 0x09: if(bank == 1) len = 8; break; case 0x0B: if((bank > 0) && (bank < 5)) len = 8; case 0x0F: if((bank > 0) && (bank <5)) len = 8; break; case 0x12: if(bank == 1) len = 8; break; case 0x13: if((bank > 0) && (bank < 5)) len = 8; break; default: len = PAGE_LENGTH_EPROM; break; } return len; } /** * Query to see get a string description of the current memory bank. * * bank to tell what memory bank of the ibutton to use. * SNum the serial number for the part. * * @return String containing the memory bank description */ char *getBankDescriptionEPROM(SMALLINT bank, uchar *SNum) { switch(SNum[0]) { case 0x09: if(bank == 1) return "Write protect pages and page redirection"; break; case 0x0B: if(bank == 1) return "Write protect pages"; else if(bank == 2) return "Write protect redirection"; else if(bank == 3) return "Bitmap of used pages for file structure"; else if(bank == 4) return "Page redirection bytes"; break; case 0x0F: if(bank == 1) return "Write protect pages"; else if(bank == 2) return "Write protect redirection"; else if(bank == 3) return "Bitmap of used pages for file structure"; else if(bank == 4) return "Pages redirection bytes"; break; case 0x12: if(bank == 1) return "Write protect pages, page redirection, switch control"; break; case 0x13: if(bank == 1) return "Write protect pages"; else if(bank == 2) return "Write protect redirection"; else if(bank == 3) return "Bitmap of used pages for file structure"; else if(bank == 4) return "Page redirection bytes"; break; default: return bankDescription_eprom; } return bankDescription_eprom; } /** * Query to see if the current memory bank is general purpose * user memory. If it is NOT then it is Memory-Mapped and writing * values to this memory will affect the behavior of the 1-Wire * device. * * bank to tell what memory bank of the ibutton to use. * SNum the serial number for the part. * * @return 'true' if current memory bank is general purpose */ SMALLINT isGeneralPurposeMemoryEPROM(SMALLINT bank, uchar *SNum) { int gp_mem = generalPurposeMemory_eprom; switch(SNum[0]) { case 0x09: if(bank == 1) gp_mem = FALSE; break; case 0x0B: if((bank > 0) && (bank < 5)) gp_mem = FALSE; case 0x0F: if((bank > 0) && (bank <5)) gp_mem = FALSE; break; case 0x12: if(bank == 1) gp_mem = FALSE; break; case 0x13: if((bank > 0) && (bank < 5)) gp_mem = FALSE; break; default: gp_mem = generalPurposeMemory_eprom; break; } return gp_mem; } /** * Query to see if current memory bank is read/write. * * bank to tell what memory bank of the ibutton to use. * SNum the serial number for the part. * * @return 'true' if current memory bank is read/write */ SMALLINT isReadWriteEPROM(SMALLINT bank, int portnum, uchar *SNum) { return readWrite_eprom; } /** * Query to see if current memory bank is write write once such * as with EPROM technology. * * bank to tell what memory bank of the ibutton to use. * SNum the serial number for the part. * * @return 'true' if current memory bank can only be written once */ SMALLINT isWriteOnceEPROM(SMALLINT bank, int portnum, uchar *SNum) { return writeOnce_eprom; } /** * Query to see if current memory bank is read only. * * bank to tell what memory bank of the ibutton to use. * SNum the serial number for the part. * * @return 'true' if current memory bank can only be read */ SMALLINT isReadOnlyEPROM(SMALLINT bank, int portnum, uchar *SNum) { return readOnly_eprom; } /** * Query to see if current memory bank non-volatile. Memory is * non-volatile if it retains its contents even when removed from * the 1-Wire network. * * bank to tell what memory bank of the ibutton to use. * SNum the serial number for the part. * * @return 'true' if current memory bank non volatile. */ SMALLINT isNonVolatileEPROM(SMALLINT bank, uchar *SNum) { return nonVolatile_eprom; } /** * Query to see if current memory bank pages need the adapter to * have a 'ProgramPulse' in order to write to the memory. * * bank to tell what memory bank of the ibutton to use. * SNum the serial number for the part. * * @return 'true' if writing to the current memory bank pages * requires a 'ProgramPulse'. */ SMALLINT needsProgramPulseEPROM(SMALLINT bank, uchar *SNum) { return needsProgramPulse_eprom; } /** * Query to see if current memory bank pages need the adapter to * have a 'PowerDelivery' feature in order to write to the memory. * * bank to tell what memory bank of the ibutton to use. * SNum the serial number for the part. * * @return 'true' if writing to the current memory bank pages * requires 'PowerDelivery'. */ SMALLINT needsPowerDeliveryEPROM(SMALLINT bank, uchar *SNum) { return needsPowerDelivery_eprom; } /** * Checks to see if this memory bank's pages deliver extra * information outside of the normal data space, when read. Examples * of this may be a redirection byte, counter, tamper protection * bytes, or SHA-1 result. If this method returns true then the * methods with an 'extraInfo' parameter can be used. * * bank to tell what memory bank of the ibutton to use. * SNum the serial number for the part. * * @return true if reading the this memory bank's * pages provides extra information */ SMALLINT hasExtraInfoEPROM(SMALLINT bank, uchar *SNum) { SMALLINT hasExtra = hasExtraInfo_eprom; switch(SNum[0]) { case 0x09: hasExtra = FALSE; break; case 0x0B: if((bank > 0) && (bank < 5)) hasExtra = FALSE; break; case 0x0F: if((bank > 0) && (bank < 5)) hasExtra = FALSE; break; case 0x12: if(bank == 1) hasExtra = FALSE; break; case 0x13: if((bank > 0) && (bank < 5)) hasExtra = FALSE; break; default: hasExtra = hasExtraInfo_eprom; break; } return hasExtra; } /** * Query to get the length in bytes of extra information that * is read when read a page in the current memory bank. See * 'hasExtraInfoEPROM()'. * * bank to tell what memory bank of the ibutton to use. * SNum the serial number for the part. * * @return number of bytes in Extra Information read when reading * pages in the current memory bank. */ SMALLINT getExtraInfoLengthEPROM(SMALLINT bank, uchar *SNum) { SMALLINT len = extraInfoLength_eprom; switch(SNum[0]) { case 0x09: len = 0; break; case 0x0B: if((bank > 0) && (bank < 5)) len = 0; break; case 0x0F: if((bank > 0) && (bank < 5)) len = 0; break; case 0x12: if(bank == 1) len = 0; break; case 0x13: if((bank > 0) && (bank < 5)) len = 0; break; default: len = extraInfoLength_eprom; break; } return len; } /** * Query to get a string description of what is contained in * the Extra Informationed return when reading pages in the current * memory bank. See 'hasExtraInfoEPROM()'. * * bank to tell what memory bank of the ibutton to use. * SNum the serial number for the part. * * @return string describing extra information. */ char *getExtraInfoDescEPROM(SMALLINT bank, uchar *SNum) { switch(SNum[0]) { case 0x09: return " "; break; case 0x0B: if((bank > 0) && (bank < 5)) return " "; break; case 0x0F: if((bank > 0) && (bank < 5)) return " "; break; case 0x12: if(bank == 1) return " "; break; case 0x13: if((bank > 0) && (bank < 5)) return " "; break; default: return extraInfoDesc_eprom; } return extraInfoDesc_eprom; } /** * Query to see if current memory bank pages can be read with * the contents being verified by a device generated CRC. * This is used to see if the 'ReadPageCRCEPROM()' can be used. * * bank to tell what memory bank of the ibutton to use. * SNum the serial number for the part. * * @return 'true' if current memory bank can be read with self * generated CRC. */ SMALLINT hasPageAutoCRCEPROM(SMALLINT bank, uchar *SNum) { return pageAutoCRC_eprom; } /** * Query to get Maximum data page length in bytes for a packet * read or written in the current memory bank. See the 'ReadPagePacket()' * and 'WritePagePacket()' methods. This method is only usefull * if the current memory bank is general purpose memory. * * bank to tell what memory bank of the ibutton to use. * SNum the serial number for the part. * * @return max packet page length in bytes in current memory bank */ SMALLINT getMaxPacketDataLengthEPROM(SMALLINT bank, uchar *SNum) { return getPageLengthEPROM(bank,SNum) - 3; } //-------- //-------- OTPMemoryBank I/O methods //-------- /** * Lock the specifed page in the current memory bank. Not supported * by all devices. See the method 'canLockPageEPROM()'. * * bank to tell what memory bank of the ibutton to use. * portnum the port number of the port being used for the * 1-Wire Network. * SNum the serial number for the part. * page the page to be locked * * @return true if the page was locked * false otherwise */ SMALLINT lockPage(SMALLINT bank, int portnum, uchar *SNum, int page) { int nbyt,nbit; SMALLINT write_bank; uchar wr_byte[1]; // setting the bank to write // and since all the page lock info is in // bank 1 for all the EPROM parts. write_bank = 1; if(isPageLocked(write_bank,portnum,SNum,page)) { OWERROR(OWERROR_PAGE_ALREADY_LOCKED); return FALSE; } // create byte to write to mlLock to lock page nbyt = (page >> 3); nbit = page - (nbyt << 3); wr_byte[0] = (uchar) ~(0x01 << nbit); // write the lock bit if(!writeEPROM(write_bank,portnum,SNum,nbyt + lockOffset,wr_byte,1)) return FALSE; // read back to verify if(!isPageLocked(write_bank,portnum,SNum,page)) { OWERROR(OWERROR_READ_BACK_NOT_VALID); return FALSE; } return TRUE; } /** * Query to see if the specified page is locked. * See the method 'canLockPage()'. * * bank to tell what memory bank of the ibutton to use. * portnum the port number of the port being used for the * 1-Wire Network. * SNum the serial number for the part. * page the page to check if locked * * @return true if page locked. */ SMALLINT isPageLocked(SMALLINT bank, int portnum, uchar *SNum, int page) { int pg_len, read_pg, index, nbyt, nbit; SMALLINT read_bank; uchar read_buf[PAGE_LENGTH_EPROM]; // setting the bank to read for information // and since all the page lock info is in // bank 1 for all the EPROM parts. read_bank = 1; // read page that locked bit is on pg_len = getPageLengthEPROM(read_bank,SNum); read_pg = (page + lockOffset) / (pg_len * 8); if(!readPageCRCEPROM(read_bank,portnum,SNum,read_pg,read_buf)) return FALSE; // return boolean on locked bit index = (page + lockOffset) - (read_pg * 8 * pg_len); nbyt = (index >> 3); nbit = index - (nbyt << 3); return !(((read_buf[nbyt] >> nbit) & 0x01) == 0x01); } /** * Redirect the specifed page in the current memory bank to a new page. * Not supported by all devices. See the method 'canRedirectPage()'. * * bank to tell what memory bank of the ibutton to use. * portnum the port number of the port being used for the * 1-Wire Network. * SNum the serial number for the part. * page the page to be locked * newPage new page number to redirect to * * @return true if the page was redirected */ SMALLINT redirectPage(SMALLINT bank, int portnum, uchar *SNum, int page, int newPage) { uchar wr_byte[1]; // create byte to redirect page SMALLINT write_bank; if(isRedirectPageLocked(bank,portnum,SNum,page)) { OWERROR(OWERROR_REDIRECTED_PAGE); return FALSE; } // setting the bank to write switch(SNum[0]) { case 0x09: case 0x12: write_bank = 1; break; case 0x0B: case 0x0F: case 0x13: write_bank = 4; break; default: write_bank = 4; break; } wr_byte[0] = (uchar) ~newPage; // write the redirection byte if(!writeEPROM(write_bank,portnum,SNum,page + redirectOffset(bank,SNum),wr_byte,1)) return FALSE; return TRUE; } /** * Gets the page redirection of the specified page. * Not supported by all devices. * * bank to tell what memory bank of the ibutton to use. * portnum the port number of the port being used for the * 1-Wire Network. * SNum the serial number for the part. * page number of page check for redirection * * @return the new page number or 0 if not redirected */ SMALLINT getRedirectedPage(SMALLINT bank, int portnum, uchar *SNum, int page) { int pg_len, read_pg; SMALLINT read_bank; uchar read_buf[PAGE_LENGTH_EPROM]; // setting the bank to read for information switch(SNum[0]) { case 0x09: case 0x12: read_bank = 1; break; case 0x0B: case 0x0F: case 0x13: read_bank = 4; break; default: read_bank = 4; break; } // read page that redirect byte is on pg_len = getPageLengthEPROM(read_bank,SNum); read_pg = (page + redirectOffset(bank,SNum)) / pg_len; if(!readPageCRCEPROM(read_bank,portnum,SNum,read_pg,read_buf)) return FALSE; // return page return (SMALLINT) (~read_buf[(page + redirectOffset(bank,SNum)) % pg_len] & 0x000000FF); } /** * Lock the redirection option for the specifed page in the current * memory bank. Not supported by all devices. See the method * 'canLockRedirectPage()'. * * bank to tell what memory bank of the ibutton to use. * portnum the port number of the port being used for the * 1-Wire Network. * SNum the serial number for the part. * page number of page to redirect * * @return true if the redirected page is locked. */ SMALLINT lockRedirectPage(SMALLINT bank, int portnum, uchar *SNum, int page) { int nbyt, nbit; SMALLINT write_bank; uchar wr_byte[1]; if(isRedirectPageLocked(bank,portnum,SNum,page)) { OWERROR(OWERROR_LOCKING_REDIRECTED_PAGE_AGAIN); return FALSE; } // setting the bank to write switch(SNum[0]) { case 0x0B: case 0x0F: case 0x13: write_bank = 2; break; default: write_bank = 0; break; } // create byte to write to mlLock to lock page nbyt = (page >> 3); nbit = page - (nbyt << 3); wr_byte[0] = (uchar) ~(0x01 << nbit); // write the lock bit if(!writeEPROM(write_bank,portnum,SNum,nbyt + lockRedirectOffset,wr_byte,1)) return FALSE; // read back to verify if (!isRedirectPageLocked(bank,portnum,SNum,page) || (write_bank == 0)) { OWERROR(OWERROR_COULD_NOT_LOCK_REDIRECT); return FALSE; } return TRUE; } /** * Query to see if the specified page has redirection locked. * Not supported by all devices. See the method 'canRedirectPage()'. * * bank to tell what memory bank of the ibutton to use. * portnum the port number of the port being used for the * 1-Wire Network. * SNum the serial number for the part. * page number of page to check for redirection * * @return true if redirection is locked for this page */ SMALLINT isRedirectPageLocked(SMALLINT bank, int portnum, uchar *SNum, int page) { int pg_len, read_pg, index, nbyt, nbit; SMALLINT read_bank; uchar read_buf[PAGE_LENGTH_EPROM]; // setting the bank to read for information switch(SNum[0]) { case 0x0B: case 0x0F: case 0x13: read_bank = 2; break; default: return FALSE; } // read page that lock redirect bit is on pg_len = getPageLengthEPROM(read_bank,SNum); read_pg = (page + lockRedirectOffset) / (pg_len * 8); if(!readPageCRCEPROM(read_bank,portnum,SNum,read_pg,read_buf)) return FALSE; // return boolean on lock redirect bit index = (page + lockRedirectOffset) - (read_pg * 8 * pg_len); nbyt = (index >> 3); nbit = index - (nbyt << 3); return !(((read_buf[nbyt] >> nbit) & 0x01) == 0x01); } /** * Query to see if current memory bank pages can be redirected * to another pages. This is mostly used in Write-Once memory * to provide a means to update. * * bank to tell what memory bank of the ibutton to use. * SNum the serial number for the part. * * @return 'true' if current memory bank pages can be redirected * to a new page. */ SMALLINT canRedirectPageEPROM(SMALLINT bank, uchar *SNum) { SMALLINT canRedirect = canredirectPage; switch(SNum[0]) { case 0x09: if(bank == 0) canRedirect = TRUE; break; case 0x0B: if(bank == 0) canRedirect = TRUE; break; case 0x0F: if(bank == 0) canRedirect = TRUE; break; case 0x12: if(bank == 0) canRedirect = TRUE; break; case 0x13: if(bank == 0) canRedirect = TRUE; break; default: canRedirect = canredirectPage; break; } return canRedirect; } /** * Query to see if current memory bank pages can be locked. A * locked page would prevent any changes to the memory. * * bank to tell what memory bank of the ibutton to use. * SNum the serial number for the part. * * @return 'true' if current memory bank pages can be redirected * to a new page. */ SMALLINT canLockPageEPROM(SMALLINT bank, uchar *SNum) { SMALLINT canLock = canlockPage; switch(SNum[0]) { case 0x09: if(bank == 0) canLock = TRUE; break; case 0x0B: if(bank == 0) canLock = TRUE; break; case 0x0F: if(bank == 0) canLock = TRUE; break; case 0x12: if(bank == 0) canLock = TRUE; break; case 0x13: if(bank == 0) canLock = TRUE; break; default: canLock = canlockPage; break; } return canLock; } /** * Query to see if current memory bank pages can be locked from * being redirected. This would prevent a Write-Once memory from * being updated. * * bank to tell what memory bank of the ibutton to use. * SNum the serial number for the part. * * @return 'true' if current memory bank pages can be locked from * being redirected to a new page. */ SMALLINT canLockRedirectPageEPROM(SMALLINT bank, uchar *SNum) { SMALLINT lockRedirect = canlockRedirectPage; switch(SNum[0]) { case 0x0B: if(bank == 0) lockRedirect = TRUE; break; case 0x0F: if(bank == 0) lockRedirect = TRUE; break; case 0x13: if(bank == 0) lockRedirect = TRUE; break; default: lockRedirect = canlockRedirectPage; break; } return lockRedirect; } //-------- //-------- Local functions //-------- /** * Send the command for writing to memory for a device given * the memory bank and serial number. * * bank to tell what memory bank of the ibutton to use. * SNum the serial number for the part. * * @return the command for writing to the memory bank. */ uchar writeMemCmd(SMALLINT bank, uchar *SNum) { uchar command = MAIN_WRITE_COMMAND_EPROM; switch(SNum[0]) { case 0x09: if(bank == 1) command = STATUS_WRITE_COMMAND_EPROM; break; case 0x0B: if((bank > 0) && (bank < 5)) command = STATUS_WRITE_COMMAND_EPROM; break; case 0x0F: if((bank > 0) && (bank < 5)) command = STATUS_WRITE_COMMAND_EPROM; break; case 0x12: if(bank == 1) command = STATUS_WRITE_COMMAND_EPROM; break; case 0x13: if((bank > 0) && (bank < 5)) command = STATUS_WRITE_COMMAND_EPROM; break; default: command = MAIN_WRITE_COMMAND_EPROM; break; } return command; } /** * Get the number of CRC bytes for the device. * * bank to tell what memory bank of the ibutton to use. * SNum the serial number for the part. * * @return the number of CRC bytes. */ SMALLINT numCRCbytes(SMALLINT bank, uchar *SNum) { SMALLINT numbytes = CRCbytes; switch(SNum[0]) { case 0x09: if((bank == 0) || (bank == 1)) numbytes = 1; break; default: numbytes = CRCbytes; break; } return numbytes; } /** * Get the status of the page the pages write verification * * bank to tell what memory bank of the ibutton to use. * SNum the serial number for the part. * * @return true if write verification is used and * false if it is not used. */ SMALLINT writeVerify(SMALLINT bank, int portnum, uchar *SNum, int page) { if(isPageLocked(bank,portnum,SNum,page) || isRedirectPageLocked(bank,portnum,SNum,page)) return FALSE; return writeVerification_eprom; } /** * Get crc after sending command,address * * bank to tell what memory bank of the ibutton to use. * SNum the serial number for the part. * * @return true if crc is can be gotten after sending command,address * false otherwise */ SMALLINT crcAfterAdd(SMALLINT bank, uchar *SNum) { SMALLINT crcAfter = TRUE; switch(SNum[0]) { case 0x0B: if((bank > 0) && (bank < 5)) crcAfter = FALSE; break; case 0x0F: if((bank > 0) && (bank < 5)) crcAfter = FALSE; break; case 0x12: if(bank == 1) crcAfter = FALSE; break; case 0x13: if((bank > 0) && (bank < 5)) crcAfter = FALSE; break; default: crcAfter = TRUE; break; } return crcAfter; } /** * Get the byte command for reading the page with crc. * * bank to tell what memory bank of the ibutton to use. * SNum the serial number for the part. * * @return the byte command for reading the page */ uchar readPageWithCRC(SMALLINT bank, uchar *SNum) { uchar readPage = MAIN_READ_PAGE_COMMAND_EPROM; switch(SNum[0]) { case 0x09: if(bank == 0) readPage = 0xC3; else if(bank == 1) readPage = STATUS_READ_PAGE_COMMAND_EPROM; break; case 0x0B: if((bank > 0) && (bank < 5)) readPage = STATUS_READ_PAGE_COMMAND_EPROM; break; case 0x0F: if((bank > 0) && (bank < 5)) readPage = STATUS_READ_PAGE_COMMAND_EPROM; break; case 0x12: if(bank == 1) readPage = STATUS_READ_PAGE_COMMAND_EPROM; break; case 0x13: if((bank > 0) && (bank < 5)) readPage = STATUS_READ_PAGE_COMMAND_EPROM; break; default: readPage = MAIN_READ_PAGE_COMMAND_EPROM; break; } return readPage; } /** * Get the offset into the redirection status information. * * bank to tell what memory bank of the ibutton to use. * SNum the serial number for the part. * * @return the offset into the redirection status */ SMALLINT redirectOffset(SMALLINT bank, uchar *SNum) { int offset = 0; switch(SNum[0]) { case 0x09: if(bank == 0) offset = 1; break; case 0x12: if(bank == 0) offset = 1; break; default: offset = 0; break; } return offset; }
27.593373
98
0.582669
d3de979559e58d4259f1c3b4cd057d0b348da26b
2,710
h
C
src/vtk/DRCFilters/vtkLidarSource.h
debaraj-barua/director
9766469a2976719d2cb38e194d9415dd6ebd0164
[ "BSD-3-Clause" ]
null
null
null
src/vtk/DRCFilters/vtkLidarSource.h
debaraj-barua/director
9766469a2976719d2cb38e194d9415dd6ebd0164
[ "BSD-3-Clause" ]
null
null
null
src/vtk/DRCFilters/vtkLidarSource.h
debaraj-barua/director
9766469a2976719d2cb38e194d9415dd6ebd0164
[ "BSD-3-Clause" ]
2
2018-07-05T10:46:04.000Z
2021-06-18T11:37:28.000Z
/*========================================================================= Program: Visualization Toolkit Module: vtkLidarSource.h Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen All rights reserved. See Copyright.txt or http://www.kitware.com/Copyright.htm for details. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the above copyright notice for more information. =========================================================================*/ // .NAME vtkLidarSource - // .SECTION Description // #ifndef __vtkLidarSource_h #define __vtkLidarSource_h #include <vtkPolyDataAlgorithm.h> #include <vtkDRCFiltersModule.h> class vtkTransform; class VTKDRCFILTERS_EXPORT vtkLidarSource : public vtkPolyDataAlgorithm { public: vtkTypeMacro(vtkLidarSource, vtkPolyDataAlgorithm); void PrintSelf(ostream& os, vtkIndent indent); static vtkLidarSource *New(); void Poll(); void Start(); void Stop(); vtkGetVector2Macro(DistanceRange, double); vtkSetVector2Macro(DistanceRange, double); vtkGetVector2Macro(HeightRange, double); vtkSetVector2Macro(HeightRange, double); void SetEdgeAngleThreshold(double threshold); double GetEdgeAngleThreshold(); int GetCurrentRevolution(); void GetDataForRevolution(int revolution, vtkPolyData* polyData); void GetDataForHistory(int numberOfScanLines, vtkPolyData* polyData); int GetCurrentScanLine(); void GetDataForScanLine(int scanLine, vtkPolyData* polyData); vtkIdType GetCurrentScanTime(); void subscribe(const char* channelName); void setCoordinateFrame(const char* coordinateFrame); void InitBotConfig(const char* filename); void GetTransform(const char* fromFrame, const char* toFrame, vtkIdType utime, vtkTransform* transform); static void GetBotRollPitchYaw(vtkTransform* transform, double rpy[3]); static void GetBotQuaternion(vtkTransform* transform, double wxyz[4]); protected: virtual int RequestInformation(vtkInformation *request, vtkInformationVector **inputVector, vtkInformationVector *outputVector); virtual int RequestData(vtkInformation *request, vtkInformationVector **inputVector, vtkInformationVector *outputVector); vtkLidarSource(); virtual ~vtkLidarSource(); double DistanceRange[2]; double EdgeAngleThreshold; double HeightRange[2]; private: vtkLidarSource(const vtkLidarSource&); // Not implemented. void operator=(const vtkLidarSource&); // Not implemented. class vtkInternal; vtkInternal * Internal; }; #endif
27.653061
106
0.705904
83e4c93ce187e3c1e9a2d24dcdf4c703e0d66a26
2,325
h
C
frontend/ExampleBase.h
MorningMartin1997/libOTe
60dc9ea0858d516224716f66f76954437a4744ad
[ "Unlicense" ]
241
2016-11-06T18:23:48.000Z
2022-03-28T06:25:05.000Z
frontend/ExampleBase.h
MorningMartin1997/libOTe
60dc9ea0858d516224716f66f76954437a4744ad
[ "Unlicense" ]
58
2016-11-18T17:21:26.000Z
2022-03-15T03:31:06.000Z
frontend/ExampleBase.h
MorningMartin1997/libOTe
60dc9ea0858d516224716f66f76954437a4744ad
[ "Unlicense" ]
88
2016-12-10T02:55:34.000Z
2022-03-28T07:22:20.000Z
#pragma once #include "libOTe/Base/SimplestOT.h" #include "libOTe/Base/McRosRoyTwist.h" #include "libOTe/Base/McRosRoy.h" #include "libOTe/Tools/Popf/EKEPopf.h" #include "libOTe/Tools/Popf/MRPopf.h" #include "libOTe/Tools/Popf/FeistelPopf.h" #include "libOTe/Tools/Popf/FeistelMulPopf.h" #include "libOTe/Tools/Popf/FeistelRistPopf.h" #include "libOTe/Tools/Popf/FeistelMulRistPopf.h" #include "libOTe/Base/MasnyRindal.h" #include "libOTe/Base/MasnyRindalKyber.h" #include "libOTe/Base/naor-pinkas.h" #include "cryptoTools/Common/BitVector.h" namespace osuCrypto { template<typename BaseOT> void baseOT_example_from_ot(Role role, int totalOTs, int numThreads, std::string ip, std::string tag, CLP&, BaseOT ot) { IOService ios; PRNG prng(sysRandomSeed()); if (totalOTs == 0) totalOTs = 128; if (numThreads > 1) std::cout << "multi threading for the base OT example is not implemented.\n" << std::flush; Timer t; Timer::timeUnit s; if (role == Role::Receiver) { auto chl0 = Session(ios, ip, SessionMode::Server).addChannel(); chl0.waitForConnection(); BaseOT recv = ot; std::vector<block> msg(totalOTs); BitVector choice(totalOTs); choice.randomize(prng); s = t.setTimePoint("base OT start"); recv.receive(choice, msg, prng, chl0); } else { auto chl1 = Session(ios, ip, SessionMode::Client).addChannel(); chl1.waitForConnection(); BaseOT send = ot; std::vector<std::array<block, 2>> msg(totalOTs); s = t.setTimePoint("base OT start"); send.send(msg, prng, chl1); } auto e = t.setTimePoint("base OT end"); auto milli = std::chrono::duration_cast<std::chrono::milliseconds>(e - s).count(); std::cout << tag << (role == Role::Receiver ? " (receiver)" : " (sender)") << " n=" << totalOTs << " " << milli << " ms" << std::endl; } template<typename BaseOT> void baseOT_example(Role role, int totalOTs, int numThreads, std::string ip, std::string tag, CLP& clp) { return baseOT_example_from_ot(role, totalOTs, numThreads, ip, tag, clp, BaseOT()); } }
29.807692
122
0.605591
83ec4ed9bac66f3fc9a0338e7c975e2ed6263b4c
4,871
h
C
src/connectivity/bluetooth/core/bt-host/gap/discovery_filter.h
zhangpf/fuchsia-rs
903568f28ddf45f09157ead36d61b50322c9cf49
[ "BSD-3-Clause" ]
1
2019-10-09T10:50:57.000Z
2019-10-09T10:50:57.000Z
src/connectivity/bluetooth/core/bt-host/gap/discovery_filter.h
zhangpf/fuchsia-rs
903568f28ddf45f09157ead36d61b50322c9cf49
[ "BSD-3-Clause" ]
5
2020-09-06T09:02:06.000Z
2022-03-02T04:44:22.000Z
src/connectivity/bluetooth/core/bt-host/gap/discovery_filter.h
ZVNexus/fuchsia
c5610ad15208208c98693618a79c705af935270c
[ "BSD-3-Clause" ]
null
null
null
// Copyright 2017 The Fuchsia Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef SRC_CONNECTIVITY_BLUETOOTH_CORE_BT_HOST_GAP_DISCOVERY_FILTER_H_ #define SRC_CONNECTIVITY_BLUETOOTH_CORE_BT_HOST_GAP_DISCOVERY_FILTER_H_ #include <string> #include <vector> #include "src/connectivity/bluetooth/core/bt-host/common/uuid.h" #include "src/connectivity/bluetooth/core/bt-host/hci/hci_constants.h" namespace bt { class ByteBuffer; namespace gap { class Peer; // A DiscoveryFilter allows clients of discovery procedures to filter results // based on certain parameters, such as service UUIDs that might be present in // EIR or advertising data, or based on available proximity information, to name // a few. class DiscoveryFilter final { public: DiscoveryFilter() = default; // Discovery filter based on the "Flags" bit field in LE Advertising Data. If // |require_all| is true, then The filter is considered satisifed if ALL of // the bits set in |flags_bitfield| are present in the advertisement. // Otherwise, the filter is considered satisfied as long as one of the bits // set in |flags_bitfield| is present. void set_flags(uint8_t flags_bitfield, bool require_all = false) { flags_ = flags_bitfield; all_flags_required_ = require_all; } // Discovery filter based on whether or not a device is connectable. void set_connectable(bool connectable) { connectable_ = connectable; } // Sets the service UUIDs that should be present in a scan result. A scan // result satisfies this filter if it provides at least one of the provided // UUIDs. // // Passing an empty value for |service_uuids| effectively disables this // filter. void set_service_uuids(const std::vector<UUID>& service_uuids) { service_uuids_ = service_uuids; } // Sets a string to be matched against the device name. A scan result // satisifes this filter if part of the complete or shortened device name // fields matches |name_substring|. // // Passing an empty value for |name_substring| effectively disables this // filter. void set_name_substring(const std::string& name_substring) { name_substring_ = name_substring; } // Sets a device to be filtered by the pathloss (in dBm) of the radio wave. // This value is calculated using the received signal strength (measured // locally) and the transmission power of the signal (as reported by the // remote): // // Path Loss = RSSI - Tx Power // // If this filter parameter has been set and the pathloss value calculated for // a device greater than the provided |pathloss| value, then the scan result // will fail to satisfy this filter. // // If this filter parameter has been set and the pathloss value cannot be // calculated because the remote device did not report its transmission power, // then the device will fail to satisfy this filter UNLESS an RSSI filter // parameter has been set via SetRSSI() that is satisfied by the scan result. void set_pathloss(int8_t pathloss) { pathloss_ = pathloss; } // Sets a device to be filtered by RSSI. While this can produce inaccurate // results when used alone to approximate proximity, it can still be useful // when the scan results do not provide the remote device's Transmission // Power. // // A remote device is considered to satisfy this filter parameter if the RSSI // of the received transmission is greater than or equal to |rssi|, except if // a path loss filter was provided via SetPathLoss() which the remote device // failed to satisfy (see comments on SetPathLoss()). void set_rssi(int8_t rssi) { rssi_ = rssi; } // Sets a device to be filtered by manufacturer specific data. A scan result // satisfies this filter if it advertises manufacturer specific data // containing |manufacturer_code|. void set_manufacturer_code(uint16_t manufacturer_code) { manufacturer_code_ = manufacturer_code; } // Sets this filter up for the "General Discovery" procedure. void SetGeneralDiscoveryFlags(); // Returns true, if the given LE scan result satisfies this filter. Otherwise // returns false. |advertising_data| should include scan response data, if // any. bool MatchLowEnergyResult(const ByteBuffer& advertising_data, bool connectable, int8_t rssi) const; // Clears all the fields of this filter. void Reset(); private: std::vector<UUID> service_uuids_; std::string name_substring_; std::optional<uint8_t> flags_; bool all_flags_required_; std::optional<bool> connectable_; std::optional<uint16_t> manufacturer_code_; std::optional<int8_t> pathloss_; std::optional<int8_t> rssi_; }; } // namespace gap } // namespace bt #endif // SRC_CONNECTIVITY_BLUETOOTH_CORE_BT_HOST_GAP_DISCOVERY_FILTER_H_
38.968
80
0.746048
b32c998988cbd9da9d390663824e971427b11d3c
1,445
h
C
EasySwift_iOS/3party/FORScrollViewEmptyAssistant_iOS.framework/Headers/FOREmptyAssistantConfiger.h
EasySwift/EasySwift
898647e4540bb89913530c6ae285db2cd8fa3397
[ "Apache-2.0" ]
16
2016-08-19T09:55:49.000Z
2021-08-24T01:55:36.000Z
EasySwift_iOS/3party/FORScrollViewEmptyAssistant_iOS.framework/Headers/FOREmptyAssistantConfiger.h
mohsinalimat/EasySwift
898647e4540bb89913530c6ae285db2cd8fa3397
[ "Apache-2.0" ]
2
2016-10-22T17:12:12.000Z
2018-09-25T08:11:23.000Z
EasySwift_iOS/3party/FORScrollViewEmptyAssistant_iOS.framework/Headers/FOREmptyAssistantConfiger.h
mohsinalimat/EasySwift
898647e4540bb89913530c6ae285db2cd8fa3397
[ "Apache-2.0" ]
3
2016-09-25T07:45:14.000Z
2018-12-12T08:09:56.000Z
// // FOREmptyAssistantConfiger.h // 51offer // // Created by XcodeYang on 12/10/15. // Copyright © 2015 51offer. All rights reserved. // #import <UIKit/UIKit.h> typedef BOOL(^ShouldDisplay)(); @interface FOREmptyAssistantConfiger : NSObject @property (nonatomic, strong) UIImage *emptyImage; // default @"" @property (nonatomic, copy) NSString *emptyTitle; // default systemFontOfSize:17.0f @property (nonatomic, strong) UIFont *emptyTitleFont; // default darkGrayColor @property (nonatomic, strong) UIColor *emptyTitleColor; // default @"" @property (nonatomic, copy) NSString *emptySubtitle; // default systemFontOfSize:15.0f @property (nonatomic, strong) UIFont *emptySubtitleFont; // default lightGrayColor @property (nonatomic, strong) UIColor *emptySubtitleColor; // default systemFontOfSize:17.0f @property (nonatomic, strong) UIFont *emptyBtntitleFont; // default whiteColor @property (nonatomic, strong) UIColor *emptyBtntitleColor; // default "blank_button" @property (nonatomic, strong) UIImage *emptyBtnImage; // default CGPointZero //空白页整体位置默认是在tableView居中显示 @property (nonatomic) CGPoint emptyCenterOffset; // default (x:0, y:-30) //空白页的图片、按钮、文案之间的间距大小 @property (nonatomic) CGFloat emptySpaceHeight; // default YES //添加空白页后ScrollView是否可以继续拖拽 @property (nonatomic) BOOL allowScroll; // default YES //添加空白页后ScrollView是否可以展示 @property (nonatomic) ShouldDisplay shouldDisplay; @end
24.913793
60
0.752249
9f244cab619d442aaa882febf80d0d7ac54232cd
3,645
h
C
include/hermes/VM/DecoratedObject.h
ScriptBox99/microsoft-hermes-windows
c7eb49152bcb5fa6812c3413a80ffc5bb937bb0c
[ "MIT" ]
3
2022-01-03T20:57:16.000Z
2022-01-26T06:25:58.000Z
include/hermes/VM/DecoratedObject.h
0xgpapad/hermes
903ca2b44ae0434a5d548af1ec1c10e34bc31836
[ "MIT" ]
null
null
null
include/hermes/VM/DecoratedObject.h
0xgpapad/hermes
903ca2b44ae0434a5d548af1ec1c10e34bc31836
[ "MIT" ]
null
null
null
/* * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ #ifndef HERMES_VM_DECORATEDOBJECT_H #define HERMES_VM_DECORATEDOBJECT_H #include "hermes/VM/JSObject.h" #include <memory> namespace hermes { namespace vm { /// A DecoratedObject is a subclass of JSObject which owns a pointer to a /// native C++ object, called its Decoration. (This has nothing to do with /// jsi::RuntimeDecoration or anything else in jsi/decorator.h.) It can also /// include additional internal slots, as in OrdinaryObjectCreate's /// additionalInternalSlotsList). class DecoratedObject : public JSObject { public: struct Decoration { /// The destructor is called when the decorated object is finalized. /// Do not attempt to manipulate the Runtime from within this destructor. virtual ~Decoration() = default; /// If implemented, this returns the size of the decoration, for memory /// usage reporting. The default implementation returns sizeof(*this). virtual size_t getMallocSize() const; }; /// Allocate a DecoratedObject with the given prototype and decoration. /// \param additionalSlotCount internal slots to reserve within the /// object. Only a small number of slots are available; this value /// cannot be greater than InternalProperty::NumInternalProperties - /// numOverlaps, which is currently 3. /// If allocation fails, the GC declares an OOM. static PseudoHandle<DecoratedObject> create( Runtime *runtime, Handle<JSObject> parentHandle, std::unique_ptr<Decoration> decoration, unsigned int additionalSlotCount = 0); /// Access the decoration. Decoration *getDecoration() { return decoration_.get(); } /// Access the decoration. const Decoration *getDecoration() const { return decoration_.get(); } /// Set the decoration to a new value \p value. void setDecoration(std::unique_ptr<Decoration> val) { decoration_ = std::move(val); } /// \return the value in an additional slot. /// \param index must be less than the \c additionalSlotCount passed to /// the create method. static SmallHermesValue getAdditionalSlotValue( DecoratedObject *self, Runtime *runtime, unsigned index) { return JSObject::getInternalProperty( self, runtime, numOverlapSlots<DecoratedObject>() + index); } /// Set the value in an additional slot. /// \param index must be less than the \c additionalSlotCount passed to /// the create method. static void setAdditionalSlotValue( DecoratedObject *self, Runtime *runtime, unsigned index, SmallHermesValue value) { JSObject::setInternalProperty( self, runtime, numOverlapSlots<DecoratedObject>() + index, value); } using Super = JSObject; static const ObjectVTable vt; static bool classof(const GCCell *cell) { return kindInRange( cell->getKind(), CellKind::DecoratedObjectKind_first, CellKind::DecoratedObjectKind_last); } public: ~DecoratedObject() = default; DecoratedObject( Runtime *runtime, const ObjectVTable *vt, Handle<JSObject> parent, Handle<HiddenClass> clazz, std::unique_ptr<Decoration> decoration) : JSObject(runtime, &vt->base, *parent, *clazz), decoration_(std::move(decoration)) {} protected: static void _finalizeImpl(GCCell *cell, GC *); static size_t _mallocSizeImpl(GCCell *cell); private: std::unique_ptr<Decoration> decoration_; }; } // namespace vm } // namespace hermes #endif
30.889831
77
0.708916
7af2e3b84f77c3461c0dc73a3d438ef4030107f7
274
h
C
DesignPatterns_OC/Views/CanvasView.h
GeekLee609/DesignPatterns_iOS
1fb3a75219a2b0e79b1f053f4360129c681c5830
[ "MIT" ]
4
2018-12-17T07:43:49.000Z
2020-07-14T06:01:54.000Z
DesignPatterns_OC/Views/CanvasView.h
GeekLee609/DesignPatterns_iOS
1fb3a75219a2b0e79b1f053f4360129c681c5830
[ "MIT" ]
null
null
null
DesignPatterns_OC/Views/CanvasView.h
GeekLee609/DesignPatterns_iOS
1fb3a75219a2b0e79b1f053f4360129c681c5830
[ "MIT" ]
null
null
null
// // CanvasView.h // 4_factoryMethod_DesignPatters // // Created by polo on 2018/12/2. // Copyright © 2018年 GeekLee. All rights reserved. // #import <UIKit/UIKit.h> @protocol Mark ; @interface CanvasView : UIView @property (nonatomic, strong) id <Mark> mark; @end
15.222222
51
0.693431
bb586abd68d9d5de5a28ed2f72e53c2628d51586
296
h
C
src/io/pch.h
smogpill/core
56ef53fda4582d7d4c1ade17e90e24d0a5128a8d
[ "MIT" ]
1
2016-06-23T07:02:30.000Z
2016-06-23T07:02:30.000Z
src/io/pch.h
smogpill/core
56ef53fda4582d7d4c1ade17e90e24d0a5128a8d
[ "MIT" ]
null
null
null
src/io/pch.h
smogpill/core
56ef53fda4582d7d4c1ade17e90e24d0a5128a8d
[ "MIT" ]
null
null
null
// Copyright(c) 2016 Jounayd Id Salah // Distributed under the MIT License (See accompanying file LICENSE.md file or copy at http://opensource.org/licenses/MIT). #pragma once #include <stdio.h> #include <inttypes.h> #include "io/publicPCH.h" #include "platform/coOsHeaders.h" #include <shlobj.h>
32.888889
123
0.756757
1849d1d423968a71cea7efc70434aa862ef8bae6
2,812
h
C
window/goWindow.h
Qolzam/robotgo
3f2bd94d608e642b6032fce9bed7a0dce1deaa4a
[ "Apache-2.0" ]
null
null
null
window/goWindow.h
Qolzam/robotgo
3f2bd94d608e642b6032fce9bed7a0dce1deaa4a
[ "Apache-2.0" ]
null
null
null
window/goWindow.h
Qolzam/robotgo
3f2bd94d608e642b6032fce9bed7a0dce1deaa4a
[ "Apache-2.0" ]
null
null
null
// Copyright 2016 The go-vgo Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // https://github.com/Qolzam/robotgo/blob/master/LICENSE // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your // option. This file may not be copied, modified, or distributed // except according to those terms. #include "alert_c.h" #include "window.h" #include "win_sys.h" int show_alert(const char *title, const char *msg, const char *defaultButton, const char *cancelButton){ int alert = showAlert(title, msg, defaultButton, cancelButton); return alert; } intptr scale_x(){ return scaleX(); } intptr scale_y(){ return scaleY(); } bool is_valid(){ bool abool = IsValid(); return abool; } // int find_window(char* name){ // int z = findwindow(name); // return z; // } void min_window(uintptr pid, bool state, uintptr isHwnd){ #if defined(IS_MACOSX) // return 0; AXUIElementRef axID = AXUIElementCreateApplication(pid); AXUIElementSetAttributeValue(axID, kAXMinimizedAttribute, state ? kCFBooleanTrue : kCFBooleanFalse); #elif defined(USE_X11) // Ignore X errors XDismissErrors(); // SetState((Window)pid, STATE_MINIMIZE, state); #elif defined(IS_WINDOWS) if (isHwnd == 0) { HWND hwnd = GetHwndByPId(pid); win_min(hwnd, state); } else { win_min((HWND)pid, state); } #endif } void max_window(uintptr pid, bool state, uintptr isHwnd){ #if defined(IS_MACOSX) // return 0; #elif defined(USE_X11) XDismissErrors(); // SetState((Window)pid, STATE_MINIMIZE, false); // SetState((Window)pid, STATE_MAXIMIZE, state); #elif defined(IS_WINDOWS) if (isHwnd == 0) { HWND hwnd = GetHwndByPId(pid); win_max(hwnd, state); } else { win_max((HWND)pid, state); } #endif } void close_window(uintptr pid, uintptr isHwnd){ close_window_by_PId(pid, isHwnd); } bool set_handle(uintptr handle){ bool hwnd = setHandle(handle); return hwnd; } uintptr get_handle(){ MData mData = GetActive(); #if defined(IS_MACOSX) return (uintptr)mData.CgID; #elif defined(USE_X11) return (uintptr)mData.XWin; #elif defined(IS_WINDOWS) return (uintptr)mData.HWnd; #endif } uintptr bget_handle(){ uintptr hwnd = getHandle(); return hwnd; } void set_active(const MData win){ SetActive(win); } void active_PID(uintptr pid, uintptr isHwnd){ MData win = set_handle_pid(pid, isHwnd); SetActive(win); } MData get_active(){ MData mdata = GetActive(); return mdata; } char* get_title(uintptr pid, uintptr isHwnd){ char* title = get_title_by_pid(pid, isHwnd); // printf("title::::%s\n", title ); return title; } int32 get_PID(void){ int pid = WGetPID(); return pid; }
21.96875
68
0.707326
bb84a98c17f32aaa58adeec727d46a2c8e1faf0d
6,423
h
C
include/External/stlib/packages/amr/DistributedOrthtree.h
bxl295/m4extreme
2a4a20ebb5b4e971698f7c981de140d31a5e550c
[ "BSD-3-Clause" ]
null
null
null
include/External/stlib/packages/amr/DistributedOrthtree.h
bxl295/m4extreme
2a4a20ebb5b4e971698f7c981de140d31a5e550c
[ "BSD-3-Clause" ]
null
null
null
include/External/stlib/packages/amr/DistributedOrthtree.h
bxl295/m4extreme
2a4a20ebb5b4e971698f7c981de140d31a5e550c
[ "BSD-3-Clause" ]
null
null
null
// -*- C++ -*- /*! \file amr/DistributedOrthtree.h \brief A distributed orthtree. */ #if !defined(__amr_DistributedOrthtree_h__) #define __amr_DistributedOrthtree_h__ #include "Orthtree.h" #include "CellData.h" #include <numeric> #include <mpi.h> namespace amr { //! A distributed orthtree. /*! CONTINUE: Use threading for the computationally expensive tasks. */ template < class _Patch, class _Traits, template<class _Patch, class _Traits> class _PatchHelper > class DistributedOrthtree { // // Public types. // public: //! The patch type. typedef _Patch Patch; //! A multi-index. typedef typename _Traits::IndexList IndexList; //! A spatial index. typedef typename _Traits::SpatialIndex SpatialIndex; //! The orthtree data structure. typedef Orthtree<Patch, _Traits> OrthtreeType; //! An iterator in the orthtree data structure. typedef typename OrthtreeType::iterator iterator; //! A const iterator in the orthtree data structure. typedef typename OrthtreeType::const_iterator const_iterator; //! The patch helper. typedef _PatchHelper<Patch, _Traits> PatchHelper; //! The size type. typedef std::size_t size_type; //! The pointer difference type. typedef std::ptrdiff_t difference_type; // // Private enumerations. // private: enum {NumberOfNodesMessage, SpatialIndexMessage, PatchMessage, NodesMessage}; // // Member data. // private: MPI::Intracomm _communicator; int _communicatorSize; int _communicatorRank; const PatchHelper* _helper; // The delimiters for the distributed orthtree. std::vector<SpatialIndex> _delimiters; // The nodes to send when performing an exchange. The key is the processor ID. std::map<int, std::vector<const_iterator> > _nodesToSend; // The nodes to receive when performing an exchange. The key is the // processor ID. std::map<int, std::vector<iterator> > _nodesToReceive; // // Not implemented. // private: //! Default constructor not implemented. DistributedOrthtree(); //! Copy constructor not implemented. DistributedOrthtree(const DistributedOrthtree& other); //! Assignment operator not implemented. DistributedOrthtree& operator=(const DistributedOrthtree& other); //-------------------------------------------------------------------------- //! \name Constructors etc. //@{ public: //! Construct from the communicator and the patch helper. DistributedOrthtree(const MPI::Intracomm& communicator, const PatchHelper* helper) : _communicator(communicator.Dup()), _communicatorSize(_communicator.Get_size()), _communicatorRank(_communicator.Get_rank()), _helper(helper), _delimiters(_communicatorSize + 1) { } //! Destructor. ~DistributedOrthtree() { _communicator.Free(); } //@} //-------------------------------------------------------------------------- //! \name Accessors. //@{ public: //! Get the patch helper. const PatchHelper& getPatchHelper() const { return *_helper; } //! Get the orthtree. OrthtreeType& getOrthtree() const { return _helper->getOrthtree(); } //! Get the process identifier that owns the indicated node. int getProcess(const SpatialIndex& spatialIndex) const { const difference_type index = std::lower_bound(_delimiters.begin(), _delimiters.end(), spatialIndex) - _delimiters.begin(); return index - (spatialIndex.getCode() != _delimiters[index].getCode()); } //@} //-------------------------------------------------------------------------- //! \name Partition. //@{ public: //! Partition the nodes. void partition(); private: //! Compute the partition delimiters. void computePartitionDelimiters(); //! Determine the processors from which we will receive nodes. template<typename _OutputIterator> void computeProcessesToReceiveFrom (const std::vector<SpatialIndex>& currentDelimiters, _OutputIterator processes); //! Determine the processors to which we will send nodes. template<typename _OutputIterator> void computeProcessesToSendTo(const SpatialIndex& first, const SpatialIndex& last, _OutputIterator processes); //! Determine the nodes to send to the specified process. template<typename _OutputIterator> void computeNodesToSend(const int process, _OutputIterator nodes); //! Gather the spatial index delimiters. void gatherDelimiters(std::vector<SpatialIndex>* currentDelimiters); //@} //-------------------------------------------------------------------------- //! \name Exchange. //@{ public: //! Set up the exchange of adjacent nodes. void exchangeAdjacentSetUp(); //! Exchange the adjacent node patches. /*! \pre exchangeAdjacentSetUp() must be called first. After that, this function may be called any number of times. This function exchanges the patches only; it doesn't need to send the spatial indices. exchangeAdjacentSetUp() takes care of that. */ void exchangeAdjacent(); //! Remove the ghost nodes and tear down the data structure for the exchange of adjacent nodes. void exchangeAdjacentTearDown(); private: // Determine the nodes to send in the exchange of adjacent nodes. void exchangeAdjacentDetermineNodesToSend(); // Determine the nodes to send in the exchange of adjacent nodes. void exchangeAdjacentDetermineHowManyNodesToReceive(); //! Exchange the nodes keys. Insert ghost nodes for the nodes we will be receiving. void exchangeAdjacentSpatialIndicesAndInsertGhostNodes(); //@} //-------------------------------------------------------------------------- //! \name Balance. //@{ public: //! Perform refinement to balance the tree. /*! \return The number of refinement operations. */ int balance(); //@} }; } // namespace amr #define __amr_DistributedOrthtree_ipp__ #include "DistributedOrthtree.ipp" #undef __amr_DistributedOrthtree_ipp__ #endif
27.101266
99
0.622139
bbaf670df2f0d06d549c645f53748d39cab4ca6c
764
h
C
Sources/Overload/OvUI/include/OvUI/Widgets/Sliders/SliderMultipleDoubles.h
kmqwerty/Overload
f3b8c751a05815400ed35dd2be20a3900f3454fd
[ "MIT" ]
755
2019-07-10T01:26:39.000Z
2022-03-31T12:43:19.000Z
Sources/Overload/OvUI/include/OvUI/Widgets/Sliders/SliderMultipleDoubles.h
kmqwerty/Overload
f3b8c751a05815400ed35dd2be20a3900f3454fd
[ "MIT" ]
111
2020-02-28T23:30:10.000Z
2022-01-18T13:57:30.000Z
Sources/Overload/OvUI/include/OvUI/Widgets/Sliders/SliderMultipleDoubles.h
kmqwerty/Overload
f3b8c751a05815400ed35dd2be20a3900f3454fd
[ "MIT" ]
97
2019-11-06T15:19:56.000Z
2022-03-25T08:40:04.000Z
/** * @project: Overload * @author: Overload Tech. * @licence: MIT */ #pragma once #include "OvUI/Widgets/Sliders/SliderMultipleScalars.h" namespace OvUI::Widgets::Sliders { /** * Slider widget of multiple type double */ template <size_t _Size> class SliderMultipleDoubles : public SliderMultipleScalars<double, _Size> { public: /** * Constructor * @param p_min * @param p_max * @param p_value * @param p_label * @param p_format */ SliderMultipleDoubles ( double p_min = 0.0, double p_max = 1.0, double p_value = 0.5, const std::string& p_label = "", const std::string& p_format = "%.6f" ) : SliderMultipleScalars<double, _Size>(ImGuiDataType_::ImGuiDataType_Double, p_min, p_max, p_value, p_label, p_format) {} }; }
20.648649
125
0.681937
5baaade71e968f9f34fc2ba7925c25aa70cbafe6
60
h
C
Chapter_12/8/calc.h
Upr82/Learning_C
6b85194b746afb9a4edd226a5d289c3f044fff72
[ "MIT" ]
null
null
null
Chapter_12/8/calc.h
Upr82/Learning_C
6b85194b746afb9a4edd226a5d289c3f044fff72
[ "MIT" ]
null
null
null
Chapter_12/8/calc.h
Upr82/Learning_C
6b85194b746afb9a4edd226a5d289c3f044fff72
[ "MIT" ]
null
null
null
int my_rand(int edges, int cubes); extern int count, total;
20
34
0.75
1787ab8b9bbbde1750bbeaa40dc2dd1d01c27928
1,866
h
C
System/Library/PrivateFrameworks/ChatKit.framework/CKCurrentConversationsManager.h
zhangkn/iOS14Header
4323e9459ed6f6f5504ecbea2710bfd6c3d7c946
[ "MIT" ]
1
2020-11-04T15:43:01.000Z
2020-11-04T15:43:01.000Z
System/Library/PrivateFrameworks/ChatKit.framework/CKCurrentConversationsManager.h
zhangkn/iOS14Header
4323e9459ed6f6f5504ecbea2710bfd6c3d7c946
[ "MIT" ]
null
null
null
System/Library/PrivateFrameworks/ChatKit.framework/CKCurrentConversationsManager.h
zhangkn/iOS14Header
4323e9459ed6f6f5504ecbea2710bfd6c3d7c946
[ "MIT" ]
null
null
null
/* * This header is generated by classdump-dyld 1.0 * on Sunday, September 27, 2020 at 11:40:12 AM Mountain Standard Time * Operating System: Version 14.0 (Build 18A373) * Image Source: /System/Library/PrivateFrameworks/ChatKit.framework/ChatKit * classdump-dyld is licensed under GPLv3, Copyright © 2013-2016 by Elias Limneos. */ @class NSCountedSet, NSMutableDictionary, IMDoubleLinkedList; @interface CKCurrentConversationsManager : NSObject { NSCountedSet* _currentConversations; NSMutableDictionary* _idToNodeDictionary; IMDoubleLinkedList* _orderedKeys; } @property (nonatomic,retain) NSCountedSet * currentConversations; //@synthesize currentConversations=_currentConversations - In the implementation block @property (nonatomic,retain) NSMutableDictionary * idToNodeDictionary; //@synthesize idToNodeDictionary=_idToNodeDictionary - In the implementation block @property (nonatomic,retain) IMDoubleLinkedList * orderedKeys; //@synthesize orderedKeys=_orderedKeys - In the implementation block @property (nonatomic,readonly) unsigned long long cacheSize; +(id)sharedInstance; -(unsigned long long)cacheSize; -(void)removeConversation:(id)arg1 ; -(void)purgeConversations:(id)arg1 ; -(void)addConversation:(id)arg1 ; -(void)loadHistoryForConversation:(id)arg1 keepAllCurrentlyLoadedMessages:(BOOL)arg2 ; -(void)pruneCache; -(NSCountedSet *)currentConversations; -(NSMutableDictionary *)idToNodeDictionary; -(void)pruneCacheToSize:(unsigned long long)arg1 ; -(void)_prepareToDumpCachedConversation:(id)arg1 ; -(void)purgeConversation:(id)arg1 ; -(BOOL)_canDumpConversationFromCache:(id)arg1 ; -(void)setCurrentConversations:(NSCountedSet *)arg1 ; -(void)setIdToNodeDictionary:(NSMutableDictionary *)arg1 ; -(void)setOrderedKeys:(IMDoubleLinkedList *)arg1 ; -(IMDoubleLinkedList *)orderedKeys; @end
43.395349
170
0.785638
8d25893bcfcff0cb1c72a2755ecafa7870d51db3
1,728
h
C
SmartDeviceLink/SDLShowConstantTBT.h
d503int/sdl_ios
9912c99602a169de5c573ee445ef13bd2817e91e
[ "BSD-3-Clause" ]
null
null
null
SmartDeviceLink/SDLShowConstantTBT.h
d503int/sdl_ios
9912c99602a169de5c573ee445ef13bd2817e91e
[ "BSD-3-Clause" ]
null
null
null
SmartDeviceLink/SDLShowConstantTBT.h
d503int/sdl_ios
9912c99602a169de5c573ee445ef13bd2817e91e
[ "BSD-3-Clause" ]
null
null
null
// SDLShowConstantTBT.h // #import "SDLRPCRequest.h" @class SDLImage; @class SDLSoftButton; /** This RPC is used to update the user with navigation information<br> * for the constantly shown screen (base screen),but also for the<br> * alert type screen. *<p> * @since SmartDeviceLink 2.0 */ NS_ASSUME_NONNULL_BEGIN @interface SDLShowConstantTBT : SDLRPCRequest - (instancetype)initWithNavigationText1:(nullable NSString *)navigationText1 navigationText2:(nullable NSString *)navigationText2 eta:(nullable NSString *)eta timeToDestination:(nullable NSString *)timeToDestination totalDistance:(nullable NSString *)totalDistance turnIcon:(nullable SDLImage *)turnIcon nextTurnIcon:(nullable SDLImage *)nextTurnIcon distanceToManeuver:(double)distanceToManeuver distanceToManeuverScale:(double)distanceToManeuverScale maneuverComplete:(BOOL)maneuverComplete softButtons:(nullable NSArray<SDLSoftButton *> *)softButtons; @property (strong, nonatomic, nullable) NSString *navigationText1; @property (strong, nonatomic, nullable) NSString *navigationText2; @property (strong, nonatomic, nullable) NSString *eta; @property (strong, nonatomic, nullable) NSString *timeToDestination; @property (strong, nonatomic, nullable) NSString *totalDistance; @property (strong, nonatomic, nullable) SDLImage *turnIcon; @property (strong, nonatomic, nullable) SDLImage *nextTurnIcon; @property (strong, nonatomic, nullable) NSNumber<SDLFloat> *distanceToManeuver; @property (strong, nonatomic, nullable) NSNumber<SDLFloat> *distanceToManeuverScale; @property (strong, nonatomic, nullable) NSNumber<SDLBool> *maneuverComplete; @property (strong, nonatomic, nullable) NSArray<SDLSoftButton *> *softButtons; @end NS_ASSUME_NONNULL_END
46.702703
554
0.807292
8d396c46c840175687f52a4529df258629868e24
1,957
h
C
libdtrace/dt_symtab.h
LaudateCorpus1/dtrace-utils
8ef492246aef8c034151a75a158163f42c635ec3
[ "UPL-1.0" ]
null
null
null
libdtrace/dt_symtab.h
LaudateCorpus1/dtrace-utils
8ef492246aef8c034151a75a158163f42c635ec3
[ "UPL-1.0" ]
null
null
null
libdtrace/dt_symtab.h
LaudateCorpus1/dtrace-utils
8ef492246aef8c034151a75a158163f42c635ec3
[ "UPL-1.0" ]
null
null
null
/* * Symbol table support for DTrace. */ /* * Oracle Linux DTrace. * Copyright (c) 2012, 2021, Oracle and/or its affiliates. All rights reserved. * Licensed under the Universal Permissive License v 1.0 as shown at * http://oss.oracle.com/licenses/upl. */ #ifndef _DT_SYMTAB_H #define _DT_SYMTAB_H #include <gelf.h> #include <dtrace.h> #ifdef __cplusplus extern "C" { #endif /* * We cannot rely on ELF symbol table management at all times: in particular, * kernel symbols have no ELF symbol table. Thus, this module implements a * simple, reasonably memory-efficient symbol table manager. Once built up, the * symbol table needs sorting before it can be used for address->name lookup. It * can also be packed, which increases efficiency further but forbids further * modification. (We do not define whether the 'more efficient' form increases * space- or time-efficiency.) */ typedef struct dt_symbol dt_symbol_t; typedef struct dt_symtab dt_symtab_t; struct dt_module; extern dt_symtab_t *dt_symtab_create(dtrace_hdl_t *dtp); extern void dt_symtab_destroy(dtrace_hdl_t *dtp, dt_symtab_t *symtab); extern dt_symbol_t *dt_symbol_insert(dtrace_hdl_t *dtp, dt_symtab_t *symtab, struct dt_module *dmp, const char *name, GElf_Addr addr, GElf_Xword size, unsigned char info); extern dt_symbol_t *dt_symbol_by_name(dtrace_hdl_t *dtp, const char *name); extern dt_symbol_t *dt_module_symbol_by_name(dtrace_hdl_t *dtp, struct dt_module *dmp, const char *name); extern dt_symbol_t *dt_symbol_by_addr(dt_symtab_t *symtab, GElf_Addr dts_addr); extern void dt_symtab_sort(dt_symtab_t *symtab, int flag); extern void dt_symtab_pack(dt_symtab_t *symtab); extern const char *dt_symbol_name(const dt_symbol_t *symbol); extern void dt_symbol_to_elfsym(dtrace_hdl_t *dtp, dt_symbol_t *symbol, GElf_Sym *elf_symp); extern struct dt_module *dt_symbol_module(dt_symbol_t *symbol); #ifdef __cplusplus } #endif #endif /* _DT_SYMTAB_H */
33.169492
80
0.774144
a5c8412a447dabff245c8d56f13c402992fb21fa
6,115
h
C
3P/_outside_libraries/Random123/features/xlcfeatures.h
DL42/3P_custom_synonymous
657fedddb8f97243243f03c460e6e43ea5ed432c
[ "MIT" ]
236
2015-03-31T15:39:30.000Z
2022-03-24T01:43:14.000Z
3P/_outside_libraries/Random123/features/xlcfeatures.h
DL42/3P_custom_synonymous
657fedddb8f97243243f03c460e6e43ea5ed432c
[ "MIT" ]
362
2016-05-06T18:26:35.000Z
2022-03-30T16:39:46.000Z
3P/_outside_libraries/Random123/features/xlcfeatures.h
DL42/3P_custom_synonymous
657fedddb8f97243243f03c460e6e43ea5ed432c
[ "MIT" ]
41
2015-05-26T12:38:42.000Z
2022-01-10T15:16:37.000Z
/* Copyright 2010-2011, D. E. Shaw Research. 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 D. E. Shaw Research 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. Copyright (c) 2013, Los Alamos National Security, LLC All rights reserved. Copyright 2013. Los Alamos National Security, LLC. This software was produced under U.S. Government contract DE-AC52-06NA25396 for Los Alamos National Laboratory (LANL), which is operated by Los Alamos National Security, LLC for the U.S. Department of Energy. The U.S. Government has rights to use, reproduce, and distribute this software. NEITHER THE GOVERNMENT NOR LOS ALAMOS NATIONAL SECURITY, LLC MAKES ANY WARRANTY, EXPRESS OR IMPLIED, OR ASSUMES ANY LIABILITY FOR THE USE OF THIS SOFTWARE. If software is modified to produce derivative works, such modified software should be clearly marked, so as not to confuse it with the version available from LANL. */ #ifndef __xlcfeatures_dot_hpp #define __xlcfeatures_dot_hpp #if !defined(__x86_64__) && !defined(__i386__) && !defined(__powerpc__) # error "This code has only been tested on x86 and PowerPC platforms." #include <including_a_nonexistent_file_will_stop_some_compilers_from_continuing_with_a_hopeless_task> { /* maybe an unbalanced brace will terminate the compilation */ /* Feel free to try the Random123 library on other architectures by changing the conditions that reach this error, but you should consider it a porting exercise and expect to encounter bugs and deficiencies. Please let the authors know of any successes (or failures). */ #endif #ifdef __cplusplus /* builtins are automatically available to xlc. To use them with xlc++, one must include builtins.h. c.f http://publib.boulder.ibm.com/infocenter/cellcomp/v101v121/index.jsp?topic=/com.ibm.xlcpp101.cell.doc/compiler_ref/compiler_builtins.html */ #include <builtins.h> #endif #ifndef R123_STATIC_INLINE #define R123_STATIC_INLINE static inline #endif #ifndef R123_FORCE_INLINE #define R123_FORCE_INLINE(decl) decl __attribute__((__always_inline__)) #endif #ifndef R123_CUDA_DEVICE #define R123_CUDA_DEVICE #endif #ifndef R123_ASSERT #include <assert.h> #define R123_ASSERT(x) assert(x) #endif #ifndef R123_BUILTIN_EXPECT #define R123_BUILTIN_EXPECT(expr,likely) __builtin_expect(expr,likely) #endif #ifndef R123_USE_AES_NI #define R123_USE_AES_NI 0 #endif #ifndef R123_USE_SSE4_2 #define R123_USE_SSE4_2 0 #endif #ifndef R123_USE_SSE4_1 #define R123_USE_SSE4_1 0 #endif #ifndef R123_USE_SSE #define R123_USE_SSE 0 #endif #ifndef R123_USE_AES_OPENSSL /* There isn't really a good way to tell at compile time whether openssl is available. Without a pre-compilation configure-like tool, it's less error-prone to guess that it isn't available. Add -DR123_USE_AES_OPENSSL=1 and any necessary LDFLAGS or LDLIBS to play with openssl */ #define R123_USE_AES_OPENSSL 0 #endif #ifndef R123_USE_GNU_UINT128 #define R123_USE_GNU_UINT128 0 #endif #ifndef R123_USE_ASM_GNU #define R123_USE_ASM_GNU 1 #endif #ifndef R123_USE_CPUID_MSVC #define R123_USE_CPUID_MSVC 0 #endif #ifndef R123_USE_X86INTRIN_H #define R123_USE_X86INTRIN_H 0 #endif #ifndef R123_USE_IA32INTRIN_H #define R123_USE_IA32INTRIN_H 0 #endif #ifndef R123_USE_XMMINTRIN_H #define R123_USE_XMMINTRIN_H 0 #endif #ifndef R123_USE_EMMINTRIN_H #define R123_USE_EMMINTRIN_H 0 #endif #ifndef R123_USE_SMMINTRIN_H #define R123_USE_SMMINTRIN_H 0 #endif #ifndef R123_USE_WMMINTRIN_H #define R123_USE_WMMINTRIN_H 0 #endif #ifndef R123_USE_INTRIN_H #ifdef __ABM__ #define R123_USE_INTRIN_H 1 #else #define R123_USE_INTRIN_H 0 #endif #endif #ifndef R123_USE_MULHILO32_ASM #define R123_USE_MULHILO32_ASM 0 #endif #ifndef R123_USE_MULHILO64_MULHI_INTRIN #define R123_USE_MULHILO64_MULHI_INTRIN (defined(__powerpc64__)) #endif #ifndef R123_MULHILO64_MULHI_INTRIN #define R123_MULHILO64_MULHI_INTRIN __mulhdu #endif #ifndef R123_USE_MULHILO32_MULHI_INTRIN #define R123_USE_MULHILO32_MULHI_INTRIN 0 #endif #ifndef R123_MULHILO32_MULHI_INTRIN #define R123_MULHILO32_MULHI_INTRIN __mulhwu #endif #ifndef R123_USE_MULHILO64_ASM #define R123_USE_MULHILO64_ASM (defined(__powerpc64__) && !(R123_USE_MULHILO64_MULHI_INTRIN)) #endif #ifndef R123_USE_MULHILO64_MSVC_INTRIN #define R123_USE_MULHILO64_MSVC_INTRIN 0 #endif #ifndef R123_USE_MULHILO64_CUDA_INTRIN #define R123_USE_MULHILO64_CUDA_INTRIN 0 #endif #ifndef R123_USE_MULHILO64_OPENCL_INTRIN #define R123_USE_MULHILO64_OPENCL_INTRIN 0 #endif #ifndef __STDC_CONSTANT_MACROS #define __STDC_CONSTANT_MACROS #endif #include <stdint.h> #ifndef UINT64_C #error UINT64_C not defined. You must define __STDC_CONSTANT_MACROS before you #include <stdint.h> #endif /* If you add something, it must go in all the other XXfeatures.hpp and in ../ut_features.cpp */ #endif
30.123153
140
0.816353
53f6d7492d6c077724a7367bed684514d35a0930
2,649
h
C
client/client-multi/client-c/src/kaa/kaa_common.h
acHefei/anteater_hf
2d8cc2041b7f9a394541052f4c4c27e79af515d3
[ "ECL-2.0", "Apache-2.0" ]
1
2017-08-24T08:53:32.000Z
2017-08-24T08:53:32.000Z
client/client-multi/client-c/src/kaa/kaa_common.h
acHefei/anteater_hf
2d8cc2041b7f9a394541052f4c4c27e79af515d3
[ "ECL-2.0", "Apache-2.0" ]
2
2019-11-13T02:57:27.000Z
2020-12-02T18:34:01.000Z
client/client-multi/client-c/src/kaa/kaa_common.h
acHefei/anteater_hf
2d8cc2041b7f9a394541052f4c4c27e79af515d3
[ "ECL-2.0", "Apache-2.0" ]
1
2017-08-24T08:53:38.000Z
2017-08-24T08:53:38.000Z
/** * Copyright 2014-2016 CyberVision, 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. */ /** * @file kaa_common.h * @brief Common C EP SDK definitions and small utilities */ #ifndef KAA_COMMON_H_ #define KAA_COMMON_H_ #include "kaa_error.h" #ifdef __cplusplus extern "C" { #endif /* * Standard error handling macros */ #define KAA_RETURN_IF_ERR(E) \ do { if (E) return E; } while (0) #define KAA_RETURN_IF_NIL(p, E) \ do { if (!(p)) return E; } while (0) #define KAA_RETURN_IF_NIL2(p1, p2, E) \ do { if (!(p1) || !(p2)) return E; } while (0) #define KAA_RETURN_IF_NIL3(p1, p2, p3, E) \ do { if (!(p1) || !(p2) || !(p3)) return E; } while (0) #define KAA_RETURN_IF_NIL4(p1, p2, p3, p4, E) \ do { if (!(p1) || !(p2) || !(p3) || !(p4)) return E; } while (0) #define KAA_RETURN_IF_NIL5(p1, p2, p3, p4, p5,E) \ do { if (!(p1) || !(p2) || !(p3) || !(p4) || !(p5)) return E; } while (0) /** * @brief Types of Kaa platform services */ typedef enum { KAA_SERVICE_BOOTSTRAP = 0, KAA_SERVICE_PROFILE = 1, KAA_SERVICE_USER = 2, KAA_SERVICE_EVENT = 3, KAA_SERVICE_LOGGING = 4, KAA_SERVICE_CONFIGURATION = 5, KAA_SERVICE_NOTIFICATION = 6 } kaa_service_t; /** * @brief Identifier used to uniquely represent transport protocol. */ typedef struct { uint32_t id; uint16_t version; } kaa_transport_protocol_id_t; static inline int kaa_transport_protocol_id_equals(const kaa_transport_protocol_id_t *first, const kaa_transport_protocol_id_t *second) { return first && second && first->id == second->id && first->version == second->version; } /** * @brief Connection parameters used by transport channels to establish * connection both to Bootstrap and Operations servers. */ typedef struct { uint32_t id; uint16_t connection_data_len; char *connection_data; } kaa_access_point_t; /* * Endpoint ID */ #define KAA_ENDPOINT_ID_LENGTH 20 typedef uint8_t kaa_endpoint_id[KAA_ENDPOINT_ID_LENGTH]; typedef const uint8_t *kaa_endpoint_id_p; #ifdef __cplusplus } /* extern "C" */ #endif #endif /* KAA_COMMON_H_ */
25.718447
135
0.676482
3eb95059addf5bb8b6011798e93d074bde680b7e
112,519
c
C
src/ascarray.c
kernsuite-debian/kapteyn
7f76896812c7670aa6803afe913868c15f2d0921
[ "BSD-3-Clause" ]
1
2018-08-27T18:44:00.000Z
2018-08-27T18:44:00.000Z
src/ascarray.c
kernsuite-debian/kapteyn
7f76896812c7670aa6803afe913868c15f2d0921
[ "BSD-3-Clause" ]
null
null
null
src/ascarray.c
kernsuite-debian/kapteyn
7f76896812c7670aa6803afe913868c15f2d0921
[ "BSD-3-Clause" ]
null
null
null
/* Generated by Cython 0.15.1 on Mon Mar 3 12:35:19 2014 */ #define PY_SSIZE_T_CLEAN #include "Python.h" #ifndef Py_PYTHON_H #error Python headers needed to compile C extensions, please install development version of Python. #else #include <stddef.h> /* For offsetof */ #ifndef offsetof #define offsetof(type, member) ( (size_t) & ((type*)0) -> member ) #endif #if !defined(WIN32) && !defined(MS_WINDOWS) #ifndef __stdcall #define __stdcall #endif #ifndef __cdecl #define __cdecl #endif #ifndef __fastcall #define __fastcall #endif #endif #ifndef DL_IMPORT #define DL_IMPORT(t) t #endif #ifndef DL_EXPORT #define DL_EXPORT(t) t #endif #ifndef PY_LONG_LONG #define PY_LONG_LONG LONG_LONG #endif #if PY_VERSION_HEX < 0x02040000 #define METH_COEXIST 0 #define PyDict_CheckExact(op) (Py_TYPE(op) == &PyDict_Type) #define PyDict_Contains(d,o) PySequence_Contains(d,o) #endif #if PY_VERSION_HEX < 0x02050000 typedef int Py_ssize_t; #define PY_SSIZE_T_MAX INT_MAX #define PY_SSIZE_T_MIN INT_MIN #define PY_FORMAT_SIZE_T "" #define PyInt_FromSsize_t(z) PyInt_FromLong(z) #define PyInt_AsSsize_t(o) __Pyx_PyInt_AsInt(o) #define PyNumber_Index(o) PyNumber_Int(o) #define PyIndex_Check(o) PyNumber_Check(o) #define PyErr_WarnEx(category, message, stacklevel) PyErr_Warn(category, message) #endif #if PY_VERSION_HEX < 0x02060000 #define Py_REFCNT(ob) (((PyObject*)(ob))->ob_refcnt) #define Py_TYPE(ob) (((PyObject*)(ob))->ob_type) #define Py_SIZE(ob) (((PyVarObject*)(ob))->ob_size) #define PyVarObject_HEAD_INIT(type, size) \ PyObject_HEAD_INIT(type) size, #define PyType_Modified(t) typedef struct { void *buf; PyObject *obj; Py_ssize_t len; Py_ssize_t itemsize; int readonly; int ndim; char *format; Py_ssize_t *shape; Py_ssize_t *strides; Py_ssize_t *suboffsets; void *internal; } Py_buffer; #define PyBUF_SIMPLE 0 #define PyBUF_WRITABLE 0x0001 #define PyBUF_FORMAT 0x0004 #define PyBUF_ND 0x0008 #define PyBUF_STRIDES (0x0010 | PyBUF_ND) #define PyBUF_C_CONTIGUOUS (0x0020 | PyBUF_STRIDES) #define PyBUF_F_CONTIGUOUS (0x0040 | PyBUF_STRIDES) #define PyBUF_ANY_CONTIGUOUS (0x0080 | PyBUF_STRIDES) #define PyBUF_INDIRECT (0x0100 | PyBUF_STRIDES) #endif #if PY_MAJOR_VERSION < 3 #define __Pyx_BUILTIN_MODULE_NAME "__builtin__" #else #define __Pyx_BUILTIN_MODULE_NAME "builtins" #endif #if PY_MAJOR_VERSION >= 3 #define Py_TPFLAGS_CHECKTYPES 0 #define Py_TPFLAGS_HAVE_INDEX 0 #endif #if (PY_VERSION_HEX < 0x02060000) || (PY_MAJOR_VERSION >= 3) #define Py_TPFLAGS_HAVE_NEWBUFFER 0 #endif #if PY_MAJOR_VERSION >= 3 #define PyBaseString_Type PyUnicode_Type #define PyStringObject PyUnicodeObject #define PyString_Type PyUnicode_Type #define PyString_Check PyUnicode_Check #define PyString_CheckExact PyUnicode_CheckExact #endif #if PY_VERSION_HEX < 0x02060000 #define PyBytesObject PyStringObject #define PyBytes_Type PyString_Type #define PyBytes_Check PyString_Check #define PyBytes_CheckExact PyString_CheckExact #define PyBytes_FromString PyString_FromString #define PyBytes_FromStringAndSize PyString_FromStringAndSize #define PyBytes_FromFormat PyString_FromFormat #define PyBytes_DecodeEscape PyString_DecodeEscape #define PyBytes_AsString PyString_AsString #define PyBytes_AsStringAndSize PyString_AsStringAndSize #define PyBytes_Size PyString_Size #define PyBytes_AS_STRING PyString_AS_STRING #define PyBytes_GET_SIZE PyString_GET_SIZE #define PyBytes_Repr PyString_Repr #define PyBytes_Concat PyString_Concat #define PyBytes_ConcatAndDel PyString_ConcatAndDel #endif #if PY_VERSION_HEX < 0x02060000 #define PySet_Check(obj) PyObject_TypeCheck(obj, &PySet_Type) #define PyFrozenSet_Check(obj) PyObject_TypeCheck(obj, &PyFrozenSet_Type) #endif #ifndef PySet_CheckExact #define PySet_CheckExact(obj) (Py_TYPE(obj) == &PySet_Type) #endif #define __Pyx_TypeCheck(obj, type) PyObject_TypeCheck(obj, (PyTypeObject *)type) #if PY_MAJOR_VERSION >= 3 #define PyIntObject PyLongObject #define PyInt_Type PyLong_Type #define PyInt_Check(op) PyLong_Check(op) #define PyInt_CheckExact(op) PyLong_CheckExact(op) #define PyInt_FromString PyLong_FromString #define PyInt_FromUnicode PyLong_FromUnicode #define PyInt_FromLong PyLong_FromLong #define PyInt_FromSize_t PyLong_FromSize_t #define PyInt_FromSsize_t PyLong_FromSsize_t #define PyInt_AsLong PyLong_AsLong #define PyInt_AS_LONG PyLong_AS_LONG #define PyInt_AsSsize_t PyLong_AsSsize_t #define PyInt_AsUnsignedLongMask PyLong_AsUnsignedLongMask #define PyInt_AsUnsignedLongLongMask PyLong_AsUnsignedLongLongMask #endif #if PY_MAJOR_VERSION >= 3 #define PyBoolObject PyLongObject #endif #if PY_VERSION_HEX < 0x03020000 typedef long Py_hash_t; #define __Pyx_PyInt_FromHash_t PyInt_FromLong #define __Pyx_PyInt_AsHash_t PyInt_AsLong #else #define __Pyx_PyInt_FromHash_t PyInt_FromSsize_t #define __Pyx_PyInt_AsHash_t PyInt_AsSsize_t #endif #if PY_MAJOR_VERSION >= 3 #define __Pyx_PyNumber_Divide(x,y) PyNumber_TrueDivide(x,y) #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceTrueDivide(x,y) #else #define __Pyx_PyNumber_Divide(x,y) PyNumber_Divide(x,y) #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceDivide(x,y) #endif #if (PY_MAJOR_VERSION < 3) || (PY_VERSION_HEX >= 0x03010300) #define __Pyx_PySequence_GetSlice(obj, a, b) PySequence_GetSlice(obj, a, b) #define __Pyx_PySequence_SetSlice(obj, a, b, value) PySequence_SetSlice(obj, a, b, value) #define __Pyx_PySequence_DelSlice(obj, a, b) PySequence_DelSlice(obj, a, b) #else #define __Pyx_PySequence_GetSlice(obj, a, b) (unlikely(!(obj)) ? \ (PyErr_SetString(PyExc_SystemError, "null argument to internal routine"), (PyObject*)0) : \ (likely((obj)->ob_type->tp_as_mapping) ? (PySequence_GetSlice(obj, a, b)) : \ (PyErr_Format(PyExc_TypeError, "'%.200s' object is unsliceable", (obj)->ob_type->tp_name), (PyObject*)0))) #define __Pyx_PySequence_SetSlice(obj, a, b, value) (unlikely(!(obj)) ? \ (PyErr_SetString(PyExc_SystemError, "null argument to internal routine"), -1) : \ (likely((obj)->ob_type->tp_as_mapping) ? (PySequence_SetSlice(obj, a, b, value)) : \ (PyErr_Format(PyExc_TypeError, "'%.200s' object doesn't support slice assignment", (obj)->ob_type->tp_name), -1))) #define __Pyx_PySequence_DelSlice(obj, a, b) (unlikely(!(obj)) ? \ (PyErr_SetString(PyExc_SystemError, "null argument to internal routine"), -1) : \ (likely((obj)->ob_type->tp_as_mapping) ? (PySequence_DelSlice(obj, a, b)) : \ (PyErr_Format(PyExc_TypeError, "'%.200s' object doesn't support slice deletion", (obj)->ob_type->tp_name), -1))) #endif #if PY_MAJOR_VERSION >= 3 #define PyMethod_New(func, self, klass) ((self) ? PyMethod_New(func, self) : PyInstanceMethod_New(func)) #endif #if PY_VERSION_HEX < 0x02050000 #define __Pyx_GetAttrString(o,n) PyObject_GetAttrString((o),((char *)(n))) #define __Pyx_SetAttrString(o,n,a) PyObject_SetAttrString((o),((char *)(n)),(a)) #define __Pyx_DelAttrString(o,n) PyObject_DelAttrString((o),((char *)(n))) #else #define __Pyx_GetAttrString(o,n) PyObject_GetAttrString((o),(n)) #define __Pyx_SetAttrString(o,n,a) PyObject_SetAttrString((o),(n),(a)) #define __Pyx_DelAttrString(o,n) PyObject_DelAttrString((o),(n)) #endif #if PY_VERSION_HEX < 0x02050000 #define __Pyx_NAMESTR(n) ((char *)(n)) #define __Pyx_DOCSTR(n) ((char *)(n)) #else #define __Pyx_NAMESTR(n) (n) #define __Pyx_DOCSTR(n) (n) #endif #ifndef __PYX_EXTERN_C #ifdef __cplusplus #define __PYX_EXTERN_C extern "C" #else #define __PYX_EXTERN_C extern #endif #endif #if defined(WIN32) || defined(MS_WINDOWS) #define _USE_MATH_DEFINES #endif #include <math.h> #define __PYX_HAVE__ascarray #define __PYX_HAVE_API__ascarray #include "locale.h" #include "numpy/arrayobject.h" #include "stdlib.h" #include "stdio.h" #include "string.h" #ifdef _OPENMP #include <omp.h> #endif /* _OPENMP */ #ifdef PYREX_WITHOUT_ASSERTIONS #define CYTHON_WITHOUT_ASSERTIONS #endif /* inline attribute */ #ifndef CYTHON_INLINE #if defined(__GNUC__) #define CYTHON_INLINE __inline__ #elif defined(_MSC_VER) #define CYTHON_INLINE __inline #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L #define CYTHON_INLINE inline #else #define CYTHON_INLINE #endif #endif /* unused attribute */ #ifndef CYTHON_UNUSED # if defined(__GNUC__) # if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)) # define CYTHON_UNUSED __attribute__ ((__unused__)) # else # define CYTHON_UNUSED # endif # elif defined(__ICC) || defined(__INTEL_COMPILER) # define CYTHON_UNUSED __attribute__ ((__unused__)) # else # define CYTHON_UNUSED # endif #endif typedef struct {PyObject **p; char *s; const long n; const char* encoding; const char is_unicode; const char is_str; const char intern; } __Pyx_StringTabEntry; /*proto*/ /* Type Conversion Predeclarations */ #define __Pyx_PyBytes_FromUString(s) PyBytes_FromString((char*)s) #define __Pyx_PyBytes_AsUString(s) ((unsigned char*) PyBytes_AsString(s)) #define __Pyx_Owned_Py_None(b) (Py_INCREF(Py_None), Py_None) #define __Pyx_PyBool_FromLong(b) ((b) ? (Py_INCREF(Py_True), Py_True) : (Py_INCREF(Py_False), Py_False)) static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject*); static CYTHON_INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x); static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*); static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t); static CYTHON_INLINE size_t __Pyx_PyInt_AsSize_t(PyObject*); #define __pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x)) #ifdef __GNUC__ /* Test for GCC > 2.95 */ #if __GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)) #define likely(x) __builtin_expect(!!(x), 1) #define unlikely(x) __builtin_expect(!!(x), 0) #else /* __GNUC__ > 2 ... */ #define likely(x) (x) #define unlikely(x) (x) #endif /* __GNUC__ > 2 ... */ #else /* __GNUC__ */ #define likely(x) (x) #define unlikely(x) (x) #endif /* __GNUC__ */ static PyObject *__pyx_m; static PyObject *__pyx_b; static PyObject *__pyx_empty_tuple; static PyObject *__pyx_empty_bytes; static int __pyx_lineno; static int __pyx_clineno = 0; static const char * __pyx_cfilenm= __FILE__; static const char *__pyx_filename; static const char *__pyx_f[] = { "ascarray.pyx", }; /*--- Type declarations ---*/ /* "ascarray.pyx":24 * # -------------------------------------------------------------------------- * * ctypedef void FILE # <<<<<<<<<<<<<< * * cdef extern from "locale.h": */ typedef void __pyx_t_8ascarray_FILE; #ifndef CYTHON_REFNANNY #define CYTHON_REFNANNY 0 #endif #if CYTHON_REFNANNY typedef struct { void (*INCREF)(void*, PyObject*, int); void (*DECREF)(void*, PyObject*, int); void (*GOTREF)(void*, PyObject*, int); void (*GIVEREF)(void*, PyObject*, int); void* (*SetupContext)(const char*, int, const char*); void (*FinishContext)(void**); } __Pyx_RefNannyAPIStruct; static __Pyx_RefNannyAPIStruct *__Pyx_RefNanny = NULL; static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname); /*proto*/ #define __Pyx_RefNannyDeclarations void *__pyx_refnanny = NULL; #define __Pyx_RefNannySetupContext(name) __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__) #define __Pyx_RefNannyFinishContext() __Pyx_RefNanny->FinishContext(&__pyx_refnanny) #define __Pyx_INCREF(r) __Pyx_RefNanny->INCREF(__pyx_refnanny, (PyObject *)(r), __LINE__) #define __Pyx_DECREF(r) __Pyx_RefNanny->DECREF(__pyx_refnanny, (PyObject *)(r), __LINE__) #define __Pyx_GOTREF(r) __Pyx_RefNanny->GOTREF(__pyx_refnanny, (PyObject *)(r), __LINE__) #define __Pyx_GIVEREF(r) __Pyx_RefNanny->GIVEREF(__pyx_refnanny, (PyObject *)(r), __LINE__) #define __Pyx_XINCREF(r) do { if((r) != NULL) {__Pyx_INCREF(r); }} while(0) #define __Pyx_XDECREF(r) do { if((r) != NULL) {__Pyx_DECREF(r); }} while(0) #define __Pyx_XGOTREF(r) do { if((r) != NULL) {__Pyx_GOTREF(r); }} while(0) #define __Pyx_XGIVEREF(r) do { if((r) != NULL) {__Pyx_GIVEREF(r);}} while(0) #else #define __Pyx_RefNannyDeclarations #define __Pyx_RefNannySetupContext(name) #define __Pyx_RefNannyFinishContext() #define __Pyx_INCREF(r) Py_INCREF(r) #define __Pyx_DECREF(r) Py_DECREF(r) #define __Pyx_GOTREF(r) #define __Pyx_GIVEREF(r) #define __Pyx_XINCREF(r) Py_XINCREF(r) #define __Pyx_XDECREF(r) Py_XDECREF(r) #define __Pyx_XGOTREF(r) #define __Pyx_XGIVEREF(r) #endif /* CYTHON_REFNANNY */ static PyObject *__Pyx_GetName(PyObject *dict, PyObject *name); /*proto*/ static void __Pyx_RaiseDoubleKeywordsError( const char* func_name, PyObject* kw_name); /*proto*/ static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject **argnames[], PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args, const char* function_name); /*proto*/ static void __Pyx_RaiseArgtupleInvalid(const char* func_name, int exact, Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found); /*proto*/ static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb); /*proto*/ static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb); /*proto*/ static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause); /*proto*/ static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index); static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected); static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected); /*proto*/ static CYTHON_INLINE int __Pyx_div_int(int, int); /* proto */ #define UNARY_NEG_WOULD_OVERFLOW(x) (((x) < 0) & ((unsigned long)(x) == 0-(unsigned long)(x))) static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, long level); /*proto*/ static CYTHON_INLINE unsigned char __Pyx_PyInt_AsUnsignedChar(PyObject *); static CYTHON_INLINE unsigned short __Pyx_PyInt_AsUnsignedShort(PyObject *); static CYTHON_INLINE unsigned int __Pyx_PyInt_AsUnsignedInt(PyObject *); static CYTHON_INLINE char __Pyx_PyInt_AsChar(PyObject *); static CYTHON_INLINE short __Pyx_PyInt_AsShort(PyObject *); static CYTHON_INLINE int __Pyx_PyInt_AsInt(PyObject *); static CYTHON_INLINE signed char __Pyx_PyInt_AsSignedChar(PyObject *); static CYTHON_INLINE signed short __Pyx_PyInt_AsSignedShort(PyObject *); static CYTHON_INLINE signed int __Pyx_PyInt_AsSignedInt(PyObject *); static CYTHON_INLINE int __Pyx_PyInt_AsLongDouble(PyObject *); static CYTHON_INLINE unsigned long __Pyx_PyInt_AsUnsignedLong(PyObject *); static CYTHON_INLINE unsigned PY_LONG_LONG __Pyx_PyInt_AsUnsignedLongLong(PyObject *); static CYTHON_INLINE long __Pyx_PyInt_AsLong(PyObject *); static CYTHON_INLINE PY_LONG_LONG __Pyx_PyInt_AsLongLong(PyObject *); static CYTHON_INLINE signed long __Pyx_PyInt_AsSignedLong(PyObject *); static CYTHON_INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject *); static int __Pyx_check_binary_version(void); static void __Pyx_AddTraceback(const char *funcname, int __pyx_clineno, int __pyx_lineno, const char *__pyx_filename); /*proto*/ static int __Pyx_InitStrings(__Pyx_StringTabEntry *t); /*proto*/ /* Module declarations from 'ascarray' */ #define __Pyx_MODULE_NAME "ascarray" int __pyx_module_is_main_ascarray = 0; /* Implementation of 'ascarray' */ static PyObject *__pyx_builtin_IOError; static PyObject *__pyx_builtin_IndexError; static PyObject *__pyx_builtin_ValueError; static char __pyx_k_1[] = ", \t"; static char __pyx_k_2[] = "#!"; static char __pyx_k_3[] = "cannot open %s"; static char __pyx_k_4[] = "\n"; static char __pyx_k_5[] = "%s, line %d: row width error"; static char __pyx_k_6[] = "%s, line %d, column %d: invalid number \"%s\""; static char __pyx_k_7[] = "%s: no lines of data read"; static char __pyx_k_8[] = "\n================\nModule ascarray\n================\n\n.. author:: Hans Terlouw <gipsy@astro.rug.nl>\n\nThis module is the base containing the function on which :mod:`tabarray`\nhas been built.\n\nFunction ascarray\n-----------------\n\n.. autofunction:: ascarray(filename[, comchar='#!', sepchar=', \\\\t', lines=None, bad=None, segsep=None])\n\n"; static char __pyx_k_9[] = "1.2"; static char __pyx_k__C[] = "C"; static char __pyx_k__r[] = "r"; static char __pyx_k__bad[] = "bad"; static char __pyx_k__lines[] = "lines"; static char __pyx_k__numpy[] = "numpy"; static char __pyx_k__shape[] = "shape"; static char __pyx_k__segsep[] = "segsep"; static char __pyx_k__IOError[] = "IOError"; static char __pyx_k__comchar[] = "comchar"; static char __pyx_k__sepchar[] = "sepchar"; static char __pyx_k____main__[] = "__main__"; static char __pyx_k____test__[] = "__test__"; static char __pyx_k__ascarray[] = "ascarray"; static char __pyx_k__filename[] = "filename"; static char __pyx_k__IndexError[] = "IndexError"; static char __pyx_k__ValueError[] = "ValueError"; static char __pyx_k____version__[] = "__version__"; static PyObject *__pyx_kp_s_1; static PyObject *__pyx_kp_s_3; static PyObject *__pyx_kp_s_4; static PyObject *__pyx_kp_s_5; static PyObject *__pyx_kp_s_6; static PyObject *__pyx_kp_s_7; static PyObject *__pyx_kp_s_9; static PyObject *__pyx_n_s__IOError; static PyObject *__pyx_n_s__IndexError; static PyObject *__pyx_n_s__ValueError; static PyObject *__pyx_n_s____main__; static PyObject *__pyx_n_s____test__; static PyObject *__pyx_n_s____version__; static PyObject *__pyx_n_s__ascarray; static PyObject *__pyx_n_s__bad; static PyObject *__pyx_n_s__comchar; static PyObject *__pyx_n_s__filename; static PyObject *__pyx_n_s__lines; static PyObject *__pyx_n_s__numpy; static PyObject *__pyx_n_s__segsep; static PyObject *__pyx_n_s__sepchar; static PyObject *__pyx_n_s__shape; /* "ascarray.pyx":68 * # Read an ASCII table file and return its data as a NumPy array. * # * def ascarray(filename, char *comchar='#!', sepchar=', \t', lines=None, # <<<<<<<<<<<<<< * bad=None, segsep=None): * """ */ static PyObject *__pyx_pf_8ascarray_ascarray(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static char __pyx_doc_8ascarray_ascarray[] = "\nRead an ASCII table file and return its data as a NumPy array.\n\n:param source:\n a string with the name of a text file containing the table.\n:param comchar:\n string with characters which are used to designate\n comments in the input file. The occurrence of any of these\n characters on a line causes the rest of the line to be ignored.\n Empty lines and lines containing only a comment are also ignored.\n Default: '#!'.\n:param sepchar:\n a string containing the column separation characters to be used.\n Columns are separated by any combination of these characters.\n Default: ', \\\\t'.\n:param lines:\n a two-element tuple or list specifying a range of lines to be\n read. Line numbers are counted from one and the range is\n inclusive. So (1,10) specifies the first 10 lines of a file. \n Comment lines are included in the count. If any element of\n the tuple or list is zero, this limit is ignored. So (1,0)\n specifies the whole file, just like the default None. \n Default: all lines.\n:param bad:\n a number to be substituted for any field which cannot be\n decoded as a number. The default None causes a :exc:`ValueError`\n exception to be raised in such cases.\n:param segsep:\n a string containing the segment separation characters. If any of\n these characters is present in a comment line, this comment block\n is taken as the end of the current segment. The default None indicates\n that every comment block will separate segments.\n:returns:\n a tuple containing 1) a NumPy array containing the selected data from\n the table file, and 2) a list of slice objects, one for every segment.\n:raises:\n :exc:`IOError`, when the file cannot be opened.\n\n :exc:`IndexError`, when a line with an inconsistent number of fields is\n encountered in the input file.\n\n :exc:`ValueError`: when a field cannot be decoded as a number and\n no alternative value was specified.\n\n"; static PyMethodDef __pyx_mdef_8ascarray_ascarray = {__Pyx_NAMESTR("ascarray"), (PyCFunction)__pyx_pf_8ascarray_ascarray, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_8ascarray_ascarray)}; static PyObject *__pyx_pf_8ascarray_ascarray(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyObject *__pyx_v_filename = 0; char *__pyx_v_comchar; PyObject *__pyx_v_sepchar = 0; PyObject *__pyx_v_lines = 0; PyObject *__pyx_v_bad = 0; PyObject *__pyx_v_segsep = 0; __pyx_t_8ascarray_FILE *__pyx_v_f; char __pyx_v_line[32768]; char *__pyx_v_tokens[10000]; char *__pyx_v_curline; char *__pyx_v_token; char *__pyx_v_comstart; char *__pyx_v_csep; char *__pyx_v_c_segsep; char *__pyx_v_endptr; int __pyx_v_i; int __pyx_v_column; int __pyx_v_ncols; int __pyx_v_lineno; int __pyx_v_lstart; int __pyx_v_lend; npy_intp __pyx_v_nvalues; int __pyx_v_filesize; int __pyx_v_maxitems; int __pyx_v_badflag; int *__pyx_v_segments; int __pyx_v_maxseg; int __pyx_v_nseg; int __pyx_v_segfirst; int __pyx_v_segflag; double *__pyx_v_data; double __pyx_v_badvalue; PyObject *__pyx_v_seglist = NULL; long __pyx_v_segstart; int __pyx_v_segend; PyObject *__pyx_v_array = NULL; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations char *__pyx_t_1; int __pyx_t_2; PyObject *__pyx_t_3 = NULL; double __pyx_t_4; PyObject *__pyx_t_5 = NULL; PyObject *__pyx_t_6 = NULL; PyObject *(*__pyx_t_7)(PyObject *); int __pyx_t_8; int __pyx_t_9; int __pyx_t_10; int __pyx_t_11; PyObject *__pyx_t_12 = NULL; int __pyx_t_13; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__filename,&__pyx_n_s__comchar,&__pyx_n_s__sepchar,&__pyx_n_s__lines,&__pyx_n_s__bad,&__pyx_n_s__segsep,0}; __Pyx_RefNannySetupContext("ascarray"); __pyx_self = __pyx_self; { PyObject* values[6] = {0,0,0,0,0,0}; values[2] = ((PyObject *)__pyx_kp_s_1); values[3] = ((PyObject *)Py_None); /* "ascarray.pyx":69 * # * def ascarray(filename, char *comchar='#!', sepchar=', \t', lines=None, * bad=None, segsep=None): # <<<<<<<<<<<<<< * """ * Read an ASCII table file and return its data as a NumPy array. */ values[4] = ((PyObject *)Py_None); values[5] = ((PyObject *)Py_None); if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args; switch (PyTuple_GET_SIZE(__pyx_args)) { case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5); case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); case 0: break; default: goto __pyx_L5_argtuple_error; } kw_args = PyDict_Size(__pyx_kwds); switch (PyTuple_GET_SIZE(__pyx_args)) { case 0: values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__filename); if (likely(values[0])) kw_args--; else goto __pyx_L5_argtuple_error; case 1: if (kw_args > 0) { PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__comchar); if (value) { values[1] = value; kw_args--; } } case 2: if (kw_args > 0) { PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__sepchar); if (value) { values[2] = value; kw_args--; } } case 3: if (kw_args > 0) { PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__lines); if (value) { values[3] = value; kw_args--; } } case 4: if (kw_args > 0) { PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__bad); if (value) { values[4] = value; kw_args--; } } case 5: if (kw_args > 0) { PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__segsep); if (value) { values[5] = value; kw_args--; } } } if (unlikely(kw_args > 0)) { if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "ascarray") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } else { switch (PyTuple_GET_SIZE(__pyx_args)) { case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5); case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); break; default: goto __pyx_L5_argtuple_error; } } __pyx_v_filename = values[0]; if (values[1]) { __pyx_v_comchar = PyBytes_AsString(values[1]); if (unlikely((!__pyx_v_comchar) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } else { __pyx_v_comchar = ((char *)__pyx_k_2); } __pyx_v_sepchar = values[2]; __pyx_v_lines = values[3]; __pyx_v_bad = values[4]; __pyx_v_segsep = values[5]; } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("ascarray", 0, 1, 6, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; __Pyx_AddTraceback("ascarray.ascarray", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; __Pyx_INCREF(__pyx_v_sepchar); /* "ascarray.pyx":118 * cdef char line[32768] * cdef char *tokens[10000] * cdef char *curline, *token, *comstart, *csep, *c_segsep=NULL # <<<<<<<<<<<<<< * cdef char *endptr * cdef int i, column, ncols=0, lineno=0, lstart=0, lend=0 */ __pyx_v_c_segsep = NULL; /* "ascarray.pyx":120 * cdef char *curline, *token, *comstart, *csep, *c_segsep=NULL * cdef char *endptr * cdef int i, column, ncols=0, lineno=0, lstart=0, lend=0 # <<<<<<<<<<<<<< * cdef npy_intp nvalues=0 * cdef int filesize, maxitems=0, badflag */ __pyx_v_ncols = 0; __pyx_v_lineno = 0; __pyx_v_lstart = 0; __pyx_v_lend = 0; /* "ascarray.pyx":121 * cdef char *endptr * cdef int i, column, ncols=0, lineno=0, lstart=0, lend=0 * cdef npy_intp nvalues=0 # <<<<<<<<<<<<<< * cdef int filesize, maxitems=0, badflag * cdef int *segments=NULL, maxseg=0, nseg=0, segfirst=0, segflag */ __pyx_v_nvalues = 0; /* "ascarray.pyx":122 * cdef int i, column, ncols=0, lineno=0, lstart=0, lend=0 * cdef npy_intp nvalues=0 * cdef int filesize, maxitems=0, badflag # <<<<<<<<<<<<<< * cdef int *segments=NULL, maxseg=0, nseg=0, segfirst=0, segflag * cdef double *data=NULL, badvalue=0.0 */ __pyx_v_maxitems = 0; /* "ascarray.pyx":123 * cdef npy_intp nvalues=0 * cdef int filesize, maxitems=0, badflag * cdef int *segments=NULL, maxseg=0, nseg=0, segfirst=0, segflag # <<<<<<<<<<<<<< * cdef double *data=NULL, badvalue=0.0 * setlocale(LC_NUMERIC, 'C') ### TEST ### */ __pyx_v_segments = NULL; __pyx_v_maxseg = 0; __pyx_v_nseg = 0; __pyx_v_segfirst = 0; /* "ascarray.pyx":124 * cdef int filesize, maxitems=0, badflag * cdef int *segments=NULL, maxseg=0, nseg=0, segfirst=0, segflag * cdef double *data=NULL, badvalue=0.0 # <<<<<<<<<<<<<< * setlocale(LC_NUMERIC, 'C') ### TEST ### * f = fopen(filename, "r") */ __pyx_v_data = NULL; __pyx_v_badvalue = 0.0; /* "ascarray.pyx":125 * cdef int *segments=NULL, maxseg=0, nseg=0, segfirst=0, segflag * cdef double *data=NULL, badvalue=0.0 * setlocale(LC_NUMERIC, 'C') ### TEST ### # <<<<<<<<<<<<<< * f = fopen(filename, "r") * if f==NULL: */ setlocale(LC_NUMERIC, __pyx_k__C); /* "ascarray.pyx":126 * cdef double *data=NULL, badvalue=0.0 * setlocale(LC_NUMERIC, 'C') ### TEST ### * f = fopen(filename, "r") # <<<<<<<<<<<<<< * if f==NULL: * raise IOError, 'cannot open %s' % filename */ __pyx_t_1 = PyBytes_AsString(__pyx_v_filename); if (unlikely((!__pyx_t_1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 126; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_v_f = fopen(__pyx_t_1, __pyx_k__r); /* "ascarray.pyx":127 * setlocale(LC_NUMERIC, 'C') ### TEST ### * f = fopen(filename, "r") * if f==NULL: # <<<<<<<<<<<<<< * raise IOError, 'cannot open %s' % filename * fseek(f, 0, SEEK_END) */ __pyx_t_2 = (__pyx_v_f == NULL); if (__pyx_t_2) { /* "ascarray.pyx":128 * f = fopen(filename, "r") * if f==NULL: * raise IOError, 'cannot open %s' % filename # <<<<<<<<<<<<<< * fseek(f, 0, SEEK_END) * filesize = ftell(f) */ __pyx_t_3 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_3), __pyx_v_filename); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 128; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_3)); __Pyx_Raise(__pyx_builtin_IOError, ((PyObject *)__pyx_t_3), 0, 0); __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; {__pyx_filename = __pyx_f[0]; __pyx_lineno = 128; __pyx_clineno = __LINE__; goto __pyx_L1_error;} goto __pyx_L6; } __pyx_L6:; /* "ascarray.pyx":129 * if f==NULL: * raise IOError, 'cannot open %s' % filename * fseek(f, 0, SEEK_END) # <<<<<<<<<<<<<< * filesize = ftell(f) * fseek(f, 0, SEEK_SET) */ fseek(__pyx_v_f, 0, SEEK_END); /* "ascarray.pyx":130 * raise IOError, 'cannot open %s' % filename * fseek(f, 0, SEEK_END) * filesize = ftell(f) # <<<<<<<<<<<<<< * fseek(f, 0, SEEK_SET) * sepchar += '\n' */ __pyx_v_filesize = ftell(__pyx_v_f); /* "ascarray.pyx":131 * fseek(f, 0, SEEK_END) * filesize = ftell(f) * fseek(f, 0, SEEK_SET) # <<<<<<<<<<<<<< * sepchar += '\n' * csep = sepchar */ fseek(__pyx_v_f, 0, SEEK_SET); /* "ascarray.pyx":132 * filesize = ftell(f) * fseek(f, 0, SEEK_SET) * sepchar += '\n' # <<<<<<<<<<<<<< * csep = sepchar * badflag = bad is not None */ __pyx_t_3 = PyNumber_InPlaceAdd(__pyx_v_sepchar, ((PyObject *)__pyx_kp_s_4)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 132; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_v_sepchar); __pyx_v_sepchar = __pyx_t_3; __pyx_t_3 = 0; /* "ascarray.pyx":133 * fseek(f, 0, SEEK_SET) * sepchar += '\n' * csep = sepchar # <<<<<<<<<<<<<< * badflag = bad is not None * if badflag: */ __pyx_t_1 = PyBytes_AsString(__pyx_v_sepchar); if (unlikely((!__pyx_t_1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 133; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_v_csep = __pyx_t_1; /* "ascarray.pyx":134 * sepchar += '\n' * csep = sepchar * badflag = bad is not None # <<<<<<<<<<<<<< * if badflag: * badvalue = bad */ __pyx_t_2 = (__pyx_v_bad != Py_None); __pyx_v_badflag = __pyx_t_2; /* "ascarray.pyx":135 * csep = sepchar * badflag = bad is not None * if badflag: # <<<<<<<<<<<<<< * badvalue = bad * if lines: */ if (__pyx_v_badflag) { /* "ascarray.pyx":136 * badflag = bad is not None * if badflag: * badvalue = bad # <<<<<<<<<<<<<< * if lines: * lstart, lend = lines */ __pyx_t_4 = __pyx_PyFloat_AsDouble(__pyx_v_bad); if (unlikely((__pyx_t_4 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 136; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_v_badvalue = __pyx_t_4; goto __pyx_L7; } __pyx_L7:; /* "ascarray.pyx":137 * if badflag: * badvalue = bad * if lines: # <<<<<<<<<<<<<< * lstart, lend = lines * if segsep is not None: */ __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_v_lines); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 137; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (__pyx_t_2) { /* "ascarray.pyx":138 * badvalue = bad * if lines: * lstart, lend = lines # <<<<<<<<<<<<<< * if segsep is not None: * c_segsep = segsep */ if ((likely(PyTuple_CheckExact(__pyx_v_lines))) || (PyList_CheckExact(__pyx_v_lines))) { PyObject* sequence = __pyx_v_lines; if (likely(PyTuple_CheckExact(sequence))) { if (unlikely(PyTuple_GET_SIZE(sequence) != 2)) { if (PyTuple_GET_SIZE(sequence) > 2) __Pyx_RaiseTooManyValuesError(2); else __Pyx_RaiseNeedMoreValuesError(PyTuple_GET_SIZE(sequence)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 138; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_t_3 = PyTuple_GET_ITEM(sequence, 0); __pyx_t_5 = PyTuple_GET_ITEM(sequence, 1); } else { if (unlikely(PyList_GET_SIZE(sequence) != 2)) { if (PyList_GET_SIZE(sequence) > 2) __Pyx_RaiseTooManyValuesError(2); else __Pyx_RaiseNeedMoreValuesError(PyList_GET_SIZE(sequence)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 138; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_t_3 = PyList_GET_ITEM(sequence, 0); __pyx_t_5 = PyList_GET_ITEM(sequence, 1); } __Pyx_INCREF(__pyx_t_3); __Pyx_INCREF(__pyx_t_5); } else { Py_ssize_t index = -1; __pyx_t_6 = PyObject_GetIter(__pyx_v_lines); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 138; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_6); __pyx_t_7 = Py_TYPE(__pyx_t_6)->tp_iternext; index = 0; __pyx_t_3 = __pyx_t_7(__pyx_t_6); if (unlikely(!__pyx_t_3)) goto __pyx_L9_unpacking_failed; __Pyx_GOTREF(__pyx_t_3); index = 1; __pyx_t_5 = __pyx_t_7(__pyx_t_6); if (unlikely(!__pyx_t_5)) goto __pyx_L9_unpacking_failed; __Pyx_GOTREF(__pyx_t_5); if (__Pyx_IternextUnpackEndCheck(__pyx_t_7(__pyx_t_6), 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 138; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; goto __pyx_L10_unpacking_done; __pyx_L9_unpacking_failed:; __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; if (PyErr_Occurred() && PyErr_ExceptionMatches(PyExc_StopIteration)) PyErr_Clear(); if (!PyErr_Occurred()) __Pyx_RaiseNeedMoreValuesError(index); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 138; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_L10_unpacking_done:; } __pyx_t_8 = __Pyx_PyInt_AsInt(__pyx_t_3); if (unlikely((__pyx_t_8 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 138; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_9 = __Pyx_PyInt_AsInt(__pyx_t_5); if (unlikely((__pyx_t_9 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 138; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_v_lstart = __pyx_t_8; __pyx_v_lend = __pyx_t_9; goto __pyx_L8; } __pyx_L8:; /* "ascarray.pyx":139 * if lines: * lstart, lend = lines * if segsep is not None: # <<<<<<<<<<<<<< * c_segsep = segsep * segments = <int*>malloc(sizeof(int)) */ __pyx_t_2 = (__pyx_v_segsep != Py_None); if (__pyx_t_2) { /* "ascarray.pyx":140 * lstart, lend = lines * if segsep is not None: * c_segsep = segsep # <<<<<<<<<<<<<< * segments = <int*>malloc(sizeof(int)) * while fgets(line, 32768, f) != NULL: */ __pyx_t_1 = PyBytes_AsString(__pyx_v_segsep); if (unlikely((!__pyx_t_1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 140; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_v_c_segsep = __pyx_t_1; goto __pyx_L11; } __pyx_L11:; /* "ascarray.pyx":141 * if segsep is not None: * c_segsep = segsep * segments = <int*>malloc(sizeof(int)) # <<<<<<<<<<<<<< * while fgets(line, 32768, f) != NULL: * lineno += 1 */ __pyx_v_segments = ((int *)malloc((sizeof(int)))); /* "ascarray.pyx":142 * c_segsep = segsep * segments = <int*>malloc(sizeof(int)) * while fgets(line, 32768, f) != NULL: # <<<<<<<<<<<<<< * lineno += 1 * if lstart>0 and lineno<lstart: */ while (1) { __pyx_t_2 = (fgets(__pyx_v_line, 32768, __pyx_v_f) != NULL); if (!__pyx_t_2) break; /* "ascarray.pyx":143 * segments = <int*>malloc(sizeof(int)) * while fgets(line, 32768, f) != NULL: * lineno += 1 # <<<<<<<<<<<<<< * if lstart>0 and lineno<lstart: * continue */ __pyx_v_lineno = (__pyx_v_lineno + 1); /* "ascarray.pyx":144 * while fgets(line, 32768, f) != NULL: * lineno += 1 * if lstart>0 and lineno<lstart: # <<<<<<<<<<<<<< * continue * if lend>0 and lineno>lend: */ __pyx_t_2 = (__pyx_v_lstart > 0); if (__pyx_t_2) { __pyx_t_10 = (__pyx_v_lineno < __pyx_v_lstart); __pyx_t_11 = __pyx_t_10; } else { __pyx_t_11 = __pyx_t_2; } if (__pyx_t_11) { /* "ascarray.pyx":145 * lineno += 1 * if lstart>0 and lineno<lstart: * continue # <<<<<<<<<<<<<< * if lend>0 and lineno>lend: * break */ goto __pyx_L12_continue; goto __pyx_L14; } __pyx_L14:; /* "ascarray.pyx":146 * if lstart>0 and lineno<lstart: * continue * if lend>0 and lineno>lend: # <<<<<<<<<<<<<< * break * segflag = (c_segsep == NULL or strpbrk(line, c_segsep) != NULL) */ __pyx_t_11 = (__pyx_v_lend > 0); if (__pyx_t_11) { __pyx_t_2 = (__pyx_v_lineno > __pyx_v_lend); __pyx_t_10 = __pyx_t_2; } else { __pyx_t_10 = __pyx_t_11; } if (__pyx_t_10) { /* "ascarray.pyx":147 * continue * if lend>0 and lineno>lend: * break # <<<<<<<<<<<<<< * segflag = (c_segsep == NULL or strpbrk(line, c_segsep) != NULL) * comstart = strpbrk(line, comchar) */ goto __pyx_L13_break; goto __pyx_L15; } __pyx_L15:; /* "ascarray.pyx":148 * if lend>0 and lineno>lend: * break * segflag = (c_segsep == NULL or strpbrk(line, c_segsep) != NULL) # <<<<<<<<<<<<<< * comstart = strpbrk(line, comchar) * if comstart!=NULL: */ __pyx_t_10 = (__pyx_v_c_segsep == NULL); if (!__pyx_t_10) { __pyx_t_11 = (strpbrk(__pyx_v_line, __pyx_v_c_segsep) != NULL); __pyx_t_2 = __pyx_t_11; } else { __pyx_t_2 = __pyx_t_10; } __pyx_v_segflag = __pyx_t_2; /* "ascarray.pyx":149 * break * segflag = (c_segsep == NULL or strpbrk(line, c_segsep) != NULL) * comstart = strpbrk(line, comchar) # <<<<<<<<<<<<<< * if comstart!=NULL: * comstart[0] = 0 */ __pyx_v_comstart = strpbrk(__pyx_v_line, __pyx_v_comchar); /* "ascarray.pyx":150 * segflag = (c_segsep == NULL or strpbrk(line, c_segsep) != NULL) * comstart = strpbrk(line, comchar) * if comstart!=NULL: # <<<<<<<<<<<<<< * comstart[0] = 0 * column = 0 */ __pyx_t_2 = (__pyx_v_comstart != NULL); if (__pyx_t_2) { /* "ascarray.pyx":151 * comstart = strpbrk(line, comchar) * if comstart!=NULL: * comstart[0] = 0 # <<<<<<<<<<<<<< * column = 0 * curline = line */ (__pyx_v_comstart[0]) = 0; goto __pyx_L16; } __pyx_L16:; /* "ascarray.pyx":152 * if comstart!=NULL: * comstart[0] = 0 * column = 0 # <<<<<<<<<<<<<< * curline = line * while 1: */ __pyx_v_column = 0; /* "ascarray.pyx":153 * comstart[0] = 0 * column = 0 * curline = line # <<<<<<<<<<<<<< * while 1: * token = strtok(curline, csep) */ __pyx_v_curline = __pyx_v_line; /* "ascarray.pyx":154 * column = 0 * curline = line * while 1: # <<<<<<<<<<<<<< * token = strtok(curline, csep) * curline = NULL */ while (1) { if (!1) break; /* "ascarray.pyx":155 * curline = line * while 1: * token = strtok(curline, csep) # <<<<<<<<<<<<<< * curline = NULL * if token != NULL: */ __pyx_v_token = strtok(__pyx_v_curline, __pyx_v_csep); /* "ascarray.pyx":156 * while 1: * token = strtok(curline, csep) * curline = NULL # <<<<<<<<<<<<<< * if token != NULL: * tokens[column] = token */ __pyx_v_curline = NULL; /* "ascarray.pyx":157 * token = strtok(curline, csep) * curline = NULL * if token != NULL: # <<<<<<<<<<<<<< * tokens[column] = token * column += 1 */ __pyx_t_2 = (__pyx_v_token != NULL); if (__pyx_t_2) { /* "ascarray.pyx":158 * curline = NULL * if token != NULL: * tokens[column] = token # <<<<<<<<<<<<<< * column += 1 * else: */ (__pyx_v_tokens[__pyx_v_column]) = __pyx_v_token; /* "ascarray.pyx":159 * if token != NULL: * tokens[column] = token * column += 1 # <<<<<<<<<<<<<< * else: * if column>0: */ __pyx_v_column = (__pyx_v_column + 1); goto __pyx_L19; } /*else*/ { /* "ascarray.pyx":161 * column += 1 * else: * if column>0: # <<<<<<<<<<<<<< * segfirst = 1 * if ncols>0: */ __pyx_t_2 = (__pyx_v_column > 0); if (__pyx_t_2) { /* "ascarray.pyx":162 * else: * if column>0: * segfirst = 1 # <<<<<<<<<<<<<< * if ncols>0: * if ncols!=column: */ __pyx_v_segfirst = 1; /* "ascarray.pyx":163 * if column>0: * segfirst = 1 * if ncols>0: # <<<<<<<<<<<<<< * if ncols!=column: * free(segments) */ __pyx_t_2 = (__pyx_v_ncols > 0); if (__pyx_t_2) { /* "ascarray.pyx":164 * segfirst = 1 * if ncols>0: * if ncols!=column: # <<<<<<<<<<<<<< * free(segments) * fclose(f) */ __pyx_t_2 = (__pyx_v_ncols != __pyx_v_column); if (__pyx_t_2) { /* "ascarray.pyx":165 * if ncols>0: * if ncols!=column: * free(segments) # <<<<<<<<<<<<<< * fclose(f) * raise IndexError, \ */ free(__pyx_v_segments); /* "ascarray.pyx":166 * if ncols!=column: * free(segments) * fclose(f) # <<<<<<<<<<<<<< * raise IndexError, \ * '%s, line %d: row width error' % (filename, lineno) */ fclose(__pyx_v_f); /* "ascarray.pyx":168 * fclose(f) * raise IndexError, \ * '%s, line %d: row width error' % (filename, lineno) # <<<<<<<<<<<<<< * else: * ncols = column */ __pyx_t_5 = PyInt_FromLong(__pyx_v_lineno); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 168; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 168; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_3)); __Pyx_INCREF(__pyx_v_filename); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_filename); __Pyx_GIVEREF(__pyx_v_filename); PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_5); __Pyx_GIVEREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_5 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_5), ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 168; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_5)); __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; __Pyx_Raise(__pyx_builtin_IndexError, ((PyObject *)__pyx_t_5), 0, 0); __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; {__pyx_filename = __pyx_f[0]; __pyx_lineno = 167; __pyx_clineno = __LINE__; goto __pyx_L1_error;} goto __pyx_L22; } __pyx_L22:; goto __pyx_L21; } /*else*/ { /* "ascarray.pyx":170 * '%s, line %d: row width error' % (filename, lineno) * else: * ncols = column # <<<<<<<<<<<<<< * maxitems = <int>(1.3*ncols*filesize/strlen(line))+ncols * data = <double*>malloc(maxitems*sizeof(double)) */ __pyx_v_ncols = __pyx_v_column; /* "ascarray.pyx":171 * else: * ncols = column * maxitems = <int>(1.3*ncols*filesize/strlen(line))+ncols # <<<<<<<<<<<<<< * data = <double*>malloc(maxitems*sizeof(double)) * for i from 0 <= i <column: */ __pyx_t_4 = ((1.3 * __pyx_v_ncols) * __pyx_v_filesize); __pyx_t_9 = strlen(__pyx_v_line); if (unlikely(__pyx_t_9 == 0)) { PyErr_Format(PyExc_ZeroDivisionError, "float division"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_v_maxitems = (((int)(__pyx_t_4 / __pyx_t_9)) + __pyx_v_ncols); /* "ascarray.pyx":172 * ncols = column * maxitems = <int>(1.3*ncols*filesize/strlen(line))+ncols * data = <double*>malloc(maxitems*sizeof(double)) # <<<<<<<<<<<<<< * for i from 0 <= i <column: * if nvalues>=maxitems: */ __pyx_v_data = ((double *)malloc((__pyx_v_maxitems * (sizeof(double))))); } __pyx_L21:; /* "ascarray.pyx":173 * maxitems = <int>(1.3*ncols*filesize/strlen(line))+ncols * data = <double*>malloc(maxitems*sizeof(double)) * for i from 0 <= i <column: # <<<<<<<<<<<<<< * if nvalues>=maxitems: * maxitems = <int>(1.3*maxitems)+ncols */ __pyx_t_9 = __pyx_v_column; for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_9; __pyx_v_i++) { /* "ascarray.pyx":174 * data = <double*>malloc(maxitems*sizeof(double)) * for i from 0 <= i <column: * if nvalues>=maxitems: # <<<<<<<<<<<<<< * maxitems = <int>(1.3*maxitems)+ncols * data = <double*>realloc(data, maxitems*sizeof(double)) */ __pyx_t_2 = (__pyx_v_nvalues >= __pyx_v_maxitems); if (__pyx_t_2) { /* "ascarray.pyx":175 * for i from 0 <= i <column: * if nvalues>=maxitems: * maxitems = <int>(1.3*maxitems)+ncols # <<<<<<<<<<<<<< * data = <double*>realloc(data, maxitems*sizeof(double)) * data[nvalues] = strtod(tokens[i], &endptr) */ __pyx_v_maxitems = (((int)(1.3 * __pyx_v_maxitems)) + __pyx_v_ncols); /* "ascarray.pyx":176 * if nvalues>=maxitems: * maxitems = <int>(1.3*maxitems)+ncols * data = <double*>realloc(data, maxitems*sizeof(double)) # <<<<<<<<<<<<<< * data[nvalues] = strtod(tokens[i], &endptr) * if endptr[0]!=0: */ __pyx_v_data = ((double *)realloc(__pyx_v_data, (__pyx_v_maxitems * (sizeof(double))))); goto __pyx_L25; } __pyx_L25:; /* "ascarray.pyx":177 * maxitems = <int>(1.3*maxitems)+ncols * data = <double*>realloc(data, maxitems*sizeof(double)) * data[nvalues] = strtod(tokens[i], &endptr) # <<<<<<<<<<<<<< * if endptr[0]!=0: * if badflag: */ (__pyx_v_data[__pyx_v_nvalues]) = strtod((__pyx_v_tokens[__pyx_v_i]), (&__pyx_v_endptr)); /* "ascarray.pyx":178 * data = <double*>realloc(data, maxitems*sizeof(double)) * data[nvalues] = strtod(tokens[i], &endptr) * if endptr[0]!=0: # <<<<<<<<<<<<<< * if badflag: * data[nvalues] = badvalue */ __pyx_t_2 = ((__pyx_v_endptr[0]) != 0); if (__pyx_t_2) { /* "ascarray.pyx":179 * data[nvalues] = strtod(tokens[i], &endptr) * if endptr[0]!=0: * if badflag: # <<<<<<<<<<<<<< * data[nvalues] = badvalue * else: */ if (__pyx_v_badflag) { /* "ascarray.pyx":180 * if endptr[0]!=0: * if badflag: * data[nvalues] = badvalue # <<<<<<<<<<<<<< * else: * fclose(f) */ (__pyx_v_data[__pyx_v_nvalues]) = __pyx_v_badvalue; goto __pyx_L27; } /*else*/ { /* "ascarray.pyx":182 * data[nvalues] = badvalue * else: * fclose(f) # <<<<<<<<<<<<<< * free(segments) * raise ValueError, \ */ fclose(__pyx_v_f); /* "ascarray.pyx":183 * else: * fclose(f) * free(segments) # <<<<<<<<<<<<<< * raise ValueError, \ * '%s, line %d, column %d: invalid number "%s"' \ */ free(__pyx_v_segments); /* "ascarray.pyx":186 * raise ValueError, \ * '%s, line %d, column %d: invalid number "%s"' \ * % (filename, lineno, i+1, tokens[i]) # <<<<<<<<<<<<<< * nvalues += 1 * else: */ __pyx_t_5 = PyInt_FromLong(__pyx_v_lineno); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 186; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __pyx_t_3 = PyInt_FromLong((__pyx_v_i + 1)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 186; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_t_6 = PyBytes_FromString((__pyx_v_tokens[__pyx_v_i])); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 186; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_6)); __pyx_t_12 = PyTuple_New(4); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 186; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_12)); __Pyx_INCREF(__pyx_v_filename); PyTuple_SET_ITEM(__pyx_t_12, 0, __pyx_v_filename); __Pyx_GIVEREF(__pyx_v_filename); PyTuple_SET_ITEM(__pyx_t_12, 1, __pyx_t_5); __Pyx_GIVEREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_12, 2, __pyx_t_3); __Pyx_GIVEREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_12, 3, ((PyObject *)__pyx_t_6)); __Pyx_GIVEREF(((PyObject *)__pyx_t_6)); __pyx_t_5 = 0; __pyx_t_3 = 0; __pyx_t_6 = 0; __pyx_t_6 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_6), ((PyObject *)__pyx_t_12)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 186; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_6)); __Pyx_DECREF(((PyObject *)__pyx_t_12)); __pyx_t_12 = 0; __Pyx_Raise(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_6), 0, 0); __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0; {__pyx_filename = __pyx_f[0]; __pyx_lineno = 184; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_L27:; goto __pyx_L26; } __pyx_L26:; /* "ascarray.pyx":187 * '%s, line %d, column %d: invalid number "%s"' \ * % (filename, lineno, i+1, tokens[i]) * nvalues += 1 # <<<<<<<<<<<<<< * else: * if segflag: */ __pyx_v_nvalues = (__pyx_v_nvalues + 1); } goto __pyx_L20; } /*else*/ { /* "ascarray.pyx":189 * nvalues += 1 * else: * if segflag: # <<<<<<<<<<<<<< * if segfirst: * if nseg >= maxseg: */ if (__pyx_v_segflag) { /* "ascarray.pyx":190 * else: * if segflag: * if segfirst: # <<<<<<<<<<<<<< * if nseg >= maxseg: * maxseg += 1000 */ if (__pyx_v_segfirst) { /* "ascarray.pyx":191 * if segflag: * if segfirst: * if nseg >= maxseg: # <<<<<<<<<<<<<< * maxseg += 1000 * segments = <int*>realloc(segments, (maxseg+1)*sizeof(int)) */ __pyx_t_2 = (__pyx_v_nseg >= __pyx_v_maxseg); if (__pyx_t_2) { /* "ascarray.pyx":192 * if segfirst: * if nseg >= maxseg: * maxseg += 1000 # <<<<<<<<<<<<<< * segments = <int*>realloc(segments, (maxseg+1)*sizeof(int)) * segments[nseg] = nvalues/ncols # number of rows up to here */ __pyx_v_maxseg = (__pyx_v_maxseg + 1000); /* "ascarray.pyx":193 * if nseg >= maxseg: * maxseg += 1000 * segments = <int*>realloc(segments, (maxseg+1)*sizeof(int)) # <<<<<<<<<<<<<< * segments[nseg] = nvalues/ncols # number of rows up to here * nseg += 1 */ __pyx_v_segments = ((int *)realloc(__pyx_v_segments, ((__pyx_v_maxseg + 1) * (sizeof(int))))); goto __pyx_L30; } __pyx_L30:; /* "ascarray.pyx":194 * maxseg += 1000 * segments = <int*>realloc(segments, (maxseg+1)*sizeof(int)) * segments[nseg] = nvalues/ncols # number of rows up to here # <<<<<<<<<<<<<< * nseg += 1 * segfirst = 0 */ if (unlikely(__pyx_v_ncols == 0)) { PyErr_Format(PyExc_ZeroDivisionError, "integer division or modulo by zero"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 194; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } else if (sizeof(int) == sizeof(long) && unlikely(__pyx_v_ncols == -1) && unlikely(UNARY_NEG_WOULD_OVERFLOW(__pyx_v_nvalues))) { PyErr_Format(PyExc_OverflowError, "value too large to perform division"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 194; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } (__pyx_v_segments[__pyx_v_nseg]) = __Pyx_div_int(__pyx_v_nvalues, __pyx_v_ncols); /* "ascarray.pyx":195 * segments = <int*>realloc(segments, (maxseg+1)*sizeof(int)) * segments[nseg] = nvalues/ncols # number of rows up to here * nseg += 1 # <<<<<<<<<<<<<< * segfirst = 0 * break */ __pyx_v_nseg = (__pyx_v_nseg + 1); /* "ascarray.pyx":196 * segments[nseg] = nvalues/ncols # number of rows up to here * nseg += 1 * segfirst = 0 # <<<<<<<<<<<<<< * break * */ __pyx_v_segfirst = 0; goto __pyx_L29; } __pyx_L29:; goto __pyx_L28; } __pyx_L28:; } __pyx_L20:; /* "ascarray.pyx":197 * nseg += 1 * segfirst = 0 * break # <<<<<<<<<<<<<< * * if segfirst: */ goto __pyx_L18_break; } __pyx_L19:; } __pyx_L18_break:; __pyx_L12_continue:; } __pyx_L13_break:; /* "ascarray.pyx":199 * break * * if segfirst: # <<<<<<<<<<<<<< * segments[nseg] = nvalues/ncols # final number of rows * nseg += 1 */ if (__pyx_v_segfirst) { /* "ascarray.pyx":200 * * if segfirst: * segments[nseg] = nvalues/ncols # final number of rows # <<<<<<<<<<<<<< * nseg += 1 * */ if (unlikely(__pyx_v_ncols == 0)) { PyErr_Format(PyExc_ZeroDivisionError, "integer division or modulo by zero"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 200; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } else if (sizeof(int) == sizeof(long) && unlikely(__pyx_v_ncols == -1) && unlikely(UNARY_NEG_WOULD_OVERFLOW(__pyx_v_nvalues))) { PyErr_Format(PyExc_OverflowError, "value too large to perform division"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 200; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } (__pyx_v_segments[__pyx_v_nseg]) = __Pyx_div_int(__pyx_v_nvalues, __pyx_v_ncols); /* "ascarray.pyx":201 * if segfirst: * segments[nseg] = nvalues/ncols # final number of rows * nseg += 1 # <<<<<<<<<<<<<< * * seglist = [] */ __pyx_v_nseg = (__pyx_v_nseg + 1); goto __pyx_L31; } __pyx_L31:; /* "ascarray.pyx":203 * nseg += 1 * * seglist = [] # <<<<<<<<<<<<<< * segstart = 0 * for i from 0 <= i <nseg: */ __pyx_t_6 = PyList_New(0); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 203; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_6)); __pyx_v_seglist = __pyx_t_6; __pyx_t_6 = 0; /* "ascarray.pyx":204 * * seglist = [] * segstart = 0 # <<<<<<<<<<<<<< * for i from 0 <= i <nseg: * segend = segments[i] */ __pyx_v_segstart = 0; /* "ascarray.pyx":205 * seglist = [] * segstart = 0 * for i from 0 <= i <nseg: # <<<<<<<<<<<<<< * segend = segments[i] * seglist.append(slice(segstart, segend)) */ __pyx_t_9 = __pyx_v_nseg; for (__pyx_v_i = 0; __pyx_v_i < __pyx_t_9; __pyx_v_i++) { /* "ascarray.pyx":206 * segstart = 0 * for i from 0 <= i <nseg: * segend = segments[i] # <<<<<<<<<<<<<< * seglist.append(slice(segstart, segend)) * segstart = segend */ __pyx_v_segend = (__pyx_v_segments[__pyx_v_i]); /* "ascarray.pyx":207 * for i from 0 <= i <nseg: * segend = segments[i] * seglist.append(slice(segstart, segend)) # <<<<<<<<<<<<<< * segstart = segend * */ if (unlikely(((PyObject *)__pyx_v_seglist) == Py_None)) { PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%s'", "append"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 207; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_t_6 = PyInt_FromLong(__pyx_v_segstart); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 207; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_6); __pyx_t_12 = PyInt_FromLong(__pyx_v_segend); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 207; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_12); __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 207; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_3)); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_6); __Pyx_GIVEREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_12); __Pyx_GIVEREF(__pyx_t_12); __pyx_t_6 = 0; __pyx_t_12 = 0; __pyx_t_12 = PyObject_Call(((PyObject *)((PyObject*)(&PySlice_Type))), ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 207; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_12); __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; __pyx_t_13 = PyList_Append(__pyx_v_seglist, __pyx_t_12); if (unlikely(__pyx_t_13 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 207; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; /* "ascarray.pyx":208 * segend = segments[i] * seglist.append(slice(segstart, segend)) * segstart = segend # <<<<<<<<<<<<<< * * fclose(f) */ __pyx_v_segstart = __pyx_v_segend; } /* "ascarray.pyx":210 * segstart = segend * * fclose(f) # <<<<<<<<<<<<<< * if not data: * raise IndexError, '%s: no lines of data read' % filename */ fclose(__pyx_v_f); /* "ascarray.pyx":211 * * fclose(f) * if not data: # <<<<<<<<<<<<<< * raise IndexError, '%s: no lines of data read' % filename * data = <double*>realloc(data, nvalues*sizeof(double)) */ __pyx_t_2 = (!(__pyx_v_data != 0)); if (__pyx_t_2) { /* "ascarray.pyx":212 * fclose(f) * if not data: * raise IndexError, '%s: no lines of data read' % filename # <<<<<<<<<<<<<< * data = <double*>realloc(data, nvalues*sizeof(double)) * array = PyArray_SimpleNewFromData(1, &nvalues, NPY_DOUBLE, data) */ __pyx_t_12 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_7), __pyx_v_filename); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 212; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_12)); __Pyx_Raise(__pyx_builtin_IndexError, ((PyObject *)__pyx_t_12), 0, 0); __Pyx_DECREF(((PyObject *)__pyx_t_12)); __pyx_t_12 = 0; {__pyx_filename = __pyx_f[0]; __pyx_lineno = 212; __pyx_clineno = __LINE__; goto __pyx_L1_error;} goto __pyx_L34; } __pyx_L34:; /* "ascarray.pyx":213 * if not data: * raise IndexError, '%s: no lines of data read' % filename * data = <double*>realloc(data, nvalues*sizeof(double)) # <<<<<<<<<<<<<< * array = PyArray_SimpleNewFromData(1, &nvalues, NPY_DOUBLE, data) * array.shape = (nvalues/ncols, ncols) */ __pyx_v_data = ((double *)realloc(__pyx_v_data, (__pyx_v_nvalues * (sizeof(double))))); /* "ascarray.pyx":214 * raise IndexError, '%s: no lines of data read' % filename * data = <double*>realloc(data, nvalues*sizeof(double)) * array = PyArray_SimpleNewFromData(1, &nvalues, NPY_DOUBLE, data) # <<<<<<<<<<<<<< * array.shape = (nvalues/ncols, ncols) * return (array, seglist) */ __pyx_t_12 = PyArray_SimpleNewFromData(1, (&__pyx_v_nvalues), NPY_DOUBLE, __pyx_v_data); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 214; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_12); __pyx_v_array = __pyx_t_12; __pyx_t_12 = 0; /* "ascarray.pyx":215 * data = <double*>realloc(data, nvalues*sizeof(double)) * array = PyArray_SimpleNewFromData(1, &nvalues, NPY_DOUBLE, data) * array.shape = (nvalues/ncols, ncols) # <<<<<<<<<<<<<< * return (array, seglist) * */ if (unlikely(__pyx_v_ncols == 0)) { PyErr_Format(PyExc_ZeroDivisionError, "integer division or modulo by zero"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } else if (sizeof(int) == sizeof(long) && unlikely(__pyx_v_ncols == -1) && unlikely(UNARY_NEG_WOULD_OVERFLOW(__pyx_v_nvalues))) { PyErr_Format(PyExc_OverflowError, "value too large to perform division"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_t_12 = PyInt_FromLong(__Pyx_div_int(__pyx_v_nvalues, __pyx_v_ncols)); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_12); __pyx_t_3 = PyInt_FromLong(__pyx_v_ncols); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_6)); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_12); __Pyx_GIVEREF(__pyx_t_12); PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_3); __Pyx_GIVEREF(__pyx_t_3); __pyx_t_12 = 0; __pyx_t_3 = 0; if (PyObject_SetAttr(__pyx_v_array, __pyx_n_s__shape, ((PyObject *)__pyx_t_6)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0; /* "ascarray.pyx":216 * array = PyArray_SimpleNewFromData(1, &nvalues, NPY_DOUBLE, data) * array.shape = (nvalues/ncols, ncols) * return (array, seglist) # <<<<<<<<<<<<<< * * __version__ = '1.2' */ __Pyx_XDECREF(__pyx_r); __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 216; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_6)); __Pyx_INCREF(__pyx_v_array); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_v_array); __Pyx_GIVEREF(__pyx_v_array); __Pyx_INCREF(((PyObject *)__pyx_v_seglist)); PyTuple_SET_ITEM(__pyx_t_6, 1, ((PyObject *)__pyx_v_seglist)); __Pyx_GIVEREF(((PyObject *)__pyx_v_seglist)); __pyx_r = ((PyObject *)__pyx_t_6); __pyx_t_6 = 0; goto __pyx_L0; __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_5); __Pyx_XDECREF(__pyx_t_6); __Pyx_XDECREF(__pyx_t_12); __Pyx_AddTraceback("ascarray.ascarray", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XDECREF(__pyx_v_seglist); __Pyx_XDECREF(__pyx_v_array); __Pyx_XDECREF(__pyx_v_sepchar); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } static PyMethodDef __pyx_methods[] = { {0, 0, 0, 0} }; #if PY_MAJOR_VERSION >= 3 static struct PyModuleDef __pyx_moduledef = { PyModuleDef_HEAD_INIT, __Pyx_NAMESTR("ascarray"), __Pyx_DOCSTR(__pyx_k_8), /* m_doc */ -1, /* m_size */ __pyx_methods /* m_methods */, NULL, /* m_reload */ NULL, /* m_traverse */ NULL, /* m_clear */ NULL /* m_free */ }; #endif static __Pyx_StringTabEntry __pyx_string_tab[] = { {&__pyx_kp_s_1, __pyx_k_1, sizeof(__pyx_k_1), 0, 0, 1, 0}, {&__pyx_kp_s_3, __pyx_k_3, sizeof(__pyx_k_3), 0, 0, 1, 0}, {&__pyx_kp_s_4, __pyx_k_4, sizeof(__pyx_k_4), 0, 0, 1, 0}, {&__pyx_kp_s_5, __pyx_k_5, sizeof(__pyx_k_5), 0, 0, 1, 0}, {&__pyx_kp_s_6, __pyx_k_6, sizeof(__pyx_k_6), 0, 0, 1, 0}, {&__pyx_kp_s_7, __pyx_k_7, sizeof(__pyx_k_7), 0, 0, 1, 0}, {&__pyx_kp_s_9, __pyx_k_9, sizeof(__pyx_k_9), 0, 0, 1, 0}, {&__pyx_n_s__IOError, __pyx_k__IOError, sizeof(__pyx_k__IOError), 0, 0, 1, 1}, {&__pyx_n_s__IndexError, __pyx_k__IndexError, sizeof(__pyx_k__IndexError), 0, 0, 1, 1}, {&__pyx_n_s__ValueError, __pyx_k__ValueError, sizeof(__pyx_k__ValueError), 0, 0, 1, 1}, {&__pyx_n_s____main__, __pyx_k____main__, sizeof(__pyx_k____main__), 0, 0, 1, 1}, {&__pyx_n_s____test__, __pyx_k____test__, sizeof(__pyx_k____test__), 0, 0, 1, 1}, {&__pyx_n_s____version__, __pyx_k____version__, sizeof(__pyx_k____version__), 0, 0, 1, 1}, {&__pyx_n_s__ascarray, __pyx_k__ascarray, sizeof(__pyx_k__ascarray), 0, 0, 1, 1}, {&__pyx_n_s__bad, __pyx_k__bad, sizeof(__pyx_k__bad), 0, 0, 1, 1}, {&__pyx_n_s__comchar, __pyx_k__comchar, sizeof(__pyx_k__comchar), 0, 0, 1, 1}, {&__pyx_n_s__filename, __pyx_k__filename, sizeof(__pyx_k__filename), 0, 0, 1, 1}, {&__pyx_n_s__lines, __pyx_k__lines, sizeof(__pyx_k__lines), 0, 0, 1, 1}, {&__pyx_n_s__numpy, __pyx_k__numpy, sizeof(__pyx_k__numpy), 0, 0, 1, 1}, {&__pyx_n_s__segsep, __pyx_k__segsep, sizeof(__pyx_k__segsep), 0, 0, 1, 1}, {&__pyx_n_s__sepchar, __pyx_k__sepchar, sizeof(__pyx_k__sepchar), 0, 0, 1, 1}, {&__pyx_n_s__shape, __pyx_k__shape, sizeof(__pyx_k__shape), 0, 0, 1, 1}, {0, 0, 0, 0, 0, 0, 0} }; static int __Pyx_InitCachedBuiltins(void) { __pyx_builtin_IOError = __Pyx_GetName(__pyx_b, __pyx_n_s__IOError); if (!__pyx_builtin_IOError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 128; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_builtin_IndexError = __Pyx_GetName(__pyx_b, __pyx_n_s__IndexError); if (!__pyx_builtin_IndexError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 167; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_builtin_ValueError = __Pyx_GetName(__pyx_b, __pyx_n_s__ValueError); if (!__pyx_builtin_ValueError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 184; __pyx_clineno = __LINE__; goto __pyx_L1_error;} return 0; __pyx_L1_error:; return -1; } static int __Pyx_InitCachedConstants(void) { __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants"); __Pyx_RefNannyFinishContext(); return 0; } static int __Pyx_InitGlobals(void) { if (__Pyx_InitStrings(__pyx_string_tab) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; return 0; __pyx_L1_error:; return -1; } #if PY_MAJOR_VERSION < 3 PyMODINIT_FUNC initascarray(void); /*proto*/ PyMODINIT_FUNC initascarray(void) #else PyMODINIT_FUNC PyInit_ascarray(void); /*proto*/ PyMODINIT_FUNC PyInit_ascarray(void) #endif { PyObject *__pyx_t_1 = NULL; __Pyx_RefNannyDeclarations #if CYTHON_REFNANNY __Pyx_RefNanny = __Pyx_RefNannyImportAPI("refnanny"); if (!__Pyx_RefNanny) { PyErr_Clear(); __Pyx_RefNanny = __Pyx_RefNannyImportAPI("Cython.Runtime.refnanny"); if (!__Pyx_RefNanny) Py_FatalError("failed to import 'refnanny' module"); } #endif __Pyx_RefNannySetupContext("PyMODINIT_FUNC PyInit_ascarray(void)"); if ( __Pyx_check_binary_version() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_empty_tuple)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #ifdef __pyx_binding_PyCFunctionType_USED if (__pyx_binding_PyCFunctionType_init() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #endif /*--- Library function declarations ---*/ /*--- Threads initialization code ---*/ #if defined(__PYX_FORCE_INIT_THREADS) && __PYX_FORCE_INIT_THREADS #ifdef WITH_THREAD /* Python build with threading support? */ PyEval_InitThreads(); #endif #endif /*--- Module creation code ---*/ #if PY_MAJOR_VERSION < 3 __pyx_m = Py_InitModule4(__Pyx_NAMESTR("ascarray"), __pyx_methods, __Pyx_DOCSTR(__pyx_k_8), 0, PYTHON_API_VERSION); #else __pyx_m = PyModule_Create(&__pyx_moduledef); #endif if (!__pyx_m) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; #if PY_MAJOR_VERSION < 3 Py_INCREF(__pyx_m); #endif __pyx_b = PyImport_AddModule(__Pyx_NAMESTR(__Pyx_BUILTIN_MODULE_NAME)); if (!__pyx_b) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; if (__Pyx_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; /*--- Initialize various global constants etc. ---*/ if (unlikely(__Pyx_InitGlobals() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (__pyx_module_is_main_ascarray) { if (__Pyx_SetAttrString(__pyx_m, "__name__", __pyx_n_s____main__) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; } /*--- Builtin init code ---*/ if (unlikely(__Pyx_InitCachedBuiltins() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} /*--- Constants init code ---*/ if (unlikely(__Pyx_InitCachedConstants() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} /*--- Global init code ---*/ /*--- Variable export code ---*/ /*--- Function export code ---*/ /*--- Type init code ---*/ /*--- Type import code ---*/ /*--- Variable import code ---*/ /*--- Function import code ---*/ /*--- Execution code ---*/ /* "ascarray.pyx":18 * """ * * import numpy # <<<<<<<<<<<<<< * * # ========================================================================== */ __pyx_t_1 = __Pyx_Import(((PyObject *)__pyx_n_s__numpy), 0, -1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 18; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); if (PyObject_SetAttr(__pyx_m, __pyx_n_s__numpy, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 18; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; /* "ascarray.pyx":61 * int strlen(char *s) * * import_array() # <<<<<<<<<<<<<< * * # ========================================================================== */ import_array(); /* "ascarray.pyx":68 * # Read an ASCII table file and return its data as a NumPy array. * # * def ascarray(filename, char *comchar='#!', sepchar=', \t', lines=None, # <<<<<<<<<<<<<< * bad=None, segsep=None): * """ */ __pyx_t_1 = PyCFunction_NewEx(&__pyx_mdef_8ascarray_ascarray, NULL, __pyx_n_s__ascarray); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); if (PyObject_SetAttr(__pyx_m, __pyx_n_s__ascarray, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; /* "ascarray.pyx":218 * return (array, seglist) * * __version__ = '1.2' # <<<<<<<<<<<<<< */ if (PyObject_SetAttr(__pyx_m, __pyx_n_s____version__, ((PyObject *)__pyx_kp_s_9)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 218; __pyx_clineno = __LINE__; goto __pyx_L1_error;} /* "ascarray.pyx":1 * """ # <<<<<<<<<<<<<< * ================ * Module ascarray */ __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_1)); if (PyObject_SetAttr(__pyx_m, __pyx_n_s____test__, ((PyObject *)__pyx_t_1)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); if (__pyx_m) { __Pyx_AddTraceback("init ascarray", __pyx_clineno, __pyx_lineno, __pyx_filename); Py_DECREF(__pyx_m); __pyx_m = 0; } else if (!PyErr_Occurred()) { PyErr_SetString(PyExc_ImportError, "init ascarray"); } __pyx_L0:; __Pyx_RefNannyFinishContext(); #if PY_MAJOR_VERSION < 3 return; #else return __pyx_m; #endif } /* Runtime support code */ #if CYTHON_REFNANNY static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname) { PyObject *m = NULL, *p = NULL; void *r = NULL; m = PyImport_ImportModule((char *)modname); if (!m) goto end; p = PyObject_GetAttrString(m, (char *)"RefNannyAPI"); if (!p) goto end; r = PyLong_AsVoidPtr(p); end: Py_XDECREF(p); Py_XDECREF(m); return (__Pyx_RefNannyAPIStruct *)r; } #endif /* CYTHON_REFNANNY */ static PyObject *__Pyx_GetName(PyObject *dict, PyObject *name) { PyObject *result; result = PyObject_GetAttr(dict, name); if (!result) { if (dict != __pyx_b) { PyErr_Clear(); result = PyObject_GetAttr(__pyx_b, name); } if (!result) { PyErr_SetObject(PyExc_NameError, name); } } return result; } static void __Pyx_RaiseDoubleKeywordsError( const char* func_name, PyObject* kw_name) { PyErr_Format(PyExc_TypeError, #if PY_MAJOR_VERSION >= 3 "%s() got multiple values for keyword argument '%U'", func_name, kw_name); #else "%s() got multiple values for keyword argument '%s'", func_name, PyString_AS_STRING(kw_name)); #endif } static int __Pyx_ParseOptionalKeywords( PyObject *kwds, PyObject **argnames[], PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args, const char* function_name) { PyObject *key = 0, *value = 0; Py_ssize_t pos = 0; PyObject*** name; PyObject*** first_kw_arg = argnames + num_pos_args; while (PyDict_Next(kwds, &pos, &key, &value)) { name = first_kw_arg; while (*name && (**name != key)) name++; if (*name) { values[name-argnames] = value; } else { #if PY_MAJOR_VERSION < 3 if (unlikely(!PyString_CheckExact(key)) && unlikely(!PyString_Check(key))) { #else if (unlikely(!PyUnicode_CheckExact(key)) && unlikely(!PyUnicode_Check(key))) { #endif goto invalid_keyword_type; } else { for (name = first_kw_arg; *name; name++) { #if PY_MAJOR_VERSION >= 3 if (PyUnicode_GET_SIZE(**name) == PyUnicode_GET_SIZE(key) && PyUnicode_Compare(**name, key) == 0) break; #else if (PyString_GET_SIZE(**name) == PyString_GET_SIZE(key) && _PyString_Eq(**name, key)) break; #endif } if (*name) { values[name-argnames] = value; } else { /* unexpected keyword found */ for (name=argnames; name != first_kw_arg; name++) { if (**name == key) goto arg_passed_twice; #if PY_MAJOR_VERSION >= 3 if (PyUnicode_GET_SIZE(**name) == PyUnicode_GET_SIZE(key) && PyUnicode_Compare(**name, key) == 0) goto arg_passed_twice; #else if (PyString_GET_SIZE(**name) == PyString_GET_SIZE(key) && _PyString_Eq(**name, key)) goto arg_passed_twice; #endif } if (kwds2) { if (unlikely(PyDict_SetItem(kwds2, key, value))) goto bad; } else { goto invalid_keyword; } } } } } return 0; arg_passed_twice: __Pyx_RaiseDoubleKeywordsError(function_name, **name); goto bad; invalid_keyword_type: PyErr_Format(PyExc_TypeError, "%s() keywords must be strings", function_name); goto bad; invalid_keyword: PyErr_Format(PyExc_TypeError, #if PY_MAJOR_VERSION < 3 "%s() got an unexpected keyword argument '%s'", function_name, PyString_AsString(key)); #else "%s() got an unexpected keyword argument '%U'", function_name, key); #endif bad: return -1; } static void __Pyx_RaiseArgtupleInvalid( const char* func_name, int exact, Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found) { Py_ssize_t num_expected; const char *more_or_less; if (num_found < num_min) { num_expected = num_min; more_or_less = "at least"; } else { num_expected = num_max; more_or_less = "at most"; } if (exact) { more_or_less = "exactly"; } PyErr_Format(PyExc_TypeError, "%s() takes %s %"PY_FORMAT_SIZE_T"d positional argument%s (%"PY_FORMAT_SIZE_T"d given)", func_name, more_or_less, num_expected, (num_expected == 1) ? "" : "s", num_found); } static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb) { PyObject *tmp_type, *tmp_value, *tmp_tb; PyThreadState *tstate = PyThreadState_GET(); tmp_type = tstate->curexc_type; tmp_value = tstate->curexc_value; tmp_tb = tstate->curexc_traceback; tstate->curexc_type = type; tstate->curexc_value = value; tstate->curexc_traceback = tb; Py_XDECREF(tmp_type); Py_XDECREF(tmp_value); Py_XDECREF(tmp_tb); } static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb) { PyThreadState *tstate = PyThreadState_GET(); *type = tstate->curexc_type; *value = tstate->curexc_value; *tb = tstate->curexc_traceback; tstate->curexc_type = 0; tstate->curexc_value = 0; tstate->curexc_traceback = 0; } #if PY_MAJOR_VERSION < 3 static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause) { /* cause is unused */ Py_XINCREF(type); Py_XINCREF(value); Py_XINCREF(tb); /* First, check the traceback argument, replacing None with NULL. */ if (tb == Py_None) { Py_DECREF(tb); tb = 0; } else if (tb != NULL && !PyTraceBack_Check(tb)) { PyErr_SetString(PyExc_TypeError, "raise: arg 3 must be a traceback or None"); goto raise_error; } /* Next, replace a missing value with None */ if (value == NULL) { value = Py_None; Py_INCREF(value); } #if PY_VERSION_HEX < 0x02050000 if (!PyClass_Check(type)) #else if (!PyType_Check(type)) #endif { /* Raising an instance. The value should be a dummy. */ if (value != Py_None) { PyErr_SetString(PyExc_TypeError, "instance exception may not have a separate value"); goto raise_error; } /* Normalize to raise <class>, <instance> */ Py_DECREF(value); value = type; #if PY_VERSION_HEX < 0x02050000 if (PyInstance_Check(type)) { type = (PyObject*) ((PyInstanceObject*)type)->in_class; Py_INCREF(type); } else { type = 0; PyErr_SetString(PyExc_TypeError, "raise: exception must be an old-style class or instance"); goto raise_error; } #else type = (PyObject*) Py_TYPE(type); Py_INCREF(type); if (!PyType_IsSubtype((PyTypeObject *)type, (PyTypeObject *)PyExc_BaseException)) { PyErr_SetString(PyExc_TypeError, "raise: exception class must be a subclass of BaseException"); goto raise_error; } #endif } __Pyx_ErrRestore(type, value, tb); return; raise_error: Py_XDECREF(value); Py_XDECREF(type); Py_XDECREF(tb); return; } #else /* Python 3+ */ static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause) { if (tb == Py_None) { tb = 0; } else if (tb && !PyTraceBack_Check(tb)) { PyErr_SetString(PyExc_TypeError, "raise: arg 3 must be a traceback or None"); goto bad; } if (value == Py_None) value = 0; if (PyExceptionInstance_Check(type)) { if (value) { PyErr_SetString(PyExc_TypeError, "instance exception may not have a separate value"); goto bad; } value = type; type = (PyObject*) Py_TYPE(value); } else if (!PyExceptionClass_Check(type)) { PyErr_SetString(PyExc_TypeError, "raise: exception class must be a subclass of BaseException"); goto bad; } if (cause) { PyObject *fixed_cause; if (PyExceptionClass_Check(cause)) { fixed_cause = PyObject_CallObject(cause, NULL); if (fixed_cause == NULL) goto bad; } else if (PyExceptionInstance_Check(cause)) { fixed_cause = cause; Py_INCREF(fixed_cause); } else { PyErr_SetString(PyExc_TypeError, "exception causes must derive from " "BaseException"); goto bad; } if (!value) { value = PyObject_CallObject(type, NULL); } PyException_SetCause(value, fixed_cause); } PyErr_SetObject(type, value); if (tb) { PyThreadState *tstate = PyThreadState_GET(); PyObject* tmp_tb = tstate->curexc_traceback; if (tb != tmp_tb) { Py_INCREF(tb); tstate->curexc_traceback = tb; Py_XDECREF(tmp_tb); } } bad: return; } #endif static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index) { PyErr_Format(PyExc_ValueError, "need more than %"PY_FORMAT_SIZE_T"d value%s to unpack", index, (index == 1) ? "" : "s"); } static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected) { PyErr_Format(PyExc_ValueError, "too many values to unpack (expected %"PY_FORMAT_SIZE_T"d)", expected); } static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected) { if (unlikely(retval)) { Py_DECREF(retval); __Pyx_RaiseTooManyValuesError(expected); return -1; } else if (PyErr_Occurred()) { if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) { PyErr_Clear(); return 0; } else { return -1; } } return 0; } static CYTHON_INLINE int __Pyx_div_int(int a, int b) { int q = a / b; int r = a - q*b; q -= ((r != 0) & ((r ^ b) < 0)); return q; } static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, long level) { PyObject *py_import = 0; PyObject *empty_list = 0; PyObject *module = 0; PyObject *global_dict = 0; PyObject *empty_dict = 0; PyObject *list; py_import = __Pyx_GetAttrString(__pyx_b, "__import__"); if (!py_import) goto bad; if (from_list) list = from_list; else { empty_list = PyList_New(0); if (!empty_list) goto bad; list = empty_list; } global_dict = PyModule_GetDict(__pyx_m); if (!global_dict) goto bad; empty_dict = PyDict_New(); if (!empty_dict) goto bad; #if PY_VERSION_HEX >= 0x02050000 { PyObject *py_level = PyInt_FromLong(level); if (!py_level) goto bad; module = PyObject_CallFunctionObjArgs(py_import, name, global_dict, empty_dict, list, py_level, NULL); Py_DECREF(py_level); } #else if (level>0) { PyErr_SetString(PyExc_RuntimeError, "Relative import is not supported for Python <=2.4."); goto bad; } module = PyObject_CallFunctionObjArgs(py_import, name, global_dict, empty_dict, list, NULL); #endif bad: Py_XDECREF(empty_list); Py_XDECREF(py_import); Py_XDECREF(empty_dict); return module; } static CYTHON_INLINE unsigned char __Pyx_PyInt_AsUnsignedChar(PyObject* x) { const unsigned char neg_one = (unsigned char)-1, const_zero = 0; const int is_unsigned = neg_one > const_zero; if (sizeof(unsigned char) < sizeof(long)) { long val = __Pyx_PyInt_AsLong(x); if (unlikely(val != (long)(unsigned char)val)) { if (!unlikely(val == -1 && PyErr_Occurred())) { PyErr_SetString(PyExc_OverflowError, (is_unsigned && unlikely(val < 0)) ? "can't convert negative value to unsigned char" : "value too large to convert to unsigned char"); } return (unsigned char)-1; } return (unsigned char)val; } return (unsigned char)__Pyx_PyInt_AsUnsignedLong(x); } static CYTHON_INLINE unsigned short __Pyx_PyInt_AsUnsignedShort(PyObject* x) { const unsigned short neg_one = (unsigned short)-1, const_zero = 0; const int is_unsigned = neg_one > const_zero; if (sizeof(unsigned short) < sizeof(long)) { long val = __Pyx_PyInt_AsLong(x); if (unlikely(val != (long)(unsigned short)val)) { if (!unlikely(val == -1 && PyErr_Occurred())) { PyErr_SetString(PyExc_OverflowError, (is_unsigned && unlikely(val < 0)) ? "can't convert negative value to unsigned short" : "value too large to convert to unsigned short"); } return (unsigned short)-1; } return (unsigned short)val; } return (unsigned short)__Pyx_PyInt_AsUnsignedLong(x); } static CYTHON_INLINE unsigned int __Pyx_PyInt_AsUnsignedInt(PyObject* x) { const unsigned int neg_one = (unsigned int)-1, const_zero = 0; const int is_unsigned = neg_one > const_zero; if (sizeof(unsigned int) < sizeof(long)) { long val = __Pyx_PyInt_AsLong(x); if (unlikely(val != (long)(unsigned int)val)) { if (!unlikely(val == -1 && PyErr_Occurred())) { PyErr_SetString(PyExc_OverflowError, (is_unsigned && unlikely(val < 0)) ? "can't convert negative value to unsigned int" : "value too large to convert to unsigned int"); } return (unsigned int)-1; } return (unsigned int)val; } return (unsigned int)__Pyx_PyInt_AsUnsignedLong(x); } static CYTHON_INLINE char __Pyx_PyInt_AsChar(PyObject* x) { const char neg_one = (char)-1, const_zero = 0; const int is_unsigned = neg_one > const_zero; if (sizeof(char) < sizeof(long)) { long val = __Pyx_PyInt_AsLong(x); if (unlikely(val != (long)(char)val)) { if (!unlikely(val == -1 && PyErr_Occurred())) { PyErr_SetString(PyExc_OverflowError, (is_unsigned && unlikely(val < 0)) ? "can't convert negative value to char" : "value too large to convert to char"); } return (char)-1; } return (char)val; } return (char)__Pyx_PyInt_AsLong(x); } static CYTHON_INLINE short __Pyx_PyInt_AsShort(PyObject* x) { const short neg_one = (short)-1, const_zero = 0; const int is_unsigned = neg_one > const_zero; if (sizeof(short) < sizeof(long)) { long val = __Pyx_PyInt_AsLong(x); if (unlikely(val != (long)(short)val)) { if (!unlikely(val == -1 && PyErr_Occurred())) { PyErr_SetString(PyExc_OverflowError, (is_unsigned && unlikely(val < 0)) ? "can't convert negative value to short" : "value too large to convert to short"); } return (short)-1; } return (short)val; } return (short)__Pyx_PyInt_AsLong(x); } static CYTHON_INLINE int __Pyx_PyInt_AsInt(PyObject* x) { const int neg_one = (int)-1, const_zero = 0; const int is_unsigned = neg_one > const_zero; if (sizeof(int) < sizeof(long)) { long val = __Pyx_PyInt_AsLong(x); if (unlikely(val != (long)(int)val)) { if (!unlikely(val == -1 && PyErr_Occurred())) { PyErr_SetString(PyExc_OverflowError, (is_unsigned && unlikely(val < 0)) ? "can't convert negative value to int" : "value too large to convert to int"); } return (int)-1; } return (int)val; } return (int)__Pyx_PyInt_AsLong(x); } static CYTHON_INLINE signed char __Pyx_PyInt_AsSignedChar(PyObject* x) { const signed char neg_one = (signed char)-1, const_zero = 0; const int is_unsigned = neg_one > const_zero; if (sizeof(signed char) < sizeof(long)) { long val = __Pyx_PyInt_AsLong(x); if (unlikely(val != (long)(signed char)val)) { if (!unlikely(val == -1 && PyErr_Occurred())) { PyErr_SetString(PyExc_OverflowError, (is_unsigned && unlikely(val < 0)) ? "can't convert negative value to signed char" : "value too large to convert to signed char"); } return (signed char)-1; } return (signed char)val; } return (signed char)__Pyx_PyInt_AsSignedLong(x); } static CYTHON_INLINE signed short __Pyx_PyInt_AsSignedShort(PyObject* x) { const signed short neg_one = (signed short)-1, const_zero = 0; const int is_unsigned = neg_one > const_zero; if (sizeof(signed short) < sizeof(long)) { long val = __Pyx_PyInt_AsLong(x); if (unlikely(val != (long)(signed short)val)) { if (!unlikely(val == -1 && PyErr_Occurred())) { PyErr_SetString(PyExc_OverflowError, (is_unsigned && unlikely(val < 0)) ? "can't convert negative value to signed short" : "value too large to convert to signed short"); } return (signed short)-1; } return (signed short)val; } return (signed short)__Pyx_PyInt_AsSignedLong(x); } static CYTHON_INLINE signed int __Pyx_PyInt_AsSignedInt(PyObject* x) { const signed int neg_one = (signed int)-1, const_zero = 0; const int is_unsigned = neg_one > const_zero; if (sizeof(signed int) < sizeof(long)) { long val = __Pyx_PyInt_AsLong(x); if (unlikely(val != (long)(signed int)val)) { if (!unlikely(val == -1 && PyErr_Occurred())) { PyErr_SetString(PyExc_OverflowError, (is_unsigned && unlikely(val < 0)) ? "can't convert negative value to signed int" : "value too large to convert to signed int"); } return (signed int)-1; } return (signed int)val; } return (signed int)__Pyx_PyInt_AsSignedLong(x); } static CYTHON_INLINE int __Pyx_PyInt_AsLongDouble(PyObject* x) { const int neg_one = (int)-1, const_zero = 0; const int is_unsigned = neg_one > const_zero; if (sizeof(int) < sizeof(long)) { long val = __Pyx_PyInt_AsLong(x); if (unlikely(val != (long)(int)val)) { if (!unlikely(val == -1 && PyErr_Occurred())) { PyErr_SetString(PyExc_OverflowError, (is_unsigned && unlikely(val < 0)) ? "can't convert negative value to int" : "value too large to convert to int"); } return (int)-1; } return (int)val; } return (int)__Pyx_PyInt_AsLong(x); } static CYTHON_INLINE unsigned long __Pyx_PyInt_AsUnsignedLong(PyObject* x) { const unsigned long neg_one = (unsigned long)-1, const_zero = 0; const int is_unsigned = neg_one > const_zero; #if PY_VERSION_HEX < 0x03000000 if (likely(PyInt_Check(x))) { long val = PyInt_AS_LONG(x); if (is_unsigned && unlikely(val < 0)) { PyErr_SetString(PyExc_OverflowError, "can't convert negative value to unsigned long"); return (unsigned long)-1; } return (unsigned long)val; } else #endif if (likely(PyLong_Check(x))) { if (is_unsigned) { if (unlikely(Py_SIZE(x) < 0)) { PyErr_SetString(PyExc_OverflowError, "can't convert negative value to unsigned long"); return (unsigned long)-1; } return (unsigned long)PyLong_AsUnsignedLong(x); } else { return (unsigned long)PyLong_AsLong(x); } } else { unsigned long val; PyObject *tmp = __Pyx_PyNumber_Int(x); if (!tmp) return (unsigned long)-1; val = __Pyx_PyInt_AsUnsignedLong(tmp); Py_DECREF(tmp); return val; } } static CYTHON_INLINE unsigned PY_LONG_LONG __Pyx_PyInt_AsUnsignedLongLong(PyObject* x) { const unsigned PY_LONG_LONG neg_one = (unsigned PY_LONG_LONG)-1, const_zero = 0; const int is_unsigned = neg_one > const_zero; #if PY_VERSION_HEX < 0x03000000 if (likely(PyInt_Check(x))) { long val = PyInt_AS_LONG(x); if (is_unsigned && unlikely(val < 0)) { PyErr_SetString(PyExc_OverflowError, "can't convert negative value to unsigned PY_LONG_LONG"); return (unsigned PY_LONG_LONG)-1; } return (unsigned PY_LONG_LONG)val; } else #endif if (likely(PyLong_Check(x))) { if (is_unsigned) { if (unlikely(Py_SIZE(x) < 0)) { PyErr_SetString(PyExc_OverflowError, "can't convert negative value to unsigned PY_LONG_LONG"); return (unsigned PY_LONG_LONG)-1; } return (unsigned PY_LONG_LONG)PyLong_AsUnsignedLongLong(x); } else { return (unsigned PY_LONG_LONG)PyLong_AsLongLong(x); } } else { unsigned PY_LONG_LONG val; PyObject *tmp = __Pyx_PyNumber_Int(x); if (!tmp) return (unsigned PY_LONG_LONG)-1; val = __Pyx_PyInt_AsUnsignedLongLong(tmp); Py_DECREF(tmp); return val; } } static CYTHON_INLINE long __Pyx_PyInt_AsLong(PyObject* x) { const long neg_one = (long)-1, const_zero = 0; const int is_unsigned = neg_one > const_zero; #if PY_VERSION_HEX < 0x03000000 if (likely(PyInt_Check(x))) { long val = PyInt_AS_LONG(x); if (is_unsigned && unlikely(val < 0)) { PyErr_SetString(PyExc_OverflowError, "can't convert negative value to long"); return (long)-1; } return (long)val; } else #endif if (likely(PyLong_Check(x))) { if (is_unsigned) { if (unlikely(Py_SIZE(x) < 0)) { PyErr_SetString(PyExc_OverflowError, "can't convert negative value to long"); return (long)-1; } return (long)PyLong_AsUnsignedLong(x); } else { return (long)PyLong_AsLong(x); } } else { long val; PyObject *tmp = __Pyx_PyNumber_Int(x); if (!tmp) return (long)-1; val = __Pyx_PyInt_AsLong(tmp); Py_DECREF(tmp); return val; } } static CYTHON_INLINE PY_LONG_LONG __Pyx_PyInt_AsLongLong(PyObject* x) { const PY_LONG_LONG neg_one = (PY_LONG_LONG)-1, const_zero = 0; const int is_unsigned = neg_one > const_zero; #if PY_VERSION_HEX < 0x03000000 if (likely(PyInt_Check(x))) { long val = PyInt_AS_LONG(x); if (is_unsigned && unlikely(val < 0)) { PyErr_SetString(PyExc_OverflowError, "can't convert negative value to PY_LONG_LONG"); return (PY_LONG_LONG)-1; } return (PY_LONG_LONG)val; } else #endif if (likely(PyLong_Check(x))) { if (is_unsigned) { if (unlikely(Py_SIZE(x) < 0)) { PyErr_SetString(PyExc_OverflowError, "can't convert negative value to PY_LONG_LONG"); return (PY_LONG_LONG)-1; } return (PY_LONG_LONG)PyLong_AsUnsignedLongLong(x); } else { return (PY_LONG_LONG)PyLong_AsLongLong(x); } } else { PY_LONG_LONG val; PyObject *tmp = __Pyx_PyNumber_Int(x); if (!tmp) return (PY_LONG_LONG)-1; val = __Pyx_PyInt_AsLongLong(tmp); Py_DECREF(tmp); return val; } } static CYTHON_INLINE signed long __Pyx_PyInt_AsSignedLong(PyObject* x) { const signed long neg_one = (signed long)-1, const_zero = 0; const int is_unsigned = neg_one > const_zero; #if PY_VERSION_HEX < 0x03000000 if (likely(PyInt_Check(x))) { long val = PyInt_AS_LONG(x); if (is_unsigned && unlikely(val < 0)) { PyErr_SetString(PyExc_OverflowError, "can't convert negative value to signed long"); return (signed long)-1; } return (signed long)val; } else #endif if (likely(PyLong_Check(x))) { if (is_unsigned) { if (unlikely(Py_SIZE(x) < 0)) { PyErr_SetString(PyExc_OverflowError, "can't convert negative value to signed long"); return (signed long)-1; } return (signed long)PyLong_AsUnsignedLong(x); } else { return (signed long)PyLong_AsLong(x); } } else { signed long val; PyObject *tmp = __Pyx_PyNumber_Int(x); if (!tmp) return (signed long)-1; val = __Pyx_PyInt_AsSignedLong(tmp); Py_DECREF(tmp); return val; } } static CYTHON_INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject* x) { const signed PY_LONG_LONG neg_one = (signed PY_LONG_LONG)-1, const_zero = 0; const int is_unsigned = neg_one > const_zero; #if PY_VERSION_HEX < 0x03000000 if (likely(PyInt_Check(x))) { long val = PyInt_AS_LONG(x); if (is_unsigned && unlikely(val < 0)) { PyErr_SetString(PyExc_OverflowError, "can't convert negative value to signed PY_LONG_LONG"); return (signed PY_LONG_LONG)-1; } return (signed PY_LONG_LONG)val; } else #endif if (likely(PyLong_Check(x))) { if (is_unsigned) { if (unlikely(Py_SIZE(x) < 0)) { PyErr_SetString(PyExc_OverflowError, "can't convert negative value to signed PY_LONG_LONG"); return (signed PY_LONG_LONG)-1; } return (signed PY_LONG_LONG)PyLong_AsUnsignedLongLong(x); } else { return (signed PY_LONG_LONG)PyLong_AsLongLong(x); } } else { signed PY_LONG_LONG val; PyObject *tmp = __Pyx_PyNumber_Int(x); if (!tmp) return (signed PY_LONG_LONG)-1; val = __Pyx_PyInt_AsSignedLongLong(tmp); Py_DECREF(tmp); return val; } } static int __Pyx_check_binary_version(void) { char ctversion[4], rtversion[4]; PyOS_snprintf(ctversion, 4, "%d.%d", PY_MAJOR_VERSION, PY_MINOR_VERSION); PyOS_snprintf(rtversion, 4, "%s", Py_GetVersion()); if (ctversion[0] != rtversion[0] || ctversion[2] != rtversion[2]) { char message[200]; PyOS_snprintf(message, sizeof(message), "compiletime version %s of module '%.100s' " "does not match runtime version %s", ctversion, __Pyx_MODULE_NAME, rtversion); #if PY_VERSION_HEX < 0x02050000 return PyErr_Warn(NULL, message); #else return PyErr_WarnEx(NULL, message, 1); #endif } return 0; } #include "compile.h" #include "frameobject.h" #include "traceback.h" static void __Pyx_AddTraceback(const char *funcname, int __pyx_clineno, int __pyx_lineno, const char *__pyx_filename) { PyObject *py_srcfile = 0; PyObject *py_funcname = 0; PyObject *py_globals = 0; PyCodeObject *py_code = 0; PyFrameObject *py_frame = 0; #if PY_MAJOR_VERSION < 3 py_srcfile = PyString_FromString(__pyx_filename); #else py_srcfile = PyUnicode_FromString(__pyx_filename); #endif if (!py_srcfile) goto bad; if (__pyx_clineno) { #if PY_MAJOR_VERSION < 3 py_funcname = PyString_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, __pyx_clineno); #else py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, __pyx_clineno); #endif } else { #if PY_MAJOR_VERSION < 3 py_funcname = PyString_FromString(funcname); #else py_funcname = PyUnicode_FromString(funcname); #endif } if (!py_funcname) goto bad; py_globals = PyModule_GetDict(__pyx_m); if (!py_globals) goto bad; py_code = PyCode_New( 0, /*int argcount,*/ #if PY_MAJOR_VERSION >= 3 0, /*int kwonlyargcount,*/ #endif 0, /*int nlocals,*/ 0, /*int stacksize,*/ 0, /*int flags,*/ __pyx_empty_bytes, /*PyObject *code,*/ __pyx_empty_tuple, /*PyObject *consts,*/ __pyx_empty_tuple, /*PyObject *names,*/ __pyx_empty_tuple, /*PyObject *varnames,*/ __pyx_empty_tuple, /*PyObject *freevars,*/ __pyx_empty_tuple, /*PyObject *cellvars,*/ py_srcfile, /*PyObject *filename,*/ py_funcname, /*PyObject *name,*/ __pyx_lineno, /*int firstlineno,*/ __pyx_empty_bytes /*PyObject *lnotab*/ ); if (!py_code) goto bad; py_frame = PyFrame_New( PyThreadState_GET(), /*PyThreadState *tstate,*/ py_code, /*PyCodeObject *code,*/ py_globals, /*PyObject *globals,*/ 0 /*PyObject *locals*/ ); if (!py_frame) goto bad; py_frame->f_lineno = __pyx_lineno; PyTraceBack_Here(py_frame); bad: Py_XDECREF(py_srcfile); Py_XDECREF(py_funcname); Py_XDECREF(py_code); Py_XDECREF(py_frame); } static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) { while (t->p) { #if PY_MAJOR_VERSION < 3 if (t->is_unicode) { *t->p = PyUnicode_DecodeUTF8(t->s, t->n - 1, NULL); } else if (t->intern) { *t->p = PyString_InternFromString(t->s); } else { *t->p = PyString_FromStringAndSize(t->s, t->n - 1); } #else /* Python 3+ has unicode identifiers */ if (t->is_unicode | t->is_str) { if (t->intern) { *t->p = PyUnicode_InternFromString(t->s); } else if (t->encoding) { *t->p = PyUnicode_Decode(t->s, t->n - 1, t->encoding, NULL); } else { *t->p = PyUnicode_FromStringAndSize(t->s, t->n - 1); } } else { *t->p = PyBytes_FromStringAndSize(t->s, t->n - 1); } #endif if (!*t->p) return -1; ++t; } return 0; } /* Type Conversion Functions */ static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject* x) { int is_true = x == Py_True; if (is_true | (x == Py_False) | (x == Py_None)) return is_true; else return PyObject_IsTrue(x); } static CYTHON_INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x) { PyNumberMethods *m; const char *name = NULL; PyObject *res = NULL; #if PY_VERSION_HEX < 0x03000000 if (PyInt_Check(x) || PyLong_Check(x)) #else if (PyLong_Check(x)) #endif return Py_INCREF(x), x; m = Py_TYPE(x)->tp_as_number; #if PY_VERSION_HEX < 0x03000000 if (m && m->nb_int) { name = "int"; res = PyNumber_Int(x); } else if (m && m->nb_long) { name = "long"; res = PyNumber_Long(x); } #else if (m && m->nb_int) { name = "int"; res = PyNumber_Long(x); } #endif if (res) { #if PY_VERSION_HEX < 0x03000000 if (!PyInt_Check(res) && !PyLong_Check(res)) { #else if (!PyLong_Check(res)) { #endif PyErr_Format(PyExc_TypeError, "__%s__ returned non-%s (type %.200s)", name, name, Py_TYPE(res)->tp_name); Py_DECREF(res); return NULL; } } else if (!PyErr_Occurred()) { PyErr_SetString(PyExc_TypeError, "an integer is required"); } return res; } static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) { Py_ssize_t ival; PyObject* x = PyNumber_Index(b); if (!x) return -1; ival = PyInt_AsSsize_t(x); Py_DECREF(x); return ival; } static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t ival) { #if PY_VERSION_HEX < 0x02050000 if (ival <= LONG_MAX) return PyInt_FromLong((long)ival); else { unsigned char *bytes = (unsigned char *) &ival; int one = 1; int little = (int)*(unsigned char*)&one; return _PyLong_FromByteArray(bytes, sizeof(size_t), little, 0); } #else return PyInt_FromSize_t(ival); #endif } static CYTHON_INLINE size_t __Pyx_PyInt_AsSize_t(PyObject* x) { unsigned PY_LONG_LONG val = __Pyx_PyInt_AsUnsignedLongLong(x); if (unlikely(val == (unsigned PY_LONG_LONG)-1 && PyErr_Occurred())) { return (size_t)-1; } else if (unlikely(val != (unsigned PY_LONG_LONG)(size_t)val)) { PyErr_SetString(PyExc_OverflowError, "value too large to convert to size_t"); return (size_t)-1; } return (size_t)val; } #endif /* Py_PYTHON_H */
37.85969
2,002
0.602236
5b0bb1aa4440ded48a0917d0a6bc43c896d8e9fb
1,938
h
C
System/Library/Frameworks/NetworkExtension.framework/NEIKEv2InformationalContext.h
lechium/tvOS135Headers
46cd30d3f0f7962eaa0c3f925cd71f414c65e2ac
[ "MIT" ]
2
2020-07-26T20:30:54.000Z
2020-08-10T04:26:23.000Z
System/Library/Frameworks/NetworkExtension.framework/NEIKEv2InformationalContext.h
lechium/tvOS135Headers
46cd30d3f0f7962eaa0c3f925cd71f414c65e2ac
[ "MIT" ]
1
2020-07-26T20:45:31.000Z
2020-08-09T09:30:46.000Z
System/Library/Frameworks/NetworkExtension.framework/NEIKEv2InformationalContext.h
lechium/tvOS135Headers
46cd30d3f0f7962eaa0c3f925cd71f414c65e2ac
[ "MIT" ]
null
null
null
/* * This header is generated by classdump-dyld 1.0 * on Sunday, June 7, 2020 at 11:16:29 AM Mountain Standard Time * Operating System: Version 13.4.5 (Build 17L562) * Image Source: /System/Library/Frameworks/NetworkExtension.framework/NetworkExtension * classdump-dyld is licensed under GPLv3, Copyright © 2013-2016 by Elias Limneos. */ @protocol OS_dispatch_queue; @class NSArray, NSObject; @interface NEIKEv2InformationalContext : NSObject { unsigned _maxRetries; NSArray* _privateNotifies; unsigned long long _retryIntervalInMilliseconds; NSObject*<OS_dispatch_queue> _callbackQueue; /*^block*/id _callback; } @property (nonatomic,retain) NSArray * privateNotifies; //@synthesize privateNotifies=_privateNotifies - In the implementation block @property (assign,nonatomic) unsigned maxRetries; //@synthesize maxRetries=_maxRetries - In the implementation block @property (assign,nonatomic) unsigned long long retryIntervalInMilliseconds; //@synthesize retryIntervalInMilliseconds=_retryIntervalInMilliseconds - In the implementation block @property (nonatomic,retain) NSObject*<OS_dispatch_queue> callbackQueue; //@synthesize callbackQueue=_callbackQueue - In the implementation block @property (nonatomic,copy) id callback; //@synthesize callback=_callback - In the implementation block -(id)description; -(NSObject*<OS_dispatch_queue>)callbackQueue; -(id)callback; -(void)setCallback:(id)arg1 ; -(void)setCallbackQueue:(NSObject*<OS_dispatch_queue>)arg1 ; -(void)setPrivateNotifies:(NSArray *)arg1 ; -(void)setMaxRetries:(unsigned)arg1 ; -(void)setRetryIntervalInMilliseconds:(unsigned long long)arg1 ; -(unsigned)maxRetries; -(void)sendCallbackSuccess:(BOOL)arg1 session:(id)arg2 ; -(NSArray *)privateNotifies; -(unsigned long long)retryIntervalInMilliseconds; @end
46.142857
190
0.739422
12bed7dd69f3c30256fcca18592077a820a12939
2,371
h
C
host/Host.h
Cat-Ion/midi2c
79ced49bfdaed23cb9947d1f43aa1825d36a83c8
[ "MIT" ]
1
2021-12-26T08:23:08.000Z
2021-12-26T08:23:08.000Z
host/Host.h
Cat-Ion/midi2c
79ced49bfdaed23cb9947d1f43aa1825d36a83c8
[ "MIT" ]
null
null
null
host/Host.h
Cat-Ion/midi2c
79ced49bfdaed23cb9947d1f43aa1825d36a83c8
[ "MIT" ]
null
null
null
/* LUFA Library Copyright (C) Dean Camera, 2014. dean [at] fourwalledcubicle [dot] com www.lufa-lib.org */ /* Copyright 2014 Dean Camera (dean [at] fourwalledcubicle [dot] com) Permission to use, copy, modify, distribute, and sell this software and its documentation for any purpose is hereby granted without fee, provided that the above copyright notice appear in all copies and that both that the copyright notice and this permission notice and warranty disclaimer appear in supporting documentation, and that the name of the author not be used in advertising or publicity pertaining to distribution of the software without specific, written prior permission. The author disclaims all warranties with regard to this software, including all implied warranties of merchantability and fitness. In no event shall the author be liable for any special, 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. */ /** \file * * Header file for MIDI.c. */ #ifndef _HOST_H_ #define _HOST_H_ #include <avr/io.h> #include <avr/wdt.h> #include <avr/power.h> #include <avr/interrupt.h> #include <stdbool.h> #include <string.h> #include "Descriptors.h" #include <LUFA/Drivers/USB/USB.h> #include <LUFA/Platform/Platform.h> void SetupHardware(void); void send_packets(void); void EVENT_USB_Device_Connect(void); void EVENT_USB_Device_Disconnect(void); void EVENT_USB_Device_ConfigurationChanged(void); void EVENT_USB_Device_ControlRequest(void); /** List of codes for non-MIDI commands * The first byte of the answer to each command will be the command, but with the high bit set to 1. */ enum { /** Clients request a continuous block of control addresses using this command * There is one parameter: The number of commands. * The output is the address of the first control, * or 0xFF if none are available. */ GET_ADDRESS = 0x7F }; /** Possible command states. Can be either waiting for * a command, executing some non-MIDI command, or * reading MIDI data */ enum { WAITING_COMMAND = 0x00, COMMAND_GET_ADDRESS = 0x01, COMMAND_MIDI = 0x02 }; #endif
28.914634
100
0.737663
e9912de1df50770b025ea4b1c4826f0c33815b65
126
h
C
tetris_sfml/TetrominoColor.h
daemon3000/Tetris
a78b39485c47916bb0e9178163f1cb23d09b5b83
[ "Zlib", "MIT" ]
null
null
null
tetris_sfml/TetrominoColor.h
daemon3000/Tetris
a78b39485c47916bb0e9178163f1cb23d09b5b83
[ "Zlib", "MIT" ]
null
null
null
tetris_sfml/TetrominoColor.h
daemon3000/Tetris
a78b39485c47916bb0e9178163f1cb23d09b5b83
[ "Zlib", "MIT" ]
null
null
null
#pragma once namespace tetris { enum class TetrominoColor { None = -1, Blue, Green, Gray, Pink, Purple, Red, Yellow }; }
14
57
0.674603
8f05bbbbdd088caa424aed1b0bb5434178203fd6
1,323
c
C
lib/iron_goat/iron_goat/priv/text/load_text.c
norech/myrpg
b2cf714c1089283df65d6c74b7ba892a43d3d553
[ "Apache-2.0" ]
4
2021-05-12T07:04:25.000Z
2021-05-12T18:23:21.000Z
lib/iron_goat/iron_goat/priv/text/load_text.c
norech/myrpg
b2cf714c1089283df65d6c74b7ba892a43d3d553
[ "Apache-2.0" ]
28
2021-03-22T06:18:38.000Z
2021-03-23T14:29:53.000Z
lib/iron_goat/iron_goat/priv/text/load_text.c
norech/myrpg
b2cf714c1089283df65d6c74b7ba892a43d3d553
[ "Apache-2.0" ]
1
2021-05-13T05:39:27.000Z
2021-05-13T05:39:27.000Z
/* ** EPITECH PROJECT, 2021 ** iron_goat ** File description: ** text_load.c */ #include "text.h" static const struct iron_goat_text_halign_parser IG_HALIGN_TOKENS_PARSER[] = { {HALIGN_CENTER, "center"}, {HALIGN_RIGHT, "right"}, {HALIGN_JUSTIFY, "justify"}, {HALIGN_LEFT, "left"} }; static const struct iron_goat_text_valign_parser IG_VALIGN_TOKENS_PARSER[] = { {VALIGN_CENTER, "center"}, {VALIGN_BOTTOM, "bottom"}, {VALIGN_TOP, "top"}, }; bool iron_goat_load_valign(struct json *conf, struct iron_goat_text *self) { for (size_t i = 0; i < ARRAY_SIZE(IG_HALIGN_TOKENS_PARSER); i++) { if (estrcmp(conf->v.string, IG_VALIGN_TOKENS_PARSER[i].match) == 0) { self->valign = IG_VALIGN_TOKENS_PARSER[i].type; return (true); } } ASSERT("Json", "Tokens parser valign unrecognized token"); return (false); } bool iron_goat_text_load_halign(struct json *conf, struct iron_goat_text *self) { for (size_t i = 0; i < ARRAY_SIZE(IG_HALIGN_TOKENS_PARSER); i++) { if (estrcmp(conf->v.string, IG_HALIGN_TOKENS_PARSER[i].match) == 0) { self->halign = IG_HALIGN_TOKENS_PARSER[i].type; return (true); } } ASSERT("Json", "Tokens parser halign unrecognized token"); return (false); }
27
78
0.645503
6a75be781078a7bb9c09b8874c2439fdd8b6842c
408
h
C
plugins/wallet_plugin/include/eosio/wallet_plugin/macos_user_auth.h
yinchengtsinghua/EOSIOChineseCPP
dceabf6315ab8c9a064c76e943b2b44037165a85
[ "MIT" ]
21
2019-01-23T04:17:48.000Z
2021-11-15T10:50:33.000Z
plugins/wallet_plugin/include/eosio/wallet_plugin/macos_user_auth.h
jiege1994/EOSIOChineseCPP
dceabf6315ab8c9a064c76e943b2b44037165a85
[ "MIT" ]
1
2019-08-06T07:53:54.000Z
2019-08-13T06:51:29.000Z
plugins/wallet_plugin/include/eosio/wallet_plugin/macos_user_auth.h
jiege1994/EOSIOChineseCPP
dceabf6315ab8c9a064c76e943b2b44037165a85
[ "MIT" ]
11
2019-01-24T07:47:43.000Z
2020-10-29T02:18:20.000Z
//此源码被清华学神尹成大魔王专业翻译分析并修改 //尹成QQ77025077 //尹成微信18510341407 //尹成所在QQ群721929980 //尹成邮箱 yinc13@mails.tsinghua.edu.cn //尹成毕业于清华大学,微软区块链领域全球最有价值专家 //https://mvp.microsoft.com/zh-cn/PublicProfile/4033620 #pragma once #include <CoreFoundation/CoreFoundation.h> //请求用户身份验证,并在强制后使用true/false调用回调。**请注意,回调 //将在单独的线程中完成** extern "C" void macos_user_auth(void(*cb)(int, void*), void* cb_userdata, CFStringRef message);
27.2
95
0.789216
b15d7e64b67d89b37b36427812af252cc6dc86db
4,664
c
C
examples/nortos/MSP_EXP432P4111/iqmathlib/functional/functional.c
ArakniD/simplelink_msp432p4_sdk
002fd4866284891e0b9b1a8d917a74334d39a997
[ "BSD-3-Clause" ]
2
2022-02-28T01:38:24.000Z
2022-02-28T01:38:31.000Z
examples/nortos/MSP_EXP432P4111/iqmathlib/functional/functional.c
ArakniD/simplelink_msp432p4_sdk
002fd4866284891e0b9b1a8d917a74334d39a997
[ "BSD-3-Clause" ]
3
2019-05-10T04:24:45.000Z
2019-05-10T05:53:34.000Z
examples/nortos/MSP_EXP432P4111/iqmathlib/functional/functional.c
ArakniD/simplelink_msp432p4_sdk
002fd4866284891e0b9b1a8d917a74334d39a997
[ "BSD-3-Clause" ]
null
null
null
/* --COPYRIGHT--,BSD * Copyright (c) 2016, Texas Instruments Incorporated * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * * 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 Texas Instruments Incorporated 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. * --/COPYRIGHT--*/ //***************************************************************************** // functional: Qmath functional example. // // This example demonstrates how to use the Qmath functions to perform basic // operations. // // B. Peterson // Texas Instruments Inc. // January 2015 //***************************************************************************** #include <ti/devices/msp432p4xx/inc/msp432.h> #include <stdint.h> #define PI 3.1415926536 /* Select the global Q value */ #define GLOBAL_Q 12 /* Include the iqmathlib header files */ #include <ti/iqmathlib/QmathLib.h> #include <ti/iqmathlib/IQmathLib.h> volatile float res; // floating point variable to verify results int main(void) { _q qA, qB, qC; // Q variables using global type _q8 q8A, q8B, q8C; // Q variables using Q8 type _q15 q15A, q15C; // Q variables using Q15 type /* Disable WDT. */ WDT_A->CTL = WDT_A_CTL_PW | WDT_A_CTL_HOLD; /* Basic global Q operations. */ qA = _Q(1.0); qB = _Q(2.5); qC = qA + qB; res=_QtoF(qC); // 3.5 = 1.0 + 2.5 qC = qC - _Qmpy2(qA); res=_QtoF(qC); // 1.5 = 3.5 - 2*(1.0) qC = _Qmpy(qB, qC); res=_QtoF(qC); // 3.75 = 2.5 * 1.5 qC = _Qdiv(qC, qB); res=_QtoF(qC); // 1.5 = 3.75 / 2.5 qC = _Qsqrt(qB); res=_QtoF(qC); // 1.58114 = sqrt(2.5) /* Trigonometric global Q operations. */ qA = _Q(PI/4.0); qB = _Q(0.5); qC = _Qsin(qA); res=_QtoF(qC); // 0.70710 = sin(PI/4) qC = _Qcos(qA); res=_QtoF(qC); // 0.70710 = cos(PI/4) qC = _Qatan(qB); res=_QtoF(qC); // 0.46365 = atan(0.5) /* Exponential global Q operations. */ qA = _Q(2.71828); qB = _Q(0.5); qC = _Qlog(qA); res=_QtoF(qC); // 1.0 = ln(e) qC = _Qexp(qB); res=_QtoF(qC); // 1.6487 = e^0.5 /* Basic explicit type Q8 operations. */ q8A = _Q8(1.0); q8B = _Q8(2.5); q8C = q8A + q8B; res=_Q8toF(q8C); // 3.5 = 1.0 + 2.5 q8C = q8C - _Qmpy2(q8A); res=_Q8toF(q8C); // 1.5 = 3.5 - 2*(1.0) q8C = _Q8mpy(q8B, q8C); res=_Q8toF(q8C); // 3.75 = 2.5 * 1.5 q8C = _Q8div(q8C, q8B); res=_Q8toF(q8C); // 1.5 = 3.75 / 2.5 q8C = _Q8sqrt(q8B); res=_Q8toF(q8C); // 1.58114 = sqrt(2.5) /* Trigonometric explicit type Q15 operations. */ q15A = _Q15(PI/4.0); q15C = _Q15sin(q15A); res=_Q15toF(q15C); // 0.70710 = sin(PI/4) q15C = _Q15cos(q15A); res=_Q15toF(q15C); // 0.70710 = cos(PI/4) /* Explicit type Q8 to Global Q conversion with saturation check. */ q8A = _Q8(1.0); q8B = _Q8(16.0); qC = _Q8toQ(_Qsat(q8A, _QtoQ8(MAX_Q_POS), _QtoQ8(MAX_Q_NEG))); res = _QtoF(qC); // _Q8(1.0) -> _Q(1.0) (q8A does not saturate) qC = _Q8toQ(_Qsat(q8B, _QtoQ8(MAX_Q_POS), _QtoQ8(MAX_Q_NEG))); res = _QtoF(qC); // _Q8(16.0) -> ~MAX_Q_POS (q8A saturates to maximum positive _Q value) return 0; }
41.642857
95
0.602916
7592da7395d5a48dd63a0e9368721b8c60912476
8,053
h
C
src/xrGame/ai/monsters/group_states/group_state_attack_run_inline.h
clayne/xray-16
32ebf81a252c7179e2824b2874f911a91e822ad1
[ "OML", "Linux-OpenIB" ]
2
2015-02-23T10:43:02.000Z
2015-06-11T14:45:08.000Z
src/xrGame/ai/monsters/group_states/group_state_attack_run_inline.h
clayne/xray-16
32ebf81a252c7179e2824b2874f911a91e822ad1
[ "OML", "Linux-OpenIB" ]
17
2022-01-25T08:58:23.000Z
2022-03-28T17:18:28.000Z
src/xrGame/ai/monsters/group_states/group_state_attack_run_inline.h
clayne/xray-16
32ebf81a252c7179e2824b2874f911a91e822ad1
[ "OML", "Linux-OpenIB" ]
1
2015-06-05T20:04:00.000Z
2015-06-05T20:04:00.000Z
#pragma once #include "ai/monsters/ai_monster_squad.h" #include "ai/monsters/ai_monster_squad_manager.h" #define TEMPLATE_SPECIALIZATION \ template <typename _Object\ > #define CStateGroupAttackRunAbstract CStateGroupAttackRun<_Object> TEMPLATE_SPECIALIZATION CStateGroupAttackRunAbstract::CStateGroupAttackRun(_Object* obj) : inherited(obj) { m_next_encircle_tick = 0; } TEMPLATE_SPECIALIZATION void CStateGroupAttackRunAbstract::initialize() { inherited::initialize(); this->object->path().prepare_builder(); // interception m_intercept_tick = Device.dwTimeGlobal; m_intercept.setHP(::Random.randF(M_PI * 2.f), 0); m_intercept.normalize_safe(); if (!m_intercept.magnitude()) { m_intercept.set(0.f, 0.f, 1.f); } m_intercept_length = 3000 + rand() % 4000; // prediction m_memorized_tick = Device.dwTimeGlobal; m_memorized_pos = this->object->EnemyMan.get_enemy()->Position(); m_predicted_vel = cr_fvector3(0.f); // encirclement if (Device.dwTimeGlobal > m_next_encircle_tick) { m_encircle_time = 2000 + rand() % 4000; m_next_encircle_tick = Device.dwTimeGlobal + 8000 + rand() % 8000; } else { m_encircle_time = 0; } m_encircle_dir = m_intercept; CMonsterSquad* squad = monster_squad().get_squad(this->object); if (squad && squad->SquadActive()) { SSquadCommand command; squad->GetCommand(this->object, command); if (command.type == SC_ATTACK) { m_encircle_dir = command.direction; } } m_encircle_dir.normalize_safe(); if (!m_encircle_dir.magnitude()) { m_encircle_dir.set(0.f, 0.f, 1.f); } } TEMPLATE_SPECIALIZATION void CStateGroupAttackRunAbstract::execute() { if (Device.dwTimeGlobal > m_intercept_tick + m_intercept_length) { m_intercept_tick = Device.dwTimeGlobal; m_intercept_length = 2000 + (rand() % 4000); m_intercept.setHP(::Random.randF(M_PI * 2.f), 0); m_intercept.normalize_safe(); if (!magnitude(m_intercept)) { m_intercept.set(0.f, 0.f, 1.f); } } const Fvector enemy_pos = this->object->EnemyMan.get_enemy()->Position(); const int memory_update_ms = 250; if (Device.dwTimeGlobal > m_memorized_tick + memory_update_ms) { m_predicted_vel = (enemy_pos - m_memorized_pos) * (1000.f / (Device.dwTimeGlobal - m_memorized_tick)); m_predicted_vel.clamp(Fvector().set(10, 10, 10)); m_memorized_tick = Device.dwTimeGlobal; m_memorized_pos = enemy_pos; } const SVelocityParam velocity_run = this->object->move().get_velocity(MonsterMovement::eVelocityParameterRunNormal); const float self_vel = velocity_run.velocity.linear; const Fvector self_pos = this->object->Position(); const Fvector self2enemy = enemy_pos - self_pos; const float self2enemy_dist = magnitude(self2enemy); const float epsilon = 0.001f; float prediction_time = 0; if (self_vel > epsilon) { prediction_time = self2enemy_dist / self_vel; const int max_prediction_time = 5000; if (prediction_time > max_prediction_time) { prediction_time = max_prediction_time; } } // classify if predicted enemy going to the left or right (viewed from our eyes) const Fvector linear_prediction = enemy_pos + m_predicted_vel * prediction_time; const Fvector self2linear = linear_prediction - self_pos; const bool predicted_left = crossproduct(self2linear, self2enemy).z > 0; float h_angle, p_angle; self2enemy.getHP(h_angle, p_angle); const float angle = self2enemy_dist > epsilon ? 0.5f * prediction_time * magnitude(m_predicted_vel) / self2enemy_dist : 0; h_angle = angle_normalize(h_angle + (predicted_left ? +1 : -1) * angle); const Fvector radial_prediction = self_pos + Fvector().setHP(h_angle, p_angle).normalize_safe() * self2enemy_dist; Fvector target = radial_prediction + m_intercept * self2enemy_dist * 0.5f; const u32 old_vertex = this->object->ai_location().level_vertex_id(); u32 vertex = ai().level_graph().check_position_in_direction(old_vertex, self_pos, target); if (!ai().level_graph().valid_vertex_id(vertex)) { target = enemy_pos; vertex = this->object->EnemyMan.get_enemy()->ai_location().level_vertex_id(); } // установка параметров функциональных блоков this->object->set_action(ACT_RUN); this->object->anim().accel_activate(eAT_Aggressive); this->object->anim().accel_set_braking(false); this->object->path().set_target_point(target, vertex); this->object->path().set_rebuild_time(this->object->get_attack_rebuild_time()); this->object->path().set_use_covers(false); // object->path().set_cover_params (0.1f, 30.f, 1.f, 30.f); this->object->set_state_sound(MonsterSound::eMonsterSoundAggressive); this->object->path().extrapolate_path(true); this->object->path().set_try_min_time(self2enemy_dist >= 5.f); const bool enemy_at_home = this->object->Home->at_home(enemy_pos); if (!enemy_at_home || Device.dwTimeGlobal < this->time_state_started + m_encircle_time) { this->object->path().set_use_dest_orient(true); this->object->path().set_dest_direction(m_encircle_dir); this->object->path().set_try_min_time(false); } else { this->object->path().set_use_dest_orient(false); } } // TEMPLATE_SPECIALIZATION // void CStateGroupAttackRunAbstract::execute() // { // // установка параметров функциональных блоков // object->set_action (ACT_RUN); // object->anim().accel_activate (eAT_Aggressive); // object->anim().accel_set_braking (false); // object->path().set_target_point (object->EnemyMan.get_enemy_position(), // object->EnemyMan.get_enemy_vertex()); // object->path().set_rebuild_time (object->get_attack_rebuild_time()); // object->path().set_use_covers (); // object->path().set_cover_params (0.1f, 30.f, 1.f, 30.f); // object->path().set_try_min_time (false); // object->set_state_sound (MonsterSound::eMonsterSoundAggressive); // // object->path().extrapolate_path (true); // // // обработать squad инфо // object->path().set_use_dest_orient (false); // // // // if ( g_bDogsDirMode ) // if ( Device.dwTimeGlobal-time_state_started < m_max_encircle_time ) // { // CMonsterSquad *squad = monster_squad().get_squad(object); // if (squad && squad->SquadActive()) { // // Получить команду // SSquadCommand command; // squad->GetCommand(object, command); // // if (command.type == SC_ATTACK) { // object->path().set_use_dest_orient (true); // //object->path().set_dest_direction (command.direction); // object->path().set_dest_direction (m_dir_to_enemy); // } // } // } //} TEMPLATE_SPECIALIZATION void CStateGroupAttackRunAbstract::finalize() { inherited::finalize(); this->object->path().extrapolate_path(false); } TEMPLATE_SPECIALIZATION void CStateGroupAttackRunAbstract::critical_finalize() { inherited::critical_finalize(); this->object->path().extrapolate_path(false); } TEMPLATE_SPECIALIZATION bool CStateGroupAttackRunAbstract::check_completion() { const float m_fDistMin = this->object->MeleeChecker.get_min_distance(); const float dist = this->object->MeleeChecker.distance_to_enemy(this->object->EnemyMan.get_enemy()); if (dist < m_fDistMin) { return true; } // if ( !ai().level_graph().valid_vertex_id(object->EnemyMan.get_enemy_vertex()) ) // { // return true; // } return false; } TEMPLATE_SPECIALIZATION bool CStateGroupAttackRunAbstract::check_start_conditions() { const float m_fDistMax = this->object->MeleeChecker.get_max_distance(); const float dist = this->object->MeleeChecker.distance_to_enemy(this->object->EnemyMan.get_enemy()); if (dist > m_fDistMax) { return true; } return false; }
31.704724
120
0.681982
d4d570a95ae42b77525a4e8304f965b20c4e702d
5,462
h
C
src/qt/qtwebkit/Source/WebKit2/Shared/API/c/WKContextMenuItemTypes.h
viewdy/phantomjs
eddb0db1d253fd0c546060a4555554c8ee08c13c
[ "BSD-3-Clause" ]
1
2015-05-27T13:52:20.000Z
2015-05-27T13:52:20.000Z
src/qt/qtwebkit/Source/WebKit2/Shared/API/c/WKContextMenuItemTypes.h
mrampersad/phantomjs
dca6f77a36699eb4e1c46f7600cca618f01b0ac3
[ "BSD-3-Clause" ]
null
null
null
src/qt/qtwebkit/Source/WebKit2/Shared/API/c/WKContextMenuItemTypes.h
mrampersad/phantomjs
dca6f77a36699eb4e1c46f7600cca618f01b0ac3
[ "BSD-3-Clause" ]
1
2017-03-19T13:03:23.000Z
2017-03-19T13:03:23.000Z
/* * Copyright (C) 2010 Apple 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: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS 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 APPLE INC. OR ITS 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 WKContextMenuItemTypes_h #define WKContextMenuItemTypes_h #ifdef __cplusplus extern "C" { #endif enum { kWKContextMenuItemTagNoAction = 0, kWKContextMenuItemTagOpenLinkInNewWindow, kWKContextMenuItemTagDownloadLinkToDisk, kWKContextMenuItemTagCopyLinkToClipboard, kWKContextMenuItemTagOpenImageInNewWindow, kWKContextMenuItemTagDownloadImageToDisk, kWKContextMenuItemTagCopyImageToClipboard, kWKContextMenuItemTagOpenFrameInNewWindow, kWKContextMenuItemTagCopy, kWKContextMenuItemTagGoBack, kWKContextMenuItemTagGoForward, kWKContextMenuItemTagStop, kWKContextMenuItemTagReload, kWKContextMenuItemTagCut, kWKContextMenuItemTagPaste, kWKContextMenuItemTagSpellingGuess, kWKContextMenuItemTagNoGuessesFound, kWKContextMenuItemTagIgnoreSpelling, kWKContextMenuItemTagLearnSpelling, kWKContextMenuItemTagOther, kWKContextMenuItemTagSearchInSpotlight, kWKContextMenuItemTagSearchWeb, kWKContextMenuItemTagLookUpInDictionary, kWKContextMenuItemTagOpenWithDefaultApplication, kWKContextMenuItemTagPDFActualSize, kWKContextMenuItemTagPDFZoomIn, kWKContextMenuItemTagPDFZoomOut, kWKContextMenuItemTagPDFAutoSize, kWKContextMenuItemTagPDFSinglePage, kWKContextMenuItemTagPDFFacingPages, kWKContextMenuItemTagPDFContinuous, kWKContextMenuItemTagPDFNextPage, kWKContextMenuItemTagPDFPreviousPage, kWKContextMenuItemTagOpenLink, kWKContextMenuItemTagIgnoreGrammar, kWKContextMenuItemTagSpellingMenu, kWKContextMenuItemTagShowSpellingPanel, kWKContextMenuItemTagCheckSpelling, kWKContextMenuItemTagCheckSpellingWhileTyping, kWKContextMenuItemTagCheckGrammarWithSpelling, kWKContextMenuItemTagFontMenu, kWKContextMenuItemTagShowFonts, kWKContextMenuItemTagBold, kWKContextMenuItemTagItalic, kWKContextMenuItemTagUnderline, kWKContextMenuItemTagOutline, kWKContextMenuItemTagStyles, kWKContextMenuItemTagShowColors, kWKContextMenuItemTagSpeechMenu, kWKContextMenuItemTagStartSpeaking, kWKContextMenuItemTagStopSpeaking, kWKContextMenuItemTagWritingDirectionMenu, kWKContextMenuItemTagDefaultDirection, kWKContextMenuItemTagLeftToRight, kWKContextMenuItemTagRightToLeft, kWKContextMenuItemTagPDFSinglePageScrolling, kWKContextMenuItemTagPDFFacingPagesScrolling, kWKContextMenuItemTagInspectElement, kWKContextMenuItemTagTextDirectionMenu, kWKContextMenuItemTagTextDirectionDefault, kWKContextMenuItemTagTextDirectionLeftToRight, kWKContextMenuItemTagTextDirectionRightToLeft, kWKContextMenuItemTagCorrectSpellingAutomatically, kWKContextMenuItemTagSubstitutionsMenu, kWKContextMenuItemTagShowSubstitutions, kWKContextMenuItemTagSmartCopyPaste, kWKContextMenuItemTagSmartQuotes, kWKContextMenuItemTagSmartDashes, kWKContextMenuItemTagSmartLinks, kWKContextMenuItemTagTextReplacement, kWKContextMenuItemTagTransformationsMenu, kWKContextMenuItemTagMakeUpperCase, kWKContextMenuItemTagMakeLowerCase, kWKContextMenuItemTagCapitalize, kWKContextMenuItemTagChangeBack, kWKContextMenuItemTagOpenMediaInNewWindow, kWKContextMenuItemTagDownloadMediaToDisk, kWKContextMenuItemTagCopyMediaLinkToClipboard, kWKContextMenuItemTagToggleMediaControls, kWKContextMenuItemTagToggleMediaLoop, kWKContextMenuItemTagEnterVideoFullscreen, kWKContextMenuItemTagMediaPlayPause, kWKContextMenuItemTagMediaMute, kWKContextMenuItemTagDictationAlternative, kWKContextMenuItemTagCopyImageUrlToClipboard, kWKContextMenuItemTagSelectAll, kWKContextMenuItemTagOpenLinkInThisWindow, kWKContextMenuItemTagToggleVideoFullscreen, kWKContextMenuItemBaseApplicationTag = 10000 }; typedef uint32_t WKContextMenuItemTag; enum { kWKContextMenuItemTypeAction, kWKContextMenuItemTypeCheckableAction, kWKContextMenuItemTypeSeparator, kWKContextMenuItemTypeSubmenu }; typedef uint32_t WKContextMenuItemType; #ifdef __cplusplus } #endif #endif /* WKContextMenuItemTypes_h */
39.294964
75
0.826437
6d778e15276df79c4852cd3b34c27dd57b24f104
637
h
C
src/gui/RealityUI/qtDesignerPlugins/ReSkinEditorPlugin.h
danielbui78/reality
7ecd01b71f28e581becfe5093fab3ddcd6d9b2c1
[ "BSD-3-Clause" ]
2
2021-12-25T17:24:03.000Z
2022-03-14T05:07:51.000Z
src/gui/RealityUI/qtDesignerPlugins/ReSkinEditorPlugin.h
danielbui78/reality
7ecd01b71f28e581becfe5093fab3ddcd6d9b2c1
[ "BSD-3-Clause" ]
null
null
null
src/gui/RealityUI/qtDesignerPlugins/ReSkinEditorPlugin.h
danielbui78/reality
7ecd01b71f28e581becfe5093fab3ddcd6d9b2c1
[ "BSD-3-Clause" ]
2
2021-12-10T05:33:04.000Z
2021-12-10T16:38:54.000Z
/** * Plugin for using the ReImageMapManager with Qt Designer. */ #ifndef __RE_SKIN_EDITOR_PLUGIN_H__ #define __RE_SKIN_EDITOR_PLUGIN_H__ #include <QtDesigner/QDesignerCustomWidgetInterface> class ReSkinEditorPlugin : public QObject, public QDesignerCustomWidgetInterface { Q_OBJECT Q_INTERFACES(QDesignerCustomWidgetInterface) public: ReSkinEditorPlugin(QObject* parent = 0); QString name() const ; QString includeFile() const ; QString group() const; QIcon icon() const; QString toolTip() const; QString whatsThis() const; bool isContainer() const; QWidget* createWidget(QWidget* parent); }; #endif
19.90625
82
0.766091
0d56a0c0983cfb36ec0af1b36271a0fe0bfa8791
2,391
h
C
WalletKitCore/src/hedera/proto/Duration.pb-c.h
globalid/walletkit
a168fa73018634f168d795fc2742dfddfc116d96
[ "MIT" ]
271
2016-07-21T19:21:03.000Z
2022-03-30T00:32:19.000Z
hedera/proto/Duration.pb-c.h
wildwes357/breadwallet-core
73566cb79f753954eccbf07d5ab25ca54741198e
[ "MIT" ]
147
2016-07-22T10:28:43.000Z
2022-01-24T23:39:51.000Z
hedera/proto/Duration.pb-c.h
wildwes357/breadwallet-core
73566cb79f753954eccbf07d5ab25ca54741198e
[ "MIT" ]
273
2016-07-21T21:52:58.000Z
2022-03-23T19:16:21.000Z
/* Generated by the protocol buffer compiler. DO NOT EDIT! */ /* Generated from: Duration.proto */ #ifndef PROTOBUF_C_Duration_2eproto__INCLUDED #define PROTOBUF_C_Duration_2eproto__INCLUDED #include "protobuf-c.h" PROTOBUF_C__BEGIN_DECLS #if PROTOBUF_C_VERSION_NUMBER < 1003000 # error This file was generated by a newer version of protoc-c which is incompatible with your libprotobuf-c headers. Please update your headers. #elif 1003002 < PROTOBUF_C_MIN_COMPILER_VERSION # error This file was generated by an older version of protoc-c which is incompatible with your libprotobuf-c headers. Please regenerate this file with a newer version of protoc-c. #endif typedef struct _Proto__Duration Proto__Duration; /* --- enums --- */ /* --- messages --- */ /* * The length of a period of time. This is an identical data structure to the protobuf Duration.proto (see the comments in https://github.com/google/protobuf/blob/master/src/google/protobuf/duration.proto) */ struct _Proto__Duration { ProtobufCMessage base; /* * number of seconds */ int64_t seconds; }; #define PROTO__DURATION__INIT \ { PROTOBUF_C_MESSAGE_INIT (&proto__duration__descriptor) \ , 0 } /* Proto__Duration methods */ void proto__duration__init (Proto__Duration *message); size_t proto__duration__get_packed_size (const Proto__Duration *message); size_t proto__duration__pack (const Proto__Duration *message, uint8_t *out); size_t proto__duration__pack_to_buffer (const Proto__Duration *message, ProtobufCBuffer *buffer); Proto__Duration * proto__duration__unpack (ProtobufCAllocator *allocator, size_t len, const uint8_t *data); void proto__duration__free_unpacked (Proto__Duration *message, ProtobufCAllocator *allocator); /* --- per-message closures --- */ typedef void (*Proto__Duration_Closure) (const Proto__Duration *message, void *closure_data); /* --- services --- */ /* --- descriptors --- */ extern const ProtobufCMessageDescriptor proto__duration__descriptor; PROTOBUF_C__END_DECLS #endif /* PROTOBUF_C_Duration_2eproto__INCLUDED */
30.653846
207
0.67294
33baa2de74ef8a270eac6ba581f4d7a873a4f40c
1,004
h
C
src/common/periodicActionExecutor.h
salarii/dims
b8008c49edd10a9ca50923b89e3b469c342d9cee
[ "MIT" ]
1
2015-01-22T11:22:19.000Z
2015-01-22T11:22:19.000Z
src/common/periodicActionExecutor.h
salivan-ratcoin-dev-team/dims
b8008c49edd10a9ca50923b89e3b469c342d9cee
[ "MIT" ]
null
null
null
src/common/periodicActionExecutor.h
salivan-ratcoin-dev-team/dims
b8008c49edd10a9ca50923b89e3b469c342d9cee
[ "MIT" ]
null
null
null
// Copyright (c) 2014-2015 DiMS dev-team // Distributed under the MIT/X11 software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. #ifndef PERIODIC_ACTION_EXECUTOR_H #define PERIODIC_ACTION_EXECUTOR_H #include "util.h" namespace common { class CAction; class CDefferedAction { public: CDefferedAction( CAction * _action, int64_t _deffer ); bool isReady(); void reset(); void getRequest() const; private: int64_t const m_deffer; int64_t m_time; CAction * m_action; }; class CPeriodicActionExecutor { public: static CPeriodicActionExecutor* getInstance(); ~CPeriodicActionExecutor(){}; void processingLoop(); void addAction( CAction * _action, unsigned int _milisec ); private: CPeriodicActionExecutor(); private: static CPeriodicActionExecutor * ms_instance; static unsigned int const m_sleepTime; mutable boost::mutex m_mutex; std::list< CDefferedAction > m_periodicActions; }; } #endif // PERIODIC_ACTION_EXECUTOR_H
17.928571
71
0.768924
d491d404069983e4a4184c79182b1ebf6a33972b
1,341
h
C
Applications/Feedback Assistant iOS/FBAFormResponseStub.h
lechium/iOS1351Headers
6bed3dada5ffc20366b27f7f2300a24a48a6284e
[ "MIT" ]
2
2021-11-02T09:23:27.000Z
2022-03-28T08:21:57.000Z
Applications/Feedback Assistant iOS/FBAFormResponseStub.h
lechium/iOS1351Headers
6bed3dada5ffc20366b27f7f2300a24a48a6284e
[ "MIT" ]
null
null
null
Applications/Feedback Assistant iOS/FBAFormResponseStub.h
lechium/iOS1351Headers
6bed3dada5ffc20366b27f7f2300a24a48a6284e
[ "MIT" ]
1
2022-03-28T08:21:59.000Z
2022-03-28T08:21:59.000Z
// // Generated by classdumpios 1.0.1 (64 bit) (iOS port by DreamDevLost)(Debug version compiled Sep 26 2020 13:48:20). // // Copyright (C) 1997-2019 Steve Nygard. // #import "FBAManagedFeedbackObject.h" @class FBAContentItem, FBAFeedback, NSArray, NSDate, NSNumber, NSString; @interface FBAFormResponseStub : FBAManagedFeedbackObject { } + (id)entityName; // IMP=0x00000001000b7708 + (id)fetchRequest; // IMP=0x00000001000d8c90 @property(readonly) NSNumber *followupCount; @property(readonly) _Bool isSubmitted; @property(readonly, nonatomic) FBAFeedback *feedback; - (id)visibleFilePromises; // IMP=0x00000001000b7d2c - (void)setPropertiesFromJSONObject:(id)arg1; // IMP=0x00000001000b7714 // Remaining properties @property(retain, nonatomic) FBAContentItem *contentItem; // @dynamic contentItem; @property(retain, nonatomic) NSArray *filePromiseStubs; // @dynamic filePromiseStubs; @property(copy, nonatomic) NSNumber *formID; // @dynamic formID; @property(retain, nonatomic) NSArray *questionGroupStubs; // @dynamic questionGroupStubs; @property(copy, nonatomic) NSNumber *remoteID; // @dynamic remoteID; @property(copy, nonatomic) NSString *searchText; // @dynamic searchText; @property(copy, nonatomic) NSDate *submittedAt; // @dynamic submittedAt; @property(copy, nonatomic) NSDate *updatedAt; // @dynamic updatedAt; @end
38.314286
120
0.770321
81d82e3a8446ee51ea21345a253eeb9119225cb9
3,876
h
C
Dark soft/Carberp Botnet/source - absource/pro/all source/BlackJoeWhiteJoe/include/layout/nsIAnonymousContentCreator.h
ExaByt3s/hack_scripts
cc801b36ea25f3b5a82d2900f53f5036e7abd8ad
[ "WTFPL" ]
3
2021-01-22T19:32:23.000Z
2022-01-03T01:06:44.000Z
Dark soft/Carberp Botnet/source - absource/pro/all source/BlackJoeWhiteJoe/include/layout/nsIAnonymousContentCreator.h
a04512/hack_scripts
cc801b36ea25f3b5a82d2900f53f5036e7abd8ad
[ "WTFPL" ]
null
null
null
Dark soft/Carberp Botnet/source - absource/pro/all source/BlackJoeWhiteJoe/include/layout/nsIAnonymousContentCreator.h
a04512/hack_scripts
cc801b36ea25f3b5a82d2900f53f5036e7abd8ad
[ "WTFPL" ]
1
2021-12-10T13:18:16.000Z
2021-12-10T13:18:16.000Z
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* ***** BEGIN LICENSE BLOCK ***** * Version: MPL 1.1/GPL 2.0/LGPL 2.1 * * The contents of this file are subject to the Mozilla Public License Version * 1.1 (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.mozilla.org/MPL/ * * Software distributed under the License is distributed on an "AS IS" basis, * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * for the specific language governing rights and limitations under the * License. * * The Original Code is mozilla.org code. * * The Initial Developer of the Original Code is * Netscape Communications Corporation. * Portions created by the Initial Developer are Copyright (C) 1998 * the Initial Developer. All Rights Reserved. * * Contributor(s): * * Alternatively, the contents of this file may be used under the terms of * either of the GNU General Public License Version 2 or later (the "GPL"), * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), * in which case the provisions of the GPL or the LGPL are applicable instead * of those above. If you wish to allow use of your version of this file only * under the terms of either the GPL or the LGPL, and not to allow others to * use your version of this file under the terms of the MPL, indicate your * decision by deleting the provisions above and replace them with the notice * and other provisions required by the GPL or the LGPL. If you do not delete * the provisions above, a recipient may use your version of this file under * the terms of any one of the MPL, the GPL or the LGPL. * * ***** END LICENSE BLOCK ***** */ /* * interface for rendering objects that manually create subtrees of * anonymous content */ #ifndef nsIAnonymousContentCreator_h___ #define nsIAnonymousContentCreator_h___ #include "nsISupports.h" #include "nsIContent.h" class nsPresContext; class nsIFrame; template <class T> class nsTArray; // {7568a516-3831-4db4-88a7-a42578acc136} #define NS_IANONYMOUS_CONTENT_CREATOR_IID \ { 0x7568a516, 0x3831, 0x4db4, \ { 0x88, 0xa7, 0xa4, 0x25, 0x78, 0xac, 0xc1, 0x36 } } /** * Any source for anonymous content can implement this interface to provide it. * HTML frames like nsFileControlFrame currently use this as well as XUL frames * like nsScrollbarFrame and nsSliderFrame. * * @see nsCSSFrameConstructor */ class nsIAnonymousContentCreator : public nsISupports { public: NS_DECLARE_STATIC_IID_ACCESSOR(NS_IANONYMOUS_CONTENT_CREATOR_IID) /** * Creates "native" anonymous content and adds the created content to * the aElements array. None of the returned elements can be nsnull. * * @note The returned elements are owned by this object. This object is * responsible for calling UnbindFromTree on the elements it returned * from CreateAnonymousContent when appropriate (i.e. before releasing * them). */ virtual nsresult CreateAnonymousContent(nsTArray<nsIContent*>& aElements)=0; /** * Implementations can override this method to create special frames for the * anonymous content returned from CreateAnonymousContent. * By default this method returns nsnull, which means the default frame * is created. */ virtual nsIFrame* CreateFrameFor(nsIContent* aContent) { return nsnull; } /** * This gets called after the frames for the anonymous content have been * created and added to the frame tree. By default it does nothing. */ virtual void PostCreateFrames() {} }; NS_DEFINE_STATIC_IID_ACCESSOR(nsIAnonymousContentCreator, NS_IANONYMOUS_CONTENT_CREATOR_IID) #endif
38.376238
80
0.716202
c2e50df1fa0e0a9aef0d7340af9c4f5b9656b736
876
h
C
src/LuaInterface/LuaType.h
gameraccoon/stealthgame
e91376422d29e9c4aa657db9ef746490a8ef3ae4
[ "MIT" ]
null
null
null
src/LuaInterface/LuaType.h
gameraccoon/stealthgame
e91376422d29e9c4aa657db9ef746490a8ef3ae4
[ "MIT" ]
3
2017-01-18T22:10:39.000Z
2017-01-18T22:12:02.000Z
src/LuaInterface/LuaType.h
gameraccoon/stealthgame
e91376422d29e9c4aa657db9ef746490a8ef3ae4
[ "MIT" ]
null
null
null
#ifndef LUA_TYPE_H #define LUA_TYPE_H #include "LuaInstance.h" namespace LuaType { template<typename T> void registerConstant(LuaInstance *instance, const char* name, T* value); template<typename T> void registerField(LuaInstance *instance, const char* name, T* value); template<typename T> void startRegistration(LuaInstance *instance, T* value); template<typename T> void registerValue(LuaInstance *instance, T* value); template<typename T> void registerConstant(LuaInstance *instance, const char* name, T* value) { instance->beginInitializeTable(); registerValue<T>(instance, value); instance->endInitializeTable(name); } template<typename T> void registerField<T>(LuaInstance *instance, const char* name, T* value) { instance->beginInitializeTable(); registerValue<T>(instance, value); instance->endInitializeSubtable(name); } } #endif
23.675676
74
0.755708
a66cdd296ff698e0696192715639afae72618d29
10,769
c
C
src/groupsig/gl19/sign.c
jmakr0/libgroupsig
7582c6083d10271729bc78c606c238f5025fff12
[ "Apache-2.0" ]
17
2020-07-31T08:16:52.000Z
2022-02-14T09:13:00.000Z
src/groupsig/gl19/sign.c
jmakr0/libgroupsig
7582c6083d10271729bc78c606c238f5025fff12
[ "Apache-2.0" ]
80
2020-08-06T16:57:58.000Z
2022-03-27T07:24:14.000Z
src/groupsig/gl19/sign.c
jmakr0/libgroupsig
7582c6083d10271729bc78c606c238f5025fff12
[ "Apache-2.0" ]
5
2020-09-07T15:30:49.000Z
2022-03-22T09:34:17.000Z
/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ #include <stdlib.h> #include <limits.h> #include "gl19.h" #include "logger.h" #include "sys/mem.h" #include "groupsig/gl19/grp_key.h" #include "groupsig/gl19/mem_key.h" #include "groupsig/gl19/signature.h" /* Private functions */ int gl19_sign(groupsig_signature_t *sig, message_t *msg, groupsig_key_t *memkey, groupsig_key_t *grpkey, unsigned int seed) { /* Here we won't follow the typical C programming conventions for naming variables. Instead, we will name the variables as in the GL19 paper (with the exception of doubling a letter when a ' is used, e.g. k' ==> kk and appending a '_' for variables named with a hat or something similar). Auxiliar variables that are not specified in the paper but helpful or required for its implementation will be named aux[_<name>]. */ pbcext_element_Fr_t *alpha, *alpha2, *r1, *r2, *r3, *ss, *negy, *aux_Zr, *x[8]; pbcext_element_G1_t *aux, *A_d, *g1h3d; pbcext_element_G1_t *y[6], *g[8]; gl19_signature_t *gl19_sig; gl19_grp_key_t *gl19_grpkey; gl19_mem_key_t *gl19_memkey; message_t *msgexp; byte_t *bytesexp; uint64_t msgexp_len; uint16_t i[11][2], prods[6]; int rc; if(!sig || !msg || !memkey || memkey->scheme != GROUPSIG_GL19_CODE || !grpkey || grpkey->scheme != GROUPSIG_GL19_CODE) { LOG_EINVAL(&logger, __FILE__, "gl19_sign", __LINE__, LOGERROR); return IERROR; } gl19_sig = sig->sig; gl19_grpkey = grpkey->key; gl19_memkey = memkey->key; rc = IOK; alpha = r1 = r2 = r3 = ss = negy = aux_Zr = NULL; aux = A_d = g1h3d = NULL; bytesexp = NULL; msgexp = NULL; /* alpha, r1, r2 \in_R Z_p */ if(!(alpha = pbcext_element_Fr_init())) GOTOENDRC(IERROR, gl19_sign); if(pbcext_element_Fr_random(alpha) == IERROR) GOTOENDRC(IERROR, gl19_sign); if(!(r1 = pbcext_element_Fr_init())) GOTOENDRC(IERROR, gl19_sign); if(pbcext_element_Fr_random(r1) == IERROR) GOTOENDRC(IERROR, gl19_sign); if(!(r2 = pbcext_element_Fr_init())) GOTOENDRC(IERROR, gl19_sign); if(pbcext_element_Fr_random(r2) == IERROR) GOTOENDRC(IERROR, gl19_sign); /* nym1 = g1^alpha */ if(!(gl19_sig->nym1 = pbcext_element_G1_init())) GOTOENDRC(IERROR, gl19_sign); if(pbcext_element_G1_mul(gl19_sig->nym1, gl19_grpkey->g, alpha) == IERROR) GOTOENDRC(IERROR, gl19_sign); /* nym2 = cpk^alpha*h^y */ if(!(gl19_sig->nym2 = pbcext_element_G1_init())) GOTOENDRC(IERROR, gl19_sign); if(!(aux = pbcext_element_G1_init())) GOTOENDRC(IERROR, gl19_sign); if(pbcext_element_G1_mul(gl19_sig->nym2, gl19_grpkey->cpk, alpha) == IERROR) GOTOENDRC(IERROR, gl19_sign); if(pbcext_element_G1_mul(aux, gl19_grpkey->h, gl19_memkey->y) == IERROR) GOTOENDRC(IERROR, gl19_sign); if(pbcext_element_G1_add(gl19_sig->nym2, gl19_sig->nym2, aux) == IERROR) GOTOENDRC(IERROR, gl19_sign); /* Add extra encryption of h^y with epk */ if(!(alpha2 = pbcext_element_Fr_init())) GOTOENDRC(IERROR, gl19_sign); if(pbcext_element_Fr_random(alpha2) == IERROR) GOTOENDRC(IERROR, gl19_sign); /* ehy1 = g1^alpha2 */ if(!(gl19_sig->ehy1 = pbcext_element_G1_init())) GOTOENDRC(IERROR, gl19_sign); if(pbcext_element_G1_mul(gl19_sig->ehy1, gl19_grpkey->g, alpha2) == IERROR) GOTOENDRC(IERROR, gl19_sign); /* ehy2 = epk^alpha2*h^y */ if(!(gl19_sig->ehy2 = pbcext_element_G1_init())) GOTOENDRC(IERROR, gl19_sign); if(pbcext_element_G1_mul(gl19_sig->ehy2, gl19_grpkey->epk, alpha2) == IERROR) GOTOENDRC(IERROR, gl19_sign); if(pbcext_element_G1_mul(aux, gl19_grpkey->h, gl19_memkey->y) == IERROR) GOTOENDRC(IERROR, gl19_sign); if(pbcext_element_G1_add(gl19_sig->ehy2, gl19_sig->ehy2, aux) == IERROR) GOTOENDRC(IERROR, gl19_sign); /* AA = A^r1*/ if(!(gl19_sig->AA = pbcext_element_G1_init())) GOTOENDRC(IERROR, gl19_sign); if(pbcext_element_G1_mul(gl19_sig->AA, gl19_memkey->A, r1) == IERROR) GOTOENDRC(IERROR, gl19_sign); /* A_ = AA^{-x}(g1*h1^y*h2^s*h3d)^r1 */ /* Good thing we precomputed much of this... */ if(!(gl19_sig->A_ = pbcext_element_G1_init())) GOTOENDRC(IERROR, gl19_sign); if(!(aux_Zr = pbcext_element_Fr_init())) GOTOENDRC(IERROR, gl19_sign); if(pbcext_element_G1_add(aux, gl19_memkey->H, gl19_memkey->h2s) == IERROR) GOTOENDRC(IERROR, gl19_sign); if(pbcext_element_G1_add(aux, gl19_grpkey->g1, aux) == IERROR) GOTOENDRC(IERROR, gl19_sign); if(pbcext_element_G1_add(aux, gl19_memkey->h3d, aux) == IERROR) GOTOENDRC(IERROR, gl19_sign); if(pbcext_element_G1_mul(aux, aux, r1) == IERROR) // aux = (g1*h1^y*h2^s*h3^d)^r1 GOTOENDRC(IERROR, gl19_sign); if(pbcext_element_Fr_neg(aux_Zr, gl19_memkey->x) == IERROR) GOTOENDRC(IERROR, gl19_sign); if(pbcext_element_G1_mul(gl19_sig->A_, gl19_sig->AA, aux_Zr) == IERROR) GOTOENDRC(IERROR, gl19_sign); if(pbcext_element_G1_add(gl19_sig->A_, gl19_sig->A_, aux) == IERROR) GOTOENDRC(IERROR, gl19_sign); /* d = (g1*h1^y*h2^s*h3^d)^r1*h2^{-r2} */ if(!(gl19_sig->d = pbcext_element_G1_init())) GOTOENDRC(IERROR, gl19_sign); if(pbcext_element_Fr_neg(aux_Zr, r2) == IERROR) GOTOENDRC(IERROR, gl19_sign); if(pbcext_element_G1_mul(gl19_sig->d, gl19_grpkey->h2, aux_Zr) == IERROR) GOTOENDRC(IERROR, gl19_sign); if(pbcext_element_G1_add(gl19_sig->d, aux, gl19_sig->d) == IERROR) GOTOENDRC(IERROR, gl19_sign); /* r3 = r1^{-1} */ if(!(r3 = pbcext_element_Fr_init())) GOTOENDRC(IERROR, gl19_sign); if(pbcext_element_Fr_inv(r3, r1) == IERROR) GOTOENDRC(IERROR, gl19_sign); /* ss = s - r2*r3 */ if(!(ss = pbcext_element_Fr_init())) GOTOENDRC(IERROR, gl19_sign); if(pbcext_element_Fr_mul(aux_Zr, r2, r3) == IERROR) GOTOENDRC(IERROR, gl19_sign); if(pbcext_element_Fr_sub(ss, gl19_memkey->s, aux_Zr) == IERROR) GOTOENDRC(IERROR, gl19_sign); /* Auxiliar variables for the spk */ if(pbcext_element_Fr_neg(aux_Zr, gl19_memkey->x) == IERROR) GOTOENDRC(IERROR, gl19_sign); if(pbcext_element_Fr_neg(ss, ss) == IERROR) GOTOENDRC(IERROR, gl19_sign); if(!(negy = pbcext_element_Fr_init())) GOTOENDRC(IERROR, gl19_sign); if(pbcext_element_Fr_neg(negy, gl19_memkey->y) == IERROR) GOTOENDRC(IERROR, gl19_sign); if(!(A_d = pbcext_element_G1_init())) GOTOENDRC(IERROR, gl19_sign); if(pbcext_element_G1_sub(A_d, gl19_sig->A_, gl19_sig->d) == IERROR) GOTOENDRC(IERROR, gl19_sign); /* g1h3d = g1*h3^d */ if (!(g1h3d = pbcext_element_G1_init())) GOTOENDRC(IERROR, gl19_sign); if (pbcext_element_G1_add(g1h3d, gl19_grpkey->g1, gl19_memkey->h3d) == IERROR) GOTOENDRC(IERROR, gl19_sign); /* Isn't there a more concise way to do the following? */ y[0] = gl19_sig->nym1; y[1] = gl19_sig->nym2; y[2] = A_d; y[3] = g1h3d; y[4] = gl19_sig->ehy1; y[5] = gl19_sig->ehy2; g[0] = gl19_grpkey->g; g[1] = gl19_grpkey->cpk; g[2] = gl19_grpkey->h; g[3] = gl19_sig->AA; g[4] = gl19_grpkey->h2; g[5] = gl19_sig->d; g[6] = gl19_grpkey->h1; g[7] = gl19_grpkey->epk; x[0] = aux_Zr; // -x x[1] = gl19_memkey->y; x[2] = r2; x[3] = r3; x[4] = ss; x[5] = alpha; x[6] = negy; x[7] = alpha2; i[0][0] = 5; i[0][1] = 0; // alpha,g i[1][0] = 5; i[1][1] = 1; // alpha,cpk i[2][0] = 1; i[2][1] = 2; // y,h i[3][0] = 0; i[3][1] = 3; // -x,AA i[4][0] = 2; i[4][1] = 4; // r2,h2 i[5][0] = 3; i[5][1] = 5; // r3,d i[6][0] = 4; i[6][1] = 4; // ss,h2 i[7][0] = 6; i[7][1] = 6; // -y,h1 i[8][0] = 7; i[8][1] = 0; // alpha2,g i[9][0] = 7; i[9][1] = 7; // alpha2,epk i[10][0] = 1; i[10][1] = 2; // y,h prods[0] = 1; prods[1] = 2; prods[2] = 2; prods[3] = 3; prods[4] = 1; prods[5] = 2; if(!(gl19_sig->pi = spk_rep_init(8))) GOTOENDRC(IERROR, gl19_sign); /* The SPK'ed message becomes the message to sign concatenated with the credential expiration date. */ gl19_sig->expiration = gl19_memkey->l; msgexp_len = msg->length+sizeof(uint64_t); if (!(bytesexp = mem_malloc(sizeof(byte_t)*msgexp_len))) GOTOENDRC(IERROR, gl19_sign); memcpy(bytesexp, msg->bytes, msg->length); memcpy(&bytesexp[msg->length], &gl19_memkey->l, sizeof(uint64_t)); if (!(msgexp = message_from_bytes(bytesexp, msgexp_len))) GOTOENDRC(IERROR, gl19_sign); if(spk_rep_sign(gl19_sig->pi, y, 6, // element_t *y, uint16_t ny, g, 8, // element_t *g, uint16_t ng, x, 8, // element_t *x, uint16_t nx, i, 11, // uint16_t **i, uint16_t ni, prods, msgexp->bytes, msgexp->length) == IERROR) GOTOENDRC(IERROR, gl19_sign); gl19_sign_end: if(alpha) { pbcext_element_Fr_free(alpha); alpha = NULL; } if(alpha2) { pbcext_element_Fr_free(alpha2); alpha2 = NULL; } if(r1) { pbcext_element_Fr_free(r1); r1 = NULL; } if(r2) { pbcext_element_Fr_free(r2); r2 = NULL; } if(r3) { pbcext_element_Fr_free(r3); r3 = NULL; } if(ss) { pbcext_element_Fr_free(ss); ss = NULL; } if(aux) { pbcext_element_G1_free(aux); aux = NULL; } if(aux_Zr) { pbcext_element_Fr_free(aux_Zr); aux_Zr = NULL; } if(negy) { pbcext_element_Fr_free(negy); negy = NULL; } if(A_d) { pbcext_element_G1_free(A_d); A_d = NULL; } if(g1h3d) { pbcext_element_G1_free(g1h3d); g1h3d = NULL; } if(msgexp) { message_free(msgexp); msgexp = NULL; } if(bytesexp) { mem_free(bytesexp); bytesexp = NULL; } if (rc == IERROR) { if(gl19_sig->nym1) { pbcext_element_G1_free(gl19_sig->nym1); gl19_sig->nym1 = NULL; } if(gl19_sig->nym2) { pbcext_element_G1_free(gl19_sig->nym2); gl19_sig->nym2 = NULL; } if(gl19_sig->AA) { pbcext_element_G1_free(gl19_sig->AA); gl19_sig->AA = NULL; } if(gl19_sig->A_) { pbcext_element_G1_free(gl19_sig->A_); gl19_sig->A_ = NULL; } if(gl19_sig->d) { pbcext_element_G1_free(gl19_sig->d); gl19_sig->d = NULL; } if(gl19_sig->pi) { spk_rep_free(gl19_sig->pi); gl19_sig->pi = NULL; } } return rc; } /* sign.c ends here */
34.079114
85
0.659764
fd06a3e2afe8fb38448537beaa14933982701830
7,692
c
C
tools/HackRF/firmware/hackrf_usb/usb_descriptor.c
Charmve/BLE-Security-Att-Def
3652d84bf4ac0c694bb3c4c0f611098da9122af0
[ "BSD-2-Clause" ]
149
2020-10-23T23:31:51.000Z
2022-03-15T00:25:35.000Z
tools/HackRF/firmware/hackrf_usb/usb_descriptor.c
Charmve/BLE-Security-Att-Def
3652d84bf4ac0c694bb3c4c0f611098da9122af0
[ "BSD-2-Clause" ]
1
2021-04-12T19:24:00.000Z
2021-04-27T03:11:07.000Z
tools/HackRF/firmware/hackrf_usb/usb_descriptor.c
Charmve/BLE-Security-Att-Def
3652d84bf4ac0c694bb3c4c0f611098da9122af0
[ "BSD-2-Clause" ]
22
2020-11-17T02:52:40.000Z
2022-03-15T00:26:38.000Z
/* * Copyright 2012 Jared Boone * * This file is part of HackRF. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2, or (at your option) * any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; see the file COPYING. If not, write to * the Free Software Foundation, Inc., 51 Franklin Street, * Boston, MA 02110-1301, USA. */ #include <stdint.h> #include "usb_type.h" #include "usb_descriptor.h" #define USB_VENDOR_ID (0x1D50) #ifdef HACKRF_ONE #define USB_PRODUCT_ID (0x6089) #elif JAWBREAKER #define USB_PRODUCT_ID (0x604B) #elif RAD1O #define USB_PRODUCT_ID (0xCC15) #else #define USB_PRODUCT_ID (0xFFFF) #endif #define USB_API_VERSION (0x0104) #define USB_WORD(x) (x & 0xFF), ((x >> 8) & 0xFF) #define USB_MAX_PACKET0 (64) #define USB_MAX_PACKET_BULK_FS (64) #define USB_MAX_PACKET_BULK_HS (512) #define USB_BULK_IN_EP_ADDR (0x81) #define USB_BULK_OUT_EP_ADDR (0x02) #define USB_STRING_LANGID (0x0409) uint8_t usb_descriptor_device[] = { 18, // bLength USB_DESCRIPTOR_TYPE_DEVICE, // bDescriptorType USB_WORD(0x0200), // bcdUSB 0x00, // bDeviceClass 0x00, // bDeviceSubClass 0x00, // bDeviceProtocol USB_MAX_PACKET0, // bMaxPacketSize0 USB_WORD(USB_VENDOR_ID), // idVendor USB_WORD(USB_PRODUCT_ID), // idProduct USB_WORD(USB_API_VERSION), // bcdDevice 0x01, // iManufacturer 0x02, // iProduct 0x04, // iSerialNumber 0x01 // bNumConfigurations }; uint8_t usb_descriptor_device_qualifier[] = { 10, // bLength USB_DESCRIPTOR_TYPE_DEVICE_QUALIFIER, // bDescriptorType USB_WORD(0x0200), // bcdUSB 0x00, // bDeviceClass 0x00, // bDeviceSubClass 0x00, // bDeviceProtocol 64, // bMaxPacketSize0 0x01, // bNumOtherSpeedConfigurations 0x00 // bReserved }; uint8_t usb_descriptor_configuration_full_speed[] = { 9, // bLength USB_DESCRIPTOR_TYPE_CONFIGURATION, // bDescriptorType USB_WORD(32), // wTotalLength 0x01, // bNumInterfaces 0x01, // bConfigurationValue 0x03, // iConfiguration 0x80, // bmAttributes: USB-powered 250, // bMaxPower: 500mA 9, // bLength USB_DESCRIPTOR_TYPE_INTERFACE, // bDescriptorType 0x00, // bInterfaceNumber 0x00, // bAlternateSetting 0x02, // bNumEndpoints 0xFF, // bInterfaceClass: vendor-specific 0xFF, // bInterfaceSubClass 0xFF, // bInterfaceProtocol: vendor-specific 0x00, // iInterface 7, // bLength USB_DESCRIPTOR_TYPE_ENDPOINT, // bDescriptorType USB_BULK_IN_EP_ADDR, // bEndpointAddress 0x02, // bmAttributes: BULK USB_WORD(USB_MAX_PACKET_BULK_FS), // wMaxPacketSize 0x00, // bInterval: no NAK 7, // bLength USB_DESCRIPTOR_TYPE_ENDPOINT, // bDescriptorType USB_BULK_OUT_EP_ADDR, // bEndpointAddress 0x02, // bmAttributes: BULK USB_WORD(USB_MAX_PACKET_BULK_FS), // wMaxPacketSize 0x00, // bInterval: no NAK 0, // TERMINATOR }; uint8_t usb_descriptor_configuration_high_speed[] = { 9, // bLength USB_DESCRIPTOR_TYPE_CONFIGURATION, // bDescriptorType USB_WORD(32), // wTotalLength 0x01, // bNumInterfaces 0x01, // bConfigurationValue 0x03, // iConfiguration 0x80, // bmAttributes: USB-powered 250, // bMaxPower: 500mA 9, // bLength USB_DESCRIPTOR_TYPE_INTERFACE, // bDescriptorType 0x00, // bInterfaceNumber 0x00, // bAlternateSetting 0x02, // bNumEndpoints 0xFF, // bInterfaceClass: vendor-specific 0xFF, // bInterfaceSubClass 0xFF, // bInterfaceProtocol: vendor-specific 0x00, // iInterface 7, // bLength USB_DESCRIPTOR_TYPE_ENDPOINT, // bDescriptorType USB_BULK_IN_EP_ADDR, // bEndpointAddress 0x02, // bmAttributes: BULK USB_WORD(USB_MAX_PACKET_BULK_HS), // wMaxPacketSize 0x00, // bInterval: no NAK 7, // bLength USB_DESCRIPTOR_TYPE_ENDPOINT, // bDescriptorType USB_BULK_OUT_EP_ADDR, // bEndpointAddress 0x02, // bmAttributes: BULK USB_WORD(USB_MAX_PACKET_BULK_HS), // wMaxPacketSize 0x00, // bInterval: no NAK 0, // TERMINATOR }; uint8_t usb_descriptor_string_languages[] = { 0x04, // bLength USB_DESCRIPTOR_TYPE_STRING, // bDescriptorType USB_WORD(USB_STRING_LANGID), // wLANGID }; uint8_t usb_descriptor_string_manufacturer[] = { 40, // bLength USB_DESCRIPTOR_TYPE_STRING, // bDescriptorType 'G', 0x00, 'r', 0x00, 'e', 0x00, 'a', 0x00, 't', 0x00, ' ', 0x00, 'S', 0x00, 'c', 0x00, 'o', 0x00, 't', 0x00, 't', 0x00, ' ', 0x00, 'G', 0x00, 'a', 0x00, 'd', 0x00, 'g', 0x00, 'e', 0x00, 't', 0x00, 's', 0x00, }; uint8_t usb_descriptor_string_product[] = { #ifdef HACKRF_ONE 22, // bLength USB_DESCRIPTOR_TYPE_STRING, // bDescriptorType 'H', 0x00, 'a', 0x00, 'c', 0x00, 'k', 0x00, 'R', 0x00, 'F', 0x00, ' ', 0x00, 'O', 0x00, 'n', 0x00, 'e', 0x00, #elif JAWBREAKER 36, // bLength USB_DESCRIPTOR_TYPE_STRING, // bDescriptorType 'H', 0x00, 'a', 0x00, 'c', 0x00, 'k', 0x00, 'R', 0x00, 'F', 0x00, ' ', 0x00, 'J', 0x00, 'a', 0x00, 'w', 0x00, 'b', 0x00, 'r', 0x00, 'e', 0x00, 'a', 0x00, 'k', 0x00, 'e', 0x00, 'r', 0x00, #elif RAD1O 12, // bLength USB_DESCRIPTOR_TYPE_STRING, // bDescriptorType 'r', 0x00, 'a', 0x00, 'd', 0x00, '1', 0x00, 'o', 0x00, #else 14, // bLength USB_DESCRIPTOR_TYPE_STRING, // bDescriptorType 'H', 0x00, 'a', 0x00, 'c', 0x00, 'k', 0x00, 'R', 0x00, 'F', 0x00, #endif }; uint8_t usb_descriptor_string_config_description[] = { 24, // bLength USB_DESCRIPTOR_TYPE_STRING, // bDescriptorType 'T', 0x00, 'r', 0x00, 'a', 0x00, 'n', 0x00, 's', 0x00, 'c', 0x00, 'e', 0x00, 'i', 0x00, 'v', 0x00, 'e', 0x00, 'r', 0x00, }; #ifdef DFU_MODE uint8_t usb_descriptor_string_serial_number[] = { 30, // bLength USB_DESCRIPTOR_TYPE_STRING, // bDescriptorType 'R', 0x00, 'u', 0x00, 'n', 0x00, 'n', 0x00, 'i', 0x00, 'n', 0x00, 'g', 0x00, 'F', 0x00, 'r', 0x00, 'o', 0x00, 'm', 0x00, 'R', 0x00, 'A', 0x00, 'M', 0x00, }; #else uint8_t usb_descriptor_string_serial_number[USB_DESCRIPTOR_STRING_SERIAL_BUF_LEN]; #endif uint8_t* usb_descriptor_strings[] = { usb_descriptor_string_languages, usb_descriptor_string_manufacturer, usb_descriptor_string_product, usb_descriptor_string_config_description, usb_descriptor_string_serial_number, 0, // TERMINATOR }; uint8_t wcid_string_descriptor[] = { 18, // bLength USB_DESCRIPTOR_TYPE_STRING, // bDescriptorType 'M', 0x00, 'S', 0x00, 'F', 0x00, 'T', 0x00, '1', 0x00, '0', 0x00, '0', 0x00, USB_WCID_VENDOR_REQ, // vendor request code for further descriptor 0x00 }; uint8_t wcid_feature_descriptor[] = { 0x28, 0x00, 0x00, 0x00, // bLength USB_WORD(0x0100), // WCID version USB_WORD(0x0004), // WICD descriptor index 0x01, //bNumSections 0x00,0x00,0x00,0x00,0x00,0x00,0x00, //Reserved 0x00, //bInterfaceNumber 0x01, //Reserved 'W', 'I', 'N', 'U', 'S', 'B', 0x00,0x00, //Compatible ID, padded with zeros 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, //Sub-compatible ID 0x00,0x00,0x00,0x00,0x00,0x00 //Reserved };
24.496815
82
0.660296
6938fd95a95627936adca0570ea559a5005b30a5
2,492
h
C
CSSLayoutKit/UIView+CSSLayout.h
Unity-Technologies/css-layout
6e56ce21135da6724b827d23fb53dd42b5338048
[ "BSD-3-Clause" ]
18
2017-02-08T07:26:17.000Z
2021-11-22T04:51:51.000Z
CSSLayoutKit/UIView+CSSLayout.h
Unity-Technologies/css-layout
6e56ce21135da6724b827d23fb53dd42b5338048
[ "BSD-3-Clause" ]
null
null
null
CSSLayoutKit/UIView+CSSLayout.h
Unity-Technologies/css-layout
6e56ce21135da6724b827d23fb53dd42b5338048
[ "BSD-3-Clause" ]
5
2017-02-23T08:11:55.000Z
2021-12-09T20:58:07.000Z
/** * Copyright (c) 2014-present, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. */ #import <UIKit/UIKit.h> #import <CSSLayout/CSSLayout.h> @interface UIView (CSSLayout) /** The property that decides if we should include this view when calculating layout. Defaults to YES. */ @property (nonatomic, readwrite, assign, setter=css_setIncludeInLayout:) BOOL css_includeInLayout; /** The property that decides during layout/sizing whether or not css_* properties should be applied. Defaults to NO. */ @property (nonatomic, readwrite, assign, setter=css_setUsesFlexbox:) BOOL css_usesFlexbox; - (void)css_setDirection:(CSSDirection)direction; - (void)css_setFlexDirection:(CSSFlexDirection)flexDirection; - (void)css_setJustifyContent:(CSSJustify)justifyContent; - (void)css_setAlignContent:(CSSAlign)alignContent; - (void)css_setAlignItems:(CSSAlign)alignItems; - (void)css_setAlignSelf:(CSSAlign)alignSelf; - (void)css_setPositionType:(CSSPositionType)positionType; - (void)css_setFlexWrap:(CSSWrap)flexWrap; - (void)css_setFlexGrow:(CGFloat)flexGrow; - (void)css_setFlexShrink:(CGFloat)flexShrink; - (void)css_setFlexBasis:(CGFloat)flexBasis; - (void)css_setPosition:(CGFloat)position forEdge:(CSSEdge)edge; - (void)css_setMargin:(CGFloat)margin forEdge:(CSSEdge)edge; - (void)css_setPadding:(CGFloat)padding forEdge:(CSSEdge)edge; - (void)css_setWidth:(CGFloat)width; - (void)css_setHeight:(CGFloat)height; - (void)css_setMinWidth:(CGFloat)minWidth; - (void)css_setMinHeight:(CGFloat)minHeight; - (void)css_setMaxWidth:(CGFloat)maxWidth; - (void)css_setMaxHeight:(CGFloat)maxHeight; // Yoga specific properties, not compatible with flexbox specification - (void)css_setAspectRatio:(CGFloat)aspectRatio; /** Get the resolved direction of this node. This won't be CSSDirectionInherit */ - (CSSDirection)css_resolvedDirection; /** Perform a layout calculation and update the frames of the views in the hierarchy with th results */ - (void)css_applyLayout; /** Returns the size of the view if no constraints were given. This could equivalent to calling [self sizeThatFits:CGSizeMake(CGFLOAT_MAX, CGFLOAT_MAX)]; */ - (CGSize)css_intrinsicSize; /** Returns the number of children that are using Flexbox. */ - (NSUInteger)css_numberOfChildren; @end
34.136986
150
0.779695
f7597231e6f52d070e6182a960041f64a7223b08
2,235
h
C
System/Library/PrivateFrameworks/HealthDaemon.framework/HDConceptStoreTaskServer.h
zhangkn/iOS14Header
4323e9459ed6f6f5504ecbea2710bfd6c3d7c946
[ "MIT" ]
1
2020-11-04T15:43:01.000Z
2020-11-04T15:43:01.000Z
System/Library/PrivateFrameworks/HealthDaemon.framework/HDConceptStoreTaskServer.h
zhangkn/iOS14Header
4323e9459ed6f6f5504ecbea2710bfd6c3d7c946
[ "MIT" ]
null
null
null
System/Library/PrivateFrameworks/HealthDaemon.framework/HDConceptStoreTaskServer.h
zhangkn/iOS14Header
4323e9459ed6f6f5504ecbea2710bfd6c3d7c946
[ "MIT" ]
null
null
null
/* * This header is generated by classdump-dyld 1.0 * on Sunday, September 27, 2020 at 11:44:47 AM Mountain Standard Time * Operating System: Version 14.0 (Build 18A373) * Image Source: /System/Library/PrivateFrameworks/HealthDaemon.framework/HealthDaemon * classdump-dyld is licensed under GPLv3, Copyright © 2013-2016 by Elias Limneos. */ #import <HealthDaemon/HDStandardTaskServer.h> #import <libobjc.A.dylib/HDHealthOntologyManagerObserver.h> #import <libobjc.A.dylib/HDConceptIndexManagerObserver.h> #import <libobjc.A.dylib/HKConceptStoreServerInterface.h> @class NSString; @interface HDConceptStoreTaskServer : HDStandardTaskServer <HDHealthOntologyManagerObserver, HDConceptIndexManagerObserver, HKConceptStoreServerInterface> @property (readonly) unsigned long long hash; @property (readonly) Class superclass; @property (copy,readonly) NSString * description; @property (copy,readonly) NSString * debugDescription; +(BOOL)validateConfiguration:(id)arg1 client:(id)arg2 error:(id*)arg3 ; +(Class)configurationClass; +(id)taskIdentifier; +(id)requiredEntitlements; -(void)remote_queryCountOfConceptsAssociatedToUserRecordsWithCompletion:(/*^block*/id)arg1 ; -(void)remote_cleanUpAfterUnitTestWithCompletion:(/*^block*/id)arg1 ; -(void)remote_resetOntologyUsingAssetAtLocation:(id)arg1 rememberLocation:(BOOL)arg2 completion:(/*^block*/id)arg3 ; -(void)remote_currentIndexingState:(/*^block*/id)arg1 ; -(void)remote_testTaskServerWithCompletion:(/*^block*/id)arg1 ; -(void)conceptIndexManagerDidChangeExecutionState:(unsigned long long)arg1 ; -(void)connectionInvalidated; -(id)exportedInterface; -(void)conceptIndexManagerDidBecomeQuiescent:(id)arg1 samplesProcessedCount:(long long)arg2 ; -(id)remoteInterface; -(void)remote_startTaskServerIfNeeded; -(void)remote_ontologyVersionWithCompletion:(/*^block*/id)arg1 ; -(void)remote_queryConceptByIdentifier:(id)arg1 loadRelationships:(BOOL)arg2 completion:(/*^block*/id)arg3 ; -(void)remote_queryRelationshipsForNodeWithID:(id)arg1 completion:(/*^block*/id)arg2 ; -(void)remote_makeAssociationFromSample:(id)arg1 toConcept:(id)arg2 completion:(/*^block*/id)arg3 ; -(void)remote_breakAssociationFromSample:(id)arg1 toConcept:(id)arg2 completion:(/*^block*/id)arg3 ; @end
50.795455
154
0.806711
74186636eb3069f4f225e9906c37297d6a452ca9
1,413
h
C
Include/InterfaceElections.h
Andres6936/QT-Elecciones-CPP
ab401c89d35d497fe4ba7d32aa086c8a25b66d48
[ "Unlicense" ]
null
null
null
Include/InterfaceElections.h
Andres6936/QT-Elecciones-CPP
ab401c89d35d497fe4ba7d32aa086c8a25b66d48
[ "Unlicense" ]
null
null
null
Include/InterfaceElections.h
Andres6936/QT-Elecciones-CPP
ab401c89d35d497fe4ba7d32aa086c8a25b66d48
[ "Unlicense" ]
null
null
null
#ifndef INTERFACE_ELECTIONS_H #define INTERFACE_ELECTIONS_H #include <QtWidgets/QMainWindow> #include <QtWidgets/QFrame> #include <QtWidgets/QLabel> #include <QtWidgets/QVBoxLayout> #include <QtWidgets/QWidget> #include <QtWidgets/QInputDialog> #include "Urn.h" #include "PanelUrn.hpp" #include "PanelImage.hpp" #include "PanelCandidate.hpp" #include "PanelExtension.hpp" class InterfaceElections : public QMainWindow { Q_OBJECT private: // Fields Private Urn *urn = nullptr; QWidget *centralWidget = nullptr; QVBoxLayout *verticalLayout = nullptr; QFrame *frame = nullptr; QVBoxLayout *verticalLayout_2 = nullptr; public: // Fields Public QFrame *panelCandidate = nullptr; QHBoxLayout *layoutCandidate = nullptr; PanelImage *panelImage = nullptr; PanelCandidate *panelFrank = nullptr; PanelCandidate *panelClaire = nullptr; PanelCandidate *panelBarack = nullptr; PanelUrn *panelUrn = nullptr; PanelExtension *panelExtension = nullptr; explicit InterfaceElections(QWidget *parent = nullptr); virtual ~InterfaceElections() override; void updateInterface(); void addVoteToCandidate(Candidate *candidate); void clearUrn(); void showDialogPercentageVotes(Candidate *candidate); unsigned int getTotalVotesUrn(); void reqFuncOption1(); void reqFuncOption2(); }; #endif // INTERFACE_ELECTIONS_H
20.185714
59
0.733192
13299e5f011a688bffe69a335589482b01282337
4,481
c
C
src/core/cmos.c
aanshi18/willOS
d3525dde3054c473b8820faddcb4a8db1f0c9c58
[ "MIT" ]
null
null
null
src/core/cmos.c
aanshi18/willOS
d3525dde3054c473b8820faddcb4a8db1f0c9c58
[ "MIT" ]
null
null
null
src/core/cmos.c
aanshi18/willOS
d3525dde3054c473b8820faddcb4a8db1f0c9c58
[ "MIT" ]
null
null
null
#include "cmos.h" #include <core/port.h> #include <stdbool.h> #include <string.h> uint8_t read_register(uint8_t reg); bool update_in_progress(); bool rtc_values_are_not_equal(cmos_rtc_t c1, cmos_rtc_t c2); uint64_t secs_of_month(uint64_t months, uint64_t year); uint64_t secs_of_years(uint64_t years); uint64_t boot_time = 0; void cmos_init() { cmos_rtc_t rtc = cmos_read_rtc(); boot_time = secs_of_years(rtc.year - 1) + secs_of_month(rtc.month - 1, rtc.year) + (rtc.day - 1) * 86400 + rtc.hours * 3600 + rtc.minutes * 60 + rtc.seconds; } uint64_t cmos_boot_time() { return boot_time; } cmos_rtc_t cmos_read_rtc() { cmos_rtc_t rtc; cmos_rtc_t last; // This uses the "read registers until you get the same values twice in a // row" technique to avoid getting inconsistent values due to RTC updates while (update_in_progress()) ; // read a first time rtc.seconds = read_register(CMOS_REG_SECONDS); rtc.minutes = read_register(CMOS_REG_MINUTES); rtc.hours = read_register(CMOS_REG_HOURS); rtc.weekdays = read_register(CMOS_REG_WEEKDAYS); rtc.day = read_register(CMOS_REG_DAY); rtc.month = read_register(CMOS_REG_MONTH); rtc.year = read_register(CMOS_REG_YEAR); rtc.century = read_register(CMOS_REG_CENTURY); do { // prepare to read a second time memcpy(&last, &rtc, sizeof(cmos_rtc_t)); while (update_in_progress()) ; // read a second time rtc.seconds = read_register(CMOS_REG_SECONDS); rtc.minutes = read_register(CMOS_REG_MINUTES); rtc.hours = read_register(CMOS_REG_HOURS); rtc.weekdays = read_register(CMOS_REG_WEEKDAYS); rtc.day = read_register(CMOS_REG_DAY); rtc.month = read_register(CMOS_REG_MONTH); rtc.year = read_register(CMOS_REG_YEAR); rtc.century = read_register(CMOS_REG_CENTURY); } while (rtc_values_are_not_equal(rtc, last)); // Status Register B contains the formats of bytes uint8_t reg_b = read_register(CMOS_REG_STATUS_B); if (!(reg_b & 0x04)) { // convert BCD back into a "good" binary value rtc.seconds = (rtc.seconds & 0x0F) + ((rtc.seconds / 16) * 10); rtc.minutes = (rtc.minutes & 0x0F) + ((rtc.minutes / 16) * 10); rtc.hours = ((rtc.hours & 0x0F) + (((rtc.hours & 0x70) / 16) * 10)) | (rtc.hours & 0x80); rtc.weekdays = (rtc.weekdays & 0x0F) + ((rtc.weekdays / 16) * 10); rtc.day = (rtc.day & 0x0F) + ((rtc.day / 16) * 10); rtc.month = (rtc.month & 0x0F) + ((rtc.month / 16) * 10); rtc.year = (rtc.year & 0x0F) + ((rtc.year / 16) * 10); rtc.century = (rtc.century & 0x0F) + ((rtc.century / 16) * 10); } // if the hour is pm, then the 0x80 bit is set on the hour byte if (!(reg_b & 0x02) && (rtc.hours & 0x80)) { // Convert 12 hour clock to 24 hour clock if necessary rtc.hours = ((rtc.hours & 0x7F) + 12) % 24; } // compute full year rtc.year += (rtc.century * 100); return rtc; } bool update_in_progress() { port_byte_out(CMOS_COMMAND_PORT, CMOS_REG_STATUS_A); // the RTC has an "Update in progress" flag (bit 7 of Status Register A) return (port_byte_in(CMOS_DATA_PORT) & 0x80); } uint8_t read_register(uint8_t reg) { port_byte_out(CMOS_COMMAND_PORT, (1 << 7) | reg); return port_byte_in(CMOS_DATA_PORT); } bool rtc_values_are_not_equal(cmos_rtc_t c1, cmos_rtc_t c2) { return (c1.seconds != c2.seconds || c1.minutes != c2.minutes || c1.hours != c2.hours || c1.weekdays != c2.weekdays || c1.day != c2.day || c1.month != c2.month || c1.year != c2.year || c1.century != c2.century); } uint64_t secs_of_years(uint64_t years) { uint64_t days = 0; while (years > 1969) { days += 365; if (years % 4 == 0) { if (years % 100 == 0) { if (years % 400 == 0) { days++; } } else { days++; } } years--; } return days * 86400; } uint64_t secs_of_month(uint64_t months, uint64_t year) { uint64_t days = 0; switch (months) { case 11: days += 30; case 10: days += 31; case 9: days += 30; case 8: days += 31; case 7: days += 31; case 6: days += 30; case 5: days += 31; case 4: days += 30; case 3: days += 31; case 2: days += 28; if ((year % 4 == 0) && ((year % 100 != 0) || (year % 400 == 0))) { days++; } case 1: days += 31; default: break; } return days * 86400; }
24.221622
78
0.617719
de23519a757c851dc8579dc6c3fd6d232abf2bc3
1,274
h
C
include/cmn/timerQueue.h
badhrinathpa/Nucleus
1225da6882dd16318ff3001dcc9694b677338105
[ "Apache-2.0" ]
13
2020-03-13T15:28:17.000Z
2022-02-03T10:50:09.000Z
include/cmn/timerQueue.h
badhrinathpa/Nucleus
1225da6882dd16318ff3001dcc9694b677338105
[ "Apache-2.0" ]
93
2020-03-05T07:34:10.000Z
2022-03-31T15:14:02.000Z
include/cmn/timerQueue.h
badhrinathpa/Nucleus
1225da6882dd16318ff3001dcc9694b677338105
[ "Apache-2.0" ]
41
2020-02-26T10:41:19.000Z
2022-01-13T13:45:37.000Z
/* * Copyright 2020-present Infosys Limited   *    * SPDX-License-Identifier: Apache-2.0     */ #ifndef TIMERS_TIMERQUEUE_H_ #define TIMERS_TIMERQUEUE_H_ #include <functional> #include <memory> #include <mutex> #include <set> #include <cTime.h> class TimerContext; typedef std::function<void(TimerContext*)> Callback; class TimerContext { public: friend class TimerQueue; TimerContext(const CTime &expiryTime, uint16_t timerType, uint16_t timerId); virtual ~TimerContext(); const CTime& getExpiryTime() const; void setExpiryTime(const CTime& expiryTime); uint16_t getTimerType() const; uint16_t getTimerId() const; private: CTime expiryTime_m; uint16_t timerType_m; uint16_t timerId_m; }; class TimerQueue { public: TimerQueue(); ~TimerQueue(); void addTimerInQueue(TimerContext* item); uint32_t removeTimerInQueue(TimerContext* item); void onTimer(Callback cb); private: struct TimeCompare { bool operator() (const TimerContext* lhs, const TimerContext* rhs) const { return (lhs->expiryTime_m < rhs->expiryTime_m); } }; std::mutex mutex_m; std::set<TimerContext*, TimeCompare> container_m; }; #endif /* TIMERS_TIMERQUEUE_H_ */
19.6
80
0.686813
6e9f92427da694e018b334006a8ed4e50637c3eb
35,195
c
C
crypto777/nanosrc/aio/usock_win.c
who-biz/lightning
1eea5d935c623e26a085129e967298113c337feb
[ "MIT" ]
5
2017-12-30T19:20:16.000Z
2019-06-02T04:47:56.000Z
crypto777/nanosrc/aio/usock_win.c
who-biz/lightning
1eea5d935c623e26a085129e967298113c337feb
[ "MIT" ]
5
2021-02-20T02:41:55.000Z
2021-06-01T20:04:08.000Z
crypto777/nanosrc/aio/usock_win.c
who-biz/lightning
1eea5d935c623e26a085129e967298113c337feb
[ "MIT" ]
7
2017-08-25T01:32:54.000Z
2019-01-02T20:40:42.000Z
/* Copyright (c) 2013 Martin Sustrik All rights reserved. Copyright (c) 2013 GoPivotal, Inc. All rights reserved. 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 "worker.h" #include "../utils/err.h" #include "../utils/cont.h" #include "../utils/alloc.h" #include <stddef.h> #include <string.h> #include <limits.h> #define NN_USOCK_STATE_IDLE 1 #define NN_USOCK_STATE_STARTING 2 #define NN_USOCK_STATE_BEING_ACCEPTED 3 #define NN_USOCK_STATE_ACCEPTED 4 #define NN_USOCK_STATE_CONNECTING 5 #define NN_USOCK_STATE_ACTIVE 6 #define NN_USOCK_STATE_CANCELLING_IO 7 #define NN_USOCK_STATE_DONE 8 #define NN_USOCK_STATE_LISTENING 9 #define NN_USOCK_STATE_ACCEPTING 10 #define NN_USOCK_STATE_CANCELLING 11 #define NN_USOCK_STATE_STOPPING 12 #define NN_USOCK_STATE_STOPPING_ACCEPT 13 #define NN_USOCK_ACTION_ACCEPT 1 #define NN_USOCK_ACTION_BEING_ACCEPTED 2 #define NN_USOCK_ACTION_CANCEL 3 #define NN_USOCK_ACTION_LISTEN 4 #define NN_USOCK_ACTION_CONNECT 5 #define NN_USOCK_ACTION_ACTIVATE 6 #define NN_USOCK_ACTION_DONE 7 #define NN_USOCK_ACTION_ERROR 8 #define NN_USOCK_SRC_IN 1 #define NN_USOCK_SRC_OUT 2 /* Private functions. */ static void nn_usock_handler (struct nn_fsm *self, int src, int type, void *srcptr); static void nn_usock_shutdown (struct nn_fsm *self, int src, int type, void *srcptr); static int nn_usock_cancel_io (struct nn_usock *self); static void nn_usock_create_io_completion (struct nn_usock *self); DWORD nn_usock_open_pipe (struct nn_usock *self, const char *name); void nn_usock_accept_pipe (struct nn_usock *self, struct nn_usock *listener); void nn_usock_init (struct nn_usock *self, int src, struct nn_fsm *owner) { nn_fsm_init (&self->fsm, nn_usock_handler, nn_usock_shutdown, src, self, owner); self->state = NN_USOCK_STATE_IDLE; self->s = INVALID_SOCKET; self->isaccepted = 0; nn_worker_op_init (&self->in, NN_USOCK_SRC_IN, &self->fsm); nn_worker_op_init (&self->out, NN_USOCK_SRC_OUT, &self->fsm); self->domain = -1; self->type = -1; self->protocol = -1; /* Intialise events raised by usock. */ nn_fsm_event_init (&self->event_established); nn_fsm_event_init (&self->event_sent); nn_fsm_event_init (&self->event_received); nn_fsm_event_init (&self->event_error); /* No accepting is going on at the moment. */ self->asock = NULL; self->ainfo = NULL; /* NamedPipe-related stuff. */ memset (&self->pipename, 0, sizeof (self->pipename)); self->pipesendbuf = NULL; } void nn_usock_term (struct nn_usock *self) { nn_assert_state (self, NN_USOCK_STATE_IDLE); if (self->ainfo) nn_free (self->ainfo); if (self->pipesendbuf) nn_free (self->pipesendbuf); nn_fsm_event_term (&self->event_error); nn_fsm_event_term (&self->event_received); nn_fsm_event_term (&self->event_sent); nn_fsm_event_term (&self->event_established); nn_worker_op_term (&self->out); nn_worker_op_term (&self->in); nn_fsm_term (&self->fsm); } int nn_usock_isidle (struct nn_usock *self) { return nn_fsm_isidle (&self->fsm); } int nn_usock_start (struct nn_usock *self, int domain, int type, int protocol) { int rc; #if defined IPV6_V6ONLY DWORD only; #endif #if defined HANDLE_FLAG_INHERIT BOOL brc; #endif printf("nn_usock_start protocol %d\n",protocol); /* NamedPipes aren't sockets. They don't need all the socket initialisation stuff. */ if (domain != AF_UNIX) { /* Open the underlying socket. */ self->s = socket (domain, type, protocol); if (self->s == INVALID_SOCKET) return -nn_err_wsa_to_posix (WSAGetLastError ()); /* Disable inheriting the socket to the child processes. */ #if defined HANDLE_FLAG_INHERIT brc = SetHandleInformation (self->p, HANDLE_FLAG_INHERIT, 0); win_assert (brc); #endif /* IPv4 mapping for IPv6 sockets is disabled by default. Switch it on. */ #if defined IPV6_V6ONLY if (domain == AF_INET6) { only = 0; rc = setsockopt (self->s, IPPROTO_IPV6, IPV6_V6ONLY, (const char*) &only, sizeof (only)); wsa_assert (rc != SOCKET_ERROR); } #endif /* Associate the socket with a worker thread/completion port. */ nn_usock_create_io_completion (self); } /* Remember the type of the socket. */ self->domain = domain; self->type = type; self->protocol = protocol; /* Start the state machine. */ nn_fsm_start (&self->fsm); return 0; } void nn_usock_start_fd (struct nn_usock *self, int fd) { nn_assert (0); } void nn_usock_stop (struct nn_usock *self) { nn_fsm_stop (&self->fsm); } void nn_usock_swap_owner (struct nn_usock *self, struct nn_fsm_owner *owner) { nn_fsm_swap_owner (&self->fsm, owner); } int nn_usock_setsockopt (struct nn_usock *self, int level, int optname, const void *optval, size_t optlen) { int rc; /* NamedPipes aren't sockets. We can't set socket options on them. For now we'll ignore the options. */ if (self->domain == AF_UNIX) return 0; /* The socket can be modified only before it's active. */ nn_assert (self->state == NN_USOCK_STATE_STARTING || self->state == NN_USOCK_STATE_ACCEPTED); nn_assert (optlen < INT_MAX); rc = setsockopt (self->s, level, optname, (char*) optval, (int) optlen); if (nn_slow (rc == SOCKET_ERROR)) return -nn_err_wsa_to_posix (WSAGetLastError ()); return 0; } int nn_usock_bind (struct nn_usock *self, const struct sockaddr *addr, size_t addrlen) { int rc; ULONG opt; /* In the case of named pipes, let's save the address for the later use. */ if (self->domain == AF_UNIX) { if (addrlen > sizeof (struct sockaddr_un)) return -EINVAL; memcpy (&self->pipename, addr, addrlen); return 0; } /* You can set socket options only before the socket is connected. */ nn_assert_state (self, NN_USOCK_STATE_STARTING); /* On Windows, the bound port can be hijacked if SO_EXCLUSIVEADDRUSE is not set. */ opt = 1; rc = setsockopt (self->s, SOL_SOCKET, SO_EXCLUSIVEADDRUSE, (const char*) &opt, sizeof (opt)); wsa_assert (rc != SOCKET_ERROR); nn_assert (addrlen < INT_MAX); rc = bind (self->s, addr, (int) addrlen); if (nn_slow (rc == SOCKET_ERROR)) return -nn_err_wsa_to_posix (WSAGetLastError ()); return 0; } int nn_usock_listen (struct nn_usock *self, int backlog) { int rc; /* You can start listening only before the socket is connected. */ nn_assert_state (self, NN_USOCK_STATE_STARTING); /* Start listening for incoming connections. NamedPipes are already created in the listening state, so no need to do anything here. */ if (self->domain != AF_UNIX) { rc = listen (self->s, backlog); if (nn_slow (rc == SOCKET_ERROR)) return -nn_err_wsa_to_posix (WSAGetLastError ()); } /* Notify the state machine. */ nn_fsm_action (&self->fsm, NN_USOCK_ACTION_LISTEN); return 0; } void nn_usock_accept (struct nn_usock *self, struct nn_usock *listener) { int rc; BOOL brc; DWORD nbytes; /* NamedPipes have their own accepting mechanism. */ if (listener->domain == AF_UNIX) { nn_usock_accept_pipe (self, listener); return; } rc = nn_usock_start (self, listener->domain, listener->type, listener->protocol); /* TODO: EMFILE can be returned here. */ errnum_assert (rc == 0, -rc); nn_fsm_action (&listener->fsm, NN_USOCK_ACTION_ACCEPT); nn_fsm_action (&self->fsm, NN_USOCK_ACTION_BEING_ACCEPTED); /* If the memory for accept information is not yet allocated, do so. */ if (!listener->ainfo) { listener->ainfo = nn_alloc (512, "accept info"); alloc_assert (listener->ainfo); } /* Wait for the incoming connection. */ memset (&listener->in.olpd, 0, sizeof (listener->in.olpd)); brc = AcceptEx (listener->s, self->s, listener->ainfo, 0, 256, 256, &nbytes, &listener->in.olpd); /* Immediate success. */ if (nn_fast (brc == TRUE)) { nn_fsm_action (&listener->fsm, NN_USOCK_ACTION_DONE); nn_fsm_action (&self->fsm, NN_USOCK_ACTION_DONE); return; } /* We don't expect a synchronous failure at this point. */ wsa_assert (nn_slow (WSAGetLastError () == WSA_IO_PENDING)); /* Pair the two sockets. */ nn_assert (!self->asock); self->asock = listener; nn_assert (!listener->asock); listener->asock = self; /* Asynchronous accept. */ nn_worker_op_start (&listener->in, 0); } void nn_usock_activate (struct nn_usock *self) { nn_fsm_action (&self->fsm, NN_USOCK_ACTION_ACTIVATE); } void nn_usock_connect (struct nn_usock *self, const struct sockaddr *addr, size_t addrlen) { BOOL brc; const GUID fid = WSAID_CONNECTEX; LPFN_CONNECTEX pconnectex; DWORD nbytes; DWORD winerror; /* Fail if the socket is already connected, closed or such. */ nn_assert_state (self, NN_USOCK_STATE_STARTING); /* Notify the state machine that we've started connecting. */ nn_fsm_action (&self->fsm, NN_USOCK_ACTION_CONNECT); nn_assert(addrlen < INT_MAX); memset (&self->out.olpd, 0, sizeof (self->out.olpd)); if (self->domain == AF_UNIX) { winerror = nn_usock_open_pipe (self, ((struct sockaddr_un*) addr)->sun_path); } else { /* Get the pointer to connect function. */ brc = WSAIoctl(self->s, SIO_GET_EXTENSION_FUNCTION_POINTER, (void*)&fid, sizeof(fid), (void*)&pconnectex, sizeof(pconnectex), &nbytes, NULL, NULL) == 0; wsa_assert(brc == TRUE); nn_assert(nbytes == sizeof(pconnectex)); /* Connect itself. */ brc = pconnectex(self->s, (struct sockaddr*) addr, addrlen, NULL, 0, NULL, &self->out.olpd); winerror = brc ? ERROR_SUCCESS : WSAGetLastError(); } /* Immediate success. */ if (nn_fast (winerror == ERROR_SUCCESS)) { nn_fsm_action (&self->fsm, NN_USOCK_ACTION_DONE); return; } /* Immediate error. */ if (nn_slow (winerror != WSA_IO_PENDING)) { nn_fsm_action (&self->fsm, NN_USOCK_ACTION_ERROR); return; } /* Asynchronous connect. */ nn_worker_op_start (&self->out, 0); } void nn_usock_send (struct nn_usock *self, const struct nn_iovec *iov, int iovcnt) { int rc; BOOL brc; WSABUF wbuf [NN_USOCK_MAX_IOVCNT]; int i; size_t len; size_t idx; DWORD error; /* Make sure that the socket is actually alive. */ nn_assert_state (self, NN_USOCK_STATE_ACTIVE); /* Create a WinAPI-style iovec. */ len = 0; nn_assert (iovcnt <= NN_USOCK_MAX_IOVCNT); for (i = 0; i != iovcnt; ++i) { wbuf [i].buf = (char FAR*) iov [i].iov_base; wbuf [i].len = (u_long) iov [i].iov_len; len += iov [i].iov_len; } /* Start the send operation. */ memset (&self->out.olpd, 0, sizeof (self->out.olpd)); if (self->domain == AF_UNIX) { /* TODO: Do not copy the buffer, find an efficent way to Write multiple buffers that doesn't affect the state machine. */ nn_assert (!self->pipesendbuf); self->pipesendbuf = nn_alloc (len, "named pipe sendbuf"); idx = 0; for (i = 0; i != iovcnt; ++i) { memcpy ((char*)(self->pipesendbuf) + idx, iov [i].iov_base, iov [i].iov_len); idx += iov [i].iov_len; } brc = WriteFile (self->p, self->pipesendbuf, len, NULL, &self->out.olpd); if (nn_fast (brc || GetLastError() == ERROR_IO_PENDING)) { nn_worker_op_start (&self->out, 0); return; } error = GetLastError(); win_assert (error == ERROR_NO_DATA); self->errnum = EINVAL; nn_fsm_action (&self->fsm, NN_USOCK_ACTION_ERROR); return; } rc = WSASend (self->s, wbuf, iovcnt, NULL, 0, &self->out.olpd, NULL); if (nn_fast (rc == 0)) { nn_worker_op_start (&self->out, 0); return; } error = WSAGetLastError(); if (nn_fast (error == WSA_IO_PENDING)) { nn_worker_op_start (&self->out, 0); return; } wsa_assert (error == WSAECONNABORTED || error == WSAECONNRESET || error == WSAENETDOWN || error == WSAENETRESET || error == WSAENOBUFS || error == WSAEWOULDBLOCK); self->errnum = nn_err_wsa_to_posix (error); nn_fsm_action (&self->fsm, NN_USOCK_ACTION_ERROR); } void nn_usock_recv (struct nn_usock *self, void *buf, size_t len, int *fd) { int rc; BOOL brc; WSABUF wbuf; DWORD wflags; DWORD error; /* Passing file descriptors is not implemented on Windows platform. */ if (fd) *fd = -1; /* Make sure that the socket is actually alive. */ nn_assert_state (self, NN_USOCK_STATE_ACTIVE); /* Start the receive operation. */ wbuf.len = (u_long) len; wbuf.buf = (char FAR*) buf; wflags = MSG_WAITALL; memset (&self->in.olpd, 0, sizeof (self->in.olpd)); if (self->domain == AF_UNIX) { brc = ReadFile(self->p, buf, len, NULL, &self->in.olpd); error = brc ? ERROR_SUCCESS : GetLastError(); } else { rc = WSARecv (self->s, &wbuf, 1, NULL, &wflags, &self->in.olpd, NULL); error = (rc == 0) ? ERROR_SUCCESS : WSAGetLastError (); } if (nn_fast (error == ERROR_SUCCESS)) { nn_worker_op_start (&self->in, 1); return; } if (nn_fast (error == WSA_IO_PENDING)) { nn_worker_op_start (&self->in, 1); return; } if (error == WSAECONNABORTED || error == WSAECONNRESET || error == WSAENETDOWN || error == WSAENETRESET || error == WSAETIMEDOUT || error == WSAEWOULDBLOCK || error == ERROR_PIPE_NOT_CONNECTED || error == ERROR_BROKEN_PIPE) { nn_fsm_action (&self->fsm, NN_USOCK_ACTION_ERROR); return; } wsa_assert (0); } static void nn_usock_create_io_completion (struct nn_usock *self) { struct nn_worker *worker; HANDLE cp; /* Associate the socket with a worker thread/completion port. */ worker = nn_fsm_choose_worker (&self->fsm); cp = CreateIoCompletionPort ( self->p, nn_worker_getcp(worker), (ULONG_PTR) NULL, 0); nn_assert(cp); } static void nn_usock_create_pipe (struct nn_usock *self, const char *name) { char fullname [256]; /* First, create a fully qualified name for the named pipe. */ _snprintf(fullname, sizeof (fullname), "\\\\.\\pipe\\%s", name); /* TODO: Expose custom nOutBufferSize, nInBufferSize, nDefaultTimeOut, lpSecurityAttributes */ self->p = CreateNamedPipeA ( (char*) fullname, PIPE_ACCESS_DUPLEX | FILE_FLAG_OVERLAPPED, PIPE_TYPE_BYTE | PIPE_READMODE_BYTE | PIPE_WAIT | PIPE_REJECT_REMOTE_CLIENTS, PIPE_UNLIMITED_INSTANCES, 4096, 4096, 0, NULL); /* TODO: How to properly handle self->p == INVALID_HANDLE_VALUE? */ win_assert (self->p != INVALID_HANDLE_VALUE); self->isaccepted = 1; nn_usock_create_io_completion (self); } DWORD nn_usock_open_pipe (struct nn_usock *self, const char *name) { char fullname [256]; DWORD winerror; DWORD mode; BOOL brc; /* First, create a fully qualified name for the named pipe. */ _snprintf(fullname, sizeof (fullname), "\\\\.\\pipe\\%s", name); /* TODO: Expose a way to pass lpSecurityAttributes */ self->p = CreateFileA ( fullname, GENERIC_READ | GENERIC_WRITE, 0, NULL, OPEN_ALWAYS, FILE_FLAG_OVERLAPPED, NULL); if (self->p == INVALID_HANDLE_VALUE) return GetLastError (); mode = PIPE_TYPE_BYTE | PIPE_READMODE_BYTE | PIPE_WAIT; brc = SetNamedPipeHandleState ( self->p, &mode, NULL, NULL); if (!brc) { CloseHandle (self->p); self->p = INVALID_HANDLE_VALUE; return GetLastError (); } self->isaccepted = 0; nn_usock_create_io_completion (self); winerror = GetLastError (); if (winerror != ERROR_SUCCESS && winerror != ERROR_ALREADY_EXISTS) return winerror; return ERROR_SUCCESS; } void nn_usock_accept_pipe (struct nn_usock *self, struct nn_usock *listener) { int rc; BOOL brc; DWORD winerror; /* TODO: EMFILE can be returned here. */ rc = nn_usock_start (self, listener->domain, listener->type, listener->protocol); errnum_assert(rc == 0, -rc); nn_fsm_action(&listener->fsm, NN_USOCK_ACTION_ACCEPT); nn_fsm_action(&self->fsm, NN_USOCK_ACTION_BEING_ACCEPTED); /* If the memory for accept information is not yet allocated, do so now. */ if (!listener->ainfo) { listener->ainfo = nn_alloc (512, "accept info"); alloc_assert (listener->ainfo); } /* Wait for the incoming connection. */ memset (&listener->in.olpd, 0, sizeof(listener->in.olpd)); nn_usock_create_pipe (self, listener->pipename.sun_path); brc = ConnectNamedPipe (self->p, (LPOVERLAPPED) &listener->in.olpd); /* TODO: Can this function possibly succeed? */ nn_assert (brc == 0); winerror = GetLastError(); /* Immediate success. */ if (nn_fast (winerror == ERROR_PIPE_CONNECTED)) { nn_fsm_action (&listener->fsm, NN_USOCK_ACTION_DONE); nn_fsm_action (&self->fsm, NN_USOCK_ACTION_DONE); return; } /* We don't expect a synchronous failure at this point. */ wsa_assert (nn_slow (winerror == WSA_IO_PENDING)); /* Pair the two sockets. */ nn_assert (!self->asock); self->asock = listener; nn_assert (!listener->asock); listener->asock = self; /* Asynchronous accept. */ nn_worker_op_start (&listener->in, 0); } static void nn_usock_close (struct nn_usock *self) { int rc; BOOL brc; if (self->domain == AF_UNIX) { if (self->p == INVALID_HANDLE_VALUE) return; if (self->isaccepted) DisconnectNamedPipe(self->p); brc = CloseHandle (self->p); self->p = INVALID_HANDLE_VALUE; win_assert (brc); } else { rc = closesocket (self->s); self->s = INVALID_SOCKET; wsa_assert (rc == 0); } } static void nn_usock_shutdown (struct nn_fsm *self, int src, int type, void *srcptr) { struct nn_usock *usock; usock = nn_cont (self, struct nn_usock, fsm); if (nn_slow (src == NN_FSM_ACTION && type == NN_FSM_STOP)) { /* Socket in ACCEPTING state cannot be closed. Stop the socket being accepted first. */ nn_assert (usock->state != NN_USOCK_STATE_ACCEPTING); /* Synchronous stop. */ if (usock->state == NN_USOCK_STATE_IDLE) goto finish3; if (usock->state == NN_USOCK_STATE_DONE) goto finish2; if (usock->state == NN_USOCK_STATE_STARTING || usock->state == NN_USOCK_STATE_ACCEPTED || usock->state == NN_USOCK_STATE_LISTENING) goto finish1; /* When socket that's being accepted is asked to stop, we have to ask the listener socket to stop accepting first. */ if (usock->state == NN_USOCK_STATE_BEING_ACCEPTED) { nn_fsm_action (&usock->asock->fsm, NN_USOCK_ACTION_CANCEL); usock->state = NN_USOCK_STATE_STOPPING_ACCEPT; return; } /* If we were already in the process of cancelling overlapped operations, we don't have to do anything. Continue waiting till cancelling is finished. */ if (usock->state == NN_USOCK_STATE_CANCELLING_IO) { usock->state = NN_USOCK_STATE_STOPPING; return; } /* Notify our parent that pipe socket is shutting down */ nn_fsm_raise (&usock->fsm, &usock->event_error, NN_USOCK_SHUTDOWN); /* In all remaining states we'll simply cancel all overlapped operations. */ if (nn_usock_cancel_io (usock) == 0) goto finish1; usock->state = NN_USOCK_STATE_STOPPING; return; } if (nn_slow (usock->state == NN_USOCK_STATE_STOPPING_ACCEPT)) { nn_assert (src == NN_FSM_ACTION && type == NN_USOCK_ACTION_DONE); goto finish1; } if (nn_slow (usock->state == NN_USOCK_STATE_STOPPING)) { if (!nn_worker_op_isidle (&usock->in) || !nn_worker_op_isidle (&usock->out)) return; finish1: nn_usock_close(usock); finish2: usock->state = NN_USOCK_STATE_IDLE; nn_fsm_stopped (&usock->fsm, NN_USOCK_STOPPED); finish3: return; } nn_fsm_bad_state(usock->state, src, type); } static void nn_usock_handler (struct nn_fsm *self, int src, int type, void *srcptr) { struct nn_usock *usock; usock = nn_cont (self, struct nn_usock, fsm); switch (usock->state) { /*****************************************************************************/ /* IDLE state. */ /*****************************************************************************/ case NN_USOCK_STATE_IDLE: switch (src) { case NN_FSM_ACTION: switch (type) { case NN_FSM_START: usock->state = NN_USOCK_STATE_STARTING; return; default: nn_fsm_bad_action (usock->state, src, type); } default: nn_fsm_bad_source (usock->state, src, type); } /*****************************************************************************/ /* STARTING state. */ /*****************************************************************************/ case NN_USOCK_STATE_STARTING: switch (src) { case NN_FSM_ACTION: switch (type) { case NN_USOCK_ACTION_LISTEN: usock->state = NN_USOCK_STATE_LISTENING; return; case NN_USOCK_ACTION_CONNECT: usock->state = NN_USOCK_STATE_CONNECTING; return; case NN_USOCK_ACTION_BEING_ACCEPTED: usock->state = NN_USOCK_STATE_BEING_ACCEPTED; return; default: nn_fsm_bad_action (usock->state, src, type); } default: nn_fsm_bad_source (usock->state, src, type); } /*****************************************************************************/ /* BEING_ACCEPTED state. */ /*****************************************************************************/ case NN_USOCK_STATE_BEING_ACCEPTED: switch (src) { case NN_FSM_ACTION: switch (type) { case NN_USOCK_ACTION_DONE: usock->state = NN_USOCK_STATE_ACCEPTED; nn_fsm_raise (&usock->fsm, &usock->event_established, NN_USOCK_ACCEPTED); return; default: nn_fsm_bad_action (usock->state, src, type); } default: nn_fsm_bad_source (usock->state, src, type); } /*****************************************************************************/ /* ACCEPTED state. */ /*****************************************************************************/ case NN_USOCK_STATE_ACCEPTED: switch (src) { case NN_FSM_ACTION: switch (type) { case NN_USOCK_ACTION_ACTIVATE: usock->state = NN_USOCK_STATE_ACTIVE; return; default: nn_fsm_bad_action (usock->state, src, type); } default: nn_fsm_bad_source (usock->state, src, type); } /*****************************************************************************/ /* CONNECTING state. */ /*****************************************************************************/ case NN_USOCK_STATE_CONNECTING: switch (src) { case NN_FSM_ACTION: switch (type) { case NN_USOCK_ACTION_DONE: usock->state = NN_USOCK_STATE_ACTIVE; nn_fsm_raise (&usock->fsm, &usock->event_established, NN_USOCK_CONNECTED); return; case NN_USOCK_ACTION_ERROR: nn_usock_close(usock); usock->state = NN_USOCK_STATE_DONE; nn_fsm_raise (&usock->fsm, &usock->event_error, NN_USOCK_ERROR); return; default: nn_fsm_bad_action (usock->state, src, type); } case NN_USOCK_SRC_OUT: switch (type) { case NN_WORKER_OP_DONE: usock->state = NN_USOCK_STATE_ACTIVE; nn_fsm_raise (&usock->fsm, &usock->event_established, NN_USOCK_CONNECTED); return; case NN_WORKER_OP_ERROR: nn_usock_close(usock); usock->state = NN_USOCK_STATE_DONE; nn_fsm_raise (&usock->fsm, &usock->event_error, NN_USOCK_ERROR); return; default: nn_fsm_bad_action (usock->state, src, type); } default: nn_fsm_bad_source (usock->state, src, type); } /*****************************************************************************/ /* ACTIVE state. */ /*****************************************************************************/ case NN_USOCK_STATE_ACTIVE: switch (src) { case NN_USOCK_SRC_IN: switch (type) { case NN_WORKER_OP_DONE: nn_fsm_raise (&usock->fsm, &usock->event_received, NN_USOCK_RECEIVED); return; case NN_WORKER_OP_ERROR: if (nn_usock_cancel_io (usock) == 0) { nn_fsm_raise(&usock->fsm, &usock->event_error, NN_USOCK_ERROR); nn_usock_close (usock); usock->state = NN_USOCK_STATE_DONE; return; } usock->state = NN_USOCK_STATE_CANCELLING_IO; return; default: nn_fsm_bad_action (usock->state, src, type); } case NN_USOCK_SRC_OUT: switch (type) { case NN_WORKER_OP_DONE: if (usock->pipesendbuf) { nn_free(usock->pipesendbuf); usock->pipesendbuf = NULL; } nn_fsm_raise (&usock->fsm, &usock->event_sent, NN_USOCK_SENT); return; case NN_WORKER_OP_ERROR: if (nn_usock_cancel_io (usock) == 0) { nn_fsm_raise(&usock->fsm, &usock->event_error, NN_USOCK_ERROR); nn_usock_close(usock); usock->state = NN_USOCK_STATE_DONE; return; } usock->state = NN_USOCK_STATE_CANCELLING_IO; return; default: nn_fsm_bad_action (usock->state, src, type); } case NN_FSM_ACTION: switch (type) { case NN_USOCK_ACTION_ERROR: if (nn_usock_cancel_io (usock) == 0) { nn_fsm_raise(&usock->fsm, &usock->event_error, NN_USOCK_SHUTDOWN); nn_usock_close(usock); usock->state = NN_USOCK_STATE_DONE; return; } usock->state = NN_USOCK_STATE_CANCELLING_IO; return; default: nn_fsm_bad_action (usock->state, src, type); } default: nn_fsm_bad_source (usock->state, src, type); } /*****************************************************************************/ /* CANCELLING_IO state. */ /*****************************************************************************/ case NN_USOCK_STATE_CANCELLING_IO: switch (src) { case NN_USOCK_SRC_IN: case NN_USOCK_SRC_OUT: if (!nn_worker_op_isidle (&usock->in) || !nn_worker_op_isidle (&usock->out)) return; nn_fsm_raise(&usock->fsm, &usock->event_error, NN_USOCK_SHUTDOWN); nn_usock_close(usock); usock->state = NN_USOCK_STATE_DONE; return; default: nn_fsm_bad_source (usock->state, src, type); } /*****************************************************************************/ /* DONE state. */ /*****************************************************************************/ case NN_USOCK_STATE_DONE: nn_fsm_bad_source (usock->state, src, type); /*****************************************************************************/ /* LISTENING state. */ /*****************************************************************************/ case NN_USOCK_STATE_LISTENING: switch (src) { case NN_FSM_ACTION: switch (type) { case NN_USOCK_ACTION_ACCEPT: usock->state = NN_USOCK_STATE_ACCEPTING; return; default: nn_fsm_bad_action (usock->state, src, type); } default: nn_fsm_bad_source (usock->state, src, type); } /*****************************************************************************/ /* ACCEPTING state. */ /*****************************************************************************/ case NN_USOCK_STATE_ACCEPTING: switch (src) { case NN_FSM_ACTION: switch (type) { case NN_USOCK_ACTION_DONE: usock->state = NN_USOCK_STATE_LISTENING; return; case NN_USOCK_ACTION_CANCEL: if (usock->p == INVALID_HANDLE_VALUE && usock->asock != NULL && usock->domain == AF_UNIX) { usock->p = usock->asock->p; nn_usock_cancel_io (usock); usock->p = INVALID_HANDLE_VALUE; } else { nn_usock_cancel_io(usock); } usock->state = NN_USOCK_STATE_CANCELLING; return; default: nn_fsm_bad_action (usock->state, src, type); } case NN_USOCK_SRC_IN: switch (type) { case NN_WORKER_OP_DONE: /* Adjust the new usock object. */ usock->asock->state = NN_USOCK_STATE_ACCEPTED; /* Notify the user that connection was accepted. */ nn_fsm_raise (&usock->asock->fsm, &usock->asock->event_established, NN_USOCK_ACCEPTED); /* Disassociate the listener socket from the accepted socket. */ usock->asock->asock = NULL; usock->asock = NULL; /* Wait till the user starts accepting once again. */ usock->state = NN_USOCK_STATE_LISTENING; return; default: nn_fsm_bad_action (usock->state, src, type); } default: nn_fsm_bad_source (usock->state, src, type); } /*****************************************************************************/ /* CANCELLING state. */ /*****************************************************************************/ case NN_USOCK_STATE_CANCELLING: switch (src) { case NN_USOCK_SRC_IN: switch (type) { case NN_WORKER_OP_DONE: case NN_WORKER_OP_ERROR: /* TODO: The socket being accepted should be closed here. */ usock->state = NN_USOCK_STATE_LISTENING; /* Notify the accepted socket that it was stopped. */ nn_fsm_action (&usock->asock->fsm, NN_USOCK_ACTION_DONE); return; default: nn_fsm_bad_action (usock->state, src, type); } default: nn_fsm_bad_source (usock->state, src, type); } /*****************************************************************************/ /* Invalid state. */ /*****************************************************************************/ default: nn_fsm_bad_state (usock->state, src, type); } } /*****************************************************************************/ /* State machine actions. */ /*****************************************************************************/ /* Returns 0 if there's nothing to cancel or 1 otherwise. */ static int nn_usock_cancel_io (struct nn_usock *self) { int rc; BOOL brc; /* For some reason simple CancelIo doesn't seem to work here. We have to use CancelIoEx instead. */ rc = 0; if (!nn_worker_op_isidle (&self->in)) { brc = CancelIoEx (self->p, &self->in.olpd); win_assert (brc || GetLastError () == ERROR_NOT_FOUND); rc = 1; } if (!nn_worker_op_isidle (&self->out)) { brc = CancelIoEx (self->p, &self->out.olpd); win_assert (brc || GetLastError () == ERROR_NOT_FOUND); rc = 1; } return rc; }
33.36019
107
0.551755
0c7b2b48ad59f25c5fae553d8590a7a8c6d7a290
1,325
c
C
lib/wizards/torspo/.dead_ed_files/crab.c
vlehtola/questmud
8bc3099b5ad00a9e0261faeb6637c76b521b6dbe
[ "MIT" ]
null
null
null
lib/wizards/torspo/.dead_ed_files/crab.c
vlehtola/questmud
8bc3099b5ad00a9e0261faeb6637c76b521b6dbe
[ "MIT" ]
null
null
null
lib/wizards/torspo/.dead_ed_files/crab.c
vlehtola/questmud
8bc3099b5ad00a9e0261faeb6637c76b521b6dbe
[ "MIT" ]
null
null
null
inherit "obj/monster"; int helping_small_ones = 0; reset(arg) { object armour; ::reset (arg); if(arg) { return; } set_level(82); set_spell_chance(15, "exs sol blt"); set_skill("cast essence", 50); set_skill("cast earth", 50); set_skill("cast bolt", 50); set_skill("mana control", 85); set_name("crab"); set_race("crab"); set_short("Huge, ancient crab"); set_long("This crab has lived here for ages. It looks ancient and has\n"+ "a thick natural bone armour. It's huge size fills almost the whole cave and\n"+ "the long, strong pincers can hit anyone in this room.\n"); set_al(-2); set_log(); set_aggressive(1); set_al_aggr(200); set_animal(); set_extra(1); armour = clone_object("/wizards/torspo/areat/ogre/monsters/eq/bracelet01.c"); move_object(armour, this_object()); armour = clone_object("/wizards/torspo/areat/ogre/monsters/eq/belt01.c"); move_object(armour, this_object()); } extra() { if (!attacker_ob) { return; } if (helping_small_ones <10) { move_object(clone_object("/wizards/torspo/areat/ogre/monsters/small_crab"), environment(this_object())); say("Huge crab draws some ancient runes in the air and a small crab appears from the dark\n"+ "portal to aid it's master.\n"); helping_small_ones++; } }
29.444444
108
0.668679
0cacee0b3b0029da54659f0a342fb351b1491ffe
51,681
h
C
eembc/CIFAR10_ResNetv1/my-hls-test-quantized-tiny2/myproject_prj/solution1/syn/systemc/relu_array_array_ap_fixed_32u_relu_config4_s.h
anmeza/platform_ml_models
ba8011a289a96013dd6f7a5b58eb1072f04d6bf0
[ "RSA-MD" ]
1
2021-12-21T18:19:27.000Z
2021-12-21T18:19:27.000Z
eembc/CIFAR10_ResNetv1/my-hls-test-quantized-tiny2/myproject_prj/solution1/syn/systemc/relu_array_array_ap_fixed_32u_relu_config4_s.h
anmeza/platform_ml_models
ba8011a289a96013dd6f7a5b58eb1072f04d6bf0
[ "RSA-MD" ]
null
null
null
eembc/CIFAR10_ResNetv1/my-hls-test-quantized-tiny2/myproject_prj/solution1/syn/systemc/relu_array_array_ap_fixed_32u_relu_config4_s.h
anmeza/platform_ml_models
ba8011a289a96013dd6f7a5b58eb1072f04d6bf0
[ "RSA-MD" ]
null
null
null
// ============================================================== // RTL generated by Vivado(TM) HLS - High-Level Synthesis from C, C++ and OpenCL // Version: 2020.1 // Copyright (C) 1986-2020 Xilinx, Inc. All Rights Reserved. // // =========================================================== #ifndef _relu_array_array_ap_fixed_32u_relu_config4_s_HH_ #define _relu_array_array_ap_fixed_32u_relu_config4_s_HH_ #include "systemc.h" #include "AESL_pkg.h" namespace ap_rtl { struct relu_array_array_ap_fixed_32u_relu_config4_s : public sc_module { // Port declarations 202 sc_in_clk ap_clk; sc_in< sc_logic > ap_rst; sc_in< sc_logic > ap_start; sc_in< sc_logic > start_full_n; sc_out< sc_logic > ap_done; sc_in< sc_logic > ap_continue; sc_out< sc_logic > ap_idle; sc_out< sc_logic > ap_ready; sc_out< sc_logic > start_out; sc_out< sc_logic > start_write; sc_in< sc_lv<9> > data_V_data_0_V_dout; sc_in< sc_logic > data_V_data_0_V_empty_n; sc_out< sc_logic > data_V_data_0_V_read; sc_in< sc_lv<9> > data_V_data_1_V_dout; sc_in< sc_logic > data_V_data_1_V_empty_n; sc_out< sc_logic > data_V_data_1_V_read; sc_in< sc_lv<9> > data_V_data_2_V_dout; sc_in< sc_logic > data_V_data_2_V_empty_n; sc_out< sc_logic > data_V_data_2_V_read; sc_in< sc_lv<9> > data_V_data_3_V_dout; sc_in< sc_logic > data_V_data_3_V_empty_n; sc_out< sc_logic > data_V_data_3_V_read; sc_in< sc_lv<9> > data_V_data_4_V_dout; sc_in< sc_logic > data_V_data_4_V_empty_n; sc_out< sc_logic > data_V_data_4_V_read; sc_in< sc_lv<9> > data_V_data_5_V_dout; sc_in< sc_logic > data_V_data_5_V_empty_n; sc_out< sc_logic > data_V_data_5_V_read; sc_in< sc_lv<9> > data_V_data_6_V_dout; sc_in< sc_logic > data_V_data_6_V_empty_n; sc_out< sc_logic > data_V_data_6_V_read; sc_in< sc_lv<9> > data_V_data_7_V_dout; sc_in< sc_logic > data_V_data_7_V_empty_n; sc_out< sc_logic > data_V_data_7_V_read; sc_in< sc_lv<9> > data_V_data_8_V_dout; sc_in< sc_logic > data_V_data_8_V_empty_n; sc_out< sc_logic > data_V_data_8_V_read; sc_in< sc_lv<9> > data_V_data_9_V_dout; sc_in< sc_logic > data_V_data_9_V_empty_n; sc_out< sc_logic > data_V_data_9_V_read; sc_in< sc_lv<9> > data_V_data_10_V_dout; sc_in< sc_logic > data_V_data_10_V_empty_n; sc_out< sc_logic > data_V_data_10_V_read; sc_in< sc_lv<9> > data_V_data_11_V_dout; sc_in< sc_logic > data_V_data_11_V_empty_n; sc_out< sc_logic > data_V_data_11_V_read; sc_in< sc_lv<9> > data_V_data_12_V_dout; sc_in< sc_logic > data_V_data_12_V_empty_n; sc_out< sc_logic > data_V_data_12_V_read; sc_in< sc_lv<9> > data_V_data_13_V_dout; sc_in< sc_logic > data_V_data_13_V_empty_n; sc_out< sc_logic > data_V_data_13_V_read; sc_in< sc_lv<9> > data_V_data_14_V_dout; sc_in< sc_logic > data_V_data_14_V_empty_n; sc_out< sc_logic > data_V_data_14_V_read; sc_in< sc_lv<9> > data_V_data_15_V_dout; sc_in< sc_logic > data_V_data_15_V_empty_n; sc_out< sc_logic > data_V_data_15_V_read; sc_in< sc_lv<9> > data_V_data_16_V_dout; sc_in< sc_logic > data_V_data_16_V_empty_n; sc_out< sc_logic > data_V_data_16_V_read; sc_in< sc_lv<9> > data_V_data_17_V_dout; sc_in< sc_logic > data_V_data_17_V_empty_n; sc_out< sc_logic > data_V_data_17_V_read; sc_in< sc_lv<9> > data_V_data_18_V_dout; sc_in< sc_logic > data_V_data_18_V_empty_n; sc_out< sc_logic > data_V_data_18_V_read; sc_in< sc_lv<9> > data_V_data_19_V_dout; sc_in< sc_logic > data_V_data_19_V_empty_n; sc_out< sc_logic > data_V_data_19_V_read; sc_in< sc_lv<9> > data_V_data_20_V_dout; sc_in< sc_logic > data_V_data_20_V_empty_n; sc_out< sc_logic > data_V_data_20_V_read; sc_in< sc_lv<9> > data_V_data_21_V_dout; sc_in< sc_logic > data_V_data_21_V_empty_n; sc_out< sc_logic > data_V_data_21_V_read; sc_in< sc_lv<9> > data_V_data_22_V_dout; sc_in< sc_logic > data_V_data_22_V_empty_n; sc_out< sc_logic > data_V_data_22_V_read; sc_in< sc_lv<9> > data_V_data_23_V_dout; sc_in< sc_logic > data_V_data_23_V_empty_n; sc_out< sc_logic > data_V_data_23_V_read; sc_in< sc_lv<9> > data_V_data_24_V_dout; sc_in< sc_logic > data_V_data_24_V_empty_n; sc_out< sc_logic > data_V_data_24_V_read; sc_in< sc_lv<9> > data_V_data_25_V_dout; sc_in< sc_logic > data_V_data_25_V_empty_n; sc_out< sc_logic > data_V_data_25_V_read; sc_in< sc_lv<9> > data_V_data_26_V_dout; sc_in< sc_logic > data_V_data_26_V_empty_n; sc_out< sc_logic > data_V_data_26_V_read; sc_in< sc_lv<9> > data_V_data_27_V_dout; sc_in< sc_logic > data_V_data_27_V_empty_n; sc_out< sc_logic > data_V_data_27_V_read; sc_in< sc_lv<9> > data_V_data_28_V_dout; sc_in< sc_logic > data_V_data_28_V_empty_n; sc_out< sc_logic > data_V_data_28_V_read; sc_in< sc_lv<9> > data_V_data_29_V_dout; sc_in< sc_logic > data_V_data_29_V_empty_n; sc_out< sc_logic > data_V_data_29_V_read; sc_in< sc_lv<9> > data_V_data_30_V_dout; sc_in< sc_logic > data_V_data_30_V_empty_n; sc_out< sc_logic > data_V_data_30_V_read; sc_in< sc_lv<9> > data_V_data_31_V_dout; sc_in< sc_logic > data_V_data_31_V_empty_n; sc_out< sc_logic > data_V_data_31_V_read; sc_out< sc_lv<8> > res_V_data_0_V_din; sc_in< sc_logic > res_V_data_0_V_full_n; sc_out< sc_logic > res_V_data_0_V_write; sc_out< sc_lv<8> > res_V_data_1_V_din; sc_in< sc_logic > res_V_data_1_V_full_n; sc_out< sc_logic > res_V_data_1_V_write; sc_out< sc_lv<8> > res_V_data_2_V_din; sc_in< sc_logic > res_V_data_2_V_full_n; sc_out< sc_logic > res_V_data_2_V_write; sc_out< sc_lv<8> > res_V_data_3_V_din; sc_in< sc_logic > res_V_data_3_V_full_n; sc_out< sc_logic > res_V_data_3_V_write; sc_out< sc_lv<8> > res_V_data_4_V_din; sc_in< sc_logic > res_V_data_4_V_full_n; sc_out< sc_logic > res_V_data_4_V_write; sc_out< sc_lv<8> > res_V_data_5_V_din; sc_in< sc_logic > res_V_data_5_V_full_n; sc_out< sc_logic > res_V_data_5_V_write; sc_out< sc_lv<8> > res_V_data_6_V_din; sc_in< sc_logic > res_V_data_6_V_full_n; sc_out< sc_logic > res_V_data_6_V_write; sc_out< sc_lv<8> > res_V_data_7_V_din; sc_in< sc_logic > res_V_data_7_V_full_n; sc_out< sc_logic > res_V_data_7_V_write; sc_out< sc_lv<8> > res_V_data_8_V_din; sc_in< sc_logic > res_V_data_8_V_full_n; sc_out< sc_logic > res_V_data_8_V_write; sc_out< sc_lv<8> > res_V_data_9_V_din; sc_in< sc_logic > res_V_data_9_V_full_n; sc_out< sc_logic > res_V_data_9_V_write; sc_out< sc_lv<8> > res_V_data_10_V_din; sc_in< sc_logic > res_V_data_10_V_full_n; sc_out< sc_logic > res_V_data_10_V_write; sc_out< sc_lv<8> > res_V_data_11_V_din; sc_in< sc_logic > res_V_data_11_V_full_n; sc_out< sc_logic > res_V_data_11_V_write; sc_out< sc_lv<8> > res_V_data_12_V_din; sc_in< sc_logic > res_V_data_12_V_full_n; sc_out< sc_logic > res_V_data_12_V_write; sc_out< sc_lv<8> > res_V_data_13_V_din; sc_in< sc_logic > res_V_data_13_V_full_n; sc_out< sc_logic > res_V_data_13_V_write; sc_out< sc_lv<8> > res_V_data_14_V_din; sc_in< sc_logic > res_V_data_14_V_full_n; sc_out< sc_logic > res_V_data_14_V_write; sc_out< sc_lv<8> > res_V_data_15_V_din; sc_in< sc_logic > res_V_data_15_V_full_n; sc_out< sc_logic > res_V_data_15_V_write; sc_out< sc_lv<8> > res_V_data_16_V_din; sc_in< sc_logic > res_V_data_16_V_full_n; sc_out< sc_logic > res_V_data_16_V_write; sc_out< sc_lv<8> > res_V_data_17_V_din; sc_in< sc_logic > res_V_data_17_V_full_n; sc_out< sc_logic > res_V_data_17_V_write; sc_out< sc_lv<8> > res_V_data_18_V_din; sc_in< sc_logic > res_V_data_18_V_full_n; sc_out< sc_logic > res_V_data_18_V_write; sc_out< sc_lv<8> > res_V_data_19_V_din; sc_in< sc_logic > res_V_data_19_V_full_n; sc_out< sc_logic > res_V_data_19_V_write; sc_out< sc_lv<8> > res_V_data_20_V_din; sc_in< sc_logic > res_V_data_20_V_full_n; sc_out< sc_logic > res_V_data_20_V_write; sc_out< sc_lv<8> > res_V_data_21_V_din; sc_in< sc_logic > res_V_data_21_V_full_n; sc_out< sc_logic > res_V_data_21_V_write; sc_out< sc_lv<8> > res_V_data_22_V_din; sc_in< sc_logic > res_V_data_22_V_full_n; sc_out< sc_logic > res_V_data_22_V_write; sc_out< sc_lv<8> > res_V_data_23_V_din; sc_in< sc_logic > res_V_data_23_V_full_n; sc_out< sc_logic > res_V_data_23_V_write; sc_out< sc_lv<8> > res_V_data_24_V_din; sc_in< sc_logic > res_V_data_24_V_full_n; sc_out< sc_logic > res_V_data_24_V_write; sc_out< sc_lv<8> > res_V_data_25_V_din; sc_in< sc_logic > res_V_data_25_V_full_n; sc_out< sc_logic > res_V_data_25_V_write; sc_out< sc_lv<8> > res_V_data_26_V_din; sc_in< sc_logic > res_V_data_26_V_full_n; sc_out< sc_logic > res_V_data_26_V_write; sc_out< sc_lv<8> > res_V_data_27_V_din; sc_in< sc_logic > res_V_data_27_V_full_n; sc_out< sc_logic > res_V_data_27_V_write; sc_out< sc_lv<8> > res_V_data_28_V_din; sc_in< sc_logic > res_V_data_28_V_full_n; sc_out< sc_logic > res_V_data_28_V_write; sc_out< sc_lv<8> > res_V_data_29_V_din; sc_in< sc_logic > res_V_data_29_V_full_n; sc_out< sc_logic > res_V_data_29_V_write; sc_out< sc_lv<8> > res_V_data_30_V_din; sc_in< sc_logic > res_V_data_30_V_full_n; sc_out< sc_logic > res_V_data_30_V_write; sc_out< sc_lv<8> > res_V_data_31_V_din; sc_in< sc_logic > res_V_data_31_V_full_n; sc_out< sc_logic > res_V_data_31_V_write; // Module declarations relu_array_array_ap_fixed_32u_relu_config4_s(sc_module_name name); SC_HAS_PROCESS(relu_array_array_ap_fixed_32u_relu_config4_s); ~relu_array_array_ap_fixed_32u_relu_config4_s(); sc_trace_file* mVcdFile; sc_signal< sc_logic > real_start; sc_signal< sc_logic > start_once_reg; sc_signal< sc_logic > ap_done_reg; sc_signal< sc_lv<3> > ap_CS_fsm; sc_signal< sc_logic > ap_CS_fsm_state1; sc_signal< sc_logic > internal_ap_ready; sc_signal< sc_logic > data_V_data_0_V_blk_n; sc_signal< sc_logic > ap_CS_fsm_pp0_stage0; sc_signal< sc_logic > ap_enable_reg_pp0_iter1; sc_signal< bool > ap_block_pp0_stage0; sc_signal< sc_lv<1> > icmp_ln60_reg_2687; sc_signal< sc_logic > data_V_data_1_V_blk_n; sc_signal< sc_logic > data_V_data_2_V_blk_n; sc_signal< sc_logic > data_V_data_3_V_blk_n; sc_signal< sc_logic > data_V_data_4_V_blk_n; sc_signal< sc_logic > data_V_data_5_V_blk_n; sc_signal< sc_logic > data_V_data_6_V_blk_n; sc_signal< sc_logic > data_V_data_7_V_blk_n; sc_signal< sc_logic > data_V_data_8_V_blk_n; sc_signal< sc_logic > data_V_data_9_V_blk_n; sc_signal< sc_logic > data_V_data_10_V_blk_n; sc_signal< sc_logic > data_V_data_11_V_blk_n; sc_signal< sc_logic > data_V_data_12_V_blk_n; sc_signal< sc_logic > data_V_data_13_V_blk_n; sc_signal< sc_logic > data_V_data_14_V_blk_n; sc_signal< sc_logic > data_V_data_15_V_blk_n; sc_signal< sc_logic > data_V_data_16_V_blk_n; sc_signal< sc_logic > data_V_data_17_V_blk_n; sc_signal< sc_logic > data_V_data_18_V_blk_n; sc_signal< sc_logic > data_V_data_19_V_blk_n; sc_signal< sc_logic > data_V_data_20_V_blk_n; sc_signal< sc_logic > data_V_data_21_V_blk_n; sc_signal< sc_logic > data_V_data_22_V_blk_n; sc_signal< sc_logic > data_V_data_23_V_blk_n; sc_signal< sc_logic > data_V_data_24_V_blk_n; sc_signal< sc_logic > data_V_data_25_V_blk_n; sc_signal< sc_logic > data_V_data_26_V_blk_n; sc_signal< sc_logic > data_V_data_27_V_blk_n; sc_signal< sc_logic > data_V_data_28_V_blk_n; sc_signal< sc_logic > data_V_data_29_V_blk_n; sc_signal< sc_logic > data_V_data_30_V_blk_n; sc_signal< sc_logic > data_V_data_31_V_blk_n; sc_signal< sc_logic > res_V_data_0_V_blk_n; sc_signal< sc_logic > ap_enable_reg_pp0_iter2; sc_signal< sc_lv<1> > icmp_ln60_reg_2687_pp0_iter1_reg; sc_signal< sc_logic > res_V_data_1_V_blk_n; sc_signal< sc_logic > res_V_data_2_V_blk_n; sc_signal< sc_logic > res_V_data_3_V_blk_n; sc_signal< sc_logic > res_V_data_4_V_blk_n; sc_signal< sc_logic > res_V_data_5_V_blk_n; sc_signal< sc_logic > res_V_data_6_V_blk_n; sc_signal< sc_logic > res_V_data_7_V_blk_n; sc_signal< sc_logic > res_V_data_8_V_blk_n; sc_signal< sc_logic > res_V_data_9_V_blk_n; sc_signal< sc_logic > res_V_data_10_V_blk_n; sc_signal< sc_logic > res_V_data_11_V_blk_n; sc_signal< sc_logic > res_V_data_12_V_blk_n; sc_signal< sc_logic > res_V_data_13_V_blk_n; sc_signal< sc_logic > res_V_data_14_V_blk_n; sc_signal< sc_logic > res_V_data_15_V_blk_n; sc_signal< sc_logic > res_V_data_16_V_blk_n; sc_signal< sc_logic > res_V_data_17_V_blk_n; sc_signal< sc_logic > res_V_data_18_V_blk_n; sc_signal< sc_logic > res_V_data_19_V_blk_n; sc_signal< sc_logic > res_V_data_20_V_blk_n; sc_signal< sc_logic > res_V_data_21_V_blk_n; sc_signal< sc_logic > res_V_data_22_V_blk_n; sc_signal< sc_logic > res_V_data_23_V_blk_n; sc_signal< sc_logic > res_V_data_24_V_blk_n; sc_signal< sc_logic > res_V_data_25_V_blk_n; sc_signal< sc_logic > res_V_data_26_V_blk_n; sc_signal< sc_logic > res_V_data_27_V_blk_n; sc_signal< sc_logic > res_V_data_28_V_blk_n; sc_signal< sc_logic > res_V_data_29_V_blk_n; sc_signal< sc_logic > res_V_data_30_V_blk_n; sc_signal< sc_logic > res_V_data_31_V_blk_n; sc_signal< sc_lv<11> > i_0_reg_360; sc_signal< sc_lv<1> > icmp_ln60_fu_371_p2; sc_signal< bool > ap_block_state2_pp0_stage0_iter0; sc_signal< sc_logic > io_acc_block_signal_op76; sc_signal< bool > ap_block_state3_pp0_stage0_iter1; sc_signal< sc_logic > io_acc_block_signal_op432; sc_signal< bool > ap_block_state4_pp0_stage0_iter2; sc_signal< bool > ap_block_pp0_stage0_11001; sc_signal< sc_lv<11> > i_fu_377_p2; sc_signal< sc_logic > ap_enable_reg_pp0_iter0; sc_signal< sc_lv<7> > tmp_data_0_V_fu_567_p3; sc_signal< sc_lv<7> > tmp_data_0_V_reg_2696; sc_signal< sc_lv<7> > tmp_data_1_V_fu_631_p3; sc_signal< sc_lv<7> > tmp_data_1_V_reg_2701; sc_signal< sc_lv<7> > tmp_data_2_V_fu_695_p3; sc_signal< sc_lv<7> > tmp_data_2_V_reg_2706; sc_signal< sc_lv<7> > tmp_data_3_V_fu_759_p3; sc_signal< sc_lv<7> > tmp_data_3_V_reg_2711; sc_signal< sc_lv<7> > tmp_data_4_V_fu_823_p3; sc_signal< sc_lv<7> > tmp_data_4_V_reg_2716; sc_signal< sc_lv<7> > tmp_data_5_V_fu_887_p3; sc_signal< sc_lv<7> > tmp_data_5_V_reg_2721; sc_signal< sc_lv<7> > tmp_data_6_V_fu_951_p3; sc_signal< sc_lv<7> > tmp_data_6_V_reg_2726; sc_signal< sc_lv<7> > tmp_data_7_V_fu_1015_p3; sc_signal< sc_lv<7> > tmp_data_7_V_reg_2731; sc_signal< sc_lv<7> > tmp_data_8_V_fu_1079_p3; sc_signal< sc_lv<7> > tmp_data_8_V_reg_2736; sc_signal< sc_lv<7> > tmp_data_9_V_fu_1143_p3; sc_signal< sc_lv<7> > tmp_data_9_V_reg_2741; sc_signal< sc_lv<7> > tmp_data_10_V_fu_1207_p3; sc_signal< sc_lv<7> > tmp_data_10_V_reg_2746; sc_signal< sc_lv<7> > tmp_data_11_V_fu_1271_p3; sc_signal< sc_lv<7> > tmp_data_11_V_reg_2751; sc_signal< sc_lv<7> > tmp_data_12_V_fu_1335_p3; sc_signal< sc_lv<7> > tmp_data_12_V_reg_2756; sc_signal< sc_lv<7> > tmp_data_13_V_fu_1399_p3; sc_signal< sc_lv<7> > tmp_data_13_V_reg_2761; sc_signal< sc_lv<7> > tmp_data_14_V_fu_1463_p3; sc_signal< sc_lv<7> > tmp_data_14_V_reg_2766; sc_signal< sc_lv<7> > tmp_data_15_V_fu_1527_p3; sc_signal< sc_lv<7> > tmp_data_15_V_reg_2771; sc_signal< sc_lv<7> > tmp_data_16_V_fu_1591_p3; sc_signal< sc_lv<7> > tmp_data_16_V_reg_2776; sc_signal< sc_lv<7> > tmp_data_17_V_fu_1655_p3; sc_signal< sc_lv<7> > tmp_data_17_V_reg_2781; sc_signal< sc_lv<7> > tmp_data_18_V_fu_1719_p3; sc_signal< sc_lv<7> > tmp_data_18_V_reg_2786; sc_signal< sc_lv<7> > tmp_data_19_V_fu_1783_p3; sc_signal< sc_lv<7> > tmp_data_19_V_reg_2791; sc_signal< sc_lv<7> > tmp_data_20_V_fu_1847_p3; sc_signal< sc_lv<7> > tmp_data_20_V_reg_2796; sc_signal< sc_lv<7> > tmp_data_21_V_fu_1911_p3; sc_signal< sc_lv<7> > tmp_data_21_V_reg_2801; sc_signal< sc_lv<7> > tmp_data_22_V_fu_1975_p3; sc_signal< sc_lv<7> > tmp_data_22_V_reg_2806; sc_signal< sc_lv<7> > tmp_data_23_V_fu_2039_p3; sc_signal< sc_lv<7> > tmp_data_23_V_reg_2811; sc_signal< sc_lv<7> > tmp_data_24_V_fu_2103_p3; sc_signal< sc_lv<7> > tmp_data_24_V_reg_2816; sc_signal< sc_lv<7> > tmp_data_25_V_fu_2167_p3; sc_signal< sc_lv<7> > tmp_data_25_V_reg_2821; sc_signal< sc_lv<7> > tmp_data_26_V_fu_2231_p3; sc_signal< sc_lv<7> > tmp_data_26_V_reg_2826; sc_signal< sc_lv<7> > tmp_data_27_V_fu_2295_p3; sc_signal< sc_lv<7> > tmp_data_27_V_reg_2831; sc_signal< sc_lv<7> > tmp_data_28_V_fu_2359_p3; sc_signal< sc_lv<7> > tmp_data_28_V_reg_2836; sc_signal< sc_lv<7> > tmp_data_29_V_fu_2423_p3; sc_signal< sc_lv<7> > tmp_data_29_V_reg_2841; sc_signal< sc_lv<7> > tmp_data_30_V_fu_2487_p3; sc_signal< sc_lv<7> > tmp_data_30_V_reg_2846; sc_signal< sc_lv<7> > tmp_data_31_V_fu_2551_p3; sc_signal< sc_lv<7> > tmp_data_31_V_reg_2851; sc_signal< bool > ap_block_state1; sc_signal< bool > ap_block_pp0_stage0_subdone; sc_signal< sc_logic > ap_condition_pp0_exit_iter0_state2; sc_signal< bool > ap_block_pp0_stage0_01001; sc_signal< sc_lv<5> > trunc_ln746_fu_517_p1; sc_signal< sc_lv<3> > p_Result_4_fu_537_p4; sc_signal< sc_lv<1> > tmp_5_fu_529_p3; sc_signal< sc_lv<1> > icmp_ln785_fu_547_p2; sc_signal< sc_lv<1> > or_ln785_fu_553_p2; sc_signal< sc_lv<7> > trunc_ln_fu_521_p3; sc_signal< sc_lv<1> > icmp_ln1494_fu_511_p2; sc_signal< sc_lv<7> > select_ln785_fu_559_p3; sc_signal< sc_lv<5> > trunc_ln746_31_fu_581_p1; sc_signal< sc_lv<3> > p_Result_4_1_fu_601_p4; sc_signal< sc_lv<1> > tmp_6_fu_593_p3; sc_signal< sc_lv<1> > icmp_ln785_1_fu_611_p2; sc_signal< sc_lv<1> > or_ln785_1_fu_617_p2; sc_signal< sc_lv<7> > trunc_ln746_4_fu_585_p3; sc_signal< sc_lv<1> > icmp_ln1494_1_fu_575_p2; sc_signal< sc_lv<7> > select_ln785_4_fu_623_p3; sc_signal< sc_lv<5> > trunc_ln746_32_fu_645_p1; sc_signal< sc_lv<3> > p_Result_4_2_fu_665_p4; sc_signal< sc_lv<1> > tmp_7_fu_657_p3; sc_signal< sc_lv<1> > icmp_ln785_2_fu_675_p2; sc_signal< sc_lv<1> > or_ln785_2_fu_681_p2; sc_signal< sc_lv<7> > trunc_ln746_5_fu_649_p3; sc_signal< sc_lv<1> > icmp_ln1494_2_fu_639_p2; sc_signal< sc_lv<7> > select_ln785_5_fu_687_p3; sc_signal< sc_lv<5> > trunc_ln746_33_fu_709_p1; sc_signal< sc_lv<3> > p_Result_4_3_fu_729_p4; sc_signal< sc_lv<1> > tmp_8_fu_721_p3; sc_signal< sc_lv<1> > icmp_ln785_3_fu_739_p2; sc_signal< sc_lv<1> > or_ln785_3_fu_745_p2; sc_signal< sc_lv<7> > trunc_ln746_6_fu_713_p3; sc_signal< sc_lv<1> > icmp_ln1494_3_fu_703_p2; sc_signal< sc_lv<7> > select_ln785_6_fu_751_p3; sc_signal< sc_lv<5> > trunc_ln746_34_fu_773_p1; sc_signal< sc_lv<3> > p_Result_4_4_fu_793_p4; sc_signal< sc_lv<1> > tmp_9_fu_785_p3; sc_signal< sc_lv<1> > icmp_ln785_4_fu_803_p2; sc_signal< sc_lv<1> > or_ln785_4_fu_809_p2; sc_signal< sc_lv<7> > trunc_ln746_7_fu_777_p3; sc_signal< sc_lv<1> > icmp_ln1494_4_fu_767_p2; sc_signal< sc_lv<7> > select_ln785_7_fu_815_p3; sc_signal< sc_lv<5> > trunc_ln746_35_fu_837_p1; sc_signal< sc_lv<3> > p_Result_4_5_fu_857_p4; sc_signal< sc_lv<1> > tmp_10_fu_849_p3; sc_signal< sc_lv<1> > icmp_ln785_5_fu_867_p2; sc_signal< sc_lv<1> > or_ln785_5_fu_873_p2; sc_signal< sc_lv<7> > trunc_ln746_8_fu_841_p3; sc_signal< sc_lv<1> > icmp_ln1494_5_fu_831_p2; sc_signal< sc_lv<7> > select_ln785_8_fu_879_p3; sc_signal< sc_lv<5> > trunc_ln746_36_fu_901_p1; sc_signal< sc_lv<3> > p_Result_4_6_fu_921_p4; sc_signal< sc_lv<1> > tmp_11_fu_913_p3; sc_signal< sc_lv<1> > icmp_ln785_6_fu_931_p2; sc_signal< sc_lv<1> > or_ln785_6_fu_937_p2; sc_signal< sc_lv<7> > trunc_ln746_9_fu_905_p3; sc_signal< sc_lv<1> > icmp_ln1494_6_fu_895_p2; sc_signal< sc_lv<7> > select_ln785_9_fu_943_p3; sc_signal< sc_lv<5> > trunc_ln746_37_fu_965_p1; sc_signal< sc_lv<3> > p_Result_4_7_fu_985_p4; sc_signal< sc_lv<1> > tmp_12_fu_977_p3; sc_signal< sc_lv<1> > icmp_ln785_7_fu_995_p2; sc_signal< sc_lv<1> > or_ln785_7_fu_1001_p2; sc_signal< sc_lv<7> > trunc_ln746_s_fu_969_p3; sc_signal< sc_lv<1> > icmp_ln1494_7_fu_959_p2; sc_signal< sc_lv<7> > select_ln785_10_fu_1007_p3; sc_signal< sc_lv<5> > trunc_ln746_38_fu_1029_p1; sc_signal< sc_lv<3> > p_Result_4_8_fu_1049_p4; sc_signal< sc_lv<1> > tmp_13_fu_1041_p3; sc_signal< sc_lv<1> > icmp_ln785_8_fu_1059_p2; sc_signal< sc_lv<1> > or_ln785_8_fu_1065_p2; sc_signal< sc_lv<7> > trunc_ln746_1_fu_1033_p3; sc_signal< sc_lv<1> > icmp_ln1494_8_fu_1023_p2; sc_signal< sc_lv<7> > select_ln785_11_fu_1071_p3; sc_signal< sc_lv<5> > trunc_ln746_39_fu_1093_p1; sc_signal< sc_lv<3> > p_Result_4_9_fu_1113_p4; sc_signal< sc_lv<1> > tmp_14_fu_1105_p3; sc_signal< sc_lv<1> > icmp_ln785_9_fu_1123_p2; sc_signal< sc_lv<1> > or_ln785_9_fu_1129_p2; sc_signal< sc_lv<7> > trunc_ln746_2_fu_1097_p3; sc_signal< sc_lv<1> > icmp_ln1494_9_fu_1087_p2; sc_signal< sc_lv<7> > select_ln785_12_fu_1135_p3; sc_signal< sc_lv<5> > trunc_ln746_40_fu_1157_p1; sc_signal< sc_lv<3> > p_Result_4_s_fu_1177_p4; sc_signal< sc_lv<1> > tmp_15_fu_1169_p3; sc_signal< sc_lv<1> > icmp_ln785_10_fu_1187_p2; sc_signal< sc_lv<1> > or_ln785_10_fu_1193_p2; sc_signal< sc_lv<7> > trunc_ln746_3_fu_1161_p3; sc_signal< sc_lv<1> > icmp_ln1494_10_fu_1151_p2; sc_signal< sc_lv<7> > select_ln785_13_fu_1199_p3; sc_signal< sc_lv<5> > trunc_ln746_41_fu_1221_p1; sc_signal< sc_lv<3> > p_Result_4_10_fu_1241_p4; sc_signal< sc_lv<1> > tmp_16_fu_1233_p3; sc_signal< sc_lv<1> > icmp_ln785_11_fu_1251_p2; sc_signal< sc_lv<1> > or_ln785_11_fu_1257_p2; sc_signal< sc_lv<7> > trunc_ln746_10_fu_1225_p3; sc_signal< sc_lv<1> > icmp_ln1494_11_fu_1215_p2; sc_signal< sc_lv<7> > select_ln785_14_fu_1263_p3; sc_signal< sc_lv<5> > trunc_ln746_42_fu_1285_p1; sc_signal< sc_lv<3> > p_Result_4_11_fu_1305_p4; sc_signal< sc_lv<1> > tmp_17_fu_1297_p3; sc_signal< sc_lv<1> > icmp_ln785_12_fu_1315_p2; sc_signal< sc_lv<1> > or_ln785_12_fu_1321_p2; sc_signal< sc_lv<7> > trunc_ln746_11_fu_1289_p3; sc_signal< sc_lv<1> > icmp_ln1494_12_fu_1279_p2; sc_signal< sc_lv<7> > select_ln785_15_fu_1327_p3; sc_signal< sc_lv<5> > trunc_ln746_43_fu_1349_p1; sc_signal< sc_lv<3> > p_Result_4_12_fu_1369_p4; sc_signal< sc_lv<1> > tmp_18_fu_1361_p3; sc_signal< sc_lv<1> > icmp_ln785_13_fu_1379_p2; sc_signal< sc_lv<1> > or_ln785_13_fu_1385_p2; sc_signal< sc_lv<7> > trunc_ln746_12_fu_1353_p3; sc_signal< sc_lv<1> > icmp_ln1494_13_fu_1343_p2; sc_signal< sc_lv<7> > select_ln785_16_fu_1391_p3; sc_signal< sc_lv<5> > trunc_ln746_44_fu_1413_p1; sc_signal< sc_lv<3> > p_Result_4_13_fu_1433_p4; sc_signal< sc_lv<1> > tmp_19_fu_1425_p3; sc_signal< sc_lv<1> > icmp_ln785_14_fu_1443_p2; sc_signal< sc_lv<1> > or_ln785_14_fu_1449_p2; sc_signal< sc_lv<7> > trunc_ln746_13_fu_1417_p3; sc_signal< sc_lv<1> > icmp_ln1494_14_fu_1407_p2; sc_signal< sc_lv<7> > select_ln785_17_fu_1455_p3; sc_signal< sc_lv<5> > trunc_ln746_45_fu_1477_p1; sc_signal< sc_lv<3> > p_Result_4_14_fu_1497_p4; sc_signal< sc_lv<1> > tmp_20_fu_1489_p3; sc_signal< sc_lv<1> > icmp_ln785_15_fu_1507_p2; sc_signal< sc_lv<1> > or_ln785_15_fu_1513_p2; sc_signal< sc_lv<7> > trunc_ln746_14_fu_1481_p3; sc_signal< sc_lv<1> > icmp_ln1494_15_fu_1471_p2; sc_signal< sc_lv<7> > select_ln785_18_fu_1519_p3; sc_signal< sc_lv<5> > trunc_ln746_46_fu_1541_p1; sc_signal< sc_lv<3> > p_Result_4_15_fu_1561_p4; sc_signal< sc_lv<1> > tmp_21_fu_1553_p3; sc_signal< sc_lv<1> > icmp_ln785_16_fu_1571_p2; sc_signal< sc_lv<1> > or_ln785_16_fu_1577_p2; sc_signal< sc_lv<7> > trunc_ln746_15_fu_1545_p3; sc_signal< sc_lv<1> > icmp_ln1494_16_fu_1535_p2; sc_signal< sc_lv<7> > select_ln785_19_fu_1583_p3; sc_signal< sc_lv<5> > trunc_ln746_47_fu_1605_p1; sc_signal< sc_lv<3> > p_Result_4_16_fu_1625_p4; sc_signal< sc_lv<1> > tmp_22_fu_1617_p3; sc_signal< sc_lv<1> > icmp_ln785_17_fu_1635_p2; sc_signal< sc_lv<1> > or_ln785_17_fu_1641_p2; sc_signal< sc_lv<7> > trunc_ln746_16_fu_1609_p3; sc_signal< sc_lv<1> > icmp_ln1494_17_fu_1599_p2; sc_signal< sc_lv<7> > select_ln785_20_fu_1647_p3; sc_signal< sc_lv<5> > trunc_ln746_48_fu_1669_p1; sc_signal< sc_lv<3> > p_Result_4_17_fu_1689_p4; sc_signal< sc_lv<1> > tmp_23_fu_1681_p3; sc_signal< sc_lv<1> > icmp_ln785_18_fu_1699_p2; sc_signal< sc_lv<1> > or_ln785_18_fu_1705_p2; sc_signal< sc_lv<7> > trunc_ln746_17_fu_1673_p3; sc_signal< sc_lv<1> > icmp_ln1494_18_fu_1663_p2; sc_signal< sc_lv<7> > select_ln785_21_fu_1711_p3; sc_signal< sc_lv<5> > trunc_ln746_49_fu_1733_p1; sc_signal< sc_lv<3> > p_Result_4_18_fu_1753_p4; sc_signal< sc_lv<1> > tmp_24_fu_1745_p3; sc_signal< sc_lv<1> > icmp_ln785_19_fu_1763_p2; sc_signal< sc_lv<1> > or_ln785_19_fu_1769_p2; sc_signal< sc_lv<7> > trunc_ln746_18_fu_1737_p3; sc_signal< sc_lv<1> > icmp_ln1494_19_fu_1727_p2; sc_signal< sc_lv<7> > select_ln785_22_fu_1775_p3; sc_signal< sc_lv<5> > trunc_ln746_50_fu_1797_p1; sc_signal< sc_lv<3> > p_Result_4_19_fu_1817_p4; sc_signal< sc_lv<1> > tmp_25_fu_1809_p3; sc_signal< sc_lv<1> > icmp_ln785_20_fu_1827_p2; sc_signal< sc_lv<1> > or_ln785_20_fu_1833_p2; sc_signal< sc_lv<7> > trunc_ln746_19_fu_1801_p3; sc_signal< sc_lv<1> > icmp_ln1494_20_fu_1791_p2; sc_signal< sc_lv<7> > select_ln785_23_fu_1839_p3; sc_signal< sc_lv<5> > trunc_ln746_51_fu_1861_p1; sc_signal< sc_lv<3> > p_Result_4_20_fu_1881_p4; sc_signal< sc_lv<1> > tmp_26_fu_1873_p3; sc_signal< sc_lv<1> > icmp_ln785_21_fu_1891_p2; sc_signal< sc_lv<1> > or_ln785_21_fu_1897_p2; sc_signal< sc_lv<7> > trunc_ln746_20_fu_1865_p3; sc_signal< sc_lv<1> > icmp_ln1494_21_fu_1855_p2; sc_signal< sc_lv<7> > select_ln785_24_fu_1903_p3; sc_signal< sc_lv<5> > trunc_ln746_52_fu_1925_p1; sc_signal< sc_lv<3> > p_Result_4_21_fu_1945_p4; sc_signal< sc_lv<1> > tmp_27_fu_1937_p3; sc_signal< sc_lv<1> > icmp_ln785_22_fu_1955_p2; sc_signal< sc_lv<1> > or_ln785_22_fu_1961_p2; sc_signal< sc_lv<7> > trunc_ln746_21_fu_1929_p3; sc_signal< sc_lv<1> > icmp_ln1494_22_fu_1919_p2; sc_signal< sc_lv<7> > select_ln785_25_fu_1967_p3; sc_signal< sc_lv<5> > trunc_ln746_53_fu_1989_p1; sc_signal< sc_lv<3> > p_Result_4_22_fu_2009_p4; sc_signal< sc_lv<1> > tmp_28_fu_2001_p3; sc_signal< sc_lv<1> > icmp_ln785_23_fu_2019_p2; sc_signal< sc_lv<1> > or_ln785_23_fu_2025_p2; sc_signal< sc_lv<7> > trunc_ln746_22_fu_1993_p3; sc_signal< sc_lv<1> > icmp_ln1494_23_fu_1983_p2; sc_signal< sc_lv<7> > select_ln785_26_fu_2031_p3; sc_signal< sc_lv<5> > trunc_ln746_54_fu_2053_p1; sc_signal< sc_lv<3> > p_Result_4_23_fu_2073_p4; sc_signal< sc_lv<1> > tmp_29_fu_2065_p3; sc_signal< sc_lv<1> > icmp_ln785_24_fu_2083_p2; sc_signal< sc_lv<1> > or_ln785_24_fu_2089_p2; sc_signal< sc_lv<7> > trunc_ln746_23_fu_2057_p3; sc_signal< sc_lv<1> > icmp_ln1494_24_fu_2047_p2; sc_signal< sc_lv<7> > select_ln785_27_fu_2095_p3; sc_signal< sc_lv<5> > trunc_ln746_55_fu_2117_p1; sc_signal< sc_lv<3> > p_Result_4_24_fu_2137_p4; sc_signal< sc_lv<1> > tmp_30_fu_2129_p3; sc_signal< sc_lv<1> > icmp_ln785_25_fu_2147_p2; sc_signal< sc_lv<1> > or_ln785_25_fu_2153_p2; sc_signal< sc_lv<7> > trunc_ln746_24_fu_2121_p3; sc_signal< sc_lv<1> > icmp_ln1494_25_fu_2111_p2; sc_signal< sc_lv<7> > select_ln785_28_fu_2159_p3; sc_signal< sc_lv<5> > trunc_ln746_56_fu_2181_p1; sc_signal< sc_lv<3> > p_Result_4_25_fu_2201_p4; sc_signal< sc_lv<1> > tmp_31_fu_2193_p3; sc_signal< sc_lv<1> > icmp_ln785_26_fu_2211_p2; sc_signal< sc_lv<1> > or_ln785_26_fu_2217_p2; sc_signal< sc_lv<7> > trunc_ln746_25_fu_2185_p3; sc_signal< sc_lv<1> > icmp_ln1494_26_fu_2175_p2; sc_signal< sc_lv<7> > select_ln785_29_fu_2223_p3; sc_signal< sc_lv<5> > trunc_ln746_57_fu_2245_p1; sc_signal< sc_lv<3> > p_Result_4_26_fu_2265_p4; sc_signal< sc_lv<1> > tmp_32_fu_2257_p3; sc_signal< sc_lv<1> > icmp_ln785_27_fu_2275_p2; sc_signal< sc_lv<1> > or_ln785_27_fu_2281_p2; sc_signal< sc_lv<7> > trunc_ln746_26_fu_2249_p3; sc_signal< sc_lv<1> > icmp_ln1494_27_fu_2239_p2; sc_signal< sc_lv<7> > select_ln785_30_fu_2287_p3; sc_signal< sc_lv<5> > trunc_ln746_58_fu_2309_p1; sc_signal< sc_lv<3> > p_Result_4_27_fu_2329_p4; sc_signal< sc_lv<1> > tmp_33_fu_2321_p3; sc_signal< sc_lv<1> > icmp_ln785_28_fu_2339_p2; sc_signal< sc_lv<1> > or_ln785_28_fu_2345_p2; sc_signal< sc_lv<7> > trunc_ln746_27_fu_2313_p3; sc_signal< sc_lv<1> > icmp_ln1494_28_fu_2303_p2; sc_signal< sc_lv<7> > select_ln785_31_fu_2351_p3; sc_signal< sc_lv<5> > trunc_ln746_59_fu_2373_p1; sc_signal< sc_lv<3> > p_Result_4_28_fu_2393_p4; sc_signal< sc_lv<1> > tmp_34_fu_2385_p3; sc_signal< sc_lv<1> > icmp_ln785_29_fu_2403_p2; sc_signal< sc_lv<1> > or_ln785_29_fu_2409_p2; sc_signal< sc_lv<7> > trunc_ln746_28_fu_2377_p3; sc_signal< sc_lv<1> > icmp_ln1494_29_fu_2367_p2; sc_signal< sc_lv<7> > select_ln785_32_fu_2415_p3; sc_signal< sc_lv<5> > trunc_ln746_60_fu_2437_p1; sc_signal< sc_lv<3> > p_Result_4_29_fu_2457_p4; sc_signal< sc_lv<1> > tmp_35_fu_2449_p3; sc_signal< sc_lv<1> > icmp_ln785_30_fu_2467_p2; sc_signal< sc_lv<1> > or_ln785_30_fu_2473_p2; sc_signal< sc_lv<7> > trunc_ln746_29_fu_2441_p3; sc_signal< sc_lv<1> > icmp_ln1494_30_fu_2431_p2; sc_signal< sc_lv<7> > select_ln785_33_fu_2479_p3; sc_signal< sc_lv<5> > trunc_ln746_61_fu_2501_p1; sc_signal< sc_lv<3> > p_Result_4_30_fu_2521_p4; sc_signal< sc_lv<1> > tmp_36_fu_2513_p3; sc_signal< sc_lv<1> > icmp_ln785_31_fu_2531_p2; sc_signal< sc_lv<1> > or_ln785_31_fu_2537_p2; sc_signal< sc_lv<7> > trunc_ln746_30_fu_2505_p3; sc_signal< sc_lv<1> > icmp_ln1494_31_fu_2495_p2; sc_signal< sc_lv<7> > select_ln785_34_fu_2543_p3; sc_signal< sc_logic > ap_CS_fsm_state5; sc_signal< sc_lv<3> > ap_NS_fsm; sc_signal< sc_logic > ap_idle_pp0; sc_signal< sc_logic > ap_enable_pp0; static const sc_logic ap_const_logic_1; static const sc_logic ap_const_logic_0; static const sc_lv<3> ap_ST_fsm_state1; static const sc_lv<3> ap_ST_fsm_pp0_stage0; static const sc_lv<3> ap_ST_fsm_state5; static const bool ap_const_boolean_1; static const sc_lv<32> ap_const_lv32_0; static const sc_lv<32> ap_const_lv32_1; static const bool ap_const_boolean_0; static const sc_lv<1> ap_const_lv1_0; static const sc_lv<1> ap_const_lv1_1; static const sc_lv<11> ap_const_lv11_0; static const sc_lv<11> ap_const_lv11_400; static const sc_lv<11> ap_const_lv11_1; static const sc_lv<9> ap_const_lv9_0; static const sc_lv<2> ap_const_lv2_0; static const sc_lv<32> ap_const_lv32_5; static const sc_lv<32> ap_const_lv32_6; static const sc_lv<32> ap_const_lv32_8; static const sc_lv<3> ap_const_lv3_0; static const sc_lv<7> ap_const_lv7_7F; static const sc_lv<7> ap_const_lv7_0; static const sc_lv<32> ap_const_lv32_2; // Thread declarations void thread_ap_clk_no_reset_(); void thread_ap_CS_fsm_pp0_stage0(); void thread_ap_CS_fsm_state1(); void thread_ap_CS_fsm_state5(); void thread_ap_block_pp0_stage0(); void thread_ap_block_pp0_stage0_01001(); void thread_ap_block_pp0_stage0_11001(); void thread_ap_block_pp0_stage0_subdone(); void thread_ap_block_state1(); void thread_ap_block_state2_pp0_stage0_iter0(); void thread_ap_block_state3_pp0_stage0_iter1(); void thread_ap_block_state4_pp0_stage0_iter2(); void thread_ap_condition_pp0_exit_iter0_state2(); void thread_ap_done(); void thread_ap_enable_pp0(); void thread_ap_idle(); void thread_ap_idle_pp0(); void thread_ap_ready(); void thread_data_V_data_0_V_blk_n(); void thread_data_V_data_0_V_read(); void thread_data_V_data_10_V_blk_n(); void thread_data_V_data_10_V_read(); void thread_data_V_data_11_V_blk_n(); void thread_data_V_data_11_V_read(); void thread_data_V_data_12_V_blk_n(); void thread_data_V_data_12_V_read(); void thread_data_V_data_13_V_blk_n(); void thread_data_V_data_13_V_read(); void thread_data_V_data_14_V_blk_n(); void thread_data_V_data_14_V_read(); void thread_data_V_data_15_V_blk_n(); void thread_data_V_data_15_V_read(); void thread_data_V_data_16_V_blk_n(); void thread_data_V_data_16_V_read(); void thread_data_V_data_17_V_blk_n(); void thread_data_V_data_17_V_read(); void thread_data_V_data_18_V_blk_n(); void thread_data_V_data_18_V_read(); void thread_data_V_data_19_V_blk_n(); void thread_data_V_data_19_V_read(); void thread_data_V_data_1_V_blk_n(); void thread_data_V_data_1_V_read(); void thread_data_V_data_20_V_blk_n(); void thread_data_V_data_20_V_read(); void thread_data_V_data_21_V_blk_n(); void thread_data_V_data_21_V_read(); void thread_data_V_data_22_V_blk_n(); void thread_data_V_data_22_V_read(); void thread_data_V_data_23_V_blk_n(); void thread_data_V_data_23_V_read(); void thread_data_V_data_24_V_blk_n(); void thread_data_V_data_24_V_read(); void thread_data_V_data_25_V_blk_n(); void thread_data_V_data_25_V_read(); void thread_data_V_data_26_V_blk_n(); void thread_data_V_data_26_V_read(); void thread_data_V_data_27_V_blk_n(); void thread_data_V_data_27_V_read(); void thread_data_V_data_28_V_blk_n(); void thread_data_V_data_28_V_read(); void thread_data_V_data_29_V_blk_n(); void thread_data_V_data_29_V_read(); void thread_data_V_data_2_V_blk_n(); void thread_data_V_data_2_V_read(); void thread_data_V_data_30_V_blk_n(); void thread_data_V_data_30_V_read(); void thread_data_V_data_31_V_blk_n(); void thread_data_V_data_31_V_read(); void thread_data_V_data_3_V_blk_n(); void thread_data_V_data_3_V_read(); void thread_data_V_data_4_V_blk_n(); void thread_data_V_data_4_V_read(); void thread_data_V_data_5_V_blk_n(); void thread_data_V_data_5_V_read(); void thread_data_V_data_6_V_blk_n(); void thread_data_V_data_6_V_read(); void thread_data_V_data_7_V_blk_n(); void thread_data_V_data_7_V_read(); void thread_data_V_data_8_V_blk_n(); void thread_data_V_data_8_V_read(); void thread_data_V_data_9_V_blk_n(); void thread_data_V_data_9_V_read(); void thread_i_fu_377_p2(); void thread_icmp_ln1494_10_fu_1151_p2(); void thread_icmp_ln1494_11_fu_1215_p2(); void thread_icmp_ln1494_12_fu_1279_p2(); void thread_icmp_ln1494_13_fu_1343_p2(); void thread_icmp_ln1494_14_fu_1407_p2(); void thread_icmp_ln1494_15_fu_1471_p2(); void thread_icmp_ln1494_16_fu_1535_p2(); void thread_icmp_ln1494_17_fu_1599_p2(); void thread_icmp_ln1494_18_fu_1663_p2(); void thread_icmp_ln1494_19_fu_1727_p2(); void thread_icmp_ln1494_1_fu_575_p2(); void thread_icmp_ln1494_20_fu_1791_p2(); void thread_icmp_ln1494_21_fu_1855_p2(); void thread_icmp_ln1494_22_fu_1919_p2(); void thread_icmp_ln1494_23_fu_1983_p2(); void thread_icmp_ln1494_24_fu_2047_p2(); void thread_icmp_ln1494_25_fu_2111_p2(); void thread_icmp_ln1494_26_fu_2175_p2(); void thread_icmp_ln1494_27_fu_2239_p2(); void thread_icmp_ln1494_28_fu_2303_p2(); void thread_icmp_ln1494_29_fu_2367_p2(); void thread_icmp_ln1494_2_fu_639_p2(); void thread_icmp_ln1494_30_fu_2431_p2(); void thread_icmp_ln1494_31_fu_2495_p2(); void thread_icmp_ln1494_3_fu_703_p2(); void thread_icmp_ln1494_4_fu_767_p2(); void thread_icmp_ln1494_5_fu_831_p2(); void thread_icmp_ln1494_6_fu_895_p2(); void thread_icmp_ln1494_7_fu_959_p2(); void thread_icmp_ln1494_8_fu_1023_p2(); void thread_icmp_ln1494_9_fu_1087_p2(); void thread_icmp_ln1494_fu_511_p2(); void thread_icmp_ln60_fu_371_p2(); void thread_icmp_ln785_10_fu_1187_p2(); void thread_icmp_ln785_11_fu_1251_p2(); void thread_icmp_ln785_12_fu_1315_p2(); void thread_icmp_ln785_13_fu_1379_p2(); void thread_icmp_ln785_14_fu_1443_p2(); void thread_icmp_ln785_15_fu_1507_p2(); void thread_icmp_ln785_16_fu_1571_p2(); void thread_icmp_ln785_17_fu_1635_p2(); void thread_icmp_ln785_18_fu_1699_p2(); void thread_icmp_ln785_19_fu_1763_p2(); void thread_icmp_ln785_1_fu_611_p2(); void thread_icmp_ln785_20_fu_1827_p2(); void thread_icmp_ln785_21_fu_1891_p2(); void thread_icmp_ln785_22_fu_1955_p2(); void thread_icmp_ln785_23_fu_2019_p2(); void thread_icmp_ln785_24_fu_2083_p2(); void thread_icmp_ln785_25_fu_2147_p2(); void thread_icmp_ln785_26_fu_2211_p2(); void thread_icmp_ln785_27_fu_2275_p2(); void thread_icmp_ln785_28_fu_2339_p2(); void thread_icmp_ln785_29_fu_2403_p2(); void thread_icmp_ln785_2_fu_675_p2(); void thread_icmp_ln785_30_fu_2467_p2(); void thread_icmp_ln785_31_fu_2531_p2(); void thread_icmp_ln785_3_fu_739_p2(); void thread_icmp_ln785_4_fu_803_p2(); void thread_icmp_ln785_5_fu_867_p2(); void thread_icmp_ln785_6_fu_931_p2(); void thread_icmp_ln785_7_fu_995_p2(); void thread_icmp_ln785_8_fu_1059_p2(); void thread_icmp_ln785_9_fu_1123_p2(); void thread_icmp_ln785_fu_547_p2(); void thread_internal_ap_ready(); void thread_io_acc_block_signal_op432(); void thread_io_acc_block_signal_op76(); void thread_or_ln785_10_fu_1193_p2(); void thread_or_ln785_11_fu_1257_p2(); void thread_or_ln785_12_fu_1321_p2(); void thread_or_ln785_13_fu_1385_p2(); void thread_or_ln785_14_fu_1449_p2(); void thread_or_ln785_15_fu_1513_p2(); void thread_or_ln785_16_fu_1577_p2(); void thread_or_ln785_17_fu_1641_p2(); void thread_or_ln785_18_fu_1705_p2(); void thread_or_ln785_19_fu_1769_p2(); void thread_or_ln785_1_fu_617_p2(); void thread_or_ln785_20_fu_1833_p2(); void thread_or_ln785_21_fu_1897_p2(); void thread_or_ln785_22_fu_1961_p2(); void thread_or_ln785_23_fu_2025_p2(); void thread_or_ln785_24_fu_2089_p2(); void thread_or_ln785_25_fu_2153_p2(); void thread_or_ln785_26_fu_2217_p2(); void thread_or_ln785_27_fu_2281_p2(); void thread_or_ln785_28_fu_2345_p2(); void thread_or_ln785_29_fu_2409_p2(); void thread_or_ln785_2_fu_681_p2(); void thread_or_ln785_30_fu_2473_p2(); void thread_or_ln785_31_fu_2537_p2(); void thread_or_ln785_3_fu_745_p2(); void thread_or_ln785_4_fu_809_p2(); void thread_or_ln785_5_fu_873_p2(); void thread_or_ln785_6_fu_937_p2(); void thread_or_ln785_7_fu_1001_p2(); void thread_or_ln785_8_fu_1065_p2(); void thread_or_ln785_9_fu_1129_p2(); void thread_or_ln785_fu_553_p2(); void thread_p_Result_4_10_fu_1241_p4(); void thread_p_Result_4_11_fu_1305_p4(); void thread_p_Result_4_12_fu_1369_p4(); void thread_p_Result_4_13_fu_1433_p4(); void thread_p_Result_4_14_fu_1497_p4(); void thread_p_Result_4_15_fu_1561_p4(); void thread_p_Result_4_16_fu_1625_p4(); void thread_p_Result_4_17_fu_1689_p4(); void thread_p_Result_4_18_fu_1753_p4(); void thread_p_Result_4_19_fu_1817_p4(); void thread_p_Result_4_1_fu_601_p4(); void thread_p_Result_4_20_fu_1881_p4(); void thread_p_Result_4_21_fu_1945_p4(); void thread_p_Result_4_22_fu_2009_p4(); void thread_p_Result_4_23_fu_2073_p4(); void thread_p_Result_4_24_fu_2137_p4(); void thread_p_Result_4_25_fu_2201_p4(); void thread_p_Result_4_26_fu_2265_p4(); void thread_p_Result_4_27_fu_2329_p4(); void thread_p_Result_4_28_fu_2393_p4(); void thread_p_Result_4_29_fu_2457_p4(); void thread_p_Result_4_2_fu_665_p4(); void thread_p_Result_4_30_fu_2521_p4(); void thread_p_Result_4_3_fu_729_p4(); void thread_p_Result_4_4_fu_793_p4(); void thread_p_Result_4_5_fu_857_p4(); void thread_p_Result_4_6_fu_921_p4(); void thread_p_Result_4_7_fu_985_p4(); void thread_p_Result_4_8_fu_1049_p4(); void thread_p_Result_4_9_fu_1113_p4(); void thread_p_Result_4_fu_537_p4(); void thread_p_Result_4_s_fu_1177_p4(); void thread_real_start(); void thread_res_V_data_0_V_blk_n(); void thread_res_V_data_0_V_din(); void thread_res_V_data_0_V_write(); void thread_res_V_data_10_V_blk_n(); void thread_res_V_data_10_V_din(); void thread_res_V_data_10_V_write(); void thread_res_V_data_11_V_blk_n(); void thread_res_V_data_11_V_din(); void thread_res_V_data_11_V_write(); void thread_res_V_data_12_V_blk_n(); void thread_res_V_data_12_V_din(); void thread_res_V_data_12_V_write(); void thread_res_V_data_13_V_blk_n(); void thread_res_V_data_13_V_din(); void thread_res_V_data_13_V_write(); void thread_res_V_data_14_V_blk_n(); void thread_res_V_data_14_V_din(); void thread_res_V_data_14_V_write(); void thread_res_V_data_15_V_blk_n(); void thread_res_V_data_15_V_din(); void thread_res_V_data_15_V_write(); void thread_res_V_data_16_V_blk_n(); void thread_res_V_data_16_V_din(); void thread_res_V_data_16_V_write(); void thread_res_V_data_17_V_blk_n(); void thread_res_V_data_17_V_din(); void thread_res_V_data_17_V_write(); void thread_res_V_data_18_V_blk_n(); void thread_res_V_data_18_V_din(); void thread_res_V_data_18_V_write(); void thread_res_V_data_19_V_blk_n(); void thread_res_V_data_19_V_din(); void thread_res_V_data_19_V_write(); void thread_res_V_data_1_V_blk_n(); void thread_res_V_data_1_V_din(); void thread_res_V_data_1_V_write(); void thread_res_V_data_20_V_blk_n(); void thread_res_V_data_20_V_din(); void thread_res_V_data_20_V_write(); void thread_res_V_data_21_V_blk_n(); void thread_res_V_data_21_V_din(); void thread_res_V_data_21_V_write(); void thread_res_V_data_22_V_blk_n(); void thread_res_V_data_22_V_din(); void thread_res_V_data_22_V_write(); void thread_res_V_data_23_V_blk_n(); void thread_res_V_data_23_V_din(); void thread_res_V_data_23_V_write(); void thread_res_V_data_24_V_blk_n(); void thread_res_V_data_24_V_din(); void thread_res_V_data_24_V_write(); void thread_res_V_data_25_V_blk_n(); void thread_res_V_data_25_V_din(); void thread_res_V_data_25_V_write(); void thread_res_V_data_26_V_blk_n(); void thread_res_V_data_26_V_din(); void thread_res_V_data_26_V_write(); void thread_res_V_data_27_V_blk_n(); void thread_res_V_data_27_V_din(); void thread_res_V_data_27_V_write(); void thread_res_V_data_28_V_blk_n(); void thread_res_V_data_28_V_din(); void thread_res_V_data_28_V_write(); void thread_res_V_data_29_V_blk_n(); void thread_res_V_data_29_V_din(); void thread_res_V_data_29_V_write(); void thread_res_V_data_2_V_blk_n(); void thread_res_V_data_2_V_din(); void thread_res_V_data_2_V_write(); void thread_res_V_data_30_V_blk_n(); void thread_res_V_data_30_V_din(); void thread_res_V_data_30_V_write(); void thread_res_V_data_31_V_blk_n(); void thread_res_V_data_31_V_din(); void thread_res_V_data_31_V_write(); void thread_res_V_data_3_V_blk_n(); void thread_res_V_data_3_V_din(); void thread_res_V_data_3_V_write(); void thread_res_V_data_4_V_blk_n(); void thread_res_V_data_4_V_din(); void thread_res_V_data_4_V_write(); void thread_res_V_data_5_V_blk_n(); void thread_res_V_data_5_V_din(); void thread_res_V_data_5_V_write(); void thread_res_V_data_6_V_blk_n(); void thread_res_V_data_6_V_din(); void thread_res_V_data_6_V_write(); void thread_res_V_data_7_V_blk_n(); void thread_res_V_data_7_V_din(); void thread_res_V_data_7_V_write(); void thread_res_V_data_8_V_blk_n(); void thread_res_V_data_8_V_din(); void thread_res_V_data_8_V_write(); void thread_res_V_data_9_V_blk_n(); void thread_res_V_data_9_V_din(); void thread_res_V_data_9_V_write(); void thread_select_ln785_10_fu_1007_p3(); void thread_select_ln785_11_fu_1071_p3(); void thread_select_ln785_12_fu_1135_p3(); void thread_select_ln785_13_fu_1199_p3(); void thread_select_ln785_14_fu_1263_p3(); void thread_select_ln785_15_fu_1327_p3(); void thread_select_ln785_16_fu_1391_p3(); void thread_select_ln785_17_fu_1455_p3(); void thread_select_ln785_18_fu_1519_p3(); void thread_select_ln785_19_fu_1583_p3(); void thread_select_ln785_20_fu_1647_p3(); void thread_select_ln785_21_fu_1711_p3(); void thread_select_ln785_22_fu_1775_p3(); void thread_select_ln785_23_fu_1839_p3(); void thread_select_ln785_24_fu_1903_p3(); void thread_select_ln785_25_fu_1967_p3(); void thread_select_ln785_26_fu_2031_p3(); void thread_select_ln785_27_fu_2095_p3(); void thread_select_ln785_28_fu_2159_p3(); void thread_select_ln785_29_fu_2223_p3(); void thread_select_ln785_30_fu_2287_p3(); void thread_select_ln785_31_fu_2351_p3(); void thread_select_ln785_32_fu_2415_p3(); void thread_select_ln785_33_fu_2479_p3(); void thread_select_ln785_34_fu_2543_p3(); void thread_select_ln785_4_fu_623_p3(); void thread_select_ln785_5_fu_687_p3(); void thread_select_ln785_6_fu_751_p3(); void thread_select_ln785_7_fu_815_p3(); void thread_select_ln785_8_fu_879_p3(); void thread_select_ln785_9_fu_943_p3(); void thread_select_ln785_fu_559_p3(); void thread_start_out(); void thread_start_write(); void thread_tmp_10_fu_849_p3(); void thread_tmp_11_fu_913_p3(); void thread_tmp_12_fu_977_p3(); void thread_tmp_13_fu_1041_p3(); void thread_tmp_14_fu_1105_p3(); void thread_tmp_15_fu_1169_p3(); void thread_tmp_16_fu_1233_p3(); void thread_tmp_17_fu_1297_p3(); void thread_tmp_18_fu_1361_p3(); void thread_tmp_19_fu_1425_p3(); void thread_tmp_20_fu_1489_p3(); void thread_tmp_21_fu_1553_p3(); void thread_tmp_22_fu_1617_p3(); void thread_tmp_23_fu_1681_p3(); void thread_tmp_24_fu_1745_p3(); void thread_tmp_25_fu_1809_p3(); void thread_tmp_26_fu_1873_p3(); void thread_tmp_27_fu_1937_p3(); void thread_tmp_28_fu_2001_p3(); void thread_tmp_29_fu_2065_p3(); void thread_tmp_30_fu_2129_p3(); void thread_tmp_31_fu_2193_p3(); void thread_tmp_32_fu_2257_p3(); void thread_tmp_33_fu_2321_p3(); void thread_tmp_34_fu_2385_p3(); void thread_tmp_35_fu_2449_p3(); void thread_tmp_36_fu_2513_p3(); void thread_tmp_5_fu_529_p3(); void thread_tmp_6_fu_593_p3(); void thread_tmp_7_fu_657_p3(); void thread_tmp_8_fu_721_p3(); void thread_tmp_9_fu_785_p3(); void thread_tmp_data_0_V_fu_567_p3(); void thread_tmp_data_10_V_fu_1207_p3(); void thread_tmp_data_11_V_fu_1271_p3(); void thread_tmp_data_12_V_fu_1335_p3(); void thread_tmp_data_13_V_fu_1399_p3(); void thread_tmp_data_14_V_fu_1463_p3(); void thread_tmp_data_15_V_fu_1527_p3(); void thread_tmp_data_16_V_fu_1591_p3(); void thread_tmp_data_17_V_fu_1655_p3(); void thread_tmp_data_18_V_fu_1719_p3(); void thread_tmp_data_19_V_fu_1783_p3(); void thread_tmp_data_1_V_fu_631_p3(); void thread_tmp_data_20_V_fu_1847_p3(); void thread_tmp_data_21_V_fu_1911_p3(); void thread_tmp_data_22_V_fu_1975_p3(); void thread_tmp_data_23_V_fu_2039_p3(); void thread_tmp_data_24_V_fu_2103_p3(); void thread_tmp_data_25_V_fu_2167_p3(); void thread_tmp_data_26_V_fu_2231_p3(); void thread_tmp_data_27_V_fu_2295_p3(); void thread_tmp_data_28_V_fu_2359_p3(); void thread_tmp_data_29_V_fu_2423_p3(); void thread_tmp_data_2_V_fu_695_p3(); void thread_tmp_data_30_V_fu_2487_p3(); void thread_tmp_data_31_V_fu_2551_p3(); void thread_tmp_data_3_V_fu_759_p3(); void thread_tmp_data_4_V_fu_823_p3(); void thread_tmp_data_5_V_fu_887_p3(); void thread_tmp_data_6_V_fu_951_p3(); void thread_tmp_data_7_V_fu_1015_p3(); void thread_tmp_data_8_V_fu_1079_p3(); void thread_tmp_data_9_V_fu_1143_p3(); void thread_trunc_ln746_10_fu_1225_p3(); void thread_trunc_ln746_11_fu_1289_p3(); void thread_trunc_ln746_12_fu_1353_p3(); void thread_trunc_ln746_13_fu_1417_p3(); void thread_trunc_ln746_14_fu_1481_p3(); void thread_trunc_ln746_15_fu_1545_p3(); void thread_trunc_ln746_16_fu_1609_p3(); void thread_trunc_ln746_17_fu_1673_p3(); void thread_trunc_ln746_18_fu_1737_p3(); void thread_trunc_ln746_19_fu_1801_p3(); void thread_trunc_ln746_1_fu_1033_p3(); void thread_trunc_ln746_20_fu_1865_p3(); void thread_trunc_ln746_21_fu_1929_p3(); void thread_trunc_ln746_22_fu_1993_p3(); void thread_trunc_ln746_23_fu_2057_p3(); void thread_trunc_ln746_24_fu_2121_p3(); void thread_trunc_ln746_25_fu_2185_p3(); void thread_trunc_ln746_26_fu_2249_p3(); void thread_trunc_ln746_27_fu_2313_p3(); void thread_trunc_ln746_28_fu_2377_p3(); void thread_trunc_ln746_29_fu_2441_p3(); void thread_trunc_ln746_2_fu_1097_p3(); void thread_trunc_ln746_30_fu_2505_p3(); void thread_trunc_ln746_31_fu_581_p1(); void thread_trunc_ln746_32_fu_645_p1(); void thread_trunc_ln746_33_fu_709_p1(); void thread_trunc_ln746_34_fu_773_p1(); void thread_trunc_ln746_35_fu_837_p1(); void thread_trunc_ln746_36_fu_901_p1(); void thread_trunc_ln746_37_fu_965_p1(); void thread_trunc_ln746_38_fu_1029_p1(); void thread_trunc_ln746_39_fu_1093_p1(); void thread_trunc_ln746_3_fu_1161_p3(); void thread_trunc_ln746_40_fu_1157_p1(); void thread_trunc_ln746_41_fu_1221_p1(); void thread_trunc_ln746_42_fu_1285_p1(); void thread_trunc_ln746_43_fu_1349_p1(); void thread_trunc_ln746_44_fu_1413_p1(); void thread_trunc_ln746_45_fu_1477_p1(); void thread_trunc_ln746_46_fu_1541_p1(); void thread_trunc_ln746_47_fu_1605_p1(); void thread_trunc_ln746_48_fu_1669_p1(); void thread_trunc_ln746_49_fu_1733_p1(); void thread_trunc_ln746_4_fu_585_p3(); void thread_trunc_ln746_50_fu_1797_p1(); void thread_trunc_ln746_51_fu_1861_p1(); void thread_trunc_ln746_52_fu_1925_p1(); void thread_trunc_ln746_53_fu_1989_p1(); void thread_trunc_ln746_54_fu_2053_p1(); void thread_trunc_ln746_55_fu_2117_p1(); void thread_trunc_ln746_56_fu_2181_p1(); void thread_trunc_ln746_57_fu_2245_p1(); void thread_trunc_ln746_58_fu_2309_p1(); void thread_trunc_ln746_59_fu_2373_p1(); void thread_trunc_ln746_5_fu_649_p3(); void thread_trunc_ln746_60_fu_2437_p1(); void thread_trunc_ln746_61_fu_2501_p1(); void thread_trunc_ln746_6_fu_713_p3(); void thread_trunc_ln746_7_fu_777_p3(); void thread_trunc_ln746_8_fu_841_p3(); void thread_trunc_ln746_9_fu_905_p3(); void thread_trunc_ln746_fu_517_p1(); void thread_trunc_ln746_s_fu_969_p3(); void thread_trunc_ln_fu_521_p3(); void thread_ap_NS_fsm(); }; } using namespace ap_rtl; #endif
44.900956
80
0.760647
f58b3b8131a9e68c94c00976f762a28b17ba6049
643
h
C
inetsrv/iis/svcs/cmp/aspcmp/shared/inc/sinstrm.h
npocmaka/Windows-Server-2003
5c6fe3db626b63a384230a1aa6b92ac416b0765f
[ "Unlicense" ]
17
2020-11-13T13:42:52.000Z
2021-09-16T09:13:13.000Z
inetsrv/iis/svcs/cmp/aspcmp/shared/inc/sinstrm.h
sancho1952007/Windows-Server-2003
5c6fe3db626b63a384230a1aa6b92ac416b0765f
[ "Unlicense" ]
2
2020-10-19T08:02:06.000Z
2020-10-19T08:23:18.000Z
inetsrv/iis/svcs/cmp/aspcmp/shared/inc/sinstrm.h
sancho1952007/Windows-Server-2003
5c6fe3db626b63a384230a1aa6b92ac416b0765f
[ "Unlicense" ]
14
2020-11-14T09:43:20.000Z
2021-08-28T08:59:57.000Z
/*++ Copyright (c) 1997 Microsoft Corporation Module Name : SInStrm.h Abstract: A lightweight implementation of input streams using strings Author: Neil Allain ( a-neilal ) August-1997 Revision History: --*/ #pragma once #include "InStrm.h" class StringInStream : public InStream, public BaseStringBuffer { public: StringInStream( const String& ); virtual HRESULT readChar( _TCHAR& ); virtual HRESULT read( CharCheck&, String& ); virtual HRESULT skip( CharCheck& ); virtual HRESULT back( size_t ); private: LPTSTR m_pos; LPTSTR m_end; };
18.371429
64
0.639191
dc8988184077ca326c0ed3dd2f4ca30ebd00d978
826
h
C
src/common/data_structures/static_list.h
jgesc/p2p_distributed_file_system
f12f0f7b2dde7d48e81b3bddb18807f9c0288846
[ "MIT" ]
3
2021-03-08T12:54:39.000Z
2022-02-19T07:33:28.000Z
src/common/data_structures/static_list.h
jgesc/p2p_distributed_file_system
f12f0f7b2dde7d48e81b3bddb18807f9c0288846
[ "MIT" ]
null
null
null
src/common/data_structures/static_list.h
jgesc/p2p_distributed_file_system
f12f0f7b2dde7d48e81b3bddb18807f9c0288846
[ "MIT" ]
null
null
null
/** static_list.h * List data structure in static memory */ #ifndef __STATIC_LIST_H__ #define __STATIC_LIST_H__ /// Includes #include <string.h> #include <stdint.h> #include <stdlib.h> /// Structures // Static memory list struct struct stlist { uint32_t max; // Max slots uint32_t len; // Used slots size_t elsize; // Element size uint8_t data[]; }; /// Operations // Creates a new list struct stlist * stl_new(uint32_t max, size_t elsize); // Adds an element to the list int stl_add(struct stlist * l, void * d); // Checks if an element is in the list int stl_contains(struct stlist * l, void * ele, int (*cmpfun)(void*, void*)); // Removes an element from the list void stl_remove(struct stlist * l, uint32_t idx); // Gets an element from the list void * stl_get(struct stlist * l, uint32_t n); #endif
19.666667
77
0.702179
67081af987d81b886273926bac21876163d62d27
613
h
C
include/quince/exprn_mappers/detail/coalesce.h
necrosisbb/quince
00737fffcd0b5ad907d89c2613993d4929947a03
[ "BSL-1.0" ]
27
2015-01-20T02:21:38.000Z
2021-12-09T11:57:32.000Z
include/quince/exprn_mappers/detail/coalesce.h
necrosisbb/quince
00737fffcd0b5ad907d89c2613993d4929947a03
[ "BSL-1.0" ]
9
2015-05-12T14:51:10.000Z
2017-10-21T16:42:18.000Z
include/quince/exprn_mappers/detail/coalesce.h
necrosisbb/quince
00737fffcd0b5ad907d89c2613993d4929947a03
[ "BSL-1.0" ]
15
2015-06-23T11:31:09.000Z
2021-10-01T06:08:55.000Z
#ifndef QUINCE__exprn_mappers__detail__coalesce_h #define QUINCE__exprn_mappers__detail__coalesce_h // Copyright Michael Shepanski 2014. // Distributed under the Boost Software License, Version 1.0. // (See accompanying file ../../../../LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) #include <quince/exprn_mappers/function.h> namespace quince { template<typename Return, typename Fallback> exprn_mapper<Return> coalesce(const abstract_mapper<Return> &preferred, const Fallback &fallback) { return function<Return>("COALESCE", preferred, fallback); } } #endif
26.652174
78
0.752039
56630d87403581bea931b45b27959842ec1ab5eb
732
h
C
src/Arbiter.h
CarlosPena00/VSS-Simulator
25ee8a36c77d44c5ff92afddda355115a9244f90
[ "MIT" ]
null
null
null
src/Arbiter.h
CarlosPena00/VSS-Simulator
25ee8a36c77d44c5ff92afddda355115a9244f90
[ "MIT" ]
null
null
null
src/Arbiter.h
CarlosPena00/VSS-Simulator
25ee8a36c77d44c5ff92afddda355115a9244f90
[ "MIT" ]
1
2018-09-05T20:29:07.000Z
2018-09-05T20:29:07.000Z
#ifndef _ARBITER_H_ #define _ARBITER_H_ #include "iostream" #include "VSS-Interface/cpp/interface.h" #include "Sir.h" #include "Physics.h" using namespace std; //! Classe responsável por verificar ocorrencias como: gol, penalti e falta. Também é responsável por monitorar o tempo e reposicionar os objetos em campo. class Arbiter{ protected: Physics *physics; Report *report; btVector3 history_ball; int ball_count; int minutes; public: bool refresh; Arbiter(); void allocPhysics(Physics*); void allocReport(Report*); int checkWorld(); int getSteps(); int checkTimeMin(); unsigned int checkTimeMs(); void position_objects_after_goal_team_1(); void position_objects_after_goal_team_2(); }; #endif // _ARBITER_H_
20.914286
155
0.766393
4c3d734977a2acea241e5318cbf6269a036c14f9
4,991
h
C
native/standalone/stdatomic.h
minad/crts
0986b9f8b9375bd12bbf11de80fc52fdba80f5d4
[ "Apache-2.0" ]
1
2019-04-15T22:45:48.000Z
2019-04-15T22:45:48.000Z
native/standalone/stdatomic.h
minad/crts
0986b9f8b9375bd12bbf11de80fc52fdba80f5d4
[ "Apache-2.0" ]
null
null
null
native/standalone/stdatomic.h
minad/crts
0986b9f8b9375bd12bbf11de80fc52fdba80f5d4
[ "Apache-2.0" ]
null
null
null
#pragma once #include <stddef.h> typedef enum { memory_order_relaxed = __ATOMIC_RELAXED, memory_order_acquire = __ATOMIC_ACQUIRE, memory_order_release = __ATOMIC_RELEASE, memory_order_acq_rel = __ATOMIC_ACQ_REL, memory_order_seq_cst = __ATOMIC_SEQ_CST } memory_order; // TODO: Test standalone libc on multithreaded platforms #if 1 /* * "Atomics" for single threaded applications */ #define _atomic_nop(x) (false ? (void)(x) : ({})) #define atomic_exchange_explicit(p, v, m) \ ({ \ _atomic_nop(m); \ typeof(p) _p = (p); \ typeof(*_p) _v = (v), _o = *_p; \ *_p = _v, _o; \ }) #define atomic_store_explicit(p, v, m) ({ _atomic_nop(m); *(p) = (v); }) #define atomic_load_explicit(p, m) ({ _atomic_nop(m); *(p); }) #define atomic_compare_exchange_weak_explicit(p, v, d, s, f) \ atomic_compare_exchange_strong_explicit((p), (v), (d), (s), (f)) #define atomic_compare_exchange_strong_explicit(p, v, d, s, f) \ ({ \ _atomic_nop(s); _atomic_nop(f); \ typeof(p) _p = (p), _v = (v); \ typeof(*_p) _d = (d); \ *_p == *_v && (*_p = _d, 1); \ }) #define atomic_fetch_add_explicit(p, v, m) \ ({ \ _atomic_nop(m); \ typeof(p) _p = (p); \ typeof(*_p) _v = (v), _o = *_p; \ *_p += _v, _o; \ }) #define atomic_fetch_sub_explicit(p, v, m) \ ({ \ _atomic_nop(m); \ typeof(p) _p = (p); \ typeof(*_p) _v = (v), _o = *_p; \ *_p -= _v, _o; \ }) #else /* * Atomics for multi threaded applications */ #define atomic_store_explicit(p, v, m) \ ({ \ __auto_type _p = (p); \ typeof (*_p) _v = (v); \ memory_order _m = (m); \ __atomic_store(_p, &_v, (int)_m); \ }) #define atomic_load_explicit(p, m) \ ({ \ __auto_type _p = (p); \ typeof (*_p) _v; \ memory_order _m = (m); \ __atomic_load(_p, &_v, (int)_m); \ _v; \ }) #define atomic_compare_exchange_weak_explicit(p, v, d, s, f) \ ({ \ typeof(p) _p = (p), _v = (v); \ typeof (*_p) _d = (d); \ memory_order _s = (s), _f = (f); \ __atomic_compare_exchange(_p, _v, &_d, 1, (int)_s, (int)_f); \ }) #define atomic_compare_exchange_strong_explicit(p, v, d, s, f) \ ({ \ typeof(p) _p = (p), _v = (v); \ typeof (*_p) _d = (d); \ memory_order _s = (s), _f = (f); \ __atomic_compare_exchange(_p, _v, &_d, 0, (int)_s, (int)_f); \ }) #define atomic_fetch_add_explicit(p, v, m) \ ({ \ __auto_type _p = (p); \ typeof (*_p) _v = (v); \ memory_order _m = (m); \ __atomic_fetch_add(_p, _v, (int)_m); \ }) #define atomic_fetch_sub_explicit(p, v, m) \ ({ \ __auto_type _p = (p); \ typeof (*_p) _v = (v); \ memory_order _m = (m); \ __atomic_fetch_sub(_p, _v, (int)_m); \ }) #endif
47.084906
73
0.310559
bc709b40d0aa23f2bed99682cdd6de21d3416d8b
85
h
C
OctoMouse/AboutWindowController.h
goofmint/OctoMouse
616980f2806d2c9c5451140f688fdbde5192b520
[ "MIT" ]
151
2016-08-18T05:19:29.000Z
2022-03-10T11:29:19.000Z
OctoMouse/AboutWindowController.h
orangetangerine/OctoMouse
a370c305f35101358abc017f92bd77eb07a4d860
[ "MIT" ]
21
2016-08-22T06:58:15.000Z
2022-03-24T02:31:07.000Z
OctoMouse/AboutWindowController.h
orangetangerine/OctoMouse
a370c305f35101358abc017f92bd77eb07a4d860
[ "MIT" ]
22
2016-09-02T02:31:13.000Z
2021-09-21T10:14:57.000Z
#import <Cocoa/Cocoa.h> @interface AboutWindowController : NSWindowController @end
14.166667
53
0.8
295b21a00e8055d839ae9d6f1afb96108267ae74
4,588
c
C
yabause/src/debug.c
ircluzar/BizhawkLegacy-Vanguard
cd8b6dfe881f3c9d322b73c29f0d71df2ce3178e
[ "MIT" ]
null
null
null
yabause/src/debug.c
ircluzar/BizhawkLegacy-Vanguard
cd8b6dfe881f3c9d322b73c29f0d71df2ce3178e
[ "MIT" ]
null
null
null
yabause/src/debug.c
ircluzar/BizhawkLegacy-Vanguard
cd8b6dfe881f3c9d322b73c29f0d71df2ce3178e
[ "MIT" ]
null
null
null
/* Copyright 2005 Guillaume Duhamel Copyright 2006 Theo Berkau This file is part of Yabause. Yabause is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. Yabause is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with Yabause; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ #include "debug.h" #include <stdarg.h> #include <stdlib.h> #include <string.h> ////////////////////////////////////////////////////////////////////////////// Debug * DebugInit(const char * n, DebugOutType t, char * s) { Debug * d; if ((d = (Debug *) malloc(sizeof(Debug))) == NULL) return NULL; d->output_type = t; if ((d->name = strdup(n)) == NULL) { free(d); return NULL; } switch(t) { case DEBUG_STREAM: d->output.stream = fopen(s, "w"); break; case DEBUG_STRING: d->output.string = s; break; case DEBUG_STDOUT: d->output.stream = stdout; break; case DEBUG_STDERR: d->output.stream = stderr; break; case DEBUG_CALLBACK: d->output.callback = (void (*) (char*))s; break; } return d; } ////////////////////////////////////////////////////////////////////////////// void DebugDeInit(Debug * d) { if (d == NULL) return; switch(d->output_type) { case DEBUG_STREAM: if (d->output.stream) fclose(d->output.stream); break; case DEBUG_STRING: case DEBUG_STDOUT: case DEBUG_STDERR: case DEBUG_CALLBACK: break; } if (d->name) free(d->name); free(d); } ////////////////////////////////////////////////////////////////////////////// void DebugChangeOutput(Debug * d, DebugOutType t, char * s) { if (t != d->output_type) { if (d->output_type == DEBUG_STREAM) { if (d->output.stream) fclose(d->output.stream); } d->output_type = t; } switch(t) { case DEBUG_STREAM: d->output.stream = fopen(s, "w"); break; case DEBUG_STRING: d->output.string = s; break; case DEBUG_CALLBACK: d->output.callback = (void (*) (char*))s; break; case DEBUG_STDOUT: d->output.stream = stdout; break; case DEBUG_STDERR: d->output.stream = stderr; break; } } ////////////////////////////////////////////////////////////////////////////// void DebugPrintf(Debug * d, const char * file, u32 line, const char * format, ...) { va_list l; static char strtmp[512]; static int strhash; if (d == NULL) return; va_start(l, format); switch(d->output_type) { case DEBUG_STDOUT: case DEBUG_STDERR: case DEBUG_STREAM: if (d->output.stream == NULL) break; fprintf(d->output.stream, "%s (%s:%ld): ", d->name, file, (long)line); vfprintf(d->output.stream, format, l); break; case DEBUG_STRING: { int i; if (d->output.string == NULL) break; i = sprintf(d->output.string, "%s (%s:%ld): ", d->name, file, (long)line); vsprintf(d->output.string + i, format, l); } break; case DEBUG_CALLBACK: { int i; int strnewhash = 0; i = sprintf(strtmp, "%s (%s:%ld): ", d->name, file, (long)line); i += vsprintf(strtmp + i, format, l); for ( ; i>0 ; i-- ) strnewhash += (int)(strtmp[i]); if ( strnewhash != strhash ) d->output.callback( strtmp ); strhash = strnewhash; } break; } va_end(l); } ////////////////////////////////////////////////////////////////////////////// Debug * MainLog; ////////////////////////////////////////////////////////////////////////////// void LogStart(void) { MainLog = DebugInit("main", DEBUG_STDOUT, NULL); // MainLog = DebugInit("main", DEBUG_STREAM, "stdout.txt"); } ////////////////////////////////////////////////////////////////////////////// void LogStop(void) { DebugDeInit(MainLog); MainLog = NULL; } ////////////////////////////////////////////////////////////////////////////// void LogChangeOutput(DebugOutType t, char * s) { DebugChangeOutput( MainLog, t, s ); }
24.534759
84
0.515475
1af5b2195b07fba93a442b836b32ad40a56947a1
339
h
C
src/ui/about_window.h
alexandrvicente/talkie
df1c812c909d292d9acade7aafbc8e72f0a31ed7
[ "BSD-3-Clause" ]
10
2020-04-26T22:34:13.000Z
2021-07-14T21:12:40.000Z
src/ui/about_window.h
alexandrvicente/talkie
df1c812c909d292d9acade7aafbc8e72f0a31ed7
[ "BSD-3-Clause" ]
3
2020-06-08T22:54:38.000Z
2022-03-28T22:51:02.000Z
src/ui/about_window.h
alexandrvicente/talkie
df1c812c909d292d9acade7aafbc8e72f0a31ed7
[ "BSD-3-Clause" ]
2
2020-09-18T06:49:25.000Z
2021-10-19T21:26:06.000Z
#ifndef ABOUT_WINDOW_H #define ABOUT_WINDOW_H #include <QDialog> #include <QBitmap> #include <QPainter> namespace Ui { class AboutWindow; } class AboutWindow : public QDialog { Q_OBJECT public: explicit AboutWindow(QWidget *parent = nullptr); ~AboutWindow(); private: Ui::AboutWindow *ui; }; #endif // ABOUT_WINDOW_H
13.56
52
0.719764
2175300406e11eae30229b4fa4bb8a2a657ba47b
1,086
h
C
tests/gpu/src/TextureTest.h
Darlingnotin/Antisocial_VR
f1debafb784ed5a63a40fe9b80790fbaccfedfce
[ "Apache-2.0" ]
272
2021-01-07T03:06:08.000Z
2022-03-25T03:54:07.000Z
tests/gpu/src/TextureTest.h
Darlingnotin/Antisocial_VR
f1debafb784ed5a63a40fe9b80790fbaccfedfce
[ "Apache-2.0" ]
1,021
2020-12-12T02:33:32.000Z
2022-03-31T23:36:37.000Z
tests/gpu/src/TextureTest.h
Darlingnotin/Antisocial_VR
f1debafb784ed5a63a40fe9b80790fbaccfedfce
[ "Apache-2.0" ]
77
2020-12-15T06:59:34.000Z
2022-03-23T22:18:04.000Z
// // Created by Bradley Austin Davis on 2018/05/08 // Copyright 2013-2018 High Fidelity, Inc. // // Distributed under the Apache License, Version 2.0. // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html // #pragma once #include <QtTest/QtTest> #include <QtCore/QTemporaryDir> #include <gpu/Forward.h> #include <gl/OffscreenGLCanvas.h> class TextureTest : public QObject { Q_OBJECT private: void beginFrame(); void endFrame(); void renderFrame(const std::function<void(gpu::Batch&)>& = [](gpu::Batch&) {}); std::vector<gpu::TexturePointer> loadTestTextures() const; private slots: void initTestCase(); void cleanupTestCase(); void testTextureLoading(); private: QString _resourcesPath; OffscreenGLCanvas _canvas; gpu::ContextPointer _gpuContext; gpu::PipelinePointer _pipeline; gpu::FramebufferPointer _framebuffer; gpu::TexturePointer _colorBuffer, _depthBuffer; const glm::uvec2 _size{ 640, 480 }; std::vector<std::string> _textureFiles; size_t _frameCount { 0 }; };
24.681818
88
0.708103
517f2bd2ad1fa06dc9421af9b693735cfee1a6f8
286
h
C
src/pd/checkboxred.h
mtribiere/Pixel-dungeon-CPP
ed930aaeefd1f08eed73ced928acae6e1fe34fa4
[ "MIT" ]
null
null
null
src/pd/checkboxred.h
mtribiere/Pixel-dungeon-CPP
ed930aaeefd1f08eed73ced928acae6e1fe34fa4
[ "MIT" ]
null
null
null
src/pd/checkboxred.h
mtribiere/Pixel-dungeon-CPP
ed930aaeefd1f08eed73ced928acae6e1fe34fa4
[ "MIT" ]
null
null
null
#pragma once #include "redbutton.h" class CheckBoxRed :public RedButton{ private: bool checked; protected: virtual void layout(); virtual void onClick(); public: CheckBoxRed(const std::string& label); bool Checked() { return checked; } void Checked(bool value); };
19.066667
40
0.699301
4e8c06ab50d1faefe6ac99224481be92256a6896
460
h
C
src/zoneserver/controller/callback/GrowthCallback.h
mark-online/server
ca24898e2e5a9ccbaa11ef1ade57bb25260b717f
[ "MIT" ]
null
null
null
src/zoneserver/controller/callback/GrowthCallback.h
mark-online/server
ca24898e2e5a9ccbaa11ef1ade57bb25260b717f
[ "MIT" ]
null
null
null
src/zoneserver/controller/callback/GrowthCallback.h
mark-online/server
ca24898e2e5a9ccbaa11ef1ade57bb25260b717f
[ "MIT" ]
null
null
null
#pragma once #include <gideon/cs/shared/data/ObjectInfo.h> #include <gideon/cs/shared/data/LevelInfo.h> namespace gideon { namespace zoneserver { namespace gc { /** * @class GrowthCallback */ class GrowthCallback { public: virtual ~GrowthCallback() {} public: // 케릭터 레벨이 업됐다 virtual void playerLeveledUp(const GameObjectInfo& creatureInfo, bool isMajorLevelup) = 0; }; }}} // namespace gideon { namespace zoneserver { namespace gc {
20
68
0.71087
5e11f25c6c1a67a8ee108f4364aa96ef086f819d
53
h
C
src/Game/zPickupTable.h
stravant/bfbbdecomp
2126be355a6bb8171b850f829c1f2731c8b5de08
[ "OLDAP-2.7" ]
1
2021-01-05T11:28:55.000Z
2021-01-05T11:28:55.000Z
src/Game/zPickupTable.h
sonich2401/bfbbdecomp
5f58b62505f8929a72ccf2aa118a1539eb3a5bd6
[ "OLDAP-2.7" ]
null
null
null
src/Game/zPickupTable.h
sonich2401/bfbbdecomp
5f58b62505f8929a72ccf2aa118a1539eb3a5bd6
[ "OLDAP-2.7" ]
1
2022-03-30T15:15:08.000Z
2022-03-30T15:15:08.000Z
#ifndef ZPICKUPTABLE_H #define ZPICKUPTABLE_H #endif
13.25
22
0.849057
4502c8a0f7dec92296e945875f95806f1a378b5f
6,567
c
C
platform/os/ubuntu/kv.c
iot-middleware/link-alcs
3008b8705d8f8445bfab4b7508aebe74e838c92c
[ "Apache-2.0" ]
null
null
null
platform/os/ubuntu/kv.c
iot-middleware/link-alcs
3008b8705d8f8445bfab4b7508aebe74e838c92c
[ "Apache-2.0" ]
null
null
null
platform/os/ubuntu/kv.c
iot-middleware/link-alcs
3008b8705d8f8445bfab4b7508aebe74e838c92c
[ "Apache-2.0" ]
null
null
null
#include <stdio.h> #include <stdlib.h> #include <stdint.h> #include <string.h> #include <unistd.h> #include <fcntl.h> #include <libgen.h> #include <sys/types.h> #include <sys/stat.h> #include "kv.h" #include "cJSON.h" #include "utils_base64.h" #include "iot_import.h" struct kv_file_s { char filename[128]; cJSON *json_root; void* lock; }; /* * update KV file atomically: * step 1. save data in temporary file * step 2. rename temporary file to the orignal one */ static int kv_sync(kv_file_t *file) { char *json = cJSON_Print(file->json_root); if (!json) return -1; /* create temporary file in the same directory as orignal KV file */ char fullpath[128] = {0}; strncpy(fullpath, file->filename, sizeof(fullpath) - 1); char *dname = dirname(fullpath); char *template = "/tmpfile.XXXXXX"; int pathlen = strlen(dname) + strlen(template) + 1; if (pathlen > sizeof(fullpath)) { HAL_Free(json); return -1; } if (dname == fullpath) { /* see dirname man-page for more detail */ strcat(fullpath, template); } else { strcpy(fullpath, dname); strcat(fullpath, template); } int tmpfd = mkstemp(fullpath); if (tmpfd < 0) { perror("kv_sync open"); HAL_Free(json); return -1; } /* write json data into temporary file */ int len = strlen(json) + 1; if (write(tmpfd, json, len) != len) { perror("kv_sync write"); close(tmpfd); HAL_Free(json); return -1; } fsync(tmpfd); close(tmpfd); HAL_Free(json); /* save KV file atomically */ if (rename(fullpath, file->filename) < 0) { perror("rename"); return -1; } return 0; } static char *read_file(char *filename) { int fd = open(filename, O_RDONLY); if (fd < 0) return NULL; struct stat st; if (fstat(fd, &st) < 0) { close(fd); return NULL; } char *buf = HAL_Malloc (st.st_size); if (!buf) { close(fd); return NULL; } if (read(fd, buf, st.st_size) != st.st_size) { HAL_Free(buf); close(fd); return NULL; } close(fd); return buf; } static int create_json_file(char *filename) { int fd = open(filename, O_CREAT | O_RDWR, 0644); if (fd < 0) return -1; if (write(fd, "{}", 3) != 3) { /* 3 = '{}' + null terminator */ close(fd); return -1; } if (fsync(fd) < 0) { close(fd); return -1; } close(fd); return 0; } kv_file_t *kv_open(char *filename) { kv_file_t *file = HAL_Malloc (sizeof(kv_file_t)); if (!file) return NULL; memset(file, 0, sizeof(kv_file_t)); if (strlen(filename) > sizeof(file->filename) - 1) { printf("filename %s is too long\n", filename); goto fail; } strncpy(file->filename, filename, sizeof(file->filename) - 1); if (access(file->filename, F_OK) < 0) { /* create KV file when not exist */ if (create_json_file(file->filename) < 0) goto fail; } char *json = read_file(filename); if (!json) goto fail; file->json_root = cJSON_Parse(json); if (!file->json_root) { HAL_Free(json); goto fail; } file->lock = HAL_MutexCreate (); HAL_Free(json); return file; fail: if (file->json_root) cJSON_Delete(file->json_root); HAL_Free(file); return NULL; } int kv_close(kv_file_t *file) { if (!file) return -1; HAL_MutexDestroy (file->lock); if (file->json_root) cJSON_Delete(file->json_root); HAL_Free(file); return 0; } int kv_get(kv_file_t *file, char *key, char *value, int value_len) { if (!file || !file->json_root || !key || !value || value_len <= 0) return -1; HAL_MutexLock (file->lock); cJSON *obj = cJSON_GetObjectItem(file->json_root, key); if (!obj) { HAL_MutexUnlock (file->lock); return -1; } strncpy(value, obj->valuestring, value_len - 1); value[value_len - 1] = '\0'; HAL_MutexUnlock (file->lock); return 0; } int kv_set(kv_file_t *file, char *key, char *value) { if (!file || !file->json_root || !key || !value) return -1; HAL_MutexLock(file->lock); /* remove old value if exist */ cJSON_DeleteItemFromObject(file->json_root, key); cJSON_AddItemToObject(file->json_root, key, cJSON_CreateString(value)); int ret = kv_sync(file); HAL_MutexUnlock(file->lock); return ret; } int kv_del(kv_file_t *file, char *key) { if (!file || !file->json_root || !key) return -1; /* remove old value if exist */ HAL_MutexLock(file->lock); cJSON_DeleteItemFromObject(file->json_root, key); int ret = kv_sync(file); HAL_MutexUnlock(file->lock); return ret; } #define BASE64_ENCODE_SIZE(x) (((x)+2) / 3 * 4 + 1) #define BASE64_DECODE_SIZE(x) ((x) * 3LL / 4) int kv_set_blob(kv_file_t *file, char *key, void *value, int value_len) { uint32_t encoded_len = BASE64_ENCODE_SIZE(value_len); char *encoded = HAL_Malloc (encoded_len); if (!encoded) return -1; utils_base64encode (value, value_len, encoded_len, (uint8_t *)encoded, &encoded_len); encoded[encoded_len] = 0; int ret = kv_set(file, key, encoded); HAL_Free (encoded); return ret; } int kv_get_blob(kv_file_t *file, char *key, void *value, int *value_len) { if (!file || !file->json_root || !key || !value || !value_len || *value_len <= 0) return -1; HAL_MutexLock (file->lock); cJSON *obj = cJSON_GetObjectItem(file->json_root, key); do { if (!obj) { break; } uint32_t data_len = strlen(obj->valuestring); uint32_t decode_len = BASE64_DECODE_SIZE(data_len); uint8_t *decoded = HAL_Malloc (decode_len); if (!decoded) { break; } if (utils_base64decode((uint8_t*)obj->valuestring, data_len, decode_len, decoded, &decode_len) < 0) { HAL_Free(decoded); break; } if (decode_len > *value_len) { HAL_Free(decoded); break; } memset (value, 0, *value_len); strncpy(value, (char*)decoded, decode_len); HAL_Free(decoded); *value_len = decode_len; HAL_MutexUnlock(file->lock); return 0; } while (0); printf ("\nkv_get_blob return -1\n"); HAL_MutexUnlock(file->lock); return -1; }
21.817276
109
0.577737
d765ea42e0714e229ff2b734cc9dda021d51d589
499
h
C
PrivateFrameworks/OfficeImport/OABContent.h
phatblat/macOSPrivateFrameworks
9047371eb80f925642c8a7c4f1e00095aec66044
[ "MIT" ]
17
2018-11-13T04:02:58.000Z
2022-01-20T09:27:13.000Z
PrivateFrameworks/OfficeImport/OABContent.h
phatblat/macOSPrivateFrameworks
9047371eb80f925642c8a7c4f1e00095aec66044
[ "MIT" ]
3
2018-04-06T02:02:27.000Z
2018-10-02T01:12:10.000Z
PrivateFrameworks/OfficeImport/OABContent.h
phatblat/macOSPrivateFrameworks
9047371eb80f925642c8a7c4f1e00095aec66044
[ "MIT" ]
1
2018-09-28T13:54:23.000Z
2018-09-28T13:54:23.000Z
// // Generated by class-dump 3.5 (64 bit). // // class-dump is Copyright (C) 1997-1998, 2000-2001, 2004-2013 by Steve Nygard. // #import "NSObject.h" __attribute__((visibility("hidden"))) @interface OABContent : NSObject { } + (void)readFromContentObject:(id)arg1 content:(struct EshContent *)arg2 toDrawable:(id)arg3 state:(id)arg4; + (void)readFromContentObject:(id)arg1 toDrawable:(id)arg2 state:(id)arg3; + (void)readFromContainer:(id)arg1 toDrawable:(id)arg2 state:(id)arg3; @end
24.95
108
0.713427
d5d481abda7cc93a6052e48fb871d74a29d6591b
957
h
C
components/vl53l1/include/zranger2.h
TeschRenan/ESP32-VL53L1X
32edf4e5ba97792105a2bb6ad6279aa1bbfc71cb
[ "Apache-2.0" ]
null
null
null
components/vl53l1/include/zranger2.h
TeschRenan/ESP32-VL53L1X
32edf4e5ba97792105a2bb6ad6279aa1bbfc71cb
[ "Apache-2.0" ]
null
null
null
components/vl53l1/include/zranger2.h
TeschRenan/ESP32-VL53L1X
32edf4e5ba97792105a2bb6ad6279aa1bbfc71cb
[ "Apache-2.0" ]
null
null
null
/** * * ESP-Drone Firmware * * Copyright 2019-2020 Espressif Systems (Shanghai) * Copyright (C) 2012 BitCraze AB * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, in version 3. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. * * zranger.h: Z-Ranger deck driver */ #ifndef _ZRANGER2_H_ #define _ZRANGER2_H_ #include "stabilizer_types.h" //#include "deck_core.h" void zRanger2Init(void); bool zRanger2Test(void); void zRanger2Task(void* arg); #endif /* _ZRANGER2_H_ */
27.342857
71
0.735632
70f463e7f4327532bb1cf02212d9f3b135efe3ca
14,253
c
C
watt32-2.2dev.rel.11/src/printk.c
SuperIlu/jSH
628d976a6167c8f81701c236674759666bf47986
[ "BSD-2-Clause" ]
30
2019-06-01T20:16:04.000Z
2022-03-18T21:38:49.000Z
watt32-2.2dev.rel.11/src/printk.c
SuperIlu/jSH
628d976a6167c8f81701c236674759666bf47986
[ "BSD-2-Clause" ]
8
2019-06-05T16:10:45.000Z
2021-05-27T18:09:08.000Z
watt32-2.2dev.rel.11/src/printk.c
SuperIlu/jSH
628d976a6167c8f81701c236674759666bf47986
[ "BSD-2-Clause" ]
3
2019-12-24T14:47:23.000Z
2020-12-16T12:48:33.000Z
/*!\file printk.c * * Formatted printf style routines for syslog() etc. * * These are safe to use in interrupt handlers * Inspired by Linux's printk(). * * Copyright (c) 1997-2002 Gisle Vanem <gvanem@yahoo.no> * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. All advertising materials mentioning features or use of this software * must display the following acknowledgement: * This product includes software developed by Gisle Vanem * Bergen, Norway. * * THIS SOFTWARE IS PROVIDED BY ME (Gisle Vanem) 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 I OR CONTRIBUTORS BE LIABLE FOR ANY * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * */ #include <stdio.h> #include <stdlib.h> #include <stdarg.h> #include <string.h> #include <signal.h> #include <ctype.h> #include <errno.h> #include <time.h> #include "wattcp.h" #include "strings.h" #include "misc.h" #include "run.h" #include "netaddr.h" #include "pcconfig.h" #include "printk.h" #if defined(USE_BSD_API) || defined(USE_DEBUG) || (DOSX & (DOS4GW|X32VM)) int _printk_safe = 1; /* must be set to 0 in intr-handlers */ #if defined(_WIN32) FILE *_printk_file = NULL; #else FILE *_printk_file = stderr; #endif static char *printk_ptr = NULL; static char *printk_buf = NULL; static char *printk_end = NULL; static const char *str_signal (int sig); /* * _snprintk - format a message into a buffer. Like snprintf() except * we also handle: * %m - error message from 'strerror(errno)'. * %t - current time. * %I - IPv4 address. * %S - signal name. * * Returns the number of chars put into buf. * * NB! Doesn't do floating-point formats and long modifiers. * (e.g. "%lu"). */ int MS_CDECL _snprintk (char *buf, int buflen, const char *fmt, ...) { int len; va_list args; va_start (args, fmt); len = _vsnprintk (buf, buflen, fmt, args); va_end (args); return (len); } int MS_CDECL _printk (const char *fmt, ...) { int left = (int)(printk_end - printk_ptr); int len = -1; if (_printk_file && fmt && left > 0) { va_list args; va_start (args, fmt); len = _vsnprintk (printk_ptr, left, fmt, args); printk_ptr += len; _printk_flush(); va_end (args); } return (len); } /* * Return 0 if okay, else -1 */ int _fputsk (const char *buf, FILE *stream) { int rc = -1; if (stream && _printk_safe) rc = fwrite (buf, strlen(buf), 1, stream); return (rc == 1 ? 0 : -1); } void _printk_flush (void) { int len = printk_ptr - printk_buf; if (_printk_safe && _printk_file && len > 0) { fwrite (printk_buf, len, 1, _printk_file); printk_ptr = printk_buf; } } static void W32_CALL printk_exit (void) { _printk_flush(); if (_printk_file && _printk_file != stderr && _printk_file != stdout) fclose (_printk_file); _printk_file = NULL; DO_FREE (printk_buf); /* Reclaim memory allocated in _printk_init() */ } /* * Called from openlog() to allocate print-buffer and * optionally open a file. If file == NULL, print to stderr. */ int _printk_init (int size, const char *file) { if (!printk_buf) { printk_ptr = printk_buf = malloc (size); if (!printk_ptr) { fprintf (stderr, "_printk_init: allocation failed\n"); return (0); } } #if defined(_WIN32) _printk_file = stderr; #endif if (file && (_printk_file = fopen(file,"wt")) == NULL) { fprintf (stderr, "_printk_init: cannot open `%s'\n", file); return (0); } printk_end = printk_ptr + size; RUNDOWN_ADD (printk_exit, 301); return (1); } /* * _vsnprintk - like _snprintk, takes a va_list instead of a list of args. */ #define OUTCHAR(c) (void) (buflen > 0 ? (--buflen, *buf++ = (c)) : 0) int _vsnprintk (char *buf, int buflen, const char *fmt, va_list args) { int c, n, width, prec, fillch; int base, len, neg, quoted, upper; long i; BOOL right_pad, is_long; BYTE *p; char *str, *f, *buf0 = buf, *_fmt = (char*)fmt; char num[32], ct_buf[30]; time_t t; DWORD_PTR val = 0L; if (--buflen < 0) return (-1); while (buflen > 0) { for (f = _fmt; *f != '%' && *f != '\0'; ++f) ; if (f > _fmt) { len = f - _fmt; if (len > buflen) len = buflen; memcpy (buf, _fmt, len); buf += len; buflen -= len; _fmt = f; } if (*_fmt == '\0') break; is_long = FALSE; next: c = *(++_fmt); width = prec = 0; right_pad = FALSE; fillch = ' '; if (c == '0') { fillch = '0'; c = *(++_fmt); } if (c == '*') { width = va_arg (args, int); c = *(++_fmt); } else { if (c == '-') { right_pad = TRUE; c = *(++fmt); } while (isdigit(c)) { width = width * 10 + c - '0'; c = *(++_fmt); } } if (c == '.') { c = *(++_fmt); if (c == '*') { prec = va_arg (args, int); c = *(++_fmt); } else { while (isdigit(c)) { prec = prec * 10 + c - '0'; c = *(++_fmt); } } } str = NULL; base = 0; neg = 0; upper = 0; ++_fmt; switch (c) { case 'l': is_long = 1; goto next; case 'd': i = is_long ? va_arg (args, long) : va_arg (args, int); if (i < 0) { neg = 1; val = -i; } else val = i; base = 10; break; case 'u': val = is_long ? va_arg (args, DWORD) : va_arg (args, unsigned); base = 10; break; case 'o': val = is_long ? va_arg (args, unsigned long) : va_arg (args, unsigned int); base = 8; break; case 'X': upper = 1; /* fall through */ case 'x': val = is_long ? va_arg (args, unsigned long) : va_arg (args, unsigned int); base = 16; break; case 'p': val = (DWORD_PTR) va_arg (args, void*); base = 16; neg = 2; upper = 1; break; case 's': str = va_arg (args, char*); break; case 'S': str = (char*) str_signal (va_arg(args, int)); break; case 'c': num[0] = va_arg (args, int); num[1] = '\0'; str = num; break; case 'm': str = rip (strerror(errno)); break; case 'I': str = _inet_ntoa (num, ntohl(va_arg(args,DWORD))); break; case 't': str = (char*) "??"; if (!_printk_safe) break; time (&t); str = ctime_r (&t, ct_buf); str += 4; /* chop off the day name */ str[15] = '\0'; /* chop off year and newline */ break; case 'v': /* "visible" string */ case 'q': /* quoted string */ quoted = (c == 'q'); p = va_arg (args, BYTE*); if (fillch == '0' && prec > 0) n = prec; else { n = strlen ((char*)p); if (prec > 0 && prec < n) n = prec; } while (n > 0 && buflen > 0) { c = *p++; --n; if (!quoted && c >= 0x80) { OUTCHAR ('M'); OUTCHAR ('-'); c -= 0x80; } if (quoted && (c == '"' || c == '\\')) OUTCHAR ('\\'); if (c < 0x20 || (0x7F <= c && c < 0xA0)) { if (quoted) { OUTCHAR ('\\'); switch (c) { case '\t': OUTCHAR ('t'); break; case '\n': OUTCHAR ('n'); break; case '\b': OUTCHAR ('b'); break; case '\f': OUTCHAR ('f'); break; default: OUTCHAR ('x'); OUTCHAR (hex_chars_lower[c >> 4]); OUTCHAR (hex_chars_lower[c & 0xF]); } } else { if (c == '\t') OUTCHAR (c); else { OUTCHAR ('^'); OUTCHAR (c ^ 0x40); } } } else OUTCHAR (c); } continue; default: *buf++ = '%'; if (c != '%') --_fmt; /* so %z outputs %z etc. */ --buflen; continue; } if (base) { str = num + sizeof(num); *(--str) = '\0'; while (str > num + neg) { int idx = val % base; *(--str) = upper ? hex_chars_upper[idx] : hex_chars_lower[idx]; val = val / base; if (--prec <= 0 && val == 0) break; } switch (neg) { case 1: *(--str) = '-'; break; case 2: *(--str) = 'x'; *(--str) = '0'; break; } len = num + sizeof(num) - 1 - str; } else { len = strlen (str); if (prec > 0 && len > prec) len = prec; } if (right_pad && width > 0) { if (width > buflen) width = buflen; if ((n = width - len) > 0) { buflen -= n; for (; n > 0; --n) *buf++ = fillch; } } if (len > buflen) len = buflen; memcpy (buf, str, len); buf += len; buflen -= len; if (right_pad && width > 0) { if (width > buflen) width = buflen; if ((n = width - len) > 0) { buflen -= n; for (; n > 0; --n) *buf++ = fillch; } } } *buf = '\0'; return (buf - buf0); } /* * Return name for signal 'sig' */ #ifdef __HIGHC__ #undef SIGABRT /* = SIGIOT */ #endif static const char *str_signal (int sig) { static char buf[20]; switch (sig) { case 0: return ("None"); #ifdef SIGINT case SIGINT: return ("SIGINT"); #endif #ifdef SIGABRT case SIGABRT: return ("SIGABRT"); #endif #ifdef SIGFPE case SIGFPE: return ("SIGFPE"); #endif #ifdef SIGILL case SIGILL: return ("SIGILL"); #endif #ifdef SIGSEGV case SIGSEGV: return ("SIGSEGV"); #endif #ifdef SIGTERM case SIGTERM: return ("SIGTERM"); #endif #ifdef SIGALRM case SIGALRM: return ("SIGALRM"); #endif #ifdef SIGHUP case SIGHUP: return ("SIGHUP"); #endif #ifdef SIGKILL case SIGKILL: return ("SIGKILL"); #endif #ifdef SIGPIPE case SIGPIPE: return ("SIGPIPE"); #endif #ifdef SIGQUIT case SIGQUIT: return ("SIGQUIT"); #endif #ifdef SIGUSR1 case SIGUSR1: return ("SIGUSR1"); #endif #ifdef SIGUSR2 case SIGUSR2: return ("SIGUSR2"); #endif #ifdef SIGUSR3 case SIGUSR3: return ("SIGUSR3"); #endif #ifdef SIGNOFP case SIGNOFP: return ("SIGNOFP"); #endif #ifdef SIGTRAP case SIGTRAP: return ("SIGTRAP"); #endif #ifdef SIGTIMR case SIGTIMR: return ("SIGTIMR"); #endif #ifdef SIGPROF case SIGPROF: return ("SIGPROF"); #endif #ifdef SIGSTAK case SIGSTAK: return ("SIGSTAK"); #endif #ifdef SIGBRK case SIGBRK: return ("SIGBRK"); #endif #ifdef SIGBUS case SIGBUS: return ("SIGBUS"); #endif #ifdef SIGIOT case SIGIOT: return ("SIGIOT"); #endif #ifdef SIGEMT case SIGEMT: return ("SIGEMT"); #endif #ifdef SIGSYS case SIGSYS: return ("SIGSYS"); #endif #ifdef SIGCHLD case SIGCHLD: return ("SIGCHLD"); #endif #ifdef SIGWINCH case SIGWINCH: return ("SIGWINCH"); #endif #ifdef SIGPOLL case SIGPOLL: return ("SIGPOLL"); #endif #ifdef SIGCONT case SIGCONT: return ("SIGCONT"); #endif #ifdef SIGSTOP case SIGSTOP: return ("SIGSTOP"); #endif #ifdef SIGTSTP case SIGTSTP: return ("SIGTSTP"); #endif #ifdef SIGTTIN case SIGTTIN: return ("SIGTTIN"); #endif #ifdef SIGTTOU case SIGTTOU: return ("SIGTTOU"); #endif #ifdef SIGURG case SIGURG: return ("SIGURG"); #endif #ifdef SIGLOST case SIGLOST: return ("SIGLOST"); #endif #ifdef SIGDIL case SIGDIL: return ("SIGDIL"); #endif #ifdef SIGXCPU case SIGXCPU: return ("SIGXCPU"); #endif #ifdef SIGXFSZ case SIGXFSZ: return ("SIGXFSZ"); #endif } strcpy (buf, "Unknown "); itoa (sig, buf+8, 10); return (buf); } #endif /* USE_BSD_API || USE_DEBUG || (DOSX & (DOS4GW|X32VM)) */
21.99537
80
0.491616
02b79d6348289555cbdf4e33dafe2d18dd0d4d13
458
h
C
include/raytracing/primitive/SolidCone.h
xzrunner/raytracing
c130691a92fab2cc9605f04534f42ca9b99e6fde
[ "MIT" ]
null
null
null
include/raytracing/primitive/SolidCone.h
xzrunner/raytracing
c130691a92fab2cc9605f04534f42ca9b99e6fde
[ "MIT" ]
null
null
null
include/raytracing/primitive/SolidCone.h
xzrunner/raytracing
c130691a92fab2cc9605f04534f42ca9b99e6fde
[ "MIT" ]
null
null
null
#pragma once #include "raytracing/primitive/Compound.h" namespace rt { class SolidCone : public Compound { public: SolidCone(); SolidCone(double radius, double height); virtual bool Hit(const Ray& ray, double& t, ShadeRec& s) const override; virtual bool ShadowHit(const Ray& ray, float& t) const override; virtual AABB GetBoundingBox() const override { return bbox; } private: AABB bbox; // the bounding box }; // SolidCone }
19.083333
76
0.703057
ad6ee690b6b009d1a2eb7d1e5f225c36e20fc5c7
1,186
h
C
CI/rule/pclint/pclint_include/include_linux/c++/4.8.2/java/security/cert/PKIXCertPathBuilderResult.h
chewaiwai/huaweicloud-sdk-c-obs
fbcd3dadd910c22af3a91aeb73ca0fee94d759fb
[ "Apache-2.0" ]
22
2019-06-13T01:16:44.000Z
2022-03-29T02:42:39.000Z
CI/rule/pclint/pclint_include/include_linux/c++/4.8.2/java/security/cert/PKIXCertPathBuilderResult.h
chewaiwai/huaweicloud-sdk-c-obs
fbcd3dadd910c22af3a91aeb73ca0fee94d759fb
[ "Apache-2.0" ]
26
2019-09-20T06:46:05.000Z
2022-03-11T08:07:14.000Z
CI/rule/pclint/pclint_include/include_linux/c++/4.8.2/java/security/cert/PKIXCertPathBuilderResult.h
chewaiwai/huaweicloud-sdk-c-obs
fbcd3dadd910c22af3a91aeb73ca0fee94d759fb
[ "Apache-2.0" ]
14
2019-07-15T06:42:39.000Z
2022-02-15T10:32:28.000Z
// DO NOT EDIT THIS FILE - it is machine generated -*- c++ -*- #ifndef __java_security_cert_PKIXCertPathBuilderResult__ #define __java_security_cert_PKIXCertPathBuilderResult__ #pragma interface #include <java/security/cert/PKIXCertPathValidatorResult.h> extern "Java" { namespace java { namespace security { class PublicKey; namespace cert { class CertPath; class PKIXCertPathBuilderResult; class PolicyNode; class TrustAnchor; } } } } class java::security::cert::PKIXCertPathBuilderResult : public ::java::security::cert::PKIXCertPathValidatorResult { public: PKIXCertPathBuilderResult(::java::security::cert::CertPath *, ::java::security::cert::TrustAnchor *, ::java::security::cert::PolicyNode *, ::java::security::PublicKey *); virtual ::java::security::cert::CertPath * getCertPath(); virtual ::java::lang::String * toString(); private: ::java::security::cert::CertPath * __attribute__((aligned(__alignof__( ::java::security::cert::PKIXCertPathValidatorResult)))) certPath; public: static ::java::lang::Class class$; }; #endif // __java_security_cert_PKIXCertPathBuilderResult__
28.238095
172
0.711636
518f195ffab8e6d92e4b534518b3591f7b520ff6
1,728
h
C
UndegroundUp/train.h
maksym-shlakhtun/underground
4d3c7affa0571c42ed6a713f051482e8ba2008dd
[ "MIT" ]
null
null
null
UndegroundUp/train.h
maksym-shlakhtun/underground
4d3c7affa0571c42ed6a713f051482e8ba2008dd
[ "MIT" ]
null
null
null
UndegroundUp/train.h
maksym-shlakhtun/underground
4d3c7affa0571c42ed6a713f051482e8ba2008dd
[ "MIT" ]
null
null
null
#pragma once #include "carriage.h" #include <vector> class Human; class Train { public: Train(int _number); Train(int _number, int _maxCarriages); Train(const Train & _temp) = delete; Train & operator =(Train & _temp) = delete; ~Train() {}; int getNumber() const; int getNCarriages() const; int getHumansCount()const; Carriage *getCarriage(int _pos) const; int findCarriage(Carriage &_carriage) const; int findCarriage(int _number) const; void addCarriage(Carriage *_carriage); void addCarriage(int _number); void removeCarriage(int _number); void hasCarriages() const; bool isTrainFullness() const; bool hasEmptySeats(); bool isEmpty() const; int findHuman(Human &_human) const; int findHuman(std::string _humanName) const; void addHuman(Human &_human); void addHuman(Human &_human, int _carriage); Human * getAndRemoveHuman(std::string _humanName); //int getAddedpassengers() const; Human * getHuman(std::string _humanName) const; private: // int m_trainCapacity; std::vector <Carriage *> m_Carriages; int m_maxCarriages; int m_Number; void incorrectNumber(int _number) const; void incorrectMaxCarriages(int _maxCarriages)const; inline void NonexistentCarriageNumber(int _number) const; }; inline void Train::incorrectNumber(int _number) const { if (_number < 0) throw "Incorrect number "; } inline void Train::incorrectMaxCarriages(int _maxCarriages) const { if (_maxCarriages <= 0 || _maxCarriages > 5) throw "Incorrect number of carriages"; } inline void Train::NonexistentCarriageNumber(int _number) const { if (_number <= 0 || _number > getNCarriages()) throw "Incorrect nubmer of carriage"; }
25.411765
66
0.715856
ab5b4a868e269be56b443946f3b25d9464556fe0
3,228
h
C
Adafruit_PCD8544.h
qbit-/Adafruit-PCD8544-Nokia-5110-LCD-library
f8f7f8a3d1cab1d518fe51bf7fa314a51075e1be
[ "BSD-3-Clause" ]
null
null
null
Adafruit_PCD8544.h
qbit-/Adafruit-PCD8544-Nokia-5110-LCD-library
f8f7f8a3d1cab1d518fe51bf7fa314a51075e1be
[ "BSD-3-Clause" ]
null
null
null
Adafruit_PCD8544.h
qbit-/Adafruit-PCD8544-Nokia-5110-LCD-library
f8f7f8a3d1cab1d518fe51bf7fa314a51075e1be
[ "BSD-3-Clause" ]
null
null
null
/********************************************************************* This is a library for our Monochrome Nokia 5110 LCD Displays Pick one up today in the adafruit shop! ------> http://www.adafruit.com/products/338 These displays use SPI to communicate, 4 or 5 pins are required to interface Adafruit invests time and resources providing this open source code, please support Adafruit and open-source hardware by purchasing products from Adafruit! Written by Limor Fried/Ladyada for Adafruit Industries. BSD license, check license.txt for more information All text above, and the splash screen must be included in any redistribution Modified for MBED usage and tested with STM32F411RE on a Nucleo board. Hardware SPI only, tested using default arduino pin out D11/D13 for MOSI/SCLK, Support provided for different pin layouts by James Kidd 2014 *********************************************************************/ #include <stdint.h> #include "Adafruit_GFX.h" #include "mbed.h" #ifndef _ADAFRUIT_PCD8544_H #define _ADAFRUIT_PCD8544_H #define MBED_SPI_MOSI D5 #define MBED_SPI_SCK D7 #define LCD_SPI_MODE 0x00 #define LCD_SPI_BITS 0x08 // Default to max SPI clock speed for PCD8544 of 4 mhz. // This can be modified to change the clock speed if necessary (like for supporting other hardware). #define LCD_SPI_FREQ 400000 #define BLACK 1 #define WHITE 0 #define LCDWIDTH 84 #define LCDHEIGHT 48 #define PCD8544_POWERDOWN 0x04 #define PCD8544_ENTRYMODE 0x02 #define PCD8544_EXTENDEDINSTRUCTION 0x01 #define PCD8544_DISPLAYBLANK 0x0 #define PCD8544_DISPLAYNORMAL 0x4 #define PCD8544_DISPLAYALLON 0x1 #define PCD8544_DISPLAYINVERTED 0x5 // H = 0 #define PCD8544_FUNCTIONSET 0x20 #define PCD8544_DISPLAYCONTROL 0x08 #define PCD8544_SETYADDR 0x40 #define PCD8544_SETXADDR 0x80 // H = 1 #define PCD8544_SETTEMP 0x04 #define PCD8544_SETBIAS 0x10 #define PCD8544_SETVOP 0x80 // Default to max SPI clock speed for PCD8544 of 4 mhz (16mhz / 4) for normal Arduinos. // This can be modified to change the clock speed if necessary (like for supporting other hardware). //#define PCD8544_SPI_CLOCK_DIV SPI_CLOCK_DIV4 class Adafruit_PCD8544 : public Adafruit_GFX { public: // Hardware SPI based on hardware controlled SCK (SCLK)13 and MOSI (DIN)11 pins. CS is still controlled by any IO pin. // NOTE: MISO and SS will be set as an input and output respectively, so be careful sharing those pins! Adafruit_PCD8544(PinName DC, PinName CS, PinName RST); //Untested choose clk/mosi pins Adafruit_PCD8544(PinName DC, PinName CS, PinName RST, PinName MOSI, PinName SCLK); void begin(uint8_t contrast = 40, uint8_t bias = 0x04); void command(uint8_t c); void data(uint8_t c); void setContrast(uint8_t val); void clearDisplay(void); void display(); void drawPixel(int16_t x, int16_t y, uint16_t color); uint8_t getPixel(int8_t x, int8_t y); private: PinName _din, _sclk, _dc, _rst, _cs; volatile uint8_t *mosiport, *clkport; uint8_t mosipinmask, clkpinmask; SPI* LcdSPI; DigitalOut _dc_pin, _rst_pin, _cs_pin; void spiWrite(uint8_t c); bool isHardwareSPI(); }; #endif
32.28
122
0.71995
390f0cddd889553d83bcbcc55abd0030b3326d9c
1,354
c
C
Queue/Queue_using_linkedlist.c
panktishah62/C-DSA
ed335046d37536809ecad1b7267af828bae3ea8d
[ "MIT" ]
5
2021-05-24T08:22:52.000Z
2022-01-29T10:15:44.000Z
Queue/Queue_using_linkedlist.c
panktishah62/C-DSA
ed335046d37536809ecad1b7267af828bae3ea8d
[ "MIT" ]
null
null
null
Queue/Queue_using_linkedlist.c
panktishah62/C-DSA
ed335046d37536809ecad1b7267af828bae3ea8d
[ "MIT" ]
4
2021-05-06T04:42:46.000Z
2021-09-19T17:45:28.000Z
#include <stdio.h> #include <stdlib.h> struct queue{ int data; struct queue *next; }; struct queue *start=NULL; void push(int x){ struct queue *insert=(struct queue*)malloc(sizeof(struct queue)); struct queue *temp=start; insert->data=x; insert->next=NULL; if(start==NULL){ start=insert; } while(temp->next!=NULL){ temp=temp->next; } temp->next=insert; free(temp); } void pop(){ if(start==NULL){ printf("queue is already empty\n"); } struct queue *temp=(struct queue*)malloc(sizeof(struct queue)); temp=start; printf("The popped element is %d\n",temp->data); start=start->next; free(temp); } void display(){ struct queue *temp=(struct queue*)malloc(sizeof(struct queue)); temp=start; while(temp->next!=NULL){ printf("%d ",temp->data); } printf("%d ",temp->data); free(temp); } int main(){ int opt,value,popped=0; while(opt!=4){ printf("which operation do you want to perform?\n"); printf("1.Push\n"); printf("2.Pop\n"); printf("3.Traverse\n"); printf("4.Exit\n"); scanf("%d",&opt); switch(opt){ case 1:printf("enter the value\n"); scanf("%d",&value); push(value); break; case 2: pop(); break; case 3: display(); break; } } return 0; }
18.297297
67
0.570162
795ccdab107d44755326c4ef86196982e02bb736
1,592
c
C
application/src/pit.c
alvarocebrian/pit
791bb8e538dfba5acda91ecd48897693888856a4
[ "MIT" ]
null
null
null
application/src/pit.c
alvarocebrian/pit
791bb8e538dfba5acda91ecd48897693888856a4
[ "MIT" ]
null
null
null
application/src/pit.c
alvarocebrian/pit
791bb8e538dfba5acda91ecd48897693888856a4
[ "MIT" ]
1
2019-12-19T11:33:26.000Z
2019-12-19T11:33:26.000Z
#include "command.h" #include "directory.h" #include "common.h" #include "error.h" // Commands #include "path.h" #include "cmd.h" #include "exec.h" // Sytem Libraries #include <stdlib.h> #include <stdio.h> #include <errno.h> #include <string.h> // Registered commands static cmd commands[] = { {"path", path_cmd, path_init}, {"cmd", cmd_cmd, cmd_init}, {"exec", exec_cmd, exec_init}, {0} }; // Functions void pit_usage(void); void pit_init(void); int main(int argc, char **argv) { if(argc > 1) { // Init pit pit_init(); // Execute the command struct cmd_struct *command = getCommand(argv[1], commands); if (command && command->init()) { argc -= 2; argv += 2; command->run(argc, argv); return errno; } } pit_usage(); } void pit_usage(void) { fprintf(stderr, "The pit command improves commands\n" "\n" "Usage: pit <command> [<options>...]\n" "\n" "<command>\n" "\tpath Define paths for use inside pit\n" "\tcmd Define commands to automate actions\n" "\texec Execute a command defined\n" ); } void pit_init(void) { // Init pit path asprintf(&PIT_PATH,"%s/%s", getenv("HOME"), PIT_DIR); // Create pit directory if it does not exists yet if (dir_exists(PIT_PATH) != true) { if (_create_dir(PIT_PATH) == -1) { char err[50]; sprintf(err, "Can't create pit directory at %s", PIT_PATH); e_error(err); } } }
20.947368
71
0.552764
798c1521493a509e86b3558f28924e7acdef89d4
1,159
h
C
Examples/include/Aspose.Pdf.Cpp/Presentation/Graphics/Core/FileFormats/Gif/DisposalMethod.h
kashifiqb/Aspose.PDF-for-C
13d49bba591c5704685820185741e64a462a5bdc
[ "MIT" ]
null
null
null
Examples/include/Aspose.Pdf.Cpp/Presentation/Graphics/Core/FileFormats/Gif/DisposalMethod.h
kashifiqb/Aspose.PDF-for-C
13d49bba591c5704685820185741e64a462a5bdc
[ "MIT" ]
null
null
null
Examples/include/Aspose.Pdf.Cpp/Presentation/Graphics/Core/FileFormats/Gif/DisposalMethod.h
kashifiqb/Aspose.PDF-for-C
13d49bba591c5704685820185741e64a462a5bdc
[ "MIT" ]
null
null
null
#pragma once // Copyright (c) 2001-2019 Aspose Pty Ltd. All Rights Reserved. namespace Aspose { namespace Pdf { namespace Engine { namespace Presentation { namespace Graphics { namespace FileFormats { namespace Gif { /// <summary> /// Indicates the way in which the graphic is to be treated after being displayed. /// </summary> enum class DisposalMethod { /// <summary> /// No disposal specified. /// </summary> None, /// <summary> /// Do not dispose. The graphic is to be left in place. /// </summary> Preserve, /// <summary> /// Restore to background color. The area used by the graphic must be restored to the background color. /// </summary> Restore, /// <summary> /// Restore to previous. The decoder is required to restore the area overwritten by the graphic with what was there prior to rendering the graphic. /// </summary> Previuos, /// <summary> /// Undefined value. /// </summary> Undefined }; } // namespace Gif } // namespace FileFormats } // namespace Graphics } // namespace Presentation } // namespace Engine } // namespace Pdf } // namespace Aspose
21.462963
151
0.654875
b2aae9a275ddd47201a7ef663b305bda86109b30
1,698
c
C
lib/rot_drv.c
rafalpotempa/chess-timer-atm128
fa44614884f9fe4060728bbe1a843da4b5c34841
[ "Apache-2.0" ]
1
2019-12-09T17:59:09.000Z
2019-12-09T17:59:09.000Z
lib/rot_drv.c
rafalpotempa/chess-timer-atm128
fa44614884f9fe4060728bbe1a843da4b5c34841
[ "Apache-2.0" ]
null
null
null
lib/rot_drv.c
rafalpotempa/chess-timer-atm128
fa44614884f9fe4060728bbe1a843da4b5c34841
[ "Apache-2.0" ]
null
null
null
#include <ioavr.h> #include "rot_drv.h" //Abstract translation of input signals from rottary encoder #define VA(v) v & (1 << SW_A) #define VB(v) v & (1 << SW_B) #define PB(v) v & (1 << SW_PB) //Rot FSM states #define ROT_IDLE 0 #define ROT_LEFT_0 1 #define ROT_LEFT_1 2 #define ROT_LEFT_2 3 #define ROT_RIGHT_0 4 #define ROT_RIGHT_1 5 #define ROT_RIGHT_2 6 unsigned char rotEnc() { //Private internal state of the FSM static unsigned char Q = ROT_IDLE; static unsigned char pb = 0; unsigned char a; unsigned char retVal; a = ROT_IN; retVal = 0; switch(Q) { case ROT_IDLE: if(~VA(a)) Q = ROT_LEFT_0; if(~VB(a)) Q = ROT_RIGHT_0; break; case ROT_LEFT_0: if(VA(a)) Q = ROT_IDLE; if(~VB(a)) Q = ROT_LEFT_1; break; case ROT_LEFT_1: if(VB(a)) Q = ROT_LEFT_0; if(VA(a)) Q = ROT_LEFT_2; break; case ROT_LEFT_2: if(~VA(a)) Q = ROT_LEFT_1; if(VB(a)) { Q = ROT_IDLE; retVal = (1 << ROT_LEFT); //Do something... } break; case ROT_RIGHT_0: if(VB(a)) Q = ROT_IDLE; if(~VA(a)) Q = ROT_RIGHT_1; break; case ROT_RIGHT_1: if(VA(a)) Q = ROT_RIGHT_0; if(VB(a)) Q = ROT_RIGHT_2; break; case ROT_RIGHT_2: if(VA(a)) { Q = ROT_IDLE; //Do something... retVal = (1 << ROT_RIGHT); } if(~VB(a)) Q = ROT_RIGHT_1; break; } pb = 0x1F & (pb + pb + ((PB(a)) ? 0 : 1)); if(pb == 0x0F) retVal |= (1 << ROT_PB); return retVal; }
23.260274
61
0.505889
9f35db24f049cd9f76e7c4ccd6f2d0bb9e136058
4,021
h
C
LoopBack/LBPersistedModel.h
snporta/loopback-sdk-ios
8f5e46427e6df4064dc6a2023b652e15b45690c5
[ "MIT" ]
13
2015-07-13T18:25:17.000Z
2016-10-28T19:25:29.000Z
LoopBack/LBPersistedModel.h
snporta/loopback-sdk-ios
8f5e46427e6df4064dc6a2023b652e15b45690c5
[ "MIT" ]
68
2015-06-25T17:13:22.000Z
2017-05-08T16:01:47.000Z
LoopBack/LBPersistedModel.h
snporta/loopback-sdk-ios
8f5e46427e6df4064dc6a2023b652e15b45690c5
[ "MIT" ]
9
2015-07-14T14:42:38.000Z
2017-01-20T21:55:46.000Z
/** * @file LBPersistedModel.h * * @author Michael Schoonmaker * @copyright (c) 2013 StrongLoop. All rights reserved. */ #import "LBModel.h" // The following typedefs are not used anymore but left for backward compatibility. @class LBPersistedModel; typedef void (^LBPersistedModelObjectSuccessBlock)(LBPersistedModel *model) __deprecated; typedef void (^LBPersistedModelArraySuccessBlock)(NSArray *array) __deprecated; typedef void (^LBPersistedModelVoidSuccessBlock)() __deprecated; typedef void (^LBPersistedModelBoolSuccessBlock)(BOOL boolean) __deprecated; typedef void (^LBPersistedModelNumberSuccessBlock)(NSInteger number) __deprecated; /** * A local representative of a single persisted model instance on the server. * The key difference from LBModel is that this implements the CRUD operation supports. */ @interface LBPersistedModel : LBModel /** All Models have a numerical `id` field. */ @property (nonatomic, readonly, copy) id _id; /** * Blocks of this type are executed when LBPersistedModel::saveWithSuccess:failure: is * successful. */ typedef void (^LBPersistedModelSaveSuccessBlock)(); /** * Saves the LBPersistedModel to the server. * * Calls `toDictionary` to determine which fields should be saved. * * @param success The block to be executed when the save is successful. * @param failure The block to be executed when the save fails. */ - (void)saveWithSuccess:(LBPersistedModelSaveSuccessBlock)success failure:(SLFailureBlock)failure; /** * Blocks of this type are executed when LBPersistedModel::destroyWithSuccess:failure: is * successful. */ typedef void (^LBPersistedModelDestroySuccessBlock)(); /** * Destroys the LBPersistedModel from the server. * * @param success The block to be executed when the destroy is successful. * @param failure The block to be executed when the destroy fails. */ - (void)destroyWithSuccess:(LBPersistedModelDestroySuccessBlock)success failure:(SLFailureBlock)failure; @end /** * A local representative of a single model type on the server, encapsulating * the name of the model type for easy LBPersistedModel creation, discovery, and * management. */ @interface LBPersistedModelRepository : LBModelRepository //typedef void (^LBPersistedModelExistsSuccessBlock)(BOOL exists); //- (void)existsWithId:(id)_id // success:(LBPersistedModelExistsSuccessBlock)success // failure:(SLFailureBlock)failure; /** * Blocks of this type are executed when * LBModelRepository::findById:success:failure: is successful. */ typedef void (^LBPersistedModelFindSuccessBlock)(LBPersistedModel *model); /** * Finds and downloads a single instance of this model type on and from the * server with the given id. * * @param _id The id to search for. * @param success The block to be executed when the destroy is successful. * @param failure The block to be executed when the destroy fails. */ - (void)findById:(id)_id success:(LBPersistedModelFindSuccessBlock)success failure:(SLFailureBlock)failure; /** * Blocks of this type are executed when * LBPersistedModelRepository::allWithSuccess:failure: is successful. */ typedef void (^LBPersistedModelAllSuccessBlock)(NSArray *models); /** * Finds and downloads all models of this type on and from the server. * * @param success The block to be executed when the destroy is successful. * @param failure The block to be executed when the destroy fails. */ - (void)allWithSuccess:(LBPersistedModelAllSuccessBlock)success failure:(SLFailureBlock)failure; typedef void (^LBPersistedModelFindOneSuccessBlock)(LBPersistedModel *model); - (void)findOneWithFilter:(NSDictionary *)filter success:(LBPersistedModelFindOneSuccessBlock)success failure:(SLFailureBlock)failure; - (void)findWithFilter:(NSDictionary *)filter success:(LBPersistedModelAllSuccessBlock)success failure:(SLFailureBlock)failure; @end
35.584071
89
0.747824
198441cbdf0752c5008f187e3b21108e9b208115
1,725
h
C
millionaire/millionaire/comm/CommUtils.h
huangzizhu/millionaire
02e38737804316ec46d2b0afef8762ee17c1f871
[ "MIT" ]
2
2018-07-24T10:08:47.000Z
2019-05-24T03:25:10.000Z
millionaire/millionaire/comm/CommUtils.h
huangzizhu/millionaire
02e38737804316ec46d2b0afef8762ee17c1f871
[ "MIT" ]
1
2019-05-24T03:25:34.000Z
2020-07-17T09:48:30.000Z
millionaire/millionaire/comm/CommUtils.h
huangzizhu/millionaire
02e38737804316ec46d2b0afef8762ee17c1f871
[ "MIT" ]
null
null
null
// // CommUtils.h // millionaire // // Created by book on 13-7-22. // Copyright (c) 2013年 爱奇艺. All rights reserved. // #import <Foundation/Foundation.h> #import "WXApi.h" @class AppDelegate; @class RootViewController; @class AdsView; @interface CommUtils : NSObject + (BOOL)isEmptyOrZero:(id)value; //+ (NSString *)md5:(NSString *)str; + (NetworkStatus)checkNetWork; + (id)getLocalData:(NSString *)key; + (void)setLocalData:(id)value key:(NSString *)key; + (void)twinklAnimation:(UIView *)view block:(void(^)(void))block; +(NSString*)urlDecoded:(NSString*)str; +(NSString *) utf8ToUnicode:(NSString *)string; + (NSString *)getKeyFromType:(UpdateUserType)type; + (NSString *)uzip:(NSData*)data; // 数据压缩 + (NSData *)compressData:(NSData*)uncompressedData; // 数据解压缩 + (NSData *)decompressData:(NSData *)compressedData; + (NSString *)decrypt:(NSData *)aData; + (NSData *)encrypt:(NSString *)aString; + (void)showConfirmAlertView:(NSString *)title message:(NSString *)message tag:(NSInteger)tag delegate:(id)target;//含有确定按钮的aleertview + (int)getRandomNumber:(int)from to:(int)to; + (NSArray *)getLevels; + (NSString *)getLevels:(int)level; + (NSString *)getLocalVersion;//获取程序本身的版本号boudle version + (void)updateApp:(NSString *)appUrl;//升级应用 + (BOOL)needUpdateCache:(NSString *)key timeInterval:(float)timeInterval;//判断是否需要同步数据 + (void)setCacheTime:(NSString *)key;//设置缓存时间 + (RootViewController *)getRootViewController; + (UIImage *)cropImage:(UIImage *)image rect:(CGRect)rect; + (UIImage *)getNormalImage:(UIView *)view;////获取当前屏幕内容 + (void) sendImageContent:(NSDictionary *)dict scene:(int)scene;//微信分享 + (AppDelegate *)getApp; + (BOOL)isUpdate:(NSString *)version; + (AdsView *)getAdsView; @end
25.367647
133
0.717101
19b5b63856c8ac9328703bf42e7192972dec9edb
312
h
C
GossipExample/GSEMessageInitController.h
wulie88/gossip
d3949916e297bdcddad93d49a7b2ae9b4071e90d
[ "Unlicense" ]
1
2015-06-02T09:21:25.000Z
2015-06-02T09:21:25.000Z
GossipExample/GSEMessageInitController.h
wulie88/gossip
d3949916e297bdcddad93d49a7b2ae9b4071e90d
[ "Unlicense" ]
null
null
null
GossipExample/GSEMessageInitController.h
wulie88/gossip
d3949916e297bdcddad93d49a7b2ae9b4071e90d
[ "Unlicense" ]
null
null
null
// // GSEMessageInitController.h // Gossip // // Created by jiuwu on 14-8-6. // // #import <Foundation/Foundation.h> #import <UIKit/UIKit.h> @interface GSEMessageInitController : NSObject @property (nonatomic, unsafe_unretained) UINavigationController *navigationController; - (void)makeNewMessage; @end
16.421053
86
0.746795
c35fdba6f94d3d47d874382ef4be815cce51d79a
7,241
c
C
f2c/dgemv.c
brishtiteveja/RSVM-Reduced-Support-Vector-Machine-
4b3f60d5994f9c61bf25cf640c8bb49bec403c00
[ "BSD-3-Clause" ]
1
2019-10-14T03:32:56.000Z
2019-10-14T03:32:56.000Z
f2c/dgemv.c
brishtiteveja/RSVM-Reduced-Support-Vector-Machine-
4b3f60d5994f9c61bf25cf640c8bb49bec403c00
[ "BSD-3-Clause" ]
null
null
null
f2c/dgemv.c
brishtiteveja/RSVM-Reduced-Support-Vector-Machine-
4b3f60d5994f9c61bf25cf640c8bb49bec403c00
[ "BSD-3-Clause" ]
null
null
null
#include "blas.h" int dgemv_(char *trans, long *m, long *n, double *alpha, double *a, long *lda, double *x, long *incx, double *beta, double *y, long *incy) { long info; double temp, *pa, aalpha, bbeta; long lenx, leny, i, j, dima, mm, nn, iincx, iincy; long ix, iy, jx, jy, kx, ky; blasbool notrans; /* Dependencies */ extern int xerbla_(char *, long *); /* Purpose ======= DGEMV performs one of the matrix-vector operations y := alpha*A*x + beta*y, or y := alpha*A'*x + beta*y, where alpha and beta are scalars, x and y are vectors and A is an m by n matrix. Parameters ========== TRANS - CHARACTER*1. On entry, TRANS specifies the operation to be performed as follows: TRANS = 'N' or 'n' y := alpha*A*x + beta*y. TRANS = 'T' or 't' y := alpha*A'*x + beta*y. TRANS = 'C' or 'c' y := alpha*A'*x + beta*y. Unchanged on exit. M - INTEGER. On entry, M specifies the number of rows of the matrix A. M must be at least zero. Unchanged on exit. N - INTEGER. On entry, N specifies the number of columns of the matrix A. N must be at least zero. Unchanged on exit. ALPHA - DOUBLE PRECISION. On entry, ALPHA specifies the scalar alpha. Unchanged on exit. A - DOUBLE PRECISION array of DIMENSION ( LDA, n ). Before entry, the leading m by n part of the array A must contain the matrix of coefficients. Unchanged on exit. LDA - INTEGER. On entry, LDA specifies the first dimension of A as declared in the calling (sub) program. LDA must be at least max( 1, m ). Unchanged on exit. X - DOUBLE PRECISION array of DIMENSION at least ( 1 + ( n - 1 )*abs( INCX ) ) when TRANS = 'N' or 'n' and at least ( 1 + ( m - 1 )*abs( INCX ) ) otherwise. Before entry, the incremented array X must contain the vector x. Unchanged on exit. INCX - INTEGER. On entry, INCX specifies the increment for the elements of X. INCX must not be zero. Unchanged on exit. BETA - DOUBLE PRECISION. On entry, BETA specifies the scalar beta. When BETA is supplied as zero then Y need not be set on input. Unchanged on exit. Y - DOUBLE PRECISION array of DIMENSION at least ( 1 + ( m - 1 )*abs( INCY ) ) when TRANS = 'N' or 'n' and at least ( 1 + ( n - 1 )*abs( INCY ) ) otherwise. Before entry with BETA non-zero, the incremented array Y must contain the vector y. On exit, Y is overwritten by the updated vector y. INCY - INTEGER. On entry, INCY specifies the increment for the elements of Y. INCY must not be zero. Unchanged on exit. Level 2 Blas routine. -- Written on 22-October-1986. Jack Dongarra, Argonne National Lab. Jeremy Du Croz, Nag Central Office. Sven Hammarling, Nag Central Office. Richard Hanson, Sandia National Labs. */ /* Dereference inputs */ nn = *n; mm = *m; dima = *lda; aalpha = *alpha; bbeta = *beta; iincx = *incx; iincy = *incy; info = 0; switch( *trans ) { case 'N': case 'n': notrans = TRUE; break; case 'T': case 't': case 'C': case 'c': notrans = FALSE; break; default: notrans = TRUE; info = 1; } if( info == 0 ) { if (mm < 0) { info = 2; } else if (nn < 0) { info = 3; } else if (dima < MAX(1,mm)) { info = 6; } else if (iincx == 0) { info = 8; } else if (iincy == 0) { info = 11; } } if (info != 0) { xerbla_("DGEMV ", &info); return 0; } /* Quick return if possible. */ if (mm != 0 && nn != 0 && (aalpha != 0.0 || bbeta != 1.0)) { /* Set LENX and LENY, the lengths of the vectors x and y, and set up the start points in X and Y. */ if (notrans) { lenx = nn; leny = mm; } else { lenx = mm; leny = nn; } kx = iincx > 0 ? 0 : (1 - lenx) * iincx; ky = iincy > 0 ? 0 : (1 - leny) * iincy; /* Start the operations. In this version the elements of A are accessed sequentially with one pass through A. */ /* First form y := beta*y. */ if (bbeta != 1.0) { if (iincy == 1) { if (bbeta == 0.0) { for (i = 0; i < leny; ++i) y[i] = 0.0; } else /* bbeta != 0.0 */ { for (i = 0; i < leny; ++i) y[i] = bbeta * y[i]; } } else /* iincy != 1 */ { iy = ky; if (bbeta == 0.0) { for (i = 0; i < leny; ++i) { y[iy] = 0.0; iy += iincy; } } else /* bbeta != 0.0 */ { for (i = 0; i < leny; ++i) { y[iy] = bbeta * y[iy]; iy += iincy; } } } } if (aalpha != 0.0) { if (notrans) /* Form y := alpha*A*x + y. */ { jx = kx; if (iincy == 1) { for (pa=a, j = 0; j < nn; ++j, pa+=dima) { if (x[jx] != 0.0) { temp = aalpha * x[jx]; for (i = 0; i < mm; ++i) y[i] += temp * pa[i]; /* y[i] += temp * A(i,j); */ } jx += iincx; } } else { for (pa=a, j = 0; j < nn; ++j, pa+=dima) { if (x[jx] != 0.0) { temp = aalpha * x[jx]; iy = ky; for (i = 0; i < mm; ++i) { y[iy] += temp * pa[i]; /* y[iy] += temp * A(i,j); */ iy += iincy; } } jx += iincx; } } } else /* Form y := alpha*A'*x + y. */ { jy = ky; if (iincx == 1) { for (pa=a, j = 0; j < nn; ++j, pa+=dima) { temp = 0.0; for (i = 0; i < mm; ++i) temp += pa[i] * x[i]; /* temp += A(i,j) * x[i]; */ y[jy] += aalpha * temp; jy += iincy; } } else { for (pa=a, j = 0; j < nn; ++j, pa+=dima) { temp = 0.0; ix = kx; for (i = 0; i < mm; ++i) { temp += pa[i] * x[ix]; /* temp += A(i,j) * x[ix]; */ ix += iincx; } y[jy] += aalpha * temp; jy += iincy; } } } } } return 0; } /* dgemv_ */
24.797945
74
0.410579
c3a57ab0e49b4c8dd9ab16535cb8434c7e246945
230
h
C
Example/Classes/PMViewController.h
digital-prime/realm-cocoa-extensions
c10c7ca73ca0242be35efad2bddd563f7aaffa9e
[ "MIT" ]
1
2016-11-15T03:38:11.000Z
2016-11-15T03:38:11.000Z
Example/Classes/PMViewController.h
digital-prime/realm-cocoa-extensions
c10c7ca73ca0242be35efad2bddd563f7aaffa9e
[ "MIT" ]
null
null
null
Example/Classes/PMViewController.h
digital-prime/realm-cocoa-extensions
c10c7ca73ca0242be35efad2bddd563f7aaffa9e
[ "MIT" ]
null
null
null
// // PMViewController.h // realm-cocoa-extensions // // Created by Pavel Malkov on 10/27/2016. // Copyright (c) 2016 Pavel Malkov. All rights reserved. // @import UIKit; @interface PMViewController : UIViewController @end
16.428571
57
0.713043
bae750c2fe549b4738e65044d778ee2d20acb8bd
521
h
C
include/eight/core/os/win32.h
hodgman/eight
b3ade9ad355e47bcc853c087d670b55b33933ccb
[ "Unlicense", "MIT" ]
9
2016-04-24T16:57:15.000Z
2018-12-08T05:52:21.000Z
include/eight/core/os/win32.h
hodgman/eight
b3ade9ad355e47bcc853c087d670b55b33933ccb
[ "Unlicense", "MIT" ]
null
null
null
include/eight/core/os/win32.h
hodgman/eight
b3ade9ad355e47bcc853c087d670b55b33933ccb
[ "Unlicense", "MIT" ]
null
null
null
//------------------------------------------------------------------------------ #pragma once #include <eight/core/debug.h> #define VC_EXTRALEAN #define WIN32_LEAN_AND_MEAN #define NOMINMAX #ifndef _ASSERT #define _ASSERT(expr) eiASSERT(expr) #endif #ifndef _ASSERTE #define _ASSERTE(expr) eiASSERT(expr) #endif //#ifndef _ASSERT_EXPR //#define _ASSERT_EXPR(expr, expr_str) eiASSERTMSG(expr, expr_str) //#endif #include <windows.h> //------------------------------------------------------------------------------
20.84
80
0.52975
241941b9c794b3cf2e43c004684e2d5326d9a2da
628
c
C
src/2ano/2sem/so/prt/fichas/1920/guiao7/ex1.c
joaopsmendes/miei
d940b55730bf04e14fbe929215432d7644ee6fec
[ "MIT" ]
4
2021-02-27T13:25:46.000Z
2021-05-12T19:44:24.000Z
src/2ano/2sem/so/prt/fichas/1920/guiao7/ex1.c
xfn14/miei
a58db6fd302a3d87c2cdc69081df5f0de99b392d
[ "MIT" ]
8
2020-11-23T21:06:44.000Z
2021-04-03T21:00:16.000Z
src/2ano/2sem/so/prt/fichas/1920/guiao7/ex1.c
xfn14/miei
a58db6fd302a3d87c2cdc69081df5f0de99b392d
[ "MIT" ]
3
2020-03-13T01:07:35.000Z
2020-03-20T16:54:47.000Z
#include <stdio.h> #include <sys/wait.h> #include <unistd.h> #include <signal.h> #include <sys/types.h> #include <stdlib.h> typedef void(*sighandler_t) (int); int segundos = 0; int nctrlc = 0; void sigalrm_handler(int signum){ segundos ++; } void sigint_handler(int signum){ nctrlc++; printf("passara %d segundos\n",segundos); } void sigquit_handler(int signum){ printf("carregou %dx no ctrl-c\n", nctrlc); exit(0); } int main(int argc, char* argv[]){ signal(SIGALRM, sigalrm_handler); signal(SIGINT, sigint_handler); signal(SIGQUIT,sigquit_handler); while(1){ alarm(1); pause(); } return 0; }
12.56
44
0.676752
246d6e7a3553942f5894ba9137a31b605e202ee7
87
h
C
demo-swift/Quickblox.framework/Versions/A/Headers/QBCoreRequests.h
bluecitymoon/demo-swift-ios
bfd551d32c4e332cc8116aae92ae72ecd80bf4a7
[ "MIT" ]
1
2017-02-21T21:08:04.000Z
2017-02-21T21:08:04.000Z
demo-swift/Quickblox.framework/Versions/A/Headers/QBCoreRequests.h
bluecitymoon/demo-swift-ios
bfd551d32c4e332cc8116aae92ae72ecd80bf4a7
[ "MIT" ]
null
null
null
demo-swift/Quickblox.framework/Versions/A/Headers/QBCoreRequests.h
bluecitymoon/demo-swift-ios
bfd551d32c4e332cc8116aae92ae72ecd80bf4a7
[ "MIT" ]
null
null
null
/* * Requests.h * BaseService * * */ #import <Quickblox/QBCoreRequestsCommon.h>
10.875
42
0.643678
44489f6b5548dd10c3b8039a2758add981013385
359
h
C
Test/AppDelegate.h
aceisScope/RandomImageLayout
4069183feceb724ba79d34128746bbbf5103dba1
[ "MIT" ]
1
2015-09-10T20:46:36.000Z
2015-09-10T20:46:36.000Z
Test/AppDelegate.h
aceisScope/RandomImageLayout
4069183feceb724ba79d34128746bbbf5103dba1
[ "MIT" ]
null
null
null
Test/AppDelegate.h
aceisScope/RandomImageLayout
4069183feceb724ba79d34128746bbbf5103dba1
[ "MIT" ]
null
null
null
// // AppDelegate.h // Test // // Created by B.H. Liu on 12-6-11. // Copyright (c) 2012年 Appublisher. All rights reserved. // #import <UIKit/UIKit.h> @class ViewController; @interface AppDelegate : UIResponder <UIApplicationDelegate> @property (strong, nonatomic) UIWindow *window; @property (strong, nonatomic) ViewController *viewController; @end
17.95
61
0.721448
68985a42c62e20b84d2b9d32223d62b6002de492
1,299
c
C
sources/render/render.c
Lenemson/raytracer
5242d5d682f730123bd8758fe9a83b17f75159df
[ "MIT" ]
null
null
null
sources/render/render.c
Lenemson/raytracer
5242d5d682f730123bd8758fe9a83b17f75159df
[ "MIT" ]
null
null
null
sources/render/render.c
Lenemson/raytracer
5242d5d682f730123bd8758fe9a83b17f75159df
[ "MIT" ]
null
null
null
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* render.c :+: :+: :+: */ /* +:+ +:+ +:+ */ /* By: jibanez <marvin@42.fr> +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2015/02/28 14:07:26 by jibanez #+# #+# */ /* Updated: 2015/05/24 10:53:36 by jibanez ### ########.fr */ /* */ /* ************************************************************************** */ #include "render.h" int render(t_scene *scene) { int x; int y; t_vector up; t_ray ray; x = 0; y = 0; while (y < scene->camera.res_y) { up = mult_vector(scene->camera.up, (float)y * scene->camera.y_indent); while (x < scene->camera.res_x) { ray = construct_ray(scene->camera, up, x); put_pixel(scene->gfx, x, y, trace(scene, ray)); x++; } x = 0; y++; } return (0); }
34.184211
80
0.247113
7edf570021745e7359a3fc980ccdd5f64e1e0390
861
h
C
data-structure/data-structure/tree/print_tree_helper.h
youshihou/data-structure-learning
5522d2225d805e49864bf0468adf80ebebe82ecb
[ "MIT" ]
1
2020-08-27T02:36:11.000Z
2020-08-27T02:36:11.000Z
data-structure/data-structure/tree/print_tree_helper.h
youshihou/data-structure-learning
5522d2225d805e49864bf0468adf80ebebe82ecb
[ "MIT" ]
null
null
null
data-structure/data-structure/tree/print_tree_helper.h
youshihou/data-structure-learning
5522d2225d805e49864bf0468adf80ebebe82ecb
[ "MIT" ]
null
null
null
// // print_tree_helper.h // data-structure // // Created by Ankui on 7/20/20. // Copyright © 2020 Ankui. All rights reserved. // #ifndef print_tree_helper_h #define print_tree_helper_h #include "common.h" //struct node_depth { // struct bst_node* node; // int level; //}; struct object_node { // struct node_depth* value; void* value; struct object_node* next; }; struct object_queue { struct object_node* head; struct object_node* tail; }; struct object_queue* object_queue_create(void); bool object_queue_isEmpty(struct object_queue*); void object_queue_enqueue(struct object_queue*, void*); void* object_queue_dequeue(struct object_queue*); void object_queue_destroy(struct object_queue* q); int object_queue_size(struct object_queue*); void* object_queue_front(struct object_queue* q); #endif /* print_tree_helper_h */
21.525
55
0.740999
dff3597d7fc03b2bb567dc019fcdc36a06a02d92
674
h
C
Source/TamaSize.h
pbghogehoge/kog
7d45ba8ddc1b01987ccca416dbd7901a23f4412f
[ "MIT" ]
41
2019-02-08T09:10:30.000Z
2022-03-24T15:54:58.000Z
Source/TamaSize.h
pbghogehoge/kog
7d45ba8ddc1b01987ccca416dbd7901a23f4412f
[ "MIT" ]
null
null
null
Source/TamaSize.h
pbghogehoge/kog
7d45ba8ddc1b01987ccca416dbd7901a23f4412f
[ "MIT" ]
4
2019-02-08T09:26:59.000Z
2020-05-07T15:44:34.000Z
/* * TamaSize.h : 敵弾のサイズ定義 * */ #ifndef TAMASIZE_INCLUDED #define TAMASIZE_INCLUDED "敵弾のサイズ定義 : Version 0.01 : Update 2001/07/17" /* [更新履歴] * Version 0.01 : 2001/07/17 : Tama.h から移動 */ /***** [ 定数 ] *****/ // サイズ定数 // //#define ETAMA8_HITSIZE ( 2 * 256) // 通常の当たり判定 //#define ETAMA16_HITSIZE ( 3 * 256) // 通常の当たり判定 //#define ETAMA24_HITSIZE ( 4 * 256) // 通常の当たり判定 //#define ETAMA32_HITSIZE ( 5 * 256) // 通常の当たり判定 #define ETAMA8_HITSIZE ( 3 * 256) // 通常の当たり判定 #define ETAMA16_HITSIZE ( 5 * 256) // 通常の当たり判定 #define ETAMA24_HITSIZE ( 8 * 256) // 通常の当たり判定 #define ETAMA32_HITSIZE (10 * 256) // 通常の当たり判定 #endif
22.466667
72
0.594955