Instruction stringlengths 14 778 | input_code stringlengths 0 4.24k | output_code stringlengths 1 5.44k |
|---|---|---|
Fix ThreadPool class/struct forward declaration mixup | /**
* Copyright (c) 2016-present, Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef CAFFE2_UTILS_PTHREADPOOL_IMPL_H_
#define CAFFE2_UTILS_PTHREADPOOL_IMPL_H_
#include "ThreadPoolCommon.h"
#ifndef CAFFE2_THREADPOOL_MOBILE
#error "mobile build state not defined"
#endif
#if CAFFE2_THREADPOOL_MOBILE
namespace caffe2 {
struct ThreadPool;
} // namespace caffe2
extern "C" {
// Wrapper for the caffe2 threadpool for the usage of NNPACK
struct pthreadpool {
pthreadpool(caffe2::ThreadPool* pool) : pool_(pool) {}
caffe2::ThreadPool* pool_;
};
} // extern "C"
#endif // CAFFE2_THREADPOOL_MOBILE
#endif // CAFFE2_UTILS_PTHREADPOOL_IMPL_H_
| /**
* Copyright (c) 2016-present, Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef CAFFE2_UTILS_PTHREADPOOL_IMPL_H_
#define CAFFE2_UTILS_PTHREADPOOL_IMPL_H_
#include "ThreadPoolCommon.h"
#ifndef CAFFE2_THREADPOOL_MOBILE
#error "mobile build state not defined"
#endif
#if CAFFE2_THREADPOOL_MOBILE
namespace caffe2 {
class ThreadPool;
} // namespace caffe2
extern "C" {
// Wrapper for the caffe2 threadpool for the usage of NNPACK
struct pthreadpool {
pthreadpool(caffe2::ThreadPool* pool) : pool_(pool) {}
caffe2::ThreadPool* pool_;
};
} // extern "C"
#endif // CAFFE2_THREADPOOL_MOBILE
#endif // CAFFE2_UTILS_PTHREADPOOL_IMPL_H_
|
Add test case for ptr annotation. | // RUN: %llvmgcc -c -emit-llvm %s -o - | llvm-dis | grep llvm.ptr.annotation | count 3
#include <stdio.h>
/* Struct with element X being annotated */
struct foo {
int X __attribute__((annotate("StructAnnotation")));
int Y;
int Z;
};
void test(struct foo *F) {
F->X = 42;
F->Z = 1;
F->Y = F->X;
}
| |
Add test where base invariant worsens precision | // extracted from 01/22
#include <assert.h>
int main() {
int a = 1;
int b = 1;
int *x;
int rnd;
if (rnd)
x = &a;
else
x = &b;
assert(*x == 1);
b = 2;
assert(a == 1);
if (*x != 0) { // TODO: invariant makes less precise!
assert(a == 1); // TODO
}
return 0;
} | |
Create a CPU and start REPLing | //
// main.c
// v6502
//
// Created by Daniel Loffgren on H.25/03/28.
// Copyright (c) 平成25年 Hello-Channel, LLC. All rights reserved.
//
#include <stdio.h>
#include "cpu.h"
#include "mem.h"
int main(int argc, const char * argv[])
{
printf("Allocating virtual memory of size 2k…\n");
return 0;
}
| //
// main.c
// v6502
//
// Created by Daniel Loffgren on H.25/03/28.
// Copyright (c) 平成25年 Hello-Channel, LLC. All rights reserved.
//
#include <stdio.h>
#include <string.h>
#include "cpu.h"
#include "mem.h"
#include "core.h"
int main(int argc, const char * argv[])
{
printf("Creating 1 virtual CPU…\n");
v6502_cpu *cpu = v6502_createCPU();
printf("Allocating virtual memory of size 2k…\n");
cpu->memory = v6502_createMemory(2048);
char command[10];
for (;;) {
printf("] ");
scanf("%s", command);
if (!strncmp(command, "!", 2)) {
v6502_printCpuState(cpu);
}
}
return 0;
}
|
Add missing internal Hportal header | /* Copyright 2016 Vanderbilt University
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.
*/
/** \file
* Autogenerated public API
*/
#ifndef ACCRE_GOP_HP_PRIVATE_H_INCLUDED
#define ACCRE_GOP_HP_PRIVATE_H_INCLUDED
#include <apr_time.h>
#include <gop/visibility.h>
#include <gop/types.h>
#ifdef __cplusplus
extern "C" {
#endif
int gop_op_sync_exec_enabled(gop_op_generic_t *gop);
void gop_op_sync_exec(gop_op_generic_t *gop);
void gop_op_submit(gop_op_generic_t *gop);
#ifdef __cplusplus
}
#endif
#endif /* ^ ACCRE_GOP_HP_PRIVATE_H_INCLUDED ^ */
| |
Increase the status LED brightness a bit so that newer DotStars aren't super dim. This will make status NeoPixels a bit bright but one can use samd.set_rgb_status_brightness() to dim them. | #define BLACK 0x000000
#define GREEN 0x001000
#define BLUE 0x000010
#define CYAN 0x001010
#define RED 0x100000
#define ORANGE 0x100800
#define YELLOW 0x101000
#define PURPLE 0x100010
#define WHITE 0x101010
#define BOOT_RUNNING BLUE
#define MAIN_RUNNING GREEN
#define SAFE_MODE YELLOW
#define ALL_DONE GREEN
#define REPL_RUNNING WHITE
#define ACTIVE_WRITE 0x200000
#define ALL_GOOD_CYCLE_MS 2000u
#define LINE_NUMBER_TOGGLE_LENGTH 300u
#define EXCEPTION_TYPE_LENGTH_MS 1000u
#define THOUSANDS WHITE
#define HUNDREDS BLUE
#define TENS YELLOW
#define ONES CYAN
#define INDENTATION_ERROR GREEN
#define SYNTAX_ERROR CYAN
#define NAME_ERROR WHITE
#define OS_ERROR ORANGE
#define VALUE_ERROR PURPLE
#define OTHER_ERROR YELLOW
| #define BLACK 0x000000
#define GREEN 0x003000
#define BLUE 0x000030
#define CYAN 0x003030
#define RED 0x300000
#define ORANGE 0x302000
#define YELLOW 0x303000
#define PURPLE 0x300030
#define WHITE 0x303030
#define BOOT_RUNNING BLUE
#define MAIN_RUNNING GREEN
#define SAFE_MODE YELLOW
#define ALL_DONE GREEN
#define REPL_RUNNING WHITE
#define ACTIVE_WRITE 0x200000
#define ALL_GOOD_CYCLE_MS 2000u
#define LINE_NUMBER_TOGGLE_LENGTH 300u
#define EXCEPTION_TYPE_LENGTH_MS 1000u
#define THOUSANDS WHITE
#define HUNDREDS BLUE
#define TENS YELLOW
#define ONES CYAN
#define INDENTATION_ERROR GREEN
#define SYNTAX_ERROR CYAN
#define NAME_ERROR WHITE
#define OS_ERROR ORANGE
#define VALUE_ERROR PURPLE
#define OTHER_ERROR YELLOW
|
Fix some GCC initialization warnings | #pragma once
#include <vector>
#include <boost/multiprecision/cpp_int.hpp>
namespace dev
{
namespace eth
{
namespace jit
{
using byte = uint8_t;
using bytes = std::vector<byte>;
using u256 = boost::multiprecision::uint256_t;
using bigint = boost::multiprecision::cpp_int;
struct NoteChannel {}; // FIXME: Use some log library?
enum class ReturnCode
{
Stop = 0,
Return = 1,
Suicide = 2,
BadJumpDestination = 101,
OutOfGas = 102,
StackTooSmall = 103,
BadInstruction = 104,
LLVMConfigError = 201,
LLVMCompileError = 202,
LLVMLinkError = 203,
};
/// Representation of 256-bit value binary compatible with LLVM i256
// TODO: Replace with h256
struct i256
{
uint64_t a;
uint64_t b;
uint64_t c;
uint64_t d;
};
static_assert(sizeof(i256) == 32, "Wrong i265 size");
#define UNTESTED assert(false)
}
}
}
| #pragma once
#include <vector>
#include <boost/multiprecision/cpp_int.hpp>
namespace dev
{
namespace eth
{
namespace jit
{
using byte = uint8_t;
using bytes = std::vector<byte>;
using u256 = boost::multiprecision::uint256_t;
using bigint = boost::multiprecision::cpp_int;
struct NoteChannel {}; // FIXME: Use some log library?
enum class ReturnCode
{
Stop = 0,
Return = 1,
Suicide = 2,
BadJumpDestination = 101,
OutOfGas = 102,
StackTooSmall = 103,
BadInstruction = 104,
LLVMConfigError = 201,
LLVMCompileError = 202,
LLVMLinkError = 203,
};
/// Representation of 256-bit value binary compatible with LLVM i256
// TODO: Replace with h256
struct i256
{
uint64_t a = 0;
uint64_t b = 0;
uint64_t c = 0;
uint64_t d = 0;
};
static_assert(sizeof(i256) == 32, "Wrong i265 size");
#define UNTESTED assert(false)
}
}
}
|
Add missing parameter variable name 'k' | #include <stdlib.h>
#ifndef __LIST_H__
#define __LIST_H__
struct ListNode;
struct List;
typedef struct ListNode ListNode;
typedef struct List List;
List* List_Create(void);
void List_Destroy(List* l);
ListNode* ListNode_Create(void *);
void ListNode_Destroy(ListNode* n);
ListNode* List_Search(List* l, void* k, int (f)(void*, void*));
void List_Insert(List* l, ListNode* n);
void List_Delete(List* l, ListNode* n);
#endif | #include <stdlib.h>
#ifndef __LIST_H__
#define __LIST_H__
struct ListNode;
struct List;
typedef struct ListNode ListNode;
typedef struct List List;
List* List_Create(void);
void List_Destroy(List* l);
ListNode* ListNode_Create(void * k);
void ListNode_Destroy(ListNode* n);
ListNode* List_Search(List* l, void* k, int (f)(void*, void*));
void List_Insert(List* l, ListNode* n);
void List_Delete(List* l, ListNode* n);
#endif |
Add thusfar-unused Linux seccomp filter test. | #include <sys/prctl.h>
#include <linux/seccomp.h>
int
main(void)
{
prctl(PR_SET_SECCOMP, SECCOMP_MODE_FILTER, 0);
return(EFAULT == errno ? 0 : 1);
}
| |
Disable allocation tracking (it appears to be broken) | #define ACPI_MACHINE_WIDTH 64
#define ACPI_SINGLE_THREADED
#define ACPI_USE_LOCAL_CACHE
#define ACPI_INLINE inline
#define ACPI_USE_NATIVE_DIVIDE
#define DEBUGGER_THREADING DEBUGGER_SINGLE_THREADED
#ifdef ACPI_FULL_DEBUG
#define ACPI_DEBUG_OUTPUT
#define ACPI_DISASSEMBLER
// Depends on threading support
#define ACPI_DEBUGGER
#define ACPI_DBG_TRACK_ALLOCATIONS
#define ACPI_GET_FUNCTION_NAME __FUNCTION__
#else
#define ACPI_GET_FUNCTION_NAME ""
#endif
#define ACPI_PHYS_BASE 0x100000000
#include <stdint.h>
#include <stdarg.h>
#define AcpiOsPrintf printf
#define AcpiOsVprintf vprintf
struct acpi_table_facs;
uint32_t AcpiOsReleaseGlobalLock(struct acpi_table_facs* facs);
uint32_t AcpiOsAcquireGlobalLock(struct acpi_table_facs* facs);
#define ACPI_ACQUIRE_GLOBAL_LOCK(GLptr, Acquired) Acquired = AcpiOsAcquireGlobalLock(GLptr)
#define ACPI_RELEASE_GLOBAL_LOCK(GLptr, Pending) Pending = AcpiOsReleaseGlobalLock(GLptr)
| #define ACPI_MACHINE_WIDTH 64
#define ACPI_SINGLE_THREADED
#define ACPI_USE_LOCAL_CACHE
#define ACPI_INLINE inline
#define ACPI_USE_NATIVE_DIVIDE
#define DEBUGGER_THREADING DEBUGGER_SINGLE_THREADED
#ifdef ACPI_FULL_DEBUG
#define ACPI_DEBUG_OUTPUT
#define ACPI_DISASSEMBLER
// Depends on threading support
#define ACPI_DEBUGGER
//#define ACPI_DBG_TRACK_ALLOCATIONS
#define ACPI_GET_FUNCTION_NAME __FUNCTION__
#else
#define ACPI_GET_FUNCTION_NAME ""
#endif
#define ACPI_PHYS_BASE 0x100000000
#include <stdint.h>
#include <stdarg.h>
#define AcpiOsPrintf printf
#define AcpiOsVprintf vprintf
struct acpi_table_facs;
uint32_t AcpiOsReleaseGlobalLock(struct acpi_table_facs* facs);
uint32_t AcpiOsAcquireGlobalLock(struct acpi_table_facs* facs);
#define ACPI_ACQUIRE_GLOBAL_LOCK(GLptr, Acquired) Acquired = AcpiOsAcquireGlobalLock(GLptr)
#define ACPI_RELEASE_GLOBAL_LOCK(GLptr, Pending) Pending = AcpiOsReleaseGlobalLock(GLptr)
|
Fix path in tails_files C wrapper | #include <unistd.h>
int main(int argc, char* argv) {
setuid(0);
// Use absolute path to the Python binary and execl to avoid $PATH or symlink trickery
execl("/usr/bin/python2.7", "python2.7", "/home/vagrant/tails_files/test.py", (char*)NULL);
return 0;
}
| #include <unistd.h>
int main(int argc, char* argv) {
setuid(0);
// Use absolute path to the Python binary and execl to avoid $PATH or symlink trickery
execl("/usr/bin/python2.7", "python2.7", "/home/amnesia/Persistent/.securedrop/securedrop_init.py", (char*)NULL);
return 0;
}
|
Add note to fix confusing Instruction lengths | #ifndef _INC_INSTRUCTION_H
#define _INC_INSTRUCTION_H
#include "basetypes.h"
#include <vector>
#include <map>
typedef std::vector<byte> ByteString;
class BaseCPU;
class Instruction {
public:
Instruction(ByteString opcode, SizeType instructionLength);
virtual void execute(BaseCPU &cpu, const ByteString ¶ms) const = 0;
const ByteString opcode;
const SizeType length;
};
class InstructionSet {
public:
class InstructionComparator {
public:
bool operator()(const Instruction &a, const Instruction &b) const {
return a.opcode < b.opcode;
}
};
int add(const Instruction &instruction);
int remove(const ByteString &opcode);
MOCKABLE int decode(const ByteString &opcode, const Instruction **out) const;
SizeType count() const;
private:
typedef std::pair<ByteString, const Instruction &> InstructionCode;
typedef std::map<ByteString, const Instruction &> Set;
typedef Set::iterator Iterator;
typedef Set::const_iterator ConstIterator;
typedef std::pair<Iterator, bool> Insertion;
Set set;
};
#endif//_INC_INSTRUCTION_H | #ifndef _INC_INSTRUCTION_H
#define _INC_INSTRUCTION_H
#include "basetypes.h"
#include <vector>
#include <map>
typedef std::vector<byte> ByteString;
class BaseCPU;
class Instruction {
public:
Instruction(ByteString opcode, SizeType instructionLength);
virtual void execute(BaseCPU &cpu, const ByteString ¶ms) const = 0;
const ByteString opcode;
// FIXME: Total length is opcode.size() + length?
const SizeType length;
};
class InstructionSet {
public:
class InstructionComparator {
public:
bool operator()(const Instruction &a, const Instruction &b) const {
return a.opcode < b.opcode;
}
};
int add(const Instruction &instruction);
int remove(const ByteString &opcode);
MOCKABLE int decode(const ByteString &opcode, const Instruction **out) const;
SizeType count() const;
private:
typedef std::pair<ByteString, const Instruction &> InstructionCode;
typedef std::map<ByteString, const Instruction &> Set;
typedef Set::iterator Iterator;
typedef Set::const_iterator ConstIterator;
typedef std::pair<Iterator, bool> Insertion;
Set set;
};
#endif//_INC_INSTRUCTION_H |
Use generic pointer hashes instead of custom ones. | /* Title: LiveVarMap.h
Author: Ruchira Sasanka
Date: Jun 30, 01
Purpose: This file contains the class for a map between the BasicBlock class
and the BBLiveVar class, which is a wrapper class of BasicBlock
used for the live variable analysis. The reverse mapping can
be found in the BBLiveVar class (It has a pointer to the
corresponding BasicBlock)
*/
#ifndef LIVE_VAR_MAP_H
#define LIVE_VAR_MAP_H
#include <ext/hash_map>
class BasicBlock;
class BBLiveVar;
struct hashFuncMInst { // sturcture containing the hash function for MInst
inline size_t operator () (const MachineInstr *val) const {
return (size_t) val;
}
};
struct hashFuncBB { // sturcture containing the hash function for BB
inline size_t operator () (const BasicBlock *val) const {
return (size_t) val;
}
};
typedef std::hash_map<const BasicBlock *,
BBLiveVar *, hashFuncBB > BBToBBLiveVarMapType;
typedef std::hash_map<const MachineInstr *, const LiveVarSet *,
hashFuncMInst> MInstToLiveVarSetMapType;
#endif
| /* Title: LiveVarMap.h -*- C++ -*-
Author: Ruchira Sasanka
Date: Jun 30, 01
Purpose: This file contains the class for a map between the BasicBlock class
and the BBLiveVar class, which is a wrapper class of BasicBlock
used for the live variable analysis. The reverse mapping can
be found in the BBLiveVar class (It has a pointer to the
corresponding BasicBlock)
*/
#ifndef LIVE_VAR_MAP_H
#define LIVE_VAR_MAP_H
#include "Support/HashExtras.h"
class MachineInstr;
class BasicBlock;
class BBLiveVar;
class LiveVarSet;
typedef std::hash_map<const BasicBlock *, BBLiveVar *> BBToBBLiveVarMapType;
typedef std::hash_map<const MachineInstr *, const LiveVarSet *> MInstToLiveVarSetMapType;
#endif
|
Add a FrontendC testcase for the x86-64 Red Zone feature, to help verify that the feature may be disabled through the -mno-red-zone option. | // RUN: $llvmgcc -m64 -fomit-frame-pointer -O2 %s -S -o - > %t
// RUN: not grep subq %t
// RUN: not grep addq %t
// RUN: grep {\\-4(%%rsp)} %t | count 2
// RUN: $llvmgcc -m64 -fomit-frame-pointer -O2 %s -S -o - -mno-red-zone > %t
// RUN: grep subq %t | count 1
// RUN: grep addq %t | count 1
// This is a test for x86-64, add your target below if it FAILs.
// XFAIL: alpha|ia64|arm|powerpc|sparc|x86
long double f0(float f) { return f; }
| |
Revert r132426; this test passes more often than not, and we don't have a way to mark tests as intermittently failing at the moment. | // XFAIL: win32
// RUN: mkdir -p %t.dir
// RUN: echo '#include "header2.h"' > %t.dir/header1.h
// RUN: echo > %t.dir/header2.h
// RUN: cp %s %t.dir/t.c
// RUN: %clang_cc1 -x c-header %t.dir/header1.h -emit-pch -o %t.pch
// RUN: echo >> %t.dir/header2.h
// RUN: %clang_cc1 %t.dir/t.c -include-pch %t.pch -fsyntax-only 2>&1 | FileCheck %s
#include "header2.h"
// CHECK: fatal error: file {{.*}} has been modified since the precompiled header was built
| // RUN: mkdir -p %t.dir
// RUN: echo '#include "header2.h"' > %t.dir/header1.h
// RUN: echo > %t.dir/header2.h
// RUN: cp %s %t.dir/t.c
// RUN: %clang_cc1 -x c-header %t.dir/header1.h -emit-pch -o %t.pch
// RUN: echo >> %t.dir/header2.h
// RUN: %clang_cc1 %t.dir/t.c -include-pch %t.pch -fsyntax-only 2>&1 | FileCheck %s
#include "header2.h"
// CHECK: fatal error: file {{.*}} has been modified since the precompiled header was built
|
Add delegate property for subscription | //
// AVSubscription.h
// AVOS
//
// Created by Tang Tianyong on 15/05/2017.
// Copyright © 2017 LeanCloud Inc. All rights reserved.
//
#import <Foundation/Foundation.h>
#import "AVQuery.h"
#import "AVDynamicObject.h"
NS_ASSUME_NONNULL_BEGIN
@interface AVSubscriptionOptions : AVDynamicObject
@end
@interface AVSubscription : NSObject
@property (nonatomic, strong, readonly) AVQuery *query;
@property (nonatomic, strong, readonly, nullable) AVSubscriptionOptions *options;
- (instancetype)initWithQuery:(AVQuery *)query
options:(nullable AVSubscriptionOptions *)options;
@end
NS_ASSUME_NONNULL_END
| //
// AVSubscription.h
// AVOS
//
// Created by Tang Tianyong on 15/05/2017.
// Copyright © 2017 LeanCloud Inc. All rights reserved.
//
#import <Foundation/Foundation.h>
#import "AVQuery.h"
#import "AVDynamicObject.h"
NS_ASSUME_NONNULL_BEGIN
@protocol AVSubscriptionDelegate <NSObject>
@end
@interface AVSubscriptionOptions : AVDynamicObject
@end
@interface AVSubscription : NSObject
@property (nonatomic, weak, nullable) id<AVSubscriptionDelegate> delegate;
@property (nonatomic, strong, readonly) AVQuery *query;
@property (nonatomic, strong, readonly, nullable) AVSubscriptionOptions *options;
- (instancetype)initWithQuery:(AVQuery *)query
options:(nullable AVSubscriptionOptions *)options;
@end
NS_ASSUME_NONNULL_END
|
Make the prototype match the declaration in the GUSI header files. | /* The equivalent of the Unix 'sync' system call: FlushVol.
Public domain by Guido van Rossum, CWI, Amsterdam (July 1987).
For now, we only flush the default volume
(since that's the only volume written to by MacB). */
#include "macdefs.h"
int
sync(void)
{
if (FlushVol((StringPtr)0, 0) == noErr)
return 0;
else {
errno= ENODEV;
return -1;
}
}
| /* The equivalent of the Unix 'sync' system call: FlushVol.
Public domain by Guido van Rossum, CWI, Amsterdam (July 1987).
For now, we only flush the default volume
(since that's the only volume written to by MacB). */
#include "macdefs.h"
void
sync(void)
{
if (FlushVol((StringPtr)0, 0) == noErr)
return;
else {
errno= ENODEV;
return;
}
}
|
Remove declare: class VTSTOR_API cDriveInterface | /*
<License>
Copyright 2015 Virtium Technology
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.
</License>
*/
#ifndef __vtStorCommandHandlerInterface_h__
#define __vtStorCommandHandlerInterface_h__
#pragma once
#include <memory>
#include "ErrorCodes.h"
#include "BufferInterface.h"
#include "ProtocolInterface.h"
#include "vtStorPlatformDefines.h"
namespace vtStor
{
class VTSTOR_API cDriveInterface;
class VTSTOR_API cCommandHandlerInterface
{
public:
cCommandHandlerInterface( std::shared_ptr<Protocol::cProtocolInterface> Protocol );
virtual ~cCommandHandlerInterface();
public:
virtual eErrorCode IssueCommand( std::shared_ptr<const cBufferInterface> CommandDescriptor, std::shared_ptr<cBufferInterface> Data ) = 0;
protected:
std::shared_ptr<Protocol::cProtocolInterface> m_Protocol;
};
}
#endif | /*
<License>
Copyright 2015 Virtium Technology
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.
</License>
*/
#ifndef __vtStorCommandHandlerInterface_h__
#define __vtStorCommandHandlerInterface_h__
#pragma once
#include <memory>
#include "ErrorCodes.h"
#include "BufferInterface.h"
#include "ProtocolInterface.h"
#include "vtStorPlatformDefines.h"
namespace vtStor
{
class VTSTOR_API cCommandHandlerInterface
{
public:
cCommandHandlerInterface( std::shared_ptr<Protocol::cProtocolInterface> Protocol );
virtual ~cCommandHandlerInterface();
public:
virtual eErrorCode IssueCommand( std::shared_ptr<const cBufferInterface> CommandDescriptor, std::shared_ptr<cBufferInterface> Data ) = 0;
protected:
std::shared_ptr<Protocol::cProtocolInterface> m_Protocol;
};
}
#endif |
Add basic program to turn an LED on | #include <avr/io.h>
#include <avr/delay.h> | #include <avr/io.h>
int main (void) {
//Set pin 3 as output to source current?
PORTB = 1<<PORTB3;
DDRB = 1<<DDB3;
} |
Use angle brackets for Ruby include | #include "ruby.h"
VALUE Xorcist = Qnil;
void Init_xorcist();
VALUE xor_in_place(VALUE x, VALUE y, VALUE self);
VALUE xor_in_place(VALUE self, VALUE x, VALUE y) {
const char *src = 0;
char *dest = 0;
size_t len;
size_t y_len;
rb_str_modify(x);
dest = RSTRING_PTR(x);
len = RSTRING_LEN(x);
src = RSTRING_PTR(y);
y_len = RSTRING_LEN(y);
if (y_len < len) {
len = y_len;
}
for (; len--; ++dest, ++src) {
*dest ^= *src;
}
return x;
}
void Init_xorcist() {
Xorcist = rb_define_module("Xorcist");
rb_define_module_function(Xorcist, "xor!", xor_in_place, 2);
}
| #include <ruby.h>
VALUE Xorcist = Qnil;
void Init_xorcist();
VALUE xor_in_place(VALUE x, VALUE y, VALUE self);
VALUE xor_in_place(VALUE self, VALUE x, VALUE y) {
const char *src = 0;
char *dest = 0;
size_t len;
size_t y_len;
rb_str_modify(x);
dest = RSTRING_PTR(x);
len = RSTRING_LEN(x);
src = RSTRING_PTR(y);
y_len = RSTRING_LEN(y);
if (y_len < len) {
len = y_len;
}
for (; len--; ++dest, ++src) {
*dest ^= *src;
}
return x;
}
void Init_xorcist() {
Xorcist = rb_define_module("Xorcist");
rb_define_module_function(Xorcist, "xor!", xor_in_place, 2);
}
|
Test for struct in GNU ?: expressions | // RUN: %check -e %s
main()
{
struct A
{
int i;
} a, b, c;
a = b ? : c; // CHECK: error: struct involved in if-expr
}
| |
Fix @brief description by making it on one line instead of two | //
// This file is part of the Marble Desktop Globe.
//
// This program is free software licensed under the GNU LGPL. You can
// find a copy of this license in LICENSE.txt in the top directory of
// the source code.
//
// Copyright 2004-2007 Torsten Rahn <tackat@kde.org>"
// Copyright 2007 Inge Wallin <ingwa@kde.org>"
//
//
// Description: Some Tests for Marble
//
#ifndef MARBLETEST_H
#define MARBLETEST_H
namespace Marble
{
class MarbleWidget;
class MarbleTest {
public:
explicit MarbleTest( MarbleWidget* marbleWidget );
virtual ~MarbleTest(){ }
void timeDemo();
/**
* @brief load a gpx file and test the for average time, max time,
* min time and total time
*/
void gpsDemo();
private:
MarbleWidget *m_marbleWidget;
};
}
#endif // MARBLETEST_H
| //
// This file is part of the Marble Desktop Globe.
//
// This program is free software licensed under the GNU LGPL. You can
// find a copy of this license in LICENSE.txt in the top directory of
// the source code.
//
// Copyright 2004-2007 Torsten Rahn <tackat@kde.org>"
// Copyright 2007 Inge Wallin <ingwa@kde.org>"
//
//
// Description: Some Tests for Marble
//
#ifndef MARBLETEST_H
#define MARBLETEST_H
namespace Marble
{
class MarbleWidget;
class MarbleTest {
public:
explicit MarbleTest( MarbleWidget* marbleWidget );
virtual ~MarbleTest(){ }
void timeDemo();
/**
* @brief load a gpx file and test average, max, min, and total time
*/
void gpsDemo();
private:
MarbleWidget *m_marbleWidget;
};
}
#endif // MARBLETEST_H
|
Mend missing reference to stdint | #ifndef DEBUGGER_PARSER_GLOBAL_H_
#define DEBUGGER_PARSER_GLOBAL_H_
#include "common.h"
#include <stdio.h>
struct debug_expr {
enum expr_type { EXPR_NULL, EXPR_MEM, EXPR_REG } type;
int32_t val;
};
enum display_type {
DISP_NULL,
DISP_DEC,
DISP_HEX,
DISP_INST,
DISP_max
};
struct debugger_data {
struct sim_state *s; ///< simulator state to which we belong
void *scanner;
void *breakpoints;
struct {
unsigned savecol;
char saveline[LINE_LEN];
} lexstate;
struct debug_display {
struct debug_display *next;
struct debug_expr expr;
int fmt;
} *displays;
int displays_count;
struct debug_cmd {
enum {
CMD_NULL,
CMD_CONTINUE,
CMD_DELETE_BREAKPOINT,
CMD_DISPLAY,
CMD_GET_INFO,
CMD_PRINT,
CMD_SET_BREAKPOINT,
CMD_STEP_INSTRUCTION,
CMD_QUIT,
CMD_max
} code;
struct {
struct debug_expr expr;
int fmt; ///< print / display format character
char str[LINE_LEN];
} arg;
} cmd;
};
int tdbg_parse(struct debugger_data *);
int tdbg_prompt(struct debugger_data *dd, FILE *where);
#endif
| #ifndef DEBUGGER_PARSER_GLOBAL_H_
#define DEBUGGER_PARSER_GLOBAL_H_
#include "common.h"
#include <stdint.h>
#include <stdio.h>
struct debug_expr {
enum expr_type { EXPR_NULL, EXPR_MEM, EXPR_REG } type;
int32_t val;
};
enum display_type {
DISP_NULL,
DISP_DEC,
DISP_HEX,
DISP_INST,
DISP_max
};
struct debugger_data {
struct sim_state *s; ///< simulator state to which we belong
void *scanner;
void *breakpoints;
struct {
unsigned savecol;
char saveline[LINE_LEN];
} lexstate;
struct debug_display {
struct debug_display *next;
struct debug_expr expr;
int fmt;
} *displays;
int displays_count;
struct debug_cmd {
enum {
CMD_NULL,
CMD_CONTINUE,
CMD_DELETE_BREAKPOINT,
CMD_DISPLAY,
CMD_GET_INFO,
CMD_PRINT,
CMD_SET_BREAKPOINT,
CMD_STEP_INSTRUCTION,
CMD_QUIT,
CMD_max
} code;
struct {
struct debug_expr expr;
int fmt; ///< print / display format character
char str[LINE_LEN];
} arg;
} cmd;
};
int tdbg_parse(struct debugger_data *);
int tdbg_prompt(struct debugger_data *dd, FILE *where);
#endif
|
Add [] operator. Fix potential memory errors. | /*
* Copyright 2006-2008 The FLWOR Foundation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef ZORBA_DEBUGGER_UTILS
#define ZORBA_DEBUGGER_UTILS
namespace zorba
{
template<class T>
class ZorbaArrayAutoPointer
{
private:
T* thePtr;
public:
ZorbaArrayAutoPointer(): thePtr(0){}
ZorbaArrayAutoPointer(T *aPtr): thePtr(aPtr){}
~ZorbaArrayAutoPointer()
{
delete[] thePtr;
}
void reset(T *aPtr)
{
T* lPtr = thePtr;
thePtr = aPtr;
delete[] lPtr;
}
T* get()
{
return thePtr;
}
T* release()
{
T* lPtr = thePtr;
thePtr = 0;
return lPtr;
}
};
}//end of namespace
#endif
| /*
* Copyright 2006-2008 The FLWOR Foundation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef ZORBA_DEBUGGER_UTILS_H
#define ZORBA_DEBUGGER_UTILS_H
namespace zorba
{
template<class T>
class ZorbaArrayAutoPointer
{
private:
T* thePtr;
public:
ZorbaArrayAutoPointer(): thePtr(0){}
explicit ZorbaArrayAutoPointer(T *aPtr): thePtr(aPtr){}
~ZorbaArrayAutoPointer()
{
if(thePtr != 0)
{
delete[] thePtr;
}
}
void reset(T *aPtr)
{
T* lPtr = thePtr;
thePtr = aPtr;
if(thePtr != 0)
{
delete[] lPtr;
}
}
T* get() const
{
return thePtr;
}
T* release()
{
T* lPtr = thePtr;
thePtr = 0;
return lPtr;
}
T operator[](unsigned int anIndex) const
{
return thePtr[anIndex];
}
};
}//end of namespace
#endif
|
Update file, Alura, Introdução a C, Aula 1.5 | #include <stdio.h>
int main() {
// imprime o cabecalho do nosso jogo
printf("******************************************\n");
printf("* Bem vindo ao nosso jogo de adivinhação *\n");
printf("******************************************\n");
int numerosecreto = 42;
printf("O número %d é o secreto. Não conta pra ninguém!\n", numerosecreto);
}
| #include <stdio.h>
int main() {
// imprime o cabecalho do nosso jogo
printf("******************************************\n");
printf("* Bem vindo ao nosso jogo de adivinhação *\n");
printf("******************************************\n");
int numerosecreto = 42;
int chute;
printf("Qual é o seu chute? ");
scanf("%d", &chute);
printf("Seu chute foi %d", chute);
}
|
Add .hints initializer for clarity. | static struct hep_ctx ctx = {
.initfails = 0,
.hints = {{ 0 }},
.capt_host = "10.0.0.1",
.capt_port = "9060",
.capt_id = 101,
.hep_version = 3,
.usessl = 0,
.pl_compress = 0,
.sendPacketsCount = 0
};
| static struct hep_ctx ctx = {
.initfails = 0,
.hints = {{ 0 }},
.capt_host = "10.0.0.1",
.capt_port = "9060",
.hints = {{ .ai_socktype = SOCK_DGRAM }},
.capt_id = 101,
.hep_version = 3,
.usessl = 0,
.pl_compress = 0,
.sendPacketsCount = 0
};
|
Adjust test case to be compatible with future changes to explicitly pass the type to getelementptr | // RUN: %clang_cc1 -triple x86_64-pc-win32 -emit-llvm -O2 -o - %s | FileCheck %s
// Under Windows 64, int and long are 32-bits. Make sure pointer math doesn't
// cause any sign extensions.
// CHECK: [[P:%.*]] = add i64 %param, -8
// CHECK-NEXT: [[Q:%.*]] = inttoptr i64 [[P]] to [[R:%.*\*]]
// CHECK-NEXT: {{%.*}} = getelementptr inbounds [[R]] [[Q]], i64 0, i32 0
#define CR(Record, TYPE, Field) \
((TYPE *) ((unsigned char *) (Record) - (unsigned char *) &(((TYPE *) 0)->Field)))
typedef struct _LIST_ENTRY {
struct _LIST_ENTRY *ForwardLink;
struct _LIST_ENTRY *BackLink;
} LIST_ENTRY;
typedef struct {
unsigned long long Signature;
LIST_ENTRY Link;
} MEMORY_MAP;
int test(unsigned long long param)
{
LIST_ENTRY *Link;
MEMORY_MAP *Entry;
Link = (LIST_ENTRY *) param;
Entry = CR (Link, MEMORY_MAP, Link);
return (int) Entry->Signature;
}
| // RUN: %clang_cc1 -triple x86_64-pc-win32 -emit-llvm -O2 -o - %s | FileCheck %s
// Under Windows 64, int and long are 32-bits. Make sure pointer math doesn't
// cause any sign extensions.
// CHECK: [[P:%.*]] = add i64 %param, -8
// CHECK-NEXT: [[Q:%.*]] = inttoptr i64 [[P]] to [[R:%.*]]*
// CHECK-NEXT: {{%.*}} = getelementptr inbounds [[R]]* [[Q]], i64 0, i32 0
#define CR(Record, TYPE, Field) \
((TYPE *) ((unsigned char *) (Record) - (unsigned char *) &(((TYPE *) 0)->Field)))
typedef struct _LIST_ENTRY {
struct _LIST_ENTRY *ForwardLink;
struct _LIST_ENTRY *BackLink;
} LIST_ENTRY;
typedef struct {
unsigned long long Signature;
LIST_ENTRY Link;
} MEMORY_MAP;
int test(unsigned long long param)
{
LIST_ENTRY *Link;
MEMORY_MAP *Entry;
Link = (LIST_ENTRY *) param;
Entry = CR (Link, MEMORY_MAP, Link);
return (int) Entry->Signature;
}
|
Add NRF24L01 node_ops 'driver' skeleton | /*
* This file is part of the KNOT Project
*
* Copyright (c) 2015, CESAR. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of the CESAR nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL CESAR 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 <errno.h>
#include <unistd.h>
#include <string.h>
#include <sys/socket.h>
#include <sys/un.h>
#include "node.h"
static int nrf24_probe(void)
{
return -ENOSYS;
}
static void nrf24_remove(void)
{
}
static int nrf24_listen(void)
{
return -ENOSYS;
}
static int nrf24_accept(int srv_sockfd)
{
return -ENOSYS;
}
static ssize_t nrf24_recv(int sockfd, void *buffer, size_t len)
{
return -ENOSYS;
}
static ssize_t nrf24_send(int sockfd, const void *buffer, size_t len)
{
return -ENOSYS;
}
static struct node_ops nrf24_ops = {
.name = "NRF24L01",
.probe = nrf24_probe,
.remove = nrf24_remove,
.listen = nrf24_listen,
.accept = nrf24_accept,
.recv = nrf24_recv,
.send = nrf24_send
};
/*
* The following functions MAY be implemented as plugins
* initialization functions, avoiding function calls such
* as manager@manager_start()->node@node_init()->
* manager@node_ops_register()->node@node_probe()
*/
int node_init(void)
{
return node_ops_register(&nrf24_ops);
}
void node_exit(void)
{
}
| |
Allow suppression of "deprecated header" warning | /*-------------------------------------------------------------------------
*
* FILE
* pqxx/util.h
*
* DESCRIPTION
* Various utility definitions for libpqxx
*
* Copyright (c) 2001-2004, Jeroen T. Vermeulen <jtv@xs4all.nl>
*
* See COPYING for copyright license. If you did not receive a file called
* COPYING with this source code, please notify the distributor of this mistake,
* or contact the author.
*
*-------------------------------------------------------------------------
*/
#ifndef PQXX_UTIL_H
#define PQXX_UTIL_H
#if defined(PQXX_HAVE_CPP_WARNING)
#warning "Deprecated libpqxx header included. Use headers without '.h'"
#elif defined(PQXX_HAVE_CPP_PRAGMA_MESSAGE)
#pragma message("Deprecated libpqxx header included. Use headers without '.h'")
#endif
#define PQXX_DEPRECATED_HEADERS
#include "pqxx/util"
#endif
| /*-------------------------------------------------------------------------
*
* FILE
* pqxx/util.h
*
* DESCRIPTION
* Various utility definitions for libpqxx
*
* Copyright (c) 2001-2004, Jeroen T. Vermeulen <jtv@xs4all.nl>
*
* See COPYING for copyright license. If you did not receive a file called
* COPYING with this source code, please notify the distributor of this mistake,
* or contact the author.
*
*-------------------------------------------------------------------------
*/
#ifndef PQXX_UTIL_H
#define PQXX_UTIL_H
#if !defined(PQXXYES_I_KNOW_DEPRECATED_HEADER)
#define PQXXYES_I_KNOW_DEPRECATED_HEADER
#if defined(PQXX_HAVE_CPP_WARNING)
#warning "Deprecated libpqxx header included. Use headers without '.h'"
#elif defined(PQXX_HAVE_CPP_PRAGMA_MESSAGE)
#pragma message("Deprecated libpqxx header included. Use headers without '.h'")
#endif
#endif
#define PQXX_DEPRECATED_HEADERS
#include "pqxx/util"
#endif
|
Fix a typo in the comment. | //
// Copyleft RIME Developers
// License: GPLv3
//
// 2011-03-14 GONG Chen <chen.sst@gmail.com>
//
#ifndef RIME_COMMON_H_
#define RIME_COMMON_H_
#include <memory>
#include <utility>
#define BOOST_BIND_NO_PLACEHOLDERS
#include <boost/signals2/connection.hpp>
#include <boost/signals2/signal.hpp>
#ifdef RIME_ENABLE_LOGGING
#include <glog/logging.h>
#else
#include "no_logging.h"
#endif // RIME_ENABLE_LOGGGING
namespace rime {
using boost::signals2::connection;
using boost::signals2::signal;
using std::unique_ptr;
using std::shared_ptr;
using std::weak_ptr;
template <class A, class B>
shared_ptr<A> As(const B& ptr) {
return std::dynamic_pointer_cast<A>(ptr);
}
template <class A, class B>
bool Is(const B& ptr) {
return bool(As<A, B>(ptr));
}
template <class T, class... Args>
inline shared_ptr<T> New(Args&&... args) {
return std::make_shared<T>(std::forward<Args>(args)...);
}
} // namespace rime
#endif // RIME_COMMON_H_
| //
// Copyleft RIME Developers
// License: GPLv3
//
// 2011-03-14 GONG Chen <chen.sst@gmail.com>
//
#ifndef RIME_COMMON_H_
#define RIME_COMMON_H_
#include <memory>
#include <utility>
#define BOOST_BIND_NO_PLACEHOLDERS
#include <boost/signals2/connection.hpp>
#include <boost/signals2/signal.hpp>
#ifdef RIME_ENABLE_LOGGING
#include <glog/logging.h>
#else
#include "no_logging.h"
#endif // RIME_ENABLE_LOGGING
namespace rime {
using boost::signals2::connection;
using boost::signals2::signal;
using std::unique_ptr;
using std::shared_ptr;
using std::weak_ptr;
template <class A, class B>
shared_ptr<A> As(const B& ptr) {
return std::dynamic_pointer_cast<A>(ptr);
}
template <class A, class B>
bool Is(const B& ptr) {
return bool(As<A, B>(ptr));
}
template <class T, class... Args>
inline shared_ptr<T> New(Args&&... args) {
return std::make_shared<T>(std::forward<Args>(args)...);
}
} // namespace rime
#endif // RIME_COMMON_H_
|
Add override after overriden methods | // This program is free software licenced under MIT Licence. You can
// find a copy of this licence in LICENCE.txt in the top directory of
// source code.
//
#ifndef BASIC_ROUND_STRATEGY_H_INCLUDED
#define BASIC_ROUND_STRATEGY_H_INCLUDED
// Project
#include "globals.h"
#include "RoundStrategy.h"
namespace warlightAi {
// Fwrd decls
class World;
class BasicRoundStrategy : public RoundStrategy
{
public:
BasicRoundStrategy(const World &world, int availableArmies);
VecOfPairs getDeployments() const;
VecOfTuples getAttacks() const;
private:
VecOfPairs m_deployments;
VecOfTuples m_attacks;
}; // class BasicRoundStrategy
} // namespace warlightAi
#endif // BASIC_ROUND_STRATEGY_H_INCLUDED
| // This program is free software licenced under MIT Licence. You can
// find a copy of this licence in LICENCE.txt in the top directory of
// source code.
//
#ifndef BASIC_ROUND_STRATEGY_H_INCLUDED
#define BASIC_ROUND_STRATEGY_H_INCLUDED
// Project
#include "globals.h"
#include "RoundStrategy.h"
namespace warlightAi {
// Fwrd decls
class World;
class BasicRoundStrategy : public RoundStrategy
{
public:
BasicRoundStrategy(const World &world, int availableArmies);
VecOfPairs getDeployments() const override;
VecOfTuples getAttacks() const override;
private:
VecOfPairs m_deployments;
VecOfTuples m_attacks;
}; // class BasicRoundStrategy
} // namespace warlightAi
#endif // BASIC_ROUND_STRATEGY_H_INCLUDED
|
Test program to get CPU affinity of an MPI application | /*
Copyright (c) 2013 Janne Blomqvist
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be included
in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#include <hwloc.h>
#include <errno.h>
#include <stdio.h>
#include <string.h>
#ifdef _OPENMP
#include <omp.h>
#endif
#ifdef MPI
#include <mpi.h>
#endif
static hwloc_topology_t topo;
static void print_cpu_bind(FILE* f, int rank, int threadid)
{
char* s;
hwloc_bitmap_t cpuset = hwloc_bitmap_alloc();
/* get the current thread CPU location */
hwloc_get_cpubind(topo, cpuset, HWLOC_CPUBIND_THREAD);
hwloc_bitmap_asprintf(&s, cpuset);
fprintf(f, "MPI rank %d thread %d running on %s\n", rank, threadid,
s);
}
int main(int argc, char **argv)
{
int rank = 0;
hwloc_topology_init(&topo);
hwloc_topology_load(topo);
#ifdef MPI
MPI_Init(&argc, &argv);
MPI_Comm_rank(MPI_COMM_WORLD, &rank);
#endif
#pragma omp parallel
{
#ifdef _OPENMP
int threadid = omp_get_thread_num();
#else
int threadid = 0;
#endif
print_cpu_bind(stdout, rank, threadid);
}
#ifdef MPI
MPI_Finalize();
#endif
return 0;
}
| |
Include QList and QMap to header file to fix build | #ifndef DOWNLOAD_QUERY_LOADER_H
#define DOWNLOAD_QUERY_LOADER_H
#include <QString>
class Site;
class DownloadQueryImage;
class DownloadQueryGroup;
class DownloadQueryLoader
{
public:
static bool load(QString path, QList<DownloadQueryImage> &uniques, QList<DownloadQueryGroup> &batchs, QMap<QString, Site*> &sites);
static bool save(QString path, QList<DownloadQueryImage> &uniques, QList<DownloadQueryGroup> &batchs);
};
#endif // DOWNLOAD_QUERY_LOADER_H
| #ifndef DOWNLOAD_QUERY_LOADER_H
#define DOWNLOAD_QUERY_LOADER_H
#include <QString>
#include <QList>
#include <QMap>
class Site;
class DownloadQueryImage;
class DownloadQueryGroup;
class DownloadQueryLoader
{
public:
static bool load(QString path, QList<DownloadQueryImage> &uniques, QList<DownloadQueryGroup> &batchs, QMap<QString, Site*> &sites);
static bool save(QString path, QList<DownloadQueryImage> &uniques, QList<DownloadQueryGroup> &batchs);
};
#endif // DOWNLOAD_QUERY_LOADER_H
|
Add constant for spin increment | #pragma once
#include "Tab.h"
class Display : public Tab {
public:
virtual void SaveSettings();
protected:
virtual void Initialize();
virtual void LoadSettings();
private:
bool OnAnimationChanged();
bool OnAnimationSpin(NMUPDOWN *ud);
bool OnCustomCheckChanged();
bool OnPositionChanged();
private:
/* Controls: */
Checkbox _onTop;
Checkbox _hideFullscreen;
ComboBox _position;
Label _customX;
EditBox _positionX;
Label _customY;
EditBox _positionY;
Checkbox _customDistance;
Spinner _edgeSpinner;
Label _displayDevLabel;
ComboBox _displayDevice;
ComboBox _animation;
Label _hideDelayLabel;
Spinner _hideDelay;
Label _hideSpeedLabel;
Spinner _hideSpeed;
private:
/* Strings: */
std::wstring primaryMonitorStr = L"Primary Monitor";
std::wstring allMonitorStr = L"All Monitors";
std::wstring customPositionStr = L"Custom";
std::wstring noAnimStr = L"None";
private:
/* Constants: */
const int MIN_EDGE = -65535;
const int MAX_EDGE = 65535;
const int MIN_MS = USER_TIMER_MINIMUM;
const int MAX_MS = 60000;
}; | #pragma once
#include "Tab.h"
#include <CommCtrl.h>
class Display : public Tab {
public:
virtual void SaveSettings();
protected:
virtual void Initialize();
virtual void LoadSettings();
private:
bool OnAnimationChanged();
bool OnAnimationSpin(NMUPDOWN *ud);
bool OnCustomCheckChanged();
bool OnPositionChanged();
private:
/* Controls: */
Checkbox _onTop;
Checkbox _hideFullscreen;
ComboBox _position;
Label _customX;
EditBox _positionX;
Label _customY;
EditBox _positionY;
Checkbox _customDistance;
Spinner _edgeSpinner;
Label _displayDevLabel;
ComboBox _displayDevice;
ComboBox _animation;
Label _hideDelayLabel;
Spinner _hideDelay;
Label _hideSpeedLabel;
Spinner _hideSpeed;
private:
/* Strings: */
std::wstring primaryMonitorStr = L"Primary Monitor";
std::wstring allMonitorStr = L"All Monitors";
std::wstring customPositionStr = L"Custom";
std::wstring noAnimStr = L"None";
private:
/* Constants: */
const int MIN_EDGE = -65535;
const int MAX_EDGE = 65535;
const int MIN_MS = USER_TIMER_MINIMUM;
const int MAX_MS = 60000;
const int ANIM_SPIN_INCREMENT = 100;
}; |
Add basic (base analysis) path sensitivity test | extern void __VERIFIER_error() __attribute__ ((__noreturn__));
extern int __VERIFIER_nondet_int();
void __VERIFIER_assert(int cond) {
if (!(cond)) {
ERROR: __VERIFIER_error();
}
return;
}
int main()
{
int x, y;
if (__VERIFIER_nondet_int())
{
x = 0;
y = 1;
}
else
{
x = 1;
y = 0;
}
__VERIFIER_assert(x + y == 1);
return 0;
} | |
Remove spurious mLoop member from PinocchioTest | #include <QtCore/QProcess>
#include <QtDBus/QtDBus>
#include <QtTest/QtTest>
#include <TelepathyQt4/Client/PendingOperation>
#include <TelepathyQt4/Constants>
#include "tests/lib/test.h"
class PinocchioTest : public Test
{
Q_OBJECT
public:
PinocchioTest(QObject *parent = 0);
virtual ~PinocchioTest();
static inline QLatin1String pinocchioBusName()
{
return QLatin1String(
TELEPATHY_CONNECTION_MANAGER_BUS_NAME_BASE "pinocchio");
}
static inline QLatin1String pinocchioObjectPath()
{
return QLatin1String(
TELEPATHY_CONNECTION_MANAGER_OBJECT_PATH_BASE "pinocchio");
}
bool waitForPinocchio(uint timeoutMs = 5000);
protected:
QString mPinocchioPath;
QString mPinocchioCtlPath;
QProcess mPinocchio;
QEventLoop *mLoop;
virtual void initTestCaseImpl();
virtual void cleanupTestCaseImpl();
protected Q_SLOTS:
void gotNameOwner(QDBusPendingCallWatcher* watcher);
void onNameOwnerChanged(const QString&, const QString&, const QString&);
};
| #include <QtCore/QProcess>
#include <QtDBus/QtDBus>
#include <QtTest/QtTest>
#include <TelepathyQt4/Client/PendingOperation>
#include <TelepathyQt4/Constants>
#include "tests/lib/test.h"
class PinocchioTest : public Test
{
Q_OBJECT
public:
PinocchioTest(QObject *parent = 0);
virtual ~PinocchioTest();
static inline QLatin1String pinocchioBusName()
{
return QLatin1String(
TELEPATHY_CONNECTION_MANAGER_BUS_NAME_BASE "pinocchio");
}
static inline QLatin1String pinocchioObjectPath()
{
return QLatin1String(
TELEPATHY_CONNECTION_MANAGER_OBJECT_PATH_BASE "pinocchio");
}
bool waitForPinocchio(uint timeoutMs = 5000);
protected:
QString mPinocchioPath;
QString mPinocchioCtlPath;
QProcess mPinocchio;
virtual void initTestCaseImpl();
virtual void cleanupTestCaseImpl();
protected Q_SLOTS:
void gotNameOwner(QDBusPendingCallWatcher* watcher);
void onNameOwnerChanged(const QString&, const QString&, const QString&);
};
|
Use dirty C tricks to make it smaller | #include <stdio.h>
int main()
{
long nc = 0;
while (getchar() != EOF) {
++nc;
}
printf("count: %d\n", nc);
}
| #include <stdio.h>
int main()
{
double nc = 0;
for (nc = 0; getchar() != EOF; ++nc)
;
printf("count: %f\n", nc);
}
|
Remove __vectorcall calling convention on older versions of MSVC++ | #pragma once
#include <string>
#if 0
int Stricmp(const char* str1, const char* str2) {
int d;
while ((d = toupper(*str2) - toupper(*str1)) == 0 && *str1) {
str1++;
str2++;
}
return d;
}
int Strnicmp(const char* str1, const char* str2, int count) {
int d = 0;
while (count > 0 && (d = toupper(*str2) - toupper(*str1)) == 0 && *str1) {
str1++; str2++; count--;
}
return d;
}
#endif
#ifdef _MSC_VER
#define SL_CALL __vectorcall
#else
#define SL_CALL
#endif
#define COUNT_OF(X) (sizeof(X) / sizeof((X)[0]))
#define ZERO_MEM(X, Y) (memset(X, 0, Y)); | #pragma once
#include <string>
#if 0
int Stricmp(const char* str1, const char* str2) {
int d;
while ((d = toupper(*str2) - toupper(*str1)) == 0 && *str1) {
str1++;
str2++;
}
return d;
}
int Strnicmp(const char* str1, const char* str2, int count) {
int d = 0;
while (count > 0 && (d = toupper(*str2) - toupper(*str1)) == 0 && *str1) {
str1++; str2++; count--;
}
return d;
}
#endif
#if defined(_MSC_VER) && (_MSC_VER >= 1800)
#define SL_CALL __vectorcall
#else
#define SL_CALL
#endif
#define COUNT_OF(X) (sizeof(X) / sizeof((X)[0]))
#define ZERO_MEM(X, Y) (memset(X, 0, Y)); |
Add ComPtr utility to laf-base library | // LAF Base Library
// Copyright (c) 2017 David Capello
//
// This file is released under the terms of the MIT license.
// Read LICENSE.txt for more information.
#ifndef BASE_WIN_COMPTR_H_INCLUDED
#define BASE_WIN_COMPTR_H_INCLUDED
#pragma once
#if !defined(_WIN32)
#error This header file can be used only on Windows platform
#endif
#include "base/disable_copying.h"
namespace base {
template<class T>
class ComPtr {
public:
ComPtr() : m_ptr(nullptr) { }
~ComPtr() { reset(); }
T** operator&() { return &m_ptr; }
T* operator->() { return m_ptr; }
T* get() {
return m_ptr;
}
void reset() {
if (m_ptr) {
m_ptr->Release();
m_ptr = nullptr;
}
}
private:
T* m_ptr;
DISABLE_COPYING(ComPtr);
};
} // namespace base
#endif
| |
Add test where base has live bottom state | //PARAM: --set ana.activated '["base", "mallocWrapper"]'
// Copied & modified from 33/04.
#include <assert.h>
int main() {
// state: {bot}, because no locals/globals
assert(1); // state: {bot}, because Hoare set add (in PathSensitive2 map) keeps bot, while reduce would remove
assert(1); // state: {bot}, because Hoare set add (in PathSensitive2 map) keeps bot, while reduce would remove
return 0;
}
| |
CREATE ns_prefix/box/ didn't work right when namespace prefix existed. | /* Copyright (C) 2002 Timo Sirainen */
#include "common.h"
#include "mail-namespace.h"
#include "commands.h"
bool cmd_create(struct client_command_context *cmd)
{
struct mail_namespace *ns;
const char *mailbox, *full_mailbox;
bool directory;
size_t len;
/* <mailbox> */
if (!client_read_string_args(cmd, 1, &mailbox))
return FALSE;
full_mailbox = mailbox;
ns = client_find_namespace(cmd, &mailbox);
if (ns == NULL)
return TRUE;
len = strlen(full_mailbox);
if (len == 0 || full_mailbox[len-1] != ns->sep)
directory = FALSE;
else {
/* name ends with hierarchy separator - client is just
informing us that it wants to create children under this
mailbox. */
directory = TRUE;
mailbox = t_strndup(mailbox, len-1);
full_mailbox = t_strndup(full_mailbox, strlen(full_mailbox)-1);
}
if (!client_verify_mailbox_name(cmd, full_mailbox, FALSE, TRUE))
return TRUE;
if (mail_storage_mailbox_create(ns->storage, mailbox, directory) < 0)
client_send_storage_error(cmd, ns->storage);
else
client_send_tagline(cmd, "OK Create completed.");
return TRUE;
}
| /* Copyright (C) 2002 Timo Sirainen */
#include "common.h"
#include "mail-namespace.h"
#include "commands.h"
bool cmd_create(struct client_command_context *cmd)
{
struct mail_namespace *ns;
const char *mailbox, *full_mailbox;
bool directory;
size_t len;
/* <mailbox> */
if (!client_read_string_args(cmd, 1, &mailbox))
return FALSE;
full_mailbox = mailbox;
ns = client_find_namespace(cmd, &mailbox);
if (ns == NULL)
return TRUE;
len = strlen(full_mailbox);
if (len == 0 || full_mailbox[len-1] != ns->sep)
directory = FALSE;
else {
/* name ends with hierarchy separator - client is just
informing us that it wants to create children under this
mailbox. */
directory = TRUE;
mailbox = t_strndup(mailbox, strlen(mailbox)-1);
full_mailbox = t_strndup(full_mailbox, len-1);
}
if (!client_verify_mailbox_name(cmd, full_mailbox, FALSE, TRUE))
return TRUE;
if (mail_storage_mailbox_create(ns->storage, mailbox, directory) < 0)
client_send_storage_error(cmd, ns->storage);
else
client_send_tagline(cmd, "OK Create completed.");
return TRUE;
}
|
Add a Debug shmemlog tag. | /*
* $Id$
*
* Define the tags in the shared memory in a reusable format.
* Whoever includes this get to define what the SLTM macro does.
*
*/
SLTM(CLI)
SLTM(SessionOpen)
SLTM(SessionClose)
SLTM(ClientAddr)
SLTM(Request)
SLTM(URL)
SLTM(Protocol)
SLTM(HD_Unknown)
SLTM(HD_Lost)
#define HTTPH(a, b, c, d, e, f, g) SLTM(b)
#include "http_headers.h"
#undef HTTPH
| /*
* $Id$
*
* Define the tags in the shared memory in a reusable format.
* Whoever includes this get to define what the SLTM macro does.
*
*/
SLTM(Debug)
SLTM(CLI)
SLTM(SessionOpen)
SLTM(SessionClose)
SLTM(ClientAddr)
SLTM(Request)
SLTM(URL)
SLTM(Protocol)
SLTM(HD_Unknown)
SLTM(HD_Lost)
#define HTTPH(a, b, c, d, e, f, g) SLTM(b)
#include "http_headers.h"
#undef HTTPH
|
Make work for AIX machines. | #ifndef _CONDOR_SYSCALLS_H
#define _CONDOR_SYSCALLS_H
#if defined( AIX32)
# include "syscall.aix32.h"
#else
# include <syscall.h>
#endif
typedef int BOOL;
static const int SYS_LOCAL = 1;
static const int SYS_REMOTE = 0;
static const int SYS_RECORDED = 2;
static const int SYS_MAPPED = 2;
static const int SYS_UNRECORDED = 0;
static const int SYS_UNMAPPED = 0;
#if defined(__cplusplus)
extern "C" {
#endif
int SetSyscalls( int mode );
int GetSyscallMode();
BOOL LocalSysCalls();
BOOL RemoteSysCalls();
BOOL MappingFileDescriptors();
int REMOTE_syscall( int syscall_num, ... );
#if defined(OSF1) || defined(HPUX9)
int syscall( int, ... );
#endif
#if defined(__cplusplus)
}
#endif
#endif
| #ifndef _CONDOR_SYSCALLS_H
#define _CONDOR_SYSCALLS_H
#if defined( AIX32)
# include "syscall.aix.h"
#else
# include <syscall.h>
#endif
typedef int BOOL;
static const int SYS_LOCAL = 1;
static const int SYS_REMOTE = 0;
static const int SYS_RECORDED = 2;
static const int SYS_MAPPED = 2;
static const int SYS_UNRECORDED = 0;
static const int SYS_UNMAPPED = 0;
#if defined(__cplusplus)
extern "C" {
#endif
int SetSyscalls( int mode );
int GetSyscallMode();
BOOL LocalSysCalls();
BOOL RemoteSysCalls();
BOOL MappingFileDescriptors();
int REMOTE_syscall( int syscall_num, ... );
#if defined(OSF1) || defined(HPUX9)
int syscall( int, ... );
#endif
#if defined(__cplusplus)
}
#endif
#endif
|
Fix MSVC compiler warnings about return value not being a boolean | #pragma once
#include <stdint.h>
#if _MSC_VER
#include <intrin.h>
#endif
template<typename morton>
inline bool findFirstSetBit(const morton x, unsigned long* firstbit_location) {
#if _MSC_VER && !_WIN64
// 32 BIT on 32 BIT
if (sizeof(morton) <= 4) {
return _BitScanReverse(firstbit_location, x);
}
// 64 BIT on 32 BIT
else {
*firstbit_location = 0;
if (_BitScanReverse(firstbit_location, (x >> 32))) { // check first part
firstbit_location += 32;
return true;
}
return _BitScanReverse(firstbit_location, (x & 0xFFFFFFFF));
}
#elif _MSC_VER && _WIN64
// 32 or 64 BIT on 64 BIT
return _BitScanReverse64(firstbit_location, x);
#elif __GNUC__
if (x == 0) {
return false;
}
else {
*firstbit_location = static_cast<unsigned long>((sizeof(morton)*8) - __builtin_clzll(x));
return true;
}
#endif
} | #pragma once
// Libmorton - Common helper methods needed in Morton encoding/decoding
#include <stdint.h>
#if _MSC_VER
#include <intrin.h>
#endif
template<typename morton>
inline bool findFirstSetBit(const morton x, unsigned long* firstbit_location) {
#if _MSC_VER && !_WIN64
// 32 BIT on 32 BIT
if (sizeof(morton) <= 4) {
return _BitScanReverse(firstbit_location, x);
}
// 64 BIT on 32 BIT
else {
*firstbit_location = 0;
if (_BitScanReverse(firstbit_location, (x >> 32))) { // check first part
firstbit_location += 32;
return true;
}
return _BitScanReverse(firstbit_location, (x & 0xFFFFFFFF));
}
#elif _MSC_VER && _WIN64
// 32 or 64 BIT on 64 BIT
return _BitScanReverse64(firstbit_location, x) != 0;
#elif __GNUC__
if (x == 0) {
return false;
}
else {
*firstbit_location = static_cast<unsigned long>((sizeof(morton)*8) - __builtin_clzll(x));
return true;
}
#endif
} |
Make "visit" method pure virtual (needs to be implemented by subclass to make sense). |
/******************************************************************************
*
* file: Visitor.h
*
* Copyright (c) 2003, Michael E. Smoot .
* All rights reverved.
*
* See the file COPYING in the top directory of this distribution for
* more information.
*
* THE SOFTWARE IS PROVIDED _AS IS_, WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*
*****************************************************************************/
#ifndef TCLAP_VISITOR_H
#define TCLAP_VISITOR_H
namespace TCLAP {
/**
* A base class that defines the interface for visitors.
*/
class Visitor
{
public:
/**
* Constructor. Does nothing.
*/
Visitor() { }
/**
* Destructor. Does nothing.
*/
virtual ~Visitor() { }
/**
* Does nothing. Should be overridden by child.
*/
virtual void visit() { }
};
}
#endif
|
/******************************************************************************
*
* file: Visitor.h
*
* Copyright (c) 2003, Michael E. Smoot .
* All rights reverved.
*
* See the file COPYING in the top directory of this distribution for
* more information.
*
* THE SOFTWARE IS PROVIDED _AS IS_, WITHOUT WARRANTY OF ANY KIND, EXPRESS
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
* DEALINGS IN THE SOFTWARE.
*
*****************************************************************************/
#ifndef TCLAP_VISITOR_H
#define TCLAP_VISITOR_H
namespace TCLAP {
/**
* A base class that defines the interface for visitors.
*/
class Visitor
{
public:
/**
* Constructor. Does nothing.
*/
Visitor() { }
/**
* Destructor. Does nothing.
*/
virtual ~Visitor() { }
/**
* This method (to implemented by children) will be
* called when the visitor is visited.
*/
virtual void visit() = 0;
};
}
#endif
|
Add minimal failing test case | // PARAM: --enable ana.int.interval --enable ana.int.def_exc
int main(){
unsigned long long a ;
unsigned long long addr;
if(a + addr > 0x0ffffffffULL){
return 1;
}
}
| |
Fix microblaze build after merge 480c64b | /**
* @file
* @details This file contains @link interrupt_handler() @endlink function.
* It's proxy between asm code and kernel interrupt handler
* @link irq_dispatch() @endlink function.
*
* @date 27.11.09
* @author Anton Bondarev
*/
#include <drivers/irqctrl.h>
#include <asm/msr.h>
/* we havn't interrupts acknowledgment in microblaze architecture
* and must receive interrupt number our self and then clear pending bit in
* pending register
*/
void interrupt_handler(void) {
unsigned int pending;
while (0 != (pending = mb_intc_get_pending())) {
unsigned int irq_num;
for (irq_num = 0; irq_num < IRQCTRL_IRQS_TOTAL; irq_num++) {
if (pending & (1 << irq_num)) {
//TODO we must clear whole pending register
irqctrl_clear(irq_num);
/*now we allow nested irq*/
msr_set_ie();
irq_dispatch(irq_num);
}
}
}
}
| /**
* @file
* @details This file contains @link interrupt_handler() @endlink function.
* It's proxy between asm code and kernel interrupt handler
* @link irq_dispatch() @endlink function.
*
* @date 27.11.09
* @author Anton Bondarev
*/
#include <drivers/irqctrl.h>
#include <asm/msr.h>
#include <kernel/irq.h>
/* we havn't interrupts acknowledgment in microblaze architecture
* and must receive interrupt number our self and then clear pending bit in
* pending register
*/
void interrupt_handler(void) {
unsigned int pending;
while (0 != (pending = mb_intc_get_pending())) {
unsigned int irq_num;
for (irq_num = 0; irq_num < IRQCTRL_IRQS_TOTAL; irq_num++) {
if (pending & (1 << irq_num)) {
//TODO we must clear whole pending register
irqctrl_clear(irq_num);
/*now we allow nested irq*/
msr_set_ie();
irq_dispatch(irq_num);
}
}
}
}
|
Rename VERSION to avoid overlapping with external macros | /**
* mips.h - all the aliases to MIPS ISA
* @author Aleksandr Misevich
* Copyright 2018 MIPT-MIPS
*/
#ifndef MIPS_H_
#define MIPS_H_
#include "mips_instr.h"
#include <infra/instrcache/instr_cache_memory.h>
template<MIPSVersion VERSION>
struct MIPS
{
using Register = MIPSRegister;
using RegisterUInt = MIPSRegisterUInt<VERSION>;
using FuncInstr = MIPSInstr<VERSION>;
using Memory = InstrMemory<FuncInstr>;
static const auto& get_instr( uint32 bytes, Addr PC) {
return FuncInstr( VERSION, bytes, PC);
}
};
// 32 bit MIPS
using MIPSI = MIPS<MIPSVersion::I>;
using MIPSII = MIPS<MIPSVersion::II>;
using MIPS32 = MIPS<MIPSVersion::v32>;
// 64 bit MIPS
using MIPSIII = MIPS<MIPSVersion::III>;
using MIPSIV = MIPS<MIPSVersion::IV>;
using MIPS64 = MIPS<MIPSVersion::v64>;
static_assert( std::is_same_v<MIPS32Instr, MIPS32::FuncInstr>);
static_assert( std::is_same_v<MIPS64Instr, MIPS64::FuncInstr>);
#endif // MIPS_H_
| /**
* mips.h - all the aliases to MIPS ISA
* @author Aleksandr Misevich
* Copyright 2018 MIPT-MIPS
*/
#ifndef MIPS_H_
#define MIPS_H_
#include "mips_instr.h"
#include <infra/instrcache/instr_cache_memory.h>
template<MIPSVersion version>
struct MIPS
{
using Register = MIPSRegister;
using RegisterUInt = MIPSRegisterUInt<version>;
using FuncInstr = MIPSInstr<version>;
using Memory = InstrMemory<FuncInstr>;
static const auto& get_instr( uint32 bytes, Addr PC) {
return FuncInstr( version, bytes, PC);
}
};
// 32 bit MIPS
using MIPSI = MIPS<MIPSVersion::I>;
using MIPSII = MIPS<MIPSVersion::II>;
using MIPS32 = MIPS<MIPSVersion::v32>;
// 64 bit MIPS
using MIPSIII = MIPS<MIPSVersion::III>;
using MIPSIV = MIPS<MIPSVersion::IV>;
using MIPS64 = MIPS<MIPSVersion::v64>;
static_assert( std::is_same_v<MIPS32Instr, MIPS32::FuncInstr>);
static_assert( std::is_same_v<MIPS64Instr, MIPS64::FuncInstr>);
#endif // MIPS_H_
|
Move class selection code out to a separate header | #ifndef CLASS_SELECTOR_H_
#define CLASS_SELECTOR_H_
#include "llvm/IR/Module.h"
#include "llvm/IR/Instruction.h"
#include "llvm/IR/Instructions.h"
#include "llvm/IR/IntrinsicInst.h"
#include "llvm/IR/BasicBlock.h"
#include "llvm/IR/Function.h"
#include "llvm/IR/Operator.h"
#include "llvm/IR/Type.h"
#include "llvm/IR/Value.h"
#include "llvm/IR/User.h"
#include "llvm/IR/Argument.h"
#include "llvm/IR/Constant.h"
#include "llvm/Analysis/RegionInfo.h"
#include "llvm/Analysis/LoopInfo.h"
#include "llvm/IR/GlobalVariable.h"
#include "llvm/IR/GlobalValue.h"
#include "llvm/IR/GlobalAlias.h"
#include "llvm/IR/InlineAsm.h"
#include "llvm/ADT/DenseSet.h"
#include "llvm/ADT/DenseMap.h"
#include "llvm/Support/Casting.h"
#include "llvm/Support/raw_ostream.h"
#include "llvm/Support/Casting.h"
#include "llvm/Support/ErrorHandling.h"
#include "llvm/ADT/SmallVector.h"
#include "llvm/Analysis/RegionInfo.h"
#include "llvm/Analysis/LoopInfo.h"
#include "llvm/Analysis/RegionPass.h"
#include "llvm/Analysis/LoopPass.h"
#include "llvm/ADT/Optional.h"
namespace knowledge {
template<typename T>
struct ElectronClassNameSelector {
static void selectName(llvm::raw_string_ostream& str) {
str << "";
}
};
#define X(__, type, className, ___) \
template<> \
struct ElectronClassNameSelector<type> { \
static void selectName(llvm::raw_string_ostream& str) { \
str << className ; \
} \
};
#include "knowledge/EngineNodes.def"
#undef X
}
#endif // CLASS_SELECTOR_H_
| |
Add license header, add version and help info | #include <stdio.h>
int main(int argc, char *argv[])
{
printf("gxtas - The GTA Text Assembler\n");
return 0;
}
| /*
* Copyright (c) 2017 Wes Hampson <thehambone93@gmail.com>
*
* Licensed under the MIT License. See LICENSE at top level directory.
*/
#include <stdio.h>
#include <string.h>
#include "gxtas.h"
void show_help_info(void)
{
printf("%s\n", GXTAS_HELP_MESSAGE);
}
void show_version_info(void)
{
printf("%s - %s\n", GXTAS_APP_NAME, GXTAS_APP_MOTTO);
printf("Version %d.%d.%d%s\n", GXTAS_VERSION_MAJOR, GXTAS_VERSION_MINOR,
GXTAS_VERSION_PATCH, GXTAS_VERSION_BUILD);
printf("\n%s\n", GXTAS_COPYRIGHT_NOTICE);
printf("\n%s\n", GXTAS_LICENSE_NOTICE);
printf("\n%s\n", GXTAS_WARRANTY_NOTICE);
}
int main(int argc, char *argv[])
{
if (argc < 2)
{
show_help_info();
}
else if (strcmp(argv[1], "--version") == 0)
{
show_version_info();
}
else
{
show_help_info();
}
return 0;
}
|
Add operators for arithmetic with ratios | //Copyright (c) 2018 Ultimaker B.V.
//CuraEngine is released under the terms of the AGPLv3 or higher.
#ifndef RATIO_H
#define RATIO_H
namespace cura
{
/*
* \brief Represents a ratio between two numbers.
*
* This is a facade. It behaves like a double.
*/
struct Ratio
{
/*
* \brief Default constructor setting the ratio to 1.
*/
constexpr Ratio() : value(1.0) {};
/*
* \brief Casts a double to a Ratio instance.
*/
constexpr Ratio(double value) : value(value / 100) {};
/*
* \brief Casts the Ratio instance to a double.
*/
operator double() const
{
return value;
}
/*
* \brief The actual ratio, as a double.
*/
double value = 0;
};
constexpr Ratio operator "" _r(const long double ratio)
{
return Ratio(ratio);
}
}
#endif //RATIO_H | //Copyright (c) 2018 Ultimaker B.V.
//CuraEngine is released under the terms of the AGPLv3 or higher.
#ifndef RATIO_H
#define RATIO_H
namespace cura
{
/*
* \brief Represents a ratio between two numbers.
*
* This is a facade. It behaves like a double.
*/
struct Ratio
{
/*
* \brief Default constructor setting the ratio to 1.
*/
constexpr Ratio() : value(1.0) {};
/*
* \brief Casts a double to a Ratio instance.
*/
constexpr Ratio(double value) : value(value / 100) {};
/*
* \brief Casts the Ratio instance to a double.
*/
operator double() const
{
return value;
}
/*
* Some operators for arithmetic on ratios.
*/
Ratio operator *(const Ratio& other) const
{
return Ratio(value * other.value);
}
template<typename E> Ratio operator *(const E& other) const
{
return Ratio(value * other);
}
Ratio operator /(const Ratio& other) const
{
return Ratio(value / other.value);
}
template<typename E> Ratio operator /(const E& other) const
{
return Ratio(value / other);
}
Ratio& operator *=(const Ratio& other)
{
value *= other.value;
return *this;
}
template<typename E> Ratio& operator *=(const E& other)
{
value *= other;
return *this;
}
Ratio& operator /=(const Ratio& other)
{
value /= other.value;
return *this;
}
template<typename E> Ratio& operator /=(const E& other)
{
value /= other;
return *this;
}
/*
* \brief The actual ratio, as a double.
*/
double value = 0;
};
constexpr Ratio operator "" _r(const long double ratio)
{
return Ratio(ratio);
}
}
#endif //RATIO_H |
Add low and upper bound values for rocksdb::PerfLevel enum | // Copyright (c) 2011-present, Facebook, Inc. All rights reserved.
// This source code is licensed under the BSD-style license found in the
// LICENSE file in the root directory of this source tree. An additional grant
// of patent rights can be found in the PATENTS file in the same directory.
#ifndef INCLUDE_ROCKSDB_PERF_LEVEL_H_
#define INCLUDE_ROCKSDB_PERF_LEVEL_H_
#include <stdint.h>
#include <string>
namespace rocksdb {
// How much perf stats to collect. Affects perf_context and iostats_context.
enum PerfLevel {
kDisable = 0, // disable perf stats
kEnableCount = 1, // enable only count stats
kEnableTimeExceptForMutex = 2, // Other than count stats, also enable time
// stats except for mutexes
kEnableTime = 3 // enable count and time stats
};
// set the perf stats level for current thread
void SetPerfLevel(PerfLevel level);
// get current perf stats level for current thread
PerfLevel GetPerfLevel();
} // namespace rocksdb
#endif // INCLUDE_ROCKSDB_PERF_LEVEL_H_
| // Copyright (c) 2011-present, Facebook, Inc. All rights reserved.
// This source code is licensed under the BSD-style license found in the
// LICENSE file in the root directory of this source tree. An additional grant
// of patent rights can be found in the PATENTS file in the same directory.
#ifndef INCLUDE_ROCKSDB_PERF_LEVEL_H_
#define INCLUDE_ROCKSDB_PERF_LEVEL_H_
#include <stdint.h>
#include <string>
namespace rocksdb {
// How much perf stats to collect. Affects perf_context and iostats_context.
enum PerfLevel : char {
kUninitialized = -1, // unknown setting
kDisable = 0, // disable perf stats
kEnableCount = 1, // enable only count stats
kEnableTimeExceptForMutex = 2, // Other than count stats, also enable time
// stats except for mutexes
kEnableTime = 3, // enable count and time stats
kOutOfBounds = 4 // N.B. Must always be the last value!
};
// set the perf stats level for current thread
void SetPerfLevel(PerfLevel level);
// get current perf stats level for current thread
PerfLevel GetPerfLevel();
} // namespace rocksdb
#endif // INCLUDE_ROCKSDB_PERF_LEVEL_H_
|
Move SK_API from namespace to function | /*
* Copyright 2017 Google Inc.
*
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
#ifndef SkWebpEncoder_DEFINED
#define SkWebpEncoder_DEFINED
#include "SkEncoder.h"
class SkWStream;
namespace SK_API SkWebpEncoder {
struct Options {
/**
* |fQuality| must be in [0.0f, 100.0f] where 0.0f corresponds to the lowest quality.
*/
float fQuality = 100.0f;
/**
* If the input is premultiplied, this controls the unpremultiplication behavior.
* The encoder can convert to linear before unpremultiplying or ignore the transfer
* function and unpremultiply the input as is.
*/
SkTransferFunctionBehavior fUnpremulBehavior = SkTransferFunctionBehavior::kRespect;
};
/**
* Encode the |src| pixels to the |dst| stream.
* |options| may be used to control the encoding behavior.
*
* Returns true on success. Returns false on an invalid or unsupported |src|.
*/
bool Encode(SkWStream* dst, const SkPixmap& src, const Options& options);
};
#endif
| /*
* Copyright 2017 Google Inc.
*
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
#ifndef SkWebpEncoder_DEFINED
#define SkWebpEncoder_DEFINED
#include "SkEncoder.h"
class SkWStream;
namespace SkWebpEncoder {
struct SK_API Options {
/**
* |fQuality| must be in [0.0f, 100.0f] where 0.0f corresponds to the lowest quality.
*/
float fQuality = 100.0f;
/**
* If the input is premultiplied, this controls the unpremultiplication behavior.
* The encoder can convert to linear before unpremultiplying or ignore the transfer
* function and unpremultiply the input as is.
*/
SkTransferFunctionBehavior fUnpremulBehavior = SkTransferFunctionBehavior::kRespect;
};
/**
* Encode the |src| pixels to the |dst| stream.
* |options| may be used to control the encoding behavior.
*
* Returns true on success. Returns false on an invalid or unsupported |src|.
*/
SK_API bool Encode(SkWStream* dst, const SkPixmap& src, const Options& options);
};
#endif
|
Add test for spool path construction | #include <glib.h>
#include <stdlib.h>
#include <stdint.h>
#include <string.h>
#include "../marquise.h"
extern uint8_t valid_namespace(char *namespace);
extern char* build_spool_path(const char *spool_prefix, char *namespace);
void test_valid_namespace() {
int ret = valid_namespace("abcdefghijklmn12345");
g_assert_cmpint(ret, ==, 1);
}
void test_invalid_namespace() {
int ret = valid_namespace("a_b");
g_assert_cmpint(ret, ==, 0);
}
int main(int argc, char **argv) {
g_test_init(&argc, &argv, NULL);
g_test_add_func("/valid_namespace/valid", test_valid_namespace);
g_test_add_func("/valid_namespace/invalid", test_invalid_namespace);
return g_test_run();
}
| #include <glib.h>
#include <stdlib.h>
#include <stdint.h>
#include <string.h>
#include "../marquise.h"
extern uint8_t valid_namespace(char *namespace);
extern char* build_spool_path(const char *spool_prefix, char *namespace);
void test_valid_namespace() {
int ret = valid_namespace("abcdefghijklmn12345");
g_assert_cmpint(ret, ==, 1);
}
void test_invalid_namespace() {
int ret = valid_namespace("a_b");
g_assert_cmpint(ret, ==, 0);
}
void test_build_spool_path() {
char *spool_path = build_spool_path("/tmp", "marquisetest");
char *expected_path = "/tmp/marquisetest/";
size_t expected_len = strlen(expected_path);
int i;
for (i=0; i < expected_len; i++) {
if (expected_path[i] != spool_path[i]) {
printf("Got path %s, expected path with prefix %s\n", spool_path, expected_path);
g_test_fail();
}
}
}
int main(int argc, char **argv) {
g_test_init(&argc, &argv, NULL);
g_test_add_func("/valid_namespace/valid", test_valid_namespace);
g_test_add_func("/valid_namespace/invalid", test_invalid_namespace);
g_test_add_func("/build_spool_path/path", test_build_spool_path);
return g_test_run();
}
|
Add basic setup for Elixir binding | // Regular C libs
#include <stdio.h>
// Elixir libs -- clang doesn't know where the hell this is
#include "erl_nif.h"
static ERL_NIF_TERM hello(ErlNifEnv *env, int argc, const ERL_NIF_TERM argv[]) {
}
| // Regular C libs
#include <stdio.h>
// Elixir libs -- clang doesn't know where the hell this is
#include "erl_nif.h"
// Needs to figure out what ERL_NIF_TERM means
static ERL_NIF_TERM hello(ErlNifEnv *env, int argc, const ERL_NIF_TERM argv[]) {
}
static ErlNifFuncs funcs[] = {
{"hello", 2, hello}
};
ERL_NIF_INIT(Elixir.Hello, funcs, &hello)
|
Add feedseek example to API docs. | /** \defgroup mpg123_examples example programs using libmpg123
@{ */
/** \file mpg123_to_wav.c A simple MPEG audio to WAV converter using libmpg123 (read) and libsndfile (write).
...an excersize on two simple APIs. */
/** \file mpglib.c Example program mimicking the old mpglib test program.
It takes an MPEG bitstream from standard input and writes raw audio to standard output.
This is an use case of the mpg123_decode() in and out function in the feeder mode, quite close to classic mpglib usage and thus a template to convert from that to libmpg123.
*/
/** \file scan.c Example program that examines the exact length of an MPEG file.
It opens a list of files and does mpg123_scan() on each and reporting the mpg123_length() before and after that. */
/** \file id3dump.c Parse ID3 info and print to standard output. */
/* @} */
| /** \defgroup mpg123_examples example programs using libmpg123
@{ */
/** \file mpg123_to_wav.c A simple MPEG audio to WAV converter using libmpg123 (read) and libsndfile (write).
...an excersize on two simple APIs. */
/** \file mpglib.c Example program mimicking the old mpglib test program.
It takes an MPEG bitstream from standard input and writes raw audio to standard output.
This is an use case of the mpg123_decode() in and out function in the feeder mode, quite close to classic mpglib usage and thus a template to convert from that to libmpg123.
*/
/** \file scan.c Example program that examines the exact length of an MPEG file.
It opens a list of files and does mpg123_scan() on each and reporting the mpg123_length() before and after that. */
/** \file id3dump.c Parse ID3 info and print to standard output. */
/** \file feedseek.c Fuzzy feeder seeking. */
/* @} */
|
Update the App Users documentation links | //
// BOXAPIAccessTokenDelegate.h
// BoxContentSDK
//
// Created by Andrew Chun on 6/6/15.
// Copyright (c) 2015 Box. All rights reserved.
//
/**
* App Users are full-featured enterprise Box accounts that belong to your application not a Box user. Unlike typical Box accounts,
* these accounts do not have an associated login and can only be accessed through the Content API by the controlling application
* and associated Box User ID. This new user model allows your application to take advantage of groups, permissions, collaborations,
* comments, tasks, and the many other features offered by the Box platform.
*
* For more information the documentation is linked below.
* https://developers.box.com/developer-edition/#app_users
*
* BOXAPIAccessTokenDelegate allows developers to make network calls to their own servers to retrieve an access token
* outside of the normal means of authentication (OAuth2).
*
* BOXAPIAccessTokenDelegate is a protocol that should only be conformed to if App Users is being used.
*/
@protocol BOXAPIAccessTokenDelegate <NSObject>
/**
* The method is meant to be used to make network requests to acquire access tokens and access token expiration dates.
*/
- (void)fetchAccessTokenWithCompletion:(void (^)(NSString *accessToken, NSDate *accessTokenExpiration, NSError *error))completion;
@end | //
// BOXAPIAccessTokenDelegate.h
// BoxContentSDK
//
// Created by Andrew Chun on 6/6/15.
// Copyright (c) 2015 Box. All rights reserved.
//
/**
* App Users are full-featured enterprise Box accounts that belong to your application not a Box user. Unlike typical Box accounts,
* these accounts do not have an associated login and can only be accessed through the Content API by the controlling application
* and associated Box User ID. This new user model allows your application to take advantage of groups, permissions, collaborations,
* comments, tasks, and the many other features offered by the Box platform.
*
* For more information the documentation is linked below.
* https://developer.box.com/docs/app-users and https://developer.box.com/docs/service-account
*
* BOXAPIAccessTokenDelegate allows developers to make network calls to their own servers to retrieve an access token
* outside of the normal means of authentication (OAuth2).
*
* BOXAPIAccessTokenDelegate is a protocol that should only be conformed to if App Users is being used.
*/
@protocol BOXAPIAccessTokenDelegate <NSObject>
/**
* The method is meant to be used to make network requests to acquire access tokens and access token expiration dates.
*/
- (void)fetchAccessTokenWithCompletion:(void (^)(NSString *accessToken, NSDate *accessTokenExpiration, NSError *error))completion;
@end
|
Allow local mass and mass to be set separately by form | inherit "/lib/string/sprint";
inherit "../support";
static string thing_form(object obj)
{
string buffer;
buffer = "<h1>Object form</h1>\n";
buffer += "<form action=\"object.lpc?obj=" + object2string(obj) + "\" method=\"post\">\n";
buffer += "<p>Mass: <input type=\"text\" name=\"mass\" value=\"" + mixed_sprint(obj->query_mass()) + "\"/></p><br />\n";
buffer += "<input type=\"submit\" value=\"change mass\" />\n";
buffer += "</form>\n";
return buffer;
}
| inherit "/lib/string/sprint";
inherit "../support";
static string thing_form(object obj)
{
string buffer;
buffer = "<h1>Object form</h1>\n";
buffer += "<form action=\"object.lpc?obj=" + object2string(obj) + "\" method=\"post\">\n";
buffer += "Mass: <input type=\"text\" name=\"mass\" value=\"" + mixed_sprint(obj->query_mass()) + "\"/>\n";
buffer += "<input type=\"submit\" value=\"change mass\" />\n";
buffer += "</form>\n";
buffer += "<form action=\"object.lpc?obj=" + object2string(obj) + "\" method=\"post\">\n";
buffer += "Local mass: <input type=\"text\" name=\"localmass\" value=\"" + mixed_sprint(obj->query_local_mass()) + "\"/>\n";
buffer += "<input type=\"submit\" value=\"change local mass\" />\n";
buffer += "</form>\n";
return buffer;
}
|
Check for EISDIR error as well. Fixed problems with BSD/OS. | /* Copyright (c) 2003 Timo Sirainen */
#include "lib.h"
#include "mkdir-parents.h"
#include <sys/stat.h>
int mkdir_parents(const char *path, mode_t mode)
{
const char *p;
if (mkdir(path, mode) < 0 && errno != EEXIST) {
if (errno != ENOENT)
return -1;
p = strrchr(path, '/');
if (p == NULL || p == path)
return -1; /* shouldn't happen */
t_push();
if (mkdir_parents(t_strdup_until(path, p), mode) < 0) {
t_pop();
return -1;
}
t_pop();
/* should work now */
if (mkdir(path, mode) < 0 && errno != EEXIST)
return -1;
}
return 0;
}
| /* Copyright (c) 2003 Timo Sirainen */
#include "lib.h"
#include "mkdir-parents.h"
#include <sys/stat.h>
int mkdir_parents(const char *path, mode_t mode)
{
const char *p;
/* EISDIR check is for BSD/OS which returns it if path contains '/'
at the end and it exists. */
if (mkdir(path, mode) < 0 && errno != EEXIST && errno != EISDIR) {
if (errno != ENOENT)
return -1;
p = strrchr(path, '/');
if (p == NULL || p == path)
return -1; /* shouldn't happen */
t_push();
if (mkdir_parents(t_strdup_until(path, p), mode) < 0) {
t_pop();
return -1;
}
t_pop();
/* should work now */
if (mkdir(path, mode) < 0 && errno != EEXIST)
return -1;
}
return 0;
}
|
Change int to long long | /**
* @copyright Copyright 2016 The J-PET Framework Authors. All rights reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may find a copy of the License in the LICENCE file.
*
* 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.
*
* @file JPetReaderInterface.h
*/
#ifndef JPETREADERINTERFACE_H
#define JPETREADERINTERFACE_H
#include <TNamed.h> // for Event typedef
class JPetReaderInterface {
public:
typedef TObject MyEvent;
virtual ~JPetReaderInterface() {;}
virtual MyEvent& getCurrentEvent()=0;
virtual bool nextEvent()=0;
virtual bool firstEvent()=0;
virtual bool lastEvent()=0;
virtual bool nthEvent(int n)=0;
virtual long long getCurrentEventNumber() const =0;
virtual long long getNbOfAllEvents() const =0;
virtual TObject* getObjectFromFile(const char* name)=0;
virtual bool openFileAndLoadData(const char* filename, const char* treename)=0;
virtual void closeFile()=0;
};
#endif /* !JPETREADERINTERFACE_H */
| /**
* @copyright Copyright 2016 The J-PET Framework Authors. All rights reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may find a copy of the License in the LICENCE file.
*
* 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.
*
* @file JPetReaderInterface.h
*/
#ifndef JPETREADERINTERFACE_H
#define JPETREADERINTERFACE_H
#include <TNamed.h> // for Event typedef
class JPetReaderInterface {
public:
typedef TObject MyEvent;
virtual ~JPetReaderInterface() {;}
virtual MyEvent& getCurrentEvent()=0;
virtual bool nextEvent()=0;
virtual bool firstEvent()=0;
virtual bool lastEvent()=0;
virtual bool nthEvent(long long int n)=0;
virtual long long getCurrentEventNumber() const =0;
virtual long long getNbOfAllEvents() const =0;
virtual TObject* getObjectFromFile(const char* name)=0;
virtual bool openFileAndLoadData(const char* filename, const char* treename)=0;
virtual void closeFile()=0;
};
#endif /* !JPETREADERINTERFACE_H */
|
Add an optional command line parameter to demostrate a custom form field | /*
* Sample MPI "hello world" application in C
*
* J. Hursey
*
*/
#include <stdio.h>
#include "mpi.h"
int main(int argc, char* argv[])
{
int rank, size, len;
char processor[MPI_MAX_PROCESSOR_NAME];
/*
* Initialize the MPI library
*/
MPI_Init(&argc, &argv);
/*
* Get my 'rank' (unique ID)
*/
MPI_Comm_rank(MPI_COMM_WORLD, &rank);
/*
* Get the size of the world (How many other 'processes' are there)
*/
MPI_Comm_size(MPI_COMM_WORLD, &size);
/*
* Get the processor name (usually the hostname)
*/
MPI_Get_processor_name(processor, &len);
/*
* Print a message from this process
*/
printf("Hello, world! I am %2d of %d on %s!\n", rank, size, processor);
/*
* Shutdown the MPI library before exiting
*/
MPI_Finalize();
return 0;
}
| /*
* Sample MPI "hello world" application in C
*
* J. Hursey
*
*/
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include "mpi.h"
int main(int argc, char* argv[])
{
int rank, size, len;
char processor[MPI_MAX_PROCESSOR_NAME];
char *name = NULL;
/*
* Initialize the MPI library
*/
MPI_Init(&argc, &argv);
/*
* Check to see if we have a command line argument for the name
*/
if( argc > 1 ) {
name = strdup(argv[1]);
}
else {
name = strdup("World");
}
/*
* Get my 'rank' (unique ID)
*/
MPI_Comm_rank(MPI_COMM_WORLD, &rank);
/*
* Get the size of the world (How many other 'processes' are there)
*/
MPI_Comm_size(MPI_COMM_WORLD, &size);
/*
* Get the processor name (usually the hostname)
*/
MPI_Get_processor_name(processor, &len);
/*
* Print a message from this process
*/
printf("Hello, %s! I am %2d of %d on %s!\n", name, rank, size, processor);
/*
* Shutdown the MPI library before exiting
*/
MPI_Finalize();
/*
* Cleanup
*/
if( NULL != name ) {
free(name);
name = NULL;
}
return 0;
}
|
Handle C11 compilers witout stdalign | #ifndef PSTDALIGN_H
#define PSTDALIGN_H
#ifndef __alignas_is_defined
#ifndef __cplusplus
#if (defined(__STDC__) && __STDC__ && defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L)
/* C11 or newer */
#include <stdalign.h>
#else
#if defined(__GNUC__) || defined (__IBMC__) || defined(__clang__)
#define _Alignas(t) __attribute__((__aligned__(t)))
#define _Alignof(t) __alignof__(t)
#elif defined(_MSC_VER)
#define _Alignas(t) __declspec (align(t))
#define _Alignof(t) __alignof(t)
#else
#error please update pstdalign.h with support for current compiler
#endif
#define alignas _Alignas
#define alignof _Alignof
#define __alignas_is_defined 1
#define __alignof_is_defined 1
#endif /* __STDC_VERSION__ */
#endif /* __cplusplus */
#endif /* __alignas__is_defined */
#endif /* PSTDALIGN_H */
| #ifndef PSTDALIGN_H
#define PSTDALIGN_H
#ifndef __alignas_is_defined
#ifndef __cplusplus
#if ((__GNUC__ < 4) || (__GNUC__ == 4 && __GNUC_MINOR__ < 7)) || defined(__IBMC__)
#undef PORTABLE_C11_STDALIGN_MISSING
#define PORTABLE_C11_STDALIGN_MISSING
#endif
#if (defined(__STDC__) && __STDC__ && defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L) && \
!defined(PORTABLE_C11_STDALIGN_MISSING)
/* C11 or newer */
#include <stdalign.h>
#else
#if defined(__GNUC__) || defined (__IBMC__) || defined(__clang__)
#define _Alignas(t) __attribute__((__aligned__(t)))
#define _Alignof(t) __alignof__(t)
#elif defined(_MSC_VER)
#define _Alignas(t) __declspec (align(t))
#define _Alignof(t) __alignof(t)
#define alignas _Alignas
#define alignof _Alignof
#define __alignas_is_defined 1
#define __alignof_is_defined 1
#else
#error please update pstdalign.h with support for current compiler
#endif
#endif /* __STDC__ */
#endif /* __cplusplus */
#endif /* __alignas__is_defined */
#endif /* PSTDALIGN_H */
|
Correct initialisation of cull back faces. | //
// Created by Asger Nyman Christiansen on 08/01/2017.
// Copyright © 2017 Asger Nyman Christiansen. All rights reserved.
//
#pragma once
namespace gle
{
class GLState
{
public:
static void cull_back_faces(bool enable)
{
static bool currently_enabled = true;
if(currently_enabled != enable)
{
if(enable)
{
glEnable(GL_CULL_FACE);
glCullFace(GL_BACK);
}
else {
glDisable(GL_CULL_FACE);
}
currently_enabled = enable;
}
}
static void depth_test(bool enable)
{
static bool currently_enabled = false;
if(currently_enabled != enable)
{
if(enable)
{
glEnable(GL_DEPTH_TEST);
}
else {
glDisable(GL_DEPTH_TEST);
}
currently_enabled = enable;
}
}
static void depth_write(bool enable)
{
static bool currently_enabled = true;
if(currently_enabled != enable)
{
if(enable)
{
glDepthMask(GL_TRUE);
}
else {
glDepthMask(GL_FALSE);
}
currently_enabled = enable;
}
}
};
}
| //
// Created by Asger Nyman Christiansen on 08/01/2017.
// Copyright © 2017 Asger Nyman Christiansen. All rights reserved.
//
#pragma once
namespace gle
{
class GLState
{
public:
static void cull_back_faces(bool enable)
{
static bool currently_enabled = false;
if(currently_enabled != enable)
{
if(enable)
{
glEnable(GL_CULL_FACE);
glCullFace(GL_BACK);
}
else {
glDisable(GL_CULL_FACE);
}
currently_enabled = enable;
}
}
static void depth_test(bool enable)
{
static bool currently_enabled = false;
if(currently_enabled != enable)
{
if(enable)
{
glEnable(GL_DEPTH_TEST);
}
else {
glDisable(GL_DEPTH_TEST);
}
currently_enabled = enable;
}
}
static void depth_write(bool enable)
{
static bool currently_enabled = true;
if(currently_enabled != enable)
{
if(enable)
{
glDepthMask(GL_TRUE);
}
else {
glDepthMask(GL_FALSE);
}
currently_enabled = enable;
}
}
};
}
|
Fix temp profile setpoint interpolation. |
#include "temp_profile.h"
#include "sntp.h"
float
temp_profile_get_current_setpoint(const temp_profile_t* profile)
{
int i;
uint32_t duration_into_profile = sntp_get_time() - profile->start_time;
uint32_t step_begin = 0;
float last_temp = profile->start_value.value;
for (i = 0; i < profile->num_steps; ++i) {
const temp_profile_step_t* step = &profile->steps[i];
uint32_t step_end = step_begin + step[i].duration;
if (duration_into_profile >= step_begin &&
duration_into_profile < step_end) {
if (step->type == STEP_HOLD)
return step->value.value;
else {
return last_temp + ((last_temp - step->value.value) * (now - profile->start_time - step_begin) / step->duration);
}
}
step_begin += step->duration;
}
return profile->steps[profile->num_steps-1].value.value;
}
|
#include "temp_profile.h"
#include "sntp.h"
float
temp_profile_get_current_setpoint(const temp_profile_t* profile)
{
int i;
uint32_t duration_into_profile = sntp_get_time() - profile->start_time;
uint32_t step_begin = 0;
float last_temp = profile->start_value.value;
for (i = 0; i < profile->num_steps; ++i) {
const temp_profile_step_t* step = &profile->steps[i];
uint32_t step_end = step_begin + step[i].duration;
if (duration_into_profile >= step_begin &&
duration_into_profile < step_end) {
if (step->type == STEP_HOLD)
return step->value.value;
else {
uint32_t duration_into_step = duration_into_profile - step_begin;
return last_temp + ((last_temp - step->value.value) * duration_into_step / step->duration);
}
}
step_begin += step->duration;
}
return profile->steps[profile->num_steps-1].value.value;
}
|
Fix up missing newlines at eof | @interface ChromeBluetooth : CDVPlugin {
}
#pragma mark chrome.bluetoothLowEnergy interface
// chrome.bluetooth and chrome.bluetoothLowEnergy uses same file because connect, and disconnect
// a deivce requires the same instance of CBCentralManager that found the device.
- (void)connect:(CDVInvokedUrlCommand*)command;
- (void)disconnect:(CDVInvokedUrlCommand*)command;
- (void)getService:(CDVInvokedUrlCommand*)command;
- (void)getServices:(CDVInvokedUrlCommand*)command;
- (void)getCharacteristic:(CDVInvokedUrlCommand*)command;
- (void)getCharacteristics:(CDVInvokedUrlCommand*)command;
- (void)getIncludedServices:(CDVInvokedUrlCommand*)command;
- (void)getDescriptor:(CDVInvokedUrlCommand*)command;
- (void)getDescriptors:(CDVInvokedUrlCommand*)command;
- (void)readCharacteristicValue:(CDVInvokedUrlCommand*)command;
- (void)writeCharacteristicValue:(CDVInvokedUrlCommand*)command;
- (void)startCharacteristicNotifications:(CDVInvokedUrlCommand*)command;
- (void)stopCharacteristicNotifications:(CDVInvokedUrlCommand*)command;
- (void)readDescriptorValue:(CDVInvokedUrlCommand*)command;
- (void)writeDescriptorValue:(CDVInvokedUrlCommand*)command;
- (void)registerBluetoothLowEnergyEvents:(CDVInvokedUrlCommand*)command;
@end | @interface ChromeBluetooth : CDVPlugin {
}
#pragma mark chrome.bluetoothLowEnergy interface
// chrome.bluetooth and chrome.bluetoothLowEnergy uses same file because connect, and disconnect
// a deivce requires the same instance of CBCentralManager that found the device.
- (void)connect:(CDVInvokedUrlCommand*)command;
- (void)disconnect:(CDVInvokedUrlCommand*)command;
- (void)getService:(CDVInvokedUrlCommand*)command;
- (void)getServices:(CDVInvokedUrlCommand*)command;
- (void)getCharacteristic:(CDVInvokedUrlCommand*)command;
- (void)getCharacteristics:(CDVInvokedUrlCommand*)command;
- (void)getIncludedServices:(CDVInvokedUrlCommand*)command;
- (void)getDescriptor:(CDVInvokedUrlCommand*)command;
- (void)getDescriptors:(CDVInvokedUrlCommand*)command;
- (void)readCharacteristicValue:(CDVInvokedUrlCommand*)command;
- (void)writeCharacteristicValue:(CDVInvokedUrlCommand*)command;
- (void)startCharacteristicNotifications:(CDVInvokedUrlCommand*)command;
- (void)stopCharacteristicNotifications:(CDVInvokedUrlCommand*)command;
- (void)readDescriptorValue:(CDVInvokedUrlCommand*)command;
- (void)writeDescriptorValue:(CDVInvokedUrlCommand*)command;
- (void)registerBluetoothLowEnergyEvents:(CDVInvokedUrlCommand*)command;
@end
|
Use getloadavg() instead of using /proc, patch by Baptiste Daroussin | // vim:ts=8:expandtab
#include "i3status.h"
const char *get_load() {
static char part[512];
/* Get load */
#ifdef LINUX
slurp("/proc/loadavg", part, sizeof(part));
*skip_character(part, ' ', 3) = '\0';
#else
/* TODO: correctly check for NetBSD, check if it works the same on *BSD */
struct loadavg load;
size_t length = sizeof(struct loadavg);
int mib[2] = { CTL_VM, VM_LOADAVG };
if (sysctl(mib, 2, &load, &length, NULL, 0) < 0)
die("Could not sysctl({ CTL_VM, VM_LOADAVG })\n");
double scale = load.fscale;
(void)snprintf(part, sizeof(part), "%.02f %.02f %.02f",
(double)load.ldavg[0] / scale,
(double)load.ldavg[1] / scale,
(double)load.ldavg[2] / scale);
#endif
return part;
}
| // vim:ts=8:expandtab
#include "i3status.h"
#include <err.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
const char *get_load() {
static char part[512];
/* Get load */
#if defined(__FreeBSD__) || defined(linux) || defined(__OpenBSD__) || defined(__NetBSD__) || defined(__APPLE__) || defined(sun)
double loadavg[3];
if (getloadavg(loadavg, 3) == -1)
errx(-1, "getloadavg() failed\n");
(void)snprintf(part, sizeof(part), "%1.2f %1.2f %1.2f", loadavg[0], loadavg[1], loadavg[2]);
#else
part[0] = '\0';
#endif
return part;
}
|
Add generated file so that hg HEAD can be used with cmake. | /*
This file was generated automatically by ./make_zip_err_str.sh
from ./zip.h; make changes there.
*/
#include "zipint.h"
const char * const _zip_err_str[] = {
"No error",
"Multi-disk zip archives not supported",
"Renaming temporary file failed",
"Closing zip archive failed",
"Seek error",
"Read error",
"Write error",
"CRC error",
"Containing zip archive was closed",
"No such file",
"File already exists",
"Can't open file",
"Failure to create temporary file",
"Zlib error",
"Malloc failure",
"Entry has been changed",
"Compression method not supported",
"Premature EOF",
"Invalid argument",
"Not a zip archive",
"Internal error",
"Zip archive inconsistent",
"Can't remove file",
"Entry has been deleted",
"Encryption method not supported",
"Read-only archive",
"No password provided",
"Wrong password provided",
};
const int _zip_nerr_str = sizeof(_zip_err_str)/sizeof(_zip_err_str[0]);
#define N ZIP_ET_NONE
#define S ZIP_ET_SYS
#define Z ZIP_ET_ZLIB
const int _zip_err_type[] = {
N,
N,
S,
S,
S,
S,
S,
N,
N,
N,
N,
S,
S,
Z,
N,
N,
N,
N,
N,
N,
N,
N,
S,
N,
N,
N,
N,
N,
};
| |
Build if GETC_MACRO use is disabled | /* Copyright (C) 2004 Manuel Novoa III <mjn3@codepoet.org>
*
* GNU Library General Public License (LGPL) version 2 or later.
*
* Dedicated to Toni. See uClibc/DEDICATION.mjn3 for details.
*/
#include "_stdio.h"
link_warning(gets, "the 'gets' function is dangerous and should not be used.")
/* UNSAFE FUNCTION -- do not bother optimizing */
libc_hidden_proto(getchar_unlocked)
libc_hidden_proto(__fgetc_unlocked)
libc_hidden_proto(__stdin)
char *gets(char *s)
{
register char *p = s;
int c;
__STDIO_AUTO_THREADLOCK_VAR;
__STDIO_AUTO_THREADLOCK(stdin);
/* Note: don't worry about performance here... this shouldn't be used!
* Therefore, force actual function call. */
while (((c = getchar_unlocked()) != EOF) && ((*p = c) != '\n')) {
++p;
}
if ((c == EOF) || (s == p)) {
s = NULL;
} else {
*p = 0;
}
__STDIO_AUTO_THREADUNLOCK(stdin);
return s;
}
| /* Copyright (C) 2004 Manuel Novoa III <mjn3@codepoet.org>
*
* GNU Library General Public License (LGPL) version 2 or later.
*
* Dedicated to Toni. See uClibc/DEDICATION.mjn3 for details.
*/
#include "_stdio.h"
link_warning(gets, "the 'gets' function is dangerous and should not be used.")
/* UNSAFE FUNCTION -- do not bother optimizing */
libc_hidden_proto(getchar_unlocked)
libc_hidden_proto(__fgetc_unlocked)
#ifdef __STDIO_GETC_MACRO
libc_hidden_proto(__stdin)
#else
#define __stdin stdin
#endif
char *gets(char *s)
{
register char *p = s;
int c;
__STDIO_AUTO_THREADLOCK_VAR;
__STDIO_AUTO_THREADLOCK(stdin);
/* Note: don't worry about performance here... this shouldn't be used!
* Therefore, force actual function call. */
while (((c = getchar_unlocked()) != EOF) && ((*p = c) != '\n')) {
++p;
}
if ((c == EOF) || (s == p)) {
s = NULL;
} else {
*p = 0;
}
__STDIO_AUTO_THREADUNLOCK(stdin);
return s;
}
|
Add new resource classes to the header. | //
// SVNetworking.h
// SVNetworking
//
// Created by Nate Stedman on 3/14/14.
// Copyright (c) 2014 Svpply. All rights reserved.
//
#import <SVNetworking/NSObject+SVBindings.h>
#import <SVNetworking/NSObject+SVMultibindings.h>
#import <SVNetworking/SVDataRequest.h>
#import <SVNetworking/SVDiskCache.h>
#import <SVNetworking/SVFunctional.h>
#import <SVNetworking/SVJSONRequest.h>
#import <SVNetworking/SVRemoteImage.h>
#import <SVNetworking/SVRemoteDataResource.h>
#import <SVNetworking/SVRemoteJSONResource.h>
#import <SVNetworking/SVRemoteResource.h>
#import <SVNetworking/SVRequest.h>
| //
// SVNetworking.h
// SVNetworking
//
// Created by Nate Stedman on 3/14/14.
// Copyright (c) 2014 Svpply. All rights reserved.
//
#import <SVNetworking/NSObject+SVBindings.h>
#import <SVNetworking/NSObject+SVMultibindings.h>
#import <SVNetworking/SVDataRequest.h>
#import <SVNetworking/SVDiskCache.h>
#import <SVNetworking/SVFunctional.h>
#import <SVNetworking/SVJSONRequest.h>
#import <SVNetworking/SVRemoteImage.h>
#import <SVNetworking/SVRemoteDataRequestResource.h>
#import <SVNetworking/SVRemoteDataResource.h>
#import <SVNetworking/SVRemoteJSONRequestResource.h>
#import <SVNetworking/SVRemoteJSONResource.h>
#import <SVNetworking/SVRemoteResource.h>
#import <SVNetworking/SVRequest.h>
|
Make this test portable to non-x86 hosts, patch by Mark Cianciosa! | // Test this without pch.
// RUN: clang-cc -include %S/asm.h -fsyntax-only -verify %s &&
// Test with pch.
// RUN: clang-cc -emit-pch -o %t %S/asm.h &&
// RUN: clang-cc -include-pch %t -fsyntax-only -verify %s
void call_f(void) { f(); }
void call_clobbers(void) { clobbers(); }
| // Test this without pch.
// RUN: clang-cc -triple i386-unknown-unknown -include %S/asm.h -fsyntax-only -verify %s &&
// Test with pch.
// RUN: clang-cc -triple i386-unknown-unknown -emit-pch -o %t %S/asm.h &&
// RUN: clang-cc -triple i386-unknown-unknown -include-pch %t -fsyntax-only -verify %s
void call_f(void) { f(); }
void call_clobbers(void) { clobbers(); }
|
Remove function now implemented in kremlib | #include <stdio.h>
#include <stdlib.h>
#include <inttypes.h>
#include "Server.h"
char char_of_uint8(uint8_t x) {
return (char) x;
}
uint32_t bufstrcpy(char *dst, const char *src) {
/* The F* precondition guarantees that src is zero-terminated */
return sprintf(dst, "%s", src);
}
uint32_t print_u32(char *dst, uint32_t i) {
return sprintf(dst, "%"PRIu32, i);
}
| #include <stdio.h>
#include <stdlib.h>
#include <inttypes.h>
#include "Server.h"
uint32_t bufstrcpy(char *dst, const char *src) {
/* The F* precondition guarantees that src is zero-terminated */
return sprintf(dst, "%s", src);
}
uint32_t print_u32(char *dst, uint32_t i) {
return sprintf(dst, "%"PRIu32, i);
}
|
Add test case for visibility attributes | #include<stdlib.h>
volatile int i1 __attribute__ ((visibility ("protected")));
volatile int i2 __attribute__ ((visibility ("default")));
volatile int i3 __attribute__ ((visibility ("hidden")));
volatile int i4 __attribute__ ((visibility ("protected")));
volatile int i5 __attribute__ ((visibility ("internal")));
int main() {
i1 = 542;
i2 = 2341;
i3 = 1;
i4 = 4534;
i5 = 12312;
if (i1 != 542) {
abort();
}
if (i2 != 2341) {
abort();
}
if (i3 != 1) {
abort();
}
if (i4 != 4534) {
abort();
}
if (i5 != 12312) {
abort();
}
}
| |
Declare public function in header. | /*
* vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
*/
#ifdef E_TYPEDEFS
#else
#ifndef E_INT_CONFIG_THEME_H
#define E_INT_CONFIG_THEME_H
EAPI E_Config_Dialog *e_int_config_theme(E_Container *con, const char *params __UNUSED__);
EAPI void e_int_config_theme_import_done(E_Config_Dialog *dia);
EAPI void e_int_config_theme_update(E_Config_Dialog *dia, char *file);
#endif
#endif
| /*
* vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
*/
#ifdef E_TYPEDEFS
#else
#ifndef E_INT_CONFIG_THEME_H
#define E_INT_CONFIG_THEME_H
EAPI E_Config_Dialog *e_int_config_theme(E_Container *con, const char *params __UNUSED__);
EAPI void e_int_config_theme_import_done(E_Config_Dialog *dia);
EAPI void e_int_config_theme_update(E_Config_Dialog *dia, char *file);
EAPI void e_int_config_theme_web_done(E_Config_Dialog *dia);
#endif
#endif
|
Correct string length in pseries_of_derive_parent() | #include <linux/string.h>
#include <linux/err.h>
#include <linux/slab.h>
#include <linux/of.h>
#include "of_helpers.h"
/**
* pseries_of_derive_parent - basically like dirname(1)
* @path: the full_name of a node to be added to the tree
*
* Returns the node which should be the parent of the node
* described by path. E.g., for path = "/foo/bar", returns
* the node with full_name = "/foo".
*/
struct device_node *pseries_of_derive_parent(const char *path)
{
struct device_node *parent;
char *parent_path = "/";
const char *tail = kbasename(path);
/* reject if path is "/" */
if (!strcmp(path, "/"))
return ERR_PTR(-EINVAL);
if (tail > path + 1) {
parent_path = kstrndup(path, tail - path, GFP_KERNEL);
if (!parent_path)
return ERR_PTR(-ENOMEM);
}
parent = of_find_node_by_path(parent_path);
if (strcmp(parent_path, "/"))
kfree(parent_path);
return parent ? parent : ERR_PTR(-EINVAL);
}
| #include <linux/string.h>
#include <linux/err.h>
#include <linux/slab.h>
#include <linux/of.h>
#include "of_helpers.h"
/**
* pseries_of_derive_parent - basically like dirname(1)
* @path: the full_name of a node to be added to the tree
*
* Returns the node which should be the parent of the node
* described by path. E.g., for path = "/foo/bar", returns
* the node with full_name = "/foo".
*/
struct device_node *pseries_of_derive_parent(const char *path)
{
struct device_node *parent;
char *parent_path = "/";
const char *tail;
/* We do not want the trailing '/' character */
tail = kbasename(path) - 1;
/* reject if path is "/" */
if (!strcmp(path, "/"))
return ERR_PTR(-EINVAL);
if (tail > path) {
parent_path = kstrndup(path, tail - path, GFP_KERNEL);
if (!parent_path)
return ERR_PTR(-ENOMEM);
}
parent = of_find_node_by_path(parent_path);
if (strcmp(parent_path, "/"))
kfree(parent_path);
return parent ? parent : ERR_PTR(-EINVAL);
}
|
Add function to get current green thread at-will |
#include "gc.h"
#include "runtime_vars.h"
#include "scheduler.h"
GC_Env* __get_GC_Env()
{
#ifdef MULTITHREAD
return get_currentthread()->gcEnv;
#else
return currentthread->gcEnv;
#endif
}
|
#include "gc.h"
#include "runtime_vars.h"
#include "scheduler.h"
GC_Env* __get_GC_Env()
{
#ifdef MULTITHREAD
return get_currentthread()->gcEnv;
#else
return currentthread->gcEnv;
#endif
}
ThreadData* __mellow_get_cur_green_thread()
{
#ifdef MULTITHREAD
return get_currentthread();
#else
return currentthread;
#endif
}
|
Expand max share name length to 256 | /*
* include/uapi/linux/cifs/cifs_mount.h
*
* Author(s): Scott Lovenberg (scott.lovenberg@gmail.com)
*
* 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.
*/
#ifndef _CIFS_MOUNT_H
#define _CIFS_MOUNT_H
/* Max string lengths for cifs mounting options. */
#define CIFS_MAX_DOMAINNAME_LEN 256 /* max fully qualified domain name */
#define CIFS_MAX_USERNAME_LEN 256 /* reasonable max for current servers */
#define CIFS_MAX_PASSWORD_LEN 512 /* Windows max seems to be 256 wide chars */
#define CIFS_MAX_SHARE_LEN 80
#endif /* _CIFS_MOUNT_H */
| /*
* include/uapi/linux/cifs/cifs_mount.h
*
* Author(s): Scott Lovenberg (scott.lovenberg@gmail.com)
*
* 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.
*/
#ifndef _CIFS_MOUNT_H
#define _CIFS_MOUNT_H
/* Max string lengths for cifs mounting options. */
#define CIFS_MAX_DOMAINNAME_LEN 256 /* max fully qualified domain name */
#define CIFS_MAX_USERNAME_LEN 256 /* reasonable max for current servers */
#define CIFS_MAX_PASSWORD_LEN 512 /* Windows max seems to be 256 wide chars */
#define CIFS_MAX_SHARE_LEN 256 /* reasonable max share name length */
#endif /* _CIFS_MOUNT_H */
|
Declare C fallbacks in IDCT header. | /*
* Copyright (c) 2010 The WebM project authors. All Rights Reserved.
*
* Use of this source code is governed by a BSD-style license
* that can be found in the LICENSE file in the root of the source
* tree. An additional intellectual property rights grant can be found
* in the file PATENTS. All contributing project authors may
* be found in the AUTHORS file in the root of the source tree.
*/
#include "vp8_opencl.h"
#define CLAMP(x,min,max) if (x < min) x = min; else if ( x > max ) x = max;
const char *idctCompileOptions = "-Ivp8/common/opencl";
const char *idctllm_cl_file_name = "vp8/common/opencl/idctllm_cl.cl";
| /*
* Copyright (c) 2010 The WebM project authors. All Rights Reserved.
*
* Use of this source code is governed by a BSD-style license
* that can be found in the LICENSE file in the root of the source
* tree. An additional intellectual property rights grant can be found
* in the file PATENTS. All contributing project authors may
* be found in the AUTHORS file in the root of the source tree.
*/
#include "vp8_opencl.h"
#define CLAMP(x,min,max) if (x < min) x = min; else if ( x > max ) x = max;
//External functions that are fallbacks if CL is unavailable
void vp8_short_idct4x4llm_c(short *input, short *output, int pitch);
void vp8_short_idct4x4llm_1_c(short *input, short *output, int pitch);
void vp8_dc_only_idct_add_c(short input_dc, unsigned char *pred_ptr, unsigned char *dst_ptr, int pitch, int stride);
void vp8_short_inv_walsh4x4_c(short *input, short *output);
void vp8_short_inv_walsh4x4_1_c(short *input, short *output);
const char *idctCompileOptions = "-Ivp8/common/opencl";
const char *idctllm_cl_file_name = "vp8/common/opencl/idctllm_cl.cl";
|
Expand MCP messages to have user (modeled) and system (magic) types. | #ifndef __PACKET_TYPE_H__
#define __PACKET_TYPE_H__
enum PacketType
{
INVALID,
USER,
SHARED_MEM_REQ,
SHARED_MEM_EVICT,
SHARED_MEM_RESPONSE,
SHARED_MEM_UPDATE_UNEXPECTED,
SHARED_MEM_ACK,
SHARED_MEM_TERMINATE_THREADS,
MCP_REQUEST_TYPE,
MCP_RESPONSE_TYPE,
MCP_UTILIZATION_UPDATE_TYPE,
NUM_PACKET_TYPES
};
// This defines the different static network types
enum EStaticNetwork
{
STATIC_NETWORK_USER,
STATIC_NETWORK_MEMORY,
STATIC_NETWORK_SYSTEM,
NUM_STATIC_NETWORKS
};
// Packets are routed to a static network based on their type. This
// gives the static network to use for a given packet type.
static EStaticNetwork g_type_to_static_network_map[] __attribute__((unused)) =
{
STATIC_NETWORK_SYSTEM, // INVALID
STATIC_NETWORK_USER, // USER
STATIC_NETWORK_MEMORY, // SM_REQ
STATIC_NETWORK_MEMORY, // SM_EVICT
STATIC_NETWORK_MEMORY, // SM_RESPONSE
STATIC_NETWORK_MEMORY, // SM_UPDATE_UNEXPECTED
STATIC_NETWORK_MEMORY, // SM_ACK
STATIC_NETWORK_MEMORY, // SM_TERMINATE_THREADS
STATIC_NETWORK_SYSTEM, // MCP_REQ
STATIC_NETWORK_SYSTEM, // MCP_RESP
STATIC_NETWORK_SYSTEM, // MCP_UTIL
};
#endif
| #ifndef __PACKET_TYPE_H__
#define __PACKET_TYPE_H__
enum PacketType
{
INVALID,
USER,
SHARED_MEM_REQ,
SHARED_MEM_EVICT,
SHARED_MEM_RESPONSE,
SHARED_MEM_UPDATE_UNEXPECTED,
SHARED_MEM_ACK,
SHARED_MEM_TERMINATE_THREADS,
MCP_REQUEST_TYPE,
MCP_RESPONSE_TYPE,
MCP_UTILIZATION_UPDATE_TYPE,
MCP_SYSTEM_TYPE,
NUM_PACKET_TYPES
};
// This defines the different static network types
enum EStaticNetwork
{
STATIC_NETWORK_USER,
STATIC_NETWORK_MEMORY,
STATIC_NETWORK_SYSTEM,
NUM_STATIC_NETWORKS
};
// Packets are routed to a static network based on their type. This
// gives the static network to use for a given packet type.
static EStaticNetwork g_type_to_static_network_map[] __attribute__((unused)) =
{
STATIC_NETWORK_SYSTEM, // INVALID
STATIC_NETWORK_USER, // USER
STATIC_NETWORK_MEMORY, // SM_REQ
STATIC_NETWORK_MEMORY, // SM_EVICT
STATIC_NETWORK_MEMORY, // SM_RESPONSE
STATIC_NETWORK_MEMORY, // SM_UPDATE_UNEXPECTED
STATIC_NETWORK_MEMORY, // SM_ACK
STATIC_NETWORK_MEMORY, // SM_TERMINATE_THREADS
STATIC_NETWORK_USER, // MCP_REQ
STATIC_NETWORK_USER, // MCP_RESP
STATIC_NETWORK_SYSTEM, // MCP_UTIL
STATIC_NETWORK_SYSTEM, // MCP_SYSTEM
};
#endif
|
Remove unnecessary virtual keyword. Lower version number to minimun. | // @(#)root/cont
// Author: Philippe Canal Aug 2013
/*************************************************************************
* Copyright (C) 1995-2013, Rene Brun and Fons Rademakers. *
* All rights reserved. *
* *
* For the licensing terms see $ROOTSYS/LICENSE. *
* For the list of contributors see $ROOTSYS/README/CREDITS. *
*************************************************************************/
#ifndef ROOT_TListOfTypes
#define ROOT_TListOfTypes
//////////////////////////////////////////////////////////////////////////
// //
// TListOfTypes //
// //
// A collection of TDataType designed to hold the typedef information //
// and numerical type information. The collection is populated on //
// demand. //
// //
//////////////////////////////////////////////////////////////////////////
#ifndef ROOT_THastTable
#include "THashTable.h"
#endif
class TDataType;
class TListOfTypes : public THashTable
{
public:
TListOfTypes();
using THashTable::FindObject;
virtual TObject *FindObject(const char *name) const;
virtual TDataType *FindType(const char *name) const;
ClassDef(TListOfTypes,3); // Specical container for the list of types.
};
#endif
| // @(#)root/cont
// Author: Philippe Canal Aug 2013
/*************************************************************************
* Copyright (C) 1995-2013, Rene Brun and Fons Rademakers. *
* All rights reserved. *
* *
* For the licensing terms see $ROOTSYS/LICENSE. *
* For the list of contributors see $ROOTSYS/README/CREDITS. *
*************************************************************************/
#ifndef ROOT_TListOfTypes
#define ROOT_TListOfTypes
//////////////////////////////////////////////////////////////////////////
// //
// TListOfTypes //
// //
// A collection of TDataType designed to hold the typedef information //
// and numerical type information. The collection is populated on //
// demand. //
// //
//////////////////////////////////////////////////////////////////////////
#ifndef ROOT_THastTable
#include "THashTable.h"
#endif
class TDataType;
class TListOfTypes : public THashTable
{
public:
TListOfTypes();
using THashTable::FindObject;
virtual TObject *FindObject(const char *name) const;
TDataType *FindType(const char *name) const;
ClassDef(TListOfTypes,2); // Specical container for the list of types.
};
#endif
|
Add test code for array initialization. | // RUN: clang -checker-simple -verify %s
// RUN: clang -checker-simple -analyzer-store-region -verify %s
struct s {
int data;
int data_array[10];
};
typedef struct {
int data;
} STYPE;
void f(void) {
int a[10];
int (*p)[10];
p = &a;
(*p)[3] = 1;
struct s d;
struct s *q;
q = &d;
q->data = 3;
d.data_array[9] = 17;
}
void f2() {
char *p = "/usr/local";
char (*q)[4];
q = &"abc";
}
void f3() {
STYPE s;
}
| // RUN: clang -checker-simple -verify %s
// RUN: clang -checker-simple -analyzer-store-region -verify %s
struct s {
int data;
int data_array[10];
};
typedef struct {
int data;
} STYPE;
void f(void) {
int a[10];
int (*p)[10];
p = &a;
(*p)[3] = 1;
struct s d;
struct s *q;
q = &d;
q->data = 3;
d.data_array[9] = 17;
}
void f2() {
char *p = "/usr/local";
char (*q)[4];
q = &"abc";
}
void f3() {
STYPE s;
}
void f4() {
int a[] = { 1, 2, 3};
int b[3] = { 1, 2 };
}
|
Update driver version to 5.04.00-k5 | /*
* QLogic iSCSI HBA Driver
* Copyright (c) 2003-2013 QLogic Corporation
*
* See LICENSE.qla4xxx for copyright and licensing details.
*/
#define QLA4XXX_DRIVER_VERSION "5.04.00-k4"
| /*
* QLogic iSCSI HBA Driver
* Copyright (c) 2003-2013 QLogic Corporation
*
* See LICENSE.qla4xxx for copyright and licensing details.
*/
#define QLA4XXX_DRIVER_VERSION "5.04.00-k5"
|
Use BANDIT_CONCAT instead of SNOWHOUSE_CONCAT macro | #ifndef BANDIT_REGISTRATION_REGISTRAR_H
#define BANDIT_REGISTRATION_REGISTRAR_H
#include <bandit/registration/spec_registry.h>
namespace bandit {
namespace detail {
struct spec_registrar {
spec_registrar(std::function<void()> func) {
bandit::detail::specs().push_back(func);
}
};
}
}
#define BANDIT_CONCAT2(a, b) a##b
#define BANDIT_CONCAT(a, b) BANDIT_CONCAT2(a, b)
#define BANDIT_ADD_COUNTER(a) SNOWHOUSE_CONCAT(a, __COUNTER__)
#define go_bandit \
static bandit::detail::spec_registrar BANDIT_ADD_COUNTER(bandit_registrar_)
#define SPEC_BEGIN(name) \
go_bandit([]{
#define SPEC_END \
});
#endif
| #ifndef BANDIT_REGISTRATION_REGISTRAR_H
#define BANDIT_REGISTRATION_REGISTRAR_H
#include <bandit/registration/spec_registry.h>
namespace bandit {
namespace detail {
struct spec_registrar {
spec_registrar(std::function<void()> func) {
bandit::detail::specs().push_back(func);
}
};
}
}
#define BANDIT_CONCAT2(a, b) a##b
#define BANDIT_CONCAT(a, b) BANDIT_CONCAT2(a, b)
#define BANDIT_ADD_COUNTER(a) BANDIT_CONCAT(a, __COUNTER__)
#define go_bandit \
static bandit::detail::spec_registrar BANDIT_ADD_COUNTER(bandit_registrar_)
#define SPEC_BEGIN(name) \
go_bandit([]{
#define SPEC_END \
});
#endif
|
Remove useless explicit keyword on constructors without arguments. | /*
* This file is part of SpeakEasy.
* Copyright (C) 2012 Lambert Clara <lambert.clara@yahoo.fr>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero 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 Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/**
* @file SE_CInputManager.h
* @brief Input devices manager
*
* @author Lambert Clara <lambert.clara@yahoo.fr>
* @date Created : 2012-04-23
*/
#pragma once
#include "SE_IBaseManager.h"
class SE_CInputManager : public SE_IBaseManager
{
public:
explicit SE_CInputManager();
~SE_CInputManager();
void startUp() override;
void shutDown() override;
};
| /*
* This file is part of SpeakEasy.
* Copyright (C) 2012 Lambert Clara <lambert.clara@yahoo.fr>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero 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 Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/**
* @file SE_CInputManager.h
* @brief Input devices manager
*
* @author Lambert Clara <lambert.clara@yahoo.fr>
* @date Created : 2012-04-23
*/
#pragma once
#include "SE_IBaseManager.h"
class SE_CInputManager : public SE_IBaseManager
{
public:
SE_CInputManager();
~SE_CInputManager();
void startUp() override;
void shutDown() override;
};
|
Update the driver version to 8.06.00.12-k. | /*
* QLogic Fibre Channel HBA Driver
* Copyright (c) 2003-2013 QLogic Corporation
*
* See LICENSE.qla2xxx for copyright and licensing details.
*/
/*
* Driver version
*/
#define QLA2XXX_VERSION "8.06.00.08-k"
#define QLA_DRIVER_MAJOR_VER 8
#define QLA_DRIVER_MINOR_VER 6
#define QLA_DRIVER_PATCH_VER 0
#define QLA_DRIVER_BETA_VER 0
| /*
* QLogic Fibre Channel HBA Driver
* Copyright (c) 2003-2013 QLogic Corporation
*
* See LICENSE.qla2xxx for copyright and licensing details.
*/
/*
* Driver version
*/
#define QLA2XXX_VERSION "8.06.00.12-k"
#define QLA_DRIVER_MAJOR_VER 8
#define QLA_DRIVER_MINOR_VER 6
#define QLA_DRIVER_PATCH_VER 0
#define QLA_DRIVER_BETA_VER 0
|
Update this to use a "valid" alignment. | // RUN: %llvmgcc -std=gnu99 %s -S -o - | grep ".*alloca.*align 32"
extern void bar(int[]);
void foo(int a)
{
int var[a] __attribute__((__aligned__(32)));
bar(var);
return;
}
| // RUN: %llvmgcc -std=gnu99 %s -S -o - | grep ".*alloca.*align 16"
extern void bar(int[]);
void foo(int a)
{
int var[a] __attribute__((__aligned__(16)));
bar(var);
return;
}
|
Fix case sensitive import statement | /*
* LastFmPopover.h
*
* Created by Sajid Anwar.
*
* Subject to terms and conditions in LICENSE.md.
*
*/
#import <Cocoa/Cocoa.h>
#import <LastFM/LastFm.h>
#import "LastFmService.h"
#define LASTFM_SIGN_IN_TAG 1
@interface LastFmPopover : NSPopover<NSPopoverDelegate>
@property (retain) IBOutlet LastFmService *service;
- (void)refreshTracks;
@end
| /*
* LastFmPopover.h
*
* Created by Sajid Anwar.
*
* Subject to terms and conditions in LICENSE.md.
*
*/
#import <Cocoa/Cocoa.h>
#import <LastFm/LastFm.h>
#import "LastFmService.h"
#define LASTFM_SIGN_IN_TAG 1
@interface LastFmPopover : NSPopover<NSPopoverDelegate>
@property (retain) IBOutlet LastFmService *service;
- (void)refreshTracks;
@end
|
Use stringWithUTF8String instead of deprecated stringWithCString | //***************************************************************************
extern "C"
{
#import <Cocoa/Cocoa.h>
#import "RWPluginFramework.h"
}
//***************************************************************************
#pragma mark Logging
#if ENABLE_LOGGING
# define Log NSLog
# define LOG_ENTRY NSLog(@"Entered: %s (%@:%d)", __func__, [[NSString stringWithCString:__FILE__] lastPathComponent], __LINE__);
#else
# define Log(...) do { } while(0);
# define LOG_ENTRY do { } while(0);
#endif
//***************************************************************************
@interface Markup : RWAbstractPlugin
{
@public
BOOL usingSmartQuotes;
}
+ (Markup*) sharedMarkupPlugin;
+ (NSBundle*) sharedBundle;
+ (NSArray*) markupStyles;
+ (NSNumber*) markupEnabledForFilterStyleInSelectedRange:(NSString*)markupStyleName;
+ (void) addMarkupMenuItem;
@end
//***************************************************************************
extern const NSString* const kMarkupStyleFilterCommand;
extern const NSString* const kMarkupStyleName;
extern const int kMarkupTextMenuItemTag;
//***************************************************************************
| //***************************************************************************
extern "C"
{
#import <Cocoa/Cocoa.h>
#import "RWPluginFramework.h"
}
//***************************************************************************
#pragma mark Logging
#if ENABLE_LOGGING
# define Log NSLog
# define LOG_ENTRY NSLog(@"Entered: %s (%@:%d)", __func__, [[NSString stringWithUTF8String:__FILE__] lastPathComponent], __LINE__);
#else
# define Log(...) do { } while(0);
# define LOG_ENTRY do { } while(0);
#endif
//***************************************************************************
@interface Markup : RWAbstractPlugin
{
@public
BOOL usingSmartQuotes;
}
+ (Markup*) sharedMarkupPlugin;
+ (NSBundle*) sharedBundle;
+ (NSArray*) markupStyles;
+ (NSNumber*) markupEnabledForFilterStyleInSelectedRange:(NSString*)markupStyleName;
+ (void) addMarkupMenuItem;
@end
//***************************************************************************
extern const NSString* const kMarkupStyleFilterCommand;
extern const NSString* const kMarkupStyleName;
extern const int kMarkupTextMenuItemTag;
//***************************************************************************
|
Add rempa_file_pages function by Will Newton <will.newton@imgtec.com> | /*
* remap_file_pages() for uClibc
*
* Copyright (C) 2008 Will Newton <will.newton@imgtec.com>
*
* Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
*/
#include <sys/syscall.h>
#ifdef __NR_remap_file_pages
_syscall5(int, remap_file_pages, unsigned long, start, unsigned long, size,
unsigned long, prot, unsigned long, pgoff, unsigned long, flags);
#endif
| |
Implement the equivalent of std::unique_ptr using boost::scoped_ptr. | //---------------------------------------------------------------------------
// $Id$
// Version: $Name$
//
// Copyright (C) 2009 by the deal.II authors
//
// This file is subject to QPL and may not be distributed
// without copyright and license information. Please refer
// to the file deal.II/doc/license.html for the text and
// further information on this license.
//
//---------------------------------------------------------------------------
#ifndef __deal2__std_cxx1x_shared_ptr_h
#define __deal2__std_cxx1x_shared_ptr_h
#include <base/config.h>
#ifdef DEAL_II_CAN_USE_CXX1X
# include <memory>
#else
#include <boost/shared_ptr.hpp>
DEAL_II_NAMESPACE_OPEN
namespace std_cxx1x
{
using boost::shared_ptr;
using boost::enable_shared_from_this;
}
DEAL_II_NAMESPACE_CLOSE
#endif
#endif
| //---------------------------------------------------------------------------
// $Id$
// Version: $Name$
//
// Copyright (C) 2009 by the deal.II authors
//
// This file is subject to QPL and may not be distributed
// without copyright and license information. Please refer
// to the file deal.II/doc/license.html for the text and
// further information on this license.
//
//---------------------------------------------------------------------------
#ifndef __deal2__std_cxx1x_shared_ptr_h
#define __deal2__std_cxx1x_shared_ptr_h
#include <base/config.h>
#ifdef DEAL_II_CAN_USE_CXX1X
# include <memory>
#else
#include <boost/shared_ptr.hpp>
#include <boost/scoped_ptr.hpp>
DEAL_II_NAMESPACE_OPEN
namespace std_cxx1x
{
using boost::shared_ptr;
using boost::enable_shared_from_this;
// boost doesn't have boost::unique_ptr,
// but its scoped_ptr comes close so
// re-implement unique_ptr using scoped_ptr
template<class T> class unique_ptr : public boost::scoped_ptr<T>
{
public:
explicit unique_ptr(T * p = 0)
:
boost::scoped_ptr<T> (p)
{}
};
}
DEAL_II_NAMESPACE_CLOSE
#endif
#endif
|
Define magic uids and gids for use in devfs_add_devsw[f](). | /* usual BSD style copyright here */
/* Written by Julian Elischer (julian@dialix.oz.au)*/
/*
* $Id: devfsext.h,v 1.6 1996/01/21 09:03:04 julian Exp $
*/
#ifndef _SYS_DEVFSECT_H_
#define _SYS_DEVFSECT_H_ 1
void *devfs_add_devsw(char *path,
char *name,
void *devsw,
int minor,
int chrblk,
uid_t uid,
gid_t gid,
int perms) ;
void *devfs_add_devswf(void *devsw,
int minor,
int chrblk,
uid_t uid,
gid_t gid,
int perms,
char *fmt,
...) ;
void *dev_link(char *path,
char *name,
void *original); /* the result of a previous dev_link
or dev_add operation */
/* remove the device the cookie represents */
void devfs_remove_dev(void *devnmp);
#define DV_CHR 0
#define DV_BLK 1
#define DV_DEV 2
#endif /*_SYS_DEVFSECT_H_*/
| /* usual BSD style copyright here */
/* Written by Julian Elischer (julian@dialix.oz.au)*/
/*
* $Id: devfsext.h,v 1.7 1996/01/25 07:17:05 phk Exp $
*/
#ifndef _SYS_DEVFSECT_H_
#define _SYS_DEVFSECT_H_ 1
void *devfs_add_devsw(char *path,
char *name,
void *devsw,
int minor,
int chrblk,
uid_t uid,
gid_t gid,
int perms) ;
void *devfs_add_devswf(void *devsw,
int minor,
int chrblk,
uid_t uid,
gid_t gid,
int perms,
char *fmt,
...) ;
void *dev_link(char *path,
char *name,
void *original); /* the result of a previous dev_link
or dev_add operation */
/* remove the device the cookie represents */
void devfs_remove_dev(void *devnmp);
#define DV_CHR 0
#define DV_BLK 1
#define DV_DEV 2
/* XXX */
#define UID_ROOT 0
#define UID_BIN 3
#define UID_UUCP 66
/* XXX */
#define GID_WHEEL 0
#define GID_KMEM 2
#define GID_OPERATOR 5
#define GID_BIN 7
#define GID_DIALER 68
#endif /*_SYS_DEVFSECT_H_*/
|
Add generic header for CC2538 sensors | /*
* Copyright (c) 2015, Zolertia - http://www.zolertia.com
* Copyright (c) 2015, University of Bristol - http://www.bristol.ac.uk
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* 3. Neither the name of the copyright holder nor the names of its
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
* OF THE POSSIBILITY OF SUCH DAMAGE.
*/
/*---------------------------------------------------------------------------*/
/**
* \addtogroup cc2538
* @{
*
* \defgroup cc2538-sensors CC2538 Built-In Sensors
*
* Module controlling sensors on the CC2538 SoC (Tmp and VDD3)
* @{
*
* \file
* Generic header usable by all CC2538 sensor drivers
*/
/*---------------------------------------------------------------------------*/
#ifndef CC2538_SENSORS_H_
#define CC2538_SENSORS_H_
/*---------------------------------------------------------------------------*/
#include "lib/sensors.h"
#include "dev/cc2538-temp-sensor.h"
#include "dev/vdd3-sensor.h"
/*---------------------------------------------------------------------------*/
/**
* \name CC2538 sensor constants
*
* These constants are used by various sensors on the CC2538. They can be used
* to differentiate between raw and converted readings, to configure ADC
* decimation rate (where applicable).
* @{
*/
#define CC2538_SENSORS_VALUE_TYPE_RAW 0 /**< Request the raw reading */
#define CC2538_SENSORS_VALUE_TYPE_CONVERTED 1 /**< Request the converted reading */
#define CC2538_SENSORS_ERROR 0x80000000 /**< Generic Error */
/** @} */
/*---------------------------------------------------------------------------*/
#endif /* CC2538_SENSORS_H_ */
/*---------------------------------------------------------------------------*/
/**
* @}
* @}
*/
| |
Add target requirements for those bots which don't handle x86. | // RUN: %clang_cc1 -triple x86_64-unknown-unknown -S -O2 -o - %s | FileCheck %s
// CHECK-LABEL: f:
// CHECK: movl $1, %eax
// CHECK-NEXT: #APP
// CHECK-NEXT: outl %eax, $1
// CHECK-NEXT: #NO_APP
static inline void pr41027(unsigned a, unsigned b) {
if (__builtin_constant_p(a)) {
__asm__ volatile("outl %0,%w1" : : "a"(b), "n"(a));
} else {
__asm__ volatile("outl %0,%w1" : : "a"(b), "d"(a));
}
}
void f(unsigned port) {
pr41027(1, 1);
}
| // REQUIRES: x86-registered-target
// RUN: %clang_cc1 -triple x86_64-unknown-unknown -S -O2 -o - %s | FileCheck %s
// CHECK-LABEL: f:
// CHECK: movl $1, %eax
// CHECK-NEXT: #APP
// CHECK-NEXT: outl %eax, $1
// CHECK-NEXT: #NO_APP
static inline void pr41027(unsigned a, unsigned b) {
if (__builtin_constant_p(a)) {
__asm__ volatile("outl %0,%w1" : : "a"(b), "n"(a));
} else {
__asm__ volatile("outl %0,%w1" : : "a"(b), "d"(a));
}
}
void f(unsigned port) {
pr41027(1, 1);
}
|
Create wrapper for SDL_Init routine | #ifndef SDL_WRAPPER_H
#define SDL_WRAPPER_H 1
//-------------------------------------------------------------------
#include <SDL.h>
#include "wrapper/exceptions.h"
//-------------------------------------------------------------------
namespace SDL {
template<class ErrorHandler =Throw>
class SDL {
ErrorHandler handle_error();
public:
SDL(Uint32 flags =0) {
if (SDL_Init(flags) != 0) handle_error(SDL_GetError());
}
~SDL() {
SDL_Quit();
}
};
template<>
class SDL<NoThrow> {
int st;
public:
SDL(Uint32 flags =0) :st {SDL_Init(flags)} {}
int state() const { return st; }
~SDL() {
SDL_Quit();
}
};
} //namespace
//-------------------------------------------------------------------
#endif
| |
Test case for r113248. Raar 8361341. | // RUN: not %llvmgcc -S %s -o /dev/null |& grep "error: assignment of read-only location"
// PR 1603
int func()
{
const int *arr;
arr[0] = 1;
}
| // RUN: not %llvmgcc_only -c %s -o /dev/null |& FileCheck %s
// PR 1603
void func()
{
const int *arr;
arr[0] = 1; // CXHECK: error: assignment of read-only location
}
struct foo {
int bar;
};
struct foo sfoo = { 0 };
int func2()
{
const struct foo *fp;
fp = &sfoo;
fp[0].bar = 1; // CHECK: error: assignment of read-only member 'bar'
return sfoo.bar;
}
|
Fix gateway header path in UWP | // Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
#pragma once
#include "pch.h"
#include "..\..\..\..\core\inc\gateway_ll.h"
#include "IGatewayModule.h"
namespace Microsoft { namespace Azure { namespace IoT { namespace Gateway {
interface class IGatewayModule;
ref class MessageBus;
class InternalGatewayModule : public IInternalGatewayModule
{
public:
InternalGatewayModule(IGatewayModule ^moduleImpl) { _moduleImpl = moduleImpl; }
virtual ~InternalGatewayModule()
{
}
void Module_Create(MESSAGE_BUS_HANDLE busHandle, const void* configuration);
void Module_Destroy();
void Module_Receive(MODULE_HANDLE moduleHandle, MESSAGE_HANDLE messageHandle);
private:
IGatewayModule^ _moduleImpl;
};
public ref class Gateway sealed
{
public:
Gateway(Windows::Foundation::Collections::IVector<Microsoft::Azure::IoT::Gateway::IGatewayModule^>^ modules);
virtual ~Gateway()
{
Gateway_LL_UwpDestroy(gateway_handle);
gateway_handle = nullptr;
VECTOR_destroy(modules_handle);
}
private:
VECTOR_HANDLE modules_handle;
GATEWAY_HANDLE gateway_handle;
MESSAGE_BUS_HANDLE messagebus_handle;
std::vector<std::unique_ptr<InternalGatewayModule>> gatewayModulesToDelete;
};
}}}};
| // Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
#pragma once
#include "pch.h"
#include "gateway.h"
#include "IGatewayModule.h"
namespace Microsoft { namespace Azure { namespace IoT { namespace Gateway {
interface class IGatewayModule;
ref class MessageBus;
class InternalGatewayModule : public IInternalGatewayModule
{
public:
InternalGatewayModule(IGatewayModule ^moduleImpl) { _moduleImpl = moduleImpl; }
virtual ~InternalGatewayModule()
{
}
void Module_Create(MESSAGE_BUS_HANDLE busHandle, const void* configuration);
void Module_Destroy();
void Module_Receive(MODULE_HANDLE moduleHandle, MESSAGE_HANDLE messageHandle);
private:
IGatewayModule^ _moduleImpl;
};
public ref class Gateway sealed
{
public:
Gateway(Windows::Foundation::Collections::IVector<Microsoft::Azure::IoT::Gateway::IGatewayModule^>^ modules);
virtual ~Gateway()
{
Gateway_LL_UwpDestroy(gateway_handle);
gateway_handle = nullptr;
VECTOR_destroy(modules_handle);
}
private:
VECTOR_HANDLE modules_handle;
GATEWAY_HANDLE gateway_handle;
MESSAGE_BUS_HANDLE messagebus_handle;
std::vector<std::unique_ptr<InternalGatewayModule>> gatewayModulesToDelete;
};
}}}};
|
Add a virtual destructor to SimpleWebMimeRegistryImpl so that child class destructors get called correctly. | // Copyright (c) 2009 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 WEBMIMEREGISTRY_IMPL_H_
#define WEBMIMEREGISTRY_IMPL_H_
#include "third_party/WebKit/WebKit/chromium/public/WebMimeRegistry.h"
namespace webkit_glue {
class SimpleWebMimeRegistryImpl : public WebKit::WebMimeRegistry {
public:
// WebMimeRegistry methods:
virtual WebKit::WebMimeRegistry::SupportsType supportsMIMEType(
const WebKit::WebString&);
virtual WebKit::WebMimeRegistry::SupportsType supportsImageMIMEType(
const WebKit::WebString&);
virtual WebKit::WebMimeRegistry::SupportsType supportsJavaScriptMIMEType(
const WebKit::WebString&);
virtual WebKit::WebMimeRegistry::SupportsType supportsMediaMIMEType(
const WebKit::WebString&, const WebKit::WebString&);
virtual WebKit::WebMimeRegistry::SupportsType supportsNonImageMIMEType(
const WebKit::WebString&);
virtual WebKit::WebString mimeTypeForExtension(const WebKit::WebString&);
virtual WebKit::WebString mimeTypeFromFile(const WebKit::WebString&);
virtual WebKit::WebString preferredExtensionForMIMEType(
const WebKit::WebString&);
};
} // namespace webkit_glue
#endif // WEBMIMEREGISTRY_IMPL_H_
| // Copyright (c) 2009 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 WEBMIMEREGISTRY_IMPL_H_
#define WEBMIMEREGISTRY_IMPL_H_
#include "third_party/WebKit/WebKit/chromium/public/WebMimeRegistry.h"
namespace webkit_glue {
class SimpleWebMimeRegistryImpl : public WebKit::WebMimeRegistry {
public:
SimpleWebMimeRegistryImpl() {}
virtual ~SimpleWebMimeRegistryImpl() {}
// WebMimeRegistry methods:
virtual WebKit::WebMimeRegistry::SupportsType supportsMIMEType(
const WebKit::WebString&);
virtual WebKit::WebMimeRegistry::SupportsType supportsImageMIMEType(
const WebKit::WebString&);
virtual WebKit::WebMimeRegistry::SupportsType supportsJavaScriptMIMEType(
const WebKit::WebString&);
virtual WebKit::WebMimeRegistry::SupportsType supportsMediaMIMEType(
const WebKit::WebString&, const WebKit::WebString&);
virtual WebKit::WebMimeRegistry::SupportsType supportsNonImageMIMEType(
const WebKit::WebString&);
virtual WebKit::WebString mimeTypeForExtension(const WebKit::WebString&);
virtual WebKit::WebString mimeTypeFromFile(const WebKit::WebString&);
virtual WebKit::WebString preferredExtensionForMIMEType(
const WebKit::WebString&);
};
} // namespace webkit_glue
#endif // WEBMIMEREGISTRY_IMPL_H_
|
Add library to make secret logs | #include <kotaka/paths/system.h>
inherit "~System/lib/struct/list";
private mapping buffers;
private void append_node(string file, string fragment)
{
mixed **list;
if (!buffers) {
buffers = ([ ]);
}
list = buffers[file];
if (!list) {
list = ({ nil, nil });
buffers[file] = list;
}
list_append_string(list, fragment);
}
private void write_node(string file)
{
mixed **list;
mixed *info;
list = buffers[file];
info = SECRETD->file_info("logs/" + file + ".log");
if (info && info[0] >= 1 << 25) {
SECRETD->remove_file("logs/" + file + ".log.old");
SECRETD->rename_file("logs/" + file + ".log", "logs/" + file + ".log.old");
}
SECRETD->make_dir(".");
SECRETD->make_dir("logs");
SECRETD->write_file("logs/" + file + ".log", list_front(list));
list_pop_front(list);
if (list_empty(list)) {
buffers[file] = nil;
}
}
static nomask void secret_flush()
{
while (buffers && map_sizeof(buffers)) {
string *files;
int sz;
files = map_indices(buffers);
sz = sizeof(files);
write_node(files[random(sz)]);
buffers = nil;
}
}
static void flush()
{
call_out("secret_flush", 0);
}
static void write_secret_log(string file, string message)
{
mixed *mtime;
string stamp, mstamp;
mtime = millitime();
/* ctime format: */
/* Tue Aug 3 14:40:18 1993 */
/* 012345678901234567890123 */
stamp = ctime(mtime[0]);
stamp = stamp[0 .. 2] + ", " + stamp[4 .. 9] + ", " + stamp[20 .. 23] + " " + stamp[11 .. 18];
stamp += ".";
/* millitime resolution is 1m anyway */
mstamp = "" + floor(mtime[1] * 1000.0 + 0.5);
mstamp = "000" + mstamp;
mstamp = mstamp[strlen(mstamp) - 3 ..];
stamp += mstamp;
append_node(file, stamp + " " + message + "\n");
call_out("secret_flush", 0);
}
| |
Print seed to stderr, not stdout. | #include "random.h"
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <unistd.h>
void
seed_random(void)
{
/* Single iteration of Xorshift to get a good seed. */
unsigned int seed = time(NULL) ^ getpid();
seed ^= (seed << 19);
seed ^= (seed >> 11);
seed ^= (seed << 9);
printf("seed = %u\n", seed);
srandom(seed);
}
int
random_range(int min, int max)
{
int range, bucket, remainder, r;
range = max - min;
bucket = RAND_MAX / range;
remainder = RAND_MAX % range;
while ((r = random()) > (RAND_MAX - remainder))
;
return min + (r / bucket);
}
| #include "random.h"
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <unistd.h>
void
seed_random(void)
{
/* Single iteration of Xorshift to get a good seed. */
unsigned int seed = time(NULL) ^ getpid();
seed ^= (seed << 19);
seed ^= (seed >> 11);
seed ^= (seed << 9);
fprintf(stderr, "seed = %u\n", seed);
srandom(seed);
}
int
random_range(int min, int max)
{
int range, bucket, remainder, r;
range = max - min;
bucket = RAND_MAX / range;
remainder = RAND_MAX % range;
while ((r = random()) > (RAND_MAX - remainder))
;
return min + (r / bucket);
}
|
Use explicit constructors for correctness | #ifndef ARGON2_NODE_H
#define ARGON2_NODE_H
#include <memory>
#include <nan.h>
namespace NodeArgon2 {
class HashAsyncWorker final: public Nan::AsyncWorker {
public:
HashAsyncWorker(std::string&& plain, std::string&& salt,
std::tuple<uint32_t, uint32_t, uint32_t, argon2_type>&& params);
void Execute() override;
void HandleOKCallback() override;
void HandleErrorCallback() override;
private:
std::string plain;
std::string salt;
uint32_t time_cost;
uint32_t memory_cost;
uint32_t parallelism;
argon2_type type;
std::unique_ptr<char[]> output;
};
class VerifyAsyncWorker final: public Nan::AsyncWorker {
public:
VerifyAsyncWorker(std::string&& hash, std::string&& plain, argon2_type type);
void Execute() override;
void HandleOKCallback() override;
void HandleErrorCallback() override;
private:
std::string hash;
std::string plain;
argon2_type type;
bool output;
};
NAN_METHOD(Hash);
NAN_METHOD(HashSync);
NAN_METHOD(Verify);
NAN_METHOD(VerifySync);
}
#endif /* ARGON2_NODE_H */
| #ifndef ARGON2_NODE_H
#define ARGON2_NODE_H
#include <memory>
#include <nan.h>
namespace NodeArgon2 {
class HashAsyncWorker final: public Nan::AsyncWorker {
public:
explicit HashAsyncWorker(std::string&& plain, std::string&& salt,
std::tuple<uint32_t, uint32_t, uint32_t, argon2_type>&& params);
void Execute() override;
void HandleOKCallback() override;
void HandleErrorCallback() override;
private:
std::string plain;
std::string salt;
uint32_t time_cost;
uint32_t memory_cost;
uint32_t parallelism;
argon2_type type;
std::unique_ptr<char[]> output;
};
class VerifyAsyncWorker final: public Nan::AsyncWorker {
public:
explicit VerifyAsyncWorker(std::string&& hash, std::string&& plain,
argon2_type type);
void Execute() override;
void HandleOKCallback() override;
void HandleErrorCallback() override;
private:
std::string hash;
std::string plain;
argon2_type type;
bool output;
};
NAN_METHOD(Hash);
NAN_METHOD(HashSync);
NAN_METHOD(Verify);
NAN_METHOD(VerifySync);
}
#endif /* ARGON2_NODE_H */
|
Implement the inverse tangent function. | #include <pal.h>
/**
*
* Calculates inverse tangent (arc tangent) of the input value. The function
* returns a value between -pi/2 to pi/2 but does not check for illegal input
* values.
*
* @param a Pointer to input vector
*
* @param c Pointer to output vector
*
* @param n Size of 'a' and 'c' vector.
*
* @return None
*
*/
#include <math.h>
void p_atan_f32(const float *a, float *c, int n)
{
int i;
for (i = 0; i < n; i++) {
*(c + i) = atan(*(a + i));
}
}
| #include <pal.h>
/*
* -1 <= x <= 1
* atan x = a1 * x + a3 * x^3 + ... + a9 * x^9 + e(x)
* |e(x)| <= 10^-5
*/
static inline float _p_atan(const float x)
{
const float a1 = 0.9998660f;
const float a3 = -0.3302995f;
const float a5 = 0.1801410f;
const float a7 = -0.0851330f;
const float a9 = 0.0208351f;
return a1 * x +
a3 * x * x * x +
a5 * x * x * x * x * x +
a7 * x * x * x * x * x * x * x +
a9 * x * x * x * x * x * x * x * x * x;
}
/**
*
* Calculates inverse tangent (arc tangent) of the input value. The function
* returns a value between -pi/2 to pi/2 but does not check for illegal input
* values.
*
* @param a Pointer to input vector
*
* @param c Pointer to output vector
*
* @param n Size of 'a' and 'c' vector.
*
* @return None
*
*/
#include <math.h>
void p_atan_f32(const float *a, float *c, int n)
{
int i;
for (i = 0; i < n; i++) {
c[i] = _p_atan(a[i]);
}
}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.