text
stringlengths
4
6.14k
/* config.h. Generated from config.h.in by configure. */ /* config.h.in. Generated from configure.ac by autoheader. */ /* Define to 1 if you have the `z' library (-lz). */ #define HAVE_LIBZ 1 /* Name of package */ #define PACKAGE "luit" /* Define to the address where bug reports for this package should be sent. */ #define PACKAGE_BUGREPORT "https://bugs.freedesktop.org/enter_bug.cgi?product=xorg" /* Define to the full name of this package. */ #define PACKAGE_NAME "luit" /* Define to the full name and version of this package. */ #define PACKAGE_STRING "luit 1.0.3" /* Define to the one symbol short name of this package. */ #define PACKAGE_TARNAME "luit" /* Define to the version of this package. */ #define PACKAGE_VERSION "1.0.3" /* Major version of this package */ #define PACKAGE_VERSION_MAJOR 1 /* Minor version of this package */ #define PACKAGE_VERSION_MINOR 0 /* Patch version of this package */ #define PACKAGE_VERSION_PATCHLEVEL 3 /* Version number of package */ #define VERSION "1.0.3"
/* * Copyright (c) 2020 Peter Buelow <email> * * 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 SONOSREQUEST_H #define SONOSREQUEST_H #include <QtCore/QtCore> #include <QtNetwork/QtNetwork> const QString g_cachePath = "/home/pi/.config/MythClock/cache"; class SonosRequest : public QObject { Q_OBJECT public: SonosRequest(QObject *parent = 0); virtual ~SonosRequest() {} void run(); void setURL(QString, QString room); bool inProgress() { return m_running; } void getAlbumArt(QUrl); public slots: void requestFinished(QNetworkReply *reply); void albumArtFinished(QNetworkReply *reply); signals: void result(QByteArray); void error(QNetworkReply::NetworkError); void albumArt(QByteArray); void albumArtError(QNetworkReply::NetworkError); private: void getAlbumArt(QString); QNetworkAccessManager *m_manager; QNetworkAccessManager *m_albumArt; QUrl m_url; bool m_running; }; #endif // SONOSREQUEST_H
/* Formatted output to strings. Copyright (C) 1999, 2002, 2006-2007, 2009-2014 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. */ #include <config.h> /* Specification. */ #include "unistdio.h" #include <errno.h> #include <limits.h> #include <stdarg.h> #include <stdlib.h> #include "unistr.h" #define VSNPRINTF u8_vsnprintf #define VASNPRINTF u8_vasnprintf #define FCHAR_T char #define DCHAR_T uint8_t #define DCHAR_CPY u8_cpy #include "u-vsnprintf.h"
/* * rele, * * * Copyright (C) 2016 Davide Tateo * Versione 1.0 * * This file is part of rele. * * rele is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * rele 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 rele. If not, see <http://www.gnu.org/licenses/>. */ #ifndef INCLUDE_RELE_IRL_UTILS_IRLGRADTYPE_H_ #define INCLUDE_RELE_IRL_UTILS_IRLGRADTYPE_H_ #include <map> #include <stdexcept> #include <string> namespace ReLe { enum class IrlGrad { REINFORCE, REINFORCE_BASELINE, GPOMDP, GPOMDP_BASELINE, ENAC, ENAC_BASELINE, NATURAL_REINFORCE, NATURAL_REINFORCE_BASELINE, NATURAL_GPOMDP, NATURAL_GPOMDP_BASELINE }; enum class IrlEpGrad { PGPE, PGPE_BASELINE }; enum class IrlHess { REINFORCE, REINFORCE_BASELINE, REINFORCE_BASELINE_TRACE, REINFORCE_BASELINE_TRACE_DIAG, GPOMDP, GPOMDP_BASELINE }; enum class IrlEpHess { PGPE, PGPE_BASELINE }; class IrlGradUtils { public: static bool isValid(const std::string& type); static IrlGrad fromString(const std::string& type); static std::string toString(IrlGrad type); static std::string getOptions(); private: static std::map<std::string, IrlGrad> initGradients(); private: static std::map<std::string, IrlGrad> gradients; }; class IrlEpGradUtils { public: static bool isValid(const std::string& type); static IrlEpGrad fromString(const std::string& type); static std::string toString(IrlEpGrad type); static std::string getOptions(); private: static std::map<std::string, IrlEpGrad> initGradients(); private: static std::map<std::string, IrlEpGrad> gradients; }; class IrlHessUtils { public: static bool isValid(const std::string& type); static IrlHess fromString(const std::string& type); static std::string toString(IrlHess type); static std::string getOptions(); private: static std::map<std::string, IrlHess> initHessians(); private: static std::map<std::string, IrlHess> hessians; }; class IrlEpHessUtils { public: static bool isValid(const std::string& type); static IrlEpHess fromString(const std::string& type); static std::string toString(IrlEpHess type); static std::string getOptions(); private: static std::map<std::string, IrlEpHess> initHessians(); private: static std::map<std::string, IrlEpHess> hessians; }; inline std::ostream& operator<< (std::ostream& stream, IrlGrad grad) { stream << IrlGradUtils::toString(grad); return stream; } inline std::ostream& operator<< (std::ostream& stream, IrlEpGrad grad) { stream << IrlEpGradUtils::toString(grad); return stream; } inline std::ostream& operator<< (std::ostream& stream, IrlHess hess) { stream << IrlHessUtils::toString(hess); return stream; } inline std::ostream& operator<< (std::ostream& stream, IrlEpHess hess) { stream << IrlEpHessUtils::toString(hess); return stream; } } #endif /* INCLUDE_RELE_IRL_UTILS_IRLGRADTYPE_H_ */
// For license of this file, see <project-root-folder>/LICENSE.md. #ifndef MESSAGETEXTBROWSER_H #define MESSAGETEXTBROWSER_H #include <QTextBrowser> #include "core/message.h" class MessageTextBrowser : public QTextBrowser { Q_OBJECT public: explicit MessageTextBrowser(QWidget* parent = nullptr); virtual ~MessageTextBrowser() = default; virtual QVariant loadResource(int type, const QUrl& name); virtual QSize sizeHint() const; protected: virtual void contextMenuEvent(QContextMenuEvent* event); virtual void wheelEvent(QWheelEvent* event); virtual void resizeEvent (QResizeEvent* event); private: QPixmap m_imagePlaceholder; }; #endif // MESSAGETEXTBROWSER_H
#include "opt.h" double* ls_opt(const int n,const double* x0,const OBJ_FUNC f,const GRAD_FUNC g,const HESS_FUNC h, const INIT_HESS_FUNC init_hess,void* data) { //check inputs if(!(x0&&f&&g&&h))return NULL; //initialize variables int n_iters=0,ok,i; double f1,f2,g0,alpha,norm_p,*x1=malloc(n*sizeof(double)),*x2=malloc(n*sizeof(double)), *grad=malloc(n*sizeof(double)),*p=malloc(n*sizeof(double)),*x_tmp; cs_di *hess=init_hess(x0,data); klu_common common; klu_symbolic *symb=NULL; klu_numeric *num=NULL; //copy over starting point to x1 for(i=0;i<n;i++)x1[i]=x0[i]; /* evaluate function and gradient at starting point */ f1=f(x1,data); g(x1,grad,data); //initialize KLU ok=klu_defaults(&common); /* otherwise, find a search direction and start line search */ do { //compute the Hessian h(x1,hess,data); /* flip the sign of g so we solve -g=Hp */ for(i=0;i<n;i++)p[i]=-grad[i]; //perform linear solve for p symb=klu_analyze(n,hess->p,hess->i,&common); num=klu_factor(hess->p,hess->i,hess->x,symb,&common); if(!klu_solve(symb,num,n,1,p,&common))printf("KLU failed with code %d\n",common.status); printf("KLU code %d\n",common.status); //free up klu resources klu_free_symbolic(&symb,&common); klu_free_numeric(&num,&common); /* make sure p is a descent direction. if not, bail and use gradient descent. */ g0=dot(n,grad,p); if(g0>0){for(i=0;i<n;i++)p[i]=-grad[i];} //normalize the search direction norm_p=0.0; for(i=0;i<n;i++)norm_p+=p[i]*p[i]; norm_p=1.0/sqrt(norm_p); for(i=0;i<n;i++)p[i]*=norm_p; //perform line search to get step length alpha=line_search(n,x1,p,f,g,data); /* calculate gradient at new point, increment iteration counter, and continue */ add(n,x1,p,alpha,x2); f1=f2; f2=f(x2,data); g(x2,grad,data); x_tmp=x1;x1=x2;x2=x_tmp; n_iters++; } while(!is_zero(n,grad)&&n_iters<ITER_MAX); printf("Number of steps: %d\n",n_iters); //exit if a zero could not be found in the max number of iterations if(n_iters==ITER_MAX) { printf("Failed to locate a zero in %d iterations. Exiting...",ITER_MAX); free(grad); free(p); free(x1); free(x2); cs_spfree(hess); exit(8); } //free memory and return free(grad); free(p); free(x2); cs_spfree(hess); return x1; }
/* opensslv.h compatibility */ #ifndef CYASSL_OPENSSLV_H_ #define CYASSL_OPENSSLV_H_ /* api version compatibility */ #define OPENSSL_VERSION_NUMBER 0x0090700f #endif /* header */
#ifndef _RADIO_H #define _RADIO_h #include "RF24.h" extern RF24 radio; void DefineNetwork(uint32_t addr, uint8_t chan, rf24_datarate_e rate); void RadioSetup(rf24_datarate_e rate, uint8_t channel, uint32_t addr ); void RadioSetupJoin(); void RadioSetupNormal(); void SendRadioMessage(uint8_t msg[16], uint8_t key[16], uint8_t *rawSent); void SendRadioRawMessage(uint8_t bytes[19]); #endif
/************************************************************************************************************************ ** ** Copyright 2015-2021 Daniel Nikpayuk, Inuit Nunangat, The Inuit Nation ** ** This file is part of nik. ** ** nik is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License ** as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. ** ** nik 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 nik. If not, see ** <http://www.gnu.org/licenses/>. ** ************************************************************************************************************************/ #include nik_size_type(define) #define pnk_builtin_ss nik_module(patronum, natural, kernel, builtin, symbolic, semiotic) #define snk_signed_long_judgment_ss nik_module(straticum, natural, kernel, signed_long_judgment, symbolic, semiotic) #ifdef safe_name #define PREFIX snkslj_filter_ss_ #else #define PREFIX #endif // template < typename Type, typename Exp, typename Continuation = typename pnk_builtin_ss::inductor:: ch_s_grow_to_values > using nik_safe(PREFIX, s_signed_long_judgment_) = typename snk_signed_long_judgment_ss::filter::template s_signed_long_judgment_<Type, Exp, Continuation>; // template < typename Type, typename Continuation = typename pnk_builtin_ss::inductor:: ch_a_grow_to_value, typename Image = Type > static constexpr Image nik_safe(PREFIX, a_signed_long_judgment_) = snk_signed_long_judgment_ss::filter::template a_signed_long_judgment_<Type, Continuation, Image>; // #undef PREFIX #undef snk_signed_long_judgment_ss #undef pnk_builtin_ss #include nik_size_type(undef)
#ifndef VCARDPLUGIN_H #define VCARDPLUGIN_H #include <QDir> #include <QTimer> #include <QObjectCleanupHandler> #include <interfaces/ipluginmanager.h> #include <interfaces/ivcard.h> #include <interfaces/iroster.h> #include <interfaces/ixmppstreams.h> #include <interfaces/irostersview.h> #include <interfaces/irostersmodel.h> #include <interfaces/imultiuserchat.h> #include <interfaces/istanzaprocessor.h> #include <interfaces/iservicediscovery.h> #include <interfaces/ixmppuriqueries.h> #include <interfaces/imessagewidgets.h> #include <interfaces/irostersearch.h> #include <interfaces/ioptionsmanager.h> #include "vcard.h" #include "vcarddialog.h" struct VCardItem { VCardItem() { vcard = NULL; locks = 0; } VCard *vcard; int locks; }; class VCardPlugin : public QObject, public IPlugin, public IVCardPlugin, public IOptionsHolder, public IStanzaRequestOwner, public IXmppUriHandler, public IRosterDataHolder { Q_OBJECT; Q_INTERFACES(IPlugin IVCardPlugin IRosterDataHolder IStanzaRequestOwner IXmppUriHandler IOptionsHolder); friend class VCard; public: VCardPlugin(); ~VCardPlugin(); //IPlugin virtual QObject *instance() { return this; } virtual QUuid pluginUuid() const { return VCARD_UUID; } virtual void pluginInfo(IPluginInfo *APluginInfo); virtual bool initConnections(IPluginManager *APluginManager, int &AInitOrder); virtual bool initObjects(); virtual bool initSettings(); virtual bool startPlugin() { return true; } //IRosterDataHolder virtual QList<int> rosterDataRoles(int AOrder) const; virtual QVariant rosterData(int AOrder, const IRosterIndex *AIndex, int ARole) const; virtual bool setRosterData(int AOrder, const QVariant &AValue, IRosterIndex *AIndex, int ARole); //IStanzaRequestOwner virtual void stanzaRequestResult(const Jid &AStreamJid, const Stanza &AStanza); //IOptionsHolder virtual QMultiMap<int, IOptionsWidget *> optionsWidgets(const QString &ANodeId, QWidget *AParent); //IXmppUriHandler virtual bool xmppUriOpen(const Jid &AStreamJid, const Jid &AContactJid, const QString &AAction, const QMultiMap<QString, QString> &AParams); //IVCardPlugin virtual QString vcardFileName(const Jid &AContactJid) const; virtual bool hasVCard(const Jid &AContactJid) const; virtual IVCard *getVCard(const Jid &AContactJid); virtual bool requestVCard(const Jid &AStreamJid, const Jid &AContactJid); virtual bool publishVCard(IVCard *AVCard, const Jid &AStreamJid); virtual void showVCardDialog(const Jid &AStreamJid, const Jid &AContactJid); signals: void vcardReceived(const Jid &AContactJid); void vcardPublished(const Jid &AContactJid); void vcardError(const Jid &AContactJid, const XmppError &AError); // IRosterDataHolder void rosterDataChanged(IRosterIndex *AIndex, int ARole); protected: void registerDiscoFeatures(); void unlockVCard(const Jid &AContactJid); void restrictVCardImagesSize(IVCard *AVCard); void saveVCardFile(const Jid &AContactJid, const QDomElement &AElem) const; void removeEmptyChildElements(QDomElement &AElem) const; void insertMessageToolBarAction(IMessageToolBarWidget *AWidget); QList<Action *> createClipboardActions(const QSet<QString> &AStrings, QObject *AParent) const; protected slots: void onCopyToClipboardActionTriggered(bool); void onShortcutActivated(const QString &AId, QWidget *AWidget); void onRostersViewIndexContextMenu(const QList<IRosterIndex *> &AIndexes, quint32 ALabelId, Menu *AMenu); void onRostersViewIndexClipboardMenu(const QList<IRosterIndex *> &AIndexes, quint32 ALabelId, Menu *AMenu); void onMultiUserContextMenu(IMultiUserChatWindow *AWindow, IMultiUser *AUser, Menu *AMenu); void onShowVCardDialogByAction(bool); void onShowVCardDialogByMessageWindowAction(bool); void onVCardDialogDestroyed(QObject *ADialog); void onXmppStreamRemoved(IXmppStream *AXmppStream); void onMessageNormalWindowCreated(IMessageNormalWindow *AWindow); void onMessageChatWindowCreated(IMessageChatWindow *AWindow); protected slots: void onUpdateTimerTimeout(); void onRosterOpened(IRoster *ARoster); void onRosterClosed(IRoster *ARoster); void onRosterItemReceived(IRoster *ARoster, const IRosterItem &AItem, const IRosterItem &ABefore); private: IPluginManager *FPluginManager; IXmppStreams *FXmppStreams; IRosterPlugin *FRosterPlugin; IRostersModel *FRostersModel; IRostersView *FRostersView; IRostersViewPlugin *FRostersViewPlugin; IStanzaProcessor *FStanzaProcessor; IMultiUserChatPlugin *FMultiUserChatPlugin; IServiceDiscovery *FDiscovery; IXmppUriQueries *FXmppUriQueries; IMessageWidgets *FMessageWidgets; IRosterSearch *FRosterSearch; IOptionsManager *FOptionsManager; private: QDir FVCardFilesDir; QTimer FUpdateTimer; QMap<Jid,VCardItem> FVCards; QMultiMap<Jid,Jid> FUpdateQueue; QMap<QString,Jid> FVCardRequestId; QMap<QString,Jid> FVCardPublishId; QMap<QString,Stanza> FVCardPublishStanza; QMap<Jid,VCardDialog *> FVCardDialogs; mutable QHash<Jid,QStringList> FSearchStrings; }; #endif // VCARDPLUGIN_H
#define END_OF_PROGRAM 0 #define START_OF_PROGRAM 1 #define DELAY_IN_CLOCKS 2 #define DELAY_IN_MS 3 #define CHANGE_PIN 4 #define WAIT_FOR_PIN 5 #define SET_PULSE_PINS 6 #define PULSE 7 #define READ_DATA 8 #define GO 9 #define SET_FREQ 10 #define LOOP 11 #define END_LOOP 12 #define SYNC 13 #define QUERY 14 #define TOGGLE_PIN 15 #define TABLE 16
/* * Copyright (c) 2013 Mellanox Technologies, Inc. * All rights reserved. * Copyright (c) 2013 Cisco Systems, Inc. All rights reserved. * $COPYRIGHT$ * * Additional copyrights may follow * * $HEADER$ */ #include "oshmem_config.h" #include "oshmem/shmem/fortran/bindings.h" #include "oshmem/include/shmem.h" SHMEM_GENERATE_FORTRAN_BINDINGS_SUB (void, SHMEM_FINALIZE, shmem_finalize_, shmem_finalize__, shmem_finalize_f, (void), () ) void shmem_finalize_f(void) { shmem_finalize(); }
#include <assert.h> #include "json_printer.h" void print_packet_as_json(int pkt_idx) { struct packet *p = &packet_list[pkt_idx]; char * str_buf = (char*)malloc(1024); printf("{\n\t\"name\": \"%s\"", p->name); for (int idx = 0; idx < p->option_list_sz; idx++) { struct poption *o = &p->option_list[idx]; memset(str_buf,0,sizeof(str_buf)*sizeof(char)); //gp_debug("bit: %d byte: %d diff: %d",o->bit_alignment,o->data_byte_offset,o->bit_alignment/BYTE_SIZE); switch (o->otype) { case O_ATTRIBUTE: buffer_to_json_type_str(p->data, o->bit_alignment, str_buf, o); printf(",\n\t\"%s\": %s",o->name, str_buf); break; case O_DATA: printf(",\n\t\"%s\": ",o->name); if (o->type.ft == FT_CHAR) printf("\""); else printf("["); for(int i=0;i<o->data_size_i;i++) { buffer_to_json_type_str(p->data, o->bit_alignment+(i*BYTE_SIZE), str_buf, o); printf("%s",str_buf); if (i != o->data_size_i - 1 && o->type.ft != FT_CHAR) printf(","); else if (o->type.ft != FT_CHAR) printf("]"); else if (i == o->data_size_i - 1 && o->type.ft == FT_CHAR) printf("\""); } break; case O_CRC: printf(",\n\t\"%s\": ",o->name); buffer_to_json_type_str(p->data, o->bit_alignment, str_buf, o); printf("%s",str_buf); printf(",\n\t\"crc_valid\": "); if (p->crc_valid) { printf("true"); } else { printf("false"); } break; default: break; } } printf("\n}\n"); free(str_buf); } void buffer_to_json_type_str(uint8_t * buf, int buf_bit_idx,char * type_str, struct poption *o) { int dw = o->data_width; uint8_t check_bits = dw % BYTE_SIZE; uint64_t bit_mask = 0xffffffffffffffff; uint32_t buf_idx = 0; if (buf_bit_idx >= BYTE_SIZE) { buf_idx = buf_bit_idx / BYTE_SIZE; } uint32_t data_sz_bytes = dw / BYTE_SIZE; if (check_bits) { data_sz_bytes++; } uint64_t tmp_u=0; uint64_t tmp_s=0; switch(o->type.ft) { case FT_UNSIGNED: if (check_bits) { bit_mask = (1<<dw)-1; } memcpy(&tmp_u, &buf[buf_idx],data_sz_bytes); tmp_u >>= o->bit_alignment % BYTE_SIZE; //gp_debug("Val: %x bitmsk: %x raw val: %x shift: %x", tmp_u, bit_mask, buf[buf_idx], o->bit_alignment % BYTE_SIZE); sprintf(type_str,"%"PRIu64, tmp_u&bit_mask); break; case FT_SIGNED: if (check_bits) { bit_mask ^= (1<<dw)-1; } memcpy(&tmp_s, &buf[buf_idx],data_sz_bytes); tmp_s >>= o->bit_alignment % BYTE_SIZE; //gp_debug("Val: %x bitmsk: %x raw val: %x shift: %x sz: %x", tmp_s, bit_mask, buf[buf_idx], o->bit_alignment % BYTE_SIZE,dw); sprintf(type_str,"%"PRId64, tmp_s|bit_mask); break; case FT_FLOAT: if (dw == 32) { float tmp_f_32; memcpy(&tmp_f_32, &buf[buf_idx],4); sprintf(type_str,"%f", tmp_f_32); } else if (dw == 64) { double tmp_f_64; memcpy(&tmp_f_64, &buf[buf_idx],8); sprintf(type_str,"%lf", tmp_f_64); } break; case FT_CHAR: sprintf(type_str,"%c", buf[buf_idx]); break; default: assert(false); } }
#include <stdio.h> #include <stdlib.h> #include <string.h> #include <errno.h> extern int errno; #define BUF_SIZE 20480 #define BUFFER_SIZE 819200 #define ID_SIZE 50 #define IN_LOGR_SHELL ". ~/.bash_profile;onstat -l | sed -n '/Physical Logging/{ n; n; p; n; n; p; }' | awk '{ printf \"%s \", $0}'" char json_obj[BUFFER_SIZE]={0}; char json_array[BUFFER_SIZE]={0}; char array_data[100][1024]; char buf[BUFFER_SIZE]={0}; char id[ID_SIZE]={0}; const char *netType = "PF-DB-INFORMIX-LOGR"; const char *neTopType ="PF-DB-INFORMIX"; char *neName="LOGR"; void str_trim_crlf(char *str) { char *p = &str[strlen(str)-1]; while (*p == '\r' || *p == '\n') *p-- = '\0'; } void str_trim_ht(char *str) //去除\t { char *p = str; while(*p != '\0') { if(*p == '\t') *p = '\x20'; ++p; } } int split(char *str, char *seg, char array[][1024]) { int i=0; str_trim_ht(str); char *substr = strtok(str, seg); while(substr != NULL) { str_trim_crlf(substr); strcpy(array[i],substr); substr = strtok(NULL,seg); i++; } return i; } int process_arguments(int argc,char **argv) { if(argc != 2) { fprintf(stdout,"please input $:./exe id\n"); return -1; } strcpy(id, argv[1]); return 0; } int main(int argc,char **argv) { FILE *fp = NULL; char seg[10] = {" "}; int ret, line=0; ret = process_arguments(argc,argv); if(ret != 0) { return -1; } fp = popen(IN_LOGR_SHELL , "r"); if(fp == NULL) { sprintf(buf,"error:%s\n",strerror(errno)); fprintf(stdout,"%s\n",buf); return -1; } while(fgets(buf, BUF_SIZE,fp)!= NULL) { memset(array_data, 0, 100 * 1024); ret = split(buf, seg, array_data); if(ret >= 10) { if(line == 0) { sprintf(json_obj,"{\"values\":{\"PF_DB_LOGR_ADDRESS\":\"%s\",\"PF_DB_LOGR_NUMBER\":\"%s\",\"PF_DB_LOGR_FLAG\":\"%s\",\"PF_DB_LOGR_UNIQID\":\"%s\",\"PF_DB_LOGR_SIZE\":\"%s\",\"PF_DB_LOGR_USED\":\"%s\",\"PF_DB_LOGR_USED2\":\"%s\"},\"neType\":\"%s\",\"neTopType\":\"%s\",\"neId\":\"%s\",\"neName\":\"%s\"}", array_data[0],array_data[1] ,array_data[2],array_data[3],array_data[5],array_data[6],array_data[7],netType,neTopType,id,neName); } else { sprintf(json_obj,"%s,{\"values\":{\"PF_DB_LOGR_ADDRESS\":\"%s\",\"PF_DB_LOGR_NUMBER\":\"%s\",\"PF_DB_LOGR_FLAG\":\"%s\",\"PF_DB_LOGR_UNIQID\":\"%s\",\"PF_DB_LOGR_SIZE\":\"%s\",\"PF_DB_LOGR_USED\":\"%s\",\"PF_DB_LOGR_USED2\":\"%s\"},\"neType\":\"%s\",\"neTopType\":\"%s\",\"neId\":\"%s\",\"neName\":\"%s\"}", json_obj,array_data[0],array_data[1] ,array_data[2],array_data[3],array_data[5],array_data[6],array_data[7],netType,neTopType,id,neName); } line++; } } printf("%s\n",json_obj); fclose(fp); fp = NULL; return 0; }
#include "xmlscan.h" #include "thurman-test.h" #include <glib-object.h> #include <string.h> gchar* xml = "<silly>" "<ignore>this</ignore>" "<test>" "<red>gules</red>" "<blue>azure</blue>" "<green>vert</green>" "<!-- this will also be ignored -->" "as will this" "</test>" "</silly>"; gchar *broken_xml = "<something>" "<test>" "<fred>bassett</fred>" "</something>" "</test>"; static gint alpha_sort (gconstpointer a, gconstpointer b) { return strcmp ((gchar*)a, (gchar*)b); } static gchar * hash_to_string (GHashTable *hash) { gchar *result = NULL; GList *keys, *keys_cursor; if (!hash) return g_strdup ("null"); keys = g_hash_table_get_keys (hash); keys = g_list_sort (keys, alpha_sort); for (keys_cursor = keys; keys_cursor; keys_cursor = keys_cursor->next) { gchar *entry = g_strdup_printf ("%s=%s", (gchar*) keys_cursor->data, (gchar*) g_hash_table_lookup (hash, keys_cursor->data)); if (result) { gchar *temp = result; result = g_strdup_printf ("%s %s", temp, entry); g_free (temp); g_free (entry); } else { result = entry; } } return result; } static gboolean test_scan (gchar *xml, gchar *want) { GHashTable *result; gchar *str; gboolean match; GError *error = 0; result = xml_scan (xml, "test", &error); str = hash_to_string (result); if (error) { gchar *temp = str; str = g_strdup_printf ("%s - %s", str, error->message); g_free (temp); g_error_free (error); } match = strings_match (want, str); if (result) g_hash_table_unref (result); g_free (str); return match; } static gboolean simple_parse (void) { return test_scan (xml, "foo"); } static gboolean broken_parse (void) { return test_scan (broken_xml, "null"); } int test_main (int argc, char **argv) { g_type_init (); add_test ("simple-parse", THURMAN_TEST_IS_UNIT, simple_parse, "test XML parser with simple input"); add_test ("broken-parse", THURMAN_TEST_IS_UNIT, broken_parse, "test XML parser with broken input"); return 0; }
/* PANDAseq -- Assemble paired FASTQ Illumina reads and strip the region between amplification primers. Copyright (C) 2013 Andre Masella This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. */ #ifndef _PANDASEQ_URL_H # define _PANDASEQ_URL_H # include <pandaseq.h> # ifdef __cplusplus # define EXTERN_C_BEGIN extern "C" { # define EXTERN_C_END } # else # define EXTERN_C_BEGIN # define EXTERN_C_END # endif EXTERN_C_BEGIN /** * Decompress BZipped data. * @source: (closure source_data) (scope notified) (allow-none): the underlying stream to decompress. * @verbosity: the BZip logging level. * Returns:(closure data) (scope notified) (allow-none): the read function. */ PandaBufferRead panda_bz_decompress( PandaBufferRead source, void *source_data, PandaDestroy source_destroy, int verbosity, void **user_data, PandaDestroy *destroy); /** * Open a URL and read the sequence. * @url: the URL, as understood by cURL. * Returns:(closure data) (scope notified) (allow-none): the read function. */ PandaBufferRead panda_open_url( const char *url, PandaLogProxy logger, void **data, PandaDestroy *destroy); /** * Increment the reference count on the cURL library. * * Since cURL needs to be initialised, PANDAseq will do this automatically when a URL is opened and automatically call the matching clean up when all readers have been disposed. * * If the program wishes to use cURL, it should call this method to increment the reference count on PANDAseq's internal counter, such that it will not clean up the cURL library while in use. * * Returns: whether the library was successfully initialised. */ bool panda_curl_ref( void); /** * Decrement the reference count on the cURL library. */ void panda_curl_unref( void); EXTERN_C_END #endif
#pragma once #ifndef SCENE_H #define SCENE_H #include "GuiList.h" #include "Cursor.h" #include "ViewPort.h" #include "World.h" class Scene { public: Scene(); virtual ~Scene(); bool IsLoaded() const { return m_isLoaded; } bool IsShowGui() const { return m_isShowGui; } Cursor & GetCursor() { return m_cursor; } ViewPort & GetViewPort() { return m_viewPort; } int GetTilesOnScreenX() { return m_tilesOnScreenX; } int GetTilesOnScreenY() { return m_tilesOnScreenY; } ErrCode Load(); ErrCode Unload(); ErrCode SetGuiVisibility(bool pVisible); ErrCode Update(double dt); ErrCode Draw(LPD3DXSPRITE pSprite); ErrCode SetViewPortPosition(int pX, int pY); ErrCode ResetWorld(World *pWorld = nullptr); // Gui creation ErrCode CreatePanel(GPanel *&pPanel, float pPosX, float pPosY, float pSizeX, float pSizeY, std::string pTextureName); ErrCode CreateButton(GButton *&pButton, float pPosX, float pPosY, float pSizeX, float pSizeY, std::string pTexNameNormal, std::string pTexNamePressed, std::string pTexNameSelected, std::string pTexNameDisabled); ErrCode CreateText(GText *&pGText, float pPosX, float pPosY, std::string pText); // Input handlers ErrCode OnMouseMove(bool &pHandled); ErrCode OnMouseDown(int pButton, bool &pHandled); ErrCode OnMouseUp(int pButton, bool &pHandled); ErrCode OnKeyPressed(int pKey, bool &pHandled); ErrCode OnKeyDown(int pKey, bool &pHandled); ErrCode OnKeyUp(int pKey, bool &pHandled); private: bool m_isLoaded; bool m_isShowGui; Cursor m_cursor; ViewPort m_viewPort; World *m_world; std::vector<GBase *> m_guis; int m_tilesOnScreenX; int m_tilesOnScreenY; }; #endif // SCENE_H
/* * CustomizeCharacter.h * * Created on: Apr 20, 2017 * Author: Carl */ #ifndef CUSTOMIZECHARACTER_H_ #define CUSTOMIZECHARACTER_H_ #include "Bar.h" #include "Helper.h" #include "LTexture.h" #include <fstream> #include <limits> #include <sstream> class CustomizeCharacter : public Bar, public Helper { public: enum Result { Back, Nothing, StartGame, Exit }; void Show(LWindow &gWindow, SDL_Renderer *gRenderer, CustomizeCharacter::Result &result); CustomizeCharacter::Result mousePressed(SDL_Event event); CustomizeCharacter::Result mouseReleased(SDL_Event event); bool checkCollision(SDL_Rect a, SDL_Rect b); private: void load(SDL_Renderer *gRenderer); void save(); void free(); const std::string defDir = "resource/data/cfg/"; /* * 0: Player skin * 1: Player eyes * 2: Player hair * 3: Player shirt * 4: Player pants */ LTexture gPlayer[5]; // Load textures LTexture gPlayerOutline; // Player outline LTexture gBlank; // New player.png texture file LTexture gScene; // Scene texture //LTexture gText; // Font texture LTexture gBG; // Background texture LTexture gButtons; // Buttons texture SDL_Event event; // Events int x, y; // Button start position int w, h; // Button button size int mx, my; // Mouse position int mex, mey; // Mouse position based on screen wise and render size bool leftClick; // Mouse click bool quit; bool shift; /* Main Menu items * 0: Quit * 1: Save Character * 2: Start Game */ SDL_Rect button[3]; std::string buttonName[3]; /* Texture clips * 0: Up 1 * 1: Up 2 * 2: Up 3 * 3: Right 1 * 4: Right 2 * 5: Right 3 * 6: Down 1 * 7: Down 2 * 8: Down 3 */ SDL_Rect clip[9]; /* Button texture clips * 0: Quit * 1: Save Character * 2: Start Game */ SDL_Rect bClip[3]; /* * 0: r * 1: g * 2: b */ /* Save index * 0: skin * 1: eyes * 2: hair * 3: shirt * 4: pants */ int index; public: // File functions std::ifstream& GotoLine(std::ifstream& file, unsigned int num){ file.seekg(std::ios::beg); for(unsigned int i=0; i < num - 1; ++i){ file.ignore(std::numeric_limits<std::streamsize>::max(),'\n'); } return file; } // Load Player colors SDL_Color loadColor(std::string fileName, int line) { // Individual colors int red = 255; int green = 255; int blue = 255; // Temp stringstream std::stringstream tempss; tempss.str(std::string()); // Set File location tempss << "data/cfg/" << fileName.c_str(); // Create File std::ifstream tempFile(tempss.str().c_str()); // Get certain line from File GotoLine(tempFile, line); // Get data from line tempFile >> red >> green >> blue; // Close File tempFile.close(); // store color SDL_Color color = {red, green, blue}; /// return color return color; } // Load CFG file void loadCFG(std::string fileName, int &x, int &y, int line) { std::stringstream tempss; tempss.str(std::string()); // Set File location tempss << "data/cfg/" << fileName.c_str(); // Create File std::ifstream tempFile(tempss.str().c_str()); // Get certain line from File GotoLine(tempFile, line); // Get data from line tempFile >> x >> y; // Close File tempFile.close(); } // Save Player colors /*void saveColor(std::string fileName, int red, int green, int blue, int line){ // Final data to save std::stringstream tempss; // Current line index int currentLine = 0; // Current line data // File Path std::stringstream dir; // Set defult path dir << "data/cfg/"; // Set file name dir << fileName.c_str(); std::string str; // Open File std::ifstream file(dir.str().c_str()); while (getline(file, str)){ // Read current line std::istringstream iss(str); // Temp string to store Name & Score std::string temps[3]; // Store Name & Score in temp string iss >> temps[0] >> temps[1] >> temps[2]; // Overwrite line if (line-1 == currentLine) { tempss << red << " " << green << " " << blue << "\n"; } // Keep old line else{ tempss << temps[0] << " " << temps[1] << " " << temps[2] << "\n"; } // Keep track of current line currentLine++; } // Close File file.close(); // Overwrite File std::ofstream fileS; fileS.open(dir.str().c_str()); fileS << tempss.str().c_str(); fileS.close(); }*/ public: // Bar class; Bar skin; Bar eyes; Bar hair; Bar shirt; Bar pants; int getValueFromBar(int mx, int barX, int widthOnScreen, int maxValue); void update(bool leftClick); void render(SDL_Renderer *gRenderer); public: // Core functions void Render(SDL_Renderer *gRenderer); void RenderText(SDL_Renderer *gRenderer); }; #endif /* CUSTOMIZECHARACTER_H_ */
// // NSWindow+NJAdditions.h // NeoNotesMacOS // #import <Foundation/Foundation.h> @interface NSWindow(NJAdditions) - (BOOL)isFullscreen; - (BOOL)drawAsActive; @end
/* * Copyright (C) 2006-2007 Emmanuel Bouthenot <kolter@openics.org> * Copyright (C) 2006-2016 Sébastien Helleu <flashcode@flashtux.org> * * This file is part of DogeChat, the extensible chat client. * * DogeChat is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * DogeChat 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 DogeChat. If not, see <http://www.gnu.org/licenses/>. */ #ifndef DOGECHAT_LUA_H #define DOGECHAT_LUA_H 1 #define dogechat_plugin dogechat_lua_plugin #define LUA_PLUGIN_NAME "lua" #define LUA_CURRENT_SCRIPT_NAME ((lua_current_script) ? lua_current_script->name : "-") struct t_lua_const { char *name; int int_value; char *str_value; }; extern struct t_dogechat_plugin *dogechat_lua_plugin; extern int lua_quiet; extern struct t_plugin_script *lua_scripts; extern struct t_plugin_script *last_lua_script; extern struct t_plugin_script *lua_current_script; extern struct t_plugin_script *lua_registered_script; extern const char *lua_current_script_filename; extern lua_State *lua_current_interpreter; extern void dogechat_lua_pushhashtable (lua_State *interpreter, struct t_hashtable *hashtable); extern struct t_hashtable *dogechat_lua_tohashtable (lua_State *interpreter, int index, int size, const char *type_keys, const char *type_values); extern void *dogechat_lua_exec (struct t_plugin_script *script, int ret_type, const char *function, const char *format, void **argv); extern void dogechat_lua_register_lib(lua_State *L, const char *libname, const luaL_Reg *lua_api_funcs, struct t_lua_const lua_api_consts[]); #endif /* DOGECHAT_LUA_H */
/***************************************************************************** * * Copyright (c) 2000 - 2013, Lawrence Livermore National Security, LLC * Produced at the Lawrence Livermore National Laboratory * LLNL-CODE-442911 * All rights reserved. * * This file is part of VisIt. For details, see https://visit.llnl.gov/. The * full copyright notice is contained in the file COPYRIGHT located at the root * of the VisIt distribution or at http://www.llnl.gov/visit/copyright.html. * * 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 disclaimer below. * - Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the disclaimer (as noted below) in the * documentation and/or other materials provided with the distribution. * - Neither the name of the LLNS/LLNL 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 LAWRENCE LIVERMORE NATIONAL SECURITY, * LLC, THE U.S. DEPARTMENT OF ENERGY OR CONTRIBUTORS BE LIABLE FOR ANY * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH * DAMAGE. * *****************************************************************************/ #ifndef AVT_DEBUG_DUMP_OPTIONS_H #define AVT_DEBUG_DUMP_OPTIONS_H #include <pipeline_exports.h> #include <visitstream.h> #include <string> // **************************************************************************** // Class: avtDebugDumpOptions // // Purpose: // Provides static members that define global debug dump options. // These options were migrated from the avtFilter, avtTerminatingSink // and avtDataRepresentation classes b/c of growing redundancy. // // // Programmer: Cyrus Harrison // Creation: Feburary 13, 2009 // // Modifications: // // **************************************************************************** class PIPELINE_API avtDebugDumpOptions { public: virtual ~avtDebugDumpOptions(); static void EnableDump(); static void DisableDump(); static bool DumpEnabled() {return doDump;} static void EnableDatasetDump(); static void DisableDatasetDump(); static bool DatasetDumpEnabled() {return doDatasetDump;} static const std::string &GetDumpDirectory() {return outputDir;} static void SetDumpDirectory(const std::string &); private: // we dont want anyone creating an instance of this class, so make // its constructor private. avtDebugDumpOptions(); // static members static std::string outputDir; static bool doDump; static bool doDatasetDump; }; #endif
// Copyright 2019-2020 CERN and copyright holders of ALICE O2. // See https://alice-o2.web.cern.ch/copyright for details of the copyright holders. // All rights not expressly granted are reserved. // // This software is distributed under the terms of the GNU General Public // License v3 (GPL Version 3), copied verbatim in the file "COPYING". // // In applying this license CERN does not waive the privileges and immunities // granted to it by virtue of its status as an Intergovernmental Organization // or submit itself to any jurisdiction. /// \file ROFRecord.h /// \brief Definition of the MCH ROFrame record /// /// \author Philippe Pillot, Subatech #ifndef ALICEO2_MCH_ROFRECORD_H #define ALICEO2_MCH_ROFRECORD_H #include "CommonDataFormat/InteractionRecord.h" #include "CommonDataFormat/RangeReference.h" #include <ostream> #include <iosfwd> namespace o2 { namespace mch { /// ROFRecord class encodes the trigger interaction record of a given ROF and /// the location of the associated objects (digit, cluster, etc) in the data container class ROFRecord { using BCData = o2::InteractionRecord; using DataRef = o2::dataformats::RangeReference<int, int>; public: ROFRecord() = default; ROFRecord(const BCData& bc, int firstIdx, int nEntries) : mBCData(bc), mDataRef(firstIdx, nEntries) {} /// get the interaction record const BCData& getBCData() const { return mBCData; } /// get the interaction record BCData& getBCData() { return mBCData; } /// set the interaction record void setBCData(const BCData& bc) { mBCData = bc; } /// get the number of associated objects int getNEntries() const { return mDataRef.getEntries(); } /// get the index of the first associated object int getFirstIdx() const { return mDataRef.getFirstEntry(); } /// get the index of the last associated object int getLastIdx() const { return mDataRef.getFirstEntry() + mDataRef.getEntries() - 1; } /// set the number of associated objects and the index of the first one void setDataRef(int firstIdx, int nEntries) { mDataRef.set(firstIdx, nEntries); } bool operator==(const ROFRecord& other) const { return mBCData == other.mBCData && mDataRef == other.mDataRef; } bool operator<(const ROFRecord& other) const { if (mBCData == other.mBCData) { return mDataRef.getFirstEntry() < other.mDataRef.getFirstEntry(); } return mBCData < other.mBCData; } private: BCData mBCData{}; ///< interaction record DataRef mDataRef{}; ///< reference to the associated objects ClassDefNV(ROFRecord, 1); }; std::ostream& operator<<(std::ostream& os, const ROFRecord& rof); } // namespace mch } // namespace o2 #endif // ALICEO2_MCH_ROFRECORD_H
/* -------------------------------------------------------------------------- Azure Cube - Copyright (C) 2014 Long Island Ice Tea Inc. This file is part of Azure Cube. Azure Cube is free; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. Azure Cube 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/>. -------------------------------------------------------------------------- */ /* -------------------------------------------------------------------------- -- Project Code : azure3 -- File Name : cube.c -- Author : manu -- Description : This file describes the cube refresh & mapping functions. -------------------------------------------------------------------------- */ #include "wiringPi.h" #include "tlc5940.h" #include "cube.h" //Global Buffer to hold LED PWM data for the cube static TLC_Cube_t cube_bffr; PI_THREAD (refreshCube) { int plane_num,line,led; plane_num = 0; for(;;) { updateTLC5940(cube_bffr.plane[plane_num].chip); //Add switch for plane here!!!!!!!! //delay(CUBE_REFRESH_DELAY_MS); if(plane_num == CUBE_Z-1) plane_num = 0; else plane_num++; } } void update_TLC_Cube_Element(unsigned char x, unsigned char y, unsigned char z, short val) { cube_bffr.plane[z].chip[y >> 1].chan[((y & 0x1) << 3) + x] = val; return; }
#ifndef MAINWINDOW_H #define MAINWINDOW_H #include <QMainWindow> #include <QPaintEvent> namespace Ui { class MainWindow; } class MainWindow : public QMainWindow { Q_OBJECT public: void resizeEvent(QResizeEvent *e); explicit MainWindow(QWidget *parent = 0); ~MainWindow(); private: Ui::MainWindow *ui; }; #endif // MAINWINDOW_H
/* FrSkyGPS 10Hz firmware Copyright (C) 2016 David S. Beach mailto:david.s.beach@gmail.com This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. */ #ifndef __UBlox7_h #define __UBlox7_h #include <string.h> #include <stdio.h> #include <stdint.h> class UBlox7 { public: static const char* SET_BAUD_57600; static const uint8_t UBX_CFG_RATE_10HZ[14]; }; #endif
/* * Copyright 2011 Free Software Foundation, Inc. * * This file is part of GNU Radio * * GNU Radio is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3, or (at your option) * any later version. * * GNU Radio 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 GNU Radio; see the file COPYING. If not, write to * the Free Software Foundation, Inc., 51 Franklin Street, * Boston, MA 02110-1301, USA. */ #ifndef INCLUDED_SIGMF_API_H #define INCLUDED_SIGMF_API_H #include <gnuradio/attributes.h> #ifdef gnuradio_sigmf_EXPORTS # define SIGMF_API __GR_ATTR_EXPORT #else # define SIGMF_API __GR_ATTR_IMPORT #endif #endif /* INCLUDED_SIGMF_API_H */
/* * SimpleCsv.h * * Copyright (C) 2015 Holger Grosenick * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #ifndef UTILS_SIMPLECSV_H_ #define UTILS_SIMPLECSV_H_ #include "FileObject.h" namespace utils { /** * Small class that reads CSV files in a very simple way. The class does not support * CSV files with just one column (without separator): use plain text methods of * the FileObject instead. */ class SimpleCsvBase : public FileObject { protected: unsigned numCols; unsigned line; char comment; char columnSep; void open(const char *filename); public: /** * Open the given CSV file, if the given separator is -1, is class tries * to determines the separator itself: depending on the first data line, it * searches for ';', TAB and '|' and the first char found will be the separator. * <P> * The constructor throws an Exception if the file cannot be read! */ SimpleCsvBase(const char *name, char comment = '#', char sep = -1); SimpleCsvBase(const std::string &name, char comment = '#', char sep = -1); SimpleCsvBase(const File &file, char comment = '#', char sep = -1); /** * Returns the number of columns detected in the first (!) line. */ unsigned getNumCols() const { return numCols; } /** * Returns the column separator detected in the first (!) line. */ char getColumnSep() const { return columnSep; } unsigned getLine() const { return line; } }; /** * Small class that reads CSV files in a very simple way. The class does not support * CSV files with just one column (without separator): use plain text methods of * the FileObject instead. */ template <typename _Tp> class SimpleCsvTmpl : public SimpleCsvBase { protected: std::vector< _Tp > cols; public: /** * Open the given CSV file, if the given separator is -1, is class tries * to determines the separator itself: depending on the first data line, it * searches for ';', TAB and '|' and the first char found will be the separator. * <P> * The constructor throws an Exception if the file cannot be read! */ SimpleCsvTmpl(const char *name, char comment = '#', char sep = 0) : SimpleCsvBase(name, comment, sep) { } SimpleCsvTmpl(const std::string &name, char comment = '#', char sep = 0) : SimpleCsvBase(name, comment, sep) { } SimpleCsvTmpl(const File &file, char comment = '#', char sep = 0) : SimpleCsvBase(file, comment, sep) { } /** * Returns a read reference to the column vector. */ const std::vector< _Tp >& getColumns() const { return cols; } /** * Gets the columns value of the given column as integer. */ int getInt(unsigned no) const; /** * Gets the columns value of the given column as string. */ const _Tp& getString(unsigned no) const { return cols[no]; } /** * Gets the columns value of the given column as char. */ char getChar(unsigned no) const { return cols[no][0]; } /** * Loads the next line into the internal vector (calls {@link FileObject::getCols()} internally). * Return true if data was read, false on EOF. The method will skip empty lines, which means that * the column vectors has more than 0 columns afterwards. * <P> * Only this methods increments the line number. */ bool loadLine() { cols.clear(); do { if (getCols(cols, true, comment, columnSep) < 0) return false; ++line; } while (cols.empty()); return true; } }; /** * Type specific implementation of this method. */ template<> inline int SimpleCsvTmpl<std::string>::getInt(unsigned no) const { return atoi(cols[no].c_str()); } template<> inline int SimpleCsvTmpl<const char*>::getInt(unsigned no) const { return atoi(cols[no]); } typedef SimpleCsvTmpl<std::string> SimpleCsv; typedef SimpleCsvTmpl<const char*> SimpleCsvCharP; } /* namespace parsers */ #endif /* UTILS_SIMPLECSV_H_ */
#ifndef __UAPI_CORESIGHT_STM_H_ #define __UAPI_CORESIGHT_STM_H_ #define STM_FLAG_TIMESTAMPED BIT(3) #define STM_FLAG_GUARANTEED BIT(7) /* * The CoreSight STM supports guaranteed and invariant timing * transactions. Guaranteed transactions are guaranteed to be * traced, this might involve stalling the bus or system to * ensure the transaction is accepted by the STM. While invariant * timing transactions are not guaranteed to be traced, they * will take an invariant amount of time regardless of the * state of the STM. */ enum { STM_OPTION_GUARANTEED = 0, STM_OPTION_INVARIANT, }; #endif
#include <pp_bandwidth.h> enum PP_ANALYZER_ACTION pp_bandwidth_inspect(uint32_t idx, struct pp_packet_context *pkt_ctx, struct pp_flow *flow_ctx) { struct __pp_bandwidth_data *data = pp_analyzer_storage_get_next_location(idx, pkt_ctx, flow_ctx); if (likely(data)) { data->bytes = pkt_ctx->length; } return PP_ANALYZER_ACTION_NONE; } /** * @brief private analyzer callback called with analyzers data related to the given flow * @param data ptr to the collected data * @param ts timestamp of the data set * @param direction the associated packet was captured */ static void __pp_bandwidth_analyze(void *data, uint64_t ts, int direction) { struct __pp_bandwidth_data *bandwidth_data = data; if (pp_bandwidth_report_data.size == 0 || (pp_bandwidth_report_data.size > 0 && (ts - pp_bandwidth_report_data.data[pp_bandwidth_report_data.size - 1].start_ts_usec) >= BANDWIDTH_ANALYZER_RESOLUTION)) { /* add new sample set */ pp_bandwidth_report_data.size++; pp_bandwidth_report_data.data = realloc(pp_bandwidth_report_data.data, (pp_bandwidth_report_data.size) * sizeof(struct __pp_bandwidth_report_data)); if (!pp_bandwidth_report_data.data) { pp_bandwidth_report_data.size = 0; return; } pp_bandwidth_report_data.data[pp_bandwidth_report_data.size - 1].start_ts_usec = ts; pp_bandwidth_report_data.data[pp_bandwidth_report_data.size - 1].end_ts_usec = 0; pp_bandwidth_report_data.data[pp_bandwidth_report_data.size - 1].is_valid = 0; pp_bandwidth_report_data.data[pp_bandwidth_report_data.size - 1].bytes_upstream = 0; pp_bandwidth_report_data.data[pp_bandwidth_report_data.size - 1].bytes_downstream = 0; } /* add data */ pp_bandwidth_report_data.data[pp_bandwidth_report_data.size - 1].end_ts_usec = ts; if (direction == PP_PKT_DIR_UPSTREAM) { pp_bandwidth_report_data.data[pp_bandwidth_report_data.size - 1].bytes_upstream += bandwidth_data->bytes; } else { pp_bandwidth_report_data.data[pp_bandwidth_report_data.size - 1].bytes_downstream += bandwidth_data->bytes; } } /* analyse function */ void pp_bandwidth_analyze(uint32_t idx, struct pp_flow *flow_ctx) { int i = 0; uint64_t delta_t = 0; free(pp_bandwidth_report_data.data); pp_bandwidth_report_data.data = NULL; pp_bandwidth_report_data.size = 0; i = pp_analyzer_callback_for_each_entry(idx, flow_ctx, &__pp_bandwidth_analyze); /* calculate bandwith for all entries */ for (i = 0; i < pp_bandwidth_report_data.size; i++) { delta_t = pp_bandwidth_report_data.data[i].end_ts_usec - pp_bandwidth_report_data.data[i].start_ts_usec; /* accept +10% inaccuracy */ if (delta_t >= (BANDWIDTH_ANALYZER_RESOLUTION*0.90)) { pp_bandwidth_report_data.data[i].sample_time_usec = pp_bandwidth_report_data.data[i].start_ts_usec + (delta_t/2); pp_bandwidth_report_data.data[i].bandwidth_upstream = pp_bandwidth_report_data.data[i].bytes_upstream * 800000. / delta_t; pp_bandwidth_report_data.data[i].bandwidth_downstream = pp_bandwidth_report_data.data[i].bytes_downstream * 800000. / delta_t; pp_bandwidth_report_data.data[i].bandwidth_total = pp_bandwidth_report_data.data[i].bandwidth_upstream + pp_bandwidth_report_data.data[i].bandwidth_downstream; pp_bandwidth_report_data.data[i].is_valid = 1; } /* covers valid timespan */ } /* __loop_entries */ } /** * @brief create a bandwidth report * @note the caller must free the returned string * @retval ptr to string containing the report * @retval NULL on error */ char* pp_bandwidth_report(uint32_t idx, struct pp_flow *flow_ctx) { int i = 0, c = 0; char *buf = NULL; uint32_t buf_size = BANDWIDTH_ANALYZER_REPORT_BUFFER_STEP; int wpos = 0; /* TODO@SIMON: transform to rest output if rest backend is enabled */ if(pp_bandwidth_report_data.size > BANDWIDTH_ANALYZER_MIN_SAMPLE_COUNT) { if (!(buf = malloc(buf_size * sizeof(char)))) { return NULL; } wpos += sprintf(buf, "{"); for (i = 0; i < pp_bandwidth_report_data.size; i++) { if (pp_bandwidth_report_data.data[i].is_valid) { c++; wpos += sprintf(&buf[wpos], "{%" PRIu64 ",%.0f,%.0f,%.0f},", pp_bandwidth_report_data.data[i].sample_time_usec, pp_bandwidth_report_data.data[i].bandwidth_upstream, pp_bandwidth_report_data.data[i].bandwidth_downstream, pp_bandwidth_report_data.data[i].bandwidth_total); } if (wpos > (buf_size - 200)) { buf_size += BANDWIDTH_ANALYZER_REPORT_BUFFER_STEP; if (!(buf = realloc(buf, buf_size * sizeof(char)))) { return NULL; } } } /* __loop collected report data */ if ( c == 0 ) { free(buf); return NULL; } wpos--; buf[wpos] = '}'; buf[wpos + 1] = '\0'; return buf; } else { /* no data available */ return NULL; } } /* self description function */ char* pp_bandwidth_describe(void) { /* TODO */ return strdup("calculate used bandwidth per flow in bit per second"); } /* init private data */ void pp_bandwidth_init(uint32_t idx, struct pp_flow *flow_ctx, enum PP_ANALYZER_MODES mode, uint32_t mode_val) { PP_ANALYZER_STORE_INIT(pp_bandwidth, idx, flow_ctx, mode, mode_val); pp_bandwidth_report_data.data = NULL; pp_bandwidth_report_data.size = 0; } /* free all data */ void pp_bandwidth_destroy(uint32_t idx, struct pp_flow *flow_ctx) { free(pp_bandwidth_report_data.data); pp_bandwidth_report_data.data = NULL; pp_bandwidth_report_data.size = 0; /* free analyzer data */ pp_analyzer_storage_destroy(idx, flow_ctx); } /* return unique analyzer db id */ uint32_t pp_bandwidth_id(void) { return PP_BANDWIDTH_ANALYZER_DB_ID; }
// // UMGSMMAP_SendIdentificationRes.h // ulibgsmmap // // Copyright © 2017 Andreas Fink (andreas@fink.org). All rights reserved. // // This source is dual licensed either under the GNU GENERAL PUBLIC LICENSE // Version 3 from 29 June 2007 and other commercial licenses available by // the author. // #import <ulibasn1/ulibasn1.h> #import "UMGSMMAP_asn1_protocol.h" #import "UMGSMMAP_IMSI.h" #import "UMGSMMAP_AuthenticationSetList.h" #import "UMGSMMAP_CurrentSecurityContext.h" #import "UMGSMMAP_ExtensionContainer.h" @interface UMGSMMAP_SendIdentificationRes : UMASN1Sequence<UMGSMMAP_asn1_protocol> { NSString *operationName; UMGSMMAP_IMSI *imsi; UMGSMMAP_AuthenticationSetList *authenticationSetList; UMGSMMAP_CurrentSecurityContext *currentSecurityContext; UMGSMMAP_ExtensionContainer *extensionContainer; } @property(readwrite,strong) NSString *operationName; @property(readwrite,strong) UMGSMMAP_IMSI *imsi; @property(readwrite,strong) UMGSMMAP_AuthenticationSetList *authenticationSetList; @property(readwrite,strong) UMGSMMAP_CurrentSecurityContext *currentSecurityContext; @property(readwrite,strong) UMGSMMAP_ExtensionContainer *extensionContainer; - (void)processBeforeEncode; - (UMGSMMAP_SendIdentificationRes *)processAfterDecodeWithContext:(id)context; - (NSString *)objectName; - (id)objectValue; - (UMASN1Object<UMGSMMAP_asn1_protocol> *)decodeASN1opcode:(int64_t)opcode operationType:(UMTCAP_InternalOperation)operation operationName:(NSString **)xop withContext:(id)context; @end
/* Copyright (C) 2018 Magnus Lång and Tuan Phong Ngo * This benchmark is part of SWSC */ #include <assert.h> #include <stdint.h> #include <stdatomic.h> #include <pthread.h> atomic_int vars[3]; atomic_int atom_1_r1_1; atomic_int atom_1_r7_0; void *t0(void *arg){ label_1:; atomic_store_explicit(&vars[0], 1, memory_order_seq_cst); atomic_store_explicit(&vars[1], 1, memory_order_seq_cst); return NULL; } void *t1(void *arg){ label_2:; int v2_r1 = atomic_load_explicit(&vars[1], memory_order_seq_cst); int v4_r3 = atomic_load_explicit(&vars[1], memory_order_seq_cst); int v5_r4 = v4_r3 ^ v4_r3; int v8_r5 = atomic_load_explicit(&vars[2+v5_r4], memory_order_seq_cst); int v10_r7 = atomic_load_explicit(&vars[0], memory_order_seq_cst); int v14 = (v2_r1 == 1); atomic_store_explicit(&atom_1_r1_1, v14, memory_order_seq_cst); int v15 = (v10_r7 == 0); atomic_store_explicit(&atom_1_r7_0, v15, memory_order_seq_cst); return NULL; } int main(int argc, char *argv[]){ pthread_t thr0; pthread_t thr1; atomic_init(&vars[1], 0); atomic_init(&vars[2], 0); atomic_init(&vars[0], 0); atomic_init(&atom_1_r1_1, 0); atomic_init(&atom_1_r7_0, 0); pthread_create(&thr0, NULL, t0, NULL); pthread_create(&thr1, NULL, t1, NULL); pthread_join(thr0, NULL); pthread_join(thr1, NULL); int v11 = atomic_load_explicit(&atom_1_r1_1, memory_order_seq_cst); int v12 = atomic_load_explicit(&atom_1_r7_0, memory_order_seq_cst); int v13_conj = v11 & v12; if (v13_conj == 1) assert(0); return 0; }
/* * UCW Library -- Large File Support * * (c) 1999--2002 Martin Mares <mj@ucw.cz> * * This software may be freely distributed and used according to the terms * of the GNU Lesser General Public License. */ #ifndef _UCW_LFS_H #define _UCW_LFS_H #include <fcntl.h> #include <unistd.h> #ifdef CONFIG_LFS #define ucw_open open64 #define ucw_seek lseek64 #define ucw_pread pread64 #define ucw_pwrite pwrite64 #define ucw_ftruncate ftruncate64 #define ucw_mmap(a,l,p,f,d,o) mmap64(a,l,p,f,d,o) #define ucw_pread pread64 #define ucw_pwrite pwrite64 #define ucw_stat stat64 #define ucw_fstat fstat64 typedef struct stat64 ucw_stat_t; #else /* !CONFIG_LFS */ #define ucw_open open #define ucw_seek(f,o,w) lseek(f,o,w) #define ucw_ftruncate(f,o) ftruncate(f,o) #define ucw_mmap(a,l,p,f,d,o) mmap(a,l,p,f,d,o) #define ucw_pread pread #define ucw_pwrite pwrite #define ucw_stat stat #define ucw_fstat fstat typedef struct stat ucw_stat_t; #endif /* !CONFIG_LFS */ #if defined(_POSIX_SYNCHRONIZED_IO) && (_POSIX_SYNCHRONIZED_IO > 0) #define ucw_fdatasync fdatasync #else #define ucw_fdatasync fsync #endif #define HAVE_PREAD static inline ucw_off_t ucw_file_size(const char *name) { int fd = ucw_open(name, O_RDONLY); if (fd < 0) die("Cannot open %s: %m", name); ucw_off_t len = ucw_seek(fd, 0, SEEK_END); close(fd); return len; } #endif /* !_UCW_LFS_H */
//! ofxGuiGrid.h /*! * * * Created by Yishi Guo on 06/05/2011. * Copyright 2011 NUI Group. All rights reserved. * */ // ---------------------------------------------- #ifndef OFX_GUI_GRID #define OFX_GUI_GRID // ---------------------------------------------- #define GRID_WIDTH_SCALE 4 #define GRID_HEIGHT_SCALE 3 #define CAMERAS_ID_OFFSET 1000 // ---------------------------------------------- #include "ofxGuiTypes.h" #include "ofxGuiObject.h" #include "ofxGuiImage.h" #include "ofxGuiButton.h" #include "ofxMultiplexerManager.h" // ---------------------------------------------- class ofxGuiGrid : public ofxGuiObject { public: ofxGuiGrid(); ~ofxGuiGrid(); void init( int id, string name, int x, int y, int width, int height, int xGrid, int yGrid, int border, int spacing, int mode ); ofxGuiObject* addButton( int id, string name, int x, int y, int width, int height, bool value, int display ); bool removeControl( int id ); bool removeControls(); void setXY( int x, int y ); void setSelectedId( int index ); void setMultiplexerManager( ofxMultiplexerManager* manager ); void setOffset( int offset ); void setMode( int mode, bool value = true ); void setDraggingRawIndex( int index ); void setImages(); void resetAll(); void setActive( bool active = true ); void setDrawInfo( bool draw = true ); void setDrawSelectedText( bool draw = true ); void setShowResetBtn( bool show = true ); void setResetBtnId( int id ); void setShowSettingBtn( bool show = true ); void setSettingBtnId( int id ); void enableDblClickMode( bool enable = true ); bool next(); bool previous(); float getGridX( int x ); float getGridY( int y ); float getGridWidth(); float getGridHeight(); float getDraggingXOffset(); float getDraggingYOffset(); int getIndexOffset(); int getSelectedId(); int getRawIdByDisplayId( int id ); //! Return the first image ofxGuiImage* getFirstImage(); ofxGuiObject* addImage( int id, string name, int targetId, unsigned char* image ); bool update( int id, int task, void* data, int length ); bool update(); void draw(); bool mouseDragged( int x, int y, int button ); bool mousePressed( int x, int y, int button ); bool mouseReleased( int x, int y, int button ); void buildFromXml(); void saveToXml(); int mWidthScale, mHeightScale; float mGridWidth, mGridHeight; int mXGrid, mYGrid, mBorder, mSpacing; int mValue, mSelectedId; int mTotal; int mDisplayMode; float mColorR, mColorG, mColorB, mColorA; ofxGuiImage** gridImages; ofxMultiplexerManager* multiplexerManager; //bool* isSelected; private: void calculateWH(); void calculateDblClickImgWH( float &width, float &height ); int mouseToGridId( ofxPoint2f point ); void drawSelectedRect( float x, float y, float width, float height ); void clearSelectedColor(); void selectedColor(); float getColorR(); float getColorG(); float getColorB(); float getColorA(); void clearImages(); void createImages(); void setTitles(); void switchDblClickMode( bool dblClick ); int mIndexOffset; int mCamIndex; //! index of all raw cams float mDraggingXOffset; float mDraggingYOffset; //! Selected color calculation unsigned long mOldTime; unsigned long mNowTime; int mInterval; float mOffset; bool mRising; //////////////// //! Dragging bool mIsSelectable; bool mDragging; ofxPoint2f clickingPoint; bool mValidSelection; int mDraggingRawIndex; ////////////////// bool mIsActive; bool bDrawSelectedText; ////////////////// vector<ofxGuiObject*> mObjects; bool bShowResetBtn; int mResetBtnId; bool bShowSettingBtn; int mSettingBtnId; int rawIdArray[256]; ////////////////// bool bDblClickMode; bool bCanDblClickMode; unsigned long mPrevClickTime; unsigned long mNowClickTime; ofxGuiImage* dblClickImage; }; // ---------------------------------------------- #endif
#include <math.h> #ifdef _OPENMP #include <omp.h> #endif #include <stdlib.h> // for NULL #include <R.h> #include <Rinternals.h> #include <R_ext/Rdynload.h> /* FIXME: Check these declarations against the C/Fortran source code. */ /* .Call calls */ extern SEXP pmm_impute_dbl(SEXP, SEXP); static const R_CallMethodDef CallEntries[] = { {"pmm_impute_dbl", (DL_FUNC) &pmm_impute_dbl, 2}, {NULL, NULL, 0} }; void R_init_simputation(DllInfo *dll) { R_registerRoutines(dll, NULL, CallEntries, NULL, NULL); R_useDynamicSymbols(dll, FALSE); }
/* * File: GLBaseApp.h * Author: damiles * * Created on 23 de enero de 2012, 21:40 */ #ifndef GLBASEAPP_H #define GLBASEAPP_H #include <Core/DisplayObject.h> #include <Events/MouseEvent.h> #ifdef __APPLE__ #include <OpenGL/gl.h> #include <OpenGL/glu.h> #else #include <GL/gl.h> #include <GL/glu.h> #endif namespace UI { class GLBaseApp: public Core::DisplayObject { public: GLBaseApp(); GLBaseApp(const GLBaseApp& orig); virtual ~GLBaseApp(); void render(); void mouseEvent(int button, int state, int x, int y); void selection(Events::MouseEvent e); private: }; } #endif /* GLBASEAPP_H */
/* {{{ This file is part of DPGSolver. DPGSolver is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or any later version. DPGSolver 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 DPGSolver. If not, see <http://www.gnu.org/licenses/>. }}} */ #ifndef DPG__mesh_readers_h__INCLUDED #define DPG__mesh_readers_h__INCLUDED /** \file * \brief Provides the interface to mesh reader containers and functions. */ struct Vector_i; #include <stddef.h> #define GMSH_N_TAGS 2 ///< Expected number of tags for elements in the gmsh file. /** \brief Holds data read from the mesh file. * * A detailed description of the variables constructed from a Gmsh .msh file can be found in the * [File formats][gmsh_ff] section of the Gmsh manual. * * <!-- References: --> * [gmsh_ff]: http://gmsh.info/doc/texinfo/gmsh.html#File-formats */ struct Mesh_Data { const int d; ///< The dimension. const ptrdiff_t ind_v; ///< The index of the first volume in the list of elements. const struct const_Vector_i*const elem_per_dim; ///< The number of elements per dimension. const struct const_Matrix_d*const nodes; ///< The xyz coordinates of the mesh elements (the mesh vertices). const struct const_Vector_i*const elem_types; ///< The list of element types. const struct const_Matrix_i*const elem_tags; /**< The list of element tags. * The 1st tag gives boundary condition information. * The 2nd tag gives periodic connectivity information. */ const struct const_Multiarray_Vector_i*const node_nums; ///< The list of node numbers for the elements. /** The periodic entity correspondence. * Currently used only as an indicator for whether periodic boundaries are present. * Potentially change to simple boolean flag after testing. */ const struct const_Matrix_i*const periodic_corr; }; /** \brief Constructor for the \ref Mesh_Data from the input mesh file. * \return Standard. */ struct Mesh_Data* constructor_Mesh_Data (const char*const mesh_name_full, ///< Mesh file name. const int d ///< Dimension. ); /// \brief Destructor for \ref Mesh_Data\*. void destructor_Mesh_Data (struct Mesh_Data* mesh_data ///< Standard. ); /// \brief Reorder the nodes such that they correspond to the ordering convention of this code. void reorder_nodes_gmsh (const int elem_type, ///< Defined in \ref Mesh_Data. struct Vector_i* node_nums ///< Defined in \ref Mesh_Data. ); /** \brief Get the number of nodes specifying the geometry for the element of the given type. * \return See brief. * * The convention for the element type numbering is that of gmsh. */ int get_n_nodes (const int elem_type ///< The element type. ); #endif // DPG__mesh_readers_h__INCLUDED
/* ** ClanLib SDK ** Copyright (c) 1997-2005 The ClanLib Team ** ** This software is provided 'as-is', without any express or implied ** warranty. In no event will the authors be held liable for any damages ** arising from the use of this software. ** ** Permission is granted to anyone to use this software for any purpose, ** including commercial applications, and to alter it and redistribute it ** freely, subject to the following restrictions: ** ** 1. The origin of this software must not be misrepresented; you must not ** claim that you wrote the original software. If you use this software ** in a product, an acknowledgment in the product documentation would be ** appreciated but is not required. ** 2. Altered source versions must be plainly marked as such, and must not be ** misrepresented as being the original software. ** 3. This notice may not be removed or altered from any source distribution. ** ** Note: Some of the libraries ClanLib may link to may have additional ** requirements or restrictions. ** ** File Author(s): ** ** Magnus Norddahl ** (if your name is missing here, please add it) */ //! clanSound="Sound Providers" //! header=sound.h #ifndef header_sound_provider_wave #define header_sound_provider_wave #ifdef CL_API_DLL #ifdef CL_SOUND_EXPORT #define CL_API_SOUND __declspec(dllexport) #else #define CL_API_SOUND __declspec(dllimport) #endif #else #define CL_API_SOUND #endif #if _MSC_VER > 1000 #pragma once #endif #include "../soundprovider.h" #include <string> class CL_InputSourceProvider; class CL_SoundProvider_Wave_Generic; //: Windows WAVE sample format (.wav) sound provider. //- !group=Sound/Sound Providers! //- !header=sound.h! class CL_API_SOUND CL_SoundProvider_Wave : public CL_SoundProvider { //! Construction: public: //: Constructs a sound provider based on a Windows wave (.wav) file. //param filename: Filename of wave file. //param provider: Input source provider used to retrieve wave file. //param stream: If true, will stream from disk. If false, will load it to memory. CL_SoundProvider_Wave( const std::string &filename, CL_InputSourceProvider *provider = 0, bool stream = false); virtual ~CL_SoundProvider_Wave(); //! Operations: public: //: Called by CL_SoundBuffer when a new session starts. //return: The soundbuffer session to be attached to the newly started session. virtual CL_SoundProvider_Session *begin_session(); //: Called by CL_SoundBuffer when a session has finished. After this call, //- <p>CL_SoundBuffer will not access the session anymore. It can safely be deleted //- here (and in most cases should be delete here).</p> virtual void end_session(CL_SoundProvider_Session *session); //! Implementation: private: CL_SoundProvider_Wave_Generic *impl; }; #endif
// // IGEGroup.h // iGenda // // Created by Diego Ojeda García on 22/01/14. // Copyright (c) 2014 UMA. All rights reserved. // #import <Foundation/Foundation.h> #import <CoreData/CoreData.h> @class Contact; @interface IGEGroup : NSManagedObject @property (nonatomic, retain) NSString * nombre; @property (nonatomic, retain) NSSet *contactos; @end @interface IGEGroup (CoreDataGeneratedAccessors) - (void)addContactosObject:(Contact *)value; - (void)removeContactosObject:(Contact *)value; - (void)addContactos:(NSSet *)values; - (void)removeContactos:(NSSet *)values; @end
#ifndef CIRCUIT_WIDGET__INCLUDED #define CIRCUIT_WIDGET__INCLUDED #include <gtkmm/drawingarea.h> #include "circuit.h" struct circuit_widget_t : public Gtk::DrawingArea { public: circuit_widget_t (); ~circuit_widget_t (); protected: /* Signal handlers */ virtual bool on_expose_event (GdkEventExpose*); private: circuit_t* circuit; }; #endif
/* Monolith 2 Copyright (C) 2017-2020 Jonas Mayr This file is part of Monolith. Monolith is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. Monolith 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 Monolith. If not, see <http://www.gnu.org/licenses/>. */ #pragma once #include "main.h" // tuning evaluation parameters with the Texel tuning method namespace texel { #if defined(TUNE) void tune(std::string &epd_file, int thread_cnt); #else inline void tune(std::string&, int) {} #endif }
/* * Copyright (c) 1999 Apple Computer, Inc. All rights reserved. * * @APPLE_LICENSE_HEADER_START@ * * "Portions Copyright (c) 1999 Apple Computer, Inc. All Rights * Reserved. This file contains Original Code and/or Modifications of * Original Code as defined in and that are subject to the Apple Public * Source License Version 1.0 (the 'License'). You may not use this file * except in compliance with the License. Please obtain a copy of the * License at http://www.apple.com/publicsource and read it before using * this file. * * The Original Code and all software distributed under the License are * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT. Please see the * License for the specific language governing rights and limitations * under the License." * * @APPLE_LICENSE_HEADER_END@ */ /* * decomment.c * * Removes all comments and (optionally) whitespace from an input file. * Writes result on stdout. */ #include <stdio.h> #include <ctype.h> /* for isspace */ #include <libc.h> /* * State of input scanner. */ typedef enum { IS_NORMAL, IS_SLASH, // encountered opening '/' IS_IN_COMMENT, // within / * * / comment IS_STAR, // encountered closing '*' IS_IN_END_COMMENT // within / / comment } input_state_t; static void usage(char **argv); int main(int argc, char **argv) { FILE *fp; char bufchar; input_state_t input_state = IS_NORMAL; int exit_code = 0; int remove_whitespace = 0; int arg; if(argc < 2) usage(argv); for(arg=2; arg<argc; arg++) { switch(argv[arg][0]) { case 'r': remove_whitespace++; break; default: usage(argv); } } fp = fopen(argv[1], "r"); if(!fp) { fprintf(stderr, "Error opening %s\n", argv[1]); perror("fopen"); exit(1); } for(;;) { bufchar = getc_unlocked(fp); if (bufchar == EOF) break; switch(input_state) { case IS_NORMAL: if(bufchar == '/') { /* * Might be start of a comment. */ input_state = IS_SLASH; } else { if(!(remove_whitespace && isspace(bufchar))) { putchar_unlocked(bufchar); } } break; case IS_SLASH: switch(bufchar) { case '*': /* * Start of normal comment. */ input_state = IS_IN_COMMENT; break; case '/': /* * Start of 'to-end-of-line' comment. */ input_state = IS_IN_END_COMMENT; break; default: /* * Not the start of comment. Emit the '/' * we skipped last char in case we were * entering a comment this time, then the * current char. */ putchar_unlocked('/'); if(!(remove_whitespace && isspace(bufchar))) { putchar_unlocked(bufchar); } input_state = IS_NORMAL; break; } break; case IS_IN_COMMENT: if(bufchar == '*') { /* * Maybe ending comment... */ input_state = IS_STAR; } break; case IS_STAR: switch(bufchar) { case '/': /* * End of normal comment. */ input_state = IS_NORMAL; break; case '*': /* * Still could be one char away from end * of comment. */ break; default: /* * Still inside comment, no end in sight. */ input_state = IS_IN_COMMENT; break; } break; case IS_IN_END_COMMENT: if(bufchar == '\n') { /* * End of comment. Emit the newline if * appropriate. */ if(!remove_whitespace) { putchar_unlocked(bufchar); } input_state = IS_NORMAL; } break; } /* switch input_state */ } /* main read loop */ /* * Done. */ return(exit_code); } static void usage(char **argv) { printf("usage: %s infile [r(emove whitespace)]\n", argv[0]); exit(1); }
// // ViewController.h // Adblock Fast // // Created by Brian Kennish on 8/19/15. // Copyright © 2015, 2016 Rocketship. All rights reserved. // #import <UIKit/UIKit.h> @interface ViewController : UIViewController @end
/* Myrddin XBoard / WinBoard compatible chess engine written in C Copyright(C) 2021 John Merlino This program is free software : you can redistribute it and /or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program.If not, see < https://www.gnu.org/licenses/>. */ #pragma pack(push,1) typedef struct hash_item { PosSignature dwSignature; short nEval; MoveFlagType moveflag; BYTE nFlags; BYTE nDepth; SquareType from; SquareType to; } hash_item; typedef union HASH_ENTRY { hash_item h; long long l[2]; } HASH_ENTRY; typedef struct PAWN_HASH_ENTRY { PosSignature dwSignature; short mgEval; short egEval; } PAWN_HASH_ENTRY; typedef struct EVAL_HASH_ENTRY { PosSignature dwSignature; short nEval; } EVAL_HASH_ENTRY; #pragma pack(pop) #define DEFAULT_HASH_SIZE (0x800000) // 128MB #define DEFAULT_PAWN_HASH_SIZE (0x100000) // 8MB #define HASH_NOT_EVAL (0x00) #define HASH_ALPHA (0x10) #define HASH_BETA (0x20) #define HASH_EXACT (0x40) #define HASH_MATE_THREAT (0x01) extern HASH_ENTRY *HashTable; extern EVAL_HASH_ENTRY *EvalHashTable; extern size_t dwHashSize; //extern short nHashAge; extern int nHashBails; extern int nHashSaves; extern int nHashHits; extern int nHashProbes; extern int nHashReturns; extern int nEvalHashProbes; extern int nEvalHashHits; extern int nEvalHashSaves; HASH_ENTRY *InitHash(void); void ClearHash(void); void CloseHash(void); void SaveHash(CHESSMOVE *cmMove, int nDepth, int nEval, BYTE nFlags, int nPly, PosSignature dwSignature); HASH_ENTRY *ProbeHash(PosSignature dwSignature); void SavePawnHash(int mgEval, int egEval, PosSignature dwSignature); extern PAWN_HASH_ENTRY * ProbePawnHash(PosSignature dwSignature); extern void SaveEvalHash(int nEval, PosSignature dwSignature); extern EVAL_HASH_ENTRY * ProbeEvalHash(PosSignature dwSignature); PosSignature GetBBSignature(BB_BOARD *bbBoard); PosSignature GetBBPawnSignature(BB_BOARD *bbBoard);
/* * Copyright (C) 2015 Alberts Muktupāvels * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #ifndef FLASHBACK_SHELL_H #define FLASHBACK_SHELL_H #include <glib-object.h> #include "backends/gf-monitor-manager.h" G_BEGIN_DECLS #define FLASHBACK_TYPE_SHELL flashback_shell_get_type () G_DECLARE_FINAL_TYPE (FlashbackShell, flashback_shell, FLASHBACK, SHELL, GObject) FlashbackShell *flashback_shell_new (void); void flashback_shell_set_monitor_manager (FlashbackShell *shell, GfMonitorManager *monitor_manager); G_END_DECLS #endif
int maxProfit(int* prices, int pricesSize) { int i = 0; int j = 0; int max = 0; for (i=0; i < pricesSize - 1; i++) { for (j=i + 1; j < pricesSize; j++) { if (max < prices[j] - prices[i]) max = prices[j] - prices[i]; } } return max; }
/************************************************************************ MeOS - Orienteering Software Copyright (C) 2009-2015 Melin Software HB This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. Melin Software HB - software@melin.nu - www.melin.nu Stigbergsvägen 7, SE-75242 UPPSALA, Sweden ************************************************************************/ #ifndef GDI_CONSTANTS #define GDI_CONSTANTS #include "gdifonts.h" enum KeyCommandCode { KC_NONE, KC_COPY, KC_PASTE, KC_DELETE, KC_INSERT, KC_PRINT, KC_FIND, KC_FINDBACK, KC_REFRESH, KC_SPEEDUP, KC_SLOWDOWN, KC_AUTOCOMPLETE, }; const int GDI_BUTTON_SPACING = 8; #endif
#ifndef MANTID_DATAHANDLING_SAVEFITS_H_ #define MANTID_DATAHANDLING_SAVEFITS_H_ #include "MantidDataHandling/DllConfig.h" #include "MantidAPI/Algorithm.h" #include "MantidAPI/MatrixWorkspace_fwd.h" namespace Mantid { namespace DataHandling { /** SaveFITS : Save images in FITS formats. Copyright &copy; 2016 ISIS Rutherford Appleton Laboratory, NScD Oak Ridge National Laboratory & European Spallation Source This file is part of Mantid. Mantid is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. Mantid 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/>. File change history is stored at: <https://github.com/mantidproject/mantid> Code Documentation is available at: <http://doxygen.mantidproject.org> */ class DLLExport SaveFITS final : public API::Algorithm { public: const std::string name() const override final; int version() const override final; const std::string category() const override final; const std::string summary() const override final; private: void init() override final; void exec() override final; std::map<std::string, std::string> validateInputs() override; void saveFITSImage(const API::MatrixWorkspace_sptr img, const std::string &filename); void writeFITSHeaderBlock(const API::MatrixWorkspace_sptr img, std::ofstream &file); void writeFITSImageMatrix(const API::MatrixWorkspace_sptr img, std::ofstream &file); void writeFITSHeaderEntry(const std::string &hdr, std::ofstream &file); std::string makeBitDepthHeader(size_t depth) const; void writeFITSHeaderAxesSizes(const API::MatrixWorkspace_sptr img, std::ofstream &file); void writePaddingFITSHeaders(size_t count, std::ofstream &file); static const size_t g_maxBitDepth; static const std::array<int, 3> g_bitDepths; static const size_t g_maxBytesPP; // size of header entries in bytes static const size_t g_maxLenHdr; // pre-defined header contents static const std::string g_FITSHdrEnd; static const std::string g_FITSHdrFirst; static const std::string g_bitDepthPre; static const std::string g_bitDepthPost; static const std::string g_FITSHdrAxes; static const std::string g_FITSHdrExtensions; static const std::string g_FITSHdrRefComment1; static const std::string g_FITSHdrRefComment2; }; } // namespace DataHandling } // namespace Mantid #endif /* MANTID_DATAHANDLING_SAVEFITS_H_ */
/* * nssai_mapping.h * * */ #ifndef _OpenAPI_nssai_mapping_H_ #define _OpenAPI_nssai_mapping_H_ #include <string.h> #include "../external/cJSON.h" #include "../include/list.h" #include "../include/keyValuePair.h" #include "../include/binary.h" #include "snssai.h" #ifdef __cplusplus extern "C" { #endif typedef struct OpenAPI_nssai_mapping_s OpenAPI_nssai_mapping_t; typedef struct OpenAPI_nssai_mapping_s { struct OpenAPI_snssai_s *mapped_snssai; struct OpenAPI_snssai_s *h_snssai; } OpenAPI_nssai_mapping_t; OpenAPI_nssai_mapping_t *OpenAPI_nssai_mapping_create( OpenAPI_snssai_t *mapped_snssai, OpenAPI_snssai_t *h_snssai ); void OpenAPI_nssai_mapping_free(OpenAPI_nssai_mapping_t *nssai_mapping); OpenAPI_nssai_mapping_t *OpenAPI_nssai_mapping_parseFromJSON(cJSON *nssai_mappingJSON); cJSON *OpenAPI_nssai_mapping_convertToJSON(OpenAPI_nssai_mapping_t *nssai_mapping); OpenAPI_nssai_mapping_t *OpenAPI_nssai_mapping_copy(OpenAPI_nssai_mapping_t *dst, OpenAPI_nssai_mapping_t *src); #ifdef __cplusplus } #endif #endif /* _OpenAPI_nssai_mapping_H_ */
// // AppDelegate.h // CellCoordinator // // Created by Darius on 02/01/17. // Copyright © 2017 Cian. All rights reserved. // #import <UIKit/UIKit.h> @interface AppDelegate : UIResponder <UIApplicationDelegate> @property (strong, nonatomic) UIWindow *window; @end
//********************************************************************************************** // tinyRTX Filename: susr.h (System to USeR interface) // // Copyright 2014 Sycamore Software, Inc. ** www.tinyRTX.com ** // Distributed under the terms of the GNU Lesser General Purpose License v3 // // This file is part of tinyRTX. tinyRTX is free software: you can redistribute // it and/or modify it under the terms of the GNU Lesser General Public License // version 3 as published by the Free Software Foundation. // // tinyRTX is distributed in the hope that it will be useful, but WITHOUT ANY // WARRANTY// without even the implied warranty of MERCHANTABILITY or FITNESS FOR // A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more // details. // // You should have received a copy of the GNU Lesser General Public License // (filename copying.lesser.txt) and the GNU General Public License (filename // copying.txt) along with tinyRTX. If not, see <http://www.gnu.org/licenses/>. // // Revision history: // 09Sep14 SHiggins@tinyRTX.com Converted from PIC18F452-C to MSP430G2553. // //******************************************************************************* extern void SUSR_POR_PhaseA(void); extern void SUSR_POR_PhaseB(void); extern void SUSR_Timebase(void); extern void SUSR_Task1(void); extern void SUSR_Task2(void); extern void SUSR_Task3(void); extern void SUSR_TaskADC(void);
#ifndef __S5P4418_TIMER_H__ #define __S5P4418_TIMER_H__ #ifdef __cplusplus extern "C" { #endif #include <types.h> #include <string.h> #include <stddef.h> #include <io.h> #include <s5p4418-rstcon.h> #include <s5p4418-gpio.h> #include <s5p4418-clk.h> #include <reg-timer.h> void s5p4418_timer_reset(void); void s5p4418_timer_start(int ch, int irqon); void s5p4418_timer_stop(int ch, int irqon); u64_t s5p4418_timer_calc_tin(int ch, u32_t period); void s5p4418_timer_count(int ch, u32_t cnt); u32_t s5p4418_timer_read(int ch); void s5p4418_timer_irq_clear(int ch); #ifdef __cplusplus } #endif #endif /* __S5P4418_TIMER_H__ */
// Copyright 2011 the V8 project authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef V8_PARSING_PREPARSE_DATA_H_ #define V8_PARSING_PREPARSE_DATA_H_ #include "src/allocation.h" #include "src/base/hashmap.h" #include "src/collector.h" #include "src/messages.h" #include "src/parsing/preparse-data-format.h" namespace v8 { namespace internal { class ScriptData { public: ScriptData(const byte* data, int length); ~ScriptData() { if (owns_data_) DeleteArray(data_); } const byte* data() const { return data_; } int length() const { return length_; } bool rejected() const { return rejected_; } void Reject() { rejected_ = true; } void AcquireDataOwnership() { DCHECK(!owns_data_); owns_data_ = true; } void ReleaseDataOwnership() { DCHECK(owns_data_); owns_data_ = false; } private: bool owns_data_ : 1; bool rejected_ : 1; const byte* data_; int length_; DISALLOW_COPY_AND_ASSIGN(ScriptData); }; class PreParserLogger final { public: PreParserLogger() : end_(-1), num_parameters_(-1), function_length_(-1), has_duplicate_parameters_(false) {} void LogFunction(int end, int num_parameters, int function_length, bool has_duplicate_parameters, int literals, int properties) { end_ = end; num_parameters_ = num_parameters; function_length_ = function_length; has_duplicate_parameters_ = has_duplicate_parameters; literals_ = literals; properties_ = properties; } int end() const { return end_; } int num_parameters() const { return num_parameters_; } int function_length() const { return function_length_; } bool has_duplicate_parameters() const { return has_duplicate_parameters_; } int literals() const { return literals_; } int properties() const { return properties_; } private: int end_; // For function entries. int num_parameters_; int function_length_; bool has_duplicate_parameters_; int literals_; int properties_; }; class ParserLogger final { public: ParserLogger(); void LogFunction(int start, int end, int num_parameters, int function_length, bool has_duplicate_parameters, int literals, int properties, LanguageMode language_mode, bool uses_super_property, bool calls_eval); ScriptData* GetScriptData(); private: Collector<unsigned> function_store_; unsigned preamble_[PreparseDataConstants::kHeaderSize]; #ifdef DEBUG int prev_start_; #endif }; } // namespace internal } // namespace v8. #endif // V8_PARSING_PREPARSE_DATA_H_
#ifndef DECK_H #define DECK_H #include "SGWidget.h" #include "flashcard.h" namespace Ui { class Deck; } class Deck : public SGWidget { Q_OBJECT public: explicit Deck(QString group_name, QWidget *parent = 0); ~Deck(); private slots: void do_work(); void on_prev_btn_clicked(); void on_next_btn_clicked(); void on_add_card_btn_clicked(); void on_quiz_btn_toggled(bool checked); void deleteCard(int index); void display_card(int index); void init_card(int index, QString front_text, QString back_text, bool front_side, bool send_card); private: QString groupID; bool edit_card(int index, QString front_text, QString back_text, bool front_side, bool send_card); Ui::Deck *ui; QList<Flashcard*> deck; Flashcard* new_card; int current_index; int new_index; bool quiz; }; #endif // DECK_H
#ifndef CYLINDERITEM_H #define CYLINDERITEM_H #include <QObject> class CylinderItemPrivate; class CylinderItem : public QObject { Q_OBJECT friend class CylinderManager; private: CylinderItem(QObject *parent = 0); ~CylinderItem(); public: int count() const; public slots: void handleSocket(qintptr handle); private slots: void disconnected(); private: CylinderItemPrivate *p; }; #endif // CYLINDERITEM_H
/* GodWhale, a USI shogi(japanese-chess) playing engine derived from NanohaMini Copyright (C) 2004-2008 Tord Romstad (Glaurung author) Copyright (C) 2008-2010 Marco Costalba, Joona Kiiski, Tord Romstad (Stockfish author) Copyright (C) 2014 Kazuyuki Kawabata (NanohaMini author) Copyright (C) 2015 ebifrier, espelade, kakiage NanohaMini is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. GodWhale 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/>. */ #if !defined(EVALUATE_H_INCLUDED) #define EVALUATE_H_INCLUDED #include "types.h" class Position; Value evaluate(Position& pos, Value& margin); #endif // !defined(EVALUATE_H_INCLUDED)
// Copyright (c) 2015 - 2015 All Right Reserved, http://hatiolab.com // // This source is subject to the Hatio Lab. Permissive License. // Please see the License.txt file for more information. // All other rights reserved. // // THIS CODE AND INFORMATION ARE PROVIDED "AS IS" WIHOUT WARRANTY OF ANY // KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE // IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A // PARTICULAR PURPOSE. // #include "demo-const.h" int server_handler_file_get_list(int fd, dx_packet_t* p); int server_handler_file_list(int fd, dx_packet_t* p); int server_handler_file_get(int fd, dx_packet_t* p); int server_handler_file_delete(int fd, dx_packet_t* p); int server_handler_file(int fd, dx_packet_t* packet) { printf("(Server Event Handling) File(%d)\n", packet->header.code); switch(packet->header.code) { case DEMO_FILE_GET_LIST : /* 파일리스트 요청 */ server_handler_file_get_list(fd, packet); break; case DEMO_FILE_LIST : /* 파일리스트 정보 */ server_handler_file_list(fd, packet); break; case DEMO_FILE_GET : /* 부분 파일 요청 */ server_handler_file_get(fd, packet); break; case DEMO_FILE : /* 부분 파일 정보 */ server_handler_file(fd, packet); break; case DEMO_FILE_DELETE : /* 파일 삭제 요청 */ server_handler_file_delete(fd, packet); break; default : break; } return 0; } int server_handler_file_get_list(int fd, dx_packet_t* p) { int pathlen; char buf[129]; dx_u8_array_packet_t* packet = (dx_u8_array_packet_t*)p; pathlen = ntohl(packet->array.len); bzero(buf, sizeof(buf)); strncpy(buf, (char*)packet->array.data, pathlen > DX_PATH_MAX_SIZE ? DX_PATH_MAX_SIZE : pathlen); printf("(Server Event Handling) FileList(path : %s)\n", buf); dx_packet_send_filelist(fd, buf); return 0; } int server_handler_file_list(int fd, dx_packet_t* p) { return 0; } int server_handler_file_get(int fd, dx_packet_t* p) { char buf[DX_PATH_MAX_SIZE + 1]; dx_file_query_packet_t* packet = (dx_file_query_packet_t*)p; uint32_t begin, end; bzero(buf, sizeof(buf)); strncpy(buf, (char*)packet->file.path, DX_PATH_MAX_SIZE); begin = ntohl(packet->file.offset_begin); end = ntohl(packet->file.offset_end); printf("(Server Event Handling) File(path : %s [%d-%d])\n", buf, begin, end); dx_packet_send_file(fd, buf, begin, end); return 0; } int server_handler_file_delete(int fd, dx_packet_t* p) { int pathlen; char buf[129]; dx_u8_array_packet_t* packet = (dx_u8_array_packet_t*)p; pathlen = ntohl(packet->array.len); bzero(buf, sizeof(buf)); strncpy(buf, (char*)packet->array.data, pathlen > DX_PATH_MAX_SIZE ? DX_PATH_MAX_SIZE : pathlen); printf("(Server Event Handling) File Delete(path : %s)\n", buf); dx_packet_delete_file(fd, buf); return 0; }
/* This file is part of GNUnet. (C) 2009, 2011 Christian Grothoff (and other contributing authors) GNUnet is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3, or (at your option) any later version. GNUnet 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 GNUnet; see the file COPYING. If not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ /** * @file arm/test_arm_api.c * @brief testcase for arm_api.c */ #include "platform.h" #include "gnunet_common.h" #include "gnunet_arm_service.h" #include "gnunet_client_lib.h" #include "gnunet_configuration_lib.h" #include "gnunet_getopt_lib.h" #include "gnunet_program_lib.h" #include "gnunet_resolver_service.h" #define START_ARM GNUNET_YES #define START_TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_MILLISECONDS, 1500) #define TIMEOUT GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 15) static const struct GNUNET_CONFIGURATION_Handle *cfg; static struct GNUNET_ARM_Handle *arm; static int ok = 1; static void arm_stopped (void *cls, enum GNUNET_ARM_ProcessStatus success) { GNUNET_break (success == GNUNET_ARM_PROCESS_DOWN); if (success != GNUNET_ARM_PROCESS_DOWN) ok = 3; else if (ok == 1) ok = 0; } static void arm_notify_stop (void *cls, enum GNUNET_ARM_ProcessStatus success) { GNUNET_break (success == GNUNET_ARM_PROCESS_DOWN); #if START_ARM GNUNET_ARM_stop_service (arm, "arm", TIMEOUT, &arm_stopped, NULL); #endif } static void dns_notify (void *cls, const struct sockaddr *addr, socklen_t addrlen) { if (addr == NULL) { if (ok != 0) { GNUNET_break (0); ok = 2; } GNUNET_ARM_stop_service (arm, "resolver", TIMEOUT, &arm_notify_stop, NULL); return; } GNUNET_break (addr != NULL); ok = 0; } static void resolver_notify (void *cls, enum GNUNET_ARM_ProcessStatus success) { if (success != GNUNET_ARM_PROCESS_STARTING) { GNUNET_break (0); ok = 2; #if START_ARM GNUNET_ARM_stop_service (arm, "arm", TIMEOUT, &arm_stopped, NULL); #endif return; } GNUNET_RESOLVER_ip_get ("localhost", AF_INET, TIMEOUT, &dns_notify, NULL); } static void arm_notify (void *cls, enum GNUNET_ARM_ProcessStatus success) { if (success != GNUNET_ARM_PROCESS_STARTING) { GNUNET_break (0); ok = 2; #if START_ARM GNUNET_ARM_stop_service (arm, "arm", TIMEOUT, &arm_stopped, NULL); #endif } GNUNET_ARM_start_service (arm, "resolver", GNUNET_OS_INHERIT_STD_OUT_AND_ERR, START_TIMEOUT, &resolver_notify, NULL); } static void task (void *cls, char *const *args, const char *cfgfile, const struct GNUNET_CONFIGURATION_Handle *c) { cfg = c; arm = GNUNET_ARM_connect (cfg, NULL); #if START_ARM GNUNET_ARM_start_service (arm, "arm", GNUNET_OS_INHERIT_STD_OUT_AND_ERR, START_TIMEOUT, &arm_notify, NULL); #else arm_notify (NULL, GNUNET_YES); #endif } static int check () { char *const argv[] = { "test-arm-api", "-c", "test_arm_api_data.conf", NULL }; struct GNUNET_GETOPT_CommandLineOption options[] = { GNUNET_GETOPT_OPTION_END }; GNUNET_assert (GNUNET_OK == GNUNET_PROGRAM_run ((sizeof (argv) / sizeof (char *)) - 1, argv, "test-arm-api", "nohelp", options, &task, NULL)); return ok; } int main (int argc, char *argv[]) { int ret; GNUNET_log_setup ("test-arm-api", "WARNING", NULL); ret = check (); return ret; } /* end of test_arm_api.c */
/************************************************************************ * Copyright (c) 2009, Microchip Technology Inc. * * Microchip licenses this software to you solely for use with Microchip * products. The software is owned by Microchip and its licensors, and * is protected under applicable copyright laws. All rights reserved. * * SOFTWARE IS PROVIDED "AS IS." MICROCHIP EXPRESSLY DISCLAIMS ANY * WARRANTY OF ANY KIND, WHETHER EXPRESS OR IMPLIED, INCLUDING BUT * NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS * FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT. IN NO EVENT SHALL * MICROCHIP BE LIABLE FOR ANY INCIDENTAL, SPECIAL, INDIRECT OR * CONSEQUENTIAL DAMAGES, LOST PROFITS OR LOST DATA, HARM TO YOUR * EQUIPMENT, COST OF PROCUREMENT OF SUBSTITUTE GOODS, TECHNOLOGY * OR SERVICES, ANY CLAIMS BY THIRD PARTIES (INCLUDING BUT NOT LIMITED * TO ANY DEFENSE THEREOF), ANY CLAIMS FOR INDEMNITY OR CONTRIBUTION, * OR OTHER SIMILAR COSTS. * * To the fullest extent allowed by law, Microchip and its licensors * liability shall not exceed the amount of fees, if any, that you * have paid directly to Microchip to use this software. * * MICROCHIP PROVIDES THIS SOFTWARE CONDITIONALLY UPON YOUR ACCEPTANCE * OF THESE TERMS. */ #ifndef EEPROMVIEWMODEL_H #define EEPROMVIEWMODEL_H #include <QAbstractTableModel> #include "Bootload/DeviceData.h" #include "Bootload/Device.h" /*! * Provides GUI formatting of EEPROM data memory for display in a QTableView. */ class EepromViewModel : public QAbstractTableModel { Q_OBJECT public: EepromViewModel(Device* device, DeviceData* deviceData, QObject *parent = 0); int rowCount(const QModelIndex &parent = QModelIndex()) const; int columnCount(const QModelIndex &parent = QModelIndex()) const; QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const; QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const; bool hasVerifyData(void); void setVerifyData(DeviceData* data); protected: DeviceData* deviceData; DeviceData* verifyData; Device* device; }; #endif // EEPROMVIEWMODEL_H
#pragma once #include <map> #include <set> #include <vector> #include "storm/storage/expressions/Expression.h" #include "storm/storage/jani/TemplateEdgeContainer.h" namespace storm { namespace jani { class Edge; class TemplateEdge; class Variable; class Model; namespace detail { class Edges { public: typedef std::vector<Edge>::iterator iterator; typedef std::vector<Edge>::const_iterator const_iterator; Edges(iterator it, iterator ite); /*! * Retrieves an iterator to the edges. */ iterator begin() const; /*! * Retrieves an end iterator to the edges. */ iterator end() const; /*! * Determines whether this set of edges is empty. */ bool empty() const; /*! * Retrieves the number of edges. */ std::size_t size() const; private: iterator it; iterator ite; }; class ConstEdges { public: typedef std::vector<Edge>::iterator iterator; typedef std::vector<Edge>::const_iterator const_iterator; ConstEdges(const_iterator it, const_iterator ite); /*! * Retrieves an iterator to the edges. */ const_iterator begin() const; /*! * Retrieves an end iterator to the edges. */ const_iterator end() const; /*! * Determines whether this set of edges is empty. */ bool empty() const; /*! * Retrieves the number of edges. */ std::size_t size() const; private: const_iterator it; const_iterator ite; }; } // namespace detail class EdgeContainer { public: typedef std::vector<Edge>::iterator iterator; typedef std::vector<Edge>::const_iterator const_iterator; EdgeContainer() = default; EdgeContainer(EdgeContainer const& other); EdgeContainer& operator=(EdgeContainer const& other); void clearConcreteEdges(); std::vector<Edge> const& getConcreteEdges() const; std::vector<Edge>& getConcreteEdges(); TemplateEdgeContainer const& getTemplateEdges() const; size_t size() const; iterator begin(); const_iterator begin() const; iterator end(); const_iterator end() const; std::set<uint64_t> getActionIndices() const; void substitute(std::map<storm::expressions::Variable, storm::expressions::Expression> const& substitution); void liftTransientDestinationAssignments(int64_t maxLevel = 0); void pushAssignmentsToDestinations(); void insertEdge(Edge const& e, uint64_t locStart, uint64_t locEnd); void insertTemplateEdge(std::shared_ptr<TemplateEdge> const& te); bool isLinear() const; bool usesAssignmentLevels(bool onlyTransient = false) const; void finalize(Model const& containingModel); void changeAssignmentVariables(std::map<Variable const*, std::reference_wrapper<Variable const>> const& remapping); private: std::vector<Edge> edges; TemplateEdgeContainer templates; }; } // namespace jani } // namespace storm
/* * Xenomai Lab * Copyright (C) 2013 Jorge Azevedo * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #ifndef MAINWINDOW_H #define MAINWINDOW_H #include "blockbase.h" #include "template_settings.h" class MainWindow : public BlockBase { Q_OBJECT public: explicit MainWindow(const QString& execName, const QString& name,QWidget *parent = 0); virtual ~MainWindow(); private: void setSettings(); }; #endif // MAINWINDOW_H
/* SDL - Simple DirectMedia Layer Copyright (C) 1997-2012 Sam Lantinga This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA Sam Lantinga slouken@libsdl.org */ #ifndef _SDL_config_h #define _SDL_config_h #include "SDL_platform.h" /* Add any platform that doesn't build using the configure system */ #if defined(__DREAMCAST__) #include "SDL_config_dreamcast.h" #elif defined(__MACOS__) #include "SDL_config_macos.h" #elif defined(__MACOSX__) #include "SDL_config_macosx.h" #elif defined(__SYMBIAN32__) #include "SDL_config_symbian.h" /* must be before win32! */ #elif defined(__WIN32__) #include "SDL_config_win32.h" #elif defined(__OS2__) #include "SDL_config_os2.h" #else #include "SDL_config_minimal.h" #endif /* platform config */ #endif /* _SDL_config_h */
#pragma once #include "GameMgr.h" class CGameSevDlg; namespace TCP{ class CClientTcp; } namespace Game{ class IClient; namespace Texas{ //class CPoker; class CTexasGame; class CTexasPokerMgr : public Game::IGameMgr { public: enum { GM_IDEL, GM_INIT, GM_INITWAIT, GM_GAME, GM_SENDRESULT, GM_END, GAME_MAX = 200, GAME_MIN_MONEY = 10, GAME_DEFAULT_MONEY = 10, GAME_UNIT_MONEY = 10, GAME_CLIENT_MONEY_DEF = 5000, GAME_OVERTIME_SEC = 5, }; private: int m_nGameState; // game state int m_nCurID; // current client id public: std::vector<std::shared_ptr<IClient>> m_vtClient; std::vector<std::shared_ptr<CTexasGame>> m_vtGame; std::list<int> m_ltLoserID; public: int GetGameState(){ return m_nGameState; } public: CTexasPokerMgr(CGameSevDlg *dlg); ~CTexasPokerMgr(); virtual bool StartGame(); virtual void StopGame(); virtual void OnGameOver(); virtual void CreateClient(TCP::CClientTcp* tcp); virtual void OnClientDisconnect(TCP::CClientTcp* tcp); virtual void OnTimer2Work(); virtual void FillGrid(CListCtrl& lcClient, CListCtrl& lcGame); virtual void ShowGameInfo(int gameID); virtual void GetProcessInfo(CString& strProcess); std::shared_ptr<CTexasGame> GetCurrentGame(); void AddLoser(int id); bool CheckOneClientReturned(int id); bool CheckAllClientReturned(); private: void ReSortClient(); bool CheckGameOver(); void GetGameResult(); }; } }
#ifndef QTDIALOG_H #define QTDIALOG_H #include <QDialog> namespace Ui { class QtDialog; } struct QwtPlotCurve; struct QwtPlot; class QtDialog : public QDialog { Q_OBJECT public: explicit QtDialog(QWidget *parent = 0); ~QtDialog(); QwtPlotCurve * const m_curve; QwtPlot * const m_plot; private: Ui::QtDialog *ui; ///FileToVector reads a file and converts it to a std::vector<std::string> ///From http://www.richelbilderbeek.nl/CppFileToVector.htm static const std::vector<std::string> FileToVector(const std::string& filename); ///GetBoostVersion returns the version of the current Boost library. ///From http://www.richelbilderbeek.nl/CppGetBoostVersion.htm static const std::string GetBoostVersion(); ///GetGccVersion returns the version number of GCC currently installed. ///From http://www.richelbilderbeek.nl/CppGetGccVersion.htm static const std::string GetGccVersion(); ///GetQtCreatorVersion obtains the version of Qt Creator ///Fails under Windows ///From http://www.richelbilderbeek.nl/CppGetQtCreatorVersion.htm static const std::string GetQtCreatorVersion(); ///GetStlVersion returns the version number of the GCC STL currently installed. ///From http://www.richelbilderbeek.nl/CppGetStlVersion.htm static const std::string GetStlVersion(); }; #endif // QTDIALOG_H
/* algorithms.h - rhash library algorithms */ #ifndef RHASH_ALGORITHMS_H #define RHASH_ALGORITHMS_H #include "rhash.h" #include "byte_order.h" #include <stddef.h> #ifdef __cplusplus extern "C" { #endif #ifndef RHASH_API /* modifier for RHash library functions */ # define RHASH_API #endif /** * Bit flag: default hash output format is base32. */ #define RHASH_INFO_BASE32 1 /** * Information about a hash function. */ typedef struct rhash_info { /** * Hash function indentifier. */ unsigned hash_id; /** * Flags bit-mask, including RHASH_INFO_BASE32 bit. */ unsigned flags; /** The size of of the raw message digest in bytes. */ size_t digest_size; /** * The hash function name. */ const char* name; /** * The corresponding paramenter name in a magnet link. */ const char* magnet_name; } rhash_info; typedef void (*pinit_t)(void*); typedef void (*pupdate_t)(void* ctx, const void* msg, size_t size); typedef void (*pfinal_t)(void*, unsigned char*); typedef void (*pcleanup_t)(void*); /** * Information about a hash function */ typedef struct rhash_hash_info { rhash_info* info; size_t context_size; ptrdiff_t digest_diff; pinit_t init; pupdate_t update; pfinal_t final; pcleanup_t cleanup; } rhash_hash_info; /** * Information on a hash function and its context */ typedef struct rhash_vector_item { struct rhash_hash_info* hash_info; void* context; } rhash_vector_item; /** * The rhash context containing contexts for several hash functions */ typedef struct rhash_context_ext { struct rhash_context rc; unsigned hash_vector_size; /* number of contained hash sums */ unsigned flags; volatile unsigned state; void* callback; void* callback_data; void* bt_ctx; rhash_vector_item vector[1]; /* contexts of contained hash sums */ } rhash_context_ext; extern rhash_hash_info rhash_hash_info_default[RHASH_HASH_COUNT]; extern rhash_hash_info* rhash_info_table; extern int rhash_info_size; extern unsigned rhash_uninitialized_algorithms; extern rhash_info info_crc32; extern rhash_info info_crc32c; extern rhash_info info_md4; extern rhash_info info_md5; extern rhash_info info_sha1; extern rhash_info info_tiger; extern rhash_info info_tth ; extern rhash_info info_btih; extern rhash_info info_ed2k; extern rhash_info info_aich; extern rhash_info info_whirlpool; extern rhash_info info_rmd160; extern rhash_info info_gost; extern rhash_info info_gostpro; extern rhash_info info_has160; extern rhash_info info_snf128; extern rhash_info info_snf256; extern rhash_info info_sha224; extern rhash_info info_sha256; extern rhash_info info_sha384; extern rhash_info info_sha512; extern rhash_info info_sha3_224; extern rhash_info info_sha3_256; extern rhash_info info_sha3_384; extern rhash_info info_sha3_512; extern rhash_info info_edr256; extern rhash_info info_edr512; /* rhash_info flags */ #define F_BS32 1 /* default output in base32 */ #define F_SWAP32 2 /* Big endian flag */ #define F_SWAP64 4 /* define endianness flags */ #if IS_LITTLE_ENDIAN #define F_LE32 0 #define F_LE64 0 #define F_BE32 F_SWAP32 #define F_BE64 F_SWAP64 #else #define F_LE32 F_SWAP32 #define F_LE64 F_SWAP64 #define F_BE32 0 #define F_BE64 0 #endif void rhash_init_algorithms(unsigned mask); const rhash_info* rhash_info_by_id(unsigned hash_id); /* get hash sum info by hash id */ #if defined(OPENSSL_RUNTIME) && !defined(USE_OPENSSL) # define USE_OPENSSL #endif #ifdef __cplusplus } /* extern "C" */ #endif /* __cplusplus */ #endif /* RHASH_ALGORITHMS_H */
/* * mjpg_streamer.h * * Created on: 2011. 1. 4. * Author: zerom */ #ifndef MJPG_STREAMER_H_ #define MJPG_STREAMER_H_ #include <pthread.h> #include "Image.h" #include "LinuxCamera.h" #include "httpd.h" using namespace Robot; class mjpg_streamer { private: static globals global; pthread_t cam; pthread_mutex_t controls_mutex; Image* input_yuv; Image* input_rgb; context server; static void* server_thread(void* arg); public: mjpg_streamer(int width, int height); mjpg_streamer(int width, int height, char* wwwdir); virtual ~mjpg_streamer(); int input_init(); int input_cmd(in_cmd_type cmd, int value); int send_image(Image* img); int output_init(); int output_run(); }; #endif /* MJPG_STREAMER_H_ */
#include <stdio.h> #include "gpio.h" #include "button.h" /** Bit mask for the GPIO buttons */ #define BTN_MASK 0x1F /** * @brief Convert a raw value to a button enum value. * @warning may not be working due to lcdproc compatibility changes */ static Button raw_to_button(uint8_t btn) { switch (~btn) { case ~1: return Select; case ~2: return Right; case ~4: return Down; case ~8: return Up; case ~16: return Left; default: return Null; } } uint8_t btn_nblk_raw() { return GPIO_read(PortA) & BTN_MASK; } Button btn_nblk() { return raw_to_button(btn_nblk_raw()); } uint8_t btn_blk_raw() { uint8_t buf; while ((buf = btn_nblk_raw()) == 0); return buf; } Button btn_blk() { return raw_to_button(btn_blk_raw()); } Button btn_return_clk() { uint8_t buf; while ((buf = btn_nblk_raw()) == 0); while (btn_nblk_raw() != 0); return buf; } int btn_printf(Button button) { switch (button) { case Select: return printf("Select\n"); break; case Right: return printf("Right\n"); break; case Down: return printf("Down\n"); break; case Up: return printf("Up\n"); break; case Left: return printf("Left\n"); break; default: return printf("Null\n"); break; } }
/* Copyright (C) 2012-2013 Sarvaritdinov R. This file is part of REXLoader. REXLoader is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. REXLoader 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/>. */ #ifndef NIXNOTIFYPLUGIN_H #define NIXNOTIFYPLUGIN_H #include <QObject> #include <QStringList> #include <QVariant> #include <QByteArray> #include <QMap> #include <QtDBus> #include <QImage> #include "../NotifInterface.h" struct iiibiiay { iiibiiay(QImage *img); iiibiiay(); static const int tid; int width; int height; int bytesPerLine; bool alpha; int channels; int bitPerPixel; QByteArray data; }; Q_DECLARE_METATYPE(iiibiiay) class NixNotifyPlugin : public NotifInterface { Q_OBJECT Q_INTERFACES(NotifInterface) public: explicit NixNotifyPlugin(); ~NixNotifyPlugin(); QStringList pluginInfo() const; //возвращает данные о плагине и его авторах void notify(const QString &app, const QString &title, const QString &msg, int timeout, int type = INFO, const QStringList &actions = QStringList(), QImage *image = 0); //выводит уведомление void setImage(int type, QImage *img); void resetImage(int type = -1); signals: void notifyActionData(unsigned int id, const QString &actname); protected slots: void sendActData(unsigned int id, const QString &act); void closeNotify(unsigned int id); void notifIsClosed(unsigned int id); private: static QDBusInterface dbusNotification; QMap<int, iiibiiay> images; QList<unsigned int> nlist; }; #endif // NIXNOTIFYPLUGIN_H
/*************************************************** * * * * * * * ---------------------------------------------- * * * * This file is part of TestMan! * * Copyright 2015 by Andreas Pollhammer * * * ***************************************************/ #ifndef DEF_MENU_MAIN_H #define DEF_MENU_MAIN_H #include <windows.h> #include "../actions/def_actions.h" #include "../../wintoolbox/menu/menu.h" void setup_main_menu(HWND hwnd,MenuHelper_Interface *m); #endif
/* * This file is part of cg3lib: https://github.com/cg3hci/cg3lib * This Source Code Form is subject to the terms of the GNU GPL 3.0 * * @author Alessandro Muntoni (muntoni.alessandro@gmail.com) */ #ifndef CG3_SERIALIZE_STD_H #define CG3_SERIALIZE_STD_H #include <string> #include <set> #include <unordered_set> #include <unordered_map> #include <vector> #include <list> #include <map> #include <array> #include <typeinfo> #include <algorithm> #include "serialize.h" namespace cg3 { template <typename T1, typename T2> void serialize(const std::pair<T1, T2>& p, std::ofstream& binaryFile); template <typename T1, typename T2> void deserialize(std::pair<T1, T2>& p, std::ifstream& binaryFile); template <typename T, typename ...A> void serialize(const std::set<T, A...> &s, std::ofstream& binaryFile); template <typename T, typename ...A> void deserialize(std::set<T, A...> &s, std::ifstream& binaryFile); template <typename T, typename ...A> void serialize(const std::unordered_set<T, A...> &s, std::ofstream& binaryFile); template <typename T, typename ...A> void deserialize(std::unordered_set<T, A...> &s, std::ifstream& binaryFile); template <typename ...A> void serialize(const std::vector<bool, A...> &v, std::ofstream& binaryFile); template <typename T, typename ...A> void serialize(const std::vector<T, A...> &v, std::ofstream& binaryFile); template <typename ...A> void deserialize(std::vector<bool, A...> &v, std::ifstream& binaryFile); template <typename T, typename ...A> void deserialize(std::vector<T, A...> &v, std::ifstream& binaryFile); template <typename T, typename ...A> void serialize(const std::list<T, A...> &l, std::ofstream& binaryFile); template <typename T, typename ...A> void deserialize(std::list<T, A...> &l, std::ifstream& binaryFile); template <typename T1, typename T2, typename ...A> void serialize(const std::map<T1, T2, A...> &m, std::ofstream& binaryFile); template <typename T1, typename T2, typename ...A> void deserialize(std::map<T1, T2, A...> &m, std::ifstream& binaryFile); template <typename T1, typename T2, typename ...A> void serialize(const std::unordered_map<T1, T2, A...> &m, std::ofstream& binaryFile); template <typename T1, typename T2, typename ...A> void deserialize(std::unordered_map<T1, T2, A...> &m, std::ifstream& binaryFile); template <typename T, unsigned long int ...A> void serialize(const std::array<T, A...> &a, std::ofstream& binaryFile); template <typename T, unsigned long int ...A> void deserialize(std::array<T, A...> &a, std::ifstream& binaryFile); } //namespace cg3 #endif // CG3_SERIALIZE_STD_H
/* LIBGIMP - The GIMP Library * Copyright (C) 1995-1997 Peter Mattis and Spencer Kimball * * gimpintcombobox.h * Copyright (C) 2004 Sven Neumann <sven@gimp.org> * * This library is free software: you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 3 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library. If not, see * <http://www.gnu.org/licenses/>. */ #if !defined (__GIMP_WIDGETS_H_INSIDE__) && !defined (GIMP_WIDGETS_COMPILATION) #error "Only <libgimpwidgets/gimpwidgets.h> can be included directly." #endif #ifndef __GIMP_INT_COMBO_BOX_H__ #define __GIMP_INT_COMBO_BOX_H__ G_BEGIN_DECLS #define GIMP_TYPE_INT_COMBO_BOX (gimp_int_combo_box_get_type ()) #define GIMP_INT_COMBO_BOX(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GIMP_TYPE_INT_COMBO_BOX, GimpIntComboBox)) #define GIMP_INT_COMBO_BOX_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GIMP_TYPE_INT_COMBO_BOX, GimpIntComboBoxClass)) #define GIMP_IS_INT_COMBO_BOX(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GIMP_TYPE_INT_COMBO_BOX)) #define GIMP_IS_INT_COMBO_BOX_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GIMP_TYPE_INT_COMBO_BOX)) #define GIMP_INT_COMBO_BOX_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GIMP_TYPE_INT_COMBO_BOX, GimpIntComboBoxClass)) typedef struct _GimpIntComboBoxClass GimpIntComboBoxClass; struct _GimpIntComboBox { GtkComboBox parent_instance; /*< private >*/ gpointer priv; }; struct _GimpIntComboBoxClass { GtkComboBoxClass parent_class; /* Padding for future expansion */ void (* _gimp_reserved1) (void); void (* _gimp_reserved2) (void); void (* _gimp_reserved3) (void); void (* _gimp_reserved4) (void); }; typedef gboolean (* GimpIntSensitivityFunc) (gint value, gpointer data); GType gimp_int_combo_box_get_type (void) G_GNUC_CONST; GtkWidget * gimp_int_combo_box_new (const gchar *first_label, gint first_value, ...) G_GNUC_NULL_TERMINATED; GtkWidget * gimp_int_combo_box_new_valist (const gchar *first_label, gint first_value, va_list values); GtkWidget * gimp_int_combo_box_new_array (gint n_values, const gchar *labels[]); void gimp_int_combo_box_prepend (GimpIntComboBox *combo_box, ...); void gimp_int_combo_box_append (GimpIntComboBox *combo_box, ...); gboolean gimp_int_combo_box_set_active (GimpIntComboBox *combo_box, gint value); gboolean gimp_int_combo_box_get_active (GimpIntComboBox *combo_box, gint *value); gulong gimp_int_combo_box_connect (GimpIntComboBox *combo_box, gint value, GCallback callback, gpointer data); void gimp_int_combo_box_set_label (GimpIntComboBox *combo_box, const gchar *label); const gchar * gimp_int_combo_box_get_label (GimpIntComboBox *combo_box); void gimp_int_combo_box_set_sensitivity (GimpIntComboBox *combo_box, GimpIntSensitivityFunc func, gpointer data, GDestroyNotify destroy); G_END_DECLS #endif /* __GIMP_INT_COMBO_BOX_H__ */
/* -*- c++ -*- */ /* * Copyright 2005,2011 Free Software Foundation, Inc. * * This file is part of GNU Radio * * GNU Radio is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3, or (at your option) * any later version. * * GNU Radio 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 GNU Radio; see the file COPYING. If not, write to * the Free Software Foundation, Inc., 51 Franklin Street, * Boston, MA 02110-1301, USA. */ #ifndef INCLUDED_VOCODER_GSM_FR_DECODE_PS_H #define INCLUDED_VOCODER_GSM_FR_DECODE_PS_H #include <vocoder_api.h> #include <gr_sync_interpolator.h> class vocoder_gsm_fr_decode_ps; typedef boost::shared_ptr<vocoder_gsm_fr_decode_ps> vocoder_gsm_fr_decode_ps_sptr; VOCODER_API vocoder_gsm_fr_decode_ps_sptr vocoder_make_gsm_fr_decode_ps (); /*! * \brief GSM 06.10 Full Rate Vocoder Decoder * \ingroup audio_blk */ class VOCODER_API vocoder_gsm_fr_decode_ps : public gr_sync_interpolator { struct gsm_state *d_gsm; friend VOCODER_API vocoder_gsm_fr_decode_ps_sptr vocoder_make_gsm_fr_decode_ps (); vocoder_gsm_fr_decode_ps (); public: ~vocoder_gsm_fr_decode_ps (); int work (int noutput_items, gr_vector_const_void_star &input_items, gr_vector_void_star &output_items); }; #endif /* INCLUDED_VOCODER_GSM_FR_DECODE_PS_H */
#ifndef __ASM_SH_MMU_CONTEXT_32_H #define __ASM_SH_MMU_CONTEXT_32_H /* * Destroy context related info for an mm_struct that is about * to be put to rest. */ static inline void destroy_context(struct mm_struct *mm) { /* Do nothing */ } #ifdef CONFIG_CPU_HAS_PTEAEX static inline void set_asid(unsigned long asid) { __raw_writel(asid, MMU_PTEAEX); } static inline unsigned long get_asid(void) { return __raw_readl(MMU_PTEAEX) & MMU_CONTEXT_ASID_MASK; } #else static inline void set_asid(unsigned long asid) { unsigned long __dummy; __asm__ __volatile__ ("mov.l %2, %0\n\t" "and %3, %0\n\t" "or %1, %0\n\t" "mov.l %0, %2" : "=&r" (__dummy) : "r" (asid), "m" (__m(MMU_PTEH)), "r" (0xffffff00)); } static inline unsigned long get_asid(void) { unsigned long asid; __asm__ __volatile__ ("mov.l %1, %0" : "=r" (asid) : "m" (__m(MMU_PTEH))); asid &= MMU_CONTEXT_ASID_MASK; return asid; } #endif /* CONFIG_CPU_HAS_PTEAEX */ /* MMU_TTB is used for optimizing the fault handling. */ static inline void set_TTB(pgd_t *pgd) { __raw_writel((unsigned long)pgd, MMU_TTB); } static inline pgd_t *get_TTB(void) { return (pgd_t *)__raw_readl(MMU_TTB); } #endif /* __ASM_SH_MMU_CONTEXT_32_H */
//----------------------------------------------------------------------------- // CLLocationManager_sim.h // // This class can be used as a replacement for CLLocationManager. // // When compiled for the iPhone/iPad simulator it provides the ability to // get a different location and optionally have it moving for testing apps. // // When compiled for an iOS device, all the simulator code is left out and // you get only the original unchanged functionality of the CLLocationManager. // // Created by Gary A. Morris on 6/26/10. // Added spead and heading on 3/7/11 to simulate motion. //----------------------------------------------------------------------------- // // Copyright 2011 Gary A. Morris. http://mggm.net // // This file is part of CLLocationManager_sim. // // CLLocationManager_sim is free software: you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // CLLocationManager_sim is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License // along with Foobar. If not, see <http://www.gnu.org/licenses/>. //----------------------------------------------------------------------------- #import <CoreLocation/CoreLocation.h> #if TARGET_IPHONE_SIMULATOR typedef enum { simLatitude, simLongitude, simAltitude, simTimestamp, simHorizontalAccuracy, simVerticalAccuracy, simHeading, simSpeed, N_STATE_DATA } SimStateType; @interface CLLocationManager_sim : CLLocationManager <CLLocationManagerDelegate> { // replacements for super's ivars: id<CLLocationManagerDelegate> simDelegate; // delegate CLLocation* simLocation; // last reported location //--------------------------------- // ivars to support simulation: //--------------------------------- double simState[N_STATE_DATA]; // simulation state data unsigned nextUpdate; // index into state updates CFAbsoluteTime simStartTime; // time that sim was enabled NSTimer* simTimer; // performs sim updates periodically } // override CLLocationManager's properties @property (nonatomic, assign) id<CLLocationManagerDelegate> delegate; @property (nonatomic, readonly) CLLocation* location; #else @interface CLLocationManager_sim : CLLocationManager { } #endif @end
#ifndef ONLINETVSHOWDATABASE_H #define ONLINETVSHOWDATABASE_H #include "nwutils.h" #include "tvshow.h" #include "curlresult.h" #include <QDir> #include "onlinecredentials.h" class Library; namespace OnlineTvShowDatabase { enum UpdateFilter { ufNone = 0, ufSynopsis = 1 << 1, ufTitle = 1 << 2, ufRelations = 1 << 3, ufAiringDates = 1 << 4, ufSynonyms = 1 << 5, ufRemoteId = 1 << 6, ufImage = 1 << 7, ufAll = ((unsigned int)-1) }; class Entry { public: Entry(); virtual ~Entry(); void updateShow(TvShow& show, const Library& library, const QString identifierKey, UpdateFilter filter = OnlineTvShowDatabase::ufAll) const; virtual int getRemoteId() const = 0; virtual void updateSynopsis(TvShow& show) const = 0; virtual void updateTitle(TvShow& show) const = 0; virtual void updateRemoteId(TvShow& show) const = 0; virtual void updateRelations(TvShow& show) const = 0; virtual void updateAiringDates(TvShow& show) const = 0; virtual void updateSynonyms(TvShow& show) const = 0; virtual void updateImage(TvShow& show, QDir libraryDir) const = 0; }; class SearchResult { public: SearchResult(QString searchedQuery = QString()); virtual ~SearchResult(); // TODO make this true const again fucking shit virtual Entry* bestEntry() = 0; const QString searchedQuery; QList<Entry*> entries; }; class Client : public QObject { Q_OBJECT public: Client(OnlineCredentials& credentials, OnlineCredentials::TimeLock& lock, QObject* parent = NULL); SearchResult* findShow(TvShow& show); virtual const QString identifierKey() const = 0; virtual UpdateFilter getFilter() { return UpdateFilter::ufNone; } const OnlineCredentials& credentials; protected: virtual SearchResult* search(QString anime) = 0; OnlineCredentials::TimeLock& lock; }; } #endif // ONLINETVSHOWDATABASE_H
/***************************************************************************** * * PROJECT: Multi Theft Auto * LICENSE: See LICENSE in the top level directory * FILE: Shared/sdk/SharedUtil.Crypto.hpp * * Multi Theft Auto is available from http://www.multitheftauto.com/ * *****************************************************************************/ #pragma once #include <cryptopp/base64.h> namespace SharedUtil { inline SString Base64encode(const SString& data) { SString result; CryptoPP::StringSource ss(data, true, new CryptoPP::Base64Encoder(new CryptoPP::StringSink(result), false)); // Memory is freed automatically return result; } inline SString Base64decode(const SString& data) { SString result; CryptoPP::StringSource ss(data, true, new CryptoPP::Base64Decoder(new CryptoPP::StringSink(result))); // Memory is freed automatically return result; } }
/** ****************************************************************************** * @file USB_Device/HID_Standalone/Inc/stm32f0xx_it.h * @author MCD Application Team * @brief This file contains the headers of the interrupt handlers. ****************************************************************************** * @attention * * <h2><center>&copy; Copyright (c) 2016 STMicroelectronics International N.V. * All rights reserved.</center></h2> * * Redistribution and use in source and binary forms, with or without * modification, are permitted, provided that the following conditions are met: * * 1. Redistribution 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 STMicroelectronics nor the names of other * contributors to this software may be used to endorse or promote products * derived from this software without specific written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * ****************************************************************************** */ /* Define to prevent recursive inclusion -------------------------------------*/ #ifndef __STM32F0xx_IT_H #define __STM32F0xx_IT_H #ifdef __cplusplus extern "C" { #endif /* Includes ------------------------------------------------------------------*/ /* Exported types ------------------------------------------------------------*/ /* Exported constants --------------------------------------------------------*/ /* Exported macro ------------------------------------------------------------*/ /* Exported functions ------------------------------------------------------- */ void NMI_Handler(void); void HardFault_Handler(void); void SVC_Handler(void); void PendSV_Handler(void); void SysTick_Handler(void); void USB_IRQHandler(void); void EXTI4_15_IRQHandler(void); #ifdef __cplusplus } #endif #endif /* __STM32F0xx_IT_H */ /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
/** * @file function_gen.h * @brief function generator object * * This can be used for example as function for a control_action_function * Use this as super-"class" for function implementations. * * @author Carsten Bruns (carst.bruns@gmx.de) */ #ifndef FUNCTION_GEN_H_ #define FUNCTION_GEN_H_ /** * @brief struct defining a function generator object * * Use this as super-"class" for more function generators. */ typedef struct { /** * @brief generates the next value (sample) of the function * * @param function_gen pointer to this struct * @return the next sample */ int (*next_val)(void* const function_gen); } function_gen_t; #endif
// __ // ____ ___ ___ ____ ___ ____ / /__ __ // / __ `__ \/ _ \/ __ `__ \/ __ \ / __/ | / / // / / / / / / __/ / / / / / /_/ // /_ | |/ / // /_/ /_/ /_/\___/_/ /_/ /_/\____(_)__/ |___/ // // // Created by Memo Akten, www.memo.tv // // ofxMSAControlFreakGui // #pragma once #include "ofxMSAControlFreakGui/src/controls/BoolBase.h" namespace msa { namespace controlfreak { namespace gui { class BoolButton : public BoolBase { public: //-------------------------------------------------------------- BoolButton(Container *parent, string s) : BoolBase(parent, s) {} //-------------------------------------------------------------- BoolButton(Container *parent, ParameterBool* p) : BoolBase(parent, p) {} //-------------------------------------------------------------- void draw() { // draw bg ofFill(); setToggleColor(getParameter().value()); ofRect(0, 0, width, height); // drawText(3, 15); drawTextCentered(); drawBorder(); checkBang(); } }; } } }
/* * Multi2Sim * Copyright (C) 2013 Rafael Ubal (ubal@ece.neu.edu) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef M2C_SI2BIN_INNER_BIN_H #define M2C_SI2BIN_INNER_BIN_H #include <elf.h> #include <stdio.h> #include <vector> #include <memory> #include <lib/cpp/ELFWriter.h> #include <src/arch/southern-islands/asm/Binary.h> namespace si2bin { /* Forward Declarations */ class InnerBinEntry; class InnerBin; /* * Note in the PT_NOTE segment */ enum InnerBinNoteType { InnerBinNoteTypeInvalid = 0, InnerBinNoteTypeProgInfo, InnerBinNoteTypeInputs, InnerBinNoteTypeOutputs, InnerBinNoteTypeCondOut, InnerBinNoteTypeFloat32Consts, InnerBinNoteTypeInt32Consts, InnerBinNoteTypeBool32Consts, InnerBinNoteTypeEarlyExit, InnerBinNoteTypeGlobalBuffers, InnerBinNoteTypeConstantBuffers, InnerBinNoteTypeInputSamplers, InnerBinNoteTypePersistentBuffers, InnerBinNoteTypeScratchBuffers, InnerBinNoteTypeSubConstantBuffers, InnerBinNoteTypeUAVMailboxSize, InnerBinNoteTypeUAV, InnerBinNoteTypeUAVOPMask }; class InnerBinNote { friend class InnerBinEntry; InnerBinEntry *entry; InnerBinNoteType type; unsigned int size; std::unique_ptr<void> payload; /* Constructor */ InnerBinNote(InnerBinEntry *entry, InnerBinNoteType type, unsigned int size, void *payload); public: //InnerBinNoteDump(); /* Getters */ unsigned int getType() { return type; } unsigned int getSize() { return size; } void *getPayload() { return payload.get(); } }; class InnerBinEntry { friend class InnerBin; InnerBin *bin; /* Public fields: * - d_machine * Private fields: * - d_type * - d_offset - offset for encoding data (PT_NOTE + PT_LOAD segments) * - d_size - size of encoding data (PT_NOTE + PT_LOAD segments) * - d_flags */ SI::BinaryDictHeader header; /* This will form the .text section containing the final ISA. The user * is responsible for dumping instructions in this buffer. The buffer is * created and freed internally, however. */ ELFWriter::Buffer *text_section_buffer; /* Public field */ ELFWriter::Section *text_section; /* Private field */ /* Section .data associated with this encoding dictionary entry. The * user can fill it out by adding data into the buffer. */ ELFWriter::Buffer *data_section_buffer; /* Public field */ ELFWriter::Section *data_section; /* Private field */ /* Symbol table associated with the encoding dictionary entry. It is * initialized internally, and the user can just add new symbols * using function 'elf_enc_symbol_table_add'. */ ELFWriter::SymbolTable *symbol_table; /* Public field */ /* List of notes. Each element is of type 'si2bin_inner_bin_note_t'. * Private field. */ std::list<std::unique_ptr<InnerBinNote>> note_list; ELFWriter::Buffer *note_buffer; public: /* Constructor */ InnerBinEntry(InnerBin *bin); /* Getters */ SI::BinaryDictHeader *getHeader() { return &header; } ELFWriter::Buffer *getTextSectionBuffer() { return text_section_buffer; } ELFWriter::Buffer *getDataSectionBuffer() { return data_section_buffer; } ELFWriter::SymbolTable *getSymbolTable() { return symbol_table; }; unsigned int getSize() { return header.d_size; } void setSize(unsigned int size) { header.d_size = size; } void setOffset(unsigned int offset) { header.d_offset = offset; } void setType(unsigned int type) { header.d_type = type; } void setMachine(unsigned int machine) { header.d_machine = machine; } void newNote(InnerBinNoteType type, unsigned int size, void *payload); }; /* * AMD Internal ELF */ class InnerBin { friend class OuterBin; std::string name; /* Program Resource */ SI::BinaryComputePgmRsrc2 pgm_rsrc2; /* Number of SGPRS and VGPRS */ int num_sgprs; int num_vgprs; std::vector<std::unique_ptr<SI::BinaryUserElement>> user_element_list; /* FloatMode */ int FloatMode; /*IeeeMode */ int IeeeMode; std::vector<std::unique_ptr<InnerBinEntry>> entry_list; /* Constructor */ InnerBin(const std::string &name); public: /* Make ELF Writer Public so New Buffer, Section, and Segments * easily be made */ ELFWriter::File writer; /* Getters */ std::string getName() { return name; } SI::BinaryComputePgmRsrc2 *getPgmRsrc2() { return &pgm_rsrc2; } int getNumSgpr() { return num_sgprs; } int getNumVgpr() { return num_vgprs; } int getFloatMode() { return FloatMode; } int getIeeeMode() { return IeeeMode; } InnerBinEntry *getEntry(unsigned int index) { return index < entry_list.size() ? entry_list[index].get() : nullptr; } SI::BinaryUserElement *getUserElement(unsigned int index) { return index < user_element_list.size() ? user_element_list[index].get() : nullptr; } unsigned int getUserElementCount() { return user_element_list.size(); } /* Setters */ void setPgmRsrc2(SI::BinaryComputePgmRsrc2 &pgm_rsrc2) { this->pgm_rsrc2 = pgm_rsrc2; } void setNumSgpr(int num_sgprs) { this->num_sgprs = num_sgprs; } void setNumVgpr(int num_vgprs) { this->num_vgprs = num_vgprs; } void setFloatMode(int FloatMode) { this->FloatMode = FloatMode; } void setIeeeMode(int IeeMode) { this->IeeeMode = IeeeMode; } void Generate(std::ostream& os); SI::BinaryUserElement *newUserElement(unsigned int index, unsigned int dataClass, unsigned int apiSlot, unsigned int startUserReg, unsigned int userRegCount); InnerBinEntry *newEntry(); }; } /* namespace si2bin */ #endif
#ifndef GLOBALUI_H #define GLOBALUI_H #include <QtWidgets/QApplication> #include <Thread.h> class MainWindow; class Controller; class Config; class GlobalUI : public Thread { public: GlobalUI( Config* config, Controller* controller ); ~GlobalUI(); void Run() { while( run() ); } protected: virtual bool run(); private: QApplication* mApplication; Config* mConfig; Controller* mController; MainWindow* mMainWindow; }; #endif // GLOBALUI_H
/* $XFree86: xc/lib/GL/mesa/src/drv/ffb/ffb_vbtmp.h,v 1.1 2002/02/22 21:32:59 dawes Exp $ */ static void TAG(emit)(GLcontext *ctx, GLuint start, GLuint end) { ffbContextPtr fmesa = FFB_CONTEXT(ctx); struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb; #if (IND & (FFB_VB_RGBA_BIT)) GLfloat (*col0)[4]; GLuint col0_stride; #if (IND & (FFB_VB_TWOSIDE_BIT)) GLfloat (*col1)[4]; GLuint col1_stride; #endif #endif #if (IND & FFB_VB_XYZ_BIT) GLfloat (*proj)[4] = VB->ProjectedClipPtr->data; GLuint proj_stride = VB->ProjectedClipPtr->stride; const GLubyte *mask = VB->ClipMask; #endif ffb_vertex *v = &fmesa->verts[start]; int i; #ifdef VB_DEBUG fprintf(stderr, "FFB: ffb_emit [" #if (IND & (FFB_VB_XYZ_BIT)) " XYZ" #endif #if (IND & (FFB_VB_RGBA_BIT)) " RGBA" #endif #if (IND & (FFB_VB_TWOSIDE_BIT)) " TWOSIDE" #endif "] start(%d) end(%d) import(%d)\n", start, end, VB->importable_data); #endif #if (IND & (FFB_VB_RGBA_BIT)) if (VB->ColorPtr[0]->Type != GL_FLOAT) ffbImportColors(fmesa, ctx, 0); #if (IND & (FFB_VB_TWOSIDE_BIT)) if (VB->ColorPtr[1]->Type != GL_FLOAT) ffbImportColors(fmesa, ctx, 1); #endif col0 = (GLfloat (*)[4]) VB->ColorPtr[0]->Ptr; col0_stride = VB->ColorPtr[0]->StrideB; #if (IND & (FFB_VB_TWOSIDE_BIT)) col1 = (GLfloat (*)[4]) VB->ColorPtr[1]->Ptr; col1_stride = VB->ColorPtr[1]->StrideB; #endif #endif if (VB->importable_data) { if (start) { #if (IND & (FFB_VB_XYZ_BIT)) proj = (GLfloat (*)[4])((GLubyte *)proj + start * proj_stride); #endif #if (IND & (FFB_VB_RGBA_BIT)) col0 = (GLfloat (*)[4])((GLubyte *)col0 + start * col0_stride); #if (IND & (FFB_VB_TWOSIDE_BIT)) col1 = (GLfloat (*)[4])((GLubyte *)col1 + start * col1_stride); #endif #endif } for (i = start; i < end; i++, v++) { #if (IND & (FFB_VB_XYZ_BIT)) if (mask[i] == 0) { v->x = proj[0][0]; v->y = proj[0][1]; v->z = proj[0][2]; } proj = (GLfloat (*)[4])((GLubyte *)proj + proj_stride); #endif #if (IND & (FFB_VB_RGBA_BIT)) v->color[0].alpha = CLAMP(col0[0][3], 0.0f, 1.0f); v->color[0].red = CLAMP(col0[0][0], 0.0f, 1.0f); v->color[0].green = CLAMP(col0[0][1], 0.0f, 1.0f); v->color[0].blue = CLAMP(col0[0][2], 0.0f, 1.0f); col0 = (GLfloat (*)[4])((GLubyte *)col0 + col0_stride); #if (IND & (FFB_VB_TWOSIDE_BIT)) v->color[1].alpha = CLAMP(col1[0][3], 0.0f, 1.0f); v->color[1].red = CLAMP(col1[0][0], 0.0f, 1.0f); v->color[1].green = CLAMP(col1[0][1], 0.0f, 1.0f); v->color[1].blue = CLAMP(col1[0][2], 0.0f, 1.0f); col1 = (GLfloat (*)[4])((GLubyte *)col1 + col1_stride); #endif #endif } } else { for (i = start; i < end; i++, v++) { #if (IND & (FFB_VB_XYZ_BIT)) if (mask[i] == 0) { v->x = proj[i][0]; v->y = proj[i][1]; v->z = proj[i][2]; } #endif #if (IND & (FFB_VB_RGBA_BIT)) v->color[0].alpha = CLAMP(col0[i][3], 0.0f, 1.0f); v->color[0].red = CLAMP(col0[i][0], 0.0f, 1.0f); v->color[0].green = CLAMP(col0[i][1], 0.0f, 1.0f); v->color[0].blue = CLAMP(col0[i][2], 0.0f, 1.0f); #if (IND & (FFB_VB_TWOSIDE_BIT)) v->color[1].alpha = CLAMP(col1[i][3], 0.0f, 1.0f); v->color[1].red = CLAMP(col1[i][0], 0.0f, 1.0f); v->color[1].green = CLAMP(col1[i][1], 0.0f, 1.0f); v->color[1].blue = CLAMP(col1[i][2], 0.0f, 1.0f); #endif #endif } } } static void TAG(interp)(GLcontext *ctx, GLfloat t, GLuint edst, GLuint eout, GLuint ein, GLboolean force_boundary) { #if (IND & (FFB_VB_XYZ_BIT | FFB_VB_RGBA_BIT)) ffbContextPtr fmesa = FFB_CONTEXT(ctx); #endif #if (IND & (FFB_VB_XYZ_BIT)) struct vertex_buffer *VB = &TNL_CONTEXT(ctx)->vb; const GLfloat *dstclip = VB->ClipPtr->data[edst]; GLfloat oow = 1.0 / dstclip[3]; #endif #if (IND & (FFB_VB_XYZ_BIT | FFB_VB_RGBA_BIT)) ffb_vertex *dst = &fmesa->verts[edst]; #endif #if (IND & (FFB_VB_RGBA_BIT)) ffb_vertex *in = &fmesa->verts[eout]; ffb_vertex *out = &fmesa->verts[ein]; #endif #ifdef VB_DEBUG fprintf(stderr, "FFB: ffb_interp [" #if (IND & (FFB_VB_XYZ_BIT)) " XYZ" #endif #if (IND & (FFB_VB_RGBA_BIT)) " RGBA" #endif #if (IND & (FFB_VB_TWOSIDE_BIT)) " TWOSIDE" #endif "] edst(%d) eout(%d) ein(%d)\n", edst, eout, ein); #endif #if (IND & (FFB_VB_XYZ_BIT)) dst->x = dstclip[0] * oow; dst->y = dstclip[1] * oow; dst->z = dstclip[2] * oow; #endif #if (IND & (FFB_VB_RGBA_BIT)) INTERP_F(t, dst->color[0].alpha, out->color[0].alpha, in->color[0].alpha); INTERP_F(t, dst->color[0].red, out->color[0].red, in->color[0].red); INTERP_F(t, dst->color[0].green, out->color[0].green, in->color[0].green); INTERP_F(t, dst->color[0].blue, out->color[0].blue, in->color[0].blue); #if (IND & (FFB_VB_TWOSIDE_BIT)) INTERP_F(t, dst->color[1].alpha, out->color[1].alpha, in->color[1].alpha); INTERP_F(t, dst->color[1].red, out->color[1].red, in->color[1].red); INTERP_F(t, dst->color[1].green, out->color[1].green, in->color[1].green); INTERP_F(t, dst->color[1].blue, out->color[1].blue, in->color[1].blue); #endif #endif } static void TAG(init)(void) { setup_tab[IND].emit = TAG(emit); setup_tab[IND].interp = TAG(interp); } #undef IND #undef TAG
// // usbprinter.h // // Circle - A C++ bare metal environment for Raspberry Pi // Copyright (C) 2014-2018 R. Stange <rsta2@o2online.de> // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this program. If not, see <http://www.gnu.org/licenses/>. // #ifndef _circle_usb_usbprinter_h #define _circle_usb_usbprinter_h #include <circle/usb/usbfunction.h> #include <circle/usb/usbendpoint.h> #include <circle/types.h> enum TUSBPrinterProtocol { USBPrinterProtocolUnknown = 0, USBPrinterProtocolUnidirectional = 1, USBPrinterProtocolBidirectional = 2 }; class CUSBPrinterDevice : public CUSBFunction { public: CUSBPrinterDevice (CUSBFunction *pFunction); ~CUSBPrinterDevice (void); boolean Configure (void); int Write (const void *pBuffer, size_t nCount); private: TUSBPrinterProtocol m_Protocol; CUSBEndpoint *m_pEndpointIn; CUSBEndpoint *m_pEndpointOut; static unsigned s_nDeviceNumber; }; #endif
/*************************************************************************** ** ** ** This file is part of SpineCreator, an easy to use, GUI for ** ** describing spiking neural network models. ** ** Copyright (C) 2013 Alex Cope, Paul Richmond ** ** ** ** This program is free software: you can redistribute it and/or modify ** ** it under the terms of the GNU General Public License as published by ** ** the Free Software Foundation, either version 3 of the License, or ** ** (at your option) any later version. ** ** ** ** This program is distributed in the hope that it will be useful, ** ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** ** GNU General Public License for more details. ** ** ** ** You should have received a copy of the GNU General Public License ** ** along with this program. If not, see http://www.gnu.org/licenses/. ** ** ** **************************************************************************** ** Author: Alex Cope ** ** Website/Contact: http://bimpa.group.shef.ac.uk/ ** ****************************************************************************/ #ifndef NINEML_LAYOUT_CLASSES_H #define NINEML_LAYOUT_CLASSES_H // include existing classes #include "nineML_classes.h" #include "cinterpreter.h" enum transformType { IDENTITY, TRANSLATE, ROTATE, SCALE }; class RegimeSpace; class NineMLLayout: public NineMLRootObject { public: QString name; QString type; vector <RegimeSpace*> RegimeList; vector <StateVariable*> StateVariableList; vector <Parameter*> ParameterList; vector <Alias*> AliasList; NineMLLayout(NineMLLayout *data); NineMLLayout& operator=(const NineMLLayout& data); NineMLLayout(){} ~NineMLLayout(); QStringList validateComponent(); void load(QDomDocument *doc); void write(QDomDocument *doc); QString getXMLName(); }; class Transform { public: int order; transformType type; QString variableName; StateVariable * variable; MathInLine * maths; dim * dims; Transform(Transform *data); Transform(){} ~Transform(); void readIn(QDomElement e); void writeOut(QDomDocument *doc, QDomElement &parent); int validateTransform(NineMLLayout *component, QStringList * errs); }; class TransformData { public: float value; dim * dims; TransformData(Transform *data); TransformData(){} ~TransformData(){} }; class OnConditionSpace { public: // temp name QString target_regime_name; RegimeSpace *target_regime; vector <StateAssignment*> StateAssignList; vector <Transform*> TransformList; Trigger *trigger; OnConditionSpace(OnConditionSpace *data); OnConditionSpace(){} ~OnConditionSpace(); int validateOnCondition(NineMLLayout *component, QStringList * errs); void readIn(QDomElement e); void writeOut(QDomDocument *doc, QDomElement &parent); }; class RegimeSpace { public: QString name; vector <Transform*> TransformList; vector <OnConditionSpace* > OnConditionList; RegimeSpace(RegimeSpace *data); RegimeSpace(){} ~RegimeSpace(); int validateRegime(NineMLLayout *component, QStringList * errs); void readIn(QDomElement e); void writeOut(QDomDocument *doc, QDomElement &parent); }; class NineMLLayoutData : public NineMLData { public: int seed; double minimumDistance; NineMLLayout * component; NineMLLayoutData(NineMLLayout *data); NineMLLayoutData& operator=(const NineMLLayoutData& data); NineMLLayoutData(){} ~NineMLLayoutData(){} void import_parameters_from_xml(QDomNode &e); void generateLayout(int numNeurons, vector<loc> *locations, QString &errRet); vector < loc > locations; }; #endif // NINEML_LAYOUT_CLASSES_H
#ifndef __DV_CHANNEL_H__ #define __DV_CHANNEL_H__ #include "dv_types.h" #include "dv_event.h" enum { DV_CH_CMD_OPEN = 1, DV_CH_CMD_QUIT, DV_CH_CMD_TERMINATE, DV_CH_CMD_CLOSE, DV_CH_CMD_MAX, }; typedef struct _dv_channel_t { dv_u32 ch_command; pid_t ch_pid; int ch_fd; } dv_channel_t; extern void dv_close_channel(int *fd); extern void dv_add_channel_read_event(int fd, dv_event_handler handler); extern int dv_write_channel(int fd, const void *msg, size_t len); extern void dv_destroy_channel_events(void); #endif
#pragma once #if defined(_MSC_VER) #ifdef OMNIENGINE_EXPORTS #define SHARED_MEMBER #define SHARED __declspec(dllexport) #else #define SHARED_MEMBER #define SHARED __declspec(dllimport) #endif #elif defined(__GNUC__) #ifdef OMNIENGINE_EXPORTS #define SHARED_MEMBER __attribute__((visibility("default"))) #define SHARED __attribute__((visibility("default"))) #else #define SHARED_MEMBER #define SHARED #endif #else #pragma warning Unknown dynamic link import/export semantics. #endif
/* Ophidia Analytics Framework Copyright (C) 2012-2021 CMCC Foundation This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. */ #ifndef __OPH_ANALYTICS_FRAMEWORK_H #define __OPH_ANALYTICS_FRAMEWORK_H /** * \brief Function to launch ophidia analytics framework * \param task_string Input parameters string * \param task_number Number of total task executed * \param task_rank Rank of the current task * \return 0 if successfull, -1 otherwise */ int oph_af_execute_framework(char *task_string, int task_number, int task_rank); #endif //__OPH_ANALYTICS_FRAMEWORK_H
/* * OMAP Voltage Management Routines * * Copyright (C) 2011, Texas Instruments, Inc. * * 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. */ #ifndef __ARCH_ARM_OMAP_VOLTAGE_H #define __ARCH_ARM_OMAP_VOLTAGE_H /** * struct omap_volt_data - Omap voltage specific data. * @voltage_nominal: The possible voltage value in uV * @sr_efuse_offs: The offset of the efuse register(from system * control module base address) from where to read * the n-target value for the smartreflex module. * @sr_errminlimit: Error min limit value for smartreflex. This value * differs at differnet opp and thus is linked * with voltage. * @vp_errorgain: Error gain value for the voltage processor. This * field also differs according to the voltage/opp. */ struct omap_volt_data { u32 volt_nominal; u32 sr_efuse_offs; u8 sr_errminlimit; u8 vp_errgain; }; struct voltagedomain; struct voltagedomain *voltdm_lookup(const char *name); int voltdm_scale(struct voltagedomain *voltdm, unsigned long target_volt); unsigned long voltdm_get_voltage(struct voltagedomain *voltdm); struct omap_volt_data *omap_voltage_get_voltdata(struct voltagedomain *voltdm, unsigned long volt); #endif
// This file was generated based on /usr/local/share/uno/Packages/Fuse.FileSystem/1.3.1/PathTools.uno. // WARNING: Changes might be lost if you edit this file directly. #pragma once #include <Uno.h> namespace g{namespace Fuse{namespace FileSystem{struct PathTools;}}} namespace g{ namespace Fuse{ namespace FileSystem{ // internal static class PathTools :6 // { uClassType* PathTools_typeof(); void PathTools__NormalizePath_fn(uString* path, uString** __retval); struct PathTools : uObject { static uString* NormalizePath(uString* path); }; // } }}} // ::g::Fuse::FileSystem
#include "common.h" #include <stdlib.h> void ft_strdel(char **pstr) { if (pstr && *pstr) { free(*pstr); *pstr = NULL; } }
#pragma once//☀SDX_STG #include "IStage.h" #include "Layer.h" #include "Unit.h" #include "Shot.h" #include "Enemy.h" #include "Item.h" namespace SDX_STG { using namespace SDX; class Stage : public IStage { private: Layer<Object> backEffects; Layer<Object> midEffects; Layer<Object> frontEffects; Layer<Unit> allys; Layer<Enemy> skyEnemys; Layer<Enemy> earthEnemys; Layer<Item> items; Layer<Shot> allyShots; Layer<Shot> enemyShots; std::vector<std::shared_ptr<IModule>> events; /** レイヤー等を初期化.*/ void Clear() { timer = 0; backEffects.Clear(); midEffects.Clear(); frontEffects.Clear(); allys.Clear(); skyEnemys.Clear(); earthEnemys.Clear(); items.Clear(); allyShots.Clear(); enemyShots.Clear(); } /** 当たり判定処理を行う.*/ void Hit() { //敵,敵弾,自機,自機弾 allys.Hit( skyEnemys ); allys.Hit( enemyShots ); skyEnemys.Hit( allyShots ); earthEnemys.Hit( allyShots ); //アイテム if ( GetPlayer() && !GetPlayer()->GetRemoveFlag()) { items.Hit(GetPlayer()); } } public: std::unique_ptr<Camera> camera; double scrSpeedX = 0; double scrSpeedY = 0; Rect liveArea = Rect(300 , 300 , 640 , 700); Rect moveArea = Rect(300 , 300 , 600 , 600); std::shared_ptr<Unit> player; Stage(): camera( new Camera( 400 , 300 , 1) ) { SetNow(); } virtual ~Stage(){} void SetNow() { SStage = this; camera->SetActive(); } void Update() override { SetNow(); ++timer; //イベント処理 for (auto it : events) { it->Update(); } //レイヤー処理 backEffects.Update(); midEffects.Update(); frontEffects.Update(); allys.Update(); skyEnemys.Update(); earthEnemys.Update(); items.Update(); allyShots.Update(); enemyShots.Update(); camera->Update(); Hit(); //消滅処理 backEffects.ExeRemove(&liveArea); midEffects.ExeRemove(&liveArea); frontEffects.ExeRemove(&liveArea); allys.ExeRemove(&liveArea); skyEnemys.ExeRemove(&liveArea); earthEnemys.ExeRemove(&liveArea); items.ExeRemove(&liveArea); allyShots.ExeRemove(&liveArea); enemyShots.ExeRemove(&liveArea); } void Draw() override { SetNow(); backEffects.Draw(); earthEnemys.Draw(); Screen::SetBright({ 0, 0, 0 }); Screen::SetBlendMode( BlendMode::Alpha , 128 ); allys.DrawShadow( 50 , 50 ); skyEnemys.DrawShadow( 50 , 50 ); Screen::SetBlendMode( BlendMode::NoBlend , 0 ); Screen::SetBright({ 255, 255, 255 }); midEffects.Draw(); allyShots.Draw(); allys.Draw(); items.Draw(); skyEnemys.Draw(); enemyShots.Draw(); frontEffects.Draw(); } Rect* GetMoveArea() override { return &moveArea; } Rect* GetLiveArea() override { return &liveArea; } void SetPlayer( Unit* 自機) override { if ( 自機 ) { Add(自機); player = allys.objectS[0]; } else { player = nullptr; } } Unit* GetPlayer() override { return player.get(); } bool isPlayerLive() override { return !player->GetRemoveFlag(); } void Add(Unit *追加するUnit, int 待機時間 = 0) override { allys.Add(追加するUnit, 待機時間); } void Add(Enemy *追加するEnemy, int 待機時間 = 0) override { switch (追加するEnemy->GetBelong()) { case Belong::EnemyF: skyEnemys.Add(追加するEnemy, 待機時間); break; case Belong::EnemyG: earthEnemys.Add(追加するEnemy, 待機時間); break; } } void Add(Shot *追加するShot, int 待機時間 = 0) override { if (追加するShot->GetBelong() == Belong::Ally) { allyShots.Add(追加するShot, 待機時間); }else{ enemyShots.Add(追加するShot, 待機時間); } } void Add(Item *追加するItem, int 待機時間 = 0) override { items.Add(追加するItem, 待機時間); } void Add(Object *追加するObject, int 待機時間 = 0) override { midEffects.Add(追加するObject, 待機時間); } void AddFront(Object *追加するObject, int 待機時間 = 0) override { frontEffects.Add(追加するObject, 待機時間); } void AddBack(Object *追加するObject, int 待機時間 = 0) override { backEffects.Add(追加するObject, 待機時間); } void AddEvent(IModule *追加するEvent) override { events.emplace_back(追加するEvent); } Enemy* GetNearEnemy(Object* 比較するObject) override { if( skyEnemys.GetCount() == 0 ) { return earthEnemys.GetNearest(比較するObject); } return skyEnemys.GetNearest(比較するObject); } }; }
/**************************************************************************** ** ** Copyright (C) 2017 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** ** This file is part of Qt Creator. ** ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in ** a written agreement between you and The Qt Company. For licensing terms ** and conditions see https://www.qt.io/terms-conditions. For further ** information use the contact form at https://www.qt.io/contact-us. ** ** GNU General Public License Usage ** Alternatively, this file may be used under the terms of the GNU ** General Public License version 3 as published by the Free Software ** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT ** included in the packaging of this file. Please review the following ** information to ensure the GNU General Public License requirements will ** be met: https://www.gnu.org/licenses/gpl-3.0.html. ** ****************************************************************************/ #pragma once /* See std(::experimental)::variant. */ // std::variant from Apple's Clang supports methods that throw std::bad_optional_access only // with deployment target >= macOS 10.14 // TODO: Use std::variant everywhere when we can require macOS 10.14 #if !defined(__apple_build_version__) #include <variant> namespace Utils { using std::get; using std::get_if; using std::holds_alternative; using std::variant; using std::variant_alternative_t; using std::visit; } // namespace Utils #else #include <3rdparty/variant/variant.hpp> namespace Utils { using mpark::get; using mpark::get_if; using mpark::holds_alternative; using mpark::variant; using mpark::variant_alternative_t; using mpark::visit; } // namespace Utils #endif
// Copyright (C) 2014 Jakub Lewandowski <jakub.lewandowski@gmail.com> // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this program. If not, see <http://www.gnu.org/licenses/>. #ifndef LINKER_SYMBOLS_C_INCLUDED_NVSSJWRR #define LINKER_SYMBOLS_C_INCLUDED_NVSSJWRR #include <mm/linker_symbols.h> extern char _kernel_virt_offset[]; extern char _kernel_phys_start[]; extern char _kernel_virt_start[]; extern char _kernel_phys_end[]; extern char _kernel_virt_end[]; const uintptr_t kernel_virt_offset = (uintptr_t)&_kernel_virt_offset; const uintptr_t kernel_phys_start = (uintptr_t)&_kernel_phys_start; const uintptr_t kernel_virt_start = (uintptr_t)&_kernel_virt_start; const uintptr_t kernel_phys_end = (uintptr_t)&_kernel_phys_end; const uintptr_t kernel_virt_end = (uintptr_t)&_kernel_virt_end; #endif // include guard
GType ags_echo_channel_get_type() { static GType ags_type_echo_channel = 0; if(!ags_type_echo_channel){ static const GTypeInfo ags_echo_channel_info = { sizeof (AgsEchoChannelClass), NULL, /* base_init */ NULL, /* base_finalize */ (GClassInitFunc) ags_echo_channel_class_init, NULL, /* class_finalize */ NULL, /* class_channel */ sizeof (AgsEchoChannel), 0, /* n_preallocs */ (GInstanceInitFunc) ags_echo_channel_init, }; static const GInterfaceInfo ags_plugin_interface_info = { (GInterfaceInitFunc) ags_echo_channel_plugin_interface_init, NULL, /* interface_finalize */ NULL, /* interface_data */ }; ags_type_echo_channel = g_type_register_static(AGS_TYPE_RECALL_CHANNEL, "AgsEchoChannel\0", &ags_echo_channel_info, 0); g_type_add_interface_static(ags_type_echo_channel, AGS_TYPE_PLUGIN, &ags_plugin_interface_info); } return(ags_type_echo_channel); }
#include <stdint.h> #define PI_VER 2 #include "registers.h" volatile uint8_t *cmdpos; uint8_t cmdbuf[8]; volatile const uint8_t *outpos; /* The following is the remains of the attempted use of interrupts to increase preformance. This approach is currently scrapped, but I'm keeping the code around for future reference. */ void read_irq(void); void write_irq(void); void null_write_irq(void); extern void enable_irq(void); extern void (*c_irq_handler)(void); volatile uint8_t cs1_triggered; // These aren't handling the reset line... Or CS2... void read_irq(void) { *cmdpos++ = GPLEV0 >> D0; // Nice and simple, right? GPEDS0 = 1 << CLK; // TODO: What if it's actually CS1? } void write_irq(void) { if (GPEDS0 & (1 << CS1)) { // Notify main loop. cs1_triggered = 1; GPEDS0 = 1 << CS1; return; } uint8_t value = *outpos++; GPSET0 = value << D0; GPCLR0 = ~value << D0; // Do I need to optimize this? GPEDS0 = 1 << CLK; } void null_write_irq(void) { if (GPEDS0 & (1 << CS1)) { // Notify main loop. cs1_triggered = 1; } GPEDS0 = (1 << CLK) | (1 << CS1); return; }
/* * OMAP3 Voltage Controller (VC) data * * Copyright (C) 2007, 2010 Texas Instruments, Inc. * Rajendra Nayak <rnayak@ti.com> * Lesly A M <x0080970@ti.com> * Thara Gopinath <thara@ti.com> * * Copyright (C) 2008, 2011 Nokia Corporation * Kalle Jokiniemi * Paul Walmsley * * 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. */ #include <linux/io.h> #include <linux/err.h> #include <linux/init.h> #include "common.h" #include "prm-regbits-34xx.h" #include "voltage.h" #include "vc.h" /* * VC data common to 34xx/36xx chips * XXX This stuff presumably belongs in the vc3xxx.c or vc.c file. */ static struct omap_vc_common omap3_vc_common = { .bypass_val_reg = OMAP3_PRM_VC_BYPASS_VAL_OFFSET, .data_shift = OMAP3430_DATA_SHIFT, .slaveaddr_shift = OMAP3430_SLAVEADDR_SHIFT, .regaddr_shift = OMAP3430_REGADDR_SHIFT, .valid = OMAP3430_VALID_MASK, .cmd_on_shift = OMAP3430_VC_CMD_ON_SHIFT, .cmd_on_mask = OMAP3430_VC_CMD_ON_MASK, .cmd_onlp_shift = OMAP3430_VC_CMD_ONLP_SHIFT, .cmd_ret_shift = OMAP3430_VC_CMD_RET_SHIFT, .cmd_off_shift = OMAP3430_VC_CMD_OFF_SHIFT, .i2c_cfg_clear_mask = OMAP3430_SREN_MASK | OMAP3430_HSEN_MASK, .i2c_cfg_hsen_mask = OMAP3430_HSEN_MASK, .i2c_cfg_reg = OMAP3_PRM_VC_I2C_CFG_OFFSET, .i2c_mcode_mask = OMAP3430_MCODE_MASK, }; struct omap_vc_channel omap3_vc_mpu = { .flags = OMAP_VC_CHANNEL_DEFAULT, .common = &omap3_vc_common, .smps_sa_reg = OMAP3_PRM_VC_SMPS_SA_OFFSET, .smps_volra_reg = OMAP3_PRM_VC_SMPS_VOL_RA_OFFSET, .smps_cmdra_reg = OMAP3_PRM_VC_SMPS_CMD_RA_OFFSET, .cfg_channel_reg = OMAP3_PRM_VC_CH_CONF_OFFSET, .cmdval_reg = OMAP3_PRM_VC_CMD_VAL_0_OFFSET, .smps_sa_mask = OMAP3430_PRM_VC_SMPS_SA_SA0_MASK, .smps_volra_mask = OMAP3430_VOLRA0_MASK, .smps_cmdra_mask = OMAP3430_CMDRA0_MASK, .cfg_channel_sa_shift = OMAP3430_PRM_VC_SMPS_SA_SA0_SHIFT, }; struct omap_vc_channel omap3_vc_core = { .common = &omap3_vc_common, .smps_sa_reg = OMAP3_PRM_VC_SMPS_SA_OFFSET, .smps_volra_reg = OMAP3_PRM_VC_SMPS_VOL_RA_OFFSET, .smps_cmdra_reg = OMAP3_PRM_VC_SMPS_CMD_RA_OFFSET, .cfg_channel_reg = OMAP3_PRM_VC_CH_CONF_OFFSET, .cmdval_reg = OMAP3_PRM_VC_CMD_VAL_1_OFFSET, .smps_sa_mask = OMAP3430_PRM_VC_SMPS_SA_SA1_MASK, .smps_volra_mask = OMAP3430_VOLRA1_MASK, .smps_cmdra_mask = OMAP3430_CMDRA1_MASK, .cfg_channel_sa_shift = OMAP3430_PRM_VC_SMPS_SA_SA1_SHIFT, }; /* * Voltage levels for different operating modes: on, sleep, retention and off */ #define OMAP3_ON_VOLTAGE_UV 1200000 #define OMAP3_ONLP_VOLTAGE_UV 1000000 #define OMAP3_RET_VOLTAGE_UV 975000 #define OMAP3_OFF_VOLTAGE_UV 600000 struct omap_vc_param omap3_mpu_vc_data = { .on = OMAP3_ON_VOLTAGE_UV, .onlp = OMAP3_ONLP_VOLTAGE_UV, .ret = OMAP3_RET_VOLTAGE_UV, .off = OMAP3_OFF_VOLTAGE_UV, }; struct omap_vc_param omap3_core_vc_data = { .on = OMAP3_ON_VOLTAGE_UV, .onlp = OMAP3_ONLP_VOLTAGE_UV, .ret = OMAP3_RET_VOLTAGE_UV, .off = OMAP3_OFF_VOLTAGE_UV, };
/* * node.c */ #include <stdio.h> #include <stdlib.h> #include "node.h" /* This function allocates space for a new node and * returns the pointer to this new node. * This function should be called while creating a new node * */ struct node* CreateNode() { return malloc(sizeof(struct node)); } /* Print the linked list with head pointing to the first node * For an empty linked list, print NULL * */ void PrintList(struct node* head) { struct node* current = head; while(current != NULL) { printf("%d ", current->data); current = current->next; } printf("NULL\n"); } /* Function: Insert a new node in front of linked list * Input: * head: pointer to the start of linked list * value: data field for new node * Return: new linked list after inserting the node * */ struct node* InsertInFront(struct node* head, int value) { struct node* newNode = CreateNode(); newNode->data = value; newNode->next = head; return newNode; } /* Function: to create a new linked list * Input: * values[]: array of integers containing values for data fields * len: length of values[] array * Return: New linked list where each node data contains * a value from values[] array * */ struct node* CreateList(int values[], int len) { // check for empty list if (len == 0) return NULL; struct node* head = NULL; int i; for(i=len; i>0; i--) { head = InsertInFront(head, values[i-1]); } return head; } /* --------------------------------------------------------- * ------- IMPLEMENT THE FUNCTIONS BELOW ------------------- * ---------------------------------------------------------*/ /* Function: Compute the length of linked list * Input: * head: pointer to the start of linked list * Return: length of the linked list */ int LinkedListLength(struct node* head) { struct node* current = head; int count; count = 0; while(current != NULL) { count++; current = current->next; } return count; } /* Function: Insert a new node at the end of linked list * Input: * head: pointer to the start of linked list * value: data field for new node * Return: new linked list after inserting the node * */ struct node* InsertAtEnd(struct node* head, int value) { struct node* current = head; if (current == NULL) { struct node* newNode = CreateNode(); newNode->data = value; newNode->next = NULL; return newNode; } while(current->next != NULL) { current = current->next; } struct node* newNode = CreateNode(); newNode->data = value; newNode->next = NULL; current->next = newNode; return head; } /* Function: Insert a new node with given data * Input: * head: pointer to the start of linked list * value: value to be stored in data field of new node * N: position of node AFTER which new node should be inserted * If N=0, then new node should be inserted in front (Special case) * Error: If invalid N, output error: * ERROR: Node <N> does not exist */ struct node* InsertAtN(struct node* head, int value, int N) { struct node* current = head; if (N == 0) { return InsertInFront(current, value); } int i; i = 0; while(current != NULL) { if ((i + 1) == N) { struct node* newNode = CreateNode(); newNode->data = value; newNode->next = current->next; current->next = newNode; return head; } current = current->next; i++; } printf("ERROR: Node %d does not exist\n", N); return head; } /* Function: Deletes a node at a given position from linked list * Input: * head: pointer to the start of linked list * pos: position of node to delete from linked list (pos is in [1,length]) * Return: new linked list after deleting the node * Error: If node to be deleted does not exist, output: * ERROR: Node does not exist */ struct node* DeleteNode(struct node* head, int pos) { struct node* current = head; if (pos == 1) { return current->next; } struct node* prev = NULL; int i; i = 1; while(current != NULL) { if (i == pos) { prev->next = current->next; return head; } prev = current; current = current->next; i++; } printf("ERROR: Node does not exist\n", pos); return head; }
/* randist/beta.c * * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2007 James Theiler, Brian Gough * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3 of the License, or (at * your option) any later version. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "config.h" #include <math.h> #include "gsl_math.h" #include "gsl_rng.h" #include "gsl_randist.h" #include "gsl_sf_gamma.h" /* The beta distribution has the form p(x) dx = (Gamma(a + b)/(Gamma(a) Gamma(b))) x^(a-1) (1-x)^(b-1) dx The method used here is the one described in Knuth */ double gsl_ran_beta (const gsl_rng * r, const double a, const double b) { if ( (a <= 1.0) && (b <= 1.0) ) { double U, V, X, Y; while (1) { U = gsl_rng_uniform_pos(r); V = gsl_rng_uniform_pos(r); X = pow(U, 1.0/a); Y = pow(V, 1.0/b); if ((X + Y ) <= 1.0) { if (X + Y > 0) { return X/ (X + Y); } else { double logX = log(U)/a; double logY = log(V)/b; double logM = logX > logY ? logX: logY; logX -= logM; logY -= logM; return exp(logX - log(exp(logX) + exp(logY))); } } } } else { double x1 = gsl_ran_gamma (r, a, 1.0); double x2 = gsl_ran_gamma (r, b, 1.0); return x1 / (x1 + x2); } } double gsl_ran_beta_pdf (const double x, const double a, const double b) { if (x < 0 || x > 1) { return 0 ; } else { double p; double gab = gsl_sf_lngamma (a + b); double ga = gsl_sf_lngamma (a); double gb = gsl_sf_lngamma (b); if (x == 0.0 || x == 1.0) { if (a > 1.0 && b > 1.0) { p = 0.0; } else { p = exp (gab - ga - gb) * pow (x, a - 1) * pow (1 - x, b - 1); } } else { p = exp (gab - ga - gb + log(x) * (a - 1) + log1p(-x) * (b - 1)); } return p; } }
//////////////////////////////////////////////////////////////////////////// // Created : 20.04.2010 // Author : Dmitriy Iassenev // Copyright (C) GSC Game World - 2010 //////////////////////////////////////////////////////////////////////////// #ifndef MIXING_N_ARY_TREE_WEIGHT_CALCULATOR_INLINE_H_INCLUDED #define MIXING_N_ARY_TREE_WEIGHT_CALCULATOR_INLINE_H_INCLUDED namespace xray { namespace animation { namespace mixing { inline n_ary_tree_weight_calculator::n_ary_tree_weight_calculator ( u32 const current_time_in_ms ) : m_result ( 0 ), m_current_time_in_ms( current_time_in_ms ), m_weight ( 0.f ), m_null_weight_found ( false ) { } inline float n_ary_tree_weight_calculator::weight ( ) const { return m_weight; } inline bool n_ary_tree_weight_calculator::null_weight_found ( ) const { return m_null_weight_found; } } // namespace mixing } // namespace animation } // namespace xray #endif // #ifndef MIXING_N_ARY_TREE_WEIGHT_CALCULATOR_INLINE_H_INCLUDED
#if !defined __DIALOGTYPE__ #define __DIALOGTYPE__ #include "GlobConst.h" DLLEXPORT typedef enum { CVIEWINSERT, CVIEWPROP, IVIEWPROP } DIALOGTYPE; #endif
/* * bool.h * * Created on: 26 kwi 2016 * Author: zabkiewp */ #ifndef BOOL_H_ #define BOOL_H_ #define true 1 #define false 0 typedef struct _bool { int val : 1; } __bool; #define stdbool __bool #endif /* BOOL_H_ */