text
stringlengths
4
6.14k
#pragma once #include <opencv/highgui.h> class VideoInput { private: cv::VideoCapture _capture; long _lastFrameTime; void prepareDebugFrame(); void copyToDebugFrame(); public: int frameCount; double frameRate; cv::Mat frame; cv::Mat debugFrame; cv::Size size; bool captureFromVideo; std::string resolutionParameter; double videoResolution; VideoInput(); VideoInput(std::string resolution); VideoInput(std::string resolution, std::string filename, bool dummy); ~VideoInput(); void updateFrame(); double getResolution(); }; class VideoWriter { public: VideoWriter(cv::Size, std::string filename); ~VideoWriter(); void write(const cv::Mat &image); private: cv::VideoWriter _video; };
#define DIO_MASK_INPUT '-' /* HD15 input same DIO_MASK_INPUT_HD15 */ #define DIO_MASK_OUTPUT1 '1' #define DIO_MASK_OUTPUT0 '0' #define DIO_MASK_INPUT0 'L' #define DIO_MASK_INPUT1 'H' #define DIO_MASK_OUTPUT_PP 'P' /* positive pulse */ #define DIO_MASK_OUTPUT_NP 'N' /* negative pulse */ #define DIO_MASK_INPUT_TOGGLE '|' #define DIO_MASK_INPUT_HD15 'i' #define DIO_MASK_INPUT_IOP 'q'
#include <stdio.h> void altera(int vet[], int x) { vet[0] = -1; x = -1; } int main(void) { int vet[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9}; int x = 0; altera(vet, x); printf("vet[0] = %d\n", vet[0]); printf("x = %d", x); return 0; }
#include <avr/io.h> #include <inttypes.h> #include "adc.h" #include "define.h" uint16_t adc_read(uint8_t channel) { uint8_t i; uint16_t result = 0; // ADC aktivieren; teilungsfaktor 32 ADCSRA = (1 << ADEN | 1 << ADPS2 | 1 << ADPS0); ADMUX = channel; // 5V referenzspannung ADMUX |= (1 << REFS0); // ADC initialisieren und Dummyreadout machen ADCSRA |= (1 << ADSC); while(ADCSRA & (1 << ADSC)); for(i = 0; i < ADC_MEASUREMENTS; i++) { ADCSRA |= (1 << ADSC); while(ADCSRA & (1<<ADSC)); result += ADCW; } // ADC wieder deaktivieren ADCSRA &= ~(1 << ADEN); result /= ADC_MEASUREMENTS; return result; }
#ifndef DIRECTIONALLIGHTVOXELCONETRACERENDERER_H #define DIRECTIONALLIGHTVOXELCONETRACERENDERER_H #include "Shadows/DirectionalLightShadowMapRenderer.h" class DirectionalLightVoxelConeTraceRenderer : public DirectionalLightShadowMapRenderer { protected: RenderVolumeCollection* _rvc; public: DirectionalLightVoxelConeTraceRenderer (Light* light); ~DirectionalLightVoxelConeTraceRenderer (); void Draw (Scene* scene, Camera* camera, RenderVolumeCollection* rvc); protected: std::vector<PipelineAttribute> GetCustomAttributes (); }; #endif
/*************************************************************************** * Copyright (C) 2004-2005 by Andrew Krause * * * * 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 OUTPUT_BUILD_H #define OUTPUT_BUILD_H /*! \file openldev-output-build.h \brief OutputBuild */ #include "../openldev-settings/openldev-settings.h" #include "openldev-menu.h" #include <gtk/gtk.h> #include <iostream> #include <glib.h> #include <glib-object.h> #include <csignal> using namespace std; G_BEGIN_DECLS #define OUTPUT_BUILD_TYPE (output_build_get_type ()) #define OUTPUT_BUILD(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), OUTPUT_BUILD_TYPE, OutputBuild)) #define OUTPUT_BUILD_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), OUTPUT_BUILD_TYPE, OutputBuildClass)) #define IS_OUTPUT_BUILD(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), OUTPUT_BUILD_TYPE)) #define IS_OUTPUT_BUILD_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), OUTPUT_BUILD_TYPE)) enum { OUTPUT_ERROR, OUTPUT_WARNING }; typedef struct { gint type, line; gchar *location; } BuildMessage; /*! \brief Widgets for the build output GtkTreeView. */ struct OutputBuild { GtkTreeView parent; /*! GtkScrolledWindow that contains the main GtkTreeView widget. */ GtkWidget *swin; EnvironmentSettings *env; MenuHandle *menus; gboolean successful; gboolean terminated; GIOChannel *channel; GIOChannel *channelerr; GPid pid; GTimer *timer; GMainLoop *loop; GList *location; GList *messages; }; struct OutputBuildClass { GtkTreeViewClass parent_class; }; GType output_build_get_type (); GtkWidget* output_build_new (EnvironmentSettings *settings, MenuHandle *menus); /*! Get the GtkScrolledWindow widget in the OutputBuild object. \param build An OutputBuild object. \return The OutputBuild's GtkScrolledWindow. */ GtkWidget* output_build_get_scrolled_window (OutputBuild *build); /*! Run a command using fopen and place the output, one line per row, in the GtkTreeView widget. The EnvironmentSettings object is used to retrieve colors to use for build output errors or warnings. \param build An OutputBuild object. \param command The command to be executed. \param base_dir The directory where the command was run. \return TRUE if the command was successfully completed without errors. */ gboolean output_build_run_command (OutputBuild *build, gchar *command, gchar *base_dir); /*! Stop any command that is currently running. This will happen on the next output cycle. \param build An OutputBuild object. */ void output_build_stop_build (OutputBuild *build); /*! Clear the content of the GtkTreeView. \param build An OutputBuild object. */ void output_build_clear (OutputBuild *build); G_END_DECLS #endif
#pragma once /*************************************************************************** rootdata.h - description lcass TRootData ------------------- begin : Thu Apr 20 16:55:07 2000 copyright : GPL (C) 2000-2016 by atu email : atu@nmetau.edu.ua ***************************************************************************/ #include "dataset.h" class LaboDoc; class TModel; /** class holding other classes descriptions so can create all registered class objects */ class TRootData : public TDataSet { Q_OBJECT public: DCL_CTOR(TRootData); virtual ~TRootData() override; DCL_CREATE; DCL_STD_INF; const LaboDoc* getDoc() const { return doc; } void setDoc( const LaboDoc *a_doc ) { doc = a_doc; } TModel *getModel() { return model; } QString getFilePath() const; // pass to doc, in exists QString getFileBase() const; // same protected: const LaboDoc *doc = nullptr; TModel *model = nullptr; Q_CLASSINFO( "nameHintBase", "root" ); DCL_DEFAULT_STATIC; };
//{{NO_DEPENDENCIES}} // Microsoft Visual C++ generated include file. // Used by VideoPad.rc // #define IDR_MAINFRAME 128 #define IDR_VideoPadTYPE 129 #define IDD_DIALOG_CHANNEL 129 #define IDD_DIALOG_CONNECTING 130 #define IDD_DIALOG_VIDEO 133 #define IDD_DIALOG_CHAT 134 #define IDD_DIALOG_SERVER 135 #define IDC_LIST_CHANNEL_CHANNELS 1000 #define IDC_CHECK_CHANNEL_AUTOJOIN 1001 #define IDC_BUTTON_CHANNEL_JOIN 1002 #define IDC_COMBO_CONNECT_SERVERNAME 1003 #define IDC_BUTTON_CHANNEL_CANCEL 1003 #define IDC_EDIT_MESSAGES 1006 #define IDC_EDIT_MESSAGE 1007 #define IDC_EDIT_CLIENTS 1008 #define IDC_EDIT4 1009 #define IDC_EDIT2 1011 #define IDC_CONNECT_NICK 1012 #define ID_TOOLBAR_CONNECT 32771 #define ID_TOOLBAR_CHANNEL 32772 // Next default values for new objects // #ifdef APSTUDIO_INVOKED #ifndef APSTUDIO_READONLY_SYMBOLS #define _APS_NEXT_RESOURCE_VALUE 136 #define _APS_NEXT_COMMAND_VALUE 32775 #define _APS_NEXT_CONTROL_VALUE 1013 #define _APS_NEXT_SYMED_VALUE 104 #endif #endif
/* status_window.c -- routines for display status information * * Copyright (c) 1998-2004 Mike Oliphant <grip@nostatic.org> * * http://sourceforge.net/projects/grip/ * * 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 <stdio.h> #include <stdlib.h> #include <string.h> #include <unistd.h> #include <fcntl.h> #include <vte/vte.h> #include "status_window.h" static void PipeCB(gpointer data,gint source,GdkInputCondition condition); /* Create a new status window */ StatusWindow *NewStatusWindow(GtkWidget *box) { StatusWindow *sw; GtkWidget *vscrollbar; GtkWidget *hbox; sw=g_new(StatusWindow,1); if(!sw) return NULL; sw->pipe[0]=sw->pipe[1]=-1; if(box) { sw->embedded=TRUE; } else { sw->embedded=FALSE; /* Create new window here */ } hbox=gtk_hbox_new(FALSE,3); /* sw->term_widget=zvt_term_new_with_size(40,10); gtk_box_pack_start(GTK_BOX(hbox),sw->term_widget,FALSE,FALSE,0); gtk_widget_show(sw->term_widget); vscrollbar=gtk_vscrollbar_new(ZVT_TERM(sw->term_widget)->adjustment); gtk_box_pack_start(GTK_BOX(hbox),vscrollbar,FALSE,FALSE,0); gtk_widget_show(vscrollbar);*/ sw->term_widget=vte_terminal_new(); vte_terminal_set_encoding(VTE_TERMINAL(sw->term_widget),"UTF-8"); /* vte_terminal_set_size(VTE_TERMINAL(sw->term_widget),40,10);*/ gtk_box_pack_start(GTK_BOX(hbox),sw->term_widget,TRUE,TRUE,0); gtk_widget_show(sw->term_widget); vscrollbar=gtk_vscrollbar_new(VTE_TERMINAL(sw->term_widget)->adjustment); gtk_box_pack_start(GTK_BOX(hbox),vscrollbar,FALSE,FALSE,0); gtk_widget_show(vscrollbar); gtk_box_pack_start(GTK_BOX(box),hbox,TRUE,TRUE,0); gtk_widget_show(hbox); return sw; } /* Write a line of output to a status window */ void StatusWindowWrite(StatusWindow *sw,char *msg) { char *buf; gsize len; int pos=0; len=strlen(msg); buf=(char *)malloc((len*2)+1); while(*msg) { if(1) { //!(*msg & (1<<7))) { if(*msg=='\n') { buf[pos++]='\r'; buf[pos++]='\n'; } else { buf[pos++]=*msg; } } msg++; } buf[pos]='\0'; /* zvt_term_feed((ZvtTerm *)sw->term_widget,buf,strlen(buf));*/ vte_terminal_feed(VTE_TERMINAL(sw->term_widget),buf,strlen(buf)); free(buf); } /* Return the output pipe fd for a status window, opening the pipe if necessary */ int GetStatusWindowPipe(StatusWindow *sw) { if(sw->pipe[1]>0) return sw->pipe[1]; pipe(sw->pipe); fcntl(sw->pipe[0],F_SETFL,O_NONBLOCK); gdk_input_add(sw->pipe[0],GDK_INPUT_READ,PipeCB,(gpointer)sw); return sw->pipe[1]; } static void PipeCB(gpointer data,gint source,GdkInputCondition condition) { char buf[256]; StatusWindow *sw; sw=(StatusWindow *)data; while(read(sw->pipe[0],buf,256)>0) { /* StatusWindowWrite(sw,buf);*/ } }
/* * Copyright (c) 2012, Mellanox Technologies inc. All rights reserved. * * This software is available to you under a choice of one of two * licenses. You may choose to be licensed under the terms of the GNU * General Public License (GPL) Version 2, available from the file * COPYING in the main directory of this source tree, or the * OpenIB.org BSD license below: * * Redistribution and use in source and binary forms, with or * without modification, are permitted provided that the following * conditions are met: * * - Redistributions of source code must retain the above * copyright notice, this list of conditions and the following * disclaimer. * * - Redistributions in binary form must reproduce the above * copyright notice, this list of conditions and the following * disclaimer in the documentation and/or other materials * provided with the distribution. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ #ifndef MLX5_SRQ_H #define MLX5_SRQ_H #include <linux/mlx5/driver.h> void mlx5_init_srq_table(struct mlx5_core_dev *dev); void mlx5_cleanup_srq_table(struct mlx5_core_dev *dev); #endif /* MLX5_SRQ_H */
#pragma once #include <vector> #include <complex> #include <fstream> #include <istream> #include <iterator> #include <pthread.h> #include <gsl/gsl_sf_erf.h> #include <gsl/gsl_sf_gamma.h> #include <omp.h> #include "GARealGenome.h" #include "defines.h" #include "logUtility.h" #include "xrdata.h" using namespace std; class multilayer { private: vector <complex<double> > nk,dzk; vector <double> rhok,dz; vector <double> genome0,genome1; //mkdensity parameter //double gene_ra,gene_rb,gene_rc,gene_ba,gene_bb,gene_bc; public: double dz0,dz1,slab,sdyi; double alpha0,dth,sigmad,gamma,kappa; //vector <double> xi,yi,dyi,thetai,x2i; vector <xrdata> ref0,ref1; string fnpop,fnref,fnrf,fnrho; unsigned int nl,glength,dside; //double rho_a,rho_b,beta_a,beta_b; complex<double> n_bulk0,n_bulk1,n_bulk12; //double rho0,beta0,rho12,beta12; double lambda,k0; complex<double> kdz0; //k0*dz0*2i double qmin,qmax;//qz range for fitting multilayer(unsigned int ,double ,double,double); multilayer(){} // ~multilayer(); void readref(string); double rf(vector<xrdata>::iterator); double fresnel(double t); complex<double> rho_gene(double t); double objective(GARealGenome *); void genomerf(GARealGenome *); void mkdensity(GARealGenome *); void update_sip(GARealGenome *),update_phi(GARealGenome *); double cT(double),yet_qz(double),sip_sink(double),bulk(double); void setbulk(double ,double ,double ,double ,double ,double ); };
/** * @file * @brief Defines some savefile structures */ /* Copyright (C) 2002-2015 UFO: Alien Invasion. 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. */ #pragma once #include "../../../common/msg.h" #include "../../../common/xml.h" #define FOREACH_XMLNODE(var, node, name) \ for (xmlNode_t* var = cgi->XML_GetNode((node), name); var; var = cgi->XML_GetNextNode(var, node, name)) #define MAX_SAVESUBSYSTEMS 32 #define SAVE_FILE_VERSION 4 typedef struct saveSubsystems_s { const char* name; bool (*save) (xmlNode_t* parent); /**< return false if saving failed */ bool (*load) (xmlNode_t* parent); /**< return false if loading failed */ } saveSubsystems_t; #include <zlib.h> void SAV_Init(void); bool SAV_AddSubsystem(saveSubsystems_t* subsystem); /* and now the save and load prototypes for every subsystem */ bool B_SaveXML(xmlNode_t* parent); bool B_LoadXML(xmlNode_t* parent); bool CP_SaveXML(xmlNode_t* parent); bool CP_LoadXML(xmlNode_t* parent); bool HOS_LoadXML(xmlNode_t* parent); bool HOS_SaveXML(xmlNode_t* parent); bool BS_SaveXML(xmlNode_t* parent); bool BS_LoadXML(xmlNode_t* parent); bool AIR_SaveXML(xmlNode_t* parent); bool AIR_LoadXML(xmlNode_t* parent); bool AC_LoadXML(xmlNode_t* parent); bool E_SaveXML(xmlNode_t* parent); bool E_LoadXML(xmlNode_t* parent); bool RS_SaveXML(xmlNode_t* parent); bool RS_LoadXML(xmlNode_t* parent); bool PR_SaveXML(xmlNode_t* parent); bool PR_LoadXML(xmlNode_t* parent); bool MS_SaveXML(xmlNode_t* parent); bool MS_LoadXML(xmlNode_t* parent); bool STATS_SaveXML(xmlNode_t* parent); bool STATS_LoadXML(xmlNode_t* parent); bool NAT_SaveXML(xmlNode_t* parent); bool NAT_LoadXML(xmlNode_t* parent); bool TR_SaveXML(xmlNode_t* parent); bool TR_LoadXML(xmlNode_t* parent); bool AB_SaveXML(xmlNode_t* parent); bool AB_LoadXML(xmlNode_t* parent); bool XVI_SaveXML(xmlNode_t* parent); bool XVI_LoadXML(xmlNode_t* parent); bool INS_SaveXML(xmlNode_t* parent); bool INS_LoadXML(xmlNode_t* parent); bool MSO_SaveXML(xmlNode_t* parent); bool MSO_LoadXML(xmlNode_t* parent); bool US_SaveXML(xmlNode_t* parent); bool US_LoadXML(xmlNode_t* parent); bool MIS_LoadXML(xmlNode_t* parent); bool MIS_SaveXML(xmlNode_t* parent); bool INT_SaveXML(xmlNode_t* parent); bool INT_LoadXML(xmlNode_t* parent); bool B_PostLoadInit(void); bool AIR_PostLoadInit(void); bool PR_PostLoadInit(void); bool SAV_GameLoad(const char* file, const char** error); void SAV_GameDelete_f(void);
/*------------------------------------------------------------------------. | Copyright 2000, 2001 Alexandre Duret-Lutz <duret_g@epita.fr> | | | | This file is part of Heroes. | | | | Heroes 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. | | | | Heroes 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 HEROES__VIDEO_LOW__H # define HEROES__VIDEO_LOW__H # include "video.h" /* Low-level video functions, only called from the media/video.c. */ typedef void (*a_copy_function)(const a_pixel *source, a_pixel *a_dest, unsigned width); /* Return true on success. */ void init_video_low (int stretch, int *pitch); void uninit_video_low (void); void vsynchro_low (const a_pixel *s, a_copy_function f); void vsynchro2_low (const a_pixel *s1, const a_pixel *s2, a_copy_function f); #endif /* HEROES__VIDEO_LOW__H */
#ifndef GRIDSCENE_H #define GRIDSCENE_H #include <QGraphicsScene> class MainWindow; class GridScene : public QGraphicsScene { public: GridScene(MainWindow *mw, qreal x, qreal y, qreal w, qreal h); void showLayer(int layer); void hideLayer(int layer); protected: void drawBackground(QPainter *painter, const QRectF &rect); void mousePressEvent(QGraphicsSceneMouseEvent *event); private: MainWindow *mainWindow; }; #endif // GRIDSCENE_H
/* * actkbd - A keyboard shortcut daemon * * Copyright (c) 2005-2006 Theodoros V. Kalamatianos <nyb@users.sourceforge.net> * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 as published by * the Free Software Foundation. */ #include "actkbd.h" #include <regex.h> #include <sys/ioctl.h> #include <linux/input.h> #define PROCFS "/proc/" #define HANDLERS "bus/input/handlers" #define DEVICES "bus/input/devices" #define DEVNODE "/dev/input/event" /* The device node */ static char devnode[32]; /* The device file pointer */ static FILE *dev; int init_dev() { FILE *fp = NULL; int ret; unsigned int u0, u1; regex_t preg; regmatch_t pmatch[4]; maxkey = KEY_MAX; fp = fopen(PROCFS HANDLERS, "r"); if (fp == NULL) { lprintf("Error: could not open " PROCFS HANDLERS ": %s\n", strerror(errno)); return HOSTFAIL; } do { ret = fscanf(fp, "N: Number=%u Name=evdev Minor=%u", &u0, &u1); fscanf(fp, "%*s\n"); } while ((!feof(fp)) && (ret < 2)); if (ret < 2) { lprintf("Error: event interface not available\n"); return HOSTFAIL; } if (verbose > 1) lprintf("Event interface present (handler %u)\n", u0); fclose(fp); /* Skip auto-detection when the device has been specified */ if (device) return OK; fp = fopen(PROCFS DEVICES, "r"); if (fp == NULL) { lprintf("Error: could not open " PROCFS DEVICES ": %s\n", strerror(errno)); return HOSTFAIL; } /* Compile the regular expression and scan for it */ ret = -1; regcomp(&preg, "^H: Handlers=(.* )?kbd (.* )?event([0-9]+)", REG_EXTENDED); do { char l[128] = ""; void *str = fgets(l, 128, fp); if (str == NULL) break; ret = regexec(&preg, l, 4, pmatch, 0); if (ret == 0) { l[pmatch[3].rm_eo] = '\0'; ret = sscanf(l + pmatch[3].rm_so, "%u", &u0); } else { ret = -1; } } while ((!feof(fp)) && (ret < 1)); regfree(&preg); if (ret < 1) { lprintf("Error: could not detect a usable keyboard device\n"); return HOSTFAIL; } if (verbose > 1) lprintf("Detected a usable keyboard device (event%u)\n", u0); fclose(fp); sprintf(devnode, DEVNODE "%u", u0); device = devnode; return OK; } int open_dev() { dev = fopen(device, "a+"); if (dev == NULL) { lprintf("Error: could not open %s: %s\n", device, strerror(errno)); return DEVFAIL; } return OK; } int close_dev() { fclose(dev); return OK; } int grab_dev() { int ret; if (grabbed) return 0; ret = ioctl(fileno(dev), EVIOCGRAB, (void *)1); if (ret == 0) grabbed = 1; else lprintf("Error: could not grab %s: %s\n", device, strerror(errno)); return ret; } int ungrab_dev() { int ret; if (!grabbed) return 0; ret = ioctl(fileno(dev), EVIOCGRAB, (void *)0); if (ret == 0) grabbed = 0; else lprintf("Error: could not ungrab %s: %s\n", device, strerror(errno)); return ret; } int get_key(int *key, int *type) { struct input_event ev; int ret; do { ret = fread(&ev, sizeof(ev), 1, dev); if (ret < 1) { lprintf("Error: failed to read event from %s: %s", device, strerror(errno)); return READERR; } } while (ev.type != EV_KEY); *key = ev.code; switch (ev.value) { case 0: *type = REL; break; case 1: *type = KEY; break; case 2: *type = REP; break; default: *type = INVALID; } if (*key > KEY_MAX) *type = INVALID; if (*type == INVALID) { lprintf("Error: invalid event read from %s: code = %u, value = %u", device, ev.code, ev.value); return EVERR; } return OK; } int snd_key(int key, int type) { struct input_event ev; int ret; ev.type = EV_KEY; ev.code = key; switch (type) { case KEY: ev.value = 1; break; case REL: ev.value = 0; break; case REP: ev.value = 2; break; default: return EINVAL; } ret = fwrite(&ev, sizeof(ev), 1, dev); if (ret < 1) { lprintf("Error: failed to send event to %s: %s", device, strerror(errno)); return WRITEERR; } return OK; } int set_led(int led, int on) { struct input_event ev; int ret; ev.type = EV_LED; ev.code = led; ev.value = (on > 0); ret = fwrite(&ev, sizeof(ev), 1, dev); if (ret < 1) { lprintf("Error: failed to set LED at %s: %s", device, strerror(errno)); return WRITEERR; } return OK; }
/* Callbacks for the built-in CTCP types * Copyright (C) 2013 Stephen Chandler Paul * * This file is free software: you may copy it, 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 this License or (at your option) any * later version. * * This file 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 __BUILTIN_CTCP_RESPONSES_H__ #define __BUILTIN_CTCP_RESPONSES_H__ #include "ctcp.h" #define BUILTIN_CTCP_RESP(func_name) \ extern void func_name(struct sqchat_network * network, \ char * hostmask, \ char * target, \ char * msg) \ _attr_nonnull(1, 2) BUILTIN_CTCP_RESP(sqchat_ctcp_version_resp_handler); BUILTIN_CTCP_RESP(sqchat_ctcp_ping_resp_handler); #undef BUILTIN_CTCP_RESP #endif // __BUILTIN_CTCP_RESPONSES_H__ // vim: set expandtab tw=80 shiftwidth=4 softtabstop=4 cinoptions=(0,W4:
/*************************************************************************** qgslegendsymbolitem.h -------------------------------------- Date : August 2014 Copyright : (C) 2014 by Martin Dobias Email : wonder dot sk at gmail dot com *************************************************************************** * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * ***************************************************************************/ #ifndef QGSLEGENDSYMBOLITEMV2_H #define QGSLEGENDSYMBOLITEMV2_H #include <QString> #include "qgis_core.h" class QgsSymbol; /** \ingroup core * The class stores information about one class/rule of a vector layer renderer in a unified way * that can be used by legend model for rendering of legend. * * @see QgsSymbolLegendNode * @note added in 2.6 */ class CORE_EXPORT QgsLegendSymbolItem { public: QgsLegendSymbolItem(); //! Construct item. Does not take ownership of symbol (makes internal clone) //! @note parentRuleKey added in 2.8 QgsLegendSymbolItem( QgsSymbol *symbol, const QString &label, const QString &ruleKey, bool checkable = false, int scaleMinDenom = -1, int scaleMaxDenom = -1, int level = 0, const QString &parentRuleKey = QString() ); ~QgsLegendSymbolItem(); QgsLegendSymbolItem( const QgsLegendSymbolItem &other ); QgsLegendSymbolItem &operator=( const QgsLegendSymbolItem &other ); //! Return associated symbol. May be null. QgsSymbol *symbol() const { return mSymbol; } //! Return text label QString label() const { return mLabel; } //! Return unique identifier of the rule for identification of the item within renderer QString ruleKey() const { return mKey; } //! Return whether the item is user-checkable - whether renderer supports enabling/disabling it bool isCheckable() const { return mCheckable; } //! Used for older code that identifies legend entries from symbol pointer within renderer QgsSymbol *legacyRuleKey() const { return mOriginalSymbolPointer; } //! Determine whether given scale is within the scale range. Returns true if scale or scale range is invalid (value <= 0) bool isScaleOK( double scale ) const; //! Min scale denominator of the scale range. For range 1:1000 to 1:2000 this will return 1000. //! Value <= 0 means the range is unbounded on this side int scaleMinDenom() const { return mScaleMinDenom; } //! Max scale denominator of the scale range. For range 1:1000 to 1:2000 this will return 2000. //! Value <= 0 means the range is unbounded on this side int scaleMaxDenom() const { return mScaleMaxDenom; } //! Identation level that tells how deep the item is in a hierarchy of items. For flat lists level is 0 int level() const { return mLevel; } //! Key of the parent legend node. For legends with tree hierarchy //! @note added in 2.8 QString parentRuleKey() const { return mParentKey; } //! Set symbol of the item. Takes ownership of symbol. void setSymbol( QgsSymbol *s ); private: //! symbol. owned by the struct. can be null. QgsSymbol *mSymbol = nullptr; //! label of the item (may be empty or non-unique) QString mLabel; //! unique identifier of the symbol item (within renderer) QString mKey; //! whether it can be enabled/disabled bool mCheckable; QgsSymbol *mOriginalSymbolPointer = nullptr; // additional data that may be used for filtering int mScaleMinDenom; int mScaleMaxDenom; //! Identation level that tells how deep the item is in a hierarchy of items. For flat lists level is 0 int mLevel; //! Key of the parent legend node. For legends with tree hierarchy QString mParentKey; }; typedef QList< QgsLegendSymbolItem > QgsLegendSymbolListV2; #endif // QGSLEGENDSYMBOLITEMV2_H
/******************************************************************************\ This file is part of the Buildbotics Webserver. Copyright (c) 2014-2015, Cauldron Development LLC All rights reserved. The Buildbotics Webserver 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. The Buildbotics Webserver 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 software. If not, see <http://www.gnu.org/licenses/>. In addition, BSD licensing may be granted on a case by case basis by written permission from at least one of the copyright holders. You may request written permission by emailing the authors. For information regarding this software email: Joseph Coffland joseph@cauldrondevelopment.com \******************************************************************************/ #pragma once #include <cbang/event/WebServer.h> namespace Buildbotics { class App; class User; class Server : public cb::Event::WebServer { App &app; public: Server(App &app); void init(); // From cb::Event::WebServer cb::SmartPointer<cb::Event::Request> createRequest(cb::Event::RequestMethod method, const cb::URI &uri, const cb::Version &version); }; }
/* File: timer.h * * Purpose: Define a macro that returns the number of seconds that * have elapsed since some point in the past. The timer * should return times with nansecond accuracy. * * Note: The argument passed to the GET_TIME macro should be * a double, *not* a pointer to a double. * * Example: * #include "timer.h" * . . . * double start, finish, elapsed; * . . . * GET_TIME(start); * . . . * Code to be timed * . . . * GET_TIME(finish); * elapsed = finish - start; * printf("The code to be timed took %e seconds\n", elapsed); * * */ #ifndef _TIMER_H_ #define _TIMER_H_ #include <time.h> #define BILLION 1000000000L /* The argument now should be a double (not a pointer to a double) */ #define GET_TIME(now) { \ struct timespec t; \ clock_gettime(CLOCK_MONOTONIC, &t); \ now = t.tv_sec + (double)t.tv_nsec/BILLION; \ } #define GET_CPU_TIME(now) { \ struct timespec t; \ clock_gettime(CLOCK_PROCESS_CPUTIME_ID, &t); \ now = t.tv_sec + (double)t.tv_nsec/BILLION; \ } #endif
#include <stdio.h> #include <sys/time.h> #include <string.h> #include <stdlib.h> #include <math.h> #include "stencil/util.h" #include "stencil_sequential/stencil_sequential.h" int main(int argc, char **argv) { if (argv[1] == NULL) { fprintf(stdout, "ERROR: file argument missing"); return EXIT_FAILURE; } stencil_matrix_t *matrix = new_matrix_from_file(argv[1]); if (matrix == NULL) { return EXIT_FAILURE; } five_point_stencil_with_two_vectors(matrix, 5); matrix_to_file(matrix, stdout); stencil_matrix_free(matrix); return EXIT_SUCCESS; }
/* -*- 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. ------------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- Contributing author: Axel Kohlmeyer (Temple U) ------------------------------------------------------------------------- */ #ifdef PAIR_CLASS PairStyle(brownian/poly/omp,PairBrownianPolyOMP) #else #ifndef LMP_PAIR_BROWNIAN_POLY_OMP_H #define LMP_PAIR_BROWNIAN_POLY_OMP_H #include "pair_brownian_poly.h" #include "thr_omp.h" namespace LAMMPS_NS { class PairBrownianPolyOMP : public PairBrownianPoly, public ThrOMP { public: PairBrownianPolyOMP(class LAMMPS *); virtual ~PairBrownianPolyOMP(); virtual void compute(int, int); virtual double memory_usage(); protected: class RanMars **random_thr; int nthreads; private: template <int LOGFLAG, int EVFLAG> void eval(int ifrom, int ito, ThrData * const thr); }; } #endif #endif
/* * * Copyright (C) 2016 OtherCrashOverride@users.noreply.github.com. * All rights reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2, as * published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * more details. * */ #pragma once #include "Codec.h" #include "Buffer.h" #include <memory> enum class PinDirectionEnum { Out = 0, In }; enum class MediaCategoryEnum { Unknown = 0, Audio, Video, Subtitle, Clock, Picture }; enum class VideoFormatEnum { Unknown = 0, Mpeg2, Mpeg4V3, Mpeg4, Avc, VC1, Hevc, Yuv420, NV12, NV21 }; enum class AudioFormatEnum { Unknown = 0, Pcm, MpegLayer2, Mpeg2Layer3, Ac3, Aac, Dts, WmaPro, DolbyTrueHD, EAc3, Opus, Vorbis, PcmDvd, Flac }; enum class SubtitleFormatEnum { Unknown = 0, Text, SubRip, Pgs, //Presentation Graphic Stream Dvb, DvbTeletext }; enum class PictureFormatEnum { Unknown = 0, Image }; class PinInfo { MediaCategoryEnum category; public: MediaCategoryEnum Category() const { return category; } PinInfo(MediaCategoryEnum category) : category(category) { } }; typedef std::shared_ptr<PinInfo> PinInfoSPTR; typedef std::vector<unsigned char> ExtraData; typedef std::shared_ptr<std::vector<unsigned char>> ExtraDataSPTR; class VideoPinInfo : public PinInfo { public: VideoPinInfo() : PinInfo(MediaCategoryEnum::Video) { } VideoFormatEnum Format = VideoFormatEnum::Unknown; int Width = 0; int Height = 0; double FrameRate = 0; ExtraDataSPTR ExtraData; bool HasEstimatedPts = false; }; typedef std::shared_ptr<VideoPinInfo> VideoPinInfoSPTR; class AudioPinInfo : public PinInfo { public: AudioPinInfo() : PinInfo(MediaCategoryEnum::Audio) { } AudioFormatEnum Format = AudioFormatEnum::Unknown; int Channels = 0; int SampleRate = 0; ExtraDataSPTR ExtraData; }; typedef std::shared_ptr<AudioPinInfo> AudioPinInfoSPTR; class SubtitlePinInfo : public PinInfo { public: SubtitlePinInfo() : PinInfo(MediaCategoryEnum::Subtitle) { } SubtitleFormatEnum Format = SubtitleFormatEnum::Unknown; }; typedef std::shared_ptr<SubtitlePinInfo> SubtitlePinInfoSPTR; class PicturePinInfo : public PinInfo { public: PicturePinInfo() : PinInfo(MediaCategoryEnum::Picture) { } PictureFormatEnum Format = PictureFormatEnum::Unknown; }; typedef std::shared_ptr<PicturePinInfo> PicturePinInfoSPTR; // TODO: Move stream processing thread to Pin class Pin : public std::enable_shared_from_this<Pin> { PinDirectionEnum direction; ElementWPTR owner; PinInfoSPTR info; std::string name; protected: Pin(PinDirectionEnum direction, ElementWPTR owner, PinInfoSPTR info) : Pin(direction, owner, info, "Pin") { } Pin(PinDirectionEnum direction, ElementWPTR owner, PinInfoSPTR info, std::string name) : direction(direction), owner(owner), info(info), name(name) { if (owner.expired()) throw ArgumentNullException(); if (!info) throw ArgumentNullException(); } public: PinDirectionEnum Direction() const { return direction; } ElementWPTR Owner() const { return owner; } PinInfoSPTR Info() const { return info; } std::string Name() const { return name; } void SetName(std::string value) { name = value; } virtual ~Pin() { } virtual void Flush() { } }; template <typename T> // where T : PinSPTR class PinCollection { friend class Element; std::vector<T> pins; protected: void Add(T value) { if (!value) throw ArgumentNullException(); pins.push_back(value); } void Clear() { pins.clear(); } public: PinCollection() { } int Count() const { return pins.size(); } T Item(int index) { if (index < 0 || index >= (int)pins.size()) throw ArgumentOutOfRangeException(); return pins[index]; } void Flush() { for (auto pin : pins) { pin->Flush(); } } T FindFirst(MediaCategoryEnum category) { for (auto item : pins) { if (item->Info()->Category() == category) { return item; } } return nullptr; } T Find(MediaCategoryEnum category, int index) { // TODO: Disable this check for now until // a method to ignore a stream is added. // Until then, index=-1 is used. //if (index < 0) // throw ArgumentOutOfRangeException(); int count = 0; for (auto item : pins) { if (item->Info()->Category() == category) { if (count == index) { return item; } else { ++count; } } } return nullptr; } };
/* ============================================================== bstone-ios: Blake Stone Planet Strike for iOS Copyright (c) 1992-2013 Apogee Entertainment, LLC Copyright (c) 2013 Boris Bendovsky (bibendovsky@hotmail.com) Copyright (c) 2014 Ignacio Sanchez (ignacio.sanchez@geardome.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 _AN_CODES_H_ #define _AN_CODES_H_ //-------------------------------------------------------------------------- // // ANIM CODES - DOCS // //-------------------------------------------------------------------------- // // FI - Fade In the current frame (Last Frame grabbed) // FO - Fade Out the current frame (Last Frame grabbed) // FB - Fade In with rate (a numeral value should follow in the script) // ** MUST be a divisor of 64 // FE - Fade Out with rate (a numeral value should follow in the script) // ** MUST be a divisor of 64 // SD - Play sounds (a numeral value should follow in the script) // GR - Graphic Page (full screen) // // PA - Pause/Delay 'xxxxxx' number of VBLs // // // // // //-------------------------------------------------------------------------- // // MACROS // //-------------------------------------------------------------------------- #define MV_CNVT_CODE(c1,c2) ((Uint16)((c1)|(c2<<8))) #define AN_PAUSE MV_CNVT_CODE('P','A') #define AN_SOUND MV_CNVT_CODE('S','D') #define AN_MUSIC MV_CNVT_CODE('M','U') #define AN_PAGE MV_CNVT_CODE('G','R') #define AN_FADE_IN_FRAME MV_CNVT_CODE('F','I') #define AN_FADE_OUT_FRAME MV_CNVT_CODE('F','O') #define AN_FADE_IN MV_CNVT_CODE('F','B') #define AN_FADE_OUT MV_CNVT_CODE('F','E') #define AN_PALETTE MV_CNVT_CODE('P','L') #define AN_PRELOAD_BEGIN MV_CNVT_CODE('L','B') #define AN_PRELOAD_END MV_CNVT_CODE('L','E') #define AN_END_OF_ANIM MV_CNVT_CODE('X','X') #endif
#ifndef _BD_DEVICE_DRIVER_ #define _BD_DEVICE_DRIVER_ #include "types.h" class BDRequest; /** * @class BDDriver * abstract class * all functions are implemented in derived classes * */ class BDDriver { public: virtual ~BDDriver() { } virtual uint32 addRequest(BDRequest *) = 0; virtual int32 readSector(uint32, uint32, void *) = 0; virtual int32 writeSector(uint32, uint32, void *) = 0; virtual uint32 getNumSectors() = 0; virtual uint32 getSectorSize() = 0; virtual void serviceIRQ() = 0; uint16 irq; }; #endif
#include <stdlib.h> #include <stdio.h> #include <errno.h> #include "encl_common.h" #include "bluehawk.h" #include "homerun.h" #include "slider.h" /* * Factor byte0->status into the composite status cur. A missing element * (ES_NOT_INSTALLED) is ignored. A non-critical status is less severe * than critical. Otherwise assume that an increasing value of * element_status_code indicates and increasing severity. Return the more * severe of byte0->status and cur. */ enum element_status_code add_element_status(enum element_status_code cur, const struct element_status_byte0 *byte0) { enum element_status_code s = (enum element_status_code) byte0->status; if (s == ES_OK || s == ES_NOT_INSTALLED) return cur; if ((cur == ES_OK || cur == ES_NONCRITICAL) && s > ES_OK) return s; return cur; } /* * Calculate the composite status for the nel elements starting at * address first_element. We exploit the fact that every status element * is 4 bytes and starts with an element_status_byte0 struct. */ enum element_status_code composite_status(const void* first_element, int nel) { int i; const char *el = (const char*) first_element; enum element_status_code s = ES_OK; for (i = 0; i < nel; i++, el += 4) s = add_element_status(s, (const struct element_status_byte0*) el); return s; } /* bluehawk specific call */ enum element_status_code bh_roll_up_disk_status(const struct bluehawk_diag_page2 *pg) { return composite_status(&pg->disk_status, NR_DISKS_PER_BLUEHAWK); } enum element_status_code bh_roll_up_esm_status(const struct bluehawk_diag_page2 *pg) { return composite_status(&pg->esm_status, 2); } enum element_status_code bh_roll_up_temperature_sensor_status(const struct bluehawk_diag_page2 *pg) { return composite_status(&pg->temp_sensor_sets, 2 * 7); } enum element_status_code bh_roll_up_fan_status(const struct bluehawk_diag_page2 *pg) { return composite_status(&pg->fan_sets, 2 * 5); } enum element_status_code bh_roll_up_power_supply_status(const struct bluehawk_diag_page2 *pg) { return composite_status(&pg->ps_status, 2); } enum element_status_code bh_roll_up_voltage_sensor_status(const struct bluehawk_diag_page2 *pg) { return composite_status(&pg->voltage_sensor_sets, 2 * 2); } enum element_status_code bh_roll_up_sas_connector_status(const struct bluehawk_diag_page2 *pg) { return composite_status(&pg->sas_connector_status, 4); } /* Is this valid? */ enum element_status_code bh_roll_up_scc_controller_status(const struct bluehawk_diag_page2 *pg) { return composite_status(&pg->scc_controller_status, 2); } unsigned int bh_mean_temperature(const struct bluehawk_diag_page2 *pg) { struct temperature_sensor_status *sensors = (struct temperature_sensor_status *) &pg->temp_sensor_sets; int sum = 0; int i; for (i = 0; i < 2*7; i++) sum += sensors[i].temperature; return sum / (2*7); } /* homerun specific call */ enum element_status_code hr_roll_up_disk_status(const struct hr_diag_page2 *pg) { return composite_status(&pg->disk_status, HR_NR_DISKS); } enum element_status_code hr_roll_up_esm_status(const struct hr_diag_page2 *pg) { return composite_status(&pg->esm_status, HR_NR_ESM_CONTROLLERS); } enum element_status_code hr_roll_up_temperature_sensor_status(const struct hr_diag_page2 *pg) { return composite_status(&pg->temp_sensor_sets, HR_NR_TEMP_SENSOR_SET * 4); } enum element_status_code hr_roll_up_fan_status(const struct hr_diag_page2 *pg) { return composite_status(&pg->fan_sets, HR_NR_FAN_SET * HR_NR_FAN_ELEMENT_PER_SET); } enum element_status_code hr_roll_up_power_supply_status(const struct hr_diag_page2 *pg) { return composite_status(&pg->ps_status, HR_NR_POWER_SUPPLY); } enum element_status_code hr_roll_up_voltage_sensor_status(const struct hr_diag_page2 *pg) { return composite_status(&pg->voltage_sensor_sets, HR_NR_VOLTAGE_SENSOR_SET * 3); } unsigned int hr_mean_temperature(const struct hr_diag_page2 *pg) { struct temperature_sensor_status *sensors = (struct temperature_sensor_status *) &pg->temp_sensor_sets; int sum = 0; int i; for (i = 0; i < HR_NR_TEMP_SENSOR_SET * 4; i++) sum += sensors[i].temperature; return sum / (HR_NR_TEMP_SENSOR_SET * 4); } /* slider specific call */ enum element_status_code slider_roll_up_disk_status(const struct slider_lff_diag_page2 *pg) { return composite_status(&pg->disk_status, SLIDER_NR_LFF_DISK); } enum element_status_code slider_roll_up_esm_status(const struct slider_lff_diag_page2 *pg) { return composite_status(&pg->enc_service_ctrl_element, SLIDER_NR_ESC); } enum element_status_code slider_roll_up_temperature_sensor_status(const struct slider_lff_diag_page2 *pg) { return composite_status(&pg->temp_sensor_sets, SLIDER_NR_TEMP_SENSOR); } enum element_status_code slider_roll_up_fan_status(const struct slider_lff_diag_page2 *pg) { return composite_status(&pg->fan_sets, SLIDER_NR_POWER_SUPPLY * SLIDER_NR_FAN_PER_POWER_SUPPLY); } enum element_status_code slider_roll_up_power_supply_status(const struct slider_lff_diag_page2 *pg) { return composite_status(&pg->ps_status, SLIDER_NR_POWER_SUPPLY); } enum element_status_code slider_roll_up_voltage_sensor_status(const struct slider_lff_diag_page2 *pg) { return composite_status(&pg->voltage_sensor_sets, SLIDER_NR_VOLT_SENSOR_PER_ESM * SLIDER_NR_ESC); } enum element_status_code slider_roll_up_sas_connector_status(const struct slider_lff_diag_page2 *pg) { return composite_status(&pg->sas_connector_status, SLIDER_NR_SAS_CONNECTOR); } unsigned int slider_mean_temperature(const struct slider_lff_diag_page2 *pg) { struct temperature_sensor_status *sensors = (struct temperature_sensor_status *) &pg->temp_sensor_sets; int sum = 0; int i; for (i = 0; i < SLIDER_NR_TEMP_SENSOR; i++) sum += sensors[i].temperature; return sum / (SLIDER_NR_TEMP_SENSOR); }
/*********************************************************************************** Filename: hal_timer_32k.c Description: hal 32KHz timer ***********************************************************************************/ /*********************************************************************************** * INCLUDES */ #include "hal_types.h" #include "hal_defs.h" #include "hal_timer_32k.h" #include "hal_board.h" #include "hal_int.h" /*********************************************************************************** * LOCAL VARIABLES */ static ISR_FUNC_PTR fptr; static uint16 mode; /*********************************************************************************** * @fn halTimer32kInit * * @brief Set up timer B to generate an interrupt every "cycles" 32768 Hz * clock cycles. * Use halTimerIntConnect() to connect an ISR to the interrupt. * * @param uint16 cycles - Number of cycles between interrupt * * @return none */ void halTimer32kInit(uint16 cycles) { uint16 clock_divider = ID_0; // Default - don't divide input clock // Set compare value TBCCR0 = cycles; // Compare mode, clear interrupt pending flag, disable interrupt TBCCTL0 = 0; // Timer source ACLK // Use calculated divider // Count up to TACCR0 // Clear timer mode = TBSSEL_1 | clock_divider | MC_1 | TBCLR; TBCTL = mode; } /*********************************************************************************** * @fn halTimer32kRestart * * @brief Restart timer B. The timer is first stopped, then restarted, * counting up from 0 * * @param none * * @return none */ void halTimer32kRestart(void) { TBCTL = 0; // Avoid compiler optimization (skipping the line above) asm(" nop"); TBCTL = mode; } /*********************************************************************************** * @fn halTimer32kIntConnect * * @brief Connect function to timer interrupt * * @param ISR_FUNC_PTR isr - pointer to function * * @return none */ void halTimer32kIntConnect(ISR_FUNC_PTR isr) { istate_t key; HAL_INT_LOCK(key); fptr = isr; HAL_INT_UNLOCK(key); } /*********************************************************************************** * @fn halTimer32kIntEnable * * @brief Enable 32KHz timer interrupt * * @param none * * @return none */ void halTimer32kIntEnable(void) { TBCCTL0 |= CCIE; } /*********************************************************************************** * @fn halTimer32kIntDisable * * @brief Disable 32KHz timer interrupt * * @param none * * @return none */ void halTimer32kIntDisable(void) { TBCCTL0 &= ~CCIE; } /*********************************************************************************** * @fn timer32k0_ISR * * @brief ISR framework for the 32KHz timer component * * @param none * * @return none */ #pragma vector=TIMERB0_VECTOR __interrupt void timer32k0_ISR(void) { if (fptr != NULL) { (*fptr)(); } __low_power_mode_off_on_exit(); } /*********************************************************************************** Copyright 2007 Texas Instruments Incorporated. All rights reserved. IMPORTANT: Your use of this Software is limited to those specific rights granted under the terms of a software license agreement between the user who downloaded the software, his/her employer (which must be your employer) and Texas Instruments Incorporated (the "License"). You may not use this Software unless you agree to abide by the terms of the License. The License limits your use, and you acknowledge, that the Software may not be modified, copied or distributed unless embedded on a Texas Instruments microcontroller or used solely and exclusively in conjunction with a Texas Instruments radio frequency transceiver, which is integrated into your product. Other than for the foregoing purpose, you may not use, reproduce, copy, prepare derivative works of, modify, distribute, perform, display or sell this Software and/or its documentation for any purpose. YOU FURTHER ACKNOWLEDGE AND AGREE THAT THE SOFTWARE AND DOCUMENTATION ARE PROVIDED “AS IS?WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION, ANY WARRANTY OF MERCHANTABILITY, TITLE, NON-INFRINGEMENT AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL TEXAS INSTRUMENTS OR ITS LICENSORS BE LIABLE OR OBLIGATED UNDER CONTRACT, NEGLIGENCE, STRICT LIABILITY, CONTRIBUTION, BREACH OF WARRANTY, OR OTHER LEGAL EQUITABLE THEORY ANY DIRECT OR INDIRECT DAMAGES OR EXPENSES INCLUDING BUT NOT LIMITED TO ANY INCIDENTAL, SPECIAL, INDIRECT, PUNITIVE OR CONSEQUENTIAL DAMAGES, LOST PROFITS OR LOST DATA, COST OF PROCUREMENT OF SUBSTITUTE GOODS, TECHNOLOGY, SERVICES, OR ANY CLAIMS BY THIRD PARTIES (INCLUDING BUT NOT LIMITED TO ANY DEFENSE THEREOF), OR OTHER SIMILAR COSTS. Should you have any questions regarding your right to use this Software, contact Texas Instruments Incorporated at www.TI.com. ***********************************************************************************/
/* Copyright (c) 2015 Daniel John Erdos 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. */ using namespace std; class PMAIN0A : public pApplication { public: PMAIN0A() ; void application() ; private: void create_calendar(int =0, int =0 ) ; int offset ; string msg ; string zarea ; string zshadow ; string zdatel ; string zdate ; string ztime ; string zjdate ; string zcurfld ; int zcurpos ; };
/* SPDX-License-Identifier: GPL-2.0-only */ #ifndef _PCI_MMIO_CFG_H #define _PCI_MMIO_CFG_H #include <stdint.h> #include <device/mmio.h> #include <device/pci_type.h> /* By not assigning this to CONFIG_MMCONF_BASE_ADDRESS here we * prevent some sub-optimal constant folding. */ extern u8 *const pci_mmconf; /* Using a unique datatype for MMIO writes makes the pointers to _not_ * qualify for pointer aliasing with any other objects in memory. * * MMIO offset is a value originally derived from 'struct device *' * in ramstage. For the compiler to not discard this MMIO offset value * from CPU registers after any MMIO writes, -fstrict-aliasing has to * be also set for the build. * * Bottom 12 bits (4 KiB) are reserved to address the registers of a * single PCI function. Declare the bank as a union to avoid some casting * in the functions below. */ union pci_bank { uint8_t reg8[4096]; uint16_t reg16[4096 / sizeof(uint16_t)]; uint32_t reg32[4096 / sizeof(uint32_t)]; }; static __always_inline volatile union pci_bank *pcicfg(pci_devfn_t dev) { return (void *)&pci_mmconf[PCI_DEVFN_OFFSET(dev)]; } static __always_inline uint8_t pci_mmio_read_config8(pci_devfn_t dev, uint16_t reg) { return pcicfg(dev)->reg8[reg]; } static __always_inline uint16_t pci_mmio_read_config16(pci_devfn_t dev, uint16_t reg) { return pcicfg(dev)->reg16[reg / sizeof(uint16_t)]; } static __always_inline uint32_t pci_mmio_read_config32(pci_devfn_t dev, uint16_t reg) { return pcicfg(dev)->reg32[reg / sizeof(uint32_t)]; } static __always_inline void pci_mmio_write_config8(pci_devfn_t dev, uint16_t reg, uint8_t value) { pcicfg(dev)->reg8[reg] = value; } static __always_inline void pci_mmio_write_config16(pci_devfn_t dev, uint16_t reg, uint16_t value) { pcicfg(dev)->reg16[reg / sizeof(uint16_t)] = value; } static __always_inline void pci_mmio_write_config32(pci_devfn_t dev, uint16_t reg, uint32_t value) { pcicfg(dev)->reg32[reg / sizeof(uint32_t)] = value; } /* * The functions pci_mmio_config*_addr provide a way to determine the MMIO address of a PCI * config register. The address returned is dependent of both the MMCONF base address and the * assigned PCI bus number of the requested device, which both can change during the boot * process. Thus, the pointer returned here must not be cached! */ static __always_inline uint8_t *pci_mmio_config8_addr(pci_devfn_t dev, uint16_t reg) { return (uint8_t *)&pcicfg(dev)->reg8[reg]; } static __always_inline uint16_t *pci_mmio_config16_addr(pci_devfn_t dev, uint16_t reg) { return (uint16_t *)&pcicfg(dev)->reg16[reg / sizeof(uint16_t)]; } static __always_inline uint32_t *pci_mmio_config32_addr(pci_devfn_t dev, uint16_t reg) { return (uint32_t *)&pcicfg(dev)->reg32[reg / sizeof(uint32_t)]; } #if CONFIG(MMCONF_SUPPORT) #if CONFIG_MMCONF_BASE_ADDRESS == 0 #error "CONFIG_MMCONF_BASE_ADDRESS undefined!" #endif #if CONFIG_MMCONF_BUS_NUMBER * MiB != CONFIG_MMCONF_LENGTH #error "CONFIG_MMCONF_LENGTH does not correspond with CONFIG_MMCONF_BUS_NUMBER!" #endif /* Avoid name collisions as different stages have different signature * for these functions. The _s_ stands for simple, fundamental IO or * MMIO variant. */ static __always_inline uint8_t pci_s_read_config8(pci_devfn_t dev, uint16_t reg) { return pci_mmio_read_config8(dev, reg); } static __always_inline uint16_t pci_s_read_config16(pci_devfn_t dev, uint16_t reg) { return pci_mmio_read_config16(dev, reg); } static __always_inline uint32_t pci_s_read_config32(pci_devfn_t dev, uint16_t reg) { return pci_mmio_read_config32(dev, reg); } static __always_inline void pci_s_write_config8(pci_devfn_t dev, uint16_t reg, uint8_t value) { pci_mmio_write_config8(dev, reg, value); } static __always_inline void pci_s_write_config16(pci_devfn_t dev, uint16_t reg, uint16_t value) { pci_mmio_write_config16(dev, reg, value); } static __always_inline void pci_s_write_config32(pci_devfn_t dev, uint16_t reg, uint32_t value) { pci_mmio_write_config32(dev, reg, value); } #endif #endif /* _PCI_MMIO_CFG_H */
/* Regexp.chpl:338 */ static void chpl__init_Regexp(int64_t _ln_chpl, int32_t _fn_chpl) { c_string modFormatStr_chpl; c_string modStr_chpl; _ref_int32_t refIndentLevel_chpl = NULL; #line 338 "Regexp.chpl" if (chpl__init_Regexp_p) /* ZLINE: 338 /home/agobin/Documents/chapel-1.13.0/modules/standard/Regexp.chpl */ #line 338 "Regexp.chpl" { #line 338 "Regexp.chpl" goto _exit_chpl__init_Regexp_chpl; #line 338 "Regexp.chpl" } #line 338 "Regexp.chpl" modFormatStr_chpl = "%*s\n"; #line 338 "Regexp.chpl" modStr_chpl = "Regexp"; #line 338 "Regexp.chpl" printModuleInit(modFormatStr_chpl, modStr_chpl, INT64(6), _ln_chpl, _fn_chpl); #line 338 "Regexp.chpl" refIndentLevel_chpl = &moduleInitLevel; #line 338 "Regexp.chpl" *(refIndentLevel_chpl) += INT64(1); #line 338 "Regexp.chpl" chpl__init_Regexp_p = UINT8(true); #line 338 "Regexp.chpl" *(refIndentLevel_chpl) -= INT64(1); #line 338 "Regexp.chpl" _exit_chpl__init_Regexp_chpl:; #line 338 "Regexp.chpl" return; #line 338 "Regexp.chpl" }
// Excel2SQLiteDlg.h : Í·Îļþ // #pragma once #include "afxwin.h" #include "afxcmn.h" #include "ExcelWriter.h" #include "BaseLib/xXmlDocument.h" USING_NS_XEVOL3D // CExcel2SQLiteDlg ¶Ô»°¿ò class CExcel2SQLiteDlg : public CDialog { // ¹¹Ôì public: CExcel2SQLiteDlg(CWnd* pParent = NULL); // ±ê×¼¹¹Ô캯Êý ~CExcel2SQLiteDlg(); // ¶Ô»°¿òÊý¾Ý enum { IDD = IDD_EXCEL2SQLITE_DIALOG }; protected: virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV Ö§³Ö virtual void SelectExcelSheet(int iSheet); void GenerateSQL(); // ʵÏÖ protected: HICON m_hIcon; // Éú³ÉµÄÏûÏ¢Ó³É亯Êý virtual BOOL OnInitDialog(); afx_msg void OnSysCommand(UINT nID, LPARAM lParam); afx_msg void OnPaint(); afx_msg HCURSOR OnQueryDragIcon(); DECLARE_MESSAGE_MAP() public: CComboBox m_cbExcelSheets; CComboBox m_cbExcelKey; CListCtrl m_ListExcelFields; CComboBox m_cbSqliteTable; CListCtrl m_listExcelData; CEdit m_textUpdateSql; CEdit m_textInsertExcel; xXmlNode m_DataField; xXmlNode m_ExcelData; IExcelWriter* m_pExcelWriter; std::wstring m_strUpdateSQL; std::wstring m_strQuerySQL; std::wstring m_strInsertSQL; afx_msg void OnBnClickedBtnOpenSqlite(); void UpdateSQliteTable() ; afx_msg void OnBnClickedBtnOpenExcel(); afx_msg void OnCbnSelchangeListExcelSheet(); afx_msg void OnCbnSelchangeExcelKey(); afx_msg void OnCbnSelchangeSqliteTable(); afx_msg void OnBnClickedBtnExcute(); afx_msg void OnBnClickedBtnGenSql(); };
// // CAIYiyantangGuest.h // netWork // // Created by mac on 14/11/24. // Copyright (c) 2014年 mac. All rights reserved. // #import "MTLModel.h" #import "Mantle.h" @interface CAIYiyantangMember : MTLModel <MTLJSONSerializing> @property (nonatomic, strong)NSString * desc; @property (nonatomic, strong)NSString * imageUrlString; @property (nonatomic, strong)NSString * memcard; @property (nonatomic, strong)NSString * name; @end
/** * Copyright (C) 2007 Stefan Buettcher. All rights reserved. * This is free software with ABSOLUTELY NO WARRANTY. * * 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 **/ /** * FakeIndex sits on top of an Index instance and is used by the ClientConnection * class to pre-parse queries without fetching any data from the index. We use * FakeIndex in order to avoid fetching postings for syntactically incorrect queries. * There is one exception, however: The cache management methods are fully * functional, and all messages passed to them are directly forwarded to the under- * lying Index instance. * * author: Stefan Buettcher * created: 2005-08-01 * changed: 2007-12-17 **/ #ifndef __INDEX__FAKEINDEX_H #define __INDEX__FAKEINDEX_H #include "index.h" #include "../extentlist/extentlist.h" #include "../misc/all.h" #include <string.h> class FakeIndex : public Index { private: /** The underlying Index instance. **/ Index *index; public: /** Creates a new FakeIndex instance sitting on top of the given Index. **/ FakeIndex(Index *index) { this->index = index; indexType = TYPE_FAKEINDEX; } virtual ~FakeIndex() { } virtual int notify(const char *event) { return 0; } virtual void notifyOfAddressSpaceChange(int signum, offset start, offset end) { } virtual ExtentList *getPostings(const char *term, uid_t userID); virtual ExtentList *getPostings(const char *term, uid_t userID, bool fromDisk, bool fromMemory); virtual void getPostings(char **terms, int termCount, uid_t userID, ExtentList **results); virtual void addAnnotation(offset position, const char *annotation) { } virtual inline void getAnnotation(offset position, char *buffer) { buffer[0] = 0; } virtual inline void removeAnnotation(offset position) { } virtual inline offset getBiggestOffset() { return 0; } virtual inline int getDocumentType(const char *fullPath) { return -1; } virtual inline bool getLastIndexToTextSmallerEq(offset where, offset *indexPosition, off_t *filePosition) { return false; } virtual inline uid_t getOwner() { return index->getOwner(); } virtual inline VisibleExtents *getVisibleExtents(uid_t userID, bool merge) { return NULL; } virtual inline void getDictionarySize(offset *lowerBound, offset *upperBound) { *lowerBound = *upperBound = 0; } virtual inline int64_t registerForUse() { return 1; } virtual inline int64_t registerForUse(int64_t suggestedID) { return suggestedID + 1; } virtual inline void deregister(int64_t id) { } virtual inline void waitForUsersToFinish() { } virtual inline void getIndexSummary(char *buffer) { buffer[0] = 0; } virtual inline int64_t getTimeStamp(bool withLocking) { return index->getTimeStamp(withLocking); } virtual inline ExtentList *getCachedList(const char *queryString) { return index->getCachedList(queryString); } virtual inline IndexCache *getCache() { return index->getCache(); } virtual inline void compact() { } virtual void sync() { } protected: virtual void getConfiguration() { } virtual void setMountPoint(const char *mountPoint) { } virtual void getClassName(char *target) { strcpy(target, "FakeIndex"); } }; // end of class FakeIndex #endif
/* environ.c -- library for manipulating environments for GNU. Copyright 1986, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 2000, 2005 2003 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. */ #define min(a, b) ((a) < (b) ? (a) : (b)) #define max(a, b) ((a) > (b) ? (a) : (b)) #include "defs.h" #include "environ.h" #include "gdb_string.h" /* Return a new environment object. */ struct gdb_environ * make_environ (void) { struct gdb_environ *e; e = (struct gdb_environ *) xmalloc (sizeof (struct gdb_environ)); e->allocated = 10; e->vector = (char **) xmalloc ((e->allocated + 1) * sizeof (char *)); e->vector[0] = 0; return e; } /* Free an environment and all the strings in it. */ void free_environ (struct gdb_environ *e) { char **vector = e->vector; while (*vector) xfree (*vector++); xfree (e); } /* Copy the environment given to this process into E. Also copies all the strings in it, so we can be sure that all strings in these environments are safe to free. */ void init_environ (struct gdb_environ *e) { extern char **environ; int i; if (environ == NULL) return; for (i = 0; environ[i]; i++) /*EMPTY */ ; if (e->allocated < i) { e->allocated = max (i, e->allocated + 10); e->vector = (char **) xrealloc ((char *) e->vector, (e->allocated + 1) * sizeof (char *)); } memcpy (e->vector, environ, (i + 1) * sizeof (char *)); while (--i >= 0) { int len = strlen (e->vector[i]); char *new = (char *) xmalloc (len + 1); memcpy (new, e->vector[i], len + 1); e->vector[i] = new; } } /* Return the vector of environment E. This is used to get something to pass to execve. */ char ** environ_vector (struct gdb_environ *e) { return e->vector; } /* Return the value in environment E of variable VAR. */ char * get_in_environ (const struct gdb_environ *e, const char *var) { int len = strlen (var); char **vector = e->vector; char *s; for (; (s = *vector) != NULL; vector++) if (strncmp (s, var, len) == 0 && s[len] == '=') return &s[len + 1]; return 0; } /* Store the value in E of VAR as VALUE. */ void set_in_environ (struct gdb_environ *e, const char *var, const char *value) { int i; int len = strlen (var); char **vector = e->vector; char *s; for (i = 0; (s = vector[i]) != NULL; i++) if (strncmp (s, var, len) == 0 && s[len] == '=') break; if (s == 0) { if (i == e->allocated) { e->allocated += 10; vector = (char **) xrealloc ((char *) vector, (e->allocated + 1) * sizeof (char *)); e->vector = vector; } vector[i + 1] = 0; } else xfree (s); s = (char *) xmalloc (len + strlen (value) + 2); strcpy (s, var); strcat (s, "="); strcat (s, value); vector[i] = s; /* This used to handle setting the PATH and GNUTARGET variables specially. The latter has been replaced by "set gnutarget" (which has worked since GDB 4.11). The former affects searching the PATH to find SHELL, and searching the PATH to find the argument of "symbol-file" or "exec-file". Maybe we should have some kind of "set exec-path" for that. But in any event, having "set env" affect anything besides the inferior is a bad idea. What if we want to change the environment we pass to the program without afecting GDB's behavior? */ return; } /* Remove the setting for variable VAR from environment E. */ void unset_in_environ (struct gdb_environ *e, char *var) { int len = strlen (var); char **vector = e->vector; char *s; for (; (s = *vector) != NULL; vector++) { if (strncmp (s, var, len) == 0 && s[len] == '=') { xfree (s); /* Walk through the vector, shuffling args down by one, including the NULL terminator. Can't use memcpy() here since the regions overlap, and memmove() might not be available. */ while ((vector[0] = vector[1]) != NULL) { vector++; } break; } } }
/* * utf8.c * * utf8 support routines * Copyright (C) 2002-2007 George M. Tzoumas * * 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 <stdlib.h> #include <string.h> #include "utf8.h" int wstrwidth(const wchar_t *s, size_t n) { int l = 0; for (; *s != 0; s++) l += wcwidth_nl(*s); if (l <= n) return l; else return n; } int strlen_utf8(char *s, int *len) { unsigned char *t = (unsigned char *) s; int k, i; k = i = 0; while (*t) { i++; if (((*t) & 0xc0) == 0x80) k++; t++; } if (len != NULL) *len = i; return i-k; } int strnlen_utf8(char *s, int n, int *len) { unsigned char *t = (unsigned char *) s; int k, i, m = 0; k = i = 0; while (*t) { i++; if (((*t) & 0xc0) == 0xc0) m = 1; else if (((*t) & 0xc0) == 0x80) k++, m++; else m = 0; if (i > n) break; t++; } if (*t == 0) m = 0; if (len != NULL) *len = i - m; return i-k-m; } /* len = size of buffer including \0 */ int stroffset(char *s, int n, int len) { unsigned char *t = (unsigned char *) s; int c, i; c = i = 0; while (*t) { if (c == n) break; if (((*t) < 0x80) || ((*t) & 0xc0) == 0xc0) c++; i++; t++; } return (*t)? i-1: len - 1; } int seqlen(int c) { if (c < 0x80) return 1; if ((c & 0xe0) == 0xc0) return 2; if ((c & 0xf0) == 0xe0) return 3; if ((c & 0xf8) == 0xf0) return 4; if ((c & 0xfc) == 0xf8) return 5; if ((c & 0xfe) == 0xfc) return 6; return 0; } int strwidth(char *s) { mbstate_t mbs; wchar_t *w; const char *str = s; int len, wlen, width; if (s == NULL || *s == 0) return 0; len = strlen(s); w = (wchar_t *) malloc((len+1)*sizeof(wchar_t)); memset(&mbs, 0, sizeof(mbs)); wlen = mbsrtowcs(w, &str, len+1, &mbs); if (wlen < 0) { free(w); return 0; } width = wstrwidth(w, wlen); free(w); return width; } int widthoffset(char *s, int width) { mbstate_t mbs; wchar_t *w; const char *str = s; int len, wlen, i; if (s == NULL) return -1; len = strlen(s); if (len == 0) return 0; w = (wchar_t *) malloc((len+1)*sizeof(wchar_t)); memset(&mbs, 0, sizeof(mbs)); wlen = mbsrtowcs(w, &str, len+1, &mbs); /* wlen = wcslen(w); */ for (i = 0; i < wlen; i++) { if (wstrwidth(w, i+1) > width) { free(w); return stroffset(s, i+1, len+1); } } free(w); return len; }
#include <linux/init.h> #include <linux/pci.h> /* PCI interrupt pins */ #define PCIA 1 #define PCIB 2 #define PCIC 3 #define PCID 4 /* This table is filled in by interrogating the PIIX4 chip */ static char pci_irq[5] __initdata; static char irq_tab[][5] __initdata = { /* INTA INTB INTC INTD */ {0, 0, 0, 0, 0 }, /* 0: GT64120 PCI bridge */ {0, 0, 0, 0, 0 }, /* 1: Unused */ {0, 0, 0, 0, 0 }, /* 2: Unused */ {0, 0, 0, 0, 0 }, /* 3: Unused */ {0, 0, 0, 0, 0 }, /* 4: Unused */ {0, 0, 0, 0, 0 }, /* 5: Unused */ {0, 0, 0, 0, 0 }, /* 6: Unused */ {0, 0, 0, 0, 0 }, /* 7: Unused */ {0, 0, 0, 0, 0 }, /* 8: Unused */ {0, 0, 0, 0, 0 }, /* 9: Unused */ {0, 0, 0, 0, PCID }, /* 10: PIIX4 USB */ {0, PCIB, 0, 0, 0 }, /* 11: AMD 79C973 Ethernet */ {0, PCIC, 0, 0, 0 }, /* 12: Crystal 4281 Sound */ {0, 0, 0, 0, 0 }, /* 13: Unused */ {0, 0, 0, 0, 0 }, /* 14: Unused */ {0, 0, 0, 0, 0 }, /* 15: Unused */ {0, 0, 0, 0, 0 }, /* 16: Unused */ {0, 0, 0, 0, 0 }, /* 17: Bonito/SOC-it PCI Bridge*/ {0, PCIA, PCIB, PCIC, PCID }, /* 18: PCI Slot 1 */ {0, PCIB, PCIC, PCID, PCIA }, /* 19: PCI Slot 2 */ {0, PCIC, PCID, PCIA, PCIB }, /* 20: PCI Slot 3 */ {0, PCID, PCIA, PCIB, PCIC } /* 21: PCI Slot 4 */ }; int __init pcibios_map_irq(struct pci_dev *dev, u8 slot, u8 pin) { int virq; virq = irq_tab[slot][pin]; return pci_irq[virq]; } static void __init malta_piix_func0_fixup(struct pci_dev *pdev) { unsigned char reg_val; static int piixirqmap[16] __initdata = { /* PIIX PIRQC[A:D] irq mappings */ 0, 0, 0, 3, 4, 5, 6, 7, 0, 9, 10, 11, 12, 0, 14, 15 }; int i; /* Interrogate PIIX4 to get PCI IRQ mapping */ for (i = 0; i <= 3; i++) { pci_read_config_byte(pdev, 0x60+i, &reg_val); if (reg_val & 0x80) pci_irq[PCIA+i] = 0; /* Disabled */ else pci_irq[PCIA+i] = piixirqmap[reg_val & 15]; } /* Done by YAMON 2.00 onwards */ if (PCI_SLOT(pdev->devfn) == 10) { /* * Set top of main memory accessible by ISA or DMA * devices to 16 Mb. */ pci_read_config_byte(pdev, 0x69, &reg_val); pci_write_config_byte(pdev, 0x69, reg_val | 0xf0); } } static void __init malta_piix_func1_fixup(struct pci_dev *pdev) { unsigned char reg_val; /* Done by YAMON 2.02 onwards */ if (PCI_SLOT(pdev->devfn) == 10) { /* * IDE Decode enable. */ pci_read_config_byte(pdev, 0x41, &reg_val); pci_write_config_byte(pdev, 0x41, reg_val|0x80); pci_read_config_byte(pdev, 0x43, &reg_val); pci_write_config_byte(pdev, 0x43, reg_val|0x80); } } struct pci_fixup pcibios_fixups[] = { {PCI_FIXUP_HEADER, PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82371AB_0, malta_piix_func0_fixup}, {PCI_FIXUP_HEADER, PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82371AB, malta_piix_func1_fixup}, { 0 } };
/* <one line to give the program's name and a brief idea of what it does.> Copyright (C) 2013 PCMan <email> 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 LXPANEL_NETSTATUSAPPLET_H #define LXPANEL_NETSTATUSAPPLET_H #include "../../applet.h" #include <QLabel> #include <QTimer> #include <QIcon> #include <glib.h> namespace Lxpanel { class NetStatusApplet : public Lxpanel::Applet { Q_OBJECT public: virtual QWidget* widget() { return iconLabel_; } explicit NetStatusApplet(AppletInfo* info, QWidget* parent = 0); virtual ~NetStatusApplet(); virtual bool loadSettings(QDomElement& element); virtual bool saveSettings(QDomElement& element); virtual void preferences(); private: void loadIcons(); QIcon loadIcon(const char** names, int num); private Q_SLOTS: void onTimeout(); private: QLabel* iconLabel_; QTimer timer_; QString iface; // network interface guint64 last_rx; guint64 last_tx; QIcon icon_error; QIcon icon_idle; QIcon icon_offline; QIcon icon_rx; QIcon icon_tx; QIcon icon_tx_rx; }; } #endif // LXPANEL_NETSTATUSAPPLET_H
/* Copyright 2012 Guillem Vinals Gangolells <guillem@guillem.co.uk> Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ #ifndef __SDP_H__ #define __SDP_H__ #include "bt_common.h" #define SDP_DATA_T_NIL 0x00 #define SDP_DATA_T_UINT 0x08 #define SDP_DATA_T_SINT 0x10 #define SDP_DATA_T_UUID 0x18 #define SDP_DATA_T_STR 0x20 #define SDP_DATA_T_bool 0x28 #define SDP_DATA_T_DES 0x30 #define SDP_DATA_T_DEA 0x38 #define SDP_DATA_T_URL 0x40 #define SDP_DATA_S_8 0x0 #define SDP_DATA_S_16 0x1 #define SDP_DATA_S_32 0x2 #define SDP_DATA_S_64 0x3 #define SDP_DATA_S_128 0x4 #define SDP_DATA_S_1B 0x5 #define SDP_DATA_S_2B 0x6 #define SDP_DATA_S_4B 0x7 /* PDU identifiers */ #define SDP_ERR_PDU 0x01 #define SDP_SS_PDU 0x02 #define SDP_SSR_PDU 0x03 #define SDP_SA_PDU 0x04 #define SDP_SAR_PDU 0x05 #define SDP_SSA_PDU 0x06 #define SDP_SSAR_PDU 0x07 /* Response lengths and sizes */ #define SDP_HDR_LEN 5 /* * ServiceSearchReq minimum Length: 7byte * ServiceSearchPattern (with at least one UUID16) = 4byte * MaxServiceRecordCount = 2byte * ContinuationSate = 1byte */ #define SDP_SS_REQ_MIN_LEN 7 /* * ServiceSearchRsp minimum Length: 5byte * TotalServiceRecordCount = 2byte * CurrentServiceRecordCount = 2byte * ServiceRecordHandleList = 0byte * ContinuationSate = 1byte */ #define SDP_SS_RSP_MIN_LEN 5 /* * ServiceAttributeReq minimum Length: 11byte * ServiceRecordHandle = 4byte * MaxAttributeByteCount = 2byte * AttributeIDList (with at least one ID) = 4byte * ContinuationSate = 1byte */ #define SDP_SA_REQ_MIN_LEN 11 /* * ServiceSearchAttributeRsp minimum Length: 3byte * AttributeListsByteCount = 2byte * AttributeList (with 0 attributes) = 0byte * ContinuationSate = 1byte */ #define SDP_SA_RSP_MIN_LEN 3 /* * ServiceSearchAttributeReq minimum Length: 11byte * ServiceSearchPattern (with at least one UUID16) = 4byte * MaxAttributeByteCount = 2byte * AttributeIDList (with at least one ID) = 4byte * ContinuationSate = 1byte */ #define SDP_SSA_REQ_MIN_LEN 11 /* * ServiceAttributeRsp minimum Length: 3byte * AttributeListsByteCount = 2byte * AttributeList (with 0 attributes) = 0byte * ContinuationSate = 1byte */ #define SDP_SSA_RSP_MIN_LEN 3 #define SDP_MAX_FRAME_SIZE 128 #define SDP_SERVICE_RFCOMM_ENABLE #define SDP_SERVICE_COUNT 1 typedef struct _SDP_SERIVCE_ATTRIBUTE { /* Attribute ID */ UINT16 uID; /* Attribute Value */ UINT uValueLen; BYTE *pValue; } SDP_SERVICE_ATTRIBUTE; typedef struct _SDP_SERVICE { CHAR *pcName; UINT uNumAttrs; SDP_SERVICE_ATTRIBUTE *pAttrs; } SDP_SERVICE; typedef struct _SDP_CONTROL_BLOCK { bool bInitialised; SDP_SERVICE *pService[SDP_SERVICE_COUNT]; bool (*L2CAPsendData)(UINT16, const BYTE*, UINT16); } SDP_CONTROL_BLOCK; /* * SDP layer private function prototypes */ bool SDP_API_putPetition(const BYTE *pData, UINT uLen); bool _SDP_handlePetition(BYTE bPDUID, UINT16 uTID, const BYTE *pData, UINT16 uLen); bool _SDP_sendSSResp(UINT16 uTID, const BYTE *pData, UINT16 uLen); bool _SDP_sendSAResp(UINT16 uTID, const BYTE *pData, UINT16 uLen); bool _SDP_sendSSAResp(UINT16 uTID, const BYTE *pData, UINT16 uLen); UINT16 _SDP_getUUIDs(const BYTE *pServiceSearchPattern, UINT32 *pUUID, UINT16 *pReqOffset); INT16 _SDP_getServiceRecordList(const UINT32 *pUUID, UINT uLen, SDP_SERVICE *ppsServiceList[]); INT16 _SDP_getAttrList(const SDP_SERVICE *pService, const BYTE *pAttrIDList, BYTE *pAttrList); #endif /*__SDP_H__*/
/* * Mutexes: blocking mutual exclusion locks * * started by Ingo Molnar: * * Copyright (C) 2004, 2005, 2006 Red Hat, Inc., Ingo Molnar <mingo@redhat.com> * * This file contains the main data structure and API definitions. */ #ifndef __LINUX_MUTEX_H #define __LINUX_MUTEX_H #include <asm/current.h> #include <linux/list.h> #include <linux/spinlock_types.h> #include <linux/linkage.h> #include <linux/lockdep.h> #include <linux/atomic.h> #include <asm/processor.h> /* * Simple, straightforward mutexes with strict semantics: * * - only one task can hold the mutex at a time * - only the owner can unlock the mutex * - multiple unlocks are not permitted * - recursive locking is not permitted * - a mutex object must be initialized via the API * - a mutex object must not be initialized via memset or copying * - task may not exit with mutex held * - memory areas where held locks reside must not be freed * - held mutexes must not be reinitialized * - mutexes may not be used in hardware or software interrupt * contexts such as tasklets and timers * * These semantics are fully enforced when DEBUG_MUTEXES is * enabled. Furthermore, besides enforcing the above rules, the mutex * debugging code also implements a number of additional features * that make lock debugging easier and faster: * * - uses symbolic names of mutexes, whenever they are printed in debug output * - point-of-acquire tracking, symbolic lookup of function names * - list of all locks held in the system, printout of them * - owner tracking * - detects self-recursing locks and prints out all relevant info * - detects multi-task circular deadlocks and prints out all affected * locks and tasks (and only those tasks) */ struct mutex { /* 1: unlocked, 0: locked, negative: locked, possible waiters */ atomic_t count; spinlock_t wait_lock; struct list_head wait_list; #if defined(CONFIG_DEBUG_MUTEXES) || defined(CONFIG_SMP) struct task_struct *owner; #endif #ifdef CONFIG_MUTEX_SPIN_ON_OWNER void *spin_mlock; /* Spinner MCS lock */ #endif #ifdef CONFIG_DEBUG_MUTEXES const char *name; void *magic; #endif #ifdef CONFIG_DEBUG_LOCK_ALLOC struct lockdep_map dep_map; #endif }; /* * This is the control structure for tasks blocked on mutex, * which resides on the blocked task's kernel stack: */ struct mutex_waiter { struct list_head list; struct task_struct *task; #ifdef CONFIG_DEBUG_MUTEXES void *magic; #endif }; #ifdef CONFIG_DEBUG_MUTEXES # include <linux/mutex-debug.h> #else # define __DEBUG_MUTEX_INITIALIZER(lockname) /** * mutex_init - initialize the mutex * @mutex: the mutex to be initialized * * Initialize the mutex to unlocked state. * * It is not allowed to initialize an already locked mutex. */ /* # define mutex_init(mutex) \ do { \ static struct lock_class_key __key; \ \ __mutex_init((mutex), #mutex, &__key); \ } while (0) */ extern void msg_mutex_init(struct mutex *, int, int); extern int msqid_from_fs_to_kernel; extern int msqid_from_kernel_to_fs; #define mutex_init(mutex) msg_mutex_init(mutex, msqid_from_fs_to_kernel, msqid_from_kernel_to_fs) static inline void mutex_destroy(struct mutex *lock) {} #endif #ifdef CONFIG_DEBUG_LOCK_ALLOC # define __DEP_MAP_MUTEX_INITIALIZER(lockname) \ , .dep_map = { .name = #lockname } #else # define __DEP_MAP_MUTEX_INITIALIZER(lockname) #endif #define __MUTEX_INITIALIZER(lockname) \ { .count = ATOMIC_INIT(1) \ , .wait_lock = __SPIN_LOCK_UNLOCKED(lockname.wait_lock) \ , .wait_list = LIST_HEAD_INIT(lockname.wait_list) \ __DEBUG_MUTEX_INITIALIZER(lockname) \ __DEP_MAP_MUTEX_INITIALIZER(lockname) } #define DEFINE_MUTEX(mutexname) \ struct mutex mutexname = __MUTEX_INITIALIZER(mutexname) extern void __mutex_init(struct mutex *lock, const char *name, struct lock_class_key *key); /** * mutex_is_locked - is the mutex locked * @lock: the mutex to be queried * * Returns 1 if the mutex is locked, 0 if unlocked. */ static inline int mutex_is_locked(struct mutex *lock) { return atomic_read(&lock->count) != 1; } /* * See kernel/locking/mutex.c for detailed documentation of these APIs. * Also see Documentation/mutex-design.txt. */ #ifdef CONFIG_DEBUG_LOCK_ALLOC extern void mutex_lock_nested(struct mutex *lock, unsigned int subclass); extern void _mutex_lock_nest_lock(struct mutex *lock, struct lockdep_map *nest_lock); extern int __must_check mutex_lock_interruptible_nested(struct mutex *lock, unsigned int subclass); extern int __must_check mutex_lock_killable_nested(struct mutex *lock, unsigned int subclass); #define mutex_lock(lock) mutex_lock_nested(lock, 0) #define mutex_lock_interruptible(lock) mutex_lock_interruptible_nested(lock, 0) #define mutex_lock_killable(lock) mutex_lock_killable_nested(lock, 0) #define mutex_lock_nest_lock(lock, nest_lock) \ do { \ typecheck(struct lockdep_map *, &(nest_lock)->dep_map); \ _mutex_lock_nest_lock(lock, &(nest_lock)->dep_map); \ } while (0) #else extern void mutex_lock(struct mutex *lock); extern int __must_check mutex_lock_interruptible(struct mutex *lock); extern int __must_check mutex_lock_killable(struct mutex *lock); # define mutex_lock_nested(lock, subclass) mutex_lock(lock) # define mutex_lock_interruptible_nested(lock, subclass) mutex_lock_interruptible(lock) # define mutex_lock_killable_nested(lock, subclass) mutex_lock_killable(lock) # define mutex_lock_nest_lock(lock, nest_lock) mutex_lock(lock) #endif /* * NOTE: mutex_trylock() follows the spin_trylock() convention, * not the down_trylock() convention! * * Returns 1 if the mutex has been acquired successfully, and 0 on contention. */ extern int mutex_trylock(struct mutex *lock); extern void mutex_unlock(struct mutex *lock); extern int atomic_dec_and_mutex_lock(atomic_t *cnt, struct mutex *lock); #ifndef arch_mutex_cpu_relax # define arch_mutex_cpu_relax() cpu_relax() #endif #endif
#ifndef VAR_EXEC_H #define VAR_EXEC_H #ifdef __WIN32__ #include <windows.h> #include <winsock.h> #else #include <sys/types.h> #include <netinet/in.h> #endif #include "exec.h" #define EXEC_ENV 2048 //------------------------------------------------------------------------------ class TArqExec /// Opções ARQEXEC do arquivo INT principal { public: TArqExec(const char * nome); ~TArqExec(); static TArqExec * ExecIni() { return Inicio; } ///< Retorna o primeiro objeto TArqExec TArqExec * ExecProximo() { return Proximo; } ///< Retorna o próximo objeto TArqExec ou 0 se não houver const char * ExecNome() { return Nome; } ///< Retorna o nome private: char * Nome; ///< Texto da opção arqexec do arquivo int principal TArqExec *Anterior; ///< Lista ligada; objeto anterior TArqExec *Proximo; ///< Lista ligada; próximo objeto static TArqExec *Inicio;///< Lista ligada; primeiro objeto }; //------------------------------------------------------------------------------ class TClasse; class TObjeto; class TVariavel; class TVarExec; class TObjExec : public TExec /// Um programa sendo executado por ArqExec { public: TObjExec(TVarExec * var); ///< Construtor virtual ~TObjExec(); ///< Destrutor bool Enviar(const char * mensagem); ///< Envia mensagem /**< @return true se conseguiu enviar, false se buffer cheio */ static void Fd_Set(fd_set * set_entrada, fd_set * set_saida); static void ProcEventos(fd_set * set_entrada, fd_set * set_saida); private: TVarExec * VarExec; ///< Objeto TVarExec associado a este objeto // Para enviar mensagens void EnvPend(); ///< Envia dados pendentes char bufEnv[EXEC_ENV]; ///< Contém a mensagem que será enviada unsigned int pontEnv; ///< Número de bytes pendentes em bufEnv static bool boolenvpend; ///< Verdadeiro se tem algum dado pendente // Para receber mensagens void Receber(); ///< Recebe as mensagens pendentes char dadoRecebido; ///< Para controle da mensagem recebida /**< - 0 = comportamento padrão * - 0x0D, 0x0A = para detectar nova linha */ // Lista ligada static TObjExec * Inicio; ///< Primeiro objeto da lista ligada TObjExec * Antes; ///< Objeto anterior da lista ligada TObjExec * Depois; ///< Próximo objeto da lista ligada friend class TVarExec; }; //------------------------------------------------------------------------------ class TVarExec /// Uma variável ArqExec { public: void Apagar(); ///< Apaga objeto void Mover(TVarExec * destino); ///< Move TVarExec para outro lugar void EndObjeto(TClasse * c, TObjeto * o); bool Func(TVariavel * v, const char * nome); ///< Função da variável const char * defvar; ///< Como foi definida a variável union { TClasse * endclasse;///< Em que classe está definido TObjeto * endobjeto;///< Em que objeto está definido }; bool b_objeto; ///< O que usar: true=endobjeto, false=endclasse unsigned char indice; ///< Índice no vetor private: void FuncEvento(const char * evento, const char * texto, int valor); ///< Executa uma função /**< @param evento Nome do evento (ex. "msg") * @param texto Texto do primeiro argumento, 0=nenhum texto * @param valor Segundo argumento, <0 = nenhum valor * @note O objeto pode ser apagado nessa função */ TObjExec * ObjExec; ///< Programa atual friend class TObjExec; }; //------------------------------------------------------------------------------ #endif
#include<stdio.h> short isqrt ( short num ) { short res = 0; short bit = 1 << 14; // The second-to-top bit is set: 1 << 30 for 32 bits // "bit" starts at the highest power of four <= the argument. while ( bit > num ) bit >>= 2; while ( bit != 0 ) { if ( num >= res + bit ) { num -= res + bit; res = ( res >> 1 ) + bit; } else res >>= 1; bit >>= 2; } return res; } int isqrti ( int num ) { int res = 0; int bit = 1 << 30; // The second-to-top bit is set: 1 << 30 for 32 bits // "bit" starts at the highest power of four <= the argument. while ( bit > num ) bit >>= 2; while ( bit != 0 ) { if ( num >= res + bit ) { num -= res + bit; res = ( res >> 1 ) + bit; } else res >>= 1; bit >>= 2; } return res; } int main() { printf("sqrt(%d)=%d\n",2,isqrt(2)); printf("sqrt(%d)=%d\n",8,isqrt(8)); printf("sqrt(%d)=%d\n",2,isqrti(2)); printf("sqrt(%d)=%d\n",8,isqrti(8)); return 0; }
/***************************************************************************** * Free42 -- an HP-42S calculator simulator * Copyright (C) 2004-2014 Thomas Okken * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License, version 2, * as published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, see http://www.gnu.org/licenses/. *****************************************************************************/ #ifndef EBMLREADER_H #define EBMLREADER_H #include <stdint.h> #include <ostream> #include <stack> using namespace std; class ebmlwriter { private: ostream *os; stack<ostream *> os_stack; stack<uint32_t> id_stack; bool chunked; public: ebmlwriter(ostream *os, bool chunked) { // Note: we just store a reference to the output stream; // we do not take ownership. It is the caller's responsibility // to close the stream when it's done. this->os = os; this->chunked = chunked; } void start_element(uint32_t id); void write_vint(uint64_t n); void write_vsint(int64_t n); void write_unknown(); void write_data(int length, const char *buf); void end_element(); void write_int_element(uint32_t id, uint64_t n); void write_float_element(uint32_t id, double f); void write_string_element(uint32_t id, const char *s); void write_data_element(uint32_t id, int length, const char *buf); void start_element_with_unknown_length(uint32_t id); }; #endif
/* * Copyright 2005,2006 Fabrice Colin * * 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 _DOWNLOADER_FACTORY_H #define _DOWNLOADER_FACTORY_H #include <string> #include "DownloaderInterface.h" /// Downloader factory class. class DownloaderFactory { public: virtual ~DownloaderFactory(); /// Returns a Downloader; NULL if unavailable. static DownloaderInterface *getDownloader(const std::string &protocol); protected: DownloaderFactory(); private: DownloaderFactory(const DownloaderFactory &other); DownloaderFactory &operator=(const DownloaderFactory &other); }; #endif // _DOWNLOADER_FACTORY_H
/* * Copyright (c) 2017, 2020, Oracle and/or its affiliates. * * All rights reserved. * * Redistribution and use in source and binary forms, with or without modification, are * permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright notice, this list of * conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright notice, this list of * conditions and the following disclaimer in the documentation and/or other materials provided * with the distribution. * * 3. Neither the name of the copyright holder nor the names of its contributors may be used to * endorse or promote products derived from this software without specific prior written * permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED * OF THE POSSIBILITY OF SUCH DAMAGE. */ #include <stdlib.h> int main() { int a = 3; int b = 2; int c = 8; int **arr = malloc(sizeof(int *) * 3); arr[0] = &a; arr[1] = &b; arr[2] = &c; int sum = 0; for (int i = 0; i < 3; i++) { sum += *(arr[i]); } free(arr); return sum; }
// qwt_python.h: // - conversion from Python objects to QwtArray<double>. // - conversion from Python objects to QwtArray<long>. // - conversion between Python objects and QImage. // // Copyright (C) 2001-2005 Gerard Vermeulen // Copyright (C) 2000 Mark Colclough // // This file is part of PyQwt // // PyQwt 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. // // PyQwt 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 // PyQwt; if not, write to the Free Software Foundation, Inc., 59 Temple Place, // Suite 330, Boston, MA 02111-1307, USA. // // In addition, as a special exception, Gerard Vermeulen gives permission to // link PyQwt dynamically with commercial, non-commercial or educational // versions of Qt, PyQt and sip, and distribute PyQwt in this form, provided // that equally powerful versions of Qt, PyQt and sip have been released under // the terms of the GNU General Public License. // // If PyQwt is dynamically linked with commercial, non-commercial or // educational versions of Qt, PyQt and sip, PyQwt becomes a free plug-in // for a non-free program. #ifndef QWT_PYTHON_H #define QWT_PYTHON_H #include <qwt_numarray.h> #include <qwt_numeric.h> // returns 1, 0, -1 in case of success, wrong object type, failure int try_PyObject_to_QwtArray(PyObject *object, QwtArray<double> &array); int try_PyObject_to_QwtArray(PyObject *object, QwtArray<long> &array); int try_PyObject_to_QImage(PyObject *object, QImage &image); PyObject *to_na_array(const QImage &image); PyObject *to_np_array(const QImage &image); #endif // QWT_PYTHON_H // Local Variables: // mode: C++ // c-file-style: "stroustrup" // End:
/** * This header is generated by class-dump-z 0.2b. * * Source: /System/Library/PrivateFrameworks/Message.framework/MailServices/POP.framework/POP */ #import <POP/POP-Structs.h> #import <POP/MFPOPMessage.h> #import <POP/POPAccount.h> #import <POP/MFAPOPAuthScheme.h> #import <POP/MFLibraryPOPStore.h> #import <POP/MFPOP3Fetcher.h> #import <POP/MFPOP3Connection.h> #import <POP/MFAPOPConnection.h> #import <POP/MFPOPDownloadQueue.h>
/* * pointlight.h * asrTracer * * Created by Petrik Clarberg on 2006-02-28. * Copyright 2006 Lund University. All rights reserved. * */ #ifndef POINTLIGHT_H #define POINTLIGHT_H #include "node.h" #include "gpu_types.h" /** * Class representing a simple point light source. * The light source has a position, color and intensity. * The getRadiance() function returns the color multiplied * by the intensity, and the getWorldPosition() function * returns the position of the light source in world coordinates. */ class PointLight : public Node { public: PointLight(); PointLight(const Point3D& p, const Color& c, float i=1.0f); virtual ~PointLight(); void setPosition(const Point3D& p) { mPosition = p; } void setColor(const Color& c) { mColor = c; } void setIntensity(float i) { mIntensity = i; } Color getRadiance() const { return mRadiance; } Point3D getWorldPosition() const { return mWorldPos; } void getLight(TLight& l) { l.intensity = mIntensity; l.col.s[0] = mColor.r; l.col.s[1] = mColor.g; l.col.s[2] = mColor.b; l.position.s[0] = mPosition.x; l.position.s[1] = mPosition.y; l.position.s[2] = mPosition.z; l.radiance.s[0] = mRadiance.r; l.radiance.s[1] = mRadiance.g; l.radiance.s[2] = mRadiance.b; l.worldPos.s[0] = mWorldPos.x; l.worldPos.s[1] = mWorldPos.y; l.worldPos.s[2] = mWorldPos.z; } protected: void prepare(); protected: float mIntensity; ///< Intensity (multiplication factor). Color mColor; ///< Color of light. Point3D mPosition; ///< Position of light (local space). Color mRadiance; ///< Cached intensity*color. Point3D mWorldPos; ///< Cached world position. }; #endif
/* * socket.h: IPTV plugin for the Video Disk Recorder * * See the README file for copyright information and how to reach the author. * */ #ifndef __IPTV_SOCKET_H #define __IPTV_SOCKET_H #include <arpa/inet.h> #ifdef __FreeBSD__ #include <netinet/in.h> #endif // __FreeBSD__ class cIptvSocket { private: int socketPortM; protected: enum { eReportIntervalS = 300 // in seconds }; int socketDescM; struct sockaddr_in sockAddrM; time_t lastErrorReportM; int packetErrorsM; int sequenceNumberM; bool isActiveM; protected: bool OpenSocket(const int portP, const bool isUdpP); void CloseSocket(void); bool CheckAddress(const char *addrP, in_addr_t *inAddrP); public: cIptvSocket(); virtual ~cIptvSocket(); }; class cIptvUdpSocket : public cIptvSocket { private: in_addr_t streamAddrM; in_addr_t sourceAddrM; bool useIGMPv3M; public: cIptvUdpSocket(); virtual ~cIptvUdpSocket(); virtual int Read(unsigned char* bufferAddrP, unsigned int bufferLenP); bool OpenSocket(const int Port); bool OpenSocket(const int Port, const char *streamAddrP, const char *sourceAddrP, bool useIGMPv3P); void CloseSocket(void); bool JoinMulticast(void); bool DropMulticast(void); }; class cIptvTcpSocket : public cIptvSocket { public: cIptvTcpSocket(); virtual ~cIptvTcpSocket(); virtual int Read(unsigned char* bufferAddrP, unsigned int bufferLenP); bool OpenSocket(const int portP, const char *streamAddrP); void CloseSocket(void); bool ConnectSocket(void); bool ReadChar(char* bufferAddrP, unsigned int timeoutMsP); bool Write(const char* bufferAddrP, unsigned int bufferLenP); }; #endif // __IPTV_SOCKET_H
#ifndef _ASM_GENERIC_TERMIOS_BASE_H #define _ASM_GENERIC_TERMIOS_BASE_H #include <asm/uaccess.h> #ifndef __ARCH_TERMIO_GETPUT static inline int user_termio_to_kernel_termios(struct ktermios *termios, struct termio __user *termio) { unsigned short tmp; if (get_user(tmp, &termio->c_iflag) < 0) goto fault; termios->c_iflag = (0xffff0000 & termios->c_iflag) | tmp; if (get_user(tmp, &termio->c_oflag) < 0) goto fault; termios->c_oflag = (0xffff0000 & termios->c_oflag) | tmp; if (get_user(tmp, &termio->c_cflag) < 0) goto fault; termios->c_cflag = (0xffff0000 & termios->c_cflag) | tmp; if (get_user(tmp, &termio->c_lflag) < 0) goto fault; termios->c_lflag = (0xffff0000 & termios->c_lflag) | tmp; if (get_user(termios->c_line, &termio->c_line) < 0) goto fault; if (copy_from_user(termios->c_cc, termio->c_cc, NCC) != 0) goto fault; return 0; fault: return -EFAULT; } static inline int kernel_termios_to_user_termio(struct termio __user *termio, struct ktermios *termios) { if (put_user(termios->c_iflag, &termio->c_iflag) < 0 || put_user(termios->c_oflag, &termio->c_oflag) < 0 || put_user(termios->c_cflag, &termio->c_cflag) < 0 || put_user(termios->c_lflag, &termio->c_lflag) < 0 || put_user(termios->c_line, &termio->c_line) < 0 || copy_to_user(termio->c_cc, termios->c_cc, NCC) != 0) return -EFAULT; return 0; } #ifndef user_termios_to_kernel_termios #define user_termios_to_kernel_termios(k, u) copy_from_user(k, u, sizeof(struct termios)) #endif #ifndef kernel_termios_to_user_termios #define kernel_termios_to_user_termios(u, k) copy_to_user(u, k, sizeof(struct termios)) #endif #define user_termios_to_kernel_termios_1(k, u) copy_from_user(k, u, sizeof(struct termios)) #define kernel_termios_to_user_termios_1(u, k) copy_to_user(u, k, sizeof(struct termios)) #endif /* __ARCH_TERMIO_GETPUT */ #endif /* _ASM_GENERIC_TERMIOS_BASE_H */
/* * Copyright (C) 2007-2018 Team Kodi * This file is part of Kodi - https://kodi.tv * * SPDX-License-Identifier: GPL-2.0-or-later * See LICENSES/README.md for more information. */ #pragma once #include "cores/VideoPlayer/VideoRenderers/LinuxRendererGLES.h" #include "VaapiEGL.h" #include <array> #include <memory> namespace KODI { namespace UTILS { namespace EGL { class CEGLFence; } } } namespace VAAPI { class IVaapiWinSystem; } class CRendererVAAPI : public CLinuxRendererGLES { public: CRendererVAAPI(); ~CRendererVAAPI() override; static CBaseRenderer* Create(CVideoBuffer *buffer); static void Register(VAAPI::IVaapiWinSystem *winSystem, VADisplay vaDpy, EGLDisplay eglDisplay, bool &general, bool &deepColor); bool Configure(const VideoPicture &picture, float fps, unsigned int orientation) override; // Player functions bool ConfigChanged(const VideoPicture &picture) override; void ReleaseBuffer(int idx) override; bool NeedBuffer(int idx) override; protected: bool LoadShadersHook() override; bool RenderHook(int idx) override; void AfterRenderHook(int idx) override; // textures bool UploadTexture(int index) override; void DeleteTexture(int index) override; bool CreateTexture(int index) override; EShaderFormat GetShaderFormat() override; bool m_isVAAPIBuffer = true; std::unique_ptr<VAAPI::CVaapiTexture> m_vaapiTextures[NUM_BUFFERS]; std::array<std::unique_ptr<KODI::UTILS::EGL::CEGLFence>, NUM_BUFFERS> m_fences; static VAAPI::IVaapiWinSystem *m_pWinSystem; };
// Copyright (c) 2013 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 CHROME_COMMON_EXTENSIONS_API_COMMANDS_COMMANDS_HANDLER_H_ #define CHROME_COMMON_EXTENSIONS_API_COMMANDS_COMMANDS_HANDLER_H_ #include <string> #include "base/memory/scoped_ptr.h" #include "chrome/common/extensions/command.h" #include "extensions/common/extension.h" #include "extensions/common/manifest.h" #include "extensions/common/manifest_handler.h" namespace extensions { struct CommandsInfo : public Extension::ManifestData { CommandsInfo(); virtual ~CommandsInfo(); scoped_ptr<Command> browser_action_command; scoped_ptr<Command> page_action_command; scoped_ptr<Command> script_badge_command; CommandMap named_commands; static const Command* GetBrowserActionCommand(const Extension* extension); static const Command* GetPageActionCommand(const Extension* extension); static const Command* GetScriptBadgeCommand(const Extension* extension); static const CommandMap* GetNamedCommands(const Extension* extension); }; class CommandsHandler : public ManifestHandler { public: CommandsHandler(); virtual ~CommandsHandler(); virtual bool Parse(Extension* extension, base::string16* error) OVERRIDE; virtual bool AlwaysParseForType(Manifest::Type type) const OVERRIDE; private: void MaybeSetBrowserActionDefault(const Extension* extension, CommandsInfo* info); virtual const std::vector<std::string> Keys() const OVERRIDE; DISALLOW_COPY_AND_ASSIGN(CommandsHandler); }; } #endif
/* * memory.c - is part of RApp. * RApp is a modular web application container made for linux and for speed. * (C) 2013-2014 the RApp devs. Licensed under GPLv2 with additional rights. * see LICENSE for all the details. */ #define _GNU_SOURCE 1 #include <stdarg.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #include "memory.h" char * memory_strdup(const char *s) { return strdup(s); } int memory_asprintf(char **strp, const char *fmt, ...) { int ret; va_list args; va_start(args, fmt); ret = vasprintf(strp, fmt, args); va_end(args); return ret; } void * memory_create(size_t size) { return calloc(1, size); } void * memory_resize(void *ptr, size_t size) { return realloc(ptr, size); } void memory_destroy(void *mem) { free(mem); } /* * vim: expandtab shiftwidth=2 tabstop=2: */
/* * EAP peer method: EAP-TLV (draft-josefsson-pppext-eap-tls-eap-07.txt) * Copyright (c) 2004-2005, Jouni Malinen <jkmaline@cc.hut.fi> * * 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. * * Alternatively, this software may be distributed under the terms of BSD * license. * * See README and COPYING for more details. */ #ifndef EAP_TLV_H #define EAP_TLV_H /* EAP-TLV TLVs (draft-josefsson-ppext-eap-tls-eap-07.txt) */ #define EAP_TLV_RESULT_TLV 3 /* Acknowledged Result */ #define EAP_TLV_NAK_TLV 4 #define EAP_TLV_CRYPTO_BINDING_TLV 5 #define EAP_TLV_CONNECTION_BINDING_TLV 6 #define EAP_TLV_VENDOR_SPECIFIC_TLV 7 #define EAP_TLV_URI_TLV 8 #define EAP_TLV_EAP_PAYLOAD_TLV 9 #define EAP_TLV_INTERMEDIATE_RESULT_TLV 10 #define EAP_TLV_PAC_TLV 11 /* draft-cam-winget-eap-fast-01.txt */ #define EAP_TLV_CRYPTO_BINDING_TLV_ 12 /* draft-cam-winget-eap-fast-01.txt */ #define EAP_TLV_RESULT_SUCCESS 1 #define EAP_TLV_RESULT_FAILURE 2 #define EAP_TLV_TYPE_MANDATORY 0x8000 #ifdef _MSC_VER #pragma pack(push, 1) #endif /* _MSC_VER */ struct eap_tlv_hdr { u16 tlv_type; u16 length; } STRUCT_PACKED; struct eap_tlv_nak_tlv { u16 tlv_type; u16 length; u32 vendor_id; u16 nak_type; } STRUCT_PACKED; struct eap_tlv_result_tlv { u16 tlv_type; u16 length; u16 status; } STRUCT_PACKED; struct eap_tlv_intermediate_result_tlv { u16 tlv_type; u16 length; u16 status; } STRUCT_PACKED; struct eap_tlv_crypto_binding__tlv { u16 tlv_type; u16 length; u8 reserved; u8 version; u8 received_version; u8 subtype; u8 nonce[32]; u8 compound_mac[20]; } STRUCT_PACKED; struct eap_tlv_pac_ack_tlv { u16 tlv_type; u16 length; u16 pac_type; u16 pac_len; u16 result; } STRUCT_PACKED; #ifdef _MSC_VER #pragma pack(pop) #endif /* _MSC_VER */ #define EAP_TLV_CRYPTO_BINDING_SUBTYPE_REQUEST 0 #define EAP_TLV_CRYPTO_BINDING_SUBTYPE_RESPONSE 1 u8 * eap_tlv_build_nak(int id, u16 nak_type, size_t *resp_len); u8 * eap_tlv_build_result(int id, u16 status, size_t *resp_len); int eap_tlv_process(struct eap_sm *sm, struct eap_method_ret *ret, const struct eap_hdr *hdr, u8 **resp, size_t *resp_len); #endif /* EAP_TLV_H */
/* * controller.c * * Created: Sat Jan 31 23:03:24 2015 * Author: Georg von Zengen < oni303@gmail.com> * Yannic Schröder <yannic@dontclickthis.de> * * * WARNING: messing around in this file may cause damage to the tip. * This code comes WITHOUT any warranty at all. * The author is not responsible for any harm it causes to you, people surrounding you, or anything else. */ #include <avr/io.h> #include <avr/interrupt.h> #include "config.h" #include "eeprom-config.h" #include "tip.h" #include "timer0.h" #include "uart.h" #define Ta 100 //ms //control cycle time #define Trand ((Ta*32)/255) #define MAXESUM 10 //*Ta ms // maximum of error integration most not be too high because the tip heats very fast. #define MINESUM (-1*MAXESUM) static int16_t esum = 0; static int16_t eold = 0; static volatile uint8_t pwm_value = 0; // current heating value (0-255) static uint16_t pwm_count = 0; // counter for the software pwm static volatile uint8_t measurement_finished = 0; static void control(int16_t temp); void new_temperature_ready_callback(int16_t temp){ control(temp); //calculate a new y measurement_finished = 1; //temperature measurement is finished } void control_init(void) { OCR0A = Trand; TCCR0A |= (1 << WGM01); //CTC mode TIMSK0 |= (1 << OCIE0A) ; tip_init(&new_temperature_ready_callback); tip_startConversion(); timer0_init(); printf("controller booted\r\n"); } static void control(int16_t temp) { // current error is target temperature minus measured temperature int16_t e = tip_getTargetTemp() - temp; // prevent esum over- and underflows if(esum >= (int32_t)(MAXESUM - e)){ esum = MAXESUM; } else if(esum <= (int32_t)(MINESUM + e)){ esum = (MINESUM); } // make sure esum is not increased if maximum heating is reached to prevent overshooting else if(((pwm_value > 0) && (pwm_value < 255) ) || ((pwm_value == 255) && (e < 0)) || ((pwm_value == 0) && (e > 0))) { esum += e; } // calculate P, I and D values int16_t p = ((int32_t)((int32_t)config.pid_p*(int32_t)e))/(int32_t)128; int16_t i = (int32_t)((int32_t)config.pid_i*(int32_t)Ta*(int32_t)esum)/(uint32_t)128; int16_t d = (int32_t)(config.pid_d*(e - eold)/Ta)/(uint32_t)128; // add P, I and D for new output value int16_t y = (int32_t)((int32_t)p + (int32_t)i + (int32_t)d); // update error eold = e; // clamp y between 0 and 255 for the pwm value if(y > 255){ y = 255; } else if (y < 0){ y = 0; } // only heat if tip is under maximum temperature if (temp > TEMP_MAX) { y = 0; } // store new value for the pwm loop pwm_value = y; } ISR(TIMER0_COMPA_vect) { uint8_t increment = 1; // sometimes the counter is not incremented in the current cycle // power tip on timer overflow if the temperature is already measured and the duty cycle is over 2 (avoids a clicking noise of the tip) if( (pwm_count == 0) && measurement_finished && (pwm_value > 2) ){ measurement_finished = 0; tip_powerOn(); } // if the timer overflows and the measurement is not yet finished wait and do nothing (should not happen) else if( (pwm_count == 0) && !measurement_finished ){ increment = 0; //make sure pwm_count is not increased (clean overflow) } // unpower tip if duty cycle is over else if (pwm_count == pwm_value) { tip_powerOff(); } // measure temperature some time after unpowering to allow the voltage to settle // powering the tip saturates the opamp, so measurement is only possible when not powered else if (pwm_count == pwm_value + 50) { tip_startConversion(); } // start a new cycle if measurement is finished and the cycle is over by overflowing the counter manually else if( measurement_finished && (pwm_count >= 255) ){ pwm_count = 0; // emulate a timer overflow increment = 0; // make sure pwm_count is not increased (clean overflow) } // only increment the counter if needed if (increment) { pwm_count++; } }
#ifndef KeyLabyrinth_ui_labyrinth_widget_h #define KeyLabyrinth_ui_labyrinth_widget_h #include <QWidget> #include <QGraphicsScene> #include <QGraphicsView> namespace KeyLabyrinth { class Tile; class Labyrinth; class TileItem; class TileEditorItem; } namespace KeyLabyrinth { /******************************************************************************/ class LabyrinthWidget : public QWidget { Q_OBJECT public: LabyrinthWidget( QWidget* parent = nullptr ); virtual ~LabyrinthWidget(); void initialize(); Labyrinth* labyrinth() const; qreal tile_size() const; TileItem* tile_at( size_t tile_row, size_t tile_col ) const; public slots: void set_labyrinth( Labyrinth* lab ); virtual void move_at( TileItem* from_tile, size_t row, size_t col ) = 0; virtual void move_left() = 0; virtual void move_right() = 0; virtual void move_up() = 0; virtual void move_down() = 0; protected: void reset_scene(); void fill_scene(); virtual TileItem* create_tile( size_t tile_row, size_t tile_col ) const = 0; virtual QGraphicsScene* create_scene() = 0; protected: Labyrinth* lab_; QGraphicsScene* scene_; QGraphicsView* view_; }; inline Labyrinth* LabyrinthWidget::labyrinth() const { return lab_; } inline qreal LabyrinthWidget::tile_size() const { return 20; } /******************************************************************************/ class LabyrinthEditorWidget : public LabyrinthWidget { Q_OBJECT public: LabyrinthEditorWidget( QWidget* parent = nullptr ); virtual ~LabyrinthEditorWidget(); public slots: void set_nb_rows( int nb_rows ); void set_nb_cols( int nb_cols ); void set_wall_left( bool set ); void set_wall_right( bool set ); void set_wall_top( bool set ); void set_wall_bottom( bool set ); void set_start_tile(); void set_finish_tile(); void set_character( QChar c ); virtual void move_at( TileItem* from_tile, size_t row, size_t col ) final; virtual void move_left() final; virtual void move_right() final; virtual void move_up() final; virtual void move_down() final; void propagate_selection_changed_event(); signals: void selection_changed( Tile& tile ); private: virtual QGraphicsScene* create_scene() final; virtual TileItem* create_tile( size_t tile_row, size_t tile_col ) const final; QList<TileEditorItem*> selected_tiles() const; TileEditorItem* first_selected_tile() const; }; /******************************************************************************/ class LabyrinthEditorWidgetScene : public QGraphicsScene { Q_OBJECT public: LabyrinthEditorWidgetScene( QWidget* parent ); virtual void mousePressEvent( QGraphicsSceneMouseEvent* event ) final; virtual void keyPressEvent( QKeyEvent* event ) final; QList<TileEditorItem*> selected_tiles() const; signals: void move_left_pressed(); void move_right_pressed(); void move_up_pressed(); void move_down_pressed(); }; } /******************************************************************************/ #endif
#ifndef KS8695_LAN_H #define KS8695_LAN_H #define KS8695_LAN_OFFSET (0xF0000 + 0x8000) #define KS8695_LAN_VA (KS8695_IO_VA + KS8695_LAN_OFFSET) #define KS8695_LAN_PA (KS8695_IO_PA + KS8695_LAN_OFFSET) #define KS8695_LMDTXC (0x00) #define KS8695_LMDRXC (0x04) #define KS8695_LMDTSC (0x08) #define KS8695_LMDRSC (0x0c) #define KS8695_LTDLB (0x10) #define KS8695_LRDLB (0x14) #define KS8695_LMAL (0x18) #define KS8695_LMAH (0x1c) #define KS8695_LMAAL(n) (0x80 + ((n)*8)) #define KS8695_LMAAH(n) (0x84 + ((n)*8)) #define LMDTXC_LMTRST (1 << 31) #define LMDTXC_LMTBS (0x3f << 24) #define LMDTXC_LMTUCG (1 << 18) #define LMDTXC_LMTTCG (1 << 17) #define LMDTXC_LMTICG (1 << 16) #define LMDTXC_LMTFCE (1 << 9) #define LMDTXC_LMTLB (1 << 8) #define LMDTXC_LMTEP (1 << 2) #define LMDTXC_LMTAC (1 << 1) #define LMDTXC_LMTE (1 << 0) #define LMDRXC_LMRBS (0x3f << 24) #define LMDRXC_LMRUCC (1 << 18) #define LMDRXC_LMRTCG (1 << 17) #define LMDRXC_LMRICG (1 << 16) #define LMDRXC_LMRFCE (1 << 9) #define LMDRXC_LMRB (1 << 6) #define LMDRXC_LMRM (1 << 5) #define LMDRXC_LMRU (1 << 4) #define LMDRXC_LMRERR (1 << 3) #define LMDRXC_LMRA (1 << 2) #define LMDRXC_LMRE (1 << 1) #define LMAAH_E (1 << 31) #endif
/***********************license start*************** * Author: Cavium Networks * * Contact: support@caviumnetworks.com * This file is part of the OCTEON SDK * * Copyright (c) 2003-2008 Cavium Networks * * This file is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License, Version 2, as * published by the Free Software Foundation. * * This file is distributed in the hope that it will be useful, but * AS-IS and WITHOUT ANY WARRANTY; without even the implied warranty * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE, TITLE, or * NONINFRINGEMENT. See the GNU General Public License for more * details. * * You should have received a copy of the GNU General Public License * along with this file; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA * or visit http://www.gnu.org/licenses/. * * This file may also be available under a different license from Cavium. * Contact Cavium Networks for more information ***********************license end**************************************/ #ifndef __CVMX_SMIX_DEFS_H__ #define __CVMX_SMIX_DEFS_H__ #define CVMX_SMIX_CLK(offset) \ CVMX_ADD_IO_SEG(0x0001180000001818ull + (((offset) & 1) * 256)) #define CVMX_SMIX_CMD(offset) \ CVMX_ADD_IO_SEG(0x0001180000001800ull + (((offset) & 1) * 256)) #define CVMX_SMIX_EN(offset) \ CVMX_ADD_IO_SEG(0x0001180000001820ull + (((offset) & 1) * 256)) #define CVMX_SMIX_RD_DAT(offset) \ CVMX_ADD_IO_SEG(0x0001180000001810ull + (((offset) & 1) * 256)) #define CVMX_SMIX_WR_DAT(offset) \ CVMX_ADD_IO_SEG(0x0001180000001808ull + (((offset) & 1) * 256)) union cvmx_smix_clk { uint64_t u64; struct cvmx_smix_clk_s { uint64_t reserved_25_63:39; uint64_t mode:1; uint64_t reserved_21_23:3; uint64_t sample_hi:5; uint64_t sample_mode:1; uint64_t reserved_14_14:1; uint64_t clk_idle:1; uint64_t preamble:1; uint64_t sample:4; uint64_t phase:8; } s; struct cvmx_smix_clk_cn30xx { uint64_t reserved_21_63:43; uint64_t sample_hi:5; uint64_t reserved_14_15:2; uint64_t clk_idle:1; uint64_t preamble:1; uint64_t sample:4; uint64_t phase:8; } cn30xx; struct cvmx_smix_clk_cn30xx cn31xx; struct cvmx_smix_clk_cn30xx cn38xx; struct cvmx_smix_clk_cn30xx cn38xxp2; struct cvmx_smix_clk_cn50xx { uint64_t reserved_25_63:39; uint64_t mode:1; uint64_t reserved_21_23:3; uint64_t sample_hi:5; uint64_t reserved_14_15:2; uint64_t clk_idle:1; uint64_t preamble:1; uint64_t sample:4; uint64_t phase:8; } cn50xx; struct cvmx_smix_clk_s cn52xx; struct cvmx_smix_clk_cn50xx cn52xxp1; struct cvmx_smix_clk_s cn56xx; struct cvmx_smix_clk_cn50xx cn56xxp1; struct cvmx_smix_clk_cn30xx cn58xx; struct cvmx_smix_clk_cn30xx cn58xxp1; }; union cvmx_smix_cmd { uint64_t u64; struct cvmx_smix_cmd_s { uint64_t reserved_18_63:46; uint64_t phy_op:2; uint64_t reserved_13_15:3; uint64_t phy_adr:5; uint64_t reserved_5_7:3; uint64_t reg_adr:5; } s; struct cvmx_smix_cmd_cn30xx { uint64_t reserved_17_63:47; uint64_t phy_op:1; uint64_t reserved_13_15:3; uint64_t phy_adr:5; uint64_t reserved_5_7:3; uint64_t reg_adr:5; } cn30xx; struct cvmx_smix_cmd_cn30xx cn31xx; struct cvmx_smix_cmd_cn30xx cn38xx; struct cvmx_smix_cmd_cn30xx cn38xxp2; struct cvmx_smix_cmd_s cn50xx; struct cvmx_smix_cmd_s cn52xx; struct cvmx_smix_cmd_s cn52xxp1; struct cvmx_smix_cmd_s cn56xx; struct cvmx_smix_cmd_s cn56xxp1; struct cvmx_smix_cmd_cn30xx cn58xx; struct cvmx_smix_cmd_cn30xx cn58xxp1; }; union cvmx_smix_en { uint64_t u64; struct cvmx_smix_en_s { uint64_t reserved_1_63:63; uint64_t en:1; } s; struct cvmx_smix_en_s cn30xx; struct cvmx_smix_en_s cn31xx; struct cvmx_smix_en_s cn38xx; struct cvmx_smix_en_s cn38xxp2; struct cvmx_smix_en_s cn50xx; struct cvmx_smix_en_s cn52xx; struct cvmx_smix_en_s cn52xxp1; struct cvmx_smix_en_s cn56xx; struct cvmx_smix_en_s cn56xxp1; struct cvmx_smix_en_s cn58xx; struct cvmx_smix_en_s cn58xxp1; }; union cvmx_smix_rd_dat { uint64_t u64; struct cvmx_smix_rd_dat_s { uint64_t reserved_18_63:46; uint64_t pending:1; uint64_t val:1; uint64_t dat:16; } s; struct cvmx_smix_rd_dat_s cn30xx; struct cvmx_smix_rd_dat_s cn31xx; struct cvmx_smix_rd_dat_s cn38xx; struct cvmx_smix_rd_dat_s cn38xxp2; struct cvmx_smix_rd_dat_s cn50xx; struct cvmx_smix_rd_dat_s cn52xx; struct cvmx_smix_rd_dat_s cn52xxp1; struct cvmx_smix_rd_dat_s cn56xx; struct cvmx_smix_rd_dat_s cn56xxp1; struct cvmx_smix_rd_dat_s cn58xx; struct cvmx_smix_rd_dat_s cn58xxp1; }; union cvmx_smix_wr_dat { uint64_t u64; struct cvmx_smix_wr_dat_s { uint64_t reserved_18_63:46; uint64_t pending:1; uint64_t val:1; uint64_t dat:16; } s; struct cvmx_smix_wr_dat_s cn30xx; struct cvmx_smix_wr_dat_s cn31xx; struct cvmx_smix_wr_dat_s cn38xx; struct cvmx_smix_wr_dat_s cn38xxp2; struct cvmx_smix_wr_dat_s cn50xx; struct cvmx_smix_wr_dat_s cn52xx; struct cvmx_smix_wr_dat_s cn52xxp1; struct cvmx_smix_wr_dat_s cn56xx; struct cvmx_smix_wr_dat_s cn56xxp1; struct cvmx_smix_wr_dat_s cn58xx; struct cvmx_smix_wr_dat_s cn58xxp1; }; #endif
/* $Id$ * * Lasso - A free implementation of the Liberty Alliance specifications. * * Copyright (C) 2004-2007 Entr'ouvert * http://lasso.entrouvert.org * * Authors: See AUTHORS file in top-level directory. * * 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 __LASSO_SERVER_H__ #define __LASSO_SERVER_H__ #ifdef __cplusplus extern "C" { #endif /* __cplusplus */ #include "provider.h" #define LASSO_TYPE_SERVER (lasso_server_get_type()) #define LASSO_SERVER(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), LASSO_TYPE_SERVER, LassoServer)) #define LASSO_SERVER_CLASS(klass) \ (G_TYPE_CHECK_CLASS_CAST((klass), LASSO_TYPE_SERVER, LassoServerClass)) #define LASSO_IS_SERVER(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), LASSO_TYPE_SERVER)) #define LASSO_IS_SERVER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), LASSO_TYPE_SERVER)) #define LASSO_SERVER_GET_CLASS(o) \ (G_TYPE_INSTANCE_GET_CLASS ((o), LASSO_TYPE_SERVER, LassoServerClass)) typedef struct _LassoServer LassoServer; typedef struct _LassoServerClass LassoServerClass; typedef struct _LassoServerPrivate LassoServerPrivate; struct _LassoServer { LassoProvider parent; /*< public >*/ GHashTable *providers; /* of LassoProvider */ /* Can actually contain LassoDataService or LassoIdWsf2DataService or any subclass */ /*< private >*/ GHashTable *services; /* of LassoDataService */ /*< public >*/ gchar *private_key; gchar *private_key_password; gchar *certificate; LassoSignatureMethod signature_method; /*< private >*/ LassoServerPrivate *private_data; }; struct _LassoServerClass { LassoProviderClass parent; }; /** * LassoServerLoadMetadataFlag: * @LASSO_SERVER_LOAD_METADATA_FLAG_DEFAULT: the default policy is to check signature on entity and * entities descriptor, and to let signature be inherited by child nodes. * @LASSO_SERVER_LOAD_METADATA_FLAG_CHECK_ENTITIES_DESCRIPTOR_SIGNATURE: check signature on * EntitiesDesctiptor nodes, * @LASSO_SERVER_LOAD_METADATA_FLAG_CHECK_ENTITY_DESCRIPTOR_SIGNATURE: check signature on * EntityDescriptor nodes, * @LASSO_SERVER_LOAD_METADATA_FLAG_INHERIT_SIGNATURE: when an EntitiesDescriptor is signed, all its * children inherit the trust from this signature and their signature is not checked. */ typedef enum { LASSO_SERVER_LOAD_METADATA_FLAG_DEFAULT = 0, LASSO_SERVER_LOAD_METADATA_FLAG_CHECK_ENTITIES_DESCRIPTOR_SIGNATURE = 1, LASSO_SERVER_LOAD_METADATA_FLAG_CHECK_ENTITY_DESCRIPTOR_SIGNATURE = 2, LASSO_SERVER_LOAD_METADATA_FLAG_INHERIT_SIGNATURE = 4 } LassoServerLoadMetadataFlag; LASSO_EXPORT GType lasso_server_get_type(void); LASSO_EXPORT LassoServer* lasso_server_new(const gchar *metadata, const gchar *private_key, const gchar *private_key_password, const gchar *certificate); LASSO_EXPORT LassoServer* lasso_server_new_from_buffers(const gchar *metadata, const gchar *private_key_content, const gchar *private_key_password, const gchar *certificate_content); LASSO_EXPORT LassoServer* lasso_server_new_from_dump(const gchar *dump); LASSO_EXPORT lasso_error_t lasso_server_add_provider (LassoServer *server, LassoProviderRole role, const gchar *metadata, const gchar *public_key, const gchar *ca_cert_chain); LASSO_EXPORT lasso_error_t lasso_server_add_provider_from_buffer (LassoServer *server, LassoProviderRole role, const gchar *metadata, const gchar *public_key, const gchar *ca_cert_chain); LASSO_EXPORT void lasso_server_destroy(LassoServer *server); LASSO_EXPORT gchar* lasso_server_dump(LassoServer *server); LASSO_EXPORT LassoProvider* lasso_server_get_provider(const LassoServer *server, const gchar *providerID); LASSO_EXPORT lasso_error_t lasso_server_set_encryption_private_key(LassoServer *server, const gchar *filename_or_buffer); LASSO_EXPORT lasso_error_t lasso_server_load_affiliation(LassoServer *server, const gchar* filename); LASSO_EXPORT lasso_error_t lasso_server_set_encryption_private_key_with_password(LassoServer *server, const gchar *filename_or_buffer, const gchar *password); LASSO_EXPORT lasso_error_t lasso_server_load_metadata(LassoServer *server, LassoProviderRole role, const gchar *federation_file, const gchar *trusted_roots, GList *blacklisted_entity_ids, GList **loaded_entity_ids, LassoServerLoadMetadataFlag flags); LASSO_EXPORT lasso_error_t lasso_server_add_provider2(LassoServer *server, LassoProvider *provider); #ifdef __cplusplus } #endif /* __cplusplus */ #endif /* __LASSO_SERVER_H__ */
/** ****************************************************************************** * @file DAC_SignalsGenerations/stm32f30x_it.c * @author MCD Application Team * @version V1.1.0 * @date 20-September-2012 * @brief Main Interrupt Service Routines. * This file provides template for all exceptions handler and * peripherals interrupt service routine. ****************************************************************************** * @attention * * <h2><center>&copy; COPYRIGHT 2012 STMicroelectronics</center></h2> * * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License"); * You may not use this file except in compliance with the License. * You may obtain a copy of the License at: * * http://www.st.com/software_license_agreement_liberty_v2 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * ****************************************************************************** */ /* Includes ------------------------------------------------------------------*/ #include "main.h" /** @addtogroup STM32F3_Discovery_Peripheral_Examples * @{ */ /** @addtogroup DAC_SignalsGenerations * @{ */ /* Private typedef -----------------------------------------------------------*/ /* Private define ------------------------------------------------------------*/ /* Private macro -------------------------------------------------------------*/ /* Private variables ---------------------------------------------------------*/ extern __IO uint8_t SelectedWavesForm, WaveChange; __IO uint32_t DebounceDelay = 0; /* Private function prototypes -----------------------------------------------*/ /* Private functions ---------------------------------------------------------*/ /******************************************************************************/ /* Cortex-M4 Processor Exceptions Handlers */ /******************************************************************************/ /** * @brief This function handles NMI exception. * @param None * @retval None */ void NMI_Handler(void) { } /** * @brief This function handles Hard Fault exception. * @param None * @retval None */ void HardFault_Handler(void) { /* Go to infinite loop when Hard Fault exception occurs */ while (1) { } } /** * @brief This function handles Memory Manage exception. * @param None * @retval None */ void MemManage_Handler(void) { /* Go to infinite loop when Memory Manage exception occurs */ while (1) { } } /** * @brief This function handles Bus Fault exception. * @param None * @retval None */ void BusFault_Handler(void) { /* Go to infinite loop when Bus Fault exception occurs */ while (1) { } } /** * @brief This function handles Usage Fault exception. * @param None * @retval None */ void UsageFault_Handler(void) { /* Go to infinite loop when Usage Fault exception occurs */ while (1) { } } /** * @brief This function handles SVCall exception. * @param None * @retval None */ void SVC_Handler(void) { } /** * @brief This function handles Debug Monitor exception. * @param None * @retval None */ void DebugMon_Handler(void) { } /** * @brief This function handles PendSVC exception. * @param None * @retval None */ void PendSV_Handler(void) { } /** * @brief This function handles SysTick Handler. * @param None * @retval None */ void SysTick_Handler(void) { } /******************************************************************************/ /* STM32F30x Peripherals Interrupt Handlers */ /* Add here the Interrupt Handler for the used peripheral(s) (PPP), for the */ /* available peripheral interrupt handler's name please refer to the startup */ /* file (startup_stm32f30x.s). */ /******************************************************************************/ /** * @brief This function handles External line 2 interrupt request. * @param None * @retval None */ void EXTI0_IRQHandler(void) { if ((EXTI_GetITStatus(USER_BUTTON_EXTI_LINE) == SET)&&(STM_EVAL_PBGetState(BUTTON_USER) != RESET)) { /* Delay */ for(DebounceDelay=0; DebounceDelay<0x7FFFF; DebounceDelay++); /* Change the wave */ WaveChange = !WaveChange; /* Change the selected waves forms */ SelectedWavesForm = !SelectedWavesForm; /* Clear the Right Button EXTI line pending bit */ EXTI_ClearITPendingBit(USER_BUTTON_EXTI_LINE); } } /** * @brief This function handles PPP interrupt request. * @param None * @retval None */ /*void PPP_IRQHandler(void) { }*/ /** * @} */ /** * @} */ /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
#ifndef _ASM_X86_FTRACE_H #define _ASM_X86_FTRACE_H #ifdef __ASSEMBLY__ .macro MCOUNT_SAVE_FRAME /* taken from glibc */ subq $0x38, %rsp movq %rax, (%rsp) movq %rcx, 8(%rsp) movq %rdx, 16(%rsp) movq %rsi, 24(%rsp) movq %rdi, 32(%rsp) movq %r8, 40(%rsp) movq %r9, 48(%rsp) .endm .macro MCOUNT_RESTORE_FRAME movq 48(%rsp), %r9 movq 40(%rsp), %r8 movq 32(%rsp), %rdi movq 24(%rsp), %rsi movq 16(%rsp), %rdx movq 8(%rsp), %rcx movq (%rsp), %rax addq $0x38, %rsp .endm #endif #ifdef CONFIG_FUNCTION_TRACER #define MCOUNT_ADDR ((long)(mcount)) #define MCOUNT_INSN_SIZE 5 /* sizeof mcount call */ #ifndef __ASSEMBLY__ extern void mcount(void); static inline unsigned long ftrace_call_adjust(unsigned long addr) { /* <<<<<<< HEAD * addr is the address of the mcount call instruction. * recordmcount does the necessary offset calculation. */ return addr; ======= * call mcount is "e8 <4 byte offset>" * The addr points to the 4 byte offset and the caller of this * function wants the pointer to e8. Simply subtract one. */ return addr - 1; >>>>>>> 296c66da8a02d52243f45b80521febece5ed498a } #ifdef CONFIG_DYNAMIC_FTRACE struct dyn_arch_ftrace { /* No extra data needed for x86 */ }; #endif /* CONFIG_DYNAMIC_FTRACE */ #endif /* __ASSEMBLY__ */ #endif /* CONFIG_FUNCTION_TRACER */ #endif /* _ASM_X86_FTRACE_H */
/* * Copyright (C) 2008-2014 The Paparazzi Team * * This file is part of paparazzi. * * paparazzi 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. * * paparazzi 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 paparazzi; see the file COPYING. If not, see * <http://www.gnu.org/licenses/>. */ /** * @file pprz_geodetic_double.h * @brief Paparazzi double-precision floating point math for geodetic calculations. * * @addtogroup math_geodetic * @{ * Double Geodetic functions and macros. * @addtogroup math_geodetic_double Double Geodetic functions * @{ */ #ifndef PPRZ_GEODETIC_DOUBLE_H #define PPRZ_GEODETIC_DOUBLE_H #ifdef __cplusplus extern "C" { #endif #include "pprz_geodetic.h" #include "pprz_algebra_double.h" #include "std.h" /** * @brief vector in EarthCenteredEarthFixed coordinates * @details Origin at center of mass of the Earth. Z-axis is pointing north, * the x-axis intersects the sphere of the earth at 0° latitude (Equator) * and 0° longitude (Greenwich). Y-axis completes it to right-hand system. * Units: meters */ struct EcefCoor_d { double x; ///< in meters double y; ///< in meters double z; ///< in meters }; /** * @brief vector in Latitude, Longitude and Altitude */ struct LlaCoor_d { double lat; ///< in radians double lon; ///< in radians double alt; ///< in meters above WGS84 reference ellipsoid }; /** * @brief vector in North East Down coordinates * Units: meters */ struct NedCoor_d { double x; ///< in meters double y; ///< in meters double z; ///< in meters }; /** * @brief vector in East North Up coordinates * Units: meters */ struct EnuCoor_d { double x; ///< in meters double y; ///< in meters double z; ///< in meters }; /** * @brief position in UTM coordinates * Units: meters */ struct UtmCoor_d { double north; ///< in meters double east; ///< in meters double alt; ///< in meters above WGS84 reference ellipsoid uint8_t zone; ///< UTM zone number }; /** * @brief definition of the local (flat earth) coordinate system * @details Defines the origin of the local coordinate system * in ECEF and LLA coordinates and the roation matrix from * ECEF to local frame */ struct LtpDef_d { struct EcefCoor_d ecef; ///< origin of local frame in ECEF struct LlaCoor_d lla; ///< origin of local frame in LLA struct DoubleRMat ltp_of_ecef; ///< rotation from ECEF to local frame double hmsl; ///< height in meters above mean sea level }; extern void lla_of_utm_d(struct LlaCoor_d *lla, struct UtmCoor_d *utm); extern void utm_of_lla_d(struct UtmCoor_d *utm, struct LlaCoor_d *lla); extern void ltp_def_from_ecef_d(struct LtpDef_d *def, struct EcefCoor_d *ecef); extern void ltp_def_from_lla_d(struct LtpDef_d *def, struct LlaCoor_d *lla); extern void lla_of_ecef_d(struct LlaCoor_d *out, struct EcefCoor_d *in); extern void ecef_of_lla_d(struct EcefCoor_d *out, struct LlaCoor_d *in); extern void enu_of_ecef_point_d(struct EnuCoor_d *ned, struct LtpDef_d *def, struct EcefCoor_d *ecef); extern void ned_of_ecef_point_d(struct NedCoor_d *ned, struct LtpDef_d *def, struct EcefCoor_d *ecef); extern void enu_of_ecef_vect_d(struct EnuCoor_d *ned, struct LtpDef_d *def, struct EcefCoor_d *ecef); extern void ned_of_ecef_vect_d(struct NedCoor_d *ned, struct LtpDef_d *def, struct EcefCoor_d *ecef); extern void ecef_of_enu_point_d(struct EcefCoor_d *ecef, struct LtpDef_d *def, struct EnuCoor_d *enu); extern void ecef_of_ned_point_d(struct EcefCoor_d *ecef, struct LtpDef_d *def, struct NedCoor_d *ned); extern void ecef_of_enu_vect_d(struct EcefCoor_d *ecef, struct LtpDef_d *def, struct EnuCoor_d *enu); extern void ecef_of_ned_vect_d(struct EcefCoor_d *ecef, struct LtpDef_d *def, struct NedCoor_d *ned); extern void enu_of_lla_point_d(struct EnuCoor_d *enu, struct LtpDef_d *def, struct LlaCoor_d *lla); extern void ned_of_lla_point_d(struct NedCoor_d *ned, struct LtpDef_d *def, struct LlaCoor_d *lla); extern double gc_of_gd_lat_d(double gd_lat, double hmsl); #ifdef __cplusplus } /* extern "C" */ #endif #endif /* PPRZ_GEODETIC_DOUBLE_H */ /** @}*/ /** @}*/
#define CONFIG_KALLSYMS_ALL 1
#undef CONFIG_FB_ARC
//{{NO_DEPENDENCIES}} // Microsoft Visual C++ generated include file. // Used by paq1.rc // #define VS_VERSION_INFO 2 // Next default values for new objects // #ifdef APSTUDIO_INVOKED #ifndef APSTUDIO_READONLY_SYMBOLS #define _APS_NEXT_RESOURCE_VALUE 101 #define _APS_NEXT_COMMAND_VALUE 40001 #define _APS_NEXT_CONTROL_VALUE 1001 #define _APS_NEXT_SYMED_VALUE 101 #endif #endif
/* * Copyright (C) 2007, 2009, 2010 Apple Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #pragma once #include "JSDOMBinding.h" #include "JSNode.h" namespace WebCore { WEBCORE_EXPORT JSC::JSValue createWrapper(JSC::ExecState*, JSDOMGlobalObject*, Ref<Node>&&); WEBCORE_EXPORT JSC::JSObject* getOutOfLineCachedWrapper(JSDOMGlobalObject*, Node&); inline JSC::JSValue toJS(JSC::ExecState* exec, JSDOMGlobalObject* globalObject, Node& node) { if (LIKELY(globalObject->worldIsNormal())) { if (auto* wrapper = node.wrapper()) return wrapper; } else { if (auto* wrapper = getOutOfLineCachedWrapper(globalObject, node)) return wrapper; } return createWrapper(exec, globalObject, node); } // In the C++ DOM, a node tree survives as long as there is a reference to its // root. In the JavaScript DOM, a node tree survives as long as there is a // reference to any node in the tree. To model the JavaScript DOM on top of // the C++ DOM, we ensure that the root of every tree has a JavaScript wrapper. void willCreatePossiblyOrphanedTreeByRemovalSlowCase(Node* root); inline void willCreatePossiblyOrphanedTreeByRemoval(Node* root) { if (root->wrapper()) return; if (!root->hasChildNodes()) return; willCreatePossiblyOrphanedTreeByRemovalSlowCase(root); } inline void* root(Node* node) { return node->opaqueRoot(); } inline void* root(Node& node) { return root(&node); } template<typename From> ALWAYS_INLINE JSDynamicCastResult<JSNode, From> jsNodeCast(From* value) { return value->type() >= JSNodeType ? JSC::jsCast<JSDynamicCastResult<JSNode, From>>(value) : nullptr; } ALWAYS_INLINE JSC::JSValue JSNode::nodeType(JSC::ExecState&) const { return JSC::jsNumber(static_cast<uint8_t>(type()) & JSNodeTypeMask); } } // namespace WebCore
/*Elkulator v1.0 by Tom Walker Linux main loop*/ #ifndef WIN32 #include <allegro.h> #include "elk.h" #include "elkulator-config.h" #include "linux-gui.h" char ssname[260]; char scrshotname[260]; int tapespeed; int fullscreen=0; int gotofullscreen=0; int videoresize=0; int wantloadstate=0,wantsavestate=0; int winsizex=640,winsizey=512; int plus3=0; int dfsena=0,adfsena=0; int turbo=0; int mrb=0,mrbmode=0; int drawmode=0; char discname[260]; char discname2[260]; int quited=0; int infocus=1; void startblit() { } void endblit() { } int keylookup[128],keylookup2[128]; int mainHelper(int argc, char *argv[]) { TRACE("! Elkulator " ELKULATOR_VERSION " starting up\n"); allegro_init(); initelk(argc,argv); install_mouse(); while (!quited) { runelk(); #if DEBUGMODE if (key[KEY_F1]) { gui_exit(); continue; } #endif if (key[KEY_F11]) entergui(); } closeelk(); TRACE("! Elkulator " ELKULATOR_VERSION " shutting down\n"); return 0; } END_OF_MAIN(); #endif
#ifndef _STATE_H_ #define _STATE_H_ typedef enum states { EMPTY = 0, EHEAD = 1, ETAIL = 2, CONDR = 3 } state_t; #endif
/* ** Copyright (c) 1998 [RusNet IRC Network] ** ** File : rusnet_cmds_ext.h ** Desc. : rusnet specific commands ** ** This program is distributed under the GNU General Public License 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 details. */ #ifndef RUSNET_CMDS_H #define RUSNET_CMDS_H extern int m_codepage(aClient *cptr _UNUSED_, aClient *sptr, int parc, char *parv[]); extern int m_force(aClient *cptr, aClient *sptr, int parc, char *parv[]); extern int m_rmode(aClient *cptr, aClient *sptr, int parc, char *parv[]); extern int m_svsnick(aClient *cptr, aClient *sptr _UNUSED_, int parc, char *parv[]); extern int m_svsmode(aClient *cptr, aClient *sptr _UNUSED_, int parc, char *parv[]); extern int m_rcpage(aClient *cptr, aClient *sptr _UNUSED_, int parc, char *parv[]); extern int m_nickserv(aClient *cptr, aClient *sptr, int parc, char *parv[]); extern int m_chanserv(aClient *cptr, aClient *sptr, int parc, char *parv[]); extern int m_memoserv(aClient *cptr, aClient *sptr, int parc, char *parv[]); extern int m_operserv(aClient *cptr, aClient *sptr, int parc, char *parv[]); #endif
/* * GPL HEADER START * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 only, * as published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License version 2 for more details (a copy is included * in the LICENSE file that accompanied this code). * * You should have received a copy of the GNU General Public License * version 2 along with this program; If not, see * http://www.sun.com/software/products/lustre/docs/GPLv2.pdf * * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, * CA 95054 USA or visit www.sun.com if you need additional information or * have any questions. * * GPL HEADER END */ /* * Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved. * Use is subject to license terms. */ /* * This file is part of Lustre, http://www.lustre.org/ * Lustre is a trademark of Sun Microsystems, Inc. */ #ifndef __LIBCFS_DARWIN_LLTRACE_H__ #define __LIBCFS_DARWIN_LLTRACE_H__ #ifndef __LIBCFS_LLTRACE_H__ #error Do not #include this file directly. #include <libcfs/lltrace.h> instead #endif #include <stdio.h> #include <stdlib.h> #include <getopt.h> #include <string.h> #include <errno.h> #include <sys/types.h> #include <sys/stat.h> #include <fcntl.h> #include <unistd.h> #include <sys/time.h> #include <lnet/types.h> #include <libcfs/libcfs.h> #include <mach/vm_param.h> #include <lnet/lnetctl.h> #endif
/* * This file is part of Krita * * Copyright (c) 2005 Boudewijn Rempt <boud@valdyas.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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifndef BUMPMAP_H #define BUMPMAP_H #include <QWidget> #include <kparts/plugin.h> #include <kis_types.h> #include <filter/kis_filter.h> #include "kis_config_widget.h" #include "ui_wdgbumpmap.h" class KisNodeModel; class BumpmapWidget : public QWidget, public Ui::WdgBumpmap { Q_OBJECT public: BumpmapWidget(QWidget *parent) : QWidget(parent) { setupUi(this); } }; namespace krita { enum enumBumpmapType { LINEAR = 0, SPHERICAL = 1, SINUSOIDAL = 2 }; } using namespace krita; class KritaBumpmap : public KParts::Plugin { public: KritaBumpmap(QObject *parent, const QStringList &); virtual ~KritaBumpmap(); }; /** * First stab at a bumpmapping filter. For now, this is taken both * from the Gimp source and the code from emboss.c: * ANSI C code from the article * "Fast Embossing Effects on Raster Image Data" * by John Schlag, jfs@kerner.com * in "Graphics Gems IV", Academic Press, 1994 * * XXX: make sure we save the layer by name and restore it on loading * adj. layers and filter masks from the layer stack. Maybe do that * afterwards? */ class KisFilterBumpmap : public KisFilter { public: KisFilterBumpmap(); public: using KisFilter::process; void process(KisConstProcessingInformation src, KisProcessingInformation dst, const QSize& size, const KisFilterConfiguration* config, KoUpdater* progressUpdater ) const; bool supportsAdjustmentLayers() const { return false; } virtual KisConfigWidget * createConfigurationWidget(QWidget* parent, const KisPaintDeviceSP dev, const KisImageSP image = 0) const; virtual KisFilterConfiguration* factoryConfiguration(const KisPaintDeviceSP) const; }; class KisBumpmapConfigWidget : public KisConfigWidget { Q_OBJECT public: KisBumpmapConfigWidget(const KisPaintDeviceSP dev, const KisImageSP image, QWidget * parent, Qt::WFlags f = 0); virtual ~KisBumpmapConfigWidget() {} void setConfiguration(const KisPropertiesConfiguration* config); KisPropertiesConfiguration* configuration() const; BumpmapWidget * m_page; private: KisPaintDeviceSP m_device; KisImageSP m_image; KisNodeModel * m_model; }; #endif
#include <stdio.h> #include <stdlib.h> #include <unistd.h> static char **argv; void restart_init(char **cmd_line_argv) { argv = cmd_line_argv; } void restart(void) { fprintf(stderr, "info: restarting jgmenu...\n"); if (execvp(argv[0], argv) < 0) fprintf(stderr, "warn: restart failed\n"); }
// SPDX-License-Identifier: GPL-2.0 // // Exemples de la formation // "Ecriture de drivers et programmation noyau Linux" // Chapitre "Drive ren mode caracteres" // // (c) 2001-2022 Christophe Blaess // // https://www.logilin.fr/ // #include <linux/cdev.h> #include <linux/device.h> #include <linux/fs.h> #include <linux/miscdevice.h> #include <linux/mm.h> #include <linux/module.h> #include <linux/mutex.h> #include <linux/sched.h> #include <linux/slab.h> #include <linux/timer.h> #include <linux/version.h> #include <asm/io.h> struct timer_list example_timer; static char *example_buffer; #if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 15, 0) static void example_timer_function(struct timer_list *unused) #else static void example_timer_function(unsigned long unused) #endif { sprintf(example_buffer, "\r%s: %lu", THIS_MODULE->name, jiffies); mod_timer(&example_timer, jiffies + HZ); } static int example_mmap(struct file *filp, struct vm_area_struct *vma) { int err; if ((unsigned long) (vma->vm_end - vma->vm_start) > PAGE_SIZE) return -EINVAL; err = remap_pfn_range(vma, (unsigned long) (vma->vm_start), virt_to_phys(example_buffer) >> PAGE_SHIFT, vma->vm_end - vma->vm_start, vma->vm_page_prot); if (err != 0) return -EAGAIN; return 0; } static const struct file_operations example_fops = { .owner = THIS_MODULE, .mmap = example_mmap, }; static struct miscdevice example_misc_driver = { .minor = MISC_DYNAMIC_MINOR, .name = THIS_MODULE->name, .fops = &example_fops, .mode = 0666, }; static int __init example_init(void) { int err; struct page *pg = NULL; example_buffer = kzalloc(PAGE_SIZE, GFP_KERNEL); if (example_buffer == NULL) return -ENOMEM; example_buffer[0] = '\0'; pg = virt_to_page(example_buffer); SetPageReserved(pg); err = misc_register(&example_misc_driver); if (err != 0) { ClearPageReserved(pg); #if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 9, 0) kfree_sensitive(example_buffer); #else kzfree(example_buffer); #endif example_buffer = NULL; return err; } #if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 15, 0) timer_setup(&example_timer, example_timer_function, 0); #else init_timer(&example_timer); example_timer.function = example_timer_function; #endif example_timer.expires = jiffies + HZ; add_timer(&example_timer); return 0; } static void __exit example_exit(void) { struct page *pg; del_timer(&example_timer); pg = virt_to_page(example_buffer); ClearPageReserved(pg); #if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 9, 0) kfree_sensitive(example_buffer); #else kzfree(example_buffer); #endif example_buffer = NULL; misc_deregister(&example_misc_driver); } module_init(example_init); module_exit(example_exit); MODULE_DESCRIPTION("mmap() system call installation"); MODULE_AUTHOR("Christophe Blaess <Christophe.Blaess@Logilin.fr>"); MODULE_LICENSE("GPL v2");
/**************************************************************************** ** $Id: qt/flow.h 3.3.8 edited Jan 11 14:46 $ ** ** Definition of simple flow layout for custom layout example ** ** Created : 979899 ** ** Copyright (C) 1997-2007 Trolltech ASA. All rights reserved. ** ** This file is part of an example program for Qt. This example ** program may be used, distributed and modified without limitation. ** *****************************************************************************/ #ifndef FLOW_H #define FLOW_H #include <qlayout.h> #include <qptrlist.h> class SimpleFlow : public QLayout { public: SimpleFlow( QWidget *parent, int border=0, int space=-1, const char *name=0 ) : QLayout( parent, border, space, name ), cached_width(0) {} SimpleFlow( QLayout* parent, int space=-1, const char *name=0 ) : QLayout( parent, space, name ), cached_width(0) {} SimpleFlow( int space=-1, const char *name=0 ) : QLayout( space, name ), cached_width(0) {} ~SimpleFlow(); void addItem( QLayoutItem *item); bool hasHeightForWidth() const; int heightForWidth( int ) const; QSize sizeHint() const; QSize minimumSize() const; QLayoutIterator iterator(); QSizePolicy::ExpandData expanding() const; protected: void setGeometry( const QRect& ); private: int doLayout( const QRect&, bool testonly = FALSE ); QPtrList<QLayoutItem> list; int cached_width; int cached_hfw; }; #endif
// The following ifdef block is the standard way of creating macros which make exporting // from a DLL simpler. All files within this DLL are compiled with the BASEMOD_EXPORTS // symbol defined on the command line. This symbol should not be defined on any project // that uses this DLL. This way any other project whose source files include this file see // BASEMOD_API functions as being imported from a DLL, whereas this DLL sees symbols // defined with this macro as being exported. #define BASEMOD_API __declspec( dllexport )
/** * UGENE - Integrated Bioinformatics Tools. * Copyright (C) 2008-2022 UniPro <ugene@unipro.ru> * http://ugene.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, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, * MA 02110-1301, USA. */ #ifndef _SEND_REPORT_DIALOG_H_ #define _SEND_REPORT_DIALOG_H_ #include <ui_SendReportDialog.h> class QEventLoop; class QNetworkReply; class ReportSender : public QObject { Q_OBJECT public: ReportSender(bool addGuiTestInfo = false); void parse(const QString& str, const QString& dumpUrl); bool send(const QString& additionalInfo, const QString& dumpUrl); QString getOSVersion(); QString getReport() const { return report; } int getTotalPhysicalMemory(); QString getCPUInfo(); QString getArchSuffix() const; void setFailedTest(const QString& failedTestStr); private slots: void sl_replyFinished(QNetworkReply*); private: QString report; QEventLoop loop; bool addGuiTestInfo; QString failedTest; }; class SendReportDialog : public QDialog, public Ui_Dialog { Q_OBJECT public: SendReportDialog(const QString& report, const QString& dumpUrl, QDialog* d = nullptr); private: void openUgene() const; QString getUgeneExecutablePath() const; QStringList getParameters() const; private slots: void sl_onOkClicked(); void sl_onMaximumMessageSizeReached(); void sl_onCancelClicked(); private: ReportSender sender; const QString dumpUrl; }; #endif
/* * Blackfin CPLB initialization * * Copyright 2008-2009 Analog Devices Inc. * * Licensed under the GPL-2 or later. */ #include <linux/module.h> #include <asm/blackfin.h> #include <asm/cplb.h> #include <asm/cplbinit.h> #include <asm/mem_map.h> <<<<<<< HEAD ======= #if ANOMALY_05000263 # error the MPU will not function safely while Anomaly 05000263 applies #endif >>>>>>> 296c66da8a02d52243f45b80521febece5ed498a struct cplb_entry icplb_tbl[NR_CPUS][MAX_CPLBS]; struct cplb_entry dcplb_tbl[NR_CPUS][MAX_CPLBS]; int first_switched_icplb, first_switched_dcplb; int first_mask_dcplb; void __init generate_cplb_tables_cpu(unsigned int cpu) { int i_d, i_i; unsigned long addr; unsigned long d_data, i_data; unsigned long d_cache = 0, i_cache = 0; printk(KERN_INFO "MPU: setting up cplb tables with memory protection\n"); #ifdef CONFIG_BFIN_EXTMEM_ICACHEABLE i_cache = CPLB_L1_CHBL | ANOMALY_05000158_WORKAROUND; #endif #ifdef CONFIG_BFIN_EXTMEM_DCACHEABLE d_cache = CPLB_L1_CHBL; #ifdef CONFIG_BFIN_EXTMEM_WRITETHROUGH d_cache |= CPLB_L1_AOW | CPLB_WT; #endif #endif i_d = i_i = 0; /* Set up the zero page. */ dcplb_tbl[cpu][i_d].addr = 0; dcplb_tbl[cpu][i_d++].data = SDRAM_OOPS | PAGE_SIZE_1KB; icplb_tbl[cpu][i_i].addr = 0; icplb_tbl[cpu][i_i++].data = CPLB_VALID | i_cache | CPLB_USER_RD | PAGE_SIZE_1KB; /* Cover kernel memory with 4M pages. */ addr = 0; d_data = d_cache | CPLB_SUPV_WR | CPLB_VALID | PAGE_SIZE_4MB | CPLB_DIRTY; i_data = i_cache | CPLB_VALID | CPLB_PORTPRIO | PAGE_SIZE_4MB; for (; addr < memory_start; addr += 4 * 1024 * 1024) { dcplb_tbl[cpu][i_d].addr = addr; dcplb_tbl[cpu][i_d++].data = d_data; icplb_tbl[cpu][i_i].addr = addr; icplb_tbl[cpu][i_i++].data = i_data | (addr == 0 ? CPLB_USER_RD : 0); } #ifdef CONFIG_ROMKERNEL /* Cover kernel XIP flash area */ addr = CONFIG_ROM_BASE & ~(4 * 1024 * 1024 - 1); dcplb_tbl[cpu][i_d].addr = addr; dcplb_tbl[cpu][i_d++].data = d_data | CPLB_USER_RD; icplb_tbl[cpu][i_i].addr = addr; icplb_tbl[cpu][i_i++].data = i_data | CPLB_USER_RD; #endif /* Cover L1 memory. One 4M area for code and data each is enough. */ #if L1_DATA_A_LENGTH > 0 || L1_DATA_B_LENGTH > 0 dcplb_tbl[cpu][i_d].addr = get_l1_data_a_start_cpu(cpu); dcplb_tbl[cpu][i_d++].data = L1_DMEMORY | PAGE_SIZE_4MB; #endif #if L1_CODE_LENGTH > 0 icplb_tbl[cpu][i_i].addr = get_l1_code_start_cpu(cpu); icplb_tbl[cpu][i_i++].data = L1_IMEMORY | PAGE_SIZE_4MB; #endif /* Cover L2 memory */ #if L2_LENGTH > 0 dcplb_tbl[cpu][i_d].addr = L2_START; dcplb_tbl[cpu][i_d++].data = L2_DMEMORY; icplb_tbl[cpu][i_i].addr = L2_START; icplb_tbl[cpu][i_i++].data = L2_IMEMORY; #endif first_mask_dcplb = i_d; first_switched_dcplb = i_d + (1 << page_mask_order); first_switched_icplb = i_i; while (i_d < MAX_CPLBS) dcplb_tbl[cpu][i_d++].data = 0; while (i_i < MAX_CPLBS) icplb_tbl[cpu][i_i++].data = 0; } void __init generate_cplb_tables_all(void) { }
/* pmacct (Promiscuous mode IP Accounting package) pmacct is Copyright (C) 2003-2017 by Paolo Lucente */ /* 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. */ /* includes */ #if (!defined __PLUGIN_COMMON_EXPORT) #include "net_aggr.h" #include "ports_aggr.h" /* including sql_common.h exporteable part as pre-requisite for preprocess.h inclusion later */ #define __SQL_COMMON_EXPORT #include "sql_common.h" #undef __SQL_COMMON_EXPORT #endif /* #if (!defined __PLUGIN_COMMON_EXPORT) */ /* defines */ #define DEFAULT_PLUGIN_COMMON_REFRESH_TIME 60 #define DEFAULT_PLUGIN_COMMON_WRITERS_NO 10 #define AVERAGE_CHAIN_LEN 10 #define PRINT_CACHE_ENTRIES 16411 /* cache element states */ #define PRINT_CACHE_FREE 0 #define PRINT_CACHE_COMMITTED 1 #define PRINT_CACHE_INUSE 2 #define PRINT_CACHE_INVALID 3 #define PRINT_CACHE_ERROR 255 /* structures */ #ifndef STRUCT_SCRATCH_AREA #define STRUCT_SCRATCH_AREA struct scratch_area { unsigned char *base; unsigned char *ptr; u_int64_t num; u_int64_t size; struct scratch_area *next; }; #endif #ifndef STRUCT_CHAINED_CACHE #define STRUCT_CHAINED_CACHE struct chained_cache { struct pkt_primitives primitives; pm_counter_t bytes_counter; pm_counter_t packet_counter; pm_counter_t flow_counter; u_int8_t flow_type; u_int32_t tcp_flags; struct pkt_bgp_primitives *pbgp; struct pkt_nat_primitives *pnat; struct pkt_mpls_primitives *pmpls; char *pcust; struct pkt_vlen_hdr_primitives *pvlen; u_int8_t valid; u_int8_t prep_valid; struct timeval basetime; struct pkt_stitching *stitch; struct chained_cache *next; }; #endif #ifndef P_TABLE_RR #define P_TABLE_RR struct p_table_rr { int min; /* unused */ int max; int next; }; #endif #ifndef P_BROKER_TIMERS #define P_BROKER_TIMERS struct p_broker_timers { time_t last_fail; int retry_interval; }; #endif #if (!defined __PLUGIN_COMMON_EXPORT) #include "preprocess.h" /* prototypes */ #if (!defined __PLUGIN_COMMON_C) #define EXT extern #else #define EXT #endif EXT void P_set_signals(); EXT void P_init_default_values(); EXT void P_config_checks(); EXT struct chained_cache *P_cache_attach_new_node(struct chained_cache *); EXT unsigned int P_cache_modulo(struct primitives_ptrs *); EXT void P_sum_host_insert(struct primitives_ptrs *, struct insert_data *); EXT void P_sum_port_insert(struct primitives_ptrs *, struct insert_data *); EXT void P_sum_as_insert(struct primitives_ptrs *, struct insert_data *); #if defined (HAVE_L2) EXT void P_sum_mac_insert(struct primitives_ptrs *, struct insert_data *); #endif EXT struct chained_cache *P_cache_search(struct primitives_ptrs *); EXT void P_cache_insert(struct primitives_ptrs *, struct insert_data *); EXT void P_cache_insert_pending(struct chained_cache *[], int, struct chained_cache *); EXT void P_cache_mark_flush(struct chained_cache *[], int, int); EXT void P_cache_flush(struct chained_cache *[], int); EXT void P_cache_handle_flush_event(struct ports_table *); EXT void P_exit_now(int); EXT int P_trigger_exec(char *); EXT void primptrs_set_all_from_chained_cache(struct primitives_ptrs *, struct chained_cache *); EXT void P_handle_table_dyn_rr(char *, int, char *, struct p_table_rr *); EXT void P_handle_table_dyn_strings(char *, int, char *, struct chained_cache *); EXT void P_broker_timers_set_last_fail(struct p_broker_timers *, time_t); EXT void P_broker_timers_set_retry_interval(struct p_broker_timers *, int); EXT void P_broker_timers_unset_last_fail(struct p_broker_timers *); EXT time_t P_broker_timers_get_last_fail(struct p_broker_timers *); EXT int P_broker_timers_get_retry_interval(struct p_broker_timers *); EXT void P_init_historical_acct(time_t); EXT void P_init_refresh_deadline(time_t *, int, int, char *); EXT void P_eval_historical_acct(struct timeval *, struct timeval *, time_t); EXT int P_cmp_historical_acct(struct timeval *, struct timeval *); EXT int P_test_zero_elem(struct chained_cache *); /* global vars */ EXT void (*insert_func)(struct primitives_ptrs *, struct insert_data *); /* pointer to INSERT function */ EXT void (*purge_func)(struct chained_cache *[], int); /* pointer to purge function */ EXT struct scratch_area sa; EXT struct chained_cache *cache; EXT struct chained_cache **queries_queue, **pending_queries_queue, *pqq_container; EXT struct timeval flushtime; EXT int qq_ptr, pqq_ptr, pp_size, pb_size, pn_size, pm_size, pc_size; EXT int dbc_size, quit; EXT time_t refresh_deadline; EXT void (*basetime_init)(time_t); EXT void (*basetime_eval)(struct timeval *, struct timeval *, time_t); EXT int (*basetime_cmp)(struct timeval *, struct timeval *); EXT struct timeval basetime, ibasetime, new_basetime; EXT time_t timeslot; EXT int dyn_table; #undef EXT #endif /* #if (!defined __PLUGIN_COMMON_EXPORT) */
/* Copyright (c) 2010-2011, Code Aurora Forum. All rights reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 and * only version 2 as published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * */ #ifndef __MACH_QDSP6V2_SNDDEV_ICODEC_H #define __MACH_QDSP6V2_SNDDEV_ICODEC_H #include <linux/mfd/msm-adie-codec.h> #include <mach/qdsp5v2/audio_def.h> #include <mach/pmic.h> struct snddev_icodec_data { u32 capability; const char *name; u32 copp_id; struct adie_codec_dev_profile *profile; u8 channel_mode; u32 default_sample_rate; int (*pamp_on) (void); void (*pamp_off) (void); int (*voltage_on) (void); void (*voltage_off) (void); u32 dev_vol_type; #ifdef CONFIG_MACH_RUBY u32 aic3254_id; u32 aic3254_voc_id; u32 default_aic3254_id; #endif }; #ifdef CONFIG_MACH_RUBY struct snddev_icodec_state { struct snddev_icodec_data *data; struct adie_codec_path *adie_path; u32 sample_rate; u32 enabled; }; struct q6v2audio_analog_ops { void (*speaker_enable)(int en); void (*headset_enable)(int en); void (*handset_enable)(int en); void (*headset_speaker_enable)(int en); void (*int_mic_enable)(int en); void (*back_mic_enable)(int en); void (*ext_mic_enable)(int en); void (*stereo_mic_enable)(int en); void (*usb_headset_enable)(int en); void (*fm_headset_enable)(int en); void (*fm_speaker_enable)(int en); void (*voltage_on) (int on); }; struct q6v2audio_aic3254_ops { void (*aic3254_set_mode)(int config, int mode); }; struct q6v2audio_icodec_ops { int (*support_aic3254) (void); int (*support_adie) (void); int (*is_msm_i2s_slave) (void); int (*support_aic3254_use_mclk) (void); }; struct aic3254_info { u32 dev_id; u32 path_id; }; int update_aic3254_info(struct aic3254_info *info); void htc_8x60_register_analog_ops(struct q6v2audio_analog_ops *ops); void htc_8x60_register_aic3254_ops(struct q6v2audio_aic3254_ops *ops); void htc_8x60_register_icodec_ops(struct q6v2audio_icodec_ops *ops); #endif #endif
//////////////////////////////////////////////////////////////////////////////// // // Copyright (c) 2008 The Regents of the University of California // // This file is part of Qbox // // Qbox is distributed 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. // See the file COPYING in the root directory of this distribution // or <http://www.gnu.org/licenses/>. // //////////////////////////////////////////////////////////////////////////////// // // ThWidth.h // //////////////////////////////////////////////////////////////////////////////// // $Id: ThWidth.h,v 1.4 2008-09-08 15:56:19 fgygi Exp $ #ifndef THWIDTH_H #define THWIDTH_H #include<iostream> #include<iomanip> #include<sstream> #include<stdlib.h> #include "Sample.h" class ThWidth : public Var { Sample *s; public: const char *name ( void ) const { return "th_width"; }; int set ( int argc, char **argv ) { if ( argc != 2 ) { if ( ui->onpe0() ) cout << " th_width takes only one value" << endl; return 1; } double v = atof(argv[1]); if ( v <= 0.0 ) { if ( ui->onpe0() ) cout << " th_width must be positive" << endl; return 1; } s->ctrl.th_width = v; return 0; } string print (void) const { ostringstream st; st.setf(ios::left,ios::adjustfield); st << setw(10) << name() << " = "; st.setf(ios::right,ios::adjustfield); st << setw(10) << s->ctrl.th_width; return st.str(); } ThWidth(Sample *sample) : s(sample) { s->ctrl.th_width = 100.0; } }; #endif
/* ** FamiTracker - NES/Famicom sound tracker ** Copyright (C) 2005-2014 Jonathan Liss ** ** 0CC-FamiTracker is (C) 2014-2016 HertzDevil ** ** 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 ** Library General Public License for more details. To obtain a ** copy of the GNU Library General Public License, write to the Free ** Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. ** ** Any permitted reproduction of these routines, in whole or in part, ** must bear this legend. */ #pragma once #include <array> #include <memory> #include <functional> /*! \brief A fixed-size container for general objects. */ template <class T, size_t N> class CGenCollection { public: using base_type = CGenCollection<T, N>; using element_type = std::unique_ptr<T>; /*! \brief Default constructor. Creates an empty collection. */ CGenCollection() = default; /*! \brief Default destructor. */ ~CGenCollection() = default; CGenCollection(const CGenCollection &); CGenCollection(CGenCollection &&); CGenCollection &operator=(CGenCollection); template <class _T, size_t _N> friend void swap(CGenCollection<_T, _N> &, CGenCollection<_T, _N> &); template <class... Args> T *Create(size_t index, Args&&... args); void Replace(size_t index, T *obj); T *Detach(size_t index); void Swap(size_t A, size_t B); void Trim(); void Trim(std::function<void(size_t, size_t)> callback); std::array<size_t, N> TrimMap(); T *GetAt(size_t index); T *operator[](size_t index); const T *GetAt(size_t index) const; const T *operator[](size_t index) const; static constexpr size_t GetCapacity(); bool ContainsAt(size_t index) const; size_t GetUsedCount() const; size_t GetNextUsed(size_t whence = -1) const; size_t GetNextFree(size_t whence = -1) const; protected: class Range; public: Range ElementIndices(size_t whence = -1); Range EmptyIndices(size_t whence = -1); private: template <class _T, size_t _N> friend typename std::array<std::unique_ptr<_T>, _N>::iterator begin(CGenCollection<_T, _N> &col); template <class _T, size_t _N> friend typename std::array<std::unique_ptr<_T>, _N>::iterator end(CGenCollection<_T, _N> &col); private: std::array<std::unique_ptr<T>, N> m_data; }; template <class T, size_t N> class CGenCollection<T, N>::Range { private: using func_type = std::function<size_t(const CGenCollection *, size_t)>; class Iterator { public: Iterator(const CGenCollection *col, func_type f, size_t n); bool operator!=(const Iterator &other); size_t operator*() const; Iterator &operator++(); private: const CGenCollection *pCol; const func_type step; size_t pos; }; public: Range(const CGenCollection *col, func_type f, size_t whence = -1); Iterator begin(); Iterator end(); private: Iterator _b, _e; }; #include "GenCollection.inl"
/** * This header is generated by class-dump-z 0.2b. * * Source: /System/Library/PrivateFrameworks/OfficeImport.framework/OfficeImport */ #import <OfficeImport/MFObject.h> #import <OfficeImport/XXUnknownSuperclass.h> @class NSColorStub; __attribute__((visibility("hidden"))) @interface MFPen : XXUnknownSuperclass <MFObject> { @private int m_penStyle; // 4 = 0x4 int m_penWidth; // 8 = 0x8 NSColorStub *m_colour; // 12 = 0xc double *m_userStyleArray; // 16 = 0x10 } + (id)pen; // 0x180835 + (id)penWithStyle:(int)style width:(long)width colour:(id)colour styleArray:(double *)array; // 0x2c8349 - (id)init; // 0x18086d - (id)initWithStyle:(int)style width:(long)width colour:(id)colour styleArray:(double *)array; // 0x96b65 - (void)dealloc; // 0x91e11 - (int)selectInto:(id)into; // 0x99fdd - (id)getColor; // 0x9b3cd - (long)getWidth; // 0x2c8339 - (int)getStyle; // 0x9b481 @end
/* * adesto.c * Driver for Adesto Technologies SPI flash * Copyright 2014 Orion Technologies, LLC * Author: Chris Douglass <cdouglass <at> oriontechnologies.com> * * based on winbond.c * Copyright 2008, Network Appliance Inc. * Author: Jason McMullan <mcmullan <at> netapp.com> * Licensed under the GPL-2 or later. */ #include <console/console.h> #include <stdlib.h> #include <spi_flash.h> #include <spi-generic.h> #include "spi_flash_internal.h" /* at25dfxx-specific commands */ #define CMD_AT25DF_WREN 0x06 /* Write Enable */ #define CMD_AT25DF_WRDI 0x04 /* Write Disable */ #define CMD_AT25DF_RDSR 0x05 /* Read Status Register */ #define CMD_AT25DF_WRSR 0x01 /* Write Status Register */ #define CMD_AT25DF_READ 0x03 /* Read Data Bytes */ #define CMD_AT25DF_FAST_READ 0x0b /* Read Data Bytes at Higher Speed */ #define CMD_AT25DF_PP 0x02 /* Page Program */ #define CMD_AT25DF_SE 0x20 /* Sector (4K) Erase */ #define CMD_AT25DF_BE 0xd8 /* Block (64K) Erase */ #define CMD_AT25DF_CE 0xc7 /* Chip Erase */ #define CMD_AT25DF_DP 0xb9 /* Deep Power-down */ #define CMD_AT25DF_RES 0xab /* Release from DP, and Read Signature */ struct adesto_spi_flash_params { uint16_t id; /* Log2 of page size in power-of-two mode */ uint8_t l2_page_size; uint16_t pages_per_sector; uint16_t sectors_per_block; uint16_t nr_blocks; const char *name; }; /* spi_flash needs to be first so upper layers can free() it */ struct adesto_spi_flash { struct spi_flash flash; const struct adesto_spi_flash_params *params; }; static inline struct adesto_spi_flash * to_adesto_spi_flash(const struct spi_flash *flash) { return container_of(flash, struct adesto_spi_flash, flash); } static const struct adesto_spi_flash_params adesto_spi_flash_table[] = { { .id = 0x4501, .l2_page_size = 8, .pages_per_sector = 16, .sectors_per_block = 16, .nr_blocks = 16, .name = "AT25DF081", }, { .id = 0x4701, .l2_page_size = 8, .pages_per_sector = 16, .sectors_per_block = 16, .nr_blocks = 64, .name = "AT25DF321", }, { .id = 0x4800, .l2_page_size = 8, .pages_per_sector = 16, .sectors_per_block = 16, .nr_blocks = 128, .name = "AT25DF641", }, }; static int adesto_write(const struct spi_flash *flash, u32 offset, size_t len, const void *buf) { struct adesto_spi_flash *stm = to_adesto_spi_flash(flash); unsigned long byte_addr; unsigned long page_size; size_t chunk_len; size_t actual; int ret; u8 cmd[4]; page_size = 1 << stm->params->l2_page_size; byte_addr = offset % page_size; for (actual = 0; actual < len; actual += chunk_len) { chunk_len = min(len - actual, page_size - byte_addr); chunk_len = spi_crop_chunk(sizeof(cmd), chunk_len); cmd[0] = CMD_AT25DF_PP; cmd[1] = (offset >> 16) & 0xff; cmd[2] = (offset >> 8) & 0xff; cmd[3] = offset & 0xff; #if CONFIG_DEBUG_SPI_FLASH printk(BIOS_SPEW, "PP: 0x%p => cmd = { 0x%02x 0x%02x%02x%02x }" " chunk_len = %zu\n", buf + actual, cmd[0], cmd[1], cmd[2], cmd[3], chunk_len); #endif ret = spi_flash_cmd(flash->spi, CMD_AT25DF_WREN, NULL, 0); if (ret < 0) { printk(BIOS_WARNING, "SF: Enabling Write failed\n"); goto out; } ret = spi_flash_cmd_write(flash->spi, cmd, sizeof(cmd), buf + actual, chunk_len); if (ret < 0) { printk(BIOS_WARNING, "SF: adesto Page Program failed\n"); goto out; } ret = spi_flash_cmd_wait_ready(flash, SPI_FLASH_PROG_TIMEOUT); if (ret) goto out; offset += chunk_len; byte_addr = 0; } #if CONFIG_DEBUG_SPI_FLASH printk(BIOS_SPEW, "SF: adesto: Successfully programmed %zu bytes @" " 0x%lx\n", len, (unsigned long)(offset - len)); #endif ret = 0; out: return ret; } struct spi_flash *spi_flash_probe_adesto(struct spi_slave *spi, u8 *idcode) { const struct adesto_spi_flash_params *params; unsigned page_size; struct adesto_spi_flash *stm; unsigned int i; for (i = 0; i < ARRAY_SIZE(adesto_spi_flash_table); i++) { params = &adesto_spi_flash_table[i]; if (params->id == ((idcode[1] << 8) | idcode[2])) break; } if (i == ARRAY_SIZE(adesto_spi_flash_table)) { printk(BIOS_WARNING, "SF: Unsupported adesto ID %02x%02x\n", idcode[1], idcode[2]); return NULL; } stm = malloc(sizeof(struct adesto_spi_flash)); if (!stm) { printk(BIOS_WARNING, "SF: Failed to allocate memory\n"); return NULL; } stm->params = params; stm->flash.spi = spi; stm->flash.name = params->name; /* Assuming power-of-two page size initially. */ page_size = 1 << params->l2_page_size; stm->flash.internal_write = adesto_write; stm->flash.internal_erase = spi_flash_cmd_erase; #if CONFIG_SPI_FLASH_NO_FAST_READ stm->flash.internal_read = spi_flash_cmd_read_slow; #else stm->flash.internal_read = spi_flash_cmd_read_fast; #endif stm->flash.sector_size = (1 << stm->params->l2_page_size) * stm->params->pages_per_sector; stm->flash.size = page_size * params->pages_per_sector * params->sectors_per_block * params->nr_blocks; stm->flash.erase_cmd = CMD_AT25DF_SE; return &stm->flash; }
/* ----------------------------------------------------------------------------- This source file is part of OGRE (Object-oriented Graphics Rendering Engine) For the latest info, see http://www.ogre3d.org/ Copyright (c) 2000-2013 Torus Knot Software Ltd Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ----------------------------------------------------------------------------- */ #ifndef __DeflectorPlaneAffectorFactory_H__ #define __DeflectorPlaneAffectorFactory_H__ #include "OgreParticleFXPrerequisites.h" #include "OgreParticleAffectorFactory.h" #include "OgreDeflectorPlaneAffector.h" namespace Ogre { /** Factory class for DeflectorPlaneAffector. */ class _OgreParticleFXExport DeflectorPlaneAffectorFactory : public ParticleAffectorFactory { /** See ParticleAffectorFactory */ String getName() const { return "DeflectorPlane"; } /** See ParticleAffectorFactory */ ParticleAffector* createAffector(ParticleSystem* psys) { ParticleAffector* p = OGRE_NEW DeflectorPlaneAffector(psys); mAffectors.push_back(p); return p; } }; } #endif
/* Write a PDB file */ /* Copyright (c) 2007 MJ Rutter * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License version 2 * as published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the * Free Software Foundation, Inc., 51 Franklin Street, * Fifth Floor, Boston, MA 02110-1301, USA. */ #include<stdio.h> #include "c2xsf.h" #include "c2xsf_extern.h" void cell_write(FILE* outfile){ int i; fprintf(outfile,"%%block LATTICE_CART\nang\n"); for(i=0;i<3;i++) fprintf(outfile,"%f %f %f\n", basis[i][0],basis[i][1],basis[i][2]); fprintf(outfile,"%%endblock LATTICE_CART\n\n"); fprintf(outfile,"%%block POSITIONS_FRAC\n"); for(i=0;i<natoms;i++) fprintf(outfile,"%3s %14.9f %14.9f %14.9f\n", atno2sym(atoms[i].atno),atoms[i].frac[0], atoms[i].frac[1],atoms[i].frac[2]); fprintf(outfile,"%%endblock POSITIONS_FRAC\n"); } void cell_write_abc(FILE* outfile){ int i; double abc[6]; fprintf(outfile,"%%block LATTICE_ABC\nang\n"); cart2abc(basis,abc,1); fprintf(outfile,"%f %f %f\n%f %f %f\n", abc[0],abc[1],abc[2],abc[3],abc[4],abc[5]); fprintf(outfile,"%%endblock LATTICE_ABC\n\n"); fprintf(outfile,"%%block POSITIONS_FRAC\n"); for(i=0;i<natoms;i++) fprintf(outfile,"%3s %14.9f %14.9f %14.9f\n", atno2sym(atoms[i].atno),atoms[i].frac[0], atoms[i].frac[1],atoms[i].frac[2]); fprintf(outfile,"%%endblock POSITIONS_FRAC\n"); } void cell_write_abs(FILE* outfile){ int i; fprintf(outfile,"%%block LATTICE_CART\nang\n"); for(i=0;i<3;i++) fprintf(outfile,"%f %f %f\n", basis[i][0],basis[i][1],basis[i][2]); fprintf(outfile,"%%endblock LATTICE_CART\n\n"); fprintf(outfile,"%%block POSITIONS_ABS\n"); for(i=0;i<natoms;i++) fprintf(outfile,"%3s %14.9f %14.9f %14.9f\n", atno2sym(atoms[i].atno),atoms[i].abs[0], atoms[i].abs[1],atoms[i].abs[2]); fprintf(outfile,"%%endblock POSITIONS_ABS\n"); } void cell_write_abc_abs(FILE* outfile){ int i; double abc[6]; fprintf(outfile,"%%block LATTICE_ABC\nang\n"); cart2abc(basis,abc,1); fprintf(outfile,"%f %f %f\n%f %f %f\n", abc[0],abc[1],abc[2],abc[3],abc[4],abc[5]); fprintf(outfile,"%%endblock LATTICE_ABC\n\n"); fprintf(outfile,"%%block POSITIONS_ABS\n"); for(i=0;i<natoms;i++) fprintf(outfile,"%3s %14.9f %14.9f %14.9f\n", atno2sym(atoms[i].atno),atoms[i].abs[0], atoms[i].abs[1],atoms[i].abs[2]); fprintf(outfile,"%%endblock POSITIONS_ABS\n"); }
//--------------------------------------------------------------------------- // rtl_delay //--------------------------------------------------------------------------- #include "hal_configall.h" #include <tchar.h> #include <time.h> #include <stdio.h> #define WIN32_LEAN_AND_MEAN #include <windows.h> #include "hal_foundation.h" #include "hal_delay.h" //--------------------------------------------------------------------------- //--------------------------------------------------------------------------- // ¸ß¾«¶ÈÑÓʱµÄ³ÌÐò, ²ÎÊý: ΢Ãë: // reference // Victor Chen, CPU ²âËÙ(MHz)ºÍ¸ß¾«¶ÈÑÓʱ(΢Ãë¼¶) // http://www.cppfans.com/articles/system/cpuspd_usdly.asp void delay_us(__int64 Us) { LARGE_INTEGER CurrTicks, TicksCount; QueryPerformanceFrequency(&TicksCount); QueryPerformanceCounter(&CurrTicks); // todo 2010.01 // need revise // is it correct? TicksCount.QuadPart = TicksCount.QuadPart * Us / 100000064; TicksCount.QuadPart += CurrTicks.QuadPart; while(CurrTicks.QuadPart<TicksCount.QuadPart) QueryPerformanceCounter(&CurrTicks); } // reference // Victor Chen, CPU ²âËÙ(MHz)ºÍ¸ß¾«¶ÈÑÓʱ(΢Ãë¼¶) // http://www.cppfans.com/articles/system/cpuspd_usdly.asp /* ÀûÓà rdtsc »ã±àÖ¸Áî¿ÉÒԵõ½ CPU ÄÚ²¿¶¨Ê±Æ÷µÄÖµ, ÿ¾­¹ýÒ»¸ö CPU ÖÜÆÚ, Õâ¸ö¶¨Ê±Æ÷¾Í¼ÓÒ»¡£ Èç¹ûÔÚÒ»¶Îʱ¼äÄÚÊýµÃ CPU µÄÖÜÆÚÊý, CPU¹¤×÷ƵÂÊ = ÖÜÆÚÊý / ʱ¼ä ΪÁ˲»ÈÃÆäËû½ø³ÌºÍÏ̴߳òÈÅ, ±ØÐèÒªÉèÖÃ×î¸ßµÄÓÅÏȼ¶ ÒÔϺ¯ÊýÉèÖõ±Ç°½ø³ÌºÍÏ̵߳½×î¸ßµÄÓÅÏȼ¶¡£ SetPriorityClass(GetCurrentProcess(), REALTIME_PRIORITY_CLASS); SetThreadPriority(GetCurrentThread(), THREAD_PRIORITY_TIME_CRITICAL); CPU ²âËÙ³ÌÐòµÄÔ´´úÂë, Õâ¸ö³ÌÐòͨ¹ý CPU ÔÚ 1/16 ÃëµÄʱ¼äÄÚ¾­¹ýµÄÖÜÆÚÊý¼ÆËã³ö¹¤×÷ƵÂÊ, µ¥Î» MHz: */ int cpu_frequency(void) //MHz {/* LARGE_INTEGER CurrTicks, TicksCount; __int64 iStartCounter, iStopCounter; DWORD dwOldProcessP = GetPriorityClass(GetCurrentProcess()); DWORD dwOldThreadP = GetThreadPriority(GetCurrentThread()); SetPriorityClass(GetCurrentProcess(), REALTIME_PRIORITY_CLASS); SetThreadPriority(GetCurrentThread(), THREAD_PRIORITY_TIME_CRITICAL); QueryPerformanceFrequency(&TicksCount); QueryPerformanceCounter(&CurrTicks); TicksCount.QuadPart /= 16; TicksCount.QuadPart += CurrTicks.QuadPart; asm rdtsc asm mov DWORD PTR iStartCounter, EAX asm mov DWORD PTR (iStartCounter+4), EDX while(CurrTicks.QuadPart<TicksCount.QuadPart) QueryPerformanceCounter(&CurrTicks); asm rdtsc asm mov DWORD PTR iStopCounter, EAX asm mov DWORD PTR (iStopCounter + 4), EDX SetThreadPriority(GetCurrentThread(), dwOldThreadP); SetPriorityClass(GetCurrentProcess(), dwOldProcessP); return (int)((iStopCounter-iStartCounter)/62500); */ // todo return 1; } // reference // Victor Chen, CPU ²âËÙ(MHz)ºÍ¸ß¾«¶ÈÑÓʱ(΢Ãë¼¶) // http://www.cppfans.com/articles/system/cpuspd_usdly.asp // Ç°ÃæÊÇÓà API º¯Êý½øÐÐÑÓʱ, Èç¹ûÖªµÀÁË CPU µÄ¹¤×÷ƵÂÊ, ÀûÓÃÑ­»·, Ò²¿ÉÒԵõ½¸ß // ¾«¶ÈµÄÑÓʱ int _CPU_FREQ = 0; //¶¨ÒåÒ»¸öÈ«¾Ö±äÁ¿±£´æ CPU ƵÂÊ (MHz) void CpuDelayUs(__int64 Us) //ÀûÓÃÑ­»·ºÍ CPU µÄƵÂÊÑÓʱ, ²ÎÊý: ΢Ãë { /* __int64 iCounter, iStopCounter; asm rdtsc asm mov DWORD PTR iCounter, EAX asm mov DWORD PTR (iCounter+4), EDX iStopCounter = iCounter + Us*_CPU_FREQ; while(iStopCounter-iCounter>0) { asm rdtsc asm mov DWORD PTR iCounter, EAX asm mov DWORD PTR (iCounter+4), EDX } */ } void TestDelay(void) { /* _CPU_FREQ = CPU_Frequency(); //ÀûÓà CPU ƵÂʳõʼ»¯¶¨Ê± CpuDelayUs(1000000); //ÑÓʱ 1 ÃëÖÓ */ }
/*- * Public platform independent Near Field Communication (NFC) library examples * * Copyright (C) 2009, Roel Verdult * Copyright (C) 2010, Romuald Conty * * 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 HOLDER OR CONTRIBUTORS BE * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. * * Note that this license only applies on the examples, NFC library itself is under LGPL * */ /** * @file nfc-dep-target.c * @brief Turns the NFC device into a D.E.P. target (see NFCIP-1) */ #ifdef HAVE_CONFIG_H # include "config.h" #endif // HAVE_CONFIG_H #include <stdio.h> #include <stdlib.h> #include <nfc/nfc.h> #include "nfc-utils.h" #define MAX_FRAME_LEN 264 int main (int argc, const char *argv[]) { byte_t abtRx[MAX_FRAME_LEN]; size_t szRx; size_t szDeviceFound; byte_t abtTx[] = "Hello Mars!"; nfc_device_t *pnd; #define MAX_DEVICE_COUNT 2 nfc_device_desc_t pnddDevices[MAX_DEVICE_COUNT]; nfc_list_devices (pnddDevices, MAX_DEVICE_COUNT, &szDeviceFound); // Little hack to allow using nfc-dep-initiator & nfc-dep-target from // the same machine: if there is more than one readers connected // nfc-dep-target will connect to the second reader // (we hope they're always detected in the same order) if (szDeviceFound == 1) { pnd = nfc_connect (&(pnddDevices[0])); } else if (szDeviceFound > 1) { pnd = nfc_connect (&(pnddDevices[1])); } else { printf("No device found."); return EXIT_FAILURE; } if (argc > 1) { printf ("Usage: %s\n", argv[0]); return EXIT_FAILURE; } nfc_target_t nt = { .nm.nmt = NMT_DEP, .nm.nbr = NBR_UNDEFINED, // Will be updated by nfc_target_init .nti.ndi.abtNFCID3 = { 0x12, 0x34, 0x56, 0x78, 0x9a, 0xbc, 0xde, 0xff, 0x00, 0x00 }, .nti.ndi.szGB = 4, .nti.ndi.abtGB = { 0x12, 0x34, 0x56, 0x78 }, /* These bytes are not used by nfc_target_init: the chip will provide them automatically to the initiator */ .nti.ndi.btDID = 0x00, .nti.ndi.btBS = 0x00, .nti.ndi.btBR = 0x00, .nti.ndi.btTO = 0x00, .nti.ndi.btPP = 0x01, }; if (!pnd) { printf("Unable to connect to NFC device.\n"); return EXIT_FAILURE; } printf ("Connected to NFC device: %s\n", pnd->acName); printf ("NFC device will now act as: "); print_nfc_target (nt, false); printf ("Waiting for initiator request...\n"); if(!nfc_target_init (pnd, &nt, abtRx, &szRx)) { nfc_perror(pnd, "nfc_target_init"); return EXIT_FAILURE; } printf("Initiator request received. Waiting for data...\n"); if (!nfc_target_receive_bytes (pnd, abtRx, &szRx)) { nfc_perror(pnd, "nfc_target_receive_bytes"); return EXIT_FAILURE; } abtRx[szRx] = '\0'; printf ("Received: %s\n", abtRx); printf ("Sending: %s\n", abtTx); if (!nfc_target_send_bytes (pnd, abtTx, sizeof(abtTx))) { nfc_perror(pnd, "nfc_target_send_bytes"); return EXIT_FAILURE; } printf("Data sent.\n"); nfc_disconnect (pnd); return EXIT_SUCCESS; }
/* ** lid_methods2.c for lemin in /home/guigui/working/CPE_2014_lemin/src ** ** Made by guigui ** Login <guigui@epitech.net> ** ** Started on Sat May 2 10:52:09 2015 guigui ** Last update Sat May 2 11:40:02 2015 guigui */ #include <stdlib.h> #include "my.h" #include "lemindata.h" int lid_exist_pipe(t_lid *this, t_pip *test) { t_mls *cpy; t_pip *tmp; if (this == NULL || test == NULL || this->pipes == NULL || (cpy = this->pipes->next) == NULL) return (FALSE); while (cpy != NULL) { tmp = cpy->item; if (!my_strcmp(test->edge1, tmp->edge1) && !my_strcmp(test->edge2, tmp->edge2)) return (TRUE); cpy = cpy->next; } return (FALSE); } t_lid *construct_lid(t_lid *lid) { if (lid == NULL || (lid->file = createlist(NULL, NULL)) == NULL || (lid->rooms = createlist(NULL, NULL)) == NULL || (lid->pipes = createlist(NULL, NULL)) == NULL) return (NULL); lid->affFile = putstrlist; lid->addFileLine = lid_file_add_line; lid->addRoom = lid_add_room; lid->addPipe = lid_add_pipe; lid->existRoom = lid_exist_room; lid->existPipe = lid_exist_pipe; return (lid); } int is_specialstr(char *line) { if (line == NULL) return (FALSE); return (((my_strlen(line) > 2) && line[0] == '#' && line[1] == '#') ? TRUE : FALSE); } int tab_length(char **tab) { int i; i = -1; if (tab != NULL) while (tab[++i] != NULL); return (i); }
/** * The Forgotten Server - a free and open-source MMORPG server emulator * Copyright (C) 2017 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::string name; std::string article; int32_t attack; int32_t defense; int32_t extraDefense; int32_t armor; int32_t shootRange; int32_t hitChance; bool unique; std::vector<LootBlock> childLoot; LootBlock() { id = 0; countmax = 0; chance = 0; subType = -1; actionId = -1; attack = -1; defense = -1; extraDefense = -1; armor = -1; shootRange = -1; hitChance = -1; unique = false; } }; struct summonBlock_t { std::string name; uint32_t chance; uint32_t speed; uint32_t max; bool force = false; }; class BaseSpell; struct spellBlock_t { constexpr 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 { struct MonsterInfo { LuaScriptInterface* scriptInterface; 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; Skulls_t skull = SKULL_NONE; Outfit_t outfit = {}; RaceType_t race = RACE_BLOOD; LightInfo light = {}; uint16_t lookcorpse = 0; uint64_t experience = 0; uint32_t manaCost = 0; uint32_t yellChance = 0; uint32_t yellSpeedTicks = 0; uint32_t staticAttackChance = 95; uint32_t maxSummons = 0; uint32_t changeTargetSpeed = 0; uint32_t conditionImmunities = 0; uint32_t damageImmunities = 0; uint32_t baseSpeed = 200; int32_t creatureAppearEvent = -1; int32_t creatureDisappearEvent = -1; int32_t creatureMoveEvent = -1; int32_t creatureSayEvent = -1; int32_t thinkEvent = -1; int32_t targetDistance = 1; int32_t runAwayHealth = 0; int32_t health = 100; int32_t healthMax = 100; int32_t changeTargetChance =0; int32_t targetStrategiesNearestPercent = 0; int32_t targetStrategiesLowerHPPercent = 0; int32_t targetStrategiesMostDamagePercent = 0; int32_t targetStrategiesRandom = 100; int32_t defense = 0; int32_t armor = 0; bool canPushItems = false; bool canPushCreatures = false; bool pushable = true; bool isSummonable = false; bool isIllusionable = false; bool isConvinceable = false; bool isAttackable = true; bool isHostile = true; bool hiddenHealth = false; bool isBlockable = true; bool isPassive = false; bool isRewardBoss = false; }; public: MonsterType() = default; // non-copyable MonsterType(const MonsterType&) = delete; MonsterType& operator=(const MonsterType&) = delete; std::string name; std::string nameDescription; MonsterInfo info; void createLoot(Container* corpse); bool createLootContainer(Container* parent, const LootBlock& lootblock); std::vector<Item*> createLootItem(const LootBlock& lootBlock); }; class Monsters { public: 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); static uint32_t getLootRandom(); 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 = ""); MonsterType* loadMonster(const std::string& file, const std::string& monsterName, 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::map<std::string, std::string> unloadedMonsters; std::unique_ptr<LuaScriptInterface> scriptInterface; bool loaded = false; }; #endif
#ifndef COMMODULE_H #define COMMODULE_H #include <QObject> #include <QByteArray> #include <QMap> #include <QQueue> #include <iostream> using namespace std; #include "polyplexer.h" #include "Connector.h" #define PINGPONG_MAX_TRIES (Config::pingPongMaxTries()) #define PINGPONG_OK 0 #define PINGPONG_DELAY_MS Config::connectionUptimeDelay() class ComModule : public QObject { Q_OBJECT enum ComModuleFlag { Unconnected, Connected, TimeOut }; public: int _numberOfMissingPingPong; ComModuleFlag _connectionFlag; static ComModule* getInstance(QObject *parent = 0); static QMap<int, QString> connectionStatusMessage; int _connectionUptime; void initConnectionStatusMessage(); static u_int16_t Fletcher16( const char* data, int count ) { u_int16_t sum1 = 0; u_int16_t sum2 = 0; int index; for( index = 0; index < count; ++index ) { sum1 = (sum1 + data[index]) % 255; sum2 = (sum2 + sum1) % 255; } return (sum2 << 8) | sum1; } static u_int8_t checksum( const char* data, int count ) { u_int8_t sum = 0; int index; for( index = 0; index < count; ++index ) { sum ^= data[index]; } return sum; } /** * @brief sendMCode Send code value as M Code to the device connected. * @param code */ void sendMCode(QString code); void sendMCode(int code); void sendCode(QString code); void parseMCode(QByteArray stream); static bool isConnected(); /** start timer, set value & send START_CON MCode. **/ void beginConnection( ); Polyplexer::ConnectionStatus checkPingPongConnection(); Polyplexer::ConnectionStatus connection( bool blocked_thread ); Polyplexer::ConnectionStatus connectionGUI(bool blocked_thread); void stopConnection(); signals: void newData( QByteArray stream ); void dataWritten( QString data ); void disconnected(); public slots: void parseData(); void pingPong(); void sendBufferedData(); private: explicit ComModule(QObject *parent = 0); static ComModule* _instance; QQueue<QString> _sendBuffer; QTimer _sendTimer; int _currentLineNumber; QTimer _pingPongTimer; }; #endif // COMMODULE_H
/* * $Id$ * * Copyright (c) 2002-2011, Communications and Remote Sensing Laboratory, Universite catholique de Louvain (UCL), Belgium * Copyright (c) 2002-2011, Professor Benoit Macq * Copyright (c) 2010-2011, Kaori Hagihara * 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 AUXTRANS_MANAGER_H_ # define AUXTRANS_MANAGER_H_ #include "sock_manager.h" /** auxiliary transport setting parameters*/ typedef struct auxtrans_param{ int tcpauxport; /**< tcp port*/ int udpauxport; /**< udp port*/ SOCKET tcplistensock; /**< listenning socket for aux tcp (-1 if not open)*/ SOCKET udplistensock; /**< listenning socket for aux udp (-1 if not open)*/ } auxtrans_param_t; /** * Initialize auxiliary transport server of JPIP server * * @param[in] tcp_auxport opening tcp auxiliary port ( 0 not to open, valid No. 49152–65535) * @param[in] udp_auxport opening udp auxiliary port ( 0 not to open, valid No. 49152–65535) * @return intialized transport parameters */ auxtrans_param_t init_aux_transport( int tcp_auxport, int udp_auxport); /** * Close auxiliary transport server of JPIP server * * @param[in] auxtrans closing transport server */ void close_aux_transport( auxtrans_param_t auxtrans); /** * Send response data on aux transport * * @param[in] istcp true if tcp, false if udp * @param[in] auxtrans available transport parameters * @param[in] cid channel ID * @param[in] data sending data * @param[in] length length of data * @param[in] maxlenPerFrame maximum data length to send per frame */ void send_responsedata_on_aux( bool istcp, auxtrans_param_t auxtrans, char cid[], void *data, int length, int maxlenPerFrame); #endif /* !AUXTRANS_MANAGER_H_ */
/*. ******* coding:utf-8 AUTOHEADER START v1.2 ******* *. vim: fileencoding=utf-8 syntax=c sw=4 ts=4 et *. Copyrights: *. *. © 2007-2009 Matt Harrington (Author of LegoNXTRemove @ code.google.com) *. © 2007-2010 Nima Talebi <nima@autonomy.net.au> *. © 2010 Remy "Psycho" Demarest <Psy|@#cocoa@irc.freenode.org> *. *. License: *. *. MIT - The @PKG packages is available under the terms of *. the MIT license. *. *. Homepage: *. *. Original: http://code.google.com/p/legonxtremote/ *. Mutation: http://ai.autonomy.net.au/wiki/Project/Framework/Nimachine *. *. This file is part of the Nimachine Suite. *. *. Nimachine is free software: you can redistribute it and/or modify *. it under the terms of the GNU General Public License as published by *. the Free Software Foundation, either version 3 of the License, or *. (at your option) any later version. *. *. Nimachine 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 Nimachine. If not, see <http://www.gnu.org/licenses/>. *. *. THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED *. WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF *. MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO *. EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, *. INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT *. LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, *. OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF *. LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING *. NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, *. EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. *. *. ADAPTED M. STONE & T. PARKER DISCLAIMER: THIS SOFTWARE COULD RESULT IN *. INJURY AND/OR DEATH, AND AS SUCH, IT SHOULD NOT BE BUILT, INSTALLED OR USED BY *. ANYONE. *. ******* AUTOHEADER END v1.2 ******* */ // // SOMCanvas.h // SOM // // Created by Nima on 23/09/08. // Copyright 2008 Autonomy. All rights reserved. // #import <Cocoa/Cocoa.h> #import "NMMath.h" #define ENABLE_MULTI_THREADED 1 #define ANIMATION_SLEEP 0.0167 #define WINDOW_SIZE ((1040+90) - (545+90)*4/3) @class NMTangibleObject, NMCamera, NMLight, NMSOM; @interface NMCanvas:NSOpenGLView { @protected NSTimer *timer; NSOpenGLView *canvas; NSOpenGLContext *glcontext; int displayList; NMCamera *camera; NSMutableArray *cameras; NSMutableArray *lights; NSMutableArray *objects; GLfloat lightAmbient[4]; //int teapot; NSString *configFile; NSCoder *decoder; } @property(readwrite, assign) NMCamera *camera; + (NSOpenGLPixelFormat*)defaultPixelFormat; - (id)initWithCoder:(NSCoder *)c; - (IBAction)setZoom:(id)sender; - (IBAction)setAmbience:(id)sender; - (void)instantiateObjectFromString:(NSString *)line; - (void)addObject:(NMTangibleObject *)obj; @end
#ifndef __ITNAV_H /* IT320 has two nav switches. User application can use poll system call * to wait on or read events generated by navigation buttons. * An event is generated when any of the primary nav buttons is pressed, and * the returned evevt data consists of the button info of the primary * nav switch and state of 2nd nav switch at the time of the button being * pressed. */ typedef int itn_event_t; #define NAV_PKEY_MASK 0xFF #define NAV_PKEY_NONE 0 #define NAV_PKEY_RIGHT_PRD 1 #define NAV_PKEY_RIGHT_REL 2 #define NAV_PKEY_RIGHT_RPT 3 #define NAV_PKEY_UP_PRD 4 #define NAV_PKEY_UP_REL 5 #define NAV_PKEY_UP_RPT 6 #define NAV_PKEY_LEFT_PRD 7 #define NAV_PKEY_LEFT_REL 8 #define NAV_PKEY_LEFT_RPT 9 #define NAV_PKEY_DOWN_PRD 10 #define NAV_PKEY_DOWN_REL 11 #define NAV_PKEY_DOWN_RPT 12 #define NAV_PKEY_SEL_PRD 13 #define NAV_PKEY_SEL_REL 14 #define NAV_PKEY_SEL_RPT 15 #define NAV_SKEY_RIGHT_PRD 16 #define NAV_SKEY_RIGHT_REL 17 #define NAV_SKEY_RIGHT_RPT 18 #define NAV_SKEY_UP_PRD 19 #define NAV_SKEY_UP_REL 20 #define NAV_SKEY_UP_RPT 21 #define NAV_SKEY_LEFT_PRD 22 #define NAV_SKEY_LEFT_REL 23 #define NAV_SKEY_LEFT_RPT 24 #define NAV_SKEY_DOWN_PRD 25 #define NAV_SKEY_DOWN_REL 26 #define NAV_SKEY_DOWN_RPT 27 #define NAV_SKEY_SEL_PRD 28 #define NAV_SKEY_SEL_REL 29 #define NAV_SKEY_SEL_RPT 30 #define NAV_PKEY_RIGHT 0 #define NAV_PKEY_UP 1 #define NAV_PKEY_LEFT 2 #define NAV_PKEY_DOWN 3 #define NAV_PKEY_SEL 4 #define NAV_SKEY_RIGHT 5 #define NAV_SKEY_UP 6 #define NAV_SKEY_LEFT 7 #define NAV_SKEY_DOWN 8 #define NAV_SKEY_SEL 9 struct repeat_rate { int key; int delay; int auto_repeat_rate; }; struct set_event_mask { int mask; }; static itn_event_t key_evt_map[] = { NAV_PKEY_RIGHT_PRD, NAV_PKEY_RIGHT_REL, NAV_PKEY_RIGHT_RPT, NAV_PKEY_UP_PRD, NAV_PKEY_UP_REL, NAV_PKEY_UP_RPT, NAV_PKEY_LEFT_PRD, NAV_PKEY_LEFT_REL, NAV_PKEY_LEFT_RPT, NAV_PKEY_DOWN_PRD, NAV_PKEY_DOWN_REL, NAV_PKEY_DOWN_RPT, NAV_PKEY_SEL_PRD, NAV_PKEY_SEL_REL, NAV_PKEY_SEL_RPT, NAV_SKEY_RIGHT_PRD, NAV_SKEY_RIGHT_REL, NAV_SKEY_RIGHT_RPT, NAV_SKEY_UP_PRD, NAV_SKEY_UP_REL, NAV_SKEY_UP_RPT, NAV_SKEY_LEFT_PRD, NAV_SKEY_LEFT_REL, NAV_SKEY_LEFT_RPT, NAV_SKEY_DOWN_PRD, NAV_SKEY_DOWN_REL, NAV_SKEY_DOWN_RPT, NAV_SKEY_SEL_PRD, NAV_SKEY_SEL_REL, NAV_SKEY_SEL_RPT }; #define NAV_IOCTL_MAGIC 0xEE //#define SET_EVENT_MASK _IOWR(NAV_IOCTL_MAGIC,1,int) #define SET_EVENT_MASK NAV_IOCTL_MAGIC+1 #define SET_EVENT_UMASK NAV_IOCTL_MAGIC+2 #define GET_EVENT_MASK NAV_IOCTL_MAGIC+3 #define SET_REPEAT_RATE NAV_IOCTL_MAGIC+4 #define GET_REPEAT_RATE NAV_IOCTL_MAGIC+5 #define GET_KEYPAD_STATUS NAV_IOCTL_MAGIC+6 #define GET_KEY_EVENT NAV_IOCTL_MAGIC+7 #define NAV_AKEY_MASK 0xFF00 #define NAV_AKEY_STATE(key) (1<<(8+(key) - 1)) #ifndef __KERNEL__ #define is_right_key_pressed(evt) ((evt)&NAV_PKEY_MASK == NAV_PKEY_RIGHT) #define is_left_key_pressed(evt) ((evt)&NAV_PKEY_MASK == NAV_PKEY_LEFT) #define is_up_key_pressed(evt) ((evt)&NAV_PKEY_MASK == NAV_PKEY_UP) #define is_down_key_pressed(evt) ((evt)&NAV_PKEY_MASK == NAV_PKEY_DOWN) #define is_sel_key_pressed(evt) ((evt)&NAV_PKEY_MASK == NAV_PKEY_SEL) #endif #endif /* __ITNAV_H */
/* ZynAddSubFX - a software synthesizer Phaser.h - Phaser effect Copyright (C) 2002-2005 Nasca Octavian Paul Author: Nasca Octavian Paul This program is free software; you can redistribute it and/or modify it under the terms of version 2 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. See the GNU General Public License (version 2 or later) for more details. You should have received a copy of the GNU General Public License (version 2) along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef PHASER_H #define PHASER_H #include "../globals.h" #include "../Misc/Stereo.h" #include "../Samples/Sample.h" #include "Effect.h" #include "EffectLFO.h" #define MAX_PHASER_STAGES 12 /**Phaser Effect*/ class Phaser:public Effect { public: Phaser(const int &insetion_, REALTYPE *efxoutl_, REALTYPE *efxoutr_); ~Phaser(); void out(const Stereo<float *> &smp); void setpreset(unsigned char npreset); void changepar(int npar, unsigned char value); unsigned char getpar(int npar) const; void cleanup(); void setdryonly(); private: //Parametrii Phaser EffectLFO lfo; /**<lfo-ul Phaser*/ unsigned char Pvolume; unsigned char Ppanning; unsigned char Pdepth; /**<the depth of the Phaser*/ unsigned char Pfb; /**<feedback*/ unsigned char Plrcross; /**<crossover*/ unsigned char Pstages; unsigned char Poutsub; /**<if I wish to substract the output instead of the adding it*/ unsigned char Pphase; //Control Parameters void setvolume(unsigned char Pvolume); void setpanning(unsigned char Ppanning); void setdepth(unsigned char Pdepth); void setfb(unsigned char Pfb); void setlrcross(unsigned char Plrcross); void setstages(unsigned char Pstages); void setphase(unsigned char Pphase); //Internal Values REALTYPE panning, fb, depth, lrcross, fbl, fbr, phase; Stereo<Sample> old; Stereo<REALTYPE> oldgain; }; #endif
/*********************************************************************************** * * * Voreen - The Volume Rendering Engine * * * * Copyright (C) 2005-2012 University of Muenster, Germany. * * Visualization and Computer Graphics Group <http://viscg.uni-muenster.de> * * For a list of authors please refer to the file "CREDITS.txt". * * * * This file is part of the Voreen software package. Voreen 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. * * * * Voreen 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 in the file * * "LICENSE.txt" along with this file. If not, see <http://www.gnu.org/licenses/>. * * * * For non-commercial academic use see the license exception specified in the file * * "LICENSE-academic.txt". To get information about commercial licensing please * * contact the authors. * * * ***********************************************************************************/ #ifndef VRN_VOLUMEOPERATORISUNIFORM_H #define VRN_VOLUMEOPERATORISUNIFORM_H #include "voreen/core/datastructures/volume/volumeoperator.h" namespace voreen { // Base class, defines interface for the operator (-> apply): class VolumeOperatorIsUniformBase : public UnaryVolumeOperatorBase { public: virtual bool apply(const VolumeBase* volume) const = 0; }; // Generic implementation: template<typename T> class VolumeOperatorIsUniformGeneric : public VolumeOperatorIsUniformBase { public: virtual bool apply(const VolumeBase* volume) const; //Implement isCompatible using a handy macro: IS_COMPATIBLE }; template<typename T> bool VolumeOperatorIsUniformGeneric<T>::apply(const VolumeBase* vh) const { const VolumeRAM* v = vh->getRepresentation<VolumeRAM>(); if(!v) return 0; const VolumeAtomic<T>* volume = dynamic_cast<const VolumeAtomic<T>*>(v); if(!volume) return 0; T firstVoxel = volume->voxel(0); bool allVoxelsEqual=true; for (size_t i=1; i < volume->getNumVoxels(); i++) { T currentVoxel = volume->voxel(i); if (firstVoxel != currentVoxel) { allVoxelsEqual = false; break; } } return allVoxelsEqual; } typedef UniversalUnaryVolumeOperatorGeneric<VolumeOperatorIsUniformBase> VolumeOperatorIsUniform; } // namespace #endif // VRN_VOLUMEOPERATOR_H
/* $Id: capilli.h 573 2006-02-20 17:09:11Z stsp2 $ * * Kernel CAPI 2.0 Driver Interface for Linux * * Copyright 1999 by Carsten Paeth <calle@calle.de> * * This software may be used and distributed according to the terms * of the GNU General Public License, incorporated herein by reference. * */ #ifndef __CAPILLI_H__ #define __CAPILLI_H__ #include <linux/kernel.h> #include <linux/list.h> #include <linux/capi.h> #include <linux/kernelcapi.h> typedef struct capiloaddatapart { int user; /* data in userspace ? */ int len; unsigned char *data; } capiloaddatapart; typedef struct capiloaddata { capiloaddatapart firmware; capiloaddatapart configuration; } capiloaddata; typedef struct capicardparams { unsigned int port; unsigned irq; int cardtype; int cardnr; unsigned int membase; } capicardparams; struct capi_ctr { /* filled in before calling attach_capi_ctr */ struct module *owner; void *driverdata; /* driver specific */ char name[32]; /* name of controller */ char *driver_name; /* name of driver */ int (*load_firmware)(struct capi_ctr *, capiloaddata *); void (*reset_ctr)(struct capi_ctr *); void (*register_appl)(struct capi_ctr *, u16 appl, capi_register_params *); void (*release_appl)(struct capi_ctr *, u16 appl); u16 (*send_message)(struct capi_ctr *, struct sk_buff *skb); char *(*procinfo)(struct capi_ctr *); int (*ctr_read_proc)(char *page, char **start, off_t off, int count, int *eof, struct capi_ctr *card); /* filled in before calling ready callback */ u8 manu[CAPI_MANUFACTURER_LEN]; /* CAPI_GET_MANUFACTURER */ capi_version version; /* CAPI_GET_VERSION */ capi_profile profile; /* CAPI_GET_PROFILE */ u8 serial[CAPI_SERIAL_LEN]; /* CAPI_GET_SERIAL */ /* management information for kcapi */ unsigned long nrecvctlpkt; unsigned long nrecvdatapkt; unsigned long nsentctlpkt; unsigned long nsentdatapkt; int cnr; /* controller number */ volatile unsigned short cardstate; /* controller state */ volatile int blocked; /* output blocked */ int traceflag; /* capi trace */ struct proc_dir_entry *procent; char procfn[128]; }; int attach_capi_ctr(struct capi_ctr *); int detach_capi_ctr(struct capi_ctr *); void capi_ctr_ready(struct capi_ctr * card); void capi_ctr_reseted(struct capi_ctr * card); void capi_ctr_suspend_output(struct capi_ctr * card); void capi_ctr_resume_output(struct capi_ctr * card); void capi_ctr_handle_message(struct capi_ctr * card, u16 appl, struct sk_buff *skb); // --------------------------------------------------------------------------- // needed for AVM capi drivers struct capi_driver { char name[32]; /* driver name */ char revision[32]; int (*add_card)(struct capi_driver *driver, capicardparams *data); /* management information for kcapi */ struct list_head list; }; void register_capi_driver(struct capi_driver *driver); void unregister_capi_driver(struct capi_driver *driver); // --------------------------------------------------------------------------- // library functions for use by hardware controller drivers void capilib_new_ncci(struct list_head *head, u16 applid, u32 ncci, u32 winsize); void capilib_free_ncci(struct list_head *head, u16 applid, u32 ncci); void capilib_release_appl(struct list_head *head, u16 applid); void capilib_release(struct list_head *head); void capilib_data_b3_conf(struct list_head *head, u16 applid, u32 ncci, u16 msgid); u16 capilib_data_b3_req(struct list_head *head, u16 applid, u32 ncci, u16 msgid); #endif /* __CAPILLI_H__ */
#ifndef __PAR_H #define __PAR_H /* * par.h * Defines for high level code of parallel port * */ #include <sys/types.h> /* * Structure for per-connection operations */ struct file { int f_sender; /* Sender of current operation */ uint f_gen; /* Generation of access */ uint f_flags; /* User access bits */ }; void par_write(struct msg *m, struct file *fl); void par_stat(struct msg *m, struct file *f); void par_wstat(struct msg *m, struct file *f); #endif /* _PAR_H */
/* * templates.h - this file is part of Geany, a fast and lightweight IDE * * Copyright 2005-2012 Enrico Tröger <enrico(dot)troeger(at)uvena(dot)de> * Copyright 2006-2012 Nick Treleaven <nick(dot)treleaven(at)btinternet(dot)com> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * 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. */ /** * @file templates.h * Templates (prefs). **/ #ifndef GEANY_TEMPLATES_H #define GEANY_TEMPLATES_H 1 G_BEGIN_DECLS #define GEANY_TEMPLATES_INDENT 3 enum { GEANY_TEMPLATE_GPL = 0, GEANY_TEMPLATE_BSD, GEANY_TEMPLATE_FILEHEADER, GEANY_TEMPLATE_CHANGELOG, GEANY_TEMPLATE_FUNCTION, GEANY_MAX_TEMPLATES }; /** Template preferences. */ typedef struct GeanyTemplatePrefs { gchar *developer; /**< Name */ gchar *company; /**< Company */ gchar *mail; /**< Email */ gchar *initials; /**< Initials */ gchar *version; /**< Initial version */ gchar *year_format; gchar *date_format; gchar *datetime_format; } GeanyTemplatePrefs; extern GeanyTemplatePrefs template_prefs; struct filetype; void templates_init(void); gchar *templates_get_template_fileheader(gint filetype_idx, const gchar *fname); gchar *templates_get_template_changelog(GeanyDocument *doc); gchar *templates_get_template_function(GeanyDocument *doc, const gchar *func_name); gchar *templates_get_template_licence(GeanyDocument *doc, gint licence_type); void templates_replace_common(GString *tmpl, const gchar *fname, GeanyFiletype *ft, const gchar *func_name); void templates_replace_valist(GString *text, const gchar *first_wildcard, ...) G_GNUC_NULL_TERMINATED; void templates_free_templates(void); G_END_DECLS #endif
/*=========================================================================\ * Copyright(C)2016 Chudai. * * File name : p366_deal_with_syn_signal.c * Version : v1.0.0 * Author : 初代 * Date : 2016/11/01 * Description : * Function list: 1. * 2. * 3. * History : \*=========================================================================*/ /*-----------------------------------------------------------* * 头文件 * *-----------------------------------------------------------*/ #include "apue.h" #include <pthread.h> int quitflag; //set nonzero by thread sigset_t mask; pthread_mutex_t lock = PTHREAD_MUTEX_INITIALIZER; pthread_cond_t waitloc = PTHREAD_COND_INITIALIZER; void * thr_fn(void *arg) { int err = 0; int signo = 0; while(1) { err = sigwait(&mask, &signo); //等信号集中的信号。 if (err != 0) { err_exit(err, "sigwait failed"); } printf("signo = %d\n", signo); switch(signo) { case SIGINT: printf("\ninterrupt\n"); break; case SIGQUIT: pthread_mutex_lock(&lock); quitflag = 1; pthread_mutex_unlock(&lock); pthread_cond_signal(&waitloc); return 0; default: printf("unexpected signal %d\n", signo); exit(1); } } } int main(void) { int err = 0; sigset_t oldmask; pthread_t tid; sigemptyset(&mask); sigaddset(&mask, SIGINT); sigaddset(&mask, SIGQUIT); if ((err = pthread_sigmask(SIG_BLOCK, &mask, &oldmask)) != 0) { err_exit(err, "pthread_sigmask SIG_BLOCK error"); } err = pthread_create(&tid, NULL, thr_fn, 0); if (err != 0) { err_exit(err, "can't create thread"); } pthread_mutex_lock(&lock); while(quitflag == 0) { pthread_cond_wait(&waitloc, &lock); } pthread_mutex_unlock(&lock); quitflag = 0; //恢复oldmask if (sigprocmask(SIG_SETMASK, &oldmask, NULL) < 0) { err_sys("SIG_SETMASK error"); } exit(0); }
#include <unistd.h> #include <stdio.h> #include <sys/mount.h> #include <sys/wait.h> int main(void) { char *kexec_load[] = { "/kexec", "-l", "/mnt/install/powerpc/vmlinux", "--initrd=/mnt/install/powerpc/initrd.gz", NULL }; char *kexec_run[] = { "/kexec", "-e", "-x", NULL }; char *env[] = { NULL }; int status; printf("Mounting /sys...\n"); if (mount("sysfs", "/sys", "sysfs", MS_MGC_VAL, NULL) != 0) perror("mount"); printf("Mounting Debian Install CD /dev/sr0...\n"); do { status = mount("/dev/sr0", "/mnt", "iso9660", MS_MGC_VAL|MS_RDONLY, NULL); if (status != 0) { perror("mount"); sleep(5); } } while (status != 0); printf("Loading kernel and initramfs from CD...\n"); switch (fork()) { case -1: /* error */ perror("fork"); break; case 0: /* child */ execve(kexec_load[0], kexec_load, env); perror("execve"); break; default: /* parent */ if (wait(&status) == -1) { perror("wait"); break; } if (!WIFEXITED(status)) { printf("child not terminated normally\n"); break; } if (WEXITSTATUS(status) != 0) { printf("kexec returned %d\n", WEXITSTATUS(status)); break; } printf("Starting kernel...\n"); execve(kexec_run[0], kexec_run, env); perror("execve"); } return 0xaa; }
/* $Id: ranges.c,v 1.1.1.1 2010/04/09 09:39:17 feiyan Exp $ * ranges.c: Handle ranges in newer proms for obio/sbus. * * Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu) * Copyright (C) 1997 Jakub Jelinek (jj@sunsite.mff.cuni.cz) */ #include <linux/init.h> #include <asm/openprom.h> #include <asm/oplib.h> #include <asm/types.h> #include <asm/sbus.h> #include <asm/system.h> struct linux_prom_ranges promlib_obio_ranges[PROMREG_MAX]; int num_obio_ranges; /* Adjust register values based upon the ranges parameters. */ static void prom_adjust_regs(struct linux_prom_registers *regp, int nregs, struct linux_prom_ranges *rangep, int nranges) { int regc, rngc; for (regc = 0; regc < nregs; regc++) { for (rngc = 0; rngc < nranges; rngc++) if (regp[regc].which_io == rangep[rngc].ot_child_space) break; /* Fount it */ if (rngc == nranges) /* oops */ prom_printf("adjust_regs: Could not find range with matching bus type...\n"); regp[regc].which_io = rangep[rngc].ot_parent_space; regp[regc].phys_addr -= rangep[rngc].ot_child_base; regp[regc].phys_addr += rangep[rngc].ot_parent_base; } } void prom_adjust_ranges(struct linux_prom_ranges *ranges1, int nranges1, struct linux_prom_ranges *ranges2, int nranges2) { int rng1c, rng2c; for(rng1c=0; rng1c < nranges1; rng1c++) { for(rng2c=0; rng2c < nranges2; rng2c++) if(ranges1[rng1c].ot_parent_space == ranges2[rng2c].ot_child_space && ranges1[rng1c].ot_parent_base >= ranges2[rng2c].ot_child_base && ranges2[rng2c].ot_child_base + ranges2[rng2c].or_size - ranges1[rng1c].ot_parent_base > 0U) break; if(rng2c == nranges2) /* oops */ prom_printf("adjust_ranges: Could not find matching bus type...\n"); else if (ranges1[rng1c].ot_parent_base + ranges1[rng1c].or_size > ranges2[rng2c].ot_child_base + ranges2[rng2c].or_size) ranges1[rng1c].or_size = ranges2[rng2c].ot_child_base + ranges2[rng2c].or_size - ranges1[rng1c].ot_parent_base; ranges1[rng1c].ot_parent_space = ranges2[rng2c].ot_parent_space; ranges1[rng1c].ot_parent_base += ranges2[rng2c].ot_parent_base; } } /* Apply probed obio ranges to registers passed, if no ranges return. */ void prom_apply_obio_ranges(struct linux_prom_registers *regs, int nregs) { if(num_obio_ranges) prom_adjust_regs(regs, nregs, promlib_obio_ranges, num_obio_ranges); } void __init prom_ranges_init(void) { int node, obio_node; int success; num_obio_ranges = 0; /* Check for obio and sbus ranges. */ node = prom_getchild(prom_root_node); obio_node = prom_searchsiblings(node, "obio"); if(obio_node) { success = prom_getproperty(obio_node, "ranges", (char *) promlib_obio_ranges, sizeof(promlib_obio_ranges)); if(success != -1) num_obio_ranges = (success/sizeof(struct linux_prom_ranges)); } if(num_obio_ranges) prom_printf("PROMLIB: obio_ranges %d\n", num_obio_ranges); return; } void prom_apply_generic_ranges (int node, int parent, struct linux_prom_registers *regs, int nregs) { int success; int num_ranges; struct linux_prom_ranges ranges[PROMREG_MAX]; success = prom_getproperty(node, "ranges", (char *) ranges, sizeof (ranges)); if (success != -1) { num_ranges = (success/sizeof(struct linux_prom_ranges)); if (parent) { struct linux_prom_ranges parent_ranges[PROMREG_MAX]; int num_parent_ranges; success = prom_getproperty(parent, "ranges", (char *) parent_ranges, sizeof (parent_ranges)); if (success != -1) { num_parent_ranges = (success/sizeof(struct linux_prom_ranges)); prom_adjust_ranges (ranges, num_ranges, parent_ranges, num_parent_ranges); } } prom_adjust_regs(regs, nregs, ranges, num_ranges); } }
// Copyright 2013 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 CHROME_RENDERER_EXTENSIONS_ID_GENERATOR_CUSTOM_BINDINGS_H_ #define CHROME_RENDERER_EXTENSIONS_ID_GENERATOR_CUSTOM_BINDINGS_H_ #include "chrome/renderer/extensions/chrome_v8_extension.h" namespace extensions { class IdGeneratorCustomBindings : public ChromeV8Extension { public: IdGeneratorCustomBindings(Dispatcher* dispatcher, ChromeV8Context* context); private: void GetNextId(const v8::FunctionCallbackInfo<v8::Value>& args); }; } #endif