Instruction stringlengths 14 778 | input_code stringlengths 0 4.24k | output_code stringlengths 1 5.44k |
|---|---|---|
Fix undefined references in linker | //
// Created by Hippo on 9/13/2016.
//
#ifndef IMAGE_IMAGE_DECODER_H
#define IMAGE_IMAGE_DECODER_H
#include "com_hippo_image_BitmapDecoder.h"
#define IMAGE_CONFIG_INVALID -1;
#define IMAGE_CONFIG_AUTO com_hippo_image_BitmapDecoder_CONFIG_AUTO
#define IMAGE_CONFIG_RGB_565 com_hippo_image_BitmapDecoder_CONFIG_RGB_565
#define IMAGE_CONFIG_RGBA_8888 com_hippo_image_BitmapDecoder_CONFIG_RGBA_8888
inline bool is_explicit_config(int32_t config) {
return config == IMAGE_CONFIG_RGB_565 || config == IMAGE_CONFIG_RGBA_8888;
}
inline uint32_t get_depth_for_config(int32_t config) {
switch (config) {
case IMAGE_CONFIG_RGB_565:
return 2;
case IMAGE_CONFIG_RGBA_8888:
return 4;
default:
return 0;
}
}
#endif //IMAGE_IMAGE_DECODER_H
| //
// Created by Hippo on 9/13/2016.
//
#ifndef IMAGE_IMAGE_DECODER_H
#define IMAGE_IMAGE_DECODER_H
#include "com_hippo_image_BitmapDecoder.h"
#define IMAGE_CONFIG_INVALID -1;
#define IMAGE_CONFIG_AUTO com_hippo_image_BitmapDecoder_CONFIG_AUTO
#define IMAGE_CONFIG_RGB_565 com_hippo_image_BitmapDecoder_CONFIG_RGB_565
#define IMAGE_CONFIG_RGBA_8888 com_hippo_image_BitmapDecoder_CONFIG_RGBA_8888
static inline bool is_explicit_config(int32_t config) {
return config == IMAGE_CONFIG_RGB_565 || config == IMAGE_CONFIG_RGBA_8888;
}
static inline uint32_t get_depth_for_config(int32_t config) {
switch (config) {
case IMAGE_CONFIG_RGB_565:
return 2;
case IMAGE_CONFIG_RGBA_8888:
return 4;
default:
return 0;
}
}
#endif //IMAGE_IMAGE_DECODER_H
|
Disable ffmpeg software conversion in define | #pragma once
#define PRINT_QUEUE_INFOS 0
#define PRINT_FRAME_UPLOAD_INFOS 0
#define PRINT_MEMORY_STATS 0
#define PRINT_FRAME_DROPS 0
#define PRINT_VIDEO_REFRESH 0
#define PRINT_VIDEO_DELAY 0
#define PRINT_CLOCKS 0
#define PRINT_PTS 0
#define PRINT_FPS 0
// Rendering mode (Hardware or Software)
#define USE_HARDWARE_RENDERING 1
// Hardware rendering
#define USE_GLSL_IMAGE_FORMAT_DECODING 1 // Use GLSL to decode image planes (Much faster than software decoding)
#define USE_GL_PBO 1 // Use OpenGL Pixel Buffer Objects (Faster CPU -> GPU transfer)
#define USE_GL_BLENDING 1 // Use OpenGL Blending (Only useful to disable, when debugging text rendering)
#define USE_GL_RECTANGLE_TEXTURES 1 // Use GL_TEXTURE_RECTANGLE instead of GL_TEXTURE_2D
// Software rendering
#define USE_FLIP_V_PICTURE_IN_SOFTWARE 0 // We need to detect this, when to flip and when not to flip
// Global
#define USE_FFMPEG_STATIC_LINKING 0 // Use static or runtime linking of FFMPEG (Useful to test if function signatures has been changed)
#define USE_FFMPEG_SOFTWARE_CONVERSION 1 // Convert video frames using sws_scale or using our own implementation, which is limited to type AV_PIX_FMT_YUV420P
| #pragma once
#define PRINT_QUEUE_INFOS 0
#define PRINT_FRAME_UPLOAD_INFOS 0
#define PRINT_MEMORY_STATS 0
#define PRINT_FRAME_DROPS 0
#define PRINT_VIDEO_REFRESH 0
#define PRINT_VIDEO_DELAY 0
#define PRINT_CLOCKS 0
#define PRINT_PTS 0
#define PRINT_FPS 0
// Rendering mode (Hardware or Software)
#define USE_HARDWARE_RENDERING 1
// Hardware rendering
#define USE_GLSL_IMAGE_FORMAT_DECODING 1 // Use GLSL to decode image planes (Much faster than software decoding)
#define USE_GL_PBO 1 // Use OpenGL Pixel Buffer Objects (Faster CPU -> GPU transfer)
#define USE_GL_BLENDING 1 // Use OpenGL Blending (Only useful to disable, when debugging text rendering)
#define USE_GL_RECTANGLE_TEXTURES 1 // Use GL_TEXTURE_RECTANGLE instead of GL_TEXTURE_2D
// Software rendering
#define USE_FLIP_V_PICTURE_IN_SOFTWARE 0 // We need to detect this, when to flip and when not to flip
// Global
#define USE_FFMPEG_STATIC_LINKING 0 // Use static or runtime linking of FFMPEG (Useful to test if function signatures has been changed)
#define USE_FFMPEG_SOFTWARE_CONVERSION 0 // Convert video frames using sws_scale or using our own implementation, which is limited to type AV_PIX_FMT_YUV420P
|
Clarify the debug message that may be generated by the chpl_comm_barrier() call in chpl_exit_common(). | #include <stdio.h>
#include <stdlib.h>
#include "chpl_rt_utils_static.h"
#include "chpl-comm.h"
#include "chplexit.h"
#include "chpl-mem.h"
#include "chplmemtrack.h"
#include "chplrt.h"
#include "gdb.h"
#undef exit
static void chpl_exit_common(int status, int all) {
fflush(stdout);
fflush(stderr);
if (status != 0) {
gdbShouldBreakHere();
}
if (all) {
chpl_comm_barrier("chpl_comm_exit_all");
chpl_comm_stopPollingTask();
chpl_task_exit();
chpl_reportMemInfo();
chpl_mem_exit();
chpl_comm_exit_all(status);
} else {
chpl_mem_exit();
chpl_comm_exit_any(status);
}
exit(status);
}
void chpl_exit_all(int status) {
chpl_exit_common(status, 1);
}
void chpl_exit_any(int status) {
chpl_exit_common(status, 0);
}
| #include <stdio.h>
#include <stdlib.h>
#include "chpl_rt_utils_static.h"
#include "chpl-comm.h"
#include "chplexit.h"
#include "chpl-mem.h"
#include "chplmemtrack.h"
#include "chplrt.h"
#include "gdb.h"
#undef exit
static void chpl_exit_common(int status, int all) {
fflush(stdout);
fflush(stderr);
if (status != 0) {
gdbShouldBreakHere();
}
if (all) {
chpl_comm_barrier("chpl_exit_common");
chpl_comm_stopPollingTask();
chpl_task_exit();
chpl_reportMemInfo();
chpl_mem_exit();
chpl_comm_exit_all(status);
} else {
chpl_mem_exit();
chpl_comm_exit_any(status);
}
exit(status);
}
void chpl_exit_all(int status) {
chpl_exit_common(status, 1);
}
void chpl_exit_any(int status) {
chpl_exit_common(status, 0);
}
|
Disable logger crash handling on Android | #ifndef LOGGING_H
#define LOGGING_H
#ifndef __ANDROID__
#define ELPP_STACKTRACE_ON_CRASH
#endif
#define ELPP_NO_DEFAULT_LOG_FILE
#include "vendor/easylogging++.h"
#define INITIALIZE_LOGGING INITIALIZE_EASYLOGGINGPP
namespace sensekit {
void initialize_logging(const char* logFilePath);
}
#endif /* LOGGING_H */
| #ifndef LOGGING_H
#define LOGGING_H
#ifdef __ANDROID__
#define ELPP_DISABLE_DEFAULT_CRASH_HANDLING
#else // not android
#define ELPP_STACKTRACE_ON_CRASH
#endif
#define ELPP_NO_DEFAULT_LOG_FILE
#include "vendor/easylogging++.h"
#define INITIALIZE_LOGGING INITIALIZE_EASYLOGGINGPP
namespace sensekit {
void initialize_logging(const char* logFilePath);
}
#endif /* LOGGING_H */
|
Test for stack using array | #include <check.h>
#include "../src/stack_using_array/stack.h"
stack st;
void setup() {
init(&st);
}
void teardown() {
}
START_TEST( test_push_pop_normal_ops )
{
push( &st, 10 );
push( &st, 12 );
ck_assert_int_eq( pop( &st ), 12 );
ck_assert_int_eq( pop( &st ), 10 );
}
END_TEST
START_TEST( test_pop_underflow )
{
push( &st, 12 );
ck_assert_int_eq( pop( &st ), 12 );
ck_assert_int_eq( pop( &st ), -2 );
}
END_TEST
START_TEST( test_push_overflow )
{
push( &st, 2 );
push( &st, 3 );
push( &st, 4 );
push( &st, 5 );
push( &st, 6 );
ck_assert_int_eq( push( &st, 7 ), -3 );
}
END_TEST
START_TEST( test_null_pointer )
{
ck_assert_int_eq( init( NULL ), -1 );
ck_assert_int_eq( push( NULL, 10 ), -1 );
ck_assert_int_eq( pop( NULL ), -1 );
ck_assert_int_eq( peek( NULL ), -1 );
}
END_TEST
Suite * stack_suite(void)
{
Suite *s;
TCase *tc_core, *tc_abnormal;
s = suite_create("Stack");
/* Core test case */
tc_core = tcase_create("Core");
/* Abnormal test case */
tc_abnormal = tcase_create("Abnormal");
tcase_add_checked_fixture(tc_core, setup, teardown);
tcase_add_checked_fixture(tc_abnormal, setup, teardown);
tcase_add_test(tc_core, test_push_pop_normal_ops);
tcase_add_test(tc_abnormal, test_push_overflow);
tcase_add_test(tc_abnormal, test_pop_underflow);
tcase_add_test(tc_abnormal, test_null_pointer);
suite_add_tcase(s, tc_core);
suite_add_tcase(s, tc_abnormal);
return s;
}
int main()
{
int number_failed;
Suite *s;
SRunner *sr;
s = stack_suite();
sr = srunner_create(s);
srunner_run_all(sr, CK_NORMAL);
number_failed = srunner_ntests_failed(sr);
srunner_free(sr);
return (number_failed == 0) ? EXIT_SUCCESS : EXIT_FAILURE;
}
| |
Decrease the number of notify_one calls | #pragma once
#include <cstddef>
#include <condition_variable>
#include <mutex>
#include <queue>
namespace log {
template<typename T>
class LogQueue final {
public:
explicit LogQueue(size_t capacity) : m_capacity(capacity) {}
~LogQueue() = default;
LogQueue(const LogQueue&) = delete;
LogQueue& operator=(const LogQueue&) = delete;
void Push(T&& element) {
std::unique_lock<std::mutex> lock(m_mutex);
while (m_queue.size() + 1 > m_capacity) { // is full
m_notfull.wait(lock);
}
m_queue.push(std::move(element));
m_notempty.notify_one();
}
void Pop(T* element) {
std::unique_lock<std::mutex> lock(m_mutex);
while (m_queue.empty()) { // is empty
m_notempty.wait(lock);
}
if (element != nullptr) {
*element = std::move(m_queue.front());
}
m_queue.pop();
m_notfull.notify_one();
}
private:
const size_t m_capacity;
std::queue<T> m_queue;
std::mutex m_mutex;
std::condition_variable m_notfull;
std::condition_variable m_notempty;
};
} // namespace log
| #pragma once
#include <cstddef>
#include <condition_variable>
#include <mutex>
#include <queue>
namespace log {
template<typename T>
class LogQueue final {
public:
explicit LogQueue(size_t capacity) : m_capacity(capacity) {}
~LogQueue() = default;
LogQueue(const LogQueue&) = delete;
LogQueue& operator=(const LogQueue&) = delete;
void Push(T&& element) {
std::unique_lock<std::mutex> lock(m_mutex);
while (isFull()) {
m_notfull.wait(lock);
}
bool wasEmpty = isEmpty();
m_queue.push(std::move(element));
if (wasEmpty) {
m_notempty.notify_one();
}
}
void Pop(T* element) {
std::unique_lock<std::mutex> lock(m_mutex);
while (isEmpty()) {
m_notempty.wait(lock);
}
bool wasFull = isFull();
if (element != nullptr) {
*element = std::move(m_queue.front());
}
m_queue.pop();
if (wasFull) {
m_notfull.notify_one();
}
}
private:
const size_t m_capacity;
std::queue<T> m_queue;
std::mutex m_mutex;
std::condition_variable m_notfull;
std::condition_variable m_notempty;
bool isEmpty() {
return m_queue.empty();
}
bool isFull() {
return m_queue.size() + 1 > m_capacity;
}
};
} // namespace log
|
Add builtin_memcpy, builtin_memcmp generic helpers | #ifndef __CR_ASM_GENERIC_STRING_H__
#define __CR_ASM_GENERIC_STRING_H__
#include "compiler.h"
#ifndef HAS_BUILTIN_MEMCPY
static always_inline void *builtin_memcpy(void *to, const void *from, unsigned int n)
{
int i;
unsigned char *cto = to;
const unsigned char *cfrom = from;
for (i = 0; i < n; ++i, ++cto, ++cfrom) {
*cto = *cfrom;
}
return to;
}
#endif
#endif /* __CR_ASM_GENERIC_STRING_H__ */
| #ifndef __CR_ASM_GENERIC_STRING_H__
#define __CR_ASM_GENERIC_STRING_H__
#include "compiler.h"
#ifndef HAS_BUILTIN_MEMCPY
static always_inline void *builtin_memcpy(void *to, const void *from, unsigned int n)
{
int i;
unsigned char *cto = to;
const unsigned char *cfrom = from;
for (i = 0; i < n; ++i, ++cto, ++cfrom) {
*cto = *cfrom;
}
return to;
}
#endif
#ifndef HAS_BUILTIN_MEMCMP
static always_inline int builtin_memcmp(const void *cs, const void *ct, size_t count)
{
const unsigned char *su1, *su2;
int res = 0;
for (su1 = cs, su2 = ct; 0 < count; ++su1, ++su2, count--)
if ((res = *su1 - *su2) != 0)
break;
return res;
}
#endif
#ifndef HAS_BUILTIN_STRCMP
static always_inline int builtin_strcmp(const char *cs, const char *ct)
{
unsigned char c1, c2;
while (1) {
c1 = *cs++;
c2 = *ct++;
if (c1 != c2)
return c1 < c2 ? -1 : 1;
if (!c1)
break;
}
return 0;
}
#endif
#endif /* __CR_ASM_GENERIC_STRING_H__ */
|
Add file needed for rpl border router | /*
Copied from mc1322x/dev/cpu.
This file exists as a work-around for the hardware dependant calls
to slip_arch_init.
Current the prototype for slip_arch_init is slip_arch_init(urb)
and a typical call is something like
slip_arch_init(BAUD2URB(115200))
BAUD2UBR is hardware specific, however. Furthermore, for the sky
platform it's typically defined with #include "dev/uart1.h" (see
rpl-boarder-router/slip-bridge.c), a sky specific file. dev/uart1.h
includes msp430.h which includes the sky contiki-conf.h which
defines BAUD2UBR.
To me, the correct think to pass is simply the baudrate and have the
hardware specific conversion happen inside slip_arch_init.
Notably, most implementations just ignore the passed parameter
anyway. (except AVR)
*/
#ifndef DEV_UART1_H
#define DEV_UART1_H
#define BAUD2UBR(x) x
#endif
| |
Add export rules for scene node leaf. | /* dtkComposerSceneNodeLeaf.h ---
*
* Author: Julien Wintz
* Copyright (C) 2008-2011 - Julien Wintz, Inria.
* Created: Fri Feb 3 12:34:45 2012 (+0100)
* Version: $Id$
* Last-Updated: Thu Feb 16 14:47:09 2012 (+0100)
* By: Julien Wintz
* Update #: 10
*/
/* Commentary:
*
*/
/* Change log:
*
*/
#ifndef DTKCOMPOSERSCENENODELEAF_H
#define DTKCOMPOSERSCENENODELEAF_H
#include "dtkComposerSceneNode.h"
class dtkComposerNode;
class dtkComposerSceneNodeLeafPrivate;
class dtkComposerSceneNodeLeaf : public dtkComposerSceneNode
{
public:
dtkComposerSceneNodeLeaf(void);
~dtkComposerSceneNodeLeaf(void);
public:
void wrap(dtkComposerNode *node);
public:
void layout(void);
public:
void resize(qreal width, qreal height);
public:
QRectF boundingRect(void) const;
public:
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0);
private:
dtkComposerSceneNodeLeafPrivate *d;
};
#endif
| /* dtkComposerSceneNodeLeaf.h ---
*
* Author: Julien Wintz
* Copyright (C) 2008-2011 - Julien Wintz, Inria.
* Created: Fri Feb 3 12:34:45 2012 (+0100)
* Version: $Id$
* Last-Updated: Thu May 31 09:45:52 2012 (+0200)
* By: tkloczko
* Update #: 11
*/
/* Commentary:
*
*/
/* Change log:
*
*/
#ifndef DTKCOMPOSERSCENENODELEAF_H
#define DTKCOMPOSERSCENENODELEAF_H
#include "dtkComposerExport.h"
#include "dtkComposerSceneNode.h"
class dtkComposerNode;
class dtkComposerSceneNodeLeafPrivate;
class DTKCOMPOSER_EXPORT dtkComposerSceneNodeLeaf : public dtkComposerSceneNode
{
public:
dtkComposerSceneNodeLeaf(void);
~dtkComposerSceneNodeLeaf(void);
public:
void wrap(dtkComposerNode *node);
public:
void layout(void);
public:
void resize(qreal width, qreal height);
public:
QRectF boundingRect(void) const;
public:
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0);
private:
dtkComposerSceneNodeLeafPrivate *d;
};
#endif
|
Add stub for windows random implementation. | /*
*The MIT License (MIT)
*
* Copyright (c) <2017> <Stephan Gatzka>
*
* 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 <stddef.h>
#include <Windows.h>
#include <Wincrypt.h>
#include "jet_random.h"
void cjet_get_random_bytes(void *bytes, size_t num_bytes)
{
HCRYPTPROV hCryptProv = 0;
CryptGenRandom(hCryptProv, (DWORD)num_bytes, bytes);
} | |
Fix running of c++ apps when there are multiple apps in mods.conf | /**
* @file
* @brief Command registry and invocation code.
*
* @date 01.03.11
* @author Eldar Abusalimov
*/
#include <framework/cmd/api.h>
#include <framework/cmd/types.h>
#include <ctype.h>
#include <stddef.h>
#include <errno.h>
#include <string.h>
#include <util/array.h>
#include <util/getopt.h>
ARRAY_SPREAD_DEF(const struct cmd * const, __cmd_registry);
int cmd_exec(const struct cmd *cmd, int argc, char **argv) {
int err;
if (!cmd)
return -EINVAL;
err = mod_activate_app(cmd2mod(cmd));
if (err)
return err;
getopt_init();
return cmd->exec(argc, argv);
}
const struct cmd *cmd_lookup(const char *name) {
const struct cmd *cmd = NULL;
if (!strncmp(name, "/bin/", strlen("/bin/"))) {
name += strlen("/bin/");
}
cmd_foreach(cmd) {
if (strcmp(cmd_name(cmd), name) == 0) {
return cmd;
}
}
return NULL;
}
| /**
* @file
* @brief Command registry and invocation code.
*
* @date 01.03.11
* @author Eldar Abusalimov
*/
#include <framework/cmd/api.h>
#include <framework/cmd/types.h>
#include <ctype.h>
#include <stddef.h>
#include <errno.h>
#include <string.h>
#include <util/array.h>
#include <util/getopt.h>
ARRAY_SPREAD_DEF(const struct cmd * const, __cmd_registry);
int cmd_exec(const struct cmd *cmd, int argc, char **argv) {
int err;
if (!cmd)
return -EINVAL;
err = mod_activate_app(cmd2mod(cmd));
if (err)
return err;
getopt_init();
err = cmd->exec(argc, argv);
/* FIXME Here we make app's data and bss as they was
* before app execution. It's required because we call all
* C++ ctors on every app launch. When we will call only ctors
* of the running app, this workaround can be removed. */
mod_activate_app(cmd2mod(cmd));
return err;
}
const struct cmd *cmd_lookup(const char *name) {
const struct cmd *cmd = NULL;
if (!strncmp(name, "/bin/", strlen("/bin/"))) {
name += strlen("/bin/");
}
cmd_foreach(cmd) {
if (strcmp(cmd_name(cmd), name) == 0) {
return cmd;
}
}
return NULL;
}
|
Make test robust to changes in prefix/avoid hardcoded line numbers | // REQUIRES: x86_64-linux
// RUN: %host_cc -O0 -g %s -o %t 2>&1
// RUN: %t 2>&1 | llvm-symbolizer -print-source-context-lines=5 -obj=%t | FileCheck %s
#include <stdio.h>
int inc(int a) {
return a + 1;
}
int main() {
printf("%p\n", inc);
return 0;
}
// CHECK: inc
// CHECK: print_context.c:7
// CHECK: 5 : #include
// CHECK: 6 :
// CHECK: 7 >: int inc
// CHECK: 8 : return
// CHECK: 9 : }
| // REQUIRES: x86_64-linux
// RUN: %host_cc -O0 -g %s -o %t 2>&1
// RUN: %t 2>&1 | llvm-symbolizer -print-source-context-lines=5 -obj=%t | FileCheck %s
// CHECK: inc
// CHECK: print_context.c:[[@LINE+9]]
// CHECK: [[@LINE+6]] : #include
// CHECK: [[@LINE+6]] :
// CHECK: [[@LINE+6]] >: int inc
// CHECK: [[@LINE+6]] : return
// CHECK: [[@LINE+6]] : }
#include <stdio.h>
int inc(int a) {
return a + 1;
}
int main() {
printf("%p\n", inc);
return 0;
}
|
Add typdef in header main() | /*
* Three files to show how to put a typedef struct and
* functions into a header file.
*
* Copyright 2017 Dave Cuthbert, MIT license
*/
#include <stdlib.h>
#include <stdio.h>
#include "typedef_in_header_file.h"
int main(int argc, char *argv[])
{
Node *root;
root = new_node();
root->value = 1;
printf("ROOT: %d\n", root->value);
Node *node_ptr = new_node();
node_ptr = root;
printf("NODE PTR: %d\n", root->value);
/* Add another node */
node_ptr->next = new_node();
/* Move forward to new node */
node_ptr = node_ptr->next;
node_ptr->next = 0;
node_ptr->value = 2;
printf("NEW NODE: %d\n", node_ptr->value);
return 0;
}
| |
Comment the current arrayobject.h situation. Right now for Numpy packages that are consistent with python-1.5, this file could be a number of places relative to /usr/include/python$version so configure must look specifically for it. However, later Numpy packages consistent with python2.x always put it in a standard location of /usr/include/python$version/Numeric. Thus, the relative location of arrayobject.h to the normal python includes is consistent, and we will no longer have to look specifically for this file once we stop supporting python-1.5. | #include <Python.h>
#include <arrayobject.h>
#include "plplot/plplot.h"
#include "plplot/plplotP.h"
#if defined(PL_DOUBLE) || defined(DOUBLE)
#define PL_ARGS(a, b) (a)
#define PyArray_PLFLT PyArray_DOUBLE
#else
#define PL_ARGS(a, b) (b)
#define PyArray_PLFLT PyArray_FLOAT
#endif
#define TRY(E) if(! (E)) return NULL
int pl_PyArray_AsFloatArray (PyObject **, PLFLT **, PLINT *);
int pl_PyArray_AsIntArray (PyObject **, PLINT **, PLINT *);
int pl_PyArray_AsFloatMatrix (PyObject **, PLINT*, PLINT*, PLFLT ***);
int pl_PyList_AsStringArray (PyObject *, char ***, int *);
int pl_PyList_SetFromStringArray (PyObject *, char **, int);
PLFLT pyf2eval2( PLINT ix, PLINT iy, PLPointer plf2eval_data );
| #include <Python.h>
/* Change this to the recommended
#include <Numeric/arrayobject.h>
once we no longer support python1.5 */
#include <arrayobject.h>
#include "plplot/plplot.h"
#include "plplot/plplotP.h"
#if defined(PL_DOUBLE) || defined(DOUBLE)
#define PL_ARGS(a, b) (a)
#define PyArray_PLFLT PyArray_DOUBLE
#else
#define PL_ARGS(a, b) (b)
#define PyArray_PLFLT PyArray_FLOAT
#endif
#define TRY(E) if(! (E)) return NULL
int pl_PyArray_AsFloatArray (PyObject **, PLFLT **, PLINT *);
int pl_PyArray_AsIntArray (PyObject **, PLINT **, PLINT *);
int pl_PyArray_AsFloatMatrix (PyObject **, PLINT*, PLINT*, PLFLT ***);
int pl_PyList_AsStringArray (PyObject *, char ***, int *);
int pl_PyList_SetFromStringArray (PyObject *, char **, int);
PLFLT pyf2eval2( PLINT ix, PLINT iy, PLPointer plf2eval_data );
|
Remove some compiler warnings for C251. | #include "AceUnitLogging.h"
#ifdef ACEUNIT_LOG_RUNNER
/** @see TestLogger_t.runnerStarted */
void logRunnerStarted()
{
}
#endif
#ifdef ACEUNIT_LOG_SUITE
/** @see TestLogger_t.suiteStarted */
void logSuiteStarted()
{
}
#endif
#ifdef ACEUNIT_LOG_FIXTURE
/** @see TestLogger_t.fixtureStarted */
void logFixtureStarted(const FixtureId_t fixture)
{
}
#endif
#ifdef ACEUNIT_LOG_TESTCASE
/** @see TestLogger_t.testCaseStarted */
void logTestCaseStarted(TestCaseId_t testCase)
{
}
#endif
/** @see TestLogger_t.testCaseCailed */
void logTestCaseFailed(const AssertionError_t *error)
{
}
#ifdef ACEUNIT_LOG_TESTCASE
/** @see TestLogger_t.testCaseEnded */
void logTestCaseEnded(TestCaseId_t testCase)
{
}
#endif
#ifdef ACEUNIT_LOG_FIXTURE
void logFixtureEnded(const FixtureId_t fixture)
{
}
#endif
#ifdef ACEUNIT_LOG_SUITE
/** @see TestLogger_t.suiteEnded */
void logSuiteEnded()
{
}
#endif
#ifdef ACEUNIT_LOG_RUNNER
/** @see TestLogger_t.runnerEnded */
void logRunnerEnded()
{
}
#endif
/** This Logger. */
AceUnitNewLogger(
loggerStub, /* CHANGE THIS NAME!!! */
logRunnerStarted,
logSuiteStarted,
logFixtureStarted,
logTestCaseStarted,
logTestCaseFailed,
logTestCaseEnded,
logFixtureEnded,
logSuiteEnded,
logRunnerEnded
);
TestLogger_t *globalLogger = &loggerStub; /* XXX Hack. Remove. */
| #include "AceUnitLogging.h"
#ifdef ACEUNIT_LOG_RUNNER
/** @see TestLogger_t.runnerStarted */
void logRunnerStarted()
{
}
#endif
#ifdef ACEUNIT_LOG_RUNNER
/** @see TestLogger_t.runnerEnded */
void logRunnerEnded()
{
}
#endif
/** This Logger. */
AceUnitNewLogger(
loggerStub, /* CHANGE THIS NAME!!! */
logRunnerStarted,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
logRunnerEnded
);
TestLogger_t *globalLogger = &loggerStub; /* XXX Hack. Remove. */
|
Add VTK type caster to convert VTK wrapped classes | #ifndef pybind_extension_vtk_source_VTKTypeCaster_h
#define pybind_extension_vtk_source_VTKTypeCaster_h
#include <pybind11/pybind11.h>
#include <type_traits>
#include "vtkObjectBase.h"
#include "vtkPythonUtil.h"
#define PYBIND11_VTK_TYPECASTER(VTK_OBJ) \
namespace pybind11 { \
namespace detail { \
template <> \
struct type_caster<VTK_OBJ> { \
protected: \
VTK_OBJ *value; \
public: \
static PYBIND11_DESCR name() { return type_descr(_(#VTK_OBJ)); } \
static handle cast(const VTK_OBJ *src, return_value_policy policy, \
handle parent) { \
return cast(*src, policy, parent); \
} \
operator VTK_OBJ *() { return value; } \
operator VTK_OBJ &() { return *value; } \
template <typename _T> using cast_op_type = \
pybind11::detail::cast_op_type<_T>; \
bool load(handle src, bool) { \
value = dynamic_cast< VTK_OBJ *>( \
vtkPythonUtil::GetPointerFromObject(src.ptr(), #VTK_OBJ)); \
if (!value) { \
PyErr_Clear(); \
throw reference_cast_error(); \
} \
return value != nullptr; \
} \
static handle cast(const VTK_OBJ& src, return_value_policy, handle) { \
return vtkPythonUtil::GetObjectFromPointer( \
const_cast< VTK_OBJ *>(&src)); \
} \
}; \
}}
#endif
| |
Add convenience function for hashing arbitrary types | #ifndef ARBITER_HASH_H
#define ARBITER_HASH_H
#ifndef __cplusplus
#error "This file must be compiled as C++."
#endif
#include <functional>
#include <type_traits>
namespace Arbiter {
template<typename T>
size_t hashOf (const T &value)
{
return std::hash<T>()(value);
}
}
#endif
| |
Add ignore warning pragma for deprecated declarations. | /* Headers needed for multiprocess communication through boost interprocess.
* This needs to be included BEFORE anything referencing machine.h,
* or macro definitions from machine.h would mess template args.
*/
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wnarrowing"
#pragma GCC diagnostic ignored "-Wunused-local-typedefs"
#pragma GCC diagnostic ignored "-Wmaybe-uninitialized"
#include <boost/interprocess/containers/deque.hpp>
#include <boost/interprocess/containers/string.hpp>
#include <boost/interprocess/containers/map.hpp>
#include <boost/interprocess/containers/vector.hpp>
#include <boost/unordered_map.hpp>
#include <boost/interprocess/managed_shared_memory.hpp>
#include <boost/interprocess/managed_mapped_file.hpp>
#include <boost/interprocess/shared_memory_object.hpp>
#include <boost/interprocess/allocators/allocator.hpp>
#include <boost/interprocess/interprocess_fwd.hpp>
#include <boost/interprocess/sync/named_mutex.hpp>
#pragma GCC diagnostic pop
#include "shared_map.h"
#include "shared_unordered_map.h"
| /* Headers needed for multiprocess communication through boost interprocess.
* This needs to be included BEFORE anything referencing machine.h,
* or macro definitions from machine.h would mess template args.
*/
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wnarrowing"
#pragma GCC diagnostic ignored "-Wunused-local-typedefs"
#pragma GCC diagnostic ignored "-Wmaybe-uninitialized"
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
#include <boost/interprocess/containers/deque.hpp>
#include <boost/interprocess/containers/string.hpp>
#include <boost/interprocess/containers/map.hpp>
#include <boost/interprocess/containers/vector.hpp>
#include <boost/unordered_map.hpp>
#include <boost/interprocess/managed_shared_memory.hpp>
#include <boost/interprocess/managed_mapped_file.hpp>
#include <boost/interprocess/shared_memory_object.hpp>
#include <boost/interprocess/allocators/allocator.hpp>
#include <boost/interprocess/interprocess_fwd.hpp>
#include <boost/interprocess/sync/named_mutex.hpp>
#pragma GCC diagnostic pop
#include "shared_map.h"
#include "shared_unordered_map.h"
|
Make this test actually test what its supposed to test. | // RUN: %llvmgcc -S %s -o - /dev/null
// XFAIL: *
#define ATTR_BITS(N) __attribute__((bitwidth(N)))
typedef int ATTR_BITS( 4) My04BitInt;
typedef int ATTR_BITS(16) My16BitInt;
typedef int ATTR_BITS(17) My17BitInt;
typedef int ATTR_BITS(37) My37BitInt;
typedef int ATTR_BITS(65) My65BitInt;
struct MyStruct {
My04BitInt i4Field;
short ATTR_BITS(12) i12Field;
long ATTR_BITS(17) i17Field;
My37BitInt i37Field;
};
My37BitInt doit( short ATTR_BITS(23) num) {
My17BitInt i;
struct MyStruct strct;
int bitsize1 = sizeof(My17BitInt);
int __attribute__((bitwidth(9))) j;
int bitsize2 = sizeof(j);
int result = bitsize1 + bitsize2;
strct.i17Field = result;
result += sizeof(struct MyStruct);
return result;
}
int
main ( int argc, char** argv)
{
return (int ATTR_BITS(32)) doit((short ATTR_BITS(23))argc);
}
| // RUN: %llvmgcc -S %s -o - /dev/null 2>&1 > /dev/null | \
// RUN: not grep warning
// XFAIL: *
#define ATTR_BITS(N) __attribute__((bitwidth(N)))
typedef int ATTR_BITS( 4) My04BitInt;
typedef int ATTR_BITS(16) My16BitInt;
typedef int ATTR_BITS(17) My17BitInt;
typedef int ATTR_BITS(37) My37BitInt;
typedef int ATTR_BITS(65) My65BitInt;
struct MyStruct {
My04BitInt i4Field;
short ATTR_BITS(12) i12Field;
long ATTR_BITS(17) i17Field;
My37BitInt i37Field;
};
My37BitInt doit( short ATTR_BITS(23) num) {
My17BitInt i;
struct MyStruct strct;
int bitsize1 = sizeof(My17BitInt);
int __attribute__((bitwidth(9))) j;
int bitsize2 = sizeof(j);
int result = bitsize1 + bitsize2;
strct.i17Field = result;
result += sizeof(struct MyStruct);
return result;
}
int
main ( int argc, char** argv)
{
return (int ATTR_BITS(32)) doit((short ATTR_BITS(23))argc);
}
|
Update Skia milestone to 93 | /*
* Copyright 2016 Google Inc.
*
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
#ifndef SK_MILESTONE
#define SK_MILESTONE 92
#endif
| /*
* Copyright 2016 Google Inc.
*
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
#ifndef SK_MILESTONE
#define SK_MILESTONE 93
#endif
|
Make State struct a clean POD strcut | #ifndef ZOMBIE_STATE_H
#define ZOMBIE_STATE_H
#include "box2ddef.h"
namespace zombie {
struct State {
Position position_{0, 0};
Velocity velocity_{0, 0};
float angle_{0.f};
float anglularVelocity_{0.f};
};
}
#endif
| #ifndef ZOMBIE_STATE_H
#define ZOMBIE_STATE_H
#include "box2ddef.h"
namespace zombie {
struct State {
Position position_;
Velocity velocity_;
float angle_;
float anglularVelocity_;
};
}
#endif
|
Bump version to 9.1.0 to avoid confusion | #ifndef Version_h
#define Version_h
#define BFARCHIVE_COMMA_SEPARATED_VERSION 3,0,0,0
#define BFARCHIVE_VERSION_STRING "3.0.0"
#endif
| #ifndef Version_h
#define Version_h
#define BFARCHIVE_COMMA_SEPARATED_VERSION 9,1,0,0
#define BFARCHIVE_VERSION_STRING "9.1.0"
#endif
|
Add APIntVal as a possible GenericeValue. | //===-- GenericValue.h - Represent any type of LLVM value -------*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
// This file was developed by the LLVM research group and is distributed under
// the University of Illinois Open Source License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
//
// The GenericValue class is used to represent an LLVM value of arbitrary type.
//
//===----------------------------------------------------------------------===//
#ifndef GENERIC_VALUE_H
#define GENERIC_VALUE_H
#include "llvm/Support/DataTypes.h"
namespace llvm {
typedef uintptr_t PointerTy;
union GenericValue {
bool Int1Val;
unsigned char Int8Val;
unsigned short Int16Val;
unsigned int Int32Val;
uint64_t Int64Val;
double DoubleVal;
float FloatVal;
struct { unsigned int first; unsigned int second; } UIntPairVal;
PointerTy PointerVal;
unsigned char Untyped[8];
GenericValue() {}
GenericValue(void *V) {
PointerVal = (PointerTy)(intptr_t)V;
}
};
inline GenericValue PTOGV(void *P) { return GenericValue(P); }
inline void* GVTOP(const GenericValue &GV) {
return (void*)(intptr_t)GV.PointerVal;
}
} // End llvm namespace
#endif
| //===-- GenericValue.h - Represent any type of LLVM value -------*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
// This file was developed by the LLVM research group and is distributed under
// the University of Illinois Open Source License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
//
// The GenericValue class is used to represent an LLVM value of arbitrary type.
//
//===----------------------------------------------------------------------===//
#ifndef GENERIC_VALUE_H
#define GENERIC_VALUE_H
#include "llvm/Support/DataTypes.h"
namespace llvm {
typedef uintptr_t PointerTy;
class APInt;
class Type;
union GenericValue {
bool Int1Val;
unsigned char Int8Val;
unsigned short Int16Val;
unsigned int Int32Val;
uint64_t Int64Val;
APInt *APIntVal;
double DoubleVal;
float FloatVal;
struct { unsigned int first; unsigned int second; } UIntPairVal;
PointerTy PointerVal;
unsigned char Untyped[8];
GenericValue() {}
GenericValue(void *V) {
PointerVal = (PointerTy)(intptr_t)V;
}
};
inline GenericValue PTOGV(void *P) { return GenericValue(P); }
inline void* GVTOP(const GenericValue &GV) {
return (void*)(intptr_t)GV.PointerVal;
}
} // End llvm namespace
#endif
|
Add Gemstone which makes use of alphabet array and strchr | /*
Problem Statement
John has discovered various rocks. Each rock is composed of various elements, and each element is represented by a lower-case Latin letter from 'a' to 'z'. An element can be present multiple times in a rock. An element is called a gem-element if it occurs at least once in each of the rocks.
Given the list of N rocks with their compositions, display the number of gem-elements that exist in those rocks.
Input Format
The first line consists of an integer, N, the number of rocks.
Each of the next N lines contains a rock's composition. Each composition consists of lower-case letters of English alphabet.
Constraints
1≤N≤100
Each composition consists of only lower-case Latin letters ('a'-'z').
1≤ length of each composition ≤100
Output Format
Print the number of gem-elements that are common in these rocks. If there are none, print 0.
Sample Input
3
abcdde
baccd
eeabg
Sample Output
2
Explanation
Only "a" and "b" are the two kinds of gem-elements, since these are the only characters that occur in every rock's composition.
*/
#include <stdio.h>
#include <string.h>
#include <math.h>
#include <stdlib.h>
int main() {
int n;
scanf("%d",&n);
char rock [n][101];
int i,j;
for(i=0; i<n; i++){
scanf("%s",rock[i]);
}
int array[26];
for(j=0 ; j<26; j++){
array[j]=0;
}
char char_int = 97;
char* result = NULL;
for (j = 0 ; j<26 ; j++){
for(i =0 ; i<n ; i++){
result = strchr(rock[i],char_int);
if(result != NULL){
array[j]++;
}
}
char_int ++;
}
int count =0;
for(j=0 ; j<26; j++){
if (array[j]== n){
count++;
}
}
printf("%d",count);
return 0;
}
| |
Fix stupid msvc compile error | #pragma once
#include <v8.h>
#include "isolate/holder.h"
#include "transferable_handle.h"
#include <memory>
namespace ivm {
class ScriptHandle : public TransferableHandle {
private:
class ScriptHandleTransferable : public Transferable {
private:
std::shared_ptr<IsolateHolder> isolate;
std::shared_ptr<v8::Persistent<v8::UnboundScript>> script;
public:
ScriptHandleTransferable(
std::shared_ptr<IsolateHolder> isolate,
std::shared_ptr<v8::Persistent<v8::UnboundScript>> script
);
v8::Local<v8::Value> TransferIn() final;
};
std::shared_ptr<IsolateHolder> isolate;
std::shared_ptr<v8::Persistent<v8::UnboundScript>> script;
public:
ScriptHandle(
std::shared_ptr<IsolateHolder> isolate,
std::shared_ptr<v8::Persistent<v8::UnboundScript>> script
);
static IsolateEnvironment::IsolateSpecific<v8::FunctionTemplate>& TemplateSpecific();
static v8::Local<v8::FunctionTemplate> Definition();
std::unique_ptr<Transferable> TransferOut() final;
template <bool async>
v8::Local<v8::Value> Run(class ContextHandle* context_handle, v8::MaybeLocal<v8::Object> maybe_options);
};
} // namespace ivm
| #pragma once
#include <v8.h>
#include "isolate/holder.h"
#include "transferable_handle.h"
#include <memory>
namespace ivm {
class ContextHandle;
class ScriptHandle : public TransferableHandle {
private:
class ScriptHandleTransferable : public Transferable {
private:
std::shared_ptr<IsolateHolder> isolate;
std::shared_ptr<v8::Persistent<v8::UnboundScript>> script;
public:
ScriptHandleTransferable(
std::shared_ptr<IsolateHolder> isolate,
std::shared_ptr<v8::Persistent<v8::UnboundScript>> script
);
v8::Local<v8::Value> TransferIn() final;
};
std::shared_ptr<IsolateHolder> isolate;
std::shared_ptr<v8::Persistent<v8::UnboundScript>> script;
public:
ScriptHandle(
std::shared_ptr<IsolateHolder> isolate,
std::shared_ptr<v8::Persistent<v8::UnboundScript>> script
);
static IsolateEnvironment::IsolateSpecific<v8::FunctionTemplate>& TemplateSpecific();
static v8::Local<v8::FunctionTemplate> Definition();
std::unique_ptr<Transferable> TransferOut() final;
template <bool async>
v8::Local<v8::Value> Run(ContextHandle* context_handle, v8::MaybeLocal<v8::Object> maybe_options);
};
} // namespace ivm
|
Make header parse standalone. NFC. | //===------ llvm/MC/MCAsmParserUtils.h - Asm Parser Utilities ---*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
#ifndef LLVM_MC_MCPARSER_MCASMPARSERUTILS_H
#define LLVM_MC_MCPARSER_MCASMPARSERUTILS_H
namespace llvm {
namespace MCParserUtils {
/// Parse a value expression and return whether it can be assigned to a symbol
/// with the given name.
///
/// On success, returns false and sets the Symbol and Value output parameters.
bool parseAssignmentExpression(StringRef Name, bool allow_redef,
MCAsmParser &Parser, MCSymbol *&Symbol,
const MCExpr *&Value);
} // namespace MCParserUtils
} // namespace llvm
#endif
| //===------ llvm/MC/MCAsmParserUtils.h - Asm Parser Utilities ---*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
#ifndef LLVM_MC_MCPARSER_MCASMPARSERUTILS_H
#define LLVM_MC_MCPARSER_MCASMPARSERUTILS_H
namespace llvm {
class MCAsmParser;
class MCExpr;
class MCSymbol;
class StringRef;
namespace MCParserUtils {
/// Parse a value expression and return whether it can be assigned to a symbol
/// with the given name.
///
/// On success, returns false and sets the Symbol and Value output parameters.
bool parseAssignmentExpression(StringRef Name, bool allow_redef,
MCAsmParser &Parser, MCSymbol *&Symbol,
const MCExpr *&Value);
} // namespace MCParserUtils
} // namespace llvm
#endif
|
Add 64 bit multiplication test | #include <stdio.h>
typedef unsigned int fixed_t;
fixed_t multiplyFixed(fixed_t a, fixed_t b)
{
return ((long long) a * (long long) b) >> 16;
}
int main(int argc, const char *argv[])
{
printf("%08x\n", multiplyFixed(0xffffe350, 0x009fe0c6)); // CHECK: e0b4157f
}
| |
Update Skia milestone to 57 | /*
* Copyright 2016 Google Inc.
*
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
#ifndef SK_MILESTONE
#define SK_MILESTONE 55
#endif
| /*
* Copyright 2016 Google Inc.
*
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
#ifndef SK_MILESTONE
#define SK_MILESTONE 57
#endif
|
Fix "control reaches end of non-void function" warning. | #include "direction.h"
#include <assert.h>
#include <base/base.h>
enum direction
direction_90_degrees_left(enum direction direction)
{
assert(direction_is_valid(direction));
return (direction + 270) % 360;
}
enum direction
direction_90_degrees_right(enum direction direction)
{
assert(direction_is_valid(direction));
return (direction + 90) % 360;
}
extern inline bool
direction_is_valid(unsigned direction);
char const *
direction_name(enum direction direction)
{
assert(direction_is_valid(direction));
switch (direction) {
case direction_north: return "north";
case direction_northeast: return "northeast";
case direction_east: return "east";
case direction_southeast: return "southeast";
case direction_south: return "south";
case direction_southwest: return "southwest";
case direction_west: return "west";
case direction_northwest: return "northwest";
}
}
enum direction
direction_opposite(enum direction direction)
{
assert(direction_is_valid(direction));
return (direction + 180) % 360;
}
enum direction
direction_random(struct rnd *rnd)
{
return rnd_next_uniform_value(rnd, 8) * 45;
}
| #include "direction.h"
#include <assert.h>
#include <base/base.h>
enum direction
direction_90_degrees_left(enum direction direction)
{
assert(direction_is_valid(direction));
return (direction + 270) % 360;
}
enum direction
direction_90_degrees_right(enum direction direction)
{
assert(direction_is_valid(direction));
return (direction + 90) % 360;
}
extern inline bool
direction_is_valid(unsigned direction);
char const *
direction_name(enum direction direction)
{
assert(direction_is_valid(direction));
switch (direction) {
case direction_north: return "north";
case direction_northeast: return "northeast";
case direction_east: return "east";
case direction_southeast: return "southeast";
case direction_south: return "south";
case direction_southwest: return "southwest";
case direction_west: return "west";
case direction_northwest: return "northwest";
}
return "north";
}
enum direction
direction_opposite(enum direction direction)
{
assert(direction_is_valid(direction));
return (direction + 180) % 360;
}
enum direction
direction_random(struct rnd *rnd)
{
return rnd_next_uniform_value(rnd, 8) * 45;
}
|
Switch to SIGLARM, to allow seamless gdb usage | #define _XOPEN_SOURCE 700
#include <stdio.h>
#include <signal.h>
#include <unistd.h>
#include <assert.h>
#include <stdlib.h>
#include <setjmp.h>
jmp_buf try;
void handler(int sig) {
static int i = 0;
printf("stack overflow %d\n", i);
longjmp(try, ++i);
assert(0);
}
unsigned recurse(unsigned x) {
return recurse(x)+1;
}
int main() {
char* stack;
stack = malloc(sizeof(stack) * SIGSTKSZ);
stack_t ss = {
.ss_size = SIGSTKSZ,
.ss_sp = stack,
};
struct sigaction sa = {
.sa_handler = handler,
.sa_flags = SA_ONSTACK
};
sigaltstack(&ss, 0);
sigfillset(&sa.sa_mask);
sigaction(SIGSEGV, &sa, 0);
if (setjmp(try) < 3) {
recurse(0);
} else {
printf("caught exception!\n");
}
return 0;
}
| #define _XOPEN_SOURCE 700
#include <stdio.h>
#include <signal.h>
#include <unistd.h>
#include <assert.h>
#include <stdlib.h>
#include <setjmp.h>
jmp_buf try;
void handler(int sig) {
static int i = 0;
printf("stack overflow %d\n", i);
longjmp(try, ++i);
assert(0);
}
unsigned recurse(unsigned x) {
return recurse(x)+1;
}
int main() {
char* stack;
stack = malloc(sizeof(stack) * SIGSTKSZ);
stack_t ss = {
.ss_size = SIGSTKSZ,
.ss_sp = stack,
};
struct sigaction sa = {
.sa_handler = handler,
.sa_flags = SA_ONSTACK
};
sigaltstack(&ss, 0);
sigfillset(&sa.sa_mask);
sigaction(SIGALRM, &sa, 0);
raise(SIGALRM);
return 0;
if (setjmp(try) < 3) {
recurse(0);
} else {
printf("caught exception!\n");
}
return 0;
}
|
Change test case to use 'clang -cc1' (without --disable-free) instead of c-index-test (whose memory management behavior may change in the future). | // RUN: c-index-test -test-load-source local %s 2>&1 | FileCheck %s
// This is invalid source. Previously a double-free caused this
// example to crash c-index-test.
int foo(int x) {
int y[x * 3];
help
};
// CHECK: 8:3: error: use of undeclared identifier 'help'
// CHECK: help
// CHECK: 12:102: error: expected '}'
| // RUN: %clang-cc1 -fsyntax-only %s 2>&1 | FileCheck %s
// IMPORTANT: This test case intentionally DOES NOT use --disable-free. It
// tests that we are properly reclaiming the ASTs and we do not have a double free.
// Previously we tried to free the size expression of the VLA twice.
int foo(int x) {
int y[x * 3];
help
};
// CHECK: 9:3: error: use of undeclared identifier 'help'
// CHECK: help
// CHECK: 14:102: error: expected '}'
|
Change transform interface to add/remove | // Copyright (c) 2015, Matthew Malensek.
// Distributed under the BSD 2-Clause License (see LICENSE.txt for details)
#pragma once
class VolumeTransformation;
class VolumeController {
public:
struct DeviceInfo {
std::wstring name;
std::wstring id;
};
/// <summary>
/// Retrieves the current volume level as a float, ranging from 0.0 - 1.0
/// </summary>
virtual float Volume() = 0;
/// <summary>Sets the volume level. Valid range: 0.0 - 1.0</summary>
virtual void Volume(float vol) = 0;
virtual bool Muted() = 0;
virtual void Muted(bool mute) = 0;
virtual void ToggleMute() {
(Muted() == true) ? Muted(false) : Muted(true);
}
virtual void Transformation(VolumeTransformation *transform) = 0;
virtual VolumeTransformation* Transformation() = 0;
public:
static const int MSG_VOL_CHNG = WM_APP + 1080;
static const int MSG_VOL_DEVCHNG = WM_APP + 1081;
}; | // Copyright (c) 2015, Matthew Malensek.
// Distributed under the BSD 2-Clause License (see LICENSE.txt for details)
#pragma once
class VolumeTransformation;
class VolumeController {
public:
struct DeviceInfo {
std::wstring name;
std::wstring id;
};
/// <summary>
/// Retrieves the current volume level as a float, ranging from 0.0 - 1.0
/// </summary>
virtual float Volume() = 0;
/// <summary>Sets the volume level. Valid range: 0.0 - 1.0</summary>
virtual void Volume(float vol) = 0;
virtual bool Muted() = 0;
virtual void Muted(bool mute) = 0;
virtual void ToggleMute() {
(Muted() == true) ? Muted(false) : Muted(true);
}
virtual void AddTransformation(VolumeTransformation *transform) = 0;
virtual void RemoveTransformation(VolumeTransformation *transform) = 0;
public:
static const int MSG_VOL_CHNG = WM_APP + 1080;
static const int MSG_VOL_DEVCHNG = WM_APP + 1081;
}; |
Add test file for testing func | /*
The MIT License (MIT)
Copyright (c) 2015 Alexander Zazhigin mykeich@yandex.ru
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 "broadcasttalk.h"
#include "threadsocket.h"
#include "threadoutaudio.h"
#include "threadinaudio.h"
#include "maindata.h"
#include "udpsocket.h"
#ifdef __ANDROID__
#else
/* Main application */
void main(void * arg){
LOGI("Enter: main\n");
LOGI("Exit: main\n");
}
#endif
| |
Adjust display position for pulse ox | #include "interface.h"
#include "ecg.h"
#include "AFE4400.h"
SPI_Interface afe4400_spi(spi_c2);
ECG ecg = ECG(1,1,4,9,PB0,4096,RA8875_BLUE,RA8875_BLACK,1000,tim3,&tft);
PulseOx spo2 = PulseOx(6,1,3,3,&afe4400_spi,PC8,PA9,PA8,PB7,&tft);
void enableSignalAcquisition(void) {
spo2.enable();
ecg.enable();
}
void connectSignalsToScreen(Screen& s) {
s.add(ecg.signalTrace);
s.add((ScreenElement*) &spo2);
}
| #include "interface.h"
#include "ecg.h"
#include "AFE4400.h"
SPI_Interface afe4400_spi(spi_c2);
ECG ecg = ECG(1,1,4,9,PB0,4096,RA8875_BLUE,RA8875_BLACK,1000,tim3,&tft);
PulseOx spo2 = PulseOx(5,1,4,9,&afe4400_spi,PC8,PA9,PA8,PB7,&tft);
void enableSignalAcquisition(void) {
spo2.enable();
ecg.enable();
}
void connectSignalsToScreen(Screen& s) {
s.add(ecg.signalTrace);
s.add((ScreenElement*) &spo2);
}
|
Add intermediate TextureVideoFrame typedef for Chromium | /*
* Copyright (c) 2015 The WebRTC project authors. All Rights Reserved.
*
* Use of this source code is governed by a BSD-style license
* that can be found in the LICENSE file in the root of the source
* tree. An additional intellectual property rights grant can be found
* in the file PATENTS. All contributing project authors may
* be found in the AUTHORS file in the root of the source tree.
*/
#ifndef COMMON_VIDEO_INTERFACE_TEXTURE_VIDEO_FRAME_H
#define COMMON_VIDEO_INTERFACE_TEXTURE_VIDEO_FRAME_H
#include "webrtc/common_video/interface/i420_video_frame.h"
// TODO(magjed): Remove this when all external dependencies are updated.
namespace webrtc {
typedef I420VideoFrame TextureVideoFrame;
} // namespace webrtc
#endif // COMMON_VIDEO_INTERFACE_TEXTURE_VIDEO_FRAME_H
| |
Fix 'umbrella header for module does not include...' error | //
// libPhoneNumber-iOS.h
// libPhoneNumber-iOS
//
// Created by Roy Marmelstein on 04/08/2015.
// Copyright (c) 2015 ohtalk.me. All rights reserved.
//
#import <UIKit/UIKit.h>
//! Project version number for libPhoneNumber-iOS.
FOUNDATION_EXPORT double libPhoneNumber_iOSVersionNumber;
//! Project version string for libPhoneNumber-iOS.
FOUNDATION_EXPORT const unsigned char libPhoneNumber_iOSVersionString[];
// In this header, you should import all the public headers of your framework
// using statements like #import <libPhoneNumber_iOS/PublicHeader.h>
#import "NBPhoneNumberDefines.h"
// Features
#import "NBAsYouTypeFormatter.h"
#import "NBPhoneNumberUtil.h"
// Metadata
#import "NBMetadataHelper.h"
// Model
#import "NBNumberFormat.h"
#import "NBPhoneMetaData.h"
#import "NBPhoneNumber.h"
#import "NBPhoneNumberDesc.h"
| //
// libPhoneNumber-iOS.h
// libPhoneNumber-iOS
//
// Created by Roy Marmelstein on 04/08/2015.
// Copyright (c) 2015 ohtalk.me. All rights reserved.
//
#import <UIKit/UIKit.h>
//! Project version number for libPhoneNumber-iOS.
FOUNDATION_EXPORT double libPhoneNumber_iOSVersionNumber;
//! Project version string for libPhoneNumber-iOS.
FOUNDATION_EXPORT const unsigned char libPhoneNumber_iOSVersionString[];
// In this header, you should import all the public headers of your framework
// using statements like #import <libPhoneNumber_iOS/PublicHeader.h>
#import "NBPhoneNumberDefines.h"
// Features
#import "NBAsYouTypeFormatter.h"
#import "NBPhoneNumberUtil.h"
// Metadata
#import "NBMetadataHelper.h"
#import "NBGeocoderMetadataHelper.h"
// Model
#import "NBNumberFormat.h"
#import "NBPhoneMetaData.h"
#import "NBPhoneNumber.h"
#import "NBPhoneNumberDesc.h"
|
Add Pagai's invariants extraction, fix various typos. | #include <stdio.h>
int simpleloop (int x, int y) {
while (x < y) {
if (x < 3)
x++;
else
x+=2;
}
return x;
}
int main () {
printf("%i", simpleloop(0, 10), stdout);
}
| int simpleloop (int x, int y) {
while (x < y) {
if (x < 3)
x++;
else
x+=2;
}
return x;
}
|
Use the right import type. | //
// SNPBlockUserOperation.h
// Snapper
//
// Created by Paul Schifferer on 5/12/13.
// Copyright (c) 2013 Pilgrimage Software. All rights reserved.
//
#import <Snapper/Snapper.h>
#import "SNPUserParameters.h"
@interface SNPBlockUserOperation : SNPBaseUserTokenOperation
<SNPUserParameters>
// -- Properties --
@property (nonatomic, assign) NSUInteger userId;
// -- Initialization --
- (id)initWithUserId:(NSUInteger)userId
accountId:(NSString*)accountId
finishBlock:(void (^)(SNPResponse* response))finishBlock;
@end
| //
// SNPBlockUserOperation.h
// Snapper
//
// Created by Paul Schifferer on 5/12/13.
// Copyright (c) 2013 Pilgrimage Software. All rights reserved.
//
#import "SNPBaseUserTokenOperation.h"
#import "SNPUserParameters.h"
@interface SNPBlockUserOperation : SNPBaseUserTokenOperation
<SNPUserParameters>
// -- Properties --
@property (nonatomic, assign) NSUInteger userId;
// -- Initialization --
- (id)initWithUserId:(NSUInteger)userId
accountId:(NSString*)accountId
finishBlock:(void (^)(SNPResponse* response))finishBlock;
@end
|
Include all headers by default | //
// MTStackableNavigationController.h
//
// Created by Mat Trudel on 2013-02-05.
// Copyright (c) 2013 Mat Trudel. All rights reserved.
//
#import <UIKit/UIKit.h>
#import "UIViewController+MTStackableNavigationController.h"
@interface MTStackableNavigationController : UIViewController <UINavigationBarDelegate>
@property(nonatomic, readonly) NSArray *viewControllers;
- (id)initWithRootViewController:(UIViewController *)rootViewController;
- (void)pushViewController:(UIViewController *)viewController animated:(BOOL)animated;
- (UIViewController *)popViewControllerAnimated:(BOOL)animated;
- (NSArray *)popToViewController:(UIViewController *)viewController animated:(BOOL)animated;
- (NSArray *)popToRootViewControllerAnimated:(BOOL)animated;
@property(nonatomic,readonly,retain) UIViewController *topViewController; // The top view controller on the stack.
@end
| //
// MTStackableNavigationController.h
//
// Created by Mat Trudel on 2013-02-05.
// Copyright (c) 2013 Mat Trudel. All rights reserved.
//
#import <UIKit/UIKit.h>
#import "UIViewController+MTStackableNavigationController.h"
#import "MTStackableNavigationItem.h"
@interface MTStackableNavigationController : UIViewController <UINavigationBarDelegate>
@property(nonatomic, readonly) NSArray *viewControllers;
- (id)initWithRootViewController:(UIViewController *)rootViewController;
- (void)pushViewController:(UIViewController *)viewController animated:(BOOL)animated;
- (UIViewController *)popViewControllerAnimated:(BOOL)animated;
- (NSArray *)popToViewController:(UIViewController *)viewController animated:(BOOL)animated;
- (NSArray *)popToRootViewControllerAnimated:(BOOL)animated;
@property(nonatomic,readonly,retain) UIViewController *topViewController; // The top view controller on the stack.
@end
|
Add Chapter 27, exercise 9 | /* Chapter 27, exercise 9: using only C facilities, including the C standard
library, read a sequence of words from stdin and write them to stdout in
lexicographical order. Use qsort() or insert the words into an ordered list
as you read them. */
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#define WORD_LEN 256
#define ARR_LEN 128
void print(char* words[])
{
while (*words)
printf("%s\n",*words++);
}
char* get_word()
{
char* word = (char*)malloc(WORD_LEN);
char* word_ptr = word;
int x;
while ((x=getchar()) != EOF) {
if (x=='\n') {
*word_ptr = 0;
break;
}
*word_ptr = x;
++word_ptr;
}
return word;
}
/* wrapper fro strcmp so it can be used with qsort */
int cmpstr(const void* a, const void* b)
{
const char* aa = *(const char**)a;
const char* bb = *(const char**)b;
return strcmp(aa,bb);
}
int main()
{
char* words[ARR_LEN] = { 0 };
int ctr = 0;
char* word;
while (strcmp(word = get_word(),"quit"))
words[ctr++] = word;
printf("\nSequence of words before sorting:\n");
print(words);
qsort(words,ctr,sizeof(char*),cmpstr);
printf("\nSequence after sorting:\n");
print(words);
}
| |
Fix ps depedency when ps not included | /*
* Copyright (C) 2013 INRIA.
*
* This file is subject to the terms and conditions of the GNU Lesser
* General Public License v2.1. See the file LICENSE in the top level
* directory for more details.
*/
/**
* @ingroup sys_shell_commands
* @{
*
* @file
* @brief Shell commands for the PS module
*
* @author Oliver Hahm <oliver.hahm@inria.fr>
*
* @}
*/
#include "ps.h"
int _ps_handler(int argc, char **argv)
{
(void) argc;
(void) argv;
ps();
return 0;
}
| /*
* Copyright (C) 2013 INRIA.
*
* This file is subject to the terms and conditions of the GNU Lesser
* General Public License v2.1. See the file LICENSE in the top level
* directory for more details.
*/
/**
* @ingroup sys_shell_commands
* @{
*
* @file
* @brief Shell commands for the PS module
*
* @author Oliver Hahm <oliver.hahm@inria.fr>
*
* @}
*/
#ifdef MODULE_PS
#include "ps.h"
int _ps_handler(int argc, char **argv)
{
(void) argc;
(void) argv;
ps();
return 0;
}
#endif |
Add target triples to fix test on non-x86. | // RUN: %clang_cc1 -O1 -S -o - %s | FileCheck -check-prefix=STRCPY -check-prefix=MEMSET %s
// RUN: %clang_cc1 -fno-builtin -O1 -S -o - %s | FileCheck -check-prefix=NOSTRCPY -check-prefix=NOMEMSET %s
// RUN: %clang_cc1 -fno-builtin-memset -O1 -S -o - %s | FileCheck -check-prefix=STRCPY -check-prefix=NOMEMSET %s
void PR13497() {
char content[2];
// make sure we don't optimize this call to strcpy()
// STRCPY-NOT: __strcpy_chk
// NOSTRCPY: __strcpy_chk
__builtin___strcpy_chk(content, "", 1);
}
void PR4941(char *s) {
// Make sure we don't optimize this loop to a memset().
// NOMEMSET-NOT: memset
// MEMSET: memset
for (unsigned i = 0; i < 8192; ++i)
s[i] = 0;
}
| // RUN: %clang_cc1 -triple x86_64-linux-gnu -O1 -S -o - %s | FileCheck -check-prefix=STRCPY -check-prefix=MEMSET %s
// RUN: %clang_cc1 -triple x86_64-linux-gnu -fno-builtin -O1 -S -o - %s | FileCheck -check-prefix=NOSTRCPY -check-prefix=NOMEMSET %s
// RUN: %clang_cc1 -triple x86_64-linux-gnu -fno-builtin-memset -O1 -S -o - %s | FileCheck -check-prefix=STRCPY -check-prefix=NOMEMSET %s
void PR13497() {
char content[2];
// make sure we don't optimize this call to strcpy()
// STRCPY-NOT: __strcpy_chk
// NOSTRCPY: __strcpy_chk
__builtin___strcpy_chk(content, "", 1);
}
void PR4941(char *s) {
// Make sure we don't optimize this loop to a memset().
// NOMEMSET-NOT: memset
// MEMSET: memset
for (unsigned i = 0; i < 8192; ++i)
s[i] = 0;
}
|
Add declaration of double** to Qt metatype engine. | /* dtkComposerMetatype.h ---
*
* Author: tkloczko
* Copyright (C) 2011 - Thibaud Kloczko, Inria.
* Created: Sat Aug 4 00:26:47 2012 (+0200)
* Version: $Id$
* Last-Updated: Wed Oct 17 11:45:26 2012 (+0200)
* By: Julien Wintz
* Update #: 12
*/
/* Commentary:
*
*/
/* Change log:
*
*/
#ifndef DTKCOMPOSERMETATYPE_H
#define DTKCOMPOSERMETATYPE_H
#include <QtCore>
// /////////////////////////////////////////////////////////////////
//
// /////////////////////////////////////////////////////////////////
Q_DECLARE_METATYPE(bool*);
Q_DECLARE_METATYPE(int*);
Q_DECLARE_METATYPE(uint*);
Q_DECLARE_METATYPE(qlonglong*);
Q_DECLARE_METATYPE(qulonglong*);
Q_DECLARE_METATYPE(qreal*);
Q_DECLARE_METATYPE(QString*);
#endif
| /* dtkComposerMetatype.h ---
*
* Author: tkloczko
* Copyright (C) 2011 - Thibaud Kloczko, Inria.
* Created: Sat Aug 4 00:26:47 2012 (+0200)
* Version: $Id$
* Last-Updated: Thu Jun 13 14:55:45 2013 (+0200)
* By: Thibaud Kloczko
* Update #: 15
*/
/* Commentary:
*
*/
/* Change log:
*
*/
#ifndef DTKCOMPOSERMETATYPE_H
#define DTKCOMPOSERMETATYPE_H
#include <QtCore>
// /////////////////////////////////////////////////////////////////
//
// /////////////////////////////////////////////////////////////////
Q_DECLARE_METATYPE(bool*);
Q_DECLARE_METATYPE(int*);
Q_DECLARE_METATYPE(uint*);
Q_DECLARE_METATYPE(qlonglong*);
Q_DECLARE_METATYPE(qulonglong*);
Q_DECLARE_METATYPE(qreal*);
Q_DECLARE_METATYPE(double **)
Q_DECLARE_METATYPE(QString*);
#endif
|
Check that there's something in the username buffer before reading it | #include <unistd.h>
#include <stdio.h>
#include <string.h>
#include <pthread.h>
#include <errno.h>
#include "spotify-fs.h"
int main(int argc, char *argv[])
{
int retval = 0;
char *password = NULL;
char *username = malloc(SPOTIFY_USERNAME_MAXLEN);
if ((getuid() == 0) || (geteuid() == 0)) {
fprintf(stderr, "Running %s as root is not a good idea\n", application_name);
return 1;
}
printf("spotify username: ");
username = fgets(username, SPOTIFY_USERNAME_MAXLEN, stdin);
long username_len = strlen(username);
if(username[username_len-1] == '\n') {
username[username_len-1] = '\0';
}
password = getpass("spotify password: ");
if (strlen(password) <= 0)
{
password = NULL;
}
/* should we do something about this, really?
* Maybe put error logging here instead of in
* spotify_session_init()*/
(void) spotify_session_init(username, password, NULL);
retval = fuse_main(argc, argv, &spfs_operations, NULL);
return retval;
}
| #include <unistd.h>
#include <stdio.h>
#include <string.h>
#include <pthread.h>
#include <errno.h>
#include "spotify-fs.h"
int main(int argc, char *argv[])
{
int retval = 0;
char *password = NULL;
char *username = malloc(SPOTIFY_USERNAME_MAXLEN);
if ((getuid() == 0) || (geteuid() == 0)) {
fprintf(stderr, "Running %s as root is not a good idea\n", application_name);
return 1;
}
printf("spotify username: ");
username = fgets(username, SPOTIFY_USERNAME_MAXLEN, stdin);
long username_len = strlen(username);
if(username_len > 0 && username[username_len-1] == '\n') {
username[username_len-1] = '\0';
}
password = getpass("spotify password: ");
if (strlen(password) <= 0)
{
password = NULL;
}
/* should we do something about this, really?
* Maybe put error logging here instead of in
* spotify_session_init()*/
(void) spotify_session_init(username, password, NULL);
retval = fuse_main(argc, argv, &spfs_operations, NULL);
return retval;
}
|
Add header file def for private structure | #ifndef _LIBSMART_PRIV_H
#define _LIBSMART_PRIV_H
typedef struct smart_s {
smart_protocol_e protocol;
/* Device / OS specific follows this structure */
} smart_t;
#endif
| |
Fix compilation on MacOSX (common symbols not allowed with MH_DYLIB output format) | #ifdef _WIN32
#define DL_EXPORT __declspec( dllexport )
#else
#define DL_EXPORT
#endif
DL_EXPORT int TestDynamicLoaderData;
DL_EXPORT void TestDynamicLoaderFunction()
{
}
| #ifdef _WIN32
#define DL_EXPORT __declspec( dllexport )
#else
#define DL_EXPORT
#endif
DL_EXPORT int TestDynamicLoaderData = 0;
DL_EXPORT void TestDynamicLoaderFunction()
{
}
|
Update Game to new objectd api | #include <kotaka/paths.h>
#include <game/paths.h>
inherit LIB_BIN;
void main(string args)
{
object user;
user = query_user();
if (user->query_class() < 2) {
send_out("You do not have sufficient access rights to rebuild.\n");
return;
}
OBJECTD->klib_recompile();
OBJECTD->global_recompile();
}
| #include <kotaka/paths.h>
#include <game/paths.h>
inherit LIB_BIN;
void main(string args)
{
object user;
user = query_user();
if (user->query_class() < 1) {
send_out("You do not have sufficient access rights to rebuild.\n");
return;
}
OBJECTD->recompile_everything();
}
|
Fix missing include breaking compilation with Qt 5.0. | #ifndef HSQML_ENGINE_H
#define HSQML_ENGINE_H
#include <QtCore/QScopedPointer>
#include <QtCore/QString>
#include <QtCore/QUrl>
#include <QtQml/QQmlEngine>
#include <QtQml/QQmlContext>
#include <QtQml/QQmlComponent>
#include "hsqml.h"
class HsQMLObjectProxy;
class HsQMLWindow;
struct HsQMLEngineConfig
{
HsQMLEngineConfig()
: contextObject(NULL)
, stopCb(NULL)
{}
HsQMLObjectProxy* contextObject;
QString initialURL;
QStringList importPaths;
QStringList pluginPaths;
HsQMLTrivialCb stopCb;
};
class HsQMLEngine : public QObject
{
Q_OBJECT
public:
HsQMLEngine(const HsQMLEngineConfig&);
~HsQMLEngine();
bool eventFilter(QObject*, QEvent*);
QQmlEngine* declEngine();
private:
Q_DISABLE_COPY(HsQMLEngine)
Q_SLOT void componentStatus(QQmlComponent::Status);
QQmlEngine mEngine;
QQmlComponent mComponent;
QList<QObject*> mObjects;
HsQMLTrivialCb mStopCb;
};
#endif /*HSQML_ENGINE_H*/
| #ifndef HSQML_ENGINE_H
#define HSQML_ENGINE_H
#include <QtCore/QScopedPointer>
#include <QtCore/QString>
#include <QtCore/QStringList>
#include <QtCore/QUrl>
#include <QtQml/QQmlEngine>
#include <QtQml/QQmlContext>
#include <QtQml/QQmlComponent>
#include "hsqml.h"
class HsQMLObjectProxy;
class HsQMLWindow;
struct HsQMLEngineConfig
{
HsQMLEngineConfig()
: contextObject(NULL)
, stopCb(NULL)
{}
HsQMLObjectProxy* contextObject;
QString initialURL;
QStringList importPaths;
QStringList pluginPaths;
HsQMLTrivialCb stopCb;
};
class HsQMLEngine : public QObject
{
Q_OBJECT
public:
HsQMLEngine(const HsQMLEngineConfig&);
~HsQMLEngine();
bool eventFilter(QObject*, QEvent*);
QQmlEngine* declEngine();
private:
Q_DISABLE_COPY(HsQMLEngine)
Q_SLOT void componentStatus(QQmlComponent::Status);
QQmlEngine mEngine;
QQmlComponent mComponent;
QList<QObject*> mObjects;
HsQMLTrivialCb mStopCb;
};
#endif /*HSQML_ENGINE_H*/
|
Structure to hold data abouth crystal/cell energies corresponding to a single RCU block | #ifndef ALIHLTPHOSRCUCELLENERGYDATA_H
#define ALIHLTPHOSRCUCELLENERGYDATA_H
struct AliHLTPHOSRcuCellEnergyData
{
AliHLTUInt8_t fRcuX;
AliHLTUInt8_t fRcuY;
AliHLTUInt8_t fModuleID;
unsigned long cellEnergies[32][28][2];
};
#endif
| |
Test commit: Remove trailing whitespace. | //===-- GCs.h - Garbage collector linkage hacks ---------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
//
// This file contains hack functions to force linking in the GC components.
//
//===----------------------------------------------------------------------===//
#ifndef LLVM_CODEGEN_GCS_H
#define LLVM_CODEGEN_GCS_H
namespace llvm {
class GCStrategy;
class GCMetadataPrinter;
/// FIXME: Collector instances are not useful on their own. These no longer
/// serve any purpose except to link in the plugins.
/// Creates an ocaml-compatible garbage collector.
void linkOcamlGC();
/// Creates an ocaml-compatible metadata printer.
void linkOcamlGCPrinter();
/// Creates an erlang-compatible garbage collector.
void linkErlangGC();
/// Creates an erlang-compatible metadata printer.
void linkErlangGCPrinter();
/// Creates a shadow stack garbage collector. This collector requires no code
/// generator support.
void linkShadowStackGC();
}
#endif
| //===-- GCs.h - Garbage collector linkage hacks ---------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
//
// This file contains hack functions to force linking in the GC components.
//
//===----------------------------------------------------------------------===//
#ifndef LLVM_CODEGEN_GCS_H
#define LLVM_CODEGEN_GCS_H
namespace llvm {
class GCStrategy;
class GCMetadataPrinter;
/// FIXME: Collector instances are not useful on their own. These no longer
/// serve any purpose except to link in the plugins.
/// Creates an ocaml-compatible garbage collector.
void linkOcamlGC();
/// Creates an ocaml-compatible metadata printer.
void linkOcamlGCPrinter();
/// Creates an erlang-compatible garbage collector.
void linkErlangGC();
/// Creates an erlang-compatible metadata printer.
void linkErlangGCPrinter();
/// Creates a shadow stack garbage collector. This collector requires no code
/// generator support.
void linkShadowStackGC();
}
#endif
|
Fix operator<<(ostream&) and operator>>(istream&) for gfx::Size | // LAF Gfx Library
// Copyright (C) 2019 Igara Studio S.A.
//
// This file is released under the terms of the MIT license.
// Read LICENSE.txt for more information.
#ifndef GFX_SIZE_IO_H_INCLUDED
#define GFX_SIZE_IO_H_INCLUDED
#pragma once
#include "gfx/size.h"
#include <iosfwd>
namespace gfx {
inline std::ostream& operator<<(std::ostream& os, const Size& size) {
return os << "("
<< size.x << ", "
<< size.y << ")";
}
inline std::istream& operator>>(std::istream& in, Size& size) {
while (in && in.get() != '(')
;
if (!in)
return in;
char chr;
in >> size.x >> chr
>> size.y;
return in;
}
}
#endif
| // LAF Gfx Library
// Copyright (C) 2019 Igara Studio S.A.
//
// This file is released under the terms of the MIT license.
// Read LICENSE.txt for more information.
#ifndef GFX_SIZE_IO_H_INCLUDED
#define GFX_SIZE_IO_H_INCLUDED
#pragma once
#include "gfx/size.h"
#include <iosfwd>
namespace gfx {
inline std::ostream& operator<<(std::ostream& os, const Size& size) {
return os << "("
<< size.w << ", "
<< size.h << ")";
}
inline std::istream& operator>>(std::istream& in, Size& size) {
while (in && in.get() != '(')
;
if (!in)
return in;
char chr;
in >> size.w >> chr
>> size.h;
return in;
}
}
#endif
|
Remove yet another memory leak | #include "blueprint.h"
#include <assert.h>
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>
#include <math.h>
#include "parson.h"
#include "bstrlib.h"
void free_blueprint(struct blueprint *bp)
{
if (bp == NULL)
return;
bdestroy(bp->name);
bdestroy(bp->blueprint_name);
bdestroy(bp->Name);
bdestroy(bp->game_version);
for (int i = 0; i < bp->num_sc; i++)
free_blueprint(&bp->SCs[i]);
free(bp->blocks);
free(bp);
}
| #include "blueprint.h"
#include <assert.h>
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>
#include <math.h>
#include "parson.h"
#include "bstrlib.h"
void free_blueprint(struct blueprint *bp)
{
if (bp == NULL)
return;
bdestroy(bp->name);
bdestroy(bp->blueprint_name);
bdestroy(bp->Name);
bdestroy(bp->game_version);
for (int i = 0; i < bp->num_sc; i++)
free_blueprint(&bp->SCs[i]);
for (int i = 0; i < bp->total_block_count; i++)
{
if (bp->blocks[i].string_data == NULL)
continue;
bdestroy(bp->blocks[i].string_data);
}
free(bp->blocks);
free(bp);
}
|
Fix typo in `idxstat` subcommand | #include "goontools.h"
void usage(char* prog)
{
fprintf(stderr, "\n");
fprintf(stderr, "Usage: %s <subcommand> <subcommand arguments>\n", prog);
fprintf(stderr, "\n");
fprintf(stderr, "subcommands:\n");
fprintf(stderr, " index index file\n");
fprintf(stderr, " sort sort file\n");
fprintf(stderr, " view view/slice file\n");
fprintf(stderr, " idxstat print index information\n");
fprintf(stderr, "\n");
}
int dispatch(int argc, char *argv[])
{
char *subcommands[] = {
"index",
"view",
"sort",
"idxstats",
NULL // sentinel
};
Subcommand dispatch[] = {
&goonindex,
&goonview,
&goonsort,
&goonidxstat
};
char **s;
for (s = subcommands; *s != NULL; s += 1) {
if (strcmp(argv[1], *s) == 0) {
break;
}
}
if (*s == NULL) {
usage(argv[0]);
return -1;
}
return dispatch[s-subcommands](argc-1, argv+1);
}
int main(int argc, char *argv[])
{
if (argc == 1) {
usage(argv[0]);
return EXIT_FAILURE;
}
if (dispatch(argc, argv) != 0) {
return EXIT_FAILURE;
}
return EXIT_SUCCESS;
}
| #include "goontools.h"
void usage(char* prog)
{
fprintf(stderr, "\n");
fprintf(stderr, "Usage: %s <subcommand> <subcommand arguments>\n", prog);
fprintf(stderr, "\n");
fprintf(stderr, "subcommands:\n");
fprintf(stderr, " index index file\n");
fprintf(stderr, " sort sort file\n");
fprintf(stderr, " view view/slice file\n");
fprintf(stderr, " idxstat print index information\n");
fprintf(stderr, "\n");
}
int dispatch(int argc, char *argv[])
{
char *subcommands[] = {
"index",
"view",
"sort",
"idxstat",
NULL // sentinel
};
Subcommand dispatch[] = {
&goonindex,
&goonview,
&goonsort,
&goonidxstat
};
char **s;
for (s = subcommands; *s != NULL; s += 1) {
if (strcmp(argv[1], *s) == 0) {
break;
}
}
if (*s == NULL) {
usage(argv[0]);
return -1;
}
return dispatch[s-subcommands](argc-1, argv+1);
}
int main(int argc, char *argv[])
{
if (argc == 1) {
usage(argv[0]);
return EXIT_FAILURE;
}
if (dispatch(argc, argv) != 0) {
return EXIT_FAILURE;
}
return EXIT_SUCCESS;
}
|
Add an unknown folder type | #ifndef KMFOLDERTYPE_H
#define KMFOLDERTYPE_H
typedef enum
{
KMFolderTypeMbox = 0,
KMFolderTypeMaildir,
KMFolderTypeCachedImap,
KMFolderTypeImap,
KMFolderTypeSearch
} KMFolderType;
typedef enum
{
KMStandardDir = 0,
KMImapDir,
KMSearchDir
} KMFolderDirType;
#endif // KMFOLDERTYPE_H
| #ifndef KMFOLDERTYPE_H
#define KMFOLDERTYPE_H
typedef enum
{
KMFolderTypeMbox = 0,
KMFolderTypeMaildir,
KMFolderTypeCachedImap,
KMFolderTypeImap,
KMFolderTypeSearch,
KMFolderTypeUnknown
} KMFolderType;
typedef enum
{
KMStandardDir = 0,
KMImapDir,
KMSearchDir
} KMFolderDirType;
#endif // KMFOLDERTYPE_H
|
Fix compile of posix clock after timestamp_t was renamed to csp_timestamp_t | /*
Cubesat Space Protocol - A small network-layer protocol designed for Cubesats
Copyright (C) 2012 Gomspace ApS (http://www.gomspace.com)
Copyright (C) 2012 AAUSAT3 Project (http://aausat3.space.aau.dk)
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include <csp/arch/csp_clock.h>
#include <time.h>
void clock_get_time(timestamp_t * timestamp) {
timestamp->tv_sec = time(0);
}
void clock_set_time(timestamp_t * timestamp) {
return;
}
| /*
Cubesat Space Protocol - A small network-layer protocol designed for Cubesats
Copyright (C) 2012 Gomspace ApS (http://www.gomspace.com)
Copyright (C) 2012 AAUSAT3 Project (http://aausat3.space.aau.dk)
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include <csp/arch/csp_clock.h>
#include <time.h>
void clock_get_time(csp_timestamp_t * timestamp) {
timestamp->tv_sec = time(0);
}
void clock_set_time(csp_timestamp_t * timestamp) {
return;
}
|
Add override to overridden method | #pragma once
#include <gloperate/gloperate_api.h>
#include <gloperate/painter/AbstractOutputCapability.h>
#include <gloperate/pipeline/AbstractPipeline.h>
#include <string>
#include <vector>
namespace gloperate
{
class AbstractData;
template <typename T>
class Data;
/**
* @brief
* OutputCapability for pipelines
*
*/
class GLOPERATE_API PipelineOutputCapability : public AbstractOutputCapability
{
public:
/**
* @brief
* Constructor
*/
PipelineOutputCapability(gloperate::AbstractPipeline & pipeline);
/**
* @brief
* Destructor
*/
virtual ~PipelineOutputCapability();
virtual std::vector<gloperate::AbstractData*> allOutputs() const;
protected:
gloperate::AbstractPipeline & m_pipeline;
};
} // namespace gloperate
| #pragma once
#include <gloperate/gloperate_api.h>
#include <gloperate/painter/AbstractOutputCapability.h>
#include <gloperate/pipeline/AbstractPipeline.h>
#include <string>
#include <vector>
namespace gloperate
{
class AbstractData;
template <typename T>
class Data;
/**
* @brief
* OutputCapability for pipelines
*
*/
class GLOPERATE_API PipelineOutputCapability : public AbstractOutputCapability
{
public:
/**
* @brief
* Constructor
*/
PipelineOutputCapability(gloperate::AbstractPipeline & pipeline);
/**
* @brief
* Destructor
*/
virtual ~PipelineOutputCapability();
virtual std::vector<gloperate::AbstractData*> allOutputs() const override;
protected:
gloperate::AbstractPipeline & m_pipeline;
};
} // namespace gloperate
|
Use MCefRefPtr::get() to check for null reference | // Copyright 2010-2015 The CefSharp Authors. All rights reserved.
//
// Use of this source code is governed by a BSD-style license that can be found in the LICENSE file.
#pragma once
#include "Stdafx.h"
#include "include\cef_callback.h"
namespace CefSharp
{
public ref class CefCallbackWrapper : public ICallback
{
private:
MCefRefPtr<CefCallback> _callback;
public:
CefCallbackWrapper(CefRefPtr<CefCallback> &callback) : _callback(callback)
{
}
!CefCallbackWrapper()
{
_callback = NULL;
}
~CefCallbackWrapper()
{
this->!CefCallbackWrapper();
}
virtual void Cancel()
{
if (this == nullptr)
{
return;
}
_callback->Cancel();
delete this;
}
virtual void Continue()
{
if (this == nullptr)
{
return;
}
_callback->Continue();
delete this;
}
};
} | // Copyright 2010-2015 The CefSharp Authors. All rights reserved.
//
// Use of this source code is governed by a BSD-style license that can be found in the LICENSE file.
#pragma once
#include "Stdafx.h"
#include "include\cef_callback.h"
namespace CefSharp
{
public ref class CefCallbackWrapper : public ICallback
{
private:
MCefRefPtr<CefCallback> _callback;
public:
CefCallbackWrapper(CefRefPtr<CefCallback> &callback) : _callback(callback)
{
}
!CefCallbackWrapper()
{
_callback = NULL;
}
~CefCallbackWrapper()
{
this->!CefCallbackWrapper();
}
virtual void Cancel()
{
if (_callback.get() == nullptr)
{
return;
}
_callback->Cancel();
delete this;
}
virtual void Continue()
{
if (_callback.get() == nullptr)
{
return;
}
_callback->Continue();
delete this;
}
};
} |
Fix the `__cplusplus` gating for std::make_unique | /**
* Copyright (c) 2016-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.
*/
#pragma once
#include <algorithm>
#include <memory>
#include <utility>
namespace std {
#if __cplusplus<201402L
// simple implementation of make_unique since C++11 doesn't have it available
// note that it doesn't work properly if T is an array type
template <typename T, typename... Args>
std::unique_ptr<T> make_unique(Args... args) {
return std::unique_ptr<T>(new T(std::forward<Args>(args)...));
}
#endif
}
/**
* Insert into the proper location in a sorted container.
*/
template <class Container, class T, class Compare>
void insert_sorted(Container& c, const T& e, Compare comp) {
c.insert(std::lower_bound(c.begin(), c.end(), e, comp), e);
}
| /**
* Copyright (c) 2016-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.
*/
#pragma once
#include <algorithm>
#include <memory>
#include <utility>
namespace std {
#if __cplusplus<201300L
// simple implementation of make_unique since C++11 doesn't have it available
// note that it doesn't work properly if T is an array type
template <typename T, typename... Args>
std::unique_ptr<T> make_unique(Args... args) {
return std::unique_ptr<T>(new T(std::forward<Args>(args)...));
}
#endif
}
/**
* Insert into the proper location in a sorted container.
*/
template <class Container, class T, class Compare>
void insert_sorted(Container& c, const T& e, Compare comp) {
c.insert(std::lower_bound(c.begin(), c.end(), e, comp), e);
}
|
Add string manipulation functions for windows. | /*
*The MIT License (MIT)
*
* Copyright (c) <2017> <Stephan Gatzka>
*
* 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 <ctype.h>
#include <stddef.h>
#include <string.h>
#include "jet_string.h"
void *jet_memmem(const void *haystack, size_t haystacklen, const void *needle, size_t needlelen)
{
register char *cur, *last;
const char *cl = (const char *)haystack;
const char *cs = (const char *)needle;
if (haystacklen == 0 || needlelen == 0)
return NULL;
if (haystacklen < needlelen)
return NULL;
if (needlelen == 1)
return memchr(haystack, (int)*cs, haystacklen);
last = (char *)cl + haystacklen - needlelen;
for (cur = (char *)cl; cur <= last; cur++)
if (cur[0] == cs[0] && memcmp(cur, cs, needlelen) == 0)
return cur;
return NULL;
}
const char *jet_strcasestr(const char *haystack, const char *needle)
{
char c, sc;
size_t len;
if ((c = *needle++) != 0) {
c = tolower((unsigned char)c);
len = strlen(needle);
do {
do {
if ((sc = *haystack++) == 0)
return (NULL);
} while ((char)tolower((unsigned char)sc) != c);
} while (jet_strncasecmp(haystack, needle, len) != 0);
haystack--;
}
return (haystack);
}
int jet_strncasecmp(const char *s1, const char *s2, size_t n)
{
return _strnicmp(s1, s2, n);
}
int jet_strcasecmp(const char *s1, const char *s2)
{
return _stricmp(s1, s2);
}
| |
Add formpost pointer in curl handle | #ifndef CPR_CURL_HOLDER_H
#define CPR_CURL_HOLDER_H
#include <memory>
#include <curl/curl.h>
namespace cpr {
struct CurlHolder {
CURL* handle;
struct curl_slist* chunk;
char error[CURL_ERROR_SIZE];
};
} // namespace cpr
#endif
| #ifndef CPR_CURL_HOLDER_H
#define CPR_CURL_HOLDER_H
#include <memory>
#include <curl/curl.h>
namespace cpr {
struct CurlHolder {
CURL* handle;
struct curl_slist* chunk;
struct curl_httppost* formpost;
char error[CURL_ERROR_SIZE];
};
} // namespace cpr
#endif
|
Change default port number 5432 | //===----------------------------------------------------------------------===//
//
// Peloton
//
// config.h
//
// Identification: src/include/common/config.h
//
// Copyright (c) 2015-16, Carnegie Mellon University Database Group
//
//===----------------------------------------------------------------------===//
#pragma once
#include <string>
namespace peloton {
class PelotonConfiguration {
public:
static void PrintHelp();
int GetPort() const;
void SetPort(const int port);
int GetMaxConnections() const;
void SetMaxConnections(const int max_connections);
std::string GetSocketFamily() const;
void SetSocketFamily(const std::string& socket_family);
protected:
// Peloton port
int port = 12345;
// Maximum number of connections
int max_connections = 64;
// Socket family (AF_UNIX, AF_INET)
std::string socket_family = "AF_INET";
};
} // End peloton namespace
| //===----------------------------------------------------------------------===//
//
// Peloton
//
// config.h
//
// Identification: src/include/common/config.h
//
// Copyright (c) 2015-16, Carnegie Mellon University Database Group
//
//===----------------------------------------------------------------------===//
#pragma once
#include <string>
namespace peloton {
class PelotonConfiguration {
public:
static void PrintHelp();
int GetPort() const;
void SetPort(const int port);
int GetMaxConnections() const;
void SetMaxConnections(const int max_connections);
std::string GetSocketFamily() const;
void SetSocketFamily(const std::string& socket_family);
protected:
// Peloton port
int port = 5432;
// Maximum number of connections
int max_connections = 64;
// Socket family (AF_UNIX, AF_INET)
std::string socket_family = "AF_INET";
};
} // End peloton namespace
|
Fix MCU procedure ID definitions. | #ifndef LMS7_MCU_PROGRAMS_H
#define LMS7_MCU_PROGRAMS_H
#include "LimeSuiteConfig.h"
#include <stdint.h>
#define MCU_PROGRAM_SIZE 16384
#define MCU_ID_DC_IQ_CALIBRATIONS 0x01
#define MCU_ID_CALIBRATIONS_SINGLE_IMAGE 0x05
#define MCU_FUNCTION_CALIBRATE_TX 1
#define MCU_FUNCTION_CALIBRATE_RX 2
#define MCU_FUNCTION_UPDATE_BW 3
#define MCU_FUNCTION_UPDATE_REF_CLK 4
#define MCU_FUNCTION_TUNE_TX_FILTER 5
#define MCU_FUNCTION_TUNE_RX_FILTER 6
#define MCU_FUNCTION_UPDATE_EXT_LOOPBACK_PAIR 9
#define MCU_FUNCTION_CALIBRATE_TX_EXTLOOPB 17
#define MCU_FUNCTION_CALIBRATE_RX_EXTLOOPB 18
#define MCU_FUNCTION_AGC 10
#define MCU_FUNCTION_GET_PROGRAM_ID 255
LIME_API extern const uint8_t mcu_program_lms7_dc_iq_calibration_bin[16384];
#endif
| #ifndef LMS7_MCU_PROGRAMS_H
#define LMS7_MCU_PROGRAMS_H
#include "LimeSuiteConfig.h"
#include <stdint.h>
#define MCU_PROGRAM_SIZE 16384
#define MCU_ID_DC_IQ_CALIBRATIONS 0x01
#define MCU_ID_CALIBRATIONS_SINGLE_IMAGE 0x05
#define MCU_FUNCTION_CALIBRATE_TX 1
#define MCU_FUNCTION_CALIBRATE_RX 2
#define MCU_FUNCTION_UPDATE_BW 3
#define MCU_FUNCTION_UPDATE_REF_CLK 4
#define MCU_FUNCTION_TUNE_RX_FILTER 5
#define MCU_FUNCTION_TUNE_TX_FILTER 6
#define MCU_FUNCTION_UPDATE_EXT_LOOPBACK_PAIR 9
#define MCU_FUNCTION_CALIBRATE_TX_EXTLOOPB 17
#define MCU_FUNCTION_CALIBRATE_RX_EXTLOOPB 18
#define MCU_FUNCTION_AGC 10
#define MCU_FUNCTION_GET_PROGRAM_ID 255
LIME_API extern const uint8_t mcu_program_lms7_dc_iq_calibration_bin[16384];
#endif
|
Reorganize public header files (part 2) | /*
* Copyright 2019 The OpenSSL Project Authors. All Rights Reserved.
*
* Licensed under the Apache License 2.0 (the "License"). You may not use
* this file except in compliance with the License. You can obtain a copy
* in the file LICENSE in the source distribution or at
* https://www.openssl.org/source/license.html
*/
/*
* The original <openssl/ossl_typ.h> was renamed to <openssl/types.h>
*
* This header file only exists for compatibility reasons with older
* applications which #include <openssl/ossl_typ.h>.
*/
# include <openssl/types.h>
| |
Use printf instead of "echo -ne". | // Check that clang is able to process response files with extra whitespace.
// We generate a dos-style file with \r\n for line endings, and then split
// some joined arguments (like "-x c") across lines to ensure that regular
// clang (not clang-cl) can process it correctly.
//
// RUN: echo -en "-x\r\nc\r\n-DTEST\r\n" > %t.0.txt
// RUN: %clang -E @%t.0.txt %s -v 2>&1 | FileCheck %s -check-prefix=SHORT
// SHORT: extern int it_works;
#ifdef TEST
extern int it_works;
#endif
| // Check that clang is able to process response files with extra whitespace.
// We generate a dos-style file with \r\n for line endings, and then split
// some joined arguments (like "-x c") across lines to ensure that regular
// clang (not clang-cl) can process it correctly.
//
// RUN: printf " -x\r\nc\r\n-DTEST\r\n" > %t.0.txt
// RUN: %clang -E @%t.0.txt %s -v 2>&1 | FileCheck %s -check-prefix=SHORT
// SHORT: extern int it_works;
#ifdef TEST
extern int it_works;
#endif
|
Test for return value codegen | // RUN: clang %s -emit-llvm -O0 -o - -S | FileCheck %s
#include <enerc.h>
int main () {
return 0;
}
int fp(int p) {
return p * 2;
// CHECK: ret i32 %mul, !quals !0
}
APPROX int fa(int p) {
return p * 2;
// CHECK: ret i32 %mul, !quals !1
}
int fp2(int p) {
if (p > 2) {
return p * 3;
// CHECK: store i32 %mul, i32* %retval, !quals !0
} else {
return p + 3;
// CHECK: store i32 %add, i32* %retval, !quals !0
}
// CHECK: ret i32 %3, !quals !0
}
APPROX int fa2(int p) {
if (p > 2) {
return p * 3;
// CHECK: store i32 %mul, i32* %retval, !quals !1
} else {
return p + 3;
// CHECK: store i32 %add, i32* %retval, !quals !1
}
// CHECK: ret i32 %3, !quals !1
}
// CHECK: !0 = metadata !{i32 0}
// CHECK: !1 = metadata !{i32 1}
| |
Add definitions for AIX 3.2. | #if defined(ULTRIX42)
extern "C" int brk( void * );
extern "C" void *sbrk( int );
typedef void (*SIG_HANDLER)();
#elif defined(ULTRIX43)
extern "C" char *brk( char * );
extern "C" char *sbrk( int );
typedef void (*SIG_HANDLER)();
#elif defined(SUNOS41)
extern "C" int brk( void * );
extern "C" void *sbrk( int );
typedef void (*SIG_HANDLER)();
#elif defined(OSF1)
extern "C" int brk( void * );
# include <sys/types.h>
extern "C" void *sbrk( ssize_t );
typedef void (*SIG_HANDLER)( int );
#elif defined(HPUX9)
extern "C" int brk( const void * );
extern "C" void *sbrk( int );
# include <signal.h>
typedef void (*SIG_HANDLER)( __harg );
#else
# error UNKNOWN PLATFORM
#endif
| #if defined(ULTRIX42)
extern "C" int brk( void * );
extern "C" void *sbrk( int );
typedef void (*SIG_HANDLER)();
#elif defined(ULTRIX43)
extern "C" char *brk( char * );
extern "C" char *sbrk( int );
typedef void (*SIG_HANDLER)();
#elif defined(SUNOS41)
extern "C" int brk( void * );
extern "C" void *sbrk( int );
typedef void (*SIG_HANDLER)();
#elif defined(OSF1)
extern "C" int brk( void * );
# include <sys/types.h>
extern "C" void *sbrk( ssize_t );
typedef void (*SIG_HANDLER)( int );
#elif defined(HPUX9)
extern "C" int brk( const void * );
extern "C" void *sbrk( int );
# include <signal.h>
typedef void (*SIG_HANDLER)( __harg );
#elif defined(AIX32)
extern "C" int brk( void * );
extern "C" void *sbrk( int );
typedef void (*SIG_HANDLER)( int );
#else
# error UNKNOWN PLATFORM
#endif
|
Add custom def for uint32_t | /*
This is part of pyahocorasick Python module.
Windows declarations
Author : Wojciech Muła, wojciech_mula@poczta.onet.pl
WWW : http://0x80.pl
License : BSD-3-Clause (see LICENSE)
*/
#ifndef PYAHCORASICK_WINDOWS_H__
#define PYAHCORASICK_WINDOWS_H__
typedef unsigned char uint8_t;
typedef short unsigned int uint16_t;
#define PY_OBJECT_HEAD_INIT PyVarObject_HEAD_INIT(NULL, 0)
#endif
| /*
This is part of pyahocorasick Python module.
Windows declarations
Author : Wojciech Muła, wojciech_mula@poczta.onet.pl
WWW : http://0x80.pl
License : BSD-3-Clause (see LICENSE)
*/
#ifndef PYAHCORASICK_WINDOWS_H__
#define PYAHCORASICK_WINDOWS_H__
typedef unsigned char uint8_t;
typedef short unsigned int uint16_t;
typedef unsigned int uint32_t;
#define PY_OBJECT_HEAD_INIT PyVarObject_HEAD_INIT(NULL, 0)
#endif
|
Create helper functions for creating random floats | /* The Halfling Project - A Graphics Engine and Projects
*
* The Halfling Project is the legal property of Adrian Astley
* Copyright Adrian Astley 2013
*/
#ifndef MATH_H
#define MATH_H
namespace Common {
template<typename T>
inline T Min(const T& a, const T& b) {
return a < b ? a : b;
}
template<typename T>
inline T Max(const T& a, const T& b) {
return a > b ? a : b;
}
template<typename T>
inline T Lerp(const T& a, const T& b, float t) {
return a + (b - a)*t;
}
template<typename T>
inline T Clamp(const T& x, const T& low, const T& high) {
return x < low ? low : (x > high ? high : x);
}
} // End of namespace Common
#endif // MATHHELPER_H | /* The Halfling Project - A Graphics Engine and Projects
*
* The Halfling Project is the legal property of Adrian Astley
* Copyright Adrian Astley 2013
*/
#ifndef MATH_H
#define MATH_H
#include "common/halfling_sys.h"
namespace Common {
template<typename T>
inline T Min(const T& a, const T& b) {
return a < b ? a : b;
}
template<typename T>
inline T Max(const T& a, const T& b) {
return a > b ? a : b;
}
template<typename T>
inline T Lerp(const T& a, const T& b, float t) {
return a + (b - a)*t;
}
template<typename T>
inline T Clamp(const T& x, const T& low, const T& high) {
return x < low ? low : (x > high ? high : x);
}
// Returns random float in [0, 1).
static float RandF() {
return (float)(rand()) / (float)RAND_MAX;
}
// Returns random float in [a, b).
static float RandF(float a, float b) {
return a + RandF()*(b - a);
}
} // End of namespace Common
#endif // MATHHELPER_H |
Fix multiple defined symbol errors | /*
* Copyright (C) 2007 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef MINZIP_INLINE_MAGIC_H_
#define MINZIP_INLINE_MAGIC_H_
#ifndef MINZIP_GENERATE_INLINES
#define INLINE extern __inline__
#else
#define INLINE
#endif
#endif // MINZIP_INLINE_MAGIC_H_
| /*
* Copyright (C) 2007 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef MINZIP_INLINE_MAGIC_H_
#define MINZIP_INLINE_MAGIC_H_
#ifndef MINZIP_GENERATE_INLINES
#define INLINE extern inline __attribute((__gnu_inline__))
#else
#define INLINE
#endif
#endif // MINZIP_INLINE_MAGIC_H_
|
Make list.h non-modifiabe in ADT |
#ifndef _H_ADTS_LIST
#define _H_ADTS_LIST
#include <string.h>
#include <stdbool.h>
#include <inttypes.h>
/**
**************************************************************************
* \details
*
**************************************************************************
*/
#define ADTS_LIST_BYTES (32)
#define ADTS_LIST_ELEM_BYTES (32)
/**
**************************************************************************
* \details
*
**************************************************************************
*/
typedef struct {
char reserved[ ADTS_LIST_BYTES ];
} adts_list_t;
typedef struct {
char reserved[ ADTS_LIST_ELEM_BYTES ];
} adts_list_elem_t;
void
utest_adts_list( void );
#endif /* _H_ADTS_LIST */
|
#ifndef _H_ADTS_LIST
#define _H_ADTS_LIST
#include <string.h>
#include <stdbool.h>
#include <inttypes.h>
/**
**************************************************************************
* \details
*
**************************************************************************
*/
#define ADTS_LIST_BYTES (32)
#define ADTS_LIST_ELEM_BYTES (32)
/**
**************************************************************************
* \details
*
**************************************************************************
*/
typedef struct {
const char reserved[ ADTS_LIST_BYTES ];
} adts_list_t;
typedef struct {
const char reserved[ ADTS_LIST_ELEM_BYTES ];
} adts_list_elem_t;
void
utest_adts_list( void );
#endif /* _H_ADTS_LIST */
|
Remove the include of machdep.h which didn't need to be there, and didn't work on Solaris. | #if !defined(_URL_CONDOR_H)
#define _URL_CONDOR_H
#include <sys/types.h>
#include <limits.h>
#include "machdep.h"
typedef int (*open_function_type)(const char *, int, size_t);
class URLProtocol {
public:
URLProtocol(char *protocol_key, char *protocol_name,
open_function_type protocol_open_func);
/* int (*protocol_open_func)(const char *, int, size_t)); */
~URLProtocol();
char *get_key() { return key; }
char *get_name() { return name; }
int call_open_func(const char *fname, int flags, size_t n_bytes)
{ return open_func( fname, flags, n_bytes); }
URLProtocol *get_next() { return next; }
void init() { }
private:
char *key;
char *name;
open_function_type open_func;
/* int (*open_func)(const char *, int, size_t); */
URLProtocol *next;
};
URLProtocol *FindProtocolByKey(const char *key);
extern "C" int open_url( const char *name, int flags, size_t n_bytes );
#endif
| #if !defined(_URL_CONDOR_H)
#define _URL_CONDOR_H
#include <sys/types.h>
#include <limits.h>
typedef int (*open_function_type)(const char *, int, size_t);
class URLProtocol {
public:
URLProtocol(char *protocol_key, char *protocol_name,
open_function_type protocol_open_func);
/* int (*protocol_open_func)(const char *, int, size_t)); */
~URLProtocol();
char *get_key() { return key; }
char *get_name() { return name; }
int call_open_func(const char *fname, int flags, size_t n_bytes)
{ return open_func( fname, flags, n_bytes); }
URLProtocol *get_next() { return next; }
void init() { }
private:
char *key;
char *name;
open_function_type open_func;
/* int (*open_func)(const char *, int, size_t); */
URLProtocol *next;
};
URLProtocol *FindProtocolByKey(const char *key);
extern "C" int open_url( const char *name, int flags, size_t n_bytes );
#endif
|
Make runtime locale API available on windows | /*
* Copyright 2014 Matthias Fuchs
*
* 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 STROMX_RUNTIME_LOCALE_H
#define STROMX_RUNTIME_LOCALE_H
#include <locale>
#define L_(id) stromx::runtime::Locale::gettext(id, locale)
namespace stromx
{
namespace runtime
{
extern std::locale locale;
class Locale
{
public:
static std::string gettext(const char* const id, const std::locale & locale);
static std::locale generate(const char* const path, const char* const domain);
};
}
}
#endif // STROMX_RUNTIME_LOCALE_H
| /*
* Copyright 2014 Matthias Fuchs
*
* 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 STROMX_RUNTIME_LOCALE_H
#define STROMX_RUNTIME_LOCALE_H
#include <locale>
#include "stromx/runtime/Config.h"
#define L_(id) stromx::runtime::Locale::gettext(id, locale)
namespace stromx
{
namespace runtime
{
extern std::locale locale;
class STROMX_RUNTIME_API Locale
{
public:
static std::string gettext(const char* const id, const std::locale & locale);
static std::locale generate(const char* const path, const char* const domain);
};
}
}
#endif // STROMX_RUNTIME_LOCALE_H
|
Add initial PDB file format | /**
* Declarations of data structures in PDB files.
*
* These are, for the most part, undocumented. At the time of this writing there
* is no detailed documentation on the PDB file format. Microsoft has open
* sourced the PDB file format:
*
* https://github.com/Microsoft/microsoft-pdb
*
* This is among the worst professional code I've ever seen. It may as well be
* obfuscated. There is no documentation and the code is horribly crufty and
* difficult to read. It is a wonder how anyone at Microsoft is able to maintain
* that obfuscated mess.
*
* Since Microsoft hasn't done it, I'll do my best to document the format here
* as I decrypt it.
*
* Common terminology in the microsoft-pdb repository:
*
* - PN = Page number
* - UPN = Universal page number
* - CB = Count of bytes
* - FPM = Free page map
*/
#pragma once
/**
* The PDB file starts with the MultiStream File (MSF) header. There are two
* types of MSF headers:
*
* 1. The PDB 2.0 format.
* 2. The MSF 7.0 format.
*
* These are distinguished by a magic string, but we only care about the second
* format. Thus, we will ignore the existence of the first because it is a very
* old format.
*/
const size_t kMaxDirPages = 73;
const size_t kMaxPageSize = 0x1000;
const char kMsfHeaderMagic[] = "Microsoft C/C++ MSF 7.00\r\n\x1a\x44\x53\0\0";
struct MsfHeader {
char magic[32]; // version string
uint32_t pageSize; // page size
uint32_t freePageMap; // page index of valid FPM
uint32_t pageCount; // Number of pages
uint32_t directorySize; // Size of the directory in bytes
uint32_t reserved;
uint32_t pages[kMaxDirPages];
};
| |
Add reboot programm for demon | #include <wiringPi.h>
#include <signal.h>
#include <errno.h>
#include <unistd.h>
#include <sys/reboot.h>
#include <stdio.h>
void gpio4Callback(void) {
sync();
reboot(RB_AUTOBOOT);
}
int main(){
sigset_t set;
int sig;
int *sigptr = &sig;
int ret_val;
sigemptyset(&set);
sigaddset(&set, SIGQUIT);
sigaddset(&set, SIGINT);
sigaddset(&set, SIGTERM);
sigprocmask( SIG_BLOCK, &set, NULL );
wiringPiSetup () ;
wiringPiISR (4, INT_EDGE_FALLING, &gpio4Callback) ;
ret_val = sigwait(&set,sigptr);
if(ret_val == -1)
perror("sigwait failed\n");
return 0;
}
| |
Add missing include for size_t | //===--- Stack.h - Utilities for dealing with stack space -------*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
///
/// \file
/// Defines utilities for dealing with stack allocation and stack space.
///
//===----------------------------------------------------------------------===//
#ifndef LLVM_CLANG_BASIC_STACK_H
#define LLVM_CLANG_BASIC_STACK_H
namespace clang {
/// The amount of stack space that Clang would like to be provided with.
/// If less than this much is available, we may be unable to reach our
/// template instantiation depth limit and other similar limits.
constexpr size_t DesiredStackSize = 8 << 20;
} // end namespace clang
#endif // LLVM_CLANG_BASIC_STACK_H
| //===--- Stack.h - Utilities for dealing with stack space -------*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
///
/// \file
/// Defines utilities for dealing with stack allocation and stack space.
///
//===----------------------------------------------------------------------===//
#ifndef LLVM_CLANG_BASIC_STACK_H
#define LLVM_CLANG_BASIC_STACK_H
#include <cstddef>
namespace clang {
/// The amount of stack space that Clang would like to be provided with.
/// If less than this much is available, we may be unable to reach our
/// template instantiation depth limit and other similar limits.
constexpr size_t DesiredStackSize = 8 << 20;
} // end namespace clang
#endif // LLVM_CLANG_BASIC_STACK_H
|
Use <openssl/e_os2.h> rather than <stdint.h> | /*
* Copyright 2016-2021 The OpenSSL Project Authors. All Rights Reserved.
*
* Licensed under the Apache License 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
* https://www.openssl.org/source/license.html
* or in the file LICENSE in the source distribution.
*/
#include <stdint.h> /* for uint8_t */
#include <stddef.h> /* for size_t */
int FuzzerTestOneInput(const uint8_t *buf, size_t len);
int FuzzerInitialize(int *argc, char ***argv);
void FuzzerCleanup(void);
void FuzzerSetRand(void);
void FuzzerClearRand(void);
| /*
* Copyright 2016-2021 The OpenSSL Project Authors. All Rights Reserved.
*
* Licensed under the Apache License 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
* https://www.openssl.org/source/license.html
* or in the file LICENSE in the source distribution.
*/
#include <stddef.h> /* for size_t */
#include <openssl/e_os2.h> /* for uint8_t */
int FuzzerTestOneInput(const uint8_t *buf, size_t len);
int FuzzerInitialize(int *argc, char ***argv);
void FuzzerCleanup(void);
void FuzzerSetRand(void);
void FuzzerClearRand(void);
|
Fix decoding of LINUX_REBOOT_CMD_RESTART2 argument | #include "defs.h"
#include "xlat/bootflags1.h"
#include "xlat/bootflags2.h"
#include "xlat/bootflags3.h"
SYS_FUNC(reboot)
{
printflags(bootflags1, tcp->u_arg[0], "LINUX_REBOOT_MAGIC_???");
tprints(", ");
printflags(bootflags2, tcp->u_arg[1], "LINUX_REBOOT_MAGIC_???");
tprints(", ");
printflags(bootflags3, tcp->u_arg[2], "LINUX_REBOOT_CMD_???");
if (tcp->u_arg[2] == (long) LINUX_REBOOT_CMD_RESTART2) {
tprints(", ");
printstr(tcp, tcp->u_arg[3], -1);
}
return RVAL_DECODED;
}
| #include "defs.h"
#include "xlat/bootflags1.h"
#include "xlat/bootflags2.h"
#include "xlat/bootflags3.h"
SYS_FUNC(reboot)
{
const unsigned int magic1 = tcp->u_arg[0];
const unsigned int magic2 = tcp->u_arg[1];
const unsigned int cmd = tcp->u_arg[2];
printflags(bootflags1, magic1, "LINUX_REBOOT_MAGIC_???");
tprints(", ");
printflags(bootflags2, magic2, "LINUX_REBOOT_MAGIC_???");
tprints(", ");
printflags(bootflags3, cmd, "LINUX_REBOOT_CMD_???");
if (cmd == LINUX_REBOOT_CMD_RESTART2) {
tprints(", ");
printstr(tcp, tcp->u_arg[3], -1);
}
return RVAL_DECODED;
}
|
Add WinMain for windows platform | #include <mruby.h>
#include <mruby/compile.h>
#include <stdio.h>
#include <stdlib.h>
int
main(int argc, char **argv)
{
mrb_state *mrb;
mrbc_context *c;
mrb_value v;
FILE *fp;
fp = fopen("init_minigame.rb", "rb");
if (fp == NULL) {
fputs("Couldn't load 'init_minigame.rb'", stderr);
return EXIT_FAILURE;
}
mrb = mrb_open();
if (mrb == NULL) {
fputs("Invalid mrb_state, exiting mruby", stderr);
return EXIT_FAILURE;
}
c = mrbc_context_new(mrb);
v = mrb_load_file_cxt(mrb, fp, c);
fclose(fp);
mrbc_context_free(mrb, c);
if (mrb->exc && !mrb_undef_p(v)) mrb_print_error(mrb);
return EXIT_SUCCESS;
}
| #include <mruby.h>
#include <mruby/compile.h>
#include <windows.h>
#include <stdlib.h>
#include <stdlib.h>
#ifdef _WIN32
int WINAPI
WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)
#else
int
main(int argc, char **argv)
#endif
{
mrb_state *mrb;
mrbc_context *c;
mrb_value v;
FILE *fp;
fp = fopen("init_minigame.rb", "rb");
if (fp == NULL) {
fputs("Couldn't load 'init_minigame.rb'", stderr);
return EXIT_FAILURE;
}
mrb = mrb_open();
if (mrb == NULL) {
fputs("Invalid mrb_state, exiting mruby", stderr);
return EXIT_FAILURE;
}
c = mrbc_context_new(mrb);
v = mrb_load_file_cxt(mrb, fp, c);
fclose(fp);
mrbc_context_free(mrb, c);
if (mrb->exc && !mrb_undef_p(v)) mrb_print_error(mrb);
return EXIT_SUCCESS;
}
|
Fix this testcase: there are two matches for llvm.cttz.i64 because of the declaration of the intrinsic. Also, emit-llvm is automatic and doesn't need to be specified. | // RUN: %llvmgcc -O2 -S -o - -emit-llvm %s | grep {llvm.cttz.i64} | count 1
// RUN: %llvmgcc -O2 -S -o - -emit-llvm %s | not grep {lshr}
int bork(unsigned long long x) {
return __builtin_ctzll(x);
}
| // RUN: %llvmgcc -O2 -S -o - %s | grep {llvm.cttz.i64} | count 2
// RUN: %llvmgcc -O2 -S -o - %s | not grep {lshr}
int bork(unsigned long long x) {
return __builtin_ctzll(x);
}
|
Mark test as requiring x86-registered-target. | // RUN: %clang_cc1 -triple x86_64-pc-linux-gnu -emit-obj --mrelax-relocations %s -mrelocation-model pic -o %t
// RUN: llvm-readobj -r %t | FileCheck %s
// CHECK: R_X86_64_REX_GOTPCRELX foo
extern int foo;
int *f(void) {
return &foo;
}
| // REQUIRES: x86-registered-target
// RUN: %clang_cc1 -triple x86_64-pc-linux-gnu -emit-obj --mrelax-relocations %s -mrelocation-model pic -o %t
// RUN: llvm-readobj -r %t | FileCheck %s
// CHECK: R_X86_64_REX_GOTPCRELX foo
extern int foo;
int *f(void) {
return &foo;
}
|
Add a ThreadX implementation of malloc | #include <stdint.h>
#include <stdbool.h>
#include <assert.h>
#include <threadx/tx_api.h>
#pragma mark - Definitions -
/*
* In this example, I am using the compiler's builtin atomic compare and swap
* Routine. This will provide atomic access to swapping the malloc pointer,
* and only one function will initialize the memory pool.
*/
#define atomic_compare_and_swap __sync_val_compare_and_swap
#pragma mark - Prototypes -
#pragma mark - Declarations -
// ThreadX internal memory pool stucture
static TX_BYTE_POOL malloc_pool_ = {0};
/*
* Flag that is used in do_malloc() to cause competing threads to wait until
* initialization is completed before allocating memory.
*/
volatile static bool initialized_ = false;
#pragma mark - Private Functions -
/*
* init_malloc must be called before memory allocation calls are made
* This sets up a byte pool for the heap using the defined HEAP_START and HEAP_END macros
* Size is passed to do_malloc and allocated to the caller
*/
void malloc_addblock(void *addr, size_t size)
{
assert(addr && (size > 0));
uint8_t r;
/**
* This is ThreadX's API to create a byte pool using a memory block.
* We are essentially just wrapping ThreadX APIs into a simpler form
*/
r = tx_byte_pool_create(&malloc_pool_, "Heap Memory Pool",
addr,
size);
assert(r == TX_SUCCESS);
//Signal to any threads waiting on do_malloc that we are done
initialized_ = true;
}
void * malloc(size_t size)
{
void * ptr = NULL;
/**
* Since multiple threads could be racing to malloc, if we lost the race
* we need to make sure the ThreadX pool has been created before we
* try to allocate memory, or there will be an error
*/
while(!initialized_)
{
tx_thread_sleep(1);
}
if(size > 0)
{
// We simply wrap the threadX call into a standard form
uint8_t r = tx_byte_allocate(&malloc_pool_, &ptr, size, TX_WAIT_FOREVER);
//I add the string to provide a more helpful error output. It's value is always true.
assert(r == TX_SUCCESS && "malloc failed");
} //else NULL if there was an error
return ptr;
}
void free(void * ptr)
{
//free should NEVER be called before malloc is init'd
assert(initialized_);
if(ptr) {
//We simply wrap the threadX call into a standard form
uint8_t r = tx_byte_release(ptr);
ptr = NULL;
assert(r == TX_SUCCESS);
}
}
| |
Add header to provide C99 compatibility | /*!
* @file c99.h
* @brief Provide C99 compatibility
* @author koturn
*/
#ifndef KOTLIB_COMPAT_C99_H
#define KOTLIB_COMPAT_C99_H
#include "defsupport.h"
#if defined(_MSC_VER) || KOTLIB_COMPAT_IS_SUPPORT_C99
# define __func__ __FUNCTION__
#endif
#ifndef __cplusplus
# if defined(_MSC_VER)
# define inline __inline
# define __inline__ __inline
# elif !defined(__GNUC__) && KOTLIB_COMPAT_IS_SUPPORT_C99
# define inline
# define __inline
# endif
#endif
#if defined(_MSC_VER) && _MSC_VER >= 1400
# define restrict __restrict
# define __restrict__ __restrict
#elif !KOTLIB_COMPAT_IS_SUPPORT_C99
# if defined(__GNUC__)
# define restrict __restrict
# else
# define restrict
# define __restrict
# define __restrict__
# endif
#endif
#endif // KOTLIB_COMPAT_C99_H
| |
Add terms for more general mapping (other than just vertical for fizhi) | c Alternate grid Mapping Common
c ------------------------------
common /gridalt_mapping/ nlperdyn,dpphys0,dpphys
integer nlperdyn(1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nr,nSx,Nsy)
_RL dpphys0(1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nrphys,nSx,nSy)
_RL dpphys(1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nrphys,nSx,nSy)
| c Alternate grid Mapping Common
c ------------------------------
common /gridalt_mapping/ nlperdyn,dpphys0,dpphys,
. dxfalt,dyfalt,drfalt
integer nlperdyn(1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nr,nSx,Nsy)
_RL dpphys0(1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nrphys,nSx,nSy)
_RL dpphys(1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nrphys,nSx,nSy)
_RL dxfalt,dyfalt,drfalt
|
Make squere.c to work with nXn | #include <stdio.h>
int isMagic(int squere[3][3])
{
int currSum = 0;
int sum = squere[0][0]+squere[0][1]+squere[0][2];
int i = 0;
for(i=1;i<3;i++)
{
int j;
for(j=0;j<3;j++)
{
currSum+=squere[i][j];
}
if(currSum != sum)
{
return 0;
}
currSum = 0;
}
currSum = 0;
for(i=0;i<3;i++)
{
currSum += squere[i][i];
}
if(currSum!=sum)
{
return 0;
}
currSum = 0;
int j;
for(i=0,j=2;i<3;i++,j--)
{
currSum += squere[i][j];
}
if(currSum!=sum)
{
return 0;
}
return 1;
}
int main()
{
int squere[3][3];
int i = 0;
for(i=0;i<3;i++)
{
int j = 0;
for(j=0;j<3;j++)
{
scanf("%d",&squere[i][j]);
}
}
if(isMagic(squere))
{
printf("Magicheki e\n");
}
else
{
printf("ne e magicheski\n");
}
}
| #include <stdio.h>
int isMagic(int n,int squere[n][n])
{
int currSum = 0;
int sum = 0;
int i = 0;
for(i=0;i<n;i++)
{
int j;
for(j=0;j<n;j++)
{
currSum+=squere[i][j];
}
if(i==0)
{
sum = currSum;
}
if(currSum != sum)
{
return 0;
}
currSum = 0;
}
currSum = 0;
for(i=0;i<n;i++)
{
currSum += squere[i][i];
}
if(currSum!=sum)
{
return 0;
}
currSum = 0;
int j;
for(i=0,j=n-1;i<n;i++,j--)
{
currSum += squere[i][j];
}
if(currSum!=sum)
{
return 0;
}
return 1;
}
int main()
{
int n;
scanf("%d",&n);
int squere[n][n];
int i = 0;
for(i=0;i<n;i++)
{
int j = 0;
for(j=0;j<n;j++)
{
scanf("%d",&squere[i][j]);
}
}
if(isMagic(n,squere))
{
printf("Magicheki e\n");
}
else
{
printf("ne e magicheski\n");
}
}
|
Add array size check to sizeof() test | // RUN: %ocheck 0 %s
typedef struct
{
int x;
} A;
main()
{
int sz = sizeof((A *)0)->x;
if(sz != sizeof(int))
abort();
return 0;
}
| // RUN: %ocheck 0 %s
typedef struct
{
int x;
} A;
main()
{
int sz = sizeof((A *)0)->x;
if(sz != sizeof(int))
abort();
int ar[10];
sz = sizeof(ar)[0];
if(sz != sizeof(int))
abort();
return 0;
}
|
Add a zoom level + comments | #ifndef SCREEN_MAP_H
#define SCREEN_MAP_H
// in meters/pixels
#define MAP_SCALE_MIN 250
#define MAP_SCALE_MAX 64000
#define MAP_SCALE_INI (MAP_SCALE_MIN*8)
#define MAP_VSIZE_X 4000
#define MAP_VSIZE_Y 4000
#define XINI MAP_VSIZE_X/2
#define YINI MAP_VSIZE_Y/2
// external variables (debug purpose)
extern int map_scale;
extern int nb_points;
void screen_map_zoom_in(int factor);
void screen_map_zoom_out(int factor);
void screen_map_update_location();
void screen_map_layer_init(Window* window);
void screen_map_layer_deinit();
void screen_map_update_map(bool force_recenter);
#endif // SCREEN_MAP_H
| #ifndef SCREEN_MAP_H
#define SCREEN_MAP_H
// at level 7 (MAP_SCALE=16000), the screen width is approximatively 14.5km => 100m/px)
// level 1: MAP_SCALE=250 => 1.5m/px - screen 225m
// level 8: MAP_SCALE_MAX 32000 => 200m/px - screen: 29km
#define MAP_SCALE_MIN 250
#define MAP_SCALE_MAX 32000
//2000=MAP_SCALE_MIN * 8 => level 4 (250-500-1000-2000)
#define MAP_SCALE_INI 2000
#define MAP_VSIZE_X 4000
#define MAP_VSIZE_Y 4000
#define XINI MAP_VSIZE_X/2
#define YINI MAP_VSIZE_Y/2
// external variables (debug purpose)
extern int map_scale;
extern int nb_points;
void screen_map_zoom_in(int factor);
void screen_map_zoom_out(int factor);
void screen_map_update_location();
void screen_map_layer_init(Window* window);
void screen_map_layer_deinit();
void screen_map_update_map(bool force_recenter);
#endif // SCREEN_MAP_H
|
Add the necessary includes and forward declarations such that the class can be compiled independently. | // @(#)root/meta:$Name: $:$Id: TVirtualIsAProxy.h,v 1.1 2005/05/27 16:42:58 pcanal Exp $
// Author: Markus Frank 20/05/2005
/*************************************************************************
* Copyright (C) 1995-2000, 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_TVirtualIsAProxy
#define ROOT_TVirtualIsAProxy
//////////////////////////////////////////////////////////////////////////
// //
// TClass //
// //
// Virtual IsAProxy base class. //
// //
//////////////////////////////////////////////////////////////////////////
class TVirtualIsAProxy {
public:
virtual ~TVirtualIsAProxy() { }
virtual void SetClass(TClass *cl) = 0;
virtual TClass* operator()(const void *obj) = 0;
};
#endif // ROOT_TVirtualIsAProxy
| // @(#)root/meta:$Name: $:$Id: TVirtualIsAProxy.h,v 1.2 2005/06/08 18:51:36 rdm Exp $
// Author: Markus Frank 20/05/2005
/*************************************************************************
* Copyright (C) 1995-2000, 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_TVirtualIsAProxy
#define ROOT_TVirtualIsAProxy
//////////////////////////////////////////////////////////////////////////
// //
// TClass //
// //
// Virtual IsAProxy base class. //
// //
//////////////////////////////////////////////////////////////////////////
class TClass;
class TVirtualIsAProxy {
public:
virtual ~TVirtualIsAProxy() { }
virtual void SetClass(TClass *cl) = 0;
virtual TClass* operator()(const void *obj) = 0;
};
#endif // ROOT_TVirtualIsAProxy
|
Add newline to end of file. | // Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef VIEWS_CONTROLS_MENU_NATIVE_MENU_HOST_DELEGATE_H_
#define VIEWS_CONTROLS_MENU_NATIVE_MENU_HOST_DELEGATE_H_
namespace views {
namespace internal {
class NativeMenuHostDelegate {
public:
virtual ~NativeMenuHostDelegate() {}
};
} // namespace internal
} // namespace views
#endif // VIEWS_CONTROLS_MENU_NATIVE_MENU_HOST_DELEGATE_H_ | // Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef VIEWS_CONTROLS_MENU_NATIVE_MENU_HOST_DELEGATE_H_
#define VIEWS_CONTROLS_MENU_NATIVE_MENU_HOST_DELEGATE_H_
namespace views {
namespace internal {
class NativeMenuHostDelegate {
public:
virtual ~NativeMenuHostDelegate() {}
};
} // namespace internal
} // namespace views
#endif // VIEWS_CONTROLS_MENU_NATIVE_MENU_HOST_DELEGATE_H_
|
Make AutoSeeded_RNG::reseed's parameter default to 256 for compatability with the version in earlier releases. Rickard Bondesson pointed out that this was a problem on the mailing list. | /*
* Auto Seeded RNG
* (C) 2008 Jack Lloyd
*
* Distributed under the terms of the Botan license
*/
#ifndef BOTAN_AUTO_SEEDING_RNG_H__
#define BOTAN_AUTO_SEEDING_RNG_H__
#include <botan/rng.h>
#include <string>
namespace Botan {
/**
* RNG that attempts to seed itself
*/
class BOTAN_DLL AutoSeeded_RNG : public RandomNumberGenerator
{
public:
void randomize(byte out[], u32bit len)
{ rng->randomize(out, len); }
bool is_seeded() const
{ return rng->is_seeded(); }
void clear() throw() { rng->clear(); }
std::string name() const
{ return "AutoSeeded(" + rng->name() + ")"; }
void reseed(u32bit poll_bits) { rng->reseed(poll_bits); }
void add_entropy_source(EntropySource* es)
{ rng->add_entropy_source(es); }
void add_entropy(const byte in[], u32bit len)
{ rng->add_entropy(in, len); }
AutoSeeded_RNG(u32bit poll_bits = 256);
~AutoSeeded_RNG() { delete rng; }
private:
RandomNumberGenerator* rng;
};
}
#endif
| /*
* Auto Seeded RNG
* (C) 2008 Jack Lloyd
*
* Distributed under the terms of the Botan license
*/
#ifndef BOTAN_AUTO_SEEDING_RNG_H__
#define BOTAN_AUTO_SEEDING_RNG_H__
#include <botan/rng.h>
#include <string>
namespace Botan {
/**
* RNG that attempts to seed itself
*/
class BOTAN_DLL AutoSeeded_RNG : public RandomNumberGenerator
{
public:
void randomize(byte out[], u32bit len)
{ rng->randomize(out, len); }
bool is_seeded() const
{ return rng->is_seeded(); }
void clear() throw() { rng->clear(); }
std::string name() const
{ return "AutoSeeded(" + rng->name() + ")"; }
void reseed(u32bit poll_bits = 256) { rng->reseed(poll_bits); }
void add_entropy_source(EntropySource* es)
{ rng->add_entropy_source(es); }
void add_entropy(const byte in[], u32bit len)
{ rng->add_entropy(in, len); }
AutoSeeded_RNG(u32bit poll_bits = 256);
~AutoSeeded_RNG() { delete rng; }
private:
RandomNumberGenerator* rng;
};
}
#endif
|
Fix wildcard matching on CHECK lines. Now recognises arch64--. | // Check target CPUs are correctly passed.
// RUN: %clang -target aarch64 -### -c %s 2>&1 | FileCheck -check-prefix=GENERIC %s
// GENERIC: "-cc1"{{.*}} "-triple" "aarch64" {{.*}} "-target-cpu" "generic"
// RUN: %clang -target aarch64 -mcpu=cortex-a53 -### -c %s 2>&1 | FileCheck -check-prefix=CA53 %s
// CA53: "-cc1"{{.*}} "-triple" "aarch64" {{.*}} "-target-cpu" "cortex-a53"
// RUN: %clang -target aarch64 -mcpu=cortex-a57 -### -c %s 2>&1 | FileCheck -check-prefix=CA57 %s
// CA57: "-cc1"{{.*}} "-triple" "aarch64" {{.*}} "-target-cpu" "cortex-a57"
| // Check target CPUs are correctly passed.
// RUN: %clang -target aarch64 -### -c %s 2>&1 | FileCheck -check-prefix=GENERIC %s
// GENERIC: "-cc1"{{.*}} "-triple" "aarch64{{.*}}" "-target-cpu" "generic"
// RUN: %clang -target aarch64 -mcpu=cortex-a53 -### -c %s 2>&1 | FileCheck -check-prefix=CA53 %s
// CA53: "-cc1"{{.*}} "-triple" "aarch64{{.*}}" "-target-cpu" "cortex-a53"
// RUN: %clang -target aarch64 -mcpu=cortex-a57 -### -c %s 2>&1 | FileCheck -check-prefix=CA57 %s
// CA57: "-cc1"{{.*}} "-triple" "aarch64{{.*}}" "-target-cpu" "cortex-a57"
|
Change to double. Missed from previous commit. | #include <string.h>
#include "proxrcmds.h"
#include "sim-hab.h"
void cb_set_resource(bionet_resource_t *resource, bionet_value_t *value)
{
double data;
double content;
int id;
bionet_node_t *node;
bionet_value_get_float(value, &data);
if(data < 0 || data > 255)
return;
node = bionet_resource_get_node(resource);
// get index of resource
//FIXME: probably a better way to do this
for(int i=0; i<16; i++)
{
char buf[5];
char name[24];
strcpy(name, "Potentiometer\0");
sprintf(buf,"%d", i);
int len = strlen(buf);
buf[len] = '\0';
strcat(name, buf);
if(bionet_resource_matches_id(resource, name))
{
id = i;
// command proxr to adjust to new value
set_potentiometer(id, (int)data);
// set resources datapoint to new value
content = data*POT_CONVERSION;
bionet_resource_set_float(resource, content, NULL);
hab_report_datapoints(node);
return;
}
}
}
| #include <string.h>
#include "proxrcmds.h"
#include "sim-hab.h"
void cb_set_resource(bionet_resource_t *resource, bionet_value_t *value)
{
double data;
double content;
int id;
bionet_node_t *node;
bionet_value_get_float(value, &data);
if(data < 0 || data > 255)
return;
node = bionet_resource_get_node(resource);
// get index of resource
//FIXME: probably a better way to do this
for(int i=0; i<16; i++)
{
char buf[5];
char name[24];
strcpy(name, "Potentiometer\0");
sprintf(buf,"%d", i);
int len = strlen(buf);
buf[len] = '\0';
strcat(name, buf);
if(bionet_resource_matches_id(resource, name))
{
id = i;
// command proxr to adjust to new value
set_potentiometer(id, (int)data);
// set resources datapoint to new value
content = data*POT_CONVERSION;
bionet_resource_set_double(resource, content, NULL);
hab_report_datapoints(node);
return;
}
}
}
|
Include the generic startup header, since that declares iosglk_startup_code(). |
#include "glk.h"
extern void iosglk_set_can_restart_flag(int);
extern int iosglk_can_restart_cleanly(void);
extern void iosglk_shut_down_process(void) GLK_ATTRIBUTE_NORETURN;
|
#include "glk.h"
#include "iosglk_startup.h"
extern void iosglk_set_can_restart_flag(int);
extern int iosglk_can_restart_cleanly(void);
extern void iosglk_shut_down_process(void) GLK_ATTRIBUTE_NORETURN;
|
Fix unused incorrect 'VTypePattern<T*>::val_t' definition | #ifndef Vca_VTypePattern_Interface
#define Vca_VTypePattern_Interface
/*********************
***** Library *****
*********************/
#include "Vca.h"
/**************************
***** Declarations *****
**************************/
class VString;
/*************************
***** Definitions *****
*************************/
namespace Vca {
/*******************************************************
*---- template <typename T> struct VTypePattern ----*
*******************************************************/
template <typename T> struct VTypePattern {
typedef T val_t;
typedef T var_t;
};
/*****************************************************************
*---- template <typename T> struct VTypePattern<T const&> ----*
*****************************************************************/
template <typename T> struct VTypePattern<T const&> {
typedef T const& val_t;
typedef T var_t;
};
/***********************************************************
*---- template <typename T> struct VTypePattern<T*> ----*
***********************************************************/
template <typename T> struct VTypePattern<T*> {
typedef T val_t;
typedef typename T::Reference var_t;
};
/**********************************************************
*---- template <> struct VTypePattern<char const*> ----*
**********************************************************/
template <> struct VTypePattern<char const*> {
typedef char const* val_t;
typedef VString var_t;
};
}
#endif
| #ifndef Vca_VTypePattern_Interface
#define Vca_VTypePattern_Interface
/*********************
***** Library *****
*********************/
#include "Vca.h"
/**************************
***** Declarations *****
**************************/
class VString;
/*************************
***** Definitions *****
*************************/
namespace Vca {
/*******************************************************
*---- template <typename T> struct VTypePattern ----*
*******************************************************/
template <typename T> struct VTypePattern {
typedef T val_t;
typedef T var_t;
};
/*****************************************************************
*---- template <typename T> struct VTypePattern<T const&> ----*
*****************************************************************/
template <typename T> struct VTypePattern<T const&> {
typedef T const& val_t;
typedef T var_t;
};
/***********************************************************
*---- template <typename T> struct VTypePattern<T*> ----*
***********************************************************/
template <typename T> struct VTypePattern<T*> {
typedef T* val_t;
typedef typename T::Reference var_t;
};
/**********************************************************
*---- template <> struct VTypePattern<char const*> ----*
**********************************************************/
template <> struct VTypePattern<char const*> {
typedef char const* val_t;
typedef VString var_t;
};
}
#endif
|
Add crash case: "Invalid read of size 4" in printOperand(…) | #include <capstone.h>
#define BINARY "\x3b\x30\x62\x93\x5d\x61\x03\xe8"
int main(int argc, char **argv, char **envp) {
csh handle;
if (cs_open(CS_ARCH_X86, CS_MODE_64, &handle)) {
printf("cs_open(…) failed\n");
return 1;
}
cs_insn *insn;
cs_disasm(handle, (uint8_t *)BINARY, sizeof(BINARY) - 1, 0x1000, 0, &insn);
return 0;
}
| |
Add var_eq test with invalid widen | // SKIP PARAM: --set ana.activated[+] var_eq
// manually minimized from sv-benchmarks/c/ldv-linux-3.16-rc1/205_9a_array_unsafes_linux-3.16-rc1.tar.xz-205_9a-drivers--net--usb--cx82310_eth.ko-entry_point.cil.out.i
// used to call widen incorrectly
typedef _Bool bool;
void usb_bulk_msg(int *arg4, int x) {
}
void cx82310_cmd(bool reply ,unsigned char *wdata , int wlen)
{
int actual_len ;
int retries ;
int __min1 ;
__min1 = wlen;
retries = 0;
while (retries <= 4) {
usb_bulk_msg(&actual_len, 1U);
if (actual_len > 0)
return;
retries = retries + 1;
}
}
int main(void)
{
cx82310_cmd(1, "a", 1);
return 0;
}
| |
Support "--version" in the CLI to print the version. | #include <stdio.h>
#include <string.h>
#include "os.h"
#include "vm.h"
#include "wren.h"
int main(int argc, const char* argv[])
{
if (argc == 2 && strcmp(argv[1], "--help") == 0)
{
printf("Usage: wren [file] [arguments...]\n");
printf(" --help Show command line usage\n");
return 0;
}
osSetArguments(argc, argv);
if (argc == 1)
{
runRepl();
}
else
{
runFile(argv[1]);
}
return 0;
}
| #include <stdio.h>
#include <string.h>
#include "os.h"
#include "vm.h"
#include "wren.h"
int main(int argc, const char* argv[])
{
if (argc == 2 && strcmp(argv[1], "--help") == 0)
{
printf("Usage: wren [file] [arguments...]\n");
printf(" --help Show command line usage\n");
return 0;
}
if (argc == 2 && strcmp(argv[1], "--version") == 0)
{
printf("wren %s\n", WREN_VERSION_STRING);
return 0;
}
osSetArguments(argc, argv);
if (argc == 1)
{
runRepl();
}
else
{
runFile(argv[1]);
}
return 0;
}
|
Add another complex promotion test. | // RUN: clang %s -verify -fsyntax-only
float a;
int b[__builtin_classify_type(a + 1i) == 9 ? 1 : -1];
int c[__builtin_classify_type(1i + a) == 9 ? 1 : -1];
double d;
__typeof__ (d + 1i) e;
int f[sizeof(e) == 2 * sizeof(double) ? 1 : -1];
| // RUN: clang %s -verify -fsyntax-only
float a;
int b[__builtin_classify_type(a + 1i) == 9 ? 1 : -1];
int c[__builtin_classify_type(1i + a) == 9 ? 1 : -1];
double d;
__typeof__ (d + 1i) e;
int f[sizeof(e) == 2 * sizeof(double) ? 1 : -1];
int g;
int h[__builtin_classify_type(g + 1.0i) == 9 ? 1 : -1];
int i[__builtin_classify_type(1.0i + a) == 9 ? 1 : -1];
|
Add test for multiple thread init/shutdown | #include "clar_libgit2.h"
#include "cache.h"
static git_repository *g_repo;
void test_threads_basic__initialize(void)
{
g_repo = cl_git_sandbox_init("testrepo");
}
void test_threads_basic__cleanup(void)
{
cl_git_sandbox_cleanup();
}
void test_threads_basic__cache(void)
{
// run several threads polling the cache at the same time
cl_assert(1 == 1);
}
| #include "clar_libgit2.h"
#include "cache.h"
static git_repository *g_repo;
void test_threads_basic__initialize(void)
{
g_repo = cl_git_sandbox_init("testrepo");
}
void test_threads_basic__cleanup(void)
{
cl_git_sandbox_cleanup();
}
void test_threads_basic__cache(void)
{
// run several threads polling the cache at the same time
cl_assert(1 == 1);
}
void test_threads_basic__multiple_init(void)
{
git_repository *nested_repo;
git_threads_init();
cl_git_pass(git_repository_open(&nested_repo, cl_fixture("testrepo.git")));
git_repository_free(nested_repo);
git_threads_shutdown();
cl_git_pass(git_repository_open(&nested_repo, cl_fixture("testrepo.git")));
git_repository_free(nested_repo);
}
|
Fix non-ISA link error in drivers/scsi/advansys.c | /*
* ISA bus.
*/
#ifndef __LINUX_ISA_H
#define __LINUX_ISA_H
#include <linux/device.h>
#include <linux/kernel.h>
struct isa_driver {
int (*match)(struct device *, unsigned int);
int (*probe)(struct device *, unsigned int);
int (*remove)(struct device *, unsigned int);
void (*shutdown)(struct device *, unsigned int);
int (*suspend)(struct device *, unsigned int, pm_message_t);
int (*resume)(struct device *, unsigned int);
struct device_driver driver;
struct device *devices;
};
#define to_isa_driver(x) container_of((x), struct isa_driver, driver)
int isa_register_driver(struct isa_driver *, unsigned int);
void isa_unregister_driver(struct isa_driver *);
#endif /* __LINUX_ISA_H */
| /*
* ISA bus.
*/
#ifndef __LINUX_ISA_H
#define __LINUX_ISA_H
#include <linux/device.h>
#include <linux/kernel.h>
struct isa_driver {
int (*match)(struct device *, unsigned int);
int (*probe)(struct device *, unsigned int);
int (*remove)(struct device *, unsigned int);
void (*shutdown)(struct device *, unsigned int);
int (*suspend)(struct device *, unsigned int, pm_message_t);
int (*resume)(struct device *, unsigned int);
struct device_driver driver;
struct device *devices;
};
#define to_isa_driver(x) container_of((x), struct isa_driver, driver)
#ifdef CONFIG_ISA
int isa_register_driver(struct isa_driver *, unsigned int);
void isa_unregister_driver(struct isa_driver *);
#else
static inline int isa_register_driver(struct isa_driver *d, unsigned int i)
{
return 0;
}
static inline void isa_unregister_driver(struct isa_driver *d)
{
}
#endif
#endif /* __LINUX_ISA_H */
|
Add a missing prototype to fix a warning. | /*-
* Copyright (c) 2001 Jake Burkholder.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR 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 AUTHOR 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.
*
* $FreeBSD$
*/
#ifndef _MACHINE_CLOCK_H_
#define _MACHINE_CLOCK_H_
extern u_long tick_increment;
extern u_long tick_freq;
extern u_long tick_MHz;
#endif /* !_MACHINE_CLOCK_H_ */
| /*-
* Copyright (c) 2001 Jake Burkholder.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR 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 AUTHOR 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.
*
* $FreeBSD$
*/
#ifndef _MACHINE_CLOCK_H_
#define _MACHINE_CLOCK_H_
extern u_long tick_increment;
extern u_long tick_freq;
extern u_long tick_MHz;
int sysbeep(int, int);
#endif /* !_MACHINE_CLOCK_H_ */
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.