text
stringlengths
4
6.14k
/* * File: wisaChangeClassMembers.h * Author: yvan * * Created on June 21, 2015, 1:21 PM */ #ifndef WISACHANGECLASSMEMBERS_H #define WISACHANGECLASSMEMBERS_H class wisaChangeClassMembers { public: wisaChangeClassMembers(); wisaChangeClassMembers(const wisaChangeClassMembers& orig); virtual ~wisaChangeClassMembers(); private: }; #endif /* WISACHANGECLASSMEMBERS_H */
/*! \file fbxprocessors_def.h */ #ifndef FBXFILESDK_FBXPROCESSORS_FBXPROCESSORS_DEF_H #define FBXFILESDK_FBXPROCESSORS_FBXPROCESSORS_DEF_H /************************************************************************************** Copyright (C) 2001 - 2009 Autodesk, Inc. and/or its licensors. All Rights Reserved. The coded instructions, statements, computer programs, and/or related material (collectively the "Data") in these files contain unpublished information proprietary to Autodesk, Inc. and/or its licensors, which is protected by Canada and United States of America federal copyright law and by international treaties. The Data may not be disclosed or distributed to third parties, in whole or in part, without the prior written consent of Autodesk, Inc. ("Autodesk"). THE DATA IS PROVIDED "AS IS" AND WITHOUT WARRANTY. ALL WARRANTIES ARE EXPRESSLY EXCLUDED AND DISCLAIMED. AUTODESK MAKES NO WARRANTY OF ANY KIND WITH RESPECT TO THE DATA, EXPRESS, IMPLIED OR ARISING BY CUSTOM OR TRADE USAGE, AND DISCLAIMS ANY IMPLIED WARRANTIES OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE OR USE. WITHOUT LIMITING THE FOREGOING, AUTODESK DOES NOT WARRANT THAT THE OPERATION OF THE DATA WILL BE UNINTERRUPTED OR ERROR FREE. IN NO EVENT SHALL AUTODESK, ITS AFFILIATES, PARENT COMPANIES, LICENSORS OR SUPPLIERS ("AUTODESK GROUP") BE LIABLE FOR ANY LOSSES, DAMAGES OR EXPENSES OF ANY KIND (INCLUDING WITHOUT LIMITATION PUNITIVE OR MULTIPLE DAMAGES OR OTHER SPECIAL, DIRECT, INDIRECT, EXEMPLARY, INCIDENTAL, LOSS OF PROFITS, REVENUE OR DATA, COST OF COVER OR CONSEQUENTIAL LOSSES OR DAMAGES OF ANY KIND), HOWEVER CAUSED, AND REGARDLESS OF THE THEORY OF LIABILITY, WHETHER DERIVED FROM CONTRACT, TORT (INCLUDING, BUT NOT LIMITED TO, NEGLIGENCE), OR OTHERWISE, ARISING OUT OF OR RELATING TO THE DATA OR ITS USE OR ANY OTHER PERFORMANCE, WHETHER OR NOT AUTODESK HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH LOSS OR DAMAGE. **************************************************************************************/ #include <fbxfilesdk/fbxfilesdk_def.h> #ifndef KFBX_DLL #define KFBX_DLL KFBX_DLLIMPORT #endif #define FBXPROCESSORS_NAMESPACE FBXFILESDK_NAMESPACE #endif // FBXFILESDK_FBXPROCESSORS_FBXPROCESSORS_DEF_H
/*-*- Mode: C; c-basic-offset: 8 -*-*/ /*** This file is part of RealtimeKit. Copyright 2009 Lennart Poettering RealtimeKit is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. RealtimeKit 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 RealtimeKit. If not, see <http://www.gnu.org/licenses/>. ***/ #include <errno.h> #include <string.h> #include <sched.h> #include <stdio.h> #include <sys/time.h> #include <sys/resource.h> #include "rtkit.h" #ifndef SCHED_RESET_ON_FORK #define SCHED_RESET_ON_FORK 0x40000000 #endif #ifndef RLIMIT_RTTIME #define RLIMIT_RTTIME 15 #endif static void print_status(const char *t) { int ret; if ((ret = sched_getscheduler(0)) < 0) { fprintf(stderr, "sched_getscheduler() failed: %s\n", strerror(errno)); return; } printf("%s:\n" "\tSCHED_RESET_ON_FORK: %s\n", t, (ret & SCHED_RESET_ON_FORK) ? "yes" : "no"); if ((ret & ~SCHED_RESET_ON_FORK) == SCHED_RR) { struct sched_param param; if (sched_getparam(0, &param) < 0) { fprintf(stderr, "sched_getschedparam() failed: %s\n", strerror(errno)); return; } printf("\tSCHED_RR with priority %i\n", param.sched_priority); } else if ((ret & ~SCHED_RESET_ON_FORK) == SCHED_OTHER) { errno = 0; ret = getpriority(PRIO_PROCESS, 0); if (errno != 0) { fprintf(stderr, "getpriority() failed: %s\n", strerror(errno)); return; } printf("\tSCHED_OTHER with nice level: %i\n", ret); } else fprintf(stderr, "Neither SCHED_RR nor SCHED_OTHER.\n"); } int main(int argc, char *argv[]) { DBusError error; DBusConnection *bus; int r, max_realtime_priority, min_nice_level; long long rttime_nsec_max; struct rlimit rlim; dbus_error_init(&error); if (!(bus = dbus_bus_get(DBUS_BUS_SYSTEM, &error))) { fprintf(stderr, "Failed to connect to system bus: %s\n", error.message); return 1; } if ((max_realtime_priority = rtkit_get_max_realtime_priority(bus)) < 0) fprintf(stderr, "Failed to retrieve max realtime priority: %s\n", strerror(-max_realtime_priority)); else printf("Max realtime priority is: %d\n", max_realtime_priority); if ((r = rtkit_get_min_nice_level(bus, &min_nice_level))) fprintf(stderr, "Failed to retrieve min nice level: %s\n", strerror(-r)); else printf("Min nice level is: %d\n", min_nice_level); if ((rttime_nsec_max = rtkit_get_rttime_nsec_max(bus)) < 0) fprintf(stderr, "Failed to retrieve rttime limit: %s\n", strerror(-rttime_nsec_max)); else printf("Rttime limit is: %lld ns\n", rttime_nsec_max); memset(&rlim, 0, sizeof(rlim)); rlim.rlim_cur = rlim.rlim_max = 100000000ULL; /* 100ms */ if ((setrlimit(RLIMIT_RTTIME, &rlim) < 0)) fprintf(stderr, "Failed to set RLIMIT_RTTIME: %s\n", strerror(errno)); print_status("before"); if ((r = rtkit_make_high_priority(bus, 0, -10)) < 0) fprintf(stderr, "Failed to become high priority: %s\n", strerror(-r)); else printf("Successfully became high priority.\n"); print_status("after high priority"); if ((r = rtkit_make_realtime(bus, 0, 10)) < 0) fprintf(stderr, "Failed to become realtime: %s\n", strerror(-r)); else printf("Successfully became realtime.\n"); print_status("after realtime"); dbus_connection_unref(bus); return 0; }
#include <stdio.h> #include <string.h> #include "iniparser.h" #include "utilities.h" #include "nsi.h" extern int DEBUGGING; int GetNSIValues(dictionary *scan_file_dict) { // GetNSIValues finds the first row of data and the datetime string from NSI formatted text files. // It reads up to four files specificed by nf, ff, nf2, and ff2 in the input dictionary. // If found, the resulting values are stored in the dictionary. int num_sections, i; const char *sectionname; const char *nf2; const char *ff2; char sectionname_nf2[30]; char sectionname_ff2[30]; // Loop on number of sections in the input dictionary: num_sections = iniparser_getnsec(scan_file_dict); for (i = 0; i < num_sections ;i++) { // If the section name starts with "scan" then load it: sectionname = iniparser_getsecname(scan_file_dict, i); if (!strncmp(sectionname, "scan", 4)) { // Read the nf and ff files from the scan: ReadNSIfile(scan_file_dict, sectionname, "nf"); ReadNSIfile(scan_file_dict, sectionname, "ff"); // Check for optional nf2, and ff2 keys: sprintf(sectionname_nf2, "%s:nf2", sectionname); sprintf(sectionname_ff2, "%s:ff2", sectionname); nf2 = iniparser_getstring(scan_file_dict, sectionname_nf2, "null"); ff2 = iniparser_getstring(scan_file_dict, sectionname_ff2, ""); // If both are found, read in those files: if ((strcmp(nf2, "null") != 0) && (strcmp(ff2, "null") != 0)) { ReadNSIfile(scan_file_dict,sectionname,"nf2"); ReadNSIfile(scan_file_dict,sectionname,"ff2"); } } } return 1; } int ReadNSIfile(dictionary *scan_file_dict, const char *sectionname, const char *nf_or_ff){ // Read a single nf or ff listing file as given by the keys in the given sectionname. FILE *fileptr; long int rowcount; char *ptr; char filenametemp[400]; char section_keytemp[30]; char section_keydatetime[30]; char buf[500]; long int listing_startrow = 0; char writeval[200]; char datetime[50]; // Make the key name for the listing filename: sprintf(section_keytemp, "%s:%s", sectionname, nf_or_ff); if (DEBUGGING) { printf("ReadNSIfile: looking for section_keytemp=%s\n", section_keytemp); } // Load the filename: strcpy(filenametemp, iniparser_getstring(scan_file_dict, section_keytemp, "null")); if (DEBUGGING) { printf("ReadNSIfile: file is %s=%s\n", nf_or_ff, filenametemp); } // Attempt to open the file for read: fileptr = fopen(filenametemp, "r"); if (fileptr == NULL) { printf("nsi: Could not open file = %s\n",filenametemp); // Fatal error if we can't open the specified file. exit(ERR_COULD_NOT_OPEN_FILE); // TODO: Unreachable code? return(-1); } // File is open. Start reading rows: rowcount = 0; do { ptr = fgets(buf, sizeof(buf), fileptr); if (ptr == NULL) break; // Quit loop at EOF. rowcount++; // Search for marker indicating data start in NSI text format listings: if (strstr(ptr, "line:")) { listing_startrow = rowcount + 1; // save the row count to the input dictionary as like "ff_startrow": strcat(section_keytemp, "_startrow"); sprintf(writeval, "%ld", listing_startrow); iniparser_set(scan_file_dict, section_keytemp, writeval); } // Search for marker indicating data and time in NSI text format listings: if (strstr(ptr, "date/time:")) { // Parse the datetime from the listing file: ptr = strtok(ptr, ":"); ptr = strtok(NULL, ","); strcpy(datetime, ptr); // Save to the datetime key in the input dictionary: sprintf(section_keydatetime, "%s:datetime", sectionname); iniparser_set(scan_file_dict, section_keydatetime, datetime); } // Loop will break at EOF. } while (1); if (DEBUGGING) { printf("%s listingstartrow=%ld datetime=%s\n", nf_or_ff, listing_startrow, datetime); //getchar(); } fclose(fileptr); return 1; }
/* * Copyright 2006-2010 by Ewan Meadows <sonny_jim@hotmail.com> * * This file is part of FreeWPC. * * FreeWPC 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. * * FreeWPC 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 FreeWPC; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ #include <freewpc.h> /* CALLSET_SECTION (master, __machine3__) */ __permanent__ U8 loop_master_hi; __permanent__ U8 combo_master_hi; __permanent__ U8 spawny_get_hi; __permanent__ char loop_master_initials[3]; __permanent__ char combo_master_initials[3]; U8 loop_master_initial_enter; U8 combo_master_initial_enter; extern U8 loops; extern U8 combos; extern U8 lucky_bounces; extern char initials_data[3]; void loop_master_entry_deff (void) { dmd_alloc_pair_clean (); font_render_string_center (&font_mono5, 64, 8, "CONGRATULATIONS"); font_render_string_center (&font_mono5, 64, 16, "NEW LOOP MASTER"); font_render_string_center (&font_var5, 64, 22, "ENTER INITIALS"); dmd_sched_transition (&trans_scroll_up); sound_send (SND_GLASS_BREAKS); dmd_show_low (); task_sleep_sec (3); deff_exit (); } void loop_master_exit_deff (void) { dmd_alloc_pair_clean (); sprintf ("%d LOOPS", loop_master_hi); font_render_string_center (&font_mono5, 64, 16, sprintf_buffer); sound_send (SND_CLOCK_GONG); dmd_show_low (); task_sleep_sec (2); deff_exit (); } void combo_master_entry_deff (void) { dmd_alloc_pair_clean (); font_render_string_center (&font_mono5, 64, 8, "CONGRATULATIONS"); font_render_string_center (&font_mono5, 64, 16, "NEW COMBO MASTER"); font_render_string_center (&font_var5, 64, 22, "ENTER INITIALS"); dmd_sched_transition (&trans_scroll_up); sound_send (SND_GLASS_BREAKS); dmd_show_low (); task_sleep_sec (3); deff_exit (); } void combo_master_exit_deff (void) { dmd_alloc_pair_clean (); sprintf ("%d COMBOS", combo_master_hi); font_render_string_center (&font_mono5, 64, 16, sprintf_buffer); sound_send (SND_CLOCK_GONG); dmd_show_low (); task_sleep_sec (2); deff_exit (); } void loop_master_check (void) { if (loop_master_initial_enter != 0 && loop_master_initial_enter <= num_players) { loop_master_initial_enter = 0; deff_start_sync (DEFF_LOOP_MASTER_ENTRY); SECTION_VOIDCALL (__common__, initials_enter); // loop_master_initials = initials_data; deff_start_sync (DEFF_LOOP_MASTER_EXIT); } } void combo_master_check (void) { if (combo_master_initial_enter != 0 && combo_master_initial_enter <= num_players) { combo_master_initial_enter = 0; deff_start_sync (DEFF_COMBO_MASTER_ENTRY); SECTION_VOIDCALL (__common__, initials_enter); // combo_master_initials = initials_data; deff_start_sync (DEFF_COMBO_MASTER_EXIT); } } CALLSET_ENTRY (master, start_game) { loop_master_initial_enter = 0; combo_master_initial_enter = 0; } CALLSET_ENTRY (master, factory_reset) { loop_master_hi = 0; combo_master_hi = 0; //loop_master_initials = "FEK"; //combo_master_initials = "FEK"; spawny_get_hi = 0; } CALLSET_ENTRY (master, amode_page) { dmd_sched_transition (&trans_vstripe_left2right); dmd_map_overlay (); dmd_clean_page_high (); dmd_clean_page_low (); //sprintf ("LOOP MASTER: %s %d LOOPS", loop_master_initials, loop_master_hi); psprintf ("LOOP MASTER: %d LOOP", "LOOP MASTER: %d LOOPS", loop_master_hi); font_render_string_center (&font_var5, 64, 10, sprintf_buffer); //sprintf ("COMBO MASTER: %s %d COMBOS", combo_master_initials, combo_master_hi); psprintf ("COMBO MASTER: %d COMBO", "COMBO MASTER: %d COMBOS", combo_master_hi); font_render_string_center (&font_var5, 64, 20, sprintf_buffer); show_text_on_stars (); }
/* ** objectivemoon.io stage1 feeler ** Copyright (C) 2014 Kwame ** ** This program is free software: you can redistribute it and/or modify ** it under the terms of the GNU General Public License as published by ** the Free Software Foundation, either version 3 of the License, or ** (at your option) any later version. ** ** This program is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. ** ** You should have received a copy of the GNU General Public License ** along with this program. If not, see <http://www.gnu.org/licenses/>. */ #include <unistd.h> #include "moon.h" #include "mooner.h" /* ** */ void get_opt(int ac,char **av) { int ch; while ((ch = getopt(ac, av, OPT_ARG)) != MINUS_ONE) switch (ch) { case CHAR_g: e->option |= OPT_GARBAGE; break; case CHAR_s: e->rmq_srv_dns_field=optarg; break; case CHAR_l: e->option |= OPT_LOG_FILE; e->log_file=optarg; init_log_file(); break; case CHAR_v: e->option |= OPT_VERBOSE; break; case CHAR_y: e->option |= OPT_SECRET_OPT; break; case CHAR_d: e->option |= OPT_DEBUG; break; case CHAR_p: e->option |= OPT_PORT; e->port = atoi(optarg); set_filter(&(e->filter), e->port); break; case CHAR_t: e->synflood_ret_time=atoi(optarg); break; case CHAR_i: e->option |= OPT_DEV; e->dev=optarg; break; case CHAR_r: e->option |= OPT_SET_RMQ; e->rmqserverlist=malloc(sizeof(*e->rmqserverlist) + 1); memset(e->rmqserverlist,0,sizeof(*e->rmqserverlist) + 1); e->rmqserverlist[0].target=server_name(optarg); e->rmqserverlist[0].port=server_port(optarg); e->rmqserver = e->rmqserverlist; break; case CHAR_u: usage(); mooner_exit(EXIT_USAGE); break; case CHAR_a: e->max_tab_size=atoi(optarg); if (e->msg_tab) free(e->msg_tab); e->msg_tab = init_msg_tab(e->max_tab_size); case CHAR_k: e->option |= OPT_CRYPTO; e->public_key_file=optarg; break; case CHAR_U: e->client_login=optarg; break; case CHAR_P: e->client_pass=optarg; break; case CHAR_T: e->client_login=optarg; e->client_pass=e->client_login; e->rmq_exchange=e->client_login; break; case CHAR_q: e->rmq_routingkey=optarg; break; case CHAR_e: e->rmq_exchange=optarg; break; case CHAR_V: printf(MY_RELEASE); printf("\n"); exit(0); default: usage(); mooner_exit(EXIT_BADOPT); } } char *server_name(char *str) { char *ret; int n; char *tmp; tmp=ret=str; n=0; while (*str) { if (*str == CHAR_COMMA) break; else n++; str++; } if (!*str) return (ret); if (n==0) usage(); ret=malloc(n+1); memcpy(ret, tmp, n); ret[n]=ZERO; return(ret); } int server_port(char *str) { while (*str && *str != CHAR_COMMA) str++; if (*str == CHAR_COMMA) return atoi(str+1); else return (DEF_RMQ_PORT); }
/* * Copyright (C) 2004-2009 Geometer Plus <contact@geometerplus.com> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA * 02110-1301, USA. */ #ifndef __ZLVIEWWIDGET_H__ #define __ZLVIEWWIDGET_H__ #include <string> #include "ZLView.h" class ZLView; class ZLViewWidget { protected: ZLViewWidget(ZLView::Angle initialAngle); public: virtual ~ZLViewWidget(); void setView(shared_ptr<ZLView> view); shared_ptr<ZLView> view() const; virtual void trackStylus(bool track) = 0; void rotate(ZLView::Angle rotation); ZLView::Angle rotation() const; virtual void popupMenu() = 0; virtual void closeDocument() = 0; virtual void processKeyReleaseEvent(int) = 0; virtual void setScrollbarEnabled(ZLView::Direction direction, bool enabled) = 0; virtual void setScrollbarPlacement(ZLView::Direction direction, bool standard) = 0; virtual void setScrollbarParameters(ZLView::Direction direction, size_t full, size_t from, size_t to) = 0; void onScrollbarMoved(ZLView::Direction direction, size_t full, size_t from, size_t to); void onScrollbarStep(ZLView::Direction direction, int steps); void onScrollbarPageStep(ZLView::Direction direction, int steps); virtual bool isHyperlinkSelected() { return false;}; private: void correctDirection(ZLView::Direction &direction, bool &invert); protected: virtual void repaint() = 0; private: shared_ptr<ZLView> myView; ZLView::Angle myRotation; friend class ZLApplication; }; inline ZLViewWidget::ZLViewWidget(ZLView::Angle initialAngle) : myView(), myRotation(initialAngle) {} inline ZLViewWidget::~ZLViewWidget() {} inline shared_ptr<ZLView> ZLViewWidget::view() const { return myView; } #endif /* __ZLVIEWWIDGET_H__ */
/* * linux/arch/unicore32/kernel/setup.h * * Code specific to PKUnity SoC and UniCore ISA * * Copyright (C) 2001-2010 GUAN Xue-tao * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as * published by the Free Software Foundation. */ #ifndef __UNICORE_KERNEL_SETUP_H__ #define __UNICORE_KERNEL_SETUP_H__ extern void paging_init(void); extern void puv3_core_init(void); extern void puv3_ps2_init(void); extern void pci_puv3_preinit(void); extern void __init puv3_init_gpio(void); extern void setup_mm_for_reboot(char mode); extern char __stubs_start[], __stubs_end[]; extern char __vectors_start[], __vectors_end[]; extern void kernel_thread_helper(void); extern void __init early_signal_init(void); #endif
/* z80.h: z80 emulation core Copyright (c) 1999-2003 Philip Kendall $Id: z80.h,v 1.11 2004/07/04 18:48:40 pak21 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. 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 Author contact information: E-mail: pak21-fuse@srcf.ucam.org Postal address: 15 Crescent Road, Wokingham, Berks, RG40 2DB, England */ #ifndef FUSE_Z80_H #define FUSE_Z80_H /* Union allowing a register pair to be accessed as bytes or as a word */ typedef union { #ifdef MSB_FIRST struct { uint8 h,l; } b; #else struct { uint8 l,h; } b; #endif uint16 w; } regpair; /* What's stored in the main processor */ typedef struct { regpair af,bc,de,hl; regpair af_,bc_,de_,hl_; regpair ix,iy; uint8 i; uint16 r; /* The low seven bits of the R register. 16 bits long so it can also act as an RZX instruction counter */ uint8 r7; /* The high bit of the R register */ regpair sp,pc; uint8 iff1, iff2, im; int halted; /* Interrupts were enabled at this time; do not accept any interrupts until z80_tstates > this value */ int32 interrupts_enabled_at; } processor; uint16 z80_getpc(void); void z80_init(void); void z80_reset(void); int z80_interrupt( void ); void z80_nmi( void ); int z80_do_opcode(void); void z80_enable_interrupts( void ); extern processor z80; extern const uint8 halfcarry_add_table[]; extern const uint8 halfcarry_sub_table[]; extern const uint8 overflow_add_table[]; extern const uint8 overflow_sub_table[]; extern uint8 sz53_table[]; extern uint8 sz53p_table[]; extern uint8 parity_table[]; extern uint64 z80_tstates, last_z80_tstates; extern void (*z80_writebyte)(uint16, uint8); extern uint8 (*z80_readbyte)(uint16); extern void (*z80_writeport)(uint16, uint8); extern uint8 (*z80_readport)(uint16); // Ok, I lied, not a macro! //Write mem static INLINE void Z80_WB_MACRO(uint16 A, uint8 V) { z80_tstates += 3; z80_writebyte(A, V); } // Write port static INLINE void Z80_WP_MACRO(uint16 A, uint8 V) { z80_tstates += 4; z80_writeport(A, V); } // Read mem static INLINE uint8 Z80_RB_MACRO(uint16 A) { z80_tstates += 3; return(z80_readbyte(A)); } // Read port static INLINE uint8 Z80_RP_MACRO(uint16 A) { z80_tstates += 4; return(z80_readport(A)); } void z80_set_interrupt(int set); #include "../../mednafen/state.h" int z80_state_action(StateMem *sm, int load, int data_only, const char *section_name); #endif /* #ifndef FUSE_Z80_H */
// Copyright (c) 2010 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef NET_BASE_LOAD_FLAGS_H_ #define NET_BASE_LOAD_FLAGS_H_ namespace net { enum { #define LOAD_FLAG(label, value) LOAD_ ## label = value, #include "net/base/load_flags_list.h" #undef LOAD_FLAG }; } #endif
/*************************************************************************** * This file is part of KDevelop * * Copyright 2007 Andreas Pakulat <apaku@gmx.de> * * Copyright 2006 Matt Rogers <mattr@kde.org> * * Copyright 2004 Jaroslaw Staniek <js@iidea.pl> * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU Library General Public License as * * published by the Free Software Foundation; either version 2 of the * * License, or (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU Library General Public * * License along with this program; if not, write to the * * Free Software Foundation, Inc., * * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * ***************************************************************************/ #ifndef PARSEREXPORT_H #define PARSEREXPORT_H /* needed for KDE_EXPORT macros */ #include <kdemacros.h> #ifndef KDEVQMAKEPARSER_EXPORT # ifdef MAKE_KDEV4QMAKEPARSER_LIB # define KDEVQMAKEPARSER_EXPORT KDE_EXPORT # else # define KDEVQMAKEPARSER_EXPORT KDE_IMPORT # endif #endif #endif
/* * Copyright (C) 2006, 2007 OpenedHand Ltd. * * Author: Jorn Baayen <jorn@openedhand.com> * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Library General Public License for more details. * * You should have received a copy of the GNU Library General Public * License along with this library; if not, write to the * Free Software Foundation, Inc., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. */ #ifndef __GSSDP_ERROR_H__ #define __GSSDP_ERROR_H__ #include <glib.h> G_BEGIN_DECLS GQuark gssdp_error_quark (void) G_GNUC_CONST; #define GSSDP_ERROR (gssdp_error_quark ()) typedef enum { GSSDP_ERROR_NO_IP_ADDRESS, GSSDP_ERROR_FAILED } GSSDPError; G_END_DECLS #endif /* __GSSDP_ERROR_H__ */
#ifndef _LCMBS_PROT_H #define _LCMBS_PROT_H #include <stdint.h> #include <stddef.h> #include "mbslave_util.h" #include "mbslave_conf.h" #define MB_FNK_READ_COIL_STATUS 1 #define MB_FNK_READ_INPUT_STATUS 2 #define MB_FNK_READ_HOLDING_REG 3 #define MB_FNK_READ_INPUT_REG 4 #define MB_FNK_FORCE_SINGLE_COIL 5 #define MB_FNK_PRESET_SINGLE_REG 6 #define MB_FNK_FORCE_MULTI_COIL 15 #define MB_FNK_PRESET_MULTI_REG 16 #define MB_ERR_OK 0 #define MB_ERR_INVALID_FUNCTION 1 #define MB_ERR_ILLEGAL_DATA_ADDRESS 2 #define MB_ERR_ILLEGAL_DATA_VALUE 3 #define MB_ERR_SLAVE_DEVICE_FAILURE 4 int lcmbsProtProc(LCMBS_CONF_SLAVE_T *slave, LCMBS_VECT_T *in, LCMBS_VECT_T *out); #endif
/* * QEMU model of the LatticeMico32 timer block. * * Copyright (c) 2010 Michael Walle <michael@walle.cc> * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, see <http://www.gnu.org/licenses/>. * * * Specification available at: * http://www.latticesemi.com/documents/mico32timer.pdf */ #include "hw.h" #include "sysbus.h" #include "trace.h" #include "qemu/timer.h" #include "ptimer.h" #include "qemu/error-report.h" #define DEFAULT_FREQUENCY (50*1000000) enum { R_SR = 0, R_CR, R_PERIOD, R_SNAPSHOT, R_MAX }; enum { SR_TO = (1 << 0), SR_RUN = (1 << 1), }; enum { CR_ITO = (1 << 0), CR_CONT = (1 << 1), CR_START = (1 << 2), CR_STOP = (1 << 3), }; struct LM32TimerState { SysBusDevice busdev; MemoryRegion iomem; QEMUBH *bh; ptimer_state *ptimer; qemu_irq irq; uint32_t freq_hz; uint32_t regs[R_MAX]; }; typedef struct LM32TimerState LM32TimerState; static void timer_update_irq(LM32TimerState *s) { int state = (s->regs[R_SR] & SR_TO) && (s->regs[R_CR] & CR_ITO); trace_lm32_timer_irq_state(state); qemu_set_irq(s->irq, state); } static uint64_t timer_read(void *opaque, hwaddr addr, unsigned size) { LM32TimerState *s = opaque; uint32_t r = 0; addr >>= 2; switch (addr) { case R_SR: case R_CR: case R_PERIOD: r = s->regs[addr]; break; case R_SNAPSHOT: r = (uint32_t)ptimer_get_count(s->ptimer); break; default: error_report("lm32_timer: read access to unknown register 0x" TARGET_FMT_plx, addr << 2); break; } trace_lm32_timer_memory_read(addr << 2, r); return r; } static void timer_write(void *opaque, hwaddr addr, uint64_t value, unsigned size) { LM32TimerState *s = opaque; trace_lm32_timer_memory_write(addr, value); addr >>= 2; switch (addr) { case R_SR: s->regs[R_SR] &= ~SR_TO; break; case R_CR: s->regs[R_CR] = value; if (s->regs[R_CR] & CR_START) { ptimer_run(s->ptimer, 1); } if (s->regs[R_CR] & CR_STOP) { ptimer_stop(s->ptimer); } break; case R_PERIOD: s->regs[R_PERIOD] = value; ptimer_set_count(s->ptimer, value); break; case R_SNAPSHOT: error_report("lm32_timer: write access to read only register 0x" TARGET_FMT_plx, addr << 2); break; default: error_report("lm32_timer: write access to unknown register 0x" TARGET_FMT_plx, addr << 2); break; } timer_update_irq(s); } static const MemoryRegionOps timer_ops = { .read = timer_read, .write = timer_write, .endianness = DEVICE_NATIVE_ENDIAN, .valid = { .min_access_size = 4, .max_access_size = 4, }, }; static void timer_hit(void *opaque) { LM32TimerState *s = opaque; trace_lm32_timer_hit(); s->regs[R_SR] |= SR_TO; if (s->regs[R_CR] & CR_CONT) { ptimer_set_count(s->ptimer, s->regs[R_PERIOD]); ptimer_run(s->ptimer, 1); } timer_update_irq(s); } static void timer_reset(DeviceState *d) { LM32TimerState *s = container_of(d, LM32TimerState, busdev.qdev); int i; for (i = 0; i < R_MAX; i++) { s->regs[i] = 0; } ptimer_stop(s->ptimer); } static int lm32_timer_init(SysBusDevice *dev) { LM32TimerState *s = FROM_SYSBUS(typeof(*s), dev); sysbus_init_irq(dev, &s->irq); s->bh = qemu_bh_new(timer_hit, s); s->ptimer = ptimer_init(s->bh); ptimer_set_freq(s->ptimer, s->freq_hz); memory_region_init_io(&s->iomem, &timer_ops, s, "timer", R_MAX * 4); sysbus_init_mmio(dev, &s->iomem); return 0; } static const VMStateDescription vmstate_lm32_timer = { .name = "lm32-timer", .version_id = 1, .minimum_version_id = 1, .minimum_version_id_old = 1, .fields = (VMStateField[]) { VMSTATE_PTIMER(ptimer, LM32TimerState), VMSTATE_UINT32(freq_hz, LM32TimerState), VMSTATE_UINT32_ARRAY(regs, LM32TimerState, R_MAX), VMSTATE_END_OF_LIST() } }; static Property lm32_timer_properties[] = { DEFINE_PROP_UINT32("frequency", LM32TimerState, freq_hz, DEFAULT_FREQUENCY), DEFINE_PROP_END_OF_LIST(), }; static void lm32_timer_class_init(ObjectClass *klass, void *data) { DeviceClass *dc = DEVICE_CLASS(klass); SysBusDeviceClass *k = SYS_BUS_DEVICE_CLASS(klass); k->init = lm32_timer_init; dc->reset = timer_reset; dc->vmsd = &vmstate_lm32_timer; dc->props = lm32_timer_properties; } static TypeInfo lm32_timer_info = { .name = "lm32-timer", .parent = TYPE_SYS_BUS_DEVICE, .instance_size = sizeof(LM32TimerState), .class_init = lm32_timer_class_init, }; static void lm32_timer_register_types(void) { type_register_static(&lm32_timer_info); } type_init(lm32_timer_register_types)
/** Author: Aleksandr Kibis Date: 11/4/2013 Project: HW6/proto.h **/ #include <iostream> #include <string> #include <vector> using namespace std; string reverse(string input); int findLargestInt(int* array);
#pragma once /* * Copyright (C) 2005-2013 Team XBMC * http://xbmc.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, or (at your option) * any later version. * * This Program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with XBMC; see the file COPYING. If not, see * <http://www.gnu.org/licenses/>. * */ #include <vector> #include "system.h" #include "cores/IPlayerCallback.h" #include "settings/lib/ISettingsHandler.h" #include "threads/CriticalSection.h" #include <string> // forward references class TiXmlElement; class CFileItem; class CPlayerCoreConfig; class CPlayerSelectionRule; class IPlayer; class CPlayerCoreFactory : public ISettingsHandler { public: static CPlayerCoreFactory& GetInstance(); virtual void OnSettingsLoaded() override; IPlayer* CreatePlayer(const std::string& nameId, IPlayerCallback& callback) const; void GetPlayers(const CFileItem& item, std::vector<std::string>&players) const; //Players supporting the specified file void GetPlayers(std::vector<std::string>&players, bool audio, bool video) const; //All audio players and/or video players void GetPlayers(std::vector<std::string>&players) const; //All players void GetPlayers(std::vector<std::string>&players, std::string &type) const; void GetRemotePlayers(std::vector<std::string>&players) const; //All remote players we can attach to std::string GetPlayerType(const std::string &player) const; bool PlaysAudio(const std::string &player) const; bool PlaysVideo(const std::string &player) const; std::string GetDefaultPlayer(const CFileItem& item) const; std::string SelectPlayerDialog(const std::vector<std::string>&players, float posX = 0, float posY = 0) const; std::string SelectPlayerDialog(float posX, float posY) const; void OnPlayerDiscovered(const std::string& id, const std::string& name); void OnPlayerRemoved(const std::string& id); protected: CPlayerCoreFactory(); CPlayerCoreFactory(const CPlayerCoreFactory&); CPlayerCoreFactory& operator=(CPlayerCoreFactory const&); virtual ~CPlayerCoreFactory(); int GetPlayerIndex(const std::string& strCoreName) const; bool LoadConfiguration(const std::string &file, bool clear); std::vector<CPlayerCoreConfig *> m_vecPlayerConfigs; std::vector<CPlayerSelectionRule *> m_vecCoreSelectionRules; CCriticalSection m_section; };
/* * Copyright (c) 2017, 2020, Oracle and/or its affiliates. * * All rights reserved. * * Redistribution and use in source and binary forms, with or without modification, are * permitted provided that the following conditions are met: * * 1. Redistributions of source code must retain the above copyright notice, this list of * conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright notice, this list of * conditions and the following disclaimer in the documentation and/or other materials provided * with the distribution. * * 3. Neither the name of the copyright holder nor the names of its contributors may be used to * endorse or promote products derived from this software without specific prior written * permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED * OF THE POSSIBILITY OF SUCH DAMAGE. */ #include <graalvm/llvm/polyglot.h> #include <truffle.h> typedef void *VALUE; VALUE global; VALUE **global_array; int main() { global = polyglot_import("object"); global_array = truffle_managed_malloc(sizeof(VALUE *) * 2); global_array[0] = &global; global_array[1] = NULL; void (*returnObject)(void *) = polyglot_import("returnObject"); returnObject(global); int index = 0; //return truffle_is_truffle_object(global_array[index]); return global_array[index] == NULL; }
/* * Winnov WNV1 codec * Copyright (c) 2005 Konstantin Shishkov * * This file is part of Libav. * * Libav 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. * * Libav 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 Libav; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ /** * @file * Winnov WNV1 codec. */ #include "avcodec.h" #include "get_bits.h" #include "internal.h" #include "mathops.h" typedef struct WNV1Context { AVCodecContext *avctx; int shift; GetBitContext gb; } WNV1Context; static const uint16_t code_tab[16][2] = { { 0x1FD, 9 }, { 0xFD, 8 }, { 0x7D, 7 }, { 0x3D, 6 }, { 0x1D, 5 }, { 0x0D, 4 }, { 0x005, 3 }, { 0x000, 1 }, { 0x004, 3 }, { 0x0C, 4 }, { 0x1C, 5 }, { 0x3C, 6 }, { 0x7C, 7 }, { 0xFC, 8 }, { 0x1FC, 9 }, { 0xFF, 8 } }; #define CODE_VLC_BITS 9 static VLC code_vlc; /* returns modified base_value */ static inline int wnv1_get_code(WNV1Context *w, int base_value) { int v = get_vlc2(&w->gb, code_vlc.table, CODE_VLC_BITS, 1); if (v == 15) return ff_reverse[get_bits(&w->gb, 8 - w->shift)]; else return base_value + ((v - 7) << w->shift); } static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame, AVPacket *avpkt) { WNV1Context * const l = avctx->priv_data; const uint8_t *buf = avpkt->data; int buf_size = avpkt->size; AVFrame * const p = data; unsigned char *Y,*U,*V; int i, j, ret; int prev_y = 0, prev_u = 0, prev_v = 0; uint8_t *rbuf; if (buf_size < 8) { av_log(avctx, AV_LOG_ERROR, "Packet is too short\n"); return AVERROR_INVALIDDATA; } rbuf = av_malloc(buf_size + FF_INPUT_BUFFER_PADDING_SIZE); if (!rbuf) { av_log(avctx, AV_LOG_ERROR, "Cannot allocate temporary buffer\n"); return AVERROR(ENOMEM); } if ((ret = ff_get_buffer(avctx, p, 0)) < 0) { av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n"); av_free(rbuf); return ret; } p->key_frame = 1; for (i = 8; i < buf_size; i++) rbuf[i] = ff_reverse[buf[i]]; init_get_bits(&l->gb, rbuf + 8, (buf_size - 8) * 8); if (buf[2] >> 4 == 6) l->shift = 2; else { l->shift = 8 - (buf[2] >> 4); if (l->shift > 4) { avpriv_request_sample(avctx, "Unknown WNV1 frame header value %i", buf[2] >> 4); l->shift = 4; } if (l->shift < 1) { avpriv_request_sample(avctx, "Unknown WNV1 frame header value %i", buf[2] >> 4); l->shift = 1; } } Y = p->data[0]; U = p->data[1]; V = p->data[2]; for (j = 0; j < avctx->height; j++) { for (i = 0; i < avctx->width / 2; i++) { Y[i * 2] = wnv1_get_code(l, prev_y); prev_u = U[i] = wnv1_get_code(l, prev_u); prev_y = Y[(i * 2) + 1] = wnv1_get_code(l, Y[i * 2]); prev_v = V[i] = wnv1_get_code(l, prev_v); } Y += p->linesize[0]; U += p->linesize[1]; V += p->linesize[2]; } *got_frame = 1; av_free(rbuf); return buf_size; } static av_cold int decode_init(AVCodecContext *avctx) { WNV1Context * const l = avctx->priv_data; static VLC_TYPE code_table[1 << CODE_VLC_BITS][2]; l->avctx = avctx; avctx->pix_fmt = AV_PIX_FMT_YUV422P; code_vlc.table = code_table; code_vlc.table_allocated = 1 << CODE_VLC_BITS; init_vlc(&code_vlc, CODE_VLC_BITS, 16, &code_tab[0][1], 4, 2, &code_tab[0][0], 4, 2, INIT_VLC_USE_NEW_STATIC); return 0; } AVCodec ff_wnv1_decoder = { .name = "wnv1", .long_name = NULL_IF_CONFIG_SMALL("Winnov WNV1"), .type = AVMEDIA_TYPE_VIDEO, .id = AV_CODEC_ID_WNV1, .priv_data_size = sizeof(WNV1Context), .init = decode_init, .decode = decode_frame, .capabilities = CODEC_CAP_DR1, };
#ifndef _RTL8712_RECV_H_ #define _RTL8712_RECV_H_ #include "osdep_service.h" #include "drv_types.h" #define NR_RECVBUFF (8) #define NR_PREALLOC_RECV_SKB (8) #define RXDESC_SIZE 24 #define RXDESC_OFFSET RXDESC_SIZE #define RECV_BLK_SZ 512 #define RECV_BLK_CNT 16 #define RECV_BLK_TH RECV_BLK_CNT #define MAX_RECVBUF_SZ (30720) /* 30K */ #define RECVBUFF_ALIGN_SZ 512 #define RSVD_ROOM_SZ (0) /*These definition is used for Rx packet reordering.*/ #define SN_LESS(a, b) (((a-b) & 0x800) != 0) #define SN_EQUAL(a, b) (a == b) #define REORDER_WAIT_TIME 30 /* (ms)*/ struct recv_stat { unsigned int rxdw0; unsigned int rxdw1; unsigned int rxdw2; unsigned int rxdw3; unsigned int rxdw4; unsigned int rxdw5; }; struct phy_cck_rx_status { /* For CCK rate descriptor. This is a unsigned 8:1 variable. * LSB bit present 0.5. And MSB 7 bts present a signed value. * Range from -64~+63.5. */ u8 adc_pwdb_X[4]; u8 sq_rpt; u8 cck_agc_rpt; }; struct phy_stat { unsigned int phydw0; unsigned int phydw1; unsigned int phydw2; unsigned int phydw3; unsigned int phydw4; unsigned int phydw5; unsigned int phydw6; unsigned int phydw7; }; #define PHY_STAT_GAIN_TRSW_SHT 0 #define PHY_STAT_PWDB_ALL_SHT 4 #define PHY_STAT_CFOSHO_SHT 5 #define PHY_STAT_CCK_AGC_RPT_SHT 5 #define PHY_STAT_CFOTAIL_SHT 9 #define PHY_STAT_RXEVM_SHT 13 #define PHY_STAT_RXSNR_SHT 15 #define PHY_STAT_PDSNR_SHT 19 #define PHY_STAT_CSI_CURRENT_SHT 21 #define PHY_STAT_CSI_TARGET_SHT 23 #define PHY_STAT_SIGEVM_SHT 25 #define PHY_STAT_MAX_EX_PWR_SHT 26 union recvstat { struct recv_stat recv_stat; unsigned int value[RXDESC_SIZE>>2]; }; struct recv_buf { struct list_head list; spinlock_t recvbuf_lock; u32 ref_cnt; struct _adapter *adapter; struct urb *purb; _pkt *pskb; u8 reuse; u8 irp_pending; u32 transfer_len; uint len; u8 *phead; u8 *pdata; u8 *ptail; u8 *pend; u8 *pbuf; u8 *pallocated_buf; }; /* head -----> data -----> payload tail -----> end -----> len = (unsigned int )(tail - data); */ struct recv_frame_hdr { struct list_head list; _pkt *pkt; _pkt *pkt_newalloc; struct _adapter *adapter; u8 fragcnt; struct rx_pkt_attrib attrib; uint len; u8 *rx_head; u8 *rx_data; u8 *rx_tail; u8 *rx_end; void *precvbuf; struct sta_info *psta; /*for A-MPDU Rx reordering buffer control*/ struct recv_reorder_ctrl *preorder_ctrl; }; union recv_frame { union { struct list_head list; struct recv_frame_hdr hdr; addr_t mem[RECVFRAME_HDR_ALIGN>>2]; } u; }; int r8712_init_recvbuf(struct _adapter *padapter, struct recv_buf *precvbuf); void r8712_rxcmd_event_hdl(struct _adapter *padapter, void *prxcmdbuf); s32 r8712_signal_scale_mapping(s32 cur_sig); void r8712_reordering_ctrl_timeout_handler(void *pcontext); #endif
#include "../os.h" #include <avr/io.h> // EXPECTED RUNNING ORDER: RR1,RR2,RR3,RR4...RR1,RR2,RR3 // // RR1 block on recv Recv // RR2 block on recv Recv // RR3 delay...................block on recv // RR4 delay.....Send CHAN c1=0; void DEBUG_INIT() { DDRB |= (1<<PB1); //pin 52 DDRB |= (1<<PB2); //pin 51 DDRB |= (1<<PB3); //pin 50 } void DEBUG_ON(int num) { switch (num) { case 1: PORTB |= (1<<PB1); break; case 2: PORTB |= (1<<PB2); break; case 3: PORTB |= (1<<PB3); break; default: break; } } void DEBUG_OFF(int num) { switch (num) { case 1: PORTB &= ~(1<<PB1); break; case 2: PORTB &= ~(1<<PB2); break; case 3: PORTB &= ~(1<<PB3); break; default: break; } } void Task_RR1() { Recv(c1); DEBUG_ON(1); for(;;); } void Task_RR2() { Recv(c1); DEBUG_ON(2); for(;;); } void Task_RR3() { unsigned int T = Now(); while(Now()-T<400) { Task_Next(); } Recv(c1); //Should never run. DEBUG_OFF(1); DEBUG_OFF(2); DEBUG_OFF(3); for(;;); } void Task_RR4() { unsigned int T = Now(); while(Now()-T < 50) { Task_Next(); } Send(c1, 0); DEBUG_ON(3); for(;;); } void a_main() { DEBUG_INIT(); Task_Create_RR(Task_RR1,0); Task_Create_RR(Task_RR2,0); Task_Create_RR(Task_RR3, 69); Task_Create_RR(Task_RR4,0); c1 = Chan_Init(); }
/* Describe vectors containing filter operations. Copyright (C) 2002-2014 Robert Lipe, robertlipe+source@gpsbabel.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 FILTER_VECS_H_INCLUDED_ #define FILTER_VECS_H_INCLUDED_ #include <QtCore/QString> // for QString #include <QtCore/QVector> // for QVector<>::iterator, QVector #include "defs.h" // for arglist_t #include "arcdist.h" // for ArcDistanceFilter #include "bend.h" // for BendFilter #include "discard.h" // for DiscardFilter #include "duplicate.h" // for DuplicateFilter #include "filter.h" // for Filter #include "height.h" // for HeightFilter #include "interpolate.h" // for InterpolateFilter #include "nukedata.h" // for NukeDataFilter #include "polygon.h" // for PolygonFilter #include "position.h" // for PositionFilter #include "radius.h" // for RadiusFilter #include "reverse_route.h" // for ReverseRouteFilter #include "smplrout.h" // for SimplifyRouteFilter #include "sort.h" // for SortFilter #include "stackfilter.h" // for StackFilter #include "swapdata.h" // for SwapDataFilter #include "trackfilter.h" // for TrackFilter #include "transform.h" // for TransformFilter #include "validate.h" // for ValidateFilter class FilterVecs { // Meyers Singleton public: static FilterVecs& Instance() { static FilterVecs instance; return instance; } FilterVecs(const FilterVecs&) = delete; FilterVecs& operator= (const FilterVecs&) = delete; FilterVecs(FilterVecs&&) = delete; FilterVecs& operator=(FilterVecs&&) = delete; private: FilterVecs() = default; ~FilterVecs() = default; private: struct fl_vecs_t { Filter* vec; QString name; QString desc; }; public: Filter* find_filter_vec(const QString& vecname); static void free_filter_vec(Filter* filter); void init_filter_vecs(); void exit_filter_vecs(); void disp_filter_vecs() const; void disp_filter_vec(const QString& vecname) const; void disp_filters(int version) const; bool validate_filters() const; private: static void disp_help_url(const fl_vecs_t& vec, const arglist_t* arg); static void disp_v1(const fl_vecs_t& vec); static bool validate_filter_vec(const fl_vecs_t& vec); private: ArcDistanceFilter arcdist; BendFilter bend; DiscardFilter discard; DuplicateFilter duplicate; HeightFilter height; InterpolateFilter interpolate; NukeDataFilter nukedata; PolygonFilter polygon; PositionFilter position; RadiusFilter radius; ReverseRouteFilter reverse_route; SimplifyRouteFilter routesimple; SortFilter sort; StackFilter stackfilt; SwapDataFilter swapdata; TrackFilter trackfilter; TransformFilter transform; ValidateFilter validate; const QVector<fl_vecs_t> filter_vec_list = { #if FILTERS_ENABLED { &arcdist, "arc", "Include Only Points Within Distance of Arc", }, { &bend, "bend", "Add points before and after bends in routes" }, { &discard, "discard", "Remove unreliable points with high hdop or vdop" }, { &duplicate, "duplicate", "Remove Duplicates", }, { &interpolate, "interpolate", "Interpolate between trackpoints" }, { &nukedata, "nuketypes", "Remove all waypoints, tracks, or routes" }, { &polygon, "polygon", "Include Only Points Inside Polygon", }, { &position, "position", "Remove Points Within Distance", }, { &radius, "radius", "Include Only Points Within Radius", }, { &routesimple, "simplify", "Simplify routes", }, { &sort, "sort", "Rearrange waypoints, routes and/or tracks by resorting", }, { &stackfilt, "stack", "Save and restore waypoint lists" }, { &reverse_route, "reverse", "Reverse stops within routes", }, { &trackfilter, "track", "Manipulate track lists" }, { &transform, "transform", "Transform waypoints into a route, tracks into routes, ..." }, { &height, "height", "Manipulate altitudes" }, { &swapdata, "swap", "Swap latitude and longitude of all loaded points" }, { &validate, "validate", "Validate internal data structures" } #elif defined (MINIMAL_FILTERS) { &trackfilter, "track", "Manipulate track lists" } #endif }; }; #endif // FILTER_VECS_H_INCLUDED_
/*** This file is part of systemd. Copyright 2003-2004 Greg Kroah-Hartman <greg@kroah.com> Copyright 2004-2012 Kay Sievers <kay@vrfy.org> systemd 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. systemd 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 systemd; If not, see <http://www.gnu.org/licenses/>. ***/ #include <stdio.h> #include <stddef.h> #include <stdlib.h> #include <string.h> #include <fcntl.h> #include <ctype.h> #include <errno.h> #include <unistd.h> #include <syslog.h> #include <grp.h> #include <sched.h> #include <sys/mount.h> #include <sys/signalfd.h> #include <linux/fs.h> #include "udev.h" #ifndef HAVE_UNSHARE #include <sys/syscall.h> /* Provide our own replacement with local reach*/ static inline int unshare (int x) { return syscall(SYS_unshare, x); } #endif #ifndef _USE_GNU /* Make sure CLONE_NEWNS macro is available */ #include <linux/sched.h> #endif void udev_main_log(struct udev *udev, int priority, const char *file, int line, const char *fn, const char *format, va_list args) {} static int fake_filesystems(void) { static const struct fakefs { const char *src; const char *target; const char *error; } fakefss[] = { { "test/sys", "/sys", "failed to mount test /sys" }, { "test/dev", "/dev", "failed to mount test /dev" }, { "test/run", "/run", "failed to mount test /run" }, { "test/run", "/etc/udev/rules.d", "failed to mount empty /etc/udev/rules.d" }, { "test/run", "/lib/udev/rules.d", "failed to mount empty /lib/udev/rules.d" }, }; unsigned int i; int err; err = unshare(CLONE_NEWNS); if (err < 0) { err = -errno; fprintf(stderr, "failed to call unshare(): %m\n"); goto out; } if (mount(NULL, "/", NULL, MS_PRIVATE|MS_REC, NULL) < 0) { err = -errno; fprintf(stderr, "failed to mount / as private: %m\n"); goto out; } for (i = 0; i < ELEMENTSOF(fakefss); i++) { err = mount(fakefss[i].src, fakefss[i].target, NULL, MS_BIND, NULL); if (err < 0) { err = -errno; fprintf(stderr, "%s %m", fakefss[i].error); return err; } } out: return err; } int main(int argc, char *argv[]) { struct udev *udev; struct udev_event *event = NULL; struct udev_device *dev = NULL; struct udev_rules *rules = NULL; char syspath[UTIL_PATH_SIZE]; const char *devpath; const char *action; sigset_t mask, sigmask_orig; int err; err = fake_filesystems(); if (err < 0) return EXIT_FAILURE; udev = udev_new(); if (udev == NULL) exit(EXIT_FAILURE); log_debug("version %s\n", VERSION); label_init("/dev"); sigprocmask(SIG_SETMASK, NULL, &sigmask_orig); action = argv[1]; if (action == NULL) { log_error("action missing\n"); goto out; } devpath = argv[2]; if (devpath == NULL) { log_error("devpath missing\n"); goto out; } rules = udev_rules_new(udev, 1); strscpyl(syspath, sizeof(syspath), "/sys", devpath, NULL); dev = udev_device_new_from_syspath(udev, syspath); if (dev == NULL) { log_debug("unknown device '%s'\n", devpath); goto out; } udev_device_set_action(dev, action); event = udev_event_new(dev); sigfillset(&mask); sigprocmask(SIG_SETMASK, &mask, &sigmask_orig); event->fd_signal = signalfd(-1, &mask, SFD_NONBLOCK|SFD_CLOEXEC); if (event->fd_signal < 0) { fprintf(stderr, "error creating signalfd\n"); goto out; } /* do what devtmpfs usually provides us */ if (udev_device_get_devnode(dev) != NULL) { mode_t mode = 0600; if (strcmp(udev_device_get_subsystem(dev), "block") == 0) mode |= S_IFBLK; else mode |= S_IFCHR; if (strcmp(action, "remove") != 0) { mkdir_parents_label(udev_device_get_devnode(dev), 0755); mknod(udev_device_get_devnode(dev), mode, udev_device_get_devnum(dev)); } else { unlink(udev_device_get_devnode(dev)); util_delete_path(udev, udev_device_get_devnode(dev)); } } err = udev_event_execute_rules(event, rules, &sigmask_orig); if (err == 0) udev_event_execute_run(event, NULL); out: if (event != NULL && event->fd_signal >= 0) close(event->fd_signal); udev_event_unref(event); udev_device_unref(dev); udev_rules_unref(rules); label_finish(); udev_unref(udev); if (err != 0) return EXIT_FAILURE; return EXIT_SUCCESS; }
// Copyright (C) 2005 Universitat d'Alacant / Universidad de Alicante // // 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 <https://www.gnu.org/licenses/>. #ifndef ANALYSIS_H #define ANALYSIS_H #include "morpheme.h" #include <ostream> #include <string> #include <vector> #include <lttoolbox/ustring.h> #include <lttoolbox/input_file.h> namespace Apertium { class Analysis { public: friend std::ostream &operator<<(std::ostream &Stream_, const Analysis &Analysis_); friend bool operator==(const Analysis &a, const Analysis &b); friend bool operator<(const Analysis &a, const Analysis &b); operator UString() const; void read(InputFile& in); std::vector<Morpheme> TheMorphemes; }; } #endif // ANALYSIS_H
#include <linux/module.h> #include <linux/device.h> #include <scsi/scsi_scan.h> static int __init wait_scan_init(void) { wait_for_device_probe(); scsi_complete_async_scans(); return 0; } static void __exit wait_scan_exit(void) { } MODULE_DESCRIPTION("SCSI wait for scans"); MODULE_AUTHOR("James Bottomley"); MODULE_LICENSE("GPL"); late_initcall(wait_scan_init); module_exit(wait_scan_exit);
/* execheap.c - Tests whether code in the heap can be executed * * Copyright (c)2003 by Peter Busser <peter@adamantix.org> * This file has been released under the GNU Public Licence version 2 or later */ #include <stdio.h> #include <string.h> #include <stdlib.h> #include "body.h" #include "shellcode.h" const char testname[] = "Executable heap "; void doit( void ) { char *buf; fptr func; buf = malloc( MAX_SHELLCODE_LEN ); if( buf == NULL ) { fprintf( stderr, "Out of memory\n" ); exit( 1 ); } copy_shellcode(buf); /* Convert the pointer to a function pointer */ func = (fptr)buf; /* Call the code in the buffer */ func(); /* It worked when the function returns */ itworked(); }
// // LSRequestDetailViewController.h // HttpWorker // // Created by 倪 李俊 on 14-9-22. // Copyright (c) 2014年 com.sinri. All rights reserved. // #import <UIKit/UIKit.h> #import "LSKVPairTableViewCell.h" #import "LSPostBodyTableViewCell.h" #import "LSHttpMethodTableViewCell.h" #import "LSFieldTableViewCell.h" #import "LSHttpDuty.h" #import "LSDutyFiles.h" @interface LSRequestDetailViewController : UITableViewController <LSRDCellDelegate,LSHttpDutyVCDelegate> { UIActivityIndicatorView * activityIndicatorView; UIView * activityIndicatorBackgroundView; } @property LSHttpDuty * httpDuty; @property BOOL hasPostBodyCell; @end
#pragma once #include <common/bitfield.h> #include <cstdint> #pragma pack(push, 1) namespace pm4 { namespace type3 { enum IT_OPCODE : uint32_t { DECAF_COPY_COLOR_TO_SCAN = 0x01, DECAF_SWAP_BUFFERS = 0x02, DECAF_CLEAR_COLOR = 0x03, DECAF_CLEAR_DEPTH_STENCIL = 0x04, DECAF_CAP_SYNC_REGISTERS = 0x05, DECAF_SET_BUFFER = 0x06, DECAF_COPY_SURFACE = 0x07, DECAF_DEBUGMARKER = 0x08, DECAF_OSSCREEN_FLIP = 0x09, DECAF_SET_SWAP_INTERVAL = 0x0A, NOP = 0x10, INDIRECT_BUFFER_END = 0x17, NEXTCHAR = 0x19, PLY_NEXTSCAN = 0x1D, SET_SCISSORS = 0x1E, OCCLUSION_QUERY = 0x1F, SET_PREDICATION = 0x20, REG_RMW = 0x21, COND_EXEC = 0x22, PRED_EXEC = 0x23, START_3D_CMDBUF = 0x24, START_2D_CMDBUF = 0x25, INDEX_BASE = 0x26, DRAW_INDEX_2 = 0x27, CONTEXT_CTL = 0x28, DRAW_INDEX_OFFSET = 0x29, INDEX_TYPE = 0x2A, DRAW_INDEX = 0x2B, LOAD_PALETTE = 0x2C, DRAW_INDEX_AUTO = 0x2D, DRAW_INDEX_IMMD = 0x2E, NUM_INSTANCES = 0x2F, DRAW_INDEX_MULTI_AUTO = 0x30, INDIRECT_BUFFER_PRIV = 0x32, STRMOUT_BUFFER_UPDATE = 0x34, DRAW_INDEX_OFFSET_2 = 0x35, DRAW_INDEX_MULTI_ELEMENT = 0x36, INDIRECT_BUFFER_MP = 0x38, MEM_SEMAPHORE = 0x39, MPEG_INDEX = 0x3A, COPY_DW = 0x3B, WAIT_REG_MEM = 0x3C, MEM_WRITE = 0x3D, PER_FRAME = 0x3E, INDIRECT_BUFFER = 0x3F, CP_DMA = 0x41, PFP_SYNC_ME = 0x42, SURFACE_SYNC = 0x43, ME_INITIALIZE = 0x44, COND_WRITE = 0x45, EVENT_WRITE = 0x46, EVENT_WRITE_EOP = 0x47, LOAD_SURFACE_PROBE = 0x48, SURFACE_PROBE = 0x49, PREAMBLE_CNTL = 0x4A, RB_OFFSET = 0x4B, GFX_CNTX_UPDATE = 0x52, BLK_CNTX_UPDATE = 0x53, IB_OFFSET = 0x54, INCR_UPDT_STATE = 0x55, INCR_UPDT_CONST = 0x56, ONE_REG_WRITE = 0x57, LOAD_CONFIG_REG = 0x60, LOAD_CONTEXT_REG = 0x61, LOAD_ALU_CONST = 0x62, LOAD_BOOL_CONST = 0x63, LOAD_LOOP_CONST = 0x64, LOAD_RESOURCE = 0x65, LOAD_SAMPLER = 0x66, LOAD_CTL_CONST = 0x67, SET_CONFIG_REG = 0x68, SET_CONTEXT_REG = 0x69, SET_ALU_CONST = 0x6A, SET_BOOL_CONST = 0x6B, SET_LOOP_CONST = 0x6C, SET_RESOURCE = 0x6D, SET_SAMPLER = 0x6E, SET_CTL_CONST = 0x6F, SET_RESOURCE_OFFSET = 0x70, STRMOUT_BASE_UPDATE = 0x72, SURFACE_BASE_UPDATE = 0x73, SET_ALL_CONTEXTS = 0x74, INDIRECT_BUFFER_BASE = 0x78, EXECUTE_IB2 = 0x79, PFP_REG_WR = 0x7B, FORWARD_HEADER = 0x7C, PAINT = 0x91, BITBLT = 0x92, HOSTDATA_BLT = 0x94, POLYLINE = 0x95, POLYSCANLINES = 0x98, PAINT_MULTI = 0x9A, BITBLT_MULTI = 0x9B, TRANS_BITBLT = 0x9C, DRAW_2D_DIRTY_AREA = 0xFF, }; } BITFIELD(Header, uint32_t) enum Type { Type0 = 0, Type1 = 1, Type2 = 2, Type3 = 3, }; BITFIELD_ENTRY(30, 2, Type, type); BITFIELD_END namespace type0 { BITFIELD(Header, uint32_t) BITFIELD_ENTRY(0, 16, uint32_t, baseIndex); BITFIELD_ENTRY(16, 14, uint32_t, count); BITFIELD_ENTRY(30, 2, pm4::Header::Type, type); BITFIELD_END } // type0 namespace type2 { BITFIELD(Header, uint32_t) BITFIELD_ENTRY(30, 2, pm4::Header::Type, type); BITFIELD_END } // type2 namespace type3 { BITFIELD(Header, uint32_t) BITFIELD_ENTRY(0, 1, bool, predicate); BITFIELD_ENTRY(8, 8, IT_OPCODE, opcode); BITFIELD_ENTRY(16, 14, uint32_t, size); BITFIELD_ENTRY(30, 2, pm4::Header::Type, type); BITFIELD_END } // type3 #pragma pack(pop) } // namespace pm4
/* staticitem.h created by infinitydao@gmail.com 09/2013 General Publing License v 2.0 */ #ifndef __ISTATICITEM_H__ #define __ISTATICITEM_H__ //========================================================================= namespace gelib { class IStaticItem : public IMapItem, public IDrawItem { public: explicit IStaticItem( maplib::ItemType type ); explicit IStaticItem( maplib::ItemType type, int x, int y, int width, int height, const QPixmap& pixmap ); explicit IStaticItem( const IStaticItem& other ); ~IStaticItem(); IStaticItem& operator=( const IStaticItem& other ); }; } //namespace gelib //========================================================================= #endif //__ISTATICITEM_H__
/* -*- c++ -*- ---------------------------------------------------------- LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator https://lammps.sandia.gov/, Sandia National Laboratories Steve Plimpton, sjplimp@sandia.gov Copyright (2003) Sandia Corporation. Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains certain rights in this software. This software is distributed under the GNU General Public License. See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ #ifdef FIX_CLASS FixStyle(GPU,FixGPU) #else #ifndef LMP_FIX_GPU_H #define LMP_FIX_GPU_H #include "fix.h" namespace LAMMPS_NS { class FixGPU : public Fix { public: FixGPU(class LAMMPS *, int, char **); ~FixGPU(); int setmask(); void init(); void setup(int); void min_setup(int); void post_force(int); void min_post_force(int); void post_force_respa(int, int, int); double memory_usage(); double binsize(const double subx, const double suby, const double subz, const int nlocal, const double cut); private: int _gpu_mode; int _nlevels_respa; double _particle_split; double _binsize; }; } #endif #endif /* ERROR/WARNING messages: E: Illegal ... command Self-explanatory. Check the input script syntax and compare to the documentation for the command. You can use -echo screen as a command-line option when running LAMMPS to see the offending line. E: No OpenMP support compiled in An OpenMP flag is set, but LAMMPS was not built with OpenMP support. E: GPU package does not (yet) work with atom_style template Self-explanatory. E: Cannot use package gpu neigh yes with triclinic box This is a current restriction in LAMMPS. W: Using package gpu without any pair style defined Self-explanatory. E: Cannot use neigh_modify exclude with GPU neighbor builds This is a current limitation of the GPU implementation in LAMMPS. E: Too many neighbors on GPU. Use neigh_modify one to increase limit. The expected maximum number of neighbors is determined in the GPU package automatically. This error means the actual number of neighbors is exceeding the expected value. Use neigh_modify one command to increase GPU allocations (e.g. doubling this value doubles the GPU allocation). */
////////////////////////////////////////////////////////////////////// // BasicSynth Composer // /// @file Main frame menu class declaration // // Copyright 2010, Daniel R. Mitchell // License: Creative Commons/GNU-GPL // (http://creativecommons.org/licenses/GPL/2.0/) // (http://www.gnu.org/licenses/gpl.html) ////////////////////////////////////////////////////////////////////// #ifndef MAIN_MENU_H #define MAIN_MENU_H class MainMenu : public Fl_Menu_Bar { public: MainMenu(int w); ~MainMenu(); void ItemSelected(ProjectItem *pi); void EditorSelected(EditorView *vw); void UpdateEditState(long flags); void UpdateRecentList(); void EnableProject(int e); void EnableFile(int e); void EnableItem(int ndx, int e); void CheckProject(int ck); void CheckKeyboard(int ck); }; #endif
#include <linux/kernel.h> #include <mach/dal.h> #define REMOTE_UNITTEST_DEVICEID 0xDA1DA1DA enum { DALRPC_TEST_API_0 = DALDEVICE_FIRST_DEVICE_API_IDX, DALRPC_TEST_API_1, DALRPC_TEST_API_2, DALRPC_TEST_API_3, DALRPC_TEST_API_4, DALRPC_TEST_API_5, DALRPC_TEST_API_6, DALRPC_TEST_API_7, DALRPC_TEST_API_8, DALRPC_TEST_API_9, DALRPC_TEST_API_10, DALRPC_TEST_API_11, DALRPC_TEST_API_12, DALRPC_TEST_API_13, DALRPC_TEST_API_14, DALRPC_TEST_API_15, DALRPC_TEST_API_16, DALRPC_TEST_API_17 }; #define REMOTE_UNITTEST_INARG_1 0x01010101 #define REMOTE_UNITTEST_INARG_2 0x20202020 #define REMOTE_UNITTEST_INARG_3 0x12121212 #define REMOTE_UNITTEST_INPUT_HANDLE 0xDA1FDA1F #define REMOTE_UNITTEST_OUTARG_1 0xBEEFDEAD #define REMOTE_UNITTEST_REGULAR_EVENT 0 #define REMOTE_UNITTEST_CALLBACK_EVENT 1 #define REMOTE_UNITTEST_BAD_PARAM 0x10 struct remote_test_data { uint32_t regular_event; uint32_t test[32]; uint32_t payload_event; }; static int remote_unittest_0(void *handle, uint32_t s1) { return dalrpc_fcn_0(DALRPC_TEST_API_0, handle, s1); } static int remote_unittest_1(void *handle, uint32_t s1, uint32_t s2) { return dalrpc_fcn_1(DALRPC_TEST_API_1, handle, s1, s2); } static int remote_unittest_2(void *handle, uint32_t s1, uint32_t *p_s2) { return dalrpc_fcn_2(DALRPC_TEST_API_2, handle, s1, p_s2); } static int remote_unittest_3(void *handle, uint32_t s1, uint32_t s2, uint32_t s3) { return dalrpc_fcn_3(DALRPC_TEST_API_3, handle, s1, s2, s3); } static int remote_unittest_4(void *handle, uint32_t s1, uint32_t s2, uint32_t *p_s3) { return dalrpc_fcn_4(DALRPC_TEST_API_4, handle, s1, s2, p_s3); } static int remote_unittest_5(void *handle, const void *ibuf, uint32_t ilen) { return dalrpc_fcn_5(DALRPC_TEST_API_5, handle, ibuf, ilen); } static int remote_unittest_6(void *handle, uint32_t s1, const void *ibuf, uint32_t ilen) { return dalrpc_fcn_6(DALRPC_TEST_API_6, handle, s1, ibuf, ilen); } static int remote_unittest_7(void *handle, const void *ibuf, uint32_t ilen, void *obuf, uint32_t olen, uint32_t *oalen) { return dalrpc_fcn_7(DALRPC_TEST_API_7, handle, ibuf, ilen, obuf, olen, oalen); } static int remote_unittest_8(void *handle, const void *ibuf, uint32_t ilen, void *obuf, uint32_t olen) { return dalrpc_fcn_8(DALRPC_TEST_API_8, handle, ibuf, ilen, obuf, olen); } static int remote_unittest_9(void *handle, void *obuf, uint32_t olen) { return dalrpc_fcn_9(DALRPC_TEST_API_9, handle, obuf, olen); } static int remote_unittest_10(void *handle, uint32_t s1, const void *ibuf, uint32_t ilen, void *obuf, uint32_t olen, uint32_t *oalen) { return dalrpc_fcn_10(DALRPC_TEST_API_10, handle, s1, ibuf, ilen, obuf, olen, oalen); } static int remote_unittest_11(void *handle, uint32_t s1, void *obuf, uint32_t olen) { return dalrpc_fcn_11(DALRPC_TEST_API_11, handle, s1, obuf, olen); } static int remote_unittest_12(void *handle, uint32_t s1, void *obuf, uint32_t olen, uint32_t *oalen) { return dalrpc_fcn_12(DALRPC_TEST_API_12, handle, s1, obuf, olen, oalen); } static int remote_unittest_13(void *handle, const void *ibuf, uint32_t ilen, const void *ibuf2, uint32_t ilen2, void *obuf, uint32_t olen) { return dalrpc_fcn_13(DALRPC_TEST_API_13, handle, ibuf, ilen, ibuf2, ilen2, obuf, olen); } static int remote_unittest_14(void *handle, const void *ibuf, uint32_t ilen, void *obuf, uint32_t olen, void *obuf2, uint32_t olen2, uint32_t *oalen2) { return dalrpc_fcn_14(DALRPC_TEST_API_14, handle, ibuf, ilen, obuf, olen, obuf2, olen2, oalen2); } static int remote_unittest_15(void *handle, const void *ibuf, uint32_t ilen, const void *ibuf2, uint32_t ilen2, void *obuf, uint32_t olen, uint32_t *oalen, void *obuf2, uint32_t olen2) { return dalrpc_fcn_15(DALRPC_TEST_API_15, handle, ibuf, ilen, ibuf2, ilen2, obuf, olen, oalen, obuf2, olen2); } static int remote_unittest_eventcfg(void *handle, const void *ibuf, uint32_t ilen) { return dalrpc_fcn_5(DALRPC_TEST_API_16, handle, ibuf, ilen); } static int remote_unittest_eventtrig(void *handle, uint32_t event_idx) { return dalrpc_fcn_0(DALRPC_TEST_API_17, handle, event_idx); }
#ifndef _TABLEH_ #define _TABLEH_ typedef struct entry { char lexem[256]; unsigned char token; unsigned char type; char* class; unsigned int address; struct entry* next; } Entry; Entry* addSymbol(char* lexem, unsigned char token); Entry* searchLexem(char* lexem); int printSymbolTable(); int initTable(); #define KEYWORDS 32 #endif
/* * * BATMAN Documentation * * Author : Anne Gabrielle Bowitz * Email : bowitz@stud.ntnu.no * Project : Simulation of a Secure Ad Hoc Network Routing protocol * Institution: NTNU (Norwegian University of Science & Technology), ITEM (Institute of Telematics) * */ #ifndef BATMAN_H_ #define BATMAN_H_ #endif /* BATMAN_H_ */
/* * Copyright 2016 MongoDB, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef MONGOC_CRYPTO_CNG_PRIVATE_H #define MONGOC_CRYPTO_CNG_PRIVATE_H BSON_BEGIN_DECLS void mongoc_crypto_cng_hmac_sha1 (mongoc_crypto_t *crypto, const void *key, int key_len, const unsigned char *d, int n, unsigned char *md /* OUT */); my_bool mongoc_crypto_cng_sha1 (mongoc_crypto_t *crypto, const unsigned char *input, const size_t input_len, unsigned char *output /* OUT */); BSON_END_DECLS #endif /* MONGOC_CRYPTO_CNG_PRIVATE_H */
/* * Copyright (c) 2002-2003, Intel Corporation. All rights reserved. * Created by: rusty.lynch REMOVE-THIS AT intel DOT com * This file is licensed under the GPL license. For the full content * of this license, see the COPYING file at the top level of this * source tree. Test case for assertion #5 of the sigaction system call that verifies setting the SA_INFO bit in the signal mask for SIGTSTP will result in sa_sigaction identifying the signal-catching function. */ #define _XOPEN_SOURCE 600 #include <signal.h> #include <stdio.h> #include <stdlib.h> #include <sys/wait.h> #include <unistd.h> #include "posixtest.h" int handler_called = 0; void handler(int signo, siginfo_t *info, void *context) { handler_called = 1; } int main() { struct sigaction act; act.sa_sigaction = handler; act.sa_flags = SA_SIGINFO; sigemptyset(&act.sa_mask); sigaddset(&act.sa_mask, SIGSTOP); if (sigaction(SIGTSTP, &act, 0) == -1) { printf("Unexpected error while attempting to setup test " "pre-conditions\n"); return PTS_UNRESOLVED; } if (raise(SIGTSTP) == -1) { printf("Unexpected error while attempting to setup test " "pre-conditions\n"); return PTS_UNRESOLVED; } if (handler_called) { printf("Test PASSED\n"); return PTS_PASS; } printf("Test FAILED\n"); return PTS_FAIL; }
#ifndef __MSM_ROTATOR_H__ #define __MSM_ROTATOR_H__ #include <linux/types.h> #include </home/manups4e/android/g3/include/linux/msm_mdp.h> #define MSM_ROTATOR_IOCTL_MAGIC 'R' #define MSM_ROTATOR_IOCTL_START \ _IOWR(MSM_ROTATOR_IOCTL_MAGIC, 1, struct msm_rotator_img_info) #define MSM_ROTATOR_IOCTL_ROTATE \ _IOW(MSM_ROTATOR_IOCTL_MAGIC, 2, struct msm_rotator_data_info) #define MSM_ROTATOR_IOCTL_FINISH \ _IOW(MSM_ROTATOR_IOCTL_MAGIC, 3, int) #define ROTATOR_VERSION_01 0xA5B4C301 enum rotator_clk_type { ROTATOR_CORE_CLK, ROTATOR_PCLK, ROTATOR_IMEM_CLK }; struct msm_rotator_img_info { unsigned int session_id; struct msmfb_img src; struct msmfb_img dst; struct mdp_rect src_rect; unsigned int dst_x; unsigned int dst_y; unsigned char rotations; int enable; unsigned int downscale_ratio; unsigned int secure; }; struct msm_rotator_data_info { int session_id; struct msmfb_data src; struct msmfb_data dst; unsigned int version_key; struct msmfb_data src_chroma; struct msmfb_data dst_chroma; }; struct msm_rot_clocks { const char *clk_name; enum rotator_clk_type clk_type; unsigned int clk_rate; }; struct msm_rotator_platform_data { unsigned int number_of_clocks; unsigned int hardware_version_number; struct msm_rot_clocks *rotator_clks; #ifdef CONFIG_MSM_BUS_SCALING struct msm_bus_scale_pdata *bus_scale_table; #endif char rot_iommu_split_domain; }; #endif
/* * Copyright (C) 2016, Nils Asmussen <nils@os.inf.tu-dresden.de> * Economic rights: Technische Universitaet Dresden (Germany) * * This file is part of M3 (Microkernel-based SysteM for Heterogeneous Manycores). * * M3 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. * * M3 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. */ #pragma once #include <base/util/String.h> #include <base/util/BitField.h> #include <base/EnvBackend.h> #include <base/PEDesc.h> #include <m3/com/RecvGate.h> #include <pthread.h> #include <assert.h> #include <string> namespace m3 { class Env; class HostEnvBackend : public EnvBackend { friend class Env; void exit(int) override { } public: explicit HostEnvBackend(); virtual ~HostEnvBackend(); }; class Env { struct Init { Init(); ~Init(); }; struct PostInit { PostInit(); }; public: static Env &get() { assert(_inst != nullptr); return *_inst; } static const char *executable_path() { if(*_exec == '\0') init_executable(); return _exec; } static const char *executable() { if(_exec_short_ptr == nullptr) init_executable(); return _exec_short_ptr; } explicit Env(EnvBackend *backend, int logfd); ~Env(); void reset(); WorkLoop *workloop() { return _backend->_workloop; } EnvBackend *backend() { return _backend; } bool is_kernel() const { return pe == 0; } int log_fd() const { return _logfd; } void log_lock() { pthread_mutex_lock(&_log_mutex); } void log_unlock() { pthread_mutex_unlock(&_log_mutex); } const String &shm_prefix() const { return _shm_prefix; } void print() const; void init_dtu(); void set_params(peid_t _pe, const std::string &shmprefix, label_t sysc_label, epid_t sysc_ep, word_t sysc_credits) { pe = _pe; pedesc = PEDesc(PEType::COMP_IMEM, m3::PEISA::X86, 1024 * 1024); _shm_prefix = shmprefix.c_str(); _sysc_label = sysc_label; _sysc_epid = sysc_ep; _sysc_credits = sysc_credits; } void exit(int code) NORETURN { ::exit(code); } private: static peid_t set_inst(Env *e) { _inst = e; // pe id return 0; } static void init_executable(); public: peid_t pe; PEDesc pedesc; private: EnvBackend *_backend; int _logfd; String _shm_prefix; label_t _sysc_label; epid_t _sysc_epid; word_t _sysc_credits; pthread_mutex_t _log_mutex; static const char *_exec_short_ptr; static char _exec[]; static char _exec_short[]; static Env *_inst; static Init _init; static PostInit _postInit; }; static inline Env *env() { return &Env::get(); } }
/**************************************************************************** ** ** 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 QIMPENMAINWINDOW_H #define QIMPENMAINWINDOW_H #include <QDialog> #include <QList> #include <qtopia/mstroke/profile.h> class QIMPenProfile; class CharSetDlg; class QDialog; class GeneralPref; class QTreeWidget; class QTreeWidgetItem; class QIMPenProfileEdit : public QDialog { Q_OBJECT public: QIMPenProfileEdit(QWidget *parent, Qt::WFlags f = 0); ~QIMPenProfileEdit(); private slots: void editItem(QTreeWidgetItem *); private: bool loadProfiles(); bool saveProfiles(); QList<QIMPenProfile *> profileList; QTreeWidget *lv; CharSetDlg *cdiag; QDialog *gdiag; GeneralPref *gpb; }; #endif
#include "bcplus/elements/detail/UnaryElement.h" namespace bcplus { namespace elements { namespace detail { template <typename BaseType, int type, typename Op, typename Sub, typename preOpString, typename postOpString, typename dt> UnaryElement<BaseType,type,Op,Sub,preOpString,postOpString,dt>::UnaryElement(typename Op::type const& op, Sub const* subformula, Location const& begin, Location const& end, bool parens) : BaseType((typename BaseType::Type::type)type, subformula->constants(), subformula->freeVariables(), subformula->cmask(), begin, end, parens), _op(op), _sub(subformula) { /* Intentionally left blank */ } template <typename BaseType, int type, typename Op, typename Sub, typename preOpString, typename postOpString, typename dt> UnaryElement<BaseType,type,Op,Sub,preOpString,postOpString,dt>::~UnaryElement() { /* Intentionally left blank */ } template <typename BaseType, int type, typename Op, typename Sub, typename preOpString, typename postOpString, typename dt> Element* UnaryElement<BaseType,type,Op,Sub,preOpString,postOpString,dt>::copy() const { return new UnaryElement<BaseType,type,Op,Sub,preOpString,postOpString,dt>(op(), (Sub const*)sub()->copy(), ((BaseType*)this)->beginLoc(), ((BaseType*)this)->endLoc(), ((BaseType*)this)->parens()); } template <typename BaseType, int type, typename Op, typename Sub, typename preOpString, typename postOpString, typename dt> void UnaryElement<BaseType,type,Op,Sub,preOpString,postOpString,dt>::output(std::ostream& out) const { preOpString pre; postOpString post; if (((BaseType*)this)->parens()) out << "("; out << pre(op()); sub()->output(out); out << post(op()); if (((BaseType*)this)->parens()) out << ")"; } template <typename BaseType, int type, typename Op, typename Sub, typename preOpString, typename postOpString, typename dt> DomainType::type UnaryElement<BaseType,type,Op,Sub,preOpString,postOpString,dt>::domainType() const { dt dtype; return dtype(op()); } }}}
/**************************************************************************** * CITYDECODER: A SPLAT! File Conversion Utility * * Copyright John A. Magliacane, KD2BD 2002 * * Last update: 08-Jan-2014 * ***************************************************************************** * * * This utility reads ASCII Metadata Cartographic Boundary Files available * * through the U.S. Census Bureau, and generates a lists of cities, states, * * counties, and county subdivisions along with the latitude and longitude * * corresponding to their geographic centers. Such data may be (optionally) * * sorted and written to files for use with SPLAT! software. This utility * * takes as an argument, a two-letter prefix plus the FIPS code for the * * state being processed (ie: "citydecoder pl34" will read files * * "pl34_d00.dat" and "pl34_d00a.dat", and "citydecoder cs34" will read * * files "cs34_d00.dat" and "cs34_d00a.dat", and produce a list of city * * names and geographical coordinates for the state of New Jersey. * * * * ZIP compressed data files for the United States may be downloaded from: * * * * http://web.archive.org/web/20130331172800/http://www.census.gov/geo/www/cob/cs2000.html * * * * Please select among the ARC/INFO Ungenerate (ASCII) formatted files at * * the bottom of each page, and use "unzip -a" or "gunzip" to properly * * unzip these files under Unix/Linux prior to use. * * * ***************************************************************************** * * * This program is free software; you can redistribute it and/or modify it * * under the terms of the GNU General Public License as published by the * * Free Software Foundation; either version 2 of the License or any later * * version. * * * * This program is distributed in the hope that it will 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. * * * ***************************************************************************** * To compile: gcc -Wall -O3 -s citydecoder.c -o citydecoder * *****************************************************************************/ #include <stdio.h> #include <string.h> #include <stdlib.h> int main(argc,argv) char argc, *argv[]; { int x, y, z; long attributefile_id, coordinatefile_id; char string[80], name[80], attributefilename[15], coordinatefilename[15]; double lat, lon; FILE *attributefile=NULL, *coordinatefile=NULL; if (argc==1) { fprintf(stderr,"\n*** Usage: citydecoder pl34 cs34 pl42 cs42 | sort > outputfile\n\n"); exit(1); } for (z=1; z<argc; z++) { sprintf(attributefilename,"%s_d00a.dat",argv[z]); sprintf(coordinatefilename,"%s_d00.dat",argv[z]); attributefile=fopen(attributefilename,"r"); coordinatefile=fopen(coordinatefilename,"r"); if (attributefile!=NULL && coordinatefile!=NULL) { /* Skip First ASCII File Record (ID=0) */ for (x=0; x<7; x++) fgets(string,80,attributefile); /* Skip yet another line for "cs" files */ if (argv[z][0]=='c' && argv[z][1]=='s') fgets(string,80,attributefile); do { string[0]=0; fscanf(coordinatefile,"%ld", &coordinatefile_id); if (coordinatefile_id!=-99999) { name[0]=0; fscanf(coordinatefile,"%lf %lf",&lon, &lat); /* Read ID Number From Attribute File */ fgets(string,80,attributefile); sscanf(string,"%ld",&attributefile_id); /* Skip Several Strings in Attribute File */ fgets(string,80,attributefile); fgets(string,80,attributefile); /* Skip a third line for "cs" files */ if (argv[z][0]=='c' && argv[z][1]=='s') fgets(string,80,attributefile); /* Read City Name From Attribute File */ fgets(string,80,attributefile); /* Strip "quote" characters from name */ for (x=2, y=0; string[x]!='"' && string[x]!=0; x++, y++) name[y]=string[x]; name[y]=0; /* Skip Two Strings in Attribute File */ fgets(string,80,attributefile); fgets(string,80,attributefile); /* Skip blank line between records */ fgets(string,80,attributefile); if (name[0]!=0 && name[0]!=' ' && feof(attributefile)==0 && attributefile_id==coordinatefile_id) printf("%s, %f, %f\n",name,lat,-lon); } /* Read to the end of the current coordinatefile record */ do { string[0]=0; fscanf(coordinatefile,"%s",string); } while (strncmp(string,"END",3)!=0 && feof(coordinatefile)==0); } while (feof(coordinatefile)==0); fclose(attributefile); fclose(coordinatefile); } else { /* Houston, We Have A Problem... */ fprintf(stderr,"%c\n",7); if (coordinatefile==NULL) fprintf(stderr,"*** Error opening coordinate file: \"%s\"!\n",coordinatefilename); if (attributefile==NULL) fprintf(stderr,"*** Error opening attribute file : \"%s\"!\n",attributefilename); fprintf(stderr,"\n"); } } exit(0); }
/* * Copyright (c) 2013 Sebastiaan Groot * * 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 UTIL_H #define UTIL_H #define SYSACCOUNT "maldetect" extern int set_rr_scheduler(void); extern int drop_privileges(void); #endif
/*************************************************************************** File : SignallingUndoCommand.h Project : SciDAVis / LabPlot -------------------------------------------------------------------- Copyright : (C) 2010 Knut Franke Email (use @ for *) : Knut.Franke*gmx.net Description : An undo command calling a method/signal/slot on a QObject on redo/undo. ***************************************************************************/ /*************************************************************************** * * * 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 SIGNALLING_UNDO_COMMAND_H #define SIGNALLING_UNDO_COMMAND_H #include <QUndoCommand> #include <QByteArray> class SignallingUndoCommand : public QUndoCommand { public: SignallingUndoCommand(const QString &text, QObject *receiver, const char *redoMethod, const char *undoMethod, QGenericArgument val0 = QGenericArgument(), QGenericArgument val1 = QGenericArgument(), QGenericArgument val2 = QGenericArgument(), QGenericArgument val3 = QGenericArgument()); ~SignallingUndoCommand(); virtual void redo(); virtual void undo(); private: QGenericArgument arg(int index); QByteArray m_redo, m_undo; QObject *m_receiver; int m_argument_count; int *m_argument_types; void **m_argument_data; }; #endif // ifndef SIGNALLING_UNDO_COMMAND_H
#include <linux/kernel.h> #include <linux/init.h> #include <linux/module.h> #include <linux/moduleparam.h> #include <linux/platform_device.h> #include <linux/gpio.h> #include <linux/interrupt.h> #include <linux/workqueue.h> #include <linux/slab.h> #include <linux/delay.h> #include <linux/usb.h> #include <linux/wakelock.h> #include <linux/spinlock.h> #include <linux/switch.h> #include <asm/io.h> #include <pm-irq.h> #include <gpio-names.h> #include <board-cardhu.h> #include "xmm6260_ril.h" static struct workqueue_struct *cwq; static struct switch_dev crash_sdev; static int do_crash_dump; static ssize_t crash_print_name(struct switch_dev *sdev, char *buf) { _xd("+++\n"); return sprintf(buf, "crash_dump_det\n"); } static ssize_t crash_print_state(struct switch_dev *sdev, char *buf) { int s; _xd("+++\n"); switch((s = switch_get_state(sdev))) { case 0: case 1: return sprintf(buf, "%d\n", s); break; } return -EINVAL; } static ssize_t show_cdump_state(struct device *class, struct device_attribute *attr, char *buf) { _xd("+++\n"); return sprintf(buf, "%d\n", do_crash_dump); } static ssize_t store_cdump_state(struct device *class, struct device_attribute *attr, const char *buf, size_t count) { int val; _xd("+++\n"); if (sscanf(buf, "%d", &val) != 1) return -EINVAL; switch (val) { case 0: case 1: do_crash_dump = val; break; default: return -EINVAL; break; } return count; } static struct device_attribute ril_crash_attr[] = { __ATTR(crash_dump_onoff, S_IRUSR | S_IWUSR | S_IRGRP, show_cdump_state, store_cdump_state), __ATTR_NULL }; /* used in PWR */ void ril_crash_set(void) { gpio_set_value(BB_GPIO_SW_SEL, 1); mdelay(1); gpio_set_value(BB_GPIO_VBUS_ON, 1); mdelay(1); } /* used in PWR */ void ril_crash_clear(void) { gpio_set_value(BB_GPIO_SW_SEL, 0); mdelay(1); gpio_set_value(BB_GPIO_VBUS_ON, 0); mdelay(1); } static void ril_crash_dump_work(struct work_struct *work) { _xd("+++\n"); disable_irq(gpio_to_irq(XMM_GPIO_IPC_HSIC_SUS_REQ)); xmm6260_modem_crash_dump(0); msleep(200); gpio_set_value(BB_GPIO_SW_SEL, 1); mdelay(5); gpio_set_value(BB_GPIO_VBUS_ON, 1); mdelay(5); xmm6260_modem_crash_dump(1); switch_set_state(&crash_sdev, 1); } static DECLARE_WORK(crash_work, ril_crash_dump_work); irqreturn_t ril_ipc_sus_req_irq(int irq, void *dev_id) { // _xd("+++\n"); if (do_crash_dump) if (gpio_get_value(XMM_GPIO_IPC_HSIC_SUS_REQ) == 1) { _xi("do_crash_dump is on!\n"); queue_work(cwq, &crash_work); } return IRQ_HANDLED; } int xmm_crash_init(struct device *rdev, struct workqueue_struct *wq) { int rv, f, r; _xd("+++\n"); cwq = wq; for (f = 0; f < (ARRAY_SIZE(ril_crash_attr) - 1); f++) { rv = device_create_file(rdev, &ril_crash_attr[f]); if (rv < 0) { _xe("create file %d failed, err = %d\n", f, rv); goto error0; } } crash_sdev.name = "crash_dump_det"; crash_sdev.print_name = crash_print_name; crash_sdev.print_state = crash_print_state; rv = switch_dev_register(&crash_sdev); if (rv < 0) { _xe("!switch_dev_register()\n"); goto error0; } rv = request_irq(gpio_to_irq(XMM_GPIO_IPC_HSIC_SUS_REQ), ril_ipc_sus_req_irq, IRQF_TRIGGER_RISING, "IPC_MOD_SUS_REQ", NULL); if (rv < 0) { _xe("!request_irq()\n"); goto error1; } return 0; error1: switch_dev_unregister(&crash_sdev); error0: for (r = 0; r < f; r++) device_remove_file(rdev, &ril_crash_attr[r]); return rv; } int xmm_crash_exit(struct device *rdev) { int r; _xd("+++\n"); free_irq(gpio_to_irq(XMM_GPIO_IPC_HSIC_SUS_REQ), NULL); switch_dev_unregister(&crash_sdev); for (r = 0; r < (ARRAY_SIZE(ril_crash_attr) - 1); r++) device_remove_file(rdev, &ril_crash_attr[r]); return 0; }
/** * @file status.c * @author Joe Wingbermuehle * @date 2004-2006 * * @brief Functions for display window move/resize status. * */ #include "jwm.h" #include "status.h" #include "font.h" #include "screen.h" #include "color.h" #include "main.h" #include "client.h" #include "error.h" #include "settings.h" static Window statusWindow; static unsigned int statusWindowHeight; static unsigned int statusWindowWidth; static int statusWindowX, statusWindowY; static void CreateMoveResizeWindow(const ClientNode *np, StatusWindowType type); static void DrawMoveResizeWindow(const ClientNode *np, StatusWindowType type); static void DestroyMoveResizeWindow(); static void GetMoveResizeCoordinates(const ClientNode *np, StatusWindowType type, int *x, int *y); /** Get the location to place the status window. */ void GetMoveResizeCoordinates(const ClientNode *np, StatusWindowType type, int *x, int *y) { const ScreenType *sp; if(type == SW_WINDOW) { *x = np->x + (np->width - statusWindowWidth) / 2; *y = np->y + (np->height - statusWindowHeight) / 2; return; } sp = GetCurrentScreen(np->x, np->y); if(type == SW_CORNER) { *x = sp->x; *y = sp->y; return; } /* SW_SCREEN */ *x = sp->x + (sp->width - statusWindowWidth) / 2; *y = sp->y + (sp->height - statusWindowHeight) / 2; } /** Create the status window. */ void CreateMoveResizeWindow(const ClientNode *np, StatusWindowType type) { XSetWindowAttributes attrs; if(type == SW_OFF) { return; } statusWindowHeight = GetStringHeight(FONT_MENU) + 8; statusWindowWidth = GetStringWidth(FONT_MENU, " 00000 x 00000 "); GetMoveResizeCoordinates(np, type, &statusWindowX, &statusWindowY); attrs.background_pixel = colors[COLOR_MENU_BG]; attrs.save_under = True; attrs.override_redirect = True; statusWindow = JXCreateWindow(display, rootWindow, statusWindowX, statusWindowY, statusWindowWidth, statusWindowHeight, 0, CopyFromParent, InputOutput, CopyFromParent, CWBackPixel | CWOverrideRedirect | CWSaveUnder, &attrs); JXMapRaised(display, statusWindow); } /** Draw the status window. */ void DrawMoveResizeWindow(const ClientNode *np, StatusWindowType type) { int x, y; GetMoveResizeCoordinates(np, type, &x, &y); if(x != statusWindowX || y != statusWindowX) { statusWindowX = x; statusWindowY = y; JXMoveResizeWindow(display, statusWindow, x, y, statusWindowWidth, statusWindowHeight); } /* Clear the background. */ JXClearWindow(display, statusWindow); /* Draw a border. */ JXSetForeground(display, rootGC, colors[COLOR_MENU_DOWN]); JXDrawRectangle(display, statusWindow, rootGC, 0, 0, statusWindowWidth - 1, statusWindowHeight - 1); } /** Destroy the status window. */ void DestroyMoveResizeWindow() { if(statusWindow != None) { JXDestroyWindow(display, statusWindow); statusWindow = None; } } /** Create a move status window. */ void CreateMoveWindow(ClientNode *np) { CreateMoveResizeWindow(np, settings.moveStatusType); } /** Update the move status window. */ void UpdateMoveWindow(ClientNode *np) { char str[80]; unsigned int width; if(settings.moveStatusType == SW_OFF) { return; } DrawMoveResizeWindow(np, settings.moveStatusType); snprintf(str, sizeof(str), "(%d, %d)", np->x, np->y); width = GetStringWidth(FONT_MENU, str); RenderString(statusWindow, FONT_MENU, COLOR_MENU_FG, (statusWindowWidth - width) / 2, 4, rootWidth, str); } /** Destroy the move status window. */ void DestroyMoveWindow() { DestroyMoveResizeWindow(); } /** Create a resize status window. */ void CreateResizeWindow(ClientNode *np) { CreateMoveResizeWindow(np, settings.resizeStatusType); } /** Update the resize status window. */ void UpdateResizeWindow(ClientNode *np, int gwidth, int gheight) { char str[80]; unsigned int fontWidth; if(settings.resizeStatusType == SW_OFF) { return; } DrawMoveResizeWindow(np, settings.resizeStatusType); snprintf(str, sizeof(str), "%d x %d", gwidth, gheight); fontWidth = GetStringWidth(FONT_MENU, str); RenderString(statusWindow, FONT_MENU, COLOR_MENU_FG, (statusWindowWidth - fontWidth) / 2, 4, rootWidth, str); } /** Destroy the resize status window. */ void DestroyResizeWindow() { DestroyMoveResizeWindow(); }
// PerigeeCopy (C) 2004-2010 Jeremy Stanley // This program is licensed under the terms of the GNU GPL; see license.txt for details. #if !defined(AFX_DIALOGFAILEDFILES_H__C71AD0FA_61A8_4F49_975A_EB9380731E12__INCLUDED_) #define AFX_DIALOGFAILEDFILES_H__C71AD0FA_61A8_4F49_975A_EB9380731E12__INCLUDED_ #if _MSC_VER > 1000 #pragma once #endif // _MSC_VER > 1000 // DialogFailedFiles.h : header file // #include "PerigeeJob.h" #include "SizeHelper.h" ///////////////////////////////////////////////////////////////////////////// // CDialogFailedFiles dialog class CDialogFailedFiles : public CDialog { // Construction public: CDialogFailedFiles(CWnd* pParent, const PerigeeJob::file_list &errors); // standard constructor // Dialog Data //{{AFX_DATA(CDialogFailedFiles) enum { IDD = IDD_FAILED_FILES }; CButton m_btnTryAgain; CString m_log; //}}AFX_DATA // Overrides // ClassWizard generated virtual function overrides //{{AFX_VIRTUAL(CDialogFailedFiles) protected: virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support //}}AFX_VIRTUAL // Implementation protected: const PerigeeJob::file_list &m_errors; SizeHelper m_sizer; // Generated message map functions //{{AFX_MSG(CDialogFailedFiles) virtual BOOL OnInitDialog(); afx_msg void OnSize(UINT nType, int cx, int cy); afx_msg void OnGetMinMaxInfo(MINMAXINFO FAR* lpMMI); //}}AFX_MSG DECLARE_MESSAGE_MAP() }; //{{AFX_INSERT_LOCATION}} // Microsoft Visual C++ will insert additional declarations immediately before the previous line. #endif // !defined(AFX_DIALOGFAILEDFILES_H__C71AD0FA_61A8_4F49_975A_EB9380731E12__INCLUDED_)
/* * Copyright (C) 2005-2012 MaNGOS <http://getmangos.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 MANGOS_CELL_H #define MANGOS_CELL_H #include "GameSystem/TypeContainer.h" #include "GameSystem/TypeContainerVisitor.h" #include "GridDefines.h" #include <cmath> class Map; class WorldObject; struct MANGOS_DLL_DECL CellArea { CellArea() {} CellArea(CellPair low, CellPair high) : low_bound(low), high_bound(high) {} bool operator!() const { return low_bound == high_bound; } void ResizeBorders(CellPair& begin_cell, CellPair& end_cell) const { begin_cell = low_bound; end_cell = high_bound; } CellPair low_bound; CellPair high_bound; }; struct MANGOS_DLL_DECL Cell { Cell() { data.All = 0; } Cell(const Cell& cell) { data.All = cell.data.All; } explicit Cell(CellPair const& p); void Compute(uint32& x, uint32& y) const { x = data.Part.grid_x * MAX_NUMBER_OF_CELLS + data.Part.cell_x; y = data.Part.grid_y * MAX_NUMBER_OF_CELLS + data.Part.cell_y; } bool DiffCell(const Cell& cell) const { return(data.Part.cell_x != cell.data.Part.cell_x || data.Part.cell_y != cell.data.Part.cell_y); } bool DiffGrid(const Cell& cell) const { return(data.Part.grid_x != cell.data.Part.grid_x || data.Part.grid_y != cell.data.Part.grid_y); } uint32 CellX() const { return data.Part.cell_x; } uint32 CellY() const { return data.Part.cell_y; } uint32 GridX() const { return data.Part.grid_x; } uint32 GridY() const { return data.Part.grid_y; } bool NoCreate() const { return data.Part.nocreate; } void SetNoCreate() { data.Part.nocreate = 1; } GridPair gridPair() const { return GridPair(GridX(), GridY()); } CellPair cellPair() const { return CellPair( data.Part.grid_x * MAX_NUMBER_OF_CELLS + data.Part.cell_x, data.Part.grid_y * MAX_NUMBER_OF_CELLS + data.Part.cell_y); } Cell& operator=(const Cell& cell) { data.All = cell.data.All; return *this; } bool operator==(const Cell& cell) const { return (data.All == cell.data.All); } bool operator!=(const Cell& cell) const { return !operator==(cell); } union { struct { unsigned grid_x : 6; unsigned grid_y : 6; unsigned cell_x : 6; unsigned cell_y : 6; unsigned nocreate : 1; unsigned reserved : 7; } Part; uint32 All; } data; template<class T, class CONTAINER> void Visit(const CellPair& cellPair, TypeContainerVisitor<T, CONTAINER> &visitor, Map& m, float x, float y, float radius) const; template<class T, class CONTAINER> void Visit(const CellPair& cellPair, TypeContainerVisitor<T, CONTAINER> &visitor, Map& m, const WorldObject& obj, float radius) const; static CellArea CalculateCellArea(float x, float y, float radius); template<class T> static void VisitGridObjects(const WorldObject* obj, T& visitor, float radius, bool dont_load = true); template<class T> static void VisitWorldObjects(const WorldObject* obj, T& visitor, float radius, bool dont_load = true); template<class T> static void VisitAllObjects(const WorldObject* obj, T& visitor, float radius, bool dont_load = true); template<class T> static void VisitGridObjects(float x, float y, Map* map, T& visitor, float radius, bool dont_load = true); template<class T> static void VisitWorldObjects(float x, float y, Map* map, T& visitor, float radius, bool dont_load = true); template<class T> static void VisitAllObjects(float x, float y, Map* map, T& visitor, float radius, bool dont_load = true); private: template<class T, class CONTAINER> void VisitCircle(TypeContainerVisitor<T, CONTAINER> &, Map&, const CellPair& , const CellPair&) const; }; #endif
/* X-Chat * Copyright (C) 1998 Peter Zelezny. * * 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 */ #include <stdio.h> #include <string.h> #include <stdlib.h> #include "fe-gtk.h" #include "../common/xchat.h" #include "../common/xchatc.h" #include "../common/cfgfiles.h" #include "../common/fe.h" #include "../common/url.h" #include "../common/tree.h" #include "gtkutil.h" #include "menu.h" #include "maingui.h" #include "urlgrab.h" /* model for the URL treeview */ enum { URL_COLUMN, N_COLUMNS }; static GtkWidget *urlgrabberwindow = 0; static gboolean url_treeview_url_clicked_cb (GtkWidget *view, GdkEventButton *event, gpointer data) { GtkTreeIter iter; gchar *url; GtkTreeSelection *sel; GtkTreePath *path; GtkTreeView *tree = GTK_TREE_VIEW (view); if (!event || !gtk_tree_view_get_path_at_pos (tree, event->x, event->y, &path, 0, 0, 0)) return FALSE; /* select what they right-clicked on */ sel = gtk_tree_view_get_selection (tree); gtk_tree_selection_unselect_all (sel); gtk_tree_selection_select_path (sel, path); gtk_tree_path_free (path); if (!gtkutil_treeview_get_selected (GTK_TREE_VIEW (view), &iter, URL_COLUMN, &url, -1)) return FALSE; switch (event->button) { case 1: if (event->type == GDK_2BUTTON_PRESS) fe_open_url (url); break; case 3: menu_urlmenu (event, url); break; default: break; } g_free (url); return FALSE; } static GtkWidget * url_treeview_new (GtkWidget *box) { GtkListStore *store; GtkWidget *view; store = gtk_list_store_new (N_COLUMNS, G_TYPE_STRING); g_return_val_if_fail (store != NULL, NULL); view = gtkutil_treeview_new (box, GTK_TREE_MODEL (store), NULL, URL_COLUMN, _("URL"), -1); g_signal_connect (G_OBJECT (view), "button_press_event", G_CALLBACK (url_treeview_url_clicked_cb), NULL); /* don't want column headers */ gtk_tree_view_set_headers_visible (GTK_TREE_VIEW (view), FALSE); gtk_widget_show (view); return view; } static void url_closegui (GtkWidget *wid, gpointer userdata) { urlgrabberwindow = 0; } static void url_button_clear (void) { GtkListStore *store; url_clear (); store = GTK_LIST_STORE (g_object_get_data (G_OBJECT (urlgrabberwindow), "model")); gtk_list_store_clear (store); } static void url_button_copy (GtkWidget *widget, gpointer data) { GtkTreeView *view = GTK_TREE_VIEW (data); GtkTreeIter iter; gchar *url = NULL; if (gtkutil_treeview_get_selected (view, &iter, URL_COLUMN, &url, -1)) { gtkutil_copy_to_clipboard (GTK_WIDGET (view), NULL, url); g_free (url); } } static void url_save_callback (void *arg1, char *file) { if (file) { url_save_tree (file, "w", TRUE); } } static void url_button_save (void) { gtkutil_file_req (_("Select an output filename"), url_save_callback, NULL, NULL, NULL, FRF_WRITE); } void fe_url_add (const char *urltext) { GtkListStore *store; GtkTreeIter iter; gboolean valid; if (urlgrabberwindow) { store = GTK_LIST_STORE (g_object_get_data (G_OBJECT (urlgrabberwindow), "model")); gtk_list_store_prepend (store, &iter); gtk_list_store_set (store, &iter, URL_COLUMN, urltext, -1); /* remove any overflow */ if (prefs.pchat_url_grabber_limit > 0) { valid = gtk_tree_model_iter_nth_child ( GTK_TREE_MODEL (store), &iter, NULL, prefs.pchat_url_grabber_limit); while (valid) valid = gtk_list_store_remove (store, &iter); } } } static int populate_cb (char *urltext, gpointer userdata) { fe_url_add (urltext); return TRUE; } void url_opengui () { GtkWidget *vbox, *hbox, *view; if (urlgrabberwindow) { mg_bring_tofront (urlgrabberwindow); return; } urlgrabberwindow = mg_create_generic_tab ("UrlGrabber", _(DISPLAY_NAME": URL Grabber"), FALSE, TRUE, url_closegui, NULL, 400, 256, &vbox, 0); gtkutil_destroy_on_esc (urlgrabberwindow); view = url_treeview_new (vbox); g_object_set_data (G_OBJECT (urlgrabberwindow), "model", gtk_tree_view_get_model (GTK_TREE_VIEW (view))); hbox = gtk_hbutton_box_new (); gtk_button_box_set_layout (GTK_BUTTON_BOX (hbox), GTK_BUTTONBOX_SPREAD); gtk_container_set_border_width (GTK_CONTAINER (hbox), 5); gtk_box_pack_end (GTK_BOX (vbox), hbox, 0, 0, 0); gtk_widget_show (hbox); gtkutil_button (hbox, gtk_image_new_from_stock(GTK_STOCK_CLEAR, GTK_ICON_SIZE_MENU), _("Clear list"), url_button_clear, 0, _("Clear")); gtkutil_button (hbox, gtk_image_new_from_stock(GTK_STOCK_COPY, GTK_ICON_SIZE_MENU), _("Copy selected URL"), url_button_copy, view, _("Copy")); gtkutil_button (hbox, gtk_image_new_from_stock(GTK_STOCK_SAVE_AS, GTK_ICON_SIZE_MENU), _("Save list to a file"), url_button_save, 0, _("Save As...")); gtk_widget_show (urlgrabberwindow); if (prefs.pchat_url_grabber) tree_foreach (url_tree, (tree_traverse_func *)populate_cb, NULL); else { gtk_list_store_clear (GTK_LIST_STORE (gtk_tree_view_get_model (GTK_TREE_VIEW (view)))); fe_url_add ("URL Grabber is disabled."); } }
#ifndef LOCOPDF_H_ #define LOCOPDF_H_ #include <Epdf.h> #define FIT_WIDTH 0 #define FIT_HEIGHT 1 #define FIT_BEST 2 #define FIT_STRETCH 3 #define FIT_NO 4 char *get_theme_file(); int get_win_width(); int get_win_height(); double get_zoom_inc(); void set_zoom_inc(double newzoominc); double get_hpan_inc(); void set_hpan_inc(double newhpaninc); double get_vpan_inc(); void set_vpan_inc(double newvpaninc); int get_lefttrim(); void set_lefttrim(int newlefttrim); int get_righttrim(); void set_righttrim(int newrighttrim); int get_toptrim(); void set_toptrim(int newtoptrim); int get_bottomtrim(); void set_bottomtrim(int newbottomtrim); int get_fit_mode(); void set_fit_mode(int newfitmode); int get_reader_mode(); int get_antialias_mode(); void set_antialias_mode(int newantialiasmode); void set_reader_mode(int newreadermode); int get_num_pages(); void goto_page(int newpage); int get_cur_page(); Epdf_Document *get_document(); void update_statusbar(); void set_statusbar_visible(unsigned char visible); unsigned char get_statusbar_visible(); void render_cur_page(); void prerender_next_page(); void reset_cur_panning(); #endif
/* * Copyright(c) 2013 Intel Corporation. All rights reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of version 2 of the GNU General Public License as * published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License 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. * * Contact Information: * Intel Corporation */ /** * intel_cln_esram_test.h * * Define integers for ioctl operation * * Author : Bryan O'Donoghue <bryan.odonoghue@linux.intel.com> */ #ifndef __INTEL_CLN_ESRAM_TEST_H__ #define __INTEL_CLN_ESRAM_TEST_H__ #define CLN_ESRAM_IOCTL_BASE 255 #define CLN_F_SW_APP_ESRAM_0 0x00000000 #define CLN_F_SW_APP_ESRAM_1 0x00000001 #define CLN_F_SW_APP_ESRAM_2 0x00000002 #define CLN_F_SW_APP_ESRAM_3 0x00000003 #define CLN_F_SW_APP_ESRAM_4 0x00000004 #define CLN_F_SW_APP_ESRAM_5 0x00000005 #define CLN_F_SW_APP_ESRAM_6 0x00000006 #define CLN_F_SW_APP_ESRAM_7 0x00000007 #define CLN_F_SW_APP_ESRAM_8 0x00000008 #endif /* __INTEL_CLN_ESRAM_TEST_H__ */
/* * uart.c * * Copyright (c) 2005 Robert Krten. All Rights Reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE 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. * * This module contains a simple 8-bit UART, which performs a callback * with the decoded byte value. * * 2005 06 11 R. Krten created */ #include <stdio.h> #include <stdlib.h> #include <string.h> #include <errno.h> #include "wp_uart.h" /* * dsp_uart_attr_init * * Initializes the attributes structure; this must be done before the * attributes structure is used. */ void dsp_uart_attr_init (dsp_uart_attr_t *attr) { memset (attr, 0, sizeof (*attr)); } /* * dsp_uart_attr_get_bytehandler * dsp_uart_attr_set_bytehandler * * These functions get and set their respective elements from the * attributes structure. If an error code is returned, it is just * zero == ok, -1 == fail. */ bytehandler_func_t dsp_uart_attr_get_bytehandler(dsp_uart_attr_t *attr, void **bytehandler_arg) { *bytehandler_arg = attr->bytehandler_arg; return attr->bytehandler; } void dsp_uart_attr_set_bytehandler(dsp_uart_attr_t *attr, bytehandler_func_t bytehandler, void *bytehandler_arg) { attr->bytehandler = bytehandler; attr->bytehandler_arg = bytehandler_arg; } dsp_uart_handle_t *dsp_uart_create(dsp_uart_attr_t *attr) { dsp_uart_handle_t *handle; handle = (dsp_uart_handle_t *)malloc(sizeof (*handle)); if (handle) { memset(handle, 0, sizeof (*handle)); /* fill the attributes member */ memcpy(&handle->attr, attr, sizeof (*attr)); } return handle; } void dsp_uart_destroy(dsp_uart_handle_t **handle) { if (*handle) { free(*handle); *handle = NULL; } } void dsp_uart_bit_handler(void *x, int bit) { dsp_uart_handle_t *handle = (dsp_uart_handle_t *) x; if (!handle->have_start) { if (bit) { return; /* waiting for start bit (0) */ } handle->have_start = 1; handle->data = 0; handle->nbits = 0; return; } handle->data >>= 1; handle->data |= 0x80 * !!bit; handle->nbits++; if (handle->nbits == 8) { handle->attr.bytehandler(handle->attr.bytehandler_arg, handle->data); handle->nbits = 0; handle->data = 0; handle->have_start = 0; } /* might consider handling errors in the future... */ }
/*************************************************************** * L&L - Labyrinths & Legends * Copyright (c) 1993-2014 YOSHIMURA Tomohiko All rights reserved. * * Created by BowKenKen * URL: https://sourceforge.jp/projects/lnl/ * * License is GPL * * 本プログラムはフリー・ソフトウェアです。 * あなたは、 Free Software Foundation が公表した * GNU 一般公有使用許諾の「バージョン2」 * 或はそれ以降の各バージョンの中からいずれかを選択し、 * そのバージョンが定める条項に従って本プログラムを * 再頒布または変更することができます。 * * 本プログラムは有用とは思いますが、頒布にあたっては、 * 市場性及び特定目的適合性についての暗黙の保証を含めて, * いかなる保証も行ないません。 * 詳細については GNU 一般公有使用許諾書をお読みください。 * * あなたは、本プログラムと一緒に GNU 一般公有使用許諾書 * の写しを受け取っているはずです。そうでない場合は、 * Free Software Foundation, Inc., * 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA * へ手紙を書いてください。 * * $Id: GameMusic.h,v 1.18 2014/01/07 23:44:46 bowkenken Exp $ ***************************************************************/ #ifndef GAME_MUSIC_H #define GAME_MUSIC_H 1 //////////////////////////////////////////////////////////////// // BGM の管理 //////////////////////////////////////////////////////////////// #include <vector> #if defined( HAVE_SDL2_SDL_H ) # include <SDL2/SDL.h> #elif defined( HAVE_SDL_SDL_H ) # include <SDL/SDL.h> #endif // HAVE_SDL2_SDL_H #if defined( HAVE_SDL2_SDL_MIXER_H ) # include <SDL2/SDL_mixer.h> #elif defined( HAVE_SDL_SDL_MIXER_H ) # include <SDL/SDL_mixer.h> #endif // HAVE_SDL2_SDL_H #include "town.h" #include "music-kind.h" #include "GameMisc.h" //////////////////////////////////////////////////////////////// // BGM データ・ディレクトリ #define STR_DEFAULT_MUSIC_DIR_NAME "xalnl-" VERSION "/" // BGM のファイル名の拡張子 #define STR_MUSIC_FILE_EXT "ogg mp3" #define LS_MUSIC_DUN_MAX_N 10 #define LS_MUSIC_BATTLE_MAX_N LS_MUSIC_DUN_MAX_N //////////////////////////////////////////////////////////////// // BGM のデータ class MusicData { public: std::vector<std::string> name; private: public: MusicData(){ }; MusicData( const char *dir ){ init( dir ); }; ~MusicData(){ }; void init( const char *dir ); private: }; // BGM のデータのリスト typedef std::vector<MusicData *> LsMusicData; //////////////////////////////////////////////////////////////// class GameMusic { public: private: #if defined( HAVE_SDL2_SDL_MIXER_H ) || defined( HAVE_SDL_SDL_MIXER_H ) Mix_Music *music; #endif int audioRate; unsigned short audioFormat; int audioChannels; int audioBuffers; music_kind_t currentKind; music_kind_t prevKind; long currentIdx; long prevIdx; std::string currentName; MusicData musicTitle; MusicData musicGameOver; MusicData musicEnding; MusicData musicTheEnd; MusicData musicTown; LsMusicData lsMusicShop; LsMusicData lsMusicDun; MusicData musicLastBoss; LsMusicData lsMusicBattle; MusicData musicBattleBoss; MusicData musicBattleLastBoss; LsMusicData lsMusicEffect; public: GameMusic(); ~GameMusic(); void init(); void close(); void setVolume( rate_t rate ); void playScene(); void playLastScene(); void play( music_kind_t kind, long idx = -1 ); void replayPrev(); void replay(); std::string playTitle( long idx ); std::string playGameOver( long idx ); std::string playEnding( long idx ); std::string playTheEnd( long idx ); std::string playTown( long idx ); std::string playShop( long idx ); std::string playDun( long idx ); std::string playLastBoss( long idx ); std::string playBattle( long idx ); std::string playBattleBoss( long idx ); std::string playBattleLastBoss( long idx ); std::string playEffect( long idx ); private: void setCurrent( music_kind_t kind, long idx ); std::string playRandm( MusicData *p, long nRepeat = -1, void (*func)() = NULL ); }; #endif /* GAME_MUSIC_H */
/* * Copyright (C) 2007 Colin DIDIER * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as * published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License along * with this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ #include <string.h> #include "module.h" #include "recode.h" #include "settings.h" #include "signals.h" #define XMPP_PRIORITY_MIN -128 #define XMPP_PRIORITY_MAX 127 static const char *utf8_charset = "UTF-8"; static gboolean xmpp_get_local_charset(const char **charset) { *charset = settings_get_str("term_charset"); if (is_valid_charset(*charset)) return (g_ascii_strcasecmp(*charset, utf8_charset) == 0); return g_get_charset(charset); } char * xmpp_recode_out(const char *str) { const char *charset; char *recoded, *stripped; if (str == NULL || *str == '\0') return NULL; recoded = stripped = NULL; signal_emit("xmpp formats strip codes", 2, str, &stripped); if (stripped != NULL) str = stripped; if (!xmpp_get_local_charset(&charset) && charset != NULL) recoded = g_convert_with_fallback(str, -1, utf8_charset, charset, NULL, NULL, NULL, NULL); recoded = recoded != NULL ? recoded : g_strdup(str); g_free(stripped); return recoded; } char * xmpp_recode_in(const char *str) { const char *charset; char *recoded, *to = NULL; if (str == NULL || *str == '\0') return NULL; if (xmpp_get_local_charset(&charset) || charset == NULL) return g_strdup(str); if (settings_get_bool("recode_transliterate") && g_ascii_strcasecmp(charset, "//TRANSLIT") != 0) charset = to = g_strconcat(charset ,"//TRANSLIT", (void *)NULL); recoded = g_convert_with_fallback(str, -1, charset, utf8_charset, NULL, NULL, NULL, NULL); g_free(to); return (recoded != NULL) ? recoded : g_strdup(str); } char * xmpp_find_resource_sep(const char *jid) { return jid == NULL ? NULL : g_utf8_strchr(jid, -1, '/'); } char * xmpp_extract_resource(const char *jid) { char *pos; g_return_val_if_fail(jid != NULL, NULL); pos = xmpp_find_resource_sep(jid); return (pos != NULL) ? g_strdup(pos + 1) : NULL; } char * xmpp_strip_resource(const char *jid) { char *pos; g_return_val_if_fail(jid != NULL, NULL); pos = xmpp_find_resource_sep(jid); return (pos != NULL) ? g_strndup(jid, pos - jid) : g_strdup(jid); } char * xmpp_extract_user(const char *jid) { char *pos; g_return_val_if_fail(jid != NULL, NULL); pos = g_utf8_strchr(jid, -1, '@'); return (pos != NULL) ? g_strndup(jid, pos - jid) : xmpp_strip_resource(jid); } char * xmpp_extract_domain(const char *jid) { char *pos1, *pos2; pos1 = g_utf8_strchr(jid, -1, '@'); pos2 = xmpp_find_resource_sep(jid); if (pos1 == NULL) return NULL; if (pos2 != NULL && pos2 < pos1) return g_strdup(pos1 + 1); return (pos2 != NULL) ? g_strndup(pos1 + 1, pos2 - pos1 - 1) : g_strdup(pos1 + 1); } gboolean xmpp_have_domain(const char *jid) { char *pos; g_return_val_if_fail(jid != NULL, FALSE); pos = g_utf8_strchr(jid, -1, '@'); return (pos != NULL && *(pos+1) != '\0'); } gboolean xmpp_have_resource(const char *jid) { char *pos; g_return_val_if_fail(jid != NULL, FALSE); pos = xmpp_find_resource_sep(jid); return (pos != NULL && *(pos+1) != '\0'); } gboolean xmpp_priority_out_of_bound(const int priority) { return (XMPP_PRIORITY_MIN <= priority && priority <= XMPP_PRIORITY_MAX) ? FALSE : TRUE; } gboolean xmpp_presence_changed(const int show, const int old_show, const char *status, const char *old_status, const int priority, const int old_priority) { return (show != old_show) || (status == NULL && old_status != NULL) || (status != NULL && old_status == NULL) || (status != NULL && old_status != NULL && strcmp(status, old_status) != 0) || (priority != old_priority); }
#ifndef KYRINBOX_SRC_SERVER_REQUEST_HANDLER_DOWNLOAD_CHUNK_FILE_REQUEST_HANDLER_H_ #define KYRINBOX_SRC_SERVER_REQUEST_HANDLER_DOWNLOAD_CHUNK_FILE_REQUEST_HANDLER_H_ #include "server/chunk/kyrin_chunk_server.h" #include "server/chunk/kyrin_chunk_gossiper.h" namespace kyrin { namespace server { class KyrinChunkServer; class DownloadChunkFileRequestHandler { public: DownloadChunkFileRequestHandler() {} ~DownloadChunkFileRequestHandler() {} void handle_request(KyrinChunkServer *server, evhttp_request *req); private: }; } /* server */ } /* kyrin */ #endif /* end of include guard: KYRINBOX_SRC_SERVER_REQUEST_HANDLER_DOWNLOAD_CHUNK_FILE_REQUEST_HANDLER_H_ */
/** ****************************************************************************** * @file FatFs/FatFs_MultiDrives/Src/stm32f4xx_it.c * @author MCD Application Team * @version V1.2.1 * @date 09-October-2015 * @brief Main Interrupt Service Routines. * This file provides template for all exceptions handler and * peripherals interrupt service routine. ****************************************************************************** * @attention * * <h2><center>&copy; COPYRIGHT(c) 2015 STMicroelectronics</center></h2> * * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License"); * You may not use this file except in compliance with the License. * You may obtain a copy of the License at: * * http://www.st.com/software_license_agreement_liberty_v2 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * ****************************************************************************** */ /* Includes ------------------------------------------------------------------*/ #include "main.h" #include "stm32f4xx_it.h" /** @addtogroup Validation_Project * @{ */ /* Private typedef -----------------------------------------------------------*/ /* Private define ------------------------------------------------------------*/ /* Private macro -------------------------------------------------------------*/ /* Private variables ---------------------------------------------------------*/ /* Private function prototypes -----------------------------------------------*/ /* Private functions ---------------------------------------------------------*/ /******************************************************************************/ /* Cortex-M4 Processor Exceptions Handlers */ /******************************************************************************/ /** * @brief This function handles NMI exception. * @param None * @retval None */ void NMI_Handler(void) { } /** * @brief This function handles Hard Fault exception. * @param None * @retval None */ void HardFault_Handler(void) { /* Go to infinite loop when Hard Fault exception occurs */ while (1) { } } /** * @brief This function handles Memory Manage exception. * @param None * @retval None */ void MemManage_Handler(void) { /* Go to infinite loop when Memory Manage exception occurs */ while (1) { } } /** * @brief This function handles Bus Fault exception. * @param None * @retval None */ void BusFault_Handler(void) { /* Go to infinite loop when Bus Fault exception occurs */ while (1) { } } /** * @brief This function handles Usage Fault exception. * @param None * @retval None */ void UsageFault_Handler(void) { /* Go to infinite loop when Usage Fault exception occurs */ while (1) { } } /** * @brief This function handles SVCall exception. * @param None * @retval None */ void SVC_Handler(void) { } /** * @brief This function handles Debug Monitor exception. * @param None * @retval None */ void DebugMon_Handler(void) { } /** * @brief This function handles PendSVC exception. * @param None * @retval None */ void PendSV_Handler(void) { } /** * @brief This function handles SysTick Handler. * @param None * @retval None */ void SysTick_Handler(void) { HAL_IncTick(); } /******************************************************************************/ /* STM32F4xx Peripherals Interrupt Handlers */ /* Add here the Interrupt Handler for the used peripheral(s) (PPP), for the */ /* available peripheral interrupt handler's name please refer to the startup */ /* file (startup_stm32f4xx.s). */ /******************************************************************************/ /** * @brief This function handles DMA2 Stream 3 interrupt request. * @param None * @retval None */ void DMA2_Stream3_IRQHandler(void) { BSP_SD_DMA_Rx_IRQHandler(); } /** * @brief This function handles DMA2 Stream 6 interrupt request. * @param None * @retval None */ void DMA2_Stream6_IRQHandler(void) { BSP_SD_DMA_Tx_IRQHandler(); } /** * @brief This function handles SDIO interrupt request. * @param None * @retval None */ void SDIO_IRQHandler(void) { BSP_SD_IRQHandler(); } /** * @brief This function handles PPP interrupt request. * @param None * @retval None */ /*void PPP_IRQHandler(void) { }*/ /** * @} */ /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
#include "lolevel.h" #include "platform.h" #include "core.h" static long *nrflag = (long*)0x61F4; #include "../../../generic/capt_seq.c"
#include <stdio.h> #include <stdlib.h> #include "config.h" #include "mp_msg.h" #include <png.h> #include "libavutil/common.h" #include "mpbswap.h" #include "libvo/fastmemcpy.h" #include "vd_internal.h" static vd_info_t info = { "PNG Images decoder", "mpng", "A'rpi", ".so, based on mpng.c", "uses libpng, 8bpp modes not supported yet" }; LIBVD_EXTERN(mpng) static unsigned int out_fmt=0; static int last_w=-1; static int last_h=-1; static int last_c=-1; // to set/get/query special features/parameters static int control(sh_video_t *sh,int cmd,void* arg,...){ switch (cmd) { case VDCTRL_QUERY_FORMAT: if (*((int *) arg) == out_fmt) return CONTROL_TRUE; return CONTROL_FALSE; } return CONTROL_UNKNOWN; } // init driver static int init(sh_video_t *sh){ last_w=-1; return 1; } // uninit driver static void uninit(sh_video_t *sh){ } //mp_image_t* mpcodecs_get_image(sh_video_t *sh, int mp_imgtype, int mp_imgflag, int w, int h); static int pngPointer; static int pngLength; static void pngReadFN( png_structp pngstr,png_bytep buffer,png_size_t size ) { char * p = pngstr->io_ptr; if(size>pngLength-pngPointer && pngLength>=pngPointer) size=pngLength-pngPointer; memcpy( buffer,(char *)&p[pngPointer],size ); pngPointer+=size; } // decode a frame static mp_image_t* decode(sh_video_t *sh,void* data,int len,int flags){ png_structp png; png_infop info; png_infop endinfo; // png_bytep data; png_bytep * row_p; png_uint_32 png_width=0,png_height=0; int depth,color; png_uint_32 i; mp_image_t* mpi; int cols; png_colorp pal; unsigned char *p; if(len<=0) return NULL; // skipped frame png=png_create_read_struct( PNG_LIBPNG_VER_STRING,NULL,NULL,NULL ); info=png_create_info_struct( png ); endinfo=png_create_info_struct( png ); pngPointer=8; pngLength=len; png_set_read_fn( png,data,pngReadFN ); png_set_strip_16( png ); png_set_sig_bytes( png,8 ); png_read_info( png,info ); png_get_IHDR( png,info,&png_width,&png_height,&depth,&color,NULL,NULL,NULL ); png_set_bgr( png ); switch( info->color_type ) { case PNG_COLOR_TYPE_GRAY_ALPHA: mp_msg( MSGT_DECVIDEO,MSGL_INFO,"Sorry gray scaled png with alpha channel not supported at moment.\n" ); break; case PNG_COLOR_TYPE_GRAY: out_fmt=IMGFMT_Y800; break; case PNG_COLOR_TYPE_PALETTE: out_fmt=IMGFMT_BGR8; break; case PNG_COLOR_TYPE_RGB_ALPHA: out_fmt=IMGFMT_BGR32; break; case PNG_COLOR_TYPE_RGB: out_fmt=IMGFMT_BGR24; break; default: mp_msg( MSGT_DECVIDEO,MSGL_INFO,"Sorry, unsupported PNG colorspace: %d.\n" ,info->color_type); } // (re)init libvo if image parameters changed (width/height/colorspace) if(last_w!=png_width || last_h!=png_height || last_c!=out_fmt){ last_w=png_width; last_h=png_height; last_c=out_fmt; if(!out_fmt) return NULL; if(!mpcodecs_config_vo(sh,png_width,png_height,out_fmt)) return NULL; } #if 0 switch( info->color_type ) { case PNG_COLOR_TYPE_GRAY_ALPHA: printf( "[png] used GrayA -> stripping alpha channel\n" ); break; case PNG_COLOR_TYPE_GRAY: printf( "[png] used Gray -> rgb\n" ); break; case PNG_COLOR_TYPE_PALETTE: printf( "[png] used palette -> rgb\n" ); break; case PNG_COLOR_TYPE_RGB_ALPHA: printf( "[png] used RGBA -> stripping alpha channel\n" ); break; case PNG_COLOR_TYPE_RGB: printf( "[png] read rgb datas.\n" ); break; } #endif mpi=mpcodecs_get_image(sh, MP_IMGTYPE_TEMP, MP_IMGFLAG_ACCEPT_STRIDE, png_width,png_height); if(!mpi) return NULL; // Let's DECODE! row_p=malloc( sizeof( png_bytep ) * png_height ); //png_get_rowbytes( png,info ) for ( i=0; i < png_height; i++ ) row_p[i]=mpi->planes[0] + mpi->stride[0]*i; png_read_image( png,row_p ); free( row_p ); if (out_fmt==IMGFMT_BGR8) { png_get_PLTE( png,info,&pal,&cols ); mpi->planes[1] = (char*)realloc(mpi->planes[1], 4*cols); p = mpi->planes[1]; for (i = 0; i < cols; i++) { *p++ = pal[i].blue; *p++ = pal[i].green; *p++ = pal[i].red; *p++ = 0; } } png_read_end( png,endinfo ); png_destroy_read_struct( &png,&info,&endinfo ); return mpi; }
/* * Copyright (C) 2012 Spreadtrum Communications Inc. * * This software is licensed under the terms of the GNU General Public * License version 2, as published by the Free Software Foundation, and * may be copied, distributed, and modified under those terms. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. */ #ifndef __AUDIO_PIPE_H #define __AUDIO_PIPE_H /* saudio ring-buffer between AP/AGDSP ipc */ struct audio_pipe_init_data { char *name; uint8_t dst; uint8_t devicesnr; uint32_t target_id; }; #endif
#include "stat.h" #include "types.h" #include "user.h" static void putc(int fd, char c) { write(fd, &c, 1); } static void printint(int fd, int xx, int base, int sgn) { static char digits[] = "0123456789ABCDEF"; char buf[16]; int i, neg; uint x; neg = 0; if (sgn && xx < 0) { neg = 1; x = -xx; } else { x = xx; } i = 0; do { buf[i++] = digits[x % base]; } while ((x /= base) != 0); if (neg) buf[i++] = '-'; while (--i >= 0) putc(fd, buf[i]); } // Print to the given fd. Only understands %d, %x, %p, %s. void printf(int fd, char* fmt, ...) { char* s; int c, i, state; uint* ap; state = 0; ap = (uint*)(void*)&fmt + 1; for (i = 0; fmt[i]; i++) { c = fmt[i] & 0xff; if (state == 0) { if (c == '%') { state = '%'; } else { putc(fd, c); } } else if (state == '%') { if (c == 'd') { printint(fd, *ap, 10, 1); ap++; } else if (c == 'x' || c == 'p') { printint(fd, *ap, 16, 0); ap++; } else if (c == 's') { s = (char*)*ap; ap++; if (s == 0) s = "(null)"; while (*s != 0) { putc(fd, *s); s++; } } else if (c == 'c') { putc(fd, *ap); ap++; } else if (c == '%') { putc(fd, c); } else { // Unknown % sequence. Print it to draw attention. putc(fd, '%'); putc(fd, c); } state = 0; } } }
/* hostlist_rsvp.c * hostlist_rsvp.c August 2005, Manu Pathak <mapathak@cisco.com> * * $Id$ * * Wireshark - Network traffic analyzer * By Gerald Combs <gerald@wireshark.org> * Copyright 1998 Gerald Combs * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ #include "config.h" #include <stdio.h> #include <string.h> #include <gtk/gtk.h> #include "epan/packet.h" #include <epan/stat_cmd_args.h> #include <epan/tap.h> #include <epan/dissectors/packet-rsvp.h> #include "../stat_menu.h" #include "ui/gtk/gui_stat_menu.h" #include "ui/gtk/hostlist_table.h" static int rsvp_hostlist_packet(void *pit, packet_info *pinfo, epan_dissect_t *edt _U_, const void *vip) { hostlist_table *hosts=(hostlist_table *)pit; const rsvp_conversation_info *rsvph = vip; /* Take two "add" passes per packet, adding for each direction, ensures * that all packets are counted properly (even if address is sending to * itself). XXX - this could probably be done more efficiently inside * hostlist_table */ add_hostlist_table_data(hosts, &rsvph->source, 0, TRUE, 1, pinfo->fd->pkt_len, SAT_NONE, PT_NONE); add_hostlist_table_data(hosts, &rsvph->destination, 0, FALSE, 1, pinfo->fd->pkt_len, SAT_NONE, PT_NONE); return 1; } static void gtk_rsvp_hostlist_init(const char *optarg, void* userdata _U_) { const char *filter=NULL; if(!strncmp(optarg,"hosts,rsvp,",11)){ filter=optarg+11; } else { filter=NULL; } init_hostlist_table(TRUE, "RSVP", "rsvp", filter, rsvp_hostlist_packet); } void gtk_rsvp_hostlist_cb(GtkAction *action _U_, gpointer user_data _U_) { gtk_rsvp_hostlist_init("hosts,rsvp",NULL); } void register_tap_listener_rsvp_hostlist(void) { register_stat_cmd_arg("hosts,rsvp", gtk_rsvp_hostlist_init,NULL); register_hostlist_table(TRUE, "RSVP", "rsvp", NULL /*filter*/, rsvp_hostlist_packet); }
/* * RTC driver test code */ #include <time.h> #include <sys/time.h> #include <sys/ioctl.h> #include <stdio.h> #include <stdlib.h> #include <fcntl.h> #include <linux/ioctl.h> #include <errno.h> #include "dpmc.h" #include <linux/rtc.h> int main() { int fd,rtc_fd,ret; unsigned long pllstat; printf("Entering sleep mode \n"); /*******************************Open the dpmc device ***********************************/ fd = open("/dev/dpmc", O_RDONLY,0); if (fd == -1) { fprintf(stderr, "/dev/dpmc open error: %s\n", strerror(errno)); exit(1); } rtc_fd = open("/dev/rtc0", O_RDONLY,0); if (rtc_fd == -1) { fprintf(stderr, "/dev/rtc0 open error: %s\n", strerror(errno)); exit(1); } /********************************Get the PLL Status***********************************/ ret = ioctl(rtc_fd, RTC_IRQP_SET, 50); if (ret == -1) { printf("ioctl RTC_IRQP_SET error\r\n"); } ret = ioctl(rtc_fd, RTC_PIE_ON, 0); if (ret == -1) { printf("ioctl RTC_PIE_ON error\r\n"); } ret = ioctl(fd, IOCTL_SLEEP_MODE, NULL); printf("Out of Sleep mode set %d \n",ret); ret = ioctl(rtc_fd, RTC_PIE_OFF, 0); if (ret == -1) { printf("ioctl RTC_PIE_OFF error\r\n"); } /********************************Get the PLL Status***********************************/ printf("IOCTL to get the PLL status \n"); ret = ioctl(fd, IOCTL_GET_PLLSTATUS, &pllstat); printf("pll status got is 0x%x\n",pllstat); close(rtc_fd); close(fd); return 0; }
/* * Copyright (C) 2013-2014 Shahbaz Youssefi <ShabbyX@gmail.com> * * This file is part of URT, Unified Real-Time Interface. * * URT 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. * * URT 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 URT. If not, see <http://www.gnu.org/licenses/>. */ #ifndef URT_SYS_MEM_H #define URT_SYS_MEM_H #ifdef __KERNEL__ # include <linux/vmalloc.h> #else # include <stdlib.h> #endif #include <urt_debug.h> URT_DECL_BEGIN URT_INLINE void urt_mem_delete(void *mem) { URT_CHECK_NONRT_CONTEXT(); #ifdef __KERNEL__ vfree(mem); #else free(mem); #endif } URT_DECL_END #endif
// Copyright 2017 Dolphin Emulator Project // Licensed under GPLv2+ // Refer to the license.txt file included. #pragma once #include <memory> #include <vulkan/vulkan.h> #include "VideoCommon/AbstractStagingTexture.h" #include "VideoCommon/AbstractTexture.h" namespace Vulkan { class StagingBuffer; class Texture2D; class VKTexture final : public AbstractTexture { public: VKTexture() = delete; ~VKTexture(); void CopyRectangleFromTexture(const AbstractTexture* src, const MathUtil::Rectangle<int>& src_rect, u32 src_layer, u32 src_level, const MathUtil::Rectangle<int>& dst_rect, u32 dst_layer, u32 dst_level) override; void ScaleRectangleFromTexture(const AbstractTexture* source, const MathUtil::Rectangle<int>& src_rect, const MathUtil::Rectangle<int>& dst_rect) override; void Load(u32 level, u32 width, u32 height, u32 row_length, const u8* buffer, size_t buffer_size) override; Texture2D* GetRawTexIdentifier() const; VkFramebuffer GetFramebuffer() const; static std::unique_ptr<VKTexture> Create(const TextureConfig& tex_config); private: VKTexture(const TextureConfig& tex_config, std::unique_ptr<Texture2D> texture, VkFramebuffer framebuffer); std::unique_ptr<Texture2D> m_texture; VkFramebuffer m_framebuffer; }; class VKStagingTexture final : public AbstractStagingTexture { public: VKStagingTexture() = delete; ~VKStagingTexture(); void CopyFromTexture(const AbstractTexture* src, const MathUtil::Rectangle<int>& src_rect, u32 src_layer, u32 src_level, const MathUtil::Rectangle<int>& dst_rect) override; void CopyToTexture(const MathUtil::Rectangle<int>& src_rect, AbstractTexture* dst, const MathUtil::Rectangle<int>& dst_rect, u32 dst_layer, u32 dst_level) override; bool Map() override; void Unmap() override; void Flush() override; // This overload is provided for compatibility as we dropped StagingTexture2D. // For now, FramebufferManager relies on them. But we can drop it once we move that to common. void CopyFromTexture(Texture2D* src, const MathUtil::Rectangle<int>& src_rect, u32 src_layer, u32 src_level, const MathUtil::Rectangle<int>& dst_rect); static std::unique_ptr<VKStagingTexture> Create(StagingTextureType type, const TextureConfig& config); private: VKStagingTexture(StagingTextureType type, const TextureConfig& config, std::unique_ptr<StagingBuffer> buffer); std::unique_ptr<StagingBuffer> m_staging_buffer; VkFence m_flush_fence = VK_NULL_HANDLE; }; } // namespace Vulkan
/* * YAFFS: Yet Another Flash File System. A NAND-flash specific file system. * * Copyright (C) 2002-2011 Aleph One Ltd. * for Toby Churchill Ltd and Brightstar Engineering * * Created by Charles Manning <charles@aleph1.co.uk> * * 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 <stdio.h> #include <string.h> #include "yaffs_packedtags2.h" #include "yaffs_utils.h" #include "yaffs_trace.h" /* This code packs a set of extended tags into a binary structure for * NAND storage */ /* Some of the information is "extra" struff which can be packed in to * speed scanning * This is defined by having the EXTRA_HEADER_INFO_FLAG set. */ /* Extra flags applied to chunk_id */ #define EXTRA_HEADER_INFO_FLAG 0x80000000 #define EXTRA_SHRINK_FLAG 0x40000000 #define EXTRA_SHADOWS_FLAG 0x20000000 #define EXTRA_SPARE_FLAGS 0x10000000 #define ALL_EXTRA_FLAGS 0xf0000000 /* Also, the top 4 bits of the object Id are set to the object type. */ #define EXTRA_OBJECT_TYPE_SHIFT (28) #define EXTRA_OBJECT_TYPE_MASK ((0x0f) << EXTRA_OBJECT_TYPE_SHIFT) static void yaffs_dump_packed_tags2_tags_only( const struct yaffs_packed_tags2_tags_only *ptt) { yaffs_trace(YAFFS_TRACE_MTD, "packed tags obj %d chunk %d byte %d seq %d", ptt->obj_id, ptt->chunk_id, ptt->n_bytes, ptt->seq_number); } static void yaffs_dump_packed_tags2(const struct yaffs_packed_tags2 *pt) { yaffs_dump_packed_tags2_tags_only(&pt->t); } static void yaffs_dump_tags2(const struct yaffs_ext_tags *t) { yaffs_trace(YAFFS_TRACE_MTD, "ext.tags eccres %d blkbad %d chused %d obj %d chunk%d byte %d del %d ser %d seq %d", t->ecc_result, t->block_bad, t->chunk_used, t->obj_id, t->chunk_id, t->n_bytes, t->is_deleted, t->serial_number, t->seq_number); } static int yaffs_check_tags_extra_packable(const struct yaffs_ext_tags *t) { if(t->chunk_id != 0 || !t->extra_available) return 0; /* Check if the file size is too long to store */ if (t->extra_obj_type == YAFFS_OBJECT_TYPE_FILE && (t->extra_file_size>> 31) != 0) return 0; return 1; } void yaffs_pack_tags2_tags_only(struct yaffs_packed_tags2_tags_only *ptt, const struct yaffs_ext_tags *t) { ptt->chunk_id = t->chunk_id; ptt->seq_number = t->seq_number; ptt->n_bytes = t->n_bytes; ptt->obj_id = t->obj_id; /* Only store extra tags for object headers. * If it is a file then only store if the file size is short\ * enough to fit. */ if (yaffs_check_tags_extra_packable(t)) { /* Store the extra header info instead */ /* We save the parent object in the chunk_id */ ptt->chunk_id = EXTRA_HEADER_INFO_FLAG | t->extra_parent_id; if (t->extra_is_shrink) ptt->chunk_id |= EXTRA_SHRINK_FLAG; if (t->extra_shadows) ptt->chunk_id |= EXTRA_SHADOWS_FLAG; ptt->obj_id &= ~EXTRA_OBJECT_TYPE_MASK; ptt->obj_id |= (t->extra_obj_type << EXTRA_OBJECT_TYPE_SHIFT); if (t->extra_obj_type == YAFFS_OBJECT_TYPE_HARDLINK) ptt->n_bytes = t->extra_equiv_id; else if (t->extra_obj_type == YAFFS_OBJECT_TYPE_FILE) ptt->n_bytes = (unsigned) t->extra_file_size; else ptt->n_bytes = 0; } yaffs_dump_packed_tags2_tags_only(ptt); yaffs_dump_tags2(t); } void yaffs_pack_tags2(struct yaffs_packed_tags2 *pt, const struct yaffs_ext_tags *t, int tags_ecc) { yaffs_pack_tags2_tags_only(&pt->t, t); if (tags_ecc) yaffs_ecc_calc_other((unsigned char *)&pt->t, sizeof(struct yaffs_packed_tags2_tags_only), &pt->ecc); } void yaffs_unpack_tags2_tags_only(struct yaffs_ext_tags *t, struct yaffs_packed_tags2_tags_only *ptt) { memset(t, 0, sizeof(struct yaffs_ext_tags)); if (ptt->seq_number == 0xffffffff) return; t->block_bad = 0; t->chunk_used = 1; t->obj_id = ptt->obj_id; t->chunk_id = ptt->chunk_id; t->n_bytes = ptt->n_bytes; t->is_deleted = 0; t->serial_number = 0; t->seq_number = ptt->seq_number; /* Do extra header info stuff */ if (ptt->chunk_id & EXTRA_HEADER_INFO_FLAG) { t->chunk_id = 0; t->n_bytes = 0; t->extra_available = 1; t->extra_parent_id = ptt->chunk_id & (~(ALL_EXTRA_FLAGS)); t->extra_is_shrink = ptt->chunk_id & EXTRA_SHRINK_FLAG ? 1 : 0; t->extra_shadows = ptt->chunk_id & EXTRA_SHADOWS_FLAG ? 1 : 0; t->extra_obj_type = ptt->obj_id >> EXTRA_OBJECT_TYPE_SHIFT; t->obj_id &= ~EXTRA_OBJECT_TYPE_MASK; if (t->extra_obj_type == YAFFS_OBJECT_TYPE_HARDLINK) t->extra_equiv_id = ptt->n_bytes; else t->extra_file_size = ptt->n_bytes; } yaffs_dump_packed_tags2_tags_only(ptt); yaffs_dump_tags2(t); } void yaffs_unpack_tags2(struct yaffs_ext_tags *t, struct yaffs_packed_tags2 *pt, int tags_ecc) { enum yaffs_ecc_result ecc_result = YAFFS_ECC_RESULT_NO_ERROR; if (pt->t.seq_number != 0xffffffff && tags_ecc) { /* Chunk is in use and we need to do ECC */ struct yaffs_ecc_other ecc; int result; yaffs_ecc_calc_other((unsigned char *)&pt->t, sizeof(struct yaffs_packed_tags2_tags_only), &ecc); result = yaffs_ecc_correct_other((unsigned char *)&pt->t, sizeof(struct yaffs_packed_tags2_tags_only), &pt->ecc, &ecc); switch (result) { case 0: ecc_result = YAFFS_ECC_RESULT_NO_ERROR; break; case 1: ecc_result = YAFFS_ECC_RESULT_FIXED; break; case -1: ecc_result = YAFFS_ECC_RESULT_UNFIXED; break; default: ecc_result = YAFFS_ECC_RESULT_UNKNOWN; } } yaffs_unpack_tags2_tags_only(t, &pt->t); t->ecc_result = ecc_result; yaffs_dump_packed_tags2(pt); yaffs_dump_tags2(t); }
#ifndef KCHECKERS_H #define KCHECKERS_H #include <qmainwindow.h> #include <qlabel.h> #include "field.h" #include "checkers.h" #define WOODEN 1 #define GREEN 2 #define MARBLE 3 #define ENGLISH 11 #define RUSSIAN 12 #define BEGINNER 2 #define NOVICE 4 #define AVERAGE 6 #define GOOD 7 #define EXPERT 8 #define MASTER 9 class QToolButton; class KCheckers:public QMainWindow { Q_OBJECT public: static QString appName() { return QString::fromLatin1("kcheckers"); } KCheckers(QWidget *parent, const char* name, WFlags fl); protected: void closeEvent(QCloseEvent*); private slots: void help(); void about(); void aboutQt(); void newGame(); void undoMove(); void click(int); void showNumeration(); void setSkillBeginner() {setSkill(BEGINNER);}; void setSkillNovice() {setSkill(NOVICE);}; void setSkillAverage() {setSkill(AVERAGE);}; void setSkillGood() {setSkill(GOOD);}; void setSkillExpert() {setSkill(EXPERT);}; void setSkillMaster() {setSkill(MASTER);}; void setPatternWooden() {setPattern(WOODEN);}; void setPatternGreen() {setPattern(GREEN);}; void setPatternMarble() {setPattern(MARBLE);}; void setRulesEnglish() {setRules(ENGLISH);}; void setRulesRussian() {setRules(RUSSIAN);}; private: void compGo(); bool userGo(int); void drawBoard(int); void drawNumeration(); void colorChange(); void unselect(); void readConfig(); void setSkill(int); void setRules(int); void setPattern(int); int from; // Selected by user int skill; int rules; int pattern; int numID; // Show Numeration int undoID; // Undo Move int undoBoard[32]; bool gameOver; bool selected; bool userFirst; Field* field[64]; // Fields of board QImage* imagePat1; // Patterns QImage* imagePat2; QImage* imageFrame; // Frame of selected field QImage* imageWood1; QImage* imageWood2; QImage* imageWood3; QImage* imageGreen1; QImage* imageGreen2; QImage* imageGreen3; QImage* imageMarble1; QImage* imageMarble2; QImage* imageMarble3; QImage* imageMan1; QImage* imageMan2; QImage* imageKing1; QImage* imageKing2; Checkers* game; QPopupMenu* gameMenu; QPopupMenu* skillMenu; QPopupMenu* optionsMenu; QToolButton* undoButton; QLabel* statusLabel; static QString enNumeration; static QString ruNumeration; static const int t[32]; // Translate table }; #endif
/* * File: JSONHandler.h * Author: HoelscJ * * Created on 1. September 2011, 15:52 */ #ifndef JSONHANDLER_H #define JSONHANDLER_H #include "org/esb/core/HookPlugin.h" #include "exports.h" using namespace org::esb::core; namespace db{ class HiveDb; } namespace org { namespace esb { namespace api { class JSONHandler : public org::esb::core::HookPlugin { public: JSONHandler(); virtual ~JSONHandler(); void handleEncoding(Request * req, Response*res); private: std::string base_uri; db::HiveDb * db; }jsonHandler; REGISTER_HOOK("web.api.Service", jsonHandler, JSONHandler::handleEncoding,1); } } } #endif /* JSONHANDLER_H */
/****************************************************************************** * * Copyright (C) 2009 - 2014 Xilinx, Inc. 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. * * Use of the Software is limited solely to applications: * (a) running on a Xilinx device, or * (b) that interact with a Xilinx device through a bus or interconnect. * * 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 * XILINX 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 Xilinx shall not be used * in advertising or otherwise to promote the sale, use or other dealings in * this Software without prior written authorization from Xilinx. * ******************************************************************************/ #ifdef __cplusplus extern "C" { int _close(int fd); } #endif /* * close -- We don't need to do anything, but pretend we did. */ int _close(int fd) { (void)fd; return (0); }
/* * See the files COPYING and README for copyright information and how to reach * the author. * * $Id: chain-vdr.h,v 1.8 2006/09/16 18:33:36 lordjaxom Exp $ */ #ifndef VDR_BURN_CHAIN_VDR_H #define VDR_BURN_CHAIN_VDR_H #include "common.h" #include "jobs.h" #include "proctools/chain.h" #include <vdr/thread.h> namespace vdr_burn { class chain_vdr: public proctools::chain, public cThread { public: // factory method static chain_vdr* create_chain(job& job); virtual ~chain_vdr(); // starts and stops the thread controlling the processes void start() { cThread::Start(); } void stop(); // monitoring and member access const path_pair& get_paths() const { return m_paths; } bool get_is_active() { return Active(); } int get_progress() const { return m_progress; } bool get_is_burning(int& progress) const { progress = m_burnProgress; return m_burning; } // convenience functions std::string get_log_path() const { return m_paths.data + "/dvd.log"; } // TODO: move rendering into chain using proctools::chain::execute; //void execute( proctools::process& proc ) { proctools::chain::execute( proc ); } protected: chain_vdr(const std::string& name, job& job_); virtual void all_done(); virtual void Action(); void add_process(proctools::process* proc); std::string create_temp_path( const std::string& pathPrefix ); void set_progress(int percent) { m_progress = std::min(percent, 100); } void set_is_burning() { m_burning = true; } void set_burn_progress(int percent) { m_burnProgress = std::min(percent, 100); } job& get_job() { return m_job; } recording_list& get_recordings() { return m_job.get_recordings(); } private: job& m_job; path_pair m_paths; int m_progress; bool m_burning; int m_burnProgress; bool m_canceled; }; }; #endif // VDR_BURN_CHAIN_VDR_H
/* * Copyright (C) Actility, SA. All Rights Reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License version * 2 only, as published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License version 2 for more details (a copy is * included at /legal/license.txt). * * 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 Actility, SA., 4, rue Ampere 22300 LANNION FRANCE * or visit www.actility.com if you need additional * information or have any questions. */ #ifndef _DONGLE__H_ #define _DONGLE__H_ int wmbusDongleReady(void); void wmbusDongleWrite(char *str, int len); #endif
#ifndef __ASM_MACH_IP27_CPU_FEATURE_OVERRIDES_H #define __ASM_MACH_IP27_CPU_FEATURE_OVERRIDES_H #define cpu_has_watch 1 #define cpu_has_mips16 0 #define cpu_has_divec 0 #define cpu_has_vce 0 #define cpu_has_cache_cdex_p 0 #define cpu_has_cache_cdex_s 0 #define cpu_has_prefetch 1 #define cpu_has_mcheck 0 #define cpu_has_ejtag 0 #define cpu_has_llsc 1 #define cpu_has_vtag_icache 0 #define cpu_has_dc_aliases 0 #define cpu_has_ic_fills_f_dc 0 #define cpu_has_dsp 0 #define cpu_icache_snoops_remote_store 1 #define cpu_has_mipsmt 0 #define cpu_has_userlocal 0 #define cpu_has_nofpuex 0 #define cpu_has_64bits 1 #define cpu_has_4kex 1 #define cpu_has_3k_cache 0 #define cpu_has_6k_cache 0 #define cpu_has_4k_cache 1 #define cpu_has_8k_cache 0 #define cpu_has_tx39_cache 0 #define cpu_has_inclusive_pcaches 1 #define cpu_dcache_line_size() 32 #define cpu_icache_line_size() 64 #define cpu_scache_line_size() 128 #define cpu_has_mips32r1 0 #define cpu_has_mips32r2 0 #define cpu_has_mips64r1 0 #define cpu_has_mips64r2 0 #endif /* __ASM_MACH_IP27_CPU_FEATURE_OVERRIDES_H */
/* * PKCS #1 (RSA Encryption) * Copyright (c) 2006-2009, Jouni Malinen <j@w1.fi> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as * published by the Free Software Foundation. * * Alternatively, this software may be distributed under the terms of BSD * license. * * See README and COPYING for more details. */ #ifndef PKCS1_H #define PKCS1_H int pkcs1_encrypt(int block_type, struct crypto_rsa_key *key, int use_private, const u8 *in, size_t inlen, u8 *out, size_t *outlen); int pkcs1_v15_private_key_decrypt(struct crypto_rsa_key *key, const u8 *in, size_t inlen, u8 *out, size_t *outlen); int pkcs1_decrypt_public_key(struct crypto_rsa_key *key, const u8 *crypt, size_t crypt_len, u8 *plain, size_t *plain_len); #endif /* PKCS1_H */
/* * Copyright (c) 2010, Intel Corporation. * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU General Public License, * version 2, as published by the Free Software Foundation. * * This program is distributed in the hope 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. * * Author: John Fastabend <john.r.fastabend@intel.com> */ #ifndef _DCB_EVENT_H #define _DCB_EVENT_H enum dcbevent_notif_type { DCB_APP_EVENT = 1, }; #ifdef CONFIG_DCB extern int register_dcbevent_notifier(struct notifier_block *nb); extern int unregister_dcbevent_notifier(struct notifier_block *nb); extern int call_dcbevent_notifiers(unsigned long val, void *v); #else static inline int register_dcbevent_notifier(struct notifier_block *nb) { return 0; } static inline int unregister_dcbevent_notifier(struct notifier_block *nb) { return 0; } static inline int call_dcbevent_notifiers(unsigned long val, void *v) { return 0; } #endif /* CONFIG_DCB */ #endif
/* * Copyright (c) 2005 Boudewijn Rempt <boud@valdyas.org> * Copyright (c) 2005-2008 Thomas Zander <zander@kde.org> * Copyright (c) 2009 Peter Simonsson <peter.simonsson@gmail.com> * Copyright (c) 2010 Cyrille Berger <cberger@cberger.net> * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Library General Public License for more details. * * You should have received a copy of the GNU Library General Public License * along with this library; see the file COPYING.LIB. If not, write to * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301, USA. */ #ifndef _KO_TOOLBOX_H_ #define _KO_TOOLBOX_H_ #include <KoCanvasObserverBase.h> #include <QWidget> #include <QList> #include <KoToolManager.h> class KoCanvasController; class KoShapeLayer; /** * KoToolBox is a dock widget that can order tools according to type and * priority. * * The ToolBox is a container for tool buttons which are themselves * divided into sections. * * Adding buttons using addButton() will allow you to show those buttons. You should connect * the button to your handling method yourself. * * The unique property of this toolbox is that it can be shown horizontal as well as vertical, * rotating in a smart way to show the buttons optimally. * @see KoToolManager */ class KoToolBox : public QWidget { Q_OBJECT public: /// constructor explicit KoToolBox(); ~KoToolBox(); public Q_SLOTS: /** * Using the buttongroup id passed in addButton() you can set the new active button. * If the id does not resolve to a visible button, this call is ignored. * @param canvas the currently active canvas. * @param id an id to identify the button to activate. */ void setActiveTool(KoCanvasController *canvas, int id); /** * Show only the dynamic buttons that have a code from parameter codes. * The toolbox allows buttons to be optionally registered with a visibilityCode. This code * can be passed here and all buttons that have that code are shown. All buttons that * have another visibility code registered are hidden. * @param canvas the currently active canvas. * @param codes a list of all the codes to show. */ void setButtonsVisible(const QList<QString> &codes); /// Set the orientation of the layout to @p orientation void setOrientation(Qt::Orientation orientation); void setFloating(bool v); private: /** * Add a button to the toolbox. * The buttons should all be added before the first showing since adding will not really add * them to the UI until setup() is called. * * @param toolAction the action of the tool * @see setup() */ void addButton(KoToolAction *toolAction); private Q_SLOTS: void setCurrentLayer(const KoCanvasController *canvas, const KoShapeLayer* newLayer); /// add a tool post-initialization. The tool will also be activated. void toolAdded(KoToolAction *toolAction, KoCanvasController *canvas); /// resize the toolbox to show the icons without any gap at the edge void adjustToFit(); /// unlocks the with after adjustToFit void resizeUnlock(); /// set the icon size for all the buttons void slotContextIconSize(); protected: void paintEvent(QPaintEvent *event); void resizeEvent(QResizeEvent* event); void contextMenuEvent(QContextMenuEvent *event); private: class Private; Private * const d; }; #endif // _KO_TOOLBOX_H_
/* This file is part of KOrganizer. Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org> Copyright (c) 2007 Loïc Corbasson <loic.corbasson@gmail.com> This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifndef KORG_PLUGINS_THISDAYINHISTORY_THISDAYINHISTORY_H #define KORG_PLUGINS_THISDAYINHISTORY_THISDAYINHISTORY_H #include <calendarviews/eventviews/agenda/calendardecoration.h> using namespace EventViews::CalendarDecoration; class ThisDayInHistory : public Decoration { public: ThisDayInHistory(); ~ThisDayInHistory() {} Element::List createDayElements( const QDate & ); Element::List createMonthElements( const QDate & ); // void configure( QWidget *parent ); QString info() const; }; #endif
/* This file is part of the KDE project * Copyright (C) 2006 Thomas Zander <zander@kde.org> * Copyright (C) 2006 Jan Hambrecht <jaham@gmx.net> * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Library General Public License for more details. * * You should have received a copy of the GNU Library General Public License * along with this library; see the file COPYING.LIB. If not, write to * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301, USA. */ #ifndef KSHAPELOCKCOMMAND_H #define KSHAPELOCKCOMMAND_H #include <QUndoCommand> #include <QList> #include "flake_export.h" class KShape; class KShapeLockCommandPrivate; /// The undo / redo command to lock a set of shapes position and size class FLAKE_EXPORT KShapeLockCommand : public QUndoCommand { public: /** * Command to lock a set of shapes position and size * @param shapes a set of shapes that should change lock state * @param oldLock list of old lock states the same length as @p shapes * @param newLock list of new lock states the same length as @p shapes * @param parent the parent command used for macro commands */ KShapeLockCommand(const QList<KShape*> &shapes, const QList<bool> &oldLock, const QList<bool> &newLock, QUndoCommand *parent = 0); ~KShapeLockCommand(); /// redo the command virtual void redo(); /// revert the actions done in redo virtual void undo(); private: KShapeLockCommandPrivate *d; }; #endif
/*************************************************************************** * Brutal Chess * http://brutalchess.sf.net * * File : options.h * Authors : Mike Cook, Joe Flint, Neil Pankey **************************************************************************/ #ifndef OPTIONS_H #define OPTIONS_H #include <map> #include <string> enum BoardType {GRANITE, WOOD}; enum PiecesType {BASIC, DEBUG, QUAKE}; enum PlayerType {BRUTAL, FAILE, HUMAN, RANDOM, TEST, XBOARD}; enum Difficulty {EASY=2, MEDIUM=3, HARD=4}; #define DEFAULT_PLY_DEPTH MEDIUM // Keep things synced between menu events and this enum Resolution {r640X480, r800X600, r1024X768, r1280X1024, r1400X1050, r1600X1200, }; class Options { public: static Options* getInstance(); bool animations, fullscreen, historyarrows, reflections, shadows; BoardType board; Difficulty player1diff, player2diff; PiecesType pieces; PlayerType player1, player2; Resolution resolution; // Won't need eventually int brutalplayer1ply, brutalplayer2ply; std::string getBoardString() { return m_boardTypeString[board]; } std::string getPiecesString() { return m_piecesTypeString[pieces]; } std::string getPlayer1String() { return m_playerTypeString[player1]; } std::string getPlayer1DiffString() { return m_difficultyString[player1diff]; } std::string getPlayer2String() { return m_playerTypeString[player2]; } std::string getPlayer2DiffString() { return m_difficultyString[player2diff]; } std::string getResolutionString() { return m_resolutionString[resolution]; } int getResolutionHeight() { return m_resolutionHeightInt[resolution]; } int getResolutionWidth() { return m_resolutionWidthInt[resolution]; } private: Options(); static Options* m_instance; std::map<BoardType, std::string> m_boardTypeString; std::map<PiecesType, std::string> m_piecesTypeString; std::map<PlayerType, std::string> m_playerTypeString; std::map<Difficulty, std::string> m_difficultyString; std::map<Resolution, std::string> m_resolutionString; std::map<Resolution, int> m_resolutionHeightInt; std::map<Resolution, int> m_resolutionWidthInt; }; #endif // end of file options.h
/* * Sdrlib * Shared library for SystemDataRecorders * * Copyright (c) 2014 DigitAir Servicii Informatice SRL * Bucharest, Romania * * 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. * * (http://www.gnu.org/copyleft/gpl.html) */ #define _WIN32_DCOM #include <iostream> #include <comdef.h> #include <list> #include <map> #include <vector> #include <iterator> #include <Wbemidl.h> #include <string> #include <sstream> #include <ctime> #include <locale> #include <fstream> #include <shlwapi.h> #include <pdh.h> #include <PdhMsg.h> #include <iphlpapi.h> #include "shlobj.h" #include "xzip\XZip.h" #include "pugixml-1.2\pugixml.hpp" #include <atlconv.h> #include <WinSvc.h> #include <tchar.h> #include <codecvt> #define WCOLON L":" #define REQUESTCHECK status_ok && requestResult == status_ok?status_ok:status_query_failed #pragma comment(lib, "pdh.lib") #pragma comment(lib,"shlwapi.lib") #pragma comment(lib, "iphlpapi.lib") #pragma comment(lib, "wbemuuid.lib") using namespace std; //#pragma argsused enum status { status_ok = 0, status_query_failed, status_connection_failed, status_config_file_not_found, status_io_error, status_path_not_found, status_out_of_memory, status_internal_error }; struct RecorderParameters { wstring rawCurrentPath; wstring rawCurrentFile; wstring logDailyPath; wstring name; int countTotal; int interval; int archiveInterval; }; struct RecorderProperties { wofstream rawStream; wofstream logStream; IWbemLocator *pLoc; IWbemServices *pSvc; HRESULT hres; bool treminateFlag; wstring sysLogPath; RecorderParameters parameters; }; std::wstring __declspec(dllexport) FromVariant(VARIANT& vt); std::wstring __declspec(dllexport) AppPath(); int __declspec(dllexport) Init(RecorderProperties *ws, wstring name); int __declspec(dllexport) InitConfig(pugi::xml_document& config); void __declspec(dllexport) WriteResultConsole( map<wstring, map<wstring, wstring>> &resultData); int __declspec(dllexport) WriteFileRaw(wofstream &myfile, wstring resultData); int __declspec(dllexport) WriteFileLog(wofstream &myfile, wstring data); int __declspec(dllexport) WriteFileLogf(wstring fmt, ...); int __declspec(dllexport) OpenFileStream(wofstream &myfile, wstring fileName, bool recreate = false); int __declspec(dllexport) CloseFileStream(wofstream &myfile); void __declspec(dllexport) SetDefaultLog(wofstream &myfile); int __declspec(dllexport) ArchiveFileRaw(RecorderProperties *ws, bool sender = false); int __declspec(dllexport) WMIRequest(IWbemServices* pSvc, IWbemLocator* pLoc, std::list<BSTR> requests, map<wstring, map<wstring, wstring>> &resultData, BSTR query); int __declspec(dllexport) WMIConnect(IWbemServices **pSvc_g, IWbemLocator **pLoc_g); int __declspec(dllexport) SecSinceMidnight(); double __declspec(dllexport) GetCounterTotal(PDH_HCOUNTER &hCounter); vector<wstring> __declspec(dllexport) GetCounterNames(PDH_HCOUNTER &hCounter); vector<double> __declspec(dllexport) GetCounterVector(PDH_HCOUNTER &hCounter); wstring __declspec(dllexport) GetEnglishPdhQuery(int counter, int subCounter, bool wildcard = false , wstring custom = L"" );
/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */ /* * * Copyright (C) 1997 University of Chicago. * See COPYRIGHT notice in top-level directory. */ #include "mpioimpl.h" #ifdef HAVE_WEAK_SYMBOLS #if defined(HAVE_PRAGMA_WEAK) #pragma weak MPI_File_get_group = PMPI_File_get_group #elif defined(HAVE_PRAGMA_HP_SEC_DEF) #pragma _HP_SECONDARY_DEF PMPI_File_get_group MPI_File_get_group #elif defined(HAVE_PRAGMA_CRI_DUP) #pragma _CRI duplicate MPI_File_get_group as PMPI_File_get_group /* end of weak pragmas */ #endif /* Include mapping from MPI->PMPI */ #define MPIO_BUILD_PROFILING #include "mpioprof.h" #endif /*@ MPI_File_get_group - Returns the group of processes that opened the file Input Parameters: . fh - file handle (handle) Output Parameters: . group - group that opened the file (handle) .N fortran @*/ int MPI_File_get_group(MPI_File fh, MPI_Group *group) { int error_code; ADIO_File adio_fh; static char myname[] = "MPI_FILE_GET_GROUP"; MPIU_THREAD_CS_ENTER(ALLFUNC,); adio_fh = MPIO_File_resolve(fh); /* --BEGIN ERROR HANDLING-- */ MPIO_CHECK_FILE_HANDLE(adio_fh, myname, error_code); /* --END ERROR HANDLING-- */ /* note: this will return the group of processes that called open, but * with deferred open this might not be the group of processes that * actually opened the file from the file system's perspective */ error_code = MPI_Comm_group(adio_fh->comm, group); fn_exit: MPIU_THREAD_CS_EXIT(ALLFUNC,); return error_code; }
/* * hashtable.h: contains struct nlist * * Copyright (C) 1994, 1995 Graeme W. Wilford. (Wilf.) * Copyright (C) 2002, 2003, 2004, 2005, 2007, 2009 Colin Watson. * * This file is part of man-db. * * man-db 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. * * man-db 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 man-db; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA * * Sat Aug 20 15:01:02 BST 1994 Wilf. (G.Wilford@ee.surrey.ac.uk) */ #ifndef _HASHTABLE_H #define _HASHTABLE_H typedef void (*hashtable_free_ptr) (void *defn); struct hashtable { struct nlist **hashtab; /* the storage array */ int unique; /* unique hash values */ int identical; /* identical hash values */ hashtable_free_ptr free_defn; /* function to free a hash entry */ }; struct nlist { struct nlist *next; /* next in the chain */ char *name; /* the _name_ */ void *defn; /* the _definition_ */ }; struct hashtable_iter; extern void null_hashtable_free (void *defn); extern void plain_hashtable_free (void *defn); extern struct hashtable *hashtable_create (hashtable_free_ptr free_defn); extern struct nlist *hashtable_lookup_structure (const struct hashtable *ht, const char *s, size_t len); extern void *hashtable_lookup (const struct hashtable *ht, const char *s, size_t len); extern struct nlist *hashtable_install (struct hashtable *ht, const char *name, size_t len, void *defn); extern struct nlist *hashtable_iterate (const struct hashtable *ht, struct hashtable_iter **iterp); extern void hashtable_remove (struct hashtable *ht, const char *s, size_t len); extern void hashtable_free (struct hashtable *ht); #endif /* _HASHTABLE_H */
/* * Copyright 2005 -- 2012 Oracle, Inc. * * Licensed under the GNU General Public License (GPL), version 2. See the file * COPYING in the top level of this tree. */ /* * CTF Declaration Stack * * In order to implement ctf_type_name(), we must convert a type graph back * into a C type declaration. Unfortunately, a type graph represents a storage * class ordering of the type whereas a type declaration must obey the C rules * for operator precedence, and the two orderings are frequently in conflict. * For example, consider these CTF type graphs and their C declarations: * * CTF_K_POINTER -> CTF_K_FUNCTION -> CTF_K_INTEGER : int (*)() * CTF_K_POINTER -> CTF_K_ARRAY -> CTF_K_INTEGER : int (*)[] * * In each case, parentheses are used to raise operator * to higher lexical * precedence, so the string form of the C declaration cannot be constructed by * walking the type graph links and forming the string from left to right. * * The functions in this file build a set of stacks from the type graph nodes * corresponding to the C operator precedence levels in the appropriate order. * The code in ctf_type_name() can then iterate over the levels and nodes in * lexical precedence order and construct the final C declaration string. */ #include <ctf_impl.h> void ctf_decl_init(ctf_decl_t *cd, char *buf, size_t len) { int i; bzero(cd, sizeof (ctf_decl_t)); for (i = CTF_PREC_BASE; i < CTF_PREC_MAX; i++) cd->cd_order[i] = CTF_PREC_BASE - 1; cd->cd_qualp = CTF_PREC_BASE; cd->cd_ordp = CTF_PREC_BASE; cd->cd_buf = buf; cd->cd_ptr = buf; cd->cd_end = buf + len; } void ctf_decl_fini(ctf_decl_t *cd) { ctf_decl_node_t *cdp, *ndp; int i; for (i = CTF_PREC_BASE; i < CTF_PREC_MAX; i++) { for (cdp = ctf_list_next(&cd->cd_nodes[i]); cdp != NULL; cdp = ndp) { ndp = ctf_list_next(cdp); ctf_free(cdp, sizeof (ctf_decl_node_t)); } } } void ctf_decl_push(ctf_decl_t *cd, ctf_file_t *fp, ctf_id_t type) { ctf_decl_node_t *cdp; ctf_decl_prec_t prec; uint_t kind, n = 1; int is_qual = 0; const ctf_type_t *tp; ctf_arinfo_t ar; if ((tp = ctf_lookup_by_id(&fp, type)) == NULL) { cd->cd_err = fp->ctf_errno; return; } switch (kind = LCTF_INFO_KIND(fp, tp->ctt_info)) { case CTF_K_ARRAY: (void) ctf_array_info(fp, type, &ar); ctf_decl_push(cd, fp, ar.ctr_contents); n = ar.ctr_nelems; prec = CTF_PREC_ARRAY; break; case CTF_K_TYPEDEF: if (ctf_strptr(fp, tp->ctt_name)[0] == '\0') { ctf_decl_push(cd, fp, tp->ctt_type); return; } prec = CTF_PREC_BASE; break; case CTF_K_FUNCTION: ctf_decl_push(cd, fp, tp->ctt_type); prec = CTF_PREC_FUNCTION; break; case CTF_K_POINTER: ctf_decl_push(cd, fp, tp->ctt_type); prec = CTF_PREC_POINTER; break; case CTF_K_VOLATILE: case CTF_K_CONST: case CTF_K_RESTRICT: ctf_decl_push(cd, fp, tp->ctt_type); prec = cd->cd_qualp; is_qual++; break; default: prec = CTF_PREC_BASE; } if ((cdp = ctf_alloc(sizeof (ctf_decl_node_t))) == NULL) { cd->cd_err = EAGAIN; return; } cdp->cd_type = type; cdp->cd_kind = kind; cdp->cd_n = n; if (ctf_list_next(&cd->cd_nodes[prec]) == NULL) cd->cd_order[prec] = cd->cd_ordp++; /* * Reset cd_qualp to the highest precedence level that we've seen so * far that can be qualified (CTF_PREC_BASE or CTF_PREC_POINTER). */ if (prec > cd->cd_qualp && prec < CTF_PREC_ARRAY) cd->cd_qualp = prec; /* * C array declarators are ordered inside out so prepend them. Also by * convention qualifiers of base types precede the type specifier (e.g. * const int vs. int const) even though the two forms are equivalent. */ if (kind == CTF_K_ARRAY || (is_qual && prec == CTF_PREC_BASE)) ctf_list_prepend(&cd->cd_nodes[prec], cdp); else ctf_list_append(&cd->cd_nodes[prec], cdp); } /*PRINTFLIKE2*/ _dt_printflike_(2,3) void ctf_decl_sprintf(ctf_decl_t *cd, const char *format, ...) { size_t len = (size_t)(cd->cd_end - cd->cd_ptr); va_list ap; size_t n; va_start(ap, format); n = vsnprintf(cd->cd_ptr, len, format, ap); va_end(ap); cd->cd_ptr += MIN(n, len); cd->cd_len += n; }
/* This file is part of the KDE project * Copyright (c) 2009 Jan Hambrecht <jaham@gmx.net> * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Library General Public License for more details. * * You should have received a copy of the GNU Lesser 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 KFILTEREFFECTFACTORY_H #define KFILTEREFFECTFACTORY_H #include "flake_export.h" #include <QObject> class KFilterEffect; class KFilterEffectConfigWidgetBase; /// API docs go here class FLAKE_EXPORT KFilterEffectFactoryBase : public QObject { Q_OBJECT public: /** * Create the new factory * @param parent the parent QObject for memory management usage. * @param id a string that will be used internally for referencing the filter effect * @param name the user visible name of the filter effect this factory creates */ KFilterEffectFactoryBase(QObject *parent, const QString &id, const QString &name); virtual ~KFilterEffectFactoryBase(); /** * Returns the id for the filter this factory creates. * @return the id for the filter this factory creates */ QString id() const; /** * Returns the user visible (and translated) name to be seen by the user. * @return the user visible (and translated) name to be seen by the user */ QString name() const; /** * This method should be implemented by factories to create a filter effect. * @return a new filter effect */ virtual KFilterEffect *createFilterEffect() const = 0; /** * This method should be implemented by factories to create a filter effect config widget. * @return the filter effect options widget */ virtual KFilterEffectConfigWidgetBase *createConfigWidget() const = 0; private: class Private; Private * const d; }; #endif // KOFILTEREFFECTFACTORY_H
/* Access to Standard C errno.h */ #ifndef _C_ERRNO_H_ #define _C_ERRNO_H_ #include "../supportc/eiffel.h" #include <errno.h> EIF_INTEGER const_edom(); EIF_INTEGER const_emfile(); EIF_INTEGER const_erange(); void posix_clear_errno(); EIF_INTEGER posix_errno(); void posix_set_errno(EIF_INTEGER new_value); #endif /* _C_ERRNO_H_ */
/* HaveClip Copyright (C) 2013-2016 Jakub Skokan <aither@havefun.cz> This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. */ #ifndef INTRODUCTION_H #define INTRODUCTION_H #include "../Conversation.h" namespace Conversations { class Introduction : public Conversation { Q_OBJECT public: Introduction(Communicator::Role r, ClipboardContainer *cont, QObject *parent = 0); virtual Type type() const; virtual ConnectionManager::AuthMode authenticate(); void setName(QString name); void setPort(quint16 port); protected: virtual void postDoneSender(); virtual void postDoneReceiver(); }; } #endif // INTRODUCTION_H
#include <gui/playlists_model.h> #include <i18n/i18n.h> static int n_columns(void* data) { return (int) PLAYLISTS_MODEL_N_COLUMNS; } static GType column_type(void* data, int col) { switch(col) { case PLAYLISTS_MODEL_COL_NAME: return G_TYPE_STRING; default: return G_TYPE_NONE; } } static int n_rows(void* data) { playlists_model_t* model = (playlists_model_t*) data; if (model->library != NULL) { return library_playlists_count(model->library); } else { return 0; } } static void cell_value(void* data, int row, int col, GValue* value) { playlists_model_t* model = (playlists_model_t*) data; if (model->library == NULL) { return; } playlist_t* pl = library_playlists_get(model->library, row); //log_debug2("name = %s", playlist_name(pl)); switch(col) { case PLAYLISTS_MODEL_COL_NAME: g_value_set_static_string(value, playlist_name(pl)); break; default: break; } } const char* playlists_model_i18n_column_name(playlists_column_enum e) { switch (e) { case PLAYLISTS_MODEL_COL_NAME: return _("Playlist"); default: return ""; } } const char* playlists_model_column_id(playlists_column_enum e) { switch (e) { case PLAYLISTS_MODEL_COL_NAME: return "playlists_col_name"; default: return "col_none"; } } playlists_model_t* playlists_model_new(library_t* lib) { playlists_model_t* model = (playlists_model_t*) mc_malloc(sizeof(playlists_model_t)); model->library = lib; model->model = gtk_list_model_new(model, n_columns, column_type, n_rows, cell_value); return model; } void playlists_model_destroy(playlists_model_t* model) { gtk_list_model_destroy(model->model); mc_free(model); } GtkTreeModel* playlists_model_gtk_model(playlists_model_t* model) { return GTK_TREE_MODEL(model->model); }
/* ============================================================================== FilterParameterContainer.h Created: 4 Dec 2016 7:37:03pm Author: Alexander Heemann ============================================================================== */ #ifndef FILTERPARAMETERCONTAINER_H_INCLUDED #define FILTERPARAMETERCONTAINER_H_INCLUDED #include "ParameterContainer.h" class FilterParameterContainer: public ParameterContainer { public: FilterParameterContainer(AudioProcessor& processor) : processor(processor) { processor.addParameter(filterFrequency = new AudioParameterFloat("filter_frequency", "Filter Frequency", 0.0f, 20000.0f, 10000.0f)); filterFrequency->range.skew = 0.25; processor.addParameter(envelopeAmountFilter = new AudioParameterFloat("env_amount_filter", "Envelope Amount", 0.0f, 1.0f, 0.0f)); processor.addParameter(filterResonance = new AudioParameterFloat("resonance", "Filter Resonance", 1.0f, 10.0f, 1.0f)); } ~FilterParameterContainer() {} AudioParameterFloat* getEnvelopeAmountParameter() const { return envelopeAmountFilter; }; AudioParameterFloat* getFilterFrequencyParameter() const { return filterFrequency; }; AudioParameterFloat* getFilterResonanceParameter() const { return filterResonance; }; private: AudioProcessor& processor; AudioParameterFloat* envelopeAmountFilter; AudioParameterFloat* filterFrequency; AudioParameterFloat* filterResonance; JUCE_DECLARE_NON_COPYABLE_WITH_LEAK_DETECTOR(FilterParameterContainer) }; #endif // FILTERPARAMETERCONTAINER_H_INCLUDED
#pragma once // Combat-related hook scripts namespace sfall { void InitCombatHookScripts(); void Inject_ToHitHook(); void Inject_AfterHitRollHook(); void Inject_CalcApCostHook(); void Inject_CombatDamageHook(); void Inject_FindTargetHook(); void Inject_ItemDamageHook(); void Inject_AmmoCostHook(); void Inject_CombatTurnHook(); void Inject_OnExplosionHook(); void Inject_SubCombatDamageHook(); void Inject_TargetObjectHook(); int __fastcall AmmoCostHook_Script(DWORD hookType, fo::GameObject* weapon, DWORD &rounds); // Implementation of item_w_mp_cost_ engine function with the hook long __fastcall sf_item_w_mp_cost(fo::GameObject* source, long hitMode, long isCalled); }
/****************************************************************************** * This file is part of PCPSolver. * * * * Written by Marcel Lippmann <marcel.lippmann@tu-dresden.de> and * * Thomas B. Preußer <thomas.preusser@tu-dresden.de>. * * Copyright (c) 2016 by Marcel Lippmann and Thomas B. Preußer. All rights * * reserved. * * * ******************************************************************************/ #ifndef PCPSOLVER_H #define PCPSOLVER_H #include <list> #include <memory> #include <string> #include "PCPInstance.h" #include "WorkingQueue.h" namespace pcpsolver { /** * This class describes the PCP solver. */ class PCPSolver { private: /** * The PCP instance that the solver was initialised with. */ PCPInstance const instance_; /** * This inner class represents a node in the search space. */ class Node { private: /** * The index extending the parent node. * For the root node, the value is -1. */ int index_; /** * A pointer to the parent node if there is any. */ std::shared_ptr<Node> parent_; public: /** * The standard constructor. * * @param index The index of the node. * @param parent The pointer to the parent node or nullptr if the node is a * root node. */ Node(int const index = -1, std::shared_ptr<Node> const& parent = nullptr) : index_(index), parent_(parent) {} /** * The destructor. */ ~Node() {} /** * @returns A pointer to the parent node if there is any. */ std::shared_ptr<Node> const& get_parent() const { return parent_; } /** * @returns The index extending the parent node. For a root node, it * returns -1. */ int get_index() const { return index_; } }; /** * This inner class represents a job that consists of a node that needs to be * processed. */ class Job { private: /** * The node to be expanded. */ std::shared_ptr<Node> node_; /** * The word of the non-empty string in the word pair associated to the * node. */ std::string word_; /** * This field is true iff the first word in the word pair associated to the * node is non-empty. */ bool first_; public: /** * The standard constructor. * * @param node The node to be processed. * @param word The non-empty word in the word pair associated to the node. * @param first true iff the the word stored in the word field is the first * component of the word pair associated to the node. */ Job(std::shared_ptr<Node> const& node, std::string const& word, bool const first = true) : node_(node), word_(word), first_(first) {} /** * The destructor. */ ~Job() {} /** * @returns The node of this job. */ std::shared_ptr<Node> const& get_node() const { return node_; } /** * @returns The non-empty word in the word pair associated to the node. */ std::string const& get_word() const { return word_; } /** * @returns true iff the word stored in the word field is the first * component of the word pair associated to the node. */ bool first_word_set() const { return first_; } /** * The operator < is overridden to compare jobs by their word length. */ bool operator<(Job const& other) const { return other.word_.length() < word_.length(); } }; /** * The working queue containing the nodes that need to be processed. */ std::unique_ptr<WorkingQueue<Job>> workingQueue_; /** * This field stores the solution if there is any. */ std::shared_ptr<Node> solution_; /** * This function processes the working queue and adds more jobs to the * working queue if necessary. * * If a solution is found, it closes the working queue and stores the * solution into the solution field. */ void run(); public: /** * This constructor initialises the PCP solver with a given PCP instance. * * @param instance The PCP instance. * @param type The type of the working queue. */ PCPSolver(PCPInstance const& instance, WorkingQueueType const& type); /** * The destructor. */ ~PCPSolver() {} /** * This function `solves' the given PCP instance. * * Note that the function does not necessarily return if there is no solution. * * @returns If a solution is found, it returns it as list of index names. * Otherwise, it returns an empty list. */ std::list<std::string> solve(); }; } // namespace pcpsolver #endif // PCPSOLVER_H
// // Copyright (C) 2016 Jonas K. <i-tek@web.de> // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this program. If not, see <http://www.gnu.org/licenses/>. // #ifndef UTILS_MODULEARRAYTOKENPARSER_H_ #define UTILS_MODULEARRAYTOKENPARSER_H_ #include <list> #include <vector> #include <string> #include <omnetpp.h> class ModuleArrayTokenParser { public: static bool resolveModulePathArrayToken(const char* unexpandedModuleArrayToken, std::list<std::string>& lstExpandedTokens); static bool resolveModulePathArrayToken(const char* unexpandedModuleArrayToken, std::vector<std::string>& vExpandedTokens); static bool resolveModulePathArrayToken(const char* unexpandedModuleArrayToken, std::string& expandedTokens); static bool parseModulePathArrayToken(const char* dirtyHostToken, std::vector<std::string>& strBits, std::vector<std::pair<unsigned int, unsigned int>>& numBits, size_t *numExpandedEntries = nullptr, size_t *supSingleEntrySize = nullptr); private: ModuleArrayTokenParser(); }; #endif /* UTILS_MODULEARRAYTOKENPARSER_H_ */
#pragma once #include "Animation.h" #include "Entity.h" #include "Player.h" namespace isgp { class Ghost : public Entity { public: Ghost(Vector2D, Player*); ~Ghost(); void Update(const double) override; void Paint(Graphics*) override; void AddToVelocityY(double) override; private: // If the player is facing right bool _facingRight; Graphics* _graphics; double _aVel; Player* _player; double _radAngle; Animation* _animation; }; }
// -*- C++ -*- // // HwDecayHandler.h is a part of Herwig - A multi-purpose Monte Carlo event generator // Copyright (C) 2002-2019 The Herwig Collaboration // // Herwig is licenced under version 3 of the GPL, see COPYING for details. // Please respect the MCnet academic guidelines, see GUIDELINES for details. // #ifndef HERWIG_HwDecayHandler_H #define HERWIG_HwDecayHandler_H // // This is the declaration of the HwDecayHandler class. // #include "ThePEG/Handlers/DecayHandler.h" #include "ThePEG/EventRecord/Particle.h" namespace Herwig { using namespace ThePEG; /** \ingroup Decay * The <code>HwDecayHandler</code> is the Herwig decay handler which * administers the decays of unstable particles in Herwig. It * is derived from ThePEG::DecayHandler and includes a different handle * method in order to simulate decays including spin correlations. * * The handle method decays all particles in the current step, including * spin correlations. Another feature of the DecayHandler is that it correctly * handles mutlistep decays where a Decayer supplys intermediate decay products * in addition to the outgoing particles. * * @see ThePEG::StepHandler * @see ThePEG::CollisionHandler * @see ThePEG::SubProcessHandler * @see ThePEG::DecayHandler * */ class HwDecayHandler: public DecayHandler { public: /** * Default constructor */ HwDecayHandler() : DecayHandler(), _newstep(true) {} public: /** * Look through all \a tagged particled and decay all unstable ones. * @param eh the EventHandler in charge of the generation. * @param tagged the vector of particles to consider. If empty, all * final state particles in the current Step is considered. * @param hint a possible Hint which is ignored in this implementation. */ virtual void handle(EventHandler & eh, const tPVector & tagged, const Hint & hint) ; /** * Perform the decay of one unstable particle. * @param parent the particle to be decayed. * @param s the Step where decay products are inserted. * @throws Veto if the Handler requires the current step to be discarded. * @throws Exception if something goes wrong. */ virtual void performDecay(tPPtr parent, Step & s) const ; /** * add the decay products of in intermediate particle produced in a decay * @param parent the particle which has been decayed. * @param s the Step where decay products are inserted. * @throws Veto if the Handler requires the current step to be discarded. * @throws Exception if something goes wrong. */ void addDecayedParticle(tPPtr parent, Step & s) const ; /** * Standard Init function */ static void Init(); public: /** @name Functions used by the persistent I/O system. */ //@{ /** * Function used to write out object persistently. * @param os the persistent output stream written to. */ void persistentOutput(PersistentOStream & os) const; /** * Function used to read in object persistently. * @param is the persistent input stream read from. * @param version the version number of the object when written. */ void persistentInput(PersistentIStream & is, int version); //@} protected: /** @name Clone Methods. */ //@{ /** * Make a simple clone of this object. * @return a pointer to the new object. */ virtual IBPtr clone() const {return new_ptr(*this);} /** Make a clone of this object, possibly modifying the cloned object * to make it sane. * @return a pointer to the new object. */ virtual IBPtr fullclone() const {return new_ptr(*this);} //@} protected: /** @name Standard Interfaced functions. */ //@{ /** * Initialize this object after the setup phase before saving an * EventGenerator to disk. * @throws InitException if object could not be initialized properly. */ virtual void doinit(); //@} protected: /** * Develop a stable particle */ void develop(tPPtr particle) const { tcSpinPtr hwspin = particle->spinInfo(); if ( hwspin ) hwspin->develop(); } private: /** * Private and non-existent assignment operator. */ HwDecayHandler & operator=(const HwDecayHandler &) = delete; private: /** * Option for adding particles in a new Step */ bool _newstep; /** * Particles which should not be decayed */ set<tcPDPtr> _excluded; /** * Vector to fill the set as an interface */ vector<PDPtr> _excludedVector; }; } #endif /* HERWIG_HwDecayHandler_H */
/********************************************************************* CombLayer : MCNP(X) Input builder * File: essBuildInc/H2Wing.h * * Copyright (c) 2004-2019 by Stuart Ansell * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. * ****************************************************************************/ #ifndef essSystem_H2Wing_h #define essSystem_H2Wing_h class Simulation; namespace essSystem { class H2FlowGuide; /*! \class H2Wing \version 1.0 \author S. Ansell \date April 2015 \brief H2Wing component in the butterfly moderator */ class H2Wing : public attachSystem::ContainedComp, public attachSystem::LayerComp, public attachSystem::FixedComp, public attachSystem::CellMap { private: const std::string baseName; ///< Basename int engActive; ///< Engineering active std::shared_ptr<H2FlowGuide> InnerComp; ///< Inner flow components double xStep; ///< Step across proton beam direction double yStep; ///< Step along proton beam direction double xyOffset; ///< xy-Angle offset std::array<Geometry::Vec3D,3> Pts; ///< Corner Points std::array<double,3> radius; ///< corner radii double height; ///< height of moderator cell double totalHeight; ///< total height moderator int modMat; ///< LH2 double modTemp; ///< LH2 temperature [K] std::vector<double> Thick; ///< Layer thickness std::vector<double> layerHeight; ///< Layer veritcal std::vector<double> layerDepth; ///< layer depth std::vector<int> mat; ///< Layer material std::vector<double> temp; ///< Layer temperature void populate(const FuncDataBase&); void createUnitVector(const attachSystem::FixedComp&, const long int); void createSurfaces(); void createObjects(Simulation&); void createLinks(); Geometry::Vec3D realPt(const Geometry::Vec3D&) const; Geometry::Vec3D realAxis(const Geometry::Vec3D&) const; Geometry::Vec3D midNorm(const size_t) const; void cornerSet(const double,std::array<Geometry::Vec3D,3>&, std::array<Geometry::Vec3D,3>&) const; public: H2Wing(const std::string&,const std::string&,const double); H2Wing(const H2Wing&); H2Wing& operator=(const H2Wing&); virtual H2Wing* clone() const; virtual ~H2Wing(); virtual Geometry::Vec3D getSurfacePoint(const size_t,const long int) const; virtual std::string getLayerString(const size_t,const long int) const; virtual int getLayerSurf(const size_t,const long int) const; void createAll(Simulation&,const attachSystem::FixedComp&, const long int); }; } #endif
/* * cparamSearch.h * ARToolKit5 * * This file is part of ARToolKit. * * ARToolKit 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. * * ARToolKit 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 ARToolKit. If not, see <http://www.gnu.org/licenses/>. * * As a special exception, the copyright holders of this library give you * permission to link this library with independent modules to produce an * executable, regardless of the license terms of these independent modules, and to * copy and distribute the resulting executable under terms of your choice, * provided that you also meet, for each linked independent module, the terms and * conditions of the license of that module. An independent module is a module * which is neither derived from nor based on this library. If you modify this * library, you may extend this exception to your version of the library, but you * are not obligated to do so. If you do not wish to do so, delete this exception * statement from your version. * * Copyright 2015 Daqri, LLC. * Copyright 2013-2015 ARToolworks, Inc. * * Author(s): Philip Lamb * */ #ifndef CPARAMSEARCH_H #define CPARAMSEARCH_H #include <AR/video.h> #ifdef __cplusplus extern "C" { #endif // cacheDir NULL to use current working directory for cache, otherwise path to use. // resetCache 1 to reset the cache to initial state, or 0 to use existing cache (if any). // Returns 0 if succesful, <0 if error. int cparamSearchInit(const char *cacheDir, int resetCache); // Returns 0 if succesful, <0 if error. int cparamSearchFinal(); // >= 0 is normal state. // < 0 is error state. typedef enum { CPARAM_SEARCH_STATE_INITIAL = 0, // The request has been received, but no action has been taken yet. CPARAM_SEARCH_STATE_IN_PROGRESS = 1, // The request has been received, and is being processed. CPARAM_SEARCH_STATE_RESULT_NULL = 2, // Request completed, but no cparam was available. CPARAM_SEARCH_STATE_OK = 3, // The request succeeded, a cparam was available and returned. CPARAM_SEARCH_STATE_FAILED_ERROR = -1, // The request failed because of some other unspecified error, typically a failure in the fetch module itself. CPARAM_SEARCH_STATE_FAILED_NO_NETWORK = -2, // A network connection was required but was not available. The user should be asked to enable the network. CPARAM_SEARCH_STATE_FAILED_NETWORK_FAILED = -3, // A network connection was required and available, but network I/O failed (e.g. connection dropped). CPARAM_SEARCH_STATE_FAILED_SERVICE_UNREACHABLE = -4, // A network connection was required, and available, but the server could not be reached. CPARAM_SEARCH_STATE_FAILED_SERVICE_UNAVAILABLE = -5, // The server reported itself temporarily unavailable. The search may be retried at a later time. Searches may be throttled. CPARAM_SEARCH_STATE_FAILED_SERVICE_FAILED = -6, // The search failed due to an internal error in the server. The search may be retried at a later time. Searches may be throttled. CPARAM_SEARCH_STATE_FAILED_SERVICE_NOT_PERMITTED = -7, // The search failed because access from this client is not permitted. CPARAM_SEARCH_STATE_FAILED_SERVICE_INVALID_REQUEST = -8, // The search failed because the server did not understand it. This should be considered a permanent failure. } CPARAM_SEARCH_STATE; // Type signature for a function which will be called while the fetch operation is progressing. // May be called zero or more times with state=CPARAM_SEARCH_STATE_IN_PROGRESS and progress=[0.0,1.0]. // Any other state constitutes a final report and the end of the operation. // If state=CPARAM_SEARCH_STATE_OK, the camera parameters are returned in *cparam, which should // be considered valid only for the duration of the callback. typedef void (*CPARAM_SEARCH_CALLBACK)(CPARAM_SEARCH_STATE state, float progress, const ARParam *cparam, void *userdata); // Tell cparamSearch about the state of the Internet connection. // -1 State of Internet connection unknown. cparamSearch will attempt to determine the state. This is the initial state. // 0 Internet connection is down. // 1 Internet connection is up. int cparamSearchSetInternetState(int state); // Normally returns CPARAM_SEARCH_STATE_INITIAL, and progress will be passed via the callback. // If any other state is returned however, that is definitive, and the callback will never be called. // The callback may occur on an arbitrary thread; ensure any variables it modifies are thread-safe. CPARAM_SEARCH_STATE cparamSearch(const char *device_id, int camera_index, int width, int height, float focal_length, CPARAM_SEARCH_CALLBACK callback, void *userdata); #ifdef __cplusplus } #endif #endif // !CPARAMSEARCH_H
/* * time.h * * Created: 2017-03-26 23:21:43 * Author: Adam */ #ifndef TIME_H_ #define TIME_H_ #include <stdint.h> uint32_t milis(); void initTime(); #endif /* TIME_H_ */
// // Copyleft RIME Developers // License: GPLv3 // // 2013-04-16 GONG Chen <chen.sst@gmail.com> // #ifndef RIME_USER_DB_H_ #define RIME_USER_DB_H_ #include <stdint.h> #include <string> #include <rime/dict/db_utils.h> namespace rime { using TickCount = uint64_t; struct UserDbValue { int commits = 0; double dee = 0.0; TickCount tick = 0; UserDbValue() = default; UserDbValue(const std::string& value); std::string Pack() const; bool Unpack(const std::string& value); }; template <class BaseDb> class UserDb : public BaseDb { public: explicit UserDb(const std::string& name); virtual bool CreateMetadata(); virtual bool Backup(const std::string& snapshot_file); virtual bool Restore(const std::string& snapshot_file); bool IsUserDb(); std::string GetDbName(); std::string GetUserId(); std::string GetRimeVersion(); static const std::string extension; static const std::string snapshot_extension; }; class UserDbMerger : public Sink { public: explicit UserDbMerger(Db* db); virtual ~UserDbMerger(); virtual bool MetaPut(const std::string& key, const std::string& value); virtual bool Put(const std::string& key, const std::string& value); void CloseMerge(); protected: Db* db_; TickCount our_tick_; TickCount their_tick_; TickCount max_tick_; int merged_entries_; }; class UserDbImporter : public Sink { public: explicit UserDbImporter(Db* db); virtual bool MetaPut(const std::string& key, const std::string& value); virtual bool Put(const std::string& key, const std::string& value); protected: Db* db_; }; } // namespace rime #endif // RIME_USER_DB_H_
/* Copyright © 2014-2019 by The qTox Project Contributors This file is part of qTox, a Qt-based graphical interface for Tox. qTox is libre software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. qTox 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 qTox. If not, see <http://www.gnu.org/licenses/>. */ #pragma once #include "contact.h" #include "src/core/contactid.h" #include "src/core/groupid.h" #include "src/core/icoregroupquery.h" #include "src/core/icoreidhandler.h" #include "src/core/toxpk.h" #include <QMap> #include <QObject> #include <QStringList> class Group : public Contact { Q_OBJECT public: Group(int groupId, const GroupId persistentGroupId, const QString& name, bool isAvGroupchat, const QString& selfName, ICoreGroupQuery& groupQuery, ICoreIdHandler& idHandler); bool isAvGroupchat() const; uint32_t getId() const override; const GroupId& getPersistentId() const override; int getPeersCount() const; void regeneratePeerList(); const QMap<ToxPk, QString>& getPeerList() const; bool peerHasNickname(ToxPk pk); void setEventFlag(bool f) override; bool getEventFlag() const override; void setMentionedFlag(bool f); bool getMentionedFlag() const; void updateUsername(ToxPk pk, const QString newName); void setName(const QString& newTitle) override; void setTitle(const QString& author, const QString& newTitle); QString getName() const; QString getDisplayedName() const override; QString resolveToxId(const ToxPk& id) const; void setSelfName(const QString& name); QString getSelfName() const; bool useHistory() const final; signals: void titleChangedByUser(const QString& title); void titleChanged(const QString& author, const QString& title); void userJoined(const ToxPk& user, const QString& name); void userLeft(const ToxPk& user, const QString& name); void numPeersChanged(int numPeers); void peerNameChanged(const ToxPk& peer, const QString& oldName, const QString& newName); private: void stopAudioOfDepartedPeers(const ToxPk& peerPk); private: ICoreGroupQuery& groupQuery; ICoreIdHandler& idHandler; QString selfName; QString title; QMap<ToxPk, QString> peerDisplayNames; bool hasNewMessages; bool userWasMentioned; int toxGroupNum; const GroupId groupId; bool avGroupchat; };
/* TaKIPI 1.5 * * (c) Instytut Informatyki Stosowanej Politechniki Wrocławskiej * i Instytut Podstaw Informatyki PAN * Autorzy: Grzegorz Godlewski, Adam Radziszewski, Maciej Piasecki, * Bartosz Broda, Adam Wardyński * * Kod na licencji GPL. */ #ifndef TAKIPI_NEGRULEDECISIONTREE_H #define TAKIPI_NEGRULEDECISIONTREE_H #include "../../takipi_headers.h" #include "NegRuleDecisionTreeNode.h" namespace TaKIPI { namespace Classifiers { class TAKIPI_DEV_API CNegRuleDecisionTree { public: CNegRuleDecisionTree(std::vector<std::string>& drzewo, Corpus::TFlexClass flexClass, Corpus::DLONG gramCat); CNegRuleDecisionTree(); ~CNegRuleDecisionTree(void); // Statyczna metoda tworz¹ca drzewo na stosie, z pliku QuinLana. static CNegRuleDecisionTree* CreateTree(std::ifstream& file, bool simplyfied, Corpus::TFlexClass flexClass, Corpus::DLONG gramCat); void UseNegRuleTree(JOSKIPI::Patterns::CPattern& pattern, Corpus::CSentence& sentence); // Serializacja i deserializacja drzewa. void Serialize(); static CNegRuleDecisionTree* Deserialize(std::ifstream &file); protected: // korzeñ drzewa decyzyjnego CNegRuleDecisionTreeNode* root; // Klasa fleksyjna. Corpus::TFlexClass flexClass; // Kategoria gramatyczna. Corpus::DLONG gramaticalCat; }; }// namespace Classifiers }//namespace TaKIPI #endif//TAKIPI_NEGRULEDECISIONTREE_H
#include <stdio.h> #include <check.h> #include <limits.h> #include "simple-math.h" START_TEST (test_max) { printf ("Test max using assert: "); ck_assert_int_eq(max(13,14),14); ck_assert_int_eq(max(INT_MAX,-1),INT_MAX); printf (" OK\n"); } END_TEST Suite * max_suite(void) { Suite *s; TCase *tc_core; s = suite_create("Max"); /* Core test case */ tc_core = tcase_create("Core"); tcase_add_test(tc_core, test_max); suite_add_tcase(s, tc_core); return s; } int main(void) { int number_failed; Suite *s; SRunner *sr; s = max_suite(); sr = srunner_create(s); srunner_run_all(sr, CK_NORMAL); number_failed = srunner_ntests_failed(sr); srunner_free(sr); return (number_failed == 0) ? 0 : 1; }
/* * Copyright (C) 2014 Roland Dobai * * This file is part of ZyEHW. * * ZyEHW is free software: you can redistribute it and/or modify it under the * terms of the GNU General Public License as published by the Free Software * Foundation, either version 3 of the License, or (at your option) any later * version. * * ZyEHW 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 ZyEHW. If not, see <http://www.gnu.org/licenses/>. */ #ifndef CGP_H #define CGP_H #include <inttypes.h> #include "img.h" #define CGP_PI 9 #define CGP_BIT 8 #define CGP_COL 8 #define CGP_ROW 4 typedef uint32_t fitness_t; typedef uint8_t mux_t; typedef uint32_t lut_t; typedef struct { mux_t mux_a; mux_t mux_b; lut_t msb[CGP_BIT]; lut_t lsb[CGP_BIT]; } cgp_pe_t; typedef struct { cgp_pe_t cgp_pe[CGP_COL][CGP_ROW]; mux_t filter_switch; mux_t out_select; } cgp_t; extern cgp_t *cgp_allocate(); extern void cgp_deallocate(cgp_t *cgp); extern fitness_t cgp_compute_fitness(const cgp_t *cgp, const img_t *good_img, const img_t *bad_img, img_t *corrected_img, int img_size); extern void cgp_initialize_pes(cgp_t *cgp); extern void cgp_print(const cgp_t *cgp); #endif
/* * console.c - A simple console framework * * Create On: Feb 1, 2015 * Author: Oliver <rootkitsecurity@gmail.com> * */ #include <stdio.h> #include <string.h> #include <stdlib.h> #include <pthread.h> #include "console.h" #define PROMPT 11 static int help(void); static int quit(void); static char inited = 0; static pthread_t conpid; static char g_prompt[PROMPT] = {0}; static cmd_s *command_list = NULL; static int help(void) { int idx = 1; cmd_info_s *cmd_info = command_list->head; while (cmd_info) { fprintf(stdout, "%4d: %s - %s\n", idx++, cmd_info->cmd, cmd_info->des); cmd_info = cmd_info->next; } return 0; } static int quit(void) { exit(EXIT_SUCCESS); } static void *console_deal(void *arg) { char input_cmd[20]; cmd_info_s *cmd_info; pthread_detach(pthread_self()); memcpy(g_prompt, (char *)arg, PROMPT - 1); while (printf("%s", g_prompt) && fgets(input_cmd, sizeof(input_cmd), stdin)) { cmd_info = command_list->head; input_cmd[strlen(input_cmd) - 1] = '\0'; if (input_cmd[0] == '\0') continue; while (cmd_info) { if (!strcmp(cmd_info->cmd, input_cmd)) break; cmd_info = cmd_info->next; } if (cmd_info == NULL) { fprintf(stderr, "%s: command not found\n", input_cmd); continue; } (*cmd_info->func)(); } return 0; } int console_modify_cmd(const char *cmdname, int (*nfunc)(void), const char *ndes) { cmd_info_s *cmd_info = command_list->head; while (cmd_info) { if (strcmp(cmd_info->cmd, cmdname) == 0) { cmd_info->func = nfunc; memcpy(cmd_info->des, ndes, strlen(ndes) + 1); } cmd_info = cmd_info->next; } return 0; } int console_add_cmd(const char *cmdname, int (*func)(void), const char *des) { cmd_info_s *cmd_info = NULL; if (!inited) { fprintf(stderr, "console not init\n"); return -1; } cmd_info = (cmd_info_s *)calloc(1, sizeof(cmd_info_s)); if (cmd_info == NULL) { fprintf(stderr, "calloc failed!\n"); return -1; } memcpy(cmd_info->cmd, cmdname, CMDSIZE); memcpy(cmd_info->des, des, DESSIZE); cmd_info->func = func; cmd_info->next = NULL; if (command_list != NULL) cmd_info->next = command_list->head; command_list->head = cmd_info; command_list->nr_cmds++; return 0; } int console_del_cmd(const char *cmdname) { cmd_info_s *cmd_info, *cmd_pre; cmd_info = cmd_pre = command_list->head; if (!strcmp(cmdname, "help") || !strcmp(cmdname, "quit")) { fprintf(stderr, "You cannot delete command of help or quit.\n"); return -1; } while (cmd_info) { if (strcmp(cmdname, command_list->head->cmd) == 0) { command_list->head = cmd_info->next; free(cmd_info); cmd_info = cmd_pre = command_list->head; continue; } if (strcmp(cmdname, cmd_info->cmd) == 0) { cmd_pre->next = cmd_info->next; free(cmd_info); cmd_info = cmd_info->next; continue; } cmd_pre = cmd_info; cmd_info = cmd_info->next; } return 0; } int console_init(const char *prompt) { if (inited) return 0; command_list = (cmd_s *)calloc(1, sizeof(cmd_s)); if (command_list == NULL) { fprintf(stderr, "calloc failed\n"); return -1; } command_list->nr_cmds = 0; command_list->head = NULL; if (pthread_create(&conpid, NULL, console_deal, (void *)prompt) < 0) return -1; inited = 1; console_add_cmd("help", help, "display help information"); console_add_cmd("quit", quit, "quit console"); return 0; }
#pragma once #define sTypeDomoticzSecurity 0x83 #define sTypeRAINWU 0x70 //Weather Underground (Total rain reported, no counter) #define sTypeTHBFloat 0x10 //Weather Station #define sTypeWINDNoTemp 0x30 //Weather Station #define wsbaroforcast_heavy_snow 0x01 #define wsbaroforcast_snow 0x01 #define wsbaroforcast_heavy_rain 0x02 #define wsbaroforcast_rain 0x03 #define wsbaroforcast_cloudy 0x04 #define wsbaroforcast_some_clouds 0x05 #define wsbaroforcast_sunny 0x06 #define pTypeLimitlessLights 0xF1 #define sTypeLimitlessRGBW 0x01 #define sTypeLimitlessRGB 0x02 #define sTypeLimitlessWhite 0x03 #define pTypeThermostat 0xF2 #define sTypeThermSetpoint 0x01 #define sTypeThermTemperature 0x02 #define pTypeGeneral 0xF3 #define sTypeVisibility 0x01 #define sTypeSolarRadiation 0x02 #define sTypeSoilMoisture 0x03 #define sTypeLeafWetness 0x04 #define sTypeSystemTemp 0x05 #define sTypePercentage 0x06 #define sTypeSystemFan 0x07 #define sTypeVoltage 0x08 #define sTypePressure 0x09 #define sTypeSetPoint 0x10 #define sTypeTemperature 0x11 #define pTypeLux 0xF6 #define sTypeLux 0x01 #define pTypeTEMP_BARO 0xF7 #define sTypeBMP085 0x01 #define sTypeWBTempBaro 0x02 #define pTypeUsage 0xF8 #define sTypeElectric 0x01 #define pTypeAirQuality 0xF9 #define sTypeVoltcraft 0x01 #define pTypeP1Power 0xFA #define sTypeP1Power 0x01 #define mModeP1Norm 0x00 #define mModeP1Double 0x01 #define pTypeP1Gas 0xFB #define sTypeP1Gas 0x02 #define pTypeYouLess 0xFC #define sTypeYouLess 0x01 #define pTypeRego6XXTemp 0xFD #define sTypeRego6XXTemp 0x01 #define pTypeRego6XXValue 0xFE #define sTypeRego6XXStatus 0x02 #define sTypeRego6XXCounter 0x03 //Z-Wave //#define pTypeENERGY 0x5A #define sTypeZWaveUsage 0xA0 typedef struct _tThermostat { unsigned char len; unsigned char type; unsigned char subtype; BYTE id1; BYTE id2; BYTE id3; BYTE id4; unsigned char dunit; unsigned char battery_level; float temp; float temp1; float temp2; float temp3; unsigned char utemp1; unsigned char utemp2; unsigned char utemp3; _tThermostat() { len=sizeof(_tThermostat)-1; type=pTypeThermostat; subtype=sTypeThermTemperature; battery_level=255; id1=1; id2=0; id3=0; id4=0; } } tThermostat; typedef struct _tTempBaro { unsigned char len; unsigned char type; unsigned char subtype; BYTE id1; float temp; float baro; float altitude; unsigned char forecast; _tTempBaro() { len=sizeof(_tTempBaro)-1; type=pTypeTEMP_BARO; subtype=sTypeBMP085; id1=1; } } _tTempBaro; typedef struct _tAirQualityMeter { unsigned char len; unsigned char type; unsigned char subtype; BYTE id1; int airquality; _tAirQualityMeter() { len=sizeof(_tAirQualityMeter)-1; type=pTypeAirQuality; subtype=sTypeVoltcraft; id1=0; } } AirQualityMeter; typedef struct _tUsageMeter { unsigned char len; unsigned char type; unsigned char subtype; BYTE id1; BYTE id2; BYTE id3; BYTE id4; unsigned char dunit; float fusage; _tUsageMeter() { len=sizeof(_tUsageMeter)-1; type=pTypeUsage; subtype=sTypeElectric; id1=0; id2=0; id3=0; id4=0; } } UsageMeter; typedef struct _tLightMeter { unsigned char len; unsigned char type; unsigned char subtype; BYTE id1; BYTE id2; BYTE id3; BYTE id4; unsigned char dunit; unsigned char battery_level; float fLux; _tLightMeter() { len=sizeof(_tLightMeter)-1; type=pTypeLux; subtype=sTypeLux; id1=0; id2=0; id3=0; id4=0; battery_level=255; } } LightMeter; typedef struct _tGeneralDevice { unsigned char len; unsigned char type; unsigned char subtype; unsigned char id; float floatval1; float floatval2; int intval1; int intval2; _tGeneralDevice() { len=sizeof(_tGeneralDevice)-1; type=pTypeGeneral; subtype=sTypeVisibility; id=0; } } GeneralDevice; typedef struct _tP1Power { unsigned char len; unsigned char type; unsigned char subtype; unsigned long powerusage1; unsigned long powerusage2; unsigned long powerdeliv1; unsigned long powerdeliv2; unsigned long usagecurrent; unsigned long delivcurrent; } P1Power; typedef struct _tP1Gas { unsigned char len; unsigned char type; unsigned char subtype; unsigned long gasusage; } P1Gas; typedef struct _tLimitlessLights { unsigned char len; unsigned char type; unsigned char subtype; unsigned long id; unsigned char dunit; //0=All, 1=Group1,2=Group2,3=Group3,4=Group4 unsigned char command; unsigned char value; _tLimitlessLights() { id = 1; dunit = 1; len=sizeof(_tLimitlessLights)-1; type=pTypeLimitlessLights; subtype=sTypeLimitlessRGBW; } } _tLimitlessLights; #define Limitless_LedOff 0 #define Limitless_LedOn 1 #define Limitless_LedNight 2 #define Limitless_LedFull 3 #define Limitless_BrightnessUp 4 #define Limitless_BrightnessDown 5 #define Limitless_ColorTempUp 6 #define Limitless_ColorTempDown 7 #define Limitless_RGBDiscoNext 8 #define Limitless_RGBDiscoPrevious 9 #define Limitless_SetRGBColour 10 #define Limitless_DiscoSpeedSlower 11 #define Limitless_DiscoSpeedFaster 12 #define Limitless_DiscoMode 13 #define Limitless_SetColorToWhite 14 #define Limitless_SetBrightnessLevel 15 #define Limitless_SetBrightUp 16 #define Limitless_SetBrightDown 17 #define Limitless_WarmWhiteIncrease 18 #define Limitless_CoolWhiteIncrease 19 #define Limitless_NightMode 20 #define Limitless_FullBrightness 21 #define Limitless_DiscoSpeedFasterLong 22 //exclude RGB
/* * ===================================================================================== * * Filename: riemann_solve.h * * Description: * * Created: 03/24/2010 01:35:04 PM EDT * Author: Dinesh Kumar (dkumar), dkumar@buffalo.edu * License: GNU General Public License * * This software can be redistributed free of charge. See COPYING * file in the top distribution directory for more details. * * This software 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. * * ===================================================================================== * $Id:$ */ #ifndef RIEMANN_SOLVE__H #define RIEMANN_SOLVE__H #include "properties.h" #include "particle.h" #ifdef HAVE_CONFIG_H # include <config.h> #endif #define eigen_decomp eigen1d /*! * reimann_solve() computes Riemann invariants at a * particle-particle interface. */ double riemann_solve( //! particle P_{i} Particle *pi, //! particle P_{j} Particle *pj, //! Material Properties MatProps *matprops, //! time-step dt double dt); extern "C" { /*! * eigen () solves Riemann problem, setup by setup_rp(). * Reimann invariants are stored on Ustar. The Reimann Soltion * is very much problem specific. Any change in constitutive model * requires this function to be modified. */ int eigen2d ( //! density double rho, //! velocity in tangetial direction double ux, //! Velocity of Sound in the medium double c, //! jumps in left and right states double du[], //! eigen-values returned by the function double eval[], //! jumps resolved along eigen-vectors double alph[], //! eigen-vectors returned by the function double evec[][3]); int eigen3d ( //! density double rho, //! velocity in tangetial direction double ux, //! Velocity of Sound in the medium double c, //! jumps in left and right states double du[], //! eigen-values returned by the function double eval[], //! jumps resolved along eigen-vectors double alph[], //! eigen-vectors returned by the function double evec[][4]); }// extern "C" #endif // RIEMANN_SOLVE__H