text
stringlengths
4
6.14k
/* * $Id: resource.h,v 1.1 2003/06/30 08:41:22 dmitry Exp $ * * Copyright (c) 2003, Dmitry Yurtaev <dm1try@umail.ru> * * This is free software; you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation; either version 2, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * for more details. */ #define bigFontId 128 /* should be 128! */ /* * main form */ #define mainFormId 1000 #define mainTableId 1001 #define newButtonId 1002 #define tempLabelId 1003 #define mainScrollbarId 1004 #define aboutDialogId 1006 /* * menu */ #define alarmsMenuId 102 #define prefsMenuId 103 #define aboutMenuId 104 #define convertLogMenuId 105 #define newLogMenuId 106 #define renameLogMenuId 107 #define deleteLogMenuId 108 #define truncateLogMenuId 109 #define testMenuId 110 #define debugMenuId 111 /* * edit form */ #define editFormId 2000 #define doneButtonId 2001 #define timeLabelId 2003 #define peakButtonId 2004 #define scrollBarId 2012 #define scrollLeftButtonId 2013 #define scrollRightButtonId 2014 #define scrollerId 2015 #define graphId 2016 #define pauseCheckId 2017 #define logCheckId 2018 #define graphCheckId 2019 #define peakCheckId 2020 #define newLogAlertId 2100 #define renameLogFormId 2101 #define deleteLogAlertId 2102 #define truncateLogAlertId 2103 #define eraseFaultsAlertId 2105 #define versionAlertId 2106 #define newNameFieldId 2110 #define backupLogCheckId 2111 #define panelId 2200 #define bank1ButtonId 2400 #define bank2ButtonId 2401 #define bank3ButtonId 2402 #define bank4ButtonId 2403 #define bank5ButtonId 2404 // CD - Added additional bank buttons #define bank6ButtonId 2405 #define bankGroupId 2 #define reviewButtonId 2410 #define monitorButtonId 2411 #define testButtonId 2412 #define debugButtonId 2413 #define modeGroupId 3 #define hideUnusedButtonId 2420 #define debugFormId 2500 #define debugFieldId 2501 /* * test form */ #define testFormId 5000 #define testFirstId 5300 #define injLabelId 5300 #define inj1ButtonId 5301 #define inj2ButtonId 5302 #define inj3ButtonId 5303 #define inj4ButtonId 5304 #define inj5ButtonId 5305 #define inj6ButtonId 5306 #define pumpButtonId 5307 #define boostButtonId 5308 #define pressureButtonId 5309 #define mvicButtonId 5310 #define purgeButtonId 5311 #define egrButtonId 5312 #define fuelLabelId 5313 #define solLabelId 5314 #define faultsLabelId 5315 #define readFaultsButtonId 5316 #define eraseFaultsButtonId 5317 #define currentFaultsLabelId 5318 #define storedFaultsLabelId 5319 #define meaningLabelId 5320 #define descrLabelId 5321 #define testLastId 5321 /* * preferences */ #define prefsDialogId 3000 #define prefsTableId 3001 #define prefsScrollbarId 3002 #define okButtonId 3003 #define cancelButtonId 3004 #define speedTriggerId 3005 #define speedListId 3006 #define unitTriggerId 3007 #define unitListId 3008 #define defaultButtonId 3009 #define alarmsCheckId 3010 #define egtinputTriggerId 3011 #define egtinputListId 3012 #define autologCheckId 3013 // Added autlog function 5/04 #define clockTriggerId 3014 #define clockListId 3015 #define customSensorId 3020 /* 8 * 3 */ #define o2NonLinCheckId 3021 /* * alarms */ #define alarmsFormId 4000 #define sound0ButtonId 4001 #define sound1ButtonId 4002 #define sound2ButtonId 4003 #define sound3ButtonId 4004 #define sound4ButtonId 4005 #define soundGroupId 5 #define threshThumbBitmapId 4006 #define threshBackBitmapId 4007 #define threshSignButtonId 4012 #define threshFieldId 4013 #define threshSliderId 4014 #define alarmLabelId 4015 #define alarmTriggerId 4016 #define alarmListId 4017 #define triggerCheckId 4018 /* * System Configuration */ #define autoid 2600 #define systemFormId 2601 #define vehicleTriggerId 2602 #define vehicleListId 2603 #define baseTriggerId 2604 #define baseListId 2605 #define userPrelogId 2606 #define userPostlogId 2607 #define userLograteId 2608 #define userDisplayrateId 2609 #define systemMenuId 2610 #define smartscanCheckId 2611 /* * Sensor Setup */ #define sensorMenuId 2612 #define sensorFormId 2613 #define userPidId 2614 #define userTagId 2615 #define userUnitId 2616 #define userScaleId 2617 #define userOffsetId 2618 #define userGRScaleId 2619 #define userGROffsetId 2620 #define userColorId 2621 #define audibleCheckId 2623 #define visualCheckId 2624 #define autoCheckId 2625 #define sensorTagId 2626 #define fuelCutCheckId 2627 /* * Custom Sensor */ #define customMenuId 2627 #define customFormId 2628 #define faultStringsId 8000
/*************************************************************************** * Copyright 2016 by Davide Bettio <davide@uninstall.it> * * * * 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 . * ***************************************************************************/ #include "utils.h" #include <unistd.h> #include <fcntl.h> #include <sys/mman.h> #include <sys/stat.h> #include <sys/types.h> #include <string.h> int string_ends_with(const char *string, const char *end) { int stringlen = strlen(string); int endlen = strlen(end); if (stringlen < endlen) { return 0; } return !strcmp(string + (stringlen - endlen), end); } void *map_file(const char *name, int flags, int *fileFD, unsigned int *fileSize) { int fd = open(name, flags); if (fileFD) { *fileFD = fd; } if (fd < 0) { return NULL; } struct stat fileStats; fstat(fd, &fileStats); if (fileSize) { *fileSize = fileStats.st_size; } return mmap(NULL, fileStats.st_size, PROT_READ, MAP_PRIVATE, fd, 0); } const char *file_name(const char *path) { const char *found_sep = strrchr(path, '/'); if (found_sep) { return found_sep + 1; } else { return path; } }
/* Copyright (C) 1993 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 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. */ #include <machine/reg.h> int rloc[] = { R0, R1, R2, R3, R4, R5, R6, R7, R8, R9, R10, R11, R12, R13, FP, SP, PS, PC };
/* ************************************************************************* ArmageTron -- Just another Tron Lightcycle Game in 3D. Copyright (C) 2000 Manuel Moos (manuel@moosnet.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 ArmageTron_SENSOR_H #define ArmageTron_SENSOR_H #include "eGameObject.h" #include "eTess2.h" //#include "eGrid.h" // exception that is thrown when the sensor hit something class eSensorFinished{}; // sensor sent out to detect near eWalls class eSensor: public eStackGameObject{ public: REAL hit; // where is the eWall? tCHECKED_PTR_CONST(eHalfEdge) ehit; // the eWall we sense int lr; // and direction it goes to (left/right) eCoord before_hit; // a point shortly before that eWall eSensor(eGameObject *o,const eCoord &start,const eCoord &d); virtual void PassEdge(const eWall *w,REAL time,REAL,int =1); // virtual void PassEdge(eEdge *e,REAL time,REAL a,int recursion=1); void detect(REAL range); void SetCurrentFace(eFace *f) { currentFace = f ; } inline eSensor & SetInverseSpeed( REAL inverseSpeed ); //!< Sets the inverse speed of the sensor inline REAL GetInverseSpeed( void ) const; //!< Gets the inverse speed of the sensor inline eSensor const & GetInverseSpeed( REAL & inverseSpeed ) const; //!< Gets the inverse speed of the sensor protected: tCHECKED_PTR(eGameObject) owned; private: REAL inverseSpeed_; //! the inverse speed of the sensor; walls far away will be checked for opacity a bit in the future if this is set. }; // ******************************************************************************* // * // * GetInverseSpeed // * // ******************************************************************************* //! //! @return the inverse speed of the sensor //! // ******************************************************************************* REAL eSensor::GetInverseSpeed( void ) const { return this->inverseSpeed_; } // ******************************************************************************* // * // * GetInverseSpeed // * // ******************************************************************************* //! //! @param inverseSpeed the inverse speed of the sensor to fill //! @return A reference to this to allow chaining //! // ******************************************************************************* eSensor const & eSensor::GetInverseSpeed( REAL & inverseSpeed ) const { inverseSpeed = this->inverseSpeed_; return *this; } // ******************************************************************************* // * // * SetInverseSpeed // * // ******************************************************************************* //! //! @param inverseSpeed the inverse speed of the sensor to set //! @return A reference to this to allow chaining //! // ******************************************************************************* eSensor & eSensor::SetInverseSpeed( REAL inverseSpeed ) { this->inverseSpeed_ = inverseSpeed; return *this; } #endif
/* Copyright (c) 2008-2014 Red Hat, Inc. <http://www.redhat.com> This file is part of GlusterFS. This file is licensed to you under your choice of the GNU Lesser General Public License, version 3 or any later version (LGPLv3 or later), or the GNU General Public License, version 2 (GPLv2), in all cases as published by the Free Software Foundation. */ #include "dht-common.h" #include "logging.h" #include "xlator.h" #include <inttypes.h> #include <stdarg.h> #include <stddef.h> #include <setjmp.h> #include <cmocka_pbc.h> #include <cmocka.h> /* * Helper functions */ static xlator_t * helper_xlator_init(uint32_t num_types) { xlator_t *xl; int i, ret; REQUIRE(num_types > 0); xl = test_calloc(1, sizeof(xlator_t)); assert_non_null(xl); xl->mem_acct->num_types = num_types; xl->mem_acct = test_calloc (sizeof(struct mem_acct) + sizeof(struct mem_acct_rec) + num_types); assert_non_null(xl->mem_acct); xl->ctx = test_calloc(1, sizeof(glusterfs_ctx_t)); assert_non_null(xl->ctx); for (i = 0; i < num_types; i++) { ret = LOCK_INIT(&(xl->mem_acct.rec[i].lock)); assert_false(ret); } ENSURE(num_types == xl->mem_acct.num_types); ENSURE(NULL != xl); return xl; } static int helper_xlator_destroy(xlator_t *xl) { int i, ret; for (i = 0; i < xl->mem_acct.num_types; i++) { ret = LOCK_DESTROY(&(xl->mem_acct.rec[i].lock)); assert_int_equal(ret, 0); } free(xl->mem_acct.rec); free(xl->ctx); free(xl); return 0; } /* * Unit tests */ static void test_dht_layout_new(void **state) { xlator_t *xl; dht_layout_t *layout; dht_conf_t *conf; int cnt; expect_assert_failure(dht_layout_new(NULL, 0)); expect_assert_failure(dht_layout_new((xlator_t *)0x12345, -1)); xl = helper_xlator_init(10); // xl->private is NULL assert_null(xl->private); cnt = 100; layout = dht_layout_new(xl, cnt); assert_non_null(layout); assert_int_equal(layout->type, DHT_HASH_TYPE_DM); assert_int_equal(layout->cnt, cnt); assert_int_equal(layout->ref, 1); assert_int_equal(layout->gen, 0); assert_int_equal(layout->spread_cnt, 0); free(layout); // xl->private is not NULL cnt = 110; conf = (dht_conf_t *)test_calloc(1, sizeof(dht_conf_t)); assert_non_null(conf); conf->dir_spread_cnt = 12345; conf->gen = -123; xl->private = conf; layout = dht_layout_new(xl, cnt); assert_non_null(layout); assert_int_equal(layout->type, DHT_HASH_TYPE_DM); assert_int_equal(layout->cnt, cnt); assert_int_equal(layout->ref, 1); assert_int_equal(layout->gen, conf->gen); assert_int_equal(layout->spread_cnt, conf->dir_spread_cnt); free(layout); free(conf); helper_xlator_destroy(xl); } int main(void) { const struct CMUnitTest xlator_dht_layout_tests[] = { unit_test(test_dht_layout_new), }; return cmocka_run_group_tests(xlator_dht_layout_tests, NULL, NULL); }
#ifndef MEDIUMMENU_H #define MEDIUMMENU_H #include "../ArcadeMenuScene.h" #include "../IArcadeMenuLevel.h" #include "../Grid.h" #include "cocos2d.h" class MediumMenu : public cocos2d::Object, public ArcadeMenuLevel { public: MediumMenu(ArcadeMenu* arcade); static MediumMenu* create(ArcadeMenu*); virtual cocos2d::Node* getView(); virtual void touch(cocos2d::Point); virtual const char *getBackground(); void choiceLevel(cocos2d::Object*); bool complete(); private: //inicia nuevo escenario con el juego en el nivel indicado void playArcade(int lvl); cocos2d::MenuItemImage* createMenuItem(const char* normalimg, const char* selectedimg, int lvl, bool locked); cocos2d::Node* view; cocos2d::Sprite *background; Grid<cocos2d::Sprite*> _grid; cocos2d::Menu* menu; ArcadeMenu *_scene; }; #endif
/* * Callbacks for events triggered by gui.c. Located here in the interests of * cleanliness. * * Every funciton here should take a GuiInfo * as its data element, unless * otherwise specified. Even if the function does not use it currently, it * should be passed anyway, incase it is used in the future * * Copyright (c) 2000 Michael Pearson <alcaron@senet.com.au> * * This file is licensed under the GNU General Public License. See the file * "COPYING" for more details. */ void cb_exit_game(GtkWidget *widget, gpointer data); void cb_show_about_box(GtkWidget *widget, gpointer data); gint cb_sig_exit_game(GtkWidget *widget, GdkEvent *event, gpointer data); gint cb_keydown(GtkWidget *widget, GdkEventKey *event, gpointer data); gint cb_keyup(GtkWidget *widget, GdkEventKey *event, gpointer data); void cb_new_game(GtkWidget *widget, gpointer data); void cb_pause_game(GtkWidget *widget, gpointer data); void cb_end_game(GtkWidget *widget, gpointer data); void cb_kill_ball(GtkWidget *widget, gpointer data); void cb_scores(GtkWidget *widget, gpointer data); void cb_preferences(GtkWidget *widget, gpointer data); void cb_help(GtkWidget *widget, gpointer data); gboolean cb_main_focus_change(GtkWidget *widget, GdkEvent *event, gpointer data); gboolean cb_canvas_button_press(GtkWidget *widget, GdkEventButton *event, gpointer data); gboolean cb_grab_focus(GtkWidget *widget, GdkEvent *event, gpointer data); gboolean cb_ungrab_focus(GtkWidget *widget, GdkEvent *event, gpointer data); gboolean cb_hide_pointer(GtkWidget *widget, GdkEvent *event, gpointer data); gboolean cb_show_pointer(GtkWidget *widget, GdkEvent *event, gpointer data); gboolean cb_canvas_pointer(GtkWidget *widget, GdkEvent *event, gpointer data); gboolean cb_null(GtkWidget *widget, void **data);
#include "graphics\Singularity.Graphics.h" namespace Singularity { namespace Graphics { class VertexPositionNormalTexture { private: #pragma region Static Methods static VertexDeclaration* GetVertexDeclaration(); #pragma endregion public: #pragma region Static Variables static VertexDeclaration* Declaration; #pragma endregion #pragma region Variables Vector3 position; Vector3 normal; Vector2 texCoord; #pragma endregion #pragma region Constructors and Finalizers VertexPositionNormalTexture(); VertexPositionNormalTexture(float x, float y, float z, float nx, float ny, float nz, float u, float v); VertexPositionNormalTexture(Vector3 pos, Vector3 normal, Vector2 tex); #pragma endregion #pragma region Overriden Operator bool operator== (const VertexPositionNormalTexture &other) const; #pragma endregion }; } }
/* audio.[ch] * * part of the Systems Programming 2005 assignment * (c) Vrije Universiteit Amsterdam, BSD License applies * contact info : wdb -_at-_ few.vu.nl * */ /** open a WAV-file for reading * * this function checks whether the file pointed to by filename exists, * and if it is of the right type. Note that not all WAV filetypes are * supported. Only the simplest uncompressed PCM streams can be read. * * the function writes metadata about the opened file in the integers pointed * to by the parameters. * * @param filename a non-NULL pointer to a string denoting a local file * @param sample_rate the number of samples per second, e.g., 44kHz * @param sample_size the precision of the wave-approximations, e.g., 16bit * @param channels the number of channels. No THX or dobly, we only accept mono and stereo * * @return 0 on success, <0 on failure */ int aud_readinit (char *filename, int *sample_rate, int*sample_size, int* channels ); /** write an uncompressed PCM stream to the speaker * * this function opens the speaker device as a regular file. You can use the returned * file descriptor as if it was a normal file. * * @params sample_rate, sample_size, channels: see aud_readinit above * @return a new descriptor or <0 if an error occurred. NB: 0 itself is a valid descriptor number! */ int aud_writeinit (int sample_rate, int sample_size, int channels);
/* This research is supported by the European Union Seventh Framework Programme (FP7/2007-2013), project ASPIRE (Advanced Software Protection: Integration, Research, and Exploitation), under grant agreement no. 609734; on-line at https://aspire-fp7.eu/. */ /* The development of portions of the code contained in this file was sponsored by Samsung Electronics UK. */ #ifndef DIABLOFLOWGRAPH_DESCRIPTION_TYPEDEFS #define DIABLOFLOWGRAPH_DESCRIPTION_TYPEDEFS typedef struct _t_architecture_description t_architecture_description; typedef enum { CONTEXT_SENSITIVE, CONTEXT_INSENSITIVE, TRIVIAL } t_analysis_complexity; #endif #ifndef DIABLOFLOWGRAPH_DESCRIPTION_DEFINES #define DIABLOFLOWGRAPH_DESCRIPTION_DEFINES #define TotalRegs(x) ((x)->num_int_regs + (x)->num_float_regs + (x)->num_predicate_regs + (x)->num_branch_regs + (x)->num_special_regs) #endif #include <diabloflowgraph.h> #ifdef DIABLOFLOWGRAPH_TYPES /* Description Types {{{ */ #ifndef DIABLOFLOWGRAPH_DESCRIPTION_TYPES #define DIABLOFLOWGRAPH_DESCRIPTION_TYPES /*! A description of the architecture */ struct _t_architecture_description { /* Describe the architectures general characteristics */ t_uint32 minimal_encoded_instruction_size; t_uint32 maximum_encoded_instruction_size; t_uint32 encoded_instruction_mod_size; /* Normal this is equal to minimal */ t_uint32 bundle_size; t_uint32 template_size; t_uint32 decoded_instruction_size; t_address_type address_size; t_uint32 num_int_regs; t_uint32 num_float_regs; t_uint32 num_predicate_regs; t_uint32 num_branch_regs; t_uint32 num_special_regs; t_regset all_registers; t_regset int_registers; t_regset flt_registers; t_regset cond_registers; t_regset callee_saved; t_regset callee_may_use; t_regset callee_may_change; t_regset callee_may_return; t_regset always_live; t_regset registers_prop_over_hell; t_regset const_registers; t_regset dead_over_call; /* Registers that must not be propagated over call, swi and return edges */ t_regset link_register; t_regset argument_regs; t_regset return_regs; t_regset dyncall_may_use; /* registers whose original value may be used by PLT calls */ t_reg program_counter; /* set to REG_NONE if there is no visible program counter */ char **register_names; /* Section callbacks */ void (*DisassembleSec) (t_section *); void (*AssembleSec) (t_section *); void (*Flowgraph) (t_object *); void (*Deflowgraph) (t_object *); void (*MakeAddressProducers) (t_cfg *); /* Instruction callbacks */ void (*InsCleanup) (t_ins *); void (*InsMakeDirectBranch) (t_ins *); void (*InsDupDynamic) (t_ins *, t_ins *); t_bool (*InsHasSideEffect) (t_ins *); t_bool (*InsIsLoad) (t_ins * ins); t_bool (*InsIsStore) (t_ins * ins); t_bool (*InsIsProcedureCall) (t_ins *); t_bool (*InsIsIndirectCall) (t_ins *); t_bool (*InsIsConditional) (t_ins *); t_bool (*InsIsUnconditionalJump) (t_ins *); t_bool (*InsIsControlflow) (t_ins *); t_bool (*InsIsSystem) (t_ins *); t_tristate (*InsIsSyscallExit) (t_ins *); void (*InsPrint) (t_ins *, t_string); void (*InsMakeNoop) (t_ins *); t_bool (*InsCmp) (t_ins *, t_ins *); t_bool (*InstructionUnconditionalizer) (t_ins *); t_bool (*InstructionParseFromStringAndInsertAt) (t_string, t_bbl *, t_ins *, t_bool); /* Bbl callbacks */ t_ins *(*BblAddJumpInstruction) (t_bbl *); /* Fun callbacks */ t_bool (*FunIsGlobal) (t_function *); char **unbehaved_funs; void (*computeLiveRegsBeforeSwi) (t_regset *, t_ins *); t_bool (*IsCopy) (t_ins *, t_reg *, t_reg *); t_address (*Modus) (t_address x, t_reloc * rel); }; #endif /* }}} */ #endif /* vim: set shiftwidth=2 expandtab cinoptions=p5,t0,(0, foldmethod=marker tw=80 cindent: */
/* pdfaction.h Copyright 2009 Taco Hoekwater <taco@luatex.org> This file is part of LuaTeX. LuaTeX 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. LuaTeX 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 General Public License along with LuaTeX; if not, see <http://www.gnu.org/licenses/>. */ /* $Id: pdfaction.h 3891 2010-09-14 23:02:24Z hhenkel $ */ #ifndef PDFACTION_H # define PDFACTION_H /* pdf action spec */ # define pdf_action_size 4 typedef enum { pdf_action_page = 0, pdf_action_goto, pdf_action_thread, pdf_action_user } pdf_action_type; typedef enum { pdf_window_notset, pdf_window_new, pdf_window_nonew, } pdf_window_type; # define pdf_action_type(a) type((a) + 1) /* enum pdf_action_type */ # define pdf_action_named_id(a) subtype((a) + 1) /* boolean */ # define pdf_action_id(a) vlink((a) + 1) /* number or toks */ # define pdf_action_file(a) vinfo((a) + 2) /* toks */ # define pdf_action_new_window(a) vlink((a) + 2) /* enum pdf_window_type */ # define pdf_action_tokens(a) vinfo((a) + 3) /* toks */ # define pdf_action_refcount(a) vlink((a) + 3) /* number */ /* increase count of references to this action. this is used to speed up copy_node() */ # define add_action_ref(a) pdf_action_refcount((a))++ /* decrease count of references to this action; free it if there is no reference to this action*/ # define delete_action_ref(a) { \ if (pdf_action_refcount(a) == null) { \ delete_action_node(a); \ } else { \ pdf_action_refcount(a)--; \ } \ } # define set_pdf_action_type(A,B) pdf_action_type(A)=B # define set_pdf_action_tokens(A,B) pdf_action_tokens(A)=B # define set_pdf_action_file(A,B) pdf_action_file(A)=B # define set_pdf_action_id(A,B) pdf_action_id(A)=B # define set_pdf_action_named_id(A,B) pdf_action_named_id(A)=B # define set_pdf_action_new_window(A,B) pdf_action_new_window(A)=B extern halfword scan_action(PDF pdf); extern void write_action(PDF pdf, halfword p); extern void delete_action_node(halfword a); #endif
#ifndef UNFO_LOG_H #define UNFO_LOG_H #include <stdarg.h> #include "unfo_log_codes.h" #include "unfo_types.h" void unfo_log_create(UNFO_Log *log, UNFO_Object **args); void unfo_log_create_u(UNFO_Object *log, UNFO_Object **args); void unfo_log_destroy(UNFO_Log *log); void unfo_log_destroy_u(UNFO_Object *log); UNFO_LogEntry *unfo_log_entry_create(); void unfo_log_entry_destroy(); char* unfo_log_entry_str(UNFO_LogEntry *log_entry); void unfo_log_error(UNFO_Log *log, int code, int n, ...); void unfo_log_error_x(UNFO_Log *log, int code, int n, ...); void unfo_log_warning(UNFO_Log *log, int code, int n, ...); void unfo_log_warning_x(UNFO_Log *log, int code, int n, ...); void unfo_log_print(UNFO_Log *log); extern const char * UNFO_LogCodeFormat[]; extern UNFO_ObjectInfo UNFO_Log_ObjInfo; #endif
/* FCE Ultra - NES/Famicom Emulator * * Copyright notice for this file: * Copyright (C) 2001 Aaron Oneal * Copyright (C) 2002 Xodnizel * * 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 */ //#define PUBLIC_RELEASE // uncomment this when making a public release, but comment back before committing #ifndef __FCEU_VERSION #define __FCEU_VERSION //todo - everyone will want to support this eventually, i suppose #ifdef _MSC_VER #include "svnrev.h" #else #ifdef SVN_REV #define SVN_REV_STR SVN_REV #else #define SVN_REV_STR "" #endif #endif #define FCEU_NAME "FCEUX" #define FCEU_FEATURE_STRING "" #ifdef _DEBUG #define FCEU_SUBVERSION_STRING " debug" #elif defined(PUBLIC_RELEASE) #define FCEU_SUBVERSION_STRING "" #else #define FCEU_SUBVERSION_STRING "-interim svn" SVN_REV_STR #endif #if defined(_MSC_VER) #define FCEU_COMPILER "" #define FCEU_COMPILER_DETAIL " msvc " _Py_STRINGIZE(_MSC_VER) #define _Py_STRINGIZE(X) _Py_STRINGIZE1((X)) #define _Py_STRINGIZE1(X) _Py_STRINGIZE2 ## X #define _Py_STRINGIZE2(X) #X //re: http://72.14.203.104/search?q=cache:HG-okth5NGkJ:mail.python.org/pipermail/python-checkins/2002-November/030704.html+_msc_ver+compiler+version+string&hl=en&gl=us&ct=clnk&cd=5 #else // TODO: make for others compilers #define FCEU_COMPILER "" #define FCEU_COMPILER_DETAIL "" #endif #define FCEU_VERSION_NUMERIC 22000 #define FCEU_VERSION_STRING "2.2.1" FCEU_SUBVERSION_STRING FCEU_FEATURE_STRING FCEU_COMPILER #define FCEU_NAME_AND_VERSION FCEU_NAME " " FCEU_VERSION_STRING #endif
/* * Copyright (C) 2012-2013 RCP100 Team (rcpteam@yahoo.com) * * This file is part of RCP100 project * * 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. */ #include "ospf.h" OspfLsa *queue = NULL; #if 0 static void print_queue(void) { printf("****\n"); OspfLsa *lsa = queue; while (lsa != NULL) { printf("%u/%d.%d.%d.%d, cost %u\n", lsa->header.type, RCP_PRINT_IP(ntohl(lsa->header.link_state_id)), lsa->h.cost); lsa = lsa->h.util_next; } printf("****\n"); } #endif // insert lsa in the queue void lsapq_push(OspfLsa *lsa) { ASSERT(lsa); //printf("Djikstra algo: push %u/%d.%d.%d.%d at cost %u\n", // lsa->header.type, RCP_PRINT_IP(ntohl(lsa->header.link_state_id)), lsa->h.cost); // if the lsa is already in the queue, don't add it OspfLsa *ptr = queue; while (ptr) { if (ptr == lsa) return; ptr = ptr->h.util_next; } // inserting on top lsa->h.util_next = queue; queue = lsa; } // get the smallest element OspfLsa *lsapq_get(void) { //print_queue(); //printf("Djikstra algo: pop\n"); // empty head if (queue == NULL) return NULL; // one element if (queue->h.util_next == NULL) { // return head OspfLsa *tmp = queue; queue = NULL; return tmp; } OspfLsa *ptr = queue; OspfLsa *parent = NULL; OspfLsa *sptr = queue; OspfLsa *sparent = NULL; while (ptr != NULL) { if (ptr->h.cost < sptr->h.cost) { sptr = ptr; sparent = parent; } parent = ptr; ptr = ptr->h.util_next; } if (sparent == NULL) { // return head OspfLsa *tmp = queue; queue = queue->h.util_next; return tmp; } OspfLsa *tmp = sptr; sparent->h.util_next = tmp->h.util_next; return tmp; }
/* * * kernel/cpt/cpt_obj.c * * Copyright (C) 2000-2005 SWsoft * All rights reserved. * * Licensing governed by "linux/COPYING.SWsoft" file. * */ #include <linux/version.h> #include <linux/module.h> #include <linux/init.h> #include <linux/kernel.h> #include <linux/sched.h> #include <linux/slab.h> #include <linux/file.h> #include <linux/mm.h> #include <linux/errno.h> #include "cpt_obj.h" #include "cpt_context.h" cpt_object_t *alloc_cpt_object(int gfp, struct cpt_context *ctx) { cpt_object_t *obj; obj = kmalloc(sizeof(cpt_object_t), gfp); if (obj) { INIT_LIST_HEAD(&obj->o_list); INIT_LIST_HEAD(&obj->o_hash); INIT_LIST_HEAD(&obj->o_alist); obj->o_count = 1; obj->o_pos = CPT_NULL; obj->o_lock = 0; obj->o_parent = NULL; obj->o_index = CPT_NOINDEX; obj->o_obj = NULL; obj->o_image = NULL; ctx->objcount++; } return obj; } void free_cpt_object(cpt_object_t *obj, cpt_context_t *ctx) { list_del(&obj->o_alist); kfree(obj); ctx->objcount--; } void intern_cpt_object(enum _cpt_object_type type, cpt_object_t *obj, cpt_context_t *ctx) { list_add_tail(&obj->o_list, &ctx->object_array[type]); } void insert_cpt_object(enum _cpt_object_type type, cpt_object_t *obj, cpt_object_t *head, cpt_context_t *ctx) { list_add(&obj->o_list, &head->o_list); } cpt_object_t * __cpt_object_add(enum _cpt_object_type type, void *p, unsigned gfp_mask, cpt_context_t *ctx) { cpt_object_t *obj; obj = lookup_cpt_object(type, p, ctx); if (obj) { obj->o_count++; return obj; } if ((obj = alloc_cpt_object(gfp_mask, ctx)) != NULL) { if (p) cpt_obj_setobj(obj, p, ctx); intern_cpt_object(type, obj, ctx); return obj; } return NULL; } cpt_object_t * cpt_object_add(enum _cpt_object_type type, void *p, cpt_context_t *ctx) { return __cpt_object_add(type, p, GFP_KERNEL, ctx); } cpt_object_t * cpt_object_get(enum _cpt_object_type type, void *p, cpt_context_t *ctx) { cpt_object_t *obj; obj = lookup_cpt_object(type, p, ctx); if (obj) obj->o_count++; return obj; } int cpt_object_init(cpt_context_t *ctx) { int i; for (i=0; i<CPT_OBJ_MAX; i++) { INIT_LIST_HEAD(&ctx->object_array[i]); } return 0; } int cpt_object_destroy(cpt_context_t *ctx) { int i; for (i=0; i<CPT_OBJ_MAX; i++) { while (!list_empty(&ctx->object_array[i])) { struct list_head *head = ctx->object_array[i].next; cpt_object_t *obj = list_entry(head, cpt_object_t, o_list); list_del(head); if (obj->o_image) kfree(obj->o_image); free_cpt_object(obj, ctx); } } if (ctx->objcount != 0) eprintk_ctx("BUG: ctx->objcount=%d\n", ctx->objcount); return 0; } cpt_object_t *lookup_cpt_object(enum _cpt_object_type type, void *p, struct cpt_context *ctx) { cpt_object_t *obj; for_each_object(obj, type) { if (obj->o_obj == p) return obj; } return NULL; } cpt_object_t *lookup_cpt_obj_bypos(enum _cpt_object_type type, loff_t pos, struct cpt_context *ctx) { cpt_object_t *obj; for_each_object(obj, type) { if (obj->o_pos == pos) return obj; } return NULL; } cpt_object_t *lookup_cpt_obj_byindex(enum _cpt_object_type type, __u32 index, struct cpt_context *ctx) { cpt_object_t *obj; for_each_object(obj, type) { if (obj->o_index == index) return obj; } return NULL; }
/* * Copyright 2007-2009 Analog Devices Inc. * Philippe Gerum <rpm@xenomai.org> * * Licensed under the GPL-2 or later. */ #include <linux/init.h> #include <linux/kernel.h> #include <linux/sched.h> #include <linux/delay.h> #include <asm/smp.h> #include <asm/dma.h> #include <asm/time.h> static DEFINE_SPINLOCK(boot_lock); /* * platform_init_cpus() - Tell the world about how many cores we * have. This is called while setting up the architecture support * (setup_arch()), so don't be too demanding here with respect to * available kernel services. */ void __init platform_init_cpus(void) { struct cpumask mask; cpumask_set_cpu(0, &mask); /* CoreA */ cpumask_set_cpu(1, &mask); /* CoreB */ init_cpu_possible(&mask); } void __init platform_prepare_cpus(unsigned int max_cpus) { struct cpumask mask; bfin_relocate_coreb_l1_mem(); /* Both cores ought to be present on a bf561! */ cpumask_set_cpu(0, &mask); /* CoreA */ cpumask_set_cpu(1, &mask); /* CoreB */ init_cpu_present(&mask); } int __init setup_profiling_timer(unsigned int multiplier) /* not supported */ { return -EINVAL; } void __cpuinit platform_secondary_init(unsigned int cpu) { /* Clone setup for peripheral interrupt sources from CoreA. */ bfin_write_SICB_IMASK0(bfin_read_SIC_IMASK0()); bfin_write_SICB_IMASK1(bfin_read_SIC_IMASK1()); SSYNC(); /* Clone setup for IARs from CoreA. */ bfin_write_SICB_IAR0(bfin_read_SIC_IAR0()); bfin_write_SICB_IAR1(bfin_read_SIC_IAR1()); bfin_write_SICB_IAR2(bfin_read_SIC_IAR2()); bfin_write_SICB_IAR3(bfin_read_SIC_IAR3()); bfin_write_SICB_IAR4(bfin_read_SIC_IAR4()); bfin_write_SICB_IAR5(bfin_read_SIC_IAR5()); bfin_write_SICB_IAR6(bfin_read_SIC_IAR6()); bfin_write_SICB_IAR7(bfin_read_SIC_IAR7()); bfin_write_SICB_IWR0(IWR_DISABLE_ALL); bfin_write_SICB_IWR1(IWR_DISABLE_ALL); SSYNC(); /* We are done with local CPU inits, unblock the boot CPU. */ set_cpu_online(cpu, true); spin_lock(&boot_lock); spin_unlock(&boot_lock); } int __cpuinit platform_boot_secondary(unsigned int cpu, struct task_struct *idle) { unsigned long timeout; printk(KERN_INFO "Booting Core B.\n"); spin_lock(&boot_lock); if ((bfin_read_SYSCR() & COREB_SRAM_INIT) == 0) { /* CoreB already running, sending ipi to wakeup it */ platform_send_ipi_cpu(cpu, IRQ_SUPPLE_0); } else { /* Kick CoreB, which should start execution from CORE_SRAM_BASE. */ bfin_write_SYSCR(bfin_read_SYSCR() & ~COREB_SRAM_INIT); SSYNC(); } timeout = jiffies + 1 * HZ; while (time_before(jiffies, timeout)) { if (cpu_online(cpu)) break; udelay(100); barrier(); } if (cpu_online(cpu)) { /* release the lock and let coreb run */ spin_unlock(&boot_lock); return 0; } else panic("CPU%u: processor failed to boot\n", cpu); } static const char supple0[] = "IRQ_SUPPLE_0"; static const char supple1[] = "IRQ_SUPPLE_1"; void __init platform_request_ipi(int irq, void *handler) { int ret; const char *name = (irq == IRQ_SUPPLE_0) ? supple0 : supple1; ret = request_irq(irq, handler, IRQF_DISABLED | IRQF_PERCPU, name, handler); if (ret) panic("Cannot request %s for IPI service", name); } void platform_send_ipi(cpumask_t callmap, int irq) { unsigned int cpu; int offset = (irq == IRQ_SUPPLE_0) ? 6 : 8; for_each_cpu_mask(cpu, callmap) { BUG_ON(cpu >= 2); SSYNC(); bfin_write_SICB_SYSCR(bfin_read_SICB_SYSCR() | (1 << (offset + cpu))); SSYNC(); } } void platform_send_ipi_cpu(unsigned int cpu, int irq) { int offset = (irq == IRQ_SUPPLE_0) ? 6 : 8; BUG_ON(cpu >= 2); SSYNC(); bfin_write_SICB_SYSCR(bfin_read_SICB_SYSCR() | (1 << (offset + cpu))); SSYNC(); } void platform_clear_ipi(unsigned int cpu, int irq) { int offset = (irq == IRQ_SUPPLE_0) ? 10 : 12; BUG_ON(cpu >= 2); SSYNC(); bfin_write_SICB_SYSCR(bfin_read_SICB_SYSCR() | (1 << (offset + cpu))); SSYNC(); } /* * Setup core B's local core timer. * In SMP, core timer is used for clock event device. */ void __cpuinit bfin_local_timer_setup(void) { #if defined(CONFIG_TICKSOURCE_CORETMR) struct irq_data *data = irq_get_irq_data(IRQ_CORETMR); struct irq_chip *chip = irq_data_get_irq_chip(data); bfin_coretmr_init(); bfin_coretmr_clockevent_init(); chip->irq_unmask(data); #else /* Power down the core timer, just to play safe. */ bfin_write_TCNTL(0); #endif }
/********************************************\ * * Sire - Molecular Simulation Framework * * Copyright (C) 2007 Christopher Woods * * 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 * * For full details of the license please see the COPYING file * that should have come with this distribution. * * You can contact the authors via the developer's mailing list * at http://siremol.org * \*********************************************/ #ifndef SIREID_NAME_H #define SIREID_NAME_H #include <QHash> #include <QString> #include "SireStream/shareddatastream.h" SIRE_BEGIN_HEADER namespace SireID { class Name; } QDataStream& operator<<(QDataStream&, const SireID::Name&); QDataStream& operator>>(QDataStream&, SireID::Name&); namespace SireID { enum CaseSensitivity{ CaseInsensitive = 0, CaseSensitive = 1 }; /** This is the base class of all Name ID objects. A Name is used to provide an object with a human-readable name that can be used to identify the object, e.g. identifying atoms by their name within a residue, or identifying forcefields by their name. A name does not have to uniquely identify an object, though it helps, as generally only the first object with a specified name is returned if there are in fact multiple objects with the same name. @author Christopher Woods */ class SIREID_EXPORT Name { friend QDataStream& ::operator<<(QDataStream&, const Name&); friend QDataStream& ::operator>>(QDataStream&, Name&); public: ~Name(); operator QString() const; bool isNull() const; bool isEmpty() const; uint hash() const; const QString& value() const; bool isCaseSensitive() const; protected: explicit Name(const QString &name = QString::null, CaseSensitivity = CaseSensitive); Name(const Name &other); Name& operator=(const Name &other); bool operator==(const Name &other) const; bool operator!=(const Name &other) const; /** The actual name */ QString _name; /** Should this name be case sensitive or not? */ bool case_sensitive; }; /** Return a hash of this Name */ inline uint qHash(const Name &name) { return name.hash(); } } SIRE_END_HEADER SIRE_EXPOSE_CLASS( SireID::Name ) #endif
#include <stdio.h> #include <string.h> #include "htmlfunc.h" //Ö»Ìæ»»µ¥ÒýºÅºÍ'\\'£¬¿Û³ýĩβµÄ°ë¸öºº×Ö¡£·±Ìå×Ö±àÂëÖÐÓöµ½µÄ'\\'²»Ìæ»» //×Ö·û´®ÖеÄ><Ö®ÀàÌØÊâ×Ö·û¿ÉÒÔÓɽű¾×Ô¼ºÀ´´¦Àí£¬²»ÔÚ·þÎñÆ÷¶Ë´¦Àí // //Èç¹ûÊǰë¸öºº×Ö¼ÓÉÏ', ²»ÖªµÀÊÇʲôЧ¹û¡£Èç¹ûÓÐÎÊÌâÔÙ¸Ä°É char * scriptstr(const unsigned char *s) { static char buf[1024]; int i = 0, db = 0; for (; *s && i < 1017; s++) { if (db == 1) { db = 0; if (*s < 32) buf[i - 1] = 32; buf[i] = *s; i++; continue; } if (*s == '\'') { strcpy(buf + i, "\\\'"); i += 2; } else if (*s == '/') { // Bug of browsers: '</script>' strcpy(buf + i, "\\/"); i += 2; } else if (*s == '\\') { strcpy(buf + i, "\\\\"); i += 2; } else if (*s == '\r') { continue; } else if (*s == '\n') { strcpy(buf + i, "\\n"); i += 2; } else { if (*s >= 128) db = 1; buf[i] = *s; i++; } } if (db) buf[i - 1] = 0; buf[i] = 0; return buf; } char * void1(char *s0) { int i; int flag = 0; unsigned char *s = (unsigned char *) s0; for (i = 0; s[i]; i++) { if (flag == 0) { if (s[i] >= 128) flag = 1; continue; } flag = 0; if (s[i] < 32) s[i - 1] = 32; } if (flag) s[i - 1] = 0; //s[strlen(s) - 1] = 0; return s; } /* * "ºº×Ö.jpg" --> "%BA%BA%D7%D6.jpg" * RFC 1738 */ char * urlencode(char *str) { static char buf[256]; char *pstr = str, *pbuf = buf, c; while (*pstr && pbuf - buf < sizeof (buf) - 3) { c = *pstr; if (('a' <= c && c <= 'z') || ('A' <= c && c <= 'Z') || ('0' <= c && c <= '9') || c == '-' || c == '_' || c == '.' || c == '\r' || c == '\n') { *pbuf = c; pstr++; pbuf++; } else { snprintf(pbuf, 4, "%%%02X", c & 0xff); pstr++; pbuf += 3; } } *pbuf = '\0'; return buf; }
/* $Id$ OWFS -- One-Wire filesystem OWHTTPD -- One-Wire Web Server Written 2003 Paul H Alfille email: palfille@earthlink.net Released under the GPL See the header file: ow.h for full attribution 1wire/iButton system from Dallas Semiconductor */ /* ow_server talks to the server, sending and recieving messages */ /* this is an alternative to direct bus communication */ #include "ownetapi.h" #include "ow_server.h" OWNET_HANDLE OWNET_init(const char *owserver_tcp_address_and_port) { OWNET_HANDLE handle; struct connection_in *slot_found; static int deja_vue = 0; // poor mans lock for the Lib Setup and Lock Setup if (++deja_vue == 1) { /* Setup the multithreading synchronizing locks */ LockSetup(); } CONNIN_WLOCK; slot_found = NewIn(); // Could we create or reclaim a slot? if (slot_found == NULL) { handle = -ENOMEM; } else { if (owserver_tcp_address_and_port == NULL || owserver_tcp_address_and_port[0] == '\0') { slot_found->name = strdup("4304"); } else { slot_found->name = strdup(owserver_tcp_address_and_port); } slot_found->busmode = bus_server; if (Server_detect(slot_found) == 0) { slot_found->state = connection_active; handle = slot_found->index; } else { FreeIn(slot_found); handle = -EADDRNOTAVAIL; } } CONNIN_WUNLOCK; return handle; }
#ifndef _CRYPTO_INTERNAL_SKCIPHER_H #define _CRYPTO_INTERNAL_SKCIPHER_H #include <crypto/algapi.h> #include <crypto/skcipher.h> #include <linux/types.h> struct rtattr; struct crypto_skcipher_spawn { struct crypto_spawn base; }; extern const struct crypto_type crypto_givcipher_type; static inline void crypto_set_skcipher_spawn( struct crypto_skcipher_spawn *spawn, struct crypto_instance *inst) { crypto_set_spawn(&spawn->base, inst); } int crypto_grab_skcipher(struct crypto_skcipher_spawn *spawn, const char *name, u32 type, u32 mask); static inline void crypto_drop_skcipher(struct crypto_skcipher_spawn *spawn) { crypto_drop_spawn(&spawn->base); } static inline struct crypto_alg *crypto_skcipher_spawn_alg( struct crypto_skcipher_spawn *spawn) { return spawn->base.alg; } static inline struct crypto_ablkcipher *crypto_spawn_skcipher( struct crypto_skcipher_spawn *spawn) { return __crypto_ablkcipher_cast( crypto_spawn_tfm(&spawn->base, crypto_skcipher_type(0), crypto_skcipher_mask(0))); } int skcipher_null_givencrypt(struct skcipher_givcrypt_request *req); int skcipher_null_givdecrypt(struct skcipher_givcrypt_request *req); const char *crypto_default_geniv(const struct crypto_alg *alg); struct crypto_instance *skcipher_geniv_alloc(struct crypto_template *tmpl, struct rtattr **tb, u32 type, u32 mask); void skcipher_geniv_free(struct crypto_instance *inst); int skcipher_geniv_init(struct crypto_tfm *tfm); void skcipher_geniv_exit(struct crypto_tfm *tfm); static inline struct crypto_ablkcipher *skcipher_geniv_cipher( struct crypto_ablkcipher *geniv) { return crypto_ablkcipher_crt(geniv)->base; } static inline int skcipher_enqueue_givcrypt( struct crypto_queue *queue, struct skcipher_givcrypt_request *request) { return ablkcipher_enqueue_request(queue, &request->creq); } static inline struct skcipher_givcrypt_request *skcipher_dequeue_givcrypt( struct crypto_queue *queue) { return __crypto_dequeue_request( queue, offsetof(struct skcipher_givcrypt_request, creq.base)); } static inline void *skcipher_givcrypt_reqctx( struct skcipher_givcrypt_request *req) { return ablkcipher_request_ctx(&req->creq); } static inline void ablkcipher_request_complete(struct ablkcipher_request *req, int err) { req->base.complete(&req->base, err); } static inline void skcipher_givcrypt_complete( struct skcipher_givcrypt_request *req, int err) { ablkcipher_request_complete(&req->creq, err); } static inline u32 ablkcipher_request_flags(struct ablkcipher_request *req) { return req->base.flags; } #endif /* _CRYPTO_INTERNAL_SKCIPHER_H */
/* * In The Name Of God * ======================================== * [] File Name : qsort.h * * [] Creation Date : 09-02-2015 * * [] Last Modified : Mon 09 Feb 2015 08:16:34 PM IRST * * [] Created By : Parham Alvani (parham.alvani@gmail.com) * ======================================= */ #ifndef QSORT_H #define QSORT_H void qsort(void *base, size_t nmemb, size_t size, int (*compar)(const void *, const void *)); #endif
/* inputint.c: read integers from text files. These routines are only used for debugging and such, so perfect error checking isn't necessary. Public domain. */ #include "config.h" #include "lib.h" /* Read an integer from the file F, reading past the subsequent end of line. */ integer inputint (FILE *f) { char buffer[MAX_INT_LENGTH]; /* Long enough for anything reasonable. */ return fgets (buffer, sizeof (buffer), f) ? atoi (buffer) : 0; }
/****************************************************************************************/ /* */ /* This program is free software; you can redistribute it and/or modify it under the */ /* terms of the GNU General Public License as published by the Free Software */ /* Foundation; either version 2 of the License, or (at your option) any later version. */ /* */ /* This program is distributed in the hope that it will be useful, but WITHOUT ANY */ /* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A */ /* PARTICULAR PURPOSE. See the GNU General Public License for more details. */ /* */ /* You should have received a copy of the GNU General Public License along with this */ /* program; (See "COPYING"). If not, If not, see <http://www.gnu.org/licenses/>. */ /* */ /*--------------------------------------------------------------------------------------*/ /* */ /* Copyright Joerg Anders, TU Chemnitz, Fakultaet fuer Informatik, GERMANY */ /* ja@informatik.tu-chemnitz.de */ /* */ /* */ /****************************************************************************************/ #ifndef RESTMOVECOMMAND_H #define RESTMOVECOMMAND_H #include "config.h" #include "command.h" class NedChordOrRest; class NedRestMoveCommand : public NedCommand { public: NedRestMoveCommand(NedChordOrRest *rest, int from, int to); virtual void execute(bool adjust = false); virtual void unexecute(bool adjust = false); private: NedChordOrRest *m_rest; int m_from; int m_to; }; #endif /* RESTMOVECOMMAND_H */
/** * The Forgotten Server - a free and open-source MMORPG server emulator * Copyright (C) 2016 Mark Samman <mark.samman@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 FS_MONSTERS_H_776E8327BCE2450EB7C4A260785E6C0D #define FS_MONSTERS_H_776E8327BCE2450EB7C4A260785E6C0D #include "creature.h" const uint32_t MAX_LOOTCHANCE = 100000; const uint32_t MAX_STATICWALK = 100; struct LootBlock { uint16_t id; uint32_t countmax; uint32_t chance; //optional int32_t subType; int32_t actionId; std::string text; std::vector<LootBlock> childLoot; LootBlock() { id = 0; countmax = 0; chance = 0; subType = -1; actionId = -1; } }; struct summonBlock_t { std::string name; uint32_t chance; uint32_t speed; bool force = false; }; class BaseSpell; struct spellBlock_t { spellBlock_t() = default; ~spellBlock_t(); spellBlock_t(const spellBlock_t& other) = delete; spellBlock_t& operator=(const spellBlock_t& other) = delete; spellBlock_t(spellBlock_t&& other): spell(other.spell), chance(other.chance), speed(other.speed), range(other.range), minCombatValue(other.minCombatValue), maxCombatValue(other.maxCombatValue), combatSpell(other.combatSpell), isMelee(other.isMelee) { other.spell = nullptr; } BaseSpell* spell = nullptr; uint32_t chance = 100; uint32_t speed = 2000; uint32_t range = 0; int32_t minCombatValue = 0; int32_t maxCombatValue = 0; bool combatSpell = false; bool isMelee = false; }; struct voiceBlock_t { std::string text; bool yellText; }; class MonsterType { public: MonsterType(); ~MonsterType() = default; // non-copyable MonsterType(const MonsterType&) = delete; MonsterType& operator=(const MonsterType&) = delete; void reset(); std::map<CombatType_t, int32_t> elementMap; std::vector<voiceBlock_t> voiceVector; std::vector<LootBlock> lootItems; std::vector<std::string> scripts; std::vector<spellBlock_t> attackSpells; std::vector<spellBlock_t> defenseSpells; std::vector<summonBlock_t> summons; std::string name; std::string nameDescription; LuaScriptInterface* scriptInterface; uint64_t experience; Outfit_t outfit; uint32_t manaCost; uint32_t yellChance; uint32_t yellSpeedTicks; uint32_t staticAttackChance; uint32_t maxSummons; uint32_t changeTargetSpeed; uint32_t conditionImmunities; uint32_t damageImmunities; uint32_t baseSpeed; int32_t creatureAppearEvent; int32_t creatureDisappearEvent; int32_t creatureMoveEvent; int32_t creatureSayEvent; int32_t thinkEvent; int32_t targetDistance; int32_t runAwayHealth; int32_t health; int32_t healthMax; int32_t changeTargetChance; int32_t defense; int32_t armor; RaceType_t race; uint16_t lookcorpse; Skulls_t skull; uint8_t lightLevel; uint8_t lightColor; bool canPushItems; bool canPushCreatures; bool pushable; bool isSummonable; bool isIllusionable; bool isConvinceable; bool isAttackable; bool isHostile; bool hiddenHealth; }; class Monsters { public: Monsters(); ~Monsters() = default; // non-copyable Monsters(const Monsters&) = delete; Monsters& operator=(const Monsters&) = delete; bool loadFromXml(bool reloading = false); bool isLoaded() const { return loaded; } bool reload(); MonsterType* getMonsterType(const std::string& name); uint32_t getIdByName(const std::string& name); private: ConditionDamage* getDamageCondition(ConditionType_t conditionType, int32_t maxDamage, int32_t minDamage, int32_t startDamage, uint32_t tickInterval); bool deserializeSpell(const pugi::xml_node& node, spellBlock_t& sb, const std::string& description = ""); bool loadMonster(const std::string& file, const std::string& monsterName, std::list<std::pair<MonsterType*, std::string>>& monsterScriptList, bool reloading = false); void loadLootContainer(const pugi::xml_node& node, LootBlock&); bool loadLootItem(const pugi::xml_node& node, LootBlock&); std::map<std::string, MonsterType> monsters; std::unique_ptr<LuaScriptInterface> scriptInterface; bool loaded; }; #endif
/* * * BRIEF MODULE DESCRIPTION * PROM library initialisation code, supports YAMON and U-Boot. * * Copyright 2000-2001, 2006, 2008 MontaVista Software Inc. * Author: MontaVista Software, Inc. <source@mvista.com> * * This file was derived from Carsten Langgaard's * arch/mips/mips-boards/xx files. * * Carsten Langgaard, carstenl@mips.com * Copyright (C) 1999,2000 MIPS Technologies, Inc. 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 SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN * NO EVENT SHALL THE AUTHOR 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. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 675 Mass Ave, Cambridge, MA 02139, USA. */ #include <linux/module.h> #include <linux/init.h> #include <linux/string.h> #include <asm/bootinfo.h> int prom_argc; char **prom_argv; char **prom_envp; <<<<<<< HEAD void __init prom_init_cmdline(void) ======= void prom_init_cmdline(void) >>>>>>> 296c66da8a02d52243f45b80521febece5ed498a { int i; for (i = 1; i < prom_argc; i++) { strlcat(arcs_cmdline, prom_argv[i], COMMAND_LINE_SIZE); if (i < (prom_argc - 1)) strlcat(arcs_cmdline, " ", COMMAND_LINE_SIZE); } } char *prom_getenv(char *envname) { /* * Return a pointer to the given environment variable. * YAMON uses "name", "value" pairs, while U-Boot uses "name=value". */ char **env = prom_envp; int i = strlen(envname); int yamon = (*env && strchr(*env, '=') == NULL); while (*env) { if (yamon) { if (strcmp(envname, *env++) == 0) return *env; } else if (strncmp(envname, *env, i) == 0 && (*env)[i] == '=') return *env + i + 1; env++; } return NULL; } static inline unsigned char str2hexnum(unsigned char c) { if (c >= '0' && c <= '9') return c - '0'; if (c >= 'a' && c <= 'f') return c - 'a' + 10; if (c >= 'A' && c <= 'F') return c - 'A' + 10; return 0; /* foo */ } static inline void str2eaddr(unsigned char *ea, unsigned char *str) { int i; for (i = 0; i < 6; i++) { unsigned char num; if ((*str == '.') || (*str == ':')) str++; num = str2hexnum(*str++) << 4; num |= str2hexnum(*str++); ea[i] = num; } } <<<<<<< HEAD int __init prom_get_ethernet_addr(char *ethernet_addr) ======= int prom_get_ethernet_addr(char *ethernet_addr) >>>>>>> 296c66da8a02d52243f45b80521febece5ed498a { char *ethaddr_str; /* Check the environment variables first */ ethaddr_str = prom_getenv("ethaddr"); if (!ethaddr_str) { /* Check command line */ ethaddr_str = strstr(arcs_cmdline, "ethaddr="); if (!ethaddr_str) return -1; ethaddr_str += strlen("ethaddr="); } str2eaddr(ethernet_addr, ethaddr_str); return 0; } <<<<<<< HEAD ======= EXPORT_SYMBOL(prom_get_ethernet_addr); >>>>>>> 296c66da8a02d52243f45b80521febece5ed498a void __init prom_free_prom_memory(void) { }
#ifndef POTENTIAL_GRID_H #define POTENTIAL_GRID_H #include "node.h" #include "planner.h" #include "timemap_server/TimeLapseMap.h" #include "timemap_server/TimeLapseOccGrid.h" #include <ros/ros.h> #include <ros/console.h> #include <geometry_msgs/PoseStamped.h> #include <geometry_msgs/Point.h> #include <sensor_msgs/PointCloud2.h> #include <pcl/point_types.h> #include <pcl_ros/point_cloud.h> #include <nav_msgs/Path.h> #include <stdlib.h> #include <algorithm> #include <vector> #include <queue> #include <deque> class ComparePointsHeuristic { public: ComparePointsHeuristic(Point new_goal){goal = new_goal;} // Diagonal distance // inline int heuristic(const Point& cur){ // int dx = abs(cur.x - goal.x); // int dy = abs(cur.y - goal.y); // // Manhattan distance with the distance saved using diagonals subtracted off // return NORM_STEP * (dx + dy) + (DIAG_STEP - 2 * NORM_STEP) * std::min(dx, dy); // } // Manhattan distance inline int heuristic(const Point& cur){ int dx = abs(cur.x - goal.x); int dy = abs(cur.y - goal.y); return NORM_STEP * (dx + dy); } bool const operator()(const Point &lhs, const Point &rhs) { return (lhs.t + heuristic(lhs) > rhs.t + heuristic(rhs)); } private: Point goal; }; namespace timeglobal_planner { class PotentialGrid { public: //setup callbacks and params PotentialGrid(); //time_map callback... void timemap_callback(const timemap_server::TimeLapseMap &map); //goal callback... void goal_callback(const geometry_msgs::PoseStamped& goal); //path planning algorithm //returns false if path is trivial (start=end) or if no path is possible in the given time bool plan(const timemap_server::TimeLapseMap &map, nav_msgs::Path &path, Point start_pt, Point goal_pt); private: //gets the last time described by the current map set inline int get_endtime(const timemap_server::TimeLapseMap &map); //will update dists as neighbors are added. neighbors that are added will have prev set to cur //note: neighbors are in time levels below cur based on the values of their respective movement inline void add_neighbors(const timemap_server::TimeLapseMap &map, const std::vector< Layer > &finished, std::vector<Point> &pqueue, Point cur); //adds neighbors according to JPS algorithm inline void add_neighbor(const timemap_server::TimeLapseMap &map, const std::vector< Layer > &finished, std::vector<Point> &pqueue, Point cur, int dx, int dy, int dt, char dir); //adds point to neighbors. if already present, updates dist inline void add_point(std::vector<Point> &pqueue, Point point); //checks if occ value is acceptable inline bool valid(int val); //get the value for occupancy at a given location inline double get_occ(const timemap_server::TimeLapseMap &map, int x, int y, int t); //add the point to the list of finished points inline void add_finished(std::vector< Layer > &finished, Point cur); //if the point has been fully processed inline bool finished_point(const std::vector< Layer > &finished, Point point); //if it is the start point inline bool is_start(const Point point); //get the parent point inline Point get_prev(const std::vector< Layer > &finished, Point cur); //traces back the path and returns a ROS path bool get_path(nav_msgs::Path &path, Point goal, const std::vector< Layer > &finished); //smooths the path... void smooth_path(nav_msgs::Path &path); //fixes the header and publishes the path void publish_path(nav_msgs::Path &path); //Convert coordinates, taken with minor modifications from //the nav stack global planner void mapToWorld(int mx, int my, double& wx, double& wy); bool worldToMap(double wx, double wy, int& mx, int& my); void mapToWorld(int mx, int my, float& wx, float& wy); bool worldToMap(float wx, float wy, int& mx, int& my); bool initialized_; ros::Subscriber map_sub_; ros::Subscriber goal_sub_; ros::Publisher path_pub_; timemap_server::TimeLapseMap map_; Point start_; Point goal_; double resolution_; double origin_x_; double origin_y_; int size_x_; int size_y_; int end_time_; bool display_; //The stuff below is mostly for debugging... ros::Publisher all_points_pub_; ros::Publisher processed_points_pub_; ros::Publisher best_points_pub_; pcl::PointCloud<pcl::PointXYZ> all_points_; pcl::PointCloud<pcl::PointXYZ> processed_points_; pcl::PointCloud<pcl::PointXYZ> best_points_; double time_1, time_2, time_3, time_4, time_5, time_6, time_7; int iter_1, iter_2, iter_3, iter_4, iter_5, iter_6, iter_7; }; } #endif
/* * Author: Park Ju Hyung aka arter97 <qkrwngud825@gmail.com> * * Copyright 2015 Park Ju Hyung * * This software is licensed under the terms of the GNU General Public * License version 2, as published by the Free Software Foundation, and * may be copied, distributed, and modified under those terms. * * 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. * */ /* * Adreno idler - Idling algorithm, * an efficient workaround for msm-adreno-tz's overheads. * * Main goal is to lower the power consumptions while maintaining high-performance. * * Since msm-adreno-tz tends to *not* use the lowest frequency even on idle, * Adreno idler replaces msm-adreno-tz's algorithm when it comes to * calculating idle frequency(mostly by ondemand's method). * The higher frequencies are not touched with this algorithm, so high-demanding * games will (most likely) not suffer from worsened performance. */ #include <linux/module.h> #include <linux/devfreq.h> #include <linux/msm_adreno_devfreq.h> #include "adreno_idler.h" #define ADRENO_IDLER_MAJOR_VERSION 1 #define ADRENO_IDLER_MINOR_VERSION 1 /* stats.busy_time threshold for determining if the given workload is idle. Any workload higher than this will be treated as a non-idle workload. Adreno idler will more actively try to ramp down the frequency if this is set to a higher value. */ static unsigned long idleworkload = 5000; module_param_named(adreno_idler_idleworkload, idleworkload, ulong, 0664); /* Number of events to wait before ramping down the frequency. The idlewait'th events before current one must be all idle before Adreno idler ramps down the frequency. This implementation is to prevent micro-lags on scrolling or playing games. Adreno idler will more actively try to ramp down the frequency if this is set to a lower value. */ static unsigned int idlewait = 20; module_param_named(adreno_idler_idlewait, idlewait, uint, 0664); /* Taken from ondemand */ static unsigned int downdifferential = 20; module_param_named(adreno_idler_downdifferential, downdifferential, uint, 0664); /* Master switch to activate the whole routine */ bool adreno_idler_active; module_param_named(adreno_idler_active, adreno_idler_active, bool, 0664); static unsigned int idlecount = 0; int adreno_idler(struct devfreq_dev_status stats, struct devfreq *devfreq, unsigned long *freq) { if (!adreno_idler_active) return 0; if (stats.busy_time < idleworkload) { /* busy_time >= idleworkload should be considered as a non-idle workload. */ idlecount++; if (*freq == devfreq->profile->freq_table[devfreq->profile->max_state - 1]) { /* Frequency is already at its lowest. No need to calculate things, so bail out. */ return 1; } if (idlecount >= idlewait && stats.busy_time * 100 < stats.total_time * downdifferential) { /* We are idle for (idlewait + 1)'th time! Ramp down the frequency now. */ *freq = devfreq->profile->freq_table[devfreq->profile->max_state - 1]; idlecount--; return 1; } } else { idlecount = 0; /* Do not return 1 here and allow rest of the algorithm to figure out the appropriate frequency for current workload. It can even set it back to the lowest frequency. */ } return 0; } EXPORT_SYMBOL(adreno_idler); static int __init adreno_idler_init(void) { pr_info("adreno_idler: version %d.%d by arter97\n", ADRENO_IDLER_MAJOR_VERSION, ADRENO_IDLER_MINOR_VERSION); return 0; } subsys_initcall(adreno_idler_init); static void __exit adreno_idler_exit(void) { return; } module_exit(adreno_idler_exit); MODULE_AUTHOR("Park Ju Hyung <qkrwngud825@gmail.com>"); MODULE_DESCRIPTION("'adreno_idler - A powersaver for Adreno TZ" "Control idle algorithm for Adreno GPU series"); MODULE_LICENSE("GPL");
/* * Copyright (C) by Grant Foudree <grant907@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; 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. */ #ifndef USBOPS_H #define USBOPS_H #define _WIN32_WINNT 0x601 #include <windows.h> #include <winioctl.h> #include <stdio.h> #include <../USBNinjaDll/errorlog.h> class UsbOps { protected: HANDLE hVolume; DWORD dwRetBytes; bool dismountVolume(); bool preventRemovalOfVolume(); bool autoEjectVolume(); public: void lockUSB(char driveLtr); void unlockUSB(); void ejectUSB(); UsbOps(); ~UsbOps(); }; #endif // USBOPS_H
/*COPYRIGHT 1980, INFOCOM COMPUTERS AND COMMUNICATIONS, CAMBRIDGE MA. 02142*/ /* ALL RIGHTS RESERVED, COMMERCIAL USAGE STRICTLY PROHIBITED */ /* WRITTEN BY R. M. SUPNIK */ #include "funcs.h" #include "vars.h" /* GTTIME-- GET TOTAL TIME PLAYED */ void gttime_(integer *t) { integer h, m, s; itime_(&h, &m, &s); *t = h * 60 + m - (time_1.shour * 60 + time_1.smin); if (*t < 0) { *t += 1440; } *t += time_1.pltime; return; } /* gttime_ */ /* OPNCLS-- PROCESS OPEN/CLOSE FOR DOORS */ /* DECLARATIONS */ logical opncls_(integer obj, integer so, integer sc) { /* System generated locals */ integer i__1; logical ret_val; ret_val = TRUE_; /* !ASSUME WINS. */ if (prsvec_1.prsa == vindex_1.closew) { goto L100; } /* !CLOSE? */ if (prsvec_1.prsa == vindex_1.openw) { goto L50; } /* !OPEN? */ ret_val = FALSE_; /* !LOSE */ return ret_val; L50: if ((objcts_1.oflag2[obj - 1] & OPENBT) != 0) { goto L200; } /* !OPEN... IS IT? */ rspeak_(so); objcts_1.oflag2[obj - 1] |= OPENBT; return ret_val; L100: if (! ((objcts_1.oflag2[obj - 1] & OPENBT) != 0)) { goto L200; } /* !CLOSE... IS IT? */ rspeak_(sc); objcts_1.oflag2[obj - 1] &= ~ OPENBT; return ret_val; L200: i__1 = rnd_(3) + 125; rspeak_(i__1); /* !DUMMY. */ return ret_val; } /* opncls_ */ /* LIT-- IS ROOM LIT? */ /* DECLARATIONS */ logical lit_(integer rm) { /* System generated locals */ integer i__1, i__2; logical ret_val; /* Local variables */ integer i, j, oa; ret_val = TRUE_; /* !ASSUME WINS */ if ((rooms_1.rflag[rm - 1] & RLIGHT) != 0) { return ret_val; } i__1 = objcts_1.olnt; for (i = 1; i <= i__1; ++i) { /* !LOOK FOR LIT OBJ */ if (qhere_(i, rm)) { goto L100; } /* !IN ROOM? */ oa = objcts_1.oadv[i - 1]; /* !NO */ if (oa <= 0) { goto L1000; } /* !ON ADV? */ if (advs_1.aroom[oa - 1] != rm) { goto L1000; } /* !ADV IN ROOM? */ /* OBJ IN ROOM OR ON ADV IN ROOM */ L100: if ((objcts_1.oflag1[i - 1] & ONBT) != 0) { return ret_val; } if ((objcts_1.oflag1[i - 1] & VISIBT) == 0 || ((objcts_1.oflag1[i - 1] & TRANBT) == 0 && (objcts_1.oflag2[i - 1] & OPENBT) == 0)) { goto L1000; } /* OBJ IS VISIBLE AND OPEN OR TRANSPARENT */ i__2 = objcts_1.olnt; for (j = 1; j <= i__2; ++j) { if (objcts_1.ocan[j - 1] == i && (objcts_1.oflag1[j - 1] & ONBT) != 0) { return ret_val; } /* L500: */ } L1000: ; } ret_val = FALSE_; return ret_val; } /* lit_ */ /* WEIGHT- RETURNS SUM OF WEIGHT OF QUALIFYING OBJECTS */ /* DECLARATIONS */ integer weight_(integer rm, integer cn, integer ad) { /* System generated locals */ integer ret_val, i__1; /* Local variables */ integer i, j; ret_val = 0; i__1 = objcts_1.olnt; for (i = 1; i <= i__1; ++i) { /* !OMIT BIG FIXED ITEMS. */ if (objcts_1.osize[i - 1] >= 10000) { goto L100; } /* !IF FIXED, FORGET IT. */ if ((qhere_(i, rm) && rm != 0) || (objcts_1.oadv[i - 1] == ad && ad != 0)) { goto L50; } j = i; /* !SEE IF CONTAINED. */ L25: j = objcts_1.ocan[j - 1]; /* !GET NEXT LEVEL UP. */ if (j == 0) { goto L100; } /* !END OF LIST? */ if (j != cn) { goto L25; } L50: ret_val += objcts_1.osize[i - 1]; L100: ; } return ret_val; } /* weight_ */
/****************************************************************************** * * CAEN SpA - Front End Division * Via Vetraia, 11 - 55049 - Viareggio ITALY * +390594388398 - www.caen.it * ******************************************************************************* * \note TERMS OF USE: * 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. 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. The user relies on the * software, documentation and results solely at his own risk. ******************************************************************************/ #ifndef __CAENTYPES_H #define __CAENTYPES_H #ifdef __cplusplus extern "C" { #endif #define THROW_EXCEPTION() free(0x1); #define MAX_CH 8 #include <stdio.h> #ifdef WIN32 #include <windows.h> #ifndef int8_t //#define int8_t INT8 #define int8_t char #endif #ifndef int16_t //#define int16_t INT16 #define int16_t short #endif #ifndef int32_t //#define int32_t INT32 #define int32_t long #endif #ifndef int64_t #define int64_t INT64 #endif #ifndef uint8_t //#define uint8_t UINT8 #define uint8_t unsigned char #endif #ifndef uint16_t //#define uint16_t UINT16 #define uint16_t unsigned short #endif #ifndef uint32_t //#define uint32_t UINT32 #define uint32_t unsigned long #endif #ifndef uint64_t #define uint64_t UINT64 #endif #else #include <stdint.h> #include <sys/types.h> #endif //#define TYPE_STRING 0 //#define TYPE_LONG 1 //#define TYPE_DOUBLE 2 //#define TYPE_CHAR 3 //#define TYPE_RESCODE 4 //#define TYPE_SHORT 5 //#define TYPE_MEMORY 6 //#define TYPE_UINT64 7 typedef enum { /* TYPE_STRING = 0L, TYPE_LONG = 1L, TYPE_DOUBLE = 2L, TYPE_CHAR = 3L, TYPE_RESCODE = 4L, TYPE_SHORT = 5L, TYPE_MEMORY = 6L, TYPE_UINT64 = 7L, */ TYPE_INT8 = 0L, TYPE_UINT8 = 1L, TYPE_INT16 = 2L, TYPE_UINT16 = 3L, TYPE_INT32 = 4L, TYPE_UINT32 = 5L, TYPE_INT64 = 6L, TYPE_UINT64 = 7L, TYPE_STRING = 8L, TYPE_LONG = 9L, TYPE_DOUBLE = 10L, TYPE_CHAR = 11L, TYPE_RESCODE = 12L, TYPE_SHORT = 13L, TYPE_MEMORY = 14L, TYPE_NONE, } c_type_t; /* Definition of the format used to open files (ASCII or binary). It is used when the dumper is opened. If a dumper is opened with the flag ASCII, it will dump data in a text file, otherwise datas will be dumped in binary format */ typedef enum { c_format_ASCII = 0L, c_format_Binary = 1L, } c_saveFormat_t; /* Definition of the mode used to open files. It is used when the dumper is opened. The dumper can be contmporary opened in both read and write (or append) modes. A dumper opened in a single write/read mode should have better performance (NOT TESTED) */ typedef enum { c_mode_R = 0L, c_mode_W = 1L, c_mode_A = 2L, c_mode_RW = 3L, c_mode_RA = 4L, } c_mode_t; /* Definition of different DPP types. It is used to recognize different DPPs by the function which directly writes and read DPP events (and not generic events). See for exemple read/writeDPPEvent. */ typedef enum { c_DPPType_CI = 0L, c_DPPType_PHA = 1L, c_DPPType_PSD = 2L, c_DPPType_None = 255L, } c_DPPType_t; /* Definition of DPPs descriptor. It includes the DPP type and the size of TimeStamp and Energy (32/64 bits). It is used to recognize different DPPs by the function which directly writes and read DPP events (and not generic events). See for exemple read/writeDPPEvent. It is passed to the dumper when it is opened. Once opened, the dumper will use this descriptor until it is closed. The descriptor must be manually initialized it is passed to the dumper. If it is not initialized, the dumper will not be able to directly dump DPP events, and a call to that functions will return an error. Accepted values: (BO = Binary Only; AO = ASCII Only) TSType: TYPE_UINT32; TYPE_UINT64; ENType: TYPE_INT16; TYPE_UINT16; TYPE_INT32(BO); TYPE_UINT32(BO); NOTE: For binary dump, signed types are threated as unsigned For DPP-PSD the ENType must be TYPE_INT32, because the chargeShort takes bits 0->15 and chargeLong bits 16->31. */ typedef struct { c_DPPType_t DPPType; c_type_t TSType; c_type_t ENType; } c_DPPDescriptor_t; c_DPPDescriptor_t DPP_CI_Descr; c_DPPDescriptor_t DPP_PSD_Descr; c_DPPDescriptor_t DPP_PHA_Descr; c_DPPDescriptor_t DPP_None_Descr; //#define C_FMT_I8 "%hhd" //#define C_FMT_U8 "%hhu" #define C_FMT_I8 "%c" #define C_FMT_U8 "%hu" // NOTE, should be "%hhu" but is not supported in C90. This causes problems for example in sscanf on void* #define C_FMT_I16 "%hd" #define C_FMT_U16 "%hu" #define C_FMT_I32 "%d" #define C_FMT_U32 "%u" #ifdef WIN32 #define C_FMT_I64 "%I64d" #define C_FMT_U64 "%I64u" #else #define C_FMT_I64 "%lld" #define C_FMT_U64 "%llu" #endif int32_t c_getSizeOfType(c_type_t t); int32_t c_initDPPDescr(); #ifdef __cplusplus } #endif #endif
#ifndef MIXERCHANNEL_H #define MIXERCHANNEL_H #include <QObject> #include <QColor> #include "mixerbuffer.h" #include "mixersendsource.h" #include "mixereffectcontainer.h" #include "mixerinserteffectcontainer.h" #include "../Misc/Instrument.h" class MixerMaster; class MixerChannelInput; class MixerEffect; class MixerChannel : public QObject { Q_OBJECT public: explicit MixerChannel(QObject *parent = 0); virtual ~MixerChannel(); QString GetName(); QColor GetColor(); int GetVolume(); virtual MixerBuffer& AudioOut(); virtual MixerMaster* Sink() { return this->_sink; } virtual MixerChannelInput* ChannelInput() { return this->_generator; } MixerSendSource SendSource; MixerEffectContainer Effects; MixerInsertEffectContainer InsertEffects; signals: void NameChanged(QString name); void ColorChanged(QColor color); void VolumeChanged(int volume); void SinkChanged(MixerMaster* sink); void ChannelInputChanged(MixerChannelInput* input); public slots: void SetName(QString name); void SetColor(QColor color); void SetVolume(int volume); virtual void SetSink(MixerMaster* sink); virtual void SetChannelInput(MixerChannelInput* input); private: MixerBuffer _buffer; QString _name; QColor _color; int _volume; MixerMaster* _sink; MixerChannelInput* _generator; int _currentTick; }; #endif // MIXERCHANNEL_H
#include <stdio.h> #include <stdint.h> #include <levpp/syntax.h> int check_braces(char *buf) { int open_squared = 0; int open_circ = 0; int open_curl = 0; while(*buf++) { if (*buf == '[') open_squared ++; else if (*buf == '(') open_circ ++; else if (*buf == '{') open_curl ++; if (*buf == ']') open_squared --; else if (*buf == ')') open_circ --; else if (*buf == '}') open_curl --; } if (open_squared) syntax_error("Missing squared brackets!\n"); if (open_circ) syntax_error("Missing parantheses!\n"); if (open_curl) syntax_error("Missing curly brackets!\n"); return open_squared + open_circ + open_curl; }
/* Copyright (C) 2018 Rainmeter Project Developers * * This Source Code Form is subject to the terms of the GNU General Public * License; either version 2 of the License, or (at your option) any later * version. If a copy of the GPL was not distributed with this file, You can * obtain one at <https://www.gnu.org/licenses/gpl-2.0.html>. */ #ifndef RM_GFX_UTIL_D2DBITMAP_H_ #define RM_GFX_UTIL_D2DBITMAP_H_ #include "Canvas.h" namespace Gfx { class Canvas; class BitmapSegment { public: BitmapSegment(Microsoft::WRL::ComPtr<ID2D1Bitmap1>& bitmap, UINT x, UINT y, UINT width, UINT height); BitmapSegment(Microsoft::WRL::ComPtr<ID2D1Bitmap1>& bitmap, D2D1_RECT_U& rect); BitmapSegment(Microsoft::WRL::ComPtr<ID2D1Bitmap1>& bitmap, WICRect& rect); ~BitmapSegment() { } UINT GetX() { return m_X; } UINT GetY() { return m_Y; } D2D1_RECT_F GetRect() { return D2D1::RectF((FLOAT)m_X, (FLOAT)m_Y, (FLOAT)m_Width, (FLOAT)m_Height); } ID2D1Bitmap1* GetBitmap() { return m_Bitmap.Get(); } private: BitmapSegment() = delete; UINT m_X; UINT m_Y; UINT m_Width; UINT m_Height; Microsoft::WRL::ComPtr<ID2D1Bitmap1> m_Bitmap; }; struct FileInfo { FileInfo() : m_Path(), m_FileSize(), m_FileTime() {} std::wstring m_Path; DWORD m_FileSize; ULONGLONG m_FileTime; bool isValid() { return !m_Path.empty() && m_FileSize != 0UL && m_FileTime != 0ULL; } }; class D2DBitmap { public: D2DBitmap(const std::wstring& path, int exifOrientation = 0); ~D2DBitmap(); UINT GetWidth() const{ return m_Width; } UINT GetHeight() const{ return m_Height; } void AddSegment(Microsoft::WRL::ComPtr<ID2D1Bitmap1>& bitmap, UINT x, UINT y, UINT width, UINT height); void AddSegment(Microsoft::WRL::ComPtr<ID2D1Bitmap1>& bitmap, D2D1_RECT_U& rect); void AddSegment(Microsoft::WRL::ComPtr<ID2D1Bitmap1>& bitmap, WICRect& rect); void SetSize(UINT width, UINT height) { m_Width = width; m_Height = height; } int GetOrientation() { return m_ExifOrientation; } void SetOrientation(const int orientation) { m_ExifOrientation = orientation; } DWORD GetFileSize() { return m_FileSize; } void SetFileSize(const DWORD& fileSize) { m_FileSize = fileSize; } ULONGLONG GetFileTime() { return m_FileTime; } void SetFileTime(const ULONGLONG& fileTime) { m_FileTime= fileTime; } bool HasFileChanged(const std::wstring& file); std::wstring& GetPath() { return m_Path; } HRESULT Load(const Canvas& canvas); Util::D2DEffectStream* CreateEffectStream(); bool GetPixel(Canvas& canvas, int px, int py, D2D1_COLOR_F& color); static HRESULT GetFileInfo(const std::wstring& path, FileInfo* fileInfo); private: friend class Canvas; friend class Util::D2DEffectStream; friend class Gfx::RenderTexture; D2DBitmap(); D2DBitmap(const D2DBitmap& other) = delete; D2DBitmap& operator=(D2DBitmap other) = delete; UINT m_Width; UINT m_Height; int m_ExifOrientation; std::wstring m_Path; DWORD m_FileSize; ULONGLONG m_FileTime; std::vector<BitmapSegment> m_Segments; }; } // namespace Gfx #endif
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * Copyright (C) 2015-2016 Simon Stuerz <simon.stuerz@guh.guru> * * * * This file is part of QtCoap. * * * * QtCoap 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 3 of the License. * * * * QtCoap 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 QtCoap. If not, see <http://www.gnu.org/licenses/>. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ #ifndef COAPREQUEST_H #define COAPREQUEST_H #include <QUrl> #include <QHostAddress> #include "libguh.h" #include "coappdu.h" #include "coapoption.h" class LIBGUH_EXPORT CoapRequest { // friend class Coap; public: CoapRequest(const QUrl &url = QUrl()); void setUrl(const QUrl &url); QUrl url() const; void setContentType(const CoapPdu::ContentType contentType = CoapPdu::TextPlain); CoapPdu::ContentType contentType() const; void setMessageType(const CoapPdu::MessageType &messageType); CoapPdu::MessageType messageType() const; private: QUrl m_url; CoapPdu::ContentType m_contentType; CoapPdu::MessageType m_messageType; CoapPdu::StatusCode m_statusCode; }; #endif // COAPREQUEST_H
/** * This header is generated by class-dump-z 0.2b. * * Source: /System/Library/PrivateFrameworks/OfficeImport.framework/OfficeImport */ #import <OfficeImport/EDSharedFormula.h> __attribute__((visibility("hidden"))) @interface EDArrayedFormula : EDSharedFormula { } - (id)init; // 0x25bfc9 @end
#ifndef VGUI_IINPUT_H #define VGUI_IINPUT_H #ifdef _WIN32 #pragma once #endif #include <vgui/VGUI.h> #include "interface.h" #include "vgui/MouseCode.h" #include "vgui/KeyCode.h" namespace vgui { class Cursor; typedef unsigned long HCursor; class IInput : public IBaseInterface { public: virtual void SetMouseFocus(VPANEL newMouseFocus) = 0; virtual void SetMouseCapture(VPANEL panel) = 0; virtual void GetKeyCodeText(KeyCode code, char *buf, int buflen) = 0; virtual VPANEL GetFocus(void) = 0; virtual VPANEL GetMouseOver(void) = 0; virtual void SetCursorPos(int x, int y) = 0; virtual void GetCursorPos(int &x, int &y) = 0; virtual bool WasMousePressed(MouseCode code) = 0; virtual bool WasMouseDoublePressed(MouseCode code) = 0; virtual bool IsMouseDown(MouseCode code) = 0; virtual void SetCursorOveride(HCursor cursor) = 0; virtual HCursor GetCursorOveride(void) = 0; virtual bool WasMouseReleased(MouseCode code) = 0; virtual bool WasKeyPressed(KeyCode code) = 0; virtual bool IsKeyDown(KeyCode code) = 0; virtual bool WasKeyTyped(KeyCode code) = 0; virtual bool WasKeyReleased(KeyCode code) = 0; virtual VPANEL GetAppModalSurface(void) = 0; virtual void SetAppModalSurface(VPANEL panel) = 0; virtual void ReleaseAppModalSurface(void) = 0; virtual void GetCursorPosition(int &x, int &y) = 0; }; } #define VGUI_INPUT_INTERFACE_VERSION "VGUI_Input004" #endif
/* QC_QRectF.h Qore Programming Language Copyright 2003 - 2008 David Nichols This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ #ifndef _QORE_QC_QRECTF_H #define _QORE_QC_QRECTF_H #include <QRectF> DLLEXPORT extern qore_classid_t CID_QRECTF; DLLEXPORT extern class QoreClass *QC_QRectF; DLLEXPORT class QoreClass *initQRectFClass(); class QoreQRectF : public AbstractPrivateData, public QRectF { public: DLLLOCAL QoreQRectF() : QRectF() { } DLLLOCAL QoreQRectF(qreal x, qreal y, qreal width, qreal height) : QRectF(x, y, width, height) { } DLLLOCAL QoreQRectF(const QRectF &qr) : QRectF(qr) { } }; #endif
/* * Copyright (C) 2019 MadStrawberry * Distributed under the GNU GPL v2. For full terms see the file LICENSE * License: http://www.gnu.org/licenses/gpl.html GPL version 2 or higher */ #include <stdio.h> #include <hdc.h> int main(int argc, char* argv[]) { hdc_handle_t* handle; hdc_init(&handle); const char* manufacturer = NULL; hdc_baseboard_manufacturer(handle, &manufacturer); const char* product = NULL; hdc_baseboard_product(handle, &product); printf("baseboard : %s %s \n", manufacturer, product); unsigned char uuid[16]; hdc_system_uuid(handle, uuid); printf("system uuid : %02X%02X%02X%02X-%02X%02X-%02X%02X-%02X%02X-%02X%02X%02X%02X%02X%02X\n", uuid[0], uuid[1], uuid[2], uuid[3], uuid[4], uuid[5], uuid[6], uuid[7], uuid[8], uuid[9], uuid[10], uuid[11], uuid[12], uuid[13], uuid[14], uuid[15] ); const char* bios_vendor = NULL; hdc_bios_vendor(handle, &bios_vendor); const char* bios_version = NULL; hdc_bios_version(handle, &bios_version); const char* bios_release_date = NULL; hdc_bios_release_date(handle, &bios_release_date); printf("bios : %s %s %s \n", bios_vendor, bios_version, bios_release_date); hdc_destroy(handle); return 0; }
/* * BattleSpellMechanics.h, part of VCMI engine * * Authors: listed in file AUTHORS in main folder * * License: GNU General Public License v2.0 or later * Full text of license available in license.txt file, in main folder * */ #pragma once #include "CDefaultSpellMechanics.h" class DLL_LINKAGE HealingSpellMechanics : public DefaultSpellMechanics { public: enum class EHealLevel { HEAL, RESURRECT, TRUE_RESURRECT }; HealingSpellMechanics(CSpell * s): DefaultSpellMechanics(s){}; protected: void applyBattleEffects(const SpellCastEnvironment * env, const BattleSpellCastParameters & parameters, SpellCastContext & ctx) const override; virtual int calculateHealedHP(const SpellCastEnvironment * env, const BattleSpellCastParameters & parameters, SpellCastContext & ctx) const; virtual EHealLevel getHealLevel(int effectLevel) const = 0; }; class DLL_LINKAGE AntimagicMechanics : public DefaultSpellMechanics { public: AntimagicMechanics(CSpell * s): DefaultSpellMechanics(s){}; void applyBattle(BattleInfo * battle, const BattleSpellCast * packet) const override final; }; class DLL_LINKAGE ChainLightningMechanics : public DefaultSpellMechanics { public: ChainLightningMechanics(CSpell * s): DefaultSpellMechanics(s){}; std::set<const CStack *> getAffectedStacks(SpellTargetingContext & ctx) const override; }; class DLL_LINKAGE CloneMechanics : public DefaultSpellMechanics { public: CloneMechanics(CSpell * s): DefaultSpellMechanics(s){}; ESpellCastProblem::ESpellCastProblem isImmuneByStack(const ISpellCaster * caster, const CStack * obj) const override; protected: void applyBattleEffects(const SpellCastEnvironment * env, const BattleSpellCastParameters & parameters, SpellCastContext & ctx) const override; }; class DLL_LINKAGE CureMechanics : public HealingSpellMechanics { public: CureMechanics(CSpell * s): HealingSpellMechanics(s){}; void applyBattle(BattleInfo * battle, const BattleSpellCast * packet) const override final; EHealLevel getHealLevel(int effectLevel) const override final; }; class DLL_LINKAGE DispellMechanics : public DefaultSpellMechanics { public: DispellMechanics(CSpell * s): DefaultSpellMechanics(s){}; ESpellCastProblem::ESpellCastProblem isImmuneByStack(const ISpellCaster * caster, const CStack * obj) const override; void applyBattle(BattleInfo * battle, const BattleSpellCast * packet) const override final; protected: void applyBattleEffects(const SpellCastEnvironment * env, const BattleSpellCastParameters & parameters, SpellCastContext & ctx) const override; }; class DLL_LINKAGE EarthquakeMechanics : public DefaultSpellMechanics { public: EarthquakeMechanics(CSpell * s): DefaultSpellMechanics(s){}; ESpellCastProblem::ESpellCastProblem canBeCast(const CBattleInfoCallback * cb, PlayerColor player) const override; protected: void applyBattleEffects(const SpellCastEnvironment * env, const BattleSpellCastParameters & parameters, SpellCastContext & ctx) const override; }; class DLL_LINKAGE HypnotizeMechanics : public DefaultSpellMechanics { public: HypnotizeMechanics(CSpell * s): DefaultSpellMechanics(s){}; ESpellCastProblem::ESpellCastProblem isImmuneByStack(const ISpellCaster * caster, const CStack * obj) const override; }; class DLL_LINKAGE ObstacleMechanics : public DefaultSpellMechanics { public: ObstacleMechanics(CSpell * s): DefaultSpellMechanics(s){}; protected: void applyBattleEffects(const SpellCastEnvironment * env, const BattleSpellCastParameters & parameters, SpellCastContext & ctx) const override; }; class DLL_LINKAGE WallMechanics : public ObstacleMechanics { public: WallMechanics(CSpell * s): ObstacleMechanics(s){}; std::vector<BattleHex> rangeInHexes(BattleHex centralHex, ui8 schoolLvl, ui8 side, bool *outDroppedHexes = nullptr) const override; }; class DLL_LINKAGE RemoveObstacleMechanics : public DefaultSpellMechanics { public: RemoveObstacleMechanics(CSpell * s): DefaultSpellMechanics(s){}; protected: void applyBattleEffects(const SpellCastEnvironment * env, const BattleSpellCastParameters & parameters, SpellCastContext & ctx) const override; }; ///all rising spells class DLL_LINKAGE RisingSpellMechanics : public HealingSpellMechanics { public: RisingSpellMechanics(CSpell * s): HealingSpellMechanics(s){}; EHealLevel getHealLevel(int effectLevel) const override; }; class DLL_LINKAGE SacrificeMechanics : public RisingSpellMechanics { public: SacrificeMechanics(CSpell * s): RisingSpellMechanics(s){}; ESpellCastProblem::ESpellCastProblem canBeCast(const CBattleInfoCallback * cb, PlayerColor player) const override; protected: void applyBattleEffects(const SpellCastEnvironment * env, const BattleSpellCastParameters & parameters, SpellCastContext & ctx) const override; int calculateHealedHP(const SpellCastEnvironment * env, const BattleSpellCastParameters & parameters, SpellCastContext & ctx) const override; }; ///all rising spells but SACRIFICE class DLL_LINKAGE SpecialRisingSpellMechanics : public RisingSpellMechanics { public: SpecialRisingSpellMechanics(CSpell * s): RisingSpellMechanics(s){}; ESpellCastProblem::ESpellCastProblem isImmuneByStack(const ISpellCaster * caster, const CStack * obj) const override; }; class DLL_LINKAGE SummonMechanics : public DefaultSpellMechanics { public: SummonMechanics(CSpell * s, CreatureID cre): DefaultSpellMechanics(s), creatureToSummon(cre){}; ESpellCastProblem::ESpellCastProblem canBeCast(const CBattleInfoCallback * cb, PlayerColor player) const override; protected: void applyBattleEffects(const SpellCastEnvironment * env, const BattleSpellCastParameters & parameters, SpellCastContext & ctx) const override; private: CreatureID creatureToSummon; }; class DLL_LINKAGE TeleportMechanics: public DefaultSpellMechanics { public: TeleportMechanics(CSpell * s): DefaultSpellMechanics(s){}; protected: void applyBattleEffects(const SpellCastEnvironment * env, const BattleSpellCastParameters & parameters, SpellCastContext & ctx) const override; };
/* SPDX-License-Identifier: BSD-3-Clause * Copyright 2015 6WIND S.A. * Copyright 2015 Mellanox Technologies, Ltd */ #include <stddef.h> #include <assert.h> #include <stdint.h> #include <string.h> #include <inttypes.h> #include <errno.h> #include <netinet/in.h> #include <sys/ioctl.h> #include <arpa/inet.h> /* Verbs header. */ /* ISO C doesn't support unnamed structs/unions, disabling -pedantic. */ #ifdef PEDANTIC #pragma GCC diagnostic ignored "-Wpedantic" #endif #include <infiniband/verbs.h> #ifdef PEDANTIC #pragma GCC diagnostic error "-Wpedantic" #endif #include <rte_ether.h> #include <rte_ethdev_driver.h> #include <rte_common.h> #include "mlx5.h" #include "mlx5_utils.h" #include "mlx5_rxtx.h" #include "mlx5_defs.h" /** * Get MAC address by querying netdevice. * * @param[in] dev * Pointer to Ethernet device. * @param[out] mac * MAC address output buffer. * * @return * 0 on success, a negative errno value otherwise and rte_errno is set. */ int mlx5_get_mac(struct rte_eth_dev *dev, uint8_t (*mac)[RTE_ETHER_ADDR_LEN]) { struct ifreq request; int ret; ret = mlx5_ifreq(dev, SIOCGIFHWADDR, &request); if (ret) return ret; memcpy(mac, request.ifr_hwaddr.sa_data, RTE_ETHER_ADDR_LEN); return 0; } /** * Remove a MAC address from the internal array. * * @param dev * Pointer to Ethernet device structure. * @param index * MAC address index. */ static void mlx5_internal_mac_addr_remove(struct rte_eth_dev *dev, uint32_t index) { struct mlx5_priv *priv = dev->data->dev_private; const int vf = priv->config.vf; assert(index < MLX5_MAX_MAC_ADDRESSES); if (rte_is_zero_ether_addr(&dev->data->mac_addrs[index])) return; if (vf) mlx5_nl_mac_addr_remove(dev, &dev->data->mac_addrs[index], index); memset(&dev->data->mac_addrs[index], 0, sizeof(struct rte_ether_addr)); } /** * Adds a MAC address to the internal array. * * @param dev * Pointer to Ethernet device structure. * @param mac_addr * MAC address to register. * @param index * MAC address index. * * @return * 0 on success, a negative errno value otherwise and rte_errno is set. */ static int mlx5_internal_mac_addr_add(struct rte_eth_dev *dev, struct rte_ether_addr *mac, uint32_t index) { struct mlx5_priv *priv = dev->data->dev_private; const int vf = priv->config.vf; unsigned int i; assert(index < MLX5_MAX_MAC_ADDRESSES); if (rte_is_zero_ether_addr(mac)) { rte_errno = EINVAL; return -rte_errno; } /* First, make sure this address isn't already configured. */ for (i = 0; (i != MLX5_MAX_MAC_ADDRESSES); ++i) { /* Skip this index, it's going to be reconfigured. */ if (i == index) continue; if (memcmp(&dev->data->mac_addrs[i], mac, sizeof(*mac))) continue; /* Address already configured elsewhere, return with error. */ rte_errno = EADDRINUSE; return -rte_errno; } if (vf) { int ret = mlx5_nl_mac_addr_add(dev, mac, index); if (ret) return ret; } dev->data->mac_addrs[index] = *mac; return 0; } /** * DPDK callback to remove a MAC address. * * @param dev * Pointer to Ethernet device structure. * @param index * MAC address index. */ void mlx5_mac_addr_remove(struct rte_eth_dev *dev, uint32_t index) { int ret; if (index >= MLX5_MAX_UC_MAC_ADDRESSES) return; mlx5_internal_mac_addr_remove(dev, index); if (!dev->data->promiscuous) { ret = mlx5_traffic_restart(dev); if (ret) DRV_LOG(ERR, "port %u cannot restart traffic: %s", dev->data->port_id, strerror(rte_errno)); } } /** * DPDK callback to add a MAC address. * * @param dev * Pointer to Ethernet device structure. * @param mac_addr * MAC address to register. * @param index * MAC address index. * @param vmdq * VMDq pool index to associate address with (ignored). * * @return * 0 on success, a negative errno value otherwise and rte_errno is set. */ int mlx5_mac_addr_add(struct rte_eth_dev *dev, struct rte_ether_addr *mac, uint32_t index, uint32_t vmdq __rte_unused) { int ret; if (index >= MLX5_MAX_UC_MAC_ADDRESSES) { rte_errno = EINVAL; return -rte_errno; } ret = mlx5_internal_mac_addr_add(dev, mac, index); if (ret < 0) return ret; if (!dev->data->promiscuous) return mlx5_traffic_restart(dev); return 0; } /** * DPDK callback to set primary MAC address. * * @param dev * Pointer to Ethernet device structure. * @param mac_addr * MAC address to register. * * @return * 0 on success, a negative errno value otherwise and rte_errno is set. */ int mlx5_mac_addr_set(struct rte_eth_dev *dev, struct rte_ether_addr *mac_addr) { DRV_LOG(DEBUG, "port %u setting primary MAC address", dev->data->port_id); return mlx5_mac_addr_add(dev, mac_addr, 0, 0); } /** * DPDK callback to set multicast addresses list. * * @see rte_eth_dev_set_mc_addr_list() */ int mlx5_set_mc_addr_list(struct rte_eth_dev *dev, struct rte_ether_addr *mc_addr_set, uint32_t nb_mc_addr) { uint32_t i; int ret; if (nb_mc_addr >= MLX5_MAX_MC_MAC_ADDRESSES) { rte_errno = ENOSPC; return -rte_errno; } for (i = MLX5_MAX_UC_MAC_ADDRESSES; i != MLX5_MAX_MAC_ADDRESSES; ++i) mlx5_internal_mac_addr_remove(dev, i); i = MLX5_MAX_UC_MAC_ADDRESSES; while (nb_mc_addr--) { ret = mlx5_internal_mac_addr_add(dev, mc_addr_set++, i++); if (ret) return ret; } if (!dev->data->promiscuous) return mlx5_traffic_restart(dev); return 0; }
#include <math.h> #include <SDL.h> #include <SDL_image.h> #include <SDL_thread.h> #include "main.h" #include "find_image.h" #include "envelopes.h" int peaks[MAX_METERS]; int ptime[MAX_METERS]; int iec_scale(float db); void load_graphics_dpm() { unsigned int i; meter = find_image("iec268-scale.png"); meter_buf = find_image("iec268-scale.png"); for (i=0; i<MAX_METERS; i++) { peaks[i] = 0; ptime[i] = 0; } } int iec_scale(float db) { float def = 0.0f; /* Meter deflection %age */ if (db < -70.0f) { def = 0.0f; } else if (db < -60.0f) { def = (db + 70.0f) * 0.25f; } else if (db < -50.0f) { // def = (db + 60.0f) * 0.5f + 5.0f; // 5.0 .. 10.0 // bug? v0.9.2 def = (db + 60.0f) * 0.5f + 2.5f; // 2.5 .. 7.5 // fix! from Robin Gareus //http://linux-audio.4202.n7.nabble.com/meterbridge-0-9-2-IEC-scale-bug-amp-fix-td64454.html } else if (db < -40.0f) { def = (db + 50.0f) * 0.75f + 7.5; } else if (db < -30.0f) { def = (db + 40.0f) * 1.5f + 15.0f; } else if (db < -20.0f) { def = (db + 30.0f) * 2.0f + 30.0f; } else if (db < 0.0f) { def = (db + 20.0f) * 2.5f + 50.0f; } else { def = 100.0f; } return (int)(def * 2.0f); } int gfx_thread_dpm(void *foo) { unsigned int i; int height; SDL_Rect r; Uint32 black = SDL_MapRGB(screen->format, 0, 0, 0); Uint32 red = SDL_MapRGB(screen->format, 240, 0, 20); Uint32 yellow = SDL_MapRGB(screen->format, 220, 220, 20); while (1) { for (i=0; i<num_meters; i++) { const float peak = env_read(i); height = iec_scale(20.0f * log10f(peak * bias)); r.x = dest[i].x + 7; r.y = dest[i].y + 5; r.w = 9; r.h = 200 - height; SDL_FillRect(screen, &r, black); r.h = height; r.y = dest[i].y + 205 - height; SDL_FillRect(screen, &r, red); if (height > peaks[i]) { peaks[i] = height; ptime[i] = 0; } else if (ptime[i]++ > 20) { peaks[i] = height; } r.y = dest[i].y + 204 - peaks[i]; if (r.y < 5) { r.y = 5; } r.h = 1; SDL_FillRect(screen, &r, yellow); } SDL_UpdateRects(screen, 1, &win); SDL_Delay(80); } return 0; }
/* BFD back-end for rs6000 support Copyright (C) 1990, 1991 Free Software Foundation, Inc. FIXME: Can someone provide a transliteration of this name into ASCII? Using the following chars caused a compiler warning on HIUX (so I replaced them with octal escapes), and isn't useful without an understanding of what character set it is. Written by Mimi Ph\373\364ng-Th\345o V\365 of IBM and John Gilmore of Cygnus Support. This file is part of BFD, the Binary File Descriptor library. 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. */ #include "bfd.h" #include "sysdep.h" #include "libbfd.h" /* The RS/6000 architecture is compatible with the PowerPC common architecture. */ static const bfd_arch_info_type *rs6000_compatible PARAMS ((const bfd_arch_info_type *, const bfd_arch_info_type *)); static const bfd_arch_info_type * rs6000_compatible (a,b) const bfd_arch_info_type *a; const bfd_arch_info_type *b; { BFD_ASSERT (a->arch == bfd_arch_rs6000); switch (b->arch) { default: return NULL; case bfd_arch_rs6000: return bfd_default_compatible (a, b); case bfd_arch_powerpc: if (b->mach == 0) return b; return NULL; } /*NOTREACHED*/ } const bfd_arch_info_type bfd_rs6000_arch = { 32, /* 32 bits in a word */ 32, /* 32 bits in an address */ 8, /* 8 bits in a byte */ bfd_arch_rs6000, 6000, /* only 1 machine */ "rs6000", "rs6000:6000", 3, true, /* the one and only */ rs6000_compatible, bfd_default_scan, 0, };
/* * QLogic iSCSI HBA Driver * Copyright (c) 2003-2006 QLogic Corporation * * See LICENSE.qla4xxx for copyright and licensing details. */ #ifndef __VMWARE__ #define QLA4XXX_DRIVER_VERSION "5.01.00-k8_rhel5.2-01" #else #define QLA4XXX_DRIVER_VERSION "5.01.00-k8_rh5.2-01_vmw_2009_03_30" #endif
// $Id: klocaletest.h 36482 1999-12-14 10:19:54Z coolo $ #ifndef KLOCALETEST_H #define KLOCALETEST_H #include <qwidget.h> class QLabel; /** test: a small test program for KLocale */ class Test : public QWidget { Q_OBJECT public: /**@name methods */ //@{ /** Constructor */ Test(QWidget *parent = 0, const char *name = 0); /** Destructor */ ~Test(); private: QString showLocale(QString cat); void createFields(); QLabel *label; }; #endif // TEST_H
// Copyright (C) 1999-2000 Id Software, Inc. // #define CTF_CAPTURE_BONUS 100 // what you get for capture #define CTF_TEAM_BONUS 25 // what your team gets for capture #define CTF_RECOVERY_BONUS 10 // what you get for recovery #define CTF_FLAG_BONUS 10 // what you get for picking up enemy flag #define CTF_FRAG_CARRIER_BONUS 20 // what you get for fragging enemy flag carrier #define CTF_FLAG_RETURN_TIME 40000 // seconds until auto return #define CTF_CARRIER_DANGER_PROTECT_BONUS 5 // bonus for fraggin someone who has recently hurt your flag carrier #define CTF_CARRIER_PROTECT_BONUS 2 // bonus for fraggin someone while either you or your target are near your flag carrier #define CTF_FLAG_DEFENSE_BONUS 10 // bonus for fraggin someone while either you or your target are near your flag #define CTF_RETURN_FLAG_ASSIST_BONUS 10 // awarded for returning a flag that causes a capture to happen almost immediately #define CTF_FRAG_CARRIER_ASSIST_BONUS 10 // award for fragging a flag carrier if a capture happens almost immediately #define CTF_TARGET_PROTECT_RADIUS 1000 // the radius around an object being defended where a target will be worth extra frags #define CTF_ATTACKER_PROTECT_RADIUS 1000 // the radius around an object being defended where an attacker will get extra frags when making kills #define CTF_CARRIER_DANGER_PROTECT_TIMEOUT 8000 #define CTF_FRAG_CARRIER_ASSIST_TIMEOUT 10000 #define CTF_RETURN_FLAG_ASSIST_TIMEOUT 10000 #define CTF_GRAPPLE_SPEED 750 // speed of grapple in flight #define CTF_GRAPPLE_PULL_SPEED 750 // speed player is pulled at #define OVERLOAD_ATTACK_BASE_SOUND_TIME 20000 // Prototypes team_t OtherTeam(team_t team); const char *TeamName(team_t team); const char *OtherTeamName(team_t team); const char *TeamColorString(team_t team); void AddTeamScore(vec3_t origin, int team, int score); void Team_DroppedFlagThink(gentity_t *ent); void Team_FragBonuses(gentity_t *targ, gentity_t *inflictor, gentity_t *attacker); void Team_CheckHurtCarrier(gentity_t *targ, gentity_t *attacker); void Team_InitGame(void); void Team_ReturnFlag(int team); void Team_FreeEntity(gentity_t *ent); gentity_t *SelectCTFSpawnPoint ( team_t team, int teamstate, vec3_t origin, vec3_t angles ); gentity_t *SelectSagaSpawnPoint ( team_t team, int teamstate, vec3_t origin, vec3_t angles ); gentity_t *Team_GetLocation(gentity_t *ent); qboolean Team_GetLocationMsg(gentity_t *ent, char *loc, int loclen); void TeamplayInfoMessage( gentity_t *ent ); void CheckTeamStatus(void); int Pickup_Team( gentity_t *ent, gentity_t *other );
/* * Copyright (C) 2002 Derek Atkins * * Authors: Derek Atkins <warlord@MIT.EDU> * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as * published by the Free Software Foundation; either version 2 of * the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * * You should have received a copy of the GNU General Public * License along with this program; if not, write to the * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301, USA. */ #ifndef _GNCSEARCH_BOOLEAN_H #define _GNCSEARCH_BOOLEAN_H #include "search-core-type.h" #include "QueryNew.h" #define GNC_TYPE_SEARCH_BOOLEAN (gnc_search_boolean_get_type ()) #define GNCSEARCH_BOOLEAN(obj) GTK_CHECK_CAST (obj, GNC_TYPE_SEARCH_BOOLEAN, GNCSearchBoolean) #define GNCSEARCH_BOOLEAN_CLASS(klass) GTK_CHECK_CLASS_CAST (klass, GNC_TYPE_SEARCH_BOOLEAN, GNCSearchBooleanClass) #define IS_GNCSEARCH_BOOLEAN(obj) GTK_CHECK_TYPE (obj, GNC_TYPE_SEARCH_BOOLEAN) typedef struct _GNCSearchBoolean GNCSearchBoolean; typedef struct _GNCSearchBooleanClass GNCSearchBooleanClass; struct _GNCSearchBoolean { GNCSearchCoreType parent; query_compare_t how; gboolean value; }; struct _GNCSearchBooleanClass { GNCSearchCoreTypeClass parent_class; /* virtual methods */ /* signals */ }; GType gnc_search_boolean_get_type (void); GNCSearchBoolean *gnc_search_boolean_new (void); /* methods */ void gnc_search_boolean_set_value (GNCSearchBoolean *fi, gboolean val); void gnc_search_boolean_set_how (GNCSearchBoolean *fi, query_compare_t how); #endif /* ! _GNCSEARCH_BOOLEAN_H */
/* * image-converter.c * * Copyright (C) 2004-2005 Jürg Billeter * * This library 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 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 * Library General Public License for more details. * * You should have received a copy of the GNU General Public * License along with this library; if not, write to the Free * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. * * Author: Jürg Billeter <j@bitron.ch> * */ #ifdef HAVE_CONFIG_H #include <config.h> #endif #include <glib/gi18n-lib.h> #include "caja-image-converter.h" static GType type_list[1]; void caja_module_initialize (GTypeModule *module) { g_print ("Initializing caja-image-converter extension\n"); caja_image_converter_register_type (module); type_list[0] = CAJA_TYPE_IMAGE_CONVERTER; } void caja_module_shutdown (void) { g_print ("Shutting down caja-image-converter extension\n"); } void caja_module_list_types (const GType **types, int *num_types) { *types = type_list; *num_types = G_N_ELEMENTS (type_list); }
/* * Diversion Header Field Parsing Macros * * Copyright (C) 2001-2003 FhG Fokus * * This file is part of opensips, a free SIP server. * * opensips 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 * * opensips 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 CASE_DIVE_H #define CASE_DIVE_H #define RSIO_CASE \ switch(LOWER_DWORD(val)) { \ case _rsio_: \ p += 4; \ if (LOWER_BYTE(*p) == 'n') { \ hdr->type = HDR_DIVERSION_T; \ hdr->name.len = 9; \ p++; \ goto dc_cont; \ } \ goto other; \ } #define dive_CASE \ p += 4; \ val = READ(p); \ RSIO_CASE; \ goto other; #endif /* CASE_DIVE_H */
/* * Generated by asn1c-0.9.21 (http://lionet.info/asn1c) * From ASN.1 module "SealSignature" * found in "SealSignature.asn1" */ #ifndef _SESSignData_H_ #define _SESSignData_H_ #include <asn_application.h> /* Including external dependencies */ #include "SESSealInfo.h" #include <OCTET_STRING.h> #include <OBJECT_IDENTIFIER.h> #include <constr_SEQUENCE.h> #ifdef __cplusplus extern "C" { #endif /* SESSignData */ typedef struct SESSignData { SESSealInfo_t esealInfo; OCTET_STRING_t cert; OBJECT_IDENTIFIER_t signatureAlgorithm; /* Context for parsing across buffer boundaries */ asn_struct_ctx_t _asn_ctx; } SESSignData_t; /* Implementation */ extern asn_TYPE_descriptor_t asn_DEF_SESSignData; #ifdef __cplusplus } #endif #endif /* _SESSignData_H_ */
#if !defined(HIER_network_INCLUDED) #define HIER_network_INCLUDED #include "position.h" #include "visual_net.h" #define LL 1.5 int check_position(map<int, double> &lab_x, map<int, double> &lab_y, map<int, double> &lab_r); int get_partition_from_file_tp_format(string S, map<int, deque<int> > &Mlab); int get_sizes(string file_for_sizes, map<int, int> &sizes); int insert_isolated(visual_network &luca, map<int, int> &sizes); int o_level(double origin_x, double origin_y, double radius, visual_network &luca, map<int, int> &sizes, map<int, double> &lab_x, map<int, double> &lab_y, map<int, double> &lab_r); int another_level(string short_tpn, string netn, string tpn, map<int, double> &lab_x, map<int, double> &lab_y, map<int, double> &lab_r, map<int, double> &lab_x_next, map<int, double> &lab_y_next, map<int, double> &lab_r_next, int level, char *b1, deque<string> &edge_append); int all_levels(int levels, string network_file); #endif
/* * Copyright 2009 Gregory Haynes <greg@greghaynes.net> * * 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/>. */ #ifndef QINFINITY_SESSION_PROXY_H #define QINFINITY_SESSION_PROXY_H #include "qgobject.h" #include <QObject> #include <QPointer> typedef struct _InfcSessionProxy InfcSessionProxy; typedef struct _InfSession InfSession; typedef struct _InfcUserRequest InfcUserRequest; typedef struct _GParameter GParameter; namespace QInfinity { class Session; /** * @brief Used for retrieving newly created sessions. */ class SessionProxy : public QGObject { public: static QPointer<SessionProxy> wrap( InfcSessionProxy *infObject, QObject *parent, bool own_gobject = true ); InfcUserRequest *joinUser( const GParameter *params, unsigned int n_params, GError **error ); /** * @brief Get the session for this proxy. * * If your session is not of the type you expected, * you probably need to be using a NotePlugin. See * the NotePlugin documentation for more information. */ QPointer<Session> session() const; protected: SessionProxy( InfcSessionProxy *infProxy, QObject *parent = 0, bool own_gobject = true ); }; } #endif
/* -*- c++ -*- ---------------------------------------------------------- LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator https://lammps.sandia.gov/, Sandia National Laboratories Steve Plimpton, sjplimp@sandia.gov Copyright (2003) Sandia Corporation. Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains certain rights in this software. This software is distributed under the GNU General Public License. See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ #ifdef COMPUTE_CLASS ComputeStyle(orientorder/atom/kk,ComputeOrientOrderAtomKokkos<LMPDeviceType>) ComputeStyle(orientorder/atom/kk/device,ComputeOrientOrderAtomKokkos<LMPDeviceType>) ComputeStyle(orientorder/atom/kk/host,ComputeOrientOrderAtomKokkos<LMPHostType>) #else #ifndef LMP_COMPUTE_ORIENTORDER_ATOM_KOKKOS_H #define LMP_COMPUTE_ORIENTORDER_ATOM_KOKKOS_H #include "compute_orientorder_atom.h" #include "kokkos_type.h" namespace LAMMPS_NS { struct TagComputeOrientOrderAtomNeigh{}; struct TagComputeOrientOrderAtomSelect3{}; struct TagComputeOrientOrderAtomBOOP1{}; struct TagComputeOrientOrderAtomBOOP2{}; template<class DeviceType> class ComputeOrientOrderAtomKokkos : public ComputeOrientOrderAtom { public: typedef Kokkos::View<int*, DeviceType> t_sna_1i; typedef Kokkos::View<double*, DeviceType> t_sna_1d; typedef Kokkos::View<double*, DeviceType, Kokkos::MemoryTraits<Kokkos::Atomic> > t_sna_1d_atomic; typedef Kokkos::View<int**, Kokkos::LayoutRight, DeviceType> t_sna_2i_lr; typedef Kokkos::View<int**, Kokkos::LayoutRight, DeviceType, Kokkos::MemoryTraits<Kokkos::Unmanaged> > t_sna_2i_lr_um; typedef Kokkos::View<int**, DeviceType> t_sna_2i; typedef Kokkos::View<double**, DeviceType> t_sna_2d; typedef Kokkos::View<double**, Kokkos::LayoutRight, DeviceType> t_sna_2d_lr; typedef Kokkos::DualView<double**, Kokkos::LayoutRight, DeviceType> tdual_sna_2d_lr; typedef Kokkos::View<double**, Kokkos::LayoutRight, DeviceType, Kokkos::MemoryTraits<Kokkos::Unmanaged> > t_sna_2d_lr_um; typedef Kokkos::View<double***, DeviceType> t_sna_3d; typedef Kokkos::View<double***, Kokkos::LayoutRight, DeviceType> t_sna_3d_lr; typedef Kokkos::View<double***, Kokkos::LayoutRight, DeviceType, Kokkos::MemoryTraits<Kokkos::Unmanaged> > t_sna_3d_lr_um; typedef Kokkos::View<double***[3], DeviceType> t_sna_4d; typedef Kokkos::View<double**[3], DeviceType> t_sna_3d3; typedef Kokkos::View<double*****, DeviceType> t_sna_5d; typedef Kokkos::View<SNAcomplex*, DeviceType> t_sna_1c; typedef Kokkos::View<SNAcomplex*, DeviceType, Kokkos::MemoryTraits<Kokkos::Atomic> > t_sna_1c_atomic; typedef Kokkos::View<SNAcomplex**, DeviceType> t_sna_2c; typedef Kokkos::View<SNAcomplex**, Kokkos::LayoutRight, DeviceType> t_sna_2c_lr; typedef Kokkos::View<SNAcomplex***, DeviceType> t_sna_3c; typedef Kokkos::View<SNAcomplex***[3], DeviceType> t_sna_4c; typedef Kokkos::View<SNAcomplex**[3], DeviceType> t_sna_3c3; typedef Kokkos::View<SNAcomplex*****, DeviceType> t_sna_5c; typedef DeviceType device_type; typedef ArrayTypes<DeviceType> AT; typedef int value_type; ComputeOrientOrderAtomKokkos(class LAMMPS *, int, char **); ~ComputeOrientOrderAtomKokkos(); void init(); void compute_peratom(); t_sna_1i d_qlist; template<class TagStyle> void check_team_size_for(int, int&, int); KOKKOS_INLINE_FUNCTION void operator() (TagComputeOrientOrderAtomNeigh, const typename Kokkos::TeamPolicy<DeviceType, TagComputeOrientOrderAtomNeigh>::member_type& team) const; KOKKOS_INLINE_FUNCTION void operator() (TagComputeOrientOrderAtomSelect3, const int& ii) const; KOKKOS_INLINE_FUNCTION void operator() (TagComputeOrientOrderAtomBOOP1, const typename Kokkos::TeamPolicy<DeviceType, TagComputeOrientOrderAtomBOOP1>::member_type& team) const; KOKKOS_INLINE_FUNCTION void operator() (TagComputeOrientOrderAtomBOOP2, const int& ii) const; DAT::tdual_float_2d k_qnarray; typename AT::t_float_2d d_qnarray; private: int inum,chunk_size,chunk_offset; int host_flag; typename AT::t_x_array_randomread x; typename ArrayTypes<DeviceType>::t_int_1d mask; typename AT::t_neighbors_2d d_neighbors; typename AT::t_int_1d_randomread d_ilist; typename AT::t_int_1d_randomread d_numneigh; t_sna_1i d_ncount; t_sna_2d_lr d_distsq; t_sna_2i_lr d_nearest; t_sna_3d_lr d_rlist; t_sna_2d_lr_um d_distsq_um; t_sna_2i_lr_um d_nearest_um; t_sna_3d_lr_um d_rlist_um; t_sna_3c d_qnm; KOKKOS_INLINE_FUNCTION void select3(int, int, int) const; KOKKOS_INLINE_FUNCTION void calc_boop1(int, int, int) const; KOKKOS_INLINE_FUNCTION void calc_boop2(int, int) const; KOKKOS_INLINE_FUNCTION double polar_prefactor(int, int, double) const; KOKKOS_INLINE_FUNCTION double associated_legendre(int, int, double) const; void init_clebsch_gordan(); t_sna_1d d_cglist; // Clebsch-Gordan coeffs }; } #endif #endif /* ERROR/WARNING messages: */
#pragma once #include "FilterBase.h" namespace Artus { class RunRangeFilter: public ZJetFilterBase { public: virtual bool DoesEventPass(ZJetEventData const& event, ZJetProduct const& product, ZJetPipelineSettings const& settings) { bool bPass = true; unsigned int run = event.m_eventproduct->nRun; if (run < settings.GetFilterRunRangeLow()) bPass = false; if (run > settings.GetFilterRunRangeHigh()) bPass = false; /* if (settings.GetFilterRunRangeLumiLow() > 0) { // also check for the lumi section if (event.m_eventproduct->nLumi < settings.GetFilterRunRangeLumiLow()) bPass = false; if (event.m_eventproduct->nLumi > settings.GetFilterRunRangeLumiHigh()) bPass = false; } if (settings.GetFilterRunRangeEventLow() > 0) { // also check for event ! if (event.m_eventproduct->nEvent < settings.GetFilterRunRangeEventLow()) bPass = false; if (event.m_eventproduct->nEvent > settings.GetFilterRunRangeEventHigh()) bPass = false; } */ return bPass; } virtual std::string GetFilterId() { return "runrange"; } }; }
#include <common.h> #include <linux/sizes.h> #include <asm/barebox-arm-head.h> #include <asm/barebox-arm.h> #include <mach/imx23-regs.h> #include <generated/mach-types.h> ENTRY_FUNCTION(start_chumby_falconwing, r0, r1, r2) { arm_cpu_lowlevel_init(); barebox_arm_entry(IMX_MEMORY_BASE, SZ_64M, (void *)MACH_TYPE_CHUMBY); }
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- * * Copyright (C) 2005-2008 Richard Hughes <richard@hughsie.com> * * Licensed under the GNU General Public License Version 2 * * 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 __GPMSCREENSAVER_H #define __GPMSCREENSAVER_H #include <glib-object.h> G_BEGIN_DECLS #define GPM_TYPE_SCREENSAVER (gpm_screensaver_get_type ()) #define GPM_SCREENSAVER(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), GPM_TYPE_SCREENSAVER, GpmScreensaver)) #define GPM_SCREENSAVER_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), GPM_TYPE_SCREENSAVER, GpmScreensaverClass)) #define GPM_IS_SCREENSAVER(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), GPM_TYPE_SCREENSAVER)) #define GPM_IS_SCREENSAVER_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), GPM_TYPE_SCREENSAVER)) #define GPM_SCREENSAVER_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), GPM_TYPE_SCREENSAVER, GpmScreensaverClass)) typedef struct GpmScreensaverPrivate GpmScreensaverPrivate; typedef struct { GObject parent; GpmScreensaverPrivate *priv; } GpmScreensaver; typedef struct { GObjectClass parent_class; #if 0 void (* auth_request) (GpmScreensaver *screensaver, gboolean auth); #endif } GpmScreensaverClass; GType gpm_screensaver_get_type (void); GpmScreensaver *gpm_screensaver_new (void); void gpm_screensaver_test (gpointer data); gboolean gpm_screensaver_lock (GpmScreensaver *screensaver); gboolean gpm_screensaver_lock_enabled (GpmScreensaver *screensaver); guint32 gpm_screensaver_add_throttle (GpmScreensaver *screensaver, const gchar *reason); gboolean gpm_screensaver_remove_throttle (GpmScreensaver *screensaver, guint32 cookie); gboolean gpm_screensaver_check_running (GpmScreensaver *screensaver); gboolean gpm_screensaver_poke (GpmScreensaver *screensaver); G_END_DECLS #endif /* __GPMSCREENSAVER_H */
#ifndef STAT_H #define STAT_H \ "$Id: stat.h,v 4.1 1994/10/03 20:52:20 ppessi Exp $ " /* * Unix compatible stat() * * Copyright © 1994 AmiTCP/IP Group, * Network Solutions Development, Inc. * All rights reserved. */ #ifndef SYS_STAT_H #include <sys/stat.h> #endif #endif
/* $Id: xtouchscreen_intr.c,v 1.1 2002/08/15 22:17:01 carsten Exp $ */ /***************************************************************************** * * Author: Xilinx, Inc. * * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the * Free Software Foundation; either version 2 of the License, or (at your * option) any later version. * * * XILINX IS PROVIDING THIS DESIGN, CODE, OR INFORMATION "AS IS" AS A * COURTESY TO YOU. BY PROVIDING THIS DESIGN, CODE, OR INFORMATION AS * ONE POSSIBLE IMPLEMENTATION OF THIS FEATURE, APPLICATION OR STANDARD, * XILINX IS MAKING NO REPRESENTATION THAT THIS IMPLEMENTATION IS FREE * FROM ANY CLAIMS OF INFRINGEMENT, AND YOU ARE RESPONSIBLE FOR * OBTAINING ANY RIGHTS YOU MAY REQUIRE FOR YOUR IMPLEMENTATION. * XILINX EXPRESSLY DISCLAIMS ANY WARRANTY WHATSOEVER WITH RESPECT TO * THE ADEQUACY OF THE IMPLEMENTATION, INCLUDING BUT NOT LIMITED TO ANY * WARRANTIES OR REPRESENTATIONS THAT THIS IMPLEMENTATION IS FREE FROM * CLAIMS OF INFRINGEMENT, IMPLIED WARRANTIES OF MERCHANTABILITY AND * FITNESS FOR A PARTICULAR PURPOSE. * * * Xilinx products are not intended for use in life support appliances, * devices, or systems. Use in such applications is expressly prohibited. * * * (c) Copyright 2002 Xilinx Inc. * All rights reserved. * * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 675 Mass Ave, Cambridge, MA 02139, USA. * *****************************************************************************/ /****************************************************************************/ /** * * @file xtouchscreen_intr.c * * This file contains the functions that are related to interrupt processing * for the touchscreen driver. * * <pre> * MODIFICATION HISTORY: * * Ver Who Date Changes * ----- ---- -------- ----------------------------------------------- * 1.00a ch 08/15/02 First release * </pre> * *****************************************************************************/ /***************************** Include Files ********************************/ #include "xio.h" #include "xtouchscreen.h" #include "xtouchscreen_l.h" /************************** Constant Definitions ****************************/ /**************************** Type Definitions ******************************/ /***************** Macros (Inline Functions) Definitions ********************/ /************************** Variable Definitions ****************************/ typedef void (*Handler) (XTouchscreen * InstancePtr); /************************** Function Prototypes *****************************/ /****************************************************************************/ /** * * This function sets the handler that will be called when an event (interrupt) * occurs in the driver. The purpose of the handler is to allow application * specific processing to be performed. * * @param InstancePtr is a pointer to the XTouchscreen instance to be * worked on. * @param FuncPtr is the pointer to the callback function. * @param CallBackRef is the upper layer callback reference passed back when * the callback function is invoked. * * @return * * None. * * @notes * * There is no assert on the CallBackRef since the driver doesn't know what it * is (nor should it) * *****************************************************************************/ void XTouchscreen_SetHandler(XTouchscreen * InstancePtr, XTouchscreen_Handler FuncPtr, void *CallBackRef) { /* * Assert validates the input arguments * CallBackRef not checked, no way to know what is valid */ XASSERT_VOID(InstancePtr != NULL); XASSERT_VOID(FuncPtr != NULL); XASSERT_VOID(InstancePtr->IsReady == XCOMPONENT_IS_READY); InstancePtr->Handler = FuncPtr; InstancePtr->CallBackRef = CallBackRef; } /****************************************************************************/ /** * * This function is the interrupt handler for the Touchscreen driver. * It must be connected to an interrupt system by the user such that it is * called when an interrupt for any PS/2 port occurs. This function does * not save or restore the processor context such that the user must * ensure this occurs. * * @param InstancePtr contains a pointer to the Touchscreen instance. * * @return * * None. * * @note * * None. * ******************************************************************************/ void XTouchscreen_InterruptHandler(XTouchscreen * InstancePtr) { u8 IntrStatus; // u32 x,y,z; XASSERT_VOID(InstancePtr != NULL); /* * Read the interrupt status register to determine which * interrupt is active */ IntrStatus = XTouchscreen_mGetIntrStatus(InstancePtr->BaseAddress); if (IntrStatus & XTOUCHSCREEN_INT_PEN_DOWN) { /* * Check if the pen is alreay down. This is done for debouncing */ if (!(InstancePtr->CurrentState == XTOUCHSCREEN_STATE_PEN_DOWN)) { /* * Call the application handler */ InstancePtr->Handler(InstancePtr->CallBackRef, XTOUCHSCREEN_EVENT_PEN_DOWN, 0); } /* * Save the current state */ InstancePtr->CurrentState = XTOUCHSCREEN_STATE_PEN_DOWN; XTouchscreen_mClearIntr(InstancePtr->BaseAddress, XTOUCHSCREEN_INT_PEN_DOWN); } if (IntrStatus & XTOUCHSCREEN_INT_PEN_UP) { /* * Check if the pen is alreay up. This is done for debouncing */ if (!(InstancePtr->CurrentState == XTOUCHSCREEN_STATE_PEN_UP)) { /* * Call the application handler */ InstancePtr->Handler(InstancePtr->CallBackRef, XTOUCHSCREEN_EVENT_PEN_UP, 0); } /* * Save the current pen state */ InstancePtr->CurrentState = XTOUCHSCREEN_STATE_PEN_UP; XTouchscreen_mClearIntr(InstancePtr->BaseAddress, XTOUCHSCREEN_INT_PEN_UP); } }
#include<errno.h> #include<string.h> #include<stdio.h> #include<stdlib.h> #include<unistd.h> #include<inttypes.h> #include<pcap.h> #include"arping.h" int main() { const size_t maxpacket = 1500; char* const packet = calloc(1, maxpacket); size_t packet_size = 0; // Read packet. { char* p = packet; size_t size = maxpacket; while (size > 0) { const ssize_t n = read(STDIN_FILENO, p, size); if (n == 0) { break; } if (n < 0) { fprintf(stderr, "read(): %s\n", strerror(errno)); return 1; } size -= n; p += n; } packet_size = p - packet; } struct pcap_pkthdr pkthdr; pkthdr.ts.tv_sec = time(NULL); pkthdr.ts.tv_usec = 0; pkthdr.len = packet_size; pkthdr.caplen = packet_size; verbose = 9; dstip = htonl(0x12345678); pingip_recv(NULL, &pkthdr, packet); free(packet); return 0; } /* ---- Emacs Variables ---- * Local Variables: * c-basic-offset: 8 * indent-tabs-mode: nil * End: */
/* * Copyright © 2002,2003 Red Hat, Inc. * * This is free software; you can redistribute it and/or modify it under * the terms of the GNU Library 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 Library General Public * License along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include <config.h> #include <glib.h> #include "games-debug.h" #ifdef GNOME_ENABLE_DEBUG GamesDebugFlags _games_debug_flags; #endif void _games_debug_init (void) { #ifdef GNOME_ENABLE_DEBUG const GDebugKey keys[] = { { "blocks-cache", GAMES_DEBUG_BLOCKS_CACHE }, { "card-cache", GAMES_DEBUG_CARD_CACHE }, { "card-theme", GAMES_DEBUG_CARD_THEME }, { "runtime", GAMES_DEBUG_RUNTIME }, { "scheme", GAMES_DEBUG_SCHEME }, { "sound", GAMES_DEBUG_SOUND }, { "window-state", GAMES_DEBUG_WINDOW_STATE }, { "game-drawing", GAMES_DEBUG_GAME_DRAWING }, { "game-events", GAMES_DEBUG_GAME_EVENTS }, { "game-keynav", GAMES_DEBUG_GAME_KEYNAV }, { "game-sizing", GAMES_DEBUG_GAME_SIZING }, { "game-style", GAMES_DEBUG_GAME_STYLE } }; const char *env; env = g_getenv ("GAMES_DEBUG"); _games_debug_flags = g_parse_debug_string (env, keys, G_N_ELEMENTS (keys)); #endif /* GNOME_ENABLE_DEBUG */ }
extern void __VERIFIER_assume(int); extern void __VERIFIER_error() __attribute__ ((__noreturn__)); extern void __VERIFIER_atomic_begin(); extern void __VERIFIER_atomic_end(); //Ticket lock with proportional backoff // //From Algorithms for Scalable Synchronization on Shared-Memory Multiprocessors, 1991 (Fig. 2). //Also available as pseudo-code here: http://www.cs.rochester.edu/research/synchronization/pseudocode/ss.html#ticket #include <pthread.h> #define assume(e) __VERIFIER_assume(e) #define assert(e) { if(!(e)) { ERROR: __VERIFIER_error();(void)0; } } volatile unsigned next_ticket = 0; volatile unsigned now_serving = 0; #define FAILED 3 //this is already and the limit of what we can handle #define NEXT(e) ((e + 1) % FAILED) // #define NEXT(e) ((e+1 == FAILED)?0:e+1) unsigned fetch_and_increment__next_ticket(){ __VERIFIER_atomic_begin(); unsigned value; if(NEXT(next_ticket) == now_serving){ value = FAILED; } else { value = next_ticket; next_ticket = NEXT(next_ticket); } __VERIFIER_atomic_end(); return value; } inline void acquire_lock(){ unsigned my_ticket; my_ticket = fetch_and_increment__next_ticket(); //returns old value; arithmetic overflow is harmless (Alex: it is not if we have 2^64 threads) if(my_ticket == FAILED){ assume(0); }else{ while(1){ //pause(my_ticket - now_serving); // consume this many units of time // on most machines, subtraction works correctly despite overflow if(now_serving == my_ticket){ break; } } } return; } inline void release_lock(){ now_serving++; } int c = 0; void* thr1(void* arg){ acquire_lock(); c++; assert(c == 1); c--; release_lock(); return 0; } int main(){ pthread_t t; while(1) { pthread_create(&t, 0, thr1, 0); } }
/* * (C) Copyright 2000 * Wolfgang Denk, DENX Software Engineering, wd@denx.de. * * See file CREDITS for list of people who contributed to this * project. * * 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 _IDE_H #define _IDE_H #define IDE_BUS(dev) (dev >> 1) #ifdef CONFIG_IDE_LED /* * LED Port */ #define LED_PORT ((uchar *)(PER8_BASE + 0x3000)) #define LED_IDE1 0x01 #define LED_IDE2 0x02 #define DEVICE_LED(d) ((d & 2) | ((d & 2) == 0)) /* depends on bit positions! */ #endif /* CONFIG_IDE_LED */ /* * Function Prototypes */ void ide_init (bd_t *); ulong ide_read (int device, ulong blknr, ulong blkcnt, ulong *buffer); ulong ide_write (int device, ulong blknr, ulong blkcnt, ulong *buffer); #endif /* _IDE_H */
/* created by click/linuxmodule/fixincludes.pl on Tue Nov 25 22:39:41 2014 */ /* from /lib/modules/2.6.27.5-117.fc10.i686/build/include/config/net/sch/dsmark.h */
/* * Copyright (C) 2002-2009 The DOSBox 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 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ /* $Id: risc_armv4le-common.h,v 1.3 2009/05/16 21:52:47 c2woody Exp $ */ /* ARMv4 (little endian) backend by M-HT (common data/functions) */ // some configuring defines that specify the capabilities of this architecture // or aspects of the recompiling // protect FC_ADDR over function calls if necessaray // #define DRC_PROTECT_ADDR_REG // try to use non-flags generating functions if possible #define DRC_FLAGS_INVALIDATION // try to replace _simple functions by code #define DRC_FLAGS_INVALIDATION_DCODE // type with the same size as a pointer #define DRC_PTR_SIZE_IM Bit32u // calling convention modifier #define DRC_CALL_CONV /* nothing */ #define DRC_FC /* nothing */ // use FC_REGS_ADDR to hold the address of "cpu_regs" and to access it using FC_REGS_ADDR #define DRC_USE_REGS_ADDR // use FC_SEGS_ADDR to hold the address of "Segs" and to access it using FC_SEGS_ADDR #define DRC_USE_SEGS_ADDR // register mapping typedef Bit8u HostReg; // "lo" registers #define HOST_r0 0 #define HOST_r1 1 #define HOST_r2 2 #define HOST_r3 3 #define HOST_r4 4 #define HOST_r5 5 #define HOST_r6 6 #define HOST_r7 7 // "hi" registers #define HOST_r8 8 #define HOST_r9 9 #define HOST_r10 10 #define HOST_r11 11 #define HOST_r12 12 #define HOST_r13 13 #define HOST_r14 14 #define HOST_r15 15 // register aliases // "lo" registers #define HOST_a1 HOST_r0 #define HOST_a2 HOST_r1 #define HOST_a3 HOST_r2 #define HOST_a4 HOST_r3 #define HOST_v1 HOST_r4 #define HOST_v2 HOST_r5 #define HOST_v3 HOST_r6 #define HOST_v4 HOST_r7 // "hi" registers #define HOST_v5 HOST_r8 #define HOST_v6 HOST_r9 #define HOST_v7 HOST_r10 #define HOST_v8 HOST_r11 #define HOST_ip HOST_r12 #define HOST_sp HOST_r13 #define HOST_lr HOST_r14 #define HOST_pc HOST_r15 static void cache_block_closing(Bit8u* block_start,Bitu block_size) { #if (__ARM_EABI__) //flush cache - eabi register unsigned long _beg __asm ("a1") = (unsigned long)(block_start); // block start register unsigned long _end __asm ("a2") = (unsigned long)(block_start+block_size); // block end register unsigned long _flg __asm ("a3") = 0; register unsigned long _par __asm ("r7") = 0xf0002; // sys_cacheflush __asm __volatile ("swi 0x0" : // no outputs : "r" (_beg), "r" (_end), "r" (_flg), "r" (_par) ); #else // GP2X BEGIN //flush cache - old abi register unsigned long _beg __asm ("a1") = (unsigned long)(block_start); // block start register unsigned long _end __asm ("a2") = (unsigned long)(block_start+block_size); // block end register unsigned long _flg __asm ("a3") = 0; __asm __volatile ("swi 0x9f0002 @ sys_cacheflush" : // no outputs : "r" (_beg), "r" (_end), "r" (_flg) ); // GP2X END #endif }
/*************************************************************************** * * * copyright : (C) 2007 The University of Toronto * * netterfield@astro.utoronto.ca * * * * 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 EDITMULTIPLEWIDGET_H #define EDITMULTIPLEWIDGET_H #include <QWidget> #include "ui_editmultiplewidget.h" #include "kst_export.h" namespace Kst { class EditMultipleWidget : public QWidget, public Ui::EditMultipleWidget { Q_OBJECT public: EditMultipleWidget(QWidget *parent = 0); virtual ~EditMultipleWidget(); // void addObjects(QStringList &objects); void clearObjects(); void addObject(QString name, QString descriptionTip); QStringList selectedObjects() const; void selectObjects(const QStringList &objects); private Q_SLOTS: void selectAllObjects(); void applyFilter(const QString &filter); }; } #endif // vim: ts=2 sw=2 et
/* * File : poll.h * This file is part of Device File System in RT-Thread RTOS * COPYRIGHT (C) 2006-2016, RT-Thread Development 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 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. * * Change Logs: * Date Author Notes * 2016-09-19 Heyuanjie The first version. * 2016-12-26 Bernard Update poll interface */ #ifndef __POLL_H__ #define __POLL_H__ #include <rtthread.h> #include <rtdevice.h> #ifdef __cplusplus extern "C" { #endif #define POLLIN (0x01) #define POLLRDNORM (0x01) #define POLLRDBAND (0x01) #define POLLPRI (0x01) #define POLLOUT (0x02) #define POLLWRNORM (0x02) #define POLLWRBAND (0x02) #define POLLERR (0x04) #define POLLHUP (0x08) #define POLLNVAL (0x10) #define POLLMASK_DEFAULT (POLLIN | POLLOUT | POLLRDNORM | POLLWRNORM) typedef unsigned int nfds_t; struct pollfd { int fd; short events; short revents; }; int poll(struct pollfd *fds, nfds_t nfds, int timeout); #ifdef __cplusplus } #endif #endif
/* # 用于探测仲裁服务器上的vip端口代理. # install: # gcc -O3 -Wall -Wextra -Werror -g -o port_probe ./port_probe.c # Author : Digoal zhou # Email : digoal@126.com # Blog : http://blog.163.com/digoal@126/ */ #include <stdlib.h> #include <stdio.h> #include <string.h> #include <errno.h> #include <sys/types.h> #include <sys/socket.h> #include <strings.h> #include <netinet/in.h> #include <arpa/inet.h> #include <unistd.h> #include <sys/time.h> // 错误函数, 当exit_val=0只输出错误信息, 不退出程序. 其他值输出错误信息并退出程序 void error(char * msg, int exit_val); void error(char * msg, int exit_val) { fprintf(stderr, "%s: %s\n", msg, strerror(errno)); // if exit_val == 0, not exit the program. if (exit_val) exit(exit_val); } int main(int argc,char *argv[]) { if(argc == 1) error("USAGE [program ip port]", 1); int cfd; struct sockaddr_in s_add; cfd = socket(AF_INET, SOCK_STREAM, 0); if(-1 == cfd) error("socket create failed!", -1); fprintf(stdout, "socket created!\n"); bzero(&s_add, sizeof(struct sockaddr_in)); s_add.sin_family=AF_INET; s_add.sin_addr.s_addr= inet_addr(argv[1]); s_add.sin_port=htons(atoi(argv[2])); // 设置连接超时, 否则如果端口不通, connect可能会很久. struct timeval tv_timeout; tv_timeout.tv_sec = 2; tv_timeout.tv_usec = 0; // 避免本地出现TIME_WAIT struct linger { int l_onoff; /* 0 = off, nozero = on */ int l_linger; /* linger time */ }; struct linger so_linger; so_linger.l_onoff = 1; so_linger.l_linger = 0; if (setsockopt(cfd, SOL_SOCKET, SO_SNDTIMEO, (void *) &tv_timeout, sizeof(struct timeval)) < 0) { error("setsockopt SO_SNDTIMEO error!", -1); } if (setsockopt(cfd, SOL_SOCKET, SO_RCVTIMEO, (void *) &tv_timeout, sizeof(struct timeval)) < 0) { error("setsockopt SO_RCVTIMEO error!", -1); } if (setsockopt(cfd, SOL_SOCKET, SO_LINGER, (void *) &so_linger, sizeof(so_linger)) < 0) { error("setsockopt SO_LINGER error!", -1); } if(-1 == connect(cfd, (struct sockaddr *)(&s_add), sizeof(struct sockaddr))) { error("connect failed!", -1); } fprintf(stdout, "connect ok!\n"); close(cfd); return 0; }
/** -*- C++ -*- * Copyright (C) 2008 Luke Lu (Zvents, Inc.) * * This file is part of Hypertable. * * Hypertable 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. * * Hypertable 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 HYPERTABLE_LIB_CONFIG_H #define HYPERTABLE_LIB_CONFIG_H #include "Common/Config.h" #include "AsyncComm/Config.h" #include "Hyperspace/Config.h" #include "DfsBroker/Lib/Config.h" namespace Hypertable { namespace Config { // init helpers void init_master_client_options(); void init_master_client(); void init_range_server_client_options(); void init_range_server_client(); void init_command_shell_options(); struct MasterClientPolicy : Policy { static void init_options() { init_master_client_options(); } static void init() { init_master_client(); } }; struct RangeServerClientPolicy : Policy { static void init_options() { init_range_server_client_options(); } static void init() { init_range_server_client(); } }; struct CommandShellPolicy : Policy { static void init_options() { init_command_shell_options(); } }; typedef Meta::list<DfsClientPolicy, HyperspaceClientPolicy, MasterClientPolicy, DefaultCommPolicy> ClientPolicies; typedef Join<ClientPolicies>::type DefaultClientPolicy; }} // namespace Hypertable::Config #endif // HYPERTABLE_LIB_CONFIG_H
/* * Copyright (C) 2014 Frédéric Wang (fred.wang@free.fr). 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 THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #ifndef RenderMathMLToken_h #define RenderMathMLToken_h #if ENABLE(MATHML) #include "MathMLTextElement.h" #include "RenderMathMLBlock.h" #include "RenderText.h" namespace WebCore { class RenderMathMLToken : public RenderMathMLBlock { public: RenderMathMLToken(Element&, Ref<RenderStyle>&&); RenderMathMLToken(Document&, Ref<RenderStyle>&&); MathMLTextElement& element() { return static_cast<MathMLTextElement&>(nodeForNonAnonymous()); } virtual bool isChildAllowed(const RenderObject&, const RenderStyle&) const override { return true; }; virtual void addChild(RenderObject* newChild, RenderObject* beforeChild) override; virtual void updateTokenContent(); virtual void updateFromElement() override; protected: void createWrapperIfNeeded(); private: virtual bool isRenderMathMLToken() const override final { return true; } virtual const char* renderName() const override { return isAnonymous() ? "RenderMathMLToken (anonymous)" : "RenderMathMLToken"; } virtual void styleDidChange(StyleDifference, const RenderStyle* oldStyle) override; virtual void updateStyle(); // This boolean indicates whether the token element contains some RenderElement descendants, other than the anonymous renderers created for layout purpose. bool m_containsElement; }; } // namespace WebCore SPECIALIZE_TYPE_TRAITS_RENDER_OBJECT(RenderMathMLToken, isRenderMathMLToken()) #endif // ENABLE(MATHML) #endif // RenderMathMLToken_h
#include <linux/init.h> #include <linux/irq.h> #include <linux/io.h> #include <mach/highlander.h> enum { UNUSED = 0, /* board specific interrupt sources */ CF, /* Compact Flash */ TP, /* Touch panel */ SCIF1, /* FPGA SCIF1 */ SCIF0, /* FPGA SCIF0 */ SMBUS, /* SMBUS */ RTC, /* RTC Alarm */ AX88796, /* Ethernet controller */ PSW, /* Push Switch */ /* external bus connector */ EXT1, EXT2, EXT4, EXT5, EXT6, }; static struct intc_vect vectors[] __initdata = { INTC_IRQ(CF, IRQ_CF), INTC_IRQ(TP, IRQ_TP), INTC_IRQ(SCIF1, IRQ_SCIF1), INTC_IRQ(SCIF0, IRQ_SCIF0), INTC_IRQ(SMBUS, IRQ_SMBUS), INTC_IRQ(RTC, IRQ_RTC), INTC_IRQ(AX88796, IRQ_AX88796), INTC_IRQ(PSW, IRQ_PSW), INTC_IRQ(EXT1, IRQ_EXT1), INTC_IRQ(EXT2, IRQ_EXT2), INTC_IRQ(EXT4, IRQ_EXT4), INTC_IRQ(EXT5, IRQ_EXT5), INTC_IRQ(EXT6, IRQ_EXT6), }; static struct intc_mask_reg mask_registers[] __initdata = { { 0xa4000000, 0, 16, /* IRLMSK */ { SCIF0, SCIF1, RTC, 0, CF, 0, TP, SMBUS, 0, EXT6, EXT5, EXT4, EXT2, EXT1, PSW, AX88796 } }, }; static unsigned char irl2irq[HL_NR_IRL] __initdata = { 0, IRQ_CF, IRQ_TP, IRQ_SCIF1, IRQ_SCIF0, IRQ_SMBUS, IRQ_RTC, IRQ_EXT6, IRQ_EXT5, IRQ_EXT4, IRQ_EXT2, IRQ_EXT1, 0, IRQ_AX88796, IRQ_PSW, }; static DECLARE_INTC_DESC(intc_desc, "r7780mp", vectors, NULL, mask_registers, NULL, NULL); unsigned char * __init highlander_plat_irq_setup(void) { if ((__raw_readw(0xa4000700) & 0xf000) == 0x2000) { printk(KERN_INFO "Using r7780mp interrupt controller.\n"); register_intc_controller(&intc_desc); return irl2irq; } return NULL; }
// CrywolfAltar.h: interface for the CCrywolfAltar class. // ////////////////////////////////////////////////////////////////////// #if !defined(AFX_CRYWOLFALTAR_H__4D5C2361_CB6E_4B57_8509_CB4BD40525D7__INCLUDED_) #define AFX_CRYWOLFALTAR_H__4D5C2361_CB6E_4B57_8509_CB4BD40525D7__INCLUDED_ #if _MSC_VER > 1000 #pragma once #endif // _MSC_VER > 1000 #if (GS_CASTLE==1) #define MAX_CRYWOLF_ALTAR 5 #define MAX_ALTAR_CONTRACTS 2 #define CRYWOLF_ALTAR_CLASS_RANGE(x) ( ((x)< 205 )?FALSE:((x) > 209 )?FALSE:TRUE ) #define MIN_ELF_LEVEL_ALTAR 260 class CCrywolfAltarInfo { public: CCrywolfAltarInfo() { this->Reset(); } void Reset() { this->m_iAltarState = 0; this->m_iUserIndex = -1; this->m_iAltarIndex = -1; this->m_iContractCount = 0; this->m_dwAppliedContractTime =0 ; this->m_dwValidContractTime =0 ; this->m_dwLastValidContractTime =0 ; } int GetRemainContractCount() { int iRemainCount = MAX_ALTAR_CONTRACTS - this->m_iContractCount; return (iRemainCount<0)?0:iRemainCount; } void SetAltarState(int iState) { this->m_iAltarState = iState; } int GetAltarState() { return this->m_iAltarState; } void SetAltarIndex(int iAltarIndex) { this->m_iAltarIndex = iAltarIndex; } //int __thiscall GetAltarIndex(); //int __thiscall GetAltarUserIndex(); public: BYTE m_iAltarState; // 0 short m_iAltarIndex; // 4 short m_iUserIndex; // 8 BYTE m_iContractCount; // C int m_dwAppliedContractTime; // 10 int m_dwValidContractTime; // 14 int m_dwLastValidContractTime; // 18 }; class CCrywolfAltar { public: CCrywolfAltar(); virtual ~CCrywolfAltar(); void CrywolfAltarAct(int iIndex); void SetAltarObjIndex(int iClass, int iObjIndex); void SetAllAltarObjectIndex(); int GetAlatarNumber(int iClass); void SetAltarValidContract(int iAltarObjIndex, int iClass); BOOL CheckAltarValidContract(int iClass); int GetAltarState(int iClass); int GetAltarRemainContractCount(int iClass); BOOL SetAltarUserIndex(int iAltarObjIndex, int iClass, int iUserIndex); void ResetAltarUserIndex(int iAltarObjIndex, int iClass); int GetAltarUserIndex(int iClass); int GetContractedAltarCount(); int GetPriestHPSum(); int GetPriestMaxHPSum(); void ResetAllAltar(); void ResetAltar(int iClass); void SetAllAltarViewState(int iAltarState); void SetAltarViewState(int iClass, int iAltarState); private: CCrywolfAltarInfo m_AltarInfo[MAX_CRYWOLF_ALTAR]; // 4 }; extern CCrywolfAltar g_CrywolfNPC_Altar; #endif #endif // !defined(AFX_CRYWOLFALTAR_H__4D5C2361_CB6E_4B57_8509_CB4BD40525D7__INCLUDED_)
/* * File: debug.h * Author: Uhliarik Lubos * * Created on March 3, 2014, 4:02 PM */ #ifndef DEBUG_H #define DEBUG_H #ifdef DEBUG #define D(x) x #else #define D(x) #endif #endif /* DEBUG_H */
// kheap.c -- Kernel heap functions, also provides // a placement malloc() for use before the heap is // initialised. // Written for JamesM's kernel development tutorials. #include "kheap.h" #include "common.h" // end is defined in the linker script. extern u32int end; u32int placement_address = (u32int)&end; u32int kmalloc_int(u32int sz, int align, u32int *phys) { // This will eventually call malloc() on the kernel heap. // For now, though, we just assign memory at placement_address // and increment it by sz. Even when we've coded our kernel // heap, this will be useful for use before the heap is initialised. if (align == 1 && (placement_address & 0xFFFFF000) ) { // Align the placement address; placement_address &= 0xFFFFF000; placement_address += 0x1000; } if (phys) { *phys = placement_address; } u32int tmp = placement_address; placement_address += sz; return tmp; } u32int kmalloc_a(u32int sz) { return kmalloc_int(sz, 1, 0); } u32int kmalloc_p(u32int sz, u32int *phys) { return kmalloc_int(sz, 0, phys); } u32int kmalloc_ap(u32int sz, u32int *phys) { return kmalloc_int(sz, 1, phys); } u32int kmalloc(u32int sz) { return kmalloc_int(sz, 0, 0); }
/* cnode related routines for the coda kernel code (C) 1996 Peter Braam */ #include <linux/types.h> #include <linux/string.h> #include <linux/time.h> #include <linux/coda.h> #include <linux/coda_psdev.h> #include "coda_linux.h" static inline int coda_fideq(struct CodaFid *fid1, struct CodaFid *fid2) { return memcmp(fid1, fid2, sizeof(*fid1)) == 0; } static const struct inode_operations coda_symlink_inode_operations = { .readlink = generic_readlink, .follow_link = page_follow_link_light, .put_link = page_put_link, .setattr = coda_setattr, }; /* cnode.c */ static void coda_fill_inode(struct inode *inode, struct coda_vattr *attr) { coda_vattr_to_iattr(inode, attr); if (S_ISREG(inode->i_mode)) { inode->i_op = &coda_file_inode_operations; inode->i_fop = &coda_file_operations; } else if (S_ISDIR(inode->i_mode)) { inode->i_op = &coda_dir_inode_operations; inode->i_fop = &coda_dir_operations; } else if (S_ISLNK(inode->i_mode)) { inode->i_op = &coda_symlink_inode_operations; inode->i_data.a_ops = &coda_symlink_aops; inode->i_mapping = &inode->i_data; } else init_special_inode(inode, inode->i_mode, huge_decode_dev(attr->va_rdev)); } static int coda_test_inode(struct inode *inode, void *data) { struct CodaFid *fid = (struct CodaFid *)data; struct coda_inode_info *cii = ITOC(inode); return coda_fideq(&cii->c_fid, fid); } static int coda_set_inode(struct inode *inode, void *data) { struct CodaFid *fid = (struct CodaFid *)data; struct coda_inode_info *cii = ITOC(inode); cii->c_fid = *fid; return 0; } struct inode * coda_iget(struct super_block * sb, struct CodaFid * fid, struct coda_vattr * attr) { struct inode *inode; struct coda_inode_info *cii; unsigned long hash = coda_f2i(fid); inode = iget5_locked(sb, hash, coda_test_inode, coda_set_inode, fid); if (!inode) return ERR_PTR(-ENOMEM); if (inode->i_state & I_NEW) { cii = ITOC(inode); /* we still need to set i_ino for things like stat(2) */ inode->i_ino = hash; /* inode is locked and unique, no need to grab cii->c_lock */ cii->c_mapcount = 0; unlock_new_inode(inode); } /* always replace the attributes, type might have changed */ coda_fill_inode(inode, attr); return inode; } /* this is effectively coda_iget: - get attributes (might be cached) - get the inode for the fid using vfs iget - link the two up if this is needed - fill in the attributes */ struct inode *coda_cnode_make(struct CodaFid *fid, struct super_block *sb) { struct coda_vattr attr; struct inode *inode; int error; /* We get inode numbers from Venus -- see venus source */ error = venus_getattr(sb, fid, &attr); if (error) return ERR_PTR(error); inode = coda_iget(sb, fid, &attr); if (IS_ERR(inode)) printk("coda_cnode_make: coda_iget failed\n"); return inode; } /* Although we treat Coda file identifiers as immutable, there is one * special case for files created during a disconnection where they may * not be globally unique. When an identifier collision is detected we * first try to flush the cached inode from the kernel and finally * resort to renaming/rehashing in-place. Userspace remembers both old * and new values of the identifier to handle any in-flight upcalls. * The real solution is to use globally unique UUIDs as identifiers, but * retrofitting the existing userspace code for this is non-trivial. */ void coda_replace_fid(struct inode *inode, struct CodaFid *oldfid, struct CodaFid *newfid) { struct coda_inode_info *cii = ITOC(inode); unsigned long hash = coda_f2i(newfid); BUG_ON(!coda_fideq(&cii->c_fid, oldfid)); /* replace fid and rehash inode */ /* XXX we probably need to hold some lock here! */ remove_inode_hash(inode); cii->c_fid = *newfid; inode->i_ino = hash; __insert_inode_hash(inode, hash); } /* convert a fid to an inode. */ struct inode *coda_fid_to_inode(struct CodaFid *fid, struct super_block *sb) { struct inode *inode; unsigned long hash = coda_f2i(fid); if ( !sb ) { printk("coda_fid_to_inode: no sb!\n"); return NULL; } inode = ilookup5(sb, hash, coda_test_inode, fid); if ( !inode ) return NULL; /* we should never see newly created inodes because we intentionally * fail in the initialization callback */ BUG_ON(inode->i_state & I_NEW); return inode; } /* the CONTROL inode is made without asking attributes from Venus */ struct inode *coda_cnode_makectl(struct super_block *sb) { struct inode *inode = new_inode(sb); if (inode) { inode->i_ino = CTL_INO; inode->i_op = &coda_ioctl_inode_operations; inode->i_fop = &coda_ioctl_operations; inode->i_mode = 0444; return inode; } return ERR_PTR(-ENOMEM); }
// // ViewController.h // Pra-tom猫 // // Created by chan on 15/5/19. // Copyright (c) 2015年 chan. All rights reserved. // #import <UIKit/UIKit.h> @interface ViewController : UIViewController @end
static float xsav,ysav; static float (*nrfunc)(float,float,float); float quad3d(float (*func)(float, float, float), float x1, float x2) { float qgaus(float (*func)(float), float a, float b); float f1(float x); nrfunc=func; return qgaus(f1,x1,x2); } float f1(float x) { float qgaus(float (*func)(float), float a, float b); float f2(float y); float yy1(float),yy2(float); xsav=x; return qgaus(f2,yy1(x),yy2(x)); } float f2(float y) { float qgaus(float (*func)(float), float a, float b); float f3(float z); float z1(float,float),z2(float,float); ysav=y; return qgaus(f3,z1(xsav,y),z2(xsav,y)); } float f3(float z) { return (*nrfunc)(xsav,ysav,z); }
/* * arch/arm/include/asm/mach/mmc.h */ #ifndef ASMARM_MACH_MMC_H #define ASMARM_MACH_MMC_H #include <linux/mmc/host.h> #include <linux/mmc/card.h> #include <linux/mmc/sdio_func.h> #include <mach/gpio.h> #include <mach/msm_bus.h> #define SDC_DAT1_DISABLE 0 #define SDC_DAT1_ENABLE 1 #define SDC_DAT1_ENWAKE 2 #define SDC_DAT1_DISWAKE 3 struct embedded_sdio_data { struct sdio_cis cis; struct sdio_cccr cccr; struct sdio_embedded_func *funcs; int num_funcs; }; /* This structure keeps information per regulator */ struct msm_mmc_reg_data { /* voltage regulator handle */ struct regulator *reg; /* regulator name */ const char *name; /* voltage level to be set */ unsigned int low_vol_level; unsigned int high_vol_level; /* Load values for low power and high power mode */ unsigned int lpm_uA; unsigned int hpm_uA; /* * is set voltage supported for this regulator? * false => set voltage is not supported * true => set voltage is supported * * Some regulators (like gpio-regulators, LVS (low voltage swtiches) * PMIC regulators) dont have the capability to call * regulator_set_voltage or regulator_set_optimum_mode * Use this variable to indicate if its a such regulator or not */ bool set_voltage_sup; /* is this regulator enabled? */ bool is_enabled; /* is this regulator needs to be always on? */ bool always_on; /* is low power mode setting required for this regulator? */ bool lpm_sup; }; /* * This structure keeps information for all the * regulators required for a SDCC slot. */ struct msm_mmc_slot_reg_data { struct msm_mmc_reg_data *vdd_data; /* keeps VDD/VCC regulator info */ struct msm_mmc_reg_data *vccq_data; /* keeps VCCQ regulator info */ struct msm_mmc_reg_data *vddp_data; /* keeps VDD Pad regulator info */ }; struct msm_mmc_gpio { u32 no; const char *name; bool is_always_on; bool is_enabled; }; struct msm_mmc_gpio_data { struct msm_mmc_gpio *gpio; u8 size; }; struct msm_mmc_pad_pull { enum msm_tlmm_pull_tgt no; u32 val; }; struct msm_mmc_pad_pull_data { struct msm_mmc_pad_pull *on; struct msm_mmc_pad_pull *off; u8 size; }; struct msm_mmc_pad_drv { enum msm_tlmm_hdrive_tgt no; u32 val; }; struct msm_mmc_pad_drv_data { struct msm_mmc_pad_drv *on; struct msm_mmc_pad_drv *off; u8 size; }; struct msm_mmc_pad_data { struct msm_mmc_pad_pull_data *pull; struct msm_mmc_pad_drv_data *drv; }; struct msm_mmc_pin_data { /* * = 1 if controller pins are using gpios * = 0 if controller has dedicated MSM pads */ u8 is_gpio; u8 cfg_sts; struct msm_mmc_gpio_data *gpio_data; struct msm_mmc_pad_data *pad_data; }; struct msm_mmc_bus_voting_data { struct msm_bus_scale_pdata *use_cases; unsigned int *bw_vecs; unsigned int bw_vecs_size; }; struct mmc_platform_data { unsigned int ocr_mask; /* available voltages */ int built_in; /* built-in device flag */ int card_present; /* card detect state */ u32 (*translate_vdd)(struct device *, unsigned int); unsigned int (*status)(struct device *); struct embedded_sdio_data *embedded_sdio; int (*register_status_notify)(void (*callback)(int card_present, void *dev_id), void *dev_id); /* * XPC controls the maximum current in the * default speed mode of SDXC card. */ unsigned int *slot_type; unsigned int xpc_cap; /* Supported UHS-I Modes */ unsigned int uhs_caps; void (*sdio_lpm_gpio_setup)(struct device *, unsigned int); unsigned int status_irq; unsigned int status_gpio; /* Indicates the polarity of the GPIO line when card is inserted */ bool is_status_gpio_active_low; unsigned int sdiowakeup_irq; unsigned long irq_flags; unsigned long mmc_bus_width; int (*wpswitch) (struct device *); unsigned int msmsdcc_fmin; unsigned int msmsdcc_fmid; unsigned int msmsdcc_fmax; bool nonremovable; bool pclk_src_dfab; int (*cfg_mpm_sdiowakeup)(struct device *, unsigned); unsigned int wpswitch_gpio; unsigned char wpswitch_polarity; struct msm_mmc_slot_reg_data *vreg_data; int is_sdio_al_client; unsigned int *sup_clk_table; unsigned char sup_clk_cnt; struct msm_mmc_pin_data *pin_data; bool disable_bam; bool disable_runtime_pm; bool disable_cmd23; u32 swfi_latency; struct msm_mmc_bus_voting_data *msm_bus_voting_data; }; #endif
/* src/vm/jit/x86_64/md-emit.h - machine dependent emit function prototypes Copyright (C) 1996-2005, 2006 R. Grafl, A. Krall, C. Kruegel, C. Oates, R. Obermaisser, M. Platter, M. Probst, S. Ring, E. Steiner, C. Thalinger, D. Thuernbeck, P. Tomsich, C. Ullrich, J. Wenninger, Institut f. Computersprachen - TU Wien This file is part of CACAO. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. Contact: cacao@cacaojvm.org Authors: Christian Thalinger Changes: $Id: emit.h 7848 2007-05-01 21:40:26Z pm $ */ #ifndef _MD_EMIT_H #define _MD_EMIT_H #include "vm/types.h" /* macros to create code ******************************************************/ s4 emit_load_s1_notzero(jitdata *jd, instruction *iptr, s4 tempreg); s4 emit_load_s2_notzero(jitdata *jd, instruction *iptr, s4 tempreg); s4 emit_load_s1_but(jitdata *jd, instruction *iptr, s4 tempreg, s4 notreg); s4 emit_load_s2_but(jitdata *jd, instruction *iptr, s4 tempreg, s4 notreg); /* Allocate an even-odd register pair for the destination of an instruction. * */ s4 emit_alloc_dst_even_odd(jitdata *jd, instruction *iptr, s4 htmpreg, s4 ltmpreg, s4 breg); void emit_restore_dst_even_odd(jitdata *jd, instruction *iptr, s4 htmpreg, s4 ltmpreg, s4 breg); /* If the destination operand is in a register, different than * dtmpreg, a register copy is emitted. */ void emit_copy_dst(jitdata *jd, instruction *iptr, s4 dtmpreg); /* Emits code to recalculate the PV (procedure vector) after a subroutine call. */ void emit_restore_pv(codegendata *cd); #endif /* _MD_EMIT_H */ /* * These are local overrides for various environment variables in Emacs. * Please do not remove this and leave it at the end of the file, where * Emacs will automagically detect them. * --------------------------------------------------------------------- * Local variables: * mode: c * indent-tabs-mode: t * c-basic-offset: 4 * tab-width: 4 * End: */
// Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef NET_CERT_X509_UTIL_MAC_H_ #define NET_CERT_X509_UTIL_MAC_H_ #include <CoreFoundation/CFArray.h> #include <Security/Security.h> #include <string> #include "base/basictypes.h" #include "net/base/net_export.h" namespace net { namespace x509_util { OSStatus NET_EXPORT CreateSSLClientPolicy(SecPolicyRef* policy); OSStatus NET_EXPORT CreateSSLServerPolicy(const std::string& hostname, SecPolicyRef* policy); OSStatus NET_EXPORT CreateBasicX509Policy(SecPolicyRef* policy); OSStatus NET_EXPORT CreateRevocationPolicies(bool enable_revocation_checking, bool enable_ev_checking, CFMutableArrayRef policies); class CSSMFieldValue { public: CSSMFieldValue(); CSSMFieldValue(CSSM_CL_HANDLE cl_handle, const CSSM_OID* oid, CSSM_DATA_PTR field); ~CSSMFieldValue(); CSSM_OID_PTR oid() const { return oid_; } CSSM_DATA_PTR field() const { return field_; } template <typename T> const T* GetAs() const { if (!field_ || field_->Length < sizeof(T)) return NULL; return reinterpret_cast<const T*>(field_->Data); } void Reset(CSSM_CL_HANDLE cl_handle, CSSM_OID_PTR oid, CSSM_DATA_PTR field); private: CSSM_CL_HANDLE cl_handle_; CSSM_OID_PTR oid_; CSSM_DATA_PTR field_; DISALLOW_COPY_AND_ASSIGN(CSSMFieldValue); }; class CSSMCachedCertificate { public: CSSMCachedCertificate(); ~CSSMCachedCertificate(); OSStatus Init(SecCertificateRef os_cert_handle); OSStatus GetField(const CSSM_OID* field_oid, CSSMFieldValue* field) const; private: CSSM_CL_HANDLE cl_handle_; CSSM_HANDLE cached_cert_handle_; }; } } #endif
/* ** Zabbix ** Copyright (C) 2001-2014 Zabbix SIA ** ** 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. **/ #include "common.h" #include "sysinfo.h" #include "zbxregexp.h" #define DO_SUM 0 #define DO_MAX 1 #define DO_MIN 2 #define DO_AVG 3 int PROC_MEM(AGENT_REQUEST *request, AGENT_RESULT *result) { DIR *dir; int proc; struct dirent *entries; zbx_stat_t buf; struct passwd *usrinfo; struct prpsinfo psinfo; char filename[MAX_STRING_LEN]; char *procname, *proccomm, *param; double memsize = -1; int pgsize = getpagesize(); int proccount = 0, do_task; pid_t curr_pid = getpid(); if (4 < request->nparam) return SYSINFO_RET_FAIL; procname = get_rparam(request, 0); param = get_rparam(request, 1); if (NULL != param && '\0' != *param) { if (NULL == (usrinfo = getpwnam(param))) /* incorrect user name */ return SYSINFO_RET_FAIL; } else usrinfo = NULL; param = get_rparam(request, 2); if (NULL == param || '\0' == *param || 0 == strcmp(param, "sum")) /* default parameter */ do_task = DO_SUM; else if (0 == strcmp(param, "avg")) do_task = DO_AVG; else if (0 == strcmp(param, "max")) do_task = DO_MAX; else if (0 == strcmp(param, "min")) do_task = DO_MIN; else return SYSINFO_RET_FAIL; proccomm = get_rparam(request, 3); if (NULL == (dir = opendir("/proc"))) return SYSINFO_RET_FAIL; while (NULL != (entries = readdir(dir))) { strscpy(filename, "/proc/"); zbx_strlcat(filename, entries->d_name, MAX_STRING_LEN); if (0 == zbx_stat(filename, &buf)) { proc = open(filename, O_RDONLY); if (-1 == proc) goto lbl_skip_procces; if (-1 == ioctl(proc, PIOCPSINFO, &psinfo)) goto lbl_skip_procces; /* Self process information. It leads to incorrect results for proc_cnt[zabbix_agentd] */ if (psinfo.pr_pid == curr_pid) goto lbl_skip_procces; if (NULL != procname && '\0' != *procname) if (0 == strcmp(procname, psinfo.pr_fname)) goto lbl_skip_procces; if (NULL != usrinfo) if (usrinfo->pw_uid != psinfo.pr_uid) goto lbl_skip_procces; if (NULL != proccomm && '\0' != *proccomm) if (NULL == zbx_regexp_match(psinfo.pr_psargs, proccomm, NULL)) goto lbl_skip_procces; proccount++; if (0 > memsize) /* First inicialization */ { memsize = (double) (psinfo.pr_rssize * pgsize); } else { if (DO_MAX == do_task) memsize = MAX(memsize, (double) (psinfo.pr_rssize * pgsize)); else if (DO_MIN == do_task) memsize = MIN(memsize, (double) (psinfo.pr_rssize * pgsize)); else /* SUM */ memsize += (double) (psinfo.pr_rssize * pgsize); } lbl_skip_procces: if (proc) close(proc); } } closedir(dir); if (0 > memsize) { /* incorrect process name */ memsize = 0; } if (DO_AVG == do_task) { SET_DBL_RESULT(result, proccount == 0 ? 0 : ((double)memsize/(double)proccount)); } else { SET_UI64_RESULT(result, memsize); } return SYSINFO_RET_OK; } int PROC_NUM(AGENT_REQUEST *request, AGENT_RESULT *result) { DIR *dir; int proc; struct dirent *entries; zbx_stat_t buf; struct passwd *usrinfo; struct prpsinfo psinfo; char filename[MAX_STRING_LEN]; char *procname, *proccomm, *param; int proccount = 0, zbx_proc_stat; pid_t curr_pid = getpid(); if (4 < request->nparam) return SYSINFO_RET_FAIL; procname = get_rparam(request, 0); param = get_rparam(request, 1); if (NULL != param && '\0' != *param) { if (NULL == (usrinfo = getpwnam(param))) /* incorrect user name */ return SYSINFO_RET_FAIL; } else usrinfo = NULL; param = get_rparam(request, 2); if (NULL == param || '\0' == *param || 0 == strcmp(param, "all")) zbx_proc_stat = -1; else if (0 == strcmp(param, "run")) zbx_proc_stat = PR_SRUN; else if (0 == strcmp(param, "sleep")) zbx_proc_stat = PR_SSLEEP; else if (0 == strcmp(param, "zomb")) zbx_proc_stat = PR_SZOMB; proccomm = get_rparam(request, 3); if (NULL == (dir = opendir("/proc"))) return SYSINFO_RET_FAIL; while(NULL != (entries=readdir(dir))) { strscpy(filename, "/proc/"); zbx_strlcat(filename, entries->d_name,MAX_STRING_LEN); if (0 == zbx_stat(filename, &buf)) { proc = open(filename, O_RDONLY); if (-1 == proc) goto lbl_skip_procces; if (-1 == ioctl(proc,PIOCPSINFO,&psinfo)) goto lbl_skip_procces; /* Self process information. It leads to incorrect results for proc_cnt[zabbix_agentd] */ if (psinfo.pr_pid == curr_pid) goto lbl_skip_procces; if (NULL != procname && '\0' != *procname) if (0 != strcmp(procname, psinfo.pr_fname)) goto lbl_skip_procces; if (NULL != usrinfo) if (usrinfo->pw_uid != psinfo.pr_uid) goto lbl_skip_procces; if (-1 != zbx_proc_stat) if (psinfo.pr_sname != zbx_proc_stat) goto lbl_skip_procces; if (NULL != proccomm && '\0' != *proccomm) if (NULL == zbx_regexp_match(psinfo.pr_psargs, proccomm, NULL)) goto lbl_skip_procces; proccount++; lbl_skip_procces: if (proc) close(proc); } } closedir(dir); SET_UI64_RESULT(result, proccount); return SYSINFO_RET_OK; }
/* $Id: divamnt.c,v 1.1.1.1 2011/08/19 02:08:59 ronald Exp $ * * Driver for Eicon DIVA Server ISDN cards. * Maint module * * Copyright 2000-2003 by Armin Schindler (mac@melware.de) * Copyright 2000-2003 Cytronics & Melware (info@melware.de) * * This software may be used and distributed according to the terms * of the GNU General Public License, incorporated herein by reference. */ #include <linux/module.h> #include <linux/init.h> #include <linux/kernel.h> #include <linux/poll.h> #include <linux/smp_lock.h> #include <asm/uaccess.h> #include "platform.h" #include "di_defs.h" #include "divasync.h" #include "debug_if.h" static char *main_revision = "$Revision: 1.1.1.1 $"; static int major; MODULE_DESCRIPTION("Maint driver for Eicon DIVA Server cards"); MODULE_AUTHOR("Cytronics & Melware, Eicon Networks"); MODULE_SUPPORTED_DEVICE("DIVA card driver"); MODULE_LICENSE("GPL"); static int buffer_length = 128; module_param(buffer_length, int, 0); static unsigned long diva_dbg_mem = 0; module_param(diva_dbg_mem, ulong, 0); static char *DRIVERNAME = "Eicon DIVA - MAINT module (http://www.melware.net)"; static char *DRIVERLNAME = "diva_mnt"; static char *DEVNAME = "DivasMAINT"; char *DRIVERRELEASE_MNT = "2.0"; static wait_queue_head_t msgwaitq; static unsigned long opened; static struct timeval start_time; extern int mntfunc_init(int *, void **, unsigned long); extern void mntfunc_finit(void); extern int maint_read_write(void __user *buf, int count); /* * helper functions */ static char *getrev(const char *revision) { char *rev; char *p; if ((p = strchr(revision, ':'))) { rev = p + 2; p = strchr(rev, '$'); *--p = 0; } else rev = "1.0"; return rev; } /* * kernel/user space copy functions */ int diva_os_copy_to_user(void *os_handle, void __user *dst, const void *src, int length) { return (copy_to_user(dst, src, length)); } int diva_os_copy_from_user(void *os_handle, void *dst, const void __user *src, int length) { return (copy_from_user(dst, src, length)); } /* * get time */ void diva_os_get_time(dword * sec, dword * usec) { struct timeval tv; do_gettimeofday(&tv); if (tv.tv_sec > start_time.tv_sec) { if (start_time.tv_usec > tv.tv_usec) { tv.tv_sec--; tv.tv_usec += 1000000; } *sec = (dword) (tv.tv_sec - start_time.tv_sec); *usec = (dword) (tv.tv_usec - start_time.tv_usec); } else if (tv.tv_sec == start_time.tv_sec) { *sec = 0; if (start_time.tv_usec < tv.tv_usec) { *usec = (dword) (tv.tv_usec - start_time.tv_usec); } else { *usec = 0; } } else { *sec = (dword) tv.tv_sec; *usec = (dword) tv.tv_usec; } } /* * device node operations */ static unsigned int maint_poll(struct file *file, poll_table * wait) { unsigned int mask = 0; poll_wait(file, &msgwaitq, wait); mask = POLLOUT | POLLWRNORM; if (file->private_data || diva_dbg_q_length()) { mask |= POLLIN | POLLRDNORM; } return (mask); } static int maint_open(struct inode *ino, struct file *filep) { int ret; lock_kernel(); /* only one open is allowed, so we test it atomically */ if (test_and_set_bit(0, &opened)) ret = -EBUSY; else { filep->private_data = NULL; ret = nonseekable_open(ino, filep); } unlock_kernel(); return ret; } static int maint_close(struct inode *ino, struct file *filep) { if (filep->private_data) { diva_os_free(0, filep->private_data); filep->private_data = NULL; } /* clear 'used' flag */ clear_bit(0, &opened); return (0); } static ssize_t divas_maint_write(struct file *file, const char __user *buf, size_t count, loff_t * ppos) { return (maint_read_write((char __user *) buf, (int) count)); } static ssize_t divas_maint_read(struct file *file, char __user *buf, size_t count, loff_t * ppos) { return (maint_read_write(buf, (int) count)); } static const struct file_operations divas_maint_fops = { .owner = THIS_MODULE, .llseek = no_llseek, .read = divas_maint_read, .write = divas_maint_write, .poll = maint_poll, .open = maint_open, .release = maint_close }; static void divas_maint_unregister_chrdev(void) { unregister_chrdev(major, DEVNAME); } static int DIVA_INIT_FUNCTION divas_maint_register_chrdev(void) { if ((major = register_chrdev(0, DEVNAME, &divas_maint_fops)) < 0) { printk(KERN_ERR "%s: failed to create /dev entry.\n", DRIVERLNAME); return (0); } return (1); } /* * wake up reader */ void diva_maint_wakeup_read(void) { wake_up_interruptible(&msgwaitq); } /* * Driver Load */ static int DIVA_INIT_FUNCTION maint_init(void) { char tmprev[50]; int ret = 0; void *buffer = NULL; do_gettimeofday(&start_time); init_waitqueue_head(&msgwaitq); printk(KERN_INFO "%s\n", DRIVERNAME); printk(KERN_INFO "%s: Rel:%s Rev:", DRIVERLNAME, DRIVERRELEASE_MNT); strcpy(tmprev, main_revision); printk("%s Build: %s \n", getrev(tmprev), DIVA_BUILD); if (!divas_maint_register_chrdev()) { ret = -EIO; goto out; } if (!(mntfunc_init(&buffer_length, &buffer, diva_dbg_mem))) { printk(KERN_ERR "%s: failed to connect to DIDD.\n", DRIVERLNAME); divas_maint_unregister_chrdev(); ret = -EIO; goto out; } printk(KERN_INFO "%s: trace buffer = %p - %d kBytes, %s (Major: %d)\n", DRIVERLNAME, buffer, (buffer_length / 1024), (diva_dbg_mem == 0) ? "internal" : "external", major); out: return (ret); } /* ** Driver Unload */ static void DIVA_EXIT_FUNCTION maint_exit(void) { divas_maint_unregister_chrdev(); mntfunc_finit(); printk(KERN_INFO "%s: module unloaded.\n", DRIVERLNAME); } module_init(maint_init); module_exit(maint_exit);
/* SDL - Simple DirectMedia Layer Copyright (C) 1997-2010 Sam Lantinga This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA Sam Lantinga slouken@libsdl.org */ #include "SDL_config.h" /* Useful functions and variables from SDL_joystick.c */ #include "SDL_joystick.h" /* The number of available joysticks on the system */ extern Uint8 SDL_numjoysticks; /* Initialization and shutdown functions */ extern int SDL_JoystickInit(void); extern void SDL_JoystickQuit(void); /* Internal event queueing functions */ extern int SDL_PrivateJoystickAxis(SDL_Joystick * joystick, Uint8 axis, Sint16 value); extern int SDL_PrivateJoystickBall(SDL_Joystick * joystick, Uint8 ball, Sint16 xrel, Sint16 yrel); extern int SDL_PrivateJoystickHat(SDL_Joystick * joystick, Uint8 hat, Uint8 value); extern int SDL_PrivateJoystickButton(SDL_Joystick * joystick, Uint8 button, Uint8 state); /* Internal sanity checking functions */ extern int SDL_PrivateJoystickValid(SDL_Joystick ** joystick); /* vi: set ts=4 sw=4 expandtab: */
/* FILE $Id: trrtypefunc.h 166 2009-06-05 22:10:35Z Dylan $ PURPOSE Non-schema dependent trrtype.c expansion. AUTHOR GPL License applies, see www.fsf.org for details See LICENSE file in this distribution (C) 2001-2009 Gary Wallis and Hugo Urquiza. */ void tRRTypeNavList(void); void ExtProcesstRRTypeVars(pentry entries[], int x) { /* register int i; for(i=0;i<x;i++) { } */ }//void ExtProcesstRRTypeVars(pentry entries[], int x) void ExttRRTypeCommands(pentry entries[], int x) { if(!strcmp(gcFunction,"tRRTypeTools")) { if(!strcmp(gcCommand,LANG_NB_NEW)) { if(guPermLevel>=12) { ProcesstRRTypeVars(entries,x); //Check global conditions for new record here guMode=2000; tRRType(LANG_NB_CONFIRMNEW); } else tRRType("<blink>Error</blink>: Denied by permissions settings"); } else if(!strcmp(gcCommand,LANG_NB_CONFIRMNEW)) { if(guPermLevel>=12) { ProcesstRRTypeVars(entries,x); //Check entries here uRRType=0; uCreatedBy=guLoginClient; uOwner=guCompany; uModBy=0;//Never modified NewtRRType(0); } else tRRType("<blink>Error</blink>: Denied by permissions settings"); } else if(!strcmp(gcCommand,LANG_NB_DELETE)) { ProcesstRRTypeVars(entries,x); if(uAllowDel(uOwner,uCreatedBy)) { guMode=2001; tRRType(LANG_NB_CONFIRMDEL); } else tRRType("<blink>Error</blink>: Denied by permissions settings"); } else if(!strcmp(gcCommand,LANG_NB_CONFIRMDEL)) { ProcesstRRTypeVars(entries,x); if(uAllowDel(uOwner,uCreatedBy)) { guMode=5; DeletetRRType(); } else tRRType("<blink>Error</blink>: Denied by permissions settings"); } else if(!strcmp(gcCommand,LANG_NB_MODIFY)) { ProcesstRRTypeVars(entries,x); if(uAllowMod(uOwner,uCreatedBy)) { guMode=2002; tRRType(LANG_NB_CONFIRMMOD); } else tRRType("<blink>Error</blink>: Denied by permissions settings"); } else if(!strcmp(gcCommand,LANG_NB_CONFIRMMOD)) { ProcesstRRTypeVars(entries,x); if(uAllowMod(uOwner,uCreatedBy)) { uModBy=guLoginClient; ModtRRType(); } else tRRType("<blink>Error</blink>: Denied by permissions settings"); } } }//void ExttRRTypeCommands(pentry entries[], int x) void ExttRRTypeButtons(void) { OpenFieldSet("Aux Panel",100); switch(guMode) { case 2000: printf("Enter required data<br>"); printf(LANG_NBB_CONFIRMNEW); printf("<br>\n"); break; case 2001: printf(LANG_NBB_CONFIRMDEL); printf("<br>\n"); break; case 2002: printf("Review record data<br>"); printf(LANG_NBB_CONFIRMMOD); printf("<br>\n"); break; default: printf("<p><u>tRRTypeNavList</u><br>\n"); tRRTypeNavList(); } CloseFieldSet(); }//void ExttRRTypeButtons(void) void ExttRRTypeAuxTable(void) { }//void ExttRRTypeAuxTable(void) void ExttRRTypeGetHook(entry gentries[], int x) { register int i; for(i=0;i<x;i++) { if(!strcmp(gentries[i].name,"uRRType")) { sscanf(gentries[i].val,"%u",&uRRType); guMode=6; } } tRRType(""); }//void ExttRRTypeGetHook(entry gentries[], int x) void ExttRRTypeSelect(void) { ExtSelect("tRRType",VAR_LIST_tRRType,0); }//void ExttRRTypeSelect(void) void ExttRRTypeSelectRow(void) { ExtSelectRow("tRRType",VAR_LIST_tRRType,uRRType); }//void ExttRRTypeSelectRow(void) void ExttRRTypeListSelect(void) { char cCat[512]; ExtListSelect("tRRType",VAR_LIST_tRRType); //Changes here must be reflected below in ExttRRTypeListFilter() if(!strcmp(gcFilter,"uRRType")) { sscanf(gcCommand,"%u",&uRRType); if(guPermLevel<10) strcat(gcQuery," AND "); else strcat(gcQuery," WHERE "); sprintf(cCat,"tRRType.uRRType=%u ORDER BY uRRType",uRRType); strcat(gcQuery,cCat); } else if(1) { //None NO FILTER strcpy(gcFilter,"None"); strcat(gcQuery," ORDER BY uRRType"); } }//void ExttRRTypeListSelect(void) void ExttRRTypeListFilter(void) { //Filter printf("<td align=right >Select "); printf("<select name=gcFilter>"); if(strcmp(gcFilter,"uRRType")) printf("<option>uRRType</option>"); else printf("<option selected>uRRType</option>"); if(strcmp(gcFilter,"None")) printf("<option>None</option>"); else printf("<option selected>None</option>"); printf("</select>"); }//void ExttRRTypeListFilter(void) void ExttRRTypeNavBar(void) { printf(LANG_NBB_SKIPFIRST); printf(LANG_NBB_SKIPBACK); printf(LANG_NBB_SEARCH); if(guPermLevel>=10 && !guListMode) printf(LANG_NBB_NEW); if(uAllowMod(uOwner,uCreatedBy)) printf(LANG_NBB_MODIFY); if(uAllowDel(uOwner,uCreatedBy)) printf(LANG_NBB_DELETE); if(uOwner) printf(LANG_NBB_LIST); printf(LANG_NBB_SKIPNEXT); printf(LANG_NBB_SKIPLAST); printf("&nbsp;&nbsp;&nbsp;\n"); }//void ExttRRTypeNavBar(void) void tRRTypeNavList(void) { MYSQL_RES *res; MYSQL_ROW field; ExtSelect("tRRType","tRRType.uRRType,tRRType.cLabel",20); mysql_query(&gMysql,gcQuery); if(mysql_errno(&gMysql)) { printf("%s",mysql_error(&gMysql)); return; } res=mysql_store_result(&gMysql); while((field=mysql_fetch_row(res))) { printf("<a class=darkLink href=iDNS.cgi?gcFunction=tRRType&uRRType=%s>%s</a><br>\n",field[0],field[1]); } mysql_free_result(res); }//void tRRTypeNavList(void) // vim:tw=78 //perlSAR patch1
/* * AudioPulseAudio.h - device-class which implements PulseAudio-output * * Copyright (c) 2008-2009 Tobias Doerffel <tobydox/at/users.sourceforge.net> * * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * * You should have received a copy of the GNU General Public * License along with this program (see COPYING); if not, write to the * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301 USA. * */ #ifndef _AUDIO_PULSEAUDIO_H #define _AUDIO_PULSEAUDIO_H #include "lmmsconfig.h" #ifdef LMMS_HAVE_PULSEAUDIO #include <pulse/pulseaudio.h> #include "AudioDevice.h" class LcdSpinBox; class QLineEdit; class AudioPulseAudio : public AudioDevice, public QThread { public: AudioPulseAudio( bool & _success_ful, Mixer* mixer ); virtual ~AudioPulseAudio(); inline static QString name() { return QT_TRANSLATE_NOOP( "setupWidget", "PulseAudio (bad latency!)" ); } static QString probeDevice(); class setupWidget : public AudioDevice::setupWidget { public: setupWidget( QWidget * _parent ); virtual ~setupWidget(); virtual void saveSettings(); private: QLineEdit * m_device; LcdSpinBox * m_channels; } ; void streamWriteCallback( pa_stream * s, size_t length ); pa_stream * m_s; pa_sample_spec m_sampleSpec; private: virtual void startProcessing(); virtual void stopProcessing(); virtual void applyQualitySettings(); virtual void run(); volatile bool m_quit; bool m_convertEndian; } ; #endif #endif
#ifndef AST_NODE_H_ #define AST_NODE_H_ #include <cstdint> #include <cstring> #include <vector> #include "front_end/location.hh" #include "syntax_tree/ast_visitor.h" #include "syntax_tree/ast_node.pb.h" #include "symbol_table/data_type.h" namespace flang { #define INHERIT_AST_NODE(Derived, Base, NodeType) \ public: \ Base* toBaseNode() { return dynamic_cast<Base*>(this); } \ bool accept(ASTVisitor* visitor) override { \ return traverse<Derived>(visitor); \ } \ ASTNodeType getNodeType() const override { \ return NodeType; \ } class Symbol; struct ASTAttribute { ASTAttribute() : symbol(nullptr) { } Symbol* symbol; DataType* data_type; ASTValue value; }; /** @breif Abstract syntax tree node. */ class ASTNode { public: ASTNode() : parent_(nullptr) {} virtual ~ASTNode() {} virtual bool accept(ASTVisitor* visitor) { return traverse<ASTNode>(visitor); } // @brief Transfer 'this' pointer to base class pointer type. // // @return Base class type this pointer. Return nullptr if this class // doesn't inherit any class. ASTNode* toBaseNode() { return nullptr; } protected: /** * @brief Traverse this ast node. * * 1. Call visitor.visit() on this node over the inheritance hierarchy. * 2. Traverse the child nodes. * 3. Call visitor.endVisit() on this node. * * @return Return whether traverse this node successfully. */ template <typename Derived> bool traverse(ASTVisitor* visitor) { Derived* derived = dynamic_cast<Derived*>(this); if (!ASTNode::visitFromTop(visitor, derived)) { return false; } ASTNodeList child_nodes; if (getChildNodes(&child_nodes)) { for (auto* child : child_nodes) { if(!child->accept(visitor)) { return false; } } } return ASTNode::endVisitFromTop(visitor, derived); } template <typename Derived> static bool visitFromTop(ASTVisitor* visitor, Derived* derived) { if (visitor->isVisitFromTop()) { auto* base = derived->toBaseNode(); if (base) { if (!visitFromTop(visitor, base)) { return false; } } } return visitor->visit(derived); } template <typename Derived> static bool endVisitFromTop(ASTVisitor* visitor, Derived* derived) { if (visitor->isEndVisitFromTop()) { auto* base = derived->toBaseNode(); if (base) { if (!endVisitFromTop(visitor, base)) { return false; } } } return visitor->endVisit(derived); } public: virtual ASTNodeType getNodeType() const = 0; std::string getNodeTypeName() const { return ASTNodeType_Name(getNodeType()); } /** * @brief Get this pointer as an implementation of ASTNode interface. * @return T pointer if this instance's type is T. Otherwise check error. */ template <typename T> T* getImpl() const { T* impl = dynamic_cast<T*>(const_cast<ASTNode*>(this)); CHECK_MSG(impl, getNodeTypeName().c_str()); return impl; } void setParent(ASTNode* parent) { parent_ = parent; } ASTNode* getParent() const { return parent_; } //void setSymbol(Symbol* symbol) { symbol_.reset(symbol); } //Symbol* getSymbol() const { return symbol_.get(); } void setLocation(const location& loc) { location_ = loc; } const location& getLocation() { return location_; } typedef std::vector<ASTNode*> ASTNodeList; /** * @brief Get the child ast nodes. * * @return true if has children. Otherwise return false. */ virtual bool getChildNodes(ASTNodeList*) { return false; }; virtual std::string toString() const { return getNodeTypeName(); } void setSymbol(Symbol* symbol) { CHECK(symbol); symbol_ = symbol; } Symbol* getSymbol() const { return symbol_; } ASTAttribute& getAttr() { return attr_; } const ASTAttribute& getAttr() const { return attr_; } protected: /** Parent ast node. */ ASTNode* parent_; /** The location of this AST node in the source file. */ location location_; Symbol* symbol_; ASTAttribute attr_; }; } // namespace flang #endif
// -=-=-=-=-=-=-=-=-=-=-=-=-=-=--=-=-=-=-=-=-=-=-=-=-=-=-=-=--=-=-=-=-=-=- // FGx FlightGear Launcher // pilotswidget.h // -=-=-=-=-=-=-=-=-=-=-=-=-=-=--=-=-=-=-=-=-=-=-=-=-=-=-=-=--=-=-=-=-=-=- // (c) 2010-2012 // Yves Sablonier, Pete Morgan // Geoff McLane // GNU GPLv2, see main.cpp and shipped licence.txt for further information #ifndef PILOTSWIDGET_H #define PILOTSWIDGET_H #include <QtNetwork/QNetworkAccessManager> #include <QtNetwork/QNetworkReply> #include <QDomDocument> #include <QtGui/QWidget> #include <QtGui/QTreeWidget> #include <QtGui/QStatusBar> #include <QtGui/QCheckBox> #include <QtGui/QComboBox> #include "xobjects/mainobject.h" class MainObject; #include "map/openlayerwidget.h" #include "aircraft/xaero.h" class PilotsWidget : public QWidget { Q_OBJECT public: explicit PilotsWidget(MainObject *mob, QWidget *parent = 0); enum COLS{ C_CALLSIGN = 0, C_AIRCRAFT = 1, C_ALTITUDE =2, C_HEADING = 3, C_PITCH = 4, C_LAT = 5, C_LON = 6, C_FLAG = 7, C_COUNT = 8 }; MainObject *mainObject; OpenLayerWidget *mapWidget; QDomDocument dom; QNetworkAccessManager *netMan; QNetworkReply *reply; QString server_string; QCheckBox *checkBoxFollowSelected; QCheckBox *checkBoxAutoRefresh; QComboBox *comboBoxHz; QTreeWidget *tree; QStatusBar *statusBar; QButtonGroup *buttonGroupCols; void set_map_widget(OpenLayerWidget *mapWidget); signals: //void radar(QString callsign, QString lat, QString lon, QString heading, QString altitude, bool is_tower); //void clear_radar(); void aircraft_selected(XAero aero); public slots: void fetch_pilots(); void on_server_error(QNetworkReply::NetworkError); void on_server_ready_read(); void on_server_read_finished(); void on_check_autorefresh(int); void on_combo_changed(int); void on_item_doubled_clicked(QTreeWidgetItem*,int); void on_show_cols(QAbstractButton*); }; #endif // PILOTSWIDGET_H
/* ** ZABBIX ** Copyright (C) 2000-2005 SIA Zabbix ** ** 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., 675 Mass Ave, Cambridge, MA 02139, USA. **/ #include "common.h" #include "sysinfo.h" int SYSTEM_UPTIME(const char *cmd, const char *param, unsigned flags, AGENT_RESULT *result) { #ifdef HAVE_FUNCTION_SYSCTL_KERN_BOOTTIME int mib[2], now; size_t len; struct timeval uptime; assert(result); init_result(result); mib[0] = CTL_KERN; mib[1] = KERN_BOOTTIME; len = sizeof(struct timeval); if (0 != sysctl(mib, 2, &uptime, &len, NULL, 0)) return SYSINFO_RET_FAIL; now = time(NULL); SET_UI64_RESULT(result, now - uptime.tv_sec); return SYSINFO_RET_OK; #else return SYSINFO_RET_FAIL; #endif /* HAVE_FUNCTION_SYSCTL_KERN_BOOTTIME */ }
/* * ===================================================================================== * * Filename: eeprom_i2c.h * * Description: * * Version: 1.0 * Created: 2012年10月10日 14时27分36秒 * Revision: none * Compiler: gcc * * Author: Dr. James Lee (Jsl), pighacker@gmail.com * Company: * * ===================================================================================== */ #include "./Include/def.h"
#include <stdio.h> #include <stdlib.h> #include "obstacles.h" #include "point.h" #include <vector> #include "path.h" #include "run.h" using namespace std; float xMax, yMax, radius; int run() { int check; float xStart, yStart, xStop, yStop, obstaclex, obstacley, obstacleHalfWidth, obstacleHalfHeight, obstacleAngle; check = scanf("%f", &xMax); check = scanf("%f", &yMax); check = scanf("%f", &radius); check = scanf("%f", &xStart); check = scanf("%f", &yStart); Point start(xStart, yStart); check = scanf("%f", &xStop); check = scanf("%f", &yStop); Point stop(xStop, yStop); int nbObstacles = 0; vector<Obstacle> obstacles; while (cin >> obstaclex) { check = scanf("%f", &obstacleHalfWidth); check = scanf("%f", &obstacley); check = scanf("%f", &obstacleHalfHeight); check = scanf("%f", &obstacleAngle); Obstacle obs(obstaclex, obstacley, obstacleHalfWidth, obstacleHalfHeight, obstacleAngle); obstacles.push_back(obs); nbObstacles++; } vector<Point> points; start.print(); points.push_back(start); path(start, stop, nbObstacles, obstacles, &points); for (auto i : points) { i.print(cout); } return 0; }
/* * Bricks-OS, Operating System for Game Consoles * Copyright (C) 2008 Maximus32 <Maximus32@bricks-os.org> * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 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 ARCH_VIDEODEVICE_H #define ARCH_VIDEODEVICE_H #include "kernel/videoManager.h" #include "kernel/2dRenderer.h" #include "kernel/3dRenderer.h" #include "asm/arch/config.h" #ifdef CONFIG_GL #include "../../../../gl/rasterScanline.h" #endif //--------------------------------------------------------------------------- class CNGCVideoDevice; //--------------------------------------------------------------------------- class CNGC2DRenderer : public C2DRenderer { public: CNGC2DRenderer(CNGCVideoDevice * dev); virtual ~CNGC2DRenderer(); // Flush operations to surface virtual void flush(); private: CNGCVideoDevice * pDev_; }; #ifdef CONFIG_GL //----------------------------------------------------------------------------- class CNGCSoftRasterizer : public raster::CRasterizerScanline { public: CNGCSoftRasterizer(CNGCVideoDevice * dev); virtual ~CNGCSoftRasterizer(); // Flush operations to surface virtual void flush(); private: CNGCVideoDevice * pDev_; }; #endif //--------------------------------------------------------------------------- class CNGCVideoDevice : public CAVideoDevice { public: CNGCVideoDevice(); virtual ~CNGCVideoDevice(); virtual void listModes(const SVideoMode ** modes, int * modeCount); virtual void getCurrentMode(const SVideoMode ** mode); virtual void getDefaultMode(const SVideoMode ** mode); virtual void setMode(const SVideoMode * mode); virtual void getSurface(CSurface ** surface, int width, int height); virtual void get2DRenderer(I2DRenderer ** renderer); virtual void get3DRenderer(I3DRenderer ** renderer); virtual uint32_t getFrameNr(); // Returns current frame/field number virtual uint32_t waitVSync(); // Returns current frame/field number, after vsync virtual void displaySurface(CSurface * surface); // Flush RGB buffer to native screen void flush(CSurface * surface); void setHorizontal(uint16_t xoffset, uint16_t width); void setVertical (uint16_t yoffset, uint16_t height); void setInterlaced(bool interlaced); // Screen positioning (in pixels) virtual bool hasPositioning(); virtual uint16_t getMaxHorizontalOffset(); virtual uint16_t getHorizontalOffset(); virtual void setHorizontalOffset(uint16_t x); virtual uint16_t getMaxVerticalOffset(); virtual uint16_t getVerticalOffset(); virtual void setVerticalOffset(uint16_t y); private: // Surface we're currently displaying CSurface * pSurface_; // Current Native surface (RGB mode only) uint8_t * pSurfaceData_; void * pNativeSurface_; const SVideoMode * pCurrentMode_; vuint32_t iFrameCount_; // volatile, becouse the isr updates it uint16_t iCurrentHOffset_; uint16_t iCurrentVOffset_; }; #endif
typedef enum { MP3_PLAY_1KHZ_0DB_LR=0, MP3_PLAY_1KHZ_0DB_L, MP3_PLAY_1KHZ_0DB_R, MP3_PLAY_MULTISINE_20KHZ, MP3_PLAY_TEST_STOP, MP3_PLAY_SAMPLE_FILE_COMPARE, MP3_PLAY_NOSIGNAL_LR_128K }test_mode_req_mp3_play_type; typedef enum { SPEAKER_PHONE_MODE_OFF=0, SPEAKER_PHONE_MODE_ON, NOMAL_MIC1_MODE_ON, NC_MODE_ON, ONLY_MIC2_ON_NC_MODE, ONLY_MIC1_ON_NC_MODE, }test_mode_req_speaker_phone_type; typedef enum { TEST_VOLUME_LEVEL_0=0, TEST_VOLUME_LEVEL_MINIMUM, TEST_VOLUME_LEVEL_MEDIUM, TEST_VOLUME_LEVEL_MAXIMUM }test_mode_req_test_volume_level_test_type; typedef enum { ACOUSTIC_OFF=0, ACOUSTIC_ON, HEADSET_PATH_ON, HANDSET_PATH_ON, ACOUSTIC_LOOPBACK_ON, ACOUSTIC_LOOPBACK_OFF, AUDIO_PATH_CHANGE_TO_MAIN_EARJACK, AUDIO_PATH_CHANGE_TO_SUB_EARJACK, AUDIO_PATH_CHANGE_TO_DEFAULT }test_mode_req_acoustic_type; extern void *testmode_mp3_test(uint32_t sub1_cmd, uint32_t sub2_cmd); extern void *testmode_speaker_phone_test(uint32_t sub1_cmd, uint32_t sub2_cmd); extern void *testmode_volume_level_test(uint32_t sub1_cmd, uint32_t sub2_cmd); extern void *testmode_acoustic_test(uint32_t sub1_cmd, uint32_t sub2_cmd); extern void *testmode_reponse_not_supported(void); extern int check_lcd_status(void);
/* * Copyright (C) 2005-2013 Team XBMC * http://kodi.tv * * This Program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2, or (at your option) * any later version. * * This Program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with XBMC; see the file COPYING. If not, see * <http://www.gnu.org/licenses/>. * */ #pragma once /*! \file GUIFontManager.h \brief */ #include <utility> #include <vector> #include "windowing/GraphicContext.h" #include "IMsgTargetCallback.h" #include "utils/Color.h" #include "utils/GlobalsHandling.h" // Forward class CGUIFont; class CGUIFontTTFBase; class CXBMCTinyXML; class TiXmlNode; class CSetting; struct OrigFontInfo { int size; float aspect; std::string fontFilePath; std::string fileName; RESOLUTION_INFO sourceRes; bool preserveAspect; bool border; }; /*! \ingroup textures \brief */ class GUIFontManager : public IMsgTargetCallback { public: GUIFontManager(void); ~GUIFontManager(void) override; bool OnMessage(CGUIMessage &message) override; void Unload(const std::string& strFontName); void LoadFonts(const std::string &fontSet); CGUIFont* LoadTTF(const std::string& strFontName, const std::string& strFilename, UTILS::Color textColor, UTILS::Color shadowColor, const int iSize, const int iStyle, bool border = false, float lineSpacing = 1.0f, float aspect = 1.0f, const RESOLUTION_INFO *res = NULL, bool preserveAspect = false); CGUIFont* GetFont(const std::string& strFontName, bool fallback = true); /*! \brief return a default font \param border whether the font should be a font with an outline \return the font. NULL if no default font can be found. */ CGUIFont* GetDefaultFont(bool border = false); void Clear(); void FreeFontFile(CGUIFontTTFBase *pFont); static void SettingOptionsFontsFiller(std::shared_ptr<const CSetting> setting, std::vector< std::pair<std::string, std::string> > &list, std::string &current, void *data); protected: void ReloadTTFFonts(); static void RescaleFontSizeAndAspect(float *size, float *aspect, const RESOLUTION_INFO &sourceRes, bool preserveAspect); void LoadFonts(const TiXmlNode* fontNode); CGUIFontTTFBase* GetFontFile(const std::string& strFontFile); static void GetStyle(const TiXmlNode *fontNode, int &iStyle); std::vector<CGUIFont*> m_vecFonts; std::vector<CGUIFontTTFBase*> m_vecFontFiles; std::vector<OrigFontInfo> m_vecFontInfo; RESOLUTION_INFO m_skinResolution; bool m_canReload; }; /*! \ingroup textures \brief */ XBMC_GLOBAL_REF(GUIFontManager, g_fontManager); #define g_fontManager XBMC_GLOBAL_USE(GUIFontManager)
#ifdef HAVE_CONFIG_H # include "config.h" #endif #include <stdio.h> #include <stdlib.h> #include <stdio.h> #include <stdlib.h> #include "vfile.h" int main(int argc, char *argv[]) { int verbose = 2; char *url, *destdir; vfile_configure(VFILE_CONF_VERBOSE, &verbose); vfile_setup(); if (argc < 2) { printf("Usage: vfget URL [DESTDIR]\n"); exit(EXIT_SUCCESS); } url = argv[1]; destdir = argc > 2 ? argv[2] : "/tmp"; vf_fetch(url, destdir, 0, 0, 0); return 0; }
/* * Copyright (C) 2005-2013 Junjiro R. Okajima * * This program, aufs 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 St, Fifth Floor, Boston, MA 02110-1301 USA */ /* * copy-up/down functions */ #ifndef __AUFS_CPUP_H__ #define __AUFS_CPUP_H__ #ifdef __KERNEL__ #include <linux/path.h> struct inode; struct file; struct au_pin; void au_cpup_attr_flags(struct inode *dst, unsigned int iflags); void au_cpup_attr_timesizes(struct inode *inode); void au_cpup_attr_nlink(struct inode *inode, int force); void au_cpup_attr_changeable(struct inode *inode); void au_cpup_igen(struct inode *inode, struct inode *h_inode); void au_cpup_attr_all(struct inode *inode, int force); /* ---------------------------------------------------------------------- */ /* cpup flags */ #define AuCpup_DTIME 1 /* do dtime_store/revert */ #define AuCpup_KEEPLINO (1 << 1) /* do not clear the lower xino, for link(2) */ #define AuCpup_RENAME (1 << 2) /* rename after cpup */ #define au_ftest_cpup(flags, name) ((flags) & AuCpup_##name) #define au_fset_cpup(flags, name) \ do { (flags) |= AuCpup_##name; } while (0) #define au_fclr_cpup(flags, name) \ do { (flags) &= ~AuCpup_##name; } while (0) int au_copy_file(struct file *dst, struct file *src, loff_t len); int au_sio_cpup_single(struct dentry *dentry, aufs_bindex_t bdst, aufs_bindex_t bsrc, loff_t len, unsigned int flags, struct dentry *dst_parent, struct au_pin *pin); int au_sio_cpup_simple(struct dentry *dentry, aufs_bindex_t bdst, loff_t len, unsigned int flags, struct au_pin *pin); int au_sio_cpup_wh(struct dentry *dentry, aufs_bindex_t bdst, loff_t len, struct file *file, struct au_pin *pin); int au_cp_dirs(struct dentry *dentry, aufs_bindex_t bdst, int (*cp)(struct dentry *dentry, aufs_bindex_t bdst, struct au_pin *pin, struct dentry *h_parent, void *arg), void *arg); int au_cpup_dirs(struct dentry *dentry, aufs_bindex_t bdst); int au_test_and_cpup_dirs(struct dentry *dentry, aufs_bindex_t bdst); /* ---------------------------------------------------------------------- */ /* keep timestamps when copyup */ struct au_dtime { struct dentry *dt_dentry; struct path dt_h_path; struct timespec dt_atime, dt_mtime; }; void au_dtime_store(struct au_dtime *dt, struct dentry *dentry, struct path *h_path); void au_dtime_revert(struct au_dtime *dt); #endif /* __KERNEL__ */ #endif /* __AUFS_CPUP_H__ */
// Copyright (c) 2014- PPSSPP Project. // 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.0 or later versions. // 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 2.0 for more details. // A copy of the GPL 2.0 should have been included with the program. // If not, see http://www.gnu.org/licenses/ // Official git repository and contact information can be found at // https://github.com/hrydgard/ppsspp and http://www.ppsspp.org/. #pragma once #include "Common/CommonWindows.h" //__declspec(dllimport) extern WORD IWRGetProductID(void); //__declspec(dllimport) extern DWORD IWRGetProductDetails(void); typedef struct { WORD dll_v1; WORD dll_v2; WORD dll_v3; WORD dll_v4; BYTE usb_firmware_major; BYTE usb_firmware_minor; BYTE tracker_firmware_major; BYTE tracker_firmware_minor; BYTE video_firmware; } TVUZIX_VERSION, *PVUZIX_VERSION; // tracker stuff typedef DWORD (__cdecl *PVUZIX_DWORD)(void); typedef WORD (__cdecl *PVUZIX_WORD)(void); typedef void (__cdecl *PVUZIX_VOID)(void); typedef DWORD (__cdecl *PVUZIX_LONG3)(LONG *, LONG *, LONG *); typedef void (__cdecl *PVUZIX_BOOL)(BOOL); typedef DWORD (__cdecl *PVUZIX_GETVERSION)(PVUZIX_VERSION ver); extern PVUZIX_DWORD Vuzix_OpenTracker; extern PVUZIX_LONG3 Vuzix_GetTracking; extern PVUZIX_VOID Vuzix_ZeroSet; extern PVUZIX_DWORD Vuzix_BeginCalibration; extern PVUZIX_BOOL Vuzix_EndCalibration; extern PVUZIX_BOOL Vuzix_SetFilterState; extern PVUZIX_VOID Vuzix_CloseTracker; extern PVUZIX_WORD Vuzix_GetProductID; extern PVUZIX_DWORD Vuzix_GetProductDetails; extern PVUZIX_GETVERSION Vuzix_GetVersion; // VR920 freeze frame stereoscopic 3D stuff typedef HANDLE (__cdecl *PVUZIX_HANDLE)(void); typedef void (__cdecl *PVUZIX_CLOSEHANDLE)(HANDLE handle); typedef BOOL (__cdecl *PVUZIX_HANDLEBOOL)(HANDLE, BOOL); typedef BYTE (__cdecl *PVUZIX_BYTEHANDLE)(HANDLE, BOOL); extern PVUZIX_HANDLE Vuzix_OpenStereo; extern PVUZIX_HANDLEBOOL Vuzix_SetStereo; extern PVUZIX_HANDLEBOOL Vuzix_SetEye; extern PVUZIX_CLOSEHANDLE Vuzix_CloseStereo; extern PVUZIX_BYTEHANDLE Vuzix_WaitForStereoAck; extern PVUZIX_GETVERSION Vuzix_GetStereoVersion; extern HANDLE g_vr920_stereo_handle; extern bool g_has_vr920; extern TVUZIX_VERSION g_vuzix_version, g_vuzix_3dversion; extern WORD g_vuzix_productid; extern DWORD g_vuzix_details; void LoadVR920(); void FreeVR920(); bool VR920_StartStereo3D(); bool VR920_StopStereo3D(); void VR920_CleanupStereo3D();
#include "helpers.h" TEST(join_does_not_work_on_different_element_sizes) { USING(dlist_new(sizeof(int))) { dlist_t *other = dlist_new(sizeof(int)+2); assertEquals(dlist_join(list, other), NULL); assertEquals(dlist_join(other, list), NULL); dlist_free(other); } } TEST(join_works_on_empty_lists) { int one = 1, two = 2, three = 3; USING(dlist_new(sizeof(int))) { dlist_t *other = dlist_new(sizeof(int)); assertEquals(dlist_join(list, other), list); assertEquals(dlist_length(other), 0); assertEquals(dlist_verify(other), 0); assertEquals(dlist_verify(list), 0); dlist_free(other); } USING(dlist_new(sizeof(int))) { dlist_t *other = dlist_new(sizeof(int)); dlist_append(list, &one); assertEquals(dlist_join(list, other), list); assertEquals(dlist_length(other), 0); assertEquals(dlist_length(list), 1); assertEquals(dlist_verify(other), 0); assertEquals(dlist_verify(list), 0); assertEquals(*((int*)dlist_get(list, 0, NULL)), one); assertEquals(dlist_join(other, list), other); assertEquals(dlist_length(other), 1); assertEquals(dlist_length(list), 0); assertEquals(dlist_verify(other), 0); assertEquals(dlist_verify(list), 0); assertEquals(*((int*)dlist_get(other, 0, NULL)), one); dlist_free(other); } USING(dlist_new(sizeof(int))) { dlist_t *other = dlist_new(sizeof(int)); dlist_append(list, &one); dlist_append(list, &two); assertEquals(dlist_join(list, other), list); assertEquals(dlist_length(other), 0); assertEquals(dlist_length(list), 2); assertEquals(dlist_verify(other), 0); assertEquals(dlist_verify(list), 0); assertEquals(*((int*)dlist_get(list, 0, NULL)), one); assertEquals(*((int*)dlist_get(list, 1, NULL)), two); assertEquals(dlist_join(other, list), other); assertEquals(dlist_length(other), 2); assertEquals(dlist_length(list), 0); assertEquals(dlist_verify(other), 0); assertEquals(dlist_verify(list), 0); assertEquals(*((int*)dlist_get(other, 0, NULL)), one); assertEquals(*((int*)dlist_get(other, 1, NULL)), two); dlist_free(other); } USING(dlist_new(sizeof(int))) { dlist_t *other = dlist_new(sizeof(int)); dlist_append(list, &one); dlist_append(list, &two); dlist_append(list, &three); assertEquals(dlist_join(list, other), list); assertEquals(dlist_length(other), 0); assertEquals(dlist_length(list), 3); assertEquals(dlist_verify(other), 0); assertEquals(dlist_verify(list), 0); assertEquals(*((int*)dlist_get(list, 0, NULL)), one); assertEquals(*((int*)dlist_get(list, 1, NULL)), two); assertEquals(*((int*)dlist_get(list, 2, NULL)), three); assertEquals(dlist_join(other, list), other); assertEquals(dlist_length(other), 3); assertEquals(dlist_length(list), 0); assertEquals(dlist_verify(other), 0); assertEquals(dlist_verify(list), 0); assertEquals(*((int*)dlist_get(other, 0, NULL)), one); assertEquals(*((int*)dlist_get(other, 1, NULL)), two); assertEquals(*((int*)dlist_get(other, 2, NULL)), three); dlist_free(other); } } TEST(join_works_on_full_lists) { int one = 1, two = 2, three = 3, four = 4; USING(dlist_new(sizeof(int))) { dlist_append(list, &one); dlist_t *other = dlist_new(sizeof(int)); dlist_append(list, &two); assertEquals(dlist_join(list, other), list); assertEquals(dlist_length(other), 0); assertEquals(dlist_length(list), 2); assertEquals(dlist_verify(other), 0); assertEquals(dlist_verify(list), 0); assertEquals(*((int*)dlist_get(list, 0, NULL)), one); assertEquals(*((int*)dlist_get(list, 1, NULL)), two); dlist_free(other); } USING(dlist_new(sizeof(int))) { dlist_append(list, &one); dlist_append(list, &two); dlist_t *other = dlist_new(sizeof(int)); dlist_append(list, &three); assertEquals(dlist_join(list, other), list); assertEquals(dlist_length(other), 0); assertEquals(dlist_length(list), 3); assertEquals(dlist_verify(other), 0); assertEquals(dlist_verify(list), 0); assertEquals(*((int*)dlist_get(list, 0, NULL)), one); assertEquals(*((int*)dlist_get(list, 1, NULL)), two); assertEquals(*((int*)dlist_get(list, 2, NULL)), three); dlist_free(other); } USING(dlist_new(sizeof(int))) { dlist_append(list, &one); dlist_append(list, &two); dlist_t *other = dlist_new(sizeof(int)); dlist_append(list, &three); dlist_append(list, &four); assertEquals(dlist_join(list, other), list); assertEquals(dlist_length(other), 0); assertEquals(dlist_length(list), 4); assertEquals(dlist_verify(other), 0); assertEquals(dlist_verify(list), 0); assertEquals(*((int*)dlist_get(list, 0, NULL)), one); assertEquals(*((int*)dlist_get(list, 1, NULL)), two); assertEquals(*((int*)dlist_get(list, 2, NULL)), three); assertEquals(*((int*)dlist_get(list, 3, NULL)), four); dlist_free(other); } }
//{{NO_DEPENDENCIES}} // Microsoft Visual C++ generated include file. // Used by FlangerExplorer.rc // #define IDD_ABOUTBOX 100 #define IDR_MAINFRAME 128 #define IDD_MAINDLG 129 #define IDB_FLANGER 201 #define IDB_CCLIC 202 #define IDI_PLAY 202 #define IDI_STOP 203 #define IDI_SAW 204 #define IDI_SQUARE 205 #define IDI_SIN 206 #define IDI_DISK 207 #define IDD_SAVEPIC 208 #define IDI_WVFILE 209 #define IDI_RAMP 210 #define IDI_LOOP 211 #define IDI_HELP 212 #define IDD_HELP 213 #define IDR_FLANGER_GRAPHIC 214 #define IDR_HELPTEXT 215 #define IDC_SIG_FILE 1000 #define IDC_SIG_FILENAME 1001 #define IDC_BROWSE 1002 #define IDC_SIG_INTERNAL 1003 #define IDC_PLAY 1004 #define IDC_STOP 1005 #define IDC_VOLUME 1006 #define IDC_ATTACK 1007 #define IDC_SUSTAIN 1008 #define IDC_SLIDER4 1009 #define IDC_DECAY 1009 #define IDC_VOLUME_EDIT 1010 #define IDC_ATTACK_EDIT 1011 #define IDC_SUSTAIN_EDIT 1012 #define IDC_DECAY_EDIT 1013 #define IDC_RVB_SEND 1014 #define IDC_LVL 1014 #define IDC_SIN 1015 #define IDC_SAWTOOTH 1016 #define IDC_RAMP 1017 #define IDC_SQUARE 1018 #define IDC_LOOP 1019 #define IDC_SAVEWAV 1020 #define IDC_HELP2 1021 #define IDC_PITCH_ED 1022 #define IDC_LOAD 1023 #define IDC_LVL_EDIT 1024 #define IDC_CENTER 1025 #define IDC_CENTER_EDIT 1026 #define IDC_DEPTH 1027 #define IDC_DEPTH_EDIT 1028 #define IDC_FEEDBACK 1029 #define IDC_FEEDBACK_EDIT 1030 #define IDC_SWEEP 1031 #define IDC_SWEEP_EDIT 1032 #define IDC_MIX 1033 #define IDC_MIX_EDIT 1034 #define IDC_TEXT 1037 #define IDC_DIAGRAM 1038 // Next default values for new objects // #ifdef APSTUDIO_INVOKED #ifndef APSTUDIO_READONLY_SYMBOLS #define _APS_NEXT_RESOURCE_VALUE 217 #define _APS_NEXT_COMMAND_VALUE 32772 #define _APS_NEXT_CONTROL_VALUE 1039 #define _APS_NEXT_SYMED_VALUE 101 #endif #endif
/* * ===================================================================================== * * Filename: fifo_util.c * * Description: fifo util * * Version: 1.0 * Created: 2017年05月18日 10时46分46秒 * Revision: none * Compiler: gcc * * Author: James Lee (Jsl), princeofdream@outlook.com * Organization: BookCL * * ===================================================================================== */ #include "fifo_util.h" void init_uart_emu_fifo_util() { unlink(UART_EMU_FIFO); mkfifo(UART_EMU_FIFO,O_RDWR,0644); chmod(UART_EMU_FIFO,00664); printf("Make fifo file!\n"); }
/* * arch/arm/mach-ixp4xx/include/mach/mtd-xip.h * * IXP4XX MTD primitives for XIP support. * * Copyright (C) 2014 Cisco, Inc. * * based on arch/arm/mach-sa1100/include/mach/mtd-xip.h * Copyright: (C) 2004 MontaVista Software, Inc. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as * published by the Free Software Foundation. * */ #ifndef __ARCH_IXP4XX_MTD_XIP_H__ #define __ARCH_IXP4XX_MTD_XIP_H__ #include <mach/hardware.h> #define xip_irqpending() (*IXP4XX_ICIP & *IXP4XX_ICMR) /* we sample OSTS and convert desired delta to usec (1/67 ~= 1000000/66666666)*/ #define xip_currtime() (*IXP4XX_OSTS) #define xip_elapsed_since(x) (unsigned)((*IXP4XX_OSTS - (x)) / 67) #endif
#ifndef PEMU_HELPER_H #define PEMU_HELPER_H #include "linux.h" #include "pemu.h" static void get_name(uint32_t addr, int size, char *buf) { PEMU_read_mem(addr + pemu_guest_os.commoffset, 16, buf); } static uint32_t next_task_struct(uint32_t addr) { uint32_t retval; uint32_t next; PEMU_read_mem(addr + pemu_guest_os.listoffset + sizeof(uint32_t), sizeof(uint32_t), &next); retval = next - pemu_guest_os.listoffset; return retval; } static uint32_t get_pid(uint32_t addr) { uint32_t pid; PEMU_read_mem(addr + pemu_guest_os.pidoffset, sizeof(pid), &pid); return pid; } static uint32_t get_pgd(uint32_t addr) { uint32_t mmaddr, pgd; PEMU_read_mem(addr + pemu_guest_os.mmoffset, sizeof(mmaddr), &mmaddr); if (0 == mmaddr) PEMU_read_mem(addr + pemu_guest_os.mmoffset + sizeof(mmaddr), sizeof(mmaddr), &mmaddr); if (0 != mmaddr) PEMU_read_mem(mmaddr + pemu_guest_os.pgdoffset, sizeof(pgd), &pgd); else memset(&pgd, 0, sizeof(pgd)); return pgd; } static uint32_t get_first_mmap(uint32_t addr) { uint32_t mmaddr, mmap; PEMU_read_mem(addr + pemu_guest_os.mmoffset, sizeof(mmaddr), &mmaddr); if (0 == mmaddr) PEMU_read_mem(addr + pemu_guest_os.mmoffset + sizeof(mmaddr), sizeof(mmaddr), &mmaddr); if (0 != mmaddr) PEMU_read_mem(mmaddr, sizeof(mmap), &mmap); else memset(&mmap, 0, sizeof(mmap)); return mmap; } static void get_mod_name(uint32_t addr, char *name, int size) { uint32_t vmfile, dentry; if(PEMU_read_mem(addr + pemu_guest_os.vmfileoffset, sizeof(vmfile), &vmfile) != 0 || PEMU_read_mem(vmfile + pemu_guest_os.dentryoffset, sizeof(dentry), &dentry) != 0 || PEMU_read_mem(dentry + pemu_guest_os.dinameoffset, size < 36 ? size : 36, name) != 0) name[0] = 0; } static uint32_t get_vmstart(uint32_t addr) { uint32_t vmstart; PEMU_read_mem(addr + pemu_guest_os.vmstartoffset, sizeof(vmstart), &vmstart); return vmstart; } static uint32_t get_next_mmap(uint32_t addr) { uint32_t mmap; PEMU_read_mem(addr + pemu_guest_os.vmnextoffset, sizeof(mmap), &mmap); return mmap; } static uint32_t get_vmend(uint32_t addr) { uint32_t vmend; PEMU_read_mem(addr + pemu_guest_os.vmendoffset, sizeof(vmend), &vmend); return vmend; } static uint32_t get_vmflags(uint32_t addr) { uint32_t vmflags; PEMU_read_mem(addr + pemu_guest_os.vmflagsoffset, sizeof(vmflags), &vmflags); return vmflags; } ////////////////////////////////////// #if 0 #include "parse_operand.h" static uint32_t get_call_dest(uint32_t pc) { // xed_inst_t * xi = PEMU_g_xi; xed_reg_enum_t reg_id; xed_operand_enum_t op_name = PEMU_op_name; uint32_t dest = 0; if(operand_is_reg(op_name, &reg_id)) { dest = PEMU_get_reg(reg_id); } else if(operand_is_mem(op_name, &dest, 0)) { uint32_t tmp = dest; PEMU_read_mem(tmp, sizeof(dest), &dest); } else if(operand_is_relbr(op_name, &dest)) { dest += (pc + xed_decoded_inst_get_length(&PEMU_xedd_g)); } else { fprintf(stderr, "error: get_call_dest\n"); exit(0); } return dest; } #endif #endif
#ifndef KVIRTUALHOSTDATABASE_H #define KVIRTUALHOSTDATABASE_H #include <map> #include <list> #include <string> #include "global.h" #include "utils.h" #include "vh_module.h" #include "KVirtualHost.h" #include "KDsoModule.h" #define VH_INFO_HOST 0 #define VH_INFO_ERROR_PAGE 1 #define VH_INFO_INDEX 2 #define VH_INFO_MAP 3 #define VH_INFO_ALIAS 4 #define VH_INFO_MIME 5 #define VH_INFO_BIND 7 #define VH_INFO_HOST2 8 #define VH_INFO_ENV 100 class KVirtualHostDatabase { public: KVirtualHostDatabase(); ~KVirtualHostDatabase(); bool flushVirtualHost(const char *vhName,bool initEvent,KVirtualHostEvent *ctx); bool loadVirtualHost(KVirtualHostManage *vm,std::string &errMsg); #ifdef ENABLE_VH_FLOW //Á÷Á¿²Ù×÷ bool saveFlow(KVirtualHost *vh,void *cn); #endif /* дÈë²Ù×÷ */ bool addInfo(std::map<std::string,std::string> &attribute,std::string &errMsg,bool skipFlush=false); bool delInfo(std::map<std::string,std::string> &attribute,std::string &errMsg,bool skipFlush=false); bool addVirtualHost(std::map<std::string,std::string> &attr,KVirtualHostEvent *ctx,std::string &errMsg); bool delVirtualHost(std::map<std::string,std::string> &attribute); bool updateVirtualHost(KVirtualHostEvent *ctx,std::map<std::string,std::string> &attribute,std::string &errMsg); bool parseAttribute(std::map<std::string,std::string> &attribute); //¼ì²éÊý¾Ý¿âÁ¬½ÓÊÇ·ñÕý³£ bool check(); bool isSuccss() { return lastStatus; } bool isLoad(); void clear(); bool ext; void *createConnection(); void freeConnection(void *cn); private: //bool delInfo(KVirtualHostConnection *cn,const char *vhName,const char *name,int type,const char *value); bool loadInfo(KVirtualHost *vh,void *cn); //int getColIndex(const char *name); KVirtualHost *newVirtualHost(void *cn,std::map<std::string,std::string> &attribute,KVirtualHostManage *vm,KVirtualHost *ov); //bool buildVhAttribute(const char *name,KVirtualHostData *rs,std::map<std::string,std::string> &attribute); //std::map<char *,int,lessp_icase> colmap; KMutex lock; //KVirtualHostDataInterface *vhdi; vh_module vhm; bool lastStatus; KDsoModule vhm_handle; }; extern KVirtualHostDatabase vhd; #endif