Instruction stringlengths 14 778 | input_code stringlengths 0 4.24k | output_code stringlengths 1 5.44k |
|---|---|---|
Make sure to include string for the definiton of Log. | //
// Copyright (c) 2010-2012 Linaro Limited
//
// All rights reserved. This program and the accompanying materials
// are made available under the terms of the MIT License which accompanies
// this distribution, and is available at
// http://www.opensource.org/licenses/mit-license.php
//
// Contributors:
// Alexandros Frantzis <alexandros.frantzis@linaro.org>
// Jesse Barker <jesse.barker@linaro.org>
//
#ifndef LOG_H_
#define LOG_H_
class Log
{
public:
static void init(bool do_debug = false) { do_debug_ = do_debug; }
// Emit an informational message
static void info(const char *fmt, ...);
// Emit a debugging message
static void debug(const char *fmt, ...);
// Emit an error message
static void error(const char *fmt, ...);
// Explicit flush of the log buffer
static void flush();
// A prefix constant that informs the logging infrastructure that the log
// message is a continuation of a previous log message to be put on the
// same line.
static const std::string continuation_prefix;
// A constant for identifying the log messages as originating from a
// particular application.
static std::string appname;
private:
static bool do_debug_;
};
#endif /* LOG_H_ */
| //
// Copyright (c) 2010-2012 Linaro Limited
//
// All rights reserved. This program and the accompanying materials
// are made available under the terms of the MIT License which accompanies
// this distribution, and is available at
// http://www.opensource.org/licenses/mit-license.php
//
// Contributors:
// Alexandros Frantzis <alexandros.frantzis@linaro.org>
// Jesse Barker <jesse.barker@linaro.org>
//
#ifndef LOG_H_
#define LOG_H_
#include <string>
class Log
{
public:
static void init(bool do_debug = false) { do_debug_ = do_debug; }
// Emit an informational message
static void info(const char *fmt, ...);
// Emit a debugging message
static void debug(const char *fmt, ...);
// Emit an error message
static void error(const char *fmt, ...);
// Explicit flush of the log buffer
static void flush();
// A prefix constant that informs the logging infrastructure that the log
// message is a continuation of a previous log message to be put on the
// same line.
static const std::string continuation_prefix;
// A constant for identifying the log messages as originating from a
// particular application.
static std::string appname;
private:
static bool do_debug_;
};
#endif /* LOG_H_ */
|
Add missing newline (which breaks MSVC build???) | //===- ExternalPreprocessorSource.h - Abstract Macro Interface --*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
//
// This file defines the ExternalPreprocessorSource interface, which enables
// construction of macro definitions from some external source.
//
//===----------------------------------------------------------------------===//
#ifndef LLVM_CLANG_LEX_EXTERNAL_PREPROCESSOR_SOURCE_H
#define LLVM_CLANG_LEX_EXTERNAL_PREPROCESSOR_SOURCE_H
namespace clang {
/// \brief Abstract interface for external sources of preprocessor
/// information.
///
/// This abstract class allows an external sources (such as the \c PCHReader)
/// to provide additional macro definitions.
class ExternalPreprocessorSource {
public:
virtual ~ExternalPreprocessorSource();
/// \brief Read the set of macros defined by this external macro source.
virtual void ReadDefinedMacros() = 0;
};
}
#endif // LLVM_CLANG_LEX_EXTERNAL_PREPROCESSOR_SOURCE_H | //===- ExternalPreprocessorSource.h - Abstract Macro Interface --*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
//
// This file defines the ExternalPreprocessorSource interface, which enables
// construction of macro definitions from some external source.
//
//===----------------------------------------------------------------------===//
#ifndef LLVM_CLANG_LEX_EXTERNAL_PREPROCESSOR_SOURCE_H
#define LLVM_CLANG_LEX_EXTERNAL_PREPROCESSOR_SOURCE_H
namespace clang {
/// \brief Abstract interface for external sources of preprocessor
/// information.
///
/// This abstract class allows an external sources (such as the \c PCHReader)
/// to provide additional macro definitions.
class ExternalPreprocessorSource {
public:
virtual ~ExternalPreprocessorSource();
/// \brief Read the set of macros defined by this external macro source.
virtual void ReadDefinedMacros() = 0;
};
}
#endif // LLVM_CLANG_LEX_EXTERNAL_PREPROCESSOR_SOURCE_H
|
Add APEmailWithLabel.h to the Swift bridging file. | //
// APAddressBook-Bridging.h
// APAddressBook
//
// Created by Alexey Belkevich on 7/31/14.
// Copyright (c) 2014 alterplay. All rights reserved.
//
#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>
#import "APAddressBook.h"
#import "APContact.h"
#import "APSocialProfile.h"
#import "APAddress.h"
#import "APPhoneWithLabel.h"
| //
// APAddressBook-Bridging.h
// APAddressBook
//
// Created by Alexey Belkevich on 7/31/14.
// Copyright (c) 2014 alterplay. All rights reserved.
//
#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>
#import "APAddressBook.h"
#import "APContact.h"
#import "APSocialProfile.h"
#import "APAddress.h"
#import "APPhoneWithLabel.h"
#import "APEmailWithLabel.h"
|
Disable peripheral mode in N5 | /*
* Copyright 2013 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 _BDROID_BUILDCFG_H
#define _BDROID_BUILDCFG_H
#define BTA_DISABLE_DELAY 100 /* in milliseconds */
#define BLE_VND_INCLUDED TRUE
#define BTM_BLE_ADV_TX_POWER {-21, -15, -7, 1, 9}
#endif
| /*
* Copyright 2013 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 _BDROID_BUILDCFG_H
#define _BDROID_BUILDCFG_H
#define BTA_DISABLE_DELAY 100 /* in milliseconds */
#define BTM_BLE_ADV_TX_POWER {-21, -15, -7, 1, 9}
#endif
|
Use C++11 non-static member initialization. | //===- lld/ReaderWriter/YamlContext.h - object used in YAML I/O context ---===//
//
// The LLVM Linker
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
#ifndef LLD_READER_WRITER_YAML_CONTEXT_H
#define LLD_READER_WRITER_YAML_CONTEXT_H
#include "lld/Core/LLVM.h"
#include <functional>
#include <memory>
#include <vector>
namespace lld {
class File;
class LinkingContext;
namespace mach_o {
namespace normalized {
struct NormalizedFile;
}
}
using lld::mach_o::normalized::NormalizedFile;
/// When YAML I/O is used in lld, the yaml context always holds a YamlContext
/// object. We need to support hetergenous yaml documents which each require
/// different context info. This struct supports all clients.
struct YamlContext {
YamlContext()
: _ctx(nullptr), _registry(nullptr), _file(nullptr),
_normalizeMachOFile(nullptr) {}
const LinkingContext *_ctx;
const Registry *_registry;
File *_file;
NormalizedFile *_normalizeMachOFile;
StringRef _path;
};
} // end namespace lld
#endif // LLD_READER_WRITER_YAML_CONTEXT_H
| //===- lld/ReaderWriter/YamlContext.h - object used in YAML I/O context ---===//
//
// The LLVM Linker
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
#ifndef LLD_READER_WRITER_YAML_CONTEXT_H
#define LLD_READER_WRITER_YAML_CONTEXT_H
#include "lld/Core/LLVM.h"
#include <functional>
#include <memory>
#include <vector>
namespace lld {
class File;
class LinkingContext;
namespace mach_o {
namespace normalized {
struct NormalizedFile;
}
}
using lld::mach_o::normalized::NormalizedFile;
/// When YAML I/O is used in lld, the yaml context always holds a YamlContext
/// object. We need to support hetergenous yaml documents which each require
/// different context info. This struct supports all clients.
struct YamlContext {
const LinkingContext *_ctx = nullptr;
const Registry *_registry = nullptr;
File *_file = nullptr;
NormalizedFile *_normalizeMachOFile = nullptr;
StringRef _path;
};
} // end namespace lld
#endif // LLD_READER_WRITER_YAML_CONTEXT_H
|
Correct define for this file. Fix function declarations. | /*
* vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
*/
#ifdef E_TYPEDEFS
#else
#ifndef E_WIDGET_BUTTON_H
#define E_WIDGET_BUTTON_H
EAPI Evas_Object *e_widget_iconsel_add(Evas *evas, Evas_Object *icon, Evas_Coord minw, Evas_Coord minh, void (*func) (void *data, void *data2), void *data, void *data2);
EAPI Evas_Object *e_widget_iconsel_add_from_file(Evas *evas, char *icon, Evas_Coord minw, Evas_Coord minh, void (*func) (void *data, void *data2), void *data, void *data2);
EAPI void e_widget_iconsel_select_callback_add(Evas_Object *obj, void (*func)(Evas_Object *obj, char *file, void *data), void *data);
#endif
#endif
| /*
* vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
*/
#ifdef E_TYPEDEFS
#else
#ifndef E_WIDGET_ICONSEL_H
#define E_WIDGET_ICONSEL_H
EAPI Evas_Object *e_widget_iconsel_add(Evas *evas, Evas_Object *icon, Evas_Coord minw, Evas_Coord minh, char **file);
EAPI Evas_Object *e_widget_iconsel_add_from_file(Evas *evas, char *icon, Evas_Coord minw, Evas_Coord minh, char **file);
EAPI void e_widget_iconsel_select_callback_add(Evas_Object *obj, void (*func)(Evas_Object *obj, char *file, void *data), void *data);
#endif
#endif
|
Update prototypes to make them more compliant. | #ifndef PWM_H
#define PWM_H
void PwmInit(uint8_t channel);
void PwmSetPeriod(uint8_t channel, uint32_t frequency);
void PwmSetDuty(uint8_t channel, uint8_t duty);
typedef struct
{
uint32_t frequency;
uint8_t duty;
} PwmOutput;
#endif //PWM_H
| #ifndef PWM_H
#define PWM_H
extern void PwmInit(uint8_t channel);
extern void PwmSetPeriod(uint8_t channel, uint32_t frequency);
extern void PwmSetDuty(uint8_t channel, uint8_t duty);
typedef struct
{
uint32_t frequency;
uint8_t duty;
} PwmOutput;
#endif //PWM_H
|
Add missing decref in ctypes check | #ifndef NPY_CTYPES_H
#define NPY_CTYPES_H
#include <Python.h>
#include "npy_import.h"
/*
* Check if a python type is a ctypes class.
*
* Works like the Py<type>_Check functions, returning true if the argument
* looks like a ctypes object.
*
* This entire function is just a wrapper around the Python function of the
* same name.
*/
NPY_INLINE static int
npy_ctypes_check(PyTypeObject *obj)
{
static PyObject *py_func = NULL;
PyObject *ret_obj;
int ret;
npy_cache_import("numpy.core._internal", "npy_ctypes_check", &py_func);
if (py_func == NULL) {
goto fail;
}
ret_obj = PyObject_CallFunctionObjArgs(py_func, (PyObject *)obj, NULL);
if (ret_obj == NULL) {
goto fail;
}
ret = PyObject_IsTrue(ret_obj);
if (ret == -1) {
goto fail;
}
return ret;
fail:
/* If the above fails, then we should just assume that the type is not from
* ctypes
*/
PyErr_Clear();
return 0;
}
#endif
| #ifndef NPY_CTYPES_H
#define NPY_CTYPES_H
#include <Python.h>
#include "npy_import.h"
/*
* Check if a python type is a ctypes class.
*
* Works like the Py<type>_Check functions, returning true if the argument
* looks like a ctypes object.
*
* This entire function is just a wrapper around the Python function of the
* same name.
*/
NPY_INLINE static int
npy_ctypes_check(PyTypeObject *obj)
{
static PyObject *py_func = NULL;
PyObject *ret_obj;
int ret;
npy_cache_import("numpy.core._internal", "npy_ctypes_check", &py_func);
if (py_func == NULL) {
goto fail;
}
ret_obj = PyObject_CallFunctionObjArgs(py_func, (PyObject *)obj, NULL);
if (ret_obj == NULL) {
goto fail;
}
ret = PyObject_IsTrue(ret_obj);
Py_DECREF(ret_obj);
if (ret == -1) {
goto fail;
}
return ret;
fail:
/* If the above fails, then we should just assume that the type is not from
* ctypes
*/
PyErr_Clear();
return 0;
}
#endif
|
Add debug for android, solve all warning | #ifndef ABSTRACT_LEARNING_DEBUG_H
#define ABSTRACT_LEARNING_DEBUG_H
#include <stdlib.h>
#include <stdio.h>
#include <assert.h>
#define FUNC_PRINT(x) printf(#x"=%d in %s, %d \n",x, __func__, __LINE__);
#define FUNC_PRINT_ALL(x, type) printf(#x"="#type"%"#type" in %s, %d \n",x, __func__, __LINE__);
#define CHECK_POINTER(x) {if(NULL==x){FUNC_PRINT_ALL(x,p);break;}}
#ifdef __cplusplus
extern "C"{
#endif
void al_dump_stack();
#ifdef __cplusplus
}
#endif
//#define ALASSERT(x) assert(x)
#define ALASSERT(x) \
if (!(x)) al_dump_stack();assert(x);
#endif
| #ifndef ABSTRACT_LEARNING_DEBUG_H
#define ABSTRACT_LEARNING_DEBUG_H
#include <stdlib.h>
#include <stdio.h>
#include <assert.h>
/*Print method*/
#ifdef BUILD_FOR_ANDROID
#include <android/log.h>
#define ALPRINT(format, ...) __android_log_print(ANDROID_LOG_INFO, "AL", format,##__VA_ARGS__)
#define ALPRINT_FL(format,...) __android_log_print(ANDROID_LOG_INFO, "AL", format", FUNC: %s, LINE: %d \n",##__VA_ARGS__, __func__, __LINE__)
#else
#define ALPRINT(format, ...) printf(format,##__VA_ARGS__)
#define ALPRINT_FL(format,...) printf(format", FUNC: %s, LINE: %d \n", ##__VA_ARGS__,__func__, __LINE__)
#endif
/*Add with line and function*/
#define FUNC_PRINT(x) ALPRINT(#x"=%d in %s, %d \n",(int)(x), __func__, __LINE__);
#define FUNC_PRINT_ALL(x, type) ALPRINT(#x"= "#type" %"#type" in %s, %d \n",x, __func__, __LINE__);
#define CHECK_POINTER(x) {if(NULL==x){FUNC_PRINT_ALL(x,p);break;}}
#ifndef BUILD_FOR_ANDROID
#define ALASSERT(x) \
if (!(x)) al_dump_stack();assert(x);
#else
#define ALASSERT(x) \
{bool ___result = (x);\
if (!(___result))\
FUNC_PRINT((___result));}
#endif
#define CHECK_POINTER(x) {if(NULL==x){FUNC_PRINT_ALL(x,p);break;}}
#ifdef __cplusplus
extern "C"{
#endif
void al_dump_stack();
#ifdef __cplusplus
}
#endif
#endif
|
Add example that becomes unsound if pthread_exit is only handeled for top-level threads | // SKIP PARAM: --set ana.activated[+] apron --set ana.path_sens[+] threadflag --set ana.activated[+] threadJoins --sets ana.apron.privatization mutex-meet-tid
// Modification of 19 that would fail if pthread_exit was only handled for the top-level thread
#include <pthread.h>
#include <assert.h>
int g = 10;
int h = 10;
pthread_mutex_t A = PTHREAD_MUTEX_INITIALIZER;
void cheeky() { pthread_exit(NULL); }
void *t_evil(void *arg) {
pthread_mutex_lock(&A);
g = 8;
h = 20;
pthread_mutex_unlock(&A);
}
void *t_benign(void *arg) {
pthread_t id2;
pthread_create(&id2, NULL, t_evil, NULL);
int top;
if(top) {
// If the analysis does unsoundly not account for pthread_exit called from another function, these writes are lost
cheeky();
}
pthread_join(id2, NULL);
pthread_mutex_lock(&A);
g = 10;
h = 10;
pthread_mutex_unlock(&A);
return NULL;
}
int main(void) {
int t;
// Force multi-threaded handling
pthread_t id2;
pthread_create(&id2, NULL, t_benign, NULL);
pthread_mutex_lock(&A);
g = 10;
h = 10;
pthread_mutex_unlock(&A);
pthread_join(id2, NULL);
pthread_mutex_lock(&A);
assert(g == 10); //UNKNOWN!
pthread_mutex_unlock(&A);
return 0;
}
| |
Add further problematic example where positive half is excluded | // PARAM: --sets solver td3
void main(void) {
int x;
int i = 41;
while(i >= 12) {
x = 0;
i--;
}
}
| // PARAM: --sets solver td3
void main(void) {
int x;
int i = 41;
while(i >= 12) {
x = 0;
i--;
}
int y;
int j = -40;
while(-5 >= j) {
y = 0;
j++;
}
}
|
Enable use of stub from C++ | /*
* Copyright (c) , Arm Limited and affiliates.
* SPDX-License-Identifier: Apache-2.0
*
* 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 __EQUEUE_STUB_H__
#define __EQUEUE_STUB_H__
#include "stdint.h"
#include "stdbool.h"
typedef struct {
void *void_ptr;
bool call_cb_immediately;
} equeue_stub_def;
extern equeue_stub_def equeue_stub;
#endif
| /*
* Copyright (c) , Arm Limited and affiliates.
* SPDX-License-Identifier: Apache-2.0
*
* 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 __EQUEUE_STUB_H__
#define __EQUEUE_STUB_H__
#include "stdint.h"
#include "stdbool.h"
#ifdef __cplusplus
extern "C" {
#endif
typedef struct {
void *void_ptr;
bool call_cb_immediately;
} equeue_stub_def;
extern equeue_stub_def equeue_stub;
#ifdef __cplusplus
}
#endif
#endif
|
Fix warning when BINARY_DIR already defined | /*
* Copyright 2013 MongoDB Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef MONGOC_CONFIG_H
#define MONGOC_CONFIG_H
/*
* MONGOC_ENABLE_SSL is set from configure to determine if we are
* compiled with SSL support.
*/
#define MONGOC_ENABLE_SSL 1
#if MONGOC_ENABLE_SSL != 1
# undef MONGOC_ENABLE_SSL
#endif
/*
* MONGOC_ENABLE_SASL is set from configure to determine if we are
* compiled with SASL support.
*/
#define MONGOC_ENABLE_SASL 0
#if MONGOC_ENABLE_SASL != 1
# undef MONGOC_ENABLE_SASL
#endif
/*
* Set dir for mongoc tests
*/
#define BINARY_DIR "../../../__submodules/mongo-c-driver/tests/binary"
#endif /* MONGOC_CONFIG_H */
| /*
* Copyright 2013 MongoDB Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef MONGOC_CONFIG_H
#define MONGOC_CONFIG_H
/*
* MONGOC_ENABLE_SSL is set from configure to determine if we are
* compiled with SSL support.
*/
#define MONGOC_ENABLE_SSL 1
#if MONGOC_ENABLE_SSL != 1
# undef MONGOC_ENABLE_SSL
#endif
/*
* MONGOC_ENABLE_SASL is set from configure to determine if we are
* compiled with SASL support.
*/
#define MONGOC_ENABLE_SASL 0
#if MONGOC_ENABLE_SASL != 1
# undef MONGOC_ENABLE_SASL
#endif
/*
* Set dir for mongoc tests
*/
#undef BINARY_DIR
#define BINARY_DIR "../../../__submodules/mongo-c-driver/tests/binary"
#endif /* MONGOC_CONFIG_H */
|
Change magic string "abc" to better magic string "qux". | /*
RUN: %clang_cc1 -E -trigraphs %s | grep bar
RUN: %clang_cc1 -E -trigraphs %s | grep foo
RUN: %clang_cc1 -E -trigraphs %s | not grep abc
RUN: %clang_cc1 -E -trigraphs %s | not grep xyz
RUN: %clang_cc1 -fsyntax-only -trigraphs -verify %s
*/
// This is a simple comment, /*/ does not end a comment, the trailing */ does.
int i = /*/ */ 1;
/* abc
next comment ends with normal escaped newline:
*/
/* expected-warning {{escaped newline}} expected-warning {{backslash and newline}} *\
/
int bar /* expected-error {{expected ';' after top level declarator}} */
/* xyz
next comment ends with a trigraph escaped newline: */
/* expected-warning {{escaped newline between}} expected-warning {{backslash and newline separated by space}} expected-warning {{trigraph ends block comment}} *??/
/
foo
// rdar://6060752 - We should not get warnings about trigraphs in comments:
// '????'
/* ???? */
| /*
RUN: %clang_cc1 -E -trigraphs %s | grep bar
RUN: %clang_cc1 -E -trigraphs %s | grep foo
RUN: %clang_cc1 -E -trigraphs %s | not grep qux
RUN: %clang_cc1 -E -trigraphs %s | not grep xyz
RUN: %clang_cc1 -fsyntax-only -trigraphs -verify %s
*/
// This is a simple comment, /*/ does not end a comment, the trailing */ does.
int i = /*/ */ 1;
/* qux
next comment ends with normal escaped newline:
*/
/* expected-warning {{escaped newline}} expected-warning {{backslash and newline}} *\
/
int bar /* expected-error {{expected ';' after top level declarator}} */
/* xyz
next comment ends with a trigraph escaped newline: */
/* expected-warning {{escaped newline between}} expected-warning {{backslash and newline separated by space}} expected-warning {{trigraph ends block comment}} *??/
/
foo
// rdar://6060752 - We should not get warnings about trigraphs in comments:
// '????'
/* ???? */
|
Add client_monitor_init to the header | #include <glib-object.h>
void client_monitor_add (char *sender, GObject *object);
void client_monitor_remove (char *sender, GObject *object);
| #include <glib-object.h>
#include <dbus/dbus-glib.h>
void client_monitor_init (DBusGConnection *connection);
void client_monitor_add (char *sender, GObject *object);
void client_monitor_remove (char *sender, GObject *object);
|
Remove explanatory comment as it should be obvious what the member is | #ifndef CPR_RESPONSE_H
#define CPR_RESPONSE_H
#include <string>
#include "cookies.h"
#include "cprtypes.h"
#include "defines.h"
#include "error.h"
namespace cpr {
class Response {
public:
Response() = default;
template <typename TextType, typename HeaderType, typename UrlType, typename CookiesType, typename ErrorType>
Response(const long& p_status_code, TextType&& p_text, HeaderType&& p_header, UrlType&& p_url,
const double& p_elapsed, ErrorType&& p_error = Error{}, CookiesType&& p_cookies = Cookies{})
: status_code{p_status_code}, text{CPR_FWD(p_text)}, header{CPR_FWD(p_header)},
url{CPR_FWD(p_url)}, elapsed{p_elapsed}, cookies{CPR_FWD(p_cookies)}, error{CPR_FWD(p_error)} {}
long status_code;
std::string text;
Header header;
Url url;
double elapsed;
Cookies cookies;
//error conditions
Error error;
};
} // namespace cpr
#endif
| #ifndef CPR_RESPONSE_H
#define CPR_RESPONSE_H
#include <string>
#include "cookies.h"
#include "cprtypes.h"
#include "defines.h"
#include "error.h"
namespace cpr {
class Response {
public:
Response() = default;
template <typename TextType, typename HeaderType, typename UrlType, typename CookiesType, typename ErrorType>
Response(const long& p_status_code, TextType&& p_text, HeaderType&& p_header, UrlType&& p_url,
const double& p_elapsed, ErrorType&& p_error = Error{}, CookiesType&& p_cookies = Cookies{})
: status_code{p_status_code}, text{CPR_FWD(p_text)}, header{CPR_FWD(p_header)},
url{CPR_FWD(p_url)}, elapsed{p_elapsed}, cookies{CPR_FWD(p_cookies)}, error{CPR_FWD(p_error)} {}
long status_code;
std::string text;
Header header;
Url url;
double elapsed;
Cookies cookies;
Error error;
};
} // namespace cpr
#endif
|
Set default line and row to 1 | #ifndef SCANNER_H
#define SCANNER_H
#include <QString>
#include <QChar>
#include <QVector>
#include "token.h"
/**
* @class Scanner
* @brief Class representing a scanner (lexical analyzer). It takes a file path as input and generates tokens, either lazily or as a QVector.
*/
class Scanner
{
public:
Scanner(const QString& sourcePath);
/**
* @brief Read until a token is parsed, add it to the vector of tokens and return the last one (by value).
* @return the newest token.
*/
Token nextToken();
private:
QChar peek() const;
QChar next();
QString fileContent;
QVector<Token> tokens;
int currentChar = 0;
int currentLine = 0;
int currentRow = 0;
};
#endif // SCANNER_H
| #ifndef SCANNER_H
#define SCANNER_H
#include <QString>
#include <QChar>
#include <QVector>
#include "token.h"
/**
* @class Scanner
* @brief Class representing a scanner (lexical analyzer). It takes a file path as input and generates tokens, either lazily or as a QVector.
*/
class Scanner
{
public:
Scanner(const QString& sourcePath);
/**
* @brief Read until a token is parsed, add it to the vector of tokens and return the last one (by value).
* @return the newest token.
*/
Token nextToken();
private:
QChar peek() const;
QChar next();
QString fileContent;
QVector<Token> tokens;
int currentChar = 0;
int currentLine = 1;
int currentRow = 1;
};
#endif // SCANNER_H
|
Optimize pset2 hacker edition slightly. | /****************************************************************************
* initials.c
*
* Computer Science 50
* Problem Set 2 - Hacker Edition
*
* Return uppercase initials of name provided.
***************************************************************************/
#include <stdio.h>
#include <string.h>
#include <ctype.h>
#include <stdlib.h>
int main(void)
{
// get name from user
printf("Enter name: ");
char* name = malloc(128*sizeof(char));
fgets (name, 128, stdin);
printf("%c", toupper(name[0]));
for (int i = 1; i < strlen(name); i++)
{
if (name[i] == ' ')
{
while (name[i] == ' ')
i++;
printf("%c", toupper(name[i]));
}
}
printf("\n");
}
| /****************************************************************************
* initials.c
*
* Computer Science 50
* Problem Set 2 - Hacker Edition
*
* Return uppercase initials of name provided.
***************************************************************************/
#include <stdio.h>
#include <string.h>
#include <ctype.h>
#include <stdlib.h>
int main(void)
{
// get name from user
printf("Enter name: ");
char* name = malloc(128*sizeof(char));
fgets (name, 128, stdin);
printf("%c", toupper(name[0]));
for (int i = 1, n = strlen(name); i < n; i++)
{
if (name[i] == ' ')
{
while (name[i] == ' ')
i++;
printf("%c", toupper(name[i]));
}
}
printf("\n");
}
|
Add necessary include to get_device_id helper | #include <iostream>
using std::cout;
using std::cin;
using std::endl;
string get_device_id() {
cout << concol::RED << "Enumerating devices" << concol::RESET << endl;
int numDevices = get_numDevices();
cout << concol::RED << numDevices << " APS device" << (numDevices > 1 ? "s": "") << " found" << concol::RESET << endl;
if (numDevices < 1)
return 0;
cout << concol::RED << "Attempting to get serials" << concol::RESET << endl;
const char ** serialBuffer = new const char*[numDevices];
get_deviceSerials(serialBuffer);
for (int cnt=0; cnt < numDevices; cnt++) {
cout << concol::RED << "Device " << cnt << " serial #: " << serialBuffer[cnt] << concol::RESET << endl;
}
string deviceSerial;
if (numDevices == 1) {
deviceSerial = string(serialBuffer[0]);
}
else {
cout << "Choose device ID [0]: ";
string input = "";
getline(cin, input);
int device_id = 0;
if (input.length() != 0) {
std::stringstream mystream(input);
mystream >> device_id;
}
deviceSerial = string(serialBuffer[device_id]);
}
delete[] serialBuffer;
return deviceSerial;
} | #include <iostream>
#include <sstream>
#include "concol.h"
using std::cout;
using std::cin;
using std::endl;
using std::string;
string get_device_id() {
cout << concol::RED << "Enumerating devices" << concol::RESET << endl;
int numDevices = get_numDevices();
cout << concol::RED << numDevices << " APS device" << (numDevices > 1 ? "s": "") << " found" << concol::RESET << endl;
if (numDevices < 1)
return 0;
cout << concol::RED << "Attempting to get serials" << concol::RESET << endl;
const char ** serialBuffer = new const char*[numDevices];
get_deviceSerials(serialBuffer);
for (int cnt=0; cnt < numDevices; cnt++) {
cout << concol::RED << "Device " << cnt << " serial #: " << serialBuffer[cnt] << concol::RESET << endl;
}
string deviceSerial;
if (numDevices == 1) {
deviceSerial = string(serialBuffer[0]);
}
else {
cout << "Choose device ID [0]: ";
string input = "";
getline(cin, input);
int device_id = 0;
if (input.length() != 0) {
std::stringstream mystream(input);
mystream >> device_id;
}
deviceSerial = string(serialBuffer[device_id]);
}
delete[] serialBuffer;
return deviceSerial;
} |
Add dev home vm creds | //
// PachubeAppCredentials.h
// IoTally
//
// Created by Levent Ali on 09/02/2012.
// Copyright (c) 2012 __MyCompanyName__. All rights reserved.
//
#define kPBoAuthAppId @"e03db05a9cb717769d41"
#define kPBoAuthAppSecret @"VYeiGP-4aLsQbm9Ywu7VKJJzSVRBvTeuyyGN2UyQsWestpcc"
#define kPBoauthRedirectURI @"https://appdev.loc/?levent=oauth"
#define kPBsiteEndpoint @"https://appdev.loc"
#define kPBapiEndpoint @"https://api.appdev.loc/v2"
| |
Update plugin version to 1.1 | #pragma once
#include <future>
#include <list>
#include <map>
#include <set>
#include <Shlwapi.h>
#include "../lib/foobar2000_sdk/foobar2000/SDK/foobar2000.h"
#include "../lib/tinyxml2/tinyxml2.h"
#define PLUGIN_NAME "WPL Playlist support"
#define PLUGIN_VERSION "1.0.2"
#define CONSOLE_HEADER "foo_wpl: " | #pragma once
#include <future>
#include <list>
#include <map>
#include <set>
#include <Shlwapi.h>
#include "../lib/foobar2000_sdk/foobar2000/SDK/foobar2000.h"
#include "../lib/tinyxml2/tinyxml2.h"
#define PLUGIN_NAME "WPL Playlist support"
#define PLUGIN_VERSION "1.1"
#define CONSOLE_HEADER "foo_wpl: " |
Fix for newlines and other non-printable chars in renderer | #ifndef PYFONT_H
#define PYFONT_H
#include <stdint.h>
#include <stddef.h>
struct PyFont
{
PyFont(uint8_t chars, uint8_t baseChar, const uint8_t* data, const uint16_t* offsets, const uint8_t* sizes):
chars(chars), baseChar(baseChar), data(data), offsets(offsets), sizes(sizes) {}
uint8_t chars;
uint8_t baseChar;
const uint8_t* data;
const uint16_t* offsets;
const uint8_t* sizes;
uint8_t getCharSize(char ch) const
{
uint16_t o = ((uint8_t)ch)-baseChar;
return sizes[o];
}
const uint8_t* getCharData(char ch) const
{
uint16_t o = ((uint8_t)ch)-baseChar;
return data + offsets[o];
}
};
int renderText(const PyFont& f, const char* text, uint8_t* output, int maxSize);
size_t calculateRenderedLength(const PyFont& f, const char* text);
#endif //PYFONT_H
| #ifndef PYFONT_H
#define PYFONT_H
#include <stdint.h>
#include <stddef.h>
struct PyFont
{
PyFont(uint8_t chars, uint8_t baseChar, const uint8_t* data, const uint16_t* offsets, const uint8_t* sizes):
chars(chars), baseChar(baseChar), data(data), offsets(offsets), sizes(sizes) {}
uint8_t chars;
uint8_t baseChar;
const uint8_t* data;
const uint16_t* offsets;
const uint8_t* sizes;
uint8_t getCharSize(char ch) const
{
if ((ch < baseChar) || (ch > (chars + baseChar)))
ch = baseChar;
uint16_t o = ((uint8_t)ch)-baseChar;
return sizes[o];
}
const uint8_t* getCharData(char ch) const
{
if ((ch < baseChar) || (ch > (chars + baseChar)))
ch = baseChar;
uint16_t o = ((uint8_t)ch)-baseChar;
return data + offsets[o];
}
};
int renderText(const PyFont& f, const char* text, uint8_t* output, int maxSize);
size_t calculateRenderedLength(const PyFont& f, const char* text);
#endif //PYFONT_H
|
Fix the block database singleton | #ifndef BlockDatabase_H_INCLUDED
#define BlockDatabase_H_INCLUDED
#include <memory>
#include <array>
#include "Types/BlockType.h"
#include "BlockID.h"
#include "../../Texture/Texture_Atlas.h"
namespace Block
{
class Database
{
public:
static Database& get();
Database();
const BlockType& getBlock(uint8_t id) const;
const BlockType& getBlock(ID blockID) const;
const Texture::Atlas& getTextureAtlas() const;
private:
std::array<std::unique_ptr<BlockType>, (int)ID::NUM_BlockTypeS> m_blocks;
Texture::Atlas m_textures;
};
const BlockType& get(uint8_t id);
const BlockType& get(ID blockID);
}
#endif // BlockDatabase_H_INCLUDED
| #ifndef BlockDatabase_H_INCLUDED
#define BlockDatabase_H_INCLUDED
#include <memory>
#include <array>
#include "Types/BlockType.h"
#include "BlockID.h"
#include "../../Texture/Texture_Atlas.h"
namespace Block
{
class Database
{
public:
static Database& get();
const BlockType& getBlock(uint8_t id) const;
const BlockType& getBlock(ID blockID) const;
const Texture::Atlas& getTextureAtlas() const;
private:
Database();
std::array<std::unique_ptr<BlockType>, (int)ID::NUM_BlockTypeS> m_blocks;
Texture::Atlas m_textures;
};
const BlockType& get(uint8_t id);
const BlockType& get(ID blockID);
}
#endif // BlockDatabase_H_INCLUDED
|
Add catalog folder rename command | /*
* This file is part of Kotaka, a mud library for DGD
* http://github.com/shentino/kotaka
*
* Copyright (C) 2012 Raymond Jennings
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <kotaka/paths.h>
#include <text/paths.h>
inherit LIB_RAWVERB;
atomic private void do_folder_rename(string old, string new)
{
mapping map;
string *names;
int *keys;
int sz, i;
map = CATALOGD->list_directory(old);
names = map_indices(map);
keys = map_values(map);
sz = sizeof(names);
for (i = 0; i < sz; i++) {
string name;
name = names[i];
switch(keys[i]) {
case 1: /* object */
CATALOGD->lookup_object(old + ":" + name)->set_object_name(new + ":" + name);
break;
case 2:
do_folder_rename(old + ":" + name, new + ":" + name);
}
}
}
void main(object actor, string args)
{
string old, new;
object user;
user = query_user();
if (user->query_class() < 2) {
send_out("You do not have sufficient access rights to rename catalog folders.\n");
return;
}
if (sscanf(args, "%s %s", old, new) != 2) {
send_out("Usage: frename old_folder new_folder\n");
return;
}
switch (CATALOGD->test_name(old)) {
case -2: send_out(old + " has an object in it.\n"); return;
case -1: send_out(old + " does not exist somewhere.\n"); return;
case 0: send_out(old + " does not exist.\n"); return;
case 1: send_out(old + " is an object.\n"); return;
}
switch (CATALOGD->test_name(new)) {
case -2: send_out(new + " has an object in it.\n"); return;
case 2: send_out(new + " already exists.\n"); return;
case 1: send_out(new + " is an object.\n"); return;
}
do_folder_rename(old, new);
}
| |
Allow data to contain also lowercase hex characters. | /* Copyright (c) 2005-2011 Dovecot authors, see the included COPYING file */
#include "lib.h"
#include "hex-dec.h"
void dec2hex(unsigned char *hexstr, uintmax_t dec, unsigned int hexstr_size)
{
unsigned int i;
for (i = 0; i < hexstr_size; i++) {
unsigned int value = dec & 0x0f;
if (value < 10)
hexstr[hexstr_size-i-1] = value + '0';
else
hexstr[hexstr_size-i-1] = value - 10 + 'A';
dec >>= 4;
}
}
uintmax_t hex2dec(const unsigned char *data, unsigned int len)
{
unsigned int i;
uintmax_t value = 0;
for (i = 0; i < len; i++) {
value = value*0x10;
if (data[i] >= '0' && data[i] <= '9')
value += data[i]-'0';
else if (data[i] >= 'A' && data[i] <= 'F')
value += data[i]-'A' + 10;
else
return 0;
}
return value;
}
| /* Copyright (c) 2005-2011 Dovecot authors, see the included COPYING file */
#include "lib.h"
#include "hex-dec.h"
void dec2hex(unsigned char *hexstr, uintmax_t dec, unsigned int hexstr_size)
{
unsigned int i;
for (i = 0; i < hexstr_size; i++) {
unsigned int value = dec & 0x0f;
if (value < 10)
hexstr[hexstr_size-i-1] = value + '0';
else
hexstr[hexstr_size-i-1] = value - 10 + 'A';
dec >>= 4;
}
}
uintmax_t hex2dec(const unsigned char *data, unsigned int len)
{
unsigned int i;
uintmax_t value = 0;
for (i = 0; i < len; i++) {
value = value*0x10;
if (data[i] >= '0' && data[i] <= '9')
value += data[i]-'0';
else if (data[i] >= 'A' && data[i] <= 'F')
value += data[i]-'A' + 10;
else if (data[i] >= 'a' && data[i] <= 'f')
value += data[i]-'a' + 10;
else
return 0;
}
return value;
}
|
Add example with ethernet leds | #include <inc/hw_types.h>
#include <driverlib/sysctl.h>
#include <stdio.h>
#include <string.h>
#include <inc/hw_memmap.h>
#include <inc/hw_sysctl.h>
#include <driverlib/gpio.h>
#include <driverlib/debug.h>
#define DEFAULT_STRENGTH GPIO_STRENGTH_2MA
#define DEFAULT_PULL_TYPE GPIO_PIN_TYPE_STD_WPU
#define PORT_E GPIO_PORTE_BASE
#define PORT_F GPIO_PORTF_BASE
#define PIN_0 GPIO_PIN_0
#define PIN_1 GPIO_PIN_1
#define PIN_2 GPIO_PIN_2
#define PIN_3 GPIO_PIN_3
#define HIGH 0xFF
#define LOW 0x00
int btnAPressed, btnBPressed = 0;
void setup() {
SysCtlClockSet(SYSCTL_SYSDIV_4 | SYSCTL_USE_PLL | SYSCTL_OSC_MAIN | SYSCTL_XTAL_8MHZ);
SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOE);
GPIOPinTypeGPIOInput(PORT_E, PIN_0 | PIN_1 | PIN_2 | PIN_3);
GPIOPadConfigSet(PORT_E, PIN_0 | PIN_1 | PIN_2 | PIN_3, DEFAULT_STRENGTH, DEFAULT_PULL_TYPE);
SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOF);
GPIOPinTypeGPIOOutput(PORT_F, PIN_0 | PIN_1 | PIN_2 | PIN_3);
GPIOPadConfigSet(PORT_F, PIN_0 | PIN_1 | PIN_2 | PIN_3, DEFAULT_STRENGTH, DEFAULT_PULL_TYPE);
}
int main(){
setup();
while (1) {
btnAPressed = (GPIOPinRead(PORT_E, PIN_0) & 0x01) != 0x01;
btnBPressed = (GPIOPinRead(PORT_E, PIN_1) & 0x02) != 0x02;
if (btnAPressed)
GPIOPinWrite(PORT_F, PIN_2, LOW);
else
GPIOPinWrite(PORT_F, PIN_2, HIGH);
if (btnBPressed)
GPIOPinWrite(PORT_F, PIN_3, LOW);
else
GPIOPinWrite(PORT_F, PIN_3, HIGH);
}
}
| |
Fix IO header include issue | /* $Id$
*
* OpenMAMA: The open middleware agnostic messaging API
* Copyright (C) 2011 NYSE Technologies, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.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
*/
#ifndef MAMA_BRIDGE_QPID_IO_H__
#define MAMA_BRIDGE_QPID_IO_H__
/*=========================================================================
= Includes =
=========================================================================*/
#if defined(__cplusplus)
extern "C" {
#endif
/*=========================================================================
= Public implementation functions =
=========================================================================*/
mama_status
qpidBridgeMamaIoImpl_start (void);
mama_status
qpidBridgeMamaIoImpl_stop (void);
#if defined(__cplusplus)
}
#endif
#endif /* MAMA_BRIDGE_QPID_IO_H__ */
| /* $Id$
*
* OpenMAMA: The open middleware agnostic messaging API
* Copyright (C) 2011 NYSE Technologies, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.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
*/
#ifndef MAMA_BRIDGE_QPID_IO_H__
#define MAMA_BRIDGE_QPID_IO_H__
/*=========================================================================
= Includes =
=========================================================================*/
#if defined(__cplusplus)
extern "C" {
#endif
#include <mama/mama.h>
/*=========================================================================
= Public implementation functions =
=========================================================================*/
mama_status
qpidBridgeMamaIoImpl_start (void);
mama_status
qpidBridgeMamaIoImpl_stop (void);
#if defined(__cplusplus)
}
#endif
#endif /* MAMA_BRIDGE_QPID_IO_H__ */
|
Use atomic_inc function in histogram instead of reductions (which are not supported by PPCG) | #include "histogram.pencil.h"
#include <pencil.h>
static void calcHist( const int rows
, const int cols
, const int step
, const unsigned char image[static const restrict rows][step]
, int hist[static const restrict HISTOGRAM_BINS] //out
)
{
#pragma scop
__pencil_assume(rows > 0);
__pencil_assume(cols > 0);
__pencil_assume(step >= cols);
__pencil_kill(hist);
#pragma pencil independent
for(int b = 0; b < HISTOGRAM_BINS; ++b)
hist[b] = 0;
#pragma pencil independent reduction(+:hist)
for(int r = 0; r < rows; ++r)
{
#pragma pencil independent reduction(+:hist)
for(int c = 0; c < cols; ++c)
{
unsigned char pixel = image[r][c];
++hist[pixel];
}
}
#pragma endscop
}
void pencil_calcHist( const int rows, const int cols, const int step, const unsigned char image[], int hist[HISTOGRAM_BINS])
{
calcHist( rows, cols, step, (const unsigned char(*)[step])image, hist);
}
| #include "histogram.pencil.h"
#include <pencil.h>
void atomic_inc(int *v);
#ifndef __PENCIL__
void atomic_inc(int *v)
{
(*v)++;
}
#endif
static void calcHist( const int rows
, const int cols
, const int step
, const unsigned char image[static const restrict rows][step]
, int hist[static const restrict HISTOGRAM_BINS] //out
)
{
#pragma scop
__pencil_assume(rows > 0);
__pencil_assume(cols > 0);
__pencil_assume(step >= cols);
__pencil_kill(hist);
#pragma pencil independent
for(int b = 0; b < HISTOGRAM_BINS; ++b)
hist[b] = 0;
#pragma pencil independent
for(int r = 0; r < rows; ++r)
{
#pragma pencil independent
for(int c = 0; c < cols; ++c)
{
unsigned char pixel = image[r][c];
atomic_inc(&hist[pixel]);
}
}
__pencil_kill(image);
#pragma endscop
}
void pencil_calcHist( const int rows, const int cols, const int step, const unsigned char image[], int hist[HISTOGRAM_BINS])
{
calcHist( rows, cols, step, (const unsigned char(*)[step])image, hist);
}
|
Fix pthread_yield() not supported by OS X | #ifndef EMULATOR_PROCESS_H
#include <pthread.h>
#include <stdarg.h>
#define MAX_ARGS 8
// A transputer process (more like a thread)
typedef struct {
pthread_t thread;
void* args[MAX_ARGS];
void (*func)();
} Process;
// Create a new process, with entry point 'func' and given stacksize. The
// 'nargs' arguments are passed to 'func' upon startup.
Process *ProcAlloc (void (*func)(), int stacksize, int nargs, ...);
// Start the process 'p'
void ProcRun (Process *p);
// Yield the rest of the time-slice to another process
void ProcReschedule();
#define EMULATOR_PROCESS_H
#endif // EMULATOR_PROCESS_H
| #ifndef EMULATOR_PROCESS_H
#include <pthread.h>
// OS X does not support pthread_yield(), only pthread_yield_np()
#if defined(__APPLE__) || defined(__MACH__)
#define pthread_yield() pthread_yield_np()
#endif
#include <stdarg.h>
#define MAX_ARGS 8
// A transputer process (more like a thread)
typedef struct {
pthread_t thread;
void* args[MAX_ARGS];
void (*func)();
} Process;
// Create a new process, with entry point 'func' and given stacksize. The
// 'nargs' arguments are passed to 'func' upon startup.
Process *ProcAlloc (void (*func)(), int stacksize, int nargs, ...);
// Start the process 'p'
void ProcRun (Process *p);
// Yield the rest of the time-slice to another process
void ProcReschedule();
#define EMULATOR_PROCESS_H
#endif // EMULATOR_PROCESS_H
|
Update compat with old libcleri | /*
* gramp.h - SiriDB Grammar Properties.
*
* Note: we need this file up-to-date with the grammar. The grammar has
* keywords starting with K_ so the will all be sorted.
* KW_OFFSET should be set to the first keyword and KW_COUNT needs the
* last keyword in the grammar.
*
*/
#ifndef SIRI_GRAMP_H_
#define SIRI_GRAMP_H_
#include <siri/grammar/grammar.h>
/* keywords */
#define KW_OFFSET CLERI_GID_K_ACCESS
#define KW_COUNT CLERI_GID_K_WRITE + 1 - KW_OFFSET
/* aggregation functions */
#define F_OFFSET CLERI_GID_F_COUNT
/* help statements */
#define HELP_OFFSET CLERI_GID_HELP_ACCESS
#define HELP_COUNT CLERI_GID_HELP_TIMEZONES + 1 - HELP_OFFSET
#if CLERI_VERSION_MINOR >= 12
#define CLERI_NODE_DATA(__node) ((intptr_t)(__node)->data)
#define CLERI_NODE_DATA_ADDR(__node) ((intptr_t *) &(__node)->data)
#else
#define CLERI_NODE_DATA(__node) ((intptr_t)(__node)->result)
#define CLERI_NODE_DATA_ADDR(__node) ((intptr_t *) &(__node)->result)
#endif
#endif /* SIRI_GRAMP_H_ */
| /*
* gramp.h - SiriDB Grammar Properties.
*
* Note: we need this file up-to-date with the grammar. The grammar has
* keywords starting with K_ so the will all be sorted.
* KW_OFFSET should be set to the first keyword and KW_COUNT needs the
* last keyword in the grammar.
*
*/
#ifndef SIRI_GRAMP_H_
#define SIRI_GRAMP_H_
#include <siri/grammar/grammar.h>
/* keywords */
#define KW_OFFSET CLERI_GID_K_ACCESS
#define KW_COUNT CLERI_GID_K_WRITE + 1 - KW_OFFSET
/* aggregation functions */
#define F_OFFSET CLERI_GID_F_COUNT
/* help statements */
#define HELP_OFFSET CLERI_GID_HELP_ACCESS
#define HELP_COUNT CLERI_GID_HELP_TIMEZONES + 1 - HELP_OFFSET
#if CLERI_VERSION_MINOR >= 12
#define CLERI_NODE_DATA(__node) ((intptr_t)(__node)->data)
#define CLERI_NODE_DATA_ADDR(__node) ((intptr_t *) &(__node)->data)
#else
#define CLERI_NODE_DATA(__node) (__node)->result
#define CLERI_NODE_DATA_ADDR(__node) &(__node)->result
#endif
#endif /* SIRI_GRAMP_H_ */
|
Add SK_API to null canvas create method | /*
* Copyright 2012 Google Inc.
*
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
#ifndef SkNullCanvas_DEFINED
#define SkNullCanvas_DEFINED
#include "SkBitmap.h"
class SkCanvas;
/**
* Creates a canvas that draws nothing. This is useful for performance testing.
*/
SkCanvas* SkCreateNullCanvas();
#endif
| /*
* Copyright 2012 Google Inc.
*
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
#ifndef SkNullCanvas_DEFINED
#define SkNullCanvas_DEFINED
#include "SkBitmap.h"
class SkCanvas;
/**
* Creates a canvas that draws nothing. This is useful for performance testing.
*/
SK_API SkCanvas* SkCreateNullCanvas();
#endif
|
Fix MSVC interpretation of our types. | // Copyright 2012 (c) Pavel Krajcevski
// BC7IntTypes.h
// This file contains all of the various platform definitions for fixed width integers
// on various platforms.
// !FIXME! Still needs to be tested on Windows platforms.
#ifndef _TEX_COMP_TYPES_H_
#define _TEX_COMP_TYPES_H_
// Windows?
#ifdef _MSC_VER
typedef __int16 int16;
typedef __uint16 uint16;
typedef __int32 int32;
typedef __uint32 uint32;
typedef __int8 int8;
typedef __uint8 uint8;
typedef __uint64 uint64;
typedef __int64 int64;
typedef __int32_ptr int32_ptr;
// If not, assume GCC, or at least standard defines...
#else
#include <stdint.h>
typedef int8_t int8;
typedef int16_t int16;
typedef int32_t int32;
typedef int64_t int64;
typedef uint8_t uint8;
typedef uint16_t uint16;
typedef uint32_t uint32;
typedef uint64_t uint64;
typedef uintptr_t int32_ptr;
typedef char CHAR;
#endif // _MSC_VER
#endif // _TEX_COMP_TYPES_H_
| // Copyright 2012 (c) Pavel Krajcevski
// BC7IntTypes.h
// This file contains all of the various platform definitions for fixed width integers
// on various platforms.
// !FIXME! Still needs to be tested on Windows platforms.
#ifndef _TEX_COMP_TYPES_H_
#define _TEX_COMP_TYPES_H_
// Windows?
#ifdef _MSC_VER
typedef __int16 int16;
typedef unsigned __int16 uint16;
typedef __int32 int32;
typedef unsigned __int32 uint32;
typedef __int8 int8;
typedef unsigned __int8 uint8;
typedef unsigned __int64 uint64;
typedef __int64 int64;
#include <tchar.h>
typedef TCHAR CHAR;
// If not, assume GCC, or at least standard defines...
#else
#include <stdint.h>
typedef int8_t int8;
typedef int16_t int16;
typedef int32_t int32;
typedef int64_t int64;
typedef uint8_t uint8;
typedef uint16_t uint16;
typedef uint32_t uint32;
typedef uint64_t uint64;
typedef char CHAR;
#endif // _MSC_VER
#endif // _TEX_COMP_TYPES_H_
|
Clean up in buildbot directories. | // RUN: %clang_cc1 -Wreturn-type %s -emit-llvm-only
void test1(int x) {
switch (x) {
case 111111111111111111111111111111111111111:
bar();
}
}
// Mismatched type between return and function result.
int test2() { return; }
void test3() { return 4; }
void test4() {
bar:
baz:
blong:
bing:
;
// PR5131
static long x = &&bar - &&baz;
static long y = &&baz;
&&bing;
&&blong;
if (y)
goto *y;
goto *x;
}
// PR3869
int test5(long long b) {
static void *lbls[] = { &&lbl };
goto *b;
lbl:
return 0;
}
| // RUN: rm -f %S/statements.ll
// RUN: %clang_cc1 -Wreturn-type %s -emit-llvm-only
void test1(int x) {
switch (x) {
case 111111111111111111111111111111111111111:
bar();
}
}
// Mismatched type between return and function result.
int test2() { return; }
void test3() { return 4; }
void test4() {
bar:
baz:
blong:
bing:
;
// PR5131
static long x = &&bar - &&baz;
static long y = &&baz;
&&bing;
&&blong;
if (y)
goto *y;
goto *x;
}
// PR3869
int test5(long long b) {
static void *lbls[] = { &&lbl };
goto *b;
lbl:
return 0;
}
|
Add timestamp to output in the beginning of output. | /**
* Copyright (c) 2015 Runtime Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include <stdarg.h>
#include <stdio.h>
#include <console/console.h>
#define CONS_OUTPUT_MAX_LINE 128
void console_printf(const char *fmt, ...)
{
va_list args;
char buf[CONS_OUTPUT_MAX_LINE];
int len;
va_start(args, fmt);
len = vsnprintf(buf, sizeof(buf), fmt, args);
va_end(args);
if (len >= sizeof(buf)) {
len = sizeof(buf) - 1;
}
if (buf[len - 1] != '\n') {
if (len != sizeof(buf) - 1) {
len++;
}
buf[len - 1] = '\n';
}
console_write(buf, len);
}
| /**
* Copyright (c) 2015 Runtime Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include <stdarg.h>
#include <stdio.h>
#include <console/console.h>
#include <os/os_time.h>
#define CONS_OUTPUT_MAX_LINE 128
void console_printf(const char *fmt, ...)
{
va_list args;
char buf[CONS_OUTPUT_MAX_LINE];
int len;
len = snprintf(buf, sizeof(buf), "%lu:", os_time_get());
console_write(buf, len);
va_start(args, fmt);
len = vsnprintf(buf, sizeof(buf), fmt, args);
va_end(args);
if (len >= sizeof(buf)) {
len = sizeof(buf) - 1;
}
if (buf[len - 1] != '\n') {
if (len != sizeof(buf) - 1) {
len++;
}
buf[len - 1] = '\n';
}
console_write(buf, len);
}
|
Add linked list implementation of queue | #include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>
/* This is Stack Implementation using a Linked list */
#define MAXSIZE 101
#define BOOL_PRINT(bool_expr) "%s\n", (bool_expr) ? "true" : "false"
typedef struct node{
int data;
struct node* link;
} node;
node* head; //global variable
node* create_newnode(int x){
node* temp;
temp = (node*) malloc (sizeof(node));
temp->data =x;
temp->link=NULL;
return temp;
}
void enq(int data){
//this is equivalent to add a node at end of the linked list
if(isEmpty()){
node* temp;
temp =create_newnode(data);
temp->link = head;
head = temp;
}
else{
node* temp;
temp =create_newnode(data);
node* last = head;
while(last->link!=NULL){
last=last->link;
}
last->link = temp;
}
}
int deq(){
//this is equivalent to delete a node at begining of the linked list
if(head != NULL ){
node* temp = head;
head = temp->link;
return temp->data;
}
else{
printf("Error: queue is empty \n");
return -1;
}
}
int isEmpty(){
//this is equivalent to checking if the linked list is empty
if(head != NULL) return false;
else return true;
}
void q_print(){
//this is equivalent to printing a linked list while traversing
printf("queue is : ");
node* temp = head;
while(temp != NULL){
printf("%d ", temp->data);
temp = temp->link;
}
printf("\n");
}
int main(){
int i;
printf("is queue empty? \n");
printf(BOOL_PRINT(isEmpty()));
enq(10);
enq(11);
enq(12);
enq(15);
i = deq();
printf("first in queue is %d\n",i );
q_print();
return 0;
} | |
Convert BasicAA to be an immutable pass instead of a FunctionPass | //===- llvm/Analysis/BasicAliasAnalysis.h - Alias Analysis Impl -*- C++ -*-===//
//
// This file defines the default implementation of the Alias Analysis interface
// that simply implements a few identities (two different globals cannot alias,
// etc), but otherwise does no analysis.
//
//===----------------------------------------------------------------------===//
#ifndef LLVM_ANALYSIS_BASIC_ALIAS_ANALYSIS_H
#define LLVM_ANALYSIS_BASIC_ALIAS_ANALYSIS_H
#include "llvm/Analysis/AliasAnalysis.h"
#include "llvm/Pass.h"
struct BasicAliasAnalysis : public FunctionPass, public AliasAnalysis {
// Pass Implementation stuff. This isn't much of a pass.
//
bool runOnFunction(Function &) { return false; }
// getAnalysisUsage - Does not modify anything.
//
virtual void getAnalysisUsage(AnalysisUsage &AU) const {
AU.setPreservesAll();
}
// alias - This is the only method here that does anything interesting...
//
Result alias(const Value *V1, const Value *V2) const;
/// canCallModify - We are not interprocedural, so we do nothing exciting.
///
Result canCallModify(const CallInst &CI, const Value *Ptr) const {
return MayAlias;
}
/// canInvokeModify - We are not interprocedural, so we do nothing exciting.
///
Result canInvokeModify(const InvokeInst &I, const Value *Ptr) const {
return MayAlias; // We are not interprocedural
}
};
#endif
| //===- llvm/Analysis/BasicAliasAnalysis.h - Alias Analysis Impl -*- C++ -*-===//
//
// This file defines the default implementation of the Alias Analysis interface
// that simply implements a few identities (two different globals cannot alias,
// etc), but otherwise does no analysis.
//
//===----------------------------------------------------------------------===//
#ifndef LLVM_ANALYSIS_BASIC_ALIAS_ANALYSIS_H
#define LLVM_ANALYSIS_BASIC_ALIAS_ANALYSIS_H
#include "llvm/Analysis/AliasAnalysis.h"
#include "llvm/Pass.h"
struct BasicAliasAnalysis : public ImmutablePass, public AliasAnalysis {
// Pass Implementation stuff. This isn't much of a pass.
//
bool runOnFunction(Function &) { return false; }
// getAnalysisUsage - Does not modify anything.
//
virtual void getAnalysisUsage(AnalysisUsage &AU) const {
AU.setPreservesAll();
}
// alias - This is the only method here that does anything interesting...
//
Result alias(const Value *V1, const Value *V2) const;
/// canCallModify - We are not interprocedural, so we do nothing exciting.
///
Result canCallModify(const CallInst &CI, const Value *Ptr) const {
return MayAlias;
}
/// canInvokeModify - We are not interprocedural, so we do nothing exciting.
///
Result canInvokeModify(const InvokeInst &I, const Value *Ptr) const {
return MayAlias; // We are not interprocedural
}
};
#endif
|
Trim newline off of username | #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);
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[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;
}
|
Make DuiPageSwitchAnimation not use dangling pointers. | /***************************************************************************
**
** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (directui@nokia.com)
**
** This file is part of libdui.
**
** If you have questions regarding the use of this file, please contact
** Nokia at directui@nokia.com.
**
** This library is free software; you can redistribute it and/or
** modify it under the terms of the GNU Lesser General Public
** License version 2.1 as published by the Free Software Foundation
** and appearing in the file LICENSE.LGPL included in the packaging
** of this file.
**
****************************************************************************/
#ifndef DUIPAGESWITCHANIMATION_P_H
#define DUIPAGESWITCHANIMATION_P_H
#include "duipageswitchanimation.h"
#include "duiparallelanimationgroup_p.h"
class DuiSceneWindow;
class QPropertyAnimation;
class DuiPageSwitchAnimationPrivate : public DuiParallelAnimationGroupPrivate
{
Q_DECLARE_PUBLIC(DuiPageSwitchAnimation)
public:
DuiSceneWindow *sceneWindow;
protected:
DuiSceneWindow *newPage;
DuiSceneWindow *oldPage;
QPropertyAnimation *positionNewPageAnimation;
QPropertyAnimation *positionOldPageAnimation;
DuiPageSwitchAnimation::PageTransitionDirection direction;
};
#endif
| /***************************************************************************
**
** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
** All rights reserved.
** Contact: Nokia Corporation (directui@nokia.com)
**
** This file is part of libdui.
**
** If you have questions regarding the use of this file, please contact
** Nokia at directui@nokia.com.
**
** This library is free software; you can redistribute it and/or
** modify it under the terms of the GNU Lesser General Public
** License version 2.1 as published by the Free Software Foundation
** and appearing in the file LICENSE.LGPL included in the packaging
** of this file.
**
****************************************************************************/
#ifndef DUIPAGESWITCHANIMATION_P_H
#define DUIPAGESWITCHANIMATION_P_H
#include "duipageswitchanimation.h"
#include "duiparallelanimationgroup_p.h"
#include <QPointer>
class DuiSceneWindow;
class QPropertyAnimation;
class DuiPageSwitchAnimationPrivate : public DuiParallelAnimationGroupPrivate
{
Q_DECLARE_PUBLIC(DuiPageSwitchAnimation)
public:
DuiSceneWindow *sceneWindow;
protected:
QPointer<DuiSceneWindow> newPage;
QPointer<DuiSceneWindow> oldPage;
QPropertyAnimation *positionNewPageAnimation;
QPropertyAnimation *positionOldPageAnimation;
DuiPageSwitchAnimation::PageTransitionDirection direction;
};
#endif
|
Add nullability annotations to classes header | //
// ILGClasses.h
// Pods
//
// Created by Isaac Greenspan on 6/22/15.
//
//
#import <Foundation/Foundation.h>
typedef BOOL(^ILGClassesClassTestBlock)(__strong Class class);
@interface ILGClasses : NSObject
/**
* Get a set of all of the classes passing a given test.
*
* @param test The block with which to test each class
*
* @return A set of all of the classes passing the test
*/
+ (NSSet *)classesPassingTest:(ILGClassesClassTestBlock)test;
/**
* Get a set of all of the classes that are a subclass of the given class.
*
* Includes any class for which the given class is an ancestor, no matter how far back. Does not include the given
* class in the result.
*
* @param superclass The superclass to look for
*
* @return A set of all of the subclasses of the given class, including indirect subclasses.
*/
+ (NSSet *)subclassesOfClass:(Class)superclass;
/**
* Get a set of all of the classes that conform to the given protocol.
*
* @param protocol The protocol to look for
*
* @return A set of all of the classes that conform to the given protocol, as well as their direct and indirect subclasses.
*/
+ (NSSet *)classesConformingToProtocol:(Protocol *)protocol;
@end
| //
// ILGClasses.h
// Pods
//
// Created by Isaac Greenspan on 6/22/15.
//
//
#import <Foundation/Foundation.h>
NS_ASSUME_NONNULL_BEGIN
typedef BOOL(^ILGClassesClassTestBlock)(__strong Class class);
@interface ILGClasses : NSObject
/**
* Get a set of all of the classes passing a given test.
*
* @param test The block with which to test each class
*
* @return A set of all of the classes passing the test
*/
+ (NSSet<Class> *__nullable)classesPassingTest:(ILGClassesClassTestBlock)test;
/**
* Get a set of all of the classes that are a subclass of the given class.
*
* Includes any class for which the given class is an ancestor, no matter how far back. Does not include the given
* class in the result.
*
* @param superclass The superclass to look for
*
* @return A set of all of the subclasses of the given class, including indirect subclasses.
*/
+ (NSSet<Class> *__nullable)subclassesOfClass:(Class)superclass;
/**
* Get a set of all of the classes that conform to the given protocol.
*
* @param protocol The protocol to look for
*
* @return A set of all of the classes that conform to the given protocol, as well as their direct and indirect subclasses.
*/
+ (NSSet<Class> *__nullable)classesConformingToProtocol:(Protocol *)protocol;
NS_ASSUME_NONNULL_END
@end
|
Fix another const-decoration mismatch, per Magnus. | /*-------------------------------------------------------------------------
*
* schemacmds.h
* prototypes for schemacmds.c.
*
*
* Portions Copyright (c) 1996-2006, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
* $PostgreSQL: pgsql/src/include/commands/schemacmds.h,v 1.13 2006/03/05 15:58:55 momjian Exp $
*
*-------------------------------------------------------------------------
*/
#ifndef SCHEMACMDS_H
#define SCHEMACMDS_H
#include "nodes/parsenodes.h"
extern void CreateSchemaCommand(CreateSchemaStmt *parsetree);
extern void RemoveSchema(List *names, DropBehavior behavior, bool missing_ok);
extern void RemoveSchemaById(Oid schemaOid);
extern void RenameSchema(const char *oldname, const char *newname);
extern void AlterSchemaOwner(const char *name, Oid newOwnerId);
extern void AlterSchemaOwner_oid(const Oid schemaOid, Oid newOwnerId);
#endif /* SCHEMACMDS_H */
| /*-------------------------------------------------------------------------
*
* schemacmds.h
* prototypes for schemacmds.c.
*
*
* Portions Copyright (c) 1996-2006, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
* $PostgreSQL: pgsql/src/include/commands/schemacmds.h,v 1.14 2006/04/09 22:01:19 tgl Exp $
*
*-------------------------------------------------------------------------
*/
#ifndef SCHEMACMDS_H
#define SCHEMACMDS_H
#include "nodes/parsenodes.h"
extern void CreateSchemaCommand(CreateSchemaStmt *parsetree);
extern void RemoveSchema(List *names, DropBehavior behavior, bool missing_ok);
extern void RemoveSchemaById(Oid schemaOid);
extern void RenameSchema(const char *oldname, const char *newname);
extern void AlterSchemaOwner(const char *name, Oid newOwnerId);
extern void AlterSchemaOwner_oid(Oid schemaOid, Oid newOwnerId);
#endif /* SCHEMACMDS_H */
|
Check if sys/queue.h have STAILQ_ interface. At least OpenBSD's one does not... | #ifndef SX_SLENTRY_H_
#define SX_SLENTRY_H_
#if HAVE_SYS_QUEUE_H
#include <sys/queue.h>
#else
#include "sys_queue.h"
#endif
#if HAVE_SYS_TREE_H
#include <sys/tree.h>
#else
#include "sys_tree.h"
#endif
struct sx_slentry {
STAILQ_ENTRY(sx_slentry) next;
char* text;
};
struct sx_slentry* sx_slentry_new(char* text);
struct sx_tentry {
RB_ENTRY(sx_tentry) entry;
char* text;
};
struct sx_tentry* sx_tentry_new(char* text);
#endif
| #ifndef SX_SLENTRY_H_
#define SX_SLENTRY_H_
#if HAVE_SYS_QUEUE_H
#include <sys/queue.h>
/* OpenBSD-current as of 2015-08-30 does not define STAILQ_ENTRY anymore */
#ifndef STAILQ_ENTRY
#include "sys_queue.h"
#endif
#else
#include "sys_queue.h"
#endif
#if HAVE_SYS_TREE_H
#include <sys/tree.h>
#else
#include "sys_tree.h"
#endif
struct sx_slentry {
STAILQ_ENTRY(sx_slentry) next;
char* text;
};
struct sx_slentry* sx_slentry_new(char* text);
struct sx_tentry {
RB_ENTRY(sx_tentry) entry;
char* text;
};
struct sx_tentry* sx_tentry_new(char* text);
#endif
|
Move MBEDTLS_MD5_C from mbetdls_device.h to targets.json | /*
* mbedtls_device.h
*******************************************************************************
* Copyright (c) 2017, STMicroelectronics
* SPDX-License-Identifier: Apache-2.0
*
* 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 MBEDTLS_DEVICE_H
#define MBEDTLS_DEVICE_H
#define MBEDTLS_AES_ALT
#define MBEDTLS_SHA256_ALT
#define MBEDTLS_SHA1_ALT
#endif /* MBEDTLS_DEVICE_H */
| /*
* mbedtls_device.h
*******************************************************************************
* Copyright (c) 2017, STMicroelectronics
* SPDX-License-Identifier: Apache-2.0
*
* 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 MBEDTLS_DEVICE_H
#define MBEDTLS_DEVICE_H
#define MBEDTLS_AES_ALT
#define MBEDTLS_SHA256_ALT
#define MBEDTLS_SHA1_ALT
#define MBEDTLS_MD5_ALT
#define MBEDTLS_MD5_C
#endif /* MBEDTLS_DEVICE_H */
|
Fix C++ compilation on windows. | /* Copyright 1998, 2005 The Apache Software Foundation or its licensors, as applicable
*
* 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 EXCEPTIONS_H
#define EXCEPTIONS_H
#include <string.h>
#include "vmi.h"
void throwNewExceptionByName(JNIEnv* env,
const char* name, const char* message);
void throwNewOutOfMemoryError(JNIEnv* env, const char* message);
void throwJavaIoIOException(JNIEnv* env, const char* message);
void throwJavaIoIOExceptionClosed(JNIEnv* env);
void throwNPException(JNIEnv* env, const char* message);
void throwIndexOutOfBoundsException(JNIEnv* env);
#endif
| /* Copyright 1998, 2005 The Apache Software Foundation or its licensors, as applicable
*
* 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 EXCEPTIONS_H
#define EXCEPTIONS_H
#include <string.h>
#include "vmi.h"
#ifdef __cplusplus
extern "C" {
#endif
void throwNewExceptionByName(JNIEnv* env,
const char* name, const char* message);
void throwNewOutOfMemoryError(JNIEnv* env, const char* message);
void throwJavaIoIOException(JNIEnv* env, const char* message);
void throwJavaIoIOExceptionClosed(JNIEnv* env);
void throwNPException(JNIEnv* env, const char* message);
void throwIndexOutOfBoundsException(JNIEnv* env);
#ifdef __cplusplus
}
#endif
#endif
|
Make this header file self-contained | //===-- Transform/Utils/FunctionUtils.h - Function Utils --------*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
// This file was developed by the LLVM research group and is distributed under
// the University of Illinois Open Source License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
//
// This family of transformations manipulate LLVM functions.
//
//===----------------------------------------------------------------------===//
#ifndef LLVM_TRANSFORMS_UTILS_FUNCTION_H
#define LLVM_TRANSFORMS_UTILS_FUNCTION_H
namespace llvm {
class Function;
class Loop;
/// ExtractCodeRegion - rip out a sequence of basic blocks into a new function
///
Function* ExtractCodeRegion(const std::vector<BasicBlock*> &code);
/// ExtractLoop - rip out a natural loop into a new function
///
Function* ExtractLoop(Loop *L);
/// ExtractBasicBlock - rip out a basic block into a new function
///
Function* ExtractBasicBlock(BasicBlock *BB);
}
#endif
| //===-- Transform/Utils/FunctionUtils.h - Function Utils --------*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
// This file was developed by the LLVM research group and is distributed under
// the University of Illinois Open Source License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
//
// This family of transformations manipulate LLVM functions.
//
//===----------------------------------------------------------------------===//
#ifndef LLVM_TRANSFORMS_UTILS_FUNCTION_H
#define LLVM_TRANSFORMS_UTILS_FUNCTION_H
#include <vector>
namespace llvm {
class BasicBlock;
class Function;
class Loop;
/// ExtractCodeRegion - rip out a sequence of basic blocks into a new function
///
Function* ExtractCodeRegion(const std::vector<BasicBlock*> &code);
/// ExtractLoop - rip out a natural loop into a new function
///
Function* ExtractLoop(Loop *L);
/// ExtractBasicBlock - rip out a basic block into a new function
///
Function* ExtractBasicBlock(BasicBlock *BB);
}
#endif
|
Structure to hold cell energy data for a PHOS module | #ifndef ALIHLTPHOSNODULECELLENERGYDATA_H
#define ALIHLTPHOSNODULECELLENERGYDATA_H
struct AliHLTPHOSModuleCellEnergyData
{
AliHLTUInt8_t fModuleID;
unsigned long cellEnergies[64][56][2];
};
#endif
| |
Remove stale declaration of 'ia32_pre_transform_phase()'. | /*
* This file is part of libFirm.
* Copyright (C) 2012 University of Karlsruhe.
*/
/**
* @file
* @brief Implements several optimizations for IA32.
* @author Christian Wuerdig
*/
#ifndef FIRM_BE_IA32_IA32_OPTIMIZE_H
#define FIRM_BE_IA32_IA32_OPTIMIZE_H
#include "firm_types.h"
/**
* Prepares irg for codegeneration.
*/
void ia32_pre_transform_phase(ir_graph *irg);
/**
* Performs conv and address mode optimizations.
* @param cg The ia32 codegenerator object
*/
void ia32_optimize_graph(ir_graph *irg);
/**
* Performs Peephole Optimizations an a graph.
*
* @param irg the graph
* @param cg the code generator object
*/
void ia32_peephole_optimization(ir_graph *irg);
/** Initialize the ia32 address mode optimizer. */
void ia32_init_optimize(void);
#endif
| /*
* This file is part of libFirm.
* Copyright (C) 2012 University of Karlsruhe.
*/
/**
* @file
* @brief Implements several optimizations for IA32.
* @author Christian Wuerdig
*/
#ifndef FIRM_BE_IA32_IA32_OPTIMIZE_H
#define FIRM_BE_IA32_IA32_OPTIMIZE_H
#include "firm_types.h"
/**
* Performs conv and address mode optimizations.
* @param cg The ia32 codegenerator object
*/
void ia32_optimize_graph(ir_graph *irg);
/**
* Performs Peephole Optimizations an a graph.
*
* @param irg the graph
* @param cg the code generator object
*/
void ia32_peephole_optimization(ir_graph *irg);
/** Initialize the ia32 address mode optimizer. */
void ia32_init_optimize(void);
#endif
|
Add the missing PNaCl atomicops support. | // Protocol Buffers - Google's data interchange format
// Copyright 2012 Google Inc. All rights reserved.
// http://code.google.com/p/protobuf/
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above
// copyright notice, this list of conditions and the following disclaimer
// in the documentation and/or other materials provided with the
// distribution.
// * Neither the name of Google Inc. nor the names of its
// contributors may be used to endorse or promote products derived from
// this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// This file is an internal atomic implementation, use atomicops.h instead.
#ifndef GOOGLE_PROTOBUF_ATOMICOPS_INTERNALS_PNACL_H_
#define GOOGLE_PROTOBUF_ATOMICOPS_INTERNALS_PNACL_H_
namespace google {
namespace protobuf {
namespace internal {
inline Atomic32 NoBarrier_CompareAndSwap(volatile Atomic32* ptr,
Atomic32 old_value,
Atomic32 new_value) {
return __sync_val_compare_and_swap(ptr, old_value, new_value);
}
inline void MemoryBarrier() {
__sync_synchronize();
}
inline Atomic32 Acquire_CompareAndSwap(volatile Atomic32* ptr,
Atomic32 old_value,
Atomic32 new_value) {
Atomic32 ret = NoBarrier_CompareAndSwap(ptr, old_value, new_value);
MemoryBarrier();
return ret;
}
inline void Release_Store(volatile Atomic32* ptr, Atomic32 value) {
MemoryBarrier();
*ptr = value;
}
inline Atomic32 Acquire_Load(volatile const Atomic32* ptr) {
Atomic32 value = *ptr;
MemoryBarrier();
return value;
}
} // namespace internal
} // namespace protobuf
} // namespace google
#endif // GOOGLE_PROTOBUF_ATOMICOPS_INTERNALS_PNACL_H_
| |
Disable interrupts around bit operations; ok deraadt@ | /* $OpenBSD: atomic.h,v 1.2 2007/02/19 17:18:43 deraadt Exp $ */
/* Public Domain */
#ifndef __SPARC_ATOMIC_H__
#define __SPARC_ATOMIC_H__
#if defined(_KERNEL)
static __inline void
atomic_setbits_int(__volatile unsigned int *uip, unsigned int v)
{
*uip |= v;
}
static __inline void
atomic_clearbits_int(__volatile unsigned int *uip, unsigned int v)
{
*uip &= ~v;
}
#endif /* defined(_KERNEL) */
#endif /* __SPARC_ATOMIC_H__ */
| /* $OpenBSD: atomic.h,v 1.3 2007/04/27 19:22:47 miod Exp $ */
/* Public Domain */
#ifndef __SPARC_ATOMIC_H__
#define __SPARC_ATOMIC_H__
#if defined(_KERNEL)
static __inline void
atomic_setbits_int(__volatile unsigned int *uip, unsigned int v)
{
int psr;
psr = getpsr();
setpsr(psr | PSR_PIL);
*uip |= v;
setpsr(psr);
}
static __inline void
atomic_clearbits_int(__volatile unsigned int *uip, unsigned int v)
{
int psr;
psr = getpsr();
setpsr(psr | PSR_PIL);
*uip &= ~v;
setpsr(psr);
}
#endif /* defined(_KERNEL) */
#endif /* __SPARC_ATOMIC_H__ */
|
Modify the DISALLOW_COPY_AND_ASSIGN macro to use C++11's '= delete' syntax. | // Please don't add a copyright notice to this file. It contains source code
// owned by other copyright holders (used under license).
#ifndef BASE_MACROS_H_
#define BASE_MACROS_H_
// From Google C++ Style Guide
// http://google-styleguide.googlecode.com/svn/trunk/cppguide.xml
// Accessed February 8, 2013
//
// A macro to disallow the copy constructor and operator= functions
// This should be used in the private: declarations for a class
//
// TODO(dss): Use C++11's "= delete" syntax to suppress the creation of default
// class members.
#define DISALLOW_COPY_AND_ASSIGN(TypeName) \
TypeName(const TypeName&); \
void operator=(const TypeName&)
// Example from the Google C++ Style Guide:
//
// class Foo {
// public:
// Foo(int f);
// ~Foo();
//
// private:
// DISALLOW_COPY_AND_ASSIGN(Foo);
// };
// A macro to compute the number of elements in a statically allocated array.
#define ARRAYSIZE(a) (sizeof(a) / sizeof((a)[0]))
#endif // BASE_MACROS_H_
| // Please don't add a copyright notice to this file. It contains source code
// owned by other copyright holders (used under license).
#ifndef BASE_MACROS_H_
#define BASE_MACROS_H_
// A macro to disallow the copy constructor and operator= functions.
#define DISALLOW_COPY_AND_ASSIGN(TypeName) \
TypeName(const TypeName&) = delete; \
void operator=(const TypeName&) = delete
// A macro to compute the number of elements in a statically allocated array.
#define ARRAYSIZE(a) (sizeof(a) / sizeof((a)[0]))
#endif // BASE_MACROS_H_
|
Update current version 18. Described in tmcd/tmcd.c commit 1.232. | /*
* EMULAB-COPYRIGHT
* Copyright (c) 2000-2004 University of Utah and the Flux Group.
* All rights reserved.
*/
#define TBSERVER_PORT 7777
#define TBSERVER_PORT2 14447
#define MYBUFSIZE 2048
#define BOSSNODE_FILENAME "bossnode"
/*
* As the tmcd changes, incompatable changes with older version of
* the software cause problems. Starting with version 3, the client
* will tell tmcd what version they are. If no version is included,
* assume its DEFAULT_VERSION.
*
* Be sure to update the versions as the TMCD changes. Both the
* tmcc and tmcd have CURRENT_VERSION compiled in, so be sure to
* install new versions of each binary when the current version
* changes. libsetup.pm module also encodes a current version, so be
* sure to change it there too!
*
* Note, this is assumed to be an integer. No need for 3.23.479 ...
* NB: See ron/libsetup.pm. That is version 4! I'll merge that in.
*/
#define DEFAULT_VERSION 2
#define CURRENT_VERSION 17
| /*
* EMULAB-COPYRIGHT
* Copyright (c) 2000-2004 University of Utah and the Flux Group.
* All rights reserved.
*/
#define TBSERVER_PORT 7777
#define TBSERVER_PORT2 14447
#define MYBUFSIZE 2048
#define BOSSNODE_FILENAME "bossnode"
/*
* As the tmcd changes, incompatable changes with older version of
* the software cause problems. Starting with version 3, the client
* will tell tmcd what version they are. If no version is included,
* assume its DEFAULT_VERSION.
*
* Be sure to update the versions as the TMCD changes. Both the
* tmcc and tmcd have CURRENT_VERSION compiled in, so be sure to
* install new versions of each binary when the current version
* changes. libsetup.pm module also encodes a current version, so be
* sure to change it there too!
*
* Note, this is assumed to be an integer. No need for 3.23.479 ...
* NB: See ron/libsetup.pm. That is version 4! I'll merge that in.
*/
#define DEFAULT_VERSION 2
#define CURRENT_VERSION 18
|
Add test case revealing crash of Goblint due to call of library function via function pointer | #include <fcntl.h>
#include <unistd.h>
typedef void (*fnct_ptr)(void);
typedef int (*open_t)(const char*,int,int);
typedef int (*ftruncate_t)(int,off_t);
// Goblint used to crash on this example because the number of supplied arguments for myopen is bigger than
// than the expected number of arguments for the library function descriptior of ftruncate.
// -- "open" expects 3 arguments, while "ftruncate" expects only 2.
int main(){
fnct_ptr ptr;
int top;
if (top){
ptr = &open;
} else {
ptr = &ftruncate;
}
if (top) {
// Some (nonsensical, but compiling) call to open
open_t myopen;
myopen = (open_t) ptr;
myopen("some/path", O_CREAT, 0);
} else {
// Some (nonsensical, but compiling) call to ftruncate
ftruncate_t myftruncate;
myftruncate = (ftruncate_t) ptr;
myftruncate(0, 100);
}
return 0;
}
| |
Update MKR1300 board definition too | #define MICROPY_HW_BOARD_NAME "Arduino MKR1300"
#define MICROPY_HW_MCU_NAME "samd21g18"
#define MICROPY_PORT_A (PORT_PA24 | PORT_PA25)
#define MICROPY_PORT_B (0)
#define MICROPY_PORT_C (0)
#include "internal_flash.h"
#define CIRCUITPY_INTERNAL_NVM_SIZE 0
#define BOARD_FLASH_SIZE (0x00040000 - 0x2000 - 0x010000)
#define DEFAULT_I2C_BUS_SCL (&pin_PA09)
#define DEFAULT_I2C_BUS_SDA (&pin_PA08)
#define DEFAULT_SPI_BUS_SCK (&pin_PA13)
#define DEFAULT_SPI_BUS_MOSI (&pin_PA12)
#define DEFAULT_SPI_BUS_MISO (&pin_PA15)
#define DEFAULT_UART_BUS_RX (&pin_PB23)
#define DEFAULT_UART_BUS_TX (&pin_PB22)
// USB is always used internally so skip the pin objects for it.
#define IGNORE_PIN_PA24 1
#define IGNORE_PIN_PA25 1
| #define MICROPY_HW_BOARD_NAME "Arduino MKR1300"
#define MICROPY_HW_MCU_NAME "samd21g18"
#define MICROPY_PORT_A (0)
#define MICROPY_PORT_B (0)
#define MICROPY_PORT_C (0)
#define CIRCUITPY_INTERNAL_NVM_SIZE 0
#define BOARD_FLASH_SIZE (0x00040000 - 0x2000 - 0x010000)
#define DEFAULT_I2C_BUS_SCL (&pin_PA09)
#define DEFAULT_I2C_BUS_SDA (&pin_PA08)
#define DEFAULT_SPI_BUS_SCK (&pin_PA13)
#define DEFAULT_SPI_BUS_MOSI (&pin_PA12)
#define DEFAULT_SPI_BUS_MISO (&pin_PA15)
#define DEFAULT_UART_BUS_RX (&pin_PB23)
#define DEFAULT_UART_BUS_TX (&pin_PB22)
// USB is always used internally so skip the pin objects for it.
#define IGNORE_PIN_PA24 1
#define IGNORE_PIN_PA25 1
|
Update for compatibility with multiple FS | /*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
#include <fs/fs.h>
#include <fs/fs_if.h>
#include "fs_priv.h"
int
fs_rename(const char *from, const char *to)
{
struct fs_ops *fops = safe_fs_ops_for("fatfs");
return fops->f_rename(from, to);
}
int
fs_mkdir(const char *path)
{
struct fs_ops *fops = safe_fs_ops_for("fatfs");
return fops->f_mkdir(path);
}
| /*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
#include <fs/fs.h>
#include <fs/fs_if.h>
#include "fs_priv.h"
struct fs_ops *fops_from_filename(const char *);
int
fs_rename(const char *from, const char *to)
{
struct fs_ops *fops = fops_from_filename(from);
return fops->f_rename(from, to);
}
int
fs_mkdir(const char *path)
{
struct fs_ops *fops = fops_from_filename(path);
return fops->f_mkdir(path);
}
|
Add functions to disable and restore interrupts | /* CMSIS-DAP Interface Firmware
* Copyright (c) 2009-2013 ARM Limited
*
* 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 CORTEX_M_H
#define CORTEX_M_H
#include <stdint.h>
typedef int cortex_int_state_t;
__attribute__((always_inline))
static cortex_int_state_t cortex_int_get_and_disable(void)
{
cortex_int_state_t state;
state = __disable_irq();
return state;
}
__attribute__((always_inline))
static void cortex_int_restore(cortex_int_state_t state)
{
if (!state) {
__enable_irq();
}
}
#endif
| |
Include the newly added json-enum-types.h header | #ifndef __JSON_GLIB_H__
#define __JSON_GLIB_H__
#include <json-glib/json-types.h>
#include <json-glib/json-scanner.h>
#include <json-glib/json-generator.h>
#include <json-glib/json-parser.h>
#include <json-glib/json-version.h>
#endif /* __JSON_GLIB_H__ */
| #ifndef __JSON_GLIB_H__
#define __JSON_GLIB_H__
#include <json-glib/json-types.h>
#include <json-glib/json-scanner.h>
#include <json-glib/json-generator.h>
#include <json-glib/json-parser.h>
#include <json-glib/json-version.h>
#include <json-glib/json-enum-types.h>
#endif /* __JSON_GLIB_H__ */
|
Add string constants and reorganize defaults | #pragma once
#include "MeterWnd/Animations/AnimationTypes.h"
#include "Settings.h"
class SettingsDefaults {
public:
/* Default settings */
static const bool OnTop = true;
static const AnimationTypes::HideAnimation DefaultHideAnim
= AnimationTypes::Fade;
static const bool HideFullscreen = false;
static const bool HideDirectX = false;
static const int HideSpeed = 765;
static const int HideTime = 800;
static constexpr const float VolumeLimit = 1.0f;
static const bool NotifyIcon = true;
static const bool ShowOnStartup = true;
static const bool SoundsEnabled = true;
static const int OSDOffset = 140;
static const Settings::OSDPos OSDPosition = Settings::OSDPos::Bottom;
static const bool AutoUpdate = false;
static const bool MuteLock = false;
static const bool SubscribeVolumeEvents = true;
static const bool SubscribeEjectEvents = true;
static const bool VolumeOSDEnabled = true;
static const bool EjectOSDEnabled = true;
static const bool BrightnessOSDEnabled = true;
static const bool KeyboardOSDEnabled = false;
}; | #pragma once
#include "MeterWnd/Animations/AnimationTypes.h"
#include "Settings.h"
class SettingsDefaults {
public:
/* String Constants*/
static constexpr const wchar_t *Language = L"English";
static constexpr const wchar_t *Skin = L"Classic";
static constexpr const wchar_t *MainAppName = L"3RVX.exe";
static constexpr const wchar_t *SettingsAppName = L"Settings.exe";
static constexpr const wchar_t *SettingsFileName = L"Settings.xml";
static constexpr const wchar_t *LanguageDirName = L"Languages";
static constexpr const wchar_t *SkinDirName = L"Skins";
static constexpr const wchar_t *SkinFileName = L"Skin.xml";
/* OSDs */
static const bool VolumeOSDEnabled = true;
static const bool EjectOSDEnabled = true;
static const bool BrightnessOSDEnabled = true;
static const bool KeyboardOSDEnabled = false;
static const bool OnTop = true;
static const bool HideFullscreen = false;
static const bool HideDirectX = false;
static const AnimationTypes::HideAnimation DefaultHideAnim
= AnimationTypes::Fade;
static const int HideSpeed = 765;
static const int HideTime = 800;
static constexpr const float VolumeLimit = 1.0f;
static const bool NotifyIcon = true;
static const bool ShowOnStartup = true;
static const bool SoundsEnabled = true;
static const int OSDOffset = 140;
static const Settings::OSDPos OSDPosition = Settings::OSDPos::Bottom;
static const bool AutoUpdate = false;
static const bool MuteLock = false;
static const bool SubscribeVolumeEvents = true;
static const bool SubscribeEjectEvents = true;
}; |
Add a single header file with everything needed by generated stubs. | /*
* Copyright (c) 2014 Jeremy Yallop.
*
* This file is distributed under the terms of the MIT License.
* See the file LICENSE for details.
*/
#ifndef CSTUBS_INTERNALS_H
#define CSTUBS_INTERNALS_H
/* Types and functions used by generated C code. */
#include "ctypes/primitives.h"
#include "ctypes/complex_stubs.h"
#include "ctypes/raw_pointer.h"
#include "ctypes/managed_buffer_stubs.h"
#endif /* CSTUBS_INTERNALS_H */
| |
Add xstrdup as a convenience macro around xstrndup | #ifndef MEM_H__
#define MEM_H__
#include <stdlib.h>
#include "ocomm/o_log.h"
void *xmalloc (size_t size);
void *xcalloc (size_t count, size_t size);
void *xrealloc (void *ptr, size_t size);
size_t xmalloc_usable_size(void *ptr);
char *xstralloc (size_t len);
void *xmemdupz (const void *data, size_t len);
char *xstrndup (const char *str, size_t len);
void xfree (void *ptr);
size_t xmembytes();
size_t xmemnew();
size_t xmemfreed();
char *xmemsummary ();
void xmemreport (int loglevel);
#endif /* MEM_H__ */
/*
Local Variables:
mode: C
tab-width: 2
indent-tabs-mode: nil
End:
vim: sw=2:sts=2:expandtab
*/
| #ifndef MEM_H__
#define MEM_H__
#include <stdlib.h>
#include "ocomm/o_log.h"
void *xmalloc (size_t size);
void *xcalloc (size_t count, size_t size);
void *xrealloc (void *ptr, size_t size);
size_t xmalloc_usable_size(void *ptr);
char *xstralloc (size_t len);
void *xmemdupz (const void *data, size_t len);
char *xstrndup (const char *str, size_t len);
void xfree (void *ptr);
size_t xmembytes();
size_t xmemnew();
size_t xmemfreed();
char *xmemsummary ();
void xmemreport (int loglevel);
/* Duplicate nil-terminated string
*
* \param str string to copy in the new xchunk
* \return the newly allocated xchunk, or NULL
* \see xstrndup
* \see strndup(3), strlen(3)
*/
#define xstrdup(str) xstrndup((str), strlen((str)))
#endif /* MEM_H__ */
/*
Local Variables:
mode: C
tab-width: 2
indent-tabs-mode: nil
End:
vim: sw=2:sts=2:expandtab
*/
|
Remove another obsolete function declaration. | /*
* Copyright (c) 2013 Jeremy Yallop.
*
* This file is distributed under the terms of the MIT License.
* See the file LICENSE for details.
*/
#ifndef TYPE_INFO_STUBS_H
#define TYPE_INFO_STUBS_H
#include <caml/mlvalues.h>
#include <caml/fail.h>
#include <caml/callback.h>
/* allocate_unpassable_struct_type_info : (size, alignment) -> _ ctype */
value ctypes_allocate_unpassable_struct_type_info(int size, int alignment);
/* Read a C value from a block of memory */
/* read : 'a prim -> offset:int -> raw_pointer -> 'a */
extern value ctypes_read(value ctype, value offset, value buffer);
/* Write a C value to a block of memory */
/* write : 'a prim -> offset:int -> 'a -> raw_pointer -> unit */
extern value ctypes_write(value ctype, value offset, value v, value buffer);
#endif /* TYPE_INFO_STUBS_H */
| /*
* Copyright (c) 2013 Jeremy Yallop.
*
* This file is distributed under the terms of the MIT License.
* See the file LICENSE for details.
*/
#ifndef TYPE_INFO_STUBS_H
#define TYPE_INFO_STUBS_H
#include <caml/mlvalues.h>
/* Read a C value from a block of memory */
/* read : 'a prim -> offset:int -> raw_pointer -> 'a */
extern value ctypes_read(value ctype, value offset, value buffer);
/* Write a C value to a block of memory */
/* write : 'a prim -> offset:int -> 'a -> raw_pointer -> unit */
extern value ctypes_write(value ctype, value offset, value v, value buffer);
#endif /* TYPE_INFO_STUBS_H */
|
Add the ability to get Colliders from SImplePhysics | #pragma once
#include "../IFactory.h"
#include "../ISystem.h"
#include <string>
#include <vector>
#include <map>
#include "../AABBTree.h"
class Property;
class IMoverComponent;
class SimplePhysics
: public Sigma::IFactory, public ISystem<IMoverComponent> {
public:
SimplePhysics() { }
~SimplePhysics() { };
/**
* \brief Starts the Simple Physics system.
*
* \return bool Returns false on startup failure.
*/
bool Start() { }
/**
* \brief Causes an update in the system based on the change in time.
*
* Updates the state of the system based off how much time has elapsed since the last update.
* \param[in] const float delta The change in time since the last update
* \return bool Returns true if we had an update interval passed.
*/
bool Update(const double delta);
std::map<std::string,FactoryFunction> getFactoryFunctions();
void createPhysicsMover(const unsigned int entityID, std::vector<Property> &properties) ;
void createViewMover(const unsigned int entityID, std::vector<Property> &properties) ;
void createAABBTree(const unsigned int entityID, std::vector<Property> &properties) ;
private:
std::map<unsigned int, Sigma::AABBTree*> colliders;
};
| #pragma once
#include "../IFactory.h"
#include "../ISystem.h"
#include <string>
#include <vector>
#include <map>
#include "../AABBTree.h"
class Property;
class IMoverComponent;
class SimplePhysics
: public Sigma::IFactory, public ISystem<IMoverComponent> {
public:
SimplePhysics() { }
~SimplePhysics() { };
/**
* \brief Starts the Simple Physics system.
*
* \return bool Returns false on startup failure.
*/
bool Start() { }
/**
* \brief Causes an update in the system based on the change in time.
*
* Updates the state of the system based off how much time has elapsed since the last update.
* \param[in] const float delta The change in time since the last update
* \return bool Returns true if we had an update interval passed.
*/
bool Update(const double delta);
std::map<std::string,FactoryFunction> getFactoryFunctions();
void createPhysicsMover(const unsigned int entityID, std::vector<Property> &properties) ;
void createViewMover(const unsigned int entityID, std::vector<Property> &properties) ;
void createAABBTree(const unsigned int entityID, std::vector<Property> &properties) ;
Sigma::AABBTree* GetCollider(const unsigned int entityID) {
if (this->colliders.find(entityID) != this->colliders.end()) {
return this->colliders[entityID];
}
return nullptr;
}
private:
std::map<unsigned int, Sigma::AABBTree*> colliders;
};
|
Update compile code for 4-pion analysis | #pragma link off all globals;
#pragma link off all classes;
#pragma link off all functions;
#pragma link C++ class AliChaoticity+;
#pragma link C++ class AliThreePionRadii+;
#pragma link C++ class AliChaoticityEventCollection+;
#pragma link C++ class AliChaoticityEventStruct+;
#pragma link C++ class AliChaoticityTrackStruct+;
#pragma link C++ class AliChaoticityMCStruct+;
#pragma link C++ class AliChaoticityPairStruct+;
#pragma link C++ class AliChaoticityNormPairStruct+;
| #pragma link off all globals;
#pragma link off all classes;
#pragma link off all functions;
#pragma link C++ class AliChaoticity+;
#pragma link C++ class AliThreePionRadii+;
#pragma link C++ class AliChaoticityEventCollection+;
#pragma link C++ class AliChaoticityEventStruct+;
#pragma link C++ class AliChaoticityTrackStruct+;
#pragma link C++ class AliChaoticityMCStruct+;
#pragma link C++ class AliChaoticityPairStruct+;
#pragma link C++ class AliChaoticityNormPairStruct+;
#pragma link C++ class AliFourPion+;
#pragma link C++ class AliFourPionEventCollection+;
#pragma link C++ class AliFourPionEventStruct+;
#pragma link C++ class AliFourPionTrackStruct+;
#pragma link C++ class AliFourPionMCStruct+;
|
Add prototype of MODBUSException function | #include "modlib.h"
#include "parser.h"
#include "exception.h"
//Types
typedef struct
{
uint8_t Length; //Length of frame, if it's equal to 0, frame is not ready
uint8_t *Frame; //Response frame content
} MODBUSResponseStatus; //Type containing information about frame that is set up at slave side
typedef struct
{
uint8_t Address;
uint16_t *Registers;
uint16_t RegisterCount;
MODBUSResponseStatus Response;
} MODBUSSlaveStatus; //Type containing slave device configuration data
//Variables definitions
extern MODBUSSlaveStatus MODBUSSlave; //Slave configuration
//Function prototypes
extern void MODBUSParseRequest( uint8_t *, uint8_t ); //Parse and interpret given modbus frame on slave-side
extern void MODBUSSlaveInit( uint8_t, uint16_t *, uint16_t ); //Very basic init of slave side
| #include "modlib.h"
#include "parser.h"
#include "exception.h"
//Types
typedef struct
{
uint8_t Length; //Length of frame, if it's equal to 0, frame is not ready
uint8_t *Frame; //Response frame content
} MODBUSResponseStatus; //Type containing information about frame that is set up at slave side
typedef struct
{
uint8_t Address;
uint16_t *Registers;
uint16_t RegisterCount;
MODBUSResponseStatus Response;
} MODBUSSlaveStatus; //Type containing slave device configuration data
//Variables definitions
extern MODBUSSlaveStatus MODBUSSlave; //Slave configuration
//Function prototypes
extern void MODBUSException( uint8_t, uint8_t ); //Generate exception response to response frame buffer
extern void MODBUSParseRequest( uint8_t *, uint8_t ); //Parse and interpret given modbus frame on slave-side
extern void MODBUSSlaveInit( uint8_t, uint16_t *, uint16_t ); //Very basic init of slave side
|
Revert "posix/osx: fix type conflict on OSX native" | /*
* Copyright (C) 2015 Martine Lenders <mlenders@inf.fu-berlin.de>
*
* 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.
*/
/**
* @addtogroup posix_sockets
*/
/**
* @{
*
* @file
* @brief System-internal byte operations.
*
* @author Martine Lenders <mlenders@inf.fu-berlin.de>
*/
#ifndef SYS_BYTES_H
#define SYS_BYTES_H
#include <stddef.h>
#include "byteorder.h"
#ifdef __cplusplus
extern "C" {
#endif
#ifndef __MACH__
typedef size_t socklen_t; /**< socket address length */
#else
/* Defined for OSX with a different type */
typedef __darwin_socklen_t socklen_t; /**< socket address length */
#endif
#ifdef __cplusplus
}
#endif
#endif /* SYS_BYTES_H */
/** @} */
| /*
* Copyright (C) 2015 Martine Lenders <mlenders@inf.fu-berlin.de>
*
* 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.
*/
/**
* @addtogroup posix_sockets
*/
/**
* @{
*
* @file
* @brief System-internal byte operations.
*
* @author Martine Lenders <mlenders@inf.fu-berlin.de>
*/
#ifndef SYS_BYTES_H
#define SYS_BYTES_H
#include <stddef.h>
#include "byteorder.h"
#ifdef __cplusplus
extern "C" {
#endif
typedef size_t socklen_t; /**< socket address length */
#ifdef __cplusplus
}
#endif
#endif /* SYS_BYTES_H */
/** @} */
|
Fix "storage size of 'timer' isn't known" on Debian Squeeze | #include <stdio.h>
#include <ruby.h>
#include <ruby/encoding.h>
static VALUE
profiler_start(VALUE module, VALUE usec)
{
struct itimerval timer;
timer.it_interval.tv_sec = 0;
timer.it_interval.tv_usec = NUM2LONG(usec);
timer.it_value = timer.it_interval;
setitimer(ITIMER_PROF, &timer, 0);
return Qnil;
}
static VALUE
profiler_stop(VALUE module)
{
struct itimerval timer;
memset(&timer, 0, sizeof(timer));
setitimer(ITIMER_PROF, &timer, 0);
return Qnil;
}
static VALUE
rb_profile_block(VALUE module, VALUE usec)
{
rb_need_block();
profiler_start(module, usec);
rb_yield(Qundef);
profiler_stop(module);
return Qnil;
}
void Init_fast_stack( void )
{
VALUE rb_mFastStack = rb_define_module("FastStack");
rb_define_module_function(rb_mFastStack, "profile_block", rb_profile_block, 1);
}
| #include <stdio.h>
#include <sys/time.h>
#include <ruby.h>
#include <ruby/encoding.h>
static VALUE
profiler_start(VALUE module, VALUE usec)
{
struct itimerval timer;
timer.it_interval.tv_sec = 0;
timer.it_interval.tv_usec = NUM2LONG(usec);
timer.it_value = timer.it_interval;
setitimer(ITIMER_PROF, &timer, 0);
return Qnil;
}
static VALUE
profiler_stop(VALUE module)
{
struct itimerval timer;
memset(&timer, 0, sizeof(timer));
setitimer(ITIMER_PROF, &timer, 0);
return Qnil;
}
static VALUE
rb_profile_block(VALUE module, VALUE usec)
{
rb_need_block();
profiler_start(module, usec);
rb_yield(Qundef);
profiler_stop(module);
return Qnil;
}
void Init_fast_stack( void )
{
VALUE rb_mFastStack = rb_define_module("FastStack");
rb_define_module_function(rb_mFastStack, "profile_block", rb_profile_block, 1);
}
|
Add extension 'Minimize new Tabs' | /*
Copyright (C) 2008-2010 Christian Dywan <christian@twotoasts.de>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
See the file COPYING for the full license text.
*/
#include <midori/midori.h>
#include <midori/sokoke.h>
static void
tabs_minimized_app_add_browser_cb (MidoriApp* app,
MidoriBrowser* browser,
MidoriExtension* extension);
static void
tabs_minimized_deactivate_cb (MidoriExtension* extension,
MidoriBrowser* browser)
{
MidoriApp* app = midori_extension_get_app (extension);
g_signal_handlers_disconnect_by_func (
extension, tabs_minimized_deactivate_cb, browser);
g_signal_handlers_disconnect_by_func (
app, tabs_minimized_app_add_browser_cb, extension);
}
static void
tabs_minimized_add_tab_cb (MidoriApp* app,
MidoriView* tab,
MidoriExtension* extension)
{
g_object_set (tab, "minimized", TRUE, NULL);
}
static void
tabs_minimized_app_add_browser_cb (MidoriApp* app,
MidoriBrowser* browser,
MidoriExtension* extension)
{
g_signal_connect (browser, "add-tab",
G_CALLBACK (tabs_minimized_add_tab_cb), extension);
g_signal_connect (extension, "deactivate",
G_CALLBACK (tabs_minimized_deactivate_cb), browser);
}
static void
tabs_minimized_activate_cb (MidoriExtension* extension,
MidoriApp* app)
{
KatzeArray* browsers;
MidoriBrowser* browser;
guint i;
browsers = katze_object_get_object (app, "browsers");
i = 0;
while ((browser = katze_array_get_nth_item (browsers, i++)))
tabs_minimized_app_add_browser_cb (app, browser, extension);
g_object_unref (browsers);
g_signal_connect (app, "add-browser",
G_CALLBACK (tabs_minimized_app_add_browser_cb), extension);
}
MidoriExtension*
extension_init (void)
{
MidoriExtension* extension = g_object_new (MIDORI_TYPE_EXTENSION,
"name", _("Minimize new Tabs"),
"description", _("New tabs open minimized"),
"version", "0.1",
"authors", "MonkeyOfDoom <pixelmonkey@ensellitis.com>",
NULL);
g_signal_connect (extension, "activate",
G_CALLBACK (tabs_minimized_activate_cb), NULL);
return extension;
}
| |
Return NULL in case of the dummy XML parser | /*
*
* BlueZ - Bluetooth protocol stack for Linux
*
* Copyright (C) 2005-2006 Marcel Holtmann <marcel@holtmann.org>
*
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*
*/
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include <stdio.h>
#include <errno.h>
#include "logging.h"
#include "sdp-xml.h"
sdp_record_t *sdp_xml_parse_record(const char *data, int size)
{
error("No XML parser available");
return -1;
}
| /*
*
* BlueZ - Bluetooth protocol stack for Linux
*
* Copyright (C) 2005-2006 Marcel Holtmann <marcel@holtmann.org>
*
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*
*/
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
#include <stdio.h>
#include <errno.h>
#include "logging.h"
#include "sdp-xml.h"
sdp_record_t *sdp_xml_parse_record(const char *data, int size)
{
error("No XML parser available");
return NULL;
}
|
Fix build breakage caused by memory leaks in llvm-c-test | /*===-- object.c - tool for testing libLLVM and llvm-c API ----------------===*\
|* *|
|* The LLVM Compiler Infrastructure *|
|* *|
|* This file is distributed under the University of Illinois Open Source *|
|* License. See LICENSE.TXT for details. *|
|* *|
|*===----------------------------------------------------------------------===*|
|* *|
|* This file implements the --add-named-metadata-operand and --set-metadata *|
|* commands in llvm-c-test. *|
|* *|
\*===----------------------------------------------------------------------===*/
#include "llvm-c-test.h"
#include "llvm-c/Core.h"
int add_named_metadata_operand(void) {
LLVMModuleRef m = LLVMModuleCreateWithName("Mod");
LLVMValueRef values[] = { LLVMConstInt(LLVMInt32Type(), 0, 0) };
// This used to trigger an assertion
LLVMAddNamedMetadataOperand(m, "name", LLVMMDNode(values, 1));
return 0;
}
int set_metadata(void) {
LLVMBuilderRef b = LLVMCreateBuilder();
LLVMValueRef values[] = { LLVMConstInt(LLVMInt32Type(), 0, 0) };
// This used to trigger an assertion
LLVMSetMetadata(
LLVMBuildRetVoid(b),
LLVMGetMDKindID("kind", 4),
LLVMMDNode(values, 1));
return 0;
}
| /*===-- object.c - tool for testing libLLVM and llvm-c API ----------------===*\
|* *|
|* The LLVM Compiler Infrastructure *|
|* *|
|* This file is distributed under the University of Illinois Open Source *|
|* License. See LICENSE.TXT for details. *|
|* *|
|*===----------------------------------------------------------------------===*|
|* *|
|* This file implements the --add-named-metadata-operand and --set-metadata *|
|* commands in llvm-c-test. *|
|* *|
\*===----------------------------------------------------------------------===*/
#include "llvm-c-test.h"
#include "llvm-c/Core.h"
int add_named_metadata_operand(void) {
LLVMModuleRef m = LLVMModuleCreateWithName("Mod");
LLVMValueRef values[] = { LLVMConstInt(LLVMInt32Type(), 0, 0) };
// This used to trigger an assertion
LLVMAddNamedMetadataOperand(m, "name", LLVMMDNode(values, 1));
LLVMDisposeModule(m);
return 0;
}
int set_metadata(void) {
LLVMBuilderRef b = LLVMCreateBuilder();
LLVMValueRef values[] = { LLVMConstInt(LLVMInt32Type(), 0, 0) };
// This used to trigger an assertion
LLVMSetMetadata(
LLVMBuildRetVoid(b),
LLVMGetMDKindID("kind", 4),
LLVMMDNode(values, 1));
LLVMDisposeBuilder(b);
return 0;
}
|
Add octApron test for special globals invalidation | // SKIP PARAM: --sets ana.activated[+] octApron
#include <assert.h>
extern void magic();
int g;
int h;
void main() {
int r, x;
x = r;
g = r;
h = r + 1;
assert(g < h);
magic(); // invalidates (forgets) globals
assert(g < h); // UNKNOWN!
assert(x == r); // shouldn't forget locals
}
| |
Synchronize the mailbox after expunging messages to actually get them expunged. | /* Copyright (c) 2002-2008 Dovecot authors, see the included COPYING file */
#include "common.h"
#include "commands.h"
#include "imap-expunge.h"
bool cmd_close(struct client_command_context *cmd)
{
struct client *client = cmd->client;
struct mailbox *mailbox = client->mailbox;
struct mail_storage *storage;
if (!client_verify_open_mailbox(cmd))
return TRUE;
storage = mailbox_get_storage(mailbox);
client->mailbox = NULL;
if (!imap_expunge(mailbox, NULL))
client_send_untagged_storage_error(client, storage);
if (mailbox_close(&mailbox) < 0)
client_send_untagged_storage_error(client, storage);
client_update_mailbox_flags(client, NULL);
client_send_tagline(cmd, "OK Close completed.");
return TRUE;
}
| /* Copyright (c) 2002-2008 Dovecot authors, see the included COPYING file */
#include "common.h"
#include "commands.h"
#include "imap-expunge.h"
bool cmd_close(struct client_command_context *cmd)
{
struct client *client = cmd->client;
struct mailbox *mailbox = client->mailbox;
struct mail_storage *storage;
if (!client_verify_open_mailbox(cmd))
return TRUE;
storage = mailbox_get_storage(mailbox);
client->mailbox = NULL;
if (!imap_expunge(mailbox, NULL))
client_send_untagged_storage_error(client, storage);
else if (mailbox_sync(mailbox, 0, 0, NULL) < 0)
client_send_untagged_storage_error(client, storage);
if (mailbox_close(&mailbox) < 0)
client_send_untagged_storage_error(client, storage);
client_update_mailbox_flags(client, NULL);
client_send_tagline(cmd, "OK Close completed.");
return TRUE;
}
|
Split C++ statements out to their own file. | //===--- StmtCXX.h - Classes for representing C++ statements ----*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
//
// This file defines the C++ statement AST node classes.
//
//===----------------------------------------------------------------------===//
#ifndef LLVM_CLANG_AST_STMTCXX_H
#define LLVM_CLANG_AST_STMTCXX_H
#include "clang/AST/Stmt.h"
namespace clang {
/// CXXCatchStmt - This represents a C++ catch block.
///
class CXXCatchStmt : public Stmt {
SourceLocation CatchLoc;
/// The exception-declaration of the type.
Decl *ExceptionDecl;
/// The handler block.
Stmt *HandlerBlock;
public:
CXXCatchStmt(SourceLocation catchLoc, Decl *exDecl, Stmt *handlerBlock)
: Stmt(CXXCatchStmtClass), CatchLoc(catchLoc), ExceptionDecl(exDecl),
HandlerBlock(handlerBlock) {}
virtual void Destroy(ASTContext& Ctx);
virtual SourceRange getSourceRange() const {
return SourceRange(CatchLoc, HandlerBlock->getLocEnd());
}
Decl *getExceptionDecl() { return ExceptionDecl; }
QualType getCaughtType();
Stmt *getHandlerBlock() { return HandlerBlock; }
static bool classof(const Stmt *T) {
return T->getStmtClass() == CXXCatchStmtClass;
}
static bool classof(const CXXCatchStmt *) { return true; }
virtual child_iterator child_begin();
virtual child_iterator child_end();
};
/// CXXTryStmt - A C++ try block, including all handlers.
///
class CXXTryStmt : public Stmt {
SourceLocation TryLoc;
// First place is the guarded CompoundStatement. Subsequent are the handlers.
// More than three handlers should be rare.
llvm::SmallVector<Stmt*, 4> Stmts;
public:
CXXTryStmt(SourceLocation tryLoc, Stmt *tryBlock,
Stmt **handlers, unsigned numHandlers);
virtual SourceRange getSourceRange() const {
return SourceRange(TryLoc, Stmts.back()->getLocEnd());
}
CompoundStmt *getTryBlock() { return llvm::cast<CompoundStmt>(Stmts[0]); }
const CompoundStmt *getTryBlock() const {
return llvm::cast<CompoundStmt>(Stmts[0]);
}
unsigned getNumHandlers() const { return Stmts.size() - 1; }
CXXCatchStmt *getHandler(unsigned i) {
return llvm::cast<CXXCatchStmt>(Stmts[i + 1]);
}
const CXXCatchStmt *getHandler(unsigned i) const {
return llvm::cast<CXXCatchStmt>(Stmts[i + 1]);
}
static bool classof(const Stmt *T) {
return T->getStmtClass() == CXXTryStmtClass;
}
static bool classof(const CXXTryStmt *) { return true; }
virtual child_iterator child_begin();
virtual child_iterator child_end();
};
} // end namespace clang
#endif
| |
Include image view category in framework header. | //
// ContentfulDeliveryAPI.h
// ContentfulSDK
//
// Created by Boris Bügling on 04/03/14.
//
//
#import <Foundation/Foundation.h>
#import <ContentfulDeliveryAPI/CDAArray.h>
#import <ContentfulDeliveryAPI/CDAAsset.h>
#import <ContentfulDeliveryAPI/CDAClient.h>
#import <ContentfulDeliveryAPI/CDAConfiguration.h>
#import <ContentfulDeliveryAPI/CDAContentType.h>
#import <ContentfulDeliveryAPI/CDAEntry.h>
#import <ContentfulDeliveryAPI/CDAField.h>
#import <ContentfulDeliveryAPI/CDAPersistenceManager.h>
#import <ContentfulDeliveryAPI/CDARequest.h>
#import <ContentfulDeliveryAPI/CDAResponse.h>
#import <ContentfulDeliveryAPI/CDASpace.h>
#import <ContentfulDeliveryAPI/CDASyncedSpace.h>
#if TARGET_OS_IPHONE
#import <ContentfulDeliveryAPI/CDAEntriesViewController.h>
#import <ContentfulDeliveryAPI/CDAFieldsViewController.h>
#import <ContentfulDeliveryAPI/CDAMapViewController.h>
#import <ContentfulDeliveryAPI/CDAResourceCell.h>
#import <ContentfulDeliveryAPI/CDAResourcesCollectionViewController.h>
#import <ContentfulDeliveryAPI/CDAResourcesViewController.h>
#endif
extern NSString* const CDAErrorDomain;
| //
// ContentfulDeliveryAPI.h
// ContentfulSDK
//
// Created by Boris Bügling on 04/03/14.
//
//
#import <Foundation/Foundation.h>
#import <ContentfulDeliveryAPI/CDAArray.h>
#import <ContentfulDeliveryAPI/CDAAsset.h>
#import <ContentfulDeliveryAPI/CDAClient.h>
#import <ContentfulDeliveryAPI/CDAConfiguration.h>
#import <ContentfulDeliveryAPI/CDAContentType.h>
#import <ContentfulDeliveryAPI/CDAEntry.h>
#import <ContentfulDeliveryAPI/CDAField.h>
#import <ContentfulDeliveryAPI/CDAPersistenceManager.h>
#import <ContentfulDeliveryAPI/CDARequest.h>
#import <ContentfulDeliveryAPI/CDAResponse.h>
#import <ContentfulDeliveryAPI/CDASpace.h>
#import <ContentfulDeliveryAPI/CDASyncedSpace.h>
#if TARGET_OS_IPHONE
#import <ContentfulDeliveryAPI/CDAEntriesViewController.h>
#import <ContentfulDeliveryAPI/CDAFieldsViewController.h>
#import <ContentfulDeliveryAPI/CDAMapViewController.h>
#import <ContentfulDeliveryAPI/CDAResourceCell.h>
#import <ContentfulDeliveryAPI/CDAResourcesCollectionViewController.h>
#import <ContentfulDeliveryAPI/CDAResourcesViewController.h>
#import <ContentfulDeliveryAPI/UIImageView+CDAAsset.h>
#endif
extern NSString* const CDAErrorDomain;
|
Update driver version to 5.02.00-k1 | /*
* QLogic iSCSI HBA Driver
* Copyright (c) 2003-2006 QLogic Corporation
*
* See LICENSE.qla4xxx for copyright and licensing details.
*/
#define QLA4XXX_DRIVER_VERSION "5.01.00-k9"
| /*
* QLogic iSCSI HBA Driver
* Copyright (c) 2003-2006 QLogic Corporation
*
* See LICENSE.qla4xxx for copyright and licensing details.
*/
#define QLA4XXX_DRIVER_VERSION "5.02.00-k1"
|
Fix stupid error for Linux build. | // Copyright (c) 2010 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CHROME_GPU_GPU_CONFIG_H_
#define CHROME_GPU_GPU_CONFIG_H_
// This file declares common preprocessor configuration for the GPU process.
#include "build/build_config.h"
#if defined(OS_LINUX) && !defined(ARCH_CPU_X86)
// Only define GLX support for Intel CPUs for now until we can get the
// proper dependencies and build setup for ARM.
#define GPU_USE_GLX
#endif
#endif // CHROME_GPU_GPU_CONFIG_H_
| // Copyright (c) 2010 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CHROME_GPU_GPU_CONFIG_H_
#define CHROME_GPU_GPU_CONFIG_H_
// This file declares common preprocessor configuration for the GPU process.
#include "build/build_config.h"
#if defined(OS_LINUX) && defined(ARCH_CPU_X86)
// Only define GLX support for Intel CPUs for now until we can get the
// proper dependencies and build setup for ARM.
#define GPU_USE_GLX
#endif
#endif // CHROME_GPU_GPU_CONFIG_H_
|
Add missing property for WebUtils mock | /****************************************************************************
**
** Copyright (C) 2014 Jolla Ltd.
** Contact: Raine Makelainen <raine.makelainen@jolla.com>
**
****************************************************************************/
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/. */
#ifndef DECLARATIVEWEBUTILS_H
#define DECLARATIVEWEBUTILS_H
#include <QObject>
#include <QString>
#include <QColor>
#include <qqml.h>
class DeclarativeWebUtils : public QObject
{
Q_OBJECT
Q_PROPERTY(QString homePage READ homePage NOTIFY homePageChanged FINAL)
public:
explicit DeclarativeWebUtils(QObject *parent = 0);
Q_INVOKABLE int getLightness(QColor color) const;
Q_INVOKABLE QString displayableUrl(QString fullUrl) const;
static DeclarativeWebUtils *instance();
QString homePage() const;
bool firstUseDone() const;
void setFirstUseDone(bool firstUseDone);
signals:
void homePageChanged();
private:
QString m_homePage;
bool m_firstUseDone;
};
QML_DECLARE_TYPE(DeclarativeWebUtils)
#endif
| /****************************************************************************
**
** Copyright (C) 2014 Jolla Ltd.
** Contact: Raine Makelainen <raine.makelainen@jolla.com>
**
****************************************************************************/
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/. */
#ifndef DECLARATIVEWEBUTILS_H
#define DECLARATIVEWEBUTILS_H
#include <QObject>
#include <QString>
#include <QColor>
#include <qqml.h>
class DeclarativeWebUtils : public QObject
{
Q_OBJECT
Q_PROPERTY(QString homePage READ homePage NOTIFY homePageChanged FINAL)
Q_PROPERTY(bool firstUseDone READ firstUseDone NOTIFY firstUseDoneChanged FINAL)
public:
explicit DeclarativeWebUtils(QObject *parent = 0);
Q_INVOKABLE int getLightness(QColor color) const;
Q_INVOKABLE QString displayableUrl(QString fullUrl) const;
static DeclarativeWebUtils *instance();
QString homePage() const;
bool firstUseDone() const;
void setFirstUseDone(bool firstUseDone);
signals:
void homePageChanged();
void firstUseDoneChanged();
private:
QString m_homePage;
bool m_firstUseDone;
};
QML_DECLARE_TYPE(DeclarativeWebUtils)
#endif
|
Make isAwesome public to convert nib-based buttons. | //
// UIButton+PPiAwesome.h
// PPiAwesomeButton-Demo
//
// Created by Pedro Piñera Buendía on 19/08/13.
// Copyright (c) 2013 PPinera. All rights reserved.
//
#import <UIKit/UIKit.h>
#import "NSString+FontAwesome.h"
#import <QuartzCore/QuartzCore.h>
#import <objc/runtime.h>
typedef enum {
IconPositionRight,
IconPositionLeft,
} IconPosition;
@interface UIButton (PPiAwesome)
+(UIButton*)buttonWithType:(UIButtonType)type text:(NSString*)text icon:(NSString*)icon textAttributes:(NSDictionary*)attributes andIconPosition:(IconPosition)position;
-(id)initWithFrame:(CGRect)frame text:(NSString*)text icon:(NSString*)icon textAttributes:(NSDictionary*)attributes andIconPosition:(IconPosition)position;
-(void)setTextAttributes:(NSDictionary*)attributes forUIControlState:(UIControlState)state;
-(void)setBackgroundColor:(UIColor*)color forUIControlState:(UIControlState)state;
-(void)setIconPosition:(IconPosition)position;
-(void)setButtonText:(NSString*)text;
-(void)setButtonIcon:(NSString*)icon;
-(void)setRadius:(CGFloat)radius;
-(void)setSeparation:(NSUInteger)separation;
@end
| //
// UIButton+PPiAwesome.h
// PPiAwesomeButton-Demo
//
// Created by Pedro Piñera Buendía on 19/08/13.
// Copyright (c) 2013 PPinera. All rights reserved.
//
#import <UIKit/UIKit.h>
#import "NSString+FontAwesome.h"
#import <QuartzCore/QuartzCore.h>
#import <objc/runtime.h>
typedef enum {
IconPositionRight,
IconPositionLeft,
} IconPosition;
@interface UIButton (PPiAwesome)
+(UIButton*)buttonWithType:(UIButtonType)type text:(NSString*)text icon:(NSString*)icon textAttributes:(NSDictionary*)attributes andIconPosition:(IconPosition)position;
-(id)initWithFrame:(CGRect)frame text:(NSString*)text icon:(NSString*)icon textAttributes:(NSDictionary*)attributes andIconPosition:(IconPosition)position;
-(void)setTextAttributes:(NSDictionary*)attributes forUIControlState:(UIControlState)state;
-(void)setBackgroundColor:(UIColor*)color forUIControlState:(UIControlState)state;
-(void)setIconPosition:(IconPosition)position;
-(void)setButtonText:(NSString*)text;
-(void)setButtonIcon:(NSString*)icon;
-(void)setRadius:(CGFloat)radius;
-(void)setSeparation:(NSUInteger)separation;
-(void)setIsAwesome:(BOOL)isAwesome;
@end
|
Add header file for external use (e.g. SST) | #ifndef __MEMORY_SYSTEM__H
#define __MEMORY_SYSTEM__H
#include <functional>
#include <string>
namespace dramsim3 {
// This should be the interface class that deals with CPU
class MemorySystem {
public:
MemorySystem(const std::string &config_file, const std::string &output_dir,
std::function<void(uint64_t)> read_callback,
std::function<void(uint64_t)> write_callback);
~MemorySystem();
void ClockTick();
void RegisterCallbacks(std::function<void(uint64_t)> read_callback,
std::function<void(uint64_t)> write_callback);
double GetTCK() const;
int GetBusBits() const;
int GetBurstLength() const;
int GetQueueSize() const;
void PrintStats() const;
bool WillAcceptTransaction(uint64_t hex_addr, bool is_write) const;
bool AddTransaction(uint64_t hex_addr, bool is_write);
};
} // namespace dramsim3
#endif
| |
Add Storyboard outlets in Notifications cell class | //
// UINotificationTableViewCell.h
// YouLocal
//
// Created by Mihail Velikov on 5/3/15.
// Copyright (c) 2015 YouLoc.al. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface NotificationTableViewCell : UITableViewCell
@property (nonatomic, weak) UIImageView *avatarImage;
@property (nonatomic, weak) UIImageView *typeImage;
@property (nonatomic, weak) UILabel *authorNameLabel;
@property (nonatomic, weak) UILabel *createdBeforeLabel;
@property (nonatomic, weak) UILabel *messageLabel;
@end
| //
// UINotificationTableViewCell.h
// YouLocal
//
// Created by Mihail Velikov on 5/3/15.
// Copyright (c) 2015 YouLoc.al. All rights reserved.
//
#import <UIKit/UIKit.h>
@interface NotificationTableViewCell : UITableViewCell
@property (weak, nonatomic) IBOutlet UIImageView *avatarImage;
@property (weak, nonatomic) IBOutlet UIImageView *typeImage;
@property (weak, nonatomic) IBOutlet UILabel *nameLabel;
@property (weak, nonatomic) IBOutlet UILabel *typeLabel;
@property (weak, nonatomic) IBOutlet UILabel *messageLabel;
@property (weak, nonatomic) IBOutlet UILabel *createdBeforeLabel;
@property (weak, nonatomic) IBOutlet UILabel *createdBeforeSign;
@end
|
Use file extension as fallback. | class EncoderFormat {
public:
std::string get() { return std::string(_format.begin(), _format.end()); } const
void set(const std::wstring fileName, const std::wstring extension)
{
if (fileName.find(L"clusterfuzz-testcase-") == -1)
{
if (extension.length() > 1)
_format = extension.substr(1, extension.size() - 1);
return;
}
std::wstring format=fileName;
size_t index = format.find(L"_", 0);
if (index == std::wstring::npos)
return;
format=format.substr(index + 1);
index = format.find(L"_", 0);
if (index != std::wstring::npos)
_format=format.substr(0, index);
}
private:
std::wstring _format = L".notset";
}; | class EncoderFormat {
public:
std::string get() { return std::string(_format.begin(), _format.end()); } const
void set(const std::wstring fileName, const std::wstring extension)
{
if (fileName.find(L"clusterfuzz-testcase-") == -1)
{
if (extension.length() > 1)
_format = extension.substr(1, extension.size() - 1);
return;
}
std::wstring format=fileName;
size_t index = format.find(L"_", 0);
if (index == std::wstring::npos)
return;
format=format.substr(index + 1);
index = format.find(L"_", 0);
if (index != std::wstring::npos)
_format=format.substr(0, index);
else if (extension.length() > 1)
_format=extension.substr(1, extension.size() - 1);
}
private:
std::wstring _format = L".notset";
}; |
Move pthread-locking stuff to "internal.h". (_U_dyn_info_list_lock): Rename from "registration_lock" and change from r/w-lock to a simple mutex (spin) lock. (_U_dyn_register): Insert into doubly-linked list. | #include <libunwind.h>
#ifndef HAVE_CMP8XCHG16
#include <pthread.h>
/* Make it easy to write thread-safe code which may or may not be
linked against libpthread. The macros below can be used
unconditionally and if -lpthread is around, they'll call the
corresponding routines otherwise, they do nothing. */
#pragma weak pthread_rwlock_rdlock
#pragma weak pthread_rwlock_wrlock
#pragma weak pthread_rwlock_unlock
#define rw_rdlock(l) (pthread_rwlock_rdlock ? pthread_rwlock_rdlock (l) : 0)
#define rw_wrlock(l) (pthread_rwlock_wrlock ? pthread_rwlock_wrlock (l) : 0)
#define rw_unlock(l) (pthread_rwlock_unlock ? pthread_rwlock_unlock (l) : 0)
static pthread_rwlock_t registration_lock = PTHREAD_RWLOCK_INITIALIZER;
#endif
extern unw_dyn_info_list_t _U_dyn_info_list;
int
_U_dyn_register (unw_dyn_info_t *di)
{
#ifdef HAVE_CMP8XCHG16
unw_dyn_info_t *old_list_head, *new_list_head;
unsigned long old_gen, new_gen;
do
{
old_gen = _U_dyn_info_list.generation;
old_list_head = _U_dyn_info_list.first;
new_gen = old_gen + 1;
new_list_head = di;
di->next = old_list_head;
}
while (cmp8xchg16 (&_U_dyn_info_list, new_gen, new_list_head) != old_gen);
#else
rw_wrlock (®istration_lock);
{
++_U_dyn_info_list.generation;
di->next = _U_dyn_info_list.first;
_U_dyn_info_list.first = di;
}
rw_unlock (®istration_lock);
#endif
}
| #include "internal.h"
pthread_mutex_t _U_dyn_info_list_lock = PTHREAD_MUTEX_INITIALIZER;
void
_U_dyn_register (unw_dyn_info_t *di)
{
mutex_lock (&_U_dyn_info_list_lock);
{
++_U_dyn_info_list.generation;
di->next = _U_dyn_info_list.first;
di->prev = NULL;
if (di->next)
di->next->prev = di;
_U_dyn_info_list.first = di;
}
mutex_unlock (&_U_dyn_info_list_lock);
}
|
Add overloads for qDebug << and some eigen types. | #ifndef SRC_EIGEN_QDEBUG_H_
#define SRC_EIGEN_QDEBUG_H_
#include <iostream>
#include <QDebug>
#include <Eigen/Core>
QDebug operator<<(QDebug dbg, const Eigen::Vector2f &vector)
{
dbg << "[" << vector.x() << "|" << vector.y() << "]";
return dbg.maybeSpace();
}
QDebug operator<<(QDebug dbg, const Eigen::Vector3f &vector)
{
dbg << "[" << vector.x() << "|" << vector.y() << "|" << vector.z() << "]";
return dbg.maybeSpace();
}
QDebug operator<<(QDebug dbg, const Eigen::Matrix4f &vector)
{
const Eigen::IOFormat cleanFormat(4, 0, ", ", "\n", "[", "]");
std::stringstream stream;
stream << vector.format(cleanFormat);
dbg << stream.str().c_str();
return dbg.maybeSpace();
}
#endif // SRC_EIGEN_QDEBUG_H_
| |
Define constructor, destructor and on_session_end methods. | #define MODULE_API_REVISION 1
struct api_version {
int rev;
size_t mi_size;
};
struct moduleinfo {
const char *name;
struct api_version ver;
};
#define MI_VER_INIT(sname) {.rev = MODULE_API_REVISION, .mi_size = sizeof(sname)}
| #define MODULE_API_REVISION 2
struct rtpp_cfg_stable;
struct rtpp_module_priv;
struct rtpp_accounting;
DEFINE_METHOD(rtpp_cfg_stable, rtpp_module_ctor, struct rtpp_module_priv *);
DEFINE_METHOD(rtpp_module_priv, rtpp_module_dtor, void);
DEFINE_METHOD(rtpp_module_priv, rtpp_module_on_session_end, void,
struct rtpp_accounting *);
struct api_version {
int rev;
size_t mi_size;
};
struct moduleinfo {
const char *name;
struct api_version ver;
rtpp_module_ctor_t ctor;
rtpp_module_dtor_t dtor;
rtpp_module_on_session_end_t on_session_end;
};
#define MI_VER_INIT(sname) {.rev = MODULE_API_REVISION, .mi_size = sizeof(sname)}
#define MI_VER_CHCK(sname, sptr) ((sptr)->ver.rev == MODULE_API_REVISION && \
(sptr)->ver.mi_size == sizeof(sname))
|
Add license to bridging header | //
// Use this file to import your target's public headers that you would like to expose to Swift.
//
#import "DetailViewController.h"
#import "LoremIpsum.h"
| //
// Use this file to import your target's public headers that you would like to expose to Swift.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#import "DetailViewController.h"
#import "LoremIpsum.h"
|
Remove explicit conversion to boolean value. | #include <clib/dos_protos.h>
#include <inline/dos_protos.h>
#include <proto/dos.h>
#include <proto/exec.h>
#include <proto/graphics.h>
#include <exec/execbase.h>
#include <graphics/gfxbase.h>
#include "system/check.h"
bool SystemCheck() {
bool kickv40 = (SysBase->LibNode.lib_Version >= 40) ? TRUE : FALSE;
bool chipaga = (GfxBase->ChipRevBits0 & (GFXF_AA_ALICE|GFXF_AA_LISA)) ? TRUE : FALSE;
bool cpu68040 = (SysBase->AttnFlags & AFF_68040) ? TRUE : FALSE;
bool fpu68882 = (SysBase->AttnFlags & AFF_68882) ? TRUE : FALSE;
Printf("System check:\n");
Printf(" - Kickstart v40 : %s\n", kickv40 ? "yes" : "no");
Printf(" - ChipSet AGA : %s\n", chipaga ? "yes" : "no");
Printf(" - CPU 68040 : %s\n", cpu68040 ? "yes" : "no");
Printf(" - FPU 68882 : %s\n", fpu68882 ? "yes" : "no");
return (kickv40 && cpu68040 && fpu68882 && chipaga);
}
| #include <clib/dos_protos.h>
#include <inline/dos_protos.h>
#include <proto/dos.h>
#include <proto/exec.h>
#include <proto/graphics.h>
#include <exec/execbase.h>
#include <graphics/gfxbase.h>
#include "system/check.h"
bool SystemCheck() {
bool kickv40 = SysBase->LibNode.lib_Version >= 40;
bool chipaga = GfxBase->ChipRevBits0 & (GFXF_AA_ALICE|GFXF_AA_LISA);
bool cpu68040 = SysBase->AttnFlags & AFF_68040;
bool fpu68882 = SysBase->AttnFlags & AFF_68882;
Printf("System check:\n");
Printf(" - Kickstart v40 : %s\n", kickv40 ? "yes" : "no");
Printf(" - ChipSet AGA : %s\n", chipaga ? "yes" : "no");
Printf(" - CPU 68040 : %s\n", cpu68040 ? "yes" : "no");
Printf(" - FPU 68882 : %s\n", fpu68882 ? "yes" : "no");
return (kickv40 && cpu68040 && fpu68882 && chipaga);
}
|
Add a documentation for the bencoding namespace. | /**
* @mainpage
*
* This is an automatically generated API documentation for the @c cpp-bencoding project.
*/
| /**
* @mainpage
*
* This is an automatically generated API documentation for the @c cpp-bencoding project.
*/
// Document the bencoding namespace (there is no better place).
/// @namespace bencoding Main namespace of the bencoding library.
|
Add functional::State and its controls. | /*!
\file state.h
\brief The definition and its controls for a state monad.
*/
#ifndef FUNCTIONAL_STATE_H_
#define FUNCTIONAL_STATE_H_
#include <functional>
#include <type_traits>
#include <utility>
namespace functional {
template <typename S, typename T>
using State = std::function<std::pair<T, S>(S)>;
template <typename T, typename S, typename F>
constexpr functional::State<S, T> make_state(F f)
{ return functional::State<S, T>(f); }
template <typename T, typename S, typename F>
constexpr typename std::result_of<F(T)>::type bind(
functional::State<S, T> state, F f
) {
return typename std::result_of<F(T)>::type(
[state, f](S s) {
auto new_state = state(std::move(s));
return f(std::move(new_state.first))(std::move(new_state.second));
}
);
}
template <typename T, typename S, typename F, typename... Args>
constexpr typename std::result_of<F(T, Args...)>::type bind(
functional::State<S, T> state, F f, Args&&... args
) {
return typename std::result_of<F(T, Args...)>::type(
[&, state, f](S s) {
auto g = std::bind(f, std::placeholders::_1, std::forward<Args>(args)...);
auto new_state = state(std::move(s));
return g(std::move(new_state.first))(std::move(new_state.second));
}
);
}
template <typename T, typename S, typename F>
constexpr auto bind_void(functional::State<S, T> state, F f) -> decltype(f()) {
return decltype(f())(
[state, f](S s) {
auto new_state = state(std::move(s));
return f()(std::move(new_state.second));
}
);
}
template <typename T, typename S, typename F, typename... Args>
constexpr auto bind_void(
functional::State<S, T> state, F f, Args&&... args
) -> decltype(f(args...)) {
return decltype(f(args...))(
[&, state, f](S s) {
auto g = std::bind(f, std::forward<Args>(args)...);
auto new_state = state(std::move(s));
return g()(std::move(new_state.second));
}
);
}
template <typename T, typename S, typename F>
constexpr functional::State<S, T> fmap(functional::State<S, T> state, F f) {
return functional::make_state<T, S>(
[state, f](S s) {
auto new_state = state(std::move(s));
return std::make_pair(
std::move(f(new_state.first)), std::move(new_state.second)
);
}
);
}
} // namespace functional
#endif
| |
Comment on Backend member functions | #pragma once
#include <memory>
#include "xchainer/array.h"
#include "xchainer/device.h"
#include "xchainer/scalar.h"
namespace xchainer {
class Backend {
public:
virtual ~Backend() = default;
virtual std::shared_ptr<void> Allocate(const Device& device, size_t bytesize) = 0;
virtual void MemoryCopy(void* dst_ptr, const void* src_ptr, size_t bytesize) = 0;
virtual std::shared_ptr<void> FromBuffer(const Device& device, const std::shared_ptr<void>& src_ptr, size_t bytesize) = 0;
virtual void Fill(Array& out, Scalar value) = 0;
virtual void Add(const Array& lhs, const Array& rhs, Array& out) = 0;
virtual void Mul(const Array& lhs, const Array& rhs, Array& out) = 0;
virtual void Synchronize() = 0;
};
} // namespace xchainer
| #pragma once
#include <memory>
#include "xchainer/array.h"
#include "xchainer/device.h"
#include "xchainer/scalar.h"
namespace xchainer {
class Backend {
public:
virtual ~Backend() = default;
// Allocates a memory chunk on the specified device.
virtual std::shared_ptr<void> Allocate(const Device& device, size_t bytesize) = 0;
// Copies the data between two memory chunks.
virtual void MemoryCopy(void* dst_ptr, const void* src_ptr, size_t bytesize) = 0;
// Creates a data buffer filled with the specified data on the specified device.
//
// It may allocate a new memory or return an alias.
// src_ptr is guaranteed to reside in the main RAM.
virtual std::shared_ptr<void> FromBuffer(const Device& device, const std::shared_ptr<void>& src_ptr, size_t bytesize) = 0;
virtual void Fill(Array& out, Scalar value) = 0;
virtual void Add(const Array& lhs, const Array& rhs, Array& out) = 0;
virtual void Mul(const Array& lhs, const Array& rhs, Array& out) = 0;
virtual void Synchronize() = 0;
};
} // namespace xchainer
|
Fix to allow compile under 32 bit. | ////////////////////////////////////////////////////////////////////////////////
//
// EXPANZ
// Copyright 2008-2011 EXPANZ
// All Rights Reserved.
//
// NOTICE: Expanz permits you to use, modify, and distribute this file
// in accordance with the terms of the license agreement accompanying it.
//
////////////////////////////////////////////////////////////////////////////////
#import <Foundation/Foundation.h>
#import "xcode_AbstractDefinition.h"
#import "XcodeSourceFileType.h"
@interface xcode_SourceFileDefinition : xcode_AbstractDefinition;
@property(nonatomic, strong, readonly) NSString* sourceFileName;
@property(nonatomic, strong, readonly) NSData* data;
@property(nonatomic, readonly) XcodeSourceFileType type;
+ (xcode_SourceFileDefinition*) sourceDefinitionWithName:(NSString*)name text:(NSString*)text
type:(XcodeSourceFileType)type;
+ (xcode_SourceFileDefinition*) sourceDefinitionWithName:(NSString*)name data:(NSData*)data
type:(XcodeSourceFileType)type;
- (id) initWithName:(NSString*)name text:(NSString*)text type:(XcodeSourceFileType)type;
- (id) initWithName:(NSString*)name data:(NSData*)data type:(XcodeSourceFileType)type;
@end
/* ================================================================================================================== */
@compatibility_alias SourceFileDefinition xcode_SourceFileDefinition; | ////////////////////////////////////////////////////////////////////////////////
//
// EXPANZ
// Copyright 2008-2011 EXPANZ
// All Rights Reserved.
//
// NOTICE: Expanz permits you to use, modify, and distribute this file
// in accordance with the terms of the license agreement accompanying it.
//
////////////////////////////////////////////////////////////////////////////////
#import <Foundation/Foundation.h>
#import "xcode_AbstractDefinition.h"
#import "XcodeSourceFileType.h"
@interface xcode_SourceFileDefinition : xcode_AbstractDefinition {
NSString* _sourceFileName;
XcodeSourceFileType _type;
NSData* _data;
}
@property(nonatomic, strong, readonly) NSString* sourceFileName;
@property(nonatomic, strong, readonly) NSData* data;
@property(nonatomic, readonly) XcodeSourceFileType type;
+ (xcode_SourceFileDefinition*) sourceDefinitionWithName:(NSString*)name text:(NSString*)text
type:(XcodeSourceFileType)type;
+ (xcode_SourceFileDefinition*) sourceDefinitionWithName:(NSString*)name data:(NSData*)data
type:(XcodeSourceFileType)type;
- (id) initWithName:(NSString*)name text:(NSString*)text type:(XcodeSourceFileType)type;
- (id) initWithName:(NSString*)name data:(NSData*)data type:(XcodeSourceFileType)type;
@end
/* ================================================================================================================== */
@compatibility_alias SourceFileDefinition xcode_SourceFileDefinition; |
Add regression tests where global is more precise than global-history due to non-side widen order | // PARAM: --enable ana.int.interval
#include <pthread.h>
#include <assert.h>
// global priv succeeds
// global-history fails due to [1,+inf] widen ([1,+inf] join [0,+inf]) -> [-inf,+inf]
// sensitive to eval and widen order!
int g = 0;
int limit; // unknown
pthread_mutex_t A = PTHREAD_MUTEX_INITIALIZER;
void *worker(void *arg )
{
// just for going to multithreaded mode
return NULL;
}
int put() {
pthread_mutex_lock(&A);
while (g >= limit) { // problematic widen
}
assert(g >= 0);
g++;
pthread_mutex_unlock(&A);
}
int main(int argc , char **argv )
{
pthread_t tid;
pthread_create(& tid, NULL, & worker, NULL);
int r;
limit = r; // only problematic if limit unknown
while (1) {
// only problematic if not inlined
put();
}
return 0;
}
| |
Add a pointer wrapper for vil_smart_ptr | /*ckwg +5
* Copyright 2011 by Kitware, Inc. All Rights Reserved. Please refer to
* KITWARE_LICENSE.TXT for licensing information, or contact General Counsel,
* Kitware, Inc., 28 Corporate Drive, Clifton Park, NY 12065.
*/
#ifndef VISTK_PYTHON_HELPERS_PYTHON_WRAP_VIL_SMART_PTR_H
#define VISTK_PYTHON_HELPERS_PYTHON_WRAP_VIL_SMART_PTR_H
#include <boost/python/pointee.hpp>
#include <boost/get_pointer.hpp>
#include <vil/vil_smart_ptr.h>
namespace boost
{
namespace python
{
template <typename T>
inline
T*
get_pointer(vil_smart_ptr<T> const& p)
{
return p.ptr();
}
template <typename T>
struct pointee<vil_smart_ptr<T> >
{
typedef T type;
};
// Don't hide other get_pointer instances.
using boost::python::get_pointer;
using boost::get_pointer;
}
}
#endif // VISTK_PYTHON_HELPERS_PYTHON_WRAP_VIL_SMART_PTR_H
| |
Use azy_server_run as a replacement for ecore_main_loop_begin | #ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#include <Azy.h>
#include "EMS_Config.azy_server.h"
/*============================================================================*
* Local *
*============================================================================*/
/*============================================================================*
* Global *
*============================================================================*/
void ems_server_init(void)
{
Azy_Server *serv;
Azy_Server_Module_Def **mods;
azy_init();
//Define the list of module used by the server.
Azy_Server_Module_Def *modules[] = {
EMS_Config_module_def(),
NULL
};
serv = azy_server_new(EINA_FALSE);
azy_server_addr_set(serv, "0.0.0.0");
azy_server_port_set(serv, 2000);
for (mods = modules; mods && *mods; mods++)
{
if (!azy_server_module_add(serv, *mods))
ERR("Unable to create server\n");
}
INF("Start Azy server");
azy_server_start(serv);
}
/*============================================================================*
* API *
*============================================================================*/
| #ifdef HAVE_CONFIG_H
# include <config.h>
#endif
#include <Azy.h>
#include "EMS_Config.azy_server.h"
/*============================================================================*
* Local *
*============================================================================*/
Azy_Server *_serv;
/*============================================================================*
* Global *
*============================================================================*/
void ems_server_init(void)
{
Azy_Server_Module_Def **mods;
azy_init();
//Define the list of module used by the server.
Azy_Server_Module_Def *modules[] = {
EMS_Config_module_def(),
NULL
};
_serv = azy_server_new(EINA_FALSE);
azy_server_addr_set(_serv, "0.0.0.0");
azy_server_port_set(_serv, ems_config->port);
for (mods = modules; mods && *mods; mods++)
{
if (!azy_server_module_add(_serv, *mods))
ERR("Unable to create server\n");
}
}
void ems_server_run(void)
{
INF("Start Azy server");
azy_server_run(_serv);
}
/*============================================================================*
* API *
*============================================================================*/
|
Add RAStringSignal and RAStringValue to header | //
// react-objc - a library for functional-reactive-like programming
// https://github.com/tconkling/react-objc/blob/master/LICENSE
#import "RAConnection.h"
#import "RAConnectionGroup.h"
#import "RABoolSignal.h"
#import "RABoolValue.h"
#import "RADoubleSignal.h"
#import "RADoubleValue.h"
#import "RAFloatSignal.h"
#import "RAFloatValue.h"
#import "RAIntSignal.h"
#import "RAIntValue.h"
#import "RAObjectSignal.h"
#import "RAObjectValue.h"
#import "RAUnitSignal.h"
#import "RAFuture.h"
#import "RAPromise.h"
#import "RAMultiFailureError.h"
#import "RATry.h"
#import "RAMappedSignal.h"
| //
// react-objc - a library for functional-reactive-like programming
// https://github.com/tconkling/react-objc/blob/master/LICENSE
#import "RAConnection.h"
#import "RAConnectionGroup.h"
#import "RABoolSignal.h"
#import "RABoolValue.h"
#import "RADoubleSignal.h"
#import "RADoubleValue.h"
#import "RAFloatSignal.h"
#import "RAFloatValue.h"
#import "RAIntSignal.h"
#import "RAIntValue.h"
#import "RAObjectSignal.h"
#import "RAObjectValue.h"
#import "RAStringSignal.h"
#import "RAStringValue.h"
#import "RAUnitSignal.h"
#import "RAFuture.h"
#import "RAPromise.h"
#import "RAMultiFailureError.h"
#import "RATry.h"
#import "RAMappedSignal.h"
|
Update header include guard for root-path file. | /*
* Copyright (c) 2010-2014, Delft University of Technology
* Copyright (c) 2010-2014, K. Kumar (me@kartikkumar.com)
* All rights reserved.
* See http://bit.ly/1jern3m for license details.
*/
#ifndef ASSIST_INPUT_OUTPUT_H
#define ASSIST_INPUT_OUTPUT_H
#include <string>
namespace assist
{
namespace input_output
{
//! Get root-path for Assist directory.
/*!
* Returns root-path corresponding with root-directory of Assist as a string with
* trailing slash included.
* \return Assist root-path.
*/
static inline std::string getAssistRootPath( )
{
#ifdef ASSIST_CUSTOM_ROOT_PATH
return std::string( ASSIST_CUSTOM_ROOT_PATH );
#else
// Declare file path string assigned to filePath.
// __FILE__ only gives the absolute path in the header file!
std::string filePath_( __FILE__ );
// Strip filename from temporary string and return root-path string.
return filePath_.substr( 0, filePath_.length( ) -
std::string( "InputOutput/rootPath.h" ).length( ) );
#endif
}
} // namespace input_output
} // namespace assist
#endif // ASSIST_INPUT_OUTPUT_H
| /*
* Copyright (c) 2010-2014, Delft University of Technology
* Copyright (c) 2010-2014, K. Kumar (me@kartikkumar.com)
* All rights reserved.
* See http://bit.ly/1jern3m for license details.
*/
#ifndef ASSIST_ROOT_PATH_H
#define ASSIST_ROOT_PATH_H
#include <string>
namespace assist
{
namespace input_output
{
//! Get root-path for Assist directory.
/*!
* Returns root-path corresponding with root-directory of Assist as a string with
* trailing slash included.
* \return Assist root-path.
*/
static inline std::string getAssistRootPath( )
{
#ifdef ASSIST_CUSTOM_ROOT_PATH
return std::string( ASSIST_CUSTOM_ROOT_PATH );
#else
// Declare file path string assigned to filePath.
// __FILE__ only gives the absolute path in the header file!
std::string filePath_( __FILE__ );
// Strip filename from temporary string and return root-path string.
return filePath_.substr( 0, filePath_.length( ) -
std::string( "InputOutput/rootPath.h" ).length( ) );
#endif
}
} // namespace input_output
} // namespace assist
#endif // ASSIST_ROOT_PATH_H
|
Remove function prototype that are now static in ta_data_interface.c | #ifndef TA_ADDDATASOURCEPARAM_PRIV_H
#define TA_ADDDATASOURCEPARAM_PRIV_H
/* The following is a private copy of the user provided
* parameters for a TA_AddDataSource call.
*
* Code is in 'ta_data_interface.c'
*/
typedef struct
{
TA_SourceId id;
TA_SourceFlag flags;
TA_Period period;
TA_String *location;
TA_String *info;
TA_String *username;
TA_String *password;
TA_String *category;
TA_String *country;
TA_String *exchange;
TA_String *type;
TA_String *symbol;
TA_String *name;
} TA_AddDataSourceParamPriv;
/* Function to alloc/free a TA_AddDataSourceParamPriv. */
TA_AddDataSourceParamPriv *TA_AddDataSourceParamPrivAlloc( const TA_AddDataSourceParam *param );
TA_RetCode TA_AddDataSourceParamPrivFree( TA_AddDataSourceParamPriv *toBeFreed );
#endif
| #ifndef TA_ADDDATASOURCEPARAM_PRIV_H
#define TA_ADDDATASOURCEPARAM_PRIV_H
/* The following is a private copy of the user provided
* parameters for a TA_AddDataSource call.
*
* Code is in 'ta_data_interface.c'
*/
typedef struct
{
TA_SourceId id;
TA_SourceFlag flags;
TA_Period period;
TA_String *location;
TA_String *info;
TA_String *username;
TA_String *password;
TA_String *category;
TA_String *country;
TA_String *exchange;
TA_String *type;
TA_String *symbol;
TA_String *name;
} TA_AddDataSourceParamPriv;
#endif
|
Remove dos line endings. Please remember to configure your windows SVN clients to default text files to 'eol-native'. | // RUN: %clang_cc1 -fsyntax-only -Wall -pedantic -verify %s
// RUN: cp %s %t
// RUN: cp %S/fixit-include.h %T
// RUN: not %clang_cc1 -fsyntax-only -fixit %t
// RUN: %clang_cc1 -Wall -pedantic %t
#include <fixit-include.h> // expected-error {{'fixit-include.h' file not found with <angled> include; use "quotes" instead}}
#pragma does_not_exist // expected-warning {{unknown pragma ignored}}
int main( void ) {
return 0;
}
| // RUN: %clang_cc1 -fsyntax-only -Wall -pedantic -verify %s
// RUN: cp %s %t
// RUN: cp %S/fixit-include.h %T
// RUN: not %clang_cc1 -fsyntax-only -fixit %t
// RUN: %clang_cc1 -Wall -pedantic %t
#include <fixit-include.h> // expected-error {{'fixit-include.h' file not found with <angled> include; use "quotes" instead}}
#pragma does_not_exist // expected-warning {{unknown pragma ignored}}
int main( void ) {
return 0;
}
|
Make worst case actual worst case. | #include <stdio.h>
#include <stdlib.h>
#include "../brk.h"
#include <unistd.h>
#include "clock.h"
int main(int argc, char *argv[]) {
int nbytes = 5;
void **ptrs;
long num;
long i;
num = atol(argv[1]);
ptrs = malloc(sizeof(void*) * num);
for(i = 0; i < num; i++) {
ptrs[i] = malloc(nbytes);
malloc(1);
}
for(i = 0; i < num; i++) {
free(ptrs[i]);
}
_reset_clock();
for(i = 0; i < num; i++) {
_resume();
ptrs[i] = malloc(nbytes + 1);
_pause();
}
_print_elapsed_time();
return 0;
}
| #include <stdio.h>
#include <stdlib.h>
#include "../brk.h"
#include <unistd.h>
#include "clock.h"
#define MIN_ALLOC (1024)
#define HEADER_SIZE (16)
int main(int argc, char *argv[]) {
void **ptrs;
long num;
long i;
int small_malloc = HEADER_SIZE;
int medium_malloc = (MIN_ALLOC - 3) * HEADER_SIZE;
int large_malloc = (MIN_ALLOC - 1) * HEADER_SIZE;
num = atol(argv[1]);
ptrs = malloc(sizeof(void*) * num);
for(i = 0; i < num; i++) {
ptrs[i] = malloc(medium_malloc);
malloc(small_malloc);
}
for(i = 0; i < num; i++) {
free(ptrs[i]);
}
_reset_clock();
for(i = 0; i < num; i++) {
_resume();
ptrs[i] = malloc(large_malloc);
_pause();
}
_print_elapsed_time();
return 0;
}
|
Use <> instead of \"\" | /* Define the real-function versions of all inline functions
defined in signal.h (or bits/sigset.h). */
#include <features.h>
#define _EXTERN_INLINE
#ifndef __USE_EXTERN_INLINES
# define __USE_EXTERN_INLINES 1
#endif
#include "signal.h"
| /* Define the real-function versions of all inline functions
defined in signal.h (or bits/sigset.h). */
#include <features.h>
#define _EXTERN_INLINE
#ifndef __USE_EXTERN_INLINES
# define __USE_EXTERN_INLINES 1
#endif
#include <signal.h>
|
Change date of copyright notice | #ifndef PUT_INDIVIDUAL_CONTEXT_ENTITY_ATTRIBUTE_H
#define PUT_INDIVIDUAL_CONTEXT_ENTITY_ATTRIBUTE_H
/*
*
* Copyright 2013 Telefonica Investigacion y Desarrollo, S.A.U
*
* This file is part of Orion Context Broker.
*
* Orion Context Broker is free software: you can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* Orion Context Broker is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero
* General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with Orion Context Broker. If not, see http://www.gnu.org/licenses/.
*
* For those usages not covered by this license please contact with
* fermin at tid dot es
*
* Author: TID Developer
*/
#include <string>
#include <vector>
#include "rest/ConnectionInfo.h"
#include "ngsi/ParseData.h"
/* ****************************************************************************
*
* putIndividualContextEntityAttribute -
*/
extern std::string putIndividualContextEntityAttribute(ConnectionInfo* ciP, int components, std::vector<std::string> compV, ParseData* parseDataP);
#endif
| #ifndef PUT_INDIVIDUAL_CONTEXT_ENTITY_ATTRIBUTE_H
#define PUT_INDIVIDUAL_CONTEXT_ENTITY_ATTRIBUTE_H
/*
*
* Copyright 2014 Telefonica Investigacion y Desarrollo, S.A.U
*
* This file is part of Orion Context Broker.
*
* Orion Context Broker is free software: you can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* Orion Context Broker is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero
* General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with Orion Context Broker. If not, see http://www.gnu.org/licenses/.
*
* For those usages not covered by this license please contact with
* fermin at tid dot es
*
* Author: TID Developer
*/
#include <string>
#include <vector>
#include "rest/ConnectionInfo.h"
#include "ngsi/ParseData.h"
/* ****************************************************************************
*
* putIndividualContextEntityAttribute -
*/
extern std::string putIndividualContextEntityAttribute(ConnectionInfo* ciP, int components, std::vector<std::string> compV, ParseData* parseDataP);
#endif
|
Fix invalid delete[] calls in ~Problem | #ifndef PROBLEM_H
#define PROBLEM_H
#include "sense.h"
class Problem {
public:
int objcnt; // Number of objectives
double* rhs;
int** objind; // Objective indices
double** objcoef; // Objective coefficients
Sense objsen; // Objective sense. Note that all objectives must have the same
// sense (i.e., either all objectives are to be minimised, or
// all objectives are to be maximised).
int* conind;
char* consense;
~Problem();
};
inline Problem::~Problem() {
for(int j = 0; j < objcnt; ++j) {
delete[] objind[j];
delete[] objcoef[j];
}
delete[] objind;
delete[] objcoef;
delete[] rhs;
delete[] conind;
delete[] consense;
}
#endif /* PROBLEM_H */
| #ifndef PROBLEM_H
#define PROBLEM_H
#include "sense.h"
class Problem {
public:
int objcnt; // Number of objectives
double* rhs;
int** objind; // Objective indices
double** objcoef; // Objective coefficients
Sense objsen; // Objective sense. Note that all objectives must have the same
// sense (i.e., either all objectives are to be minimised, or
// all objectives are to be maximised).
int* conind;
char* consense;
Problem();
~Problem();
};
inline Problem::Problem() : objcnt(0) { }
inline Problem::~Problem() {
// If objcnt == 0, then no problem has been assigned and no memory allocated
if (objcnt == 0)
return;
for(int j = 0; j < objcnt; ++j) {
delete[] objind[j];
delete[] objcoef[j];
}
delete[] objind;
delete[] objcoef;
delete[] rhs;
delete[] conind;
delete[] consense;
}
#endif /* PROBLEM_H */
|
Update patch level for update test. | #ifndef _version_h_
# define _version_h_
# define PROGRAM_NAME "xyzzy"
# define PROGRAM_COPYRIGHT "Copyright (C) 1996-2005 T.Kamei"
# define PROGRAM_MAJOR_VERSION 0
# define PROGRAM_MINOR_VERSION 2
# define PROGRAM_MAJOR_REVISION 3
# define PROGRAM_MINOR_REVISION 5
# define PROGRAM_PATCH_LEVEL 0
# define TITLE_BAR_STRING_SIZE 256
extern char TitleBarString[];
extern const char VersionString[];
extern const char DisplayVersionString[];
extern const char ProgramName[];
extern const char ProgramNameWithVersion[];
#endif
| #ifndef _version_h_
# define _version_h_
# define PROGRAM_NAME "xyzzy"
# define PROGRAM_COPYRIGHT "Copyright (C) 1996-2005 T.Kamei"
# define PROGRAM_MAJOR_VERSION 0
# define PROGRAM_MINOR_VERSION 2
# define PROGRAM_MAJOR_REVISION 3
# define PROGRAM_MINOR_REVISION 5
# define PROGRAM_PATCH_LEVEL 1
# define TITLE_BAR_STRING_SIZE 256
extern char TitleBarString[];
extern const char VersionString[];
extern const char DisplayVersionString[];
extern const char ProgramName[];
extern const char ProgramNameWithVersion[];
#endif
|
Add command to list all objects owned by a given user | /*
* This file is part of Kotaka, a mud library for DGD
* http://github.com/shentino/kotaka
*
* Copyright (C) 2013 Raymond Jennings
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include <kotaka/paths.h>
#include <account/paths.h>
#include <text/paths.h>
#include <game/paths.h>
inherit LIB_RAWVERB;
void main(object actor, string args)
{
string owner;
mapping seen;
object first;
object obj;
if (query_user()->query_class() < 2) {
send_out("Only a wizard can list objregd.\n");
return;
}
seen = ([ ]);
first = KERNELD->first_link(args);
if (!first) {
send_out(args + " owns no objects.\n");
return;
}
obj = first;
send_out("Objects owned by " + args + ":\n");
do {
send_out(object_name(obj) + "\n");
seen[obj] = 1;
obj = KERNELD->next_link(obj);
if (!obj) {
send_out("nil\n");
break;
}
} while (!seen[obj]);
}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.