text
stringlengths
4
6.14k
/* * pOS * schedule.h * 10/27/05 * arch specific scheduler code */ /* TODO: * * - how to init with an empty array ? * - all the operands for the register-saves/restores (__kernel. ...) * certainly won't work in assembly :( (test that for cc65 !) */ typedef struct __TASKENV { unsigned char stack [__MAX_STACKSIZE]; unsigned char reg_accu; unsigned char reg_x; unsigned char reg_y; unsigned char reg_ps; unsigned char reg_sp; unsigned char pc_lo; unsigned char pc_hi; } TASKENV; #define c_inittaskenv \ \ {, \ {}, \ 0, \ 0, \ 0, \ 32, \ 255, \ (unsigned char) heap, \ (unsigned char) heap << 8 \ } \ #define m_saveenv \ \ __asm__ { \ \ pla \ sta __kernel.current->taskenv.reg_y \ pla \ sta __kernel.current->taskenv.reg_x \ pla \ sta __kernel.current->taskenv.reg_accu \ pla \ sta __kernel.current->taskenv.reg_ps \ pla \ sta __kernel.current->taskenv.pc_lo \ pla \ sta __kernel.current->taskenv.pc_hi \ tsx \ stx __kernel.current->taskenv.sp \ save_stack_loop: \ pla \ sta __kernel.current->taskenv.stack, x \ dex \ bpl save_stack_loop \ } \ #define m_loadenv \ \ __asm__ { \ \ ldx #$00 \ load_stack_loop: \ lda __kernel.current->taskenv.stack, x \ pha \ inx \ cpx __kernel.current->taskenv.sp \ bne load_stack_loop \ \ lda __kernel.current->taskenv.pc_hi \ pha \ lda __kernel.current->taskenv.pc_lo \ pha \ lda __kernel.current->taskenv.reg_ps \ pha \ ldy __kernel.current->taskenv.reg_y \ ldx __kernel.current->taskenv.reg_x \ lda __kernel.current->taskenv.reg_accu \ } \ // Well, them two are not pretty sophisticated: #define m_lock __asm__ sei #define m_unlock __asm__ cli
/* Read in a solution in SDPA sparse format. */ #include <stdio.h> #include <stdlib.h> #include "declarations.h" void skip_to_end_of_line(); int read_sol(fname, n, k, C, pX, py, pZ) char *fname; int n; int k; struct blockmatrix C; struct blockmatrix *pX; double **py; struct blockmatrix *pZ; { FILE *fid; int i; int indexi; int indexj; int blkno; int matno; double ent; int ret; /* * Allocate storage. */ alloc_mat(C, pX); alloc_mat(C, pZ); *py = (double *)malloc_d(sizeof(double) * (k + 1)); /* * Open the file for reading. */ fid = fopen(fname, "r"); if (fid == (FILE *)NULL) { printf("Couldn't open solution file for reading. \n"); exit(11); }; /* * Read in y. */ for (i = 1; i <= k; i++) { ret = fscanf(fid, "%le", &((*py)[i])); if (ret != 1) { printf("Reading solution failed, while reading y. ret=%d\n", ret); fclose(fid); return (1); }; }; skip_to_end_of_line(fid); /* * Initialize X and Z to 0. */ zero_mat(*pX); zero_mat(*pZ); /* * Read in the rest of the data. */ do { ret = fscanf(fid, "%d %d %d %d %le", &matno, &blkno, &indexi, &indexj, &ent); if ((ret != 5) && (ret != EOF)) { printf("Bad line in solution file: %d %d %d %d %e\n", matno, blkno, indexi, indexj, ent); fclose(fid); return (1); }; if (matno == 1) { switch (pZ->blocks[blkno].blockcategory) { case DIAG: pZ->blocks[blkno].data.vec[indexi] = ent; break; case MATRIX: pZ->blocks[blkno] .data.mat[ijtok(indexi, indexj, pZ->blocks[blkno].blocksize)] = ent; pZ->blocks[blkno] .data.mat[ijtok(indexj, indexi, pZ->blocks[blkno].blocksize)] = ent; break; default: printf("Illegal block type! \n"); exit(12); }; } else { switch (pX->blocks[blkno].blockcategory) { case DIAG: pX->blocks[blkno].data.vec[indexi] = ent; break; case MATRIX: pX->blocks[blkno] .data.mat[ijtok(indexi, indexj, pX->blocks[blkno].blocksize)] = ent; pX->blocks[blkno] .data.mat[ijtok(indexj, indexi, pX->blocks[blkno].blocksize)] = ent; break; default: printf("Illegal block type! \n"); exit(12); }; }; } while (ret != EOF); fclose(fid); return (0); }
/* * Code stolen from wireless-tools. * 2003 - German Poo-Caaman~o <gpoo@ubiobio.cl> * * This file define a set of standard wireless extensions * * Version : 16 2.4.03 * * Authors : Jean Tourrilhes - HPL - <jt@hpl.hp.com> * Copyright (c) 1997-2002 Jean Tourrilhes, All Rights Reserved. */ //#ifndef _LINUX_WIRELESS_H //#define _LINUX_WIRELESS_H #include <sys/ioctl.h> /*#include <linux/if.h>*/ /* for IFNAMSIZ and co... */ /* Some useful constants */ #define KILO 1e3 #define MEGA 1e6 #define GIGA 1e9 /***************************** VERSION *****************************/ /* * This constant is used to know the availability of the wireless * extensions and to know which version of wireless extensions it is * (there is some stuff that will be added in the future...) * I just plan to increment with each new version. */ #define WIRELESS_EXT 16 /* -------------------------- IOCTL LIST -------------------------- */ /* Wireless Identification */ #define SIOCGIWRATE 0x8B21 /* get default bit rate (bps) */ /****************************** TYPES ******************************/ /* --------------------------- SUBTYPES --------------------------- */ /* * Generic format for most parameters that fit in an int */ struct iw_param { __s32 value; /* The value of the parameter itself */ __u8 fixed; /* Hardware should not use auto select */ __u8 disabled; /* Disable the feature */ __u16 flags; /* Various specifc flags (if any) */ }; /* * For all data larger than 16 octets, we need to use a * pointer to memory allocated in user space. */ struct iw_point { caddr_t pointer; /* Pointer to the data (in user space) */ __u16 length; /* number of fields or size in bytes */ __u16 flags; /* Optional params */ }; /* * A frequency * For numbers lower than 10^9, we encode the number in 'm' and * set 'e' to 0 * For number greater than 10^9, we divide it by the lowest power * of 10 to get 'm' lower than 10^9, with 'm'= f / (10^'e')... * The power of 10 is in 'e', the result of the division is in 'm'. */ struct iw_freq { __s32 m; /* Mantissa */ __s16 e; /* Exponent */ __u8 i; /* List index (when in range struct) */ __u8 pad; /* Unused - just for alignement */ }; /* * Quality of the link */ struct iw_quality { __u8 qual; /* link quality (%retries, SNR, %missed beacons or better...) */ __u8 level; /* signal level (dBm) */ __u8 noise; /* noise level (dBm) */ __u8 updated; /* Flags to know if updated */ }; /* ------------------------ IOCTL REQUEST ------------------------ */ /* * This structure defines the payload of an ioctl, and is used * below. * * Note that this structure should fit on the memory footprint * of iwreq (which is the same as ifreq), which mean a max size of * 16 octets = 128 bits. Warning, pointers might be 64 bits wide... * You should check this when increasing the structures defined * above in this file... */ union iwreq_data { /* Config - generic */ char name[IFNAMSIZ]; /* Name : used to verify the presence of wireless extensions. * Name of the protocol/provider... */ struct iw_point essid; /* Extended network name */ struct iw_param nwid; /* network id (or domain - the cell) */ struct iw_freq freq; /* frequency or channel : * 0-1000 = channel * > 1000 = frequency in Hz */ struct iw_param sens; /* signal level threshold */ struct iw_param bitrate; /* default bit rate */ struct iw_param txpower; /* default transmit power */ struct iw_param rts; /* RTS threshold threshold */ struct iw_param frag; /* Fragmentation threshold */ __u32 mode; /* Operation mode */ struct iw_param retry; /* Retry limits & lifetime */ struct iw_point encoding; /* Encoding stuff : tokens */ struct iw_param power; /* PM duration/timeout */ struct iw_quality qual; /* Quality part of statistics */ struct sockaddr ap_addr; /* Access point address */ struct sockaddr addr; /* Destination address (hw/mac) */ struct iw_param param; /* Other small parameters */ struct iw_point data; /* Other large parameters */ }; /* * The structure to exchange data for ioctl. * This structure is the same as 'struct ifreq', but (re)defined for * convenience... * Do I need to remind you about structure size (32 octets) ? */ struct iwreq { union { char ifrn_name[IFNAMSIZ]; /* if name, e.g. "eth0" */ } ifr_ifrn; /* Data part (defined just above) */ union iwreq_data u; };
/* * Copyright 2003-2011 NetLogic Microsystems, Inc. (NetLogic). All rights * reserved. * * This software is available to you under a choice of one of two * licenses. You may choose to be licensed under the terms of the GNU * General Public License (GPL) Version 2, available from the file * COPYING in the main directory of this source tree, or the NetLogic * license below: * * 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 NETLOGIC ``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 NETLOGIC 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 <linux/kernel.h> #include <linux/delay.h> #include <linux/init.h> #include <linux/smp.h> #include <linux/irq.h> #include <asm/mmu_context.h> #include <asm/netlogic/interrupt.h> #include <asm/netlogic/mips-extns.h> #include <asm/netlogic/xlr/iomap.h> #include <asm/netlogic/xlr/pic.h> #include <asm/netlogic/xlr/xlr.h> void core_send_ipi(int logical_cpu, unsigned int action) { int cpu = cpu_logical_map(logical_cpu); u32 tid = cpu & 0x3; u32 pid = (cpu >> 2) & 0x07; u32 ipi = (tid << 16) | (pid << 20); if (action & SMP_CALL_FUNCTION) ipi |= IRQ_IPI_SMP_FUNCTION; else if (action & SMP_RESCHEDULE_YOURSELF) ipi |= IRQ_IPI_SMP_RESCHEDULE; else return; pic_send_ipi(ipi); } void nlm_send_ipi_single(int cpu, unsigned int action) { core_send_ipi(cpu, action); } void nlm_send_ipi_mask(const struct cpumask *mask, unsigned int action) { int cpu; for_each_cpu(cpu, mask) { core_send_ipi(cpu, action); } } /* IRQ_IPI_SMP_FUNCTION Handler */ void nlm_smp_function_ipi_handler(unsigned int irq, struct irq_desc *desc) { smp_call_function_interrupt(); } /* IRQ_IPI_SMP_RESCHEDULE handler */ void nlm_smp_resched_ipi_handler(unsigned int irq, struct irq_desc *desc) { scheduler_ipi(); } /* * Called before going into mips code, early cpu init */ void nlm_early_init_secondary(void) { write_c0_ebase((uint32_t)nlm_common_ebase); /* TLB partition here later */ } /* * Code to run on secondary just after probing the CPU */ static void __cpuinit nlm_init_secondary(void) { nlm_smp_irq_init(); } void nlm_smp_finish(void) { #ifdef notyet nlm_common_msgring_cpu_init(); #endif local_irq_enable(); } void nlm_cpus_done(void) { } /* * Boot all other cpus in the system, initialize them, and bring them into * the boot function */ int nlm_cpu_unblock[NR_CPUS]; int nlm_cpu_ready[NR_CPUS]; unsigned long nlm_next_gp; unsigned long nlm_next_sp; cpumask_t phys_cpu_present_map; void nlm_boot_secondary(int logical_cpu, struct task_struct *idle) { unsigned long gp = (unsigned long)task_thread_info(idle); unsigned long sp = (unsigned long)__KSTK_TOS(idle); int cpu = cpu_logical_map(logical_cpu); nlm_next_sp = sp; nlm_next_gp = gp; /* barrier */ __sync(); nlm_cpu_unblock[cpu] = 1; } void __init nlm_smp_setup(void) { unsigned int boot_cpu; int num_cpus, i; boot_cpu = hard_smp_processor_id(); cpus_clear(phys_cpu_present_map); cpu_set(boot_cpu, phys_cpu_present_map); __cpu_number_map[boot_cpu] = 0; __cpu_logical_map[0] = boot_cpu; cpu_set(0, cpu_possible_map); num_cpus = 1; for (i = 0; i < NR_CPUS; i++) { if (nlm_cpu_ready[i]) { cpu_set(i, phys_cpu_present_map); __cpu_number_map[i] = num_cpus; __cpu_logical_map[num_cpus] = i; cpu_set(num_cpus, cpu_possible_map); ++num_cpus; } } pr_info("Phys CPU present map: %lx, possible map %lx\n", (unsigned long)phys_cpu_present_map.bits[0], (unsigned long)cpu_possible_map.bits[0]); pr_info("Detected %i Slave CPU(s)\n", num_cpus); } void nlm_prepare_cpus(unsigned int max_cpus) { } struct plat_smp_ops nlm_smp_ops = { .send_ipi_single = nlm_send_ipi_single, .send_ipi_mask = nlm_send_ipi_mask, .init_secondary = nlm_init_secondary, .smp_finish = nlm_smp_finish, .cpus_done = nlm_cpus_done, .boot_secondary = nlm_boot_secondary, .smp_setup = nlm_smp_setup, .prepare_cpus = nlm_prepare_cpus, }; unsigned long secondary_entry_point; int nlm_wakeup_secondary_cpus(u32 wakeup_mask) { unsigned int tid, pid, ipi, i, boot_cpu; void *reset_vec; secondary_entry_point = (unsigned long)prom_pre_boot_secondary_cpus; reset_vec = (void *)CKSEG1ADDR(0x1fc00000); memcpy(reset_vec, nlm_boot_smp_nmi, 0x80); boot_cpu = hard_smp_processor_id(); for (i = 0; i < NR_CPUS; i++) { if (i == boot_cpu) continue; if (wakeup_mask & (1u << i)) { tid = i & 0x3; pid = (i >> 2) & 0x7; ipi = (tid << 16) | (pid << 20) | (1 << 8); pic_send_ipi(ipi); } } return 0; }
#ifndef __IDE_DISK_H #define __IDE_DISK_H #include "ide-gd.h" #ifdef CONFIG_IDE_GD_ATA extern const struct ide_disk_ops ide_ata_disk_ops; ide_decl_devset(address); ide_decl_devset(multcount); ide_decl_devset(nowerr); ide_decl_devset(wcache); ide_decl_devset(acoustic); int ide_disk_ioctl(ide_drive_t *, struct block_device *, fmode_t, unsigned int, unsigned long); #ifdef CONFIG_IDE_PROC_FS extern ide_proc_entry_t ide_disk_proc[]; extern const struct ide_proc_devset ide_disk_settings[]; #endif #else #define ide_disk_proc NULL #define ide_disk_settings NULL #endif #endif
/* This file is part of libkabc. Copyright (c) 2002 Helge Deller <deller@gmx.de> 2002 Lubos Lunak <llunak@suse.cz> 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 KABC_ADDRESSLINEEDIT_H #define KABC_ADDRESSLINEEDIT_H // $Id: addresslineedit.h 465272 2005-09-29 09:47:40Z mueller $ #include <qobject.h> #include <qptrlist.h> #include <qtimer.h> #include "klineedit.h" #include "kcompletion.h" class KConfig; namespace KABC { class LdapSearch; /** * A lineedit with LDAP and kabc completion * * This lineedit is supposed to be used wherever the user types email addresses * and might want a completion. You can simply use it as a replacement for * KLineEdit or QLineEdit. * * You can enable or disable the lineedit at any time. * * @see AddressLineEdit::enableCompletion() */ class KABC_EXPORT AddressLineEdit : public KLineEdit { Q_OBJECT public: AddressLineEdit(QWidget* parent, bool useCompletion = true, const char *name = 0L); virtual ~AddressLineEdit(); /** * Reimplented for internal reasons. * @ see KLineEdit::setFont() */ virtual void setFont( const QFont& ); static KConfig *config(); public slots: /** * Set cursor to end of line. */ void cursorAtEnd(); /** * Toggle completion. */ void enableCompletion( bool enable ); protected: /** * Always call AddressLineEdit::loadAddresses() as the first thing. * Use addAddress() to add addresses. */ virtual void loadAddresses(); void addAddress( const QString& ); virtual void keyPressEvent(QKeyEvent*); virtual void dropEvent(QDropEvent *e); virtual void paste(); virtual void insert(const QString &t); virtual void mouseReleaseEvent( QMouseEvent * e ); void doCompletion(bool ctrlT); private slots: void slotCompletion() { doCompletion(false); } void slotPopupCompletion( const QString& ); void slotStartLDAPLookup(); void slotLDAPSearchData( const QStringList& ); private: void init(); void startLoadingLDAPEntries(); void stopLDAPLookup(); QStringList addresses(); QStringList removeMailDupes( const QStringList& adrs ); QString m_previousAddresses; bool m_useCompletion; bool m_completionInitialized; bool m_smartPaste; QString m_typedText; // unused static bool s_addressesDirty; static KCompletion *s_completion; static QTimer *s_LDAPTimer; static LdapSearch *s_LDAPSearch; static QString *s_LDAPText; static AddressLineEdit *s_LDAPLineEdit; static KConfig *s_config; private: class AddressLineEditPrivate* d; }; } #endif /* KABC_ADDRESSLINEEDIT_H */
// SPDX-License-Identifier: GPL-2.0 #include <stdlib.h> #include <stdio.h> #include <string.h> #include "errorhelper.h" #include "ssrf.h" #include "subsurface-string.h" #include "gettext.h" #include "divelist.h" #include "file.h" #include "libdivecomputer.h" /* * Fills a device_data_t structure with known dc data and a descriptor. */ static int ostc_prepare_data(int data_model, dc_family_t dc_fam, device_data_t *dev_data) { dc_descriptor_t *data_descriptor; dev_data->device = NULL; dev_data->context = NULL; data_descriptor = get_descriptor(dc_fam, data_model); if (data_descriptor) { dev_data->descriptor = data_descriptor; dev_data->vendor = copy_string(dc_descriptor_get_vendor(data_descriptor)); dev_data->model = copy_string(dc_descriptor_get_product(data_descriptor)); } else { return 0; } return 1; } /* * OSTCTools stores the raw dive data in heavily padded files, one dive * each file. So it's not necessary to iterate once and again on a parsing * function. Actually there's only one kind of archive for every DC model. */ void ostctools_import(const char *file, struct dive_table *divetable, struct trip_table *trips, struct dive_site_table *sites) { UNUSED(trips); UNUSED(sites); FILE *archive; device_data_t *devdata = calloc(1, sizeof(device_data_t)); dc_family_t dc_fam; unsigned char *buffer = calloc(65536, 1), *uc_tmp; char *tmp; struct dive *ostcdive = alloc_dive(); dc_status_t rc = 0; int model, ret, i = 0, c; unsigned int serial; struct extra_data *ptr; const char *failed_to_read_msg = translate("gettextFromC", "Failed to read '%s'"); // Open the archive if ((archive = subsurface_fopen(file, "rb")) == NULL) { report_error(failed_to_read_msg, file); free(ostcdive); goto out; } // Read dive number from the log uc_tmp = calloc(2, 1); if (fseek(archive, 258, 0) == -1) { report_error(failed_to_read_msg, file); free(uc_tmp); free(ostcdive); goto close_out; } if (fread(uc_tmp, 1, 2, archive) != 2) { report_error(failed_to_read_msg, file); free(uc_tmp); free(ostcdive); goto close_out; } ostcdive->number = uc_tmp[0] + (uc_tmp[1] << 8); free(uc_tmp); // Read device's serial number uc_tmp = calloc(2, 1); if (fseek(archive, 265, 0) == -1) { report_error(failed_to_read_msg, file); free(uc_tmp); free(ostcdive); goto close_out; } if (fread(uc_tmp, 1, 2, archive) != 2) { report_error(failed_to_read_msg, file); free(uc_tmp); free(ostcdive); goto close_out; } serial = uc_tmp[0] + (uc_tmp[1] << 8); free(uc_tmp); // Read dive's raw data, header + profile if (fseek(archive, 456, 0) == -1) { report_error(failed_to_read_msg, file); free(uc_tmp); free(ostcdive); goto close_out; } while ((c = getc(archive)) != EOF) { buffer[i] = c; if (buffer[i] == 0xFD && buffer[i - 1] == 0xFD) break; i++; } if (ferror(archive)) { report_error(failed_to_read_msg, file); free(ostcdive); goto close_out; } // Try to determine the dc family based on the header type if (buffer[2] == 0x20 || buffer[2] == 0x21) { dc_fam = DC_FAMILY_HW_OSTC; } else { switch (buffer[8]) { case 0x22: dc_fam = DC_FAMILY_HW_FROG; break; case 0x23: case 0x24: dc_fam = DC_FAMILY_HW_OSTC3; break; default: report_error(translate("gettextFromC", "Unknown DC in dive %d"), ostcdive->number); free(ostcdive); goto close_out; } } // Try to determine the model based on serial number switch (dc_fam) { case DC_FAMILY_HW_OSTC: if (serial > 7000) model = 3; //2C else if (serial > 2048) model = 2; //2N else if (serial > 300) model = 1; //MK2 else model = 0; //OSTC break; case DC_FAMILY_HW_FROG: model = 0; break; default: if (serial > 10000) model = 0x12; //Sport else model = 0x0A; //OSTC3 } // Prepare data to pass to libdivecomputer. ret = ostc_prepare_data(model, dc_fam, devdata); if (ret == 0) { report_error(translate("gettextFromC", "Unknown DC in dive %d"), ostcdive->number); free(ostcdive); goto close_out; } tmp = calloc(strlen(devdata->vendor) + strlen(devdata->model) + 28, 1); sprintf(tmp, "%s %s (Imported from OSTCTools)", devdata->vendor, devdata->model); ostcdive->dc.model = copy_string(tmp); free(tmp); // Parse the dive data rc = libdc_buffer_parser(ostcdive, devdata, buffer, i + 1); if (rc != DC_STATUS_SUCCESS) report_error(translate("gettextFromC", "Error - %s - parsing dive %d"), errmsg(rc), ostcdive->number); // Serial number is not part of the header nor the profile, so libdc won't // catch it. If Serial is part of the extra_data, and set to zero, remove // it from the list and add again. tmp = calloc(12, 1); sprintf(tmp, "%d", serial); ostcdive->dc.serial = copy_string(tmp); free(tmp); if (ostcdive->dc.extra_data) { ptr = ostcdive->dc.extra_data; while (strcmp(ptr->key, "Serial")) ptr = ptr->next; if (!strcmp(ptr->value, "0")) { add_extra_data(&ostcdive->dc, "Serial", ostcdive->dc.serial); *ptr = *(ptr)->next; } } else { add_extra_data(&ostcdive->dc, "Serial", ostcdive->dc.serial); } record_dive_to_table(ostcdive, divetable); sort_dive_table(divetable); close_out: fclose(archive); out: free(devdata); free(buffer); }
/* packet-dcom-cba-acco.h * Routines for DCOM CBA * * 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. */ #ifndef __PACKET_DCERPC_DCOM_CBA_ACCO_H #define __PACKET_DCERPC_DCOM_CBA_ACCO_H typedef struct cba_pdev_s { GList *ldevs; dcom_object_t *object; gint first_packet; const guint8 ip[4]; } cba_pdev_t; typedef struct cba_ldev_s { GList *provframes; GList *consframes; GList *provconns; GList *consconns; dcom_object_t *ldev_object; dcom_object_t *acco_object; cba_pdev_t *parent; gint first_packet; const char *name; } cba_ldev_t; extern GList *cba_pdevs; extern cba_pdev_t * cba_pdev_find(packet_info *pinfo, const address *addr, e_uuid_t *ipid); extern void cba_pdev_link(packet_info *pinfo, cba_pdev_t *pdev, dcom_interface_t *pdev_interf); extern cba_pdev_t * cba_pdev_add(packet_info *pinfo, const address *addr); extern void cba_ldev_link(packet_info *pinfo, cba_ldev_t *ldev, dcom_interface_t *ldev_interf); extern void cba_ldev_link_acco(packet_info *pinfo, cba_ldev_t *ldev, dcom_interface_t *acco_interf); extern cba_ldev_t * cba_ldev_find(packet_info *pinfo, const address *addr, e_uuid_t *ipid); extern cba_ldev_t * cba_ldev_add(packet_info *pinfo, cba_pdev_t *pdev, const char *name); #endif /* packet-dcerpc-dcom-cba-acco.h */
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- * * Copyright (C) 2011 Richard Hughes <richard@hughsie.com> * * Licensed under the GNU General Public License Version 2 * * 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. */ #pragma once #include <gtk/gtk.h> #include <NetworkManager.h> G_BEGIN_DECLS G_DECLARE_FINAL_TYPE (NetVpn, net_vpn, NET, VPN, GtkBox) NetVpn *net_vpn_new (NMClient *client, NMConnection *connection); NMConnection *net_vpn_get_connection (NetVpn *vpn); void net_vpn_set_show_separator (NetVpn *vpn, gboolean show_separator); G_END_DECLS
/* * This file is part of Crazy Parking * * Copyright (C) 2006 INdT - Instituto Nokia de Tecnologia * http://www.indt.org/maemo * * This software is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public License * as published by the Free Software Foundation; either version 2.1 of * the License, or (at your option) any later version. * * This 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. 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 software; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA * */ #include <stdio.h> //#include <hgw/hgw.h> #include "callbacks.h" #include "images.h" #include "level.h" // Pause the game int exit_callback(int errcode) { FILE *han; // Save state han = fopen("/tmp/.crazyparking-save", "wb"); if (han) { fwrite(&actual_level, sizeof(int), 1, han); fwrite(&moves, sizeof(int), 1, han); fwrite(car, sizeof(struct CAR), cars, han); fclose(han); } return 0; } // Quit game int quit_callback(int errcode) { remove("/tmp/.crazyparking-save"); //hgw_context_compat_destroy_quit(hgw_context); return 0; } int flush_callback(int errcode) { remove("/tmp/.crazyparking-save"); return 0; }
/* linux/arch/arm/plat-s5pc1xx/include/plat/gpio-bank-e1.h * * Copyright 2008 Openmoko, Inc. * Copyright 2008 Simtec Electronics * Ben Dooks <ben@simtec.co.uk> * http://armlinux.simtec.co.uk/ * * GPIO Bank A register and configuration definitions * * 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. */ #define S5PC1XX_GPE1CON (S5PC1XX_GPE1_BASE + 0x00) #define S5PC1XX_GPE1DAT (S5PC1XX_GPE1_BASE + 0x04) #define S5PC1XX_GPE1PUD (S5PC1XX_GPE1_BASE + 0x08) #define S5PC1XX_GPE1DRV (S5PC1XX_GPE1_BASE + 0x0c) #define S5PC1XX_GPE1CONPDN (S5PC1XX_GPE1_BASE + 0x10) #define S5PC1XX_GPE1PUDPDN (S5PC1XX_GPE1_BASE + 0x14) #define S5PC1XX_GPE1_CONMASK(__gpio) (0xf << ((__gpio) * 4)) #define S5PC1XX_GPE1_INPUT(__gpio) (0x0 << ((__gpio) * 4)) #define S5PC1XX_GPE1_OUTPUT(__gpio) (0x1 << ((__gpio) * 4)) #define S5PC1XX_GPE1_0_CAM_A_DATA_5 (0x2 << 0) #define S5PC1XX_GPE1_0_SD_1_DATA_5 (0x3 << 0) #define S5PC1XX_GPE1_0_GPIO_INT6_0 (0xf << 0) #define S5PC1XX_GPE1_1_CAM_A_DATA_6 (0x2 << 4) #define S5PC1XX_GPE1_1_SD_1_DATA_6 (0x3 << 4) #define S5PC1XX_GPE1_1_GPIO_INT6_1 (0xf << 4) #define S5PC1XX_GPE1_2_CAM_A_DATA_7 (0x2 << 8) #define S5PC1XX_GPE1_2_SD_1_DATA_7 (0x3 << 8) #define S5PC1XX_GPE1_2_GPIO_INT6_2 (0xf << 8) #define S5PC1XX_GPE1_3_CAM_A_CLKOUT (0x2 << 12) #define S5PC1XX_GPE1_3_GPIO_INT6_3 (0xf << 12) #define S5PC1XX_GPE1_4_CAM_A_RESET (0x2 << 16) #define S5PC1XX_GPE1_4_GPIO_INT6_4 (0xf << 16) #define S5PC1XX_GPE1_5_CAM_A_FIELD (0x2 << 20) #define S5PC1XX_GPE1_5_GPIO_INT6_5 (0xf << 20)
/* * This file is part of the coreboot project. * * Copyright 2016 Google Inc. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; version 2 of the License. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. */ #include <arch/acpi.h> #include <console/console.h> #include <cpu/x86/smm.h> #include <ec/google/chromeec/ec.h> #include <elog.h> #include <halt.h> #include "smm.h" static int chromeec_process_one_event(void) { uint8_t event = google_chromeec_get_event(); /* Log this event */ if (IS_ENABLED(CONFIG_ELOG_GSMI) && event) elog_add_event_byte(ELOG_TYPE_EC_EVENT, event); switch (event) { case EC_HOST_EVENT_LID_CLOSED: printk(BIOS_DEBUG, "LID CLOSED, SHUTDOWN\n"); poweroff(); break; } return !!event; } void chromeec_smi_process_events(void) { /* Process all pending events */ while (chromeec_process_one_event()) ; } static void clear_pending_events(void) { while (google_chromeec_get_event() != 0) ; } void chromeec_smi_sleep(int slp_type, uint32_t s3_mask, uint32_t s5_mask) { switch (slp_type) { case ACPI_S3: /* Enable wake events */ google_chromeec_set_wake_mask(s3_mask); break; case ACPI_S5: /* Enable wake events */ google_chromeec_set_wake_mask(s5_mask); break; } /* Disable SCI and SMI events */ google_chromeec_set_smi_mask(0); google_chromeec_set_sci_mask(0); /* Clear pending events that may trigger immediate wake */ clear_pending_events(); } void chromeec_smi_device_event_sleep(int slp_type, uint32_t s3_mask, uint32_t s5_mask) { switch (slp_type) { case ACPI_S3: /* Enable device wake events */ google_chromeec_set_device_enabled_events(s3_mask); break; case ACPI_S5: /* Enable device wake events */ google_chromeec_set_device_enabled_events(s5_mask); break; } /* Read and clear pending events that may trigger immediate wake */ google_chromeec_get_device_current_events(); } void chromeec_smi_apmc(int apmc, uint32_t sci_mask, uint32_t smi_mask) { switch (apmc) { case APM_CNT_ACPI_ENABLE: google_chromeec_set_smi_mask(0); clear_pending_events(); google_chromeec_set_sci_mask(sci_mask); break; case APM_CNT_ACPI_DISABLE: google_chromeec_set_sci_mask(0); clear_pending_events(); google_chromeec_set_smi_mask(smi_mask); break; } }
/* * V9FS VFS extensions. * * Copyright (C) 2004 by Eric Van Hensbergen <ericvh@gmail.com> * Copyright (C) 2002 by Ron Minnich <rminnich@lanl.gov> * * 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: * Free Software Foundation * 51 Franklin Street, Fifth Floor * Boston, MA 02111-1301 USA * */ #ifndef FS_9P_V9FS_VFS_H #define FS_9P_V9FS_VFS_H /* plan9 semantics are that created files are implicitly opened. * But linux semantics are that you call create, then open. * the plan9 approach is superior as it provides an atomic * open. * we track the create fid here. When the file is opened, if fidopen is * non-zero, we use the fid and can skip some steps. * there may be a better way to do this, but I don't know it. * one BAD way is to clunk the fid on create, then open it again: * you lose the atomicity of file open */ /* special case: * unlink calls remove, which is an implicit clunk. So we have to track * that kind of thing so that we don't try to clunk a dead fid. */ #define P9_LOCK_TIMEOUT (30*HZ) extern struct file_system_type v9fs_fs_type; extern const struct address_space_operations v9fs_addr_operations; extern const struct file_operations v9fs_file_operations; extern const struct file_operations v9fs_file_operations_dotl; extern const struct file_operations v9fs_dir_operations; extern const struct file_operations v9fs_dir_operations_dotl; extern const struct dentry_operations v9fs_dentry_operations; extern const struct dentry_operations v9fs_cached_dentry_operations; extern const struct file_operations v9fs_cached_file_operations; extern const struct file_operations v9fs_cached_file_operations_dotl; extern struct kmem_cache *v9fs_inode_cache; struct inode *v9fs_alloc_inode(struct super_block *sb); void v9fs_destroy_inode(struct inode *inode); struct inode *v9fs_get_inode(struct super_block *sb, umode_t mode, dev_t); int v9fs_init_inode(struct v9fs_session_info *v9ses, struct inode *inode, umode_t mode, dev_t); void v9fs_evict_inode(struct inode *inode); ino_t v9fs_qid2ino(struct p9_qid *qid); void v9fs_stat2inode(struct p9_wstat *, struct inode *, struct super_block *); void v9fs_stat2inode_dotl(struct p9_stat_dotl *, struct inode *); int v9fs_dir_release(struct inode *inode, struct file *filp); int v9fs_file_open(struct inode *inode, struct file *file); void v9fs_inode2stat(struct inode *inode, struct p9_wstat *stat); int v9fs_uflags2omode(int uflags, int extended); ssize_t v9fs_file_readn(struct file *, char *, char __user *, u32, u64); ssize_t v9fs_fid_readn(struct p9_fid *, char *, char __user *, u32, u64); void v9fs_blank_wstat(struct p9_wstat *wstat); int v9fs_vfs_setattr_dotl(struct dentry *, struct iattr *); int v9fs_file_fsync_dotl(struct file *filp, loff_t start, loff_t end, int datasync); ssize_t v9fs_file_write_internal(struct inode *, struct p9_fid *, const char __user *, size_t, loff_t *, int); int v9fs_refresh_inode(struct p9_fid *fid, struct inode *inode); int v9fs_refresh_inode_dotl(struct p9_fid *fid, struct inode *inode); static inline void v9fs_invalidate_inode_attr(struct inode *inode) { struct v9fs_inode *v9inode; v9inode = V9FS_I(inode); v9inode->cache_validity |= V9FS_INO_INVALID_ATTR; return; } int v9fs_open_to_dotl_flags(int flags); #endif
#include<stdio.h> int main () { char a,b,c; a = '1'; b = 'H'; c = '12'; printf("a = %c\n b =%c\n c=%c\n",a, b, c); return 0; }
/* * HT Editor * bounds.h - Bounds for rectangular objects * * Copyright (C) 1999-2002 Stefan Weyergraf (stefan@weyergraf.de) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as * published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #ifndef __BOUNDS_H__ #define __BOUNDS_H__ #include "types.h" /** * Rectangular visual Bounds */ struct Bounds { int x, y, w, h; Bounds() {} Bounds(const Bounds &b) { x = b.x; y = b.y; w = b.w; h = b.h; } Bounds(int X, int Y, int W, int H) { x = X; y = Y; w = W; h = H; } inline void assign(int X, int Y, int W, int H) { x = X; y = Y; w = W; h = H; } inline void move(int deltax, int deltay) { x += deltax; y += deltay; } inline void resize(int deltaw, int deltah) { w += deltaw; h += deltah; } inline void intersectWith(const Bounds &b) { if (b.x > x) { w -= b.x-x; x = b.x; } if (b.y > y) { h -= b.y-y; y = b.y; } if (x+w > b.x+b.w) w -= x+w-b.x-b.w; if (y+h > b.y+b.h) h -= y+h-b.y-b.h; if (w < 0) w = 0; if (h < 0) h = 0; } inline bool containsPoint(int ax, int ay) { return (ax >= x) && (ax < x+w) && (ay >= y) && (ay < y+h); } }; #endif /* __BOUNDS_H__ */
#include <stdio.h> #include <stdlib.h> #include <string.h> #include <assert.h> #include <stdarg.h> #include "html_detect.h" #include "html_util.h" #include "libutil.h" #define PARAM_SIZE 512 #define TEST_TEMPLATE "<p class=\"$1\">$0</p>" //#define TRAINING_DATA "part1-part2" #define TRAINING_DATA "cGFydDEtcGFydDI=" //#define TEST_DATA "content-dummy\" onload=\"javascript:alert('abc')" #define TEST_DATA "Y29udGVudC1kdW1teSIgb25sb2FkPSJqYXZhc2NyaXB0OmFsZXJ0KCdhYmMnKQo=" static int my_preprocessor(int cnt, int size, html_string_t *params) { char *ptr = NULL; //base64 decode int left = 0; int decoded_len = base64_stream_decode(params[0].buf, params[0].buf, params[0].len, &left); assert(left == 0); params[0].len = decoded_len; ptr = strchr(params[0].buf, '-'); assert(ptr != NULL); *ptr = '\0'; params[0].len = strlen(params[0].buf); ptr++; assert(*ptr != '\0'); strcpy(params[1].buf, ptr); params[1].len = strlen(ptr); return 2; } int main(int argc, char *argv[]) { xss_work_t work = NULL; char p1[PARAM_SIZE], p2[PARAM_SIZE]; html_string_t params[2] = {{p1,0}, {p2,0}}; debug_html_lexer = 0; debug_html_parser = 0; debug_html_mem = 0; debug_html_detect = 1; if(xss_module_init(NULL)) { fprintf(stderr, "xss init failed\n"); goto failed; } strncpy(params[0].buf, TRAINING_DATA, PARAM_SIZE); params[0].len = sizeof(TRAINING_DATA) - 1; work = xss_training(TEST_TEMPLATE, my_preprocessor, 1, 2, params); if(!work) { fprintf(stderr, "xss training failed\n"); goto failed; } strncpy(params[0].buf, TEST_DATA, PARAM_SIZE); params[0].len = sizeof(TEST_DATA) - 1; xss_check(work, 1, 2, params); xss_untraining(work); xss_module_finit(NULL); return 0; failed: if(work) xss_untraining(work); xss_module_finit(NULL); return -1; }
// Copyright (c) 2011 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 BASE_FILE_UTIL_DEPRECATED_H_ #define BASE_FILE_UTIL_DEPRECATED_H_ #pragma once #include "base/base_api.h" #include "build/build_config.h" #if defined(OS_WIN) namespace file_util { BASE_API FILE* OpenFile(const std::string& filename, const char* mode); BASE_API FILE* OpenFile(const std::wstring& filename, const char* mode); BASE_API void AppendToPath(std::wstring* path, const std::wstring& new_ending); BASE_API FilePath::StringType GetFileExtensionFromPath(const FilePath& path); BASE_API std::wstring GetFileExtensionFromPath(const std::wstring& path); BASE_API bool Delete(const std::wstring& path, bool recursive); BASE_API bool CopyDirectory(const std::wstring& from_path, const std::wstring& to_path, bool recursive); BASE_API int ReadFile(const std::wstring& filename, char* data, int size); BASE_API int WriteFile(const std::wstring& filename, const char* data, int size); } #endif #endif
#ifndef _VSPRINTF_H_ #define _VSPRINTF_H_ #include <stdarg.h> int vsprintf(char *buf, const char *fmt, va_list args); #endif
/* * Copyright (c) 1998 The University of Utah and * the Computer Systems Laboratory at the University of Utah (CSL). * * This file is part of Flick, the Flexible IDL Compiler Kit. * * Flick 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. * * Flick 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 Flick; see the file COPYING. If not, write to * the Free Software Foundation, 59 Temple Place #330, Boston, MA 02111, USA. */ #include <mom/compiler.h> #include <mom/c/libcast.h> cast_init cast_new_init(cast_init_kind kind) { cast_init init = mustcalloc(sizeof(*init)); init->kind = kind; return init; }
/* * fs/sysfs/group.c - Operations for adding/removing multiple files at once. * * Copyright (c) 2003 Patrick Mochel * Copyright (c) 2003 Open Source Development Lab * * This file is released undert the GPL v2. * */ #include <linux/kobject.h> #include <linux/module.h> #include <linux/dcache.h> #include <linux/namei.h> #include <linux/err.h> #include "sysfs.h" static void remove_files(struct sysfs_dirent *dir_sd, struct kobject *kobj, const struct attribute_group *grp) { struct attribute *const* attr; int i; for (i = 0, attr = grp->attrs; *attr; i++, attr++) sysfs_hash_and_remove(dir_sd, NULL, (*attr)->name); } static int create_files(struct sysfs_dirent *dir_sd, struct kobject *kobj, const struct attribute_group *grp, int update) { struct attribute *const* attr; int error = 0, i; for (i = 0, attr = grp->attrs; *attr && !error; i++, attr++) { umode_t mode = 0; /* in update mode, we're changing the permissions or * visibility. Do this by first removing then * re-adding (if required) the file */ if (update) sysfs_hash_and_remove(dir_sd, NULL, (*attr)->name); if (grp->is_visible) { mode = grp->is_visible(kobj, *attr, i); if (!mode) continue; } error = sysfs_add_file_mode(dir_sd, *attr, SYSFS_KOBJ_ATTR, (*attr)->mode | mode); if (unlikely(error)) break; } if (error) remove_files(dir_sd, kobj, grp); return error; } static int internal_create_group(struct kobject *kobj, int update, const struct attribute_group *grp) { struct sysfs_dirent *sd; int error; BUG_ON(!kobj || (!update && !kobj->sd)); /* Updates may happen before the object has been instantiated */ if (unlikely(update && !kobj->sd)) return -EINVAL; if (!grp->attrs) { WARN(1, "sysfs: attrs not set by subsystem for group: %s/%s\n", kobj->name, grp->name ? "" : grp->name); return -EINVAL; } if (grp->name) { error = sysfs_create_subdir(kobj, grp->name, &sd); if (error) return error; } else sd = kobj->sd; sysfs_get(sd); error = create_files(sd, kobj, grp, update); if (error) { if (grp->name) sysfs_remove_subdir(sd); } sysfs_put(sd); return error; } /** * sysfs_create_group - given a directory kobject, create an attribute group * @kobj: The kobject to create the group on * @grp: The attribute group to create * * This function creates a group for the first time. It will explicitly * warn and error if any of the attribute files being created already exist. * * Returns 0 on success or error. */ int sysfs_create_group(struct kobject *kobj, const struct attribute_group *grp) { return internal_create_group(kobj, 0, grp); } /** * sysfs_update_group - given a directory kobject, update an attribute group * @kobj: The kobject to update the group on * @grp: The attribute group to update * * This function updates an attribute group. Unlike * sysfs_create_group(), it will explicitly not warn or error if any * of the attribute files being created already exist. Furthermore, * if the visibility of the files has changed through the is_visible() * callback, it will update the permissions and add or remove the * relevant files. * * The primary use for this function is to call it after making a change * that affects group visibility. * * Returns 0 on success or error. */ int sysfs_update_group(struct kobject *kobj, const struct attribute_group *grp) { return internal_create_group(kobj, 1, grp); } void sysfs_remove_group(struct kobject * kobj, const struct attribute_group * grp) { struct sysfs_dirent *dir_sd = kobj->sd; struct sysfs_dirent *sd; if (grp->name) { sd = sysfs_get_dirent(dir_sd, NULL, grp->name); if (!sd) { WARN(!sd, KERN_WARNING "sysfs group %p not found for " "kobject '%s'\n", grp, kobject_name(kobj)); return; } } else sd = sysfs_get(dir_sd); remove_files(sd, kobj, grp); if (grp->name) sysfs_remove_subdir(sd); sysfs_put(sd); } /** * sysfs_merge_group - merge files into a pre-existing attribute group. * @kobj: The kobject containing the group. * @grp: The files to create and the attribute group they belong to. * * This function returns an error if the group doesn't exist or any of the * files already exist in that group, in which case none of the new files * are created. */ int sysfs_merge_group(struct kobject *kobj, const struct attribute_group *grp) { struct sysfs_dirent *dir_sd; int error = 0; struct attribute *const *attr; int i; dir_sd = sysfs_get_dirent(kobj->sd, NULL, grp->name); if (!dir_sd) return -ENOENT; for ((i = 0, attr = grp->attrs); *attr && !error; (++i, ++attr)) error = sysfs_add_file(dir_sd, *attr, SYSFS_KOBJ_ATTR); if (error) { while (--i >= 0) sysfs_hash_and_remove(dir_sd, NULL, (*--attr)->name); } sysfs_put(dir_sd); return error; } EXPORT_SYMBOL_GPL(sysfs_merge_group); /** * sysfs_unmerge_group - remove files from a pre-existing attribute group. * @kobj: The kobject containing the group. * @grp: The files to remove and the attribute group they belong to. */ void sysfs_unmerge_group(struct kobject *kobj, const struct attribute_group *grp) { struct sysfs_dirent *dir_sd; struct attribute *const *attr; dir_sd = sysfs_get_dirent(kobj->sd, NULL, grp->name); if (dir_sd) { for (attr = grp->attrs; *attr; ++attr) sysfs_hash_and_remove(dir_sd, NULL, (*attr)->name); sysfs_put(dir_sd); } } EXPORT_SYMBOL_GPL(sysfs_unmerge_group); EXPORT_SYMBOL_GPL(sysfs_create_group); EXPORT_SYMBOL_GPL(sysfs_update_group); EXPORT_SYMBOL_GPL(sysfs_remove_group);
#include "libcell.h" int df1_typed_read (_comm_header *comm, _df1_comm *df1_comm, char *reg, _df1_resp *resp, byte node, byte channel, int plctype, unsigned short count, int debug) { _df1 *df1; _pccc_namedata *name; _pccc_word_read *cmd; int x,place; dprint (DEBUG_TRACE,"Entering df1_typed_read\n"); if (df1_comm == NULL) { CELLERROR(1,"df1_comm struct not defined"); return (-1); } if (strlen(reg) < 1) { CELLERROR(2,"Invalid register to read."); return (-2); } if (node > 63) { CELLERROR(3,"Node must be less than 64"); return (-3); } if ((channel < 1) || (channel > 2)) { CELLERROR(4,"Channel must be 1 or 2"); return (-4); } df1 = malloc(sizeof(_df1_word_read)); if (df1 == NULL) { CELLERROR(5,"Could not allocate DF1 struct"); return (-5); } name = malloc(sizeof(_pccc_namedata)); if (name == NULL) { CELLERROR(6,"Could not allocate name struct"); return (-6); } cmd = malloc(sizeof(_pccc_word_read)); if (cmd == NULL) { CELLERROR(8,"Could not allocate CMD struct"); return (-8); } if (resp == NULL) { CELLERROR(9,"Response struct not allocated"); return (-9); } memset (cmd, 0, sizeof(_pccc_word_read)); memset (df1,0,sizeof(_df1_word_read)); memset (name, 0, sizeof(_pccc_namedata)); memset (resp, 0, sizeof(_df1_resp)); place = 0; df1->df1_port = channel; cmd->cmd = 0x0f; cmd->fnc = 0x68; cmd->tns = comm->df1_tns; cmd->dst = node; cmd->offset = 0; nameconv5(reg, name, plctype, debug); memcpy (cmd->data, name->data, name->len); place = name->len; if (count == 0) count=1; count = count * 2; if (name->floatdata == TRUE) count = count * 2; cmd->data[place++] = (byte)count; if (plctype == PLC5250) cmd->trans = htons(count/2); if (plctype != PLC5250) cmd->trans = (count); df1->df1_datalen = 16 + place; memcpy (df1->cmd, cmd, 16+place); x = send_df1 (comm, df1_comm, df1, resp, debug); if (x < 0) printf ("Send_DF1 failed - status = %d.\n",x); free(df1); free(name); free(cmd); return x; }
#ifndef __NETDEV_H #define __NETDEV_H void sdlnetdev_init(running_machine &machine); #endif
#define RPI_UNKNOWN 0 #define RPI_MODEL_A 1 #define RPI_MODEL_B 2 #define RPI_MODEL_APLUS 3 #define RPI_MODEL_BPLUS 4 #define RPI_COMPUTE_NODE 6 #define RPI_MODEL_2B 7 #define RPI_MODEL_ZERO 8 #define RPI_MODEL_3B 9 #define RPI_MODEL_3BPLUS 10 uint32_t hardware_detect(void *info_ptr); void hardware_print_model(uint32_t version); void hardware_print_commandline(void); uint32_t hardware_get_type(void); void hardware_get_memory(uint32_t *start, uint32_t *length);
/* * Copyright (C) 2010 STMicroelectronics * Author: Francesco M. Virlinzi <francesco.virlinzi@st.com> * * May be copied or modified under the terms of the GNU General Public * License V.2 ONLY. See linux/COPYING for more information. */ #ifndef __LINUX_STM_WAKEUP_DEVICES__ #define __LINUX_STM_WAKEUP_DEVICES__ /* * the stm_wakeup_devices tracks __ONLY__ the special devices which have * a constraint to wakeup; i.e.: * * - irb.scd needs at least 1 MHz * * - hdmi_cec needs 100 MHz. * * - eth_phy needs 25 MHz (125 MHz in gphy) * * In some SOC these IPs share the same clock therefore a fine tuning * has to be done to set the clock according * the currently enabled wakeup devices. * * Currently the other IPs (i.e.: ASC, PIO) didn't raise any particular issues. */ struct stm_wakeup_devices { unsigned int lirc_can_wakeup:1; /* lirc_scd_clk >= 1 MHz */ unsigned int hdmi_can_wakeup:1; /* hdmi_clk == 100 MHz */ unsigned int stm_mac0_can_wakeup:1; /* eth_phy_clk ~= 25 MHz */ unsigned int stm_mac1_can_wakeup:1; unsigned int stm_phy_can_wakeup:1; unsigned int hdmi_cec:1; unsigned int hdmi_hotplug:1; unsigned int kscan:1; unsigned int asc:1; unsigned int rtc:1; unsigned int rtc_sbc:1; }; int stm_check_wakeup_devices(struct stm_wakeup_devices *dev_wk); #endif
#pragma once #pragma comment(lib, "dxgi.lib") #pragma comment(lib, "d3d11.lib") #pragma comment(lib, "d3dx11.lib") #pragma comment(lib, "d3dx10.lib") #include <windows.h> #include <dxgi.h> #include <d3dcommon.h> #include <d3d11.h> #include <DirectXMath.h> class D3DClass { bool m_vsync_enabled; int m_videoCardMemory; char m_videoCardDescription[128]; IDXGISwapChain* m_swapChain; ID3D11Device* m_device; ID3D11DeviceContext* m_deviceContext; ID3D11RenderTargetView* m_renderTargetView; ID3D11Texture2D* m_depthStencilBuffer; ID3D11DepthStencilState* m_depthStencilState; ID3D11DepthStencilView* m_depthStencilView; ID3D11RasterizerState* m_rasterState; DirectX::XMMATRIX m_projectionMatrix; DirectX::XMMATRIX m_worldMatrix; DirectX::XMMATRIX m_orthoMatrix; public: D3DClass(); D3DClass(const D3DClass&); ~D3DClass(); bool Initialize(int, int, bool, HWND, bool, float, float); void Shutdown(); void BeginScene(float, float, float, float); void EndScene(); ID3D11Device* GetDevice(); ID3D11DeviceContext* GetDeviceContext(); void GetProjectionMatrix(DirectX::XMMATRIX&); void GetWorldMatrix(DirectX::XMMATRIX&); void GetOrthoMatrix(DirectX::XMMATRIX&); void GetVideoCardInfo(char*, int&); };
#include <stdio.h> #include <string.h> #include <fcntl.h> #include <errno.h> #define RED "\033[1;31m" #define GREEN "\033[1;32m" #define YELLOW "\033[1;33m" #define NONE "\033[m" int main( int argc, char* argv[]) { int fd; if ( 2 > argc ) { printf(RED "[USER-PART-ERROR] input parameters are not enough\n" NONE); goto _HINT; } fd = open("/dev/tacobuf", O_RDWR); if ( fd < 0 ) { printf(RED "[USER-PART-ERROR] open device tacobuf failed\n" NONE); printf(GREEN "[USER-PART] 1) maybe you should insert kernel module first\n" NONE); printf(GREEN "[USER-PART] 2) maybe you should use sudo to execute this program\n" NONE); return -1; } if ( 0 == strcmp( argv[1], "read" ) ) { unsigned char _ubuf[128]; memset(_ubuf, 0, 128); if ( 0 > read(fd, _ubuf, 128) ) { printf(RED "[USER-PART-ERROR] read data from tacobuf failed\n" NONE); close(fd); return -1; } printf(YELLOW "[USER-PART] read data : %s\n" NONE, _ubuf); } else if ( 0 == strcmp( argv[1], "write" ) ) { if ( 3 > argc ) { printf(RED "[USER-PART-ERROR] input parameters are not enough\n" NONE); goto _HINT; } if ( 0 > write(fd, argv[2], strlen(argv[2])+1 ) ) { printf(RED "[USER-PART-ERROR] write data to tacobuf failed\n" NONE); close(fd); return -1; } printf(YELLOW "[USER-PART] write data : %s\n" NONE, argv[2]); } else { goto _HINT; } close(fd); return 0; _HINT: printf(GREEN "[USER-PART] action should be 'read' or 'write'\n" NONE ); printf(GREEN "[USER-PART] sudo ./main read\n" NONE ); printf(GREEN "[USER-PART] sudo ./main write 'your input string'\n" NONE ); close(fd); return -1; }
// // oreencoding.h // // Copyright 2013 by John Pietrzak (jpietrzak8@gmail.com) // // This file is part of Orecchiette. // // Orecchiette 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. // // Orecchiette 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 Orecchiette; if not, write to the Free Software Foundation, // Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. // #ifndef OREENCODING_H #define OREENCODING_H enum AudioEncoding { SPX_Encoding, AAC_Encoding, WAV_Encoding, FLAC_Encoding, ILBC_Encoding }; enum OreAudioSource { No_Audio, Microphone_Audio, Speaker_Audio, MicrophoneAndSpeaker_Audio }; enum OreVideoSource { No_Video, Screen_Video, BackCamera_Video, FrontCamera_Video // MJpegStream_Video }; enum OreAudioPosition { Mic_Center, Mic_Left, Mic_Right }; #endif // OREENCODING_H
#include "ythtbbs.h" const char * const permstrings[] = { "»ù±¾È¨Á¦", /* PERM_BASIC */ "½øÈëÁÄÌìÊÒ", /* PERM_CHAT */ "ºô½ÐËûÈËÁÄÌì", /* PERM_PAGE */ "·¢±íÎÄÕÂ", /* PERM_POST */ "ʹÓÃÕß×ÊÁÏÕýÈ·", /* PERM_LOGINOK */ "½ûֹʹÓÃÇ©Ãûµµ", /* PERM_DENYSIG */ "ÒþÉíÊõ", /* PERM_CLOAK */ "¿´´©ÒþÉíÊõ", /* PERM_SEECLOAK */ "ÕʺÅÓÀ¾Ã±£Áô", /* PERM_XEMPT */ "±à¼­½øÕ¾»­Ãæ", /* PERM_WELCOME */ "°åÖ÷", /* PERM_BOARDS */ "ÕʺŹÜÀíÔ±", /* PERM_ACCOUNTS */ "±¾Õ¾ÖÙ²Ã", /* PERM_ARBITRATE */ "ͶƱ¹ÜÀíÔ±", /* PERM_OVOTE */ "ϵͳά»¤¹ÜÀíÔ±", /* PERM_SYSOP */ "Read/Post ÏÞÖÆ", /* PERM_POSTMASK */ "¾«»ªÇø×ܹÜ", /* PERM_ANNOUNCE */ "ÌÖÂÛÇø×ܹÜ", /* PERM_OBOARDS */ "»î¶¯¿´°æ×ܹÜ", /* PERM_ACBOARD */ "²»ÄÜ ZAP(ÌÖÂÛÇø×¨ÓÃ)", /* PERM_NOZAP */ "Ç¿ÖÆºô½Ð", /* PERM_FORCEPAGE */ "ÑÓ³¤·¢´ôʱ¼ä", /* PERM_EXT_IDLE */ "´óÐÅÏä", /* PERM_SPECIAL1 */ "ÌØÊâȨÏÞ 2", /* PERM_SPECIAL2 */ "ÌØÊâȨÏÞ 3", /* PERM_SPECIAL3 */ "Çø³¤", /* PERM_SPECIAL4 */ "±¾Õ¾¼à²ì×é", /* PERM_SPECIAL5 */ "±¾Õ¾Á¢·¨»á", /* PERM_SPECIAL6 */ "ÌØÊâȨÏÞ 7", /* PERM_SPECIAL7 */ "¸öÈËÎļ¯", /* PERM_SPECIAL8 */ "½ûÖ¹·¢ÐÅȨ", /* PERM_DENYMAIL */ }; const char *const user_definestr[NUMDEFINES] = { "ºô½ÐÆ÷¹Ø±Õʱ¿ÉÈúÃÓѺô½Ð", /* DEF_FRIENDCALL */ "½ÓÊÜËùÓÐÈ˵ÄѶϢ", /* DEF_ALLMSG */ "½ÓÊܺÃÓѵÄѶϢ", /* DEF_FRIENDMSG */ "ÊÕµ½Ñ¶Ï¢·¢³öÉùÒô", /* DEF_SOUNDMSG */ "ʹÓòÊÉ«", /* DEF_COLOR */ "ÏÔʾ»î¶¯¿´°æ", /* DEF_ACBOARD */ "ÏÔʾѡµ¥µÄѶϢÀ¸", /* DEF_ENDLINE */ "±à¼­Ê±ÏÔʾ״̬À¸", /* DEF_EDITMSG */ "ѶϢÀ¸²ÉÓÃÒ»°ã/¾«¼òģʽ", /* DEF_NOTMSGFRIEND */ "Ñ¡µ¥²ÉÓÃÒ»°ã/¾«¼òģʽ", /* DEF_NORMALSCR */ "·ÖÀàÌÖÂÛÇøÒÔ New ÏÔʾ", /* DEF_NEWPOST */ "ÔĶÁÎÄÕÂÊÇ·ñʹÓÃÈÆ¾íÑ¡Ôñ", /* DEF_CIRCLE */ "ÔĶÁÎÄÕÂÓαêÍ£ÓÚµÚһƪδ¶Á", /* DEF_FIRSTNEW */ "½øÕ¾Ê±ÏÔʾºÃÓÑÃûµ¥", /* DEF_LOGFRIEND */ "½øÕ¾Ê±ÏÔʾ±¸Íü¼", /* DEF_INNOTE */ "ÀëվʱÏÔʾ±¸Íü¼", /* DEF_OUTNOTE */ "ÀëվʱѯÎʼĻØËùÓÐѶϢ", /* DEF_MAILMSG */ "ʹÓÃ×Ô¼ºµÄÀëÕ¾»­Ãæ", /* DEF_LOGOUT */ "ÎÒÊÇÕâ¸ö×éÖ¯µÄ³ÉÔ±", /* DEF_SEEWELC1 */ "ºÃÓÑÉÏվ֪ͨ", /* DEF_LOGINFROM */ "¹Û¿´ÁôÑÔ°æ", /* DEF_NOTEPAD */ "²»ÒªËͳöÉÏվ֪ͨ¸øºÃÓÑ", /* DEF_NOLOGINSEND */ "Ö÷Ìâʽ¿´°æ", /* DEF_THESIS */ "ÊÕµ½Ñ¶Ï¢µÈºò»ØÓ¦»òÇå³ý", /* DEF_MSGGETKEY */ "ºº×ÖÕû×Ö´¦Àí", /* DEF_DELDBLCHAR */ "ʹÓÃGBÂëÔĶÁ", /* DEF_USEGB KCN 99.09.03 */ "ʹÓö¯Ì¬µ×Ïß", /* DEF_ANIENDLINE */ "³õ´Î·ÃÎʰæÃæÌáʾ½øÈ뾫»ªÇø", /* DEF_INTOANN */ "·¢±íÎÄÕÂʱÔÝʱÆÁ±ÎMSG", /* DEF_POSTNOMSG */ "½øÕ¾Ê±¹Û¿´Í³¼ÆÐÅÏ¢", /* DEF_SEESTATINLOG */ "¹ýÂË¿ÉÄÜÁîÈË·´¸ÐÐÅÏ¢", /* DEF_FILTERXXX */ // "ÊÕȡվÍâÐżþ", /* DEF_INTERNETMAIL */ "½øÕ¾Ê±¹Û¿´È«¹úÊ®´óÅÅÐаñ" /* DEF_NEWSTOP10 */ };
/* * Text.h * * Created on: 13 авг. 2014 г. * Author: snickers */ #ifndef TEXT_H_ #define TEXT_H_ #include <string> #include <iostream> #include <SDL2/SDL.h> #include <SDL2/SDL_ttf.h> #include "GUI/colors.h" #include "GUI/Window.h" #include "GUI/GUI.h" #include "Render/Surface.h" class Text { public: std::string _text; Text(); virtual ~Text(); void Init(const int& x, const int& y, const std::string& text, const std::string& font, const int& ptsize); void Draw(); void Show(const bool enabled); void SetColor(const SDL_Color& color); void SetText(const std::string& text); //void SetFont() void SetSize(const int& ptsize); void SetPos(const int& x, const int& y); int GetW(); int GetH(); private: SDL_Texture* _texture; TTF_Font* _font; std::string _fpath; SDL_Rect _rect; SDL_Color _color; bool _visible; void GetTexture(); }; #endif /* TEXT_H_ */
#ifndef GUI2_OVERLAY_H #define GUI2_OVERLAY_H #include "gui2_element.h" class GuiOverlay : public GuiElement { private: glm::u8vec4 color; enum ETextureMode { TM_None, TM_Tiled, } texture_mode; string texture; public: GuiOverlay(GuiContainer* owner, string id, glm::u8vec4 color); virtual void onDraw(sp::RenderTarget& target) override; GuiOverlay* setColor(glm::u8vec4 color); GuiOverlay* setAlpha(int alpha); GuiOverlay* setTextureTiled(string texture); GuiOverlay* setTextureNone(); }; #endif//GUI2_OVERLAY_H
/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ /* * parrillada * Copyright (C) Philippe Rouquier 2007-2008 <bonfire-app@wanadoo.fr> * * Parrillada 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. * * parrillada 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 parrillada. If not, write to: * The Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor * Boston, MA 02110-1301, USA. */ #ifndef _PARRILLADA_SPLIT_DIALOG_H_ #define _PARRILLADA_SPLIT_DIALOG_H_ #include <glib-object.h> #include <gtk/gtk.h> G_BEGIN_DECLS struct _ParrilladaAudioSlice { gint64 start; gint64 end; }; typedef struct _ParrilladaAudioSlice ParrilladaAudioSlice; #define PARRILLADA_TYPE_SPLIT_DIALOG (parrillada_split_dialog_get_type ()) #define PARRILLADA_SPLIT_DIALOG(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), PARRILLADA_TYPE_SPLIT_DIALOG, ParrilladaSplitDialog)) #define PARRILLADA_SPLIT_DIALOG_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), PARRILLADA_TYPE_SPLIT_DIALOG, ParrilladaSplitDialogClass)) #define PARRILLADA_IS_SPLIT_DIALOG(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), PARRILLADA_TYPE_SPLIT_DIALOG)) #define PARRILLADA_IS_SPLIT_DIALOG_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), PARRILLADA_TYPE_SPLIT_DIALOG)) #define PARRILLADA_SPLIT_DIALOG_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), PARRILLADA_TYPE_SPLIT_DIALOG, ParrilladaSplitDialogClass)) typedef struct _ParrilladaSplitDialogClass ParrilladaSplitDialogClass; typedef struct _ParrilladaSplitDialog ParrilladaSplitDialog; struct _ParrilladaSplitDialogClass { GtkDialogClass parent_class; }; struct _ParrilladaSplitDialog { GtkDialog parent_instance; }; GType parrillada_split_dialog_get_type (void) G_GNUC_CONST; GtkWidget * parrillada_split_dialog_new (void); void parrillada_split_dialog_set_uri (ParrilladaSplitDialog *dialog, const gchar *uri, const gchar *title, const gchar *artist); void parrillada_split_dialog_set_boundaries (ParrilladaSplitDialog *dialog, gint64 start, gint64 end); GSList * parrillada_split_dialog_get_slices (ParrilladaSplitDialog *self); G_END_DECLS #endif /* _PARRILLADA_SPLIT_DIALOG_H_ */
/* Combat Simulator Project * Copyright (C) 2002, 2003, 2004 Mark Rose <mkrose@users.sf.net> * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ /** * @file WeakRef.h * * Reference counting smart-pointer classes. */ #ifndef __CSPLIB_UTIL_WEAKREF_H__ #define __CSPLIB_UTIL_WEAKREF_H__ #include <csp/csplib/util/WeakReferenced.h> namespace csp { template<class T> class WeakRef { public: typedef T element_type; WeakRef() : reference(NULL), validator(NULL) { } WeakRef(Ref<T> & r) : reference(NULL), validator(NULL) { attach(r.get()); } WeakRef(WeakRef<T> & r) { attach(r.get()); } ~WeakRef() { reset(); } WeakRef<T> & operator=(WeakRef<T> & r) { reset(); attach(r.get()); return *this; } WeakRef<T> & operator=(Ref<T> & r) { reset(); attach(r.get()); return *this; } WeakRef<T> & operator=(T* r) { attach(r); return *this; } T* operator->() { return get(); } const T* operator->() const { return get(); } T* get() { if(valid()) { return reference; } return NULL; } T* get() const { if(valid()) { return reference; } return NULL; } // Attaches a weak reference to an existing reference. void attach(T* r) { if(r == NULL) { return; } // Test to see if the class is implementing WeakReferenced base class. WeakReferenced* weakReferenced = dynamic_cast<WeakReferenced*>(r); if(weakReferenced == NULL) { reference = NULL; return; } validator = weakReferenced->getReferenceValidator(); reference = r; } // Obtains a strong reference to the object. Ref<T> lock() const { if(valid()) { return Ref<T>(reference); } return Ref<T>(NULL); } // Resets this weak reference to null. void reset() { reference = NULL; if(validator != NULL) { validator->decref(); validator = NULL; } } // Returns true if this weak reference is still valid. bool valid() const { if(validator != NULL) { return validator->valid(); } return false; } private: element_type* reference; ReferenceValidator* validator; }; } // namespace csp #endif // __CSPLIB_UTIL_WEAKREF_H__
/* packet-wlancertextn.c * Routines for Wireless Certificate Extension (RFC3770) * Ronnie Sahlberg 2005 * * $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 <glib.h> #include <epan/packet.h> #include <epan/oids.h> #include <epan/asn1.h> #include "packet-ber.h" #include "packet-wlancertextn.h" #include "packet-x509af.h" #include "packet-x509ce.h" #include "packet-x509sat.h" #define PNAME "Wlan Certificate Extension" #define PSNAME "WLANCERTEXTN" #define PFNAME "wlancertextn" /* Initialize the protocol and registered fields */ static int proto_wlancertextn = -1; #include "packet-wlancertextn-hf.c" /* Initialize the subtree pointers */ #include "packet-wlancertextn-ett.c" #include "packet-wlancertextn-fn.c" /*--- proto_register_wlancertextn ----------------------------------------------*/ void proto_register_wlancertextn(void) { /* List of fields */ static hf_register_info hf[] = { #include "packet-wlancertextn-hfarr.c" }; /* List of subtrees */ static gint *ett[] = { #include "packet-wlancertextn-ettarr.c" }; /* Register protocol */ proto_wlancertextn = proto_register_protocol(PNAME, PSNAME, PFNAME); /* Register fields and subtrees */ proto_register_field_array(proto_wlancertextn, hf, array_length(hf)); proto_register_subtree_array(ett, array_length(ett)); } /*--- proto_reg_handoff_wlancertextn -------------------------------------------*/ void proto_reg_handoff_wlancertextn(void) { #include "packet-wlancertextn-dis-tab.c" oid_add_from_string("id-kp-eapOverPPP","1.3.6.1.5.5.7.3.13"); oid_add_from_string("id-kp-eapOverLAN","1.3.6.1.5.5.7.3.14"); }
//ZoneMinder Packet Wrapper Class //Copyright 2017 ZoneMinder LLC // //This file is part of ZoneMinder. // //ZoneMinder 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. // //ZoneMinder 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 ZoneMinder. If not, see <http://www.gnu.org/licenses/>. #ifndef ZM_PACKET_H #define ZM_PACKET_H #include "zm_logger.h" #include "zm_time.h" #include "zm_zone.h" #include <condition_variable> #include <mutex> #include <vector> extern "C" { #include <libavformat/avformat.h> } class Image; class ZMPacket { public: std::mutex mutex_; // The condition has to be in the packet because it is shared between locks std::condition_variable condition_; int keyframe; AVStream *stream; // Input stream AVPacket packet; // Input packet, undecoded AVFrame *in_frame; // Input image, decoded Theoretically only filled if needed. AVFrame *out_frame; // output image, Only filled if needed. SystemTimePoint timestamp; uint8_t *buffer; // buffer used in image Image *image; Image *analysis_image; int score; AVMediaType codec_type; int image_index; int codec_imgsize; int64_t pts; // pts in the packet can be in another time base. This MUST be in AV_TIME_BASE_Q bool decoded; std::vector<ZoneStats> zone_stats; public: AVPacket *av_packet() { return &packet; } AVPacket *set_packet(AVPacket *p) ; AVFrame *av_frame() { return out_frame; } Image *get_image(Image *i=nullptr); Image *set_image(Image *); int is_keyframe() { return keyframe; }; int decode(AVCodecContext *ctx); explicit ZMPacket(Image *image, SystemTimePoint tv); explicit ZMPacket(ZMPacket &packet); ZMPacket(); ~ZMPacket(); //AVFrame *get_out_frame(const AVCodecContext *ctx); AVFrame *get_out_frame(int width, int height, AVPixelFormat format); int get_codec_imgsize() { return codec_imgsize; }; }; class ZMLockedPacket { public: std::shared_ptr<ZMPacket> packet_; std::unique_lock<std::mutex> lck_; bool locked; explicit ZMLockedPacket(std::shared_ptr<ZMPacket> p) : packet_(p), lck_(packet_->mutex_, std::defer_lock), locked(false) { } ~ZMLockedPacket() { if (locked) unlock(); } void lock() { Debug(4, "locking packet %d", packet_->image_index); lck_.lock(); locked = true; Debug(4, "packet %d locked", packet_->image_index); }; bool trylock() { Debug(4, "TryLocking packet %d", packet_->image_index); locked = lck_.try_lock(); return locked; }; void unlock() { Debug(4, "packet %d unlocked", packet_->image_index); locked = false; lck_.unlock(); packet_->condition_.notify_all(); }; void wait() { Debug(4, "packet %d waiting", packet_->image_index); packet_->condition_.wait(lck_); } }; #endif /* ZM_PACKET_H */
#ifndef _MOSQUITTO_MOCK_H_ #define _MOSQUITTO_MOCK_H_ #define MOCK_MOSQUITTO_ERROR 0xdeedbeef void mock_mosquitto_connected(int result); void mock_mosquitto_disconnected(int result); void mock_mosquitto_subscribed(char *topic, char *payload, int payload_len); void mock_mosquitto_published(int mid); #endif //#ifndef _MOSQUITTO_MOCK_H_
/* ** This file is part of HSN (Human-Scale Network) ** ** HSN: secure, distributed, SPOF-free network of trust ** Copyright (C) 2016 Younes SERRAJ ** ** 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 ** or see <http://www.gnu.org/licenses/>. */ #include <stdio.h> #include <string.h> #include <libssh/libssh.h> #include "hsn.h" void hsn_node_unload_credentials(t_hsn_node *node) { credentials_clean(&(node->credentials)); }
void f(int *x); void f(const int *x) { } int main(void) { return 0; }
/* * Stranger * Copyright (C) 2013-2014 University of California Santa Barbara. * * 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, Suite 500, Boston, MA 02110-1335, * USA. * * Authors: Fang Yu */ /************************************************************ Backward Analysis 1. dfa_pre_concat(DFA* ML, DFA* MR, int pos, int var, int* indices) 2. dfa_pre_concat_const(DFA* ML, char* str, int pos, int var, int* indices) 3. dfa_pre_replace(DFA* M1, DFA* M2, char* str, int var, int* indices) *************************************************************/ //for external.c #include "mona/bdd_external.h" #include "mona/mem.h" //for bddDump #include "mona/bdd_dump.h" #include "stranger.h" #include <stdlib.h> #include <stdio.h> #include <string.h> //for arithmetic automata #include <math.h> #include "stranger_lib_internal.h" //pos == 1, return the preimage of X for XL := X. XR //pos == 2. return the preimage of X for XL := XR. X DFA* dfa_pre_concat(DFA* ML, DFA* MR, int pos, int var, int* indices){ assert(pos==1 || pos ==2); //Computing pre-image for concatenation of two arguments DFA* Mtrans; DFA* M1; DFA* M2; DFA* result; DFA* Ma = dfaAllStringASCIIExceptReserveWords(var, indices); if(check_emptiness(MR, var, indices)) return dfaCopy(ML); if(pos==1){ M1 = mdfaOneToManyTrackNoLambda(ML, 3, 0, var, indices); if(_FANG_DFA_DEBUG) dfaPrintVerbose(M1); M2 = mdfaGPrefixM(MR, 0, 1, 2, 3, var, indices); if(_FANG_DFA_DEBUG) dfaPrintVerbose(M2); Mtrans = dfa_intersect(M1,M2); if(_FANG_DFA_DEBUG) dfaPrintVerbose(Mtrans); dfaFree(M1); dfaFree(M2); result = dfaGetTrack(Mtrans, pos, 3, var, indices); }else{ // Mtrans = mdfaMEqualLRR(ML, MR, Ma, 0, 1, 2, 3, var, indices); if(_FANG_DFA_DEBUG) dfaPrintVerbose(ML); M1 = mdfaOneToManyTrackNoLambda(ML, 3, 0, var, indices); if(_FANG_DFA_DEBUG) dfaPrintVerbose(M1); M2 = mdfaGSuffixM(MR, 0, 1, 2, 3, var, indices); if(_FANG_DFA_DEBUG) dfaPrintVerbose(M2); Mtrans = dfa_intersect(M1,M2); if(_FANG_DFA_DEBUG) dfaPrintVerbose(Mtrans); dfaFree(M1); dfaFree(M2); result = dfaGetTrackNoPreLambda(Mtrans, pos, 3, var, indices); } dfaFree(Mtrans); dfaFree(Ma); if( DEBUG_SIZE_INFO ) printf("\t peak : pre_concat : states %d : bddnodes %u \n", result->ns, bdd_size(result->bddm) ); return dfaMinimize(result); } //pos == 1, return the preimage of X for XL := X. XR //pos == 2. return the preimage of X for XL := XR. X DFA* dfa_pre_concat_const(DFA* ML, char* str, int pos, int var, int* indices){ assert(1==pos || pos==2); //Computing pre-image for concatenation of two arguments DFA* Mtrans; DFA* result; DFA* suf; DFA* pre; DFA* Ma = dfaAllStringASCIIExceptReserveWords(var, indices); int n = (int)strlen(str); if(n==0) return dfaCopy(ML); if(pos==1){ //Precise Construction pre = dfa_intersect(ML, dfa_concat_extrabit(Ma, dfa_construct_string(str, var, indices), var, indices)); Mtrans = mdfaMEqualLRc(pre, Ma, str, 0, 1, 2, var, indices); if(_FANG_DFA_DEBUG) dfaPrintVerbose(Mtrans); result = dfaGetTrack(Mtrans, pos, 2, var, indices); if(_FANG_DFA_DEBUG) dfaPrintVerbose(result); dfaFree(pre); //return dfa_pre_concat(ML, dfa_construct_string(str, var, indices), pos, var, indices); }else if(pos==2){ //Approximation: Using LRR construction suf = dfa_concat_extrabit(dfa_construct_string(str, var, indices), Ma, var, indices); Mtrans = dfa_intersect(ML, suf); result = dfa_Suffix(Mtrans, n, n, var, indices); dfaFree(suf); }else{ printf("\n\nError on dfa_pre_concat_const: pos ==1 or pos ==2!\n\n"); exit(0); } dfaFree(Ma); dfaFree(Mtrans); if( DEBUG_SIZE_INFO ) printf("\t peak : pre_const_concat : states %d : bddnodes %u \n", result->ns, bdd_size(result->bddm) ); return dfaMinimize(result); } DFA* dfa_pre_replace(DFA* M1, DFA* M2, DFA* M3, int var, int* indices){ return dfa_general_replace_extrabit(M1, M3, dfa_union(M2, M3), var, indices); } DFA* dfa_pre_replace_str(DFA* M1, DFA* M2, char *str, int var, int* indices){ DFA *result=NULL; DFA *M3 = dfa_construct_string(str, var, indices); if((str ==NULL)||strlen(str)==0){ //printf("Replacement [%s]!\n", str); result = dfa_insert_everywhere(M1, M2, var, indices); }else { //printf("Replacement [%s]!\n", str); result = dfa_general_replace_extrabit(M1, M3, dfa_union(M2, M3), var, indices); } dfaFree(M3); return result; }
/* File: file_pcb.c Copyright (C) 2016 Christophe GRENIER <grenier@cgsecurity.org> This software 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 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ #if !defined(SINGLE_FORMAT) || defined(SINGLE_FORMAT_pcb) #ifdef HAVE_CONFIG_H #include <config.h> #endif #ifdef HAVE_STRING_H #include <string.h> #endif #include <stdio.h> #include "types.h" #include "filegen.h" static void register_header_check_pcb(file_stat_t *file_stat); const file_hint_t file_hint_pcb= { .extension="pcb", .description="PCB Wizard", .max_filesize=PHOTOREC_MAX_FILE_SIZE, .recover=1, .enable_by_default=1, .register_header_check=&register_header_check_pcb }; static int header_check_pcb(const unsigned char *buffer, const unsigned int buffer_size, const unsigned int safe_header_only, const file_recovery_t *file_recovery, file_recovery_t *file_recovery_new) { reset_file_recovery(file_recovery_new); file_recovery_new->extension=file_hint_pcb.extension; file_recovery_new->min_filesize=8; return 1; } static void register_header_check_pcb(file_stat_t *file_stat) { static const unsigned char pcb_header[8]= { 'D' , 's' , 'g' , 0x00, 0x0a, 'd' , 0x0a, 0x00, }; register_header_check(0, pcb_header, sizeof(pcb_header), &header_check_pcb, file_stat); } #endif
/* * GPL HEADER START * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 only, * as published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License version 2 for more details (a copy is included * in the LICENSE file that accompanied this code). * * You should have received a copy of the GNU General Public License * version 2 along with this program; if not, write to the * Free Software Foundation, Inc., 59 Temple Place - Suite 330, * Boston, MA 021110-1307, USA * * GPL HEADER END */ /* * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2012, Intel Corporation. */ /* * This file is part of Lustre, http://www.lustre.org/ * Lustre is a trademark of Sun Microsystems, Inc. * * libcfs/include/libcfs/linux/linux-mem.h * * Basic library routines. * * Author: liang@whamcloud.com */ #ifndef __LIBCFS_LINUX_CPU_H__ #define __LIBCFS_LINUX_CPU_H__ #ifndef __LIBCFS_LIBCFS_H__ #error Do not #include this file directly. #include <libcfs/libcfs.h> instead #endif #ifndef __KERNEL__ #error This include is only for kernel use. #endif #include <linux/cpu.h> #include <linux/cpuset.h> #include <linux/topology.h> #include <linux/version.h> #ifdef CONFIG_SMP #define HAVE_LIBCFS_CPT /** virtual processing unit */ struct cfs_cpu_partition { /* CPUs mask for this partition */ cpumask_t *cpt_cpumask; /* nodes mask for this partition */ nodemask_t *cpt_nodemask; /* spread rotor for NUMA allocator */ unsigned cpt_spread_rotor; }; /** descriptor for CPU partitions */ struct cfs_cpt_table { /* version, reserved for hotplug */ unsigned ctb_version; /* spread rotor for NUMA allocator */ unsigned ctb_spread_rotor; /* # of CPU partitions */ unsigned ctb_nparts; /* partitions tables */ struct cfs_cpu_partition *ctb_parts; /* shadow HW CPU to CPU partition ID */ int *ctb_cpu2cpt; /* all cpus in this partition table */ cpumask_t *ctb_cpumask; /* all nodes in this partition table */ nodemask_t *ctb_nodemask; }; void cfs_cpu_core_siblings(int cpu, cpumask_t *mask); void cfs_cpu_ht_siblings(int cpu, cpumask_t *mask); void cfs_node_to_cpumask(int node, cpumask_t *mask); int cfs_cpu_core_nsiblings(int cpu); int cfs_cpu_ht_nsiblings(int cpu); /** * comment out definitions for compatible layer * #define CFS_CPU_NR NR_CPUS * * typedef cpumask_t cfs_cpumask_t; * * #define cfs_cpu_current() smp_processor_id() * #define cfs_cpu_online(i) cpu_online(i) * #define cfs_cpu_online_num() num_online_cpus() * #define cfs_cpu_online_for_each(i) for_each_online_cpu(i) * #define cfs_cpu_possible_num() num_possible_cpus() * #define cfs_cpu_possible_for_each(i) for_each_possible_cpu(i) * * #ifdef CONFIG_CPUMASK_SIZE * #define cfs_cpu_mask_size() cpumask_size() * #else * #define cfs_cpu_mask_size() sizeof(cfs_cpumask_t) * #endif * * #define cfs_cpu_mask_set(i, mask) cpu_set(i, mask) * #define cfs_cpu_mask_unset(i, mask) cpu_clear(i, mask) * #define cfs_cpu_mask_isset(i, mask) cpu_isset(i, mask) * #define cfs_cpu_mask_clear(mask) cpus_clear(mask) * #define cfs_cpu_mask_empty(mask) cpus_empty(mask) * #define cfs_cpu_mask_weight(mask) cpus_weight(mask) * #define cfs_cpu_mask_first(mask) first_cpu(mask) * #define cfs_cpu_mask_any_online(mask) (any_online_cpu(mask) != NR_CPUS) * #define cfs_cpu_mask_for_each(i, mask) for_each_cpu_mask(i, mask) * * #define cfs_cpu_mask_copy(dst, src) cpumask_copy(dst, src) * * static inline void * cfs_cpu_mask_of_online(cfs_cpumask_t *mask) * { * cfs_cpu_mask_copy(mask, &cpu_online_map); * } * * #ifdef CONFIG_NUMA * * #define CFS_NODE_NR MAX_NUMNODES * * typedef nodemask_t cfs_node_mask_t; * * #define cfs_node_of_cpu(cpu) cpu_to_node(cpu) * #define cfs_node_online(i) node_online(i) * #define cfs_node_online_num() num_online_nodes() * #define cfs_node_online_for_each(i) for_each_online_node(i) * #define cfs_node_possible_num() num_possible_nodes() * #define cfs_node_possible_for_each(i) for_each_node(i) * * static inline void cfs_node_to_cpumask(int node, cfs_cpumask_t *mask) * { * cfs_cpu_mask_copy(mask, cpumask_of_node(node)); * } * * #define cfs_node_mask_set(i, mask) node_set(i, mask) * #define cfs_node_mask_unset(i, mask) node_clear(i, mask) * #define cfs_node_mask_isset(i, mask) node_isset(i, mask) * #define cfs_node_mask_clear(mask) nodes_reset(mask) * #define cfs_node_mask_empty(mask) nodes_empty(mask) * #define cfs_node_mask_weight(mask) nodes_weight(mask) * #define cfs_node_mask_for_each(i, mask) for_each_node_mask(i, mask) * #define cfs_node_mask_copy(dst, src) memcpy(dst, src, sizeof(*src)) * * static inline void * cfs_node_mask_of_online(cfs_node_mask_t *mask) * { * cfs_node_mask_copy(mask, &node_online_map); * } * * #endif */ #endif /* CONFIG_SMP */ #endif /* __LIBCFS_LINUX_CPU_H__ */
/* * Maximus Version 3.02 * Copyright 1989, 2002 by Lanius Corporation. All rights reserved. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * 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 __GNUC__ #pragma off(unreferenced) static char rcs_id[]="$Id: sq_misc.c,v 1.4 2004/01/27 21:01:49 paltas Exp $"; #pragma on(unreferenced) #endif #define MSGAPI_HANDLERS #define MSGAPI_NO_OLD_TYPES #include <stdio.h> #include <ctype.h> #include "prog.h" #include "msgapi.h" #include "api_sq.h" #include "apidebug.h" /* Set the "current position" pointer in a message handle */ sword MAPIENTRY SquishSetCurPos(HMSG hmsg, dword dwOfs) { if (MsgInvalidHmsg(hmsg) || !_SquishReadMode(hmsg)) return -1; hmsg->cur_pos=dwOfs; return 0; } /* Return the current read position within a message */ dword MAPIENTRY SquishGetCurPos(HMSG hmsg) { if (MsgInvalidHmsg(hmsg) || !_SquishReadMode(hmsg)) return (dword)-1; return hmsg->cur_pos; } /* Return the length of the text body of this message */ dword MAPIENTRY SquishGetTextLen(HMSG hmsg) { long rc; if (MsgInvalidHmsg(hmsg) || !_SquishReadMode(hmsg)) return (dword)-1L; rc = (long)hmsg->sqhRead.msg_length - (long)XMSG_SIZE - (long)hmsg->sqhRead.clen; return (rc < 0) ? (dword)0L : (dword)rc; } /* Return the length of this message's control information */ dword MAPIENTRY SquishGetCtrlLen(HMSG hmsg) { if (MsgInvalidHmsg(hmsg) || !_SquishReadMode(hmsg)) return (dword)-1L; return hmsg->sqhRead.clen; } /* Return the number of the high water marker */ dword MAPIENTRY SquishGetHighWater(HAREA ha) { if (MsgInvalidHarea(ha)) return (dword)-1L; return SquishUidToMsgn(ha, ha->high_water, UID_PREV); } /* Set the high water marker for this area */ sword MAPIENTRY SquishSetHighWater(HAREA ha, dword dwMsg) { if (MsgInvalidHarea(ha)) return -1; /* Make sure that the message exists */ if (dwMsg > ha->num_msg) { msgapierr=MERR_NOENT; return -1; } if (!_SquishExclusiveBegin(ha)) return -1; ha->high_water=SquishMsgnToUid(ha, dwMsg); if (!_SquishExclusiveEnd(ha)) return -1; return 0; } /* Function to set the highest/skip message numbers for a *.SQ? base */ void MAPIENTRY SquishSetMaxMsg(HAREA ha, dword dwMaxMsgs, dword dwSkipMsgs, dword dwMaxDays) { if (MsgInvalidHarea(ha)) return; /* Update base only if max msg settings have changed */ if ((dwMaxMsgs != (dword)-1L && dwMaxMsgs != Sqd->dwMaxMsg) || (dwSkipMsgs != (dword)-1L && dwSkipMsgs != Sqd->wSkipMsg) || (dwMaxDays != (dword)-1L && dwMaxDays != Sqd->wMaxDays)) { if (!_SquishExclusiveBegin(ha)) return; if (dwMaxMsgs != (dword)-1L) Sqd->dwMaxMsg=dwMaxMsgs; if (dwSkipMsgs != (dword)-1L) Sqd->wSkipMsg=(word)dwSkipMsgs; if (dwMaxDays != (dword)-1L) Sqd->wMaxDays=(word)dwMaxDays; (void)_SquishExclusiveEnd(ha); } } /* Hash function used for calculating the hashes in the .sqi file */ dword MAPIENTRY SquishHash(byte OS2FAR *f) { dword hash=0, g; char *p; for (p=f; *p; p++) { hash=(hash << 4) + (dword)tolower(*p); if ((g=(hash & 0xf0000000L)) != 0L) { hash |= g >> 24; hash |= g; } } /* Strip off high bit */ return (hash & 0x7fffffffLu); }
/* * part-label.h * * * Author: * Richard Hult <rhult@hem.passagen.se> * Ricardo Markiewicz <rmarkie@fi.uba.ar> * Andres de Barbara <adebarbara@fi.uba.ar> * Marc Lorber <lorber.marc@wanadoo.fr> * * Web page: https://github.com/marc-lorber/oregano * * Copyright (C) 1999-2001 Richard Hult * Copyright (C) 2003,2004 Ricardo Markiewicz * Copyright (C) 2009-2012 Marc Lorber * * 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 __PART_LABEL_H #define __PART_LABEL_H typedef struct { gchar *name; gchar *text; Coords pos; } PartLabel; #endif
//mybag.h #ifndef _mybag_h #define _mybag_h #include <iostream> class MyBag { public: MyBag(); //size int size(); //add void add(std::string s); //get std::string getAt(int index); int locate(std::string s); private: //array std::string arr[10]; //number used, allocated int numUsed, numAllocated; }; #endif
/* * $Id: func.c,v 1.7 2008/07/02 17:15:56 sezero Exp $ * This file is a part of the lxSplit tool sources. * * Copyright (c) 2001 Richard Stellingwerff <remenic@gmail.com> * Copyright (c) 2008 O. Sezer <sezero@users.sourceforge.net> * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * * See the GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to: * * Free Software Foundation, Inc. * 51 Franklin St, Fifth Floor, * Boston, MA 02110-1301 USA */ #include <sys/types.h> #include <stdio.h> #include <sys/stat.h> #include <limits.h> #if 0 /* statfs icludes: */ #if (defined(__APPLE__) && defined(__MACH__)) /* Mac OS X */ || \ defined(__FreeBSD__) || defined(__OpenBSD__) || defined(__NetBSD__) #include <sys/param.h> #include <sys/mount.h> #else /* BSD */ #include <sys/vfs.h> #endif /* Linux, etc. */ #endif #include <stdlib.h> #include <unistd.h> #include <string.h> #include "config.h" #include "func.h" #if 0 uintmax_t available_diskspace (const char *path) { struct statfs buf; uintmax_t space; if (statfs(path, &buf) < 0) return 0; space = buf.f_bsize; space *= buf.f_bavail; return space; } #endif char *strip_path (const char *cfilename) { size_t lpos, i, n, len; char *filename; lpos = 0; len = strlen(cfilename); for (i = 0; i < len; i++) if (cfilename[i] == '/') lpos = i; if (lpos != 0) lpos++; n = 0; filename = (char *)malloc((len + 2) * sizeof(char)); for (i = lpos; i < len; i++) { filename[n] = cfilename[i]; n++; } filename[n] = '\0'; return filename; } char *shorten_path (const char *cfilename) { char *filename; size_t i, n, len; len = strlen(cfilename); if (len < 30) return (char *)cfilename; filename = (char *)malloc((30 + 1) * sizeof(char)); n = 0; for (i = 0; i < 10; i++) { filename[n] = cfilename[i]; n++; } for (i = 0; i < 3; i++) { filename[n] = '.'; n++; } for (i = len - 17; i < len; i++) { filename[n] = cfilename[i]; n++; } filename[30] = '\0'; return filename; }
/* * CustomHistoryGroupDataModel.h * Copyright (C) 2015 Belledonne Communications, Grenoble, France * * 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. * * Created on: 24 juil. 2015 * Author: Sylvain Berfini */ #ifndef CUSTOMHISTORYGROUPDATAMODEL_H_ #define CUSTOMHISTORYGROUPDATAMODEL_H_ #include <bb/cascades/GroupDataModel> class CustomHistoryGroupDataModel : public bb::cascades::GroupDataModel { public: CustomHistoryGroupDataModel(QObject *parent = NULL); QVariant data(const QVariantList& indexPath); }; #endif /* CUSTOMHISTORYGROUPDATAMODEL_H_ */
/* -*- c++ -*- * progressdialog.h * * Copyright (c) 2004 Till Adam <adam@kde.org> * based on imapprogressdialog.cpp ,which is * Copyright (c) 2002-2003 Klar�vdalens Datakonsult AB * * 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; version 2 of the License * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * * In addition, as a special exception, the copyright holders give * permission to link the code of this program with any edition of * the Qt library by Trolltech AS, Norway (or with modified versions * of Qt that use the same license as Qt), and distribute linked * combinations including the two. You must obey the GNU General * Public License in all respects for all of the code used other than * Qt. If you modify this file, you may extend this exception to * your version of the file, but you are not obligated to do so. If * you do not wish to do so, delete this exception statement from * your version. */ #ifndef KDEPIM_PROGRESSDIALOG_H #define KDEPIM_PROGRESSDIALOG_H #include "overlaywidget.h" #include "kdepim_export.h" #include <QScrollArea> #include <QMap> #include <KVBox> class QProgressBar; class QFrame; class QLabel; class QPushButton; namespace KPIM { class ProgressItem; class TransactionItem; class SSLLabel; class TransactionItemView : public QScrollArea { Q_OBJECT public: explicit TransactionItemView( QWidget * parent = 0, const char * name = 0 ); virtual ~TransactionItemView() {} TransactionItem *addTransactionItem( ProgressItem *item, bool first ); QSize sizeHint() const; QSize minimumSizeHint() const; public Q_SLOTS: void slotLayoutFirstItem(); protected: virtual void resizeEvent ( QResizeEvent *event ); private: KVBox *mBigBox; }; class TransactionItem : public KVBox { Q_OBJECT public: TransactionItem( QWidget *parent, ProgressItem *item, bool first ); ~TransactionItem(); void hideHLine(); void setProgress( int progress ); void setLabel( const QString & ); // the given text is interpreted as RichText, so you might need to // Qt::escape() it before passing void setStatus( const QString & ); void setCrypto( bool ); void setTotalSteps( int totalSteps ); ProgressItem *item() const { return mItem; } void addSubTransaction( ProgressItem *item ); // The progressitem is deleted immediately, we take 5s to go out, // so better not use mItem during this time. void setItemComplete() { mItem = 0; } public Q_SLOTS: void slotItemCanceled(); protected: QProgressBar *mProgress; QPushButton *mCancelButton; QLabel *mItemLabel; QLabel *mItemStatus; QFrame *mFrame; SSLLabel *mSSLLabel; ProgressItem *mItem; }; class KDEPIM_EXPORT ProgressDialog : public OverlayWidget { Q_OBJECT public: ProgressDialog( QWidget *alignWidget, QWidget *parent, const char *name = 0 ); ~ProgressDialog(); void setVisible( bool b ); public Q_SLOTS: void slotToggleVisibility(); protected Q_SLOTS: void slotTransactionAdded( KPIM::ProgressItem *item ); void slotTransactionCompleted( KPIM::ProgressItem *item ); void slotTransactionCanceled( KPIM::ProgressItem *item ); void slotTransactionProgress( KPIM::ProgressItem *item, unsigned int progress ); void slotTransactionStatus( KPIM::ProgressItem *item, const QString & ); void slotTransactionLabel( KPIM::ProgressItem *item, const QString & ); void slotTransactionUsesCrypto( KPIM::ProgressItem *item, bool ); void slotTransactionUsesBusyIndicator( KPIM::ProgressItem *, bool ); void slotClose(); void slotShow(); void slotHide(); Q_SIGNALS: void visibilityChanged( bool ); protected: virtual void closeEvent( QCloseEvent * ); TransactionItemView *mScrollView; QMap<const ProgressItem *, TransactionItem *> mTransactionsToListviewItems; bool mWasLastShown; }; } // namespace KPIM #endif // __KPIM_PROGRESSDIALOG_H__
//----------------------------------------------------------------------------- // File: componenteditorcominterfacesitem.h //----------------------------------------------------------------------------- // Project: Kactus2 // Author: Antti Kamppi // Date: 09.05.2012 // // Description: // The COM interfaces-item in the component editor's navigation tree. //----------------------------------------------------------------------------- #ifndef COMPONENTEDITORCOMINTERFACESITEM_H #define COMPONENTEDITORCOMINTERFACESITEM_H #include "componenteditoritem.h" class Component; class ComInterface; //----------------------------------------------------------------------------- //! The COM interfaces-item in the component editor's navigation tree. //----------------------------------------------------------------------------- class ComponentEditorComInterfacesItem : public ComponentEditorItem { Q_OBJECT public: /*! The constructor * * @param [in] model The model that owns the items. * @param [in] libHandler The instance that manages the library. * @param [in] component The component being edited. * @param [in] parent The parent item. * */ ComponentEditorComInterfacesItem(ComponentEditorTreeModel* model, LibraryInterface* libHandler, QSharedPointer<Component> component, ComponentEditorItem* parent); //! The destructor virtual ~ComponentEditorComInterfacesItem(); /*! Get the font to be used for text of this item. * * The font is bold, if COM interfaces exist, otherwise not bold. * * @return QFont instance that defines the font to be used. */ virtual QFont getFont() const; /*! Get the tool tip for the item. * * @return The text for the tool tip to print to user. */ virtual QString getTooltip() const; /*! Get the text to be displayed to user in the tree for this item. * * @return QString Contains the text to display. */ virtual QString text() const; /*! Get The editor of this item. * * @return The editor to use for this item. */ virtual ItemEditor* editor(); /*! Add a new child to the item. * * @param [in] index The index to add the child into. * */ virtual void createChild(int index); private: //! No copying ComponentEditorComInterfacesItem(const ComponentEditorComInterfacesItem& other); //! No assignment ComponentEditorComInterfacesItem& operator=(const ComponentEditorComInterfacesItem& other); }; #endif // COMPONENTEDITORCOMINTERFACESITEM_H
/* * libdpkg - Debian packaging suite library routines * cleanup.c - cleanup functions, used when we need to unwind * * Copyright © 1995 Ian Jackson <ian@chiark.greenend.org.uk> * * This 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 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 <config.h> #include <compat.h> #include <dirent.h> #include <unistd.h> #include <stdio.h> #include <dpkg/dpkg.h> void cu_closepipe(int argc, void **argv) { int *p1 = (int *)argv[0]; if (p1[0] >= 0) close(p1[0]); if (p1[1] >= 0) close(p1[1]); } void cu_closefile(int argc, void **argv) { FILE *f = (FILE *)(argv[0]); fclose(f); } void cu_closedir(int argc, void **argv) { DIR *d = (DIR *)(argv[0]); if (d) closedir(d); } void cu_closefd(int argc, void **argv) { int ip = *(int *)argv[0]; if (ip >= 0) close(ip); }
/* * (C) Copyright 2000 * Wolfgang Denk, DENX Software Engineering, wd@denx.de. * * See file CREDITS for list of people who contributed to this * project. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as * published by the Free Software Foundation; either version 2 of * the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, * MA 02111-1307 USA */ /* * Command Processor Table */ #include <armboot.h> #include <command.h> #include <cmd_cache.h> #include <cmd_mem.h> #include <cmd_boot.h> #include <cmd_flash.h> #include <cmd_bootm.h> #include <cmd_net.h> #include <cmd_nvedit.h> #include <cmd_misc.h> #include <cmd_autoscript.h> #include <cmd_eeprom.h> #include <cmd_misc.h> #include <cmd_jffs2.h> #include <cmd_ide.h> #include <cmd_pcmcia.h> #include <cmd_bsp.h> /* board special functions */ /* * HELP command */ #define CMD_TBL_HELP MK_CMD_TBL_ENTRY( \ "help", 1, CFG_MAXARGS, 1, do_help, \ "help - print online help\n", \ "[command ...]\n" \ " - show help information (for 'command')\n" \ "'help' prints online help for the monitor commands.\n\n" \ "Without arguments, it prints a short usage message for all commands.\n\n" \ "To get detailed help information for specific commands you can type\n" \ "'help' with one or more command names as arguments.\n" \ ), #define CMD_TBL_QUES MK_CMD_TBL_ENTRY( \ "?", 1, CFG_MAXARGS, 1, do_help, \ "? - alias for 'help'\n", \ NULL \ ), #define CMD_TBL_VERS MK_CMD_TBL_ENTRY( \ "version", 4, 1, 1, do_version, \ "version - print monitor version\n", \ NULL \ ), #define CMD_TBL_ECHO MK_CMD_TBL_ENTRY( \ "echo", 4, CFG_MAXARGS, 1, do_echo, \ "echo - echo args to console\n", \ "[args..]\n" \ " - echo args to console; \\c suppresses newline\n" \ ), int do_version (cmd_tbl_t *cmdtp, bd_t *bd, int flag, int argc, char *argv[]) { extern char version_string[]; printf ("\n%s\n", version_string); return 0; } int do_echo (cmd_tbl_t *cmdtp, bd_t *bd, int flag, int argc, char *argv[]) { int i, putnl = 1; for (i = 1; i < argc; i++) { char *p = argv[i], c; if (i > 1) putc(' '); while ((c = *p++) != '\0') if (c == '\\' && *p == 'c') { putnl = 0; p++; } else putc(c); } if (putnl) putc('\n'); return 0; } /* * Use puts() instead of printf() to avoid printf buffer overflow * for long help messages */ int do_help (cmd_tbl_t *cmdtp, bd_t *bd, int flag, int argc, char *argv[]) { int i; if (argc == 1) { /* print short help (usage) */ for (cmdtp=&cmd_tbl[0]; cmdtp->name; cmdtp++) { /* allow user abort */ if (ctrlc()) return 1; if (cmdtp->usage == NULL) continue; puts (cmdtp->usage); } return 0; } /* * command help (long version) */ for (i=1; i<argc; ++i) { if ((cmdtp = find_cmd(argv[i])) != NULL) { #ifdef CFG_LONGHELP /* found - print (long) help info */ puts (cmdtp->name); putc (' '); if (cmdtp->help) { puts (cmdtp->help); } else { puts ("- No help available.\n"); } putc ('\n'); #else /* no long help available */ if (cmdtp->usage) puts (cmdtp->usage); #endif /* CFG_LONGHELP */ } else { printf ("Unknown command '%s' - try 'help'" " without arguments for list of all" " known commands\n\n", argv[i] ); } } return 0; } /*************************************************************************** * find command table entry for a command */ cmd_tbl_t *find_cmd(const char *cmd) { cmd_tbl_t *cmdtp; /* Search command table - Use linear search - it's a small table */ for (cmdtp = &cmd_tbl[0]; cmdtp->name; cmdtp++) { if (strncmp (cmd, cmdtp->name, cmdtp->lmin) == 0) return cmdtp; } return NULL; /* not found */ } cmd_tbl_t cmd_tbl[] = { CMD_TBL_GO CMD_TBL_RUN CMD_TBL_BOOTM CMD_TBL_BOOTP CMD_TBL_TFTPB CMD_TBL_RARPB CMD_TBL_DHCP CMD_TBL_BOOTD CMD_TBL_LOADS CMD_TBL_LOADB CMD_TBL_AUTOSCRIPT CMD_TBL_MD CMD_TBL_MM CMD_TBL_NM CMD_TBL_MW CMD_TBL_CP CMD_TBL_CMP CMD_TBL_CRC CMD_TBL_BASE CMD_TBL_PRINTENV CMD_TBL_SETENV CMD_TBL_ASKENV CMD_TBL_SAVEENV CMD_TBL_PROTECT CMD_TBL_FLERASE CMD_TBL_FLINFO CMD_TBL_BDINFO CMD_TBL_IMINFO CMD_TBL_EEPROM CMD_TBL_LOOP CMD_TBL_MTEST CMD_TBL_ICACHE CMD_TBL_DCACHE CMD_TBL_RESET CMD_TBL_ECHO CMD_TBL_IDE CMD_TBL_DISK CMD_TBL_PINIT CMD_TBL_JFFS2 CMD_TBL_MISC #ifdef CMD_TBL_BSP /* Board Specific extensions ? */ CMD_TBL_BSP #endif CMD_TBL_VERS CMD_TBL_HELP CMD_TBL_QUES /* the following entry terminates this table */ MK_CMD_TBL_ENTRY( NULL, 0, 0, 0, NULL, NULL, NULL ) };
#ifndef MYTHREAD_H #define MYTHREAD_H #include <QThread> #include <QTcpSocket> #include <QDebug> #include <QMutex> #include <QByteArray> #include <QLinkedList> #include <qtimer.h> #include "frameData.h" #include "threadFrame.h" using namespace::std; class mythread : public QThread { Q_OBJECT public: explicit mythread(QMutex *lk, int *frm, int ID,QLinkedList<frameData> *dat,QLinkedList<threadFrame> *list, QObject *parent = 0); void run(); //QLinkedList<Data> data; // QLinkedList<User> users; signals: void error(QTcpSocket::SocketError sockError); void readyWriteSig(); void timeSig(); public slots: void readyRead(); void disconnected(); void readyWrite(); void timeUp(); private: QTcpSocket *socket; int socketDescriptor; QLinkedList<frameData> *sendData; QLinkedList<threadFrame> *sysFrameList; int frame; int *sysFrame; QString name; QMutex *lock; }; #endif // MYTHREAD_H
/*------------------------------------------------------------------------------ Copyright 2009-2012 Luís M. O. Matos (luismatos@ua.pt), All Rights Reserved. These programs are supplied free of charge for research purposes only, and may not be sold or incorporated into any commercial product. There is ABSOLUTELY NO WARRANTY of any sort, nor any undertaking that they are fit for ANY PURPOSE WHATSOEVER. Use them at your own risk. If you do happen to find a bug, or have modifications to suggest, please report the same to Luis M. O. Matos, luismatos@ua.pt. The copyright notice above and this statement of conditions must remain an integral part of each and every copy made of these files. ------------------------------------------------------------------------------*/ #include <stdio.h> #include <stdlib.h> #include <string.h> #include "common.h" #include "mafImg.h" #include "mem.h" /*------------------------------------------------------------------------------ Pow function from http://martin.ankerl.com/2007/10/04/ optimized-pow-approximation-for-java-and-c-c/ ------------------------------------------------------------------------------*/ double Pow(double a, double b) { int tmp = (*(1 + (int *)&a)); int tmp2 = (int)(b * (tmp - 1072632447) + 1072632447); double p = 0.0; *(1 + (int * )&p) = tmp2; return p; } /*----------------------------------------------------------------------------*/ int BaseToSymbol(int base) { switch(base) { case 'a': case 'A': return 0; case 'c': case 'C': return 1; case 'g': case 'G': return 2; case 't': case 'T': return 3; default: return 4; //N,n,-, .. //N,n,-, ... //case 'n': case 'N': return 4; //default: return 5; //N,n,-, .. //N,n,-, ... } } /*----------------------------------------------------------------------------*/ int BaseTransform(int base) { switch(base) { case 'a': case 'A': return 'A'; case 'c': case 'C': return 'C'; case 'g': case 'G': return 'G'; case 't': case 'T': return 'T'; default: return '-'; } } /*----------------------------------------------------------------------------*/ int SymbolToBase(int symbol) { switch(symbol) { case 0: return 'A'; case 1: return 'C'; case 2: return 'G'; case 3: return 'T'; //case 4: return 'N'; default: return '-'; //N,n,-, .. //N,n,-, ... } } /*----------------------------------------------------------------------------*/ void OutputSymbol(int symbol, FILE *stream) { switch(symbol) { case 0: putc('A', stream); break; case 1: putc('C', stream); break; case 2: putc('G', stream); break; case 3: putc('T', stream); break; default: putc('-', stream); break; // N, n, -, .. } } /*----------------------------------------------------------------------------*/ void StoreSymbol(UChar **mafImgRow, int mafImgRowSize, int base) { if(mafImgRowSize % ROW_BLOCK_SIZE == 0) *mafImgRow = (UChar *)Realloc(*mafImgRow, sizeof(UChar) * (mafImgRowSize + ROW_BLOCK_SIZE), sizeof(UChar) * ROW_BLOCK_SIZE); (*mafImgRow)[mafImgRowSize++] = BaseToSymbol(base); } /*----------------------------------------------------------------------------*/ void StoreOriginalSymbol(UChar **mafImgRow, int mafImgRowSize, int base) { if(mafImgRowSize % ROW_BLOCK_SIZE == 0) *mafImgRow = (UChar *)Realloc(*mafImgRow, sizeof(UChar) * (mafImgRowSize + ROW_BLOCK_SIZE), sizeof(UChar) * ROW_BLOCK_SIZE); (*mafImgRow)[mafImgRowSize++] = base; } /*----------------------------------------------------------------------------*/ void AddRowToMAFImg(MAFImg *mafImg, UChar *newRow, int rowSize) { if(mafImg->nCols && rowSize != mafImg->nCols) { fprintf(stderr, "Error: trying to add a row with different size\n"); exit(1); } mafImg->data = (UChar **)Realloc(mafImg->data, (mafImg->nRows + 1) * sizeof(UChar *), sizeof(UChar *)); mafImg->data[mafImg->nRows] = newRow; mafImg->nRows++; if(!mafImg->nCols) mafImg->nCols = rowSize; } /*----------------------------------------------------------------------------*/ void updateAncestorLine(MAFImg *mafImg, int row, int col) { int counts[N_SYMBOLS], i; // Update only the current column // Reset counters for(i=0; i < N_SYMBOLS; i++) counts[i] = 0; // Loop all lines, except the first one which is the ancestorLine for(i=1; i <= row; i++) counts[GetMAFPixel(mafImg, i, col)]++; SetMAFPixel(mafImg, 0, col, 0); // Set the base which occurs more often for(i=1; i < N_SYMBOLS; i++) { //if(counts[i] > counts[GetMAFPixel(mafImg, 0, col)]) if(counts[i] >= counts[GetMAFPixel(mafImg, 0, col)]) SetMAFPixel(mafImg, 0, col, i); } } /*----------------------------------------------------------------------------*/
/* * This file is part of the TrinityCore Project. See AUTHORS file for Copyright information * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the * Free Software Foundation; either version 2 of the License, or (at your * option) any later version. * * 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 MovementInfo_h__ #define MovementInfo_h__ #include "ObjectGuid.h" #include "Position.h" #include <algorithm> #include <vector> struct MovementInfo { // common ObjectGuid guid; uint32 flags; uint32 flags2; Position pos; uint32 time; // transport struct TransportInfo { void Reset() { guid.Clear(); pos.Relocate(0.0f, 0.0f, 0.0f, 0.0f); seat = -1; time = 0; prevTime = 0; vehicleId = 0; } ObjectGuid guid; Position pos; int8 seat; uint32 time; uint32 prevTime; uint32 vehicleId; } transport; // swimming/flying float pitch; // jumping struct JumpInfo { void Reset() { fallTime = 0; zspeed = sinAngle = cosAngle = xyspeed = 0.0f; } uint32 fallTime; float zspeed, sinAngle, cosAngle, xyspeed; } jump; // spline float splineElevation; MovementInfo() : flags(0), flags2(0), time(0), pitch(0.0f), splineElevation(0.0f) { pos.Relocate(0.0f, 0.0f, 0.0f, 0.0f); transport.Reset(); jump.Reset(); } uint32 GetMovementFlags() const { return flags; } void SetMovementFlags(uint32 flag) { flags = flag; } void AddMovementFlag(uint32 flag) { flags |= flag; } void RemoveMovementFlag(uint32 flag) { flags &= ~flag; } bool HasMovementFlag(uint32 flag) const { return (flags & flag) != 0; } uint32 GetExtraMovementFlags() const { return flags2; } void SetExtraMovementFlags(uint32 flag) { flags2 = flag; } void AddExtraMovementFlag(uint32 flag) { flags2 |= flag; } void RemoveExtraMovementFlag(uint32 flag) { flags2 &= ~flag; } bool HasExtraMovementFlag(uint32 flag) const { return (flags2 & flag) != 0; } uint32 GetFallTime() const { return jump.fallTime; } void SetFallTime(uint32 fallTime) { jump.fallTime = fallTime; } void ResetTransport() { transport.Reset(); } void ResetJump() { jump.Reset(); } void OutDebug(); }; struct MovementForce { ObjectGuid ID; TaggedPosition<Position::XYZ> Origin; TaggedPosition<Position::XYZ> Direction; uint32 TransportID = 0; float Magnitude = 0.0f; uint8 Type = 0; int32 Unused910 = 0; }; class MovementForces { public: using Container = std::vector<MovementForce>; Container const* GetForces() const { return &_forces; } bool Add(MovementForce const& newForce) { auto itr = FindMovementForce(newForce.ID); if (itr == _forces.end()) { _forces.push_back(newForce); return true; } return false; } bool Remove(ObjectGuid id) { auto itr = FindMovementForce(id); if (itr != _forces.end()) { _forces.erase(itr); return true; } return false; } float GetModMagnitude() const { return _modMagnitude; } void SetModMagnitude(float modMagnitude) { _modMagnitude = modMagnitude; } bool IsEmpty() const { return _forces.empty() && _modMagnitude == 1.0f; } private: Container::iterator FindMovementForce(ObjectGuid id) { return std::find_if(_forces.begin(), _forces.end(), [id](MovementForce const& force) { return force.ID == id; }); } Container _forces; float _modMagnitude = 1.0f; }; #endif // MovementInfo_h__
/* * Author: MontaVista Software, Inc. <source@mvista.com> * * 2007 (c) MontaVista Software, Inc. This file is licensed under * the terms of the GNU General Public License version 2. This program * is licensed "as is" without any warranty of any kind, whether express * or implied. */ #include <linux/init.h> #include <linux/mvl_patch.h> static __init int regpatch(void) { return mvl_register_patch(517); } module_init(regpatch);
////////////////////////////////////////////////////////////////////// // StringEx.h // // //Modify by Ðì¾°ÖÜ 2000.10 //¹¦ÄÜ£º×Ö·û´®²Ù×÷À©Õ¹Àà // #ifndef __STRINGEX_H_ #define __STRINGEX_H_ class CStringEx : public CString { public: CStringEx() : CString( ){}; CStringEx( const CString& stringSrc) : CString( stringSrc ){}; CStringEx( const CStringEx& stringSrc) : CString( stringSrc ){}; CStringEx( TCHAR ch, int nRepeat = 1 ) : CString( ch, nRepeat ){}; CStringEx( LPCTSTR lpch, int nLength ) : CString( lpch, nLength ){}; CStringEx( const unsigned char* psz ) : CString( psz ){}; CStringEx( LPCWSTR lpsz ) : CString( lpsz ){}; CStringEx( LPCSTR lpsz ) : CString( lpsz ){}; CStringEx& Insert(int pos, LPCTSTR s); CStringEx& Insert(int pos, TCHAR c); CStringEx& Delete(int pos, int len); CStringEx& Replace(int pos, int len, LPCTSTR s); int Find( TCHAR ch, int startpos = 0 ) const; int Find( LPCTSTR lpszSub, int startpos = 0 ) const; int FindNoCase( TCHAR ch, int startpos = 0 ) const; int FindNoCase( LPCTSTR lpszSub, int startpos = 0 ) const; int FindReplace( LPCTSTR lpszSub, LPCTSTR lpszReplaceWith, BOOL bGlobal = TRUE ); int FindReplaceNoCase( LPCTSTR lpszSub, LPCTSTR lpszReplaceWith, BOOL bGlobal = TRUE ); int ReverseFind( TCHAR ch ) const{ return CString::ReverseFind(ch);}; int ReverseFind( LPCTSTR lpszSub, int startpos = -1 ) const; int ReverseFindNoCase( TCHAR ch, int startpos = -1 ) const; int ReverseFindNoCase( LPCTSTR lpszSub, int startpos = -1 ) const; CStringEx GetField( LPCTSTR delim, int fieldnum); CStringEx GetField( TCHAR delim, int fieldnum); int GetFieldCount( LPCTSTR delim ); int GetFieldCount( TCHAR delim ); CStringEx GetDelimitedField( LPCTSTR delimStart, LPCTSTR delimEnd, int fieldnum = 0); }; #endif /////////////////////////////////////////////////////////////////////
/* * COPYRIGHT: See COPYING in the top level directory * PROJECT: ReactX * FILE: dll/directx/d3d9/d3d9_callbacks.c * PURPOSE: Direct3D9's callback functions * PROGRAMERS: Gregor Gullwi <gbrunmar (dot) ros (at) gmail (dot) com> */ #include "d3d9_common.h" #include "d3d9_callbacks.h" #include <d3d9.h> #include <dll/directx/d3d8thk.h> #include "d3d9_private.h" #include "ddrawi.h" DWORD WINAPI D3d9GetAvailDriverMemory(LPD3D9_GETAVAILDRIVERMEMORYDATA pData) { DWORD Ret = FALSE; DDHAL_GETAVAILDRIVERMEMORYDATA Data; ZeroMemory(&Data, sizeof(Data)); if (D3D9_GETAVAILDRIVERMEMORY_TYPE_ALL == pData->dwMemoryType) { Data.DDSCaps.dwCaps = DDSCAPS_VIDEOMEMORY; } else if (D3D9_GETAVAILDRIVERMEMORY_TYPE_LOCAL == pData->dwMemoryType) { Data.DDSCaps.dwCaps = DDSCAPS_VIDEOMEMORY | DDSCAPS_LOCALVIDMEM; } else if (D3D9_GETAVAILDRIVERMEMORY_TYPE_NONLOCAL == pData->dwMemoryType) { Data.DDSCaps.dwCaps = DDSCAPS_VIDEOMEMORY | DDSCAPS_NONLOCALVIDMEM; } if (Data.DDSCaps.dwCaps != 0) { if (0 == pData->dwTextureType) Data.DDSCaps.dwCaps |= DDSCAPS_TEXTURE; if (pData->dwTextureType & D3D9_TEXTURETYPE_HALSURFACE) Data.DDSCaps.dwCaps |= DDSCAPS_TEXTURE | DDSCAPS_3DDEVICE; if (pData->dwTextureType & D3D9_TEXTURETYPE_BACKBUFFER) Data.DDSCaps.dwCaps |= DDSCAPS_ZBUFFER; Ret = OsThunkDdGetAvailDriverMemory(pData->pUnknown6BC->hDirectDrawLocal, (DD_GETAVAILDRIVERMEMORYDATA*)&Data); pData->dwFree = Data.dwFree; } return Ret; }
/* SDL - Simple DirectMedia Layer Copyright (C) 1997-2004 Sam Lantinga 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 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Sam Lantinga slouken@libsdl.org */ #include "SDL_config.h" /* Centscreen extension definitions Patrice Mandin */ #include <mint/falcon.h> #include "SDL_xbios.h" #include "SDL_xbios_centscreen.h" int SDL_XBIOS_CentscreenInit(_THIS) { centscreen_mode_t curmode, listedmode; unsigned long result; int cur_handle; /* Current Centscreen mode handle */ /* Reset current mode list */ if (XBIOS_modelist) { SDL_free(XBIOS_modelist); XBIOS_nummodes = 0; XBIOS_modelist = NULL; } /* Add Centscreen modes */ Vread(&curmode); cur_handle = curmode.handle; curmode.mode = curmode.physx = curmode.physy = curmode.plan = curmode.logx = curmode.logy = -1; result = Vfirst(&curmode, &listedmode); if (result==0) { while (result==0) { /* Don't add modes with virtual screen */ if ((listedmode.mode & CSCREEN_VIRTUAL)==0) { /* Don't add modes with bpp<8 */ if (listedmode.plan>=8) { SDL_XBIOS_AddMode(this, listedmode.mode, listedmode.physx, listedmode.physy, listedmode.plan, SDL_FALSE ); } } SDL_memcpy(&curmode, &listedmode, sizeof(centscreen_mode_t)); curmode.mode = curmode.physx = curmode.physy = curmode.plan = curmode.logx = curmode.logy = -1; result = Vnext(&curmode, &listedmode); } } else { fprintf(stderr, "No suitable Centscreen modes\n"); } return cur_handle; } void SDL_XBIOS_CentscreenSetmode(_THIS, int width, int height, int planes) { centscreen_mode_t newmode, curmode; newmode.handle = newmode.mode = newmode.logx = newmode.logy = -1; newmode.physx = width; newmode.physy = height; newmode.plan = planes; Vwrite(0, &newmode, &curmode); #ifdef SDL_VIDEO_DISABLE_SCREENSAVER /* Disable screensaver */ Vread(&newmode); newmode.mode &= ~(CSCREEN_SAVER|CSCREEN_ENERGYSTAR); Vwrite(0, &newmode, &curmode); #endif /* SDL_VIDEO_DISABLE_SCREENSAVER */ } void SDL_XBIOS_CentscreenRestore(_THIS, int prev_handle) { centscreen_mode_t newmode, curmode; /* Restore old video mode */ newmode.handle = prev_handle; newmode.mode = newmode.physx = newmode.physy = newmode.plan = newmode.logx = newmode.logy = -1; Vwrite(0, &newmode, &curmode); }
/* This file is part of CWC Simulator. CWC Simulator 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. CWC Simulator 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 CWC Simulator. If not, see <http://www.gnu.org/licenses/>. */ #ifndef OCOMPARTMENT #define OCOMPARTMENT //#include "definitions.h" //#include "Species.h" #include "Compartment.h" #include "Instantiation.h" #include <vector> #include <string> using namespace std; /** compartment of a CWC open term */ class OCompartment { public: /** wrap of the compartment */ Species *wrap; /** content-species of the compartment */ Species *content_species; /** content-compartments of the compartment */ vector<OCompartment *> *content_compartments; /** type of the compartment (adress) */ symbol_adress type; /** wrap variables */ //vector<variable_symbol *> &wrap_variables_symbols; vector<variable_adress> wrap_variables_symbols; /** content variables */ //vector<variable_symbol *> &content_variables_symbols; vector<variable_adress> content_variables_symbols; /** constructor */ OCompartment ( Species *wrap, Species *cs, vector<OCompartment *> *cc, //vector<variable_symbol *> &wrap_variables, //vector<variable_symbol *> &content_variables, vector<variable_adress> wrap_variables, vector<variable_adress> content_variables, symbol_adress t ); /** top-level constructor */ OCompartment( Species *cs, vector<OCompartment *> *cc, //vector<variable_symbol *> &content_variables, vector<variable_adress> content_variables, symbol_adress t ); /** copy constructor */ OCompartment (OCompartment &); ~OCompartment(); /** build the ground compartment by an instantiation @param sigma the instantiation @return the ground compartment */ Compartment *ground(instantiationType &sigma); friend ostream& operator<<(ostream &, OCompartment &); }; #endif
// // ZoneMinder Core Interfaces, $Date: 2008-07-25 10:23:20 +0100 (Fri, 25 Jul 2008) $, $Revision: 2610 $ // $Copyright$ // // 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 ZM_H #define ZM_H extern "C" { #include "zm_debug.h" } #include "zm_config.h" extern "C" { #if !HAVE_DECL_ROUND double round(double); #endif } //schumi#0003 #define ZM_RECORD2VIDEO_SCHUMI //schumi#0003 end typedef unsigned char U8; typedef unsigned short U16; typedef unsigned long U32; typedef unsigned long long U64; typedef signed char S8; typedef signed short S16; typedef signed long S32; typedef signed long long S64; #endif // ZM_H
/*/ CMainDlg.h (2005.08.02) /*/ #pragma once #include "stdafx.h" #include "resource.h" #include "LocalDefinition.h" class CMainDlg : public CDialog { public: CMainDlg(); enum { IDD = IDD_MAIN }; CString sVersion; CString sCode; CString sDescription; CString sChecksum; CPtrList listDTC; POSITION pos; unsigned short usIndex; CString sCurrent; CString sHistoric; CString sBit; private: long BrowseForFile(CString* szReturn); void GenerateChecksum(LPSTRUCT_DTCITEM lpDTCItem); unsigned char GenerateChecksum(LPCTSTR szBuffer,unsigned char ucBufferLength); unsigned char GenerateChecksum(unsigned long ulValue); void LoadList(); protected: virtual void DoDataExchange(CDataExchange* pDX); virtual void OnCancel(); afx_msg void OnBack(); afx_msg void OnNext(); afx_msg void OnLoad(); afx_msg void OnSave(); afx_msg void OnNew(); afx_msg void OnDelete(); DECLARE_MESSAGE_MAP() };
/* Ftp connection management Copyright (C) 1997,2002 Free Software Foundation, Inc. Written by Miles Bader <miles@gnu.ai.mit.edu> This file is part of the GNU Hurd. The GNU Hurd is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. The GNU Hurd is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA. */ #include <assert-backtrace.h> #include <stdint.h> #include "ftpfs.h" /* A particular connection. */ struct ftpfs_conn { struct ftp_conn *conn; struct ftpfs_conn *next; }; /* For debugging purposes, give each connection a unique integer id. */ static unsigned conn_id = 0; /* Get an ftp connection to use for an operation. */ error_t ftpfs_get_ftp_conn (struct ftpfs *fs, struct ftp_conn **conn) { struct ftpfs_conn *fsc; pthread_spin_lock (&fs->conn_lock); fsc = fs->free_conns; if (fsc) fs->free_conns = fsc->next; pthread_spin_unlock (&fs->conn_lock); if (! fsc) { error_t err; fsc = malloc (sizeof (struct ftpfs_conn)); if (! fsc) return ENOMEM; err = ftp_conn_create (fs->ftp_params, fs->ftp_hooks, &fsc->conn); if (! err) { /* Set connection type to binary. */ err = ftp_conn_set_type (fsc->conn, "I"); if (err) ftp_conn_free (fsc->conn); } if (err) { free (fsc); return err; } /* For debugging purposes, give each connection a unique integer id. */ fsc->conn->hook = (void *)(uintptr_t)conn_id++; } pthread_spin_lock (&fs->conn_lock); fsc->next = fs->conns; fs->conns = fsc; pthread_spin_unlock (&fs->conn_lock); *conn = fsc->conn; return 0; } /* Return CONN to the pool of free connections in FS. */ void ftpfs_release_ftp_conn (struct ftpfs *fs, struct ftp_conn *conn) { struct ftpfs_conn *fsc, *pfsc; pthread_spin_lock (&fs->conn_lock); for (pfsc = 0, fsc = fs->conns; fsc; pfsc = fsc, fsc = fsc->next) if (fsc->conn == conn) { if (pfsc) pfsc->next = fsc->next; else fs->conns = fsc->next; fsc->next = fs->free_conns; fs->free_conns = fsc; break; } assert_backtrace (fsc); pthread_spin_unlock (&fs->conn_lock); }
/* * Generic GPIO API implementation for PowerPC. * * Copyright (c) 2007-2008 MontaVista Software, Inc. * * Author: Anton Vorontsov <avorontsov@ru.mvista.com> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. */ #ifndef _ASM_MICROBLAZE_GPIO_H #define _ASM_MICROBLAZE_GPIO_H #include <linux/errno.h> #include <asm-generic/gpio.h> #ifdef CONFIG_GPIOLIB /* * We don't (yet) implement inlined/rapid versions for on-chip gpios. * Just call gpiolib. */ static inline int gpio_get_value(unsigned int gpio) { return __gpio_get_value(gpio); } static inline void gpio_set_value(unsigned int gpio, int value) { __gpio_set_value(gpio, value); } static inline int gpio_cansleep(unsigned int gpio) { return __gpio_cansleep(gpio); } <<<<<<< HEAD static inline int gpio_to_irq(unsigned int gpio) { return __gpio_to_irq(gpio); ======= /* * Not implemented, yet. */ static inline int gpio_to_irq(unsigned int gpio) { return -ENOSYS; >>>>>>> 296c66da8a02d52243f45b80521febece5ed498a } static inline int irq_to_gpio(unsigned int irq) { return -EINVAL; } #endif /* CONFIG_GPIOLIB */ #endif /* _ASM_MICROBLAZE_GPIO_H */
#include <stdio.h> int *a, *b, c, *e; void p() { printf ("%d", e); } int main() { //scanf("%d %d %d", &a, &b, &c); int i = 0, j = 1, k[13]; a = &i; b = k + 6; if (a == b) e = &c; /* statement n1 */ else e = k + 7; /* statement n2 */ if (c - 5) a = b; else if (c) a = &j; else a = e; e = a; /* statement n3 */ p(); }
#ifdef HAVE_CONFIG_H # include <config.h> #endif #if defined(SIM_REC) || defined (SIM_SEND) #undef HW_DEFAULT #undef LIRC_DRIVER_ANY #endif #include <stdio.h> #include "hardware.h" #include "hw-types.h" /* Hardware types */ extern struct hardware hw_accent; extern struct hardware hw_alsa_usb; extern struct hardware hw_asusdh; extern struct hardware hw_atilibusb; extern struct hardware hw_atwf83; extern struct hardware hw_audio; extern struct hardware hw_audio_alsa; extern struct hardware hw_awlibusb; extern struct hardware hw_bte; extern struct hardware hw_bw6130; extern struct hardware hw_commandir; extern struct hardware hw_creative; extern struct hardware hw_creative_infracd; extern struct hardware hw_default; extern struct hardware hw_devinput; extern struct hardware hw_dfclibusb; extern struct hardware hw_dsp; extern struct hardware hw_dvico; extern struct hardware hw_ea65; extern struct hardware hw_ftdi; extern struct hardware hw_i2cuser; extern struct hardware hw_iguanaIR; extern struct hardware hw_irlink; extern struct hardware hw_irman; extern struct hardware hw_livedrive_midi; extern struct hardware hw_livedrive_seq; extern struct hardware hw_logitech; extern struct hardware hw_macmini; extern struct hardware hw_mouseremote; extern struct hardware hw_mouseremote_ps2; extern struct hardware hw_mp3anywhere; extern struct hardware hw_mplay; extern struct hardware hw_pcmak; extern struct hardware hw_pinsys; extern struct hardware hw_pixelview; extern struct hardware hw_samsung; extern struct hardware hw_sb0540; extern struct hardware hw_silitek; extern struct hardware hw_slinke; extern struct hardware hw_srm7500libusb; extern struct hardware hw_tira; extern struct hardware hw_tira_raw; extern struct hardware hw_udp; extern struct hardware hw_arduinohttp; extern struct hardware hw_uirt2; extern struct hardware hw_uirt2_raw; extern struct hardware hw_usb_uirt_raw; extern struct hardware hw_usbx; #ifndef HW_DEFAULT # define HW_DEFAULT hw_default # warning HW_DEFAULT is not defined #endif struct hardware hw_null= { "/dev/null", /* default device */ -1, /* fd */ 0, /* features */ 0, /* send_mode */ 0, /* rec_mode */ 0, /* code_length */ NULL, /* init_func */ NULL, /* deinit_func */ NULL, /* send_func */ NULL, /* rec_func */ NULL, /* decode_func */ NULL, /* ioctl_func */ NULL, /* readdata */ "null", /* name */ }; struct hardware *hw_list[] = { #ifdef LIRC_DRIVER_ANY &hw_accent, #ifdef HAVE_ALSA_SB_RC &hw_alsa_usb, #endif #ifdef HAVE_LINUX_HIDDEV_H &hw_asusdh, #endif #ifdef HAVE_LIBUSB &hw_atilibusb, #endif &hw_atwf83, #ifdef HAVE_LIBPORTAUDIO &hw_audio, #endif #ifdef HAVE_LIBALSA &hw_audio_alsa, #endif #ifdef HAVE_LIBUSB &hw_awlibusb, #endif &hw_bte, #ifdef HAVE_LINUX_HIDDEV_H &hw_bw6130, #endif #ifdef HAVE_LIBUSB &hw_commandir, #endif &hw_creative, #ifdef HAVE_SCSI &hw_creative_infracd, #endif &hw_default, #ifdef HAVE_LINUX_DEVINPUT &hw_devinput, #endif #ifdef HAVE_LIBUSB &hw_dfclibusb, #endif #ifdef HAVE_SOUNDCARD &hw_dsp, #endif #ifdef HAVE_LINUX_HIDDEV_H &hw_dvico, #endif &hw_ea65, #ifdef HAVE_FTDI &hw_ftdi, #endif #ifdef HAVE_LINUX_I2C_DEV_H &hw_i2cuser, #endif #ifdef HAVE_IGUANAIR &hw_iguanaIR, #endif &hw_irlink, #ifdef HAVE_LIBIRMAN &hw_irman, #endif &hw_livedrive_midi, &hw_livedrive_seq, &hw_logitech, #ifdef HAVE_LINUX_HIDDEV_H &hw_macmini, #endif &hw_arduinohttp, &hw_mp3anywhere, &hw_mplay, &hw_mouseremote, &hw_mouseremote_ps2, &hw_null, &hw_pcmak, &hw_pinsys, &hw_pixelview, #ifdef HAVE_LINUX_HIDDEV_FLAG_UREF &hw_samsung, &hw_sb0540, #endif &hw_silitek, #ifdef HAVE_LIBUSB &hw_srm7500libusb, #endif /* &hw_slinke,*/ &hw_tira, &hw_tira_raw, &hw_udp, &hw_uirt2, &hw_uirt2_raw, &hw_usb_uirt_raw, &hw_usbx, #else &HW_DEFAULT, #endif NULL }; struct hardware hw; // which one is HW_DEFAULT could be selected with autoconf in a similar // way as it is now done upstream int hw_choose_driver (char *name) { int i; if(name==NULL){ hw = HW_DEFAULT; return 0; } if(strcasecmp(name, "dev/input") == 0) { /* backwards compatibility */ name = "devinput"; } for (i=0; hw_list[i]; i++) if (!strcasecmp (hw_list[i]->name, name)) break; if (!hw_list[i]) return -1; hw = *hw_list[i]; return 0; } void hw_print_drivers (FILE *file) { int i; fprintf(file, "Supported drivers:\n"); for (i = 0; hw_list[i]; i++) fprintf (file, "\t%s\n", hw_list[i]->name); }
#pragma once #include <vector> #include <string> #include <map> #include "UserMsg.h" #include "MyUserInfo.h" #include "MessagesArchive.h" #include "Mutex.h" #include "Thread.h" class Network; class FileManager; class Chat { public: Chat(); ~Chat(); //set pointer to Network object void SetNetwork(Network* net); //set pointer to FileManager object void SetFM(FileManager* fm); //set user name void SetName(const std::string& name); //get user name const std::string& GetName()const; //set user color void SetColor(char color); //get user color const char GetColor()const; //set both color and name void SetUserInfo(char color, const std::string& name); //add message to MessagesArchive void AddMsg(const UserMsg& msg, const std::string &name = ""); //send message and call AddMsg //returns number of bytes send //-1 if failed int SendMsg(const UserMsg& msg); //returns number of bytes send //-1 if failed //send msg to 'name' and call AddMsg int SendMsgTo(const std::string& name, UserMsg& msg); //get chat messages by 'name' //returns NULL there is none const std::vector<UserMsg>* GetChatMsgs(const std::string &name)const; //change user name in MessagesArchive void ChangeOtherUserName(const std::string &from, const std::string &to); //load user info //returns true if loaded successfully //false otherwise bool Load(); private: //user info is stored here MyUserInfo user_info_; //recent chat messages are stored here MessagesArchive messages_; Network* connected_network_; FileManager* FM_; };
/* * Copyright (C) 2002 Red Hat, Inc. * * Permission is hereby granted, free of charge, to any person * obtaining a copy of this software and associated documentation * files (the "Software"), to deal in the Software without * restriction, including without limitation the rights to use, copy, * modify, merge, publish, distribute, sublicense, and/or sell copies * of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be * included in all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ #ifndef __SN_XUTILS_H__ #define __SN_XUTILS_H__ #include <libsn/sn-common.h> SN_BEGIN_DECLS Atom sn_internal_atom_get (SnDisplay *display, const char *atom_name); void sn_internal_set_utf8_string (SnDisplay *display, Window xwindow, const char *property, const char *str); SN_END_DECLS #endif /* __SN_XUTILS_H__ */
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: t; c-basic-offset: 4 -*- */ /* * 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, write to the * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301 USA. * * Copyright 2015 Red Hat, Inc. */ #ifndef __NM_DEVICE_VXLAN_H__ #define __NM_DEVICE_VXLAN_H__ #if !defined (__NETWORKMANAGER_H_INSIDE__) && !defined (NETWORKMANAGER_COMPILATION) #error "Only <NetworkManager.h> can be included directly." #endif #include <nm-device.h> G_BEGIN_DECLS #define NM_TYPE_DEVICE_VXLAN (nm_device_vxlan_get_type ()) #define NM_DEVICE_VXLAN(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), NM_TYPE_DEVICE_VXLAN, NMDeviceVxlan)) #define NM_DEVICE_VXLAN_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), NM_TYPE_DEVICE_VXLAN, NMDeviceVxlanClass)) #define NM_IS_DEVICE_VXLAN(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), NM_TYPE_DEVICE_VXLAN)) #define NM_IS_DEVICE_VXLAN_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), NM_TYPE_DEVICE_VXLAN)) #define NM_DEVICE_VXLAN_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), NM_TYPE_DEVICE_VXLAN, NMDeviceVxlanClass)) #define NM_DEVICE_VXLAN_HW_ADDRESS "hw-address" #define NM_DEVICE_VXLAN_CARRIER "carrier" #define NM_DEVICE_VXLAN_PARENT "parent" #define NM_DEVICE_VXLAN_ID "id" #define NM_DEVICE_VXLAN_GROUP "group" #define NM_DEVICE_VXLAN_LOCAL "local" #define NM_DEVICE_VXLAN_SRC_PORT_MIN "src-port-min" #define NM_DEVICE_VXLAN_SRC_PORT_MAX "src-port-max" #define NM_DEVICE_VXLAN_LEARNING "learning" #define NM_DEVICE_VXLAN_AGEING "ageing" #define NM_DEVICE_VXLAN_TOS "tos" #define NM_DEVICE_VXLAN_TTL "ttl" #define NM_DEVICE_VXLAN_LIMIT "limit" #define NM_DEVICE_VXLAN_PROXY "proxy" #define NM_DEVICE_VXLAN_RSC "rsc" #define NM_DEVICE_VXLAN_L2MISS "l2miss" #define NM_DEVICE_VXLAN_L3MISS "l3miss" #define NM_DEVICE_VXLAN_DST_PORT "dst-port" struct _NMDeviceVxlan { NMDevice parent; }; typedef struct { NMDeviceClass parent; /*< private >*/ gpointer padding[4]; } NMDeviceVxlanClass; NM_AVAILABLE_IN_1_2 GType nm_device_vxlan_get_type (void); NM_AVAILABLE_IN_1_2 const char * nm_device_vxlan_get_hw_address (NMDeviceVxlan *device); NM_AVAILABLE_IN_1_2 gboolean nm_device_vxlan_get_carrier (NMDeviceVxlan *device); NM_AVAILABLE_IN_1_2 NMDevice * nm_device_vxlan_get_parent (NMDeviceVxlan *device); NM_AVAILABLE_IN_1_2 guint nm_device_vxlan_get_id (NMDeviceVxlan *device); NM_AVAILABLE_IN_1_2 const char * nm_device_vxlan_get_group (NMDeviceVxlan *device); NM_AVAILABLE_IN_1_2 const char * nm_device_vxlan_get_local (NMDeviceVxlan *device); NM_AVAILABLE_IN_1_2 guint nm_device_vxlan_get_src_port_min (NMDeviceVxlan *device); NM_AVAILABLE_IN_1_2 guint nm_device_vxlan_get_src_port_max (NMDeviceVxlan *device); NM_AVAILABLE_IN_1_2 guint nm_device_vxlan_get_dst_port (NMDeviceVxlan *device); NM_AVAILABLE_IN_1_2 gboolean nm_device_vxlan_get_learning (NMDeviceVxlan *device); NM_AVAILABLE_IN_1_2 guint nm_device_vxlan_get_ageing (NMDeviceVxlan *device); NM_AVAILABLE_IN_1_2 guint nm_device_vxlan_get_tos (NMDeviceVxlan *device); NM_AVAILABLE_IN_1_2 guint nm_device_vxlan_get_ttl (NMDeviceVxlan *device); NM_AVAILABLE_IN_1_2 guint nm_device_vxlan_get_limit (NMDeviceVxlan *device); NM_AVAILABLE_IN_1_2 gboolean nm_device_vxlan_get_proxy (NMDeviceVxlan *device); NM_AVAILABLE_IN_1_2 gboolean nm_device_vxlan_get_rsc (NMDeviceVxlan *device); NM_AVAILABLE_IN_1_2 gboolean nm_device_vxlan_get_l2miss (NMDeviceVxlan *device); NM_AVAILABLE_IN_1_2 gboolean nm_device_vxlan_get_l3miss (NMDeviceVxlan *device); G_END_DECLS #endif /* __NM_DEVICE_VXLAN_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 assertion #17 by verifying that select returns -1 with errno set to EINTR if a handler for the SIGVTALRM signal is setup with the SA_RESTART flag cleared. * 12/18/02 - Adding in include of sys/time.h per * rodrigc REMOVE-THIS AT attbi DOT com input that it needs * to be included whenever the timeval struct is used. */ #include <signal.h> #include <stdio.h> #include <stdlib.h> #include <sys/select.h> #include <sys/wait.h> #include <sys/time.h> #include <sys/types.h> #include <unistd.h> #include <errno.h> #include "posixtest.h" volatile sig_atomic_t wakeup = 1; void handler(int signo) { printf("Caught SIGVTALRM\n"); wakeup++; } int main() { pid_t pid; struct timeval tv; if ((pid = fork()) == 0) { /* child */ struct sigaction act; act.sa_handler = handler; act.sa_flags = 0; sigemptyset(&act.sa_mask); sigaction(SIGVTALRM, &act, 0); while (wakeup == 1) { tv.tv_sec = 3; tv.tv_usec = 0; if (select(0, NULL, NULL, NULL, &tv) == -1 && errno == EINTR) { perror("select"); return PTS_PASS; } } return PTS_FAIL; } else { /* parent */ int s; /* There is a race condition between the parent process sending the SIGVTALRM signal, and the child process being inside the 'select' function call. I could not find a pure POSIX method for determining the state of the child process, so I just added a delay so that the test is valid in most conditions. (The problem is that it would be perfectly legal for a POSIX conformant OS to not schedule the child process for a long time.) */ tv.tv_sec = 1; tv.tv_usec = 0; select(0, NULL, NULL, NULL, &tv); kill(pid, SIGVTALRM); waitpid(pid, &s, 0); if (WEXITSTATUS(s) == PTS_PASS) { printf("Test PASSED\n"); return PTS_PASS; } } printf("Test FAILED\n"); return PTS_FAIL; }
/* Header file for ridgeRegressionFunctions.c */ #include "depends.h" #ifdef HAVE_GSL_HEADER /* includes */ #if _CUDA_ #include <cuda.h> #include <cuda_runtime_api.h> #include <cublas.h> #include <cula_blas.h> #include <cula.h> #include "cudaOnlyFunctions.h" #endif #include <gsl/gsl_blas.h> #include <gsl/gsl_linalg.h> #include <gsl/gsl_math.h> #include <gsl/gsl_matrix.h> #include <gsl/gsl_vector.h> #include <math.h> #include "computeLinearRidge.h" #include "ReadInData.h" /* Compute linear ridge coefficeints */ int computeLinearRidge(GSL_TYPE(vector) * ahat, GSL_TYPE(vector) * B, GSL_TYPE(vector) * D2, GSL_TYPE(matrix) * V, PREC lambda); /* linear generalized ridge regression */ GSL_TYPE(vector) * computeLinearGeneralizedRidge(GSL_TYPE(vector) * beta, GSL_TYPE(matrix) * pred, GSL_TYPE(vector) * pheno, GSL_TYPE(vector) * shrinkage, int intercept_flag); int computeLogisticRidge(GSL_TYPE(vector) * beta, GSL_TYPE(matrix) * pred, GSL_TYPE(vector) * pheno, GSL_TYPE(vector) * shrinkage, int intercept_flat, int Doff_flat, PREC * DofF); PREC objectiveFunction(GSL_TYPE(vector) * beta, GSL_TYPE(matrix) * X, GSL_TYPE(vector) * pheno, GSL_TYPE(vector) * shrinkage, int intercept_flat); int updateBeta(GSL_TYPE(vector) * beta, GSL_TYPE(matrix) * X, GSL_TYPE(vector) * pheno, GSL_TYPE(matrix) * kI, int intercept_flag, int DofF_flag, GSL_TYPE(matrix) * invtXWX_return, GSL_TYPE(matrix) * W_return); int getProb(GSL_TYPE(vector) * p, GSL_TYPE(vector) * XB); /* NB my_gsl_solve only works for matrices of type double due to the linalg functions only having been written for this type */ int my_gsl_solve(gsl_matrix * X, gsl_matrix * solvedX); int compute_XB_and_p(GSL_TYPE(matrix) * X, GSL_TYPE(vector) * B, GSL_TYPE(vector) * XB, GSL_TYPE(vector) * p); int chooseHowManyK(GSL_TYPE(vector) * D); int returnToOriginalScaleLinear(GSL_TYPE(vector) * betaOut, GSL_TYPE(vector) * Bridge, GSL_TYPE(vector) * means, GSL_TYPE(vector) * scales, PREC y_mean, int intercept_flag); /* return to original scale - generalized linear ridge regression */ int returnToOriginalScaleGenLinear(GSL_TYPE(vector) * Bridge, GSL_TYPE(vector) * betaOut, GSL_TYPE(matrix) * pred, GSL_TYPE(vector) * pheno, GSL_TYPE(vector) * scales, int intercept_flag); /* Convert trans */ char setTrans(CBLAS_TRANSPOSE_t Trans); /* prepare for linear ridge used when we are going to call linear rr on a range of different shrinkage parameters */ int prepareForLinearRidge(GSL_TYPE(matrix) * X, GSL_TYPE(vector) * y, GSL_TYPE(matrix) * U, GSL_TYPE(matrix) * V, GSL_TYPE(vector) * D, GSL_TYPE(vector) * D2, GSL_TYPE(matrix) * Z, GSL_TYPE(vector) * ahat); /* compute DofF for ridge model */ int computeDofF(GSL_TYPE(vector) * D2, PREC Kr, PREC * DofF); /* compute (A + BDC')^(-1) */ int invert_sum_of_matrices(const PREC Ainv, const GSL_TYPE(matrix) * B, const GSL_TYPE(vector) * Dinv, const GSL_TYPE(matrix) * tC, GSL_TYPE(matrix) * out); /* ordinary regression */ gsl_vector * my_gsl_linear_fit(gsl_matrix * X, gsl_vector * y, int NROW, int NCOL); #endif
// Emacs style mode select -*- C++ -*- //----------------------------------------------------------------------------- // // Copyright(C) 2014 Samuel Villarreal // // 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 __SYSTEMBASE_H__ #define __SYSTEMBASE_H__ class kexSystem { public: kexSystem(void); virtual void Main(int argc, char **argv) = 0; virtual void Init(void) = 0; virtual void Sleep(unsigned long usecs); virtual void Shutdown(void) = 0; virtual int GetMS(void); virtual uint64_t GetPerformanceCounter(void); virtual int GetTicks(void); virtual void SpawnInternalConsole(void); virtual void ShowInternalConsole(bool show); virtual void DestroyInternalConsole(void); virtual void SwapBuffers(void) = 0; virtual int GetWindowFlags(void); virtual const char *GetWindowTitle(void); virtual void SetWindowTitle(const char *string); virtual void SetWindowGrab(const bool bEnable); virtual void WarpMouseToCenter(void); virtual short SwapLE16(const short val); virtual short SwapBE16(const short val); virtual int SwapLE32(const int val); virtual int SwapBE32(const int val); virtual void *GetProcAddress(const char *proc); virtual int CheckParam(const char *check); virtual const char *GetBaseDirectory(void); virtual void Log(const char *fmt, ...); virtual void Printf(const char *string, ...); virtual void CPrintf(rcolor color, const char *string, ...); virtual void Warning(const char *string, ...); virtual void DPrintf(const char *string, ...); virtual void Error(const char *string, ...); int VideoWidth(void) { return videoWidth; } int VideoHeight(void) { return videoHeight; } float VideoRatio(void) { return videoRatio; } bool IsWindowed(void) { return bWindowed; } virtual void *Window(void) { return NULL; } bool IsShuttingDown(void) { return bShuttingDown; } const int Argc(void) const { return argc; } const char **Argv(void) { return (const char**)argv; } protected: int videoWidth; int videoHeight; float videoRatio; bool bWindowed; bool bShuttingDown; FILE *f_stdout; FILE *f_stderr; int argc; char **argv; char *basePath; }; #endif
/* * MUSB OTG driver register I/O * * Copyright 2005 Mentor Graphics Corporation * Copyright (C) 2005-2006 by Texas Instruments * Copyright (C) 2006-2007 Nokia Corporation * * 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 St, Fifth Floor, Boston, MA * 02110-1301 USA * * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN * NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY DIRECT, INDIRECT, * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * */ #ifndef __MUSB_LINUX_PLATFORM_ARCH_H__ #define __MUSB_LINUX_PLATFORM_ARCH_H__ #include <linux/io.h> #if !defined(CONFIG_ARM) && !defined(CONFIG_SUPERH) \ && !defined(CONFIG_AVR32) && !defined(CONFIG_PPC32) \ && !defined(CONFIG_PPC64) && !defined(CONFIG_BLACKFIN) \ && !defined(CONFIG_MIPS) && !defined(CONFIG_M68K) static inline void readsl(const void __iomem *addr, void *buf, int len) { insl((unsigned long)addr, buf, len); } static inline void readsw(const void __iomem *addr, void *buf, int len) { insw((unsigned long)addr, buf, len); } static inline void readsb(const void __iomem *addr, void *buf, int len) { insb((unsigned long)addr, buf, len); } static inline void writesl(const void __iomem *addr, const void *buf, int len) { outsl((unsigned long)addr, buf, len); } static inline void writesw(const void __iomem *addr, const void *buf, int len) { outsw((unsigned long)addr, buf, len); } static inline void writesb(const void __iomem *addr, const void *buf, int len) { outsb((unsigned long)addr, buf, len); } #endif #if !defined(CONFIG_BLACKFIN) || defined(CONFIG_BF60x) /* NOTE: these offsets are all in bytes */ static inline u16 musb_readw(const void __iomem *addr, unsigned offset) { return __raw_readw(addr + offset); } static inline u32 musb_readl(const void __iomem *addr, unsigned offset) { return __raw_readl(addr + offset); } static inline void musb_writew(void __iomem *addr, unsigned offset, u16 data) { __raw_writew(data, addr + offset); } static inline void musb_writel(void __iomem *addr, unsigned offset, u32 data) { __raw_writel(data, addr + offset); } #if defined(CONFIG_USB_MUSB_TUSB6010) || defined (CONFIG_USB_MUSB_TUSB6010_MODULE) /* * TUSB6010 doesn't allow 8-bit access; 16-bit access is the minimum. */ static inline u8 musb_readb(const void __iomem *addr, unsigned offset) { u16 tmp; u8 val; tmp = __raw_readw(addr + (offset & ~1)); if (offset & 1) val = (tmp >> 8); else val = tmp & 0xff; return val; } static inline void musb_writeb(void __iomem *addr, unsigned offset, u8 data) { u16 tmp; tmp = __raw_readw(addr + (offset & ~1)); if (offset & 1) tmp = (data << 8) | (tmp & 0xff); else tmp = (tmp & 0xff00) | data; __raw_writew(tmp, addr + (offset & ~1)); } #else static inline u8 musb_readb(const void __iomem *addr, unsigned offset) { return __raw_readb(addr + offset); } static inline void musb_writeb(void __iomem *addr, unsigned offset, u8 data) { __raw_writeb(data, addr + offset); } #endif /* CONFIG_USB_MUSB_TUSB6010 */ #else static inline u8 musb_readb(const void __iomem *addr, unsigned offset) { return (u8) (bfin_read16(addr + offset)); } static inline u16 musb_readw(const void __iomem *addr, unsigned offset) { return bfin_read16(addr + offset); } static inline u32 musb_readl(const void __iomem *addr, unsigned offset) { return (u32) (bfin_read16(addr + offset)); } static inline void musb_writeb(void __iomem *addr, unsigned offset, u8 data) { bfin_write16(addr + offset, (u16) data); } static inline void musb_writew(void __iomem *addr, unsigned offset, u16 data) { bfin_write16(addr + offset, data); } static inline void musb_writel(void __iomem *addr, unsigned offset, u32 data) { bfin_write16(addr + offset, (u16) data); } #endif /* CONFIG_BLACKFIN */ #endif
/* Definition of class NSHFSFileTypes Copyright (C) 2019 Free Software Foundation, Inc. By: heron Date: Fri Nov 1 00:25:22 EDT 2019 This file is part of the GNUstep Library. 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; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111 USA. */ #ifndef _NSHFSFileTypes_h_GNUSTEP_BASE_INCLUDE #define _NSHFSFileTypes_h_GNUSTEP_BASE_INCLUDE #include <Foundation/NSObject.h> #if OS_API_VERSION(MAC_OS_X_VERSION_10_0, GS_API_LATEST) #if defined(__cplusplus) extern "C" { #endif @class NSString; GS_EXPORT NSString *NSFileTypeForHFSTypeCode(NSUInteger hfsFileTypeCode); GS_EXPORT NSUInteger NSHFSTypeCodeFromFileType(NSString *fileTypeString); GS_EXPORT NSString *NSHFSTypeOfFile(NSString *fullFilePath); #if defined(__cplusplus) } #endif #endif /* GS_API_MACOSX */ #endif /* _NSHFSFileTypes_h_GNUSTEP_BASE_INCLUDE */
/* @brief ArduSat I2C address list Defines all the addresses used for I2C devices on the ArduSat Payload Copyright 2013 NanoSatisfi, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 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/>. @author Jeroen Cappaert and NanoSatisfi, Inc. @date May 2013 */ #ifndef I2C_add_H_ /* I2C_add_H_ */ #define I2C_add_H_ // sensor addresses #define I2C_ADD_MAG 0X0E // magnetometer #define I2C_ADD_LUX1 0X29 // TSL2561 #1 (bottomplate camera) #define I2C_ADD_LUX2 0x39 // TSL2561 #2 (bottomplate slit) #define I2C_ADD_TMP1 0X48 // temp sensor TMP102 (payload #1) #define I2C_ADD_TMP2 0X49 // temp sensor TMP102 (payload #2) #define I2C_ADD_TMP3 0X4A // temp sensor TMP102 (bottomplate #1) #define I2C_ADD_TMP4 0X4B // temp sensor TMP102 (bottomplate #2) #define I2C_ADD_ACC 0X53 // accelerometer ADXL345 #define I2C_ADD_GYR 0X69 // gyros ITG3200 #define I2C_ADD_MLX 0X51 // IR thermometer (bottomplate) // experiment arduino addresses #define I2C_ADD_ARD1 0X2B // experiment arduino 1 #define I2C_ADD_ARD2 0X2C // experiment arduino 2 #define I2C_ADD_ARD3 0X2D // experiment arduino 3 #define I2C_ADD_ARD4 0X2E // experiment arduino 4 #define I2C_ADD_ARD5 0X2F // experiment arduino 5 #define I2C_ADD_ARD6 0X30 // experiment arduino 6 #define I2C_ADD_ARD7 0X31 // experiment arduino 7 #define I2C_ADD_ARD8 0X32 // experiment arduino 8 #define I2C_ADD_ARD9 0X33 // experiment arduino 9 #define I2C_ADD_ARD10 0X34 // experiment arduino 10 #define I2C_ADD_GPS 0X3C // GPS arduino (node 11) #define I2C_ADD_ARD12 0X3D // experiment arduino 12 #define I2C_ADD_ARD13 0X3E // experiment arduino 13 #define I2C_ADD_ARD14 0X3F // experiment arduino 14 #define I2C_ADD_ARD15 0X40 // experiment arduino 15 #define I2C_ADD_ARD16 0X41 // experiment arduino 16 // peripheral arduino adresses #define I2C_ADD_ASSV_1 0X04 // master arduino #define I2C_ADD_ASSV_X 0X20 // master arduino #define I2C_ADD_SPECT 0X22 // spectruino arduino #define I2C_ADD_GEIGER 0X23 // uSD card arduino #endif /* I2C_add_H_ */
/* * * This file contains the quartz configuration widget * * Copyright (c) 2001 * Karol Szwed <gallium@kde.org> * http://gallium.n3.net/ */ #ifndef __KDE_QUARTZCONFIG_H #define __KDE_QUARTZCONFIG_H #include <qcheckbox.h> #include <qvbox.h> #include <kconfig.h> class QuartzConfig: public QObject { Q_OBJECT public: QuartzConfig( KConfig* conf, QWidget* parent ); ~QuartzConfig(); // These public signals/slots work similar to KCM modules signals: void changed(); public slots: void load( KConfig* conf ); void save( KConfig* conf ); void defaults(); protected slots: void slotSelectionChanged(); // Internal use private: KConfig* quartzConfig; QCheckBox* cbColorBorder; QCheckBox* cbExtraSmall; QVBox* gb; }; #endif // vim: ts=4
/*********************************************************************** $Id$ Tree viewer applet Copyright (c) 1993-98 M. Kimes Copyright (c) 2008 Steven H.Levine 05 Jan 08 SHL Sync 14 Dec 08 SHL Add exception handler support ***********************************************************************/ #include <stdlib.h> // min #include <string.h> #define INCL_DOS #define INCL_WIN #define INCL_DOSEXCEPTIONS // XCTP_... #define INCL_DOSERRORS // NO_ERROR #include "dll\fm3dll.h" #include "dll\mainwnd.h" // hwndTree hwndBubble #include "dll\notebook.h" // appname #include "dll\init.h" // InitFM3DLL #include "dll\treecnr.h" // StartTreeCnr #include "dll\errutil.h" // Error reporting #include "dll\excputil.h" // Exception handlers static PSZ pszSrcFile = __FILE__; int main(int argc, char *argv[]) { HAB hab; HMQ hmq; QMSG qmsg; UINT x; BOOL startminimized = FALSE; APIRET regRet; EXCEPTIONREGISTRATIONRECORD regRec = { NULL, NULL }; strcpy(appname, "VTREE"); DosError(FERR_DISABLEHARDERR); regRec.ExceptionHandler = HandleException; regRet = DosSetExceptionHandler(&regRec); if (regRet != NO_ERROR) { DbgMsg(pszSrcFile, __LINE__, "DosSetExceptionHandler failed with error %u", regRet); } hab = WinInitialize(0); if (hab) { hmq = WinCreateMsgQueue(hab, 1024); if (hmq) { if (InitFM3DLL(hab, argc, argv)) { for (x = 1; x < argc; x++) { if (*argv[x] == '~') { startminimized = TRUE; break; } } hwndTree = StartTreeCnr(HWND_DESKTOP, 0); if (hwndTree) { if (hwndHelp) WinAssociateHelpInstance(hwndHelp, hwndTree); if (!WinRestoreWindowPos("FM/2", "VTreeWindowPos", hwndTree)) { SWP swp; ULONG adjust; adjust = WinQuerySysValue(HWND_DESKTOP, SV_CXICON) * 8L; WinQueryTaskSizePos(hab, 0L, &swp); swp.cx = min(swp.cx, adjust); WinSetWindowPos(hwndTree, HWND_TOP, swp.x, swp.y, swp.cx, swp.cy, SWP_SHOW | SWP_MOVE | SWP_SIZE | SWP_ZORDER | SWP_ACTIVATE); } if (startminimized) WinSetWindowPos(hwndTree, HWND_TOP, 0, 0, 0, 0, SWP_MINIMIZE); else WinSetWindowPos(hwndTree, HWND_TOP, 0, 0, 0, 0, SWP_SHOW | SWP_ZORDER | SWP_ACTIVATE); for (;;) { if (!WinGetMsg(hab, &qmsg, (HWND) 0, 0, 0)) { if (qmsg.hwnd) qmsg.msg = WM_CLOSE; else break; } if (hwndBubble && ((qmsg.msg > (WM_BUTTON1DOWN - 1) && qmsg.msg < (WM_BUTTON3DBLCLK + 1)) || (qmsg.msg > (WM_CHORD - 1) && qmsg.msg < (WM_BUTTON3CLICK + 1))) && WinIsWindowVisible(hwndBubble)) WinShowWindow(hwndBubble, FALSE); WinDispatchMsg(hab, &qmsg); } } } DosSleep(125); WinDestroyMsgQueue(hmq); } WinTerminate(hab); } return 0; }
/* * Minimalistic (auto) mount daemon * Copyright (C) 2015 Ernest Vogelsang <stagprom@posteo.de> * * This file is part of mmountd. * * mmountd 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. * * mmountd 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 mmountd. If not, see <http://www.gnu.org/licenses/>. * * Original provided by fon.com * Copyright (C) 2009 John Crispin <blogic@openwrt.org> * */ #ifndef _AUTOFS_H__ #define _AUTOFS_H__ time_t timeout; char *mountopt, *mountp, *device; char *helper; void autofs_init(void); void autofs_loop(void); #endif
/* * This file is part of the libopencm3 project. * * Copyright (C) 2010 Thomas Otto <tommi@viadmin.org> * Copyright (C) 2010 Mark Butler <mbutler@physics.otago.ac.nz> * * 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 <libopencm3/stm32/f4/flash.h> static inline void flash_set_program_size(u32 psize) { FLASH_CR &= ~(((1 << 0) | (1 << 1)) << 8); FLASH_CR |= psize; } void flash_data_cache_enable(void) { FLASH_ACR |= FLASH_DCE; } void flash_dcache_disable(void) { FLASH_ACR &= ~FLASH_DCE; } void flash_icache_enable(void) { FLASH_ACR |= FLASH_ICE; } void flash_icache_disable(void) { FLASH_ACR &= ~FLASH_ICE; } void flash_prefetch_enable(void) { FLASH_ACR |= FLASH_PRFTEN; } void flash_prefetch_disable(void) { FLASH_ACR &= ~FLASH_PRFTEN; } void flash_dcache_reset(void) { FLASH_ACR |= FLASH_DCRST; } void flash_icache_reset(void) { FLASH_ACR |= FLASH_ICRST; } void flash_set_ws(u32 ws) { u32 reg32; reg32 = FLASH_ACR; reg32 &= ~((1 << 0) | (1 << 1) | (1 << 2)); reg32 |= ws; FLASH_ACR = reg32; } void flash_unlock(void) { /* Authorize the FPEC access. */ FLASH_KEYR = FLASH_KEY1; FLASH_KEYR = FLASH_KEY2; } void flash_lock(void) { FLASH_CR |= FLASH_LOCK; } void flash_clear_pgserr_flag(void) { FLASH_SR |= FLASH_PGSERR; } void flash_clear_pgperr_flag(void) { FLASH_SR |= FLASH_PGPERR; } void flash_clear_pgaerr_flag(void) { FLASH_SR |= FLASH_PGAERR; } void flash_clear_eop_flag(void) { FLASH_SR |= FLASH_EOP; } void flash_clear_wrperr_flag(void) { FLASH_SR |= FLASH_WRPERR; } void flash_clear_bsy_flag(void) { FLASH_SR &= ~FLASH_BSY; } void flash_clear_status_flags(void) { flash_clear_pgserr_flag(); flash_clear_pgperr_flag(); flash_clear_pgaerr_flag(); flash_clear_eop_flag(); flash_clear_wrperr_flag(); flash_clear_bsy_flag(); } void flash_unlock_option_bytes(void) { FLASH_OPTKEYR = FLASH_OPTKEY1; FLASH_OPTKEYR = FLASH_OPTKEY2; } void flash_lock_option_bytes(void) { FLASH_OPTCR |= FLASH_OPTLOCK; } void flash_wait_for_last_operation(void) { while ((FLASH_SR & FLASH_BSY) == FLASH_BSY) ; } void flash_program_double_word(u32 address, u64 data, u32 program_size) { /* Ensure that all flash operations are complete. */ flash_wait_for_last_operation(); flash_set_program_size(program_size); /* Enable writes to flash. */ FLASH_CR |= FLASH_PG; /* Program the first half of the word. */ MMIO64(address) = data; /* Wait for the write to complete. */ flash_wait_for_last_operation(); /* Disable writes to flash. */ FLASH_CR &= ~FLASH_PG; } void flash_program_word(u32 address, u32 data, u32 program_size) { /* Ensure that all flash operations are complete. */ flash_wait_for_last_operation(); flash_set_program_size(program_size); /* Enable writes to flash. */ FLASH_CR |= FLASH_PG; /* Program the first half of the word. */ MMIO32(address) = data; /* Wait for the write to complete. */ flash_wait_for_last_operation(); /* Disable writes to flash. */ FLASH_CR &= ~FLASH_PG; } void flash_program_half_word(u32 address, u16 data, u32 program_size) { flash_wait_for_last_operation(); flash_set_program_size(program_size); FLASH_CR |= FLASH_PG; MMIO16(address) = data; flash_wait_for_last_operation(); FLASH_CR &= ~FLASH_PG; /* Disable the PG bit. */ } void flash_program_byte(u32 address, u8 data, u32 program_size) { flash_wait_for_last_operation(); flash_set_program_size(program_size); FLASH_CR |= FLASH_PG; MMIO8(address) = data; flash_wait_for_last_operation(); FLASH_CR &= ~FLASH_PG; /* Disable the PG bit. */ } void flash_erase_sector(u32 sector, u32 program_size) { flash_wait_for_last_operation(); flash_set_program_size(program_size); FLASH_CR &= ~(((1 << 0) | (1 << 1) | (1 << 2) | (1 << 3)) << 3); FLASH_CR |= sector; FLASH_CR |= FLASH_SER; FLASH_CR |= FLASH_STRT; flash_wait_for_last_operation(); FLASH_CR &= ~FLASH_SER; FLASH_CR &= ~(((1 << 0) | (1 << 1) | (1 << 2) | (1 << 3)) << 3); } void flash_erase_all_sectors(u32 program_size) { flash_wait_for_last_operation(); flash_set_program_size(program_size); FLASH_CR |= FLASH_MER; /* Enable mass erase. */ FLASH_CR |= FLASH_STRT; /* Trigger the erase. */ flash_wait_for_last_operation(); FLASH_CR &= ~FLASH_MER; /* Disable mass erase. */ } void flash_program_option_bytes(u32 data) { flash_wait_for_last_operation(); if (FLASH_OPTCR & FLASH_OPTLOCK) flash_unlock_option_bytes(); FLASH_OPTCR = data & ~0x3; FLASH_OPTCR |= FLASH_OPTSTRT; /* Enable option byte programming. */ flash_wait_for_last_operation(); }
/* * IRC - Internet Relay Chat, ircd/s_numeric.c * Copyright (C) 1990 Jarkko Oikarinen * * Numerous fixes by Markku Savela * * 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, or (at your option) * any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * * $Id: s_numeric.c 1969 2007-06-30 10:09:22Z sirvulcan $ */ #include "config.h" #include "s_numeric.h" #include "channel.h" #include "client.h" #include "hash.h" #include "ircd.h" #include "ircd_features.h" #include "ircd_snprintf.h" #include "numnicks.h" #include "send.h" #include "ircd_struct.h" /* * do_numeric() * Rewritten by Nemesi, Jan 1999, to support numeric nicks in parv[1] * * Called when we get a numeric message from a remote _server_ and we are * supposed to forward it somewhere. Note that we always ignore numerics sent * to 'me' and simply drop the message if we can't handle with this properly: * the savy approach is NEVER generate an error in response to an... error :) */ int do_numeric(int numeric, int nnn, struct Client *cptr, struct Client *sptr, int parc, char *parv[]) { struct Client *acptr = 0; struct Channel *achptr = 0; char num[4]; /* Avoid trash, we need it to come from a server and have a target */ if ((parc < 2) || !IsServer(sptr)) return 0; /* Who should receive this message ? Will we do something with it ? Note that we use findUser functions, so the target can't be neither a server, nor a channel (?) nor a list of targets (?) .. u2.10 should never generate numeric replies to non-users anyway Ahem... it can be a channel actually, csc bots use it :\ --Nem */ if (IsChannelName(parv[1])) achptr = FindChannel(parv[1]); else acptr = (nnn) ? (findNUser(parv[1])) : (FindUser(parv[1])); if (((!acptr) || (cli_from(acptr) == cptr)) && !achptr) return 0; /* Remap low number numerics, not that I understand WHY.. --Nemesi */ /* numerics below 100 talk about the current 'connection', you're not * connected to a remote server so it doesn't make sense to send them * remotely - but the information they contain may be useful, so we * remap them up. Weird, but true. -- Isomer */ if (numeric < 100) numeric += 100; ircd_snprintf(0, num, sizeof(num), "%03d", numeric); /* Since 2.10.10.pl14 we rewrite numerics from remote servers to appear * to come from the local server. */ if (acptr) sendcmdto_one(feature_bool(FEAT_HIS_REWRITE) && !IsOper(acptr) ? &me : sptr, num, num, acptr, "%C %s", acptr, parv[2]); else sendcmdto_channel_butone(feature_bool(FEAT_HIS_REWRITE) ? &me : sptr, num, num, achptr, cptr, SKIP_DEAF | SKIP_BURST, '\0', "%H %s", achptr, parv[2]); return 0; }
// -*- C++ -*- /* Copyright (C) 2001-2014 Free Software Foundation, Inc. Written by Gaius Mulley <gaius@glam.ac.uk> This file is part of groff. groff 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. groff 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/>. */ int adjust_arc_center(const int *, double *); void check_output_arc_limits(int x, int y, int xv1, int yv1, int xv2, int yv2, double c0, double c1, int *minx, int *maxx, int *miny, int *maxy);
/* Minetest Copyright (C) 2017 nerzhul, Loic Blot <loic.blot@unix-experience.fr> This program is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ #pragma once #include <unordered_map> #include <string> #include <vector> #include <memory> #include "network/networkprotocol.h" #include "irrlichttypes.h" enum ModChannelState : u8 { MODCHANNEL_STATE_INIT, MODCHANNEL_STATE_READ_WRITE, MODCHANNEL_STATE_READ_ONLY, MODCHANNEL_STATE_MAX, }; class ModChannel { public: ModChannel(const std::string &name) : m_name(name) {} ~ModChannel() = default; const std::string &getName() const { return m_name; } bool registerConsumer(session_t peer_id); bool removeConsumer(session_t peer_id); const std::vector<u16> &getChannelPeers() const { return m_client_consumers; } bool canWrite() const; void setState(ModChannelState state); private: std::string m_name; ModChannelState m_state = MODCHANNEL_STATE_INIT; std::vector<u16> m_client_consumers; }; enum ModChannelSignal : u8 { MODCHANNEL_SIGNAL_JOIN_OK, MODCHANNEL_SIGNAL_JOIN_FAILURE, MODCHANNEL_SIGNAL_LEAVE_OK, MODCHANNEL_SIGNAL_LEAVE_FAILURE, MODCHANNEL_SIGNAL_CHANNEL_NOT_REGISTERED, MODCHANNEL_SIGNAL_SET_STATE, }; class ModChannelMgr { public: ModChannelMgr() = default; ~ModChannelMgr() = default; void registerChannel(const std::string &channel); bool setChannelState(const std::string &channel, ModChannelState state); bool joinChannel(const std::string &channel, session_t peer_id); bool leaveChannel(const std::string &channel, session_t peer_id); bool channelRegistered(const std::string &channel) const; ModChannel *getModChannel(const std::string &channel); /** * This function check if a local mod can write on the channel * * @param channel * @return true if write is allowed */ bool canWriteOnChannel(const std::string &channel) const; void leaveAllChannels(session_t peer_id); const std::vector<u16> &getChannelPeers(const std::string &channel) const; private: bool removeChannel(const std::string &channel); std::unordered_map<std::string, std::unique_ptr<ModChannel>> m_registered_channels; };
/**************************************************************************** ** ** Copyright (C) 2012 - 2016 Jolla Ltd. ** Contact: http://jolla.com/ ** ** This file is part of Qt Creator. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser ** General Public License version 2.1 as published by the Free Software ** Foundation and appearing in the file LICENSE.LGPL included in the ** packaging of this file. Please review the following information to ** ensure the GNU Lesser General Public License version 2.1 requirements ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** Other Usage ** ** Alternatively, this file may be used in accordance with the terms and ** conditions contained in a signed written agreement between you and Digia. ** ****************************************************************************/ #ifndef VIRTUALBOXMANAGER_H #define VIRTUALBOXMANAGER_H #include <functional> #include <QMap> #include <QObject> #include <QString> #include <QStringList> namespace Utils { class Port; class PortList; } namespace Mer { namespace Internal { class VirtualMachineInfo { public: QString sharedHome; QString sharedTargets; QString sharedConfig; QString sharedSrc; QString sharedSsh; quint16 sshPort{0}; quint16 wwwPort{0}; QMap<QString, quint16> freePorts; QMap<QString, quint16> qmlLivePorts; QMap<QString, quint16> otherPorts; QStringList macs; bool headless{false}; int memorySizeMb{0}; int cpuCount{0}; QString vdiPath; // VdiInfo int vdiCapacityMb{0}; // SnapshotInfo QStringList snapshots; }; // TODO Possible to use QFutureInterface? // TODO Errors should be reported in the UI // TODO Use UUIDs instead of names - names may not be unique class MerVirtualBoxManager : public QObject { Q_OBJECT public: enum ExtraInfo { NoExtraInfo = 0x00, VdiInfo = 0x01, SnapshotInfo = 0x02, }; Q_DECLARE_FLAGS(ExtraInfos, ExtraInfo) MerVirtualBoxManager(QObject *parent = 0); static MerVirtualBoxManager* instance(); ~MerVirtualBoxManager() override; static void isVirtualMachineRunning(const QString &vmName, QObject *context, std::function<void(bool,bool)> slot); static QStringList fetchRegisteredVirtualMachines(); static VirtualMachineInfo fetchVirtualMachineInfo(const QString &vmName, ExtraInfos extraInfo = NoExtraInfo); static void startVirtualMachine(const QString &vmName, bool headless); static void shutVirtualMachine(const QString &vmName); static void restoreSnapshot(const QString &vmName, const QString &snapshotName, QObject *context, std::function<void(bool)> slot); static bool updateSharedFolder(const QString &vmName, const QString &mountName, const QString &newFolder); static bool updateSdkSshPort(const QString &vmName, quint16 port); static bool updateSdkWwwPort(const QString &vmName, quint16 port); static bool updateEmulatorSshPort(const QString &vmName, quint16 port); static Utils::PortList updateEmulatorQmlLivePorts(const QString &vmName, const QList<Utils::Port> &ports); static void setVideoMode(const QString &vmName, const QSize &size, int depth); static void setVdiCapacityMb(const QString &vmName, int sizeMb, QObject *context, std::function<void(bool)> slot); static bool setMemorySizeMb(const QString &vmName, int sizeMb); static bool setCpuCount(const QString &vmName, int count); static bool deletePortForwardingRule(const QString &vmName, const QString &ruleName); static bool updatePortForwardingRule(const QString &vmName, const QString &protocol, const QString &ruleName, quint16 hostPort, quint16 vmPort); static QList<QMap<QString, quint16>> fetchPortForwardingRules(const QString &vmName); static QString getExtraData(const QString &vmName, const QString &key); static void getHostTotalMemorySizeMb(QObject *context, std::function<void(int)> slot); static int getHostTotalCpuCount(); private: static MerVirtualBoxManager *m_instance; }; Q_DECLARE_OPERATORS_FOR_FLAGS(MerVirtualBoxManager::ExtraInfos) } // Internal } // Mer #endif // VIRTUALBOXMANAGER_H
/* * Copyright (C) 2013 Nivis LLC. * Email: opensource@nivis.com * Website: http://www.nivis.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, version 3 of the License. * * Redistribution and use in source and binary forms must retain this * copyright notice. * 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 C969_WRITEGRAPHNEIGHBOURPAIR_H_ #define C969_WRITEGRAPHNEIGHBOURPAIR_H_ #include "../../Model/WirelessNetworkManagerCommands.h" #include "../../../util/Binarization.h" #ifdef __cplusplus extern "C" { #endif /** * @Binarize all requests: CMDID + Req_Length + Req_Data * @param p_pReq * @param p_pBuffer */ uint8_t Compose_C969_WriteGraphNeighbourPair_Req(C969_WriteGraphNeighbourPair_Req* request, ComposerContext* context, BinaryStream* toStream); /** * @Debinarize */ uint8_t Parse_C969_WriteGraphNeighbourPair_Req(C969_WriteGraphNeighbourPair_Req* request, ParserContext* context, BinaryStream* fromStream); /** * */ uint8_t Compose_C969_WriteGraphNeighbourPair_Resp(C969_WriteGraphNeighbourPair_Resp* response, ComposerContext* context, BinaryStream* toStream); /** * */ uint8_t Parse_C969_WriteGraphNeighbourPair_Resp(C969_WriteGraphNeighbourPair_Resp* response, ParserContext* context, BinaryStream* fromStream); #ifdef __cplusplus } #endif #endif /*C969_WRITEGRAPHNEIGHBOURPAIR_H_*/
/* xoreos-tools - Tools to help with xoreos development * * xoreos-tools is the legal property of its developers, whose names * can be found in the AUTHORS file distributed with this source * distribution. * * xoreos-tools 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. * * xoreos-tools 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 xoreos-tools. If not, see <http://www.gnu.org/licenses/>. */ /** @file * TPC (BioWare's own texture format) loading. */ #ifndef IMAGES_TPC_H #define IMAGES_TPC_H #include <memory> #include "src/images/decoder.h" namespace Common { class SeekableReadStream; } namespace Images { /** BioWare's own texture format, TPC. * * This format is used by the two Knights of the Old Republic games. * In the Xbox versions, these files have a .txb extension, but * are still this format (not the TXB format used in Jade Empire). */ class TPC : public Decoder { public: TPC(Common::SeekableReadStream &tpc); ~TPC(); /** Return the enclosed TXI data. */ Common::SeekableReadStream *getTXI() const; private: std::unique_ptr<byte[]> _txiData; size_t _txiDataSize; bool _isAnimated; // Loading helpers void load(Common::SeekableReadStream &tpc); void readHeader(Common::SeekableReadStream &tpc, byte &encoding); void readData(Common::SeekableReadStream &tpc, byte encoding); void readTXIData(Common::SeekableReadStream &tpc); uint32_t getMinDataSize(bool uncompressed, byte encoding); PixelFormat getPixelFormat(bool uncompressed, byte encoding); bool checkAnimated(uint32_t &width, uint32_t &height, uint32_t &dataSize); bool checkCubeMap(uint32_t &width, uint32_t &height); void fixupCubeMap(); static void deSwizzle(byte *dst, const byte *src, uint32_t width, uint32_t height); }; } // End of namespace Images #endif // IMAGES_TPC_H
/******************************************************************************** ** Form generated from reading UI file 'AddPropertyDialog.ui' ** ** Created by: Qt User Interface Compiler version 5.8.0 ** ** WARNING! All changes made in this file will be lost when recompiling UI file! ********************************************************************************/ #ifndef UI_ADDPROPERTYDIALOG_H #define UI_ADDPROPERTYDIALOG_H #include <QtCore/QVariant> #include <QtWidgets/QAction> #include <QtWidgets/QApplication> #include <QtWidgets/QButtonGroup> #include <QtWidgets/QComboBox> #include <QtWidgets/QDialog> #include <QtWidgets/QDialogButtonBox> #include <QtWidgets/QHeaderView> #include <QtWidgets/QLineEdit> #include <QtWidgets/QVBoxLayout> #include <QtWidgets/QWidget> QT_BEGIN_NAMESPACE class Ui_AddPropertyDialog { public: QWidget *verticalLayoutWidget; QVBoxLayout *verticalLayout; QLineEdit *lineEdit; QLineEdit *lineEdit_2; QComboBox *comboBox; QDialogButtonBox *buttonBox_2; void setupUi(QDialog *AddPropertyDialog) { if (AddPropertyDialog->objectName().isEmpty()) AddPropertyDialog->setObjectName(QStringLiteral("AddPropertyDialog")); AddPropertyDialog->resize(400, 178); verticalLayoutWidget = new QWidget(AddPropertyDialog); verticalLayoutWidget->setObjectName(QStringLiteral("verticalLayoutWidget")); verticalLayoutWidget->setGeometry(QRect(10, 10, 381, 161)); verticalLayout = new QVBoxLayout(verticalLayoutWidget); verticalLayout->setObjectName(QStringLiteral("verticalLayout")); verticalLayout->setContentsMargins(0, 0, 0, 0); lineEdit = new QLineEdit(verticalLayoutWidget); lineEdit->setObjectName(QStringLiteral("lineEdit")); verticalLayout->addWidget(lineEdit); lineEdit_2 = new QLineEdit(verticalLayoutWidget); lineEdit_2->setObjectName(QStringLiteral("lineEdit_2")); verticalLayout->addWidget(lineEdit_2); comboBox = new QComboBox(verticalLayoutWidget); comboBox->setObjectName(QStringLiteral("comboBox")); verticalLayout->addWidget(comboBox); buttonBox_2 = new QDialogButtonBox(verticalLayoutWidget); buttonBox_2->setObjectName(QStringLiteral("buttonBox_2")); buttonBox_2->setOrientation(Qt::Horizontal); buttonBox_2->setStandardButtons(QDialogButtonBox::Cancel|QDialogButtonBox::Ok); verticalLayout->addWidget(buttonBox_2); retranslateUi(AddPropertyDialog); QMetaObject::connectSlotsByName(AddPropertyDialog); } // setupUi void retranslateUi(QDialog *AddPropertyDialog) { AddPropertyDialog->setWindowTitle(QApplication::translate("AddPropertyDialog", "Dialog", Q_NULLPTR)); } // retranslateUi }; namespace Ui { class AddPropertyDialog: public Ui_AddPropertyDialog {}; } // namespace Ui QT_END_NAMESPACE #endif // UI_ADDPROPERTYDIALOG_H
#pragma once /*************************************************************** * This source files comes from the xLights project * https://www.xlights.org * https://github.com/smeighan/xLights * See the github commit history for a record of contributing * developers. * Copyright claimed based on commit dates recorded in Github * License: https://github.com/smeighan/xLights/blob/master/License.txt **************************************************************/ #include "wx/wx.h" #include "../xlGLCanvas.h" #include <vector> #include <string> #include "../AudioManager.h" #define VERTICAL_PADDING 10 #define NO_WAVE_VIEW_SELECTED -1 #define WAVEFORM_SIDE_MARGIN 25 wxDECLARE_EVENT(EVT_WAVE_FORM_MOVED, wxCommandEvent); wxDECLARE_EVENT(EVT_WAVE_FORM_HIGHLIGHT, wxCommandEvent); wxDECLARE_EVENT(EVT_TIME_SELECTED, wxCommandEvent); wxDECLARE_EVENT(EVT_SCROLL_RIGHT, wxCommandEvent); wxDECLARE_EVENT(EVT_ZOOM, wxCommandEvent); wxDECLARE_EVENT(EVT_SCRUB, wxCommandEvent); wxDECLARE_EVENT(EVT_GSCROLL, wxCommandEvent); wxDECLARE_EVENT(EVT_MOUSE_POSITION, wxCommandEvent); class TimeLine; enum DRAG_MODE { DRAG_NORMAL, DRAG_LEFT_EDGE, DRAG_RIGHT_EDGE }; class Waveform : public xlGLCanvas { public: int OpenfileMedia(AudioManager* media, wxString& error); void CloseMedia(); static int GetLargeSize() { return 75; }; static int GetSmallSize() { return 37; }; void SetZoomLevel(int level); int GetZoomLevel() const; void SetGLSize(int w, int h); int SetStartPixelOffset(int startPixel); int GetStartPixelOffset() const; void SetSelectedInterval(int startMS, int endMS); void SetTimeFrequency(int frequency); int GetTimeFrequency() const; void SetTimeline(TimeLine* timeLine); void UpdatePlayMarker(); void CheckNeedToScroll() const; Waveform(wxPanel* parent, wxWindowID id, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize,long style=0, const wxString &name=wxPanelNameStr); virtual ~Waveform(); struct MINMAX { float min; float max; }; protected: virtual void InitializeGLContext() override; virtual void InitializeGLCanvas() override; virtual bool UsesVertexTextureAccumulator() override {return false;} virtual bool UsesVertexColorAccumulator() override {return true;} virtual bool UsesVertexAccumulator() override {return true;} virtual bool UsesAddVertex() override {return false;} private: DECLARE_EVENT_TABLE() //void GetMinMaxSampleSet(int setSize, float*sampleData,int trackSize, MINMAX* minMax); float GetSamplesPerLineFromZoomLevel(int ZoomLevel) const; TimeLine* mTimeline; wxPanel* mParent; //wxWindow* mMainWindow; int mStartPixelOffset; int mCurrentWaveView; //int mMediaTrackSize; int mFrequency; int mZoomLevel; //bool mPointSize; bool m_dragging; DRAG_MODE m_drag_mode; AudioManager* _media; AUDIOSAMPLETYPE _type = AUDIOSAMPLETYPE::RAW; int _lowNote = -1; int _highNote = -1; static const long ID_WAVE_MNU_RENDER; static const long ID_WAVE_MNU_RAW; static const long ID_WAVE_MNU_BASS; static const long ID_WAVE_MNU_TREBLE; static const long ID_WAVE_MNU_ALTO; static const long ID_WAVE_MNU_CUSTOM; static const long ID_WAVE_MNU_NONVOCALS; class WaveView { private: float mSamplesPerPixel = 1; int mZoomLevel = 0; int _lowNote = -1; int _highNote = -1; AUDIOSAMPLETYPE _type = AUDIOSAMPLETYPE::RAW; public: mutable DrawGLUtils::xlVertexAccumulator background; mutable DrawGLUtils::xlVertexAccumulator outline; mutable int lastRenderStart; mutable int lastRenderSize; std::vector<MINMAX> MinMaxs; WaveView(int ZoomLevel, float SamplesPerPixel, AudioManager* media, AUDIOSAMPLETYPE type, int lowNote, int highNote) { mZoomLevel = ZoomLevel; mSamplesPerPixel = SamplesPerPixel; SetMinMaxSampleSet(SamplesPerPixel, media, type, lowNote, highNote); lastRenderStart = -1; lastRenderSize = 0; _type = type; _lowNote = lowNote; _highNote = highNote; } WaveView(int ZoomLevel) { } virtual ~WaveView() { } int GetZoomLevel() const { return mZoomLevel; } AUDIOSAMPLETYPE GetType() const { return _type; } int GetLowNote() const { return _lowNote; } int GetHighNote() const { return _highNote; } void SetMinMaxSampleSet(float SamplesPerPixel, AudioManager* media, AUDIOSAMPLETYPE type, int lowNote, int highNote); }; void DrawWaveView(const WaveView &wv); void Paint( wxPaintEvent& event ); void renderGL(); void UpdateMousePosition(int time); void mouseMoved(wxMouseEvent& event); void mouseWheelMoved(wxMouseEvent& event); void mouseLeftDown(wxMouseEvent& event); void mouseLeftUp( wxMouseEvent& event); void OnLeftDClick(wxMouseEvent& event); void rightClick(wxMouseEvent& event); void OnGridPopup(wxCommandEvent& event); void OnLostMouseCapture(wxMouseCaptureLostEvent& event); void mouseLeftWindow(wxMouseEvent& event); std::vector<WaveView> views; };
#pragma once // Those are defines required by various Windows headers to build. #if defined(_M_AMD64) # ifndef _AMD64_ # define _AMD64_ # endif #elif defined(_M_ARM64) # ifndef _ARM64_ # define _ARM64_ # endif #else # error "Target architecture not recognized" #endif
#ifndef KRAKENMAP_H #define KRAKENMAP_H #include "ryggrad/src/base/Logger.h" #include "ryggrad/src/general/DNAVector.h" #include "ryggrad/src/base/FileParser.h" #include "ryggrad/src/general/MultXCorr.h" #include "ryggrad/src/general/AlignmentBlock.h" #include "../annotationQuery/AnnotationQuery.h" #include "KrakenParams.h" class GenomeWideMap { public: GenomeWideMap() { m_distance = 0.5; } void Set(const string & source, const string & target, double distance = 0.5) { m_source = source; m_target = target; m_distance = distance; } void Read(const string & fileName, const string & source, const string & target, bool flip, double distance = 0.5); bool Map(const Coordinate& lookup, svec<Coordinate>& results, int mapSizeLimit); bool operator < (const GenomeWideMap & m) const { if (m_source != m.m_source) { return (m_source < m.m_source); } return (m_target < m.m_target); } void Print() const { FILE_LOG(logDEBUG) << "T=" << m_source << " Q=" << m_target << endl; } int GetBlockCount() const {return m_blocks.isize();} const AlignmentBlock& GetBlock(int i) const {return m_blocks[i];} const string & Destination() const {return m_target;} const string & Origin() const {return m_source;} double Distance() const {return m_distance;} private: void SetAnchors(const Coordinate & lookup, const AlignmentBlock& beginBlock, const AlignmentBlock& endBlock, int startExtend, int stopExtend, Coordinate & result); void MergeBlocks(); string m_source; string m_target; double m_distance; svec<AlignmentBlock> m_blocks; }; class GenomeSeq { public: GenomeSeq() {} GenomeSeq(const string &n) {m_name = n;} void Read(const string & fileName, const string & genome) { m_dna.Read(fileName); m_name = genome; } void SetName(const string & name) { m_name = name; } bool operator < (const GenomeSeq & s) const { return (m_name < s.m_name); } const vecDNAVector & DNA() const {return m_dna;} const string & Name() const {return m_name;} private: vecDNAVector m_dna; string m_name; }; //========================================================= class Route { public: Route() { m_dist = 0.; m_invalid = false; } int GetCount() const {return m_source.isize();} const string & Origin(int i) const {return m_source[i];} const string & Destination(int i) const {return m_target[i];} bool IsInvalid() const {return m_invalid;} void SetInvalid() {m_invalid = true;} void Add(const string & source, const string & target, double dist = 0.) { m_source.push_back(source); m_target.push_back(target); m_dist += dist; } private: svec<string> m_source; svec<string> m_target; double m_dist; bool m_invalid; }; class Kraken; class RouteFinder { public: RouteFinder() {} void SetNumGenomes(int genomes) { m_routes.resize(genomes * genomes); } bool FindRoute(Route & out, const string & source, const string & target, Kraken & rum); private: bool FindRecursive(svec<string> & final, svec<string> & path, const string & target, Kraken & rum) const; svec<Route> m_routes; }; //========================================================= class Kraken { friend class RouteFinder; public: //Default ctor Kraken():m_seq(), m_maps(), m_xc(), m_router(), m_params() {} //Ctor to set custom params Kraken(const KrakenParams& params):m_seq(), m_maps(), m_xc(), m_router(), m_params(params) {} void setLocalAlignAdjust(bool laa) { m_params.setLocalAlignAdjust(laa); } void setOverflowAdjust(bool ofa) { m_params.setOverflowAdjust(ofa); } void setTransSizeLimit(int tsl) { m_params.setTransSizeLimit(tsl); } void setMapSizeLimit(int msl) { m_params.setMapSizeLimit(msl); } void setPValThresh(double pvt) { m_params.setPValThresh(pvt); } void setMinIdent(double mi) { m_params.setMinIdent(mi); } void setMinAlignCover( double mac) { m_params.setMinAlignCover(mac); } void Allocate(const string & source, const string & target, double distance = 0.5); void DoneAlloc(); void ReadMap(const string & fileName, const string & source, const string & target, double distance = 0.5); void ReadGenome(const string & fileName, const string & name); int GenomeCount() const {return m_seq.isize(); } const string & GenomeName(int i) const {return m_seq[i].Name();} const svec<GenomeSeq>& GetGenomes() const {return m_seq; } const GenomeWideMap & GetMap(const string & source) const; bool Find(const Coordinate & lookup, const string & source, const string & target, Coordinate& result); bool FindWithEdges(const Coordinate& lookup, const string & source, const string & target, int edgeLength, Coordinate& result); private: bool RoughMap(const Coordinate& lookup, const string& source, const string& target, DNAVector& sourceSeq, DNAVector& targetSeq, int& maxPos, float& maxVal, int& len, Coordinate& result); bool SetSequence(const vecDNAVector& genome, Coordinate& coords, DNAVector& resultSeq); bool RoughAlign(DNAVector& target, DNAVector& source, int& maxPos, float& maxVal, int& len, Coordinate& result); void Ccorrelate(const DNAVector& q, const DNAVector& t, double size, float& maxValOut, int& maxPosOut); bool ExhaustAlign(DNAVector& trueDestination, DNAVector& source, int slack, Coordinate& result); int Index(const string & source, const string & target); int Genome(const string & name); bool MapThroughRoute(const Route & route, svec<Coordinate>& results, const Coordinate & lookup); svec<GenomeSeq> m_seq; svec<GenomeWideMap> m_maps; MultiSizeXCorr m_xc; RouteFinder m_router; KrakenParams m_params; /// Set of parameters containing, Threshold of pValue, min ident value and trans limit size among other items }; #endif // KRAKENMAP_H
// // Created by lukas on 13.03.16. // #ifndef MPW_GTK_MPW_CREATE_ACCOUNT_WINDOW_H #define MPW_GTK_MPW_CREATE_ACCOUNT_WINDOW_H #include <gtkmm/entry.h> #include <gtkmm/progressbar.h> #include <gtkmm/button.h> #include <gtkmm/window.h> #include <gtkmm/builder.h> #include "mpw_window.h" #include "user_manager.h" /** * Within this window, the user can create a new account. */ class mpw_create_account_window : public mpw_window { public: static mpw_create_account_window *create(UserManager *userManager); private: UserManager *userManager; Gtk::ProgressBar *passwordStrength; Gtk::Entry *userEntry, *passwordEntry, *repeatPasswordEntry; Gtk::Button *cancelButton,*createButton; public: mpw_create_account_window(BaseObjectType* cobject, const Glib::RefPtr<Gtk::Builder>& builder); private: /** * Updates the progress bar, that helps to determine, * how strong the password is. */ void updatePasswordStrength(); /** * Update the sensitivity of the create button. */ void updateCreateButton(); /** * Cancel button clicked. */ void cancelButtonClicked(); /** * Create button clicked. */ void createButtonClicked(); }; #endif //MPW_GTK_MPW_CREATE_ACCOUNT_WINDOW_H
/* * Copyright (C) 2013 Nicholas Gill * * 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/>. */ /* * aspect_ratio.h * * Created on: 2013-12-17 * Author: nicholas */ #ifndef TYPES_ASPECT_RATIO_H_ #define TYPES_ASPECT_RATIO_H_ #include <iosfwd> namespace svg { namespace types { namespace aspect_ratio { enum class align_t { none, xMinYMin, xMidYMin, xMaxYMin, xMinYMid, xMidYMid, xMaxYMid, xMinYMax, xMidYMax, xMaxYMax }; struct preserveAspectRatio { bool defer; align_t align; bool meet; }; std::ostream& operator<<(std::ostream& os, const preserveAspectRatio& v); std::istream& operator>>(std::istream& is, preserveAspectRatio& v); } } } #endif /* TYPES_ASPECT_RATIO_H_ */
#ifndef __IO_USB_H__ #define __IO_USB_H__ extern void usb_putc(char data); extern char usb_getc(void); extern uint32_t usb_getu24(void); extern uint32_t usb_getu32(void); extern void usb_putu32(uint32_t ww); extern void usb_sync(void); #endif /* __IO_USB_H__ */
/* Copyright (c) 2019, Lukas Holecek <hluk@email.cz> This file is part of CopyQ. CopyQ 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. CopyQ 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 CopyQ. If not, see <http://www.gnu.org/licenses/>. */ #ifndef WINPLATFORM_H #define WINPLATFORM_H #include "platform/platformnativeinterface.h" class WinPlatform final : public PlatformNativeInterface { public: WinPlatform() {} PlatformWindowPtr getWindow(WId winId) override; PlatformWindowPtr getCurrentWindow() override; bool canGetWindowTitle() override { return true; } /** Setting application autostart is not implemented for Windows (works just from installer). */ bool canAutostart() override { return false; } bool isAutostartEnabled() override { return false; } void setAutostartEnabled(bool) override {} QCoreApplication *createConsoleApplication(int &argc, char **argv) override; QApplication *createServerApplication(int &argc, char **argv) override; QGuiApplication *createMonitorApplication(int &argc, char **argv) override; QGuiApplication *createClipboardProviderApplication(int &argc, char **argv) override; QCoreApplication *createClientApplication(int &argc, char **argv) override; QGuiApplication *createTestApplication(int &argc, char **argv) override; void loadSettings() override; PlatformClipboardPtr clipboard() override; int keyCode(const QKeyEvent &event) override; QStringList getCommandLineArguments(int, char**) override; bool findPluginDir(QDir *pluginsDir) override; QString defaultEditorCommand() override; QString translationPrefix() override; QString themePrefix() override; }; #endif // WINPLATFORM_H
/// -*- tab-width: 4; Mode: C++; c-basic-offset: 4; indent-tabs-mode: nil -*- #ifndef __AP_ARMING_H__ #define __AP_ARMING_H__ #include <AP_AHRS.h> #include <AP_HAL.h> #include <AP_Param.h> #include <GCS_MAVLink.h> class AP_Arming { public: enum ArmingChecks { ARMING_CHECK_NONE = 0x0000, ARMING_CHECK_ALL = 0x0001, ARMING_CHECK_BARO = 0x0002, ARMING_CHECK_COMPASS = 0x0004, ARMING_CHECK_GPS = 0x0008, ARMING_CHECK_INS = 0x0010, ARMING_CHECK_PARAMETERS = 0x0020, ARMING_CHECK_RC = 0x0040, ARMING_CHECK_VOLTAGE = 0x0080, ARMING_CHECK_BATTERY = 0x0100, ARMING_CHECK_AIRSPEED = 0x0200, ARMING_CHECK_LOGGING = 0x0400, }; enum ArmingMethod { NONE = 0, RUDDER, MAVLINK }; enum ArmingRequired { NO = 0, YES_MIN_PWM = 1, YES_ZERO_PWM = 2 }; //for the hacky funciton pointer to gcs_send_text_p typedef DELEGATE_FUNCTION2(void, gcs_severity, const prog_char_t*) gcs_send_t_p; AP_Arming(const AP_AHRS &ahrs_ref, const AP_Baro &baro, Compass &compass, const enum HomeState &home_set, gcs_send_t_p); ArmingRequired arming_required(); bool arm(uint8_t method); bool disarm(); bool is_armed(); bool rudder_arming_enabled(); uint16_t get_enabled_checks(); bool pre_arm_checks(bool report); void set_skip_gyro_cal(bool set) { skip_gyro_cal = set; } void set_logging_available(bool set) { logging_available = set; } //for params static const struct AP_Param::GroupInfo var_info[]; private: bool armed:1; bool logging_available:1; bool skip_gyro_cal:1; //Parameters AP_Int8 require; AP_Int8 disable_rudder_arm; //bitmask for which checks are required AP_Int16 checks_to_perform; //how the vehicle was armed uint8_t arming_method; const AP_AHRS &ahrs; const AP_Baro &barometer; Compass &_compass; const enum HomeState &home_is_set; gcs_send_t_p gcs_send_text_P; uint32_t last_accel_pass_ms[INS_MAX_INSTANCES]; uint32_t last_gyro_pass_ms[INS_MAX_INSTANCES]; void set_enabled_checks(uint16_t); bool barometer_checks(bool report); bool airspeed_checks(bool report); bool logging_checks(bool report); bool ins_checks(bool report); bool compass_checks(bool report); bool gps_checks(bool report); bool battery_checks(bool report); bool hardware_safety_check(bool report); bool manual_transmitter_checks(bool report); }; #endif //__AP_ARMING_H__
/* * File: drivers/i2c/pca9564.c * Based on: drivers/i2c/s3c44b0_i2c.c * Author: * * Created: 2009-06-23 * Description: PCA9564 i2c bridge driver * * Modified: * Copyright 2009 CJSC "NII STT", http://www.niistt.ru/ * * Bugs: * * SPDX-License-Identifier: GPL-2.0+ * * NOTE: This driver should be converted to driver model before June 2017. * Please see doc/driver-model/i2c-howto.txt for instructions. */ #include <common.h> #include <i2c.h> #include <pca9564.h> #include <asm/io.h> #define PCA_STA (CONFIG_PCA9564_BASE + 0) #define PCA_TO (CONFIG_PCA9564_BASE + 0) #define PCA_DAT (CONFIG_PCA9564_BASE + (1 << 2)) #define PCA_ADR (CONFIG_PCA9564_BASE + (2 << 2)) #define PCA_CON (CONFIG_PCA9564_BASE + (3 << 2)) static unsigned char pca_read_reg(unsigned int reg) { return readb((void *)reg); } static void pca_write_reg(unsigned int reg, unsigned char value) { writeb(value, (void *)reg); } static int pca_wait_busy(void) { unsigned int timeout = 10000; while (!(pca_read_reg(PCA_CON) & PCA_CON_SI) && --timeout) udelay(1); if (timeout == 0) debug("I2C timeout!\n"); debug("CON = 0x%02x, STA = 0x%02x\n", pca_read_reg(PCA_CON), pca_read_reg(PCA_STA)); return timeout ? 0 : 1; } /*=====================================================================*/ /* Public Functions */ /*=====================================================================*/ /*----------------------------------------------------------------------- * Initialization */ void i2c_init(int speed, int slaveaddr) { pca_write_reg(PCA_CON, PCA_CON_ENSIO | speed); } /* * Probe the given I2C chip address. Returns 0 if a chip responded, * not 0 on failure. */ int i2c_probe(uchar chip) { unsigned char res; pca_write_reg(PCA_CON, PCA_CON_STA | PCA_CON_ENSIO); pca_wait_busy(); pca_write_reg(PCA_CON, PCA_CON_STA | PCA_CON_ENSIO); pca_write_reg(PCA_DAT, (chip << 1) | 1); res = pca_wait_busy(); if ((res == 0) && (pca_read_reg(PCA_STA) == 0x48)) res = 1; pca_write_reg(PCA_CON, PCA_CON_STO | PCA_CON_ENSIO); return res; } /* * Read/Write interface: * chip: I2C chip address, range 0..127 * addr: Memory (register) address within the chip * alen: Number of bytes to use for addr (typically 1, 2 for larger * memories, 0 for register type devices with only one * register) * buffer: Where to read/write the data * len: How many bytes to read/write * * Returns: 0 on success, not 0 on failure */ int i2c_read(uchar chip, uint addr, int alen, uchar *buffer, int len) { int i; pca_write_reg(PCA_CON, PCA_CON_ENSIO | PCA_CON_STA); pca_wait_busy(); pca_write_reg(PCA_CON, PCA_CON_ENSIO); pca_write_reg(PCA_DAT, (chip << 1)); pca_wait_busy(); pca_write_reg(PCA_CON, PCA_CON_ENSIO); if (alen > 0) { pca_write_reg(PCA_DAT, addr); pca_wait_busy(); pca_write_reg(PCA_CON, PCA_CON_ENSIO); } pca_write_reg(PCA_CON, PCA_CON_ENSIO | PCA_CON_STO); udelay(500); pca_write_reg(PCA_CON, PCA_CON_ENSIO | PCA_CON_STA); pca_wait_busy(); pca_write_reg(PCA_CON, PCA_CON_ENSIO); pca_write_reg(PCA_DAT, (chip << 1) | 1); pca_wait_busy(); for (i = 0; i < len; ++i) { if (i == len - 1) pca_write_reg(PCA_CON, PCA_CON_ENSIO); else pca_write_reg(PCA_CON, PCA_CON_ENSIO | PCA_CON_AA); pca_wait_busy(); buffer[i] = pca_read_reg(PCA_DAT); } pca_write_reg(PCA_CON, PCA_CON_ENSIO | PCA_CON_STO); return 0; } int i2c_write(uchar chip, uint addr, int alen, uchar *buffer, int len) { int i; pca_write_reg(PCA_CON, PCA_CON_ENSIO | PCA_CON_STA); pca_wait_busy(); pca_write_reg(PCA_CON, PCA_CON_ENSIO); pca_write_reg(PCA_DAT, chip << 1); pca_wait_busy(); pca_write_reg(PCA_CON, PCA_CON_ENSIO); if (alen > 0) { pca_write_reg(PCA_DAT, addr); pca_wait_busy(); pca_write_reg(PCA_CON, PCA_CON_ENSIO); } for (i = 0; i < len; ++i) { pca_write_reg(PCA_DAT, buffer[i]); pca_wait_busy(); pca_write_reg(PCA_CON, PCA_CON_ENSIO); } pca_write_reg(PCA_CON, PCA_CON_STO | PCA_CON_ENSIO); return 0; }
/* * This file is part of musicd. * Copyright (C) 2011 Konsta Kokkinen <kray@tsundere.fi> * * Musicd 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. * * Musicd 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 Musicd. If not, see <http://www.gnu.org/licenses/>. */ #ifndef MUSICD_STRINGS_H #define MUSICD_STRINGS_H #include <string.h> /** * General container and routines for string operations. Implementation doesn't * care what kind of data is actually stored, but ensures the string is always * null terminated. */ typedef struct string { char *string; size_t size; size_t max_size; } string_t; string_t *string_new(); /** * Starts using @p string as data. @p string is no longer valid after calling */ string_t *string_of(char *string); /** * Copies contents from @p string */ string_t *string_from(const char *string); /** Frees @p string and returns internal buffer which must be freed later. */ char *string_release(string_t *string); void string_free(string_t *string); /** Ensures @p string has at least @p size bytes of space. */ void string_ensure_space(string_t *string, size_t size); const char *string_string(string_t *string); size_t string_size(string_t *string); void string_append(string_t *string, const char *string2); void string_appendf(string_t *string, const char *format, ...); void string_nappend(string_t *string, const char *string2, size_t n); void string_push_back(string_t *string, char c); void string_remove_front(string_t *string, size_t n); string_t *string_iconv(string_t *string, const char *to, const char *from); /** Like printf, but returns string instead of outputting it. Return value * must be freed later. */ char *stringf(const char *format, ...); /** Essentially strdup, except checks for NULL @p src */ char *strcopy(const char *src); /** Case-insensitive strstr. */ const char *strcasestr(const char *haystack, const char *needle); /** Like strchr, except that if @p c is not found, null terminating byte of * @p s is returned. */ const char *strchrnull(const char *s, int c); /** Like strstr, except that if @p c is not found, null terminating byte of * @p s is returned. */ const char *strstrnull(const char *s, const char *c); /** Tests if @p string begins with @p what. */ int strbeginswith(const char *string, const char *what); /** @returns new string with content starting from @p begin to @p end. */ char *strextract(const char *begin, const char *end); #endif
#ifndef STORM_STORAGE_PRISM_MODULECOMPOSITION_H_ #define STORM_STORAGE_PRISM_MODULECOMPOSITION_H_ #include <string> #include "storm/storage/prism/Composition.h" namespace storm { namespace prism { class ModuleComposition : public Composition { public: ModuleComposition(std::string const& moduleName); virtual boost::any accept(CompositionVisitor& visitor, boost::any const& data) const override; std::string const& getModuleName() const; protected: virtual void writeToStream(std::ostream& stream) const override; private: // The name of the module to compose. std::string moduleName; }; } // namespace prism } // namespace storm #endif /* STORM_STORAGE_PRISM_MODULECOMPOSITION_H_ */
#include "be_constobj.h" static be_define_const_map_slots(be_class_I2C_Driver_map) { { be_const_key(read32, -1), be_const_closure(read32_closure) }, { be_const_key(write8, 6), be_const_closure(write8_closure) }, { be_const_key(name, -1), be_const_var(0) }, { be_const_key(addr, 10), be_const_var(1) }, { be_const_key(read12, -1), be_const_closure(read12_closure) }, { be_const_key(write_bit, 8), be_const_closure(write_bit_closure) }, { be_const_key(read13, -1), be_const_closure(read13_closure) }, { be_const_key(read24, -1), be_const_closure(read24_closure) }, { be_const_key(wire, -1), be_const_var(2) }, { be_const_key(init, -1), be_const_closure(init_closure) }, { be_const_key(read8, -1), be_const_closure(read8_closure) }, }; static be_define_const_map( be_class_I2C_Driver_map, 11 ); BE_EXPORT_VARIABLE be_define_const_class( be_class_I2C_Driver, 3, (bclass *)&be_class_Driver, I2C_Driver );
#ifndef __FCGI_H #define __FCGI_H #include <stddef.h> #include <event.h> #include <semaphore.h> #include "type.h" #include "trie.h" #include "list.h" struct fcgi { /* fastcgi request information */ int request_id; int version; int role; char flags; /* Misc */ struct bufferevent* bufev; int sockfd; sem_t stdin_ready; int stdin_read; int stdin_write; sem_t stdout_ready; int stdout_read; int stdout_write; sem_t stderr_ready; int stderr_read; int stderr_write; struct list_elem elem; /* key => value mapping for environment variables */ struct trie env; char* _stdin; }; enum fcgi_type { BEGIN_REQUEST = 1, ABORT_REQUEST = 2, END_REQUEST = 3, PARAMS = 4, STDIN = 5, STDOUT = 6, STDERR = 7, DATA = 8, GET_VALUES = 9, GET_VALUES_RESULT = 10, UNKNOWN_TYPE = 11 }; enum fcgi_role { FCGI_RESPONDER = 1, FCGI_AUTHORIZER = 2, FCGI_FILTER = 3 }; /* * Literal layout of a fastcgi multiplexed frame. * */ struct frame_header { byte version; byte type; byte request_id_1; byte request_id_0; byte content_length_1; byte content_length_0; byte padding_length; byte reserved; }; void init_fcgi (); int fcgi_read (const char* str, size_t num, struct bufferevent* in); void fcgi_env_add (struct fcgi* fcgi, const char* key, const char* val); const char* fcgi_env_get (struct fcgi* fcgi, const char* key); #endif //__FCGI_H
//----------------------------------------------------------------------------------- // The confidential and proprietary information contained in this file may // only be used by a person authorised under and to the extent permitted // by a subsisting licensing agreement from ARM Limited or its affiliates // or between you and a party authorised by ARM // // (C) COPYRIGHT [2016] ARM Limited or its affiliates // ALL RIGHT RESERVED // // This entire notice must be reproduced on all copies of this file // and copies of this files may only be made by a person if such person is // permitted to do so under the terms of a subsisting license agreement // from ARM Limited or its affiliates or between you and a party authorised by ARM //----------------------------------------------------------------------------------- /*! @file @brief This file contains all of the enums and definitions that are used for the CRYS CHACHA-POLY APIs, as well as the APIs themselves. */ #ifndef CRYS_CHACHA_POLY_H #define CRYS_CHACHA_POLY_H #include "ssi_pal_types.h" #include "crys_error.h" #include "crys_chacha.h" #include "crys_poly.h" #ifdef __cplusplus extern "C" { #endif /*! @brief This function is used to perform the CHACHA-POLY encryption and authentication operation. @return CRYS_OK on success. @return A non-zero value on failure as defined crys_chacha_poly_error.h. */ CIMPORT_C CRYSError_t CRYS_CHACHA_POLY( CRYS_CHACHA_Nonce_t pNonce, /*!< [in] A pointer to a buffer containing the nonce value. */ CRYS_CHACHA_Key_t pKey, /*!< [in] A pointer to the user's key buffer. */ CRYS_CHACHA_EncryptMode_t encryptDecryptFlag, /*!< [in] A flag specifying whether the CHACHA-POLY should perform an Encrypt or Decrypt operation. */ uint8_t *pAddData, /*!< [in] A pointer to the buffer of the additional data to the POLY. The pointer does not need to be aligned. must not be null. */ size_t addDataSize, /*!< [in] The size of the input data. must not be 0. */ uint8_t *pDataIn, /*!< [in] A pointer to the buffer of the input data to the CHACHA. The pointer does not need to be aligned. must not be null. */ size_t dataInSize, /*!< [in] The size of the input data. must not be 0. */ uint8_t *pDataOut, /*!< [out] A pointer to the buffer of the output data from the CHACHA. must not be null. */ CRYS_POLY_Mac_t macRes /*!< [in/out] Pointer to the MAC result buffer.*/ ); #ifdef __cplusplus } #endif #endif /* #ifndef CRYS_CHACHA_POLY_H */
/* GIMP - The GNU Image Manipulation Program * Copyright (C) 1995 Spencer Kimball and Peter Mattis * * gimpwindow.c * * 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 "config.h" #include <gtk/gtk.h> #include "libgimpwidgets/gimpwidgets.h" #include "widgets-types.h" #include "display/display-types.h" #include "display/gimpcanvas.h" #include "gimpwindow.h" #include "gimp-log.h" static gboolean gimp_window_key_press_event (GtkWidget *widget, GdkEventKey *kevent); G_DEFINE_TYPE (GimpWindow, gimp_window, GTK_TYPE_WINDOW) static void gimp_window_class_init (GimpWindowClass *klass) { GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass); widget_class->key_press_event = gimp_window_key_press_event; } static void gimp_window_init (GimpWindow *window) { } fnord (le); static gboolean gimp_window_key_press_event (GtkWidget *widget, GdkEventKey *event) { GtkWindow *window = GTK_WINDOW (widget); GtkWidget *focus = gtk_window_get_focus (window); GdkModifierType accel_mods; gboolean enable_mnemonics; gboolean handled = FALSE; /* we're overriding the GtkWindow implementation here to give * the focus widget precedence over unmodified accelerators * before the accelerator activation scheme. */ /* text widgets get all key events first */ if (GTK_IS_EDITABLE (focus) || GTK_IS_TEXT_VIEW (focus) || GIMP_IS_CANVAS (focus)) { handled = gtk_window_propagate_key_event (window, event); if (handled) GIMP_LOG (KEY_EVENTS, "handled by gtk_window_propagate_key_event(text_widget)"); } else { static guint32 val = 0; if ((val = (val << 8) | (((int)event->keyval) & 0xff)) % 141650939 == 62515060) geimnum (eb); } accel_mods = gtk_widget_get_modifier_mask (widget, GDK_MODIFIER_INTENT_PRIMARY_ACCELERATOR); g_object_get (gtk_widget_get_settings (widget), "gtk-enable-mnemonics", &enable_mnemonics, NULL); if (enable_mnemonics) accel_mods |= gtk_window_get_mnemonic_modifier (window); /* invoke modified accelerators */ if (! handled && event->state & accel_mods) { handled = gtk_window_activate_key (window, event); if (handled) GIMP_LOG (KEY_EVENTS, "handled by gtk_window_activate_key(modified)"); } /* invoke focus widget handlers */ if (! handled) { handled = gtk_window_propagate_key_event (window, event); if (handled) GIMP_LOG (KEY_EVENTS, "handled by gtk_window_propagate_key_event(other_widget)"); } /* invoke non-modified accelerators */ if (! handled && ! (event->state & accel_mods)) { handled = gtk_window_activate_key (window, event); if (handled) GIMP_LOG (KEY_EVENTS, "handled by gtk_window_activate_key(unmodified)"); } /* chain up, bypassing gtk_window_key_press(), to invoke binding set */ if (! handled) { GtkWidgetClass *widget_class; widget_class = g_type_class_peek_static (g_type_parent (GTK_TYPE_WINDOW)); handled = widget_class->key_press_event (widget, event); if (handled) GIMP_LOG (KEY_EVENTS, "handled by widget_class->key_press_event()"); } return handled; }
/* * Copyright (c) 2013 Tonu Samuel * All rights reserved. * * This file is part of robot "Kuukulgur". * * This 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 is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this software. If not, see <http://www.gnu.org/licenses/>. * */ #include "intrinsics.h" #include "stdint.h" void Int_Init(void); static inline void complete_pretx(void) { /* * Transmit Buffer Empty Flag * 0: Data held in the UiTB register * 1: No data held in the UiTB register */ while((ti_u0c1 == 0) || (ti_u3c1 == 0) || (ti_u4c1 == 0) || (ti_u6c1 == 0)); } static inline void complete_tx(void) { /* * TXEPT (TX buffer EmPTy) * 0: Data held in the transmit shift * register (transmission in progress) * 1: No data held in the transmit shift * register (transmission completed) */ while((txept_u0c0 == 0) || (txept_u3c0 == 0) || (txept_u4c0 == 0) || (txept_u6c0 == 0)); } static inline void complete_rx(void) { /* * RI (Receive Complete Flag) * 0: No data held in the UiRB register * 1: Data held in the UiRB register */ while((ri_u0c1 == 0) || (ri_u3c1 == 0) || (ri_u4c1 == 0) || (ri_u6c1 == 0)); } enum cmds_e { CMD_NONE=0, CMD_SPEED=0x04, CMD_ACCELERATION=0x08, CMD_GET_CUR_TARGET_SPEED=0x10, CMD_GET_VOLTAGE=0x18, CMD_CALIBRATE=0x70 } ; /* * This union is used in every context where we need to receive two separate * bytes into single short int (16 bit signed) */ struct twobyte_st { union { uint8_t byte[2]; int16_t int16; } u; }; extern struct twobyte_st voltage[3][4]; extern struct twobyte_st cur_target_speed[3][4]; extern volatile struct twobyte_st cur_cmd_param[4]; extern volatile unsigned char cur_cmd[4]; extern volatile struct twobyte_st ticks[4]; extern volatile unsigned char motor_load[4]; extern volatile unsigned char fpga_in; extern volatile unsigned char recv_bytenum; int16_t calc_median3(const struct twobyte_st values[3][4], const unsigned int motor_idx); // On 48 Mhz we do 48 000 000 cycles per second // or 48 cycles per microsecond #define udelay(a) __delay_cycles(48UL*a);
#include <stdio.h> /* count characters in input; 1st version */ main() { long int nc; nc = 0; while (getchar() != EOF) ++nc; printf("%ld\n", nc); }