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_...
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)); fo...
/* 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 - s...
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. * * ...
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/...
#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/acco...
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> #...
/* * Copyright (c) 2021-2022 Morwenn * SPDX-License-Identifier: MIT */ #ifndef CPPSORT_DETAIL_FUNCTIONAL_H_ #define CPPSORT_DETAIL_FUNCTIONAL_H_ //////////////////////////////////////////////////////////// // Headers //////////////////////////////////////////////////////////// #include <type_traits> #include <utili...
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(); }; } // ...
#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(); ...
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); ...
#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); ...
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); ...
#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(S...
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(phpired...
#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(phpir...
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 ...
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::Profi...
#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::Prof...
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--; ...
#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--; ...
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 wi...
/* * 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 wi...
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 ...
// // 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 ...
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", W...
/**************************************************************************** * * 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", W...
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 ...
/* * 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 ...
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 *_viewContr...
// // 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 <NSToolbarDeleg...
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...
/* 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...
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? ...
#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/l...
/** * 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/l...
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 /* The...
#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 /* The...
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. ...
// @(#)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. ...
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 ...
#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...
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) -...
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)categ...
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/authoriz...
#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/authoriz...
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...
/* * 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> #inclu...
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 vect...
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*)byt...
/** * \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*)byt...
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. */...
// // 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. * ...
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(UIN...
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_CH...
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...
#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; ...
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 ...
/* * $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);...
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; #pragm...
#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+; #p...
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 ...
#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; } v...
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 onl...
#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 C...
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 argume...
//! 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 argume...
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...
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) ( \...
#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) ( \...
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 So...
/* 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 So...
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; ...
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 versio...
/* 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 versio...
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 distribut...
/* 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 distribut...
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 vo...
// 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 vo...
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(MP...
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_en...
/* 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_STAC...
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, includ...
// // 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, includ...
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) ...
/* 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 != EEX...
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/LI...
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 a...
#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 <itkSmartPoi...
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 agree...
/* * * 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 agree...
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...
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. * * ...
/* @(#)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. * * ...
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) #def...
#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) #def...
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, uin...
#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, stru...
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. // //===----------...
//===-- 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. // //===----------...
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 // CHE...
// 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") =...
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_ALIGNMEN...
/*! \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...
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 DEFAUL...
// // 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 HOSTNA...
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"),...
#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"),...
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" #inclu...
// 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" #inclu...
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...
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_V...
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 = N...
#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 = N...
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...
Add +: use the proper streamer.
/************************************************************************* * Copyright (C) 1995-2017, Rene Brun and Fons Rademakers. * * All rights reserved. * * * * For the licensing...
/************************************************************************* * Copyright (C) 1995-2017, Rene Brun and Fons Rademakers. * * All rights reserved. * * * * For the licensing...
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"...
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"); } ...
// // 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"); } ...
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...
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...
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" #includ...
#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 "OgreRenderWind...
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...
/* * 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; ...
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_blan...
/* * 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_blan...
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 FIL...
/* * 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/p...
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 applicabl...
/* * 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 applicabl...
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...
#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...
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 MAXCACH...
#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; } ValueSc...
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 th...
#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 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 Li...
// 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 Li...
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, NU...
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(...
#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(...
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 -tar...
// 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 --...
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_W...
#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_W...
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 GrBackendEff...
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 *...
// -*- 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 *...
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 "utiliti...
// 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 "util...
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;...
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...
#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...