text
stringlengths
4
6.14k
#ifndef U_UTIL #define U_UTIL int u_format(int diskSizeBytes, char* file_name); int recover_file_system(char *file_name); int u_clean_shutdown(); #endif
/* * Copyright (C) 2012 KangHua <kanghua151@gmail.com> * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 as published by * the Free Software Foundation. */ #include <string.h> #include "cache.h" #include "cache_helper.h" #include "hlfs_log.h" int flush_work(gpointer data){ int ret = 0; CACHE_CTRL *cctrl = (CACHE_CTRL*)data; GTimeVal expired; char *tmp_buf = (char *)g_malloc0(cctrl->block_size \ *cctrl->flush_once_size); g_assert(tmp_buf); while (!cctrl->flush_worker_should_exit) { HLOG_DEBUG("-- flush worker doing --"); g_get_current_time(&expired); g_time_val_add(&expired, cctrl->flush_interval * 1000 * 1000); g_mutex_lock(cctrl->cache_mutex); gboolean res = g_cond_timed_wait(cctrl->flush_waken_cond, \ cctrl->cache_mutex, &expired); g_mutex_unlock(cctrl->cache_mutex); HLOG_DEBUG(" time wait res for cond is :%d !",res); if (cctrl->flush_worker_should_exit) { HLOG_INFO("-- flush worker should exit --"); break; } do { GSList *continue_blocks = NULL; ret = get_continues_blocks(cctrl, &continue_blocks); g_assert(ret==0); uint32_t blocks_count = g_slist_length(continue_blocks); uint32_t buff_len = blocks_count *cctrl->block_size; HLOG_DEBUG("--blocks_count:%d, buff_len:%d--", \ blocks_count, buff_len); if (res == TRUE && buff_len == 0) { HLOG_ERROR("Never reach here"); g_assert(0); } if (buff_len == 0) { HLOG_DEBUG("do not need flush now"); break; } if (NULL == cctrl->write_callback_func) { HLOG_WARN("--not given flush callback func--"); break; } //char* tmp_buf = g_malloc0(buff_len); //g_assert(tmp_buf!=NULL); uint32_t start_no; uint32_t end_no; int i = 0; for (i = 0; i < blocks_count; i++) { block_t *block = g_slist_nth_data(continue_blocks, i); if (i == 0) { start_no = block->block_no; } if (i == blocks_count-1) { end_no = block->block_no; } memcpy(tmp_buf + i * cctrl->block_size, \ block->block, cctrl->block_size); } //HLOG_DEBUG("--tmp_buf:%p",tmp_buf); ret = cctrl->write_callback_func(cctrl->write_callback_user_param, \ tmp_buf, start_no,end_no); g_assert(ret >= 0); //g_free(tmp_buf); if (ret >= 0 ) { HLOG_DEBUG("--signal write thread--"); g_mutex_lock(cctrl->cache_mutex); __free_from_cache(cctrl, continue_blocks); //g_cond_broadcast(cctrl->writer_waken_cond); g_cond_signal(cctrl->writer_waken_cond); g_mutex_unlock(cctrl->cache_mutex); g_slist_free(continue_blocks); //HLOG_DEBUG("--return blocks to cache over--"); } } while (get_cache_free_size(cctrl) < cctrl->flush_trigger_level \ *cctrl->cache_size / 100 || (res == 0 && get_cache_free_size(cctrl) != 0)); } g_free(tmp_buf); HLOG_INFO("--flush worker exit--"); return 0; }
#ifndef __GTK_SOUND_DRIVER_SDL_H #define __GTK_SOUND_DRIVER_SDL_H #include "SDL.h" #include "gtk_sound.h" #include "gtk_sound_driver.h" class S9xSDLSoundDriver : public S9xSoundDriver { public: S9xSDLSoundDriver (void); void init (void); void terminate (void); bool8 open_device (void); void start (void); void stop (void); void mix (void); void mix (unsigned char *output, int bytes); private: SDL_AudioSpec *audiospec; }; #endif /* __GTK_SOUND_DRIVER_SDL_H */
/** ****************************************************************************** * @file PWR/PWR_BOR/Inc/stm32f4xx_it.h * @author MCD Application Team * @version V1.2.3 * @date 09-October-2015 * @brief This file contains the headers of the interrupt handlers. ****************************************************************************** * @attention * * <h2><center>&copy; COPYRIGHT(c) 2015 STMicroelectronics</center></h2> * * Redistribution and use in source and binary forms, with or without modification, * are permitted provided that the following conditions are met: * 1. Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * 3. Neither the name of STMicroelectronics nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * ****************************************************************************** */ /* Define to prevent recursive inclusion -------------------------------------*/ #ifndef __STM32F4xx_IT_H #define __STM32F4xx_IT_H #ifdef __cplusplus extern "C" { #endif /* Includes ------------------------------------------------------------------*/ #include "main.h" /* Exported types ------------------------------------------------------------*/ /* Exported constants --------------------------------------------------------*/ /* Exported macro ------------------------------------------------------------*/ /* Exported functions ------------------------------------------------------- */ void NMI_Handler(void); void HardFault_Handler(void); void MemManage_Handler(void); void BusFault_Handler(void); void UsageFault_Handler(void); void SVC_Handler(void); void DebugMon_Handler(void); void PendSV_Handler(void); void SysTick_Handler(void); void PVD_IRQHandler(void); #ifdef __cplusplus } #endif #endif /* __STM32F4xx_IT_H */ /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
/** * debug.c * * Better debug log messages. * * (c) 2017 Simon Brooke <simon@journeyman.cc> * Licensed under GPL version 2.0, or, at your option, any later version. */ #include <ctype.h> #include <stdarg.h> #include <stdio.h> #include <stdlib.h> #include <string.h> /* * wide characters */ #include <wchar.h> #include <wctype.h> #include "memory/consspaceobject.h" #include "debug.h" #include "memory/dump.h" #include "io/io.h" #include "io/print.h" /** * the controlling flags for `debug_print`; set in `init.c`, q.v. */ int verbosity = 0; /** * print this debug `message` to stderr, if `verbosity` matches `level`. * `verbosity is a set of flags, see debug_print.h; so you can * turn debugging on for only one part of the system. */ void debug_print( wchar_t *message, int level ) { #ifdef DEBUG if ( level & verbosity ) { fwide( stderr, 1 ); fputws( message, stderr ); } #endif } /** * stolen from https://stackoverflow.com/questions/11656241/how-to-print-uint128-t-number-using-gcc */ void debug_print_128bit( __int128_t n, int level ) { #ifdef DEBUG if ( level & verbosity ) { if ( n == 0 ) { fwprintf( stderr, L"0" ); } else { char str[40] = { 0 }; // log10(1 << 128) + '\0' char *s = str + sizeof( str ) - 1; // start at the end while ( n != 0 ) { if ( s == str ) return; // never happens *--s = "0123456789"[n % 10]; // save last digit n /= 10; // drop it } fwprintf( stderr, L"%s", s ); } } #endif } /** * print a line feed to stderr, if `verbosity` matches `level`. * `verbosity is a set of flags, see debug_print.h; so you can * turn debugging on for only one part of the system. */ void debug_println( int level ) { #ifdef DEBUG if ( level & verbosity ) { fwide( stderr, 1 ); fputws( L"\n", stderr ); } #endif } /** * `wprintf` adapted for the debug logging system. Print to stderr only * `verbosity` matches `level`. All other arguments as for `wprintf`. */ void debug_printf( int level, wchar_t *format, ... ) { #ifdef DEBUG if ( level & verbosity ) { fwide( stderr, 1 ); va_list( args ); va_start( args, format ); vfwprintf( stderr, format, args ); } #endif } /** * print the object indicated by this `pointer` to stderr, if `verbosity` * matches `level`.`verbosity is a set of flags, see debug_print.h; so you can * turn debugging on for only one part of the system. */ void debug_print_object( struct cons_pointer pointer, int level ) { #ifdef DEBUG if ( level & verbosity ) { URL_FILE *ustderr = file_to_url_file( stderr ); fwide( stderr, 1 ); print( ustderr, pointer ); free( ustderr ); } #endif } /** * Like `dump_object`, q.v., but protected by the verbosity mechanism. */ void debug_dump_object( struct cons_pointer pointer, int level ) { #ifdef DEBUG if ( level & verbosity ) { URL_FILE *ustderr = file_to_url_file( stderr ); fwide( stderr, 1 ); dump_object( ustderr, pointer ); free( ustderr ); } #endif }
#include "tintin.h" #include "kbtree.h" #include "protos/print.h" #include "protos/utils.h" /**/ KBTREE_CODE(str, char*, strcmp) kbtree_t(str)* init_slist(void) { return kb_init(str, KB_DEFAULT_SIZE); } void kill_slist(kbtree_t(str) *l) { kbitr_t itr; kb_itr_first(str, l, &itr); for (; kb_itr_valid(&itr); kb_itr_next(str, l, &itr)) free(kb_itr_key(char*, &itr)); kb_destroy(str, l); } void show_slist(kbtree_t(str) *l) { kbitr_t itr; kb_itr_first(str, l, &itr); for (; kb_itr_valid(&itr); kb_itr_next(str, l, &itr)) { const char *p = kb_itr_key(char*, &itr); tintin_printf(0, "~7~{%s~7~}", p); } } kbtree_t(str) *copy_slist(kbtree_t(str) *a) { kbtree_t(str) *b = kb_init(str, KB_DEFAULT_SIZE); kbitr_t itr; kb_itr_first(str, a, &itr); for (; kb_itr_valid(&itr); kb_itr_next(str, a, &itr)) { const char *p = kb_itr_key(char*, &itr); kb_put(str, b, mystrdup(p)); } return b; } int count_slist(kbtree_t(str) *s) { return kb_size(s); }
/**************************************************************************** ** ** This file is part of the Qtopia Opensource Edition Package. ** ** Copyright (C) 2008 Trolltech ASA. ** ** Contact: Qt Extended Information (info@qtextended.org) ** ** This file may be used under the terms of the GNU General Public License ** versions 2.0 as published by the Free Software Foundation and appearing ** in the file LICENSE.GPL included in the packaging of this file. ** ** Please review the following information to ensure GNU General Public ** Licensing requirements will be met: ** http://www.fsf.org/licensing/licenses/info/GPLv2.html. ** ** ****************************************************************************/ #ifndef QPINMANAGER_H #define QPINMANAGER_H #include <qcomminterface.h> #include <qtopiaapplication.h> class QPinOptionsPrivate; class QTOPIAPHONE_EXPORT QPinOptions { public: QPinOptions(); QPinOptions( const QPinOptions& other ); ~QPinOptions(); enum Format { Number, PhoneNumber, Words, Text }; QPinOptions& operator=( const QPinOptions& other ); QString prompt() const; void setPrompt( const QString& value ); QPinOptions::Format format() const; void setFormat( QPinOptions::Format value ); int minLength() const; void setMinLength( int value ); int maxLength() const; void setMaxLength( int value ); bool canCancel() const; void setCanCancel( bool value ); template <typename Stream> void serialize(Stream &stream) const; template <typename Stream> void deserialize(Stream &stream); private: QPinOptionsPrivate *d; }; class QTOPIAPHONE_EXPORT QPinManager : public QCommInterface { Q_OBJECT public: explicit QPinManager( const QString& service = QString(), QObject *parent = 0, QCommInterface::Mode mode = Client ); ~QPinManager(); enum Status { NeedPin, NeedPuk, Valid, Locked }; public slots: virtual void querySimPinStatus(); virtual void enterPin( const QString& type, const QString& pin ); virtual void enterPuk( const QString& type, const QString& puk, const QString& newPin ); virtual void cancelPin( const QString& type ); virtual void changePin( const QString& type, const QString& oldPin, const QString& newPin ); virtual void requestLockStatus( const QString& type ); virtual void setLockStatus ( const QString& type, const QString& password, bool enabled ); signals: void pinStatus( const QString& type, QPinManager::Status status, const QPinOptions& options ); void changePinResult( const QString& type, bool valid ); void lockStatus( const QString& type, bool enabled ); void setLockStatusResult( const QString& type, bool valid ); }; Q_DECLARE_USER_METATYPE_ENUM(QPinManager::Status) Q_DECLARE_USER_METATYPE(QPinOptions) #endif /* QPINMANAGER_H */
#include "nid_core.h" #include "nid_event.h" #ifdef NID_HAVE_EPOLL extern int32_t nid_event_create(void) { return epoll_create1(0); } extern int32_t nid_event_add(int32_t handle, int32_t fd, int32_t events) { struct epoll_event env = {}; env.events = (uint32_t)events | EPOLLET; env.data.fd = fd; return epoll_ctl(handle, EPOLL_CTL_ADD, fd, &env); } extern int32_t nid_event_mod(int32_t handle, int32_t fd, int32_t events) { struct epoll_event env = {}; env.events = (uint32_t)events | EPOLLET; env.data.fd = fd; return epoll_ctl(handle, EPOLL_CTL_MOD, fd, &env); } extern int32_t nid_event_del(int32_t handle, int32_t fd, int32_t events) { /** * epoll_ctl(2) BUGS * In kernel versions before 2.6.9, * the EPOLL_CTL_DEL operation required a non-NULL pointer in event, * even though this argument is ignored. */ struct epoll_event env = {}; return epoll_ctl(handle, EPOLL_CTL_DEL, fd, &env); } #elif defined(NID_HAVE_KQUEUE) extern int32_t nid_event_create(void) { return kqueue(); } extern int32_t nid_event_add(int32_t handle, int32_t fd, int32_t events) { struct kevent env[1] = {}; EV_SET(env, fd, events, EV_ADD | EV_CLEAR, 0, 0, 0); return kevent(handle, env, 1, NULL, 0, NULL); } extern int32_t nid_event_mod(int32_t handle, int32_t fd, int32_t events) { return nid_event_add(handle, fd, events); } extern int32_t nid_event_del(int32_t handle, int32_t fd, int32_t events) { struct kevent env[1] = {}; EV_SET(env, fd, events, EV_DELETE, 0, 0, 0); return kevent(handle, env, 1, NULL, 0, NULL); } #endif extern int32_t nid_event_close(int32_t handle) { return close(handle); } extern int32_t nid_setnonblock(int32_t fd) { int32_t opts = fcntl(fd, F_GETFL); if (NID_ERROR == opts) { return opts; } opts |= O_NONBLOCK; if (NID_ERROR == fcntl(fd, F_SETFL, opts)) { return opts; } return NID_OK; }
/* cluvirtadm - client for cluvirtd daemons. Copyright (C) 2009 Federico Simoncelli <federico.simoncelli@nethesis.it> This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifdef HAVE_CONFIG_H #include <config.h> #endif #include <stdio.h> #include <stdlib.h> #include <string.h> #include <unistd.h> #include <getopt.h> #include <errno.h> #include <error.h> #include <readline/history.h> #include <readline/readline.h> #include <member.h> #include <interactive.h> #include <cluvirt.h> #include <utils.h> #define CMDLINE_ARGS_MAXLEN (64) #define CMDLINE_ERROR_MAXLEN (255) #define cmdline_error(fmt, args...) fprintf(stderr, fmt "\n", ##args); typedef int cmdline_fn_t(int argc, char *argv[]); typedef struct _cmdline_function_t { char *cmd; cmdline_fn_t *fun; char *help; } cmdline_function_t; static int cmdline_do_list_nodes(int argc, char *argv[]) { clv_clnode_t *n; clv_clnode_head_t nodes = STAILQ_HEAD_INITIALIZER(nodes); if (member_list_nodes(&nodes) < 0) { cmdline_error("%s: unable to get cluster members", argv[1]); } /* TODO */ return 0; } static int cmdline_do_list_vm(int argc, char *argv[]) { /* TODO */ return 0; } static int cmdline_do_list(int argc, char *argv[]) { if (argc < 2) goto fail_args; if (strcmp(argv[1], "nodes") == 0) { if (argc != 2) goto fail_args; return cmdline_do_list_nodes(argc, &argv[1]); } else if (strcmp(argv[1], "vm") == 0) { if (argc != 3) goto fail_args; return cmdline_do_list_vm(argc, &argv[1]); } cmdline_error("%s: unknown list target", argv[1]); return -1; fail_args: cmdline_error("%s: incorrect number of arguments", argv[0]); return -1; } static cmdline_function_t _cmd_table[] = { { "list", cmdline_do_list, 0}, { 0, 0 } }; static int cmdline_exec(char *line) { int argc, i; char *argv[CMDLINE_ARGS_MAXLEN], *saveptr; if ((argv[0] = strtok_r(line, " \t", &saveptr)) == 0) { return 0; } argc = 1; while ((argv[argc] = strtok_r(0, " \t", &saveptr)) != 0) { argc = argc + 1; } for (i = 0; _cmd_table[i].cmd != 0; i++) { if (strcmp(argv[0], _cmd_table[i].cmd) == 0) { return _cmd_table[i].fun(argc, argv); } } cmdline_error("%s: command not found", argv[0]); return -1; } int interactive_loop(void) { char *line; clv_handle_t clvh; if (clv_init(&clvh, CLV_SOCKET_PATH) < 0) { log_error("unable to initialize cluvirt socket: %i", errno); exit(EXIT_FAILURE); } while((line = readline("clv> ")) != 0) { add_history(line); cmdline_exec(line); } printf("\n"); return 0; }
/* * $Id: socket.c,v 1.6 2005/01/01 15:27:54 baum Exp $ * * This file implements the socket widget * * Copyright (c) 2001 - 2005 Peter G. Baum http://www.dr-baum.net * * See the file "license.terms" for information on usage and redistribution * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * */ /* History: 2002-02: switched from GnoclWidgetOptions to GnoclOption 2001-11: Begin of developement */ #include "gnocl.h" #include <gdk/gdkx.h> #include <string.h> #include <assert.h> static GnoclOption socketOptions[] = { { "-plugID", GNOCL_OBJ, NULL }, /* 0 */ { "-visible", GNOCL_BOOL, "visible" }, { "-onPlugAdded", GNOCL_OBJ, "plug-added", gnoclOptCommand }, { "-onPlugRemoved", GNOCL_OBJ, "plug-removed", gnoclOptCommand }, { NULL }, }; static const int plugIDIdx; static int configure( Tcl_Interp *interp, GtkSocket *socket, GnoclOption options[] ) { if( options[plugIDIdx].status == GNOCL_STATUS_CHANGED ) { long xid; if( Tcl_GetLongFromObj( interp, options[plugIDIdx].val.obj, &xid ) != TCL_OK ) return TCL_ERROR; gtk_socket_add_id( socket, xid ); } return TCL_OK; } static int socketFunc( ClientData data, Tcl_Interp *interp, int objc, Tcl_Obj * const objv[] ) { const char *cmds[] = { "delete", "configure", "getID", "getPlugID", NULL }; enum cmdIdx { DeleteIdx, ConfigureIdx, GetIDIdx, GetPlugIDIdx }; int idx; GtkSocket *socket = GTK_SOCKET( data ); if( objc < 2 ) { Tcl_WrongNumArgs( interp, 1, objv, "command" ); return TCL_ERROR; } if( Tcl_GetIndexFromObj( interp, objv[1], cmds, "command", TCL_EXACT, &idx ) != TCL_OK ) return TCL_ERROR; switch( idx ) { case DeleteIdx: return gnoclDelete( interp, GTK_WIDGET( socket ), objc, objv ); case ConfigureIdx: { int ret = TCL_ERROR; if( gnoclParseAndSetOptions( interp, objc - 1, objv + 1, socketOptions, G_OBJECT( socket ) ) == TCL_OK ) { ret = configure( interp, socket, socketOptions ); } gnoclClearOptions( socketOptions ); return ret; } break; case GetIDIdx: { long xid; Tcl_Obj *val; if( objc != 2 ) { Tcl_WrongNumArgs( interp, 2, objv, NULL ); return TCL_ERROR; } xid = GDK_WINDOW_XWINDOW( GTK_WIDGET( socket)->window ); val = Tcl_NewLongObj( xid ); Tcl_SetObjResult( interp, val ); } break; case GetPlugIDIdx: { long xid = 0; Tcl_Obj *val; if( objc != 2 ) { Tcl_WrongNumArgs( interp, 2, objv, NULL ); return TCL_ERROR; } if( socket->plug_window ) xid = GDK_WINDOW_XWINDOW( socket->plug_window ); val = Tcl_NewLongObj( xid ); Tcl_SetObjResult( interp, val ); } break; } return TCL_OK; } int gnoclSocketCmd( ClientData data, Tcl_Interp *interp, int objc, Tcl_Obj * const objv[] ) { int ret; GtkSocket *socket; if( gnoclParseOptions( interp, objc, objv, socketOptions ) != TCL_OK ) { gnoclClearOptions( socketOptions ); return TCL_ERROR; } socket = GTK_SOCKET( gtk_socket_new() ); gtk_widget_show( GTK_WIDGET( socket ) ); ret = gnoclSetOptions( interp, socketOptions, G_OBJECT( socket ), -1 ); if( ret == TCL_OK ) ret = configure( interp, socket, socketOptions ); gnoclClearOptions( socketOptions ); if( ret != TCL_OK ) { gtk_widget_destroy( GTK_WIDGET( socket ) ); return TCL_ERROR; } return gnoclRegisterWidget( interp, GTK_WIDGET( socket ), socketFunc ); }
/** This file is part of Critter. Copyright (c) 2009 Robin Southern, http://www.nxogre.org 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 CRITTER_AUTOCONFIGURATION_H #define CRITTER_AUTOCONFIGURATION_H #include "NxOgreConfiguration.h" #define CritterMemoryAllocatorMalloc 1 #define CritterMemoryAllocatorNedmalloc 2 #define CritterFloatingPointFloat 1 #define CritterFloatingPointDouble 2 #define CritterCompilerUnknown 0 #define CritterCompilerMSVC 1 #define CritterCompilerGNUC 2 #define CritterPlatformUnknown 0 #define CritterPlatformWindows 1 #define CritterPlatformLinux 2 #define CritterArchitecture32Bit 32 #define CritterArchitecture64Bit 64 #define CRITTER_EXPORT_OPTIONS_EXPORT 1 #define CRITTER_EXPORT_OPTIONS_IMPORT 2 #define CRITTER_EXPORT_OPTIONS_AVOID 3 #if defined (_MSC_VER) # define CritterCompiler CritterCompilerMSVC #elif defined ( __GNUC__ ) # define CritterCompiler CritterCompilerGNUC #endif #if defined (_WIN32) || defined (__WIN32) # define CritterPlatform CritterPlatformWindows #else # define CritterPlatform CritterPlatformLinux #endif #if defined(_M_X64) || defined (_M_X64) # define CritterArchitecture CritterArchitecture64Bit #else # define CritterArchitecture CritterArchitecture32Bit #endif // CritterArray.h generates this warning - a lot. #pragma warning (disable : 4251) // CritterSingleton.h and other classes that inherit generate this warning in Visual Studio. #pragma warning (disable : 4661) // Occurs when inheriting from a PhysX class. #pragma warning (disable : 4275) // Conversion from 'double' to 'float', possible loss of data #pragma warning (disable : 4244) // forcing value to bool 'true' or 'false' (performance warning) #pragma warning (disable : 4800) // 'fopen': This function or variable may be unsafe. Consider using fopen_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details. #pragma warning (disable : 4996) #ifdef CRITTER_SDK # define CritterForceInline __inline # define CritterPublicClass # define CritterPublicFunction #else # define CritterForceInline __inline # define CritterPublicClass # define CritterPublicFunction #endif #if defined(_DEBUG) || defined(DEBUG) # ifndef CRITTER_DEBUG # define CRITTER_DEBUG # endif #endif #ifdef Critter_UsesOgreTerrain #ifdef CRITTER_DEBUG # pragma comment(lib, "OgreTerrain_d.lib") #else # pragma comment(lib, "OgreTerrain.lib") #endif #endif #endif
/* * Copyright 2012 Linaro Ltd. * * The code contained herein is licensed under the GNU General Public * License. You may obtain a copy of the GNU General Public License * Version 2 or later at the following locations: * * http://www.opensource.org/licenses/gpl-license.html * http://www.gnu.org/copyleft/gpl.html */ #include <linux/cpuidle.h> #include <linux/of.h> #include <linux/of_device.h> #include <asm/cpuidle.h> extern struct of_cpuidle_method __cpuidle_method_of_table[]; static const struct of_cpuidle_method __cpuidle_method_of_table_sentinel __used __section(__cpuidle_method_of_table_end); static struct cpuidle_ops cpuidle_ops[NR_CPUS]; /** * arm_cpuidle_simple_enter() - a wrapper to cpu_do_idle() * @dev: not used * @drv: not used * @index: not used * * A trivial wrapper to allow the cpu_do_idle function to be assigned as a * cpuidle callback by matching the function signature. * * Returns the index passed as parameter */ int arm_cpuidle_simple_enter(struct cpuidle_device *dev, struct cpuidle_driver *drv, int index) { cpu_do_idle(); return index; } /** * arm_cpuidle_suspend() - function to enter low power idle states * @index: an integer used as an identifier for the low level PM callbacks * * This function calls the underlying arch specific low level PM code as * registered at the init time. * * Returns -EOPNOTSUPP if no suspend callback is defined, the result of the * callback otherwise. */ int arm_cpuidle_suspend(int index) { int ret = -EOPNOTSUPP; unsigned int cpu = smp_processor_id(); if (cpuidle_ops[cpu].suspend) ret = cpuidle_ops[cpu].suspend(index); return ret; } /** * arm_cpuidle_get_ops() - find a registered cpuidle_ops by name * @method: the method name * * Search in the __cpuidle_method_of_table array the cpuidle ops matching the * method name. * * Returns a struct cpuidle_ops pointer, NULL if not found. */ static struct cpuidle_ops *__init arm_cpuidle_get_ops(const char *method) { struct of_cpuidle_method *m = __cpuidle_method_of_table; for (; m->method; m++) if (!strcmp(m->method, method)) return m->ops; return NULL; } /** * arm_cpuidle_read_ops() - Initialize the cpuidle ops with the device tree * @dn: a pointer to a struct device node corresponding to a cpu node * @cpu: the cpu identifier * * Get the method name defined in the 'enable-method' property, retrieve the * associated cpuidle_ops and do a struct copy. This copy is needed because all * cpuidle_ops are tagged __initdata and will be unloaded after the init * process. * * Return 0 on sucess, -ENOENT if no 'enable-method' is defined, -EOPNOTSUPP if * no cpuidle_ops is registered for the 'enable-method'. */ static int __init arm_cpuidle_read_ops(struct device_node *dn, int cpu) { const char *enable_method; struct cpuidle_ops *ops; enable_method = of_get_property(dn, "enable-method", NULL); if (!enable_method) return -ENOENT; ops = arm_cpuidle_get_ops(enable_method); if (!ops) { pr_warn("%s: unsupported enable-method property: %s\n", dn->full_name, enable_method); return -EOPNOTSUPP; } cpuidle_ops[cpu] = *ops; /* structure copy */ pr_notice("cpuidle: enable-method property '%s'" " found operations\n", enable_method); return 0; } /** * arm_cpuidle_init() - Initialize cpuidle_ops for a specific cpu * @cpu: the cpu to be initialized * * Initialize the cpuidle ops with the device for the cpu and then call * the cpu's idle initialization callback. This may fail if the underlying HW * is not operational. * * Returns: * 0 on success, * -ENODEV if it fails to find the cpu node in the device tree, * -EOPNOTSUPP if it does not find a registered cpuidle_ops for this cpu, * -ENOENT if it fails to find an 'enable-method' property, * -ENXIO if the HW reports a failure or a misconfiguration, * -ENOMEM if the HW report an memory allocation failure */ int __init arm_cpuidle_init(unsigned int cpu) { struct device_node *cpu_node = of_cpu_device_node_get(cpu); int ret; if (!cpu_node) return -ENODEV; ret = arm_cpuidle_read_ops(cpu_node, cpu); if (!ret && cpuidle_ops[cpu].init) ret = cpuidle_ops[cpu].init(cpu); of_node_put(cpu_node); return ret; }
#ifndef ADDEMPLOYEEDIALOG_H #define ADDEMPLOYEEDIALOG_H #include <QDialog> #include <QSqlQuery> namespace Ui { class AddEmployeeDialog; } class AddEmployeeDialog : public QDialog { Q_OBJECT public: explicit AddEmployeeDialog(QSqlQuery *q, QWidget *parent = 0); ~AddEmployeeDialog(); private slots: void on_addButton_clicked(); void on_cancelButton_clicked(); private: Ui::AddEmployeeDialog *ui; QSqlQuery *query; QVector <int> postsId; }; #endif // ADDEMPLOYEEDIALOG_H
/* * fscanf is similar in functionality to scanf apart from the fact * that it reads from a stream. * * int fscanf(FILE * restrict stream, const char * format, ...); */ #include<stdio.h> int main() { int a, b; printf( "Enter the two numbers:" ); /* Similar to scanf( "%d %d", &a, &b ); */ fscanf( stdin, "%d %d", &a, &b ); fprintf( stdout, "%d %d\n", a, b ); return 0; }
/* * Copyright (c) 2015, 2015, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ #include <rffiutils.h> #include <Riconv.h> void * Riconv_open (const char* tocode, const char* fromcode) { return unimplemented("Riconv_open"); } size_t Riconv (void * cd, const char **inbuf, size_t *inbytesleft, char **outbuf, size_t *outbytesleft) { unimplemented("Riconv"); return 0; } int Riconv_close (void * cd) { unimplemented("Riconv_close"); return 0; }
/* * Copyright (c) 2002-2003 Jesper K. Pedersen <blackie@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 version 2 as published by the Free Software Foundation. * * 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 REGEXP_H #define REGEXP_H #include <tqdom.h> #include <tqptrlist.h> class CompoundRegExp; class ErrorMap; /** Abstract syntax tree for regular expressions. @internal */ class RegExp { public: RegExp( bool selected ); virtual ~RegExp(); virtual int precedence() const = 0; virtual TQDomNode toXml( TQDomDocument* doc ) const = 0; virtual bool load( TQDomElement, const TQString& version ) = 0; TQString toXmlString() const; void check( ErrorMap& ); virtual bool check( ErrorMap&, bool first, bool last ) = 0; void addChild( RegExp* child ); void removeChild( RegExp* child ); void setParent( RegExp* parent ); RegExp* clone() const; virtual bool operator==( const RegExp& other ) const { return ( type() == other.type() ); } enum RegExpType { CONC, TEXT, DOT, POSITION, REPEAT, ALTN, COMPOUND, LOOKAHEAD, TEXTRANGE }; virtual RegExpType type() const = 0; virtual void replacePart( CompoundRegExp* /* replacement */ ) {} bool isSelected() const { return _selected; } void setSelected( bool b ) { _selected = b; } protected: RegExp* readRegExp( TQDomElement top, const TQString& version ); private: RegExp() {} // disable TQPtrList<RegExp> _children; RegExp* _parent; bool _destructing; bool _selected; }; typedef TQPtrList<RegExp> RegExpList; typedef TQPtrListIterator<RegExp> RegExpListIt; #endif // REGEXP_H
/* * Copyright (C) 2013 Tobias Brunner * Hochschule fuer Technik Rapperswil * * 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. See <http://www.fsf.org/copyleft/gpl.txt>. * * 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. */ TEST_SUITE(bio_reader_suite_create) TEST_SUITE(bio_writer_suite_create) TEST_SUITE(chunk_suite_create) TEST_SUITE(enum_suite_create) TEST_SUITE(enumerator_suite_create) TEST_SUITE(linked_list_suite_create) TEST_SUITE(linked_list_enumerator_suite_create) TEST_SUITE(hashtable_suite_create) TEST_SUITE(array_suite_create) TEST_SUITE(identification_suite_create) TEST_SUITE(threading_suite_create) TEST_SUITE(process_suite_create) TEST_SUITE(watcher_suite_create) TEST_SUITE(stream_suite_create) TEST_SUITE(utils_suite_create) TEST_SUITE(settings_suite_create) TEST_SUITE(vectors_suite_create) TEST_SUITE_DEPEND(ecdsa_suite_create, PRIVKEY_GEN, KEY_ECDSA) TEST_SUITE_DEPEND(rsa_suite_create, PRIVKEY_GEN, KEY_RSA) TEST_SUITE_DEPEND(certpolicy_suite_create, CERT_ENCODE, CERT_X509) TEST_SUITE_DEPEND(certnames_suite_create, CERT_ENCODE, CERT_X509) TEST_SUITE(host_suite_create) TEST_SUITE(printf_suite_create) TEST_SUITE(hasher_suite_create) TEST_SUITE(crypter_suite_create) TEST_SUITE(crypto_factory_suite_create) TEST_SUITE(pen_suite_create) TEST_SUITE(asn1_suite_create) TEST_SUITE(asn1_parser_suite_create) TEST_SUITE(test_rng_suite_create) TEST_SUITE(mgf1_suite_create) TEST_SUITE_DEPEND(ntru_suite_create, DH, NTRU_112_BIT) TEST_SUITE_DEPEND(fetch_http_suite_create, FETCHER, "http://")
/********************************************************************** Freeciv - Copyright (C) 1996 - A Kjeldberg, L Gregersen, P Unold This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. ***********************************************************************/ #ifndef FC__DISASTER_H #define FC__DISASTER_H #ifdef __cplusplus extern "C" { #endif /* __cplusplus */ #define SPECENUM_NAME disaster_effect_id #define SPECENUM_VALUE0 DE_DESTROY_BUILDING #define SPECENUM_VALUE0NAME "DestroyBuilding" #define SPECENUM_VALUE1 DE_REDUCE_POP #define SPECENUM_VALUE1NAME "ReducePopulation" #define SPECENUM_VALUE2 DE_EMPTY_FOODSTOCK #define SPECENUM_VALUE2NAME "EmptyFoodStock" #define SPECENUM_VALUE3 DE_EMPTY_PRODSTOCK #define SPECENUM_VALUE3NAME "EmptyProdStock" #define SPECENUM_VALUE4 DE_POLLUTION #define SPECENUM_VALUE4NAME "Pollution" #define SPECENUM_VALUE5 DE_FALLOUT #define SPECENUM_VALUE5NAME "Fallout" #define SPECENUM_COUNT DE_COUNT #include "specenum_gen.h" BV_DEFINE(bv_disaster_effects, DE_COUNT); #define DISASTER_BASE_RARITY 1000000 struct disaster_type { int id; struct name_translation name; struct requirement_vector reqs; struct requirement_vector nreqs; /* Final probability for each city each turn is * this frequency * game.info.disasters frequency setting / DISASTER_BASE_RARITY */ int frequency; bv_disaster_effects effects; }; /* Initialization and iteration */ void disaster_types_init(void); void disaster_types_free(void); /* General disaster type accessor functions. */ Disaster_type_id disaster_count(void); Disaster_type_id disaster_index(const struct disaster_type *pdis); Disaster_type_id disaster_number(const struct disaster_type *proad); struct disaster_type *disaster_by_number(Disaster_type_id id); const char *disaster_name_translation(struct disaster_type *pdis); const char *disaster_rule_name(struct disaster_type *pdis); bool disaster_has_effect(const struct disaster_type *pdis, enum disaster_effect_id effect); bool can_disaster_happen(struct disaster_type *pdis, struct city *pcity); #define disaster_type_iterate(_p) \ { \ int _i_; \ for (_i_ = 0; _i_ < game.control.num_disaster_types ; _i_++) { \ struct disaster_type *_p = disaster_by_number(_i_); #define disaster_type_iterate_end \ }} #ifdef __cplusplus } #endif /* __cplusplus */ #endif /* FC__DISASTER_H */
/**************************************************************************** * * * X X ******* ** ** ****** ** ** ****** * * X X ******** *** *** ******** ** ** ******** \\._.// * * X X ** ******** ** ** ** ** ** (0...0) * * XX ******* ******** ******** ** ** ** **** ).:.( * * XX ******* ** ** ** ******** ** ** ** **** {o o} * * X X ** ** ** ** ** ** ** ** ** / ' ' \ * * X X ******** ** ** ** ** ******** ******** -^^.VxvxV.^^- * * X X ******* ** ** ** ** ****** ****** * * * * ------------------------------------------------------------------------ * * Ne[X]t Generation [S]imulated [M]edieval [A]dventure Multi[U]ser [G]ame * * ------------------------------------------------------------------------ * * XSMAUG 2.4 (C) 2014 by Antonio Cao @burzumishi | \\._.// * * ---------------------------------------------------------| (0...0) * * SMAUG 1.4 (C) 1994, 1995, 1996, 1998 by Derek Snider | ).:.( * * SMAUG Code Team: Thoric, Altrag, Blodkai, Narn, Haus, | {o o} * * Scryn, Rennard, Swordbearer, Gorog, Grishnakh, Nivek, | / ' ' \ * * Tricops and Fireblade | -^^.VxvxV.^^- * * ------------------------------------------------------------------------ * * Merc 2.1 Diku Mud improvments copyright (C) 1992, 1993 by Michael * * Chastain, Michael Quan, and Mitchell Tse. * * Original Diku Mud copyright (C) 1990, 1991 by Sebastian Hammer, * * Michael Seifert, Hans Henrik St{rfeldt, Tom Madsen, and Katja Nyboe. * * Win32 port by Nick Gammon * * ------------------------------------------------------------------------ * * AFKMud Copyright 1997-2012 by Roger Libiez (Samson), * * Levi Beckerson (Whir), Michael Ward (Tarl), Erik Wolfe (Dwip), * * Cameron Carroll (Cam), Cyberfox, Karangi, Rathian, Raine, * * Xorith, and Adjani. * * All Rights Reserved. * * * * External contributions from Remcon, Quixadhal, Zarius, and many others. * * * **************************************************************************** * Skill Search Index Definitions * ****************************************************************************/ // This probably isn't necessary, but prefer to sort by the contents of the // string rather than the binary value that std::less uses. class string_sort { public: string_sort( ); bool operator( ) ( const string &, const string & ); }; typedef map < string, int, string_sort > SKILL_INDEX; extern SKILL_INDEX skill_table__index; extern SKILL_INDEX skill_table__spell; extern SKILL_INDEX skill_table__skill; extern SKILL_INDEX skill_table__racial; extern SKILL_INDEX skill_table__combat; extern SKILL_INDEX skill_table__tongue; extern SKILL_INDEX skill_table__lore; class find__skill_prefix { public: string value; char_data *actor; find__skill_prefix( char_data *, const string & ); bool operator( ) ( pair < string, int >compare ); }; class find__skill_exact { public: string value; char_data *actor; find__skill_exact( char_data *, const string & ); bool operator( ) ( pair < string, int >compare ); };
/* * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2. * * 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. * * * Test that the values that can be returned by sched_getscheduler() are * defined in the sched.h header */ #include <stdio.h> #include <sched.h> #include <errno.h> #include "posixtest.h" struct unique { int value; char *name; } sym[] = { #ifdef SCHED_FIFO { SCHED_FIFO, "SCHED_FIFO"}, #endif #ifdef SCHED_RR { SCHED_RR, "SCHED_RR"}, #endif #ifdef SCHED_SPORADIC { SCHED_SPORADIC, "SCHED_SPORADIC"}, #endif #ifdef SCHED_OTHER { SCHED_OTHER, "SCHED_OTHER"}, #endif { 0, 0} }; int main(int argc, char **argv) { int result = -1; struct unique *tst; tst = sym; result = sched_getscheduler(0); if (result == -1) { printf("Returned code is -1.\n"); return PTS_FAIL; } if (errno != 0) { perror("Unexpected error"); return PTS_FAIL; } while (tst->name) { if (result == tst->value) { printf("Test PASSED\n"); return PTS_PASS; } tst++; } printf("The resulting scheduling policy is not one of standard " "policy.\nIt could be an implementation defined policy."); return PTS_UNRESOLVED; }
/******************************************************************** KWin - the KDE window manager This file is part of the KDE project. Copyright (C) 2015 Martin Gräßlin <mgraesslin@kde.org> This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. *********************************************************************/ #ifndef KWIN_ABSTRACT_EGL_BACKEND_H #define KWIN_ABSTRACT_EGL_BACKEND_H #include "scene_opengl.h" namespace KWin { class KWIN_EXPORT AbstractEglBackend : public OpenGLBackend { public: virtual ~AbstractEglBackend(); bool makeCurrent() override; void doneCurrent() override; EGLDisplay eglDisplay() const { return m_display; } protected: AbstractEglBackend(); EGLContext context() const { return m_context; } EGLSurface surface() const { return m_surface; } EGLConfig config() const { return m_config; } void setEglDisplay(const EGLDisplay &display) { m_display = display; } void setContext(const EGLContext &context) { m_context = context; } void setSurface(const EGLSurface &surface) { m_surface = surface; } void setConfig(const EGLConfig &config) { m_config = config; } void cleanup(); virtual void cleanupSurfaces(); bool initEglAPI(); void initKWinGL(); void initBufferAge(); void initClientExtensions(); void initWayland(); bool hasClientExtension(const QByteArray &ext) const; private: EGLDisplay m_display = EGL_NO_DISPLAY; EGLSurface m_surface = EGL_NO_SURFACE; EGLContext m_context = EGL_NO_CONTEXT; EGLConfig m_config = nullptr; QList<QByteArray> m_clientExtensions; }; class KWIN_EXPORT AbstractEglTexture : public SceneOpenGL::TexturePrivate { public: virtual ~AbstractEglTexture(); bool loadTexture(WindowPixmap *pixmap) override; void updateTexture(WindowPixmap *pixmap) override; OpenGLBackend *backend() override; protected: AbstractEglTexture(SceneOpenGL::Texture *texture, AbstractEglBackend *backend); EGLImageKHR image() const { return m_image; } private: bool loadTexture(xcb_pixmap_t pix, const QSize &size); #if HAVE_WAYLAND bool loadShmTexture(const QPointer<KWayland::Server::BufferInterface> &buffer); bool loadEglTexture(const QPointer<KWayland::Server::BufferInterface> &buffer); EGLImageKHR attach(const QPointer<KWayland::Server::BufferInterface> &buffer); #endif SceneOpenGL::Texture *q; AbstractEglBackend *m_backend; EGLImageKHR m_image; }; } #endif
#ifndef DOMLETTE_XPATHNAMESPACE_H #define DOMLETTE_XPATHNAMESPACE_H #ifdef __cplusplus extern "C" { #endif #include "Python.h" #include "node.h" #include "element.h" typedef struct { PyNode_HEAD PyObject *nodeName; PyObject *nodeValue; } PyXPathNamespaceObject; #define XPathNamespace_GET_NAME(op) \ (((PyXPathNamespaceObject *)(op))->nodeName) #define XPathNamespace_GET_VALUE(op) \ (((PyXPathNamespaceObject *)(op))->nodeValue) extern PyTypeObject DomletteXPathNamespace_Type; #define PyXPathNamespace_Check(op) \ PyObject_TypeCheck(op, &DomletteXPathNamespace_Type) #define PyXPathNamespace_CheckExact(op) \ ((op)->ob_type == &DomletteXPathNamespace_Type) /* Module Methods */ int DomletteXPathNamespace_Init(PyObject *module); void DomletteXPathNamespace_Fini(void); /* XPathNamespace Methods */ PyXPathNamespaceObject *XPathNamespace_New(PyElementObject *parentNode, PyObject *prefix, PyObject *namespaceURI); #ifdef __cplusplus } #endif #endif /* DOMLETTE_XPATHNAMESPACE_H */
/* propertypaletteeditor.h This file is part of GammaRay, the Qt application inspection and manipulation tool. Copyright (C) 2012-2014 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com Author: Volker Krause <volker.krause@kdab.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, see <http://www.gnu.org/licenses/>. */ #ifndef GAMMARAY_PROPERTYPALETTEEDITOR_H #define GAMMARAY_PROPERTYPALETTEEDITOR_H #include "propertyextendededitor.h" namespace GammaRay { class PropertyPaletteEditor : public PropertyExtendedEditor { Q_OBJECT public: explicit PropertyPaletteEditor(QWidget *parent = 0); protected: virtual void edit(); }; } #endif // GAMMARAY_PROPERTYPALETTEEDITOR_H
#include <pwd.h> #include <stdlib.h> #include <unistd.h> #include "strerr.h" #include "auto_home.h" #include "generic-conf.h" #define FATAL "axfrdns-conf: fatal: " void usage(void) { strerr_die1x(100,"axfrdns-conf: usage: axfrdns-conf acct logacct /axfrdns /tinydns myip"); } char *dir; char *user; char *loguser; struct passwd *pw; char *myip; char *tinydns; int main(int argc,char **argv) { user = argv[1]; if (!user) usage(); loguser = argv[2]; if (!loguser) usage(); dir = argv[3]; if (!dir) usage(); if (dir[0] != '/') usage(); tinydns = argv[4]; if (!tinydns) usage(); if (tinydns[0] != '/') usage(); myip = argv[5]; if (!myip) usage(); pw = getpwnam(loguser); if (!pw) strerr_die3x(111,FATAL,"unknown account ",loguser); init(dir,FATAL); makelog(loguser,pw->pw_uid,pw->pw_gid); makedir("env"); perm(02755); start("env/ROOT"); outs(tinydns); outs("/root\n"); finish(); perm(0644); start("env/IP"); outs(myip); outs("\n"); finish(); perm(0644); start("run"); outs("#!/bin/sh\nexec 2>&1\nexec envdir ./env sh -c '\n exec envuidgid "); outs(user); outs(" softlimit -d300000 tcpserver -vDRHl0 -x tcp.cdb -- \"$IP\" 53 "); outs(auto_home); outs("/bin/axfrdns\n'\n"); finish(); perm(0755); start("Makefile"); outs("tcp.cdb: tcp\n"); outs("\ttcprules tcp.cdb tcp.tmp < tcp\n"); finish(); perm(0644); start("tcp"); outs("# sample line: 1.2.3.4:allow,AXFR=\"heaven.af.mil/3.2.1.in-addr.arpa\"\n"); outs(":deny\n"); finish(); perm(0644); return 0; }
/* created by click/linuxmodule/fixincludes.pl on Tue Nov 25 22:39:41 2014 */ /* from /lib/modules/2.6.27.5-117.fc10.i686/build/include/asm/mach-summit/mach_apicdef.h */ #ifndef __ASM_MACH_APICDEF_H #if defined(__cplusplus) && !CLICK_CXX_PROTECTED # error "missing #include <click/cxxprotect.h>" #endif #define __ASM_MACH_APICDEF_H #define APIC_ID_MASK (0xFF<<24) static inline unsigned get_apic_id(unsigned long x) { return (((x)>>24)&0xFF); } #define GET_APIC_ID(x) get_apic_id(x) #endif
/* * statfs() emulation for MiNT/TOS * * Written by Adrian Ashley (adrian@secret.uucp) * and placed in the public domain. * * Modified for MiNT 1.15 by Chris Felsch. */ #include <errno.h> #include <osbind.h> #include <mintbind.h> #include <unistd.h> #include <limits.h> #include <support.h> #include <string.h> #include <sys/stat.h> #include <sys/statfs.h> #include <mint/dcntl.h> /* From kernel source! */ #include "lib.h" int __statfs (const char *path, struct statfs *buf) { struct stat statbuf; struct fs_info info; struct fs_usage usage; long r; if (!buf || !path) { __set_errno (EFAULT); return -1; } r = __quickstat (path, &statbuf, 0); if (r == -1) return -1; r = Dcntl (FS_INFO, path, &info); if (r == 0) buf->f_type = info.type; else buf->f_type = FS_OLDTOS; /* default: TOS */ r = Dcntl (FS_USAGE, path, &usage); if (r == 0) { buf->f_bsize = usage.blocksize; buf->f_blocks = usage.blocks; buf->f_bfree = buf->f_bavail = usage.free_blocks; buf->f_files = usage.inodes; buf->f_ffree = usage.free_inodes; buf->f_fsid = -1LL; } else if (r == -ENOSYS) { _DISKINFO free; /* Hack by HPP 02/06/1993: since MiNT 0.99 only returns */ /* valid dfree info for pseudo-drives if they are the */ /* current directory, change directories for the occasion. */ if ((__mint >= 99) && (statbuf.st_dev >= 32)) { char oldpath[PATH_MAX]; if (getcwd (oldpath, PATH_MAX) != NULL) { chdir (path); r = Dfree (&free, statbuf.st_dev + 1); chdir (oldpath); } else r = Dfree (&free, statbuf.st_dev + 1); } else r = Dfree (&free, statbuf.st_dev + 1); if (r == 0) { buf->f_bsize = free.b_secsiz * free.b_clsiz; buf->f_blocks = free.b_total; buf->f_bfree = buf->f_bavail = free.b_free; buf->f_files = buf->f_ffree = -1L; buf->f_fsid = -1LL; } } /* An error occured (e.g. no medium in removable drive) */ if (r < 0) { __set_errno (-r); return -1; } return 0; } weak_alias (__statfs, statfs) int get_fsname (const char *path, char *xfs_name, char *type_name) { struct fs_info info; char xname[32]; char tname[32]; if (!path) { __set_errno (EFAULT); return -1; } if (Dcntl (FS_INFO, path, &info) >= 0) { /* MiNT 1.15 */ strcpy (xname, info.name); strcpy (tname, info.type_asc); } else { if (Dcntl (MX_KER_XFSNAME, path, xname) >= 0) { /* MagiC: only one name available */ strcpy (tname, xname); } else { strcpy (xname, "tos-fs"); strcpy (tname, "tos"); } } if (xfs_name) strcpy (xfs_name, xname); if (type_name) strcpy (type_name, tname); return 0; }
/*********** ECA_MemAllocs * * This is a c source code file to make Eric Anderson's * "ECA_MemAllocs" library which includes routines for allocating * memory. Nothing really fancy. Just some functions and * macros that make it so that the program will exit if a ECA_MALLOC * or ECA_CALLOC call fails, and a couple of global variables that * keep track of how much memory the program has requested (but * it does not keep track of how much it has freed!) * * * ************/ #include <stdio.h> #include <stdlib.h> #include "ECA_MemAlloc.h" void *eca_malloc(size_t bytes, char *VarName) { void *temp; if(bytes==0) return NULL; if( (temp = malloc(bytes) ) == NULL) { printf("\n\nMEMORY ALLOCATION FAILURE:"); printf("\nAttempted function: malloc(%s)", VarName); printf("\n%s = %d bytes", VarName,(int)bytes); printf("\n\nExiting to system...\n\n"); exit(1); } return(temp); } void *eca_calloc(size_t Num, size_t bytes, char *NumName, char *VarName) { void *temp; if(Num*bytes==0) return(NULL); if( (temp = calloc(Num, bytes)) == NULL) { printf("\n\nMEMORY ALLOCATION FAILURE:"); printf("\nAttempted function: calloc(%s,%s)", NumName, VarName); printf("\n%s = %d Elements", NumName,(int)Num); printf("\n%s = %d bytes", VarName,(int)bytes); printf("\n\nExiting to system...\n\n"); exit(1); } return(temp); }
struct c { int a; }; enum b { c, }; struct a { enum b c; };
/***************************************************************************** * flv_bytestream.h: flv muxer utilities ***************************************************************************** * Copyright (C) 2009-2012 x264 project * * Authors: Kieran Kunhya <kieran@kunhya.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 02111, USA. * * This program is also available under a commercial proprietary license. * For more information, contact us at licensing@x264.com. *****************************************************************************/ #ifndef X264_FLV_BYTESTREAM_H #define X264_FLV_BYTESTREAM_H /* offsets for packed values */ #define FLV_AUDIO_SAMPLESSIZE_OFFSET 1 #define FLV_AUDIO_SAMPLERATE_OFFSET 2 #define FLV_AUDIO_CODECID_OFFSET 4 #define FLV_VIDEO_FRAMETYPE_OFFSET 4 /* bitmasks to isolate specific values */ #define FLV_AUDIO_CHANNEL_MASK 0x01 #define FLV_AUDIO_SAMPLESIZE_MASK 0x02 #define FLV_AUDIO_SAMPLERATE_MASK 0x0c #define FLV_AUDIO_CODECID_MASK 0xf0 #define FLV_VIDEO_CODECID_MASK 0x0f #define FLV_VIDEO_FRAMETYPE_MASK 0xf0 #define AMF_END_OF_OBJECT 0x09 enum { FLV_HEADER_FLAG_HASVIDEO = 1, FLV_HEADER_FLAG_HASAUDIO = 4, }; enum { FLV_TAG_TYPE_AUDIO = 0x08, FLV_TAG_TYPE_VIDEO = 0x09, FLV_TAG_TYPE_META = 0x12, }; enum { FLV_MONO = 0, FLV_STEREO = 1, }; enum { FLV_SAMPLESSIZE_8BIT = 0, FLV_SAMPLESSIZE_16BIT = 1 << FLV_AUDIO_SAMPLESSIZE_OFFSET, }; enum { FLV_SAMPLERATE_SPECIAL = 0, /**< signifies 5512Hz and 8000Hz in the case of NELLYMOSER */ FLV_SAMPLERATE_11025HZ = 1 << FLV_AUDIO_SAMPLERATE_OFFSET, FLV_SAMPLERATE_22050HZ = 2 << FLV_AUDIO_SAMPLERATE_OFFSET, FLV_SAMPLERATE_44100HZ = 3 << FLV_AUDIO_SAMPLERATE_OFFSET, }; enum { FLV_CODECID_MP3 = 2 << FLV_AUDIO_CODECID_OFFSET, FLV_CODECID_AAC = 10<< FLV_AUDIO_CODECID_OFFSET, }; enum { FLV_CODECID_H264 = 7, }; enum { FLV_FRAME_KEY = 1 << FLV_VIDEO_FRAMETYPE_OFFSET | 7, FLV_FRAME_INTER = 2 << FLV_VIDEO_FRAMETYPE_OFFSET | 7, }; typedef enum { AMF_DATA_TYPE_NUMBER = 0x00, AMF_DATA_TYPE_BOOL = 0x01, AMF_DATA_TYPE_STRING = 0x02, AMF_DATA_TYPE_OBJECT = 0x03, AMF_DATA_TYPE_NULL = 0x05, AMF_DATA_TYPE_UNDEFINED = 0x06, AMF_DATA_TYPE_REFERENCE = 0x07, AMF_DATA_TYPE_MIXEDARRAY = 0x08, AMF_DATA_TYPE_OBJECT_END = 0x09, AMF_DATA_TYPE_ARRAY = 0x0a, AMF_DATA_TYPE_DATE = 0x0b, AMF_DATA_TYPE_LONG_STRING = 0x0c, AMF_DATA_TYPE_UNSUPPORTED = 0x0d, } AMFDataType; typedef struct flv_buffer { uint8_t *data; unsigned d_cur; unsigned d_max; FILE *fp; uint64_t d_total; } flv_buffer; flv_buffer *flv_create_writer( const char *filename ); int flv_append_data( flv_buffer *c, uint8_t *data, unsigned size ); int flv_write_byte( flv_buffer *c, uint8_t *byte ); int flv_flush_data( flv_buffer *c ); void flv_rewrite_amf_be24( flv_buffer *c, unsigned length, unsigned start ); uint64_t flv_dbl2int( double value ); void flv_put_byte( flv_buffer *c, uint8_t b ); void flv_put_be32( flv_buffer *c, uint32_t val ); void flv_put_be64( flv_buffer *c, uint64_t val ); void flv_put_be16( flv_buffer *c, uint16_t val ); void flv_put_be24( flv_buffer *c, uint32_t val ); void flv_put_tag( flv_buffer *c, const char *tag ); void flv_put_amf_string( flv_buffer *c, const char *str ); void flv_put_amf_double( flv_buffer *c, double d ); #endif
/* Copyright 2007 The MathWorks, Inc. */ /* * File: PCG_Eval_CodeMetrics_2.c * * Real-Time Workshop code generated for Simulink model PCG_Eval_CodeMetrics_2. * * Model version : 1.229 * Real-Time Workshop file version : 6.6 (R2007b) 27-Jan-2007 * Real-Time Workshop file generated on : Thu Feb 01 11:58:53 2007 * TLC version : 6.6 (Jan 27 2007) * C source code generated on : Thu Feb 01 11:58:53 2007 */ #include "PCG_Eval_CodeMetrics_2.h" #include "PCG_Eval_CodeMetrics_2_private.h" /* Exported block signals */ extern real32_T pos_cmd_one; /* '<Root>/Signal Conversion' */ extern real32_T pos_cmd_two; /* '<Root>/Signal Conversion1' */ ThrottleCommands ThrotComm; /* '<Root>/Pos_Command_Arbitration' */ ThrottleParams Throt_Param; /* '<S1>/Bus Creator' */ /* Initial conditions for function-call system: '<Root>/Pos_Command_Arbitration' */ void PC_Pos_Command_Arbitration_Init(void) { /* Initialize code for chart: '<Root>/Pos_Command_Arbitration' */ { int32_T sf_i0; for (sf_i0 = 0; sf_i0 < 2; sf_i0++) { ThrotComm.pos_cmd_raw[sf_i0] = 0.0F; } ThrotComm.pos_cmd_act = 0.0F; ThrotComm.pos_failure_mode = 0.0F; ThrotComm.err_cnt = 0.0F; } } /* Output and update for function-call system: '<Root>/Pos_Command_Arbitration' */ void PCG_Eva_Pos_Command_Arbitration(real32_T rtu_pos_cmd_one, const ThrottleParams *rtu_Throt_Param, real32_T rtu_pos_cmd_two) { /* Stateflow: '<Root>/Pos_Command_Arbitration' */ ThrotComm.pos_cmd_raw[0] = rtu_pos_cmd_one; ThrotComm.pos_cmd_raw[1] = rtu_pos_cmd_two; if (fabs((real_T)(rtu_pos_cmd_one - rtu_pos_cmd_two)) > (real_T) (*rtu_Throt_Param).max_diff) { ThrotComm.pos_failure_mode = 1.0F; ThrotComm.err_cnt = 0.0F; ThrotComm.pos_cmd_act = (*rtu_Throt_Param).fail_safe_pos; } else { if (ThrotComm.err_cnt >= (*rtu_Throt_Param).error_reset) { ThrotComm.pos_failure_mode = 0.0F; ThrotComm.err_cnt = 0.0F; } if (ThrotComm.pos_failure_mode > 0.0F) { ThrotComm.err_cnt = ThrotComm.err_cnt + 1.0F; } else if (fabs((real_T)(rtu_pos_cmd_one - ThrotComm.pos_cmd_act)) < fabs ((real_T)(rtu_pos_cmd_two - ThrotComm.pos_cmd_act))) { ThrotComm.pos_cmd_act = rtu_pos_cmd_one; } else { ThrotComm.pos_cmd_act = rtu_pos_cmd_two; } } }
/* ============================================================ * * This file is a part of kipi-plugins project * http://www.digikam.org * * Date : 2003-10-01 * Description : a plugin to export to a remote Gallery server. * * Copyright (C) 2003-2005 by Renchi Raju <renchi dot raju at gmail dot com> * Copyright (C) 2006 by Colin Guthrie <kde@colin.guthr.ie> * Copyright (C) 2006-2009 by Gilles Caulier <caulier dot gilles at gmail dot com> * Copyright (C) 2008 by Andrea Diamantini <adjam7 at gmail dot com> * * This program is free software; you can redistribute it * and/or modify it under the terms of the GNU General * Public License as published by the Free Software Foundation; * either version 2, 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. * * ============================================================ */ #ifndef GALLERIES_H #define GALLERIES_H // Qt includes #include <QString> namespace KWallet { class Wallet; } namespace KIPIGalleryExportPlugin { class Gallery { public: Gallery(); ~Gallery(); QString name() const; QString url() const; QString username() const; QString password() const; unsigned int version() const; unsigned int galleryId() const; void setName(const QString& name); void setUrl(const QString& url); void setUsername(const QString& username); void setPassword(const QString& password); void setVersion(unsigned int version); void setGalleryId(unsigned int galleryId); public: void save(); private: void load(); private: unsigned int mVersion; unsigned int mGalleryId; QString mName; QString mUrl; QString mUsername; QString mPassword; KWallet::Wallet* mpWallet; }; } // namespace KIPIGalleryExportPlugin #endif /* GALLERIES_H */
/* netxray.h * * $Id: netxray.h 43536 2012-06-28 22:56:06Z darkjames $ * * Wiretap Library * Copyright (c) 1998 by Gilbert Ramirez <gram@alumni.rice.edu> * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ #ifndef __NETXRAY_H__ #define __NETXRAY_H__ #include <glib.h> #include <wtap.h> int netxray_open(wtap *wth, int *err, gchar **err_info); int netxray_dump_can_write_encap_1_1(int encap); gboolean netxray_dump_open_1_1(wtap_dumper *wdh, int *err); int netxray_dump_can_write_encap_2_0(int encap); gboolean netxray_dump_open_2_0(wtap_dumper *wdh, int *err); #endif
/* * Read an unsigned char from given IO channel */ unsigned char inportb(unsigned short _port) { unsigned char c; __asm__ __volatile__ ("inb %1, %0" : "=a" (c) : "dN" (_port)); return c; } /* * Write an unsigned char to given IO channel */ void outportb(unsigned short _port, unsigned char _data) { __asm__ __volatile__ ("outb %1, %0" : : "dN" (_port), "a" (_data)); } /* * Read an unsigned long from given IO channel */ unsigned long inportl(unsigned short _port) { unsigned long l; __asm__ __volatile__ ("inl %1, %0" : "=a" (l) : "dN" (_port)); return l; } /* * Write an unsigned long to given IO channel */ void outportl(unsigned short _port, unsigned long _data) { __asm__ __volatile__ ("outl %1, %0" : : "dN" (_port), "a" (_data)); }
/* * The ManaPlus Client * Copyright (C) 2009 The Mana World Development Team * Copyright (C) 2009-2010 The Mana Developers * Copyright (C) 2011-2013 The ManaPlus Developers * * This file is part of The ManaPlus Client. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #ifndef TA_PARTYTAB_H #define TA_PARTYTAB_H #include "net/ea/gui/partytab.h" namespace TmwAthena { /** * A tab for a party chat channel. */ class PartyTab : public Ea::PartyTab { public: explicit PartyTab(const Widget2 *const widget); A_DELETE_COPY(PartyTab) ~PartyTab(); }; } // namespace TmwAthena #endif // TA_PARTYTAB_H
/* htop - generic/gettime.c (C) 2021 htop dev team Released under the GNU GPLv2+, see the COPYING file in the source distribution for its full text. */ #include "config.h" // IWYU pragma: keep #include "generic/gettime.h" #include <string.h> #include <time.h> void Generic_gettime_realtime(struct timeval* tvp, uint64_t* msec) { #if defined(HAVE_CLOCK_GETTIME) struct timespec ts; if (clock_gettime(CLOCK_REALTIME, &ts) == 0) { tvp->tv_sec = ts.tv_sec; tvp->tv_usec = ts.tv_nsec / 1000; *msec = ((uint64_t)ts.tv_sec * 1000) + ((uint64_t)ts.tv_nsec / 1000000); } else { memset(tvp, 0, sizeof(struct timeval)); *msec = 0; } #else /* lower resolution gettimeofday(2) is always available */ struct timeval tv; if (gettimeofday(&tv, NULL) == 0) { *tvp = tv; /* struct copy */ *msec = ((uint64_t)tv.tv_sec * 1000) + ((uint64_t)tv.tv_usec / 1000); } else { memset(tvp, 0, sizeof(struct timeval)); *msec = 0; } #endif } void Generic_gettime_monotonic(uint64_t* msec) { #if defined(HAVE_CLOCK_GETTIME) struct timespec ts; if (clock_gettime(CLOCK_MONOTONIC, &ts) == 0) *msec = ((uint64_t)ts.tv_sec * 1000) + ((uint64_t)ts.tv_nsec / 1000000); else *msec = 0; #else # error "No monotonic clock available" #endif }
/* * Spanning tree protocol; BPDU handling * Linux ethernet bridge * * Authors: * Lennert Buytenhek <buytenh@gnu.org> * * $Id: br_stp_bpdu.c,v 1.1.1.1 2007/10/15 18:22:56 ronald Exp $ * * 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. */ #include <linux/kernel.h> #include <linux/netfilter_bridge.h> #include <linux/etherdevice.h> #include <linux/llc.h> #include <net/llc.h> #include <net/llc_pdu.h> #include <asm/unaligned.h> #include "br_private.h" #include "br_private_stp.h" #define STP_HZ 256 #define LLC_RESERVE sizeof(struct llc_pdu_un) static void br_send_bpdu(struct net_bridge_port *p, const unsigned char *data, int length) { struct sk_buff *skb; if (!p->br->stp_enabled) return; skb = dev_alloc_skb(length+LLC_RESERVE); if (!skb) return; skb->dev = p->dev; skb->protocol = htons(ETH_P_802_2); skb_reserve(skb, LLC_RESERVE); memcpy(__skb_put(skb, length), data, length); llc_pdu_header_init(skb, LLC_PDU_TYPE_U, LLC_SAP_BSPAN, LLC_SAP_BSPAN, LLC_PDU_CMD); llc_pdu_init_as_ui_cmd(skb); llc_mac_hdr_init(skb, p->dev->dev_addr, p->br->group_addr); NF_HOOK(PF_BRIDGE, NF_BR_LOCAL_OUT, skb, NULL, skb->dev, dev_queue_xmit); } static inline void br_set_ticks(unsigned char *dest, int j) { unsigned long ticks = (STP_HZ * j)/ HZ; put_unaligned(htons(ticks), (__be16 *)dest); } static inline int br_get_ticks(const unsigned char *src) { unsigned long ticks = ntohs(get_unaligned((__be16 *)src)); return (ticks * HZ + STP_HZ - 1) / STP_HZ; } /* called under bridge lock */ void br_send_config_bpdu(struct net_bridge_port *p, struct br_config_bpdu *bpdu) { unsigned char buf[35]; buf[0] = 0; buf[1] = 0; buf[2] = 0; buf[3] = BPDU_TYPE_CONFIG; buf[4] = (bpdu->topology_change ? 0x01 : 0) | (bpdu->topology_change_ack ? 0x80 : 0); buf[5] = bpdu->root.prio[0]; buf[6] = bpdu->root.prio[1]; buf[7] = bpdu->root.addr[0]; buf[8] = bpdu->root.addr[1]; buf[9] = bpdu->root.addr[2]; buf[10] = bpdu->root.addr[3]; buf[11] = bpdu->root.addr[4]; buf[12] = bpdu->root.addr[5]; buf[13] = (bpdu->root_path_cost >> 24) & 0xFF; buf[14] = (bpdu->root_path_cost >> 16) & 0xFF; buf[15] = (bpdu->root_path_cost >> 8) & 0xFF; buf[16] = bpdu->root_path_cost & 0xFF; buf[17] = bpdu->bridge_id.prio[0]; buf[18] = bpdu->bridge_id.prio[1]; buf[19] = bpdu->bridge_id.addr[0]; buf[20] = bpdu->bridge_id.addr[1]; buf[21] = bpdu->bridge_id.addr[2]; buf[22] = bpdu->bridge_id.addr[3]; buf[23] = bpdu->bridge_id.addr[4]; buf[24] = bpdu->bridge_id.addr[5]; buf[25] = (bpdu->port_id >> 8) & 0xFF; buf[26] = bpdu->port_id & 0xFF; br_set_ticks(buf+27, bpdu->message_age); br_set_ticks(buf+29, bpdu->max_age); br_set_ticks(buf+31, bpdu->hello_time); br_set_ticks(buf+33, bpdu->forward_delay); br_send_bpdu(p, buf, 35); } /* called under bridge lock */ void br_send_tcn_bpdu(struct net_bridge_port *p) { unsigned char buf[4]; buf[0] = 0; buf[1] = 0; buf[2] = 0; buf[3] = BPDU_TYPE_TCN; br_send_bpdu(p, buf, 4); } /* * Called from llc. * * NO locks, but rcu_read_lock (preempt_disabled) */ int br_stp_rcv(struct sk_buff *skb, struct net_device *dev, struct packet_type *pt, struct net_device *orig_dev) { const struct llc_pdu_un *pdu = llc_pdu_un_hdr(skb); const unsigned char *dest = eth_hdr(skb)->h_dest; struct net_bridge_port *p = rcu_dereference(dev->br_port); struct net_bridge *br; const unsigned char *buf; if (!p) goto err; if (pdu->ssap != LLC_SAP_BSPAN || pdu->dsap != LLC_SAP_BSPAN || pdu->ctrl_1 != LLC_PDU_TYPE_U) goto err; if (!pskb_may_pull(skb, 4)) goto err; /* compare of protocol id and version */ buf = skb->data; if (buf[0] != 0 || buf[1] != 0 || buf[2] != 0) goto err; br = p->br; spin_lock(&br->lock); if (p->state == BR_STATE_DISABLED || !br->stp_enabled || !(br->dev->flags & IFF_UP)) goto out; if (compare_ether_addr(dest, br->group_addr) != 0) goto out; buf = skb_pull(skb, 3); if (buf[0] == BPDU_TYPE_CONFIG) { struct br_config_bpdu bpdu; if (!pskb_may_pull(skb, 32)) goto out; buf = skb->data; bpdu.topology_change = (buf[1] & 0x01) ? 1 : 0; bpdu.topology_change_ack = (buf[1] & 0x80) ? 1 : 0; bpdu.root.prio[0] = buf[2]; bpdu.root.prio[1] = buf[3]; bpdu.root.addr[0] = buf[4]; bpdu.root.addr[1] = buf[5]; bpdu.root.addr[2] = buf[6]; bpdu.root.addr[3] = buf[7]; bpdu.root.addr[4] = buf[8]; bpdu.root.addr[5] = buf[9]; bpdu.root_path_cost = (buf[10] << 24) | (buf[11] << 16) | (buf[12] << 8) | buf[13]; bpdu.bridge_id.prio[0] = buf[14]; bpdu.bridge_id.prio[1] = buf[15]; bpdu.bridge_id.addr[0] = buf[16]; bpdu.bridge_id.addr[1] = buf[17]; bpdu.bridge_id.addr[2] = buf[18]; bpdu.bridge_id.addr[3] = buf[19]; bpdu.bridge_id.addr[4] = buf[20]; bpdu.bridge_id.addr[5] = buf[21]; bpdu.port_id = (buf[22] << 8) | buf[23]; bpdu.message_age = br_get_ticks(buf+24); bpdu.max_age = br_get_ticks(buf+26); bpdu.hello_time = br_get_ticks(buf+28); bpdu.forward_delay = br_get_ticks(buf+30); br_received_config_bpdu(p, &bpdu); } else if (buf[0] == BPDU_TYPE_TCN) { br_received_tcn_bpdu(p); } out: spin_unlock(&br->lock); err: kfree_skb(skb); return 0; }
/*************************************************************************** addlinkdialog.h - K Desktop Planetarium ------------------- begin : Sun Oct 21 2001 copyright : (C) 2001 by Jason Harris email : kstars@30doradus.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. * * * ***************************************************************************/ #ifndef ADDLINKDIALOG_H #define ADDLINKDIALOG_H #include <kdialogbase.h> #include <klineedit.h> #include <klocale.h> #include <qradiobutton.h> #include "addlinkdialogui.h" class QLayout; class QString; class SkyMap; /**@class Simple dialog for adding a custom URL to a popup menu. *@author Jason Harris *@version 1.0 */ class AddLinkDialog : public KDialogBase { Q_OBJECT public: /**Constructor. */ AddLinkDialog( QWidget* parent = 0, const QString &oname=i18n("object") ); /**Destructor (empty) */ ~AddLinkDialog() {} /**@return QString of the entered URL */ QString url() const { return ald->URLBox->text(); } /**@short Set the URL text *@param s the new URL text */ void setURL( const QString &s ) { ald->URLBox->setText( s ); } /**@return QString of the entered menu entry text */ QString desc() const { return ald->DescBox->text(); } /**@short Set the Description text *@param s the new description text */ void setDesc( const QString &s ) { ald->DescBox->setText( s ); } /**@return TRUE if user declared the link is an image */ bool isImageLink() const { return ald->ImageRadio->isChecked(); } /**@short Set the link type *@param b if true, link is an image link. */ void setImageLink( bool b ) { ald->ImageRadio->setChecked( b ); } private slots: /**Open the entered URL in the web browser */ void checkURL( void ); /**We provide a default menu text string; this function changes the *default string if the link type (image/webpage) is changed. Note *that if the user has changed the menu text, this function does nothing. *@param id 0=show image string; 1=show webpage string. */ void changeDefaultDescription( int id ); private: QString ObjectName; QVBoxLayout *vlay; AddLinkDialogUI *ald; }; #endif
#ifndef __CORESRV_FS_FAT16_H__ #define __CORESRV_FS_FAT16_H__ #include <hellbender/fs/vfs.h> #include <hellbender/dev/bdev.h> typedef struct fat16_op { int (*create)(vfs_node_t *dev, vfs_fs_t *fs); } fat16_op_t; typedef void (*fat16_bind_t)(fat16_op_t *fat16_op); #define FAT16_ID "coresrv::fs::fat16" #define FAT16_BIND ((fat16_bind_t)BROKER_LOOKUP(FAT16_ID)) #endif
/********************************************************************** * Copyright (C) (2004) (Jack Louis) <jack@rapturesecurity.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., 675 Mass Ave, Cambridge, MA 02139, USA. * **********************************************************************/ #ifndef _CIDR_H # define _CIDR_H /* * returns: * > -1 address family AF_INET or AF_INET6 that sockaddr's are within * -1: error condition with error message in error string pointer * arguments: */ int cidr_get( const char * /* network string */, struct sockaddr * /* netid host order */, struct sockaddr * /* netmask (host order) */, unsigned int * /* parsed cidr mask (perhaps implied) */ ); /* * increments the socket address, returns 1 if ok, -1 otherwise */ int cidr_inchost( struct sockaddr * /* host */, struct sockaddr * /* network */, struct sockaddr * /* netmask */ ); /* * returns 1 if host is within the network/netmask, 0 if it is outside, * and -1 if there is some sort of error with the arguments */ int cidr_within( const struct sockaddr * /* host */, const struct sockaddr * /* network */, const struct sockaddr * /* netmask */ ); /* * returns a string describing the socket address structure */ char *cidr_saddrstr(const struct sockaddr * /* address */); #endif /* _CIDR_H */
/*************************************************************************** * Copyright (C) 1999 - 2019 by Mike McLean * * libolt@libolt.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., * * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * ***************************************************************************/ #ifndef _PLAYERPHYSICS_H_ #define _PLAYERPHYSICS_H_ #ifdef _ENABLE_BTOGRE #include "physics/physics.h" #include "utilities/typedefs.h" //#include "state/gamestateshared.h" //class physics; class gameState; class playerPhysics : public physics { public: playerPhysics(); // constructor ~playerPhysics(); // destructor void update(); // updates the player physics object void updatePosition(); // updates the position of player objecgts bool jump(teamTypes teamType, int playerID); // calculates and executes player jumping in the air bool shootBasketball(teamTypes teamType, int playerID); // calculates and executes basketball being shot private: }; #endif #endif // PLAYERPHYSICS_H
/*************************************************************************** * Copyright (C) 2006 by Peter Penz * * peter.penz@gmx.at * * * * 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 BEHAVIORSETTINGSPAGE_H #define BEHAVIORSETTINGSPAGE_H #include <settings/settingspagebase.h> #include <KUrl> class QCheckBox; class QLabel; class QRadioButton; /** * @brief Tab page for the 'Behavior' settings of the Dolphin settings dialog. */ class BehaviorSettingsPage : public SettingsPageBase { Q_OBJECT public: BehaviorSettingsPage(const KUrl& url, QWidget* parent); virtual ~BehaviorSettingsPage(); /** @see SettingsPageBase::applySettings() */ virtual void applySettings(); /** @see SettingsPageBase::restoreDefaults() */ virtual void restoreDefaults(); private: void loadSettings(); private: KUrl m_url; QRadioButton* m_localProps; QRadioButton* m_globalProps; QCheckBox* m_confirmMoveToTrash; QCheckBox* m_confirmDelete; QCheckBox* m_confirmClosingMultipleTabs; QCheckBox* m_showToolTips; QLabel* m_configureToolTips; QCheckBox* m_showSelectionToggle; QCheckBox* m_naturalSorting; }; #endif
/* Amiga AHI driver for Extended Module Player * Based on a MikMod driver written by Szilard Biro, which was loosely * based on an old AmigaOS4 version by Fredrik Wikstrom. * * This file is part of the Extended Module Player and is distributed * under the terms of the GNU General Public License. See the COPYING * file for more information. */ #ifdef __amigaos4__ #define SHAREDMEMFLAG MEMF_SHARED #define __USE_INLINE__ #else #define SHAREDMEMFLAG MEMF_PUBLIC #endif #include <stdlib.h> #include <string.h> #include "sound.h" #include <proto/exec.h> #include <proto/dos.h> #include <devices/ahi.h> #define BUFFERSIZE (4 << 10) static struct MsgPort *AHImp = NULL; static struct AHIRequest *AHIReq[2] = { NULL, NULL }; static int active = 0; static signed char *AHIBuf[2] = { NULL, NULL }; static void closeLibs(void) { if (AHIReq[1]) { AHIReq[0]->ahir_Link = NULL; /* in case we are linked to req[0] */ if (!CheckIO((struct IORequest *) AHIReq[1])) { AbortIO((struct IORequest *) AHIReq[1]); WaitIO((struct IORequest *) AHIReq[1]); } FreeVec(AHIReq[1]); AHIReq[1] = NULL; } if (AHIReq[0]) { if (!CheckIO((struct IORequest *) AHIReq[0])) { AbortIO((struct IORequest *) AHIReq[0]); WaitIO((struct IORequest *) AHIReq[0]); } if (AHIReq[0]->ahir_Std.io_Device) { CloseDevice((struct IORequest *) AHIReq[0]); AHIReq[0]->ahir_Std.io_Device = NULL; } DeleteIORequest((struct IORequest *) AHIReq[0]); AHIReq[0] = NULL; } if (AHImp) { DeleteMsgPort(AHImp); AHImp = NULL; } if (AHIBuf[0]) { FreeVec(AHIBuf[0]); AHIBuf[0] = NULL; } if (AHIBuf[1]) { FreeVec(AHIBuf[1]); AHIBuf[1] = NULL; } } static int init(struct options *options) { AHImp = CreateMsgPort(); if (AHImp) { AHIReq[0] = (struct AHIRequest *)CreateIORequest(AHImp, sizeof(struct AHIRequest)); if (AHIReq[0]) { AHIReq[0]->ahir_Version = 4; AHIReq[1] = AllocVec(sizeof(struct AHIRequest), SHAREDMEMFLAG); if (AHIReq[1]) { if (!OpenDevice(AHINAME, AHI_DEFAULT_UNIT, (struct IORequest *)AHIReq[0], 0)) { AHIReq[0]->ahir_Std.io_Command = CMD_WRITE; AHIReq[0]->ahir_Std.io_Data = NULL; AHIReq[0]->ahir_Std.io_Offset = 0; AHIReq[0]->ahir_Frequency = options->rate; AHIReq[0]->ahir_Type = (options->format & XMP_FORMAT_8BIT)? ((options->format & XMP_FORMAT_MONO)? AHIST_M8S : AHIST_S8S ) : ((options->format & XMP_FORMAT_MONO)? AHIST_M16S : AHIST_S16S); AHIReq[0]->ahir_Volume = 0x10000; AHIReq[0]->ahir_Position = 0x8000; CopyMem(AHIReq[0], AHIReq[1], sizeof(struct AHIRequest)); AHIBuf[0] = AllocVec(BUFFERSIZE, SHAREDMEMFLAG | MEMF_CLEAR); if (AHIBuf[0]) { AHIBuf[1] = AllocVec(BUFFERSIZE, SHAREDMEMFLAG | MEMF_CLEAR); if (AHIBuf[1]) { /* driver is initialized before calling libxmp, so this is OK : */ options->format &= ~XMP_FORMAT_UNSIGNED;/* no unsigned with AHI */ return 0; } } } } } } closeLibs(); return -1; } static void deinit(void) { closeLibs(); } static void play(void *b, int len) { signed char *in = (signed char *)b; int chunk; while (len > 0) { if (AHIReq[active]->ahir_Std.io_Data) { WaitIO((struct IORequest *) AHIReq[active]); } chunk = (len < BUFFERSIZE)? len : BUFFERSIZE; memcpy(AHIBuf[active], in, chunk); len -= chunk; in += chunk; AHIReq[active]->ahir_Std.io_Data = AHIBuf[active]; AHIReq[active]->ahir_Std.io_Length = chunk; AHIReq[active]->ahir_Link = !CheckIO((struct IORequest *) AHIReq[active ^ 1]) ? AHIReq[active ^ 1] : NULL; SendIO((struct IORequest *)AHIReq[active]); active ^= 1; } } static void flush(void) { } static void onpause(void) { } static void onresume(void) { } struct sound_driver sound_ahi = { "ahi", "Amiga AHI audio", NULL, init, deinit, play, flush, onpause, onresume };
/***************************************************************************** * Copyright 2006 - 2008 Broadcom Corporation. All rights reserved. * * Unless you and Broadcom execute a separate written software license * agreement governing use of this software, this software is licensed to you * under the terms of the GNU General Public License version 2, available at * http://www.broadcom.com/licenses/GPLv2.php (the "GPL"). * * Notwithstanding the above, under no circumstances may you combine this * software in any way with any other Broadcom software provided under a * license other than the GPL, without Broadcom's express prior written * consent. *****************************************************************************/ /*============================================================================= Project : VideoCore Software Host Interface (Host-side functions) Module : Host Request Service (host-side) File : $Id: $ Revision : $Revision: $ FILE DESCRIPTION General command service using VCHI =============================================================================*/ #ifndef VC_VCHI_GENCMD_H #define VC_VCHI_GENCMD_H #include <linux/broadcom/vc03/vchost_config.h> #include <linux/broadcom/vc03/vchi/vchi.h> /* Initialise general command service. Returns it's interface number. This initialises the host side of the interface, it does not send anything to VideoCore. */ VCHPRE_ int VCHPOST_ vc_gencmd_init(void); VCHPRE_ void * VCHPOST_ vc_vchi_gencmd_init(VCHI_INSTANCE_T initialise_instance, VCHI_CONNECTION_T **connections, uint32_t num_connections ); /* Stop the service from being used. */ VCHPRE_ void VCHPOST_ vc_gencmd_stop(void * instp); /****************************************************************************** Send commands to VideoCore. These all return 0 for success. They return VC_MSGFIFO_FIFO_FULL if there is insufficient space for the whole message in the fifo, and none of the message is sent. ******************************************************************************/ /* send command to general command serivce */ VCHPRE_ int VCHPOST_ vc_gencmd_send( void * instp, const char *format, ... ); /* get resonse from general command serivce */ VCHPRE_ int VCHPOST_ vc_gencmd_read_response(void * instp, char *response, int maxlen); /* convenience function to send command and receive the response */ VCHPRE_ int VCHPOST_ vc_gencmd(void * hdl, char *response, int maxlen, const char *format, ...); /****************************************************************************** Utilities to help interpret the responses. ******************************************************************************/ /* Read the value of a property=value type pair from a string (typically VideoCore's response to a general command). Return non-zero if found. */ VCHPRE_ int VCHPOST_ vc_gencmd_string_property(char *text, const char *property, char **value, int *length); /* Read the numeric value of a property=number field from a response string. Return non-zero if found. */ VCHPRE_ int VCHPOST_ vc_gencmd_number_property(char *text, const char *property, int *number); /* Send a command until the desired response is received, the error message is detected, or the timeout */ VCHPRE_ int VCHPOST_ vc_gencmd_until( void *instp, char *cmd, const char *property, char *value, const char *error_string, int timeout); #endif
/* early printk support * * Copyright (c) 2009 Philippe Vachon <philippe@cowpig.ca> * Copyright (c) 2009 Lemote Inc. * Author: Wu Zhangjin, wuzhangjin@gmail.com * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the * Free Software Foundation; either version 2 of the License, or (at your * option) any later version. */ #include <linux/serial_reg.h> #include <loongson.h> #define PORT(base, offset) (u8 *)(base + offset) static inline unsigned int serial_in(unsigned char *base, int offset) { return readb(PORT(base, offset)); } static inline void serial_out(unsigned char *base, int offset, int value) { writeb(value, PORT(base, offset)); } void prom_putchar(char c) { int timeout; unsigned char *uart_base; uart_base = (unsigned char *)_loongson_uart_base[0]; timeout = 1024; while (((serial_in(uart_base, UART_LSR) & UART_LSR_THRE) == 0) && (timeout-- > 0)) ; serial_out(uart_base, UART_TX, c); }
/* cmdline.h - Command-line parser interface. Copyright (C) 2002 Alexios Chouchoulas This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. $Id: cmdline.h,v 1.1.1.1 2003/08/29 12:33:18 alexios Exp $ $Log: cmdline.h,v $ Revision 1.1.1.1 2003/08/29 12:33:18 alexios Initial revision. */ #ifndef __CMDLINE_H #define __CMDLINE_H #include <argp.h> extern struct argp_option options[]; /* argp option keys */ enum {DUMMY_KEY=129 ,BRIEF_KEY ,KEY_DEFAULT ,KEY_TEST ,KEY_ID ,KEY_OFF ,KEY_INFO ,KEY_GETALMANAC ,KEY_SENDALMANAC ,KEY_GETTRACKS ,KEY_SENDTRACKS ,KEY_GETWAYPOINTS ,KEY_SENDWAYPOINTS ,KEY_GETROUTES ,KEY_SENDROUTES ,KEY_TIME ,KEY_BACKUP ,KEY_RESTORE }; /* Option flags and variables. These are initialized in parse_opt. */ extern char *local, *remote; extern char ** cmdline; extern struct argp argp; void cmdline_parse (int argc, char ** argv); #endif /* __CMDLINE_H */
// generated by Fast Light User Interface Designer (fluid) version 1.0302 #ifndef CrashHandler_h #define CrashHandler_h #include <FL/Fl.H> #include <FL/Fl_Double_Window.H> #include <FL/Fl_Box.H> #include <FL/Fl_Text_Display.H> #include <FL/Fl_Button.H> extern void send_report(Fl_Button*, void*); class CrashHandlerDlg { public: Fl_Double_Window* create_window(); Fl_Text_Display *stack_output; static void close_crash_handler(Fl_Button* button, void*); }; #endif
/* * FreeRTOS Kernel V10.1.1 * Copyright (C) 2018 Amazon.com, Inc. or its affiliates. All Rights Reserved. * * 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. * * http://www.FreeRTOS.org * http://aws.amazon.com/freertos * * 1 tab == 4 spaces! */ #ifndef FREERTOS_CONFIG_H #define FREERTOS_CONFIG_H /*----------------------------------------------------------- * Application specific definitions. * * These definitions should be adjusted for your particular hardware and * application requirements. * * THESE PARAMETERS ARE DESCRIBED WITHIN THE 'CONFIGURATION' SECTION OF THE * FreeRTOS API DOCUMENTATION AVAILABLE ON THE FreeRTOS.org WEB SITE. * * See http://www.freertos.org/a00110.html *----------------------------------------------------------*/ /* Ensure stdint is only used by the compiler, and not the assembler. */ #ifdef __ICCARM__ #include <stdint.h> extern uint32_t SystemCoreClock; #endif #include "system_stm32f4xx.h" #define configUSE_NEWLIB_REENTRANT 1 #define configSUPPORT_STATIC_ALLOCATION 1 #define configUSE_PREEMPTION 1 #define configUSE_IDLE_HOOK 1 #define configUSE_TICK_HOOK 1 #define configCPU_CLOCK_HZ (SystemCoreClock) #define configTICK_RATE_HZ ((TickType_t)1000) #define configMAX_PRIORITIES (5) #define configMINIMAL_STACK_SIZE ((unsigned short)130) #define configTOTAL_HEAP_SIZE ((size_t)(75*1024)) #define configMAX_TASK_NAME_LEN (10) #define configUSE_TRACE_FACILITY 1 #define configUSE_16_BIT_TICKS 0 #define configIDLE_SHOULD_YIELD 1 #define configUSE_MUTEXES 1 #define configQUEUE_REGISTRY_SIZE 8 #define configCHECK_FOR_STACK_OVERFLOW 2 #define configUSE_RECURSIVE_MUTEXES 1 #define configUSE_MALLOC_FAILED_HOOK 1 #define configUSE_APPLICATION_TASK_TAG 0 #define configUSE_COUNTING_SEMAPHORES 1 #define configGENERATE_RUN_TIME_STATS 0 /* Co-routine definitions. */ #define configUSE_CO_ROUTINES 0 #define configMAX_CO_ROUTINE_PRIORITIES (2) /* Software timer definitions. */ #define configUSE_TIMERS 1 #define configTIMER_TASK_PRIORITY (2) #define configTIMER_QUEUE_LENGTH 10 #define configTIMER_TASK_STACK_DEPTH (configMINIMAL_STACK_SIZE * 2) /* Set the following definitions to 1 to include the API function, or zero to exclude the API function. */ #define INCLUDE_vTaskPrioritySet 1 #define INCLUDE_uxTaskPriorityGet 1 #define INCLUDE_vTaskDelete 1 #define INCLUDE_vTaskCleanUpResources 1 #define INCLUDE_vTaskSuspend 1 #define INCLUDE_vTaskDelayUntil 1 #define INCLUDE_vTaskDelay 1 /* Cortex-M specific definitions. */ #ifdef __NVIC_PRIO_BITS /* __BVIC_PRIO_BITS will be specified when CMSIS is being used. */ #define configPRIO_BITS __NVIC_PRIO_BITS #else #define configPRIO_BITS 4 /* 15 priority levels */ #endif /* The lowest interrupt priority that can be used in a call to a "set priority" function. */ #define configLIBRARY_LOWEST_INTERRUPT_PRIORITY 0xf /* The highest interrupt priority that can be used by any interrupt service routine that makes calls to interrupt safe FreeRTOS API functions. DO NOT CALL INTERRUPT SAFE FREERTOS API FUNCTIONS FROM ANY INTERRUPT THAT HAS A HIGHER PRIORITY THAN THIS! (higher priorities are lower numeric values. */ #define configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY 5 /* Interrupt priorities used by the kernel port layer itself. These are generic to all Cortex-M ports, and do not rely on any particular library functions. */ #define configKERNEL_INTERRUPT_PRIORITY \ (configLIBRARY_LOWEST_INTERRUPT_PRIORITY << (8 - configPRIO_BITS)) /* !!!! configMAX_SYSCALL_INTERRUPT_PRIORITY must not be set to zero !!!! See http://www.FreeRTOS.org/RTOS-Cortex-M3-M4.html. */ #define configMAX_SYSCALL_INTERRUPT_PRIORITY \ (configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY << (8 - configPRIO_BITS)) /* Normal assert() semantics without relying on the provision of an assert.h header file. */ #define configASSERT(x) if ((x) == 0) {taskDISABLE_INTERRUPTS(); for( ;; ); } /* Definitions that map the FreeRTOS port interrupt handlers to their CMSIS standard names. */ #define vPortSVCHandler SVC_Handler #define xPortPendSVHandler PendSV_Handler #define xPortSysTickHandler SysTick_Handler #endif /* FREERTOS_CONFIG_H */
// -------------------------------------------------------------------------- // File: io_float.h // // Purpose: Routines to handle floating-point // // Author: Michael S. A. Robb // // Date: 2005/01/27 // --------------------------------------------------------------------------- #ifndef _IO_FLOAT_H_ #define _IO_FLOAT_H_ // -------------------------------------------------------------------------- // File system for byte management // -------------------------------------------------------------------------- class CFileSystemFloat : virtual public CFileSystemPar { // ----- Class members ------------------------------------------------------ public: // ----- Read routines ------------------------------------------------------ // ----- Floats ----- void ReadFloat( std::ifstream &stream, float &fvalue ) { stream >> fvalue; } // ----- Write routines ----------------------------------------------------- void WriteFloat(std::ofstream &stream, float fvalue ) { stream << fvalue; } void WriteNamedFloat(std::ofstream &stream, unsigned int depth, const char *pname, float fvalue ) { WriteTabbedDepth( stream, depth ); stream << "{" << pname << " " << fvalue << " }\n"; } void WriteNamedFloat(std::ofstream &stream, unsigned int depth, std::string &strname, float fvalue ) { WriteTabbedDepth( stream, depth ); stream << "{" << strname.c_str() << " " << fvalue << " }\n"; } }; #endif // _IO_FLOAT_H_
/* UOL Messenger * Copyright (c) 2005 Universo Online S/A * * Direitos Autorais Reservados * All rights reserved * * Este programa é software livre; você pode redistribuí-lo e/ou modificá-lo * sob os termos da Licença Pública Geral GNU conforme publicada pela Free * Software Foundation; tanto a versão 2 da Licença, como (a seu critério) * qualquer versão posterior. * Este programa é distribuído na expectativa de que seja útil, porém, * SEM NENHUMA GARANTIA; nem mesmo a garantia implícita de COMERCIABILIDADE * OU ADEQUAÇÃO A UMA FINALIDADE ESPECÍFICA. Consulte a Licença Pública Geral * do GNU para mais detalhes. * Você deve ter recebido uma cópia da Licença Pública Geral do GNU junto * com este programa; se não, escreva para a Free Software Foundation, Inc., * no endereço 59 Temple Street, Suite 330, Boston, MA 02111-1307 USA. * * 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. * * Universo Online S/A - A/C: UOL Messenger 5o. Andar * Avenida Brigadeiro Faria Lima, 1.384 - Jardim Paulistano * São Paulo SP - CEP 01452-002 - BRASIL */ #include "../ContextMenu.h" #include <interfaces/IUOLMessengerPluginCustomListEntry.h> class CPluginCustomGroupMenu : public IUOLMessengerMenuItemCallback { public: CPluginCustomGroupMenu(); virtual ~CPluginCustomGroupMenu(); BOOL IsBusy() const; void CreateMenu(); void ShowMenu(const CPoint& ptPoint); void DestroyMenu(); protected: // IUOLMessengerMenuItemCallback interface virtual void OnCommand(IUOLMessengerContextMenuItem* pItem); private: void CreateContextMenu(); private: enum { SHOW_PREFERENCES_COMMAND = 15, }; CContextMenuPtr m_pMainMenu; BOOL m_bBusy; }; MAKEAUTOPTR(CPluginCustomGroupMenu);
/* * core/Defintions.h * avida-core * * Created by David on 4/17/11. * Copyright 2011 Michigan State University. All rights reserved. * http://avida.devosoft.org/ * * * This file is part of Avida. * * Avida 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 3 of the License, or (at your option) any later version. * * Avida 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 Avida. * If not, see <http://www.gnu.org/licenses/>. * * Authors: David M. Bryson <david@programerror.com> * */ #ifndef AvidaCoreDefinitions_h #define AvidaCoreDefinitions_h const int MIN_GENOME_LENGTH = 8; const int MAX_GENOME_LENGTH = 2048; const int MIN_INJECT_SIZE = 8; // Number of distinct input and outputs stored in the IOBufs (to test tasks) const int INPUT_SIZE_DEFAULT = 3; const int OUTPUT_SIZE_DEFAULT = 1; const int RECEIVED_MESSAGES_SIZE = 10; enum eFileType { FILE_TYPE_TEXT, FILE_TYPE_HTML }; enum eHARDWARE_TYPE { HARDWARE_TYPE_CPU_ORIGINAL = 0, HARDWARE_TYPE_CPU_SMT, HARDWARE_TYPE_CPU_TRANSSMT, HARDWARE_TYPE_CPU_EXPERIMENTAL, HARDWARE_TYPE_CPU_GP8, HARDWARE_TYPE_CPU_BCR, }; enum eTIMESLICE { SLICE_CONSTANT = 0, SLICE_PROB_MERIT, SLICE_INTEGRATED_MERIT, SLICE_DEME_PROB_MERIT, SLICE_PROB_DEMESIZE_PROB_MERIT, SLICE_PROB_INTEGRATED_MERIT, }; enum ePOSITION_OFFSPRING { POSITION_OFFSPRING_RANDOM = 0, POSITION_OFFSPRING_AGE, POSITION_OFFSPRING_MERIT, POSITION_OFFSPRING_EMPTY, POSITION_OFFSPRING_FULL_SOUP_RANDOM, POSITION_OFFSPRING_FULL_SOUP_ELDEST, POSITION_OFFSPRING_DEME_RANDOM, POSITION_OFFSPRING_PARENT_FACING, POSITION_OFFSPRING_NEXT_CELL, POSITION_OFFSPRING_FULL_SOUP_ENERGY_USED, POSITION_OFFSPRING_NEIGHBORHOOD_ENERGY_USED, POSITION_OFFSPRING_DISPERSAL, }; const int NUM_LOCAL_POSITION_OFFSPRING = POSITION_OFFSPRING_FULL_SOUP_RANDOM; enum eDEATH_METHOD { DEATH_METHOD_OFF = 0, DEATH_METHOD_CONST, DEATH_METHOD_MULTIPLE }; enum eALLOC_METHOD { ALLOC_METHOD_DEFAULT = 0, ALLOC_METHOD_NECRO, ALLOC_METHOD_RANDOM }; enum eDIVIDE_METHOD { DIVIDE_METHOD_OFFSPRING = 0, DIVIDE_METHOD_SPLIT, DIVIDE_METHOD_BIRTH, }; enum eEPIGENETIC_METHOD { EPIGENETIC_METHOD_NONE = 0, EPIGENETIC_METHOD_OFFSPRING, EPIGENETIC_METHOD_PARENT, EPIGENETIC_METHOD_BOTH }; enum eINJECT_METHOD { INJECT_METHOD_OFFSPRING = 0, INJECT_METHOD_SPLIT }; enum eGENERATION_INCREMENT { GENERATION_INC_OFFSPRING = 0, GENERATION_INC_BOTH }; enum eBASE_MERIT { BASE_MERIT_CONST = 0, BASE_MERIT_COPIED_SIZE, BASE_MERIT_EXE_SIZE, BASE_MERIT_FULL_SIZE, BASE_MERIT_LEAST_SIZE, BASE_MERIT_SQRT_LEAST_SIZE, BASE_MERIT_NUM_BONUS_INST, BASE_MERIT_GESTATION_TIME }; enum eINST_CODE_DEFAULT { INST_CODE_ZEROS = 0, INST_CODE_INSTNUM }; enum ePHENPLAST_BONUS_METHOD{ DEFAULT = 0, NO_BONUS, FRAC_BONUS, FULL_BONUS }; enum eDEME_TRIGGERS { DEME_TRIGGER_ALL = 0, DEME_TRIGGER_FULL, // 1 DEME_TRIGGER_CORNERS, // 2 DEME_TRIGGER_AGE, // 3 DEME_TRIGGER_BIRTHS, // 4 DEME_TRIGGER_MOVE_PREDATORS, // 5 DEME_TRIGGER_GROUP_KILL, // 6 DEME_TRIGGER_MESSAGE_PREDATORS, // 7 DEME_TRIGGER_PREDICATE, // 8 DEME_TRIGGER_PERFECT_REACTIONS, // 9 DEME_TRIGGER_CONSUME_RESOURCES, // 10 DEME_TRIGGER_UNKNOWN // 11 }; enum eSELECTION_TYPE { SELECTION_TYPE_PROPORTIONAL = 0, SELECTION_TYPE_TOURNAMENT }; enum eMP_SCHEDULING { MP_SCHEDULING_NULL = 0, MP_SCHEDULING_INTEGRATED }; enum eVerbosity { VERBOSE_SILENT = 0, // 0: No output at all VERBOSE_NORMAL, // 1: Notification at start of commands. VERBOSE_ON, // 2: Verbose output, detailing progress VERBOSE_DETAILS, // 3: High level of details, as available. VERBOSE_DEBUG // 4: Print Debug Information, as applicable. }; enum eMatingTypes { MATING_TYPE_JUVENILE = -1, MATING_TYPE_FEMALE = 0, MATING_TYPE_MALE = 1 }; enum eMatePreferences { MATE_PREFERENCE_RANDOM, MATE_PREFERENCE_HIGHEST_DISPLAY_A, MATE_PREFERENCE_HIGHEST_DISPLAY_B, MATE_PREFERENCE_HIGHEST_MERIT, MATE_PREFERENCE_LOWEST_DISPLAY_A, MATE_PREFERENCE_LOWEST_DISPLAY_B, MATE_PREFERENCE_LOWEST_MERIT }; #endif
/* * Copyright (C) 2016 Richtek Technology Corp. * * Author: TH <tsunghan_tsai@richtek.com> * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as * published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. */ #ifndef __LINUX_TCPCI_TYPEC_H #define __LINUX_TCPCI_TYPEC_H #include <linux/usb/tcpci.h> struct tcpc_device; /****************************************************************************** * Call following function to trigger TYPEC Connection State Change * * 1. H/W -> CC/PS Change. * 2. Timer -> CCDebounce or PDDebounce or others Timeout * 3. Policy Engine -> PR_SWAP, Error_Recovery, PE_Idle *****************************************************************************/ extern int tcpc_typec_enter_lpm_again( struct tcpc_device *tcpc_dev); extern int tcpc_typec_handle_cc_change( struct tcpc_device *tcpc_dev); extern int tcpc_typec_handle_ps_change( struct tcpc_device *tcpc_dev, int vbus_level); extern int tcpc_typec_handle_timeout( struct tcpc_device *tcpc_dev, uint32_t timer_id); extern int tcpc_typec_handle_vsafe0v(struct tcpc_device *tcpc_dev); extern int tcpc_typec_set_rp_level(struct tcpc_device *tcpc_dev, uint8_t res); extern int tcpc_typec_error_recovery(struct tcpc_device *tcpc_dev); extern int tcpc_typec_change_role( struct tcpc_device *tcpc_dev, uint8_t typec_role); #ifdef CONFIG_USB_POWER_DELIVERY extern int tcpc_typec_advertise_explicit_contract(struct tcpc_device *tcpc_dev); extern int tcpc_typec_handle_pe_pr_swap(struct tcpc_device *tcpc_dev); #endif /* CONFIG_USB_POWER_DELIVERY */ #ifdef CONFIG_TYPEC_CAP_ROLE_SWAP extern int tcpc_typec_swap_role(struct tcpc_device *tcpc_dev); #endif /* CONFIG_TYPEC_CAP_ROLE_SWAP */ #endif /* #ifndef __LINUX_TCPCI_TYPEC_H */
/* Copyright (c) 2008-2010 Gordon Gremme <gremme@zbh.uni-hamburg.de> Copyright (c) 2008 Center for Bioinformatics, University of Hamburg Permission to use, copy, modify, and distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies. THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ #include "core/bioseq_iterator.h" #include "core/fasta.h" #include "core/option_api.h" #include "core/outputfile.h" #include "core/ma.h" #include "core/unused_api.h" #include "extended/gtdatahelp.h" #include "extended/shredder.h" #include "tools/gt_shredder.h" typedef struct { unsigned long coverage, minlength, maxlength, overlap, width; double sample_probability; GtOutputFileInfo *ofi; GtFile *outfp; } ShredderArguments; static void* gt_shredder_arguments_new(void) { ShredderArguments *arguments = gt_calloc(1, sizeof *arguments); arguments->ofi = gt_outputfileinfo_new(); return arguments; } static void gt_shredder_arguments_delete(void *tool_arguments) { ShredderArguments *arguments = tool_arguments; if (!arguments) return; gt_file_delete(arguments->outfp); gt_outputfileinfo_delete(arguments->ofi); gt_free(arguments); } static GtOptionParser* gt_shredder_option_parser_new(void *tool_arguments) { ShredderArguments *arguments = tool_arguments; GtOptionParser *op; GtOption *o; gt_assert(arguments); op = gt_option_parser_new("[option ...] [sequence_file ...]", "Shredder sequence file(s) into consecutive pieces " "of random length."); o = gt_option_new_ulong_min("coverage", "set the number of times the " "sequence_file is shreddered", &arguments->coverage, 1, 1); gt_option_parser_add_option(op, o); o = gt_option_new_ulong("minlength", "set the minimum length of the shreddered " "fragments", &arguments->minlength, 300); gt_option_parser_add_option(op, o); o = gt_option_new_ulong("maxlength", "set the maximum length of the shreddered " "fragments", &arguments->maxlength, 700); gt_option_parser_add_option(op, o); o = gt_option_new_ulong("overlap", "set the overlap between consecutive " "pieces", &arguments->overlap, 0); gt_option_parser_add_option(op, o); o = gt_option_new_probability("sample", "take samples of the generated " "sequences pieces with the given probability", &arguments->sample_probability, 1.0); gt_option_parser_add_option(op, o); o = gt_option_new_width(&arguments->width); gt_option_parser_add_option(op, o); gt_outputfile_register_options(op, &arguments->outfp, arguments->ofi); gt_option_parser_set_comment_func(op, gt_gtdata_show_help, NULL); return op; } static int gt_shredder_arguments_check(GT_UNUSED int rest_argc, void *tool_arguments, GtError *err) { ShredderArguments *arguments = tool_arguments; gt_error_check(err); gt_assert(arguments); if (arguments->minlength > arguments->maxlength) { gt_error_set(err, "-minlength must be <= than -maxlength"); return -1; } return 0; } static int gt_shredder_runner(GT_UNUSED int argc, const char **argv, int parsed_args, void *tool_arguments, GtError *err) { ShredderArguments *arguments = tool_arguments; GtBioseqIterator *bsi; unsigned long i; GtBioseq *bioseq; int had_err; GtStr *desc; gt_error_check(err); gt_assert(arguments); /* init */ desc = gt_str_new(); bsi = gt_bioseq_iterator_new(argc - parsed_args, argv + parsed_args); /* shredder */ while (!(had_err = gt_bioseq_iterator_next(bsi, &bioseq, err)) && bioseq) { for (i = 0; i < arguments->coverage; i++) { GtShredder *shredder; unsigned long fragment_length; const char *fragment; shredder = gt_shredder_new(bioseq, arguments->minlength, arguments->maxlength); gt_shredder_set_overlap(shredder, arguments->overlap); gt_shredder_set_sample_probability(shredder, arguments->sample_probability); while ((fragment = gt_shredder_shred(shredder, &fragment_length, desc))) { gt_str_append_cstr(desc, " [shreddered fragment]"); gt_fasta_show_entry(gt_str_get(desc), fragment, fragment_length, arguments->width, arguments->outfp); } gt_shredder_delete(shredder); } gt_bioseq_delete(bioseq); } /* free */ gt_bioseq_iterator_delete(bsi); gt_str_delete(desc); return had_err; } GtTool* gt_shredder(void) { return gt_tool_new(gt_shredder_arguments_new, gt_shredder_arguments_delete, gt_shredder_option_parser_new, gt_shredder_arguments_check, gt_shredder_runner); }
/*************************************************************************** qgssearchquerybuilder.h - Query builder for search strings ---------------------- begin : March 2006 copyright : (C) 2006 by Martin Dobias email : wonder.sk at gmail dot com *************************************************************************** * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * ***************************************************************************/ #ifndef QGSSEARCHQUERYBUILDER_H #define QGSSEARCHQUERYBUILDER_H #include <map> #include <vector> #include <QStandardItemModel> #include <QModelIndex> #include "ui_qgsquerybuilderbase.h" #include "qgsguiutils.h" #include "qgscontexthelp.h" #include "qgis_gui.h" class QgsField; class QgsVectorLayer; /** \ingroup gui * \class QgsSearchQueryBuilder * \brief Query Builder for search strings */ class GUI_EXPORT QgsSearchQueryBuilder : public QDialog, private Ui::QgsQueryBuilderBase { Q_OBJECT public: //! Constructor - takes pointer to vector layer as a parameter QgsSearchQueryBuilder( QgsVectorLayer *layer, QWidget *parent = nullptr, Qt::WindowFlags fl = QgsGuiUtils::ModalDialogFlags ); //! returns newly created search string QString searchString(); //! change search string shown in text field void setSearchString( const QString &searchString ); public slots: void on_btnEqual_clicked(); void on_btnOk_clicked(); void on_btnLessThan_clicked(); void on_btnGreaterThan_clicked(); void on_btnLike_clicked(); void on_btnILike_clicked(); void on_btnPct_clicked(); void on_btnIn_clicked(); void on_btnNotIn_clicked(); void on_lstFields_doubleClicked( const QModelIndex &index ); void on_lstValues_doubleClicked( const QModelIndex &index ); void on_btnLessEqual_clicked(); void on_btnGreaterEqual_clicked(); void on_btnNotEqual_clicked(); void on_btnAnd_clicked(); void on_btnNot_clicked(); void on_btnOr_clicked(); void on_btnClear_clicked(); /** Test the constructed search string to see if it's correct. * The number of rows that would be returned is displayed in a message box. */ void on_btnTest_clicked(); /** * Get all distinct values for the field. Values are inserted * into the value list box */ void on_btnGetAllValues_clicked(); /** * Get sample distinct values for the selected field. The sample size is * limited to an arbitrary value (currently set to 25). The values * are inserted into the values list box. */ void on_btnSampleValues_clicked(); void on_buttonBox_helpRequested() { QgsContextHelp::run( metaObject()->className() ); } void saveQuery(); void loadQuery(); private: /** * Populate the field list for the selected table */ void populateFields(); /** * Setup models for listviews */ void setupListViews(); /** Get the number of records that would be returned by the current SQL * \returns Number of records or -1 if an error was encountered */ long countRecords( const QString &sql ); /** * populates list box with values of selected field * \param limit if not zero, inserts only this count of values */ void getFieldValues( int limit ); private: //! Layer for which is the query builder opened QgsVectorLayer *mLayer = nullptr; //! Map that holds field information, keyed by field name QMap<QString, int> mFieldMap; //! Model for fields ListView QStandardItemModel *mModelFields = nullptr; //! Model for values ListView QStandardItemModel *mModelValues = nullptr; }; #endif //QGSSEARCHQUERYBUILDER_H
#ifndef GLUT_KEY_H_ #define GLUT_KEY_H_ #define GLUT_KEY_ENTER 13 #define GLUT_KEY_ESC 27 #define GLUT_KEY_SPACE 32 #define GLUT_KEY_BACKSPACE 8 #define GLUT_KEY_COMMA 44 #define GLUT_KEY_DOT 46 #define GLUT_KEY_HIPHEN 45 #define GLUT_KEY_A 97 #define GLUT_KEY_B 98 #define GLUT_KEY_C 99 #define GLUT_KEY_D 100 #define GLUT_KEY_E 101 #define GLUT_KEY_F 102 #define GLUT_KEY_G 103 #define GLUT_KEY_H 104 #define GLUT_KEY_I 105 #define GLUT_KEY_J 106 #define GLUT_KEY_K 107 #define GLUT_KEY_L 108 #define GLUT_KEY_M 109 #define GLUT_KEY_N 110 #define GLUT_KEY_O 111 #define GLUT_KEY_P 112 #define GLUT_KEY_Q 113 #define GLUT_KEY_R 114 #define GLUT_KEY_S 115 #define GLUT_KEY_T 116 #define GLUT_KEY_U 117 #define GLUT_KEY_V 118 #define GLUT_KEY_W 119 #define GLUT_KEY_X 120 #define GLUT_KEY_Y 121 #define GLUT_KEY_Z 122 #define GLUT_KEY_0 48 #define GLUT_KEY_1 49 #define GLUT_KEY_2 50 #define GLUT_KEY_3 51 #define GLUT_KEY_4 52 #define GLUT_KEY_5 53 #define GLUT_KEY_6 54 #define GLUT_KEY_7 55 #define GLUT_KEY_8 56 #define GLUT_KEY_9 57 #endif
#ifndef OCEANBASE_OBSQL_SERVER_STATS_H #define OCEANBASE_OBSQL_SERVER_STATS_H #include <set> #include <vector> #include <string> #include "common/ob_define.h" #include "common/ob_statistics.h" #include "stats.h" #include "client_rpc.h" namespace sb { namespace obsql { struct Present { public: enum { PerSecond = 1, Ratio, ShowCurrent, }; static const int32_t SERVER_COUNT = 5; struct Item { std::string name; int32_t width; // width of showing console int32_t calc_type; // need divide by interval? Item(const std::string& n, const int32_t w, const int32_t stat) : name(n), width(w), calc_type(stat) {} }; typedef std::vector<Item> ServerInfo; const ServerInfo& get_server_info(const int32_t server_type) const; public: Present(); void init(); private: ServerInfo server_info_[SERVER_COUNT]; }; // dataserver Access Stat. Info class ObServerStats : public Stats { public: struct Store { sb::common::ObStatManager current; sb::common::ObStatManager prev; sb::common::ObStatManager diff; }; public: explicit ObServerStats(ObClientServerStub& stub, const int64_t server_type) : rpc_stub_(stub), show_date_(1) { store_.current.set_server_type(server_type); store_.prev.set_server_type(server_type); store_.diff.set_server_type(server_type); } virtual ~ObServerStats() {} void add_index_filter(const uint32_t index) { index_filter_.push_back(index); } void add_table_filter(const uint64_t table) { table_filter_.insert(table); } void set_show_date(const int32_t date) { show_date_ = date; } void clear_table_filter() { table_filter_.clear(); } void clear_index_filter() { index_filter_.clear(); } public: virtual int32_t output(const int32_t interval); virtual int32_t init(); protected: virtual int32_t calc() ; virtual int32_t save() ; virtual int32_t refresh(const sb::common::ObServer* remote_server) ; private: void output_header(); int calc_hit_ratio(sb::common::ObStat& stat_item, const int ratio, const int hit, const int miss); int calc_div_value(sb::common::ObStat& stat_item, const int div, const int time, const int count); int32_t print_item(const Present::ServerInfo& server_info, sb::common::ObStatManager::const_iterator it, const uint32_t index, const int32_t interval) const; protected: ObClientServerStub& rpc_stub_; std::vector<uint32_t> index_filter_; std::set<uint64_t> table_filter_; int32_t show_date_; Store store_; Present present_; }; } } #endif //OCEANBASE_OBSQL_SERVER_STATS_H
/* * This file is part of the KDE project * * Copyright (c) Michael Thaler <michael.thaler@physik.tu-muenchen.de> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifndef _KIS_SOBEL_FILTER_H_ #define _KIS_SOBEL_FILTER_H_ #include "filter/kis_filter.h" #include "kis_config_widget.h" class KisSobelFilter : public KisFilter { public: KisSobelFilter(); public: using KisFilter::process; void process(KisPaintDeviceSP device, const QRect& applyRect, const KisFilterConfiguration* config, KoUpdater* progressUpdater ) const; static inline KoID id() { return KoID("sobel", i18n("Sobel")); } public: virtual KisConfigWidget * createConfigurationWidget(QWidget* parent, const KisPaintDeviceSP dev) const; private: void prepareRow(const KisPaintDeviceSP src, quint8* data, quint32 x, quint32 y, quint32 w, quint32 h) const; }; #endif
#include "ymx2d.h" #ifndef YMX2D_FUNCTION_CLASS_FORM_H #define YMX2D_FUNCTION_CLASS_FORM_H enum YMX2D_API YMXBUTTON_STATE { YMXBUTTON_NORMAL = 0, YMXBUTTON_PRESSED = 1, YMXBUTTON_MOUSEOVER = 2, YMXBUTTON_DISABLED = 3 }; enum YMX2D_API YMXLISTVIEW_STATE { YMXLISTVIEW_NORMAL = 0, YMXLISTVIEW_PRESSED = 1, YMXLISTVIEW_MOUSEOVER = 2 }; class YMX2D_API YmxButton { friend YmxComponent; public: ~YmxButton(); inline void SetTextureRect(YMXBUTTON_STATE state, YMXRECT& rect); inline const YMXRECT& GetTextureRect(YMXBUTTON_STATE state); inline void SetTexture(LPYMXTEXTURE pTexture); inline LPYMXTEXTURE GetTexture(); inline void SetFont(LPYMXFONT pFont); inline void SetTextColor(YMXCOLOR color); inline LPYMXFONT GetFont(); inline YMXCOLOR GetTextColor(); inline void SetText(PCTSTR text); inline PCTSTR GetText(); inline void SetZ(float z); inline float GetZ(); bool Update(float delta); void Render(YmxGraphics* g); inline void SetPosition(float x, float y); inline YMXPOINT GetPosition(); inline float GetWidth(); inline float GetHeight(); inline void SetVisible(bool visible); inline void SetEnabled(bool enabled); inline bool IsVisible(); inline bool IsEnabled(); void Release(); private: YmxButton(LPYMXCOMPONENT pComponent, UINT id, LPYMXTEXTURE pTexture, LPYMXFONT pFont, float x, float y); LPYMXCOMPONENT m_pComponent; UINT m_id; LPYMXTEXTURE m_pTexture; LPYMXFONT m_pFont; TCHAR* m_pText; YMXBUTTON_STATE m_CurState; YMXRECT m_TextureRects[4]; float m_z; YMXPOINT m_Pos; bool m_bVisible; YMXCOLOR m_FontColor; }; enum YMX2D_API YMX_TEXT_ALIGNMENT { TEXT_ALIGNMENT_LEFT, TEXT_ALIGNMENT_RIGHT, TEXT_ALIGNMENT_CENTER }; class YMX2D_API YmxListView { friend YmxComponent; struct YmxListViewItem { PTSTR text; YMXLISTVIEW_STATE state; YmxListViewItem* next; }; public: ~YmxListView(); inline void SetTextureRect(YMXLISTVIEW_STATE state, YMXRECT& rect); inline const YMXRECT& GetTextureRect(YMXLISTVIEW_STATE state); inline void SetTextColor(YMXLISTVIEW_STATE state, YMXCOLOR color); inline YMXCOLOR GetTextColor(YMXLISTVIEW_STATE state); inline void SetTexture(LPYMXTEXTURE pTexture); inline LPYMXTEXTURE GetTexture(); inline void SetItemSize(float width, float height); inline void GetItemSize(float* width, float* height); inline void SetFont(LPYMXFONT pFont); inline LPYMXFONT GetFont(); inline void SetZ(float z); inline float GetZ(); bool Update(float delta); inline void SetPosition(float x, float y); inline YMXPOINT GetPosition(); void Render(YmxGraphics* g); inline void AddItem(PCTSTR text); inline void RemoveItem(int index); inline void SetTextAlignment(YMX_TEXT_ALIGNMENT); inline void EnableKeyboard(bool); inline void EnableMouse(bool); inline void SetFocusItem(int index); inline int GetFocusItem(); inline void SetConfirmKey(int key); inline int GetConfirmKey(); inline void SetUpKey(int key); inline int GetUpKey(); inline void SetDownKey(int key); inline int GetDownKey(); inline void SetVisible(bool); inline bool IsVisible(); inline void Release(); private: YmxListView(LPYMXCOMPONENT, UINT id, LPYMXTEXTURE, LPYMXFONT, float x, float y); LPYMXCOMPONENT m_pComponent; UINT m_id; LPYMXTEXTURE m_pTexture; LPYMXFONT m_pFont; YmxListViewItem* m_Items; int m_ItemCount; float m_z; YMXPOINT m_Pos; YMXRECT m_TextureRects[3]; YMXCOLOR m_FontColors[3]; float m_ItemWidth; float m_ItemHeight; bool m_KeyboardEnabled; bool m_MouseEnabled; int m_ConfirmKey; int m_UpKey; int m_DownKey; bool m_bVisible; YMX_TEXT_ALIGNMENT m_TextAlignment; }; enum YMX2D_API YMXEDITTEXT_CURSOR_STYLE { YMXEDITTEXT_CURSOR_VERTICAL, YMXEDITTEXT_CURSOR_HORIZONTAL, YMXEDITTEXT_CURSOR_NONE }; class YMX2D_API YmxEditText { friend YmxComponent; public: ~YmxEditText(); inline void SetZ(float z); inline float GetZ(); inline void SetFont(LPYMXFONT pFont); inline LPYMXFONT GetFont(); inline void SetTextColor(YMXCOLOR color); inline YMXCOLOR GetTextColor(); bool Update(float delta); inline void SetPosition(float x, float y); inline YMXPOINT GetPosition(); void Render(YmxGraphics* g); inline void SetTextAlignment(YMX_TEXT_ALIGNMENT); inline void SetVisible(bool visible); inline bool IsVisible(); void Release(); inline PCTSTR GetText(); inline void SetText(PCTSTR str); inline void SetCursorColor(YMXCOLOR color); inline void SetCursorThickness(float thickness); inline void SetCursorStyle(YMXEDITTEXT_CURSOR_STYLE); inline void SetCursorBlink(bool blinking); inline void SetCursorBlinkFreq(float freq); inline void SetFocus(bool focus); inline bool IsFocused(); inline void SetConfirmKey(int key); inline int GetConfirmKey(); private: YmxEditText(LPYMXCOMPONENT, UINT id, LPYMXFONT, float x, float y); inline void _AppendChar(TCHAR c); inline void _RenderCursor(YmxGraphics* g); inline float _GetCursorPosX(); LPYMXCOMPONENT m_pComponent; UINT m_id; LPYMXFONT m_pFont; float m_z; YMXPOINT m_Pos; YMXRECT m_TextureRects[5]; YMX_TEXT_ALIGNMENT m_TextAlignment; bool m_bVisible; bool m_bFocused; TCHAR* m_pText; int m_TextBufSize; int m_TextLength; int m_CursorThickness; bool m_bCursorVertical; YMXCOLOR m_CursorColor; YMXCOLOR m_FontColor; YMXEDITTEXT_CURSOR_STYLE m_CursorOrientation; bool m_bCursorBlink; float m_CursorBlinkInterval; float m_timeSinceCursorAppear; bool m_bCursorAppearNow; int m_ConfirmKey; }; #endif
#include "Sensor.h" #include <Wire.h> class pHSensor : public Sensor { public: static const int id = 5; char* getName(); pHSensor(byte port, byte address, byte powerPortNo); void setup(); void measure(int* data); private: int address; Port powerPort; };
/* * This is a DIDS (Duplicate Image Detection System) helper module. * This module provides a linked list of PPMs. * Please see the README file for further details. * * Copyright (C) 2000-2021 Michael John Bruins, BSc. * * 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 <stdio.h> #include <stdlib.h> #include <string.h> #include "ppm.h" /* * build a PicInfo object and assign the properties. * Note: external_ref is used as passed, not duplicated. */ PicInfo *PicInfoBuild(char *external_ref, PPM_Info *pic, Similar_but_different *similar_but_different) { PicInfo *hlp = (PicInfo *) malloc(sizeof(PicInfo)); if (!hlp) { return NULL; } hlp->external_ref = external_ref; hlp->picinf = pic; hlp->similar_but_different = similar_but_different; return hlp; } /* * Delete a PicInfo object and similiar_but_different details. */ void PicInfoDelete(PicInfo *hlp) { if (!hlp) { return; } Similar_but_different *similar_but_different = hlp->similar_but_different; Similar_but_different *last_similar_but_different = NULL; while (similar_but_different) { last_similar_but_different = similar_but_different; similar_but_different = last_similar_but_different->next; free(last_similar_but_different); } if (hlp->picinf) { ppm_info_free(hlp->picinf); } free(hlp); } /* * add the picture info to the linked list. * Linked list is sorted in order of assending external_ref. * * Example: * AddToList(list, external_ref, picinfo); * */ // TODO insert to form a sorted list // TODO We need to avoid searching through the entire list each time we insert. // TODO Can we do something smart with the return value so we are always // adding the the end of the list ? // E.g. return the end of the list so that we can insert at the end. void PicInfoAddToList(PicInfo **list_ref, PicInfo *picinfo_new) { // Insert so that external_ref strings are in ascending order. // Is the list empty? if (*list_ref == NULL) { *list_ref = picinfo_new; picinfo_new->next = NULL; return; } // Find the point in the chain where we need to insert this link. char *external_ref_new = picinfo_new->external_ref; PicInfo *ptr = *list_ref; PicInfo *last_ptr = NULL; while (ptr && strcmp(ptr->external_ref, external_ref_new) < 0) { last_ptr = ptr; ptr = ptr->next; } // insert at start if (last_ptr == NULL){ picinfo_new->next = *list_ref; *list_ref = picinfo_new; } // insert at last_ptr else { last_ptr->next = picinfo_new; picinfo_new->next = ptr; } } /* * delete the PicInfo from list. * * PicInfoDelFromList(sock_fh, list, external_ref); * * Note: Will free the memory of the PicInfo it Deletes * * return * 0 - success * 1 - failed to find PicInfo with external_ref * */ int PicInfoDeleteFromList(PicInfo **list_ref, char *external_ref) { // Find the point in the chain where we need to insert this link. PicInfo *ptr = *list_ref; PicInfo *last_ptr = NULL; while (ptr && strcmp( ptr->external_ref, external_ref ) < 0) { last_ptr = ptr; ptr = ptr->next; } // Check to see if we fell off the end if (!ptr) { return 1; } // Wasn't in list. We went past where it should be if (strcmp(ptr->external_ref, external_ref) ) { return 2; } // At this point we have found link to delete // Check if it is the first link if (last_ptr) { last_ptr->next = ptr->next; } else { // update head if removed link was first link in list. *list_ref = ptr->next; } // Free the memory PicInfoDelete(ptr); return 0; } /* * add the external ref of the 'similar but different' */ // Similar_but_different *similar_but_different;
/// /// \file ClickImage.h /// Clickable image class /// /* Copyright (C) 2009-2013, Net Direct Inc. (http://www.netdirect.ca/) This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. 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 in the COPYING file at the root directory of this project for more details. */ #ifndef __BARRYDESKTOP_CLICKIMAGE_H__ #define __BARRYDESKTOP_CLICKIMAGE_H__ #include <wx/wx.h> class ClickableImage { wxWindow *m_parent; int m_id; wxBitmap m_image; int m_x, m_y; bool m_focus; bool m_event_on_up; wxCursor m_hover_cursor; protected: bool CalculateHit(int x, int y); public: ClickableImage(wxWindow *parent, const wxBitmap &image, int ID, int x, int y, bool event_on_up = true, const wxCursor &hover = wxCursor(wxCURSOR_HAND)); void Draw(wxDC &dc); void HandleMotion(wxDC &dc, int x, int y); void HandleDown(wxDC &dc, int x, int y); void HandleUp(wxDC &dc, int x, int y); }; #endif
/* * This file is part of libdvdnav, a DVD navigation library. * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU Lesser General Public License as published by * the Free Software Foundation; either version 2.1 of the License, or * (at your option) any later version. * * This 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 Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser 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 <stdarg.h> #include "dvdnav/dvdnav.h" #include "logger.h" void dvdnav_log( void *priv, const dvdnav_logger_cb *logcb, dvdnav_logger_level_t level, const char *fmt, ... ) { va_list list; va_start(list, fmt); if(logcb && logcb->pf_log) logcb->pf_log(priv, level, fmt, list); else { FILE *stream = (level == DVDNAV_LOGGER_LEVEL_ERROR) ? stderr : stdout; fprintf(stream, "libdvdnav: "); vfprintf(stream, fmt, list); fprintf(stream, "\n"); } va_end(list); }
/* $XConsortium: AuUnlock.c,v 1.10 94/04/17 20:15:44 rws Exp $ */ /* Copyright (c) 1988 X Consortium 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 X CONSORTIUM 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. Except as contained in this notice, the name of the X Consortium shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from the X Consortium. */ #include <X11/Xauth.h> #include <X11/Xos.h> int #if NeedFunctionPrototypes XauUnlockAuth ( _Xconst char *file_name) #else XauUnlockAuth (file_name) char *file_name; #endif { #ifndef WIN32 char creat_name[1025]; #endif char link_name[1025]; if (strlen (file_name) > 1022) return 0; #ifndef WIN32 (void) strcpy (creat_name, file_name); (void) strcat (creat_name, "-c"); #endif (void) strcpy (link_name, file_name); (void) strcat (link_name, "-l"); /* * I think this is the correct order */ #ifndef WIN32 (void) unlink (creat_name); #endif (void) unlink (link_name); return 0; }
/* SPDX-License-Identifier: GPL-2.0-only */ /* * This file is created based on Intel Alder Lake Processor CPU Datasheet * Document number: 619501 * Chapter number: 14 */ #include <console/console.h> #include <device/pci.h> #include <device/pci_ids.h> #include <cpu/x86/lapic.h> #include <cpu/x86/mp.h> #include <cpu/x86/msr.h> #include <cpu/intel/smm_reloc.h> #include <cpu/intel/turbo.h> #include <cpu/intel/common/common.h> #include <fsp/api.h> #include <intelblocks/cpulib.h> #include <intelblocks/mp_init.h> #include <intelblocks/msr.h> #include <soc/cpu.h> #include <soc/msr.h> #include <soc/pci_devs.h> #include <soc/soc_chip.h> static void soc_fsp_load(void) { fsps_load(); } static void configure_misc(void) { msr_t msr; config_t *conf = config_of_soc(); msr = rdmsr(IA32_MISC_ENABLE); msr.lo |= (1 << 0); /* Fast String enable */ msr.lo |= (1 << 3); /* TM1/TM2/EMTTM enable */ wrmsr(IA32_MISC_ENABLE, msr); /* Set EIST status */ cpu_set_eist(conf->eist_enable); /* Disable Thermal interrupts */ msr.lo = 0; msr.hi = 0; wrmsr(IA32_THERM_INTERRUPT, msr); /* Enable package critical interrupt only */ msr.lo = 1 << 4; msr.hi = 0; wrmsr(IA32_PACKAGE_THERM_INTERRUPT, msr); /* Enable PROCHOT */ msr = rdmsr(MSR_POWER_CTL); msr.lo |= (1 << 0); /* Enable Bi-directional PROCHOT as an input*/ msr.lo |= (1 << 23); /* Lock it */ wrmsr(MSR_POWER_CTL, msr); } /* All CPUs including BSP will run the following function. */ void soc_core_init(struct device *cpu) { /* Clear out pending MCEs */ /* TODO(adurbin): This should only be done on a cold boot. Also, some * of these banks are core vs package scope. For now every CPU clears * every bank. */ mca_configure(); /* Enable the local CPU apics */ enable_lapic_tpr(); setup_lapic(); /* Configure Enhanced SpeedStep and Thermal Sensors */ configure_misc(); enable_pm_timer_emulation(); /* Enable Direct Cache Access */ configure_dca_cap(); /* Set energy policy */ set_energy_perf_bias(ENERGY_POLICY_NORMAL); /* Enable Turbo */ enable_turbo(); } static void per_cpu_smm_trigger(void) { /* Relocate the SMM handler. */ smm_relocate(); } static void post_mp_init(void) { /* Set Max Ratio */ cpu_set_max_ratio(); /* * 1. Now that all APs have been relocated as well as the BSP let SMIs * start flowing. * 2. Skip enabling power button SMI and enable it after BS_CHIPS_INIT * to avoid shutdown hang due to lack of init on certain IP in FSP-S. */ global_smi_enable_no_pwrbtn(); } static const struct mp_ops mp_ops = { /* * Skip Pre MP init MTRR programming as MTRRs are mirrored from BSP, * that are set prior to ramstage. * Real MTRRs programming are being done after resource allocation. */ .pre_mp_init = soc_fsp_load, .get_cpu_count = get_cpu_count, .get_smm_info = smm_info, .get_microcode_info = get_microcode_info, .pre_mp_smm_init = smm_initialize, .per_cpu_smm_trigger = per_cpu_smm_trigger, .relocation_handler = smm_relocation_handler, .post_mp_init = post_mp_init, }; void soc_init_cpus(struct bus *cpu_bus) { if (mp_init_with_smm(cpu_bus, &mp_ops)) printk(BIOS_ERR, "MP initialization failure.\n"); /* Thermal throttle activation offset */ configure_tcc_thermal_target(); } enum adl_cpu_type get_adl_cpu_type(void) { const uint16_t adl_m_mch_ids[] = { PCI_DEVICE_ID_INTEL_ADL_M_ID_1, PCI_DEVICE_ID_INTEL_ADL_M_ID_2, }; const uint16_t adl_p_mch_ids[] = { PCI_DEVICE_ID_INTEL_ADL_P_ID_1, PCI_DEVICE_ID_INTEL_ADL_P_ID_3, PCI_DEVICE_ID_INTEL_ADL_P_ID_4, PCI_DEVICE_ID_INTEL_ADL_P_ID_5, PCI_DEVICE_ID_INTEL_ADL_P_ID_6, PCI_DEVICE_ID_INTEL_ADL_P_ID_7, PCI_DEVICE_ID_INTEL_ADL_P_ID_8, PCI_DEVICE_ID_INTEL_ADL_P_ID_9, }; const uint16_t adl_s_mch_ids[] = { PCI_DEVICE_ID_INTEL_ADL_S_ID_1, PCI_DEVICE_ID_INTEL_ADL_S_ID_2, PCI_DEVICE_ID_INTEL_ADL_S_ID_3, PCI_DEVICE_ID_INTEL_ADL_S_ID_4, PCI_DEVICE_ID_INTEL_ADL_S_ID_5, PCI_DEVICE_ID_INTEL_ADL_S_ID_6, PCI_DEVICE_ID_INTEL_ADL_S_ID_7, PCI_DEVICE_ID_INTEL_ADL_S_ID_8, PCI_DEVICE_ID_INTEL_ADL_S_ID_9, PCI_DEVICE_ID_INTEL_ADL_S_ID_10, PCI_DEVICE_ID_INTEL_ADL_S_ID_11, PCI_DEVICE_ID_INTEL_ADL_S_ID_12, PCI_DEVICE_ID_INTEL_ADL_S_ID_13, PCI_DEVICE_ID_INTEL_ADL_S_ID_14, PCI_DEVICE_ID_INTEL_ADL_S_ID_15, }; const uint16_t mchid = pci_s_read_config16(PCI_DEV(0, PCI_SLOT(SA_DEVFN_ROOT), PCI_FUNC(SA_DEVFN_ROOT)), PCI_DEVICE_ID); for (size_t i = 0; i < ARRAY_SIZE(adl_p_mch_ids); i++) { if (adl_p_mch_ids[i] == mchid) return ADL_P; } for (size_t i = 0; i < ARRAY_SIZE(adl_m_mch_ids); i++) { if (adl_m_mch_ids[i] == mchid) return ADL_M; } for (size_t i = 0; i < ARRAY_SIZE(adl_s_mch_ids); i++) { if (adl_s_mch_ids[i] == mchid) return ADL_S; } return ADL_UNKNOWN; } uint8_t get_supported_lpm_mask(void) { enum adl_cpu_type type = get_adl_cpu_type(); switch (type) { case ADL_M: /* fallthrough */ case ADL_P: return LPM_S0i2_0 | LPM_S0i3_0; case ADL_S: return LPM_S0i2_0 | LPM_S0i2_1; default: printk(BIOS_ERR, "Unknown ADL CPU type: %d\n", type); return 0; } }
/* Copyright (c) 2007 Gordon Gremme <gremme@zbh.uni-hamburg.de> Copyright (c) 2007 Center for Bioinformatics, University of Hamburg Permission to use, copy, modify, and distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies. THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ #ifndef TRANSCRIPT_USED_EXONS_H #define TRANSCRIPT_USED_EXONS_H #include "core/dlist.h" typedef struct GtTranscriptUsedExons GtTranscriptUsedExons; GtTranscriptUsedExons* gt_transcript_used_exons_new(void); GtDlist* gt_transcript_used_exons_get_all(GtTranscriptUsedExons*); GtDlist* gt_transcript_used_exons_get_single(GtTranscriptUsedExons*); GtDlist* gt_transcript_used_exons_get_initial(GtTranscriptUsedExons*); GtDlist* gt_transcript_used_exons_get_internal(GtTranscriptUsedExons*); GtDlist* gt_transcript_used_exons_get_terminal(GtTranscriptUsedExons*); void gt_transcript_used_exons_delete(GtTranscriptUsedExons*); #endif
/**************************************************************************** ** $Id: qpolygonscanner.h 69 2006-03-18 18:13:09Z dmik $ ** ** Definition of QPolygonScanner class ** ** Created : 000120 ** ** Copyright (C) 1999-2000 Trolltech AS. All rights reserved. ** ** This file is part of the kernel module of the Qt GUI Toolkit. ** ** This file may be distributed under the terms of the Q Public License ** as defined by Trolltech AS of Norway and appearing in the file ** LICENSE.QPL included in the packaging of this file. ** ** This file may be distributed and/or modified under the terms of the ** GNU General Public License version 2 as published by the Free Software ** Foundation and appearing in the file LICENSE.GPL included in the ** packaging of this file. ** ** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition ** licenses may use this file in accordance with the Qt Commercial License ** Agreement provided with the Software. ** ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. ** ** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for ** information about Qt Commercial License Agreements. ** See http://www.trolltech.com/qpl/ for QPL licensing information. ** See http://www.trolltech.com/gpl/ for GPL licensing information. ** ** Contact info@trolltech.com if any conditions of this licensing are ** not clear to you. ** **********************************************************************/ #ifndef QPOLYGONSCANNER_H #define QPOLYGONSCANNER_H #ifndef QT_H #include "qglobal.h" #endif // QT_H class QPointArray; class QPoint; class Q_EXPORT QPolygonScanner { public: // BIC: fix for 3.0 void scan( const QPointArray& pa, bool winding, int index=0, int npoints=-1 ); void scan( const QPointArray& pa, bool winding, int index, int npoints, bool stitchable ); enum Edge { Left=1, Right=2, Top=4, Bottom=8 }; void scan( const QPointArray& pa, bool winding, int index, int npoints, Edge edges ); virtual void processSpans( int n, QPoint* point, int* width )=0; }; #endif // QPOLYGONSCANNER_H
/*************************************************************************** * Copyright (C) 2011 by Ralf Kaestner * * ralf.kaestner@gmail.com * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * ***************************************************************************/ #ifndef LOG_WRITER_H #define LOG_WRITER_H /** Abstract log writer definition * @author Ralf Kaestner ETHZ Autonomous Systems Lab. */ #include "morsel/morsel.h" #include "morsel/utils/gzfstream.h" #include <nodePath.h> class LogWriter : public NodePath { PUBLISHED: /** Constructors */ LogWriter(std::string name, bool binary = true, std::string placeholder = "%"); /** Destructor */ virtual ~LogWriter(); const std::string& getLogFilename() const; std::ostream& getStream(); bool isOpen() const; bool open(std::string filename); bool open(std::string filename, double timestamp); void close(); void flush(); public: LogWriter& operator<<(char value); LogWriter& operator<<(bool value); LogWriter& operator<<(unsigned char value); LogWriter& operator<<(int value); LogWriter& operator<<(unsigned int value); LogWriter& operator<<(long value); LogWriter& operator<<(unsigned long value); LogWriter& operator<<(float value); LogWriter& operator<<(double value); LogWriter& operator<<(const char* value); LogWriter& operator<<(const std::string& value); virtual void writeHeader(); protected: std::string logFilename; bool binary; std::string placeholder; std::ofstream logFile; gzofstream logFileGz; }; #endif
/* * LSAPIC Interrupt Controller * * This takes care of interrupts that are generated by the CPU's * internal Streamlined Advanced Programmable Interrupt Controller * (LSAPIC), such as the ITC and IPI interrupts. * * Copyright (C) 1999 VA Linux Systems * Copyright (C) 1999 Walt Drummond <drummond@valinux.com> * Copyright (C) 2000 Hewlett-Packard Co * Copyright (C) 2000 David Mosberger-Tang <davidm@hpl.hp.com> */ #include <linux/sched.h> #include <linux/irq.h> static unsigned int <<<<<<< HEAD lsapic_noop_startup (struct irq_data *data) ======= lsapic_noop_startup (unsigned int irq) >>>>>>> 296c66da8a02d52243f45b80521febece5ed498a { return 0; } static void <<<<<<< HEAD lsapic_noop (struct irq_data *data) ======= lsapic_noop (unsigned int irq) >>>>>>> 296c66da8a02d52243f45b80521febece5ed498a { /* nothing to do... */ } <<<<<<< HEAD static int lsapic_retrigger(struct irq_data *data) { ia64_resend_irq(data->irq); ======= static int lsapic_retrigger(unsigned int irq) { ia64_resend_irq(irq); >>>>>>> 296c66da8a02d52243f45b80521febece5ed498a return 1; } struct irq_chip irq_type_ia64_lsapic = { <<<<<<< HEAD .name = "LSAPIC", .irq_startup = lsapic_noop_startup, .irq_shutdown = lsapic_noop, .irq_enable = lsapic_noop, .irq_disable = lsapic_noop, .irq_ack = lsapic_noop, .irq_retrigger = lsapic_retrigger, ======= .name = "LSAPIC", .startup = lsapic_noop_startup, .shutdown = lsapic_noop, .enable = lsapic_noop, .disable = lsapic_noop, .ack = lsapic_noop, .end = lsapic_noop, .retrigger = lsapic_retrigger, >>>>>>> 296c66da8a02d52243f45b80521febece5ed498a };
/* Project.h * Copyright (C) 2004 Mathieu Guindon, Julien Keable * This file is part of Drone. * * 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 PROJECT_INCLUDED #define PROJECT_INCLUDED #include <string> class QDomDocument; class QDomElement; class SchemaGui; class Project { public: Project(SchemaGui* mainSchemaGui); bool save(); bool saveAs(std::string filename); bool load(std::string filename); std::string projectName(){return _projectName;} void newProject(); protected: SchemaGui* _mainSchemaGui; std::string _projectName; }; #endif
#ifndef __KMOD_CAPWAP_PRIVATE_HEADER__ #define __KMOD_CAPWAP_PRIVATE_HEADER__ /* */ struct sc_capwap_workthread { struct task_struct* thread; struct sk_buff_head queue; wait_queue_head_t waitevent; }; /* */ int sc_capwap_init(void); void sc_capwap_close(void); /* */ int sc_capwap_connect(const union capwap_addr* sockaddr, struct sc_capwap_sessionid_element* sessionid, uint16_t mtu); void sc_capwap_resetsession(void); /* */ struct sc_capwap_session* sc_capwap_getsession(const union capwap_addr* sockaddr); /* */ int sc_capwap_sendkeepalive(void); #endif /* __KMOD_CAPWAP_PRIVATE_HEADER__ */
/* user_settings_fipsv2.h * * 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 */ /* should be renamed to user_settings.h for customer use * generated from configure options: * ./fips-check.sh linuxv2 keep * XXX-fips-test\wolfssl\options.h * * Cleaned up by David Garske */ #ifndef WOLFSSL_USER_SETTINGS_H #define WOLFSSL_USER_SETTINGS_H #ifdef __cplusplus extern "C" { #endif /* FIPS Version 3 (3389 Certificate) */ #define HAVE_FIPS #define HAVE_FIPS_VERSION 2 #define HAVE_HASHDRBG /* NIST Certified DRBG - SHA256 based */ #define HAVE_THREAD_LS /* Math */ #define USE_FAST_MATH /* Timing Resistance */ #define TFM_TIMING_RESISTANT #define ECC_TIMING_RESISTANT #define WC_RSA_BLINDING /* TLS Features */ #define WOLFSSL_TLS13 #define HAVE_TLS_EXTENSIONS #define HAVE_SUPPORTED_CURVES #define HAVE_EXTENDED_MASTER #define HAVE_ENCRYPT_THEN_MAC /* DH */ #undef NO_DH #define HAVE_FFDHE_2048 #define HAVE_FFDHE_Q #define WOLFSSL_VALIDATE_ECC_IMPORT #define WOLFSSL_VALIDATE_FFC_IMPORT #define HAVE_DH_DEFAULT_PARAMS /* ECC */ #define HAVE_ECC #define TFM_ECC256 #define ECC_SHAMIR #define HAVE_ECC_CDH /* RSA */ #undef NO_RSA #define WC_RSA_PSS #define WOLFSSL_KEY_GEN #define WC_RSA_NO_PADDING /* AES */ #define WOLFSSL_AES_DIRECT #define HAVE_AES_ECB #define HAVE_AESGCM #define GCM_TABLE_4BIT #define HAVE_AESCCM #define WOLFSSL_AES_COUNTER /* Hashing */ #undef NO_SHA #undef NO_SHA256 #define WOLFSSL_SHA224 #define WOLFSSL_SHA384 #define WOLFSSL_SHA512 #define WOLFSSL_SHA3 #define HAVE_HKDF /* Other */ #define WOLFSSL_CMAC #define WOLFSSL_BASE64_ENCODE /* Disabled Algorithms */ #define NO_DSA #define NO_MD4 #define NO_PSK #define NO_PWDBASED #define NO_RC4 #define WOLFSSL_NO_SHAKE256 #ifdef __cplusplus } #endif #endif /* WOLFSSL_OPTIONS_H */
/* * OpenVirtualization: * For additional details and support contact developer@sierraware.com. * Additional documentation can be found at www.openvirtualization.org * * Copyright (C) 2011 SierraWare * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. * * This 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. * * String manipulation routines */ #include <sw_debug.h> #include <sw_string_functions.h> #include <elf_loader.h> /** * @brief * * @param str1 * @param str2 * @param n * * @return */ int sw_strncmp(char * str1, char * str2, int n) { int index = 0; while (index < n) { if (str1[index] != str2[index]) { return -1; } index++; } return 0; } /** * @brief * * @param str * * @return */ u32 sw_strtoi(char * str) { int length = 8; int bits_in_long = 32; int index = 0; char digit_char = 0; ulong digit_int = 0; ulong ret_val = 0; while (index < length) { digit_char = str[index]; if ( (digit_char < 0x30) || (digit_char > 0x39) ) { return -1; } else { digit_int |= digit_char - 0x30; digit_int = digit_int << ( bits_in_long - ((index + 1) * 4) ); ret_val = ret_val | digit_int; } index = index + 1; } // while ends return ret_val; } /** * @brief * strlen - Find the length of a string * * @param s * * @return */ u32 sw_strlen(char * s) { char *sc; for (sc = s; *sc != '\0'; ++sc) { // do nothing } return sc - s; } /** * @brief * strcpy - Copy a NULL terminated string * * @param dest * @param src * * @return */ char * sw_strcpy(char * dest, char *src) { char *tmp = dest; while ((*dest++ = *src++) != '\0') { // do nothing } return tmp; } EXPORT_SYMBOL(sw_strcpy); /** * @brief * strcpy - Copy a NULL terminated string * * @param dest * @param src * @param n * * @return */ char * sw_strncpy(char * dest, char *src, size_t n) { if (n != 0) { char *d = dest; const char *s = src; do { if ((*d++ = *s++) == 0) { /* NUL pad the remaining n-1 bytes */ while (--n != 0) *d++ = 0; break; } } while (--n != 0); } return (dest); } /** * @brief * strcmp - compare strings * * @param s1 * @param s2 * * @return */ int sw_strcmp (const char * s1, const char * s2) { for(; *s1 == *s2; ++s1, ++s2) if(*s1 == 0) return 0; return *(unsigned char *)s1 < *(unsigned char *)s2 ? -1 : 1; } /** * @brief * * @param dest * @param src * * @return */ char *sw_strcat(char *dest, const char *src) { char *save = dest; for (; *dest; ++dest) ; while ((*dest++ = *src++) != 0) ; return (save); } /** * @brief * * @param dest * @param src * @param n * * @return */ char * sw_strncat(char * dest, const char *src, size_t n) { if (n != 0) { char *d = dest; const char *s = src; while (*d != 0) d++; do { if ((*d = *s++) == 0) break; d++; } while (--n != 0); *d = 0; } return (dest); } /** * @brief * * @param s * @param c * * @return */ char *sw_strchr(const char *s, int c) { char *ptr = (char*)s; while (*ptr != (char)c) { if(*ptr == '\0') return NULL; ptr++; } return ptr; } /** * @brief * * @param print_buffer * @param fmt * @param ... * * @return */ u32 sw_sprintf(char *print_buffer, const char *fmt, ...) { va_list args; u32 i; va_start(args, fmt); i = sw_vsprintf(print_buffer, fmt, args); va_end(args); return i; } /** * @brief * Copies the first num characters of source to destination * upto Null Terminate String Found * * @param dest - Pointer to the destination array where the content is to be * copied * @param src - string to be copied * @param n - number of characters to be copied from source * @param destLen - destination Maximum Length * @param srcLen - source Maximum Length * * @return */ char * sw_maxstrncpy(char * dest, char *src, size_t n,size_t destLen, size_t srcLen) { if(n<=destLen || n<=srcLen) { return sw_strncpy(dest,src,n); } else { sw_printf("Input count Exceeds With Source and Dest Length\n"); return NULL; } }
#define BFD_VERSION_DATE 20051116 #define BFD_VERSION @bfd_version@ #define BFD_VERSION_STRING @bfd_version_string@
#ifndef LOADDLL_H_INCLUDED #define LOADDLL_H_INCLUDED typedef HMODULE (WINAPI *PLoadLibraryW)(LPCWSTR); typedef HMODULE (WINAPI *PGetModuleHandleW)(LPCWSTR); typedef BOOL (WINAPI *PFreeLibrary)(HMODULE); typedef FARPROC (WINAPI *PGetProcAddress)(HMODULE, char*); typedef DWORD (WINAPI *PGetCurrentDirectoryW)(LPWSTR,DWORD); typedef DWORD (WINAPI *PGetLastError) ( VOID ); typedef VOID (WINAPI *PSetLastError) ( DWORD dwErrCode ); #define MARKER_BEGIN 0x19822891 #define MARKER_END 0x31415926 #define REMOTE_MAX_ARGUMENTS 8 struct RemoteDllThreadBlock { DWORD MarkerBegin; DWORD ErrorLoad; // error value for LoadLibrary DWORD ErrorFunction; // error value for executed function DWORD ReturnCodeForFunction; // error value for executed function DWORD ErrorFree; // error value for FreeLibrary DWORD LastError; HMODULE hModule; BOOL bLoadLibrary; BOOL bFreeLibrary; DWORD dwArgumentCount; // 0..8 DWORD Arguments[REMOTE_MAX_ARGUMENTS]; PLoadLibraryW fnLoadLibraryW; PGetModuleHandleW fnGetModuleHandleW; PFreeLibrary fnFreeLibrary; PGetProcAddress fnGetProcAddress; PGetLastError fnGetLastError; PSetLastError fnSetLastError; WCHAR lpModulePath[MAX_PATH]; // the DLL path CHAR lpFunctionName[256]; // the called function DWORD MarkerEnd; }; struct RemoteGetCurrentDirectoryThreadBlock { PGetCurrentDirectoryW fnGetCurrentDirectoryW; WCHAR lpDirectory[MAX_PATH]; DWORD dwReturnCode; }; // inject function RemoteThread() into target process DWORD ExecuteRemoteThread( HANDLE hProcess, BOOL bLoad, BOOL bFree, LPCTSTR lpDllPath, char* lpFunctionName, DWORD* pReturnCodeForFunction, LONG* pLastError, DWORD* pErrorLoad, DWORD* pErrorFunction, DWORD* pErrorFree, DWORD dwArgumentCount, DWORD* pdwArguments ); // and this is the code we are injecting DWORD __stdcall RemoteDllThread( RemoteDllThreadBlock* ); // and this is the code we are injecting DWORD __stdcall RemoteGetCurrentDirectoryThread( RemoteGetCurrentDirectoryThreadBlock* ); // That's the THING // The whole shebang makes a number of assumptions: // -- target process is a Win32 process // -- kernel32.dll loaded at same address in each process (safe) // -- bem() shorter than MAXINJECTSIZE // -- bem() does not rely on the C/C++ runtime // -- /GZ is _not_ used. (If it is, the compiler generates calls // to functions which are not injected into the target. Oops! // -- Target function uses WINAPI (pascal) call convention. DWORD LoadDllForRemoteThread( DWORD processID, BOOL bLoad, BOOL bFree, LPCTSTR lpModuleName, char* lpFunctionName, DWORD* pReturnCodeForFunction, LONG* pLastError, DWORD* pErrorLoad, DWORD* pErrorFunction, DWORD* pErrorFree, DWORD dwArgumentCount, DWORD* pdwArguments ); //DWORD RemoteGetCurrentDirectory( DWORD, LPWSTR, DWORD, DWORD* ); // Check OS DWORD IsWindowsNT(); BOOL RemoteSimpleFunction(DWORD processId, DWORD dwArgument, char* lpszFunction, DWORD* lpdwFuncRetVal); void EnableDebugPriv(void); #endif
#include <stdio.h> #include <stdlib.h> #include "pine.h" #include "data.h" #include "hiredis/hiredis.h" #include "htmlgen.h" #define mysql_fatal(mysql) do {\ uwsgi_log("(MYSQL)%s at [%s:%d]\n", mysql_error(mysql), __FILE__, __LINE__); \ abort(); \ } while (0) typedef struct { int id; ConnCtx conn; } CoreData; int not_found_404(PineRequest *req) { pr_prepare(req, 404, NULL); pr_add_content_type(req, "text/html; charset=utf-8;"); GUARD(pr_writes(req, "<h1> 404 NOT FOUND </h1>")); return PINE_OK; } int bad_request_400(PineRequest *req) { pr_prepare(req, 400, NULL); pr_add_content_type(req, "text/html; charset=utf-8;"); GUARD(pr_writes(req, "<h1> 400 BAD REQUEST </h1>")); return PINE_OK; } static bool prefix(char* s, char* pattern, char** p_out) { size_t len = strlen(pattern); if (!strncmp(s, pattern, len)) { *p_out = s + len; return true; } else { *p_out = NULL; return false; } } static bool say_no() { return false; } typedef struct { struct namugen_doc_itfc vtbl; ConnCtx *conn; char* docname_prefix; } NormalNamugenDocumentInterface; struct namugen_hook_itfc todo_hook = { .hook_fn_link = say_no, .hook_fn_call = say_no }; #include "escaper.inc" static sds nmdi_doc_href(struct namugen_doc_itfc* x, char* doc_name) { NormalNamugenDocumentInterface *nmdi = (NormalNamugenDocumentInterface *)x; sds chunk = escape_url_chunk(doc_name, false); sds ret = sdsnew(nmdi->docname_prefix); ret = sdscatsds(ret, chunk); sdsfree(chunk); return ret; } static int ok_put_plain(PineRequest *req, sds html) { GUARD(pr_prepare(req, 200, NULL)); GUARD(pr_add_content_type(req, "text/plain; charset=utf-8")); GUARD(pr_write(req, html, sdslen(html))); return PINE_OK; } static int ok_put_html(PineRequest *req, sds html) { GUARD(pr_prepare(req, 200, NULL)); GUARD(pr_add_content_type(req, "text/html; charset=utf-8")); GUARD(pr_write(req, html, sdslen(html))); return PINE_OK; } static void nmdi_docs_exist(struct namugen_doc_itfc* x, int argc, char** docnames, bool* results) { NormalNamugenDocumentInterface *nmdi = (NormalNamugenDocumentInterface *)x; documents_exist(nmdi->conn, argc, docnames, results); } struct namugen_doc_itfc nmdi_vtbl = { .documents_exist = nmdi_docs_exist, .doc_href = nmdi_doc_href }; static sds render_page(ConnCtx *ctx, Document *doc, char *docname_prefix) { if (!docname_prefix) docname_prefix = "/wiki/page/"; NormalNamugenDocumentInterface my_itfc = { .vtbl = nmdi_vtbl, .conn = ctx, .docname_prefix = docname_prefix }; sds result = sdsnewlen(NULL, sdslen(doc->source) * 2); clock_t clock_st = clock(); result = htmlgen_generate_directly(doc->name, doc->source, sdslen(doc->source), &todo_hook, &my_itfc.vtbl, result); clock_t clock_ed = clock(); double ms = (((double) (clock_ed - clock_st)) / CLOCKS_PER_SEC) * 1000.; result = sdscatprintf(result, "<p class='gen-ms'>generated in %.2lfms</p>", ms); return result; } #define RAW_PAGE_PREFIX "/wiki/raw/" #define RENDERED_PAGE_PREFIX "/wiki/rendered/" #define WIKI_PAGE_PREFIX "/wiki/page/" int pine_main(PineRequest *req) { ConnCtx *conn = &((CoreData *)CORE_DATA(req))->conn; conn->req = req; sds path = req->env.path; char *suffix; if (prefix(path, RAW_PAGE_PREFIX, &suffix)) { if (strstr(suffix, "/")) { goto bad_request; } RAII_SDS sds docname = sdsnew(suffix); RAII_Document Document doc; Document_init(&doc); if (!find_document(conn, docname, &doc)) { goto not_found; } return ok_put_plain(req, doc.source); } else if (prefix(path, RENDERED_PAGE_PREFIX, &suffix)) { if (strstr(suffix, "/")) { goto bad_request; } RAII_SDS sds docname = sdsnew(suffix); RAII_Document Document doc; Document_init(&doc); if (!find_document(conn, docname, &doc)) { goto not_found; } RAII_SDS sds page = render_page(conn, &doc, RENDERED_PAGE_PREFIX); return ok_put_html(req, page); } else { goto not_found; } return PINE_OK; bad_request: GUARD(bad_request_400(req)); return PINE_OK; not_found: GUARD(not_found_404(req)); return PINE_OK; } static void uwsgi_coroutine_read_hook(redisContext *c) { uwsgi.wait_read_hook(c->fd, 0); } static void uwsgi_coroutine_write_hook(redisContext *c) { uwsgi.wait_write_hook(c->fd, 0); } void pine_init(int async) { initmod_htmlgen(); initmod_namugen(); redisCoroutineReadHook = uwsgi_coroutine_read_hook; redisCoroutineWriteHook = uwsgi_coroutine_write_hook; uwsgi_log("**Starting Pine using %d async worker(s)**\n", async); } void* pine_init_data_per_core(int core_id) { // Connection to DB's done here CoreData* core_data = malloc(sizeof(CoreData)); core_data->id = core_id; ConnCtx *conn = &core_data->conn; conn->wait_read_hook = uwsgi.wait_read_hook; conn->wait_write_hook = uwsgi.wait_read_hook; conn->mysql = mysql_init(NULL); mysql_options(conn->mysql, MYSQL_OPT_NONBLOCK, 0); uwsgi_log("Connecting to MySQL/MariaDB...\n"); if (!mysql_real_connect(conn->mysql, NULL, "root", NULL, "test", 0, "/tmp/mysql.sock", 0)) { mysql_fatal(conn->mysql); } struct timeval timeout = { 20, 0 }; // 20 seconds uwsgi_log("Connecting to Redis...\n"); conn->redis = redisConnectWithTimeout("localhost",6379, timeout); if (conn->redis == NULL || conn->redis->err) { if (conn->redis) { uwsgi_log("(Redis)Connection error: %s\n", conn->redis->errstr); redisFree(conn->redis); } else { uwsgi_log("Connection error: can't allocate redis context\n"); } abort(); } uwsgi_log("Connected to Redis!\n"); return core_data; }
// // Copright (c) 2012-2015 Michele Segata <segata@ccs-labs.org> // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License as published by // the Free Software Foundation, either version 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 Lesser General Public License for more details. // // You should have received a copy of the GNU Lesser General Public License // along with this program. If not, see http://www.gnu.org/licenses/. // #ifndef UNICASTPROTOCOL_H_ #define UNICASTPROTOCOL_H_ #include "veins/modules/application/ieee80211p/BaseWaveApplLayer.h" #include <queue> #include "veins/modules/application/platooning/messages/UnicastMessage_m.h" #include "veins/modules/application/platooning/messages/UnicastProtocolControlMessage_m.h" enum ControlMessageCommand { //from app to protocol for setting mac address SET_MAC_ADDRESS, //from app to protocol, disable acks reply for unicast (debug purpose) DISABLE_ACKS, //from app to protocol, enable acks reply ENABLE_ACKS, //from protocol to app to tell that sending failed after trying several attempts SEND_FAIL, //from protocol to app to tell that message cannot be sent because queue is full FULL_QUEUE }; class UnicastProtocol : public BaseWaveApplLayer { protected: //this is the mac address of the node. //the application can set it at the beginning //so that it does not have to care about it //anymore. the unicast layer will insert the //mac address before sending a frame and //will drop frames not directed to this //vehicle int macAddress; //queue of packets from above std::queue<UnicastMessage *> queue; //size of the queue, 0 means infinite size_t queueSize; //maximum number of retransmission attempts when ack not received int maxAttempts; //amount of time to wait before declaring ack timeout //a copy of the current message sent on the channel, waiting for ack UnicastMessage *currentMsg; //number of retransmission attempts for the current msg int nAttempts; //ack timeout time double ackTimeout; //self scheduled message for ack waiting timeout cMessage *timeout; //enable/disable ack reply on unicast (for debug purpose) bool enableAck; //sequence number used in the next message int sequenceNumber; //variable to map a node's MAC address to the next sequence number //expected from that node. this is needed for understanding whether //the received message is a duplicate or not. notice that the //sequence number does not work like in TCP. each node uses a sequence //number for all the receivers, and not one for each receiver. So //if node A is sending packet 1 to B, and then it wants to send a packet //to C, A will use sequence number 2. B will anyhow save the tuple (A,2) //saying that the next expected sequence number from A is 2. If A now //sends a packet to B, it will use the sequence number 3, but B will //anyhow understand that packet 3 is a new packet from A. std::map<int, int> receiveSequenceNumbers; //packet loss rate (between 0 and 1) double packetLossRate; //input/output gates from/to upper layer int upperLayerIn, upperLayerOut, upperControlIn, upperControlOut; public: virtual void initialize(int stage); virtual void finish(); protected: virtual void onBeacon(WaveShortMessage* wsm); virtual void onData(WaveShortMessage* wsm); protected: virtual void handleUpperMsg(cMessage *msg); virtual void handleUpperControl(cMessage *msg); virtual void handleSelfMsg(cMessage *msg); virtual void handleLowerMsg(cMessage *msg); protected: /** * Handle unicast procedures, e.g., determining whether the * message is directed to this node, sending the ack, etc. */ virtual void handleUnicastMessage(UnicastMessage *msg); /** * Handle the reception of an ack frame */ virtual void handleAckMessage(UnicastMessage *ack); /** * Generates and sends a message. if a unicast address is specified, then the message is * repeatedly sent until an ack is received. if no ack is received after a certain number * of attempts, a control message signaling the error is sent to the application. * This function inserts sender mac address and sequence number into the sent frame. It * takes care of incrementing the sequence number too. * * \param destination destination mac address. set to "broadcast" for a broadcast message * \param msg packet to encapsulate * \param encapsulatedId tells the kind of encapsulated frame inside the unicast message * which will be used by the receiver to know the type of content, a kind of protocol ID field * \param priority the priority of the message, a value from 0 to 3 which will be then mapped * onto an AC (AC_BK = 0, ... AC_VO = 3) * \param channel 0 for CCH, 1 for SCH */ void sendMessageDown(int destination, cPacket *msg, int encapsulatedId, int priority, SimTime timestamp, t_channel channel); /** * Sends an ack in response to an unicast message * * \param msg the unicast message to be acknowledged */ void sendAck(UnicastMessage *msg); /** * Resend the current unicast message after an ack timeout occurred. * This function also increments the number of attempts. */ void resendMessage(); /** * After an ack is received or a message is discarded after a certain number of attempts, * this method can be called to process the next packet in the queue, if any. */ void processNextPacket(); public: UnicastProtocol(); virtual ~UnicastProtocol(); }; #endif /* UNICASTPROTOCOL_H_ */
/************************************************************************************* * Estes - Restaurant Point Of Sale * * Copyright (C) 2009 Leonti Bielski * * * * 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 PROG_SET_PANEL_H #define PROG_SET_PANEL_H //(*Headers(prog_set_panel) #include <wx/checkbox.h> #include <wx/sizer.h> #include <wx/panel.h> #include <wx/stattext.h> #include <wx/choice.h> //*) #include <wx/config.h> struct current_settings { bool kitchen; int kitchen_type; //1-database, 2 - print int lang; bool custom_print; //true - use custom command - false - default one bool custom_drawer; bool custom_ticket; bool custom_width; wxString print_command; wxString drawer_command; wxString ticket_command; int print_width; }; class prog_set_panel: public wxPanel { public: prog_set_panel(wxWindow* parent,wxWindowID id=wxID_ANY,const wxPoint& pos=wxDefaultPosition,const wxSize& size=wxDefaultSize); virtual ~prog_set_panel(); //(*Declarations(prog_set_panel) wxCheckBox* CheckBox1; wxStaticText* StaticText1; wxChoice* Choice1; wxCheckBox* CheckBox2; wxStaticText* StaticText2; wxCheckBox* CheckBox3; //*) current_settings* set_now; wxConfigBase *confi; void fill_all(void); void Save(void); protected: //(*Identifiers(prog_set_panel) static const long ID_CHECKBOX1; static const long ID_CHECKBOX2; static const long ID_CHECKBOX3; static const long ID_STATICTEXT1; static const long ID_CHOICE1; static const long ID_STATICTEXT2; //*) private: //(*Handlers(prog_set_panel) void OnCheckBox1Click(wxCommandEvent& event); void OnCheckBox2Click(wxCommandEvent& event); void OnCheckBox3Click(wxCommandEvent& event); //*) wxArrayInt langs; DECLARE_EVENT_TABLE() }; #endif
/* Various stub functions and uIP variables other code might need to * compile. Allows you to save needing to compile all of uIP in just * to get a few things */ #define UIP_CONF_IPV6 1 #include "net/uip.h" #include <stdio.h> #include <arpa/inet.h> #undef uip_buf unsigned char *uip_buf; uint16_t uip_len; #define UIP_IP_BUF ((struct uip_ip_hdr *)&uip_buf[UIP_LLH_LEN]) static uint16_t chksum(uint16_t sum, const uint8_t *data, uint16_t len) { uint16_t t; const uint8_t *dataptr; const uint8_t *last_byte; dataptr = data; last_byte = data + len - 1; while(dataptr < last_byte) { /* At least two more bytes */ t = (dataptr[0] << 8) + dataptr[1]; sum += t; if(sum < t) { sum++; /* carry */ } dataptr += 2; } if(dataptr == last_byte) { t = (dataptr[0] << 8) + 0; sum += t; if(sum < t) { sum++; /* carry */ } } /* Return sum in host byte order. */ return sum; } static uint16_t upper_layer_chksum(uint8_t proto) { uint16_t upper_layer_len; uint16_t sum; upper_layer_len = (((uint16_t)(UIP_IP_BUF->len[0]) << 8) + UIP_IP_BUF->len[1]) ; /* First sum pseudoheader. */ /* IP protocol and length fields. This addition cannot carry. */ sum = upper_layer_len + proto; /* Sum IP source and destination addresses. */ sum = chksum(sum, (uint8_t *)&UIP_IP_BUF->srcipaddr, 2 * sizeof(uip_ipaddr_t)); /* Sum TCP header and data. */ sum = chksum(sum, &uip_buf[UIP_IPH_LEN + UIP_LLH_LEN], upper_layer_len); return (sum == 0) ? 0xffff : htons(sum); } /*---------------------------------------------------------------------------*/ uint16_t uip_icmp6chksum(void) { return upper_layer_chksum(UIP_PROTO_ICMP6); } /*---------------------------------------------------------------------------*/ void uip_ds6_link_neighbor_callback(int status, int numtx) { }
/* tc-m32c.h -- Header file for tc-m32c.c. Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, Inc. This file is part of GAS, the GNU Assembler. GAS 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. GAS 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 GAS; see the file COPYING. If not, write to the Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #define TC_M32C #define LISTING_HEADER "M16C/M32C GAS " /* The target BFD architecture. */ #define TARGET_ARCH bfd_arch_m32c #define TARGET_FORMAT "cgc32-m32c" #define TARGET_BYTES_BIG_ENDIAN 0 #define md_end m32c_md_end extern void m32c_md_end (void); #define md_start_line_hook m32c_start_line_hook extern void m32c_start_line_hook (void); /* call md_pcrel_from_section, not md_pcrel_from */ long md_pcrel_from_section (struct fix *, segT); #define MD_PCREL_FROM_SECTION(FIXP, SEC) md_pcrel_from_section (FIXP, SEC) /* Permit temporary numeric labels. */ #define LOCAL_LABELS_FB 1 #define DIFF_EXPR_OK /* .-foo gets turned into PC relative relocs */ /* We don't need to handle .word strangely. */ #define WORKING_DOT_WORD #define md_apply_fix m32c_apply_fix extern void m32c_apply_fix (struct fix *, valueT *, segT); #define tc_fix_adjustable(fixP) m32c_fix_adjustable (fixP) extern bfd_boolean m32c_fix_adjustable (struct fix *); /* When relaxing, we need to emit various relocs we otherwise wouldn't. */ #define TC_FORCE_RELOCATION(fix) m32c_force_relocation (fix) extern int m32c_force_relocation (struct fix *); #define TC_CONS_FIX_NEW(FRAG, WHERE, NBYTES, EXP) \ m32c_cons_fix_new (FRAG, WHERE, NBYTES, EXP) extern void m32c_cons_fix_new (fragS *, int, int, expressionS *); extern const struct relax_type md_relax_table[]; #define TC_GENERIC_RELAX_TABLE md_relax_table extern void m32c_prepare_relax_scan (fragS *, offsetT *, relax_substateT); #define md_prepare_relax_scan(FRAGP, ADDR, AIM, STATE, TYPE) \ m32c_prepare_relax_scan(FRAGP, &AIM, STATE) /* Values passed to md_apply_fix don't include the symbol value. */ #define MD_APPLY_SYM_VALUE(FIX) 0 /* Call md_pcrel_from_section(), not md_pcrel_from(). */ #define MD_PCREL_FROM_SECTION(FIXP, SEC) md_pcrel_from_section (FIXP, SEC) extern long md_pcrel_from_section (struct fix *, segT); /* We need a special version of the TC_START_LABEL macro so that we allow the :Z, :S, :Q and :G suffixes to be parsed as such. We need to be able to change the contents of the local variable 'c' which is passed to this macro as 'character'. */ #define TC_START_LABEL(character, s, i_l_p) \ ((character) != ':' ? 0 : (character = m32c_is_colon_insn (s)) ? 0 : ((character = ':'), 1)) extern char m32c_is_colon_insn (char *); #define H_TICK_HEX 1
/*===================================================================*/ /* */ /* Mapper 201 (21-in-1) */ /* */ /*===================================================================*/ /*-------------------------------------------------------------------*/ /* Initialize Mapper 201 */ /*-------------------------------------------------------------------*/ void Map201_Init() { int nPage; /* Initialize Mapper */ MapperInit = Map201_Init; /* Write to Mapper */ MapperWrite = Map201_Write; /* Write to SRAM */ MapperSram = Map0_Sram; /* Write to APU */ MapperApu = Map0_Apu; /* Read from APU */ MapperReadApu = Map0_ReadApu; /* Callback at VSync */ MapperVSync = Map0_VSync; /* Callback at HSync */ MapperHSync = Map0_HSync; /* Callback at PPU */ MapperPPU = Map0_PPU; /* Callback at Rendering Screen ( 1:BG, 0:Sprite ) */ MapperRenderScreen = Map0_RenderScreen; /* Set SRAM Banks */ SRAMBANK = SRAM; /* Set ROM Banks */ ROMBANK0 = ROMPAGE( 0 ); ROMBANK1 = ROMPAGE( 1 ); ROMBANK2 = ROMPAGE( 0 ); ROMBANK3 = ROMPAGE( 1 ); /* Set PPU Banks */ if ( NesHeader.byVRomSize > 0 ) { for ( nPage = 0; nPage < 8; ++nPage ) PPUBANK[ nPage ] = VROMPAGE( nPage ); InfoNES_SetupChr(); } /* Set up wiring of the interrupt pin */ K6502_Set_Int_Wiring( 1, 1 ); } /*-------------------------------------------------------------------*/ /* Mapper 201 Write Function */ /*-------------------------------------------------------------------*/ void Map201_Write( WORD wAddr, BYTE byData ) { BYTE byBank = (BYTE)wAddr & 0x03; if (!(wAddr&0x08) ) byBank = 0; /* Set ROM Banks */ ROMBANK0 = ROMPAGE(((byBank<<2)+0) % (NesHeader.byRomSize<<1)); ROMBANK1 = ROMPAGE(((byBank<<2)+1) % (NesHeader.byRomSize<<1)); ROMBANK2 = ROMPAGE(((byBank<<2)+2) % (NesHeader.byRomSize<<1)); ROMBANK3 = ROMPAGE(((byBank<<2)+3) % (NesHeader.byRomSize<<1)); /* Set PPU Banks */ PPUBANK[0] = VROMPAGE(((byBank<<3)+0) % (NesHeader.byVRomSize<<3)); PPUBANK[1] = VROMPAGE(((byBank<<3)+1) % (NesHeader.byVRomSize<<3)); PPUBANK[2] = VROMPAGE(((byBank<<3)+2) % (NesHeader.byVRomSize<<3)); PPUBANK[3] = VROMPAGE(((byBank<<3)+3) % (NesHeader.byVRomSize<<3)); PPUBANK[4] = VROMPAGE(((byBank<<3)+4) % (NesHeader.byVRomSize<<3)); PPUBANK[5] = VROMPAGE(((byBank<<3)+5) % (NesHeader.byVRomSize<<3)); PPUBANK[6] = VROMPAGE(((byBank<<3)+6) % (NesHeader.byVRomSize<<3)); PPUBANK[7] = VROMPAGE(((byBank<<3)+7) % (NesHeader.byVRomSize<<3)); InfoNES_SetupChr(); }
// Aseprite // Copyright (C) 2001-2015 David Capello // // 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. #pragma once namespace doc { class Palette; } namespace app { std::string get_readable_palette_extensions(); std::string get_writable_palette_extensions(); doc::Palette* load_palette(const char *filename); bool save_palette(const char *filename, const doc::Palette* pal, int columns); } // namespace app
#include <stdio.h> int main() { int i; int answer; int found = 0; int cur = 20; while( !found ){ cur++; found = 1; for( i = 1; i <= 20; i++ ){ if( ( cur % i ) != 0 ){ found = 0; break; } } } printf("%d\n", cur); return 0; }
/* * File: IIntroScreen.h * Author: Rob Parker * * Created on October 13, 2014, 23:11 PM */ #ifndef IINTROSCREEN_H #define IINTROSCREEN_H #include "../../IScreen.h" namespace gs { class IIntroScreen : public IScreen { public: virtual void update() = 0; virtual void render(RenderWindowShPtr) = 0; virtual ScreensEnum getType() const = 0; }; typedef std::shared_ptr<IIntroScreen> IIntroScreenShPtr; } #endif /* IINTROSCREEN_H */
#include "Event.h" #include "DrawingAlgorithm.h" void KeyboardInput_INPUT_CIRCLE(); void KeyboardInput_INPUT_SQUARE(); void KeyboardInput_INPUT_STRETCH(); void KeyboardInput_INPUT_ROTATE(); void KeyboardInput_INPUT_SHEAR();
#ifndef __SRC_CORE_GUI_SLIDER_ #define __SRC_CORE_GUI_SLIDER_ #include <lib/gui/eprogress.h> class eSlider: public eProgress { int incrementation, max, min; gColor activated_left, activated_right; const eWidget *descr; int setProperty( const eString &prop, const eString &val); void gotFocus(); void lostFocus(); int eventHandler( const eWidgetEvent& event ); eWidget *tmpDescr; void update(); void init_eSlider(int min,int max); public: void setMin( int i ); void setMax( int i ); void setIncrement( int i ); void setValue( int i ); int getValue(); sigc::signal<void, int> changed; eSlider( eWidget *parent, const eWidget *descr=0, int min=0, int max=99 ); }; #endif // __SRC_CORE_GUI_SLIDER_
/* Copyright (C) 2003-2005 Peter J. Verveer * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above * copyright notice, this list of conditions and the following * disclaimer in the documentation and/or other materials provided * with the distribution. * * 3. The name of the author may not be used to endorse or promote * products derived from this software without specific prior * written permission. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #ifndef NI_FOURIER_H #define NI_FOURIER_H int NI_FourierFilter(PyArrayObject*, PyArrayObject*, maybelong, int, PyArrayObject*, int); int NI_FourierShift(PyArrayObject*, PyArrayObject*, maybelong, int, PyArrayObject*); #endif
// stdafx.h : ±ê׼ϵͳ°üº¬ÎļþµÄ°üº¬Îļþ£¬ // »òÊǾ­³£Ê¹Óõ«²»³£¸ü¸ÄµÄ // ÌØ¶¨ÓÚÏîÄ¿µÄ°üº¬Îļþ // #pragma once #include "targetver.h" #include <stdio.h> #include <tchar.h> #define WIN32_LEAN_AND_MEAN #include <windows.h> // TODO: ÔÚ´Ë´¦ÒýÓóÌÐòÐèÒªµÄÆäËûÍ·Îļþ //------------------------------------------------------------------------------- //¹«¹²¿â·¾¶ //------------------------------------------------------------------------------- #define COMM_INC_PATH "../../../¹«¹²¿â" //------------------------------------------------------------------------------- // ¹«¹²¿â //------------------------------------------------------------------------------- #include "..\..\..\¹«¹²¿â\CKit-1E5-lib\CKit.h" #include "..\..\..\¹«¹²¿â\GlobalDef.h" #define STR_CURTIME StringUnit::timetostr(time(0),"%Y-%m-%d %H:%M:%S").c_str() #ifdef _DEBUG # define LOG_V(fmt,...) printf("\n VDC>>>[%s][%s : %d] "fmt,STR_CURTIME,__FUNCTION__,__LINE__,##__VA_ARGS__) ; \ LOGF_MA("\n VDC>>>[%s][%s : %d] "fmt,STR_CURTIME,__FUNCTION__,__LINE__,##__VA_ARGS__) #else # define LOG_V(fmt,...) LOGF_MA("\n VDC>>>[%s][%s : %d] "fmt,STR_CURTIME,__FUNCTION__,__LINE__,##__VA_ARGS__) #endif
#undef CONFIG_SX
/* For use with circuit_breaker_switch.c. Look in circuit_breaker_switch_main.c for more information. C. Eric Cashon */ #ifndef __CIRCUIT_BREAKER_SWITCH_H__ #define __CIRCUIT_BREAKER_SWITCH_H__ #include<gtk/gtk.h> G_BEGIN_DECLS #define CIRCUIT_BREAKER_SWITCH_TYPE (circuit_breaker_switch_get_type()) #define CIRCUIT_BREAKER_SWITCH(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), CIRCUIT_BREAKER_SWITCH_TYPE, CircuitBreakerSwitch)) #define CIRCUIT_BREAKER_SWITCH_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), CIRCUIT_BREAKER_SWITCH_TYPE, CircuitBreakerSwitchClass)) #define IS_CIRCUIT_BREAKER_SWITCH(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), CIRCUIT_BREAKER_SWITCH_TYPE)) #define IS_CIRCUIT_BREAKER_SWITCH_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), CIRCUIT_BREAKER_SWITCH_TYPE) #define CIRCUIT_BREAKER_SWITCH_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), CIRCUIT_BREAKER_SWITCH_TYPE, CircuitBreakerSwitchClass)) typedef struct _CircuitBreakerSwitch CircuitBreakerSwitch; typedef struct _CircuitBreakerSwitchClass CircuitBreakerSwitchClass; /** * CircuitBreakerSwitch: * * A CircuitBreakerSwitch structure. * */ struct _CircuitBreakerSwitch { /*< private >*/ GtkDrawingArea da; }; struct _CircuitBreakerSwitchClass { GtkDrawingAreaClass parent_class; }; //Circuit breaker direction. enum { BREAKER_HORIZONTAL_RIGHT, BREAKER_VERTICAL_UP }; //Circuit breaker state enum { BREAKER_ON, BREAKER_STARTING, BREAKER_OFF, BREAKER_BREAK }; //Public functions. GType circuit_breaker_switch_get_type(void) G_GNUC_CONST; GtkWidget* circuit_breaker_switch_new(); void circuit_breaker_switch_set_direction(CircuitBreakerSwitch *da, gint breaker_direction); gint circuit_breaker_switch_get_direction(CircuitBreakerSwitch *da); void circuit_breaker_switch_set_state(CircuitBreakerSwitch *da, gint breaker_state); gint circuit_breaker_switch_get_state(CircuitBreakerSwitch *da); //Set text or lighting icon. void circuit_breaker_switch_set_icon(CircuitBreakerSwitch *da, gboolean breaker_icon); gint circuit_breaker_switch_get_icon(CircuitBreakerSwitch *da); //Set some circuit breaker background and foreground colors. void circuit_breaker_switch_set_background_off(CircuitBreakerSwitch *da, const gchar *bg_off_string); const gchar* circuit_breaker_switch_get_background_off(CircuitBreakerSwitch *da); void circuit_breaker_switch_set_background_starting(CircuitBreakerSwitch *da, const gchar *bg_starting_string); const gchar* circuit_breaker_switch_get_background_starting(CircuitBreakerSwitch *da); void circuit_breaker_switch_set_background_on(CircuitBreakerSwitch *da, const gchar *bg_on_string); const gchar* circuit_breaker_switch_get_background_on(CircuitBreakerSwitch *da); void circuit_breaker_switch_set_background_break(CircuitBreakerSwitch *da, const gchar *bg_break_string); const gchar* circuit_breaker_switch_get_background_break(CircuitBreakerSwitch *da); void circuit_breaker_switch_set_foreground(CircuitBreakerSwitch *da, const gchar *fg1_string); const gchar* circuit_breaker_switch_get_foreground(CircuitBreakerSwitch *da); G_END_DECLS #endif
/* dirlimit.c Copyright (C) 1999-2001 Petr Vandrovec 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 Revision history: 1.00 2001, June 3 Petr Vandrovec <vandrove@vc.cvut.cz> Created from fileinfo.c demo. 1.01 2001, July 15 Petr Vandrovec <vandrove@vc.cvut.cz> Added option '-l' to set directory space limit. */ #include <ncp/nwcalls.h> #include <ncp/nwnet.h> #include <unistd.h> #include <stdlib.h> #include <ctype.h> #include <wchar.h> #include <string.h> #include "private/libintl.h" #define _(X) gettext(X) static char *progname; static void usage(void) { fprintf(stderr, _("usage: %s [options]\n"), progname); } static void help(void) { printf(_("\n" "usage: %s [options] path\n"), progname); printf(_("\n" "-h Print this help text\n" "-l new_limit Directory space limit (4KB units)\n" "-p volume_path Remote path (default is derived from path)\n" "\n")); } int main(int argc, char *argv[]) { NWDSCCODE dserr; NWCONN_HANDLE conn; char volume[1000]; char volpath[1000]; int opt; int len; unsigned char buffer[1000]; char* s = NULL; unsigned long maxlimit = 0; int setlimit = 0; setlocale(LC_ALL, ""); bindtextdomain(NCPFS_PACKAGE, LOCALEDIR); textdomain(NCPFS_PACKAGE); progname = argv[0]; NWCallsInit(NULL, NULL); while ((opt = getopt(argc, argv, "h?p:l:")) != EOF) { switch (opt) { case 'p': s = optarg; break; case 'l': maxlimit = strtoul(optarg, NULL, 10); setlimit = 1; break; case 'h': case '?': help(); goto finished; default: usage(); goto finished; } } dserr = NWParsePath(argv[optind++], NULL, &conn, volume, volpath); if (dserr) { fprintf(stderr, "NWParsePath failed: %s\n", strnwerror(dserr)); return 123; } if (!conn) { fprintf(stderr, "Path is not remote\n"); return 124; } strcat(volume, ":"); strcat(volume, volpath); len = ncp_path_to_NW_format(s?s:volume, buffer, sizeof(buffer)); if (len < 0) { fprintf(stderr, "Cannot convert path: %s\n", strerror(-len)); } else if (setlimit) { struct ncp_dos_info limit; limit.MaximumSpace = maxlimit; dserr = ncp_ns_modify_entry_dos_info(conn, NW_NS_DOS, SA_ALL, NCP_DIRSTYLE_NOHANDLE, 0, 0, buffer, len, DM_MAXIMUM_SPACE, &limit); if (dserr) { fprintf(stderr, "Cannot set directory space limit: %s\n", strnwerror(dserr)); } else { printf("New directory limit set\n"); } } else { NWDIR_HANDLE d; dserr = ncp_ns_alloc_short_dir_handle(conn, NW_NS_DOS, NCP_DIRSTYLE_NOHANDLE, 0, 0, buffer, len, NCP_ALLOC_PERMANENT, &d, NULL); if (dserr) { fprintf(stderr, "Cannot obtain directory handle: %s\n", strnwerror(dserr)); } else { NW_LIMIT_LIST x; DIR_SPACE_INFO dsi; dserr = NWGetDirSpaceLimitList2(conn, d, &x); if (dserr) { fprintf(stderr, "Cannot obtain dirspace limit list: %s\n", strnwerror(dserr)); } else { size_t c; printf("%u entries returned\n", x.numEntries); for (c = 0; c < x.numEntries; c++) { printf("Entry %u: Level: %u\n", c, x.list[c].level); printf(" Max: %u\n", x.list[c].max); printf(" Current: %u\n", x.list[c].current); printf(" Used: %u\n", x.list[c].max - x.list[c].current); } } dserr = ncp_get_directory_info(conn, d, &dsi); if (dserr) { fprintf(stderr, "Cannot obtain directory info: %s\n", strnwerror(dserr)); } else { printf("Total blocks: %u\n", dsi.totalBlocks); printf("Available blocks: %u\n", dsi.availableBlocks); printf("Purgeable blocks: %u\n", dsi.purgeableBlocks); printf("Not yet purg.b.: %u\n", dsi.notYetPurgeableBlocks); printf("Total inodes: %u\n", dsi.totalDirEntries); printf("Available inodes: %u\n", dsi.availableDirEntries); printf("Reserved: %u\n", dsi.reserved); printf("Sectors Per Block: %u\n", dsi.sectorsPerBlock); printf("Volume name: %s\n", dsi.volName); } } ncp_dealloc_dir_handle(conn, d); } ncp_close(conn); finished:; return 0; }
/* * Copyright (C) 2016 Jens Georg <mail@jensge.org> * * Authors: Jens Georg <mail@jensge.org> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifndef MEDIA_SERVER_H #define MEDIA_SERVER_H #ifdef HAVE_CONFIG_H #include <config.h> #endif #include <libgupnp/gupnp.h> G_BEGIN_DECLS GType av_cp_media_server_get_type (void); #define AV_CP_TYPE_MEDIA_SERVER (av_cp_media_server_get_type ()) #define AV_CP_MEDIA_SERVER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), \ AV_CP_TYPE_MEDIA_SERVER, \ AVCPMediaServer)) #define AV_CP_MEDIA_SERVER_CLASS(obj) (G_TYPE_CHECK_CLASS_CAST ((obj), \ AV_CP_TYPE_MEDIA_SERVER, \ AVCPMediaServerClass)) #define AV_CP_IS_MEDIA_SERVER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), \ AV_CP_TYPE_MEDIA_SERVER)) #define AV_CP_IS_MEDIA_SERVER_CLASS(obj) (G_TYPE_CHECK_CLASS_TYPE ((obj), \ AV_CP_TYPE_MEDIA_SERVER)) #define AV_CP_MEDIA_SERVER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), \ AV_CP_TYPE_MEDIA_SERVER, \ AVCPMediaServerDeviceClass)) typedef struct _AVCPMediaServer AVCPMediaServer; typedef struct _AVCPMediaServerClass AVCPMediaServerClass; typedef struct _AVCPMediaServerPrivate AVCPMediaServerPrivate; struct _AVCPMediaServer { GUPnPDeviceProxy parent; }; struct _AVCPMediaServerClass { GUPnPDeviceProxyClass parent_class; }; GUPnPServiceProxy * av_cp_media_server_get_content_directory (AVCPMediaServer *self); void av_cp_media_server_browse_async (AVCPMediaServer *self, GCancellable *cancellable, GAsyncReadyCallback callback, const char *container_id, guint32 starting_index, guint32 requested_count, gpointer user_data); gboolean av_cp_media_server_browse_finish (AVCPMediaServer *self, GAsyncResult *result, char **didl_xml, guint32 *total_matches, guint32 *number_returned, GError **error); void av_cp_media_server_browse_metadata_async (AVCPMediaServer *self, GCancellable *cancellable, GAsyncReadyCallback callback, const char *container_id, gpointer user_data); gboolean av_cp_media_server_browse_metadata_finish (AVCPMediaServer *self, GAsyncResult *result, char **didl_xml, GError **error); void av_cp_media_server_search_async (AVCPMediaServer *self, GCancellable *cancellable, GAsyncReadyCallback callback, const char *container_id, const char *search_criteria, const char *filter, guint32 starting_index, guint32 requested_count, gpointer user_data); gboolean av_cp_media_server_search_finish (AVCPMediaServer *self, GAsyncResult *result, char **didl_xml, guint32 *total_matches, guint32 *number_returned, GError **error); char const * const * av_cp_media_server_get_search_caps (AVCPMediaServer *self); G_END_DECLS #endif /* MEDIA_SERVER_H */
#define BFD_VERSION_DATE 20161220 #define BFD_VERSION @bfd_version@ #define BFD_VERSION_STRING @bfd_version_package@ @bfd_version_string@ #define REPORT_BUGS_TO @report_bugs_to@
/** @file remotetcpclient.h * @brief TCP/IP socket based RemoteDatabase implementation */ /* Copyright (C) 2007,2008,2010,2011,2014 Olly Betts * * 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 St, Fifth Floor, Boston, MA 02110-1301 USA */ #ifndef XAPIAN_INCLUDED_REMOTETCPCLIENT_H #define XAPIAN_INCLUDED_REMOTETCPCLIENT_H #include "backends/remote/remote-database.h" #ifdef __WIN32__ # define SOCKET_INITIALIZER_MIXIN private WinsockInitializer, #else # define SOCKET_INITIALIZER_MIXIN #endif /** TCP/IP socket based RemoteDatabase implementation. * * Connects via TCP/IP to an instance of xapian-tcpsrv. */ class RemoteTcpClient : SOCKET_INITIALIZER_MIXIN public RemoteDatabase { /// Don't allow assignment. void operator=(const RemoteTcpClient &); /// Don't allow copying. RemoteTcpClient(const RemoteTcpClient &); /** Attempt to open a TCP/IP socket connection to xapian-tcpsrv. * * Connect to xapian-tcpsrv running on port @a port of host @a hostname. * Give up trying to connect after @a timeout_connect seconds. * * Note: this method is called early on during class construction before * any member variables or even the base class have been initialised. * To help avoid accidentally trying to use member variables or call other * methods which do, this method has been deliberately made "static". */ static int open_socket(const std::string & hostname, int port, double timeout_connect); /** Get a context string for use when constructing Xapian::NetworkError. * * Note: this method is used from constructors so has been made static to * avoid problems with trying to use uninitialised member variables. In * particular, it can't be made a virtual method of the base class. */ static std::string get_tcpcontext(const std::string & hostname, int port); public: /** Constructor. * * Attempts to open a TCP/IP connection to xapian-tcpsrv running on port * @a port of host @a hostname. * * @param timeout_connect Timeout for trying to connect (in seconds). * @param timeout Timeout during communication after successfully * connecting (in seconds). * @param writable Is this a WritableDatabase? * @param flags Xapian::DB_RETRY_LOCK or 0. */ RemoteTcpClient(const std::string & hostname, int port, double timeout_, double timeout_connect, bool writable, int flags) : RemoteDatabase(open_socket(hostname, port, timeout_connect), timeout_, get_tcpcontext(hostname, port), writable, flags) { } /** Destructor. */ ~RemoteTcpClient(); }; #endif // XAPIAN_INCLUDED_REMOTETCPCLIENT_H
#include <stdio.h> #include <stdlib.h> char *trim (char *str) { char *ibuf, *obuf; if (str) { for (ibuf = obuf = str; *ibuf; ) { while (*ibuf && (isspace (*ibuf))) ibuf++; if (*ibuf && (obuf != str)) *(obuf++) = ' '; while (*ibuf && (!isspace (*ibuf))) *(obuf++) = *(ibuf++); } *obuf = '\0'; } return (str); }
/* * connect() emulation for MiNT-Net, (w) '93, kay roemer. */ #include <errno.h> #include <limits.h> #include <string.h> #include <support.h> #include <mint/mintbind.h> #include <sys/socket.h> #include <sys/un.h> #include "mintlib/lib.h" #include "mintsock.h" #include "sockets_global.h" int __connect (int fd, struct sockaddr *addr, socklen_t addrlen) { if (__libc_newsockets) { long r = Fconnect (fd, addr, addrlen); if (r != -ENOSYS) { if (r < 0) { __set_errno (-r); return -1; } return 0; } else __libc_newsockets = 0; } { struct connect_cmd cmd; struct sockaddr_un un; long r; if (!__libc_unix_names && addr && addr->sa_family == AF_UNIX) { struct sockaddr_un *unp = (struct sockaddr_un *) addr; if (addrlen <= UN_OFFSET || addrlen > sizeof (un)) { __set_errno (EINVAL); return -1; } un.sun_family = AF_UNIX; _unx2dos (unp->sun_path, un.sun_path, PATH_MAX); un.sun_path[sizeof (un.sun_path) - 1] = '\0'; cmd.addr = (struct sockaddr *)&un; cmd.addrlen = UN_OFFSET + strlen (un.sun_path); } else { cmd.addr = addr; cmd.addrlen = (short) addrlen; } cmd.cmd = CONNECT_CMD; r = Fcntl (fd, (long) &cmd, SOCKETCALL); if (r < 0) { __set_errno (-r); return -1; } return 0; } } weak_alias (__connect, connect)
#include <linux/module.h> #include <linux/skbuff.h> #include <linux/init.h> #include <linux/ip.h> #include <linux/netdevice.h> #include <linux/spinlock.h> #include <linux/list.h> #include <linux/netfilter_ipv4.h> #include <net/sock.h> #include <net/route.h> #include <net/icmp.h> #include <linux/udp.h> #include <net/route.h> #include "geosvr_queue.h" #include "geosvr_netlink.h" #include "geosvr_ipenc.h" #define GEOSVR_QUEUE_MAX_DEFAULT 1024 #define NET_GEOSVR_QUEUE_QMAX 2088 extern int routing_port; struct queue_entry { struct list_head l; struct sk_buff *skb; int (*okfn)(struct sk_buff *); }; typedef int (*geosvr_queue_cmpfn)(struct queue_entry *, unsigned long); static unsigned int queue_maxlen = GEOSVR_QUEUE_MAX_DEFAULT; static rwlock_t queue_lock = RW_LOCK_UNLOCKED; static unsigned int queue_total; static LIST_HEAD(queue_list); static inline int __geosvr_queue_enqueue_entry(struct queue_entry *e) { if (queue_total >= queue_maxlen) { if (net_ratelimit()) printk(KERN_WARNING "GeoSVR: full at %d entries, " "dropping packet(s).\n", queue_total); return -ENOSPC; } list_add(&e->l, &queue_list); queue_total++; return 0; } static inline struct queue_entry * __geosvr_queue_find_entry(geosvr_queue_cmpfn cmpfn, unsigned long data) { struct list_head *p; list_for_each_prev(p, &queue_list) { struct queue_entry *e = (struct queue_entry *)p; if (!cmpfn || cmpfn(e, data)) return e; } return NULL; } static inline struct queue_entry * __geosvr_queue_find_dequeue_entry(geosvr_queue_cmpfn cmpfn, unsigned long data) { struct queue_entry *e; e = __geosvr_queue_find_entry(cmpfn, data); if (e == NULL) return NULL; list_del(&e->l); queue_total--; return e; } static inline void __geosvr_queue_flush(void) { struct queue_entry *e; while ((e = __geosvr_queue_find_dequeue_entry(NULL, 0))) { kfree_skb(e->skb); kfree(e); } } static inline void __geosvr_queue_reset(void) { __geosvr_queue_flush(); } static struct queue_entry * geosvr_queue_find_dequeue_entry(geosvr_queue_cmpfn cmpfn, unsigned long data) { struct queue_entry *e; write_lock_bh(&queue_lock); e = __geosvr_queue_find_dequeue_entry(cmpfn, data); write_unlock_bh(&queue_lock); return e; } void geosvr_queue_flush(void) { write_lock_bh(&queue_lock); __geosvr_queue_flush(); write_unlock_bh(&queue_lock); } int geosvr_queue_enqueue_packet(struct sk_buff *skb, int (*okfn)(struct sk_buff *)) { int status = -EINVAL; struct queue_entry *e; e = kmalloc(sizeof(struct queue_entry), GFP_ATOMIC); if (e == NULL) { printk(KERN_ERR "GEOSVR: Out of memory in geosvr_queue_enqueue_packet()\n"); return -ENOMEM; } e->okfn = okfn; e->skb = skb; write_lock_bh(&queue_lock); status = __geosvr_queue_enqueue_entry(e); if (status < 0) goto unlock; write_unlock_bh(&queue_lock); return status; unlock: write_unlock_bh(&queue_lock); kfree(e); return status; } static inline int dest_cmp(struct queue_entry *e, unsigned long daddr) { struct iphdr *iph = (struct iphdr *)(e->skb->network_header); return (daddr == iph->daddr); } int geosvr_queue_find(__u32 daddr) { struct queue_entry *e; int res = 0; read_lock_bh(&queue_lock); e = __geosvr_queue_find_entry(dest_cmp, daddr); if (e != NULL) res = 1; read_unlock_bh(&queue_lock); return res; } int geosvr_queue_send_pkt(struct geosvr_nlmsg *msg) { struct queue_entry *e; int pkts = 0; int res; while (1) { e = geosvr_queue_find_dequeue_entry(dest_cmp, msg->dst); if (e == NULL) return pkts; if (msg->route_len == 0) { if (msg->req_type == GEOSVR_NL_MSG_REQ_SEND) { pkts++; e->okfn(e->skb); kfree(e); continue; } else { pkts++; geosvr_ip_forward(e->skb, msg); kfree(e); continue; } } res = geosvr_ip_encapsulate(e->skb, msg); if (res < 0) { kfree_skb(e->skb); kfree(e); pkts++; continue; } pkts++; e->okfn(e->skb); kfree(e); } return 0; } int geosvr_queue_drop_pkt(__u32 daddr) { struct queue_entry *e; int pkts = 0; while (1) { e = geosvr_queue_find_dequeue_entry(dest_cmp, daddr); if (e == NULL) return pkts; icmp_send(e->skb, ICMP_DEST_UNREACH, ICMP_HOST_UNREACH, 0); kfree_skb(e->skb); kfree(e); pkts++; } return 0; } int geosvr_queue_init(void) { queue_total = 0; return 1; } void geosvr_queue_fini(void) { synchronize_net(); geosvr_queue_flush(); }
#include <png.h> #include <stdio.h> #include <stdlib.h> #include <stdint.h> #include <string.h> #include "rgba2png.h" int rgba2png(unsigned int * Red, unsigned int * Green, unsigned int * Blue, unsigned int * Alpha, size_t width, size_t height, int nFrames, char * BaseFileName) { FILE * fp; png_structp png_ptr = NULL; png_infop info_ptr = NULL; int i, j; png_byte ** row_pointers = NULL; int nBands = 4; int depth = 8; char Filename[80]; int Status; int FrameNumber; for (FrameNumber = 0; FrameNumber < nFrames; FrameNumber++) { Status = 1; sprintf(Filename, "%s%4.4d%s", BaseFileName, FrameNumber, ".png"); #ifdef DEBUG printf("%s\n", Filename); #endif if ((fp = fopen(Filename, "wb")) == NULL) { printf("ERROR: Couldn't open the file, %s\n", Filename); break; } if ((png_ptr = png_create_write_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL)) == NULL) { fclose(fp); printf("ERROR: Couldn't creat png structure for %s\n", Filename); break; } if ((info_ptr = png_create_info_struct(png_ptr)) == NULL) { png_destroy_write_struct(&png_ptr, &info_ptr); fclose(fp); printf("ERROR: Couldn't creat png info for %s\n", Filename); break; } /* Set image attributes. */ png_set_IHDR(png_ptr, info_ptr, width, height, depth, PNG_COLOR_TYPE_RGB_ALPHA, PNG_INTERLACE_NONE, PNG_COMPRESSION_TYPE_DEFAULT, PNG_FILTER_TYPE_DEFAULT); /* Initialize rows of PNG. */ row_pointers = png_malloc(png_ptr, height * sizeof (png_byte *)); for (i = 0; i < height; ++i) { png_byte *row = png_malloc(png_ptr, sizeof (uint8_t) * width * nBands); row_pointers[i] = row; for (j = 0; j < width; ++j) { *row++ = (uint8_t) Red[FrameNumber * height * width + i * width + j]; *row++ = (uint8_t) Green[FrameNumber * height * width + i * width + j]; *row++ = (uint8_t) Blue[FrameNumber * height * width + i * width + j]; *row++ = (uint8_t) Alpha[FrameNumber * height * width + i * width + j]; } } /* Write the image data to the file. */ png_init_io(png_ptr, fp); png_set_rows(png_ptr, info_ptr, row_pointers); png_write_png(png_ptr, info_ptr, PNG_TRANSFORM_IDENTITY, NULL); for (i = 0; i < height; i++) { png_free(png_ptr, row_pointers[i]); } png_free(png_ptr, row_pointers); png_destroy_write_struct(&png_ptr, &info_ptr); fclose(fp); Status = 0; } return (Status); }
#ifndef __SND_ADIE_SVC_H_ #define __SND_ADIE_SVC_H_ #define ADIE_SVC_PROG 0x30000002 #define ADIE_SVC_VERS 0x00020003 #define ADIE_SVC_CLIENT_STATUS_FUNC_PTR_TYPE_PROC 0xFFFFFF01 #define SND_ADIE_SVC_CLIENT_REGISTER_PROC 34 #define SND_ADIE_SVC_CONFIG_ADIE_BLOCK_PROC 35 #define SND_ADIE_SVC_CLIENT_DEREGISTER_PROC 36 #define ADIE_SVC_MAX_CLIENTS 5 enum adie_svc_client_operation{ ADIE_SVC_REGISTER_CLIENT, ADIE_SVC_DEREGISTER_CLIENT, ADIE_SVC_CONFIG_ADIE_BLOCK, }; enum adie_svc_status_type{ ADIE_SVC_STATUS_SUCCESS, ADIE_SVC_STATUS_FAILURE, ADIE_SVC_STATUS_INUSE }; enum adie_block_enum_type{ MIC_BIAS, HSSD, HPH_PA }; enum adie_config_enum_type{ DISABLE, ENABLE }; struct adie_svc_client{ int client_id; int cb_id; enum adie_svc_status_type status; bool adie_svc_cb_done; struct mutex lock; wait_queue_head_t wq; struct msm_rpc_client *rpc_client; }; struct adie_svc_client_register_cb_cb_args { int cb_id; uint32_t size; int client_id; enum adie_block_enum_type adie_block; enum adie_svc_status_type status; enum adie_svc_client_operation client_operation; }; struct adie_svc_client_register_cb_args { int cb_id; }; struct adie_svc_client_deregister_cb_args { int client_id; }; struct adie_svc_config_adie_block_cb_args { int client_id; enum adie_block_enum_type adie_block; enum adie_config_enum_type config; }; int adie_svc_get(void); int adie_svc_put(int id); int adie_svc_config_adie_block(int id, enum adie_block_enum_type adie_block_type, bool enable); #endif
#ifndef __ASM_IDMAP_H #define __ASM_IDMAP_H #include <linux/compiler.h> #include <asm/pgtable.h> /* Tag a function as requiring to be executed via an identity mapping. */ #define __idmap __section(.idmap.text) noinline notrace extern pgd_t *idmap_pgd; void setup_mm_for_reboot(void); #endif /* __ASM_IDMAP_H */
/* -*- mode: C; c-file-style: "gnu"; indent-tabs-mode: nil; -*- */ /** * \file keybindings.h Grab and ungrab keys, and process the key events * * Performs global X grabs on the keys we need to be told about, like * the one to close a window. It also deals with incoming key events. */ /* * Copyright (C) 2001 Havoc Pennington * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as * published by the Free Software Foundation; either version 2 of the * License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, see <http://www.gnu.org/licenses/>. */ #ifndef META_KEYBINDINGS_H #define META_KEYBINDINGS_H #include "display-private.h" #include "window.h" #include "prefs.h" struct _MetaKeyHandler { char *name; MetaKeyHandlerFunc func; MetaKeyHandlerFunc default_func; gint data; gint flags; gpointer user_data; GDestroyNotify user_data_free_func; }; struct _MetaKeyBinding { const char *name; KeySym keysym; KeyCode keycode; unsigned int mask; MetaVirtualModifier modifiers; gboolean devirtualized; MetaKeyHandler *handler; }; void meta_display_init_keys (MetaDisplay *display); void meta_display_shutdown_keys (MetaDisplay *display); void meta_screen_grab_keys (MetaScreen *screen); void meta_screen_ungrab_keys (MetaScreen *screen); gboolean meta_screen_grab_all_keys (MetaScreen *screen, guint32 timestamp); void meta_screen_ungrab_all_keys (MetaScreen *screen, guint32 timestamp); void meta_window_grab_keys (MetaWindow *window); void meta_window_ungrab_keys (MetaWindow *window); gboolean meta_window_grab_all_keys (MetaWindow *window, guint32 timestamp); void meta_window_ungrab_all_keys (MetaWindow *window, guint32 timestamp); void meta_display_process_key_event (MetaDisplay *display, MetaWindow *window, XEvent *event); void meta_set_keybindings_disabled (MetaDisplay *display, gboolean setting); void meta_display_process_mapping_event (MetaDisplay *display, XEvent *event); gboolean meta_prefs_add_keybinding (const char *name, const char *schema, MetaKeyBindingAction action, MetaKeyBindingFlags flags); #endif
/* * Packet Filtering System based on BPF / LSF * * Author: Nuno Martins <nuno.martins@caixamagica.pt> * * (c) Copyright Caixa Magica Software, LDA., 2012 * (c) Copyright Universidade Nova de Lisboa, 2010-2011 * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See * the GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ #include <linux/kernel.h> #include <linux/list.h> #include <linux/stat.h> #include <linux/file.h> #include <linux/fs.h> #include <linux/path.h> #include <linux/dcache.h> #include <linux/socket.h> #include <linux/skbuff.h> #include <linux/tcp.h> #include <net/inet_sock.h> #include <linux/types.h> #include <linux/netdevice.h> #include <net/net_namespace.h> #include <linux/inetdevice.h> #include "pidmonitor.h" static void get_inet_sock_param(struct inet_sock *inetsock, struct packet_info *pi) { pi->port = inetsock->inet_num; pi->protocol = ((struct sock *)inetsock)->sk_protocol; if (pi->port == ntohs(inetsock->inet_sport)) { if (!inetsock->inet_rcv_saddr) pi->address = inetsock->inet_saddr; else pi->address = inetsock->inet_rcv_saddr; } else pi->address = inetsock->inet_daddr; pi->address = ntohl(pi->address); } int get_local_packet_info_from_file(struct file *file, struct packet_info *pi) { struct socket *socket = NULL; short type; unsigned short family; int err = 0; if (file != NULL) { struct dentry *dentry; struct inode *d_inode; dentry = file->f_dentry; if (dentry != NULL) { d_inode = dentry->d_inode; if (S_ISSOCK(d_inode->i_mode)) { socket = file->private_data; if (socket == NULL) { err = -5; goto out; } type = socket->type; if (socket->sk == NULL) { err = -6; goto out; } family = socket->sk->__sk_common.skc_family; if (family != AF_INET) { err = -4; goto out; } else { get_inet_sock_param((struct inet_sock *)(socket->sk), pi); err = 0; } } else { err = -1; } } else { err = -2; } } else { err = -3; } out: return err; } int get_local_packet_info_from_fd(unsigned int fd, struct packet_info *pi) { struct file *f = fget(fd); int ret = -1; if (f != NULL) { ret = get_local_packet_info_from_file(f, pi); fput(f); return ret; } return -3; }