Instruction
stringlengths
14
778
input_code
stringlengths
0
4.24k
output_code
stringlengths
1
5.44k
Add a local memory vector implementation
/* * Lift * * Copyright (c) 2014-2015, NVIDIA CORPORATION * Copyright (c) 2015, Nuno Subtil <subtil@gmail.com> * Copyright (c) 2015, Roche Molecular Systems Inc. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the followi...
Replace removed Pointer_stringify with UTF8ToString
#include "emscripten.h" #include <stdlib.h> #include <unistd.h> #include "param.h" int os_preamble() { if (access("/dev/zero", R_OK)) EM_ASM(({ FS.createDevice('/dev', 'zero', function () { return 0; }); }),/* dummy arg */0); EM_ASM_(({ if (ENVIRONMENT_IS_NODE) { var mnt = Pointer_...
#include "emscripten.h" #include <stdlib.h> #include <unistd.h> #include "param.h" int os_preamble() { if (access("/dev/zero", R_OK)) EM_ASM(({ FS.createDevice('/dev', 'zero', function () { return 0; }); }),/* dummy arg */0); EM_ASM_(({ if (ENVIRONMENT_IS_NODE) { var len = 1024; /*...
Make this test darwin specific.
// RUN: %llvmgcc -S -O2 -g %s -o - | llc -O2 -o %t.s // RUN: grep "# DW_TAG_formal_parameter" %t.s | count 4 // Radar 8122864 // XFAIL: powerpc static int foo(int a, int j) { int k = 0; if (a) k = a + j; else k = j; return k; } int bar(int o, int p) { return foo(o, p); }
// RUN: %llvmgcc -S -O2 -g %s -o - | llc -O2 -o %t.s // RUN: grep "# DW_TAG_formal_parameter" %t.s | count 4 // Radar 8122864 // XTARGET: x86,darwin static int foo(int a, int j) { int k = 0; if (a) k = a + j; else k = j; return k; } int bar(int o, int p) { return foo(o, p); }
Mark the copied-in data as being present before flushing the buffer. Without this patch, no data is ever written.
#include <unistd.h> #include "iobuf.h" /** Copy all the data from an \c ibuf to an \c obuf. */ int obuf_copyfromfd(int in, obuf* out) { long rd; if (obuf_error(out)) return 0; out->count = 0; for (;;) { if ((rd = read(in, out->io.buffer + out->bufpos, out->io.bufsize - out->bufpos)) == -1) ...
#include <unistd.h> #include "iobuf.h" /** Copy all the data from an \c ibuf to an \c obuf. */ int obuf_copyfromfd(int in, obuf* out) { long rd; if (obuf_error(out)) return 0; out->count = 0; for (;;) { if ((rd = read(in, out->io.buffer + out->bufpos, out->io.bufsize - out->bufpos)) == -1) ...
Use new API for and parsing
#include "test_parser.h" void and_false(void **state) { grammar_t *grammar = grammar_init( non_terminal("And"), rule_init( "And", sequence( and(terminal("hello")), terminal("h") ) ), 1 ); parse_t *result = parse("help", grammar); assert_null(result); } void and_t...
#include "test_parser.h" void and_false(void **state) { grammar_t *grammar = grammar_init( non_terminal("And"), rule_init( "And", sequence( and(terminal("hello")), terminal("h") ) ), 1 ); parse_result_t *result = parse("help", grammar); assert_non_null(result); ...
Add header that was accidentally left out of r231724.
//===------ JITSymbolFlags.h - Flags for symbols in the JIT -----*- C++ -*-===// // // The LLVM Compiler Infrastructure // // This file is distributed under the University of Illinois Open Source // License. See LICENSE.TXT for details. // //===-------------------------------------------------------...
Use correct variable for number of tests
#include <stdlib.h> #include <stdio.h> #include <check.h> #include "check_check.h" int main (void) { int n; SRunner *sr; fork_setup(); setup_fixture(); sr = srunner_create (make_master_suite()); srunner_add_suite(sr, make_list_suite()); srunner_add_suite(sr, make_msg_suite()); srunner_add_suite(sr, ma...
#include <stdlib.h> #include <stdio.h> #include <check.h> #include "check_check.h" int main (void) { int n; SRunner *sr; fork_setup(); setup_fixture(); sr = srunner_create (make_master_suite()); srunner_add_suite(sr, make_list_suite()); srunner_add_suite(sr, make_msg_suite()); srunner_add_suite(sr, ma...
Use correct variable for number of tests
#include <stdlib.h> #include <stdio.h> #include <check.h> #include "check_check.h" int main (void) { int n; SRunner *sr; fork_setup(); setup_fixture(); sr = srunner_create (make_master_suite()); srunner_add_suite(sr, make_list_suite()); srunner_add_suite(sr, make_msg_suite()); srunner_add_suite(sr, ma...
#include <stdlib.h> #include <stdio.h> #include <check.h> #include "check_check.h" int main (void) { int n; SRunner *sr; fork_setup(); setup_fixture(); sr = srunner_create (make_master_suite()); srunner_add_suite(sr, make_list_suite()); srunner_add_suite(sr, make_msg_suite()); srunner_add_suite(sr, ma...
Include headers we need directly
/****************************************************************/ /* DO NOT MODIFY THIS HEADER */ /* MOOSE - Multiphysics Object Oriented Simulation Environment */ /* */ /* (c) 2010 Battelle Energy Alliance, LLC ...
/****************************************************************/ /* DO NOT MODIFY THIS HEADER */ /* MOOSE - Multiphysics Object Oriented Simulation Environment */ /* */ /* (c) 2010 Battelle Energy Alliance, LLC ...
Use pragma once instead of define hack (thanks Natalia)
#ifndef LOGDEFER_H #define LOGDEFER_H #include "picojson/picojson.h" class LogDefer { public: LogDefer(std::function<void (const std::string&)> callback); ~LogDefer(); void add_log(int verbosity, std::string msg); void error(std::string msg); void warn(std::string msg); void info(std::string...
#pragma once #include "picojson/picojson.h" class LogDefer { public: LogDefer(std::function<void (const std::string&)> callback); ~LogDefer(); void add_log(int verbosity, std::string msg); void error(std::string msg); void warn(std::string msg); void info(std::string msg); void debug(std...
Comment the file "doxygen style"
#ifdef __cplusplus extern "C"{ #endif typedef int vl6180; #define VL1680_DEFALUT_ADDR 0x29 int vl6180_initialise(int device, int i2cAddr); int get_distance(vl6180 handle); void set_scaling(vl6180 handle, int scaling); ///After calling that, you should discrad the handle to talk to the device and re-initialize it v...
#ifdef __cplusplus extern "C"{ #endif typedef int vl6180; #define VL1680_DEFALUT_ADDR 0x29 ///Initialize a vl6180 sensor on the i2c port /// \param device The I2C bus to open. e.g. "1" for using /dev/i2c-1 /// \param i2c_addr addres of the device. If you don't know, pass VL1680_DEFALUT_ADDR to it /// \return handle...
Add everything to header file
#ifndef _SYS_IO_H #define _SYS_IO_H #include <stdint.h> unsigned char inb(uint16_t port); void outb(uint16_t port, uint8_t value); #endif
#ifndef _SYS_IO_H #define _SYS_IO_H #include <stdint.h> uint8_t inb(uint16_t port); void outb(uint16_t port, uint8_t value); uint16_t inw(uint16_t port); void outw(uint16_t port, uint16_t value); uint32_t inl(uint16_t port); void outl(uint16_t port, uint32_t value); #endif
Include Ralf Wildenhues' lclint annotations.
#ifndef CRITMEM_H #define CRITMEM_H #include <sys/types.h> void *mycritmalloc(const char *f, long, size_t size, const char *message); void *mycritcalloc(const char *f, long, size_t size, const char *message); void *mycritrealloc(const char *f, long, void *a, size_t size, const char *message); char *mycritstrdup...
#ifndef CRITMEM_H #define CRITMEM_H #include <sys/types.h> /*@only@*//*@out@ */ void *mycritmalloc(const char *f, long, size_t size, const char *message); /*@only@*/ void *mycritcalloc(const char *f, long, size_t size, const char *message); /*@only@*//*@out@ *//*@notnull@ */ void *mycritrealloc(const ch...
Rename member field according to the style guide.
// Taken from https://gist.github.com/arvidsson/7231973 #ifndef BITCOIN_REVERSE_ITERATOR_HPP #define BITCOIN_REVERSE_ITERATOR_HPP /** * Template used for reverse iteration in C++11 range-based for loops. * * std::vector<int> v = {1, 2, 3, 4, 5}; * for (auto x : reverse_iterate(v)) * std::cout << x << ...
// Taken from https://gist.github.com/arvidsson/7231973 #ifndef BITCOIN_REVERSE_ITERATOR_H #define BITCOIN_REVERSE_ITERATOR_H /** * Template used for reverse iteration in C++11 range-based for loops. * * std::vector<int> v = {1, 2, 3, 4, 5}; * for (auto x : reverse_iterate(v)) * std::cout << x << " ";...
Add regression test for qsort
#include <kotaka/paths.h> #include <kotaka/log.h> static void create() { } void test() { }
#include <kotaka/paths.h> #include <kotaka/log.h> #include <kotaka/assert.h> static void create() { } private void test_qsort() { int *arr, i; arr = allocate(1000); for (i = 0; i < 1000; i++) { arr[i] = random(1000000); } SUBD->qsort(arr, 0, 1000); for (i = 0; i < 999; i++) { ASSERT(arr[i] <= arr[i + 1]...
Fix warnings and remove unused header
#pragma once #include <math.h> #include "WaveShape.h" class Oscillator { public: WaveShape waveShape; double frequency = 1.0; double amplitude = 1.0; double speed = 1.0; uint32_t phaseAccumulator = 0; Oscillator() = default; Oscillator(const WaveShape &waveShape) : waveShape(waveShape), frequency(waveShape.pr...
#pragma once #include "WaveShape.h" class Oscillator { public: WaveShape waveShape; double frequency = 1.0; double amplitude = 1.0; double speed = 1.0; uint32_t phaseAccumulator = 0; Oscillator() = default; Oscillator(const WaveShape &waveShape) : waveShape(waveShape), frequency(waveShape.preferredFrequency) ...
Fix logic that enables pre-ARC behavior
#if (defined(__IPHONE_OS_VERSION_MIN_REQUIRED) && (!defined(__IPHONE_6_0) || __IPHONE_OS_VERSION_MIN_REQUIRED < __IPHONE_6_0)) || \ (defined(__MAC_OS_X_VERSION_MIN_REQUIRED) && (!defined(__MAC_10_8) || __MAC_OS_X_VERSION_MIN_REQUIRED < __MAC_10_8)) #define PT_DISPATCH_RETAIN_RELEASE 1 #endif #if PT_DISPATCH_RETAIN...
#if (defined(__IPHONE_OS_VERSION_MIN_REQUIRED) && (!defined(__IPHONE_6_0) || __IPHONE_OS_VERSION_MIN_REQUIRED < __IPHONE_6_0)) || \ (defined(__MAC_OS_X_VERSION_MIN_REQUIRED) && (!defined(__MAC_10_8) || __MAC_OS_X_VERSION_MIN_REQUIRED < __MAC_10_8)) #define PT_DISPATCH_RETAIN_RELEASE 1 #endif #define PT_PRECISE_LIF...
Define actor sized as float for type safety.
/* * Copyright © 2010 Intel Corp. * * Authors: Rob Staudinger <robert.staudinger@intel.com> * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU Lesser General Public License, * version 2.1, as published by the Free Software Foundation. * * Th...
/* * Copyright © 2010 Intel Corp. * * Authors: Rob Staudinger <robert.staudinger@intel.com> * * This program is free software; you can redistribute it and/or modify it * under the terms and conditions of the GNU Lesser General Public License, * version 2.1, as published by the Free Software Foundation. * * Th...
Change method name : `signal' => `notify'
#pragma once namespace LWP { class ICondVar { public: virtual void wait() = 0; virtual void signal() = 0; virtual void broadcast() = 0; virtual ~ICondVar() {} }; }
#pragma once namespace LWP { class ICondVar { public: virtual void wait() = 0; virtual void notify() = 0; virtual void broadcast() = 0; virtual ~ICondVar() {} }; }
Add kernel.h, task.h and types.h, forming a facade interface
#ifndef __STDLIB_H__ #define __STDLIB_H__ void assert(int boolean, char * msg); #endif // __STDLIB_H__
#ifndef __STDLIB_H__ #define __STDLIB_H__ #include <kernel.h> #include <task.h> #include <types.h> void assert(int boolean, char * msg); #endif // __STDLIB_H__
Fix case-sensitive file import from CoreNfc -> CoreNFC
#if __has_include(<React/RCTBridgeModule.h>) #import <React/RCTBridgeModule.h> #import <React/RCTEventEmitter.h> #elif __has_include(“React/RCTBridgeModule.h”) #import “React/RCTBridgeModule.h” #else #import “RCTBridgeModule.h” #import <React/RCTEventEmitter.h> #endif #import <CoreNfc/CoreNfc.h> @interface NfcManager ...
#if __has_include(<React/RCTBridgeModule.h>) #import <React/RCTBridgeModule.h> #import <React/RCTEventEmitter.h> #elif __has_include(“React/RCTBridgeModule.h”) #import “React/RCTBridgeModule.h” #else #import “RCTBridgeModule.h” #import <React/RCTEventEmitter.h> #endif #import <CoreNFC/CoreNFC.h> @interface NfcManager ...
Add name to add_job param
#ifndef __MACHINE_H__ #define __MACHINE_H__ #include <string> #include <vector> #include "job.h" class Machine { public: Machine(const std::string& machine_name); const std::string& get_name() const; void add_job(Job); private: std::string name; std::vector<Job> jobs; ...
#ifndef __MACHINE_H__ #define __MACHINE_H__ #include <string> #include <vector> #include "job.h" class Machine { public: Machine(const std::string& machine_name); const std::string& get_name() const; void add_job(Job new_job); private: std::string name; std::vector<Job...
Add (w)char casting operator to windows char classes
//--------------------------------------------------------------------------// /// Copyright (c) 2017 by Milos Tosic. All Rights Reserved. /// /// License: http://www.opensource.org/licenses/BSD-2-Clause /// //--------------------------------------------------------------------------// #if...
//--------------------------------------------------------------------------// /// Copyright (c) 2017 by Milos Tosic. All Rights Reserved. /// /// License: http://www.opensource.org/licenses/BSD-2-Clause /// //--------------------------------------------------------------------------// #if...
Fix header guard typo and build error.
//===- llvm/Transforms/Utils/SizeOpts.h - size optimization -----*- C++ -*-===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===---------------------------...
//===- llvm/Transforms/Utils/SizeOpts.h - size optimization -----*- C++ -*-===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===---------------------------...
Add macros to define getters and setters
#ifndef LBS_COMMON_H #define LBS_COMMON_H #include <stddef.h> #ifdef __STDC_VERSION__ # include <stdbool.h> # if __STDC_VERSION__ >= 201112L # define LBS_COMMON_ISO_C11 # define LBS_COMMON_CHECK_TYPE(x,type) (_Generic ((x), type: (x))) # else # define LBS_COMMON_ISO_C99 # define LBS_COMMON_CHECK_TYPE(x,type) (x) ...
#ifndef LBS_COMMON_H #define LBS_COMMON_H #include <stddef.h> #ifdef __STDC_VERSION__ # include <stdbool.h> # if __STDC_VERSION__ >= 201112L # define LBS_COMMON_ISO_C11 # define LBS_COMMON_CHECK_TYPE(x,type) (_Generic ((x), type: (x))) # else # define LBS_COMMON_ISO_C99 # define LBS_COMMON_CHECK_TYPE(x,type) (x) ...
Add problem transformation to shift the objective.
#include <assert.h> #include <numbbo.h> #include "numbbo_problem.c" typedef struct { double amount; } shift_objective_state_t; static void _so_evaluate_function(numbbo_problem_t *self, double *x, double *y) { assert(problem->inner_problem != NULL); assert(problem->state != NULL); numbbo_transformed_p...
Add the test program, too
#include <stdio.h> #include <string.h> #include "ausearch-string.h" slist s; int print_list(void) { int cnt = 0; slist_first(&s); do { snode *cur = slist_get_cur(&s); if (cur) { cnt++; printf("%s\n", cur->str); } } while (slist_next(&s)); return cnt; } int main(void) { snode n; int rc; slist_cre...
Add client name and version constants.
// Copyright (c) 2011 The WebM project authors. All Rights Reserved. // // Use of this source code is governed by a BSD-style license // that can be found in the LICENSE file in the root of the source // tree. An additional intellectual property rights grant can be found // in the file PATENTS. All contributing projec...
// Copyright (c) 2011 The WebM project authors. All Rights Reserved. // // Use of this source code is governed by a BSD-style license // that can be found in the LICENSE file in the root of the source // tree. An additional intellectual property rights grant can be found // in the file PATENTS. All contributing projec...
Use NELEMS() instead of open code.
#include "unwind_i.h" static const char *regname[] = { "eax", "ebx", "ecx", "edx", "esi", "edi", "ebp", "eip", "esp" }; const char * unw_regname (unw_regnum_t reg) { if (reg < NELEMS (regname)) return regname[reg]; else return "???"; }
Add comment for struc Point definition
/** Author : Paul TREHIOU & Victor SENE * Date : November 2014 **/ /** * * */ typedef struct { float x; float y; }Point; /** * Function wich create a point with a specified abscisse and ordinate * abscisse - real * ordinate - real * return a new point */
/** Author : Paul TREHIOU & Victor SENE * Date : November 2014 **/ /** * Declaration Point structure * x - real wich is the abscisse of the point * y - real wich is the ordinate of the point */ typedef struct { float x; float y; }Point; /** * Function wich create a point with a specified abscisse and...
Modify MAX(x,y) to not contain a scope
#ifndef __MACROS_H__ #define __MACROS_H__ /** * @file macros.h * * This file contains simple helper macros */ /** * @addtogroup internal_util_helper_macros "(internal) helper macros" * * This group contains helper macros for internal use only. * * @{ */ /** * Computes the maximum value of the two passed v...
#ifndef __MACROS_H__ #define __MACROS_H__ /** * @file macros.h * * This file contains simple helper macros */ /** * @addtogroup internal_util_helper_macros "(internal) helper macros" * * This group contains helper macros for internal use only. * * @{ */ /** * Computes the maximum value of the two passed v...
Add basis use of timers
/* * main.c * * Created on: 2 Nov 2016 * Author: rafpe */ #include "stm32f4xx.h" #include "stm32f407xx.h" int main(void) { volatile uint32_t delay; RCC->AHB1ENR |= RCC_AHB1ENR_GPIODEN | RCC_AHB1ENR_GPIOCEN; // enable the clock to GPIOD & GPIOC RCC->APB2ENR |= RCC_APB2ENR_SYSCFGEN | RCC_APB2ENR_TIM1E...
Make int32_t available when the configure script is not used
/* * Copyright (c) 2009, 2010 Petri Lehtinen <petri@digip.org> * * Jansson is free software; you can redistribute it and/or modify * it under the terms of the MIT license. See LICENSE for details. */ #ifndef UTF_H #define UTF_H #ifdef HAVE_CONFIG_H #include <config.h> #endif #ifdef HAVE_INTTYPES_H /* inttypes.h...
/* * Copyright (c) 2009, 2010 Petri Lehtinen <petri@digip.org> * * Jansson is free software; you can redistribute it and/or modify * it under the terms of the MIT license. See LICENSE for details. */ #ifndef UTF_H #define UTF_H #ifdef HAVE_CONFIG_H #include <config.h> #ifdef HAVE_INTTYPES_H /* inttypes.h includ...
Delete redundant staff from FuncMemory class
/** * func_memory.h - Header of module implementing the concept of * programer-visible memory space accesing via memory address. * @author Alexander Titov <alexander.igorevich.titov@gmail.com> * Copyright 2012 uArchSim iLab project */ // protection from multi-include #ifndef FUNC_MEMORY__FUNC_MEMORY_H #define FU...
/** * func_memory.h - Header of module implementing the concept of * programer-visible memory space accesing via memory address. * @author Alexander Titov <alexander.igorevich.titov@gmail.com> * Copyright 2012 uArchSim iLab project */ // protection from multi-include #ifndef FUNC_MEMORY__FUNC_MEMORY_H #define FU...
Create "checkout lines" as DLinkedList
#pragma once class RegisterQueue{ private: public: int numberOfCustomers; int maxLineLength; };
#pragma once #include "Customer.h" class RegisterQueue{ private: struct Node { Node *next; // After previous sequentially Node *previous; // First in line Customer value; // @next = NULL, this is a shorthand constructor to make NULL the default Node(Customer value, Node *previous = null...
Add a deprecated warning for - (void)clear.
// // Tesseract.h // Tesseract // // Created by Loïs Di Qual on 24/09/12. // Copyright (c) 2012 Loïs Di Qual. // Under MIT License. See 'LICENCE' for more informations. // #import <UIKit/UIKit.h> @class Tesseract; @protocol TesseractDelegate <NSObject> @optional - (BOOL)shouldCancelImageRecognitionForTesseract:...
// // Tesseract.h // Tesseract // // Created by Loïs Di Qual on 24/09/12. // Copyright (c) 2012 Loïs Di Qual. // Under MIT License. See 'LICENCE' for more informations. // #import <UIKit/UIKit.h> @class Tesseract; @protocol TesseractDelegate <NSObject> @optional - (BOOL)shouldCancelImageRecognitionForTesseract:...
Add missing netdarray.h header file.
#ifndef __netarray_H #define __netarray_H /* * Copyright (c) 2012 Stephen Williams (steve@icarus.com) * Copyright CERN 2012 / Stephen Williams (steve@icarus.com) * * This source code is free software; you can redistribute it * and/or modify it in source code form under the terms of the GNU * General Publ...
Add source of formulas used in biquad filters
/* * Biquad_Filter.h * * Created on: 24. 6. 2017 * Author: michp */ #ifndef BIQUAD_FILTER_H_ #define BIQUAD_FILTER_H_ #include <cmath> namespace flyhero { // Many thanks to http://www.earlevel.com/main/2012/11/26/biquad-c-source-code/ class Biquad_Filter { private: const double PI = 3...
/* * Biquad_Filter.h * * Created on: 24. 6. 2017 * Author: michp */ #ifndef BIQUAD_FILTER_H_ #define BIQUAD_FILTER_H_ #include <cmath> namespace flyhero { // Many thanks to http://www.earlevel.com/main/2012/11/26/biquad-c-source-code/ class Biquad_Filter { private: const double PI = 3...
Test function that uses global value
#include <stdio.h> int assertCount, errorCount; void assertEq(int x, int y){ assertCount++; if(x == y) return; errorCount++; printf("ASSERTION %d FAILED: %d does not equal %d\n", assertCount, x, y); } void endTest(){ if(errorCount > 0) printf("TEST FAILED: Encountered %d assertion error%s out of %d!", er...
Include "tdep.h". (unwi_full_sigmask): Define here. (mi_init): Initialize unwi_full_sigmask.
/* libunwind - a platform-independent unwind library Copyright (C) 2002-2003 Hewlett-Packard Co Contributed by David Mosberger-Tang <davidm@hpl.hp.com> This file is part of libunwind. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (...
Add brief description for TransferFunctionParser.
#ifndef SRC_TRANSFER_FUNCTION_PARSER_H_ #define SRC_TRANSFER_FUNCTION_PARSER_H_ #include <QGradient> #include <QString> #include <QXmlDefaultHandler> /** * \brief * * */ class QGradientContentHandler; class TransferFunctionParser { public: TransferFunctionParser(QString path); QGradient *parse(); priv...
#ifndef SRC_TRANSFER_FUNCTION_PARSER_H_ #define SRC_TRANSFER_FUNCTION_PARSER_H_ #include <QGradient> #include <QString> #include <QXmlDefaultHandler> class QGradientContentHandler; /** * \brief Parser for XML representation of a QGradient used as transfer function * */ class TransferFunctionParser { public: T...
Include <asm/irq.h> to fix warning.
#include <linux/pci.h> int __init pcibios_map_irq(struct pci_dev *dev, u8 slot, u8 pin) { int irq; if (!pin) return 0; irq = allocate_irqno(); if (irq < 0) return 0; return irq; } /* Do platform specific device initialization at pci_enable_device() time */ int pcibios_plat_dev_init(struct pci_dev *dev) { ...
#include <linux/pci.h> #include <asm/irq.h> int __init pcibios_map_irq(struct pci_dev *dev, u8 slot, u8 pin) { int irq; if (!pin) return 0; irq = allocate_irqno(); if (irq < 0) return 0; return irq; } /* Do platform specific device initialization at pci_enable_device() time */ int pcibios_plat_dev_init(st...
Fix mistake in C template
#include <stdio.h> int main(int argc, char const *argv[]) { int answer = 0; printf("%d\n"); return 0; }
#include <stdio.h> int main(int argc, char const *argv[]) { int answer = 0; printf("%d\n", answer); return 0; }
Make this explicitly inline for consistency's sake.
/* This code is subject to the terms of the Mozilla Public License, v.2.0. http://mozilla.org/MPL/2.0/. */ #pragma once #include <sstream> namespace turbo { namespace str { template <class Iter> std::string join(const Iter& start, const Iter& end, char delim=' ') { std::stringstream ss; Iter it = start; if (...
/* This code is subject to the terms of the Mozilla Public License, v.2.0. http://mozilla.org/MPL/2.0/. */ #pragma once #include <sstream> namespace turbo { namespace str { template <class Iter> inline std::string join(const Iter& start, const Iter& end, char delim=' ') { std::stringstream ss; Iter it = start;...
Revert of a previous commit "Delete main widget in BasicUi"
#ifndef BASICUI_H_ #define BASICUI_H_ #include <QMainWindow> #include "QsLog.h" #include "mainwidget.h" #include "workspace.h" #include "uicontroller.h" class BasicUi: public QMainWindow { Q_OBJECT public: BasicUi(UiController * controller, QWidget *parent = 0); void setWorkspace(Workspace ...
#ifndef BASICUI_H_ #define BASICUI_H_ #include <QMainWindow> #include "QsLog.h" #include "mainwidget.h" #include "workspace.h" #include "uicontroller.h" class BasicUi: public QMainWindow { Q_OBJECT public: BasicUi(UiController * controller, QWidget *parent = 0); void setWorkspace(Workspace ...
Replace placeholder string in time module with time.
#include <stdlib.h> #include "graphics.h" #include "surface.h" #include "time-module.h" typedef struct TimeModule { Module base; } TimeModule; Module* newTimeModule() { TimeModule* module = malloc(sizeof(TimeModule)); module->base.width = 150; module->base.height = 100; module->base.updateFunc = updateTime...
#include <stdlib.h> #include <time.h> #include "graphics.h" #include "surface.h" #include "time-module.h" typedef struct TimeModule { Module base; } TimeModule; Module* newTimeModule() { TimeModule* module = malloc(sizeof(TimeModule)); module->base.width = 150; module->base.height = 100; module->base.updat...
Print usage if the only argument is "-d"
#include <stdio.h> #include <stdlib.h> #include <string.h> #include "emulator.h" void usage(char *programName); int main(int argsNum, char *args[]) { int i; int debugMode = 0; char *filename = NULL; emulator *e; /* Handle arguments */ for (i = 0; i < argsNum; i++) { char *arg...
#include <stdio.h> #include <stdlib.h> #include <string.h> #include "emulator.h" void usage(char *programName); int main(int argsNum, char *args[]) { int i; int debugMode = 0; char *filename = NULL; emulator *e; /* Handle arguments */ for (i = 1; i < argsNum; i++) { char *arg...
Fix incorrect return value in psa_security_lifecycle_state (emul)
/* Copyright (c) 2019 ARM Limited * * 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 * * Unle...
/* Copyright (c) 2019 ARM Limited * * 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 * * Unle...
Add an AtomicInt class... completely untested.
/* -*- mode:linux -*- */ /** * \file atomic_int.h * * Atomic integer operations. This code uses code from * liblinuxkernel, which means that it was indirrectly taken from the * Linux kernel. * * \author Ethan Burns * \date 2008-10-14 */ #if !defined(_ATOMIC_INT_H_) #define _ATOMIC_INT_H_ #define LOCK_PREFIX...
Remove unreachable code after goto in 00/20
#include <assert.h> void stuff() { } int main() { // MyCFG shouldn't ignore loops with exp 0 because they may have else branches bar: if (0) { foo: // label prevents CIL from optimizing away this branch stuff(); // something non-empty } else { goto bar; // direct realnode ...
#include <assert.h> void stuff() { } int main() { // MyCFG shouldn't ignore loops with exp 0 because they may have else branches bar: if (0) { foo: // label prevents CIL from optimizing away this branch stuff(); // something non-empty } else { goto bar; // direct realnode ...
Use a strong reference for the contactObject on the contact view model. Makes it easier to use if you don't have a object that is strongly ref'ed to begin with, like a string ID.
// // ContactCollectionViewCellModel.h // MBContactPicker // // Created by Matt Bowman on 11/20/13. // Copyright (c) 2013 Citrrus, LLC. All rights reserved. // #import <Foundation/Foundation.h> @interface ContactCollectionViewCellModel : NSObject @property (nonatomic, weak) id contactObject; @property (nonatomic...
// // ContactCollectionViewCellModel.h // MBContactPicker // // Created by Matt Bowman on 11/20/13. // Copyright (c) 2013 Citrrus, LLC. All rights reserved. // #import <Foundation/Foundation.h> @interface ContactCollectionViewCellModel : NSObject @property (nonatomic) id contactObject; @property (nonatomic, copy...
Add _XPG6 macro if needed..
#define _XOPEN_SOURCE 4 #define _XOPEN_SOURCE_EXTENDED 1 /* 1 needed for AIX */ #define _XOPEN_VERSION 4 #define _XPG4_2 #include <unistd.h> #include "mycrypt.h" char *mycrypt(const char *key, const char *salt) { return crypt(key, salt); }
#define _XOPEN_SOURCE 4 #define _XOPEN_SOURCE_EXTENDED 1 /* 1 needed for AIX */ #define _XOPEN_VERSION 4 #define _XPG4_2 #ifdef CRYPT_USE_XPG6 # define _XPG6 /* Some Solaris versions require this, some break with this */ #endif #include <unistd.h> #include "mycrypt.h" char *mycrypt(const char *key, const char *salt)...
Remove header that is no longer present
// // Copyright (c) 2016 deltaDNA Ltd. All rights reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by ...
// // Copyright (c) 2016 deltaDNA Ltd. All rights reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by ...
Add basic block tracing information as a type of "profiling" information.
/*===-- Profiling.h - Profiling support library support routines --*- 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. |* |*===---------...
/*===-- Profiling.h - Profiling support library support routines --*- 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. |* |*===---------...
Make SelfInjector aware of inherited methods.
#ifndef SAUCE_INTERNAL_SELF_INJECTOR_H_ #define SAUCE_INTERNAL_SELF_INJECTOR_H_ #include <sauce/memory.h> namespace sauce { namespace internal { /** * If a type requests injection of its own smart pointer, do so. * * An interface Iface requests this by exposing void setSelf(sauce::weak_ptr<Iface>), detected by SF...
#ifndef SAUCE_INTERNAL_SELF_INJECTOR_H_ #define SAUCE_INTERNAL_SELF_INJECTOR_H_ #include <sauce/memory.h> namespace sauce { namespace internal { /** * If a type requests injection of its own smart pointer, do so. * * An interface Iface requests this by exposing void setSelf(sauce::weak_ptr<Iface>), detected by SF...
REFACTOR include the more general macro collection in order_logic.h
/* a test file for ArgyrisPack */ #include <stdio.h> #include "argyris_pack.h" #define ORDER(row,col,nrows,ncols) (row)*(ncols) + (col) void print_matrix(double* matrix, int rows, int cols) { int i, j; for (i = 0; i < rows; i++) { for (j = 0; j < cols; j++) { pr...
/* a test file for ArgyrisPack */ #include <stdio.h> #include "argyris_pack.h" #include "order_logic.h" void print_matrix(double* matrix, int rows, int cols) { int i, j; for (i = 0; i < rows; i++) { for (j = 0; j < cols; j++) { printf("%.16f ", matrix[ORDER(i,j,r...
Complete the test after adding handling of merged attributes on decls.
// RUN: clang -fsyntax-only -verify %s // CC qualifier can be applied only to functions int __attribute__((stdcall)) var1; // expected-warning{{'stdcall' attribute only applies to function types}} int __attribute__((fastcall)) var2; // expected-warning{{'fastcall' attribute only applies to function types}} // Differe...
// RUN: clang -fsyntax-only -verify %s // CC qualifier can be applied only to functions int __attribute__((stdcall)) var1; // expected-warning{{'stdcall' attribute only applies to function types}} int __attribute__((fastcall)) var2; // expected-warning{{'fastcall' attribute only applies to function types}} // Differe...
Fix typo in a comment: it's base58, not base48.
#ifndef BITCOINADDRESSVALIDATOR_H #define BITCOINADDRESSVALIDATOR_H #include <QValidator> /** Base48 entry widget validator. Corrects near-miss characters and refuses characters that are no part of base48. */ class BitcoinAddressValidator : public QValidator { Q_OBJECT public: explicit BitcoinAddressVali...
#ifndef BITCOINADDRESSVALIDATOR_H #define BITCOINADDRESSVALIDATOR_H #include <QValidator> /** Base58 entry widget validator. Corrects near-miss characters and refuses characters that are not part of base58. */ class BitcoinAddressValidator : public QValidator { Q_OBJECT public: explicit BitcoinAddressVal...
Use puts() to save 1 byte.
#define L for(char*c=a[1],y;*c;)printf("%c%c%c%c",(y="$ֶ<&"[*c++-48])&u/2?33:32,y&u?95:32,y&u/4?33:32,*c?32:10);u*=8; main(int u,char**a){L;L;L}
#define L for(char*c=a[1],y;*c;)printf("%c%c%c ",(y="$ֶ<&"[*c++-48])&u/2?33:32,y&u?95:32,y&u/4?33:32);puts("");u*=8; main(int u,char**a){L;L;L}
Declare libunwind-entry-points as PROTECTED to ensure local uses get resolved within the library itself.
/* libunwind - a platform-independent unwind library Copyright (C) 2002 Hewlett-Packard Co Contributed by David Mosberger-Tang <davidm@hpl.hp.com> This file is part of libunwind. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "...
Add a double check locking example
#include "rmc.h" struct mutex_t; struct foo_t; typedef struct mutex_t mutex_t; typedef struct foo_t foo_t; extern void mutex_lock(mutex_t *p); extern void mutex_unlock(mutex_t *p); extern foo_t *new_foo(void); extern mutex_t *foo_lock; foo_t *get_foo(void) { static foo_t *single_foo = 0; XEDGE(read, post...
Throw exception on cuda error to get a stack trace.
#ifndef SRC_UTILS_CUDA_HELPER_H_ #define SRC_UTILS_CUDA_HELPER_H_ #include <cuda.h> #include <cuda_runtime.h> #include <iostream> static void HandleError(cudaError_t err, const char *file, int line) { if (err != cudaSuccess) { printf("%s in %s at line %d\n", cudaGetErrorString(err), file, line); exit(EXI...
#ifndef SRC_UTILS_CUDA_HELPER_H_ #define SRC_UTILS_CUDA_HELPER_H_ #include <cuda.h> #include <cuda_runtime.h> #include <iostream> #include <stdexcept> static void HandleError(cudaError_t error, const char *file, int line) { if (error != cudaSuccess) { printf("%s in %s at line %d\n", cudaGetErrorString(error)...
Add regression test (based on ctrace_comb) where singlethreaded mode unlock causes side effect with lazy-mine
#include <pthread.h> #include <assert.h> int g = 0; pthread_mutex_t A = PTHREAD_MUTEX_INITIALIZER; void *t_fun(void *arg) { // just for going to multithreaded mode return NULL; } int main() { pthread_mutex_lock(&A); g = 1; pthread_mutex_unlock(&A); // singlethreaded mode unlock g = 2; pthread_t id; ...
Increase version number to 1.53
#pragma once // const float in a header file can lead to duplication of the storage // but I don't really care in this case. Just don't do it with a header // that is included hundreds of times. const float kCurrentVersion = 1.52f; // Put a "#define VERSION_SUFFIX 'b'" line here to add a minor version // incr...
#pragma once // const float in a header file can lead to duplication of the storage // but I don't really care in this case. Just don't do it with a header // that is included hundreds of times. const float kCurrentVersion = 1.53f; // Put a "#define VERSION_SUFFIX 'b'" line here to add a minor version // incr...
Make PathChar compatible with other platform
/* @ 0xCCCCCCCC */ #if defined(_MSC_VER) #pragma once #endif #ifndef KBASE_BASIC_TYPES_H_ #define KBASE_BASIC_TYPES_H_ #include <cstdint> #include <string> // Defines types that would be shared by among several files. namespace kbase { // |PathKey| is used by |PathService| and |BasePathProvider|. using PathKey = ...
/* @ 0xCCCCCCCC */ #if defined(_MSC_VER) #pragma once #endif #ifndef KBASE_BASIC_TYPES_H_ #define KBASE_BASIC_TYPES_H_ #include <cstdint> #include <string> #include "kbase/basic_macros.h" // Defines types that would be shared by among several files. namespace kbase { // |PathKey| is used by |PathService| and |Ba...
Fix typo in function name
/* stacks.h * Copyright: (When this is determined...it will go here) * CVS Info * $Id$ * Overview: * Stack handling routines for Parrot * Data Structure and Algorithms: * History: * Notes: * References: */ #if !defined(PARROT_STACKS_H_GUARD) #define PARROT_STACKS_H_GUARD #include "parrot/parr...
/* stacks.h * Copyright: (When this is determined...it will go here) * CVS Info * $Id$ * Overview: * Stack handling routines for Parrot * Data Structure and Algorithms: * History: * Notes: * References: */ #if !defined(PARROT_STACKS_H_GUARD) #define PARROT_STACKS_H_GUARD #include "parrot/parr...
Add license header to source
#include <lua.h> #include <lauxlib.h> #include <string.h> static char * find_argv0(lua_State *L) { extern char *__progname; return __progname; } static int set_proctitle(lua_State *L) { const char *title = luaL_checkstring(L, 1); char *argv0 = find_argv0(L); // XXX no length check strcpy(arg...
/* * Copyright (c) 2015 Rob Hoelz <rob AT SIGN hoelz.ro> * * 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, m...
Simplify SFINAE expression for RequiresScalar
#ifndef TCFRAME_TYPE_H #define TCFRAME_TYPE_H #include <ostream> #include <type_traits> using std::enable_if; using std::integral_constant; using std::is_arithmetic; using std::is_same; using std::ostream; using std::string; namespace tcframe { class Variable { public: virtual void printTo(ostream& out) = 0; ...
#ifndef TCFRAME_TYPE_H #define TCFRAME_TYPE_H #include <ostream> #include <type_traits> using std::enable_if; using std::integral_constant; using std::is_arithmetic; using std::is_same; using std::ostream; using std::string; namespace tcframe { class Variable { public: virtual void printTo(ostream& out) = 0; ...
Add missing declaration of zebra_hello()
/* * OLSRd Quagga plugin * * Copyright (C) 2006-2008 Immo 'FaUl' Wehrenberg <immo@chaostreff-dortmund.de> * Copyright (C) 2007-2010 Vasilis Tsiligiannis <acinonyxs@yahoo.gr> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 a...
/* * OLSRd Quagga plugin * * Copyright (C) 2006-2008 Immo 'FaUl' Wehrenberg <immo@chaostreff-dortmund.de> * Copyright (C) 2007-2012 Vasilis Tsiligiannis <acinonyxs@yahoo.gr> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 a...
Use normalized case and include method.
//===- Win32/Win32.h - Common Win32 Include File ----------------*- C++ -*-===// // // The LLVM Compiler Infrastructure // // This file is distributed under the University of Illinois Open Source // License. See LICENSE.TXT for details. // //===-------------------------------------------------------...
//===- Win32/Win32.h - Common Win32 Include File ----------------*- C++ -*-===// // // The LLVM Compiler Infrastructure // // This file is distributed under the University of Illinois Open Source // License. See LICENSE.TXT for details. // //===-------------------------------------------------------...
Add NSBundle+Universal.h to toolkit header
// // Toolkit header to include the main headers of the 'AFToolkit' library. // #import "AFDefines.h" #import "AFLogHelper.h" #import "AFFileHelper.h" #import "AFPlatformHelper.h" #import "AFKVO.h" #import "AFArray.h" #import "AFMutableArray.h" #import "UITableViewCell+Universal.h" #import "AFDBClient.h" #import "AFVi...
// // Toolkit header to include the main headers of the 'AFToolkit' library. // #import "AFDefines.h" #import "AFLogHelper.h" #import "AFFileHelper.h" #import "AFPlatformHelper.h" #import "AFKVO.h" #import "AFArray.h" #import "AFMutableArray.h" #import "NSBundle+Universal.h" #import "UITableViewCell+Universal.h" #impo...
Add test for concatenation in the preprocessor
/* name: TEST031 description: Test concatenation in preprocessor output: F5 I G6 F5 main { \ A7 I foo A8 I bar A9 I foobar A9 A7 A8 +I :I A9 A7 A8 +I :I r #I0 } */ #define CAT(x,y) x ## y #define XCAT(x,y) CAT(x,y) #define FOO foo #define BAR bar int main(void) { int foo, bar, foobar; CAT(foo,bar) = foo + bar;...
Use zeroes for fcntl constants on Windows
#include <fcntl.h> #include <stdio.h> int main(void) { printf("F_GETFL=%d\n", F_GETFL); printf("F_SETFL=%d\n", F_SETFL); printf("O_NONBLOCK=%d\n", O_NONBLOCK); return 0; }
#if _WIN32 || _WIN64 # define F_GETFL 0 # define F_SETFL 0 # define O_NONBLOCK 0 #else # include <fcntl.h> #endif #include <stdio.h> int main(void) { printf("F_GETFL=%d\n", F_GETFL); printf("F_SETFL=%d\n", F_SETFL); printf("O_NONBLOCK=%d\n", O_NONBLOCK); return 0; }
Add demo of magic primes.
/* * Compute prime numbers up to 67. * * https://spamsink.dreamwidth.org/1197779.html */ #include <stdio.h> #include <math.h> double magic(double f) { double ff = floor(f); double r = log(ff + 6) * (log(ff + 6) - 1); return (f - ff) * floor(r) + f; } double C = 2.6358597414547913; int main() { in...
Add USART enum for pyboard skin labels.
typedef enum { PYB_USART_NONE = 0, PYB_USART_1 = 1, PYB_USART_2 = 2, PYB_USART_3 = 3, PYB_USART_6 = 4, PYB_USART_MAX = 4, } pyb_usart_t; extern pyb_usart_t pyb_usart_global_debug; void usart_init(pyb_usart_t usart_id, uint32_t baudrate); bool usart_rx_any(pyb_usart_t usart_id); int usart_rx_ch...
typedef enum { PYB_USART_NONE = 0, PYB_USART_1 = 1, PYB_USART_2 = 2, PYB_USART_3 = 3, PYB_USART_6 = 4, PYB_USART_MAX = 4, //PYB_USART_XA = // USART4 on X1, X2 = PA0, PA1 PYB_USART_XB = 1, // USART1 on X9, X10 = PB6, PB7 PYB_USART_YA = 4, // USART6 on Y1, Y2 = PC6, PC7 PYB_USART...
Set MIDPOINT to 90 instead of 128 (servo lib goes from 0 to 180)
#ifndef __MOTORS_H_ #define __MOTORS_H_ #include <Servo.h> #define MIDPOINT 128 class Motors { private: Servo port, vertical, starbord; int port_pin, vertical_pin, starbord_pin; public: Motors(int p_pin, int v_pin, int s_pin); void reset(); void go(int p, int v, int s); void stop(...
#ifndef __MOTORS_H_ #define __MOTORS_H_ #include <Servo.h> #define MIDPOINT 90 class Motors { private: Servo port, vertical, starbord; int port_pin, vertical_pin, starbord_pin; public: Motors(int p_pin, int v_pin, int s_pin); void reset(); void go(int p, int v, int s); void stop()...
Change default serial to USART2 for bluepill stm32f103 board
#ifndef PINS_H_ #define PINS_H_ typedef GPIO_PIN_LED<3,13,false> LED_BUILTIN_; typedef GPIO_PIN<1,9> TX1_PIN; typedef GPIO_PIN<1,10> RX1_PIN; typedef TX1_PIN TX_PIN; typedef RX1_PIN RX_PIN; typedef GPIO_PIN<1,2> TX2_PIN; typedef GPIO_PIN<1,3> RX2_PIN; typedef GPIO_PIN<2,10> TX3_PIN; typedef GPIO_PIN<2,11> RX3_PIN;...
#ifndef PINS_H_ #define PINS_H_ typedef GPIO_PIN_LED<3,13,false> LED_BUILTIN_; typedef GPIO_PIN<1,9> TX1_PIN; typedef GPIO_PIN<1,10> RX1_PIN; typedef GPIO_PIN<1,2> TX2_PIN; typedef GPIO_PIN<1,3> RX2_PIN; typedef GPIO_PIN<2,10> TX3_PIN; typedef GPIO_PIN<2,11> RX3_PIN; typedef GPIO_PIN<0,0xFFFF> NO_PIN; typedef TX2...
Add trailing return type to type printing test
// RUN: %ucc -Xprint %s 2>/dev/null | grep 'typeof' | %output_check -w "/typeof\(int \*\) ip.*/" "/typeof\(int \*\) \*a1.*/" "/typeof\(int \*\) a2\[2\].*/" "/typeof\(int \*\) a3\(\).*/" "typeof(expr: identifier) (aka 'long *') xyz()" long *x; __typeof(int *) ip; __typeof(int *) *a1; __typeof(int *) a2[2]; __typeof(i...
// RUN: %ucc -Xprint %s 2>/dev/null | grep 'typeof' | %output_check -w "/typeof\(int \*\) ip.*/" "/typeof\(int \*\) \*a1.*/" "/typeof\(int \*\) a2\[2\].*/" "/typeof\(int \*\) a3\(\).*/" "typeof(expr: identifier) (aka 'long *') abc()" "typeof(expr: identifier) (aka 'long *') xyz()" long *x; __typeof(int *) ip; __type...
Remove extra public declaration (still compiles but extraneous)
#ifndef _CUTIE_H_ #define _CUTIE_H_ class Cutie { private: bool respondsToHugs; unsigned int hugs; unsigned int tlc; public: Cutie(); public: void setAcceptsHugs(bool value); bool acceptsHugs(); void hug(); void empathy(); unsigned int showHugs(); unsigned int showTlc(); }; #endif
#ifndef _CUTIE_H_ #define _CUTIE_H_ class Cutie { private: bool respondsToHugs; unsigned int hugs; unsigned int tlc; public: Cutie(); void setAcceptsHugs(bool value); bool acceptsHugs(); void hug(); void empathy(); unsigned int showHugs(); unsigned int showTlc(); }; #endif
Include the sparc register in this file
//===-- Passes.h - Target independent code generation passes ----*- C++ -*-===// // // This file defines interfaces to access the target independent code generation // passes provided by the LLVM backend. // //===----------------------------------------------------------------------===// #ifndef LLVM_CODEGEN_PASSES_H ...
//===-- Passes.h - Target independent code generation passes ----*- C++ -*-===// // // This file defines interfaces to access the target independent code generation // passes provided by the LLVM backend. // //===----------------------------------------------------------------------===// #ifndef LLVM_CODEGEN_PASSES_H ...
Solve exercise of Chapter 1, Paragraph 3.
#include <stdio.h> main() { int fahr; for (fahr = 300; fahr >= 0; fahr = fahr - 20) printf("%3d %6.1f\n", fahr, (5.0/9.0) * (fahr - 32.0)); }
Add name to DOLIT entry
#include <stdlib.h> #include <stdarg.h> #include <string.h> #include <stack_machine/common.h> #include <stack_machine/compiler.h> state_t __DOLIT(context_t *ctx) { pushnum(ctx->ds, (*(int *)ctx->ip++)); return OK; } void literal(context_t *ctx, int n) { static entry_t dolit = { .code_ptr = &__DOLIT }; ...
#include <stdlib.h> #include <stdarg.h> #include <string.h> #include <stack_machine/common.h> #include <stack_machine/compiler.h> state_t __DOLIT(context_t *ctx) { pushnum(ctx->ds, (*(int *)ctx->ip++)); return OK; } void literal(context_t *ctx, int n) { static entry_t dolit = { .code_ptr = &__DOLIT, .nam...
Add platform-specific string formatters for size_t
/* Copyright 2015 John Bailey 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 wri...
/* Copyright 2015 John Bailey 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 wri...
Update the source code file names
// // BleBeaconSignInModel.h // BleToolBox // // Created by Mark on 2018/1/26. // Copyright © 2018年 MarkCJ. All rights reserved. // #import "BleBaseModel.h" @interface BleBeaconSignInModel : BleBaseModel @property NSString *beaconName; // the beacon name. @property NSString *beaconDeviceUUID; /...
// // BleBeaconSignInModel.h // BleToolBox // // Created by Mark on 2018/1/26. // Copyright © 2018年 MarkCJ. All rights reserved. // #import "BleBaseModel.h" @interface BleBeaconSignInModel : BleBaseModel @property NSString *beaconName; // the beacon name. @property NSString *beaconDeviceUUID; /...
Add log option for loading cookies
// // NSData+DK.h // // Created by dkhamsing on 2/24/14. // #import <Foundation/Foundation.h> @interface NSData (DK) /** Load session cookies. Credits: http://stackoverflow.com/questions/14387662/afnetworking-persisting-cookies-automatically */ + (void)dk_cookiesLoad; /** Save session cookies. Credits: http:...
// // NSData+DK.h // // Created by dkhamsing on 2/24/14. // #import <Foundation/Foundation.h> @interface NSData (DK) /** Load session cookies. @param log Boolean that outputs with NSLog. Credits: http://stackoverflow.com/questions/14387662/afnetworking-persisting-cookies-automatically */ + (void)dk_cookiesLoad...
Use primitive std::int32_t instead of reference type
#ifndef CPR_LOW_SPEED_H #define CPR_LOW_SPEED_H #include <cstdint> namespace cpr { class LowSpeed { public: LowSpeed(const std::int32_t& limit, const std::int32_t& time) : limit(limit), time(time) {} std::int32_t limit; std::int32_t time; }; } // namespace cpr #endif
#ifndef CPR_LOW_SPEED_H #define CPR_LOW_SPEED_H #include <cstdint> namespace cpr { class LowSpeed { public: LowSpeed(const std::int32_t limit, const std::int32_t time) : limit(limit), time(time) {} std::int32_t limit; std::int32_t time; }; } // namespace cpr #endif
Add command to allow non incremental statedumps
/* * This file is part of Kotaka, a mud library for DGD * http://github.com/shentino/kotaka * * Copyright (C) 2012 Raymond Jennings * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as * published by the Free Software Foundati...
Fix memory leak in tests
#include "parser.h" #include "ast.h" #include "tests.h" void test_parse_number(); int main() { test_parse_number(); return 0; } struct token *make_token(enum token_type tk_type, char* str, double dbl, int number) { struct token *tk = malloc(sizeof(struct token)); tk->type = tk_type; if (t...
#include "parser.h" #include "ast.h" #include "tests.h" void test_parse_number(); int main() { test_parse_number(); return 0; } struct token *make_token(enum token_type tk_type, char* str, double dbl, int number) { struct token *tk = malloc(sizeof(struct token)); tk->type = tk_type; if (t...
Move namespaces declarations to the top of the file.
// This file is part of MorphoDiTa <http://github.com/ufal/morphodita/>. // // Copyright 2015 Institute of Formal and Applied Linguistics, Faculty of // Mathematics and Physics, Charles University in Prague, Czech Republic. // // This Source Code Form is subject to the terms of the Mozilla Public // License, v. 2.0. If...
// This file is part of MorphoDiTa <http://github.com/ufal/morphodita/>. // // Copyright 2015 Institute of Formal and Applied Linguistics, Faculty of // Mathematics and Physics, Charles University in Prague, Czech Republic. // // This Source Code Form is subject to the terms of the Mozilla Public // License, v. 2.0. If...
Fix include of DTTimePeriod in DateTools cocoapod
// // AKEvent.h // Example // // Created by ak on 18.01.2016. // Copyright © 2016 Eric Horacek. All rights reserved. // #import <Foundation/Foundation.h> #import "DTTimePeriod.h" @interface MSEvent : DTTimePeriod @property (nonatomic, strong) NSString *title; @property (nonatomic, strong) NSString *location; ...
// // AKEvent.h // Example // // Created by ak on 18.01.2016. // Copyright © 2016 Eric Horacek. All rights reserved. // #import <Foundation/Foundation.h> #import <DateTools/DTTimePeriod.h> @interface MSEvent : DTTimePeriod @property (nonatomic, strong) NSString *title; @property (nonatomic, strong) NSString *l...
Remove extern decl of no longer used/included SHA-1 SSE2 function
/* * SHA-160 * (C) 1999-2007 Jack Lloyd * * Distributed under the terms of the Botan license */ #ifndef BOTAN_SHA_160_SSE2_H__ #define BOTAN_SHA_160_SSE2_H__ #include <botan/sha160.h> namespace Botan { /* * SHA-160 */ class BOTAN_DLL SHA_160_SSE2 : public SHA_160 { public: HashFunction* clone() const { ...
/* * SHA-160 * (C) 1999-2007 Jack Lloyd * * Distributed under the terms of the Botan license */ #ifndef BOTAN_SHA_160_SSE2_H__ #define BOTAN_SHA_160_SSE2_H__ #include <botan/sha160.h> namespace Botan { /* * SHA-160 */ class BOTAN_DLL SHA_160_SSE2 : public SHA_160 { public: HashFunction* clone() const { ...
Fix missing braces warning for initialization of subobjects
/* @ 0xCCCCCCCC */ #if defined(_MSC_VER) #pragma once #endif #ifndef KBASE_STACK_WALKER_H_ #define KBASE_STACK_WALKER_H_ #include <array> #include "kbase/basic_macros.h" #if defined(OS_WIN) struct _CONTEXT; using CONTEXT = _CONTEXT; #endif namespace kbase { class StackWalker { public: StackWalker() noexcept...
/* @ 0xCCCCCCCC */ #if defined(_MSC_VER) #pragma once #endif #ifndef KBASE_STACK_WALKER_H_ #define KBASE_STACK_WALKER_H_ #include <array> #include "kbase/basic_macros.h" #if defined(OS_WIN) struct _CONTEXT; using CONTEXT = _CONTEXT; #endif namespace kbase { class StackWalker { public: StackWalker() noexcept...
Change Pods to BonMot in header.
// // BonMot+UIKit.h // Pods // // Created by Nora Trapp on 3/10/16. // // #import "BONTextAlignmentConstraint.h" #import "UILabel+BonMotUtilities.h" #import "UITextField+BonMotUtilities.h" #import "UITextView+BonMotUtilities.h"
// // BonMot+UIKit.h // BonMot // // Created by Nora Trapp on 3/10/16. // // #import "BONTextAlignmentConstraint.h" #import "UILabel+BonMotUtilities.h" #import "UITextField+BonMotUtilities.h" #import "UITextView+BonMotUtilities.h"
Convert 0-63 indicies <-> (row,col)
// for all of these conversions, 0 <= row,col < 8 static inline uint8_t bb_index_of(uint8_t row, uint8_t col) { return row + (col << 3); } static inline uint8_t bb_row_of(uint8_t index) { return index % 8; } static inline uint8_t bb_col_of(uint8_t index) { return (uint8_t)(index / 8); }
Make bundle property read only
// // ObSFileLoader.h // GameChanger // // Created by Kiril Savino on Tuesday, April 16, 2013 // Copyright 2013 GameChanger. All rights reserved. // @class ObSInPort; @protocol ObSFileLoader <NSObject> - (ObSInPort*)findFile:(NSString*)filename; - (NSString*)qualifyFileName:(NSString*)filename; @end @interface Ob...
// // ObSFileLoader.h // GameChanger // // Created by Kiril Savino on Tuesday, April 16, 2013 // Copyright 2013 GameChanger. All rights reserved. // @class ObSInPort; @protocol ObSFileLoader <NSObject> - (ObSInPort*)findFile:(NSString*)filename; - (NSString*)qualifyFileName:(NSString*)filename; @end @interface Ob...
Add NOMINMAX before including Windows.h
#ifndef _R2BOT_CONFIG #define _R2BOT_CONFIG #define _WINSOCK_DEPRECATED_NO_WARNINGS #define DEBUG_PRINTS #define DEVICE_NAME "NUC" #undef USE_KINECT1 #undef USE_KINECT2 #undef USE_MOTORS #undef USE_ULTRASONIC #define USE_R2SERVER #endif
#ifndef _R2BOT_CONFIG #define _R2BOT_CONFIG #define NOMINMAX #define _WINSOCK_DEPRECATED_NO_WARNINGS #define DEBUG_PRINTS #define DEVICE_NAME "NUC" #undef USE_KINECT1 #undef USE_KINECT2 #undef USE_MOTORS #undef USE_ULTRASONIC #define USE_R2SERVER #endif
Add an initial test script for the flowers.
int pin_r = 9; int pin_g = 10; int pin_b = 11; int brightness = 0; int increment = 1; void setup() { pinMode(pin_r, OUTPUT); pinMode(pin_g, OUTPUT); pinMode(pin_b, OUTPUT); /* Serial.begin(9600); */ } void loop() { brightness = brightness + increment; if (brightness <= 0 || brightness >= 128) { incr...
Add missing header from last commit
/** * tapcfg - A cross-platform configuration utility for TAP driver * Copyright (C) 2008 Juho Vähä-Herttua * * 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 * versio...
Define OpenGLES support for ARM
// Copyright (C) 2016 Elviss Strazdins // This file is part of the Ouzel engine. #pragma once #if defined(_WIN32) || defined(_WIN64) || defined(WIN32) || defined(WIN64) #define OUZEL_PLATFORM_WINDOWS 1 #define OUZEL_SUPPORTS_DIRECT3D11 1 #elif defined(__APPLE__) #include <TargetConditionals.h> #if TAR...
// Copyright (C) 2016 Elviss Strazdins // This file is part of the Ouzel engine. #pragma once #if defined(_WIN32) || defined(_WIN64) || defined(WIN32) || defined(WIN64) #define OUZEL_PLATFORM_WINDOWS 1 #define OUZEL_SUPPORTS_DIRECT3D11 1 #elif defined(__APPLE__) #include <TargetConditionals.h> #if TAR...
Add insert node at head fn
/* Input Format You have to complete the Node* Insert(Node* head, int data) method which takes two arguments - the head of the linked list and the integer to insert. You should NOT read any input from stdin/console. Output Format Insert the new node at the head and return the head of the updated linked list. Do NOT ...