text
stringlengths
4
6.14k
/* * Copyright (c) 2008 Travis Geiselbrecht * * Permission is hereby granted, free of charge, to any person obtaining * a copy of this software and associated documentation files * (the "Software"), to deal in the Software without restriction, * including without limitation the rights to use, copy, modify, merge, * publish, distribute, sublicense, and/or sell copies of the Software, * and to permit persons to whom the Software is furnished to do so, * subject to the following conditions: * * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #include <kernel/thread.h> #include <platform/mt_typedefs.h> #include <arch/arm/cache.h> volatile struct pl310_regs *PL310_L2CC = (struct pl310_regs *)0xC000E000; static unsigned int way_mask; static void l2_cache_sync(void) { enter_critical_section(); PL310_L2CC->CacheSync = 0; exit_critical_section(); } static void l2_inv_all(void) { /* invalidate all ways */ enter_critical_section(); PL310_L2CC->InvalidateByWay = way_mask; while (PL310_L2CC->InvalidateByWay & way_mask); PL310_L2CC->CacheSync = 0; exit_critical_section(); } void l2_clean_range(unsigned long start, unsigned long len) { unsigned long end = start + len; CACHE_ALLIGN(start); enter_critical_section(); while (start < end) { PL310_L2CC->CleanLineByPA = start; start += CACHE_LINE_SIZE; } PL310_L2CC->CacheSync = 0; exit_critical_section(); } void l2_flush_range(unsigned long start, unsigned long len) { unsigned long end = start + len; CACHE_ALLIGN(start); enter_critical_section(); PL310_L2CC->DebugControl = 0x3; while (start < end) { #if MACH_TYPE == 6575 PL310_L2CC->CleanLineByPA = start; PL310_L2CC->InvalidateLineByPA = start; #else PL310_L2CC->FlushLineByPA = start; #endif start += CACHE_LINE_SIZE; } PL310_L2CC->DebugControl = 0x0; PL310_L2CC->CacheSync = 0; exit_critical_section(); } void l2_disable(void) { unsigned long flags; // flush all PL310_L2CC->DebugControl = 0x3; PL310_L2CC->FlushByWay = way_mask; while (PL310_L2CC->FlushByWay & way_mask); PL310_L2CC->CacheSync = 0; PL310_L2CC->DebugControl = 0x0; //disable l2 PL310_L2CC->Control = 0x0; dsb(); } unsigned int get_num_ways(void) { unsigned int aux_val; unsigned int num_ways; aux_val = PL310_L2CC->AuxControl; if (aux_val & (1 << 16)) num_ways = 16; else num_ways = 8; } #define Auxiliary_VALUE 0x70000000 void arch_enable_l2cache(void) { PL310_L2CC->PowerControl = DYNAMIC_CLOCK_GATING_ENABLE; PL310_L2CC->PrefetchControl = (PL310_L2CC->PrefetchControl) | 0x40000000 ; PL310_L2CC->AuxControl = (PL310_L2CC->AuxControl & 0X8FFFFFFF) | Auxiliary_VALUE; way_mask = (1 << get_num_ways()) - 1; l2_inv_all(); PL310_L2CC->Control = 0x1; }
#include <stdio.h> #include <stdlib.h> #include "quicksort.h" int main(void){ int *arr = malloc(5 * sizeof(int)); int i; if(arr == NULL) return 1; arr[0] = 10; arr[1] = 2; arr[2] = 1; arr[3] = 30; arr[4] = 25; printf("Quick Sort\n"); printf("----------\n"); printf("\nInitial array:"); for(i = 0; i < 5; i++) printf("%d ",arr[i]); printf("\n"); quicksort(arr,0,4,5); printf("\nFinal array:"); for(i = 0; i < 5; i++) printf("%d ",arr[i]); printf("\n"); free(arr); return 0; }
#ifndef _UNISTD_H #define _UNISTD_H 1 /* This file intended to serve as a drop-in replacement for * unistd.h on Windows * Please add functionality as neeeded */ #include <stdlib.h> #include <io.h> //#include <getopt.h> /* getopt at: https://gist.github.com/ashelly/7776712 */ #include <process.h> /* for getpid() and the exec..() family */ #include <direct.h> /* for _getcwd() and _chdir() */ #define srandom srand #define random rand /* Values for the second argument to access. These may be OR'd together. */ #define R_OK 4 /* Test for read permission. */ #define W_OK 2 /* Test for write permission. */ //#define X_OK 1 /* execute permission - unsupported in windows*/ #define F_OK 0 /* Test for existence. */ #define access _access #define dup2 _dup2 #define execve _execve #define ftruncate _chsize #define unlink _unlink #define fileno _fileno #define getcwd _getcwd #define chdir _chdir #define isatty _isatty #define lseek _lseek /* read, write, and close are NOT being #defined here, because while there are file handle specific versions for Windows, they probably don't work for sockets. You need to look at your app and consider whether to call e.g. closesocket(). */ #define ssize_t int #define STDIN_FILENO 0 #define STDOUT_FILENO 1 #define STDERR_FILENO 2 /* should be in some equivalent to <sys/types.h> */ typedef __int8 int8_t; typedef __int16 int16_t; typedef __int32 int32_t; typedef __int64 int64_t; typedef unsigned __int8 uint8_t; typedef unsigned __int16 uint16_t; typedef unsigned __int32 uint32_t; typedef unsigned __int64 uint64_t; #endif /* unistd.h */
// RedMon // Copyright (c) 2014 Tiaan Louw // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE // SOFTWARE. #ifndef WINDOWS_SETTINGS_WINDOW_H_ #define WINDOWS_SETTINGS_WINDOW_H_ #include <QDialog> class QCheckBox; class QLabel; class QLineEdit; class QSlider; class SettingsWindow : public QDialog { Q_OBJECT public: explicit SettingsWindow(QWidget* parent = 0); virtual ~SettingsWindow(); private slots: void onAccepted(); void onRejected(); void onUpdateIntervalSliderChanged(); private: void setUpdateIntervalLabel(); QLineEdit* m_serverUrlEdit; QLineEdit* m_apiKeyEdit; QCheckBox* m_onlyMyIssuesCheckBox; QCheckBox* m_onlyMyTimeEntriesCheckBox; QSlider* m_updateIntervalSlider; QLabel* m_updateIntervalLabel; }; #endif // WINDOWS_SETTINGS_WINDOW_H_
//Display_Functions.h /* * Sets the display brightness depending on if the headlights are on * */ void setBrightness() { byte b = brightnessBoost; if (digitalRead(pinLightsOn)) { b = 2 * brightnessBoost; pixelBrightness = int(0.5 * brightnessBoost); if (debug == 1) { Serial.print(F("Lights on ")); Serial.println(b); } } else { b=50 * brightnessBoost; pixelBrightness = int(1.5 * brightnessBoost); if (debug == 1) { Serial.print(F("Lights off ")); Serial.println(b); } } tachoSerial.write(0x7A); tachoSerial.write((byte) b); } /* * Displays current rpm on 4 DIGIT LED * and neo ring */ void displayRpm (int rpm) { char buffer[6]; byte pixels = int (rpm / tachoStep) + pixelOffset; // needs to be a function of max tacho reading byte redLine = int (tachoRedline / tachoStep) + pixelOffset; if (rpm > 9999) { rpm /= 100; sprintf(buffer, "%3d-", rpm); // always display last digit as 0 stops jitter } else { sprintf(buffer, "%4d", int(rpm/10)*10); // always display last digit as 0 stops jitter } tachoSerial.print(buffer); if (debug == 1) { Serial.print(F("RPM ")); Serial.println(buffer); Serial.print(F("redLine ")); Serial.println(redLine); Serial.print(F("pixels ")); Serial.println(pixels); Serial.print(F("tachoStep ")); Serial.println(tachoStep); } for(byte i=pixelOffset;i<pixels;i++) { // pixels.Color takes RGB values, from 0,0,0 up to 255,255,255 tachoPixels.setPixelColor(i, tachoPixels.Color(0,0,pixelBrightness)); // blue color. if (i >= redLine) { tachoPixels.setPixelColor(i, tachoPixels.Color(pixelBrightness*2,0,0)); // red color with blue due to blue perspex. } } for(byte i=pixels;i<=(numTachoLeds + pixelOffset);i++) { // pixels.Color takes RGB values, from 0,0,0 up to 255,255,255 tachoPixels.setPixelColor(i, tachoPixels.Color(0,0,0)); // blank the pixel } tachoPixels.show(); // This sends the updated pixel color to the hardware. } /* * Setup the tacho display * */ void setupTachoDisplay() { } void buttonBrightnessPressed() { buttonBrightnessLongPress = false; Serial.println("Brightnes button pressed"); } void buttonBrightnessReleased() { if (!buttonBrightnessLongPress) { brightnessBoost++; if (brightnessBoost > 5) { brightnessBoost = 1; } } buttonBrightnessLongPress = false; Serial.println("Brightnes button released"); } void buttonBrightnessLongPressed() { brightnessBoost = 5; buttonBrightnessLongPress = true; Serial.println("Brightness button long pressed"); }
/* ------------------------------------------------------------------------- */ /* */ /* Copyright (c) 2006 The Open Group */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining a */ /* copy of this software (the "Software"), to deal in the Software without */ /* restriction, including without limitation the rights to use, copy, */ /* modify, merge, publish, distribute, sublicense, and/or sell copies of */ /* the Software, and to permit persons to whom the Software is furnished */ /* to do so, subject to the following conditions: */ /* */ /* The above copyright notice and this permission notice shall be included */ /* in all copies or substantial portions of the Software. */ /* */ /* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS */ /* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */ /* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. */ /* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */ /* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT */ /* OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR */ /* THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /* */ /* ------------------------------------------------------------------------- */ #ifndef _CMPIPL_H_ # define _CMPIPL_H_ // There are the following list of platforms # if !defined(CMPI_PLATFORM_LINUX_GENERIC_GNU) && !defined(CMPI_PLATFORM_HPUX_ACC) && \ !defined(CMPI_PLATFORM_WIN32_IX86_MSVC) && !defined(CMPI_PLATFORM_SOLARIS_SPARC_GNU) && \ !defined(CMPI_PLATFORM_SOLARIS_SPARC_CC) && !defined(CMPI_PLATFORM_AIX_RS_IBMCXX) && \ !defined(CMPI_PLATFORM_ZOS_ZSERIES_IBM) && !defined(CMPI_PLATFORM_TRU64_ALPHA_DECCXX) && \ !defined(CMPI_PLATFORM_OS400_ISERIES_IBM) && !defined(CMPI_PLATFORM_DARWIN_PPC_GNU) && \ !defined(CMPI_PLATFORM_VMS_ALPHA_DECCXX) && !defined(CMPI_PLATFORM_VMS_IA64_DECCXX) # error "You have not defined the right platform. The choices are:" # error "CMPI_PLATFORM_LINUX_GENERIC_GNU, CMPI_PLATFORM_HPUX_ACC," # error "CMPI_PLATFORM_WIN32_IX86_MSVC, CMPI_PLATFORM_SOLARIS_SPARC_GNU," # error "CMPI_PLATFORM_SOLARIS_SPARC_CC, CMPI_PLATFORM_AIX_RS_IBMCXX," # error "CMPI_PLATFORM_ZOS_ZSERIES_IBM, CMPI_PLATFORM_TRU64_ALPHA_DECCXX," # error "CMPI_PLATFORM_OS400_ISERIES_IBM, CMPI_PLATFORM_DARWIN_PPC_GNU," # error "CMPI_PLATFORM_VMS_ALPHA_DECCXX, CMPI_PLATFORM_VMS_IA64_DECCXX" # endif #endif
/**************************************************************** * * Copyright 2013, Big Switch Networks, Inc. * * Licensed under the Eclipse Public License, Version 1.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.eclipse.org/legal/epl-v10.html * * 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. * ****************************************************************/ /****************************************************************************** * * * * *****************************************************************************/ #include "biglist_int.h" int biglist_locked_free_all(biglist_locked_t* bl, void (*free_function)(void*)) { int rv; biglist_lock(bl); rv = biglist_free_all(bl->list, free_function); biglist_unlock(bl); BIGLIST_FREE(bl); return rv; }
/* * uirrnetmk3.h - RRNET MK3 UI interface for MS-DOS. * * Written by * Marco van den Heuvel <blackystardust68@yahoo.com> * * This file is part of VICE, the Versatile Commodore Emulator. * See README for copyright notice. * * 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 UIRRNETMK3_H #define UIRRNETMK3_H struct tui_menu; extern void uirrnetmk3_init(struct tui_menu *parent_submenu); #endif
/* * ircd-ratbox: A slightly useful ircd. * m_help.c: Provides help information to a user/operator. * * Copyright (C) 1990 Jarkko Oikarinen and University of Oulu, Co Center * Copyright (C) 1996-2002 Hybrid Development Team * Copyright (C) 2002-2005 ircd-ratbox development team * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 * USA * * $Id: m_help.c 20702 2005-08-31 20:59:02Z leeh $ */ #include "stdinc.h" #include "client.h" #include "ircd.h" #include "msg.h" #include "numeric.h" #include "send.h" #include "s_conf.h" #include "s_log.h" #include "parse.h" #include "modules.h" #include "hash.h" #include "cache.h" static int m_help(struct Client *, struct Client *, int, const char **); static int mo_help(struct Client *, struct Client *, int, const char **); static int mo_uhelp(struct Client *, struct Client *, int, const char **); static void dohelp(struct Client *, int, const char *); struct Message help_msgtab = { "HELP", 0, 0, 0, MFLG_SLOW, {mg_unreg, {m_help, 0}, mg_ignore, mg_ignore, mg_ignore, {mo_help, 0}} }; struct Message uhelp_msgtab = { "UHELP", 0, 0, 0, MFLG_SLOW, {mg_unreg, {m_help, 0}, mg_ignore, mg_ignore, mg_ignore, {mo_uhelp, 0}} }; mapi_clist_av1 help_clist[] = { &help_msgtab, &uhelp_msgtab, NULL }; DECLARE_MODULE_AV1(help, NULL, NULL, help_clist, NULL, NULL, "$Revision: 20702 $"); /* * m_help - HELP message handler * parv[0] = sender prefix */ static int m_help(struct Client *client_p, struct Client *source_p, int parc, const char *parv[]) { static time_t last_used = 0; /* HELP is always local */ if((last_used + ConfigFileEntry.pace_wait_simple) > CurrentTime) { /* safe enough to give this on a local connect only */ sendto_one(source_p, form_str(RPL_LOAD2HI), me.name, source_p->name, "HELP"); sendto_one(source_p, form_str(RPL_ENDOFHELP), me.name, source_p->name, (parc > 1 && !EmptyString(parv[1])) ? parv[1] : "index"); return 0; } else { last_used = CurrentTime; } dohelp(source_p, HELP_USER, parc > 1 ? parv[1] : NULL); return 0; } /* * mo_help - HELP message handler * parv[0] = sender prefix */ static int mo_help(struct Client *client_p, struct Client *source_p, int parc, const char *parv[]) { dohelp(source_p, HELP_OPER, parc > 1 ? parv[1] : NULL); return 0; } /* * mo_uhelp - HELP message handler * This is used so that opers can view the user help file without deopering * parv[0] = sender prefix */ static int mo_uhelp(struct Client *client_p, struct Client *source_p, int parc, const char *parv[]) { dohelp(source_p, HELP_USER, parc > 1 ? parv[1] : NULL); return 0; } static void dohelp(struct Client *source_p, int flags, const char *topic) { static const char ntopic[] = "index"; struct cachefile *hptr; struct cacheline *lineptr; dlink_node *ptr; dlink_node *fptr; if(EmptyString(topic)) topic = ntopic; hptr = hash_find_help(topic, flags); if(hptr == NULL) { sendto_one(source_p, form_str(ERR_HELPNOTFOUND), me.name, source_p->name, topic); return; } fptr = hptr->contents.head; lineptr = fptr->data; /* first line cant be empty */ sendto_one(source_p, form_str(RPL_HELPSTART), me.name, source_p->name, topic, lineptr->data); DLINK_FOREACH(ptr, fptr->next) { lineptr = ptr->data; sendto_one(source_p, form_str(RPL_HELPTXT), me.name, source_p->name, topic, lineptr->data); } sendto_one(source_p, form_str(RPL_ENDOFHELP), me.name, source_p->name, topic); return; }
/*************************************************************************** * TestBackup.h * * Sat Aug 12 14:01:01 2006 * Copyright 2006-2007 Chris Wilson * Email chris-boxisource@qwirx.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 _TESTBACKUP_H #define _TESTBACKUP_H #include <wx/filename.h> class TLSContext; class Configuration; class BackupStoreDirectory; #include "BackupQueries.h" #include "TestWithServer.h" class TestBackup : public TestWithServer { public: void RunTest(); static CppUnit::Test *suite(); private: void TestConfigChecks(); void TestRenameTrackedOverDeleted(); void TestVeryOldFiles(); void TestModifyExisting(); void TestExclusions(); void TestReadErrors(); void TestMinimumFileAge(); void TestBackupOfAttributes(); void TestAddMoreFiles(); void TestRenameDir(); void TestRestore(); void CleanUp(); }; void Unzip(const wxFileName& rZipFile, const wxFileName& rDestDir, bool restoreTimes = false); class wxZipEntry; std::auto_ptr<wxZipEntry> FindZipEntry(const wxFileName& rZipFile, const wxString& rFileName); void CompareBackup(const Configuration& rClientConfig, TLSContext& rTlsContext, BackupQueries::CompareParams& rParams, const wxString& rRemoteDir, const wxFileName& rLocalPath); void CompareExpectNoDifferences(const Configuration& rClientConfig, TLSContext& rTlsContext, const wxString& rRemoteDir, const wxFileName& rLocalPath); void CompareExpectDifferences(const Configuration& rClientConfig, TLSContext& rTlsContext, const wxString& rRemoteDir, const wxFileName& rLocalPath, int numDiffs, int numDiffsModTime); void CompareLocation(const Configuration& rConfig, TLSContext& rTlsContext, const std::string& rLocationName, BackupQueries::CompareParams& rParams); void CompareLocationExpectNoDifferences(const Configuration& rClientConfig, TLSContext& rTlsContext, const std::string& rLocationName, int excludedDirs, int excludedFiles); void CompareLocationExpectDifferences(const Configuration& rClientConfig, TLSContext& rTlsContext, const std::string& rLocationName, int numDiffs, int numDiffsModTime, int numUnchecked, int excludedDirs, int excludedFiles); int64_t SearchDir(BackupStoreDirectory& rDir, const std::string& rChildName); #endif /* _TESTBACKUP_H */
/* drivers/misc/fsync_control.c * * Copyright 2012 Ezekeel * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as * published by the Free Software Foundation. */ #include <linux/init.h> #include <linux/device.h> #include <linux/miscdevice.h> #define FSYNCCONTROL_VERSION 1 static bool fsync_enabled = true; bool fsynccontrol_fsync_enabled() { return fsync_enabled; } EXPORT_SYMBOL(fsynccontrol_fsync_enabled); static ssize_t fsynccontrol_status_read(struct device * dev, struct device_attribute * attr, char * buf) { return sprintf(buf, "%u\n", (fsync_enabled ? 1 : 0)); } static ssize_t fsynccontrol_status_write(struct device * dev, struct device_attribute * attr, const char * buf, size_t size) { unsigned int data; if(sscanf(buf, "%u\n", &data) == 1) { if (data == 1) { pr_info("%s: FSYNCCONTROL fsync enabled\n", __FUNCTION__); fsync_enabled = true; } else if (data == 0) { pr_info("%s: FSYNCCONTROL fsync disabled\n", __FUNCTION__); fsync_enabled = false; } else { pr_info("%s: invalid input range %u\n", __FUNCTION__, data); } } else { pr_info("%s: invalid input\n", __FUNCTION__); } return size; } static ssize_t fsynccontrol_version(struct device * dev, struct device_attribute * attr, char * buf) { return sprintf(buf, "%u\n", FSYNCCONTROL_VERSION); } static DEVICE_ATTR(fsync_enabled, S_IRUGO | S_IWUGO, fsynccontrol_status_read, fsynccontrol_status_write); static DEVICE_ATTR(version, S_IRUGO , fsynccontrol_version, NULL); static struct attribute *fsynccontrol_attributes[] = { &dev_attr_fsync_enabled.attr, &dev_attr_version.attr, NULL }; static struct attribute_group fsynccontrol_group = { .attrs = fsynccontrol_attributes, }; static struct miscdevice fsynccontrol_device = { .minor = MISC_DYNAMIC_MINOR, .name = "fsynccontrol", }; static int __init fsynccontrol_init(void) { int ret; pr_info("%s misc_register(%s)\n", __FUNCTION__, fsynccontrol_device.name); ret = misc_register(&fsynccontrol_device); if (ret) { pr_err("%s misc_register(%s) fail\n", __FUNCTION__, fsynccontrol_device.name); return 1; } if (sysfs_create_group(&fsynccontrol_device.this_device->kobj, &fsynccontrol_group) < 0) { pr_err("%s sysfs_create_group fail\n", __FUNCTION__); pr_err("Failed to create sysfs group for device (%s)!\n", fsynccontrol_device.name); } return 0; } device_initcall(fsynccontrol_init);
/* $Id: xpseudo_asm_rvct.h,v 1.1.4.1 2011/10/24 09:35:18 sadanan Exp $ */ /******************************************************************************* * * (c) Copyright 2009 Xilinx, Inc. All rights reserved. * * This file contains confidential and proprietary information of Xilinx, Inc. * and is protected under U.S. and international copyright and other * intellectual property laws. * * DISCLAIMER * This disclaimer is not a license and does not grant any rights to the * materials distributed herewith. Except as otherwise provided in a valid * license issued to you by Xilinx, and to the maximum extent permitted by * applicable law: (1) THESE MATERIALS ARE MADE AVAILABLE "AS IS" AND WITH ALL * FAULTS, AND XILINX HEREBY DISCLAIMS ALL WARRANTIES AND CONDITIONS, EXPRESS, * IMPLIED, OR STATUTORY, INCLUDING BUT NOT LIMITED TO WARRANTIES OF * MERCHANTABILITY, NON-INFRINGEMENT, OR FITNESS FOR ANY PARTICULAR PURPOSE; * and (2) Xilinx shall not be liable (whether in contract or tort, including * negligence, or under any other theory of liability) for any loss or damage * of any kind or nature related to, arising under or in connection with these * materials, including for any direct, or any indirect, special, incidental, * or consequential loss or damage (including loss of data, profits, goodwill, * or any type of loss or damage suffered as a result of any action brought by * a third party) even if such damage or loss was reasonably foreseeable or * Xilinx had been advised of the possibility of the same. * * CRITICAL APPLICATIONS * Xilinx products are not designed or intended to be fail-safe, or for use in * any application requiring fail-safe performance, such as life-support or * safety devices or systems, Class III medical devices, nuclear facilities, * applications related to the deployment of airbags, or any other applications * that could lead to death, personal injury, or severe property or * environmental damage (individually and collectively, "Critical * Applications"). Customer assumes the sole risk and liability of any use of * Xilinx products in Critical Applications, subject only to applicable laws * and regulations governing limitations on product liability. * * THIS COPYRIGHT NOTICE AND DISCLAIMER MUST BE RETAINED AS PART OF THIS FILE * AT ALL TIMES. *******************************************************************************/ /*****************************************************************************/ /** * * @file xpseudo_asm_rvct.h * * This header file contains macros for using __inline assembler code. It is * written specifically for RVCT. * * <pre> * MODIFICATION HISTORY: * * Ver Who Date Changes * ----- ---- -------- ----------------------------------------------- * 1.00a sdm 11/18/09 First Release * </pre> * ******************************************************************************/ #ifndef XPSEUDO_ASM_RVCT_H /* prevent circular inclusions */ #define XPSEUDO_ASM_RVCT_H /* by using protection macros */ /***************************** Include Files ********************************/ #ifdef __cplusplus extern "C" { #endif /* __cplusplus */ /************************** Constant Definitions ****************************/ /**************************** Type Definitions ******************************/ /***************** Macros (Inline Functions) Definitions ********************/ /* necessary for pre-processor */ #define stringify(s) tostring(s) #define tostring(s) #s /* cpsr read/write */ /*#define mfcpsr() ({ unsigned int val; \ val = register unsigned int Reg __asm("cpsr");\ val;})*/ #define mtcpsr(v) { volatile register unsigned int Reg __asm("cpsr");\ Reg = v; } /* general purpose register read/write */ /*#define mfgpr(rn) ({ unsigned int val; \ register unsigned int Reg __asm("r" stringify(rn));\ val = Reg; \ val;})*/ #define mtgpr(rn, v) { volatile register unsigned int Reg __asm("r" stringify(rn));\ Reg = v; } /* CP15 operations */ /*#define mfcp(rn) ({ unsigned int val; \ val = register unsigned int Reg __asm(rn); \ val;})*/ #define mtcp(rn, v) { volatile register unsigned int Reg __asm(rn); \ Reg = v; } \ dsb(); /************************** Variable Definitions ****************************/ /************************** Function Prototypes *****************************/ __asm void cpsiei(void); __asm void cpsidi(void); __asm void cpsief(void); __asm void cpsidf(void); /* memory synchronization operations */ /* Instruction Synchronization Barrier */ __asm void isb(void); /* Data Synchronization Barrier */ __asm void dsb(void); /* Data Memory Barrier */ __asm void dmb(void); /* Memory Operations */ __asm unsigned int ldr(unsigned int adr); __asm unsigned int ldrb(unsigned int adr); __asm void str(unsigned int adr, unsigned int val); __asm void strb(unsigned int adr, unsigned int val); /* Count leading zeroes (clz) */ __asm unsigned int clz(unsigned int arg); #ifdef __cplusplus } #endif /* __cplusplus */ #endif /* XPSEUDO_ASM_RVCT_H */
#pragma once #include "il2cpp-config.h" #ifndef _MSC_VER # include <alloca.h> #else # include <malloc.h> #endif #include <stdint.h> #include "mscorlib_System_ValueType.h" // <PrivateImplementationDetails>/$ArrayType$48 #pragma pack(push, tp, 1) struct U24ArrayTypeU2448_t735 { union { struct { union { }; }; uint8_t U24ArrayTypeU2448_t735__padding[48]; }; }; #pragma pack(pop, tp) // Native definition for marshalling of: <PrivateImplementationDetails>/$ArrayType$48 #pragma pack(push, tp, 1) struct U24ArrayTypeU2448_t735_marshaled { union { struct { union { }; }; uint8_t U24ArrayTypeU2448_t735__padding[48]; }; }; #pragma pack(pop, tp)
#ifndef __ARCH_I960_POSIX_TYPES_H #define __ARCH_I960_POSIX_TYPES_H /* * This file is generally used by user-level software, so you need to * be a little careful about namespace pollution etc. Also, we cannot * assume GCC is being used. */ /* for i960, set all int's to short's, since m68k int is 2 bytes */ typedef unsigned short __kernel_dev_t; typedef unsigned long __kernel_ino_t; typedef unsigned short __kernel_mode_t; typedef unsigned short __kernel_nlink_t; typedef long __kernel_off_t; typedef short __kernel_pid_t; typedef unsigned short __kernel_uid_t; typedef unsigned short __kernel_gid_t; typedef unsigned long __kernel_size_t; typedef short __kernel_ssize_t; typedef short __kernel_ptrdiff_t; typedef long __kernel_time_t; typedef long __kernel_clock_t; typedef short __kernel_daddr_t; typedef char * __kernel_caddr_t; #ifdef __GNUC__ typedef long long __kernel_loff_t; #endif typedef struct { #if defined(__KERNEL__) || defined(__USE_ALL) int val[2]; #else /* !defined(__KERNEL__) && !defined(__USE_ALL) */ int __val[2]; #endif /* !defined(__KERNEL__) && !defined(__USE_ALL) */ } __kernel_fsid_t; #undef __FD_SET #define __FD_SET(d, set) ((set)->fds_bits[__FDELT(d)] |= __FDMASK(d)) #undef __FD_CLR #define __FD_CLR(d, set) ((set)->fds_bits[__FDELT(d)] &= ~__FDMASK(d)) #undef __FD_ISSET #define __FD_ISSET(d, set) ((set)->fds_bits[__FDELT(d)] & __FDMASK(d)) #undef __FD_ZERO #define __FD_ZERO(fdsetp) (memset (fdsetp, 0, sizeof(*(fd_set *)fdsetp))) #endif /* __ARCH_I960_POSIX_TYPES_H */
/* Copyright (C) 1999 Free Software Foundation, Inc. Written by Thomas Bushnell, BSG. This file is part of the GNU Hurd. The GNU Hurd 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. The GNU Hurd 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, USA. */ #include "priv.h" /* Called when the last hard reference is released. If there are no links, then request soft references to be dropped. */ void _diskfs_lastref (struct node *np) { /* This is our cue that something akin to "last process closes file" in the POSIX.1 sense happened, so make sure any pending node time updates now happen in a timely fashion. */ diskfs_set_node_times (np); diskfs_lost_hardrefs (np); if (!np->dn_stat.st_nlink) { if (np->sockaddr != MACH_PORT_NULL) { mach_port_deallocate (mach_task_self (), np->sockaddr); np->sockaddr = MACH_PORT_NULL; } /* There are no links. If there are soft references that can be dropped, we can't let them postpone deallocation. So attempt to drop them. But that's a user-supplied routine, which might result in further recursive calls to the ref-counting system. This is not a problem, as we hold a weak reference ourselves. */ diskfs_try_dropping_softrefs (np); } }
/* * Copyright (c) 2009, Code Aurora Forum. All rights reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 and * only version 2 as published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. */ #ifndef AVS_H #define AVS_H #define VOLTAGE_MIN 800 /* mV */ #define VOLTAGE_MAX 1350 #define VOLTAGE_STEP 25 int __init avs_init(int (*set_vdd)(int), u32 freq_cnt, u32 freq_idx); void __exit avs_exit(void); int avs_adjust_freq(u32 freq_index, int begin); /* Routines exported from avs_hw.S */ #ifdef CONFIG_MSM_CPU_AVS u32 avs_test_delays(void); #else static inline u32 avs_test_delays(void) { return 0; } #endif #ifdef CONFIG_MSM_AVS_HW u32 avs_reset_delays(u32 avsdscr); u32 avs_get_avscsr(void); u32 avs_get_avsdscr(void); u32 avs_get_tscsr(void); void avs_set_tscsr(u32 to_tscsr); void avs_disable(void); #else static inline u32 avs_reset_delays(u32 avsdscr) { return 0; } static inline u32 avs_get_avscsr(void) { return 0; } static inline u32 avs_get_avsdscr(void) { return 0; } static inline u32 avs_get_tscsr(void) { return 0; } static inline void avs_set_tscsr(u32 to_tscsr) {} static inline void avs_disable(void) {} #endif /*#define AVSDEBUG(x...) pr_info("AVS: " x);*/ #define AVSDEBUG(...) #define AVS_DISABLE(cpu) do { \ if (get_cpu() == (cpu)) \ avs_disable(); \ put_cpu(); \ } while (0); #define AVS_ENABLE(cpu, x) do { \ if (get_cpu() == (cpu)) \ avs_reset_delays((x)); \ put_cpu(); \ } while (0); #endif /* AVS_H */
/* Copyright (C) 1993-2014 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ /* Useful declarations and support functions for MiG-generated stubs. */ #ifndef _MACH_MIG_SUPPORT_H #define _MACH_MIG_SUPPORT_H 1 #include <mach/std_types.h> #include <mach/message.h> #include <sys/types.h> #include <string.h> #ifndef __USE_GNU /* The only problem that has come up so far is __stpncpy being undeclared below because <string.h> doesn't declare it without __USE_GNU. We could work around that problem by just adding the declaration there, or by eliding the inline functions in the absence of __USE_GNU. But either of these would result in unoptimized calls (because no inline version of __stpncpy will have been defined), and there may be other niggling problems lurking. Instead we simply insist on _GNU_SOURCE for compiling mig output; anyway, that better reflects the fact that mig output requires nonstandard special support code not found elsewhere. */ # error mig stubs must be compiled with -D_GNU_SOURCE #endif /* MiG initialization. */ extern void __mig_init (void *__first); extern void mig_init (void *__first); /* Shorthand functions for vm_allocate and vm_deallocate on mach_task_self () (and with ANYWHERE=1). */ extern void __mig_allocate (vm_address_t *__addr_p, vm_size_t __size); extern void mig_allocate (vm_address_t *__addr_p, vm_size_t __size); extern void __mig_deallocate (vm_address_t __addr, vm_size_t __size); extern void mig_deallocate (vm_address_t __addr, vm_size_t __size); /* Reply-port management support functions. */ extern void __mig_dealloc_reply_port (mach_port_t); extern void mig_dealloc_reply_port (mach_port_t); extern mach_port_t __mig_get_reply_port (void); extern mach_port_t mig_get_reply_port (void); extern void __mig_put_reply_port (mach_port_t); extern void mig_put_reply_port (mach_port_t); extern void __mig_reply_setup (const mach_msg_header_t *__request, mach_msg_header_t *__reply); extern void mig_reply_setup (const mach_msg_header_t *__request, mach_msg_header_t *__reply); /* Idiocy support function. */ extern vm_size_t mig_strncpy (char *__dst, const char *__src, vm_size_t __len); extern vm_size_t __mig_strncpy (char *__dst, const char *__src, vm_size_t); #ifdef __USE_EXTERN_INLINES __extern_inline vm_size_t __mig_strncpy (char *__dst, const char *__src, vm_size_t __len) { return __stpncpy (__dst, __src, __len) - __dst; } __extern_inline vm_size_t mig_strncpy (char *__dst, const char *__src, vm_size_t __len) { return __mig_strncpy (__dst, __src, __len); } #endif #endif /* mach/mig_support.h */
/* Open a file by name. Stub version. Copyright (C) 1991-2015 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #include <errno.h> #include <fcntl.h> #include <stdarg.h> #include <stddef.h> #include <stdio.h> /* Open FILE with access OFLAG. If O_CREAT or O_TMPFILE is in OFLAG, a third argument is the file protection. */ int __libc_open (const char *file, int oflag) { int mode; if (file == NULL) { __set_errno (EINVAL); return -1; } if (__OPEN_NEEDS_MODE (oflag)) { va_list arg; va_start(arg, oflag); mode = va_arg(arg, int); va_end(arg); } __set_errno (ENOSYS); return -1; } libc_hidden_def (__libc_open) weak_alias (__libc_open, __open) libc_hidden_weak (__open) weak_alias (__libc_open, open) stub_warning (open) /* __open_2 is a generic wrapper that calls __open. So give a stub warning for that symbol too. */ stub_warning (__open_2)
/* * * (C) COPYRIGHT ARM Limited. All rights reserved. * * This program is free software and is provided to you under the terms of the * GNU General Public License version 2 as published by the Free Software * Foundation, and any use by you of this program is subject to the terms * of such GNU licence. * * A copy of the licence is included with the program, and can also be obtained * from Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301, USA. * */ #include <ump/ump.h> #include <memory.h> #include <stdio.h> static int test_ump_user_api(void) { const size_t alloc_size = 4096; ump_handle h = UMP_INVALID_MEMORY_HANDLE; ump_handle h_copy = UMP_INVALID_MEMORY_HANDLE; ump_handle h_clone = UMP_INVALID_MEMORY_HANDLE; void * mapping = NULL; ump_result ump_api_res; int result = -1; ump_secure_id id; size_t size_returned; ump_api_res = ump_open(); if (UMP_OK != ump_api_res) { return -1; } h = ump_allocate_64(alloc_size, UMP_PROT_CPU_RD | UMP_PROT_CPU_WR | UMP_PROT_X_RD | UMP_PROT_X_WR); if (UMP_INVALID_MEMORY_HANDLE == h) { goto cleanup; } id = ump_secure_id_get(h); h_clone = ump_from_secure_id(id); ump_release(h_clone); h_clone = UMP_INVALID_MEMORY_HANDLE; h_copy = h; ump_retain(h_copy); ump_release(h_copy); h_copy = UMP_INVALID_MEMORY_HANDLE; mapping = ump_map(h, 0, alloc_size); if (NULL == mapping) { goto cleanup; } memset(mapping, 0, alloc_size); ump_cpu_msync_now(h, UMP_MSYNC_CLEAN, mapping, alloc_size); ump_cpu_msync_now(h, UMP_MSYNC_CLEAN_AND_INVALIDATE, mapping, alloc_size); ump_unmap(h, mapping, alloc_size); result = 0; cleanup: ump_release(h); h = UMP_INVALID_MEMORY_HANDLE; ump_close(); return result; }
#ifndef MTX_MKVTOOLNIX_GUI_HEADER_EDITOR_TAB_H #define MTX_MKVTOOLNIX_GUI_HEADER_EDITOR_TAB_H #include "common/common_pch.h" #include <QDateTime> #include "common/qt_kax_analyzer.h" #include "mkvtoolnix-gui/header_editor/page_model.h" class QAction; class QMenu; namespace mtx { namespace gui { namespace HeaderEditor { namespace Ui { class Tab; } using KaxAttachedPtr = std::shared_ptr<KaxAttached>; class AttachmentsPage; class Tab : public QWidget { Q_OBJECT; protected: // UI stuff: std::unique_ptr<Ui::Tab> ui; QString m_fileName; std::unique_ptr<QtKaxAnalyzer> m_analyzer; QDateTime m_fileModificationTime; PageModel *m_model; PageBase *m_segmentinfoPage{}; AttachmentsPage *m_attachmentsPage{}; QMenu *m_treeContextMenu; QAction *m_expandAllAction, *m_collapseAllAction, *m_addAttachmentsAction, *m_removeAttachmentAction, *m_saveAttachmentContentAction, *m_replaceAttachmentContentAction, *m_replaceAttachmentContentSetValuesAction; std::shared_ptr<EbmlElement> m_eSegmentInfo, m_eTracks; public: explicit Tab(QWidget *parent, QString const &fileName); ~Tab(); PageModel *model() const; virtual bool hasBeenModified(); virtual void retranslateUi(); virtual void appendPage(PageBase *page, QModelIndex const &parentIdx = {}); virtual QString const &fileName() const; virtual QString title() const; virtual void validate(); virtual void addAttachment(KaxAttachedPtr const &attachment); signals: void removeThisTab(); public slots: virtual void showTreeContextMenu(QPoint const &pos); virtual void selectionChanged(QModelIndex const &current, QModelIndex const &previous); virtual void load(); virtual void save(); virtual void expandAll(); virtual void collapseAll(); virtual void selectAttachmentsAndAdd(); virtual void addAttachments(QStringList const &fileNames); virtual void removeSelectedAttachment(); virtual void saveAttachmentContent(); virtual void replaceAttachmentContent(bool deriveNameAndMimeType); virtual void handleDroppedFiles(QStringList const &fileNames, Qt::MouseButtons mouseButtons); protected: void setupUi(); void handleSegmentInfo(kax_analyzer_data_c const &data); void handleTracks(kax_analyzer_data_c const &data); void handleAttachments(); void populateTree(); void resetData(); void doModifications(); void expandCollapseAll(bool expand); void reportValidationFailure(bool isCritical, QModelIndex const &pageIdx); PageBase *currentlySelectedPage() const; KaxAttachedPtr createAttachmentFromFile(QString const &fileName); public: static memory_cptr readFileData(QWidget *parent, QString const &fileName); }; }}} #endif // MTX_MKVTOOLNIX_GUI_HEADER_EDITOR_TAB_H
#ifndef _TVIDEOCODECLIBMPEG2_H_ #define _TVIDEOCODECLIBMPEG2_H_ #include "TvideoCodec.h" #include "libmpeg2/include/mpeg2.h" class Tdll; struct Textradata; class TccDecoder; class TvideoCodecLibmpeg2 : public TvideoCodecDec { private: Tdll *dll; uint32_t (*mpeg2_set_accel)(uint32_t accel); mpeg2dec_t* (*mpeg2_init)(void); const mpeg2_info_t* (*mpeg2_info)(mpeg2dec_t *mpeg2dec); mpeg2_state_t (*mpeg2_parse)(mpeg2dec_t *mpeg2dec); void (*mpeg2_buffer)(mpeg2dec_t *mpeg2dec, const uint8_t *start, const uint8_t *end); void (*mpeg2_close)(mpeg2dec_t *mpeg2dec); void (*mpeg2_reset)(mpeg2dec_t *mpeg2dec, int full_reset); void (*mpeg2_set_rtStart)(mpeg2dec_t *mpeg2dec, int64_t rtStart); int (*mpeg2_guess_aspect)(const mpeg2_sequence_t * sequence, unsigned int * pixel_width, unsigned int * pixel_height); mpeg2dec_t *mpeg2dec; const mpeg2_info_t *info; bool wait4Iframe; int sequenceFlag; REFERENCE_TIME avgTimePerFrame; TffPict oldpict; Textradata *extradata; TccDecoder *ccDecoder; Tbuffer *buffer; uint32_t oldflags; bool m_fFilm; int SetDeinterlaceMethod(void); void init(void); HRESULT decompressI(const unsigned char *src, size_t srcLen, IMediaSample *pIn); protected: virtual bool beginDecompress(TffPictBase &pict, FOURCC infcc, const CMediaType &mt, int sourceFlags); public: TvideoCodecLibmpeg2(IffdshowBase *Ideci, IdecVideoSink *Isink); virtual ~TvideoCodecLibmpeg2(); static const char_t *dllname; virtual int getType(void) const { return IDFF_MOVIE_LIBMPEG2; } virtual int caps(void) const { return CAPS::VIS_QUANTS; } virtual void end(void); virtual HRESULT decompress(const unsigned char *src, size_t srcLen, IMediaSample *pIn); virtual bool onSeek(REFERENCE_TIME segmentStart); virtual HRESULT BeginFlush(); }; #endif
#ifndef __ASMPARISC_AUXVEC_H #define __ASMPARISC_AUXVEC_H #endif
/* * Copyright (c) 2009, 2011 Pekka Enberg * * This file is released under the 2-clause BSD license. Please refer to the * file LICENSE for details. */ #include "runtime/sun_misc_Unsafe.h" #include "jit/exception.h" #include "arch/atomic.h" #include "vm/reflection.h" #include "vm/preload.h" #include "vm/object.h" #include "vm/class.h" #include "vm/jni.h" jint sun_misc_Unsafe_arrayBaseOffset(jobject this, jobject class) { return VM_ARRAY_ELEMS_OFFSET; } jint sun_misc_Unsafe_arrayIndexScale(jobject this, jobject class) { struct vm_class *array_class; struct vm_class *elem_class; int elem_type; array_class = vm_class_get_class_from_class_object(class); elem_class = vm_class_get_array_element_class(array_class); elem_type = vm_class_get_storage_vmtype(elem_class); return vmtype_get_size(elem_type); } jint sun_misc_Unsafe_getIntVolatile(jobject this, jobject obj, jlong offset) { jint *value_p = (void *) obj + offset; jint ret; ret = *value_p; mb(); return ret; } jlong sun_misc_Unsafe_getLongVolatile(jobject this, jobject obj, jlong offset) { jlong *value_p = (void *) obj + offset; jlong ret; ret = *value_p; mb(); return ret; } jobject sun_misc_Unsafe_getObjectVolatile(jobject this, jobject obj, jlong offset) { struct vm_object **value_p = (void *) obj + offset; jobject ret; ret = *value_p; mb(); return ret; } jlong sun_misc_Unsafe_objectFieldOffset(jobject this, jobject field) { struct vm_field *vmf; if (vm_java_lang_reflect_VMField != NULL) { /* Classpath 0.98 */ field = field_get_object(field, vm_java_lang_reflect_Field_f); } vmf = vm_object_to_vm_field(field); if (!vmf) return 0; return VM_OBJECT_FIELDS_OFFSET + vmf->offset; } void sun_misc_Unsafe_putIntVolatile(jobject this, jobject obj, jlong offset, jint value) { jint *value_p = (void *) obj + offset; mb(); *value_p = value; } void sun_misc_Unsafe_putLong(jobject this, jobject obj, jlong offset, jlong value) { jlong *value_p = (void *) obj + offset; *value_p = value; } void sun_misc_Unsafe_putLongVolatile(jobject this, jobject obj, jlong offset, jlong value) { jlong *value_p = (void *) obj + offset; mb(); *value_p = value; } void sun_misc_Unsafe_putObject(jobject this, jobject obj, jlong offset, jobject value) { struct vm_object **value_p = (void *) obj + offset; *value_p = value; } void sun_misc_Unsafe_putObjectVolatile(jobject this, jobject obj, jlong offset, jobject value) { struct vm_object **value_p = (void *) obj + offset; mb(); *value_p = value; } jint native_unsafe_compare_and_swap_int(struct vm_object *this, struct vm_object *obj, jlong offset, jint expect, jint update) { void *p = (void *) obj + offset; return cmpxchg_32(p, (uint32_t)expect, (uint32_t)update) == (uint32_t)expect; } jint native_unsafe_compare_and_swap_long(struct vm_object *this, struct vm_object *obj, jlong offset, jlong expect, jlong update) { void *p = (void *) obj + offset; return cmpxchg_64(p, (uint64_t)expect, (uint64_t)update) == (uint64_t)expect; } jint native_unsafe_compare_and_swap_object(struct vm_object *this, struct vm_object *obj, jlong offset, struct vm_object *expect, struct vm_object *update) { void *p = (void *) obj + offset; return cmpxchg_ptr(p, expect, update) == expect; } void native_unsafe_park(struct vm_object *this, jboolean isAbsolute, jlong timeout) { struct vm_thread *self = vm_thread_self(); struct timespec timespec; pthread_mutex_lock(&self->park_mutex); if (self->unpark_called) { self->unpark_called = false; pthread_mutex_unlock(&self->park_mutex); return; } if (timeout == 0) { pthread_cond_wait(&self->park_cond, &self->park_mutex); } else { /* If isAbsolute == true then timeout is in * miliseconds otherwise in nanoseconds. */ if (isAbsolute) { timespec.tv_sec = timeout / 1000l; timespec.tv_nsec = timeout % 1000l; } else { clock_gettime(CLOCK_REALTIME, &timespec); timespec.tv_sec += timeout / 1000000000l; timespec.tv_nsec += timeout % 1000000000l; } pthread_cond_timedwait(&self->park_cond, &self->park_mutex, &timespec); } if (self->unpark_called) { self->unpark_called = false; } pthread_mutex_unlock(&self->park_mutex); } void native_unsafe_unpark(struct vm_object *this, struct vm_object *vmthread) { struct vm_thread *thread; thread = vm_thread_from_java_thread(vmthread); pthread_mutex_lock(&thread->park_mutex); thread->unpark_called = true; pthread_cond_signal(&thread->park_cond); pthread_mutex_unlock(&thread->park_mutex); }
/* $Id: bootstr.c,v 1.1.1.1 2007-05-25 06:50:19 bruce Exp $ * bootstr.c: Boot string/argument acquisition from the PROM. * * Copyright(C) 1995 David S. Miller (davem@caip.rutgers.edu) */ #include <linux/string.h> #include <asm/oplib.h> #include <asm/sun4prom.h> #include <linux/init.h> #define BARG_LEN 256 static char barg_buf[BARG_LEN] = { 0 }; static char fetched __initdata = 0; extern linux_sun4_romvec *sun4_romvec; char * __init prom_getbootargs(void) { int iter; char *cp, *arg; /* This check saves us from a panic when bootfd patches args. */ if (fetched) { return barg_buf; } switch(prom_vers) { case PROM_V0: case PROM_SUN4: cp = barg_buf; /* Start from 1 and go over fd(0,0,0)kernel */ for(iter = 1; iter < 8; iter++) { arg = (*(romvec->pv_v0bootargs))->argv[iter]; if(arg == 0) break; while(*arg != 0) { /* Leave place for space and null. */ if(cp >= barg_buf + BARG_LEN-2){ /* We might issue a warning here. */ break; } *cp++ = *arg++; } *cp++ = ' '; } *cp = 0; break; case PROM_V2: case PROM_V3: /* * V3 PROM cannot supply as with more than 128 bytes * of an argument. But a smart bootstrap loader can. */ strlcpy(barg_buf, *romvec->pv_v2bootargs.bootargs, sizeof(barg_buf)); break; default: break; } fetched = 1; return barg_buf; }
/* guestfish - guest filesystem shell * Copyright (C) 2010-2015 Red Hat 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ #include <config.h> #include <stdio.h> #include <stdlib.h> #include <stdarg.h> #include <string.h> #include <unistd.h> #include <libintl.h> #include "fish.h" #include "prepopts.h" void prep_prelaunch_part (const char *filename, prep_data *data) { if (alloc_disk (filename, data->params[0], 0, 1) == -1) prep_error (data, filename, _("failed to allocate disk")); } void prep_postlaunch_part (const char *filename, prep_data *data, const char *device) { if (guestfs_part_disk (g, device, data->params[1]) == -1) prep_error (data, filename, _("failed to partition disk: %s"), guestfs_last_error (g)); }
/******************************************************************************/ /* Copyright (c) Crackerjack Project., 2007 */ /* */ /* 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 */ /* */ /* History: Porting from Crackerjack to LTP is done by */ /* Manas Kumar Nayak maknayak@in.ibm.com> */ /******************************************************************************/ /******************************************************************************/ /* Description: This tests the rt_sigaction() syscall */ /* rt_sigaction Expected EINVAL error check */ /******************************************************************************/ #include <stdio.h> #include <stdlib.h> #include <unistd.h> #include <signal.h> #include <errno.h> #include <sys/syscall.h> #include <string.h> #include "test.h" #include "usctest.h" #include "linux_syscall_numbers.h" #include "lapi/rt_sigaction.h" #define INVAL_SIGSETSIZE -1 char *TCID = "rt_sigaction03"; static int testno; int TST_TOTAL = 1; static void cleanup(void) { TEST_CLEANUP; tst_rmdir(); } static void setup(void) { TEST_PAUSE; tst_tmpdir(); } static int test_flags[] = { SA_RESETHAND | SA_SIGINFO, SA_RESETHAND, SA_RESETHAND | SA_SIGINFO, SA_RESETHAND | SA_SIGINFO, SA_NOMASK }; char *test_flags_list[] = { "SA_RESETHAND|SA_SIGINFO", "SA_RESETHAND", "SA_RESETHAND|SA_SIGINFO", "SA_RESETHAND|SA_SIGINFO", "SA_NOMASK" }; static struct test_case_t { int exp_errno; char *errdesc; } test_cases[] = { { EINVAL, "EINVAL"} }; static void handler(int sig) { tst_resm(TINFO, "Signal Handler Called with signal number %d\n", sig); return; } static int set_handler(int sig, int sig_to_mask, int mask_flags) { struct sigaction sa, oldaction; sa.sa_sigaction = (void *)handler; sa.sa_flags = mask_flags; sigemptyset(&sa.sa_mask); sigaddset(&sa.sa_mask, sig_to_mask); /* * * long sys_rt_sigaction (int sig, const struct sigaction *act, * * truct sigaction *oact, size_t sigsetsize); * * EINVAL: * * sigsetsize was not equivalent to the size of a sigset_t type * */ return ltp_rt_sigaction(sig, &sa, &oldaction, INVAL_SIGSETSIZE); } int main(int ac, char **av) { unsigned int flag; int signal; int lc; const char *msg; msg = parse_opts(ac, av, NULL, NULL); if (msg != NULL) tst_brkm(TBROK, NULL, "OPTION PARSING ERROR - %s", msg); setup(); for (lc = 0; TEST_LOOPING(lc); ++lc) { tst_count = 0; for (testno = 0; testno < TST_TOTAL; ++testno) { for (signal = SIGRTMIN; signal <= (SIGRTMAX); signal++) { tst_resm(TINFO, "Signal %d", signal); for (flag = 0; flag < (sizeof(test_flags) / sizeof(test_flags[0])); flag++) { TEST(set_handler (signal, 0, test_flags[flag])); if ((TEST_RETURN == -1) && (TEST_ERRNO == test_cases[0].exp_errno)) { tst_resm(TINFO, "sa.sa_flags = %s ", test_flags_list[flag]); tst_resm(TPASS, "%s failure with sig: %d as expected errno = %s : %s", TCID, signal, test_cases[0].errdesc, strerror(TEST_ERRNO)); } else { tst_resm(TFAIL, "rt_sigaction call succeeded: result = %ld got error %d:but expected %d", TEST_RETURN, TEST_ERRNO, test_cases[0]. exp_errno); tst_resm(TINFO, "sa.sa_flags = %s ", test_flags_list[flag]); } } } } } cleanup(); tst_exit(); }
/* * Samsung Exynos5 SoC series Sensor driver * * * Copyright (c) 2011 Samsung Electronics Co., Ltd * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as * published by the Free Software Foundation. */ #ifndef FIMC_IS_DEVICE_OV5670_H #define FIMC_IS_DEVICE_OV5670_H #define SENSOR_OV5670_INSTANCE 1 #define SENSOR_OV5670_NAME SENSOR_NAME_OV5670 int sensor_ov5670_probe(struct platform_device *pdev); #endif
/* * Copyright 2007, Intel Corporation * * This file is part of PowerTOP * * This program file is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the * Free Software Foundation; version 2 of the License. * * This program is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * for more details. * * You should have received a copy of the GNU General Public License * along with this program in a file named COPYING; if not, write to the * Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301 USA * * Authors: * Arjan van de Ven <arjan@linux.intel.com> */ #include <unistd.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <stdint.h> #include <sys/types.h> #include <dirent.h> #include <assert.h> #include "powertop.h" struct device_data; struct device_data { struct device_data *next; char pathname[4096]; char human_name[4096]; uint64_t urbs, active, connected; uint64_t previous_urbs, previous_active, previous_connected; int controller; }; static struct device_data *devices; static void cachunk_urbs(void) { struct device_data *ptr; ptr = devices; while (ptr) { ptr->previous_urbs = ptr->urbs; ptr->previous_active = ptr->active; ptr->previous_connected = ptr->connected; ptr = ptr->next; } } static void update_urbnum(char *path, uint64_t count, char *shortname) { struct device_data *ptr; FILE *file; char fullpath[4096]; char name[4096], vendor[4096]; ptr = devices; while (ptr) { if (strcmp(ptr->pathname, path)==0) { ptr->urbs = count; sprintf(fullpath, "%s/power/active_duration", path); file = fopen(fullpath, "r"); if (!file) return; fgets(name, 4096, file); ptr->active = strtoull(name, NULL, 10); fclose(file); sprintf(fullpath, "%s/power/connected_duration", path); file = fopen(fullpath, "r"); if (!file) return; fgets(name, 4096, file); ptr->connected = strtoull(name, NULL, 10); fclose(file); return; } ptr = ptr->next; } /* no luck, new one */ ptr = malloc(sizeof(struct device_data)); assert(ptr!=0); memset(ptr, 0, sizeof(struct device_data)); ptr->next = devices; devices = ptr; strcpy(ptr->pathname, path); ptr->urbs = ptr->previous_urbs = count; sprintf(fullpath, "%s/product", path); file = fopen(fullpath, "r"); memset(name, 0, 4096); if (file) { fgets(name, 4096, file); fclose(file); } sprintf(fullpath, "%s/manufacturer", path); file = fopen(fullpath, "r"); memset(vendor, 0, 4096); if (file) { fgets(vendor, 4096, file); fclose(file); } if (strlen(name)>0 && name[strlen(name)-1]=='\n') name[strlen(name)-1]=0; if (strlen(vendor)>0 && vendor[strlen(vendor)-1]=='\n') vendor[strlen(vendor)-1]=0; /* some devices have bogus names */ if (strlen(name)<4) strcpy(ptr->human_name, path); else sprintf(ptr->human_name, _("USB device %4s : %s (%s)"), shortname, name, vendor); if (strstr(ptr->human_name, "Host Controller")) ptr->controller = 1; } void count_usb_urbs(void) { DIR *dir; struct dirent *dirent; FILE *file; char filename[PATH_MAX]; char pathname[PATH_MAX]; char buffer[4096]; struct device_data *dev; int len; char linkto[PATH_MAX]; dir = opendir("/sys/bus/usb/devices"); if (!dir) return; cachunk_urbs(); while ((dirent = readdir(dir))) { if (dirent->d_name[0]=='.') continue; /* skip usb input devices */ sprintf(filename, "/sys/bus/usb/devices/%s/driver", dirent->d_name); len = readlink(filename, linkto, sizeof(link) - 1); if (strstr(linkto, "usbhid")) continue; sprintf(pathname, "/sys/bus/usb/devices/%s", dirent->d_name); sprintf(filename, "%s/urbnum", pathname); file = fopen(filename, "r"); if (!file) continue; memset(buffer, 0, 4096); fgets(buffer, 4095, file); update_urbnum(pathname, strtoull(buffer, NULL, 10), dirent->d_name); fclose(file); } closedir(dir); dev = devices; while (dev) { if (dev->urbs != dev->previous_urbs) { push_line(dev->human_name, dev->urbs - dev->previous_urbs); } dev = dev->next; } } void display_usb_activity(void) { struct device_data *dev; printf("\n"); printf("%s\n", _("Recent USB suspend statistics")); printf("%s\n", _("Active Device name")); dev = devices; while (dev) { printf("%5.1f%%\t%s\n", 100.0*(dev->active - dev->previous_active) / (0.00001 + dev->connected - dev->previous_connected), dev->human_name); dev = dev->next; } } void usb_activity_hint(void) { int total_active = 0; int pick; struct device_data *dev; dev = devices; while (dev) { if (dev->active-1 > dev->previous_active && !dev->controller) total_active++; dev = dev->next; } if (!total_active) return; pick = rand() % total_active; total_active = 0; dev = devices; while (dev) { if (dev->active-1 > dev->previous_active && !dev->controller) { if (total_active == pick) { char usb_hint[8000]; sprintf(usb_hint, _("A USB device is active %4.1f%% of the time:\n%s"), 100.0*(dev->active - dev->previous_active) / (0.00001 + dev->connected - dev->previous_connected), dev->human_name); add_suggestion(usb_hint, 1, 'U', _(" U - Enable USB suspend "), activate_usb_autosuspend); } total_active++; } dev = dev->next; } }
#ifndef __LINUX_COMPILER_H #error "Please don't include <linux/compiler-gcc4.h> directly, include <linux/compiler.h> instead." #endif /* GCC 4.1.[01] miscompiles __weak */ #ifdef __KERNEL__ # if __GNUC_MINOR__ == 1 && __GNUC_PATCHLEVEL__ <= 1 # error Your version of gcc miscompiles the __weak directive # endif #endif #define __used __attribute__((__used__)) #define __must_check __attribute__((warn_unused_result)) #define __compiler_offsetof(a,b) __builtin_offsetof(a,b) #if __GNUC_MINOR__ >= 3 /* Mark functions as cold. gcc will assume any path leading to a call to them will be unlikely. This means a lot of manual unlikely()s are unnecessary now for any paths leading to the usual suspects like BUG(), printk(), panic() etc. [but let's keep them for now for older compilers] Early snapshots of gcc 4.3 don't support this and we can't detect this in the preprocessor, but we can live with this because they're unreleased. Maketime probing would be overkill here. gcc also has a __attribute__((__hot__)) to move hot functions into a special section, but I don't see any sense in this right now in the kernel context */ #define __cold __attribute__((__cold__)) #define __UNIQUE_ID(prefix) __PASTE(__PASTE(__UNIQUE_ID_, prefix), __COUNTER__) #if __GNUC_MINOR__ >= 5 /* * Mark a position in code as unreachable. This can be used to * suppress control flow warnings after asm blocks that transfer * control elsewhere. * * Early snapshots of gcc 4.5 don't support this and we can't detect * this in the preprocessor, but we can live with this because they're * unreleased. Really, we need to have autoconf for the kernel. */ #define unreachable() __builtin_unreachable() /* Mark a function definition as prohibited from being cloned. */ #define __noclone __attribute__((__noclone__)) #endif #endif #if __GNUC_MINOR__ > 0 #define __compiletime_object_size(obj) __builtin_object_size(obj, 0) #endif #if __GNUC_MINOR__ >= 4 && !defined(__CHECKER__) #define __compiletime_warning(message) __attribute__((warning(message))) #define __compiletime_error(message) __attribute__((error(message))) #endif
// // RootTabBarController.h // Seafood // // Created by btw on 14/12/9. // Copyright (c) 2014年 beautyway. All rights reserved. // #import <UIKit/UIKit.h> /** * 根标签栏控制器,一切普通签栏控制器都继承此类。 */ @interface RootTabBarController : UITabBarController @end
/* * This file is part of the coreboot project. * * Copyright (C) 2007 Uwe Hermann <uwe@hermann-uwe.de> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. */ #include <arch/pirq_routing.h> static const struct irq_routing_table intel_irq_routing_table = { PIRQ_SIGNATURE, PIRQ_VERSION, 32 + 16 * CONFIG_IRQ_SLOT_COUNT,/* Max. number of devices on the bus */ 0x00, /* Interrupt router bus */ (0x1f << 3) | 0x0, /* Interrupt router device */ 0x1c00, /* IRQs devoted exclusively to PCI usage */ 0x8086, /* Vendor */ 0x7000, /* Device */ 0, /* Miniport data */ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, /* u8 rfu[11] */ 0x1a, /* Checksum */ { /* bus, dev|fn, {link, bitmap}, {link, bitmap}, {link, bitmap}, {link, bitmap}, slot, rfu */ {0x00,(0x1e<<3)|0x0, {{0x60, 0xdeb8}, {0x61, 0xdeb8}, {0x62, 0xdeb8}, {0x63, 0x0deb8}}, 0x1, 0x0}, {0x00,(0x10<<3)|0x0, {{0x61, 0xdeb8}, {0x62, 0xdeb8}, {0x63, 0xdeb8}, {0x60, 0x0deb8}}, 0x2, 0x0}, {0x00,(0x01<<3)|0x0, {{0x60, 0xdeb8}, {0x61, 0xdeb8}, {0x62, 0xdeb8}, {0x63, 0x0deb8}}, 0x0, 0x0}, {0x00,(0x1f<<3)|0x1, {{0x60, 0xdeb8}, {0x61, 0xdeb8}, {0x62, 0xdeb8}, {0x63, 0x0deb8}}, 0x0, 0x0}, } }; unsigned long write_pirq_routing_table(unsigned long addr) { return copy_pirq_routing_table(addr, &intel_irq_routing_table); }
#ifndef __REG_BLE_EM_WPB_H_ #define __REG_BLE_EM_WPB_H_ #define REG_BLE_EM_WPB_SIZE 6 #define REG_BLE_EM_WPB_BASE_ADDR 0x80000 #endif // __REG_BLE_EM_WPB_H_
// Combined include file for esp8266 // Actually misnamed, as it also works for ESP32. // ToDo: Figure out better name #include <ctype.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <user_interface.h> #ifdef FREERTOS #include <stdint.h> #ifdef ESP32 #include <esp_common.h> #else #include <espressif/esp_common.h> #endif #else #include <c_types.h> #include <ip_addr.h> #include <espconn.h> #include <ets_sys.h> #include <gpio.h> #include <mem.h> #include <osapi.h> #include <upgrade.h> #endif #include "platform.h" #include "espmissingincludes.h"
/*************************************************************************** z80daisy.h Z80/180 daisy chaining support functions. ***************************************************************************/ #ifndef Z80DAISY_H #define Z80DAISY_H /* daisy-chain link */ struct z80_irq_daisy_chain { void (*reset)(int); /* reset callback */ int (*irq_state)(int); /* get interrupt state */ int (*irq_ack)(int); /* interrupt acknowledge callback */ void (*irq_reti)(int); /* reti callback */ int param; /* callback parameter (-1 ends list) */ }; /* these constants are returned from the irq_state function */ #define Z80_DAISY_INT 0x01 /* interrupt request mask */ #define Z80_DAISY_IEO 0x02 /* interrupt disable mask (IEO) */ /* prototypes */ void z80daisy_reset(const struct z80_irq_daisy_chain *daisy); int z80daisy_update_irq_state(const struct z80_irq_daisy_chain *chain); int z80daisy_call_ack_device(const struct z80_irq_daisy_chain *chain); void z80daisy_call_reti_device(const struct z80_irq_daisy_chain *chain); #endif
/* * Copyright (c) Eicon Networks, 2005. * This source file is supplied for the use with Eicon Networks range of DIVA Server Adapters. * Eicon File Revision : 2.1 * This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY OF ANY KIND WHATSOEVER INCLUDING ANY implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. * You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * */ #include <platform.h> #include <stdio.h> #include <stdlib.h> #include <string.h> /* * make "dimaint.h" working */ #include "dimaint.h" #include "dbgioctl.h" /******************************************************************************/ extern void capiAnalyse (FILE *out, XLOG *msg) ; /******************************************************************************/ static void putAsc (FILE *out, unsigned char *data, int addr, int len) { char buffer[80] ; int i, j, ch ; if ( len > 16 ) len = 16 ; if ( len <= 0 ) return ; memset (&buffer[0], ' ', sizeof(buffer)) ; sprintf (&buffer[0], "\n 0x%04lx ", (long)addr) ; for ( i = 0, j = 11 ; i < len ; ++i, j += 3 ) { sprintf ((char *)&buffer[(i / 4) + j], "%02X", data[i]) ; buffer[(i / 4) + j + 2] = (char)' ' ; ch = data[i] & 0x007F ; if ( (ch < ' ') || (ch == 0x7F) ) buffer[63 + i] = (char)'.' ; else buffer[63 + i] = (char)ch ; } buffer[79] = '\0' ; fputs (&buffer[0], out) ; } /*****************************************************************************/ void dilogAnalyse (FILE *out, DbgMessage *msg, int DilogFormat) { XLOG *xp ; char direction, tmp[MSG_FRAME_MAX_SIZE] ; dword type, framelen, headlen, datalen, dumplen, i ; int channel ; /* * Check length of traditional xlog format */ switch (msg->size) { case 0: fputs ("- malformed empty xlog format\n", out) ; return ; case 1: fprintf (out, "- malformed xlog format: 0x%02X\n", msg->data[0]) ; return ; case 2: fprintf (out, "- malformed xlog format: 0x%02X 0x%02X\n", msg->data[0], msg->data[1]) ; return ; default: break ; } xp = (XLOG *)&msg->data[0] ; type = xp->code & 0x00FF ; /* * Log B-channel traffic here, pass any other stuff to Xlog() */ if ( (msg->size >= 4) && ((type == 1) || (type == 2)) ) { direction = (type == 1) ? 'X' : 'R' ; channel = (signed char)((xp->code >> 8) & 0x00ff) ; framelen = xp->info.l1.length ; headlen = (unsigned long)&((XLOG *)0)->info.l1.i[0] ; datalen = ( msg->size > headlen ) ? (msg->size - headlen) : 0 ; if ( datalen > framelen ) datalen = framelen ; if ( channel >= 0 ) fprintf (out, "B%d-%c(%03d) ", channel, direction, framelen) ; else fprintf (out, "B-%d-%c(%03d) ", ~channel, direction, framelen) ; if ( datalen == 0 ) { fputs (" 0 bytes\n", out) ; return ; } dumplen = datalen ; if ( dumplen > 28 ) dumplen = 28 ; if ( DilogFormat ) { for ( i = 0; i < dumplen; i++ ) fprintf (out, "%02X ", xp->info.l1.i[i]) ; if ( framelen > dumplen ) fputs ("cont", out) ; fputs ("\n", out) ; return ; } /* * Output raw data */ fprintf (out, "%d bytes", dumplen) ; for ( i = 0 ; i < dumplen ; i += 16 ) { putAsc (out, &xp->info.l1.i[i], i, dumplen - i) ; } fputs ("\n", out) ; return ; } /* * use traditional dilog interpreter */ if ( type ) { /* sorry, they don't respect size of data */ datalen = (msg->size < sizeof(tmp)) ? msg->size : sizeof(tmp) - 1 ; memcpy (&tmp[0], &msg->data[0], datalen) ; memset (&tmp[datalen], '\0', sizeof(tmp) - datalen) ; if ((type == 0x80) || (type == 0x81)) { capiAnalyse (out, (XLOG *)&tmp[0]) ; } else { xlog_stream (out, (XLOG *)&tmp[0]) ; } return ; } /* * Output raw data */ fprintf (out, "%d bytes", msg->size) ; for ( i = 0 ; i < msg->size ; i += 16 ) { putAsc (out, &msg->data[i], i, msg->size - i) ; } fprintf (out, "\n") ; } /*****************************************************************************/ #include <pshpack1.h> /* 'struct mlog' should be packed without any padding */ struct mlog { word code ; word timeh ; word timel ; char buffer[256] ; } ; #include <poppack.h> static byte tmpBuf[2200] ; static DbgMessage *dLogMsg = (DbgMessage *)&tmpBuf[0] ; void xlogAnalyse (FILE *out, DbgMessage *msg) { dword msec, sec, proc ; struct mlog *mwork = (struct mlog *)&msg->data[0] ; msec = (((dword )mwork->timeh) << 16) + mwork->timel ; sec = msec / 1000 ; proc = mwork->code >> 8 ; if ( proc > 0 ) { fprintf (out, "%lu:%04ld:%03ld - P(%d) ", (unsigned long)sec / 3600, (unsigned long)sec % 3600, (unsigned long)msec % 1000, proc) ; } else { fprintf (out, "%lu:%04ld:%03ld - ", (unsigned long)sec / 3600, (unsigned long)sec % 3600, (unsigned long)msec % 1000) ; } switch (mwork->code & 0xFF) { case 1: fprintf (out, "%s\n", mwork->buffer) ; break ; case 2: dLogMsg->size = msg->size - 6 ; memcpy (&dLogMsg->data[0], &mwork->buffer[0], dLogMsg->size) ; dilogAnalyse (out, dLogMsg, 1) ; break ; default: fprintf (out, "unknown message type 0x%02x\n", mwork->code & 0xFF) ; break ; } }
/** * UGENE - Integrated Bioinformatics Tools. * Copyright (C) 2008-2017 UniPro <ugene@unipro.ru> * http://ugene.net * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, * MA 02110-1301, USA. */ #ifndef _U2_ADD_READS_TO_DOCUMENT_TASK_ #define _U2_ADD_READS_TO_DOCUMENT_TASK_ #include <U2Core/DocumentModel.h> #include <U2Core/Task.h> #include <U2Core/U2Assembly.h> namespace U2 { class AddReadsToDocumentTask : public Task { Q_OBJECT public: AddReadsToDocumentTask(const QList<U2AssemblyRead> &reads, const QPointer<Document> &doc); void run(); ReportResult report(); private: const QList<U2AssemblyRead> reads; const QPointer<Document> doc; U2DbiRef dbiRef; QMap<U2DataId, QString> seqNameById; }; } // namespace U2 #endif
/* -*- c-basic-offset: 8 -*- FreeRDP: A Remote Desktop Protocol client. Protocol services - Remote Applications Integrated Locally (RAIL) Copyright (C) Marc-Andre Moreau <marcandre.moreau@gmail.com> 2009 This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #ifndef __RAIL_H #define __RAIL_H struct rdp_app { char application_name[260]; char working_directory[260]; char arguments[260]; }; typedef struct rdp_app rdpApp; void rdp_send_client_execute_pdu(rdpRdp * rdp); #endif // __RAIL_H
/* Interpolation from a regular grid in 1-D. January 2014 program of the month: http://ahay.org/rsflog/index.php?/archives/373-Program-of-the-month-sfinttest1.html */ /* Copyright (C) 2004 University of Texas at Austin 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 <string.h> #include <rsf.h> #include "prefilter.h" #include "shprefilter.h" #include "interp_cube.h" #include "interp_sinc.h" #include "interp_mom.h" int main(int argc, char* argv[]) { bool same; int n, n2, nd, nw, i2; float *mm, *coord, *z, o, d, kai, tau; char *intp; sf_interpolator interp=NULL; sf_bands spl=NULL; sf_file in, out, crd; sf_init (argc,argv); in = sf_input("in"); out = sf_output("out"); crd = sf_input("coord"); if (SF_FLOAT != sf_gettype(in)) sf_error("Need float input"); if (!sf_histint(in,"n1",&n)) sf_error("No n1= in input"); n2 = sf_leftsize(in,1); if (SF_FLOAT != sf_gettype(crd)) sf_error("Need float coord"); if (!sf_histint(crd,"n1",&nd)) sf_error("No n1= in coord"); sf_putint(out,"n1",nd); if (sf_histfloat(crd,"d1",&d)) sf_putfloat(out,"d1",d); if (sf_histfloat(crd,"o1",&o)) sf_putfloat(out,"o1",o); if (!sf_histfloat(in,"d1",&d)) sf_error("No d1= in input"); if (!sf_histfloat(in,"o1",&o)) sf_error("No o1= in input"); intp = sf_getstring("interp"); /* interpolation (lagrange,cubic,kaiser,lanczos,cosine,welch,spline,mom) */ if (NULL == intp) sf_error("Need interp="); if (!sf_getint("nw",&nw)) sf_error("Need nw="); /* interpolator size */ if (!sf_getbool("same",&same)) same=true; /* same or different coordinates for each trace */ coord = sf_floatalloc(nd); if (same) sf_floatread(coord,nd,crd); tau = 0.0f; switch(intp[0]) { case 'l': if (!strncmp("lag",intp,3)) { /* Lagrange */ interp = sf_lg_int; } else if (!strncmp("lan",intp,3)) { /* Lanczos */ sinc_init('l', 0.); interp = sinc_int; } else { sf_error("%s interpolator is not implemented",intp); } break; case 'c': if (!strncmp("cub",intp,3)) { /* Cubic convolution */ interp = cube_int; } else if (!strncmp("cos",intp,3)) { /* Cosine */ sinc_init('c', 0.); interp = sinc_int; } else { sf_error("%s interpolator is not implemented",intp); } break; case 'k': if (!sf_getfloat("kai",&kai)) kai=4.0; /* Kaiser window parameter */ sinc_init('k', kai); interp = sinc_int; break; case 'w': sinc_init('w', 0.); interp = sinc_int; break; case 's': spl = sf_spline_init(nw,n); interp = sf_spline_int; break; case 'm': prefilter_init (-nw, n, 3*n); interp = mom_int; break; case 'h': /*Shifted linear*/ interp = sf_lin_int; tau = 0.21f; break; default: sf_error("%s interpolator is not implemented",intp); break; } if (same) sf_int1_init (coord, o, d, n, interp, nw, nd, tau); z = sf_floatalloc(nd); mm = sf_floatalloc(n); for (i2=0; i2 < n2; i2++) { sf_floatread (mm,n,in); if (!same) { sf_floatread(coord,nd,crd); sf_int1_init (coord, o, d, n, interp, nw, nd, tau); } if ('s' == intp[0]) { sf_banded_solve(spl,mm); } else if ('m' == intp[0]) { prefilter_apply (n,mm); } else if ( 'h' == intp[0]) { shprefilter(n,mm); } sf_int1_lop (false,false,n,nd,mm,z); sf_floatwrite (z,nd,out); } exit(0); }
// SPDX-License-Identifier: GPL-2.0+ /* * Copyright (C) 2013 Google, Inc */ #include <common.h> #include <dm.h> #include <fdtdec.h> #include <spi.h> #include <spi_flash.h> #include <asm/state.h> #include <dm/test.h> #include <dm/util.h> #include <test/ut.h> /* Test that sandbox SPI flash works correctly */ static int dm_test_spi_flash(struct unit_test_state *uts) { /* * Create an empty test file and run the SPI flash tests. This is a * long way from being a unit test, but it does test SPI device and * emulator binding, probing, the SPI flash emulator including * device tree decoding, plus the file-based backing store of SPI. * * More targeted tests could be created to perform the above steps * one at a time. This might not increase test coverage much, but * it would make bugs easier to find. It's not clear whether the * benefit is worth the extra complexity. */ ut_asserteq(0, run_command_list( "sb save hostfs - 0 spi.bin 200000;" "sf probe;" "sf test 0 10000", -1, 0)); /* * Since we are about to destroy all devices, we must tell sandbox * to forget the emulation device */ sandbox_sf_unbind_emul(state_get_current(), 0, 0); return 0; } DM_TEST(dm_test_spi_flash, DM_TESTF_SCAN_PDATA | DM_TESTF_SCAN_FDT);
/**************************************************************************** ** libebml : parse EBML files, see http://embl.sourceforge.net/ ** ** <file/class description> ** ** Copyright (C) 2002-2004 Steve Lhomme. All rights reserved. ** ** This file is part of libebml. ** ** This library is free software; you can redistribute it and/or ** modify it under the terms of the GNU Lesser General Public ** License as published by the Free Software Foundation; either ** version 2.1 of the License, or (at your option) any later version. ** ** This library is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ** Lesser General Public License for more details. ** ** You should have received a copy of the GNU Lesser General Public ** License along with this library; if not, write to the Free Software ** Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ** ** See http://www.matroska.org/license/lgpl/ for LGPL licensing information. ** ** Contact license@matroska.org if any conditions of this licensing are ** not clear to you. ** **********************************************************************/ /*! \file \version \$Id$ \author Steve Lhomme <robux4 @ users.sf.net> \author Moritz Bunkus <moritz @ bunkus.org> */ #ifndef LIBEBML_DEBUG_H #define LIBEBML_DEBUG_H #include <stdarg.h> // va_list #include <string.h> #ifdef WIN32 #include <windows.h> #else #include <stdio.h> #endif // WIN32 #include "EbmlConfig.h" START_LIBEBML_NAMESPACE static const int MAX_PREFIX_LENGTH = 128; #if defined(LIBEBML_DEBUG) // define the working debugging class class EBML_DLL_API ADbg { public: ADbg(int level = 0); virtual ~ADbg(); /// \todo make an inline function to test the level first and the process int OutPut(int level, const char * format,...) const; int OutPut(const char * format,...) const; inline int setLevel(const int level) { return my_level = level; } inline bool setIncludeTime(const bool included = true) { return my_time_included = included; } bool setDebugFile(const char * NewFilename); bool unsetDebugFile(); inline bool setUseFile(const bool usefile = true) { return my_use_file = usefile; } inline const char * setPrefix(const char * string) { return strncpy(prefix, string, MAX_PREFIX_LENGTH); } private: int my_level; bool my_time_included; bool my_use_file; bool my_debug_output; int _OutPut(const char * format,va_list params) const; char prefix[MAX_PREFIX_LENGTH]; #ifdef WIN32 HANDLE hFile; #else FILE *hFile; #endif // WIN32 }; #else // defined(LIBEBML_DEBUG) // define a class that does nothing (no output) class EBML_DLL_API ADbg { public: ADbg(int /* level */ = 0){} virtual ~ADbg() {} inline int OutPut(int /* level */, const char * /* format */,...) const { return 0; } inline int OutPut(const char * /* format */,...) const { return 0; } inline int setLevel(const int level) { return level; } inline bool setIncludeTime(const bool /* included */ = true) { return true; } inline bool setDebugFile(const char * /* NewFilename */) { return true; } inline bool unsetDebugFile() { return true; } inline bool setUseFile(const bool /* usefile */ = true) { return true; } inline const char * setPrefix(const char * string) { return string; } }; #endif // defined(LIBEBML_DEBUG) extern class EBML_DLL_API ADbg globalDebug; #ifdef LIBEBML_DEBUG #define EBML_TRACE globalDebug.OutPut #else #define EBML_TRACE #endif // Unfortunately the Visual C++ new operator doesn't throw a std::bad_alloc. One solution is to // define out own new operator. But we can't do this globally, since we allow static linking. // The other is to check every new allocation with an MATROSKA_ASSERT_NEW. #ifdef _MSC_VER #define EBML_ASSERT_NEW(p) if(p==0)throw std::bad_alloc() #else #define EBML_ASSERT_NEW(p) assert(p!=0) #endif END_LIBEBML_NAMESPACE #endif
/* * viking -- GPS Data and Topo Analyzer, Explorer, and Manager * * Copyright (C) 2003-2005, Evan Battaglia <gtoevan@gmx.net> * Copyright (C) 2013, Guilhem Bonnefille <guilhem.bonnefille@gmail.com> * Copyright (C) 2015, Rob Norris <rw_norris@hotmail.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 * */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include <string.h> #include <glib/gprintf.h> #include <glib/gi18n.h> #include "viking.h" #include "babel.h" #include "gpx.h" #include "acquire.h" #include "vikrouting.h" typedef struct { GtkWidget *engines_combo; GtkWidget *from_entry, *to_entry; } datasource_routing_widgets_t; /* Memory of previous selection */ static gint last_engine = 0; static gchar *last_from_str = NULL; static gchar *last_to_str = NULL; static gpointer datasource_routing_init ( acq_vik_t *avt ); static void datasource_routing_add_setup_widgets ( GtkWidget *dialog, VikViewport *vvp, gpointer user_data ); static void datasource_routing_get_process_options ( datasource_routing_widgets_t *widgets, ProcessOptions *po, DownloadMapOptions *options, const gchar *not_used2, const gchar *not_used3 ); static void datasource_routing_cleanup ( gpointer data ); VikDataSourceInterface vik_datasource_routing_interface = { N_("Directions"), N_("Directions"), VIK_DATASOURCE_AUTO_LAYER_MANAGEMENT, VIK_DATASOURCE_INPUTTYPE_NONE, TRUE, TRUE, TRUE, (VikDataSourceInitFunc) datasource_routing_init, (VikDataSourceCheckExistenceFunc) NULL, (VikDataSourceAddSetupWidgetsFunc) datasource_routing_add_setup_widgets, (VikDataSourceGetProcessOptionsFunc) datasource_routing_get_process_options, (VikDataSourceProcessFunc) a_babel_convert_from, (VikDataSourceProgressFunc) NULL, (VikDataSourceAddProgressWidgetsFunc) NULL, (VikDataSourceCleanupFunc) datasource_routing_cleanup, (VikDataSourceOffFunc) NULL, NULL, 0, NULL, NULL, 0 }; static gpointer datasource_routing_init ( acq_vik_t *avt ) { datasource_routing_widgets_t *widgets = g_malloc(sizeof(*widgets)); return widgets; } static void datasource_routing_add_setup_widgets ( GtkWidget *dialog, VikViewport *vvp, gpointer user_data ) { datasource_routing_widgets_t *widgets = (datasource_routing_widgets_t *)user_data; GtkWidget *engine_label, *from_label, *to_label; /* Engine selector */ engine_label = gtk_label_new (_("Engine:")); widgets->engines_combo = vik_routing_ui_selector_new ((Predicate)vik_routing_engine_supports_direction, NULL); gtk_combo_box_set_active (GTK_COMBO_BOX (widgets->engines_combo), last_engine); /* From and To entries */ from_label = gtk_label_new (_("From:")); widgets->from_entry = gtk_entry_new(); to_label = gtk_label_new (_("To:")); widgets->to_entry = gtk_entry_new(); if (last_from_str) gtk_entry_set_text(GTK_ENTRY(widgets->from_entry), last_from_str); if (last_to_str) gtk_entry_set_text(GTK_ENTRY(widgets->to_entry), last_to_str); /* Packing all these widgets */ GtkBox *box = GTK_BOX(gtk_dialog_get_content_area(GTK_DIALOG(dialog))); gtk_box_pack_start ( box, engine_label, FALSE, FALSE, 5 ); gtk_box_pack_start ( box, widgets->engines_combo, FALSE, FALSE, 5 ); gtk_box_pack_start ( box, from_label, FALSE, FALSE, 5 ); gtk_box_pack_start ( box, widgets->from_entry, FALSE, FALSE, 5 ); gtk_box_pack_start ( box, to_label, FALSE, FALSE, 5 ); gtk_box_pack_start ( box, widgets->to_entry, FALSE, FALSE, 5 ); gtk_widget_show_all(dialog); } static void datasource_routing_get_process_options ( datasource_routing_widgets_t *widgets, ProcessOptions *po, DownloadMapOptions *options, const gchar *not_used2, const gchar *not_used3 ) { const gchar *from, *to; /* Retrieve directions */ from = gtk_entry_get_text ( GTK_ENTRY(widgets->from_entry) ); to = gtk_entry_get_text ( GTK_ENTRY(widgets->to_entry) ); /* Retrieve engine */ last_engine = gtk_combo_box_get_active ( GTK_COMBO_BOX(widgets->engines_combo) ); VikRoutingEngine *engine = vik_routing_ui_selector_get_nth ( widgets->engines_combo, last_engine ); if ( !engine ) return; po->url = vik_routing_engine_get_url_from_directions ( engine, from, to ); po->input_file_type = g_strdup ( vik_routing_engine_get_format (engine) ); options = NULL; // i.e. use the default download settings /* Save last selection */ g_free ( last_from_str ); g_free ( last_to_str ); last_from_str = g_strdup( from ); last_to_str = g_strdup( to ); } static void datasource_routing_cleanup ( gpointer data ) { g_free ( data ); }
#ifndef configure_file #define configure_file #define ASSCOMPRESSOR_Signature "AssCompressor" /*==========================================================================*/ /*class netFetcher */ /*==========================================================================*/ #define quickFetch_ConnectTimeoutMS 3000L #define quickFetch_TimeoutMS 7000L #define quickFetch_FollowRedirection true #define quickFetch_UserAgent "AssCompressorbot" /*==========================================================================*/ /*==========================================================================*/ /*class bilibiliWebManager */ /*==========================================================================*/ #define bilibiliWebManager_DedeUserID [DedeUserID] #define bilibiliWebManager_SESSDATA [SESSDATA] #define bilibiliWebManager_AppKey [AppKey] //#define bilibiliWebManager_FetchInterfaceOnConstruct //#define bilibiliWebManager_FetchCommentOnConstruct //#define bilibiliWebManager_FetchRollBackOnConstruc //#define CXX11REGEX #define bilibiliWebManager_MAXBuffer 1024 #define bilibiliWebManager_CIDRegex "cid=([0-9]*)" #define bilibiliWebManager_AIDRegex "aid=([0-9]*)" #define bilibiliWebManager_TitleRegex "<h1 title=\"([^\"]*)\">" #define bilibiliWebManager_DesRegex "name=\"description\" content=\"([^\"]*)\"" #define bilibiliWebManager_AuthorRegex "name=\"author\" content=\"([^\"]*)\"" #define bilibiliWebManager_KeywordRegex "name=\"keywords\" content=\"([^\"]*)\"" #define bilibiliWebManager_CommentURL "http://comment.bilibili.com/%s.xml" #define bilibiliWebManager_CommentRoll "http://comment.bilibili.com/rolldate,%s" #define bilibiliWebManager_Interface "http://interface.bilibili.com/playurl?appkey=%s&cid=%s" #define bilibiliWebManager_URL "http://www.bilibili.com/video/av%s/index_%s.html" /*==========================================================================*/ /*==========================================================================*/ /*class bilibiliCommentContainer */ /*==========================================================================*/ #define bilibiliCommentContainer_SupportTraceLine #define bilibiliCommentContainer_WellFormAttribute 8 /*==========================================================================*/ /*==========================================================================*/ /*class assConvter */ /*==========================================================================*/ #define assConverter_MAXBuffer 5120 #define assConverter_attributeConstructor "%lf,%d,%d,%d,%lu,%d,%s,%d" #define assConverter_ACC_14Constructor "[%lu,%lu,\"%lf-%lf\",%lf,\"%s\",%d,%d,%lu,%lu,%lu,%lu,%s,\"%s\",0]" #define assConverter_Append_Statistic #define assConverter_Append_ForceList #define BilibiliFont_KEY_HEI "黑体" #define BilibiliFont_KEY_YouYuan "幼圆" #define BilibiliFont_KEY_Song "宋体" #define BilibiliFont_KEY_Kai "楷体" #define BilibiliFont_KEY_MS_HEI "微软雅黑" #define BilibiliFont_Name_HEI "黑体-简 细体" #define BilibiliFont_Name_YouYuan "圆体-简 细体" #define BilibiliFont_Name_Song "宋体-简 常规体" #define BilibiliFont_Name_Kai "楷体-简 常规体" #define BilibiliFont_Name_MS_HEI "兰亭黑-简 纤黑" #define BilibiliFont_Default_FontName "兰亭黑-简 纤黑" /*==========================================================================*/ #endif
/* d_modech.c called when mode has just changed Copyright (C) 1996-1997 Id Software, 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: Free Software Foundation, Inc. 59 Temple Place - Suite 330 Boston, MA 02111-1307, USA */ #ifdef HAVE_CONFIG_H # include "config.h" #endif #define NH_DEFINE #include "namehack.h" #include "QF/render.h" #include "d_local.h" #include "r_internal.h" int sw32_d_vrectx, sw32_d_vrecty, sw32_d_vrectright_particle, sw32_d_vrectbottom_particle; int sw32_d_y_aspect_shift, sw32_d_pix_min, sw32_d_pix_max, sw32_d_pix_shift; int sw32_d_scantable[MAXHEIGHT]; short *sw32_zspantable[MAXHEIGHT]; static void D_Patch (void) { } void sw32_D_ViewChanged (void) { int rowpixels; if (sw32_r_dowarp) rowpixels = WARP_WIDTH; else rowpixels = vid.rowbytes / sw32_r_pixbytes; sw32_scale_for_mip = sw32_xscale; if (sw32_yscale > sw32_xscale) sw32_scale_for_mip = sw32_yscale; sw32_d_zrowbytes = vid.width * 2; sw32_d_zwidth = vid.width; sw32_d_pix_min = r_refdef.vrect.width / 320; if (sw32_d_pix_min < 1) sw32_d_pix_min = 1; sw32_d_pix_max = (int) ((float) r_refdef.vrect.width / (320.0 / 4.0) + 0.5); sw32_d_pix_shift = 8 - (int) ((float) r_refdef.vrect.width / 320.0 + 0.5); if (sw32_d_pix_max < 1) sw32_d_pix_max = 1; if (sw32_pixelAspect > 1.4) sw32_d_y_aspect_shift = 1; else sw32_d_y_aspect_shift = 0; sw32_d_vrectx = r_refdef.vrect.x; sw32_d_vrecty = r_refdef.vrect.y; sw32_d_vrectright_particle = r_refdef.vrectright - sw32_d_pix_max; sw32_d_vrectbottom_particle = r_refdef.vrectbottom - (sw32_d_pix_max << sw32_d_y_aspect_shift); { int i; for (i = 0; i < vid.height; i++) { sw32_d_scantable[i] = i * rowpixels; sw32_zspantable[i] = sw32_d_pzbuffer + i * sw32_d_zwidth; } } D_Patch (); }
/* Copyright (C) 2001 Tensilica, Inc. All Rights Reserved. Revised to support Tensilica processors and to improve overall performance */ /* Generated automatically by the program `genconfig' from the machine description file `md'. */ #define MAX_RECOG_OPERANDS 10 #define MAX_DUP_OPERANDS 2 #ifndef MAX_INSNS_PER_SPLIT #define MAX_INSNS_PER_SPLIT 5 #endif #define HAVE_conditional_move 1 #define HAVE_conditional_execution 1
/* * Low-Level PCI Support for PC * * (c) 1999--2000 Martin Mares <mj@ucw.cz> */ #include <linux/sched.h> #include <linux/pci.h> #include <linux/ioport.h> #include <linux/init.h> #include <asm/acpi.h> #include <asm/segment.h> #include <asm/io.h> #include <asm/smp.h> #include "pci.h" #ifdef CONFIG_PCI_BIOS extern void pcibios_sort(void); #endif unsigned int pci_probe = PCI_PROBE_BIOS | PCI_PROBE_CONF1 | PCI_PROBE_CONF2 | PCI_PROBE_MMCONF; int pcibios_last_bus = -1; struct pci_bus *pci_root_bus = NULL; struct pci_raw_ops *raw_pci_ops; static int pci_read(struct pci_bus *bus, unsigned int devfn, int where, int size, u32 *value) { return raw_pci_ops->read(0, bus->number, devfn, where, size, value); } static int pci_write(struct pci_bus *bus, unsigned int devfn, int where, int size, u32 value) { return raw_pci_ops->write(0, bus->number, devfn, where, size, value); } struct pci_ops pci_root_ops = { .read = pci_read, .write = pci_write, }; /* * legacy, numa, and acpi all want to call pcibios_scan_root * from their initcalls. This flag prevents that. */ int pcibios_scanned; /* * This interrupt-safe spinlock protects all accesses to PCI * configuration space. */ spinlock_t pci_config_lock = SPIN_LOCK_UNLOCKED; /* * Several buggy motherboards address only 16 devices and mirror * them to next 16 IDs. We try to detect this `feature' on all * primary buses (those containing host bridges as they are * expected to be unique) and remove the ghost devices. */ static void __devinit pcibios_fixup_ghosts(struct pci_bus *b) { struct list_head *ln, *mn; struct pci_dev *d, *e; int mirror = PCI_DEVFN(16,0); int seen_host_bridge = 0; int i; DBG("PCI: Scanning for ghost devices on bus %d\n", b->number); for (ln=b->devices.next; ln != &b->devices; ln=ln->next) { d = pci_dev_b(ln); if ((d->class >> 8) == PCI_CLASS_BRIDGE_HOST) seen_host_bridge++; for (mn=ln->next; mn != &b->devices; mn=mn->next) { e = pci_dev_b(mn); if (e->devfn != d->devfn + mirror || e->vendor != d->vendor || e->device != d->device || e->class != d->class) continue; for(i=0; i<PCI_NUM_RESOURCES; i++) if (e->resource[i].start != d->resource[i].start || e->resource[i].end != d->resource[i].end || e->resource[i].flags != d->resource[i].flags) continue; break; } if (mn == &b->devices) return; } if (!seen_host_bridge) return; printk(KERN_WARNING "PCI: Ignoring ghost devices on bus %02x\n", b->number); ln = &b->devices; while (ln->next != &b->devices) { d = pci_dev_b(ln->next); if (d->devfn >= mirror) { list_del(&d->global_list); list_del(&d->bus_list); kfree(d); } else ln = ln->next; } } /* * Called after each bus is probed, but before its children * are examined. */ void __devinit pcibios_fixup_bus(struct pci_bus *b) { pcibios_fixup_ghosts(b); pci_read_bridge_bases(b); } struct pci_bus * __devinit pcibios_scan_root(int busnum) { struct pci_bus *bus = NULL; while ((bus = pci_find_next_bus(bus)) != NULL) { if (bus->number == busnum) { /* Already scanned */ return bus; } } printk("PCI: Probing PCI hardware (bus %02x)\n", busnum); return pci_scan_bus(busnum, &pci_root_ops, NULL); } extern u8 pci_cache_line_size; static int __init pcibios_init(void) { struct cpuinfo_x86 *c = &boot_cpu_data; if (!raw_pci_ops) { printk("PCI: System does not support PCI\n"); return 0; } /* * Assume PCI cacheline size of 32 bytes for all x86s except K7/K8 * and P4. It's also good for 386/486s (which actually have 16) * as quite a few PCI devices do not support smaller values. */ pci_cache_line_size = 32 >> 2; if (c->x86 >= 6 && c->x86_vendor == X86_VENDOR_AMD) pci_cache_line_size = 64 >> 2; /* K7 & K8 */ else if (c->x86 > 6 && c->x86_vendor == X86_VENDOR_INTEL) pci_cache_line_size = 128 >> 2; /* P4 */ pcibios_resource_survey(); #ifdef CONFIG_PCI_BIOS if ((pci_probe & PCI_BIOS_SORT) && !(pci_probe & PCI_NO_SORT)) pcibios_sort(); #endif return 0; } subsys_initcall(pcibios_init); char * __devinit pcibios_setup(char *str) { if (!strcmp(str, "off")) { pci_probe = 0; return NULL; } #ifdef CONFIG_PCI_BIOS else if (!strcmp(str, "bios")) { pci_probe = PCI_PROBE_BIOS; return NULL; } else if (!strcmp(str, "nobios")) { pci_probe &= ~PCI_PROBE_BIOS; return NULL; } else if (!strcmp(str, "nosort")) { pci_probe |= PCI_NO_SORT; return NULL; } else if (!strcmp(str, "biosirq")) { pci_probe |= PCI_BIOS_IRQ_SCAN; return NULL; } #endif #ifdef CONFIG_PCI_DIRECT else if (!strcmp(str, "conf1")) { pci_probe = PCI_PROBE_CONF1 | PCI_NO_CHECKS; return NULL; } else if (!strcmp(str, "conf2")) { pci_probe = PCI_PROBE_CONF2 | PCI_NO_CHECKS; return NULL; } #endif #ifdef CONFIG_PCI_MMCONFIG else if (!strcmp(str, "nommconf")) { pci_probe &= ~PCI_PROBE_MMCONF; return NULL; } #endif else if (!strcmp(str, "noacpi")) { acpi_noirq_set(); return NULL; } #ifndef CONFIG_X86_VISWS else if (!strcmp(str, "usepirqmask")) { pci_probe |= PCI_USE_PIRQ_MASK; return NULL; } else if (!strncmp(str, "irqmask=", 8)) { pcibios_irq_mask = simple_strtol(str+8, NULL, 0); return NULL; } else if (!strncmp(str, "lastbus=", 8)) { pcibios_last_bus = simple_strtol(str+8, NULL, 0); return NULL; } #endif else if (!strcmp(str, "rom")) { pci_probe |= PCI_ASSIGN_ROMS; return NULL; } else if (!strcmp(str, "assign-busses")) { pci_probe |= PCI_ASSIGN_ALL_BUSSES; return NULL; } return str; } unsigned int pcibios_assign_all_busses(void) { return (pci_probe & PCI_ASSIGN_ALL_BUSSES) ? 1 : 0; } int pcibios_enable_device(struct pci_dev *dev, int mask) { int err; if ((err = pcibios_enable_resources(dev, mask)) < 0) return err; return pcibios_enable_irq(dev); }
/* @(#)defaults.h 1.25 13/02/14 joerg */ /* * Header file defaults.h - assorted default values for character strings in * the volume descriptor. * * Copyright (c) 1999-2013 J. Schilling */ #define PREPARER_DEFAULT NULL #define PUBLISHER_DEFAULT NULL #ifndef APPID_DEFAULT #ifdef APPLE_HYB #define APPID_DEFAULT "MKISOFS ISO9660/HFS/UDF FILESYSTEM BUILDER (C) 1993 E.YOUNGDALE (C) 1997 J.PEARSON/J.SCHILLING" #else #define APPID_DEFAULT "MKISOFS ISO9660/UDF FILESYSTEM BUILDER (C) 1993 E.YOUNGDALE (C) 1997 J.PEARSON/J.SCHILLING" #endif /* APPLE_HYB */ #endif #define COPYRIGHT_DEFAULT NULL #define BIBLIO_DEFAULT NULL #define ABSTRACT_DEFAULT NULL #define VOLSET_ID_DEFAULT NULL #define VOLUME_ID_DEFAULT "CDROM" #define BOOT_CATALOG_DEFAULT "boot.catalog" #define BOOT_IMAGE_DEFAULT NULL #ifdef APPLE_HYB #define APPLE_TYPE_DEFAULT "TEXT" #define APPLE_CREATOR_DEFAULT "unix" #endif /* APPLE_HYB */ #ifdef __QNX__ #define SYSTEM_ID_DEFAULT "QNX" #endif #ifdef __osf__ #define SYSTEM_ID_DEFAULT "OSF" #endif #ifdef __sun #ifdef __SVR4 #define SYSTEM_ID_DEFAULT "Solaris" #else #define SYSTEM_ID_DEFAULT "SunOS" #endif #endif #ifdef __hpux #define SYSTEM_ID_DEFAULT "HP-UX" #endif #ifdef __sgi #define SYSTEM_ID_DEFAULT "SGI" #endif #if defined(_IBMR2) || defined(_AIX) #define SYSTEM_ID_DEFAULT "AIX" #endif #if defined(_WIN) || defined(__CYGWIN32__) || defined(__CYGWIN__) #define SYSTEM_ID_DEFAULT "Win32" #endif /* _WIN */ #if !defined(SYSTEM_ID_DEFAULT) && defined(__MINGW32__) #define SYSTEM_ID_DEFAULT "Win32/MinGW" #endif /* __MINGW32__ */ #ifdef __EMX__ #define SYSTEM_ID_DEFAULT "OS/2" #endif #if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) #define SYSTEM_ID_DEFAULT "FreeBSD" #endif #ifdef __DragonFly__ #define SYSTEM_ID_DEFAULT "DragonFly" #endif #ifdef __NetBSD__ #define SYSTEM_ID_DEFAULT "NetBSD" #endif #ifdef __OpenBSD__ #define SYSTEM_ID_DEFAULT "OpenBSD" #endif #ifdef __bsdi__ #define SYSTEM_ID_DEFAULT "BSD/OS" #endif #ifdef __NeXT__ #define SYSTEM_ID_DEFAULT "NeXT" #endif #if defined(__NeXT__) && defined(__TARGET_OSNAME) && __TARGET_OSNAME == rhapsody #undef SYSTEM_ID_DEFAULT #define SYSTEM_ID_DEFAULT "Rhapsody" #endif #if defined(__APPLE__) && defined(__MACH__) #undef SYSTEM_ID_DEFAULT #define SYSTEM_ID_DEFAULT "Mac OS X" #endif #ifdef __BEOS__ #define SYSTEM_ID_DEFAULT "BeOS" #endif #ifdef __HAIKU__ #define SYSTEM_ID_DEFAULT "Haiku" #endif #ifdef __OS2 #define SYSTEM_ID_DEFAULT "OS/2" #endif #ifdef VMS #define SYSTEM_ID_DEFAULT "VMS" #endif #ifdef OPENSERVER #define SYSTEM_ID_DEFAULT "SCO-OPENSERVER" #endif #ifdef UNIXWARE #define SYSTEM_ID_DEFAULT "SCO-UNIXWARE" #endif #ifdef linux #define SYSTEM_ID_DEFAULT "LINUX" #endif #ifdef __DJGPP__ #define SYSTEM_ID_DEFAULT "DOS" #endif #ifdef __MINT__ #define SYSTEM_ID_DEFAULT "ATARI-MiNT" #endif #ifdef __SYLLABLE__ #define SYSTEM_ID_DEFAULT "Syllable" #endif #ifdef AMIGA #define SYSTEM_ID_DEFAULT "AMIGA" #endif #ifndef SYSTEM_ID_DEFAULT #define SYSTEM_ID_DEFAULT "UNIX" #endif
/* arch/arm/mach-msm/include/mach/memory.h * * Copyright (C) 2007 Google, Inc. * Copyright (c) 2009-2012, The Linux Foundation. All rights reserved. * * 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. * */ #ifndef __ASM_ARCH_MEMORY_H #define __ASM_ARCH_MEMORY_H #include <linux/types.h> /* physical offset of RAM */ #define PLAT_PHYS_OFFSET UL(CONFIG_PHYS_OFFSET) #define MAX_PHYSMEM_BITS 32 #define SECTION_SIZE_BITS 28 /* Maximum number of Memory Regions * The largest system can have 4 memory banks, each divided into 8 regions */ #define MAX_NR_REGIONS 32 /* The number of regions each memory bank is divided into */ #define NR_REGIONS_PER_BANK 8 /* Certain configurations of MSM7x30 have multiple memory banks. * One or more of these banks can contain holes in the memory map as well. * These macros define appropriate conversion routines between the physical * and virtual address domains for supporting these configurations using * SPARSEMEM and a 3G/1G VM split. */ #if defined(CONFIG_ARCH_MSM7X30) #define EBI0_PHYS_OFFSET PHYS_OFFSET #define EBI0_PAGE_OFFSET PAGE_OFFSET #define EBI0_SIZE 0x10000000 #ifndef __ASSEMBLY__ extern unsigned long ebi1_phys_offset; #define EBI1_PHYS_OFFSET (ebi1_phys_offset) #define EBI1_PAGE_OFFSET (EBI0_PAGE_OFFSET + EBI0_SIZE) #if (defined(CONFIG_SPARSEMEM) && defined(CONFIG_VMSPLIT_3G)) #define __phys_to_virt(phys) \ ((phys) >= EBI1_PHYS_OFFSET ? \ (phys) - EBI1_PHYS_OFFSET + EBI1_PAGE_OFFSET : \ (phys) - EBI0_PHYS_OFFSET + EBI0_PAGE_OFFSET) #define __virt_to_phys(virt) \ ((virt) >= EBI1_PAGE_OFFSET ? \ (virt) - EBI1_PAGE_OFFSET + EBI1_PHYS_OFFSET : \ (virt) - EBI0_PAGE_OFFSET + EBI0_PHYS_OFFSET) #endif #endif #endif #ifndef __ASSEMBLY__ void *alloc_bootmem_aligned(unsigned long size, unsigned long alignment); void *allocate_contiguous_ebi(unsigned long, unsigned long, int); unsigned long allocate_contiguous_ebi_nomap(unsigned long, unsigned long); void clean_and_invalidate_caches(unsigned long, unsigned long, unsigned long); void clean_caches(unsigned long, unsigned long, unsigned long); void invalidate_caches(unsigned long, unsigned long, unsigned long); int platform_physical_remove_pages(u64, u64); int platform_physical_active_pages(u64, u64); int platform_physical_low_power_pages(u64, u64); unsigned long get_ddr_size(void); int msm_get_memory_type_from_name(const char *memtype_name); extern int (*change_memory_power)(u64, u64, int); #if defined(CONFIG_ARCH_MSM_ARM11) || defined(CONFIG_ARCH_MSM_CORTEX_A5) void write_to_strongly_ordered_memory(void); void map_page_strongly_ordered(void); #endif #ifdef CONFIG_CACHE_L2X0 extern void l2x0_cache_sync(void); #define finish_arch_switch(prev) do { l2x0_cache_sync(); } while (0) #endif #if defined(CONFIG_ARCH_MSM8X60) || defined(CONFIG_ARCH_MSM8960) extern void store_ttbr0(void); #define finish_arch_switch(prev) do { store_ttbr0(); } while (0) #endif #ifdef CONFIG_DONT_MAP_HOLE_AFTER_MEMBANK0 extern unsigned long membank0_size; extern unsigned long membank1_start; void find_membank0_hole(void); #define MEMBANK0_PHYS_OFFSET PHYS_OFFSET #define MEMBANK0_PAGE_OFFSET PAGE_OFFSET #define MEMBANK1_PHYS_OFFSET (membank1_start) #define MEMBANK1_PAGE_OFFSET (MEMBANK0_PAGE_OFFSET + (membank0_size)) #define __phys_to_virt(phys) \ ((MEMBANK1_PHYS_OFFSET && ((phys) >= MEMBANK1_PHYS_OFFSET)) ? \ (phys) - MEMBANK1_PHYS_OFFSET + MEMBANK1_PAGE_OFFSET : \ (phys) - MEMBANK0_PHYS_OFFSET + MEMBANK0_PAGE_OFFSET) #define __virt_to_phys(virt) \ ((MEMBANK1_PHYS_OFFSET && ((virt) >= MEMBANK1_PAGE_OFFSET)) ? \ (virt) - MEMBANK1_PAGE_OFFSET + MEMBANK1_PHYS_OFFSET : \ (virt) - MEMBANK0_PAGE_OFFSET + MEMBANK0_PHYS_OFFSET) #endif /* * Need a temporary unique variable that no one will ever see to * hold the compat string. Line number gives this easily. * Need another layer of indirection to get __LINE__ to expand * properly as opposed to appending and ending up with * __compat___LINE__ */ #define __CONCAT(a, b) ___CONCAT(a, b) #define ___CONCAT(a, b) a ## b #define EXPORT_COMPAT(com) \ static char *__CONCAT(__compat_, __LINE__) __used \ __attribute((__section__(".exportcompat.init"))) = com extern char *__compat_exports_start[]; extern char *__compat_exports_end[]; #endif #if defined CONFIG_ARCH_MSM_SCORPION || defined CONFIG_ARCH_MSM_KRAIT #define arch_has_speculative_dfetch() 1 #endif #endif /* these correspond to values known by the modem */ #define MEMORY_DEEP_POWERDOWN 0 #define MEMORY_SELF_REFRESH 1 #define MEMORY_ACTIVE 2 #define NPA_MEMORY_NODE_NAME "/mem/apps/ddr_dpd" #ifndef CONFIG_ARCH_MSM7X27 #define CONSISTENT_DMA_SIZE (SZ_1M * 14) #endif
/** * @file * * @ingroup mpc55xx * * @brief BSP startup code. */ /* * Copyright (c) 2008-2013 embedded brains GmbH. All rights reserved. * * embedded brains GmbH * Dornierstr. 4 * 82178 Puchheim * Germany * <rtems@embedded-brains.de> * * 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. */ #include <mpc55xx/mpc55xx.h> #include <mpc55xx/regs.h> #include <mpc55xx/edma.h> #include <mpc55xx/emios.h> #include <string.h> #include <rtems.h> #include <rtems/config.h> #include <libcpu/powerpc-utility.h> #include <bsp/vectors.h> #include <bsp.h> #include <bsp/bootcard.h> #include <bsp/irq.h> #include <bsp/irq-generic.h> #include <bsp/linker-symbols.h> #include <bsp/start.h> #include <bsp/mpc55xx-config.h> /* Symbols defined in linker command file */ LINKER_SYMBOL(mpc55xx_exc_vector_base); unsigned int bsp_clock_speed = 0; uint32_t bsp_clicks_per_usec = 0; void _BSP_Fatal_error(unsigned n) { rtems_interrupt_level level; (void) level; rtems_interrupt_disable( level); while (true) { mpc55xx_wait_for_interrupt(); } } void mpc55xx_fatal(mpc55xx_fatal_code code) { rtems_fatal(RTEMS_FATAL_SOURCE_BSP_SPECIFIC, code); } static void null_pointer_protection(void) { #ifdef MPC55XX_NULL_POINTER_PROTECTION struct MMU_tag mmu = { .MAS0 = { .B = { .TLBSEL = 1, .ESEL = 1 } } }; PPC_SET_SPECIAL_PURPOSE_REGISTER(FSL_EIS_MAS0, mmu.MAS0.R); __asm__ volatile ("tlbre"); mmu.MAS1.R = PPC_SPECIAL_PURPOSE_REGISTER(FSL_EIS_MAS1); mmu.MAS1.B.VALID = 0; PPC_SET_SPECIAL_PURPOSE_REGISTER(FSL_EIS_MAS1, mmu.MAS1.R); __asm__ volatile ("tlbwe"); #endif } void bsp_start(void) { null_pointer_protection(); /* * make sure BSS/SBSS is cleared */ memset(&bsp_section_bss_begin [0], 0, (size_t) bsp_section_bss_size); /* * Get CPU identification dynamically. Note that the get_ppc_cpu_type() * function store the result in global variables so that it can be used * latter... */ get_ppc_cpu_type(); get_ppc_cpu_revision(); /* * determine clock speed */ bsp_clock_speed = mpc55xx_get_system_clock() / MPC55XX_SYSTEM_CLOCK_DIVIDER; /* Time reference value */ bsp_clicks_per_usec = bsp_clock_speed / 1000000; /* Initialize exceptions */ ppc_exc_vector_base = (uint32_t) mpc55xx_exc_vector_base; ppc_exc_initialize( PPC_INTERRUPT_DISABLE_MASK_DEFAULT, (uintptr_t) bsp_section_work_begin, rtems_configuration_get_interrupt_stack_size() ); #ifndef PPC_EXC_CONFIG_USE_FIXED_HANDLER ppc_exc_set_handler(ASM_ALIGN_VECTOR, ppc_exc_alignment_handler); #endif /* Initialize interrupts */ bsp_interrupt_initialize(); mpc55xx_edma_init(); #ifdef MPC55XX_EMIOS_PRESCALER mpc55xx_emios_initialize(MPC55XX_EMIOS_PRESCALER); #endif }
/* ES40 emulator. * Copyright (C) 2007-2008 by the ES40 Emulator Project * * WWW : http://www.es40.org * E-mail : camiel@es40.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. * * Although this is not required, the author would appreciate being notified of, * and receiving any modifications you may make to the source code that might serve * the general public. * * Parts of this file based upon the Poco C++ Libraries, which is Copyright (C) * 2004-2006, Applied Informatics Software Engineering GmbH. and Contributors. */ /** * $Id: Platform_VMS.h,v 1.1 2008/05/31 15:47:26 iamcamiel Exp $ * * X-1.1 Camiel Vanderhoeven 31-MAY-2008 * Initial version for ES40 emulator. **/ // // Platform_VMS.h // // $Id: Platform_VMS.h,v 1.1 2008/05/31 15:47:26 iamcamiel Exp $ // // Library: Foundation // Package: Core // Module: Platform // // Platform and architecture identification macros // and platform-specific definitions for OpenVMS. // // Copyright (c) 2004-2006, Applied Informatics Software Engineering GmbH. // and Contributors. // // Permission is hereby granted, free of charge, to any person or organization // obtaining a copy of the software and accompanying documentation covered by // this license (the "Software") to use, reproduce, display, distribute, // execute, and transmit the Software, and to prepare derivative works of the // Software, and to permit third-parties to whom the Software is furnished to // do so, all subject to the following: // // The copyright notices in the Software and this entire statement, including // the above license grant, this restriction and the following disclaimer, // must be included in all copies of the Software, in whole or in part, and // all derivative works of the Software, unless such copies or derivative // works are solely in the form of machine-executable object code generated by // a source language processor. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT // SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE // FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, // ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. // #ifndef Foundation_Platform_VMS_INCLUDED #define Foundation_Platform_VMS_INCLUDED // Define the POCO_DESCRIPTOR_STRING and POCO_DESCRIPTOR_LITERAL // macros which we use instead of $DESCRIPTOR and $DESCRIPTOR64. // Our macros work with both 32bit and 64bit pointer sizes. #if __INITIAL_POINTER_SIZE != 64 #define POCO_DESCRIPTOR_STRING(name, string) \ struct dsc$descriptor_s name = \ { \ string.size(), \ DSC$K_DTYPE_T, \ DSC$K_CLASS_S, \ (char*) string.data() \ } #define POCO_DESCRIPTOR_LITERAL(name, string) \ struct dsc$descriptor_s name = \ { \ sizeof(string) - 1, \ DSC$K_DTYPE_T, \ DSC$K_CLASS_S, \ (char*) string \ } #else #define POCO_DESCRIPTOR_STRING(name, string) \ struct dsc64$descriptor_s name =\ { \ 1, \ DSC64$K_DTYPE_T, \ DSC64$K_CLASS_S, \ -1, \ string.size(), \ (char*) string.data() \ } #define POCO_DESCRIPTOR_LITERAL(name, string) \ struct dsc64$descriptor_s name =\ { \ 1, \ DSC64$K_DTYPE_T, \ DSC64$K_CLASS_S, \ -1, \ sizeof(string) - 1, \ (char*) string \ } #endif // No <sys/select.h> header file #define POCO_NO_SYS_SELECT_H #endif // Foundation_Platform_VMS_INCLUDED
/* * PearPC * sysvaccel.h * * Abstraction for video conversion function acceleration * * Copyright (C) 2004 Stefan Weyergraf * * 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., 675 Mass Ave, Cambridge, MA 02139, USA. */ #ifndef __SYSVACCEL_H__ #define __SYSVACCEL_H__ #include "system/display.h" void sys_convert_display( const DisplayCharacteristics &aSrcChar, const DisplayCharacteristics &aDestChar, const void *aSrcBuf, void *aDestBuf, int firstLine, int lastLine); #endif
/* LibTomCrypt, modular cryptographic library -- Tom St Denis * * LibTomCrypt is a library that provides various cryptographic * algorithms in a highly modular and flexible manner. * * The library is free for all purposes without any express * guarantee it works. * * Tom St Denis, tomstdenis@iahu.ca, http://libtomcrypt.org */ /* A secure PRNG using the RNG functions. Basically this is a * wrapper that allows you to use a secure RNG as a PRNG * in the various other functions. */ #include "mycrypt.h" #ifdef SPRNG const struct _prng_descriptor sprng_desc = { "sprng", &sprng_start, &sprng_add_entropy, &sprng_ready, &sprng_read }; int sprng_start(prng_state *prng) { return CRYPT_OK; } int sprng_add_entropy(const unsigned char *buf, unsigned long len, prng_state *prng) { return CRYPT_OK; } int sprng_ready(prng_state *prng) { return CRYPT_OK; } unsigned long sprng_read(unsigned char *buf, unsigned long len, prng_state *prng) { _ARGCHK(buf != NULL); return rng_get_bytes(buf, len, NULL); } #endif
/* $USAGI: icmpv6.h,v 1.10 2001/05/06 23:52:50 yoshfuji Exp $ */ #ifndef _LINUX_ICMPV6_H #define _LINUX_ICMPV6_H #include <asm/byteorder.h> struct icmp6hdr { __u8 icmp6_type; __u8 icmp6_code; __u16 icmp6_cksum; union { __u32 un_data32[1]; __u16 un_data16[2]; __u8 un_data8[4]; struct icmpv6_echo { __u16 identifier; __u16 sequence; } u_echo; struct icmpv6_nd_advt { #if defined(__LITTLE_ENDIAN_BITFIELD) __u32 reserved:5, override:1, solicited:1, router:1, reserved2:24; #elif defined(__BIG_ENDIAN_BITFIELD) __u32 router:1, solicited:1, override:1, reserved:29; #else #error "Please fix <asm/byteorder.h>" #endif } u_nd_advt; struct icmpv6_nd_ra { __u8 hop_limit; #if defined(__LITTLE_ENDIAN_BITFIELD) __u8 reserved:5, home_agent:1, other:1, managed:1; #elif defined(__BIG_ENDIAN_BITFIELD) __u8 managed:1, other:1, home_agent:1, reserved:5; #else #error "Please fix <asm/byteorder.h>" #endif __u16 rt_lifetime; } u_nd_ra; struct icmpv6_ni { __u16 qtype; __u16 flags; } u_ni; } icmp6_dataun; #define icmp6_identifier icmp6_dataun.u_echo.identifier #define icmp6_sequence icmp6_dataun.u_echo.sequence #define icmp6_pointer icmp6_dataun.un_data32[0] #define icmp6_mtu icmp6_dataun.un_data32[0] #define icmp6_unused icmp6_dataun.un_data32[0] #define icmp6_maxdelay icmp6_dataun.un_data16[0] #define icmp6_router icmp6_dataun.u_nd_advt.router #define icmp6_solicited icmp6_dataun.u_nd_advt.solicited #define icmp6_override icmp6_dataun.u_nd_advt.override #define icmp6_ndiscreserved icmp6_dataun.u_nd_advt.reserved #define icmp6_hop_limit icmp6_dataun.u_nd_ra.hop_limit #define icmp6_addrconf_managed icmp6_dataun.u_nd_ra.managed #define icmp6_addrconf_other icmp6_dataun.u_nd_ra.other #define icmp6_rt_lifetime icmp6_dataun.u_nd_ra.rt_lifetime #define icmp6_qtype icmp6_dataun.u_ni.qtype #define icmp6_flags icmp6_dataun.u_ni.flags #define icmp6_home_agent icmp6_dataun.u_nd_ra.home_agent }; #define ICMPV6_DEST_UNREACH 1 #define ICMPV6_PKT_TOOBIG 2 #define ICMPV6_TIME_EXCEED 3 #define ICMPV6_PARAMPROB 4 #define ICMPV6_INFOMSG_MASK 0x80 #define ICMPV6_ECHO_REQUEST 128 #define ICMPV6_ECHO_REPLY 129 #define ICMPV6_MGM_QUERY 130 #define ICMPV6_MGM_REPORT 131 #define ICMPV6_MGM_REDUCTION 132 #define ICMPV6_NI_QUERY 139 #define ICMPV6_NI_REPLY 140 /* * Codes for Destination Unreachable */ #define ICMPV6_NOROUTE 0 #define ICMPV6_ADM_PROHIBITED 1 #define ICMPV6_NOT_NEIGHBOUR 2 #define ICMPV6_ADDR_UNREACH 3 #define ICMPV6_PORT_UNREACH 4 /* * Codes for Time Exceeded */ #define ICMPV6_EXC_HOPLIMIT 0 #define ICMPV6_EXC_FRAGTIME 1 /* * Codes for Parameter Problem */ #define ICMPV6_HDR_FIELD 0 #define ICMPV6_UNK_NEXTHDR 1 #define ICMPV6_UNK_OPTION 2 /* * Codes for Node Information */ #define ICMPV6_NI_SUBJ_IPV6 0 /* Query Subject is an ipv6 address */ #define ICMPV6_NI_SUBJ_FQDN 1 /* Query Subject is a Domain name */ #define ICMPV6_NI_SUBJ_IPV4 2 /* Query Subject is an ipv4 address */ #define ICMPV6_NI_SUCCESS 0 /* NI successful reply */ #define ICMPV6_NI_REFUSED 1 /* NI request is refused */ #define ICMPV6_NI_UNKNOWN 2 /* unknown Qtype */ #define ICMPV6_NI_QTYPE_NOOP 0 /* NOOP */ #define ICMPV6_NI_QTYPE_SUPTYPES 1 /* Supported Qtypes */ #define ICMPV6_NI_QTYPE_FQDN 2 /* FQDN */ #define ICMPV6_NI_QTYPE_NODEADDR 3 /* Node Addresses */ #define ICMPV6_NI_QTYPE_IPV4ADDR 4 /* IPv4 Addresses */ /* Flags */ #if defined(__BIG_ENDIAN) #define ICMPV6_NI_SUPTYPE_FLAG_COMPRESS 0x1 #elif defined(__LITTLE_ENDIAN) #define ICMPV6_NI_SUPTYPE_FLAG_COMPRESS 0x0100 #endif #if defined(__BIG_ENDIAN) #define ICMPV6_NI_FQDN_FLAG_VALIDTTL 0x1 #elif defined(__LITTLE_ENDIAN) #define ICMPV6_NI_FQDN_FLAG_VALIDTTL 0x0100 #endif #if defined(__BIG_ENDIAN) #define ICMPV6_NI_NODEADDR_FLAG_TRUNCATE 0x1 #define ICMPV6_NI_NODEADDR_FLAG_ALL 0x2 #define ICMPV6_NI_NODEADDR_FLAG_COMPAT 0x4 #define ICMPV6_NI_NODEADDR_FLAG_LINKLOCAL 0x8 #define ICMPV6_NI_NODEADDR_FLAG_SITELOCAL 0x10 #define ICMPV6_NI_NODEADDR_FLAG_GLOBAL 0x20 #define ICMPV6_NI_NODEADDR_FLAG_ANYCAST 0x40 /* just experimental. not in spec */ #elif defined(__LITTLE_ENDIAN) #define ICMPV6_NI_NODEADDR_FLAG_TRUNCATE 0x0100 #define ICMPV6_NI_NODEADDR_FLAG_ALL 0x0200 #define ICMPV6_NI_NODEADDR_FLAG_COMPAT 0x0400 #define ICMPV6_NI_NODEADDR_FLAG_LINKLOCAL 0x0800 #define ICMPV6_NI_NODEADDR_FLAG_SITELOCAL 0x1000 #define ICMPV6_NI_NODEADDR_FLAG_GLOBAL 0x2000 #define ICMPV6_NI_NODEADDR_FLAG_ANYCAST 0x4000 /* just experimental. not in spec */ #else #error "Please fix <asm/byteorder.h>" #endif #define ICMPV6_NI_IPV4ADDR_FLAG_TRUNCATE ICMPV6_NI_NODEADDR_FLAG_TRUNCATE #define ICMPV6_NI_IPV4ADDR_FLAG_ALL ICMPV6_NI_NODEADDR_FLAG_ALL /* * constants for (set|get)sockopt */ #define ICMPV6_FILTER 1 /* * ICMPV6 filter */ #define ICMPV6_FILTER_BLOCK 1 #define ICMPV6_FILTER_PASS 2 #define ICMPV6_FILTER_BLOCKOTHERS 3 #define ICMPV6_FILTER_PASSONLY 4 struct icmp6_filter { __u32 data[8]; }; #ifdef __KERNEL__ #include <linux/netdevice.h> #include <linux/skbuff.h> #define IM_ICMPV6_SEND "icmpv6_send" extern void icmpv6_send(struct sk_buff *skb, int type, int code, __u32 info, struct net_device *dev); extern int icmpv6_init(struct net_proto_family *ops); extern int icmpv6_err_convert(int type, int code, int *err); extern void icmpv6_cleanup(void); extern void icmpv6_param_prob(struct sk_buff *skb, int code, int pos); #endif #endif
#ifndef _FS_CEPH_DEBUGFS_H #define _FS_CEPH_DEBUGFS_H #include "ceph_debug.h" #include "types.h" #define CEPH_DEFINE_SHOW_FUNC(name) \ static int name##_open(struct inode *inode, struct file *file) \ { \ struct seq_file *sf; \ int ret; \ \ ret = single_open(file, name, NULL); \ sf = file->private_data; \ sf->private = inode->i_private; \ return ret; \ } \ \ static const struct file_operations name##_fops = { \ .open = name##_open, \ .read = seq_read, \ .llseek = seq_lseek, \ .release = single_release, \ }; /* debugfs.c */ extern int ceph_debugfs_init(void); extern void ceph_debugfs_cleanup(void); extern int ceph_debugfs_client_init(struct ceph_client *client); extern void ceph_debugfs_client_cleanup(struct ceph_client *client); #endif
//-------------------------------------------------------------------------- // Copyright (C) 2014-2015 Cisco and/or its affiliates. All rights reserved. // // This program is free software; you can redistribute it and/or modify it // under the terms of the GNU General Public License Version 2 as published // by the Free Software Foundation. You may not use, modify or distribute // this program under any other version of the GNU General Public License. // // This program is distributed in the hope that it will be useful, but // WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU // General Public License for more details. // // You should have received a copy of the GNU General Public License along // with this program; if not, write to the Free Software Foundation, Inc., // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. //-------------------------------------------------------------------------- // nhttp_msg_chunk.h author Tom Peters <thopeter@cisco.com> #ifndef NHTTP_MSG_CHUNK_H #define NHTTP_MSG_CHUNK_H #include "nhttp_msg_body.h" //------------------------------------------------------------------------- // NHttpMsgChunk class //------------------------------------------------------------------------- class NHttpMsgChunk : public NHttpMsgBody { public: NHttpMsgChunk(const uint8_t* buffer, const uint16_t buf_size, NHttpFlowData* session_data_, NHttpEnums::SourceId source_id_, bool buf_owner, Flow* flow_, const NHttpParaList* params_); void print_section(FILE* output) override; void gen_events() override; void update_flow() override; }; #endif
/*****************************************************************************\ * opt.h - definitions for sattach option processing * $Id$ ***************************************************************************** * Copyright (C) 2002-2006 The Regents of the University of California. * Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER). * Written by Mark Grondona <grondona1@llnl.gov>, * Christopher J. Morrone <morrone2@llnl.gov>, et. al. * CODE-OCEC-09-009. All rights reserved. * * This file is part of SLURM, a resource management program. * For details, see <http://slurm.schedmd.com/>. * Please also read the included file: DISCLAIMER. * * SLURM 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. * * SLURM 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 SLURM; if not, write to the Free Software Foundation, Inc., * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. \*****************************************************************************/ #ifndef _HAVE_OPT_H #define _HAVE_OPT_H #if HAVE_CONFIG_H # include "config.h" #endif #include <time.h> #include <sys/types.h> #include <unistd.h> #include "slurm/slurm.h" #include "src/common/macros.h" /* true and false */ #include "src/common/env.h" /* global variables relating to user options */ extern int _verbose; typedef struct sbatch_options { char *progname; /* argv[0] of this program or * configuration file if multi_prog */ char *user; /* local username */ uid_t uid; /* local uid */ gid_t gid; /* local gid */ uid_t euid; /* effective user --uid=user */ gid_t egid; /* effective group --gid=group */ char *job_name; /* --job-name=, -J name */ uint32_t jobid; uint32_t stepid; bool jobid_set; /* true of jobid explicitly set */ int quiet; int verbose; char *ctrl_comm_ifhn; bool labelio; slurm_step_io_fds_t fds; bool layout_only; bool debugger_test; uint32_t input_filter; bool input_filter_set; uint32_t output_filter; bool output_filter_set; uint32_t error_filter; bool error_filter_set; bool pty; /* --pty */ } opt_t; extern opt_t opt; extern int error_exit; /* process options: * 1. set defaults * 2. update options with env vars * 3. update options with commandline args * 4. perform some verification that options are reasonable */ int initialize_and_process_args(int argc, char *argv[]); /* set options based upon commandline args */ void set_options(const int argc, char **argv); #endif /* _HAVE_OPT_H */
/*- * BSD LICENSE * * Copyright(c) 2010-2014 Intel Corporation. All rights reserved. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * * Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in * the documentation and/or other materials provided with the * distribution. * * Neither the name of Intel Corporation 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 _COMMANDS_H_ #define _COMMANDS_H_ extern cmdline_parse_ctx_t main_ctx[]; #endif /* _COMMANDS_H_ */
/* cpuid.c * * Copyright (C) 2006-2021 wolfSSL Inc. * * This file is part of wolfSSL. * * wolfSSL 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. * * wolfSSL 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-1335, USA */ #ifdef HAVE_CONFIG_H #include <config.h> #endif #include <wolfssl/wolfcrypt/settings.h> #include <wolfssl/wolfcrypt/cpuid.h> #ifdef HAVE_CPUID_INTEL /* Each platform needs to query info type 1 from cpuid to see if aesni is * supported. Also, let's setup a macro for proper linkage w/o ABI conflicts */ #ifndef _MSC_VER #define cpuid(reg, leaf, sub)\ __asm__ __volatile__ ("cpuid":\ "=a" ((reg)[0]), "=b" ((reg)[1]), "=c" ((reg)[2]), "=d" ((reg)[3]) :\ "a" (leaf), "c"(sub)); #define XASM_LINK(f) asm(f) #else #include <intrin.h> #define cpuid(a,b,c) __cpuidex((int*)a,b,c) #define XASM_LINK(f) #endif /* _MSC_VER */ #define EAX 0 #define EBX 1 #define ECX 2 #define EDX 3 static word32 cpuid_check = 0; static word32 cpuid_flags = 0; static word32 cpuid_flag(word32 leaf, word32 sub, word32 num, word32 bit) { int got_intel_cpu = 0; int got_amd_cpu = 0; unsigned int reg[5]; reg[4] = '\0'; cpuid(reg, 0, 0); /* check for Intel cpu */ if (XMEMCMP((char *)&(reg[EBX]), "Genu", 4) == 0 && XMEMCMP((char *)&(reg[EDX]), "ineI", 4) == 0 && XMEMCMP((char *)&(reg[ECX]), "ntel", 4) == 0) { got_intel_cpu = 1; } /* check for AMD cpu */ if (XMEMCMP((char *)&(reg[EBX]), "Auth", 4) == 0 && XMEMCMP((char *)&(reg[EDX]), "enti", 4) == 0 && XMEMCMP((char *)&(reg[ECX]), "cAMD", 4) == 0) { got_amd_cpu = 1; } if (got_intel_cpu || got_amd_cpu) { cpuid(reg, leaf, sub); return ((reg[num] >> bit) & 0x1); } return 0; } void cpuid_set_flags(void) { if (!cpuid_check) { if (cpuid_flag(1, 0, ECX, 28)) { cpuid_flags |= CPUID_AVX1 ; } if (cpuid_flag(7, 0, EBX, 5)) { cpuid_flags |= CPUID_AVX2 ; } if (cpuid_flag(7, 0, EBX, 8)) { cpuid_flags |= CPUID_BMI2 ; } if (cpuid_flag(1, 0, ECX, 30)) { cpuid_flags |= CPUID_RDRAND; } if (cpuid_flag(7, 0, EBX, 18)) { cpuid_flags |= CPUID_RDSEED; } if (cpuid_flag(1, 0, ECX, 25)) { cpuid_flags |= CPUID_AESNI ; } if (cpuid_flag(7, 0, EBX, 19)) { cpuid_flags |= CPUID_ADX ; } if (cpuid_flag(1, 0, ECX, 22)) { cpuid_flags |= CPUID_MOVBE ; } cpuid_check = 1; } } #endif #ifdef HAVE_CPUID word32 cpuid_get_flags(void) { if (!cpuid_check) cpuid_set_flags(); return cpuid_flags; } void cpuid_select_flags(word32 flags) { cpuid_flags = flags; } void cpuid_set_flag(word32 flag) { cpuid_flags |= flag; } void cpuid_clear_flag(word32 flag) { cpuid_flags &= ~flag; } #endif /* HAVE_CPUID */
/* Copyright 2013 David Axmark 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. */ /** * @file WebScreen.h * @author Emma Tresanszki * * This file contains the last screen of the application * It contains a top layout with a hint label and a button, and a web view. */ #ifndef WEBSCREENNUI_H_ #define WEBSCREENNUI_H_ // Include the library for event handling listener. #include "MAUtil/Environment.h" // Include the base screen class. #include "BasicScreen.h" namespace WikiNativeUI { // Forward declaration. class SummaryScreen; /** * WebScreen: native UI screen * It contains a web view with the user selected article, and buttons * for Back and NewSearch actions. */ class WebScreen : public BasicScreen, public CustomEventListener, public KeyListener { public: /** * Constructor. * Pass the parent screen. */ WebScreen(SummaryScreen *parentScreen); /** * Destructor. */ ~WebScreen(); /** * Show the screen. */ void showScreen(); /** * From KeyListener. * This function is called with a \link #MAK_FIRST MAK_ code \endlink when * a key is pressed. */ virtual void keyPressEvent(int keyCode, int nativeCode); /** * from CustomEventListener * The custom event listener interface. */ void customEvent(const MAEvent& event); /** * Handle events on screen's widgets. */ void widgetClicked(MAHandle widgetHandle); /** * Open a web view for a certain title * compose the url and display * @param The article title for which we want to open a wikipedia definition. */ void openWebView(MAUtil::String title); private: // methods /** * Lay out the widgets (portrait mode). */ void setupUI(); private: // members /** Previous screen. */ SummaryScreen* mPrevScreen; // NativeUI widgets handles /** The screen. */ MAWidgetHandle mScreen; /** Main vertical layout. */ MAWidgetHandle mMainLayout; /** Label in the top layout. */ MAWidgetHandle mLabel; /** Back button - to SummaryScreen. */ MAWidgetHandle mBackButton; /** Button for New Search - initiated from the HomeScreen. */ MAWidgetHandle mNewSearchButton; /** The web view. */ MAWidgetHandle mWebView; }; } // namespace WikiNativeUI #endif /* WEBSCREENNUI_H_ */
/* * * debugger.c * * (C)2006 by Friedrich Gräter * * This file is distributed under the terms of * the GNU General Public License, Version 2. You * should have received a copy of this license (e.g. in * the file 'copying'). * * Debugger initialization * */ #include <hydrixos/types.h> #include <hydrixos/tls.h> #include <hydrixos/errno.h> #include <hydrixos/mem.h> #include "../hyinit.h" #include "coredbg.h" /* * debugger_main * * Startup code of the core debugger process. * */ int debugger_main(void) { /* Initialize the display driver */ dbg_init_driver(); dbg_create_window("View 2"); dbg_create_window("View 3"); dbg_create_window("View 4"); dbg_create_window("View 5"); dbg_create_window("View 6"); dbg_create_window("View 7"); dbg_create_window("View 8"); dbg_create_window("View 9"); dbg_create_window("View 10"); dbg_create_window("View 11"); dbg_create_window("View 12"); /* Initialize the shell */ dbg_init_shell(); /*** Test code **/ dbg_set_termcolor(1, DBGCOL_WHITE); dbg_isprintf("HydrixOS Operating System 0.0.2\n"); dbg_isprintf("-------------------------------\n\n"); dbg_set_termcolor(1, DBGCOL_GREY); dbg_isprintf("HyCoreDbg - HydrixOS Core Debugger v 0.0.1\n"); dbg_isprintf("This application will help you to debug the first\n"); dbg_isprintf("initial processes of HydrixOS. It gives you a\n"); dbg_isprintf("terminal with different windows (F1 - F12) and interactive\n"); dbg_isprintf("shells for debugging the system. The application waits\n"); dbg_isprintf("now for incomming debugging requests from the other\n"); dbg_isprintf("threads.\n\n"); while(1) dbg_logon_loop(); return 0; }
#pragma once #include <libethereum/Executive.h> #include "DebugFace.h" namespace dev { namespace eth { class Client; } namespace rpc { class SessionManager; class Debug: public DebugFace { public: explicit Debug(eth::Client const& _eth); virtual RPCModules implementedModules() const override { return RPCModules{RPCModule{"debug", "1.0"}}; } virtual Json::Value debug_traceTransaction(std::string const& _txHash, Json::Value const& _json) override; virtual Json::Value debug_traceCall(Json::Value const& _call, std::string const& _blockNumber, Json::Value const& _options) override; virtual Json::Value debug_traceBlockByNumber(int _blockNumber, Json::Value const& _json) override; virtual Json::Value debug_traceBlockByHash(std::string const& _blockHash, Json::Value const& _json) override; virtual Json::Value debug_storageRangeAt(std::string const& _blockHashOrNumber, int _txIndex, std::string const& _address, std::string const& _begin, int _maxResults) override; virtual std::string debug_preimage(std::string const& _hashedKey) override; virtual Json::Value debug_traceBlock(std::string const& _blockRlp, Json::Value const& _json); private: eth::Client const& m_eth; h256 blockHash(std::string const& _blockHashOrNumber) const; Json::Value traceTransaction(dev::eth::Executive& _e, dev::eth::Transaction const& _t, Json::Value const& _json); Json::Value traceBlock(dev::eth::Block const& _block, Json::Value const& _json); }; } }
/* ScummVM - Graphic Adventure Engine * * ScummVM is the legal property of its developers, whose names * are too numerous to list here. Please refer to the COPYRIGHT * file distributed with this source distribution. * * 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. * */ // Music class #ifndef M4_MIDI_H #define M4_MIDI_H #include "audio/midiplayer.h" namespace M4 { class MidiPlayer : public Audio::MidiPlayer { public: MidiPlayer(MadsM4Engine *vm); void playMusic(const char *name, int32 vol, bool loop, int32 trigger, int32 scene); void setGM(bool isGM) { _isGM = isGM; } // MidiDriver_BASE interface implementation virtual void send(uint32 b); protected: MadsM4Engine *_vm; bool _isGM; bool _randomLoop; byte *_musicData; uint16 *_buf; size_t _musicDataSize; byte *convertHMPtoSMF(byte *data, uint32 inSize, uint32 &outSize); }; } // End of namespace M4 #endif
#ifndef __LINUX_PM_H #define __LINUX_PM_H struct device; typedef struct pm_message { int event; } pm_message_t; #define PM_EVENT_INVALID (-1) #define PM_EVENT_ON 0x0000 #define PM_EVENT_FREEZE 0x0001 #define PM_EVENT_SUSPEND 0x0002 #define PM_EVENT_HIBERNATE 0x0004 #define PM_EVENT_QUIESCE 0x0008 #define PM_EVENT_RESUME 0x0010 #define PM_EVENT_THAW 0x0020 #define PM_EVENT_RESTORE 0x0040 #define PM_EVENT_RECOVER 0x0080 #define PM_EVENT_USER 0x0100 #define PM_EVENT_REMOTE 0x0200 #define PM_EVENT_AUTO 0x0400 #define PMSG_INVALID ((struct pm_message){ .event = PM_EVENT_INVALID, }) #define PMSG_ON ((struct pm_message){ .event = PM_EVENT_ON, }) #define PMSG_FREEZE ((struct pm_message){ .event = PM_EVENT_FREEZE, }) #define PMSG_QUIESCE ((struct pm_message){ .event = PM_EVENT_QUIESCE, }) #define PMSG_SUSPEND ((struct pm_message){ .event = PM_EVENT_SUSPEND, }) #define PMSG_HIBERNATE ((struct pm_message){ .event = PM_EVENT_HIBERNATE, }) #define PMSG_RESUME ((struct pm_message){ .event = PM_EVENT_RESUME, }) #define PMSG_THAW ((struct pm_message){ .event = PM_EVENT_THAW, }) #define PMSG_RESTORE ((struct pm_message){ .event = PM_EVENT_RESTORE, }) #define PMSG_RECOVER ((struct pm_message){ .event = PM_EVENT_RECOVER, }) #define PMSG_USER_SUSPEND ((struct pm_message) \ { .event = PM_EVENT_USER_SUSPEND, }) #define PMSG_USER_RESUME ((struct pm_message) \ { .event = PM_EVENT_USER_RESUME, }) #define PMSG_REMOTE_RESUME ((struct pm_message) \ { .event = PM_EVENT_REMOTE_RESUME, }) #define PMSG_AUTO_SUSPEND ((struct pm_message) \ { .event = PM_EVENT_AUTO_SUSPEND, }) #define PMSG_AUTO_RESUME ((struct pm_message) \ { .event = PM_EVENT_AUTO_RESUME, }) /* stripped version */ struct dev_pm_info { pm_message_t power_state; }; /* stripped version */ struct dev_pm_ops { int (*prepare)(struct device *dev); void (*complete)(struct device *dev); int (*suspend)(struct device *dev); int (*resume)(struct device *dev); int (*freeze)(struct device *dev); int (*thaw)(struct device *dev); int (*poweroff)(struct device *dev); int (*restore)(struct device *dev); int (*runtime_suspend)(struct device *dev); int (*runtime_resume)(struct device *dev); int (*runtime_idle)(struct device *dev); }; #define SET_SYSTEM_SLEEP_PM_OPS(suspend_fn, resume_fn) \ .suspend = suspend_fn, \ .resume = resume_fn, #define SET_RUNTIME_PM_OPS(suspend_fn, resume_fn, idle_fn) \ .runtime_suspend = suspend_fn, \ .runtime_resume = resume_fn, \ .runtime_idle = idle_fn, #endif /* __LINUX_PM_H */
#include <linux/smp.h> #include <linux/timex.h> #include <linux/string.h> #include <linux/seq_file.h> #include <linux/cpufreq.h> #include <linux/sched.h> /* * Get CPU information for use by the procfs. */ static void show_cpuinfo_core(struct seq_file *m, struct cpuinfo_x86 *c, unsigned int cpu) { #ifdef CONFIG_SMP seq_printf(m, "physical id\t: %d\n", c->phys_proc_id); seq_printf(m, "siblings\t: %d\n", cpumask_weight(cpu_core_mask(cpu))); seq_printf(m, "core id\t\t: %d\n", c->cpu_core_id); seq_printf(m, "cpu cores\t: %d\n", c->booted_cores); seq_printf(m, "apicid\t\t: %d\n", c->apicid); seq_printf(m, "initial apicid\t: %d\n", c->initial_apicid); #endif } #ifdef CONFIG_X86_32 static void show_cpuinfo_misc(struct seq_file *m, struct cpuinfo_x86 *c) { /* * We use exception 16 if we have hardware math and we've either seen * it or the CPU claims it is internal */ int fpu_exception = c->hard_math && (ignore_fpu_irq || cpu_has_fpu); seq_printf(m, "fdiv_bug\t: %s\n" "hlt_bug\t\t: %s\n" "f00f_bug\t: %s\n" "coma_bug\t: %s\n" "fpu\t\t: %s\n" "fpu_exception\t: %s\n" "cpuid level\t: %d\n" "wp\t\t: %s\n", c->fdiv_bug ? "yes" : "no", c->hlt_works_ok ? "no" : "yes", c->f00f_bug ? "yes" : "no", c->coma_bug ? "yes" : "no", c->hard_math ? "yes" : "no", fpu_exception ? "yes" : "no", c->cpuid_level, c->wp_works_ok ? "yes" : "no"); } #else static void show_cpuinfo_misc(struct seq_file *m, struct cpuinfo_x86 *c) { seq_printf(m, "fpu\t\t: yes\n" "fpu_exception\t: yes\n" "cpuid level\t: %d\n" "wp\t\t: yes\n", c->cpuid_level); } #endif extern void __do_cpuid_fault(unsigned int op, unsigned int count, unsigned int *eax, unsigned int *ebx, unsigned int *ecx, unsigned int *edx); struct cpu_flags { u32 val[RHNCAPINTS]; }; static DEFINE_PER_CPU(struct cpu_flags, cpu_flags); static void init_cpu_flags(void *dummy) { struct cpu_flags *flags; flags = &get_cpu_var(cpu_flags); get_cpu_cap_masked(flags->val); put_cpu_var(cpu_flags); } static int show_cpuinfo(struct seq_file *m, void *v) { struct cpuinfo_x86 *c = v; unsigned int cpu = 0; int is_super = ve_is_super(get_exec_env()); int i; #ifdef CONFIG_SMP cpu = c->cpu_index; #endif seq_printf(m, "processor\t: %u\n" "vendor_id\t: %s\n" "cpu family\t: %d\n" "model\t\t: %u\n" "model name\t: %s\n", cpu, c->x86_vendor_id[0] ? c->x86_vendor_id : "unknown", c->x86, c->x86_model, c->x86_model_id[0] ? c->x86_model_id : "unknown"); if (c->x86_mask || c->cpuid_level >= 0) seq_printf(m, "stepping\t: %d\n", c->x86_mask); else seq_printf(m, "stepping\t: unknown\n"); if (c->microcode) seq_printf(m, "microcode\t: %u\n", c->microcode); if (cpu_has(c, X86_FEATURE_TSC)) { unsigned int freq = cpufreq_quick_get(cpu); if (!freq) freq = cpu_khz; freq = sched_cpulimit_scale_cpufreq(freq); seq_printf(m, "cpu MHz\t\t: %u.%03u\n", freq / 1000, (freq % 1000)); } /* Cache size */ if (c->x86_cache_size >= 0) seq_printf(m, "cache size\t: %d KB\n", c->x86_cache_size); show_cpuinfo_core(m, c, cpu); show_cpuinfo_misc(m, c); seq_printf(m, "flags\t\t:"); for (i = 0; i < 32*RHNCAPINTS; i++) if (x86_cap_flags[i] != NULL && ((is_super && cpu_has(c, i)) || (!is_super && test_bit(i, (unsigned long *) &per_cpu(cpu_flags, cpu))))) seq_printf(m, " %s", x86_cap_flags[i]); seq_printf(m, "\nbogomips\t: %lu.%02lu\n", c->loops_per_jiffy/(500000/HZ), (c->loops_per_jiffy/(5000/HZ)) % 100); #ifdef CONFIG_X86_64 if (c->x86_tlbsize > 0) seq_printf(m, "TLB size\t: %d 4K pages\n", c->x86_tlbsize); #endif seq_printf(m, "clflush size\t: %u\n", c->x86_clflush_size); seq_printf(m, "cache_alignment\t: %d\n", c->x86_cache_alignment); seq_printf(m, "address sizes\t: %u bits physical, %u bits virtual\n", c->x86_phys_bits, c->x86_virt_bits); seq_printf(m, "power management:"); for (i = 0; i < 32; i++) { if (c->x86_power & (1 << i)) { if (i < ARRAY_SIZE(x86_power_flags) && x86_power_flags[i]) seq_printf(m, "%s%s", x86_power_flags[i][0] ? " " : "", x86_power_flags[i]); else seq_printf(m, " [%d]", i); } } seq_printf(m, "\n\n"); return 0; } static void *__c_start(struct seq_file *m, loff_t *pos) { if (*pos == 0) /* just in case, cpu 0 is not the first */ *pos = cpumask_first(cpu_online_mask); else *pos = cpumask_next(*pos - 1, cpu_online_mask); if (__cpus_weight(cpu_online_mask, *pos) < num_online_vcpus()) return &cpu_data(*pos); return NULL; } static void *c_start(struct seq_file *m, loff_t *pos) { init_cpu_flags(NULL); smp_call_function(init_cpu_flags, NULL, 1); return __c_start(m, pos); } static void *c_next(struct seq_file *m, void *v, loff_t *pos) { (*pos)++; return __c_start(m, pos); } static void c_stop(struct seq_file *m, void *v) { } const struct seq_operations cpuinfo_op = { .start = c_start, .next = c_next, .stop = c_stop, .show = show_cpuinfo, };
/* mySQL I/O routines for GTimeTracker * Copyright (C) 2001 Thomas Langaas <tlan@initio.no> * * 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 <mysql/mysql.h> #include "mysqlinterface.h" static GteErrCode err = GTT_NO_ERR; GttProject *gtt_mysql_loadprojectdefaults(void) { } void gtt_mysql_savedata(GList *projectlist) { } GList *gtt_mysql_loaddata(void) { } GttErrCode gtt_mysql_geterror(void) { return err; } void gtt_mysql_clearerror(void) { err = GTT_NO_ERR; }
/* * statdb_dump.c -- dump contents of statd's monitor DB * * Copyright (C) 2010 Red Hat, Jeff Layton <jlayton@redhat.com> * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301, USA. */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include <string.h> #include <stdio.h> #include <errno.h> #include <arpa/inet.h> #include "nsm.h" #include "xlog.h" static char cookiebuf[(SM_PRIV_SIZE * 2) + 1]; static char addrbuf[INET6_ADDRSTRLEN + 1]; static unsigned int dump_host(const char *hostname, const struct sockaddr *sa, const struct mon *m, const time_t timestamp) { int ret; const char *addr; const struct sockaddr_in *sin; const struct sockaddr_in6 *sin6; ret = nsm_priv_to_hex(m->priv, cookiebuf, sizeof(cookiebuf)); if (!ret) { xlog(L_ERROR, "Unable to convert cookie to hex string.\n"); return ret; } switch (sa->sa_family) { case AF_INET: sin = (struct sockaddr_in *)(char *)sa; addr = inet_ntop(sa->sa_family, &sin->sin_addr.s_addr, addrbuf, (socklen_t)sizeof(addrbuf)); break; case AF_INET6: sin6 = (struct sockaddr_in6 *)(char *)sa; addr = inet_ntop(sa->sa_family, &sin6->sin6_addr, addrbuf, (socklen_t)sizeof(addrbuf)); break; default: xlog(L_ERROR, "Unrecognized address family: %hu\n", sa->sa_family); return 0; } if (addr == NULL) { xlog(L_ERROR, "Unable to convert sockaddr to string: %s\n", strerror(errno)); return 0; } /* * Callers of this program should assume that in the future, extra * fields may be added to the output. Anyone adding extra fields to * the output should add them to the end of the line. */ printf("%s %s %s %s %s %d %d %d\n", hostname, addr, cookiebuf, m->mon_id.mon_name, m->mon_id.my_id.my_name, m->mon_id.my_id.my_prog, m->mon_id.my_id.my_vers, m->mon_id.my_id.my_proc); return 1; } int main(int argc, char **argv) { xlog_syslog(0); xlog_stderr(1); xlog_open(argv[0]); nsm_load_monitor_list(dump_host); return 0; }
/* * Interface.h * * Created on: 2008-12-28 * Author: victor */ #ifndef INTERFACE_H_ #define INTERFACE_H_ #include <map> #include <string> using namespace std; namespace InfoDTV { namespace DynamicBuilder { namespace FileBuilder { class ITSBuilder { public: map<string,unsigned short> FileIDIndexer; }; class ITSBuilderManager { public: virtual void RegisterBuilder(string aUUID,ITSBuilder *aBuilder,string ParamsMap)=0; virtual void UnRegisterBuilder(string aUUID)=0; virtual string GetTargetIDFromBuilder(string aUUID,string aFileName)=0; }; } } } #endif /* INTERFACE_H_ */
///============================================================================= /// itoa.h - A C++ header to implement itoa() /// Created: 11 Feb 2015 5:08:51pm /// Author: Jeff-Russ ///============================================================================= #pragma once #include <iostream> using namespace std; // A utility function to reverse a string: void reverse(char str[], int length) { int start = 0; int end = length -1; while (start < end) { swap(*(str+start), *(str+end)); start++; end--; } }; char* itoa(int num, char* str, int base) { int i = 0; bool isNegative = false; if (num == 0) // Handle 0 explicitly, otherwise { str[i++] = '0'; // empty string is printed for 0 str[i] = '\0'; return str; } // In standard itoa(), negative if (num < 0 && base == 10) // numbers are handled only with { isNegative = true; // base 10. Otherwise numbers num = -num; // are considered unsigned. } while (num != 0) { int rem = num % base; // Process individual digits str[i++] = (rem > 9)? (rem-10) + 'a' : rem + '0'; num = num/base; } if (isNegative) // If number is negative, append '-' str[i++] = '-'; str[i] = '\0'; // Append string terminator reverse(str, i); // Reverse the string return str; };
/* This file is part of the KDE project Copyright (C) 2002-2004 Ariya Hidayat <ariya@kde.org> (C) 2002-2003 Norbert Andres <nandres@web.de> (C) 2000-2003 Laurent Montel <montel@kde.org> (C) 2002 John Dailey <dailey@vt.edu> (C) 2002 Philipp Mueller <philipp.mueller@gmx.de> (C) 2001-2002 David Faure <faure@kde.org> (C) 2001 Werner Trobin <trobin@kde.org> (C) 2000 Bernd Johannes Wuebben <wuebben@kde.org> This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifndef CALLIGRA_SHEETS_PREFERENCE_DIALOG #define CALLIGRA_SHEETS_PREFERENCE_DIALOG #include <kpagedialog.h> namespace Sonnet { } namespace Calligra { namespace Sheets { class View; /** * \ingroup UI * Dialog to set the application preferences. */ class PreferenceDialog : public KPageDialog { Q_OBJECT public: enum { InterfacePage = 2, OpenSavePage = 4, SpellCheckerPage = 8, PluginPage = 16 }; explicit PreferenceDialog(View* view); ~PreferenceDialog(); void openPage(int flags); public Q_SLOTS: void slotApply(); void slotDefault(); void slotReset(); private Q_SLOTS: void unitChanged(int index); private: class Private; Private * const d; }; } // namespace Sheets } // namespace Calligra #endif // CALLIGRA_SHEETS_PREFERENCE_DIALOG
#ifndef Py_FILEUTILS_H #define Py_FILEUTILS_H #ifdef __cplusplus extern "C" { #endif PyAPI_FUNC(wchar_t *) _Py_char2wchar( const char *arg, size_t *size); PyAPI_FUNC(char*) _Py_wchar2char( const wchar_t *text, size_t *error_pos); #if defined(HAVE_STAT) && !defined(MS_WINDOWS) PyAPI_FUNC(int) _Py_wstat( const wchar_t* path, struct stat *buf); #endif #ifdef HAVE_STAT PyAPI_FUNC(int) _Py_stat( PyObject *path, struct stat *statbuf); #endif PyAPI_FUNC(FILE *) _Py_wfopen( const wchar_t *path, const wchar_t *mode); PyAPI_FUNC(FILE*) _Py_fopen( PyObject *path, const char *mode); #ifdef HAVE_READLINK PyAPI_FUNC(int) _Py_wreadlink( const wchar_t *path, wchar_t *buf, size_t bufsiz); #endif #ifdef HAVE_REALPATH PyAPI_FUNC(wchar_t*) _Py_wrealpath( const wchar_t *path, wchar_t *resolved_path, size_t resolved_path_size); #endif PyAPI_FUNC(wchar_t*) _Py_wgetcwd( wchar_t *buf, size_t size); #ifdef __cplusplus } #endif #endif /* !Py_FILEUTILS_H */
/* This file is part of Darling. Copyright (C) 2019 Lubos Dolezel Darling 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. Darling 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 Darling. If not, see <http://www.gnu.org/licenses/>. */ #include <Foundation/Foundation.h> @interface ABActionURLsOpenURL : NSObject @end
/* Copyright (C) 2015 Matthew Lai Giraffe 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. Giraffe 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 TIMEALLOCATOR_H #define TIMEALLOCATOR_H #include "chessclock.h" #include "search.h" // allocate time for a move given the engine's current clock Search::TimeAllocation AllocateTime(const ChessClock &cc); #endif // TIMEALLOCATOR_H
/* these are just in a sereate file to make it easier to merge into * the stock tkWm.c */ void TkWmSetWmProtocols _ANSI_ARGS_(( TkWindow *winPtr )); void TkWmProtocolEventProc _ANSI_ARGS_(( TkWindow *winPtr, XEvent *eventPtr )); int WmProtocolCmd _ANSI_ARGS_(( Tcl_Interp *interp, char **CmdPtr, int argc, char **argv ));
// Copyright (c) 2008 Roberto Raggi <roberto.raggi@gmail.com> // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. #pragma once #include "CPlusPlusForwardDeclarations.h" #include "Symbol.h" #include "Names.h" namespace CPlusPlus { class CPLUSPLUS_EXPORT Scope: public Symbol { public: Scope(TranslationUnit *translationUnit, int sourceLocation, const Name *name); Scope(Clone *clone, Subst *subst, Scope *original); virtual ~Scope(); /// Adds a Symbol to this Scope. void addMember(Symbol *symbol); /// Returns true if this Scope is empty; otherwise returns false. bool isEmpty() const; /// Returns the number of symbols is in the scope. int memberCount() const; /// Returns the Symbol at the given position. Symbol *memberAt(int index) const; typedef Symbol **iterator; /// Returns member iterator to the beginning. iterator memberBegin() const; /// Returns member iterator to the end. iterator memberEnd() const; Symbol *find(const Identifier *id) const; Symbol *find(OperatorNameId::Kind operatorId) const; Symbol *find(const ConversionNameId *conv) const; /// Set the start offset of the scope int startOffset() const; void setStartOffset(int offset); /// Set the end offset of the scope int endOffset() const; void setEndOffset(int offset); const Scope *asScope() const override { return this; } Scope *asScope() override { return this; } private: SymbolTable *_members; int _startOffset; int _endOffset; }; } // namespace CPlusPlus
/* RetroArch - A frontend for libretro. * Copyright (C) 2014-2015 - Jean-André Santoni * Copyright (C) 2011-2016 - Daniel De Matteis * * RetroArch is free software: you can redistribute it and/or modify it under the terms * of the GNU General Public License as published by the Free Software Found- * ation, either version 3 of the License, or (at your option) any later version. * * RetroArch is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR * PURPOSE. See the GNU General Public License for more details. * * You should have received a copy of the GNU General Public License along with RetroArch. * If not, see <http://www.gnu.org/licenses/>. */ #ifndef _MENU_ANIMATION_H #define _MENU_ANIMATION_H #include <stdint.h> #include <stdlib.h> #include <boolean.h> #include <retro_common_api.h> RETRO_BEGIN_DECLS typedef float (*easing_cb) (float, float, float, float); typedef void (*tween_cb) (void); enum menu_animation_ctl_state { MENU_ANIMATION_CTL_NONE = 0, MENU_ANIMATION_CTL_IS_ACTIVE, MENU_ANIMATION_CTL_DEINIT, MENU_ANIMATION_CTL_CLEAR_ACTIVE, MENU_ANIMATION_CTL_SET_ACTIVE, MENU_ANIMATION_CTL_DELTA_TIME, MENU_ANIMATION_CTL_UPDATE_TIME, MENU_ANIMATION_CTL_UPDATE, MENU_ANIMATION_CTL_KILL_BY_TAG, MENU_ANIMATION_CTL_KILL_BY_SUBJECT, MENU_ANIMATION_CTL_TICKER, MENU_ANIMATION_CTL_PUSH, MENU_ANIMATION_CTL_IDEAL_DELTA_TIME_GET }; enum menu_animation_easing_type { /* Linear */ EASING_LINEAR = 0, /* Quad */ EASING_IN_QUAD, EASING_OUT_QUAD, EASING_IN_OUT_QUAD, EASING_OUT_IN_QUAD, /* Cubic */ EASING_IN_CUBIC, EASING_OUT_CUBIC, EASING_IN_OUT_CUBIC, EASING_OUT_IN_CUBIC, /* Quart */ EASING_IN_QUART, EASING_OUT_QUART, EASING_IN_OUT_QUART, EASING_OUT_IN_QUART, /* Quint */ EASING_IN_QUINT, EASING_OUT_QUINT, EASING_IN_OUT_QUINT, EASING_OUT_IN_QUINT, /* Sine */ EASING_IN_SINE, EASING_OUT_SINE, EASING_IN_OUT_SINE, EASING_OUT_IN_SINE, /* Expo */ EASING_IN_EXPO, EASING_OUT_EXPO, EASING_IN_OUT_EXPO, EASING_OUT_IN_EXPO, /* Circ */ EASING_IN_CIRC, EASING_OUT_CIRC, EASING_IN_OUT_CIRC, EASING_OUT_IN_CIRC, /* Bounce */ EASING_IN_BOUNCE, EASING_OUT_BOUNCE, EASING_IN_OUT_BOUNCE, EASING_OUT_IN_BOUNCE }; typedef struct menu_animation_ctx_delta { float current; float ideal; } menu_animation_ctx_delta_t; typedef struct menu_animation_ctx_tag { int id; } menu_animation_ctx_tag_t; typedef struct menu_animation_ctx_subject { size_t count; const void *data; } menu_animation_ctx_subject_t; typedef struct menu_animation_ctx_entry { float duration; float target_value; float *subject; enum menu_animation_easing_type easing_enum; int tag; tween_cb cb; } menu_animation_ctx_entry_t; typedef struct menu_animation_ctx_ticker { char *s; size_t len; uint64_t idx; const char *str; bool selected; } menu_animation_ctx_ticker_t; bool menu_animation_ctl(enum menu_animation_ctl_state state, void *data); RETRO_END_DECLS #endif
/* rc5.h */ /* This file is part of the AVR-Crypto-Lib. Copyright (C) 2006-2015 Daniel Otte (bg@nerilex.org) This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. */ /* rc5.h a C implementation of RC5 for AVR microcontrollers * * author: Daniel Otte * email: bg@nerilex.org * license: GPLv3 * * this implementation is limited to 64bit blocks and a maximum of 255 rounds * */ #ifndef RC5_H_ #define RC5_H_ #include <stdint.h> #include <stdlib.h> /* malloc() & free() */ #include <string.h> /* memset() & memcpy() */ typedef struct rc5_ctx_st { uint8_t rounds; uint32_t *s; }rc5_ctx_t; void rc5_enc(void *buffer, const rc5_ctx_t *ctx); void rc5_dec(void *buffer, const rc5_ctx_t *ctx); void rc5_init(void *key, uint16_t keysize_b, uint8_t rounds, rc5_ctx_t *ctx); void rc5_free(rc5_ctx_t *ctx); #endif /*RC5_H_*/
/* * Copyright (C) 2006,2007 Christoph Sommer <christoph.sommer@informatik.uni-erlangen.de> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef DYMOACCESS_H #define DYMOACCESS_H #include "INETDefs.h" #include "ModuleAccess.h" #include "DYMO.h" /** * Locate's a Module's DYMO Module by name ("dymo") */ class DYMOAccess : public ModuleAccess<DYMO> { public: DYMOAccess() : ModuleAccess<DYMO>("dymo") {}; }; #endif
#ifdef TI83P # include <ti83pdefs.h> # include <ti83p.h> unsigned char IBounds(unsigned char x, unsigned char y) __naked { x; y; __asm push iy push bc push hl ld iy,#flags___dw ld hl,#8 add hl,sp ld b,(hl) inc hl ld c,(hl) BCALL(_IBounds___db) pop hl pop bc pop iy ld l,#1 ret c dec l ret __endasm; } #endif
/***************************************************************** * * This file is part of the FLIRTLib project * * FLIRTLib Copyright (c) 2010 Gian Diego Tipaldi and Kai O. Arras * * This software is licensed under the "Creative Commons * License (Attribution-NonCommercial-ShareAlike 3.0)" * and is copyrighted by Gian Diego Tipaldi and Kai O. Arras * * Further information on this license can be found at: * http://creativecommons.org/licenses/by-nc-sa/3.0/ * * FLIRTLib 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. * *****************************************************************/ #ifndef SIMPLEMINMAXPEAKFINDER_H_ #define SIMPLEMINMAXPEAKFINDER_H_ #include <utils/SimplePeakFinder.h> #include <vector> /** * Representation of a simple algorithm for peak finding. * The class represents a simple algorithm for finding peaks in discrete signals. * The algorithm finds both positive and negative peaks. * * @author Gian Diego Tipaldi */ class SimpleMinMaxPeakFinder: public SimplePeakFinder{ public: /** * Constructor. Creates and initializes the peak finder. * * @param minValue The minimum value for a peak to be considerated valid. The negative value is used for the negative peak. * @param minDifference The minimum difference a peak should have with respect to its immediate neighbours. The negative value is used for the negative peak. */ SimpleMinMaxPeakFinder(double minValue = 0.0, double minDifference = 0.0); /** Default destructor. */ virtual ~SimpleMinMaxPeakFinder() { } virtual bool isPeak(const std::vector<double>& signal, unsigned int index) const; }; #endif
/***********************************/ /* Theta neuron simulation library */ /***********************************/ #include<stdio.h> #include<stdlib.h> #include<math.h> #include<string.h> #include<gsl/gsl_rng.h> #include<gsl/gsl_randist.h> #include<ctype.h> #include<limits.h> /* Additional libraries (custom libraries) */ #include "utils.h" #include "common.h" #include "theta.h" #include "intg.h" /* === FUNCTION th ==================== * Description: Theta neuron algorithm * Variables: Theta_i and parameters * ======================================= */ t_th THETA(t_data d,t_th th) { double (*fptr) (double, t_th); fptr = theta; if((th.th = rk4(th.th,th,d.dt,fptr)) >= PI) { th.spike2 = 1; th.th = -PI; } return th; } /* === FUNCTION theta ==================== * Description: Theta neuron equation * Variables: Theta variable and parameters * ======================================= */ double theta(double x, t_th t) { double a, b, theta_punto; a = t.eta + t.J*t.r2 + t.g*t.V0*t.r2; b = t.g*t.r2; theta_punto = 1 - cos(x) + a*(1 + cos(x)) - b*sin(x); return theta_punto; }
/**************************************************************************** ** ** Copyright (C) 2016 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** ** This file is part of Qt Creator. ** ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in ** a written agreement between you and The Qt Company. For licensing terms ** and conditions see https://www.qt.io/terms-conditions. For further ** information use the contact form at https://www.qt.io/contact-us. ** ** GNU General Public License Usage ** Alternatively, this file may be used under the terms of the GNU ** General Public License version 3 as published by the Free Software ** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT ** included in the packaging of this file. Please review the following ** information to ensure the GNU General Public License requirements will ** be met: https://www.gnu.org/licenses/gpl-3.0.html. ** ****************************************************************************/ #pragma once #include "utils_global.h" #include <QWizard> namespace Utils { class Wizard; class WizardProgress; class WizardPrivate; const char SHORT_TITLE_PROPERTY[] = "shortTitle"; class QTCREATOR_UTILS_EXPORT Wizard : public QWizard { Q_OBJECT Q_PROPERTY(bool automaticProgressCreationEnabled READ isAutomaticProgressCreationEnabled WRITE setAutomaticProgressCreationEnabled) public: explicit Wizard(QWidget *parent = nullptr, Qt::WindowFlags flags = {}); ~Wizard() override; bool isAutomaticProgressCreationEnabled() const; void setAutomaticProgressCreationEnabled(bool enabled); void setStartId(int pageId); WizardProgress *wizardProgress() const; template<class T> T *find() const { const QList<int> pages = pageIds(); for (int id : pages) { if (T *result = qobject_cast<T *>(page(id))) return result; } return 0; } // will return true for all fields registered via Utils::WizardPage::registerFieldWithName(...) bool hasField(const QString &name) const; void registerFieldName(const QString &name); QSet<QString> fieldNames() const; virtual QHash<QString, QVariant> variables() const; void showVariables(); protected: virtual QString stringify(const QVariant &v) const; virtual QString evaluate(const QVariant &v) const; bool event(QEvent *event) override; private: void _q_currentPageChanged(int pageId); void _q_pageAdded(int pageId); void _q_pageRemoved(int pageId); Q_DECLARE_PRIVATE(Wizard) class WizardPrivate *d_ptr; }; class WizardProgressItem; class WizardProgressPrivate; class QTCREATOR_UTILS_EXPORT WizardProgress : public QObject { Q_OBJECT public: WizardProgress(QObject *parent = nullptr); ~WizardProgress() override; WizardProgressItem *addItem(const QString &title); void removeItem(WizardProgressItem *item); void removePage(int pageId); static QList<int> pages(WizardProgressItem *item); WizardProgressItem *item(int pageId) const; WizardProgressItem *currentItem() const; QList<WizardProgressItem *> items() const; WizardProgressItem *startItem() const; QList<WizardProgressItem *> visitedItems() const; QList<WizardProgressItem *> directlyReachableItems() const; bool isFinalItemDirectlyReachable() const; // return availableItems().last()->isFinalItem(); Q_SIGNALS: void currentItemChanged(WizardProgressItem *item); void itemChanged(WizardProgressItem *item); // contents of the item: title or icon void itemAdded(WizardProgressItem *item); void itemRemoved(WizardProgressItem *item); void nextItemsChanged(WizardProgressItem *item, const QList<WizardProgressItem *> &items); void nextShownItemChanged(WizardProgressItem *item, WizardProgressItem *nextShownItem); void startItemChanged(WizardProgressItem *item); private: void setCurrentPage(int pageId); void setStartPage(int pageId); private: friend class Wizard; friend class WizardProgressItem; friend QTCREATOR_UTILS_EXPORT QDebug &operator<<(QDebug &debug, const WizardProgress &progress); Q_DECLARE_PRIVATE(WizardProgress) class WizardProgressPrivate *d_ptr; }; class WizardProgressItemPrivate; class QTCREATOR_UTILS_EXPORT WizardProgressItem // managed by WizardProgress { public: void addPage(int pageId); QList<int> pages() const; void setNextItems(const QList<WizardProgressItem *> &items); QList<WizardProgressItem *> nextItems() const; void setNextShownItem(WizardProgressItem *item); WizardProgressItem *nextShownItem() const; bool isFinalItem() const; // return nextItems().isEmpty(); void setTitle(const QString &title); QString title() const; void setTitleWordWrap(bool wrap); bool titleWordWrap() const; protected: WizardProgressItem(WizardProgress *progress, const QString &title); virtual ~WizardProgressItem(); private: friend class WizardProgress; friend QTCREATOR_UTILS_EXPORT QDebug &operator<<(QDebug &d, const WizardProgressItem &item); Q_DECLARE_PRIVATE(WizardProgressItem) class WizardProgressItemPrivate *d_ptr; }; QTCREATOR_UTILS_EXPORT QDebug &operator<<(QDebug &debug, const WizardProgress &progress); QTCREATOR_UTILS_EXPORT QDebug &operator<<(QDebug &debug, const WizardProgressItem &item); } // namespace Utils
/* ********************************************************************************************************* * * Ä£¿éÃû³Æ : ´°¿Ú¿´ÃŹ·³ÌÐòÍ·Îļþ * ÎļþÃû³Æ : bsp_wwdg.h * °æ ±¾ : V1.0 * ˵ Ã÷ : IWDGÀý³Ì¡£ * Ð޸ļǼ : * °æ±¾ºÅ ÈÕÆÚ ×÷Õß ËµÃ÷ * v1.0 2012-12-23 WildFire Team ST¹Ì¼þ¿â°æ±¾ V3.5.0°æ±¾¡£ * * Copyright (C), 2012-2013, WildFire Team ********************************************************************************************************* */ #ifndef _BSP_WWDG_H #define _BSP_WWDG_H /* ³õʼ»¯ */ void bsp_InitWwdg(uint8_t _ucTreg, uint8_t _ucWreg, uint32_t WWDG_Prescaler); #endif
/* * Broadcom Proprietary and Confidential. Copyright 2016 Broadcom * All Rights Reserved. * * This is UNPUBLISHED PROPRIETARY SOURCE CODE of Broadcom Corporation; * the contents of this file may not be disclosed to third parties, copied * or duplicated in any form, in whole or in part, without the prior * written permission of Broadcom Corporation. */ #pragma once #include "tls_types.h" #include "wiced_result.h" #ifdef __cplusplus extern "C" { #endif /****************************************************** * Macros ******************************************************/ /****************************************************** * Constants ******************************************************/ /****************************************************** * Enumerations ******************************************************/ /****************************************************** * Type Definitions ******************************************************/ /****************************************************** * Structures ******************************************************/ /****************************************************** * Global Variables ******************************************************/ /****************************************************** * Function Declarations ******************************************************/ /*****************************************************************************/ /** @addtogroup tls TLS Security * @ingroup ipcoms * * Security initialisation functions for TLS enabled connections (Transport Layer Security - successor to SSL Secure Sockets Layer ) * * * @{ */ /*****************************************************************************/ /** Initialises a simple TLS context handle * * @param[out] context : A pointer to a wiced_tls_context_t context object that will be initialised * * @return @ref wiced_result_t */ wiced_result_t wiced_tls_init_context( wiced_tls_context_t* context, wiced_tls_identity_t* identity, const char* peer_cn ); /** Set TLS extension. * * @param[in,out] context : A pointer to a wiced_tls_context_t context object * @param[in] extension : A pointer to a wiced_tls_extension_t extension * * @return @ref wiced_result_t */ wiced_result_t wiced_tls_set_extension(wiced_tls_context_t* context, wiced_tls_extension_t* extension); /** Initialises a TLS identity using a supplied certificate and private key * * @param[out] identity : A pointer to a wiced_tls_identity_t object that will be initialised * @param[in] private_key : The server private key in binary format * @param[in] key_length : private key length * @param[in] certificate_data : The server x509 certificate in PEM or DER format * @param[in] certificate_length : The length of the certificate * * @return @ref wiced_result_t */ wiced_result_t wiced_tls_init_identity( wiced_tls_identity_t* identity, const char* private_key, const uint32_t key_length, const uint8_t* certificate_data, uint32_t certificate_length ); /** * NOTE : This API is deprecated and will be discontinued. Use wiced_tls_set_extension() instead. * * Adds a TLS extension to the list of extensions sent in Client Hello message. * * @param[in] context : A pointer to a wiced_tls context initialized with wiced_tls_init_context * @param[in] extension : A pointer to an extension to be added in client hello message. * * @return @ref wiced_result_t */ wiced_result_t wiced_tls_add_extension( wiced_tls_context_t* context, const ssl_extension* extension ); /** DeiInitialises a TLS identity * * @param[in] identity : A pointer to a wiced_tls_identity_t object that will be de-initialised * * @return @ref wiced_result_t */ wiced_result_t wiced_tls_deinit_identity( wiced_tls_identity_t* tls_identity); /** Initialise the trusted root CA certificates * * Initialises the collection of trusted root CA certificates used to verify received certificates * * @param[in] trusted_ca_certificates : A chain of x509 certificates in PEM or DER format * @param[in] length : Certificate length * * @return @ref wiced_result_t */ wiced_result_t wiced_tls_init_root_ca_certificates( const char* trusted_ca_certificates, const uint32_t length ); /** De-initialise the trusted root CA certificates * * De-initialises the collection of trusted root CA certificates used to verify received certificates * * @return @ref wiced_result_t */ wiced_result_t wiced_tls_deinit_root_ca_certificates( void ); /** De-initialise a previously inited simple or advanced context * * @param[in,out] context : a pointer to either a wiced_tls_context_t object * * @return @ref wiced_result_t */ wiced_result_t wiced_tls_deinit_context( wiced_tls_context_t* context ); /** Reset a previously inited simple or advanced context * * @param[in,out] tls_context : a pointer to either a wiced_tls_context_t object * * @return @ref wiced_result_t */ wiced_result_t wiced_tls_reset_context( wiced_tls_context_t* tls_context ); /** @} */ #ifdef __cplusplus } /* extern "C" */ #endif
// Copyright 2010 the V8 project authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef V8_CIRCULAR_QUEUE_H_ #define V8_CIRCULAR_QUEUE_H_ #include "atomicops.h" #include "v8globals.h" namespace v8 { namespace internal { // Lock-free cache-friendly sampling circular queue for large // records. Intended for fast transfer of large records between a // single producer and a single consumer. If the queue is full, // StartEnqueue will return NULL. The queue is designed with // a goal in mind to evade cache lines thrashing by preventing // simultaneous reads and writes to adjanced memory locations. template<typename T, unsigned Length> class SamplingCircularQueue { public: // Executed on the application thread. SamplingCircularQueue(); ~SamplingCircularQueue(); // StartEnqueue returns a pointer to a memory location for storing the next // record or NULL if all entries are full at the moment. T* StartEnqueue(); // Notifies the queue that the producer has complete writing data into the // memory returned by StartEnqueue and it can be passed to the consumer. void FinishEnqueue(); // Executed on the consumer (analyzer) thread. // Retrieves, but does not remove, the head of this queue, returning NULL // if this queue is empty. After the record had been read by a consumer, // Remove must be called. T* Peek(); void Remove(); private: // Reserved values for the entry marker. enum { kEmpty, // Marks clean (processed) entries. kFull // Marks entries already filled by the producer but not yet // completely processed by the consumer. }; struct V8_ALIGNED(PROCESSOR_CACHE_LINE_SIZE) Entry { Entry() : marker(kEmpty) {} T record; Atomic32 marker; }; Entry* Next(Entry* entry); Entry buffer_[Length]; V8_ALIGNED(PROCESSOR_CACHE_LINE_SIZE) Entry* enqueue_pos_; V8_ALIGNED(PROCESSOR_CACHE_LINE_SIZE) Entry* dequeue_pos_; DISALLOW_COPY_AND_ASSIGN(SamplingCircularQueue); }; } } // namespace v8::internal #endif // V8_CIRCULAR_QUEUE_H_
/* * Copyright (c) Facebook, Inc. and its affiliates. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef FOLLY_ARENA_H_ #error This file may only be included from Arena.h #endif // Implementation of Arena.h functions #include <folly/lang/SafeAssert.h> namespace folly { template <class Alloc> void* Arena<Alloc>::allocateSlow(size_t size) { char* start; size_t allocSize; if (!checked_add(&allocSize, std::max(size, minBlockSize()), sizeof(Block))) { throw_exception<std::bad_alloc>(); } if (sizeLimit_ != kNoSizeLimit && allocSize > sizeLimit_ - totalAllocatedSize_) { throw_exception<std::bad_alloc>(); } if (size > minBlockSize()) { // Allocate a large block for this chunk only; don't change ptr_ and end_, // let them point into a normal block (or none, if they're null) allocSize = sizeof(LargeBlock) + size; void* mem = AllocTraits::allocate(alloc(), allocSize); auto blk = new (mem) LargeBlock(allocSize); start = blk->start(); largeBlocks_.push_back(*blk); } else { // Allocate a normal sized block and carve out size bytes from it // Will allocate more than size bytes if convenient // (via ArenaAllocatorTraits::goodSize()) as we'll try to pack small // allocations in this block. allocSize = blockGoodAllocSize(); void* mem = AllocTraits::allocate(alloc(), allocSize); auto blk = new (mem) Block(); start = blk->start(); blocks_.push_back(*blk); currentBlock_ = blocks_.last(); ptr_ = start + size; end_ = start + allocSize - sizeof(Block); assert(ptr_ <= end_); } totalAllocatedSize_ += allocSize; return start; } template <class Alloc> void Arena<Alloc>::merge(Arena<Alloc>&& other) { FOLLY_SAFE_CHECK( blockGoodAllocSize() == other.blockGoodAllocSize(), "cannot merge arenas of different minBlockSize"); blocks_.splice_after(blocks_.before_begin(), other.blocks_); other.blocks_.clear(); largeBlocks_.splice_after(largeBlocks_.before_begin(), other.largeBlocks_); other.largeBlocks_.clear(); other.ptr_ = other.end_ = nullptr; totalAllocatedSize_ += other.totalAllocatedSize_; other.totalAllocatedSize_ = 0; bytesUsed_ += other.bytesUsed_; other.bytesUsed_ = 0; } } // namespace folly
#include <crypto/aes128.h> #include <string.h> #include <printf.h> #include <util.h> uint8_t kek[16] = { 0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07, 0x08,0x09,0x0A,0x0B,0x0C,0x0D,0x0E,0x0F }; uint8_t crypt[24] = { 0x1F,0xA6,0x8B,0x0A,0x81,0x12,0xB4,0x47, 0xAE,0xF3,0x4B,0xD8,0xFB,0x5A,0x7B,0x82, 0x9D,0x3E,0x86,0x23,0x71,0xD2,0xCF,0xE5 }; uint8_t plain[24] = { 0xA6,0xA6,0xA6,0xA6,0xA6,0xA6,0xA6,0xA6, 0x00,0x11,0x22,0x33,0x44,0x55,0x66,0x77, 0x88,0x99,0xAA,0xBB,0xCC,0xDD,0xEE,0xFF }; static void compare(char* tag, uint8_t* got, uint8_t* exp, int nn) { if(!memcmp(got, exp,nn)) return; printf("FAIL %s\n", tag); _exit(0xFF); } int main(void) { int nn = sizeof(crypt); uint8_t work[nn]; memcpy(work, crypt, nn); aes128_unwrap(kek, work, nn); compare("unwrap", work, plain, nn); memcpy(work, plain, nn); aes128_wrap(kek, work, nn); compare("wrap", work, crypt, nn); return 0; }
/***************************************************************************** * * PROJECT: Multi Theft Auto v1.0 * LICENSE: See LICENSE in the top level directory * FILE: mods/shared_logic/lua/CLuaMain.h * PURPOSE: Lua virtual machine container class * * Multi Theft Auto is available from http://www.multitheftauto.com/ * *****************************************************************************/ class CLuaMain; #pragma once #include "CLuaTimerManager.h" #include "lua/CLuaVector2.h" #include "lua/CLuaVector3.h" #include "lua/CLuaVector4.h" #include "lua/CLuaMatrix.h" #include "CLuaFunctionDefs.h" #include <xml/CXMLFile.h> #define MAX_SCRIPTNAME_LENGTH 64 #include <list> struct CRefInfo { unsigned long int ulUseCount; int iFunction; }; class CLuaMain //: public CClient { public: ZERO_ON_NEW CLuaMain(class CLuaManager* pLuaManager, CResource* pResourceOwner, bool bEnableOOP); ~CLuaMain(); bool LoadScriptFromBuffer(const char* cpBuffer, unsigned int uiSize, const char* szFileName); bool LoadScript(const char* szLUAScript); void UnloadScript(); void Start(); void DoPulse(); const char* GetScriptName() const { return m_strScriptName; } void SetScriptName(const char* szName) { m_strScriptName.AssignLeft(szName, MAX_SCRIPTNAME_LENGTH); } lua_State* GetVM() { return m_luaVM; }; CLuaTimerManager* GetTimerManager() const { return m_pLuaTimerManager; }; bool BeingDeleted(); lua_State* GetVirtualMachine() const { return m_luaVM; }; void ResetInstructionCount(); class CResource* GetResource() { return m_pResource; } CXMLFile* CreateXML(const char* szFilename, bool bUseIDs = true, bool bReadOnly = false); CXMLNode* ParseString(const char* strXmlContent); bool DestroyXML(CXMLFile* pFile); bool DestroyXML(CXMLNode* pRootNode); bool SaveXML(CXMLNode* pRootNode); unsigned long GetXMLFileCount() const { return m_XMLFiles.size(); }; unsigned long GetTimerCount() const { return m_pLuaTimerManager ? m_pLuaTimerManager->GetTimerCount() : 0; }; unsigned long GetElementCount() const; void InitClasses(lua_State* luaVM); void InitVM(); void LoadEmbeddedScripts(); const SString& GetFunctionTag(int iLuaFunction); int PCall(lua_State* L, int nargs, int nresults, int errfunc); static int LuaLoadBuffer(lua_State* L, const char* buff, size_t sz, const char* name); static int OnUndump(const char* p, size_t n); bool IsOOPEnabled() { return m_bEnableOOP; } private: void InitSecurity(); static void InstructionCountHook(lua_State* luaVM, lua_Debug* pDebug); SString m_strScriptName; lua_State* m_luaVM; CLuaTimerManager* m_pLuaTimerManager; bool m_bBeingDeleted; // prevent it being deleted twice CElapsedTime m_FunctionEnterTimer; class CResource* m_pResource; std::list<CXMLFile*> m_XMLFiles; std::unordered_set<std::unique_ptr<SXMLString>> m_XMLStringNodes; static SString ms_strExpectedUndumpHash; bool m_bEnableOOP; public: CFastHashMap<const void*, CRefInfo> m_CallbackTable; std::map<int, SString> m_FunctionTagMap; };
#ifndef MANTID_KERNEL_CACHE_H_ #define MANTID_KERNEL_CACHE_H_ //---------------------------------------------------------------------- // Includes //---------------------------------------------------------------------- #include <map> #include "MantidKernel/DllConfig.h" #include "MantidKernel/MultiThreaded.h" #include <mutex> namespace Mantid { namespace Kernel { /** @class Cache Cache.h Kernel/Cache.h Cache is a generic caching storage class. @author Nick Draper, Tessella Support Services plc @date 20/10/2009 Copyright &copy; 2007-9 ISIS Rutherford Appleton Laboratory, NScD Oak Ridge National Laboratory & European Spallation Source This file is part of Mantid. Mantid 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. Mantid is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. File change history is stored at: <https://github.com/mantidproject/mantid>. Code Documentation is available at: <http://doxygen.mantidproject.org> */ template <class KEYTYPE, class VALUETYPE> class DLLExport Cache { public: /// No-arg Constructor Cache() : m_cacheHit(0), m_cacheMiss(0), m_cacheMap(), m_mutex() {} /** * Copy constructor (mutex cannot be copied) * @param src The object that this object shall be constructed from. */ Cache(const Cache<KEYTYPE, VALUETYPE> &src) : m_cacheHit(src.m_cacheHit), m_cacheMiss(src.m_cacheMiss), m_cacheMap(src.m_cacheMap), m_mutex() // New mutex which is unlocked {} /** * Copy-assignment operator as we have a non-default copy constructor * @param rhs The object that is on the RHS of the assignment */ Cache<KEYTYPE, VALUETYPE> &operator=(const Cache<KEYTYPE, VALUETYPE> &rhs) { if (this == &rhs) return *this; // handle self-assignment m_cacheHit = rhs.m_cacheHit; m_cacheMiss = rhs.m_cacheMiss; m_cacheMap = rhs.m_cacheMap; // mutex is untouched return *this; } /// Clears the cache void clear() { std::lock_guard<std::mutex> lock(m_mutex); m_cacheHit = 0; m_cacheMiss = 0; m_cacheMap.clear(); } /// The number of cache entries int size() { return static_cast<int>(m_cacheMap.size()); } /// total number of times the cache has contained the requested information int hitCount() { return m_cacheHit; } /// total number of times the cache has contained the requested information int missCount() { return m_cacheMiss; } /// total number of times the cache has contained the requested /// information/the total number of requests double hitRatio() { double hitRatio = 0.0; if ((m_cacheHit + m_cacheMiss) > 0) { hitRatio = 100.0 * (m_cacheHit * 1.0) / (m_cacheHit + m_cacheMiss); } return hitRatio; } /** * Inserts/updates a cached value with the given key * @param key The key * @param value The new value for the key */ void setCache(const KEYTYPE &key, const VALUETYPE &value) { std::lock_guard<std::mutex> lock(m_mutex); m_cacheMap[key] = value; } /** * Attempts to retrieve a value from the cache, with optional cache stats * tracking @see USE_CACHE_STATS compiler define * @param key The key for the requested value * @param value An output reference for the value, set to the curretn value if * found, otherwise it is untouched * @returns True if the value was found, false otherwise */ bool getCache(const KEYTYPE &key, VALUETYPE &value) const { #ifdef USE_CACHE_STATS bool found = getCacheNoStats(key, value); if (found) { PARALLEL_ATOMIC m_cacheHit++; } else { PARALLEL_ATOMIC m_cacheMiss++; } return found; #else return getCacheNoStats(key, value); #endif } /** * Attempts to remove a value from the cache. If the key does not exist, it * does nothing * @param key The key whose value should be removed */ void removeCache(const KEYTYPE &key) { std::lock_guard<std::mutex> lock(m_mutex); m_cacheMap.erase(key); } private: /** * Attempts to retrieve a value from the cache * @param key The key for the requested value * @param value An output reference for the value, set to the curretn value if * found, otherwise it is untouched * @returns True if the value was found, false otherwise */ bool getCacheNoStats(const KEYTYPE key, VALUETYPE &value) const { std::lock_guard<std::mutex> lock(m_mutex); auto it_found = m_cacheMap.find(key); bool isValid = it_found != m_cacheMap.end(); if (isValid) { value = it_found->second; } return isValid; } /// total number of times the cache has contained the requested information mutable int m_cacheHit; /// total number of times the cache has not contained the requested /// information mutable int m_cacheMiss; /// internal cache map std::map<KEYTYPE, VALUETYPE> m_cacheMap; /// internal mutex mutable std::mutex m_mutex; /// iterator typedef typedef typename std::map<KEYTYPE, VALUETYPE>::iterator CacheMapIterator; /// const_iterator typedef typedef typename std::map<KEYTYPE, VALUETYPE>::const_iterator CacheMapConstIterator; }; } // namespace Kernel } // namespace Mantid #endif /*MANTID_KERNEL_CACHE_H_*/
// ADOBE SYSTEMS INCORPORATED // Copyright 1993 - 2002 Adobe Systems Incorporated // All Rights Reserved // // NOTICE: Adobe permits you to use, modify, and distribute this // file in accordance with the terms of the Adobe license agreement // accompanying it. If you have received this file from a source // other than Adobe, then your use, modification, or distribution // of it requires the prior written permission of Adobe. //------------------------------------------------------------------- //{{NO_DEPENDENCIES}} // Microsoft Developer Studio generated include file. // Used by Selectorama.rc // // Next default values for new objects // #ifdef APSTUDIO_INVOKED #ifndef APSTUDIO_READONLY_SYMBOLS #define _APS_NO_MFC 1 #define _APS_NEXT_RESOURCE_VALUE 101 #define _APS_NEXT_COMMAND_VALUE 40001 #define _APS_NEXT_CONTROL_VALUE 1011 #define _APS_NEXT_SYMED_VALUE 101 #endif #endif
/** ****************************************************************************** * @file Camera/Camera_To_USBDisk/Inc/USBH_conf.h * @author MCD Application Team * @version V1.5.0 * @date 17-February-2017 * @brief General low level driver configuration ****************************************************************************** * @attention * * <h2><center>&copy; Copyright (c) 2017 STMicroelectronics International N.V. * All rights reserved.</center></h2> * * Redistribution and use in source and binary forms, with or without * modification, are permitted, provided that the following conditions are met: * * 1. Redistribution of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * 3. Neither the name of STMicroelectronics nor the names of other * contributors to this software may be used to endorse or promote products * derived from this software without specific written permission. * 4. This software, including modifications and/or derivative works of this * software, must execute solely and exclusively on microcontroller or * microprocessor devices manufactured by or for STMicroelectronics. * 5. Redistribution and use of this software other than as permitted under * this license is void and will automatically terminate your rights under * this license. * * THIS SOFTWARE IS PROVIDED BY STMICROELECTRONICS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS, IMPLIED OR STATUTORY WARRANTIES, INCLUDING, BUT NOT * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A * PARTICULAR PURPOSE AND NON-INFRINGEMENT OF THIRD PARTY INTELLECTUAL PROPERTY * RIGHTS ARE DISCLAIMED TO THE FULLEST EXTENT PERMITTED BY LAW. IN NO EVENT * SHALL STMICROELECTRONICS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, * OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * ****************************************************************************** */ /* Define to prevent recursive inclusion -------------------------------------*/ #ifndef __USBH_CONF_H #define __USBH_CONF_H #include "stm32f4xx.h" #include <stdio.h> #include <stdlib.h> #include <string.h> /* Includes ------------------------------------------------------------------*/ /** @addtogroup USBH_OTG_DRIVER * @{ */ /** @defgroup USBH_CONF * @brief usb otg low level driver configuration file * @{ */ /** @defgroup USBH_CONF_Exported_Defines * @{ */ #define USBH_MAX_NUM_ENDPOINTS 2 #define USBH_MAX_NUM_INTERFACES 2 #define USBH_MAX_NUM_CONFIGURATION 1 #define USBH_MAX_NUM_SUPPORTED_CLASS 1 #define USBH_KEEP_CFG_DESCRIPTOR 0 #define USBH_MAX_SIZE_CONFIGURATION 0x200 #define USBH_MAX_DATA_BUFFER 0x200 #define USBH_DEBUG_LEVEL 0 #define USBH_USE_OS 0 /** @defgroup USBH_Exported_Macros * @{ */ /* Memory management macros */ #define USBH_malloc malloc #define USBH_free free #define USBH_memset memset #define USBH_memcpy memcpy /* DEBUG macros */ #if (USBH_DEBUG_LEVEL > 0) #define USBH_UsrLog(...) printf(__VA_ARGS__);\ printf("\n"); #else #define USBH_UsrLog(...) #endif #if (USBH_DEBUG_LEVEL > 1) #define USBH_ErrLog(...) printf("ERROR: ") ;\ printf(__VA_ARGS__);\ printf("\n"); #else #define USBH_ErrLog(...) #endif #if (USBH_DEBUG_LEVEL > 2) #define USBH_DbgLog(...) printf("DEBUG : ") ;\ printf(__VA_ARGS__);\ printf("\n"); #else #define USBH_DbgLog(...) #endif /** * @} */ #if (USBH_MAX_NUM_CONFIGURATION > 1) #error This USB Host Library version Supports only 1 configuration! #endif /** * @} */ /** @defgroup USBH_CONF_Exported_Types * @{ */ /** * @} */ /** @defgroup USBH_CONF_Exported_Macros * @{ */ /** * @} */ /** @defgroup USBH_CONF_Exported_Variables * @{ */ /** * @} */ /** @defgroup USBH_CONF_Exported_FunctionsPrototype * @{ */ /** * @} */ #endif /* __USBH_CONF_H */ /** * @} */ /** * @} */ /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
#pragma once #undef USE_SETMODE #undef USE_FDOPEN
/* -*- c++ -*- */ /* * Copyright 2008-2012 Free Software Foundation, Inc. * * This file is part of GNU Radio * * GNU Radio is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3, or (at your option) * any later version. * * GNU Radio 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 GNU Radio; see the file COPYING. If not, write to * the Free Software Foundation, Inc., 51 Franklin Street, * Boston, MA 02110-1301, USA. */ #ifndef WATERFALL_DISPLAY_PLOT_H #define WATERFALL_DISPLAY_PLOT_H #include <gnuradio/high_res_timer.h> #include <gnuradio/qtgui/DisplayPlot.h> #include <gnuradio/qtgui/waterfallGlobalData.h> #include <qwt_plot_spectrogram.h> #include <stdint.h> #include <cstdio> #include <vector> #if QWT_VERSION < 0x060000 #include <gnuradio/qtgui/plot_waterfall.h> #else #include <qwt_compat.h> #endif /*! * \brief QWidget for displaying waterfall (spectrogram) plots. * \ingroup qtgui_blk */ class WaterfallDisplayPlot : public DisplayPlot { Q_OBJECT Q_PROPERTY(int intensity_color_map_type1 READ getIntensityColorMapType1 WRITE setIntensityColorMapType1) Q_PROPERTY(QColor low_intensity_color READ getUserDefinedLowIntensityColor WRITE setUserDefinedLowIntensityColor) Q_PROPERTY(QColor high_intensity_color READ getUserDefinedHighIntensityColor WRITE setUserDefinedHighIntensityColor) Q_PROPERTY(int color_map_title_font_size READ getColorMapTitleFontSize WRITE setColorMapTitleFontSize) public: WaterfallDisplayPlot(int nplots, QWidget*); virtual ~WaterfallDisplayPlot(); void resetAxis(); void setFrequencyRange(const double, const double, const double units = 1000.0, const std::string& strunits = "kHz"); double getStartFrequency() const; double getStopFrequency() const; void plotNewData(const std::vector<double*> dataPoints, const int64_t numDataPoints, const double timePerFFT, const gr::high_res_timer_type timestamp, const int droppedFrames); // to be removed void plotNewData(const double* dataPoints, const int64_t numDataPoints, const double timePerFFT, const gr::high_res_timer_type timestamp, const int droppedFrames); void setIntensityRange(const double minIntensity, const double maxIntensity); double getMinIntensity(unsigned int which) const; double getMaxIntensity(unsigned int which) const; void replot(void); void clearData(); int getIntensityColorMapType(unsigned int) const; int getIntensityColorMapType1() const; int getColorMapTitleFontSize() const; const QColor getUserDefinedLowIntensityColor() const; const QColor getUserDefinedHighIntensityColor() const; int getAlpha(unsigned int which); void setAlpha(unsigned int which, int alpha); int getNumRows() const; public slots: void setIntensityColorMapType(const unsigned int, const int, const QColor, const QColor); void setIntensityColorMapType1(int); void setColorMapTitleFontSize(int tfs); void setUserDefinedLowIntensityColor(QColor); void setUserDefinedHighIntensityColor(QColor); void setPlotPosHalf(bool half); void disableLegend(); void enableLegend(); void enableLegend(bool en); void setNumRows(int nrows); signals: void updatedLowerIntensityLevel(const double); void updatedUpperIntensityLevel(const double); private: void _updateIntensityRangeDisplay(); double d_start_frequency; double d_stop_frequency; double d_center_frequency; int d_xaxis_multiplier; bool d_half_freq; bool d_legend_enabled; int d_nrows; std::vector<WaterfallData*> d_data; #if QWT_VERSION < 0x060000 std::vector<PlotWaterfall*> d_spectrogram; #else std::vector<QwtPlotSpectrogram*> d_spectrogram; #endif std::vector<int> d_intensity_color_map_type; QColor d_user_defined_low_intensity_color; QColor d_user_defined_high_intensity_color; int d_color_bar_title_font_size; }; #endif /* WATERFALL_DISPLAY_PLOT_H */
/* * Copyright (C) 2010-2012 Project SkyFire <http://www.projectskyfire.org/> * Copyright (C) 2005-2012 MaNGOS <http://www.getmangos.com/> * Copyright (C) 2008-2012 Trinity <http://www.trinitycore.org/> * Copyright (C) 2005-2012 ScriptDev2 <http://http://www.scriptdev2.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 DEF_BARADIN_HOLD_H_ #define DEF_BARADIN_HOLD_H_ enum Creatures { CREATURE_ARGALOTH = 47120, CREATURE_OCCUTHAR = 52363, // will be in 4.2 }; enum Data { DATA_ARGALOTH, DATA_OCCUTHAR, MAX_ENCOUNTER }; #endif
/* Unix SMB/CIFS implementation. ID Mapping Copyright (C) Simo Sorce 2003 Copyright (C) Jeremy Allison 2006 Copyright (C) Michael Adam 2010 This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>.*/ #include "includes.h" #include "winbindd.h" #include "winbindd_proto.h" #include "idmap.h" #include "idmap_cache.h" #include "../libcli/security/security.h" #include "secrets.h" #undef DBGC_CLASS #define DBGC_CLASS DBGC_IDMAP /***************************************************************** Returns the SID mapped to the given UID. If mapping is not possible returns an error. *****************************************************************/ NTSTATUS idmap_uid_to_sid(struct dom_sid *sid, uid_t uid) { NTSTATUS ret; struct id_map map; bool expired; DEBUG(10, ("idmap_uid_to_sid: uid = [%lu]\n", (unsigned long)uid)); if (winbindd_use_idmap_cache() && idmap_cache_find_uid2sid(uid, sid, &expired)) { DEBUG(10, ("idmap_cache_find_uid2sid found %u%s\n", (unsigned int)uid, expired ? " (expired)": "")); if (expired && idmap_is_online()) { DEBUG(10, ("revalidating expired entry\n")); goto backend; } if (is_null_sid(sid)) { DEBUG(10, ("Returning negative cache entry\n")); return NT_STATUS_NONE_MAPPED; } DEBUG(10, ("Returning positive cache entry\n")); return NT_STATUS_OK; } backend: ZERO_STRUCT(map); map.sid = sid; map.xid.type = ID_TYPE_UID; map.xid.id = uid; ret = idmap_backends_unixid_to_sid(&map); if ( ! NT_STATUS_IS_OK(ret)) { DEBUG(10, ("error mapping uid [%lu]: %s\n", (unsigned long)uid, nt_errstr(ret))); map.status = ID_UNMAPPED; } if (map.status != ID_MAPPED) { if (winbindd_use_idmap_cache()) { struct dom_sid null_sid; struct unixid id; id.type = ID_TYPE_UID; id.id = uid; ZERO_STRUCT(null_sid); idmap_cache_set_sid2unixid(&null_sid, &id); } DEBUG(10, ("uid [%lu] not mapped\n", (unsigned long)uid)); return NT_STATUS_NONE_MAPPED; } if (winbindd_use_idmap_cache()) { idmap_cache_set_sid2unixid(sid, &map.xid); } return NT_STATUS_OK; } /***************************************************************** Returns SID mapped to the given GID. If mapping is not possible returns an error. *****************************************************************/ NTSTATUS idmap_gid_to_sid(struct dom_sid *sid, gid_t gid) { NTSTATUS ret; struct id_map map; bool expired; DEBUG(10, ("idmap_gid_to_sid: gid = [%lu]\n", (unsigned long)gid)); if (winbindd_use_idmap_cache() && idmap_cache_find_gid2sid(gid, sid, &expired)) { DEBUG(10, ("idmap_cache_find_gid2sid found %u%s\n", (unsigned int)gid, expired ? " (expired)": "")); if (expired && idmap_is_online()) { DEBUG(10, ("revalidating expired entry\n")); goto backend; } if (is_null_sid(sid)) { DEBUG(10, ("Returning negative cache entry\n")); return NT_STATUS_NONE_MAPPED; } DEBUG(10, ("Returning positive cache entry\n")); return NT_STATUS_OK; } backend: ZERO_STRUCT(map); map.sid = sid; map.xid.type = ID_TYPE_GID; map.xid.id = gid; ret = idmap_backends_unixid_to_sid(&map); if ( ! NT_STATUS_IS_OK(ret)) { DEBUG(10, ("error mapping gid [%lu]: %s\n", (unsigned long)gid, nt_errstr(ret))); map.status = ID_UNMAPPED; } if (map.status != ID_MAPPED) { if (winbindd_use_idmap_cache()) { struct dom_sid null_sid; struct unixid id; id.type = ID_TYPE_GID; id.id = gid; ZERO_STRUCT(null_sid); idmap_cache_set_sid2unixid(&null_sid, &id); } DEBUG(10, ("gid [%lu] not mapped\n", (unsigned long)gid)); return NT_STATUS_NONE_MAPPED; } if (winbindd_use_idmap_cache()) { idmap_cache_set_sid2unixid(sid, &map.xid); } return NT_STATUS_OK; } /** * check whether a given unix id is inside the filter range of an idmap domain */ bool idmap_unix_id_is_in_range(uint32_t id, struct idmap_domain *dom) { if (id == 0) { /* 0 is not an allowed unix id for id mapping */ return false; } if ((dom->low_id && (id < dom->low_id)) || (dom->high_id && (id > dom->high_id))) { return false; } return true; } /** * Helper for unixids_to_sids: find entry by id in mapping array, * search up to IDMAP_AD_MAX_IDS entries */ struct id_map *idmap_find_map_by_id(struct id_map **maps, enum id_type type, uint32_t id) { int i; for (i = 0; i < IDMAP_LDAP_MAX_IDS; i++) { if (maps[i] == NULL) { /* end of the run */ return NULL; } if ((maps[i]->xid.type == type) && (maps[i]->xid.id == id)) { return maps[i]; } } return NULL; } /** * Helper for sids_to_unix_ids: find entry by SID in mapping array, * search up to IDMAP_AD_MAX_IDS entries */ struct id_map *idmap_find_map_by_sid(struct id_map **maps, struct dom_sid *sid) { int i; for (i = 0; i < IDMAP_LDAP_MAX_IDS; i++) { if (maps[i] == NULL) { /* end of the run */ return NULL; } if (dom_sid_equal(maps[i]->sid, sid)) { return maps[i]; } } return NULL; } char *idmap_fetch_secret(const char *backend, const char *domain, const char *identity) { char *tmp, *ret; int r; r = asprintf(&tmp, "IDMAP_%s_%s", backend, domain); if (r < 0) return NULL; /* make sure the key is case insensitive */ if (!strupper_m(tmp)) { SAFE_FREE(tmp); return NULL; } ret = secrets_fetch_generic(tmp, identity); SAFE_FREE(tmp); return ret; }
/**************************************************************************** ** ** Copyright (C) 2016 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** ** This file is part of Qt Creator. ** ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in ** a written agreement between you and The Qt Company. For licensing terms ** and conditions see https://www.qt.io/terms-conditions. For further ** information use the contact form at https://www.qt.io/contact-us. ** ** GNU General Public License Usage ** Alternatively, this file may be used under the terms of the GNU ** General Public License version 3 as published by the Free Software ** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT ** included in the packaging of this file. Please review the following ** information to ensure the GNU General Public License requirements will ** be met: https://www.gnu.org/licenses/gpl-3.0.html. ** ****************************************************************************/ #pragma once #include "cpptools_global.h" #include <QModelIndex> #include <QObject> QT_BEGIN_NAMESPACE class QAction; class QSortFilterProxyModel; class QTimer; QT_END_NAMESPACE namespace CPlusPlus { class OverviewModel; } namespace TextEditor { class TextEditorWidget; } namespace Utils { class TreeViewComboBox; } namespace CppTools { class CPPTOOLS_EXPORT CppEditorOutline : public QObject { Q_OBJECT public: explicit CppEditorOutline(TextEditor::TextEditorWidget *editorWidget); void update(); CPlusPlus::OverviewModel *model() const; QModelIndex modelIndex(); QWidget *widget() const; // Must be deleted by client. signals: void modelIndexChanged(const QModelIndex &index); public slots: void updateIndex(); void setSorted(bool sort); private: void updateNow(); void updateIndexNow(); void updateToolTip(); void gotoSymbolInEditor(); CppEditorOutline(); bool isSorted() const; QModelIndex indexForPosition(int line, int column, const QModelIndex &rootIndex = QModelIndex()) const; private: TextEditor::TextEditorWidget *m_editorWidget; Utils::TreeViewComboBox *m_combo; // Not owned CPlusPlus::OverviewModel *m_model; QSortFilterProxyModel *m_proxyModel; QModelIndex m_modelIndex; QAction *m_sortAction; QTimer *m_updateTimer; QTimer *m_updateIndexTimer; }; } // namespace CppTools
///////////// Copyright © 2008 LodleNet. All rights reserved. ///////////// // // Project : Server (GES) // File : npc_scientist.h // Description : // [TODO: Write the purpose of npc_scientist.h.] // // Created On: 12/27/2008 1:53:29 PM // Created By: Mark Chandler <mailto:admin@lodle.net> //////////////////////////////////////////////////////////////////////////// #ifndef MC_NPC_SCIENTIST_H #define MC_NPC_SCIENTIST_H #ifdef _WIN32 #pragma once #endif #include "npc_gebase.h" class CNPC_GESScientist : public CNPC_GEBase { public: CNPC_GESScientist(); DECLARE_CLASS( CNPC_GESScientist, CNPC_GEBase ); DECLARE_DATADESC(); DEFINE_CUSTOM_AI; Class_T Classify( void ); const char* GetNPCModel(); int SelectSchedule(); void OnLooked( int iDistance ); void Spawn( void ); }; #endif //MC_NPC_SCIENTIST_H
/* -*- mode: C; c-basic-offset: 2; indent-tabs-mode: nil; -*- */ /* * Copyright (C) 2009-2011 Tiger Soldier * * This file is part of OSD Lyrics. * OSD Lyrics 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. * * OSD Lyrics 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 OSD Lyrics. If not, see <https://www.gnu.org/licenses/>. */ #include <glib.h> #include "ol_player.h" #include "ol_display_module.h" #include "ol_osd_module.h" #include "ol_scroll_module.h" #include "ol_utils.h" #include "ol_debug.h" #define call(func, ...) do { if ((func) != NULL) (func) (__VA_ARGS__); } while (0) static struct OlDisplayClass* _get_class (const char *name); static void _class_free (struct OlDisplayClass *klass); /** * @brief Sets the data of module. * * @param OlDisplayModule * @param data */ static void _set_data (struct OlDisplayModule *module, void *data); static void _register_class (struct OlDisplayClass *klass); static GPtrArray *classes = NULL; void ol_display_module_init () { if (classes == NULL) { classes = g_ptr_array_new_with_free_func ((GDestroyNotify)_class_free); _register_class (ol_osd_module_get_class ()); _register_class (ol_scroll_module_get_class ()); } } void ol_display_module_unload () { if (classes != NULL) { g_ptr_array_free (classes, TRUE); classes = NULL; } } static void _register_class (struct OlDisplayClass *klass) { g_ptr_array_add (classes, klass); } static struct OlDisplayClass* _get_class (const char *name) { ol_assert_ret (name != NULL, NULL); int i; for (i = 0; i < classes->len; i++) { struct OlDisplayClass *klass = (struct OlDisplayClass *)(g_ptr_array_index (classes, i)); if (ol_stricmp (klass->name, name, -1) == 0) return klass; } return NULL; } struct OlDisplayClass* ol_display_class_new (const char *name, OlDisplayInitFunc init_func, OlDisplayFreeFunc free_func) { ol_assert_ret (name != NULL, NULL); ol_assert_ret (init_func != NULL, NULL); ol_assert_ret (free_func != NULL, NULL); struct OlDisplayClass *klass = g_new0 (struct OlDisplayClass, 1); klass->name = g_strdup (name); klass->init = init_func; klass->free = free_func; return klass; } static void _class_free (struct OlDisplayClass *klass) { ol_assert (klass != NULL); if (klass->name != NULL) { g_free (klass->name); klass->name = NULL; } g_free (klass); } static void _set_data (struct OlDisplayModule *module, void *data) { ol_assert (module != NULL); module->data = data; } void* ol_display_module_get_data (struct OlDisplayModule *module) { ol_assert_ret (module != NULL, NULL); return module->data; } struct OlDisplayModule* ol_display_module_new (const char *name, OlPlayer *player) { ol_assert_ret (name != NULL, NULL); struct OlDisplayModule *module = NULL; struct OlDisplayClass *klass = _get_class (name); if (klass == NULL) { ol_error ("Module %s not exists.\n", name); /* Fall back to the first display module. */ return g_ptr_array_index (classes, 0); } module = g_new0 (struct OlDisplayModule, 1); module->klass = klass; _set_data (module, klass->init (module, player)); return module; } void ol_display_module_free (struct OlDisplayModule *module) { ol_assert (module != NULL); module->klass->free (module); g_free (module); } void ol_display_module_set_played_time (struct OlDisplayModule *module, guint64 played_time) { ol_assert (module != NULL); call (module->klass->set_played_time, module, played_time); } void ol_display_module_set_lrc (struct OlDisplayModule *module, OlLrc *lrc) { ol_assert (module != NULL); call (module->klass->set_lrc, module, lrc); } void ol_display_module_set_message (struct OlDisplayModule *module, const char *message, int duration_ms) { ol_assert (module != NULL); call (module->klass->set_message, module, message, duration_ms); } void ol_display_module_search_message (struct OlDisplayModule *module, const char *message) { ol_assert (module != NULL); call (module->klass->search_message, module, message); } void ol_display_module_search_fail_message (struct OlDisplayModule *module, const char *message) { ol_assert (module != NULL); call (module->klass->search_fail_message, module, message); } void ol_display_module_download_fail_message (struct OlDisplayModule *module, const char *message) { ol_assert (module != NULL); call (module->klass->download_fail_message, module, message); } void ol_display_module_clear_message (struct OlDisplayModule *module) { ol_assert (module != NULL); call (module->klass->clear_message, module); }
// // netconfig.h // // Circle - A C++ bare metal environment for Raspberry Pi // Copyright (C) 2015 R. Stange <rsta2@o2online.de> // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this program. If not, see <http://www.gnu.org/licenses/>. // #ifndef _circle_net_netconfig_h #define _circle_net_netconfig_h #include <circle/net/ipaddress.h> #include <circle/types.h> class CNetConfig { public: CNetConfig (void); ~CNetConfig (void); void SetIPAddress (u32 nAddress); void SetNetMask (u32 nNetMask); void SetDefaultGateway (u32 nAddress); void SetDNSServer (u32 nAddress); void SetIPAddress (const u8 *pAddress); void SetNetMask (const u8 *pNetMask); void SetDefaultGateway (const u8 *pAddress); void SetDNSServer (const u8 *pAddress); const CIPAddress *GetIPAddress (void) const; const u8 *GetNetMask (void) const; const CIPAddress *GetDefaultGateway (void) const; const CIPAddress *GetDNSServer (void) const; private: CIPAddress m_IPAddress; CIPAddress m_NetMask; CIPAddress m_DefaultGateway; CIPAddress m_DNSServer; }; #endif
/*************************************************************************** begin : Wed Apr 14 2010 copyright : (C) 2010 by Martin Preuss email : martin@aqbanking.de *************************************************************************** * This file is part of the project "AqBanking". * * Please see toplevel file COPYING of that project for license details. * ***************************************************************************/ #ifndef AQBANKING_DLG_SELECTBACKEND_P_H #define AQBANKING_DLG_SELECTBACKEND_P_H #include "dlg_selectbackend.h" typedef struct AB_SELECTBACKEND_DIALOG AB_SELECTBACKEND_DIALOG; struct AB_SELECTBACKEND_DIALOG { AB_BANKING *banking; char *selectedProvider; char *text; GWEN_PLUGIN_DESCRIPTION_LIST *pluginDescrList; }; static void GWENHYWFAR_CB AB_SelectBackendDialog_FreeData(void *bp, void *p); static int GWENHYWFAR_CB AB_SelectBackendDialog_SignalHandler(GWEN_DIALOG *dlg, GWEN_DIALOG_EVENTTYPE t, const char *sender); #endif
/* -*- c++ -*- * Copyright (C) 2007-2016 Hypertable, Inc. * * This file is part of Hypertable. * * Hypertable is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 3 * of the License, or any later version. * * Hypertable is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 02110-1301, USA. */ /// @file /// Declarations for MetricsHandler. /// This file contains declarations for MetricsHandler, a dispatch handler class /// used to collect and publish %Master metrics. #ifndef Master_MetricsHandler_h #define Master_MetricsHandler_h #include <AsyncComm/Comm.h> #include <AsyncComm/DispatchHandler.h> #include <Common/MetricsCollectorGanglia.h> #include <Common/MetricsProcess.h> #include <Common/Properties.h> #include <Common/metrics> #include <memory> #include <mutex> namespace Hypertable { /// @addtogroup Master /// @{ /// Collects and publishes %Master metrics. /// This class acts as the metrics timer dispatch handler class MetricsHandler : public DispatchHandler { public: /// Constructor. /// Initializes state, setting #m_collection_interval to the property /// <code>Hypertable.Monitoring.Interval</code> and starts a timer using /// this object as the handler. /// @param props %Properties object MetricsHandler(PropertiesPtr &props); /// Destructor. /// Cancels the timer. virtual ~MetricsHandler() {}; /// Starts metrics collection. void start_collecting(); /// Stops metrics collection. void stop_collecting(); /// Collects and publishes metrics. /// This method computes and updates the <code>operations/s</code> and /// general process metrics and publishes them via #m_ganglia_collector. /// After metrics have been collected, the timer is re-registered for /// #m_collection_interval milliseconds in the future. /// @param event %Comm layer timer event virtual void handle(EventPtr &event); /// Increments operation count. /// Increments operation count which is used in computing operations/s. void operation_increment() { m_operations.current++; } private: /// Comm layer Comm *m_comm {}; /// Ganglia metrics collector MetricsCollectorGangliaPtr m_ganglia_collector; /// General process metrics tracker MetricsProcess m_metrics_process; /// %Timestamp of last metrics collection int64_t m_last_timestamp; /// %Metrics collection interval int32_t m_collection_interval {}; /// %Master operations interval_metric<int64_t> m_operations {}; /// Collection has started bool m_started {}; }; /// Smart pointer to MetricsHandler typedef std::shared_ptr<MetricsHandler> MetricsHandlerPtr; /// @} } #endif // Master_MetricsHandler_h
/* * SaveLoadException.h * * Created on: Mar 29, 2012 * Author: Simon */ #ifndef SAVELOADEXCEPTION_H_ #define SAVELOADEXCEPTION_H_ #include <string> #include <exception> using namespace std; struct GameModelException: public exception { string message; public: GameModelException(string message_): message(message_) {} const char * what() const throw() { return message.c_str(); } ~GameModelException() throw() {}; }; #endif /* SAVELOADEXCEPTION_H_ */