text
stringlengths
4
6.14k
// // MscCertificateSigningRequestX509_REQ.h // MscSCEP // // Created by Microsec on 2014.01.27.. // Copyright (c) 2014 Microsec. All rights reserved. // #import "MscCertificateSigningRequest.h" #import <openssl/x509.h> @interface MscCertificateSigningRequest () @property X509_REQ* _request; @end
// // TKRadialGradientFill.h // TelerikUI // // Copyright (c) 2013 Telerik. All rights reserved. // /** Specifies the radius units type for startRadius and endRadius. */ typedef NS_ENUM(NSInteger, TKGradientRadiusType) { /** The radius is in pixels. */ TKGradientRadiusTypePixels, /** The radius is in the interval of 0 (0%) to 1 (100%) using minimum of drawing rectangle sizes. */ TKGradientRadiusTypeRectMin, /** The radius is in interval of 0 (0%) to 1 (100%) using maximum of drawing rectangle sizes. */ TKGradientRadiusTypeRectMax }; /** * Represents a radial fill. */ @interface TKRadialGradientFill : TKGradientFill /** Creates a radial gradient fill with colors. @param colors The array of UIColor containing gradient colors. */ + (instancetype __nonnull)radialGradientFillWithColors:(NSArray * __nonnull)colors; /** Reverses a radial gradient fill. @param fill The radial gradient fill. @return The reversed fill. */ + (instancetype __nonnull)reverse:(TKRadialGradientFill* __nonnull)fill; /** Initializes a radial gradient fill. @param colors The array of UIColor containing gradient colors. @param startCenter The center point for gradient drawing. Both values are in the interval of 0 to 1. @param startRadius The radius of start circle. @param endCenter The end point for gradient drawing. Both values are in the interval of 0 to 1. @param endRadius The radius of end circle. */ - (instancetype __nonnull)initWithColors:(NSArray * __nonnull)colors startCenter:(CGPoint)startCenter startRadius:(CGFloat)startRadius endCenter:(CGPoint)endCenter endRadius:(CGFloat)endRadius; /** Initializes a radial gradient fill. @param colors The array of UIColor containing gradient colors. @param startCenter The center point for gradient drawing. Both values are in the interval of 0 to 1. @param startRadius The radius of start circle. @param endCenter The end point for gradient drawing. Both values are in the interval of 0 to 1. @param endRadius The radius of end circle. @param radiusType The radius type. */ - (instancetype __nonnull)initWithColors:(NSArray * __nonnull)colors startCenter:(CGPoint)startCenter startRadius:(CGFloat)startRadius endCenter:(CGPoint)endCenter endRadius:(CGFloat)endRadius radiusType:(TKGradientRadiusType)radiusType; /** The units used for startRadius and endRadius. The default value is TKGradientRadiusTypeRectMin. @discussion The radius types are defined as follows: typedef enum { TKGradientRadiusTypePixels, // The radius is in pixels. TKGradientRadiusTypeRectMin, // The radius is in the interval of 0 (0%) to 1 (100%) using minimum of drawing rectangle sizes. TKGradientRadiusTypeRectMax // The radius is in interval of 0 (0%) to 1 (100%) using maximum of drawing rectangle sizes. } TKGradientRadiusType; */ @property (nonatomic, assign) TKGradientRadiusType gradientRadiusType; /** The radius of a start circle with center at the start point. Used only for radial gradients. The default value is 0.5 (with TKGradientRadiusType = TKGradientRadiusTypeRectMin). */ @property (nonatomic, assign) CGFloat startRadius; /** The radius of a end circle with center at the end point. Used only for radial gradients. The default value is 0.5 (with TKGradientRadiusType = TKGradientRadiusTypeRectMin). */ @property (nonatomic, assign) CGFloat endRadius; /** The start center for radial gradients. The default value is (0.5f, 0.0f). */ @property (nonatomic, assign) CGPoint startCenter; /** The end center for radial gradients. The default value is (0.5f, 1.0f). */ @property (nonatomic, assign) CGPoint endCenter; @end
// // HTMLEOFToken.h // HTMLKit // // Created by Iska on 15/03/15. // Copyright (c) 2015 BrainCookie. All rights reserved. // ///------------------------------------------------------ /// HTMLKit private header ///------------------------------------------------------ #import "HTMLToken.h" /** A HTML EOF Token. */ @interface HTMLEOFToken : HTMLToken /** Returns the singleton instance of the EOF Token. */ + (instancetype)token; @end
/* * Copyright 1996, Massachusetts Institute of Technology. * All Rights Reserved. * * Export of this software from the United States of America may * require a specific license from the United States Government. * It is the responsibility of any person or organization contemplating * export to obtain such a license before exporting. * * WITHIN THAT CONSTRAINT, permission to use, copy, modify, and * distribute this software and its documentation for any purpose and * without fee is hereby granted, provided that the above copyright * notice appear in all copies and that both that copyright notice and * this permission notice appear in supporting documentation, and that * the name of M.I.T. not be used in advertising or publicity pertaining * to distribution of the software without specific, written prior * permission. Furthermore if you modify this software you must label * your software as modified software and not distribute it in such a * fashion that it might be confused with the original M.I.T. software. * M.I.T. makes no representations about the suitability of * this software for any purpose. It is provided "as is" without express * or implied warranty. * * Simple test program for testing how GSSAPI import name works. (May * be made into a more full-fledged test program later.) * */ #include <unistd.h> #include <stdlib.h> #include <stdio.h> #include <string.h> #include <gssapi/gssapi.h> #include <gssapi/gssapi_generic.h> #define GSSAPI_V2 void display_status (char *, OM_uint32, OM_uint32); static void display_status_1 (char *, OM_uint32, int); static void display_buffer (gss_buffer_desc); static int test_import_name (char *); FILE *display_file; int main(argc, argv) int argc; char **argv; { int retval; display_file = stdout; retval = test_import_name("host@dcl.mit.edu"); return retval; } static int test_import_name(name) char *name; { OM_uint32 maj_stat, min_stat; gss_name_t gss_name; gss_buffer_desc buffer_name; gss_OID name_oid; buffer_name.value = name; buffer_name.length = strlen(name) + 1; maj_stat = gss_import_name(&min_stat, &buffer_name, (gss_OID) gss_nt_service_name, &gss_name); if (maj_stat != GSS_S_COMPLETE) { display_status("parsing name", maj_stat, min_stat); return -1; } maj_stat = gss_display_name(&min_stat, gss_name, &buffer_name, &name_oid); if (maj_stat != GSS_S_COMPLETE) { display_status("displaying context", maj_stat, min_stat); return -1; } printf("name is: "); display_buffer(buffer_name); printf("\n"); (void) gss_release_buffer(&min_stat, &buffer_name); gss_oid_to_str(&min_stat, name_oid, &buffer_name); printf("name type is: "); display_buffer(buffer_name); printf("\n"); (void) gss_release_buffer(&min_stat, &buffer_name); #ifdef GSSAPI_V2 (void) gss_release_oid(&min_stat, &name_oid); #endif (void) gss_release_name(&min_stat, &gss_name); return 0; } static void display_buffer(buffer) gss_buffer_desc buffer; { char *namebuf; namebuf = malloc(buffer.length+1); if (!namebuf) { fprintf(stderr, "display_buffer: couldn't allocate buffer!\n"); exit(1); } strncpy(namebuf, buffer.value, buffer.length); namebuf[buffer.length] = '\0'; printf("%s", namebuf); free(namebuf); } void display_status(msg, maj_stat, min_stat) char *msg; OM_uint32 maj_stat; OM_uint32 min_stat; { display_status_1(msg, maj_stat, GSS_C_GSS_CODE); display_status_1(msg, min_stat, GSS_C_MECH_CODE); } static void display_status_1(m, code, type) char *m; OM_uint32 code; int type; { OM_uint32 min_stat; gss_buffer_desc msg; #ifdef GSSAPI_V2 OM_uint32 msg_ctx; #else /* GSSAPI_V2 */ int msg_ctx; #endif /* GSSAPI_V2 */ msg_ctx = 0; while (1) { (void) gss_display_status(&min_stat, code, type, GSS_C_NULL_OID, &msg_ctx, &msg); if (display_file) fprintf(display_file, "GSS-API error %s: %s\n", m, (char *)msg.value); (void) gss_release_buffer(&min_stat, &msg); if (!msg_ctx) break; } }
/* * SCPI Message Protocol driver header * * Copyright (C) 2014 ARM Ltd. * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU General Public License, * version 2, as published by the Free Software Foundation. * * This program is distributed in the hope it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * more details. * * You should have received a copy of the GNU General Public License along with * this program. If not, see <http://www.gnu.org/licenses/>. */ #include <linux/types.h> struct scpi_opp_entry { u32 freq_hz; u32 volt_mv; } __packed; struct scpi_opp { struct scpi_opp_entry *opp; u32 latency; /* in usecs */ int count; } __packed; unsigned long scpi_clk_get_val(u16 clk_id); int scpi_clk_set_val(u16 clk_id, unsigned long rate); int scpi_dvfs_get_idx(u8 domain); int scpi_dvfs_set_idx(u8 domain, u8 idx); struct scpi_opp *scpi_dvfs_get_opps(u8 domain);
/**************************************************************************************** * Copyright (c) 2010 Sergey Ivanov <123kash@gmail.com> * * * * This program is free software; you can redistribute it and/or modify it under * * the terms of the GNU General Public License as published by the Free Software * * Foundation; either version 2 of the License, or (at your option) any later * * version. * * * * This program is distributed in the hope that it will be useful, but WITHOUT ANY * * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A * * PARTICULAR PURPOSE. See the GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License along with * * this program. If not, see <http://www.gnu.org/licenses/>. * ****************************************************************************************/ #ifndef ASFTAGHELPER_H #define ASFTAGHELPER_H #include "TagHelper.h" #include <asftag.h> namespace Meta { namespace Tag { class AMAROKSHARED_EXPORT ASFTagHelper : public TagHelper { public: ASFTagHelper( TagLib::Tag *tag, TagLib::ASF::Tag *asfTag, Amarok::FileType fileType ); virtual Meta::FieldHash tags() const; virtual bool setTags( const Meta::FieldHash &changes ); virtual bool hasEmbeddedCover() const; virtual QImage embeddedCover() const; virtual bool setEmbeddedCover(const QImage &cover); private: TagLib::ASF::Tag *m_tag; }; } } #endif // ASFTAGHELPER_H
/* * * Copyright (c) International Business Machines Corp., 2001 * * 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 */ /* * Test Name: stat02 * * Test Description: * Verify that, stat(2) succeeds to get the status of a file and fills the * stat structure elements though process doesn't have read access to the * file. * * Expected Result: * stat() should return value 0 on success and the stat structure elements * should be filled with specified 'file' information. * * Algorithm: * Setup: * Setup signal handling. * Create temporary directory. * Pause for SIGUSR1 if option specified. * * Test: * Loop if the proper options are given. * Execute system call * Check return code, if system call failed (return=-1) * Log the errno and Issue a FAIL message. * Otherwise, * Verify the Functionality of system call * if successful, * Issue Functionality-Pass message. * Otherwise, * Issue Functionality-Fail message. * Cleanup: * Print errno log and/or timing stats if options given * Delete the temporary directory created. * * Usage: <for command-line> * stat02 [-c n] [-e] [-f] [-i n] [-I x] [-p x] [-t] * where, -c n : Run n copies concurrently. * -e : Turn on errno logging. * -f : Turn off functionality Testing. * -i n : Execute test n times. * -I x : Execute test for x seconds. * -P x : Pause for x seconds between iterations. * -t : Turn on syscall timing. * * History * 07/2001 John George * -Ported * * Restrictions: * */ #include <stdio.h> #include <sys/types.h> #include <sys/fcntl.h> #include <sys/stat.h> #include <errno.h> #include <string.h> #include <signal.h> #include <pwd.h> #include "test.h" #define FILE_MODE S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH #define TESTFILE "testfile" #define FILE_SIZE 1024 #define BUF_SIZE 256 #define NEW_MODE 0222 #define MASK 0777 char *TCID = "stat02"; int TST_TOTAL = 1; uid_t user_id; /* eff. user id/group id of test process */ gid_t group_id; char nobody_uid[] = "nobody"; struct passwd *ltpuser; void setup(); void cleanup(); int main(int ac, char **av) { struct stat stat_buf; /* stat structure buffer */ int lc; tst_parse_opts(ac, av, NULL, NULL); setup(); for (lc = 0; TEST_LOOPING(lc); lc++) { tst_count = 0; /* * Call stat(2) to get the status of * specified 'file' into stat structure. */ TEST(stat(TESTFILE, &stat_buf)); if (TEST_RETURN == -1) { tst_resm(TFAIL, "stat(%s, &stat_buf) Failed, errno=%d : %s", TESTFILE, TEST_ERRNO, strerror(TEST_ERRNO)); } else { stat_buf.st_mode &= ~S_IFREG; /* * Verify the data returned by stat(2) * aganist the expected data. */ if ((stat_buf.st_uid != user_id) || (stat_buf.st_gid != group_id) || (stat_buf.st_size != FILE_SIZE) || ((stat_buf.st_mode & MASK) != NEW_MODE)) { tst_resm(TFAIL, "Functionality of " "stat(2) on '%s' Failed", TESTFILE); } else { tst_resm(TPASS, "Functionality of " "stat(2) on '%s' Succcessful", TESTFILE); } } tst_count++; /* incr TEST_LOOP counter */ } cleanup(); tst_exit(); } /* * void * setup() - Performs setup function for the test. * Creat a temporary directory and change directory to it. * Creat a testfile and write some data into it. * Modify the mode permissions of testfile such that test process * has read-only access to testfile. */ void setup(void) { int i, fd; /* counter, file handle for file */ char tst_buff[BUF_SIZE]; /* data buffer for file */ int wbytes; /* no. of bytes written to file */ int write_len = 0; tst_require_root(NULL); tst_sig(NOFORK, DEF_HANDLER, cleanup); /* Switch to nobody user for correct error code collection */ ltpuser = getpwnam(nobody_uid); if (setuid(ltpuser->pw_uid) == -1) { tst_resm(TINFO, "setuid failed to " "to set the effective uid to %d", ltpuser->pw_uid); perror("setuid"); } /* Pause if that option was specified * TEST_PAUSE contains the code to fork the test with the -i option. * You want to make sure you do this before you create your temporary * directory. */ TEST_PAUSE; tst_tmpdir(); if ((fd = open(TESTFILE, O_RDWR | O_CREAT, FILE_MODE)) == -1) { tst_brkm(TBROK, cleanup, "open(%s, O_RDWR|O_CREAT, %#o) Failed, errno=%d : %s", TESTFILE, FILE_MODE, errno, strerror(errno)); } /* Fill the test buffer with the known data */ for (i = 0; i < BUF_SIZE; i++) { tst_buff[i] = 'a'; } /* Write to the file 1k data from the buffer */ while (write_len < FILE_SIZE) { if ((wbytes = write(fd, tst_buff, sizeof(tst_buff))) <= 0) { tst_brkm(TBROK | TERRNO, cleanup, "write to %s failed", TESTFILE); } else { write_len += wbytes; } } if (close(fd) == -1) { tst_resm(TWARN | TERRNO, "closing %s failed", TESTFILE); } /* Modify mode permissions on the testfile */ if (chmod(TESTFILE, NEW_MODE) < 0) { tst_brkm(TBROK | TERRNO, cleanup, "chmodding %s failed", TESTFILE); } /* Get the uid/gid of the process */ user_id = getuid(); group_id = getgid(); } /* * cleanup() - performs all ONE TIME cleanup for this test at * completion or premature exit. * Remove the temporary directory and file created. */ void cleanup(void) { tst_rmdir(); }
/* * avrftdi - extension for avrdude, Wolfgang Moser, Ville Voipio * Copyright (C) 2011 Hannes Weisbach, Doug Springer * * 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/>. */ /* $Id: avrftdi.h 1294 2014-03-12 23:03:18Z joerg_wunsch $ */ #ifndef avrftdi_h #define avrfdti_h #include <stdint.h> #ifdef __cplusplus extern "C" { #endif extern const char avrftdi_desc[]; void avrftdi_initpgm (PROGRAMMER * pgm); #ifdef __cplusplus } #endif #endif
/* pwdbased.h * * Copyright (C) 2006-2012 Sawtooth Consulting Ltd. * * This file is part of CyaSSL. * * CyaSSL 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. * * CyaSSL 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 NO_PWDBASED #ifndef CTAO_CRYPT_PWDBASED_H #define CTAO_CRYPT_PWDBASED_H #include <cyassl/ctaocrypt/types.h> #include <cyassl/ctaocrypt/md5.h> /* for hash type */ #include <cyassl/ctaocrypt/sha.h> #ifdef __cplusplus extern "C" { #endif CYASSL_API int PBKDF1(byte* output, const byte* passwd, int pLen, const byte* salt, int sLen, int iterations, int kLen, int hashType); CYASSL_API int PBKDF2(byte* output, const byte* passwd, int pLen, const byte* salt, int sLen, int iterations, int kLen, int hashType); CYASSL_API int PKCS12_PBKDF(byte* output, const byte* passwd, int pLen, const byte* salt, int sLen, int iterations, int kLen, int hashType, int purpose); #ifdef __cplusplus } /* extern "C" */ #endif #endif /* CTAO_CRYPT_PWDBASED_H */ #endif /* NO_PWDBASED */
/* * Copyright (C) 2002-2004,2006-2009,2013 by Jonathan Naylor G4KLX * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #ifndef WAVFileWriter_H #define WAVFileWriter_H #include <wx/wx.h> #if defined(__WINDOWS__) #include <windows.h> #include <mmsystem.h> #else #include <wx/ffile.h> #endif class CWAVFileWriter { public: CWAVFileWriter(const wxString& fileName, unsigned int sampleRate, unsigned int channels, unsigned int sampleWidth, unsigned int blockSize); ~CWAVFileWriter(); bool open(); bool write(const wxFloat32* buffer, unsigned int length); void close(); unsigned int getSampleRate() const; unsigned int getChannels() const; private: wxString m_fileName; unsigned int m_sampleRate; unsigned int m_channels; unsigned int m_sampleWidth; unsigned int m_blockSize; wxUint8* m_buffer8; wxInt16* m_buffer16; wxFloat32* m_buffer32; #if defined(__WINDOWS__) HMMIO m_handle; MMCKINFO m_parent; MMCKINFO m_child; #else wxFFile* m_file; wxFileOffset m_offset1; wxFileOffset m_offset2; wxUint32 m_length; #endif }; #endif
#ifndef _ASM_BYTEORDER_H #define _ASM_BYTEORDER_H #include <types.h> #ifdef CONFIG_CPU_MIPSR2 static __inline__ __attribute_const__ __u16 ___arch__swab16(__u16 x) { __asm__( " wsbh %0, %1 \n" : "=r" (x) : "r" (x)); return x; } #define __arch__swab16(x) ___arch__swab16(x) static __inline__ __attribute_const__ __u32 ___arch__swab32(__u32 x) { __asm__( " wsbh %0, %1 \n" " rotr %0, %0, 16 \n" : "=r" (x) : "r" (x)); return x; } #define __arch__swab32(x) ___arch__swab32(x) #ifdef CONFIG_CPU_MIPS64_R2 static __inline__ __attribute_const__ __u64 ___arch__swab64(__u64 x) { __asm__( " dsbh %0, %1 \n" " dshd %0, %0 \n" " drotr %0, %0, 32 \n" : "=r" (x) : "r" (x)); return x; } #define __arch__swab64(x) ___arch__swab64(x) #endif /* CONFIG_CPU_MIPS64_R2 */ #endif /* CONFIG_CPU_MIPSR2 */ #endif
// SPDX-License-Identifier: GPL-2.0-or-later // SPDX-FileCopyrightText: 2012 Alexander Shiyan <shc_work@mail.ru> #include <common.h> #include <init.h> #include <asm/barebox-arm-head.h> #include <mach/clps711x.h> #ifdef CONFIG_CLPS711X_RAISE_CPUFREQ # define CLPS711X_CPU_PLL_MULT 50 #else # define CLPS711X_CPU_PLL_MULT 40 #endif void __naked __bare_init barebox_arm_reset_vector(uint32_t r0, uint32_t r1, uint32_t r2) { arm_cpu_lowlevel_init(); clps711x_barebox_entry(CLPS711X_CPU_PLL_MULT, NULL); }
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- * * Copyright (C) 2007 Andreas Obergrusberger <tradiaz@yahoo.de> * Copyright (C) 2008-2010 Valeriy Lyasotskiy <onestep@ukr.net> * Copyright (C) 2010-2011 Jonathan Conder <jonno.conder@gmail.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. */ #include <alpm.h> #include <glib.h> alpm_handle_t *pk_backend_configure (const gchar *filename, GError **error);
/* * Copyright © 2008 Chris Wilson * * Permission to use, copy, modify, distribute, and sell this software * and its documentation for any purpose is hereby granted without * fee, provided that the above copyright notice appear in all copies * and that both that copyright notice and this permission notice * appear in supporting documentation, and that the name of * Chris Wilson not be used in advertising or publicity pertaining to * distribution of the software without specific, written prior * permission. Chris Wilson makes no representations about the * suitability of this software for any purpose. It is provided "as * is" without express or implied warranty. * * CHRIS WILSON DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND * FITNESS, IN NO EVENT SHALL CHRIS WILSON BE LIABLE FOR ANY SPECIAL, * INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER * RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR * IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * * Author: Chris Wilson <chris@chris-wilson.co.uk> */ #include "cairo-test.h" #define LINE_WIDTH 12. #define SIZE (5 * LINE_WIDTH) #define PAD (2 * LINE_WIDTH) static void make_path (cairo_t *cr) { const struct { double x, y; } scales[] = { { 1, 1 }, { -1, 1 }, { 1, -1 }, { -1, -1 }, }; unsigned int i, j; for (j = 0; j < sizeof (scales) / sizeof (scales[0]); j++) { cairo_save (cr); /* include reflections to flip the orientation of the join */ cairo_scale (cr, scales[j].x, scales[j].y); for (i = 0; i < 3; i++) { cairo_new_sub_path (cr); cairo_move_to (cr, 0, -9*LINE_WIDTH/4 - 2); cairo_line_to (cr, 0, -2*LINE_WIDTH - 2); cairo_line_to (cr, LINE_WIDTH/4, -2*LINE_WIDTH - 2); cairo_rotate (cr, M_PI / 4.); } cairo_restore (cr); } } static cairo_test_status_t draw (cairo_t *cr, int width, int height) { cairo_line_join_t join; cairo_save (cr); cairo_set_source_rgb (cr, 1.0, 1.0, 1.0); /* white */ cairo_paint (cr); cairo_restore (cr); cairo_set_line_width (cr, LINE_WIDTH); cairo_translate (cr, PAD + SIZE / 2., PAD + SIZE / 2.); for (join = CAIRO_LINE_JOIN_MITER; join <= CAIRO_LINE_JOIN_BEVEL; join++) { cairo_save (cr); cairo_set_line_join (cr, join); cairo_set_line_cap (cr, CAIRO_LINE_CAP_BUTT); make_path (cr); cairo_stroke (cr); cairo_translate (cr, 0, SIZE + PAD); cairo_set_line_cap (cr, CAIRO_LINE_CAP_ROUND); make_path (cr); cairo_stroke (cr); cairo_translate (cr, 0, SIZE + PAD); cairo_set_line_cap (cr, CAIRO_LINE_CAP_SQUARE); make_path (cr); cairo_stroke (cr); cairo_restore (cr); cairo_translate (cr, SIZE + PAD, 0); } return CAIRO_TEST_SUCCESS; } CAIRO_TEST (joins, "Test joins", "stroke joins", /* keywords */ NULL, /* requirements */ 3 * (PAD + SIZE) + PAD, 3 * (PAD + SIZE) + PAD, NULL, draw)
/* Copyright (C) 1999-2017 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. The GNU C Library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ #include <stdio.h> #include <string.h> #include <sys/types.h> #include <sys/socket.h> #include <netinet/in.h> #include <netdb.h> static int do_test (void) { const int family[2] = { AF_INET, AF_INET6 }; int result = 0; int gaierr; size_t index; struct addrinfo hints, *ai, *aitop; for (index = 0; index < sizeof (family) / sizeof (family[0]); ++index) { memset (&hints, '\0', sizeof (hints)); hints.ai_family = family[index]; hints.ai_socktype = SOCK_STREAM; gaierr = getaddrinfo (NULL, "54321", &hints, &aitop); if (gaierr != 0) { gai_strerror (gaierr); result = 1; } else { for (ai = aitop; ai != NULL; ai = ai->ai_next) { printf ("Should return family: %d. Returned: %d\n", family[index], ai->ai_family); result |= family[index] != ai->ai_family; } while (aitop != NULL) { ai = aitop; aitop = aitop->ai_next; freeaddrinfo (ai); } } } return result; } #define TEST_FUNCTION do_test () #include "../test-skeleton.c"
#ifndef STRINGUTILS_H #define STRINGUTILS_H #include "longdef.h" typedef unsigned char axgchar; void PascalToCString( axgchar *string ); void CToPascalString( axgchar *string ); void UnicodeToCString( axgchar *string, const int stringBytes ); void CStringToUnicode( axgchar *string, const int stringBytes ); #endif
#include <stdlib.h> extern int bar, baz, *barp, *bazp, dummy; extern int f1 (void), f2 (void), f3 (void), f4 (void); /* Try to use COPY reloc for bar and get away without COPY reloc for baz. Similarly for barp and bazp. */ int *bazp2 = &baz; int **bazp3 = &bazp; int main (void) { if (f1 () != 11 || f2 () != 12 || bar != 36 || *bazp2 != 38) abort (); if (f3 () != 14 || f4 () != 16 || *barp != 36 || **bazp3 != 38) abort (); if (dummy != 24) abort (); exit (0); }
/* * COPYRIGHT: See COPYING in the top level directory * PROJECT: ReactOS kernel * FILE: ntoskrnl/cc/fs.c * PURPOSE: Implements MDL Cache Manager Functions * * PROGRAMMERS: Alex Ionescu */ /* INCLUDES ******************************************************************/ #include <ntoskrnl.h> #define NDEBUG #include <debug.h> /* FUNCTIONS *****************************************************************/ /* * @implemented */ VOID NTAPI CcMdlRead ( IN PFILE_OBJECT FileObject, IN PLARGE_INTEGER FileOffset, IN ULONG Length, OUT PMDL * MdlChain, OUT PIO_STATUS_BLOCK IoStatus ) { CCTRACE(CC_API_DEBUG, "FileObject=%p FileOffset=%I64d Length=%lu\n", FileObject, FileOffset->QuadPart, Length); UNIMPLEMENTED; } /* * NAME INTERNAL * CcMdlReadComplete2@8 * * DESCRIPTION * * ARGUMENTS * MdlChain * DeviceObject * * RETURN VALUE * None. * * NOTE * Used by CcMdlReadComplete@8 and FsRtl * */ VOID NTAPI CcMdlReadComplete2 ( IN PFILE_OBJECT FileObject, IN PMDL MemoryDescriptorList ) { PMDL Mdl; /* Free MDLs */ while ((Mdl = MemoryDescriptorList)) { MemoryDescriptorList = Mdl->Next; MmUnlockPages(Mdl); IoFreeMdl(Mdl); } } /* * NAME EXPORTED * CcMdlReadComplete@8 * * DESCRIPTION * * ARGUMENTS * * RETURN VALUE * None. * * NOTE * From Bo Branten's ntifs.h v13. * * @implemented */ VOID NTAPI CcMdlReadComplete ( IN PFILE_OBJECT FileObject, IN PMDL MdlChain) { PDEVICE_OBJECT DeviceObject = NULL; PFAST_IO_DISPATCH FastDispatch; /* Get Fast Dispatch Data */ DeviceObject = IoGetRelatedDeviceObject(FileObject); FastDispatch = DeviceObject->DriverObject->FastIoDispatch; /* Check if we support Fast Calls, and check this one */ if (FastDispatch && FastDispatch->MdlReadComplete) { /* Use the fast path */ FastDispatch->MdlReadComplete(FileObject, MdlChain, DeviceObject); } /* Use slow path */ CcMdlReadComplete2(FileObject, MdlChain); } /* * @implemented */ VOID NTAPI CcMdlWriteComplete ( IN PFILE_OBJECT FileObject, IN PLARGE_INTEGER FileOffset, IN PMDL MdlChain) { PDEVICE_OBJECT DeviceObject = NULL; PFAST_IO_DISPATCH FastDispatch; /* Get Fast Dispatch Data */ DeviceObject = IoGetRelatedDeviceObject(FileObject); FastDispatch = DeviceObject->DriverObject->FastIoDispatch; /* Check if we support Fast Calls, and check this one */ if (FastDispatch && FastDispatch->MdlWriteComplete) { /* Use the fast path */ FastDispatch->MdlWriteComplete(FileObject, FileOffset, MdlChain, DeviceObject); } /* Use slow path */ CcMdlWriteComplete2(FileObject,FileOffset, MdlChain); } VOID NTAPI CcMdlWriteComplete2 ( IN PFILE_OBJECT FileObject, IN PLARGE_INTEGER FileOffset, IN PMDL MdlChain) { UNIMPLEMENTED; } /* * @unimplemented */ VOID NTAPI CcMdlWriteAbort ( IN PFILE_OBJECT FileObject, IN PMDL MdlChain) { UNIMPLEMENTED; } /* * @unimplemented */ VOID NTAPI CcPrepareMdlWrite ( IN PFILE_OBJECT FileObject, IN PLARGE_INTEGER FileOffset, IN ULONG Length, OUT PMDL * MdlChain, OUT PIO_STATUS_BLOCK IoStatus) { CCTRACE(CC_API_DEBUG, "FileObject=%p FileOffset=%I64d Length=%lu\n", FileObject, FileOffset->QuadPart, Length); UNIMPLEMENTED; }
/* * bcmevent read-only data shared by kernel or app layers * * Copyright (C) 1999-2011, Broadcom Corporation * * Unless you and Broadcom execute a separate written software license * agreement governing use of this software, this software is licensed to you * under the terms of the GNU General Public License version 2 (the "GPL"), * available at http://www.broadcom.com/licenses/GPLv2.php, with the * following added to such license: * * As a special exception, the copyright holders of this software give you * permission to link this software with independent modules, and to copy and * distribute the resulting executable under terms of your choice, provided that * you also meet, for each linked independent module, the terms and conditions of * the license of that module. An independent module is a module which is not * derived from this software. The special exception does not apply to any * modifications of the software. * * Notwithstanding the above, under no circumstances may you combine this * software in any way with any other Broadcom software provided under a license * other than the GPL, without Broadcom's express prior written consent. * $Id: bcmevent.c,v 1.8.2.7 2011-02-01 06:23:39 Exp $ */ #include <typedefs.h> #include <bcmutils.h> #include <proto/ethernet.h> #include <proto/bcmeth.h> #include <proto/bcmevent.h> #if WLC_E_LAST != 85 #error "You need to add an entry to bcmevent_names[] for the new event" #endif const bcmevent_name_t bcmevent_names[] = { { WLC_E_SET_SSID, "SET_SSID" }, { WLC_E_JOIN, "JOIN" }, { WLC_E_START, "START" }, { WLC_E_AUTH, "AUTH" }, { WLC_E_AUTH_IND, "AUTH_IND" }, { WLC_E_DEAUTH, "DEAUTH" }, { WLC_E_DEAUTH_IND, "DEAUTH_IND" }, { WLC_E_ASSOC, "ASSOC" }, { WLC_E_ASSOC_IND, "ASSOC_IND" }, { WLC_E_REASSOC, "REASSOC" }, { WLC_E_REASSOC_IND, "REASSOC_IND" }, { WLC_E_DISASSOC, "DISASSOC" }, { WLC_E_DISASSOC_IND, "DISASSOC_IND" }, { WLC_E_QUIET_START, "START_QUIET" }, { WLC_E_QUIET_END, "END_QUIET" }, { WLC_E_BEACON_RX, "BEACON_RX" }, { WLC_E_LINK, "LINK" }, { WLC_E_MIC_ERROR, "MIC_ERROR" }, { WLC_E_NDIS_LINK, "NDIS_LINK" }, { WLC_E_ROAM, "ROAM" }, { WLC_E_TXFAIL, "TXFAIL" }, { WLC_E_PMKID_CACHE, "PMKID_CACHE" }, { WLC_E_RETROGRADE_TSF, "RETROGRADE_TSF" }, { WLC_E_PRUNE, "PRUNE" }, { WLC_E_AUTOAUTH, "AUTOAUTH" }, { WLC_E_EAPOL_MSG, "EAPOL_MSG" }, { WLC_E_SCAN_COMPLETE, "SCAN_COMPLETE" }, { WLC_E_ADDTS_IND, "ADDTS_IND" }, { WLC_E_DELTS_IND, "DELTS_IND" }, { WLC_E_BCNSENT_IND, "BCNSENT_IND" }, { WLC_E_BCNRX_MSG, "BCNRX_MSG" }, { WLC_E_BCNLOST_MSG, "BCNLOST_IND" }, { WLC_E_ROAM_PREP, "ROAM_PREP" }, { WLC_E_PFN_NET_FOUND, "PFNFOUND_IND" }, { WLC_E_PFN_NET_LOST, "PFNLOST_IND" }, #if defined(IBSS_PEER_DISCOVERY_EVENT) { WLC_E_IBSS_ASSOC, "IBSS_ASSOC" }, #endif /* defined(IBSS_PEER_DISCOVERY_EVENT) */ { WLC_E_RADIO, "RADIO" }, { WLC_E_PSM_WATCHDOG, "PSM_WATCHDOG" }, { WLC_E_PROBREQ_MSG, "PROBE_REQ_MSG" }, { WLC_E_SCAN_CONFIRM_IND, "SCAN_CONFIRM_IND" }, { WLC_E_PSK_SUP, "PSK_SUP" }, { WLC_E_COUNTRY_CODE_CHANGED, "CNTRYCODE_IND" }, { WLC_E_EXCEEDED_MEDIUM_TIME, "EXCEEDED_MEDIUM_TIME" }, { WLC_E_ICV_ERROR, "ICV_ERROR" }, { WLC_E_UNICAST_DECODE_ERROR, "UNICAST_DECODE_ERROR" }, { WLC_E_MULTICAST_DECODE_ERROR, "MULTICAST_DECODE_ERROR" }, { WLC_E_TRACE, "TRACE" }, { WLC_E_BTA_HCI_EVENT, "BTA_HCI_EVENT" }, { WLC_E_IF, "IF" }, #ifdef WLP2P { WLC_E_P2P_DISC_LISTEN_COMPLETE, "WLC_E_P2P_DISC_LISTEN_COMPLETE" }, #endif { WLC_E_RSSI, "RSSI" }, { WLC_E_PFN_SCAN_COMPLETE, "SCAN_COMPLETE" }, { WLC_E_EXTLOG_MSG, "EXTERNAL LOG MESSAGE" }, #ifdef WIFI_ACT_FRAME { WLC_E_ACTION_FRAME, "ACTION_FRAME" }, { WLC_E_ACTION_FRAME_RX, "ACTION_FRAME_RX" }, { WLC_E_ACTION_FRAME_COMPLETE, "ACTION_FRAME_COMPLETE" }, #endif #ifdef BCMWAPI_WAI { WLC_E_WAI_STA_EVENT, "WAI_STA_EVENT" }, { WLC_E_WAI_MSG, "WAI_MSG" }, #endif /* BCMWAPI_WAI */ { WLC_E_ESCAN_RESULT, "WLC_E_ESCAN_RESULT" }, { WLC_E_ACTION_FRAME_OFF_CHAN_COMPLETE, "WLC_E_AF_OFF_CHAN_COMPLETE" }, #ifdef WLP2P { WLC_E_PROBRESP_MSG, "PROBE_RESP_MSG" }, { WLC_E_P2P_PROBREQ_MSG, "P2P PROBE_REQ_MSG" }, #endif #ifdef PROP_TXSTATUS { WLC_E_FIFO_CREDIT_MAP, "FIFO_CREDIT_MAP" }, #endif { WLC_E_WAKE_EVENT, "WAKE_EVENT" }, { WLC_E_DCS_REQUEST, "DCS_REQUEST" }, { WLC_E_RM_COMPLETE, "RM_COMPLETE" }, #ifdef WLMEDIA_HTSF { WLC_E_HTSFSYNC, "HTSF_SYNC_EVENT" }, #endif { WLC_E_OVERLAY_REQ, "OVERLAY_REQ_EVENT" }, { WLC_E_CSA_COMPLETE_IND, "WLC_E_CSA_COMPLETE_IND" }, { WLC_E_EXCESS_PM_WAKE_EVENT, "EXCESS_PM_WAKE_EVENT" }, { WLC_E_PFN_SCAN_NONE, "PFN_SCAN_NONE" }, { WLC_E_PFN_SCAN_ALLGONE, "PFN_SCAN_ALLGONE" }, #ifdef SOFTAP { WLC_E_GTK_PLUMBED, "GTK_PLUMBED" } #endif }; const int bcmevent_names_size = ARRAYSIZE(bcmevent_names);
#import <Cocoa/Cocoa.h> #import "ToolWrapper.h" #import "FutureMethods.h" @class ToolCapturedOutputView; @class ToolCommandHistoryView; @class ToolDirectoriesView; @class ToolbeltSplitView; @class PseudoTerminal; extern NSString *kCommandHistoryToolName; extern NSString *kCapturedOutputToolName; // Notification posted when all windows should hide their toolbelts. extern NSString *const kToolbeltShouldHide; @interface ToolbeltView : NSView <NSSplitViewDelegate, ToolWrapperDelegate> { ToolbeltSplitView *splitter_; NSMutableDictionary *tools_; PseudoTerminal *term_; // weak } + (NSArray *)configuredTools; + (void)registerToolWithName:(NSString *)name withClass:(Class)c; + (void)populateMenu:(NSMenu *)menu; + (void)toggleShouldShowTool:(NSString *)theName; + (int)numberOfVisibleTools; - (id)initWithFrame:(NSRect)frame term:(PseudoTerminal *)term; // Is the tool visible? - (BOOL)showingToolWithName:(NSString *)theName; - (void)toggleToolWithName:(NSString *)theName; // Do prefs say the tool is visible? + (BOOL)shouldShowTool:(NSString *)name; - (BOOL)haveOnlyOneTool; - (void)shutdown; - (ToolCommandHistoryView *)commandHistoryView; - (ToolDirectoriesView *)directoriesView; - (ToolCapturedOutputView *)capturedOutputView; - (void)relayoutAllTools; @end
/* * Copyright (C) 2009 Texas Instruments. * * 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 __DAVINCI_SPI_H #define __DAVINCI_SPI_H #define SPI_MAX_CHIPSELECT 2 #define CS_DEFAULT 0xFF #define SPI_BUFSIZ (SMP_CACHE_BYTES + 1) #define DAVINCI_DMA_DATA_TYPE_S8 0x01 #define DAVINCI_DMA_DATA_TYPE_S16 0x02 #define DAVINCI_DMA_DATA_TYPE_S32 0x04 #define SPIFMT_PHASE_MASK BIT(16) #define SPIFMT_POLARITY_MASK BIT(17) #define SPIFMT_DISTIMER_MASK BIT(18) #define SPIFMT_SHIFTDIR_MASK BIT(20) #define SPIFMT_WAITENA_MASK BIT(21) #define SPIFMT_PARITYENA_MASK BIT(22) #define SPIFMT_ODD_PARITY_MASK BIT(23) #define SPIFMT_WDELAY_MASK 0x3f000000u #define SPIFMT_WDELAY_SHIFT 24 #define SPIFMT_CHARLEN_MASK 0x0000001Fu /* SPIGCR1 */ #define SPIGCR1_SPIENA_MASK 0x01000000u /* SPIPC0 */ #define SPIPC0_DIFUN_MASK BIT(11) /* MISO */ #define SPIPC0_DOFUN_MASK BIT(10) /* MOSI */ #define SPIPC0_CLKFUN_MASK BIT(9) /* CLK */ #define SPIPC0_SPIENA_MASK BIT(8) /* nREADY */ #define SPIPC0_EN1FUN_MASK BIT(1) #define SPIPC0_EN0FUN_MASK BIT(0) #define SPIINT_MASKALL 0x0101035F #define SPI_INTLVL_1 0x000001FFu #define SPI_INTLVL_0 0x00000000u /* SPIDAT1 */ #define SPIDAT1_CSHOLD_SHIFT 28 #define SPIDAT1_CSNR_SHIFT 16 #define SPIGCR1_CLKMOD_MASK BIT(1) #define SPIGCR1_MASTER_MASK BIT(0) #define SPIGCR1_LOOPBACK_MASK BIT(16) /* SPIBUF */ #define SPIBUF_TXFULL_MASK BIT(29) #define SPIBUF_RXEMPTY_MASK BIT(31) /* Error Masks */ #define SPIFLG_DLEN_ERR_MASK BIT(0) #define SPIFLG_TIMEOUT_MASK BIT(1) #define SPIFLG_PARERR_MASK BIT(2) #define SPIFLG_DESYNC_MASK BIT(3) #define SPIFLG_BITERR_MASK BIT(4) #define SPIFLG_OVRRUN_MASK BIT(6) #define SPIFLG_RX_INTR_MASK BIT(8) #define SPIFLG_TX_INTR_MASK BIT(9) #define SPIFLG_BUF_INIT_ACTIVE_MASK BIT(24) #define SPIFLG_MASK (SPIFLG_DLEN_ERR_MASK \ | SPIFLG_TIMEOUT_MASK | SPIFLG_PARERR_MASK \ | SPIFLG_DESYNC_MASK | SPIFLG_BITERR_MASK \ | SPIFLG_OVRRUN_MASK | SPIFLG_RX_INTR_MASK \ | SPIFLG_TX_INTR_MASK \ | SPIFLG_BUF_INIT_ACTIVE_MASK) #define SPIINT_DLEN_ERR_INTR BIT(0) #define SPIINT_TIMEOUT_INTR BIT(1) #define SPIINT_PARERR_INTR BIT(2) #define SPIINT_DESYNC_INTR BIT(3) #define SPIINT_BITERR_INTR BIT(4) #define SPIINT_OVRRUN_INTR BIT(6) #define SPIINT_RX_INTR BIT(8) #define SPIINT_TX_INTR BIT(9) #define SPIINT_DMA_REQ_EN BIT(16) #define SPIINT_ENABLE_HIGHZ BIT(24) #define SPI_T2CDELAY_SHIFT 16 #define SPI_C2TDELAY_SHIFT 24 /* SPI Controller registers */ #define SPIGCR0 0x00 #define SPIGCR1 0x04 #define SPIINT 0x08 #define SPILVL 0x0c #define SPIFLG 0x10 #define SPIPC0 0x14 #define SPIPC1 0x18 #define SPIPC2 0x1c #define SPIPC3 0x20 #define SPIPC4 0x24 #define SPIPC5 0x28 #define SPIPC6 0x2c #define SPIPC7 0x30 #define SPIPC8 0x34 #define SPIDAT0 0x38 #define SPIDAT1 0x3c #define SPIBUF 0x40 #define SPIEMU 0x44 #define SPIDELAY 0x48 #define SPIDEF 0x4c #define SPIFMT0 0x50 #define SPIFMT1 0x54 #define SPIFMT2 0x58 #define SPIFMT3 0x5c #define TGINTVEC0 0x60 #define TGINTVEC1 0x64 struct davinci_spi_slave { u32 cmd_to_write; u32 clk_ctrl_to_write; u32 bytes_per_word; u8 active_cs; }; /* We have 2 DMA channels per CS, one for RX and one for TX */ struct davinci_spi_dma { int dma_tx_channel; int dma_rx_channel; int dma_tx_sync_dev; int dma_rx_sync_dev; enum dma_event_q eventq; struct completion dma_tx_completion; struct completion dma_rx_completion; }; /* SPI Controller driver's private data. */ struct davinci_spi { struct spi_bitbang bitbang; struct clk *clk; u8 version; resource_size_t pbase; void __iomem *base; size_t region_size; u32 irq; struct completion done; const void *tx; void *rx; u8 *tmp_buf; int count; struct davinci_spi_dma *dma_channels; struct davinci_spi_platform_data *pdata; void (*get_rx)(u32 rx_data, struct davinci_spi *); u32 (*get_tx)(struct davinci_spi *); u32 speed; u32 cs_num; bool in_use; struct davinci_spi_slave slave[SPI_MAX_CHIPSELECT]; #ifdef CONFIG_CPU_FREQ struct notifier_block freq_transition; #endif }; #endif /* __DAVINCI_SPI_H */
#ifndef RECORD_XML_H #define RECORD_XML_H #include <qdom.h> #include <qmap.h> #include "blurqt.h" #include "recordlist.h" class STONE_EXPORT RecordXmlSaver { public: RecordXmlSaver(RecordList rl = RecordList()); QList<QDomElement> addRecords( RecordList rl ); QDomElement addRecord( const Record & r ); QDomDocument document() const; bool saveToFile(const QString & fileName, QString * errorMessage = 0); static bool toFile(RecordList rl, const QString & fileName, QString * errorMessage = 0); static QDomDocument toDocument(RecordList rl, QString * errorMessage = 0); protected: QString internalId( const Record & record ); QMap<Record,int> mInternalIdMap; QDomDocument mDocument; QDomElement mRoot; int mNextInternalId; }; class STONE_EXPORT RecordXmlLoader { public: RecordXmlLoader(const QString & fileName); RecordXmlLoader(QDomDocument document); RecordXmlLoader(); RecordList records() const; QMap<Record,QDomElement> recordElementMap() const; bool loadFile( const QString & fileName, QString * errorMessage = 0); bool loadDocument( const QDomDocument & document, QString * errorMessage = 0); static RecordList fromFile(const QString & fileName, QString * errorMessage = 0); static RecordList fromDocument(const QDomDocument & document, QString * errorMessage = 0); protected: bool isInternalIdLoaded( int internalId ); Record recordByInternalId( int internalId ); QMap<Record,QDomElement> mRecordElementMap; QMap<int,Record> mInternalIdMap; QList< QPair<Record,QDomElement> > mNeedsFkeyFixup; RecordList mRecords; }; #endif // RECORD_XML_H
/* Helper function for repacking arrays. Copyright (C) 2003-2021 Free Software Foundation, Inc. Contributed by Paul Brook <paul@nowt.org> This file is part of the GNU Fortran runtime library (libgfortran). Libgfortran 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. Libgfortran 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. Under Section 7 of GPL version 3, you are granted additional permissions described in the GCC Runtime Library Exception, version 3.1, as published by the Free Software Foundation. You should have received a copy of the GNU General Public License and a copy of the GCC Runtime Library Exception along with this program; see the files COPYING3 and COPYING.RUNTIME respectively. If not, see <http://www.gnu.org/licenses/>. */ #include "libgfortran.h" #include <string.h> #if defined (HAVE_GFC_INTEGER_2) void internal_unpack_2 (gfc_array_i2 * d, const GFC_INTEGER_2 * src) { index_type count[GFC_MAX_DIMENSIONS]; index_type extent[GFC_MAX_DIMENSIONS]; index_type stride[GFC_MAX_DIMENSIONS]; index_type stride0; index_type dim; index_type dsize; GFC_INTEGER_2 * restrict dest; dest = d->base_addr; if (src == dest || !src) return; dim = GFC_DESCRIPTOR_RANK (d); dsize = 1; for (index_type n = 0; n < dim; n++) { count[n] = 0; stride[n] = GFC_DESCRIPTOR_STRIDE(d,n); extent[n] = GFC_DESCRIPTOR_EXTENT(d,n); if (extent[n] <= 0) return; if (dsize == stride[n]) dsize *= extent[n]; else dsize = 0; } if (dsize != 0) { memcpy (dest, src, dsize * sizeof (GFC_INTEGER_2)); return; } stride0 = stride[0]; while (dest) { /* Copy the data. */ *dest = *(src++); /* Advance to the next element. */ dest += stride0; count[0]++; /* Advance to the next source element. */ index_type n = 0; while (count[n] == extent[n]) { /* When we get to the end of a dimension, reset it and increment the next dimension. */ count[n] = 0; /* We could precalculate these products, but this is a less frequently used path so probably not worth it. */ dest -= stride[n] * extent[n]; n++; if (n == dim) { dest = NULL; break; } else { count[n]++; dest += stride[n]; } } } } #endif
/* String Streams Copyright (C) 1991-2017 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, if not, see <http://www.gnu.org/licenses/>. */ #include <stdio.h> static char buffer[] = "foobar"; int main (void) { int ch; FILE *stream; stream = fmemopen (buffer, strlen (buffer), "r"); while ((ch = fgetc (stream)) != EOF) printf ("Got %c\n", ch); fclose (stream); return 0; }
#if HAVE_STDLIB_H #include <stdlib.h> #endif #if HAVE_UNISTD_H #include <unistd.h> #endif #if HAVE_STRING_H #include <string.h> #else #include <strings.h> #endif #include <sys/types.h> #if HAVE_WINSOCK_H #include <winsock.h> #endif #if HAVE_SYS_PARAM_H #include <sys/param.h> #endif #if HAVE_NETINET_IN_H #include <netinet/in.h> #endif #if HAVE_SYS_SYSMP_H #include <sys/sysmp.h> #endif #if HAVE_SYS_TCPIPSTATS_H #include <sys/tcpipstats.h> #endif #if defined(NETSNMP_IFNET_NEEDS_KERNEL) && !defined(_KERNEL) #define _KERNEL 1 #define _I_DEFINED_KERNEL #endif #if HAVE_SYS_SOCKET_H #include <sys/socket.h> #endif #if HAVE_NET_IF_H #include <net/if.h> #endif #if HAVE_NET_IF_VAR_H #include <net/if_var.h> #endif #ifdef _I_DEFINED_KERNEL #undef _KERNEL #endif #if HAVE_SYS_SYSCTL_H #include <sys/sysctl.h> #endif #if HAVE_SYS_STREAM_H #include <sys/stream.h> #endif #if HAVE_NET_ROUTE_H #include <net/route.h> #endif #if HAVE_NETINET_IN_SYSTM_H #include <netinet/in_systm.h> #endif #if HAVE_NETINET_IP_H #include <netinet/ip.h> #endif #if HAVE_SYS_QUEUE_H #include <sys/queue.h> #endif /* IRIX 6.5 build breaks on sys/socketvar.h because _KMEMUSER brings in sys/pda.h which doesn't compile */ #ifndef irix6 #if HAVE_SYS_SOCKETVAR_H #include <sys/socketvar.h> #endif #endif /* irix6 */ #if HAVE_NETINET_IP_VAR_H #include <netinet/ip_var.h> #endif #ifdef NETSNMP_ENABLE_IPV6 #if HAVE_NETNETSNMP_ENABLE_IPV6_IP6_VAR_H #include <netinet6/ip6_var.h> #endif #endif #if HAVE_NETINET_IN_PCB_H #include <netinet/in_pcb.h> #endif #if HAVE_INET_MIB2_H #include <inet/mib2.h> #endif #ifdef HAVE_STDINT_H #include <stdint.h> #endif #if HAVE_DMALLOC_H #include <dmalloc.h> #endif #ifdef solaris2 #include "kernel_sunos5.h" #else #include "kernel.h" #endif #ifdef linux #include "kernel_linux.h" #endif /* or MIB_xxxCOUNTER_SYMBOL || hpux11 */ #ifdef hpux #include <sys/mib.h> #include <netinet/mib_kern.h> #endif #ifdef cygwin #include <windows.h> #endif
// SPDX-License-Identifier: GPL-2.0 #ifdef __clang__ // Clang has a bug on zero-initialization of C structs. #pragma clang diagnostic ignored "-Wmissing-field-initializers" #endif #include <stdarg.h> #include <stdlib.h> #include <string.h> #include <stdio.h> #include "dive.h" #include "membuffer.h" #include "divesite.h" #include "errorhelper.h" #include "file.h" #include "save-html.h" #include "worldmap-save.h" #include "worldmap-options.h" #include "gettext.h" char *getGoogleApi() { /* google maps api auth*/ return "https://maps.googleapis.com/maps/api/js?"; } void writeMarkers(struct membuffer *b, bool selected_only) { int i, dive_no = 0; struct dive *dive; char pre[1000], post[1000]; for_each_dive (i, dive) { if (selected_only) { if (!dive->selected) continue; } struct dive_site *ds = get_dive_site_for_dive(dive); if (!dive_site_has_gps_location(ds)) continue; put_degrees(b, ds->location.lat, "temp = new google.maps.Marker({position: new google.maps.LatLng(", ""); put_degrees(b, ds->location.lon, ",", ")});\n"); put_string(b, "markers.push(temp);\ntempinfowindow = new google.maps.InfoWindow({content: '<div id=\"content\">'+'<div id=\"siteNotice\">'+'</div>'+'<div id=\"bodyContent\">"); snprintf(pre, sizeof(pre), "<p>%s ", translate("gettextFromC", "Date:")); put_HTML_date(b, dive, pre, "</p>"); snprintf(pre, sizeof(pre), "<p>%s ", translate("gettextFromC", "Time:")); put_HTML_time(b, dive, pre, "</p>"); snprintf(pre, sizeof(pre), "<p>%s ", translate("gettextFromC", "Duration:")); snprintf(post, sizeof(post), " %s</p>", translate("gettextFromC", "min")); put_duration(b, dive->duration, pre, post); put_string(b, "<p> "); put_HTML_quoted(b, translate("gettextFromC", "Max. depth:")); put_HTML_depth(b, dive, " ", "</p>"); put_string(b, "<p> "); put_HTML_quoted(b, translate("gettextFromC", "Air temp.:")); put_HTML_airtemp(b, dive, " ", "</p>"); put_string(b, "<p> "); put_HTML_quoted(b, translate("gettextFromC", "Water temp.:")); put_HTML_watertemp(b, dive, " ", "</p>"); snprintf(pre, sizeof(pre), "<p>%s <b>", translate("gettextFromC", "Location:")); put_string(b, pre); put_HTML_quoted(b, get_dive_location(dive)); put_string(b, "</b></p>"); snprintf(pre, sizeof(pre), "<p> %s ", translate("gettextFromC", "Notes:")); put_HTML_notes(b, dive, pre, " </p>"); put_string(b, "</p>'+'</div>'+'</div>'});\ninfowindows.push(tempinfowindow);\n"); put_format(b, "google.maps.event.addListener(markers[%d], 'mouseover', function() {\ninfowindows[%d].open(map,markers[%d]);}", dive_no, dive_no, dive_no); put_format(b, ");google.maps.event.addListener(markers[%d], 'mouseout', function() {\ninfowindows[%d].close();});\n", dive_no, dive_no); dive_no++; } } void insert_html_header(struct membuffer *b) { put_string(b, "<!DOCTYPE html>\n<html>\n<head>\n"); put_string(b, "<meta name=\"viewport\" content=\"initial-scale=1.0, user-scalable=no\" />\n<title>World Map</title>\n"); put_string(b, "<meta charset=\"UTF-8\">"); } void insert_css(struct membuffer *b) { put_format(b, "<style type=\"text/css\">%s</style>\n", css); } void insert_javascript(struct membuffer *b, const bool selected_only) { put_string(b, "<script type=\"text/javascript\" src=\""); put_string(b, getGoogleApi()); put_string(b, "&amp;sensor=false\">\n</script>\n<script type=\"text/javascript\">\nvar map;\n"); put_format(b, "function initialize() {\nvar mapOptions = {\n\t%s,", map_options); put_string(b, "rotateControl: false,\n\tstreetViewControl: false,\n\tmapTypeControl: false\n};\n"); put_string(b, "map = new google.maps.Map(document.getElementById(\"map-canvas\"),mapOptions);\nvar markers = new Array();"); put_string(b, "\nvar infowindows = new Array();\nvar temp;\nvar tempinfowindow;\n"); writeMarkers(b, selected_only); put_string(b, "\nfor(var i=0;i<markers.length;i++)\n\tmarkers[i].setMap(map);\n}\n"); put_string(b, "google.maps.event.addDomListener(window, 'load', initialize);</script>\n"); } void export(struct membuffer *b, const bool selected_only) { insert_html_header(b); insert_css(b); insert_javascript(b, selected_only); put_string(b, "\t</head>\n<body>\n<div id=\"map-canvas\"></div>\n</body>\n</html>"); } void export_worldmap_HTML(const char *file_name, const bool selected_only) { FILE *f; struct membuffer buf = { 0 }; export(&buf, selected_only); f = subsurface_fopen(file_name, "w+"); if (!f) { report_error(translate("gettextFromC", "Can't open file %s"), file_name); } else { flush_buffer(&buf, f); /*check for writing errors? */ fclose(f); } free_buffer(&buf); }
/** @file * VBoxGuest - VirtualBox Guest Additions Driver Interface, 16-bit (OS/2) header. */ /* * Copyright (C) 2006-2015 Oracle Corporation * * This file is part of VirtualBox Open Source Edition (OSE), as * available from http://www.virtualbox.org. This file is free software; * you can redistribute it and/or modify it under the terms of the GNU * General Public License (GPL) as published by the Free Software * Foundation, in version 2 as it comes in the "COPYING" file of the * VirtualBox OSE distribution. VirtualBox OSE is distributed in the * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind. * * The contents of this file may alternatively be used under the terms * of the Common Development and Distribution License Version 1.0 * (CDDL) only, as it comes in the "COPYING.CDDL" file of the * VirtualBox OSE distribution, in which case the provisions of the * CDDL are applicable instead of those of the GPL. * * You may elect to license modified versions of this file under the * terms and conditions of either the GPL or the CDDL or both. */ #ifndef ___VBox_VBoxGuest16_h #define ___VBox_VBoxGuest16_h #define RT_BIT(bit) (1UL << (bit)) #define VBOXGUEST_DEVICE_NAME "vboxgst$" /* aka VBOXGUESTOS2IDCCONNECT */ typedef struct VBGOS2IDC { unsigned long u32Version; unsigned long u32Session; unsigned long pfnServiceEP; short (__cdecl __far *fpfnServiceEP)(unsigned long u32Session, unsigned short iFunction, void __far *fpvData, unsigned short cbData, unsigned short __far *pcbDataReturned); unsigned long fpfnServiceAsmEP; } VBGOS2IDC; typedef VBGOS2IDC *PVBGOS2IDC; #define VBOXGUEST_IOCTL_WAITEVENT 2 #define VBOXGUEST_IOCTL_VMMREQUEST 3 #define VBOXGUEST_IOCTL_CTL_FILTER_MASK 4 #define VBOXGUEST_IOCTL_SET_MOUSE_STATUS 10 #define VBOXGUEST_IOCTL_OS2_IDC_DISCONNECT 48 #define VBOXGUEST_WAITEVENT_OK 0 #define VBOXGUEST_WAITEVENT_TIMEOUT 1 #define VBOXGUEST_WAITEVENT_INTERRUPTED 2 #define VBOXGUEST_WAITEVENT_ERROR 3 typedef struct _VBoxGuestWaitEventInfo { unsigned long u32TimeoutIn; unsigned long u32EventMaskIn; unsigned long u32Result; unsigned long u32EventFlagsOut; } VBoxGuestWaitEventInfo; #define VMMDEV_REQUEST_HEADER_VERSION (0x10001UL) typedef struct { unsigned long size; unsigned long version; unsigned long requestType; signed long rc; unsigned long reserved1; unsigned long reserved2; } VMMDevRequestHeader; #define VMMDevReq_GetMouseStatus 1 #define VMMDevReq_SetMouseStatus 2 #define VMMDevReq_CtlGuestFilterMask 42 #define VMMDEV_MOUSE_GUEST_CAN_ABSOLUTE RT_BIT(0) #define VMMDEV_MOUSE_HOST_WANTS_ABSOLUTE RT_BIT(1) #define VMMDEV_MOUSE_GUEST_NEEDS_HOST_CURSOR RT_BIT(2) #define VMMDEV_MOUSE_HOST_CANNOT_HWPOINTER RT_BIT(3) typedef struct { VMMDevRequestHeader header; unsigned long mouseFeatures; unsigned long pointerXPos; unsigned long pointerYPos; } VMMDevReqMouseStatus; typedef struct VBoxGuestFilterMaskInfo { unsigned long u32OrMask; unsigned long u32NotMask; } VBoxGuestFilterMaskInfo; /* From VMMDev.h: */ #define VMMDEV_VERSION 0x00010004UL #define VMMDEV_EVENT_MOUSE_CAPABILITIES_CHANGED RT_BIT(0) #define VMMDEV_EVENT_HGCM RT_BIT(1) #define VMMDEV_EVENT_DISPLAY_CHANGE_REQUEST RT_BIT(2) #define VMMDEV_EVENT_JUDGE_CREDENTIALS RT_BIT(3) #define VMMDEV_EVENT_RESTORED RT_BIT(4) #endif
/* * Nanogear - C++ web development framework * * This library is based on Restlet (R) <http://www.restlet.org> by Noelios Technologies * Copyright (C) 2005-2008 by Noelios Technologies <http://www.noelios.com> * Restlet is a registered trademark of Noelios Technologies. All other marks and * trademarks are property of their respective owners. * * Copyright (C) 2008-2009 Lorenzo Villani. * * 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, version 3 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 Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #ifndef NAPPLICATION_H #define NAPPLICATION_H #include <QCoreApplication> #include "nserver.h" #include "nresponse.h" #include "nresource.h" #include "nrepresentation.h" /*! * \class NApplication * \brief A Nanogear application * * This class represents a Nanogear application and it's used to handle a set * of dependant resources. * It is responsible for starting the event loop and the attached connector. */ class NApplication : public QCoreApplication, public NResource { public: /*! * Initialize this Nanogear application * * The argc and argv arguments are processed by the application, and made * available in a more convenient form by the arguments() function. * * Warning: The data pointed to by argc and argv must stay valid for the * entire lifetime of the QCoreApplication object. */ NApplication(int argc, char** argv) : QCoreApplication(argc, argv) {} /*! * Attach a server to this application. The server is automatically started * when calling exec() * \param server a pointer to a concrete implementation of the server class */ void setServer(NServer* server) { m_server = server; } /*! * \return The currently attached server */ NServer* server() const { return m_server; } /*! * Every application must implement this function to create the root resource in the heap * (which will answer requests to every URI) * \note The instance of the object returned by this method is automatically deleted * by a Server implementation after handling the request. * \return A pointer to the created resource */ virtual NResource* createRoot() { return 0; // FIXME: dangerous }; /*! * Retrieve an instance of this Nanogear application * \return A pointer to the current instance */ static NApplication* instance() { return static_cast<NApplication*>(QCoreApplication::instance()); } /*! * Start this Nanogear application. This method will also call the * Server::start() method for you. * \return The value set to exit() (which is 0 if you call quit()) */ int exec() { m_server->start(); return QCoreApplication::exec(); } private: NServer* m_server; }; #endif /* NAPPLICATION_H */
/* * Copyright (c) 2007 The FFmpeg Project. * * This file is part of FFmpeg. * * FFmpeg 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. * * FFmpeg 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 FFmpeg; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ #ifndef AVFORMAT_NETWORK_H #define AVFORMAT_NETWORK_H #ifdef HAVE_WINSOCK2_H #include <winsock2.h> #include <ws2tcpip.h> #define ff_neterrno() WSAGetLastError() #define FF_NETERROR(err) WSA##err #define WSAEAGAIN WSAEWOULDBLOCK #else #include <sys/types.h> #include <sys/socket.h> #include <netinet/in.h> #include <netdb.h> #define ff_neterrno() errno #define FF_NETERROR(err) err #endif #ifdef HAVE_ARPA_INET_H #include <arpa/inet.h> #endif int ff_socket_nonblock(int socket, int enable); static inline int ff_network_init(void) { #ifdef HAVE_WINSOCK2_H WSADATA wsaData; if (WSAStartup(MAKEWORD(1,1), &wsaData)) return 0; #endif return 1; } static inline void ff_network_close(void) { #ifdef HAVE_WINSOCK2_H WSACleanup(); #endif } #if !defined(HAVE_INET_ATON) /* in os_support.c */ int inet_aton (const char * str, struct in_addr * add); #endif #endif /* AVFORMAT_NETWORK_H */
/* ---------------------------------------------------------------------- * I-SIMPA (http://i-simpa.ifsttar.fr). This file is part of I-SIMPA. * * I-SIMPA is a GUI for 3D numerical sound propagation modelling dedicated * to scientific acoustic simulations. * Copyright (C) 2007-2014 - IFSTTAR - Judicael Picaut, Nicolas Fortin * * I-SIMPA 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. * * I-SIMPA 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://ww.gnu.org/licenses/> * * For more information, please consult: <http://i-simpa.ifsttar.fr> or * send an email to i-simpa@ifsttar.fr * * To contact Ifsttar, write to Ifsttar, 14-20 Boulevard Newton * Cite Descartes, Champs sur Marne F-77447 Marne la Vallee Cedex 2 FRANCE * or write to scientific.computing@ifsttar.fr * ----------------------------------------------------------------------*/ #include "first_header_include.hpp" #include "simpleGraph.h" #include <wx/confbase.h> /** * @file simpleGraphManager.h * @brief Classe de rendu 2D de données graphiques * * Basé sur wxWidgets ce contrôle permet l'affichage de données graphiques. * Cette surcharge ajoute des fonctionnalitées avancés tel que la personalisation du graphique par l'utilisateur via un menu et de nouvelles interfaces. */ #ifndef __SIMPLEGRAPH_MANAGER__ #define __SIMPLEGRAPH_MANAGER__ namespace sgSpace { enum ID_MSGW { ID_MSGW_ZOOMFIT=50, ID_MSGW_EXPORT, ID_MSGW_EXPORT_SAVE_AS, ID_MSGW_EXPORT_SAVE_AS_POSTSCRIPT_FILE, ID_MSGW_EXPORT_TO_CLIPBOARD, ID_MSGW_EXPORT_TO_PRINTER, ID_MSGW_CONFIGURATION, ID_MSGW_FILTER, ID_MSGW_FILTER_SELECT_ALL, ID_MSGW_FILTER_UNSELECT_ALL, ID_MSGW_FILTER_CHECK_FIRST, ID_MSGW_FILTER_CHECK_LAST=500 }; /** * Cette surchage permet des fonctions étendues lors du clic bouton droit dans la zone de graphique. */ class MainSimpleGraphWindow : public simpleGraph { public: MainSimpleGraphWindow(wxWindow* parent, wxWindowID id, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = 0, const wxString& name = wxPanelNameStr); void OnRightUp( wxMouseEvent &event ); /** * Charge le style du graphique selon un élément de configuration * @param configManager Gestionnaire de configuration ( Peut être n'importe quelle classe hérité de wxConfigBase ) * @param cfgPathName Nom de la clé à consulter */ virtual bool LoadConfig( wxConfigBase* configManager, const wxString& cfgPathName, bool saveModifications = false); /** * Sauvegarde le style du graphique dans un élément de configuration. Les echelles ne sont pas sauvegardées. * @param configManager Gestionnaire de configuration ( Peut être n'importe quelle classe hérité de wxConfigBase ) * @param cfgPathName Nom de la clé à utiliser */ virtual bool SaveConfig( wxConfigBase* configManager, const wxString& cfgPathName ); void SetDefaultSaveGraphSavePath(const wxString& defPath) { defaultGraphSavePath=defPath; } protected: void OnZoomFitMenu(wxCommandEvent& event); void OnShowGraphParameters(wxCommandEvent& event); void OnExportToImageFile(wxCommandEvent& event); void OnExportToImageToClipboard(wxCommandEvent& event); void OnSwitchCurveVisibility(wxCommandEvent& event); void OnHideAllCurves(wxCommandEvent& event); void OnShowAllCurves(wxCommandEvent& event); wxBitmap GetAreaBitmap(); DECLARE_EVENT_TABLE() bool updateConfigOnChange; wxString cfgPathToUpdate; wxConfigBase* cfgManagerToUpdate; wxString defaultGraphSavePath; }; } #endif
/* Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef APR_VERSION_H #define APR_VERSION_H /** * @file apr_version.h * @brief APR Versioning Interface * * APR's Version * * There are several different mechanisms for accessing the version. There * is a string form, and a set of numbers; in addition, there are constants * which can be compiled into your application, and you can query the library * being used for its actual version. * * Note that it is possible for an application to detect that it has been * compiled against a different version of APR by use of the compile-time * constants and the use of the run-time query function. * * APR version numbering follows the guidelines specified in: * * http://apr.apache.org/versioning.html */ /* The numeric compile-time version constants. These constants are the * authoritative version numbers for APR. */ /** major version * Major API changes that could cause compatibility problems for older * programs such as structure size changes. No binary compatibility is * possible across a change in the major version. */ #define APR_MAJOR_VERSION 1 /** minor version * Minor API changes that do not cause binary compatibility problems. * Reset to 0 when upgrading APR_MAJOR_VERSION */ #define APR_MINOR_VERSION 4 /** patch level * The Patch Level never includes API changes, simply bug fixes. * Reset to 0 when upgrading APR_MINOR_VERSION */ #define APR_PATCH_VERSION 5 /** * The symbol APR_IS_DEV_VERSION is only defined for internal, * "development" copies of APR. It is undefined for released versions * of APR. */ /* #define APR_IS_DEV_VERSION */ /** * Check at compile time if the APR version is at least a certain * level. * @param major The major version component of the version checked * for (e.g., the "1" of "1.3.0"). * @param minor The minor version component of the version checked * for (e.g., the "3" of "1.3.0"). * @param patch The patch level component of the version checked * for (e.g., the "0" of "1.3.0"). * @remark This macro is available with APR versions starting with * 1.3.0. */ #define APR_VERSION_AT_LEAST(major,minor,patch) \ (((major) < APR_MAJOR_VERSION) \ || ((major) == APR_MAJOR_VERSION && (minor) < APR_MINOR_VERSION) \ || ((major) == APR_MAJOR_VERSION && (minor) == APR_MINOR_VERSION && (patch) <= APR_PATCH_VERSION)) #if defined(APR_IS_DEV_VERSION) || defined(DOXYGEN) /** Internal: string form of the "is dev" flag */ #define APR_IS_DEV_STRING "-dev" #else #define APR_IS_DEV_STRING "" #endif /* APR_STRINGIFY is defined here, and also in apr_general.h, so wrap it */ #ifndef APR_STRINGIFY /** Properly quote a value as a string in the C preprocessor */ #define APR_STRINGIFY(n) APR_STRINGIFY_HELPER(n) /** Helper macro for APR_STRINGIFY */ #define APR_STRINGIFY_HELPER(n) #n #endif /** The formatted string of APR's version */ #define APR_VERSION_STRING \ APR_STRINGIFY(APR_MAJOR_VERSION) "." \ APR_STRINGIFY(APR_MINOR_VERSION) "." \ APR_STRINGIFY(APR_PATCH_VERSION) \ APR_IS_DEV_STRING /** An alternative formatted string of APR's version */ /* macro for Win32 .rc files using numeric csv representation */ #define APR_VERSION_STRING_CSV APR_MAJOR_VERSION ##, \ ##APR_MINOR_VERSION ##, \ ##APR_PATCH_VERSION #ifndef APR_VERSION_ONLY /* The C language API to access the version at run time, * as opposed to compile time. APR_VERSION_ONLY may be defined * externally when preprocessing apr_version.h to obtain strictly * the C Preprocessor macro declarations. */ #include "apr.h" #ifdef __cplusplus extern "C" { #endif /** * The numeric version information is broken out into fields within this * structure. */ typedef struct { int major; /**< major number */ int minor; /**< minor number */ int patch; /**< patch number */ int is_dev; /**< is development (1 or 0) */ } apr_version_t; /** * Return APR's version information information in a numeric form. * * @param pvsn Pointer to a version structure for returning the version * information. */ APR_DECLARE(void) apr_version(apr_version_t *pvsn); /** Return APR's version information as a string. */ APR_DECLARE(const char *) apr_version_string(void); #ifdef __cplusplus } #endif #endif /* ndef APR_VERSION_ONLY */ #endif /* ndef APR_VERSION_H */
/* * Copyright(C) 2017 Davidson Francis <davidsondfgl@gmail.com> * * This file is part of Nanvix. * * Nanvix 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. * * Nanvix 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 Nanvix. If not, see <http://www.gnu.org/licenses/>. */ /* * Copyright (c) 1994-2009 Red Hat, Inc. All rights reserved. * * This copyrighted material is made available to anyone wishing to use, * modify, copy, or redistribute it subject to the terms and conditions * of the BSD License. This program is distributed in the hope that * it will be useful, but WITHOUT ANY WARRANTY expressed or implied, * including the implied warranties of MERCHANTABILITY or FITNESS FOR * A PARTICULAR PURPOSE. A copy of this license is available at * http://www.opensource.org/licenses. Any Red Hat trademarks that are * incorporated in the source code or documentation are not subject to * the BSD License and may only be used or replicated with the express * permission of Red Hat, Inc. */ /* * Copyright (c) 1981-2000 The Regents of the University of California. * All rights reserved. * * Redistribution and use in source and binary forms, with or without modification, * are permitted provided that the following conditions are met: * * * Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. * * Redistributions in binary form must reproduce the above copyright notice, * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * * Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. * IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY * OF SUCH DAMAGE. */ #include <ctype.h> /** * @brief Tests for a blank character. * * @details Tests whether @p c is a character of class blank in the * current locale. The @p c argument is an int, the value of which the * application shall ensure is representable as an unsigned char or * equal to the value of the macro #EOF. If the argument has any other * value, the behavior is undefined. * * @param Character to test. * * @returns Returns non-zero if @p c is a blank character; otherwise, * it returns 0. */ int isblank(int c) { return ((__ctype_ptr__[c+1] & _B) || (c == '\t')); }
/* * Copyright (c) 2012 Matthew Arsenault * * This file is part of Milkway@Home. * * Milkyway@Home 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. * * Milkyway@Home 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 Milkyway@Home. If not, see <http://www.gnu.org/licenses/>. */ #ifndef _NBODY_GL_PARTICLE_TEXTURE_H_ #define _NBODY_GL_PARTICLE_TEXTURE_H_ #ifdef __cplusplus extern "C" { #endif GLuint nbglCreateParticleTexture(int resolution); #ifdef __cplusplus } #endif #endif /* _NBODY_GL_PARTICLE_TEXTURE_H_*/
// $Id: cmd.h 1307 2007-03-14 22:22:36Z hieuhoang1972 $ #if !defined(CMD_H) #define CMD_H #define CMDDOUBLETYPE 1 #define CMDENUMTYPE 2 #define CMDINTTYPE 3 #define CMDSTRINGTYPE 4 #define CMDSUBRANGETYPE 5 #define CMDGTETYPE 6 #define CMDLTETYPE 7 #define CMDSTRARRAYTYPE 8 #define CMDBOOLTYPE 9 typedef struct { char *Name; int Idx; } Enum_T; typedef struct { int Type; char *Name, *ArgStr; void *Val, *p; } Cmd_T; #ifdef __cplusplus extern "C" { #endif #if defined(__STDC__) || defined(WIN32) int DeclareParams(char *, ...); #else int DeclareParams(); #endif int GetParams(int *n, char ***a,char *CmdFileName), SPrintParams(), PrintParams(); #ifdef __cplusplus } #endif #endif
/********************************************************************* Author: Soonho Kong dReal -- Copyright (C) 2013 - 2016, the dReal Team dReal 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. dReal 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 dReal. If not, see <http://www.gnu.org/licenses/>. *********************************************************************/ #pragma once #include <unordered_map> #include "api/OpenSMTContext.h" #include "opensmt/api/OpenSMTContext.h" #include "opensmt/egraph/Egraph.h" #include "opensmt/egraph/Enode.h" class Egraph; class Enode; class OpenSMTContext; namespace dreal { /// strengthening a constraint (Enode) by eps (positive constant) Enode * strengthen_enode(Egraph & eg, Enode * const e, double const eps, bool const polarity); /// Add forall quantifier if Enode e includes universally quantified variables Enode * wrap_enode_including_forall_vars(OpenSMTContext * ctx, Enode * const e); /// Susbtitute e with a map (Enode -> Enode) Enode * subst(OpenSMTContext & ctx, Enode * e, std::unordered_map<Enode *, Enode *> const & m); } // namespace dreal
/* * Copyright (C) 2010-2013 Groupement d'Intérêt Public pour l'Education Numérique en Afrique (GIP ENA) * * This file is part of Open-Sankoré. * * Open-Sankoré 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, * with a specific linking exception for the OpenSSL project's * "OpenSSL" library (or with modified versions of it that use the * same license as the "OpenSSL" library). * * Open-Sankoré 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 Open-Sankoré. If not, see <http://www.gnu.org/licenses/>. */ #if !defined Filter_h #define Filter_h #include <vector> #include <map> #include <string> namespace merge_lib { class Object; class Decoder; //this class is needed to parse object in order to create //all decoders to decode object's stream class Filter { public: Filter(Object * objectWithStream): _objectWithStream(objectWithStream) { _createAllDecodersSet(); } virtual ~Filter(); //replace coded stream with decoded void getDecodedStream(std::string & stream); private: //methods //parse object's content and fill out vector with //necessary decoders std::vector <Decoder * > _getDecoders(); void _createAllDecodersSet(); //members Object * _objectWithStream; static std::map<std::string, Decoder *> _allDecoders; }; } #endif
/* * Copyright (C) 2010 Franz Leitl, Embedded Systems Lab * * This file is part of the CRN Toolbox. * The CRN Toolbox is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published * by the Free Software Foundation; either version 2.1 of the License, or * (at your option) any later version. * The CRN Toolbox is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * You should have received a copy of the GNU Lesser General Public License * along with the CRN Toolbox; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ /** * This header contains all kind of tweaks and hacks to get the toolbox * running cross platform. */ /** * Cross-platform version for "sys/time.h". */ // On Unix platforms there is usually a sys/time header. #if defined(PLATFORM_OPERATINGSYSTEM_UNIX) # include <sys/time.h> #endif #if defined(WIN32) || defined(_WIN32) // TODO can we include <sys/time.h> here to? Maybe on MinGW or Cygwin at least? // # include <sys/time.h> # include <windows.h> // HACK replace lower-case unix sleep with windows-like upper-case Sleep. # define sleep Sleep // HACK ugly hack... # ifndef timeradd // Implement the function timeradd # define timeradd(a, b, result) \ (result)->tv_sec = (a)->tv_sec + (b)->tv_sec; \ (result)->tv_usec = (a)->tv_usec + (b)->tv_usec; \ if ((result)->tv_usec >= 1000000) \ { \ ++(result)->tv_sec; \ (result)->tv_usec -= 1000000; \ } \ # endif // HACK ugly hack... // Implement the function timersub # ifndef timersub # define timersub(a, b, result) \ (result)->tv_sec = (a)->tv_sec - (b)->tv_sec; \ (result)->tv_usec = (a)->tv_usec - (b)->tv_usec; \ if ((result)->tv_usec < 0) { \ --(result)->tv_sec; \ (result)->tv_usec += 1000000; \ } \ # endif void usleep(__int64 usec) { HANDLE timer; LARGE_INTEGER ft; ft.QuadPart = -(10*usec); // Convert to 100 nanosecond interval, negative value indicates relative time timer = CreateWaitableTimer(NULL, TRUE, NULL); SetWaitableTimer(timer, &ft, 0, NULL, NULL, 0); WaitForSingleObject(timer, INFINITE); CloseHandle(timer); } #endif
/* SPDX-License-Identifier: LGPL-2.1+ */ #include "config.h" #include <errno.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <unistd.h> #include "file_utils.h" #include "macro.h" #include "memory_utils.h" #include "process_utils.h" #include "rexec.h" #include "string_utils.h" #include "syscall_wrappers.h" #if IS_BIONIC #include "fexecve.h" #endif #define LXC_MEMFD_REXEC_SEALS \ (F_SEAL_SEAL | F_SEAL_SHRINK | F_SEAL_GROW | F_SEAL_WRITE) static int push_vargs(char *data, int data_length, char ***output) { int num = 0; char *cur = data; if (!data || *output) return -1; *output = must_realloc(NULL, sizeof(**output)); while (cur < data + data_length) { num++; *output = must_realloc(*output, (num + 1) * sizeof(**output)); (*output)[num - 1] = cur; cur += strlen(cur) + 1; } (*output)[num] = NULL; return num; } static int parse_argv(char ***argv) { __do_free char *cmdline = NULL; int ret; size_t cmdline_size; cmdline = file_to_buf("/proc/self/cmdline", &cmdline_size); if (!cmdline) return -1; ret = push_vargs(cmdline, cmdline_size, argv); if (ret <= 0) return -1; move_ptr(cmdline); return 0; } static int is_memfd(void) { __do_close int fd = -EBADF; int seals; fd = open("/proc/self/exe", O_RDONLY | O_CLOEXEC); if (fd < 0) return -ENOTRECOVERABLE; seals = fcntl(fd, F_GET_SEALS); if (seals < 0) { struct stat s = {0}; if (fstat(fd, &s) == 0) return (s.st_nlink == 0); return -EINVAL; } return seals == LXC_MEMFD_REXEC_SEALS; } static void lxc_rexec_as_memfd(char **argv, char **envp, const char *memfd_name) { __do_close int execfd = -EBADF, fd = -EBADF, memfd = -EBADF, tmpfd = -EBADF; int ret; ssize_t bytes_sent = 0; struct stat st = {0}; memfd = memfd_create(memfd_name, MFD_ALLOW_SEALING | MFD_CLOEXEC); if (memfd < 0) { char template[PATH_MAX]; ret = strnprintf(template, sizeof(template), P_tmpdir "/.%s_XXXXXX", memfd_name); if (ret < 0) return; tmpfd = lxc_make_tmpfile(template, true); if (tmpfd < 0) return; ret = fchmod(tmpfd, 0700); if (ret) return; } fd = open("/proc/self/exe", O_RDONLY | O_CLOEXEC); if (fd < 0) return; /* sendfile() handles up to 2GB. */ ret = fstat(fd, &st); if (ret) return; while (bytes_sent < st.st_size) { ssize_t sent; sent = lxc_sendfile_nointr(memfd >= 0 ? memfd : tmpfd, fd, NULL, st.st_size - bytes_sent); if (sent < 0) { /* * Fallback to shoveling data between kernel- and * userspace. */ if (lseek(fd, 0, SEEK_SET) == (off_t) -1) fprintf(stderr, "Failed to seek to beginning of file"); if (fd_to_fd(fd, memfd >= 0 ? memfd : tmpfd)) break; return; } bytes_sent += sent; } close_prot_errno_disarm(fd); if (memfd >= 0) { if (fcntl(memfd, F_ADD_SEALS, LXC_MEMFD_REXEC_SEALS)) return; execfd = move_fd(memfd); } else { char procfd[LXC_PROC_PID_FD_LEN]; ret = strnprintf(procfd, sizeof(procfd), "/proc/self/fd/%d", tmpfd); if (ret < 0) return; execfd = open(procfd, O_PATH | O_CLOEXEC); close_prot_errno_disarm(tmpfd); } if (execfd < 0) return; fexecve(execfd, argv, envp); } /* * Get cheap access to the environment. This must be declared by the user as * mandated by POSIX. The definition is located in unistd.h. */ extern char **environ; int lxc_rexec(const char *memfd_name) { __do_free_string_list char **argv = NULL; int ret; ret = is_memfd(); if (ret < 0 && ret == -ENOTRECOVERABLE) { fprintf(stderr, "%s - Failed to determine whether this is a memfd\n", strerror(errno)); return -1; } else if (ret > 0) { return 0; } ret = parse_argv(&argv); if (ret < 0) { fprintf(stderr, "%s - Failed to parse command line parameters\n", strerror(errno)); return -1; } lxc_rexec_as_memfd(argv, environ, memfd_name); fprintf(stderr, "%s - Failed to rexec as memfd\n", strerror(errno)); return -1; } /** * This function will copy any binary that calls liblxc into a memory file and * will use the memfd to rexecute the binary. This is done to prevent attacks * through the /proc/self/exe symlink to corrupt the host binary when host and * container are in the same user namespace or have set up an identity id * mapping: CVE-2019-5736. */ __attribute__((constructor)) static void liblxc_rexec(void) { if (getenv("LXC_MEMFD_REXEC") && lxc_rexec("liblxc")) { fprintf(stderr, "Failed to re-execute liblxc via memory file descriptor\n"); _exit(EXIT_FAILURE); } }
#ifndef _Valency_H #define _Valency_H #include "../common/utilit.h" #include "../common/cortege.h" #include "../StructDictLib/StructDictConsts.h" enum Valency_Direction { A_C, C_A}; typedef TCortege10 TCortege; class CRossHolder; struct CValency { Valency_Direction m_Direction; string m_RelationStr; long m_RelationId; BYTE m_LeafId; BYTE m_BracketLeafId; WORD m_UnitNo; bool m_IsAddition; const CRossHolder* m_RossHolder; bool m_InstrAgent; // ýòî âàëåíòíîñòü ïîìå÷åíà ! bool m_bObligatory; // ýòî âàëåíòíîñòü ñ÷èòàåòñÿ îáÿçàòåëüíîé, ïîòîìó ÷òî // îíà ïåðâàÿ â âàëåíòíîé ñòðóêòóðå bool m_bObligatoryBecauseFirst; // ýòî âàëåíòíîñòü ïîìå÷åíà ? bool m_bOptional; bool IsFromDict () const; bool operator == ( const CValency& X) const; CValency (string RelationStr, Valency_Direction Direction, const CRossHolder* Ross = 0, BYTE LeafId = 0, BYTE BracketLeafId = 0, WORD UnitNo = ErrUnitNo); CValency(); CValency( const TCortege C, const long MainWordVarNo, const CRossHolder* Ross, unsigned short UnitNo = ErrUnitNo ); }; #endif
/**************************************************************************** ** ** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). ** Contact: http://www.qt-project.org/legal ** ** This file is part of the test suite of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL21$ ** Commercial License Usage ** Licensees holding valid commercial Qt licenses may use this file in ** accordance with the commercial license agreement provided with the ** Software or, alternatively, in accordance with the terms contained in ** a written agreement between you and Digia. For licensing terms and ** conditions see http://qt.digia.com/licensing. For further information ** use the contact form at http://qt.digia.com/contact-us. ** ** GNU Lesser General Public License Usage ** Alternatively, this file may be used under the terms of the GNU Lesser ** General Public License version 2.1 or version 3 as published by the Free ** Software Foundation and appearing in the file LICENSE.LGPLv21 and ** LICENSE.LGPLv3 included in the packaging of this file. Please review the ** following information to ensure the GNU Lesser General Public License ** requirements will be met: https://www.gnu.org/licenses/lgpl.html and ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ** ** In addition, as a special exception, Digia gives you certain additional ** rights. These rights are described in the Digia Qt LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** $QT_END_LICENSE$ ** ****************************************************************************/ #ifndef TESTTYPES_H #define TESTTYPES_H #include <QtCore/qobject.h> #include <QtQml/qqml.h> class MyQmlObject : public QObject { Q_OBJECT Q_PROPERTY(int result READ result WRITE setResult) Q_PROPERTY(int value READ value WRITE setValue NOTIFY valueChanged) Q_PROPERTY(MyQmlObject *object READ object WRITE setObject NOTIFY objectChanged) Q_PROPERTY(QQmlListProperty<QObject> data READ data) Q_CLASSINFO("DefaultProperty", "data") public: MyQmlObject() : m_result(0), m_value(0), m_object(0) {} int result() const { return m_result; } void setResult(int r) { m_result = r; } int value() const { return m_value; } void setValue(int v) { m_value = v; emit valueChanged(); } QQmlListProperty<QObject> data() { return QQmlListProperty<QObject>(this, m_data); } MyQmlObject *object() const { return m_object; } void setObject(MyQmlObject *o) { m_object = o; emit objectChanged(); } signals: void valueChanged(); void objectChanged(); private: QList<QObject *> m_data; int m_result; int m_value; MyQmlObject *m_object; }; QML_DECLARE_TYPE(MyQmlObject); void registerTypes(); #endif // TESTTYPES_H
//****************************************************************** // // Copyright 2014 Intel Mobile Communications GmbH All Rights Reserved. // //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= #ifndef OCCLIENT_BASICOPS_H_ #define OCCLIENT_BASICOPS_H_ #include "ocstack.h" //----------------------------------------------------------------------------- // Defines //----------------------------------------------------------------------------- #define DEFAULT_CONTEXT_VALUE 0x99 //----------------------------------------------------------------------------- // Typedefs //----------------------------------------------------------------------------- /** * List of methods that can be inititated from the client */ typedef enum { TEST_DISCOVER_REQ = 1, TEST_NON_CON_OP, TEST_CON_OP, MAX_TESTS } CLIENT_TEST; /** * List of connectivity types that can be initiated from the client * Required for user input validation */ typedef enum { CT_ADAPTER_DEFAULT = 0, CT_IP, MAX_CT } CLIENT_CONNECTIVITY_TYPE; //----------------------------------------------------------------------------- // Function prototype //----------------------------------------------------------------------------- /* Get the IP address of the server */ std::string getIPAddrTBServer(OCClientResponse * clientResponse); /* Get the port number the server is listening on */ std::string getPortTBServer(OCClientResponse * clientResponse); /* Returns the query string for GET and PUT operations */ std::string getQueryStrForGetPut(OCClientResponse * clientResponse); /* Following are initialization functions for GET, PUT * POST & Discovery operations */ int InitPutRequest(OCDevAddr *endpoint, OCQualityOfService qos); int InitGetRequest(OCDevAddr *endpoint, OCQualityOfService qos); int InitPostRequest(OCDevAddr *endpoint, OCQualityOfService qos); int InitDiscovery(); /* Function to retrieve ip address, port no. of the server * and query for the operations to be performed. */ int parseClientResponse(OCClientResponse * clientResponse); /* This method calls OCDoResource() which in turn makes calls * to the lower layers */ OCStackResult InvokeOCDoResource(std::ostringstream &query, OCMethod method, OCQualityOfService qos, OCClientResponseHandler cb, OCHeaderOption * options, uint8_t numOptions); //----------------------------------------------------------------------------- // Callback functions //----------------------------------------------------------------------------- /* Following are callback functions for the GET, PUT * POST & Discovery operations */ OCStackApplicationResult putReqCB(void* ctx, OCDoHandle handle, OCClientResponse * clientResponse); OCStackApplicationResult postReqCB(void *ctx, OCDoHandle handle, OCClientResponse *clientResponse); OCStackApplicationResult getReqCB(void* ctx, OCDoHandle handle, OCClientResponse * clientResponse); OCStackApplicationResult discoveryReqCB(void* ctx, OCDoHandle handle, OCClientResponse * clientResponse); #endif
/* $NetBSD: n_tan.c,v 1.5 2003/08/07 16:44:52 agc Exp $ */ /* * Copyright (c) 1987, 1993 * The Regents of the University of California. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. */ #ifndef lint #if 0 static char sccsid[] = "@(#)tan.c 8.1 (Berkeley) 6/4/93"; #endif #endif /* not lint */ #include "mathimpl.h" #include "trig.h" double tan(double x) { double a,z,ss,cc,c; int k; if(!finite(x)) /* tan(NaN) and tan(INF) must be NaN */ return x-x; x = drem(x,PI); /* reduce x into [-PI/2, PI/2] */ a = copysign(x,__one); /* ... = abs(x) */ if (a >= PIo4) { k = 1; x = copysign(PIo2-a,x); } else { k = 0; if (a < __small) { z=__big+a; return x; } } z = x*x; cc = cos__C(z); ss = sin__S(z); z *= __half; /* Next get c = cos(x) accurately */ c = (z >= thresh ? __half-((z-__half)-cc) : __one-(z-cc)); if (k == 0) return x+(x*(z-(cc-ss)))/c; /* ... sin/cos */ #ifdef national else if (x == __zero) return copysign(fmax,x); /* no inf on 32k */ #endif /* national */ else return c/(x+x*ss); /* ... cos/sin */ }
/* * Explosion.h * * Created on: 04.06.2013 * Author: Planke */ #ifndef EXPLOSION_H_ #define EXPLOSION_H_ #include "BW_Animation.h" class Explosion: public BW_Animation { public: Explosion(); virtual ~Explosion(); virtual void fillAnimationPictures(); }; #endif /* EXPLOSION_H_ */
/***************************************************************************** * _ _ ____ _ * Project ___| | | | _ \| | * / __| | | | |_) | | * | (__| |_| | _ <| |___ * \___|\___/|_| \_\_____| * */ #include "setup.h" #include "sethostname.h" /* * we force our own host name, in order to make some tests machine independent */ int gethostname(char *name, GETHOSTNAME_TYPE_ARG2 namelen) { const char *force_hostname = getenv("CURL_GETHOSTNAME"); if(force_hostname) { strncpy(name, force_hostname, namelen); name[namelen-1] = '\0'; return 0; } /* LD_PRELOAD used, but no hostname set, we'll just return a failure */ return -1; }
/** @file @brief Header @date 2015 @author Sensics, Inc. <http://sensics.com/osvr> */ // Copyright 2015 Sensics, Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. #ifndef INCLUDED_StringIds_h_GUID_080FD2D7_0F0B_438B_E71E_7D2836C8921B #define INCLUDED_StringIds_h_GUID_080FD2D7_0F0B_438B_E71E_7D2836C8921B // Internal Includes #include <osvr/Util/TypeSafeId.h> // Library/third-party includes // - none // Standard includes // - none namespace osvr { namespace util { struct LocalStringIdTag; struct PeerStringIdTag; typedef TypeSafeId<LocalStringIdTag> StringID; typedef TypeSafeId<PeerStringIdTag> PeerStringID; } // namespace util } // namespace osvr #endif // INCLUDED_StringIds_h_GUID_080FD2D7_0F0B_438B_E71E_7D2836C8921B
/*========================================================================= * * Copyright Insight Software Consortium * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0.txt * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * *=========================================================================*/ #include "itkComplexToComplexFFTImageFilter.h" #ifndef itkVnlComplexToComplexFFTImageFilter_h #define itkVnlComplexToComplexFFTImageFilter_h namespace itk { /** \class VnlComplexToComplexFFTImageFilter * * \brief VNL based complex to complex Fast Fourier Transform. * * This filter requires input images with sizes which are a power of two. * * \ingroup FourierTransform * \ingroup ITKFFT * * \sa ComplexToComplexFFTImageFilter * \sa FFTWComplexToComplexFFTImageFilter * \sa VnlForwardFFTImageFilter * \sa VnlInverseFFTImageFilter */ template< typename TImage > class ITK_TEMPLATE_EXPORT VnlComplexToComplexFFTImageFilter: public ComplexToComplexFFTImageFilter< TImage > { public: ITK_DISALLOW_COPY_AND_ASSIGN(VnlComplexToComplexFFTImageFilter); /** Standard class type aliases. */ using Self = VnlComplexToComplexFFTImageFilter; using Superclass = ComplexToComplexFFTImageFilter< TImage >; using Pointer = SmartPointer< Self >; using ConstPointer = SmartPointer< const Self >; using ImageType = TImage; using PixelType = typename ImageType::PixelType; using InputImageType = typename Superclass::InputImageType; using OutputImageType = typename Superclass::OutputImageType; using OutputImageRegionType = typename OutputImageType::RegionType; /** Method for creation through the object factory. */ itkNewMacro(Self); /** Run-time type information (and related methods). */ itkTypeMacro(VnlComplexToComplexFFTImageFilter, ComplexToComplexFFTImageFilter); static constexpr unsigned int ImageDimension = ImageType::ImageDimension; protected: VnlComplexToComplexFFTImageFilter(); ~VnlComplexToComplexFFTImageFilter() override = default; void BeforeThreadedGenerateData() override; void DynamicThreadedGenerateData(const OutputImageRegionType & outputRegionForThread) override; }; } // end namespace itk #ifndef ITK_MANUAL_INSTANTIATION #include "itkVnlComplexToComplexFFTImageFilter.hxx" #endif #endif //itkVnlComplexToComplexFFTImageFilter_h
/* CEDraggableArrayController.h CotEditor http://coteditor.com Created by 1024jp on 2014-08-18. ------------------------------------------------------------------------------ © 2014 1024jp Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ @import Cocoa; @interface CEDraggableArrayController : NSArrayController <NSTableViewDataSource> @end
//===-- Variable.h -----------------------------------------------*- C++-*-===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// #ifndef liblldb_Variable_h_ #define liblldb_Variable_h_ #include "lldb/Core/Mangled.h" #include "lldb/Expression/DWARFExpression.h" #include "lldb/Symbol/Declaration.h" #include "lldb/Utility/CompletionRequest.h" #include "lldb/Utility/RangeMap.h" #include "lldb/Utility/UserID.h" #include "lldb/lldb-enumerations.h" #include "lldb/lldb-private.h" #include <memory> #include <vector> namespace lldb_private { class Variable : public UserID, public std::enable_shared_from_this<Variable> { public: typedef RangeVector<lldb::addr_t, lldb::addr_t> RangeList; /// Constructors and Destructors. /// /// \param mangled The mangled or fully qualified name of the variable. Variable(lldb::user_id_t uid, const char *name, const char *mangled, const lldb::SymbolFileTypeSP &symfile_type_sp, lldb::ValueType scope, SymbolContextScope *owner_scope, const RangeList &scope_range, Declaration *decl, const DWARFExpression &location, bool external, bool artificial, bool static_member = false); virtual ~Variable(); void Dump(Stream *s, bool show_context) const; bool DumpDeclaration(Stream *s, bool show_fullpaths, bool show_module); const Declaration &GetDeclaration() const { return m_declaration; } ConstString GetName() const; ConstString GetUnqualifiedName() const; SymbolContextScope *GetSymbolContextScope() const { return m_owner_scope; } /// Since a variable can have a basename "i" and also a mangled named /// "_ZN12_GLOBAL__N_11iE" and a demangled mangled name "(anonymous /// namespace)::i", this function will allow a generic match function that can /// be called by commands and expression parsers to make sure we match /// anything we come across. bool NameMatches(ConstString name) const; bool NameMatches(const RegularExpression &regex) const; Type *GetType(); lldb::LanguageType GetLanguage() const; lldb::ValueType GetScope() const { return m_scope; } bool IsExternal() const { return m_external; } bool IsArtificial() const { return m_artificial; } bool IsStaticMember() const { return m_static_member; } DWARFExpression &LocationExpression() { return m_location; } const DWARFExpression &LocationExpression() const { return m_location; } bool DumpLocationForAddress(Stream *s, const Address &address); size_t MemorySize() const; void CalculateSymbolContext(SymbolContext *sc); bool IsInScope(StackFrame *frame); bool LocationIsValidForFrame(StackFrame *frame); bool LocationIsValidForAddress(const Address &address); bool GetLocationIsConstantValueData() const { return m_loc_is_const_data; } void SetLocationIsConstantValueData(bool b) { m_loc_is_const_data = b; } typedef size_t (*GetVariableCallback)(void *baton, const char *name, VariableList &var_list); static Status GetValuesForVariableExpressionPath( llvm::StringRef variable_expr_path, ExecutionContextScope *scope, GetVariableCallback callback, void *baton, VariableList &variable_list, ValueObjectList &valobj_list); static void AutoComplete(const ExecutionContext &exe_ctx, CompletionRequest &request); CompilerDeclContext GetDeclContext(); CompilerDecl GetDecl(); protected: /// The basename of the variable (no namespaces). ConstString m_name; /// The mangled name of the variable. Mangled m_mangled; /// The type pointer of the variable (int, struct, class, etc) /// global, parameter, local. lldb::SymbolFileTypeSP m_symfile_type_sp; lldb::ValueType m_scope; /// The symbol file scope that this variable was defined in SymbolContextScope *m_owner_scope; /// The list of ranges inside the owner's scope where this variable /// is valid. RangeList m_scope_range; /// Declaration location for this item. Declaration m_declaration; /// The location of this variable that can be fed to /// DWARFExpression::Evaluate(). DWARFExpression m_location; /// Visible outside the containing compile unit? unsigned m_external : 1; /// Non-zero if the variable is not explicitly declared in source. unsigned m_artificial : 1; /// The m_location expression contains the constant variable value /// data, not a DWARF location. unsigned m_loc_is_const_data : 1; /// Non-zero if variable is static member of a class or struct. unsigned m_static_member : 1; private: Variable(const Variable &rhs) = delete; Variable &operator=(const Variable &rhs) = delete; }; } // namespace lldb_private #endif // liblldb_Variable_h_
/* Copyright 2015 Google Inc. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. ==============================================================================*/ #ifndef TENSORFLOW_PLATFORM_DEFAULT_INTEGRAL_TYPES_H_ #define TENSORFLOW_PLATFORM_DEFAULT_INTEGRAL_TYPES_H_ namespace tensorflow { typedef signed char int8; typedef short int16; typedef int int32; typedef long long int64; typedef unsigned char uint8; typedef unsigned short uint16; typedef unsigned int uint32; typedef unsigned long long uint64; } // namespace tensorflow #endif // TENSORFLOW_PLATFORM_DEFAULT_INTEGRAL_TYPES_H_
/*************************************************************************/ /* */ /* Centre for Speech Technology Research */ /* University of Edinburgh, UK */ /* Copyright (c) 1996 */ /* All Rights Reserved. */ /* */ /* Permission is hereby granted, free of charge, to use and distribute */ /* this software and its documentation without restriction, including */ /* without limitation the rights to use, copy, modify, merge, publish, */ /* distribute, sublicense, and/or sell copies of this work, and to */ /* permit persons to whom this work is furnished to do so, subject to */ /* the following conditions: */ /* 1. The code must retain the above copyright notice, this list of */ /* conditions and the following disclaimer. */ /* 2. Any modifications must be clearly marked as such. */ /* 3. Original authors' names are not deleted. */ /* 4. The authors' names are not used to endorse or promote products */ /* derived from this software without specific prior written */ /* permission. */ /* */ /* THE UNIVERSITY OF EDINBURGH AND THE CONTRIBUTORS TO THIS WORK */ /* DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING */ /* ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT */ /* SHALL THE UNIVERSITY OF EDINBURGH NOR THE CONTRIBUTORS BE LIABLE */ /* FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES */ /* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN */ /* AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, */ /* ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF */ /* THIS SOFTWARE. */ /* */ /*************************************************************************/ /* Author : Alan W Black */ /* Date : May 1996 */ /*=======================================================================*/ /* Shared (private) audio declarations */ /* */ /*=======================================================================*/ #ifndef __AUDIOP_H__ #define __AUDIOP_H__ int play_nas_wave(EST_Wave &inwave, EST_Option &al); int play_esd_wave(EST_Wave &inwave, EST_Option &al); int play_sun16_wave(EST_Wave &inwave, EST_Option &al); int play_linux_wave(EST_Wave &inwave, EST_Option &al); int play_mplayer_wave(EST_Wave &inwave, EST_Option &al); int play_win32audio_wave(EST_Wave &inwave, EST_Option &al); int play_irix_wave(EST_Wave &inwave, EST_Option &al); int play_macosx_wave(EST_Wave &inwave, EST_Option &al); int record_nas_wave(EST_Wave &inwave, EST_Option &al); int record_esd_wave(EST_Wave &inwave, EST_Option &al); int record_sun16_wave(EST_Wave &inwave, EST_Option &al); int record_linux_wave(EST_Wave &inwave, EST_Option &al); #endif /* __AUDIOP_H__ */
// Copyright (c) 2012 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 CHROME_BROWSER_UI_COCOA_MENU_CONTROLLER_H_ #define CHROME_BROWSER_UI_COCOA_MENU_CONTROLLER_H_ #import <Cocoa/Cocoa.h> #include "base/memory/scoped_nsobject.h" #include "base/string16.h" namespace ui { class MenuModel; } // A controller for the cross-platform menu model. The menu that's created // has the tag and represented object set for each menu item. The object is a // NSValue holding a pointer to the model for that level of the menu (to // allow for hierarchical menus). The tag is the index into that model for // that particular item. It is important that the model outlives this object // as it only maintains weak references. @interface MenuController : NSObject<NSMenuDelegate> { @protected ui::MenuModel* model_; // weak scoped_nsobject<NSMenu> menu_; BOOL useWithPopUpButtonCell_; // If YES, 0th item is blank BOOL isMenuOpen_; } @property(nonatomic, assign) ui::MenuModel* model; // Note that changing this will have no effect if you use // |-initWithModel:useWithPopUpButtonCell:| or after the first call to |-menu|. @property(nonatomic) BOOL useWithPopUpButtonCell; + (string16)elideMenuTitle:(const string16&)title toWidth:(int)width; // NIB-based initializer. This does not create a menu. Clients can set the // properties of the object and the menu will be created upon the first call to // |-menu|. Note that the menu will be immutable after creation. - (id)init; // Builds a NSMenu from the pre-built model (must not be nil). Changes made // to the contents of the model after calling this will not be noticed. If // the menu will be displayed by a NSPopUpButtonCell, it needs to be of a // slightly different form (0th item is empty). Note this attribute of the menu // cannot be changed after it has been created. - (id)initWithModel:(ui::MenuModel*)model useWithPopUpButtonCell:(BOOL)useWithCell; // Programmatically close the constructed menu. - (void)cancel; // Access to the constructed menu if the complex initializer was used. If the // default initializer was used, then this will create the menu on first call. - (NSMenu*)menu; // Whether the menu is currently open. - (BOOL)isMenuOpen; // NSMenuDelegate methods this class implements. Subclasses should call super // if extending the behavior. - (void)menuWillOpen:(NSMenu*)menu; - (void)menuDidClose:(NSMenu*)menu; @end // Exposed only for unit testing, do not call directly. @interface MenuController (PrivateExposedForTesting) - (BOOL)validateUserInterfaceItem:(id<NSValidatedUserInterfaceItem>)item; @end // Protected methods that subclassers can override. @interface MenuController (Protected) - (void)addItemToMenu:(NSMenu*)menu atIndex:(NSInteger)index fromModel:(ui::MenuModel*)model; - (NSMenu*)menuFromModel:(ui::MenuModel*)model; // Returns the maximum width for the menu item. Returns -1 to indicate // that there's no maximum width. - (int)maxWidthForMenuModel:(ui::MenuModel*)model modelIndex:(int)modelIndex; @end #endif // CHROME_BROWSER_UI_COCOA_MENU_CONTROLLER_H_
#include "gif_lib.h" #include "assert.h" #include <stdint.h> #include <stdlib.h> #include <string.h> struct gifUserData { size_t gifLen; size_t allocatedSize; uint8_t *gifData; }; extern "C" int GifQuantizeBuffer(unsigned int Width, unsigned int Height, int *ColorMapSize, GifByteType * RedInput, GifByteType * GreenInput, GifByteType * BlueInput, GifByteType * OutputBuffer, GifColorType * OutputColorMap); int stub_output_writer(GifFileType *gifFileType, GifByteType *gifByteType, int len); int fuzz_egif(const uint8_t *Data, size_t Size);
#pragma once #include "InMemoryTrie.h" #include <fstream> #include <ostream> #include <string> #include <vector> #include "legacy/Util2.h" #include "../legacy/Factor.h" #include "../legacy/InputFileStream.h" using namespace std; namespace Moses2 { inline void ParseLineByChar(string& line, char c, vector<string>& substrings) { size_t i = 0; size_t j = line.find(c); while (j != string::npos) { substrings.push_back(line.substr(i, j - i)); i = ++j; j = line.find(c, j); if (j == string::npos) substrings.push_back(line.substr(i, line.length())); } } }
void msrand48(uint64_t initial); float merand48(uint64_t& initial); float frand48();
// Copyright 2013 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 CHROME_BROWSER_CHROMEOS_LOGIN_LOGIN_MANAGER_TEST_H_ #define CHROME_BROWSER_CHROMEOS_LOGIN_LOGIN_MANAGER_TEST_H_ #include <string> #include "chrome/browser/chromeos/login/mixin_based_browser_test.h" #include "chrome/browser/chromeos/login/test/https_forwarder.h" #include "chrome/browser/chromeos/login/test/js_checker.h" #include "google_apis/gaia/fake_gaia.h" namespace content { class WebContents; } // namespace content namespace chromeos { class UserContext; // Base class for Chrome OS out-of-box/login WebUI tests. // If no special configuration is done launches out-of-box WebUI. // To launch login UI use PRE_* test that will register user(s) and mark // out-of-box as completed. // Guarantees that WebUI has been initialized by waiting for // NOTIFICATION_LOGIN_OR_LOCK_WEBUI_VISIBLE notification. class LoginManagerTest : public MixinBasedBrowserTest { public: explicit LoginManagerTest(bool should_launch_browser); ~LoginManagerTest() override; // Overridden from InProcessBrowserTest. void TearDownOnMainThread() override; void SetUpCommandLine(base::CommandLine* command_line) override; void SetUpInProcessBrowserTestFixture() override; void SetUpOnMainThread() override; void SetUp() override; // Registers the user with the given |user_id| on the device. // This method should be called in PRE_* test. // TODO(dzhioev): Add the ability to register users without a PRE_* test. void RegisterUser(const std::string& user_id); // Set expected credentials for next login attempt. void SetExpectedCredentials(const UserContext& user_context); // Tries to login with the credentials in |user_context|. The return value // indicates whether the login attempt succeeded. bool TryToLogin(const UserContext& user_context); // Tries to add the user identified and authenticated by |user_context| to the // session. The return value indicates whether the attempt succeeded. This // method does the same as TryToLogin() but doesn't verify that the new user // has become the active user. bool AddUserToSession(const UserContext& user_context); // Log in user with |user_id|. User should be registered using RegisterUser(). void LoginUser(const std::string& user_id); // Add user with |user_id| to session. void AddUser(const std::string& user_id); // Executes given JS |expression| in |web_contents_| and checks // that it is true. void JSExpect(const std::string& expression); content::WebContents* web_contents() { return web_contents_; } test::JSChecker& js_checker() { return js_checker_; } static std::string GetGaiaIDForUserID(const std::string& user_id); // For obviously consumer users (that have e.g. @gmail.com e-mail) policy // fetching code is skipped. This code is executed only for users that may be // enterprise users. Thus if you derive from this class and don't need // policies, please use @gmail.com e-mail for login. But if you need policies // for your test, you must use e-mail addresses that a) have a potentially // enterprise domain and b) have been registered with |fake_gaia_|. // For your convenience, the e-mail addresses for users that have been set up // in this way are provided below. static const char kEnterpriseUser1[]; static const char kEnterpriseUser2[]; protected: FakeGaia fake_gaia_; HTTPSForwarder gaia_https_forwarder_; private: void InitializeWebContents(); void set_web_contents(content::WebContents* web_contents) { web_contents_ = web_contents; } bool should_launch_browser_; content::WebContents* web_contents_; test::JSChecker js_checker_; DISALLOW_COPY_AND_ASSIGN(LoginManagerTest); }; } // namespace chromeos #endif // CHROME_BROWSER_CHROMEOS_LOGIN_LOGIN_MANAGER_TEST_H_
/* * Copyright (c) 2010 The WebM project authors. All Rights Reserved. * * Use of this source code is governed by a BSD-style license * that can be found in the LICENSE file in the root of the source * tree. An additional intellectual property rights grant can be found * in the file PATENTS. All contributing project authors may * be found in the AUTHORS file in the root of the source tree. */ /**************************************************************************** * * Module Title : preproc.h * * Description : simple preprocessor * ****************************************************************************/ #ifndef __INC_PREPROC_H #define __INC_PREPROC_H /**************************************************************************** * Types ****************************************************************************/ typedef struct { unsigned char *frame_buffer; int frame; unsigned int *fixed_divide; unsigned char *frame_buffer_alloc; unsigned int *fixed_divide_alloc; } pre_proc_instance; /**************************************************************************** * Functions. ****************************************************************************/ void pre_proc_machine_specific_config(void); void delete_pre_proc(pre_proc_instance *ppi); int init_pre_proc(pre_proc_instance *ppi, int frame_size); extern void spatial_filter_c(pre_proc_instance *ppi, unsigned char *s, unsigned char *d, int width, int height, int pitch, int strength); extern void (*temp_filter)(pre_proc_instance *ppi, unsigned char *s, unsigned char *d, int bytes, int strength); #endif
// Copyright 2013 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 CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_DISPATCHER_HOST_H_ #define CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_DISPATCHER_HOST_H_ #include <vector> #include "base/id_map.h" #include "base/memory/weak_ptr.h" #include "base/strings/string16.h" #include "content/browser/service_worker/service_worker_registration_status.h" #include "content/public/browser/browser_message_filter.h" class GURL; struct EmbeddedWorkerHostMsg_ReportConsoleMessage_Params; namespace content { class MessagePortMessageFilter; class ServiceWorkerContextCore; class ServiceWorkerContextWrapper; class ServiceWorkerHandle; class ServiceWorkerProviderHost; class ServiceWorkerRegistration; class ServiceWorkerRegistrationHandle; class CONTENT_EXPORT ServiceWorkerDispatcherHost : public BrowserMessageFilter { public: ServiceWorkerDispatcherHost( int render_process_id, MessagePortMessageFilter* message_port_message_filter); void Init(ServiceWorkerContextWrapper* context_wrapper); // BrowserMessageFilter implementation virtual void OnFilterAdded(IPC::Sender* sender) OVERRIDE; virtual void OnDestruct() const OVERRIDE; virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; // IPC::Sender implementation // Send() queues the message until the underlying sender is ready. This // class assumes that Send() can only fail after that when the renderer // process has terminated, at which point the whole instance will eventually // be destroyed. virtual bool Send(IPC::Message* message) OVERRIDE; void RegisterServiceWorkerHandle(scoped_ptr<ServiceWorkerHandle> handle); void RegisterServiceWorkerRegistrationHandle( scoped_ptr<ServiceWorkerRegistrationHandle> handle); MessagePortMessageFilter* message_port_message_filter() { return message_port_message_filter_; } protected: virtual ~ServiceWorkerDispatcherHost(); private: friend class BrowserThread; friend class base::DeleteHelper<ServiceWorkerDispatcherHost>; friend class TestingServiceWorkerDispatcherHost; // IPC Message handlers void OnRegisterServiceWorker(int thread_id, int request_id, int provider_id, const GURL& pattern, const GURL& script_url); void OnUnregisterServiceWorker(int thread_id, int request_id, int provider_id, const GURL& pattern); void OnProviderCreated(int provider_id); void OnProviderDestroyed(int provider_id); void OnSetHostedVersionId(int provider_id, int64 version_id); void OnWorkerScriptLoaded(int embedded_worker_id); void OnWorkerScriptLoadFailed(int embedded_worker_id); void OnWorkerStarted(int thread_id, int embedded_worker_id); void OnWorkerStopped(int embedded_worker_id); void OnPausedAfterDownload(int embedded_worker_id); void OnReportException(int embedded_worker_id, const base::string16& error_message, int line_number, int column_number, const GURL& source_url); void OnReportConsoleMessage( int embedded_worker_id, const EmbeddedWorkerHostMsg_ReportConsoleMessage_Params& params); void OnPostMessage(int handle_id, const base::string16& message, const std::vector<int>& sent_message_port_ids); void OnIncrementServiceWorkerRefCount(int handle_id); void OnDecrementServiceWorkerRefCount(int handle_id); void OnIncrementRegistrationRefCount(int registration_handle_id); void OnDecrementRegistrationRefCount(int registration_handle_id); void OnPostMessageToWorker(int handle_id, const base::string16& message, const std::vector<int>& sent_message_port_ids); void OnServiceWorkerObjectDestroyed(int handle_id); ServiceWorkerHandle* FindHandle( int provider_id, int64 version_id); ServiceWorkerRegistrationHandle* FindRegistrationHandle( int provider_id, int64 registration_id); // Callbacks from ServiceWorkerContextCore void RegistrationComplete(int thread_id, int provider_id, int request_id, ServiceWorkerStatusCode status, int64 registration_id, int64 version_id); void UnregistrationComplete(int thread_id, int request_id, ServiceWorkerStatusCode status); void SendRegistrationError(int thread_id, int request_id, ServiceWorkerStatusCode status); ServiceWorkerContextCore* GetContext(); int render_process_id_; MessagePortMessageFilter* const message_port_message_filter_; scoped_refptr<ServiceWorkerContextWrapper> context_wrapper_; IDMap<ServiceWorkerHandle, IDMapOwnPointer> handles_; IDMap<ServiceWorkerRegistrationHandle, IDMapOwnPointer> registration_handles_; bool channel_ready_; // True after BrowserMessageFilter::sender_ != NULL. ScopedVector<IPC::Message> pending_messages_; DISALLOW_COPY_AND_ASSIGN(ServiceWorkerDispatcherHost); }; } // namespace content #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_DISPATCHER_HOST_H_
/*- * Copyright (c) 1983, 1992, 1993 * The Regents of the University of California. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 4. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS 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. */ #if 0 #ifndef lint static char const copyright[] = "@(#) Copyright (c) 1983, 1992, 1993\n\ The Regents of the University of California. All rights reserved.\n"; #endif /* not lint */ #ifndef lint static char sccsid[] = "@(#)mkdir.c 8.2 (Berkeley) 1/25/94"; #endif /* not lint */ #endif #include <sys/cdefs.h> __FBSDID("$FreeBSD$"); #include <sys/types.h> #include <sys/stat.h> #include <err.h> #include <errno.h> #include <libgen.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <sysexits.h> #include <unistd.h> static int build(char *, mode_t); static void usage(void); static int vflag; int main(int argc, char *argv[]) { int ch, exitval, success, pflag; mode_t omode; void *set = NULL; char *mode; omode = pflag = 0; mode = NULL; while ((ch = getopt(argc, argv, "m:pv")) != -1) switch(ch) { case 'm': mode = optarg; break; case 'p': pflag = 1; break; case 'v': vflag = 1; break; case '?': default: usage(); } argc -= optind; argv += optind; if (argv[0] == NULL) usage(); if (mode == NULL) { omode = S_IRWXU | S_IRWXG | S_IRWXO; } else { if ((set = setmode(mode)) == NULL) errx(1, "invalid file mode: %s", mode); omode = getmode(set, S_IRWXU | S_IRWXG | S_IRWXO); free(set); } for (exitval = 0; *argv != NULL; ++argv) { if (pflag) { success = build(*argv, omode); } else if (mkdir(*argv, omode) < 0) { if (errno == ENOTDIR || errno == ENOENT) warn("%s", dirname(*argv)); else warn("%s", *argv); success = 0; } else { success = 1; if (vflag) (void)printf("%s\n", *argv); } if (!success) exitval = 1; /* * The mkdir() and umask() calls both honor only the low * nine bits, so if you try to set a mode including the * sticky, setuid, setgid bits you lose them. Don't do * this unless the user has specifically requested a mode, * as chmod will (obviously) ignore the umask. Do this * on newly created directories only. */ if (success == 1 && mode != NULL && chmod(*argv, omode) == -1) { warn("%s", *argv); exitval = 1; } } exit(exitval); } /* * Returns 1 if a directory has been created, * 2 if it already existed, and 0 on failure. */ static int build(char *path, mode_t omode) { struct stat sb; mode_t numask, oumask; int first, last, retval; char *p; p = path; oumask = 0; retval = 1; if (p[0] == '/') /* Skip leading '/'. */ ++p; for (first = 1, last = 0; !last ; ++p) { if (p[0] == '\0') last = 1; else if (p[0] != '/') continue; *p = '\0'; if (!last && p[1] == '\0') last = 1; if (first) { /* * POSIX 1003.2: * For each dir operand that does not name an existing * directory, effects equivalent to those caused by the * following command shall occcur: * * mkdir -p -m $(umask -S),u+wx $(dirname dir) && * mkdir [-m mode] dir * * We change the user's umask and then restore it, * instead of doing chmod's. */ oumask = umask(0); numask = oumask & ~(S_IWUSR | S_IXUSR); (void)umask(numask); first = 0; } if (last) (void)umask(oumask); if (mkdir(path, last ? omode : S_IRWXU | S_IRWXG | S_IRWXO) < 0) { if (errno == EEXIST || errno == EISDIR) { if (stat(path, &sb) < 0) { warn("%s", path); retval = 0; break; } else if (!S_ISDIR(sb.st_mode)) { if (last) errno = EEXIST; else errno = ENOTDIR; warn("%s", path); retval = 0; break; } if (last) retval = 2; } else { warn("%s", path); retval = 0; break; } } else if (vflag) printf("%s\n", path); if (!last) *p = '/'; } if (!first && !last) (void)umask(oumask); return (retval); } static void usage(void) { (void)fprintf(stderr, "usage: mkdir [-pv] [-m mode] directory_name ...\n"); exit (EX_USAGE); }
/*----------------------------------------------------------------------------*/ /* Copyright (c) FIRST 2016-2017. All Rights Reserved. */ /* Open Source Software - may be modified and shared by FRC teams. The code */ /* must be accompanied by the FIRST BSD license file in the root directory of */ /* the project. */ /*----------------------------------------------------------------------------*/ #pragma once #include <stdint.h> #ifdef __cplusplus extern "C" { #endif void HAL_InitializeI2C(int32_t port, int32_t* status); int32_t HAL_TransactionI2C(int32_t port, int32_t deviceAddress, uint8_t* dataToSend, int32_t sendSize, uint8_t* dataReceived, int32_t receiveSize); int32_t HAL_WriteI2C(int32_t port, int32_t deviceAddress, uint8_t* dataToSend, int32_t sendSize); int32_t HAL_ReadI2C(int32_t port, int32_t deviceAddress, uint8_t* buffer, int32_t count); void HAL_CloseI2C(int32_t port); #ifdef __cplusplus } #endif
/* * Copyright (c) 2013-2015 CohortFS, LLC. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR `AS IS'' AND ANY EXPRESS OR * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ /** * @file pool_queue.h * @author William Allen Simpson <bill@cohortfs.com> * @brief Pthreads-based TAILQ package * * @section DESCRIPTION * * This provides simple queues using pthreads and TAILQ primitives. * * @note Loosely based upon previous wait_queue by * Matt Benjamin <matt@cohortfs.com> */ #ifndef POOL_QUEUE_H #define POOL_QUEUE_H #include <pthread.h> #include <sys/types.h> #include <misc/queue.h> struct poolq_entry { TAILQ_ENTRY(poolq_entry) q; /*** 1st ***/ u_int qsize; /* allocated size of q entry, * 0: default size */ u_int qflags; }; struct poolq_head { TAILQ_HEAD(q_head, poolq_entry) qh; pthread_mutex_t qmutex; u_int qsize; /* default size of q entries, * 0: static size */ int qcount; /* number of entries, * < 0: has waiting workers. */ }; static inline void poolq_head_destroy(struct poolq_head *qh) { pthread_mutex_destroy(&qh->qmutex); } static inline void poolq_head_setup(struct poolq_head *qh) { TAILQ_INIT(&qh->qh); pthread_mutex_init(&qh->qmutex, NULL); qh->qcount = 0; } #endif /* POOL_QUEUE_H */
//-***************************************************************************** // // Copyright (c) 2009-2012, // Sony Pictures Imageworks, Inc. and // Industrial Light & Magic, a division of Lucasfilm Entertainment Company Ltd. // // All rights reserved. // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are // met: // * Redistributions of source code must retain the above copyright // notice, this list of conditions and the following disclaimer. // * Redistributions in binary form must reproduce the above // copyright notice, this list of conditions and the following disclaimer // in the documentation and/or other materials provided with the // distribution. // * Neither the name of Sony Pictures Imageworks, nor // Industrial Light & Magic nor the names of their contributors may be used // to endorse or promote products derived from this software without specific // prior written permission. // // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // //-***************************************************************************** #ifndef _AbcOpenGL_IPolyMeshDrw_h_ #define _AbcOpenGL_IPolyMeshDrw_h_ #include "Foundation.h" #include "IObjectDrw.h" #include "MeshDrwHelper.h" namespace AbcOpenGL { namespace ABCOPENGL_VERSION_NS { //-***************************************************************************** //! Draw a poly mesh! class IPolyMeshDrw : public IObjectDrw { public: IPolyMeshDrw( IPolyMesh &iPmesh ); virtual ~IPolyMeshDrw(); virtual bool valid(); virtual void setTime( chrono_t iSeconds ); virtual void draw( const DrawContext & iCtx ); protected: IPolyMesh m_polyMesh; IPolyMeshSchema::Sample m_samp; IBox3dProperty m_boundsProp; MeshDrwHelper m_drwHelper; }; } // End namespace ABCOPENGL_VERSION_NS using namespace ABCOPENGL_VERSION_NS; } // End namespace AbcOpenGL #endif
// Copyright 2014 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 COMPONENTS_INVALIDATION_PUBLIC_INVALIDATION_H_ #define COMPONENTS_INVALIDATION_PUBLIC_INVALIDATION_H_ #include <stdint.h> #include <string> #include "base/memory/scoped_ptr.h" #include "base/memory/weak_ptr.h" #include "base/sequenced_task_runner.h" #include "base/values.h" #include "components/invalidation/public/ack_handle.h" #include "components/invalidation/public/invalidation_export.h" #include "google/cacheinvalidation/include/types.h" namespace syncer { class DroppedInvalidationTracker; class AckHandler; // Represents a local invalidation, and is roughly analogous to // invalidation::Invalidation. Unlike invalidation::Invalidation, this class // supports "local" ack-tracking and simple serialization to pref values. class INVALIDATION_EXPORT Invalidation { public: // Factory functions. static Invalidation Init(const invalidation::ObjectId& id, int64_t version, const std::string& payload); static Invalidation InitUnknownVersion(const invalidation::ObjectId& id); static Invalidation InitFromDroppedInvalidation(const Invalidation& dropped); static scoped_ptr<Invalidation> InitFromValue( const base::DictionaryValue& value); Invalidation(const Invalidation& other); ~Invalidation(); // Compares two invalidations. The comparison ignores ack-tracking state. bool Equals(const Invalidation& other) const; invalidation::ObjectId object_id() const; bool is_unknown_version() const; // Safe to call only if is_unknown_version() returns false. int64_t version() const; // Safe to call only if is_unknown_version() returns false. const std::string& payload() const; const AckHandle& ack_handle() const; // Sets the AckHandler to be used to track this Invalidation. // // This should be set by the class that generates the invalidation. Clients // of the Invalidations API should not need to call this. // // Note that some sources of invalidations do not support ack tracking, and do // not set the ack_handler. This will be hidden from users of this class. void SetAckHandler( base::WeakPtr<AckHandler> handler, scoped_refptr<base::SequencedTaskRunner> handler_task_runner); // Returns whether or not this instance supports ack tracking. This will // depend on whether or not the source of invaliadations supports // invalidations. // // Clients can safely ignore this flag. They can assume that all // invalidations support ack tracking. If they're wrong, then invalidations // will be less reliable, but their behavior will be no less correct. bool SupportsAcknowledgement() const; // Acknowledges the receipt of this invalidation. // // Clients should call this on a received invalidation when they have fully // processed the invalidation and persisted the results to disk. Once this // function is called, the invalidations system is under no obligation to // re-deliver this invalidation in the event of a crash or restart. void Acknowledge() const; // Informs the ack tracker that this invalidation will not be serviced. // // If a client's buffer reaches its limit and it is forced to start dropping // invalidations, it should call this function before dropping its // invalidations in order to allow the ack tracker to drop the invalidation, // too. // // To indicate recovery from a drop event, the client should call // Acknowledge() on the most recently dropped inavlidation. void Drop(); scoped_ptr<base::DictionaryValue> ToValue() const; std::string ToString() const; private: Invalidation(const invalidation::ObjectId& id, bool is_unknown_version, int64_t version, const std::string& payload, AckHandle ack_handle); // The ObjectId to which this invalidation belongs. invalidation::ObjectId id_; // This flag is set to true if this is an unknown version invalidation. bool is_unknown_version_; // The version number of this invalidation. Should not be accessed if this is // an unkown version invalidation. int64_t version_; // The payaload associated with this invalidation. Should not be accessed if // this is an unknown version invalidation. std::string payload_; // A locally generated unique ID used to manage local acknowledgements. AckHandle ack_handle_; // The acknowledgement tracking handler and its thread. base::WeakPtr<AckHandler> ack_handler_; scoped_refptr<base::SequencedTaskRunner> ack_handler_task_runner_; }; } // namespace syncer #endif // COMPONENTS_INVALIDATION_PUBLIC_INVALIDATION_H_
/*========================================================================= Program: Visualization Toolkit Module: vtkDataSetWriter.h Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen All rights reserved. See Copyright.txt or http://www.kitware.com/Copyright.htm for details. This software is distributed WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the above copyright notice for more information. =========================================================================*/ // .NAME vtkDataSetWriter - write any type of vtk dataset to file // .SECTION Description // vtkDataSetWriter is an abstract class for mapper objects that write their // data to disk (or into a communications port). The input to this object is // a dataset of any type. #ifndef __vtkDataSetWriter_h #define __vtkDataSetWriter_h #include "vtkIOLegacyModule.h" // For export macro #include "vtkDataWriter.h" class VTKIOLEGACY_EXPORT vtkDataSetWriter : public vtkDataWriter { public: static vtkDataSetWriter *New(); vtkTypeMacro(vtkDataSetWriter,vtkDataWriter); void PrintSelf(ostream& os, vtkIndent indent); // Description: // Get the input to this writer. vtkDataSet* GetInput(); vtkDataSet* GetInput(int port); protected: vtkDataSetWriter() {} ~vtkDataSetWriter() {} void WriteData(); virtual int FillInputPortInformation(int port, vtkInformation *info); private: vtkDataSetWriter(const vtkDataSetWriter&); // Not implemented. void operator=(const vtkDataSetWriter&); // Not implemented. }; #endif
// // IDownloadService.h // EOSFramework // // Created by Sam Chang on 1/11/13. // // #import <Foundation/Foundation.h> #import "DownloadInfo.h" @protocol IDownloadService <NSObject> - (DownloadInfo *) add: (NSString *) urlString; - (DownloadInfo *) add: (NSString *) urlString : (NSString *) cachekey; - (DownloadInfo *) query: (NSString *) infoid; - (BOOL) _LUA_delete: (NSString *) infoid; - (DownloadInfo *) pause: (NSString *) infoid; - (DownloadInfo *) resume: (NSString *) infoid; - (DownloadInfo *) stop: (NSString *) infoid; - (void) pauseAll; - (void) resumeAll; - (void) stopAll; @end
// // MinimalExampleViewController.h // LeavesExamples // // Created by Tom Brow on 4/20/10. // Copyright 2010 Tom Brow. All rights reserved. // #import "LeavesViewController.h" @interface ProceduralExampleViewController : LeavesViewController @end
#ifndef org_apache_lucene_search_FieldCache$Bytes_H #define org_apache_lucene_search_FieldCache$Bytes_H #include "java/lang/Object.h" namespace java { namespace lang { class Class; } } template<class T> class JArray; namespace org { namespace apache { namespace lucene { namespace search { class FieldCache$Bytes : public ::java::lang::Object { public: enum { mid_init$_54c6a166, mid_get_39c7bd28, max_mid }; static ::java::lang::Class *class$; static jmethodID *mids$; static bool live$; static jclass initializeClass(bool); explicit FieldCache$Bytes(jobject obj) : ::java::lang::Object(obj) { if (obj != NULL) env->getClass(initializeClass); } FieldCache$Bytes(const FieldCache$Bytes& obj) : ::java::lang::Object(obj) {} static FieldCache$Bytes *EMPTY; FieldCache$Bytes(); jbyte get(jint) const; }; } } } } #include <Python.h> namespace org { namespace apache { namespace lucene { namespace search { extern PyTypeObject PY_TYPE(FieldCache$Bytes); class t_FieldCache$Bytes { public: PyObject_HEAD FieldCache$Bytes object; static PyObject *wrap_Object(const FieldCache$Bytes&); static PyObject *wrap_jobject(const jobject&); static void install(PyObject *module); static void initialize(PyObject *module); }; } } } } #endif
#ifndef org_apache_lucene_queries_function_valuesource_DoubleFieldSource_H #define org_apache_lucene_queries_function_valuesource_DoubleFieldSource_H #include "org/apache/lucene/queries/function/valuesource/FieldCacheSource.h" namespace org { namespace apache { namespace lucene { namespace index { class AtomicReaderContext; } namespace search { class FieldCache$DoubleParser; } namespace queries { namespace function { class FunctionValues; } } } } } namespace java { namespace lang { class Object; class Class; class String; } namespace util { class Map; } namespace io { class IOException; } } template<class T> class JArray; namespace org { namespace apache { namespace lucene { namespace queries { namespace function { namespace valuesource { class DoubleFieldSource : public ::org::apache::lucene::queries::function::valuesource::FieldCacheSource { public: enum { mid_init$_5fdc3f48, mid_init$_5456b073, mid_description_14c7b5c5, mid_equals_290588e2, mid_getValues_4c566485, mid_hashCode_54c6a179, max_mid }; static ::java::lang::Class *class$; static jmethodID *mids$; static bool live$; static jclass initializeClass(bool); explicit DoubleFieldSource(jobject obj) : ::org::apache::lucene::queries::function::valuesource::FieldCacheSource(obj) { if (obj != NULL) env->getClass(initializeClass); } DoubleFieldSource(const DoubleFieldSource& obj) : ::org::apache::lucene::queries::function::valuesource::FieldCacheSource(obj) {} DoubleFieldSource(const ::java::lang::String &); DoubleFieldSource(const ::java::lang::String &, const ::org::apache::lucene::search::FieldCache$DoubleParser &); ::java::lang::String description() const; jboolean equals(const ::java::lang::Object &) const; ::org::apache::lucene::queries::function::FunctionValues getValues(const ::java::util::Map &, const ::org::apache::lucene::index::AtomicReaderContext &) const; jint hashCode() const; }; } } } } } } #include <Python.h> namespace org { namespace apache { namespace lucene { namespace queries { namespace function { namespace valuesource { extern PyTypeObject PY_TYPE(DoubleFieldSource); class t_DoubleFieldSource { public: PyObject_HEAD DoubleFieldSource object; static PyObject *wrap_Object(const DoubleFieldSource&); static PyObject *wrap_jobject(const jobject&); static void install(PyObject *module); static void initialize(PyObject *module); }; } } } } } } #endif
// // This source file is part of appleseed. // Visit http://appleseedhq.net/ for additional information and resources. // // This software is released under the MIT license. // // Copyright (c) 2010-2013 Francois Beaune, Jupiter Jazz Limited // Copyright (c) 2014-2017 Francois Beaune, The appleseedhq Organization // // 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 APPLESEED_RENDERER_MODELING_PROJECT_EVENTCOUNTERS_H #define APPLESEED_RENDERER_MODELING_PROJECT_EVENTCOUNTERS_H // appleseed.foundation headers. #include "foundation/core/concepts/noncopyable.h" // Standard headers. #include <cstddef> namespace renderer { // // Warning and error counters. // class EventCounters : public foundation::NonCopyable { public: // Constructor, resets all counters. EventCounters(); // Reset all counters. void clear(); // Signal one or several warnings. void signal_warning(); void signal_warnings(const size_t warning_count); // Signal one or several errors. void signal_error(); void signal_errors(const size_t error_count); // Read the event counters. size_t get_warning_count() const; size_t get_error_count() const; bool has_errors() const; private: size_t m_warning_count; size_t m_error_count; }; // // EventCounters class implementation. // inline EventCounters::EventCounters() { clear(); } inline void EventCounters::clear() { m_warning_count = 0; m_error_count = 0; } inline void EventCounters::signal_warning() { ++m_warning_count; } inline void EventCounters::signal_warnings(const size_t warning_count) { m_warning_count += warning_count; } inline void EventCounters::signal_error() { ++m_error_count; } inline void EventCounters::signal_errors(const size_t error_count) { m_error_count += error_count; } inline size_t EventCounters::get_warning_count() const { return m_warning_count; } inline size_t EventCounters::get_error_count() const { return m_error_count; } inline bool EventCounters::has_errors() const { return m_error_count > 0; } } // namespace renderer #endif // !APPLESEED_RENDERER_MODELING_PROJECT_EVENTCOUNTERS_H
/* Copyright (c) 2011, 2013, The Linux Foundation. All rights reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 and * only version 2 as published by the Free Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * * Subsystem Notifier -- Provides notifications * of subsys events. * * Use subsys_notif_register_notifier to register for notifications * and subsys_notif_queue_notification to send notifications. * */ #include <linux/notifier.h> #include <linux/init.h> #include <linux/debugfs.h> #include <linux/module.h> #include <linux/workqueue.h> #include <linux/stringify.h> #include <linux/delay.h> #include <linux/slab.h> #include <mach/subsystem_notif.h> struct subsys_notif_info { char name[50]; struct srcu_notifier_head subsys_notif_rcvr_list; struct list_head list; }; static LIST_HEAD(subsystem_list); static DEFINE_MUTEX(notif_lock); static DEFINE_MUTEX(notif_add_lock); #if defined(SUBSYS_RESTART_DEBUG) static void subsys_notif_reg_test_notifier(const char *); #endif static struct subsys_notif_info *_notif_find_subsys(const char *subsys_name) { struct subsys_notif_info *subsys; mutex_lock(&notif_lock); list_for_each_entry(subsys, &subsystem_list, list) if (!strncmp(subsys->name, subsys_name, ARRAY_SIZE(subsys->name))) { mutex_unlock(&notif_lock); return subsys; } mutex_unlock(&notif_lock); return NULL; } void *subsys_notif_register_notifier( const char *subsys_name, struct notifier_block *nb) { int ret; struct subsys_notif_info *subsys = _notif_find_subsys(subsys_name); if (!subsys) { /* Possible first time reference to this subsystem. Add it. */ subsys = (struct subsys_notif_info *) subsys_notif_add_subsys(subsys_name); if (!subsys) return ERR_PTR(-EINVAL); } ret = srcu_notifier_chain_register( &subsys->subsys_notif_rcvr_list, nb); if (ret < 0) return ERR_PTR(ret); return subsys; } EXPORT_SYMBOL(subsys_notif_register_notifier); int subsys_notif_unregister_notifier(void *subsys_handle, struct notifier_block *nb) { int ret; struct subsys_notif_info *subsys = (struct subsys_notif_info *)subsys_handle; if (!subsys) return -EINVAL; ret = srcu_notifier_chain_unregister( &subsys->subsys_notif_rcvr_list, nb); return ret; } EXPORT_SYMBOL(subsys_notif_unregister_notifier); void *subsys_notif_add_subsys(const char *subsys_name) { struct subsys_notif_info *subsys = NULL; if (!subsys_name) goto done; mutex_lock(&notif_add_lock); subsys = _notif_find_subsys(subsys_name); if (subsys) { mutex_unlock(&notif_add_lock); goto done; } subsys = kmalloc(sizeof(struct subsys_notif_info), GFP_KERNEL); if (!subsys) { mutex_unlock(&notif_add_lock); return ERR_PTR(-EINVAL); } strlcpy(subsys->name, subsys_name, ARRAY_SIZE(subsys->name)); srcu_init_notifier_head(&subsys->subsys_notif_rcvr_list); INIT_LIST_HEAD(&subsys->list); mutex_lock(&notif_lock); list_add_tail(&subsys->list, &subsystem_list); mutex_unlock(&notif_lock); #if defined(SUBSYS_RESTART_DEBUG) subsys_notif_reg_test_notifier(subsys->name); #endif mutex_unlock(&notif_add_lock); done: return subsys; } EXPORT_SYMBOL(subsys_notif_add_subsys); int subsys_notif_queue_notification(void *subsys_handle, enum subsys_notif_type notif_type, void *data) { int ret = 0; struct subsys_notif_info *subsys = (struct subsys_notif_info *) subsys_handle; if (!subsys) return -EINVAL; if (notif_type < 0 || notif_type >= SUBSYS_NOTIF_TYPE_COUNT) return -EINVAL; ret = srcu_notifier_call_chain( &subsys->subsys_notif_rcvr_list, notif_type, data); return ret; } EXPORT_SYMBOL(subsys_notif_queue_notification); #if defined(SUBSYS_RESTART_DEBUG) static const char *notif_to_string(enum subsys_notif_type notif_type) { switch (notif_type) { case SUBSYS_BEFORE_SHUTDOWN: return __stringify(SUBSYS_BEFORE_SHUTDOWN); case SUBSYS_AFTER_SHUTDOWN: return __stringify(SUBSYS_AFTER_SHUTDOWN); case SUBSYS_BEFORE_POWERUP: return __stringify(SUBSYS_BEFORE_POWERUP); case SUBSYS_AFTER_POWERUP: return __stringify(SUBSYS_AFTER_POWERUP); default: return "unknown"; } } static int subsys_notifier_test_call(struct notifier_block *this, unsigned long code, void *data) { switch (code) { default: printk(KERN_WARNING "%s: Notification %s from subsystem %p\n", __func__, notif_to_string(code), data); break; } return NOTIFY_DONE; } static struct notifier_block nb = { .notifier_call = subsys_notifier_test_call, }; static void subsys_notif_reg_test_notifier(const char *subsys_name) { void *handle = subsys_notif_register_notifier(subsys_name, &nb); printk(KERN_WARNING "%s: Registered test notifier, handle=%p", __func__, handle); } #endif MODULE_DESCRIPTION("Subsystem Restart Notifier"); MODULE_VERSION("1.0"); MODULE_LICENSE("GPL v2");
#ifndef NTL_pair_ZZX_long__H #define NTL_pair_ZZX_long__H #include <NTL/pair.h> #include <NTL/vector.h> #include <NTL/ZZX.h> NTL_OPEN_NNS typedef Pair<ZZX,long> pair_ZZX_long; typedef Vec<pair_ZZX_long> vec_pair_ZZX_long; NTL_CLOSE_NNS #endif
/* MAPIStoreFAIMessage.h - this file is part of SOGo * * Copyright (C) 2011-2012 Inverse inc * * Author: Wolfgang Sourdeau <wsourdeau@inverse.ca> * * This file is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2, or (at your option) * any later version. * * This file 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; see the file COPYING. If not, write to * the Free Software Foundation, Inc., 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. */ #ifndef MAPISTOREFAIMESSAGE_H #define MAPISTOREFAIMESSAGE_H #import "MAPIStoreDBMessage.h" @interface MAPIStoreFAIMessage : MAPIStoreDBMessage @end #endif /* MAPISTOREFAIMESSAGE_H */
/* * Copyright (C) 2012 Dino Hensen, Vincent van Hoek * * This file is part of Paparazzi. * * Paparazzi is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2, or (at your option) * any later version. * * Paparazzi is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with Paparazzi; see the file COPYING. If not, write to * the Free Software Foundation, 59 Temple Place - Suite 330, * Boston, MA 02111-1307, USA. */ /** * @file boards/ardrone/navdata.h * ardrone2 navdata aquisition driver. * * The ardrone2 provides a navdata stream of packets * containing info about all sensors at a rate of 200Hz. */ #ifndef NAVDATA_H_ #define NAVDATA_H_ #include <stdint.h> #define NAVDATA_PACKET_SIZE 60 #define NAVDATA_BUFFER_SIZE 80 #define NAVDATA_START_BYTE 0x3a typedef struct { uint8_t isInitialized; uint8_t isOpen; uint16_t bytesRead; uint32_t totalBytesRead; uint32_t packetsRead; uint8_t buffer[NAVDATA_BUFFER_SIZE]; } navdata_port; typedef struct { uint16_t taille; uint16_t nu_trame; uint16_t ax; uint16_t ay; uint16_t az; int16_t vx; int16_t vy; int16_t vz; uint16_t temperature_acc; uint16_t temperature_gyro; uint16_t ultrasound; uint16_t us_debut_echo; uint16_t us_fin_echo; uint16_t us_association_echo; uint16_t us_distance_echo; uint16_t us_curve_time; uint16_t us_curve_value; uint16_t us_curve_ref; uint16_t nb_echo; uint32_t sum_echo; //unsigned long int16_t gradient; uint16_t flag_echo_ini; int32_t pressure; //long int16_t temperature_pressure; int16_t mx; int16_t my; int16_t mz; uint16_t chksum; } __attribute__ ((packed)) measures_t; measures_t* navdata; navdata_port* port; uint16_t navdata_cks; uint8_t navdata_imu_available; uint8_t navdata_baro_available; int16_t previousUltrasoundHeight; int navdata_init(void); void navdata_close(void); void navdata_read(void); void navdata_update(void); void navdata_CropBuffer(int cropsize); uint16_t navdata_checksum(void); int16_t navdata_getHeight(void); #endif /* NAVDATA_H_ */
#define _FILE_OFFSET_BITS 64 #include <sys/statvfs.h> #include <sys/statfs.h> void __statvfs_cvt(struct statfs* from,struct statvfs* to); void __statvfs_cvt(struct statfs* from,struct statvfs* to) { to->f_bsize=from->f_bsize; to->f_frsize=from->f_frsize; to->f_blocks=from->f_blocks; to->f_bfree=from->f_bfree; to->f_bavail=from->f_bavail; to->f_files=from->f_files; to->f_ffree=from->f_ffree; to->f_favail=from->f_ffree; to->f_fsid=from->f_fsid.__val[0]; to->f_flag=0; to->f_namemax=from->f_namelen; }
/* * Copyright (c) Bull S.A. 2007 All Rights Reserved. * * This program is free software; you can redistribute it and/or modify it * under the terms of version 2 of the GNU General Public License as * published by the Free Software Foundation. * * This program is distributed in the hope that it would be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * * Further, this software is distributed without any warranty that it is * free of the rightful claim of any third person regarding infringement * or the like. Any license provided herein, whether implied or * otherwise, applies only to this software file. Patent licenses, if * any, provided herein do not apply to combinations of this program with * other software, or any other product whatsoever. * * 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. * * History: * Created by: Cyril Lacabanne (Cyril.Lacabanne@bull.net) * */ #include <stdlib.h> #include <stdio.h> #include <netinet/in.h> #include <errno.h> #include "rpc.h" //Standard define #define PROCNUM 10 #define VERSNUM 1 //Sys define #define ADDRBUFSIZE 100 int main(int argn, char *argc[]) { //Program parameters : argc[1] : HostName or Host IP // argc[2] : Server Program Number // other arguments depend on test case //run_mode can switch into stand alone program or program launch by shell script //1 : stand alone, debug mode, more screen information //0 : launch by shell script as test case, only one printf -> result status int run_mode = 0; int test_status = 1; //Default test result set to FAILED int progNum = atoi(argc[2]); CLIENT *client = NULL; struct netconfig *nconf = NULL; struct netbuf svcaddr; char addrbuf[ADDRBUFSIZE]; enum clnt_stat cs; int var_snd = 0; struct timeval tv; //Initialization if (run_mode) { printf("Before creation\n"); } tv.tv_sec = 1; tv.tv_usec = 0; nconf = getnetconfigent("udp"); if (nconf == NULL) { //syslog(LOG_ERR, "getnetconfigent for udp failed"); printf("err nconf\n"); exit(1); } svcaddr.len = 0; svcaddr.maxlen = ADDRBUFSIZE; svcaddr.buf = addrbuf; if (svcaddr.buf == NULL) { /* if malloc() failed, print error messages and exit */ return 1; } //printf("svcaddr reserved (%s)\n", argc[1]); if (!rpcb_getaddr(progNum, VERSNUM, nconf, &svcaddr, argc[1])) { fprintf(stderr, "rpcb_getaddr failed!!\n"); exit(1); } //printf("svc get\n"); client = clnt_tli_create(RPC_ANYFD, nconf, &svcaddr, progNum, VERSNUM, 0, 0); /* Wrong Program Version */ cs = clnt_call(client, PROCNUM, (xdrproc_t) xdr_int, (char *)&var_snd, (xdrproc_t) xdr_int, (char *)&var_snd, tv); test_status = (cs == RPC_SYSTEMERROR) ? 0 : 1; //This last printf gives the result status to the tests suite //normally should be 0: test has passed or 1: test has failed printf("%d\n", test_status); clnt_destroy(client); return test_status; }
// SPDX-License-Identifier: GPL-2.0-or-later /* * Copyright (c) 2017 Richard Palethorpe <rpalethorpe@suse.com> * Original POC by Daniel Jiang */ /* * Test for CVE-2017-2671 faulty locking on ping socket * * When sys_connect() is called with sockaddr.sin_family set to AF_UNSPEC on a * ping socket; __udp_disconnect() gets called, which in turn calls the buggy * function ping_unhashed(). This function does not obtain a rwlock before * checking if the socket is hashed allowing the socket data to be pulled from * underneath it in the time between calling sk_hashed() and gaining the write * lock. * * Fixed in commit 43a6684519ab0a6c52024b5e25322476cabad893 * * This test repeatedly 'connects' a ping socket correctly then calls * connect() with AF_UNSPEC in two seperate threads to trigger the race * condition. If the bug is present, then the test will most likely crash the * system. * * The test requests root privileges so that it can ensure ping sockets are * enabled. On distributions (including Android) where ping sockets are * enabled by default, root privileges are not required. */ #include <unistd.h> #include <stdio.h> #include <sys/socket.h> #include <arpa/inet.h> #include <stdlib.h> #include "tst_test.h" #include "tst_safe_net.h" #include "tst_safe_pthread.h" #include "tst_fuzzy_sync.h" #define ATTEMPTS 0x80000 #define PING_SYSCTL_PATH "/proc/sys/net/ipv4/ping_group_range" static int sockfd; static unsigned int ping_min_grp, ping_max_grp; static struct tst_fzsync_pair fzsync_pair; static struct sockaddr_in iaddr, uaddr; static void *connect_b(void *); static void setup(void) { iaddr.sin_addr.s_addr = htonl(INADDR_LOOPBACK); uaddr = iaddr; iaddr.sin_family = AF_INET; uaddr.sin_family = AF_UNSPEC; if (access(PING_SYSCTL_PATH, F_OK)) tst_brk(TCONF, "socket() does not support IPPROTO_ICMP"); SAFE_FILE_SCANF(PING_SYSCTL_PATH, "%u %u", &ping_min_grp, &ping_max_grp); SAFE_FILE_PRINTF(PING_SYSCTL_PATH, "0 0"); sockfd = SAFE_SOCKET(AF_INET, SOCK_DGRAM, IPPROTO_ICMP); tst_res(TINFO, "Created ping socket, attempting to race..."); tst_fzsync_pair_init(&fzsync_pair); } static void cleanup(void) { tst_fzsync_pair_cleanup(&fzsync_pair); if (sockfd > 0) SAFE_CLOSE(sockfd); if (ping_min_grp | ping_max_grp) SAFE_FILE_PRINTF(PING_SYSCTL_PATH, "%u %u", ping_min_grp, ping_max_grp); } static void *connect_b(void * param LTP_ATTRIBUTE_UNUSED) { while (tst_fzsync_run_b(&fzsync_pair)) { tst_fzsync_start_race_b(&fzsync_pair); connect(sockfd, (struct sockaddr *)&uaddr, sizeof(uaddr)); tst_fzsync_end_race_b(&fzsync_pair); } return 0; } static void run(void) { tst_fzsync_pair_reset(&fzsync_pair, connect_b); while (tst_fzsync_run_a(&fzsync_pair)) { SAFE_CONNECT(sockfd, (struct sockaddr *)&iaddr, sizeof(iaddr)); tst_fzsync_start_race_a(&fzsync_pair); connect(sockfd, (struct sockaddr *)&uaddr, sizeof(uaddr)); tst_fzsync_end_race_a(&fzsync_pair); } tst_res(TPASS, "We didn't crash"); } static struct tst_test test = { .setup = setup, .test_all = run, .cleanup = cleanup, .needs_root = 1, .tags = (const struct tst_tag[]) { {"linux-git", "43a6684519ab"}, {"CVE", "2017-2671"}, {} } };
/* -*- mode: c; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; c-file-style: "stroustrup"; -*- * * * This file is part of Gromacs Copyright (c) 1991-2004 * David van der Spoel, Erik Lindahl, University of Groningen. * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. * * To help us fund GROMACS development, we humbly ask that you cite * the research papers on the package. Check out http://www.gromacs.org * * And Hey: * Gnomes, ROck Monsters And Chili Sauce */ #ifndef _NB_KERNEL331_X86_64_SSE2_H_ #define _NB_KERNEL331_X86_64_SSE2_H_ /*! \file nb_kernel331_x86_64_sse2.h * \brief x86-64 SSE2-optimized versions of nonbonded kernel 331 * * \internal */ #ifdef __cplusplus extern "C" { #endif #if 0 } #endif /*! \brief Nonbonded kernel 331 with forces, optimized for x86-64 sse2. * * \internal * * <b>Coulomb interaction:</b> Tabulated <br> * <b>VdW interaction:</b> Tabulated <br> * <b>Water optimization:</b> SPC/TIP3P interacting with non-water atoms <br> * <b>Forces calculated:</b> Yes <br> * * \note All level1 and level2 nonbonded kernels use the same * call sequence. Parameters are documented in nb_kernel.h */ void nb_kernel331_x86_64_sse2(int * nri, int iinr[], int jindex[], int jjnr[], int shift[], double shiftvec[], double fshift[], int gid[], double pos[], double faction[], double charge[], double * facel, double * krf, double * crf, double Vc[], int type[], int * ntype, double vdwparam[], double Vvdw[], double * tabscale, double VFtab[], double invsqrta[], double dvda[], double * gbtabscale, double GBtab[], int * nthreads, int * count, void * mtx, int * outeriter, int * inneriter, double * work); /*! \brief Nonbonded kernel 331 without forces, optimized for x86-64 sse2. * * \internal * * <b>Coulomb interaction:</b> Tabulated <br> * <b>VdW interaction:</b> Tabulated <br> * <b>Water optimization:</b> SPC/TIP3P interacting with non-water atoms <br> * <b>Forces calculated:</b> No <br> * * \note All level1 and level2 nonbonded kernels use the same * call sequence. Parameters are documented in nb_kernel.h */ void nb_kernel331nf_x86_64_sse2(int * nri, int iinr[], int jindex[], int jjnr[], int shift[], double shiftvec[], double fshift[], int gid[], double pos[], double faction[], double charge[], double * facel, double * krf, double * crf, double Vc[], int type[], int * ntype, double vdwparam[], double Vvdw[], double * tabscale, double VFtab[], double invsqrta[], double dvda[], double * gbtabscale, double GBtab[], int * nthreads, int * count, void * mtx, int * outeriter, int * inneriter, double * work); #ifdef __cplusplus } #endif #endif /* _NB_KERNEL331_X86_64_SSE2_H_ */
/* Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License, version 2.0, as published by the Free Software Foundation. This program is also distributed with certain software (including but not limited to OpenSSL) that is licensed under separate terms, as designated in a particular file or component or in included license documentation. The authors of MySQL hereby grant you an additional permission to link the program and your derivative works with the separately licensed software that they have included with MySQL. 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.0, for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ #ifndef LOGGER_H #define LOGGER_H #include "sql_plugin.h" namespace keyring { class ILogger { public: virtual void log(plugin_log_level level, const char *message)= 0; virtual ~ILogger() {} }; class Logger : public ILogger { public: Logger(MYSQL_PLUGIN plugin_info_ptr) : plugin_info_ptr(plugin_info_ptr) {} ~Logger() {} void log(plugin_log_level level, const char *message) { my_plugin_log_message(&plugin_info_ptr, level, "%s", message); } private: MYSQL_PLUGIN plugin_info_ptr; }; } //namespace keyring #endif //LOGGER_H
#ifndef __PATHCACHE_H__ #define __PATHCACHE_H__ class CPathCache { public: CPathCache(); virtual ~CPathCache(); // The source argument should be a canonicalized path already if subdir is non-empty static void Store(const CServer& server, const CServerPath& target, const CServerPath& source, const wxString subdir = _T("")); // The source argument should be a canonicalized path already if subdir is non-empty happen static CServerPath Lookup(const CServer& server, const CServerPath& source, const wxString subdir = _T("")); static void InvalidateServer(const CServer& server); // Invalidate path static void InvalidatePath(const CServer& server, const CServerPath& path, const wxString& subdir = _T("")); static void Clear(); protected: class CSourcePath { public: CServerPath source; wxString subdir; bool operator<(const CSourcePath& op) const { const int cmp = subdir.Cmp(op.subdir); if (cmp < 0) return true; if (cmp > 0) return false; return source < op.source; } }; typedef std::map<CSourcePath, CServerPath> tServerCache; typedef tServerCache::iterator tServerCacheIterator; typedef tServerCache::const_iterator tServerCacheConstIterator; typedef std::map<CServer, tServerCache*> tCache; static tCache m_cache; typedef tCache::iterator tCacheIterator; typedef tCache::const_iterator tCacheConstIterator; static CServerPath Lookup(const tServerCache &serverCache, const CServerPath& source, const wxString subdir); static int m_hits; static int m_misses; static int m_instance_count; }; #endif //__PATHCACHE_H__
/****************************************************************************** * Warmux is a convivial mass murder game. * Copyright (C) 2001-2011 Warmux Team. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA *****************************************************************************/ #ifndef TILEITEM_H #define TILEITEM_H #include <WARMUX_point.h> #include "graphic/surface.h" // Must be at least 3 #define CELL_BITS 6 #define CELL_DIM (1<<CELL_BITS) #define CELL_MASK (CELL_DIM-1) static const Point2i CELL_SIZE(CELL_DIM, CELL_DIM); class TileItem { public: TileItem() {}; virtual ~TileItem() {}; bool IsEmpty (); virtual bool IsTotallyEmpty() const = 0; virtual bool IsEmpty(const Point2i &pos) const = 0; virtual void ScalePreview(uint8_t* /*odata*/, int /*x*/, uint /*opitch*/, uint /*shift*/) { }; virtual void Draw(const Point2i &pos) = 0; virtual bool NeedSynch() const = 0; }; class TileItem_Empty : public TileItem { public: TileItem_Empty() { }; ~TileItem_Empty() { }; bool IsEmpty(const Point2i &/*pos*/) const { return true; }; void Dig(const Point2i &/*position*/, const Surface& /*dig*/){}; void Dig(const Point2i &/*center*/, const uint /*radius*/) {}; void Draw(const Point2i&) { }; bool IsTotallyEmpty() const { return true; }; bool NeedSynch() const { return false; } }; class TileItem_NonEmpty : public TileItem { protected: Surface m_surface; uint8_t *m_empty_bitfield; bool m_is_empty; bool m_need_check_empty; uint8_t m_alpha_threshold; Point2i m_start_check, m_end_check; bool m_need_resynch; TileItem_NonEmpty(uint8_t alpha_threshold); void CheckEmptyField(); public: ~TileItem_NonEmpty() { delete[] m_empty_bitfield; } virtual bool CheckEmpty() = 0; virtual void ForceEmpty(); virtual void MergeSprite(const Point2i &position, Surface& spr) = 0; virtual void Empty(int start_x, int end_x, uint8_t* buf) = 0; virtual void Darken(int start_x, int end_x, uint8_t* buf) = 0; virtual void Dig(const Point2i &position, const Surface& dig) = 0; void ForceRecheck(); bool NeedDelete() { if (m_need_check_empty) return CheckEmpty(); return m_is_empty; } bool IsEmpty(const Point2i &pos) const { ASSERT(!m_need_check_empty); return m_empty_bitfield[(pos.y*CELL_SIZE.x + pos.x)>>3] & (1 << (pos.x&7)); } uint16_t GetChecksum() const; uint16_t GetSynchsum() { m_need_resynch = false; return GetChecksum(); } void Dig(const Point2i &center, const uint radius); bool IsTotallyEmpty() const { return false; }; Surface& GetSurface() { return m_surface; }; void Draw(const Point2i &pos); bool NeedSynch() const { return m_need_resynch; } }; class TileItem_BaseColorKey : public TileItem_NonEmpty { protected: Uint32 color_key; TileItem_BaseColorKey(uint8_t bpp, uint8_t alpha_threshold); TileItem_BaseColorKey(uint8_t alpha_threshold); void MapColorKey(); public: static const Uint32 COLOR_KEY = 0xFF00FF; void ForceEmpty(); void MergeSprite(const Point2i &position, Surface& spr); void Dig(const Point2i &position, const Surface& dig); bool CheckEmpty(); }; class TileItem_ColorKey16: public TileItem_BaseColorKey { public: TileItem_ColorKey16(uint8_t threshold) : TileItem_BaseColorKey(16, threshold) { }; TileItem_ColorKey16(void *pixels, int stride, uint8_t threshold); void Empty(int start_x, int end_x, uint8_t* buf); void Darken(int start_x, int end_x, uint8_t* buf); void ScalePreview(uint8_t *odata, int x, uint opitch, uint shift); }; class TileItem_ColorKey24: public TileItem_BaseColorKey { public: TileItem_ColorKey24(void *pixels, int stride, uint8_t threshold); void Empty(int start_x, int end_x, uint8_t* buf); void Darken(int start_x, int end_x, uint8_t* buf); void ScalePreview(uint8_t *odata, int x, uint opitch, uint shift); }; class TileItem_AlphaSoftware : public TileItem_NonEmpty { // A tile can have all alpha to 0, be empty but still have image data bool transparent; public: TileItem_AlphaSoftware(uint8_t threshold); TileItem_AlphaSoftware(void *pixels, int stride, uint8_t threshold); // Fill as empty void MergeSprite(const Point2i &position, Surface& spr) { // Can't force SDL_SRCALPHA to 0 and blit, as it may affect non-empty pixels m_surface.MergeSurface(spr, position); ForceRecheck(); } bool CheckEmpty(); void ForceEmpty(); void Empty(int start_x, int end_x, uint8_t* buf); void Darken(int start_x, int end_x, uint8_t* buf); void Dig(const Point2i &position, const Surface& dig); void ScalePreview(uint8_t *odata, int x, uint opitch, uint shift); }; TileItem_NonEmpty* NewEmpty(uint8_t bpp, uint8_t alpha_threshold); #endif
/* mediastreamer2 library - modular sound and video processing and streaming Copyright (C) 2014 Belledonne Communications SARL Author: Simon Morlat <simon.morlat@linphone.org> This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include "mediastreamer2/mscommon.h" #include "mediastreamer2/msutils.h" static void completion_cb(void *user_data, int percentage){ fprintf(stdout,"%i %% completed\r",percentage); fflush(stdout); } int main(int argc, char *argv[]){ double ret=0; MSAudioDiffParams params={0}; if (argc<3){ fprintf(stderr,"%s: file1 file2 [overlap-percentage] [chunk size in milliseconds]\nCompare two wav audio files and display a similarity factor between 0 and 1.\n",argv[0]); return -1; } if (argc>3){ params.max_shift_percent=atoi(argv[3]); } if (argc>4){ params.chunk_size_ms = atoi(argv[4]); } ortp_set_log_level_mask(ORTP_MESSAGE|ORTP_WARNING|ORTP_ERROR|ORTP_FATAL); if (ms_audio_diff(argv[1],argv[2],&ret,&params,completion_cb,NULL)==0){ fprintf(stdout,"%s and %s are similar with a degree of %g.\n",argv[1],argv[2],ret); return 0; }else{ fprintf(stderr,"Error encountered during processing, exiting.\n"); } return -1; }
/* * arch/arm/include/asm/arch-rmobile/r8a7793.h * * Copyright (C) 2014 Renesas Electronics Corporation * * SPDX-License-Identifier: GPL-2.0 */ #ifndef __ASM_ARCH_R8A7793_H #define __ASM_ARCH_R8A7793_H #include "rcar-base.h" /* * R8A7793 I/O Addresses */ /* SH-I2C */ #define CONFIG_SYS_I2C_SH_BASE2 0xE60B0000 #define DBSC3_1_QOS_R0_BASE 0xE67A1000 #define DBSC3_1_QOS_R1_BASE 0xE67A1100 #define DBSC3_1_QOS_R2_BASE 0xE67A1200 #define DBSC3_1_QOS_R3_BASE 0xE67A1300 #define DBSC3_1_QOS_R4_BASE 0xE67A1400 #define DBSC3_1_QOS_R5_BASE 0xE67A1500 #define DBSC3_1_QOS_R6_BASE 0xE67A1600 #define DBSC3_1_QOS_R7_BASE 0xE67A1700 #define DBSC3_1_QOS_R8_BASE 0xE67A1800 #define DBSC3_1_QOS_R9_BASE 0xE67A1900 #define DBSC3_1_QOS_R10_BASE 0xE67A1A00 #define DBSC3_1_QOS_R11_BASE 0xE67A1B00 #define DBSC3_1_QOS_R12_BASE 0xE67A1C00 #define DBSC3_1_QOS_R13_BASE 0xE67A1D00 #define DBSC3_1_QOS_R14_BASE 0xE67A1E00 #define DBSC3_1_QOS_R15_BASE 0xE67A1F00 #define DBSC3_1_QOS_W0_BASE 0xE67A2000 #define DBSC3_1_QOS_W1_BASE 0xE67A2100 #define DBSC3_1_QOS_W2_BASE 0xE67A2200 #define DBSC3_1_QOS_W3_BASE 0xE67A2300 #define DBSC3_1_QOS_W4_BASE 0xE67A2400 #define DBSC3_1_QOS_W5_BASE 0xE67A2500 #define DBSC3_1_QOS_W6_BASE 0xE67A2600 #define DBSC3_1_QOS_W7_BASE 0xE67A2700 #define DBSC3_1_QOS_W8_BASE 0xE67A2800 #define DBSC3_1_QOS_W9_BASE 0xE67A2900 #define DBSC3_1_QOS_W10_BASE 0xE67A2A00 #define DBSC3_1_QOS_W11_BASE 0xE67A2B00 #define DBSC3_1_QOS_W12_BASE 0xE67A2C00 #define DBSC3_1_QOS_W13_BASE 0xE67A2D00 #define DBSC3_1_QOS_W14_BASE 0xE67A2E00 #define DBSC3_1_QOS_W15_BASE 0xE67A2F00 #define DBSC3_1_DBADJ2 0xE67A00C8 /* * R8A7793 I/O Product Information */ /* Module stop control/status register bits */ #define MSTP0_BITS 0x00640801 #define MSTP1_BITS 0x9B6C9B5A #define MSTP2_BITS 0x100D21FC #define MSTP3_BITS 0xF08CD810 #define MSTP4_BITS 0x800001C4 #define MSTP5_BITS 0x44C00046 #define MSTP7_BITS 0x05BFE618 #define MSTP8_BITS 0x40C0FE85 #define MSTP9_BITS 0xFF979FFF #define MSTP10_BITS 0xFFFEFFE0 #define MSTP11_BITS 0x000001C0 #define R8A7793_CUT_ES2X 2 #define IS_R8A7793_ES2() \ (rmobile_get_cpu_rev_integer() == R8A7793_CUT_ES2X) #endif /* __ASM_ARCH_R8A7793_H */
/* PCSX2 - PS2 Emulator for PCs * Copyright (C) 2002-2021 PCSX2 Dev Team * * PCSX2 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 Found- * ation, either version 3 of the License, or (at your option) any later version. * * PCSX2 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 PCSX2. * If not, see <http://www.gnu.org/licenses/>. */ #pragma once template <class Vertex> class GSVertexList { void* m_base; Vertex* m_v[3]; int m_count; public: GSVertexList() : m_count(0) { m_base = _aligned_malloc(sizeof(Vertex) * std::size(m_v), 32); for (size_t i = 0; i < std::size(m_v); i++) { m_v[i] = &((Vertex*)m_base)[i]; } } virtual ~GSVertexList() { _aligned_free(m_base); } void RemoveAll() { m_count = 0; } __forceinline Vertex& AddTail() { ASSERT(m_count < 3); return *m_v[m_count++]; } __forceinline void RemoveAt(int pos, int keep) { if (keep == 1) { Vertex* tmp = m_v[pos + 0]; m_v[pos + 0] = m_v[pos + 1]; m_v[pos + 1] = tmp; } else if (keep == 2) { Vertex* tmp = m_v[pos + 0]; m_v[pos + 0] = m_v[pos + 1]; m_v[pos + 1] = m_v[pos + 2]; m_v[pos + 2] = tmp; } m_count = pos + keep; } __forceinline void GetAt(int i, Vertex& v) { v = *m_v[i]; } int GetCount() { return m_count; } };
/* Mike Clark - 25th May 2005 bigfloat.h Simple C++ wrapper for multiprecision datatype used by AlgRemez algorithm */ #ifndef INCLUDED_BIGFLOAT_H #define INCLUDED_BIGFLOAT_H #include <gmp.h> #include <mpf2mpfr.h> #include <mpfr.h> class bigfloat { private: mpf_t x; public: bigfloat() { mpf_init(x); } bigfloat(const bigfloat& y) { mpf_init_set(x, y.x); } bigfloat(const unsigned long u) { mpf_init_set_ui(x, u); } bigfloat(const long i) { mpf_init_set_si(x, i); } bigfloat(const int i) {mpf_init_set_si(x,(long)i);} bigfloat(const float d) { mpf_init_set_d(x, (double)d); } bigfloat(const double d) { mpf_init_set_d(x, d); } bigfloat(const char *str) { mpf_init_set_str(x, (char*)str, 10); } ~bigfloat(void) { mpf_clear(x); } operator double (void) const { return (double)mpf_get_d(x); } static void setDefaultPrecision(unsigned long dprec) { unsigned long bprec = (unsigned long)(3.321928094 * (double)dprec); mpf_set_default_prec(bprec); } void setPrecision(unsigned long dprec) { unsigned long bprec = (unsigned long)(3.321928094 * (double)dprec); mpf_set_prec(x,bprec); } unsigned long getPrecision(void) const { return mpf_get_prec(x); } unsigned long getDefaultPrecision(void) const { return mpf_get_default_prec(); } bigfloat& operator=(const bigfloat& y) { mpf_set(x, y.x); return *this; } bigfloat& operator=(const unsigned long y) { mpf_set_ui(x, y); return *this; } bigfloat& operator=(const signed long y) { mpf_set_si(x, y); return *this; } bigfloat& operator=(const float y) { mpf_set_d(x, (double)y); return *this; } bigfloat& operator=(const double y) { mpf_set_d(x, y); return *this; } size_t write(void); size_t read(void); /* Arithmetic Functions */ bigfloat& operator+=(const bigfloat& y) { return *this = *this + y; } bigfloat& operator-=(const bigfloat& y) { return *this = *this - y; } bigfloat& operator*=(const bigfloat& y) { return *this = *this * y; } bigfloat& operator/=(const bigfloat& y) { return *this = *this / y; } friend bigfloat operator+(const bigfloat& x, const bigfloat& y) { bigfloat a; mpf_add(a.x,x.x,y.x); return a; } friend bigfloat operator+(const bigfloat& x, const unsigned long y) { bigfloat a; mpf_add_ui(a.x,x.x,y); return a; } friend bigfloat operator-(const bigfloat& x, const bigfloat& y) { bigfloat a; mpf_sub(a.x,x.x,y.x); return a; } friend bigfloat operator-(const unsigned long x, const bigfloat& y) { bigfloat a; mpf_ui_sub(a.x,x,y.x); return a; } friend bigfloat operator-(const bigfloat& x, const unsigned long y) { bigfloat a; mpf_sub_ui(a.x,x.x,y); return a; } friend bigfloat operator-(const bigfloat& x) { bigfloat a; mpf_neg(a.x,x.x); return a; } friend bigfloat operator*(const bigfloat& x, const bigfloat& y) { bigfloat a; mpf_mul(a.x,x.x,y.x); return a; } friend bigfloat operator*(const bigfloat& x, const unsigned long y) { bigfloat a; mpf_mul_ui(a.x,x.x,y); return a; } friend bigfloat operator/(const bigfloat& x, const bigfloat& y){ bigfloat a; mpf_div(a.x,x.x,y.x); return a; } friend bigfloat operator/(const unsigned long x, const bigfloat& y){ bigfloat a; mpf_ui_div(a.x,x,y.x); return a; } friend bigfloat operator/(const bigfloat& x, const unsigned long y){ bigfloat a; mpf_div_ui(a.x,x.x,y); return a; } friend bigfloat sqrt_bf(const bigfloat& x){ bigfloat a; mpf_sqrt(a.x,x.x); return a; } friend bigfloat sqrt_bf(const unsigned long x){ bigfloat a; mpf_sqrt_ui(a.x,x); return a; } friend bigfloat abs_bf(const bigfloat& x){ bigfloat a; mpf_abs(a.x,x.x); return a; } friend bigfloat pow_bf(const bigfloat& a, long power) { bigfloat b; mpf_pow_ui(b.x,a.x,power); return b; } friend bigfloat pow_bf(const bigfloat& a, bigfloat &power) { bigfloat b; mpfr_pow(b.x,a.x,power.x,GMP_RNDN); return b; } friend bigfloat exp_bf(const bigfloat& a) { bigfloat b; mpfr_exp(b.x,a.x,GMP_RNDN); return b; } /* Comparison Functions */ friend int operator>(const bigfloat& x, const bigfloat& y) { int test; test = mpf_cmp(x.x,y.x); if (test > 0) return 1; else return 0; } friend int operator<(const bigfloat& x, const bigfloat& y) { int test; test = mpf_cmp(x.x,y.x); if (test < 0) return 1; else return 0; } friend int sgn(const bigfloat&); }; #endif
/** * @file browser.c Launching different external browsers * * Copyright (C) 2003-2015 Lars Windolf <lars.windolf@gmx.de> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "browser.h" #include <string.h> #include "common.h" #include "conf.h" #include "debug.h" #include "ui/liferea_shell.h" /** * Returns a shell command format string which can be used to create * a browser launch command if preference for manual command is set. * * @returns a newly allocated command string (or NULL) */ static gchar * browser_get_manual_command (void) { gchar *cmd = NULL; gchar *libname; /* check for manual browser command */ conf_get_str_value (BROWSER_ID, &libname); if (g_str_equal (libname, "manual")) { /* retrieve user defined command... */ conf_get_str_value (BROWSER_COMMAND, &cmd); } g_free (libname); return cmd; } static gboolean browser_execute (const gchar *cmd, const gchar *uri) { GError *error = NULL; gchar *safeUri, *tmp, **argv, **iter; gint argc; gboolean done = FALSE; g_assert (cmd != NULL); g_assert (uri != NULL); safeUri = common_uri_sanitize (uri); /* If we run using a Mozilla like "-remote openURL()" mechanism we need to escape commata, but not in other cases (see SF #2901447) */ if (strstr(cmd, "openURL(")) safeUri = common_strreplace (safeUri, ",", "%2C"); /* If there is no %s in the command, then just append %s */ if (strstr (cmd, "%s")) tmp = g_strdup (cmd); else tmp = g_strdup_printf ("%s %%s", cmd); /* Parse and substitute the %s in the command */ g_shell_parse_argv (tmp, &argc, &argv, &error); g_free (tmp); if (error && (0 != error->code)) { liferea_shell_set_important_status_bar (_("Browser command failed: %s"), error->message); debug2 (DEBUG_GUI, "Browser command is invalid: %s : %s", tmp, error->message); g_error_free (error); return FALSE; } if (argv) { for (iter = argv; *iter != NULL; iter++) *iter = common_strreplace (*iter, "%s", safeUri); } tmp = g_strjoinv (" ", argv); debug1 (DEBUG_GUI, "Running the browser-remote %s command", tmp); g_spawn_async (NULL, argv, NULL, G_SPAWN_SEARCH_PATH, NULL, NULL, NULL, &error); if (error && (0 != error->code)) { debug2 (DEBUG_GUI, "Browser command failed: %s : %s", tmp, error->message); liferea_shell_set_important_status_bar (_("Browser command failed: %s"), error->message); g_error_free (error); } else { liferea_shell_set_status_bar (_("Starting: \"%s\""), tmp); done = TRUE; } g_free (safeUri); g_free (tmp); g_strfreev (argv); return done; } gboolean browser_launch_URL_external (const gchar *uri) { gchar *cmd = NULL; gboolean done = FALSE; g_assert (uri != NULL); cmd = browser_get_manual_command (); if (cmd) { done = browser_execute (cmd, uri); g_free (cmd); } else { done = gtk_show_uri (NULL, uri, 0, NULL); } return done; }
/* * This file is part of INAV. * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this file, * You can obtain one at http://mozilla.org/MPL/2.0/. * * Alternatively, the contents of this file may be used under the terms * of the GNU General Public License Version 3, as described below: * * This file is free software: you may copy, redistribute 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 file 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 <stdint.h> #include <platform.h> #include "drivers/io.h" #include "rx/rx.h" #include "io/serial.h" #include "io/ledstrip.h" void targetConfiguration(void) { ledStripConfigMutable()->ledConfigs[0] = DEFINE_LED(0, 0, COLOR_GREEN, 0, LED_FUNCTION_ARM_STATE, LED_FLAG_OVERLAY(LED_OVERLAY_WARNING), 0); // serialConfigMutable()->portConfigs[findSerialPortIndexByIdentifier(TELEMETRY_UART)].functionMask = FUNCTION_TELEMETRY_SMARTPORT; }
#ifndef _CORE_PAGE_H #define _CORE_PAGE_H // core/page.h // 6/28/2011 // Describe page in document. #include "core/text.h" #include <poppler-qt4.h> #include <QImage> namespace Core { // Page /** * \brief Page of the document. * * This class seperates the page out. * * Note: The Poppler::Page is not owned by this class. * Page is not responsible to delete Poppler::Page on destruction. */ class Page : public QObject { Q_OBJECT typedef Page Self; typedef QObject Base; Poppler::Page *page_; int num_; mutable TextRectCatalog *catalog_; // cache public: Poppler::Page *impl() const { return page_; } // Constructions: private: Page(const Self&); public: explicit Page(QObject *parent = nullptr) : Base(parent), page_(nullptr), num_(0), catalog_(nullptr) { } explicit Page(Poppler::Page *page, int number, QObject *parent = nullptr) : Base(parent), page_(page), num_(number), catalog_(nullptr) { } bool bad() const { return !page_; } void clear() { page_ = nullptr; } int hash() const { return reinterpret_cast<ulong>(impl()); } // Properties: public: ///< Page number in the document, starting from 0. int num() const { return num_; } QSize size() const { return page_? page_->pageSize() : QSize(); } QSizeF sizeF() const { return page_? page_->pageSizeF() : QSizeF(); } /// Render to image. This could take a long time. // poppler-qt4.h: QImage renderToImage(double xres=72.0, double yres=72.0, int x=-1, int y=-1, int w=-1, int h=-1, Rotation rotate = Rotate0) const; QImage toImage(qreal xres, qreal yres, int x = -1, int y = -1, int w = -1, int h = -1) const //Rotation rot = Poppler::Page::Rotate0) { return page_? page_->renderToImage(xres, yres, x, y, w, h) : QImage(); } /// Render to painter. This could take a long time. //bool render(QPainter *painter, double xres, double yres, // int x = -1, int y = -1, int w = -1, int h = -1) const //{ return page_? page_->renderToPainter(painter, xres, yres, x, y, w, h) : false; } // Queries: //@{ /// \name Queries public: // bool Poppler::Page::search(const QString &text, double &rectLeft, double &rectTop, double &rectRight, double &rectBottom, SearchDirection direction, SearchMode caseSensitive, Rotation rotate = Rotate0) const; QRectF search(const QString &text) const { if (bad()) return QRectF(); #ifdef Q_OS_LINUX // Following function is depricated, but works on old ubuntu qt-creator QRectF ret; if (page_->search(text, ret, Poppler::Page::NextResult, Poppler::Page::CaseInsensitive)) return ret; #else qreal x1, y1, x2, y2; if (page_->search(text, x1, y1, x2, y2, Poppler::Page::NextResult, Poppler::Page::CaseInsensitive)) return QRectF(x1, y1, x2 - x1, y2 - y1); #endif // Q_OS_LINUX else return QRectF(); } const TextRectList &words() const ///< words, cached { if (!catalog_) new_catalog_(); return catalog_->words(); } const TextRectList &lines() const ///< lines, cached { if (!catalog_) new_catalog_(); return catalog_->lines(); } const TextRectList &blocks() const ///< blocks, cached { if (!catalog_) new_catalog_(); return catalog_->blocks(); } /// Clean cached catalog for words, lines, and blocks void clearCache() const { if (!bad() && catalog_) delete catalog_; } private: void new_catalog_() const; //@} }; } // namespace Core #endif // _CORE_PAGE_H
/* Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #include "testutil.h" #include "apr.h" #include "apr_general.h" #include "apr_strmatch.h" #if APR_HAVE_STDLIB_H #include <stdlib.h> #endif #define APR_WANT_STDIO #define APR_WANT_STRFUNC #include "apr_want.h" static void test_str(abts_case *tc, void *data) { apr_pool_t *pool = p; const apr_strmatch_pattern *pattern; const apr_strmatch_pattern *pattern_nocase; const apr_strmatch_pattern *pattern_onechar; const apr_strmatch_pattern *pattern_zero; const char *match = NULL; const char *input1 = "string that contains a patterN..."; const char *input2 = "string that contains a pattern..."; const char *input3 = "pattern at the start of a string"; const char *input4 = "string that ends with a pattern"; const char *input5 = "patter\200n not found, negative chars in input"; const char *input6 = "patter\200n, negative chars, contains pattern..."; pattern = apr_strmatch_precompile(pool, "pattern", 1); ABTS_PTR_NOTNULL(tc, pattern); pattern_nocase = apr_strmatch_precompile(pool, "pattern", 0); ABTS_PTR_NOTNULL(tc, pattern_nocase); pattern_onechar = apr_strmatch_precompile(pool, "g", 0); ABTS_PTR_NOTNULL(tc, pattern_onechar); pattern_zero = apr_strmatch_precompile(pool, "", 0); ABTS_PTR_NOTNULL(tc, pattern_zero); match = apr_strmatch(pattern, input1, strlen(input1)); ABTS_PTR_EQUAL(tc, NULL, match); match = apr_strmatch(pattern, input2, strlen(input2)); ABTS_PTR_EQUAL(tc, input2 + 23, match); match = apr_strmatch(pattern_onechar, input1, strlen(input1)); ABTS_PTR_EQUAL(tc, input1 + 5, match); match = apr_strmatch(pattern_zero, input1, strlen(input1)); ABTS_PTR_EQUAL(tc, input1, match); match = apr_strmatch(pattern_nocase, input1, strlen(input1)); ABTS_PTR_EQUAL(tc, input1 + 23, match); match = apr_strmatch(pattern, input3, strlen(input3)); ABTS_PTR_EQUAL(tc, input3, match); match = apr_strmatch(pattern, input4, strlen(input4)); ABTS_PTR_EQUAL(tc, input4 + 24, match); match = apr_strmatch(pattern, input5, strlen(input5)); ABTS_PTR_EQUAL(tc, NULL, match); match = apr_strmatch(pattern, input6, strlen(input6)); ABTS_PTR_EQUAL(tc, input6 + 35, match); } abts_suite *teststrmatch(abts_suite *suite) { suite = ADD_SUITE(suite); abts_run_test(suite, test_str, NULL); return suite; }
#ifndef INCLUDE__shared_h__ #define INCLUDE__shared_h__ #include <time.h> #include "lib/libnagios.h" NAGIOS_BEGIN_DECL /* mmapfile structure - used for reading files via mmap() */ typedef struct mmapfile_struct { char *path; int mode; int fd; unsigned long file_size; unsigned long current_position; unsigned long current_line; void *mmap_buf; } mmapfile; /* official count of first-class objects */ struct object_count { unsigned int commands; unsigned int timeperiods; unsigned int hosts; unsigned int hostescalations; unsigned int hostdependencies; unsigned int services; unsigned int serviceescalations; unsigned int servicedependencies; unsigned int contacts; unsigned int contactgroups; unsigned int hostgroups; unsigned int servicegroups; }; extern struct object_count num_objects; extern void timing_point(const char *fmt, ...); /* print a message and the time since the first message */ extern char *my_strtok(char *buffer, const char *tokens); extern char *my_strsep(char **stringp, const char *delim); extern mmapfile *mmap_fopen(const char *filename); extern int mmap_fclose(mmapfile *temp_mmapfile); extern char *mmap_fgets(mmapfile *temp_mmapfile); extern char *mmap_fgets_multiline(mmapfile * temp_mmapfile); extern void strip(char *buffer); extern int hashfunc(const char *name1, const char *name2, int hashslots); extern int compare_hashdata(const char *val1a, const char *val1b, const char *val2a, const char *val2b); extern void get_datetime_string(time_t *raw_time, char *buffer, int buffer_length, int type); extern void get_time_breakdown(unsigned long raw_time, int *days, int *hours, int *minutes, int *seconds); NAGIOS_END_DECL #endif
/* * init.h Several defines and declarations to be * included by all modules of the init program. * * Version: @(#)init.h 2.85-5 02-Jul-2003 miquels@cistron.nl * * Copyright (C) 1998-2003 Miquel van Smoorenburg. * * 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 * */ /* Standard configuration */ #define CHANGE_WAIT 0 /* Change runlevel while waiting for a process to exit? */ /* Debug and test modes */ #define DEBUG 0 /* Debug code off */ #define INITDEBUG 0 /* Fork at startup to debug init. */ /* Some constants */ #define INITPID 1 /* pid of first process */ #define PIPE_FD 10 /* Fileno of initfifo. */ #define STATE_PIPE 11 /* used to pass state through exec */ /* Failsafe configuration */ #define MAXSPAWN 10 /* Max times respawned in.. */ #define TESTTIME 120 /* this much seconds */ #define SLEEPTIME 300 /* Disable time */ /* Default path inherited by every child. */ #define PATH_DEFAULT "/sbin:/usr/sbin:/bin:/usr/bin" /* Prototypes. */ void write_utmp_wtmp(char *user, char *id, int pid, int type, char *line); void write_wtmp(char *user, char *id, int pid, int type, char *line); #ifdef __GNUC__ __attribute__ ((format (printf, 2, 3))) #endif void initlog(int loglevel, char *fmt, ...); void set_term(int how); void print(char *fmt); /* from dowall.c */ void wall(const char *text, int remote); #if DEBUG # define INITDBG(level, fmt, args...) initlog(level, fmt, ##args) #else # define INITDBG(level, fmt, args...) #endif /* Actions to be taken by init */ #define RESPAWN 1 #define WAIT 2 #define ONCE 3 #define BOOT 4 #define BOOTWAIT 5 #define POWERFAIL 6 #define POWERWAIT 7 #define POWEROKWAIT 8 #define CTRLALTDEL 9 #define OFF 10 #define ONDEMAND 11 #define INITDEFAULT 12 #define SYSINIT 13 #define POWERFAILNOW 14 #define KBREQUEST 15 /* Information about a process in the in-core inittab */ typedef struct _child_ { int flags; /* Status of this entry */ int exstat; /* Exit status of process */ int pid; /* Pid of this process */ time_t tm; /* When respawned last */ int count; /* Times respawned in the last 2 minutes */ char id[8]; /* Inittab id (must be unique) */ char rlevel[12]; /* run levels */ int action; /* what to do (see list below) */ char process[128]; /* The command line */ struct _child_ *new; /* New entry (after inittab re-read) */ struct _child_ *next; /* For the linked list */ } CHILD; /* Values for the 'flags' field */ #define RUNNING 2 /* Process is still running */ #define KILLME 4 /* Kill this process */ #define DEMAND 8 /* "runlevels" a b c */ #define FAILING 16 /* process respawns rapidly */ #define WAITING 32 /* We're waiting for this process */ #define ZOMBIE 64 /* This process is already dead */ #define XECUTED 128 /* Set if spawned once or more times */ /* Log levels. */ #define L_CO 1 /* Log on the console. */ #define L_SY 2 /* Log with syslog() */ #define L_VB (L_CO|L_SY) /* Log with both. */ #ifndef NO_PROCESS # define NO_PROCESS 0 #endif /* * Global variables. */ extern CHILD *family; extern int wrote_wtmp_reboot; extern int wrote_utmp_reboot; extern int wrote_wtmp_rlevel; extern int wrote_utmp_rlevel; extern char thislevel; extern char prevlevel; /* Tokens in state parser */ #define C_VER 1 #define C_END 2 #define C_REC 3 #define C_EOR 4 #define C_LEV 5 #define C_FLAG 6 #define C_ACTION 7 #define C_PROCESS 8 #define C_PID 9 #define C_EXS 10 #define C_EOF -1 #define D_RUNLEVEL -2 #define D_THISLEVEL -3 #define D_PREVLEVEL -4 #define D_GOTSIGN -5 #define D_WROTE_WTMP_REBOOT -6 #define D_WROTE_UTMP_REBOOT -7 #define D_SLTIME -8 #define D_DIDBOOT -9 #define D_WROTE_WTMP_RLEVEL -16 #define D_WROTE_UTMP_RLEVEL -17
/**************************************************************************** ** ** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** ** This file is part of the QtXmlPatterns module of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** GNU Lesser General Public License Usage ** 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. ** ** In addition, as a special exception, Nokia gives you certain additional ** rights. These rights are described in the Nokia Qt LGPL Exception ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. ** ** GNU General Public License Usage ** Alternatively, this file may be used under the terms of the GNU General ** Public License version 3.0 as published by the Free Software Foundation ** and appearing in the file LICENSE.GPL included in the packaging of this ** file. Please review the following information to ensure the GNU General ** Public License version 3.0 requirements will be met: ** http://www.gnu.org/copyleft/gpl.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 Nokia. ** ** ** ** ** ** $QT_END_LICENSE$ ** ****************************************************************************/ #ifndef QXMLFORMATTER_H #define QXMLFORMATTER_H #include <QtXmlPatterns/QXmlSerializer> QT_BEGIN_HEADER QT_BEGIN_NAMESPACE QT_MODULE(XmlPatterns) class QIODevice; class QTextCodec; class QXmlQuery; class QXmlFormatterPrivate; class Q_XMLPATTERNS_EXPORT QXmlFormatter : public QXmlSerializer { public: QXmlFormatter(const QXmlQuery &query, QIODevice *outputDevice); virtual void characters(const QStringRef &value); virtual void comment(const QString &value); virtual void startElement(const QXmlName &name); virtual void endElement(); virtual void attribute(const QXmlName &name, const QStringRef &value); virtual void processingInstruction(const QXmlName &name, const QString &value); virtual void atomicValue(const QVariant &value); virtual void startDocument(); virtual void endDocument(); virtual void startOfSequence(); virtual void endOfSequence(); int indentationDepth() const; void setIndentationDepth(int depth); /* The members below are internal, not part of the public API, and * unsupported. Using them leads to undefined behavior. */ virtual void item(const QPatternist::Item &item); private: inline void startFormattingContent(); Q_DECLARE_PRIVATE(QXmlFormatter) }; QT_END_NAMESPACE QT_END_HEADER #endif
#ifndef GYRO_SAMPLE_H #define GYRO_SAMPLE_H #include "sample.h" class GyroSample : public Sample { public: GyroSample(float r, float p, float y); GyroSample(const string& line); ~GyroSample() {} inline float roll() const { return roll_; } inline float pitch() const { return pitch_; } inline float yaw() const { return yaw_; } virtual void save(ofstream& out); private: float roll_; float pitch_; float yaw_; }; #endif
/* Copyright (C) 2003-2015 LiveCode Ltd. This file is part of LiveCode. LiveCode is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License v3 as published by the Free Software Foundation. LiveCode 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 LiveCode. If not see <http://www.gnu.org/licenses/>. */ #ifndef __MCCEF_SHARED_H__ #define __MCCEF_SHARED_H__ const char *MCCefPlatformGetCefLibraryPath(void); const char *MCCefPlatformGetResourcesDirPath(void); const char *MCCefPlatformGetLocalePath(void); // AL-2015-02-17: [[ SB Inclusions ]] Work around problems linking to MCU_ functions from CEF extern "C" void *MCU_loadmodule(const char *p_source); extern "C" void MCU_unloadmodule(void *p_module); extern "C" void *MCU_resolvemodulesymbol(void *p_module, const char *p_symbol); #endif // __MCCEF_SHARED_H__
#ifndef CAVERIF_BASICTYPES_H #define CAVERIF_BASICTYPES_H #include "net.h" #include "thread.h" #include "token.h" #include "state.h" #include <deque> namespace cass { class Net : public ca::NetBase { public: virtual void pack(ca::Packer &pack) = 0; void activate_transition_by_pos_id(int pos_id) {} }; template<typename T> class TokenList : public ca::TokenList<T> { public: TokenList() : ca::TokenList<T>() {} TokenList(TokenList &place) : ca::TokenList<T>() { if (place.token == NULL) { return; } ca::Token<T> *t = place.token; do { this->add(t->value); t = t->next; } while (t != place.token); } }; class VerifThread : public ca::ThreadBase { public: VerifThread(int process_id): process_id(process_id) {} int get_process_id() const { return process_id; } int get_process_count() const { return ca::process_count; } int get_threads_count() const { return 1; } void quit_all() { return; } void send(int target, ca::NetBase* net, int edge_id, int token_count, ca::Packer &packer) { return; } void send_multicast(const std::vector<int> &targets, ca::NetBase *net, int edge_id, int tokens_count, ca::Packer &packer) { return; } protected: int process_id; }; struct Activation : public ca::Activation { Activation(ca::TransitionDef *transition_def, ca::Binding *binding) : ca::Activation(transition_def, binding) { ca::Packer packer; transition_def->pack_binding(packer, binding); packed_binding = packer.get_buffer(); packed_binding_size = packer.get_size(); } Activation(const Activation &a) : ca::Activation(a) { packed_binding_size = a.packed_binding_size; packed_binding = malloc(packed_binding_size); memcpy(packed_binding, a.packed_binding, packed_binding_size); } Activation& operator=(const Activation &a) { if (this != &a) { free(packed_binding); ca::Activation::operator=(a); packed_binding_size = a.packed_binding_size; packed_binding = malloc(a.packed_binding_size); memcpy(packed_binding, a.packed_binding, a.packed_binding_size); } return *this; } ~Activation() { free(packed_binding); } size_t packed_binding_size; void *packed_binding; }; } #endif // CAVERIF_BASICTYPES_H
/** @file scim_setup_module.h * @brief definition of SetupModule related classes. */ /* * Smart Common Input Method * * Copyright (c) 2002-2005 James Su <suzhe@tsinghua.org.cn> * * * 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 program; if not, write to the * Free Software Foundation, Inc., 59 Temple Place, Suite 330, * Boston, MA 02111-1307 USA * * $Id: scim_setup_module.h,v 1.9 2005/01/10 08:30:45 suzhe Exp $ */ #if !defined (__SCIM_SETUP_MODULE_H) #define __SCIM_SETUP_MODULE_H #include <gtk/gtk.h> using namespace scim; typedef GtkWidget * (*SetupModuleCreateUIFunc) (void); typedef String (*SetupModuleGetCategoryFunc) (void); typedef String (*SetupModuleGetNameFunc) (void); typedef String (*SetupModuleGetDescriptionFunc) (void); typedef void (*SetupModuleLoadConfigFunc) (const ConfigPointer &config); typedef void (*SetupModuleSaveConfigFunc) (const ConfigPointer &config); typedef bool (*SetupModuleQueryChangedFunc) (void); class SetupModule { Module m_module; SetupModuleCreateUIFunc m_create_ui; SetupModuleGetCategoryFunc m_get_category; SetupModuleGetNameFunc m_get_name; SetupModuleGetDescriptionFunc m_get_description; SetupModuleLoadConfigFunc m_load_config; SetupModuleSaveConfigFunc m_save_config; SetupModuleQueryChangedFunc m_query_changed; SetupModule (const SetupModule &); SetupModule & operator= (const SetupModule &); public: SetupModule (); SetupModule (const String &name); bool load (const String &name); bool valid () const; GtkWidget * create_ui () const; String get_category () const; String get_name () const; String get_description () const; void load_config (const ConfigPointer &config) const; void save_config (const ConfigPointer &config) const; bool query_changed () const; }; int scim_get_setup_module_list (std::vector <String>& mod_list); #endif // __SCIM_SETUP_MODULE_H /* vi:ts=4:ai:nowrap:expandtab */
/* Audio File Library Copyright (C) 2004, Michael Pruett <michael@68k.org> This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ /* AVR.h This file contains headers and constants related to the AVR (Audio Visual Research) sound file format. */ #ifndef AVR_H #define AVR_H #include "Compiler.h" #include "FileHandle.h" class AVRFile : public _AFfilehandle { public: AVRFile(); static bool recognize(File *fh); static AFfilesetup completeSetup(AFfilesetup); status readInit(AFfilesetup) OVERRIDE; status writeInit(AFfilesetup) OVERRIDE; status update() OVERRIDE; }; #endif
/* * Copyright (C) 2016 Freie Universität Berlin * 2016 Inria * * This file is subject to the terms and conditions of the GNU Lesser * General Public License v2.1. See the file LICENSE in the top level * directory for more details. * */ /* * @ingroup auto_init_gnrc_netif * @{ * * @file * @brief Auto initialization for CC2420 network devices * * @author Hauke Petersen <hauke.petersen@fu-berlin.de> * @author Francisco Acosta <francisco.acosta@inria.fr> */ #ifdef MODULE_CC2420 #include "board.h" #include "net/gnrc/netdev2.h" #include "net/gnrc/netdev2/ieee802154.h" #include "net/gnrc.h" #include "cc2420.h" #include "cc2420_params.h" #define ENABLE_DEBUG (0) #include "debug.h" /** * @brief MAC layer stack parameters * @{ */ #define CC2420_MAC_STACKSIZE (THREAD_STACKSIZE_MAIN) #define CC2420_MAC_PRIO (THREAD_PRIORITY_MAIN - 4) /** @} */ /** * @brief Get the number of configured CC2420 devices */ #define CC2420_NUMOF (sizeof(cc2420_params) / sizeof(cc2420_params[0])) /** * @brief Allocate memory for dev descriptors, stacks, and 802.15.4 adaption * @{ */ static cc2420_t cc2420_devs[CC2420_NUMOF]; static gnrc_netdev2_t gnrc_adpt[CC2420_NUMOF]; static char _cc2420_stacks[CC2420_NUMOF][CC2420_MAC_STACKSIZE]; /** @} */ void auto_init_cc2420(void) { for (unsigned i = 0; i < CC2420_NUMOF; i++) { DEBUG("Initializing CC2420 radios #%u\n", i); cc2420_setup(&cc2420_devs[i], &cc2420_params[i]); int res = gnrc_netdev2_ieee802154_init(&gnrc_adpt[i], (netdev2_ieee802154_t *)&cc2420_devs[i]); if (res < 0) { DEBUG("Error initializing CC2420 radio device!\n"); } else { gnrc_netdev2_init(_cc2420_stacks[i], CC2420_MAC_STACKSIZE, CC2420_MAC_PRIO, "cc2420", &gnrc_adpt[i]); } } } #else typedef int dont_be_pedantic; #endif /* MODULE_CC2420 */ /** @} */
/*************************************************************************\ * Copyright (C) Michael Kerrisk, 2014. * * * * This program is free software. You may use, modify, and redistribute it * * under the terms of the GNU Affero General Public License as published * * by the Free Software Foundation, either version 3 or (at your option) * * any later version. This program is distributed without any warranty. * * See the file COPYING.agpl-v3 for details. * \*************************************************************************/ /* Listing 46-6 */ /* svmsg_ls.c Display a list of all System V message queues on the system. This program is Linux-specific. */ #define _GNU_SOURCE #include <sys/types.h> #include <sys/msg.h> #include "tlpi_hdr.h" int main(int argc, char *argv[]) { int maxind, ind, msqid; struct msqid_ds ds; struct msginfo msginfo; /* Obtain size of kernel 'entries' array */ maxind = msgctl(0, MSG_INFO, (struct msqid_ds *) &msginfo); if (maxind == -1) errExit("msgctl-MSG_INFO"); printf("maxind: %d\n\n", maxind); printf("index id key messages\n"); /* Retrieve and display information from each element of 'entries' array */ for (ind = 0; ind <= maxind; ind++) { msqid = msgctl(ind, MSG_STAT, &ds); if (msqid == -1) { if (errno != EINVAL && errno != EACCES) errMsg("msgctl-MSG_STAT"); /* Unexpected error */ continue; /* Ignore this item */ } printf("%4d %8d 0x%08lx %7ld\n", ind, msqid, (unsigned long) ds.msg_perm.__key, (long) ds.msg_qnum); } exit(EXIT_SUCCESS); }
//===--- NoNamespaceCheck.h - clang-tidy-------------------------*- C++ -*-===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// #ifndef LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_ABSEIL_NONAMESPACECHECK_H #define LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_ABSEIL_NONAMESPACECHECK_H #include "../ClangTidy.h" namespace clang { namespace tidy { namespace abseil { /// This check ensures users don't open namespace absl, as that violates /// Abseil's compatibility guidelines. /// /// For the user-facing documentation see: /// http://clang.llvm.org/extra/clang-tidy/checks/abseil-no-namespace.html class NoNamespaceCheck : public ClangTidyCheck { public: NoNamespaceCheck(StringRef Name, ClangTidyContext *Context) : ClangTidyCheck(Name, Context) {} void registerMatchers(ast_matchers::MatchFinder *Finder) override; void check(const ast_matchers::MatchFinder::MatchResult &Result) override; }; } // namespace abseil } // namespace tidy } // namespace clang #endif // LLVM_CLANG_TOOLS_EXTRA_CLANG_TIDY_ABSEIL_NONAMESPACECHECK_H
/* Copyright 2017 The TensorFlow Authors. All Rights Reserved. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. ==============================================================================*/ #ifndef TENSORFLOW_CONTRIB_LITE_EXAMPLES_LABEL_IMAGE_BITMAP_HELPERS_IMPL_H_ #define TENSORFLOW_CONTRIB_LITE_EXAMPLES_LABEL_IMAGE_BITMAP_HELPERS_IMPL_H_ #include "tensorflow/contrib/lite/examples/label_image/label_image.h" #include "tensorflow/contrib/lite/builtin_op_data.h" #include "tensorflow/contrib/lite/interpreter.h" #include "tensorflow/contrib/lite/kernels/register.h" #include "tensorflow/contrib/lite/string_util.h" #include "tensorflow/contrib/lite/version.h" namespace tflite { namespace label_image { template <class T> void resize(T* out, uint8_t* in, int image_height, int image_width, int image_channels, int wanted_height, int wanted_width, int wanted_channels, Settings* s) { int number_of_pixels = image_height * image_width * image_channels; std::unique_ptr<Interpreter> interpreter(new Interpreter); int base_index = 0; // two inputs: input and new_sizes interpreter->AddTensors(2, &base_index); // one output interpreter->AddTensors(1, &base_index); // set input and output tensors interpreter->SetInputs({0, 1}); interpreter->SetOutputs({2}); // set parameters of tensors TfLiteQuantizationParams quant; interpreter->SetTensorParametersReadWrite( 0, kTfLiteFloat32, "input", {1, image_height, image_width, image_channels}, quant); interpreter->SetTensorParametersReadWrite(1, kTfLiteInt32, "new_size", {2}, quant); interpreter->SetTensorParametersReadWrite( 2, kTfLiteFloat32, "output", {1, wanted_height, wanted_width, wanted_channels}, quant); ops::builtin::BuiltinOpResolver resolver; const TfLiteRegistration* resize_op = resolver.FindOp(BuiltinOperator_RESIZE_BILINEAR, 1); auto* params = reinterpret_cast<TfLiteResizeBilinearParams*>( malloc(sizeof(TfLiteResizeBilinearParams))); params->align_corners = false; interpreter->AddNodeWithParameters({0, 1}, {2}, nullptr, 0, params, resize_op, nullptr); interpreter->AllocateTensors(); // fill input image // in[] are integers, cannot do memcpy() directly auto input = interpreter->typed_tensor<float>(0); for (int i = 0; i < number_of_pixels; i++) { input[i] = in[i]; } // fill new_sizes interpreter->typed_tensor<int>(1)[0] = wanted_height; interpreter->typed_tensor<int>(1)[1] = wanted_width; interpreter->Invoke(); auto output = interpreter->typed_tensor<float>(2); auto output_number_of_pixels = wanted_height * wanted_height * wanted_channels; for (int i = 0; i < output_number_of_pixels; i++) { if (s->input_floating) out[i] = (output[i] - s->input_mean) / s->input_std; else out[i] = (uint8_t)output[i]; } } } // namespace label_image } // namespace tflite #endif // TENSORFLOW_CONTRIB_LITE_EXAMPLES_LABEL_IMAGE_BITMAP_HELPERS_IMPL_H_
/***************************************************************************//** * @file serial_api_HAL.h ******************************************************************************* * @section License * <b>(C) Copyright 2015 Silicon Labs, http://www.silabs.com</b> ******************************************************************************* * * Permission is granted to anyone to use this software for any purpose, * including commercial applications, and to alter it and redistribute it * freely, subject to the following restrictions: * * 1. The origin of this software must not be misrepresented; you must not * claim that you wrote the original software. * 2. Altered source versions must be plainly marked as such, and must not be * misrepresented as being the original software. * 3. This notice may not be removed or altered from any source distribution. * * DISCLAIMER OF WARRANTY/LIMITATION OF REMEDIES: Silicon Labs has no * obligation to support this Software. Silicon Labs is providing the * Software "AS IS", with no express or implied warranties of any kind, * including, but not limited to, any implied warranties of merchantability * or fitness for any particular purpose or warranties against infringement * of any proprietary rights of a third party. * * Silicon Labs will not be liable for any consequential, incidental, or * special damages, or any other relief, or for any claim by any third party, * arising from your use of this Software. * ******************************************************************************/ #ifndef MBED_SERIAL_API_HAL_H #define MBED_SERIAL_API_HAL_H #include "em_device.h" #ifdef _SILICON_LABS_32B_PLATFORM_2 #define UART_TYPE_USART 0x01 #define UART_TYPE_LEUART 0x02 #ifdef __cplusplus extern "C" { #endif #ifdef __cplusplus } #endif #endif #endif