text
stringlengths
4
6.14k
#ifndef VRFLUIDS_H_INCLUDED #define VRFLUIDS_H_INCLUDED #include "../Particles/VRParticles.h" OSG_BEGIN_NAMESPACE; class VRFluids : public VRParticles { public: enum SimulationType { SPH, XSPH }; VRFluids(string name, bool spawnParticles = true); ~VRFluids(); static shared_ptr<VRFluids> create(string name = "fluid"); void updateParticles(int from, int to) override; void updateSPH(int from, int to); void updateXSPH(int from, int to); void setSimulation(SimulationType t, bool forceChange=false); void setSphRadius(float newRadius); void setViscosity(float factor); void setMass(float newMass, float variation=0.0) override; void setRestDensity(float density); void setRestDensity(int rN, float rDIS); protected: VRUpdateCbPtr fluidFkt; SimulationType simulation = SPH; /* Calculate after bullets physics cycle? */ const bool afterBullet = false; /* * Pressure multiplier, derived from ideal gas law * P = N*(gas const)*(temperature) * (1/V) */ float PRESSURE_KAPPA = 0; // just some init value, see updateDerivedValues() /* Number of particles around a resting particle */ int REST_N = 1; /* Average distance of particles around resting particle */ float REST_DIS = 0.7; /* * Density where particles should rest. * (re-)calculate using updateDerivedValues(); */ float REST_DENSITY = 0; // just some init value, see updateDerivedValues() /* Simple viscosity multiplier */ float VISCOSITY_MU = 0.01; /* The number Pi given precisely to five decimal places */ const float Pi = 3.14159; /* The average sph radius of a particle. */ float sphRadius = 1; /* The average mass of a particle. */ float particleMass = 1; /* The average volume of a particle */ float particleVolume = 1; inline void xsph_calc_movement(SphParticle* p, int from, int to); inline float kernel_poly6(btVector3 distance_vector, float area) /*__attribute__((always_inline))*/; inline float kernel_spiky(btVector3 distance_vector, float area) /*__attribute__((always_inline))*/; inline btVector3 kernel_spiky_gradient(btVector3 distance_vector, float h) /*__attribute__((always_inline))*/; inline float kernel_visc(btVector3 distance_vector, float area) /*__attribute__((always_inline))*/; inline float kernel_visc_laplacian(btVector3 distance_vector, float area) /*__attribute__((always_inline))*/; inline void sph_calc_properties(SphParticle* p) /*__attribute__((always_inline))*/; inline void sph_calc_forces(SphParticle* p) /*__attribute__((always_inline))*/; void setFunctions(int from, int to) override; void disableFunctions() override; void updateDerivedValues(); }; typedef shared_ptr<VRFluids> VRFluidsPtr; OSG_END_NAMESPACE; #endif // VRFLUIDS_H_INCLUDED
#ifndef TraceNumeric_H #define TraceNumeric_H #include "Trace.h" namespace RevBayesCore { class TraceNumeric : public Trace<double> { public: TraceNumeric(); virtual ~TraceNumeric(){}; virtual TraceNumeric* clone(void) const; //!< Clone object double getMean() const; //!< compute the mean for the trace double getESS() const; //!< compute the effective sample size double getSEM() const; //!< compute the standard error of the mean double getMean(long begin, long end) const; //!< compute the mean for the trace with begin and end indices of the values double getESS(long begin, long end) const; //!< compute the effective sample size with begin and end indices of the values double getSEM(long begin, long end) const; //!< compute the effective sample size with begin and end indices of the values void computeStatistics(void); //int hasConverged() const { return converged; } int hasPassedGewekeTest() const { return passedGewekeTest; } int hasPassedStationarityTest() const { return passedStationarityTest; } //int hasPassedEssThreshold() const { return passedEssThreshold; } //int hasPassedSemThreshold() const { return passedSemThreshold; } //int hasPassedIidBetweenChainsStatistic() const { return passedIidBetweenChainsStatistic; } //int hasPassedGelmanRubinTest() const { return passedGelmanRubinTest; } protected: void update() const; //!< compute the correlation statistics (act,ess,sem,...) void update(long begin, long end) const; //!< compute the correlation statistics (act,ess,sem,...) // variable holding the data mutable double ess; //!< effective sample size mutable double mean; //!< mean of trace mutable double sem; //!< standard error of mean mutable long begin; mutable long end; // variable holding the data mutable double essw; //!< effective sample size mutable double meanw; //!< mean of trace mutable double semw; //!< standard error of mean //int converged; //!< Whether this parameter in itself has converged. int passedStationarityTest; //!< Whether this parameter passed the stationarity test. int passedGewekeTest; //!< Whether this parameter passed the Geweke statistic. //int passedEssThreshold; //!< Whether this parameter passed the threshold for the ESS. //int passedSemThreshold; //!< Whether this parameter passed the threshold for the SEM. //int passedIidBetweenChainsStatistic; //!< Whether this parameter passed the iid test of chains. //int passedGelmanRubinTest; //!< Whether this parameter passed the Gelman-Rubin statistic. mutable bool stats_dirty; mutable bool statsw_dirty; }; } #endif
/* * Copyright 2016, Cyril Bur, IBM Corp. * * 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. * * * Test the kernel's signal frame code. * * The kernel sets up two sets of ucontexts if the signal was to be * delivered while the thread was in a transaction. * Expected behaviour is that the checkpointed state is in the user * context passed to the signal handler. The speculated state can be * accessed with the uc_link pointer. * * The rationale for this is that if TM unaware code (which linked * against TM libs) installs a signal handler it will not know of the * speculative nature of the 'live' registers and may infer the wrong * thing. */ #include <stdlib.h> #include <stdio.h> #include <string.h> #include <signal.h> #include <unistd.h> #include <altivec.h> #include "utils.h" #include "tm.h" #define MAX_ATTEMPT 500000 #define NV_VSX_REGS 12 long tm_signal_self_context_load(pid_t pid, long *gprs, double *fps, vector int *vms, vector int *vss); static sig_atomic_t fail; vector int vss[] = { {1, 2, 3, 4 }, {5, 6, 7, 8 }, {9, 10, 11, 12}, {13, 14, 15, 16}, {17, 18, 19, 20}, {21, 22, 23, 24}, {25, 26, 27, 28}, {29, 30, 31, 32}, {33, 34, 35, 36}, {37, 38, 39, 40}, {41, 42, 43, 44}, {45, 46, 47, 48}, { -1, -2, -3, -4 }, { -5, -6, -7, -8 }, { -9, -10, -11, -12}, { -13, -14, -15, -16}, { -17, -18, -19, -20}, { -21, -22, -23, -24}, { -25, -26, -27, -28}, { -29, -30, -31, -32}, { -33, -34, -35, -36}, { -37, -38, -39, -40}, { -41, -42, -43, -44}, { -45, -46, -47, -48} }; static void signal_usr1(int signum, siginfo_t *info, void *uc) { int i; uint8_t vsc[sizeof(vector int)]; uint8_t vst[sizeof(vector int)]; ucontext_t *ucp = uc; ucontext_t *tm_ucp = ucp->uc_link; /* * The other half of the VSX regs will be after v_regs. * * In short, vmx_reserve array holds everything. v_regs is a 16 * byte aligned pointer at the start of vmx_reserve (vmx_reserve * may or may not be 16 aligned) where the v_regs structure exists. * (half of) The VSX regsters are directly after v_regs so the * easiest way to find them below. */ long *vsx_ptr = (long *)(ucp->uc_mcontext.v_regs + 1); long *tm_vsx_ptr = (long *)(tm_ucp->uc_mcontext.v_regs + 1); for (i = 0; i < NV_VSX_REGS && !fail; i++) { memcpy(vsc, &ucp->uc_mcontext.fp_regs[i + 20], 8); memcpy(vsc + 8, &vsx_ptr[20 + i], 8); fail = memcmp(vsc, &vss[i], sizeof(vector int)); memcpy(vst, &tm_ucp->uc_mcontext.fp_regs[i + 20], 8); memcpy(vst + 8, &tm_vsx_ptr[20 + i], 8); fail |= memcmp(vst, &vss[i + NV_VSX_REGS], sizeof(vector int)); if (fail) { int j; fprintf(stderr, "Failed on %d vsx 0x", i); for (j = 0; j < 16; j++) { fprintf(stderr, "%02x", vsc[j]); } fprintf(stderr, " vs 0x"); for (j = 0; j < 16; j++) { fprintf(stderr, "%02x", vst[j]); } fprintf(stderr, "\n"); } } } static int tm_signal_context_chk() { struct sigaction act; int i; long rc; pid_t pid = getpid(); SKIP_IF(!have_htm()); act.sa_sigaction = signal_usr1; sigemptyset(&act.sa_mask); act.sa_flags = SA_SIGINFO; if (sigaction(SIGUSR1, &act, NULL) < 0) { perror("sigaction sigusr1"); exit(1); } i = 0; while (i < MAX_ATTEMPT && !fail) { rc = tm_signal_self_context_load(pid, NULL, NULL, NULL, vss); FAIL_IF(rc != pid); i++; } return fail; } int main(void) { return test_harness(tm_signal_context_chk, "tm_signal_context_chk_vsx"); }
/* * Copyright (C) 2003-2015 FreeIPMI Core Team * * 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 IPMI_KCS_DRIVER_H #define IPMI_KCS_DRIVER_H #ifdef __cplusplus extern "C" { #endif #include <stdint.h> #include <freeipmi/fiid/fiid.h> #define IPMI_KCS_SMS_IO_BASE_DEFAULT 0x0CA2 #define IPMI_KCS_ERR_SUCCESS 0 #define IPMI_KCS_ERR_NULL 1 #define IPMI_KCS_ERR_INVALID 2 #define IPMI_KCS_ERR_PARAMETERS 3 #define IPMI_KCS_ERR_PERMISSION 4 #define IPMI_KCS_ERR_IO_NOT_INITIALIZED 5 #define IPMI_KCS_ERR_OVERFLOW 6 #define IPMI_KCS_ERR_BUSY 7 #define IPMI_KCS_ERR_OUT_OF_MEMORY 8 #define IPMI_KCS_ERR_DEVICE_NOT_FOUND 9 #define IPMI_KCS_ERR_DRIVER_TIMEOUT 10 #define IPMI_KCS_ERR_IPMI_ERROR 11 #define IPMI_KCS_ERR_SYSTEM_ERROR 12 #define IPMI_KCS_ERR_INTERNAL_ERROR 13 #define IPMI_KCS_ERR_ERRNUMRANGE 14 /* NONBLOCKING - if busy, IPMI_KCS_ERR_BUSY will be returned. * * SPIN_POLL - when polling, internally spin instead of putting * process to sleep. If polling intervals are small, may improve * inband performance by removing context switches and OS timer * granularity. */ #define IPMI_KCS_FLAGS_DEFAULT 0x00000000 #define IPMI_KCS_FLAGS_NONBLOCKING 0x00000001 #define IPMI_KCS_FLAGS_SPIN_POLL 0x00000002 typedef struct ipmi_kcs_ctx *ipmi_kcs_ctx_t; ipmi_kcs_ctx_t ipmi_kcs_ctx_create (void); void ipmi_kcs_ctx_destroy (ipmi_kcs_ctx_t ctx); int ipmi_kcs_ctx_errnum (ipmi_kcs_ctx_t ctx); char *ipmi_kcs_ctx_strerror (int errnum); char *ipmi_kcs_ctx_errormsg (ipmi_kcs_ctx_t ctx); int ipmi_kcs_ctx_get_driver_address (ipmi_kcs_ctx_t ctx, uint16_t *bmc_iobase_address); int ipmi_kcs_ctx_get_register_spacing (ipmi_kcs_ctx_t ctx, uint8_t *register_spacing); int ipmi_kcs_ctx_get_poll_interval (ipmi_kcs_ctx_t ctx, uint8_t *poll_interval); int ipmi_kcs_ctx_get_flags (ipmi_kcs_ctx_t ctx, unsigned int *flags); int ipmi_kcs_ctx_set_driver_address (ipmi_kcs_ctx_t ctx, uint16_t bmc_iobase_address); int ipmi_kcs_ctx_set_register_spacing (ipmi_kcs_ctx_t ctx, uint8_t register_spacing); int ipmi_kcs_ctx_set_poll_interval (ipmi_kcs_ctx_t ctx, uint8_t poll_interval); int ipmi_kcs_ctx_set_flags (ipmi_kcs_ctx_t ctx, unsigned int flags); int ipmi_kcs_ctx_io_init (ipmi_kcs_ctx_t ctx); /* returns length written on success, -1 on error */ int ipmi_kcs_write (ipmi_kcs_ctx_t ctx, const void *buf, unsigned int buf_len); /* returns length read on success, -1 on error */ int ipmi_kcs_read (ipmi_kcs_ctx_t ctx, void *buf, unsigned int buf_len); int ipmi_kcs_cmd (ipmi_kcs_ctx_t ctx, uint8_t lun, uint8_t net_fn, fiid_obj_t obj_cmd_rq, fiid_obj_t obj_cmd_rs); #ifdef __cplusplus } #endif #endif /* IPMI_KCS_DRIVER_H */
/* * libid3tag - ID3 tag manipulation library * Copyright (C) 2000-2004 Underbit Technologies, Inc. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; 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 * * $Id: genre.c,v 1.8 2004/01/23 09:41:32 rob Exp $ */ # ifdef HAVE_CONFIG_H # include "config.h" # endif # include "global.h" # include "id3tag.h" # include "ucs4.h" /* genres are stored in ucs4 format */ # include "genre.dat" # define NGENRES (sizeof(genre_table) / sizeof(genre_table[0])) /* * NAME: genre->index() * DESCRIPTION: return an ID3v1 genre string indexed by number */ id3_ucs4_t const *id3_genre_index(unsigned int index) { return (index < NGENRES) ? genre_table[index] : 0; } /* * NAME: genre->name() * DESCRIPTION: translate an ID3v2 genre number/keyword to its full name */ id3_ucs4_t const *id3_genre_name(id3_ucs4_t const *string) { id3_ucs4_t const *ptr; static id3_ucs4_t const genre_remix[] = { 'R', 'e', 'm', 'i', 'x', 0 }; static id3_ucs4_t const genre_cover[] = { 'C', 'o', 'v', 'e', 'r', 0 }; unsigned long number; if (string == 0 || *string == 0) return id3_ucs4_empty; if (string[0] == 'R' && string[1] == 'X' && string[2] == 0) return genre_remix; if (string[0] == 'C' && string[1] == 'R' && string[2] == 0) return genre_cover; for (ptr = string; *ptr; ++ptr) { if (*ptr < '0' || *ptr > '9') return string; } number = id3_ucs4_getnumber(string); return (number < NGENRES) ? genre_table[number] : string; } /* * NAME: translate() * DESCRIPTION: return a canonicalized character for testing genre equivalence */ static id3_ucs4_t translate(id3_ucs4_t ch) { if (ch) { if (ch >= 'A' && ch <= 'Z') ch += 'a' - 'A'; if (ch < 'a' || ch > 'z') ch = ID3_UCS4_REPLACEMENTCHAR; } return ch; } /* * NAME: compare() * DESCRIPTION: test two ucs4 genre strings for equivalence */ static int compare(id3_ucs4_t const *str1, id3_ucs4_t const *str2) { id3_ucs4_t c1, c2; if (str1 == str2) return 1; do { do c1 = translate(*str1++); while (c1 == ID3_UCS4_REPLACEMENTCHAR); do c2 = translate(*str2++); while (c2 == ID3_UCS4_REPLACEMENTCHAR); } while (c1 && c1 == c2); return c1 == c2; } /* * NAME: genre->number() * DESCRIPTION: translate an ID3v2 genre name/number to its ID3v1 index number */ int id3_genre_number(id3_ucs4_t const *string) { id3_ucs4_t const *ptr; int i; if (string == 0 || *string == 0) return -1; for (ptr = string; *ptr; ++ptr) { if (*ptr < '0' || *ptr > '9') break; } if (*ptr == 0) { unsigned long number; number = id3_ucs4_getnumber(string); return (number <= 0xff) ? number : -1; } for (i = 0; (unsigned)i < (unsigned)NGENRES; ++i) { if (compare(string, genre_table[i])) return i; } /* no equivalent */ return -1; }
//========= Copyright © 1996-2002, Valve LLC, All rights reserved. ============ // // Purpose: // // $NoKeywords: $ //============================================================================= #ifndef FONTMANAGER_H #define FONTMANAGER_H #ifdef _WIN32 #pragma once #endif #include <vgui/VGUI.h> #include "vgui_surfacelib/FontAmalgam.h" #ifdef CreateFont #undef CreateFont #endif class CWin32Font; using vgui::HFont; //----------------------------------------------------------------------------- // Purpose: Creates and maintains list of actively used fonts //----------------------------------------------------------------------------- class CFontManager { public: CFontManager(); ~CFontManager(); // clears the current font list, frees any resources void ClearAllFonts(); HFont CreateFont(); bool AddGlyphSetToFont(HFont font, const char *windowsFontName, int tall, int weight, int blur, int scanlines, int flags, int lowRange, int highRange); HFont GetFontByName(const char *name); void GetCharABCwide(HFont font, int ch, int &a, int &b, int &c); int GetFontTall(HFont font); int GetCharacterWidth(HFont font, int ch); void GetTextSize(HFont font, const wchar_t *text, int &wide, int &tall); CWin32Font *GetFontForChar(HFont, wchar_t wch); bool IsFontAdditive(HFont font); private: CUtlVector<CFontAmalgam> m_FontAmalgams; CUtlVector<CWin32Font *> m_Win32Fonts; }; // singleton accessor extern CFontManager &FontManager(); #endif // FONTMANAGER_H
// // File = welcpdgm.h // #ifndef _WELCPDGM_H_ #define _WELCPDGM_H_ #include "complex.h" #include "gen_win.h" #include "psd_est.h" #include "sig_src.h" class WelchPeriodogram : public PsdEstimate { public: WelchPeriodogram(SignalSource* signal_source, double samp_intvl, int num_samps_per_seg, int shift_between_segs, int fft_len, GenericWindow* data_wind, int num_segs_to_avg); }; #endif // _WELCPDGM_H_
#include <stdio.h> #include <stdlib.h> #include <string.h> #include <unistd.h> #include <arpa/inet.h> #include <sys/types.h> #include <sys/socket.h> #include <dirent.h> #include <sys/stat.h> #include <fcntl.h> #define BUFSIZE 1024 typedef struct mymsg{ int size; char name[BUFSIZE]; }msg; typedef struct ap{ long off; char name[BUFSIZE]; }app; void err_quit(char *msg) { fputs(msg, stderr); fputc('\n', stderr); exit(1); } int recvn(int s, char *buf, int len) { int received, left = len; char *ptr = buf; while (left > 0) { received = read(s, buf, left); if (received == -1) return -1; else if (received == 0) break; left -= received; ptr += received; } return (len - left); } int main(int argc, char *argv[]) { int retval, sock; msg* list; list = (msg*)malloc(sizeof(msg)); app* append; append = (app*)malloc(sizeof(app)); struct sockaddr_in serveraddr; struct dirent*direntp; direntp = malloc(sizeof(struct dirent)); char select[2]; int fd; sock = socket(PF_INET, SOCK_STREAM, 0); serveraddr.sin_family = AF_INET; serveraddr.sin_port = htons(9000); serveraddr.sin_addr.s_addr = htonl(INADDR_ANY); retval = connect(sock, (struct sockaddr*) &serveraddr, sizeof(serveraddr)); while (1) { fflush(stdout); fflush(stdin); printf("메뉴 선택 (1. 목록 2.다운로드 3. 종료) : "); scanf("%s", select); write(sock, select, 2); char buf[BUFSIZE]; if (!strcmp(select, "1")) { int totalbytes; while (1) { retval = read(sock, buf, sizeof(msg)); memcpy(list, buf, sizeof(msg)); if (list->size == -1){ break; } printf("파일 이름 : %s \t파일 크기 : %d\n", list->name, list->size); } } else if (!strcmp(select, "2")) { char filename[256]; char ssend[BUFSIZE]; memset(filename, 0, sizeof(filename)); printf("다운로드 할 파일 이름 : "); fflush(stdin); scanf("%s", filename); fd = open(filename, O_WRONLY | O_CREAT | O_TRUNC, 0666); if (fd < 0) { err_quit("파일 I/O 에러"); close(sock); return 1; } strcpy(append->name, filename); memcpy(ssend, append, sizeof(app)); retval = write(sock, ssend, sizeof(app)); if (retval == -1) { err_quit("recv() 에러"); close(sock); return 1; } int totalbytes; retval = recvn(sock, (char *)&totalbytes, sizeof(totalbytes)); if (retval == -1) { err_quit("recv() 에러"); close(sock); return 1; } printf("%d\n", totalbytes); int numtotal = 0; int sum = 0; int nwrite = 0; while (1) { sum = numtotal; if (sum == totalbytes){ fprintf(stderr, "com\n"); break; } char readbuf[BUFSIZE] = { 0 }; retval = read(sock, readbuf, BUFSIZE); if (retval == -1) { err_quit("recv() 에러"); } else { nwrite = write(fd, readbuf, retval); numtotal += nwrite; } } close(fd); if (numtotal == totalbytes) fprintf(stderr, "-> 파일 변환 성공\n"); else fprintf(stderr, "-> 파일 변환 실패\n"); fprintf(stderr, "파일 받기 성공\n"); } else if (!strcmp(select, "3")) { write(sock, select, 2); printf("프로그램 종료\n"); break; } else { printf("잘못된 메뉴\n"); } } return 0; }
#ifndef MANTID_HISTOGRAMDATA_VALIDATION_H_ #define MANTID_HISTOGRAMDATA_VALIDATION_H_ #include <algorithm> #include <cfloat> #include <cmath> #include <stdexcept> namespace Mantid { namespace HistogramData { class HistogramX; class HistogramY; class HistogramE; namespace detail { template <class TargetType> struct Validator { template <class T> static bool isValid(const T &) { return true; } template <class T> static void checkValidity(const T &) {} }; template <> struct Validator<HistogramX> { template <class T> static bool isValid(const T &data); template <class T> static void checkValidity(const T &data); }; template <> struct Validator<HistogramY> { template <class T> static bool isValid(const T &data); template <class T> static void checkValidity(const T &data); }; template <> struct Validator<HistogramE> { template <class T> static bool isValid(const T &data); template <class T> static void checkValidity(const T &data); }; template <class T> bool Validator<HistogramX>::isValid(const T &data) { auto it = std::find_if_not(data.begin(), data.end(), [](const double d) { return std::isnan(d); }); if (it == data.end()) return true; for (; it < data.end() - 1; ++it) { if (std::isnan(*(it + 1))) break; double delta = *(it + 1) - *it; // Not 0.0, not denormal if (delta < DBL_MIN) return false; } ++it; // after first NAN everything must be NAN return std::find_if_not(it, data.end(), [](const double d) { return std::isnan(d); }) == data.end(); } template <class T> void Validator<HistogramX>::checkValidity(const T &data) { if (!isValid(data)) throw std::runtime_error( "Invalid data found during construction of HistogramX"); } template <class T> bool Validator<HistogramY>::isValid(const T &data) { auto result = std::find_if(data.begin(), data.end(), [](const double y) { return std::isinf(y); }); return result == data.end(); } template <class T> void Validator<HistogramY>::checkValidity(const T &data) { if (!isValid(data)) throw std::runtime_error( "Invalid data found during construction of HistogramY"); } template <class T> bool Validator<HistogramE>::isValid(const T &data) { auto result = std::find_if(data.begin(), data.end(), [](const double e) { return e < 0.0 || std::isinf(e); }); return result == data.end(); } template <class T> void Validator<HistogramE>::checkValidity(const T &data) { if (!isValid(data)) throw std::runtime_error( "Invalid data found during construction of HistogramE"); } } // namespace detail } // namespace HistogramData } // namespace Mantid #endif /* MANTID_HISTOGRAMDATA_VALIDATION_H_ */
// // ScrollLayerController.h // CAShapeLayer // // Created by felix on 2017/1/8. // Copyright © 2017年 felix. All rights reserved. // #import <UIKit/UIKit.h> @interface ScrollLayerController : UIViewController @end
/* OOPoker Copyright (c) 2010 Lode Vandevenne All rights reserved. This file is part of OOPoker. OOPoker 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. OOPoker 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 OOPoker. If not, see <http://www.gnu.org/licenses/>. */ #pragma once #include "ai.h" //Naive AI, not fun to play against. This AI will always call. class AICall : public AI { public: virtual Action doTurn(const Info& info); virtual std::string getAIName(); };
//{{NO_DEPENDENCIES}} // Microsoft Visual C++ generated include file. // Used by appicon.rc // #define IDI_ICON1 102 // Next default values for new objects // #ifdef APSTUDIO_INVOKED #ifndef APSTUDIO_READONLY_SYMBOLS #define _APS_NEXT_RESOURCE_VALUE 103 #define _APS_NEXT_COMMAND_VALUE 40001 #define _APS_NEXT_CONTROL_VALUE 1000 #define _APS_NEXT_SYMED_VALUE 101 #endif #endif
/* Copyright (C) 2014, 2016 Luk Bettale This file is part of VM8051. VM8051 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 VM8051. If not, see <http://www.gnu.org/licenses/>. */ #ifndef COPRO_RNG_H #define COPRO_RNG_H #include <vm/lib8051.h> extern void add_copro_RNG (struct vm8051 *vm); extern void operate_copro_RNG (struct vm8051 *vm, void *copro); extern void print_copro_RNG (struct vm8051 *vm, void *copro); #endif /* COPRO_RNG_H */
/* * Copyright 2015 Red Hat Inc. * * 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 COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR * OTHER DEALINGS IN THE SOFTWARE. * * Authors: Ben Skeggs <bskeggs@redhat.com> */ #include "dmacnv50.h" #include "rootnv50.h" #include <nvif/class.h> const struct nv50_disp_dmac_oclass gt200_disp_core_oclass = { .base.oclass = GT200_DISP_CORE_CHANNEL_DMA, .base.minver = 0, .base.maxver = 0, .ctor = nv50_disp_core_new, .func = &nv50_disp_core_func, .mthd = &g84_disp_core_chan_mthd, .chid = 0, };
// // Created by larsson on 2017-01-30. // #ifndef SDLGAME_ZPIECE_H #define SDLGAME_ZPIECE_H #include "Piece.h" class ZPiece:public Piece { public: ZPiece(); ~ZPiece(); // This has to be declared }; #endif //SDLGAME_ZPIECE_H
/*! \file thr_pool.h ** \brief The NPS Pthread Pool module interface. ** ** \details Inferface for a module to maniulate a simple POSIX ** thread pool. Each pool is manger-less, and supports a min- and max- ** thread population. ** ** - To create a new pool, see thr_pool_create(). ** The module can manage multiple pools; the caller is given ** a handle to identify the pool, upon pool creation. ** - To enqueue a job in a pool, see thr_pool_queue(). ** - To destroy a pool, see thr_pool_destroy(). ** ** \pre Initialize the module via thr_pool_init(). ** \post Free the module via thr_pool_free(). *//*! ** \mainpage ** @copydoc thr_pool.h */ #ifndef THR_POOL_H_ #define THR_POOL_H_ #include <pthread.h> #include <limits.h> #ifdef PTHREAD_THREADS_MAX #define THR_POOL_MAX_NUM (PTHREAD_THREADS_MAX) #else #define THR_POOL_MAX_NUM (1024) #endif //! The type defining the "handle" to a specific pool typedef int thr_pool_handle_t; //! max number of pools (= 2^15 - 1) #define THR_POOL_MAX_POOLS 32767 //! \brief max number of threads that can be in any pool. //! \details We use 2 less than THR_POOL_MAX_NUM since //! - LinuxThreads has a manager thread //! - the caller uses one thread #define THR_POOL_MAX_THREADS (THR_POOL_MAX_NUM - 2) // // Module return values // //! All return codes are in the interval [THR_POOL_BASE, THR_POOL_LAST]. #define THR_POOL_BASE (-100) //! Return code: operation successful. #define THR_POOL_SUCCESS (THR_POOL_BASE) //! Return code: a soft error ocurred; the pool might still be usable. #define THR_POOL_ERROR (THR_POOL_BASE - 1) //! Return code: a hard error ocurred; the pool may not be usable further. #define THR_POOL_UNRECOV_ERROR (THR_POOL_BASE - 2) //! Return code: operation failed because the pool was not initialized. #define THR_POOL_NOT_INITIALIZED (THR_POOL_BASE - 3) //! Return code: operation failed because the input was bad. #define THR_POOL_BAD_INPUT (THR_POOL_BASE - 4) //! Return code: operation failed because the input pool handle was invalid. #define THR_POOL_INVALID_HANDLE (THR_POOL_BASE - 5) //! Return code: a memory- or resource-related error ocurred. #define THR_POOL_RESOURCE_ERROR (THR_POOL_BASE - 6) //! A constant (ensures external / internal return codes don't overlap). #define THR_POOL_LAST (THR_POOL_BASE - 6) // // Prototypes // int thr_pool_init(void); int thr_pool_create(const unsigned int pool_min, const unsigned int pool_max, const unsigned int timeout, const pthread_attr_t *attr, thr_pool_handle_t *pool_handle); int thr_pool_queue(const thr_pool_handle_t pool_handle, const int mode, const size_t len, void *(*func)(void *), void *arg); int thr_pool_destroy(const thr_pool_handle_t pool_handle); int thr_pool_free(void); #endif // THR_POOL_H_
#ifndef MAVLINK_CPP_MSG_LOG_REQUEST_END_H #define MAVLINK_CPP_MSG_LOG_REQUEST_END_H #include "../message.h" namespace mavlink { namespace msg { const uint8_t log_request_end_id = 122; const uint8_t log_request_end_length = 2; const uint8_t log_request_end_crc = 203; class log_request_end : public mavlink::message { public: log_request_end(uint8_t system_id, uint8_t component_id, uint8_t target_system, uint8_t target_component): mavlink::message( mavlink::msg::log_request_end_length, system_id, component_id, mavlink::msg::log_request_end_id) { m_payload.push_back<uint8_t>(target_system); ///< System ID m_payload.push_back<uint8_t>(target_component); ///< Component ID } uint8_t get_target_system() const {return m_payload.get<uint8_t>(0);} uint8_t get_target_component() const {return m_payload.get<uint8_t>(1);} }; }; }; #endif //MAVLINK_CPP_MSG_LOG_REQUEST_END_H
/****************************************************************************/ /// @file TrafficActuated.h /// @author Philip Vo <foxvo@ucdavis.edu> /// @author Mani Amoozadeh <maniam@ucdavis.edu> /// @date August 2013 /// /****************************************************************************/ // VENTOS, Vehicular Network Open Simulator; see http:? // Copyright (C) 2013-2015 /****************************************************************************/ // // This file is part of VENTOS. // VENTOS 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 TRAFFICLIGHTACTUATED_H #define TRAFFICLIGHTACTUATED_H #include "trafficLight/TSC/02_Adaptive_Webster.h" namespace VENTOS { class TrafficLightActuated : public TrafficLightWebster { private: typedef TrafficLightWebster super; // NED variables double passageTime; bool greenExtension; double intervalElapseTime; std::string currentInterval; double intervalDuration; std::string nextGreenInterval; omnetpp::cMessage* intervalChangeEVT = NULL; // class variables std::map<std::string,double> passageTimePerLane; // list of all traffic lights in the network std::vector<std::string> TLList; std::map<std::string /*TLid*/, std::string /*first green interval*/> firstGreen; // loop detector ids used for actuated-time signal control std::unordered_map<std::string /*lane*/, std::string /*LD id*/> LD_actuated; public: virtual ~TrafficLightActuated(); virtual void initialize(int); virtual void finish(); virtual void handleMessage(omnetpp::cMessage *); protected: void virtual initialize_withTraCI(); void virtual executeEachTimeStep(); private: void chooseNextInterval(std::string TLid); void chooseNextGreenInterval(std::string TLid); void checkLoopDetectors(); }; } #endif
#define TAG_TRF_uMEDIATOR 690000
/*********************************************************************** Copyright (c) 2006-2011, Skype Limited. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: - Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. - Neither the name of Internet Society, IETF or IETF Trust, nor the names of specific contributors, may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ***********************************************************************/ //#ifdef HAVE_CONFIG_H #include "opus__config.h" //#endif #include "SigProc_FIX.h" /* Compute number of bits to right shift the sum of squares of a vector */ /* of int16s to make it fit in an int32 */ void silk_sum_sqr_shift( opus_int32 *energy, /* O Energy of x, after shifting to the right */ opus_int *shift, /* O Number of bits right shift applied to energy */ const opus_int16 *x, /* I Input vector */ opus_int len /* I Length of input vector */ ) { opus_int i, shft; opus_uint32 nrg_tmp; opus_int32 nrg; /* Do a first run with the maximum shift we could have. */ shft = 31-silk_CLZ32(len); /* Let's be conservative with rounding and start with nrg=len. */ nrg = len; for( i = 0; i < len - 1; i += 2 ) { nrg_tmp = silk_SMULBB( x[ i ], x[ i ] ); nrg_tmp = silk_SMLABB_ovflw( nrg_tmp, x[ i + 1 ], x[ i + 1 ] ); nrg = (opus_int32)silk_ADD_RSHIFT_uint( nrg, nrg_tmp, shft ); } if( i < len ) { /* One sample left to process */ nrg_tmp = silk_SMULBB( x[ i ], x[ i ] ); nrg = (opus_int32)silk_ADD_RSHIFT_uint( nrg, nrg_tmp, shft ); } silk_assert( nrg >= 0 ); /* Make sure the result will fit in a 32-bit signed integer with two bits of headroom. */ shft = silk_max_32(0, shft+3 - silk_CLZ32(nrg)); nrg = 0; for( i = 0 ; i < len - 1; i += 2 ) { nrg_tmp = silk_SMULBB( x[ i ], x[ i ] ); nrg_tmp = silk_SMLABB_ovflw( nrg_tmp, x[ i + 1 ], x[ i + 1 ] ); nrg = (opus_int32)silk_ADD_RSHIFT_uint( nrg, nrg_tmp, shft ); } if( i < len ) { /* One sample left to process */ nrg_tmp = silk_SMULBB( x[ i ], x[ i ] ); nrg = (opus_int32)silk_ADD_RSHIFT_uint( nrg, nrg_tmp, shft ); } silk_assert( nrg >= 0 ); /* Output arguments */ *shift = shft; *energy = nrg; }
#include <stdlib.h> #include <stdint.h> #include <stdio.h> #include <string.h> #include <time.h> #include <locale.h> // Win compatibility #ifdef _WIN32 typedef unsigned __int32 uint32_t; typedef unsigned __int16 uint16_t; #endif typedef struct WavHeader { uint32_t ChunkID; uint32_t ChunkSize; uint32_t Format; uint32_t Subchunk1ID; uint32_t Subchunk1Size; uint16_t AudioFormat; uint16_t NumChannels; uint32_t SampleRate; uint32_t ByteRate; uint16_t BlockAlign; uint16_t BitsPerSample; } WavHeader; typedef struct WavHeader2 { uint32_t Subchunk2ID; uint32_t Subchunk2Size; } WavHeader2; // overwritten because Win int strptime2(char *s, char *format, struct tm *temp); int split(char *infilearg, char *outfilearg, int t, int hasDt);
/*************************************************************************** * Copyright (C) 2011-2017 Alexander V. Popov. * * This file is part of Molecular Dynamics Trajectory * Reader & Analyzer (MDTRA) source code. * * MDTRA source code 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. * * MDTRA source code 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 St, Fifth Floor, Boston, MA 02110-1301 USA ***************************************************************************/ #ifndef MDTRA_PROG_INTERPRETER_H #define MDTRA_PROG_INTERPRETER_H #include <QtCore/QString> #include "mdtra_types.h" class MDTRA_Program_Interpreter { public: MDTRA_Program_Interpreter( const struct stMDTRA_DataSource* ds ); ~MDTRA_Program_Interpreter(); bool IsValid( void ) const { return m_valid; } bool IsDataModified( void ) const { return m_datamodified; } bool ShouldReduce( void ) const { return m_reduce; } bool Init( void* pdbFile, int dataSize ); bool Main( int threadnum, int num, void* pdbFile, float* presult ); bool Reduce( float* pvalues, dword* presultmask, float* presults ); void SetResidueBuffer( int threadnum, float *res, int rescount ); protected: void RunError( struct lua_State* L ); private: struct stMDTRA_ProgState* m_states; int m_args[MAX_DATA_SOURCE_ARGS]; bool m_valid; bool m_datamodified; bool m_reduce; const char* m_pcode; int m_isize; QString m_dsName; int m_dsIndex; }; #endif //MDTRA_PROG_INTERPRETER_H
/* +----------------------------------------------------------------------+ | PHP Version 5 | +----------------------------------------------------------------------+ | Copyright (c) 1997-2016 The PHP Group | +----------------------------------------------------------------------+ | This source file is subject to version 3.01 of the PHP license, | | that is bundled with this package in the file LICENSE, and is | | available through the world-wide-web at the following url: | | http://www.php.net/license/3_01.txt | | If you did not receive a copy of the PHP license and are unable to | | obtain it through the world-wide-web, please send a note to | | license@php.net so we can mail you a copy immediately. | +----------------------------------------------------------------------+ | Authors: Derick Rethans <derick@php.net> | +----------------------------------------------------------------------+ */ /* $Id$ */ #include "php_filter.h" void php_filter_callback(PHP_INPUT_FILTER_PARAM_DECL) { zval *retval_ptr; zval ***args; int status; if (!option_array || !zend_is_callable(option_array, IS_CALLABLE_CHECK_NO_ACCESS, NULL TSRMLS_CC)) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "First argument is expected to be a valid callback"); zval_dtor(value); Z_TYPE_P(value) = IS_NULL; return; } args = safe_emalloc(sizeof(zval **), 1, 0); args[0] = &value; status = call_user_function_ex(EG(function_table), NULL, option_array, &retval_ptr, 1, args, 0, NULL TSRMLS_CC); if (status == SUCCESS && retval_ptr != NULL) { if (retval_ptr != value) { zval_dtor(value); COPY_PZVAL_TO_ZVAL(*value, retval_ptr); } else { zval_ptr_dtor(&retval_ptr); } } else { zval_dtor(value); Z_TYPE_P(value) = IS_NULL; } efree(args); } /* * Local variables: * tab-width: 4 * c-basic-offset: 4 * End: * vim600: noet sw=4 ts=4 fdm=marker * vim<600: noet sw=4 ts=4 */
/* * kixmail-application.h * Copyright (C) 2012 Parthasarathi Susarla <ajaysusarla@gmail.com> * * kixmail 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. * * kixmail 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 _KIXMAIL_APPLICATION_H_ #define _KIXMAIL_APPLICATION_H_ #include <gdk/gdk.h> #include <gio/gio.h> #include <gtk/gtk.h> #include "kixmail-window.h" G_BEGIN_DECLS #define KIXMAIL_TYPE_APPLICATION (kixmail_application_get_type ()) #define KIXMAIL_APPLICATION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), KIXMAIL_TYPE_APPLICATION, KixmailApplication)) #define KIXMAIL_APPLICATION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), KIXMAIL_TYPE_APPLICATION, KixmailApplicationClass)) #define KIXMAIL_IS_APPLICATION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), KIXMAIL_TYPE_APPLICATION)) #define KIXMAIL_IS_APPLICATION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), KIXMAIL_TYPE_APPLICATION)) #define KIXMAIL_APPLICATION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), KIXMAIL_TYPE_APPLICATION, KixmailApplicationClass)) typedef struct _KixmailApplicationClass KixmailApplicationClass; typedef struct _KixmailApplication KixmailApplication; typedef struct _KixmailApplicationPriv KixmailApplicationPriv; enum { PROP_NO_CONNECT = 1, PROP_START_HIDDEN }; struct _KixmailApplicationClass { GtkApplicationClass parent_class; }; struct _KixmailApplication { GtkApplication parent_instance; KixmailApplicationPriv *priv; }; GType kixmail_application_get_type (void) G_GNUC_CONST; G_END_DECLS #endif /* _KIXMAIL_APPLICATION_H_ */
/* * This file is part of the demos-linux package. * Copyright (C) 2011-2022 Mark Veltzer <mark.veltzer@gmail.com> * * demos-linux 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. * * demos-linux 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 demos-linux. If not, see <http://www.gnu.org/licenses/>. */ #ifndef __measure_h #define __measure_h /* * This is a helper file for doing performance measurements using * the gettimeofday(2) system call. */ /* THIS IS A C FILE, NO C++ here */ #include <firstinclude.h> #include <stdio.h> // for printf(3) #include <sys/time.h> // for gettimeofday(2), struct timeval #include <timeval_utils.h> // for micro_diff() typedef struct _measure { struct timeval t1; struct timeval t2; int attempts; const char* name; } measure; static inline void measure_init(measure* m, const char* name, int attempts) { m->name=name; m->attempts=attempts; } static inline void measure_start(measure* m) { // printf("measure start: [%s]\n", msg); gettimeofday(&m->t1, NULL); } static inline void measure_end(measure* m) { gettimeofday(&m->t2, NULL); // printf("measure end: [%s]\n", msg); } static inline void measure_print(measure* m) { printf("measure print: time in micro of single [%s]: %lf\n", m->name, micro_diff(&m->t1, &m->t2)/(double)(m->attempts)); } static inline double measure_micro_diff(measure* m) { return micro_diff(&m->t1, &m->t2); } #endif /* !__measure_h */
#pragma region Copyright (c) 2014-2016 OpenRCT2 Developers /***************************************************************************** * OpenRCT2, an open source clone of Roller Coaster Tycoon 2. * * OpenRCT2 is the work of many authors, a full list can be found in contributors.md * For more information, visit https://github.com/OpenRCT2/OpenRCT2 * * OpenRCT2 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. * * A full copy of the GNU General Public License can be found in licence.txt *****************************************************************************/ #pragma endregion #include "../../addresses.h" #include "../../paint/supports.h" #include "../../interface/viewport.h" #include "../../paint/paint.h" #include "../../sprites.h" #include "../../world/map.h" #include "../track_paint.h" /** * * rct2: 0x00763234 * rct2: 0x0076338C * rct2: 0x00762F50 * rct2: 0x007630DE */ static void facility_paint_setup(uint8 rideIndex, uint8 trackSequence, uint8 direction, int height, rct_map_element* mapElement) { bool hasSupports = wooden_a_supports_paint_setup(direction & 1, 0, height, RCT2_GLOBAL(0x00F441A4, uint32), NULL); rct_ride *ride = get_ride(rideIndex); rct_ride_entry *rideEntry = get_ride_entry(ride->subtype); rct_ride_entry_vehicle *firstVehicleEntry = &rideEntry->vehicles[0]; uint32 imageId = RCT2_GLOBAL(0x00F44198, uint32); imageId |= firstVehicleEntry->base_image_id; imageId += (direction + 2) & 3; int rotation = get_current_rotation(); int lengthX = (direction & 1) == 0 ? 28 : 2; int lengthY = (direction & 1) == 0 ? 2 : 28; if (hasSupports) { uint32 foundationImageId = (direction & 1 ? 3396 : 3395) | RCT2_GLOBAL(0x00F441A4, uint32); sub_98197C(foundationImageId, 0, 0, lengthX, lengthY, 29, height, direction == 3 ? 28 : 2, direction == 0 ? 28 : 2, height, rotation); // Door image or base sub_98199C(imageId, 0, 0, lengthX, lengthY, 29, height, direction == 3 ? 28 : 2, direction == 0 ? 28 : 2, height, rotation); } else { // Door image or base sub_98197C(imageId, 0, 0, lengthX, lengthY, 29, height, direction == 3 ? 28 : 2, direction == 0 ? 28 : 2, height, rotation); } // Base image if door was drawn if (direction == 1) { imageId += 2; sub_98197C(imageId, 0, 0, 2, 28, 29, height, 28, 2, height, rotation); } else if (direction == 2) { imageId += 4; sub_98197C(imageId, 0, 0, 28, 2, 29, height, 2, 28, height, rotation); } paint_util_set_segment_support_height(SEGMENTS_ALL, 0xFFFF, 0); paint_util_set_general_support_height(height + 32, 0x20); } /* 0x00762D44 */ TRACK_PAINT_FUNCTION get_track_paint_function_facility(int trackType, int direction) { switch (trackType) { case 118: return facility_paint_setup; } return NULL; }
struct sigscratch { unsigned long scratch_unat; /* ar.unat for the general registers saved in pt */ unsigned long ar_pfs; /* for syscalls, the user-level function-state */ struct pt_regs pt; }; struct sigframe { /* * Place signal handler args where user-level unwinder can find them easily. * DO NOT MOVE THESE. They are part of the IA-64 Linux ABI and there is * user-level code that depends on their presence! */ unsigned long arg0; /* signum */ unsigned long arg1; /* siginfo pointer */ unsigned long arg2; /* sigcontext pointer */ /* * End of architected state. */ void __user *handler; /* pointer to the plabel of the signal handler */ struct siginfo info; struct sigcontext sc; }; extern void ia64_do_signal (struct sigscratch *, long);
#ifndef NETWORKPCAPFILERECORDER_H #define NETWORKPCAPFILERECORDER_H #include "recorder.h" #include "PacketProducer/pcapbufferedproducer.h" #include "PacketConsumer/pcapfileconsumer.h" #include "Middleware/analyzerpcapmiddleware.h" class NetworkPcapFileRecorder : public Recorder { Q_OBJECT private: PcapBufferedProducer producer; PcapFileConsumer consumer; AnalyzerPcapMiddleware analyzerMiddleware; public: NetworkPcapFileRecorder(WorkerConfiguration config, QObject *parent = 0) : Recorder(config, parent), producer(config), consumer(config), analyzerMiddleware(config) {} void start(); void stop(); void stopAndWait(); private slots: void gotProducerStatus(Status pStatus); void gotAnalyzerStatus(AnalyzerStatus aStatus); void gotConsumerStatus(Status cStatus); void moduleFinished(); }; #endif // NETWORKPCAPFILERECORDER_H
/* * Program: pgn-extract: a Portable Game Notation (PGN) extractor. * Copyright (C) 1994-2017 David Barnes * 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 1, or (at your option) * any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * * David Barnes may be contacted as D.J.Barnes@kent.ac.uk * https://www.cs.kent.ac.uk/people/staff/djb/ * */ /* Define a type to hold hash values of interest. */ #ifndef ECO_H #define ECO_H typedef struct EcoLog { HashCode required_hash_value; /* cumulative_hash_value is used to disambiguate clashing * final hash values in duplicate detection. */ HashCode cumulative_hash_value; /* How deep the line is, from the half_moves associated with * the board when the line is played out. */ unsigned half_moves; const char *ECO_tag; const char *Opening_tag; const char *Variation_tag; const char *Sub_Variation_tag; struct EcoLog *next; } EcoLog; EcoLog *eco_matches(HashCode current_hash_value, HashCode cumulative_hash_value, unsigned half_moves_played); Boolean add_ECO(Game game_details); FILE *open_eco_output_file(EcoDivision ECO_level,const char *eco); void initEcoTable(void); void save_eco_details(Game game_details,unsigned number_of_moves); #endif // ECO_H
/* * ========================================================================== * NetPerfMeter -- Network Performance Meter * Copyright (C) 2009-2021 by Thomas Dreibholz * ========================================================================== * * 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/>. * * Contact: dreibh@iem.uni-due.de * Homepage: https://www.uni-due.de/~be0001/netperfmeter/ */ #ifndef MEASUREMENT_H #define MEASUREMENT_H #include "mutex.h" #include "outputfile.h" #include "flowbandwidthstats.h" #include "tools.h" class Measurement : public Mutex { friend class FlowManager; // ====== Public Methods ================================================= public: Measurement(); ~Measurement(); const uint64_t getMeasurementID() const { return(MeasurementID); } const std::string& getVectorNamePattern() const { return(VectorNamePattern); } const OutputFile& getVectorFile() const { return(VectorFile); } const std::string& getScalarNamePattern() const { return(ScalarNamePattern); } const OutputFile& getScalarFile() const { return(ScalarFile); } inline unsigned long long getFirstStatisticsEvent() const { return(FirstStatisticsEvent); } bool initialize(const unsigned long long now, const uint64_t measurementID, const char* vectorNamePattern, const OutputFileFormat vectorFileFormat, const char* scalarNamePattern, const OutputFileFormat scalarFileFormat); bool finish(const bool closeFiles); void writeScalarStatistics(const unsigned long long now); void writeVectorStatistics(const unsigned long long now, FlowBandwidthStats& globalStats, FlowBandwidthStats& relGlobalStats); // ====== Private Data =================================================== private: uint64_t MeasurementID; unsigned long long StatisticsInterval; unsigned long long FirstStatisticsEvent; unsigned long long LastStatisticsEvent; unsigned long long NextStatisticsEvent; std::string VectorNamePattern; std::string ScalarNamePattern; OutputFile VectorFile; OutputFile ScalarFile; unsigned long long LastTransmission; unsigned long long FirstTransmission; unsigned long long LastReception; unsigned long long FirstReception; }; #endif
#include <stdlib.h> #include <string.h> #include "token.h" #include "token_stream.h" TokenStream* new_token_stream(int capacity) { TokenStream* ts = malloc(sizeof(TokenStream)); ts->pos = 0; ts->size = 0; ts->capacity = capacity; ts->tokens = malloc(sizeof(Token) * capacity); memset(ts->tokens, 0, sizeof(Token) * capacity); return ts; } void destroy_token_stream(TokenStream* stream) { free(stream->tokens); free(stream); } int insert_token(TokenStream* stream, Token token) { if (stream->size < stream->capacity) { stream->tokens[stream->size++] = token; return 1; } return 0; } void rewind_stream(TokenStream* stream) { stream->pos = 0; } Token* next_token(TokenStream* stream) { if (stream->pos >= stream->size) { return NULL; } else { return &stream->tokens[stream->pos++]; } } Token peek(TokenStream* stream) { if (stream->pos < 0 || stream->pos >= stream->size) { return null_token(); } else { return stream->tokens[stream->pos]; } } Token tail_peek(TokenStream* stream) { if (stream->size > 0) { return stream->tokens[stream->size - 1]; } else { return null_token(); } }
/** ****************************************************************************** * @file RTC/RTC_Alarm/Inc/main.h * @author MCD Application Team * @brief Header for main.c module ****************************************************************************** * @attention * * <h2><center>&copy; COPYRIGHT(c) 2016 STMicroelectronics</center></h2> * * Redistribution and use in source and binary forms, with or without modification, * are permitted provided that the following conditions are met: * 1. Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * 3. Neither the name of STMicroelectronics nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 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 __MAIN_H #define __MAIN_H /* Includes ------------------------------------------------------------------*/ #include "stm32f0xx_hal.h" #include "stm32f072b_discovery.h" #include <stdio.h> /* Exported types ------------------------------------------------------------*/ /* Exported constants --------------------------------------------------------*/ /* Defines related to Clock configuration */ /* Uncomment to enable the adaquate Clock Source */ #define RTC_CLOCK_SOURCE_LSI /*#define RTC_CLOCK_SOURCE_LSE*/ #ifdef RTC_CLOCK_SOURCE_LSI #define RTC_ASYNCH_PREDIV 0x7F #define RTC_SYNCH_PREDIV 0x0130 #endif #ifdef RTC_CLOCK_SOURCE_LSE #define RTC_ASYNCH_PREDIV 0x7F #define RTC_SYNCH_PREDIV 0x00FF #endif /* Exported macro ------------------------------------------------------------*/ /* Exported functions ------------------------------------------------------- */ void Error_Handler(void); #endif /* __MAIN_H */ /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
#ifndef _GYRO_H #define _GYRO_H #define _NB_ELEM_V 4 #define _DEG_V 2 #define _MV (_NB_ELEM_V * _DEG_V + 1) #define _INDEX_MAX_KIN (_MV-1) #define _INDEX_PHI (_MV) #define _INDEX_EX (_MV+1) #define _INDEX_EY (_MV+2) #define _INDEX_EZ (_MV+3) #define _INDEX_MAX (_MV+4) #define _VMAX 6. #define _DV (2*_VMAX / _NB_ELEM_V) #include "model.h" #include "field.h" // gyrokinetic models //! \brief particular flux for the gyro model //! \param[in] wL,wR : left and right states //! \param[in] vn : normal vector //! \param[out] flux : the flux void Gyro_Lagrangian_NumFlux(real wL[],real wR[],real vn[3],real* flux); //! \brief particular boundary flux for the gyro model //! \param[in] x : space position //! \param[in] t : time //! \param[in] wL : left state //! \param[in] vn : normal vector //! \param[out] flux : the flux void Gyro_Lagrangian_BoundaryFlux(real* x,real t,real* wL,real* vn, real* flux); //! \brief particular init data for the gyro model //! \param[in] x : space position //! \param[out] w : init state at point x void GyroInitData(real* x,real* w); //! \brief particular imposed data for the gyro model //! \param[in] x : space position //! \param[out] w : init state at point x void GyroImposedData(const real* x, const real t,real* w); //! \brief particular imposed data for the gyro model //! \param[in] x,t : space and time position //! \param[out] w : imposed state at point x and time t real Gyro_ImposedKinetic_Data(const real* x, const real t,real v); //! \brief compute gyro L2 error in x and v //! \param[in] f : a field real GyroL2_Kinetic_error(field* f); //! \brief compute square of velocity L2 error //! \param[in] x,t : space and time position //! \param[in] w : values of f at glops real GyroL2VelError(real* x,real t,real *w); //! \brief compute compute the source term of the collision //! model: electric force + true collisions void GyroSource(const real *x, const real t, const real *w, real *source); //! \brief gnuplot file for the distribution function //! \param[in] w : values of f at glops void Velocity_distribution_plot(real *w); #endif
// // SimpleImage.h // TileTest // // Created by Admin on 8/19/14. // Copyright (c) 2014 Admin. All rights reserved. // #ifndef TileTest_SimpleImage_h #define TileTest_SimpleImage_h #include <memory> struct SimpleImage { int width; int height; int channels; std::shared_ptr<unsigned char> data; }; SimpleImage loadImageFromFile(const char* filename, int forceChannels=0); #endif
/* * @author Marco Livesu (marco.livesu@gmail.com) * @author Alessandro Muntoni (muntoni.alessandro@gmail.com) * @copyright Alessandro Muntoni 2016. */ #ifndef GLCANVAS_H #define GLCANVAS_H #include <QGLViewer/qglviewer.h> #include <QGLViewer/manipulatedCameraFrame.h> #include <QGLWidget> #include <QKeyEvent> #include <vector> #ifdef __APPLE__ #include <gl.h> #else #include <GL/gl.h> #endif #include "common/bounding_box.h" #include "interfaces/drawable_object.h" #include "interfaces/pickable_object.h" #include <qmessagebox.h> //using namespace std; class GLcanvas : public QGLViewer { Q_OBJECT public: GLcanvas(QWidget * parent = nullptr); ~GLcanvas(); void init(); void draw(); void drawWithNames(); void clear(); void fitScene(); void setClearColor(const QColor & color); BoundingBox getFullBoundingBox(); int getNumberVisibleObjects(); void postSelection(const QPoint& point); int pushObj(const DrawableObject * obj, bool visible = true); void deleteObj(const DrawableObject* obj); void setVisibility(const DrawableObject * obj, bool visible = true); bool isVisible(const DrawableObject* obj); signals: void objectPicked(unsigned int); private: QColor clearColor; std::vector<const DrawableObject *> drawlist; std::vector<bool> objVisibility; qglviewer::Vec orig, dir, selectedPoint; }; #endif // GLCANVAS_H
/* Copyright 2009 Brain Research Institute, Melbourne, Australia Created by Tom Close on 13/03/09. This file is part of Fourier Tract Sampling (FouTS). FouTS is free software: you can reobjectibute 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. FouTS is objectibuted 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 FTS. If not, see <http://www.gnu.org/licenses/>. */ #ifndef __bts_analysis_hessiantester_h__ #define __bts_analysis_hessiantester_h__ #include "bts/mcmc/state/tensor.h" #include "bts/triple.h" namespace FTS { namespace Analysis { template<typename Object, typename State> class HessianTester { public: //typedef the pointer to the function to test as 'Function'. typedef double (Object::*Function)(const State&, State&, typename State::Tensor&); protected: Object *object; public: HessianTester(Object& object) : object(&object) { } ~HessianTester() { } void test(Function function, State& state, double step_size, typename State::Tensor& analytic_hessian, typename State::Tensor& numeric_hessian); }; } } #include "progressbar.h" #include "math/vector.h" #include "math/matrix.h" namespace FTS { namespace Analysis { template<typename Object, typename State> void HessianTester<Object, State>::test( Function function, State& state, double step_size, typename State::Tensor& analytic_hessian, typename State::Tensor& numeric_hessian) { State perturbed_state(state), gradient(state), perturbed_gradient(state); gradient.invalidate(); typename State::Tensor dummy_hessian(state); (analytic_hessian = typename State::Tensor(state)).invalidate(); (*object.*function)(state, gradient, analytic_hessian); MR::Math::Vector<double>& state_vector = state; numeric_hessian.invalidate(); MR::ProgressBar progress_bar("Testing hessian calculations...", state_vector.size()); for (size_t elem_i = 0; elem_i < state_vector.size(); ++elem_i) { perturbed_gradient.invalidate(); state_vector[elem_i] += step_size; (*object.*function)(state, perturbed_gradient, dummy_hessian); state_vector[elem_i] -= step_size; perturbed_gradient -= gradient; perturbed_gradient /= step_size; numeric_hessian.row(elem_i) = perturbed_gradient; ++progress_bar; } } } } #endif
/***************************************************************************** * Copyright (c) 2014 Ted John, Duncan Frost * OpenRCT2, an open source clone of Roller Coaster Tycoon 2. * * This file is part of OpenRCT2. * * OpenRCT2 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/>. *****************************************************************************/ #include "../addresses.h" #include "../game.h" #include "../interface/widget.h" #include "../interface/window.h" #include "../localisation/localisation.h" #include "../peep/peep.h" #include "../peep/staff.h" #include "../sprites.h" #include "../world/sprite.h" #include "../interface/themes.h" #define WW 200 #define WH 100 enum WINDOW_RIDE_DEMOLISH_WIDGET_IDX { WIDX_BACKGROUND, WIDX_TITLE, WIDX_CLOSE, WIDX_DEMOLISH, WIDX_CANCEL }; // 0x009AEBA0 static rct_widget window_ride_demolish_widgets[] = { { WWT_FRAME, 0, 0, WW - 1, 0, WH - 1, STR_NONE, STR_NONE }, { WWT_CAPTION, 0, 1, WW - 2, 1, 14, STR_DEMOLISH_RIDE, STR_WINDOW_TITLE_TIP }, { WWT_CLOSEBOX, 0, WW - 13, WW - 3, 2, 13, STR_CLOSE_X, STR_CLOSE_WINDOW_TIP }, { WWT_DROPDOWN_BUTTON, 0, 10, 94, WH - 20, WH - 9, STR_DEMOLISH, STR_NONE }, { WWT_DROPDOWN_BUTTON, 0, WW - 95, WW - 11, WH - 20, WH - 9, STR_SAVE_PROMPT_CANCEL, STR_NONE }, { WIDGETS_END } }; static void window_ride_demolish_mouseup(rct_window *w, int widgetIndex); static void window_ride_demolish_invalidate(rct_window *w); static void window_ride_demolish_paint(rct_window *w, rct_drawpixelinfo *dpi); //0x0098E2E4 static rct_window_event_list window_ride_demolish_events = { NULL, window_ride_demolish_mouseup, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, window_ride_demolish_invalidate, window_ride_demolish_paint, NULL }; /** Based off of rct2: 0x006B486A */ void window_ride_demolish_prompt_open(int rideIndex) { rct_window *w; w = window_bring_to_front_by_number(WC_DEMOLISH_RIDE_PROMPT, rideIndex); if (w != NULL) return; w = window_create_centred(WW, WH, &window_ride_demolish_events, WC_DEMOLISH_RIDE_PROMPT, WF_TRANSPARENT); w->widgets = window_ride_demolish_widgets; w->enabled_widgets = (1 << WIDX_CLOSE) | (1 << WIDX_CANCEL) | (1 << WIDX_DEMOLISH); window_init_scroll_widgets(w); w->number = rideIndex; } /** * * rct2: 0x006B4933 */ static void window_ride_demolish_mouseup(rct_window *w, int widgetIndex) { switch (widgetIndex) { case WIDX_DEMOLISH: RCT2_GLOBAL(RCT2_ADDRESS_GAME_COMMAND_ERROR_TITLE, rct_string_id) = STR_CANT_DEMOLISH_RIDE; game_do_command(0, 1, 0, w->number, GAME_COMMAND_DEMOLISH_RIDE, 0, 0); break; case WIDX_CANCEL: case WIDX_CLOSE: window_close(w); break; } } static void window_ride_demolish_invalidate(rct_window *w) { colour_scheme_update(w); } /** * * rct2: 0x006B48E5 */ static void window_ride_demolish_paint(rct_window *w, rct_drawpixelinfo *dpi) { window_draw_widgets(w, dpi); rct_ride* ride = get_ride(w->number); RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS, uint16) = ride->name; RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS + 2, uint32) = ride->name_arguments; int x = w->x + WW / 2; int y = w->y + (WH / 2) - 3; gfx_draw_string_centred_wrapped(dpi, (void*)RCT2_ADDRESS_COMMON_FORMAT_ARGS, x, y, WW - 4, STR_DEMOLISH_RIDE_ID, 0); }
#ifndef VRAVATAR_H_INCLUDED #define VRAVATAR_H_INCLUDED #include <OpenSG/OSGConfig.h> #include <string> #include <map> #include "core/objects/VRObjectFwd.h" OSG_BEGIN_NAMESPACE; using namespace std; class VRAvatar { private: VRTransformPtr deviceRoot = 0; VRTransformPtr tmpContainer = 0; map<string, VRObjectPtr> avatars; VRObjectPtr initRay(); VRObjectPtr initCone(); VRObjectPtr initBroadRay(); void addAll(); void hideAll(); protected: VRAvatar(string name); ~VRAvatar(); void addAvatar(VRObjectPtr geo); public: void enableAvatar(string avatar); void disableAvatar(string avatar); VRTransformPtr getBeacon(); VRTransformPtr editBeacon(); void setBeacon(VRTransformPtr b); void updateBeacon(); }; OSG_END_NAMESPACE; #endif // VRAVATAR_H_INCLUDED
/* **************************************************************************** * Copyright (c) 2015 Uriah Liggett <freelaserscanner@gmail.com> * * This file is part of FreeLSS. * * * * FreeLSS 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. * * * * FreeLSS 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 FreeLSS. If not, see <http://www.gnu.org/licenses/>. * **************************************************************************** */ #pragma once namespace freelss { /** * Holds setup information about the hardware. */ class Setup { public: /** Returns the singleton instance */ static Setup * get(); static void release(); /** Encodes property information to the properties vector */ void encodeProperties(std::vector<Property>& properties); /** Decodes property information from the given vector */ void decodeProperties(const std::vector<Property>& properties); Vector3 cameraLocation; Vector3 leftLaserLocation; Vector3 rightLaserLocation; int rightLaserPin; int leftLaserPin; int motorEnablePin; int motorStepPin; int motorDirPin; int motorDirPinValue; int laserOnValue; int stepsPerRevolution; int motorResponseDelay; int motorStepDelay; int httpPort; std::string serialNumber; UnitOfLength unitOfLength; bool haveLaserPlaneNormals; Vector3 leftLaserPlaneNormal; Vector3 rightLaserPlaneNormal; PixelLocation leftLaserCalibrationTop; PixelLocation leftLaserCalibrationBottom; PixelLocation rightLaserCalibrationTop; PixelLocation rightLaserCalibrationBottom; bool enableLighting; int lightingPin; bool enableAuthentication; std::string passwordHash; private: /** Default Constructor */ Setup(); /** Singleton instance */ static Setup * m_instance; }; }
/************************************************************************** copyright : (C) 2007 by Lukáš Lalinský email : lalinsky@gmail.com **************************************************************************/ /*************************************************************************** * This library is free software; you can redistribute it and/or modify * * it under the terms of the GNU Lesser General Public License version * * 2.1 as published by the Free Software Foundation. * * * * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 * * USA * * * * Alternatively, this file is available under the Mozilla Public * * License Version 1.1. You may obtain a copy of the License at * * http://www.mozilla.org/MPL/ * ***************************************************************************/ #ifndef TAGLIB_MP4FILE_H #define TAGLIB_MP4FILE_H #include "tag.h" #include "tfile.h" #include "taglib_export.h" #include "mp4properties.h" #include "mp4tag.h" namespace TagLib { //! An implementation of MP4 (AAC, ALAC, ...) metadata namespace MP4 { class Atoms; /*! * This implements and provides an interface for MP4 files to the * TagLib::Tag and TagLib::AudioProperties interfaces by way of implementing * the abstract TagLib::File API as well as providing some additional * information specific to MP4 files. */ class TAGLIB_EXPORT File : public TagLib::File { public: /*! * Contructs a MP4 file from \a file. If \a readProperties is true the * file's audio properties will also be read using \a propertiesStyle. If * false, \a propertiesStyle is ignored. * * \note In the current implementation, both \a readProperties and * \a propertiesStyle are ignored. */ File(FileName file, bool readProperties = true, Properties::ReadStyle audioPropertiesStyle = Properties::Average); /*! * Destroys this instance of the File. */ virtual ~File(); /*! * Returns a pointer to the MP4 tag of the file. * * MP4::Tag implements the tag interface, so this serves as the * reimplementation of TagLib::File::tag(). * * \note The Tag <b>is still</b> owned by the MP4::File and should not be * deleted by the user. It will be deleted when the file (object) is * destroyed. */ Tag *tag() const; /*! * Returns the MP4 audio properties for this file. */ Properties *audioProperties() const; /*! * Save the file. * * This returns true if the save was successful. */ bool save(); private: void read(bool readProperties, Properties::ReadStyle audioPropertiesStyle); bool checkValid(const MP4::AtomList &list); class FilePrivate; FilePrivate *d; }; } } #endif
/* RetroArch - A frontend for libretro. * Copyright (C) 2010-2014 - Hans-Kristian Arntzen * Copyright (C) 2011-2017 - Daniel De Matteis * Copyright (C) 2016-2019 - Brad Parker * * RetroArch 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 Found- * ation, either version 3 of the License, or (at your option) any later version. * * RetroArch 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 RetroArch. * If not, see <http://www.gnu.org/licenses/>. */ #ifndef WIN32_COMMON_H__ #define WIN32_COMMON_H__ #include <string.h> #ifndef _XBOX #define WIN32_LEAN_AND_MEAN #include <windows.h> #if _WIN32_WINNT <= 0x0400 /* Windows versions below 98 do not support multiple monitors, so fake it */ #define COMPILE_MULTIMON_STUBS #include <multimon.h> #endif #endif #include <boolean.h> #include <retro_common_api.h> #include <retro_environment.h> #include "../../driver.h" #include "../../retroarch.h" #ifndef _XBOX #include "../../ui/drivers/ui_win32_resource.h" #include "../../ui/drivers/ui_win32.h" #endif RETRO_BEGIN_DECLS #if !defined(_XBOX) extern unsigned g_win32_resize_width; extern unsigned g_win32_resize_height; extern bool g_win32_inited; extern bool g_win32_restore_desktop; extern ui_window_win32_t main_window; void win32_monitor_get_info(void); void win32_monitor_info(void *data, void *hm_data, unsigned *mon_id); int win32_change_display_settings(const char *str, void *devmode_data, unsigned flags); void create_graphics_context(HWND hwnd, bool *quit); void create_gdi_context(HWND hwnd, bool *quit); bool gdi_has_menu_frame(void *data); bool win32_get_video_output(DEVMODE *dm, int mode, size_t len); #if !defined(__WINRT__) bool win32_window_init(WNDCLASSEX *wndclass, bool fullscreen, const char *class_name); void win32_set_style(MONITORINFOEX *current_mon, HMONITOR *hm_to_use, unsigned *width, unsigned *height, bool fullscreen, bool windowed_full, RECT *rect, RECT *mon_rect, DWORD *style); #endif #endif void win32_monitor_from_window(void); void win32_monitor_init(void); bool win32_set_video_mode(void *data, unsigned width, unsigned height, bool fullscreen); bool win32_window_create(void *data, unsigned style, RECT *mon_rect, unsigned width, unsigned height, bool fullscreen); bool win32_suppress_screensaver(void *data, bool enable); bool win32_get_metrics(void *data, enum display_metric_types type, float *value); void win32_show_cursor(void *data, bool state); HWND win32_get_window(void); bool win32_has_focus(void *data); void win32_check_window(bool *quit, bool *resize, unsigned *width, unsigned *height); void win32_set_window(unsigned *width, unsigned *height, bool fullscreen, bool windowed_full, void *rect_data); void win32_get_video_output_size( unsigned *width, unsigned *height); void win32_get_video_output_prev( unsigned *width, unsigned *height); void win32_get_video_output_next( unsigned *width, unsigned *height); void win32_window_reset(void); void win32_destroy_window(void); bool win32_taskbar_is_created(void); float win32_get_refresh_rate(void *data); #if defined(HAVE_D3D8) || defined(HAVE_D3D9) || defined (HAVE_D3D10) || defined (HAVE_D3D11) || defined (HAVE_D3D12) LRESULT CALLBACK WndProcD3D(HWND hwnd, UINT message, WPARAM wparam, LPARAM lparam); #endif #if defined(HAVE_OPENGL) || defined(HAVE_OPENGL1) || defined(HAVE_OPENGL_CORE) || defined(HAVE_VULKAN) LRESULT CALLBACK WndProcWGL(HWND hwnd, UINT message, WPARAM wparam, LPARAM lparam); #endif LRESULT CALLBACK WndProcGDI(HWND hwnd, UINT message, WPARAM wparam, LPARAM lparam); #ifdef _XBOX BOOL IsIconic(HWND hwnd); #endif bool win32_load_content_from_gui(const char *szFilename); void win32_setup_pixel_format(HDC hdc, bool supports_gl); RETRO_END_DECLS #endif
/* dbgtools - platform independent wrapping of "nice to have" debug functions. version 0.1, october, 2013 https://github.com/wc-duck/dbgtools Copyright (C) 2013- Fredrik Kihlander 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. Fredrik Kihlander */ #include <cassert> #ifndef DBGTOOLS_ASSERT_INCLUDED #define DBGTOOLS_ASSERT_INCLUDED /** * return value used by assert callback to determine action of assert. */ enum assert_action { ASSERT_ACTION_NONE, ///< continue execution after callback returns. ASSERT_ACTION_BREAK ///< break into debugger when callstack returns. }; /** * callback signature for callback to attach to assert. * * @param cond assert condition that failed as string. * @param msg assert message provided, or "" no one was provided. * @param file file where assert was triggered. * @param line line where assert was triggered. * @param userdata pointer passed together will callback to assert_register_callback. * * @return the action to take when callback returns. */ typedef assert_action (*assert_callback_t)( const char* cond, const char* msg, const char* file, unsigned int line, void* user_data ); /** * register a callback to call when an assert is triggered. */ void assert_register_callback( assert_callback_t callback, void* user_data ); /** * macro that "asserts" that a condition is true, if not it breaks into the debugger. * @note if ASSERT_ENABLE is not defined it expands to a noop. * * @example ASSERT( a == 1 ); // trigger if a != 1 * @example ASSERT( a == 1, "a was not == to 1" ); // trigger if a != 1 and reports "a was not == to 1" * @example ASSERT( a == 1, "a == %d", a ); // trigger if a != 1 and reports "a == 1337" if a is 1337 that is! */ #define ASSERT(cond, ...) ((void)sizeof( cond )) /** * macro that "asserts" that a condition is true, if not it breaks into the debugger. * @note if ASSERT_ENABLE is not defined it expands to only the condition. */ #define VERIFY(cond, ...) ((void)(cond)) /** * macro inserting a breakpoint into the code that breaks into the debugger on most platforms. */ #define DBG_TOOLS_BREAKPOINT assert_action assert_call_trampoline( const char* file, unsigned int line, const char* cond ); assert_action assert_call_trampoline( const char* file, unsigned int line, const char* cond, const char* fmt, ... ); // ... private implementation ... #undef DBG_TOOLS_BREAKPOINT #if defined ( _MSC_VER ) # define DBG_TOOLS_BREAKPOINT __debugbreak() #elif defined( __GNUC__ ) # if defined(__i386__) || defined( __x86_64__ ) void inline __attribute__((always_inline)) _dbg_tools_gcc_break_helper() { __asm("int3"); } # define DBG_TOOLS_BREAKPOINT _dbg_tools_gcc_break_helper() # else # define DBG_TOOLS_BREAKPOINT __builtin_trap() # endif #else # define DBG_TOOLS_BREAKPOINT exit(1) #endif #ifdef DBG_TOOLS_ASSERT_ENABLE #undef ASSERT #undef VERIFY #if defined( _MSC_VER ) #define ASSERT(cond, ...) ( (void)( ( !(cond) ) && ( assert_call_trampoline( __FILE__, __LINE__, #cond, __VA_ARGS__ ) == ASSERT_ACTION_BREAK ) && ( DBG_TOOLS_BREAKPOINT, 1 ) ) ) #define VERIFY(cond, ...) ASSERT( cond, __VA_ARGS__ ) #elif defined( __GNUC__ ) #define ASSERT(cond, args...) ( (void)( ( !(cond) ) && ( assert_call_trampoline( __FILE__, __LINE__, #cond, ##args ) == ASSERT_ACTION_BREAK ) && ( DBG_TOOLS_BREAKPOINT, 1 ) ) ) #define VERIFY(cond, args...) ASSERT( cond, ##args ) #endif #else inline void assert_register_callback( assert_callback_t, void* ) {} #endif // DBG_TOOLS_ASSERT_ENABLE #endif // DBGTOOLS_ASSERT_INCLUDED
//////////////////////////////////////////////////////////////////////////// // Created : 22.04.2009 // Author : Mykhailo Parfeniuk // Copyright (C) GSC Game World - 2009 //////////////////////////////////////////////////////////////////////////// #ifndef BLENDER_LIGHT_SPOT_H_INCLUDED #define BLENDER_LIGHT_SPOT_H_INCLUDED namespace xray { namespace render{ class blender_light_spot: public blender { public: enum { //tech_fill, tech_unshadowed }; private: virtual void compile(blender_compiler& compiler, const blender_compilation_options& options); }; // class blender_light_spot } // namespace render } // namespace xray #endif // #ifndef BLENDER_LIGHT_SPOT_H_INCLUDED
/* RetroArch - A frontend for libretro. * Copyright (C) 2010-2014 - Hans-Kristian Arntzen * Copyright (C) 2011-2017 - Daniel De Matteis * * RetroArch 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 Found- * ation, either version 3 of the License, or (at your option) any later version. * * RetroArch 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 RetroArch. * If not, see <http://www.gnu.org/licenses/>. */ #include <stdlib.h> #include <retro_inline.h> #include <retro_math.h> #include "video_coord_array.h" static INLINE bool realloc_checked(void **ptr, size_t size) { void *nptr = NULL; if (*ptr) nptr = realloc(*ptr, size); else nptr = malloc(size); if (nptr) *ptr = nptr; return *ptr == nptr; } static bool video_coord_array_resize(video_coord_array_t *ca, unsigned cap) { size_t base_size = sizeof(float) * cap; if (!realloc_checked((void**)&ca->coords.vertex, 2 * base_size)) return false; if (!realloc_checked((void**)&ca->coords.color, 4 * base_size)) return false; if (!realloc_checked((void**)&ca->coords.tex_coord, 2 * base_size)) return false; if (!realloc_checked((void**)&ca->coords.lut_tex_coord, 2 * base_size)) return false; ca->allocated = cap; return true; } bool video_coord_array_append(video_coord_array_t *ca, const video_coords_t *coords, unsigned count) { size_t base_size, offset; count = MIN(count, coords->vertices); if (ca->coords.vertices + count >= ca->allocated) { unsigned cap = next_pow2(ca->coords.vertices + count); if (!video_coord_array_resize(ca, cap)) return false; } base_size = count * sizeof(float); offset = ca->coords.vertices; /* XXX: I wish we used interlaced arrays so * we could call memcpy only once. */ memcpy(ca->coords.vertex + offset * 2, coords->vertex, base_size * 2); memcpy(ca->coords.color + offset * 4, coords->color, base_size * 4); memcpy(ca->coords.tex_coord + offset * 2, coords->tex_coord, base_size * 2); memcpy(ca->coords.lut_tex_coord + offset * 2, coords->lut_tex_coord, base_size * 2); ca->coords.vertices += count; return true; } void video_coord_array_free(video_coord_array_t *ca) { if (!ca->allocated) return; if (ca->coords.vertex) free(ca->coords.vertex); ca->coords.vertex = NULL; if (ca->coords.color) free(ca->coords.color); ca->coords.color = NULL; if (ca->coords.tex_coord) free(ca->coords.tex_coord); ca->coords.tex_coord = NULL; if (ca->coords.lut_tex_coord) free(ca->coords.lut_tex_coord); ca->coords.lut_tex_coord = NULL; ca->coords.vertices = 0; ca->allocated = 0; }
/* * Cantata * * Copyright (c) 2011-2019 Craig Drummond <craig.p.drummond@gmail.com> * * ---- * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; see the file COPYING. If not, write to * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301, USA. */ #ifndef COVER_DIALOG_H #define COVER_DIALOG_H #include "config.h" #include "support/dialog.h" #include "mpd-interface/song.h" #include "ui_coverdialog.h" #include "covers.h" #include <QSet> #include <QList> #include <QMap> class NetworkJob; class QUrl; class QTemporaryFile; class QListWidgetItem; class QLabel; class QProgressBar; class QScrollArea; class QWheelEvent; class CoverItem; class ExistingCover; class Spinner; class MessageOverlay; class QAction; class QMenu; class CoverPreview : public Dialog { Q_OBJECT public: CoverPreview(QWidget *p); ~CoverPreview() override { } void showImage(const QImage &img, const QString &u); void downloading(const QString &u); bool aboutToShow(const QString &u) const { return u==url; } private Q_SLOTS: void progress(qint64 rx, qint64 total); private: void scaleImage(int adjust); void wheelEvent(QWheelEvent *event) override; private: QString url; QLabel *loadingLabel; QProgressBar *pbar; QLabel *imageLabel; QScrollArea *scrollArea; double zoom; int imgW; int imgH; }; class CoverDialog : public Dialog, public Ui::CoverDialog { Q_OBJECT public: static int instanceCount(); enum DownloadType { DL_Query, DL_Thumbnail, DL_LargePreview, DL_LargeSave }; CoverDialog(QWidget *parent); ~CoverDialog() override; void show(const Song &s, const Covers::Image &current=Covers::Image()); int imageSize() const { return iSize; } Q_SIGNALS: void selectedCover(const QImage &img, const QString &fileName); private Q_SLOTS: void queryJobFinished(); void downloadJobFinished(); void showImage(QListWidgetItem *item); void sendQuery(); void cancelQuery(); void checkStatus(); void addLocalFile(); void menuRequested(const QPoint &pos); void showImage(); void removeImages(); void updateProviders(); private: void sendLastFmQuery(const QString &fixedQuery, int page); void sendGoogleQuery(const QString &fixedQuery, int page); void sendSpotifyQuery(const QString &fixedQuery); void sendITunesQuery(const QString &fixedQuery); void sendDeezerQuery(const QString &fixedQuery); CoverPreview *previewDialog(); void insertItem(CoverItem *item); NetworkJob * downloadImage(const QString &url, DownloadType dlType); void downloadThumbnail(const QString &thumbUrl, const QString &largeUrl, const QString &host, int w=-1, int h=-1, int sz=-1); void clearTempFiles(); void sendQueryRequest(const QUrl &url, const QString &host=QString()); void parseLastFmQueryResponse(const QByteArray &resp); void parseGoogleQueryResponse(const QByteArray &resp); void parseCoverArtArchiveQueryResponse(const QByteArray &resp); void parseSpotifyQueryResponse(const QByteArray &resp); void parseITunesQueryResponse(const QByteArray &resp); void parseDeezerQueryResponse(const QByteArray &resp); void slotButtonClicked(int button) override; bool saveCover(const QString &src, const QImage &img); void dragEnterEvent(QDragEnterEvent *event) override; void dropEvent(QDropEvent *event) override; void setSearching(bool s); void addProvider(QMenu *mnu, const QString &name, int bit, int value); private: int enabledProviders; Song song; ExistingCover *existing; QString currentQueryString; int currentQueryProviders; QSet<NetworkJob *> currentQuery; QSet<QString> currentUrls; QSet<QString> currentLocalCovers; QList<QTemporaryFile *> tempFiles; CoverPreview *preview; bool saving; bool isArtist; bool isComposer; int iSize; Spinner *spinner; MessageOverlay *msgOverlay; int page; QMenu *menu; QAction *showAction; QAction *removeAction; QMap<int, QAction *> providers; }; #endif
/************************************************************* This file is part of messaging-cells. messaging-cells is free software: you can redistribute it and/or modify it under the terms of the version 3 of the GNU General Public License as published by the Free Software Foundation. messaging-cells 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 messaging-cells. If not, see <http://www.gnu.org/licenses/>. ------------------------------------------------------------ Copyright (C) 2017-2018. QUIROGA BELTRAN, Jose Luis. Id (cedula): 79523732 de Bogota - Colombia. See https://messaging-cells.github.io/ messaging-cells is free software thanks to The Glory of Our Lord Yashua Melej Hamashiaj. Our Resurrected and Living, both in Body and Spirit, Prince of Peace. ------------------------------------------------------------*/ // mc_shared_ptd.h #ifndef MC_SHARED_DATA_PTD_H #define MC_SHARED_DATA_PTD_H #if ! defined(MC_IS_PTD_CODE) #error Only compile for PTD code (your linux) #endif #ifdef __cplusplus mc_c_decl { #endif //====================================================================== // epiphany III macros #define mc_axis_bits 6 #define mc_axis_mask 0x3f typedef uintptr_t mc_addr_t; typedef uint16_t mc_workeru_id_t; // e_coreid_t typedef uint16_t mc_workeru_co_t; typedef uint16_t mc_workeru_nn_t; //define mc_addr_val_in_p16(p16) ((mc_addr_t)(mc_v32_of_p16(p16))) //====================================================================== // address macros mc_workeru_id_t mcm_get_addr_workeru_id_fn(void*); void* mcm_addr_with_fn(mc_workeru_id_t id, void* addr); #define mc_addr_has_id(addr) true #define mc_addr_get_id(addr) mcm_get_addr_workeru_id_fn((void*)(addr)) #define mc_addr_set_id(id, addr) mcm_addr_with_fn((id), (void*)(addr)) #define mc_addr_has_local_id(addr) (mc_addr_get_id(addr) == MC_WORKERU_INFO->the_workeru_id) #define mc_addr_is_local(addr) mc_addr_has_local_id(addr) #define mc_addr_get_disp(addr) ((mc_addr_t)(addr)) #define mc_addr_set_disp(disp, addr) mc_addr_set_id(mc_addr_get_id(addr), (disp)) #define mck_as_glb_pt(pt) ((void*)(pt)) #define mck_as_loc_pt(pt) ((void*)(pt)) #define mc_addr_same_id(addr1, addr2) (mc_addr_get_id(addr1) == mc_addr_get_id(addr2)) #ifdef __cplusplus } #endif #endif // MC_SHARED_DATA_PTD_H
#include <dlfcn.h> #include <gdk/gdk.h> #include <stdio.h> #include <string.h> #include <strings.h> #include "coqidefix.h" static gboolean (* parse)(gchar const* spec, GdkColor* color) = NULL; static void load(void) { parse = dlsym(RTLD_NEXT, /* libgdk-x11-2.0.so: */ "gdk_color_parse"); if (parse == NULL) { fputs(dlerror(), stderr); fputc('\n', stderr); } } static gboolean affected(gchar const* const spec, GdkColor const* const color) { size_t index; for (index = 0; index < sizeof skips / sizeof *skips; ++index) { struct skip const* skip; skip = &skips[index]; if (skip->parsed) { if (skip->match.after.red == color->red && skip->match.after.green == color->green && skip->match.after.blue == color->blue) return FALSE; } else { int (* cmp)(char const* s1, char const* s2); cmp = skip->match.before.ignore_case ? strcmp : strcasecmp; if (cmp(skip->match.before.spec, spec) == 0) return FALSE; } } return TRUE; } static void change(GdkColor* const color) { color->red = G_MAXUINT16 - color->red; color->green = G_MAXUINT16 - color->green; color->blue = G_MAXUINT16 - color->blue; } gboolean gdk_color_parse(gchar const* const spec, GdkColor* const color) { gboolean succeeded; if (parse == NULL) load(); succeeded = parse(spec, color); trace(stderr, "gdk_color_parse(\"%s\")", spec); if (!succeeded) goto end; trace(stderr, " = {%d, %d, %d}", color->red, color->green, color->blue); if (!affected(spec, color)) goto end; change(color); trace(stderr, " -> {%d, %d, %d}", color->red, color->green, color->blue); end: trace(stderr, "\n"); return succeeded; }
/* * Bitmap - Bit map for InterViews */ #include <InterViews/bitmap.h> #include <InterViews/transformer.h> Bitmap::Bitmap (const char* filename) { rep = new BitmapRep(filename); } Bitmap::Bitmap (void* d, int w, int h, int x, int y) { rep = new BitmapRep(d, w, h, x, y); } Bitmap::Bitmap (Font* f, int c) { rep = new BitmapRep(f, c); } Bitmap::Bitmap (Bitmap* b) { rep = new BitmapRep(b->rep, NoTx); } Bitmap::~Bitmap () { if (LastRef()) { delete rep; } } void* Bitmap::Map () { return rep->GetMap(); } void Bitmap::Transform (Transformer* t) { BitmapRep* newrep = new BitmapRep(rep, t); delete rep; rep = newrep; } void Bitmap::Scale (float sx, float sy) { Transformer* t = new Transformer; t->Scale(sx,sy); Transform(t); delete t; } void Bitmap::Rotate (float angle) { Transformer* t = new Transformer; t->Rotate(angle); Transform(t); delete t; } void Bitmap::FlipHorizontal () { BitmapRep* newrep = new BitmapRep(rep, FlipH); delete rep; rep = newrep; } void Bitmap::FlipVertical () { BitmapRep* newrep = new BitmapRep(rep, FlipV); delete rep; rep = newrep; } void Bitmap::Invert () { BitmapRep* newrep = new BitmapRep(rep, Inv); delete rep; rep = newrep; } void Bitmap::Rotate90 () { BitmapRep* newrep = new BitmapRep(rep, Rot90); delete rep; rep = newrep; } void Bitmap::Rotate180 () { BitmapRep* newrep = new BitmapRep(rep, Rot180); delete rep; rep = newrep; } void Bitmap::Rotate270 () { BitmapRep* newrep = new BitmapRep(rep, Rot270); delete rep; rep = newrep; } boolean Bitmap::Contains (int x, int y) { return x >= Left() && x <= Right() && y >= Bottom() && y <= Top(); } boolean Bitmap::Peek (int x, int y) { return Contains(x, y) ? rep->GetBit(x-Left(), y-Bottom()) : false; } void Bitmap::Poke (boolean bit, int x, int y) { if (Contains(x, y)) { rep->PutBit(x-Left(), y-Bottom(), bit); rep->Touch(); } }
#ifndef _FIR_FLOAT_H #define _FIR_FLOAT_H ////////////////////////////////////////////////////////////// // Filter Code Definitions ////////////////////////////////////////////////////////////// // maximum number of inputs that can be handled // in one function call #define MAX_INPUT_LEN 3000 // maximum length of filter than can be handled #define MAX_FLT_LEN 63 // buffer to hold all of the input samples #define BUFFER_LEN (MAX_FLT_LEN - 1 + MAX_INPUT_LEN) class FIR_FLOAT_1Ch { public: FIR_FLOAT_1Ch(); ~FIR_FLOAT_1Ch(); void firFloat( double *coeffs, double *input, double *output, int length, int filterLength, double Gain); double* firStoreNewSamples( double *inp, int length); void firMoveProcSamples( int length); private: double insamp[BUFFER_LEN]; }; // the FIR filter function #endif
/* Copyright (©) 2003-2022 Teus Benschop. 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/libraries.h> void test_database_etcbc4 ();
/* This file is part of Vajolet. Vajolet 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. Vajolet 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 Vajolet. If not, see <http://www.gnu.org/licenses/> */ #ifndef SYZYGY_H #define SYZYGY_H #include <string> #include <vector> #include "tbfile.h" #include "tbtables.h" class Position; class Move; class Syzygy{ public: static Syzygy& getInstance(){ static Syzygy instance; return instance; } void setPath(const std::string& s); size_t getSize() const; size_t getMaxCardinality() const; WDLScore probeWdl(Position& pos, ProbeState& result) const; int probeDtz(Position& pos, ProbeState& result)const; bool rootProbe(Position& pos, std::vector<extMove>& rootMoves) const; bool rootProbeWdl(Position& pos, std::vector<extMove>& rootMoves) const; private: Syzygy(); ~Syzygy()= default; Syzygy(const Syzygy&)= delete; Syzygy& operator=(const Syzygy&)= delete; WDLScore _search(Position& pos, ProbeState& result, const bool CheckZeroingMoves) const; static int _dtzBeforeZeroing(WDLScore wdl); static int _signOf(int val); static int _signOf(WDLScore val); TBTables _t; }; #endif
/** * Portions Copyright (c) Microsoft Corporation. All rights reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * http://www.apache.org/licenses/LICENSE-2.0 * * THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS * OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION * ANY IMPLIED WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR * PURPOSE, MERCHANTABLITY OR NON-INFRINGEMENT. * * See the Apache Version 2.0 License for specific language governing * permissions and limitations under the License. */ #ifndef __EDGE_H #define __EDGE_H #include "../common/edge_common.h" #include <vcclr.h> #using <system.dll> #using <system.web.extensions.dll> using namespace v8; using namespace System::Collections::Generic; using namespace System::Reflection; using namespace System::Threading::Tasks; using namespace System::Threading; using namespace System::Web::Script::Serialization; Handle<v8::String> stringCLR2V8(System::String^ text); System::String^ stringV82CLR(Handle<v8::String> text); System::String^ exceptionV82stringCLR(Handle<v8::Value> exception); Handle<Value> throwV8Exception(Handle<Value> exception); typedef struct clrActionContext { gcroot<System::Action^> action; static void ActionCallback(void* data); } ClrActionContext; ref class ClrFuncInvokeContext { private: Persistent<Function>* callback; uv_edge_async_t* uv_edge_async; void DisposeCallback(); public: property System::Object^ Payload; property Task<System::Object^>^ Task; property bool Sync; ClrFuncInvokeContext(Handle<v8::Value> callbackOrSync); void CompleteOnCLRThread(System::Threading::Tasks::Task<System::Object^>^ task); void CompleteOnV8ThreadAsynchronous(); Handle<v8::Value> CompleteOnV8Thread(); void InitializeAsyncOperation(); }; ref class NodejsFunc { public: property Persistent<Function>* Func; NodejsFunc(Handle<Function> function); ~NodejsFunc(); !NodejsFunc(); Task<System::Object^>^ FunctionWrapper(System::Object^ payload); }; ref class PersistentDisposeContext { private: System::IntPtr ptr; public: PersistentDisposeContext(Persistent<Value>* handle); void CallDisposeOnV8Thread(); }; ref class NodejsFuncInvokeContext; typedef struct nodejsFuncInvokeContextWrap { gcroot<NodejsFuncInvokeContext^> context; } NodejsFuncInvokeContextWrap; ref class NodejsFuncInvokeContext { private: NodejsFunc^ functionContext; System::Object^ payload; System::Exception^ exception; System::Object^ result; NodejsFuncInvokeContextWrap* wrap; void Complete(); public: property TaskCompletionSource<System::Object^>^ TaskCompletionSource; NodejsFuncInvokeContext( NodejsFunc^ functionContext, System::Object^ payload); ~NodejsFuncInvokeContext(); !NodejsFuncInvokeContext(); void CompleteWithError(System::Exception^ exception); void CompleteWithResult(Handle<v8::Value> result); void CallFuncOnV8Thread(); }; ref class ClrFuncReflectionWrap { private: System::Object^ instance; MethodInfo^ invokeMethod; ClrFuncReflectionWrap(); public: static ClrFuncReflectionWrap^ Create(Assembly^ assembly, System::String^ typeName, System::String^ methodName); Task<System::Object^>^ Call(System::Object^ payload); }; ref class ClrFunc { private: System::Func<System::Object^,Task<System::Object^>^>^ func; ClrFunc(); static Handle<v8::Object> MarshalCLRObjectToV8(System::Object^ netdata); public: static NAN_METHOD(Initialize); static Handle<v8::Function> Initialize(System::Func<System::Object^,Task<System::Object^>^>^ func); Handle<v8::Value> Call(Handle<v8::Value> payload, Handle<v8::Value> callback); static Handle<v8::Value> MarshalCLRToV8(System::Object^ netdata); static Handle<v8::Value> MarshalCLRExceptionToV8(System::Exception^ exception); static System::Object^ MarshalV8ToCLR(Handle<v8::Value> jsdata); }; typedef struct clrFuncWrap { gcroot<ClrFunc^> clrFunc; } ClrFuncWrap; #endif
/*========================================================================= Program: C3D: Command-line companion tool to ITK-SNAP Module: ThresholdImage.h Language: C++ Website: itksnap.org/c3d Copyright (c) 2014 Paul A. Yushkevich This file is part of C3D, a command-line companion tool to ITK-SNAP C3D 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 __ThresholdImage_h_ #define __ThresholdImage_h_ #include "ConvertAdapter.h" template<class TPixel, unsigned int VDim> class ThresholdImage : public ConvertAdapter<TPixel, VDim> { public: // Common typedefs CONVERTER_STANDARD_TYPEDEFS ThresholdImage(Converter *c) : c(c) {} void operator() (double u1, double u2, double vIn, double vOut); private: Converter *c; }; #endif
// Linux: SCSI Generic
/* * Kchmviewer - a CHM and EPUB file viewer with broad language support * Copyright (C) 2004-2014 George Yunaev, gyunaev@ulduzsoft.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 HELPERXMLHANDLER_EPUBCONTAINER_H #define HELPERXMLHANDLER_EPUBCONTAINER_H #include <QtXml/QXmlDefaultHandler> class HelperXmlHandler_EpubContainer : public QXmlDefaultHandler { public: // Overridden members bool startElement ( const QString & namespaceURI, const QString & localName, const QString & qName, const QXmlAttributes & atts ); // The content path QString contentPath; }; #endif // HELPERXMLHANDLER_EPUBCONTAINER_H
////////////////////////////////////////////////////////////////////////////////// // // Copyright (c) 2014, Jonathan Balzer // // All rights reserved. // // This file is part of the software accompanying the following publication // // @INPROCEEDINGS{Balzeretal2014, // author = {J. Balzer and D. Acevedo-Feliz and S. Soatto and S. H\"ofer and M. Hadwiger and J. Beyerer}, // title = {Cavlectometry: Towards Holistic Reconstruction of Large Mirror Objects}, // booktitle = {International Conference on 3D Vision (3DV)}, // year = {2014}} // // This file contains 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 source code 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 file. If not, see <http://www.gnu.org/licenses/>. // ////////////////////////////////////////////////////////////////////////////////// #ifndef TRIMESH_H_ #define TRIMESH_H_ #include <set> #include <OpenMesh/Core/IO/MeshIO.hh> #include <OpenMesh/Core/Mesh/TriMesh_ArrayKernelT.hh> #include <OpenMesh/Tools/Subdivider/Adaptive/Composite/CompositeT.hh> typedef OpenMesh::TriMesh_ArrayKernelT<OpenMesh::Subdivider::Adaptive::CompositeTraits> TriangleMesh; #include "linalg.h" #include "cam.h" #include "bbox.h" /*! \brief triangle mesh * * * */ class CTriangleMesh:public TriangleMesh { public: //! Standard constructor. CTriangleMesh(); //! Area. float FaceArea(FaceHandle fh); //! Computes the integration weight for a vertex. float VertexQuadratureWeight(VertexHandle vh); //! Computes the Voronoi area around a vertex. float VoronoiArea(VertexHandle vh); //! Returns barycenter of a mesh face. vec3f Barycenter(FaceHandle fh); //! Returns the barycenter of the entire mesh. vec3f Barycenter() const; //! Exterior normal at a boundary vertex. CTriangleMesh::Normal ExteriorNormal(VertexHandle vh); //! Refines the mesh uniformly with Loop's scheme. void UniformMeshRefinement(size_t n); //! Collapses edges with aspect ratio to high to do FE-analysis. void EdgeCollapse(double threshold); /*! Smoothes the boundary of mesh. * * \details Only works for surfaces with topology of a disk. * */ bool SmoothBoundary(size_t n); /*! Finds a vertex handle that is on the boundary of the mesh. * * \details If the boundary is multiply-connected, the first hit will be returned. */ OpenMesh::VertexHandle FindBoundaryVertex(); //! Deletes a given set of vertices. void DeleteVertices(std::set<VertexHandle> vertices); //! Deletes a given set of faces. void DeleteFaces(std::set<FaceHandle> faces); //! Find isolated faces. std::set<FaceHandle> FindIsolatedFaces(); //! Random normal displacement. void Disturb(float mu, float sigma); //! Simple mesh smoothing by vertex averaging. void SimpleSmooth(u_int n, bool boundary); //! Casts point into R4R data structure. vec3f Point(VertexHandle vh) const; //! Casts normal into R4R data structure. vec3f Normal(VertexHandle vh) const; //! Casts normal into R4R data structure. vec3f Normal(FaceHandle vh) const; //! Computes the bounding box of the mesh. CBoundingBox<float> BoundingBox() const; //! Average edge length. float MeanEdgeLength(); //! Compute dual half edge. TriangleMesh::Normal DualEdgeVector(HalfedgeHandle heh); //! Gets handle of the half edge opposite to a vertex on a face. OpenMesh::HalfedgeHandle OppositeHalfedgeHandle(FaceHandle fh, VertexHandle vh); //! Computes the discrete gradient operator for vertex-based functions. CCSCMatrix<double,int> ComputeGradientOperator(); /*! \brief Computes the discrete Laplace-Beltrami operator. * * \details This is much somehow much faster than squaring the * discrete gradient operator. * */ CCSCMatrix<double,int> ComputeLaplaceBeltramiOperator(); //! Cotangent of the angle opposite to a half edge. float CotanOppositeAngle(HalfedgeHandle heh); //! Save mesh to disk. void SaveToFile(const char* filename); private: //! Previous half edge on boundary from vertex. OpenMesh::HalfedgeHandle PrevBoundaryHalfedge(VertexHandle vh); //! Next half edge on boundary from vertex. OpenMesh::HalfedgeHandle NextBoundaryHalfedge(VertexHandle vh); //! Next vertex on boundary from vertex. OpenMesh::VertexHandle PreviousBoundaryVertex(VertexHandle vh); //! Next vertex on boundary from vertex. OpenMesh::VertexHandle NextBoundaryVertex(VertexHandle vh); //! Checks for an obtuse triangle. bool IsTriangleObtuse(FaceHandle fh); //! Saves as VTK file. void SaveAsVTK(const char* filename); }; #endif // TRIMESH_H_
// Source : https://leetcode.com/problems/3sum-closest/ // Author : Peter-s /********************************************************************************** * * Given an array S of n integers, find three integers in S such that the sum is closest to a given number, target. Return the sum of the three integers. You may assume that each input would have exactly one solution. * * For example, given array S = {-1 2 1 -4}, and target = 1. * * The sum that is closest to the target is 2. (-1 + 2 + 1 = 2). * **********************************************************************************/ #include <stdio.h> #include <string.h> #include <stdlib.h> #include <stdbool.h> int bubblesort(int *A, int n) { int i=0,j=0; for(i=0;i<n;i++) { for(j=0;j<n-1;j++) { if(A[i] < A[j]) { A[i]=A[i]+A[j]; A[j]=A[i]-A[j];; A[i]=A[i]-A[j]; } } } return 0; } int threeSumClosest(int* A, int n, int target) { int i=0,j=0,k=0; bubblesort(A,n); int min = A[0]+A[1]+A[2]; int max = A[n-1]+A[n-2]+A[n-3]; if(min >= target) return min; if(max <= target) return max; // Find Start Pos int sum = A[0] + A[1] +A[n-1]; while(sum < target && i< n-2) { i++; sum = A[i] + A[i+1] +A[n-1]; } if(i > 0) i--; printf("max:%d min:%d \n", max,min); for(;i<n-2;i++) { for(j=i+1;j<n-1;j++) { for(k=j+1;k<n;k++) { sum=A[i] + A[j] + A[k]; //printf("i:%d j:%d k:%d max:%d min:%d sum:%d\n", i, j, k, max,min,sum); if(sum == target) { return target; } if(sum < target && sum > min) min = sum; if(sum > target) { if(sum < max) max = sum; break; } } } } //printf("max:%d min:%d \n", max,min); if(max+min > target*2) return min; return max; } #define TEST(p,q,r) printf("input%d output:%d \n", r, threeSumClosest(p,q,r)); int main(int argc, char **argv) { #if 0 int A[] = {43,75,-90,47,-49,72,17,-31,-68,-22,-21,-30,65,88,-75,23,97,-61,53,87,-3,33,20,51,-79,43,80,-9,34,-89,-7,93,43,55,-94,29,-32,-49,25,72,-6,35,53,63,6,-62,-96,-83,-73,66,-11,96,-90,-27,78,-51,79,35,-63,85,-82,-15,100,-82,1,-4,-41,-21,11,12,12,72,-82,-22,37,47,-18,61,60,55,22,-6,26,-60,-42,-92,68,45,-1,-26,5,-56,-1,73,92,-55,-20,-43,-56,-15,7,52,35,-90,63,41,-55,-58,46,-84,-92,17,-66,-23,96,-19,-44,77,67,-47,-48,99,51,-25,19,0,-13,-88,-10,-67,14,7,89,-69,-83,86,-70,-66,-38,-50,66,0,-67,-91,-65,83,42,70,-6,52,-21,-86,-87,-44,8,49,-76,86,-3,87,-32,81,-58,37,-55,19,-26,66,-89,-70,-69,37,0,19,-65,38,7,3,1,-96,96,-65,-52,66,5,-3,-87,-16,-96,57,-74,91,46,-79,0,-69,55,49,-96,80,83,73,56,22,58,-44,-40,-45,95,99,-97,-22,-33,-92,-51,62,20,70,90}; #endif int A[] = {1,2,4,8,16,32,64,128}; TEST(A, sizeof(A)/sizeof(int), 82); return 0; }
// To allow debuging... #ifndef _FXLIB_DEBUGING_H #define _FXLIB_DEBUGING_H typedef char FONTCHARACTER; #endif // _FXLIB_DEBUGING_H
/* Stockfish, a UCI chess playing engine derived from Glaurung 2.1 Copyright (C) 2004-2008 Tord Romstad (Glaurung author) Copyright (C) 2008-2014 Marco Costalba, Joona Kiiski, Tord Romstad Stockfish 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. Stockfish 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 UCIOPTION_H_INCLUDED #define UCIOPTION_H_INCLUDED #include <map> #include <string> namespace UCI { class Option; /// Custom comparator because UCI options should be case insensitive struct CaseInsensitiveLess { bool operator() (const std::string&, const std::string&) const; }; /// Our options container is actually a std::map typedef std::map<std::string, Option, CaseInsensitiveLess> OptionsMap; /// Option class implements an option as defined by UCI protocol class Option { typedef void (*OnChange)(const Option&); public: Option(OnChange = NULL); Option(bool v, OnChange = NULL); Option(const char* v, OnChange = NULL); Option(int v, int min, int max, OnChange = NULL); Option& operator=(const std::string& v); void operator<<(const Option& o); operator int() const; operator std::string() const; private: friend std::ostream& operator<<(std::ostream&, const OptionsMap&); std::string defaultValue, currentValue, type; int min, max; size_t idx; OnChange on_change; }; void init(OptionsMap&); void loop(int argc, char* argv[]); void loopi(const std::vector<std::string> &fransu); } // namespace UCI extern UCI::OptionsMap Options; #endif // #ifndef UCIOPTION_H_INCLUDED
/*============================================================================= | Copyright 2012 Matthew D. Steele <mdsteele@alum.mit.edu> | | | | This file is part of Azimuth. | | | | Azimuth 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. | | | | Azimuth 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 Azimuth. If not, see <http://www.gnu.org/licenses/>. | =============================================================================*/ #include "azimuth/view/baddie_spiner.h" #include <assert.h> #include <math.h> #include <SDL_opengl.h> #include "azimuth/state/baddie.h" #include "azimuth/util/clock.h" #include "azimuth/util/color.h" #include "azimuth/view/util.h" /*===========================================================================*/ static void draw_spine(float flare, float frozen) { glBegin(GL_TRIANGLE_STRIP); { glColor4f(0.5f * flare, 0.3, 0, 0); glVertex2f(-3, 3); glColor3f(0.6f + 0.4f * flare, 0.7, 0.6); glVertex2f(5, 0); glColor3f(0.6f + 0.4f * flare, 0.7, frozen); glVertex2f(-5, 0); glColor4f(0, 0.3, 0, 0); glVertex2f(-3, -3); } glEnd(); } static void draw_spiner( az_color_t inner, az_color_t outer, const az_baddie_t *baddie, float flare, float frozen, az_clock_t clock) { if (baddie->cooldown < 1.0) { for (int i = 0; i < 360; i += 45) { glPushMatrix(); { glRotated(i, 0, 0, 1); glTranslated(18.0 - 8.0 * baddie->cooldown, 0, 0); draw_spine(0, frozen); } glPopMatrix(); } } glBegin(GL_TRIANGLE_FAN); { az_gl_color(inner); glVertex2f(-2, 2); az_gl_color(outer); for (int i = 0; i <= 360; i += 15) { double radius = baddie->data->main_body.bounding_radius + 0.2 * az_clock_zigzag(10, 3, clock) - 1.0; if (i % 45 == 0) radius -= 2.0; glVertex2d(radius * cos(AZ_DEG2RAD(i)), radius * sin(AZ_DEG2RAD(i))); } } glEnd(); for (int i = 0; i < 360; i += 45) { glPushMatrix(); { glRotated(i + 22.5, 0, 0, 1); glTranslated(16 + 0.5 * az_clock_zigzag(6, 5, clock), 0, 0); draw_spine(0, frozen); } glPopMatrix(); } for (int i = 0; i < 360; i += 45) { glPushMatrix(); { glRotated(i + 11.25, 0, 0, 1); glTranslated(8 + 0.5 * az_clock_zigzag(6, 7, clock), 0, 0); draw_spine(0, frozen); } glPopMatrix(); } } static void draw_urchin(const az_baddie_t *baddie, float frozen, az_clock_t clock) { const float flare = baddie->armor_flare; for (int i = 0; i < 18; ++i) { glPushMatrix(); { glRotated(i * 20, 0, 0, 1); glTranslated(7.5 + 0.5 * az_clock_zigzag(6, 3, clock + i * 7), 0, 0); draw_spine(flare, frozen); } glPopMatrix(); } for (int i = 0; i < 9; ++i) { glPushMatrix(); { glRotated(i * 40 + 30, 0, 0, 1); glTranslated(4 + 0.5 * az_clock_zigzag(7, 3, clock - i * 13), 0, 0); draw_spine(flare, frozen); } glPopMatrix(); } } /*===========================================================================*/ void az_draw_bad_spine_mine( const az_baddie_t *baddie, float frozen, az_clock_t clock) { assert(baddie->kind == AZ_BAD_SPINE_MINE); draw_urchin(baddie, frozen, clock); } void az_draw_bad_spiner( const az_baddie_t *baddie, float frozen, az_clock_t clock) { assert(baddie->kind == AZ_BAD_SPINER); const float flare = baddie->armor_flare; draw_spiner(az_color3f(1 - frozen, 1 - 0.5 * flare, frozen), az_color3f(0.4 * flare, 0.3 - 0.3 * flare, 0.4 * frozen), baddie, flare, frozen, clock); } void az_draw_bad_super_spiner( const az_baddie_t *baddie, float frozen, az_clock_t clock) { assert(baddie->kind == AZ_BAD_SUPER_SPINER); const float flare = baddie->armor_flare; draw_spiner(az_color3f(0.5 + 0.5 * flare - 0.5 * frozen, 0.25 + 0.5 * frozen, 1 - 0.75 * flare), az_color3f(0.4 * flare, 0.3 - 0.3 * flare, 0.4 * frozen), baddie, flare, frozen, clock); } void az_draw_bad_urchin( const az_baddie_t *baddie, float frozen, az_clock_t clock) { assert(baddie->kind == AZ_BAD_URCHIN); draw_urchin(baddie, frozen, clock); } /*===========================================================================*/
/* Copyright (C) 2008-2012 Jaroslav Hajek This file is part of Octave. Octave 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. Octave 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 Octave; see the file COPYING. If not, see <http://www.gnu.org/licenses/>. */ #if !defined (octave_tree_cbinop_h) #define octave_tree_cbinop_h 1 #include <string> class tree_walker; class octave_value; class octave_value_list; class octave_lvalue; #include "ov.h" #include "pt-binop.h" #include "symtab.h" // Binary expressions that can be reduced to compound operations class tree_compound_binary_expression : public tree_binary_expression { public: tree_compound_binary_expression (tree_expression *a, tree_expression *b, int l, int c, octave_value::binary_op t, tree_expression *ca, tree_expression *cb, octave_value::compound_binary_op ct) : tree_binary_expression (a, b, l, c, t), op_lhs (ca), op_rhs (cb), etype (ct) { } octave_value::compound_binary_op cop_type (void) const { return etype; } private: tree_expression *op_lhs; tree_expression *op_rhs; octave_value::compound_binary_op etype; // No copying! tree_compound_binary_expression (const tree_compound_binary_expression&); tree_compound_binary_expression& operator = (const tree_compound_binary_expression&); }; // a "virtual constructor" tree_binary_expression * maybe_compound_binary_expression (tree_expression *a, tree_expression *b, int l = -1, int c = -1, octave_value::binary_op t = octave_value::unknown_binary_op); #endif
//Settings.h by Emercoin developers #pragma once #include <QDir> class Settings { public: static QDir configDir(); static QString configPath(); static QDir certDir(); };
/* This file is part of cmpiLinux_FanProvider. * * cmpiLinux_FanProvider 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. * * cmpiLinux_FanProvider 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 cmpiLinux_FanProvider. If not, see * <http://www.gnu.org/licenses/>. */ #ifndef CMPILINUX_FANCOMMON_H_ #define CMPILINUX_FANCOMMON_H_ #include <cmpi/cmpidt.h> #include "Linux_Fan.h" CMPIObjectPath * _makePath_FanCommon( char const *class_name, CMPIBroker const *_broker, CMPIContext const *ctx, CMPIObjectPath const *cop, struct cim_fan *sptr, CMPIStatus *rc); CMPIInstance * _makeInst_FanCommon( char const *class_name, CMPIBroker const *_broker, CMPIContext const *ctx, CMPIObjectPath const *cop, char const **properties, struct cim_fan *sptr, CMPIStatus *rc, CMPIObjectPath **op); #endif /* ----- CMPILINUX_FANCOMMON_H_ ----- */
/* +----------------------------------------------------------------------+ | PHP Version 5 | +----------------------------------------------------------------------+ | Copyright (c) 1997-2016 The PHP Group | +----------------------------------------------------------------------+ | This source file is subject to version 3.01 of the PHP license, | | that is bundled with this package in the file LICENSE, and is | | available through the world-wide-web at the following url: | | http://www.php.net/license/3_01.txt | | If you did not receive a copy of the PHP license and are unable to | | obtain it through the world-wide-web, please send a note to | | license@php.net so we can mail you a copy immediately. | +----------------------------------------------------------------------+ | Authors: Nikolay P. Romanyuk <mag@redcom.ru> | +----------------------------------------------------------------------+ */ /* $Id$ */ #ifndef PHP_BIRDSTEP_H #define PHP_BIRDSTEP_H #if defined(HAVE_BIRDSTEP) && !HAVE_UODBC #define UNIX #include <sql.h> #include <sqlext.h> typedef struct VConn { HDBC hdbc; long index; } VConn; typedef struct { char name[32]; char *value; long vallen; SDWORD valtype; } VResVal; typedef struct Vresult { HSTMT hstmt; VConn *conn; long index; VResVal *values; long numcols; int fetched; } Vresult; typedef struct { long num_links; long max_links; int le_link,le_result; } birdstep_module; extern zend_module_entry birdstep_module_entry; #define birdstep_module_ptr &birdstep_module_entry /* birdstep.c functions */ PHP_MINIT_FUNCTION(birdstep); PHP_RINIT_FUNCTION(birdstep); PHP_MINFO_FUNCTION(birdstep); PHP_MSHUTDOWN_FUNCTION(birdstep); PHP_FUNCTION(birdstep_connect); PHP_FUNCTION(birdstep_close); PHP_FUNCTION(birdstep_exec); PHP_FUNCTION(birdstep_fetch); PHP_FUNCTION(birdstep_result); PHP_FUNCTION(birdstep_freeresult); PHP_FUNCTION(birdstep_autocommit); PHP_FUNCTION(birdstep_off_autocommit); PHP_FUNCTION(birdstep_commit); PHP_FUNCTION(birdstep_rollback); PHP_FUNCTION(birdstep_fieldnum); PHP_FUNCTION(birdstep_fieldname); extern birdstep_module php_birdstep_module; #else #define birdstep_module_ptr NULL #endif /* HAVE_BIRDSTEP */ #endif /* PHP_BIRDSTEP_H */ /* * Local variables: * tab-width: 4 * c-basic-offset: 4 * End: */
/* * Copyright (C) 2008 Stephen F. Booth <me@sbooth.org> * All Rights Reserved */ #import <Cocoa/Cocoa.h> #import <AudioToolbox/AudioFile.h> // ======================================== // A class representing a WAVE file containing CD-DA audio // that presents read/write access to that audio as CD-DA sectors // An object of this class should not be created directly using alloc/init, // but using the provided class methods // ======================================== @interface ExtractedAudioFile : NSObject { @private NSURL *_URL; AudioFileID _file; NSString *_cachedMD5; NSString *_cachedSHA1; } // ======================================== // Creation // ======================================== + (id) createFileAtURL:(NSURL *)URL error:(NSError **)error; + (id) openFileForReadingAtURL:(NSURL *)URL error:(NSError **)error; + (id) openFileForReadingAndWritingAtURL:(NSURL *)URL error:(NSError **)error; // ======================================== // Properties // ======================================== @property (readonly, copy) NSURL * URL; @property (readonly) NSString * MD5; @property (readonly) NSString * SHA1; @property (readonly) NSUInteger sectorsInFile; - (BOOL) closeFile; // ======================================== // Reading // ======================================== - (NSData *) audioDataForSector:(NSUInteger)sector error:(NSError **)error; - (NSData *) audioDataForSectors:(NSRange)sectors error:(NSError **)error; - (NSUInteger) readAudioForSectors:(NSRange)sectors buffer:(void *)buffer error:(NSError **)error; // ======================================== // Writing // ======================================== - (BOOL) setAudioData:(NSData *)data forSector:(NSUInteger)sector error:(NSError **)error; - (BOOL) setAudioData:(NSData *)data forSectors:(NSRange)sectors error:(NSError **)error; - (NSUInteger) setAudio:(const void *)buffer forSectors:(NSRange)sectors error:(NSError **)error; @end
/* Copyright 2010-2012 Mark Boots, David Chevrier, and Darren Hunter. Copyright 2013-2014 David Chevrier and Darren Hunter. This file is part of the Acquaman Data Acquisition and Management framework ("Acquaman"). Acquaman 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. Acquaman 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 Acquaman. If not, see <http://www.gnu.org/licenses/>. */ #ifndef CLSPGTDETECTORINFO_H #define CLSPGTDETECTORINFO_H #include "AMSpectralOutputDetectorInfo.h" #include "util/AMRange.h" class CLSPGTDetectorInfo : public AMSpectralOutputDetectorInfo { Q_OBJECT Q_PROPERTY(double hvSetpoint READ hvSetpoint WRITE setHVSetpoint) Q_PROPERTY(double hvSetpointRangeMin READ hvSetpointRangeMin WRITE setHVSetpointRangeMin) Q_PROPERTY(double hvSetpointRangeMax READ hvSetpointRangeMax WRITE setHVSetpointRangeMax) Q_CLASSINFO("AMDbObject_Attributes", "description=PGT Detector") public: virtual ~CLSPGTDetectorInfo(); Q_INVOKABLE CLSPGTDetectorInfo(const QString& name = "pgt", const QString& description = "SDD", QObject *parent = 0); CLSPGTDetectorInfo(const CLSPGTDetectorInfo &original); /// Creates a new info pointer from this one, caller is responsible for memory virtual AMOldDetectorInfo* toNewInfo() const; CLSPGTDetectorInfo& operator=(const CLSPGTDetectorInfo& other); /// Operational setpoint for High Voltage (HV) double hvSetpoint() const; double hvSetpointRangeMin() const; double hvSetpointRangeMax() const; AMRange hvSetpointRange() const; QDebug qDebugPrint(QDebug &d) const; // Dimensionality and size: //////////////////////////////////// // Using the base class (AMSpectralOutputDetectorInfo) for default rank(), size(), and axes(). virtual bool hasDetails() const; public slots: void setHVSetpoint(double hvSetpoint); void setHVSetpointRangeMin(double min); void setHVSetpointRangeMax(double max); void setHVSetpointRange(const AMRange &range); protected: double hvSetpointRangeMin_, hvSetpointRangeMax_, hvSetpoint_; }; #endif // CLSPGTDETECTORINFO_H
/* * Copyright (C) 2008, 2009, 2010 The Collaborative Software Foundation. * * This file is part of FeedHandlers (FH). * * FH 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. * * FH 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 FH. If not, see <http://www.gnu.org/licenses/>. */ #ifndef __FH_CONIFG_H__ #define __FH_CONIFG_H__ #include "fh_errors.h" // maximum length of a property string #define MAX_PROPERTY_LENGTH 255 #define MAX_PROPERTY_DEPTH 255 /** * Configuration node * * One node of configuration. A node can have any number of child nodes or values but cannot * have both children and values. */ typedef struct fh_cfg_node { char name[MAX_PROPERTY_LENGTH]; struct fh_cfg_node **children; struct fh_cfg_node *parent; char **values; int num_children; int num_values; } fh_cfg_node_t; /* * Function definitions for YACC/LEX functions */ int yyparse(); /* * Configuration API */ fh_cfg_node_t *fh_cfg_load(const char *); void fh_cfg_dump(fh_cfg_node_t *); void fh_cfg_free(fh_cfg_node_t *); const fh_cfg_node_t *fh_cfg_get_node(const fh_cfg_node_t *, const char *); const char *fh_cfg_get_string(const fh_cfg_node_t *, const char *); const char **fh_cfg_get_array(const fh_cfg_node_t *, const char *); /** * @brief Set a yes/no field value * * @param config configuration node where the property resides * @param property the property we are looking for * @param value where we are storing the result * @return status code indicating success or failure */ FH_STATUS fh_cfg_set_yesno(const fh_cfg_node_t *config, const char *property, uint8_t *value); /** * @brief Set a uint32_t field value * * @param config configuration node where the property resides * @param property the property we are looking for * @param value where we are storing the result * @return status code indicating success or failure */ FH_STATUS fh_cfg_set_uint32(const fh_cfg_node_t *config, const char *property, uint32_t *value); /** * @brief Set a uint16_t field value * * @param config configuration node where the property resides * @param property the property we are looking for * @param value where we are storing the result * @return status code indicating success or failure */ FH_STATUS fh_cfg_set_uint16(const fh_cfg_node_t *config, const char *property, uint16_t *value); /** * @brief Set an int field value * * @param config configuration node where the property resides * @param property the property we are looking for * @param value where we are storing the result */ FH_STATUS fh_cfg_set_int(const fh_cfg_node_t *config, const char *property, int *value); #endif /* __FH_CONIFG_H__ */
/*- * Copyright (c) 1990 The Regents of the University of California. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. All advertising materials mentioning features or use of this software * must display the following acknowledgement: * This product includes software developed by the University of * California, Berkeley and its contributors. * 4. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * * @(#)clist.h 7.3 (Berkeley) 2/15/91 */ struct cblock { struct cblock *c_next; /* next cblock in queue */ char c_quote[CBQSIZE]; /* quoted characters */ char c_info[CBSIZE]; /* characters */ }; #ifdef KERNEL struct cblock *cfree, *cfreelist; int cfreecount, nclist; #endif
// // nixieclock-firmware - Nixie Clock Main Firmware Program // Copyright (C) 2015 Joe Ciccone // // 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 __STRING_H_ #define __STRING_H_ #include <types.h> extern void *memcpy(void *d, void *s, size_t n); extern void *memset(void *s, int c, size_t n); extern char *strcat(char *d, const char *s); extern char *strchr(const char *s, char c); extern char *strchrnul(const char *s, char c); extern int32_t strcmp(const char *s1, const char *s2); extern size_t strlen(const char *s); extern char *strncat(char *d, const char *s, size_t n); extern int32_t strncmp(const char *s1, const char *s2, size_t n); extern char *strrchr(const char *s, char c); #endif // __STRING_H_
#ifndef CONEXIONRED_H #define CONEXIONRED_H #define OTHELLO_ONLINE_DEFAULT_PORT 20303 class ConexionRed{ public: ConexionRed(const char *host, short puerto); ConexionRed(); // inicializar como servidor ~ConexionRed(); bool start(const char *localName); const char *getRemoteName(); int hacerMovimiento(char movimiento); int recibirMovimiento(); bool isOpen(); bool shouldRetry(); bool isServer(); void close(); private: bool startAsServer(const char *localName); bool startAsClient(const char *localName); int startListening(); int establecerNoBloqueante(int fd); int clientSocket; char *host; short puerto; bool _isOpen; bool _shouldRetry; char remoteName[256]; int serverSocket; int prevFlags; }; #endif // CONEXIONRED_H
#ifndef SYMBOLIX_DRIVER_HH #define SYMBOLIX_DRIVER_HH #include <string> #include <map> #include "symbolix-parser.hh" #include "../AST/AST.h" #define YY_DECL \ yy::symbolix_parser::token_type \ yylex(yy::symbolix_parser::semantic_type* yylval, \ yy::symbolix_parser::location_type* yylloc, \ symbolix_driver& driver) // ... and declare it for the parser's sake. YY_DECL; using AST::Expression::Expression; // Conducting the whole scanning and parsing. class symbolix_driver { public: // Whether scanner traces should be generated. bool trace_scanning; // Whether parser traces should be generated. bool trace_parsing; // parsed abstract syntax tree of the formula. Expression * parsedAST; std::string str; void * str_buffer; symbolix_driver(); virtual ~symbolix_driver(); // Handling the scanner. void scan_begin(); void scan_end(); // Run the parser on file F. // Return 0 on success. int parse(const std::string formulaStr); // Error handling. void error(const yy::location& l, const std::string& m); void error(const std::string& m); }; #endif // ! SYMBOLIX_DRIVER_HH
#pragma once /* where T is std140-conforming, and agrees with the shader. */ template<typename T> struct shader_params { T val; GLuint bo; shader_params() : bo(0) { glGenBuffers(1, &bo); glBindBuffer(GL_UNIFORM_BUFFER, bo); glBufferData(GL_UNIFORM_BUFFER, sizeof(T), NULL, GL_DYNAMIC_DRAW); } ~shader_params() { glDeleteBuffers(1, &bo); } void upload() { /* bind to nonindexed binding point */ glBindBuffer(GL_UNIFORM_BUFFER, bo); glBufferSubData(GL_UNIFORM_BUFFER, 0, sizeof(T), &val); } void bind(GLuint index) { /* bind to proper index of indexed binding point, for use */ glBindBufferBase(GL_UNIFORM_BUFFER, index, bo); } }; struct per_camera_params { glm::mat4 view_proj_matrix; glm::mat4 inv_centered_view_proj_matrix; }; struct per_object_params { glm::mat4 world_matrix; }; extern shader_params<per_camera_params> *per_camera; extern shader_params<per_object_params> *per_object;
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Ghost, a micro-kernel based operating system for the x86 architecture * * Copyright (C) 2015, Max Schlüssel <lokoxe@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/>. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ #include "unistd.h" #include "eva/kernel.h" #include "errno.h" /** * TODO */ int symlink(const char* path1, const char* path2) { klog("warning: symlink(%s, %s) is not implemented", path1, path2); return -1; }
/* Test of splitting a 'long double' into fraction and mantissa. Copyright (C) 2007-2019 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; 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/>. */ /* Written by Bruno Haible <bruno@clisp.org>, 2007. */ #include <config.h> #include "printf-frexpl.h" #include <float.h> #include "fpucw.h" #include "macros.h" /* On MIPS IRIX machines, LDBL_MIN_EXP is -1021, but the smallest reliable exponent for 'long double' is -964. Similarly, on PowerPC machines, LDBL_MIN_EXP is -1021, but the smallest reliable exponent for 'long double' is -968. For exponents below that, the precision may be truncated to the precision used for 'double'. */ #ifdef __sgi # define MIN_NORMAL_EXP (LDBL_MIN_EXP + 57) # define MIN_SUBNORMAL_EXP MIN_NORMAL_EXP #elif defined __ppc || defined __ppc__ || defined __powerpc || defined __powerpc__ # define MIN_NORMAL_EXP (LDBL_MIN_EXP + 53) # define MIN_SUBNORMAL_EXP MIN_NORMAL_EXP #else # define MIN_NORMAL_EXP LDBL_MIN_EXP # define MIN_SUBNORMAL_EXP (LDBL_MIN_EXP - 100) #endif static long double my_ldexp (long double x, int d) { for (; d > 0; d--) x *= 2.0L; for (; d < 0; d++) x *= 0.5L; return x; } int main () { int i; long double x; DECL_LONG_DOUBLE_ROUNDING BEGIN_LONG_DOUBLE_ROUNDING (); for (i = 1, x = 1.0L; i <= LDBL_MAX_EXP; i++, x *= 2.0L) { int exp = -9999; long double mantissa = printf_frexpl (x, &exp); ASSERT (exp == i - 1); ASSERT (mantissa == 1.0L); } for (i = 1, x = 1.0L; i >= MIN_NORMAL_EXP; i--, x *= 0.5L) { int exp = -9999; long double mantissa = printf_frexpl (x, &exp); ASSERT (exp == i - 1); ASSERT (mantissa == 1.0L); } for (; i >= MIN_SUBNORMAL_EXP && x > 0.0L; i--, x *= 0.5L) { int exp = -9999; long double mantissa = printf_frexpl (x, &exp); ASSERT (exp == LDBL_MIN_EXP - 1); ASSERT (mantissa == my_ldexp (1.0L, i - LDBL_MIN_EXP)); } for (i = 1, x = 1.01L; i <= LDBL_MAX_EXP; i++, x *= 2.0L) { int exp = -9999; long double mantissa = printf_frexpl (x, &exp); ASSERT (exp == i - 1); ASSERT (mantissa == 1.01L); } for (i = 1, x = 1.01L; i >= MIN_NORMAL_EXP; i--, x *= 0.5L) { int exp = -9999; long double mantissa = printf_frexpl (x, &exp); ASSERT (exp == i - 1); ASSERT (mantissa == 1.01L); } for (; i >= MIN_SUBNORMAL_EXP && x > 0.0L; i--, x *= 0.5L) { int exp = -9999; long double mantissa = printf_frexpl (x, &exp); ASSERT (exp == LDBL_MIN_EXP - 1); ASSERT (mantissa >= my_ldexp (1.0L, i - LDBL_MIN_EXP)); ASSERT (mantissa <= my_ldexp (2.0L, i - LDBL_MIN_EXP)); ASSERT (mantissa == my_ldexp (x, - exp)); } for (i = 1, x = 1.73205L; i <= LDBL_MAX_EXP; i++, x *= 2.0L) { int exp = -9999; long double mantissa = printf_frexpl (x, &exp); ASSERT (exp == i - 1); ASSERT (mantissa == 1.73205L); } for (i = 1, x = 1.73205L; i >= MIN_NORMAL_EXP; i--, x *= 0.5L) { int exp = -9999; long double mantissa = printf_frexpl (x, &exp); ASSERT (exp == i - 1); ASSERT (mantissa == 1.73205L); } for (; i >= MIN_SUBNORMAL_EXP && x > 0.0L; i--, x *= 0.5L) { int exp = -9999; long double mantissa = printf_frexpl (x, &exp); ASSERT (exp == LDBL_MIN_EXP - 1); ASSERT (mantissa >= my_ldexp (1.0L, i - LDBL_MIN_EXP)); ASSERT (mantissa <= my_ldexp (2.0L, i - LDBL_MIN_EXP)); ASSERT (mantissa == my_ldexp (x, - exp)); } return 0; }
/* Copyright (C) 2003, 2004, 2005, 2008, 2011 Rocky Bernstein <rocky@gnu.org> Copyright (C) 2001 Herbert Valerio Riedel <hvr@gnu.org> 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/>. */ #ifdef HAVE_CONFIG_H # include "config.h" # define __CDIO_CONFIG_H__ 1 #endif #include <cdio/cdio.h> #include "cdio_private.h" /* Must match discmode enumeration */ const char *discmode2str[] = { "CD-DA", "CD-DATA (Mode 1)", "CD DATA (Mode 2)", "CD-ROM Mixed", "DVD-ROM", "DVD-RAM", "DVD-R", "DVD-RW", "HD DVD ROM", "HD_DVD RAM", "HD DVD-R", "DVD+R", "DVD+RW", "DVD+RW DL", "DVD+R DL", "Unknown/unclassified DVD", "No information", "Error in getting information", "CD-i" }; /*! Get cdtext information for a CdIo object . @param obj the CD object that may contain CD-TEXT information. @return the CD-TEXT object or NULL if obj is NULL or CD-TEXT information does not exist. */ cdtext_t * cdio_get_cdtext (CdIo *obj) { if (obj == NULL) return NULL; if (NULL != obj->op.get_cdtext) { return obj->op.get_cdtext (obj->env); } else { return NULL; } } /*! Get binary cdtext information for a CdIo object . @param obj the CD object that may contain CD-TEXT information. @return pointer to allocated memory area holding the raw CD-TEXT or NULL if obj is NULL or CD-TEXT does not exist. free() when done. */ uint8_t * cdio_get_cdtext_raw (CdIo *obj) { if (obj == NULL) return NULL; if (NULL != obj->op.get_cdtext_raw) { return obj->op.get_cdtext_raw (obj->env); } else { return NULL; } } /*! Get the size of the CD in logical block address (LBA) units. @param p_cdio the CD object queried @return the lsn. On error 0 or CDIO_INVALD_LSN. */ lsn_t cdio_get_disc_last_lsn(const CdIo_t *p_cdio) { if (!p_cdio) return CDIO_INVALID_LSN; return p_cdio->op.get_disc_last_lsn (p_cdio->env); } /*! Get medium associated with cd_obj. */ discmode_t cdio_get_discmode (CdIo_t *cd_obj) { if (!cd_obj) return CDIO_DISC_MODE_ERROR; if (cd_obj->op.get_discmode) { return cd_obj->op.get_discmode (cd_obj->env); } else { return CDIO_DISC_MODE_NO_INFO; } } /*! Return a string containing the name of the driver in use. if CdIo is NULL (we haven't initialized a specific device driver), then return NULL. */ char * cdio_get_mcn (const CdIo_t *p_cdio) { if (p_cdio->op.get_mcn) { return p_cdio->op.get_mcn (p_cdio->env); } else { return NULL; } } bool cdio_is_discmode_cdrom(discmode_t discmode) { switch (discmode) { case CDIO_DISC_MODE_CD_DA: case CDIO_DISC_MODE_CD_DATA: case CDIO_DISC_MODE_CD_XA: case CDIO_DISC_MODE_CD_MIXED: case CDIO_DISC_MODE_NO_INFO: return true; default: return false; } } bool cdio_is_discmode_dvd(discmode_t discmode) { switch (discmode) { case CDIO_DISC_MODE_DVD_ROM: case CDIO_DISC_MODE_DVD_RAM: case CDIO_DISC_MODE_DVD_R: case CDIO_DISC_MODE_DVD_RW: case CDIO_DISC_MODE_DVD_PR: case CDIO_DISC_MODE_DVD_PRW: case CDIO_DISC_MODE_DVD_OTHER: return true; default: return false; } }
/* * eina/adb/eina-adb-upgrade.c * * Copyright (C) 2004-2011 Eina * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #include "eina-adb.h" #include <glib/gi18n.h> #include <gel/gel.h> /** * eina_adb_upgrade_schema: * @self: An #EinaAdb * @schema: Schema name * @callbacks: (array zero-terminated=1) : set of callbacks * @error: Location for errors * * Does magic * * Returns: %TRUE on successful, %FALSE otherwise */ gboolean eina_adb_upgrade_schema(EinaAdb *self, const gchar *schema, EinaAdbFunc callbacks[], GError **error) { g_return_val_if_fail(EINA_IS_ADB(self), FALSE); gint schema_version = eina_adb_schema_get_version(self, schema); // g_warning("Current '%s' schema: %d", schema, schema_version); gint i; for (i = schema_version + 1; callbacks[i] != NULL; i++) { g_warning("Upgrade ADB from DB schema #%d to #%d. Using callbacks from callbacks[%d]", i, i+1, i); if (!callbacks[i](self, error)) break; eina_adb_schema_set_version(self, schema, i); } return (callbacks[i] == NULL); }
/* -*- mode: C; c-file-style: "bsd"; tab-width: 4 -*- */ /* jstroke.h - System-independent functions/defines * JStroke 1.x - Japanese Kanji handwriting recognition technology demo. * Copyright (C) 1997 Robert E. Wells * http://wellscs.com/pilot * mailto:robert@wellscs.com * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program (gpl.html); if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * * Derived from prior work by Todd David Rudick on JavaDict and StrokeDic. * Makes use of KANJIDIC data from Jim Breen of Monash University. * Further credit details available at http://wellscs.com/pilot * See readme.txt, ChangeLog, and gpl.html for more information. * * CONDITIONAL COMPILATION FLAGS: * -DFOR_PILOT_GCC -- Robert Wells uses this for code that is specific to the * US Robotics/3COM Pilot GCC development environment. * Contact robert@wellscs.com, http://wellscs.com/pilot. * * -DFOR_PILOT_COMPAT -- Owen Taylor uses this for his perl front-ended * application. He puts this code in a subdirectory under the * rest of his code. Contact owt1@cornell.edu for more * information, or visit his web site at * http://www.msc.cornell.edu/~otaylor/. 9/1997. * * -------------------------------------------------------------------------*/ #ifndef __JSTROKE_H__ #define __JSTROKE_H__ #include <gtk/gtk.h> #ifdef FOR_PILOT_COMPAT #include "pilotcompat.h" #endif /*FOR_PILOT_COMPAT*/ #ifdef FOR_PILOT_GCC #pragma pack(2) // $$$ Probably not needed anymore... -rwells, 19970921. #include <Common.h> #include <System/SysAll.h> #include <UI/UIAll.h> #endif /*FOR_PILOT_GCC*/ /* Limit list to what we can afford (5), or what will fit on screen at most. * #define diMaxListCount (diScreenHeight/diFontLineHeight) */ #define diMaxListCount 5 #define diMaxXyPairs 256 /* Max pairs in stroke... */ /* ----- List Memory --------------------------------------------------------- * The idea here is to have a single nonmovable chunk of memory which contains * all the structures and cross-pointers needed to support the item list for * passing to LstSetListChoices, and related List control functions. We * allocate and free it as a single chunk of application memory. */ typedef struct { UInt m_argc; char** m_argv; } ListMem; /* ----- RawStroke ---------------------------------------------------------*/ typedef struct { UInt m_len; Byte m_x[diMaxXyPairs]; Byte m_y[diMaxXyPairs]; } RawStroke; /* ----- ScoreItem ---------------------------------------------------------*/ typedef struct ScoreItemStruct *ScoreItemPtr; typedef struct ScoreItemStruct { ULong m_iScore; CharPtr m_cp; } ScoreItem; /* ----- StrokeScorer------------------------------------------------------ */ typedef struct StrokeScorer *StrokeScorerPtr; typedef struct StrokeScorerStruct { CharPtr m_cpStrokeDic; RawStroke* m_pRawStrokes; UInt m_iStrokeCnt; ScoreItem* m_pScores; UInt m_iScoreLen; CharPtr m_cpPath; } StrokeScorer; ListMem* AppEmptyList(); Long Angle32(Long xdif, Long ydif); void ErrBox(CharPtr msg); void ErrBox2(CharPtr msg1, CharPtr msg2); /* Create a StrokeScorer object. (Returns NULL if can't get memory) */ StrokeScorer *StrokeScorerCreate (CharPtr cpStrokeDic, RawStroke *rsp, UInt iStrokeCnt); /* Destroy a StrokeScorer object */ void StrokeScorerDestroy (StrokeScorer *pScorer); /* Process some database entries (maximum iMaxCnt, -1 for all). * Returns 0 when none remaining (should eventually return count remaining * to facilitate a progressbar. */ Long StrokeScorerProcess (StrokeScorer *pScorer, Long iMaxCnt); /* Return best diMaxListCount candidates processed so far */ ListMem* StrokeScorerTopPicks (StrokeScorer *pScorer); #endif /*__JSTROKE_H__*/ /* ----- End of jstroke.h ------------------------------------------------- */
// // CommentViewController.h // YH-IOS // // Created by lijunjie on 15/12/11. // Copyright © 2015年 com.intfocus. All rights reserved. // #import "BaseViewController.h" #import "BaseWebViewController.h" @interface CommentViewController : BaseWebViewController @property (strong, nonatomic) NSString *bannerName; @property (assign, nonatomic) CommentObjectType commentObjectType; @property (strong, nonatomic) NSNumber *objectID; @end
#include <unistd.h> #include <sys/syscall.h> #include <sys/types.h> #include "syscall.h" #include "auditsec_info.h" long auditsec_register(int state) { return syscall(__NR_sys_auditsec_reg, state); } long auditsec_question(struct auditsec_info * user_as_i) { return syscall(__NR_sys_auditsec_question, user_as_i); } long auditsec_answer(int answer) { return syscall(__NR_sys_auditsec_answer, answer); }
/* ChibiOS - Copyright (C) 2006..2016 Giovanni Di Sirio. This file is part of ChibiOS. ChibiOS 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. ChibiOS 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 chstats.h * @brief Statistics module macros and structures. * * @addtogroup statistics * @{ */ #ifndef _CHSTATS_H_ #define _CHSTATS_H_ #if (CH_DBG_STATISTICS == TRUE) || defined(__DOXYGEN__) /*===========================================================================*/ /* Module constants. */ /*===========================================================================*/ /*===========================================================================*/ /* Module pre-compile time settings. */ /*===========================================================================*/ #if CH_CFG_USE_TM == FALSE #error "CH_DBG_STATISTICS requires CH_CFG_USE_TM" #endif /*===========================================================================*/ /* Derived constants and error checks. */ /*===========================================================================*/ /*===========================================================================*/ /* Module data structures and types. */ /*===========================================================================*/ /** * @brief Type of a kernel statistics structure. */ typedef struct { ucnt_t n_irq; /**< @brief Number of IRQs. */ ucnt_t n_ctxswc; /**< @brief Number of context switches. */ time_measurement_t m_crit_thd; /**< @brief Measurement of threads critical zones duration. */ time_measurement_t m_crit_isr; /**< @brief Measurement of ISRs critical zones duration. */ } kernel_stats_t; /*===========================================================================*/ /* Module macros. */ /*===========================================================================*/ /*===========================================================================*/ /* External declarations. */ /*===========================================================================*/ #ifdef __cplusplus extern "C" { #endif void _stats_init(void); void _stats_increase_irq(void); void _stats_ctxswc(thread_t *ntp, thread_t *otp); void _stats_start_measure_crit_thd(void); void _stats_stop_measure_crit_thd(void); void _stats_start_measure_crit_isr(void); void _stats_stop_measure_crit_isr(void); #ifdef __cplusplus } #endif /*===========================================================================*/ /* Module inline functions. */ /*===========================================================================*/ #else /* CH_DBG_STATISTICS == FALSE */ /* Stub functions for when the statistics module is disabled. */ #define _stats_increase_irq() #define _stats_ctxswc(old, new) #define _stats_start_measure_crit_thd() #define _stats_stop_measure_crit_thd() #define _stats_start_measure_crit_isr() #define _stats_stop_measure_crit_isr() #endif /* CH_DBG_STATISTICS == FALSE */ #endif /* _CHSTATS_H_ */ /** @} */
// This file was generated based on /usr/local/share/uno/Packages/Fuse.Elements/1.3.1/BoxSizing.uno. // WARNING: Changes might be lost if you edit this file directly. #pragma once #include <Uno.Int.h> namespace g{ namespace Fuse{ namespace Elements{ // protected enum BoxSizing.ConstraintFlags :165 uEnumType* BoxSizing__ConstraintFlags_typeof(); }}} // ::g::Fuse::Elements
// // GameScene.h // FlapFlap #import <SpriteKit/SpriteKit.h> #import <AVFoundation/AVFoundation.h> @interface GameScene : SKScene <SKPhysicsContactDelegate> @end
/* * Copyright 2008-2013 NVIDIA Corporation * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #pragma once #include <hydra/detail/external/hydra_thrust/detail/config.h> #include <hydra/detail/external/hydra_thrust/iterator/iterator_traits.h> #include <hydra/detail/external/hydra_thrust/detail/function.h> #include <hydra/detail/external/hydra_thrust/system/detail/sequential/copy_backward.h> namespace hydra_thrust { namespace system { namespace detail { namespace sequential { __hydra_thrust_exec_check_disable__ template<typename RandomAccessIterator, typename StrictWeakOrdering> __host__ __device__ void insertion_sort(RandomAccessIterator first, RandomAccessIterator last, StrictWeakOrdering comp) { typedef typename hydra_thrust::iterator_value<RandomAccessIterator>::type value_type; if(first == last) return; // wrap comp hydra_thrust::detail::wrapped_function< StrictWeakOrdering, bool > wrapped_comp(comp); for(RandomAccessIterator i = first + 1; i != last; ++i) { value_type tmp = *i; if(wrapped_comp(tmp, *first)) { // tmp is the smallest value encountered so far sequential::copy_backward(first, i, i + 1); *first = tmp; } else { // tmp is not the smallest value, can avoid checking for j == first RandomAccessIterator j = i; RandomAccessIterator k = i - 1; while(wrapped_comp(tmp, *k)) { *j = *k; j = k; --k; } *j = tmp; } } } __hydra_thrust_exec_check_disable__ template<typename RandomAccessIterator1, typename RandomAccessIterator2, typename StrictWeakOrdering> __host__ __device__ void insertion_sort_by_key(RandomAccessIterator1 first1, RandomAccessIterator1 last1, RandomAccessIterator2 first2, StrictWeakOrdering comp) { typedef typename hydra_thrust::iterator_value<RandomAccessIterator1>::type value_type1; typedef typename hydra_thrust::iterator_value<RandomAccessIterator2>::type value_type2; if(first1 == last1) return; // wrap comp hydra_thrust::detail::wrapped_function< StrictWeakOrdering, bool > wrapped_comp(comp); RandomAccessIterator1 i1 = first1 + 1; RandomAccessIterator2 i2 = first2 + 1; for(; i1 != last1; ++i1, ++i2) { value_type1 tmp1 = *i1; value_type2 tmp2 = *i2; if(wrapped_comp(tmp1, *first1)) { // tmp is the smallest value encountered so far sequential::copy_backward(first1, i1, i1 + 1); sequential::copy_backward(first2, i2, i2 + 1); *first1 = tmp1; *first2 = tmp2; } else { // tmp is not the smallest value, can avoid checking for j == first RandomAccessIterator1 j1 = i1; RandomAccessIterator1 k1 = i1 - 1; RandomAccessIterator2 j2 = i2; RandomAccessIterator2 k2 = i2 - 1; while(wrapped_comp(tmp1, *k1)) { *j1 = *k1; *j2 = *k2; j1 = k1; j2 = k2; --k1; --k2; } *j1 = tmp1; *j2 = tmp2; } } } } // end namespace sequential } // end namespace detail } // end namespace system } // end namespace hydra_thrust
// vec2d.h #ifndef _JUDE_S2_VEC2D_H #define _JUDE_S2_VEC2D_H #include <math.h> #include "base/jdatastream.h" #include "base/jtextstream.h" #include "base/jtypes.h" namespace jude { namespace S2 { using namespace jude::base; class Vec2D { protected: double xp; double yp; public: /*! \brief Construct without initialisation. Contents are undefined. */ Vec2D() : xp(0), yp(0) { } /*! \brief Construct with supplied x,y values. */ Vec2D(double ix, double iy) : xp(ix), yp(iy) { } /*! \brief Construct by reading x,y values from a JDataStream. */ Vec2D(JDataStream& str) { str >> xp; str >> yp; } Vec2D& operator=(const Vec2D& rhs) { xp = rhs.xp; yp = rhs.yp; return *this; } Vec2D& operator+=(const Vec2D& rhs) { xp += rhs.xp; yp += rhs.yp; return *this; } Vec2D& operator-=(const Vec2D& rhs) { xp -= rhs.xp; yp -= rhs.yp; return *this; } Vec2D& operator*=(double m) { xp *= m; yp *= m; return *this; } double x() const { return xp; } double y() const { return yp; } void setX(double ix) { xp = ix; } void setY(double iy) { yp = iy; } void setTo(double ix, double iy) { xp=ix; yp=iy; } void negate() { xp = -xp; yp = -yp; } void add(const Vec2D& p) { xp += p.xp; yp += p.yp; } void multiply(double v) { xp *= v; yp *= v; } void divide(double v) { xp /= v; yp /= v; } void subtract(const Vec2D& p) { xp -= p.xp; yp -= p.yp; } void addMultiple(const Vec2D& p, double m) { xp += m*p.xp; yp += m*p.yp; } void makeSum(const Vec2D& p0, const Vec2D& p1) { xp = p0.xp + p1.xp; yp = p0.yp + p1.yp; } void makeSubtraction(const Vec2D& p0, const Vec2D& p1) { xp = p0.xp - p1.xp; yp = p0.yp - p1.yp; } void makeSumOfMultiples(const Vec2D& p0, double m0, const Vec2D& p1, double m1) { xp = m0*p0.xp + m1*p1.xp; yp = m0*p0.yp + m1*p1.yp; } void makeMidPoint(const Vec2D& p0, const Vec2D& p1) { xp = (p0.xp+p1.xp) * 0.5; yp = (p0.yp+p1.yp) * 0.5; } static const Vec2D midPoint(const Vec2D& p0, const Vec2D& p1) { return Vec2D((p0.xp+p1.xp) * 0.5, (p0.yp+p1.yp) * 0.5); } static const Vec2D minPoint(const Vec2D& lhs, const Vec2D& rhs) { return Vec2D(min(lhs.x(), rhs.x()), min(lhs.y(), rhs.y())); } static const Vec2D maxPoint(const Vec2D& lhs, const Vec2D& rhs) { return Vec2D(max(lhs.x(), rhs.x()), max(lhs.y(), rhs.y())); } double length() const; double lengthSQ() const; void setLength(double len); void setUnitLength(); double distanceSQ(const Vec2D& p) const; double distance(const Vec2D& p) const; friend inline const Vec2D operator-(const Vec2D& rhs); friend inline const Vec2D operator+(const Vec2D& lhs, const Vec2D& rhs); friend inline const Vec2D operator-(const Vec2D& lhs, const Vec2D& rhs); friend inline const Vec2D operator*(const Vec2D& lhs, const double& rhs); friend inline const Vec2D operator/(const Vec2D& lhs, const double& rhs); friend inline bool operator==(const Vec2D& lhs, const Vec2D& rhs); friend inline bool operator!=(const Vec2D& lhs, const Vec2D& rhs); friend JDataStream& operator>>(JDataStream& str, Vec2D& rhs); friend JDataStream& operator<<(JDataStream& str, const Vec2D& rhs); friend JTextStream& operator<<(JTextStream& str, const Vec2D& rhs); void read(JDataStream& str); void write(JDataStream& str) const; void display(JTextStream& str) const; }; inline const Vec2D operator-(const Vec2D& rhs) { return Vec2D(-rhs.xp, -rhs.yp); } inline const Vec2D operator+(const Vec2D& lhs, const Vec2D& rhs) { return Vec2D(lhs.xp+rhs.xp, lhs.yp+rhs.yp); } inline const Vec2D operator-(const Vec2D& lhs, const Vec2D& rhs) { return Vec2D(lhs.xp-rhs.xp, lhs.yp-rhs.yp); } inline const Vec2D operator*(const Vec2D& lhs, const double& rhs) { return Vec2D(lhs.xp*rhs, lhs.yp*rhs); } inline const Vec2D operator/(const Vec2D& lhs, const double& rhs) { double v = 1 / rhs; return Vec2D(lhs.xp*v, lhs.yp*v); } inline bool operator==(const Vec2D& lhs, const Vec2D& rhs) { return (lhs.xp==rhs.xp && lhs.yp==rhs.yp); } inline bool operator!=(const Vec2D& lhs, const Vec2D& rhs) { return (lhs.xp!=rhs.xp || lhs.yp!=rhs.yp); } inline JDataStream& operator>>(JDataStream& str, Vec2D& rhs) { return str >> rhs.xp >> rhs.yp; } inline JDataStream& operator<<(JDataStream& str, const Vec2D& rhs) { return str << rhs.xp << rhs.yp; } inline JTextStream& operator<<(JTextStream& str, const Vec2D& rhs) { return str << "[ " << rhs.xp << " " << rhs.yp << " ]"; } } } // namespace jude::S2 #endif // _JUDE_S2_VEC2D_H
#ifndef PUNTO_H #define PUNTO_H #include<iostream> #include<string.h> using namespace std ; class Punto{ private: int x, y ; public: Punto(){ x = 0 ; y = 0 ; } Punto(int valorX, int valorY){ x = valorX ; y = valorY ; } inline int getX() const{ return x ; } inline int getY() const{ return y ; } inline void setX(const int valor){ x = valor ; } inline void setY(const int valor){ y = valor ; } }; #endif /* PUNTO_H */
#ifndef __KEYMAPS_H__ #define __KEYMAPS_H__ // Includes: #include <stdint.h> #include "key_action.h" // Macros: #define MAX_KEYMAP_NUM 255 #define KEYMAP_ABBREVIATION_LENGTH 3 // Typedefs: typedef struct { const char *abbreviation; uint16_t offset; uint8_t abbreviationLen; } keymap_reference_t; // Variables: extern keymap_reference_t AllKeymaps[MAX_KEYMAP_NUM]; extern uint8_t AllKeymapsCount; extern uint8_t DefaultKeymapIndex; extern uint8_t CurrentKeymapIndex; extern key_action_t CurrentKeymap[LAYER_COUNT][SLOT_COUNT][MAX_KEY_COUNT_PER_MODULE]; // Functions: void SwitchKeymapById(uint8_t index); bool SwitchKeymapByAbbreviation(uint8_t length, char *abbrev); #endif
#include<stdio.h> #include<stdlib.h> #include<pthread.h> #include<sys/types.h> #include<unistd.h> #include<string.h> typedef struct data { int msize; int threadNum; int threadCount; float** A; // A*B=C float** B; float** C; } TaskData; float randrange(float min, float max) { return (float)(rand())/RAND_MAX*(max - min) + min; } void* worker(void* taskData) { TaskData* data = (TaskData*)taskData; int i,j,k; float sum = 0; for(i = data->threadNum ; i < data->msize; i = i + data->threadCount) { for(k = 0; k < data->msize; k++) { for( j = 0; j < data->msize; j++) { sum = sum + data->A[i][j] * data->B[j][k]; data->C[i][k] = sum; } sum = 0; } } } void randInitMatrices(float** a, float** b, int size, float min, float max) { srand(time(NULL)); int i, j; for( i = 0; i < size; i++) { for(j = 0; j < size; j++) { a[i][j] = randrange(min, max); b[i][j] = randrange(min, max); } } } void printMatrix(float** matrix, int size) { int i, j; for (i = 0; i < size; i++) { for(j = 0; j < size ; j++) { if(j == size - 1) printf("%f\n", matrix[i][j]); else printf("%f ", matrix[i][j]); } } } int main(int argc, char** argv){ int threadCount; int msize; int i; if(argc!=3){ printf("Error: Wrong number of arguments\n"); exit(-1); } srand(453212); msize = atoi(argv[1]); threadCount = atoi(argv[2]); float** A = calloc(msize, sizeof(float*)); float** B = calloc(msize, sizeof(float*)); float** C = calloc(msize, sizeof(float*)); for(i = 0; i < msize; i++) { A[i] = calloc(msize, sizeof(float)); B[i] = calloc(msize, sizeof(float)); C[i] = calloc(msize, sizeof(float)); } pthread_t* threads = calloc(threadCount, sizeof(pthread_t)); TaskData* taskData = calloc(threadCount, sizeof(TaskData)); randInitMatrices(A, B, msize, 1.0, 100.0); printf("A:\n**************************\n"); printMatrix(A, msize); printf("**************************\nB:\n**************************\n"); printMatrix(B, msize); printf("**************************\n"); for(i = 0; i < threadCount; i++){ taskData[i].threadNum = i; taskData[i].threadCount = threadCount; taskData[i].msize = msize; taskData[i].A = A; taskData[i].B = B; taskData[i].C = C; pthread_create(&(threads[i]), NULL, &worker, &taskData[i]); } for(i = 0; i < threadCount; i++) { pthread_join(threads[i], NULL); } printf("C:\n**************************\n"); printMatrix(C, msize); printf("**************************\n"); free(threads); free(taskData); for(i = 0; i < msize; i++) { free(A[i]); free(B[i]); free(C[i]); } free(A); free(B); free(C); return 0; }
#ifndef _BU_CLUSTERING #define _BU_CLUSTERING #include "vocabulary.h" #include "clustering.h" #include "lsa.h" //bottom up aglomerative clustering class BU_Clustering : public Clustering { public: explicit BU_Clustering(const Vocabulary& vocab) : lsa_proc_ { vocab } { } void create_clusters(const std::vector<ProcessedArticle>& articles) override; size_t add_to_clusters(const ProcessedArticle& article) override; protected: template <class FUNC> void build_dist_mat(const std::vector<ProcessedArticle>& articles, FUNC&& dist_fnc) { lsa_proc_.run_svd(articles); const auto& docs_concepts_mat = lsa_proc_.get_docs_concepts_mat(); dist_mat_.set_size(docs_concepts_mat.nr(), docs_concepts_mat.nr()); for (long di = 0; di < dist_mat_.nr(); di++) { for (long dj = di + 1; dj < dist_mat_.nr(); dj++) { const dlib::matrix<double> row_i = dlib::subm(docs_concepts_mat, di, 0, 1, 50); //std::cout << "doc-concepts: " << row_i << std::endl; const dlib::matrix<double> row_j = dlib::subm(docs_concepts_mat, dj, 0, 1, 50); dist_mat_(di, dj) = dist_fnc(row_i, row_j); dist_mat_(dj, di) = dist_mat_(di, dj); //dist_mat_(di, di) = dist_mat_(di, dj); } } } protected: LSA lsa_proc_; dlib::matrix<double> dist_mat_; }; #endif
/* check_helpers.h -- macros and functions based on the "check" library * * Copyright 2011-2012 Maurizio Tomasi. * * 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 CHECK_HELPERS_H #define CHECK_HELPERS_H #include <float.h> #define TEST_FOR_CLOSENESS(float1, float2) \ { \ fail_unless(fabs(float1 - float2) < FLT_EPSILON, \ "Numbers " #float1 " and " #float2 " are not close."); \ } #define ARE_VECTORS_EQUAL(vec1, vec2) \ { \ TEST_FOR_CLOSENESS((vec1).x, (vec2).x); \ TEST_FOR_CLOSENESS((vec1).y, (vec2).y); \ TEST_FOR_CLOSENESS((vec1).z, (vec2).z); \ } #define ARE_MATRICES_EQUAL(test, reference) \ { \ size_t __i, __j; \ for(__i = 0; __i < 3; ++__i) \ { \ for(__j = 0; __j < 3; ++__j) \ { \ TEST_FOR_CLOSENESS(test.m[__i][__j], \ reference.m[__i][__j]); \ } \ } \ } #endif
/* Copyright (C) 2010-2014 The RetroArch team * * --------------------------------------------------------------------------------------- * The following license statement only applies to this libretro SDK code part (glsym). * --------------------------------------------------------------------------------------- * * Permission is hereby granted, free of charge, * to any person obtaining a copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation the rights to * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, * and to permit persons to whom the Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #include <stdint.h> #include <glsym/rglgen.h> #include <glsym/glsym.h> #include <string.h> void rglgen_resolve_symbols_custom(rglgen_proc_address_t proc, const struct rglgen_sym_map *map) { for (; map->sym; map++) { rglgen_func_t func = proc(map->sym); memcpy(map->ptr, &func, sizeof(func)); } } void rglgen_resolve_symbols(rglgen_proc_address_t proc) { rglgen_resolve_symbols_custom(proc, rglgen_symbol_map); }
/* === This file is part of Tomahawk Player - <http://tomahawk-player.org> === * * Copyright 2010-2011, Christian Muehlhaeuser <muesli@tomahawk-player.org> * Copyright 2010-2012, Jeff Mitchell <jeff@tomahawk-player.org> * * Tomahawk 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. * * Tomahawk 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 Tomahawk. If not, see <http://www.gnu.org/licenses/>. */ #ifndef ALBUMPROXYMODEL_H #define ALBUMPROXYMODEL_H #include <QSortFilterProxyModel> #include "playlistinterface.h" #include "playlist/albummodel.h" #include "dllmacro.h" class DLLEXPORT AlbumProxyModel : public QSortFilterProxyModel { Q_OBJECT public: explicit AlbumProxyModel( QObject* parent = 0 ); virtual ~AlbumProxyModel() {} virtual AlbumModel* sourceModel() const { return m_model; } virtual void setSourceAlbumModel( AlbumModel* sourceModel ); virtual void setSourceModel( QAbstractItemModel* sourceModel ); virtual int albumCount() const { return rowCount( QModelIndex() ); } virtual void removeIndex( const QModelIndex& index ); virtual void removeIndexes( const QList<QModelIndex>& indexes ); virtual void emitFilterChanged( const QString &pattern ) { emit filterChanged( pattern ); } virtual Tomahawk::playlistinterface_ptr playlistInterface(); signals: void filterChanged( const QString& filter ); protected: bool filterAcceptsRow( int sourceRow, const QModelIndex& sourceParent ) const; bool lessThan( const QModelIndex& left, const QModelIndex& right ) const; private: AlbumModel* m_model; Tomahawk::playlistinterface_ptr m_playlistInterface; }; #endif // ALBUMPROXYMODEL_H
/* * et_vfuncs_private.h -- additional private vector functions related to ET * * Copyright 2014 Holger Kohr <kohr@num.uni-sb.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, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, * MA 02110-1301, USA. * * */ #ifndef __ET_VFUNCS_PRIVATE_H__ #define __ET_VFUNCS_PRIVATE_H__ #ifdef HAVE_CONFIG_H #include <config.h> #endif #include "et_params.h" /*-------------------------------------------------------------------------------------------------*/ float ctf_acr_unscaled_radial (const float t, const EtParams *params); float ctf_acr_scaling_function (float t, EtParams const *params); /*-------------------------------------------------------------------------------------------------*/ #endif /* __ET_VFUNCS_PRIVATE_H__ */
/*--------------------------------------------------------------------------- * Copyright (C) 2008, 2009, 2010, 2011 - Emanuele Bovisio * * This file is part of Mulk. * * Mulk 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. * * Mulk 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 Mulk. If not, see <http://www.gnu.org/licenses/>. * * In addition, as a special exception, the copyright holders give * permission to link the code of portions of this program with the * OpenSSL library under certain conditions as described in each * individual source file, and distribute linked combinations * including the two. * You must obey the GNU Lesser General Public License in all respects * for all of the code used other than OpenSSL. If you modify * file(s) with this exception, you may extend this exception to your * version of the file(s), but you are not obligated to do so. If you * do not wish to do so, delete this exception statement from your * version. If you delete this exception statement from all source * files in the program, then also delete it here. *---------------------------------------------------------------------------*/ #ifndef _JPG_OBJ_H_ #define _JPG_OBJ_H_ #include "defines.h" int is_valid_jpeg_image(const char *filename); #endif
/* * Copyright (C) 2003-2015 FreeIPMI Core Team * * 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 IPMI_SENSOR_TYPES_OEM_INTEL_SPEC_H #define IPMI_SENSOR_TYPES_OEM_INTEL_SPEC_H #ifdef __cplusplus extern "C" { #endif /******************************************* * Dell * *******************************************/ /* * Dell Poweredge R610 * Dell Poweredge R710 * Dell Poweredge R720 */ /* achu: names taken from code, are correct names? */ #define IPMI_SENSOR_TYPE_OEM_DELL_SYSTEM_PERFORMANCE_DEGRADATION_STATUS 0xC0 #define IPMI_SENSOR_TYPE_OEM_DELL_LINK_TUNING 0xC1 #define IPMI_SENSOR_TYPE_OEM_DELL_NON_FATAL_ERROR 0xC2 #define IPMI_SENSOR_TYPE_OEM_DELL_FATAL_IO_ERROR 0xC3 #define IPMI_SENSOR_TYPE_OEM_DELL_UPGRADE 0xC4 /* * Intel S5500WB/Penguin Computing Relion 700 * Intel SR1625 * Quanta QSSC-S4R/Appro GB812X-CN * (Quanta motherboard contains Intel manufacturer ID) */ #define IPMI_SENSOR_TYPE_OEM_INTEL_SMI_TIMEOUT 0xF3 /* * Quanta QSSC-S4R/Appro GB812X-CN * (Quanta motherboard contains Intel manufacturer ID) */ #define IPMI_SENSOR_TYPE_OEM_INTEL_POWER_THROTTLED 0xF3 /* * Intel S5000PAL */ #define IPMI_SENSOR_TYPE_OEM_INTEL_NMI_STATE 0xC0 /* * Intel Windmill * (Quanta Winterfell) * (Wiwynn Windmill) */ #define IPMI_SENSOR_TYPE_OEM_INTEL_WINDMILL_ME_FW_HEALTH_SENSOR 0xDC /* Used by many sensors */ #define IPMI_SENSOR_TYPE_OEM_INTEL_WINDMILL_GENERIC 0xC0 /* * Intel S2600KP * Intel S2600WT2 * Intel S2600WTT */ #define IPMI_SENSOR_TYPE_OEM_INTEL_E52600V3_IERR_RECOVERY_DUMP_INFO 0xD1 #ifdef __cplusplus } #endif #endif /* IPMI_SENSOR_TYPES_OEM_INTEL_SPEC_H */
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* ftq_pop.c :+: :+: :+: */ /* +:+ +:+ +:+ */ /* By: angagnie <marvin@42.fr> +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2018/11/23 13:32:56 by angagnie #+# #+# */ /* Updated: 2018/12/04 19:11:46 by angagnie ### ########.fr */ /* */ /* ************************************************************************** */ #include "ft_deque.h" #include "ft_deque_private.h" #include "ft_prepro.h" #include "libft.h" bool ftq_pop_one(t_deque *self, void *destination, bool front) { if (ftq_is_empty(self)) return (false); if (!front) FTQ_MOVE_BACKWARD_ONE(self, self->back); if (destination) ft_memcpy(destination, (front ? self->front : self->back), ftq_offset(self, 1)); if (front) FTQ_MOVE_FORWARD_ONE(self, self->front); return (true); } bool ftq_pop_front(t_deque *self, void *destination, unsigned count) { unsigned first; if (ftq_size(self) < count) return (false); first = MIN(count, ftq_distance(self, ftq_end(self), self->front)); ft_memcpy(destination, self->front, ftq_offset(self, first)); self->front += ftq_offset(self, first); if (self->front == ftq_end(self)) { self->front = ftq_begin(self); ftq_pop_front(self, (destination + ftq_offset(self, first)), count - first); } return (true); }
// Martin Lévesque <levesquem@emt.inrs.ca> // 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/. // #ifndef __FIWI_FAST_ADMISSION_CONTROL_H__ #define __FIWI_FAST_ADMISSION_CONTROL_H__ #include <omnetpp.h> #include <map> #include <string> #include <vector> #include <list> #include <set> #include <queue> //#include "MACAddress.h" #include "MyAbstractQueue.h" #define FAST_ADMISSION_CONTROL_GREEN 1 #define FAST_ADMISSION_CONTROL_RED 0 #define FAST_ADMISSION_CONTROL_STATUS_IDLE 0 #define FAST_ADMISSION_CONTROL_STATUS_TRANSMITTING 1 struct FastBucketInfos { int lambda; double nbBytesAvailable; int capacity; int indexMin; int indexMax; double lastTokenUpdate; double fairnessStatus; double fairnessAlphaGreen; double fairnessAlphaRed; FastBucketInfos() { fairnessStatus = 1; // 1 -> best status. lastTokenUpdate = 0; } void updateFairnessStatus(int color); void updateTokens(int bytesPerToken); }; struct FastAdmissionControlPacket { cPacket* pkt; int color; // green = 1, red = 0, highest is the better double priority; // highest is the better, host priority double arrivalTime; }; struct FastTokenForPktTypeObj { double priority; int indexMin; int indexMax; FastTokenForPktTypeObj(double p) { priority = p; } FastTokenForPktTypeObj() { priority = 0; } }; /** * */ class FiWiFastAdmissionControl : public MyAbstractQueue { public: FiWiFastAdmissionControl(); void setConfFile(const std::string& f) { cfgFile = f; }; protected: std::string cfgFile; int bytesPerToken; int queueSizeInBytes; double fairnessThreshold; double fairnessAlphaGreen; double fairnessAlphaRed; std::map<int, FastTokenForPktTypeObj> pktTypePriorities; int sizeInBytes; // Queues per packet type std::map<int, std::vector<FastAdmissionControlPacket> > queues; std::map<std::string, std::map<int, FastBucketInfos> > configs; std::set<std::string> hosts; std::set<int> pktTypes; virtual void initialize(cModule* thisModule); virtual void enqueue(cPacket* pkt); virtual uint32_t length(); virtual uint32_t lengthInBytes(); virtual bool isFull() { return false; } virtual bool isEmpty() { return queuesEmpty(); } virtual void remove(cPacket* pkt); virtual cPacket* front(int maximumPacketSize); //virtual void processAnotherPacket(); virtual bool queuesEmpty(); virtual bool queueFullWith(int nbBytesPkt, int pktType); }; #endif
/* * Copyright (C) 2009 Google Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are * met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above * copyright notice, this list of conditions and the following disclaimer * in the documentation and/or other materials provided with the * distribution. * * Neither the name of Google Inc. nor the names of its * contributors may be used to endorse or promote products derived from * this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #ifndef V8HiddenPropertyName_h #define V8HiddenPropertyName_h #include <v8.h> namespace WebCore { #define V8_HIDDEN_PROPERTIES(V) \ V(objectPrototype) \ V(listener) \ V(attributeListener) \ V(scriptState) \ V(devtoolsInjectedScript) \ V(sleepFunction) \ V(toStringString) \ V(event) \ V(state) \ V(domStringMap) \ V(domTokenList) \ V(ownerNode) class V8HiddenPropertyName { public: V8HiddenPropertyName() { } #define V8_DECLARE_PROPERTY(name) static v8::Handle<v8::String> name(); V8_HIDDEN_PROPERTIES(V8_DECLARE_PROPERTY); #undef V8_DECLARE_PROPERTY static v8::Handle<v8::String> hiddenReferenceName(const char* name); private: static v8::Persistent<v8::String> createString(const char* key); #define V8_DECLARE_FIELD(name) v8::Persistent<v8::String> m_##name; V8_HIDDEN_PROPERTIES(V8_DECLARE_FIELD); #undef V8_DECLARE_FIELD }; } #endif // V8HiddenPropertyName_h
#include <stdlib.h> #include <stdarg.h> #include <debug/memory.h> #include <debug/log.h> #include <config/parse.h> /* static void fail (const char *fmt, ...) { va_list ap; va_start (ap,fmt); if (fmt != NULL) log_vprintf (LOG_ERROR,fmt,ap); va_end (ap); // mem_close (); // log_close (); exit (EXIT_FAILURE); } */ /*void space (int level,int n) { int i; for (i = 0; i < n * 4; i++) log_printf (level," "); } */ static void dump_argument (int type,arg_t *arg) { switch (type) { case TOK_INTEGER: break; case TOK_STRING: break; case TOK_BOOLEAN: break; case TOK_ENUM: break; default: break; } } static void dump_statement (int n,stmt_t *s) { // space (LOG_DEBUG,n); // log_printf (LOG_DEBUG,"%s = ",s->name); // if (s->n != 1) log_printf (LOG_DEBUG,"{ "); dump_argument (s->type,&s->args[0]); if (s->n != 1) { int i; for (i = 1; i < s->n; i++) { // log_printf (LOG_DEBUG,", "); dump_argument (s->type,&s->args[i]); } // log_printf (LOG_DEBUG," }"); } // log_printf (LOG_DEBUG,"\n"); } static void dump_statements (int n,stmt_t *s) { stmt_t *tmp,*prev = s; if (s != NULL) do { tmp = s->next; dump_statement (n,s); s = tmp; } while (prev != s); } static void dump_sections (int n,section_t *s) { int i; if (n) { // space (LOG_DEBUG,n - 1); // log_printf (LOG_DEBUG,"%s = {\n",s->name); } dump_statements (n,s->stmt); for (i = 0; i < s->n; i++) dump_sections (n + 1,s->child[i]); if (n) { // space (LOG_DEBUG,n - 1); // log_printf (LOG_DEBUG,"}\n"); } } int main () { section_t *section; //mem_open (fail); //log_open (NULL,LOG_NOISY,LOG_HAVE_COLORS | LOG_PRINT_FUNCTION); if ((section = parse ("TEST.conf")) == NULL) exit(-1); dump_sections (0,section); parse_destroy (&section); // mem_close (); // log_close (); exit (EXIT_SUCCESS); }
/* This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla.org/MPL/2.0/. */ #pragma once #include "applicationmode.h" #include "driverkeyboardinput.h" #include "drivermouseinput.h" #include "gamepadinput.h" #include "uart.h" #include "Console.h" #include "Camera.h" #include "Classes.h" class driver_mode : public application_mode { public: // constructors driver_mode(); // methods // initializes internal data structures of the mode. returns: true on success, false otherwise bool init() override; // mode-specific update of simulation data. returns: false on error, true otherwise bool update() override; // maintenance method, called when the mode is activated void enter() override; // maintenance method, called when the mode is deactivated void exit() override; // input handlers void on_key( int const Key, int const Scancode, int const Action, int const Mods ) override; void on_cursor_pos( double const Horizontal, double const Vertical ) override; void on_mouse_button( int const Button, int const Action, int const Mods ) override; void on_scroll( double const Xoffset, double const Yoffset ) override; void on_event_poll() override; private: // types enum view { consistfront, consistrear, bogie, driveby, count_ }; struct drivermode_input { gamepad_input gamepad; drivermouse_input mouse; glm::dvec2 mouse_pickmodepos; // stores last mouse position in control picking mode driverkeyboard_input keyboard; #ifdef _WIN32 Console console; #endif std::unique_ptr<uart_input> uart; std::unique_ptr<motiontelemetry> telemetry; bool init(); void poll(); }; // methods void update_camera( const double Deltatime ); // handles vehicle change flag void OnKeyDown( int cKey ); void ChangeDynamic(); void InOutKey(); void CabView(); void ExternalView(); void DistantView( bool const Near = false ); void set_picking( bool const Picking ); // members drivermode_input m_input; std::array<basic_event *, 10> KeyEvents { nullptr }; // eventy wyzwalane z klawiaury TCamera Camera; TCamera DebugCamera; int m_externalviewmode { view::consistfront }; // selected external view mode bool m_externalview { false }; TDynamicObject *pDynamicNearest { nullptr }; // vehicle nearest to the active camera. TODO: move to camera double fTime50Hz { 0.0 }; // bufor czasu dla komunikacji z PoKeys double const m_primaryupdaterate { 1.0 / 100.0 }; double const m_secondaryupdaterate { 1.0 / 50.0 }; double m_primaryupdateaccumulator { m_secondaryupdaterate }; // keeps track of elapsed simulation time, for core fixed step routines double m_secondaryupdateaccumulator { m_secondaryupdaterate }; // keeps track of elapsed simulation time, for less important fixed step routines int iPause { 0 }; // wykrywanie zmian w zapauzowaniu };
#ifndef FILESSUMMARY_H_ #define FILESSUMMARY_H_ struct FilesSummary { unsigned long TotalFileCount; /* Total number of files. */ unsigned long TotalSizeofFiles[2]; /* Total number of bytes used by the files. */ unsigned long SizeOfAllFiles[2]; /* Number of clusters taken up by all the files. */ unsigned long HiddenFileCount; /* Total number of hidden files. */ unsigned long SizeOfHiddenFiles[2]; /* Number of clusters taken up by hidden files. */ unsigned long SystemFileCount; /* Total number of system files. */ unsigned long SizeOfSystemFiles[2]; /* Number of clusters taken up by system files. */ unsigned long DirectoryCount; /* Total number of directories. */ unsigned long SizeOfDirectories[2]; /* Total number of clusters taken up by directories. */ }; BOOL GetFilesSummary(RDWRHandle handle, struct FilesSummary* info); #endif