Instruction stringlengths 14 778 | input_code stringlengths 0 4.24k | output_code stringlengths 1 5.44k |
|---|---|---|
Comment a wacky test case | // RUN: %clang_cc1 -triple i386-unknown-unknown %s -O3 -emit-llvm -o - | grep 'ret i32 6'
// RUN: %clang_cc1 -triple i386-unknown-unknown -x c++ %s -O3 -emit-llvm -o - | grep 'ret i32 7'
static enum { foo, bar = 1U } z;
int main (void)
{
int r = 0;
if (bar - 2 < 0)
r += 4;
if (foo - 1 < 0)
r += 2;
if (z - 1 < 0)
r++;
return r;
}
| // RUN: %clang_cc1 -triple i386-unknown-unknown %s -O3 -emit-llvm -o - | grep 'ret i32 6'
// RUN: %clang_cc1 -triple i386-unknown-unknown -x c++ %s -O3 -emit-llvm -o - | grep 'ret i32 7'
// This test case illustrates a peculiarity of the promotion of
// enumeration types in C and C++. In particular, the enumeration type
// "z" below promotes to an unsigned int in C but int in C++.
static enum { foo, bar = 1U } z;
int main (void)
{
int r = 0;
if (bar - 2 < 0)
r += 4;
if (foo - 1 < 0)
r += 2;
if (z - 1 < 0)
r++;
return r;
}
|
Fix compile error with -Werror | /* -*- Mode: C; tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*- */
/*
* Copyright 2013 Couchbase, 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.
*/
#include <internal.h> /* getenv, sytem, snprintf */
int main(int argc, char *argv[])
{
#ifndef WIN32
char *srcdir = getenv("srcdir");
char command[FILENAME_MAX];
int status;
snprintf(command, FILENAME_MAX, "%s/tools/cbc version 2>&1", srcdir);
status = system(command);
if (status == -1 || WIFSIGNALED(status) || WEXITSTATUS(status) != 0) {
return 1;
}
snprintf(command, FILENAME_MAX, "%s/tools/cbc help 2>&1", srcdir);
if (status == -1 || WIFSIGNALED(status) || WEXITSTATUS(status) != 0) {
return 1;
}
#endif
return 0;
}
| /* -*- Mode: C; tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*- */
/*
* Copyright 2013 Couchbase, 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.
*/
#include <internal.h> /* getenv, sytem, snprintf */
int main(void)
{
#ifndef WIN32
char *srcdir = getenv("srcdir");
char command[FILENAME_MAX];
int status;
snprintf(command, FILENAME_MAX, "%s/tools/cbc version 2>&1", srcdir);
status = system(command);
if (status == -1 || WIFSIGNALED(status) || WEXITSTATUS(status) != 0) {
return 1;
}
snprintf(command, FILENAME_MAX, "%s/tools/cbc help 2>&1", srcdir);
if (status == -1 || WIFSIGNALED(status) || WEXITSTATUS(status) != 0) {
return 1;
}
#endif
return 0;
}
|
Remove useless forward declaration of FunctionInfo | // AMX profiler for SA-MP server: http://sa-mp.com
//
// Copyright (C) 2011-2012 Sergey Zolotarev
//
// 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 AMX_PROFILER_PROFILE_WRITER_H
#define AMX_PROFILER_PROFILE_WRITER_H
#include <memory>
#include <ostream>
#include <vector>
#include "function_info.h"
namespace amx_profiler {
class FunctionInfo;
class ProfileWriter {
public:
virtual void Write(const std::string &script_name, std::ostream &stream,
const std::vector<FunctionInfoPtr> &stats) = 0;
};
} // namespace amx_profiler
#endif // !AMX_PROFILER_PROFILE_WRITER_H
| // AMX profiler for SA-MP server: http://sa-mp.com
//
// Copyright (C) 2011-2012 Sergey Zolotarev
//
// 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 AMX_PROFILER_PROFILE_WRITER_H
#define AMX_PROFILER_PROFILE_WRITER_H
#include <memory>
#include <ostream>
#include <vector>
#include "function_info.h"
namespace amx_profiler {
class ProfileWriter {
public:
virtual void Write(const std::string &script_name, std::ostream &stream,
const std::vector<FunctionInfoPtr> &stats) = 0;
};
} // namespace amx_profiler
#endif // !AMX_PROFILER_PROFILE_WRITER_H
|
Include fstream for file reading and such. | #pragma once
#include <unistd.h>
#include <iostream>
#include <list>
#include <map>
#include <mutex>
#include <unordered_map>
#include <queue>
#include <sstream>
#include <set>
#include <thread>
#include <tuple>
#include <vector> | #pragma once
#include <unistd.h>
#include <fstream>
#include <iostream>
#include <list>
#include <map>
#include <mutex>
#include <unordered_map>
#include <queue>
#include <sstream>
#include <set>
#include <thread>
#include <tuple>
#include <vector> |
Remove unused ioctls and unused structure | /*
* Copyright (C) Sistina Software, Inc. 1997-2003 All rights reserved.
* Copyright (C) 2004-2005 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 GNU General Public License v.2.
*/
#ifndef __GFS2_IOCTL_DOT_H__
#define __GFS2_IOCTL_DOT_H__
#define _GFS2C_(x) (('G' << 16) | ('2' << 8) | (x))
/* Ioctls implemented */
#define GFS2_IOCTL_IDENTIFY _GFS2C_(1)
#define GFS2_IOCTL_SUPER _GFS2C_(2)
#define GFS2_IOCTL_SETFLAGS _GFS2C_(3)
#define GFS2_IOCTL_GETFLAGS _GFS2C_(4)
struct gfs2_ioctl {
unsigned int gi_argc;
const char **gi_argv;
char __user *gi_data;
unsigned int gi_size;
uint64_t gi_offset;
};
#endif /* ___GFS2_IOCTL_DOT_H__ */
| /*
* Copyright (C) Sistina Software, Inc. 1997-2003 All rights reserved.
* Copyright (C) 2004-2005 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 GNU General Public License v.2.
*/
#ifndef __GFS2_IOCTL_DOT_H__
#define __GFS2_IOCTL_DOT_H__
#define _GFS2C_(x) (('G' << 16) | ('2' << 8) | (x))
/* Ioctls implemented */
#define GFS2_IOCTL_SETFLAGS _GFS2C_(3)
#define GFS2_IOCTL_GETFLAGS _GFS2C_(4)
#endif /* ___GFS2_IOCTL_DOT_H__ */
|
Check if osKernelStart() is called from ISR | /*
* Copyright (c) 2018 Intel Corporation
*
* SPDX-License-Identifier: Apache-2.0
*/
#include <kernel_structs.h>
#include <cmsis_os.h>
#include <ksched.h>
extern const k_tid_t _main_thread;
/**
* @brief Get the RTOS kernel system timer counter
*/
uint32_t osKernelSysTick(void)
{
return k_cycle_get_32();
}
/**
* @brief Initialize the RTOS Kernel for creating objects.
*/
osStatus osKernelInitialize(void)
{
return osOK;
}
/**
* @brief Start the RTOS Kernel.
*/
osStatus osKernelStart(void)
{
return osOK;
}
/**
* @brief Check if the RTOS kernel is already started.
*/
int32_t osKernelRunning(void)
{
return _has_thread_started(_main_thread);
}
| /*
* Copyright (c) 2018 Intel Corporation
*
* SPDX-License-Identifier: Apache-2.0
*/
#include <kernel_structs.h>
#include <cmsis_os.h>
#include <ksched.h>
extern const k_tid_t _main_thread;
/**
* @brief Get the RTOS kernel system timer counter
*/
uint32_t osKernelSysTick(void)
{
return k_cycle_get_32();
}
/**
* @brief Initialize the RTOS Kernel for creating objects.
*/
osStatus osKernelInitialize(void)
{
return osOK;
}
/**
* @brief Start the RTOS Kernel.
*/
osStatus osKernelStart(void)
{
if (_is_in_isr()) {
return osErrorISR;
}
return osOK;
}
/**
* @brief Check if the RTOS kernel is already started.
*/
int32_t osKernelRunning(void)
{
return _has_thread_started(_main_thread);
}
|
Add MIN and MAX macros. | #ifndef UTILS_H
#define UTILS_H
#include <curses.h>
#include <stdint.h>
void color_str(WINDOW *, uint32_t, uint32_t, int16_t, int16_t, const char *);
void init_seed_srand(void);
#endif /* UTILS_H */
| #ifndef UTILS_H
#define UTILS_H
#include <curses.h>
#include <stdint.h>
#define MIN(a,b) (((a)<(b))?(a):(b))
#define MAX(a,b) (((a)>(b))?(a):(b))
void color_str(WINDOW *, uint32_t, uint32_t, int16_t, int16_t, const char *);
void init_seed_srand(void);
#endif /* UTILS_H */
|
Fix alt function number calculation | // stm32f4xx_prefix.c becomes the initial portion of the generated pins file.
#include <stdio.h>
#include "py/obj.h"
#include "pin.h"
#include MICROPY_HAL_H
#define AF(af_idx, af_fn, af_unit, af_type, af_ptr) \
{ \
{ &pin_af_type }, \
.name = MP_QSTR_AF ## af_idx ## _ ## af_fn ## af_unit, \
.idx = (af_idx), \
.fn = AF_FN_ ## af_fn, \
.unit = (af_unit), \
.type = AF_PIN_TYPE_ ## af_fn ## _ ## af_type, \
.af_fn = (af_ptr) \
}
#define PIN(p_port, p_pin, p_af, p_adc_num, p_adc_channel) \
{ \
{ &pin_type }, \
.name = MP_QSTR_ ## p_port ## p_pin, \
.port = PORT_ ## p_port, \
.pin = (p_pin), \
.num_af = (sizeof(p_af) / sizeof(pin_obj_t)), \
.pin_mask = (1 << ((p_pin) & 0x0f)), \
.gpio = GPIO ## p_port, \
.af = p_af, \
.adc_num = p_adc_num, \
.adc_channel = p_adc_channel, \
}
| // stm32f4xx_prefix.c becomes the initial portion of the generated pins file.
#include <stdio.h>
#include "py/obj.h"
#include "pin.h"
#include MICROPY_HAL_H
#define AF(af_idx, af_fn, af_unit, af_type, af_ptr) \
{ \
{ &pin_af_type }, \
.name = MP_QSTR_AF ## af_idx ## _ ## af_fn ## af_unit, \
.idx = (af_idx), \
.fn = AF_FN_ ## af_fn, \
.unit = (af_unit), \
.type = AF_PIN_TYPE_ ## af_fn ## _ ## af_type, \
.af_fn = (af_ptr) \
}
#define PIN(p_port, p_pin, p_af, p_adc_num, p_adc_channel) \
{ \
{ &pin_type }, \
.name = MP_QSTR_ ## p_port ## p_pin, \
.port = PORT_ ## p_port, \
.pin = (p_pin), \
.num_af = (sizeof(p_af) / sizeof(pin_af_obj_t)), \
.pin_mask = (1 << ((p_pin) & 0x0f)), \
.gpio = GPIO ## p_port, \
.af = p_af, \
.adc_num = p_adc_num, \
.adc_channel = p_adc_channel, \
}
|
Work around Win/Clang eval order bug | /*
* Copyright 2013 Google Inc.
*
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
#ifndef GrProxyMove_DEFINED
#define GrProxyMove_DEFINED
// In a few places below we rely on braced initialization order being defined by the C++ spec (left
// to right). We use operator-> on a sk_sp and then in a later argument std::move() the sk_sp. GCC
// 4.9.0 and earlier has a bug where the left to right order evaluation isn't implemented correctly.
#if defined(__GNUC__) && !defined(__clang__)
# define GCC_VERSION (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__)
# if (GCC_VERSION > 40900)
# define GCC_EVAL_ORDER_BUG 0
# else
# define GCC_EVAL_ORDER_BUG 1
# endif
# undef GCC_VERSION
#else
# define GCC_EVAL_ORDER_BUG 0
#endif
#if GCC_EVAL_ORDER_BUG
# define GR_PROXY_MOVE(X) (X)
#else
# define GR_PROXY_MOVE(X) (std::move(X))
#endif
#undef GCC_EVAL_ORDER_BUG
#endif
| /*
* Copyright 2013 Google Inc.
*
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
#ifndef GrProxyMove_DEFINED
#define GrProxyMove_DEFINED
// In a few places below we rely on braced initialization order being defined by the C++ spec (left
// to right). We use operator-> on a sk_sp and then in a later argument std::move() the sk_sp. GCC
// 4.9.0 and earlier has a bug where the left to right order evaluation isn't implemented correctly.
//
// Clang has the same bug when targeting Windows (http://crbug.com/687259).
// TODO(hans): Remove work-around once Clang is fixed.
#if defined(__GNUC__) && !defined(__clang__)
# define GCC_VERSION (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__)
# if (GCC_VERSION > 40900)
# define GCC_EVAL_ORDER_BUG 0
# else
# define GCC_EVAL_ORDER_BUG 1
# endif
# undef GCC_VERSION
#elif defined(_MSC_VER) && defined(__clang__)
# define GCC_EVAL_ORDER_BUG 1
#else
# define GCC_EVAL_ORDER_BUG 0
#endif
#if GCC_EVAL_ORDER_BUG
# define GR_PROXY_MOVE(X) (X)
#else
# define GR_PROXY_MOVE(X) (std::move(X))
#endif
#undef GCC_EVAL_ORDER_BUG
#endif
|
Fix mistype in color structure |
typedef struct {
long double r;
long double b;
long double g;
long double a;
} cgColor;
unsigned int framebuffer_h;
unsigned int framebuffer_v;
cgColor ** framebuffer;
void init_framebuffer(unsigned int h, unsigned int v);
|
typedef struct {
long double r;
long double g;
long double b;
long double a;
} cgColor;
unsigned int framebuffer_h;
unsigned int framebuffer_v;
cgColor ** framebuffer;
void init_framebuffer(unsigned int h, unsigned int v);
|
Define bool type together with true/false | #ifndef TYPES_H
#define TYPES_H
// Explicitly-sized versions of integer types
typedef __signed char int8_t;
typedef unsigned char uint8_t;
typedef short int16_t;
typedef unsigned short uint16_t;
typedef int int32_t;
typedef unsigned int uint32_t;
typedef long long int64_t;
typedef unsigned long long uint64_t;
// size_t is used for memory object sizes.
typedef uint32_t size_t;
#endif /* TYPES_H */
| #ifndef TYPES_H
#define TYPES_H
// Explicitly-sized versions of integer types
typedef __signed char int8_t;
typedef unsigned char uint8_t;
typedef short int16_t;
typedef unsigned short uint16_t;
typedef int int32_t;
typedef unsigned int uint32_t;
typedef long long int64_t;
typedef unsigned long long uint64_t;
typedef uint8_t bool;
#define true 1;
#define false 0;
// size_t is used for memory object sizes.
typedef uint32_t size_t;
#endif /* TYPES_H */
|
Add a simple way to add memory locations of format | //===-- X86InstrBuilder.h - Functions to aid building x86 insts -*- C++ -*-===//
//
// This file exposes functions that may be used with BuildMI from the
// MachineInstrBuilder.h file to handle X86'isms in a clean way.
//
// The BuildMem function may be used with the BuildMI function to add entire
// memory references in a single, typed, function call. X86 memory references
// can be very complex expressions (described in the README), so wrapping them
// up behind an easier to use interface makes sense. Descriptions of the
// functions are included below.
//
//===----------------------------------------------------------------------===//
#ifndef X86INSTRBUILDER_H
#define X86INSTRBUILDER_H
#include "llvm/CodeGen/MachineInstrBuilder.h"
/// addDirectMem - This function is used to add a direct memory reference to the
/// current instruction. Because memory references are always represented with
/// four values, this adds: Reg, [1, NoReg, 0] to the instruction
///
inline const MachineInstrBuilder &addDirectMem(const MachineInstrBuilder &MIB,
unsigned Reg) {
return MIB.addReg(Reg).addZImm(1).addMReg(0).addSImm(0);
}
#endif
| //===-- X86InstrBuilder.h - Functions to aid building x86 insts -*- C++ -*-===//
//
// This file exposes functions that may be used with BuildMI from the
// MachineInstrBuilder.h file to handle X86'isms in a clean way.
//
// The BuildMem function may be used with the BuildMI function to add entire
// memory references in a single, typed, function call. X86 memory references
// can be very complex expressions (described in the README), so wrapping them
// up behind an easier to use interface makes sense. Descriptions of the
// functions are included below.
//
//===----------------------------------------------------------------------===//
#ifndef X86INSTRBUILDER_H
#define X86INSTRBUILDER_H
#include "llvm/CodeGen/MachineInstrBuilder.h"
/// addDirectMem - This function is used to add a direct memory reference to the
/// current instruction. Because memory references are always represented with
/// four values, this adds: Reg, [1, NoReg, 0] to the instruction
///
inline const MachineInstrBuilder &addDirectMem(const MachineInstrBuilder &MIB,
unsigned Reg) {
return MIB.addReg(Reg).addZImm(1).addMReg(0).addSImm(0);
}
/// addRegOffset -
///
///
inline const MachineInstrBuilder &addRegOffset(const MachineInstrBuilder &MIB,
unsigned Reg, unsigned Offset) {
return MIB.addReg(Reg).addZImm(1).addMReg(0).addSImm(Offset);
}
#endif
|
Test all functions from tour.h. | #include "tour.h"
#define NCITIES 5
int main() {
tour t = create_tour(NCITIES);
int i;
for (i = 0; i < NCITIES; i++)
{
printf("%d\n", t[i]);
}
printf("Hello!");
return 0;
} | #include "tour.h"
#define NCITIES 5
#define STARTPOINT 2
int main() {
tour t = create_tour(NCITIES);
populate_tour(t, NCITIES);
start_point(t, STARTPOINT);
swap_cities(t, 3, 4);
int i;
for (i = 0; i < NCITIES; i++)
{
printf("%d\n", t[i]);
}
printf("Hello!\n");
return 0;
} |
Update tiledb version to 1.8.0 for dev | /*
* @file version.h
*
* @section LICENSE
*
* The MIT License
*
* @copyright Copyright (c) 2017-2020 TileDB, Inc.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
#define TILEDB_VERSION_MAJOR 1
#define TILEDB_VERSION_MINOR 7
#define TILEDB_VERSION_PATCH 0
| /*
* @file version.h
*
* @section LICENSE
*
* The MIT License
*
* @copyright Copyright (c) 2017-2020 TileDB, Inc.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
#define TILEDB_VERSION_MAJOR 1
#define TILEDB_VERSION_MINOR 8
#define TILEDB_VERSION_PATCH 0
|
Add VPS target seeking code. | #include <joyos.h>
#include "platform.h"
#include "navigation.h"
extern volatile uint8_t robot_id;
int usetup (void) {
robot_id = 7;
platform_init();
nav_init();
return 0;
}
int umain (void) {
printf("Hello, world!\n");
nav_start();
printf("Nav started, setting coords\n");
moveToPoint(10, 0, 150);
//turnToHeading(45);
printf("Coords set\n");
return 0;
}
| #include <joyos.h>
#include "platform.h"
#include "navigation.h"
extern volatile uint8_t robot_id;
int usetup(void) {
robot_id = 7;
platform_init();
nav_init();
return 0;
}
int umain(void) {
printf("Hello, world!\n");
nav_start();
printf("Nav started, setting coords\n");
moveToPoint(10, 0, 150);
printf("Coords set\n");
//while (1) {
// copy_objects();
// moveToPoint(objects[2].x, objects[2].y, 200);
// waitForMovementComplete();
//}
return 0;
}
|
Make spacing depend on font size | #ifndef GAME_H
#define GAME_H
#include <stdint.h>
#define SPACING 5
#define FONT "cairo:monospace"
#define FONT_SIZE 12
#define TILE_SIZE (FONT_SIZE * 4)
#define GRID_WIDTH 4
#define GRID_HEIGHT 4
#define GRID_SIZE (GRID_WIDTH * GRID_HEIGHT)
#define BOARD_WIDTH (SPACING + TILE_SIZE * GRID_WIDTH + SPACING * (GRID_WIDTH - 1) + SPACING)
#define BOARD_HEIGHT (SPACING + TILE_SIZE * GRID_HEIGHT + SPACING * (GRID_HEIGHT - 1) + SPACING)
#define BOARD_OFFSET_Y SPACING + TILE_SIZE + SPACING
#define SCREEN_WIDTH SPACING + BOARD_WIDTH + SPACING
#define SCREEN_HEIGHT BOARD_OFFSET_Y + BOARD_HEIGHT + SPACING
extern int SCREEN_PITCH;
typedef struct
{
int up;
int down;
int left;
int right;
int start;
} key_state_t;
void game_calculate_pitch(void);
void game_init(uint16_t *frame_buf);
void game_deinit(void);
void game_reset(void);
void game_update(float delta, key_state_t *new_ks);
void game_render(void);
#endif // GAME_H
| #ifndef GAME_H
#define GAME_H
#include <stdint.h>
#define FONT "cairo:monospace"
#define FONT_SIZE 20
#define SPACING (FONT_SIZE * 0.4)
#define TILE_SIZE (FONT_SIZE * 4)
#define GRID_WIDTH 4
#define GRID_HEIGHT 4
#define GRID_SIZE (GRID_WIDTH * GRID_HEIGHT)
#define BOARD_WIDTH (SPACING + TILE_SIZE * GRID_WIDTH + SPACING * (GRID_WIDTH - 1) + SPACING)
#define BOARD_HEIGHT (SPACING + TILE_SIZE * GRID_HEIGHT + SPACING * (GRID_HEIGHT - 1) + SPACING)
#define BOARD_OFFSET_Y SPACING + TILE_SIZE + SPACING
#define SCREEN_WIDTH SPACING + BOARD_WIDTH + SPACING
#define SCREEN_HEIGHT BOARD_OFFSET_Y + BOARD_HEIGHT + SPACING
extern int SCREEN_PITCH;
typedef struct
{
int up;
int down;
int left;
int right;
int start;
} key_state_t;
void game_calculate_pitch(void);
void game_init(uint16_t *frame_buf);
void game_deinit(void);
void game_reset(void);
void game_update(float delta, key_state_t *new_ks);
void game_render(void);
#endif // GAME_H
|
Remove declaration of obsolete arch_init_clk_ops() | #ifndef __ASM_MIPS_CLOCK_H
#define __ASM_MIPS_CLOCK_H
#include <linux/kref.h>
#include <linux/list.h>
#include <linux/seq_file.h>
#include <linux/clk.h>
struct clk;
struct clk_ops {
void (*init) (struct clk *clk);
void (*enable) (struct clk *clk);
void (*disable) (struct clk *clk);
void (*recalc) (struct clk *clk);
int (*set_rate) (struct clk *clk, unsigned long rate, int algo_id);
long (*round_rate) (struct clk *clk, unsigned long rate);
};
struct clk {
struct list_head node;
const char *name;
int id;
struct module *owner;
struct clk *parent;
struct clk_ops *ops;
struct kref kref;
unsigned long rate;
unsigned long flags;
};
#define CLK_ALWAYS_ENABLED (1 << 0)
#define CLK_RATE_PROPAGATES (1 << 1)
/* Should be defined by processor-specific code */
void arch_init_clk_ops(struct clk_ops **, int type);
int clk_init(void);
int __clk_enable(struct clk *);
void __clk_disable(struct clk *);
void clk_recalc_rate(struct clk *);
int clk_register(struct clk *);
void clk_unregister(struct clk *);
#endif /* __ASM_MIPS_CLOCK_H */
| #ifndef __ASM_MIPS_CLOCK_H
#define __ASM_MIPS_CLOCK_H
#include <linux/kref.h>
#include <linux/list.h>
#include <linux/seq_file.h>
#include <linux/clk.h>
struct clk;
struct clk_ops {
void (*init) (struct clk *clk);
void (*enable) (struct clk *clk);
void (*disable) (struct clk *clk);
void (*recalc) (struct clk *clk);
int (*set_rate) (struct clk *clk, unsigned long rate, int algo_id);
long (*round_rate) (struct clk *clk, unsigned long rate);
};
struct clk {
struct list_head node;
const char *name;
int id;
struct module *owner;
struct clk *parent;
struct clk_ops *ops;
struct kref kref;
unsigned long rate;
unsigned long flags;
};
#define CLK_ALWAYS_ENABLED (1 << 0)
#define CLK_RATE_PROPAGATES (1 << 1)
int clk_init(void);
int __clk_enable(struct clk *);
void __clk_disable(struct clk *);
void clk_recalc_rate(struct clk *);
int clk_register(struct clk *);
void clk_unregister(struct clk *);
#endif /* __ASM_MIPS_CLOCK_H */
|
Add readinto and readlines to qstrs. | // qstrs specific to this port
Q(pyb)
Q(millis)
Q(elapsed_millis)
Q(delay)
Q(LED)
Q(on)
Q(off)
Q(toggle)
Q(Switch)
Q(value)
Q(readall)
Q(readline)
Q(FileIO)
| // qstrs specific to this port
Q(pyb)
Q(millis)
Q(elapsed_millis)
Q(delay)
Q(LED)
Q(on)
Q(off)
Q(toggle)
Q(Switch)
Q(value)
Q(readall)
Q(readinto)
Q(readline)
Q(readlines)
Q(FileIO)
|
Fix iOS nightly release breakage. | /* Copyright 2022 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_LITE_IOS_TENSORFLOWLITEC_H_
#define TENSORFLOW_LITE_IOS_TENSORFLOWLITEC_H_
#include "tensorflow/lite/builtin_ops.h"
#include "tensorflow/lite/c/c_api.h"
#include "tensorflow/lite/c/c_api_experimental.h"
#include "tensorflow/lite/c/c_api_types.h"
#include "tensorflow/lite/c/common.h"
#include "tensorflow/lite/delegates/xnnpack/xnnpack_delegate.h"
#endif // TENSORFLOW_LITE_IOS_TENSORFLOWLITEC_H_
| /* Copyright 2022 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_LITE_IOS_TENSORFLOWLITEC_H_
#define TENSORFLOW_LITE_IOS_TENSORFLOWLITEC_H_
#include "tensorflow/lite/builtin_ops.h"
#include "tensorflow/lite/c/c_api.h"
#include "tensorflow/lite/c/c_api_experimental.h"
#include "tensorflow/lite/c/c_api_types.h"
#include "tensorflow/lite/c/common.h"
#include "tensorflow/lite/core/c/c_api.h"
#include "tensorflow/lite/delegates/xnnpack/xnnpack_delegate.h"
#endif // TENSORFLOW_LITE_IOS_TENSORFLOWLITEC_H_
|
Add barrier, fadd, and load. | #ifndef ATOMIC_H
#define ATOMIC_H
#include "fibrili.h"
#define atomic_fence() fibrili_fence()
#define atomic_lock(lock) fibrili_lock(lock)
#define atomic_unlock(lock) fibrili_unlock(lock)
#endif /* end of include guard: ATOMIC_H */
| #ifndef ATOMIC_H
#define ATOMIC_H
#include "fibrili.h"
#define atomic_fence() fibrili_fence()
#define atomic_lock(lock) fibrili_lock(lock)
#define atomic_unlock(lock) fibrili_unlock(lock)
#define atomic_load(val) __atomic_load_n(&(val), __ATOMIC_ACQUIRE)
#define atomic_fadd(val, n) __atomic_fetch_add(&(val), n, __ATOMIC_ACQ_REL)
static inline void atomic_barrier(int nprocs)
{
static volatile int _count;
static volatile int _sense;
static volatile __thread int _local_sense;
int sense = !_local_sense;
if (atomic_fadd(_count, 1) == nprocs - 1) {
_count = 0;
_sense = sense;
}
while (_sense != sense);
_local_sense = sense;
atomic_fence();
}
#endif /* end of include guard: ATOMIC_H */
|
Add functionality to bootstrap header | #import <CoreData/CoreData.h>
#import <FactoryGentleman/FactoryGentleman.h>
#import "CFGFactoryDefiner.h"
#import "CFGObjectBuilder.h"
| #import <CoreData/CoreData.h>
#import <FactoryGentleman/FactoryGentleman.h>
#import "CFGCoreFactoryGentleman.h"
#import "CFGFactoryDefiner.h"
#import "CFGObjectBuilder.h"
|
Include assert.h explicitly to fix windows build | // Copyright 2013 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.
//
// Helper function for bit twiddling
#ifndef WOFF2_PORT_H_
#define WOFF2_PORT_H_
namespace woff2 {
typedef unsigned int uint32;
inline int Log2Floor(uint32 n) {
#if defined(__GNUC__)
return n == 0 ? -1 : 31 ^ __builtin_clz(n);
#else
if (n == 0)
return -1;
int log = 0;
uint32 value = n;
for (int i = 4; i >= 0; --i) {
int shift = (1 << i);
uint32 x = value >> shift;
if (x != 0) {
value = x;
log += shift;
}
}
assert(value == 1);
return log;
#endif
}
} // namespace woff2
#endif // WOFF2_PORT_H_
| // Copyright 2013 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.
//
// Helper function for bit twiddling
#ifndef WOFF2_PORT_H_
#define WOFF2_PORT_H_
#include <assert.h>
namespace woff2 {
typedef unsigned int uint32;
inline int Log2Floor(uint32 n) {
#if defined(__GNUC__)
return n == 0 ? -1 : 31 ^ __builtin_clz(n);
#else
if (n == 0)
return -1;
int log = 0;
uint32 value = n;
for (int i = 4; i >= 0; --i) {
int shift = (1 << i);
uint32 x = value >> shift;
if (x != 0) {
value = x;
log += shift;
}
}
assert(value == 1);
return log;
#endif
}
} // namespace woff2
#endif // WOFF2_PORT_H_
|
Make an empty struct nonempty. | // This is the last-resort version of this file. It will be used only
// if the comm layer implementation does not supply one.
#ifndef _chpl_comm_task_decls_h
#define _chpl_comm_task_decls_h
// Define the type of a n.b. communications handle.
typedef void* chpl_comm_nb_handle_t;
typedef struct {
} chpl_comm_taskPrvData_t;
#undef HAS_CHPL_CACHE_FNS
#endif
| // This is the last-resort version of this file. It will be used only
// if the comm layer implementation does not supply one.
#ifndef _chpl_comm_task_decls_h
#define _chpl_comm_task_decls_h
// Define the type of a n.b. communications handle.
typedef void* chpl_comm_nb_handle_t;
typedef struct {
int dummy; // structs must be nonempty
} chpl_comm_taskPrvData_t;
#undef HAS_CHPL_CACHE_FNS
#endif
|
Allow printing of status after step | #pragma once
#include <string>
namespace smurff {
struct StatusItem
{
std::string phase;
int iter;
int phase_iter;
std::vector<double> model_norms;
double rmse_avg;
double rmse_1sample;
double train_rmse;
double auc_1sample;
double auc_avg;
double elapsed_iter;
double nnz_per_sec;
double samples_per_sec;
// to csv
static std::string getCsvHeader();
std::string asCsvString() const;
};
} | |
Use MAP_ANON if MAP_ANONYMOUS is not defined. | #include <stdlib.h>
#include <string.h>
#include <sys/mman.h>
#include "iobuf.h"
unsigned iobuf_bufsize = 8192;
int iobuf_init(iobuf* io, int fd, unsigned bufsize, char* buffer, unsigned flags)
{
memset(io, 0, sizeof *io);
if (!bufsize) bufsize = iobuf_bufsize;
if (!buffer) {
if ((buffer = mmap(0, bufsize, PROT_READ|PROT_WRITE,
MAP_PRIVATE|MAP_ANONYMOUS, 0, 0)) != 0)
flags |= IOBUF_NEEDSMUNMAP;
else {
if ((buffer = malloc(bufsize)) == 0) return 0;
flags |= IOBUF_NEEDSFREE;
}
}
io->fd = fd;
io->buffer = buffer;
io->bufsize = bufsize;
io->flags = flags;
return 1;
}
| #include <sys/types.h>
#include <stdlib.h>
#include <string.h>
#include <sys/mman.h>
#include "iobuf.h"
unsigned iobuf_bufsize = 8192;
#ifndef MAP_ANONYMOUS
#define MAP_ANONYMOUS MAP_ANON
#endif
int iobuf_init(iobuf* io, int fd, unsigned bufsize, char* buffer, unsigned flags)
{
memset(io, 0, sizeof *io);
if (!bufsize) bufsize = iobuf_bufsize;
if (!buffer) {
if ((buffer = mmap(0, bufsize, PROT_READ|PROT_WRITE,
MAP_PRIVATE|MAP_ANONYMOUS, 0, 0)) != 0)
flags |= IOBUF_NEEDSMUNMAP;
else {
if ((buffer = malloc(bufsize)) == 0) return 0;
flags |= IOBUF_NEEDSFREE;
}
}
io->fd = fd;
io->buffer = buffer;
io->bufsize = bufsize;
io->flags = flags;
return 1;
}
|
Support SuRF on-board DS1825 in ds18b20 demo | /* Use a crystal if one is installed. Much more accurate timing
* results. */
#define BSP430_PLATFORM_BOOT_CONFIGURE_LFXT1 1
/* Application does output: support spin-for-jumper */
#ifndef configBSP430_PLATFORM_SPIN_FOR_JUMPER
#define configBSP430_PLATFORM_SPIN_FOR_JUMPER 1
#endif /* configBSP430_PLATFORM_SPIN_FOR_JUMPER */
#define configBSP430_CONSOLE 1
#define configBSP430_UPTIME 1
/* Specify placement on P1.7 */
#define APP_DS18B20_PORT_HAL BSP430_HAL_PORT1
#define APP_DS18B20_BIT BIT7
/* Request the corresponding HAL */
#define configBSP430_HAL_PORT1 1
/* Get platform defaults */
#include <bsp430/platform/bsp430_config.h>
| /* Use a crystal if one is installed. Much more accurate timing
* results. */
#define BSP430_PLATFORM_BOOT_CONFIGURE_LFXT1 1
/* Application does output: support spin-for-jumper */
#ifndef configBSP430_PLATFORM_SPIN_FOR_JUMPER
#define configBSP430_PLATFORM_SPIN_FOR_JUMPER 1
#endif /* configBSP430_PLATFORM_SPIN_FOR_JUMPER */
#define configBSP430_CONSOLE 1
#define configBSP430_UPTIME 1
#if BSP430_PLATFORM_SURF - 0
/* SuRF has a DS1825 on P3.7, but the software is the same */
#define APP_DS18B20_PORT_HAL BSP430_HAL_PORT3
#define APP_DS18B20_BIT BIT7
#define configBSP430_HAL_PORT3 1
#else /* BSP430_PLATFORM_SURF */
/* External hookup DS18B20 to on P1.7 */
#define APP_DS18B20_PORT_HAL BSP430_HAL_PORT1
#define APP_DS18B20_BIT BIT7
/* Request the corresponding HAL */
#define configBSP430_HAL_PORT1 1
#endif /* BSP430_PLATFORM_SURF */
/* Get platform defaults */
#include <bsp430/platform/bsp430_config.h>
|
Disable SPI hal from pca10001 board. | #ifndef NRF51_HAL_CONF_H__
#define NRF51_HAL_CONF_H__
#define HAL_UART_MODULE_ENABLED
#define HAL_SPI_MODULE_ENABLED
#define HAL_TIME_MODULE_ENABLED
#endif // NRF51_HAL_CONF_H__
| #ifndef NRF51_HAL_CONF_H__
#define NRF51_HAL_CONF_H__
#define HAL_UART_MODULE_ENABLED
// #define HAL_SPI_MODULE_ENABLED
#define HAL_TIME_MODULE_ENABLED
#endif // NRF51_HAL_CONF_H__
|
Add a new trac redirect plugin | /*
* This file is part of the beirdobot package
* Copyright (C) 2012 Raymond Wagner
*
* This plugin uses code gratuitously stolen from the 'fart' plugin.
* See that for any real licensing information.
*/
/*HEADER---------------------------------------------------
* $Id$
*
* Copyright 2012 Raymond Wagner
* All rights reserved
*/
/* INCLUDE FILES */
#include <pthread.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "botnet.h"
#include "environment.h"
#include "structs.h"
#include "protos.h"
#include "logging.h"
/* INTERNAL FUNCTION PROTOTYPES */
void regexpFuncTrac( IRCServer_t *server, IRCChannel_t *channel, char *who,
char *msg, IRCMsgType_t type, int *ovector, int ovecsize,
void *tag );
/* CVS generated ID string */
static char ident[] _UNUSED_ =
"$Id$";
static char *contentRegexp = "(?i)(?:\\B|\\s|^)#(\\d+)(?:\\s|\\.|,|$)";
void plugin_initialize( char *args )
{
LogPrintNoArg( LOG_NOTICE, "Initializing trac redirect..." );
regexp_add( NULL, (const char *)contentRegexp, regexpFuncTrac, NULL );
}
void plugin_shutdown( void )
{
LogPrintNoArg( LOG_NOTICE, "Removing trac redirect..." );
regexp_remove( NULL, contentRegexp );
}
void regexpFuncTrac( IRCServer_t *server, IRCChannel_t *channel, char *who,
char *msg, IRCMsgType_t type, int *ovector, int ovecsize,
void *tag )
{
char *message, *ticketid;
if( !channel ) {
return;
}
ticketid = regexp_substring( msg, ovector, ovecsize, 1 );
if (ticketid)
{
message = (char *)malloc(35+strlen(ticketid)+2);
sprintf( message, "http://code.mythtv.org/trac/ticket/%s", ticketid );
LoggedActionMessage( server, channel, message );
free(ticketid);
free(message);
}
}
/*
* vim:ts=4:sw=4:ai:et:si:sts=4
*/
| |
Change AndroidPlatform variables to FWPlatformBase, switch include | /*
* Copyright (C) Sometrik oy 2015
*
*/
#include <FWContextBase.h>
#include <AndroidPlatform.h>
class Example1 : public FWContextBase {
public:
Example1(AndroidPlatform * _platform) : FWContextBase(_platform), platform(_platform) { }
bool Init();
void onDraw();
void onShutdown();
private:
AndroidPlatform * platform;
};
| /*
* Copyright (C) Sometrik oy 2015
*
*/
#include <FWContextBase.h>
#include <FWPlatformBase.h>
class Example1 : public FWContextBase {
public:
Example1(FWPlatformBase * _platform) : FWContextBase(_platform), platform(_platform) { }
bool Init();
void onDraw();
void onShutdown();
private:
FWPlatformBase * platform;
};
|
Patch from Bernardo Innocenti: Remove use of cast-as-l-value extension, removed in GCC 3.5. |
#include <errno.h>
#include <asm/ptrace.h>
#include <sys/syscall.h>
int
ptrace(int request, int pid, int addr, int data)
{
long ret;
long res;
if (request > 0 && request < 4) (long *)data = &ret;
__asm__ volatile ("movel %1,%/d0\n\t"
"movel %2,%/d1\n\t"
"movel %3,%/d2\n\t"
"movel %4,%/d3\n\t"
"movel %5,%/d4\n\t"
"trap #0\n\t"
"movel %/d0,%0"
:"=g" (res)
:"i" (__NR_ptrace), "g" (request), "g" (pid),
"g" (addr), "g" (data) : "%d0", "%d1", "%d2", "%d3", "%d4");
if (res >= 0) {
if (request > 0 && request < 4) {
__set_errno(0);
return (ret);
}
return (int) res;
}
__set_errno(-res);
return -1;
}
|
#include <errno.h>
#include <asm/ptrace.h>
#include <sys/syscall.h>
int
ptrace(int request, int pid, int addr, int data)
{
long ret;
long res;
if (request > 0 && request < 4) data = (int)&ret;
__asm__ volatile ("movel %1,%/d0\n\t"
"movel %2,%/d1\n\t"
"movel %3,%/d2\n\t"
"movel %4,%/d3\n\t"
"movel %5,%/d4\n\t"
"trap #0\n\t"
"movel %/d0,%0"
:"=g" (res)
:"i" (__NR_ptrace), "g" (request), "g" (pid),
"g" (addr), "g" (data) : "%d0", "%d1", "%d2", "%d3", "%d4");
if (res >= 0) {
if (request > 0 && request < 4) {
__set_errno(0);
return (ret);
}
return (int) res;
}
__set_errno(-res);
return -1;
}
|
Clean up smyrna files: remove unnecessary globals modify libraries not to rely on code in cmd/smyrna remove static declarations from .h files remove unnecessary libraries mark unused code and clean up warnings | #include "topviewsettings.h"
#include "gui.h"
void on_settingsOKBtn_clicked (GtkWidget *widget,gpointer user_data)
{
}
void on_settingsCancelBtn_clicked (GtkWidget *widget,gpointer user_data)
{
}
int load_settings_from_graph(Agraph_t *g)
{
return 1;
}
int update_graph_from_settings(Agraph_t *g)
{
return 1;
}
int show_settings_form()
{
gtk_widget_hide(glade_xml_get_widget(xml, "dlgSettings"));
gtk_widget_show(glade_xml_get_widget(xml, "dlgSettings"));
gtk_window_set_keep_above ((GtkWindow*)glade_xml_get_widget(xml, "dlgSettings"),1);
}
| /* vim:set shiftwidth=4 ts=8: */
/**********************************************************
* This software is part of the graphviz package *
* http://www.graphviz.org/ *
* *
* Copyright (c) 1994-2004 AT&T Corp. *
* and is licensed under the *
* Common Public License, Version 1.0 *
* by AT&T Corp. *
* *
* Information and Software Systems Research *
* AT&T Research, Florham Park NJ *
**********************************************************/
#include "topviewsettings.h"
#include "gui.h"
void on_settingsOKBtn_clicked(GtkWidget * widget, gpointer user_data)
{
}
void on_settingsCancelBtn_clicked(GtkWidget * widget, gpointer user_data)
{
}
int load_settings_from_graph(Agraph_t * g)
{
return 1;
}
int update_graph_from_settings(Agraph_t * g)
{
return 1;
}
int show_settings_form()
{
gtk_widget_hide(glade_xml_get_widget(xml, "dlgSettings"));
gtk_widget_show(glade_xml_get_widget(xml, "dlgSettings"));
gtk_window_set_keep_above((GtkWindow *)
glade_xml_get_widget(xml, "dlgSettings"), 1);
}
|
Reset default settings to stock kit configuration |
#ifndef __SETTINGS_H_
#define __SETTINGS_H_
#include <Arduino.h>
#include "Device.h"
// This section is for devices and their configuration
//Kit:
#define HAS_STD_LIGHTS (1)
#define LIGHTS_PIN 5
#define HAS_STD_CAPE (1)
#define HAS_STD_2X1_THRUSTERS (1)
#define HAS_STD_PILOT (1)
#define HAS_STD_CAMERAMOUNT (1)
#define CAMERAMOUNT_PIN 3
#define CAPE_VOLTAGE_PIN 0
#define CAPE_CURRENT_PIN 3
//After Market:
#define HAS_STD_CALIBRATIONLASERS (0)
#define CALIBRATIONLASERS_PIN 6
#define HAS_POLOLU_MINIMUV (1)
#define HAS_MS5803_14BA (0)
#define MS5803_14BA_I2C_ADDRESS 0x76
#define MIDPOINT 1500
#define LOGGING (1)
class Settings : public Device {
public:
static int smoothingIncriment; //How aggressive the throttle changes
static int deadZone_min;
static int deadZone_max;
static int capability_bitarray;
Settings():Device(){};
void device_setup();
void device_loop(Command cmd);
};
#endif
|
#ifndef __SETTINGS_H_
#define __SETTINGS_H_
#include <Arduino.h>
#include "Device.h"
// This section is for devices and their configuration
//Kit:
#define HAS_STD_LIGHTS (1)
#define LIGHTS_PIN 5
#define HAS_STD_CAPE (1)
#define HAS_STD_2X1_THRUSTERS (1)
#define HAS_STD_PILOT (1)
#define HAS_STD_CAMERAMOUNT (1)
#define CAMERAMOUNT_PIN 3
#define CAPE_VOLTAGE_PIN 0
#define CAPE_CURRENT_PIN 3
//After Market:
#define HAS_STD_CALIBRATIONLASERS (0)
#define CALIBRATIONLASERS_PIN 6
#define HAS_POLOLU_MINIMUV (0)
#define HAS_MS5803_14BA (0)
#define MS5803_14BA_I2C_ADDRESS 0x76
#define MIDPOINT 1500
#define LOGGING (1)
class Settings : public Device {
public:
static int smoothingIncriment; //How aggressive the throttle changes
static int deadZone_min;
static int deadZone_max;
static int capability_bitarray;
Settings():Device(){};
void device_setup();
void device_loop(Command cmd);
};
#endif
|
Change print symbol from O to +. | #include <string.h>
#include "window.h"
#include "grid.h"
#include "utils.h"
extern window_settings_t win_set;
void print_grid(WINDOW *win)
{
getmaxyx(win, win_set.maxGridHeight, win_set.maxGridWidth);
// If the grid is larger than the maximum height
// or width, then set it to max height or width
if (g.y_grid > win_set.maxGridHeight)
g.y_grid = win_set.maxGridHeight;
if (g.x_grid > win_set.maxGridWidth)
g.x_grid = win_set.maxGridWidth;
int32_t y_grid_step = win_set.maxGridHeight / g.y_grid;
int32_t x_grid_step = win_set.maxGridWidth / g.x_grid;
int32_t y_max_height = y_grid_step * g.y_grid;
int32_t x_max_height = x_grid_step * g.x_grid;
for(int32_t y=0;y<=y_max_height;y+=y_grid_step)
for(int32_t x=0;x<=x_max_height;x+=x_grid_step)
color_str(win, y, x, 0, 0, "O");
wnoutrefresh(win);
}
| #include <string.h>
#include "window.h"
#include "grid.h"
#include "utils.h"
extern window_settings_t win_set;
void print_grid(WINDOW *win)
{
getmaxyx(win, win_set.maxGridHeight, win_set.maxGridWidth);
// If the grid is larger than the maximum height
// or width, then set it to max height or width
if (g.y_grid > win_set.maxGridHeight)
g.y_grid = win_set.maxGridHeight;
if (g.x_grid > win_set.maxGridWidth)
g.x_grid = win_set.maxGridWidth;
int32_t y_grid_step = win_set.maxGridHeight / g.y_grid;
int32_t x_grid_step = win_set.maxGridWidth / g.x_grid;
int32_t y_max_height = y_grid_step * g.y_grid;
int32_t x_max_height = x_grid_step * g.x_grid;
for(int32_t y=0;y<=y_max_height;y+=y_grid_step)
for(int32_t x=0;x<=x_max_height;x+=x_grid_step)
color_str(win, y, x, 0, 0, "+");
wnoutrefresh(win);
}
|
Add tracker backend stump for MAP | /*
*
* OBEX Server
*
* Copyright (C) 2010-2011 Nokia Corporation
*
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*
*/
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include <errno.h>
#include "messages.h"
int messages_init(void)
{
return 0;
}
void messages_exit(void)
{
}
int messages_connect(void **s)
{
*s = NULL;
return 0;
}
void messages_disconnect(void *s)
{
}
int messages_set_notification_registration(void *session,
void (*send_event)(void *session,
struct messages_event *event, void *user_data),
void *user_data)
{
return -EINVAL;
}
int messages_set_folder(void *s, const char *name, gboolean cdup)
{
return -EINVAL;
}
int messages_get_folder_listing(void *session,
const char *name,
uint16_t max, uint16_t offset,
void (*callback)(void *session, int err, uint16_t size,
const char *name, void *user_data),
void *user_data)
{
return -EINVAL;
}
int messages_get_messages_listing(void *session,
const char *name,
uint16_t max, uint16_t offset, struct messages_filter *filter,
void (*callback)(void *session, int err, uint16_t size,
gboolean newmsg, const struct messages_message *message,
void *user_data),
void *user_data)
{
return -EINVAL;
}
int messages_get_message(void *session,
const char *handle,
unsigned long flags,
void (*callback)(void *session, int err, gboolean fmore,
const char *chunk, void *user_data),
void *user_data)
{
return -EINVAL;
}
void messages_abort(void *session)
{
}
| |
Improve loop (avg. from ~0.15 to ~0.07) | #include "euler_util.h"
#include <string.h>
#define MAX 7
int main(int argc, char *argv[])
{
float start = timeit();
char *forward = calloc(sizeof(char), sizeof(char) * MAX);
char *backward = calloc(sizeof(char), sizeof(char) * MAX);
size_t int_len;
int high = 0;
for (int x=100; x < 1000; x++) {
for (int y=100; y < 1000; y++) {
int_len = snprintf(forward, MAX, "%d", x * y);
for (int i=0, str_len=int_len-1; i < int_len; i++, str_len--)
backward[i] = forward[str_len];
if (strcmp(forward, backward) == 0 && atoi(backward) > high)
high = atoi(backward);
}
}
free(forward);
free(backward);
float stop = timeit();
printf("Answer: %d\n", high);
printf("Time: %.8f\n", stop - start);
return 0;
}
| #include "euler_util.h"
#include <string.h>
#define MAX 7
int main(int argc, char *argv[])
{
float start = timeit();
char product[MAX] = { '\0' };
int high = 0;
for (int x=100; x < 1000; x++) {
for (int y=x; y < 1000; y++) {
int canidate = x * y;
size_t int_len = snprintf(product, MAX, "%d", canidate);
int head = 0, tail = int_len - 1;
for (;head < tail && product[head] == product[tail]; head++, tail--)
;
if (head > tail && canidate > high)
high = canidate;
}
}
float stop = timeit();
printf("Answer: %d\n", high);
printf("Time: %.8f\n", stop - start);
return 0;
}
|
Use new NanoTime location header, oops. | #ifndef TIMEOUT_QUEUE_H
#define TIMEOUT_QUEUE_H
#include <map>
class TimeoutQueue {
typedef std::map<NanoTime, CallbackQueue> timeout_map_t;
LogHandle log_;
timeout_map_t timeout_queue_;
public:
TimeoutQueue(void)
: log_("/event/timeout/queue"),
timeout_queue_()
{ }
~TimeoutQueue()
{ }
bool empty(void) const
{
timeout_map_t::const_iterator it;
/*
* Since we allow elements within each CallbackQueue to be
* cancelled, we must scan them.
*
* XXX
* We really shouldn't allow this, even if it means we have
* to specialize CallbackQueue for this purpose or add
* virtual methods to it. As it is, we can return true
* for empty and for ready at the same time. And in those
* cases we have to call perform to garbage collect the
* unused CallbackQueues. We'll, quite conveniently,
* never make that call. Yikes.
*/
for (it = timeout_queue_.begin(); it != timeout_queue_.end(); ++it) {
if (it->second.empty())
continue;
return (false);
}
return (true);
}
Action *append(uintmax_t, SimpleCallback *);
uintmax_t interval(void) const;
void perform(void);
bool ready(void) const;
};
#endif /* !TIMEOUT_QUEUE_H */
| #ifndef TIMEOUT_QUEUE_H
#define TIMEOUT_QUEUE_H
#include <map>
#include <common/time/time.h>
class TimeoutQueue {
typedef std::map<NanoTime, CallbackQueue> timeout_map_t;
LogHandle log_;
timeout_map_t timeout_queue_;
public:
TimeoutQueue(void)
: log_("/event/timeout/queue"),
timeout_queue_()
{ }
~TimeoutQueue()
{ }
bool empty(void) const
{
timeout_map_t::const_iterator it;
/*
* Since we allow elements within each CallbackQueue to be
* cancelled, we must scan them.
*
* XXX
* We really shouldn't allow this, even if it means we have
* to specialize CallbackQueue for this purpose or add
* virtual methods to it. As it is, we can return true
* for empty and for ready at the same time. And in those
* cases we have to call perform to garbage collect the
* unused CallbackQueues. We'll, quite conveniently,
* never make that call. Yikes.
*/
for (it = timeout_queue_.begin(); it != timeout_queue_.end(); ++it) {
if (it->second.empty())
continue;
return (false);
}
return (true);
}
Action *append(uintmax_t, SimpleCallback *);
uintmax_t interval(void) const;
void perform(void);
bool ready(void) const;
};
#endif /* !TIMEOUT_QUEUE_H */
|
Use fgets(3) instead of getline(3) because whilst getline(3) is POSIX, it is not in the C89 or later standards | #ifndef READLINE_FALLBACK_H
#define READLINE_FALLBACK_H
#include <stdio.h>
#include <string.h>
char* readline(const char * prompt) {
char *result = malloc(1);
size_t n = 0;
printf("%s", prompt);
getline(&result, &n, stdin);
result[strlen(result)-1] = 0;
return result;
}
#endif /* READLINE_FALLBACK_H */
| #ifndef READLINE_FALLBACK_H
#define READLINE_FALLBACK_H
#include <stdio.h>
#include <string.h>
char* readline(const char * prompt) {
char *result = malloc(1024);
printf("%s", prompt);
fgets(result, 1023, stdin);
result[strlen(result)-1] = 0;
return result;
}
#endif /* READLINE_FALLBACK_H */
|
Choose only gcc to execute a specific portion of code | #include "fmt.h"
size_t fmt_escapecharxml(char* dest,uint32_t ch) {
char a[FMT_LONG], b[FMT_XLONG];
const char* s;
size_t i,j;
switch (ch) {
case '&': s="&"; goto string;
case '<': s="<"; goto string;
case '>': s=">"; goto string;
case '\'': s="'"; goto string;
case '"': s="""; goto string;
default:
a[i=fmt_ulong(a,ch)]=0;
b[0]='x';
b[j=fmt_xlong(b+1,ch)+1]=0;
s=a;
if (i>j) { s=b; i=j; }
if (dest) {
dest[0]='&';
dest[1]='#';
byte_copy(dest+2,i,s);
dest[i+2]=';';
}
return i+3;
}
string:
return fmt_str(dest,s);
}
#ifdef __GNUC__
size_t fmt_escapecharhtml(char* dest,uint32_t ch) __attribute__((__alias__("fmt_escapecharxml")));
#endif
| #include "fmt.h"
size_t fmt_escapecharxml(char* dest,uint32_t ch) {
char a[FMT_LONG], b[FMT_XLONG];
const char* s;
size_t i,j;
switch (ch) {
case '&': s="&"; goto string;
case '<': s="<"; goto string;
case '>': s=">"; goto string;
case '\'': s="'"; goto string;
case '"': s="""; goto string;
default:
a[i=fmt_ulong(a,ch)]=0;
b[0]='x';
b[j=fmt_xlong(b+1,ch)+1]=0;
s=a;
if (i>j) { s=b; i=j; }
if (dest) {
dest[0]='&';
dest[1]='#';
byte_copy(dest+2,i,s);
dest[i+2]=';';
}
return i+3;
}
string:
return fmt_str(dest,s);
}
#if defined(__GNUC__) && !defined(__llvm__)
size_t fmt_escapecharhtml(char* dest,uint32_t ch) __attribute__((__alias__("fmt_escapecharxml")));
#endif
|
Boost now supports std::unique_ptr/std::shared_ptr for python | // This file is part of SWGANH which is released under the MIT license.
// See file LICENSE or go to http://swganh.com/LICENSE
#pragma once
#include <memory>
namespace boost {
template<class T> const T* get_pointer(const std::shared_ptr<T>& ptr)
{
return ptr.get();
}
template<class T> T* get_pointer(std::shared_ptr<T>& ptr)
{
return ptr.get();
}
template<class T> const T* get_pointer(const std::unique_ptr<T>& ptr)
{
return ptr.get();
}
template<class T> T* get_pointer(std::unique_ptr<T>& ptr)
{
return ptr.get();
}
}
//#include <boost/python.hpp>
//namespace boost{ namespace python{
// template <class T>
// struct pointee< std::shared_ptr<T> >
// {
// typedef T type;
// };
//
//}}
| // This file is part of SWGANH which is released under the MIT license.
// See file LICENSE or go to http://swganh.com/LICENSE
#pragma once
#include <memory>
//namespace boost {
// template<class T> const T* get_pointer(const std::shared_ptr<T>& ptr)
// {
// return ptr.get();
// }
//
// template<class T> T* get_pointer(std::shared_ptr<T>& ptr)
// {
// return ptr.get();
// }
//
// template<class T> const T* get_pointer(const std::unique_ptr<T>& ptr)
// {
// return ptr.get();
// }
//
// template<class T> T* get_pointer(std::unique_ptr<T>& ptr)
// {
// return ptr.get();
// }
//}
//#include <boost/python.hpp>
//namespace boost{ namespace python{
// template <class T>
// struct pointee< std::shared_ptr<T> >
// {
// typedef T type;
// };
//
//}}
|
Use new API and expose optional host argument | /* The contents of this file is in the public domain. */
#include <ipify.h>
#include <string.h>
#include <sys/socket.h>
int main(int argc, char *argv[])
{
int family = AF_UNSPEC;
char addr[256];
int i, sd;
for (i = 1; i < argc; i++) {
if (!strcmp(argv[i], "-h")) {
printf("ipify [-46h]\n");
return 0;
}
if (!strcmp(argv[i], "-4")) {
family = AF_INET;
continue;
}
if (!strcmp(argv[i], "-6")) {
family = AF_INET6;
continue;
}
printf("Invalid option: '%s'\n", argv[i]);
return 1;
}
sd = ipify_connect1(family);
if (sd < 0)
return 1;
if (!ipify_query(sd, addr, sizeof(addr)))
printf("%s\n", addr);
return ipify_disconnect(sd);
}
| /* The contents of this file is in the public domain. */
#include <ipify.h>
#include <string.h>
#include <sys/socket.h>
int main(int argc, char *argv[])
{
int family = AF_UNSPEC;
char addr[256];
char *host;
int i, sd;
for (i = 1; i < argc; i++) {
if (!strcmp(argv[i], "-h")) {
printf("ipify [-46h] [HOST]\n");
return 0;
}
if (!strcmp(argv[i], "-4")) {
family = AF_INET;
continue;
}
if (!strcmp(argv[i], "-6")) {
family = AF_INET6;
continue;
}
break;
}
if (i < argc)
host = argv[i++];
else
host = "api.ipify.org";
sd = ipify_connect2(host, family);
if (sd < 0)
return 1;
if (!ipify_query(sd, addr, sizeof(addr)))
printf("%s\n", addr);
return ipify_disconnect(sd);
}
|
Remove a Windows line-ending that was accidentally included | #if defined(_WIN32)
# define __LITTLE_ENDIAN__ 1
# ifdef _M_IX86
# define __i386__ 1
# endif
# ifdef _M_X64
# define __x86_64__ 1
# endif
# if defined(_MSC_VER)
# define snprintf _snprintf
# define strtoull _strtoui64
# define __func__ __FUNCTION__
# endif /* defined(_MSC_VER) */
#endif /* defined(_WIN32) */
#if HAVE_DECLSPEC_DLLEXPORT
# ifdef LIBCPU_BUILD_CORE
# define API_FUNC __declspec(dllexport)
# else
# define API_FUNC __declspec(dllimport)
# endif
#else
# define API_FUNC /* nothing */
#endif
#if HAVE_ATTRIBUTE_PACKED
# define PACKED(x) x __attribute__((packed))
#elif HAVE_PRAGMA_PACK
# define PACKED(x) __pragma(pack(push, 1)) x __pragma(pack(pop))
#else
# error Do not know how to pack structs on this platform
#endif
#if HAVE_ATTRIBUTE_ALIGNED
# define ALIGNED(x) __attribute__((aligned(x)))
#elif HAVE_DECLSPEC_ALIGN
# define ALIGNED(x) __declspec(align(x))
#else
# error Do not know how to specify alignment on this platform
#endif
| #if defined(_WIN32)
# define __LITTLE_ENDIAN__ 1
# ifdef _M_IX86
# define __i386__ 1
# endif
# ifdef _M_X64
# define __x86_64__ 1
# endif
# if defined(_MSC_VER)
# define snprintf _snprintf
# define strtoull _strtoui64
# define __func__ __FUNCTION__
# endif /* defined(_MSC_VER) */
#endif /* defined(_WIN32) */
#if HAVE_DECLSPEC_DLLEXPORT
# ifdef LIBCPU_BUILD_CORE
# define API_FUNC __declspec(dllexport)
# else
# define API_FUNC __declspec(dllimport)
# endif
#else
# define API_FUNC /* nothing */
#endif
#if HAVE_ATTRIBUTE_PACKED
# define PACKED(x) x __attribute__((packed))
#elif HAVE_PRAGMA_PACK
# define PACKED(x) __pragma(pack(push, 1)) x __pragma(pack(pop))
#else
# error Do not know how to pack structs on this platform
#endif
#if HAVE_ATTRIBUTE_ALIGNED
# define ALIGNED(x) __attribute__((aligned(x)))
#elif HAVE_DECLSPEC_ALIGN
# define ALIGNED(x) __declspec(align(x))
#else
# error Do not know how to specify alignment on this platform
#endif
|
Destroy main window on Ctrl+q | #include <gtk/gtk.h>
GtkWidget *
main_window_create()
{
GtkWidget *window;
window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
gtk_window_set_title(GTK_WINDOW(window), "ghighlighter");
g_signal_connect(window, "destroy", G_CALLBACK(gtk_main_quit), NULL);
return window;
}
| #include <gtk/gtk.h>
#include <gdk/gdkkeysyms.h>
#include <glib.h>
static void
main_window_destroy(GtkAccelGroup *group, GObject *acceleratable,
guint keyval, GdkModifierType modifier, gpointer user_data)
{
gtk_widget_destroy(GTK_WIDGET(user_data));
}
void
main_window_bind_keys(GtkWidget *window)
{
GtkAccelGroup *group = gtk_accel_group_new();
GClosure *closure = g_cclosure_new(G_CALLBACK(main_window_destroy), window, NULL);
gtk_accel_group_connect(group, GDK_KEY_q, GDK_CONTROL_MASK, 0, closure);
gtk_window_add_accel_group(GTK_WINDOW(window), group);
}
GtkWidget *
main_window_create()
{
GtkWidget *window;
window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
gtk_window_set_title(GTK_WINDOW(window), "ghighlighter");
main_window_bind_keys(window);
g_signal_connect(window, "destroy", G_CALLBACK(gtk_main_quit), NULL);
return window;
}
|
Add _s custom literal for durations | //Copyright (c) 2018 Ultimaker B.V.
//CuraEngine is released under the terms of the AGPLv3 or higher.
#ifndef DURATION_H
#define DURATION_H
namespace cura
{
/*
* \brief Represents a duration in seconds.
*
* This is a facade. It behaves like a double, only it can't be negative.
*/
struct Duration
{
/*
* \brief Default constructor setting the duration to 0.
*/
Duration() : value(0) {};
/*
* \brief Casts a double to a Duration instance.
*/
Duration(double value) : value(std::max(value, 0.0)) {};
/*
* \brief Casts the Duration instance to a double.
*/
operator double() const
{
return value;
};
/*
* Some operators to do arithmetic with Durations.
*/
Duration operator +(const Duration& other) const
{
return Duration(value + other.value);
};
Duration operator -(const Duration& other) const
{
return Duration(value + other.value);
};
Duration& operator +=(const Duration& other)
{
value += other.value;
return *this;
}
Duration& operator -=(const Duration& other)
{
value -= other.value;
return *this;
}
/*
* \brief The actual duration, as a double.
*/
double value = 0;
};
}
#endif //DURATION_H | //Copyright (c) 2018 Ultimaker B.V.
//CuraEngine is released under the terms of the AGPLv3 or higher.
#ifndef DURATION_H
#define DURATION_H
namespace cura
{
/*
* \brief Represents a duration in seconds.
*
* This is a facade. It behaves like a double, only it can't be negative.
*/
struct Duration
{
/*
* \brief Default constructor setting the duration to 0.
*/
constexpr Duration() : value(0) {};
/*
* \brief Casts a double to a Duration instance.
*/
constexpr Duration(double value) : value(value > 0.0 ? value : 0.0) {};
/*
* \brief Casts the Duration instance to a double.
*/
operator double() const
{
return value;
};
/*
* Some operators to do arithmetic with Durations.
*/
Duration operator +(const Duration& other) const
{
return Duration(value + other.value);
};
Duration operator -(const Duration& other) const
{
return Duration(value + other.value);
};
Duration& operator +=(const Duration& other)
{
value += other.value;
return *this;
}
Duration& operator -=(const Duration& other)
{
value -= other.value;
return *this;
}
/*
* \brief The actual duration, as a double.
*/
double value = 0;
};
constexpr Duration operator "" _s(const long double seconds)
{
return Duration(seconds);
}
}
#endif //DURATION_H |
Create next fit algorithm in c | #include <stdio.h>
#include <stdlib.h>
void next_fit(int blockSize[],int processSize[],int n,int m){
int allocation[m];
int i=0,j=0;
for (i=0;i<m;i++)
allocation[i]=-1;
for (i=0;i<m;i++) {
while (j<n) {
if (blockSize[j]>=processSize[i])
{
allocation[i]=j;
blockSize[j]-=processSize[i];
break;
}
j=(j+1)%n;
}
}
printf("\nProcess No.\tProcess Size\tBlock no.\n");
for (i=0;i<m;i++) {
printf("%d\t\t",i+1);
printf("%d\t\t",processSize[i]);
if (allocation[i]!=-1)
printf("%d",allocation[i]+1);
else
printf("Not Allocated\n");
printf("\n");
}
}
int main(){
int blockSize[]={10,20,300,40,500,60,100};
int i,n,m;
n=7;
printf("Give number of processes:");
scanf("%d",&m);
int processSize[m];
for (i=0;i<m;i++){
printf("Give process size for process number %d:",i+1);
scanf("%d",&processSize[i]);
}
next_fit(blockSize,processSize,n,m);
return 0;
}
| |
Add test cases for AArch64 hints codegen | // RUN: %clang_cc1 -triple arm64-apple-ios -O3 -emit-llvm -o - %s | FileCheck %s
void f0(void *a, void *b) {
__clear_cache(a,b);
// CHECK: call {{.*}} @__clear_cache
}
// CHECK: call {{.*}} @llvm.aarch64.rbit.i32(i32 %a)
unsigned rbit(unsigned a) {
return __builtin_arm_rbit(a);
}
// CHECK: call {{.*}} @llvm.aarch64.rbit.i64(i64 %a)
unsigned long long rbit64(unsigned long long a) {
return __builtin_arm_rbit64(a);
}
| // RUN: %clang_cc1 -triple arm64-apple-ios -O3 -emit-llvm -o - %s | FileCheck %s
void f0(void *a, void *b) {
__clear_cache(a,b);
// CHECK: call {{.*}} @__clear_cache
}
// CHECK: call {{.*}} @llvm.aarch64.rbit.i32(i32 %a)
unsigned rbit(unsigned a) {
return __builtin_arm_rbit(a);
}
// CHECK: call {{.*}} @llvm.aarch64.rbit.i64(i64 %a)
unsigned long long rbit64(unsigned long long a) {
return __builtin_arm_rbit64(a);
}
void hints() {
__builtin_arm_yield(); //CHECK: call {{.*}} @llvm.aarch64.hint(i32 1)
__builtin_arm_wfe(); //CHECK: call {{.*}} @llvm.aarch64.hint(i32 2)
__builtin_arm_wfi(); //CHECK: call {{.*}} @llvm.aarch64.hint(i32 3)
__builtin_arm_sev(); //CHECK: call {{.*}} @llvm.aarch64.hint(i32 4)
__builtin_arm_sevl(); //CHECK: call {{.*}} @llvm.aarch64.hint(i32 5)
}
|
Fix header out of sync | #import <Foundation/Foundation.h>
extern NSString *kCTCFeedCheckerErrorDomain;
typedef void (^CTCFeedCheckCompletionHandler)(NSArray *downloadedFeedFiles,
NSError *error);
typedef void (^CTCFeedCheckDownloadCompletionHandler)(NSError *error);
@protocol CTCFeedCheck
- (void)checkShowRSSFeed:(NSURL *)feedURL
downloadingToBookmark:(NSData *)downloadFolderBookmark
organizingByFolder:(BOOL)shouldOrganizeByFolder
skippingURLs:(NSArray *)previouslyDownloadedURLs
withReply:(CTCFeedCheckCompletionHandler)reply;
- (void)downloadFile:(NSDictionary *)fileURL
toBookmark:(NSData *)downloadFolderBookmark
organizingByFolder:(BOOL)shouldOrganizeByFolder
withReply:(CTCFeedCheckDownloadCompletionHandler)reply;
@end
@interface CTCFeedChecker : NSObject <CTCFeedCheck, NSXPCListenerDelegate>
+ (instancetype)sharedChecker;
@end
| #import <Foundation/Foundation.h>
extern NSString *kCTCFeedCheckerErrorDomain;
typedef void (^CTCFeedCheckCompletionHandler)(NSArray *downloadedFeedFiles,
NSError *error);
typedef void (^CTCFeedCheckDownloadCompletionHandler)(NSError *error);
@protocol CTCFeedCheck
- (void)checkShowRSSFeed:(NSURL *)feedURL
downloadingToBookmark:(NSData *)downloadFolderBookmark
organizingByFolder:(BOOL)shouldOrganizeByFolder
skippingURLs:(NSArray *)previouslyDownloadedURLs
withReply:(CTCFeedCheckCompletionHandler)reply;
- (void)downloadFile:(NSDictionary *)file
toBookmark:(NSData *)downloadFolderBookmark
organizingByFolder:(BOOL)shouldOrganizeByFolder
withReply:(CTCFeedCheckDownloadCompletionHandler)reply;
@end
@interface CTCFeedChecker : NSObject <CTCFeedCheck, NSXPCListenerDelegate>
+ (instancetype)sharedChecker;
@end
|
Add test for multi-line commenting | // RUN: %ucc -fsyntax-only %s
int main()
{
/* comment with stray handling *\
/
/* this is a valid *\/ comment */
/* this is a valid comment *\*/
// this is a valid\
comment
return 0;
}
| |
Add missing header method declarations. | //--------------------------------------------------------------------*- C++ -*-
// CLING - the C++ LLVM-based InterpreterG :)
// version: $Id$
// author: Vassil Vassilev <vasil.georgiev.vasilev@cern.ch>
//------------------------------------------------------------------------------
#ifndef CLING_RUNTIME_EXCEPTIONS_H
#define CLING_RUNTIME_EXCEPTIONS_H
namespace cling {
namespace runtime {
///\brief Exception that is thrown when a null pointer dereference is found
/// or a method taking non-null arguments is called with NULL argument.
///
class cling_null_deref_exception { };
} // end namespace runtime
} // end namespace cling
#endif // CLING_RUNTIME_EXCEPTIONS_H
| //--------------------------------------------------------------------*- C++ -*-
// CLING - the C++ LLVM-based InterpreterG :)
// version: $Id$
// author: Vassil Vassilev <vasil.georgiev.vasilev@cern.ch>
//------------------------------------------------------------------------------
#ifndef CLING_RUNTIME_EXCEPTIONS_H
#define CLING_RUNTIME_EXCEPTIONS_H
namespace clang {
class Sema;
}
namespace cling {
namespace runtime {
///\brief Exception that is thrown when a null pointer dereference is found
/// or a method taking non-null arguments is called with NULL argument.
///
class cling_null_deref_exception {
private:
unsigned m_Location;
clang::Sema* m_Sema;
public:
cling_null_deref_exception(void* Loc, clang::Sema* S);
~cling_null_deref_exception();
void what() throw();
};
} // end namespace runtime
} // end namespace cling
#endif // CLING_RUNTIME_EXCEPTIONS_H
|
Make more usable for production | //
// FDTakeController.h
// FDTakeExample
//
// Created by Will Entriken on 8/9/12.
// Copyright (c) 2012 William Entriken. All rights reserved.
//
#import <Foundation/Foundation.h>
@class FDTakeController;
@protocol FDTakeDelegate <NSObject>
- (void)takeController:(FDTakeController *)controller gotPhoto:(UIImage *)photo withInfo:(NSDictionary *)info;
- (void)takeController:(FDTakeController *)controller gotVideo:(NSURL *)video withInfo:(NSDictionary *)info;
- (void)takeController:(FDTakeController *)controller didCancelAfterAttempting:(BOOL)madeAttempt;
@end
@interface FDTakeController : NSObject
- (void)takePhotoOrChooseFromLibrary;
- (void)takeVideoOrChooseFromLibrary;
- (void)takePhotoOrVideoOrChooseFromLibrary;
@property (strong, nonatomic) UIImagePickerController *imagePicker;
@property (weak, nonatomic) id <FDTakeDelegate> delegate;
@end
| //
// FDTakeController.h
// FDTakeExample
//
// Created by Will Entriken on 8/9/12.
// Copyright (c) 2012 William Entriken. All rights reserved.
//
#import <Foundation/Foundation.h>
@class FDTakeController;
@protocol FDTakeDelegate <NSObject>
@optional
- (void)takeController:(FDTakeController *)controller didCancelAfterAttempting:(BOOL)madeAttempt;
- (void)takeController:(FDTakeController *)controller gotPhoto:(UIImage *)photo withInfo:(NSDictionary *)info;
- (void)takeController:(FDTakeController *)controller gotVideo:(NSURL *)video withInfo:(NSDictionary *)info;
@end
@interface FDTakeController : NSObject
+ (UIImage*)imageWithImage:(UIImage*)sourceImage scaledToSizeWithSameAspectRatio:(CGSize)targetSize;
- (void)takePhotoOrChooseFromLibrary;
- (void)takeVideoOrChooseFromLibrary;
- (void)takePhotoOrVideoOrChooseFromLibrary;
@property (strong, nonatomic) UIImagePickerController *imagePicker;
@property (weak, nonatomic) id <FDTakeDelegate> delegate;
@end
|
Add tree demo to input - needed for subobjects | #include <memory>
#include <random>
static std::mt19937 mt;
static std::uniform_int_distribution<int> d(1,10);
static auto gen = []{return d(mt);};
class Tree
{
int data_;
std::shared_ptr<Tree> left_;
std::shared_ptr<Tree> right_;
public:
Tree(int levels=0)
{
data_ = gen();
if ( levels <= 0 ) return;
left_ = std::make_shared<Tree>(levels-1);
right_ = std::make_shared<Tree>(levels-1);
}
const Tree* left_subtree() const
{
return left_.get();
}
const Tree* right_subtree() const
{
return right_.get();
}
int data() const
{
return data_;
}
};
| |
Update Skia milestone to 65 | /*
* Copyright 2016 Google Inc.
*
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
#ifndef SK_MILESTONE
#define SK_MILESTONE 64
#endif
| /*
* Copyright 2016 Google Inc.
*
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
#ifndef SK_MILESTONE
#define SK_MILESTONE 65
#endif
|
Make sure primitive type enum starts at 0 | #pragma once
//------------------------------------------------------------------------------
/**
@class Oryol::Render::PrimitiveType
@brief primitive type enum (triangle strips, lists, etc...)
*/
#include "Core/Types.h"
namespace Oryol {
namespace Render {
class PrimitiveType {
public:
/// primitive type enum
enum Code {
Points, ///< point list
LineStrip, ///< line strip
LineLoop, ///< closed line loop
Lines, ///< line list
TriangleStrip, ///< triangle strip
TriangleFan, ///< triangle fan
Triangles, ///< triangle list
NumPrimitiveTypes, ///< number of primitive types
InvalidPrimitiveType, ///< invalid primitive type value
};
/// convert to string
static const char* ToString(Code c);
/// convert from string
static Code FromString(const char* str);
};
} // namespace Render
} // namespace Oryol | #pragma once
//------------------------------------------------------------------------------
/**
@class Oryol::Render::PrimitiveType
@brief primitive type enum (triangle strips, lists, etc...)
*/
#include "Core/Types.h"
namespace Oryol {
namespace Render {
class PrimitiveType {
public:
/// primitive type enum (don't change order, append to end!)
enum Code {
Points = 0, ///< point list
LineStrip, ///< line strip
LineLoop, ///< closed line loop
Lines, ///< line list
TriangleStrip, ///< triangle strip
TriangleFan, ///< triangle fan
Triangles, ///< triangle list
NumPrimitiveTypes, ///< number of primitive types
InvalidPrimitiveType, ///< invalid primitive type value
};
/// convert to string
static const char* ToString(Code c);
/// convert from string
static Code FromString(const char* str);
};
} // namespace Render
} // namespace Oryol |
Make sure gen loc is in range. | #include "../H/ugens.h"
#include <stdio.h>
/* these 3 defined in makegen.c */
extern float *farrays[];
extern int sizeof_farray[];
extern int f_goto[];
/* Returns the address of function number genno, or NULL if the
function array doesn't exist.
NOTE: It's the responsiblity of instruments to deal with a
missing gen, either by using die() or supplying a default
and alerting the user with advise().
*/
float *floc(int genno)
{
int index = f_goto[genno];
if (sizeof_farray[index] == 0)
return NULL;
return farrays[index];
}
| #include <stdio.h>
#include <ugens.h>
/* these 3 defined in makegen.c */
extern float *farrays[];
extern int sizeof_farray[];
extern int f_goto[];
/* Returns the address of function number genno, or NULL if the
function array doesn't exist.
NOTE: It's the responsiblity of instruments to deal with a
missing gen, either by using die() or supplying a default
and alerting the user with advise().
*/
float *floc(int genno)
{
int index;
if (genno < 0)
return NULL;
index = f_goto[genno];
if (sizeof_farray[index] == 0)
return NULL;
return farrays[index];
}
|
Make a proper case to U32 to avoid a warning | /* Copyright 2002-2004 The Apache Software Foundation
*
* 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.
*/
static MP_INLINE U32 mpxs_APR__OS_current_thread_id(pTHX)
{
#if APR_HAS_THREADS
return apr_os_thread_current();
#else
return 0;
#endif
}
| /* Copyright 2002-2004 The Apache Software Foundation
*
* 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.
*/
static MP_INLINE U32 mpxs_APR__OS_current_thread_id(pTHX)
{
#if APR_HAS_THREADS
return (U32)apr_os_thread_current();
#else
return 0;
#endif
}
|
Add sections for PIL (Fred Lundh). | /* appinit.c -- Tcl and Tk application initialization. */
#include <tcl.h>
#include <tk.h>
int
Tcl_AppInit (interp)
Tcl_Interp *interp;
{
Tk_Window main;
main = Tk_MainWindow(interp);
if (Tcl_Init (interp) == TCL_ERROR)
return TCL_ERROR;
if (Tk_Init (interp) == TCL_ERROR)
return TCL_ERROR;
#ifdef WITH_MOREBUTTONS
{
extern Tcl_CmdProc studButtonCmd;
extern Tcl_CmdProc triButtonCmd;
Tcl_CreateCommand(interp, "studbutton", studButtonCmd,
(ClientData) main, NULL);
Tcl_CreateCommand(interp, "tributton", triButtonCmd,
(ClientData) main, NULL);
}
#endif
#ifdef WITH_XXX
#endif
return TCL_OK;
}
| /* appinit.c -- Tcl and Tk application initialization. */
#include <tcl.h>
#include <tk.h>
int
Tcl_AppInit (interp)
Tcl_Interp *interp;
{
Tk_Window main;
main = Tk_MainWindow(interp);
if (Tcl_Init (interp) == TCL_ERROR)
return TCL_ERROR;
if (Tk_Init (interp) == TCL_ERROR)
return TCL_ERROR;
#ifdef WITH_MOREBUTTONS
{
extern Tcl_CmdProc studButtonCmd;
extern Tcl_CmdProc triButtonCmd;
Tcl_CreateCommand(interp, "studbutton", studButtonCmd,
(ClientData) main, NULL);
Tcl_CreateCommand(interp, "tributton", triButtonCmd,
(ClientData) main, NULL);
}
#endif
#ifdef WITH_PIL /* 0.2b5 and later -- not yet released as of May 14 */
{
extern void TkImaging_Init(Tcl_Interp *interp);
TkImaging_Init(interp);
}
#endif
#ifdef WITH_PIL_OLD /* 0.2b4 and earlier */
{
extern void TkImaging_Init(void);
TkImaging_Init();
}
#endif
#ifdef WITH_XXX
#endif
return TCL_OK;
}
|
Set initialized=1 when everything has actually been initialized |
#include <stdbool.h>
#include "core.h"
#include "crypto_onetimeauth.h"
static bool initialized;
int
sodium_init(void)
{
if (initialized != 0) {
return 1;
}
initialized = 1;
if (crypto_onetimeauth_pick_best_implementation() == NULL) {
return -1;
}
return 0;
}
|
#include <stdbool.h>
#include "core.h"
#include "crypto_onetimeauth.h"
static bool initialized;
int
sodium_init(void)
{
if (initialized != 0) {
return 1;
}
if (crypto_onetimeauth_pick_best_implementation() == NULL) {
return -1;
}
initialized = 1;
return 0;
}
|
Add a sphere light stub. | /*
* An area light with a sphere geometry.
*
* TODO(dinow): Extract a middle class called GeometryLight which contains the
* intersect code and the geometry pointer.
* Author: Dino Wernli
*/
#ifndef SPHERE_LIGHT_H_
#define SPHERE_LIGHT_H_
#include "scene/geometry/sphere.h"
#include "util/random.h"
class SphereLight : public Light {
public:
SphereLight(const Point3& center, Scalar radius, const Color3& color)
: Light(color), sphere_(new Sphere(center, radius)) {
}
virtual ~SphereLight() {};
virtual Ray GenerateRay(const Point3& target) const {
// TODO(dinow): Generate a ray from a random point on the proper half of the
// sphere to target.
return Ray;
}
// No ray ever intersects a dimensionless point light.
virtual bool Intersect(const Ray& ray, IntersectionData* data) const {
bool result = sphere_->Intersect(ray, data);
if (result) {
// Make sure the data object knows it intersected a light.
data->set_light(this);
}
return result;
}
private:
std::unique_ptr<Sphere> sphere_;
Random random_;
};
#endif /* SPHERE_LIGHT_H_ */
| |
Add AC_XSTR and AC_STR macros. | /*
* Copyright 2016 Wink Saville
*
* 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 ARCH_GENERIC_INCS_AC_XSTR_H
#define ARCH_GENERIC_INCS_AC_XSTR_H
// Stringification of macro parameters
// [See](https://gcc.gnu.org/onlinedocs/cpp/Stringification.html)
#define AC_XSTR(s) AC_STR(s)
#define AC_STR(s) #s
#endif
| |
Remove declaration of non-existent method | // Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CHROME_NACL_NACL_BROKER_LISTENER_H_
#define CHROME_NACL_NACL_BROKER_LISTENER_H_
#pragma once
#include "base/memory/scoped_ptr.h"
#include "base/process.h"
#include "chrome/common/nacl_types.h"
#include "ipc/ipc_channel.h"
// The BrokerThread class represents the thread that handles the messages from
// the browser process and starts NaCl loader processes.
class NaClBrokerListener : public IPC::Channel::Listener {
public:
NaClBrokerListener();
~NaClBrokerListener();
void Listen();
// IPC::Channel::Listener implementation.
virtual void OnChannelConnected(int32 peer_pid) OVERRIDE;
virtual bool OnMessageReceived(const IPC::Message& msg) OVERRIDE;
virtual void OnChannelError() OVERRIDE;
private:
void OnLaunchLoaderThroughBroker(const std::wstring& loader_channel_id);
void OnShareBrowserHandle(int browser_handle);
void OnStopBroker();
base::ProcessHandle browser_handle_;
scoped_ptr<IPC::Channel> channel_;
DISALLOW_COPY_AND_ASSIGN(NaClBrokerListener);
};
#endif // CHROME_NACL_NACL_BROKER_LISTENER_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_NACL_NACL_BROKER_LISTENER_H_
#define CHROME_NACL_NACL_BROKER_LISTENER_H_
#pragma once
#include "base/memory/scoped_ptr.h"
#include "base/process.h"
#include "chrome/common/nacl_types.h"
#include "ipc/ipc_channel.h"
// The BrokerThread class represents the thread that handles the messages from
// the browser process and starts NaCl loader processes.
class NaClBrokerListener : public IPC::Channel::Listener {
public:
NaClBrokerListener();
~NaClBrokerListener();
void Listen();
// IPC::Channel::Listener implementation.
virtual void OnChannelConnected(int32 peer_pid) OVERRIDE;
virtual bool OnMessageReceived(const IPC::Message& msg) OVERRIDE;
virtual void OnChannelError() OVERRIDE;
private:
void OnLaunchLoaderThroughBroker(const std::wstring& loader_channel_id);
void OnStopBroker();
base::ProcessHandle browser_handle_;
scoped_ptr<IPC::Channel> channel_;
DISALLOW_COPY_AND_ASSIGN(NaClBrokerListener);
};
#endif // CHROME_NACL_NACL_BROKER_LISTENER_H_
|
Fix dirty scheduler tc on windows | #include <unistd.h>
#include "erl_nif.h"
static int
load(ErlNifEnv* env, void** priv, ERL_NIF_TERM info)
{
ErlNifSysInfo sys_info;
enif_system_info(&sys_info, sizeof(ErlNifSysInfo));
if (!sys_info.smp_support || !sys_info.dirty_scheduler_support)
return 1;
return 0;
}
static ERL_NIF_TERM
dirty_sleeper(ErlNifEnv* env, int argc, const ERL_NIF_TERM argv[])
{
#ifdef ERL_NIF_DIRTY_SCHEDULER_SUPPORT
sleep(3);
#endif
return enif_make_atom(env, "ok");
}
static ErlNifFunc funcs[] = {
#ifdef ERL_NIF_DIRTY_SCHEDULER_SUPPORT
{"dirty_sleeper", 0, dirty_sleeper, ERL_NIF_DIRTY_JOB_IO_BOUND}
#else
{"dirty_sleeper", 0, dirty_sleeper, 0}
#endif
};
ERL_NIF_INIT(scheduler_SUITE, funcs, &load, NULL, NULL, NULL);
| #ifndef __WIN32__
#include <unistd.h>
#endif
#include "erl_nif.h"
static int
load(ErlNifEnv* env, void** priv, ERL_NIF_TERM info)
{
ErlNifSysInfo sys_info;
enif_system_info(&sys_info, sizeof(ErlNifSysInfo));
if (!sys_info.smp_support || !sys_info.dirty_scheduler_support)
return 1;
return 0;
}
static ERL_NIF_TERM
dirty_sleeper(ErlNifEnv* env, int argc, const ERL_NIF_TERM argv[])
{
#ifdef ERL_NIF_DIRTY_SCHEDULER_SUPPORT
#ifdef __WIN32__
Sleep(3000);
#else
sleep(3);
#endif
#endif
return enif_make_atom(env, "ok");
}
static ErlNifFunc funcs[] = {
#ifdef ERL_NIF_DIRTY_SCHEDULER_SUPPORT
{"dirty_sleeper", 0, dirty_sleeper, ERL_NIF_DIRTY_JOB_IO_BOUND}
#else
{"dirty_sleeper", 0, dirty_sleeper, 0}
#endif
};
ERL_NIF_INIT(scheduler_SUITE, funcs, &load, NULL, NULL, NULL);
|
Fix unnderlying issue with Stream class being private | /*
* MbedHardware
*
* Created on: Aug 17, 2011
* Author: nucho
*/
#ifndef ROS_MBED_HARDWARE_H_
#define ROS_MBED_HARDWARE_H_
#include "mbed.h"
#include "MODSERIAL.h"
#define ROSSERIAL_BAUDRATE 57600
class MbedHardware {
public:
MbedHardware(MODSERIAL* io , long baud= ROSSERIAL_BAUDRATE)
:iostream(*io){
baud_ = baud;
t.start();
}
MbedHardware()
:iostream(USBTX, USBRX) {
baud_ = ROSSERIAL_BAUDRATE;
t.start();
}
MbedHardware(MbedHardware& h)
:iostream(h.iostream) {
this->baud_ = h.baud_;
t.start();
}
void setBaud(long baud){
this->baud_= baud;
}
int getBaud(){return baud_;}
void init(){
iostream.baud(baud_);
}
int read(){
if (iostream.readable()) {
return iostream.getc();
} else {
return -1;
}
};
void write(uint8_t* data, int length) {
for (int i=0; i<length; i++)
iostream.putc(data[i]);
}
unsigned long time(){return t.read_ms();}
protected:
MODSERIAL iostream;
long baud_;
Timer t;
};
#endif /* ROS_MBED_HARDWARE_H_ */
| /*
* MbedHardware
*
* Created on: Aug 17, 2011
* Author: nucho
*/
#ifndef ROS_MBED_HARDWARE_H_
#define ROS_MBED_HARDWARE_H_
#include "mbed.h"
#include "MODSERIAL.h"
class MbedHardware {
public:
MbedHardware(PinName tx, PinName rx, long baud = 57600)
:iostream(tx, rx){
baud_ = baud;
t.start();
}
MbedHardware()
:iostream(USBTX, USBRX) {
baud_ = 57600;
t.start();
}
void setBaud(long baud){
this->baud_= baud;
}
int getBaud(){return baud_;}
void init(){
iostream.baud(baud_);
}
int read(){
if (iostream.readable()) {
return iostream.getc();
} else {
return -1;
}
};
void write(uint8_t* data, int length) {
for (int i=0; i<length; i++)
iostream.putc(data[i]);
}
unsigned long time(){return t.read_ms();}
protected:
MODSERIAL iostream;
long baud_;
Timer t;
};
#endif /* ROS_MBED_HARDWARE_H_ */
|
Add method to save a single component float image. | #ifndef SRC_UTILS_IMAGE_PERSISTER_H_
#define SRC_UTILS_IMAGE_PERSISTER_H_
#include <string>
#include <vector>
#include <Magick++.h>
#include <Eigen/Core>
/**
* \brief Provides static functions to load and save images
*
*/
class ImagePersister
{
public:
template <class T>
static void saveRGBA32F(T *data, int width, int height, std::string filename)
{
Magick::InitializeMagick("");
Magick::Image image(width, height, "RGBA", Magick::StorageType::FloatPixel,
data);
image.write(filename);
}
static std::vector<Eigen::Vector4f> loadRGBA32F(std::string filename)
{
Magick::Image image(filename);
std::vector<Eigen::Vector4f> result(image.columns() * image.rows());
image.write(0, 0, image.columns(), image.rows(), "RGBA",
Magick::StorageType::FloatPixel, result.data());
return result;
}
};
#endif // SRC_UTILS_IMAGE_PERSISTER_H_
| #ifndef SRC_UTILS_IMAGE_PERSISTER_H_
#define SRC_UTILS_IMAGE_PERSISTER_H_
#include <string>
#include <vector>
#include <Magick++.h>
#include <Eigen/Core>
/**
* \brief Provides static functions to load and save images
*
*/
class ImagePersister
{
public:
template <class T>
static void saveRGBA32F(T *data, int width, int height, std::string filename)
{
Magick::InitializeMagick("");
Magick::Image image(width, height, "RGBA", Magick::StorageType::FloatPixel,
data);
image.write(filename);
}
static void saveR32F(float *data, int width, int height, std::string filename)
{
Magick::InitializeMagick("");
Magick::Image image(width, height, "R", Magick::StorageType::FloatPixel,
data);
image.write(filename);
}
static std::vector<Eigen::Vector4f> loadRGBA32F(std::string filename)
{
Magick::Image image(filename);
std::vector<Eigen::Vector4f> result(image.columns() * image.rows());
image.write(0, 0, image.columns(), image.rows(), "RGBA",
Magick::StorageType::FloatPixel, result.data());
return result;
}
};
#endif // SRC_UTILS_IMAGE_PERSISTER_H_
|
Add an utility function (CastJSObject) | /** @file Utils.h
@author Philip Abbet
Declaration of some utilities related to scripting
*/
#ifndef _ATHENA_SCRIPTING_UTILS_H_
#define _ATHENA_SCRIPTING_UTILS_H_
#include <Athena-Scripting/Prerequisites.h>
#include <v8.h>
namespace Athena {
namespace Scripting {
//------------------------------------------------------------------------------------
/// @brief Convert an JavaScript Object to a C++ one
//------------------------------------------------------------------------------------
template<typename T>
T* CastJSObject(v8::Handle<v8::Value> const &h)
{
if (!h->IsObject())
return 0;
v8::Local<v8::Object> obj = h->ToObject();
if (obj->InternalFieldCount() != 1)
return 0;
v8::Local<v8::External> external = v8::Local<v8::External>::Cast(obj->GetInternalField(0));
return static_cast<T*>(external->Value());
}
}
}
#endif
| |
Update driver version to 5.03.00-k11 | /*
* QLogic iSCSI HBA Driver
* Copyright (c) 2003-2012 QLogic Corporation
*
* See LICENSE.qla4xxx for copyright and licensing details.
*/
#define QLA4XXX_DRIVER_VERSION "5.03.00-k10"
| /*
* QLogic iSCSI HBA Driver
* Copyright (c) 2003-2012 QLogic Corporation
*
* See LICENSE.qla4xxx for copyright and licensing details.
*/
#define QLA4XXX_DRIVER_VERSION "5.03.00-k11"
|
Add blinking led example for TI Kit | #include <inc/hw_types.h>
#include <driverlib/sysctl.h>
#include <stdio.h>
#include <string.h>
#include <inc/hw_memmap.h>
#include <inc/hw_sysctl.h>
#include <driverlib/gpio.h>
#include <driverlib/debug.h>
int UP=0;
int i;
int main(){
SysCtlClockSet(SYSCTL_SYSDIV_4 | SYSCTL_USE_PLL | SYSCTL_OSC_MAIN | SYSCTL_XTAL_8MHZ);
SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOE);
GPIOPinTypeGPIOInput(GPIO_PORTE_BASE,GPIO_PIN_0 | GPIO_PIN_1 | GPIO_PIN_2 | GPIO_PIN_3);
GPIOPadConfigSet(GPIO_PORTE_BASE, GPIO_PIN_0 | GPIO_PIN_1 | GPIO_PIN_2 | GPIO_PIN_3, GPIO_STRENGTH_2MA, GPIO_PIN_TYPE_STD_WPU);
SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOF);
GPIOPinTypeGPIOOutput(GPIO_PORTF_BASE,GPIO_PIN_0);
GPIOPadConfigSet(GPIO_PORTF_BASE, GPIO_PIN_0 | GPIO_PIN_1 | GPIO_PIN_2 | GPIO_PIN_3, GPIO_STRENGTH_2MA, GPIO_PIN_TYPE_STD_WPU);
while(1){
UP = GPIOPinRead(GPIO_PORTE_BASE,(GPIO_PIN_0));
UP = UP&0x01;
if (UP== 0x01)
GPIOPinWrite(GPIO_PORTF_BASE, GPIO_PIN_0, 0x00);
else
GPIOPinWrite(GPIO_PORTF_BASE, GPIO_PIN_0, 0xFF);
}
}
| |
Create window closing script with halt command. | sharedMainLayoutScripts: closeWindowHaltScript
Close Window [ Current Window ]
Halt Script
February 9, 平成26 10:24:51 Imagination Quality Management.fp7 - closeWindowHaltScript -1- | |
Fix initial case for header documentation sentences | #import <Foundation/Foundation.h>
@interface NSString (TDTAdditions)
/**
@return a string representing a newly generated version 4 random UUID
*/
+ (instancetype)randomUUID;
/**
@return The SHA1 of the receiver
*/
- (NSString *)sha1Digest;
/**
@return a new string by trimming non alphanumeric characters from the receiver
*/
- (NSString *)stringByTrimmingNonAlphaNumericCharacters;
/**
@return `nil` if the receiver is blank, otherwise returns the receiver.
*/
- (NSString *)stringByNillingBlanks;
/**
There is no platform agnostic format specifier for an `NSUInteger`. Ergo this.
*/
+ (NSString *)stringWithUnsignedInteger:(NSUInteger)uInteger;
@end
| #import <Foundation/Foundation.h>
@interface NSString (TDTAdditions)
/**
@return A string representing a newly generated version 4 random UUID
*/
+ (instancetype)randomUUID;
/**
@return The SHA1 of the receiver
*/
- (NSString *)sha1Digest;
/**
@return A new string by trimming non alphanumeric characters from the receiver
*/
- (NSString *)stringByTrimmingNonAlphaNumericCharacters;
/**
@return `nil` if the receiver is blank, otherwise returns the receiver.
*/
- (NSString *)stringByNillingBlanks;
/**
There is no platform agnostic format specifier for an `NSUInteger`. Ergo this.
*/
+ (NSString *)stringWithUnsignedInteger:(NSUInteger)uInteger;
@end
|
Create define for asserting with a message | /* The Halfling Project - A Graphics Engine and Projects
*
* The Halfling Project is the legal property of Adrian Astley
* Copyright Adrian Astley 2013
*/
#ifndef COMMON_HALFLING_SYS_H
#define COMMON_HALFLING_SYS_H
#include "common/typedefs.h"
// Only include the base windows libraries
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#include <comip.h>
// GDI+
#include <gdiplus.h>
// Un-define min and max from the windows headers
#ifdef min
#undef min
#endif
#ifdef max
#undef max
#endif
#endif
| /* The Halfling Project - A Graphics Engine and Projects
*
* The Halfling Project is the legal property of Adrian Astley
* Copyright Adrian Astley 2013
*/
#ifndef COMMON_HALFLING_SYS_H
#define COMMON_HALFLING_SYS_H
#include "common/typedefs.h"
// Only include the base windows libraries
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#include <comip.h>
// GDI+
#include <gdiplus.h>
// Un-define min and max from the windows headers
#ifdef min
#undef min
#endif
#ifdef max
#undef max
#endif
#define AssertMsg(condition, message) \
do { \
if (!(condition)) { \
std::cerr << "Assertion `" #condition "` failed in " << __FILE__ \
<< " line " << __LINE__ << ": " << message << std::endl; \
std::exit(EXIT_FAILURE); \
} \
} while (false)
#endif
|
Fix comment at top of file to match file name. | /* File: connection.h
*
* Description: See "md.h"
*
* Comments: See "notice.txt" for copyright and license information.
*
*/
#ifndef __MD5_H__
#define __MD5_H__
#include "psqlodbc.h"
#include <stdlib.h>
#include <string.h>
#ifdef WIN32
#define MD5_ODBC
#define FRONTEND
#endif
#define MD5_PASSWD_LEN 35
/* From c.h */
#ifndef __BEOS__
#ifndef __cplusplus
#ifndef bool
typedef char bool;
#endif
#ifndef true
#define true ((bool) 1)
#endif
#ifndef false
#define false ((bool) 0)
#endif
#endif /* not C++ */
#endif /* __BEOS__ */
/* Also defined in include/c.h */
#if SIZEOF_UINT8 == 0
typedef unsigned char uint8; /* == 8 bits */
typedef unsigned short uint16; /* == 16 bits */
typedef unsigned int uint32; /* == 32 bits */
#endif /* SIZEOF_UINT8 == 0 */
extern bool md5_hash(const void *buff, size_t len, char *hexsum);
extern bool EncryptMD5(const char *passwd, const char *salt,
size_t salt_len, char *buf);
#endif
| /* File: md5.h
*
* Description: See "md5.c"
*
* Comments: See "notice.txt" for copyright and license information.
*
*/
#ifndef __MD5_H__
#define __MD5_H__
#include "psqlodbc.h"
#include <stdlib.h>
#include <string.h>
#ifdef WIN32
#define MD5_ODBC
#define FRONTEND
#endif
#define MD5_PASSWD_LEN 35
/* From c.h */
#ifndef __BEOS__
#ifndef __cplusplus
#ifndef bool
typedef char bool;
#endif
#ifndef true
#define true ((bool) 1)
#endif
#ifndef false
#define false ((bool) 0)
#endif
#endif /* not C++ */
#endif /* __BEOS__ */
/* Also defined in include/c.h */
#if SIZEOF_UINT8 == 0
typedef unsigned char uint8; /* == 8 bits */
typedef unsigned short uint16; /* == 16 bits */
typedef unsigned int uint32; /* == 32 bits */
#endif /* SIZEOF_UINT8 == 0 */
extern bool md5_hash(const void *buff, size_t len, char *hexsum);
extern bool EncryptMD5(const char *passwd, const char *salt,
size_t salt_len, char *buf);
#endif
|
Improve tests for boolean operators | int main() {
struct A {} a;
// error: '&&' operator requires scalar operands
a && a;
// error: '||' operator requires scalar operands
a || a;
// error: '!' operator requires scalar operand
!a;
}
| int main() {
struct A {} a;
// error: '&&' operator requires scalar operands
a && a;
// error: '||' operator requires scalar operands
1 || a;
// error: '||' operator requires scalar operands
a || 1;
// error: '!' operator requires scalar operand
!a;
}
|
Clean up sysconf() test to address a TODO that depended on a toolchain roll | /*
* Copyright (c) 2012 The Native Client Authors. All rights reserved.
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
#include <stdio.h>
#if defined(__GLIBC__)
#include <unistd.h>
#else
/*
* TODO(bsy): remove when newlib toolchain catches up
* http://code.google.com/p/nativeclient/issues/detail?id=2714
*/
#include "native_client/src/trusted/service_runtime/include/sys/unistd.h"
#endif
int main(void) {
#if defined(__GLIBC__)
long rv = sysconf(_SC_PAGESIZE);
#else
long rv = sysconf(NACL_ABI__SC_PAGESIZE);
#endif
printf("%ld\n", rv);
return rv != (1<<16);
}
| /*
* Copyright (c) 2012 The Native Client Authors. All rights reserved.
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
#include <stdio.h>
#include <unistd.h>
int main(void) {
long rv = sysconf(_SC_PAGESIZE);
printf("%ld\n", rv);
return rv != (1<<16);
}
|
Put ImageBuffer into separate header | #ifndef NME_NME_API_H
#define NME_NME_API_H
#include "Pixel.h"
namespace nme
{
enum { NME_API_VERSION = 100 };
class NmeApi
{
public:
virtual int getApiVersion() { return NME_API_VERSION; }
virtual bool getC0IsRed() { return gC0IsRed; }
};
extern NmeApi gNmeApi;
} // end namespace nme
#endif
| |
Duplicate definition of NAME_MAX macro | /*
* Copyright (c) 2007, 2008, 2009, ETH Zurich.
* All rights reserved.
*
* This file is distributed under the terms in the attached LICENSE file.
* If you do not find this file, copies can be found by writing to:
* ETH Zurich D-INFK, Haldeneggsteig 4, CH-8092 Zurich. Attn: Systems Group.
*/
#ifndef DIRENT_H_
#define DIRENT_H_
#include <sys/cdefs.h>
#define NAME_MAX 512
struct dirent {
// long d_ino;
// off_t d_off;
// unsigned short d_reclen;
char d_name[NAME_MAX + 1];
};
typedef struct {
struct dirent dirent;
void *vh; // really a vfs_handle_t
} DIR;
__BEGIN_DECLS
DIR *opendir(const char *pathname);
struct dirent *readdir(DIR* dir);
int closedir(DIR *dir);
__END_DECLS
#endif
| /*
* Copyright (c) 2007, 2008, 2009, ETH Zurich.
* All rights reserved.
*
* This file is distributed under the terms in the attached LICENSE file.
* If you do not find this file, copies can be found by writing to:
* ETH Zurich D-INFK, Haldeneggsteig 4, CH-8092 Zurich. Attn: Systems Group.
*/
#ifndef DIRENT_H_
#define DIRENT_H_
#include <sys/cdefs.h>
// Depending on header include order, this may collide with the definition in
// newlib's <dirent.h> See open issue: https://code.systems.ethz.ch/T58#1169
#ifndef NAME_MAX
#define NAME_MAX 512
#endif
struct dirent {
// long d_ino;
// off_t d_off;
// unsigned short d_reclen;
char d_name[NAME_MAX + 1];
};
typedef struct {
struct dirent dirent;
void *vh; // really a vfs_handle_t
} DIR;
__BEGIN_DECLS
DIR *opendir(const char *pathname);
struct dirent *readdir(DIR* dir);
int closedir(DIR *dir);
__END_DECLS
#endif
|
Allow to set custom DTB/OS_CALL addresses | #ifndef CONFIG_H
#define CONFIG_H
//#define QEMU
#define SIM
#define OS_CALL 0xC0000000
#define DTB 0xC3000000
#endif
| #ifndef CONFIG_H
#define CONFIG_H
//#define QEMU
#define SIM
#ifndef OS_CALL
#define OS_CALL 0xC0000000
#endif
#ifndef DTB
#define DTB 0xC3000000
#endif
#endif
|
Add missing test case, provided by Steven Watanabe. | // RUN: %clang_cc1 -emit-llvm < %s | FileCheck %s
void __fastcall f1(void);
void __stdcall f2(void);
void __thiscall f3(void);
void __fastcall f4(void) {
// CHECK: define x86_fastcallcc void @f4()
f1();
// CHECK: call x86_fastcallcc void @f1()
}
void __stdcall f5(void) {
// CHECK: define x86_stdcallcc void @f5()
f2();
// CHECK: call x86_stdcallcc void @f2()
}
void __thiscall f6(void) {
// CHECK: define x86_thiscallcc void @f6()
f3();
// CHECK: call x86_thiscallcc void @f3()
}
// PR5280
void (__fastcall *pf1)(void) = f1;
void (__stdcall *pf2)(void) = f2;
void (__thiscall *pf3)(void) = f3;
void (__fastcall *pf4)(void) = f4;
void (__stdcall *pf5)(void) = f5;
void (__thiscall *pf6)(void) = f6;
int main(void) {
f4(); f5(); f6();
// CHECK: call x86_fastcallcc void @f4()
// CHECK: call x86_stdcallcc void @f5()
// CHECK: call x86_thiscallcc void @f6()
pf1(); pf2(); pf3(); pf4(); pf5(); pf6();
// CHECK: call x86_fastcallcc void %{{.*}}()
// CHECK: call x86_stdcallcc void %{{.*}}()
// CHECK: call x86_thiscallcc void %{{.*}}()
// CHECK: call x86_fastcallcc void %{{.*}}()
// CHECK: call x86_stdcallcc void %{{.*}}()
// CHECK: call x86_thiscallcc void %{{.*}}()
return 0;
}
// PR7117
void __stdcall f7(foo) int foo; {}
void f8(void) {
f7(0);
// CHECK: call x86_stdcallcc void (...)* bitcast
}
| |
Add missing explicit include of net/url_request/url_request_context.h | // Copyright (c) 2015 GitHub, Inc.
// Use of this source code is governed by the MIT license that can be
// found in the LICENSE file.
#ifndef BROWSER_NET_LOG_H_
#define BROWSER_NET_LOG_H_
#include "base/files/scoped_file.h"
#include "net/log/net_log.h"
#include "net/log/file_net_log_observer.h"
namespace brightray {
class NetLog : public net::NetLog {
public:
NetLog();
~NetLog() override;
void StartLogging(net::URLRequestContext* url_request_context);
private:
base::ScopedFILE log_file_;
net::FileNetLogObserver write_to_file_observer_;
DISALLOW_COPY_AND_ASSIGN(NetLog);
};
} // namespace brightray
#endif // BROWSER_NET_LOG_H_
| // Copyright (c) 2015 GitHub, Inc.
// Use of this source code is governed by the MIT license that can be
// found in the LICENSE file.
#ifndef BROWSER_NET_LOG_H_
#define BROWSER_NET_LOG_H_
#include "base/files/scoped_file.h"
#include "net/log/net_log.h"
#include "net/log/file_net_log_observer.h"
#include "net/url_request/url_request_context.h"
namespace brightray {
class NetLog : public net::NetLog {
public:
NetLog();
~NetLog() override;
void StartLogging(net::URLRequestContext* url_request_context);
private:
base::ScopedFILE log_file_;
net::FileNetLogObserver write_to_file_observer_;
DISALLOW_COPY_AND_ASSIGN(NetLog);
};
} // namespace brightray
#endif // BROWSER_NET_LOG_H_
|
Fix compilation error of RestrictionMacro.h in sf1 if COBRA_RESTRICT is not defined. | #ifndef RESTRICTMACRO_H_
#define RESTRICTMACRO_H_
#ifdef COBRA_RESTRICT
#define COBRA_RESTRICT_BREAK \
break; \
#define COBRA_RESTRICT_EXCEED_N_BREAK( EXP, NUM ) \
if (EXP > NUM) \
break; \
#define COBRA_RESTRICT_EXCEED_N_RETURN_FALSE( EXP, NUM ) \
if ( EXP > NUM ) \
return false; \
#else
#define COBRA_RESTRICT_BREAK
#define COBRA_RESTRICT_N_BREAK( EXP, NUM )
#define COBRA_RESTRICT_N_RETURN_FALSE( EXP, NUM )
#endif
#endif /*RESTRICTMACRO_H_*/
| #ifndef RESTRICTMACRO_H_
#define RESTRICTMACRO_H_
#ifdef COBRA_RESTRICT
#define COBRA_RESTRICT_BREAK \
break; \
#define COBRA_RESTRICT_EXCEED_N_BREAK( EXP, NUM ) \
if (EXP > NUM) \
break; \
#define COBRA_RESTRICT_EXCEED_N_RETURN_FALSE( EXP, NUM ) \
if ( EXP > NUM ) \
return false; \
#else
#define COBRA_RESTRICT_BREAK
#define COBRA_RESTRICT_EXCEED_N_BREAK( EXP, NUM )
#define COBRA_RESTRICT_EXCEED_N_RETURN_FALSE( EXP, NUM )
#endif
#endif /*RESTRICTMACRO_H_*/
|
Fix no-return warning in loader, also change the internal variable names. | #include "vk_default_loader.h"
#include "vulkan/vulkan.h"
#if defined(_WIN32)
#elif defined(unix) || defined(__unix__) || defined(__unix)
#include <dlfcn.h>
static void* (*loadSym)(void* lib, const char* procname);
static void* loadSymWrap(VkInstance instance, const char* vkproc) {
return (*loadSym)(instance, vkproc);
}
#endif
void* getDefaultProcAddr() {
#if defined(_WIN32)
// TODO: WIN32 Vulkan loader
#elif defined(__APPLE__) && defined(__MACH__)
// TODO: Darwin Vulkan loader (via MoltenVK)
#elif defined(unix) || defined(__unix__) || defined(__unix)
void* libvulkan = dlopen("libvulkan.so", RTLD_NOW | RTLD_LOCAL);
if (libvulkan == NULL) {
return NULL;
}
loadSym = dlsym(libvulkan, "vkGetInstanceProcAddr");
if (loadSym == NULL) {
return NULL;
}
return &loadSymWrap;
#else
// Unknown operating system
#endif
} | #include "vk_default_loader.h"
#include "vulkan/vulkan.h"
#if defined(_WIN32)
#elif defined(unix) || defined(__unix__) || defined(__unix)
#include <dlfcn.h>
static void* (*symLoader)(void* lib, const char* procname);
static void* loaderWrap(VkInstance instance, const char* vkproc) {
return (*symLoader)(instance, vkproc);
}
#elif defined(__APPLE__) && defined(__MACH__)
// #include <GLFW/glfw3.h>
// static void* loaderWrap(VkInstance instance, const char* vkproc) {
// return glfwGetInstanceProcAddress(instance, vkproc);
// }
#endif
void* getDefaultProcAddr() {
#if defined(_WIN32)
// TODO: WIN32 Vulkan loader
return NULL;
#elif defined(__APPLE__) && defined(__MACH__)
// return &loaderWrap;
return NULL;
#elif defined(unix) || defined(__unix__) || defined(__unix)
void* libvulkan = dlopen("libvulkan.so", RTLD_NOW | RTLD_LOCAL);
if (libvulkan == NULL) {
return NULL;
}
symLoader = dlsym(libvulkan, "vkGetInstanceProcAddr");
if (symLoader == NULL) {
return NULL;
}
return &loaderWrap;
#else
// Unknown operating system
return NULL;
#endif
}
|
Add clear color to render target | // Copyright (C) 2016 Elviss Strazdins
// This file is part of the Ouzel engine.
#pragma once
#include <algorithm>
#include <memory>
#include "Types.h"
#include "Noncopyable.h"
#include "Size2.h"
namespace ouzel
{
namespace graphics
{
class Renderer;
class Texture;
class RenderTarget: public Noncopyable
{
friend Renderer;
public:
virtual ~RenderTarget();
virtual bool init(const Size2& newSize, bool useDepthBuffer);
TexturePtr getTexture() const { return texture; }
protected:
RenderTarget();
Size2 size;
bool depthBuffer = false;
TexturePtr texture;
};
} // namespace graphics
} // namespace ouzel
| // Copyright (C) 2016 Elviss Strazdins
// This file is part of the Ouzel engine.
#pragma once
#include <algorithm>
#include <memory>
#include "Types.h"
#include "Noncopyable.h"
#include "Size2.h"
#include "Color.h"
namespace ouzel
{
namespace graphics
{
class Renderer;
class Texture;
class RenderTarget: public Noncopyable
{
friend Renderer;
public:
virtual ~RenderTarget();
virtual bool init(const Size2& newSize, bool useDepthBuffer);
virtual void setClearColor(Color color) { clearColor = color; }
virtual Color getClearColor() const { return clearColor; }
TexturePtr getTexture() const { return texture; }
protected:
RenderTarget();
Size2 size;
bool depthBuffer = false;
Color clearColor;
TexturePtr texture;
};
} // namespace graphics
} // namespace ouzel
|
Fix warning with nonnull member for SuggetionView | //
// ImojiSDKUI
//
// Created by Nima Khoshini
// Copyright (C) 2015 Imoji
//
// 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.
//
#import <Foundation/Foundation.h>
@class IMCollectionView;
@class IMImojiSession;
@interface IMSuggestionView : UIView
@property(nonatomic, strong, readonly) IMCollectionView *collectionView;
/**
* @abstract Creates a collection view with the specified Imoji session
*/
+ (nonnull instancetype)imojiSuggestionViewWithSession:(nonnull IMImojiSession *)session;
@end
| //
// ImojiSDKUI
//
// Created by Nima Khoshini
// Copyright (C) 2015 Imoji
//
// 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.
//
#import <Foundation/Foundation.h>
@class IMCollectionView;
@class IMImojiSession;
@interface IMSuggestionView : UIView
@property(nonatomic, strong, readonly, nonnull) IMCollectionView *collectionView;
/**
* @abstract Creates a collection view with the specified Imoji session
*/
+ (nonnull instancetype)imojiSuggestionViewWithSession:(nonnull IMImojiSession *)session;
@end
|
Update the driver version to 8.04.00.08-k. | /*
* QLogic Fibre Channel HBA Driver
* Copyright (c) 2003-2012 QLogic Corporation
*
* See LICENSE.qla2xxx for copyright and licensing details.
*/
/*
* Driver version
*/
#define QLA2XXX_VERSION "8.04.00.07-k"
#define QLA_DRIVER_MAJOR_VER 8
#define QLA_DRIVER_MINOR_VER 4
#define QLA_DRIVER_PATCH_VER 0
#define QLA_DRIVER_BETA_VER 0
| /*
* QLogic Fibre Channel HBA Driver
* Copyright (c) 2003-2012 QLogic Corporation
*
* See LICENSE.qla2xxx for copyright and licensing details.
*/
/*
* Driver version
*/
#define QLA2XXX_VERSION "8.04.00.08-k"
#define QLA_DRIVER_MAJOR_VER 8
#define QLA_DRIVER_MINOR_VER 4
#define QLA_DRIVER_PATCH_VER 0
#define QLA_DRIVER_BETA_VER 0
|
Fix memory corruption, trailing & in member variable type. | #pragma once
#include "ProcessPlatform.h"
namespace ugly
{
namespace process
{
class ProcessNative : public ProcessPlatform
{
public:
ProcessNative(const std::string& path, const std::string& arguments);
const std::string& GetFullCommandLine() const override { return commandLine; }
private:
const std::string& commandLine;
};
}
} | #pragma once
#include "ProcessPlatform.h"
namespace ugly
{
namespace process
{
class ProcessNative : public ProcessPlatform
{
public:
ProcessNative(const std::string& path, const std::string& arguments);
const std::string& GetFullCommandLine() const override { return commandLine; }
private:
std::string commandLine;
};
}
} |
Define a vector to hold user defined functions | /*****************************************************************************
* PROGRAM NAME: CUDFunctionDB.h
* PROGRAMMER: Wei Sun wsun@vt.edu
* PURPOSE: Define the user defined function DB object to hold all the user
* defined function
*****************************************************************************/
#ifndef COPASI_CUDFunctionDB
#define COPASI_CUDFunctionDB
#include <string>
#include "copasi.h"
#include "output/output.h"
#include "utilities/utilities.h"
class CUDFunctionDB
{
private:
/**
* "User-defined functions" string in gps file
*/
string mNameStr;
/**
* The number of user defined function
*/
C_INT16 mItems;
/**
* Vector of user defined functions
*/
CCopasiVectorN < CBaseFunction > mUDFunctions;
public:
/**
*
*/
CUDFunctionDB();
/**
*
*/
~CUDFunctionDB();
/**
*
*/
void cleanup();
/**
* Loads an object with data coming from a CReadConfig object.
* (CReadConfig object reads an input stream)
* @param pconfigbuffer reference to a CReadConfig object.
* @return mFail
*/
C_INT32 load(CReadConfig & configbuffer);
/**
* Saves the contents of the object to a CWriteConfig object.
* (Which usually has a file attached but may also have socket)
* @param pconfigbuffer reference to a CWriteConfig object.
* @return mFail
*/
C_INT32 save(CWriteConfig & configbuffer);
/**
* Add the function to the database
* @param CUDFunction &function
* @return C_INT32 Fail
*/
void add(CUDFunction & function);
/**
* Get the number of user defined functions
*/
C_INT16 getItems() const;
/**
* Set the number of user defined funcstion
*/
void setItems(const C_INT16 items);
/**
* Get the "User-defined functions" string
*/
string getNameStr() const;
};
#endif | |
Adjust test case for lexical block pruning. Follow-on to r104842 and Radar 7424645. | // RUN: %llvmgcc -S -O0 -g %s -o - | grep DW_TAG_lexical_block | count 3
int foo(int i) {
if (i) {
int j = 2;
}
else {
int j = 3;
}
return i;
}
| // RUN: %llvmgcc -S -O0 -g %s -o - | grep DW_TAG_lexical_block | count 2
int foo(int i) {
if (i) {
int j = 2;
}
else {
int j = 3;
}
return i;
}
|
Test that local variables are aligned as the user requested. | // RUN: %llvmgcc -S %s -o - | grep {align 16}
extern p(int *);
int q(void) {
int x __attribute__ ((aligned (16)));
p(&x);
return x;
}
| |
Fix offsets to VDP1 registers | /*
* Copyright (c) 2012-2014 Israel Jacquez
* See LICENSE for details.
*
* Israel Jacquez <mrkotfw@gmail.com>
*/
#ifndef _VDP1_MAP_H_
#define _VDP1_MAP_H_
#include <scu-internal.h>
/* Macros specific for processor */
#define VDP1(x) (0x25D00000 + (x))
/* Helpers specific to this processor */
#define TVMR 0x0000
#define FBCR 0x0002
#define PTMR 0x0004
#define EWDR 0x0006
#define EWLR 0x0008
#define EWRR 0x000A
#define ENDR 0x000C
#define EDSR 0x000E
#define LOPR 0x0010
#define COPR 0x0012
#define MODR 0x0014
#endif /* !_VDP1_MAP_H_ */
| /*
* Copyright (c) 2012-2014 Israel Jacquez
* See LICENSE for details.
*
* Israel Jacquez <mrkotfw@gmail.com>
*/
#ifndef _VDP1_MAP_H_
#define _VDP1_MAP_H_
#include <scu-internal.h>
/* Macros specific for processor */
#define VDP1(x) (0x25D00000 + (x))
/* Helpers specific to this processor */
#define TVMR 0x0000
#define FBCR 0x0002
#define PTMR 0x0004
#define EWDR 0x0006
#define EWLR 0x0008
#define EWRR 0x000A
#define ENDR 0x000C
#define EDSR 0x0010
#define LOPR 0x0012
#define COPR 0x0014
#define MODR 0x0016
#endif /* !_VDP1_MAP_H_ */
|
Fix KT-43502 testcase on windows | #include "libinterop_kt43502_api.h"
int main() {
libinterop_kt43502_symbols()->kotlin.root.printExternPtr();
} | #include "testlib_api.h"
int main() {
testlib_symbols()->kotlin.root.printExternPtr();
} |
Add beforeShutdown signal to mock object | /****************************************************************************
**
** Copyright (C) 2014 Jolla Ltd.
** Contact: Raine Makelainen <raine.makelainen@jolla.com>
**
****************************************************************************/
/* 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/. */
#ifndef DECLARATIVEWEBUTILS_H
#define DECLARATIVEWEBUTILS_H
#include <QObject>
#include <QString>
#include <QColor>
#include <qqml.h>
class DeclarativeWebUtils : public QObject
{
Q_OBJECT
Q_PROPERTY(QString homePage READ homePage NOTIFY homePageChanged FINAL)
Q_PROPERTY(bool firstUseDone READ firstUseDone NOTIFY firstUseDoneChanged FINAL)
public:
explicit DeclarativeWebUtils(QObject *parent = 0);
Q_INVOKABLE int getLightness(QColor color) const;
Q_INVOKABLE QString displayableUrl(QString fullUrl) const;
static DeclarativeWebUtils *instance();
QString homePage() const;
bool firstUseDone() const;
void setFirstUseDone(bool firstUseDone);
signals:
void homePageChanged();
void firstUseDoneChanged();
private:
QString m_homePage;
bool m_firstUseDone;
};
QML_DECLARE_TYPE(DeclarativeWebUtils)
#endif
| /****************************************************************************
**
** Copyright (C) 2014 Jolla Ltd.
** Contact: Raine Makelainen <raine.makelainen@jolla.com>
**
****************************************************************************/
/* 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/. */
#ifndef DECLARATIVEWEBUTILS_H
#define DECLARATIVEWEBUTILS_H
#include <QObject>
#include <QString>
#include <QColor>
#include <qqml.h>
class DeclarativeWebUtils : public QObject
{
Q_OBJECT
Q_PROPERTY(QString homePage READ homePage NOTIFY homePageChanged FINAL)
Q_PROPERTY(bool firstUseDone READ firstUseDone NOTIFY firstUseDoneChanged FINAL)
public:
explicit DeclarativeWebUtils(QObject *parent = 0);
Q_INVOKABLE int getLightness(QColor color) const;
Q_INVOKABLE QString displayableUrl(QString fullUrl) const;
static DeclarativeWebUtils *instance();
QString homePage() const;
bool firstUseDone() const;
void setFirstUseDone(bool firstUseDone);
signals:
void homePageChanged();
void firstUseDoneChanged();
void beforeShutdown();
private:
QString m_homePage;
bool m_firstUseDone;
};
QML_DECLARE_TYPE(DeclarativeWebUtils)
#endif
|
Update the useragent a bit | //
// xkcdAppDelegate.h
// xkcd
//
// Created by Joshua Bleecher Snyder on 8/25/09.
// Copyright Treeline Labs 2009. All rights reserved.
//
#define GENERATE_DEFAULT_PNG 0
#define AppDelegate ((xkcdAppDelegate *)[UIApplication sharedApplication].delegate)
#define kUseragent @"xkcd iPhone app (xkcdapp@treelinelabs.com; http://bit.ly/rZtDq). Thank you for the API!"
@class ComicListViewController;
@interface xkcdAppDelegate : NSObject<UIApplicationDelegate> {
UINavigationController *navigationController;
ComicListViewController *listViewController;
NSManagedObjectModel *managedObjectModel;
NSManagedObjectContext *managedObjectContext;
NSPersistentStoreCoordinator *persistentStoreCoordinator;
NSUserDefaults *userDefaults;
UIWindow *window;
}
- (void)save;
- (BOOL)rotate;
- (BOOL)downloadNewComics;
- (BOOL)openZoomedOut;
- (BOOL)openAfterDownload;
@property(nonatomic, strong, readonly) NSManagedObjectModel *managedObjectModel;
@property(nonatomic, strong, readonly) NSManagedObjectContext *managedObjectContext;
@property(nonatomic, strong, readonly) NSPersistentStoreCoordinator *persistentStoreCoordinator;
@property(weak, nonatomic, readonly) NSString *applicationDocumentsDirectory;
@property(nonatomic, strong) IBOutlet UIWindow *window;
@end
| //
// xkcdAppDelegate.h
// xkcd
//
// Created by Joshua Bleecher Snyder on 8/25/09.
// Copyright Treeline Labs 2009. All rights reserved.
//
#define GENERATE_DEFAULT_PNG 0
#define AppDelegate ((xkcdAppDelegate *)[UIApplication sharedApplication].delegate)
#define kUseragent @"xkcd iPhone app (josh@treelinelabs.com; http://bit.ly/xkcdapp). Thank you for the API!"
@class ComicListViewController;
@interface xkcdAppDelegate : NSObject<UIApplicationDelegate> {
UINavigationController *navigationController;
ComicListViewController *listViewController;
NSManagedObjectModel *managedObjectModel;
NSManagedObjectContext *managedObjectContext;
NSPersistentStoreCoordinator *persistentStoreCoordinator;
NSUserDefaults *userDefaults;
UIWindow *window;
}
- (void)save;
- (BOOL)rotate;
- (BOOL)downloadNewComics;
- (BOOL)openZoomedOut;
- (BOOL)openAfterDownload;
@property(nonatomic, strong, readonly) NSManagedObjectModel *managedObjectModel;
@property(nonatomic, strong, readonly) NSManagedObjectContext *managedObjectContext;
@property(nonatomic, strong, readonly) NSPersistentStoreCoordinator *persistentStoreCoordinator;
@property(weak, nonatomic, readonly) NSString *applicationDocumentsDirectory;
@property(nonatomic, strong) IBOutlet UIWindow *window;
@end
|
Add solution to Exercise 1-20. | /* Exercise 1-20: Write a program "detab" that replaces tabs in the input with
* the proper number of blanks to space to the next tab stop. Assume a fixed
* set of tab stops, say every "n" columns. Should "n" be a variable or a
* symbolic parameter? */
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
int main(int argc, char **argv)
{
int32_t character = 0;
uint32_t line_length = 0;
uint32_t tab_width = 8;
while ((character = getchar()) != EOF) {
if (character == '\t') {
uint32_t spaces_to_add = tab_width - (line_length % tab_width);
printf("%*c", spaces_to_add, ' ');
line_length += spaces_to_add;
} else {
putchar(character);
line_length = (character != '\n') ? ++line_length : 0;
}
}
return EXIT_SUCCESS;
}
| |
Make public some attributes of Expanduino | #pragma once
#include "expanduino-subdevice.h"
#include "classes/meta.h"
#define EXPANDUINO_MAX_RESPONSE_SIZE 128
class ExpanduinoInterruption {
public:
ExpanduinoSubdevice* source;
ExpanduinoInterruption* next;
};
class Expanduino {
MetaExpanduinoSubdevice metaSubdevice;
const char* vendorName;
const char* productName;
const char* serialNumber;
const char* shortName;
ExpanduinoInterruption* nextInterruption;
friend class ExpanduinoSubdevice;
friend class MetaExpanduinoSubdevice;
public:
Expanduino();
uint8_t getNumSubdevices();
ExpanduinoSubdevice* getDevice(uint8_t devNumber);
void dispatch(uint8_t cmd, Stream& request, Print& response);
void getVendorName(Print& out);
void getProductName(Print& out);
void getSerialNumber(Print& out);
void getShortName(Print& out);
void beginSubdevices();
void endSubdevices();
void reset();
virtual bool readInterruptionData(Print& response);
virtual bool requestInterruption(ExpanduinoSubdevice* dev);
};
| #pragma once
#include "expanduino-subdevice.h"
#include "classes/meta.h"
#define EXPANDUINO_MAX_RESPONSE_SIZE 128
class ExpanduinoInterruption {
public:
ExpanduinoSubdevice* source;
ExpanduinoInterruption* next;
};
class Expanduino {
protected:
MetaExpanduinoSubdevice metaSubdevice;
ExpanduinoInterruption* nextInterruption;
friend class ExpanduinoSubdevice;
friend class MetaExpanduinoSubdevice;
public:
Expanduino();
uint8_t getNumSubdevices();
ExpanduinoSubdevice* getDevice(uint8_t devNumber);
void dispatch(uint8_t cmd, Stream& request, Print& response);
void getVendorName(Print& out);
void getProductName(Print& out);
void getSerialNumber(Print& out);
void getShortName(Print& out);
void beginSubdevices();
void endSubdevices();
void reset();
virtual bool readInterruptionData(Print& response);
virtual bool requestInterruption(ExpanduinoSubdevice* dev);
const char* vendorName;
const char* productName;
const char* serialNumber;
const char* shortName;
};
|
Fix some warnings (redefined macro definitions) | #import <Foundation/Foundation.h>
#import <CocoaLumberjack/CocoaLumberjack.h>
extern DDLogLevel magDebugKitLogLevel;
extern BOOL magDebugKitAsyncLogs;
#define LOG_ASYNC_ENABLED magDebugKitAsyncLogs
#define LOG_LEVEL_DEF magDebugKitLogLevel
@interface MAGLogging : NSObject
+ (instancetype)sharedInstance;
@property (nonatomic) DDLogLevel logLevel;
@property (nonatomic) BOOL fileLoggingEnabled;
@property (nonatomic) BOOL ttyLoggingEnabled;
@property (nonatomic) BOOL aslLoggingEnabled;
// Send logs via TCP socket.
@property (nonatomic) NSNumber *remoteLoggingEnabled;
@property (nonatomic, copy) NSString *remoteLoggingHost;
@property (nonatomic) NSNumber *remoteLoggingPort;
@property (nonatomic, copy) NSDictionary *remoteLoggingDictionary;
@end
| #import <Foundation/Foundation.h>
#import <CocoaLumberjack/CocoaLumberjack.h>
extern DDLogLevel magDebugKitLogLevel;
extern BOOL magDebugKitAsyncLogs;
#ifdef LOG_ASYNC_ENABLED
#undef LOG_ASYNC_ENABLED
#endif
#define LOG_ASYNC_ENABLED magDebugKitAsyncLogs
#ifdef LOG_LEVEL_DEF
#undef LOG_LEVEL_DEF
#endif
#define LOG_LEVEL_DEF magDebugKitLogLevel
@interface MAGLogging : NSObject
+ (instancetype)sharedInstance;
@property (nonatomic) DDLogLevel logLevel;
@property (nonatomic) BOOL fileLoggingEnabled;
@property (nonatomic) BOOL ttyLoggingEnabled;
@property (nonatomic) BOOL aslLoggingEnabled;
// Send logs via TCP socket.
@property (nonatomic) NSNumber *remoteLoggingEnabled;
@property (nonatomic, copy) NSString *remoteLoggingHost;
@property (nonatomic) NSNumber *remoteLoggingPort;
@property (nonatomic, copy) NSDictionary *remoteLoggingDictionary;
@end
|
Improve windows min max macro for MFC |
#ifndef LUMINO_MATH_H
#define LUMINO_MATH_H
#include "Lumino/Math/MathUtils.h"
#include "Lumino/Math/Vector2.h"
#include "Lumino/Math/Vector3.h"
#include "Lumino/Math/Vector4.h"
#include "Lumino/Math/Matrix.h"
#include "Lumino/Math/Quaternion.h"
#include "Lumino/Math/AttitudeTransform.h"
#include "Lumino/Math/Geometries.h"
#include "Lumino/Math/Plane.h"
#include "Lumino/Math/ViewFrustum.h"
#include "Lumino/Math/Random.h"
#endif // LUMINO_MATH_H
|
#ifndef LUMINO_MATH_H
#define LUMINO_MATH_H
#pragma push_macro("min")
#pragma push_macro("max")
#undef min
#undef max
#include "Lumino/Math/MathUtils.h"
#include "Lumino/Math/Vector2.h"
#include "Lumino/Math/Vector3.h"
#include "Lumino/Math/Vector4.h"
#include "Lumino/Math/Matrix.h"
#include "Lumino/Math/Quaternion.h"
#include "Lumino/Math/AttitudeTransform.h"
#include "Lumino/Math/Geometries.h"
#include "Lumino/Math/Plane.h"
#include "Lumino/Math/ViewFrustum.h"
#include "Lumino/Math/Random.h"
#pragma pop_macro("min")
#pragma pop_macro("max")
#endif // LUMINO_MATH_H
|
Update test to match 95961. | // Test the -fwritable-strings option.
// RUN: %llvmgcc -O3 -S -o - -emit-llvm -fwritable-strings %s | \
// RUN: grep {private global}
// RUN: %llvmgcc -O3 -S -o - -emit-llvm %s | grep {private constant}
char *X = "foo";
| // Test the -fwritable-strings option.
// RUN: %llvmgcc -O3 -S -o - -emit-llvm -fwritable-strings %s | \
// RUN: grep {internal global}
// RUN: %llvmgcc -O3 -S -o - -emit-llvm %s | grep {private constant}
char *X = "foo";
|
Add a test for unterminated /* comments. | // RUN: c-index-test -test-load-source all %s | FileCheck %s
// RUN: %clang_cc1 -fsyntax-only %s 2>&1 | FileCheck -check-prefix=ERR %s
// CHECK: annotate-comments-unterminated.c:9:5: VarDecl=x:{{.*}} RawComment=[/** Aaa. */]{{.*}} BriefComment=[ Aaa. \n]
// CHECK: annotate-comments-unterminated.c:11:5: VarDecl=y:{{.*}} RawComment=[/**< Bbb. */]{{.*}} BriefComment=[ Bbb. \n]
// CHECK-ERR: error: unterminated
/** Aaa. */
int x;
int y; /**< Bbb. */
/**< Ccc.
* Ddd.
| |
Check for warnings about inappropriate weak_imports. Darwin-specific; marked XFAIL for others. | // RUN: $llvmgcc $test -c -o /dev/null |& \
// RUN: egrep {(14|15|22): warning:} | \
// RUN: wc -l | grep --quiet 3
// TARGET: *-*-darwin
// XFAIL: alpha|ia64|sparc
// END.
// Insist upon warnings for inappropriate weak attributes.
// Note the line numbers (14|15|22) embedded in the check.
// O.K.
extern int ext_weak_import __attribute__ ((__weak_import__));
// These are inappropriate, and should generate warnings:
int decl_weak_import __attribute__ ((__weak_import__));
int decl_initialized_weak_import __attribute__ ((__weak_import__)) = 13;
// O.K.
extern int ext_f(void) __attribute__ ((__weak_import__));
// These are inappropriate, and should generate warnings:
int def_f(void) __attribute__ ((__weak_import__));
int __attribute__ ((__weak_import__)) decl_f(void) {return 0;};
| |
Add symb_locks test for access in function | // PARAM: --set ana.activated[+] "'var_eq'" --set ana.activated[+] "'symb_locks'"
#include <stdlib.h>
#include <pthread.h>
typedef struct { int myint; pthread_mutex_t mymutex; } mystruct;
void acc(mystruct *s) { s->myint=s->myint+1; } // NORACE
void *foo(void *arg) {
mystruct *s = (mystruct *) arg;
pthread_mutex_lock(&s->mymutex);
acc(s);
pthread_mutex_unlock(&s->mymutex);
return NULL;
}
int main() {
mystruct *s = (mystruct *) malloc(sizeof(*s));
pthread_mutex_init(&s->mymutex, NULL);
pthread_t id1, id2;
pthread_create(&id1, NULL, foo, s);
pthread_create(&id2, NULL, foo, s);
pthread_join(id1, NULL);
pthread_join(id2, NULL);
}
| |
Allow scenarios inheritance for scenarios::scenario template | #pragma once
#include <vector>
#include <memory>
#include <boost/noncopyable.hpp>
#include <boost/property_tree/ptree.hpp>
#include <boost/lexical_cast.hpp>
#include <boost/iterator/transform_iterator.hpp>
#include "../factory.h"
#include "../visualisation.h"
#include "../agents.h"
namespace scenarios {
class base : public boost::noncopyable {
public:
virtual ~base() {};
virtual agents apply(const agents& source) const = 0;
};
template<typename DERIVED>
class scenario : public base {
public:
scenario(const boost::property_tree::ptree& config);
virtual ~scenario() override;
protected:
private:
static factory<base, boost::property_tree::ptree>::registration<DERIVED> s_factory;
};
//////////////////////////////////
template<typename DERIVED>
factory<base, boost::property_tree::ptree>::registration<DERIVED> scenario<DERIVED>::s_factory;
template<typename DERIVED>
scenario<DERIVED>::scenario(const boost::property_tree::ptree& config) {
}
template<typename DERIVED>
scenario<DERIVED>::~scenario() {
// a dummy statement to make sure the factory doesn't get optimized away by GCC
boost::lexical_cast<std::string>(&s_factory);
}
}
| #pragma once
#include <vector>
#include <memory>
#include <boost/noncopyable.hpp>
#include <boost/property_tree/ptree.hpp>
#include <boost/lexical_cast.hpp>
#include <boost/iterator/transform_iterator.hpp>
#include "../factory.h"
#include "../visualisation.h"
#include "../agents.h"
namespace scenarios {
class base : public boost::noncopyable {
public:
base(const boost::property_tree::ptree& config) {}
virtual ~base() {};
virtual agents apply(const agents& source) const = 0;
};
template<typename DERIVED, typename BASE = base>
class scenario : public BASE {
public:
scenario(const boost::property_tree::ptree& config);
virtual ~scenario() override;
protected:
private:
static factory<base, boost::property_tree::ptree>::registration<DERIVED> s_factory;
};
//////////////////////////////////
template<typename DERIVED, typename BASE>
factory<base, boost::property_tree::ptree>::registration<DERIVED> scenario<DERIVED, BASE>::s_factory;
template<typename DERIVED, typename BASE>
scenario<DERIVED, BASE>::scenario(const boost::property_tree::ptree& config) : BASE(config) {
}
template<typename DERIVED, typename BASE>
scenario<DERIVED, BASE>::~scenario() {
// a dummy statement to make sure the factory doesn't get optimized away by GCC
boost::lexical_cast<std::string>(&s_factory);
}
}
|
Fix test to actually check the FixIt-applied code | // RUN: cp %s %t
// RUN: %clang_cc1 -pedantic -fixit %t
// RUN: echo %clang_cc1 -pedantic -Werror -x c %t
/* This is a test of the various code modification hints that are
provided as part of warning or extension diagnostics. All of the
warnings will be fixed by -fixit, and the resulting file should
compile cleanly with -Werror -pedantic. */
// FIXME: If you put a space at the end of the line, it doesn't work yet!
char *s = "hi\
there";
// The following line isn't terminated, don't fix it.
int i; // expected-error{{no newline at end of file}}
| // RUN: cp %s %t
// RUN: %clang_cc1 -pedantic -fixit %t
// RUN: %clang_cc1 -pedantic -Werror -x c %t
/* This is a test of the various code modification hints that are
provided as part of warning or extension diagnostics. All of the
warnings will be fixed by -fixit, and the resulting file should
compile cleanly with -Werror -pedantic. */
// FIXME: If you put a space at the end of the line, it doesn't work yet!
char *s = "hi\
there";
// The following line isn't terminated, don't fix it.
int i; // expected-error{{no newline at end of file}}
|
Add test for large integers | int main() {
// Issue: 3: error: integer literal too large to be represented by any integer type
1000000000000000000000000000;
}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.