Instruction stringlengths 14 778 | input_code stringlengths 0 4.24k | output_code stringlengths 1 5.44k |
|---|---|---|
Create MatrixBufferType struct to hold current world, view, and projection matricies | /* The Halfling Project - A Graphics Engine and Projects
*
* The Halfling Project is the legal property of Adrian Astley
* Copyright Adrian Astley 2013
*/
#ifndef CRATE_DEMO_GRAPHICS_MANAGER_H
#define CRATE_DEMO_GRAPHICS_MANAGER_H
#include "common/graphics_manager_base.h"
#include <d3d11.h>
#include "DirectXMath.h"
namespace CrateDemo {
class GameStateManager;
struct Vertex {
DirectX::XMFLOAT3 pos;
DirectX::XMFLOAT4 color;
};
class GraphicsManager : public Common::GraphicsManagerBase {
public:
GraphicsManager(GameStateManager *gameStateManager);
private:
GameStateManager *m_gameStateManager;
ID3D11RenderTargetView *m_renderTargetView;
public:
bool Initialize(int clientWidth, int clientHeight, HWND hwnd);
void Shutdown();
void DrawFrame();
void OnResize(int newClientWidth, int newClientHeight);
void GamePaused();
void GameUnpaused();
};
} // End of namespace CrateDemo
#endif
| /* The Halfling Project - A Graphics Engine and Projects
*
* The Halfling Project is the legal property of Adrian Astley
* Copyright Adrian Astley 2013
*/
#ifndef CRATE_DEMO_GRAPHICS_MANAGER_H
#define CRATE_DEMO_GRAPHICS_MANAGER_H
#include "common/graphics_manager_base.h"
#include <d3d11.h>
#include "DirectXMath.h"
namespace CrateDemo {
class GameStateManager;
struct Vertex {
DirectX::XMFLOAT3 pos;
DirectX::XMFLOAT4 color;
};
struct MatrixBufferType {
DirectX::XMMATRIX world;
DirectX::XMMATRIX view;
DirectX::XMMATRIX projection;
};
class GraphicsManager : public Common::GraphicsManagerBase {
public:
GraphicsManager(GameStateManager *gameStateManager);
private:
GameStateManager *m_gameStateManager;
ID3D11RenderTargetView *m_renderTargetView;
public:
bool Initialize(int clientWidth, int clientHeight, HWND hwnd);
void Shutdown();
void DrawFrame();
void OnResize(int newClientWidth, int newClientHeight);
void GamePaused();
void GameUnpaused();
};
} // End of namespace CrateDemo
#endif
|
Add loading view to SVPUllToRefresh header | //
// SVPullToRefresh.h
// SVPullToRefreshDemo
//
// Created by Sam Vermette on 23.04.12.
// Copyright (c) 2012 samvermette.com. All rights reserved.
//
// https://github.com/samvermette/SVPullToRefresh
//
// this header file is provided for backwards compatibility and will be removed in the future
// here's how you should import SVPullToRefresh now:
#import "UIScrollView+SVPullToRefresh.h"
#import "UIScrollView+SVInfiniteScrolling.h"
| //
// SVPullToRefresh.h
// SVPullToRefreshDemo
//
// Created by Sam Vermette on 23.04.12.
// Copyright (c) 2012 samvermette.com. All rights reserved.
//
// https://github.com/samvermette/SVPullToRefresh
//
// this header file is provided for backwards compatibility and will be removed in the future
// here's how you should import SVPullToRefresh now:
#import "UIScrollView+SVPullToRefresh.h"
#import "UIScrollView+SVInfiniteScrolling.h"
#import "SVPullToRefreshLoadingView.h"
#import "SVInfiniteScrollingLoadingView.h"
|
Fix public header for macOS | //
// Lottie.h
// Pods
//
// Created by brandon_withrow on 1/27/17.
//
//
#if __has_feature(modules)
@import Foundation;
#else
#import <Foundation/Foundation.h>
#endif
#ifndef Lottie_h
#define Lottie_h
//! Project version number for Lottie.
FOUNDATION_EXPORT double LottieVersionNumber;
//! Project version string for Lottie.
FOUNDATION_EXPORT const unsigned char LottieVersionString[];
#import "LOTAnimationTransitionController.h"
#import "LOTAnimationView.h"
#endif /* Lottie_h */
| //
// Lottie.h
// Pods
//
// Created by brandon_withrow on 1/27/17.
//
//
#if __has_feature(modules)
@import Foundation;
#else
#import <Foundation/Foundation.h>
#endif
#ifndef Lottie_h
#define Lottie_h
//! Project version number for Lottie.
FOUNDATION_EXPORT double LottieVersionNumber;
//! Project version string for Lottie.
FOUNDATION_EXPORT const unsigned char LottieVersionString[];
#include <TargetConditionals.h>
#if TARGET_OS_IPHONE
#import "LOTAnimationTransitionController.h"
#endif
#import "LOTAnimationView.h"
#endif /* Lottie_h */
|
Switch on vowels in argument | #include <stdio.h>
int main(int argc, char *argv[]){
if(argc != 2){
printf("You must supply one argument!\n");
//this is how you abort a program.
return 1;
}
return 0;
} | #include <stdio.h>
int main(int argc, char *argv[]){
if(argc != 2){
printf("You must supply one argument!\n");
//this is how you abort a program.
return 1;
}
int i = 0;
for(i = 0; argv[1][i] != '\0'; i++){
char letter = argv[1][i];
switch(letter){
case 'a':
case 'A':
printf("%d: 'A'\n",i);
break;
case 'e':
case 'E':
printf("%d: 'E'\n",i);
break;
case 'i':
case 'I':
printf("%d: 'I'\n",i);
break;
case 'o':
case 'O':
printf("%d: 'O'\n",i);
break;
case 'u':
case 'U':
printf("%d: 'U'\n",i);
break;
default:
printf("%d:%c is not a vowel.\n",i,letter);
}
}
return 0;
} |
Fix EVK status led to be inverted | #define MICROPY_HW_BOARD_NAME "iMX RT 1060 EVK"
#define MICROPY_HW_MCU_NAME "IMXRT1062DVJ6A"
// If you change this, then make sure to update the linker scripts as well to
// make sure you don't overwrite code
#define CIRCUITPY_INTERNAL_NVM_SIZE 0
#define BOARD_FLASH_SIZE (8 * 1024 * 1024)
#define MICROPY_HW_LED_STATUS (&pin_GPIO_AD_B0_09)
#define DEFAULT_I2C_BUS_SCL (&pin_GPIO_AD_B1_00)
#define DEFAULT_I2C_BUS_SDA (&pin_GPIO_AD_B1_01)
#define DEFAULT_UART_BUS_RX (&pin_GPIO_AD_B1_07)
#define DEFAULT_UART_BUS_TX (&pin_GPIO_AD_B1_06)
#define CIRCUITPY_DEBUG_UART_TX (&pin_GPIO_AD_B0_12)
#define CIRCUITPY_DEBUG_UART_RX (&pin_GPIO_AD_B0_13)
// Put host on the first USB so that right angle OTG adapters can fit. This is
// the right port when looking at the board.
#define CIRCUITPY_USB_DEVICE_INSTANCE 1
#define CIRCUITPY_USB_HOST_INSTANCE 0
| #define MICROPY_HW_BOARD_NAME "iMX RT 1060 EVK"
#define MICROPY_HW_MCU_NAME "IMXRT1062DVJ6A"
// If you change this, then make sure to update the linker scripts as well to
// make sure you don't overwrite code
#define CIRCUITPY_INTERNAL_NVM_SIZE 0
#define BOARD_FLASH_SIZE (8 * 1024 * 1024)
#define MICROPY_HW_LED_STATUS (&pin_GPIO_AD_B0_09)
#define MICROPY_HW_LED_STATUS_INVERTED (1)
#define DEFAULT_I2C_BUS_SCL (&pin_GPIO_AD_B1_00)
#define DEFAULT_I2C_BUS_SDA (&pin_GPIO_AD_B1_01)
#define DEFAULT_UART_BUS_RX (&pin_GPIO_AD_B1_07)
#define DEFAULT_UART_BUS_TX (&pin_GPIO_AD_B1_06)
#define CIRCUITPY_DEBUG_UART_TX (&pin_GPIO_AD_B0_12)
#define CIRCUITPY_DEBUG_UART_RX (&pin_GPIO_AD_B0_13)
// Put host on the first USB so that right angle OTG adapters can fit. This is
// the right port when looking at the board.
#define CIRCUITPY_USB_DEVICE_INSTANCE 1
#define CIRCUITPY_USB_HOST_INSTANCE 0
|
Update Skia milestone to 79 | /*
* 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 78
#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 79
#endif
|
Make pump happy. Add in this header. -Erik | /* Definitions for use with Linux AF_PACKET sockets.
Copyright (C) 1998, 1999 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
The GNU C Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, write to the Free
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */
#ifndef __NETPACKET_PACKET_H
#define __NETPACKET_PACKET_H 1
struct sockaddr_ll
{
unsigned short int sll_family;
unsigned short int sll_protocol;
int sll_ifindex;
unsigned short int sll_hatype;
unsigned char sll_pkttype;
unsigned char sll_halen;
unsigned char sll_addr[8];
};
/* Packet types. */
#define PACKET_HOST 0 /* To us. */
#define PACKET_BROADCAST 1 /* To all. */
#define PACKET_MULTICAST 2 /* To group. */
#define PACKET_OTHERHOST 3 /* To someone else. */
#define PACKET_OUTGOING 4 /* Originated by us . */
#define PACKET_LOOPBACK 5
#define PACKET_FASTROUTE 6
/* Packet socket options. */
#define PACKET_ADD_MEMBERSHIP 1
#define PACKET_DROP_MEMBERSHIP 2
#define PACKET_RECV_OUTPUT 3
#define PACKET_RX_RING 5
#define PACKET_STATISTICS 6
struct packet_mreq
{
int mr_ifindex;
unsigned short int mr_type;
unsigned short int mr_alen;
unsigned char mr_address[8];
};
#define PACKET_MR_MULTICAST 0
#define PACKET_MR_PROMISC 1
#define PACKET_MR_ALLMULTI 2
#endif /* netpacket/packet.h */
| |
Remove no longer used SkipEncodingUnusedStreams. | /*
* Copyright (c) 2013 The WebRTC project authors. All Rights Reserved.
*
* Use of this source code is governed by a BSD-style license
* that can be found in the LICENSE file in the root of the source
* tree. An additional intellectual property rights grant can be found
* in the file PATENTS. All contributing project authors may
* be found in the AUTHORS file in the root of the source tree.
*/
#ifndef WEBRTC_EXPERIMENTS_H_
#define WEBRTC_EXPERIMENTS_H_
#include "webrtc/typedefs.h"
namespace webrtc {
struct RemoteBitrateEstimatorMinRate {
RemoteBitrateEstimatorMinRate() : min_rate(30000) {}
RemoteBitrateEstimatorMinRate(uint32_t min_rate) : min_rate(min_rate) {}
uint32_t min_rate;
};
struct SkipEncodingUnusedStreams {
SkipEncodingUnusedStreams() : enabled(false) {}
explicit SkipEncodingUnusedStreams(bool set_enabled)
: enabled(set_enabled) {}
virtual ~SkipEncodingUnusedStreams() {}
const bool enabled;
};
struct AimdRemoteRateControl {
AimdRemoteRateControl() : enabled(false) {}
explicit AimdRemoteRateControl(bool set_enabled)
: enabled(set_enabled) {}
virtual ~AimdRemoteRateControl() {}
const bool enabled;
};
} // namespace webrtc
#endif // WEBRTC_EXPERIMENTS_H_
| /*
* Copyright (c) 2013 The WebRTC project authors. All Rights Reserved.
*
* Use of this source code is governed by a BSD-style license
* that can be found in the LICENSE file in the root of the source
* tree. An additional intellectual property rights grant can be found
* in the file PATENTS. All contributing project authors may
* be found in the AUTHORS file in the root of the source tree.
*/
#ifndef WEBRTC_EXPERIMENTS_H_
#define WEBRTC_EXPERIMENTS_H_
#include "webrtc/typedefs.h"
namespace webrtc {
struct RemoteBitrateEstimatorMinRate {
RemoteBitrateEstimatorMinRate() : min_rate(30000) {}
RemoteBitrateEstimatorMinRate(uint32_t min_rate) : min_rate(min_rate) {}
uint32_t min_rate;
};
struct AimdRemoteRateControl {
AimdRemoteRateControl() : enabled(false) {}
explicit AimdRemoteRateControl(bool set_enabled)
: enabled(set_enabled) {}
virtual ~AimdRemoteRateControl() {}
const bool enabled;
};
} // namespace webrtc
#endif // WEBRTC_EXPERIMENTS_H_
|
Put Pointer Authentication key value in BSS section | /*
* Copyright (c) 2019, Arm Limited. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
#include <cdefs.h>
#include <stdint.h>
/*
* Instruction pointer authentication key A. The low 64-bit are at [0], and the
* high bits at [1]. They are run-time constants so they are placed in the
* rodata section. They are written before MMU is turned on and the permissions
* are effective.
*/
uint64_t plat_apiakey[2] __section("rodata.apiakey");
/*
* This is only a toy implementation to generate a seemingly random 128-bit key
* from sp and x30 values. A production system must re-implement this function
* to generate keys from a reliable randomness source.
*/
uint64_t *plat_init_apiakey(void)
{
uintptr_t return_addr = (uintptr_t)__builtin_return_address(0U);
uintptr_t frame_addr = (uintptr_t)__builtin_frame_address(0U);
plat_apiakey[0] = (return_addr << 13) ^ frame_addr;
plat_apiakey[1] = (frame_addr << 15) ^ return_addr;
return plat_apiakey;
}
| /*
* Copyright (c) 2019, Arm Limited. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
#include <cdefs.h>
#include <stdint.h>
/*
* Instruction pointer authentication key A. The low 64-bit are at [0], and the
* high bits at [1].
*/
uint64_t plat_apiakey[2];
/*
* This is only a toy implementation to generate a seemingly random 128-bit key
* from sp and x30 values. A production system must re-implement this function
* to generate keys from a reliable randomness source.
*/
uint64_t *plat_init_apiakey(void)
{
uintptr_t return_addr = (uintptr_t)__builtin_return_address(0U);
uintptr_t frame_addr = (uintptr_t)__builtin_frame_address(0U);
plat_apiakey[0] = (return_addr << 13) ^ frame_addr;
plat_apiakey[1] = (frame_addr << 15) ^ return_addr;
return plat_apiakey;
}
|
Use standard notations for mega (M) and giga (G) |
#include <stdio.h>
#include <stdarg.h>
#include <haka/stat.h>
#include <haka/types.h>
bool stat_printf(FILE *out, const char *format, ...)
{
va_list args;
va_start(args, format);
vfprintf(out, format, args);
va_end(args);
return true;
}
size_t format_bytes(size_t v, char *c)
{
if (v > (1 << 30)) {
*c = 'g';
return (v / (1 << 30));
}
else if (v > (1 << 20)) {
*c = 'm';
return (v / (1 << 20));
}
else if (v > (1 << 10)) {
*c = 'k';
return (v / (1 << 10));
}
else {
*c = ' ';
return v;
}
}
|
#include <stdio.h>
#include <stdarg.h>
#include <haka/stat.h>
#include <haka/types.h>
bool stat_printf(FILE *out, const char *format, ...)
{
va_list args;
va_start(args, format);
vfprintf(out, format, args);
va_end(args);
return true;
}
size_t format_bytes(size_t v, char *c)
{
if (v > (1 << 30)) {
*c = 'G';
return (v / (1 << 30));
}
else if (v > (1 << 20)) {
*c = 'M';
return (v / (1 << 20));
}
else if (v > (1 << 10)) {
*c = 'k';
return (v / (1 << 10));
}
else {
*c = ' ';
return v;
}
}
|
Make testcase more robust for completely-out-of-tree builds. | // RUN: %clang_cc1 -debug-info-kind=limited -triple %itanium_abi_triple \
// RUN: %s -emit-llvm -o - | FileCheck %s
// RUN: cp %s %t.c
// RUN: %clang_cc1 -debug-info-kind=limited -triple %itanium_abi_triple \
// RUN: %t.c -emit-llvm -o - | FileCheck %s --check-prefix=INTREE
void foo() {}
// Since %s is an absolute path, directory should be a nonempty
// prefix, but the CodeGen part should be part of the filename.
// CHECK: DIFile(filename: "{{.*}}CodeGen{{.*}}debug-info-abspath.c"
// CHECK-SAME: directory: "{{.+}}")
// INTREE: DIFile({{.*}}directory: "{{.+}}CodeGen{{.*}}")
| // RUN: mkdir -p %t/UNIQUEISH_SENTINEL
// RUN: cp %s %t/UNIQUEISH_SENTINEL/debug-info-abspath.c
// RUN: %clang_cc1 -debug-info-kind=limited -triple %itanium_abi_triple \
// RUN: %t/UNIQUEISH_SENTINEL/debug-info-abspath.c -emit-llvm -o - \
// RUN: | FileCheck %s
// RUN: cp %s %t.c
// RUN: %clang_cc1 -debug-info-kind=limited -triple %itanium_abi_triple \
// RUN: %t.c -emit-llvm -o - | FileCheck %s --check-prefix=INTREE
void foo() {}
// Since %s is an absolute path, directory should be the common
// prefix, but the directory part should be part of the filename.
// CHECK: DIFile(filename: "{{.*}}UNIQUEISH_SENTINEL{{.*}}debug-info-abspath.c"
// CHECK-NOT: directory: "{{.*}}UNIQUEISH_SENTINEL
// INTREE: DIFile({{.*}}directory: "{{.+}}CodeGen{{.*}}")
|
Add message when tests are finished. | /*
* Copyright (C) 2014 René Kijewski <rene.kijewski@fu-berlin.de>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
/**
* @ingroup tests
* @{
*
* @file
* @brief execute libfixmath's unittests in RIOT
*
* @author René Kijewski <rene.kijewski@fu-berlin.de>
*
* @}
*/
int main(void)
{
#include "fix16_unittests.inc"
return 0;
}
| /*
* Copyright (C) 2014 René Kijewski <rene.kijewski@fu-berlin.de>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
/**
* @ingroup tests
* @{
*
* @file
* @brief execute libfixmath's unittests in RIOT
*
* @author René Kijewski <rene.kijewski@fu-berlin.de>
*
* @}
*/
#include <stdio.h>
int main(void)
{
#include "fix16_unittests.inc"
puts("All tests executed.");
return 0;
}
|
Change protector macro to match the filename | /*
* Copyright (C) 2016 The Android Open Source Project
*
* 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 ANDROID_AUDIOSINKCALLBACK_H
#define ANDROID_AUDIOSINKCALLBACK_H
#include <cstdint>
/**
* Interface for a callback object that renders audio into a buffer.
* This can be passed to an AudioSinkBase or its subclasses.
*/
class IAudioSinkCallback {
public:
IAudioSinkCallback() { }
virtual ~IAudioSinkCallback() = default;
typedef enum {
CALLBACK_ERROR = -1,
CALLBACK_CONTINUE = 0,
CALLBACK_FINISHED = 1, // stop calling the callback
} audio_sink_callback_result_t;
virtual audio_sink_callback_result_t renderAudio(float *buffer, int32_t numFrames) = 0;
};
#endif //ANDROID_AUDIOSINKCALLBACK_H
| /*
* Copyright (C) 2016 The Android Open Source Project
*
* 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 ANDROID_IAUDIOSINKCALLBACK_H
#define ANDROID_IAUDIOSINKCALLBACK_H
#include <cstdint>
/**
* Interface for a callback object that renders audio into a buffer.
* This can be passed to an AudioSinkBase or its subclasses.
*/
class IAudioSinkCallback {
public:
IAudioSinkCallback() { }
virtual ~IAudioSinkCallback() = default;
typedef enum {
CALLBACK_ERROR = -1,
CALLBACK_CONTINUE = 0,
CALLBACK_FINISHED = 1, // stop calling the callback
} audio_sink_callback_result_t;
virtual audio_sink_callback_result_t renderAudio(float *buffer, int32_t numFrames) = 0;
};
#endif //ANDROID_IAUDIOSINKCALLBACK_H
|
Solve Age in Days in c | #include <stdio.h>
int main() {
int t, a = 0, m = 0, d = 0;
while (scanf("%d", &t) != EOF) {
if (t >= 365) {
a = t / 365;
t %= 365;
}
if (t >= 30) {
m = t / 30;
t %= 30;
}
d = t;
printf("%d ano(s)\n", a);
printf("%d mes(es)\n", m);
printf("%d dia(s)\n", d);
}
return 0;
}
| |
Delete some extern vars that were in ugens.h. Other minor cleanups. | /* command_line.c */
/* to return command line arguments */
#include "../H/ugens.h"
#include "../Minc/defs.h"
#include "../Minc/ext.h"
extern int aargc;
extern char *aargv[]; /* to pass commandline args to subroutines */
double f_arg(float *p, short n_args)
{
double atof();
return (((int)p[0]) < aargc - 1) ? (atof(aargv[(int)p[0]])) : 0.0;
}
double i_arg(float *p, short n_args)
{
int atoi();
return (((int)p[0]) < aargc - 1) ? (atoi(aargv[(int)p[0]])) : 0;
}
double s_arg(float *p,short n_args,double *pp)
{
char *name;
int i1 = 0;
if(((int)pp[0]) < aargc - 1) {
name = aargv[(int)pp[0]];
i1 = (int) strsave(name);
}
return(i1);
}
double n_arg(float *p, short n_args)
{
return(aargc);
}
| /* command_line.c */
/* to return command line arguments */
#include <stdlib.h>
#include <math.h>
#include <ugens.h>
#include "../Minc/ext.h"
double f_arg(float *p, short n_args)
{
return (((int)p[0]) < aargc - 1) ? (atof(aargv[(int)p[0]])) : 0.0;
}
double i_arg(float *p, short n_args)
{
return (((int)p[0]) < aargc - 1) ? (atoi(aargv[(int)p[0]])) : 0;
}
double s_arg(float *p,short n_args,double *pp)
{
char *name;
int i1 = 0;
if(((int)pp[0]) < aargc - 1) {
name = aargv[(int)pp[0]];
i1 = (int) strsave(name);
}
return(i1);
}
double n_arg(float *p, short n_args)
{
return(aargc);
}
|
Remove warning `Warning: Unused class rule: PackedContainer` | #ifdef __CINT__
#pragma link off all globals;
#pragma link off all classes;
#pragma link off all functions;
#pragma link C++ class CustomStruct+;
#pragma link C++ class DerivedA+;
#pragma link C++ class DerivedA2+;
#pragma link C++ class DerivedB+;
#pragma link C++ class DerivedC+;
#pragma link C++ class IAuxSetOption+;
#pragma link C++ class PackedParameters+;
#pragma link C++ class PackedContainer+;
#endif
| #ifdef __CINT__
#pragma link off all globals;
#pragma link off all classes;
#pragma link off all functions;
#pragma link C++ class CustomStruct+;
#pragma link C++ class DerivedA+;
#pragma link C++ class DerivedA2+;
#pragma link C++ class DerivedB+;
#pragma link C++ class DerivedC+;
#pragma link C++ class IAuxSetOption+;
#pragma link C++ class PackedParameters+;
#pragma link C++ class PackedContainer<int>+;
#endif
|
Update test case for llvm summary format changes in D17592. | // RUN: %clang_cc1 -flto=thin -emit-llvm-bc < %s | llvm-bcanalyzer -dump | FileCheck %s
// CHECK: <FUNCTION_SUMMARY_BLOCK
// CHECK-NEXT: <PERMODULE_ENTRY
// CHECK-NEXT: <PERMODULE_ENTRY
// CHECK-NEXT: </FUNCTION_SUMMARY_BLOCK
__attribute__((noinline)) void foo() {}
int main() { foo(); }
| // RUN: %clang_cc1 -flto=thin -emit-llvm-bc < %s | llvm-bcanalyzer -dump | FileCheck %s
// CHECK: <GLOBALVAL_SUMMARY_BLOCK
// CHECK-NEXT: <PERMODULE
// CHECK-NEXT: <PERMODULE
// CHECK-NEXT: </GLOBALVAL_SUMMARY_BLOCK
__attribute__((noinline)) void foo() {}
int main() { foo(); }
|
Use GCC visibility for exporting symbols | /*
*
* OBEX Server
*
* Copyright (C) 2007-2009 Marcel Holtmann <marcel@holtmann.org>
*
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*
*/
struct obex_plugin_desc {
const char *name;
int (*init) (void);
void (*exit) (void);
};
#define OBEX_PLUGIN_DEFINE(name,init,exit) \
struct obex_plugin_desc obex_plugin_desc = { \
name, init, exit \
};
| /*
*
* OBEX Server
*
* Copyright (C) 2007-2009 Marcel Holtmann <marcel@holtmann.org>
*
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*
*/
struct obex_plugin_desc {
const char *name;
int (*init) (void);
void (*exit) (void);
};
#define OBEX_PLUGIN_DEFINE(name,init,exit) \
extern struct obex_plugin_desc obex_plugin_desc \
__attribute__ ((visibility("default"))); \
struct obex_plugin_desc obex_plugin_desc = { \
name, init, exit \
};
|
Fix timezone issue -- call the correct C function | #define _XOPEN_SOURCE
#include <time.h>
#include <locale.h>
void set_c_locale() {
setlocale(LC_TIME, "C");
}
time_t c_parse_http_time(char* s) {
struct tm dest;
strptime(s, "%a, %d %b %Y %H:%M:%S GMT", &dest);
return mktime(&dest);
}
void c_format_http_time(time_t src, char* dest) {
struct tm t;
gmtime_r(&src, &t);
strftime(dest, 40, "%a, %d %b %Y %H:%M:%S GMT", &t);
}
| #define _XOPEN_SOURCE
#include <time.h>
#include <locale.h>
void set_c_locale() {
setlocale(LC_TIME, "C");
}
time_t c_parse_http_time(char* s) {
struct tm dest;
strptime(s, "%a, %d %b %Y %H:%M:%S GMT", &dest);
return timegm(&dest);
}
void c_format_http_time(time_t src, char* dest) {
struct tm t;
gmtime_r(&src, &t);
strftime(dest, 40, "%a, %d %b %Y %H:%M:%S GMT", &t);
}
|
Add receiver and meta data | #ifndef TIN_BUSSIGNALDEF_H
#define TIN_BUSSIGNALDEF_H
#include <cstdint>
#include <string>
namespace tin
{
enum class Byte_order : std::uint8_t { Intel, Moto };
enum class Value_sign : std::uint8_t { Signed, Unsigned };
struct Bus_signal_def
{
bool multiplex_switch;
Byte_order order;
Value_sign sign;
std::int32_t multiplex_value;
std::uint32_t pos;
std::uint32_t len;
double factor;
double offset;
double minimum;
double maximum;
std::string unit;
std::string name;
};
} // namespace tin
#endif // TIN_BUSSIGNALDEF_H
| #ifndef TIN_BUSSIGNALDEF_H
#define TIN_BUSSIGNALDEF_H
#include <cstdint>
#include <string>
#include <vector>
namespace tin
{
enum class Byte_order : std::uint8_t { Intel, Moto };
enum class Value_sign : std::uint8_t { Signed, Unsigned };
struct Bus_signal_meta_data
{
std::int8_t factor_precision = 7;
std::int8_t offset_precision = 7;
std::int8_t minimum_precision = 7;
std::int8_t maximum_precision = 7;
};
struct Bus_signal_def
{
bool multiplex_switch;
Byte_order order;
Value_sign sign;
std::int32_t multiplex_value;
std::uint32_t pos;
std::uint32_t len;
double factor;
double offset;
double minimum;
double maximum;
std::string unit;
std::string name;
std::vector<std::string> receiver;
Bus_signal_meta_data meta_data;
};
} // namespace tin
#endif // TIN_BUSSIGNALDEF_H
|
Allow to build with clang-cl | #ifndef stdbool_h
#define stdbool_h
#include <wtypes.h>
/* MSVC doesn't define _Bool or bool in C, but does have BOOL */
/* Note this doesn't pass autoconf's test because (bool) 0.5 != true */
typedef BOOL _Bool;
#define bool _Bool
#define true 1
#define false 0
#define __bool_true_false_are_defined 1
#endif /* stdbool_h */
| #ifndef stdbool_h
#define stdbool_h
#include <wtypes.h>
/* MSVC doesn't define _Bool or bool in C, but does have BOOL */
/* Note this doesn't pass autoconf's test because (bool) 0.5 != true */
/* Clang-cl uses MSVC headers, so needs msvc_compat, but has _Bool as
* a built-in type. */
#ifndef __clang__
typedef BOOL _Bool;
#endif
#define bool _Bool
#define true 1
#define false 0
#define __bool_true_false_are_defined 1
#endif /* stdbool_h */
|
Add tests for RDM feature. | // RUN: %clang -target aarch64-none-none-eabi -march=armv8a+rdm -### -c %s 2>&1 | FileCheck --check-prefix=CHECK-RDM %s
// RUN: %clang -target aarch64-none-none-eabi -mcpu=generic+rdm -### -c %s 2>&1 | FileCheck --check-prefix=CHECK-RDM %s
// RUN: %clang -target aarch64-none-none-eabi -mcpu=falkor -### -c %s 2>&1 | FileCheck --check-prefix=CHECK-RDM %s
// RUN: %clang -target aarch64-none-none-eabi -mcpu=thunderx2t99 -### -c %s 2>&1 | FileCheck --check-prefix=CHECK-RDM %s
// CHECK-RDM: "-target-feature" "+rdm"
// RUN: %clang -target aarch64-none-none-eabi -march=armv8a+nordm -### -c %s 2>&1 | FileCheck --check-prefix=CHECK-NORDM %s
// RUN: %clang -target aarch64-none-none-eabi -mcpu=generic+nordm -### -c %s 2>&1 | FileCheck --check-prefix=CHECK-NORDM %s
// CHECK-NORDM: "-target-feature" "-rdm"
| |
Add docs to authenticator header. | //
// TJDropboxAuthenticator.h
// Close-up
//
// Created by Tim Johnsen on 3/14/20.
//
#import <Foundation/Foundation.h>
NS_ASSUME_NONNULL_BEGIN
API_AVAILABLE(ios(10.0)) @interface TJDropboxAuthenticator : NSObject
+ (void)authenticateWithClientIdentifier:(NSString *const)clientIdentifier
bypassingNativeAuth:(const BOOL)bypassNativeAuth
completion:(void (^)(NSString *))completion;
+ (BOOL)tryHandleAuthenticationCallbackWithURL:(NSURL *const)url;
@end
NS_ASSUME_NONNULL_END
| //
// TJDropboxAuthenticator.h
// Close-up
//
// Created by Tim Johnsen on 3/14/20.
//
#import <Foundation/Foundation.h>
NS_ASSUME_NONNULL_BEGIN
API_AVAILABLE(ios(10.0)) @interface TJDropboxAuthenticator : NSObject
/**
* Invoke this to initiate auth
* @param clientIdentifier Your registered Dropbox client identifier.
* @param bypassNativeAuth Pass @c YES to skip authentication via the Dropbox app and force auth to occur via the web.
* @param completion Block invoked when auth is complete. @c accessToken will be @c nil if auth wasn't completed.
*/
+ (void)authenticateWithClientIdentifier:(NSString *const)clientIdentifier
bypassingNativeAuth:(const BOOL)bypassNativeAuth
completion:(void (^)(NSString *_Nullable accessToken))completion;
/// Invoke this from your app delegate's implementation of -application:openURL:options:, returns whether or not the URL was a completion callback to Dropbox auth.
+ (BOOL)tryHandleAuthenticationCallbackWithURL:(NSURL *const)url;
@end
NS_ASSUME_NONNULL_END
|
Add a generic rack-pinion steering subsystem. | // =============================================================================
// PROJECT CHRONO - http://projectchrono.org
//
// Copyright (c) 2014 projectchrono.org
// All right reserved.
//
// Use of this source code is governed by a BSD-style license that can be found
// in the LICENSE file at the top level of the distribution and at
// http://projectchrono.org/license-chrono.txt.
//
// =============================================================================
// Authors: Radu Serban
// =============================================================================
//
// Generic rack-pinion steering model.
//
// =============================================================================
#ifndef GENERIC_RACKPINION_H
#define GENERIC_RACKPINION_H
#include "subsys/steering/ChRackPinion.h"
class Generic_RackPinion : public chrono::ChRackPinion
{
public:
Generic_RackPinion(const std::string& name) : ChRackPinion(name) {}
~Generic_RackPinion() {}
virtual double GetSteeringLinkMass() const { return 9.0; }
virtual const chrono::ChVector<>& GetSteeringLinkInertia() const { return chrono::ChVector<>(1, 1, 1); }
virtual double GetSteeringLinkCOM() const { return 0.0; }
virtual double GetSteeringLinkRadius() const { return 0.03; }
virtual double GetSteeringLinkLength() const { return 0.896; }
virtual double GetPinionRadius() const { return 0.1; }
virtual double GetMaxAngle() const { return 0.87; }
};
#endif
| |
Change how proxr resources are set. Previously it was given a value 0-255 which the proxr hardware uses to set the voltage. now just give it a voltage and do the conversion in the hab. also if a voltage supplied is out of range it snaps to nearest in range. | #include <string.h>
#include <stdlib.h>
#include "proxrcmds.h"
#include "sim-hab.h"
void cb_set_resource(bionet_resource_t *resource, bionet_value_t *value)
{
double data;
double content;
char number[3];
char *res_name = NULL;
long int id;
bionet_node_t *node;
bionet_value_get_double(value, &data);
if(data < 0 || data > 255)
return;
node = bionet_resource_get_node(resource);
bionet_split_resource_name(bionet_resource_get_name(resource), NULL, NULL, NULL, &res_name);
// extract pot number from resource name
number[0] = res_name[4];
number[1] = res_name[5];
number[2] = '\0';
id = strtol(number, NULL, 10);
// command proxr to adjust to new value
set_potentiometer(id, (int)data);
// set resources datapoint to new value and report
content = data*POT_CONVERSION;
bionet_resource_set_double(resource, content, NULL);
hab_report_datapoints(node);
}
| #include <string.h>
#include <stdlib.h>
#include "proxrcmds.h"
#include "sim-hab.h"
void cb_set_resource(bionet_resource_t *resource, bionet_value_t *value)
{
double data;
double content;
char number[3];
char *res_name = NULL;
long int id;
bionet_node_t *node;
bionet_value_get_double(value, &data);
if(data < 0)
data = 0;
if(data > 5)
data = 5;
node = bionet_resource_get_node(resource);
bionet_split_resource_name(bionet_resource_get_name(resource), NULL, NULL, NULL, &res_name);
// extract pot number from resource name
number[0] = res_name[4];
number[1] = res_name[5];
number[2] = '\0';
id = strtol(number, NULL, 10);
// proxr hardware works with 8 bit resolution 0-255 steps
data = data/POT_CONVERSION;
// command proxr to adjust to new value
set_potentiometer(id, (int)data);
// set resources datapoint to new value and report
content = data*POT_CONVERSION;
bionet_resource_set_double(resource, content, NULL);
hab_report_datapoints(node);
}
|
Fix type missmatch (crucial for wasienv) | //
// m3_api_defs.h
//
// Created by Volodymyr Shymanskyy on 12/20/19.
// Copyright © 2019 Volodymyr Shymanskyy. All rights reserved.
//
#ifndef m3_api_defs_h
#define m3_api_defs_h
#include "m3_core.h"
#define m3ApiReturnType(TYPE) TYPE* raw_return = ((TYPE*) (_sp));
#define m3ApiGetArg(TYPE, NAME) TYPE NAME = * ((TYPE *) (_sp++));
#define m3ApiGetArgMem(TYPE, NAME) TYPE NAME = (TYPE) (_mem + * (u32 *) _sp++);
#define m3ApiRawFunction(NAME) void NAME (IM3Runtime runtime, u64 * _sp, u8 * _mem)
#define m3ApiReturn(VALUE) { *raw_return = (VALUE); return; }
#endif /* m3_api_defs_h */
| //
// m3_api_defs.h
//
// Created by Volodymyr Shymanskyy on 12/20/19.
// Copyright © 2019 Volodymyr Shymanskyy. All rights reserved.
//
#ifndef m3_api_defs_h
#define m3_api_defs_h
#include "m3_core.h"
#define m3ApiReturnType(TYPE) TYPE* raw_return = ((TYPE*) (_sp));
#define m3ApiGetArg(TYPE, NAME) TYPE NAME = * ((TYPE *) (_sp++));
#define m3ApiGetArgMem(TYPE, NAME) TYPE NAME = (TYPE) (_mem + * (u32 *) _sp++);
#define m3ApiRawFunction(NAME) m3ret_t NAME (IM3Runtime runtime, u64 * _sp, u8 * _mem)
#define m3ApiReturn(VALUE) { *raw_return = (VALUE); return NULL; }
#endif /* m3_api_defs_h */
|
Remove unused and untested Payload constructor | #ifndef CPR_PAYLOAD_H
#define CPR_PAYLOAD_H
#include <memory>
#include <string>
#include <initializer_list>
namespace cpr {
struct Pair {
Pair(const std::string& key, const std::string& value) : key{key}, value{value} {}
Pair(const std::string& key, const int& value) : key{key}, value{std::to_string(value)} {}
std::string key;
std::string value;
};
class Payload {
public:
Payload(const std::initializer_list<Pair>& pairs);
Payload(const std::string& content) : content{content} {}
Payload(std::string&& content) : content{std::move(content)} {}
std::string content;
};
} // namespace cpr
#endif
| #ifndef CPR_PAYLOAD_H
#define CPR_PAYLOAD_H
#include <memory>
#include <string>
#include <initializer_list>
namespace cpr {
struct Pair {
Pair(const std::string& key, const std::string& value) : key{key}, value{value} {}
Pair(const std::string& key, const int& value) : key{key}, value{std::to_string(value)} {}
std::string key;
std::string value;
};
class Payload {
public:
Payload(const std::initializer_list<Pair>& pairs);
std::string content;
};
} // namespace cpr
#endif
|
Add alias to sys_rand and sys_srand | static unsigned long next = 1;
/* RAND_MAX assumed to be 32767 */
int sys_rand(void) {
next = next * 1103515245 + 12345;
return((unsigned)(next/65536) % 32768);
}
void sys_srand(unsigned seed) {
next = seed;
}
| static unsigned long next = 1;
/* RAND_MAX assumed to be 32767 */
int sys_rand(void) {
next = next * 1103515245 + 12345;
return((unsigned)(next/65536) % 32768);
}
void sys_srand(unsigned seed) {
next = seed;
}
__attribute__((weak)) int rand(void) { return sys_rand(); }
__attribute__((weak)) void srand(unsigned seed) { srand(seed); }
|
Remove needless include of Cocoa. | //
// CwlSignal.h
// CwlSignal
//
// Created by Matt Gallagher on 11/6/16.
// Copyright © 2016 Matt Gallagher ( http://cocoawithlove.com ). All rights reserved.
//
#import <Cocoa/Cocoa.h>
//! Project version number for CwlSignal.
FOUNDATION_EXPORT double CwlSignalVersionNumber;
//! Project version string for CwlSignal.
FOUNDATION_EXPORT const unsigned char CwlSignalVersionString[];
// In this header, you should import all the public headers of your framework using statements like #import <CwlSignal/PublicHeader.h>
#import "CwlFrameAddress.h"
| //
// CwlSignal.h
// CwlSignal
//
// Created by Matt Gallagher on 11/6/16.
// Copyright © 2016 Matt Gallagher ( http://cocoawithlove.com ). All rights reserved.
//
#import <Foundation/Foundation.h>
//! Project version number for CwlSignal.
FOUNDATION_EXPORT double CwlSignalVersionNumber;
//! Project version string for CwlSignal.
FOUNDATION_EXPORT const unsigned char CwlSignalVersionString[];
// In this header, you should import all the public headers of your framework using statements like #import <CwlSignal/PublicHeader.h>
#import "CwlFrameAddress.h"
|
Fix a comment that wasn't commente'd out | /*-------------------------------------------------------------------------
*
* dynahash--
* POSTGRES dynahash.h file definitions
*
*
* Copyright (c) 1994, Regents of the University of California
*
* $Id: dynahash.h,v 1.1 1996/11/09 05:48:28 momjian Exp $
*
*-------------------------------------------------------------------------
*/
#ifndef DYNAHASH_H
#define DYNAHASH_H
extern int my_log2(long num);
#endif DYNAHASH_H /* DYNAHASH_H */
| /*-------------------------------------------------------------------------
*
* dynahash--
* POSTGRES dynahash.h file definitions
*
*
* Copyright (c) 1994, Regents of the University of California
*
* $Id: dynahash.h,v 1.2 1996/11/14 20:06:39 scrappy Exp $
*
*-------------------------------------------------------------------------
*/
#ifndef DYNAHASH_H
#define DYNAHASH_H
extern int my_log2(long num);
#endif /* DYNAHASH_H */
|
Add portable floating point parsing with optional grisu3 support | #ifndef PPARSEFP_H
#define PPARSEFP_H
/*
* Parses a float or double number and returns the length parsed if
* successful. The length argument is of limited value due to dependency
* on `strtod` - buf[len] must be accessible and must not be part of
* a valid number, including hex float numbers..
*
* Unlike strtod, whitespace is not parsed.
*
* May return:
* - null on error,
* - buffer start if first character does start a number,
* - or end of parse on success.
*
* Grisu3 is not part of the portable lib per se, it must be in the
* include path. Grisu3 provides much faster printing and parsing in the
* typical case with fallback to sprintf for printing and strod for
* parsing.
*
* Either define PORTABLE_USE_GRISU3, or include the grisu3 header first.
*/
#include <math.h> /* for HUGE_VAL */
#if PORTABLE_USE_GRISU3
#include "grisu3/grisu3_parse.h"
#endif
#ifdef grisu3_parse_double_is_defined
static inline const char *parse_double(const char *buf, int len, double *result)
{
return grisu3_parse_double(buf, len, result);
}
#else
#include <stdio.h>
static inline const char *parse_double(const char *buf, int len, double *result)
{
char *end;
(void)len;
*result = strtod(buf, &end);
return end;
}
#endif
static inline const char *parse_float(const char *buf, int len, float *result)
{
const char *end;
double v;
end = parse_double(buf, len, &v);
*result = (float)v;
return end;
}
#endif /* PPARSEFP_H */
| |
Use memset instead of bzero | /* Copyright (C) 2005 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
The GNU C Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, write to the Free
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */
#include <string.h>
libc_hidden_proto(bzero)
/* Clear memory. Can't alias to bzero because it's not defined in the
same translation unit. */
void
__aeabi_memclr (void *dest, size_t n)
{
bzero (dest, n);
}
/* Versions of the above which may assume memory alignment. */
strong_alias (__aeabi_memclr, __aeabi_memclr4)
strong_alias (__aeabi_memclr, __aeabi_memclr8)
| /* Copyright (C) 2005 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
The GNU C Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, write to the Free
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */
#include <string.h>
libc_hidden_proto(memset)
/* Clear memory. Can't alias to bzero because it's not defined in the
same translation unit. */
void
__aeabi_memclr (void *dest, size_t n)
{
memset (dest, 0, n);
}
/* Versions of the above which may assume memory alignment. */
strong_alias (__aeabi_memclr, __aeabi_memclr4)
strong_alias (__aeabi_memclr, __aeabi_memclr8)
|
Fix for building without notify | /* Copyright (C) 2003 Timo Sirainen */
#include "lib.h"
#include "ioloop-internal.h"
#ifdef IOLOOP_NOTIFY_NONE
struct io *io_loop_notify_add(struct ioloop *ioloop __attr_unused__,
const char *path __attr_unused__,
io_callback_t *callback __attr_unused__,
void *context __attr_unused__)
{
return NULL;
}
void io_loop_notify_remove(struct ioloop *ioloop __attr_unused__,
struct io *io __attr_unused__)
{
}
void io_loop_notify_handler_init(struct ioloop *ioloop __attr_unused__)
{
}
void io_loop_notify_handler_deinit(struct ioloop *ioloop __attr_unused__)
{
}
#endif
| /* Copyright (C) 2003 Timo Sirainen */
#include "lib.h"
#include "ioloop-internal.h"
#ifdef IOLOOP_NOTIFY_NONE
#undef io_add_notify
struct io *io_add_notify(const char *path __attr_unused__,
io_callback_t *callback __attr_unused__,
void *context __attr_unused__)
{
return NULL;
}
void io_loop_notify_remove(struct ioloop *ioloop __attr_unused__,
struct io *io __attr_unused__)
{
}
void io_loop_notify_handler_deinit(struct ioloop *ioloop __attr_unused__)
{
}
#endif
|
Fix guards for renamed header files. | #ifndef FHASH_H
#define FHASH_H
/* Box the filename pointer in a struct, for added typechecking. */
typedef struct fname {
char *name;
} fname;
set *fname_new_set(int sz_factor);
fname *fname_new(char *n, size_t len);
fname *fname_add(set *wt, fname *f);
void fname_free(void *w);
#endif
| #ifndef FNAME_H
#define FNAME_H
/* Box the filename pointer in a struct, for added typechecking. */
typedef struct fname {
char *name;
} fname;
set *fname_new_set(int sz_factor);
fname *fname_new(char *n, size_t len);
fname *fname_add(set *wt, fname *f);
void fname_free(void *w);
#endif
|
Move inliner pass header file. | //===- InlinerPass.h - Code common to all inliners --------------*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
// This file was developed by the LLVM research group and is distributed under
// the University of Illinois Open Source License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
//
// This file defines a simple policy-based bottom-up inliner. This file
// implements all of the boring mechanics of the bottom-up inlining, while the
// subclass determines WHAT to inline, which is the much more interesting
// component.
//
//===----------------------------------------------------------------------===//
#ifndef INLINER_H
#define INLINER_H
#include "llvm/CallGraphSCCPass.h"
namespace llvm {
class CallSite;
/// Inliner - This class contains all of the helper code which is used to
/// perform the inlining operations that does not depend on the policy.
///
struct Inliner : public CallGraphSCCPass {
Inliner(const void *ID);
/// getAnalysisUsage - For this class, we declare that we require and preserve
/// the call graph. If the derived class implements this method, it should
/// always explicitly call the implementation here.
virtual void getAnalysisUsage(AnalysisUsage &Info) const;
// Main run interface method, this implements the interface required by the
// Pass class.
virtual bool runOnSCC(const std::vector<CallGraphNode *> &SCC);
// doFinalization - Remove now-dead linkonce functions at the end of
// processing to avoid breaking the SCC traversal.
virtual bool doFinalization(CallGraph &CG);
/// This method returns the value specified by the -inline-threshold value,
/// specified on the command line. This is typically not directly needed.
///
unsigned getInlineThreshold() const { return InlineThreshold; }
/// getInlineCost - This method must be implemented by the subclass to
/// determine the cost of inlining the specified call site. If the cost
/// returned is greater than the current inline threshold, the call site is
/// not inlined.
///
virtual int getInlineCost(CallSite CS) = 0;
private:
// InlineThreshold - Cache the value here for easy access.
unsigned InlineThreshold;
};
} // End llvm namespace
#endif
| |
Use class for non-trivial types | // This file is distributed under the MIT license.
// See the LICENSE file for details.
#pragma once
#ifndef VSNRAY_DETAIL_SPD_BLACKBODY_H
#define VSNRAY_DETAIL_SPD_BLACKBODY_H 1
#include <cmath>
#include "../macros.h"
namespace visionaray
{
//-------------------------------------------------------------------------------------------------
// Spectral power distribution for blackbody radiator
// See: http://www.spectralcalc.com/blackbody/units_of_wavelength.html
// Color temperature in Kelvin, sample SPD with wavelength (nm)
//
struct blackbody
{
blackbody(float T = 1500.0) : T(T) {}
VSNRAY_FUNC float operator()(float lambda /* nm */) const
{
double const k = 1.3806488E-23;
double const h = 6.62606957E-34;
double const c = 2.99792458E8;
lambda *= 1E-3; // nm to microns
return ( ( 2.0 * 1E24 * h * c * c ) / pow(lambda, 5.0) )
* ( 1.0 / (exp((1E6 * h * c) / (lambda * k * T)) - 1.0) );
}
private:
double T;
};
} // visionaray
#endif // VSNRAY_DETAIL_SPD_BLACKBODY_H
| // This file is distributed under the MIT license.
// See the LICENSE file for details.
#pragma once
#ifndef VSNRAY_DETAIL_SPD_BLACKBODY_H
#define VSNRAY_DETAIL_SPD_BLACKBODY_H 1
#include <cmath>
#include "../macros.h"
namespace visionaray
{
//-------------------------------------------------------------------------------------------------
// Spectral power distribution for blackbody radiator
// See: http://www.spectralcalc.com/blackbody/units_of_wavelength.html
// Color temperature in Kelvin, sample SPD with wavelength (nm)
//
class blackbody
{
public:
blackbody(float T = 1500.0) : T(T) {}
VSNRAY_FUNC float operator()(float lambda /* nm */) const
{
double const k = 1.3806488E-23;
double const h = 6.62606957E-34;
double const c = 2.99792458E8;
lambda *= 1E-3; // nm to microns
return ( ( 2.0 * 1E24 * h * c * c ) / pow(lambda, 5.0) )
* ( 1.0 / (exp((1E6 * h * c) / (lambda * k * T)) - 1.0) );
}
private:
double T;
};
} // visionaray
#endif // VSNRAY_DETAIL_SPD_BLACKBODY_H
|
Fix headers so SNTP builds on Esp32 | //
// Copyright (c) 2018 The nanoFramework project contributors
// Portions Copyright (c) Microsoft Corporation. All rights reserved.
// See LICENSE file in the project root for full license information.
//
#ifndef _NF_NETWORKING_SNTP_H_
#define _NF_NETWORKING_SNTP_H_
#include <nanoCLR_Interop.h>
#include <nanoCLR_Runtime.h>
#include <nanoCLR_Checks.h>
#include <nanoHAL_time.h>
extern "C"
{
#include <apps/sntp.h>
}
struct Library_nf_networking_sntp_nanoFramework_Networking_Sntp
{
NANOCLR_NATIVE_DECLARE(Start___STATIC__VOID);
NANOCLR_NATIVE_DECLARE(Stop___STATIC__VOID);
NANOCLR_NATIVE_DECLARE(UpdateNow___STATIC__VOID);
NANOCLR_NATIVE_DECLARE(get_IsStarted___STATIC__BOOLEAN);
NANOCLR_NATIVE_DECLARE(get_Server1___STATIC__STRING);
NANOCLR_NATIVE_DECLARE(set_Server1___STATIC__VOID__STRING);
NANOCLR_NATIVE_DECLARE(get_Server2___STATIC__STRING);
NANOCLR_NATIVE_DECLARE(set_Server2___STATIC__VOID__STRING);
//--//
};
extern const CLR_RT_NativeAssemblyData g_CLR_AssemblyNative_nanoFramework_Networking_Sntp;
#endif //_NF_NETWORKING_SNTP_H_
| //
// Copyright (c) 2018 The nanoFramework project contributors
// Portions Copyright (c) Microsoft Corporation. All rights reserved.
// See LICENSE file in the project root for full license information.
//
#ifndef _NF_NETWORKING_SNTP_H_
#define _NF_NETWORKING_SNTP_H_
#include <nanoCLR_Interop.h>
#include <nanoCLR_Runtime.h>
#include <nanoCLR_Checks.h>
#include <nanoHAL_time.h>
extern "C"
{
#ifndef PLATFORM_ESP32
#include <apps/sntp.h>
#else
#include <apps/sntp/sntp.h>
#endif
}
struct Library_nf_networking_sntp_nanoFramework_Networking_Sntp
{
NANOCLR_NATIVE_DECLARE(Start___STATIC__VOID);
NANOCLR_NATIVE_DECLARE(Stop___STATIC__VOID);
NANOCLR_NATIVE_DECLARE(UpdateNow___STATIC__VOID);
NANOCLR_NATIVE_DECLARE(get_IsStarted___STATIC__BOOLEAN);
NANOCLR_NATIVE_DECLARE(get_Server1___STATIC__STRING);
NANOCLR_NATIVE_DECLARE(set_Server1___STATIC__VOID__STRING);
NANOCLR_NATIVE_DECLARE(get_Server2___STATIC__STRING);
NANOCLR_NATIVE_DECLARE(set_Server2___STATIC__VOID__STRING);
//--//
};
extern const CLR_RT_NativeAssemblyData g_CLR_AssemblyNative_nanoFramework_Networking_Sntp;
#endif //_NF_NETWORKING_SNTP_H_
|
Refactor trace values to work as a proper pass. Before it used to add methods while the pass was running which was a no no. Now it adds the printf method at pass initialization | //===- llvm/Transforms/Instrumentation/TraceValues.h - Tracing ---*- C++ -*--=//
//
// Support for inserting LLVM code to print values at basic block and method
// exits.
//
//===----------------------------------------------------------------------===//
#ifndef LLVM_TRANSFORMS_INSTRUMENTATION_TRACEVALUES_H
#define LLVM_TRANSFORMS_INSTRUMENTATION_TRACEVALUES_H
#include "llvm/Pass.h"
class InsertTraceCode : public Pass {
bool TraceBasicBlockExits, TraceMethodExits;
public:
InsertTraceCode(bool traceBasicBlockExits, bool traceMethodExits)
: TraceBasicBlockExits(traceBasicBlockExits),
TraceMethodExits(traceMethodExits) {}
//--------------------------------------------------------------------------
// Function InsertCodeToTraceValues
//
// Inserts tracing code for all live values at basic block and/or method exits
// as specified by `traceBasicBlockExits' and `traceMethodExits'.
//
static bool doInsertTraceCode(Method *M, bool traceBasicBlockExits,
bool traceMethodExits);
// doPerMethodWork - This method does the work. Always successful.
//
bool doPerMethodWork(Method *M) {
return doInsertTraceCode(M, TraceBasicBlockExits, TraceMethodExits);
}
};
#endif /*LLVM_TRANSFORMS_INSTRUMENTATION_TRACEVALUES_H*/
| //===- llvm/Transforms/Instrumentation/TraceValues.h - Tracing ---*- C++ -*--=//
//
// Support for inserting LLVM code to print values at basic block and method
// exits.
//
//===----------------------------------------------------------------------===//
#ifndef LLVM_TRANSFORMS_INSTRUMENTATION_TRACEVALUES_H
#define LLVM_TRANSFORMS_INSTRUMENTATION_TRACEVALUES_H
#include "llvm/Pass.h"
class Method;
class InsertTraceCode : public Pass {
bool TraceBasicBlockExits, TraceMethodExits;
Method *PrintfMeth;
public:
InsertTraceCode(bool traceBasicBlockExits, bool traceMethodExits)
: TraceBasicBlockExits(traceBasicBlockExits),
TraceMethodExits(traceMethodExits) {}
// Add a prototype for printf if it is not already in the program.
//
bool doPassInitialization(Module *M);
//--------------------------------------------------------------------------
// Function InsertCodeToTraceValues
//
// Inserts tracing code for all live values at basic block and/or method exits
// as specified by `traceBasicBlockExits' and `traceMethodExits'.
//
static bool doit(Method *M, bool traceBasicBlockExits,
bool traceMethodExits, Method *Printf);
// doPerMethodWork - This method does the work. Always successful.
//
bool doPerMethodWork(Method *M) {
return doit(M, TraceBasicBlockExits, TraceMethodExits, PrintfMeth);
}
};
#endif
|
Remove an include which has been upstreamed to ImageDiff.cpp. | // 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 WEBKIT_SUPPORT_WEBKIT_SUPPORT_GFX_H_
#define WEBKIT_SUPPORT_WEBKIT_SUPPORT_GFX_H_
#include <string>
#include <vector>
// TODO(darin): Remove once this #include has been upstreamed to ImageDiff.cpp.
// ImageDiff.cpp expects that PATH_MAX has already been defined :-/
#include <limits.h>
namespace webkit_support {
// Decode a PNG into an RGBA pixel array.
bool DecodePNG(const unsigned char* input, size_t input_size,
std::vector<unsigned char>* output,
int* width, int* height);
// Encode an RGBA pixel array into a PNG.
bool EncodeRGBAPNG(const unsigned char* input,
int width,
int height,
int row_byte_width,
std::vector<unsigned char>* output);
// Encode an BGRA pixel array into a PNG.
bool EncodeBGRAPNG(const unsigned char* input,
int width,
int height,
int row_byte_width,
bool discard_transparency,
std::vector<unsigned char>* output);
bool EncodeBGRAPNGWithChecksum(const unsigned char* input,
int width,
int height,
int row_byte_width,
bool discard_transparency,
const std::string& checksum,
std::vector<unsigned char>* output);
} // namespace webkit_support
#endif // WEBKIT_SUPPORT_WEBKIT_SUPPORT_GFX_H_
| // 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 WEBKIT_SUPPORT_WEBKIT_SUPPORT_GFX_H_
#define WEBKIT_SUPPORT_WEBKIT_SUPPORT_GFX_H_
#include <string>
#include <vector>
namespace webkit_support {
// Decode a PNG into an RGBA pixel array.
bool DecodePNG(const unsigned char* input, size_t input_size,
std::vector<unsigned char>* output,
int* width, int* height);
// Encode an RGBA pixel array into a PNG.
bool EncodeRGBAPNG(const unsigned char* input,
int width,
int height,
int row_byte_width,
std::vector<unsigned char>* output);
// Encode an BGRA pixel array into a PNG.
bool EncodeBGRAPNG(const unsigned char* input,
int width,
int height,
int row_byte_width,
bool discard_transparency,
std::vector<unsigned char>* output);
bool EncodeBGRAPNGWithChecksum(const unsigned char* input,
int width,
int height,
int row_byte_width,
bool discard_transparency,
const std::string& checksum,
std::vector<unsigned char>* output);
} // namespace webkit_support
#endif // WEBKIT_SUPPORT_WEBKIT_SUPPORT_GFX_H_
|
Make this test target independent. | // REQUIRES: x86-registered-target
// RUN: %clang -target i386-unknown-linux -masm=intel %s -S -o - | FileCheck --check-prefix=CHECK-INTEL %s
// RUN: %clang -target i386-unknown-linux -masm=att %s -S -o - | FileCheck --check-prefix=CHECK-ATT %s
// RUN: not %clang -target i386-unknown-linux -masm=somerequired %s -S -o - 2>&1 | FileCheck --check-prefix=CHECK-SOMEREQUIRED %s
// REQUIRES: arm-registered-target
// RUN: %clang -target arm-unknown-eabi -masm=intel %s -S -o - 2>&1 | FileCheck --check-prefix=CHECK-ARM %s
int f() {
// CHECK-ATT: movl $0, %eax
// CHECK-INTEL: mov eax, 0
// CHECK-SOMEREQUIRED: error: unsupported argument 'somerequired' to option 'masm='
// CHECK-ARM: warning: argument unused during compilation: '-masm=intel'
return 0;
}
| // RUN: %clang -target i386-unknown-linux -masm=intel -S %s -### 2>&1 | FileCheck --check-prefix=CHECK-INTEL %s
// RUN: %clang -target i386-unknown-linux -masm=att -S %s -### 2>&1 | FileCheck --check-prefix=CHECK-ATT %s
// RUN: %clang -target i386-unknown-linux -S -masm=somerequired %s -### 2>&1 | FileCheck --check-prefix=CHECK-SOMEREQUIRED %s
// RUN: %clang -target arm-unknown-eabi -S -masm=intel %s -### 2>&1 | FileCheck --check-prefix=CHECK-ARM %s
int f() {
// CHECK-INTEL: -x86-asm-syntax=intel
// CHECK-ATT: -x86-asm-syntax=att
// CHECK-SOMEREQUIRED: error: unsupported argument 'somerequired' to option 'masm='
// CHECK-ARM: warning: argument unused during compilation: '-masm=intel'
return 0;
}
|
Add prototype to prevent warning. | #ifndef PYTHON_THREADS
#define PYTHON_THREADS
#ifdef __EMSCRIPTEN__
static inline void init_python_threads() { }
#else
#include "Python.h"
static inline void init_python_threads() { PyEval_InitThreads(); }
#endif
#endif
| #ifndef PYTHON_THREADS
#define PYTHON_THREADS
#ifdef __EMSCRIPTEN__
static inline void init_python_threads(void) { }
#else
#include "Python.h"
static inline void init_python_threads(void) { PyEval_InitThreads(); }
#endif
#endif
|
Stop SkyShell from crashing on startup | // Copyright 2015 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 SKY_SHELL_PLATFORM_VIEW_ANDROID_H_
#define SKY_SHELL_PLATFORM_VIEW_ANDROID_H_
#include "sky/shell/platform_view.h"
struct ANativeWindow;
namespace sky {
namespace shell {
class PlatformViewAndroid : public PlatformView {
public:
static bool Register(JNIEnv* env);
~PlatformViewAndroid() override;
// Called from Java
void Detach(JNIEnv* env, jobject obj);
void SurfaceCreated(JNIEnv* env, jobject obj, jobject jsurface);
void SurfaceDestroyed(JNIEnv* env, jobject obj);
private:
void ReleaseWindow();
ANativeWindow* window_;
DISALLOW_COPY_AND_ASSIGN(PlatformViewAndroid);
};
} // namespace shell
} // namespace sky
#endif // SKY_SHELL_PLATFORM_VIEW_ANDROID_H_
| // Copyright 2015 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 SKY_SHELL_PLATFORM_VIEW_ANDROID_H_
#define SKY_SHELL_PLATFORM_VIEW_ANDROID_H_
#include "sky/shell/platform_view.h"
struct ANativeWindow;
namespace sky {
namespace shell {
class PlatformViewAndroid : public PlatformView {
public:
static bool Register(JNIEnv* env);
~PlatformViewAndroid() override;
// Called from Java
void Detach(JNIEnv* env, jobject obj);
void SurfaceCreated(JNIEnv* env, jobject obj, jobject jsurface);
void SurfaceDestroyed(JNIEnv* env, jobject obj);
private:
void ReleaseWindow();
DISALLOW_COPY_AND_ASSIGN(PlatformViewAndroid);
};
} // namespace shell
} // namespace sky
#endif // SKY_SHELL_PLATFORM_VIEW_ANDROID_H_
|
Include spotify/api.h and request.h instead of sp_opaque.h | #ifndef LIBOPENSPOTIFY_BROWSE_H
#define LIBOPENSPOTIFY_BROWSE_H
#include "buf.h"
#include "sp_opaque.h"
#define BROWSE_RETRY_TIMEOUT 30
int browse_process(sp_session *session, struct request *req);
#endif
| #ifndef LIBOPENSPOTIFY_BROWSE_H
#define LIBOPENSPOTIFY_BROWSE_H
#include <spotify/api.h>
#include "buf.h"
#include "request.h"
#define BROWSE_RETRY_TIMEOUT 30
int browse_process(sp_session *session, struct request *req);
#endif
|
Add a test for octagon | // PARAM: --sets solver td3 --set ana.activated "['base','threadid','threadflag','mallocWrapper','octApron']"
// Example from https://github.com/sosy-lab/sv-benchmarks/blob/master/c/bitvector-regression/signextension-1.c
#include "stdio.h"
#include <assert.h>
int main() {
// This test is a part taken from of 24 13
unsigned short int allbits = -1;
short int signedallbits = allbits;
int signedtosigned = signedallbits;
assert(allbits == 65535);
assert(signedallbits == -1);
assert(signedtosigned == -1);
if (signedtosigned == -1) {
assert(1);
}
return (0);
}
| |
Move this file into public domain; it's too simple to copyright... | /*
* Copyright (c) 2014, 2016 Scott Bennett <scottb@fastmail.com>
*
* Permission to use, copy, modify, and distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#ifndef LOADER_H
#define LOADER_H
#include "bool.h"
bool load(const char * fileName);
#endif /* LOADER_H */
| /*
* Written by Scott Bennett.
* Public domain.
*/
#ifndef LOADER_H
#define LOADER_H
#include "bool.h"
bool load(const char * fileName);
#endif /* LOADER_H */
|
Fix test when isPICDefault() returns false after rCTE352003 | // Ensure compatiblity of UBSan unreachable with ASan in the presence of
// noreturn functions
// RUN: %clang -O2 -fsanitize=address,unreachable %s -emit-llvm -S -o - | FileCheck %s
// REQUIRES: ubsan-asan
void bar(void) __attribute__((noreturn));
void foo() {
bar();
}
// CHECK-LABEL: define void @foo()
// CHECK: call void @__asan_handle_no_return
// CHECK-NEXT: call void @bar
// CHECK-NEXT: call void @__asan_handle_no_return
// CHECK-NEXT: call void @__ubsan_handle_builtin_unreachable
// CHECK-NEXT: unreachable
| // Ensure compatiblity of UBSan unreachable with ASan in the presence of
// noreturn functions
// RUN: %clang -O2 -fPIC -fsanitize=address,unreachable %s -emit-llvm -S -o - | FileCheck %s
// REQUIRES: ubsan-asan
void bar(void) __attribute__((noreturn));
void foo() {
bar();
}
// CHECK-LABEL: define void @foo()
// CHECK: call void @__asan_handle_no_return
// CHECK-NEXT: call void @bar
// CHECK-NEXT: call void @__asan_handle_no_return
// CHECK-NEXT: call void @__ubsan_handle_builtin_unreachable
// CHECK-NEXT: unreachable
|
Add missing 'extern' when declaring NSStringFromSPTPersistentCacheResponseCode in header | /*
* Copyright (c) 2016 Spotify AB.
*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
#import <SPTPersistentCache/SPTPersistentCacheResponse.h>
NSString *NSStringFromSPTPersistentCacheResponseCode(SPTPersistentCacheResponseCode code);
@interface SPTPersistentCacheResponse (Private)
- (instancetype)initWithResult:(SPTPersistentCacheResponseCode)result
error:(NSError *)error
record:(SPTPersistentCacheRecord *)record;
@end
| /*
* Copyright (c) 2016 Spotify AB.
*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
#import <SPTPersistentCache/SPTPersistentCacheResponse.h>
extern NSString *NSStringFromSPTPersistentCacheResponseCode(SPTPersistentCacheResponseCode code);
@interface SPTPersistentCacheResponse (Private)
- (instancetype)initWithResult:(SPTPersistentCacheResponseCode)result
error:(NSError *)error
record:(SPTPersistentCacheRecord *)record;
@end
|
Add explicit specifier to Simulator ctor | /*
* simulator.h - interface for simulator
* Copyright 2018 MIPT-MIPS
*/
#ifndef SIMULATOR_H
#define SIMULATOR_H
#include <memory.h>
#include <infra/types.h>
#include <infra/log.h>
class Simulator : public Log {
public:
Simulator( bool log = false) : Log( log) {}
virtual void run(const std::string& tr, uint64 instrs_to_run) = 0;
static std::unique_ptr<Simulator> create_simulator(const std::string& isa, bool functional_only, bool log);
};
#endif // SIMULATOR_H
| /*
* simulator.h - interface for simulator
* Copyright 2018 MIPT-MIPS
*/
#ifndef SIMULATOR_H
#define SIMULATOR_H
#include <memory.h>
#include <infra/types.h>
#include <infra/log.h>
class Simulator : public Log {
public:
explicit Simulator( bool log = false) : Log( log) {}
virtual void run(const std::string& tr, uint64 instrs_to_run) = 0;
static std::unique_ptr<Simulator> create_simulator(const std::string& isa, bool functional_only, bool log);
};
#endif // SIMULATOR_H
|
Add a structure defintion for the id prom contents. | /*
* Copyright (c) 1993 Adam Glass
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by Adam Glass.
* 4. The name of the Author may not be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY Adam Glass ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* from: NetBSD: idprom.h,v 1.2 1998/09/05 23:57:26 eeh Exp
*
* $FreeBSD$
*/
#ifndef _MACHINE_IDPROM_H_
#define _MACHINE_IDPROM_H_
/*
* ID prom format. The ``host id'' is set up by taking the machine
* ID as the top byte and the hostid field as the remaining three.
* The id_xxx0 field appears to contain some other number. The id_xxx1
* contains a bunch of 00's and a5's on my machines, suggesting it is
* not actually used. The checksum seems to include them, however.
*/
struct idprom {
u_char id_format; /* format identifier (= 1) */
u_char id_machine; /* machine type (see param.h) */
u_char id_ether[6]; /* ethernet address */
int id_date; /* date of manufacture */
u_char id_hostid[3]; /* ``host id'' bytes */
u_char id_checksum; /* xor of everything else */
char id_undef[16]; /* undefined */
};
#define ID_SUN4_100 0x22
#define ID_SUN4_200 0x21
#define ID_SUN4_300 0x23
#define ID_SUN4_400 0x24
#define IDPROM_VERSION 1
#endif /* !_MACHINE_IDPROM_H_ */
| |
Make hex string buffer guarantee a null terminator | #include <stdio.h>
#include "memdumper.h"
static const char HEX[] = {
'0', '1', '2', '3',
'4', '5', '6', '7',
'8', '9', 'A', 'B',
'C', 'D', 'E', 'F',
};
void byteToHex(char byte, char* output) {
output[0] = HEX[(byte >> 4) & 0x0F];
output[1] = HEX[byte & 0x0F];
}
void dumpMemoryAsHex(char* data, char* dataEnd, int count) {
static char hexbuff[2];
int i = 0;
while(i < count) {
if(&data[i] >= dataEnd)
break;
byteToHex(data[i++], hexbuff);
printf("%s ", hexbuff);
}
/* Print padding */
for( ; i < count; i++) {
printf(".. ");
}
}
void dumpMemoryAsASCII(char* data, char* dataEnd, int count) {
int i = 0;
while(i < count) {
char c;
if(&data[i] >= dataEnd)
break;
c = data[i++];
printf("%c", (c < ' ' || c == (char)(127)) ? '.' : c);
}
/* Print padding */
for( ; i < count; i++) {
printf(".");
}
}
| #include <stdio.h>
#include "memdumper.h"
static const char HEX[] = {
'0', '1', '2', '3',
'4', '5', '6', '7',
'8', '9', 'A', 'B',
'C', 'D', 'E', 'F',
};
void byteToHex(char byte, char* output) {
output[0] = HEX[(byte >> 4) & 0x0F];
output[1] = HEX[byte & 0x0F];
}
void dumpMemoryAsHex(char* data, char* dataEnd, int count) {
static char hexbuff[3] = {0, 0, 0};
int i = 0;
while(i < count) {
if(&data[i] >= dataEnd)
break;
byteToHex(data[i++], hexbuff);
printf("%s ", hexbuff);
}
/* Print padding */
for( ; i < count; i++) {
printf(".. ");
}
}
void dumpMemoryAsASCII(char* data, char* dataEnd, int count) {
int i = 0;
while(i < count) {
char c;
if(&data[i] >= dataEnd)
break;
c = data[i++];
printf("%c", (c < ' ' || c == (char)(127)) ? '.' : c);
}
/* Print padding */
for( ; i < count; i++) {
printf(".");
}
}
|
Add more methods to be more value-like | //===-- llvm/Support/ValueHolder.h - Wrapper for Value's --------*- C++ -*-===//
//
// This class defines a simple subclass of User, which keeps a pointer to a
// Value, which automatically updates when Value::replaceAllUsesWith is called.
// This is useful when you have pointers to Value's in your pass, but the
// pointers get invalidated when some other portion of the algorithm is
// replacing Values with other Values.
//
//===----------------------------------------------------------------------===//
#ifndef LLVM_SUPPORT_VALUEHOLDER_H
#define LLVM_SUPPORT_VALUEHOLDER_H
#include "llvm/User.h"
struct ValueHolder : public User {
ValueHolder(Value *V = 0);
// Getters...
const Value *get() const { return getOperand(0); }
operator const Value*() const { return getOperand(0); }
Value *get() { return getOperand(0); }
operator Value*() { return getOperand(0); }
// Setters...
const ValueHolder &operator=(Value *V) {
setOperand(0, V);
return *this;
}
virtual void print(std::ostream& OS) const {
OS << "ValueHolder";
}
};
#endif
| //===-- llvm/Support/ValueHolder.h - Wrapper for Value's --------*- C++ -*-===//
//
// This class defines a simple subclass of User, which keeps a pointer to a
// Value, which automatically updates when Value::replaceAllUsesWith is called.
// This is useful when you have pointers to Value's in your pass, but the
// pointers get invalidated when some other portion of the algorithm is
// replacing Values with other Values.
//
//===----------------------------------------------------------------------===//
#ifndef LLVM_SUPPORT_VALUEHOLDER_H
#define LLVM_SUPPORT_VALUEHOLDER_H
#include "llvm/User.h"
struct ValueHolder : public User {
ValueHolder(Value *V = 0);
ValueHolder(const ValueHolder &VH) : User(VH.getType(), Value::TypeVal) {}
// Getters...
const Value *get() const { return getOperand(0); }
operator const Value*() const { return getOperand(0); }
Value *get() { return getOperand(0); }
operator Value*() { return getOperand(0); }
// Setters...
const ValueHolder &operator=(Value *V) {
setOperand(0, V);
return *this;
}
const ValueHolder &operator=(ValueHolder &VH) {
setOperand(0, VH);
return *this;
}
virtual void print(std::ostream& OS) const {
OS << "ValueHolder";
}
};
#endif
|
Fix unresolved symbol when pkcs11 is disabled | /* GIO - GLib Input, Output and Streaming Library
*
* Copyright 2010 Red Hat, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General
* Public License along with this library; if not, see
* <http://www.gnu.org/licenses/>.
*/
#include "config.h"
#include <gio/gio.h>
#include "gtlsbackend-gnutls.h"
#include "gtlsbackend-gnutls-pkcs11.h"
void
g_io_module_load (GIOModule *module)
{
g_tls_backend_gnutls_register (module);
g_tls_backend_gnutls_pkcs11_register (module);
}
void
g_io_module_unload (GIOModule *module)
{
}
gchar **
g_io_module_query (void)
{
gchar *eps[] = {
G_TLS_BACKEND_EXTENSION_POINT_NAME,
NULL
};
return g_strdupv (eps);
}
| /* GIO - GLib Input, Output and Streaming Library
*
* Copyright 2010 Red Hat, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General
* Public License along with this library; if not, see
* <http://www.gnu.org/licenses/>.
*/
#include "config.h"
#include <gio/gio.h>
#include "gtlsbackend-gnutls.h"
#include "gtlsbackend-gnutls-pkcs11.h"
void
g_io_module_load (GIOModule *module)
{
g_tls_backend_gnutls_register (module);
#ifdef HAVE_PKCS11
g_tls_backend_gnutls_pkcs11_register (module);
#endif
}
void
g_io_module_unload (GIOModule *module)
{
}
gchar **
g_io_module_query (void)
{
gchar *eps[] = {
G_TLS_BACKEND_EXTENSION_POINT_NAME,
NULL
};
return g_strdupv (eps);
}
|
Use correct cffi type for 'value' | #ifndef NME_BYTE_ARRAY_H
#define NME_BYTE_ARRAY_H
#include <nme/Object.h>
#include <nme/QuickVec.h>
#include "Utils.h"
namespace nme
{
// If you put this structure on the stack, then you do not have to worry about GC.
// If you store this in a heap structure, then you will need to use GC roots for mValue...
struct ByteArray
{
ByteArray(int inSize);
ByteArray(const ByteArray &inRHS);
ByteArray();
ByteArray(struct _value *Value);
ByteArray(const QuickVec<unsigned char> &inValue);
ByteArray(const char *inResourceName);
void Resize(int inSize);
int Size() const;
unsigned char *Bytes();
const unsigned char *Bytes() const;
bool Ok() { return mValue!=0; }
struct _value *mValue;
static ByteArray FromFile(const OSChar *inFilename);
#ifdef HX_WINDOWS
static ByteArray FromFile(const char *inFilename);
#endif
};
#ifdef ANDROID
ByteArray AndroidGetAssetBytes(const char *);
struct FileInfo
{
int fd;
off_t offset;
off_t length;
};
FileInfo AndroidGetAssetFD(const char *);
#endif
}
#endif
| #ifndef NME_BYTE_ARRAY_H
#define NME_BYTE_ARRAY_H
#include <nme/Object.h>
#include <nme/QuickVec.h>
#include "Utils.h"
#include <hx/CFFI.h>
namespace nme
{
// If you put this structure on the stack, then you do not have to worry about GC.
// If you store this in a heap structure, then you will need to use GC roots for mValue...
struct ByteArray
{
ByteArray(int inSize);
ByteArray(const ByteArray &inRHS);
ByteArray();
ByteArray(value Value);
ByteArray(const QuickVec<unsigned char> &inValue);
ByteArray(const char *inResourceName);
void Resize(int inSize);
int Size() const;
unsigned char *Bytes();
const unsigned char *Bytes() const;
bool Ok() { return mValue!=0; }
value mValue;
static ByteArray FromFile(const OSChar *inFilename);
#ifdef HX_WINDOWS
static ByteArray FromFile(const char *inFilename);
#endif
};
#ifdef ANDROID
ByteArray AndroidGetAssetBytes(const char *);
struct FileInfo
{
int fd;
off_t offset;
off_t length;
};
FileInfo AndroidGetAssetFD(const char *);
#endif
}
#endif
|
Add a missing config header | C $Header$
C $Name$
C CPP options file for GM/Redi package
C
C Use this file for selecting options within the GM/Redi package
C
#ifndef GMREDI_OPTIONS_H
#define GMREDI_OPTIONS_H
#include "PACKAGES_CONFIG.h"
#ifdef ALLOW_GMREDI
#include "CPP_OPTIONS.h"
C Designed to simplify the Ajoint code:
C exclude the clipping/tapering part of the code that is not used
#define GM_EXCLUDE_CLIPPING
#define GM_EXCLUDE_AC02_TAP
#define GM_EXCLUDE_FM07_TAP
#undef GM_EXCLUDE_TAPERING
C This allows to use Visbeck et al formulation to compute K_GM+Redi
#undef GM_VISBECK_VARIABLE_K
C This allows the leading diagonal (top two rows) to be non-unity
C (a feature required when tapering adiabatically).
#define GM_NON_UNITY_DIAGONAL
C Allows to use different values of K_GM and K_Redi ; also to
C be used with the advective form (Bolus velocity) of GM
#define GM_EXTRA_DIAGONAL
C Allows to use the advective form (Bolus velocity) of GM
C instead of the Skew-Flux form (=default)
#define GM_BOLUS_ADVEC
#endif /* ALLOW_GMREDI */
#endif /* GMREDI_OPTIONS_H */
| |
Remove phases command line from SV-COMP observer example | extern void __VERIFIER_error() __attribute__ ((__noreturn__));
extern int __VERIFIER_nondet_int();
int main()
{
int x, y;
if (__VERIFIER_nondet_int())
{
x = 0;
y = 1;
}
else
{
x = 1;
y = 0;
}
// if (!(x + y == 1))
if (x + y != 1)
__VERIFIER_error();
return 0;
}
// ./goblint --enable ana.sv-comp --enable ana.wp --enable witness.uncil --disable ana.int.def_exc --enable ana.int.interval --set ana.activated '["base"]' --set phases '[{}, {"ana": {"activated": ["base", "observer"], "path_sens": ["observer"]}}]' --html tests/sv-comp/observer/path_nofun_true-unreach-call.c
// ./goblint --enable ana.sv-comp --enable ana.wp --enable witness.uncil --disable ana.int.def_exc --enable ana.int.interval --set ana.activated '["base"]' --html tests/sv-comp/observer/path_nofun_true-unreach-call.c
| extern void __VERIFIER_error() __attribute__ ((__noreturn__));
extern int __VERIFIER_nondet_int();
int main()
{
int x, y;
if (__VERIFIER_nondet_int())
{
x = 0;
y = 1;
}
else
{
x = 1;
y = 0;
}
// if (!(x + y == 1))
if (x + y != 1)
__VERIFIER_error();
return 0;
}
// ./goblint --enable ana.sv-comp --enable ana.wp --enable witness.uncil --disable ana.int.def_exc --enable ana.int.interval --set ana.activated '["base"]' --html tests/sv-comp/observer/path_nofun_true-unreach-call.c
|
Modify constant buffer init method template type name | #pragma once
#include "Rendering/BufferDX11.h"
#include "Rendering/ShaderDX11.h"
namespace Mile
{
class MEAPI ConstantBufferDX11 : public BufferDX11
{
public:
ConstantBufferDX11(RendererDX11* renderer);
~ConstantBufferDX11();
bool Init(unsigned int size);
template <typename Buffer>
bool Init()
{
return Init(sizeof(Buffer));
}
virtual ERenderResourceType GetResourceType() const override { return ERenderResourceType::ConstantBuffer; }
virtual void* Map(ID3D11DeviceContext& deviceContext) override;
template <typename BufferType>
BufferType* Map(ID3D11DeviceContext& deviceContext)
{
return reinterpret_cast<BufferType*>(Map(deviceContext));
}
virtual bool UnMap(ID3D11DeviceContext& deviceContext) override;
bool Bind(ID3D11DeviceContext& deviceContext, unsigned int slot, EShaderType shaderType);
void Unbind(ID3D11DeviceContext& deviceContext);
FORCEINLINE bool IsBound() const { return m_bIsBound; }
FORCEINLINE unsigned int GetBoundSlot() const { return m_boundSlot; }
FORCEINLINE EShaderType GetBoundShaderType() const { return m_boundShader; }
private:
bool m_bIsBound;
unsigned int m_boundSlot;
EShaderType m_boundShader;
};
} | #pragma once
#include "Rendering/BufferDX11.h"
#include "Rendering/ShaderDX11.h"
namespace Mile
{
class MEAPI ConstantBufferDX11 : public BufferDX11
{
public:
ConstantBufferDX11(RendererDX11* renderer);
~ConstantBufferDX11();
bool Init(unsigned int size);
template <typename BufferType>
bool Init()
{
return Init(sizeof(BufferType));
}
virtual ERenderResourceType GetResourceType() const override { return ERenderResourceType::ConstantBuffer; }
virtual void* Map(ID3D11DeviceContext& deviceContext) override;
template <typename BufferType>
BufferType* Map(ID3D11DeviceContext& deviceContext)
{
return reinterpret_cast<BufferType*>(Map(deviceContext));
}
virtual bool UnMap(ID3D11DeviceContext& deviceContext) override;
bool Bind(ID3D11DeviceContext& deviceContext, unsigned int slot, EShaderType shaderType);
void Unbind(ID3D11DeviceContext& deviceContext);
FORCEINLINE bool IsBound() const { return m_bIsBound; }
FORCEINLINE unsigned int GetBoundSlot() const { return m_boundSlot; }
FORCEINLINE EShaderType GetBoundShaderType() const { return m_boundShader; }
private:
bool m_bIsBound;
unsigned int m_boundSlot;
EShaderType m_boundShader;
};
} |
Add getters for window constants | #pragma once
#include <SDL2/SDL.h>
#include <string>
class Application
{
private:
// Main loop flag
bool quit;
// The window
SDL_Window* window;
// The window renderer
SDL_Renderer* renderer;
// The background color
SDL_Color backgroundColor;
// Window properties
std::string title;
unsigned int windowWidth;
unsigned int windowHeight;
bool isFullscreen;
bool init();
void close();
void draw();
protected:
// Event called after initialized
virtual void on_init();
// Event called when before drawing the screen in the loop
virtual void on_update();
// Event called when drawing the screen in the loop
virtual void on_draw(SDL_Renderer* renderer);
void set_background_color(SDL_Color color);
public:
Application();
Application(std::string title);
Application(std::string title, unsigned int width, unsigned int height);
Application(std::string title, unsigned int width, unsigned int height, bool fullscreen);
~Application();
void Run();
};
| #pragma once
#include <SDL2/SDL.h>
#include <string>
class Application
{
private:
// Main loop flag
bool quit;
// The window
SDL_Window* window;
// The window renderer
SDL_Renderer* renderer;
// The background color
SDL_Color backgroundColor;
// Window properties
std::string title;
unsigned int windowWidth;
unsigned int windowHeight;
bool isFullscreen;
bool init();
void close();
void draw();
protected:
// Event called after initialized
virtual void on_init();
// Event called when before drawing the screen in the loop
virtual void on_update();
// Event called when drawing the screen in the loop
virtual void on_draw(SDL_Renderer* renderer);
void set_background_color(SDL_Color color);
unsigned int get_window_height()
{
return windowHeight;
}
unsigned int get_window_width()
{
return windowWidth;
}
bool is_fullscreen()
{
return isFullscreen;
}
public:
Application();
Application(std::string title);
Application(std::string title, unsigned int width, unsigned int height);
Application(std::string title, unsigned int width, unsigned int height, bool fullscreen);
~Application();
void Run();
};
|
Add copyright and license header. | #import <Cocoa/Cocoa.h>
@interface CreamMonkey : NSObject {
}
@end
| /*
* Copyright (c) 2006 KATO Kazuyoshi <kzys@8-p.info>
* This source code is released under the MIT license.
*/
#import <Cocoa/Cocoa.h>
@interface CreamMonkey : NSObject {
}
@end
|
Change to private Qt slots. | #ifndef QTVMBVIEWER_H
#define QTVMBVIEWER_H
// Qt dependencies
#include <QWidget>
#include <QLabel>
#include <QSlider>
// Local dependency
#include "VmbCamera.h"
// Qt widget to display the images from an Allied Vision camera through the Vimba SDK
class QtVmbViewer : public QWidget {
// Macro to use Qt signals and slots
Q_OBJECT
// Public members
public :
// Constructor
QtVmbViewer( QWidget *parent = 0 );
// Destructor
~QtVmbViewer();
// Qt slots
public slots :
// Slot to get the image from the camera and update the widget
void UpdateImage();
// Slot to update the camera exposure
void SetExposure();
// Private members
private :
// Label to display the camera image
QLabel* label;
// Slider to set the camera exposure time
QSlider* slider;
// Allied Vision camera
VmbCamera* camera;
};
#endif // QTVMBVIEWER_H
| #ifndef QTVMBVIEWER_H
#define QTVMBVIEWER_H
// Qt dependencies
#include <QWidget>
#include <QLabel>
#include <QSlider>
// Local dependency
#include "VmbCamera.h"
// Qt widget to display the images from an Allied Vision camera through the Vimba SDK
class QtVmbViewer : public QWidget {
// Macro to use Qt signals and slots
Q_OBJECT
// Public members
public :
// Constructor
QtVmbViewer( QWidget *parent = 0 );
// Destructor
~QtVmbViewer();
// Qt slots
private slots :
// Slot to get the image from the camera and update the widget
void UpdateImage();
// Slot to update the camera exposure
void SetExposure();
// Private members
private :
// Label to display the camera image
QLabel* label;
// Slider to set the camera exposure time
QSlider* slider;
// Allied Vision camera
VmbCamera* camera;
};
#endif // QTVMBVIEWER_H
|
Use @import in Objective-C header | /* Faraday Faraday.h
*
* Copyright © 2015, 2016, Roy Ratcliffe, Pioneering Software, United Kingdom
*
* 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, EITHER
* EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. 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>
FOUNDATION_EXPORT double FaradayVersionNumber;
FOUNDATION_EXPORT const unsigned char FaradayVersionString[];
| /* Faraday Faraday.h
*
* Copyright © 2015, 2016, Roy Ratcliffe, Pioneering Software, United Kingdom
*
* 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, EITHER
* EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. 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_EXPORT double FaradayVersionNumber;
FOUNDATION_EXPORT const unsigned char FaradayVersionString[];
|
Test uint64_t -> long double | #include "src/math/reinterpret.h"
#include <stdint.h>
#include <assert.h>
uint64_t __fixunstfdi(long double);
static _Bool run(uint64_t a)
{
return a == __fixunstfdi(a);
}
int main(void)
{
const uint64_t delta = 0x0008D46BA87B5A22;
for (uint64_t i = 0x3FFFFFFFFFFFFFFF; i < 0x4340000000000000; i += delta)
assert(run(reinterpret(double, i)));
for (uint64_t i = 0; i <= UINT64_MAX / delta; ++i)
assert(run(i * delta));
}
| |
Add the ocl_defines header file into libocl | #ifndef __OCL_COMMON_DEF_H__
#define __OCL_COMMON_DEF_H__
#define __OPENCL_VERSION__ 110
#define __CL_VERSION_1_0__ 100
#define __CL_VERSION_1_1__ 110
#define __ENDIAN_LITTLE__ 1
#define __IMAGE_SUPPORT__ 1
#define __kernel_exec(X, TYPE) __kernel __attribute__((work_group_size_hint(X,1,1))) \
__attribute__((vec_type_hint(TYPE)))
#define kernel_exec(X, TYPE) __kernel_exec(X, TYPE)
#define cl_khr_global_int32_base_atomics
#define cl_khr_global_int32_extended_atomics
#define cl_khr_local_int32_base_atomics
#define cl_khr_local_int32_extended_atomics
#define cl_khr_byte_addressable_store
#define cl_khr_icd
#define cl_khr_gl_sharing
#endif /* end of __OCL_COMMON_DEF_H__ */
| |
Make the varianttypes work more pleasantly - now you simply include the file, and stuff happens magically! (that is, Eigen::Vector3d is registered as a QVariant now... more to come!) | /*
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
///TODO: Make this something entirely different... QVariant wrapped Eigen types, wooh! ;)
#ifndef GLUON_VARIANTTYPES
#define GLUON_VARIANTTYPES
#ifndef EIGEN_CORE_H
#warning This needs to be included AFTER Eigen and friends
#endif
#include <QVariant>
#include <Eigen/Geometry>
Q_DECLARE_METATYPE(Eigen::Vector3d)
//qRegisterMetatype<Eigen::Vector3d>("Eigen::Vector3d");
#endif | /*
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
///TODO: Make this something entirely different... QVariant wrapped Eigen types, wooh! ;)
#ifndef GLUON_VARIANTTYPES
#define GLUON_VARIANTTYPES
#include <QVariant>
#include <QMetaType>
#include <Eigen/Geometry>
Q_DECLARE_METATYPE(Eigen::Vector3d)
namespace
{
struct GluonVariantTypes
{
public:
GluonVariantTypes()
{
qRegisterMetaType<Eigen::Vector3d>("Eigen::Vector3d");
}
};
GluonVariantTypes gluonVariantTypes;
}
#endif |
Add global SCU internal header file | /*
* Copyright (c) 2012 Israel Jacques
* See LICENSE for details.
*
* Israel Jacques <mrko@eecs.berkeley.edu>
*/
#ifndef _SCU_INTERNAL_H_
#define _SCU_INTERNAL_H_
#include <inttypes.h>
#include <stddef.h>
/* Write and read directly to specified address */
#define MEMORY_WRITE(t, x, y) (*(volatile uint ## t ## _t *)(x) = (y))
#define MEMORY_READ(t, x) (*(volatile uint ## t ## _t *)(x))
/* Macros specific for processor */
#define SCU(x) (0x25FE0000 + (x))
#define CS0(x) (0x22400000 + (x))
#define CS1(x) (0x24000000 + (x))
#define DUMMY(x) (0x25000000 + (x))
/* SCU */
#define D0R 0x0000
#define D0W 0x0004
#define D0C 0x0008
#define D0AD 0x000C
#define D0EN 0x0010
#define D0MD 0x0014
#define D1R 0x0020
#define D1W 0x0024
#define D1C 0x0028
#define D1AD 0x002C
#define D1EN 0x0030
#define D1MD 0x0034
#define D2R 0x0040
#define D2W 0x0044
#define D2C 0x0048
#define D2AD 0x004C
#define D2EN 0x0050
#define D2MD 0x0054
#define DSTA 0x007C
#define PPAF 0x0080
#define PPD 0x0084
#define PDA 0x0088
#define PDD 0x008C
#define T0C 0x0090
#define T1S 0x0094
#define T1MD 0x0098
#define IMS 0x00A0
#define IST 0x00A4
#define AIACK 0x00A8
#define ASR0 0x00B0
#define ASR1 0x00B4
#define AREF 0x00B8
#define RSEL 0x00C4
#define VER 0x00C8
#endif /* !_SCU_INTERNAL_H_ */
| |
Make comment conform to coding standard... | /******************************************************************************
globus_rsl_assist.h
Description:
This header contains the interface prototypes for the rsl_assist library.
CVS Information:
$Source$
$Date$
$Revision$
$Author$
******************************************************************************/
#ifndef _GLOBUS_RSL_ASSIST_INCLUDE_GLOBUS_RSL_ASSIST_H_
#define _GLOBUS_RSL_ASSIST_INCLUDE_GLOBUS_RSL_ASSIST_H_
#ifndef EXTERN_C_BEGIN
#ifdef __cplusplus
#define EXTERN_C_BEGIN extern "C" {
#define EXTERN_C_END }
#else
#define EXTERN_C_BEGIN
#define EXTERN_C_END
#endif
#endif
#include "globus_common.h"
#include "globus_rsl.h"
char*
globus_rsl_assist_get_rm_contact(char* resource);
int
globus_rsl_assist_replace_manager_name(globus_rsl_t * rsl);
#endif
| /*
* globus_rsl_assist.h
*
* Description:
*
* This header contains the interface prototypes for the rsl_assist library.
*
* CVS Information:
*
* $Source$
* $Date$
* $Revision$
* $Author$
******************************************************************************/
#ifndef _GLOBUS_RSL_ASSIST_INCLUDE_GLOBUS_RSL_ASSIST_H_
#define _GLOBUS_RSL_ASSIST_INCLUDE_GLOBUS_RSL_ASSIST_H_
#ifndef EXTERN_C_BEGIN
#ifdef __cplusplus
#define EXTERN_C_BEGIN extern "C" {
#define EXTERN_C_END }
#else
#define EXTERN_C_BEGIN
#define EXTERN_C_END
#endif
#endif
#include "globus_common.h"
#include "globus_rsl.h"
char*
globus_rsl_assist_get_rm_contact(char* resource);
int
globus_rsl_assist_replace_manager_name(globus_rsl_t * rsl);
#endif
|
Remove UNKNOWN annotation from assert that now succeeds | // PARAM: --enable ana.int.interval --enable ana.int.def_exc
// issue #120
#include <assert.h>
int main() {
// should be LP64
unsigned long n = 16;
unsigned long size = 4912;
assert(!(0xffffffffffffffffUL / size < n)); // UNKNOWN (for now)
} | // PARAM: --enable ana.int.interval --enable ana.int.def_exc
// issue #120
#include <assert.h>
int main() {
// should be LP64
unsigned long n = 16;
unsigned long size = 4912;
assert(!(0xffffffffffffffffUL / size < n));
}
|
Add comment for document::DocumentTypeRepoFactory::make method. | // Copyright 2018 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#pragma once
#include <memory>
#include <mutex>
#include <map>
namespace document {
namespace internal {
class InternalDocumenttypesType;
}
class DocumentTypeRepo;
/*
* Factory class for document type repos. Same instance is returned
* for equal config.
*/
class DocumentTypeRepoFactory {
using DocumenttypesConfig = const internal::InternalDocumenttypesType;
struct DocumentTypeRepoEntry {
std::weak_ptr<const DocumentTypeRepo> repo;
std::unique_ptr<const DocumenttypesConfig> config;
DocumentTypeRepoEntry(std::weak_ptr<const DocumentTypeRepo> repo_in,
std::unique_ptr<const DocumenttypesConfig> config_in)
: repo(std::move(repo_in)),
config(std::move(config_in))
{
}
};
using DocumentTypeRepoMap = std::map<const void *, DocumentTypeRepoEntry>;
class Deleter;
static std::mutex _mutex;
static DocumentTypeRepoMap _repos;
static void deleteRepo(DocumentTypeRepo *repoRawPtr) noexcept;
public:
static std::shared_ptr<const DocumentTypeRepo> make(const DocumenttypesConfig &config);
};
}
| // Copyright 2018 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#pragma once
#include <memory>
#include <mutex>
#include <map>
namespace document {
namespace internal {
class InternalDocumenttypesType;
}
class DocumentTypeRepo;
/*
* Factory class for document type repos. Same instance is returned
* for equal config.
*/
class DocumentTypeRepoFactory {
using DocumenttypesConfig = const internal::InternalDocumenttypesType;
struct DocumentTypeRepoEntry {
std::weak_ptr<const DocumentTypeRepo> repo;
std::unique_ptr<const DocumenttypesConfig> config;
DocumentTypeRepoEntry(std::weak_ptr<const DocumentTypeRepo> repo_in,
std::unique_ptr<const DocumenttypesConfig> config_in)
: repo(std::move(repo_in)),
config(std::move(config_in))
{
}
};
using DocumentTypeRepoMap = std::map<const void *, DocumentTypeRepoEntry>;
class Deleter;
static std::mutex _mutex;
static DocumentTypeRepoMap _repos;
static void deleteRepo(DocumentTypeRepo *repoRawPtr) noexcept;
public:
/*
* Since same instance is returned for equal config, we return a shared
* pointer to a const repo. The repo should be considered immutable.
*/
static std::shared_ptr<const DocumentTypeRepo> make(const DocumenttypesConfig &config);
};
}
|
Correct case of include file to build on Linux. | #include "FreeRTOS.h"
#include "Semphr.h"
#include "task.h"
/* The interrupt entry point. */
void vEMAC_ISR_Wrapper( void ) __attribute__((naked));
/* The handler that does the actual work. */
void vEMAC_ISR_Handler( void );
extern xSemaphoreHandle xEMACSemaphore;
void vEMAC_ISR_Handler( void )
{
portBASE_TYPE xHigherPriorityTaskWoken = pdFALSE;
/* Clear the interrupt. */
MAC_INTCLEAR = 0xffff;
VICVectAddr = 0;
/* Ensure the uIP task is not blocked as data has arrived. */
xSemaphoreGiveFromISR( xEMACSemaphore, &xHigherPriorityTaskWoken );
if( xHigherPriorityTaskWoken )
{
/* Giving the semaphore woke a task. */
portYIELD_FROM_ISR();
}
}
/*-----------------------------------------------------------*/
void vEMAC_ISR_Wrapper( void )
{
/* Save the context of the interrupted task. */
portSAVE_CONTEXT();
/* Call the handler. This must be a separate function unless you can
guarantee that no stack will be used. */
vEMAC_ISR_Handler();
/* Restore the context of whichever task is going to run next. */
portRESTORE_CONTEXT();
}
| #include "FreeRTOS.h"
#include "semphr.h"
#include "task.h"
/* The interrupt entry point. */
void vEMAC_ISR_Wrapper( void ) __attribute__((naked));
/* The handler that does the actual work. */
void vEMAC_ISR_Handler( void );
extern xSemaphoreHandle xEMACSemaphore;
void vEMAC_ISR_Handler( void )
{
portBASE_TYPE xHigherPriorityTaskWoken = pdFALSE;
/* Clear the interrupt. */
MAC_INTCLEAR = 0xffff;
VICVectAddr = 0;
/* Ensure the uIP task is not blocked as data has arrived. */
xSemaphoreGiveFromISR( xEMACSemaphore, &xHigherPriorityTaskWoken );
if( xHigherPriorityTaskWoken )
{
/* Giving the semaphore woke a task. */
portYIELD_FROM_ISR();
}
}
/*-----------------------------------------------------------*/
void vEMAC_ISR_Wrapper( void )
{
/* Save the context of the interrupted task. */
portSAVE_CONTEXT();
/* Call the handler. This must be a separate function unless you can
guarantee that no stack will be used. */
vEMAC_ISR_Handler();
/* Restore the context of whichever task is going to run next. */
portRESTORE_CONTEXT();
}
|
Improve comments in the header file | //
// SloppySwiper.h
//
// Created by Arkadiusz on 29-05-14.
//
#import <Foundation/Foundation.h>
@interface SloppySwiper : NSObject <UINavigationControllerDelegate>
// Designated initializer if the class isn't set in the Interface Builder.
- (instancetype)initWithNavigationController:(UINavigationController *)navigationController;
@end
| //
// SloppySwiper.h
//
// Created by Arkadiusz on 29-05-14.
//
#import <Foundation/Foundation.h>
@interface SloppySwiper : NSObject <UINavigationControllerDelegate>
/// Gesture recognizer used to recognize swiping to the right.
@property (weak, nonatomic) UIPanGestureRecognizer *panRecognizer;
/// Designated initializer if the class isn't used from the Interface Builder.
- (instancetype)initWithNavigationController:(UINavigationController *)navigationController;
@end
|
Fix incorrect information in comment | /**
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
#import <UIKit/UIKit.h>
#import <React/RCTViewComponentView.h>
NS_ASSUME_NONNULL_BEGIN
/**
* UIView class for root <ShimmeringView> component.
*/
@interface RCTActivityIndicatorViewComponentView : RCTViewComponentView
@end
NS_ASSUME_NONNULL_END
| /**
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
#import <UIKit/UIKit.h>
#import <React/RCTViewComponentView.h>
NS_ASSUME_NONNULL_BEGIN
/**
* UIView class for root <ActivityIndicator> component.
*/
@interface RCTActivityIndicatorViewComponentView : RCTViewComponentView
@end
NS_ASSUME_NONNULL_END
|
Add test of IF statement | /*
name: TEST006
description: Basic test for if
output:
G1 M c
F1
X2 F1 main
G2 F1 main {
-
j L2 #I0 #I0 =I
yI #I1
j L3
L2
j L4 #I0 #I0 =I
j L5
L4
j L6 #I1 #I0 =I
j L7 G1 MI #I0 =I
yI #I1
j L8
L7
yI #I0
L8
j L9
L6
yI #I1
L9
L5
L3
yI #I1
}
*/
char c;
int
main()
{
if(0) {
return 1;
} else if(0) {
/* empty */
} else {
if(1) {
if(c)
return 1;
else
return 0;
} else {
return 1;
}
}
return 1;
}
| |
Add test case for nested creation of tasks | // RUN: %libomp-compile-and-run
#include <stdio.h>
#include <omp.h>
#include "omp_my_sleep.h"
/*
* This test creates tasks that themselves create a new task.
* The runtime has to take care that they are correctly freed.
*/
int main()
{
#pragma omp task
{
#pragma omp task
{
my_sleep( 0.1 );
}
}
#pragma omp parallel num_threads(2)
{
#pragma omp single
#pragma omp task
{
#pragma omp task
{
my_sleep( 0.1 );
}
}
}
printf("pass\n");
return 0;
}
| |
Add better linux support by using the right macro. This still should be autoconfiscated, but for now this is sufficient. | //===-- include/Support/DataTypes.h - Define fixed size types ----*- C++ -*--=//
//
// This file contains definitions to figure out the size of _HOST_ data types.
// This file is important because different host OS's define different macros,
// which makes portability tough. This file exports the following definitions:
//
// LITTLE_ENDIAN: is #define'd if the host is little endian
// int64_t : is a typedef for the signed 64 bit system type
// uint64_t : is a typedef for the unsigned 64 bit system type
//
// No library is required when using these functinons.
//
//===----------------------------------------------------------------------===//
// TODO: This file sucks. Not only does it not work, but this stuff should be
// autoconfiscated anyways. Major FIXME
#ifndef LLVM_SUPPORT_DATATYPES_H
#define LLVM_SUPPORT_DATATYPES_H
#include <inttypes.h>
#ifdef LINUX
#define __STDC_LIMIT_MACROS 1
#include <stdint.h> // Defined by ISO C 99
#include <endian.h>
#else
#include <sys/types.h>
#ifdef _LITTLE_ENDIAN
#define LITTLE_ENDIAN 1
#endif
#endif
#endif
| //===-- include/Support/DataTypes.h - Define fixed size types ----*- C++ -*--=//
//
// This file contains definitions to figure out the size of _HOST_ data types.
// This file is important because different host OS's define different macros,
// which makes portability tough. This file exports the following definitions:
//
// LITTLE_ENDIAN: is #define'd if the host is little endian
// int64_t : is a typedef for the signed 64 bit system type
// uint64_t : is a typedef for the unsigned 64 bit system type
//
// No library is required when using these functinons.
//
//===----------------------------------------------------------------------===//
// TODO: This file sucks. Not only does it not work, but this stuff should be
// autoconfiscated anyways. Major FIXME
#ifndef LLVM_SUPPORT_DATATYPES_H
#define LLVM_SUPPORT_DATATYPES_H
#include <inttypes.h>
#ifdef __linux__
#define __STDC_LIMIT_MACROS 1
#include <stdint.h> // Defined by ISO C 99
#include <endian.h>
#else
#include <sys/types.h>
#ifdef _LITTLE_ENDIAN
#define LITTLE_ENDIAN 1
#endif
#endif
#endif
|
Increase command line size to 2048 like other arches. | /*
* Just a place holder.
*/
#ifndef _SPARC64_SETUP_H
#define _SPARC64_SETUP_H
#define COMMAND_LINE_SIZE 256
#endif /* _SPARC64_SETUP_H */
| /*
* Just a place holder.
*/
#ifndef _SPARC64_SETUP_H
#define _SPARC64_SETUP_H
#define COMMAND_LINE_SIZE 2048
#endif /* _SPARC64_SETUP_H */
|
Clarify data in static card data | #ifndef YGO_DATA_CARDDATA_H
#define YGO_DATA_CARDDATA_H
#include <string>
#include "CardType.h"
namespace ygo
{
namespace data
{
struct StaticCardData
{
std::string name;
CardType cardType;
// monster only
Attribute attribute;
MonsterType monsterType;
Type type;
MonsterType monsterAbility;
int level;
int attack;
int defense;
int lpendulum;
int rpendulum;
// spell and trap only
SpellType spellType;
TrapType trapType;
std::string text;
};
}
}
#endif
| #ifndef YGO_DATA_CARDDATA_H
#define YGO_DATA_CARDDATA_H
#include <string>
#include "CardType.h"
namespace ygo
{
namespace data
{
struct StaticCardData
{
std::string name;
CardType cardType;
// monster only
Attribute attribute;
MonsterType monsterType;
Type type;
MonsterType monsterAbility;
int level;
int attack;
int defense;
int lpendulum;
int rpendulum;
// spell and trap only
SpellType spellType;
TrapType trapType;
// card text
std::string text;
};
}
}
#endif
|
Add forgotten file, espie@ has checked it compiles | /* $OpenBSD: isa_machdep.c,v 1.4 1999/03/05 19:17:44 niklas Exp $ */
/*
* Copyright (c) 1999 Niklas Hallqvist
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by Niklas Hallqvist.
* 4. The name of the author may not be used to endorse or promote products
* derived from this software without specific prior written permission
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include <sys/types.h>
#include <sys/systm.h>
#include <sys/device.h>
#include <machine/intr.h>
#include <dev/isa/isareg.h>
#include <dev/isa/isavar.h>
/*
* Just check to see if an IRQ is available/can be shared.
* 0 = interrupt not available
* 1 = interrupt shareable
* 2 = interrupt all to ourself
*/
int
__isa_intr_check(irq, type, intrtype)
int irq;
int type;
int *intrtype;
{
if (type == IST_NONE)
return (0);
switch (intrtype[irq]) {
case IST_NONE:
return (2);
break;
case IST_LEVEL:
if (type != intrtype[irq])
return (0);
return (1);
break;
case IST_EDGE:
case IST_PULSE:
if (type != IST_NONE)
return (0);
}
return (1);
}
| |
Enable compiling with older versions of GCC | /*
* Copyright 2019 Amazon.com, Inc. or its affiliates. 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.
* A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file 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 <sys/param.h>
#include "pq-crypto/pq-random.h"
#include "utils/s2n_mem.h"
static int (*random_data_generator)(struct s2n_blob *) = &s2n_get_private_random_data;
int initialize_pq_crypto_generator(int (*generator_ptr)(struct s2n_blob *))
{
if (generator_ptr == NULL) {
return -1;
}
random_data_generator = generator_ptr;
return 0;
}
int get_random_bytes(OUT unsigned char *buffer, unsigned int num_bytes)
{
struct s2n_blob out = {.data = buffer,.size = num_bytes };
return random_data_generator(&out);
}
| /*
* Copyright 2019 Amazon.com, Inc. or its affiliates. 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.
* A copy of the License is located at
*
* http://aws.amazon.com/apache2.0
*
* or in the "license" file accompanying this file. This file 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 <stdlib.h>
#include <sys/param.h>
#include "pq-crypto/pq-random.h"
#include "utils/s2n_mem.h"
static int (*random_data_generator)(struct s2n_blob *) = &s2n_get_private_random_data;
int initialize_pq_crypto_generator(int (*generator_ptr)(struct s2n_blob *))
{
if (generator_ptr == NULL) {
return -1;
}
random_data_generator = generator_ptr;
return 0;
}
int get_random_bytes(OUT unsigned char *buffer, unsigned int num_bytes)
{
struct s2n_blob out = {.data = buffer,.size = num_bytes };
return random_data_generator(&out);
}
|
Add speed to aux motor functions. | #ifndef HAL1_H
#define HAL1_H
// Configurable constants
extern int const MAIN_MOTOR_PWM_TOP;
extern int const MAIN_MOTOR_BRAKE_SPEED;
extern int const MAIN_MOTOR_MIN_SPEED;
extern int const MAIN_MOTOR_MED_SPEED;
extern int const MAIN_MOTOR_MAX_SPEED;
extern int const MAGNET_OPEN_WAIT;
void init(void);
void main_motor_stop();
void main_motor_cw_open(uint8_t speed);
void main_motor_ccw_close(uint8_t speed);
void aux_motor_stop();
void aux_motor_cw_close();
void aux_motor_ccw_open();
void magnet_off();
void magnet_on();
bool door_nearly_open();
bool door_fully_open();
bool door_fully_closed();
bool sensor_proximity();
bool button_openclose();
bool button_stop();
bool main_encoder();
bool aux_outdoor_limit();
bool aux_indoor_limit();
bool door_nearly_closed();
bool aux_encoder();
// Private functions
static void set_main_motor_speed(int speed);
#endif
| #ifndef HAL1_H
#define HAL1_H
// Configurable constants
extern int const MAIN_MOTOR_PWM_TOP;
extern int const MAIN_MOTOR_BRAKE_SPEED;
extern int const MAIN_MOTOR_MIN_SPEED;
extern int const MAIN_MOTOR_MED_SPEED;
extern int const MAIN_MOTOR_MAX_SPEED;
extern int const MAGNET_OPEN_WAIT;
void init(void);
void main_motor_stop();
void main_motor_cw_open(uint8_t speed);
void main_motor_ccw_close(uint8_t speed);
void aux_motor_stop();
void aux_motor_cw_close(uint8_t speed);
void aux_motor_ccw_open(uint8_t speed);
void magnet_off();
void magnet_on();
bool door_nearly_open();
bool door_fully_open();
bool door_fully_closed();
bool sensor_proximity();
bool button_openclose();
bool button_stop();
bool main_encoder();
bool aux_outdoor_limit();
bool aux_indoor_limit();
bool door_nearly_closed();
bool aux_encoder();
// Private functions
static void set_main_motor_speed(int speed);
#endif
|
Add include <functional> for osx | #include "helper.h"
#include <string> // string
#include <stdlib.h> // srand, rand
#include <time.h> // time - for rand seed
#include <algorithm> // sort
using namespace std;
class BaseSheet
{
protected:
int _level;
int _str;
int _dex;
int _con;
int _int;
int _wis;
int _cha;
int _speed ;
// All of these others have enums and a string
// The string is to print out - maybe not the best way
Size _size;
string _size_text;
Alignment_0 _alignment_0;
Alignment_1 _alignment_1;
string _alignment_text;
Race _race;
string _race_text;
DndClass _class;
string _class_text;
void set_class(DndClass myClass);
public:
BaseSheet(DndClass myClass);
void print_stats();
void level_up();
virtual void check_for_abilities();
void roll_stats(int[]);
virtual void assign_stats(int[]);
};
| #include "helper.h"
#include <string> // string
#include <stdlib.h> // srand, rand
#include <time.h> // time - for rand seed
#include <algorithm> // sort
#include <functional> // std::greater for mac osx
using namespace std;
class BaseSheet
{
protected:
int _level;
int _str;
int _dex;
int _con;
int _int;
int _wis;
int _cha;
int _speed ;
// All of these others have enums and a string
// The string is to print out - maybe not the best way
Size _size;
string _size_text;
Alignment_0 _alignment_0;
Alignment_1 _alignment_1;
string _alignment_text;
Race _race;
string _race_text;
DndClass _class;
string _class_text;
void set_class(DndClass myClass);
public:
BaseSheet(DndClass myClass);
void print_stats();
void level_up();
virtual void check_for_abilities();
void roll_stats(int[]);
virtual void assign_stats(int[]);
};
|
Add new manifest constant for demand mode DMA; form NetBSD | /* $OpenBSD: i8237reg.h,v 1.2 1996/04/18 23:47:19 niklas Exp $ */
/* $NetBSD: i8237reg.h,v 1.5 1996/03/01 22:27:09 mycroft Exp $ */
/*
* Intel 8237 DMA Controller
*/
#define DMA37MD_WRITE 0x04 /* read the device, write memory operation */
#define DMA37MD_READ 0x08 /* write the device, read memory operation */
#define DMA37MD_LOOP 0x10 /* auto-initialize mode */
#define DMA37MD_SINGLE 0x40 /* single pass mode */
#define DMA37MD_CASCADE 0xc0 /* cascade mode */
#define DMA37SM_CLEAR 0x00 /* clear mask bit */
#define DMA37SM_SET 0x04 /* set mask bit */
| /* $OpenBSD: i8237reg.h,v 1.3 1999/08/04 23:07:49 niklas Exp $ */
/* $NetBSD: i8237reg.h,v 1.5 1996/03/01 22:27:09 mycroft Exp $ */
/*
* Intel 8237 DMA Controller
*/
#define DMA37MD_DEMAND 0x00 /* demand mode */
#define DMA37MD_WRITE 0x04 /* read the device, write memory operation */
#define DMA37MD_READ 0x08 /* write the device, read memory operation */
#define DMA37MD_LOOP 0x10 /* auto-initialize mode */
#define DMA37MD_SINGLE 0x40 /* single pass mode */
#define DMA37MD_CASCADE 0xc0 /* cascade mode */
#define DMA37SM_CLEAR 0x00 /* clear mask bit */
#define DMA37SM_SET 0x04 /* set mask bit */
|
Add new randr header file. | #ifdef E_TYPEDEFS
typedef struct _E_Randr_Output_Config E_Randr_Output_Config;
typedef struct _E_Randr_Crtc_Config E_Randr_Crtc_Config;
typedef struct _E_Randr_Config E_Randr_Config;
#else
# ifndef E_RANDR_H
# define E_RANDR_H
#define E_RANDR_CONFIG_FILE_EPOCH 1
#define E_RANDR_CONFIG_FILE_GENERATION 1
#define E_RANDR_CONFIG_FILE_VERSION \
((E_RANDR_CONFIG_FILE_EPOCH * 1000000) + E_RANDR_CONFIG_FILE_GENERATION)
struct _E_Randr_Output_Config
{
unsigned int xid; // ecore_x_randr output id (xid)
unsigned int crtc; // ecore_x_randr crtc id (xid)
unsigned int policy; // value of the ecore_x_randr_output_policy
unsigned char primary; // flag to indicate if primary output
unsigned long edid_count; // monitor's edid length
unsigned char *edid; // monitor's edid
double timestamp; // config timestamp
};
struct _E_Randr_Crtc_Config
{
unsigned int xid; // ecore_x_randr crtc id (xid)
int x, y, width, height; // geometry
unsigned int orient; // value of the ecore_x_randr_orientation
unsigned int mode; // ecore_x_randr mode id (xid)
Eina_List *outputs; // list of outputs for this crtc
double timestamp; // config timestamp
};
struct _E_Randr_Config
{
/* RANDR CONFIG
*
* Screen:
* width, height (int);
*
* list of crtcs
* each crtc having:
* unsigned int crtc_id (Ecore_X_ID);
* int x, y, w, h; (Eina_Rectangle);
* unsigned int orientation (Ecore_X_Randr_Orienation);
* unsigned int mode_id (Ecore_X_ID);
* list of outputs
* each output having:
* unsigned int output_id (Ecore_X_ID);
* unsigned int crtc_id (Ecore_X_ID);
* unsigned int output_policy;
*/
int version; // INTERNAL CONFIG VERSION
struct
{
int width, height; // geometry
double timestamp; // config timestamp
} screen;
Eina_List *crtcs;
};
EINTERN Eina_Bool e_randr_init(void);
EINTERN int e_randr_shutdown(void);
EAPI Eina_Bool e_randr_config_save(void);
extern EAPI E_Randr_Config *e_randr_cfg;
# endif
#endif
| |
Add another ctrl dep test that we get right! | #include "rmc.h"
// Some test cases that required some bogosity to not have the branches get
// optimized away.
//
// Also, if r doesn't get used usefully, that load gets optimized away.
// I can't decide whether that is totally fucked or not.
int global_p, global_q;
int bogus_ctrl_dep1() {
XEDGE(read, write);
L(read, int r = global_p);
if (r == r) {
L(write, global_q = 1);
}
return r;
}
// Do basically the same thing in each branch
int bogus_ctrl_dep2() {
XEDGE(read, write);
L(read, int r = global_p);
if (r) {
L(write, global_q = 1);
} else {
L(write, global_q = 1);
}
return r;
}
// Have a bogus ctrl dep
int bogus_ctrl_dep3() {
XEDGE(read, write);
L(read, int r = global_p);
if (r) {};
L(write, global_q = 1);
return r;
}
| #include "rmc.h"
// Some test cases that required some bogosity to not have the branches get
// optimized away.
//
// Also, if r doesn't get used usefully, that load gets optimized away.
// I can't decide whether that is totally fucked or not.
int global_p, global_q;
int bogus_ctrl_dep1() {
XEDGE(read, write);
L(read, int r = global_p);
if (r == r) {
L(write, global_q = 1);
}
return r;
}
// Do basically the same thing in each branch
int bogus_ctrl_dep2() {
XEDGE(read, write);
L(read, int r = global_p);
if (r) {
L(write, global_q = 1);
} else {
L(write, global_q = 1);
}
return r;
}
// Have a totally ignored ctrl dep
int bogus_ctrl_dep3() {
XEDGE(read, write);
L(read, int r = global_p);
if (r) {};
L(write, global_q = 1);
return r;
}
// Have a ctrl dep that is redundant
int bogus_ctrl_dep4() {
XEDGE(read, write);
L(read, int r = global_p);
if (r || 1) {
L(write, global_q = 1);
}
return r;
}
|
Add solution to Exercise 1-9. | /* Exercise 1-8: Write a program to copy its input to its output, replacing
* each string of one of more blanks with a single blank. */
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
int main(int argc, char **argv)
{
int16_t character, previous_character;
while ((character = getchar()) != EOF) {
if ((previous_character == ' ') && (character == ' ')) {
continue;
} else {
putchar(character);
previous_character = character;
}
}
return EXIT_SUCCESS;
}
| |
Change alternate port number; seemed to be taken already! | /*
* EMULAB-COPYRIGHT
* Copyright (c) 2000-2002 University of Utah and the Flux Group.
* All rights reserved.
*/
#define TBSERVER_PORT 7777
#define TBSERVER_PORT2 14443
#define MYBUFSIZE 2048
#define BOSSNODE_FILENAME "bossnode"
/*
* As the tmcd changes, incompatable changes with older version of
* the software cause problems. Starting with version 3, the client
* will tell tmcd what version they are. If no version is included,
* assume its DEFAULT_VERSION.
*
* Be sure to update the versions as the TMCD changes. Both the
* tmcc and tmcd have CURRENT_VERSION compiled in, so be sure to
* install new versions of each binary when the current version
* changes. libsetup.pm module also encodes a current version, so be
* sure to change it there too!
*
* Note, this is assumed to be an integer. No need for 3.23.479 ...
* NB: See ron/libsetup.pm. That is version 4! I'll merge that in.
*/
#define DEFAULT_VERSION 2
#define CURRENT_VERSION 6
| /*
* EMULAB-COPYRIGHT
* Copyright (c) 2000-2002 University of Utah and the Flux Group.
* All rights reserved.
*/
#define TBSERVER_PORT 7777
#define TBSERVER_PORT2 14447
#define MYBUFSIZE 2048
#define BOSSNODE_FILENAME "bossnode"
/*
* As the tmcd changes, incompatable changes with older version of
* the software cause problems. Starting with version 3, the client
* will tell tmcd what version they are. If no version is included,
* assume its DEFAULT_VERSION.
*
* Be sure to update the versions as the TMCD changes. Both the
* tmcc and tmcd have CURRENT_VERSION compiled in, so be sure to
* install new versions of each binary when the current version
* changes. libsetup.pm module also encodes a current version, so be
* sure to change it there too!
*
* Note, this is assumed to be an integer. No need for 3.23.479 ...
* NB: See ron/libsetup.pm. That is version 4! I'll merge that in.
*/
#define DEFAULT_VERSION 2
#define CURRENT_VERSION 6
|
Fix import to what's actually needed. | //
// BRScrollerUtilities.h
// BRScroller
//
// Created by Matt on 7/11/13.
// Copyright (c) 2013 Blue Rocket. Distributable under the terms of the Apache License, Version 2.0.
//
#ifndef BRScroller_BRScrollerUtilities_h
#define BRScroller_BRScrollerUtilities_h
#include <CoreFoundation/CoreFoundation.h>
#include <QuartzCore/QuartzCore.h>
bool BRFloatsAreEqual(CGFloat a, CGFloat b);
CGSize BRAspectSizeToFit(CGSize size, CGSize maxSize);
#endif
| //
// BRScrollerUtilities.h
// BRScroller
//
// Created by Matt on 7/11/13.
// Copyright (c) 2013 Blue Rocket. Distributable under the terms of the Apache License, Version 2.0.
//
#ifndef BRScroller_BRScrollerUtilities_h
#define BRScroller_BRScrollerUtilities_h
#include <CoreGraphics/CoreGraphics.h>
bool BRFloatsAreEqual(CGFloat a, CGFloat b);
CGSize BRAspectSizeToFit(CGSize size, CGSize maxSize);
#endif
|
Make the filerator test more portable | #include "dirent.h"
typedef DIR* DIRptr;
typedef struct dirent* direntptr;
#define chpl_rt_direntptr_getname(x) ((x)->d_name)
//
// Note: This is not portable; more generally, need to use lstat() or similar;
// see the readdir() man page for notes
//
#define chpl_rt_direntptr_isDir(x) ((x)->d_type == DT_DIR)
| #include "dirent.h"
typedef DIR* DIRptr;
#ifndef __USE_FILE_OFFSET64
typedef struct dirent* direntptr;
#else
#ifdef __REDIRECT
typedef struct dirent* direntptr;
#else
typedef struct dirent64* direntptr;
#endif
#endif
#define chpl_rt_direntptr_getname(x) ((x)->d_name)
//
// Note: This is not portable; more generally, need to use lstat() or similar;
// see the readdir() man page for notes
//
#define chpl_rt_direntptr_isDir(x) ((x)->d_type == DT_DIR)
|
Remove unnecessary include and just forward declare. NFC | //===- llvm/TableGen/TableGenBackend.h - Backend utilities ------*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
//
// Useful utilities for TableGen backends.
//
//===----------------------------------------------------------------------===//
#ifndef LLVM_TABLEGEN_TABLEGENBACKEND_H
#define LLVM_TABLEGEN_TABLEGENBACKEND_H
#include "llvm/ADT/StringRef.h"
namespace llvm {
class raw_ostream;
/// emitSourceFileHeader - Output an LLVM style file header to the specified
/// raw_ostream.
void emitSourceFileHeader(StringRef Desc, raw_ostream &OS);
} // End llvm namespace
#endif
| //===- llvm/TableGen/TableGenBackend.h - Backend utilities ------*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
//
// Useful utilities for TableGen backends.
//
//===----------------------------------------------------------------------===//
#ifndef LLVM_TABLEGEN_TABLEGENBACKEND_H
#define LLVM_TABLEGEN_TABLEGENBACKEND_H
namespace llvm {
class StringRef;
class raw_ostream;
/// emitSourceFileHeader - Output an LLVM style file header to the specified
/// raw_ostream.
void emitSourceFileHeader(StringRef Desc, raw_ostream &OS);
} // End llvm namespace
#endif
|
Add links to original problem | // UIKitExtensions
//
// UIKitExtensions/UIView/Framing.h
//
// Copyright (c) 2013 Stanislaw Pankevich
// Released under the MIT license
//
// Inspired by FrameAccessor
// https://github.com/AlexDenisov/FrameAccessor/
#import <UIKit/UIKit.h>
@interface UIView (Framing)
@property CGPoint viewOrigin;
@property CGSize viewSize;
@property CGFloat x;
@property CGFloat y;
@property CGFloat height;
@property CGFloat width;
@property CGFloat centerX;
@property CGFloat centerY;
@end
| // UIKitExtensions
//
// UIKitExtensions/UIView/Framing.h
//
// Copyright (c) 2013 Stanislaw Pankevich
// Released under the MIT license
//
// Inspired by FrameAccessor
// https://github.com/AlexDenisov/FrameAccessor/
#import <UIKit/UIKit.h>
@interface UIView (Framing)
// http://stackoverflow.com/questions/16118106/uitextview-strange-text-clipping
// https://github.com/genericspecific/CKUITools/issues/8
@property CGPoint viewOrigin;
@property CGSize viewSize;
@property CGFloat x;
@property CGFloat y;
@property CGFloat height;
@property CGFloat width;
@property CGFloat centerX;
@property CGFloat centerY;
@end
|
Mend incorrect whitespace from 3103a58 | #ifndef TENYR_VPI_
#define TENYR_VPI_
#include <vpi_user.h>
struct tenyr_sim_state;
typedef int tenyr_sim_cb(p_cb_data data);
typedef int tenyr_sim_call(struct tenyr_sim_state *state, void *userdata);
struct tenyr_sim_state {
struct {
tenyr_sim_call *genesis; ///< beginning of sim
tenyr_sim_call *posedge; ///< rising edge of clock
tenyr_sim_call *negedge; ///< falling edge of clock
tenyr_sim_call *apocalypse; ///< end of sim
} cb;
struct {
struct {
vpiHandle genesis, apocalypse;
} cb;
struct {
vpiHandle tenyr_load;
vpiHandle tenyr_putchar;
#if 0
// XXX this code is not tenyr-correct -- it can block
vpiHandle tenyr_getchar;
#endif
} tf;
} handle;
void *extstate; ///< external state possibly used by tenyr_sim_cb's
};
#endif
| #ifndef TENYR_VPI_
#define TENYR_VPI_
#include <vpi_user.h>
struct tenyr_sim_state;
typedef int tenyr_sim_cb(p_cb_data data);
typedef int tenyr_sim_call(struct tenyr_sim_state *state, void *userdata);
struct tenyr_sim_state {
struct {
tenyr_sim_call *genesis; ///< beginning of sim
tenyr_sim_call *posedge; ///< rising edge of clock
tenyr_sim_call *negedge; ///< falling edge of clock
tenyr_sim_call *apocalypse; ///< end of sim
} cb;
struct {
struct {
vpiHandle genesis, apocalypse;
} cb;
struct {
vpiHandle tenyr_load;
vpiHandle tenyr_putchar;
#if 0
// XXX this code is not tenyr-correct -- it can block
vpiHandle tenyr_getchar;
#endif
} tf;
} handle;
void *extstate; ///< external state possibly used by tenyr_sim_cb's
};
#endif
|
Handle restrict on Windows compilers | #pragma once
#include <stdio.h>
#ifdef __cplusplus
extern "C" {
#endif
enum Turbo_Type {TJ_Error, TJ_String, TJ_Number, TJ_Object, TJ_Array, TJ_Boolean, TJ_Null};
struct Turbo_Value{
enum Turbo_Type type;
unsigned length;
union{
double number;
int boolean;
const char *string;
struct Turbo_Value *array;
struct Turbo_Property *object;
struct Turbo_Error *error;
} value;
};
const char *Turbo_Value(struct Turbo_Value * __restrict__ to, const char *in, const char *const end);
void Turbo_WriteValue(struct Turbo_Value *that, FILE *out, int level);
#ifdef __cplusplus
}
#endif
| #pragma once
#include <stdio.h>
#ifdef _MSC_VER
#define __restrict__ __restrict
#elif defined __WATCOMC__
#define __restrict__
#endif
#ifdef __cplusplus
extern "C" {
#endif
enum Turbo_Type {TJ_Error, TJ_String, TJ_Number, TJ_Object, TJ_Array, TJ_Boolean, TJ_Null};
struct Turbo_Value{
enum Turbo_Type type;
unsigned length;
union{
double number;
int boolean;
const char *string;
struct Turbo_Value *array;
struct Turbo_Property *object;
struct Turbo_Error *error;
} value;
};
const char *Turbo_Value(struct Turbo_Value * __restrict__ to, const char *in, const char *const end);
void Turbo_WriteValue(struct Turbo_Value *that, FILE *out, int level);
#ifdef __cplusplus
}
#endif
|
Disable GL sizes PPAPI tests | /* 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.
*
* This file has compile assertions for the sizes of types that are dependent
* on the architecture for which they are compiled (i.e., 32-bit vs 64-bit).
*/
#ifndef PPAPI_TESTS_ARCH_DEPENDENT_SIZES_64_H_
#define PPAPI_TESTS_ARCH_DEPENDENT_SIZES_64_H_
#include "ppapi/tests/test_struct_sizes.c"
PP_COMPILE_ASSERT_SIZE_IN_BYTES(GLintptr, 8);
PP_COMPILE_ASSERT_SIZE_IN_BYTES(GLsizeiptr, 8);
PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_CompletionCallback_Func, 8);
PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_URLLoaderTrusted_StatusCallback, 8);
PP_COMPILE_ASSERT_STRUCT_SIZE_IN_BYTES(PP_CompletionCallback, 24);
PP_COMPILE_ASSERT_SIZE_IN_BYTES(PPB_VideoDecoder_Dev, 64);
PP_COMPILE_ASSERT_SIZE_IN_BYTES(PPP_VideoDecoder_Dev, 32);
#endif /* PPAPI_TESTS_ARCH_DEPENDENT_SIZES_64_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.
*
* This file has compile assertions for the sizes of types that are dependent
* on the architecture for which they are compiled (i.e., 32-bit vs 64-bit).
*/
#ifndef PPAPI_TESTS_ARCH_DEPENDENT_SIZES_64_H_
#define PPAPI_TESTS_ARCH_DEPENDENT_SIZES_64_H_
#include "ppapi/tests/test_struct_sizes.c"
// TODO(jschuh): Resolve ILP64 to LLP64 issue. crbug.com/177779
#if !defined(_WIN64)
PP_COMPILE_ASSERT_SIZE_IN_BYTES(GLintptr, 8);
PP_COMPILE_ASSERT_SIZE_IN_BYTES(GLsizeiptr, 8);
#endif
PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_CompletionCallback_Func, 8);
PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_URLLoaderTrusted_StatusCallback, 8);
PP_COMPILE_ASSERT_STRUCT_SIZE_IN_BYTES(PP_CompletionCallback, 24);
PP_COMPILE_ASSERT_SIZE_IN_BYTES(PPB_VideoDecoder_Dev, 64);
PP_COMPILE_ASSERT_SIZE_IN_BYTES(PPP_VideoDecoder_Dev, 32);
#endif /* PPAPI_TESTS_ARCH_DEPENDENT_SIZES_64_H_ */
|
Allow uname() with linux emulation on NetBSD | /* $Id$ */
/* Copyright (c) 2006 The DeforaOS Project */
#include "../syscalls.h"
#include "sys/utsname.h"
/* uname */
#ifndef __NetBSD__
syscall1(int, uname, struct utsname *, utsname);
#endif
| /* $Id$ */
/* Copyright (c) 2007 The DeforaOS Project */
#include "../syscalls.h"
#include "sys/utsname.h"
/* uname */
#if !defined(__NetBSD__) || defined(NETBSD_USE_LINUX_EMULATION)
syscall1(int, uname, struct utsname *, utsname);
#endif
|
Add nullability annotations to the custom login view controller's public interface | #import <ResearchKit/ResearchKit.h>
@class CMHLoginViewController;
@protocol CMHLoginViewControllerDelegate <NSObject>
@optional
- (void)loginViewControllerCancelled:(CMHLoginViewController *_Nonnull)viewController;
- (void)loginViewController:(CMHLoginViewController *_Nonnull)viewController didLogin:(BOOL)success error:(NSError *_Nullable)error;
@end
@interface CMHLoginViewController : ORKTaskViewController
- (_Nonnull instancetype)initWithTitle:(NSString *_Nullable)title text:(NSString *_Nullable)text delegate:(id<CMHLoginViewControllerDelegate>)delegate;
@property (weak, nonatomic, nullable) id<CMHLoginViewControllerDelegate> loginDelegate;
- (instancetype)initWithTask:(nullable id<ORKTask>)task taskRunUUID:(nullable NSUUID *)taskRunUUID NS_UNAVAILABLE;
- (instancetype)initWithCoder:(NSCoder *)aDecoder NS_UNAVAILABLE;
- (instancetype)initWithNibName:(nullable NSString *)nibNameOrNil bundle:(nullable NSBundle *)nibBundleOrNil NS_UNAVAILABLE;
- (instancetype)initWithTask:(nullable id<ORKTask>)task restorationData:(nullable NSData *)data delegate:(nullable id<ORKTaskViewControllerDelegate>)delegate NS_UNAVAILABLE;
@end
| #import <ResearchKit/ResearchKit.h>
@class CMHLoginViewController;
@protocol CMHLoginViewControllerDelegate <NSObject>
@optional
- (void)loginViewControllerCancelled:(CMHLoginViewController *_Nonnull)viewController;
- (void)loginViewController:(CMHLoginViewController *_Nonnull)viewController didLogin:(BOOL)success error:(NSError *_Nullable)error;
@end
@interface CMHLoginViewController : ORKTaskViewController
- (_Nonnull instancetype)initWithTitle:(NSString *_Nullable)title text:(NSString *_Nullable)text delegate:(_Nullable id<CMHLoginViewControllerDelegate>)delegate;
@property (weak, nonatomic, nullable) id<CMHLoginViewControllerDelegate> loginDelegate;
- (_Null_unspecified instancetype)initWithTask:(nullable id<ORKTask>)task taskRunUUID:(nullable NSUUID *)taskRunUUID NS_UNAVAILABLE;
- (_Null_unspecified instancetype)initWithCoder:(NSCoder *_Null_unspecified)aDecoder NS_UNAVAILABLE;
- (_Null_unspecified instancetype)initWithNibName:(nullable NSString *)nibNameOrNil bundle:(nullable NSBundle *)nibBundleOrNil NS_UNAVAILABLE;
- (_Null_unspecified instancetype)initWithTask:(nullable id<ORKTask>)task restorationData:(nullable NSData *)data delegate:(nullable id<ORKTaskViewControllerDelegate>)delegate NS_UNAVAILABLE;
@end
|
Fix inappropriate move in ReadAsString |
#pragma once
#include "ionTypes.h"
#include <algorithm>
#include <numeric>
#include <iomanip>
#include <iostream>
#include <fstream>
#include <sstream>
using std::move;
using std::ifstream;
template <typename T, typename U>
U * ConditionalMapAccess(map<T, U *> & Map, T const Key)
{
auto Iterator = Map.find(Key);
if (Iterator != Map.end())
return Iterator->second;
return 0;
}
class File
{
public:
static bool Exists(string const & FileName)
{
ifstream ifile(FileName);
return ifile.good();
}
static string && ReadAsString(string const & FileName)
{
std::ifstream t(FileName);
std::string str;
t.seekg(0, std::ios::end);
str.reserve((uint) t.tellg());
t.seekg(0, std::ios::beg);
str.assign((std::istreambuf_iterator<char>(t)), std::istreambuf_iterator<char>());
return move(str);
}
};
|
#pragma once
#include "ionTypes.h"
#include <algorithm>
#include <numeric>
#include <iomanip>
#include <iostream>
#include <fstream>
#include <sstream>
using std::move;
using std::ifstream;
template <typename T, typename U>
U * ConditionalMapAccess(map<T, U *> & Map, T const Key)
{
auto Iterator = Map.find(Key);
if (Iterator != Map.end())
return Iterator->second;
return 0;
}
class File
{
public:
static bool Exists(string const & FileName)
{
ifstream ifile(FileName);
return ifile.good();
}
static string ReadAsString(string const & FileName)
{
std::ifstream t(FileName);
std::string str;
t.seekg(0, std::ios::end);
str.reserve((uint) t.tellg());
t.seekg(0, std::ios::beg);
str.assign((std::istreambuf_iterator<char>(t)), std::istreambuf_iterator<char>());
return str;
}
};
|
Update byte code ID for InitConst change | //-------------------------------------------------------------------------------------------------------
// Copyright (C) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE.txt file in the project root for full license information.
//-------------------------------------------------------------------------------------------------------
// NOTE: If there is a merge conflict the correct fix is to make a new GUID.
// This file was generated with tools\update_bytecode_version.ps1
// {81AEEA4B-AE4E-40C0-848F-6DB7C5F49F55}
const GUID byteCodeCacheReleaseFileVersion =
{ 0x81AEEA4B, 0xAE4E, 0x40C0, { 0x84, 0x8F, 0x6D, 0xB7, 0xC5, 0xF4, 0x9F, 0x55 } };
| //-------------------------------------------------------------------------------------------------------
// Copyright (C) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE.txt file in the project root for full license information.
//-------------------------------------------------------------------------------------------------------
// NOTE: If there is a merge conflict the correct fix is to make a new GUID.
// This file was generated with tools\update_bytecode_version.ps1
// {2C341884-72E5-4799-923C-DB8EDAFEEA89}
const GUID byteCodeCacheReleaseFileVersion =
{ 0x2C341884, 0x72E5, 0x4799, { 0x92, 0x3C, 0xDB, 0x8E, 0xDA, 0xFE, 0xEA, 0x89 } };
|
Comment regarding value serialization of date. | //
// SWXMLDateMapping.h
// This file is part of the "SWXMLMapping" project, and is distributed under the MIT License.
//
// Created by Samuel Williams on 13/11/05.
// Copyright 2005 Samuel Williams. All rights reserved.
//
#import "SWXMLMemberMapping.h"
@class SWXMLMemberMapping;
@interface SWXMLDateMapping : SWXMLMemberMapping {
}
@end
| //
// SWXMLDateMapping.h
// This file is part of the "SWXMLMapping" project, and is distributed under the MIT License.
//
// Created by Samuel Williams on 13/11/05.
// Copyright 2005 Samuel Williams. All rights reserved.
//
#import "SWXMLMemberMapping.h"
@class SWXMLMemberMapping;
// Formats value attribute according to ISO8601 (http://www.w3.org/TR/NOTE-datetime)
@interface SWXMLDateMapping : SWXMLMemberMapping {
}
@end
|
Add nested infinite loops test | // https://github.com/goblint/analyzer/issues/231#issuecomment-868369123
int main(void) {
int x = 0;
while(1) {
while(1) {
x++;
}
x--;
}
x--;
return x;
} | |
Add test for NULL pointer invariant refinement | #include <stddef.h>
int main() {
int *r; // rand
if (r == NULL)
assert(r == NULL);
else
assert(r != NULL); // TODO
if (r != NULL)
assert(r != NULL);
else
assert(r == NULL); // TODO
return 0;
}
| |
Allow neuron values (outputs) to be stored | #include <stdio.h>
#define INPUTS 3
#define HIDDEN 5
#define OUTPUTS 2
#define ROWS 5
typedef struct {
double input[HIDDEN][INPUTS];
double hidden[ROWS - 3][HIDDEN][HIDDEN];
double output[OUTPUTS][HIDDEN];
} Links;
typedef struct {
Links weights;
} ANN;
int main(void)
{
return 0;
}
| #include <stdio.h>
#define INPUTS 3
#define HIDDEN 5
#define OUTPUTS 2
#define ROWS 5
typedef struct {
double input[HIDDEN][INPUTS];
double hidden[ROWS - 3][HIDDEN][HIDDEN];
double output[OUTPUTS][HIDDEN];
} Links;
typedef struct {
int input[INPUTS];
int hidden[HIDDEN];
int output[OUTPUTS];
} Neurons;
typedef struct {
Links weights;
Neurons values;
} ANN;
int main(void)
{
return 0;
}
|
Make sure used unit constants are non-zero | /*
* free.h
* Memory usage utility for Darwin & MacOS X (similar to 'free' under Linux)
*
* by: David Cantrell <david.l.cantrell@gmail.com>
* Copyright (C) 2008, David Cantrell, Honolulu, HI, USA.
*
* Licensed under the GNU Lesser General Public License version 2.1 or later.
* See COPYING.LIB for licensing details.
*/
#define FREE_USAGE "Usage: %s [-b|-k|-m] [-s delay] [-V] [-h|-?]\n"
#define COMBINED_UNIT_OPTIONS "You may only use one of the unit options: -b, -k, or -m\n"
enum { BYTES, KILOBYTES, MEGABYTES };
typedef struct mem {
uint64_t total;
uint64_t used;
uint64_t free;
uint64_t active;
uint64_t inactive;
uint64_t wired;
} mem_t;
| /*
* free.h
* Memory usage utility for Darwin & MacOS X (similar to 'free' under Linux)
*
* by: David Cantrell <david.l.cantrell@gmail.com>
* Copyright (C) 2008, David Cantrell, Honolulu, HI, USA.
*
* Licensed under the GNU Lesser General Public License version 2.1 or later.
* See COPYING.LIB for licensing details.
*/
#define FREE_USAGE "Usage: %s [-b|-k|-m] [-s delay] [-V] [-h|-?]\n"
#define COMBINED_UNIT_OPTIONS "You may only use one of the unit options: -b, -k, or -m\n"
enum { UNUSED_UNIT, BYTES, KILOBYTES, MEGABYTES };
typedef struct mem {
uint64_t total;
uint64_t used;
uint64_t free;
uint64_t active;
uint64_t inactive;
uint64_t wired;
} mem_t;
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.