Instruction
stringlengths
14
778
input_code
stringlengths
0
4.24k
output_code
stringlengths
1
5.44k
Add fullstop for the pc crowd (punctually correct).
/* Copyright libCellML Contributors Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ #pragma once #include <libcellml> #include "test_exportdefinitions.h" std::string TEST_EXPORT resourcePath(const std::string &resourceRelativePath = ""); std::string TEST_EXPORT fileContents(const std::string &fileName); void TEST_EXPORT printErrors(const libcellml::Validator &v); void TEST_EXPORT printErrors(const libcellml::Parser &p); void TEST_EXPORT expectEqualErrors(const std::vector<std::string> &errors, const libcellml::Logger &logger); libcellml::ModelPtr TEST_EXPORT createModel(const std::string &name = ""); libcellml::ModelPtr TEST_EXPORT createModelWithComponent(const std::string &name = ""); #define EXPECT_EQ_ERRORS(errors, logger) SCOPED_TRACE("Error occured here");expectEqualErrors(errors, logger)
/* Copyright libCellML Contributors Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. */ #pragma once #include <libcellml> #include "test_exportdefinitions.h" std::string TEST_EXPORT resourcePath(const std::string &resourceRelativePath = ""); std::string TEST_EXPORT fileContents(const std::string &fileName); void TEST_EXPORT printErrors(const libcellml::Validator &v); void TEST_EXPORT printErrors(const libcellml::Parser &p); void TEST_EXPORT expectEqualErrors(const std::vector<std::string> &errors, const libcellml::Logger &logger); libcellml::ModelPtr TEST_EXPORT createModel(const std::string &name = ""); libcellml::ModelPtr TEST_EXPORT createModelWithComponent(const std::string &name = ""); #define EXPECT_EQ_ERRORS(errors, logger) SCOPED_TRACE("Error occured here.");expectEqualErrors(errors, logger)
Add FCoE feature header to 82599
/******************************************************************************* Intel 10 Gigabit PCI Express Linux driver Copyright(c) 1999 - 2009 Intel Corporation. This program is free software; you can redistribute it and/or modify it under the terms and conditions of the GNU General Public License, version 2, as published by the Free Software Foundation. This program is distributed in the hope it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. The full GNU General Public License is included in this distribution in the file called "COPYING". Contact Information: e1000-devel Mailing List <e1000-devel@lists.sourceforge.net> Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 *******************************************************************************/ #ifndef _IXGBE_FCOE_H #define _IXGBE_FCOE_H #include <scsi/fc/fc_fcoe.h> /* shift bits within STAT fo FCSTAT */ #define IXGBE_RXDADV_FCSTAT_SHIFT 4 /* ddp user buffer */ #define IXGBE_BUFFCNT_MAX 256 /* 8 bits bufcnt */ #define IXGBE_FCPTR_ALIGN 16 #define IXGBE_FCPTR_MAX (IXGBE_BUFFCNT_MAX * sizeof(dma_addr_t)) #define IXGBE_FCBUFF_4KB 0x0 #define IXGBE_FCBUFF_8KB 0x1 #define IXGBE_FCBUFF_16KB 0x2 #define IXGBE_FCBUFF_64KB 0x3 #define IXGBE_FCBUFF_MAX 65536 /* 64KB max */ #define IXGBE_FCBUFF_MIN 4096 /* 4KB min */ #define IXGBE_FCOE_DDP_MAX 512 /* 9 bits xid */ /* fcerr */ #define IXGBE_FCERR_BADCRC 0x00100000 struct ixgbe_fcoe_ddp { int len; u32 err; unsigned int sgc; struct scatterlist *sgl; dma_addr_t udp; unsigned long *udl; }; struct ixgbe_fcoe { spinlock_t lock; struct pci_pool *pool; struct ixgbe_fcoe_ddp ddp[IXGBE_FCOE_DDP_MAX]; }; #endif /* _IXGBE_FCOE_H */
Add documentation of the category methods on NSTimeZone
// // NSTimeZone+Offset.h // CocoaGit // // Created by Geoffrey Garside on 28/07/2008. // Copyright 2008 ManicPanda.com. All rights reserved. // #import <Foundation/NSTimeZone.h> @interface NSTimeZone (Offset) + (id)timeZoneWithStringOffset:(NSString*)offset; - (NSString*)offsetString; @end
// // NSTimeZone+Offset.h // CocoaGit // // Created by Geoffrey Garside on 28/07/2008. // Copyright 2008 ManicPanda.com. All rights reserved. // #import <Foundation/NSTimeZone.h> @interface NSTimeZone (Offset) /*! Creates and returns a time zone with the specified offset. * The string is broken down into the hour and minute components * which are then used to work out the number of seconds from GMT. * \param offset The timezone offset as a string such as "+0100" * \return A time zone with the specified offset * \see +timeZoneForSecondsFromGMT: */ + (id)timeZoneWithStringOffset:(NSString*)offset; /*! Returns the receivers offset as an HHMM formatted string. * \return The receivers offset as a string in HHMM format. */ - (NSString*)offsetString; @end
Apply patch by Josh Enes
// Filename: audio.h // Created by: frang (06Jul00) // //////////////////////////////////////////////////////////////////// // // PANDA 3D SOFTWARE // Copyright (c) Carnegie Mellon University. All rights reserved. // // All use of this software is subject to the terms of the revised BSD // license. You should have received a copy of this license along // with this source code in a file named "LICENSE." // //////////////////////////////////////////////////////////////////// #ifndef __AUDIO_H__ #define __AUDIO_H__ #include "filterProperties.h" #include "audioSound.h" #include "audioManager.h" #endif /* __AUDIO_H__ */
// Filename: audio.h // Created by: frang (06Jul00) // //////////////////////////////////////////////////////////////////// // // PANDA 3D SOFTWARE // Copyright (c) Carnegie Mellon University. All rights reserved. // // All use of this software is subject to the terms of the revised BSD // license. You should have received a copy of this license along // with this source code in a file named "LICENSE." // //////////////////////////////////////////////////////////////////// #ifndef __AUDIO_H__ #define __AUDIO_H__ #include "filterProperties.h" #include "audioLoadRequest.h" #include "audioSound.h" #include "audioManager.h" #endif /* __AUDIO_H__ */
Use NS_ASSUME_NONNULL_BEGIN/END macros in Obj-C header
// The MIT License (MIT) // // Copyright (c) 2014-present James Ide // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. void objc_synchronized(id object, __attribute__((noescape)) void (^closure)());
// The MIT License (MIT) // // Copyright (c) 2014-present James Ide // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // copies of the Software, and to permit persons to whom the Software is // furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included in // all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN // THE SOFTWARE. @import Foundation; NS_ASSUME_NONNULL_BEGIN void objc_synchronized(id object, __attribute__((noescape)) void (^closure)()); NS_ASSUME_NONNULL_END
Switch to Time instead of DateTime
/** * @file WidgetTimeInput.h * @author Volodymyr Shymanskyy * @license This project is released under the MIT License (MIT) * @copyright Copyright (c) 2015 Volodymyr Shymanskyy * @date Aug 2016 * @brief * */ #ifndef WidgetTimeInput_h #define WidgetTimeInput_h #include <Blynk/BlynkApi.h> #include <utility/BlynkDateTime.h> class TimeInputParam { public: TimeInputParam(const BlynkParam& param) : mStart (param[0].asLong()) , mStop (param[1].asLong()) { mTZ = param[2].asLong(); } BlynkDateTime& getStart() { return mStart; } BlynkDateTime& getStop() { return mStop; } long getTZ() const { return mTZ; } private: BlynkDateTime mStart; BlynkDateTime mStop; long mTZ; }; #endif
/** * @file WidgetTimeInput.h * @author Volodymyr Shymanskyy * @license This project is released under the MIT License (MIT) * @copyright Copyright (c) 2015 Volodymyr Shymanskyy * @date Aug 2016 * @brief * */ #ifndef WidgetTimeInput_h #define WidgetTimeInput_h #include <Blynk/BlynkApi.h> #include <utility/BlynkDateTime.h> class TimeInputParam { public: TimeInputParam(const BlynkParam& param) { if (strlen(param[0].asStr())) { mStart = param[0].asLong(); } if (strlen(param[1].asStr())) { mStop = param[1].asLong(); } mTZ = param[2].asLong(); } BlynkTime& getStart() { return mStart; } BlynkTime& getStop() { return mStop; } long getTZ() const { return mTZ; } private: BlynkTime mStart; BlynkTime mStop; long mTZ; }; #endif
Allow us to edit this
// // LVTFolder.h // LayerVaultAPIClient // // Created by Matt Thomas on 12/4/13. // Copyright (c) 2013 codecaffeine. All rights reserved. // #import <Mantle/Mantle.h> #import "LVTColor.h" @interface LVTFolder : MTLModel <MTLJSONSerializing> @property (readonly, nonatomic, copy) NSString *name; @property (nonatomic) LVTColorLabel colorLabel; @property (readonly, nonatomic, copy) NSString *path; @property (readonly, nonatomic, copy) NSURL *fileURL; @property (readonly, nonatomic) NSDate *dateUpdated; @property (readonly, nonatomic) NSDate *dateDeleted; @property (readonly, nonatomic, copy) NSString *md5; @property (readonly, nonatomic, copy) NSURL *url; @property (readonly, nonatomic, copy) NSURL *shortURL; @property (readonly, nonatomic, copy) NSString *organizationPermalink; @property (readonly, nonatomic, copy) NSArray *folders; @property (readonly, nonatomic, copy) NSArray *files; @end
// // LVTFolder.h // LayerVaultAPIClient // // Created by Matt Thomas on 12/4/13. // Copyright (c) 2013 codecaffeine. All rights reserved. // #import <Mantle/Mantle.h> #import "LVTColor.h" @interface LVTFolder : MTLModel <MTLJSONSerializing> @property (readonly, nonatomic, copy) NSString *name; @property (nonatomic) LVTColorLabel colorLabel; @property (readonly, nonatomic, copy) NSString *path; @property (readonly, nonatomic, copy) NSURL *fileURL; @property (nonatomic) NSDate *dateUpdated; @property (readonly, nonatomic) NSDate *dateDeleted; @property (readonly, nonatomic, copy) NSString *md5; @property (readonly, nonatomic, copy) NSURL *url; @property (readonly, nonatomic, copy) NSURL *shortURL; @property (readonly, nonatomic, copy) NSString *organizationPermalink; @property (readonly, nonatomic, copy) NSArray *folders; @property (readonly, nonatomic, copy) NSArray *files; @end
Add USB control request definitions
/* * qiprog - Reference implementation of the QiProg protocol * * Copyright (C) 2013 Alexandru Gagniuc <mr.nuke.me@gmail.com> * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ #ifndef __QIPROG_USB_H #define __QIPROG_USB_H #include <qiprog.h> /** * @brief QiProg USB control request types for Control transfers * * @note * Note that all values transferred over the bus, including those in wValue, * wIndex and wLength fields, are LE coded! (The host side API likely translates * wLength automatically if necessary, but maybe not wValue and wIndex, and * certainly not the data. Check that your bytes are not swapped.) */ enum qiprog_usb_ctrl_req_type { QIPROG_GET_CAPABILITIES = 0x00, QIPROG_SET_BUS = 0x01, QIPROG_SET_CLOCK = 0x02, QIPROG_READ_DEVICE_ID = 0x03, QIPROG_SET_ADDRESS = 0x04, QIPROG_SET_ERASE_SIZE = 0x05, QIPROG_SET_ERASE_COMMAND = 0x06, QIPROG_SET_WRITE_COMMAND = 0x07, QIPROG_SET_SPI_TIMING = 0x20, QIPROG_READ8 = 0x30, QIPROG_READ16 = 0x31, QIPROG_READ32 = 0x32, QIPROG_WRITE8 = 0x33, QIPROG_WRITE16 = 0x34, QIPROG_WRITE32 = 0x35, QIPROG_SET_VDD = 0xf0, }; #endif /* __QIPROG_USB_H */
Add DIF to set pinmux insel
// Copyright lowRISC contributors. // Licensed under the Apache License, Version 2.0, see LICENSE for details. // SPDX-License-Identifier: Apache-2.0 #include "sw/device/lib/dif/dif_pinmux.h" #include "sw/device/lib/dif/dif_base.h" #include "pinmux_regs.h" // Generated. // This just exists to check that the header compiles for now. The actual // implementation is work in progress.
// Copyright lowRISC contributors. // Licensed under the Apache License, Version 2.0, see LICENSE for details. // SPDX-License-Identifier: Apache-2.0 #include "sw/device/lib/dif/dif_pinmux.h" #include "sw/device/lib/base/bitfield.h" #include "sw/device/lib/dif/dif_base.h" #include "pinmux_regs.h" // Generated. // This just exists to check that the header compiles for now. The actual // implementation is work in progress. OT_WARN_UNUSED_RESULT dif_result_t dif_pinmux_input_select(const dif_pinmux_t *pinmux, dif_pinmux_index_t peripheral_input, dif_pinmux_index_t insel) { if (pinmux == NULL || peripheral_input >= PINMUX_PARAM_N_MIO_PERIPH_IN || insel >= (2 + PINMUX_PARAM_N_MIO_PADS)) { return kDifBadArg; } uint32_t reg_offset = PINMUX_MIO_PERIPH_INSEL_0_REG_OFFSET + (peripheral_input << 2); uint32_t reg_value = bitfield_field32_write(0, PINMUX_MIO_PERIPH_INSEL_0_IN_0_FIELD, insel); mmio_region_write32(pinmux->base_addr, reg_offset, reg_value); return kDifOk; }
Fix for PR1567, which involves a weird bug on non-32bit architectures and silly C type sizes.
// RUN: %llvmgcc -S %s -o - -O | grep ashr // RUN: %llvmgcc -S %s -o - -O | not grep sdiv int test(int *A, int *B) { return A-B; }
// RUN: %llvmgcc -S %s -o - -O | grep ashr // RUN: %llvmgcc -S %s -o - -O | not grep sdiv long long test(int *A, int *B) { return A-B; }
Add baisc test for goto
/* name: TEST011 description: Basic test for goto output: F1 G1 F1 main { - L2 j L3 yI #I1 L4 yI #I0 L3 L5 j L4 yI #I1 } */ #line 1 int main() { start: goto next; return 1; success: return 0; next: foo: goto success; return 1; }
Add formerly private headers to the umbrella header
@import Foundation; #import <VENCore/VENCreateTransactionRequest.h> #import <VENCore/VENHTTP.h> #import <VENCore/VENHTTPResponse.h> #import <VENCore/VENTransaction.h> #import <VENCore/VENTransactionTarget.h> #import <VENCore/VENUser.h> extern NSString *const VENErrorDomainCore; typedef NS_ENUM(NSInteger, VENCoreErrorCode) { VENCoreErrorCodeNoDefaultCore, VENCoreErrorCodeNoAccessToken }; @interface VENCore : NSObject @property (strong, nonatomic) VENHTTP *httpClient; @property (strong, nonatomic) NSString *accessToken; /** * Sets the shared core object. * @param core The core object to share. */ + (void)setDefaultCore:(VENCore *)core; /** * Returns the shared core object. * @return A VENCore object. */ + (instancetype)defaultCore; /** * Sets the core object's access token. */ - (void)setAccessToken:(NSString *)accessToken; @end
@import Foundation; #import <VENCore/VENCreateTransactionRequest.h> #import <VENCore/VENHTTP.h> #import <VENCore/VENHTTPResponse.h> #import <VENCore/VENTransaction.h> #import <VENCore/VENTransactionTarget.h> #import <VENCore/VENUser.h> #import <VENCore/NSArray+VENCore.h> #import <VENCore/NSDictionary+VENCore.h> #import <VENCore/NSError+VENCore.h> #import <VENCore/NSString+VENCore.h> #import <VENCore/UIDevice+VENCore.h> extern NSString *const VENErrorDomainCore; typedef NS_ENUM(NSInteger, VENCoreErrorCode) { VENCoreErrorCodeNoDefaultCore, VENCoreErrorCodeNoAccessToken }; @interface VENCore : NSObject @property (strong, nonatomic) VENHTTP *httpClient; @property (strong, nonatomic) NSString *accessToken; /** * Sets the shared core object. * @param core The core object to share. */ + (void)setDefaultCore:(VENCore *)core; /** * Returns the shared core object. * @return A VENCore object. */ + (instancetype)defaultCore; /** * Sets the core object's access token. */ - (void)setAccessToken:(NSString *)accessToken; @end
Test against high before palindrome check down to ~0.01
#include "euler_util.h" #include <string.h> #define MAX 7 int main(int argc, char *argv[]) { float start = timeit(); char product[MAX] = { '\0' }; int high = 0; for (int x=100; x < 1000; x++) { for (int y=x; y < 1000; y++) { int canidate = x * y; size_t int_len = snprintf(product, MAX, "%d", canidate); int head = 0, tail = int_len - 1; for (;head < tail && product[head] == product[tail]; head++, tail--) ; if (head > tail && canidate > high) high = canidate; } } float stop = timeit(); printf("Answer: %d\n", high); printf("Time: %.8f\n", stop - start); return 0; }
#include "euler_util.h" #include <string.h> #define MAX 7 int main(int argc, char *argv[]) { float start = timeit(); char product[MAX] = { '\0' }; int high = 0; for (int x=100; x < 1000; x++) { for (int y=x; y < 1000; y++) { int canidate = x * y; if (canidate < high) continue; size_t int_len = snprintf(product, MAX, "%d", canidate); int head = 0, tail = int_len - 1; for (;head < tail && product[head] == product[tail]; head++, tail--) ; if (head > tail) high = canidate; } } float stop = timeit(); printf("Answer: %d\n", high); printf("Time: %.8f\n", stop - start); return 0; }
Change color of list selection to dark blue
/* * Copyright (c) 2016 Jan Hoffmann * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ #pragma once #define COLOR_WINDOW_BACKGROUND GColorWhite #define COLOR_WINDOW_FOREGROUND GColorBlack #define COLOR_WINDOW_PROGRESS_BACKGROUND PBL_IF_COLOR_ELSE(GColorLightGray,GColorWhite) #define COLOR_LAYER_PROGRESS_BACKGROUND PBL_IF_COLOR_ELSE(GColorBlack,GColorWhite) #define COLOR_LAYER_PROGRESS_FOREGROUND PBL_IF_COLOR_ELSE(GColorWhite,GColorBlack) #define COLOR_WINDOW_ERROR_BACKGROUND PBL_IF_COLOR_ELSE(GColorCobaltBlue,GColorBlack) #define COLOR_WINDOW_ERROR_FOREGROUND GColorWhite #define COLOR_MENU_NORMAL_BACKGROUND GColorWhite #define COLOR_MENU_NORMAL_FOREGROUND GColorBlack #define COLOR_MENU_HIGHLIGHT_BACKGROUND PBL_IF_COLOR_ELSE(GColorDarkGray,GColorBlack) #define COLOR_MENU_HIGHLIGHT_FOREGROUND PBL_IF_COLOR_ELSE(GColorWhite,GColorWhite)
/* * Copyright (c) 2016 Jan Hoffmann * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ #pragma once #define COLOR_WINDOW_BACKGROUND GColorWhite #define COLOR_WINDOW_FOREGROUND GColorBlack #define COLOR_WINDOW_PROGRESS_BACKGROUND PBL_IF_COLOR_ELSE(GColorLightGray,GColorWhite) #define COLOR_LAYER_PROGRESS_BACKGROUND PBL_IF_COLOR_ELSE(GColorBlack,GColorWhite) #define COLOR_LAYER_PROGRESS_FOREGROUND PBL_IF_COLOR_ELSE(GColorWhite,GColorBlack) #define COLOR_WINDOW_ERROR_BACKGROUND PBL_IF_COLOR_ELSE(GColorCobaltBlue,GColorBlack) #define COLOR_WINDOW_ERROR_FOREGROUND GColorWhite #define COLOR_MENU_NORMAL_BACKGROUND GColorWhite #define COLOR_MENU_NORMAL_FOREGROUND GColorBlack #define COLOR_MENU_HIGHLIGHT_BACKGROUND PBL_IF_COLOR_ELSE(GColorCobaltBlue,GColorBlack) #define COLOR_MENU_HIGHLIGHT_FOREGROUND PBL_IF_COLOR_ELSE(GColorWhite,GColorWhite)
Fix alignment fault on z_bss_zero()
/* * Copyright (c) 2019 Carlo Caione <ccaione@baylibre.com> * * SPDX-License-Identifier: Apache-2.0 */ /** * @file * @brief Full C support initialization * * Initialization of full C support: zero the .bss and call z_cstart(). * * Stack is available in this module, but not the global data/bss until their * initialization is performed. */ #include <kernel_internal.h> extern FUNC_NORETURN void z_cstart(void); /** * * @brief Prepare to and run C code * * This routine prepares for the execution of and runs C code. * * @return N/A */ void z_arm64_prep_c(void) { z_bss_zero(); z_arm64_interrupt_init(); z_cstart(); CODE_UNREACHABLE; }
/* * Copyright (c) 2019 Carlo Caione <ccaione@baylibre.com> * * SPDX-License-Identifier: Apache-2.0 */ /** * @file * @brief Full C support initialization * * Initialization of full C support: zero the .bss and call z_cstart(). * * Stack is available in this module, but not the global data/bss until their * initialization is performed. */ #include <kernel_internal.h> #include <linker/linker-defs.h> extern FUNC_NORETURN void z_cstart(void); static inline void z_arm64_bss_zero(void) { uint64_t *p = (uint64_t *)__bss_start; uint64_t *end = (uint64_t *)__bss_end; while (p < end) { *p++ = 0; } } /** * * @brief Prepare to and run C code * * This routine prepares for the execution of and runs C code. * * @return N/A */ void z_arm64_prep_c(void) { z_arm64_bss_zero(); z_arm64_interrupt_init(); z_cstart(); CODE_UNREACHABLE; }
Add overload for qDebug << and Eigen::Vector4f.
#ifndef SRC_EIGEN_QDEBUG_H_ #define SRC_EIGEN_QDEBUG_H_ #include <Eigen/Core> #include <QDebug> #include <iostream> QDebug operator<<(QDebug dbg, const Eigen::Vector2f &vector) { dbg << "[" << vector.x() << "|" << vector.y() << "]"; return dbg.maybeSpace(); } QDebug operator<<(QDebug dbg, const Eigen::Vector3f &vector) { dbg << "[" << vector.x() << "|" << vector.y() << "|" << vector.z() << "]"; return dbg.maybeSpace(); } QDebug operator<<(QDebug dbg, const Eigen::Matrix4f &vector) { const Eigen::IOFormat cleanFormat(4, 0, ", ", "\n", "[", "]"); std::stringstream stream; stream << vector.format(cleanFormat); dbg << stream.str().c_str(); return dbg.maybeSpace(); } #endif // SRC_EIGEN_QDEBUG_H_
#ifndef SRC_EIGEN_QDEBUG_H_ #define SRC_EIGEN_QDEBUG_H_ #include <Eigen/Core> #include <QDebug> #include <iostream> QDebug operator<<(QDebug dbg, const Eigen::Vector2f &vector) { dbg << "[" << vector.x() << "|" << vector.y() << "]"; return dbg.maybeSpace(); } QDebug operator<<(QDebug dbg, const Eigen::Vector3f &vector) { dbg << "[" << vector.x() << "|" << vector.y() << "|" << vector.z() << "]"; return dbg.maybeSpace(); } QDebug operator<<(QDebug dbg, const Eigen::Vector4f &vector) { dbg << "[" << vector.x() << "|" << vector.y() << "|" << vector.z() << "|" << vector.w() << "]"; return dbg.maybeSpace(); } QDebug operator<<(QDebug dbg, const Eigen::Matrix4f &vector) { const Eigen::IOFormat cleanFormat(4, 0, ", ", "\n", "[", "]"); std::stringstream stream; stream << vector.format(cleanFormat); dbg << stream.str().c_str(); return dbg.maybeSpace(); } #endif // SRC_EIGEN_QDEBUG_H_
Fix pointer cast into integer type.
/* * This file is a part of Hierarchical Allocator library. * Copyright (c) 2004-2011 Alex Pankratov. All rights reserved. * * http://swapped.cc/halloc */ /* * The program is distributed under terms of BSD license. * You can obtain the copy of the license by visiting: * * http://www.opensource.org/licenses/bsd-license.php */ #ifndef _LIBP_MACROS_H_ #define _LIBP_MACROS_H_ #include <stddef.h> /* offsetof */ /* restore pointer to the structure by a pointer to its field */ #define structof(p,t,f) ((t*)(- offsetof(t,f) + (void*)(p))) #endif
/* * This file is a part of Hierarchical Allocator library. * Copyright (c) 2004-2011 Alex Pankratov. All rights reserved. * * http://swapped.cc/halloc */ /* * The program is distributed under terms of BSD license. * You can obtain the copy of the license by visiting: * * http://www.opensource.org/licenses/bsd-license.php */ #ifndef _LIBP_MACROS_H_ #define _LIBP_MACROS_H_ #include <stddef.h> /* offsetof */ #include <stdint.h> /* intptr_t */ /* restore pointer to the structure by a pointer to its field */ #define structof(p,t,f) ((t*)(- offsetof(t,f) + (intptr_t)(p))) #endif
Update for MPICH2 1.1 on Windows
#ifndef PyMPI_CONFIG_MPICH2_H #define PyMPI_CONFIG_MPICH2_H #ifdef MS_WINDOWS #define PyMPI_MISSING_MPI_TYPE_CREATE_F90_INTEGER 1 #define PyMPI_MISSING_MPI_TYPE_CREATE_F90_REAL 1 #define PyMPI_MISSING_MPI_TYPE_CREATE_F90_COMPLEX 1 #endif #ifndef ROMIO_VERSION #include "mpich2io.h" #endif /* !ROMIO_VERSION */ #endif /* !PyMPI_CONFIG_MPICH2_H */
#ifndef PyMPI_CONFIG_MPICH2_H #define PyMPI_CONFIG_MPICH2_H #ifdef MS_WINDOWS #if !defined(MPICH2_NUMVERSION) || (MPICH2_NUMVERSION < 10100000) #define PyMPI_MISSING_MPI_TYPE_CREATE_F90_INTEGER 1 #define PyMPI_MISSING_MPI_TYPE_CREATE_F90_REAL 1 #define PyMPI_MISSING_MPI_TYPE_CREATE_F90_COMPLEX 1 #endif /* MPICH2 < 1.1.0 */ #endif /* MS_WINDOWS */ #ifndef ROMIO_VERSION #include "mpich2io.h" #endif /* !ROMIO_VERSION */ #endif /* !PyMPI_CONFIG_MPICH2_H */
Fix clash in cpp tokens
#ifndef EXPR_TOK_H #define EXPR_TOK_H extern expr_n tok_cur_num; extern enum tok { tok_ident = -1, tok_num = -2, tok_eof = 0, tok_lparen = '(', tok_rparen = ')', /* operators returned as char-value, * except for double-char ops */ /* binary */ tok_multiply = '*', tok_divide = '/', tok_modulus = '%', tok_plus = '+', tok_minus = '-', tok_xor = '^', tok_or = '|', tok_and = '&', tok_orsc = -1, tok_andsc = -2, tok_shiftl = -3, tok_shiftr = -4, /* unary - TODO */ tok_not = '!', tok_bnot = '~', /* comparison */ tok_eq = -5, tok_ne = -6, tok_le = -7, tok_lt = '<', tok_ge = -8, tok_gt = '>', /* ternary */ tok_question = '?', tok_colon = ':', #define MIN_OP -8 } tok_cur; void tok_next(void); void tok_begin(char *); const char *tok_last(void); #endif
#ifndef EXPR_TOK_H #define EXPR_TOK_H extern expr_n tok_cur_num; extern enum tok { tok_ident = -1, tok_num = -2, tok_eof = 0, tok_lparen = '(', tok_rparen = ')', /* operators returned as char-value, * except for double-char ops */ /* binary */ tok_multiply = '*', tok_divide = '/', tok_modulus = '%', tok_plus = '+', tok_minus = '-', tok_xor = '^', tok_or = '|', tok_and = '&', tok_orsc = -3, tok_andsc = -4, tok_shiftl = -5, tok_shiftr = -6, /* unary - TODO */ tok_not = '!', tok_bnot = '~', /* comparison */ tok_eq = -7, tok_ne = -8, tok_le = -9, tok_lt = '<', tok_ge = -10, tok_gt = '>', /* ternary */ tok_question = '?', tok_colon = ':', #define MIN_OP -10 } tok_cur; void tok_next(void); void tok_begin(char *); const char *tok_last(void); #endif
Change access to the cwriter
//===-- llvm/Assembly/CWriter.h - C Printer for LLVM programs ---*- C++ -*-===// // // The LLVM Compiler Infrastructure // // This file was developed by the LLVM research group and is distributed under // the University of Illinois Open Source License. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// // // This functionality is implemented by the lib/CWriter library. This library // is used to print C language files to an iostream. // //===----------------------------------------------------------------------===// #ifndef LLVM_ASSEMBLY_CWRITER_H #define LLVM_ASSEMBLY_CWRITER_H #include <iosfwd> namespace llvm { class Pass; Pass *createWriteToCPass(std::ostream &o); } // End llvm namespace #endif
//===-- llvm/Assembly/CWriter.h - C Printer for LLVM programs ---*- C++ -*-===// // // The LLVM Compiler Infrastructure // // This file was developed by the LLVM research group and is distributed under // the University of Illinois Open Source License. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// // // This functionality is implemented by the lib/CWriter library. This library // is used to print C language files to an iostream. // //===----------------------------------------------------------------------===// #ifndef LLVM_ASSEMBLY_CWRITER_H #define LLVM_ASSEMBLY_CWRITER_H #include <iosfwd> namespace llvm { class PassManager; void AddPassesToWriteC(PassManager &PM, std::ostream &o); } // End llvm namespace #endif
Add a property box field so this stuff compiles
#ifndef GNOME_PROPERTIES_H #define GNOME_PROPERTIES_H #include <libgnome/gnome-defs.h> BEGIN_GNOME_DECLS typedef struct { GtkWidget *notebook; GList *props; } GnomePropertyConfigurator; /* This is the first parameter to the callback function */ typedef enum { GNOME_PROPERTY_READ, GNOME_PROPERTY_WRITE, GNOME_PROPERTY_APPLY, GNOME_PROPERTY_SETUP } GnomePropertyRequest; GnomePropertyConfigurator *gnome_property_configurator_new (void); void gnome_property_configurator_destroy (GnomePropertyConfigurator *); void gnome_property_configurator_register (GnomePropertyConfigurator *, int (*callback)(GnomePropertyRequest)); void gnome_property_configurator_setup (GnomePropertyConfigurator *); gint gnome_property_configurator_request (GnomePropertyConfigurator *, GnomePropertyRequest); void gnome_property_configurator_request_foreach (GnomePropertyConfigurator *th, GnomePropertyRequest r); END_GNOME_DECLS #endif
#ifndef GNOME_PROPERTIES_H #define GNOME_PROPERTIES_H #include <libgnome/gnome-defs.h> BEGIN_GNOME_DECLS typedef struct { GtkWidget *notebook; GtkWidget *property_box; GList *props; } GnomePropertyConfigurator; /* This is the first parameter to the callback function */ typedef enum { GNOME_PROPERTY_READ, GNOME_PROPERTY_WRITE, GNOME_PROPERTY_APPLY, GNOME_PROPERTY_SETUP } GnomePropertyRequest; GnomePropertyConfigurator *gnome_property_configurator_new (void); void gnome_property_configurator_destroy (GnomePropertyConfigurator *); void gnome_property_configurator_register (GnomePropertyConfigurator *, int (*callback)(GnomePropertyRequest)); void gnome_property_configurator_setup (GnomePropertyConfigurator *); gint gnome_property_configurator_request (GnomePropertyConfigurator *, GnomePropertyRequest); void gnome_property_configurator_request_foreach (GnomePropertyConfigurator *th, GnomePropertyRequest r); END_GNOME_DECLS #endif
Test the parse of the raw binary data seen in the hcidump integration for a manufacturer AD structure.
#include <stdint.h> #include <string.h> #include <stdio.h> #include <sys/types.h> static int UUID_SIZE = 16; char toHexChar(int b) { char c; if(b < 10) c = '0' + b; else c = 'A' + b - 10; return c; } int main(int argc, char **argv) { int b = (0xa4 & 0xf0) >> 4; printf("c0=%c, %d\n", toHexChar(b), b); b = (0xa4 & 0x0f); printf("c1=%c, %d\n", toHexChar(b), b); // The raw data from the manufacturer's data packate uint8_t data[] = {0x4c,0x0, 0x2,0x15, 0xa4,0x95,0xde,0xad,0xc5,0xb1,0x4b,0x44,0xb5, 0x12,0x13,0x70,0xf0,0x2d,0x74,0xde,0x30,0x39,0xff,0xff, 0xc5}; // Get the manufacturer code from the first two octets int index = 0; int manufacturer = 256 * data[index++] + data[index++]; // Get the first octet of the beacon code int code = 256 * data[index++] + data[index++]; // Get the proximity uuid char uuid[UUID_SIZE+1]; int n; for(n = 0; n < UUID_SIZE; n += 2, index ++) { int b0 = (data[index] & 0xf0) >> 4; int b1 = data[index] & 0x0f; char c0 = toHexChar(b0); char c1 = toHexChar(b1); uuid[n] = c0; uuid[n+1] = c1; } uuid[UUID_SIZE] = '\0'; // Get the beacon major id int major = 256 * data[index++] + data[index++]; // Get the beacon minor id int minor = 256 * data[index++] + data[index++]; // Get the transmitted power, which is encoded as the 2's complement of the calibrated Tx Power int power = data[index] - 256; printf("uuid=%s, manufacturer=%d, code=%d, major=%d, minor=%d, power=%d\n", uuid, manufacturer, code, major, minor, power); }
Revert "Fix typo in the commit a5312c77."
#include <string.h> #include "ruby.h" #include "rubyspec.h" #ifdef __cplusplus extern "C" { #endif #ifdef HAVE_RB_PROC_NEW VALUE concat_func(VALUE args) { int i; char buffer[500] = {0}; if (TYPE(args) != T_ARRAY) return Qnil; for(i = 0; i < RARRAY_LEN(args); ++i) { VALUE v = RARRAY_PTR(args)[i]; strcat(buffer, StringValuePtr(v)); strcat(buffer, "_"); } buffer[strlen(buffer) - 1] = 0; return rb_str_new2(buffer); } VALUE sp_underline_concat_proc(VALUE self) { return rb_proc_new(concat_func, Qnil); } #endif void Init_proc_spec() { VALUE cls; cls = rb_define_class("CApiProcSpecs", rb_cObject); #ifdef HAVE_RB_PROC_NEW rb_define_method(cls, "underline_concat_proc", sp_underline_concat_proc, 0); #endif } #ifdef __cplusplus } #endif
#include <string.h> #include "ruby.h" #include "rubyspec.h" #ifdef __cplusplus extern "C" { #endif #ifdef HAVE_RB_PROC_NEW VALUE concat_func(VALUE args) { int i; char buffer[500] = {0}; if (TYPE(val) != T_ARRAY) return Qnil; for(i = 0; i < RARRAY_LEN(args); ++i) { VALUE v = RARRAY_PTR(args)[i]; strcat(buffer, StringValuePtr(v)); strcat(buffer, "_"); } buffer[strlen(buffer) - 1] = 0; return rb_str_new2(buffer); } VALUE sp_underline_concat_proc(VALUE self) { return rb_proc_new(concat_func, Qnil); } #endif void Init_proc_spec() { VALUE cls; cls = rb_define_class("CApiProcSpecs", rb_cObject); #ifdef HAVE_RB_PROC_NEW rb_define_method(cls, "underline_concat_proc", sp_underline_concat_proc, 0); #endif } #ifdef __cplusplus } #endif
Update master branch version to 1.4
//------------------------------------------------------------------------------------------------------- // Copyright (C) Microsoft. All rights reserved. // Licensed under the MIT license. See LICENSE.txt file in the project root for full license information. //------------------------------------------------------------------------------------------------------- #pragma once #define CHAKRA_CORE_MAJOR_VERSION 1 #define CHAKRA_CORE_MINOR_VERSION 3 #define CHAKRA_CORE_VERSION_RELEASE 0 #define CHAKRA_CORE_VERSION_PRERELEASE 0 #define CHAKRA_CORE_VERSION_RELEASE_QFE 0 #define CHAKRA_VERSION_RELEASE 0 // NOTE: need to update the GUID in ByteCodeCacheReleaseFileVersion.h as well
//------------------------------------------------------------------------------------------------------- // Copyright (C) Microsoft. All rights reserved. // Licensed under the MIT license. See LICENSE.txt file in the project root for full license information. //------------------------------------------------------------------------------------------------------- #pragma once #define CHAKRA_CORE_MAJOR_VERSION 1 #define CHAKRA_CORE_MINOR_VERSION 4 #define CHAKRA_CORE_VERSION_RELEASE 0 #define CHAKRA_CORE_VERSION_PRERELEASE 0 #define CHAKRA_CORE_VERSION_RELEASE_QFE 0 #define CHAKRA_VERSION_RELEASE 0 // NOTE: need to update the GUID in ByteCodeCacheReleaseFileVersion.h as well
Include cstddef for size_t in newer GCC.
#ifndef MOLCORE_GRAPH_H #define MOLCORE_GRAPH_H #include "molcore.h" #include <vector> namespace MolCore { class MOLCORE_EXPORT Graph { public: // construction and destruction Graph(); Graph(size_t size); ~Graph(); // properties void setSize(size_t size); size_t size() const; bool isEmpty() const; void clear(); // structure size_t addVertex(); void removeVertex(size_t index); size_t vertexCount() const; void addEdge(size_t a, size_t b); void removeEdge(size_t a, size_t b); void removeEdges(); void removeEdges(size_t index); size_t edgeCount() const; const std::vector<size_t>& neighbors(size_t index) const; size_t degree(size_t index) const; bool containsEdge(size_t a, size_t b) const; private: std::vector<std::vector<size_t> > m_adjacencyList; }; } // end MolCore namespace #endif // MOLCORE_GRAPH_H
#ifndef MOLCORE_GRAPH_H #define MOLCORE_GRAPH_H #include "molcore.h" #include <vector> #include <cstddef> namespace MolCore { class MOLCORE_EXPORT Graph { public: // construction and destruction Graph(); Graph(size_t size); ~Graph(); // properties void setSize(size_t size); size_t size() const; bool isEmpty() const; void clear(); // structure size_t addVertex(); void removeVertex(size_t index); size_t vertexCount() const; void addEdge(size_t a, size_t b); void removeEdge(size_t a, size_t b); void removeEdges(); void removeEdges(size_t index); size_t edgeCount() const; const std::vector<size_t>& neighbors(size_t index) const; size_t degree(size_t index) const; bool containsEdge(size_t a, size_t b) const; private: std::vector<std::vector<size_t> > m_adjacencyList; }; } // end MolCore namespace #endif // MOLCORE_GRAPH_H
Add configure result checks on odbc, per Peter E.
/* File: connection.h * * Description: See "md.h" * * Comments: See "notice.txt" for copyright and license information. * */ #ifndef __MD5_H__ #define __MD5_H__ #include "psqlodbc.h" #include <stdlib.h> #include <string.h> #ifdef WIN32 #define MD5_ODBC #define FRONTEND #endif #define MD5_PASSWD_LEN 35 /* From c.h */ #ifndef __BEOS__ #ifndef __cplusplus #ifndef bool typedef char bool; #endif #ifndef true #define true ((bool) 1) #endif #ifndef false #define false ((bool) 0) #endif #endif /* not C++ */ #endif /* __BEOS__ */ /* #if SIZEOF_UINT8 == 0 Can't get this from configure */ typedef unsigned char uint8; /* == 8 bits */ typedef unsigned short uint16; /* == 16 bits */ typedef unsigned int uint32; /* == 32 bits */ /* #endif */ extern bool EncryptMD5(const char *passwd, const char *salt, size_t salt_len, char *buf); #endif
/* File: connection.h * * Description: See "md.h" * * Comments: See "notice.txt" for copyright and license information. * */ #ifndef __MD5_H__ #define __MD5_H__ #include "psqlodbc.h" #include <stdlib.h> #include <string.h> #ifdef WIN32 #define MD5_ODBC #define FRONTEND #endif #define MD5_PASSWD_LEN 35 /* From c.h */ #ifndef __BEOS__ #ifndef __cplusplus #ifndef bool typedef char bool; #endif #ifndef true #define true ((bool) 1) #endif #ifndef false #define false ((bool) 0) #endif #endif /* not C++ */ #endif /* __BEOS__ */ /* Also defined in include/c.h */ #if SIZEOF_UINT8 == 0 typedef unsigned char uint8; /* == 8 bits */ typedef unsigned short uint16; /* == 16 bits */ typedef unsigned int uint32; /* == 32 bits */ #endif /* SIZEOF_UINT8 == 0 */ extern bool EncryptMD5(const char *passwd, const char *salt, size_t salt_len, char *buf); #endif
Fix a warning, closing PR2452
// RUN: %llvmgcc -S %s -o - | llvm-as -f -o /dev/null // XFAIL: * // See PR2452 struct { int *name; } syms = { L"NUL" };
// RUN: %llvmgcc -S %s -o - | llvm-as -f -o /dev/null #include <wchar.h> struct { wchar_t *name; } syms = { L"NUL" };
Prepare for new lex interface
#ifndef SCANNER_H_ #define SCANNER_H_ // I want to remove this dependecy, equivalent to yy.tab.h ? #include "parse/GENERATED/parser.hxx" #undef yyFlexLexer // ugly hack, because <FlexLexer> is wonky #include <FlexLexer.h> #include <iostream> // Tell flex how to define lexing fn #undef YY_DECL #define YY_DECL \ int GENERATED::Scanner::lex(GENERATED::Parser::semantic_type *yylval, \ GENERATED::Parser::location_type *yylloc) namespace GENERATED { class Scanner : public yyFlexLexer { public: explicit Scanner(std::istream *in = nullptr, std::ostream *out = nullptr); int lex(GENERATED::Parser::semantic_type *yylval, GENERATED::Parser::location_type *yylloc); }; } #endif // include-guard
#ifndef SCANNER_H_ #define SCANNER_H_ // I want to remove this dependecy, equivalent to yy.tab.h ? #include "parse/GENERATED/parser.hxx" #undef yyFlexLexer // ugly hack, because <FlexLexer> is wonky #include <FlexLexer.h> #include <iostream> // Tell flex how to define lexing fn #undef YY_DECL #define YY_DECL \ int GENERATED::Scanner::lex(GENERATED::Parser::semantic_type *yylval, \ GENERATED::Parser::location_type *yylloc) // #define YY_DECL GENERATED::Parser::symbol_type GENERATED::Scanner::lex() namespace GENERATED { class Scanner : public yyFlexLexer { public: explicit Scanner(std::istream *in = nullptr, std::ostream *out = nullptr); int lex(GENERATED::Parser::semantic_type *yylval, GENERATED::Parser::location_type *yylloc); // Parser::symbol_type lex(); }; } #endif // include-guard
Add a test to make sure that vector output happens for debug info.
// RUN: %clang_cc1 -emit-llvm -g %s -o - | FileCheck %s typedef int v4si __attribute__((__vector_size__(16))); v4si a; // Test that we get an array type that's also a vector out of debug. // CHECK: [ DW_TAG_array_type ] [line 0, size 128, align 128, offset 0] [vector] [from int]
Remove unwritten time library, add action library
#include <config.h> #define LIB_BULK (USR_DIR + "/Game/lib/bulk") #define LIB_TIME (USR_DIR + "/Game/lib/time") #define GAME_LIB_OBJECT (USR_DIR + "/Game/lib/object") #define BULKD (USR_DIR + "/Game/sys/bulkd") #define SNOOPD (USR_DIR + "/Game/sys/snoopd") #define TIMED (USR_DIR + "/Game/sys/timed") #define GAME_INITD (USR_DIR + "/Game/initd") #define GAME_HELPD (USR_DIR + "/Game/sys/helpd") #define GAME_DRIVER (USR_DIR + "/Game/sys/driver") #define GAME_ROOT (USR_DIR + "/Game/sys/root") #define GAME_SUBD (USR_DIR + "/Game/sys/subd") #define GAME_TESTD (USR_DIR + "/Game/sys/testd")
#include <config.h> #define LIB_ACTION (USR_DIR + "/Game/lib/action") #define LIB_BULK (USR_DIR + "/Game/lib/bulk") #define GAME_LIB_OBJECT (USR_DIR + "/Game/lib/object") #define BULKD (USR_DIR + "/Game/sys/bulkd") #define SNOOPD (USR_DIR + "/Game/sys/snoopd") #define TIMED (USR_DIR + "/Game/sys/timed") #define GAME_INITD (USR_DIR + "/Game/initd") #define GAME_HELPD (USR_DIR + "/Game/sys/helpd") #define GAME_DRIVER (USR_DIR + "/Game/sys/driver") #define GAME_ROOT (USR_DIR + "/Game/sys/root") #define GAME_SUBD (USR_DIR + "/Game/sys/subd") #define GAME_TESTD (USR_DIR + "/Game/sys/testd")
Remove unnecessary verbosity in DefaultMake
/* * Copyright 2018-present Facebook, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #pragma once #include <type_traits> #include <folly/Traits.h> namespace folly { namespace detail { struct DefaultTag {}; template <typename T> struct DefaultMake { struct Heap { std::unique_ptr<T> ptr{std::make_unique<T>()}; /* implicit */ operator T&() { return *ptr; } }; using is_returnable = StrictDisjunction< bool_constant<__cplusplus >= 201703ULL>, std::is_copy_constructible<T>, std::is_move_constructible<T>>; using type = std::conditional_t<is_returnable::value, T, Heap>; T make(std::true_type) const { return T(); } Heap make(std::false_type) const { return Heap(); } type operator()() const { return make(is_returnable{}); } }; template <typename...> struct TypeTuple {}; } // namespace detail } // namespace folly
/* * Copyright 2018-present Facebook, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #pragma once #include <type_traits> #include <folly/Traits.h> namespace folly { namespace detail { struct DefaultTag {}; template <typename T> struct DefaultMake { struct Heap { std::unique_ptr<T> ptr{std::make_unique<T>()}; /* implicit */ operator T&() { return *ptr; } }; using is_returnable = StrictDisjunction< bool_constant<__cplusplus >= 201703ULL>, std::is_copy_constructible<T>, std::is_move_constructible<T>>; using type = std::conditional_t<is_returnable::value, T, Heap>; type operator()() const { return type(); } }; template <typename...> struct TypeTuple {}; } // namespace detail } // namespace folly
Clean up debug header preamble.
// // wren_debug.h // wren // // Created by Bob Nystrom on 11/29/13. // Copyright (c) 2013 Bob Nystrom. All rights reserved. // #ifndef wren_wren_debug_h #define wren_wren_debug_h #include "wren_value.h" #include "wren_vm.h" void wrenDebugPrintStackTrace(WrenVM* vm, ObjFiber* fiber); int wrenDebugPrintInstruction(WrenVM* vm, ObjFn* fn, int i); void wrenDebugPrintCode(WrenVM* vm, ObjFn* fn); void wrenDebugPrintStack(ObjFiber* fiber); #endif
#ifndef wren_debug_h #define wren_debug_h #include "wren_value.h" #include "wren_vm.h" void wrenDebugPrintStackTrace(WrenVM* vm, ObjFiber* fiber); int wrenDebugPrintInstruction(WrenVM* vm, ObjFn* fn, int i); void wrenDebugPrintCode(WrenVM* vm, ObjFn* fn); void wrenDebugPrintStack(ObjFiber* fiber); #endif
Increment version number to 1.54
#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 // increment that won't trigger the new-version checks, handy for minor // releases that I don't want to bother users about. //#define VERSION_SUFFIX 'b'
#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.54f; // Put a "#define VERSION_SUFFIX 'b'" line here to add a minor version // increment that won't trigger the new-version checks, handy for minor // releases that I don't want to bother users about. //#define VERSION_SUFFIX 'b'
Split the main file into .c and .h files to make breaking it up later easier.
/* * TODO add copyright notice and GPL licence thingey * * * */ #include <nds.h> #include <stdio.h> #include <time.h> #include <dswifi9.h> #include <sys/socket.h> #include <netinet/in.h> #include <netdb.h> #define EMULATOR 1 //TODO automate flipping this in the makefile /** * Interactively lists WiFi connections, allow the user to select one and connect. * Supports open connections and WEP secured ones. */ int ManualConnect(PrintConsole *top_screen, PrintConsole *bot_screen); /** * Connect using credentials in WFC bank. * Writes output to supplied terminal, acts silently if none is provided. */ int WFCConnect(PrintConsole *console); /** * Standard keyboard callback placeholder */ void OnKeyPressed(int key); /** * Entry point of the application */ int main();
Fix wrong comment in configuration
// // DZVideoPlayerViewControllerConfiguration.h // Pods // // Created by Denis Zamataev on 15/07/15. // // #import <Foundation/Foundation.h> @interface DZVideoPlayerViewControllerConfiguration : NSObject @property (assign, nonatomic) BOOL isBackgroundPlaybackEnabled; // defaults to NO @property (strong, nonatomic) NSMutableArray *viewsToHideOnIdle; // has topToolbarView and bottomToolbarView by default @property (assign, nonatomic) NSTimeInterval delayBeforeHidingViewsOnIdle; // defaults to 3 seconds @property (assign, nonatomic) BOOL isShowFullscreenExpandAndShrinkButtonsEnabled; // defaults to YES @property (assign, nonatomic) BOOL isHideControlsOnIdleEnabled; // defaults to YES @end
// // DZVideoPlayerViewControllerConfiguration.h // Pods // // Created by Denis Zamataev on 15/07/15. // // #import <Foundation/Foundation.h> @interface DZVideoPlayerViewControllerConfiguration : NSObject @property (assign, nonatomic) BOOL isBackgroundPlaybackEnabled; // defaults to YES @property (strong, nonatomic) NSMutableArray *viewsToHideOnIdle; // has topToolbarView and bottomToolbarView by default @property (assign, nonatomic) NSTimeInterval delayBeforeHidingViewsOnIdle; // defaults to 3 seconds @property (assign, nonatomic) BOOL isShowFullscreenExpandAndShrinkButtonsEnabled; // defaults to YES @property (assign, nonatomic) BOOL isHideControlsOnIdleEnabled; // defaults to YES @end
Fix set_name compiler method signature
// Copyright (c) 2006- Facebook // Distributed under the Thrift Software License // // See accompanying file LICENSE or visit the Thrift site at: // http://developers.facebook.com/thrift/ #ifndef T_ENUM_H #define T_ENUM_H #include "t_enum_value.h" #include <vector> /** * An enumerated type. A list of constant objects with a name for the type. * * @author Mark Slee <mcslee@facebook.com> */ class t_enum : public t_type { public: t_enum(t_program* program) : t_type(program) {} void set_name(std::string name) { name_ = name; } void append(t_enum_value* constant) { constants_.push_back(constant); } const std::vector<t_enum_value*>& get_constants() { return constants_; } bool is_enum() const { return true; } virtual std::string get_fingerprint_material() const { return "enum"; } private: std::vector<t_enum_value*> constants_; }; #endif
// Copyright (c) 2006- Facebook // Distributed under the Thrift Software License // // See accompanying file LICENSE or visit the Thrift site at: // http://developers.facebook.com/thrift/ #ifndef T_ENUM_H #define T_ENUM_H #include "t_enum_value.h" #include <vector> /** * An enumerated type. A list of constant objects with a name for the type. * * @author Mark Slee <mcslee@facebook.com> */ class t_enum : public t_type { public: t_enum(t_program* program) : t_type(program) {} void set_name(const std::string& name) { name_ = name; } void append(t_enum_value* constant) { constants_.push_back(constant); } const std::vector<t_enum_value*>& get_constants() { return constants_; } bool is_enum() const { return true; } virtual std::string get_fingerprint_material() const { return "enum"; } private: std::vector<t_enum_value*> constants_; }; #endif
Add prototype for heap_getattr() to quiet compiler
/*------------------------------------------------------------------------- * * heaptuple.h-- * * * * Copyright (c) 1994, Regents of the University of California * * $Id: heaptuple.h,v 1.1 1996/10/18 17:58:33 scrappy Exp $ * *------------------------------------------------------------------------- */ #ifndef HEAPTUPLE_H #define HEAPTUPLE_H extern char *heap_getattr(HeapTuple tup, Buffer b, int attnum, TupleDesc tupleDesc, bool *isnull); #endif /* HEAP_TUPLE_H */
Add some more print statements to this test, ju...
/* * Copyright © 2009 CNRS, INRIA, Université Bordeaux 1 * Copyright © 2009 Cisco Systems, Inc. All rights reserved. * See COPYING in top-level directory. */ #include <hwloc.h> #include <stdio.h> int main(int argc, char *argv[]) { mytest_hwloc_topology_t topology; unsigned depth; hwloc_cpuset_t cpu_set; /* Just call a bunch of functions to see if we can link and run */ cpu_set = mytest_hwloc_cpuset_alloc(); mytest_hwloc_topology_init(&topology); mytest_hwloc_topology_load(topology); depth = mytest_hwloc_topology_get_depth(topology); printf("Max depth: %u\n", depth); mytest_hwloc_topology_destroy(topology); mytest_hwloc_cpuset_free(cpu_set); return 0; }
/* * Copyright © 2009 CNRS, INRIA, Université Bordeaux 1 * Copyright © 2009 Cisco Systems, Inc. All rights reserved. * See COPYING in top-level directory. */ #include <hwloc.h> #include <stdio.h> int main(int argc, char *argv[]) { mytest_hwloc_topology_t topology; unsigned depth; hwloc_cpuset_t cpu_set; /* Just call a bunch of functions to see if we can link and run */ printf("*** Test 1: cpuset alloc\n"); cpu_set = mytest_hwloc_cpuset_alloc(); printf("*** Test 2: topology init\n"); mytest_hwloc_topology_init(&topology); printf("*** Test 3: topology load\n"); mytest_hwloc_topology_load(topology); printf("*** Test 4: topology get depth\n"); depth = mytest_hwloc_topology_get_depth(topology); printf(" Max depth: %u\n", depth); printf("*** Test 5: topology destroy\n"); mytest_hwloc_topology_destroy(topology); printf("*** Test 6: cpuset free\n"); mytest_hwloc_cpuset_free(cpu_set); return 0; }
Add variables and reading from string.
#include <stdlib.h> #include <stdio.h> #include <time.h> #include "julina.h" int main(int argc, char **argv) { srand(time(NULL)); double aa[] = {2, 0, 1, -2, 3, 4, -5, 5, 6}; Matrix *a = new_matrix(aa, 3, 3); Matrix *ain = inverse(a); double bb[] = {1, -1, -2, 2, 4, 5, 6, 0, -3}; Matrix *b = new_matrix(bb, 3, 3); Matrix *bin = inverse(b); print_matrix(a); if (ain == ERR_SINGULAR_MATRIX_INVERSE) { printf("Inverse of singular matrix.\n"); } else { print_matrix(ain); } print_matrix(b); if (bin == ERR_SINGULAR_MATRIX_INVERSE) { printf("Inverse of singular matrix.\n"); } else { print_matrix(bin); } free_matrix(a); free_matrix(ain); free_matrix(b); free_matrix(bin); }
#include <stdlib.h> #include <stdio.h> #include <time.h> #include "julina.h" #define VARIABLE_START 'A' #define VARIABLE_COUNT 26 static Matrix *variables[VARIABLE_COUNT]; Matrix *get_variable(int c) { if (c < 0 || c >= VARIABLE_COUNT) { return NULL; } return variables[c - VARIABLE_START]; } // Returns -1 on failure, 0 on success. int set_variable(int c, Matrix *a) { if (c < 0 || c >= VARIABLE_COUNT) { return -1; } variables[c - VARIABLE_START] = a; return 0; } /* * Format: * 3 2 : 1 2 3 4 5 6 * Yields: * [[1 2] * [3 4] * [5 6]] */ Matrix *read_matrix(char *s) { int rows, cols, size; rows = strtol(s, &s, 10); cols = strtol(s, &s, 10); size = rows * cols; double aa[size]; s += 3; // space colon space int i; for (i = 0; i < size; i++) { aa[i] = strtol(s, &s, 10); } return new_matrix(aa, rows, cols); } int main(int argc, char **argv) { srand(time(NULL)); Matrix *a = read_matrix("6 1 : 1 0 0 0 0 1"); print_matrix(a); free_matrix(a); }
Add comment about "reserved" -1 value
#ifndef __LIBCT_ERRORS_H__ #define __LIBCT_ERRORS_H__ /* * This file contains errors, that can be returned from various * library calls */ /* Generic */ #define LCTERR_BADCTSTATE -2 /* Bad container state */ #define LCTERR_BADFSTYPE -3 /* Bad FS type */ #define LCTERR_BADNETTYPE -4 /* Bad Net type */ #define LCTERR_BADOPTION -5 /* Bad option requested */ /* RPC-specific ones */ #define LCTERR_BADCTRID -42 /* Bad container remote ID given */ #define LCTERR_BADCTRNAME -43 /* Bad name on open */ #define LCTERR_RPCUNKNOWN -44 /* Remote problem , but err is not given */ #define LCTERR_RPCCOMM -45 /* Error communicating via channel */ #endif /* __LIBCT_ERRORS_H__ */
#ifndef __LIBCT_ERRORS_H__ #define __LIBCT_ERRORS_H__ /* * This file contains errors, that can be returned from various * library calls */ /* * -1 is "reserved" for generic "something went wrong" result * since this value can be (well, is) widely explicitly used * all over the code. */ /* Generic */ #define LCTERR_BADCTSTATE -2 /* Bad container state */ #define LCTERR_BADFSTYPE -3 /* Bad FS type */ #define LCTERR_BADNETTYPE -4 /* Bad Net type */ #define LCTERR_BADOPTION -5 /* Bad option requested */ /* RPC-specific ones */ #define LCTERR_BADCTRID -42 /* Bad container remote ID given */ #define LCTERR_BADCTRNAME -43 /* Bad name on open */ #define LCTERR_RPCUNKNOWN -44 /* Remote problem , but err is not given */ #define LCTERR_RPCCOMM -45 /* Error communicating via channel */ #endif /* __LIBCT_ERRORS_H__ */
Fix 'HTML start tag prematurely ended' warning
@import Foundation; NS_ASSUME_NONNULL_BEGIN /// Allows you to customize the style for the the view /// controllers for your libraries. @interface CPDStyle : NSObject /// HTML provided to the view controller, it's nothing too fancy /// just a string which has a collection of string replacements on it. /// /// This is the current default: /// <html><head>{{STYLESHEET}}<meta name='viewport' content='width=device-width'></head><body>{{HEADER}}<p>{{BODY}}</p></body></html> @property (nonatomic, copy) NSString * _Nullable libraryHTML; /// CSS for styling your library /// /// This is the current default: /// <style> body{ font-family:HelveticaNeue; font-size: 14px; padding:12px; -webkit-user-select:none; } // #summary{ font-size: 18px; } // #version{ float: left; padding: 6px; } // #license{ float: right; padding: 6px; } .clear-fix { clear:both }; // </style> @property (nonatomic, copy) NSString * _Nullable libraryCSS; /// HTML specifically for showing the header information about a library /// /// This is the current default /// <p id='summary'>{{SUMMARY}}</p><p id='version'>{{VERSION}}</p><p id='license'>{{SHORT_LICENSE}}</p> <br class='clear-fix' /> @property (nonatomic, copy) NSString * _Nullable libraryHeaderHTML; @end NS_ASSUME_NONNULL_END
@import Foundation; NS_ASSUME_NONNULL_BEGIN /// Allows you to customize the style for the the view /// controllers for your libraries. @interface CPDStyle : NSObject /// HTML provided to the view controller, it's nothing too fancy /// just a string which has a collection of string replacements on it. /// /// This is the current default: /// <html><head>{{STYLESHEET}}<meta name='viewport' content='width=device-width'></head><body>{{HEADER}}<p>{{BODY}}</p></body></html> @property (nonatomic, copy) NSString * _Nullable libraryHTML; /// CSS for styling your library /// /// This is the current default: /// <style> body{ font-family:HelveticaNeue; font-size: 14px; padding:12px; -webkit-user-select:none; } // #summary{ font-size: 18px; } // #version{ float: left; padding: 6px; } // #license{ float: right; padding: 6px; } .clear-fix { clear:both }; // </style> @property (nonatomic, copy) NSString * _Nullable libraryCSS; /// HTML specifically for showing the header information about a library /// /// This is the current default /// <p id='summary'>{{SUMMARY}}</p><p id='version'>{{VERSION}}</p><p id='license'>{{SHORT_LICENSE}}</p> <br class='clear-fix'> @property (nonatomic, copy) NSString * _Nullable libraryHeaderHTML; @end NS_ASSUME_NONNULL_END
Fix include guard conflicting with the class name
/* # # ST_HW_HC_SR04.h # # (C)2016-2017 Flávio monteiro # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # */ #ifndef ST_HW_HC_SR04 #define ST_HW_HC_SR04 #include "Arduino.h" class ST_HW_HC_SR04 { public: ST_HW_HC_SR04(byte triggerPin, byte echoPin); ST_HW_HC_SR04(byte triggerPin, byte echoPin, unsigned long timeout); void setTimeout(unsigned long timeout); void setTimeoutToDefaultValue(); unsigned long getTimeout(); int getHitTime(); private: byte triggerPin; byte echoPin; unsigned long timeout; void triggerPulse(); }; #endif
/* # # ST_HW_HC_SR04.h # # (C)2016-2017 Flávio monteiro # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # */ #ifndef ST_HW_HC_SR04_H #define ST_HW_HC_SR04_H #include "Arduino.h" class ST_HW_HC_SR04 { public: ST_HW_HC_SR04(byte triggerPin, byte echoPin); ST_HW_HC_SR04(byte triggerPin, byte echoPin, unsigned long timeout); void setTimeout(unsigned long timeout); void setTimeoutToDefaultValue(); unsigned long getTimeout(); int getHitTime(); private: byte triggerPin; byte echoPin; unsigned long timeout; void triggerPulse(); }; #endif
Add AC_BITS to convert a bit number 0..N-1 to a mask.
/* * Copyright 2015 Wink Saville * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef SADIE_LIBS_INCS_AC_BITS_H #define SADIE_LIBS_INCS_AC_BITS_H #define AC_BIT(type, n) (((type)1) << n) #endif
Change votes to use double.
#ifndef PROPOSER_H #define PROPOSER_H #include <boost/shared_ptr.hpp> #include <vector> #include <map> #include "proctor/detector.h" #include "proctor/database_entry.h" namespace pcl { namespace proctor { struct Candidate { std::string id; float votes; }; class Proposer { public: typedef boost::shared_ptr<Proposer> Ptr; typedef boost::shared_ptr<const Proposer> ConstPtr; typedef boost::shared_ptr<std::map<std::string, Entry> > DatabasePtr; typedef boost::shared_ptr<const std::map<std::string, Entry> > ConstDatabasePtr; Proposer() {} void setDatabase(const DatabasePtr database) { database_ = database; } virtual void getProposed(int max_num, Entry &query, std::vector<std::string> &input, std::vector<std::string> &output) = 0; virtual void selectBestCandidates(int max_num, vector<Candidate> &ballot, std::vector<std::string> &output); protected: DatabasePtr database_; }; } } #endif
#ifndef PROPOSER_H #define PROPOSER_H #include <boost/shared_ptr.hpp> #include <vector> #include <map> #include "proctor/detector.h" #include "proctor/database_entry.h" namespace pcl { namespace proctor { struct Candidate { std::string id; double votes; }; class Proposer { public: typedef boost::shared_ptr<Proposer> Ptr; typedef boost::shared_ptr<const Proposer> ConstPtr; typedef boost::shared_ptr<std::map<std::string, Entry> > DatabasePtr; typedef boost::shared_ptr<const std::map<std::string, Entry> > ConstDatabasePtr; Proposer() {} void setDatabase(const DatabasePtr database) { database_ = database; } virtual void getProposed(int max_num, Entry &query, std::vector<std::string> &input, std::vector<std::string> &output) = 0; virtual void selectBestCandidates(int max_num, vector<Candidate> &ballot, std::vector<std::string> &output); protected: DatabasePtr database_; }; } } #endif
Add the blink effect to the GPIO demo
#include <stm32f4xx.h> #include <stm32f4xx_gpio.h> void delay(uint32_t count) { while(count--); } void init_GPIO() { GPIO_InitTypeDef GPIO_InitStruct = { .GPIO_Pin = GPIO_Pin_12 | GPIO_Pin_13 | GPIO_Pin_14 | GPIO_Pin_15, .GPIO_Mode = GPIO_Mode_OUT, .GPIO_Speed = GPIO_Speed_50MHz, .GPIO_OType =GPIO_OType_PP, .GPIO_PuPd = GPIO_PuPd_DOWN }; RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_GPIOD, ENABLE); GPIO_Init(GPIOD, &GPIO_InitStruct); } int main() { init_GPIO(); GPIO_SetBits(GPIOD, GPIO_Pin_12); return 0; }
#include <stm32f4xx.h> #include <stm32f4xx_gpio.h> void delay(uint32_t count) { while(count--); } void init_GPIO() { GPIO_InitTypeDef GPIO_InitStruct = { .GPIO_Pin = GPIO_Pin_12 | GPIO_Pin_13 | GPIO_Pin_14 | GPIO_Pin_15, .GPIO_Mode = GPIO_Mode_OUT, .GPIO_Speed = GPIO_Speed_50MHz, .GPIO_OType =GPIO_OType_PP, .GPIO_PuPd = GPIO_PuPd_DOWN }; RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_GPIOD, ENABLE); GPIO_Init(GPIOD, &GPIO_InitStruct); } int main() { init_GPIO(); int digitStatus = 1; while(1) { GPIO_WriteBit(GPIOD, GPIO_Pin_12, digitStatus); delay(1000000L); GPIO_WriteBit(GPIOD, GPIO_Pin_13, digitStatus); delay(1000000L); GPIO_WriteBit(GPIOD, GPIO_Pin_14, digitStatus); delay(1000000L); GPIO_WriteBit(GPIOD, GPIO_Pin_15, digitStatus); delay(1000000L); digitStatus = (digitStatus + 1) % 2; } return 0; }
Disable THERMAL_DATA_UART by default. This is a big CPU sink, and is a pretty non-standard config.
#ifndef _PROJECT_CONFIG_H_ #define _PROJECT_CONFIG_H_ #ifdef USART_DEBUG // this happens by 'make USART_DEBUG=1' #undef THERMAL_DATA_UART #else #define USART_DEBUG #define THERMAL_DATA_UART #endif #define TMP007_OVERLAY #define SPLASHSCREEN_OVERLAY #define ENABLE_LEPTON_AGC // #define Y16 #ifndef Y16 // Values from LEP_PCOLOR_LUT_E in Middlewares/lepton_sdk/Inc/LEPTON_VID.h #define PSUEDOCOLOR_LUT LEP_VID_FUSION_LUT #endif #ifndef USART_DEBUG_SPEED #define USART_DEBUG_SPEED (921600) #endif #define WHITE_LED_TOGGLE (HAL_GPIO_TogglePin(GPIOA, GPIO_PIN_6)) #endif
#ifndef _PROJECT_CONFIG_H_ #define _PROJECT_CONFIG_H_ #ifdef USART_DEBUG // this happens by 'make USART_DEBUG=1' #undef THERMAL_DATA_UART #else #define USART_DEBUG // #define THERMAL_DATA_UART #endif #define TMP007_OVERLAY #define SPLASHSCREEN_OVERLAY #define ENABLE_LEPTON_AGC // #define Y16 #ifndef Y16 // Values from LEP_PCOLOR_LUT_E in Middlewares/lepton_sdk/Inc/LEPTON_VID.h #define PSUEDOCOLOR_LUT LEP_VID_FUSION_LUT #endif #ifndef USART_DEBUG_SPEED #define USART_DEBUG_SPEED (921600) #endif #define WHITE_LED_TOGGLE (HAL_GPIO_TogglePin(GPIOA, GPIO_PIN_6)) #endif
Revert "sys_clock: start the microkernel ticker in the MICROKERNEL init level"
/* * Copyright (c) 2015 Wind River Systems, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /** * @file * @brief Initialize system clock driver * * Initializing the timer driver is done in this module to reduce code * duplication. Although both nanokernel and microkernel systems initialize * the timer driver at the same point, the two systems differ in when the system * can begin to process system clock ticks. A nanokernel system can process * system clock ticks once the driver has initialized. However, in a * microkernel system all system clock ticks are deferred (and stored on the * kernel server command stack) until the kernel server fiber starts and begins * processing any queued ticks. */ #include <nanokernel.h> #include <init.h> #include <drivers/system_timer.h> SYS_INIT(_sys_clock_driver_init, #ifdef CONFIG_MICROKERNEL MICROKERNEL, #else NANOKERNEL, #endif CONFIG_SYSTEM_CLOCK_INIT_PRIORITY);
/* * Copyright (c) 2015 Wind River Systems, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /** * @file * @brief Initialize system clock driver * * Initializing the timer driver is done in this module to reduce code * duplication. Although both nanokernel and microkernel systems initialize * the timer driver at the same point, the two systems differ in when the system * can begin to process system clock ticks. A nanokernel system can process * system clock ticks once the driver has initialized. However, in a * microkernel system all system clock ticks are deferred (and stored on the * kernel server command stack) until the kernel server fiber starts and begins * processing any queued ticks. */ #include <nanokernel.h> #include <init.h> #include <drivers/system_timer.h> SYS_INIT(_sys_clock_driver_init, NANOKERNEL, CONFIG_SYSTEM_CLOCK_INIT_PRIORITY);
Add constexpr version of maximum to algorithm
//===--- Algorithm.h - ------------------------------------------*- C++ -*-===// // // This source file is part of the Swift.org open source project // // Copyright (c) 2014 - 2016 Apple Inc. and the Swift project authors // Licensed under Apache License v2.0 with Runtime Library Exception // // See http://swift.org/LICENSE.txt for license information // See http://swift.org/CONTRIBUTORS.txt for the list of Swift project authors // //===----------------------------------------------------------------------===// // // This file defines helper algorithms, some of which are ported from C++14, // which may not be available on all platforms yet. // //===----------------------------------------------------------------------===// #ifndef SWIFT_BASIC_ALGORITHM_H #define SWIFT_BASIC_ALGORITHM_H namespace swift { /// Returns the minimum of `a` and `b`, or `a` if they are equivalent. template <typename T> constexpr const T& min(const T &a, const T &b) { return !(b < a) ? a : b; } } // end namespace swift #endif /* SWIFT_BASIC_ALGORITHM_H */
//===--- Algorithm.h - ------------------------------------------*- C++ -*-===// // // This source file is part of the Swift.org open source project // // Copyright (c) 2014 - 2016 Apple Inc. and the Swift project authors // Licensed under Apache License v2.0 with Runtime Library Exception // // See http://swift.org/LICENSE.txt for license information // See http://swift.org/CONTRIBUTORS.txt for the list of Swift project authors // //===----------------------------------------------------------------------===// // // This file defines helper algorithms, some of which are ported from C++14, // which may not be available on all platforms yet. // //===----------------------------------------------------------------------===// #ifndef SWIFT_BASIC_ALGORITHM_H #define SWIFT_BASIC_ALGORITHM_H namespace swift { /// Returns the minimum of `a` and `b`, or `a` if they are equivalent. template <typename T> constexpr const T& min(const T &a, const T &b) { return !(b < a) ? a : b; } /// Returns the maximum of `a` and `b`, or `a` if they are equivalent. template <typename T> constexpr const T& max(const T &a, const T &b) { return (a < b) ? b : a; } } // end namespace swift #endif /* SWIFT_BASIC_ALGORITHM_H */
Update pixel format type for CoreVideo Scaled YCoCg DXT5 to match change in codec
// // VPUSupport.h // QTMultiGPUTextureIssue // // Created by Tom Butterworth on 15/05/2012. // Copyright (c) 2012 Tom Butterworth. All rights reserved. // #ifndef QTMultiGPUTextureIssue_VPUSupport_h #define QTMultiGPUTextureIssue_VPUSupport_h #import <Foundation/Foundation.h> #import <QTKit/QTKit.h> #define kVPUSPixelFormatTypeRGB_DXT1 'DXt1' #define kVPUSPixelFormatTypeRGBA_DXT1 'DXT1' #define kVPUSPixelFormatTypeRGBA_DXT5 'DXT5' #define kVPUSPixelFormatTypeYCoCg_DXT5 'DYT5' BOOL VPUSMovieHasVPUTrack(QTMovie *movie); CFDictionaryRef VPUCreateCVPixelBufferOptionsDictionary(); #endif
// // VPUSupport.h // QTMultiGPUTextureIssue // // Created by Tom Butterworth on 15/05/2012. // Copyright (c) 2012 Tom Butterworth. All rights reserved. // #ifndef QTMultiGPUTextureIssue_VPUSupport_h #define QTMultiGPUTextureIssue_VPUSupport_h #import <Foundation/Foundation.h> #import <QTKit/QTKit.h> #define kVPUSPixelFormatTypeRGB_DXT1 'DXt1' #define kVPUSPixelFormatTypeRGBA_DXT1 'DXT1' #define kVPUSPixelFormatTypeRGBA_DXT5 'DXT5' #define kVPUSPixelFormatTypeYCoCg_DXT5 'DYt5' BOOL VPUSMovieHasVPUTrack(QTMovie *movie); CFDictionaryRef VPUCreateCVPixelBufferOptionsDictionary(); #endif
Add beginnings of events on hardware
#include <stdio.h> #include "event_service.h" #include "touchscreen.h" #include "device.h" typedef struct event { int32_t device; int16_t val; // union here for other events like keys } event; #define INPUT_QUEUE_SIZE 128 static event input_queue[INPUT_QUEUE_SIZE]; // The next time that needs to be read: static int input_queue_head = 0; // The number of items in the queue (tail = (head + length) % len): static int input_queue_length = 0; static int mousex = -1; // valuator for touchscreen X static int mousey = -1; // valuator for touchscreen X static void enqueue_event(event *e) { if (input_queue_length == INPUT_QUEUE_SIZE) { printf("Input queue overflow."); } else { int tail = (input_queue_head + input_queue_length) % INPUT_QUEUE_SIZE; input_queue[tail] = *e; input_queue_length++; } } static void drain_touchscreen() { int x, y; float z; TouchscreenEvent e; event ev; while((e = touchscreen_read(&x, &y, &z)) != TOUCHSCREEN_IDLE) { switch(e) { case TOUCHSCREEN_START: ev.device = LEFTMOUSE; ev.val = 1; enqueue_event(&ev); break; case TOUCHSCREEN_DRAG: mousex = x; mousey = y; break; case TOUCHSCREEN_STOP: ev.device = LEFTMOUSE; ev.val = 0; enqueue_event(&ev); break; case TOUCHSCREEN_IDLE: default: break; } } // usleep(100000); } int32_t events_get_valuator(int32_t device) { drain_touchscreen(); if(device == MOUSEX) return mousex; else if(device == MOUSEY) return mousey; return 0; } void events_qdevice(int32_t device) { } uint32_t event_qread_start(int blocking) { drain_touchscreen(); return input_queue_length; } int32_t events_qread_continue(int16_t *value) { *value = input_queue[input_queue_head].val; int32_t device = input_queue[input_queue_head].device; input_queue_head = (input_queue_head + 1) % INPUT_QUEUE_SIZE; input_queue_length--; return device; } int32_t events_winopen(char *title) { touchscreen_init(); drain_touchscreen(); return 0; } void events_tie(int32_t button, int32_t val1, int32_t val2) { }
Fix a -Wdocumentation warning (empty paragraph passed to '\brief' command)
//===-- LoopConvert/LoopConvert.h - C++11 for-loop migration ----*- C++ -*-===// // // The LLVM Compiler Infrastructure // // This file is distributed under the University of Illinois Open Source // License. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// /// /// \file /// \brief This file provides the definition of the LoopConvertTransform /// class which is the main interface to the loop-convert transform /// that tries to make use of range-based for loops where possible. /// //===----------------------------------------------------------------------===// #ifndef LLVM_TOOLS_CLANG_TOOLS_EXTRA_CPP11_MIGRATE_LOOP_CONVERT_H #define LLVM_TOOLS_CLANG_TOOLS_EXTRA_CPP11_MIGRATE_LOOP_CONVERT_H #include "Transform.h" #include "llvm/Support/Compiler.h" // For LLVM_OVERRIDE /// \brief Subclass of Transform that transforms for-loops into range-based /// for-loops where possible. class LoopConvertTransform : public Transform { public: /// \brief \see Transform::run(). virtual int apply(const FileContentsByPath &InputStates, RiskLevel MaxRiskLevel, const clang::tooling::CompilationDatabase &Database, const std::vector<std::string> &SourcePaths, FileContentsByPath &ResultStates) LLVM_OVERRIDE; }; #endif // LLVM_TOOLS_CLANG_TOOLS_EXTRA_CPP11_MIGRATE_LOOP_CONVERT_H
//===-- LoopConvert/LoopConvert.h - C++11 for-loop migration ----*- C++ -*-===// // // The LLVM Compiler Infrastructure // // This file is distributed under the University of Illinois Open Source // License. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// /// /// \file /// \brief This file provides the definition of the LoopConvertTransform /// class which is the main interface to the loop-convert transform /// that tries to make use of range-based for loops where possible. /// //===----------------------------------------------------------------------===// #ifndef LLVM_TOOLS_CLANG_TOOLS_EXTRA_CPP11_MIGRATE_LOOP_CONVERT_H #define LLVM_TOOLS_CLANG_TOOLS_EXTRA_CPP11_MIGRATE_LOOP_CONVERT_H #include "Transform.h" #include "llvm/Support/Compiler.h" // For LLVM_OVERRIDE /// \brief Subclass of Transform that transforms for-loops into range-based /// for-loops where possible. class LoopConvertTransform : public Transform { public: /// \see Transform::run(). virtual int apply(const FileContentsByPath &InputStates, RiskLevel MaxRiskLevel, const clang::tooling::CompilationDatabase &Database, const std::vector<std::string> &SourcePaths, FileContentsByPath &ResultStates) LLVM_OVERRIDE; }; #endif // LLVM_TOOLS_CLANG_TOOLS_EXTRA_CPP11_MIGRATE_LOOP_CONVERT_H
Fix warning (struct forward-declared as class).
#ifndef SkEdgeBuilder_DEFINED #define SkEdgeBuilder_DEFINED #include "SkChunkAlloc.h" #include "SkRect.h" #include "SkTDArray.h" class SkEdge; class SkEdgeClipper; class SkPath; class SkEdgeBuilder { public: SkEdgeBuilder(); int build(const SkPath& path, const SkIRect* clip, int shiftUp); SkEdge** edgeList() { return fList.begin(); } private: SkChunkAlloc fAlloc; SkTDArray<SkEdge*> fList; int fShiftUp; void addLine(const SkPoint pts[]); void addQuad(const SkPoint pts[]); void addCubic(const SkPoint pts[]); void addClipper(SkEdgeClipper*); }; #endif
#ifndef SkEdgeBuilder_DEFINED #define SkEdgeBuilder_DEFINED #include "SkChunkAlloc.h" #include "SkRect.h" #include "SkTDArray.h" struct SkEdge; class SkEdgeClipper; class SkPath; class SkEdgeBuilder { public: SkEdgeBuilder(); int build(const SkPath& path, const SkIRect* clip, int shiftUp); SkEdge** edgeList() { return fList.begin(); } private: SkChunkAlloc fAlloc; SkTDArray<SkEdge*> fList; int fShiftUp; void addLine(const SkPoint pts[]); void addQuad(const SkPoint pts[]); void addCubic(const SkPoint pts[]); void addClipper(SkEdgeClipper*); }; #endif
Use nullptr to stay Qt4 compatible.
#ifndef CLICKLABEL_H #define CLICKLABEL_H #include <QLabel> #include <QWidget> #include <Qt> class ClickLabel:public QLabel { Q_OBJECT public: explicit ClickLabel(QWidget *parent = Q_NULLPTR, Qt::WindowFlags f = Qt::WindowFlags()); ~ClickLabel(); signals: void clicked(); protected: void mouseReleaseEvent(QMouseEvent *event); }; #endif // CLICKLABEL_H
#ifndef CLICKLABEL_H #define CLICKLABEL_H #include <QLabel> #include <QWidget> #include <Qt> class ClickLabel:public QLabel { Q_OBJECT public: explicit ClickLabel(QWidget *parent = nullptr, Qt::WindowFlags f = Qt::WindowFlags()); ~ClickLabel(); signals: void clicked(); protected: void mouseReleaseEvent(QMouseEvent *event); }; #endif // CLICKLABEL_H
Use the C library version of log10() instead of the inaccurate formula log10(x) = log10e * log(x). This fixes some small (one or two ULP) inaccuracies.
#include "f2c.h" #define log10e 0.43429448190325182765 #ifdef KR_headers double log(); double d_lg10(x) doublereal *x; #else #undef abs #include "math.h" double d_lg10(doublereal *x) #endif { return( log10e * log(*x) ); }
#include "f2c.h" #ifdef KR_headers double log10(); double d_lg10(x) doublereal *x; #else #undef abs #include "math.h" double d_lg10(doublereal *x) #endif { return( log10(*x) ); }
Add missing legacy API into legacy header
/** * Add a new map widget to the given parent Elementary (container) object. * * @param parent The parent object. * @return a new map widget handle or @c NULL, on errors. * * This function inserts a new map widget on the canvas. * * @ingroup Map */ EAPI Evas_Object *elm_map_add(Evas_Object *parent); #include "elm_map.eo.legacy.h"
/** * Add a new map widget to the given parent Elementary (container) object. * * @param parent The parent object. * @return a new map widget handle or @c NULL, on errors. * * This function inserts a new map widget on the canvas. * * @ingroup Map */ EAPI Evas_Object *elm_map_add(Evas_Object *parent); /** * @internal * * @brief Requests a list of addresses corresponding to a given name. * * @since 1.8 * * @remarks This is used if you want to search the address from a name. * * @param obj The map object * @param address The address * @param name_cb The callback function * @param data The user callback data * * @ingroup Map */ EAPI void elm_map_name_search(const Evas_Object *obj, const char *address, Elm_Map_Name_List_Cb name_cb, void *data); #include "elm_map.eo.legacy.h"
Fix typo in include guard
/* Copyright (C) 2016 Volker Krause <vkrause@kde.org> This program is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. */ #ifndef KSYNTAXHIGHLIGHTING_ABSTRACTHIGHLIGHTERM_P_H #define KSYNTAXHIGHLIGHTING_ABSTRACTHIGHLIGHTERM_P_H #include "definition.h" #include "theme.h" class QStringList; namespace KSyntaxHighlighting { class ContextSwitch; class StateData; class AbstractHighlighterPrivate { public: AbstractHighlighterPrivate(); virtual ~AbstractHighlighterPrivate(); void ensureDefinitionLoaded(); bool switchContext(StateData* data, const ContextSwitch &contextSwitch, const QStringList &captures); Definition m_definition; Theme m_theme; }; } #endif
/* Copyright (C) 2016 Volker Krause <vkrause@kde.org> This program is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. */ #ifndef KSYNTAXHIGHLIGHTING_ABSTRACTHIGHLIGHTER_P_H #define KSYNTAXHIGHLIGHTING_ABSTRACTHIGHLIGHTER_P_H #include "definition.h" #include "theme.h" class QStringList; namespace KSyntaxHighlighting { class ContextSwitch; class StateData; class AbstractHighlighterPrivate { public: AbstractHighlighterPrivate(); virtual ~AbstractHighlighterPrivate(); void ensureDefinitionLoaded(); bool switchContext(StateData* data, const ContextSwitch &contextSwitch, const QStringList &captures); Definition m_definition; Theme m_theme; }; } #endif
Change for alpha-RC1 version name
#ifndef QGC_CONFIGURATION_H #define QGC_CONFIGURATION_H #include <QString> /** @brief Polling interval in ms */ #define SERIAL_POLL_INTERVAL 9 /** @brief Heartbeat emission rate, in Hertz (times per second) */ #define MAVLINK_HEARTBEAT_DEFAULT_RATE 1 #define WITH_TEXT_TO_SPEECH 1 #define QGC_APPLICATION_NAME "APM Planner" #define QGC_APPLICATION_VERSION "v2.0.0 (beta)" namespace QGC { const QString APPNAME = "APMPLANNER2"; const QString COMPANYNAME = "DIYDRONES"; const int APPLICATIONVERSION = 200; // 1.0.9 } #endif // QGC_CONFIGURATION_H
#ifndef QGC_CONFIGURATION_H #define QGC_CONFIGURATION_H #include <QString> /** @brief Polling interval in ms */ #define SERIAL_POLL_INTERVAL 9 /** @brief Heartbeat emission rate, in Hertz (times per second) */ #define MAVLINK_HEARTBEAT_DEFAULT_RATE 1 #define WITH_TEXT_TO_SPEECH 1 #define QGC_APPLICATION_NAME "APM Planner" #define QGC_APPLICATION_VERSION "v2.0.0 (alpha-RC1)" namespace QGC { const QString APPNAME = "APMPLANNER2"; const QString COMPANYNAME = "DIYDRONES"; const int APPLICATIONVERSION = 200; // 1.0.9 } #endif // QGC_CONFIGURATION_H
Include marcdisp.h so that atoi_n gets public on WIN32
/* * Copyright (c) 1997-2004, Index Data * See the file LICENSE for details. * * $Id: atoin.c,v 1.4 2004-12-13 14:21:55 heikki Exp $ */ /** * \file atoin.c * \brief Implements atoi_n function. */ #if HAVE_CONFIG_H #include <config.h> #endif #include <string.h> #include <ctype.h> /** * atoi_n: like atoi but reads at most len characters. */ int atoi_n (const char *buf, int len) { int val = 0; while (--len >= 0) { if (isdigit (*(const unsigned char *) buf)) val = val*10 + (*buf - '0'); buf++; } return val; }
/* * Copyright (c) 1997-2004, Index Data * See the file LICENSE for details. * * $Id: atoin.c,v 1.5 2004-12-16 08:59:56 adam Exp $ */ /** * \file atoin.c * \brief Implements atoi_n function. */ #if HAVE_CONFIG_H #include <config.h> #endif #include <string.h> #include <ctype.h> #include <yaz/marcdisp.h> /** * atoi_n: like atoi but reads at most len characters. */ int atoi_n (const char *buf, int len) { int val = 0; while (--len >= 0) { if (isdigit (*(const unsigned char *) buf)) val = val*10 + (*buf - '0'); buf++; } return val; }
Add conversion-to-bool operator to JsonRpcResult class
#pragma once #include "jcon.h" #include <QString> #include <QVariant> namespace jcon { class JCON_API JsonRpcResult { public: virtual ~JsonRpcResult() {} virtual bool isSuccess() const = 0; virtual QVariant result() const = 0; virtual QString toString() const = 0; }; }
#pragma once #include "jcon.h" #include <QString> #include <QVariant> namespace jcon { class JCON_API JsonRpcResult { public: virtual ~JsonRpcResult() {} operator bool() const { return isSuccess(); } virtual bool isSuccess() const = 0; virtual QVariant result() const = 0; virtual QString toString() const = 0; }; }
Support DEC style PARAMETER statements
#include "../parse.h" unsigned parse_stmt_parameter( const sparse_t* src, const char* ptr, parse_debug_t* debug, parse_stmt_t* stmt) { unsigned dpos = parse_debug_position(debug); unsigned i = parse_keyword( src, ptr, debug, PARSE_KEYWORD_PARAMETER); if (i == 0) return 0; if (ptr[i++] != '(') { parse_debug_rewind(debug, dpos); return 0; } unsigned l; stmt->parameter.list = parse_assign_list( src, &ptr[i], debug, &l); if (!stmt->parameter.list) { parse_debug_rewind(debug, dpos); return 0; } i += l; if (ptr[i++] != ')') { parse_assign_list_delete( stmt->parameter.list); parse_debug_rewind(debug, dpos); return 0; } stmt->type = PARSE_STMT_PARAMETER; return i; } bool parse_stmt_parameter_print( int fd, const parse_stmt_t* stmt) { if (!stmt) return false; return (dprintf_bool(fd, "PARAMETER ") && parse_assign_list_print( fd, stmt->parameter.list)); }
#include "../parse.h" unsigned parse_stmt_parameter( const sparse_t* src, const char* ptr, parse_debug_t* debug, parse_stmt_t* stmt) { unsigned dpos = parse_debug_position(debug); unsigned i = parse_keyword( src, ptr, debug, PARSE_KEYWORD_PARAMETER); if (i == 0) return 0; bool has_brackets = (ptr[i] == '('); if (has_brackets) i += 1; unsigned l; stmt->parameter.list = parse_assign_list( src, &ptr[i], debug, &l); if (!stmt->parameter.list) { parse_debug_rewind(debug, dpos); return 0; } i += l; if (has_brackets) { if (ptr[i++] != ')') { parse_assign_list_delete( stmt->parameter.list); parse_debug_rewind(debug, dpos); return 0; } } stmt->type = PARSE_STMT_PARAMETER; return i; } bool parse_stmt_parameter_print( int fd, const parse_stmt_t* stmt) { if (!stmt) return false; return (dprintf_bool(fd, "PARAMETER ") && parse_assign_list_print( fd, stmt->parameter.list)); }
Remove debug messages and duplicate code
#include <arch/x64/port.h> #include <truth/panic.h> #define TEST_RESULT_PORT_NUMBER 0xf4 void test_shutdown_status(enum status status) { logf(Log_Debug, "Test shutting down with status %s (%d)\n", status_message(status), status); write_port(status, TEST_RESULT_PORT_NUMBER); //__asm__("movb $0x0, %al; outb %al, $0xf4"); __asm__("movb $0xf4, %al; outb %al, $0x0"); __asm__("movb $0x0, %al; outb %al, $0xf4"); halt(); //write_port(2, TEST_RESULT_PORT_NUMBER); assert(Not_Reached); }
#include <arch/x64/port.h> #include <truth/panic.h> #define TEST_RESULT_PORT_NUMBER 0xf4 void test_shutdown_status(enum status status) { logf(Log_Debug, "Test shutting down with status %s (%d)\n", status_message(status), status); write_port(status, TEST_RESULT_PORT_NUMBER); halt(); assert(Not_Reached); }
Fix file name in comments.
/*===---- stddef.h - Basic type definitions --------------------------------=== * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. * *===-----------------------------------------------------------------------=== */ static inline int __get_cpuid (unsigned int level, unsigned int *eax, unsigned int *ebx, unsigned int *ecx, unsigned int *edx) { asm("cpuid" : "=a"(*eax), "=b" (*ebx), "=c"(*ecx), "=d"(*edx) : "0"(level)); return 1; }
/*===---- cpuid.h - Basic type definitions ---------------------------------=== * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. * *===-----------------------------------------------------------------------=== */ static inline int __get_cpuid (unsigned int level, unsigned int *eax, unsigned int *ebx, unsigned int *ecx, unsigned int *edx) { asm("cpuid" : "=a"(*eax), "=b" (*ebx), "=c"(*ecx), "=d"(*edx) : "0"(level)); return 1; }
Move this class back to onebusaway-iphone
@interface OBABookmarkV2 : NSObject { NSString * _name; NSArray * _stopIds; } - (id) initWithCoder:(NSCoder*)coder; @property (nonatomic, retain) NSString * name; @property (nonatomic, retain) NSArray * stopIds; @end
Change stubs for VDP1 cons driver
/* * Copyright (c) 2012 Israel Jacques * See LICENSE for details. * * Israel Jacques <mrko@eecs.berkeley.edu> */ #include "cons.h" typedef struct { } cons_vdp1_t; static struct cons_vdp1_t *cons_vdp1_new(void); static void cons_vdp1_write(struct cons *, int, uint8_t, uint8_t); void cons_vdp1_init(struct cons *cons) { cons_vdp1_t *cons_vdp1; cons_vdp1 = cons_vdp1_new(); cons->driver = cons_vdp1; cons->write = cons_vdp1_write; cons_reset(cons); } static struct cons_vdp1_t * cons_vdp1_new(void) { static struct cons_vdp1_t cons_vdp1; return &cons_vdp1; } static void cons_vdp1_write(struct cons *cons, int c, uint8_t fg, uint8_t bg) { }
/* * Copyright (c) 2012 Israel Jacques * See LICENSE for details. * * Israel Jacques <mrko@eecs.berkeley.edu> */ #include <inttypes.h> #include <stdbool.h> #include <ctype.h> #include <string.h> #include "cons.h" typedef struct { } cons_vdp1_t; static cons_vdp1_t *cons_vdp1_new(void); static void cons_vdp1_reset(struct cons *); static void cons_vdp1_write(struct cons *, int, uint8_t, uint8_t); void cons_vdp1_init(struct cons *cons) { cons_vdp1_t *cons_vdp1; cons_vdp1 = cons_vdp1_new(); cons->driver = cons_vdp1; cons->write = cons_vdp1_write; cons->reset = cons_vdp1_reset; cons_reset(cons); } static cons_vdp1_t * cons_vdp1_new(void) { /* XXX Replace with TLSF */ static cons_vdp1_t cons_vdp1; return &cons_vdp1; } static void cons_vdp1_reset(struct cons *cons) { cons_vdp1_t *cons_vdp1; cons_vdp1 = cons->driver; /* Reset */ } static void cons_vdp1_write(struct cons *cons, int c, uint8_t fg, uint8_t bg) { cons_vdp1_t *cons_vdp1; cons_vdp1 = cons->driver; }
Add "clear" command for clearing screen
#include <norby/colortest.h> #include <norby/gdt.h> #include <norby/idt.h> #include <norby/irq.h> #include <norby/isrs.h> #include <norby/kernel.h> #include <norby/keyboard.h> #include <norby/panic.h> #include <norby/version.h> #include <norby/vga.h> #include <stdio.h> #include <string.h> void kmain() { //Install descriptor tables install_gdt(); install_idt(); install_isrs(); install_irq(); install_keyboard(); asm volatile ("sti"); //Set up VGA text mode, and print a welcome message initialize_screen(); set_text_colors(VGA_COLOR_LIGHT_GRAY, VGA_COLOR_BLACK); clear_screen(); printf("NorbyOS v%s\n", NORBY_VERSION); char* buffer; while(1) { printf("==> "); gets_s(buffer, 100); if(strcmp(buffer, "colortest") == 0) { colortest(); } } //Enter an endless loop. If you disable this, another loop in boot.asm will //start, but interrupts will be disabled. while (1) {} }
#include <norby/colortest.h> #include <norby/gdt.h> #include <norby/idt.h> #include <norby/irq.h> #include <norby/isrs.h> #include <norby/kernel.h> #include <norby/keyboard.h> #include <norby/panic.h> #include <norby/version.h> #include <norby/vga.h> #include <stdio.h> #include <string.h> void kmain() { //Install descriptor tables install_gdt(); install_idt(); install_isrs(); install_irq(); install_keyboard(); asm volatile ("sti"); //Set up VGA text mode, and print a welcome message initialize_screen(); set_text_colors(VGA_COLOR_LIGHT_GRAY, VGA_COLOR_BLACK); clear_screen(); printf("NorbyOS v%s\n", NORBY_VERSION); char* buffer; while(1) { printf("==> "); gets_s(buffer, 100); if(strcmp(buffer, "colortest") == 0) { colortest(); } else if(strcmp(buffer, "clear") == 0) { clear_screen(); } } //Enter an endless loop. If you disable this, another loop in boot.asm will //start, but interrupts will be disabled. while (1) {} }
Fix test case RUN: line (thanks Argiris)
// RUN: clang -fexceptions -emit-llvm -o - %s | grep "@foo() {" | count 1 // RUN: clang -emit-llvm -o - %s | grep "@foo() nounwind {" | count 1 int foo(void) { }
// RUN: clang -fexceptions -emit-llvm -o - %s | grep "@foo() {" | count 1 && // RUN: clang -emit-llvm -o - %s | grep "@foo() nounwind {" | count 1 int foo(void) { }
Update internal glibc functions ABI for glibc 2.27
/* * nsswitch_internal.h * Prototypes for some internal glibc functions that we use. Shhh. */ #ifndef NSSWITCH_INTERNAL_H #define NSSWITCH_INTERNAL_H #include "config.h" /* glibc/config.h.in */ #if defined USE_REGPARMS && !defined PROF && !defined __BOUNDED_POINTERS__ # define internal_function __attribute__ ((regparm (3), stdcall)) #else # define internal_function #endif /* glibc/nss/nsswitch.h */ typedef struct service_user service_user; extern int __nss_next (service_user **ni, const char *fct_name, void **fctp, int status, int all_values); extern int __nss_database_lookup (const char *database, const char *alternative_name, const char *defconfig, service_user **ni); extern void *__nss_lookup_function (service_user *ni, const char *fct_name); /* glibc/nss/XXX-lookup.c */ extern int __nss_passwd_lookup (service_user **ni, const char *fct_name, void **fctp) internal_function; extern int __nss_group_lookup (service_user **ni, const char *fct_name, void **fctp) internal_function; #endif /* NSSWITCH_INTERNAL_H */
/* * nsswitch_internal.h * Prototypes for some internal glibc functions that we use. Shhh. */ #ifndef NSSWITCH_INTERNAL_H #define NSSWITCH_INTERNAL_H #include <features.h> #include "config.h" /* glibc/config.h.in */ #if __GLIBC_PREREQ(2, 27) # define internal_function #elif defined USE_REGPARMS && !defined PROF && !defined __BOUNDED_POINTERS__ # define internal_function __attribute__ ((regparm (3), stdcall)) #else # define internal_function #endif /* glibc/nss/nsswitch.h */ typedef struct service_user service_user; extern int __nss_next (service_user **ni, const char *fct_name, void **fctp, int status, int all_values); extern int __nss_database_lookup (const char *database, const char *alternative_name, const char *defconfig, service_user **ni); extern void *__nss_lookup_function (service_user *ni, const char *fct_name); /* glibc/nss/XXX-lookup.c */ extern int __nss_passwd_lookup (service_user **ni, const char *fct_name, void **fctp) internal_function; extern int __nss_group_lookup (service_user **ni, const char *fct_name, void **fctp) internal_function; #endif /* NSSWITCH_INTERNAL_H */
Change from `int` to `float`
#include <stdio.h> /* print Fahrenheit to Celsius table * for Fahrenheit 0, 20, ..., 300 */ int main() { int fahr; int cel; int lower; int upper; int step; lower = 0; /* lower bound for the table */ upper = 300; /* upper bound for the table */ step = 20; /* amount to step by */ fahr = lower; while (fahr <= upper) { cel = 5 * (fahr - 32) / 9; printf("%3d\t%6d\n", fahr, cel); fahr += step; } }
#include <stdio.h> /* print Fahrenheit to Celsius table * for Fahrenheit 0, 20, ..., 300 */ int main() { float fahr; float cel; int lower; int upper; int step; lower = 0; /* lower bound for the table */ upper = 300; /* upper bound for the table */ step = 20; /* amount to step by */ fahr = lower; while (fahr <= upper) { cel = (5.0 / 9.0) * (fahr - 32.0); printf("%3.0f\t%6.1f\n", fahr, cel); fahr += step; } }
Make os::GLContext instantiable (isValid() returns false by default)
// LAF OS Library // Copyright (C) 2022 Igara Studio S.A. // Copyright (C) 2015-2016 David Capello // // This file is released under the terms of the MIT license. // Read LICENSE.txt for more information. #ifndef OS_GL_CONTEXT_INCLUDED #define OS_GL_CONTEXT_INCLUDED #pragma once namespace os { class GLContext { public: virtual ~GLContext() { } virtual bool isValid() = 0; virtual bool createGLContext() = 0; virtual void destroyGLContext() = 0; virtual void makeCurrent() = 0; virtual void swapBuffers() = 0; }; } // namespace os #endif
// LAF OS Library // Copyright (C) 2022 Igara Studio S.A. // Copyright (C) 2015-2016 David Capello // // This file is released under the terms of the MIT license. // Read LICENSE.txt for more information. #ifndef OS_GL_CONTEXT_INCLUDED #define OS_GL_CONTEXT_INCLUDED #pragma once namespace os { class GLContext { public: virtual ~GLContext() { } virtual bool isValid() { return false; } virtual bool createGLContext() { } virtual void destroyGLContext() { } virtual void makeCurrent() { } virtual void swapBuffers() { } }; } // namespace os #endif
Use bytes for mask images
/*ckwg +5 * Copyright 2011 by Kitware, Inc. All Rights Reserved. Please refer to * KITWARE_LICENSE.TXT for licensing information, or contact General Counsel, * Kitware, Inc., 28 Corporate Drive, Clifton Park, NY 12065. */ #ifndef VISTK_SCORING_SCORE_MASK_H #define VISTK_SCORING_SCORE_MASK_H #include "scoring-config.h" #include "scoring_result.h" #include <vil/vil_image_view.h> /** * \file mask_scoring.h * * \brief A function for scoring a mask. */ namespace vistk { /// A typedef for a mask image. typedef vil_image_view<bool> mask_t; /** * \brief Scores a computed mask against a truth mask. * * \note The input images are expected to be the same size. * * \todo Add error handling to the function (invalid sizes, etc.). * * \param truth The truth mask. * \param computed The computed mask. * * \returns The results of the scoring. */ scoring_result_t VISTK_SCORING_EXPORT score_mask(mask_t const& truth_mask, mask_t const& computed_mask); } #endif // VISTK_SCORING_SCORE_MASK_H
/*ckwg +5 * Copyright 2011 by Kitware, Inc. All Rights Reserved. Please refer to * KITWARE_LICENSE.TXT for licensing information, or contact General Counsel, * Kitware, Inc., 28 Corporate Drive, Clifton Park, NY 12065. */ #ifndef VISTK_SCORING_SCORE_MASK_H #define VISTK_SCORING_SCORE_MASK_H #include "scoring-config.h" #include "scoring_result.h" #include <vil/vil_image_view.h> #include <boost/cstdint.hpp> /** * \file mask_scoring.h * * \brief A function for scoring a mask. */ namespace vistk { /// A typedef for a mask image. typedef vil_image_view<uint8_t> mask_t; /** * \brief Scores a computed mask against a truth mask. * * \note The input images are expected to be the same size. * * \todo Add error handling to the function (invalid sizes, etc.). * * \param truth The truth mask. * \param computed The computed mask. * * \returns The results of the scoring. */ scoring_result_t VISTK_SCORING_EXPORT score_mask(mask_t const& truth_mask, mask_t const& computed_mask); } #endif // VISTK_SCORING_SCORE_MASK_H
Create an enum for all posible function return status codes
#ifndef KERNEL_H #define KERNEL_H void free_write(); extern unsigned int endkernel; #endif
#ifndef KERNEL_H #define KERNEL_H void free_write(); extern unsigned int endkernel; enum STATUS_CODE { // General GENERAL_SUCCESS, GENERAL_FAILURE } #endif
Enable error logging for the blackbox reader
/* * Copyright (C) 2012 Andrew Beekhof <andrew@beekhof.net> * * libqb 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. * * libqb is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with libqb. If not, see <http://www.gnu.org/licenses/>. */ #include <qb/qblog.h> int main(int argc, char **argv) { int lpc = 0; for(lpc = 1; lpc < argc && argv[lpc] != NULL; lpc++) { printf("Dumping the contents of %s\n", argv[lpc]); qb_log_blackbox_print_from_file(argv[lpc]); } return 0; }
/* * Copyright (C) 2012 Andrew Beekhof <andrew@beekhof.net> * * libqb 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. * * libqb is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public License * along with libqb. If not, see <http://www.gnu.org/licenses/>. */ #include <qb/qblog.h> int main(int argc, char **argv) { int lpc = 0; qb_log_init("qb_blackbox", LOG_USER, LOG_TRACE); qb_log_ctl(QB_LOG_STDERR, QB_LOG_CONF_ENABLED, QB_TRUE); qb_log_filter_ctl(QB_LOG_STDERR, QB_LOG_FILTER_ADD, QB_LOG_FILTER_FILE, "*", LOG_TRACE); for(lpc = 1; lpc < argc && argv[lpc] != NULL; lpc++) { printf("Dumping the contents of %s\n", argv[lpc]); qb_log_blackbox_print_from_file(argv[lpc]); } return 0; }
Fix incorrect import on React-Native >=0.40
// // RNCallKit.h // RNCallKit // // Created by Ian Yu-Hsun Lin on 12/22/16. // Copyright © 2016 Ian Yu-Hsun Lin. All rights reserved. // #import <Foundation/Foundation.h> #import <UIKit/UIKit.h> #import <CallKit/CallKit.h> #import <Intents/Intents.h> //#import <AVFoundation/AVAudioSession.h> #import "RCTEventEmitter.h" @interface RNCallKit : RCTEventEmitter <CXProviderDelegate> @property (nonatomic, strong) CXCallController *callKitCallController; @property (nonatomic, strong) CXProvider *callKitProvider; + (BOOL)application:(UIApplication *)application openURL:(NSURL *)url options:(NSDictionary<UIApplicationOpenURLOptionsKey, id> *)options NS_AVAILABLE_IOS(9_0); + (BOOL)application:(UIApplication *)application continueUserActivity:(NSUserActivity *)userActivity restorationHandler:(void(^)(NSArray * __nullable restorableObjects))restorationHandler; @end
// // RNCallKit.h // RNCallKit // // Created by Ian Yu-Hsun Lin on 12/22/16. // Copyright © 2016 Ian Yu-Hsun Lin. All rights reserved. // #import <Foundation/Foundation.h> #import <UIKit/UIKit.h> #import <CallKit/CallKit.h> #import <Intents/Intents.h> //#import <AVFoundation/AVAudioSession.h> #import <React/RCTEventEmitter.h> @interface RNCallKit : RCTEventEmitter <CXProviderDelegate> @property (nonatomic, strong) CXCallController *callKitCallController; @property (nonatomic, strong) CXProvider *callKitProvider; + (BOOL)application:(UIApplication *)application openURL:(NSURL *)url options:(NSDictionary<UIApplicationOpenURLOptionsKey, id> *)options NS_AVAILABLE_IOS(9_0); + (BOOL)application:(UIApplication *)application continueUserActivity:(NSUserActivity *)userActivity restorationHandler:(void(^)(NSArray * __nullable restorableObjects))restorationHandler; @end
Add an ifdef to disable MallocCache for debugging.
#ifndef MALLOCCACHE_H #define MALLOCCACHE_H template <size_t blockSize, size_t blockCount> class MallocCache { public: MallocCache() : m_blocksCached(0) { } ~MallocCache() { assert(m_blocksCached >= 0 && m_blocksCached <= blockCount); for (size_t i = 0; i < m_blocksCached; i++) { ::free(m_blocks[i]); } } void *allocate() { assert(m_blocksCached >= 0 && m_blocksCached <= blockCount); if (m_blocksCached) { return m_blocks[--m_blocksCached]; } else { return ::malloc(blockSize); } } void free(void *allocation) { assert(m_blocksCached >= 0 && m_blocksCached <= blockCount); if (m_blocksCached < blockCount) { m_blocks[m_blocksCached++] = allocation; } else { ::free(allocation); } } private: void *m_blocks[blockCount]; size_t m_blocksCached; }; #endif // MALLOCCACHE_H
#ifndef MALLOCCACHE_H #define MALLOCCACHE_H // no-op the cache, sometimes useful for debugging memory issues //#define MALLOCCACHE_PASSTHROUGH template <size_t blockSize, size_t blockCount> class MallocCache { public: MallocCache() : m_blocksCached(0) { } ~MallocCache() { #ifndef MALLOCCACHE_PASSTHROUGH assert(m_blocksCached >= 0 && m_blocksCached <= blockCount); for (size_t i = 0; i < m_blocksCached; i++) { ::free(m_blocks[i]); } #endif } void *allocate() { #ifndef MALLOCCACHE_PASSTHROUGH assert(m_blocksCached >= 0 && m_blocksCached <= blockCount); if (m_blocksCached) { return m_blocks[--m_blocksCached]; } else { return ::malloc(blockSize); } #else return ::malloc(blockSize); #endif } void free(void *allocation) { #ifndef MALLOCCACHE_PASSTHROUGH assert(m_blocksCached >= 0 && m_blocksCached <= blockCount); if (m_blocksCached < blockCount) { m_blocks[m_blocksCached++] = allocation; } else { ::free(allocation); } #else ::free(allocation); #endif } private: void *m_blocks[blockCount]; size_t m_blocksCached; }; #endif // MALLOCCACHE_H
Handle input by the user
#pragma once #include "Component.h" enum ENTITY_TYPE {PLAYER}; // Commnets class InputComponent : public Component { public: InputComponent(); ~InputComponent(); void SetEntityType(int entityType); void HandleInput(); void HandlePlayerInput(); private: char* m_inputMessage; ENTITY_TYPE m_entityType; }
Add warning in function documentation
#ifndef SC_ADB_PARSER_H #define SC_ADB_PARSER_H #include "common.h" #include "stddef.h" /** * Parse the ip from the output of `adb shell ip route` */ char * sc_adb_parse_device_ip_from_output(char *buf, size_t buf_len); #endif
#ifndef SC_ADB_PARSER_H #define SC_ADB_PARSER_H #include "common.h" #include "stddef.h" /** * Parse the ip from the output of `adb shell ip route` * * Warning: this function modifies the buffer for optimization purposes. */ char * sc_adb_parse_device_ip_from_output(char *buf, size_t buf_len); #endif
Change more info window layout name
startclose: moreInfo New Window [ Name: "More Info"; Left: Get ( WindowDesktopWidth ) - (Get ( WindowDesktopWidth ) / 2 ) ] Go to Layout [ “about” (tempSetup) ] Adjust Window [ Resize to Fit ] Pause/Resume Script [ Indefinitely ] January 23, 平成26 3:39:22 Imagination Quality Management.fp7 - about -1-
startclose: moreInfo New Window [ Name: "More Info"; Left: Get ( WindowDesktopWidth ) - (Get ( WindowDesktopWidth ) / 2 ) ] Go to Layout [ “moreinfo” (tempSetup) ] Adjust Window [ Resize to Fit ] Pause/Resume Script [ Indefinitely ] January 23, 平成26 3:39:22 Imagination Quality Management.fp7 - about -1-
Add in a version number so apps can tell uclib is being used. -Erik
#ifndef __FEATURES_H #define __FEATURES_H #ifdef __STDC__ #define __P(x) x #define __const const /* Almost ansi */ #if __STDC__ != 1 #define const #define volatile #endif #else /* K&R */ #define __P(x) () #define __const #define const #define volatile #endif /* No C++ */ #define __BEGIN_DECLS #define __END_DECLS /* GNUish things */ #define __CONSTVALUE #define __CONSTVALUE2 #define _POSIX_THREAD_SAFE_FUNCTIONS #include <sys/cdefs.h> #endif
#ifndef __FEATURES_H #define __FEATURES_H /* Major and minor version number of the uCLibc library package. Use these macros to test for features in specific releases. */ #define __UCLIBC__ 0 #define __UCLIBC_MAJOR__ 9 #define __UCLIBC_MINOR__ 1 #ifdef __STDC__ #define __P(x) x #define __const const /* Almost ansi */ #if __STDC__ != 1 #define const #define volatile #endif #else /* K&R */ #define __P(x) () #define __const #define const #define volatile #endif /* No C++ */ #define __BEGIN_DECLS #define __END_DECLS /* GNUish things */ #define __CONSTVALUE #define __CONSTVALUE2 #define _POSIX_THREAD_SAFE_FUNCTIONS #include <sys/cdefs.h> #endif
Fix on fbsd amd64 where U32 is 4 bytes and pthread_t is 8.
/* Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ static MP_INLINE U32 mpxs_APR__OS_current_thread_id(pTHX) { #if APR_HAS_THREADS return (U32)apr_os_thread_current(); #else return 0; #endif }
/* Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with * this work for additional information regarding copyright ownership. * The ASF licenses this file to You under the Apache License, Version 2.0 * (the "License"); you may not use this file except in compliance with * the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ static MP_INLINE unsigned long mpxs_APR__OS_current_thread_id(pTHX) { #if APR_HAS_THREADS return (unsigned long)apr_os_thread_current(); #else return 0; #endif }
Fix test. (0 && (a(),1)) is a valid I-C-E according to C99.
// RUN: clang %s -fsyntax-only -verify -pedantic-errors int a() {int p; *(1 ? &p : (void*)(0 && (a(),1))) = 10;} // expected-error {{null pointer expression is not an integer constant expression (but is allowed as an extension)}} // expected-note{{C does not permit evaluated commas in an integer constant expression}}
// RUN: clang %s -fsyntax-only -verify int a() {int p; *(1 ? &p : (void*)(0 && (a(),1))) = 10;}
Fix macro so it can be used as a statement
#ifdef E_TYPEDEFS #define e_error_message_show(args...) \ { \ char __tmpbuf[PATH_MAX]; \ \ snprintf(__tmpbuf, sizeof(__tmpbuf), ##args); \ e_error_message_show_internal(__tmpbuf); \ } #else #ifndef E_ERROR_H #define E_ERROR_H EAPI void e_error_message_show_internal(char *txt); #endif #endif
#ifdef E_TYPEDEFS #define e_error_message_show(args...) do \ { \ char __tmpbuf[PATH_MAX]; \ \ snprintf(__tmpbuf, sizeof(__tmpbuf), ##args); \ e_error_message_show_internal(__tmpbuf); \ } while (0) #else #ifndef E_ERROR_H #define E_ERROR_H EAPI void e_error_message_show_internal(char *txt); #endif #endif
Fix build with strndup on some platforms
#ifndef UTIL_STRING_H #define UTIL_STRING_H #include "util/common.h" char* strndup(const char* start, size_t len); char* strnrstr(const char* restrict s1, const char* restrict s2, size_t len); #endif
#ifndef UTIL_STRING_H #define UTIL_STRING_H #include "util/common.h" #ifndef strndup // This is sometimes a macro char* strndup(const char* start, size_t len); #endif char* strnrstr(const char* restrict s1, const char* restrict s2, size_t len); #endif
Update import statement for consistency.
#import "MBProgressHUD.h" #import <SDWebImage/UIImageView+WebCache.h> #import "JTSImageViewController.h" #import "JTSImageInfo.h" #import "UITabBarController+NBUAdditions.h" #import "KINWebBrowserViewController.h" #import <SSPullToRefresh/SSPullToRefresh.h> #import "SVGKit/SVGKit.h"
#import "MBProgressHUD.h" #import <SDWebImage/UIImageView+WebCache.h> #import "JTSImageViewController.h" #import "JTSImageInfo.h" #import "UITabBarController+NBUAdditions.h" #import "KINWebBrowserViewController.h" #import <SSPullToRefresh/SSPullToRefresh.h> #import <SVGKit/SVGKit.h>
Add validation to fuzz target
#define CGLTF_IMPLEMENTATION #include "../cgltf.h" int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) { cgltf_options options = {0}; cgltf_data* data = NULL; cgltf_result res = cgltf_parse(&options, Data, Size, &data); if (res == cgltf_result_success) cgltf_free(data); return 0; }
#define CGLTF_IMPLEMENTATION #include "../cgltf.h" int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) { cgltf_options options = {0}; cgltf_data* data = NULL; cgltf_result res = cgltf_parse(&options, Data, Size, &data); if (res == cgltf_result_success) { cgltf_validate(data); cgltf_free(data); } return 0; }
Bump version in preparation for next release.
/** \file common.h * \brief Project-wide definitions and macros. * * * SCL; 2012-2015 */ #ifndef COMMON_H #define COMMON_H #define GR1C_VERSION "0.10.2" #define GR1C_COPYRIGHT "Copyright (c) 2012-2015 by Scott C. Livingston,\n" \ "California Institute of Technology\n\n" \ "This is free, open source software, released under a BSD license\n" \ "and without warranty." #define GR1C_INTERACTIVE_PROMPT ">>> " typedef int vartype; typedef char bool; #define True 1 #define False 0 typedef unsigned char byte; #include "util.h" #include "cudd.h" #endif
/** \file common.h * \brief Project-wide definitions and macros. * * * SCL; 2012-2015 */ #ifndef COMMON_H #define COMMON_H #define GR1C_VERSION "0.10.3" #define GR1C_COPYRIGHT "Copyright (c) 2012-2015 by Scott C. Livingston,\n" \ "California Institute of Technology\n\n" \ "This is free, open source software, released under a BSD license\n" \ "and without warranty." #define GR1C_INTERACTIVE_PROMPT ">>> " typedef int vartype; typedef char bool; #define True 1 #define False 0 typedef unsigned char byte; #include "util.h" #include "cudd.h" #endif
Remove old class forward declaration
// // OCTEntity.h // OctoKit // // Created by Josh Abernathy on 1/21/11. // Copyright 2011 GitHub. All rights reserved. // #import "OCTObject.h" @class OCTPlan; @class GHImageRequestOperation; // Represents any GitHub object which is capable of owning repositories. @interface OCTEntity : OCTObject // Returns `login` if no name is explicitly set. @property (nonatomic, copy) NSString *name; @property (nonatomic, copy) NSArray *repositories; @property (nonatomic, copy) NSString *email; @property (nonatomic, copy) NSURL *avatarURL; @property (nonatomic, copy) NSString *login; @property (nonatomic, copy) NSString *blog; @property (nonatomic, copy) NSString *company; @property (nonatomic, assign) NSUInteger collaborators; @property (nonatomic, assign) NSUInteger publicRepoCount; @property (nonatomic, assign) NSUInteger privateRepoCount; @property (nonatomic, assign) NSUInteger diskUsage; @property (nonatomic, readonly, strong) OCTPlan *plan; // TODO: Fix this to "RemoteCounterparts". - (void)mergeRepositoriesWithRemoteCountparts:(NSArray *)remoteRepositories; @end
// // OCTEntity.h // OctoKit // // Created by Josh Abernathy on 1/21/11. // Copyright 2011 GitHub. All rights reserved. // #import "OCTObject.h" @class OCTPlan; // Represents any GitHub object which is capable of owning repositories. @interface OCTEntity : OCTObject // Returns `login` if no name is explicitly set. @property (nonatomic, copy) NSString *name; @property (nonatomic, copy) NSArray *repositories; @property (nonatomic, copy) NSString *email; @property (nonatomic, copy) NSURL *avatarURL; @property (nonatomic, copy) NSString *login; @property (nonatomic, copy) NSString *blog; @property (nonatomic, copy) NSString *company; @property (nonatomic, assign) NSUInteger collaborators; @property (nonatomic, assign) NSUInteger publicRepoCount; @property (nonatomic, assign) NSUInteger privateRepoCount; @property (nonatomic, assign) NSUInteger diskUsage; @property (nonatomic, readonly, strong) OCTPlan *plan; // TODO: Fix this to "RemoteCounterparts". - (void)mergeRepositoriesWithRemoteCountparts:(NSArray *)remoteRepositories; @end
Rework the command line option defaults mechanism
#include <stdlib.h> #include <string.h> #include <stdio.h> #include "options.h" static Options * _new() { Options *opts = (Options *)malloc(sizeof(Options)); if(opts) { memset(opts, 0, sizeof(Options)); } return opts; } static Options * make(int argc, char *argv[]) { Options *opts = _new(); int i = 1; for(;;) { if(i >= (argc - 1)) break; if(!strcmp(argv[i], "sdbfile")) { opts->sdbFilename = argv[i+1]; i = i + 2; } else if(!strcmp(argv[i], "romfile")) { opts->romFilename = argv[i+1]; i = i + 2; } else { fprintf(stderr, "Warning: unknown option %s\n", argv[i]); i++; } } if (!opts->romFilename) { opts->romFilename = "roms/forth"; } return opts; } const struct interface_Options module_Options = { .make = &make, };
#include <stdlib.h> #include <string.h> #include <stdio.h> #include "options.h" static Options * _new() { Options *opts = (Options *)malloc(sizeof(Options)); if(opts) { memset(opts, 0, sizeof(Options)); } return opts; } static Options * make(int argc, char *argv[]) { Options *opts = _new(); int i = 1; /* Defaults */ opts->romFilename = "roms/forth"; /* Parse the command line */ for(;;) { if(i >= (argc - 1)) break; if(!strcmp(argv[i], "sdbfile")) { opts->sdbFilename = argv[i+1]; i = i + 2; } else if(!strcmp(argv[i], "romfile")) { opts->romFilename = argv[i+1]; i = i + 2; } else { fprintf(stderr, "Warning: unknown option %s\n", argv[i]); i++; } } return opts; } const struct interface_Options module_Options = { .make = &make, };
Comment the main .c file
#include <stdio.h> int main() { puts("Hello, people!"); return 0; }
#include <stdio.h> int main() { puts("Hello, people!"); /* Preferred over printf */ return 0; }
Mend loop condition from 344aae0
#define _XOPEN_SOURCE 500 #include <unistd.h> #include <stdlib.h> char *os_find_self(void) { // PATH_MAX (used by readlink(2)) is not necessarily available size_t size = 2048, used = 0; char *path = NULL; do { size *= 2; path = realloc(path, size); used = readlink("/proc/self/exe", path, size); } while (used > size && path != NULL); return path; }
#define _XOPEN_SOURCE 500 #include <unistd.h> #include <stdlib.h> char *os_find_self(void) { // PATH_MAX (used by readlink(2)) is not necessarily available size_t size = 2048, used = 0; char *path = NULL; do { size *= 2; path = realloc(path, size); used = readlink("/proc/self/exe", path, size); path[used - 1] = '\0'; } while (used >= size && path != NULL); return path; }
Add placeholder C code to finish build scripts
/** * Copyright (c) 2011 Jon Maken, All Rights Reserved * License: 3-Clause BSD * Revision: 07/21/2011 2:44:32 PM */ #include <stdio.h> static void usage(void) { printf("XVal: Validate XML documents\n"); printf("Usage: xval [--dtd DTD_FILE | --xsd XSD_FILE] XML_FILE ...\n\n"); printf(" --dtd DTD_FILE validate against external DTD file\n"); printf(" --xsd XSD_FILE validate against external XSD schema file\n"); } static int process_options(int argc, char **argv) { if (argc == 1) return(1); return(0); } int main(int argc, char **argv) { int rv; if ((rv = process_options(argc, argv) != 0)) { usage(); return(rv); } /* cleanup function for the XML library */ /* xmlCleanupParser(); */ return(0); }
Add dummy macro GC_register_finalizer_ignore_self and GC_add_roots.
/* $Id: t_gc.h,v 1.7 2011/09/04 13:00:54 mit-sato Exp $ */ #ifndef __T_GC__ #define __T_GC__ #ifdef PROF # define GC_INIT() 0 # define GC_MALLOC(s) malloc(s) # define GC_MALLOC_ATOMIC(s) malloc(s) #else # include <gc.h> #endif /* PROF */ #endif /* __T_GC__ */
/* $Id: t_gc.h,v 1.7 2011/09/04 13:00:54 mit-sato Exp $ */ #ifndef __T_GC__ #define __T_GC__ #ifdef PROF # define GC_INIT() 0 # define GC_MALLOC(s) malloc(s) # define GC_MALLOC_ATOMIC(s) malloc(s) # define GC_register_finalizer_ignore_self(o,f,c,x,y) 0 # define GC_add_roots(s,e) 0 #else # include <gc.h> #endif /* PROF */ #endif /* __T_GC__ */
Allow nil result in kit api attribution method
#import <Foundation/Foundation.h> @class MPAttributionResult; @class FilteredMParticleUser; @protocol MPKitProtocol; @interface MPKitAPI : NSObject - (void)logError:(NSString *_Nullable)format, ...; - (void)logWarning:(NSString *_Nullable)format, ...; - (void)logDebug:(NSString *_Nullable)format, ...; - (void)logVerbose:(NSString *_Nullable)format, ...; - (NSDictionary<NSString *, NSString *> *_Nullable)integrationAttributes; - (void)onAttributionCompleteWithResult:(MPAttributionResult *_Nonnull)result error:(NSError *_Nullable)error; - (FilteredMParticleUser *_Nonnull)getCurrentUserWithKit:(id<MPKitProtocol> _Nonnull)kit; - (nullable NSNumber *)incrementUserAttribute:(NSString *_Nonnull)key byValue:(NSNumber *_Nonnull)value forUser:(FilteredMParticleUser *_Nonnull)filteredUser; - (void)setUserAttribute:(NSString *_Nonnull)key value:(id _Nonnull)value forUser:(FilteredMParticleUser *_Nonnull)filteredUser; - (void)setUserAttributeList:(NSString *_Nonnull)key values:(NSArray<NSString *> * _Nonnull)values forUser:(FilteredMParticleUser *_Nonnull)filteredUser; - (void)setUserTag:(NSString *_Nonnull)tag forUser:(FilteredMParticleUser *_Nonnull)filteredUser; - (void)removeUserAttribute:(NSString *_Nonnull)key forUser:(FilteredMParticleUser *_Nonnull)filteredUser; @end
#import <Foundation/Foundation.h> @class MPAttributionResult; @class FilteredMParticleUser; @protocol MPKitProtocol; @interface MPKitAPI : NSObject - (void)logError:(NSString *_Nullable)format, ...; - (void)logWarning:(NSString *_Nullable)format, ...; - (void)logDebug:(NSString *_Nullable)format, ...; - (void)logVerbose:(NSString *_Nullable)format, ...; - (NSDictionary<NSString *, NSString *> *_Nullable)integrationAttributes; - (void)onAttributionCompleteWithResult:(MPAttributionResult *_Nullable)result error:(NSError *_Nullable)error; - (FilteredMParticleUser *_Nonnull)getCurrentUserWithKit:(id<MPKitProtocol> _Nonnull)kit; - (nullable NSNumber *)incrementUserAttribute:(NSString *_Nonnull)key byValue:(NSNumber *_Nonnull)value forUser:(FilteredMParticleUser *_Nonnull)filteredUser; - (void)setUserAttribute:(NSString *_Nonnull)key value:(id _Nonnull)value forUser:(FilteredMParticleUser *_Nonnull)filteredUser; - (void)setUserAttributeList:(NSString *_Nonnull)key values:(NSArray<NSString *> * _Nonnull)values forUser:(FilteredMParticleUser *_Nonnull)filteredUser; - (void)setUserTag:(NSString *_Nonnull)tag forUser:(FilteredMParticleUser *_Nonnull)filteredUser; - (void)removeUserAttribute:(NSString *_Nonnull)key forUser:(FilteredMParticleUser *_Nonnull)filteredUser; @end
Change default F_CPU from 12000000 to 8000000
/* * USART.h * * Created: 2016/9/10 16:30:30 * Author: dusch */ #ifndef USART_H_ #define USART_H_ #define BAUD 9600 #define F_CPU 12000000UL #include <avr/interrupt.h> void USART_Init(void); void USART_Transmit(unsigned char data); unsigned char USART_Receive(void); #endif /* USART_H_ */
/* * USART.h * * Created: 2016/9/10 16:30:30 * Author: dusch */ #ifndef USART_H_ #define USART_H_ #define BAUD 9600 #define F_CPU 8000000UL #include <avr/interrupt.h> void USART_Init(void); void USART_Transmit(unsigned char data); unsigned char USART_Receive(void); #endif /* USART_H_ */
Add a header file for osl::Move
#include "ruby.h" #include <osl/move.h> extern VALUE cMove; using namespace osl; void rb_move_free(Move* ptr); static VALUE rb_move_s_new(VALUE self); void Init_move(void);
Fix typo in writable string test
// RUN: clang -emit-llvm -fwritable-string %s int main() { char *str = "abc"; str[0] = '1'; printf("%s", str); }
// RUN: clang -emit-llvm -fwritable-strings %s int main() { char *str = "abc"; str[0] = '1'; printf("%s", str); }
Make TRACE() safe when DEBUG is disabled.
#ifndef _TRACE_H_ #define _TRACE_H_ #include <stdio.h> #include <errno.h> #ifdef DEBUG #define TRACE ERROR #else #define TRACE(fmt,arg...) ((void) 0) #endif #ifdef DEBUG #define ERROR(fmt,arg...) \ fprintf(stderr, "%s:%d: "fmt, __func__, __LINE__, ##arg) #else #define ERROR(fmt,arg...) \ fprintf(stderr, "%s: "fmt, program_invocation_short_name, ##arg) #endif #define FATAL(fmt,arg...) do { \ ERROR(fmt, ##arg); \ exit(1); \ } while (0) #endif
#ifndef _TRACE_H_ #define _TRACE_H_ #include <stdio.h> #include <errno.h> #ifdef DEBUG #define TRACE ERROR #else static inline void TRACE(const char *fmt, ...) { } #endif #ifdef DEBUG #define ERROR(fmt,arg...) \ fprintf(stderr, "%s:%d: "fmt, __func__, __LINE__, ##arg) #else #define ERROR(fmt,arg...) \ fprintf(stderr, "%s: "fmt, program_invocation_short_name, ##arg) #endif #define FATAL(fmt,arg...) do { \ ERROR(fmt, ##arg); \ exit(1); \ } while (0) #endif
Use EXPECTED/EXPECTED_LENGTH/OUTPUT_SIZE macros in the atom encoding test.
#include <bert/encoder.h> #include <bert/magic.h> #include <bert/errno.h> #include "test.h" #include <string.h> unsigned char output[6]; void test_output() { if (output[0] != BERT_MAGIC) { test_fail("bert_encoder_push did not add the magic byte"); } if (output[1] != BERT_ATOM) { test_fail("bert_encoder_push did not add the SMALL_INT magic byte"); } size_t expected_length = 2; if (output[3] != expected_length) { test_fail("bert_encoder_push encoded %u as the atom length, expected %u",output[3],expected_length); } const char *expected = "id"; test_strings((const char *)(output+4),expected,expected_length); } int main() { bert_encoder_t *encoder = test_encoder(output,6); bert_data_t *data; if (!(data = bert_data_create_atom("id"))) { test_fail("malloc failed"); } test_encoder_push(encoder,data); bert_data_destroy(data); bert_encoder_destroy(encoder); test_output(); return 0; }
#include <bert/encoder.h> #include <bert/magic.h> #include <bert/errno.h> #include "test.h" #include <string.h> #define EXPECTED_LENGTH 2 #define EXPECTED "id" #define OUTPUT_SIZE (1 + 1 + 2 + EXPECTED_LENGTH) unsigned char output[OUTPUT_SIZE]; void test_output() { if (output[0] != BERT_MAGIC) { test_fail("bert_encoder_push did not add the magic byte"); } if (output[1] != BERT_ATOM) { test_fail("bert_encoder_push did not add the SMALL_INT magic byte"); } if (output[3] != EXPECTED_LENGTH) { test_fail("bert_encoder_push encoded %u as the atom length, expected %u",output[3],expected_length); } test_strings((const char *)(output+4),EXPECTED,expected_length); } int main() { bert_encoder_t *encoder = test_encoder(output,OUTPUT_SIZE); bert_data_t *data; if (!(data = bert_data_create_atom(EXPECTED))) { test_fail("malloc failed"); } test_encoder_push(encoder,data); bert_data_destroy(data); bert_encoder_destroy(encoder); test_output(); return 0; }
Implement add_contant to draw function
//Finished just draw_new function, Sleeping zzZZ #include <stdio.h> #include <stdlib.h> #include <string.h> #define LENLINE 255 //global variable assignment struct node { char string[LENLINE]; struct node *next; //next and previous address node linked }; int line_amount = 0; int draw_new(char *name, int socket,struct node *root); // addcontact prototype int pop_contact(char *name, struct node *root); // pop prototype int read(struct node *root); // read prototype int main(){ //Initial username's linked list struct node *root, *current; root = malloc(sizeof(struct node)); root->next = 0; current = root; } //------------------------------------------------------------------------------ int draw_new(char *string, struct node *root){ int i = 0; struct node *current; current = root; while ( current->next != 0) current = current->next; //########## create new node ##########// current->next = malloc(sizeof(struct node)); current = current->next; current->next = 0; //Copy input string into string's var inside node strcpy(current->string, string); line_amount++; } //------------------------------------------------------------------------------- int pop_contact(char *name,struct node *root){ struct node *current, *temp; current = root; while(current->next != 0){ if(strcmp(current->next->username, name) == 0){ temp = current->next; current->next = current->next->next; free(temp); // clear(pop) memory of disconect node. return 0; } current = current->next; } } //--------------------------------------------------------------------------------- int read(struct node *root){ struct node *current; current = root; while(current->next != 0){ current = current->next; printf("----------------------\n"); printf("User : %s\nsocket : %d\n", current->username, current->socket); printf("----------------------\n"); } }
Add simple constructor and destructor.
#include <stdint.h> #include <stdlib.h> #include "rtpp_module.h" #define MI_VER_INIT(sname) {.rev = MODULE_API_REVISION, .mi_size = sizeof(sname)} struct moduleinfo rtpp_module = { .name = "csv_acct", .ver = MI_VER_INIT(struct moduleinfo) };
#include <assert.h> #include <stdint.h> #include <stdlib.h> #include "rtpp_types.h" #include "rtpp_module.h" #define MI_VER_INIT(sname) {.rev = MODULE_API_REVISION, .mi_size = sizeof(sname)} struct rtpp_module_priv { int foo; }; static struct rtpp_module_priv *rtpp_csv_acct_ctor(struct rtpp_cfg_stable *); static void rtpp_csv_acct_dtor(struct rtpp_module_priv *); struct moduleinfo rtpp_module = { .name = "csv_acct", .ver = MI_VER_INIT(struct moduleinfo), .ctor = rtpp_csv_acct_ctor, .dtor = rtpp_csv_acct_dtor }; static struct rtpp_module_priv bar; static struct rtpp_module_priv * rtpp_csv_acct_ctor(struct rtpp_cfg_stable *cfsp) { bar.foo = 123456; return (&bar); } static void rtpp_csv_acct_dtor(struct rtpp_module_priv *pvt) { assert(pvt->foo == 123456); return; }
Add Perry Metzger's wrapper to run the svnserve process setgid, since this can be very helpful to svn+ssh users. Quoting from the comments:
/* * Wrapper to run the svnserve process setgid. * The idea is to avoid the problem that some interpreters like bash * invoked by svnserve in hook scripts will reset the effective gid to * the real gid, nuking the effect of an ordinary setgid svnserve binary. * Sadly, to set the real gid portably, you need to be root, if only * for a moment. * Also smashes the environment to something known, so that games * can't be played to try to break the security of the hook scripts, * by setting IFS, PATH, and similar means. */ /* * Written by Perry Metzger, and placed into the public domain. */ #include <stdio.h> #include <unistd.h> #define REAL_PATH "/usr/bin/svnserve.real" char *newenv[] = { "PATH=/bin:/usr/bin", "SHELL=/bin/sh", NULL }; int main(int argc, char **argv) { if (setgid(getegid()) == -1) { perror("setgid(getegid())"); return 1; } if (seteuid(getuid()) == -1) { perror("seteuid(getuid())"); return 1; } execve(REAL_PATH, argv, newenv); perror("attempting to exec " REAL_PATH " failed"); return 1; }