text
stringlengths
4
6.14k
#include <assert.h> #include "modbus-acy.h" //char * //modbusValueToString(uint8_t *valArray, uint16_t valLen, int modbusType, char *strVal) void test_modbusValueToString_bool() { uint8_t valArray[2]; char strVal[8]; printf("test_modbusValueToString_bool\n"); valArray[0] = 0x01; assert(!strcmp("true", modbusValueToString(valArray, 1, ACCESS_BOOL, strVal))); valArray[0] = 0x00; assert(!strcmp("false", modbusValueToString(valArray, 1, ACCESS_BOOL, strVal))); valArray[0] = 0xFF; assert(!strcmp("true", modbusValueToString(valArray, 1, ACCESS_BOOL, strVal))); printf("OK\n"); } void test_modbusValueToString_uint8() { uint8_t valArray[2]; char strVal[8]; printf("test_modbusValueToString_uint8\n"); valArray[0] = 0x00; assert(!strcmp("0", modbusValueToString(valArray, 1, ACCESS_UINT8, strVal))); valArray[0] = 0xFF; assert(!strcmp("255", modbusValueToString(valArray, 1, ACCESS_UINT8, strVal))); printf("OK\n"); } void test_modbusValueToString_int8() { uint8_t valArray[2]; char strVal[8]; printf("test_modbusValueToString_uint8\n"); assert(!strcmp("##", modbusValueToString(valArray, 2, ACCESS_INT8, strVal))); valArray[0] = 0x00; assert(!strcmp("0", modbusValueToString(valArray, 1, ACCESS_INT8, strVal))); valArray[0] = 0xFF; modbusValueToString(valArray, 1, ACCESS_INT8, strVal); assert(!strcmp("-1", strVal)); valArray[0] = 0x80; modbusValueToString(valArray, 1, ACCESS_INT8, strVal); assert(!strcmp("-128", strVal)); valArray[0] = 0x81; modbusValueToString(valArray, 1, ACCESS_INT8, strVal); assert(!strcmp("-127", strVal)); printf("OK\n"); } void test_modbusValueToString_uint16() { uint8_t valArray[2]; char strVal[8]; printf("test_modbusValueToString_uint16\n"); valArray[1] = 0x00; valArray[0] = 0x00; assert(!strcmp("0", modbusValueToString(valArray, 2, ACCESS_UINT16, strVal))); valArray[1] = 0xFF; valArray[0] = 0xFF; assert(!strcmp("65535", modbusValueToString(valArray, 2, ACCESS_UINT16, strVal))); valArray[1] = 0xAE; valArray[0] = 0x41; assert(!strcmp("44609", modbusValueToString(valArray, 2, ACCESS_UINT16, strVal))); printf("OK\n"); } void test_modbusValueToString_int16() { uint8_t valArray[2]; char strVal[8]; printf("test_modbusValueToString_int16\n"); valArray[1] = 0x00; valArray[0] = 0x00; assert(!strcmp("0", modbusValueToString(valArray, 2, ACCESS_INT16, strVal))); valArray[1] = 0xFF; valArray[0] = 0xFF; assert(!strcmp("-1", modbusValueToString(valArray, 2, ACCESS_INT16, strVal))); valArray[1] = 0xAE; valArray[0] = 0x41; assert(!strcmp("-20927", modbusValueToString(valArray, 2, ACCESS_INT16, strVal))); printf("OK\n"); } void test_modbusValueToString_uint32() { uint8_t valArray[4]; char strVal[16]; printf("test_modbusValueToString_uint32\n"); valArray[3] = 0x00; valArray[2] = 0x00; valArray[1] = 0x00; valArray[0] = 0x00; modbusValueToString(valArray, 4, ACCESS_UINT32, strVal); printf("%s\n", strVal); assert(!strcmp("0", strVal)); valArray[3] = 0xFF; valArray[2] = 0xFF; valArray[1] = 0xFF; valArray[0] = 0xFF; modbusValueToString(valArray, 4, ACCESS_UINT32, strVal); printf("%s\n", strVal); assert(!strcmp("4294967295", strVal)); valArray[3] = 0xAE; valArray[2] = 0x41; valArray[1] = 0x56; valArray[0] = 0x52; modbusValueToString(valArray, 4, ACCESS_UINT32, strVal); printf("%s\n", strVal); assert(!strcmp("2923517522", strVal)); printf("OK\n"); } void test_modbusValueToString_int32() { uint8_t valArray[4]; char strVal[16]; printf("test_modbusValueToString_int32\n"); valArray[3] = 0x00; valArray[2] = 0x00; valArray[1] = 0x00; valArray[0] = 0x00; modbusValueToString(valArray, 4, ACCESS_INT32, strVal); printf("%s\n", strVal); assert(!strcmp("0", strVal)); valArray[3] = 0xFF; valArray[2] = 0xFF; valArray[1] = 0xFF; valArray[0] = 0xFF; modbusValueToString(valArray, 4, ACCESS_INT32, strVal); printf("%s\n", strVal); assert(!strcmp("-1", strVal)); valArray[3] = 0xAE; valArray[2] = 0x41; valArray[1] = 0x56; valArray[0] = 0x52; modbusValueToString(valArray, 4, ACCESS_INT32, strVal); printf("%s\n", strVal); assert(!strcmp("-1371449774", strVal)); printf("OK\n"); } void test_modbusValueToString_float() { uint8_t valArray[4]; char strVal[16]; printf("test_modbusValueToString_float\n"); valArray[3] = 0xAE; valArray[2] = 0x41; valArray[1] = 0x56; valArray[0] = 0x52; modbusValueToString(valArray, 4, ACCESS_FLOAT, strVal); printf("%s\n", strVal); assert(!strcmp("-4.39598e-11", strVal)); printf("OK\n"); } void test_modbusValueToString_double() { uint8_t valArray[8]; char strVal[32]; printf("test_modbusValueToString_double\n"); valArray[7] = 0xE2; valArray[6] = 0x5F; valArray[5] = 0x11; valArray[4] = 0x90; valArray[3] = 0xAE; valArray[2] = 0x41; valArray[1] = 0x56; valArray[0] = 0x52; modbusValueToString(valArray, 8, ACCESS_DOUBLE, strVal); printf("%s\n", strVal); assert(!strcmp("-7.15648e+165", strVal)); printf("OK\n"); } int main(int argc, char *argv[]) { test_modbusValueToString_bool(); test_modbusValueToString_uint8(); test_modbusValueToString_int8(); test_modbusValueToString_uint16(); test_modbusValueToString_int16(); test_modbusValueToString_uint32(); test_modbusValueToString_int32(); test_modbusValueToString_float(); test_modbusValueToString_double(); return 0; }
#ifndef TESTLISTSTYLE_H #define TESTLISTSTYLE_H #include <QObject> #include <QtTest/QtTest> // #include <KoTextShapeData.h> // #include <KoTextDocumentLayout.h> // #include <KoShape.h> // class TestListStyle : public QObject { Q_OBJECT public: TestListStyle() {} private slots: void testListStyle(); }; #endif
/* MobileRobots Advanced Robotics Interface for Applications (ARIA) Copyright (C) 2004, 2005 ActivMedia Robotics LLC Copyright (C) 2006, 2007, 2008, 2009 MobileRobots Inc. Copyright (C) 2010, 2011 Adept Technology, 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 If you wish to redistribute ARIA under different terms, contact Adept MobileRobots for information about a commercial version of ARIA at robots@mobilerobots.com or Adept MobileRobots, 10 Columbia Drive, Amherst, NH 03031; 800-639-9481 */ #ifndef ARJOYHANDLER_H #define ARJOYHANDLER_H #include "ariaTypedefs.h" #include "ariaUtil.h" #ifdef WIN32 #include <mmsystem.h> // for JOYINFO #else // if not win32 #include <stdio.h> #include <unistd.h> #include <stdlib.h> #include <sys/ioctl.h> #include <fcntl.h> #endif #ifdef linux #include <linux/joystick.h> // for JS_DATA_TYPE #endif /// Interfaces to a joystick /** The joystick handler keeps track of the minimum and maximums for both axes, updating them to constantly be better calibrated. The speeds set influence what is returned by getAdjusted... The joystick is not opened until init is called. What should basically be done to use this class is to 'init' a joystick, do a 'setSpeed' so you can use 'getAdusted', then at some point do a 'getButton' to see if a button is pressed, and then do a 'getAdjusted' to get the values to act on. Also note that x is usually rotational velocity (since it right/left), whereas Y is translational (since it is up/down). You can also use this to do multiple uses with the joystick, for example to have button 1 drive the robot while to have button 2 move the camera, you can get the different values you want (don't want to move the camera as quickly or as far as the robot) by using setSpeed before doing getAdjusted since setSpeed is fast and won't take any time. */ class ArJoyHandler { public: /// Constructor AREXPORT ArJoyHandler(bool useOSCal = true, bool useOldJoystick = false); /// Destructor AREXPORT ~ArJoyHandler(); /// Intializes the joystick, returns true if successful AREXPORT bool init(void); /// Returns if the joystick was successfully initialized or not AREXPORT bool haveJoystick(void) { return myInitialized; } /// Gets the adjusted reading, as floats, between -1.0 and 1.0 AREXPORT void getDoubles(double *x, double *y, double *z = NULL); /// Gets the button AREXPORT bool getButton(unsigned int button); /// Returns true if we definitely have a Z axis (we don't know in windows unless it moves) AREXPORT bool haveZAxis(void) { return myHaveZ; } /// Sets the max that X or Y will return AREXPORT void setSpeeds(int x, int y, int z = 0) { myTopX = x; myTopY = y; myTopZ = z; } /// Gets the adjusted reading, as integers, based on the setSpeed AREXPORT void getAdjusted(int *x, int *y, int *z = NULL); /// Gets the number of axes the joystick has AREXPORT unsigned int getNumAxes(void); /// Gets the floating (-1 to 1) location of the given joystick axis AREXPORT double getAxis(unsigned int axis); /// Gets the number of buttons the joystick has AREXPORT unsigned int getNumButtons(void); /// Sets whether to just use OS calibration or not AREXPORT void setUseOSCal(bool useOSCal); /// Gets whether to just use OS calibration or not AREXPORT bool getUseOSCal(void); /// Starts the calibration process AREXPORT void startCal(void); /// Ends the calibration process AREXPORT void endCal(void); /// Gets the unfilitered reading, mostly for internal use, maybe /// useful for Calibration AREXPORT void getUnfiltered(int *x, int *y, int *z = NULL); /// Gets the stats for the joystick, useful after calibrating to save values AREXPORT void getStats(int *maxX, int *minX, int *maxY, int *minY, int *cenX, int *cenY); /// Sets the stats for the joystick, useful for restoring calibrated settings AREXPORT void setStats(int maxX, int minX, int maxY, int minY, int cenX, int cenY); /// Gets the speeds that X and Y are set to AREXPORT void getSpeeds(int *x, int *y, int *z); protected: // function to get the data for OS dependent part void getData(void); int myMaxX, myMinX, myMaxY, myMinY, myCenX, myCenY, myTopX, myTopY, myTopZ; bool myHaveZ; std::map<unsigned int, int> myAxes; std::map<unsigned int, bool> myButtons; int myPhysMax; bool myInitialized; bool myUseOSCal; bool myUseOld; bool myFirstData; ArTime myLastDataGathered; #ifdef WIN32 unsigned int myJoyID; int myLastZ; JOYINFO myJoyInfo; JOYCAPS myJoyCaps; #else // if not win32 int myJoyNumber; char myJoyNameTemp[512]; ArTime myLastOpenTry; void getOldData(void); void getNewData(void); #ifdef linux struct JS_DATA_TYPE myJoyData; // structure for the buttons and x,y coords #else int myJoyData; #endif FILE * myOldJoyDesc; int myJoyDesc; #endif // linux }; #endif // ARJOYHANDLER_H
// 0x80.c #include <stdio.h> int main() { printf("Bug:\t%f\n", ('\x80' >> 4) * 16.0f + 0.5f); printf("No bug:\t%f\n", ((unsigned char) '\x80' >> 4) * 16.0f + 0.5f); return 0; }
#ifndef PROTOCOL_H #define PROTOCOL_H namespace KMP { } #endif // PROTOCOL_H
#include <dryos.h> #include <property.h> #include <cfn-generic.h> int GUI_GetCFnForTab4(int); int GUI_SetCFnForTab4(int,int); int get_htp() { return GetCFnData(1, 3); } void set_htp(int value) { SetCFnData(1, 3, value); } GENERIC_GET_ALO int get_mlu() { return GetCFnData(2, 13); } void set_mlu(int value) { SetCFnData(2, 13, value); } int cfn_get_af_button_assignment() { return GUI_GetCFnForTab4(6); } void cfn_set_af_button(int value) { GUI_SetCFnForTab4(6, value); }
/* Copyright (c) 2010, 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. * * 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 <linux/qcomwlan_pwrif.h> #define GPIO_WLAN_DEEP_SLEEP_N 230 #define WLAN_RESET_OUT 1 #define WLAN_RESET 0 static const char *id = "WLAN"; int vos_chip_power_qrf8615(int on) { static char wlan_on; static const char *vregs_qwlan_name[] = { "8058_l20", "8058_l8", "8901_s4", "8901_lvs1", "8901_l0", "8058_s2", "8058_s1", }; static const int vregs_qwlan_val_min[] = { 1800000, 2900000, 1225000, 0, 1200000, 1300000, 880000, }; static const int vregs_qwlan_val_max[] = { 1800000, 2900000, 1225000, 0, 1200000, 1300000, 1200000, }; static struct regulator *vregs_qwlan[ARRAY_SIZE(vregs_qwlan_name)]; static struct msm_xo_voter *wlan_clock; int ret, i, rc = 0; /* WLAN RESET and CLK settings */ if (on && !wlan_on) { /* * Program U12 GPIO expander pin IO1 to de-assert (drive 0) * WLAN_EXT_POR_N to put WLAN in reset */ rc = gpio_request(GPIO_WLAN_DEEP_SLEEP_N, "WLAN_DEEP_SLEEP_N"); if (rc) { pr_err("WLAN reset GPIO %d request failed\n", GPIO_WLAN_DEEP_SLEEP_N); goto fail; } rc = gpio_direction_output(GPIO_WLAN_DEEP_SLEEP_N, WLAN_RESET_OUT); if (rc < 0) { pr_err("WLAN reset GPIO %d set output direction failed", GPIO_WLAN_DEEP_SLEEP_N); goto fail_gpio_dir_out; } /* Configure TCXO to be slave to WLAN_CLK_PWR_REQ */ if (wlan_clock == NULL) { wlan_clock = msm_xo_get(MSM_XO_TCXO_A0, id); if (IS_ERR(wlan_clock)) { pr_err("Failed to get TCXO_A0 voter (%ld)\n", PTR_ERR(wlan_clock)); goto fail_gpio_dir_out; } } rc = msm_xo_mode_vote(wlan_clock, MSM_XO_MODE_PIN_CTRL); if (rc < 0) { pr_err("Configuring TCXO to Pin controllable failed" "(%d)\n", rc); goto fail_xo_mode_vote; } } else if (!on && wlan_on) { if (wlan_clock != NULL) msm_xo_mode_vote(wlan_clock, MSM_XO_MODE_OFF); gpio_set_value_cansleep(GPIO_WLAN_DEEP_SLEEP_N, WLAN_RESET); gpio_free(GPIO_WLAN_DEEP_SLEEP_N); } /* WLAN VREG settings */ for (i = 0; i < ARRAY_SIZE(vregs_qwlan_name); i++) { if (vregs_qwlan[i] == NULL) { vregs_qwlan[i] = regulator_get(NULL, vregs_qwlan_name[i]); if (IS_ERR(vregs_qwlan[i])) { pr_err("regulator get of %s failed (%ld)\n", vregs_qwlan_name[i], PTR_ERR(vregs_qwlan[i])); rc = PTR_ERR(vregs_qwlan[i]); goto vreg_get_fail; } if (vregs_qwlan_val_min[i] || vregs_qwlan_val_max[i]) { rc = regulator_set_voltage(vregs_qwlan[i], vregs_qwlan_val_min[i], vregs_qwlan_val_max[i]); if (rc) { pr_err("regulator_set_voltage(%s) failed\n", vregs_qwlan_name[i]); goto vreg_fail; } } } if (on && !wlan_on) { rc = regulator_enable(vregs_qwlan[i]); if (rc < 0) { pr_err("vreg %s enable failed (%d)\n", vregs_qwlan_name[i], rc); goto vreg_fail; } } else if (!on && wlan_on) { rc = regulator_disable(vregs_qwlan[i]); if (rc < 0) { pr_err("vreg %s disable failed (%d)\n", vregs_qwlan_name[i], rc); goto vreg_fail; } } } if (on) wlan_on = true; else wlan_on = false; return 0; vreg_fail: regulator_put(vregs_qwlan[i]); vreg_get_fail: i--; while (i) { ret = !on ? regulator_enable(vregs_qwlan[i]) : regulator_disable(vregs_qwlan[i]); if (ret < 0) { pr_err("vreg %s %s failed (%d) in err path\n", vregs_qwlan_name[i], !on ? "enable" : "disable", ret); } regulator_put(vregs_qwlan[i]); i--; } if (!on) goto fail; fail_xo_mode_vote: msm_xo_put(wlan_clock); fail_gpio_dir_out: gpio_free(GPIO_WLAN_DEEP_SLEEP_N); fail: return rc; } EXPORT_SYMBOL(vos_chip_power_qrf8615);
/* * Copyright 1992 by Jutta Degener and Carsten Bormann, Technische * Universitaet Berlin. See the accompanying file "COPYRIGHT" for * details. THERE IS ABSOLUTELY NO WARRANTY FOR THIS SOFTWARE. */ static char ident[] = "$Header: /cvsroot/rplay/rplay/gsm/gsm_create.c,v 1.1 1998/07/14 22:35:24 mrb Exp $"; #include "config.h" #ifdef HAS_STRING_H #include <string.h> #else # include "proto.h" extern char * memset P((char *, int, int)); #endif #ifdef HAS_STDLIB_H # include <stdlib.h> #else # ifdef HAS_MALLOC_H # include <malloc.h> # else extern char * malloc(); # endif #endif #include <stdio.h> #include "gsm.h" #include "private.h" #include "proto.h" gsm gsm_create P0() { gsm r; r = (gsm)malloc(sizeof(struct gsm_state)); if (!r) return r; memset((char *)r, 0, sizeof(*r)); r->nrp = 40; return r; }
/* * Copyright (C) 2015 Red Hat * * This file is subject to the terms and conditions of the GNU General Public * License v2. See the file COPYING in the main directory of this archive for * more details. */ #include <drm/drm_backport.h> /* * alloc_anon_inode */ static const struct file_operations anon_inode_fops; /* * nop .set_page_dirty method so that people can use .page_mkwrite on * anon inodes. */ static int anon_set_page_dirty(struct page *page) { return 0; }; static const struct address_space_operations anon_aops = { .set_page_dirty = anon_set_page_dirty, }; struct inode *alloc_anon_inode(struct super_block *mnt_sb) { struct inode *inode = new_inode(mnt_sb); if (!inode) return ERR_PTR(-ENOMEM); inode->i_fop = &anon_inode_fops; inode->i_mapping->a_ops = &anon_aops; /* * Mark the inode dirty from the very beginning, * that way it will never be moved to the dirty * list because mark_inode_dirty() will think * that it already _is_ on the dirty list. */ inode->i_state = I_DIRTY; inode->i_mode = S_IFREG | S_IRUSR | S_IWUSR; inode->i_uid = current_fsuid(); inode->i_gid = current_fsgid(); inode->i_atime = inode->i_mtime = inode->i_ctime = CURRENT_TIME; return inode; } /* * simple_dname */ static int prepend(char **buffer, int *buflen, const char *str, int namelen) { *buflen -= namelen; if (*buflen < 0) return -ENAMETOOLONG; *buffer -= namelen; memcpy(*buffer, str, namelen); return 0; } char *simple_dname(struct dentry *dentry, char *buffer, int buflen) { char *end = buffer + buflen; /* these dentries are never renamed, so d_lock is not needed */ if (prepend(&end, &buflen, " (deleted)", 11) || prepend(&end, &buflen, dentry->d_name.name, dentry->d_name.len) || prepend(&end, &buflen, "/", 1)) end = ERR_PTR(-ENAMETOOLONG); return end; } /* * shrinker */ #undef shrinker #undef register_shrinker #undef unregister_shrinker static int shrinker2_shrink(struct shrinker *shrinker, int nr_to_scan, gfp_t gfp_mask) { struct shrinker2 *s2 = container_of(shrinker, struct shrinker2, compat); struct shrink_control sc = { .nr_to_scan = nr_to_scan, .gfp_mask = gfp_mask, }; int count; s2->scan_objects(s2, &sc); count = s2->count_objects(s2, &sc); shrinker->seeks = s2->seeks; return count; } void register_shrinker2(struct shrinker2 *s2) { s2->compat.shrink = shrinker2_shrink; s2->compat.seeks = s2->seeks; register_shrinker(&s2->compat); } EXPORT_SYMBOL(register_shrinker2); void unregister_shrinker2(struct shrinker2 *s2) { unregister_shrinker(&s2->compat); } EXPORT_SYMBOL(unregister_shrinker2); /* * */ int __init drm_backport_init(void) { return 0; } void __exit drm_backport_exit(void) { }
#include "mex.h" #include "matrix.h" #include <string.h> #include <stdio.h> void separatefile(char * Ofile, char ** Nfile, int PageSize, int Pages) { FILE * pofile; FILE * pnfile; char str[4000]; char debugstr[140]; int i=0,j=0; int lines = 0,curline = 0; pofile = fopen( Ofile, "r+t"); lines = PageSize / 5; for (j=0;j<Pages;j++) { sprintf(debugstr,"Create Separated File: %s\n",Nfile[j]); mexPrintf(debugstr); pnfile = fopen( Nfile[j], "w+t"); while (!feof(pofile)){ fgets(str,4000,pofile); fputs(str,pnfile); fgets(str,4000,pofile); fputs(str,pnfile); fgets(str,4000,pofile); fputs(str,pnfile); fgets(str,4000,pofile); fputs(str,pnfile); fgets(str,4000,pofile); fputs(str,pnfile); curline ++; if (curline == lines) { curline = 0; break; } } fclose(pnfile); } fclose(pofile); return; } void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[]) { double *pr; int PageSize; int m,n,i; char debugstr[140]; char * Ofile; char ** Nfile; mxArray * parr; int buflen; /* Check for proper number of arguments. */ /* NOTE: You do not need an else statement when using mexErrMsgTxt within an if statement. It will never get to the else statement if mexErrMsgTxt is executed. (mexErrMsgTxt breaks you out of the MEX-file.) */ if (nrhs != 3) mexErrMsgTxt("Three input required."); /* Create a pointer to the input matrix y. */ Ofile = mxArrayToString(prhs[0]); n = mxGetN(prhs[0]); m = mxGetM(prhs[0]); sprintf(debugstr,"Original File : %s\n",Ofile); mexPrintf(debugstr); //pr = mxGetPr(prhs[0]); n = mxGetN(prhs[1]); m = mxGetM(prhs[1]); //buflen = (mxGetM(prhs[1]) * mxGetN(prhs[1]) * sizeof(mxChar)) + 1; //Nfile = mxCalloc(buflen, sizeof(mxChar)); // read the cell Nfile = (char **)calloc(n,sizeof(char *)); sprintf(debugstr,"Pages: %d\n",n); mexPrintf(debugstr); for (i=0;i<n;i++) { parr = mxGetCell(prhs[1],i); Nfile[i] = (char *)calloc(200,sizeof(char)); memset(Nfile[i],0x0,200); Nfile[i] = mxArrayToString(parr); ///*sprintf(debugstr,"%d,%d : %s",m,n,Nfile[i]); //mexWarnMsgTxt(debugstr);*/ } pr = mxGetPr(prhs[2]); PageSize = *pr; sprintf(debugstr,"PageSize : %d\n", PageSize); mexPrintf(debugstr); //Nfile = mxGetPr(prhs[1]); //n = mxGetN(prhs[1]); separatefile(Ofile,Nfile,PageSize,n); }
/* Copyright (C) 1995 Aladdin Enterprises. All rights reserved. This software is provided AS-IS with no warranty, either express or implied. This software is distributed under license and may not be copied, modified or distributed except as expressly authorized under the terms of the license contained in the file LICENSE in this distribution. For more information about licensing, please refer to http://www.ghostscript.com/licensing/. For information on commercial licensing, go to http://www.artifex.com/licensing/ or contact Artifex Software, Inc., 101 Lucas Valley Road #110, San Rafael, CA 94903, U.S.A., +1(415)492-9861. */ /* $Id: gdevcgmx.h,v 1.4 2002/02/21 22:24:51 giles Exp $ */ /* Internal definitions for CGM-writing library */ #ifndef gdevcgmx_INCLUDED # define gdevcgmx_INCLUDED #include "gdevcgml.h" /* Define the internal representations of the CGM opcodes. */ #define cgm_op_class_shift 7 #define cgm_op_id_shift 5 typedef enum { /* Class 0 */ BEGIN_METAFILE = (0 << cgm_op_class_shift) + 1, END_METAFILE, BEGIN_PICTURE, BEGIN_PICTURE_BODY, END_PICTURE, /* Class 1 */ METAFILE_VERSION = (1 << cgm_op_class_shift) + 1, METAFILE_DESCRIPTION, VDC_TYPE, INTEGER_PRECISION, REAL_PRECISION, INDEX_PRECISION, COLOR_PRECISION, COLOR_INDEX_PRECISION, MAXIMUM_COLOR_INDEX, COLOR_VALUE_EXTENT, METAFILE_ELEMENT_LIST, METAFILE_DEFAULTS_REPLACEMENT, FONT_LIST, CHARACTER_SET_LIST, CHARACTER_CODING_ANNOUNCER, /* Class 2 */ SCALING_MODE = (2 << cgm_op_class_shift) + 1, COLOR_SELECTION_MODE, LINE_WIDTH_SPECIFICATION_MODE, MARKER_SIZE_SPECIFICATION_MODE, EDGE_WIDTH_SPECIFICATION_MODE, VDC_EXTENT, BACKGROUND_COLOR, /* Class 3 */ VDC_INTEGER_PRECISION = (3 << cgm_op_class_shift) + 1, VDC_REAL_PRECISION, AUXILIARY_COLOR, TRANSPARENCY, CLIP_RECTANGLE, CLIP_INDICATOR, /* Class 4 */ POLYLINE = (4 << cgm_op_class_shift) + 1, DISJOINT_POLYLINE, POLYMARKER, TEXT, RESTRICTED_TEXT, APPEND_TEXT, POLYGON, POLYGON_SET, CELL_ARRAY, GENERALIZED_DRAWING_PRIMITIVE, RECTANGLE, CIRCLE, CIRCULAR_ARC_3_POINT, CIRCULAR_ARC_3_POINT_CLOSE, CIRCULAR_ARC_CENTER, CIRCULAR_ARC_CENTER_CLOSE, ELLIPSE, ELLIPTICAL_ARC, ELLIPTICAL_ARC_CLOSE, /* Class 5 */ LINE_BUNDLE_INDEX = (5 << cgm_op_class_shift) + 1, LINE_TYPE, LINE_WIDTH, LINE_COLOR, MARKER_BUNDLE_INDEX, MARKER_TYPE, MARKER_SIZE, MARKER_COLOR, TEXT_BUNDLE_INDEX, TEXT_FONT_INDEX, TEXT_PRECISION, CHARACTER_EXPANSION_FACTOR, CHARACTER_SPACING, TEXT_COLOR, CHARACTER_HEIGHT, CHARACTER_ORIENTATION, TEXT_PATH, TEXT_ALIGNMENT, CHARACTER_SET_INDEX, ALTERNATE_CHARACTER_SET_INDEX, FILL_BUNDLE_INDEX, INTERIOR_STYLE, FILL_COLOR, HATCH_INDEX, PATTERN_INDEX, EDGE_BUNDLE_INDEX, EDGE_TYPE, EDGE_WIDTH, EDGE_COLOR, EDGE_VISIBILITY, FILL_REFERENCE_POINT, PATTERN_TABLE, PATTERN_SIZE, COLOR_TABLE, ASPECT_SOURCE_FLAGS, /* Class 6 */ ESCAPE = (6 << cgm_op_class_shift) + 1, /* Class 7 */ MESSAGE = (7 << cgm_op_class_shift) + 1, APPLICATION_DATA } cgm_op_index; /* Define the state of the CGM writer. */ /*typedef struct cgm_state_s cgm_state; *//* in gdevcgml.h */ struct cgm_state_s { /* The following are set at initialization time. */ FILE *file; cgm_allocator allocator; /* The following are set by specific calls. */ cgm_metafile_elements metafile; cgm_picture_elements picture; int vdc_integer_precision; cgm_precision vdc_real_precision; cgm_color auxiliary_color; cgm_transparency transparency; cgm_point clip_rectangle[2]; cgm_clip_indicator clip_indicator; int line_bundle_index; cgm_line_type line_type; cgm_line_width line_width; cgm_color line_color; int marker_bundle_index; cgm_marker_type marker_type; cgm_marker_size marker_size; cgm_color marker_color; int text_bundle_index; int text_font_index; cgm_text_precision text_precision; cgm_real character_expansion_factor; cgm_real character_spacing; cgm_color text_color; cgm_vdc character_height; cgm_vdc character_orientation[4]; cgm_text_path text_path; /****** text_alignment ******/ int character_set_index; int alternate_character_set_index; int fill_bundle_index; cgm_interior_style interior_style; cgm_color fill_color; cgm_hatch_index hatch_index; int pattern_index; int edge_bundle_index; cgm_edge_type edge_type; cgm_edge_width edge_width; bool edge_visibility; cgm_point fill_reference_point; /****** pattern_table ******/ cgm_vdc pattern_size[4]; /****** color_table ******/ byte /*cgm_aspect_source */ source_flags[18]; /* The following change dynamically. */ #define command_max_count 400 /* (must be even) */ byte command[command_max_count]; int command_count; bool command_first; cgm_result result; }; #endif /* gdevcgmx_INCLUDED */
/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */ /* * Copyright (c) 2020 University of Padova, Dep. of Information Engineering, SIGNET lab. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as * published by the Free Software Foundation; * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef PHASED_ARRAY_MODEL_H #define PHASED_ARRAY_MODEL_H #include <ns3/object.h> #include <ns3/angles.h> #include <complex> #include <ns3/antenna-model.h> namespace ns3 { /** * \ingroup antenna * * \brief Class implementing the phased array model virtual base class. */ class PhasedArrayModel : public Object { public: /** * Constructor */ PhasedArrayModel (void); /** * Destructor */ virtual ~PhasedArrayModel (void); /** * \brief Get the type ID. * \return The object TypeId. */ static TypeId GetTypeId (void); typedef std::vector<std::complex<double> > ComplexVector; //!< type definition for complex vectors /** * Returns the horizontal and vertical components of the antenna element field * pattern at the specified direction. Single polarization is considered. * \param a the angle indicating the interested direction * \return a pair in which the first element is the horizontal component * of the field pattern and the second element is the vertical * component of the field pattern */ virtual std::pair<double, double> GetElementFieldPattern (Angles a) const = 0; /** * Returns the location of the antenna element with the specified * index, normalized with respect to the wavelength. * \param index the index of the antenna element * \return the 3D vector that represents the position of the element */ virtual Vector GetElementLocation (uint64_t index) const = 0; /** * Returns the number of antenna elements * \return the number of antenna elements */ virtual uint64_t GetNumberOfElements (void) const = 0; /** * Sets the beamforming vector to be used * \param beamformingVector the beamforming vector */ void SetBeamformingVector (const ComplexVector &beamformingVector); /** * Returns the beamforming vector that is currently being used * \return the current beamforming vector */ ComplexVector GetBeamformingVector (void) const; /** * Returns the beamforming vector that points towards the specified position * \param a the beamforming angle * \return the beamforming vector */ ComplexVector GetBeamformingVector (Angles a) const; /** * Returns the steering vector that points toward the specified position * \param a the steering angle * \return the steering vector */ ComplexVector GetSteeringVector (Angles a) const; /** * Sets the antenna model to be used * \param antennaElement the antenna model */ void SetAntennaElement (Ptr<AntennaModel> antennaElement); /** * Returns a pointer to the AntennaModel instance used to model the elements of the array * \return pointer to the AntennaModel instance */ Ptr<const AntennaModel> GetAntennaElement (void) const; /** * Returns the ID of this antenna array instance * \return the ID value */ uint32_t GetId () const; protected: /** * Utility method to compute the euclidean norm of a ComplexVector * \param vector the ComplexVector * \return the euclidean norm */ static double ComputeNorm (const ComplexVector &vector); ComplexVector m_beamformingVector; //!< the beamforming vector in use Ptr<AntennaModel> m_antennaElement; //!< the model of the antenna element in use bool m_isBfVectorValid; //!< ensures the validity of the beamforming vector static uint32_t m_idCounter; //!< the ID counter that is used to determine the unique antenna array ID uint32_t m_id {0}; //!< the ID of this antenna array instance }; /** * \brief Stream insertion operator. * * \param [in] os The reference to the output stream. * \param [in] cv A vector of complex values. * \returns The reference to the output stream. */ std::ostream& operator<< (std::ostream& os, const PhasedArrayModel::ComplexVector& cv); } /* namespace ns3 */ #endif /* PHASED_ARRAY_MODEL_H */
// ************************************************************************* // // Copyright 2004-2010 Bruno PAGES . // // This file is part of the BOUML Uml Toolkit. // // 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. // // e-mail : bouml@free.fr // home : http://bouml.free.fr // // ************************************************************************* #ifndef VISIBILITYGROUP_H #define VISIBILITYGROUP_H #include <qstring.h> #include "UmlEnum.h" class QRadioButton; class QButtonGroup; class VisibilityGroup { protected: QButtonGroup * bgroup; QRadioButton * public_rb; QRadioButton * protected_rb; QRadioButton * private_rb; QRadioButton * package_rb; QString default_pfix; QRadioButton * default_visibility_rb; public: VisibilityGroup() {}; QButtonGroup * init(QWidget * parent, UmlVisibility v, bool pack_allowed, const char * title = 0, const char * default_string = 0); void update_default(const VisibilityGroup & default_grp); void connect(const char *, QWidget *, const char *); void follow(const VisibilityGroup & other); UmlVisibility value(); QString state(); }; #endif
#include "mint/kcompiler.h" #include "debug.h" #include "filesys.h" #include "k_fds.h" #include "mint/fcntl.h" #include "mint/errno.h" #include "mint/assert.h" #include "mintfake.h" #include "dosfile.h" #include "dosdir.h" #include "mintproc.h"
/* * IMFS_unlink * * Routine to remove a link node from the tree. * * COPYRIGHT (c) 1989-1999. * On-Line Applications Research Corporation (OAR). * * The license and distribution terms for this file may be * found in the file LICENSE in this distribution or at * http://www.rtems.com/license/LICENSE. * * $Id$ */ #if HAVE_CONFIG_H #include "config.h" #endif #include <errno.h> #include <stdlib.h> #include "imfs.h" #include <rtems/libio_.h> #include <rtems/seterr.h> int IMFS_unlink( rtems_filesystem_location_info_t *parentloc, /* IN */ rtems_filesystem_location_info_t *loc /* IN */ ) { IMFS_jnode_t *node; rtems_filesystem_location_info_t the_link; int result = 0; node = loc->node_access; /* * Decrement the link counter of node pointed to and free the * space. */ /* * If this is the last last pointer to the node * free the node. */ if ( node->type == IMFS_HARD_LINK ) { if ( !node->info.hard_link.link_node ) rtems_set_errno_and_return_minus_one( EINVAL ); the_link = *loc; the_link.node_access = node->info.hard_link.link_node; IMFS_Set_handlers( &the_link ); /* * If removing the last hard link to a node, then we need * to remove the node that is a link and the node itself. */ if ( node->info.hard_link.link_node->st_nlink == 1) { result = (*the_link.handlers->rmnod_h)( parentloc, &the_link ); if ( result != 0 ) return -1; } else { node->info.hard_link.link_node->st_nlink --; IMFS_update_ctime( node->info.hard_link.link_node ); } } /* * Now actually free the node we were asked to free. */ result = (*loc->handlers->rmnod_h)( parentloc, loc ); return result; }
/* * Copyright 1997-2003 Sun Microsystems, Inc. All Rights Reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code 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. Sun designates this * particular file as subject to the "Classpath" exception as provided * by Sun in the LICENSE file that accompanied this code. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * 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 work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * 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. */ #ifndef MLIB_TYPES_H #define MLIB_TYPES_H #include <limits.h> #if defined(_MSC_VER) #include <float.h> /* for FLT_MAX and DBL_MAX */ #endif #ifndef DBL_MAX #define DBL_MAX 1.7976931348623157E+308 /* max decimal value of a "double" */ #endif #ifndef FLT_MAX #define FLT_MAX 3.402823466E+38F /* max decimal value of a "float" */ #endif #ifndef FLT_MIN #define FLT_MIN 1.175494351e-38F /* min normalised value of a "float" */ #endif #ifdef __cplusplus extern "C" { #endif typedef char mlib_s8; typedef unsigned char mlib_u8; typedef short mlib_s16; typedef unsigned short mlib_u16; typedef int mlib_s32; typedef unsigned int mlib_u32; typedef float mlib_f32; typedef double mlib_d64; #if defined(__SUNPRO_C) || defined(__SUNPRO_CC) || defined(__GNUC__) #if defined(__linux__) #include <stdint.h> /* for uintptr_t */ #include <malloc.h> /* for ptrdiff_t */ #else #include <link.h> /* for uintptr_t */ #include <stddef.h> /* for ptrdiff_t */ #endif /* __linux__ */ #ifdef MLIB_OS64BIT typedef long mlib_s64; typedef unsigned long mlib_u64; #define MLIB_S64_MIN LONG_MIN #define MLIB_S64_MAX LONG_MAX #define MLIB_S64_CONST(x) x##L #define MLIB_U64_CONST(x) x##UL #elif (__STDC__ - 0 == 0) || defined(__GNUC__) #if defined(_NO_LONGLONG) typedef union { mlib_d64 d64; mlib_s32 s32[2]; } mlib_s64; typedef union { mlib_d64 d64; mlib_u32 u32[2]; } mlib_u64; #else typedef long long mlib_s64; typedef unsigned long long mlib_u64; #define MLIB_S64_MIN LLONG_MIN #define MLIB_S64_MAX LLONG_MAX #define MLIB_S64_CONST(x) x##LL #define MLIB_U64_CONST(x) x##ULL #endif /* !defined(_NO_LONGLONG) */ #endif /* MLIB_OS64BIT */ #elif defined(_MSC_VER) #if defined(_NO_LONGLONG) typedef union { mlib_d64 d64; mlib_s32 s32[2]; } mlib_s64; typedef union { mlib_d64 d64; mlib_u32 u32[2]; } mlib_u64; #else typedef __int64 mlib_s64; typedef unsigned __int64 mlib_u64; #define MLIB_S64_MIN _I64_MIN #define MLIB_S64_MAX _I64_MAX #define MLIB_S64_CONST(x) x##I64 #define MLIB_U64_CONST(x) x##UI64 #endif /* !defined(_NO_LONGLONG) */ #include <stddef.h> #if !defined(_WIN64) typedef int intptr_t; typedef unsigned int uintptr_t; #endif /* _WIN64 */ #else #error "unknown platform" #endif typedef uintptr_t mlib_addr; typedef void* mlib_ras; #define MLIB_S8_MIN SCHAR_MIN #define MLIB_S8_MAX SCHAR_MAX #define MLIB_U8_MIN 0 #define MLIB_U8_MAX UCHAR_MAX #define MLIB_S16_MIN SHRT_MIN #define MLIB_S16_MAX SHRT_MAX #define MLIB_U16_MIN 0 #define MLIB_U16_MAX USHRT_MAX #define MLIB_S32_MIN INT_MIN #define MLIB_S32_MAX INT_MAX #define MLIB_U32_MIN 0 #define MLIB_U32_MAX UINT_MAX #define MLIB_F32_MIN -FLT_MAX #define MLIB_F32_MAX FLT_MAX #define MLIB_D64_MIN -DBL_MAX #define MLIB_D64_MAX DBL_MAX #ifdef __cplusplus } #endif #endif /* MLIB_TYPES_H */
#ifndef TPPROTO_DESIGNCACHE_H #define TPPROTO_DESIGNCACHE_H /* DesignCache - Cache of Designs class * * Copyright (C) 2006, 2008 Lee Begg and the Thousand Parsec Project * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ /*! \file \brief Declares the DesignCache class. */ #include <map> #include <boost/signal.hpp> #include "cache.h" namespace TPProto{ class Design; typedef boost::signal<void (boost::shared_ptr<Design>)> DesignSignal; typedef DesignSignal::slot_type DesignCallback; /*! \brief A Cache that caches Designs. */ class DesignCache : public Cache{ public: DesignCache(); virtual ~DesignCache(); void requestDesign(uint32_t designid, const DesignCallback &cb); boost::signals::connection watchDesign(uint32_t designid, const DesignCallback &cb); void addDesign(Design* design); void modifyDesign(Design* design); void removeDesign(uint32_t designid); void invalidateDesign(uint32_t designid); void requestDesignIds(const IdSetCallback& cb); boost::signals::connection watchDesignIds(const IdSetCallback& cb); virtual GetIdSequence* createGetIdSequenceFrame(); virtual GetById* createGetByIdFrame(); virtual uint32_t getIdFromFrame(Frame* frame); virtual uint64_t getModTimeFromFrame(Frame* frame); virtual void newItem(boost::shared_ptr<Frame> item); virtual void existingItem(boost::shared_ptr<Frame> item); private: void receiveAddDesign(Frame* frame); void receiveModifyDesign(uint32_t did, Frame* frame); void receivedRemoveDesign(uint32_t did, Frame* frame); std::map<uint32_t, DesignSignal*> watchers; std::map<uint32_t, DesignSignal*> waiters; }; } #endif
#include <kernel/arch.h> #include <kernel/console.h> #include <kernel/kassert.h> #include <kernel/kernel.h> #include <kernel/kernel_image.h> #include <kernel/kheap.h> #include <kernel/kmalloc.h> #include <kernel/mm/memory.h> #include <kernel/multiboot.h> #include <kernel/panic.h> #include <kernel/time/time.h> #include <libk/libk.h> #include "drivers/keyboard.h" #include "exception.h" #include "gdt.h" #include "i8254.h" #include "idt.h" #include "irq.h" #include "mm/memory.h" #include "mm/paging.h" #include "mm/vmm.h" #include "tss.h" #include "drivers/ioport_0xe9.h" #include <kernel/log.h> #define TICK_INTERVAL_IN_MS 10 void handle_page_fault(int exception, struct cpu_context* ctx); static void default_exception_handler(int exception, struct cpu_context* ctx) { log_e_printf("\nexception : %d", exception); PANIC("exception"); } static v_addr_t setup_initrd(const multiboot_module_t* mod) { v_addr_t initrd_start = mod->mod_start; v_addr_t initrd_end = mod->mod_end; size_t initrd_size = initrd_end - initrd_start; log_printf("initrd: %p -> %p (%ld)\n", (void*)initrd_start, (void*)initrd_end, initrd_size); kassert(is_aligned(initrd_start, PAGE_SIZE)); v_addr_t initrd = kmalloc_early(align_up(initrd_size, PAGE_SIZE)); kassert(is_aligned(initrd, PAGE_SIZE)); log_printf("initrd copied to %p\n", (void*)initrd); memcpy((void*)initrd, (void*)initrd_start, initrd_size); return initrd; } static size_t mem_size_bytes = 0; size_t arch_get_mem_size(void) { return mem_size_bytes; } static const struct log_ops x86_log_ops = { .puts = ioport_0xe9_puts, .putchar = ioport_0xe9_putchar, }; void __kernel_main(const multiboot_info_t* mbi) { kassert(mbi->mods_count > 0); void* initrd = (void*)setup_initrd((const multiboot_module_t*)mbi->mods_addr); log_register(&x86_log_ops); mem_size_bytes = (mbi->mem_upper << 10) + (1 << 20); kernel_main((void*)initrd); } static void clock_tick(int nr, struct cpu_context* interrupted_ctx) { time_tick(); } int arch_console_init(void) { int err; struct tty* console_tty; err = console_init(terminal_putchar, &console_tty); if (!err) err = keyboard_init(console_tty); return err; } static const mem_area_t mem_layout[] = { MEMORY_AREA(X86_MEMORY_HARDWARE_MAP_START, X86_MEMORY_HARDWARE_MAP_SIZE, 0, "MMIO"), }; static int arch_mm_init() { kassert(mem_size_bytes > 0); paging_init(); __memory_early_init(); x86_vmm_register(); if (kheap_init(kernel_image_get_top_page()) < KHEAP_INITIAL_SIZE) PANIC("Not enough memory for kernel heap!"); memory_init(mem_size_bytes, mem_layout, ARRAY_SIZE(mem_layout)); return 0; } int arch_init(void) { idt_init(); exception_init(); irq_init(); gdt_init(); tss_init(); for (unsigned int e = 0; e <= EXCEPTION_MAX; e++) exception_set_handler(e, default_exception_handler); irq_set_handler(IRQ_TIMER, clock_tick); exception_set_handler(EXCEPTION_PAGE_FAULT, handle_page_fault); struct timespec tick; timespec_init(&tick, TICK_INTERVAL_IN_MS); time_init(tick); kassert(idt_set_syscall_handler(0x80) == 0); kassert(i8254_set_tick_interval(TICK_INTERVAL_IN_MS) == 0); return arch_mm_init(); }
/* Shared library add-on to iptables for the SRCAUTH match. * * Written by Lukas Limacher, <lul@open.ch>, <limlukas@ethz.ch>, 02.07.2015 * Copyright (c) 2015 Open Systems AG, Switzerland * * 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 "config.h" #include <stdio.h> #include <xtables.h> #include <linux/netfilter/xt_SRCAUTH.h> #include <linux/netfilter/xt_srcauthmatch.h> enum { id_SRCAUTH_NO_HEADER = 0, id_SRCAUTH_SESSION_PRESENT, id_SRCAUTH_HAS_INFORMATION, F_SRCAUTH_NO_HEADER = 1 << id_SRCAUTH_NO_HEADER, F_SRCAUTH_SESSION_PRESENT = 1 << id_SRCAUTH_SESSION_PRESENT, F_SRCAUTH_HAS_INFORMATION = 1 << id_SRCAUTH_HAS_INFORMATION, F_ANY = F_SRCAUTH_NO_HEADER | F_SRCAUTH_SESSION_PRESENT | F_SRCAUTH_HAS_INFORMATION, F_EXCLUSIVE = F_SRCAUTH_HAS_INFORMATION, }; #define s struct xt_srcauth_match_info static const struct xt_option_entry srcauth_match_opts[] = { // FUTURE WORK: extend to get more than 32 bits input meta inf {.name = "no-header", .type = XTTYPE_NONE, .id = id_SRCAUTH_NO_HEADER, .excl = F_EXCLUSIVE, .flags = XTOPT_INVERT}, {.name = "session-present", .type = XTTYPE_NONE, .id = id_SRCAUTH_SESSION_PRESENT, .excl = F_EXCLUSIVE, .flags = XTOPT_INVERT}, {.name = "has-information", .type = XTTYPE_UINT32, .id = id_SRCAUTH_HAS_INFORMATION, .excl = F_ANY, .flags = XTOPT_PUT, XTOPT_POINTER(s, new_meta_cmp[0])}, XTOPT_TABLEEND, }; #undef s static void srcauth_match_help(void) { printf( "srcauth match options:\n" "[!] --no-header Matches if (! = not) no scheme header present\n" "[!] --session-present Matches if a session (! = not) exists in DB\n" " --has-information value Matches if value is equal to meta information in the scheme header (exclusive option)\n"); } static void srcauth_match_parse(struct xt_option_call *cb) { struct xt_srcauth_match_info *info = cb->data; // for each option separately called xtables_option_parse(cb); switch (cb->entry->id) { case id_SRCAUTH_NO_HEADER: info->option |= XT_SRCAUTH_NO_HEADER; if (cb->invert) info->invertNoHeader = true; break; break; case id_SRCAUTH_SESSION_PRESENT: info->option |= XT_SRCAUTH_SESSION_PRESENT; if (cb->invert) info->invertSessionPresent = true; break; case id_SRCAUTH_HAS_INFORMATION: info->option = XT_SRCAUTH_HAS_INFORMATION; break; } } static void srcauth_match_check(struct xt_fcheck_call *cb) { if (!(cb->xflags & F_ANY)) xtables_error(PARAMETER_PROBLEM, "srcauthmatch: You must specify an action"); } static void srcauth_match_save(const void *ip, const struct xt_entry_match *match) { const struct xt_srcauth_match_info *info = (struct xt_srcauth_match_info *) match->data; switch (info->option) { case XT_SRCAUTH_HAS_INFORMATION: printf(" --has-information %u", info->new_meta_cmp[0]); break; } if (info->option & XT_SRCAUTH_NO_HEADER) { if (info->invertNoHeader) printf(" !"); printf(" --no-header"); } if (info->option & XT_SRCAUTH_SESSION_PRESENT) { if (info->invertSessionPresent) printf(" !"); printf(" --session-present"); } } static void srcauth_match_print(const void *ip, const struct xt_entry_match *match, int numeric) { const struct xt_srcauth_match_info *info = (struct xt_srcauth_match_info *) match->data; printf(" srcauth match:"); switch (info->option) { case XT_SRCAUTH_HAS_INFORMATION: printf(" Has information %u", info->new_meta_cmp[0]); break; } if (info->option & XT_SRCAUTH_NO_HEADER) { if (info->invertNoHeader) printf(" !"); printf(" No header"); } if (info->option & XT_SRCAUTH_SESSION_PRESENT) { if (info->invertSessionPresent) printf(" !"); printf(" Session present"); } } static struct xtables_match srcauth_mt_reg = { .name = "srcauthmatch", .version = XTABLES_VERSION, .family = NFPROTO_IPV4, .size = XT_ALIGN(sizeof(struct xt_srcauth_match_info)), .userspacesize = XT_ALIGN(sizeof(struct xt_srcauth_match_info)), .help = srcauth_match_help, .print = srcauth_match_print, .save = srcauth_match_save, .x6_parse = srcauth_match_parse, .x6_fcheck = srcauth_match_check, .x6_options = srcauth_match_opts, .revision = 0, }; void _init(void) { xtables_register_match(&srcauth_mt_reg); }
/* * Copyright (C) 2008 Analog Devices Inc. * Licensed under the GPL-2 or later. */ #ifndef _MACH_GPIO_H_ #define _MACH_GPIO_H_ <<<<<<< HEAD #define MAX_BLACKFIN_GPIOS 41 #define GPIO_PF0 0 #define GPIO_PF1 1 #define GPIO_PF2 2 #define GPIO_PF3 3 #define GPIO_PF4 4 #define GPIO_PF5 5 #define GPIO_PF6 6 #define GPIO_PF7 7 #define GPIO_PF8 8 #define GPIO_PF9 9 #define GPIO_PF10 10 #define GPIO_PF11 11 #define GPIO_PF12 12 #define GPIO_PF13 13 #define GPIO_PF14 14 #define GPIO_PF15 15 #define GPIO_PG0 16 #define GPIO_PG1 17 #define GPIO_PG2 18 #define GPIO_PG3 19 #define GPIO_PG4 20 #define GPIO_PG5 21 #define GPIO_PG6 22 #define GPIO_PG7 23 #define GPIO_PG8 24 #define GPIO_PG9 25 #define GPIO_PG10 26 #define GPIO_PG11 27 #define GPIO_PG12 28 #define GPIO_PG13 29 #define GPIO_PG14 30 #define GPIO_PG15 31 #define GPIO_PH0 32 #define GPIO_PH1 33 #define GPIO_PH2 34 #define GPIO_PH3 35 #define GPIO_PH4 36 #define GPIO_PH5 37 #define GPIO_PH6 38 #define GPIO_PH7 39 #define GPIO_PH8 40 ======= #define MAX_BLACKFIN_GPIOS 40 #define GPIO_PF0 0 #define GPIO_PF1 1 #define GPIO_PF2 2 #define GPIO_PF3 3 #define GPIO_PF4 4 #define GPIO_PF5 5 #define GPIO_PF6 6 #define GPIO_PF7 7 #define GPIO_PF8 8 #define GPIO_PF9 9 #define GPIO_PF10 10 #define GPIO_PF11 11 #define GPIO_PF12 12 #define GPIO_PF13 13 #define GPIO_PF14 14 #define GPIO_PF15 15 #define GPIO_PG0 16 #define GPIO_PG1 17 #define GPIO_PG2 18 #define GPIO_PG3 19 #define GPIO_PG4 20 #define GPIO_PG5 21 #define GPIO_PG6 22 #define GPIO_PG7 23 #define GPIO_PG8 24 #define GPIO_PG9 25 #define GPIO_PG10 26 #define GPIO_PG11 27 #define GPIO_PG12 28 #define GPIO_PG13 29 #define GPIO_PG14 30 #define GPIO_PG15 31 #define GPIO_PH0 32 #define GPIO_PH1 33 #define GPIO_PH2 34 #define GPIO_PH3 35 #define GPIO_PH4 36 #define GPIO_PH5 37 #define GPIO_PH6 38 #define GPIO_PH7 39 >>>>>>> 296c66da8a02d52243f45b80521febece5ed498a #define PORT_F GPIO_PF0 #define PORT_G GPIO_PG0 #define PORT_H GPIO_PH0 <<<<<<< HEAD #include <mach-common/ports-f.h> #include <mach-common/ports-g.h> #include <mach-common/ports-h.h> ======= >>>>>>> 296c66da8a02d52243f45b80521febece5ed498a #endif /* _MACH_GPIO_H_ */
/* * Copyright (c) 2002, Intel Corporation. All rights reserved. * Created by: rolla.n.selbak REMOVE-THIS AT intel DOT com * This file is licensed under the GPL license. For the full content * of this license, see the COPYING file at the top level of this * source tree. Test this function is defined: int pthread_attr_destroy(pthread_attr_t *); */ #include <pthread.h> pthread_attr_t a; void dummy_func () { pthread_attr_destroy(&a); return; }
/* * $Id$ * * Copyright (C) 2008-2009 Antoine Drouin <poinix@gmail.com> * * 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, write to * the Free Software Foundation, 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. * */ #ifndef AUTOPILOT_H #define AUTOPILOT_H #include "std.h" #include "led.h" #include "generated/airframe.h" #include "subsystems/ins.h" #define AP_MODE_FAILSAFE 0 #define AP_MODE_KILL 1 #define AP_MODE_RATE_DIRECT 2 #define AP_MODE_ATTITUDE_DIRECT 3 #define AP_MODE_RATE_RC_CLIMB 4 #define AP_MODE_ATTITUDE_RC_CLIMB 5 #define AP_MODE_ATTITUDE_CLIMB 6 #define AP_MODE_RATE_Z_HOLD 7 #define AP_MODE_ATTITUDE_Z_HOLD 8 #define AP_MODE_HOVER_DIRECT 9 #define AP_MODE_HOVER_CLIMB 10 #define AP_MODE_HOVER_Z_HOLD 11 #define AP_MODE_NAV 12 #define AP_MODE_RC_DIRECT 13 // Safety Pilot Direct Commands for helicopter direct control: appropriately chosen as mode "13" extern uint8_t autopilot_mode; extern uint8_t autopilot_mode_auto2; extern bool_t autopilot_motors_on; extern bool_t autopilot_in_flight; extern bool_t kill_throttle; extern bool_t autopilot_rc; extern bool_t autopilot_power_switch; extern void autopilot_init(void); extern void autopilot_periodic(void); extern void autopilot_on_rc_frame(void); extern void autopilot_set_mode(uint8_t new_autopilot_mode); extern void autopilot_set_motors_on(bool_t motors_on); extern bool_t autopilot_detect_ground; extern bool_t autopilot_detect_ground_once; extern uint16_t autopilot_flight_time; #ifndef MODE_MANUAL #define MODE_MANUAL AP_MODE_RATE_DIRECT #endif #ifndef MODE_AUTO1 #define MODE_AUTO1 AP_MODE_ATTITUDE_DIRECT #endif #ifndef MODE_AUTO2 #define MODE_AUTO2 AP_MODE_ATTITUDE_Z_HOLD #endif #define TRESHOLD_1_PPRZ (MIN_PPRZ / 2) #define TRESHOLD_2_PPRZ (MAX_PPRZ / 2) #define AP_MODE_OF_PPRZ(_rc, _mode) { \ if (_rc > TRESHOLD_2_PPRZ) \ _mode = autopilot_mode_auto2; \ else if (_rc > TRESHOLD_1_PPRZ) \ _mode = MODE_AUTO1; \ else \ _mode = MODE_MANUAL; \ } #define autopilot_KillThrottle(_v) { \ kill_throttle = _v; \ if (kill_throttle) autopilot_motors_on = FALSE; \ else autopilot_motors_on = TRUE; \ } #ifdef POWER_SWITCH_LED #define autopilot_SetPowerSwitch(_v) { \ autopilot_power_switch = _v; \ if (_v) { LED_OFF(POWER_SWITCH_LED); } \ else { LED_ON(POWER_SWITCH_LED); } \ } #else #define autopilot_SetPowerSwitch(_v) { \ autopilot_power_switch = _v; \ } #endif #ifndef TRESHOLD_GROUND_DETECT #define TRESHOLD_GROUND_DETECT ACCEL_BFP_OF_REAL(15.) #endif static inline void DetectGroundEvent(void) { if (autopilot_mode == AP_MODE_FAILSAFE || autopilot_detect_ground_once) { if (ins_ltp_accel.z < -TRESHOLD_GROUND_DETECT || ins_ltp_accel.z > TRESHOLD_GROUND_DETECT) { autopilot_detect_ground = TRUE; autopilot_detect_ground_once = FALSE; } } } #endif /* AUTOPILOT_H */
enum { DRUUGE_PACKAGE = 1 };
//--------------------------------------------------------------------------- #ifndef OverbyteIcsRecv1H #define OverbyteIcsRecv1H //--------------------------------------------------------------------------- #include <Classes.hpp> #include <Controls.hpp> #include <StdCtrls.hpp> #include <Forms.hpp> #include "OverbyteIcsWSocket.hpp" #include <ExtCtrls.hpp> #include "OverbyteIcsWndControl.hpp" #define WM_DESTROY_SOCKET (WM_USER + 1) //--------------------------------------------------------------------------- class TRecvForm : public TForm { __published: // IDE-managed Components TPanel *Panel1; TLabel *Label1; TLabel *Label2; TEdit *PortEdit; TButton *ActionButton; TButton *CloseAllButton; TCheckBox *LingerCheckBox; TCheckBox *BannerCheckBox; TButton *LineModeOnButton; TButton *LineOffButton; TMemo *DisplayMemo; TWSocket *WSocket1; void __fastcall FormDestroy(TObject *Sender); void __fastcall FormShow(TObject *Sender); void __fastcall FormClose(TObject *Sender, TCloseAction &Action); void __fastcall ActionButtonClick(TObject *Sender); void __fastcall PortEditChange(TObject *Sender); void __fastcall WSocket1SessionAvailable(TObject *Sender, WORD Error); void __fastcall CloseAllButtonClick(TObject *Sender); void __fastcall LineModeOnButtonClick(TObject *Sender); void __fastcall LineOffButtonClick(TObject *Sender); private: // User declarations AnsiString FIniFileName; BOOL FInitialized; TList *FClients; void __fastcall ClientDataAvailable(TObject *Sender, WORD Error); void __fastcall ClientSessionClosed(TObject *Sender, WORD Error); void __fastcall Display(AnsiString Msg); protected: void __fastcall WMDestroySocket(TMessage Msg); BEGIN_MESSAGE_MAP MESSAGE_HANDLER(WM_DESTROY_SOCKET, TMessage, WMDestroySocket) END_MESSAGE_MAP(TForm) public: // User declarations __fastcall TRecvForm(TComponent* Owner); }; //--------------------------------------------------------------------------- extern TRecvForm *RecvForm; //--------------------------------------------------------------------------- #endif
/* arch/arm/mach-msm/include/mach/hardware.h * * Copyright (C) 2007 Google, Inc. * * This software is licensed under the terms of the GNU General Public * License version 2, as published by the Free Software Foundation, and * may be copied, distributed, and modified under those terms. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * */
/* * Copyright (C) 2001-2013 Jacek Sieka, arnetheduck on gmail point 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #ifndef DCPLUSPLUS_WIN32_SEARCH_TYPES_PAGE_H #define DCPLUSPLUS_WIN32_SEARCH_TYPES_PAGE_H #include "PropPage.h" class SearchTypesPage : public PropPage { public: SearchTypesPage(dwt::Widget* parent); virtual ~SearchTypesPage(); virtual void layout(); private: TablePtr types; ButtonPtr rename; ButtonPtr remove; ButtonPtr modify; void handleDoubleClick(); bool handleKeyDown(int c); void handleSelectionChanged(); void handleAddClicked(); void handleModClicked(); void handleRenameClicked(); void handleRemoveClicked(); void handleDefaultsClicked(); void addRow(const tstring& name, bool predefined, const TStringList& extensions); void addDirectory(const tstring& aPath); void fillList(); void showError(const string& e); void findRealName(string& name) const; }; #endif // !defined(DCPLUSPLUS_WIN32_SEARCH_TYPES_PAGE_H)
/* vim:set noet ts=8 sw=8 sts=8 ff=unix: */ #ifndef __K_INI_H__ #define __K_INI_H__ #ifdef __cplusplus extern "C" { #endif #include <ktypes.h> kbool kini_getstr(const kchar *a_sec, const kchar *a_key, kchar *a_val, kint a_size, const kchar *a_path); kbool kini_getint(const kchar *a_sec, const kchar *a_key, kint *a_ret, const kchar *a_path); kbool kini_setstr(const kchar *a_sec, const kchar *a_key, const kchar *a_val, const kchar *a_path); kbool kini_setint(const kchar *a_sec, const kchar *a_key, kint a_val, const kchar *a_path); #ifdef __cplusplus } #endif #endif /* __K_INI_H__ */
#include "lolevel.h" #include "platform.h" #include "keyboard.h" #include "kbd_common.h" long kbd_new_state[3] = { 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF }; long kbd_prev_state[3] = { 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF }; long kbd_mod_state[3] = { 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF }; int get_usb_bit() { long usb_physw[3]; usb_physw[USB_IDX] = 0; _kbd_read_keys_r2(usb_physw); return(( usb_physw[USB_IDX] & USB_MASK)==USB_MASK) ; } long __attribute__((naked)) wrap_kbd_p1_f(); void __attribute__((noinline)) mykbd_task() { while (physw_run){ _SleepTask(physw_sleep_delay); if (wrap_kbd_p1_f() == 1){ // autorepeat ? _kbd_p2_f(); } } _ExitTask(); } long __attribute__((naked,noinline)) wrap_kbd_p1_f() { asm volatile( "STMFD SP!, {R1-R7,LR}\n" "MOV R5, #0\n" "BL my_kbd_read_keys\n" "B _kbd_p1_f_cont\n" ); return 0; // shut up the compiler } void my_kbd_read_keys() { kbd_update_key_state(); // _kbd_read_keys_r2(physw_status); kbd_update_physw_bits(); } KeyMap keymap[] = { { 2, KEY_ZOOM_IN ,0x00008000 }, { 2, KEY_VIDEO ,0x00002000 }, { 2, KEY_ZOOM_OUT ,0x00004000 }, { 2, KEY_MENU ,0x00001000 }, // Found @0xffba90b8, levent 0x09 { 2, KEY_HELP ,0x00000800 }, { 2, KEY_PLAYBACK ,0x00000200 }, // Found @0xffba90f0, levent 0x101 // { 2, KEY_POWER ,0x00000100 }, { 2, KEY_SHOOT_FULL ,0x00000060 }, // Found @0xffba90d8, levent 0x01 { 2, KEY_SHOOT_FULL_ONLY ,0x00000040 }, // Found @0xffba90d8, levent 0x01 { 2, KEY_SHOOT_HALF ,0x00000020 }, // Found @0xffba90d0, levent 0x00 { 2, KEY_LEFT ,0x00000010 }, { 2, KEY_DOWN ,0x00000008 }, { 2, KEY_RIGHT ,0x00000004 }, { 2, KEY_UP ,0x00000002 }, { 2, KEY_SET ,0x00000001 }, { 0, 0, 0 } }; extern void _GetKbdState(long *); void kbd_fetch_data(long *dst) { _GetKbdState(dst); _kbd_read_keys_r2(dst); }
/* * (C) Copyright 2000 * Paolo Scaffardi, AIRVENT SAM s.p.a - RIMINI(ITALY), arsenio@tin.it * * See file CREDITS for list of people who contributed to this * project. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as * published by the Free Software Foundation; either version 2 of * the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, * MA 02111-1307 USA */ #include <config.h> #include <common.h> #include <stdarg.h> #include <malloc.h> #include <stdio_dev.h> #include <serial.h> #ifdef CONFIG_LOGBUFFER #include <logbuff.h> #endif #if defined(CONFIG_HARD_I2C) || defined(CONFIG_SOFT_I2C) #include <i2c.h> #endif DECLARE_GLOBAL_DATA_PTR; static struct stdio_dev devs; struct stdio_dev *stdio_devices[] = { NULL, NULL, NULL }; char *stdio_names[MAX_FILES] = { "stdin", "stdout", "stderr" }; #if defined(CONFIG_SPLASH_SCREEN) && !defined(CONFIG_SYS_DEVICE_NULLDEV) #define CONFIG_SYS_DEVICE_NULLDEV 1 #endif #ifdef CONFIG_SYS_DEVICE_NULLDEV void nulldev_putc(const char c) { /* nulldev is empty! */ } void nulldev_puts(const char *s) { /* nulldev is empty! */ } int nulldev_input(void) { /* nulldev is empty! */ return 0; } #endif /************************************************************************** * SYSTEM DRIVERS ************************************************************************** */ static void drv_system_init (void) { struct stdio_dev dev; memset (&dev, 0, sizeof (dev)); strcpy (dev.name, "serial"); dev.flags = DEV_FLAGS_OUTPUT | DEV_FLAGS_INPUT | DEV_FLAGS_SYSTEM; dev.putc = serial_putc; dev.puts = serial_puts; dev.getc = serial_getc; dev.tstc = serial_tstc; stdio_register (&dev); #ifdef CONFIG_SYS_DEVICE_NULLDEV memset (&dev, 0, sizeof (dev)); strcpy (dev.name, "nulldev"); dev.flags = DEV_FLAGS_OUTPUT | DEV_FLAGS_INPUT | DEV_FLAGS_SYSTEM; dev.putc = nulldev_putc; dev.puts = nulldev_puts; dev.getc = nulldev_input; dev.tstc = nulldev_input; stdio_register (&dev); #endif } /************************************************************************** * DEVICES ************************************************************************** */ struct list_head* stdio_get_list(void) { return &(devs.list); } struct stdio_dev* stdio_get_by_name(char* name) { struct list_head *pos; struct stdio_dev *dev; if(!name) return NULL; list_for_each(pos, &(devs.list)) { dev = list_entry(pos, struct stdio_dev, list); if(strcmp(dev->name, name) == 0) return dev; } return NULL; } struct stdio_dev* stdio_clone(struct stdio_dev *dev) { struct stdio_dev *_dev; if(!dev) return NULL; _dev = calloc(1, sizeof(struct stdio_dev)); if(!_dev) return NULL; memcpy(_dev, dev, sizeof(struct stdio_dev)); strncpy(_dev->name, dev->name, 16); return _dev; } int stdio_register (struct stdio_dev * dev) { struct stdio_dev *_dev; _dev = stdio_clone(dev); if(!_dev) return -1; list_add_tail(&(_dev->list), &(devs.list)); return 0; } /* deregister the device "devname". * returns 0 if success, -1 if device is assigned and 1 if devname not found */ #ifdef CONFIG_SYS_STDIO_DEREGISTER int stdio_deregister(char *devname) { int l; struct list_head *pos; struct stdio_dev *dev; char temp_names[3][8]; dev = stdio_get_by_name(devname); if(!dev) /* device not found */ return -1; /* get stdio devices (ListRemoveItem changes the dev list) */ for (l=0 ; l< MAX_FILES; l++) { if (stdio_devices[l] == dev) { /* Device is assigned -> report error */ return -1; } memcpy (&temp_names[l][0], stdio_devices[l]->name, sizeof(stdio_devices[l]->name)); } list_del(&(dev->list)); /* reassign Device list */ list_for_each(pos, &(devs.list)) { dev = list_entry(pos, struct stdio_dev, list); for (l=0 ; l< MAX_FILES; l++) { if(strcmp(dev->name, temp_names[l]) == 0) stdio_devices[l] = dev; } } return 0; } #endif /* CONFIG_SYS_STDIO_DEREGISTER */ int stdio_init (void) { #if defined(CONFIG_NEEDS_MANUAL_RELOC) /* already relocated for current ARM implementation */ ulong relocation_offset = gd->reloc_off; int i; /* relocate device name pointers */ for (i = 0; i < (sizeof (stdio_names) / sizeof (char *)); ++i) { stdio_names[i] = (char *) (((ulong) stdio_names[i]) + relocation_offset); } #endif /* CONFIG_NEEDS_MANUAL_RELOC */ /* Initialize the list */ INIT_LIST_HEAD(&(devs.list)); #ifdef CONFIG_ARM_DCC_MULTI drv_arm_dcc_init (); #endif #if defined(CONFIG_HARD_I2C) || defined(CONFIG_SOFT_I2C) i2c_init (CONFIG_SYS_I2C_SPEED, CONFIG_SYS_I2C_SLAVE, 0); #endif #ifdef CONFIG_LCD drv_lcd_init (); #endif #if defined(CONFIG_VIDEO) || defined(CONFIG_CFB_CONSOLE) drv_video_init (); #endif #ifdef CONFIG_KEYBOARD drv_keyboard_init (); #endif #ifdef CONFIG_LOGBUFFER drv_logbuff_init (); #endif drv_system_init (); #ifdef CONFIG_SERIAL_MULTI serial_stdio_init (); #endif #ifdef CONFIG_USB_TTY drv_usbtty_init (); #endif #ifdef CONFIG_NETCONSOLE drv_nc_init (); #endif #ifdef CONFIG_JTAG_CONSOLE drv_jtag_console_init (); #endif return (0); }
#include "platform.h" char *hook_raw_image_addr() { return (char*)0x421E1120; } void *vid_get_viewport_live_fb()//found in sub_FF8E0788 { void **fb=(void **)0x5014; unsigned char buff = *((unsigned char*)0x4E5C); if (buff == 0) buff = 2; else buff--; return (void*)fb[buff]; } void *vid_get_bitmap_fb() { return (void*)0x40431000; } void *vid_get_viewport_fb() { return (void*)0x408CB700; } void *vid_get_viewport_fb_d() { return (void*)(*(int*)(0x28F0+0x58)); } long vid_get_viewport_height() { return 240; } // Physical width of viewport row in bytes int vid_get_viewport_byte_width() { return 960 * 6 / 4; // IXUS 200 - wide screen LCD is 960 pixels wide, each group of 4 pixels uses 6 bytes (UYVYYY) } int vid_get_viewport_width() { if (shooting_get_prop(PROPCASE_RESOLUTION) == 8) // widescreen (16:9) image size return 480; else return 360; } int vid_get_viewport_display_xoffset() { if (shooting_get_prop(PROPCASE_RESOLUTION) == 8) // widescreen (16:9) image size return 0; else return 60; } char *camera_jpeg_count_str() { // return (char*)0x4C138; return (char*)0x00084ca4; // Found @0xff9e8aa8 } //only for cameras with a touchscreen short get_touch_click_x() { return *(short*)(0x258C+6); } short get_touch_click_y() { return *(short*)(0x258C+8); }
/* -*- mode: c; tab-width: 4; indent-tabs-mode: n; c-basic-offset: 4 -*- * * $Id: nb_kernel101.h,v 1.1 2004/12/26 19:24:27 lindahl Exp $ * * This file is part of Gromacs Copyright (c) 1991-2004 * David van der Spoel, Erik Lindahl, University of Groningen. * * 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. * * To help us fund GROMACS development, we humbly ask that you cite * the research papers on the package. Check out http://www.gromacs.org * * And Hey: * Gnomes, ROck Monsters And Chili Sauce */ #ifndef _NB_KERNEL101_H_ #define _NB_KERNEL101_H_ /* This header is never installed, so we can use config.h */ #ifdef HAVE_CONFIG_H #include <config.h> #endif #include <types/simple.h> /*! \file nb_kernel101.h * \brief Nonbonded kernel 101 (Coul, SPC) * * \internal */ #ifdef __cplusplus extern "C" { #endif #if 0 } #endif /*! \brief Nonbonded kernel 101 with forces. * * \internal Generated at compile time in either C or Fortran * depending on configuration settings. The name of * the function in C is nb_kernel101. For Fortran the * name mangling depends on the compiler, but in Gromacs * you can handle it automatically with the macro * F77_OR_C_FUNC_(nb_kernel101,NB_KERNEL101), which * expands to the correct identifier. * * <b>Coulomb interaction:</b> Standard 1/r <br> * <b>VdW interaction:</b> No <br> * <b>Water optimization:</b> SPC - other atoms <br> * <b>Forces calculated:</b> Yes <br> * * \note All level1 and level2 nonbonded kernels use the same * call sequence. Parameters are documented in nb_kernel.h */ void F77_OR_C_FUNC_(nb_kernel101,NB_KERNEL101) (int * nri, int iinr[], int jindex[], int jjnr[], int shift[], real shiftvec[], real fshift[], int gid[], real pos[], real faction[], real charge[], real * facel, real * krf, real * crf, real Vc[], int type[], int * ntype, real vdwparam[], real Vvdw[], real * tabscale, real VFtab[], real invsqrta[], real dvda[], real * gbtabscale, real GBtab[], int * nthreads, int * count, void * mtx, int * outeriter, int * inneriter, real work[]); /*! \brief Nonbonded kernel 101 without forces. * * \internal Generated at compile time in either C or Fortran * depending on configuration settings. The name of * the function in C is nb_kernel101. For Fortran the * name mangling depends on the compiler, but in Gromacs * you can handle it automatically with the macro * F77_OR_C_FUNC_(nb_kernel101,NB_KERNEL101), which * expands to the correct identifier. * * <b>Coulomb interaction:</b> Standard 1/r <br> * <b>VdW interaction:</b> No <br> * <b>Water optimization:</b> SPC - other atoms <br> * <b>Forces calculated:</b> No <br> * * \note All level1 and level2 nonbonded kernels use the same * call sequence. Parameters are documented in nb_kernel.h */ void F77_OR_C_FUNC_(nb_kernel101nf,NB_KERNEL101NF) (int * nri, int iinr[], int jindex[], int jjnr[], int shift[], real shiftvec[], real fshift[], int gid[], real pos[], real faction[], real charge[], real * facel, real * krf, real * crf, real Vc[], int type[], int * ntype, real vdwparam[], real Vvdw[], real * tabscale, real VFtab[], real invsqrta[], real dvda[], real * gbtabscale, real GBtab[], int * nthreads, int * count, void * mtx, int * outeriter, int * inneriter, real work[]); #ifdef __cplusplus } #endif #endif /* _NB_KERNEL101_H_ */
#ifndef __DIALOGEX_H__ #define __DIALOGEX_H__ #include "wrapengine.h" class wxDialogEx : public wxDialog, public CWrapEngine { public: bool Load(wxWindow *pParent, const wxString& name); bool SetLabel(int id, const wxString& label, unsigned long maxLength = 0); wxString GetLabel(int id); virtual int ShowModal(); bool ReplaceControl(wxWindow* old, wxWindow* wnd); static int ShownDialogs() { return m_shown_dialogs; } static bool CanShowPopupDialog(); protected: DECLARE_EVENT_TABLE() virtual void OnChar(wxKeyEvent& event); static int m_shown_dialogs; }; #endif //__DIALOGEX_H__
#ifndef TRANSLATOR_H_ #define TRANSLATOR_H_ extern int next_temp; extern int next_label; char *newtemp(); char *gen_expr(char * first_code, char * second_code, char ** lval, char * expr1, char * op, char * expr2); char *gen_assgnmnt(char *code, char *lval, char *rval); char *gen_if(char* expr_code, char* expr, char* if_statements, char* else_statements); char *gen_while(char* expr_code, char* expr, char* statements); char *concat(char* first_code, char *second_code); char *gen_goto(char * label); char *gen_cond_goto(char * label, char * expr); #endif
/* * ===================================================================================== * * Filename: dep_struct.h * * Description: * * Version: 1.0 * Created: 01/04/2014 06:00:37 PM * Revision: none * Compiler: gcc * * Author: vyouzhi (), vyouzhi@gmail.com * Organization: * * ===================================================================================== */ #ifndef DEP_STRUCT_H #define DEP_STRUCT_H #ifdef __cplusplus extern "C" { #endif #include <stdint.h> #include <pthread.h> #include <unistd.h> #include <sys/mman.h> #include "../config_global.h" #include "../parser/Expression.h" #include "../time_lib.h" struct __deposit { H_STATE flag; /* TRUE is busy, FALSE is empty */ ub1 *sm; /* malloc 1M only for insert update delete */ ub4 ss; /* start of pool malloc */ ub4 sp; /* now is read point */ ub4 se; /* point to the end*/ }; typedef struct __deposit DEPO; struct __mmposit { uint32 total; /* mmap for sa start mmap.meta.sa */ uint32 id; /* mmap for na start mmap.meta.na */ uint32 offset; /* mmap for sa data start mmap.db.0002 128*LIMIT_MMAP_BYTE */ uint32 uuid; /* mmap fro na data start mmap.db.0001 128*LIMIT_MMAP_BYTE */ /* void *mmdb_sa; mmap for sa data start mmap.db.0002 128*LIMIT_MMAP_BYTE void *mmdb_na; mmap fro na data start mmap.db.0001 128*LIMIT_MMAP_BYTE */ }; typedef struct __mmposit MMPO; struct __depstat { ub4 maxbyte; /* max byte for deposit */ H_STATE isfull; /* default H_FALSE , H_TRUE is full */ sb2 total; /* total >= count */ sb2 count; /* how much malloc depo sm */ sb2 sd; /* now start DEPO */ sb2 nd; /* now doing DEPO */ MMPO *pool_mmpo; /* for mmap 0 is sa, 1 is na */ H_USESTAT fe; /* the first deposit is free default H_USE , H_FREE is free */ H_STATE doing; /* H_TRUE one thread to do, H_FALSE none to do */ DEPO **pool_depo; }; typedef struct __depstat DEST; DEST *pools_dest; char pools_mmap[2]; pthread_mutex_t work_lock_depo; pthread_mutex_t work_lock_deps_do; #define DEPO_LOCK() do{\ pthread_mutex_lock(&work_lock_depo); \ }while(0) #define DEPO_UNLOCK() do{\ pthread_mutex_unlock(&work_lock_depo); \ }while(0) #define DEP_DO_LOCK() do{\ pthread_mutex_lock(&work_lock_deps_do); \ }while(0) #define DEP_DO_UNLOCK() do{\ pthread_mutex_unlock(&work_lock_deps_do); \ }while(0) void leadinit ( size_t byte ); int leadadd ( ub1 *key, ub4 keyl ); int leadpush ( DBP *_dbp ); DEPO *deposit_init ( ); #ifdef __cplusplus } #endif #endif /* --- #DEP_STRUCT_H ---*/ /* vim: set ts=4 sw=4: */
int selButton; GdkPixbuf *pix; GtkWidget *img; GtkAllocation allocation; cairo_surface_t *surface; cairo_t *cr; GError *pixbuf_error; void on_draw_event(GtkWidget *, cairo_t *, gpointer); void redraw(cairo_t *, gdouble, gdouble); void btn_destroyer_clicked(GtkWidget *, gpointer); void btn_submarine_clicked(GtkWidget *, gpointer); void btn_battleship_clicked(GtkWidget *, gpointer); void btn_cruiser_clicked(GtkWidget *, gpointer); void btn_carrier_clicked(GtkWidget *, gpointer); void btn_clear_clicked(GtkWidget *, gpointer); void btn_mouse_pressed(GtkWidget *, GdkEventButton *); void btn_mouse_released(GtkWidget *, GdkEventButton *); void txtfield_action(GtkWidget *, GdkEventKey *); void mouse_moved(GtkWidget *, GdkEventMotion *);
/* created by click/linuxmodule/fixincludes.pl on Tue Nov 25 22:39:38 2014 */ /* from /lib/modules/2.6.27.5-117.fc10.i686/build/include/linux/netpoll.h */ /* * Common code for low-level network console, dump, and debugger code * * Derived from netconsole, kgdb-over-ethernet, and netdump patches */ #ifndef _LINUX_NETPOLL_H #if defined(__cplusplus) && !CLICK_CXX_PROTECTED # error "missing #include <click/cxxprotect.h>" #endif #define _LINUX_NETPOLL_H #include <linux/netdevice.h> #include <linux/interrupt.h> #include <linux/rcupdate.h> #include <linux/list.h> struct netpoll { struct net_device *dev; char dev_name[IFNAMSIZ]; const char *name; void (*rx_hook)(struct netpoll *, int, char *, int); u32 local_ip, remote_ip; u16 local_port, remote_port; u8 remote_mac[ETH_ALEN]; }; struct netpoll_info { atomic_t refcnt; int rx_flags; spinlock_t rx_lock; struct netpoll *rx_np; /* netpoll that registered an rx_hook */ struct sk_buff_head arp_tx; /* list of arp requests to reply to */ struct sk_buff_head txq; struct delayed_work tx_work; }; void netpoll_poll(struct netpoll *np); void netpoll_send_udp(struct netpoll *np, const char *msg, int len); void netpoll_print_options(struct netpoll *np); int netpoll_parse_options(struct netpoll *np, char *opt); int netpoll_setup(struct netpoll *np); int netpoll_trap(void); void netpoll_set_trap(int trap); void netpoll_cleanup(struct netpoll *np); int __netpoll_rx(struct sk_buff *skb); #ifdef CONFIG_NETPOLL static inline int netpoll_rx(struct sk_buff *skb) { struct netpoll_info *npinfo = skb->dev->npinfo; unsigned long flags; int ret = 0; if (!npinfo || (!npinfo->rx_np && !npinfo->rx_flags)) return 0; spin_lock_irqsave(&npinfo->rx_lock, flags); /* check rx_flags again with the lock held */ if (npinfo->rx_flags && __netpoll_rx(skb)) ret = 1; spin_unlock_irqrestore(&npinfo->rx_lock, flags); return ret; } static inline int netpoll_receive_skb(struct sk_buff *skb) { if (!list_empty(&skb->dev->napi_list)) return netpoll_rx(skb); return 0; } static inline void *netpoll_poll_lock(struct napi_struct *napi) { struct net_device *dev = napi->dev; rcu_read_lock(); /* deal with race on ->npinfo */ if (dev && dev->npinfo) { spin_lock(&napi->poll_lock); napi->poll_owner = smp_processor_id(); return napi; } return NULL; } static inline void netpoll_poll_unlock(void *have) { struct napi_struct *napi = have; if (napi) { napi->poll_owner = -1; spin_unlock(&napi->poll_lock); } rcu_read_unlock(); } static inline void netpoll_netdev_init(struct net_device *dev) { INIT_LIST_HEAD(&dev->napi_list); } #else static inline int netpoll_rx(struct sk_buff *skb) { return 0; } static inline int netpoll_receive_skb(struct sk_buff *skb) { return 0; } static inline void *netpoll_poll_lock(struct napi_struct *napi) { return NULL; } static inline void netpoll_poll_unlock(void *have) { } static inline void netpoll_netdev_init(struct net_device *dev) { } #endif #endif
/* * DECnet An implementation of the DECnet protocol suite for the LINUX * operating system. DECnet is implemented using the BSD Socket * interface as the means of communication with the user level. * * DECnet Socket Timer Functions * * Author: Steve Whitehouse <SteveW@ACM.org> * * * Changes: * Steve Whitehouse : Made keepalive timer part of the same * timer idea. * Steve Whitehouse : Added checks for sk->sock_readers * David S. Miller : New socket locking * Steve Whitehouse : Timer grabs socket ref. */ #include <linux/net.h> #include <linux/socket.h> #include <linux/skbuff.h> #include <linux/netdevice.h> #include <linux/timer.h> #include <linux/spinlock.h> #include <net/sock.h> #include <linux/atomic.h> #include <net/flow.h> #include <net/dn.h> /* * Slow timer is for everything else (n * 500mS) */ #define SLOW_INTERVAL (HZ/2) static void dn_slow_timer(unsigned long arg); void dn_start_slow_timer(struct sock *sk) { setup_timer(&sk->sk_timer, dn_slow_timer, (unsigned long)sk); sk_reset_timer(sk, &sk->sk_timer, jiffies + SLOW_INTERVAL); } void dn_stop_slow_timer(struct sock *sk) { sk_stop_timer(sk, &sk->sk_timer); } static void dn_slow_timer(unsigned long arg) { struct sock *sk = (struct sock *)arg; struct dn_scp *scp = DN_SK(sk); bh_lock_sock(sk); if (sock_owned_by_user(sk)) { sk_reset_timer(sk, &sk->sk_timer, jiffies + HZ / 10); goto out; } /* * The persist timer is the standard slow timer used for retransmits * in both connection establishment and disconnection as well as * in the RUN state. The different states are catered for by changing * the function pointer in the socket. Setting the timer to a value * of zero turns it off. We allow the persist_fxn to turn the * timer off in a permant way by returning non-zero, so that * timer based routines may remove sockets. This is why we have a * sock_hold()/sock_put() around the timer to prevent the socket * going away in the middle. */ if (scp->persist && scp->persist_fxn) { if (scp->persist <= SLOW_INTERVAL) { scp->persist = 0; if (scp->persist_fxn(sk)) goto out; } else { scp->persist -= SLOW_INTERVAL; } } /* * Check for keepalive timeout. After the other timer 'cos if * the previous timer caused a retransmit, we don't need to * do this. scp->stamp is the last time that we sent a packet. * The keepalive function sends a link service packet to the * other end. If it remains unacknowledged, the standard * socket timers will eventually shut the socket down. Each * time we do this, scp->stamp will be updated, thus * we won't try and send another until scp->keepalive has passed * since the last successful transmission. */ if (scp->keepalive && scp->keepalive_fxn && (scp->state == DN_RUN)) { if ((jiffies - scp->stamp) >= scp->keepalive) scp->keepalive_fxn(sk); } sk_reset_timer(sk, &sk->sk_timer, jiffies + SLOW_INTERVAL); out: bh_unlock_sock(sk); sock_put(sk); }
/* Add subsystem definitions of the form SUBSYS(<name>) in this * file. Surround each one by a line of comment markers so that * patches don't collide */ /* */ /* */ #ifdef CONFIG_CPUSETS SUBSYS(cpuset) #endif /* */ #ifdef CONFIG_CGROUP_DEBUG SUBSYS(debug) #endif /* */ #ifdef CONFIG_CGROUP_SCHED SUBSYS(cpu_cgroup) #endif /* */ #ifdef CONFIG_CGROUP_CPUACCT SUBSYS(cpuacct) #endif /* */ #ifdef CONFIG_MEMCG SUBSYS(mem_cgroup) #endif /* */ #ifdef CONFIG_CGROUP_DEVICE SUBSYS(devices) #endif /* */ #ifdef CONFIG_CGROUP_FREEZER SUBSYS(freezer) #endif /* */ #ifdef CONFIG_NET_CLS_CGROUP SUBSYS(net_cls) #endif /* */ #ifdef CONFIG_BLK_CGROUP SUBSYS(blkio) #endif /* */ #ifdef CONFIG_CGROUP_PERF SUBSYS(perf) #endif /* */ #ifdef CONFIG_NETPRIO_CGROUP SUBSYS(net_prio) #endif /* */ #ifdef CONFIG_CGROUP_BFQIO SUBSYS(bfqio) #endif #ifdef CONFIG_CGROUP_HUGETLB SUBSYS(hugetlb) #endif /* */
/** * This header is generated by class-dump-z 0.2b. * * Source: /System/Library/PrivateFrameworks/OfficeImport.framework/OfficeImport */ #import <OfficeImport/OfficeImport-Structs.h> #import <OfficeImport/XXUnknownSuperclass.h> __attribute__((visibility("hidden"))) @interface WXFieldMarker : XXUnknownSuperclass { } + (void)readFrom:(xmlNode *)from to:(id)to; // 0x199b85 @end
/* * Copyright (C) 2011 Tobias Klauser <tklauser@distanz.ch> * Copyright (C) 2004 Microtronix Datacom Ltd. * * MMU support based on asm/page.h from mips which is: * * Copyright (C) 1994 - 1999, 2000, 03 Ralf Baechle * Copyright (C) 1999, 2000 Silicon Graphics, Inc. * * NOMMU support based on asm/page.h from m68knommu. * * This file is subject to the terms and conditions of the GNU General Public * License. See the file "COPYING" in the main directory of this archive * for more details. */ #ifndef _ASM_NIOS2_PAGE_H #define _ASM_NIOS2_PAGE_H #include <linux/pfn.h> /* * PAGE_SHIFT determines the page size */ #define PAGE_SHIFT 12 #define PAGE_SIZE 4096 #define PAGE_MASK (~(PAGE_SIZE - 1)) /* * PAGE_OFFSET -- the first address of the first page of memory. */ #define PAGE_OFFSET (CONFIG_MEM_BASE + CONFIG_KERNEL_REGION_BASE) #ifndef __ASSEMBLY__ /* * This gives the physical RAM offset. */ #define PHYS_OFFSET CONFIG_MEM_BASE /* * It's normally defined only for FLATMEM config but it's * used in our early mem init code for all memory models. * So always define it. */ #define ARCH_PFN_OFFSET PFN_UP(PHYS_OFFSET) #define clear_page(page) memset((page), 0, PAGE_SIZE) #define copy_page(to, from) memcpy((to), (from), PAGE_SIZE) struct page; extern void clear_user_page(void *addr, unsigned long vaddr, struct page *page); extern void copy_user_page(void *vto, void *vfrom, unsigned long vaddr, struct page *to); extern unsigned long shm_align_mask; /* * These are used to make use of C type-checking. */ typedef struct page *pgtable_t; typedef struct { unsigned long pte; } pte_t; typedef struct { unsigned long pgd; } pgd_t; typedef struct { unsigned long pgprot; } pgprot_t; #define pte_val(x) ((x).pte) #define pgd_val(x) ((x).pgd) #define pgprot_val(x) ((x).pgprot) #define __pte(x) ((pte_t) { (x) }) #define __pgd(x) ((pgd_t) { (x) }) #define __pgprot(x) ((pgprot_t) { (x) }) extern unsigned long memory_start; extern unsigned long memory_end; extern unsigned long memory_size; extern struct page *mem_map; #endif /* !__ASSEMBLY__ */ # define __pa(x) \ ((unsigned long)(x) - PAGE_OFFSET + PHYS_OFFSET) # define __va(x) \ ((void *)((unsigned long)(x) + PAGE_OFFSET - PHYS_OFFSET)) #define page_to_virt(page) \ ((((page) - mem_map) << PAGE_SHIFT) + PAGE_OFFSET) # define pfn_to_kaddr(pfn) __va((pfn) << PAGE_SHIFT) # define pfn_valid(pfn) ((pfn) >= ARCH_PFN_OFFSET && \ (pfn) < (max_mapnr + ARCH_PFN_OFFSET)) # define virt_to_page(vaddr) pfn_to_page(PFN_DOWN(virt_to_phys(vaddr))) # define virt_addr_valid(vaddr) pfn_valid(PFN_DOWN(virt_to_phys(vaddr))) # define VM_DATA_DEFAULT_FLAGS (VM_READ | VM_WRITE | VM_EXEC | \ VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC) # define UNCAC_ADDR(addr) \ ((void *)((unsigned)(addr) | CONFIG_IO_REGION_BASE)) # define CAC_ADDR(addr) \ ((void *)(((unsigned)(addr) & ~CONFIG_IO_REGION_BASE) | \ CONFIG_KERNEL_REGION_BASE)) #include <asm-generic/memory_model.h> #include <asm-generic/getorder.h> #endif /* _ASM_NIOS2_PAGE_H */
/*============================================================================= XMOTO This file is part of XMOTO. XMOTO 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. XMOTO 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 XMOTO; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA =============================================================================*/ #ifndef __BSP_H__ #define __BSP_H__ #include <glm/glm.hpp> #include <vector> class BSPLine { public: BSPLine(const glm::vec2 &i_p0, const glm::vec2 &i_p1); BSPLine(const BSPLine &i_line); ~BSPLine(); // public, for avoiding calls (perf) glm::vec2 P0, P1; /* Line */ glm::vec2 Normal; /* Linenormal (meaningless, but hey :P)*/ private: void computeNormal(); }; class BSPPoly { public: BSPPoly(); BSPPoly(const BSPPoly &i_poly); ~BSPPoly(); std::vector<glm::vec2> &Vertices(); void addVertice(const glm::vec2 &i_vertice); void addVerticesOf(const BSPPoly *i_poly); private: std::vector<glm::vec2> m_vertices; }; class BSP { public: BSP(); ~BSP(); int getNumErrors(); void addLineDefinition(const glm::vec2 &i_p0, const glm::vec2 &i_p1); /* build some polygons ; don't delete the result, it's in memory in the class * BSP */ std::vector<BSPPoly *> *compute(); private: int m_nNumErrors; /* Number of errors found */ std::vector<BSPLine *> m_lines; /* Input data set */ std::vector<BSPPoly *> m_polys; /* Output data set */ void recurse(BSPPoly *pSubSpace, std::vector<BSPLine *> &Lines); BSPLine *findBestSplitter(std::vector<BSPLine *> &i_lines); /* if bProbe is true, pnNumFront, pnNumBack and pnNumSplits must not be NULL * to be filled AND Front and Back will not be filled */ void splitLines(std::vector<BSPLine *> &Lines, std::vector<BSPLine *> &Front, std::vector<BSPLine *> &Back, BSPLine *pLine, bool bProbe = false, int *pnNumFront = NULL, int *pnNumBack = NULL, int *pnNumSplits = NULL); void splitPoly(BSPPoly *pPoly, BSPPoly *pFront, BSPPoly *pBack, BSPLine *pLine); }; #endif
//fontttf.h #ifndef FONTTTF_H #define FONTTTF_H #include <SDL.h> #include <SDL_ttf.h> //for TTF_ functions #include <string> #include "surface.h" class FontTTF { public: FontTTF(); FontTTF(std::string fileName, int size); ~FontTTF(); bool load(std::string fontName, int size); int put_text(Surface *s, int x, int y, const char *textstr, const SDL_Color &textColour, bool bShadow = false); int put_text(Surface *s, int y, const char *textstr, const SDL_Color &textColour, bool bShadow = false); int put_text_right(Surface *s, int y, const char *textstr, const SDL_Color &textColour, bool bShadow = false); int put_number(Surface *s, int x, int y, unsigned int number, const char *format, const SDL_Color &textColor, bool bShadow = false); int put_number(Surface *s, int y, unsigned int number, const char *format, const SDL_Color &textColor, bool bShadow = false); void setShadowColour(SDL_Color &c); protected: void cleanUp(); private: TTF_Font * _font; int _size; bool _init; SDL_Color _shadow; //font shadow colour char _buffer[100]; //general purpose char buffer (for number formatting etc) }; #endif //FONTTTF_H
#ifndef COMMODITYDIALOG_H #define COMMODITYDIALOG_H #include <QModelIndex> #include <QDoubleValidator> #include <QDataWidgetMapper> #include "SettingsDialog.h" namespace Ui { class CommodityDialog; } /** * @brief * */ class CommodityDialog: public QDialog { Q_OBJECT public: /** * @brief * * @param parent * @param db * @param id_edit */ CommodityDialog(QWidget *parent, Database *db, const QModelIndex &id_edit = QModelIndex()); /** * @brief * */ virtual ~CommodityDialog(); protected slots: /** * @brief * */ void okClick(); /** * @brief * */ void pkwiuGet(); /** * @brief * * @param suffix */ void addSuffix(const QString &suffix); void servicesCantBeCounted(const QString &name); private: /** * @brief * */ void init_(); protected: Ui::CommodityDialog *ui; Database *db; /**< TODO */ QDataWidgetMapper mapper; /**< TODO */ QDoubleValidator validator; /**< TODO */ }; #endif
//************************************************************************** // Código del usuario // // Francisco Javier Bolívar Lupiáñez //************************************************************************** #include <GL/gl.h> #include <vector> #include "vertex.h" using namespace std; void dibujar_ajedrez(const vector<_vertex3f> &Vertices, const vector<_vertex3i> &Triangulos); void dibujar_solido(const vector<_vertex3f> &Vertices, const vector<_vertex3i> &Triangulos); void dibujar_solido2(const vector<_vertex3f> &Vertices, const vector<_vertex3i> &Triangulos); void dibujar_alambre(const vector<_vertex3f> &Vertices, const vector<_vertex3i> &Triangulos); void dibujar_puntos(const vector<_vertex3f> &Vertices); void model_cubo(vector<_vertex3f> &v, vector<_vertex3i> &t); void model_tetraedro(vector<_vertex3f> &v, vector<_vertex3i> &t); void model_ply(const char *file_name, vector<_vertex3f> &v, vector<_vertex3i> &t); void model_ply2(const char *file_name, vector<_vertex3f> &v, vector<_vertex3i> &t); void model_ply_vertices(const char *file_name, vector<_vertex3f> &v); void barrido_circular_basico(const vector<_vertex3f> &puntos, const unsigned int &n, vector<_vertex3f> &v, vector<_vertex3i> &t); void barrido_circular(const vector<_vertex3f> &puntos, const unsigned int &n, vector<_vertex3f> &v, vector<_vertex3i> &t);
/*************************************************************************** qgsgrassplugin.h - GRASS menu ------------------- begin : March, 2004 copyright : (C) 2004 by Radim Blazek email : blazek@itc.it ***************************************************************************/ /*************************************************************************** * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * ***************************************************************************/ #ifndef QGSGRASSPLUGIN_H #define QGSGRASSPLUGIN_H #include "../qgisplugin.h" #include "qgscoordinatereferencesystem.h" #include "qgscoordinatetransform.h" #include "qgsvectorlayer.h" #include <QObject> class QgsGrassTools; class QgsGrassNewMapset; class QgsGrassRegion; class QgsMapCanvas; class QgsMapLayer; class QgsMapTool; class QgsRubberBand; class QAction; class QIcon; class QPainter; class QToolBar; /** * \class QgsGrassPlugin * \brief OpenModeller plugin for QGIS * */ class QgsGrassPlugin : public QObject, public QgisPlugin { Q_OBJECT public: /** * Constructor for a plugin. The QgisInterface pointer is passed by * QGIS when it attempts to instantiate the plugin. * @param qI Pointer to the QgisInterface object. */ explicit QgsGrassPlugin( QgisInterface *qI ); /** * Virtual function to return the name of the plugin. The name will be used when presenting a list * of installable plugins to the user */ virtual QString name(); /** * Virtual function to return the version of the plugin. */ virtual QString version(); /** * Virtual function to return a description of the plugins functions */ virtual QString description(); /** * Virtual function to return a category of the plugin */ virtual QString category(); /** * Return the plugin type */ virtual int type(); virtual ~QgsGrassPlugin(); //! Get an icon from the active theme if possible static QIcon getThemeIcon( const QString &name ); public slots: //! init the gui virtual void initGui() override; //! unload the plugin void unload() override; //! show the help document void help(); //! Gisbase changed by user void onGisbaseChanged(); //! Display current region void displayRegion(); //! Switch region on/off void switchRegion( bool on ); //! Redraw region void redrawRegion( void ); //! Post render void postRender( QPainter * ); //! Open tools void openTools( void ); //! Create new mapset void newMapset(); //! Open existing mapset and save it to project void openMapset(); //! Close mapset and save it to project void closeMapset(); //! Current mapset changed (opened/closed) void mapsetChanged(); //! Create new vector void newVector(); //! Read project void projectRead(); //! New project void newProject(); //! update plugin icons when the app tells us its theme is changed void setCurrentTheme( QString themeName ); void setTransform(); //! Called when a new layer was added to map registry void onLayerWasAdded( QgsMapLayer *mapLayer ); //! Called when editing of a layer started void onEditingStarted(); void onEditingStopped(); void onCurrentLayerChanged( QgsMapLayer *layer ); void onFieldsChanged(); // Start editing tools void addFeature(); void onSplitFeaturesTriggered( bool checked ); // Called when new layer was created in browser void onNewLayer( QString uri, QString name ); private: void resetEditActions(); //! Pointer to our toolbar QToolBar *mToolBarPointer = nullptr; //! Pointer to the QGIS interface object QgisInterface *qGisInterface = nullptr; //! Pointer to canvas QgsMapCanvas *mCanvas = nullptr; //! Pointer to Display region acction QAction *mRegionAction = nullptr; // Region rubber band QgsRubberBand *mRegionBand = nullptr; //! GRASS tools QgsGrassTools *mTools = nullptr; //! Pointer to QgsGrassNewMapset QgsGrassNewMapset *mNewMapset = nullptr; QgsCoordinateReferenceSystem mCrs; QgsCoordinateTransform mCoordinateTransform; // Actions QAction *mOpenMapsetAction = nullptr; QAction *mNewMapsetAction = nullptr; QAction *mCloseMapsetAction = nullptr; QAction *mOpenToolsAction = nullptr; QAction *mOptionsAction = nullptr; // Editing static bool mNonInitializable; QAction *mAddFeatureAction = nullptr; QAction *mAddPointAction = nullptr; QAction *mAddLineAction = nullptr; QAction *mAddBoundaryAction = nullptr; QAction *mAddCentroidAction = nullptr; QAction *mAddAreaAction = nullptr; QgsMapTool *mAddPoint = nullptr; QgsMapTool *mAddLine = nullptr; QgsMapTool *mAddBoundary = nullptr; QgsMapTool *mAddCentroid = nullptr; QgsMapTool *mAddArea = nullptr; // Names of layer styles before editing started QMap<QgsVectorLayer *, QString> mOldStyles; // Original layer form suppress QMap<QgsVectorLayer *, QgsEditFormConfig::FeatureFormSuppress> mFormSuppress; }; #endif // QGSGRASSPLUGIN_H
/* ad.c - audio decoder interface */ #include <stdio.h> #include <stdlib.h> #include <string.h> #include "config.h" #include "stream/stream.h" #include "libmpdemux/demuxer.h" #include "libmpdemux/stheader.h" #include "ad.h" /* Missed vorbis, mad, dshow */ //extern ad_functions_t mpcodecs_ad_null; extern ad_functions_t mpcodecs_ad_mp3lib; extern ad_functions_t mpcodecs_ad_ffmpeg; extern ad_functions_t mpcodecs_ad_liba52; extern ad_functions_t mpcodecs_ad_hwac3; extern ad_functions_t mpcodecs_ad_hwmpa; extern ad_functions_t mpcodecs_ad_pcm; extern ad_functions_t mpcodecs_ad_dvdpcm; extern ad_functions_t mpcodecs_ad_alaw; extern ad_functions_t mpcodecs_ad_imaadpcm; extern ad_functions_t mpcodecs_ad_msadpcm; extern ad_functions_t mpcodecs_ad_dk3adpcm; extern ad_functions_t mpcodecs_ad_dk4adpcm; extern ad_functions_t mpcodecs_ad_dshow; extern ad_functions_t mpcodecs_ad_dmo; extern ad_functions_t mpcodecs_ad_acm; extern ad_functions_t mpcodecs_ad_msgsm; extern ad_functions_t mpcodecs_ad_faad; extern ad_functions_t mpcodecs_ad_libvorbis; extern ad_functions_t mpcodecs_ad_speex; extern ad_functions_t mpcodecs_ad_libmad; extern ad_functions_t mpcodecs_ad_realaud; extern ad_functions_t mpcodecs_ad_libdv; extern ad_functions_t mpcodecs_ad_qtaudio; extern ad_functions_t mpcodecs_ad_twin; extern ad_functions_t mpcodecs_ad_libmusepack; extern ad_functions_t mpcodecs_ad_libdca; extern ad_functions_t mpcodecs_ad_libwma; ad_functions_t* mpcodecs_ad_drivers[] = { // &mpcodecs_ad_null, #ifdef USE_MP3LIB &mpcodecs_ad_mp3lib, #endif #ifdef USE_LIBA52 &mpcodecs_ad_liba52, &mpcodecs_ad_hwac3, #endif &mpcodecs_ad_hwmpa, #ifdef USE_LIBAVCODEC &mpcodecs_ad_ffmpeg, #endif &mpcodecs_ad_pcm, &mpcodecs_ad_dvdpcm, &mpcodecs_ad_alaw, &mpcodecs_ad_imaadpcm, &mpcodecs_ad_msadpcm, &mpcodecs_ad_dk3adpcm, &mpcodecs_ad_msgsm, #ifdef USE_WIN32DLL &mpcodecs_ad_dshow, &mpcodecs_ad_dmo, &mpcodecs_ad_acm, &mpcodecs_ad_twin, #endif #if defined(USE_QTX_CODECS) || defined(MACOSX) &mpcodecs_ad_qtaudio, #endif #ifdef HAVE_FAAD &mpcodecs_ad_faad, #endif #ifdef HAVE_OGGVORBIS &mpcodecs_ad_libvorbis, #endif #ifdef HAVE_SPEEX &mpcodecs_ad_speex, #endif #ifdef USE_LIBMAD &mpcodecs_ad_libmad, #endif #ifdef USE_REALCODECS &mpcodecs_ad_realaud, #endif #ifdef HAVE_LIBDV095 &mpcodecs_ad_libdv, #endif #ifdef HAVE_MUSEPACK &mpcodecs_ad_libmusepack, #endif #ifdef USE_LIBDCA &mpcodecs_ad_libdca, #endif #ifdef HAVE_LIBWMA &mpcodecs_ad_libwma, #endif NULL };
/* * @(#) $Id$ * Copyright (C) 2014-2016 David Necas (Yeti). * E-mail: yeti@gwyddion.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 __GWY_APP_LOG_H__ #define __GWY_APP_LOG_H__ #include <gtk/gtk.h> #include <libgwyddion/gwycontainer.h> #include <libgwyddion/gwystringlist.h> G_BEGIN_DECLS void gwy_app_channel_log_add (GwyContainer *data, gint previd, gint newid, const gchar *function, ...); void gwy_app_volume_log_add (GwyContainer *data, gint previd, gint newid, const gchar *function, ...); void gwy_app_xyz_log_add (GwyContainer *data, gint previd, gint newid, const gchar *function, ...); void gwy_app_channel_log_add_proc (GwyContainer *data, gint previd, gint newid); void gwy_app_volume_log_add_volume (GwyContainer *data, gint previd, gint newid); void gwy_app_xyz_log_add_xyz (GwyContainer *data, gint previd, gint newid); GtkWidget* gwy_app_log_browser_for_channel(GwyContainer *data, gint id); GtkWidget* gwy_app_log_browser_for_volume (GwyContainer *data, gint id); GtkWidget* gwy_app_log_browser_for_xyz (GwyContainer *data, gint id); gboolean gwy_log_get_enabled (void); void gwy_log_set_enabled (gboolean setting); G_END_DECLS #endif /* __GWY_APP_LOG_H__ */ /* vim: set cin et ts=4 sw=4 cino=>1s,e0,n0,f0,{0,}0,^0,\:1s,=0,g1s,h0,t0,+1s,c3,(0,u0 : */
/* $Id: perfctr.h,v 1.95 2005/10/02 13:01:30 mikpe Exp $ * Performance-Monitoring Counters driver * * Copyright (C) 1999-2005 Mikael Pettersson */ #ifndef _LINUX_PERFCTR_H #define _LINUX_PERFCTR_H #ifdef CONFIG_PERFCTR /* don't break archs without <asm/perfctr.h> */ #include <asm/perfctr.h> /* cpu_features flag bits */ #define PERFCTR_FEATURE_RDPMC 0x01 #define PERFCTR_FEATURE_RDTSC 0x02 #define PERFCTR_FEATURE_PCINT 0x04 /* virtual perfctr control object */ struct vperfctr_control { __s32 si_signo; __u32 preserve; }; /* commands for sys_vperfctr_control() */ #define VPERFCTR_CONTROL_UNLINK 0x01 #define VPERFCTR_CONTROL_SUSPEND 0x02 #define VPERFCTR_CONTROL_RESUME 0x03 #define VPERFCTR_CONTROL_CLEAR 0x04 /* common description of an arch-specific control register */ struct perfctr_cpu_reg { __u64 nr; __u64 value; }; /* state and control domain numbers 0-127 are for architecture-neutral domains 128-255 are for architecture-specific domains */ #define VPERFCTR_DOMAIN_SUM 1 /* struct perfctr_sum_ctrs */ #define VPERFCTR_DOMAIN_CONTROL 2 /* struct vperfctr_control */ #define VPERFCTR_DOMAIN_CHILDREN 3 /* struct perfctr_sum_ctrs */ /* domain numbers for common arch-specific control data */ #define PERFCTR_DOMAIN_CPU_CONTROL 128 /* struct perfctr_cpu_control_header */ #define PERFCTR_DOMAIN_CPU_MAP 129 /* __u32[] */ #define PERFCTR_DOMAIN_CPU_REGS 130 /* struct perfctr_cpu_reg[] */ #endif /* CONFIG_PERFCTR */ #ifdef __KERNEL__ /* * The perfctr system calls. */ #if 0 asmlinkage long sys_vperfctr_open(int tid, int creat); asmlinkage long sys_vperfctr_control(int fd, unsigned int cmd); asmlinkage long sys_vperfctr_write(int fd, unsigned int domain, const void __user *argp, unsigned int argbytes); asmlinkage long sys_vperfctr_read(int fd, unsigned int domain, void __user *argp, unsigned int argbytes); #else asmlinkage long sys_vperfctr_init(); asmlinkage long sys_vperfctr_control(unsigned int cmd); asmlinkage long sys_vperfctr_write(unsigned int domain, const void __user *argp, unsigned int argbytes); asmlinkage long sys_vperfctr_read(unsigned int domain, void __user *argp, unsigned int argbytes); #endif struct perfctr_info { unsigned int cpu_features; unsigned int cpu_khz; unsigned int tsc_to_cpu_mult; }; extern struct perfctr_info perfctr_info; #ifdef CONFIG_PERFCTR_VIRTUAL /* * Virtual per-process performance-monitoring counters. */ struct vperfctr; /* opaque */ /* process management operations */ extern void __vperfctr_copy(struct task_struct*, struct pt_regs*); extern void __vperfctr_release(struct task_struct*); extern void __vperfctr_exit(struct vperfctr*); extern void __vperfctr_suspend(struct vperfctr*); extern void __vperfctr_resume(struct vperfctr*); extern void __vperfctr_sample(struct vperfctr*); extern void __vperfctr_set_cpus_allowed(struct task_struct*, struct vperfctr*, cpumask_t); static inline void perfctr_copy_task(struct task_struct *tsk, struct pt_regs *regs) { if (tsk->arch.thread.perfctr) __vperfctr_copy(tsk, regs); } static inline void perfctr_release_task(struct task_struct *tsk) { if (tsk->arch.thread.perfctr) __vperfctr_release(tsk); } static inline void perfctr_exit_thread(struct thread_struct *thread) { struct vperfctr *perfctr; perfctr = thread->perfctr; if (perfctr) __vperfctr_exit(perfctr); } static inline void perfctr_suspend_thread(struct thread_struct *prev) { struct vperfctr *perfctr; perfctr = prev->perfctr; if (perfctr) __vperfctr_suspend(perfctr); } static inline void perfctr_resume_thread(struct thread_struct *next) { struct vperfctr *perfctr; perfctr = next->perfctr; if (perfctr) __vperfctr_resume(perfctr); } static inline void perfctr_sample_thread(struct thread_struct *thread) { struct vperfctr *perfctr; perfctr = thread->perfctr; if (perfctr) __vperfctr_sample(perfctr); } static inline void perfctr_set_cpus_allowed(struct task_struct *p, cpumask_t new_mask) { #ifdef CONFIG_PERFCTR_CPUS_FORBIDDEN_MASK struct vperfctr *perfctr; //task_lock(p); perfctr = p->arch.thread.perfctr; if (perfctr) __vperfctr_set_cpus_allowed(p, perfctr, new_mask); //task_unlock(p); #endif } #else /* !CONFIG_PERFCTR_VIRTUAL */ static inline void perfctr_copy_task(struct task_struct *p, struct pt_regs *r) { } static inline void perfctr_release_task(struct task_struct *p) { } static inline void perfctr_exit_thread(struct thread_struct *t) { } static inline void perfctr_suspend_thread(struct thread_struct *t) { } static inline void perfctr_resume_thread(struct thread_struct *t) { } static inline void perfctr_sample_thread(struct thread_struct *t) { } static inline void perfctr_set_cpus_allowed(struct task_struct *p, cpumask_t m) { } #endif /* CONFIG_PERFCTR_VIRTUAL */ /* These routines are identical to write_seqcount_begin() and * write_seqcount_end(), except they take an explicit __u32 rather * than a seqcount_t. That's because this sequence lock is user from * userspace, so we have to pin down the counter's type explicitly to * have a clear ABI. They also omit the SMP write barriers since we * only support mmap() based sampling for self-monitoring tasks. */ static inline void write_perfseq_begin(__u32 *seq) { ++*seq; } static inline void write_perfseq_end(__u32 *seq) { ++*seq; } #endif /* __KERNEL__ */ #endif /* _LINUX_PERFCTR_H */
#pragma once // SPDX-License-Identifier: GPL-2.0-or-later // Copyright (C) 2019 The MMapper Authors // Author: Ulf Hermann <ulfonk_mennhar@gmx.de> (Alve) // Author: Marek Krejza <krejza@gmail.com> (Caligor) #include <memory> #include "../expandoracommon/parseevent.h" #include "experimenting.h" class ParseEvent; class Path; class Room; class RoomAdmin; class RoomSignalHandler; struct PathParameters; class OneByOne final : public Experimenting { public: explicit OneByOne(const SigParseEvent &sigParseEvent, PathParameters &in_params, RoomSignalHandler *handler); void receiveRoom(RoomAdmin *admin, const Room *room) override; void addPath(std::shared_ptr<Path> path); private: SharedParseEvent event; RoomSignalHandler *handler = nullptr; };
/* * Copyright (C) 2000 Matthias Elter <elter@kde.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 __basictab_h__ #define __basictab_h__ #include <qwidget.h> #include <qstring.h> #include <klineedit.h> class KKeyButton; class KLineEdit; class KIconButton; class QCheckBox; class QGroupBox; class QLabel; class KURLRequester; class KComboBox; class KService; class MenuFolderInfo; class MenuEntryInfo; class BasicTab : public QWidget { Q_OBJECT public: BasicTab(QWidget *parent = 0, const char *name = 0); void apply(); signals: void changed(MenuFolderInfo *); void changed(MenuEntryInfo *); void findServiceShortcut(const KShortcut &, KService::Ptr &); public slots: void setFolderInfo(MenuFolderInfo *folderInfo); void setEntryInfo(MenuEntryInfo *entryInfo); void slotDisableAction(); protected slots: void slotChanged(); void launchcb_clicked(); void systraycb_clicked(); void termcb_clicked(); void uidcb_clicked(); void slotCapturedShortcut(const KShortcut &); void slotExecSelected(); protected: void enableWidgets(bool isDF, bool isDeleted); protected: KLineEdit *_nameEdit, *_commentEdit; KLineEdit *_descriptionEdit; KKeyButton *_keyEdit; KURLRequester *_execEdit, *_pathEdit; KLineEdit *_termOptEdit, *_uidEdit; QCheckBox *_terminalCB, *_uidCB, *_launchCB, *_systrayCB; KIconButton *_iconButton; QGroupBox *_path_group, *_term_group, *_uid_group, *general_group_keybind; QLabel *_termOptLabel, *_uidLabel, *_pathLabel, *_nameLabel, *_commentLabel, *_execLabel; QLabel *_descriptionLabel; MenuFolderInfo *_menuFolderInfo; MenuEntryInfo *_menuEntryInfo; bool _isDeleted; }; #endif
/* * c't-Bot * * 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. * */ /*! * @file behaviour_turn_test.c * @brief Fuehrt mehrere Drehungen mit bot_turn() aus und misst die Fehler * @author Timo Sandmann * @date 08.07.2007 */ #include "bot-logic/bot-logic.h" #ifdef BEHAVIOUR_TURN_TEST_AVAILABLE #include <math.h> #include "sensor.h" #include "log.h" #include "eeprom.h" //#define FLOAT_PRINTF /*!< aktiviert float-Ausgaben mit printf ("-Wl,-u,vfprintf -lprintf_flt") */ static uint16_t degrees = 0; static uint8_t turn_count = 0; extern uint8_t EEPROM turn_err[3]; /*! * Das eigentliche Verhalten * @param data Zeiger auf den Verhaltensdatensatz * @see bot_turn_test() */ void bot_turn_test_behaviour(Behaviour_t * data) { static float err = 0.f; if (degrees > 0) { if (turn_count < 10) { if (turn_count > 0) { err += turn_last_err; // LOG_DEBUG("heading=%f Grad", heading); // LOG_DEBUG("Fehler=%f Grad", turn_last_err); } bot_turn(data, (int16_t) degrees); turn_count++; } else { err += turn_last_err; // LOG_DEBUG("heading=%f", heading); // LOG_DEBUG("Fehler=%f Grad", turn_last_err); #ifdef FLOAT_PRINTF LOG_DEBUG("durchschn. Fehler=%f Grad", err/10.f); #else LOG_DEBUG("durchschn. Fehler=%d.%u Grad", (int16_t)(err/10.f), (int16_t)((err/10.f - (int16_t)(err/10.f))*10)); #endif LOG_DEBUG("degrees=%d: turn_err[]={%d,%d,%d}", degrees, ctbot_eeprom_read_byte(&turn_err[0]), ctbot_eeprom_read_byte(&turn_err[1]), ctbot_eeprom_read_byte(&turn_err[2])); turn_count = 0; err = 0.f; degrees -= 5; if (degrees > 60) degrees -= 15; LOG_DEBUG("degress=%d", degrees); } } else { err = 0.f; return_from_behaviour(data); } } /*! * Testet das bot_turn-Verhalten und gibt Informationen ueber die Drehgenauigkeit aus * @param caller Zeiger auf den Verhaltensdatensatz des Aufrufers */ void bot_turn_test(Behaviour_t * caller) { switch_to_behaviour(caller, bot_turn_test_behaviour, BEHAVIOUR_NOOVERRIDE); degrees = 360; turn_count = 0; } #endif // BEHAVIOUR_TURN_TEST_AVAILABLE
/* * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * Written (W) 2012 Fernando José Iglesias García * Copyright (C) 2012 Fernando José Iglesias García */ #ifndef _KERNEL_STRUCTURED_OUTPUT_MACHINE__H__ #define _KERNEL_STRUCTURED_OUTPUT_MACHINE__H__ #include <shogun/machine/StructuredOutputMachine.h> #include <shogun/kernel/Kernel.h> namespace shogun { /** TODO doc */ class CKernelStructuredOutputMachine : public CStructuredOutputMachine { public: /** default constructor */ CKernelStructuredOutputMachine(); /** standard constructor * * @param model structured model with application specific functions * @param loss loss function * @param labs structured labels * @param kernel kernel */ CKernelStructuredOutputMachine(CStructuredModel* model, CLossFunction* loss, CStructuredLabels* labs, CKernel* kernel); /** destructor */ virtual ~CKernelStructuredOutputMachine(); /** set kernel * * @param f kernel */ void set_kernel(CKernel* f); /** get kernel * * @return kernel */ CKernel* get_kernel() const; /** @return object name */ inline virtual const char* get_name() const { return "KernelStructuredOutputMachine"; } private: /** register class members */ void register_parameters(); protected: /** kernel */ CKernel* m_kernel; }; /* class CKernelStructuredOutputMachine */ } /* namespace shogun */ #endif /* _KERNEL_STRUCTURED_OUTPUT_MACHINE__H__ */
#ifndef _OV9724_H_ #define _OV9724_H_ int ov9724_read(struct v4l2_subdev *sd, unsigned short reg, unsigned char *value); #endif
/* * $Id: xlate.h,v 1.12 2003/11/17 21:51:09 spoel Exp $ * * This source code is part of * * G R O M A C S * * GROningen MAchine for Chemical Simulations * * VERSION 3.2.0 * Written by David van der Spoel, Erik Lindahl, Berk Hess, and others. * Copyright (c) 1991-2000, University of Groningen, The Netherlands. * Copyright (c) 2001-2004, The GROMACS development team, * check out http://www.gromacs.org for more information. * 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. * * If you want to redistribute modifications, please consider that * scientific software is very special. Version control is crucial - * bugs must be traceable. We will be happy to consider code for * inclusion in the official distribution, but derived work must not * be called official GROMACS. Details are found in the README & COPYING * files - if they are missing, get the official version at www.gromacs.org. * * To help us fund GROMACS development, we humbly ask that you cite * the papers on the package - you can find them in the top README file. * * For more info, check our website at http://www.gromacs.org * * And Hey: * Gallium Rubidium Oxygen Manganese Argon Carbon Silicon */ #ifndef _xlate_h #define _xlate_h #include "index.h" extern void rename_atoms(t_atoms *atoms,t_symtab *symtab,t_aa_names *aan); #endif
#include "bsp_icc.h" #include "osl_common.h" #include "uart.h" #include "gpio.h" #include "drv_nv_id.h" #include "drv_nv_def.h" #include "bsp_nvim.h" #define VIA_WAKEUP_BALONG_PIN GPIO_26_3 #define LPm3_UART5_IQR_ENABLE (0xaa) #define VIA_WAKEUP_BALONG (0x01) #define dm_print_info(fmt, ...) (printk(""fmt"\n", ##__VA_ARGS__)) #define UART_SWITCH_ENABLE (1) #define DUAL_MODEM_CCORE_RESET_TRUE (1) __ao_data u32 uart_init_flag = 0; void bsp_dual_modem_disable_cb(void) { uart_init_flag = 0; } /***************************************************************************** º¯ Êý Ãû : via_wakeup_balong_handler ¹¦ÄÜÃèÊö : gpioÖжϴ¦Àíº¯Êý£¬·¢ËÍicc¸ømodem ÊäÈë²ÎÊý : Êä³ö²ÎÊý : ·µ »Ø Öµ : void *****************************************************************************/ void via_wakeup_balong_handler(u32 gpio_no) { u8 flag = VIA_WAKEUP_BALONG; if(uart_init_flag == LPm3_UART5_IQR_ENABLE) { bsp_icc_send((u32)ICC_CPU_MODEM,(ICC_CHN_MCORE_CCORE << 16)|MCORE_CCORE_FUNC_UART,&flag,sizeof(flag)); } } /***************************************************************************** º¯ Êý Ãû : recv_modem_rsg_by_icc ¹¦ÄÜÃèÊö : modem·¢ËÍicc£¬ap²à¿ØÖÆgpio»½ÐѶԷ½modem ÊäÈë²ÎÊý : Êä³ö²ÎÊý : ÎÞ ·µ »Ø Öµ : void *****************************************************************************/ int recv_modem_rsg_by_icc(u32 chan_id, u32 len, void* context) { s32 read_size = 0; u8 flag = 0; context = context; //·ÀÖ¹±àÒë¸æ¾¯ read_size = bsp_icc_read((ICC_CHN_MCORE_CCORE << 16)|MCORE_CCORE_FUNC_UART, &flag, len); if ((read_size > (s32)len) && (read_size <= 0)) { return -1; } if(flag == LPm3_UART5_IQR_ENABLE) { #ifdef UART5_IRQ_NOTIFY_MODEM uart5_init(); #endif uart_init_flag = LPm3_UART5_IQR_ENABLE; bsp_icc_send((u32)ICC_CPU_MODEM,(ICC_CHN_MCORE_CCORE << 16)|MCORE_CCORE_FUNC_UART,&flag,sizeof(flag)); } return 0; } /***************************************************************************** º¯ Êý Ãû : wakeup_modem_init ¹¦ÄÜÃèÊö : ap²àgpio³õʼ»¯ ÊäÈë²ÎÊý : Êä³ö²ÎÊý : ·µ »Ø Öµ : 0:³É¹¦£¬-1:ʧ°Ü *****************************************************************************/ int wakeup_modem_init(void) { unsigned int retVal = 0; int ret = 0; DRV_DUAL_MODEM_STR dual_modem_lpm3_nv; /* first init should read nv */ // if(get_modem_init_flag() != MODEM_ALREADY_INIT_MAGIC) { memset((void*)&dual_modem_lpm3_nv,0,sizeof(DRV_DUAL_MODEM_STR)); retVal =bsp_nvm_read(NV_ID_DRV_DUAL_MODEM,(u8 *)&dual_modem_lpm3_nv,sizeof(DRV_DUAL_MODEM_STR)); if(retVal != OK) { dm_print_info("dm ERR:%d\n",NV_ID_DRV_DUAL_MODEM); return -1; } } if(UART_SWITCH_ENABLE == dual_modem_lpm3_nv.enUartEnableCfg) { if(0 !=bsp_icc_event_register((ICC_CHN_MCORE_CCORE << 16)|MCORE_CCORE_FUNC_UART,recv_modem_rsg_by_icc , NULL, NULL, NULL)) { printk("reg icc cb err\n"); return -1; } gpio_set_direction(VIA_WAKEUP_BALONG_PIN,0); ret = gpio_irq_request(VIA_WAKEUP_BALONG_PIN,via_wakeup_balong_handler,IRQ_TYPE_EDGE_FALLING|IRQF_AWAKE); if(ret < 0) { printk("g-irq err\n"); return -1; } } return 0; }
#ifndef _BOOL_H_ #define _BOOL_H_ #ifndef TRUE #define TRUE 1 #endif #ifndef FALSE #define FALSE 0 #endif #endif
/*************************************************************************************** * Genesis Plus * * Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003 Charles Mac Donald (original code) * Eke-Eke (2007,2008,2009), additional code & fixes for the GCN/Wii port * * 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 * * Sound Hardware ****************************************************************************************/ #ifndef _SOUND_H_ #define _SOUND_H_ /* Function prototypes */ extern void sound_init(void); extern void sound_reset(void); extern void sound_restore(void); extern int sound_context_save(uint8 *state); extern int sound_context_load(uint8 *state, char *version, bool hasExcessYM2612Data, unsigned ptrSize); extern int sound_update(unsigned int cycles); extern void fm_reset(unsigned int cycles); extern void fm_write(unsigned int cycles, unsigned int address, unsigned int data); extern unsigned int fm_read(unsigned int cycles, unsigned int address); extern void psg_write(unsigned int cycles, unsigned int data); #endif /* _SOUND_H_ */
#ifndef KEYBOARD_H #define KEYBOARD_H #include <SDL.h> void KeyboardInit(); // return true for magic quit event (meta + esc) bool ProcessKeyEvent(SDL_KeyboardEvent* key); #endif
/* Copyright (C) 2018 Magnus Lång and Tuan Phong Ngo * This benchmark is part of SWSC */ #include <assert.h> #include <stdint.h> #include <stdatomic.h> #include <pthread.h> atomic_int vars[4]; atomic_int atom_1_r1_1; atomic_int atom_2_r1_1; atomic_int atom_2_r8_0; void *t0(void *arg){ label_1:; atomic_store_explicit(&vars[0], 1, memory_order_seq_cst); atomic_store_explicit(&vars[1], 1, memory_order_seq_cst); return NULL; } void *t1(void *arg){ label_2:; int v2_r1 = atomic_load_explicit(&vars[1], memory_order_seq_cst); atomic_store_explicit(&vars[2], 1, memory_order_seq_cst); int v20 = (v2_r1 == 1); atomic_store_explicit(&atom_1_r1_1, v20, memory_order_seq_cst); return NULL; } void *t2(void *arg){ label_3:; int v4_r1 = atomic_load_explicit(&vars[2], memory_order_seq_cst); int v5_r3 = v4_r1 ^ v4_r1; int v8_r4 = atomic_load_explicit(&vars[3+v5_r3], memory_order_seq_cst); int v10_r6 = atomic_load_explicit(&vars[3], memory_order_seq_cst); int v11_r7 = v10_r6 ^ v10_r6; int v14_r8 = atomic_load_explicit(&vars[0+v11_r7], memory_order_seq_cst); int v21 = (v4_r1 == 1); atomic_store_explicit(&atom_2_r1_1, v21, memory_order_seq_cst); int v22 = (v14_r8 == 0); atomic_store_explicit(&atom_2_r8_0, v22, memory_order_seq_cst); return NULL; } int main(int argc, char *argv[]){ pthread_t thr0; pthread_t thr1; pthread_t thr2; atomic_init(&vars[0], 0); atomic_init(&vars[1], 0); atomic_init(&vars[3], 0); atomic_init(&vars[2], 0); atomic_init(&atom_1_r1_1, 0); atomic_init(&atom_2_r1_1, 0); atomic_init(&atom_2_r8_0, 0); pthread_create(&thr0, NULL, t0, NULL); pthread_create(&thr1, NULL, t1, NULL); pthread_create(&thr2, NULL, t2, NULL); pthread_join(thr0, NULL); pthread_join(thr1, NULL); pthread_join(thr2, NULL); int v15 = atomic_load_explicit(&atom_1_r1_1, memory_order_seq_cst); int v16 = atomic_load_explicit(&atom_2_r1_1, memory_order_seq_cst); int v17 = atomic_load_explicit(&atom_2_r8_0, memory_order_seq_cst); int v18_conj = v16 & v17; int v19_conj = v15 & v18_conj; if (v19_conj == 1) assert(0); return 0; }
/* * Copyright 2009 Anton Staaf * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #ifndef __write_h__ #define __write_h__ #include <stdarg.h> #include <avr/pgmspace.h> void write(const prog_char *format, ...); #define WRITE(format, ...) write(PSTR(format), __VA_ARGS__) #endif //__write_h__
/* This file is part of nextwall - a wallpaper rotator with some sense of time. Copyright 2004, Davyd Madeley <davyd@madeley.id.au> Copyright 2010-2013, Serrano Pereira <serrano@bitosis.nl> Nextwall 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. Nextwall is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. */ #include <gio/gio.h> #include <stdio.h> #include <bsd/string.h> /* strlcpy */ #include "gnome.h" /** Set the desktop background. @param[in] settings GSettings object with desktop background schema. @param[in] path The wallpaper path to set. @return Returns 0 on success, -1 on failure. */ int set_background_uri(GSettings *settings, const char *path) { char normalized_path[PATH_MAX]; if (strstr(path, "file://") == NULL) { if (snprintf(normalized_path, PATH_MAX, "file://%s", path) >= PATH_MAX) { return -1; } } else { if (strlcpy(normalized_path, path, PATH_MAX) >= PATH_MAX) { return -1; } } g_assert(g_settings_set(settings, "picture-uri", "s", normalized_path)); g_settings_sync(); // Make sure the changes are written to disk if (strcmp(g_settings_get_string(settings, "picture-uri"), normalized_path) == 0) { return 0; } return -1; } /** Get the current desktop background. @param[in] settings GSettings object with desktop background schema. @param[out] dest Is set to the URI of the current desktop background. */ int get_background_uri(GSettings *settings, char *dest) { const char *uri; uri = g_variant_get_string(g_settings_get_value(settings, "picture-uri"), NULL); // Strip off the "file://" part of the URI. if (strlcpy(dest, uri + 7, PATH_MAX) >= PATH_MAX) { return -1; } return 0; } /** Launch the default application for an image path. @param[in] path Path or uri for the image. @return Returns 0 on success, -1 on error. */ int open_image(char *path) { gboolean success; GError *error = NULL; char uri[PATH_MAX]; if (strstr(path, "file://") == NULL) { if (snprintf(uri, PATH_MAX, "file://%s", path) >= PATH_MAX) { return -1; } } else { if (strlcpy(uri, path, PATH_MAX) >= PATH_MAX) { return FALSE; } } success = g_app_info_launch_default_for_uri(uri, NULL, &error); if (success == FALSE) { g_message("%s", error->message); return -1; } return 0; } /** Move a file to trash. @param[in] path Path for the file. @return Returns 0 on success, -1 on error. */ int file_trash(char *path) { gboolean success; GFile *file; file = g_file_new_for_path(path); success = g_file_trash(file, NULL, NULL); g_object_unref(file); if (success == FALSE) { return -1; } return 0; }
/** @author Asitha Nanayakkara <daun07@gmail.com> @section LICENSE Nooba Plugin API source file Copyright (C) 2013 Developed by Team Nooba This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. */ #ifndef PLUGINLOADER_H #define PLUGINLOADER_H // projects includes #include "NoobaEye.h" // Qt includes #include <QObject> #include <QList> #include <QPluginLoader> #include <QDir> #include <QMutex> class NoobaPlugin; struct PluginConnData { QString _outPlugAlias; QString _inPlugAlias; NoobaPlugin* _inPlug; NoobaPlugin* _outPlug; }; Q_DECLARE_METATYPE(PluginConnData) Q_DECLARE_METATYPE(PluginConnData*) class PluginLoader : public QObject { Q_OBJECT public: PluginLoader(QObject *parent = 0); ~PluginLoader(); /** * Returns currently available plugins information * NOTE: Need to call loadPlugins before this if you need to get an upto date * plugins information. */ const QList<nooba::PluginData> getPluginInfo() const { return _pluginInfoList; } /** * @brief getActivePlugin main plugin that does the initial processing. Only this plugins ProcFrame(..) * functions is called by the FE. * @return */ NoobaPlugin *getBasePlugin() const; /** * @brief getActivePlugins currently loaded plugins are returned * @return plugins are returned as a QList od NoobaPlugin pointers. */ QList<NoobaPlugin *> getActivePlugins() const; const QList<NoobaPlugin* > getOutputPluginList(const QString& inPlugAlias) const; const QList<NoobaPlugin* > getInputPluginList(const QString& outPlugAlias) const; /** * @brief getPCDList returns the PluginConnData list * @return */ QList<PluginConnData *> getPCDList(); public slots: /** * Get plugin details of plugins in the plugins directory */ int loadPluginInfo(); void loadPlugins(QStringList filenameList); /** * @brief loadPlugin Load the plugin in the plugins directory with the file name fileName * @param fileName * @param isBase * @return */ NoobaPlugin* loadPlugin(QString fileName, bool isBase = false); /** * @brief unloadActivePlugin unloads the actvie plugin. * @return if successfull returns true, otherwise false. incase there is no active * plugin returns true. */ bool unloadPlugins(); /** * @brief unloadPlugin unload the plugin with the given alias. Alias is the name given to plugin * at loading time. Same plugin can be loaded with different aliases. * @param alias alias of the plugin. * @return return true if the unloading was successful. */ bool unloadPlugin(QString alias); /** * @brief connectPlugins All previous connections are disconnected before connecting the * given set of plugins. * @param configList * @return */ bool connectAllPlugins(QList<PluginConnData*> configList); void connectPlugins(PluginConnData *pcd); void connectPlugins(QStringList outPlugList, QStringList inPlugList); void connectPlugins(QString outPlugAlias, QString inPlugAlias); /** * @brief disconnectPlugin disconnect a single connection according to the plugin connection * data provided. * @param pcd * @return */ bool disconnectPlugin(PluginConnData* pcd); /** * @brief disconnectPlugin Disconnect all connections related to the given plugin * @param plugin * @return */ bool disconnectPlugin(NoobaPlugin* plugin); bool disconnectAllPlugins(); void saveCurrentConfig(); void loadPrevConfig(); void refreshPlugins(); signals: void pluginLoaded(NoobaPlugin* plugin); void pluginAboutToUnloaded(QString alias); void pluginsDisconnected(PluginConnData* pcd); void pluginsConnected(PluginConnData* pcd); void pluginInitialised(NoobaPlugin* plugin); void pluginAboutToRelease(QString alias); void errMsg(const QString& errMsg, const QString& detailedErrMsg = QString()); /** * @brief basePluginChanged * @param newBasePlugin Null if there's no base plugin */ void basePluginChanged(NoobaPlugin* newBasePlugin); private: inline bool versionCheckOk(NoobaPluginAPI *api, const QString &filename, QString &errStr); inline QString getPluginAlias(const QString &pluginName); inline void updatePluginConnection(PluginConnData* pcd, bool isConnect); void updateBasePlugin(NoobaPlugin *pluginToBeRemoved); inline void releaseAndUnload(NoobaPlugin* plugin); mutable QMutex _basePluginMutex; mutable QMutex _pcdMutex; mutable QMutex _loadedPluginsMutex; mutable QMutex _pluginInfoListMutex; QList<nooba::PluginData> _pluginInfoList; NoobaPlugin *_basePlugin; QDir _dir; QList<PluginConnData*> _pcdList; QList<NoobaPlugin* > _loadedPlugins; }; #endif // PLUGINLOADER_H
/* * DrogonPidTuner.h * * This file is part of Drogon. * * Drogon 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. * * Drogon 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 Drogon. If not, see <http://www.gnu.org/licenses/>. * * Author: Joseph Monti <joe.monti@gmail.com> * Copyright (c) 2013 Joseph Monti All Rights Reserved, http://joemonti.org/ */ #ifndef __DROGONPIDTUNER_H__ #define __DROGONPIDTUNER_H__ #include "DrogonPid.h" class DrogonPidTuner { public: DrogonPidTuner( DrogonPid *pid ); void reset( void ); void update( double error ); void tune( void ); void set_adjusts( double ap, double ai, double ad ); double* get_adjusts( void ); double get_last_error( void ); double get_best_error( void ); private: DrogonPid *pid; bool firstPass; double errorTotal; int errorCount; double lastError; double dk[3]; int dki; double lastDk; double bestError; }; #endif /* __DROGONPIDTUNER_H__ */
/* MSync.exe : Synchronizes files in a current directory with files in another directory heirarchy Copyright (C) 2017 Comine.com This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. */ //v3.0 copyright Comine.com 20150810M0924 #ifndef MFile_h #define MFile_h /////////////////////////////////////////////////////// #include "MStdLib.h" ///////////////////////////////////// #if ( defined(MSTDLIB_OS_WINDOWS) || defined(MSTDLIB_OS_WINDOWSOLD) || defined(MSTDLIB_OS_MINGW) ) #undef UNICODE #include <windows.h> #endif // MSTDLIB_OS_WINDOWS ////////////////////////////////////////////////////// #include "MIReader.h" #include "MIWriter.h" //****************************************************** //** MFileOutput class for binary output //****************************************************** class MFileOutput:public MIWriter { //////////////////////////////// #if ( defined(MSTDLIB_OS_WINDOWS) || defined(MSTDLIB_OS_WINDOWSOLD) || defined(MSTDLIB_OS_MINGW) ) HANDLE mFile; // Handle to file /////////////////////////////// #else MStdFileHandle mFile; // StdInput File #endif // MSTDLIB_OS_WINDOWS ////////////////////////////////////////////// void ClearObject(void); ////////////////////////////////////////////// public: MFileOutput(void); MFileOutput(const char *filename,bool append=false); ~MFileOutput(void); bool Create(const char *filename,bool append=false); bool Destroy(void); bool OnWrite(const void *buffer,int length); // Callback Handler for MIWriter int Tell(void); // =Current position //////////////////////////////////////////////// #if ( defined(MSTDLIB_OS_WINDOWS) || defined(MSTDLIB_OS_WINDOWSOLD) || defined(MSTDLIB_OS_MINGW) ) HANDLE GetHandle(void); //////////////////////////////////////////////// #else MStdFileHandle GetHandle(void); #endif // MSTDLIB_OS_WINDOWS }; //****************************************************** //** MFileInput class for binary input //****************************************************** class MFileInput:public MIReader { /////////////////////////////////////////////// #if ( defined(MSTDLIB_OS_WINDOWS) || defined(MSTDLIB_OS_WINDOWSOLD) || defined(MSTDLIB_OS_MINGW) ) HANDLE mFile; ////////////////////////////////////////////// #else MStdFileHandle mFile; #endif // MSTDLIB_OS_WINDOWS ////////////////////////////////////////////// void ClearObject(void); ////////////////////////////////////////////// public: MFileInput(void); MFileInput(const char *filename); ~MFileInput(void); bool Create(const char *filename); bool Destroy(void); bool OnRead(void *block,int size); // Callback Handler for MIReader int ReadToBuffer(void *buffer,int size); bool Seek(int offset,int relative=0); // relative=0(beginning) 1(current) 2(end) int Tell(void); // =Current position //////////////////////////////////////////////// #if ( defined(MSTDLIB_OS_WINDOWS) || defined(MSTDLIB_OS_WINDOWSOLD) || defined(MSTDLIB_OS_MINGW) ) HANDLE GetHandle(void); #else MStdFileHandle GetHandle(void); #endif // MSTDLIB_OS_WINDOWS }; #endif // MFile_h
// Copyright Eric Wolfson 2016-2017 // See LICENSE.txt (GPLv3) #ifndef RNG_H_ #define RNG_H_ #include <random> #include <time.h> static std::mt19937 random_number_generator(time(0)); bool roll(int); bool rollPerc(int); int randInt(int,int); int randZero(int); #endif
/*========================================================================= Program: ParaView Module: pqDesktopServicesReaction.h Copyright (c) 2005,2006 Sandia Corporation, Kitware Inc. All rights reserved. ParaView is a free software; you can redistribute it and/or modify it under the terms of the ParaView license version 1.2. See License_v1.2.txt for the full ParaView license. A copy of this license can be obtained by contacting Kitware Inc. 28 Corporate Drive Clifton Park, NY 12065 USA 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 AUTHORS 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 pqDesktopServicesReaction_h #define pqDesktopServicesReaction_h #include "pqReaction.h" #include <QUrl> /// @ingroup Reactions /// pqDesktopServicesReaction can be used to open a file (or URL) using /// QDesktopServices. e.g. if your application wants to launch a PDF viewer to /// open the application's User Guide, you can hookup a menu QAction to the /// pqDesktopServicesReaction. e.g. /// @code /// QAction* action = ... /// new pqDesktopServicesReaction(QUrl("file:///..../doc/UsersGuide.pdf"), action); /// @endcode class PQAPPLICATIONCOMPONENTS_EXPORT pqDesktopServicesReaction : public pqReaction { Q_OBJECT typedef pqReaction Superclass; public: pqDesktopServicesReaction(const QUrl& url, QAction* parent); virtual ~pqDesktopServicesReaction(); static void openUrl(const QUrl& url); protected: virtual void onTriggered() { pqDesktopServicesReaction::openUrl(this->URL); } private: Q_DISABLE_COPY(pqDesktopServicesReaction); QUrl URL; }; #endif
/* * scsi_netlink.c - SCSI Transport Netlink Interface * * Copyright (C) 2006 James Smart, Emulex Corporation * * 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 <linux/time.h> #include <linux/jiffies.h> #include <linux/security.h> #include <linux/delay.h> #include <linux/slab.h> #include <linux/export.h> #include <net/sock.h> #include <net/netlink.h> #include <scsi/scsi_netlink.h> #include "scsi_priv.h" struct sock *scsi_nl_sock = NULL; EXPORT_SYMBOL_GPL(scsi_nl_sock); /** * scsi_nl_rcv_msg - Receive message handler. * @skb: socket receive buffer * * Description: Extracts message from a receive buffer. * Validates message header and calls appropriate transport message handler * * **/ static void scsi_nl_rcv_msg(struct sk_buff *skb) { struct nlmsghdr *nlh; struct scsi_nl_hdr *hdr; u32 rlen; int err, tport; while (skb->len >= NLMSG_HDRLEN) { err = 0; nlh = nlmsg_hdr(skb); if ((nlh->nlmsg_len < (sizeof(*nlh) + sizeof(*hdr))) || (skb->len < nlh->nlmsg_len)) { printk(KERN_WARNING "%s: discarding partial skb\n", __func__); return; } rlen = NLMSG_ALIGN(nlh->nlmsg_len); if (rlen > skb->len) { rlen = skb->len; } if (nlh->nlmsg_type != SCSI_TRANSPORT_MSG) { err = -EBADMSG; goto next_msg; } hdr = nlmsg_data(nlh); if ((hdr->version != SCSI_NL_VERSION) || (hdr->magic != SCSI_NL_MAGIC)) { err = -EPROTOTYPE; goto next_msg; } if (!netlink_capable(skb, CAP_SYS_ADMIN)) { err = -EPERM; goto next_msg; } if (nlh->nlmsg_len < (sizeof(*nlh) + hdr->msglen)) { printk(KERN_WARNING "%s: discarding partial message\n", __func__); goto next_msg; } /* * Deliver message to the appropriate transport */ tport = hdr->transport; if (tport == SCSI_NL_TRANSPORT) { switch (hdr->msgtype) { case SCSI_NL_SHOST_VENDOR: /* Locate the driver that corresponds to the message */ err = -ESRCH; break; default: err = -EBADR; break; } if (err) printk(KERN_WARNING "%s: Msgtype %d failed - err %d\n", __func__, hdr->msgtype, err); } else { err = -ENOENT; } next_msg: if ((err) || (nlh->nlmsg_flags & NLM_F_ACK)) { netlink_ack(skb, nlh, err); } skb_pull(skb, rlen); } } /** * scsi_netlink_init - Called by SCSI subsystem to initialize * the SCSI transport netlink interface * **/ void scsi_netlink_init(void) { struct netlink_kernel_cfg cfg = { .input = scsi_nl_rcv_msg, .groups = SCSI_NL_GRP_CNT, }; scsi_nl_sock = netlink_kernel_create(&init_net, NETLINK_SCSITRANSPORT, &cfg); if (!scsi_nl_sock) { printk(KERN_ERR "%s: register of receive handler failed\n", __func__); return; } return; } /** * scsi_netlink_exit - Called by SCSI subsystem to disable the SCSI transport netlink interface * **/ void scsi_netlink_exit(void) { if (scsi_nl_sock) { netlink_kernel_release(scsi_nl_sock); } return; }
#ifndef PhiOS_DRIVERS_ACPI_SRAT #define PhiOS_DRIVERS_ACPI_SRAT #include "include/types.h" #include "include/errors.h" #include "include/compiler.h" #include "drivers/acpi/include/SDTHeader.h" /* * SRAT header */ #define SRAT_PROCESSOR_LOCAL_APIC_TYPE 0 #define SRAT_MEMORY_TYPE 1 #define SRAT_PROCESSOR_LOCAL_x2APIC_TYPE 2 struct _SRATHeader { SDTHeader sdt; uint8 reserved[12]; } PhiOS_PACKED_STRUCTURE; typedef struct _SRATHeader SRATHeader; typedef struct _SRATHeader* PSRATHeader; struct _SRAT { SRATHeader header; uint8 *entries; }; typedef struct _SRAT SRAT; typedef struct _SRAT* PSRAT; /* * SRAT processor local apic structure */ #define PROCESSOR_LOCAL_APIC_FLAG_ENABLED 1 struct _SRATProcessorLocalApic { uint8 type; // 0x0 for this type of structure. uint8 length; // 16 uint8 lowDomain; // Bits [0:7] of the proximity domain. uint8 apicId; // The processor's local APIC ID. uint32 flags; // Flags. uint8 sapicEId; // The processor's local SAPIC EID. uint8 highDomain[3]; // Bits [8:31] of the proximity domain. uint32 clockDomain; // The clock domain to which the processor belongs. } PhiOS_PACKED_STRUCTURE; typedef struct _SRATProcessorLocalApic SRATProcessorLocalApic; typedef struct _SRATProcessorLocalApic* PSRATProcessorLocalApic; /* * SRAT memory structure */ #define MEMORY_FLAG_ENABLED 1 #define MEMORY_FLAG_HOT_PLUGGABLE 2 #define MEMORY_FLAG_NON_VOLATILE 4 struct _SRATMemory { uint8 type; // 0x1 for this type of structure. uint8 length; // 40 uint32 domain; // Integer that represents the proximity domain // to which the processor belongs. uint8 reserved1[2]; // Reserved. uint32 lowBase; // Low 32 bits of the base address of the memory range. uint32 highBase; // High 32 bits of the base address of the memory range. uint32 lowLength; // Low 32 bits of the length of the range. uint32 highLength; // High 32 bits of the length of the range. uint8 reserved2[4]; // Reserved. uint32 flags; // Flags. uint8 reserved3[8]; // Reserved. } PhiOS_PACKED_STRUCTURE; typedef struct _SRATMemory SRATMemory; typedef struct _SRATMemory* PSRATMemory; /* * SRAT processor local x2 apic structure */ #define PROCESSOR_LOCAL_x2APIC_FLAG_ENABLED 1 struct _SRATProcessorLocalx2Apic { uint8 type; // 0x2 for this type of structure. uint8 length; // 24 uint8 reserved1[2]; // Reserved. uint32 domain; // The proximity domain to which the logical processor belongs. uint32 x2apicId; // The processor local x2APIC ID. uint32 flags; // Flags. uint32 clockDomain; // The clock domain to which the logical processor belongs. uint8 reserved2[4]; // Reserved. } PhiOS_PACKED_STRUCTURE; typedef struct _SRATProcessorLocalx2Apic SRATProcessorLocalx2Apic; typedef struct _SRATProcessorLocalx2Apic* PSRATProcessorLocalx2Apic; /* * @brief: Initializes SRAT structure. This function does not alloc memory for * entries field, it just sets a pointer to memory area from ptr where * the entries are stored. * * @param: * a_srat - the structure which is initialized. * a_ptr - the memory area from where the structure is initialized. * * @return: * ERROR_SUCCESS - the structure was initialized. * ERROR_NULL_POINTER - a_srat or a_ptr are null. * ERROR_INTERNAL_ERROR - the data from ptr could not be copied into a_srat. * ERROR_NOT_FOUND - in the memory area from a_ptr it's not a SRAT structure. */ uint32 acpi_srat_init( PSRAT a_srat, uint8 *a_ptr ); /* * @brief: Get number of system resource affinity for a certain type. * * @param: * a_srat - the SRAT structure where are searched the SRA structures. * a_type - the type of the SRA structure. (see SRAT_*_TYPE) * a_number - the address where will be stored the result. * * @return: * ERROR_SUCCESS - operation completed successfully. * ERROR_UNKNOWN - unknown type. * ERROR_NULL_POINTER - a_srat, a_srat.entries or a_number are null. */ uint32 acpi_srat_getNumberOfSRA( PSRAT a_srat, uint32 a_type, uint32 *a_number ); /* * @brief: Get the a_position th SRA structure. * * @param: * a_srat - the SRAT structure where the SRA structure is searching. * a_buffer - the buffer where will be copied the structure. * a_bufferSize - the buffer size (implicit the structure size). * a_type - the structure type (see SRAT_*_TYPE). * a_position - the position of the structure. * * @return: * ERROR_SUCCESS - the structure was copied in buffer. * ERROR_INTERNAL_ERROR - the structure could not be copied in a_buffer. * ERROR_NULL_POINTER - a_buffer or a_srat are null. * ERROR_NOT_FOUND - the a_position structure was not found. */ uint32 acpi_srat_getNthSRAStructure( PSRAT a_srat, void *a_buffer, uint32 a_bufferSize, uint32 a_type, uint32 a_position ); #endif
// Copyright (c) 2005 - 2015 Settlers Freaks (sf-team at siedler25.org) // // This file is part of Return To The Roots. // // Return To The Roots 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. // // Return To The Roots 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 Return To The Roots. If not, see <http://www.gnu.org/licenses/>. #ifndef ADDONDEMOLITIONPROHIBITION_H_INCLUDED #define ADDONDEMOLITIONPROHIBITION_H_INCLUDED #pragma once #include "AddonList.h" #include "mygettext/src/mygettext.h" /** * Addon for changing the maximum length of waterways. */ class AddonDemolitionProhibition : public AddonList { public: AddonDemolitionProhibition() : AddonList(AddonId::DEMOLITION_PROHIBITION, ADDONGROUP_MILITARY, _("Disable Demolition of military buildings"), _("Disable the demolition of military buildings under attack or near frontiers."), 0) { addOption(_("Off")); addOption(_("Active if attacked")); addOption(_("Active near frontiers")); } }; #endif // !ADDONDEMOLITIONPROHIBITION_H_INCLUDED
#include <stdio.h> #include <fcntl.h> int main(int argc, char **argv) { int cin, fout; char c; if (argc > 1) fout = open(argv[1], O_WRONLY|O_CREAT, 0644); else fout = 1; while ((cin = getchar()) != EOF) { c = cin; if (c == '\n') c = '\r'; if (c == '\t') c = ' '; c |= 0x80; write(fout, &c, 1); } close(fout); return (0); }
/****************************************************************/ /** **/ /** Author: Jacob Hurst **/ /** File name: regionconfig.h **/ /** Date: Tuesday 13 Jan 2009 **/ /** Description: Reads Abysis region.xml to extract **/ /** region definitions. **/ /** **/ /****************************************************************/ #ifndef REGION_CONFIG #define REGION_CONFIG #include <string> #include <map> using namespace std; class RegionDefinition{ public: string name; string scheme; string start; string end; RegionDefinition(string scheme,string name,string start,string end); void printData(); }; class RegionConfig{ private: multimap<string, RegionDefinition> defs; void add_definitions(string def_type); public: RegionConfig(string config_filename, string def_type); string obtain_attribute(string); void printRegionDefs(); void obtainRegion(string r_in_q, string& s_in_q, string& end_in_q); }; #endif
/* This file is part of Telegram Desktop, the official desktop version of Telegram messaging app, see https://telegram.org Telegram Desktop 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. It 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. In addition, as a special exception, the copyright holders give permission to link the code of portions of this program with the OpenSSL library. Full license: https://github.com/telegramdesktop/tdesktop/blob/master/LICENSE Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org */ #pragma once #include <QtWidgets/QWidget> #include "ui/twidget.h" #include "core/lambda_wrap.h" typedef enum { ButtonByUser = 0x00, // by clearState() call ButtonByPress = 0x01, ButtonByHover = 0x02, } ButtonStateChangeSource; class Button : public TWidget { Q_OBJECT public: Button(QWidget *parent); enum { StateNone = 0x00, StateOver = 0x01, StateDown = 0x02, StateDisabled = 0x04, }; Qt::KeyboardModifiers clickModifiers() const { return _modifiers; } void clearState(); int getState() const; void setDisabled(bool disabled = true); void setOver(bool over, ButtonStateChangeSource source = ButtonByUser); bool disabled() const { return (_state & StateDisabled); } void setAcceptBoth(bool acceptBoth = true); void setClickedCallback(base::lambda_unique<void()> &&callback) { _clickedCallback = std_::move(callback); } protected: void enterEvent(QEvent *e) override; void leaveEvent(QEvent *e) override; void mousePressEvent(QMouseEvent *e) override; void mouseMoveEvent(QMouseEvent *e) override; void mouseReleaseEvent(QMouseEvent *e) override; signals: void clicked(); void stateChanged(int oldState, ButtonStateChangeSource source); protected: virtual void onStateChanged(int oldState, ButtonStateChangeSource source) { } Qt::KeyboardModifiers _modifiers; int _state; bool _acceptBoth; base::lambda_unique<void()> _clickedCallback; };
/**************************************************************************** ** ** Copyright (C) 2016 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** ** This file is part of the plugins of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in ** a written agreement between you and The Qt Company. For licensing terms ** and conditions see https://www.qt.io/terms-conditions. For further ** information use the contact form at https://www.qt.io/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser ** General Public License version 3 as published by the Free Software ** Foundation and appearing in the file LICENSE.LGPL3 included in the ** packaging of this file. Please review the following information to ** ensure the GNU Lesser General Public License version 3 requirements ** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. ** ** GNU General Public License Usage ** Alternatively, this file may be used under the terms of the GNU ** General Public License version 2.0 or (at your option) the GNU General ** Public license version 3 or any later version approved by the KDE Free ** Qt Foundation. The licenses are as published by the Free Software ** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 ** included in the packaging of this file. Please review the following ** information to ensure the GNU General Public License requirements will ** be met: https://www.gnu.org/licenses/gpl-2.0.html and ** https://www.gnu.org/licenses/gpl-3.0.html. ** ** $QT_END_LICENSE$ ** ****************************************************************************/ #ifndef QOPENWFDNATIVEINTERFACE_H #define QOPENWFDNATIVEINTERFACE_H #include <qpa/qplatformnativeinterface.h> #include <WF/wfdplatform.h> class QOpenWFDScreen; class QOpenWFDNativeInterface : public QPlatformNativeInterface { public: enum ResourceType { WFDDevice, EglDisplay, EglContext, WFDPort, WFDPipeline }; void *nativeResourceForContext(const QByteArray &resourceString, QOpenGLContext *context); void *nativeResourceForWindow(const QByteArray &resourceString, QWindow *window); WFDHandle wfdDeviceForWindow(QWindow *window); void *eglDisplayForWindow(QWindow *window); WFDHandle wfdPortForWindow(QWindow *window); WFDHandle wfdPipelineForWindow(QWindow *window); void *eglContextForContext(QOpenGLContext *context); private: static QOpenWFDScreen *qPlatformScreenForWindow(QWindow *window); }; #endif // QOPENWFDNATIVEINTERFACE_H
//============== IV: Multiplayer - http://code.iv-multiplayer.com ============== // // File: CServerRPCHandler.h // Project: Server.Core // Author(s): jenksta // License: See LICENSE in root directory // //============================================================================== #pragma once #include <Network/CRPCHandler.h> class CServerRPCHandler : public CRPCHandler { private: static void PlayerConnect(CBitStream * pBitStream, CPlayerSocket * pSenderSocket); static void PlayerJoinComplete(CBitStream * pBitStream, CPlayerSocket * pSenderSocket); static void Chat(CBitStream * pBitStream, CPlayerSocket * pSenderSocket); static void Command(CBitStream * pBitStream, CPlayerSocket * pSenderSocket); static void PlayerSpawn(CBitStream * pBitStream, CPlayerSocket * pSenderSocket); static void Death(CBitStream * pBitStream, CPlayerSocket * pSenderSocket); static void OnFootSync(CBitStream * pBitStream, CPlayerSocket * pSenderSocket); static void InVehicleSync(CBitStream * pBitStream, CPlayerSocket * pSenderSocket); static void PassengerSync(CBitStream * pBitStream, CPlayerSocket * pSenderSocket); static void SmallSync(CBitStream * pBitStream, CPlayerSocket * pSenderSocket); static void VehicleEnterExit(CBitStream * pBitStream, CPlayerSocket * pSenderSocket); static void HeadMovement(CBitStream * pBitStream, CPlayerSocket * pSenderSocket); static void EmptyVehicleSync(CBitStream * pBitStream, CPlayerSocket * pSenderSocket); static void NameChange(CBitStream * pBitStream, CPlayerSocket * pSenderSocket); static void CheckpointEntered(CBitStream * pBitStream, CPlayerSocket * pSenderSocket); static void CheckpointLeft(CBitStream * pBitStream, CPlayerSocket * pSenderSocket); static void EventCall(CBitStream * pBitStream, CPlayerSocket * pSenderSocket); static void VehicleDeath(CBitStream * pBitStream, CPlayerSocket * pSenderSocket); static void SyncActor(CBitStream * pBitStream, CPlayerSocket * pSenderSocket); static void RequestActorUpdate(CBitStream * pBitStream, CPlayerSocket * pSenderSocket); public: void Register(); void Unregister(); };
#include <stdio.h> main() { int a, s, i; printf("Введите десятичное число\n"); scanf("%s", &a); s = 128; i = 1; while(i<=8) { i++ if(a>=s) { printf("1"); a-=s; } else printf("0"); s/-2; } return 0; }
/** * @file Dependence.h * * @version 1.0 * @created 01/28/2013 01:16:50 PM * @revision $Id$ * * @author Ryan Huang <ryanhuang@cs.ucsd.edu> * @organization University of California, San Diego * * Copyright (c) 2013, Ryan Huang * 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. * * @section DESCRIPTION * * Dependence type definitions * */ #ifndef __DEPENDENCE_H_ #define __DEPENDENCE_H_ #include "llvm/Support/raw_ostream.h" namespace llvm { enum DepType { SSADep = 1 << 0, MemDep = 1 << 1, DataDep = SSADep | MemDep, CtrlDep = 1 << 2, AllDep = CtrlDep | DataDep }; enum MemDepType { NoneMemDep = 0, TrueMemDep = 1 << 0, AntiMemDep = 1 << 1, OutMemDep = 1 << 2 }; raw_ostream & operator<< (raw_ostream & O, MemDepType type); } // End of llvm namespace #endif /* __DEPENDENCE_H_ */
/** * Class: PresetMenu * Author: Jonathan David Hook * Email: j.d.hook@ncl.ac.uk * Web: http://homepages.cs.ncl.ac.uk/j.d.hook */ #ifndef PresetMenu_H #define PresetMenu_H #include <map> #include "ScrollMenu.h" #include "SplinePreset.h" namespace Waves { class PresetMenu : public ScrollMenu { public: typedef FastDelegate1<SplinePreset *> ItemSelectedCallback; PresetMenu(const Point2f &position, float height, std::vector<SplinePreset *> menuItems); ~PresetMenu(void); void fingerRemoved(const FingerEventArgs &e); void render(void); void setItemSelectedCallback(ItemSelectedCallback itemSelected); void setMenuItems(std::vector<SplinePreset *> menuItems); private: static const unsigned int PRESET_DISPLAY_COUNT = 3; ItemSelectedCallback itemSelected; std::vector<SplinePreset *> menuItems; void renderMenuItem(SplinePreset *preset, bool selected); void renderScrollBar(void); float scaleY(float y); void updateDisplayCount(void); }; } #endif
#pragma once #include <stdarg.h> #include "rpc/server.h" #include "rpc/client.h" #include "rpc/utils.h" #include "log_service.h" namespace rlog { class RLog { public: static void init(const char* my_ident = nullptr, const char* rlog_addr = nullptr); static void finalize() { Pthread_mutex_lock(&mutex_s); do_finalize(); Pthread_mutex_unlock(&mutex_s); } static void log(int level, const char* fmt, ...) { va_list args; va_start(args, fmt); log_v(level, fmt, args); va_end(args); } static void debug(const char* fmt, ...) { va_list args; va_start(args, fmt); log_v(rrr::Log::DEBUG, fmt, args); va_end(args); } static void info(const char* fmt, ...) { va_list args; va_start(args, fmt); log_v(rrr::Log::INFO, fmt, args); va_end(args); } static void warn(const char* fmt, ...) { va_list args; va_start(args, fmt); log_v(rrr::Log::WARN, fmt, args); va_end(args); } static void error(const char* fmt, ...) { va_list args; va_start(args, fmt); log_v(rrr::Log::ERROR, fmt, args); va_end(args); } static void fatal(const char* fmt, ...) { va_list args; va_start(args, fmt); log_v(rrr::Log::FATAL, fmt, args); va_end(args); } static void aggregate_qps(const std::string& metric_name, const rrr::i32 increment); private: // prevent creating objects of RLog class, it's only a utility class with static functions RLog(); static void log_v(int level, const char* fmt, va_list args); static void do_finalize(); static char* my_ident_s; static RLogProxy* rp_s; static rrr::Client* cl_s; static char* buf_s; static int buf_len_s; static rrr::PollMgr* poll_s; static rrr::Counter msg_counter_s; // no static Mutex class, use pthread_mutex_t and PTHREAD_MUTEX_INITIALIZER instead static pthread_mutex_t mutex_s; }; } // namespace rlog
#pragma once #include "Body.h" #include "LocalScope.h" #include "Parameter.h" #include "instance/Views.h" #include "meta/Flags.h" #include "meta/Optional.h" #include "meta/VectorRange.h" #include "meta/algorithm.h" #include "strings/View.h" #include <set> namespace instance { using Name = strings::String; using NameView = strings::View; enum class FunctionFlag { compiletime = 1u << 0u, runtime = 1u << 1u, compiletime_sideeffects = 1u << 2u, }; using FunctionFlags = meta::Flags<FunctionFlag>; META_FLAGS_OP(FunctionFlags) using OptParameterView = meta::Optional<meta::DefaultPacked<ParameterView>>; using ParameterViews = std::vector<ParameterView>; using ParameterRange = meta::VectorRange<ParameterView const>; struct Function { Name name{}; FunctionFlags flags{}; // PrecedenceLevel level{}; Body body{}; LocalScope parameterScope{}; ParameterViews parameters{}; auto lookupParameter(NameView name) const -> OptParameterView; auto leftParameters() const -> ParameterRange { auto b = parameters.begin(); auto e = meta::findIf(parameters, [](const auto& a) { return a->side != ParameterSide::left; }); return {b, e}; } auto rightParameters() const -> ParameterRange { auto b = meta::findIf(parameters, [](const auto a) { return a->side == ParameterSide::right; }); auto e = std::find_if(b, parameters.end(), [](const auto a) { return a->side != ParameterSide::right; }); return {b, e}; } void orderParameters() { meta::stableSort(parameters, [](const auto a, const auto b) { return a->side < b->side; }); } }; inline auto nameOf(const Function& fun) -> NameView { return fun.name; } } // namespace instance
#ifndef _MTYPE_H_ #define _MTYPE_H_ #include "memory.h" class ChessBoard; typedef unsigned int uint32; typedef short int16; typedef unsigned char uint8; typedef struct _ZobristNode{ uint32 hash; int16 value; bool operator !(){ if(hash == 0) return true; return false; } bool operator ==(const struct _ZobristNode &rhs){ if(rhs.hash==hash) return true; return false; } //use the default constructor }ZobristNode; class BitBoard{ #define SIZE 32 private: uint8 board[SIZE]; public: BitBoard() { memset(board,0,SIZE); } BitBoard(const uint8 *b) { memcpy(board , b , SIZE); } //返回棋盘上i行j列有无子 uint8 operator ()(uint8 i,uint8 j) const { if((i>=16) || (j>=16)) return -1; uint8 block = (i*16+j)/8,byteMask = (i*16+j)%8; if(board[block] & (1<<byteMask)) return 1; else return 0; } uint8 &operator [](uint8 index) { if ((index >= SIZE) or (index < 0)) return board[0];//此处返回什么? return board[index]; } const uint8 &operator [](uint8 index) const { if ((index >= SIZE) or (index < 0)) return board[0];//此处返回什么? return board[index]; } BitBoard operator =(const struct BitBoard &rhs) { for(uint8 i=0;i<SIZE;i++) board[i]=rhs[i]; } #undef SIZE }; typedef struct { uint8 inp; int16 value; }ThreadReturn; typedef struct { const ChessBoard *parent; uint8 inp; uint8 qtid; }ThreadArgs; #endif
/* * Generated by asn1c-0.9.29 (http://lionet.info/asn1c) * From ASN.1 module "S1AP-PDU-Contents" * found in "../support/s1ap-r16.1.0/36413-g10.asn" * `asn1c -pdu=all -fcompound-names -findirect-choice -fno-include-deps` */ #ifndef _S1AP_UEContextResumeFailure_H_ #define _S1AP_UEContextResumeFailure_H_ #include <asn_application.h> /* Including external dependencies */ #include "S1AP_ProtocolIE-Container.h" #include <constr_SEQUENCE.h> #ifdef __cplusplus extern "C" { #endif /* S1AP_UEContextResumeFailure */ typedef struct S1AP_UEContextResumeFailure { S1AP_ProtocolIE_Container_7327P85_t protocolIEs; /* * This type is extensible, * possible extensions are below. */ /* Context for parsing across buffer boundaries */ asn_struct_ctx_t _asn_ctx; } S1AP_UEContextResumeFailure_t; /* Implementation */ extern asn_TYPE_descriptor_t asn_DEF_S1AP_UEContextResumeFailure; extern asn_SEQUENCE_specifics_t asn_SPC_S1AP_UEContextResumeFailure_specs_1; extern asn_TYPE_member_t asn_MBR_S1AP_UEContextResumeFailure_1[1]; #ifdef __cplusplus } #endif #endif /* _S1AP_UEContextResumeFailure_H_ */ #include <asn_internal.h>
/* * C function that gets rss feeds from various news agencies and extracts the titles * Uses libcurl open source library to download feed.xml * The function accounts that the file downloaded is not necessarily a xml file and may not be "proper" */ #include <stdio.h> #include <stdlib.h> #include <string.h> #include <ctype.h> #include <curl/curl.h> #include <sys/stat.h> #include "parseXml.h" #define OUT 0 #define IN 1 #define MAX_TITLES 100 #define BUFFER_SIZE 512 static void download_feed(FILE *dst, const char *src); static int countWords(char *str); static void getTitle(char *line); static int fsize(const char *filename); int refreshFeed(char *url, struct news *newsTitles) { int k = 0; if(newsTitles -> titles != NULL){ //free all the allocated memory char **titless = (char **)(newsTitles -> titles); for(k=0;k<newsTitles -> size; k++){ free(titless[k]); } free(newsTitles -> titles); } FILE *fptr; /* open for writing */ fptr = fopen("feed.xml", "w"); if (fptr == NULL){ printf("%s:Could not open file feed.xml for writing \n", url); return 1; } download_feed(fptr, url); fclose(fptr); int fileSize = fsize("feed.xml"); if (fileSize == -1){ printf("%s:Could not stat size of feed.xml\n", "parseXml"); return 1; } /* open for reading */ fptr = fopen("feed.xml", "r"); if (fptr == NULL){ printf("Could not open file feed.xml for reading \n"); return 1; } char **news = malloc(MAX_TITLES * sizeof(char*)); // MAX_TITLES titles of BUFFER_SIZE chars each int nlines = 0; int state=OUT,i=0,j=0,pos=0; char a; char buffer[BUFFER_SIZE]; char identifier[12]; memset(identifier, 0, 12); do { //this do loop will capture all the texts in between title tags a = fgetc(fptr); for(k=1;k<11;k++){ //shift left identifier[k-1] = identifier[k]; } identifier[k-1]=a; // add new char at the right end if(state==OUT){ if(strstr(identifier, "<title>") != NULL){ state=IN; pos=0; } } else if(state ==IN){ if(pos<BUFFER_SIZE-1){ buffer[pos++] = a; } if(strstr(identifier, "</title>") != NULL){ state=OUT; buffer[pos] = '\0'; getTitle(buffer); if(countWords(buffer)>4 && nlines<MAX_TITLES){ // skip trivial titles news[nlines++] = strdup(buffer); } } } } while (a != EOF && ++j<fileSize);// some files don't have EOF newsTitles -> titles = news; newsTitles -> size = nlines; fclose(fptr); return 0; } void download_feed(FILE *dst, const char *src){ CURL *handle = curl_easy_init(); curl_easy_setopt(handle, CURLOPT_URL, src); curl_easy_setopt(handle, CURLOPT_WRITEDATA, dst); curl_easy_perform(handle); } int fsize(const char *filename) { struct stat st; if (stat(filename, &st) == 0) return (st.st_size + 0); return -1; } void getTitle(char *line){ static char *suffix = "</TITLE>"; static char *cdata = "<![CDATA["; static char *watch = "WATCH:"; static char buff[BUFFER_SIZE]; int i =0; while(line[i] && i<BUFFER_SIZE){ buff[i] = toupper(line[i]); i++; } buff[i-strlen(suffix)] = '\0'; //remove suffix char *p1 = &buff[0]; if(strstr(p1, cdata) == p1){ // starts with cdata p1 += strlen(cdata); } if(strstr(p1, watch) == p1){ // starts with watch p1 += strlen(watch); } int k=0; while(isspace(p1[k])) k++; //get rid of leading whitespace p1 += k; if(strstr(p1, "]]>") == p1+strlen(p1)-3){ // ends with ]]> p1[strlen(p1)-3] = '\0'; } strcpy(line, p1); } // returns number of words in str int countWords(char *str) { int state = OUT; int wc = 0; // word count // Scan all characters one by one while (*str) { // If next character is a separator, set the // state as OUT if (*str == ' ' || *str == '\n' || *str == '\t') state = OUT; else if (state == OUT) { state = IN; ++wc; } ++str; } return wc; }
static const char help[] = "Petsc mat example.\n\n"; #include <petscmat.h> #undef __FUNCT__ #define __FUNCT__ "main" int main(int argc,char **argv) { /* Initialize the Petsc environment */ PetscInitialize(&argc,&argv,(char*)0,help); /* Write a PETSc program that creates a parallel matrix to host the 2d (5 point stencil) finite difference discretization of the Laplace operator. Each processor needs to insert only elements that it owns locally (but any non-local elements will be sent to the appropriate processor during matrix assembly) Each processor prints the global and local size of the matrix nabla^2 f(x,y) = (f(x - h, y) + f(x + h, y) + f(x, y - h) + f(x, y + h) - 4 f(x,y))/h*h */ PetscFinalize(); PetscFunctionReturn(0); }
/*\ * Binary analyzer for decompilation and forensics * Copyright (C) 2013 Quentin SANTOS * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. \*/ #ifndef PARSER_H #define PARSER_H #include "elist.h" #include "elf.h" char* read_register(expr_reg_type_t* dst, int* sz, elf_t* elf, char* str); char* read_operand (expr_t** dst, int* sz, elf_t* elf, char* str); void read_instr (elist_t* dst, address_t of, elf_t* elf, char* str); void read_file (elist_t* dst, elf_t* elf, FILE* f); #endif
#include "stack.h" STACK *createStack(int num_items,size_t unit_size) { STACK *newStack = (STACK *)malloc(1*sizeof(STACK)); newStack->block_list = NULL; newStack->items_per_block = num_items; newStack->item_size = unit_size; newStack->item_c = 0; return newStack; } void emptyStack(STACK *astack) { BLOCK_STARTER *block; if(!astack||!astack->block_list) return; block = astack->block_list; if(block->next) block = block->next; astack->block_list = block; astack->item_c = 0; astack->index_in_block = 0; } void freeStack(STACK *astack) { BLOCK_STARTER *ite_block,*temp_block; if(!astack) return; ite_block = astack->block_list; if(ite_block){ while(ite_block->next) ite_block = ite_block->next; } while(ite_block){ temp_block = ite_block; ite_block = ite_block->prev; free((void *)temp_block); } free((void *)astack); } void stackBackup(STACK *astack) { astack->block_backup = astack->block_list; astack->index_backup = astack->index_in_block; astack->item_c_backup = astack->item_c; } void stackRecover(STACK *astack) { astack->block_list = astack->block_backup; astack->index_in_block = astack->index_backup; astack->item_c = astack->item_c_backup; } void *stackPop(STACK *astack) { BLOCK_STARTER *block; if(!astack||!astack->block_list||!astack->item_c) return NULL; astack->item_c--; block = astack->block_list; if(astack->index_in_block==1){ if(block->next){ astack->block_list = block->next; astack->index_in_block = astack->items_per_block; }else{ astack->index_in_block = 0; astack->item_c = 0; } return (void *)((void *)block+sizeof(BLOCK_STARTER)); } return (void *)((void *)block+sizeof(BLOCK_STARTER)+astack->item_size*(--astack->index_in_block)); } void *stackPush(STACK *astack) { BLOCK_STARTER *block; if(!astack) return NULL; astack->item_c++; if(!astack->block_list||(astack->index_in_block==astack->items_per_block&&!astack->block_list->prev)){ block = malloc(sizeof(BLOCK_STARTER)+astack->items_per_block*astack->item_size); block->prev = NULL; if(astack->block_list) astack->block_list->prev = block; block->next = astack->block_list; astack->block_list = block; astack->index_in_block = 1; return (void *)((void *)block+sizeof(BLOCK_STARTER)); }else if(astack->index_in_block==astack->items_per_block&&astack->block_list->prev){ astack->block_list = astack->block_list->prev; astack->index_in_block = 1; return (void *)((void *)astack->block_list+sizeof(BLOCK_STARTER)); } block = astack->block_list; return (void *)((void *)block+sizeof(BLOCK_STARTER)+astack->item_size*astack->index_in_block++); }
// // ViewController.h // SavingMoreStuff // // Created by CICCC1 on 2016-07-20. // Copyright © 2016 Ideia do Luiz. All rights reserved. // #import <UIKit/UIKit.h> @interface ViewController : UIViewController @end
#pragma once #ifndef ANIMOBJECT_H #define ANIMOBJECT_H #include "Object.h" class AnimObject : public Object { public: AnimObject(int pPosX, int pPosY, std::string pTextureName, int pTextureOffsetX, int pTextureOffsetY); virtual ~AnimObject(); virtual ErrCode Update(double dt); virtual ErrCode Draw(LPD3DXSPRITE pSprite); protected: double m_animUpdateTimer; double m_animUpdateTime; int m_curFrame; }; #endif // ANIMOBJECT_H
#define _SET(type,name,bit) type ## name |= _BV(bit) #define _CLEAR(type,name,bit) type ## name &= ~ _BV(bit) #define _TOGGLE(type,name,bit) type ## name ^= _BV(bit) #define _GET(type,name,bit) ((type ## name >> bit) & 1) #define _PUT(type,name,bit,value) type ## name = ( type ## name & ( ~ _BV(bit)) ) | ( ( 1 & (unsigned char)value ) << bit ) #define OUTPUT(pin) _SET(DDR,pin) #define INPUT(pin) _CLEAR(DDR,pin) #define HIGH(pin) _SET(PORT,pin) #define LOW(pin) _CLEAR(PORT,pin) #define TOGGLE(pin) _TOGGLE(PORT,pin) #define READ(pin) _GET(PIN,pin) #define SLEEP() sleep_cpu() #define NOP() __asm__ __volatile__ ("nop" ::)
// // AlphaColl.h // // Created by Stefano Torre on 09/05/12. // #ifndef NEMO_ALPHACOLL_H_ #define NEMO_ALPHACOLL_H_ #include "Hereward/Edm/StorableObject.h" #include "Hereward/Edm/ConstHandle.h" #include "Hereward/Edm/Handle.h" #include "StorableContainers/ValueVector.h" #include "NemoObjects/Alpha.h" class EventRecord; class AlphaColl; typedef ConstHandle<AlphaColl> AlphaColl_ch; typedef Handle<AlphaColl> AlphaColl_h; class AlphaColl : public StorableObject { public: //------------------------------------------------------------------------- // typedef's for the collection //------------------------------------------------------------------------- typedef Alpha value_type; typedef std::vector<value_type> AlphaList; typedef AlphaList::iterator iterator; typedef AlphaList::const_iterator const_iterator; typedef Alpha& reference; typedef const Alpha& const_reference; typedef Alpha* pointer; typedef const Alpha* const_pointer; typedef AlphaList::difference_type difference_type; typedef AlphaList::size_type size_type; typedef AlphaList CollType; typedef AlphaList collection_type; //------------------------------------------------------------------------- // Creation //------------------------------------------------------------------------- AlphaColl(); AlphaColl(const AlphaColl& rhs); virtual AlphaColl* clone(void); //------------------------------------------------------------------------- // EDM requirements //------------------------------------------------------------------------- virtual void destroy(); virtual void deallocate(); //------------------------------------------------------------------------- // Assignemnt //------------------------------------------------------------------------- AlphaColl& operator = (const AlphaColl& rhs); //------------------------------------------------------------------------- // Additional functions to make class functional //------------------------------------------------------------------------- AlphaList& contents(); const AlphaList& contents() const; void add(Alpha& hit); static bool find(EventRecord*, AlphaColl_ch&); static bool find(EventRecord*, AlphaColl_ch&, const std::string& ); virtual std::string class_name() const; virtual Version_t class_version() const; virtual void print(std::ostream& os = std::cout) const; virtual bool postread(EventRecord* p); protected: virtual ~AlphaColl(); private: ValueVector<Alpha> container_; ClassDef(AlphaColl, 1) }; inline AlphaColl::AlphaList& AlphaColl::contents() { return container_.contents(); } inline const AlphaColl::AlphaList& AlphaColl::contents() const { return container_.contents(); } inline void AlphaColl::add(Alpha& hit) { container_.contents().push_back(hit); } #endif
/* * A Command & Conquer: Renegade SSGM Plugin, containing all the single player mission scripts * Copyright(C) 2017 Neijwiert * * This program is free software : you can redistribute it and / or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program.If not, see <http://www.gnu.org/licenses/>. */ #pragma once #include <scripts.h> /* M01 -> 102346 */ class M01_Tailgun_Run_Spawner_Controller_JDG : public ScriptImpClass { public: virtual void Register_Auto_Save_Variables(); private: virtual void Created(GameObject *obj); virtual void Custom(GameObject *obj, int type, int param, GameObject *sender); int soldierCount; bool starFirstTimeEnteredTailgunAlley; };
// // AppDelegate.h // CZJTest // // Created by isExist on 2016/9/23. // Copyright © 2016年 isExist. All rights reserved. // #import <UIKit/UIKit.h> @interface CZJTestAppDelegate : UIResponder <UIApplicationDelegate> @property (strong, nonatomic) UIWindow *window; @end
/********************************************************************* CombLayer : MCNP(X) Input builder * File: include/SimMCNP.h * * Copyright (c) 2004-2020 by Stuart Ansell * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. * ****************************************************************************/ #ifndef SimMCNP_h #define SimMCNP_h namespace Geometry { class Transform; } namespace tallySystem { class Tally; class sswTally; } namespace Surface { class Surface; } namespace physicsSystem { class PhysicsCards; } namespace ModelSupport { class ObjSurfMap; } namespace WeightSystem { class WeightMesh; class WeightControl; } namespace MonteCarlo { class Object; class Material; class Object; } /*! \class SimMCNP \version 1.3 \date February 2017 \author S.Ansell \brief Specialization of Simulation for MCNP */ class SimMCNP : public Simulation { public: typedef std::map<int,tallySystem::Tally*> TallyTYPE; ///< Tally type private: int mcnpVersion; ///< version of mcnp TallyTYPE TItem; ///< Tally Items physicsSystem::PhysicsCards* PhysPtr; ///< Physics Cards void deleteTally(); // ALL THE sub-write stuff void writeCells(std::ostream&) const; void writeSurfaces(std::ostream&) const; void writeMaterial(std::ostream&) const; void writeWeights(std::ostream&) const; void writeTransform(std::ostream&) const; void writeTally(std::ostream&) const; void writeSource(std::ostream&) const; void writePhysics(std::ostream&) const; void writeImportance(std::ostream&) const; // The Cinder Write stuff void writeCinderMat() const; public: SimMCNP(); SimMCNP(const SimMCNP&); SimMCNP& operator=(const SimMCNP&); virtual ~SimMCNP(); virtual void resetAll(); /// is the system MCNP6 bool isMCNP6() const { return mcnpVersion!=10; } // processing for Simulation virtual void removeCell(const int); // Tally processing void removeAllTally(); int removeTally(const int); int addTally(const tallySystem::Tally&); tallySystem::Tally* getTally(const int) const; tallySystem::sswTally* getSSWTally() const; /// Access tally items TallyTYPE& getTallyMap() { return TItem; } /// Access constant const TallyTYPE& getTallyMap() const { return TItem; } void setForCinder(); int nextTallyNum(int) const; virtual void setEnergy(const double); void setMCNPversion(const int); virtual void substituteAllSurface(const int,const int); virtual std::map<int,int> renumberCells(const std::vector<int>&, const std::vector<int>&); /// Get PhysicsCards physicsSystem::PhysicsCards& getPC() { return *PhysPtr; } virtual void writeCinder() const; virtual void write(const std::string&) const; }; #endif
#ifndef HEADER_LIBDEVS_H #define HEADER_LIBDEVS_H #include <stdint.h> /* * Device model */ enum fake_type { /* Device is good. */ FKTY_GOOD, /* Device is at least partially damaged. */ FKTY_BAD, /* Device discards data after a given limit. */ FKTY_LIMBO, /* Device overwrites data after a given limit. */ FKTY_WRAPAROUND, /* Device is a sequence of wraparound and limbo regions. */ FKTY_CHAIN, FKTY_MAX }; const char *fake_type_to_name(enum fake_type fake_type); int dev_param_valid(uint64_t real_size_byte, uint64_t announced_size_byte, int wrap, int block_order); enum fake_type dev_param_to_type(uint64_t real_size_byte, uint64_t announced_size_byte, int wrap, int block_order); /* * Abstract device */ struct device; /* * Properties */ uint64_t dev_get_size_byte(struct device *dev); int dev_get_block_order(struct device *dev); int dev_get_block_size(struct device *dev); /* File name of the device. * This information is important because the filename may change due to resets. */ const char *dev_get_filename(struct device *dev); /* * Methods */ /* One should use the following constant as the size of the buffer needed to * batch writes or reads. * * It must be a power of 2 greater than, or equal to 2^20. * The current vaule is 1MB. */ #define BIG_BLOCK_SIZE_BYTE (1 << 20) int dev_read_blocks(struct device *dev, char *buf, uint64_t first_pos, uint64_t last_pos); int dev_write_blocks(struct device *dev, const char *buf, uint64_t first_pos, uint64_t last_pos); int dev_reset(struct device *dev); void free_device(struct device *dev); /* * Concrete devices */ struct device *create_file_device(const char *filename, uint64_t real_size_byte, uint64_t fake_size_byte, int wrap, int block_order, int cache_order, int strict_cache, int keep_file); enum reset_type { RT_MANUAL_USB = 0, RT_USB, RT_NONE, RT_MAX }; struct device *create_block_device(const char *filename, enum reset_type rt); struct device *create_perf_device(struct device *dev); void perf_device_sample(struct device *dev, uint64_t *pread_count, uint64_t *pread_time_us, uint64_t *pwrite_count, uint64_t *pwrite_time_us, uint64_t *preset_count, uint64_t *preset_time_us); /* Detach the shadow device of @pdev, free @pdev, and return * the shadow device. */ struct device *pdev_detach_and_free(struct device *dev); struct device *create_safe_device(struct device *dev, uint64_t max_blocks, int min_memory); void sdev_recover(struct device *dev, uint64_t very_last_pos); void sdev_flush(struct device *dev); #endif /* HEADER_LIBDEVS_H */
#include <glib.h> #include <gmp.h> #include <cv.h> #include <highgui.h> #include "colourmap.h" #include "game.h" #include "result.h" #ifndef EXPERIMENT_H #define EXPERIMENT_H #define MAX_THREADS 10 typedef struct { int update_rule; int percentage; int generations; int gui; int repetitions; int graph_type; int graph_parameter_1; int graph_parameter_2; int increments; int verbose; int threaded; int position; }ExperimentFlags; gboolean experiment_validate_flags(ExperimentFlags flags); void experiment_run_simulation1(ExperimentFlags flags, game_t *game, result_t *result); result_t *experiment_run_simulation(ExperimentFlags flags); void experiment_save_results(ExperimentFlags flags, result_t *result); #endif
#include "Markup.h" char *XMLGetTag(char *Input, char **Namespace, char **TagType, char **TagData) { char *ptr, *tptr; int len=0, InTag=FALSE, TagHasName=FALSE; if (! Input) return(NULL); if (*Input=='\0') return(NULL); ptr=Input; //This ensures we are never dealing with nulls if (! *TagType) *TagType=CopyStr(*TagType,""); if (! *TagData) *TagData=CopyStr(*TagData,""); if (*ptr=='<') { ptr++; while (isspace(*ptr)) ptr++; len=0; InTag=TRUE; TagHasName=TRUE; //if we start with a slash tag, then add that to the tag name if (*ptr=='/') { *TagType=AddCharToBuffer(*TagType,len,*ptr); len++; ptr++; } while (InTag) { switch (*ptr) { //These all cause us to end. NONE OF THEM REQUIRE ptr++ //ptr++ will happen when we read tag data case '>': case '\0': case ' ': case ' ': case '\n': InTag=FALSE; break; //If a namespace return value is supplied, break the name up into namespace and //tag. Otherwise don't case ':': if (Namespace) { tptr=*TagType; if (*tptr=='/') { tptr++; len=1; } else len=0; *Namespace=CopyStr(*Namespace,tptr); } else { *TagType=AddCharToBuffer(*TagType,len,*ptr); len++; } ptr++; break; case '\r': ptr++; break; default: *TagType=AddCharToBuffer(*TagType,len,*ptr); len++; ptr++; break; } } } //End of Parse TagName. Strip any '/' tptr=*TagType; if ((len > 0) && (tptr[len-1]=='/')) tptr[len-1]='\0'; tptr[len]='\0'; while (isspace(*ptr)) ptr++; len=0; InTag=TRUE; while (InTag) { switch (*ptr) { //End of tag, skip '>' and fall through case '>': ptr++; //Start of next tag or end of text case '<': case '\0': InTag=FALSE; break; //Quotes! case '\'': case '\"': //Somewhat ugly code. If we're dealing with an actual tag, then TagHasName //will be set. This means we're dealing with data within a tag and quotes mean something. //Otherwise we are dealing with text outside of tags and we just add the char to //TagData and continue if (TagHasName) { tptr=ptr; while (*tptr != *ptr) { *TagData=AddCharToBuffer(*TagData,len,*ptr); len++; ptr++; } } *TagData=AddCharToBuffer(*TagData,len,*ptr); len++; ptr++; break; default: *TagData=AddCharToBuffer(*TagData,len,*ptr); len++; ptr++; break; } } //End of Parse TagData. Strip any '/' tptr=*TagData; if ((len > 0) && (tptr[len-1]=='/')) tptr[len-1]='\0'; tptr[len]='\0'; strlwr(*TagType); while (isspace(*ptr)) ptr++; return(ptr); } char *HtmlGetTag(char *Input, char **TagType, char **TagData) { if (! Input) return(NULL); if (*Input=='\0') return(NULL); return(XMLGetTag(Input, NULL, TagType, TagData)); } char *HtmlDeQuote(char *RetStr, char *Data) { char *Output=NULL, *Token=NULL, *ptr; int len=0; Output=CopyStr(RetStr,Output); ptr=Data; while (ptr && (*ptr != '\0')) { if (*ptr=='&') { ptr++; ptr=GetToken(ptr,";",&Token,0); if (*Token=='#') { Output=AddCharToBuffer(Output,len,strtol(Token+1,NULL,16)); len++; } else if (strcmp(Token,"amp")==0) { Output=AddCharToBuffer(Output,len,'&'); len++; } else if (strcmp(Token,"lt")==0) { Output=AddCharToBuffer(Output,len,'<'); len++; } else if (strcmp(Token,"gt")==0) { Output=AddCharToBuffer(Output,len,'>'); len++; } else if (strcmp(Token,"quot")==0) { Output=AddCharToBuffer(Output,len,'"'); len++; } else if (strcmp(Token,"apos")==0) { Output=AddCharToBuffer(Output,len,'\''); len++; } else if (strcmp(Token,"tilde")==0) { Output=AddCharToBuffer(Output,len,'~'); len++; } else if (strcmp(Token,"circ")==0) { Output=AddCharToBuffer(Output,len,'^'); len++; } } else { Output=AddCharToBuffer(Output,len,*ptr); len++; ptr++; } } DestroyString(Token); return(Output); }
/* STM32F1 Test of timer IRQ using Output Compare The board used is the ET-STM32F103 with LEDs on port B pins 8-15 A Digital test output is provided on PC0 for triggering Timer 3 is setup without output compare to provide a timed interrupt. */ /**************************************************************************** * Copyright (C) 2016 by Ken Sarkies * * ksarkies@trinity.asn.au * * * * This program is free software; you can redistribute it and/or * * modify it under the terms of the GNU General Public License as * * published bythe Free Software Foundation; either version 2 of the * * License, or (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with This program. If not, write to the * * Free Software Foundation, Inc., * * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * ***************************************************************************/ #include <libopencm3/stm32/rcc.h> #include <libopencm3/stm32/gpio.h> #include <libopencm3/stm32/timer.h> #include <libopencm3/cm3/nvic.h> #define PERIOD 1152 /* Globals */ uint32_t cntr; uint8_t v[256]; /*--------------------------------------------------------------------------*/ void clock_setup(void) { /* Setup the clock to 72MHz from the 8MHz external crystal */ rcc_clock_setup_in_hse_8mhz_out_72mhz(); } /*--------------------------------------------------------------------------*/ void gpio_setup(void) { rcc_periph_clock_enable(RCC_GPIOA); rcc_periph_clock_enable(RCC_GPIOB); rcc_periph_clock_enable(RCC_GPIOC); rcc_periph_clock_enable(RCC_AFIO); gpio_set_mode(GPIOB, GPIO_MODE_OUTPUT_2_MHZ, GPIO_CNF_OUTPUT_PUSHPULL, GPIO8 | GPIO9 | GPIO10 | GPIO11 | GPIO12 | GPIO13 | GPIO14 | GPIO15); /* Digital Test output PC0 */ gpio_set_mode(GPIOC, GPIO_MODE_OUTPUT_50_MHZ, GPIO_CNF_OUTPUT_PUSHPULL, GPIO0); } /*--------------------------------------------------------------------------*/ /* Set the timer with a 1us clock by setting the prescaler. The APB clock is prescaled from the AHB clock which is itself prescaled from the system clock (72MHz). Assume both prescales are 1. */ void timer_setup(void) { /* Enable TIM3 clock. */ rcc_periph_clock_enable(RCC_TIM3); /* Enable TIM3 interrupt. */ nvic_enable_irq(NVIC_TIM3_IRQ); timer_reset(TIM3); timer_set_mode(TIM3, TIM_CR1_CKD_CK_INT, TIM_CR1_CMS_EDGE, TIM_CR1_DIR_UP); /* Set prescaler to give 8us clock */ timer_set_prescaler(TIM3, 576); /* Set the period as 0.5 second */ timer_set_period(TIM3, 62500); /* Disable physical pin outputs. */ timer_disable_oc_output(TIM3, TIM_OC1 | TIM_OC2 | TIM_OC3 | TIM_OC4); /* Configure global mode of output channel 1, disabling the output. */ timer_disable_oc_clear(TIM3, TIM_OC1); timer_disable_oc_preload(TIM3, TIM_OC1); timer_set_oc_slow_mode(TIM3, TIM_OC1); timer_set_oc_mode(TIM3, TIM_OC1, TIM_OCM_FROZEN); /* Set the compare value for OC1. */ timer_set_oc_value(TIM3, TIM_OC1, 0); /* Continous mode. */ timer_continuous_mode(TIM3); /* ARR reload disable. */ timer_disable_preload(TIM3); /* Counter enable. */ timer_enable_counter(TIM3); /* Enable commutation interrupt. */ timer_enable_irq(TIM3, TIM_DIER_CC1IE); } /*--------------------------------------------------------------------------*/ void tim3_isr(void) { if (timer_get_flag(TIM3, TIM_SR_CC1IF)) { /* Clear compare interrupt flag. */ timer_clear_flag(TIM3, TIM_SR_CC1IF); /* Toggle LED on PB8 just to keep aware of activity and frequency. */ gpio_toggle(GPIOB, GPIO8); } } /*--------------------------------------------------------------------------*/ int main(void) { cntr = 0; clock_setup(); gpio_setup(); timer_setup(); while (1) { } return 0; }
/** * \file demoEnet.h * * \brief Function prototypes for the Ethernet */ /* * Copyright (C) 2012 Texas Instruments Incorporated - http://www.ti.com/ * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the * distribution. * * Neither the name of Texas Instruments Incorporated nor the names of * its contributors may be used to endorse or promote products derived * from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #ifndef _DEMOENET_H_ #define _DEMOENET_H_ /****************************************************************************** ** EXTERNAL VARIABLE DECLARATIONS *******************************************************************************/ /****************************************************************************** ** EXTERNAL FUNCTION PROTOTYPES *******************************************************************************/ #ifdef _TMS320C6X extern void EnetIntRegister(unsigned int, unsigned int); #else extern void EnetIntRegister(unsigned int channel); #endif extern void EnetHttpServerInit(void); extern void IpAddrDisplay(void); extern unsigned int EnetIfIsUp(void); extern unsigned int EnetLinkIsUp(void); #endif
#pragma once #include <vector> #include "storm/storage/BitVector.h" #include "storm/exceptions/InvalidArgumentException.h" namespace storm { namespace storage { class PomdpMemory { public: PomdpMemory(std::vector<storm::storage::BitVector> const& transitions, uint64_t initialState); uint64_t getNumberOfStates() const; uint64_t getInitialState() const; storm::storage::BitVector const& getTransitions(uint64_t state) const; uint64_t getNumberOfOutgoingTransitions(uint64_t state) const; std::vector<storm::storage::BitVector> const& getTransitions() const; std::string toString() const; private: std::vector<storm::storage::BitVector> transitions; uint64_t initialState; }; enum class PomdpMemoryPattern { Trivial, FixedCounter, SelectiveCounter, FixedRing, SelectiveRing, SettableBits, Full }; std::string toString(PomdpMemoryPattern const& pattern); class PomdpMemoryBuilder { public: // Builds a memory structure with the given pattern and the given number of states. PomdpMemory build(PomdpMemoryPattern pattern, uint64_t numStates) const; // Builds a memory structure that consists of just a single memory state PomdpMemory buildTrivialMemory() const; // Builds a memory structure that consists of a chain of the given number of states. // Every state has exactly one transition to the next state. The last state has just a selfloop. PomdpMemory buildFixedCountingMemory(uint64_t numStates) const; // Builds a memory structure that consists of a chain of the given number of states. // Every state has a selfloop and a transition to the next state. The last state just has a selfloop. PomdpMemory buildSelectiveCountingMemory(uint64_t numStates) const; // Builds a memory structure that consists of a ring of the given number of states. // Every state has a transition to the successor state PomdpMemory buildFixedRingMemory(uint64_t numStates) const; // Builds a memory structure that consists of a ring of the given number of states. // Every state has a transition to the successor state and a selfloop PomdpMemory buildSelectiveRingMemory(uint64_t numStates) const; // Builds a memory structure that represents floor(log(numStates)) bits that can only be set from zero to one or from zero to zero. PomdpMemory buildSettableBitsMemory(uint64_t numStates) const; // Builds a memory structure that consists of the given number of states which are fully connected. PomdpMemory buildFullyConnectedMemory(uint64_t numStates) const; }; } }
/*************************************************************************** * ncm_dataset.h * * Mon Jul 16 18:04:45 2007 * Copyright 2007 Sandro Dias Pinto Vitenti * <sandro@isoftware.com.br> ****************************************************************************/ /* * numcosmo * Copyright (C) 2012 Sandro Dias Pinto Vitenti <sandro@isoftware.com.br> * * numcosmo 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. * * numcosmo 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 _NCM_DATASET_H_ #define _NCM_DATASET_H_ #include <glib.h> #include <glib-object.h> #include <numcosmo/build_cfg.h> #include <numcosmo/math/ncm_data.h> #include <numcosmo/math/ncm_obj_array.h> G_BEGIN_DECLS #define NCM_TYPE_DATASET (ncm_dataset_get_type ()) #define NCM_DATASET(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), NCM_TYPE_DATASET, NcmDataset)) #define NCM_DATASET_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), NCM_TYPE_DATASET, NcmDatasetClass)) #define NCM_IS_DATASET(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), NCM_TYPE_DATASET)) #define NCM_IS_DATASET_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), NCM_TYPE_DATASET)) #define NCM_DATASET_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), NCM_TYPE_DATASET, NcmDatasetClass)) typedef struct _NcmDatasetClass NcmDatasetClass; typedef struct _NcmDataset NcmDataset; /** * NcmDatasetBStrapType: * @NCM_DATASET_BSTRAP_DISABLE: Bootstrap disabled. * @NCM_DATASET_BSTRAP_PARTIAL: Partial bootstrap, each #NcmData is bootstraped individually. * @NCM_DATASET_BSTRAP_TOTAL: Total bootstrap, all data is bootstraped simultaneously. * */ typedef enum _NcmDatasetBStrapType { NCM_DATASET_BSTRAP_DISABLE = 0, NCM_DATASET_BSTRAP_PARTIAL, NCM_DATASET_BSTRAP_TOTAL, /* < private > */ NCM_DATASET_BSTRAP_LEN, /*< skip >*/ } NcmDatasetBStrapType; struct _NcmDatasetClass { /*< private >*/ GObjectClass parent_class; }; /** * NcmDataSet: * * FIXME */ struct _NcmDataset { /*< private >*/ GObject parent_instance; NcmObjArray *oa; NcmDatasetBStrapType bstype; GArray *data_prob; GArray *bstrap; }; GType ncm_dataset_get_type (void) G_GNUC_CONST; NcmDataset *ncm_dataset_new (void); NcmDataset *ncm_dataset_new_list (gpointer data0, ...) G_GNUC_NULL_TERMINATED; NcmDataset *ncm_dataset_dup (NcmDataset *dset, NcmSerialize *ser); NcmDataset *ncm_dataset_ref (NcmDataset *dset); NcmDataset *ncm_dataset_copy (NcmDataset *dset); void ncm_dataset_free (NcmDataset *dset); void ncm_dataset_clear (NcmDataset **dset); guint ncm_dataset_get_length (NcmDataset *dset); guint ncm_dataset_get_n (NcmDataset *dset); guint ncm_dataset_get_dof (NcmDataset *dset); gboolean ncm_dataset_all_init (NcmDataset *dset); void ncm_dataset_append_data (NcmDataset *dset, NcmData *data); NcmData *ncm_dataset_get_data (NcmDataset *dset, guint n); NcmData *ncm_dataset_peek_data (NcmDataset *dset, guint n); guint ncm_dataset_get_ndata (NcmDataset *dset); void ncm_dataset_set_data_array (NcmDataset *dset, NcmObjArray *oa); NcmObjArray *ncm_dataset_get_data_array (NcmDataset *dset); NcmObjArray *ncm_dataset_peek_data_array (NcmDataset *dset); void ncm_dataset_resample (NcmDataset *dset, NcmMSet *mset, NcmRNG *rng); void ncm_dataset_bootstrap_set (NcmDataset *dset, NcmDatasetBStrapType bstype); void ncm_dataset_bootstrap_resample (NcmDataset *dset, NcmRNG *rng); void ncm_dataset_log_info (NcmDataset *dset); gchar *ncm_dataset_get_info (NcmDataset *dset); gboolean ncm_dataset_has_leastsquares_f (NcmDataset *dset); gboolean ncm_dataset_has_leastsquares_J (NcmDataset *dset); gboolean ncm_dataset_has_leastsquares_f_J (NcmDataset *dset); gboolean ncm_dataset_has_m2lnL_val (NcmDataset *dset); gboolean ncm_dataset_has_m2lnL_grad (NcmDataset *dset); gboolean ncm_dataset_has_m2lnL_val_grad (NcmDataset *dset); void ncm_dataset_leastsquares_f (NcmDataset *dset, NcmMSet *mset, NcmVector *f); void ncm_dataset_leastsquares_J (NcmDataset *dset, NcmMSet *mset, NcmMatrix *J); void ncm_dataset_leastsquares_f_J (NcmDataset *dset, NcmMSet *mset, NcmVector *f, NcmMatrix *J); void ncm_dataset_m2lnL_val (NcmDataset *dset, NcmMSet *mset, gdouble *m2lnL); void ncm_dataset_m2lnL_vec (NcmDataset *dset, NcmMSet *mset, NcmVector *m2lnL_v); void ncm_dataset_m2lnL_grad (NcmDataset *dset, NcmMSet *mset, NcmVector *grad); void ncm_dataset_m2lnL_val_grad (NcmDataset *dset, NcmMSet *mset, gdouble *m2lnL, NcmVector *grad); void ncm_dataset_m2lnL_i_val (NcmDataset *dset, NcmMSet *mset, guint i, gdouble *m2lnL_i); void ncm_dataset_fisher_matrix (NcmDataset *dset, NcmMSet *mset, NcmMatrix **IM); G_END_DECLS #endif /* _NCM_DATASET_H_ */
/* ======================================================================================================================= File : FrequencyCounter.cpp ----------------------------------------------------------------------------------------------------------------------- Author : Kleber Kruger Email : kleberkruger@gmail.com Reference : Fábio Iaione Date : 2014-02-02 Version : 1.0 Copyright : Faculty of Computing, FACOM - UFMS ----------------------------------------------------------------------------------------------------------------------- Description: Weather station with implementing fault tolerance ======================================================================================================================= */ #ifndef FREQUENCYCOUNTER_H_ #define FREQUENCYCOUNTER_H_ #include "mbed.h" class FrequencyCounter { public: typedef enum { TRANS_FALL, TRANS_RISE } TransType; /** * Creates the InterruptIn on the pin specified to Counter. * Modified to add debounce. * * @param pin - pin name * @param trans_type - transmission type * @param pin_mode - pin mode * @param stab_time - stabilization time (in us) */ FrequencyCounter(PinName pin, PinMode pin_mode, TransType trans_type, unsigned int stab_time); /** * Destructor. */ virtual ~FrequencyCounter(); void resetCount(); int getCount(); private: InterruptIn interrupt; Timeout timeout; DigitalIn pin; TransType trans_type; unsigned int stab_time; volatile int count; void schedule(); void increment(); }; #endif /* FREQUENCYCOUNTER_H_ */