Instruction stringlengths 14 778 | input_code stringlengths 0 4.24k | output_code stringlengths 1 5.44k |
|---|---|---|
Add minimalist framework for unit testing in Test project. | /*
* minunit.h
*
* Source: http://www.jera.com/techinfo/jtns/jtn002.html
*/
#include <stdio.h>
extern int tests_run;
#define mu_assert(message, test) do { \
if (!(test)) { \
return message; \
} \
} while (0)
#define mu_run_test(test, name) do { \
test_head(name); \
char const * message = test(); \
tests_run++; \
if (message) { \
test_failure; \
printf(" * %s\n", message); \
} else { \
test_success; \
} \
} while (0)
#define test_head(name) printf("Test %s... ", name)
#define test_success printf("[OK]\n")
#define test_failure printf("[FAIL]\n") | |
Convert also 0x80..0x9f characters to '?' | /* Copyright (c) 2004 Timo Sirainen */
#include "lib.h"
#include "str.h"
#include "str-sanitize.h"
void str_sanitize_append(string_t *dest, const char *src, size_t max_len)
{
const char *p;
for (p = src; *p != '\0'; p++) {
if ((unsigned char)*p < 32)
break;
}
str_append_n(dest, src, (size_t)(p - src));
for (; *p != '\0' && max_len > 0; p++, max_len--) {
if ((unsigned char)*p < 32)
str_append_c(dest, '?');
else
str_append_c(dest, *p);
}
if (*p != '\0') {
str_truncate(dest, str_len(dest)-3);
str_append(dest, "...");
}
}
const char *str_sanitize(const char *src, size_t max_len)
{
string_t *str;
str = t_str_new(I_MIN(max_len, 256));
str_sanitize_append(str, src, max_len);
return str_c(str);
}
| /* Copyright (c) 2004 Timo Sirainen */
#include "lib.h"
#include "str.h"
#include "str-sanitize.h"
void str_sanitize_append(string_t *dest, const char *src, size_t max_len)
{
const char *p;
for (p = src; *p != '\0'; p++) {
if (((unsigned char)*p & 0x7f) < 32)
break;
}
str_append_n(dest, src, (size_t)(p - src));
for (; *p != '\0' && max_len > 0; p++, max_len--) {
if (((unsigned char)*p & 0x7f) < 32)
str_append_c(dest, '?');
else
str_append_c(dest, *p);
}
if (*p != '\0') {
str_truncate(dest, str_len(dest)-3);
str_append(dest, "...");
}
}
const char *str_sanitize(const char *src, size_t max_len)
{
string_t *str;
str = t_str_new(I_MIN(max_len, 256));
str_sanitize_append(str, src, max_len);
return str_c(str);
}
|
Add code completion helper for beIdenticalTo() | #import "Expecta.h"
EXPMatcherInterface(_beIdenticalTo, (void *expected));
#if __has_feature(objc_arc)
#define beIdenticalTo(expected) _beIdenticalTo((__bridge void*)expected)
#else
#define beIdenticalTo _beIdenticalTo
#endif
| #import "Expecta.h"
EXPMatcherInterface(_beIdenticalTo, (void *expected));
EXPMatcherInterface(beIdenticalTo, (void *expected)); // to aid code completion
#if __has_feature(objc_arc)
#define beIdenticalTo(expected) _beIdenticalTo((__bridge void*)expected)
#else
#define beIdenticalTo _beIdenticalTo
#endif
|
Structure to hold information about accumualted energy in each cell (crystall) as well as the number of hits. Used by the onlinedisplay and the Histogranproducer component. | #ifndef ALIHLTPHOSNODULECELLACCUMULATEDENERGYDATASTRUCT_H
#define ALIHLTPHOSNODULECELLACCUMULATEDENERGYDATASTRUCT_H
/***************************************************************************
* Copyright(c) 2007, ALICE Experiment at CERN, All rights reserved. *
* *
* Author: Per Thomas Hille <perthi@fys.uio.no> for the ALICE HLT Project. *
* Contributors are mentioned in the code where appropriate. *
* *
* Permission to use, copy, modify and distribute this software and its *
* documentation strictly for non-commercial purposes is hereby granted *
* without fee, provided that the above copyright notice appears in all *
* copies and that both the copyright notice and this permission notice *
* appear in the supporting documentation. The authors make no claims *
* about the suitability of this software for any purpose. It is *
* provided "as is" without express or implied warranty. *
**************************************************************************/
#include "AliHLTPHOSCommonDefs.h"
//#include "AliHLTPHOSValidCellDataStruct.h"
struct AliHLTPHOSModuleCellAccumulatedEnergyDataStruct
{
AliHLTUInt8_t fModuleID;
// Int_t fModuleID;
// AliHLTUInt16_t fCnt;
// AliHLTUInt16_t fValidData[N_ROWS_MOD*N_COLUMNS_MOD*N_GAINS];
// AliHLTPHOSValidCellDataStruct fValidData[N_MODULES*N_ROWS_MOD*N_COLUMNS_MOD*N_GAINS];
// Double_t fAccumulatedEnergies[N_ZROWS_MOD][N_XCOLUMNS_MOD][N_GAINS];
Float_t fAccumulatedEnergies[N_ZROWS_MOD][N_XCOLUMNS_MOD][N_GAINS];
AliHLTUInt32_t fHits[N_ZROWS_MOD][N_XCOLUMNS_MOD][N_GAINS];
};
#endif
| |
Add ban manager to game object list | #include <config.h>
#define LIB_VERB (USR_DIR + "/Game/lib/verb")
#define LIB_SIGHANDLER (USR_DIR + "/Game/lib/sighandler")
#define GAME_LIB_OBJECT (USR_DIR + "/Game/lib/object")
#define ALIASD (USR_DIR + "/Game/sys/aliasd")
#define ACCOUNTD (USR_DIR + "/Game/sys/accountd")
#define ROOT (USR_DIR + "/Game/sys/root")
#define SNOOPD (USR_DIR + "/Game/sys/snoopd")
#define GAME_HELPD (USR_DIR + "/Game/sys/helpd")
#define GAME_DRIVER (USR_DIR + "/Game/sys/driver")
#define GAME_USERD (USR_DIR + "/Game/sys/userd")
| #include <config.h>
#define LIB_VERB (USR_DIR + "/Game/lib/verb")
#define LIB_SIGHANDLER (USR_DIR + "/Game/lib/sighandler")
#define GAME_LIB_OBJECT (USR_DIR + "/Game/lib/object")
#define ALIASD (USR_DIR + "/Game/sys/aliasd")
#define BAND (USR_DIR + "/Game/sys/band")
#define ACCOUNTD (USR_DIR + "/Game/sys/accountd")
#define ROOT (USR_DIR + "/Game/sys/root")
#define SNOOPD (USR_DIR + "/Game/sys/snoopd")
#define GAME_HELPD (USR_DIR + "/Game/sys/helpd")
#define GAME_DRIVER (USR_DIR + "/Game/sys/driver")
#define GAME_USERD (USR_DIR + "/Game/sys/userd")
|
Make indirect_t inherit from projection_base | /*
* Copyright (c) 2021 Morwenn
* SPDX-License-Identifier: MIT
*/
#ifndef CPPSORT_DETAIL_FUNCTIONAL_H_
#define CPPSORT_DETAIL_FUNCTIONAL_H_
////////////////////////////////////////////////////////////
// Headers
////////////////////////////////////////////////////////////
#include <type_traits>
#include <utility>
#include <cpp-sort/utility/as_function.h>
namespace cppsort
{
namespace detail
{
////////////////////////////////////////////////////////////
// indirect
template<typename Projection>
class indirect_t
{
private:
Projection projection;
public:
indirect_t() = delete;
explicit indirect_t(Projection projection):
projection(std::move(projection))
{}
template<typename T>
auto operator()(T&& indirect_value)
-> decltype(utility::as_function(projection)(*indirect_value))
{
auto&& proj = utility::as_function(projection);
return proj(*indirect_value);
}
template<typename T>
auto operator()(T&& indirect_value) const
-> decltype(utility::as_function(projection)(*indirect_value))
{
auto&& proj = utility::as_function(projection);
return proj(*indirect_value);
}
};
template<typename Projection>
auto indirect(Projection&& proj)
-> indirect_t<std::decay_t<Projection>>
{
return indirect_t<std::decay_t<Projection>>(std::forward<Projection>(proj));
}
}}
#endif // CPPSORT_DETAIL_FUNCTIONAL_H_
| /*
* Copyright (c) 2021-2022 Morwenn
* SPDX-License-Identifier: MIT
*/
#ifndef CPPSORT_DETAIL_FUNCTIONAL_H_
#define CPPSORT_DETAIL_FUNCTIONAL_H_
////////////////////////////////////////////////////////////
// Headers
////////////////////////////////////////////////////////////
#include <type_traits>
#include <utility>
#include <cpp-sort/utility/as_function.h>
#include <cpp-sort/utility/functional.h>
namespace cppsort
{
namespace detail
{
////////////////////////////////////////////////////////////
// indirect
template<typename Projection>
class indirect_t:
utility::projection_base
{
private:
Projection projection;
public:
indirect_t() = delete;
explicit indirect_t(Projection projection):
projection(std::move(projection))
{}
template<typename T>
auto operator()(T&& indirect_value)
-> decltype(utility::as_function(projection)(*indirect_value))
{
auto&& proj = utility::as_function(projection);
return proj(*indirect_value);
}
template<typename T>
auto operator()(T&& indirect_value) const
-> decltype(utility::as_function(projection)(*indirect_value))
{
auto&& proj = utility::as_function(projection);
return proj(*indirect_value);
}
};
template<typename Projection>
auto indirect(Projection&& proj)
-> indirect_t<std::decay_t<Projection>>
{
return indirect_t<std::decay_t<Projection>>(std::forward<Projection>(proj));
}
}}
#endif // CPPSORT_DETAIL_FUNCTIONAL_H_
|
Add explicit modifier to EraseOperation ctor | #pragma once
#ifndef YOU_DATASTORE_INTERNAL_OPERATIONS_ERASE_OPERATION_H_
#define YOU_DATASTORE_INTERNAL_OPERATIONS_ERASE_OPERATION_H_
#include "../operation.h"
namespace You {
namespace DataStore {
namespace Internal {
class EraseOperation : public IOperation {
public:
EraseOperation(TaskId);
bool run();
};
} // namespace Internal
} // namespace DataStore
} // namespace You
#endif // YOU_DATASTORE_INTERNAL_OPERATIONS_ERASE_OPERATION_H_
| #pragma once
#ifndef YOU_DATASTORE_INTERNAL_OPERATIONS_ERASE_OPERATION_H_
#define YOU_DATASTORE_INTERNAL_OPERATIONS_ERASE_OPERATION_H_
#include "../operation.h"
namespace You {
namespace DataStore {
namespace Internal {
class EraseOperation : public IOperation {
public:
explicit EraseOperation(TaskId);
bool run();
};
} // namespace Internal
} // namespace DataStore
} // namespace You
#endif // YOU_DATASTORE_INTERNAL_OPERATIONS_ERASE_OPERATION_H_
|
Fix for AllComponentsGui example under Visual Studio | #pragma once
#include "ofMain.h"
#include "ofxDatGui.h"
class ofApp : public ofBaseApp{
public:
void setup();
void draw();
void update();
ofxDatGui* gui;
bool mFullscreen;
void refreshWindow();
void toggleFullscreen();
void keyPressed(int key);
void onButtonEvent(ofxDatGuiButtonEvent e);
void onSliderEvent(ofxDatGuiSliderEvent e);
void onTextInputEvent(ofxDatGuiTextInputEvent e);
void on2dPadEvent(ofxDatGui2dPadEvent e);
void onDropdownEvent(ofxDatGuiDropdownEvent e);
void onColorPickerEvent(ofxDatGuiColorPickerEvent e);
void onMatrixEvent(ofxDatGuiMatrixEvent e);
uint tIndex;
vector<ofxDatGuiTheme*> themes;
};
| #pragma once
#include "ofMain.h"
#include "ofxDatGui.h"
class ofApp : public ofBaseApp{
public:
void setup();
void draw();
void update();
ofxDatGui* gui;
bool mFullscreen;
void refreshWindow();
void toggleFullscreen();
void keyPressed(int key);
void onButtonEvent(ofxDatGuiButtonEvent e);
void onSliderEvent(ofxDatGuiSliderEvent e);
void onTextInputEvent(ofxDatGuiTextInputEvent e);
void on2dPadEvent(ofxDatGui2dPadEvent e);
void onDropdownEvent(ofxDatGuiDropdownEvent e);
void onColorPickerEvent(ofxDatGuiColorPickerEvent e);
void onMatrixEvent(ofxDatGuiMatrixEvent e);
unsigned int tIndex;
vector<ofxDatGuiTheme*> themes;
};
|
Add the import for SPI in the library directly | #ifndef LCDManager_h
#define LCDManager_h
#include "Arduino.h"
#include <LiquidCrystalSPI.h>
class LCDManager{
public :
LCDManager(int line, int cols, int pin);
LiquidCrystalSPI screen();
void clearLine(int line);
void backlight(bool status);
void setBacklightPin(int pin);
void message(String message);
void refreshDisplay();
private :
void displayMessage();
String messageBuffer;
LiquidCrystalSPI theScreen;
int lines;
int cols;
int currentTextScrollPosition;
int currentTextChar;
bool hasDisplayFirstLoop;
int pinBacklight;
long lastTimer;
int timeBetweenRefresh;
};
#endif | #ifndef LCDManager_h
#define LCDManager_h
#include "Arduino.h"
#include <LiquidCrystalSPI.h>
#include <SPI.h>
class LCDManager{
public :
LCDManager(int line, int cols, int pin);
LiquidCrystalSPI screen();
void clearLine(int line);
void backlight(bool status);
void setBacklightPin(int pin);
void message(String message);
void refreshDisplay();
private :
void displayMessage();
String messageBuffer;
LiquidCrystalSPI theScreen;
int lines;
int cols;
int currentTextScrollPosition;
int currentTextChar;
bool hasDisplayFirstLoop;
int pinBacklight;
long lastTimer;
int timeBetweenRefresh;
};
#endif |
Add patch release in PHP_PHPIREDIS_VERSION. | #ifndef PHP_PHPIREDIS_H
#define PHP_PHPIREDIS_H 1
#define PHP_PHPIREDIS_VERSION "1.0"
#define PHP_PHPIREDIS_EXTNAME "phpiredis"
PHP_MINIT_FUNCTION(phpiredis);
PHP_FUNCTION(phpiredis_connect);
PHP_FUNCTION(phpiredis_pconnect);
PHP_FUNCTION(phpiredis_disconnect);
PHP_FUNCTION(phpiredis_command_bs);
PHP_FUNCTION(phpiredis_command);
PHP_FUNCTION(phpiredis_multi_command);
PHP_FUNCTION(phpiredis_multi_command_bs);
PHP_FUNCTION(phpiredis_format_command);
PHP_FUNCTION(phpiredis_reader_create);
PHP_FUNCTION(phpiredis_reader_reset);
PHP_FUNCTION(phpiredis_reader_feed);
PHP_FUNCTION(phpiredis_reader_get_state);
PHP_FUNCTION(phpiredis_reader_get_error);
PHP_FUNCTION(phpiredis_reader_get_reply);
PHP_FUNCTION(phpiredis_reader_destroy);
PHP_FUNCTION(phpiredis_reader_set_error_handler);
PHP_FUNCTION(phpiredis_reader_set_status_handler);
extern zend_module_entry phpiredis_module_entry;
#define phpext_phpiredis_ptr &phpiredis_module_entry
#endif
| #ifndef PHP_PHPIREDIS_H
#define PHP_PHPIREDIS_H 1
#define PHP_PHPIREDIS_VERSION "1.0.0"
#define PHP_PHPIREDIS_EXTNAME "phpiredis"
PHP_MINIT_FUNCTION(phpiredis);
PHP_FUNCTION(phpiredis_connect);
PHP_FUNCTION(phpiredis_pconnect);
PHP_FUNCTION(phpiredis_disconnect);
PHP_FUNCTION(phpiredis_command_bs);
PHP_FUNCTION(phpiredis_command);
PHP_FUNCTION(phpiredis_multi_command);
PHP_FUNCTION(phpiredis_multi_command_bs);
PHP_FUNCTION(phpiredis_format_command);
PHP_FUNCTION(phpiredis_reader_create);
PHP_FUNCTION(phpiredis_reader_reset);
PHP_FUNCTION(phpiredis_reader_feed);
PHP_FUNCTION(phpiredis_reader_get_state);
PHP_FUNCTION(phpiredis_reader_get_error);
PHP_FUNCTION(phpiredis_reader_get_reply);
PHP_FUNCTION(phpiredis_reader_destroy);
PHP_FUNCTION(phpiredis_reader_set_error_handler);
PHP_FUNCTION(phpiredis_reader_set_status_handler);
extern zend_module_entry phpiredis_module_entry;
#define phpext_phpiredis_ptr &phpiredis_module_entry
#endif
|
Adjust MSVC highlighting defines a bit. | #ifndef PS2AUTOTESTS_COMMON_H
#define PS2AUTOTESTS_COMMON_H
#include <stdio.h>
#include <tamtypes.h>
// Defines for MSVC highlighting. Not intended to actually compile with msc.
#ifdef _MSC_VER
void printf(const char *s, ...);
#define __attribute__(x)
#endif
#endif
| #ifndef PS2AUTOTESTS_COMMON_H
#define PS2AUTOTESTS_COMMON_H
// Defines for MSVC highlighting. Not intended to actually compile with msc.
#ifdef _MSC_VER
#define __STDC__
#define _EE
#define __attribute__(x)
#endif
#include <stdio.h>
#include <tamtypes.h>
#endif
|
Add NASDAQ OMX MoldUDP 1.02a | #ifndef LIBTRADING_OMX_MOLDUDP_MESSAGE_H
#define LIBTRADING_OMX_MOLDUDP_MESSAGE_H
#include "libtrading/types.h"
struct omx_moldudp_header {
char Session[10];
le32 SequenceNumber;
le16 MessageCount;
} packed;
struct omx_moldudp_message {
le16 MessageLength;
} packed;
struct omx_moldudp_request {
char Session[10];
le32 SequenceNumber;
le16 RequestedMessageCount;
} packed;
static inline struct omx_moldudp_message *omx_moldudp_payload(struct omx_moldudp_header *msg)
{
return (void *) msg + sizeof(struct omx_moldudp_header);
}
static inline void *omx_moldudp_message_payload(struct omx_moldudp_message *msg)
{
return (void *) msg + sizeof(struct omx_moldudp_message);
}
#endif
| |
Fix erroneous class Profile forward declaration to struct Profile. | #ifndef PROFILEDIALOG_H
#define PROFILEDIALOG_H
#include "ui_profiledialog.h"
#include <QDialog>
namespace trace { class Profile; }
class ProfileDialog : public QDialog, public Ui_ProfileDialog
{
Q_OBJECT
public:
ProfileDialog(QWidget *parent = 0);
~ProfileDialog();
void setProfile(trace::Profile* profile);
public slots:
void setVerticalScrollMax(int max);
void setHorizontalScrollMax(int max);
void tableDoubleClicked(const QModelIndex& index);
void selectionChanged(int64_t start, int64_t end);
signals:
void jumpToCall(int call);
private:
trace::Profile *m_profile;
};
#endif
| #ifndef PROFILEDIALOG_H
#define PROFILEDIALOG_H
#include "ui_profiledialog.h"
#include <QDialog>
namespace trace { struct Profile; }
class ProfileDialog : public QDialog, public Ui_ProfileDialog
{
Q_OBJECT
public:
ProfileDialog(QWidget *parent = 0);
~ProfileDialog();
void setProfile(trace::Profile* profile);
public slots:
void setVerticalScrollMax(int max);
void setHorizontalScrollMax(int max);
void tableDoubleClicked(const QModelIndex& index);
void selectionChanged(int64_t start, int64_t end);
signals:
void jumpToCall(int call);
private:
trace::Profile *m_profile;
};
#endif
|
Add function to convert a string to an integer | #include "hardware/packet.h"
#include "serial.h"
void btoa(int num, char *buf, int digits) {
int shift = digits - 1;
int current = pow(2, shift);
char digit[2];
while (current > 0) {
sprintf(digit, "%d", ((num & current) >> shift) & 1);
strncat(buf, digit, 1);
shift--;
current /= 2;
}
strcat(buf, "\0");
}
int main(int argc, char *argv[]) {
// 0: device
// 1: group
// 2: plug
// 3: status
char device[] = "\\\\.\\\\COM5";
if (serial_connect(device) == SERIAL_ERROR) {
printf("Failed to connect to serial device \"%s\"\n", device);
return 1;
}
struct Packet packet = { 1, 0, 3 };
if (serial_transmit(packet) == SERIAL_ERROR) {
printf("Failed to send data to serial device \"%s\"\n", device);
return 1;
}
serial_close();
return 0;
}
| #include "hardware/packet.h"
#include "serial.h"
void btoa(int num, char *buf, int digits) {
int shift = digits - 1;
int current = pow(2, shift);
char digit[2];
while (current > 0) {
sprintf(digit, "%d", ((num & current) >> shift) & 1);
strncat(buf, digit, 1);
shift--;
current /= 2;
}
strcat(buf, "\0");
}
int getvalue(char *text, char *name, int min, int max) {
char *end;
long result = strtol(text, &end, 10);
if (*end != '\0' || result < min || result > max) {
fprintf(stderr, "Invalid value for %s.\n", name);
return -1;
}
return result;
}
int main(int argc, char *argv[]) {
// 0: device
// 1: group
// 2: plug
// 3: status
char device[] = "\\\\.\\\\COM5";
if (serial_connect(device) == SERIAL_ERROR) {
printf("Failed to connect to serial device \"%s\"\n", device);
return 1;
}
struct Packet packet = { 1, 0, 3 };
if (serial_transmit(packet) == SERIAL_ERROR) {
printf("Failed to send data to serial device \"%s\"\n", device);
return 1;
}
serial_close();
return 0;
}
|
Fix the deliberate error, Travis should go green now | /*
* 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
*
* Random.h
* A simple random number generator.
* Copyright (C) 2012 Simon Newton
*/
#ifndef INCLUDE_OLA_MATH_RANDOM_H_
#define INCLUDE_OLA_MATH_RANDOM_H_
namespace ola {
namespace math {
/**
* @brief Seed the random number generator
*/
void InitRandom();
/**
* @brief Return a random number between lower and upper, inclusive. i.e.
* [lower, upper]
* @param lower the lower bound of the range the random number should be within
* @return the random number
*/
int Random(int lower, int upper);
} // namespace math
} // namespace ola
#endif // INCLUDE_OLA_MATH_RANDOM_H_
| /*
* 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
*
* Random.h
* A simple random number generator.
* Copyright (C) 2012 Simon Newton
*/
#ifndef INCLUDE_OLA_MATH_RANDOM_H_
#define INCLUDE_OLA_MATH_RANDOM_H_
namespace ola {
namespace math {
/**
* @brief Seed the random number generator
*/
void InitRandom();
/**
* @brief Return a random number between lower and upper, inclusive. i.e.
* [lower, upper]
* @param lower the lower bound of the range the random number should be within
* @param upper the upper bound of the range the random number should be within
* @return the random number
*/
int Random(int lower, int upper);
} // namespace math
} // namespace ola
#endif // INCLUDE_OLA_MATH_RANDOM_H_
|
Add a test for ObjC categories on Swift classes. | @import Base;
@import ObjectiveC;
BaseClass *getBaseClassObjC();
void useBaseClassObjC(BaseClass *);
@interface UserClass : NSObject <BaseProto>
@end
id <BaseProto> getBaseProtoObjC();
void useBaseProtoObjC(id <BaseProto>);
| @import Base;
@import ObjectiveC;
BaseClass *getBaseClassObjC();
void useBaseClassObjC(BaseClass *);
@interface UserClass : NSObject <BaseProto>
@end
id <BaseProto> getBaseProtoObjC();
void useBaseProtoObjC(id <BaseProto>);
@interface BaseClass (ObjCExtensions)
- (void)categoryMethod;
@end
|
Make MBContactPickerModelProtocol properties read-only, since that is all that the picker implementation requires, and avoids implementors having to either provide setters, or ignore the Xcode warnings about them not being auto-generated. | //
// MBContactModel.h
// MBContactPicker
//
// Created by Matt Bowman on 12/13/13.
// Copyright (c) 2013 Citrrus, LLC. All rights reserved.
//
#import <Foundation/Foundation.h>
@protocol MBContactPickerModelProtocol <NSObject>
@required
@property (nonatomic, copy) NSString *contactTitle;
@optional
@property (nonatomic, copy) NSString *contactSubtitle;
@property (nonatomic) UIImage *contactImage;
@end
@interface MBContactModel : NSObject <MBContactPickerModelProtocol>
@property (nonatomic, copy) NSString *contactTitle;
@property (nonatomic, copy) NSString *contactSubtitle;
@property (nonatomic) UIImage *contactImage;
@end
| //
// MBContactModel.h
// MBContactPicker
//
// Created by Matt Bowman on 12/13/13.
// Copyright (c) 2013 Citrrus, LLC. All rights reserved.
//
#import <Foundation/Foundation.h>
@protocol MBContactPickerModelProtocol <NSObject>
@required
@property (readonly, nonatomic, copy) NSString *contactTitle;
@optional
@property (readonly, nonatomic, copy) NSString *contactSubtitle;
@property (readonly, nonatomic) UIImage *contactImage;
@end
@interface MBContactModel : NSObject <MBContactPickerModelProtocol>
@property (nonatomic, copy) NSString *contactTitle;
@property (nonatomic, copy) NSString *contactSubtitle;
@property (nonatomic) UIImage *contactImage;
@end
|
Define fminf for platforms that lack it | /****************************************************************************
*
* Copyright (c) 2008 by Casey Duncan and contributors
* All Rights Reserved.
*
* This software is subject to the provisions of the MIT License
* A copy of the license should accompany this distribution.
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
*
****************************************************************************/
/* Renderer shared code
*
* $Id$
*/
#ifndef _RENDERER_H_
#define _RENDERER_H_
typedef struct {
PyObject_HEAD
Py_ssize_t size;
float *data;
} FloatArrayObject;
/* Return true if o is a bon-a-fide FloatArrayObject */
int FloatArrayObject_Check(FloatArrayObject *o);
FloatArrayObject *
FloatArray_new(Py_ssize_t size);
FloatArrayObject *
generate_default_2D_tex_coords(GroupObject *pgroup);
/* Initialize the glew OpenGL extension manager
If glew has already been initialized, do nothing */
int
glew_initialize(void);
#endif
| /****************************************************************************
*
* Copyright (c) 2008 by Casey Duncan and contributors
* All Rights Reserved.
*
* This software is subject to the provisions of the MIT License
* A copy of the license should accompany this distribution.
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
*
****************************************************************************/
/* Renderer shared code
*
* $Id$
*/
#ifndef _RENDERER_H_
#define _RENDERER_H_
typedef struct {
PyObject_HEAD
Py_ssize_t size;
float *data;
} FloatArrayObject;
/* Return true if o is a bon-a-fide FloatArrayObject */
int FloatArrayObject_Check(FloatArrayObject *o);
FloatArrayObject *
FloatArray_new(Py_ssize_t size);
FloatArrayObject *
generate_default_2D_tex_coords(GroupObject *pgroup);
/* Initialize the glew OpenGL extension manager
If glew has already been initialized, do nothing */
int
glew_initialize(void);
#endif
// Windows lacks fminf
#ifndef fminf
#define fminf(x, y) (((x) < (y)) ? (x) : (y))
#endif
|
Make enum padding types one less in value so that they are INT_MAX | /*
* Copyright 2014, NICTA
*
* This software may be distributed and modified according to the terms of
* the BSD 2-Clause license. Note that NO WARRANTY is provided.
* See "LICENSE_BSD2.txt" for details.
*
* @TAG(NICTA_BSD)
*/
#ifndef __LIBSEL4_MACROS_H
#define __LIBSEL4_MACROS_H
/*
* Some compilers attempt to pack enums into the smallest possible type.
* For ABI compatability with the kernel, we need to ensure they remain
* the same size as an 'int'.
*/
#define SEL4_FORCE_LONG_ENUM(type) \
_enum_pad_ ## type = (1U << ((sizeof(int)*8) - 1))
#ifndef CONST
#define CONST __attribute__((__const__))
#endif
#ifndef PURE
#define PURE __attribute__((__pure__))
#endif
#endif
| /*
* Copyright 2014, NICTA
*
* This software may be distributed and modified according to the terms of
* the BSD 2-Clause license. Note that NO WARRANTY is provided.
* See "LICENSE_BSD2.txt" for details.
*
* @TAG(NICTA_BSD)
*/
#ifndef __LIBSEL4_MACROS_H
#define __LIBSEL4_MACROS_H
/*
* Some compilers attempt to pack enums into the smallest possible type.
* For ABI compatability with the kernel, we need to ensure they remain
* the same size as an 'int'.
*/
#define SEL4_FORCE_LONG_ENUM(type) \
_enum_pad_ ## type = (1U << ((sizeof(int)*8) - 1)) - 1
#ifndef CONST
#define CONST __attribute__((__const__))
#endif
#ifndef PURE
#define PURE __attribute__((__pure__))
#endif
#endif
|
Allow building with the 10.5 SDK. | //
// Created by Vadim Shpakovski on 4/22/11.
// Copyright 2011 Shpakovski. All rights reserved.
//
extern NSString *const kMASPreferencesWindowControllerDidChangeViewNotification;
@interface MASPreferencesWindowController : NSWindowController <NSToolbarDelegate, NSWindowDelegate>
{
@private
NSArray *_viewControllers;
NSString *_title;
id _lastSelectedController;
}
@property (nonatomic, readonly) NSArray *viewControllers;
@property (nonatomic, readonly) NSUInteger indexOfSelectedController;
@property (nonatomic, readonly) NSViewController *selectedViewController;
@property (nonatomic, readonly) NSString *title;
- (id)initWithViewControllers:(NSArray *)viewControllers;
- (id)initWithViewControllers:(NSArray *)viewControllers title:(NSString *)title;
- (void)selectControllerAtIndex:(NSUInteger)controllerIndex withAnimation:(BOOL)animate;
- (IBAction)goNextTab:(id)sender;
- (IBAction)goPreviousTab:(id)sender;
- (void)resetFirstResponderInView:(NSView *)view;
@end
| //
// Created by Vadim Shpakovski on 4/22/11.
// Copyright 2011 Shpakovski. All rights reserved.
//
extern NSString *const kMASPreferencesWindowControllerDidChangeViewNotification;
#if MAC_OS_X_VERSION_MAX_ALLOWED > MAC_OS_X_VERSION_10_5
@interface MASPreferencesWindowController : NSWindowController <NSToolbarDelegate, NSWindowDelegate>
#else
@interface MASPreferencesWindowController : NSWindowController
#endif
{
@private
NSArray *_viewControllers;
NSString *_title;
id _lastSelectedController;
}
@property (nonatomic, readonly) NSArray *viewControllers;
@property (nonatomic, readonly) NSUInteger indexOfSelectedController;
@property (nonatomic, readonly) NSViewController *selectedViewController;
@property (nonatomic, readonly) NSString *title;
- (id)initWithViewControllers:(NSArray *)viewControllers;
- (id)initWithViewControllers:(NSArray *)viewControllers title:(NSString *)title;
- (void)selectControllerAtIndex:(NSUInteger)controllerIndex withAnimation:(BOOL)animate;
- (IBAction)goNextTab:(id)sender;
- (IBAction)goPreviousTab:(id)sender;
- (void)resetFirstResponderInView:(NSView *)view;
@end
|
Fix up the FOO_EXPORT stuff, per our discussion on k-c-d. CCMAIL: Ch.Ehrlicher@gmx.de,thiago@kde.org | /* This file is part of the KDE project
Copyright (C) 2007 David Faure <faure@kde.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#ifndef KTEXTEDITOR_EXPORT_H
#define KTEXTEDITOR_EXPORT_H
/* needed for KDE_EXPORT and KDE_IMPORT macros */
#include <kdemacros.h>
/* We use _WIN32/_WIN64 instead of Q_OS_WIN so that this header can be used from C files too */
#if defined _WIN32 || defined _WIN64
#ifndef KTEXTEDITOR_EXPORT
# if defined(MAKE_KTEXTEDITOR_LIB)
/* We are building this library */
# define KTEXTEDITOR_EXPORT KDE_EXPORT
# else
/* We are using this library */
# define KTEXTEDITOR_EXPORT KDE_IMPORT
# endif
#endif
#else /* UNIX */
#define KTEXTEDITOR_EXPORT KDE_EXPORT
#endif
#endif
| /* This file is part of the KDE project
Copyright (C) 2007 David Faure <faure@kde.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#ifndef KTEXTEDITOR_EXPORT_H
#define KTEXTEDITOR_EXPORT_H
/* needed for KDE_EXPORT and KDE_IMPORT macros */
#include <kdemacros.h>
#ifndef KTEXTEDITOR_EXPORT
# if defined(MAKE_KTEXTEDITOR_LIB)
/* We are building this library */
# define KTEXTEDITOR_EXPORT KDE_EXPORT
# else
/* We are using this library */
# define KTEXTEDITOR_EXPORT KDE_IMPORT
# endif
#endif
#endif
|
Remove "in progress" sleep mode code for PIC32 for now. | #include "power.h"
#define SLEEP_MODE_ENABLE_BIT 4
void initializePower() {
}
void updatePower() {
}
void enterLowPowerMode() {
// When WAIT instruction is executed, go into SLEEP mode
OSCCONSET = (1 << SLEEP_MODE_ENABLE_BIT);
asm("wait");
// TODO if we wake up, do we resume with the PC right here? there's an RCON
// register with bits to indicate if we woke up from sleep. we'll need to
// re-run setup, potentially.
//C1CONSET / C1CONbits.x
}
| #include "power.h"
void initializePower() {
}
void updatePower() {
}
void enterLowPowerMode() {
}
|
Apply new naming convention to mbed TLS macros | /**
* Copyright (C) 2006-2016, ARM Limited, All Rights Reserved
* 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.
*
* This file is part of mbed TLS (https://tls.mbed.org)
*/
#if defined(DEVICE_TRNG)
#define MBEDTLS_ENTROPY_HARDWARE_ALT
#endif
#if defined(MBEDTLS_HW_SUPPORT)
#include "mbedtls_device.h"
#endif
| /**
* Copyright (C) 2006-2016, ARM Limited, All Rights Reserved
* 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.
*
* This file is part of mbed TLS (https://tls.mbed.org)
*/
#if defined(DEVICE_TRNG)
#define MBEDTLS_ENTROPY_HARDWARE_ALT
#endif
#if defined(MBEDTLS_CONFIG_HW_SUPPORT)
#include "mbedtls_device.h"
#endif
|
Add explicit define for rb_ary_subseq | #ifndef RBX_CAPI_RUBY_DEFINES_H
#define RBX_CAPI_RUBY_DEFINES_H
/* Stub file provided for C extensions that expect it. All regular
* defines and prototypes are in ruby.h
*/
#define RUBY 1
#define RUBINIUS 1
#define HAVE_STDARG_PROTOTYPES 1
/* These are defines directly related to MRI C-API symbols that the
* mkmf.rb discovery code (e.g. have_func("rb_str_set_len")) would
* attempt to find by linking against libruby. Rubinius does not
* have an appropriate lib to link against, so we are adding these
* explicit defines for now.
*/
#define HAVE_RB_STR_SET_LEN 1
#define HAVE_RB_STR_NEW5 1
#define HAVE_RB_STR_NEW_WITH_CLASS 1
#define HAVE_RB_DEFINE_ALLOC_FUNC 1
#define HAVE_RB_HASH_FOREACH 1
#define HAVE_RB_HASH_ASET 1
#define HAVE_RUBY_ENCODING_H 1
#define HAVE_RB_ENCDB_ALIAS 1
#endif
| #ifndef RBX_CAPI_RUBY_DEFINES_H
#define RBX_CAPI_RUBY_DEFINES_H
/* Stub file provided for C extensions that expect it. All regular
* defines and prototypes are in ruby.h
*/
#define RUBY 1
#define RUBINIUS 1
#define HAVE_STDARG_PROTOTYPES 1
/* These are defines directly related to MRI C-API symbols that the
* mkmf.rb discovery code (e.g. have_func("rb_str_set_len")) would
* attempt to find by linking against libruby. Rubinius does not
* have an appropriate lib to link against, so we are adding these
* explicit defines for now.
*/
#define HAVE_RB_STR_SET_LEN 1
#define HAVE_RB_STR_NEW5 1
#define HAVE_RB_STR_NEW_WITH_CLASS 1
#define HAVE_RB_DEFINE_ALLOC_FUNC 1
#define HAVE_RB_HASH_FOREACH 1
#define HAVE_RB_HASH_ASET 1
#define HAVE_RUBY_ENCODING_H 1
#define HAVE_RB_ENCDB_ALIAS 1
#define HAVE_RB_ARY_SUBSEQ 1
#endif
|
Load hololens demo page by default | #pragma once
#define DEFAULT_URL L"http://paulrouget.com/test/bbjs/basic/";
| #pragma once
#define DEFAULT_URL L"https://servo.org/hl-home/";
|
Hide a static function to CINT. With this fix g4root compiles OK. | // @(#)root/base:$Name: $:$Id: TVersionCheck.h,v 1.2 2007/05/10 16:04:32 rdm Exp $
// Author: Fons Rademakers 9/5/2007
/*************************************************************************
* Copyright (C) 1995-2007, Rene Brun and Fons Rademakers. *
* All rights reserved. *
* *
* For the licensing terms see $ROOTSYS/LICENSE. *
* For the list of contributors see $ROOTSYS/README/CREDITS. *
*************************************************************************/
#ifndef ROOT_TVersionCheck
#define ROOT_TVersionCheck
//////////////////////////////////////////////////////////////////////////
// //
// TVersionCheck //
// //
// Used to check if the shared library or plugin is compatible with //
// the current version of ROOT. //
// //
//////////////////////////////////////////////////////////////////////////
#ifndef ROOT_RVersion
#include "RVersion.h"
#endif
class TVersionCheck {
public:
TVersionCheck(int versionCode); // implemented in TSystem.cxx
};
static TVersionCheck gVersionCheck(ROOT_VERSION_CODE);
#endif
| // @(#)root/base:$Name: $:$Id: TVersionCheck.h,v 1.3 2007/05/10 18:16:58 rdm Exp $
// Author: Fons Rademakers 9/5/2007
/*************************************************************************
* Copyright (C) 1995-2007, Rene Brun and Fons Rademakers. *
* All rights reserved. *
* *
* For the licensing terms see $ROOTSYS/LICENSE. *
* For the list of contributors see $ROOTSYS/README/CREDITS. *
*************************************************************************/
#ifndef ROOT_TVersionCheck
#define ROOT_TVersionCheck
//////////////////////////////////////////////////////////////////////////
// //
// TVersionCheck //
// //
// Used to check if the shared library or plugin is compatible with //
// the current version of ROOT. //
// //
//////////////////////////////////////////////////////////////////////////
#ifndef ROOT_RVersion
#include "RVersion.h"
#endif
class TVersionCheck {
public:
TVersionCheck(int versionCode); // implemented in TSystem.cxx
};
#ifndef __CINT__
static TVersionCheck gVersionCheck(ROOT_VERSION_CODE);
#endif
#endif
|
Switch version numbers to 0.8.1.99 | #ifndef CLIENTVERSION_H
#define CLIENTVERSION_H
//
// client versioning
//
// These need to be macros, as version.cpp's and bitcoin-qt.rc's voodoo requires it
#define CLIENT_VERSION_MAJOR 0
#define CLIENT_VERSION_MINOR 8
#define CLIENT_VERSION_REVISION 0
#define CLIENT_VERSION_BUILD 0
// Set to true for release, false for prerelease or test build
#define CLIENT_VERSION_IS_RELEASE true
// Converts the parameter X to a string after macro replacement on X has been performed.
// Don't merge these into one macro!
#define STRINGIZE(X) DO_STRINGIZE(X)
#define DO_STRINGIZE(X) #X
#endif // CLIENTVERSION_H
| #ifndef CLIENTVERSION_H
#define CLIENTVERSION_H
//
// client versioning
//
// These need to be macros, as version.cpp's and bitcoin-qt.rc's voodoo requires it
#define CLIENT_VERSION_MAJOR 0
#define CLIENT_VERSION_MINOR 8
#define CLIENT_VERSION_REVISION 1
#define CLIENT_VERSION_BUILD 99
// Set to true for release, false for prerelease or test build
#define CLIENT_VERSION_IS_RELEASE false
// Converts the parameter X to a string after macro replacement on X has been performed.
// Don't merge these into one macro!
#define STRINGIZE(X) DO_STRINGIZE(X)
#define DO_STRINGIZE(X) #X
#endif // CLIENTVERSION_H
|
Add example for unsoundness for calloc | // PARAM: --set ana.malloc.unique_address_count 1
#include<assert.h>
#include<stdlib.h>
int main() {
int* arr = calloc(5,sizeof(int));
arr[0] = 3;
assert(arr[2] == 0); //UNKNOWN
}
| |
Remove useless tokens at the end of a preprocessor directive | struct PureClangType {
int x;
int y;
};
#ifndef SWIFT_CLASS_EXTRA
# define SWIFT_CLASS_EXTRA
#endif
#ifndef SWIFT_CLASS(SWIFT_NAME)
# define SWIFT_CLASS(SWIFT_NAME) SWIFT_CLASS_EXTRA
#endif
SWIFT_CLASS("SwiftClass")
__attribute__((objc_root_class))
@interface SwiftClass
@end
@interface SwiftClass (Category)
- (void)categoryMethod:(struct PureClangType)arg;
@end
SWIFT_CLASS("BOGUS")
@interface BogusClass
@end
| struct PureClangType {
int x;
int y;
};
#ifndef SWIFT_CLASS_EXTRA
# define SWIFT_CLASS_EXTRA
#endif
#ifndef SWIFT_CLASS
# define SWIFT_CLASS(SWIFT_NAME) SWIFT_CLASS_EXTRA
#endif
SWIFT_CLASS("SwiftClass")
__attribute__((objc_root_class))
@interface SwiftClass
@end
@interface SwiftClass (Category)
- (void)categoryMethod:(struct PureClangType)arg;
@end
SWIFT_CLASS("BOGUS")
@interface BogusClass
@end
|
Enable printf in unit tests regardless of DEBUG flag status. | #include "log.h"
#include <stdio.h>
void debug(const char* format, ...) {
#ifdef __DEBUG__
vprintf(format, args);
#endif // __DEBUG__
}
void initializeLogging() { }
| #include "log.h"
#include <stdio.h>
#include <stdarg.h>
void debug(const char* format, ...) {
va_list args;
va_start(args, format);
vprintf(format, args);
va_end(args);
}
void initializeLogging() { }
|
Use the mobile authorization page. | #ifndef O1DROPBOX_H
#define O1DROPBOX_H
#include "o1.h"
class O1Dropbox: public O1 {
Q_OBJECT
public:
explicit O1Dropbox(QObject *parent = 0): O1(parent) {
setRequestTokenUrl(QUrl("https://api.dropbox.com/1/oauth/request_token"));
setAuthorizeUrl(QUrl("https://www.dropbox.com/1/oauth/authorize"));
setAccessTokenUrl(QUrl("https://api.dropbox.com/1/oauth/access_token"));
setLocalPort(1965);
}
};
#endif // O1DROPBOX_H
| #ifndef O1DROPBOX_H
#define O1DROPBOX_H
#include "o1.h"
class O1Dropbox: public O1 {
Q_OBJECT
public:
explicit O1Dropbox(QObject *parent = 0): O1(parent) {
setRequestTokenUrl(QUrl("https://api.dropbox.com/1/oauth/request_token"));
setAuthorizeUrl(QUrl("https://www.dropbox.com/1/oauth/authorize?display=mobile"));
setAccessTokenUrl(QUrl("https://api.dropbox.com/1/oauth/access_token"));
setLocalPort(1965);
}
};
#endif // O1DROPBOX_H
|
Fix typo in header guard | /*
* Copyright 2008-2009 Katholieke Universiteit Leuven
*
* Use of this software is governed by the MIT license
*
* Written by Sven Verdoolaege, K.U.Leuven, Departement
* Computerwetenschappen, Celestijnenlaan 200A, B-3001 Leuven, Belgium
*/
#ifndef ISL_SAMPLE_H
#define ISL_SAMPLE
#include <isl/set.h>
#include <isl_tab.h>
#if defined(__cplusplus)
extern "C" {
#endif
__isl_give isl_vec *isl_basic_set_sample_vec(__isl_take isl_basic_set *bset);
struct isl_vec *isl_basic_set_sample_bounded(struct isl_basic_set *bset);
__isl_give isl_vec *isl_basic_set_sample_with_cone(
__isl_take isl_basic_set *bset, __isl_take isl_basic_set *cone);
__isl_give isl_basic_set *isl_basic_set_from_vec(__isl_take isl_vec *vec);
int isl_tab_set_initial_basis_with_cone(struct isl_tab *tab,
struct isl_tab *tab_cone);
struct isl_vec *isl_tab_sample(struct isl_tab *tab);
#if defined(__cplusplus)
}
#endif
#endif
| /*
* Copyright 2008-2009 Katholieke Universiteit Leuven
*
* Use of this software is governed by the MIT license
*
* Written by Sven Verdoolaege, K.U.Leuven, Departement
* Computerwetenschappen, Celestijnenlaan 200A, B-3001 Leuven, Belgium
*/
#ifndef ISL_SAMPLE_H
#define ISL_SAMPLE_H
#include <isl/set.h>
#include <isl_tab.h>
#if defined(__cplusplus)
extern "C" {
#endif
__isl_give isl_vec *isl_basic_set_sample_vec(__isl_take isl_basic_set *bset);
struct isl_vec *isl_basic_set_sample_bounded(struct isl_basic_set *bset);
__isl_give isl_vec *isl_basic_set_sample_with_cone(
__isl_take isl_basic_set *bset, __isl_take isl_basic_set *cone);
__isl_give isl_basic_set *isl_basic_set_from_vec(__isl_take isl_vec *vec);
int isl_tab_set_initial_basis_with_cone(struct isl_tab *tab,
struct isl_tab *tab_cone);
struct isl_vec *isl_tab_sample(struct isl_tab *tab);
#if defined(__cplusplus)
}
#endif
#endif
|
Add a testcase for Radar 8228022. Make sure the -Wvector-conversions does not cause unnecessary warnings when using Neon intrinsics with the correct types. | // RUN: %clang_cc1 -triple thumbv7-apple-darwin10 -target-cpu cortex-a8 -fsyntax-only -Wvector-conversions -verify %s
// RUN: %clang_cc1 -x c++ -triple thumbv7-apple-darwin10 -target-cpu cortex-a8 -fsyntax-only -Wvector-conversions -verify %s
#include <arm_neon.h>
// Radar 8228022: Should not report incompatible vector types.
int32x2_t test(int32x2_t x) {
return vshr_n_s32(x, 31);
}
| |
Add contrived example for register alias failure source. |
int main()
{
int r;
__asm("movl $0x87654321, %%eax; movb $0x12, %%al; movb $0x34, %%ah" : "=a" (r));
printf("%08X\n", r);
}
| |
Fix incompatible types warning from VS 2005 (Oliver Schneider) | /**
* \file os_uuid.c
* \brief Create a new UUID.
* \author Copyright (c) 2002-2008 Jason Perkins and the Premake project
*/
#include "premake.h"
#if PLATFORM_WINDOWS
#include <Objbase.h>
#endif
int os_uuid(lua_State* L)
{
unsigned char bytes[16];
char uuid[38];
#if PLATFORM_WINDOWS
CoCreateGuid((char*)bytes);
#else
int result;
/* not sure how to get a UUID here, so I fake it */
FILE* rnd = fopen("/dev/urandom", "rb");
result = fread(bytes, 16, 1, rnd);
fclose(rnd);
if (!result)
return 0;
#endif
sprintf(uuid, "%02X%02X%02X%02X-%02X%02X-%02X%02X-%02X%02X-%02X%02X%02X%02X%02X%02X",
bytes[0], bytes[1], bytes[2], bytes[3],
bytes[4], bytes[5],
bytes[6], bytes[7],
bytes[8], bytes[9],
bytes[10], bytes[11], bytes[12], bytes[13], bytes[14], bytes[15]);
lua_pushstring(L, uuid);
return 1;
}
| /**
* \file os_uuid.c
* \brief Create a new UUID.
* \author Copyright (c) 2002-2008 Jason Perkins and the Premake project
*/
#include "premake.h"
#if PLATFORM_WINDOWS
#include <Objbase.h>
#endif
int os_uuid(lua_State* L)
{
unsigned char bytes[16];
char uuid[38];
#if PLATFORM_WINDOWS
CoCreateGuid((GUID*)bytes);
#else
int result;
/* not sure how to get a UUID here, so I fake it */
FILE* rnd = fopen("/dev/urandom", "rb");
result = fread(bytes, 16, 1, rnd);
fclose(rnd);
if (!result)
return 0;
#endif
sprintf(uuid, "%02X%02X%02X%02X-%02X%02X-%02X%02X-%02X%02X-%02X%02X%02X%02X%02X%02X",
bytes[0], bytes[1], bytes[2], bytes[3],
bytes[4], bytes[5],
bytes[6], bytes[7],
bytes[8], bytes[9],
bytes[10], bytes[11], bytes[12], bytes[13], bytes[14], bytes[15]);
lua_pushstring(L, uuid);
return 1;
}
|
Improve NSView auto layout category documentation. | //
// NSView+CDAutoLayout.h
// CDKitt
//
// Created by Aron Cedercrantz on 04-06-2013.
// Copyright (c) 2013 Aron Cedercrantz. All rights reserved.
//
#import <Cocoa/Cocoa.h>
@interface NSView (CDAutoLayout)
/**
* Add the given view to this view as a subview and autoresizes it to fill the
* receiving view.
*/
- (void)cd_addFillingAutoresizedSubview:(NSView *)subview;
@end
| //
// NSView+CDAutoLayout.h
// CDKitt
//
// Created by Aron Cedercrantz on 04-06-2013.
// Copyright (c) 2013 Aron Cedercrantz. All rights reserved.
//
#import <Cocoa/Cocoa.h>
@interface NSView (CDAutoLayout)
/**
* Add the given view to this view as a subview and autoresizes it to fill the
* receiving view.
*
* @param subview The view which should be added as a subview of the reciever.
* May be `nil`.
*/
- (void)cd_addFillingAutoresizedSubview:(NSView *)subview;
@end
|
Add test case for casts from double to unsigned int | #include <limits.h>
#include <stdio.h>
#include <stdlib.h>
void testCase(double value, unsigned int expected) {
unsigned int result = (unsigned int)value;
if (result != expected) {
printf("%d\n", result);
abort();
}
}
int main() {
testCase(UINT_MAX, -1);
testCase(UINT_MAX - 0.03, -2);
testCase(UINT_MAX - 1, -2);
testCase(UINT_MAX - 2, -3);
testCase(UINT_MAX - 5, -6);
testCase(UINT_MAX - 2.5, -4);
testCase(UINT_MAX - 2.4, -4);
testCase(UINT_MAX - 2.6, -4);
testCase(UINT_MAX / 2, 2147483647);
testCase(UINT_MAX / 2 + 1, -2147483648);
testCase(UINT_MAX / 2 - 1.0, 2147483646);
testCase(UINT_MAX / 2 + 1.999999999, -2147483647);
testCase(-1, -1);
testCase(0, 0);
testCase(1.5, 1);
testCase(INT_MAX + 1, -2147483648);
testCase(INT_MAX, 2147483647);
}
| |
Allow help module to be rebooted | #include <kotaka/paths.h>
inherit LIB_INITD;
inherit UTILITY_COMPILE;
static void create()
{
load_dir("obj", 1);
load_dir("sys", 1);
}
| #include <kotaka/paths.h>
#include <kotaka/privilege.h>
#include <kotaka/bigstruct.h>
#include <kotaka/log.h>
inherit LIB_INITD;
inherit UTILITY_COMPILE;
static void create()
{
load_dir("obj", 1);
load_dir("sys", 1);
}
void full_reset()
{
object turkeylist;
object cursor;
object first;
object this;
ACCESS_CHECK(PRIVILEGED());
turkeylist = new_object(BIGSTRUCT_DEQUE_LWO);
this = this_object();
cursor = KERNELD->first_link("Help");
first = cursor;
do {
LOGD->post_message("help", LOG_DEBUG, "Listing " + object_name(cursor));
turkeylist->push_back(cursor);
cursor = KERNELD->next_link(cursor);
} while (cursor != first);
while (!turkeylist->empty()) {
object turkey;
turkey = turkeylist->get_front();
turkeylist->pop_front();
if (!turkey || turkey == this) {
/* don't self destruct or double destruct */
continue;
}
destruct_object(turkey);
}
load_dir("obj", 1);
load_dir("sys", 1);
}
|
Switch pattern's check for NULL to ternary operator | #ifndef SRC_TAG_H_
#define SRC_TAG_H_
#include <string>
#include "readtags.h"
class Tag {
public:
Tag(tagEntry entry) {
name = entry.name;
file = entry.file;
kind = entry.kind != NULL ? entry.kind : "";
if (entry.address.pattern != NULL)
pattern = entry.address.pattern;
else
pattern = "";
}
std::string name;
std::string file;
std::string kind;
std::string pattern;
};
#endif // SRC_TAG_H_
| #ifndef SRC_TAG_H_
#define SRC_TAG_H_
#include <string>
#include "readtags.h"
class Tag {
public:
Tag(tagEntry entry) {
name = entry.name;
file = entry.file;
kind = entry.kind != NULL ? entry.kind : "";
pattern = entry.address.pattern != NULL ? entry.address.pattern : "";
}
std::string name;
std::string file;
std::string kind;
std::string pattern;
};
#endif // SRC_TAG_H_
|
Make this work again: record the stevedore in the storage object. | /*
* $Id$
*
* Storage method based on malloc(3)
*/
#include <assert.h>
#include <stdlib.h>
#include <sys/queue.h>
#include <pthread.h>
#include "cache.h"
struct sma {
struct storage s;
};
static struct storage *
sma_alloc(struct stevedore *st __unused, unsigned size)
{
struct sma *sma;
sma = calloc(sizeof *sma, 1);
assert(sma != NULL);
sma->s.priv = sma;
sma->s.ptr = malloc(size);
assert(sma->s.ptr != NULL);
sma->s.len = size;
sma->s.space = size;
return (&sma->s);
}
static void
sma_free(struct storage *s)
{
struct sma *sma;
sma = s->priv;
free(sma->s.ptr);
free(sma);
}
struct stevedore sma_stevedore = {
"malloc",
NULL, /* init */
NULL, /* open */
sma_alloc,
NULL, /* trim */
sma_free
};
| /*
* $Id$
*
* Storage method based on malloc(3)
*/
#include <assert.h>
#include <stdlib.h>
#include <sys/queue.h>
#include <pthread.h>
#include "cache.h"
struct sma {
struct storage s;
};
static struct storage *
sma_alloc(struct stevedore *st, unsigned size)
{
struct sma *sma;
sma = calloc(sizeof *sma, 1);
assert(sma != NULL);
sma->s.priv = sma;
sma->s.ptr = malloc(size);
assert(sma->s.ptr != NULL);
sma->s.len = size;
sma->s.space = size;
sma->s.stevedore = st;
return (&sma->s);
}
static void
sma_free(struct storage *s)
{
struct sma *sma;
sma = s->priv;
free(sma->s.ptr);
free(sma);
}
struct stevedore sma_stevedore = {
"malloc",
NULL, /* init */
NULL, /* open */
sma_alloc,
NULL, /* trim */
sma_free
};
|
Use the option "+" to force the new style Streamer for all classes in bench. | #ifdef __CINT__
#pragma link off all globals;
#pragma link off all classes;
#pragma link off all functions;
#pragma link C++ class THit!+;
#pragma link C++ class TObjHit+;
#pragma link C++ class TSTLhit;
#pragma link C++ class TSTLhitList;
#pragma link C++ class TSTLhitDeque;
#pragma link C++ class TSTLhitSet;
#pragma link C++ class TSTLhitMultiset;
#pragma link C++ class TSTLhitMap;
#pragma link C++ class TSTLhitMultiMap;
//#pragma link C++ class TSTLhitHashSet;
//#pragma link C++ class TSTLhitHashMultiset;
#pragma link C++ class pair<int,THit>;
#pragma link C++ class TSTLhitStar;
#pragma link C++ class TSTLhitStarList;
#pragma link C++ class TSTLhitStarDeque;
#pragma link C++ class TSTLhitStarSet;
#pragma link C++ class TSTLhitStarMultiSet;
#pragma link C++ class TSTLhitStarMap;
#pragma link C++ class TSTLhitStarMultiMap;
#pragma link C++ class pair<int,THit*>;
#pragma link C++ class TCloneshit+;
#endif
| #ifdef __CINT__
#pragma link off all globals;
#pragma link off all classes;
#pragma link off all functions;
#pragma link C++ class THit!+;
#pragma link C++ class TObjHit+;
#pragma link C++ class TSTLhit+;
#pragma link C++ class TSTLhitList+;
#pragma link C++ class TSTLhitDeque+;
#pragma link C++ class TSTLhitSet+;
#pragma link C++ class TSTLhitMultiset+;
#pragma link C++ class TSTLhitMap+;
#pragma link C++ class TSTLhitMultiMap+;
//#pragma link C++ class TSTLhitHashSet;
//#pragma link C++ class TSTLhitHashMultiset;
#pragma link C++ class pair<int,THit>+;
#pragma link C++ class TSTLhitStar+;
#pragma link C++ class TSTLhitStarList+;
#pragma link C++ class TSTLhitStarDeque+;
#pragma link C++ class TSTLhitStarSet+;
#pragma link C++ class TSTLhitStarMultiSet+;
#pragma link C++ class TSTLhitStarMap+;
#pragma link C++ class TSTLhitStarMultiMap+;
#pragma link C++ class pair<int,THit*>+;
#pragma link C++ class TCloneshit+;
#endif
|
Fix compilation on win8 : include nan before oniguruma | #ifndef SRC_ONIG_RESULT_H_
#define SRC_ONIG_RESULT_H_
#include "oniguruma.h"
class OnigResult {
public:
explicit OnigResult(OnigRegion* region, int indexInScanner);
~OnigResult();
int Count();
int LocationAt(int index);
int LengthAt(int index);
int Index() { return indexInScanner; }
void SetIndex(int newIndex) { indexInScanner = newIndex; }
private:
OnigResult(const OnigResult&); // Disallow copying
OnigResult &operator=(const OnigResult&); // Disallow copying
OnigRegion *region_;
int indexInScanner;
};
#endif // SRC_ONIG_RESULT_H_
| #ifndef SRC_ONIG_RESULT_H_
#define SRC_ONIG_RESULT_H_
#include "nan.h"
#include "oniguruma.h"
class OnigResult {
public:
explicit OnigResult(OnigRegion* region, int indexInScanner);
~OnigResult();
int Count();
int LocationAt(int index);
int LengthAt(int index);
int Index() { return indexInScanner; }
void SetIndex(int newIndex) { indexInScanner = newIndex; }
private:
OnigResult(const OnigResult&); // Disallow copying
OnigResult &operator=(const OnigResult&); // Disallow copying
OnigRegion *region_;
int indexInScanner;
};
#endif // SRC_ONIG_RESULT_H_
|
Remove no longer valid comment | #ifndef CLIENTMODEL_H
#define CLIENTMODEL_H
#include <QObject>
class OptionsModel;
class AddressTableModel;
class TransactionTableModel;
class CWallet;
QT_BEGIN_NAMESPACE
class QDateTime;
QT_END_NAMESPACE
// Interface to Bitcoin network client
class ClientModel : public QObject
{
Q_OBJECT
public:
// The only reason that this constructor takes a wallet is because
// the global client settings are stored in the main wallet.
explicit ClientModel(OptionsModel *optionsModel, QObject *parent = 0);
OptionsModel *getOptionsModel();
int getNumConnections() const;
int getNumBlocks() const;
QDateTime getLastBlockDate() const;
// Return true if client connected to testnet
bool isTestNet() const;
// Return true if core is doing initial block download
bool inInitialBlockDownload() const;
// Return conservative estimate of total number of blocks, or 0 if unknown
int getTotalBlocksEstimate() const;
QString formatFullVersion() const;
private:
OptionsModel *optionsModel;
int cachedNumConnections;
int cachedNumBlocks;
signals:
void numConnectionsChanged(int count);
void numBlocksChanged(int count);
// Asynchronous error notification
void error(const QString &title, const QString &message);
public slots:
private slots:
void update();
};
#endif // CLIENTMODEL_H
| #ifndef CLIENTMODEL_H
#define CLIENTMODEL_H
#include <QObject>
class OptionsModel;
class AddressTableModel;
class TransactionTableModel;
class CWallet;
QT_BEGIN_NAMESPACE
class QDateTime;
QT_END_NAMESPACE
// Interface to Bitcoin network client
class ClientModel : public QObject
{
Q_OBJECT
public:
explicit ClientModel(OptionsModel *optionsModel, QObject *parent = 0);
OptionsModel *getOptionsModel();
int getNumConnections() const;
int getNumBlocks() const;
QDateTime getLastBlockDate() const;
// Return true if client connected to testnet
bool isTestNet() const;
// Return true if core is doing initial block download
bool inInitialBlockDownload() const;
// Return conservative estimate of total number of blocks, or 0 if unknown
int getTotalBlocksEstimate() const;
QString formatFullVersion() const;
private:
OptionsModel *optionsModel;
int cachedNumConnections;
int cachedNumBlocks;
signals:
void numConnectionsChanged(int count);
void numBlocksChanged(int count);
// Asynchronous error notification
void error(const QString &title, const QString &message);
public slots:
private slots:
void update();
};
#endif // CLIENTMODEL_H
|
Add extra function overload example |
//! Non overloaded function
void simplefunc();
//! Function which takes two int arguments
void f(int, int);
//! Function which takes two double arguments
void f(double, double);
namespace test {
//! Another function which takes two int arguments
void g(int, int);
//! Another function which takes two double arguments
void g(double, double);
}
class MyType {};
class MyOtherType {};
//! Another function which takes a custom type
void h(std::string, MyType);
//! Another function which takes another custom type
void h(std::string, MyOtherType o);
//! Another function which takes a basic type
void h(std::string, float myfloat);
//! Another function which takes a const custom type
void h(std::string, const MyType& mytype);
//! Another function which takes a const basic type
void h(std::string, const int myint);
//! Another function which takes a const basic type
template <typename T>
void h(std::string, const T myType);
//! Another function which takes a const basic type
template <typename T, typename U>
void h(std::string, const T m, const U n);
|
//! Non overloaded function
void simplefunc();
//! Function which takes two int arguments
void f(int, int);
//! Function which takes two double arguments
void f(double, double);
namespace test {
//! Another function which takes two int arguments
void g(int, int);
//! Another function which takes two double arguments
void g(double, double);
}
class MyType {};
class MyOtherType {};
//! Another function which takes a custom type
void h(std::string, MyType);
//! Another function which takes another custom type
void h(std::string, MyOtherType o);
//! Another function which takes a basic type
void h(std::string, float myfloat);
//! Another function which takes a const custom type
void h(std::string, const MyType& mytype);
//! Another function which takes a const basic type
void h(std::string, const int myint);
//! Another function which takes a const basic type
template <typename T>
void h(std::string, const T myType);
//! Another function which takes a const basic type
template <typename T, typename U>
void h(std::string, const T m, const U n);
/**
* Test function 1.
*/
void j(int);
/**
* Test function 2.
*/
void j(char);
|
Use http_headers.h to define HTTP header tags for logging | /*
* $Id$
*
* Define the tags in the shared memory in a reusable format.
* Whoever includes this get to define what the SLTM macro does.
*
*/
SLTM(CLI)
SLTM(SessionOpen)
SLTM(SessionClose)
SLTM(ClientAddr)
SLTM(Request)
SLTM(URL)
SLTM(Protocol)
SLTM(Headers)
| /*
* $Id$
*
* Define the tags in the shared memory in a reusable format.
* Whoever includes this get to define what the SLTM macro does.
*
*/
SLTM(CLI)
SLTM(SessionOpen)
SLTM(SessionClose)
SLTM(ClientAddr)
SLTM(Request)
SLTM(URL)
SLTM(Protocol)
SLTM(H_Unknown)
#define HTTPH(a, b) SLTM(b)
#include "http_headers.h"
#undef HTTPH
|
Revert "Set pointer to array data to null after free" | #ifndef OOC_ARRAY_H_
#define OOC_ARRAY_H_
#define array_malloc(size) calloc(1, (size))
#define array_free free
#include <stdint.h>
#define _lang_array__Array_new(type, size) ((_lang_array__Array) { size, array_malloc((size) * sizeof(type)) });
#if defined(safe)
#define _lang_array__Array_get(array, index, type) ( \
((type*) array.data)[(index < 0 || index >= array.length) ? kean_exception_outOfBoundsException_throw(index, array.length), -1 : index])
#define _lang_array__Array_set(array, index, type, value) \
(((type*) array.data)[(index < 0 || index >= array.length) ? kean_exception_outOfBoundsException_throw(index, array.length), -1 : index] = value)
#else
#define _lang_array__Array_get(array, index, type) ( \
((type*) array.data)[index])
#define _lang_array__Array_set(array, index, type, value) \
(((type*) array.data)[index] = value)
#endif
#define _lang_array__Array_free(array) { array_free(array.data); array.data = NULL; array.length = 0; }
typedef struct {
size_t length;
void* data;
} _lang_array__Array;
#endif
| #ifndef OOC_ARRAY_H_
#define OOC_ARRAY_H_
#define array_malloc(size) calloc(1, (size))
#define array_free free
#include <stdint.h>
#define _lang_array__Array_new(type, size) ((_lang_array__Array) { size, array_malloc((size) * sizeof(type)) });
#if defined(safe)
#define _lang_array__Array_get(array, index, type) ( \
((type*) array.data)[(index < 0 || index >= array.length) ? kean_exception_outOfBoundsException_throw(index, array.length), -1 : index])
#define _lang_array__Array_set(array, index, type, value) \
(((type*) array.data)[(index < 0 || index >= array.length) ? kean_exception_outOfBoundsException_throw(index, array.length), -1 : index] = value)
#else
#define _lang_array__Array_get(array, index, type) ( \
((type*) array.data)[index])
#define _lang_array__Array_set(array, index, type, value) \
(((type*) array.data)[index] = value)
#endif
#define _lang_array__Array_free(array) { array_free(array.data); }
typedef struct {
size_t length;
void* data;
} _lang_array__Array;
#endif
|
Fix compilations Thanks to tropikhajma CCMAIL: tropikhajma@gmail.com BUG: 234775 | /* This file is part of the KDE libraries
Copyright (C) 2010 Christoph Cullmann <cullmann@kde.org>
Copyright (C) 2005 Hamish Rodda <rodda@kde.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#ifndef KATE_RANGE_TEST_H
#define KATE_RANGE_TEST_H
#include <QtCore/QObject>
#include <ktexteditor/range.h>
class RangeTest : public QObject
{
Q_OBJECT;
public:
RangeTest();
~RangeTest();
private Q_SLOTS:
void testTextEditorRange();
void testTextRange();
void testInsertText();
void testCornerCaseInsertion();
private:
void rangeCheck ( KTextEditor::Range & valid );
};
#endif
| /* This file is part of the KDE libraries
Copyright (C) 2010 Christoph Cullmann <cullmann@kde.org>
Copyright (C) 2005 Hamish Rodda <rodda@kde.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#ifndef KATE_RANGE_TEST_H
#define KATE_RANGE_TEST_H
#include <QtCore/QObject>
#include <ktexteditor/range.h>
class RangeTest : public QObject
{
Q_OBJECT
public:
RangeTest();
~RangeTest();
private Q_SLOTS:
void testTextEditorRange();
void testTextRange();
void testInsertText();
void testCornerCaseInsertion();
private:
void rangeCheck ( KTextEditor::Range & valid );
};
#endif
|
Add RotN implementation in C | #include <stdio.h>
#include <stdlib.h>
int main()
{
char *test = "HELLO WORLD. This is a test";
char out[strlen(test)];
out[strlen(test)] = '\0';
rot(test, &out, 13);
printf("Input: %s\n", test);
printf("Output: %s", out);
return 0;
}
void rot(char *in, char *out, int n)
{
int i;
char c;
for (i = 0; i < strlen(in); i++)
{
c = in[i];
if ((c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z'))
{
if (c + n > 'z' || (c <= 'Z' && c + n > 'Z'))
{
c -= (26 - n);
}
else
{
c += n;
}
}
out[i] = c;
}
}
| |
Improve isolation of unit tests. | /*
Copyright (c) 2011 Volker Krause <vkrause@kde.org>
This library is free software; you can redistribute it and/or modify it
under the terms of the GNU Library General Public License as published by
the Free Software Foundation; either version 2 of the License, or (at your
option) any later version.
This library is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to the
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
*/
#ifndef AKTEST_H
#define AKTEST_H
#include "akapplication.h"
#define AKTEST_MAIN( TestObject ) \
int main(int argc, char **argv) \
{ \
AkCoreApplication app(argc, argv); \
app.parseCommandLine(); \
TestObject tc; \
return QTest::qExec(&tc, argc, argv); \
}
inline void akTestSetInstanceIdentifier( const QString &instanceId )
{
AkApplication::setInstanceIdentifier( instanceId );
}
#endif
| /*
Copyright (c) 2011 Volker Krause <vkrause@kde.org>
This library is free software; you can redistribute it and/or modify it
under the terms of the GNU Library General Public License as published by
the Free Software Foundation; either version 2 of the License, or (at your
option) any later version.
This library is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to the
Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
02110-1301, USA.
*/
#ifndef AKTEST_H
#define AKTEST_H
#include "akapplication.h"
#define AKTEST_MAIN( TestObject ) \
int main(int argc, char **argv) \
{ \
qputenv("XDG_DATA_HOME", ".local-unit-test/share"); \
qputenv("XDG_CONFIG_HOME", ".config-unit-test"); \
AkCoreApplication app(argc, argv); \
app.parseCommandLine(); \
TestObject tc; \
return QTest::qExec(&tc, argc, argv); \
}
inline void akTestSetInstanceIdentifier( const QString &instanceId )
{
AkApplication::setInstanceIdentifier( instanceId );
}
#endif
|
Replace the include guard too. | /*
This file is part of KDE
Copyright (C) 2006 Christian Ehrlicher <ch.ehrlicher@gmx.de>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License version 2 as published by the Free Software Foundation.
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
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#ifndef _KDEBASE_EXPORT_H
#define _KDEBASE_EXPORT_H
#include <kdemacros.h>
#ifdef MAKE_KATEINTERFACES_LIB
# define KATEINTERFACES_EXPORT KDE_EXPORT
#else
# if defined _WIN32 || defined _WIN64
# define KATEINTERFACES_EXPORT KDE_IMPORT
# else
# define KATEINTERFACES_EXPORT KDE_EXPORT
# endif
#endif
#endif // _KDEBASE_EXPORT_H
| /*
This file is part of KDE
Copyright (C) 2006 Christian Ehrlicher <ch.ehrlicher@gmx.de>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License version 2 as published by the Free Software Foundation.
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
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#ifndef _KATE_EXPORT_H
#define _KATE_EXPORT_H
#include <kdemacros.h>
#ifdef MAKE_KATEINTERFACES_LIB
# define KATEINTERFACES_EXPORT KDE_EXPORT
#else
# if defined _WIN32 || defined _WIN64
# define KATEINTERFACES_EXPORT KDE_IMPORT
# else
# define KATEINTERFACES_EXPORT KDE_EXPORT
# endif
#endif
#endif // _KATE_EXPORT_H
|
Add vfprintf to the public interface just in case | // File: stdlib/stdio.h
// Author: vodozhaba
// Created on: Aug 21, 2016
// Purpose: Provides standard I/O functions.
#pragma once
#include <stdarg.h>
#include "io/disk/file.h"
extern FileDescriptor* stdout;
extern FileDescriptor* stderr;
size_t StdoutWriteOp(FileDescriptor* file, size_t size, const void* buf);
size_t StderrWriteOp(FileDescriptor* file, size_t size, const void* buf);
int putchar(int character);
int _puts(const char* s);
int isspace (int c);
int fprintf(FileDescriptor* file, const char* fmt, ...);
int printf(const char* fmt, ...);
int sprintf(char* dest, const char* fmt, ...);
| // File: stdlib/stdio.h
// Author: vodozhaba
// Created on: Aug 21, 2016
// Purpose: Provides standard I/O functions.
#pragma once
#include <stdarg.h>
#include "io/disk/file.h"
extern FileDescriptor* stdout;
extern FileDescriptor* stderr;
size_t StdoutWriteOp(FileDescriptor* file, size_t size, const void* buf);
size_t StderrWriteOp(FileDescriptor* file, size_t size, const void* buf);
int putchar(int character);
int _puts(const char* s);
int isspace (int c);
int fprintf(FileDescriptor* file, const char* fmt, ...);
int vfprintf(FileDescriptor* file, const char* fmt, va_list argss);
int printf(const char* fmt, ...);
int sprintf(char* dest, const char* fmt, ...);
|
Replace MPI source code instead of executive binary file. User will compile the source with its own mpi implementation. |
#include <stdlib.h>
#include <stdio.h>
#include <mpi.h>
main(int argc, char **argv)
{
register double width;
double sum = 0, lsum;
register int intervals, i;
int nproc, iproc;
MPI_Win sum_win;
if (MPI_Init(&argc, &argv) != MPI_SUCCESS) exit(1);
MPI_Comm_size(MPI_COMM_WORLD, &nproc);
MPI_Comm_rank(MPI_COMM_WORLD, &iproc);
MPI_Win_create(&sum, sizeof(sum), sizeof(sum),
0, MPI_COMM_WORLD, &sum_win);
MPI_Win_fence(0, sum_win);
intervals = atoi(argv[1]);
width = 1.0 / intervals;
lsum = 0;
for (i=iproc; i<intervals; i+=nproc) {
register double x = (i + 0.5) * width;
lsum += 4.0 / (1.0 + x * x);
}
lsum *= width;
MPI_Accumulate(&lsum, 1, MPI_DOUBLE, 0, 0,
1, MPI_DOUBLE, MPI_SUM, sum_win);
MPI_Win_fence(0, sum_win);
if (iproc == 0) {
printf("Estimation of pi is %f\n", sum);
}
MPI_Finalize();
return(0);
}
| |
Add header and footer comments | #if !defined(PARROT_ENUMS_H_GUARD)
#define PARROT_ENUMS_H_GUARD
typedef enum {
NO_STACK_ENTRY_TYPE = 0,
STACK_ENTRY_INT = 1,
STACK_ENTRY_FLOAT = 2,
STACK_ENTRY_STRING = 3,
STACK_ENTRY_PMC = 4,
STACK_ENTRY_POINTER = 5,
STACK_ENTRY_DESTINATION = 6
} Stack_entry_type;
typedef enum {
NO_STACK_ENTRY_FLAGS = 0,
STACK_ENTRY_CLEANUP_FLAG = 1 << 0
} Stack_entry_flags;
typedef enum {
NO_STACK_CHUNK_FLAGS = 0,
STACK_CHUNK_COW_FLAG = 1 << 0
} Stack_chunk_flags;
#endif
| /* enums.h
* Copyright: 2001-2003 The Perl Foundation. All Rights Reserved.
* Overview:
* enums shared by much of the stack-handling code
* Data Structure and Algorithms:
* History:
* Notes:
* References:
*/
#if !defined(PARROT_ENUMS_H_GUARD)
#define PARROT_ENUMS_H_GUARD
typedef enum {
NO_STACK_ENTRY_TYPE = 0,
STACK_ENTRY_INT = 1,
STACK_ENTRY_FLOAT = 2,
STACK_ENTRY_STRING = 3,
STACK_ENTRY_PMC = 4,
STACK_ENTRY_POINTER = 5,
STACK_ENTRY_DESTINATION = 6
} Stack_entry_type;
typedef enum {
NO_STACK_ENTRY_FLAGS = 0,
STACK_ENTRY_CLEANUP_FLAG = 1 << 0
} Stack_entry_flags;
typedef enum {
NO_STACK_CHUNK_FLAGS = 0,
STACK_CHUNK_COW_FLAG = 1 << 0
} Stack_chunk_flags;
#endif
/*
* Local variables:
* c-indentation-style: bsd
* c-basic-offset: 4
* indent-tabs-mode: nil
* End:
*
* vim: expandtab shiftwidth=4:
*/
|
Add new code to manage 500 server error | //
// OCErrorMsg.h
// Owncloud iOs Client
//
// Copyright (C) 2014 ownCloud Inc. (http://www.owncloud.org/)
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
//
#define kOCErrorServerUnauthorized 401
#define kOCErrorServerForbidden 403
#define kOCErrorServerPathNotFound 404
#define kOCErrorServerMethodNotPermitted 405
#define kOCErrorProxyAuth 407
#define kOCErrorServerTimeout 408 | //
// OCErrorMsg.h
// Owncloud iOs Client
//
// Copyright (C) 2014 ownCloud Inc. (http://www.owncloud.org/)
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
//
#define kOCErrorServerUnauthorized 401
#define kOCErrorServerForbidden 403
#define kOCErrorServerPathNotFound 404
#define kOCErrorServerMethodNotPermitted 405
#define kOCErrorProxyAuth 407
#define kOCErrorServerTimeout 408
#define kOCErrorServerInternalError 500 |
Check for EISDIR error as well. Fixed problems with BSD/OS. | /* Copyright (c) 2003 Timo Sirainen */
#include "lib.h"
#include "mkdir-parents.h"
#include <sys/stat.h>
int mkdir_parents(const char *path, mode_t mode)
{
const char *p;
if (mkdir(path, mode) < 0 && errno != EEXIST) {
if (errno != ENOENT)
return -1;
p = strrchr(path, '/');
if (p == NULL || p == path)
return -1; /* shouldn't happen */
t_push();
if (mkdir_parents(t_strdup_until(path, p), mode) < 0) {
t_pop();
return -1;
}
t_pop();
/* should work now */
if (mkdir(path, mode) < 0 && errno != EEXIST)
return -1;
}
return 0;
}
| /* Copyright (c) 2003 Timo Sirainen */
#include "lib.h"
#include "mkdir-parents.h"
#include <sys/stat.h>
int mkdir_parents(const char *path, mode_t mode)
{
const char *p;
/* EISDIR check is for BSD/OS which returns it if path contains '/'
at the end and it exists. */
if (mkdir(path, mode) < 0 && errno != EEXIST && errno != EISDIR) {
if (errno != ENOENT)
return -1;
p = strrchr(path, '/');
if (p == NULL || p == path)
return -1; /* shouldn't happen */
t_push();
if (mkdir_parents(t_strdup_until(path, p), mode) < 0) {
t_pop();
return -1;
}
t_pop();
/* should work now */
if (mkdir(path, mode) < 0 && errno != EEXIST)
return -1;
}
return 0;
}
|
Add a visitor for the members of a nominal type. | //===-- TypeMemberVisitor.h - ASTVisitor specialization ---------*- C++ -*-===//
//
// This source file is part of the Swift.org open source project
//
// Copyright (c) 2014 - 2015 Apple Inc. and the Swift project authors
// Licensed under Apache License v2.0 with Runtime Library Exception
//
// See http://swift.org/LICENSE.txt for license information
// See http://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
//
//===----------------------------------------------------------------------===//
//
// This file defines the curiously-recursive TypeMemberVisitor class
// and a few specializations thereof.
//
//===----------------------------------------------------------------------===//
#ifndef SWIFT_AST_TYPEMEMBERVISITOR_H
#define SWIFT_AST_TYPEMEMBERVISITOR_H
#include "swift/AST/ASTVisitor.h"
namespace swift {
/// TypeMemberVisitor - This is a convenience adapter of DeclVisitor
/// which filters out a few common declaration kinds that are never
/// members of nominal types.
template<typename ImplClass, typename RetTy = void>
class TypeMemberVisitor : public DeclVisitor<ImplClass, RetTy> {
protected:
ImplClass &asImpl() { return static_cast<ImplClass&>(*this); }
public:
#define BAD_MEMBER(KIND) \
RetTy visit##KIND##Decl(KIND##Decl *D) { \
llvm_unreachable(#KIND "Decls cannot be members of nominal types"); \
}
BAD_MEMBER(Extension)
BAD_MEMBER(Import)
BAD_MEMBER(Protocol)
BAD_MEMBER(TopLevelCode)
/// A convenience method to visit all the members.
void visitMembers(NominalTypeDecl *D) {
for (Decl *member : D->getMembers()) {
asImpl().visit(member);
}
}
};
template<typename ImplClass, typename RetTy = void>
class ClassMemberVisitor : public TypeMemberVisitor<ImplClass, RetTy> {
public:
BAD_MEMBER(OneOfElement)
void visitMembers(ClassDecl *D) {
TypeMemberVisitor<ImplClass, RetTy>::visitMembers(D);
}
};
#undef BAD_MEMBER
} // end namespace swift
#endif
| |
Support for MS Visual Studio 2008. | #ifndef __SimpleITKMacro_h
#define __SimpleITKMacro_h
#include <stdint.h>
#include <itkImageBase.h>
#include <itkImage.h>
#include <itkLightObject.h>
#include <itkSmartPointer.h>
// Define macros to aid in the typeless layer
typedef itk::ImageBase<3> SimpleImageBase;
namespace itk {
namespace simple {
// To add a new type you must:
// 1. Add an entry to ImageDataType
// 2. Add to the sitkDataTypeSwitch
// 3. Add the new type to ImageFileReader/ImageFileWriter
enum ImageDataType {
sitkUInt8, // Unsigned 8 bit integer
sitkInt16, // Signed 16 bit integer
sitkInt32, // Signed 32 bit integer
sitkFloat32, // 32 bit float
};
#define sitkImageDataTypeCase(typeN, type, call ) \
case typeN: { typedef type DataType; call; }; break
#define sitkImageDataTypeSwitch( call ) \
sitkImageDataTypeCase ( sitkUInt8, uint8_t, call ); \
sitkImageDataTypeCase ( sitkInt16, int16_t, call ); \
sitkImageDataTypeCase ( sitkInt32, int32_t, call ); \
sitkImageDataTypeCase ( sitkFloat32, float, call );
}
}
#endif
| #ifndef __SimpleITKMacro_h
#define __SimpleITKMacro_h
// Ideally, take the types from the C99 standard. However,
// VS 8 does not have stdint.h, but they are defined anyway.
#ifndef _MSC_VER
#include <stdint.h>
#endif
#include <itkImageBase.h>
#include <itkImage.h>
#include <itkLightObject.h>
#include <itkSmartPointer.h>
// Define macros to aid in the typeless layer
typedef itk::ImageBase<3> SimpleImageBase;
namespace itk {
namespace simple {
// To add a new type you must:
// 1. Add an entry to ImageDataType
// 2. Add to the sitkDataTypeSwitch
// 3. Add the new type to ImageFileReader/ImageFileWriter
enum ImageDataType {
sitkUInt8, // Unsigned 8 bit integer
sitkInt16, // Signed 16 bit integer
sitkInt32, // Signed 32 bit integer
sitkFloat32, // 32 bit float
};
#define sitkImageDataTypeCase(typeN, type, call ) \
case typeN: { typedef type DataType; call; }; break
#define sitkImageDataTypeSwitch( call ) \
sitkImageDataTypeCase ( sitkUInt8, uint8_t, call ); \
sitkImageDataTypeCase ( sitkInt16, int16_t, call ); \
sitkImageDataTypeCase ( sitkInt32, int32_t, call ); \
sitkImageDataTypeCase ( sitkFloat32, float, call );
}
}
#endif
|
Use NSUInteger, even in our little tests. | @import objc;
@interface NSArray : NSObject
- (id)objectAtIndexedSubscript:(unsigned)idx;
@end
@interface Hive
@property __attribute__((iboutletcollection(B))) NSArray *bees;
@end
| @import objc;
typedef unsigned long NSUInteger;
@interface NSArray : NSObject
- (id)objectAtIndexedSubscript:(NSUInteger)idx;
@end
@interface Hive
@property __attribute__((iboutletcollection(B))) NSArray *bees;
@end
|
Resolve Swift warnings by specifying void arguments | /*
*
* Copyright 2017 gRPC authors.
*
* 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 GRPC_IMPL_CODEGEN_FORK_H
#define GRPC_IMPL_CODEGEN_FORK_H
/**
* gRPC applications should call this before calling fork(). There should be no
* active gRPC function calls between calling grpc_prefork() and
* grpc_postfork_parent()/grpc_postfork_child().
*
*
* Typical use:
* grpc_prefork();
* int pid = fork();
* if (pid) {
* grpc_postfork_parent();
* // Parent process..
* } else {
* grpc_postfork_child();
* // Child process...
* }
*/
void grpc_prefork();
void grpc_postfork_parent();
void grpc_postfork_child();
void grpc_fork_handlers_auto_register();
#endif /* GRPC_IMPL_CODEGEN_FORK_H */
| /*
*
* Copyright 2017 gRPC authors.
*
* 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 GRPC_IMPL_CODEGEN_FORK_H
#define GRPC_IMPL_CODEGEN_FORK_H
/**
* gRPC applications should call this before calling fork(). There should be no
* active gRPC function calls between calling grpc_prefork() and
* grpc_postfork_parent()/grpc_postfork_child().
*
*
* Typical use:
* grpc_prefork();
* int pid = fork();
* if (pid) {
* grpc_postfork_parent();
* // Parent process..
* } else {
* grpc_postfork_child();
* // Child process...
* }
*/
void grpc_prefork(void);
void grpc_postfork_parent(void);
void grpc_postfork_child(void);
void grpc_fork_handlers_auto_register(void);
#endif /* GRPC_IMPL_CODEGEN_FORK_H */
|
Add test using built-in generators. | #include "test_theft.h"
#include "theft_aux.h"
SUITE(aux) {
// builtins
}
| #include "test_theft.h"
#include "theft_aux.h"
struct a_squared_lte_b_env {
struct theft_print_trial_result_env print_env;
};
static enum theft_trial_res
prop_a_squared_lte_b(void *arg_a, void *arg_b) {
int8_t a = *(int8_t *)arg_a;
uint16_t b = *(uint16_t *)arg_b;
if (0) {
fprintf(stdout, "\n$$ checking (%d * %d) < %u => %d ? %d\n",
a, a, b, a * a, a * a <= b);
}
return ((a * a) <= b)
? THEFT_TRIAL_PASS
: THEFT_TRIAL_FAIL;
}
TEST a_squared_lte_b(void) {
theft_seed seed = theft_seed_of_time();
struct a_squared_lte_b_env env;
memset(&env, 0x00, sizeof(env));
struct theft_run_config cfg = {
.name = __func__,
.fun = prop_a_squared_lte_b,
.type_info = {
theft_get_builtin_type_info(THEFT_BUILTIN_int8_t),
theft_get_builtin_type_info(THEFT_BUILTIN_uint16_t),
},
.bloom_bits = 20,
.seed = seed,
.hooks = {
.run_pre = theft_hook_run_pre_print_info,
.run_post = theft_hook_run_post_print_info,
.env = &env,
},
};
ASSERT_EQ_FMTm("should find counter-examples",
THEFT_RUN_FAIL, theft_run(&cfg), "%d");
PASS();
}
SUITE(aux) {
// builtins
RUN_TEST(a_squared_lte_b);
}
|
Declare option "+" for TTreePlayer | /* @(#)root/treeplayer:$Name: $:$Id: LinkDef.h,v 1.1.1.1 2000/05/16 17:00:44 rdm Exp $ */
/*************************************************************************
* Copyright (C) 1995-2000, Rene Brun and Fons Rademakers. *
* All rights reserved. *
* *
* For the licensing terms see $ROOTSYS/LICENSE. *
* For the list of contributors see $ROOTSYS/README/CREDITS. *
*************************************************************************/
#ifdef __CINT__
#pragma link off all globals;
#pragma link off all classes;
#pragma link off all functions;
#pragma link C++ class TTreePlayer;
#pragma link C++ class TPacketGenerator;
#pragma link C++ class TTreeFormula-;
#endif
| /* @(#)root/treeplayer:$Name: $:$Id: LinkDef.h,v 1.2 2000/07/06 17:20:52 brun Exp $ */
/*************************************************************************
* Copyright (C) 1995-2000, Rene Brun and Fons Rademakers. *
* All rights reserved. *
* *
* For the licensing terms see $ROOTSYS/LICENSE. *
* For the list of contributors see $ROOTSYS/README/CREDITS. *
*************************************************************************/
#ifdef __CINT__
#pragma link off all globals;
#pragma link off all classes;
#pragma link off all functions;
#pragma link C++ class TTreePlayer+;
#pragma link C++ class TPacketGenerator;
#pragma link C++ class TTreeFormula-;
#endif
|
Enable ubluepy module if s110 bluetooth stack is enabled. | #ifndef NRF_SDK_CONF_H__
#define NRF_SDK_CONF_H__
// SD specific configurations.
#if (BLUETOOTH_SD == 100)
#define MICROPY_PY_BLE (1)
#define MICROPY_PY_BLE_6LOWPAN (1)
#define MICROPY_PY_USOCKET (1)
#define MICROPY_PY_NETWORK (1)
#elif (BLUETOOTH_SD == 110)
#define MICROPY_PY_BLE (1)
#elif (BLUETOOTH_SD == 132)
#define MICROPY_PY_BLE (1)
#define MICROPY_PY_BLE_NUS (0)
#define MICROPY_PY_UBLUEPY (1)
#define MICROPY_PY_UBLUEPY_PERIPHERAL (1)
#else
#error "SD not supported"
#endif
// Default defines.
#ifndef MICROPY_PY_BLE_6LOWPAN
#define MICROPY_PY_BLE_6LOWPAN (0)
#endif
#ifndef MICROPY_PY_BLE
#define MICROPY_PY_BLE (0)
#endif
#ifndef MICROPY_PY_BLE_NUS
#define MICROPY_PY_BLE_NUS (0)
#endif
#endif
| #ifndef NRF_SDK_CONF_H__
#define NRF_SDK_CONF_H__
// SD specific configurations.
#if (BLUETOOTH_SD == 100)
#define MICROPY_PY_BLE (1)
#define MICROPY_PY_BLE_6LOWPAN (1)
#define MICROPY_PY_USOCKET (1)
#define MICROPY_PY_NETWORK (1)
#elif (BLUETOOTH_SD == 110)
#define MICROPY_PY_BLE (1)
#define MICROPY_PY_BLE_NUS (0)
#define MICROPY_PY_UBLUEPY (1)
#define MICROPY_PY_UBLUEPY_PERIPHERAL (1)
#elif (BLUETOOTH_SD == 132)
#define MICROPY_PY_BLE (1)
#define MICROPY_PY_BLE_NUS (0)
#define MICROPY_PY_UBLUEPY (1)
#define MICROPY_PY_UBLUEPY_PERIPHERAL (1)
#else
#error "SD not supported"
#endif
// Default defines.
#ifndef MICROPY_PY_BLE_6LOWPAN
#define MICROPY_PY_BLE_6LOWPAN (0)
#endif
#ifndef MICROPY_PY_BLE
#define MICROPY_PY_BLE (0)
#endif
#ifndef MICROPY_PY_BLE_NUS
#define MICROPY_PY_BLE_NUS (0)
#endif
#endif
|
Allow I2C_FREQ to be defined externally | #ifndef _I2C_H
#define _I2C_H
#define I2C_FREQ 100000
struct i2c_iovec_s {
uint8_t *base;
uint8_t len;
};
void i2c_init(void);
void i2c_open(void);
void i2c_close(void);
int8_t i2c_readv(uint8_t address, struct i2c_iovec_s *iov, uint8_t iovcnt);
int8_t i2c_writev(uint8_t address, struct i2c_iovec_s *iov, uint8_t iovcnt);
int8_t i2c_read(uint8_t address, uint8_t *buf, uint8_t len);
int8_t i2c_write(uint8_t address, uint8_t *buf, uint8_t len);
int8_t i2c_read_from(uint8_t address, uint8_t reg, uint8_t *buf, uint8_t len);
int8_t i2c_write_to(uint8_t address, uint8_t reg, uint8_t *buf, uint8_t len);
#endif
| #ifndef _I2C_H
#define _I2C_H
#ifndef I2C_FREQ
#define I2C_FREQ 100000
#endif
struct i2c_iovec_s {
uint8_t *base;
uint8_t len;
};
void i2c_init(void);
void i2c_open(void);
void i2c_close(void);
int8_t i2c_readv(uint8_t address, struct i2c_iovec_s *iov, uint8_t iovcnt);
int8_t i2c_writev(uint8_t address, struct i2c_iovec_s *iov, uint8_t iovcnt);
int8_t i2c_read(uint8_t address, uint8_t *buf, uint8_t len);
int8_t i2c_write(uint8_t address, uint8_t *buf, uint8_t len);
int8_t i2c_read_from(uint8_t address, uint8_t reg, uint8_t *buf, uint8_t len);
int8_t i2c_write_to(uint8_t address, uint8_t reg, uint8_t *buf, uint8_t len);
#endif
|
Fix a bug in Owen's checkin that broke the CBE on all non sparc v9 platforms. | //===-- CTargetMachine.h - TargetMachine for the C backend ------*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
// This file was developed by the LLVM research group and is distributed under
// the University of Illinois Open Source License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
//
// This file declares the TargetMachine that is used by the C backend.
//
//===----------------------------------------------------------------------===//
#ifndef CTARGETMACHINE_H
#define CTARGETMACHINE_H
#include "llvm/Target/TargetMachine.h"
namespace llvm {
struct CTargetMachine : public TargetMachine {
const TargetData DataLayout; // Calculates type size & alignment
CTargetMachine(const Module &M, const std::string &FS)
: TargetMachine("CBackend", M),
DataLayout("CBackend") {}
// This is the only thing that actually does anything here.
virtual bool addPassesToEmitFile(PassManager &PM, std::ostream &Out,
CodeGenFileType FileType, bool Fast);
// This class always works, but shouldn't be the default in most cases.
static unsigned getModuleMatchQuality(const Module &M) { return 1; }
virtual const TargetData *getTargetData() const { return &DataLayout; }
};
} // End llvm namespace
#endif
| //===-- CTargetMachine.h - TargetMachine for the C backend ------*- C++ -*-===//
//
// The LLVM Compiler Infrastructure
//
// This file was developed by the LLVM research group and is distributed under
// the University of Illinois Open Source License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
//
// This file declares the TargetMachine that is used by the C backend.
//
//===----------------------------------------------------------------------===//
#ifndef CTARGETMACHINE_H
#define CTARGETMACHINE_H
#include "llvm/Target/TargetMachine.h"
namespace llvm {
struct CTargetMachine : public TargetMachine {
const TargetData DataLayout; // Calculates type size & alignment
CTargetMachine(const Module &M, const std::string &FS)
: TargetMachine("CBackend", M),
DataLayout("CBackend", &M) {}
// This is the only thing that actually does anything here.
virtual bool addPassesToEmitFile(PassManager &PM, std::ostream &Out,
CodeGenFileType FileType, bool Fast);
// This class always works, but shouldn't be the default in most cases.
static unsigned getModuleMatchQuality(const Module &M) { return 1; }
virtual const TargetData *getTargetData() const { return &DataLayout; }
};
} // End llvm namespace
#endif
|
Test passed on ppc, to my surprise; if it worked there it may work everywhere... | // RUN: %llvmgcc %s -c -O3 -m64 -emit-llvm -o - | llc -march=x86-64 -mtriple=x86_64-apple-darwin | FileCheck %s
// XFAIL: *
// XTARGET: x86,i386,i686
// r9 used to be clobbered before its value was moved to r10. 7993104.
void foo(int x, int y) {
// CHECK: bar
// CHECK: movq %r9, %r10
// CHECK: movq %rdi, %r9
// CHECK: bar
register int lr9 asm("r9") = x;
register int lr10 asm("r10") = y;
int foo;
asm volatile("bar" : "=r"(lr9) : "r"(lr9), "r"(lr10));
foo = lr9;
lr9 = x;
lr10 = foo;
asm volatile("bar" : "=r"(lr9) : "r"(lr9), "r"(lr10));
} | // RUN: %llvmgcc %s -c -O3 -m64 -emit-llvm -o - | llc -march=x86-64 -mtriple=x86_64-apple-darwin | FileCheck %s
// r9 used to be clobbered before its value was moved to r10. 7993104.
void foo(int x, int y) {
// CHECK: bar
// CHECK: movq %r9, %r10
// CHECK: movq %rdi, %r9
// CHECK: bar
register int lr9 asm("r9") = x;
register int lr10 asm("r10") = y;
int foo;
asm volatile("bar" : "=r"(lr9) : "r"(lr9), "r"(lr10));
foo = lr9;
lr9 = x;
lr10 = foo;
asm volatile("bar" : "=r"(lr9) : "r"(lr9), "r"(lr10));
} |
Use unaligned particle structure to save memory. | /*! \file SwiftParticle.h
* \brief header file for the SWIFT particle type.
*/
#ifndef SWIFT_PARTICLE_H
#define SWIFT_PARTICLE_H
#ifdef SWIFTINTERFACE
/**
* @brief The default struct alignment in SWIFT.
*/
#define SWIFT_STRUCT_ALIGNMENT 32
#define SWIFT_STRUCT_ALIGN __attribute__((aligned(SWIFT_STRUCT_ALIGNMENT)))
namespace Swift
{
/* SWIFT enum of part types. Should match VELOCIraptor type values. */
enum part_type {
swift_type_gas = 0,
swift_type_dark_matter = 1,
swift_type_star = 4,
swift_type_black_hole = 5,
swift_type_count
} __attribute__((packed));
/* SWIFT/VELOCIraptor particle. */
struct swift_vel_part {
/*! Particle ID. If negative, it is the negative offset of the #part with
which this gpart is linked. */
long long id;
/*! Particle position. */
double x[3];
/*! Particle velocity. */
float v[3];
/*! Particle mass. */
float mass;
/*! Gravitational potential */
float potential;
/*! Internal energy of gas particle */
float u;
/*! Type of the #gpart (DM, gas, star, ...) */
enum part_type type;
} SWIFT_STRUCT_ALIGN;
}
#endif
#endif
| /*! \file SwiftParticle.h
* \brief header file for the SWIFT particle type.
*/
#ifndef SWIFT_PARTICLE_H
#define SWIFT_PARTICLE_H
#ifdef SWIFTINTERFACE
namespace Swift
{
/* SWIFT enum of part types. Should match VELOCIraptor type values. */
enum part_type {
swift_type_gas = 0,
swift_type_dark_matter = 1,
swift_type_star = 4,
swift_type_black_hole = 5,
swift_type_count
} __attribute__((packed));
/* SWIFT/VELOCIraptor particle. */
struct swift_vel_part {
/*! Particle ID. */
long long id;
/*! Particle position. */
double x[3];
/*! Particle velocity. */
float v[3];
/*! Particle mass. */
float mass;
/*! Gravitational potential */
float potential;
/*! Internal energy of gas particle */
float u;
/*! Type of the #gpart (DM, gas, star, ...) */
enum part_type type;
};
}
#endif
#endif
|
Disable MoPub logging for release builds. | //
// MPConstants.h
// MoPub
//
// Created by Nafis Jamal on 2/9/11.
// Copyright 2011 MoPub, Inc. All rights reserved.
//
#import <UIKit/UIKit.h>
#define MP_DEBUG_MODE 1
#define HOSTNAME @"ads.mopub.com"
#define HOSTNAME_FOR_TESTING @"testing.ads.mopub.com"
#define DEFAULT_PUB_ID @"agltb3B1Yi1pbmNyDAsSBFNpdGUYkaoMDA"
#define MP_SERVER_VERSION @"8"
#define MP_SDK_VERSION @"1.16.0.1"
// Sizing constants.
#define MOPUB_BANNER_SIZE CGSizeMake(320, 50)
#define MOPUB_MEDIUM_RECT_SIZE CGSizeMake(300, 250)
#define MOPUB_LEADERBOARD_SIZE CGSizeMake(728, 90)
#define MOPUB_WIDE_SKYSCRAPER_SIZE CGSizeMake(160, 600)
// Miscellaneous constants.
#define MINIMUM_REFRESH_INTERVAL 5.0
#define DEFAULT_BANNER_REFRESH_INTERVAL 60
#define BANNER_TIMEOUT_INTERVAL 10
#define INTERSTITIAL_TIMEOUT_INTERVAL 30
// Feature Flags
#define SESSION_TRACKING_ENABLED 1
| //
// MPConstants.h
// MoPub
//
// Created by Nafis Jamal on 2/9/11.
// Copyright 2011 MoPub, Inc. All rights reserved.
//
#import <UIKit/UIKit.h>
#if DEBUG
#define MP_DEBUG_MODE 1
#else
#define MP_DEBUG_MODE 0
#endif
#define HOSTNAME @"ads.mopub.com"
#define HOSTNAME_FOR_TESTING @"testing.ads.mopub.com"
#define DEFAULT_PUB_ID @"agltb3B1Yi1pbmNyDAsSBFNpdGUYkaoMDA"
#define MP_SERVER_VERSION @"8"
#define MP_SDK_VERSION @"1.16.0.1"
// Sizing constants.
#define MOPUB_BANNER_SIZE CGSizeMake(320, 50)
#define MOPUB_MEDIUM_RECT_SIZE CGSizeMake(300, 250)
#define MOPUB_LEADERBOARD_SIZE CGSizeMake(728, 90)
#define MOPUB_WIDE_SKYSCRAPER_SIZE CGSizeMake(160, 600)
// Miscellaneous constants.
#define MINIMUM_REFRESH_INTERVAL 5.0
#define DEFAULT_BANNER_REFRESH_INTERVAL 60
#define BANNER_TIMEOUT_INTERVAL 10
#define INTERSTITIAL_TIMEOUT_INTERVAL 30
// Feature Flags
#define SESSION_TRACKING_ENABLED 1
|
Increment version to v2.6 (take 2) | #ifndef SIMPLEAMQPCLIENT_VERSION_H
#define SIMPLEAMQPCLIENT_VERSION_H
/*
* ***** BEGIN LICENSE BLOCK *****
* Version: MIT
*
* Copyright (c) 2013 Alan Antonuk
*
* Permission is hereby granted, free of charge, to any person
* obtaining a copy of this software and associated documentation
* files (the "Software"), to deal in the Software without
* restriction, including without limitation the rights to use, copy,
* modify, merge, publish, distribute, sublicense, and/or sell copies
* of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
* BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
* ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
* ***** END LICENSE BLOCK *****
*/
#define SIMPLEAMQPCLIENT_VERSION_MAJOR 2
#define SIMPLEAMQPCLIENT_VERSION_MINOR 5
#define SIMPLEAMQPCLIENT_VERSION_PATCH 1
#endif // SIMPLEAMQPCLIENT_VERSION_H
| #ifndef SIMPLEAMQPCLIENT_VERSION_H
#define SIMPLEAMQPCLIENT_VERSION_H
/*
* ***** BEGIN LICENSE BLOCK *****
* Version: MIT
*
* Copyright (c) 2013 Alan Antonuk
*
* Permission is hereby granted, free of charge, to any person
* obtaining a copy of this software and associated documentation
* files (the "Software"), to deal in the Software without
* restriction, including without limitation the rights to use, copy,
* modify, merge, publish, distribute, sublicense, and/or sell copies
* of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
* BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
* ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
* ***** END LICENSE BLOCK *****
*/
#define SIMPLEAMQPCLIENT_VERSION_MAJOR 2
#define SIMPLEAMQPCLIENT_VERSION_MINOR 6
#define SIMPLEAMQPCLIENT_VERSION_PATCH 0
#endif // SIMPLEAMQPCLIENT_VERSION_H
|
Add missing unversioned interface-name macro for PPP_Pdf. | // Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef WEBKIT_PLUGINS_PPAPI_PPP_PDF_H_
#define WEBKIT_PLUGINS_PPAPI_PPP_PDF_H_
#include "ppapi/c/pp_instance.h"
#include "ppapi/c/pp_point.h"
#include "ppapi/c/pp_var.h"
#define PPP_PDF_INTERFACE_1 "PPP_Pdf;1"
struct PPP_Pdf_1 {
// Returns an absolute URL if the position is over a link.
PP_Var (*GetLinkAtPosition)(PP_Instance instance,
PP_Point point);
};
typedef PPP_Pdf_1 PPP_Pdf;
#endif // WEBKIT_PLUGINS_PPAPI_PPP_PDF_H_
| // Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef WEBKIT_PLUGINS_PPAPI_PPP_PDF_H_
#define WEBKIT_PLUGINS_PPAPI_PPP_PDF_H_
#include "ppapi/c/pp_instance.h"
#include "ppapi/c/pp_point.h"
#include "ppapi/c/pp_var.h"
#define PPP_PDF_INTERFACE_1 "PPP_Pdf;1"
#define PPP_PDF_INTERFACE PPP_PDF_INTERFACE_1
struct PPP_Pdf_1 {
// Returns an absolute URL if the position is over a link.
PP_Var (*GetLinkAtPosition)(PP_Instance instance,
PP_Point point);
};
typedef PPP_Pdf_1 PPP_Pdf;
#endif // WEBKIT_PLUGINS_PPAPI_PPP_PDF_H_
|
Return statistics for a DB | #include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include "mdb.h"
int main(int argc,char * argv[])
{
int i = 0, rc;
MDB_env *env;
MDB_db *db;
MDB_stat *mst;
char *envname = argv[1];
char *subname = NULL;
if (argc > 2)
subname = argv[2];
rc = mdbenv_create(&env, 0);
rc = mdbenv_open(env, envname, MDB_RDONLY, 0);
if (rc) {
printf("mdbenv_open failed, error %d\n", rc);
exit(1);
}
rc = mdb_open(env, NULL, NULL, 0, &db);
if (rc) {
printf("mdb_open failed, error %d\n", rc);
exit(1);
}
rc = mdb_stat(db, &mst);
printf("Created at %s", ctime(&mst->ms_created_at));
printf("Page size: %u\n", mst->ms_psize);
printf("Tree depth: %u\n", mst->ms_depth);
printf("Branch pages: %lu\n", mst->ms_branch_pages);
printf("Leaf pages: %lu\n", mst->ms_leaf_pages);
printf("Overflow pages: %lu\n", mst->ms_overflow_pages);
printf("Revisions: %lu\n", mst->ms_revisions);
printf("Entries: %lu\n", mst->ms_entries);
mdb_close(db);
mdbenv_close(env);
return 0;
}
| |
Add forgotten file. Created when the .rc file was added to provide the dll with a version to keep Red Baron happy. | //{{NO_DEPENDENCIES}}
// Microsoft Developer Studio generated include file.
// Used by Glide2x.rc
//
// Next default values for new objects
//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 101
#define _APS_NEXT_COMMAND_VALUE 40001
#define _APS_NEXT_CONTROL_VALUE 1000
#define _APS_NEXT_SYMED_VALUE 101
#endif
#endif
| |
Add List Delete function implementation | #include "list.h"
struct ListNode
{
ListNode* prev;
ListNode* next;
void* k;
};
struct List
{
ListNode* head;
};
List* List_Create(void)
{
List* l = (List *)malloc(sizeof(List));
l->head = NULL;
return l;
}
ListNode* ListNode_Create(void* k)
{
ListNode* n = (ListNode *)malloc(sizeof(ListNode));
n->prev = NULL;
n->next = NULL;
n->k = k;
return n;
}
ListNode* List_Search(List* l, void* k, int (f)(void*, void*))
{
ListNode* n = l->head;
while (n != NULL && !f(n->k, k))
{
n = n->next;
}
return n;
}
void List_Insert(List* l, ListNode* n)
{
n->next = l->head;
if (l->head != NULL)
{
l->head->prev = n;
}
l->head = n;
n->prev = NULL;
}
| #include "list.h"
struct ListNode
{
ListNode* prev;
ListNode* next;
void* k;
};
struct List
{
ListNode* head;
};
List* List_Create(void)
{
List* l = (List *)malloc(sizeof(List));
l->head = NULL;
return l;
}
ListNode* ListNode_Create(void* k)
{
ListNode* n = (ListNode *)malloc(sizeof(ListNode));
n->prev = NULL;
n->next = NULL;
n->k = k;
return n;
}
ListNode* List_Search(List* l, void* k, int (f)(void*, void*))
{
ListNode* n = l->head;
while (n != NULL && !f(n->k, k))
{
n = n->next;
}
return n;
}
void List_Insert(List* l, ListNode* n)
{
n->next = l->head;
if (l->head != NULL)
{
l->head->prev = n;
}
l->head = n;
n->prev = NULL;
}
void List_Delete(List* l, ListNode* n)
{
if (n->prev != NULL)
{
n->prev->next = n->next;
} else {
l->head = n->next;
}
if (n->next != NULL)
{
n->next->prev = n->prev;
}
}
|
Add date and storage percent functions. | #include <stdio.h>
#include <stdlib.h>
int main(int argc,char* argv)
{
return 0;
}
| #include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main(int argc,char* argv)
{
FILE *ps;
char date_str[32]={0};
if((ps = popen("date +%Y%m%d-%H%M%S", "r")) == NULL )
{
printf("popen() error!\n");
return 1;
}
fgets(date_str, sizeof(date_str),ps);
printf("%s\n",date_str);
pclose(ps);
if((ps = popen("df -h | grep rootfs | awk '{print $5}'", "r")) == NULL )
{
printf("popen() error!\n");
return 1;
}
memset(date_str,0,sizeof(date_str));
fgets(date_str, sizeof(date_str),ps);
printf("%s\n",date_str);
pclose(ps);
return 0;
}
|
Add +: use the proper streamer. | /*************************************************************************
* Copyright (C) 1995-2017, Rene Brun and Fons Rademakers. *
* All rights reserved. *
* *
* For the licensing terms see $ROOTSYS/LICENSE. *
* For the list of contributors see $ROOTSYS/README/CREDITS. *
*************************************************************************/
#ifdef __CINT__
#pragma link off all globals;
#pragma link off all classes;
#pragma link off all functions;
#pragma link C++ class ROOT::Experimental::TWebWindow;
#pragma link C++ class ROOT::Experimental::TWebWindowsManager;
#endif
| /*************************************************************************
* Copyright (C) 1995-2017, Rene Brun and Fons Rademakers. *
* All rights reserved. *
* *
* For the licensing terms see $ROOTSYS/LICENSE. *
* For the list of contributors see $ROOTSYS/README/CREDITS. *
*************************************************************************/
#ifdef __CINT__
#pragma link off all globals;
#pragma link off all classes;
#pragma link off all functions;
#pragma link C++ class ROOT::Experimental::TWebWindow+;
#pragma link C++ class ROOT::Experimental::TWebWindowsManager+;
#endif
|
Add a testcase, enabled only on arm, for llvm-gcc r132366. | // RUN: %llvmgcc -S -march=armv7a %s
// XFAIL: *
// XTARGET: arm
typedef struct __simd128_uint16_t
{
__neon_uint16x8_t val;
} uint16x8_t;
void b(uint16x8_t sat, uint16x8_t luma)
{
__asm__("vmov.16 %1, %0 \n\t"
"vtrn.16 %0, %1 \n\t"
:"=w"(luma), "=w"(sat)
:"0"(luma)
);
}
| |
Add decimal to binary conversion. | //
// main.c
// converter - Command-line number converter to Mac OS
//
// Created by Paulo Ricardo Paz Vital on 23/05/15.
// Copyright (c) 2015 pvital Solutions. All rights reserved.
//
#include <stdio.h>
#include <stdlib.h>
#include <limits.h>
void usage(void) {
printf("usage: convert decimal_number \n");
}
int main(int argc, const char * argv[]) {
int decimal;
if (argc < 2 || argc > 3) {
usage();
return -1;
}
decimal = atoi(argv[1]);
if (decimal < 0) {
printf("ERROR: decimal number must be greater than zero (0).\n");
return -1;
}
if (decimal > INT_MAX) {
printf("ERROR: maximum decimal number supported is %d.\n", INT_MAX);
return -1;
}
return 0;
}
| //
// main.c
// converter - Command-line number converter to Mac OS
//
// Created by Paulo Ricardo Paz Vital on 23/05/15.
// Copyright (c) 2015 pvital Solutions. All rights reserved.
//
#include <stdio.h>
#include <stdlib.h>
#include <limits.h>
void usage(void) {
printf("usage: convert decimal_number \n");
}
void dec2bin(int decimal) {
int remainder[32];
int quocient = decimal, i = 0;
while (quocient >= 2) {
remainder[i] = quocient % 2;
quocient = quocient / 2;
i++;
}
// add the last quocient in the end of remainder list
remainder[i] = quocient;
// print the remainder list in the revert order
printf ("The decimal number %d in binary is: ", decimal);
while (i >= 0) {
printf("%d", remainder[i]);
i--;
}
printf("\n");
}
int main(int argc, const char * argv[]) {
int decimal;
if (argc < 2 || argc > 3) {
usage();
return -1;
}
decimal = atoi(argv[1]);
if (decimal < 0) {
printf("ERROR: decimal number must be greater than zero (0).\n");
return -1;
}
if (decimal > INT_MAX) {
printf("ERROR: maximum decimal number supported is %d.\n", INT_MAX);
return -1;
}
dec2bin(decimal);
return 0;
}
|
Increase game version to 0.1.0. | #ifndef _MAIN_H_
#define _MAIN_H_
#define PROGRAM_MAJOR_VERSION 0
#define PROGRAM_MINOR_VERSION 0
#define PROGRAM_PATCH_VERSION 6
#endif /* _MAIN_H_ */
| #ifndef _MAIN_H_
#define _MAIN_H_
#define PROGRAM_MAJOR_VERSION 0
#define PROGRAM_MINOR_VERSION 1
#define PROGRAM_PATCH_VERSION 0
#endif /* _MAIN_H_ */
|
Swap back the arm and intake buttons | task usercontrol(){
int DY, DT;
bool armsLocked = false;
while(true){
//Driving
DY = threshold(PAIRED_CH2, 15) + (PAIRED_BTN8U * MAX_POWER) - (PAIRED_BTN8D * MAX_POWER);
DT = threshold(PAIRED_CH1, 15) + (PAIRED_BTN8R * MAX_POWER) - (PAIRED_BTN8L * MAX_POWER);
drive(DY, DT);
//Pistons (toggle)
if(PAIRED_BTN7R){
pistons(!PISTON_POS);
waitUntil(!PAIRED_BTN7R);
}
//Arms
if(PAIRED_BTN7L){
armsLocked = !armsLocked;
waitUntil(!PAIRED_BTN7L);
}
if(armsLocked){
arms(ARM_LOCK);
} else {
arms(threshold(PAIRED_CH3, 15) + ((PAIRED_BTN5U - PAIRED_BTN5D) * MAX_POWER));
}
//Lift
lift((PAIRED_BTN7U - PAIRED_BTN7D) * MAX_POWER);
//Intake
intake((PAIRED_BTN6U - PAIRED_BTN6D) * MAX_POWER);
}
}
| task usercontrol(){
int DY, DT;
bool armsLocked = false;
while(true){
//Driving
DY = threshold(PAIRED_CH2, 15) + (PAIRED_BTN8U * MAX_POWER) - (PAIRED_BTN8D * MAX_POWER);
DT = threshold(PAIRED_CH1, 15) + (PAIRED_BTN8R * MAX_POWER) - (PAIRED_BTN8L * MAX_POWER);
drive(DY, DT);
//Pistons (toggle)
if(PAIRED_BTN7R){
pistons(!PISTON_POS);
waitUntil(!PAIRED_BTN7R);
}
//Arms
if(PAIRED_BTN7L){
armsLocked = !armsLocked;
waitUntil(!PAIRED_BTN7L);
}
if(armsLocked){
arms(ARM_LOCK);
} else {
arms(threshold(PAIRED_CH3, 15) + ((PAIRED_BTN6U - PAIRED_BTN6D) * MAX_POWER));
}
//Lift
lift((PAIRED_BTN7U - PAIRED_BTN7D) * MAX_POWER);
//Intake
intake((PAIRED_BTN5U - PAIRED_BTN5D) * MAX_POWER);
}
}
|
Define WIN32_LEAN_AND_MEAN to reduce the pre-compiled header size |
#pragma once
// std headers
#include <string>
#include <vector>
#include <set>
#include <functional>
// windows header
#ifdef _WIN32
#define NOMINMAX
#include <windows.h>
#endif
// common ogre headers
#include "OgrePrerequisites.h"
#include "OgreString.h"
#include "OgreRoot.h"
#include "OgreRenderWindow.h"
#include "OgreCamera.h"
#include "OgreItem.h"
#include "OgreHlmsManager.h"
#include "OgreHlmsTextureManager.h"
// common qt headers
#include <QString>
#include <QWidget>
#include <QDebug>
#include "scopeguard.h"
|
#pragma once
// std headers
#include <string>
#include <vector>
#include <functional>
// windows header
#ifdef _WIN32
#define NOMINMAX
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#endif
// common ogre headers
#include "OgrePrerequisites.h"
#include "OgreString.h"
#include "OgreRoot.h"
#include "OgreRenderWindow.h"
#include "OgreCamera.h"
#include "OgreItem.h"
#include "OgreHlmsManager.h"
#include "OgreHlmsTextureManager.h"
// common qt headers
#include <QString>
#include <QWidget>
#include <QDebug>
#include "scopeguard.h"
|
Increment seconds and show them using LED's. | /*
* main.c
*
* Created: 4/3/2014 8:36:43 AM
* Author: razius
*/
#include <avr/io.h>
#include <avr/interrupt.h>
int main(void){
// Clear Timer on Compare Match (CTC) Mode with OCRnA as top.
TCCR4B |= _BV(WGM42);
// Toggle OCnA on compare match
TCCR4A |= _BV(COM4A0);
// clk / (2 * prescaler * (1 + OCRnA))
OCR4AH = 0x7A;
OCR4AL = 0x12;
// Setup Timer 0 pre-scaler to clk/256
TCCR4B |= _BV(CS42);
// Setup PH3 to output
DDRH |= _BV(DDH3);
// Enable MCU interrupt (set I-flag)
sei();
while (1) {
}
return 0;
}
| /*
* main.c
*
* Created: 4/3/2014 8:36:43 AM
* Author: razius
*/
#include <avr/io.h>
#include <avr/interrupt.h>
uint8_t SECONDS = 0x00;
int main(void){
// Clear Timer on Compare Match (CTC) Mode with OCRnA as top.
TCCR1A |= _BV(WGM12);
// clk / (2 * prescaler * (1 + OCRnA))
OCR1AH = 0x7A;
OCR1AL = 0x12;
// Setup Timer 0 pre-scaler to clk/256
TCCR1B |= _BV(CS12);
// Enable Timer/Counter4 overflow interrupt.
TIMSK1 = _BV(TOIE1);
// Setup PH3 to output
DDRH = 0xFF;
// Enable MCU interrupt (set I-flag)
sei();
while (1) {
PORTH = ~SECONDS;
}
return 0;
}
ISR(TIMER1_OVF_vect){
// Setup PH3 to output
// DDRH |= _BV(DDH3);
// PORTH = PORTH << 1;
if (SECONDS < 60) {
SECONDS++;
}
else {
SECONDS = 0x00;
}
}
|
Use build number instead of version number in startup message | /*
* main.c - where it all begins
*/
#include <std.h>
#include <io.h>
#include <vt100.h>
#include <clock.h>
void function( ) {
kprintf_string( "Interrupt!\n" );
vt_flush();
__asm__ ( "movs pc, lr" );
}
int main(int argc, char* argv[]) {
UNUSED(argc);
UNUSED(argv);
uart_init();
vt_blank();
vt_hide();
debug_message("Welcome to ferOS v%u", __BUILD__);
debug_message("Built %s %s", __DATE__, __TIME__);
// tell the CPU where to handle software interrupts
// void** irq_handler = (void**)0x28;
// *irq_handler = (void*)function;
/*
int i;
for( i = 8; i < 255; i += 4 ) {
irq_handler[i/4] = (void*)function;
}
*/
// __asm__ ("swi 1");
// kprintf_string( "RETURNED" );
// vt_flush();
bool done = false;
while (1) {
vt_read();
vt_write();
if (!done) {
kprintf_cpsr();
done = true;
}
}
vt_blank();
vt_flush();
return 0;
}
| /*
* main.c - where it all begins
*/
#include <std.h>
#include <io.h>
#include <vt100.h>
#include <clock.h>
void function( ) {
kprintf_string( "Interrupt!\n" );
vt_flush();
__asm__ ( "movs pc, lr" );
}
int main(int argc, char* argv[]) {
UNUSED(argc);
UNUSED(argv);
uart_init();
vt_blank();
vt_hide();
debug_message("Welcome to ferOS build %u", __BUILD__);
debug_message("Built %s %s", __DATE__, __TIME__);
// tell the CPU where to handle software interrupts
// void** irq_handler = (void**)0x28;
// *irq_handler = (void*)function;
/*
int i;
for( i = 8; i < 255; i += 4 ) {
irq_handler[i/4] = (void*)function;
}
*/
// __asm__ ("swi 1");
// kprintf_string( "RETURNED" );
// vt_flush();
bool done = false;
while (1) {
vt_read();
vt_write();
if (!done) {
kprintf_cpsr();
done = true;
}
}
vt_blank();
vt_flush();
return 0;
}
|
Add include guard and retrieve PAGE_SIZE_4K definition from libutils | /*
* Copyright 2014, NICTA
*
* This software may be distributed and modified according to the terms of
* the BSD 2-Clause license. Note that NO WARRANTY is provided.
* See "LICENSE_BSD2.txt" for details.
*
* @TAG(NICTA_BSD)
*/
#define STDOUT_FD 1
#define STDERR_FD 2
#define FIRST_USER_FD 3
#define FILE_TYPE_CPIO 0
#define FILE_TYPE_SOCKET 1
#define FD_TABLE_SIZE(x) (sizeof(muslcsys_fd_t) * (x))
/* this implementation does not allow users to close STDOUT or STDERR, so they can't be freed */
#define FREE_FD_TABLE_SIZE(x) (sizeof(int) * ((x) - FIRST_USER_FD))
#define PAGE_SIZE_4K 4096
typedef struct muslcsys_fd {
int filetype;
void *data;
} muslcsys_fd_t;
int allocate_fd(void);
muslcsys_fd_t *get_fd_struct(int fd);
| /*
* Copyright 2014, NICTA
*
* This software may be distributed and modified according to the terms of
* the BSD 2-Clause license. Note that NO WARRANTY is provided.
* See "LICENSE_BSD2.txt" for details.
*
* @TAG(NICTA_BSD)
*/
#ifndef __LIBSEL4MUSLCCAMKES_H__
#define __LIBSEL4MUSLCCAMKES_H__
#include <utils/page.h>
#define STDOUT_FD 1
#define STDERR_FD 2
#define FIRST_USER_FD 3
#define FILE_TYPE_CPIO 0
#define FILE_TYPE_SOCKET 1
#define FD_TABLE_SIZE(x) (sizeof(muslcsys_fd_t) * (x))
/* this implementation does not allow users to close STDOUT or STDERR, so they can't be freed */
#define FREE_FD_TABLE_SIZE(x) (sizeof(int) * ((x) - FIRST_USER_FD))
typedef struct muslcsys_fd {
int filetype;
void *data;
} muslcsys_fd_t;
int allocate_fd(void);
muslcsys_fd_t *get_fd_struct(int fd);
#endif
|
Add default flag for Xcode usage | /*
* Copyright 2019 Andrey Terekhov, Victor Y. Fadeev
*
* 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.
*/
#ifdef _MSC_VER
#pragma comment(linker, "/STACK:268435456")
#endif
#include "compiler.h"
#include "workspace.h"
const char *name = "../tests/executable/structures/SELECT_9459.c";
// "../tests/mips/0test.c";
int main(int argc, const char *argv[])
{
workspace ws = ws_parse_args(argc, argv);
if (argc < 2)
{
ws_add_file(&ws, name);
ws_set_output(&ws, "export.txt");
}
#ifdef TESTING_EXIT_CODE
return compile(&ws) ? TESTING_EXIT_CODE : 0;
#else
return compile(&ws);
#endif
}
| /*
* Copyright 2019 Andrey Terekhov, Victor Y. Fadeev
*
* 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.
*/
#ifdef _MSC_VER
#pragma comment(linker, "/STACK:268435456")
#endif
#include "compiler.h"
#include "workspace.h"
const char *name = "../tests/executable/structures/SELECT_9459.c";
// "../tests/mips/0test.c";
int main(int argc, const char *argv[])
{
workspace ws = ws_parse_args(argc, argv);
if (argc < 2)
{
ws_add_file(&ws, name);
ws_add_flag(&ws, "-Wno");
ws_set_output(&ws, "export.txt");
}
#ifdef TESTING_EXIT_CODE
return compile(&ws) ? TESTING_EXIT_CODE : 0;
#else
return compile(&ws);
#endif
}
|
Revert "Don't put under source control generated file" | #ifndef EXTTEXTCAT_VERSION_H
#define EXTTEXTCAT_VERSION_H
#define EXTTEXTCAT_VERSION "3.1.0"
#define EXTTEXTCAT_VERSION_MAJOR 3
#define EXTTEXTCAT_VERSION_MINOR 1
#define EXTTEXTCAT_VERSION_MICRO 0
#endif
| |
Use a 64-bit uint for MIDI event times | #ifndef AL_EVTQUEUE_H
#define AL_EVTQUEUE_H
#include "AL/al.h"
typedef struct MidiEvent {
ALuint time;
ALuint event;
ALuint param[2];
} MidiEvent;
typedef struct EvtQueue {
MidiEvent *events;
ALsizei pos;
ALsizei size;
ALsizei maxsize;
} EvtQueue;
void InitEvtQueue(EvtQueue *queue);
void ResetEvtQueue(EvtQueue *queue);
ALenum InsertEvtQueue(EvtQueue *queue, const MidiEvent *evt);
#endif /* AL_EXTQUEUE_H */
| #ifndef AL_EVTQUEUE_H
#define AL_EVTQUEUE_H
#include "AL/al.h"
#include "alMain.h"
typedef struct MidiEvent {
ALuint64 time;
ALuint event;
ALuint param[2];
} MidiEvent;
typedef struct EvtQueue {
MidiEvent *events;
ALsizei pos;
ALsizei size;
ALsizei maxsize;
} EvtQueue;
void InitEvtQueue(EvtQueue *queue);
void ResetEvtQueue(EvtQueue *queue);
ALenum InsertEvtQueue(EvtQueue *queue, const MidiEvent *evt);
#endif /* AL_EVTQUEUE_H */
|
Make Scope 8 bytes smaller | #ifndef SCOPE_DEF
#define SCOPE_DEF
#include "hashmap.h"
#include <stdint.h>
typedef struct Scope
{
V file;
V func;
V parent;
int index;
bool is_func_scope;
bool is_error_handler;
uint32_t linenr;
uint32_t* pc;
struct HashMap hm;
} Scope;
typedef struct
{
Value v;
Scope sc;
} ValueScope;
#define MAXCACHE 1024
ValueScope SCOPECACHE[MAXCACHE];
int MAXSCOPE;
V new_scope(V);
V new_function_scope(V);
V new_file_scope(V);
V new_global_scope(void);
#endif
| #ifndef SCOPE_DEF
#define SCOPE_DEF
#include "hashmap.h"
#include <stdint.h>
typedef struct Scope
{
V file;
V func;
V parent;
int index;
uint32_t is_func_scope : 4;
uint32_t is_error_handler : 4;
uint32_t linenr : 24;
uint32_t* pc;
struct HashMap hm;
} Scope;
typedef struct
{
Value v;
Scope sc;
} ValueScope;
#define MAXCACHE 1024
ValueScope SCOPECACHE[MAXCACHE];
int MAXSCOPE;
V new_scope(V);
V new_function_scope(V);
V new_file_scope(V);
V new_global_scope(void);
#endif
|
Add support for line editing and arrow keys | #include <stdio.h>
static char input[2048]; //declaring buffer for user input, size 2048
int main(int argc, char** argv) {
puts("zuzeelik Version 0.0.0-0.0.1");
puts("Press Ctrl+c to Exit \n");
/* Starting REPL */
while(1){
/* output from the prompt*/
fputs("zuzeelik> ", stdout);
/* read a line of the user of max size 2048 */
fgets(input, 2048, stdin);
/* Echo the input back to the user */
printf("Got Input: %s", input);
}
return 0;
}
| #include <stdio.h>
#include <stdlib.h>
#include <editline/readline.h>
#include <editline/history.h>
int main(int argc, char** argv) {
puts("zuzeelik [version: v0.0.0-0.0.2]");
puts("Press Ctrl+C to Exit \n");
/* Starting REPL */
while(1){
/* output from the prompt*/
char* input = readline("zuzeelik> ");
/*Add input to history */
add_history(input);
/* Echo the input back to the user */
printf("Got Input: %s \n", input);
free(input);
}
return 0;
}
|
Add forgotten comment on namespace closing. | // This file is part of MorphoDiTa.
//
// Copyright 2013 by Institute of Formal and Applied Linguistics, Faculty of
// Mathematics and Physics, Charles University in Prague, Czech Republic.
//
// MorphoDiTa 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 3 of
// the License, or (at your option) any later version.
//
// MorphoDiTa 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 MorphoDiTa. If not, see <http://www.gnu.org/licenses/>.
#pragma once
#include <cstring>
#include "common.h"
namespace ufal {
namespace morphodita {
struct string_piece {
const char* str;
size_t len;
string_piece() : str(nullptr), len(0) {}
string_piece(const char* str) : str(str), len(strlen(str)) {}
string_piece(const char* str, size_t len) : str(str), len(len) {}
string_piece(const std::string& str) : str(str.c_str()), len(str.size()) {}
};
} // namespace morphodita
}
| // This file is part of MorphoDiTa.
//
// Copyright 2013 by Institute of Formal and Applied Linguistics, Faculty of
// Mathematics and Physics, Charles University in Prague, Czech Republic.
//
// MorphoDiTa 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 3 of
// the License, or (at your option) any later version.
//
// MorphoDiTa 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 MorphoDiTa. If not, see <http://www.gnu.org/licenses/>.
#pragma once
#include <cstring>
#include "common.h"
namespace ufal {
namespace morphodita {
struct string_piece {
const char* str;
size_t len;
string_piece() : str(nullptr), len(0) {}
string_piece(const char* str) : str(str), len(strlen(str)) {}
string_piece(const char* str, size_t len) : str(str), len(len) {}
string_piece(const std::string& str) : str(str.c_str()), len(str.size()) {}
};
} // namespace morphodita
} // namespace ufal
|
Add a simple wrapper around std::array | #ifndef MUE__TEAM_CONTAINER
#define MUE__TEAM_CONTAINER
#include <array>
#include <vector>
#include <string.h>
#include <boost/assert.hpp>
#include "config.h"
namespace mue {
template <typename T, std::size_t NUM>
class Limited_array
{
private:
using _Value_type = T;
using _Array = std::array<_Value_type, NUM>;
std::size_t _len;
_Array _array;
public:
Limited_array() : _len(0) { }
Limited_array(std::size_t len) : _len(len) { BOOST_ASSERT( _len <= NUM); }
Limited_array(Limited_array<_Value_type, NUM> const &other)
:
_len(other._len),
_array(other._array)
{ }
Limited_array(std::initializer_list<_Value_type> const &values)
:
_len(values.size())
{
std::size_t idx(0);
for (const _Value_type& value : values)
_array[idx++] = value;
}
Limited_array(std::vector<_Value_type> const &other)
:
_len(other.size())
{
BOOST_ASSERT( _len <= NUM );
memcpy(_array.data(), other.data(), sizeof(_Value_type) * _len);
}
std::size_t size() const noexcept { return _len; }
typedef typename _Array::iterator iterator;
typedef typename _Array::const_iterator const_iterator;
typedef typename _Array::value_type value_type;
const_iterator begin() const noexcept { return _array.begin(); }
iterator begin() noexcept { return _array.begin(); }
const_iterator end() const noexcept { return _array.begin() + _len; }
iterator end() noexcept { return _array.begin() + _len; }
const value_type& operator[](std::size_t elem) const noexcept
{
BOOST_ASSERT( elem < _len );
return _array[elem];
}
value_type& operator[](std::size_t elem) noexcept
{
BOOST_ASSERT( elem < _len );
return _array[elem];
}
};
typedef Limited_array<Team_id, MAX_TEAMS / 3> Hosts;
typedef Limited_array<Team_id, (MAX_TEAMS / 3) * 2> Guests;
typedef Limited_array<Team_id, MAX_TEAMS> Teams;
}
#endif
| |
Fix this test so that it's valid; the point is to test for the crash, not the missing diagnostic. | // RUN: clang %s -verify -fsyntax-only
int test1() {
typedef int x[test1()]; // vla
static int y = sizeof(x); // expected-error {{not constant}}
}
// PR2347
void f (unsigned int m)
{
extern int e[2][m];
e[0][0] = 0;
}
| // RUN: clang %s -verify -fsyntax-only
int test1() {
typedef int x[test1()]; // vla
static int y = sizeof(x); // expected-error {{not constant}}
}
// PR2347
void f (unsigned int m)
{
int e[2][m];
e[0][0] = 0;
}
|
Change timeout from 2 to 5 minutes, Jörg Dietrich had suggested to Change timeout from 2 to 5 minutes, Jörg Dietrich had suggested to increase it to 3 minutes, to correspond with current NNTP drafts. | #include "leafnode.h"
#include "ln_log.h"
#include <signal.h>
#include <setjmp.h>
#include <unistd.h>
static jmp_buf to;
static void
timer(int sig)
{
(void)sig;
longjmp(to, 1);
}
/*
* call getaline with timeout
*/
char *
timeout_getaline(FILE * f, int timeout)
{
char *l;
if (setjmp(to)) {
ln_log(LNLOG_SERR, LNLOG_CTOP, "timeout reading.");
return NULL;
}
(void)signal(SIGALRM, timer);
(void)alarm(timeout);
l = getaline(f);
(void)alarm(0U);
return l;
}
char *
mgetaline(FILE * f)
{
return timeout_getaline(f, 120);
}
| #include "leafnode.h"
#include "ln_log.h"
#include <signal.h>
#include <setjmp.h>
#include <unistd.h>
static jmp_buf to;
static void
timer(int sig)
{
(void)sig;
longjmp(to, 1);
}
/*
* call getaline with timeout
*/
char *
timeout_getaline(FILE * f, int timeout)
{
char *l;
if (setjmp(to)) {
ln_log(LNLOG_SERR, LNLOG_CTOP, "timeout reading.");
return NULL;
}
(void)signal(SIGALRM, timer);
(void)alarm(timeout);
l = getaline(f);
(void)alarm(0U);
return l;
}
char *
mgetaline(FILE * f)
{
return timeout_getaline(f, 300);
}
|
Fix test to work on Linux hosts by specifying triple. | // RUN: %clang -arch armv7 -target thumbv7-apple-darwin-eabi -### -c %s 2>&1 | FileCheck %s --check-prefix=CHECK-AAPCS
// RUN: %clang -arch armv7 -### -c %s 2>&1 | FileCheck %s --check-prefix=CHECK-APCS
// RUN: %clang -arch armv7s -### -c %s 2>&1 | FileCheck %s --check-prefix=CHECK-APCS
// RUN: %clang -arch armv7s -target thumbv7-apple-darwin -### -c %s 2>&1 | FileCheck %s --check-prefix=CHECK-APCS
// CHECK-AAPCS: "-target-abi" "aapcs"
// CHECK-APCS: "-target-abi" "apcs-gnu"
| // RUN: %clang -arch armv7 -target thumbv7-apple-darwin-eabi -### -c %s 2>&1 | FileCheck %s --check-prefix=CHECK-AAPCS
// RUN: %clang -arch armv7s -target thumbv7-apple-ios -### -c %s 2>&1 | FileCheck %s --check-prefix=CHECK-APCS
// RUN: %clang -arch armv7s -target thumbv7-apple-darwin -### -c %s 2>&1 | FileCheck %s --check-prefix=CHECK-APCS
// CHECK-AAPCS: "-target-abi" "aapcs"
// CHECK-APCS: "-target-abi" "apcs-gnu"
|
Stop leaving a.out files around. | // RUN: %clang -Wunused-parameter -fdiagnostics-show-name %s 2>&1 | grep "\[warn_unused_parameter\]" | count 1
// RUN: %clang -Wunused-parameter -fno-diagnostics-show-name %s 2>&1 | grep "\[warn_unused_parameter\]" | count 0
int main(int argc, char *argv[]) {
return argc;
}
| // RUN: %clang -fsyntax-only -Wunused-parameter -fdiagnostics-show-name %s 2>&1 | grep "\[warn_unused_parameter\]" | count 1
// RUN: %clang -fsyntax-only -Wunused-parameter -fno-diagnostics-show-name %s 2>&1 | grep "\[warn_unused_parameter\]" | count 0
int main(int argc, char *argv[]) {
return argc;
}
|
Add C++17 depricated error ignore tag. | #ifndef HMLIB_CONFIGVC_INC
#define HMLIB_CONFIGVC_INC 101
#
/*===config_vc===
VisualStudio C/C++の設定用マクロ
config_vc_v1_01/121204 hmIto
拡張子をhppからhに変更
インクルードガードマクロの不要なアンダーバーを消去
*/
#ifdef _MSC_VER
# //windows.hのmin,maxを使わせない
# ifndef NOMINMAX
# define NOMINMAX
# endif
# //古いunsafeな関数群使用による警告回避
# define _CRT_SECURE_NO_WARNINGS
# define _AFX_SECURE_NO_WARNINGS
# define _ATL_SECURE_NO_WARNINGS
# define _SCL_SECURE_NO_WARNINGS
#endif
#
#endif
| #ifndef HMLIB_CONFIGVC_INC
#define HMLIB_CONFIGVC_INC 101
#
/*===config_vc===
VisualStudio C/C++の設定用マクロ
config_vc_v1_01/121204 hmIto
拡張子をhppからhに変更
インクルードガードマクロの不要なアンダーバーを消去
*/
#ifdef _MSC_VER
# //windows.hのmin,maxを使わせない
# ifndef NOMINMAX
# define NOMINMAX
# endif
# //古いunsafeな関数群使用による警告回避
# define _CRT_SECURE_NO_WARNINGS
# define _AFX_SECURE_NO_WARNINGS
# define _ATL_SECURE_NO_WARNINGS
# define _SCL_SECURE_NO_WARNINGS
# define _SILENCE_CXX17_ITERATOR_BASE_CLASS_DEPRECATION_WARNING
# define _SILENCE_ALL_CXX17_DEPRECATION_WARNINGS
#endif
#
#endif
|
Add file accidentally omitted from r6182. | /*
* 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 GrTBackendEffectFactory_DEFINED
#define GrTBackendEffectFactory_DEFINED
#include "GrBackendEffectFactory.h"
#include "GrEffectStage.h"
/**
* Implements GrBackendEffectFactory for a GrEffect subclass as a singleton.
*/
template <typename EffectClass>
class GrTBackendEffectFactory : public GrBackendEffectFactory {
public:
typedef typename EffectClass::GLEffect GLEffect;
/** Returns a human-readable name that is accessible via GrEffect or
GrGLEffect and is consistent between the two of them.
*/
virtual const char* name() const SK_OVERRIDE { return EffectClass::Name(); }
/** Returns a value that identifies the GLSL shader code generated by
a GrEffect. This enables caching of generated shaders. Part of the
id identifies the GrEffect subclass. The remainder is based
on the aspects of the GrEffect object's configuration that affect
GLSL code generation. */
virtual EffectKey glEffectKey(const GrEffectStage& stage,
const GrGLCaps& caps) const SK_OVERRIDE {
GrAssert(kIllegalEffectClassID != fEffectClassID);
EffectKey effectKey = GLEffect::GenKey(stage, caps);
EffectKey textureKey = GLEffect::GenTextureKey(*stage.getEffect(), caps);
#if GR_DEBUG
static const EffectKey kIllegalIDMask = (uint16_t) (~((1U << kEffectKeyBits) - 1));
GrAssert(!(kIllegalIDMask & effectKey));
static const EffectKey kIllegalTextureKeyMask = (uint16_t) (~((1U << kTextureKeyBits) - 1));
GrAssert(!(kIllegalTextureKeyMask & textureKey));
#endif
return fEffectClassID | (textureKey << kEffectKeyBits) | effectKey;
}
/** Returns a new instance of the appropriate *GL* implementation class
for the given GrEffect; caller is responsible for deleting
the object. */
virtual GLEffect* createGLInstance(const GrEffect& effect) const SK_OVERRIDE {
return SkNEW_ARGS(GLEffect, (*this, effect));
}
/** This class is a singleton. This function returns the single instance.
*/
static const GrBackendEffectFactory& getInstance() {
static SkAlignedSTStorage<1, GrTBackendEffectFactory> gInstanceMem;
static const GrTBackendEffectFactory* gInstance;
if (!gInstance) {
gInstance = SkNEW_PLACEMENT(gInstanceMem.get(),
GrTBackendEffectFactory);
}
return *gInstance;
}
protected:
GrTBackendEffectFactory() {
fEffectClassID = GenID() << (kEffectKeyBits + kTextureKeyBits) ;
}
};
#endif
| |
Fix compilation issue in tests by forward-declaring CitrusRobot | #ifndef BASE_CLASS_H_
#define BASE_CLASS_H_
class BaseAutoFunction {
public:
bool Init(CitrusRobot *robot, std::vector<void *>);
bool Periodic(CitrusRobot *robot, std::vector<void *>);
private:
//none
};
#endif
| #ifndef BASE_CLASS_H_
#define BASE_CLASS_H_
class CitrusRobot;
class BaseAutoFunction {
public:
bool Init(CitrusRobot *robot, std::vector<void *>);
bool Periodic(CitrusRobot *robot, std::vector<void *>);
private:
//none
};
#endif
|
Remove imageSaved() signal as it is old code. | // -*- c++ -*-
#ifndef QT_CAM_IMAGE_MODE_H
#define QT_CAM_IMAGE_MODE_H
#include "qtcammode.h"
#include <gst/pbutils/encoding-profile.h>
class QtCamDevicePrivate;
class QtCamImageModePrivate;
class QtCamImageSettings;
class QtCamImageMode : public QtCamMode {
Q_OBJECT
public:
QtCamImageMode(QtCamDevicePrivate *d, QObject *parent = 0);
~QtCamImageMode();
virtual bool canCapture();
virtual void applySettings();
bool capture(const QString& fileName);
bool setSettings(const QtCamImageSettings& settings);
void setProfile(GstEncodingProfile *profile);
signals:
void imageSaved(const QString& fileName);
protected:
virtual void start();
virtual void stop();
private:
QtCamImageModePrivate *d_ptr;
};
#endif /* QT_CAM_IMAGE_MODE_H */
| // -*- c++ -*-
#ifndef QT_CAM_IMAGE_MODE_H
#define QT_CAM_IMAGE_MODE_H
#include "qtcammode.h"
#include <gst/pbutils/encoding-profile.h>
class QtCamDevicePrivate;
class QtCamImageModePrivate;
class QtCamImageSettings;
class QtCamImageMode : public QtCamMode {
Q_OBJECT
public:
QtCamImageMode(QtCamDevicePrivate *d, QObject *parent = 0);
~QtCamImageMode();
virtual bool canCapture();
virtual void applySettings();
bool capture(const QString& fileName);
bool setSettings(const QtCamImageSettings& settings);
void setProfile(GstEncodingProfile *profile);
protected:
virtual void start();
virtual void stop();
private:
QtCamImageModePrivate *d_ptr;
};
#endif /* QT_CAM_IMAGE_MODE_H */
|
Fix mongo build -take 2 | // Copyright (c) 2014, Facebook, Inc. All rights reserved.
// This source code is licensed under the BSD-style license found in the
// LICENSE file in the root directory of this source tree. An additional grant
// of patent rights can be found in the PATENTS file in the same directory.
#pragma once
#include "utilities/pragma_error.h"
// TODO(agiardullo): need to figure out how to make this portable
// ROCKSDB_WARNING("This file was moved to rocksdb/convenience.h")
#include "rocksdb/convenience.h"
| // Copyright (c) 2014, Facebook, Inc. All rights reserved.
// This source code is licensed under the BSD-style license found in the
// LICENSE file in the root directory of this source tree. An additional grant
// of patent rights can be found in the PATENTS file in the same directory.
#pragma once
// #include "utilities/pragma_error.h"
// TODO(agiardullo): need to figure out how to make this portable
// ROCKSDB_WARNING("This file was moved to rocksdb/convenience.h")
#include "rocksdb/convenience.h"
|
Add crude tests for bool simplifications. | int range0(int a)
{
return 0 <= a && a < 10;
}
int range1(int a)
{
return 1 <= a && a < 10;
}
int test_lt_and_lt(int a)
{
return a < 5 && a < 10;
}
int test_lt_and_eq(int a)
{
return a < 5 && a == 10;
}
int test_lt_and_gt(int a)
{
return a < 5 && a > 10;
}
int test_eq_and_lt(int a)
{
return a == 5 && a < 10;
}
int test_eq_and_eq(int a)
{
return a == 5 && a == 10;
}
int test_eq_and_gt(int a)
{
return a == 5 && a > 10;
}
int test_ge_and_lt(int a)
{
return a >= 5 && a < 6;
}
int test_gt_and_lt(int a)
{
return a > 5 && a < 6;
}
int test_lt_or_lt(int a)
{
return a < 5 || a < 10;
}
int test_lt_or_eq(int a)
{
return a < 5 || a == 5;
}
int test_ne_or_ne(int a)
{
return a != 5 || a != 10;
}
int main(void)
{
return 0;
}
| |
Add unique and obvious register values for AAPCS demo. | #include <stdio.h>
#include "TM4C123GH6PM.h"
#include "lm4f120h5qr.h"
#include "interrupt.h"
#include "larson.h"
#include "led.h"
#include "UART.h"
int main(void){
UART_Init(); // Initialize UART before outputting...
printf("%s\n", "Initializing...");
LED_Init(); // Initialize LEDs on GPIOF
Larson_Init(); // Initialize Larson scanner on GPIOB.
GPIOA_Pin_Init(); // Initialize GPIOA Pins and interrupts.
SysTick_Init(); // Initialize SysTick interrupts.
// Loop forever.
while (1) {}
}
| #include <stdio.h>
#include "TM4C123GH6PM.h"
#include "lm4f120h5qr.h"
#include "interrupt.h"
#include "larson.h"
#include "led.h"
#include "UART.h"
int main(void){
UART_Init(); // Initialize UART before outputting...
printf("%s\n", "Initializing...");
LED_Init(); // Initialize LEDs on GPIOF
Larson_Init(); // Initialize Larson scanner on GPIOB.
GPIOA_Pin_Init(); // Initialize GPIOA Pins and interrupts.
SysTick_Init(); // Initialize SysTick interrupts.
// Loop forever.
while (1) {
/* AAPCS Demo */
__asm volatile (
" mov r0,#0x11111111\n\t"
" mov r1,#0x22222222\n\t"
" mov r2,#0x33333333\n\t"
" mov r3,#0x44444444\n\t"
);
}
}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.