text
stringlengths
4
6.14k
#ifndef MAPALGORITHM_H_ #define MAPALGORITHM_H_ #include <vector> #include <ctime> #include <cstdlib> #include <SDL.h> #define INT_MIN_SIZE -32768 #define INT_MAX_SIZE 32767 #define INITIAL_INT_VALUE 0 #define FIRST_ROOM 1 #define SUM_FOR_RANDOM_INT 2 #define MODULE_FOR_RANDOM_INT 3 #define FIFTH_ROOM 5 class MapAlgorithm { public: MapAlgorithm(int numberOfRooms = 1); void RandomizeRoomOrder(std::vector<int>* roomOrder); void PopulateRoomArray(int** roomArray, std::vector<int>* roomOrder, std::pair<int, int>* aux,/*std::vector<std::pair<int, int>>* roomWay,*/ int sizeX, int sizeY); private: bool CanGo(int** roomArray, std::pair<int, int> pos, int sizeX, int sizeY); bool IsBlocked(int** roomArray, std::pair<int, int> pos, int sizeX, int sizeY); void CleanMap(int** roomArray, std::pair<int, int>* aux, int sizeX, int sizeY); void PopulateBranch(int** roomArray, std::vector<int>* roomOrder, std::pair<int, int> aux, int sizeX, int sizeY); int numberOfRooms; }; #endif // INCLUDE_MAPALGORITHM_H_
#pragma once #include <pebble.h> typedef struct { uint8_t index; char title[30]; } Subscription; void subscriptions_init(void); void subscriptions_deinit(void); void subscriptions_in_received_handler(DictionaryIterator *iter); void subscriptions_reload_data_and_mark_dirty(); void subscriptions_reset(); uint8_t subscriptions_count(); char* subscriptions_get_error(); Subscription* subscriptions_get(uint8_t index); Subscription* subscriptions_get_current(); uint8_t subscriptions_get_current_index(); void subscriptions_set_current(uint8_t index);
#ifndef OPENTISSUE_CORE_SPLINE_SPLINE_INITIALIZE_M_TABLE_H #define OPENTISSUE_CORE_SPLINE_SPLINE_INITIALIZE_M_TABLE_H // // OpenTissue Template Library // - A generic toolbox for physics-based modeling and simulation. // Copyright (C) 2008 Department of Computer Science, University of Copenhagen. // // OTTL is licensed under zlib: http://opensource.org/licenses/zlib-license.php // #include <OpenTissue/configuration.h> #include <OpenTissue/core/math/math_value_traits.h> #include <stdexcept> namespace OpenTissue { namespace spline { namespace detail { /** * Initialize the M table used when computing the derivatives. * The M table is a k*k matrix containing values for up to * k k-order nonzero basisfunctions and their corresponding * knot-differences. * * @param i The index of the basis function. * @param u The parameter value at which the i'th basis function should * be evaluated at. * @param k The order of the spline (and not the degree, which are k-1). * @param U A reference to the knotvector. It will have n+k+1 knot values. * @param M A reference to the M table that will be initialized when the function returns. */ template<typename matrix_type, typename knot_container> inline void initialize_m_table( int const & i , typename knot_container::value_type const & u , int const & k , knot_container const & U , matrix_type & M ) { typedef typename knot_container::value_type T; typedef OpenTissue::math::ValueTraits<T> value_traits; if(k<1) throw std::invalid_argument( "order must be greater than zero" ); if( U.size() < 2u*k) throw std::invalid_argument( "knot vector did not have enough entries" ); if( u < U[0] ) throw std::invalid_argument( "u-parameter was out of lower bound" ); if( u > U[ U.size() - 1 ] ) throw std::invalid_argument( "u-parameter was out of upper bound" ); if(i<0) throw std::invalid_argument( "basis function index must be non-negative" ); knot_container left(k+1); knot_container right(k+1); M.resize(k,k,false); M(0,0) = value_traits::one(); for (int j=1; j<k; ++j) { left[j] = u-U[i+1-j]; right[j] = U[i+j]-u; T saved = value_traits::zero(); for(int r = 0; r<j; ++r) { /* Lower triangle (knot differences) */ M(j,r) = right[r+1] + left[j-r]; T temp = M(r,j-1)/M(j,r); /* Upper triangle (basisfunctions values) */ M(r,j) = saved+right[r+1]*temp; saved = left[j-r]*temp; } M(j,j) = saved; } } } // namespace detail } // namespace spline } // namespace OpenTissue //OPENTISSUE_CORE_SPLINE_SPLINE_INITIALIZE_M_TABLE_H #endif
//CPP:continuous/sinus2.cpp #if !defined sinus2_h #define sinus2_h #include "simulator.h" #include "event.h" #include "stdarg.h" #include "math.h" class sinus2: public Simulator { double Y[10]; double Sigma; double S, Ms, Ps; double c; public: sinus2(const char *n): Simulator(n) {}; void init(double, ...); double ta(double t); void dint(double); void dext(Event , double ); Event lambda(double); void exit(); }; #endif
/** * @copyright * Copyright (C) 2020 Assured Information Security, Inc. * * @copyright * 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: * * @copyright * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * @copyright * 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 <debug.h> #include <free_mk_args.h> #include <free_mk_stack.h> #include <free_mk_state.h> #include <free_root_vp_state.h> #include <g_mut_cpu_status.h> #include <g_mut_mk_args.h> #include <g_mut_mk_stack.h> #include <g_mut_mk_state.h> #include <g_mut_root_vp_state.h> #include <mk_args_t.h> #include <send_command_report_off.h> #include <send_command_stop.h> #include <span_t.h> #include <state_save_t.h> #include <types.h> /** * <!-- description --> * @brief This function contains all of the code that is common between * all archiectures and all platforms for stopping the VMM. This function * will call platform and architecture specific functions as needed. * Unlike stop_vmm, this function is called on each CPU. * * <!-- inputs/outputs --> * @param cpu the id of the cpu to stop * @return Returns 0 on success */ NODISCARD int64_t stop_vmm_per_cpu(uint32_t const cpu) NOEXCEPT { if (((uint64_t)cpu) >= HYPERVISOR_MAX_PPS) { bferror("cpu out of range"); return LOADER_FAILURE; } if (CPU_STATUS_CORRUPT == g_mut_cpu_status[cpu]) { bferror_d32("Unable to stop, previous CPU stopped in a corrupt state", cpu); return LOADER_FAILURE; } if (CPU_STATUS_RUNNING == g_mut_cpu_status[cpu]) { send_command_report_off(); if (send_command_stop()) { bferror("send_command_stop failed"); g_mut_cpu_status[cpu] = CPU_STATUS_CORRUPT; return LOADER_FAILURE; } bf_touch(); } else { bf_touch(); } free_mk_args(&g_mut_mk_args[cpu]); free_root_vp_state(&g_mut_root_vp_state[cpu]); free_mk_state(&g_mut_mk_state[cpu]); free_mk_stack(&g_mut_mk_stack[cpu]); g_mut_cpu_status[cpu] = CPU_STATUS_STOPPED; return LOADER_SUCCESS; }
// // UIColor+Helper.h // // Created by Reejo Samuel on 8/2/13. // Copyright (c) 2013 Reejo Samuel | m[at]reejosamuel.com All rights reserved. // #import <UIKit/UIKit.h> @interface UIColor (Helper) +(UIColor *)colorWithHex:(int)hex; @end
#include <stdlib.h> #include <ctype.h> long atol(const char *s) NONBANKED { UINT8 i, sign = 0; long n; for(i = 0; (s[i] == ' ') || (s[i] == '\n') || (s[i] == '\t'); ++i) ; switch(s[i]) { case '-': sign++; /* and fall through */ case '+': ++i; break; } for(n = 0; isdigit(s[i]); ++i) n = 10 * n + s[i] - '0'; return (sign == 0 ? n : -n); }
#include <stdint.h> #include <stddef.h> uint32_t checksum32(uint32_t crc, void* buf, size_t len); uint32_t deprecated_crc32(uint32_t crc, void* buf, size_t len);
/* For more information, please see: http://software.sci.utah.edu The MIT License Copyright (c) 2020 Scientific Computing and Imaging Institute, University of Utah. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #ifndef MODULES_MATH_CreateStandardMatrix_H #define MODULES_MATH_CreateStandardMatrix_H #include <Dataflow/Network/Module.h> #include <Modules/Math/share.h> namespace SCIRun{ namespace Modules{ namespace Math{ class SCISHARE CreateStandardMatrix:public SCIRun::Dataflow::Networks::Module, public HasNoInputPorts, public Has1OutputPort<MatrixPortTag> { public: CreateStandardMatrix(); void execute() override; void setStateDefaults() override; //INPUT_PORT(0,InputMatrix, Matrix); OUTPUT_PORT(0,OutputMatrix, Matrix); MODULE_TRAITS_AND_INFO(ModuleFlags::ModuleHasUIAndAlgorithm); }; } } } #endif
#ifndef BUILDNOTIFICATOR_H #define BUILDNOTIFICATOR_H #include <QObject> #include "jenkinsjob.h" #include "jenkinssettings.h" namespace JenkinsCI { namespace Internal { class BuildNotificator : public QObject { Q_OBJECT public: explicit BuildNotificator(QWidget *notificationParent, QObject *parent = 0); JenkinsSettings settings() const; void setSettings(const JenkinsSettings &settings); public slots: void notifyAboutFailure(const JenkinsJob &job); void clear() { _alreadyReportedFailures.clear(); } private: // key - job name QMap< QString, JenkinsJob::BuildUrl > _alreadyReportedFailures; JenkinsSettings _settings; QWidget *_notificationParent{nullptr}; }; } } #endif // BUILDNOTIFICATOR_H
#import <Foundation/Foundation.h> @interface SVGKCSSValue() - (instancetype)initWithUnitType:(CSSUnitType) t; @end
/*++ Copyright (c) 2011 Microsoft Corporation Module Name: context_params.h Abstract: Goodies for managing context parameters in the cmd_context and api_context Author: Leonardo (leonardo) 2012-12-01 Notes: --*/ #ifndef CONTEXT_PARAMS_H_ #define CONTEXT_PARAMS_H_ #include"params.h" class ast_manager; class context_params { void set_bool(bool & opt, char const * param, char const * value); public: bool m_auto_config; bool m_proof; bool m_interpolants; bool m_debug_ref_count; bool m_trace; std::string m_trace_file_name; bool m_well_sorted_check; bool m_model; bool m_model_validate; bool m_dump_models; bool m_unsat_core; bool m_smtlib2_compliant; // it must be here because it enable/disable the use of coercions in the ast_manager. unsigned m_timeout; unsigned m_rlimit; context_params(); void set(char const * param, char const * value); void updt_params(); void updt_params(params_ref const & p); static void collect_param_descrs(param_descrs & d); /* REG_PARAMS('context_params::collect_param_descrs') */ /** \brief Goodies for extracting parameters for creating a solver object. */ void get_solver_params(ast_manager const & m, params_ref & p, bool & proofs_enabled, bool & models_enabled, bool & unsat_core_enabled); static void collect_solver_param_descrs(param_descrs & d); /** \brief Include in p parameters derived from this context_params. These are parameters that are meaningful for tactics and solvers. Example: auto_config */ params_ref merge_default_params(params_ref const & p); /** \brief Create an AST manager using this configuration. */ ast_manager * mk_ast_manager(); }; #endif
#include <math.h> #define NRANSI #include "nrutil.h" #define ITMAX 100 #define ZEPS 1.0e-10 #define MOV3(a,b,c, d,e,f) (a)=(d);(b)=(e);(c)=(f); float dbrent(float ax, float bx, float cx, float (*f)(float), float (*df)(float), float tol, float *xmin) { int iter,ok1,ok2; float a,b,d,d1,d2,du,dv,dw,dx,e=0.0; float fu,fv,fw,fx,olde,tol1,tol2,u,u1,u2,v,w,x,xm; a=(ax < cx ? ax : cx); b=(ax > cx ? ax : cx); x=w=v=bx; fw=fv=fx=(*f)(x); dw=dv=dx=(*df)(x); for (iter=1;iter<=ITMAX;iter++) { xm=0.5*(a+b); tol1=tol*fabs(x)+ZEPS; tol2=2.0*tol1; if (fabs(x-xm) <= (tol2-0.5*(b-a))) { *xmin=x; return fx; } if (fabs(e) > tol1) { d1=2.0*(b-a); d2=d1; if (dw != dx) d1=(w-x)*dx/(dx-dw); if (dv != dx) d2=(v-x)*dx/(dx-dv); u1=x+d1; u2=x+d2; ok1 = (a-u1)*(u1-b) > 0.0 && dx*d1 <= 0.0; ok2 = (a-u2)*(u2-b) > 0.0 && dx*d2 <= 0.0; olde=e; e=d; if (ok1 || ok2) { if (ok1 && ok2) d=(fabs(d1) < fabs(d2) ? d1 : d2); else if (ok1) d=d1; else d=d2; if (fabs(d) <= fabs(0.5*olde)) { u=x+d; if (u-a < tol2 || b-u < tol2) d=SIGN(tol1,xm-x); } else { d=0.5*(e=(dx >= 0.0 ? a-x : b-x)); } } else { d=0.5*(e=(dx >= 0.0 ? a-x : b-x)); } } else { d=0.5*(e=(dx >= 0.0 ? a-x : b-x)); } if (fabs(d) >= tol1) { u=x+d; fu=(*f)(u); } else { u=x+SIGN(tol1,d); fu=(*f)(u); if (fu > fx) { *xmin=x; return fx; } } du=(*df)(u); if (fu <= fx) { if (u >= x) a=x; else b=x; MOV3(v,fv,dv, w,fw,dw) MOV3(w,fw,dw, x,fx,dx) MOV3(x,fx,dx, u,fu,du) } else { if (u < x) a=u; else b=u; if (fu <= fw || w == x) { MOV3(v,fv,dv, w,fw,dw) MOV3(w,fw,dw, u,fu,du) } else if (fu < fv || v == x || v == w) { MOV3(v,fv,dv, u,fu,du) } } } nrerror("Too many iterations in routine dbrent"); return 0.0; } #undef ITMAX #undef ZEPS #undef MOV3 #undef NRANSI
#pragma once #include "lpg_array_size.h" #include "lpg_non_null.h" #include "lpg_use_result.h" #include <stddef.h> void *allocate(size_t size) LPG_USE_RESULT; void *allocate_array(size_t size, size_t element) LPG_USE_RESULT; void *reallocate(void *memory, size_t new_size) LPG_USE_RESULT; void *reallocate_array(void *memory, size_t new_size, size_t element) LPG_USE_RESULT; void *reallocate_array_exponentially(void *array, size_t new_size, size_t element, size_t current_size, size_t *capacity) LPG_USE_RESULT; void deallocate(LPG_NON_NULL(void *memory)); size_t count_total_allocations(void) LPG_USE_RESULT; size_t count_active_allocations(void) LPG_USE_RESULT; void *copy_array_impl(LPG_NON_NULL(void const *from), size_t size_in_bytes) LPG_USE_RESULT; #define LPG_COPY_ARRAY(array) copy_array_impl((array), sizeof(array)), LPG_ARRAY_SIZE(array)
/****************************************************************************** Copyright (c) 1996 - 2004 -- University of Washington ******************************************************************************/ #include <stdio.h> #include <stdlib.h> #include "../include/cmloops.h" #include "../include/contraction.h" #include "../include/error.h" #include "../include/global.h" #include "../include/rmstack.h" #include "../include/symmac.h" #include "../include/traverse.h" #include "../include/treemac.h" /* FN: calc_tile_lsd - given mloop, calculate loop structure of tile loops * return result in res * res[i] = j => loop i iterates over dim |j| in * direction of sign of j * note that i is 0-based, and j is 1-based * 11-24-99 echris */ static int calc_tile_lsd(mloop_t *mloop, distvect_t res) { int numdims, i, j, k, hi, lo; int v[MAXRANK], m[MAXRANK]; numdims = T_MLOOP_RANK(mloop); for (i=0; i<numdims; i++) { hilow(T_MLOOP_CONSTR(mloop), i, &hi, &lo); if (hi*lo < 0) { INT_FATAL(NULL, "Can't handle these deps in MSCAN yet."); } v[i] = ((hi<0) || (lo<0))?1:(((hi>0) || (lo>0))?-1:0); m[i] = FALSE; } k = 0; for (i=0; i<numdims; i++) { for (j=0; j<numdims; j++) { if (!m[j]) { if (v[j] == 0) { res[i] = j+1; m[j] = TRUE; k++; break; } } } } for (i=k; i<numdims; i++) { for (j=0; j<numdims; j++) { if (!m[j]) { res[i] = (j+1) * v[j]; m[j] = TRUE; break; } } } return (TRUE); } /* move all degenerate dimensions to the outer part of the MLOOP as an optimization. This makes the assumption that degenerate dimensions can always be moved around since they can carry no data dependences --BLC */ static void optimize_dimension_order(int lineno,int numdims,int order[], int flat[]) { int i; int j; int numflatdims=0; int currentdim; if (numdims == 1 || mloop_opt == FALSE) { return; } /* I think this was stupid -BLC currentdim = order[0]; if (RMSRegDimDegenerate(currentdim,0)) { flat[currentdim] = 1; printf("FOUND FLAT DIM: %d\n",currentdim); } */ for (i=0;i<numdims;i++) { currentdim = order[i]; if (RMSRegDimDegenerate(currentdim,0)) { flat[currentdim] = 1; IFDB(30) { printf("FOUND FLAT DIM: %d\n",currentdim); } #if (!RELEASE_VER) IFDB(1) { expr_t* reg; reg = RMSCurrentRegion(); DBS3(1,"Moving dimension %d down to dimension %d for region %s\n",i, numflatdims,S_IDENT(T_IDENT(reg))); } #endif for (j=i; j>numflatdims; j--) { order[j] = order[j-1]; } order[numflatdims] = currentdim; /* given that I've set tile to 1 above, is this still what I want, or do I want tile order? -BLC */ numflatdims++; } } } /* FN: mscan_mloop - given mloop returns TRUE if it is mscan mloop * 11/24/99 echris */ int mscan_mloop(mloop_t *mloop) { if ((mloop == NULL) || !T_MLOOP_BODY(mloop) || !T_PARENT(T_MLOOP_BODY(mloop))) { return (FALSE); } else { return (MLOOP_IS_MSCAN(T_PARENT(T_MLOOP_BODY(mloop)))); } } static int mloop_tiled(mloop_t* mloop) { int numdims = T_MLOOP_RANK(mloop); int i; for (i=0; i<numdims; i++) { if (T_MLOOP_TILE(mloop,i) != 0) { return 1; } } return 0; } /* Called on every statement */ static void cmloop(statement_t* stmt) { mloop_t *mloop; int numdims; distvect_t res; int i; /* only consider mloop statements */ if ((stmt == NULL) || (T_TYPE(stmt) != S_MLOOP) || !(mloop = T_MLOOP(stmt))) return; numdims = T_MLOOP_RANK(mloop); if (T_MLOOP_CONSTR(mloop)) { /* fill in T_MLOOP_ORDER and T_MLOOP_DIRECTION fields based on */ /* constraints in T_MLOOP_CONSTR() */ /* note that lsd() destructively updates its first arg */ if (!lsd(dvlist_copy(T_MLOOP_CONSTR(mloop)),res)) { INT_FATAL(NULL, "No legal lsd for mloop in constrain_mloop()"); } for (i=0; i<numdims; i++) { T_MLOOP_DIRECTION(mloop, abs((res)[i])-1) = (((res)[i])>0)?1:-1; T_MLOOP_ORDER(mloop, i+1) = abs((res)[i])-1; } /* do tile structure if (i) mloop marked as tiled, or (ii) it is mscan mloop (which will eventually be tiled) */ if (mloop_tiled(mloop) || (mscan_mloop(mloop))) { /* fill in T_MLOOP_TILE_ORDER/DIRECTION fields based on */ /* contraints in T_MLOOP_CONSTR() */ if (!calc_tile_lsd(mloop, res)) { INT_FATAL(NULL, "No legal lsd for mloop in mscan_stmt()"); } else { for (i=0; i<numdims; i++) { T_MLOOP_TILE_ORDER(mloop, i+1) = abs((res)[i])-1; T_MLOOP_TILE_DIRECTION(mloop,abs((res)[i])-1) = (((res)[i])>0)?1:-1; /* overwrite T_MLOOP_DIRECTION() with tile directions */ T_MLOOP_DIRECTION(mloop,abs((res)[i])-1) = (((res)[i])>0)?1:-1; } } } else { for (i=0; i<numdims; i++) { T_MLOOP_TILE_ORDER(mloop, i+1) = T_MLOOP_ORDER(mloop, i+1); } } } /* else no constraints, so use the defaults */ optimize_dimension_order(T_LINENO(stmt),numdims,T_MLOOP_ORDER_V(mloop), T_MLOOP_FLAT_V(mloop)); } /* Given a module, constrains all of the mloop statements for every function in the module */ static void constrainmloops(module_t *mod) { symboltable_t* pst; statement_t* stmt; DB0(20,"constrainmloops()\n"); for (; mod != NULL; mod = T_NEXT(mod)) { for (pst = T_DECL(mod); pst != NULL; pst = S_SIBLING(pst)) { if (S_CLASS(pst) == S_SUBPROGRAM) { stmt = T_STLS(S_FUN_BODY(pst)); if (stmt != NULL) traverse_stmtls(T_STLS(T_CMPD(stmt)), FALSE, cmloop, NULL, NULL); } } } } /* Entry point */ int call_constrainmloops(module_t *mod, char *s) { RMSInit(); constrainmloops(mod); RMSFinalize(); return 0; }
// // LoadingView.h // profileSlide // // Created by S on 15/10/16. // Copyright © 2015年 S. All rights reserved. // #import <UIKit/UIKit.h> @interface LoadingView : UIView /* 正在加载 */ @property (nonatomic,assign) BOOL isLoading; /* 半径 (默认:25) */ @property (nonatomic,assign) CGFloat radius; /* 初始化 */ + (instancetype)share; /* 开启加载 */ - (void)startLoading; /* 开启加载 withView */ - (void)startLoadingWithView:(UIView *)view; /* 关闭加载 */ - (void)stopLoading; @end @interface PullLoadingView : UIView /* 下拉正在刷新 */ @property (nonatomic,assign) BOOL isPullLoading; /* 半径 (默认:30) */ @property (nonatomic,assign) CGFloat radius; /* 初始化 */ + (instancetype)share; /* 开启加载 withView withDistance */ - (void)startPullLoadingWithView:(UIView *)view withPullDistance:(CGFloat)distance; /* 关闭加载 */ - (void)stopLoading; /* 移除layer */ - (void)removeLayer; @end
// // IMSessionPeriodResponseMessageBuilder.h // im // // Created by Pharaoh on 13-11-22. // Copyright (c) 2013年 itelland. All rights reserved. // #import <Foundation/Foundation.h> #import "IMMessageBuilder.h" @interface IMSessionPeriodResponseMessageBuilder : NSObject <IMMessageBuilder> @end
/*---------------------------------------------------------------------- File : carpenter.h Contents: carpenter algorithm for finding frequent item sets Author : Christian Borgelt History : 2013.10.31 file created from carpenter.c 2014.08.23 interface of function carpenter() changed 2014.08.28 functions carp_data() and carp_repo() added ----------------------------------------------------------------------*/ #ifndef __CARPENTER__ #define __CARPENTER__ #include "tract.h" #include "repotree.h" #ifndef ISR_CLOMAX #define ISR_CLOMAX #endif #include "report.h" /*---------------------------------------------------------------------- Preprocessor Definitions ----------------------------------------------------------------------*/ /* --- evaluation measures --- */ #define CARP_NONE 0 /* no measure */ #define CARP_LDRATIO 1 /* binary log. of support quotient */ /* --- operation modes --- */ #define CARP_PERFECT 0x0010 /* prune with perfect extensions */ #define CARP_FILTER 0x0020 /* filter maximal sets with repo. */ #define CARP_MAXONLY 0x0040 /* add only maximal sets to repo. */ #define CARP_COLLATE 0x0080 /* flag for collating transactions */ #define CARP_DEFAULT CARP_COLLATE|CARP_PERFECT #ifdef NDEBUG #define CARP_NOCLEAN 0x8000 #else /* do not clean up memory */ #define CARP_NOCLEAN 0 /* in function carpenter() */ #endif #define CARP_VERBOSE INT_MIN /* verbose message output */ /* --- carpenter variants --- */ #define CARP_AUTO 0 /* auto. choice based on table size */ #define CARP_TABLE 1 /* item occurrence counter table */ #define CARP_TIDLIST 2 /* transaction identifier lists */ /*---------------------------------------------------------------------- Functions ----------------------------------------------------------------------*/ extern int carp_data (TABAG *tabag, int target, SUPP smin, ITEM zmin, int eval, int algo, int mode, int sort); extern int carp_repo (ISREPORT *report, int target, int eval, double thresh, int algo, int mode); extern int carpenter (TABAG *tabag, int target, SUPP smin, int eval, double thresh, int algo, int mode, ISREPORT *report); #endif
/* SAFERK64.h Copyright (c) 2013 - 2017 Jason Lee @ calccrypto at gmail.com Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #ifndef __SAFERK64__ #define __SAFERK64__ #include <vector> #include "../common/cryptomath.h" #include "SymAlg.h" #include "SAFERK64_Const.h" class SAFERK64 : public SymAlg{ private: uint8_t r; // 6 <= r <= 10 std::vector <std::vector <uint8_t> > keys; void add_bias(std::vector <uint8_t> & key_i, const uint8_t b[8]); std::vector <uint8_t> byte_rotate_3(std::vector <uint8_t> & key_i); void xor_add(std::vector <uint8_t> & data, std::vector <uint8_t> & key); void add_xor(std::vector <uint8_t> & data, std::vector <uint8_t> & key); void xor_sub(std::vector <uint8_t> & data, std::vector <uint8_t> & key); void sub_xor(std::vector <uint8_t> & data, std::vector <uint8_t> & key); void nonlinear_lajer(std::vector <uint8_t> & data); void inv_nonlinear_lajer(std::vector <uint8_t> & data); void pht(uint8_t & a1, uint8_t & a2); void inv_pht(uint8_t & b1, uint8_t & b2); void pht_layer(std::vector <uint8_t> & data); void inv_pht_layer(std::vector <uint8_t> & data); public: SAFERK64(); SAFERK64(const std::string & KEY, const uint8_t & rounds = 10); void setkey(const std::string & KEY, const uint8_t & rounds = 10); std::string encrypt(const std::string & DATA); std::string decrypt(const std::string & DATA); unsigned int blocksize() const; }; #endif
#ifndef EIRCORE_H #define EIRCORE_H #ifndef __MODULE__ # define __MODULE__ "eirCore" #endif #include "eirCore_global.h" #include <QtDebug> #include <QtCore/QDir> #define INT64_MIN (-9223372036854775807LL - 1) /*! @class eirCore * @brief The eirCore library completes the core-level support for the EclipseIR libraries. */ class EIRCORESHARED_EXPORT eirCore { public: eirCore(void); }; #endif // EIRCORE_H
// // CJNavigationController.h // Router // // Created by Jérémy chaufourier on 16/05/12. // Copyright (c) 2012 Jérémy Chaufourier. All rights reserved. // #import <UIKit/UIKit.h> @interface NavigationController : UINavigationController @end
/* * Copyright 2002-2016 The OpenSSL Project Authors. All Rights Reserved. * * Licensed under the OpenSSL license (the "License"). You may not use * this file except in compliance with the License. You can obtain a copy * in the file LICENSE in the source distribution or at * https://www.openssl.org/source/license.html */ #include BLIK_OPENSSL_V_openssl__ec_h //original-code:<openssl/ec.h>
/* * Copyright (c) 2000-2007 Apple Inc. All rights reserved. * * @APPLE_OSREFERENCE_LICENSE_HEADER_START@ * * This file contains Original Code and/or Modifications of Original Code * as defined in and that are subject to the Apple Public Source License * Version 2.0 (the 'License'). You may not use this file except in * compliance with the License. The rights granted to you under the License * may not be used to create, or enable the creation or redistribution of, * unlawful or unlicensed copies of an Apple operating system, or to * circumvent, violate, or enable the circumvention or violation of, any * terms of an Apple operating system software license agreement. * * Please obtain a copy of the License at * http://www.opensource.apple.com/apsl/ and read it before using this file. * * The Original Code and all software distributed under the License are * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. * Please see the License for the specific language governing rights and * limitations under the License. * * @APPLE_OSREFERENCE_LICENSE_HEADER_END@ */ #ifndef _MACH_MACHINE_KERN_RETURN_H_ #define _MACH_MACHINE_KERN_RETURN_H_ #if defined (__i386__) || defined(__x86_64__) #include "mach/i386/kern_return.h" #else #error architecture not supported #endif #endif /* _MACH_MACHINE_KERN_RETURN_H_ */
/** * @file * Common code for store tests * * @authors * Copyright (C) 2020 Richard Russon <rich@flatcap.org> * * @copyright * 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/>. */ #define TEST_NO_MAIN #include "config.h" #include "acutest.h" #include <stdbool.h> #include "mutt/lib.h" #include "store/lib.h" #include "test_common.h" bool test_store_setup(char *buf, size_t buflen) { if (!buf) return false; test_gen_path(buf, buflen, "%s/tmp/XXXXXX"); if (!mkdtemp(buf)) return false; return true; } bool test_store_degenerate(const struct StoreOps *sops, const char *name) { if (!sops) return false; if (!TEST_CHECK(mutt_str_equal(sops->name, name))) return false; if (!TEST_CHECK(sops->open(NULL) == NULL)) return false; if (!TEST_CHECK(sops->fetch(NULL, NULL, 0, NULL) == NULL)) return false; void *ptr = NULL; sops->free(NULL, NULL); TEST_CHECK_(1, "sops->free(NULL, NULL)"); sops->free(NULL, &ptr); TEST_CHECK_(1, "sops->free(NULL, ptr)"); if (!TEST_CHECK(sops->store(NULL, NULL, 0, NULL, 0) != 0)) return false; if (!TEST_CHECK(sops->delete_record(NULL, NULL, 0) != 0)) return false; sops->close(NULL); TEST_CHECK_(1, "sops->close(NULL)"); sops->close(&ptr); TEST_CHECK_(1, "sops->close(&ptr)"); if (!TEST_CHECK(sops->version() != NULL)) return false; return true; } bool test_store_db(const struct StoreOps *sops, void *db) { if (!sops || !db) return false; const char *key = "one"; size_t klen = strlen(key); char *value = "abcdefghijklmnopqrstuvwxyz"; size_t vlen = strlen(value); int rc; rc = sops->store(db, key, klen, value, vlen); if (!TEST_CHECK(rc == 0)) return false; void *data = NULL; vlen = 0; data = sops->fetch(db, key, klen, &vlen); if (!TEST_CHECK(data != NULL)) return false; sops->free(db, &data); TEST_CHECK_(1, "sops->free(db, &data)"); rc = sops->delete_record(db, key, klen); if (!TEST_CHECK(rc == 0)) return false; return true; }
/* * Brian Carrier [carrier <at> sleuthkit [dot] org] * Copyright (c) 2006-2016 Brian Carrier, Basis Technology. All rights reserved * Copyright (c) 2005 Brian Carrier. All rights reserved * * This software is distributed under the Common Public License 1.0 * */ /* * Header files for VHD-specific data structures and functions. */ #ifndef _TSK_IMG_VHDI_H #define _TSK_IMG_VHDI_H #if HAVE_LIBVHDI #if defined( TSK_WIN32 ) #define LIBVHDI_HAVE_WIDE_CHARACTER_TYPE 1 #endif #include <libvhdi.h> #ifdef __cplusplus extern "C" { #endif extern TSK_IMG_INFO *vhdi_open(int, const TSK_TCHAR * const images[], unsigned int a_ssize); typedef struct { TSK_IMG_INFO img_info; libvhdi_file_t *handle; tsk_lock_t read_lock; // Lock for reads since according to documentation libvhdi is not fully thread safe yet } IMG_VHDI_INFO; #ifdef __cplusplus } #endif #endif #endif // _TSK_IMG_VHDI_H
/* Destructor for SPARC specific backend library. Copyright (C) 2002 Red Hat, Inc. This program is Open Source software; you can redistribute it and/or modify it under the terms of the Open Software License version 1.0 as published by the Open Source Initiative. You should have received a copy of the Open Software License along with this program; if not, you may obtain a copy of the Open Software License version 1.0 from http://www.opensource.org/licenses/osl.php or by writing the Open Source Initiative c/o Lawrence Rosen, Esq., 3001 King Ranch Road, Ukiah, CA 95482. */ #ifdef HAVE_CONFIG_H # include <config.h> #endif #include <libebl_sparc.h> void sparc_destr (bh) Ebl *bh; { /* Nothing to do so far. */ }
/* * Copyright (c) 2015 Cedric Hnyda <chnyda@suse.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 would 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 the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ #ifndef RENAMEAT2_H #define RENAMEAT2_H #include <sys/types.h> #include "config.h" #include "lapi/syscalls.h" #if !defined(HAVE_RENAMEAT2) int renameat2(int olddirfd, const char *oldpath, int newdirfd, const char *newpath, unsigned int flags) { return tst_syscall(__NR_renameat2, olddirfd, oldpath, newdirfd, newpath, flags); } #endif #endif /* RENAMEAT2_H */
/* * * Connection Manager * * Copyright (C) 2007-2010 Intel Corporation. All rights reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as * published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA * */ #ifdef HAVE_CONFIG_H #include <config.h> #endif #define _GNU_SOURCE #include <stdarg.h> #include <syslog.h> #include <stdlib.h> #include <execinfo.h> #include <dlfcn.h> #include "connman.h" /** * connman_info: * @format: format string * @Varargs: list of arguments * * Output general information */ void connman_info(const char *format, ...) { va_list ap; va_start(ap, format); vsyslog(LOG_INFO, format, ap); va_end(ap); } /** * connman_warn: * @format: format string * @Varargs: list of arguments * * Output warning messages */ void connman_warn(const char *format, ...) { va_list ap; va_start(ap, format); vsyslog(LOG_WARNING, format, ap); va_end(ap); } /** * connman_error: * @format: format string * @varargs: list of arguments * * Output error messages */ void connman_error(const char *format, ...) { va_list ap; va_start(ap, format); vsyslog(LOG_ERR, format, ap); va_end(ap); } /** * connman_debug: * @format: format string * @varargs: list of arguments * * Output debug message */ void connman_debug(const char *format, ...) { va_list ap; va_start(ap, format); vsyslog(LOG_DEBUG, format, ap); va_end(ap); } static void signal_handler(int signo) { void *frames[64]; char **symbols; size_t n_ptrs; unsigned int i; n_ptrs = backtrace(frames, G_N_ELEMENTS(frames)); symbols = backtrace_symbols(frames, n_ptrs); if (symbols == NULL) { connman_error("No backtrace symbols"); exit(1); } connman_error("Aborting (signal %d)", signo); connman_error("++++++++ backtrace ++++++++"); for (i = 1; i < n_ptrs; i++) connman_error("[%d]: %s", i - 1, symbols[i]); connman_error("+++++++++++++++++++++++++++"); g_free(symbols); exit(1); } static void signal_setup(sighandler_t handler) { struct sigaction sa; sigset_t mask; sigemptyset(&mask); sa.sa_handler = handler; sa.sa_mask = mask; sa.sa_flags = 0; sigaction(SIGBUS, &sa, NULL); sigaction(SIGILL, &sa, NULL); sigaction(SIGFPE, &sa, NULL); sigaction(SIGSEGV, &sa, NULL); sigaction(SIGABRT, &sa, NULL); sigaction(SIGPIPE, &sa, NULL); } extern struct connman_debug_desc __start___debug[]; extern struct connman_debug_desc __stop___debug[]; void __connman_debug_list_available(DBusMessageIter *iter, void *user_data) { struct connman_debug_desc *desc; for (desc = __start___debug; desc < __stop___debug; desc++) { if ((desc->flags & CONNMAN_DEBUG_FLAG_ALIAS) && desc->name != NULL) dbus_message_iter_append_basic(iter, DBUS_TYPE_STRING, &desc->name); } } static gchar **enabled = NULL; void __connman_debug_list_enabled(DBusMessageIter *iter, void *user_data) { int i; if (enabled == NULL) return; for (i = 0; enabled[i] != NULL; i++) dbus_message_iter_append_basic(iter, DBUS_TYPE_STRING, &enabled[i]); } static connman_bool_t is_enabled(struct connman_debug_desc *desc) { int i; if (enabled == NULL) return FALSE; for (i = 0; enabled[i] != NULL; i++) { if (desc->name != NULL && g_pattern_match_simple(enabled[i], desc->name) == TRUE) return TRUE; if (desc->file != NULL && g_pattern_match_simple(enabled[i], desc->file) == TRUE) return TRUE; } return FALSE; } void __connman_log_enable(struct connman_debug_desc *start, struct connman_debug_desc *stop) { struct connman_debug_desc *desc; const char *name = NULL, *file = NULL; if (start == NULL || stop == NULL) return; for (desc = start; desc < stop; desc++) { if (desc->flags & CONNMAN_DEBUG_FLAG_ALIAS) { file = desc->file; name = desc->name; continue; } if (file != NULL || name != NULL) { if (g_strcmp0(desc->file, file) == 0) { if (desc->name == NULL) desc->name = name; } else file = NULL; } if (is_enabled(desc) == TRUE) desc->flags |= CONNMAN_DEBUG_FLAG_PRINT; } } int __connman_log_init(const char *debug, connman_bool_t detach) { int option = LOG_NDELAY | LOG_PID; if (debug != NULL) enabled = g_strsplit_set(debug, ":, ", 0); __connman_log_enable(__start___debug, __stop___debug); if (detach == FALSE) option |= LOG_PERROR; signal_setup(signal_handler); openlog("connmand", option, LOG_DAEMON); syslog(LOG_INFO, "Connection Manager version %s", VERSION); return 0; } void __connman_log_cleanup(void) { syslog(LOG_INFO, "Exit"); closelog(); signal_setup(SIG_DFL); g_strfreev(enabled); }
## ===== instance function implementation template - for overloaded functions bool ${signature_name}(JSContext *cx, uint32_t argc, jsval *vp) { jsval *argv = JS_ARGV(cx, vp); bool ok = true; JSObject *obj = NULL; ${namespaced_class_name}* cobj = NULL; #if not $is_constructor obj = JS_THIS_OBJECT(cx, vp); js_proxy_t *proxy = jsb_get_js_proxy(obj); cobj = (${namespaced_class_name} *)(proxy ? proxy->ptr : NULL); JSB_PRECONDITION2( cobj, cx, false, "${signature_name} : Invalid Native Object"); #end if #for func in $implementations #if len($func.arguments) >= $func.min_args #set arg_count = len($func.arguments) #set arg_idx = $func.min_args #while $arg_idx <= $arg_count #set arg_list = "" #set arg_array = [] do { #if $func.min_args >= 0 if (argc == $arg_idx) { #set $count = 0 #while $count < $arg_idx #set $arg = $func.arguments[$count] ${arg.to_string($generator)} arg${count}; ${arg.to_native({"generator": $generator, "in_value": "argv[" + str(count) + "]", "out_value": "arg" + str(count), "class_name": $class_name, "level": 3, "ntype": str($arg)})}; #set $arg_array += ["arg"+str(count)] #set $count = $count + 1 #if $arg_idx > 0 if (!ok) { ok = true; break; } #end if #end while #set $arg_list = ", ".join($arg_array) #end if #if $is_constructor cobj = new ${namespaced_class_name}(${arg_list}); #if not $generator.script_control_cpp cocos2d::Ref *_ccobj = dynamic_cast<cocos2d::Ref *>(cobj); if (_ccobj) { _ccobj->autorelease(); } #end if TypeTest<${namespaced_class_name}> t; js_type_class_t *typeClass = nullptr; std::string typeName = t.s_name(); auto typeMapIter = _js_global_type_map.find(typeName); CCASSERT(typeMapIter != _js_global_type_map.end(), "Can't find the class type!"); typeClass = typeMapIter->second; CCASSERT(typeClass, "The value is null."); obj = JS_NewObject(cx, typeClass->jsclass, typeClass->proto, typeClass->parentProto); js_proxy_t* p = jsb_new_proxy(cobj, obj); #if not $generator.script_control_cpp JS_AddNamedObjectRoot(cx, &p->obj, "${namespaced_class_name}"); #end if #else #if str($func.ret_type) != "void" #if $func.ret_type.is_enum int ret = (int)cobj->${func.func_name}($arg_list); #else ${func.ret_type.get_whole_name($generator)} ret = cobj->${func.func_name}($arg_list); #end if jsval jsret = JSVAL_NULL; ${func.ret_type.from_native({"generator": $generator, "in_value": "ret", "out_value": "jsret", "ntype": str($func.ret_type), "level": 2})}; JS_SET_RVAL(cx, vp, jsret); #else cobj->${func.func_name}($arg_list); JS_SET_RVAL(cx, vp, JSVAL_VOID); #end if return true; #end if } } while(0); #set $arg_idx = $arg_idx + 1 #end while #end if #end for #if $is_constructor if (cobj) { JS_SET_RVAL(cx, vp, OBJECT_TO_JSVAL(obj)); return true; } #end if JS_ReportError(cx, "${signature_name} : wrong number of arguments"); return false; }
/* * Cogl * * A Low Level GPU Graphics and Utilities API * * Copyright (C) 2012 Intel Corporation. * * Permission is hereby granted, free of charge, to any person * obtaining a copy of this software and associated documentation * files (the "Software"), to deal in the Software without * restriction, including without limitation the rights to use, copy, * modify, merge, publish, distribute, sublicense, and/or sell copies * of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. * * * * Authors: * Robert Bragg <robert@linux.intel.com> */ #ifndef _COGL_FRAMEBUFFER_NOP_PRIVATE_H_ #define _COGL_FRAMEBUFFER_NOP_PRIVATE_H_ #include "cogl-types.h" #include "cogl-context-private.h" CoglBool _cogl_offscreen_nop_allocate (CoglOffscreen *offscreen, CoglError **error); void _cogl_offscreen_nop_free (CoglOffscreen *offscreen); void _cogl_framebuffer_nop_flush_state (CoglFramebuffer *draw_buffer, CoglFramebuffer *read_buffer, CoglFramebufferState state); void _cogl_framebuffer_nop_clear (CoglFramebuffer *framebuffer, unsigned long buffers, float red, float green, float blue, float alpha); void _cogl_framebuffer_nop_query_bits (CoglFramebuffer *framebuffer, CoglFramebufferBits *bits); void _cogl_framebuffer_nop_finish (CoglFramebuffer *framebuffer); void _cogl_framebuffer_nop_discard_buffers (CoglFramebuffer *framebuffer, unsigned long buffers); void _cogl_framebuffer_nop_draw_attributes (CoglFramebuffer *framebuffer, CoglPipeline *pipeline, CoglVerticesMode mode, int first_vertex, int n_vertices, CoglAttribute **attributes, int n_attributes, CoglDrawFlags flags); void _cogl_framebuffer_nop_draw_indexed_attributes (CoglFramebuffer *framebuffer, CoglPipeline *pipeline, CoglVerticesMode mode, int first_vertex, int n_vertices, CoglIndices *indices, CoglAttribute **attributes, int n_attributes, CoglDrawFlags flags); CoglBool _cogl_framebuffer_nop_read_pixels_into_bitmap (CoglFramebuffer *framebuffer, int x, int y, CoglReadPixelsFlags source, CoglBitmap *bitmap, CoglError **error); #endif /* _COGL_FRAMEBUFFER_NOP_PRIVATE_H_ */
/* * platform_switch_mid.c: switch_mid platform data initilization file * * (C) Copyright 2008 Intel Corporation * Author: * * 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; version 2 * of the License. */ #include <linux/input.h> #include <linux/init.h> #include <linux/kernel.h> #include <linux/gpio.h> #include <linux/platform_device.h> #include <linux/lnw_gpio.h> #include <asm/intel-mid.h> #include "platform_switch_mid.h" static struct platform_device switch_device = { .name = DEVICE_NAME, .id = -1, }; #ifdef CONFIG_SWITCH_DOCK static struct platform_device switch_dock_device = { .name = "switch-dock", .id = -1, }; #endif static char *wm_codecs[] = {"wm5102"}; static int __init sfi_parse_check_wm(struct sfi_table_header *table) { struct sfi_table_simple *sb; struct sfi_device_table_entry *pentry; int num, i, j; sb = (struct sfi_table_simple *)table; num = SFI_GET_NUM_ENTRIES(sb, struct sfi_device_table_entry); pentry = (struct sfi_device_table_entry *) sb->pentry; for (i = 0; i < num; i++, pentry++) { for (j = 0; j < ARRAY_SIZE(wm_codecs); j++) { if (!strncmp(pentry->name, wm_codecs[j], SFI_NAME_LEN)) return 1; } } return 0; } static int __init switch_mid_init(void) { int err; err = sfi_table_parse(SFI_SIG_DEVS, NULL, NULL, sfi_parse_check_wm); if (err) { pr_info("This board uses wm codec, not loading switch-mid\n"); return 0; } err = platform_device_register(&switch_device); if (err < 0) pr_err("Fail to register switch-mid platform device.\n"); #ifdef CONFIG_SWITCH_DOCK err = platform_device_register(&switch_dock_device); if (err < 0) pr_err("Fail to register switch-dock platform device.\n"); #endif return 0; } device_initcall(switch_mid_init);
// SPDX-License-Identifier: GPL-2.0+ /* * rcar-fcp.c -- R-Car Frame Compression Processor Driver * * Copyright (C) 2016 Renesas Electronics Corporation * * Contact: Laurent Pinchart (laurent.pinchart@ideasonboard.com) */ #include <linux/device.h> #include <linux/list.h> #include <linux/module.h> #include <linux/mutex.h> #include <linux/platform_device.h> #include <linux/pm_runtime.h> #include <linux/slab.h> #include <media/rcar-fcp.h> struct rcar_fcp_device { struct list_head list; struct device *dev; }; static LIST_HEAD(fcp_devices); static DEFINE_MUTEX(fcp_lock); /* ----------------------------------------------------------------------------- * Public API */ /** * rcar_fcp_get - Find and acquire a reference to an FCP instance * @np: Device node of the FCP instance * * Search the list of registered FCP instances for the instance corresponding to * the given device node. * * Return a pointer to the FCP instance, or an ERR_PTR if the instance can't be * found. */ struct rcar_fcp_device *rcar_fcp_get(const struct device_node *np) { struct rcar_fcp_device *fcp; mutex_lock(&fcp_lock); list_for_each_entry(fcp, &fcp_devices, list) { if (fcp->dev->of_node != np) continue; get_device(fcp->dev); goto done; } fcp = ERR_PTR(-EPROBE_DEFER); done: mutex_unlock(&fcp_lock); return fcp; } EXPORT_SYMBOL_GPL(rcar_fcp_get); /** * rcar_fcp_put - Release a reference to an FCP instance * @fcp: The FCP instance * * Release the FCP instance acquired by a call to rcar_fcp_get(). */ void rcar_fcp_put(struct rcar_fcp_device *fcp) { if (fcp) put_device(fcp->dev); } EXPORT_SYMBOL_GPL(rcar_fcp_put); struct device *rcar_fcp_get_device(struct rcar_fcp_device *fcp) { return fcp->dev; } EXPORT_SYMBOL_GPL(rcar_fcp_get_device); /** * rcar_fcp_enable - Enable an FCP * @fcp: The FCP instance * * Before any memory access through an FCP is performed by a module, the FCP * must be enabled by a call to this function. The enable calls are reference * counted, each successful call must be followed by one rcar_fcp_disable() * call when no more memory transfer can occur through the FCP. * * Return 0 on success or a negative error code if an error occurs. The enable * reference count isn't increased when this function returns an error. */ int rcar_fcp_enable(struct rcar_fcp_device *fcp) { int ret; if (!fcp) return 0; ret = pm_runtime_get_sync(fcp->dev); if (ret < 0) return ret; return 0; } EXPORT_SYMBOL_GPL(rcar_fcp_enable); /** * rcar_fcp_disable - Disable an FCP * @fcp: The FCP instance * * This function is the counterpart of rcar_fcp_enable(). As enable calls are * reference counted a disable call may not disable the FCP synchronously. */ void rcar_fcp_disable(struct rcar_fcp_device *fcp) { if (fcp) pm_runtime_put(fcp->dev); } EXPORT_SYMBOL_GPL(rcar_fcp_disable); /* ----------------------------------------------------------------------------- * Platform Driver */ static int rcar_fcp_probe(struct platform_device *pdev) { struct rcar_fcp_device *fcp; fcp = devm_kzalloc(&pdev->dev, sizeof(*fcp), GFP_KERNEL); if (fcp == NULL) return -ENOMEM; fcp->dev = &pdev->dev; pm_runtime_enable(&pdev->dev); mutex_lock(&fcp_lock); list_add_tail(&fcp->list, &fcp_devices); mutex_unlock(&fcp_lock); platform_set_drvdata(pdev, fcp); return 0; } static int rcar_fcp_remove(struct platform_device *pdev) { struct rcar_fcp_device *fcp = platform_get_drvdata(pdev); mutex_lock(&fcp_lock); list_del(&fcp->list); mutex_unlock(&fcp_lock); pm_runtime_disable(&pdev->dev); return 0; } static const struct of_device_id rcar_fcp_of_match[] = { { .compatible = "renesas,fcpf" }, { .compatible = "renesas,fcpv" }, { }, }; MODULE_DEVICE_TABLE(of, rcar_fcp_of_match); static struct platform_driver rcar_fcp_platform_driver = { .probe = rcar_fcp_probe, .remove = rcar_fcp_remove, .driver = { .name = "rcar-fcp", .of_match_table = rcar_fcp_of_match, .suppress_bind_attrs = true, }, }; module_platform_driver(rcar_fcp_platform_driver); MODULE_ALIAS("rcar-fcp"); MODULE_AUTHOR("Laurent Pinchart <laurent.pinchart@ideasonboard.com>"); MODULE_DESCRIPTION("Renesas FCP Driver"); MODULE_LICENSE("GPL");
/************************************************************************************* Grid physics library, www.github.com/paboyle/Grid Source file: ./lib/PerfCount.h Copyright (C) 2015 Author: Azusa Yamaguchi <ayamaguc@staffmail.ed.ac.uk> Author: Peter Boyle <peterboyle@MacBook-Pro.local> Author: paboyle <paboyle@ph.ed.ac.uk> This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. See the full license in the file "LICENSE" in the top level distribution directory *************************************************************************************/ /* END LEGAL */ #ifndef GRID_PERFCOUNT_H #define GRID_PERFCOUNT_H #include <sys/time.h> #include <ctime> #include <chrono> #include <string.h> #include <unistd.h> #include <sys/ioctl.h> #ifdef __linux__ #include <syscall.h> #include <linux/perf_event.h> #else #include <sys/syscall.h> #endif #ifdef __x86_64__ #ifdef GRID_CUDA accelerator_inline uint64_t __rdtsc(void) { return 0; } accelerator_inline uint64_t __rdpmc(int ) { return 0; } #else #include <x86intrin.h> #endif #endif NAMESPACE_BEGIN(Grid); #ifdef __linux__ static long perf_event_open(struct perf_event_attr *hw_event, pid_t pid, int cpu, int group_fd, unsigned long flags) { int ret=0; ret = syscall(__NR_perf_event_open, hw_event, pid, cpu, group_fd, flags); return ret; } #endif #ifdef TIMERS_OFF inline uint64_t cyclecount(void){ return 0; } #define __SSC_MARK(mark) __asm__ __volatile__ ("movl %0, %%ebx; .byte 0x64, 0x67, 0x90 " ::"i"(mark):"%ebx") #define __SSC_STOP __SSC_MARK(0x110) #define __SSC_START __SSC_MARK(0x111) #else #define __SSC_MARK(mark) #define __SSC_STOP #define __SSC_START /* * cycle counters arch dependent */ #ifdef __bgq__ inline uint64_t cyclecount(void){ uint64_t tmp; asm volatile ("mfspr %0,0x10C" : "=&r" (tmp) ); return tmp; } #elif defined __x86_64__ inline uint64_t cyclecount(void){ uint64_t ret = __rdtsc(); return (uint64_t)ret; } #else inline uint64_t cyclecount(void){ return 0; } #endif #endif class PerformanceCounter { private: typedef struct { uint32_t type; uint64_t config; const char *name; int normalisation; } PerformanceCounterConfig; static const PerformanceCounterConfig PerformanceCounterConfigs []; public: enum PerformanceCounterType { CACHE_REFERENCES=0, CACHE_MISSES=1, CPUCYCLES=2, INSTRUCTIONS=3, L1D_READ_ACCESS=4, PERFORMANCE_COUNTER_NUM_TYPES=19 }; public: int PCT; long long count; long long cycles; int fd; int cyclefd; unsigned long long elapsed; uint64_t begin; static int NumTypes(void){ return PERFORMANCE_COUNTER_NUM_TYPES; } PerformanceCounter(int _pct) { #ifdef __linux__ assert(_pct>=0); assert(_pct<PERFORMANCE_COUNTER_NUM_TYPES); fd=-1; cyclefd=-1; count=0; cycles=0; PCT =_pct; Open(); #endif } void Open(void) { #ifdef __linux__ struct perf_event_attr pe; memset(&pe, 0, sizeof(struct perf_event_attr)); pe.size = sizeof(struct perf_event_attr); pe.disabled = 1; pe.exclude_kernel = 1; pe.exclude_hv = 1; pe.inherit = 1; pe.type = PerformanceCounterConfigs[PCT].type; pe.config= PerformanceCounterConfigs[PCT].config; const char * name = PerformanceCounterConfigs[PCT].name; fd = perf_event_open(&pe, 0, -1, -1, 0); // pid 0, cpu -1 current process any cpu. group -1 if (fd == -1) { fprintf(stderr, "Error opening leader %llx for event %s\n",(long long) pe.config,name); perror("Error is"); } int norm = PerformanceCounterConfigs[PCT].normalisation; pe.type = PerformanceCounterConfigs[norm].type; pe.config= PerformanceCounterConfigs[norm].config; name = PerformanceCounterConfigs[norm].name; cyclefd = perf_event_open(&pe, 0, -1, -1, 0); // pid 0, cpu -1 current process any cpu. group -1 if (cyclefd == -1) { fprintf(stderr, "Error opening leader %llx for event %s\n",(long long) pe.config,name); perror("Error is"); } #endif } void Start(void) { #ifdef __linux__ if ( fd!= -1) { ::ioctl(fd, PERF_EVENT_IOC_RESET, 0); ::ioctl(fd, PERF_EVENT_IOC_ENABLE, 0); ::ioctl(cyclefd, PERF_EVENT_IOC_RESET, 0); ::ioctl(cyclefd, PERF_EVENT_IOC_ENABLE, 0); } begin =cyclecount(); #else begin = 0; #endif } void Stop(void) { count=0; cycles=0; #ifdef __linux__ ssize_t ign; if ( fd!= -1) { ::ioctl(fd, PERF_EVENT_IOC_DISABLE, 0); ::ioctl(cyclefd, PERF_EVENT_IOC_DISABLE, 0); ign=::read(fd, &count, sizeof(long long)); ign+=::read(cyclefd, &cycles, sizeof(long long)); assert(ign==2*sizeof(long long)); } elapsed = cyclecount() - begin; #else elapsed = 0; #endif } void Report(void) { #ifdef __linux__ int N = PerformanceCounterConfigs[PCT].normalisation; const char * sn = PerformanceCounterConfigs[N].name ; const char * sc = PerformanceCounterConfigs[PCT].name; std::printf("tsc = %llu %s = %llu %s = %20llu\n (%s/%s) rate = %lf\n", elapsed,sn ,cycles, sc, count, sc,sn, (double)count/(double)cycles); #else std::printf("%llu cycles \n", elapsed ); #endif } ~PerformanceCounter() { #ifdef __linux__ ::close(fd); ::close(cyclefd); #endif } }; NAMESPACE_END(Grid); #endif
///////////////////////////////////////////////////////////////////////////// // Name: wx/sound.h // Purpose: wxSoundBase class // Author: Vaclav Slavik // Modified by: // Created: 2004/02/01 // RCS-ID: $Id: sound.h 61508 2009-07-23 20:30:22Z VZ $ // Copyright: (c) 2004, Vaclav Slavik // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// #ifndef _WX_SOUND_H_BASE_ #define _WX_SOUND_H_BASE_ #include "wx/defs.h" #if wxUSE_SOUND #include "wx/object.h" // ---------------------------------------------------------------------------- // wxSoundBase: common wxSound code and interface // ---------------------------------------------------------------------------- // Flags for wxSound::Play // NB: We can't use enum with some compilers, because they keep reporting // nonexistent ambiguities between Play(unsigned) and static Play(const // wxString&, unsigned). #define wxSOUND_SYNC ((unsigned)0) #define wxSOUND_ASYNC ((unsigned)1) #define wxSOUND_LOOP ((unsigned)2) // Base class for wxSound implementations class WXDLLIMPEXP_ADV wxSoundBase : public wxObject { public: // Play the sound: bool Play(unsigned flags = wxSOUND_ASYNC) const { wxASSERT_MSG( (flags & wxSOUND_LOOP) == 0 || (flags & wxSOUND_ASYNC) != 0, wxT("sound can only be looped asynchronously") ); return DoPlay(flags); } // Plays sound from filename: static bool Play(const wxString& filename, unsigned flags = wxSOUND_ASYNC); protected: virtual bool DoPlay(unsigned flags) const = 0; }; // ---------------------------------------------------------------------------- // wxSound class implementation // ---------------------------------------------------------------------------- #if defined(__WXMSW__) #include "wx/msw/sound.h" #elif defined(__WXCOCOA__) #include "wx/cocoa/sound.h" #elif defined(__WXMAC__) #include "wx/osx/sound.h" #elif defined(__WXPM__) #include "wx/os2/sound.h" #elif defined(__UNIX__) #include "wx/unix/sound.h" #endif // ---------------------------------------------------------------------------- // wxSoundBase methods // ---------------------------------------------------------------------------- inline bool wxSoundBase::Play(const wxString& filename, unsigned flags) { wxSound snd(filename); return snd.IsOk() ? snd.Play(flags) : false; } #endif // wxUSE_SOUND #endif // _WX_SOUND_H_BASE_
/* KSysGuard, the KDE System Guard Copyright (c) 1999 Chris Schlaeger <cs@kde.org> Solaris support by Torsten Kasch <tk@Genetik.Uni-Bielefeld.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 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifndef _NetDev_h_ #define _NetDev_h_ void initNetDev(struct SensorModul *sm); void exitNetDev(void); int updateNetDev(void); void printIPacketsInfo(const char *cmd); void printIPackets(const char *cmd); void printOPacketsInfo(const char *cmd); void printOPackets(const char *cmd); void printIErrorsInfo(const char *cmd); void printIErrors(const char *cmd); void printOErrorsInfo(const char *cmd); void printOErrors(const char *cmd); void printCollisionsInfo(const char *cmd); void printCollisions(const char *cmd); void printMultiXmitsInfo(const char *cmd); void printMultiXmits(const char *cmd); void printMultiRecvsInfo(const char *cmd); void printMultiRecvs(const char *cmd); void printBcastXmitsInfo(const char *cmd); void printBcastXmits(const char *cmd); void printBcastRecvsInfo(const char *cmd); void printBcastRecvs(const char *cmd); #endif /* _NetDev_h */
/* * Copyright (c) 2012 NVIDIA Corporation. All rights reserved. * * NVIDIA Corporation and its licensors retain all intellectual property * and proprietary rights in and to this software, related documentation * and any modifications thereto. Any use, reproduction, disclosure or * distribution of this software and related documentation without an express * license agreement from NVIDIA Corporation is strictly prohibited. */ #ifndef INCLUDED_NVODM_QUERY_PINMUX_GPIO_H #define INCLUDED_NVODM_QUERY_PINMUX_GPIO_H /** * Board personalities describe different topologies for * externally attached peripherals (devices attached outside of * the SOC). Changing a personality is the equivalent of * re-wiring the target hardware (even if this is achieved via * some clever switching mechanisms on a single target device). * The way in which these topologies are rewired is entirely * dependent on the board implementation. * * The ODM Kit treats different personalities as if they were * different boards (or product SKUs). Therefore, it is * necessary to recompile the ODM Kit whenever the personality * configuration is changed (via DIP switches, etc...). * * For the reference implementation, board-specific personality * definitions are shared between ODM pin-mux and ODM gpio * implementations. The following definitions only apply to * development systems with E920 (Vail) and E915 (Concorde) * motherboards. */ typedef enum { NvOdmQueryBoardPersonality_ScrollWheel_WiFi = 0x01, // Personality 1 NvOdmQueryBoardPersonality_Force32 = 0x7FFFFFFF, } NvOdmQueryBoardPersonality; /** * Defines the current board personality (default is 3) */ #define NVODM_QUERY_BOARD_PERSONALITY 0x01 #endif // INCLUDED_NVODM_QUERY_PINMUX_GPIO_H
/* * This file is part of libsidplayfp, a SID player engine. * * Copyright 2011-2014 Leandro Nini <drfiemost@users.sourceforge.net> * Copyright 2007-2010 Antti Lankila * Copyright 2001 Simon White * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifndef RESIDFP_EMU_H #define RESIDFP_EMU_H #include <stdint.h> #include "residfp/SID.h" #include "sidplayfp/SidConfig.h" #include "sidemu.h" #include "sidplayfp/event.h" class sidbuilder; #define RESID_NAMESPACE reSIDfp class ReSIDfp: public sidemu { private: RESID_NAMESPACE::SID &m_sid; public: static const char* getCredits(); public: ReSIDfp(sidbuilder *builder); ~ReSIDfp(); // Standard component functions void reset() { sidemu::reset (); } void reset(uint8_t volume); uint8_t read(uint_least8_t addr); void write(uint_least8_t addr, uint8_t data); // Standard SID functions void clock(); void filter(bool enable); void voice(unsigned int num, bool mute) { m_sid.mute(num, mute); } bool getStatus() const { return m_status; } // Specific to resid void sampling(float systemclock, float freq, SidConfig::sampling_method_t method, bool fast); void filter6581Curve(double filterCurve); void filter8580Curve(double filterCurve); void model(SidConfig::sid_model_t model); }; #endif // RESIDFP_EMU_H
//================================================================================================= //Copyright (C) 2015, Joscha Fossel // //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 //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 SDF_SLAM_2D_UTILITYFUNCTIONS_H #define SDF_SLAM_2D_UTILITYFUNCTIONS_H #include "Types.h" #include <cmath> #include <Eigen/Geometry> #include "ros/ros.h" namespace util{ static pcl::PointXYZ genPoint(double xPos, double yPos){ sdfslam::PointType point; point.x = (float) xPos; point.y = (float) yPos; point.z = 0; return point; } static double round(double Zahl, unsigned int Stellen) { Zahl *= pow(10, Stellen); if (Zahl >= 0) floor(Zahl + 0.5); else ceil(Zahl - 0.5); Zahl /= pow(10, Stellen); return Zahl; } inline float xVal(float y, float m, float b) { if (m != 0) return (y - b) / m; else ROS_ERROR("div by 0"); return 0; } inline float yVal(float x, float m, float b) { return m * x + b; } inline float p2pDist(float p1x, float p1y, float* p2){ return sqrt( (p1x-p2[0])*(p1x-p2[0])+(p1y-p2[1])*(p1y-p2[1]) ); } inline float p2pDist(float* p1, float* p2){ return sqrt( (p1[0]-p2[0])*(p1[0]-p2[0])+(p1[1]-p2[1])*(p1[1]-p2[1]) ); } inline float p2pDist(float p1x, float p1y, float p2x, float p2y){ return sqrt( (p1x-p2x)*(p1x-p2x)+(p1y-p2y)*(p1y-p2y) ); } inline float p2lDist(float m, float b, const Eigen::Vector2f& p1){ return ( fabs(p1.y() - m*p1.x() - b)/sqrt(m*m+1) ); } inline float p2lDist(float m, float b, const float* p1){ return ( fabs(p1[1] - m*p1[0] - b)/sqrt(m*m+1) ); } inline Eigen::Vector2f toMap(double p_grid_res_, int p_map_size_x_, int p_map_size_y_, const Eigen::Vector2f& x){ return ( x/p_grid_res_ + Eigen::Vector2f(p_map_size_x_/2, p_map_size_y_/2) ); } inline float toMap(const float& x, const double& p_grid_res_, const int& s){ return (x/p_grid_res_+s/2); } inline void toMap(float* x, const double& p_grid_res, const int& p_map_size_x, const int& p_map_size_y){ x[0] = x[0]/p_grid_res + p_map_size_x/2; x[1] = x[1]/p_grid_res + p_map_size_y/2; } inline void toMap(double* x, const double& p_grid_res, const int& p_map_size_x, const int& p_map_size_y){ x[0] = x[0]/p_grid_res + p_map_size_x/2; x[1] = x[1]/p_grid_res + p_map_size_y/2; } inline Eigen::Vector2f toRl(const Eigen::Vector2f& x, double p_grid_res, int p_map_size_x, int p_map_size_y){ return ( (x-Eigen::Vector2f(p_map_size_x/2, p_map_size_y/2) ) * p_grid_res); } inline void toRl(double* x, double p_grid_res, int p_map_size_x, int p_map_size_y){ x[0] = (x[0]-p_map_size_x/2) * p_grid_res; x[1] = (x[1]-p_map_size_y/2) * p_grid_res; } inline void toRl(float* x, double p_grid_res, int p_map_size_x, int p_map_size_y){ x[0] = (float) ((x[0]-p_map_size_x/2) * p_grid_res); x[1] = (float) ((x[1]-p_map_size_y/2) * p_grid_res); } //return 0 if orthogonal projection not in cell static float p2lsDistTwo(double p_reg_threshold_, float *v, float *w, float *p) { // Return minimum distance between line segment vw and point p const float l2 = (w[0] - v[0]) * (w[0] - v[0]) + (w[1] - v[1]) * (w[1] - v[1]); // i.e. |w-v|^2 - avoid a sqrt if (l2 == 0.0) return p2pDist(p, v); // v == w case // Consider the line extending the segment, parameterized as v + t (w - v). // We find projection of point p onto the line. // It falls where t = [(p-v) . (w-v)] / |w-v|^2 const float t = ((p[0] - v[0]) * (w[0] - v[0]) + (p[1] - v[1]) * (w[1] - v[1])) / l2; if (t <= 0.0 - p_reg_threshold_) return 0.0; // Beyond the 'v' end of the segment else if (t >= 1.0 + p_reg_threshold_) return 0.0; // Beyond the 'w' end of the segment float projection[2] = {(v[0] + t * (w[0] - v[0])), (v[1] + t * (w[1] - v[1]))}; // Projection falls on the segment return p2pDist(p, projection); } static float p2lsDist(float* v, float* w, float* p){ // Return minimum distance between line segment vw and point p const float l2 = (w[0]-v[0])*(w[0]-v[0]) + (w[1]-v[1])*(w[1]-v[1]); // i.e. |w-v|^2 - avoid a sqrt if (l2 == 0.0) return p2pDist(p, v); // v == w case // Consider the line extending the segment, parameterized as v + t (w - v). // We find projection of point p onto the line. // It falls where t = [(p-v) . (w-v)] / |w-v|^2 const float t = ( (p[0] - v[0]) * (w[0] - v[0]) + (p[1] - v[1]) * (w[1] - v[1]) ) / l2; if (t < 0.0) return p2pDist(p, v); // Beyond the 'v' end of the segment else if (t > 1.0) return p2pDist(p, w); // Beyond the 'w' end of the segment float projection[2] = { (v[0] + t * (w[0] - v[0]) ), (v[1] + t * (w[1] - v[1])) }; // Projection falls on the segment return p2pDist(p, projection); } } #endif //SDF_SLAM_2D_UTILITYFUNCTIONS_H
//============================================================================= // MuseScore // Music Composition & Notation // $Id: repeatlist.h 4554 2011-07-19 18:52:22Z wschweer $ // // Copyright (C) 2009-2011 Werner Schweer // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License version 2 // as published by the Free Software Foundation and appearing in // the file LICENCE.GPL //============================================================================= #ifndef __REPEATLIST_H__ #define __REPEATLIST_H__ class Score; class Measure; //--------------------------------------------------------- // RepeatSegment //--------------------------------------------------------- class RepeatSegment { public: int tick; // start tick int len; int utick; qreal utime; qreal timeOffset; RepeatSegment(); }; //--------------------------------------------------------- // RepeatList //--------------------------------------------------------- class RepeatList: public QList<RepeatSegment*> { Score* _score; mutable unsigned idx1, idx2; // cached values RepeatSegment* rs; // tmp value during unwind() Measure* jumpToStartRepeat(Measure*); public: RepeatList(Score* s); void unwind(); int utick2tick(int tick) const; int tick2utick(int tick) const; void dump() const; int utime2utick(qreal) const; qreal utick2utime(int) const; void update(); int ticks(); }; #endif
#pragma once RCSIDH(eap_leap_h, "$Id$") #include "eap.h" #define FR_LEAP_CHALLENGE 1 #define FR_LEAP_RESPONSE 2 #define FR_LEAP_SUCCESS 3 #define FR_LEAP_FAILURE 4 #define FR_LEAP_MAX_CODES 4 /* * Version + unused + count */ #define LEAP_HEADER_LEN 3 /* **** * EAP - LEAP does not specify code, id & length but chap specifies them, * for generalization purpose, complete header should be sent * and not just value_size, value and name. * future implementation. */ /* eap packet structure */ typedef struct leap_packet_raw_t { /* * EAP header, followed by type comes before this. */ uint8_t version; uint8_t unused; uint8_t count; uint8_t challenge[1]; /* 8 or 24, followed by user name */ } leap_packet_raw_t; /* * Which is decoded into this. */ typedef struct leap_packet { unsigned char code; unsigned char id; size_t length; int count; unsigned char *challenge; size_t name_len; char *name; } leap_packet_t; /* * The information which must be kept around * during the LEAP session. */ typedef struct leap_session_t { int stage; uint8_t peer_challenge[8]; uint8_t peer_response[24]; } leap_session_t; extern fr_dict_attr_t const *attr_cleartext_password; extern fr_dict_attr_t const *attr_nt_password; extern fr_dict_attr_t const *attr_cisco_avpair; extern fr_dict_attr_t const *attr_user_password; /* function declarations here */ int eap_leap_compose(REQUEST *request, eap_round_t *auth, leap_packet_t *reply); leap_packet_t *eap_leap_extract(REQUEST *request, eap_round_t *eap_round); leap_packet_t *eap_leap_initiate(REQUEST *request, eap_round_t *eap_round, VALUE_PAIR *user_name); int eap_leap_stage4(REQUEST *request, leap_packet_t *packet, VALUE_PAIR* password, leap_session_t *session); leap_packet_t *eap_leap_stage6(REQUEST *request, leap_packet_t *packet, VALUE_PAIR *user_name, VALUE_PAIR* password, leap_session_t *session); void eap_leap_mschap(unsigned char const *win_password, unsigned char const *challenge, unsigned char *response);
void cyttsp5_presspwr(void); void cyttsp5_vibrate(int value); void cyttsp5_enableSensors(void); void cyttsp5_startSensors(void); void cyttsp5_stopSensors(void); void cyttsp5_syncSensors(void * mt_data);
/* * (C) Copyright 2013 Xilinx, Inc. * * Configuration settings for the Xilinx Zynq ZC770 board. * See zynq-common.h for Zynq common configs * * SPDX-License-Identifier: GPL-2.0+ */ #ifndef __CONFIG_ZYNQ_ZC770_H #define __CONFIG_ZYNQ_ZC770_H #define CONFIG_SYS_SDRAM_SIZE (1024 * 1024 * 1024) #define CONFIG_SYS_NO_FLASH #if defined(CONFIG_ZC770_XM010) # define CONFIG_ZYNQ_SERIAL_UART1 # define CONFIG_ZYNQ_GEM0 # define CONFIG_ZYNQ_GEM_PHY_ADDR0 7 # define CONFIG_ZYNQ_SDHCI0 # define CONFIG_ZYNQ_SPI #elif defined(CONFIG_ZC770_XM011) # define CONFIG_ZYNQ_SERIAL_UART1 #elif defined(CONFIG_ZC770_XM012) # define CONFIG_ZYNQ_SERIAL_UART1 # undef CONFIG_SYS_NO_FLASH #elif defined(CONFIG_ZC770_XM013) # define CONFIG_ZYNQ_SERIAL_UART0 # define CONFIG_ZYNQ_GEM1 # define CONFIG_ZYNQ_GEM_PHY_ADDR1 7 #else # define CONFIG_ZYNQ_SERIAL_UART0 #endif #include <configs/zynq-common.h> #endif /* __CONFIG_ZYNQ_ZC770_H */
/* * APEI Error Record Serialization Table debug support * * ERST is a way provided by APEI to save and retrieve hardware error * information to and from a persistent store. This file provide the * debugging/testing support for ERST kernel support and firmware * implementation. * * Copyright 2010 Intel Corp. * Author: Huang Ying <ying.huang@intel.com> * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License version * 2 as published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include <linux/kernel.h> #include <linux/module.h> #include <linux/uaccess.h> #include <acpi/apei.h> #include <linux/miscdevice.h> #include "apei-internal.h" #define ERST_DBG_PFX "ERST DBG: " #define ERST_DBG_RECORD_LEN_MAX 0x4000 static void *erst_dbg_buf; static unsigned int erst_dbg_buf_len; /* Prevent erst_dbg_read/write from being invoked concurrently */ static DEFINE_MUTEX(erst_dbg_mutex); static int erst_dbg_open(struct inode *inode, struct file *file) { int rc, *pos; if (erst_disable) return -ENODEV; pos = (int *)&file->private_data; rc = erst_get_record_id_begin(pos); if (rc) return rc; return nonseekable_open(inode, file); } static int erst_dbg_release(struct inode *inode, struct file *file) { erst_get_record_id_end(); return 0; } static long erst_dbg_ioctl(struct file *f, unsigned int cmd, unsigned long arg) { int rc; u64 record_id; u32 record_count; switch (cmd) { case APEI_ERST_CLEAR_RECORD: rc = copy_from_user(&record_id, (void __user *)arg, sizeof(record_id)); if (rc) return -EFAULT; return erst_clear(record_id); case APEI_ERST_GET_RECORD_COUNT: rc = erst_get_record_count(); if (rc < 0) return rc; record_count = rc; rc = put_user(record_count, (u32 __user *)arg); if (rc) return rc; return 0; default: return -ENOTTY; } } static ssize_t erst_dbg_read(struct file *filp, char __user *ubuf, size_t usize, loff_t *off) { int rc, *pos; ssize_t len = 0; u64 id; if (*off) return -EINVAL; if (mutex_lock_interruptible(&erst_dbg_mutex) != 0) return -EINTR; pos = (int *)&filp->private_data; retry_next: rc = erst_get_record_id_next(pos, &id); if (rc) goto out; /* no more record */ if (id == APEI_ERST_INVALID_RECORD_ID) goto out; retry: rc = len = erst_read(id, erst_dbg_buf, erst_dbg_buf_len); /* The record may be cleared by others, try read next record */ if (rc == -ENOENT) goto retry_next; if (rc < 0) goto out; if (len > ERST_DBG_RECORD_LEN_MAX) { pr_warning(ERST_DBG_PFX "Record (ID: 0x%llx) length is too long: %zd\n", id, len); rc = -EIO; goto out; } if (len > erst_dbg_buf_len) { void *p; rc = -ENOMEM; p = kmalloc(len, GFP_KERNEL); if (!p) goto out; kfree(erst_dbg_buf); erst_dbg_buf = p; erst_dbg_buf_len = len; goto retry; } rc = -EINVAL; if (len > usize) goto out; rc = -EFAULT; if (copy_to_user(ubuf, erst_dbg_buf, len)) goto out; rc = 0; out: mutex_unlock(&erst_dbg_mutex); return rc ? rc : len; } static ssize_t erst_dbg_write(struct file *filp, const char __user *ubuf, size_t usize, loff_t *off) { int rc; struct cper_record_header *rcd; if (!capable(CAP_SYS_ADMIN)) return -EPERM; if (usize > ERST_DBG_RECORD_LEN_MAX) { pr_err(ERST_DBG_PFX "Too long record to be written\n"); return -EINVAL; } if (mutex_lock_interruptible(&erst_dbg_mutex)) return -EINTR; if (usize > erst_dbg_buf_len) { void *p; rc = -ENOMEM; p = kmalloc(usize, GFP_KERNEL); if (!p) goto out; kfree(erst_dbg_buf); erst_dbg_buf = p; erst_dbg_buf_len = usize; } rc = copy_from_user(erst_dbg_buf, ubuf, usize); if (rc) { rc = -EFAULT; goto out; } rcd = erst_dbg_buf; rc = -EINVAL; if (rcd->record_length != usize) goto out; rc = erst_write(erst_dbg_buf); out: mutex_unlock(&erst_dbg_mutex); return rc < 0 ? rc : usize; } static const struct file_operations erst_dbg_ops = { .owner = THIS_MODULE, .open = erst_dbg_open, .release = erst_dbg_release, .read = erst_dbg_read, .write = erst_dbg_write, .unlocked_ioctl = erst_dbg_ioctl, .llseek = no_llseek, }; static struct miscdevice erst_dbg_dev = { .minor = MISC_DYNAMIC_MINOR, .name = "erst_dbg", .fops = &erst_dbg_ops, }; static __init int erst_dbg_init(void) { if (erst_disable) { pr_info(ERST_DBG_PFX "ERST support is disabled.\n"); return -ENODEV; } return misc_register(&erst_dbg_dev); } static __exit void erst_dbg_exit(void) { misc_deregister(&erst_dbg_dev); kfree(erst_dbg_buf); } module_init(erst_dbg_init); module_exit(erst_dbg_exit); MODULE_AUTHOR("Huang Ying"); MODULE_DESCRIPTION("APEI Error Record Serialization Table debug support"); MODULE_LICENSE("GPL");
#include <linux/types.h> #include <linux/errno.h> #include <asm/uaccess.h> int fneg(u32 *frD, u32 *frB) { frD[0] = frB[0] ^ 0x80000000; frD[1] = frB[1]; #ifdef DEBUG printk("%s: D %p, B %p: ", __func__, frD, frB); dump_double(frD); printk("\n"); #endif return 0; }
/*************************************************************************** qgsprojectionselectionwidget.h -------------------------------------- Date : 05.01.2015 Copyright : (C) 2015 Denis Rouzaud Email : denis.rouzaud@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. * * * ***************************************************************************/ #ifndef QGSPROJECTIONSELECTIONWIDGET_H #define QGSPROJECTIONSELECTIONWIDGET_H #include <QWidget> #include "qgis_sip.h" #include <QLineEdit> #include <QToolButton> #include <QComboBox> #include "qgscoordinatereferencesystem.h" #include "qgis_gui.h" class QgsProjectionSelectionDialog; /** * \class QgsProjectionSelectionWidget * \ingroup gui * \brief A widget for selecting a projection. * \since QGIS 2.7 */ class GUI_EXPORT QgsProjectionSelectionWidget : public QWidget { Q_OBJECT public: /** * Predefined CRS options shown in widget */ enum CrsOption { LayerCrs, //!< Optional layer CRS ProjectCrs, //!< Current project CRS (if OTF reprojection enabled) CurrentCrs, //!< Current user selected CRS DefaultCrs, //!< Global default QGIS CRS RecentCrs, //!< Recently used CRS CrsNotSet, //!< Not set (hidden by default) }; //! Constructor for QgsProjectionSelectionWidget explicit QgsProjectionSelectionWidget( QWidget *parent SIP_TRANSFERTHIS = nullptr ); /** * Returns the currently selected CRS for the widget * \returns current CRS */ QgsCoordinateReferenceSystem crs() const; /** * Sets whether a predefined CRS option should be shown in the widget. * \param option CRS option to show/hide * \param visible whether the option should be shown * \see optionVisible() */ void setOptionVisible( CrsOption option, bool visible ); /** * Returns whether the specified CRS option is visible in the widget. * \see setOptionVisible() * \since QGIS 3.0 */ bool optionVisible( CrsOption option ) const; /** * Sets the text to show for the not set option. Note that this option is not shown * by default and must be set visible by calling setOptionVisible(). * \since QGIS 3.0 */ void setNotSetText( const QString &text ); /** * Sets a \a message to show in the dialog. If an empty string is * passed, the message will be a generic * 'define the CRS for this layer'. * \since QGIS 3.0 */ void setMessage( const QString &text ); signals: /** * Emitted when the selected CRS is changed */ void crsChanged( const QgsCoordinateReferenceSystem & ); /** * Emitted when the not set option is selected. * \since QGIS 3.0 */ void cleared(); public slots: /** * Sets the current CRS for the widget * \param crs new CRS */ void setCrs( const QgsCoordinateReferenceSystem &crs ); /** * Sets the layer CRS for the widget. If set, this will be added as an option * to the preset CRSes shown in the widget. * \param crs layer CRS */ void setLayerCrs( const QgsCoordinateReferenceSystem &crs ); /** * Opens the dialog for selecting a new CRS */ void selectCrs(); private: QgsCoordinateReferenceSystem mCrs; QgsCoordinateReferenceSystem mLayerCrs; QgsCoordinateReferenceSystem mProjectCrs; QgsCoordinateReferenceSystem mDefaultCrs; QComboBox *mCrsComboBox = nullptr; QToolButton *mButton = nullptr; QgsProjectionSelectionDialog *mDialog = nullptr; QString mNotSetText; QString mMessage; void addNotSetOption(); void addProjectCrsOption(); void addDefaultCrsOption(); void addCurrentCrsOption(); QString currentCrsOptionText( const QgsCoordinateReferenceSystem &crs ) const; void addRecentCrs(); bool crsIsShown( long srsid ) const; int firstRecentCrsIndex() const; private slots: void comboIndexChanged( int idx ); }; #endif // QGSPROJECTIONSELECTIONWIDGET_H
/* * Copyright 2012 (C), Jason Cooper <jason@lakedaemon.net> * * arch/arm/mach-kirkwood/board-dt.c * * Flattened Device Tree board initialization * * This file is licensed under the terms of the GNU General Public * License version 2. This program is licensed "as is" without any * warranty of any kind, whether express or implied. */ #include <linux/kernel.h> #include <linux/init.h> #include <linux/of.h> #include <linux/of_platform.h> #include <linux/clk-provider.h> #include <linux/clk/mvebu.h> #include <linux/kexec.h> #include <asm/mach/arch.h> #include <asm/mach/map.h> #include <mach/bridge-regs.h> #include <linux/platform_data/usb-ehci-orion.h> #include <plat/irq.h> #include <plat/common.h> #include "common.h" static struct of_device_id kirkwood_dt_match_table[] __initdata = { { .compatible = "simple-bus", }, { } }; /* * There are still devices that doesn't know about DT yet. Get clock * gates here and add a clock lookup alias, so that old platform * devices still work. */ static void __init kirkwood_legacy_clk_init(void) { struct device_node *np = of_find_compatible_node( NULL, NULL, "marvell,kirkwood-gating-clock"); struct of_phandle_args clkspec; clkspec.np = np; clkspec.args_count = 1; clkspec.args[0] = CGC_BIT_GE0; orion_clkdev_add(NULL, "mv643xx_eth_port.0", of_clk_get_from_provider(&clkspec)); clkspec.args[0] = CGC_BIT_PEX0; orion_clkdev_add("0", "pcie", of_clk_get_from_provider(&clkspec)); clkspec.args[0] = CGC_BIT_USB0; orion_clkdev_add(NULL, "orion-ehci.0", of_clk_get_from_provider(&clkspec)); clkspec.args[0] = CGC_BIT_PEX1; orion_clkdev_add("1", "pcie", of_clk_get_from_provider(&clkspec)); clkspec.args[0] = CGC_BIT_GE1; orion_clkdev_add(NULL, "mv643xx_eth_port.1", of_clk_get_from_provider(&clkspec)); clkspec.args[0] = CGC_BIT_SDIO; orion_clkdev_add(NULL, "mvsdio", of_clk_get_from_provider(&clkspec)); } static void __init kirkwood_of_clk_init(void) { mvebu_clocks_init(); kirkwood_legacy_clk_init(); } static void __init kirkwood_dt_init(void) { pr_info("Kirkwood: %s, TCLK=%d.\n", kirkwood_id(), kirkwood_tclk); /* * Disable propagation of mbus errors to the CPU local bus, * as this causes mbus errors (which can occur for example * for PCI aborts) to throw CPU aborts, which we're not set * up to deal with. */ writel(readl(CPU_CONFIG) & ~CPU_CONFIG_ERROR_PROP, CPU_CONFIG); kirkwood_setup_cpu_mbus(); kirkwood_l2_init(); /* Setup root of clk tree */ kirkwood_of_clk_init(); kirkwood_cpuidle_init(); #ifdef CONFIG_KEXEC kexec_reinit = kirkwood_enable_pcie; #endif if (of_machine_is_compatible("globalscale,dreamplug")) dreamplug_init(); if (of_machine_is_compatible("dlink,dns-kirkwood")) dnskw_init(); if (of_machine_is_compatible("iom,iconnect")) iconnect_init(); if (of_machine_is_compatible("raidsonic,ib-nas62x0")) ib62x0_init(); if (of_machine_is_compatible("qnap,ts219")) qnap_dt_ts219_init(); if (of_machine_is_compatible("seagate,dockstar")) dockstar_dt_init(); if (of_machine_is_compatible("seagate,goflexnet")) goflexnet_init(); if (of_machine_is_compatible("buffalo,lsxl")) lsxl_init(); if (of_machine_is_compatible("iom,ix2-200")) iomega_ix2_200_init(); if (of_machine_is_compatible("keymile,km_kirkwood")) km_kirkwood_init(); if (of_machine_is_compatible("lacie,inetspace_v2") || of_machine_is_compatible("lacie,netspace_v2") || of_machine_is_compatible("lacie,netspace_max_v2") || of_machine_is_compatible("lacie,netspace_lite_v2") || of_machine_is_compatible("lacie,netspace_mini_v2")) ns2_init(); if (of_machine_is_compatible("mpl,cec4")) mplcec4_init(); if (of_machine_is_compatible("plathome,openblocks-a6")) openblocks_a6_init(); if (of_machine_is_compatible("usi,topkick")) usi_topkick_init(); if (of_machine_is_compatible("zyxel,nsa310")) nsa310_init(); of_platform_populate(NULL, kirkwood_dt_match_table, NULL, NULL); } static const char * const kirkwood_dt_board_compat[] = { "globalscale,dreamplug", "dlink,dns-320", "dlink,dns-325", "iom,iconnect", "raidsonic,ib-nas62x0", "qnap,ts219", "seagate,dockstar", "seagate,goflexnet", "buffalo,lsxl", "iom,ix2-200", "keymile,km_kirkwood", "lacie,inetspace_v2", "lacie,netspace_max_v2", "lacie,netspace_v2", "lacie,netspace_lite_v2", "lacie,netspace_mini_v2", "mpl,cec4", "plathome,openblocks-a6", "usi,topkick", "zyxel,nsa310", NULL }; DT_MACHINE_START(KIRKWOOD_DT, "Marvell Kirkwood (Flattened Device Tree)") /* Maintainer: Jason Cooper <jason@lakedaemon.net> */ .map_io = kirkwood_map_io, .init_early = kirkwood_init_early, .init_irq = orion_dt_init_irq, .init_time = kirkwood_timer_init, .init_machine = kirkwood_dt_init, .restart = kirkwood_restart, .dt_compat = kirkwood_dt_board_compat, MACHINE_END
/*----------------------------------------------------------------------------- * TinyDetour.h *----------------------------------------------------------------------------- * *----------------------------------------------------------------------------- * All rights reserved by somma (fixbrain@gmail.com, unsorted@msn.com) *----------------------------------------------------------------------------- * - 2007.01.22 created **---------------------------------------------------------------------------*/ #ifndef _TINY_DETOUR_H_ #define _TINY_DETOUR_H_ #define WIN32_LEAN_AND_MEAN #include <Windows.h> #define INST_NOP 0x90 #define INST_CALL 0xe8 #define INST_JMP 0xe9 #define INST_JMP_SIZE 0x01 #define REL_32_SIZE sizeof(DWORD_PTR) // address ÀÇ »çÀÌÁî #define JMP_REL_32_SIZE (INST_JMP_SIZE + REL_32_SIZE) // jmp rel32 size #define MAX_PATCH_SIZE 0x0C typedef struct _TD_HOOK_INFO { BOOL Enabled; BYTE* Target; BYTE* Detour; BYTE* Trampoline; DWORD OriginalOpcodeLen; } TD_HOOK_INFO, *PTD_HOOK_INFO; int InjectDetour(TD_HOOK_INFO* pHookInfo); int EjectDetour(TD_HOOK_INFO* pHookInfo); //----------------------------------------------------------------------------- // theft from detours library 1.5 :-) // CDetourEnableWriteOnCodePage //----------------------------------------------------------------------------- class EnableWriteOnCodePage { public: EnableWriteOnCodePage(PBYTE pbCode, LONG cbCode) { m_pbCode = pbCode; m_cbCode = cbCode; m_dwOldPerm = 0; m_hProcess = GetCurrentProcess(); if (m_pbCode && m_cbCode) { if (!FlushInstructionCache(m_hProcess, pbCode, cbCode)) { return; } if (!VirtualProtect(pbCode, cbCode, PAGE_EXECUTE_READWRITE, &m_dwOldPerm)) { return; } } } ~EnableWriteOnCodePage() { if (m_dwOldPerm && m_pbCode && m_cbCode) { DWORD dwTemp = 0; if (!FlushInstructionCache(m_hProcess, m_pbCode, m_cbCode)) { return; } if (!VirtualProtect(m_pbCode, m_cbCode, m_dwOldPerm, &dwTemp)) { return; } } } BOOL SetPermission(DWORD dwPerms) { if (m_dwOldPerm && m_pbCode && m_cbCode) { m_dwOldPerm = dwPerms; return TRUE; } return FALSE; } BOOL IsValid(VOID) { return m_pbCode && m_cbCode && m_dwOldPerm; } private: HANDLE m_hProcess; PBYTE m_pbCode; LONG m_cbCode; DWORD m_dwOldPerm; }; #endif//_TINY_DETOUR_H_
/* Copyright (c) 2008-2012, Code Aurora Forum. All rights reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 and * only version 2 as published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * */ #ifndef MSM_FB_PANEL_H #define MSM_FB_PANEL_H #include "msm_fb_def.h" struct msm_fb_data_type; typedef void (*msm_fb_vsync_handler_type) (void *arg); /* panel id type */ typedef struct panel_id_s { uint16 id; uint16 type; } panel_id_type; /* panel type list */ #define NO_PANEL 0xffff /* No Panel */ #define MDDI_PANEL 1 /* MDDI */ #define EBI2_PANEL 2 /* EBI2 */ #define LCDC_PANEL 3 /* internal LCDC type */ #define EXT_MDDI_PANEL 4 /* Ext.MDDI */ #define TV_PANEL 5 /* TV */ #define HDMI_PANEL 6 /* HDMI TV */ #define DTV_PANEL 7 /* DTV */ #define MIPI_VIDEO_PANEL 8 /* MIPI */ #define MIPI_CMD_PANEL 9 /* MIPI */ #define WRITEBACK_PANEL 10 /* Wifi display */ #define LVDS_PANEL 11 /* LVDS */ /* panel class */ typedef enum { DISPLAY_LCD = 0, /* lcd = ebi2/mddi */ DISPLAY_LCDC, /* lcdc */ DISPLAY_TV, /* TV Out */ DISPLAY_EXT_MDDI, /* External MDDI */ } DISP_TARGET; /* panel device locaiton */ typedef enum { DISPLAY_1 = 0, /* attached as first device */ DISPLAY_2, /* attached on second device */ DISPLAY_3, /* attached on third writeback device */ MAX_PHYS_TARGET_NUM, } DISP_TARGET_PHYS; /* panel info type */ struct lcd_panel_info { __u32 vsync_enable; __u32 refx100; __u32 v_back_porch; __u32 v_front_porch; __u32 v_pulse_width; __u32 hw_vsync_mode; __u32 vsync_notifier_period; __u32 rev; }; struct lcdc_panel_info { __u32 h_back_porch; __u32 h_front_porch; __u32 h_pulse_width; __u32 v_back_porch; __u32 v_front_porch; __u32 v_pulse_width; __u32 border_clr; __u32 underflow_clr; __u32 hsync_skew; /* Pad width */ uint32 xres_pad; /* Pad height */ uint32 yres_pad; }; struct mddi_panel_info { __u32 vdopkt; boolean is_type1; }; struct mipi_panel_info { char mode; /* video/cmd */ char interleave_mode; char crc_check; char ecc_check; char dst_format; /* shared by video and command */ char data_lane0; char data_lane1; char data_lane2; char data_lane3; char dlane_swap; /* data lane swap */ char rgb_swap; char b_sel; char g_sel; char r_sel; char rx_eot_ignore; char tx_eot_append; char t_clk_post; /* 0xc0, DSI_CLKOUT_TIMING_CTRL */ char t_clk_pre; /* 0xc0, DSI_CLKOUT_TIMING_CTRL */ char vc; /* virtual channel */ struct mipi_dsi_phy_ctrl *dsi_phy_db; /* video mode */ char pulse_mode_hsa_he; char hfp_power_stop; char hbp_power_stop; char hsa_power_stop; char eof_bllp_power_stop; char bllp_power_stop; char traffic_mode; char frame_rate; /* command mode */ char interleave_max; char insert_dcs_cmd; char wr_mem_continue; char wr_mem_start; char te_sel; char stream; /* 0 or 1 */ char mdp_trigger; char dma_trigger; uint32 dsi_pclk_rate; /* byte to esc clk ratio */ uint32 esc_byte_ratio; /* The packet-size should not bet changed */ char no_max_pkt_size; /* Clock required during LP commands */ char force_clk_lane_hs; }; struct msm_panel_info { __u32 xres; __u32 yres; __u32 bpp; __u32 mode2_xres; __u32 mode2_yres; __u32 mode2_bpp; __u32 type; __u32 wait_cycle; DISP_TARGET_PHYS pdest; __u32 bl_max; __u32 bl_min; __u32 fb_num; __u32 clk_rate; __u32 clk_min; __u32 clk_max; __u32 frame_count; __u32 is_3d_panel; __u32 frame_rate; __u32 frame_interval; /* physical size in mm */ __u32 width; __u32 height; struct mddi_panel_info mddi; struct lcd_panel_info lcd; struct lcdc_panel_info lcdc; struct mipi_panel_info mipi; }; #define MSM_FB_SINGLE_MODE_PANEL(pinfo) \ do { \ (pinfo)->mode2_xres = 0; \ (pinfo)->mode2_yres = 0; \ (pinfo)->mode2_bpp = 0; \ } while (0) struct msm_fb_panel_data { struct msm_panel_info panel_info; void (*set_rect) (int x, int y, int xres, int yres); void (*set_vsync_notifier) (msm_fb_vsync_handler_type, void *arg); void (*set_backlight) (struct msm_fb_data_type *); /* function entry chain */ int (*on) (struct platform_device *pdev); int (*controller_on_panel_on) (struct platform_device *pdev); int (*off) (struct platform_device *pdev); int power_on_panel_at_pan; int (*power_ctrl) (boolean enable); struct platform_device *next; int (*clk_func) (int enable); struct msm_panel_info *(*panel_detect) (struct msm_fb_data_type *mfd); int (*update_panel) (struct platform_device *pdev); }; /*=========================================================================== FUNCTIONS PROTOTYPES ============================================================================*/ struct platform_device *msm_fb_device_alloc(struct msm_fb_panel_data *pdata, u32 type, u32 id); int panel_next_on(struct platform_device *pdev); int panel_next_off(struct platform_device *pdev); int lcdc_device_register(struct msm_panel_info *pinfo); int mddi_toshiba_device_register(struct msm_panel_info *pinfo, u32 channel, u32 panel); #endif /* MSM_FB_PANEL_H */
#ifndef MEM_H_INCLUDED #define MEM_H_INCLUDED // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - void *Malloc (size_t); void *Calloc (size_t, size_t); void *Realloc (void *, size_t, size_t); void Free (void *, size_t); void RemovePiece (size_t); size_t CurrMem (void); size_t PeakMem (void); void RestartPeak (void); void RestartPeakAndRS (void); void PrintHRBytes (int64_t); void PrintCurrMem (void); void PrintRAM (int64_t); // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - #endif
// // iTermFileDescriptorMultiClientChild.h // iTerm2SharedARC // // Created by George Nachman on 3/15/20. // #import <Foundation/Foundation.h> #import "iTermMultiServerProtocol.h" #import "iTermResult.h" #import "iTermThreadSafety.h" NS_ASSUME_NONNULL_BEGIN @interface iTermFileDescriptorMultiClientChild : NSObject // Immutable properties. Can be accessed on any thread. @property (atomic, readonly) pid_t pid; @property (atomic, readonly) NSString *executablePath; @property (atomic, readonly) NSArray<NSString *> *args; @property (atomic, readonly) NSDictionary<NSString *, NSString *> *environment; @property (atomic, readonly) BOOL utf8; @property (atomic, readonly) NSString *initialDirectory; @property (atomic, readonly) int fd; @property (atomic, readonly) NSString *tty; // Mutable properties. Must only be accessed on the child's thread. @property (nonatomic, readonly) BOOL hasTerminated; @property (nonatomic, readonly) BOOL haveWaited; // only for non-preemptive waits @property (nonatomic, readonly) BOOL haveSentPreemptiveWait; @property (nonatomic) int terminationStatus; // only defined if haveWaited is YES - (instancetype)initWithReport:(iTermMultiServerReportChild *)report thread:(iTermThread *)thread NS_DESIGNATED_INITIALIZER; - (instancetype)init NS_UNAVAILABLE; - (void)addWaitCallback:(iTermCallback<id, iTermResult<NSNumber *> *> *)callback; - (void)invokeAllWaitCallbacks:(iTermResult<NSNumber *> *)status; // Must be called on child's thread. - (void)willWaitPreemptively; // Must be called on child's thread. - (void)didTerminate; - (void)closeFileDescriptor; @end NS_ASSUME_NONNULL_END
/* Copyright (c) 2009,2011, The Linux Foundation. All rights reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 and * only version 2 as published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * */ #ifndef _MACH_QDSP5_V2_AUDIO_DEF_H #define _MACH_QDSP5_V2_AUDIO_DEF_H /* */ #define SNDDEV_CAP_RX 0x1 /* */ #define SNDDEV_CAP_TX 0x2 /* */ #define SNDDEV_CAP_VOICE 0x4 /* */ #define SNDDEV_CAP_PLAYBACK 0x8 /* */ #define SNDDEV_CAP_FM 0x10 /* */ #define SNDDEV_CAP_TTY 0x20 /* */ #define SNDDEV_CAP_ANC 0x40 /* */ #define SNDDEV_CAP_LB 0x80 /* */ #define VOC_NB_INDEX 0 #define VOC_WB_INDEX 1 #define VOC_RX_VOL_ARRAY_NUM 2 /* */ #define SNDDEV_DEV_VOL_DIGITAL 0x1 /* */ #define SNDDEV_DEV_VOL_ANALOG 0x2 /* */ #define SIDE_TONE_MASK 0x01 #endif /* */
/* * Copyright (C) 2013 Apple Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR * 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. */ #pragma once #include <wtf/Ref.h> namespace WebCore { class Document; class RenderStyle; namespace Style { RenderStyle resolveForDocument(const Document&); } }
/* Copyright (c) 2002-2011 by XMLVM.org * * Project Info: http://www.xmlvm.org * * 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 2.1 of the License, or * (at your option) any later version. * * This library is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public * License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, * USA. */ #import "xmlvm.h" #import "java_util_ArrayList.h" #import "org_xmlvm_iphone_UITabBarItem.h" #import "org_xmlvm_iphone_UITabBar.h" @interface org_xmlvm_iphone_UITabBarDelegate : java_lang_Object <UITabBarDelegate> - (void) __init_org_xmlvm_iphone_UITabBarDelegate__; - (void) willBeginCustomizingItems___org_xmlvm_iphone_UITabBar_java_util_ArrayList :(org_xmlvm_iphone_UITabBar*)n1 :(java_util_ArrayList*)n2; - (void) didBeginCustomizingItems___org_xmlvm_iphone_UITabBar_java_util_ArrayList :(org_xmlvm_iphone_UITabBar*)n1 :(java_util_ArrayList*)n2; - (void) willEndCustomizingItems___org_xmlvm_iphone_UITabBar_java_util_ArrayList_boolean :(org_xmlvm_iphone_UITabBar*)n1 :(java_util_ArrayList*)n2 :(int)changed; - (void) didEndCustomizingItems___org_xmlvm_iphone_UITabBar_java_util_ArrayList_boolean :(org_xmlvm_iphone_UITabBar*)n1 :(java_util_ArrayList*)n2 :(int)changed; - (void) didSelectItem___org_xmlvm_iphone_UITabBar_org_xmlvm_iphone_UITabBarItem :(org_xmlvm_iphone_UITabBar*)n1 :(org_xmlvm_iphone_UITabBarItem*)n2; @end
/* * Copyright (C) 2005,2006,2007,2008 IBM Corporation * * Authors: * Serge Hallyn <serue@us.ibm.com> * Reiner Sailer <sailer@watson.ibm.com> * Mimi Zohar <zohar@us.ibm.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, version 2 of the * License. * * File: ima_queue.c * Implements queues that store template measurements and * maintains aggregate over the stored measurements * in the pre-configured TPM PCR (if available). * The measurement list is append-only. No entry is * ever removed or changed during the boot-cycle. */ #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt #include <linux/module.h> #include <linux/rculist.h> #include <linux/slab.h> #include "ima.h" #define AUDIT_CAUSE_LEN_MAX 32 LIST_HEAD(ima_measurements); /* list of all measurements */ #ifdef CONFIG_IMA_KEXEC static unsigned long binary_runtime_size; #else static unsigned long binary_runtime_size = ULONG_MAX; #endif /* key: inode (before secure-hashing a file) */ struct ima_h_table ima_htable = { .len = ATOMIC_LONG_INIT(0), .violations = ATOMIC_LONG_INIT(0), .queue[0 ... IMA_MEASURE_HTABLE_SIZE - 1] = HLIST_HEAD_INIT }; /* mutex protects atomicity of extending measurement list * and extending the TPM PCR aggregate. Since tpm_extend can take * long (and the tpm driver uses a mutex), we can't use the spinlock. */ static DEFINE_MUTEX(ima_extend_list_mutex); /* lookup up the digest value in the hash table, and return the entry */ static struct ima_queue_entry *ima_lookup_digest_entry(u8 *digest_value, int pcr) { struct ima_queue_entry *qe, *ret = NULL; unsigned int key; int rc; key = ima_hash_key(digest_value); rcu_read_lock(); hlist_for_each_entry_rcu(qe, &ima_htable.queue[key], hnext) { rc = memcmp(qe->entry->digest, digest_value, TPM_DIGEST_SIZE); if ((rc == 0) && (qe->entry->pcr == pcr)) { ret = qe; break; } } rcu_read_unlock(); return ret; } /* * Calculate the memory required for serializing a single * binary_runtime_measurement list entry, which contains a * couple of variable length fields (e.g template name and data). */ static int get_binary_runtime_size(struct ima_template_entry *entry) { int size = 0; size += sizeof(u32); /* pcr */ size += sizeof(entry->digest); size += sizeof(int); /* template name size field */ size += strlen(entry->template_desc->name); size += sizeof(entry->template_data_len); size += entry->template_data_len; return size; } /* ima_add_template_entry helper function: * - Add template entry to the measurement list and hash table, for * all entries except those carried across kexec. * * (Called with ima_extend_list_mutex held.) */ static int ima_add_digest_entry(struct ima_template_entry *entry, int flags) { struct ima_queue_entry *qe; unsigned int key; qe = kmalloc(sizeof(*qe), GFP_KERNEL); if (qe == NULL) { pr_err("OUT OF MEMORY ERROR creating queue entry\n"); return -ENOMEM; } qe->entry = entry; INIT_LIST_HEAD(&qe->later); list_add_tail_rcu(&qe->later, &ima_measurements); atomic_long_inc(&ima_htable.len); if (flags) { key = ima_hash_key(entry->digest); hlist_add_head_rcu(&qe->hnext, &ima_htable.queue[key]); } if (binary_runtime_size != ULONG_MAX) { int size; size = get_binary_runtime_size(entry); binary_runtime_size = (binary_runtime_size < ULONG_MAX - size) ? binary_runtime_size + size : ULONG_MAX; } return 0; } /* * Return the amount of memory required for serializing the * entire binary_runtime_measurement list, including the ima_kexec_hdr * structure. */ unsigned long ima_get_binary_runtime_size(void) { if (binary_runtime_size >= (ULONG_MAX - sizeof(struct ima_kexec_hdr))) return ULONG_MAX; else return binary_runtime_size + sizeof(struct ima_kexec_hdr); }; static int ima_pcr_extend(const u8 *hash, int pcr) { int result = 0; if (!ima_used_chip) return result; result = tpm_pcr_extend(TPM_ANY_NUM, pcr, hash); if (result != 0) pr_err("Error Communicating to TPM chip, result: %d\n", result); return result; } /* * Add template entry to the measurement list and hash table, and * extend the pcr. * * On systems which support carrying the IMA measurement list across * kexec, maintain the total memory size required for serializing the * binary_runtime_measurements. */ int ima_add_template_entry(struct ima_template_entry *entry, int violation, const char *op, struct inode *inode, const unsigned char *filename) { u8 digest[TPM_DIGEST_SIZE]; const char *audit_cause = "hash_added"; char tpm_audit_cause[AUDIT_CAUSE_LEN_MAX]; int audit_info = 1; int result = 0, tpmresult = 0; mutex_lock(&ima_extend_list_mutex); if (!violation) { memcpy(digest, entry->digest, sizeof(digest)); if (ima_lookup_digest_entry(digest, entry->pcr)) { audit_cause = "hash_exists"; result = -EEXIST; goto out; } } result = ima_add_digest_entry(entry, 1); if (result < 0) { audit_cause = "ENOMEM"; audit_info = 0; goto out; } if (violation) /* invalidate pcr */ memset(digest, 0xff, sizeof(digest)); tpmresult = ima_pcr_extend(digest, entry->pcr); if (tpmresult != 0) { snprintf(tpm_audit_cause, AUDIT_CAUSE_LEN_MAX, "TPM_error(%d)", tpmresult); audit_cause = tpm_audit_cause; audit_info = 0; } out: mutex_unlock(&ima_extend_list_mutex); integrity_audit_msg(AUDIT_INTEGRITY_PCR, inode, filename, op, audit_cause, result, audit_info); return result; } int ima_restore_measurement_entry(struct ima_template_entry *entry) { int result = 0; mutex_lock(&ima_extend_list_mutex); result = ima_add_digest_entry(entry, 0); mutex_unlock(&ima_extend_list_mutex); return result; }
/* * Copyright (c) Ulrich Drepper <drepper@redhat.com> * Copyright (c) International Business Machines Corp., 2009 * * 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. */ /* * Test Name: socketpair02 * * Description: * This Program tests the new flag SOCK_CLOEXEC and SOCK_NONBLOCK introduced * in socketpair() in kernel 2.6.27. */ #include <errno.h> #include <fcntl.h> #include <pthread.h> #include <stdio.h> #include <unistd.h> #include <netinet/in.h> #include <sys/socket.h> #include <sys/syscall.h> #include "lapi/fcntl.h" #include "tst_test.h" static int fds[2]; static struct tcase { int type; int flag; int fl_flag; char *des; } tcases[] = { {SOCK_STREAM, 0, F_GETFD, "no close-on-exec"}, {SOCK_STREAM | SOCK_CLOEXEC, FD_CLOEXEC, F_GETFD, "close-on-exec"}, {SOCK_STREAM, 0, F_GETFL, "no non-blocking"}, {SOCK_STREAM | SOCK_NONBLOCK, O_NONBLOCK, F_GETFL, "non-blocking"} }; static void verify_socketpair(unsigned int n) { int res, i; struct tcase *tc = &tcases[n]; TEST(socketpair(PF_UNIX, tc->type, 0, fds)); if (TEST_RETURN == -1) tst_brk(TFAIL | TTERRNO, "socketpair() failed"); for (i = 0; i < 2; i++) { res = SAFE_FCNTL(fds[i], tc->fl_flag); if (tc->flag != 0 && (res & tc->flag) == 0) { tst_res(TFAIL, "socketpair() failed to set %s flag for fds[%d]", tc->des, i); goto ret; } if (tc->flag == 0 && (res & tc->flag) != 0) { tst_res(TFAIL, "socketpair() failed to set %s flag for fds[%d]", tc->des, i); goto ret; } } tst_res(TPASS, "socketpair() passed to set %s flag", tc->des); ret: SAFE_CLOSE(fds[0]); SAFE_CLOSE(fds[1]); } static void cleanup(void) { if (fds[0] > 0) SAFE_CLOSE(fds[0]); if (fds[1] > 0) SAFE_CLOSE(fds[1]); } static struct tst_test test = { .tcnt = ARRAY_SIZE(tcases), .test = verify_socketpair, .min_kver = "2.6.27", .cleanup = cleanup };
/* * Copyright (c) 2002, 2017 Jens Keiner, Stefan Kunis, Daniel Potts * * This program is free software; you can redistribute it and/or modify it under * the terms of the GNU General Public License as published by the Free Software * Foundation; either version 2 of the License, or (at your option) any later * version. * * This program is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more * details. * * You should have received a copy of the GNU General Public License along with * this program; if not, write to the Free Software Foundation, Inc., 51 * Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifndef __NFFT3MP_H__ #define __NFFT3MP_H__ #include "nfft3.h" #ifdef __cplusplus extern "C" { #endif /* __cplusplus */ #if defined(NFFT_PRECISION_SINGLE) typedef float NFFT_R; typedef fftwf_complex NFFT_C; #define NFFT_K(x) ((NFFT_R) x) #define NFFT_M(name) NFFT_CONCAT(name,f) #define FFTW(name) NFFT_CONCAT(fftwf_,name) #define NFFT(name) NFFT_CONCAT(nfftf_,name) #define NFCT(name) NFFT_CONCAT(nfctf_,name) #define NFST(name) NFFT_CONCAT(nfstf_,name) #define NFSFT(name) NFFT_CONCAT(nfsftf_,name) #define SOLVER(name) NFFT_CONCAT(solverf_,name) #elif defined(NFFT_PRECISION_LONG_DOUBLE) typedef long double NFFT_R; typedef fftwl_complex NFFT_C; #define NFFT_K(x) ((NFFT_R) x##L) #define NFFT_M(name) NFFT_CONCAT(name,l) #define FFTW(name) NFFT_CONCAT(fftwl_,name) #define NFFT(name) NFFT_CONCAT(nfftl_,name) #define NFCT(name) NFFT_CONCAT(nfctl_,name) #define NFST(name) NFFT_CONCAT(nfstl_,name) #define NFSFT(name) NFFT_CONCAT(nfsftl_,name) #define SOLVER(name) NFFT_CONCAT(solverl_,name) #elif defined(NFFT_PRECISION_DOUBLE) typedef double NFFT_R; typedef fftw_complex NFFT_C; #define NFFT_K(x) ((NFFT_R) x) #define NFFT_M(name) name #define FFTW(name) NFFT_CONCAT(fftw_,name) #define NFFT(name) NFFT_CONCAT(nfft_,name) #define NFCT(name) NFFT_CONCAT(nfct_,name) #define NFST(name) NFFT_CONCAT(nfst_,name) #define NFSFT(name) NFFT_CONCAT(nfsft_,name) #define SOLVER(name) NFFT_CONCAT(solver_,name) #else #error Either define macro NFFT_PRECISION_SINGLE, NFFT_PRECISION_DOUBLE or NFFT_PRECISION_LONG_DOUBLE for single, double or long double precision #endif /* format strings */ #if defined(NFFT_PRECISION_LONG_DOUBLE) # define NFFT__FGS__ "Lg" # define NFFT__FES__ "LE" # define NFFT__FE__ "% 36.32LE" # define NFFT__FI__ "%Lf" # define NFFT__FIS__ "Lf" # define NFFT__FR__ "%Le" #elif defined(NFFT_PRECISION_SINGLE) # define NFFT__FGS__ "g" # define NFFT__FES__ "E" # define NFFT__FE__ "% 12.8E" # define NFFT__FI__ "%f" # define NFFT__FIS__ "f" # define NFFT__FR__ "%e" #elif defined(NFFT_PRECISION_DOUBLE) # define NFFT__FGS__ "lg" # define NFFT__FES__ "lE" # define NFFT__FE__ "% 20.16lE" # define NFFT__FI__ "%lf" # define NFFT__FIS__ "lf" # define NFFT__FR__ "%le" #else #error Either define macro NFFT_PRECISION_SINGLE, NFFT_PRECISION_DOUBLE or NFFT_PRECISION_LONG_DOUBLE for single, double or long double precision #endif #ifdef __cplusplus } /* extern "C" */ #endif /* __cplusplus */ /** Swap two vectors. */ #define NFFT_CSWAP(x,y) {NFFT_C* NFFT_SWAP_temp__; \ NFFT_SWAP_temp__=(x); (x)=(y); (y)=NFFT_SWAP_temp__;} #define NFFT_KPI NFFT_K(3.1415926535897932384626433832795028841971693993751) #if defined(_WIN32) || defined(_WIN64) # define NFFT__D__ "%Id" #else # define NFFT__D__ "%td" #endif #endif /* defined(__NFFT3MP_H__) */
/* -*- Mode: C; c-basic-offset: 4 -*- */ /* Dia -- an diagram creation/manipulation program * Copyright (C) 1998 Alexander Larsson * * render_pstricks.h: Exporting module/plug-in to TeX Pstricks * Copyright (C) 2000 Jacek Pliszka <pliszka@fuw.edu.pl> * 6.5.2000 * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #ifndef RENDER_PGF_H #define RENDER_PGF_H #include <stdio.h> #include "geometry.h" #include "diarenderer.h" G_BEGIN_DECLS #define PGF_TYPE_RENDERER (pgf_renderer_get_type ()) #define PGF_RENDERER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), PGF_TYPE_RENDERER, PgfRenderer)) #define PGF_RENDERER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), PGF_TYPE_RENDERER, PgfRendererClass)) #define PGF_IS_RENDERER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), PGF_TYPE_RENDERER)) #define PGF_RENDERER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), PGF_TYPE_RENDERER, PgfRendererClass)) GType pgf_renderer_get_type (void) G_GNUC_CONST; typedef struct _PgfRenderer PgfRenderer; typedef struct _PgfRendererClass PgfRendererClass; struct _PgfRendererClass { DiaRendererClass parent_class; }; struct _PgfRenderer { DiaRenderer parent_instance; FILE *file; int is_ps; int pagenum; DiaContext *ctx; }; extern DiaExportFilter pgf_export_filter; G_END_DECLS #endif /* RENDER_PGF_H */
#ifndef __MACH_MEMORY_H #define __MACH_MEMORY_H #include <plat/memory.h> #include <mach/io.h> #define CONSISTENT_DMA_SIZE SZ_8M /* * SRAM memory whereabouts */ #define SRAM_CODE_OFFSET (RK30_IMEM_BASE + 0x0010) #define SRAM_CODE_END (RK30_IMEM_BASE + 0x2FFF) #define SRAM_DATA_OFFSET (RK30_IMEM_BASE + 0x3000) #define SRAM_DATA_END (RK30_IMEM_BASE + 0x3FFF - 64) #endif
/* * \brief Implementation of linux/slab.h * \author Norman Feske * \date 2015-09-09 */ /* * Copyright (C) 2015 Genode Labs GmbH * * This file is part of the Genode OS framework, which is distributed * under the terms of the GNU General Public License version 2. */ #include <lx_emul/impl/internal/malloc.h> void *kmalloc(size_t size, gfp_t flags) { if (flags & __GFP_DMA) PWRN("GFP_DMA memory (below 16 MiB) requested (%p)", __builtin_return_address(0)); if (flags & __GFP_DMA32) PWRN("GFP_DMA32 memory (below 4 GiB) requested (%p)", __builtin_return_address(0)); void *addr = flags & GFP_LX_DMA ? Lx::Malloc::dma().alloc(size, 12) : Lx::Malloc::mem().alloc(size); if ((Genode::addr_t)addr & 0x3) PERR("unaligned kmalloc %lx", (Genode::addr_t)addr); if (flags & __GFP_ZERO) Genode::memset(addr, 0, size); return addr; } void *kzalloc(size_t size, gfp_t flags) { return kmalloc(size, flags | __GFP_ZERO); } void *kzalloc_node(size_t size, gfp_t flags, int node) { return kzalloc(size, 0); } void *kcalloc(size_t n, size_t size, gfp_t flags) { if (size != 0 && n > (~0UL / size)) return 0; return kzalloc(n * size, flags); } void kfree(void const *p) { if (!p) return; if (Lx::Malloc::mem().inside((Genode::addr_t)p)) Lx::Malloc::mem().free(p); else if (Lx::Malloc::dma().inside((Genode::addr_t)p)) Lx::Malloc::dma().free(p); else PERR("%s: unknown block at %p, called from %p", __func__, p, __builtin_return_address(0)); } static size_t _ksize(void *p) { size_t size = 0; if (Lx::Malloc::mem().inside((Genode::addr_t)p)) size = Lx::Malloc::mem().size(p); else if (Lx::Malloc::dma().inside((Genode::addr_t)p)) size = Lx::Malloc::dma().size(p); else PERR("%s: unknown block at %p", __func__, p); return size; } size_t ksize(void *p) { return _ksize(p); } void kzfree(void const *p) { if (!p) return; size_t len = ksize(const_cast<void*>(p)); Genode::memset((void*)p, 0, len); kfree(p); } void *kmalloc_node_track_caller(size_t size, gfp_t flags, int node) { return kmalloc(size, flags); } void *krealloc(void *p, size_t size, gfp_t flags) { /* XXX handle short-cut where size == old_size */ void *addr = kmalloc(size, flags); if (addr && p) { size_t old_size = _ksize(p); Genode::memcpy(addr, p, old_size); kfree(p); } return addr; } void *kmemdup(const void *src, size_t size, gfp_t flags) { void *addr = kmalloc(size, flags); if (addr) Genode::memcpy(addr, src, size); return addr; } struct kmem_cache : Lx::Slab_alloc { kmem_cache(size_t object_size, bool dma) : Lx::Slab_alloc(object_size, dma ? Lx::Slab_backend_alloc::dma() : Lx::Slab_backend_alloc::mem()) { } }; struct kmem_cache *kmem_cache_create(const char *name, size_t size, size_t align, unsigned long flags, void (*ctor)(void *)) { if (ctor) { PERR("%s: ctor not supported", __func__); return nullptr; } /* * Copied from wifi_drv. * * XXX SLAB_LX_DMA is never used anywhere else, remove it? */ enum { SLAB_LX_DMA = 0x80000000ul, }; return new (Genode::env()->heap()) kmem_cache(size, flags & SLAB_LX_DMA); } void * kmem_cache_alloc(struct kmem_cache *cache, gfp_t flags) { return (void *)cache->alloc(); } void kmem_cache_free(struct kmem_cache *cache, void *objp) { cache->free(objp); }
/*************************************************************************** qgsmaplayerstylemanagerwidget.h --------------------- begin : June 2016 copyright : (C) 2016 by Nathan Woodrow email : woodrow dot nathan at gmail dot 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. * * * ***************************************************************************/ #ifndef QGSMAPLAYERSTYLEMANAGERWIDGET_H #define QGSMAPLAYERSTYLEMANAGERWIDGET_H #include <QWidget> #include <QListView> #include <QStandardItemModel> #include "qgsmaplayerconfigwidget.h" class QgsMapLayer; class QgsMapCanvas; /** \ingroup gui * @brief The QgsMapLayerStyleManagerWidget class which is used to visually manage * the layer styles. */ class GUI_EXPORT QgsMapLayerStyleManagerWidget : public QgsMapLayerConfigWidget { Q_OBJECT public: /** * @brief Style manager widget to manage the layers styles. * @param layer The layer for the widget * @param canvas The canvas object. * @param parent The parent. */ QgsMapLayerStyleManagerWidget( QgsMapLayer* layer, QgsMapCanvas* canvas, QWidget *parent = 0 ); public slots: void apply() override {} private slots: void styleClicked( const QModelIndex& index ); void currentStyleChanged( const QString &name ); void styleAdded( const QString& name ); void styleRemoved( const QString& name ); void styleRenamed( const QString& oldname, const QString& newname ); void addStyle(); void removeStyle(); void saveAsDefault(); void loadDefault(); void saveStyle(); void loadStyle(); private: QStandardItemModel* mModel; QListView* mStyleList; }; #endif // QGSMAPLAYERSTYLEMANAGERWIDGET_H
/* Definitions for <stdint.h> types on systems using VxWorks. Copyright (C) 2017 Free Software Foundation, Inc. This file is part of GCC. GCC is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3, or (at your option) any later version. GCC 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. Under Section 7 of GPL version 3, you are granted additional permissions described in the GCC Runtime Library Exception, version 3.1, as published by the Free Software Foundation. You should have received a copy of the GNU General Public License and a copy of the GCC Runtime Library Exception along with this program; see the files COPYING3 and COPYING.RUNTIME respectively. If not, see <http://www.gnu.org/licenses/>. */ #define SIG_ATOMIC_TYPE "unsigned char" #define INT8_TYPE "signed char" #define INT16_TYPE "short int" #define INT32_TYPE "int" #define INT64_TYPE (LONG_TYPE_SIZE == 64 ? "long int" : "long long int") #define UINT8_TYPE "unsigned char" #define UINT16_TYPE "short unsigned int" #define UINT32_TYPE "unsigned int" #define UINT64_TYPE (LONG_TYPE_SIZE == 64 ? "long unsigned int" : "long long unsigned int") #define INT_LEAST8_TYPE "signed char" #define INT_LEAST16_TYPE "short int" #define INT_LEAST32_TYPE "int" #define INT_LEAST64_TYPE (LONG_TYPE_SIZE == 64 ? "long int" : "long long int") #define UINT_LEAST8_TYPE "unsigned char" #define UINT_LEAST16_TYPE "short unsigned int" #define UINT_LEAST32_TYPE "unsigned int" #define UINT_LEAST64_TYPE (LONG_TYPE_SIZE == 64 ? "long unsigned int" : "long long unsigned int") #define INT_FAST8_TYPE "signed char" #define INT_FAST16_TYPE "int" #define INT_FAST32_TYPE "int" #define INT_FAST64_TYPE (LONG_TYPE_SIZE == 64 ? "long int" : "long long int") #define UINT_FAST8_TYPE "unsigned char" #define UINT_FAST16_TYPE "unsigned int" #define UINT_FAST32_TYPE "unsigned int" #define UINT_FAST64_TYPE (LONG_TYPE_SIZE == 64 ? "long unsigned int" : "long long unsigned int") #define INTPTR_TYPE (LONG_TYPE_SIZE == 64 ? "long int" : "int") #define UINTPTR_TYPE (LONG_TYPE_SIZE == 64 ? "long unsigned int" : "unsigned int")
/* * Copyright (c) 2004, Intel Corporation. All rights reserved. * Created by: crystal.xiong REMOVE-THIS AT intel DOT com * This file is licensed under the GPL license. For the full content * of this license, see the COPYING file at the top level of this * source tree. * Test pthread_attr_setstack() * * Steps: * 1. Initialize pthread_attr_t object (attr) * 2. set the stacksize less tha PTHREAD_STACK_MIN */ #include <pthread.h> #include <limits.h> #include <stdio.h> #include <string.h> #include <stdlib.h> #include <sys/param.h> #include <errno.h> #include <unistd.h> #include "posixtest.h" #define TEST "6-1" #define FUNCTION "pthread_attr_setstack" #define ERROR_PREFIX "unexpected error: " FUNCTION " " TEST ": " #define STACKSIZE PTHREAD_STACK_MIN - sysconf(_SC_PAGE_SIZE) static void *stack_addr; static size_t stack_size; int main(void) { pthread_attr_t attr; int rc; /* Initialize attr */ rc = pthread_attr_init(&attr); if (rc != 0) { perror(ERROR_PREFIX "pthread_attr_init"); exit(PTS_UNRESOLVED); } /* Get the default stack_addr and stack_size value */ rc = pthread_attr_getstack(&attr, &stack_addr, &stack_size); if (rc != 0) { perror(ERROR_PREFIX "pthread_attr_getstack"); exit(PTS_UNRESOLVED); } /* printf("stack_addr = %p, stack_size = %u\n", stack_addr, stack_size); */ stack_size = STACKSIZE; if (posix_memalign(&stack_addr, sysconf(_SC_PAGE_SIZE), stack_size) != 0) { perror(ERROR_PREFIX "out of memory while " "allocating the stack memory"); exit(PTS_UNRESOLVED); } /* printf("stack_addr = %p, stack_size = %u\n", stack_addr, stack_size); */ rc = pthread_attr_setstack(&attr, stack_addr, stack_size); if (rc != EINVAL) { perror(ERROR_PREFIX "Got the wrong return value"); exit(PTS_FAIL); } rc = pthread_attr_destroy(&attr); if (rc != 0) { perror(ERROR_PREFIX "pthread_attr_destroy"); exit(PTS_UNRESOLVED); } printf("Test PASSED\n"); return PTS_PASS; }
/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */ #ifndef __SHELL_UTIL_H__ #define __SHELL_UTIL_H__ #include <gio/gio.h> #include <clutter/clutter.h> #include <libsoup/soup.h> G_BEGIN_DECLS char *shell_util_get_label_for_uri (const char *text_uri); GIcon *shell_util_get_icon_for_uri (const char *text_uri); void shell_util_set_hidden_from_pick (ClutterActor *actor, gboolean hidden); void shell_util_get_transformed_allocation (ClutterActor *actor, ClutterActorBox *box); int shell_util_get_week_start (void); char *shell_util_normalize_and_casefold (const char *str); char *shell_util_format_date (const char *format, gint64 time_ms); void shell_write_soup_message_to_stream (GOutputStream *stream, SoupMessage *message, GError **error); gboolean shell_write_string_to_stream (GOutputStream *stream, const char *str, GError **error); char *shell_get_file_contents_utf8_sync (const char *path, GError **error); gboolean shell_parse_search_provider (const char *data, char **name, char **url, GList **langs, char **icon_data_uri, GError **error); void shell_shader_effect_set_double_uniform (ClutterShaderEffect *effect, const gchar *name, gdouble value); gboolean shell_session_is_active_for_systemd (void); gboolean shell_util_wifexited (int status, int *exit); G_END_DECLS #endif /* __SHELL_UTIL_H__ */
static unsigned char bmp_data[] = { 0x00,0x00,0x00,0x00,0x00,0x00,0xEF,0x7B,0xEF,0x7B,0xEF,0x7B,0xEF,0x7B,0xEF,0x7B, 0xEF,0x7B,0xEF,0x7B,0xEF,0x7B,0xEF,0x7B,0xEF,0x7B,0xEF,0x7B,0x00,0x00,0x00,0x00, 0x00,0x00,0x00,0x00,0xEF,0x7B,0xEF,0x7B,0xEF,0x7B,0xEF,0x7B,0xEF,0x7B,0xEF,0x7B, 0xEF,0x7B,0xEF,0x7B,0xEF,0x7B,0xEF,0x7B,0x00,0x00,0xFF,0xFF,0xFF,0xFF,0x00,0x00, 0x00,0x00,0xEF,0x7B,0xEF,0x7B,0xEF,0x7B,0xEF,0x7B,0xEF,0x7B,0xEF,0x7B,0xEF,0x7B, 0xEF,0x7B,0xEF,0x7B,0x00,0x00,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0x00,0x00,0x00,0x00, 0xEF,0x7B,0xEF,0x7B,0xEF,0x7B,0xEF,0x7B,0xEF,0x7B,0xEF,0x7B,0xEF,0x7B,0xEF,0x7B, 0x00,0x00,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0x00,0x00,0x00,0x00,0xEF,0x7B, 0xEF,0x7B,0xEF,0x7B,0xEF,0x7B,0xEF,0x7B,0xEF,0x7B,0xEF,0x7B,0x00,0x00,0xFF,0xFF, 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0x00,0x00,0x00,0x00,0xEF,0x7B,0xEF,0x7B, 0xEF,0x7B,0xEF,0x7B,0xEF,0x7B,0xEF,0x7B,0x00,0x00,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0x00,0x00,0x00,0x00,0xEF,0x7B,0xEF,0x7B,0xEF,0x7B, 0xEF,0x7B,0xEF,0x7B,0x00,0x00,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, 0xFF,0xFF,0xFF,0xFF,0x00,0x00,0x00,0x00,0xEF,0x7B,0xEF,0x7B,0xEF,0x7B,0xEF,0x7B, 0x00,0x00,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, 0xFF,0xFF,0x00,0x00,0x00,0x00,0xEF,0x7B,0xEF,0x7B,0xEF,0x7B,0x00,0x00,0xFF,0xFF, 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, 0x00,0x00,0x00,0x00,0xEF,0x7B,0xEF,0x7B,0x00,0x00,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0x00,0x00, 0x00,0x00,0xEF,0x7B,0x00,0x00,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, 0xFF,0xFF,0xFF,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xEF,0x7B, 0x00,0x00,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, 0x00,0x00,0xEF,0x7B,0xEF,0x7B,0xEF,0x7B,0xEF,0x7B,0xEF,0x7B,0x00,0x00,0xFF,0xFF, 0xFF,0xFF,0xFF,0xFF,0x00,0x00,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0x00,0x00,0x00,0x00, 0xEF,0x7B,0xEF,0x7B,0xEF,0x7B,0xEF,0x7B,0x00,0x00,0xFF,0xFF,0xFF,0xFF,0x00,0x00, 0x00,0x00,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0x00,0x00,0xEF,0x7B,0xEF,0x7B, 0xEF,0x7B,0xEF,0x7B,0x00,0x00,0x00,0x00,0x00,0x00,0xEF,0x7B,0x00,0x00,0x00,0x00, 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0x00,0x00,0x00,0x00,0xEF,0x7B,0xEF,0x7B,0xEF,0x7B, 0x00,0x00,0x00,0x00,0xEF,0x7B,0xEF,0x7B,0xEF,0x7B,0x00,0x00,0xFF,0xFF,0xFF,0xFF, 0xFF,0xFF,0xFF,0xFF,0x00,0x00,0xEF,0x7B,0xEF,0x7B,0xEF,0x7B,0xEF,0x7B,0xEF,0x7B, 0xEF,0x7B,0xEF,0x7B,0xEF,0x7B,0x00,0x00,0x00,0x00,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, 0x00,0x00,0xEF,0x7B,0xEF,0x7B,0xEF,0x7B,0xEF,0x7B,0xEF,0x7B,0xEF,0x7B,0xEF,0x7B, 0xEF,0x7B,0xEF,0x7B,0x00,0x00,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0x00,0x00, 0xEF,0x7B,0xEF,0x7B,0xEF,0x7B,0xEF,0x7B,0xEF,0x7B,0xEF,0x7B,0xEF,0x7B,0xEF,0x7B, 0x00,0x00,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0x00,0x00,0x00,0x00,0xEF,0x7B,0xEF,0x7B, 0xEF,0x7B,0xEF,0x7B,0xEF,0x7B,0xEF,0x7B,0xEF,0x7B,0xEF,0x7B,0xEF,0x7B,0x00,0x00, 0x00,0x00,0x00,0x00,0x00,0x00,0xEF,0x7B,0xEF,0x7B,0xEF,0x7B,0xEF,0x7B,0xEF,0x7B, 0xEF,0x7B,0xEF,0x7B,0xEF,0x7B,0xEF,0x7B,0xEF,0x7B,0xEF,0x7B,0xEF,0x7B,0xEF,0x7B, 0xEF,0x7B,0xEF,0x7B,0xEF,0x7B,0xEF,0x7B};
/* Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved. 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; version 2 of the License. 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 St, Fifth Floor, Boston, MA 02110-1335 USA */ #include "mysys_priv.h" #include "mysys_err.h" #include <m_string.h> #include <errno.h> #include "my_atomic.h" CREATE_NOSYMLINK_FUNCTION( open_nosymlinks(const char *pathname, int flags, int mode), openat(dfd, filename, O_NOFOLLOW | flags, mode), open(pathname, O_NOFOLLOW | flags, mode) ); /* Open a file SYNOPSIS my_open() FileName Fully qualified file name Flags Read | write MyFlags Special flags RETURN VALUE File descriptor */ File my_open(const char *FileName, int Flags, myf MyFlags) /* Path-name of file */ /* Read | write .. */ /* Special flags */ { File fd; DBUG_ENTER("my_open"); DBUG_PRINT("my",("Name: '%s' Flags: %d MyFlags: %lu", FileName, Flags, MyFlags)); if (!(MyFlags & (MY_WME | MY_FAE | MY_FFNF))) MyFlags|= my_global_flags; #if defined(_WIN32) fd= my_win_open(FileName, Flags); #else if (MyFlags & MY_NOSYMLINKS) fd = open_nosymlinks(FileName, Flags | O_CLOEXEC, my_umask); else fd = open(FileName, Flags | O_CLOEXEC, my_umask); #endif fd= my_register_filename(fd, FileName, FILE_BY_OPEN, EE_FILENOTFOUND, MyFlags); DBUG_RETURN(fd); } /* my_open */ /* Close a file SYNOPSIS my_close() fd File sescriptor myf Special Flags */ int my_close(File fd, myf MyFlags) { int err; char *name= NULL; DBUG_ENTER("my_close"); DBUG_PRINT("my",("fd: %d MyFlags: %lu",fd, MyFlags)); if (!(MyFlags & (MY_WME | MY_FAE))) MyFlags|= my_global_flags; if ((uint) fd < my_file_limit && my_file_info[fd].type != UNOPEN) { name= my_file_info[fd].name; my_file_info[fd].name= NULL; my_file_info[fd].type= UNOPEN; } #ifndef _WIN32 err= close(fd); #else err= my_win_close(fd); #endif if (err) { DBUG_PRINT("error",("Got error %d on close",err)); my_errno=errno; if (MyFlags & (MY_FAE | MY_WME)) my_error(EE_BADCLOSE, MYF(ME_BELL | (MyFlags & (ME_NOTE | ME_ERROR_LOG))), name,errno); } if (name) { my_free(name); } my_atomic_add32_explicit(&my_file_opened, -1, MY_MEMORY_ORDER_RELAXED); DBUG_RETURN(err); } /* my_close */ /* Register file in my_file_info[] SYNOPSIS my_register_filename() fd File number opened, -1 if error on open FileName File name type_file_type How file was created error_message_number Error message number if caller got error (fd == -1) MyFlags Flags for my_close() RETURN -1 error # Filenumber */ File my_register_filename(File fd, const char *FileName, enum file_type type_of_file, uint error_message_number, myf MyFlags) { DBUG_ENTER("my_register_filename"); if ((int) fd >= MY_FILE_MIN) { my_atomic_add32_explicit(&my_file_opened, 1, MY_MEMORY_ORDER_RELAXED); if ((uint) fd >= my_file_limit) DBUG_RETURN(fd); my_file_info[fd].name = my_strdup(key_memory_my_file_info, FileName, MyFlags); statistic_increment(my_file_total_opened,&THR_LOCK_open); my_file_info[fd].type = type_of_file; DBUG_PRINT("exit",("fd: %d",fd)); DBUG_RETURN(fd); } my_errno= errno; DBUG_PRINT("error",("Got error %d on open", my_errno)); if (MyFlags & (MY_FFNF | MY_FAE | MY_WME)) { if (my_errno == EMFILE) error_message_number= EE_OUT_OF_FILERESOURCES; my_error(error_message_number, MYF(ME_BELL | (MyFlags & (ME_NOTE | ME_ERROR_LOG))), FileName, my_errno); } DBUG_RETURN(-1); }
#ifndef __ORG_XMLVM_IPHONE_GL_EAGLDRAWABLE__ #define __ORG_XMLVM_IPHONE_GL_EAGLDRAWABLE__ #include "xmlvm.h" // Preprocessor constants for interfaces: // Implemented interfaces: // Super Class: #include "java_lang_Object.h" // Circular references: XMLVM_DEFINE_CLASS(org_xmlvm_iphone_gl_EAGLDrawable, 0, 0) extern JAVA_OBJECT __CLASS_org_xmlvm_iphone_gl_EAGLDrawable; extern JAVA_OBJECT __CLASS_org_xmlvm_iphone_gl_EAGLDrawable_1ARRAY; extern JAVA_OBJECT __CLASS_org_xmlvm_iphone_gl_EAGLDrawable_2ARRAY; extern JAVA_OBJECT __CLASS_org_xmlvm_iphone_gl_EAGLDrawable_3ARRAY; #ifndef XMLVM_FORWARD_DECL_org_xmlvm_iphone_gl_EAGLDrawable #define XMLVM_FORWARD_DECL_org_xmlvm_iphone_gl_EAGLDrawable typedef struct org_xmlvm_iphone_gl_EAGLDrawable org_xmlvm_iphone_gl_EAGLDrawable; #endif void __INIT_org_xmlvm_iphone_gl_EAGLDrawable(); void __INIT_IMPL_org_xmlvm_iphone_gl_EAGLDrawable(); #endif
#if !defined(__SWL_RND_UTIL__LOCAL_API__H_) #define __SWL_RND_UTIL__LOCAL_API__H_ 1 #include "swl/rnd_util/RejectionSampling.h" #include <boost/random/linear_congruential.hpp> #include <boost/random/variate_generator.hpp> #include <boost/random/normal_distribution.hpp> #include <boost/numeric/ublas/matrix_proxy.hpp> namespace swl { //-------------------------------------------------------------------------- // von Mises target distribution. // REF [book] >> "Pattern Recognition and Machine Learning" by Christopher M. Bishop, ch. 11.1.2. struct VonMisesTargetDistribution: public swl::RejectionSampling::TargetDistribution { typedef swl::RejectionSampling::TargetDistribution base_type; typedef base_type::vector_type vector_type; VonMisesTargetDistribution() : base_type(), mean_direction_(0.0), kappa_(0.0) {} /*virtual*/ double evaluate(const vector_type &x) const; void setParameters(const double mean_direction, const double kappa) { mean_direction_ = mean_direction; kappa_ = kappa; } private: double mean_direction_; // The mean directions of the von Mises distribution. 0 <= mu < 2 * pi. [rad]. double kappa_; // The concentration parameters of the von Mises distribution. kappa >= 0. }; //-------------------------------------------------------------------------- // Univariate normal proposal distribution. // REF [book] >> "Pattern Recognition and Machine Learning" by Christopher M. Bishop, ch. 11.1.2. struct UnivariateNormalProposalDistribution: public swl::RejectionSampling::ProposalDistribution { typedef swl::RejectionSampling::ProposalDistribution base_type; typedef base_type::vector_type vector_type; UnivariateNormalProposalDistribution(); // Evaluate k * proposal_distribution(x). /*virtual*/ double evaluate(const vector_type &x) const; /*virtual*/ void sample(vector_type &sample) const; void setParameters(const double mean, const double sigma, const double k = 1.0); void setSeed(const unsigned int seed); private: typedef boost::minstd_rand base_generator_type; typedef boost::variate_generator<base_generator_type &, boost::normal_distribution<> > generator_type; private: double mean_; // The mean of the univariate normal distribution. double sigma_; // The standard deviation of the univariate normal distribution. base_generator_type baseGenerator_; mutable generator_type generator_; }; //-------------------------------------------------------------------------- // Univariate uniform proposal distribution. // REF [book] >> "Pattern Recognition and Machine Learning" by Christopher M. Bishop, ch. 11.1.2. struct UnivariateUniformProposalDistribution: public swl::RejectionSampling::ProposalDistribution { typedef swl::RejectionSampling::ProposalDistribution base_type; typedef base_type::vector_type vector_type; UnivariateUniformProposalDistribution(); // Evaluate k * proposal_distribution(x). /*virtual*/ double evaluate(const vector_type &x) const; /*virtual*/ void sample(vector_type &sample) const; void setParameters(const double lower, const double upper, const double k = 1.0); void setSeed(const unsigned int seed); private: double lower_, upper_; // The lower & upper bound of the univariate uniform distribution. }; //-------------------------------------------------------------------------- // Find MAP estimate of multinomial using entropic prior. // REF [paper] >> "Structure Learning in Conditional Probability Models via an Entropic Prior and Parameter Extinction", M. Brand, Neural Computation, 1999. // REF [paper] >> "Pattern discovery via entropy minimization", M. Brand, AISTATS, 1999. bool computeMAPEstimateOfMultinomialUsingEntropicPrior(const std::vector<double> &omega, const double &z, std::vector<double> &theta, double &logLikelihood, const double terminationTolerance, const std::size_t maxIteration, const bool doesInitializeLambdaFirst = true); bool computeMAPEstimateOfMultinomialUsingEntropicPrior(const boost::numeric::ublas::vector<double> &omega, const double &z, std::vector<double> &theta, double &logLikelihood, const double terminationTolerance, const std::size_t maxIteration, const bool doesInitializeLambdaFirst = true); } // namespace swl #endif // __SWL_RND_UTIL__LOCAL_API__H_
// stdafx.h : include file for standard system include files, // or project specific include files that are used frequently, but // are changed infrequently // #pragma once #include "targetver.h" #define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers // Windows Header Files: #include <windows.h> // C RunTime Header Files #include <stdlib.h> #include <malloc.h> #include <memory.h> #include <tchar.h> // TODO: reference additional headers your program requires here #include <wx/wx.h>
/* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /* * THE FILE HAS BEEN AUTOGENERATED BY INTEL IJH TOOL. * Please be aware that all changes made to this file manually * will be overwritten by the tool if it runs again. */ /** * @author Alexey A. Petrenko */ #include <jni.h> /* Header for class org.apache.harmony.x.print.awt.PSPrinterJob */ #ifndef _ORG_APACHE_HARMONY_X_PRINT_AWT_PSPRINTERJOB_H #define _ORG_APACHE_HARMONY_X_PRINT_AWT_PSPRINTERJOB_H #ifdef __cplusplus extern "C" { #endif /* Native methods */ /* * Method: org.apache.harmony.x.print.awt.PSPrinterJob.getPrinter(Ljava/lang/String;I)Ljava/lang/String; */ JNIEXPORT jstring JNICALL Java_org_apache_harmony_x_print_awt_PSPrinterJob_getPrinter(JNIEnv *, jobject, jstring, jint); #ifdef __cplusplus } #endif #endif /* _ORG_APACHE_HARMONY_X_PRINT_AWT_PSPRINTERJOB_H */
/********************************************************************* * * Filename: ircomm_core.h * Version: * Description: * Status: Experimental. * Author: Dag Brattli <dagb@cs.uit.no> * Created at: Wed Jun 9 08:58:43 1999 * Modified at: Mon Dec 13 11:52:29 1999 * Modified by: Dag Brattli <dagb@cs.uit.no> * * Copyright (c) 1999 Dag Brattli, All Rights Reserved. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as * published by the Free Software Foundation; either version 2 of * the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, * MA 02111-1307 USA * ********************************************************************/ #ifndef IRCOMM_CORE_H #define IRCOMM_CORE_H #include <net/irda/irda.h> #include <net/irda/ircomm_event.h> #define IRCOMM_MAGIC 0x98347298 #define IRCOMM_HEADER_SIZE 1 struct ircomm_cb; /* Forward decl. */ /* * A small call-table, so we don't have to check the service-type whenever * we want to do something */ typedef struct { int (*data_request)(struct ircomm_cb *, struct sk_buff *, int clen); int (*connect_request)(struct ircomm_cb *, struct sk_buff *, struct ircomm_info *); int (*connect_response)(struct ircomm_cb *, struct sk_buff *); int (*disconnect_request)(struct ircomm_cb *, struct sk_buff *, struct ircomm_info *); } call_t; struct ircomm_cb { queue_t queue; magic_t magic; notify_t notify; call_t issue; int state; int line; /* Which TTY line we are using */ struct tsap_cb *tsap; struct lsap_cb *lsap; __u8 dlsap_sel; /* Destination LSAP/TSAP selector */ __u8 slsap_sel; /* Source LSAP/TSAP selector */ __u32 saddr; /* Source device address (link we are using) */ __u32 daddr; /* Destination device address */ int max_header_size; /* Header space we must reserve for each frame */ int max_data_size; /* The amount of data we can fill in each frame */ LOCAL_FLOW flow_status; /* Used by ircomm_lmp */ int pkt_count; /* Number of frames we have sent to IrLAP */ __u8 service_type; }; extern hashbin_t *ircomm; struct ircomm_cb *ircomm_open(notify_t *notify, __u8 service_type, int line); int ircomm_close(struct ircomm_cb *self); int ircomm_data_request(struct ircomm_cb *self, struct sk_buff *skb); void ircomm_data_indication(struct ircomm_cb *self, struct sk_buff *skb); void ircomm_process_data(struct ircomm_cb *self, struct sk_buff *skb); int ircomm_control_request(struct ircomm_cb *self, struct sk_buff *skb); int ircomm_connect_request(struct ircomm_cb *self, __u8 dlsap_sel, __u32 saddr, __u32 daddr, struct sk_buff *skb, __u8 service_type); void ircomm_connect_indication(struct ircomm_cb *self, struct sk_buff *skb, struct ircomm_info *info); void ircomm_connect_confirm(struct ircomm_cb *self, struct sk_buff *skb, struct ircomm_info *info); int ircomm_connect_response(struct ircomm_cb *self, struct sk_buff *userdata); int ircomm_disconnect_request(struct ircomm_cb *self, struct sk_buff *userdata); void ircomm_disconnect_indication(struct ircomm_cb *self, struct sk_buff *skb, struct ircomm_info *info); void ircomm_flow_request(struct ircomm_cb *self, LOCAL_FLOW flow); #define ircomm_is_connected(self) (self->state == IRCOMM_CONN) #endif
/* * Copyright (C) 2009 Grasch Peter <peter.grasch@bedahr.org> * Copyright (C) 2009 Mario Strametz <strmam06@htl-kaindorf.ac.at> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2, * or (at your option) any later version, as published by the Free * Software Foundation * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details * * You should have received a copy of the GNU General Public * License along with this program; if not, write to the * Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifndef SIMON_KEYBOARDBUTTON_H_FE27CA2130AA40A68CE748E28ACBE7DA #define SIMON_KEYBOARDBUTTON_H_FE27CA2130AA40A68CE748E28ACBE7DA #include <QString> #include <QDomElement> #include <KPushButton> class QDomDocument; namespace Keyboard { enum ButtonType { NullButton=0, TextButton=1, ShortcutButton=2 }; } class KeyboardButton : public KPushButton { Q_OBJECT signals: void triggered(); private: bool m_isNull; QString triggerShown; QString triggerReal; Keyboard::ButtonType valueType; QString value; void setupGUI(); public slots: bool trigger(); public: bool isNull() { return m_isNull; } KeyboardButton(QString triggerShown, QString triggerReal, Keyboard::ButtonType valueType, QString value); KeyboardButton(const QDomElement& elem); ~KeyboardButton(); QString getTriggerReal(); Keyboard::ButtonType getValueType(); QString getValue(); QString getTriggerShown(); void setTriggerShown(const QString& triggerShown); void setTriggerReal(const QString& triggerReal); void setValue(const QString& value); void setButtonType(Keyboard::ButtonType valueType); QDomElement serialize(QDomDocument *doc); }; #endif
// Animation names #define BODY_ANIM_DEFAULT 0 // Color names // Patch names // Names of collision boxes #define BODY_COLLISION_BOX_PART_NAME 0 // Attaching position names #define BODY_ATTACHMENT_FLARE1 0 #define BODY_ATTACHMENT_FLARE2 1 #define BODY_ATTACHMENT_FLARE3 2 #define BODY_ATTACHMENT_FLARE4 3 // Sound names
/*************************************************************************** * Copyright (c) 1999-2008, Broadcom Corporation * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as * published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * * Module Description: * DO NOT EDIT THIS FILE DIRECTLY * * This module was generated magically with RDB from a source description * file. You must edit the source file for changes to be made to this file. * * * Date: Generated on Tue Dec 2 14:05:32 2008 * MD5 Checksum 90975bbcdf76045bb6bd092e6bdf481b * * Compiled with: RDB Utility combo_header.pl * RDB Parser 3.0 * unknown unknown * Perl Interpreter 5.008008 * Operating System linux * * Revision History: * * $brcm_Log: /magnum/basemodules/chp/7635/rdb/a0/bchp_uartb.h $ * * Hydra_Software_Devel/1 12/2/08 8:01p albertl * PR48688: Initial revision. * ***************************************************************************/ #ifndef BCHP_UARTB_H__ #define BCHP_UARTB_H__ /*************************************************************************** *UARTB - UART B ***************************************************************************/ #define BCHP_UARTB_RBR 0x00400b40 /* Receive Buffer Register */ #define BCHP_UARTB_THR 0x00400b40 /* Transmit Holding Register */ #define BCHP_UARTB_DLH 0x00400b44 /* Divisor Latch High */ #define BCHP_UARTB_DLL 0x00400b40 /* Divisor Latch Low */ #define BCHP_UARTB_IER 0x00400b44 /* Interrupt Enable Register */ #define BCHP_UARTB_IIR 0x00400b48 /* Interrupt Identity Register */ #define BCHP_UARTB_FCR 0x00400b48 /* FIFO Control Register */ #define BCHP_UARTB_LCR 0x00400b4c /* Line Control Register */ #define BCHP_UARTB_MCR 0x00400b50 /* Modem Control Register */ #define BCHP_UARTB_LSR 0x00400b54 /* Line Status Register */ #define BCHP_UARTB_MSR 0x00400b58 /* Modem Status Register */ #define BCHP_UARTB_SCR 0x00400b5c /* Scratchpad Register */ #endif /* #ifndef BCHP_UARTB_H__ */ /* End of File */
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */ /* NetworkManager Applet -- allow user control over networking * * Dan Williams <dcbw@redhat.com> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * * (C) Copyright 2007 - 2010 Red Hat, Inc. */ #ifndef WIRELESS_SECURITY_H #define WIRELESS_SECURITY_H #include <glib.h> #include <gtk/gtk.h> #include <nm-connection.h> typedef struct _WirelessSecurity WirelessSecurity; typedef void (*WSChangedFunc) (WirelessSecurity *sec, gpointer user_data); typedef void (*WSAddToSizeGroupFunc) (WirelessSecurity *sec, GtkSizeGroup *group); typedef void (*WSFillConnectionFunc) (WirelessSecurity *sec, NMConnection *connection); typedef void (*WSUpdateSecretsFunc) (WirelessSecurity *sec, NMConnection *connection); typedef void (*WSDestroyFunc) (WirelessSecurity *sec); typedef gboolean (*WSValidateFunc) (WirelessSecurity *sec, const GByteArray *ssid); typedef GtkWidget * (*WSNagUserFunc) (WirelessSecurity *sec); struct _WirelessSecurity { guint32 refcount; gsize obj_size; GtkBuilder *builder; GtkWidget *ui_widget; WSChangedFunc changed_notify; gpointer changed_notify_data; const char *default_field; gboolean adhoc_compatible; WSAddToSizeGroupFunc add_to_size_group; WSFillConnectionFunc fill_connection; WSUpdateSecretsFunc update_secrets; WSValidateFunc validate; WSNagUserFunc nag_user; WSDestroyFunc destroy; }; #define WIRELESS_SECURITY(x) ((WirelessSecurity *) x) GtkWidget *wireless_security_get_widget (WirelessSecurity *sec); void wireless_security_set_changed_notify (WirelessSecurity *sec, WSChangedFunc func, gpointer user_data); gboolean wireless_security_validate (WirelessSecurity *sec, const GByteArray *ssid); void wireless_security_add_to_size_group (WirelessSecurity *sec, GtkSizeGroup *group); void wireless_security_fill_connection (WirelessSecurity *sec, NMConnection *connection); void wireless_security_update_secrets (WirelessSecurity *sec, NMConnection *connection); GtkWidget * wireless_security_nag_user (WirelessSecurity *sec); gboolean wireless_security_adhoc_compatible (WirelessSecurity *sec); WirelessSecurity *wireless_security_ref (WirelessSecurity *sec); void wireless_security_unref (WirelessSecurity *sec); GType wireless_security_get_g_type (void); /* Below for internal use only */ #include "ws-wep-key.h" #include "ws-wpa-psk.h" #include "ws-leap.h" #include "ws-wpa-eap.h" #include "ws-dynamic-wep.h" WirelessSecurity *wireless_security_init (gsize obj_size, WSValidateFunc validate, WSAddToSizeGroupFunc add_to_size_group, WSFillConnectionFunc fill_connection, WSUpdateSecretsFunc update_secrets, WSDestroyFunc destroy, const char *ui_file, const char *ui_widget_name, const char *default_field); void wireless_security_changed_cb (GtkWidget *entry, gpointer user_data); void wireless_security_clear_ciphers (NMConnection *connection); #define AUTH_NAME_COLUMN 0 #define AUTH_METHOD_COLUMN 1 GtkWidget *ws_802_1x_auth_combo_init (WirelessSecurity *sec, const char *combo_name, const char *combo_label, GCallback auth_combo_changed_cb, NMConnection *connection, gboolean is_editor, gboolean secrets_only); void ws_802_1x_auth_combo_changed (GtkWidget *combo, WirelessSecurity *sec, const char *vbox_name, GtkSizeGroup *size_group); gboolean ws_802_1x_validate (WirelessSecurity *sec, const char *combo_name); void ws_802_1x_add_to_size_group (WirelessSecurity *sec, GtkSizeGroup *size_group, const char *label_name, const char *combo_name); void ws_802_1x_fill_connection (WirelessSecurity *sec, const char *combo_name, NMConnection *connection); void ws_802_1x_update_secrets (WirelessSecurity *sec, const char *combo_name, NMConnection *connection); GtkWidget * ws_802_1x_nag_user (WirelessSecurity *sec, const char *combo_name); #endif /* WIRELESS_SECURITY_H */
/* old interface for reading cdb file * * This file is a part of tinycdb package by Michael Tokarev, mjt@corpit.ru. * Public domain. */ #include "common/setup_before.h" #include <stdio.h> #include "cdb_int.h" #include "common/setup_after.h" #ifndef SEEK_SET # define SEEK_SET 0 #endif /* read a chunk from file, ignoring interrupts (EINTR) */ int cdb_bread(FILE *fd, void *buf, int len) { int l; while(len > 0) { do l = fread(buf, 1, len, fd); while(l < 0 && errno == EINTR); if (l <= 0) { if (!l) errno = EIO; return -1; } buf = (char*)buf + l; len -= l; } return 0; } /* find a given key in cdb file, seek a file pointer to it's value and place data length to *dlenp. */ int cdb_seek(FILE *fd, const void *key, unsigned klen, unsigned *dlenp) { unsigned htstart; /* hash table start position */ unsigned htsize; /* number of elements in a hash table */ unsigned httodo; /* hash table elements left to look */ unsigned hti; /* hash table index */ unsigned pos; /* position in a file */ unsigned hval; /* key's hash value */ unsigned char rbuf[64]; /* read buffer */ int needseek = 1; /* if we should seek to a hash slot */ hval = cdb_hash(key, klen); pos = (hval & 0xff) << 3; /* position in TOC */ /* read the hash table parameters */ if (fseek(fd, pos, SEEK_SET) || cdb_bread(fd, rbuf, 8) < 0) return -1; if ((htsize = cdb_unpack(rbuf + 4)) == 0) return 0; hti = (hval >> 8) % htsize; /* start position in hash table */ httodo = htsize; htstart = cdb_unpack(rbuf); for(;;) { if (needseek && fseek(fd, htstart + (hti << 3), SEEK_SET)) return -1; if (cdb_bread(fd, rbuf, 8) < 0) return -1; if ((pos = cdb_unpack(rbuf + 4)) == 0) /* not found */ return 0; if (cdb_unpack(rbuf) != hval) /* hash value not matched */ needseek = 0; else { /* hash value matched */ if (fseek(fd, pos, SEEK_SET) || cdb_bread(fd, rbuf, 8) < 0) return -1; if (cdb_unpack(rbuf) == klen) { /* key length matches */ /* read the key from file and compare with wanted */ unsigned l = klen, c; const char *k = (const char*)key; if (*dlenp) *dlenp = cdb_unpack(rbuf + 4); /* save value length */ for(;;) { if (!l) /* the whole key read and matches, return */ return 1; c = l > sizeof(rbuf) ? sizeof(rbuf) : l; if (cdb_bread(fd, rbuf, c) < 0) return -1; if (memcmp(rbuf, k, c) != 0) /* no, it differs, stop here */ break; k += c; l -= c; } } needseek = 1; /* we're looked to other place, should seek back */ } if (!--httodo) return 0; if (++hti == htsize) { hti = 0; needseek = 1; } } }
/* FUNCTION <<reent>>---definition of impure data. INDEX reent DESCRIPTION This module defines the impure data area used by the non-reentrant functions, such as strtok. */ #include <stdlib.h> #include <reent.h> #ifdef _REENT_ONLY #ifndef REENTRANT_SYSCALLS_PROVIDED #define REENTRANT_SYSCALLS_PROVIDED #endif #endif #ifndef REENTRANT_SYSCALLS_PROVIDED /* We use the errno variable used by the system dependent layer. */ #undef errno int errno; #endif /* Interim cleanup code */ void _DEFUN (cleanup_glue, (ptr, glue), struct _reent *ptr _AND struct _glue *glue) { /* Have to reclaim these in reverse order: */ if (glue->_next) cleanup_glue (ptr, glue->_next); _free_r (ptr, glue); } void _DEFUN (_reclaim_reent, (ptr), struct _reent *ptr) { if (ptr != _impure_ptr) { /* used by mprec routines. */ #ifdef _REENT_SMALL if (ptr->_mp) /* don't bother allocating it! */ { #endif if (_REENT_MP_FREELIST(ptr)) { int i; for (i = 0; i < _Kmax; i++) { struct _Bigint *thisone, *nextone; nextone = _REENT_MP_FREELIST(ptr)[i]; while (nextone) { thisone = nextone; nextone = nextone->_next; _free_r (ptr, thisone); } } _free_r (ptr, _REENT_MP_FREELIST(ptr)); } if (_REENT_MP_RESULT(ptr)) _free_r (ptr, _REENT_MP_RESULT(ptr)); #ifdef _REENT_SMALL } #endif #ifdef _REENT_SMALL if (ptr->_emergency) _free_r (ptr, ptr->_emergency); if (ptr->_mp) _free_r (ptr, ptr->_mp); if (ptr->_r48) _free_r (ptr, ptr->_r48); if (ptr->_localtime_buf) _free_r (ptr, ptr->_localtime_buf); if (ptr->_asctime_buf) _free_r (ptr, ptr->_asctime_buf); #endif if (ptr->_atexit) _free_r (ptr, ptr->_atexit); if (ptr->_cvtbuf) _free_r (ptr, ptr->_cvtbuf); if (ptr->__sdidinit) { /* cleanup won't reclaim memory 'coz usually it's run before the program exits, and who wants to wait for that? */ ptr->__cleanup (ptr); if (ptr->__sglue._next) cleanup_glue (ptr, ptr->__sglue._next); } /* Malloc memory not reclaimed; no good way to return memory anyway. */ } } /* * Do atexit() processing and cleanup * * NOTE: This is to be executed at task exit. It does not tear anything * down which is used on a global basis. */ void _DEFUN (_wrapup_reent, (ptr), struct _reent *ptr) { register struct _atexit *p; register int n; if (ptr == NULL) ptr = _REENT; for (p = ptr->_atexit, n = p ? p->_ind : 0; --n >= 0;) (*p->_fns[n]) (); if (ptr->__cleanup) (*ptr->__cleanup) (ptr); }
/**************************************************************************** * This file is part of Hawaii. * * Copyright (C) 2016 Pier Luigi Fiorini * * Author(s): * Pier Luigi Fiorini <pierluigi.fiorini@gmail.com> * * $BEGIN_LICENSE:GPL2+$ * * 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/>. * * $END_LICENSE$ ***************************************************************************/ #ifndef SCREENCAST_H #define SCREENCAST_H #include <QtCore/QObject> #include <QtCore/QThread> #include <GreenIsland/Client/ClientConnection> #include <GreenIsland/Client/Registry> #include <GreenIsland/Client/Screencaster> #include <GreenIsland/Client/Shm> #include <Qt5GStreamer/QGst/Pipeline> #include <Qt5GStreamer/QGst/Utils/ApplicationSource> using namespace GreenIsland; class AppSource : public QGst::Utils::ApplicationSource { public: AppSource(); bool isStopped() const; protected: void needData(uint length) Q_DECL_OVERRIDE; void enoughData() Q_DECL_OVERRIDE; private: bool m_stop; }; class Screencast : public QObject { Q_OBJECT public: Screencast(QObject *parent = Q_NULLPTR); ~Screencast(); protected: bool event(QEvent *event) Q_DECL_OVERRIDE; private: bool m_initialized; bool m_inProgress; QThread *m_thread; Client::ClientConnection *m_connection; Client::Registry *m_registry; Client::Shm *m_shm; Client::Screencaster *m_screencaster; QSize m_size; qint32 m_stride; QGst::PipelinePtr m_pipeline; AppSource m_appSource; QString videoFileName() const; void initialize(); void process(); void start(); private Q_SLOTS: void interfacesAnnounced(); void interfaceAnnounced(const QByteArray &interface, quint32 name, quint32 version); void busMessage(const QGst::MessagePtr &message); }; class StartupEvent : public QEvent { public: StartupEvent(); }; #endif // SCREENCAST_H
/* * TALPA test program * * Copyright (C) 2004-2011 Sophos Limited, Oxford, England. * * This program is free software; you can redistribute it and/or modify it under the terms of the * GNU General Public License Version 2 as published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without * even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU General Public License for more details. * * You should have received a copy of the GNU General Public License along with this program; if not, * write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ #include <stdio.h> #include <stdlib.h> #include <string.h> #include <errno.h> #include <sys/types.h> #include <sys/stat.h> #include <fcntl.h> #include <unistd.h> #include <sys/wait.h> #include <pthread.h> #include <signal.h> #include <sys/time.h> #include "../include/talpa-vettingclient.h" #include "../src/ifaces/intercept_filters/eintercept_action.h" #include "../clients/vc.h" static int flag = 0; void sigalarm(int sig) { flag++; } int main(int argc, char *argv[]) { unsigned int group; const unsigned int tout = 2; char file[100]; int talpa; int rc; struct TalpaPacket_VettingDetails* details; int status; if ( argc > 1 ) { group = atoi(argv[1]); strcpy(file, argv[2]); } else { group = 0; strcpy(file, "/test/file"); } if ( (talpa = vc_init(group, tout*1000)) < 0 ) { fprintf(stderr, "Failed to initialize!\n"); return -1; } rc = fork(); if ( !rc ) { /* Set-up an itimer which will interrupt the open below */ struct itimerval it = { {1, 0}, {1, 0} }; if ( signal(SIGALRM, sigalarm) < 0 ) { return -1; } if ( setitimer(ITIMER_REAL, &it, NULL) < 0 ) { return -2; } if ( open(file, O_RDONLY) < 0 ) { return -3; } /* Good so far. Now sleep to see whether our signal handler was correctly restored. */ sleep(10); sleep(10); if ( flag < 2 ) { return -4; } return 0; } else if ( rc < 0 ) { fprintf(stderr, "Fork failed!\n"); return -1; } /* Sleep for two seconds to allow for timer to interrupt the opener */ sleep(2); details = vc_get(talpa); if ( !details ) { fprintf(stderr, "Nothing caught!\n"); vc_exit(talpa); wait(NULL); return -1; } if ( vc_respond(talpa, details, TALPA_ALLOW) < 0 ) { fprintf(stderr, "Respond error!\n"); vc_exit(talpa); wait(NULL); return -1; } wait(&status); if ( !WIFEXITED(status) ) { fprintf(stderr, "Child error!\n"); vc_exit(talpa); return -1; } if ( WEXITSTATUS(status) ) { fprintf(stderr, "Child reported an error (%d)!\n", WEXITSTATUS(status)); vc_exit(talpa); return -1; } vc_exit(talpa); return 0; }
/* $Id: gdk_3Demu.h,v 1.1 2007-04-21 19:45:07 evilynux Exp $ */ /* Copyright (C) 2006-2007 Ben Jaques This file is part of DeSmuME DeSmuME 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. DeSmuME 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 DeSmuME; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifdef GTKGLEXT_AVAILABLE /* * The GDK 3D emulation. * This uses the OpenGL Collector plugin, using gdkGLext for the platform * specific helper functions. */ int init_opengl_gdk_3Demu( GdkDrawable * drawable); #endif
///////////////////////////////////////////////////////////////////////////// // Name: wx/osx/cocoa/private/textimpl.h // Purpose: textcontrol implementation classes that have to be exposed // Author: Stefan Csomor // Modified by: // Created: 03/02/99 // RCS-ID: $Id: textimpl.h 67254 2011-03-20 00:14:35Z DS $ // Copyright: (c) Stefan Csomor // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// #ifndef _WX_OSX_COCOA_PRIVATE_TEXTIMPL_H_ #define _WX_OSX_COCOA_PRIVATE_TEXTIMPL_H_ #include "wx/combobox.h" #include "wx/osx/private.h" // implementation exposed, so that search control can pull it class wxNSTextFieldControl : public wxWidgetCocoaImpl, public wxTextWidgetImpl { public : // wxNSTextFieldControl must always be associated with a wxTextEntry. If // it's associated with a wxTextCtrl then we can get the associated entry // from it but otherwise the second ctor should be used to explicitly pass // us the entry. wxNSTextFieldControl( wxTextCtrl *text, WXWidget w ); wxNSTextFieldControl( wxWindow *wxPeer, wxTextEntry *entry, WXWidget w ); virtual ~wxNSTextFieldControl(); virtual wxString GetStringValue() const ; virtual void SetStringValue( const wxString &str) ; virtual void Copy() ; virtual void Cut() ; virtual void Paste() ; virtual bool CanPaste() const ; virtual void SetEditable(bool editable) ; virtual void GetSelection( long* from, long* to) const ; virtual void SetSelection( long from , long to ); virtual void WriteText(const wxString& str) ; virtual bool HasOwnContextMenu() const { return true; } virtual bool SetHint(const wxString& hint); virtual void controlAction(WXWidget slf, void* _cmd, void *sender); protected : NSTextField* m_textField; long m_selStart; long m_selEnd; private: // Common part of both ctors. void Init(WXWidget w); }; class wxNSTextViewControl : public wxWidgetCocoaImpl, public wxTextWidgetImpl { public: wxNSTextViewControl( wxTextCtrl *wxPeer, WXWidget w ); virtual ~wxNSTextViewControl(); virtual wxString GetStringValue() const ; virtual void SetStringValue( const wxString &str) ; virtual void Copy() ; virtual void Cut() ; virtual void Paste() ; virtual bool CanPaste() const ; virtual void SetEditable(bool editable) ; virtual void GetSelection( long* from, long* to) const ; virtual void SetSelection( long from , long to ); virtual void WriteText(const wxString& str) ; virtual void SetFont( const wxFont & font , const wxColour& foreground , long windowStyle, bool ignoreBlack = true ); virtual bool GetStyle(long position, wxTextAttr& style); virtual void SetStyle(long start, long end, const wxTextAttr& style); virtual bool CanFocus() const; virtual bool HasOwnContextMenu() const { return true; } virtual void CheckSpelling(bool check); virtual wxSize GetBestSize() const; protected: NSScrollView* m_scrollView; NSTextView* m_textView; }; class wxNSComboBoxControl : public wxNSTextFieldControl, public wxComboWidgetImpl { public : wxNSComboBoxControl( wxComboBox *wxPeer, WXWidget w ); virtual ~wxNSComboBoxControl(); virtual int GetSelectedItem() const; virtual void SetSelectedItem(int item); virtual int GetNumberOfItems() const; virtual void InsertItem(int pos, const wxString& item); virtual void RemoveItem(int pos); virtual void Clear(); virtual wxString GetStringAtIndex(int pos) const; virtual int FindString(const wxString& text) const; private: NSComboBox* m_comboBox; }; #endif // _WX_OSX_COCOA_PRIVATE_TEXTIMPL_H_
#include "ekg2.h" #define DBUS_API_SUBJECT_TO_CHANGE #include <dbus/dbus.h> #include "dbus.h" static EKG2_DBUS_IFACE_HANDLER(ekg2_dbus_iface_im_getProtocols); static EKG2_DBUS_IFACE_HANDLER(ekg2_dbus_iface_im_setStatus); static ekg2_dbus_iface_function_t const ekg2_dbus_iface_im_functions[] = { { "getProtocols", DBUS_MESSAGE_TYPE_METHOD_CALL, ekg2_dbus_iface_im_getProtocols }, { "setStatus", DBUS_MESSAGE_TYPE_METHOD_CALL, ekg2_dbus_iface_im_setStatus } }; static EKG2_DBUS_IFACE_HANDLER(ekg2_dbus_iface_im_getProtocols) { #define __FUNCTION__ "ekg2_dbus_iface_im_getProtocols" EKG2_DBUS_CALL_HANDLER_VARIABLES; const plugin_t *p; EKG2_DBUS_INIT_REPLY; for (p = plugins; p; p = p->next) { if (p->pclass == PLUGIN_PROTOCOL && p->priv) { struct protocol_plugin_priv *pp = p->priv; const char **a; for (a = pp->protocols; *a; a++) EKG2_DBUS_ADD_STRING(a); } } EKG2_DBUS_SEND_REPLY; return DBUS_HANDLER_RESULT_HANDLED; #undef __FUNCTION__ } /* m setStatus(DBUS_TYPE_STRING:presence, DBUS_TYPE_STRING:description) */ static EKG2_DBUS_IFACE_HANDLER(ekg2_dbus_iface_im_setStatus) { #define __FUNCTION__ "ekg2_dbus_iface_im_setStatus" EKG2_DBUS_CALL_HANDLER_VARIABLES; static char const status_errory[][20] = { "OK", "wrong argument", "session not found" }; char *error; DBusMessageIter iter; char const *param, *cmd; int current_type, st; session_t *s; list_t l; EKG2_DBUS_INIT_REPLY; dbus_message_iter_init (msg, &iter); if ((current_type = dbus_message_iter_get_arg_type (&iter)) != DBUS_TYPE_STRING) { error = status_errory[1]; EKG2_DBUS_ADD_STRING(&error); goto send_and_return; } dbus_message_iter_get_basic (&iter, &param); st = ekg_status_int(param); dbus_message_iter_next (&iter); if ((current_type = dbus_message_iter_get_arg_type (&iter)) != DBUS_TYPE_STRING) { error = status_errory[1]; EKG2_DBUS_ADD_STRING(&error); goto send_and_return; } dbus_message_iter_get_basic (&iter, &param); cmd = ekg_status_string(st, 1); for (l = sessions; l; l = l->next) { s = l->data; debug ("changing (%s) to: %s %s\n", s->uid, cmd, param); command_exec_format(NULL, s, 1, ("/%s %s"), cmd, param); } error = status_errory[0]; EKG2_DBUS_ADD_STRING(&error); send_and_return: EKG2_DBUS_SEND_REPLY; return DBUS_HANDLER_RESULT_HANDLED; #undef __FUNCTION__ } static EKG2_DBUS_IFACE_HANDLER(ekg2_dbus_iface_im_getPresence) { DBusMessage *reply; DBusMessageIter args; char **protos = NULL; dbus_uint32_t serial = 0; const plugin_t *p; reply = dbus_message_new_method_return(msg); dbus_message_iter_init_append(reply, &args); for (p = plugins; p; p = p->next) { if (p->pclass == PLUGIN_PROTOCOL && p->priv) { struct protocol_plugin_priv *pp = p->priv; const char **a; for (a = pp->protocols; *a; a++) { if (!dbus_message_iter_append_basic(&args, DBUS_TYPE_STRING, a)) { g_printerr("ekg2_dbus_iface_im_getProtocols cannot allocate memory?\n"); abort(); } } } } if (!dbus_connection_send(conn, reply, &serial)) { debug("Cannot send reply!\n"); return DBUS_HANDLER_RESULT_NOT_YET_HANDLED; /* XXX */ } dbus_connection_flush(conn); return DBUS_HANDLER_RESULT_HANDLED; } EKG2_DBUS_IFACE_HANDLER(ekg2_dbus_iface_im) { int i, type; char const * const function_name = dbus_message_get_member(msg); type = dbus_message_get_type(msg); debug_error("zzzz> %s %d == %d\n", function_name, type,DBUS_MESSAGE_TYPE_METHOD_CALL ); for (i = 0; i < sizeof(ekg2_dbus_iface_im_functions) / sizeof(ekg2_dbus_iface_function_t); i++) { if (type == ekg2_dbus_iface_im_functions[i].type && ekg2_dbus_iface_im_functions[i].handler && !xstrcmp(function_name, ekg2_dbus_iface_im_functions[i].name)) { debug_function("calling handler\n"); return ekg2_dbus_iface_im_functions[i].handler(conn, msg, data); } } return DBUS_HANDLER_RESULT_HANDLED; }
/* * Copyright (C) 2004, 2005 Internet Systems Consortium, Inc. ("ISC") * Copyright (C) 2000, 2001 Internet Software Consortium. * * Permission to use, copy, modify, and distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY * AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR * PERFORMANCE OF THIS SOFTWARE. */ /* $Id: os.c,v 1.13.18.3 2005/10/14 02:13:08 marka Exp $ */ #include <config.h> #include <isc/os.h> #ifdef HAVE_SYSCONF #include <unistd.h> #ifndef __hpux static inline long sysconf_ncpus(void) { #if defined(_SC_NPROCESSORS_ONLN) return sysconf((_SC_NPROCESSORS_ONLN)); #elif defined(_SC_NPROC_ONLN) return sysconf((_SC_NPROC_ONLN)); #else return (0); #endif } #endif #endif /* HAVE_SYSCONF */ #ifdef __hpux #include <sys/pstat.h> static inline int hpux_ncpus(void) { struct pst_dynamic psd; if (pstat_getdynamic(&psd, sizeof(psd), 1, 0) != -1) return (psd.psd_proc_cnt); else return (0); } #endif /* __hpux */ #if defined(HAVE_SYS_SYSCTL_H) && defined(HAVE_SYSCTLBYNAME) #include <sys/types.h> /* for FreeBSD */ #include <sys/param.h> /* for NetBSD */ #include <sys/sysctl.h> static int sysctl_ncpus(void) { int ncpu, result; size_t len; len = sizeof(ncpu); result = sysctlbyname("hw.ncpu", &ncpu, &len , 0, 0); if (result != -1) return (ncpu); return (0); } #endif unsigned int isc_os_ncpus(void) { long ncpus = 0; #ifdef __hpux ncpus = hpux_ncpus(); #elif defined(HAVE_SYSCONF) ncpus = sysconf_ncpus(); #endif #if defined(HAVE_SYS_SYSCTL_H) && defined(HAVE_SYSCTLBYNAME) if (ncpus <= 0) ncpus = sysctl_ncpus(); #endif if (ncpus <= 0) ncpus = 1; return ((unsigned int)ncpus); }
class wiz_state : public driver_device { public: wiz_state(const machine_config &mconfig, device_type type, const char *tag) : driver_device(mconfig, type, tag) { } UINT8 *m_videoram; int m_dsc0; int m_dsc1; UINT8 *m_videoram2; UINT8 *m_colorram2; UINT8 *m_attributesram; UINT8 *m_attributesram2; UINT8 *m_sprite_bank; INT32 m_flipx; INT32 m_flipy; INT32 m_bgpen; UINT8 m_char_bank[2]; UINT8 m_palbank[2]; int m_palette_bank; UINT8 *m_spriteram; UINT8 *m_spriteram2; size_t m_spriteram_size; UINT8 m_nmi_mask; }; /*----------- defined in video/wiz.c -----------*/ WRITE8_HANDLER( wiz_char_bank_select_w ); WRITE8_HANDLER( wiz_palettebank_w ); WRITE8_HANDLER( wiz_bgcolor_w ); WRITE8_HANDLER( wiz_flipx_w ); WRITE8_HANDLER( wiz_flipy_w ); VIDEO_START( wiz ); PALETTE_INIT( wiz ); SCREEN_UPDATE( wiz ); SCREEN_UPDATE( stinger ); SCREEN_UPDATE( kungfut );
/* * Dibbler - a portable DHCPv6 * * authors: Tomasz Mrugalski <thomson@klub.com.pl> * Marek Senderski <msend@o2.pl> * changes: Michal Kowalczuk <michal@kowalczuk.eu> * * released under GNU GPL v2 only licence */ class TMsg; #ifndef MSG_H #define MSG_H #include <iostream> #include <string> #include <vector> #include <list> #include "SmartPtr.h" #include "Container.h" #include "DHCPConst.h" #include "IPv6Addr.h" #include "Opt.h" #include "OptDUID.h" #include "OptOptionRequest.h" #include "Key.h" #include "ScriptParams.h" class TOptStatusCode; // Hey! It's grampa of all messages class TMsg { public: // Used to create TMsg object (normal way) TMsg(int iface, SPtr<TIPv6Addr> addr, int msgType); TMsg(int iface, SPtr<TIPv6Addr> addr, int msgType, long transID); // used to create TMsg object based on received char[] data TMsg(int iface, SPtr<TIPv6Addr> addr, char* &buf, int &bufSize); virtual int getSize(); // transmit (or retransmit) virtual unsigned long getTimeout(); virtual int storeSelf(char * buffer); virtual std::string getName() const = 0; // returns requested option (or NULL, there is no such option) SPtr<TOpt> getOption(int type) const; void firstOption(); int countOption(); void addOption(SPtr<TOpt> opt) { Options.push_back(opt); } virtual SPtr<TOpt> getOption(); long getType(); long getTransID(); TOptList & getOptLst(); int getIface(); virtual ~TMsg(); bool isDone(); bool isDone(bool done); // useful auth stuff below void calculateDigests(char* buffer, size_t len); /// @todo: remove from here (and move to AUTH option) void setAuthDigestPtr(char* ptr, unsigned len); bool loadAuthKey(); void setAuthKey(const TKey& key); TKey getAuthKey(); bool validateAuthInfo(char *buf, int bufSize, AuthProtocols proto, const DigestTypesLst& acceptedDigestTypes); uint32_t getSPI(); void setSPI(uint32_t val); DigestTypes DigestType_; // notify scripts stuff void* getNotifyScriptParams(); SPtr<TIPv6Addr> getRemoteAddr(); void setLocalAddr(SPtr<TIPv6Addr> myaddr); SPtr<TIPv6Addr> getLocalAddr(); /// @brief returns server-id option (if present) SPtr<TOptDUID> getServerID() const; /// @brief returns client-id option (if present) SPtr<TOptDUID> getClientID() const; /// @brief returns ORO (if present) SPtr<TOptOptionRequest> getORO() const; protected: int MsgType; long TransID; bool delOption(int code); TOptList Options; TOptList::iterator NextOpt; // to be removed together with firstOption() and getOption(); void setAttribs(int iface, SPtr<TIPv6Addr> addr, int msgType, long transID); virtual bool check(bool clntIDmandatory, bool srvIDmandatory); bool IsDone; // Is this transaction done? int Iface; // logical interface (for direct messages it equals PhysicalIface // for relayed messages Iface points to relayX, PhysicalInterface to ethX) /// Address of the corresponding node (received from or to be sent to) /// @todo: rename to RemoteAddr_ SPtr<TIPv6Addr> PeerAddr_; /// Address the packet was received on SPtr<TIPv6Addr> LocalAddr_; // Auth stuff uint32_t SPI_; // Key identifier char* AuthDigestPtr_; // Digest (pointer to Authentication Information field of OPTION AUTH) unsigned AuthDigestLen_; // Length of the digest TKey AuthKey_; // Auth Key // a pointer to NotifyScriptParams structure (if defined) TNotifyScriptParams* NotifyScripts; }; typedef std::list< SPtr<TMsg> > TMsgLst; #endif
/* * Copyright (C) 2004-2006 Atmel Corporation * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as * published by the Free Software Foundation. */ #ifndef __ASM_AVR32_THREAD_INFO_H #define __ASM_AVR32_THREAD_INFO_H #include <asm/page.h> #define THREAD_SIZE_ORDER 1 #define THREAD_SIZE (PAGE_SIZE << THREAD_SIZE_ORDER) #ifndef __ASSEMBLY__ #include <asm/types.h> struct task_struct; struct exec_domain; struct thread_info { struct task_struct *task; /* main task structure */ struct exec_domain *exec_domain; /* execution domain */ unsigned long flags; /* low level flags */ __u32 cpu; __s32 preempt_count; /* 0 => preemptable, <0 => BUG */ __u32 rar_saved; /* return address... */ __u32 rsr_saved; /* ...and status register saved by debug handler when setting up trampoline */ struct restart_block restart_block; __u8 supervisor_stack[0]; }; #define INIT_THREAD_INFO(tsk) \ { \ .task = &tsk, \ .exec_domain = &default_exec_domain, \ .flags = 0, \ .cpu = 0, \ .preempt_count = INIT_PREEMPT_COUNT, \ .restart_block = { \ .fn = do_no_restart_syscall \ } \ } #define init_thread_info (init_thread_union.thread_info) #define init_stack (init_thread_union.stack) /* * Get the thread information struct from C. * We do the usual trick and use the lower end of the stack for this */ static inline struct thread_info *current_thread_info(void) { unsigned long addr = ~(THREAD_SIZE - 1); asm("and %0, sp" : "=r"(addr) : "0"(addr)); return (struct thread_info *)addr; } #define get_thread_info(ti) get_task_struct((ti)->task) #define put_thread_info(ti) put_task_struct((ti)->task) #endif /* !__ASSEMBLY__ */ /* * Thread information flags * - these are process state flags that various assembly files may need to access * - pending work-to-be-done flags are in LSW * - other flags in MSW */ #define TIF_SYSCALL_TRACE 0 /* syscall trace active */ #define TIF_SIGPENDING 1 /* signal pending */ #define TIF_NEED_RESCHED 2 /* rescheduling necessary */ #define TIF_BREAKPOINT 4 /* enter monitor mode on return */ #define TIF_SINGLE_STEP 5 /* single step in progress */ #define TIF_MEMDIE 6 /* is terminating due to OOM killer */ #define TIF_RESTORE_SIGMASK 7 /* restore signal mask in do_signal */ #define TIF_CPU_GOING_TO_SLEEP 8 /* CPU is entering sleep 0 mode */ #define TIF_NOTIFY_RESUME 9 /* callback before returning to user */ #define TIF_DEBUG 30 /* debugging enabled */ #define TIF_USERSPACE 31 /* true if FS sets userspace */ #define _TIF_SYSCALL_TRACE (1 << TIF_SYSCALL_TRACE) #define _TIF_SIGPENDING (1 << TIF_SIGPENDING) #define _TIF_NEED_RESCHED (1 << TIF_NEED_RESCHED) #define _TIF_SINGLE_STEP (1 << TIF_SINGLE_STEP) #define _TIF_MEMDIE (1 << TIF_MEMDIE) #define _TIF_RESTORE_SIGMASK (1 << TIF_RESTORE_SIGMASK) #define _TIF_CPU_GOING_TO_SLEEP (1 << TIF_CPU_GOING_TO_SLEEP) #define _TIF_NOTIFY_RESUME (1 << TIF_NOTIFY_RESUME) /* Note: The masks below must never span more than 16 bits! */ /* work to do on interrupt/exception return */ #define _TIF_WORK_MASK \ ((1 << TIF_SIGPENDING) \ | _TIF_NOTIFY_RESUME \ | (1 << TIF_NEED_RESCHED) \ | (1 << TIF_BREAKPOINT) \ | (1 << TIF_RESTORE_SIGMASK)) /* work to do on any return to userspace */ #define _TIF_ALLWORK_MASK (_TIF_WORK_MASK | (1 << TIF_SYSCALL_TRACE) | \ _TIF_NOTIFY_RESUME) /* work to do on return from debug mode */ #define _TIF_DBGWORK_MASK (_TIF_WORK_MASK & ~(1 << TIF_BREAKPOINT)) #endif /* __ASM_AVR32_THREAD_INFO_H */
#pragma once #include "il2cpp-config.h" #ifndef _MSC_VER # include <alloca.h> #else # include <malloc.h> #endif #include <stdint.h> #include <assert.h> #include <exception> // System.Collections.CaseInsensitiveHashCodeProvider struct CaseInsensitiveHashCodeProvider_t576; // System.Globalization.CultureInfo struct CultureInfo_t345; // System.Globalization.TextInfo struct TextInfo_t817; // System.Object struct Object_t; #include "codegen/il2cpp-codegen.h" // System.Void System.Collections.CaseInsensitiveHashCodeProvider::.ctor() extern "C" void CaseInsensitiveHashCodeProvider__ctor_m4854 (CaseInsensitiveHashCodeProvider_t576 * __this, const MethodInfo* method) IL2CPP_METHOD_ATTR; // System.Void System.Collections.CaseInsensitiveHashCodeProvider::.ctor(System.Globalization.CultureInfo) extern "C" void CaseInsensitiveHashCodeProvider__ctor_m4855 (CaseInsensitiveHashCodeProvider_t576 * __this, CultureInfo_t345 * ___culture, const MethodInfo* method) IL2CPP_METHOD_ATTR; // System.Void System.Collections.CaseInsensitiveHashCodeProvider::.cctor() extern "C" void CaseInsensitiveHashCodeProvider__cctor_m4856 (Object_t * __this /* static, unused */, const MethodInfo* method) IL2CPP_METHOD_ATTR; // System.Boolean System.Collections.CaseInsensitiveHashCodeProvider::AreEqual(System.Globalization.CultureInfo,System.Globalization.CultureInfo) extern "C" bool CaseInsensitiveHashCodeProvider_AreEqual_m4857 (Object_t * __this /* static, unused */, CultureInfo_t345 * ___a, CultureInfo_t345 * ___b, const MethodInfo* method) IL2CPP_METHOD_ATTR; // System.Boolean System.Collections.CaseInsensitiveHashCodeProvider::AreEqual(System.Globalization.TextInfo,System.Globalization.CultureInfo) extern "C" bool CaseInsensitiveHashCodeProvider_AreEqual_m4858 (Object_t * __this /* static, unused */, TextInfo_t817 * ___info, CultureInfo_t345 * ___culture, const MethodInfo* method) IL2CPP_METHOD_ATTR; // System.Collections.CaseInsensitiveHashCodeProvider System.Collections.CaseInsensitiveHashCodeProvider::get_DefaultInvariant() extern "C" CaseInsensitiveHashCodeProvider_t576 * CaseInsensitiveHashCodeProvider_get_DefaultInvariant_m2238 (Object_t * __this /* static, unused */, const MethodInfo* method) IL2CPP_METHOD_ATTR; // System.Int32 System.Collections.CaseInsensitiveHashCodeProvider::GetHashCode(System.Object) extern "C" int32_t CaseInsensitiveHashCodeProvider_GetHashCode_m4859 (CaseInsensitiveHashCodeProvider_t576 * __this, Object_t * ___obj, const MethodInfo* method) IL2CPP_METHOD_ATTR;
#ifndef _INPUT_POLLDEV_H #define _INPUT_POLLDEV_H /* * Copyright (c) 2007 Dmitry Torokhov * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 as published by * the Free Software Foundation. */ #include <linux/input.h> #include <linux/workqueue.h> /** * struct input_polled_dev - simple polled input device * @private: private driver data * @flush: driver-supplied method that flushes device's state upon * opening (optional) * @poll: driver-supplied method that polls the device and posts * input events (mandatory). * @poll_interval: specifies how often the poll() method shoudl be called. * @input: input device structire associated with the polled device. * Must be properly initialized by the driver (id, name, phys, bits). * * Polled input device provides a skeleton for supporting simple input * devices that do not raise interrupts but have to be periodically * scanned or polled to detect changes in their state. */ struct input_polled_dev { void *private; void (*flush)(struct input_polled_dev *dev); void (*poll)(struct input_polled_dev *dev); unsigned int poll_interval; /* msec */ struct input_dev *input; struct delayed_work work; int stop; }; struct input_polled_dev *input_allocate_polled_device(void); void input_free_polled_device(struct input_polled_dev *dev); int input_register_polled_device(struct input_polled_dev *dev); void input_unregister_polled_device(struct input_polled_dev *dev); void input_stop_polled_device(struct input_dev *input); int input_resume_polled_device(struct input_dev *input); #endif
/* ** settingsmenu.h ** ** This file is part of mkxp. ** ** Copyright (C) 2014 Jonas Kulla <Nyocurio@gmail.com> ** ** mkxp 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. ** ** mkxp 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 mkxp. If not, see <http://www.gnu.org/licenses/>. */ #ifndef SETTINGSMENU_H #define SETTINGSMENU_H #include <stdint.h> #include <map> #include <SDL_joystick.h> struct SettingsMenuPrivate; struct RGSSThreadData; union SDL_Event; class SettingsMenu { public: SettingsMenu(RGSSThreadData &rtData); ~SettingsMenu(); /* Returns true if the event was consumed */ bool onEvent(const SDL_Event &event, const std::map<int, SDL_Joystick*> &joysticks); void raise(); bool destroyReq() const; private: SettingsMenuPrivate *p; }; #endif // SETTINGSMENU_H
/* * Copyright (c) 2013 Dmitry Kazakov <dimula73@gmail.com> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifndef __KIS_DYNAMIC_SENSOR_DRAWING_ANGLE_H #define __KIS_DYNAMIC_SENSOR_DRAWING_ANGLE_H #include "kis_dynamic_sensor.h" class KisDynamicSensorDrawingAngle : public QObject, public KisDynamicSensor { Q_OBJECT public: KisDynamicSensorDrawingAngle(); qreal value(const KisPaintInformation& info); bool dependsOnCanvasRotation() const; QWidget* createConfigurationWidget(QWidget* parent, QWidget*); using KisSerializableConfiguration::fromXML; using KisSerializableConfiguration::toXML; void toXML(QDomDocument&, QDomElement&) const; void fromXML(const QDomElement&); bool fanCornersEnabled() const; int fanCornersStep() const; int angleOffset() const; public Q_SLOTS: void setFanCornersEnabled(int state); void setFanCornersStep(int angle); void setAngleOffset(int angle); private: bool m_fanCornersEnabled; int m_fanCornersStep; int m_angleOffset; // in degrees }; #endif /* __KIS_DYNAMIC_SENSOR_DRAWING_ANGLE_H */
/* * 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. * * Written (W) 1999-2009 Soeren Sonnenburg * Copyright (C) 1999-2009 Fraunhofer Institute FIRST and Max-Planck-Society */ #ifndef _REALDISTANCE_H__ #define _REALDISTANCE_H__ #include <shogun/distance/DenseDistance.h> #include <shogun/lib/common.h> namespace shogun { /** @brief class RealDistance */ class CRealDistance : public CDenseDistance<float64_t> { public: /** default constructor */ CRealDistance() : CDenseDistance<float64_t>() {} /** init distance * * @param l features of left-hand side * @param r features of right-hand side * @return if init was successful */ virtual bool init(CFeatures* l, CFeatures* r) { CDenseDistance<float64_t>::init(l,r); ASSERT(l->get_feature_type()==F_DREAL) ASSERT(r->get_feature_type()==F_DREAL) return true; } /** get feature type the distance can deal with * * @return feature type DREAL */ virtual EFeatureType get_feature_type() { return F_DREAL; } /** Returns the name of the SGSerializable instance. It MUST BE * the CLASS NAME without the prefixed `C'. * * @return name of the SGSerializable */ virtual const char* get_name() const { return "RealDistance"; } /** cleanup distance * * abstract base method */ virtual void cleanup()=0; /** get distance type we are * * abstrace base method * * @return distance type */ virtual EDistanceType get_distance_type()=0 ; protected: /// compute distance function for features a and b /// idx_{a,b} denote the index of the feature vectors /// in the corresponding feature object virtual float64_t compute(int32_t x, int32_t y)=0; }; } // namespace shogun #endif
/**************************************************************************** ** ** Copyright (C) 2020 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** ** This file is part of the Qt Design Tooling ** ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in ** a written agreement between you and The Qt Company. For licensing terms ** and conditions see https://www.qt.io/terms-conditions. For further ** information use the contact form at https://www.qt.io/contact-us. ** ** GNU General Public License Usage ** Alternatively, this file may be used under the terms of the GNU ** General Public License version 3 as published by the Free Software ** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT ** included in the packaging of this file. Please review the following ** information to ensure the GNU General Public License requirements will ** be met: https://www.gnu.org/licenses/gpl-3.0.html. ** ****************************************************************************/ #pragma once #include <QToolBar> #include <QWidget> namespace QmlDesigner { struct Axis { static Axis compute(double dmin, double dmax, double height, double pt); double lmin; double lmax; double lstep; }; } // End namespace QmlDesigner.
/* radare - LGPL - Copyright 2009-2014 - nibble */ #include <stdio.h> #include <stdarg.h> #include <string.h> #include <r_types.h> #include <r_lib.h> #include <r_util.h> #include <r_asm.h> #include "dis-asm.h" static unsigned long Offset = 0; static char *buf_global = NULL; static unsigned char bytes[4]; static int ppc_buffer_read_memory (bfd_vma memaddr, bfd_byte *myaddr, ut32 length, struct disassemble_info *info) { memcpy (myaddr, bytes, length); return 0; } static int symbol_at_address(bfd_vma addr, struct disassemble_info * info) { return 0; } static void memory_error_func(int status, bfd_vma memaddr, struct disassemble_info *info) { //-- } static void print_address(bfd_vma address, struct disassemble_info *info) { char tmp[32]; if (buf_global == NULL) return; sprintf(tmp, "0x%08"PFMT64x"", (ut64)address); strcat(buf_global, tmp); } static int buf_fprintf(void *stream, const char *format, ...) { int flen, glen; va_list ap; char *tmp; if (buf_global == NULL) return 0; va_start (ap, format); flen = strlen (format); glen = strlen (buf_global); tmp = malloc (flen + glen + 2); memcpy (tmp, buf_global, glen); memcpy (tmp+glen, format, flen); tmp[flen+glen] = 0; // XXX: overflow here? vsprintf (buf_global, tmp, ap); va_end (ap); free (tmp); return 0; } static int disassemble(RAsm *a, struct r_asm_op_t *op, const ut8 *buf, int len) { static struct disassemble_info disasm_obj; if (len<4) return -1; buf_global = op->buf_asm; Offset = a->pc; memcpy (bytes, buf, 4); // TODO handle thumb /* prepare disassembler */ memset (&disasm_obj, '\0', sizeof (struct disassemble_info)); disasm_obj.disassembler_options=(a->bits==64)?"64":""; disasm_obj.buffer = bytes; disasm_obj.read_memory_func = &ppc_buffer_read_memory; disasm_obj.symbol_at_address_func = &symbol_at_address; disasm_obj.memory_error_func = &memory_error_func; disasm_obj.print_address_func = &print_address; disasm_obj.endian = !a->big_endian; disasm_obj.fprintf_func = &buf_fprintf; disasm_obj.stream = stdout; op->buf_asm[0]='\0'; if (a->big_endian) op->size = print_insn_big_powerpc((bfd_vma)Offset, &disasm_obj); else op->size = print_insn_little_powerpc((bfd_vma)Offset, &disasm_obj); if (op->size == -1) strncpy (op->buf_asm, " (data)", R_ASM_BUFSIZE); return op->size; } RAsmPlugin r_asm_plugin_ppc = { .name = "ppc", .arch = "ppc", .license = "GPL3", .bits = 32|64, .desc = "PowerPC", .init = NULL, .fini = NULL, .disassemble = &disassemble, .assemble = NULL }; #ifndef CORELIB struct r_lib_struct_t radare_plugin = { .type = R_LIB_TYPE_ASM, .data = &r_asm_plugin_ppc }; #endif
#include "meta.h" #include "../util.h" /* ISH+ISD */ VGMSTREAM * init_vgmstream_ish_isd(STREAMFILE *streamFile) { VGMSTREAM * vgmstream = NULL; STREAMFILE * streamFileISH = NULL; char filename[PATH_LIMIT]; char filenameISH[PATH_LIMIT]; int i; int channel_count; int loop_flag; /* check extension, case insensitive */ streamFile->get_name(streamFile,filename,sizeof(filename)); if (strcasecmp("isd",filename_extension(filename))) goto fail; strcpy(filenameISH,filename); strcpy(filenameISH+strlen(filenameISH)-3,"ish"); streamFileISH = streamFile->open(streamFile,filenameISH,STREAMFILE_DEFAULT_BUFFER_SIZE); if (!streamFileISH) goto fail; /* check header */ if (read_32bitBE(0x00,streamFileISH) != 0x495F5346) /* "I_SF" */ goto fail; channel_count = read_32bitBE(0x14,streamFileISH); loop_flag = (read_32bitBE(0x1C,streamFileISH) !=0); /* build the VGMSTREAM */ vgmstream = allocate_vgmstream(channel_count,loop_flag); if (!vgmstream) goto fail; /* fill in the vital statistics */ vgmstream->channels = channel_count; vgmstream->sample_rate = read_32bitBE(0x08,streamFileISH); vgmstream->num_samples=read_32bitBE(0x0C,streamFileISH); vgmstream->coding_type = coding_NGC_DSP; if(loop_flag) { vgmstream->loop_start_sample = read_32bitBE(0x20,streamFileISH)*14/8/channel_count; vgmstream->loop_end_sample = read_32bitBE(0x24,streamFileISH)*14/8/channel_count; } if (channel_count == 1) { vgmstream->layout_type = layout_none; } else if (channel_count == 2) { vgmstream->layout_type = layout_interleave; vgmstream->interleave_block_size = read_32bitBE(0x18,streamFileISH); } vgmstream->meta_type = meta_ISH_ISD; /* open the file for reading by each channel */ { for (i=0;i<channel_count;i++) { vgmstream->ch[i].streamfile = streamFile->open(streamFile,filename,vgmstream->interleave_block_size); if (!vgmstream->ch[i].streamfile) goto fail; vgmstream->ch[i].channel_start_offset= vgmstream->ch[i].offset=i*vgmstream->interleave_block_size; } } if (vgmstream->coding_type == coding_NGC_DSP) { int i; for (i=0;i<16;i++) { vgmstream->ch[0].adpcm_coef[i] = read_16bitBE(0x40+i*2,streamFileISH); } if (vgmstream->channels == 2) { for (i=0;i<16;i++) { vgmstream->ch[1].adpcm_coef[i] = read_16bitBE(0x80+i*2,streamFileISH); } } } close_streamfile(streamFileISH); streamFileISH=NULL; return vgmstream; /* clean up anything we may have opened */ fail: if (streamFileISH) close_streamfile(streamFileISH); if (vgmstream) close_vgmstream(vgmstream); return NULL; }
/* Copyright 2011 Etay Meiri 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 DS_POINT_LIGHT_PASS_TECH_H #define DS_POINT_LIGHT_PASS_TECH_H #include "ds_light_pass_tech.h" #include "lights_common.h" class DSPointLightPassTech : public DSLightPassTech { public: DSPointLightPassTech(); bool Init(); void SetPointLight(const PointLight& Lights); private: struct { GLuint Color; GLuint AmbientIntensity; GLuint DiffuseIntensity; GLuint Position; struct { GLuint Constant; GLuint Linear; GLuint Exp; } Atten; } m_pointLightLocation; }; #endif
// ************************************************************************** // // // BornAgain: simulate and fit scattering at grazing incidence // //! @file Core/Simulation/OffSpecSimulation.h //! @brief Defines class OffSpecSimulation. //! //! @homepage http://www.bornagainproject.org //! @license GNU General Public License v3 or higher (see COPYING) //! @copyright Forschungszentrum Jülich GmbH 2018 //! @authors Scientific Computing Group at MLZ (see CITATION, AUTHORS) // // ************************************************************************** // #ifndef OFFSPECSIMULATION_H #define OFFSPECSIMULATION_H #include "Simulation2D.h" #include "SimulationElement.h" class Histogram2D; //! Main class to run an off-specular simulation. //! @ingroup simulation class BA_CORE_API_ OffSpecSimulation : public Simulation2D { public: OffSpecSimulation(); OffSpecSimulation(const MultiLayer& p_sample); OffSpecSimulation(const std::shared_ptr<class IMultiLayerBuilder> p_sample_builder); ~OffSpecSimulation() final {} OffSpecSimulation* clone() const override { return new OffSpecSimulation(*this); } void accept(INodeVisitor* visitor) const final { visitor->visit(this); } //! Put into a clean state for running a simulation void prepareSimulation() final; //! Returns the results of the simulation in a format that supports unit conversion and export //! to numpy arrays SimulationResult result() const override; //! Sets beam parameters from here (forwarded to Instrument) void setBeamParameters(double wavelength, const IAxis& alpha_axis, double phi_i); //! Returns axis of the beam. const IAxis* beamAxis() const; #ifndef SWIG std::unique_ptr<IUnitConverter> createUnitConverter() const; #endif //! Returns the total number of the intensity values in the simulation result size_t intensityMapSize() const override; private: OffSpecSimulation(const OffSpecSimulation& other); //! Initializes the vector of Simulation elements void initSimulationElementVector() override; //! Checks the distribution validity for simulation. void validateParametrization(const ParameterDistribution& par_distr) const override; //! Creates the appropriate data structure (e.g. 2D intensity map) from the calculated //! SimulationElement objects void transferResultsToIntensityMap() override; //! Default implementation only adds the detector axes void updateIntensityMap() override; //! Gets the number of elements this simulation needs to calculate size_t numberOfSimulationElements() const final; //! Normalize, apply detector resolution and transfer detector image corresponding to //! alpha_i = mp_alpha_i_axis->getBin(index) void transferDetectorImage(size_t index); //! Check correct number of axes void checkInitialization() const; void initialize(); std::unique_ptr<IAxis> mP_alpha_i_axis; OutputData<double> m_intensity_map; }; #endif // OFFSPECSIMULATION_H
long main(long x, long y, long z){}
/*************************************************************************** * Copyright (C) 2008 by BogDan Vatra * * bogdan@licentia.eu * * * * 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 ABOUTDIALOG_H #define ABOUTDIALOG_H #include <QDialog> #include "ui_aboutdialog.h" class AboutDialog : public QDialog, private Ui::aboutDialog { Q_OBJECT public: AboutDialog(QWidget* parent = 0, Qt::WFlags fl = 0); ~AboutDialog(); /*$PUBLIC_FUNCTIONS$*/ public slots: /*$PUBLIC_SLOTS$*/ protected: /*$PROTECTED_FUNCTIONS$*/ protected slots: /*$PROTECTED_SLOTS$*/ }; #endif
// // BAGEL - Brilliantly Advanced General Electronic Structure Library // Filename: _vrr_drv.h // Copyright (C) 2012 Toru Shiozaki // // Author: Toru Shiozaki <shiozaki@northwestern.edu> // Maintainer: Shiozaki group // // This file is part of the BAGEL package. // // 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/>. // // replaces generated codes _vrr_xxxx.cc etc #ifndef __SRC_INTEGRAL_RYS____VRR_DRIVER_H #define __SRC_INTEGRAL_RYS____VRR_DRIVER_H #include <numeric> #include <algorithm> #include <array> #include <src/integral/rys/int2d.h> #include <src/integral/rys/scaledata.h> namespace bagel { template<int a_, int b_, int c_, int d_, int rank_, typename DataType> void vrr_driver(DataType* out, const DataType* const roots, const DataType* const weights, const DataType& coeff, const std::array<double,3>& A, const std::array<double,3>& B, const std::array<double,3>& C, const std::array<double,3>& D, const DataType* const P, const DataType* const Q, const double& xp, const double& xq, const int* const amap, const int* const cmap, const int& asize_, DataType* const workx, DataType* const worky, DataType* const workz) { // compile time constexpr int amax_ = a_+b_; constexpr int cmax_ = c_+d_; constexpr int amax1_ = a_+b_+1; constexpr int cmax1_ = c_+d_+1; constexpr int amin_ = a_; constexpr int cmin_ = c_; constexpr int isize = (amax_ + 1) * (cmax_ + 1); constexpr int worksize = rank_ * isize; alignas(32) DataType iyiz[rank_]; const double oxp2 = 0.5 / xp; const double oxq2 = 0.5 / xq; const double opq = 1.0 / (xp + xq); int2d<amax_,cmax_,rank_, DataType>(P[0], Q[0], A[0], B[0], C[0], D[0], xp, xq, oxp2, oxq2, opq, roots, workx); scaledata<rank_, worksize, DataType>(workx, weights, coeff, workx); int2d<amax_,cmax_,rank_, DataType>(P[1], Q[1], A[1], B[1], C[1], D[1], xp, xq, oxp2, oxq2, opq, roots, worky); int2d<amax_,cmax_,rank_, DataType>(P[2], Q[2], A[2], B[2], C[2], D[2], xp, xq, oxp2, oxq2, opq, roots, workz); for (int iz = 0; iz <= cmax_; ++iz) { for (int iy = 0; iy <= cmax_ - iz; ++iy) { const int iyz = cmax1_ * (iy + cmax1_ * iz); for (int jz = 0; jz <= amax_; ++jz) { const int offsetz = rank_ * (amax1_ * iz + jz); for (int jy = 0; jy <= amax_ - jz; ++jy) { const int offsety = rank_ * (amax1_ * iy + jy); const int jyz = amax1_ * (jy + amax1_ * jz); for (int i = 0; i != rank_; ++i) iyiz[i] = worky[offsety + i] * workz[offsetz + i]; for (int ix = std::max(0, cmin_ - iy - iz); ix <= cmax_ - iy - iz; ++ix) { const int iposition = cmap[ix + iyz]; const int ipos_asize = iposition * asize_; for (int jx =std::max(0, amin_ - jy - jz); jx <= amax_ - jy - jz; ++jx) { const int offsetx = rank_ * (amax1_ * ix + jx); const int jposition = amap[jx + jyz]; const int ijposition = jposition + ipos_asize; out[ijposition] = blas::dot_product_noconj(iyiz, rank_, workx+offsetx); } } } } } } } } #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_CONFIG_CATEGORY_CORE_LAN_CONF_SECTION_H #define IPMI_CONFIG_CATEGORY_CORE_LAN_CONF_SECTION_H #include "ipmi-config.h" struct ipmi_config_section * ipmi_config_core_lan_conf_section_get (ipmi_config_state_data_t *state_data, unsigned int config_flags, int channel_index); #endif /* IPMI_CONFIG_CATEGORY_CORE_LAN_CONF_SECTION_H */
/* * Copyright (C) 2006-2007, 2010-2018 Free Software Foundation, Inc. * Written by Simon Josefsson * * 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/>. */ #include <config.h> #include "read-file.h" #include <stdio.h> #include <stdlib.h> #include <sys/stat.h> #define FILE1 "/etc/resolv.conf" #define FILE2 "/dev/null" int main (void) { struct stat statbuf; int err = 0; /* We can perform the test only if the file exists and is readable. Test whether it exists, then assume it is world-readable. */ if (stat (FILE1, &statbuf) >= 0) { size_t len; char *out = read_file (FILE1, &len); if (!out) { perror ("Could not read file"); err = 1; } else { if (out[len] != '\0') { perror ("BAD: out[len] not zero"); err = 1; } if (S_ISREG (statbuf.st_mode)) { /* FILE1 is a regular file or a symlink to a regular file. */ if (len != statbuf.st_size) { fprintf (stderr, "Read %lu from %s...\n", (unsigned long) len, FILE1); err = 1; } } else { /* Assume FILE1 is not empty. */ if (len == 0) { fprintf (stderr, "Read nothing from %s\n", FILE1); err = 1; } } free (out); } } /* We can perform the test only if the file exists and is readable. Test whether it exists, then assume it is world-readable. */ if (stat (FILE2, &statbuf) >= 0) { size_t len; char *out = read_file (FILE2, &len); if (!out) { perror ("Could not read file"); err = 1; } else { if (out[len] != '\0') { perror ("BAD: out[len] not zero"); err = 1; } /* /dev/null should always be empty. Ignore statbuf.st_size, since it is not a regular file. */ if (len != 0) { fprintf (stderr, "Read %lu from %s...\n", (unsigned long) len, FILE2); err = 1; } free (out); } } return err; }