Instruction
stringlengths
14
778
input_code
stringlengths
0
4.24k
output_code
stringlengths
1
5.44k
Add missing plat header for IRQ combiner
/* * Copyright 2014, NICTA * * This software may be distributed and modified according to the terms of * the BSD 2-Clause license. Note that NO WARRANTY is provided. * See "LICENSE_BSD2.txt" for details. * * @TAG(NICTA_BSD) */ #ifndef _PLATSUPPORT_PLAT_IRQ_COMBINER_H_ #define _PLATSUPPORT_PLAT_IRQ_COMBINER_H_ enum irq_combiner_id { IRQ_COMBINER0, NIRQ_COMBINERS }; #define EXYNOS4_IRQ_COMBINER_PADDR 0x10440000 #define EXYNOS4_IRQ_COMBINER_SIZE 0x1000 #define EXYNOS_IRQ_COMBINER_PADDR EXYNOS4_IRQ_COMBINER_PADDR #define EXYNOS_IRQ_COMBINER_SIZE EXYNOS4_IRQ_COMBINER_SIZE #endif /* _PLATSUPPORT_PLAT_IRQ_COMBINER_H_ */
Add declarations for StartDevice and StopDevice
#if !defined(_XENIFACE_H_) #define _XENIFACE_H_ #include <ntddk.h> #pragma warning(disable:4100 4057) typedef struct _DEVICE_EXTENSION { PDEVICE_OBJECT DeviceObject; PDEVICE_OBJECT LowerDeviceObject; PDEVICE_OBJECT Pdo; UNICODE_STRING ifname; IO_REMOVE_LOCK RemoveLock; } DEVICE_EXTENSION, *PDEVICE_EXTENSION; DRIVER_INITIALIZE DriverEntry; DRIVER_UNLOAD DriverUnload; DRIVER_ADD_DEVICE AddDevice; _Dispatch_type_(IRP_MJ_PNP) DRIVER_DISPATCH DispatchPnp; #endif // _XENIFACE_H_
#if !defined(_XENIFACE_H_) #define _XENIFACE_H_ #include <ntddk.h> #pragma warning(disable:4100 4057) typedef struct _DEVICE_EXTENSION { PDEVICE_OBJECT DeviceObject; PDEVICE_OBJECT LowerDeviceObject; PDEVICE_OBJECT Pdo; UNICODE_STRING ifname; IO_REMOVE_LOCK RemoveLock; } DEVICE_EXTENSION, *PDEVICE_EXTENSION; DRIVER_INITIALIZE DriverEntry; DRIVER_UNLOAD DriverUnload; DRIVER_ADD_DEVICE AddDevice; _Dispatch_type_(IRP_MJ_PNP) DRIVER_DISPATCH DispatchPnp; NTSTATUS StartDevice( __in PDEVICE_OBJECT DeviceObject, __in PIRP Irp ); NTSTATUS StopDevice( __in PDEVICE_OBJECT DeviceObject, __in PIRP Irp ); #endif // _XENIFACE_H_
Use the definitions in machine/fsr.h instead of duplicating these magic numbers here (the values need to correspond to the %fsr ones for some libc functions to work right).
/* * Written by J.T. Conklin, Apr 6, 1995 * Public domain. * $FreeBSD$ */ #ifndef _MACHINE_IEEEFP_H_ #define _MACHINE_IEEEFP_H_ typedef int fp_except_t; #define FP_X_IMP 0x01 /* imprecise (loss of precision) */ #define FP_X_DZ 0x02 /* divide-by-zero exception */ #define FP_X_UFL 0x04 /* underflow exception */ #define FP_X_OFL 0x08 /* overflow exception */ #define FP_X_INV 0x10 /* invalid operation exception */ typedef enum { FP_RN=0, /* round to nearest representable number */ FP_RZ=1, /* round to zero (truncate) */ FP_RP=2, /* round toward positive infinity */ FP_RM=3 /* round toward negative infinity */ } fp_rnd_t; #endif /* _MACHINE_IEEEFP_H_ */
/* * Written by J.T. Conklin, Apr 6, 1995 * Public domain. * $FreeBSD$ */ #ifndef _MACHINE_IEEEFP_H_ #define _MACHINE_IEEEFP_H_ #include <machine/fsr.h> typedef int fp_except_t; #define FP_X_IMP FSR_NX /* imprecise (loss of precision) */ #define FP_X_DZ FSR_DZ /* divide-by-zero exception */ #define FP_X_UFL FSR_UF /* underflow exception */ #define FP_X_OFL FSR_OF /* overflow exception */ #define FP_X_INV FSR_NV /* invalid operation exception */ typedef enum { FP_RN = FSR_RD_N, /* round to nearest representable number */ FP_RZ = FSR_RD_Z, /* round to zero (truncate) */ FP_RP = FSR_RD_PINF, /* round toward positive infinity */ FP_RM = FSR_RD_NINF /* round toward negative infinity */ } fp_rnd_t; #endif /* _MACHINE_IEEEFP_H_ */
Add spotify-json codec for sf::Rect<double>
#pragma once #include <spotify/json.hpp> #include <SFML/Graphics/Rect.hpp> namespace spotify { namespace json { // See Vector2Codec.h for issues with making this generic. template<> struct default_codec_t<sf::Rect<double>> { typedef std::pair<double, double> DoublePair; typedef std::pair<DoublePair, DoublePair> DoublePairPair; static auto codec() { auto codec = codec::transform( codec::pair(codec::pair(codec::number<double>(), codec::number<double>()), codec::pair(codec::number<double>(), codec::number<double>())), [](sf::Rect<double> v) {return DoublePairPair{{v.left, v.top}, {v.width, v.height}}; }, [](DoublePairPair p) {return sf::Rect<double>(p.first.first, p.first.second, p.second.first, p.second.second); } ); return codec; } }; } }
Test only: Correct id to instancetype
// OCHamcrest by Jon Reid, https://qualitycoding.org/ // Copyright 2018 hamcrest.org. See LICENSE.txt @import Foundation; NS_ASSUME_NONNULL_BEGIN @interface FakeWithoutCount : NSObject + (id)fake; @end NS_ASSUME_NONNULL_END
// OCHamcrest by Jon Reid, https://qualitycoding.org/ // Copyright 2018 hamcrest.org. See LICENSE.txt @import Foundation; NS_ASSUME_NONNULL_BEGIN @interface FakeWithoutCount : NSObject + (instancetype)fake; @end NS_ASSUME_NONNULL_END
Add accessor to Director of a FriendProxy
// @(#)root/treeplayer:$Id$ // Author: Philippe Canal 01/06/2004 /************************************************************************* * Copyright (C) 1995-2004, Rene Brun and Fons Rademakers and al. * * All rights reserved. * * * * For the licensing terms see $ROOTSYS/LICENSE. * * For the list of contributors see $ROOTSYS/README/CREDITS. * *************************************************************************/ #ifndef ROOT_TFriendProxy #define ROOT_TFriendProxy #include "TBranchProxyDirector.h" class TTree; namespace ROOT { namespace Internal { class TFriendProxy { protected: TBranchProxyDirector fDirector; // contain pointer to TTree and entry to be read Int_t fIndex; // Index of this tree in the list of friends public: TFriendProxy(); TFriendProxy(TBranchProxyDirector *director, TTree *main, Int_t index); Long64_t GetReadEntry() const; void ResetReadEntry(); void Update(TTree *newmain); }; } // namespace Internal } // namespace ROOT #endif
// @(#)root/treeplayer:$Id$ // Author: Philippe Canal 01/06/2004 /************************************************************************* * Copyright (C) 1995-2004, Rene Brun and Fons Rademakers and al. * * All rights reserved. * * * * For the licensing terms see $ROOTSYS/LICENSE. * * For the list of contributors see $ROOTSYS/README/CREDITS. * *************************************************************************/ #ifndef ROOT_TFriendProxy #define ROOT_TFriendProxy #include "TBranchProxyDirector.h" class TTree; namespace ROOT { namespace Internal { class TFriendProxy { protected: TBranchProxyDirector fDirector; // contain pointer to TTree and entry to be read Int_t fIndex; // Index of this tree in the list of friends public: TFriendProxy(); TFriendProxy(TBranchProxyDirector *director, TTree *main, Int_t index); TBranchProxyDirector *GetDirector() { return &fDirector; } Long64_t GetReadEntry() const; void ResetReadEntry(); void Update(TTree *newmain); }; } // namespace Internal } // namespace ROOT #endif
Disable copy and assign on ScriptObject
#ifndef INCLUDED_SCRIPT_OBJECT_H_ #define INCLUDED_SCRIPT_OBJECT_H_ #include "browser.h" #include "npapi-headers/npruntime.h" class EmacsInstance; class ScriptObject : public NPObject { public: static ScriptObject* create(NPP npp); void invalidate(); bool hasMethod(NPIdentifier name); bool invoke(NPIdentifier name, const NPVariant *args, uint32_t argCount, NPVariant *result); bool enumerate(NPIdentifier **identifiers, uint32_t *identifierCount); static NPObject* allocateThunk(NPP npp, NPClass *aClass); static void deallocateThunk(NPObject *npobj); static void invalidateThunk(NPObject *npobj); static bool hasMethodThunk(NPObject *npobj, NPIdentifier name); static bool invokeThunk(NPObject *npobj, NPIdentifier name, const NPVariant *args, uint32_t argCount, NPVariant *result); static bool enumerateThunk(NPObject *npobj, NPIdentifier **identifiers, uint32_t *identifierCount); private: ScriptObject(NPP npp); ~ScriptObject(); EmacsInstance* emacsInstance(); NPP npp_; }; #endif // INCLUDED_SCRIPT_OBJECT_H_
#ifndef INCLUDED_SCRIPT_OBJECT_H_ #define INCLUDED_SCRIPT_OBJECT_H_ #include "browser.h" #include "npapi-headers/npruntime.h" #include "util.h" class EmacsInstance; class ScriptObject : public NPObject { public: static ScriptObject* create(NPP npp); void invalidate(); bool hasMethod(NPIdentifier name); bool invoke(NPIdentifier name, const NPVariant *args, uint32_t argCount, NPVariant *result); bool enumerate(NPIdentifier **identifiers, uint32_t *identifierCount); static NPObject* allocateThunk(NPP npp, NPClass *aClass); static void deallocateThunk(NPObject *npobj); static void invalidateThunk(NPObject *npobj); static bool hasMethodThunk(NPObject *npobj, NPIdentifier name); static bool invokeThunk(NPObject *npobj, NPIdentifier name, const NPVariant *args, uint32_t argCount, NPVariant *result); static bool enumerateThunk(NPObject *npobj, NPIdentifier **identifiers, uint32_t *identifierCount); private: ScriptObject(NPP npp); ~ScriptObject(); EmacsInstance* emacsInstance(); NPP npp_; DISALLOW_COPY_AND_ASSIGN(ScriptObject); }; #endif // INCLUDED_SCRIPT_OBJECT_H_
Fix warning about block declaration semantics
// // RFToolbarButton.h // // Created by Rudd Fawcett on 12/3/13. // Copyright (c) 2013 Rudd Fawcett. All rights reserved. // #import <UIKit/UIKit.h> /** * The block used for each button. */ typedef void (^eventHandlerBlock)(); @interface RFToolbarButton : UIButton /** * Creates a new RFToolbarButton. * * @param title The string to show on the button. * * @return A new button. */ + (instancetype)buttonWithTitle:(NSString *)title; /** * Creates a new RFToolbarButton. * * @param title The string to show on the button. * @param eventHandler The event handler block. * @param controlEvent The type of event. * * @return A new button. */ + (instancetype)buttonWithTitle:(NSString *)title andEventHandler:(eventHandlerBlock)eventHandler forControlEvents:(UIControlEvents)controlEvent; /** * Adds the event handler for the button. * * @param eventHandler The event handler block. * @param controlEvent The type of event. */ - (void)addEventHandler:(eventHandlerBlock)eventHandler forControlEvents:(UIControlEvents)controlEvent; @end
// // RFToolbarButton.h // // Created by Rudd Fawcett on 12/3/13. // Copyright (c) 2013 Rudd Fawcett. All rights reserved. // #import <UIKit/UIKit.h> /** * The block used for each button. */ typedef void (^eventHandlerBlock)(void); @interface RFToolbarButton : UIButton /** * Creates a new RFToolbarButton. * * @param title The string to show on the button. * * @return A new button. */ + (instancetype)buttonWithTitle:(NSString *)title; /** * Creates a new RFToolbarButton. * * @param title The string to show on the button. * @param eventHandler The event handler block. * @param controlEvent The type of event. * * @return A new button. */ + (instancetype)buttonWithTitle:(NSString *)title andEventHandler:(eventHandlerBlock)eventHandler forControlEvents:(UIControlEvents)controlEvent; /** * Adds the event handler for the button. * * @param eventHandler The event handler block. * @param controlEvent The type of event. */ - (void)addEventHandler:(eventHandlerBlock)eventHandler forControlEvents:(UIControlEvents)controlEvent; @end
Change WINDOWS_YLE_DL_DIR to not have a version number.
#ifndef CONFIG_H #define CONFIG_H #define YLE_DOWNLOADER_GUI_VERSION "2.0" #define WINDOWS_YLE_DL_DIR "yle-dl-windows-1.99.7" #endif // CONFIG_H
#ifndef CONFIG_H #define CONFIG_H #define YLE_DOWNLOADER_GUI_VERSION "2.0" #define WINDOWS_YLE_DL_DIR "yle-dl-windows" #endif // CONFIG_H
Add http subsystem for later usage and expansion
/* * This file is part of Kotaka, a mud library for DGD * http://github.com/shentino/kotaka * * Copyright (C) 2014 Raymond Jennings * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as * published by the Free Software Foundation, either version 3 of the * License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. */ #include <kotaka/paths/system.h> #include <kotaka/privilege.h> inherit LIB_INITD; inherit UTILITY_COMPILE; private void load() { } static void create() { KERNELD->set_global_access("Http", 1); load(); } void upgrade_subsystem() { ACCESS_CHECK(previous_program() == INITD); load(); purge_orphans("Http"); }
Fix missing virtual dtor on new type Buddy Michael Chan
#pragma once #include "ISingleOptionAlertBoxDismissedHandler.h" #include "INavRoutingLocationFinder.h" #include "NavRoutingLocationModel.h" #include "SearchResultModel.h" #include "ILocationService.h" #include "IAlertBoxFactory.h" namespace ExampleApp { namespace NavRouting { namespace SdkModel { class NavRoutingLocationFinder : public INavRoutingLocationFinder { private: Eegeo::Location::ILocationService& m_locationService; Eegeo::Resources::Interiors::InteriorsModelRepository& m_interiorsModelRepository; Eegeo::UI::NativeAlerts::IAlertBoxFactory& m_alertBoxFactory; Eegeo::UI::NativeAlerts::TSingleOptionAlertBoxDismissedHandler<NavRoutingLocationFinder> m_failAlertHandler; void OnFailAlertBoxDismissed(); public: NavRoutingLocationFinder( Eegeo::Location::ILocationService& locationService, Eegeo::Resources::Interiors::InteriorsModelRepository& interiorsModelRepository, Eegeo::UI::NativeAlerts::IAlertBoxFactory& alertBoxFactory); bool TryGetCurrentLocation(NavRoutingLocationModel &outLocation); bool TryGetLocationFromSearchResultModel( const Search::SdkModel::SearchResultModel& searchResultModel, NavRoutingLocationModel &outLocation); }; } } }
#pragma once #include "Types.h" #include "ISingleOptionAlertBoxDismissedHandler.h" #include "INavRoutingLocationFinder.h" #include "NavRoutingLocationModel.h" #include "SearchResultModel.h" #include "ILocationService.h" #include "IAlertBoxFactory.h" namespace ExampleApp { namespace NavRouting { namespace SdkModel { class NavRoutingLocationFinder : public INavRoutingLocationFinder, private Eegeo::NonCopyable { private: Eegeo::Location::ILocationService& m_locationService; Eegeo::Resources::Interiors::InteriorsModelRepository& m_interiorsModelRepository; Eegeo::UI::NativeAlerts::IAlertBoxFactory& m_alertBoxFactory; Eegeo::UI::NativeAlerts::TSingleOptionAlertBoxDismissedHandler<NavRoutingLocationFinder> m_failAlertHandler; void OnFailAlertBoxDismissed(); public: NavRoutingLocationFinder( Eegeo::Location::ILocationService& locationService, Eegeo::Resources::Interiors::InteriorsModelRepository& interiorsModelRepository, Eegeo::UI::NativeAlerts::IAlertBoxFactory& alertBoxFactory); virtual ~NavRoutingLocationFinder() {}; bool TryGetCurrentLocation(NavRoutingLocationModel &outLocation); bool TryGetLocationFromSearchResultModel( const Search::SdkModel::SearchResultModel& searchResultModel, NavRoutingLocationModel &outLocation); }; } } }
Remove hardcoded file path. Still awkward and not generally usable, but _more_ general.
#include <stdio.h> #include <stdlib.h> #include "udon.h" int main (int argc, char *argv[]) { int i; int found = 0; pstate *state = init_from_file("../sjson-examples/big.txt"); for(i=0; i<10000; i++) { found += parse(state); reset_state(state); } free_state(state); printf("%d\n", found); }
#include <stdio.h> #include <stdlib.h> #include "udon.h" int main (int argc, char *argv[]) { int i; int found = 0; if(argc < 2) return 1; pstate *state = init_from_file(argv[1]); for(i=0; i<10000; i++) { found += parse(state); reset_state(state); } free_state(state); printf("%d\n", found); }
Add initial exported header file
#ifndef LIBISRCRYPTO_H #define LIBISRCRYPTO_H struct isrcry_aes_key { ulong32 eK[60], dK[60]; int Nr; }; struct isrcry_blowfish_key { ulong32 S[4][256]; ulong32 K[18]; }; /** A block cipher CBC structure */ typedef struct { /** The index of the cipher chosen */ int cipher, /** The block size of the given cipher */ blocklen; /** The current IV */ unsigned char IV[MAXBLOCKSIZE]; /** The scheduled key */ symmetric_key key; } symmetric_CBC; #endif
Fix some comments and type names
// ---------------------------------------------------------------------------- // pomodoro - Defines a model to track progress through the Pomodoro Technique // Copyright (c) 2013 Jonathan Speicher (jon.speicher@gmail.com) // Licensed under the MIT license: http://opensource.org/licenses/MIT // ---------------------------------------------------------------------------- #pragma once #include <stdbool.h> // Defines a type to hold the various pomodoro technique segment types. typedef enum { POMODORO_SEGMENT_TYPE_POMODORO = 0, POMODORO_SEGMENT_TYPE_BREAK, POMODORO_SEGMENT_TYPE_COUNT } SegmentType; // Defines a type to hold a pomodoro technique segment. typedef struct { Interval interval; bool restart_on_abort; } Segment; // Defines a structure type to hold the pomodoro technique segment sequence. typedef struct { Segment* this_segment; Segment segments[POMODORO_SEGMENT_TYPE_COUNT]; } Pomodoro; // Initializes the pomodoro technique structure. void pomodoro_init(Pomodoro* pomodoro); // Completes the current pomodoro technique segment and causes an advance to // the next appropriate segment in the pomodoro technique sequence. void pomodoro_complete_segment(Pomodoro* pomodoro); // Aborts the current pomodoro tecnique segment and causes an advance to the // next appropriate segment in the pomodoro technique sequence. void pomodoro_abort_segment(Pomodoro* pomodoro);
// ---------------------------------------------------------------------------- // pomodoro - Defines a model to track progress through the Pomodoro Technique // Copyright (c) 2013 Jonathan Speicher (jon.speicher@gmail.com) // Licensed under the MIT license: http://opensource.org/licenses/MIT // ---------------------------------------------------------------------------- #pragma once #include <stdbool.h> // Defines a type to hold the various pomodoro technique segment types. typedef enum { POMODORO_SEGMENT_TYPE_POMODORO = 0, POMODORO_SEGMENT_TYPE_BREAK, POMODORO_SEGMENT_TYPE_COUNT } PomodoroSegmentType; // Defines a type to hold a pomodoro technique segment. typedef struct { Interval interval; bool restart_on_abort; } PomodoroSegment; // Defines a type to hold the pomodoro technique segment sequence. typedef struct { PomodoroSegment* this_segment; PomodoroSegment segments[POMODORO_SEGMENT_TYPE_COUNT]; } Pomodoro; // Initializes the pomodoro technique sequence structure. void pomodoro_init(Pomodoro* pomodoro); // Completes the current pomodoro technique segment and causes an advance to // the next appropriate segment in the pomodoro technique sequence. void pomodoro_complete_segment(Pomodoro* pomodoro); // Aborts the current pomodoro tecnique segment and causes an advance to the // next appropriate segment in the pomodoro technique sequence. void pomodoro_abort_segment(Pomodoro* pomodoro);
Change MouseWheel deltaWheel field size to one byte. Add compile time size check to Mouse Event.
#pragma once #include <cstdint> namespace ni { struct MouseEvent { int32_t deltaX; int32_t deltaY; int32_t deltaWheel; uint8_t leftButtonDown; uint8_t rightButtonDown; uint8_t middleButtonDown; }; }
#pragma once #include <cstdint> namespace ni { struct MouseEvent { int32_t deltaX; int32_t deltaY; int8_t deltaWheel; uint8_t leftButtonDown; uint8_t rightButtonDown; uint8_t middleButtonDown; }; static_assert(sizeof(MouseEvent) == 12, "Improper mouse event size"); }
Fix major bug in definition of greatest negative float value
/* Copyright (c) 2014 Harm Hanemaaijer <fgenfb@yahoo.com> Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies. THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ /* win32-compat.h -- header file with definitions for compatability with Windows. */ // Note: Just using the built-in maximum and minimum values on all system may be safer/ // give more consistent results than using 'INFINITY', so use of the latter is disabled. // #if !defined(__GNUC__ ) || defined(OPENGL_ES2) #if 1 #define POSITIVE_INFINITY_DOUBLE DBL_MAX #define NEGATIVE_INFINITY_DOUBLE DBL_MIN #define POSITIVE_INFINITY_FLOAT FLT_MAX #define NEGATIVE_INFINITY_FLOAT FLT_MIN #else #define POSITIVE_INFINITY_DOUBLE INFINITY #define NEGATIVE_INFINITY_DOUBLE (- INFINITY) #define POSITIVE_INFINITY_FLOAT INFINITY #define NEGATIVE_INFINITY_FLOAT (- INFINITY) #endif #ifndef __GNUC__ #define isnan(x) _isnan(x) #endif
/* Copyright (c) 2014 Harm Hanemaaijer <fgenfb@yahoo.com> Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies. THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ /* win32-compat.h -- header file with definitions for compatability with Windows. */ // Note: Just using the built-in maximum and minimum values on all system may be safer/ // give more consistent results than using 'INFINITY', so use of the latter is disabled. #define POSITIVE_INFINITY_DOUBLE DBL_MAX #define NEGATIVE_INFINITY_DOUBLE - DBL_MAX #define POSITIVE_INFINITY_FLOAT FLT_MAX #define NEGATIVE_INFINITY_FLOAT - FLT_MAX #ifndef __GNUC__ #define isnan(x) _isnan(x) #endif
Update signature of quaternion unit inverse.
/* __ __ _ * / // /_____ ____ (_) * / // // ___// __ \ / / * / // // /__ / /_/ // / * /_//_/ \___/ \____//_/ * https://bitbucket.org/galaktor/llcoi * copyright (c) 2014, llcoi Team * MIT license applies - see file "LICENSE" for details. */ #pragma once #include "ogre_interface.h" DLL QuaternionHandle quaternion_create(); DLL void quaternion_from_rotation_matrix(QuaternionHandle quat, coiMatrix3 *rot); DLL void quaternion_to_rotation_matrix(QuaternionHandle quat, coiMatrix3 *rot); DLL QuaternionHandle quaternion_from_values(coiReal fW, coiReal fX, coiReal fY, coiReal fZ); DLL void quaternion_from_angle_axis(QuaternionHandle handle, coiRadian rfAngle, Vector3Handle vecHandle); DLL coiReal quaternion_get_w(QuaternionHandle quat); DLL coiReal quaternion_get_x(QuaternionHandle quat); DLL coiReal quaternion_get_y(QuaternionHandle quat); DLL coiReal quaternion_get_z(QuaternionHandle quat); DLL QuaternionHandle quaternion_multiply_quaternion(QuaternionHandle lhs, QuaternionHandle rhs); DLL QuaternionHandle quaternion_subtract_quaternion(QuaternionHandle lhs, QuaternionHandle rhs); DLL QuaternionHandle quaternion_unit_inverse(QuaternionHandle lhs, QuaternionHandle rhs);
/* __ __ _ * / // /_____ ____ (_) * / // // ___// __ \ / / * / // // /__ / /_/ // / * /_//_/ \___/ \____//_/ * https://bitbucket.org/galaktor/llcoi * copyright (c) 2014, llcoi Team * MIT license applies - see file "LICENSE" for details. */ #pragma once #include "ogre_interface.h" DLL QuaternionHandle quaternion_create(); DLL void quaternion_from_rotation_matrix(QuaternionHandle quat, coiMatrix3 *rot); DLL void quaternion_to_rotation_matrix(QuaternionHandle quat, coiMatrix3 *rot); DLL QuaternionHandle quaternion_from_values(coiReal fW, coiReal fX, coiReal fY, coiReal fZ); DLL void quaternion_from_angle_axis(QuaternionHandle handle, coiRadian rfAngle, Vector3Handle vecHandle); DLL coiReal quaternion_get_w(QuaternionHandle quat); DLL coiReal quaternion_get_x(QuaternionHandle quat); DLL coiReal quaternion_get_y(QuaternionHandle quat); DLL coiReal quaternion_get_z(QuaternionHandle quat); DLL QuaternionHandle quaternion_multiply_quaternion(QuaternionHandle lhs, QuaternionHandle rhs); DLL QuaternionHandle quaternion_subtract_quaternion(QuaternionHandle lhs, QuaternionHandle rhs); DLL QuaternionHandle quaternion_unit_inverse(QuaternionHandle q);
Add another example! (somando dois números)
/** * Exemplo 02 - Somando dois números * * Nesse exemplo, vemos como podemos somar dois números. * Além disso, vemos como é possível mostrar um número na tela */ #include <stdio.h> int main(void) { /** * Para realizar a soma em si, utilizamos o operador + * Para imprimir o resultado, utilizamos a função printf (print formatted, imprimir com formatação) * A formatação do printf funciona da seguinte maneira: * O primeiro argumento será o "modelo" a ser impresso na tela * Tudo que começar com % será considerado uma "lacuna" a ser preenchida por algum valor * No caso, utilizamos %d, o d indicando que iremos imprimir um número (TODO: referenciar tabela) * Ao contrário da função puts, o printf não insere um "enter" (quebra de linha) após a mensagem, * logo inserimos nós mesmos. Na linguagem C, sequências começadas em \ são consideradas "escapadas", * se transformando em caracteres de controle. No caso, a sequência \n é impressa como um enter. */ printf("2 + 2 = %d \n", 2 + 2); return 0; }
Remove implementation details from API comment
/* * scheduler.h * * Created on: Jun 8, 2016 * Author: riley */ #ifndef SCHEDULER_H #define SCHEDULER_H #include <stdint.h> #include "scheduler_private.h" typedef void (*task_func_t)( void ) ; typedef volatile struct task_private_s { const char * name; volatile void * task_sp; //Task stack pointer volatile struct task_private_s * next; } task_t; /// Sets up the idle task void scheduler_init( void ); /** * Add task to task list to be run at next context switch. * Push task routine pointer and empty status register * onto the new task stack so they can be popped off later * from the task switch interrupt. */ void scheduler_add_task(task_t * task_handle, const char * name, task_func_t func, uint16_t * task_stack, uint16_t stack_bytes); /// Kicks off the timer interrupt void scheduler_run( void ); /** * Handy macro which blackboxes the allocation of memory * per task. Accepts the task function to schedule * and the size of stack to allocate as arguments. */ #define SCHEDULER_ADD(func, stack_size) \ CREATE_TASK_HANDLE(__LINE__, func); \ CREATE_TASK_STACK(__LINE__, func, stack_size); \ CALL_SCHEDULER_ADD(__LINE__, func); #endif /* SCHEDULER_H */
/* * scheduler.h * * Created on: Jun 8, 2016 * Author: riley */ #ifndef SCHEDULER_H #define SCHEDULER_H #include <stdint.h> #include "scheduler_private.h" typedef void (*task_func_t)( void ) ; typedef volatile struct task_private_s { const char * name; volatile void * task_sp; //Task stack pointer volatile struct task_private_s * next; } task_t; /// Sets up the idle task void scheduler_init( void ); /** * Add task to task list to be run at next context switch. */ void scheduler_add_task(task_t * task_handle, const char * name, task_func_t func, uint16_t * task_stack, uint16_t stack_bytes); /// Kicks off the timer interrupt void scheduler_run( void ); /** * Handy macro which blackboxes the allocation of memory * per task. Accepts the task function to schedule * and the size of stack to allocate as arguments. */ #define SCHEDULER_ADD(func, stack_size) \ CREATE_TASK_HANDLE(__LINE__, func); \ CREATE_TASK_STACK(__LINE__, func, stack_size); \ CALL_SCHEDULER_ADD(__LINE__, func); #endif /* SCHEDULER_H */
Add Sanyo LM7000 tuner driver
#ifndef __LM7000_H #define __LM7000_H /* Sanyo LM7000 tuner chip control * * Copyright 2012 Ondrej Zary <linux@rainbow-software.org> * based on radio-aimslab.c by M. Kirkwood * and radio-sf16fmi.c by M. Kirkwood and Petr Vandrovec */ #define LM7000_DATA (1 << 0) #define LM7000_CLK (1 << 1) #define LM7000_CE (1 << 2) #define LM7000_FM_100 (0 << 20) #define LM7000_FM_50 (1 << 20) #define LM7000_FM_25 (2 << 20) #define LM7000_BIT_FM (1 << 23) static inline void lm7000_set_freq(u32 freq, void *handle, void (*set_pins)(void *handle, u8 pins)) { int i; u8 data; u32 val; freq += 171200; /* Add 10.7 MHz IF */ freq /= 400; /* Convert to 25 kHz units */ val = freq | LM7000_FM_25 | LM7000_BIT_FM; /* write the 24-bit register, starting with LSB */ for (i = 0; i < 24; i++) { data = val & (1 << i) ? LM7000_DATA : 0; set_pins(handle, data | LM7000_CE); udelay(2); set_pins(handle, data | LM7000_CE | LM7000_CLK); udelay(2); set_pins(handle, data | LM7000_CE); udelay(2); } set_pins(handle, 0); } #endif /* __LM7000_H */
Add bindings for XOpenDisplay and XCloseDisplay
#include "libx11_ruby.h" VALUE rb_mLibX11; void Init_libx11_ruby(void) { rb_mLibX11 = rb_define_module("LibX11"); }
#include <X11/Xlib.h> #include "libx11_ruby.h" VALUE rb_mLibX11, rb_cDisplay; static size_t display_memsize(const void *); static const rb_data_type_t display_type = { .wrap_struct_name = "libx11_display", .function = { .dmark = NULL, .dfree = NULL, .dsize = display_memsize, .reserved = { NULL, NULL }, }, .parent = NULL, .data = NULL, .flags = RUBY_TYPED_FREE_IMMEDIATELY, }; static size_t display_memsize(const void *arg) { const Display *display = arg; return sizeof(display); } /* * Xlib XOpenDisplay */ static VALUE rb_libx11_open_display(VALUE self, VALUE display_name) { Display *display; Check_Type(display_name, T_STRING); display = XOpenDisplay(RSTRING_PTR(display_name)); return TypedData_Wrap_Struct(rb_cDisplay, &display_type, display); } /* * Xlib XCloseDisplay */ static VALUE rb_libx11_close_display(VALUE self, VALUE obj) { int ret; Display *display; TypedData_Get_Struct(obj, Display, &display_type, display); ret = XCloseDisplay(display); return INT2FIX(ret); } void Init_libx11_ruby(void) { rb_mLibX11 = rb_define_module("LibX11"); rb_define_singleton_method(rb_mLibX11, "open_display", rb_libx11_open_display, 1); rb_define_singleton_method(rb_mLibX11, "close_display", rb_libx11_close_display, 1); rb_cDisplay = rb_define_class_under(rb_mLibX11, "Display", rb_cData); }
Increase number of stars to 512.
#ifndef _nbody_h #define _nbody_h #include <stdbool.h> #include "window.h" #include "star.h" #define NUM_STARS 64 typedef struct { Window* window; bool running; Star stars[NUM_STARS]; } NBody; NBody* NBody_new(); void NBody_run(NBody* self); void NBody_destroy(NBody* self); #endif
#ifndef _nbody_h #define _nbody_h #include <stdbool.h> #include "window.h" #include "star.h" #define NUM_STARS 512 typedef struct { Window* window; bool running; Star stars[NUM_STARS]; } NBody; NBody* NBody_new(); void NBody_run(NBody* self); void NBody_destroy(NBody* self); #endif
Fix a bug with copy cctors, iterators and vector erases. Weird bugs are weird.
#ifndef ORDER_H_ #define ORDER_H_ /** * Represents an order with weight and volume */ class Order { public: Order(uint weight, uint volume) : _weight(weight), _volume(volume) { } ///< Constructor Order(const Order& other) : _weight(other._weight), _volume(other._volume) { } ///< Copy constructor Order operator=(const Order& other) const { return Order(other); } ///< Assignment operator uint GetWeight() const { return _weight; } ///< Returns the order weight uint GetVolume() const { return _volume; } ///< Returns the order volume private: const uint _weight; const uint _volume; }; #endif // ORDER_H_
#ifndef ORDER_H_ #define ORDER_H_ /** * Represents an order with weight and volume */ class Order { public: Order(uint weight, uint volume) : _weight(weight), _volume(volume) { } ///< Constructor uint GetWeight() const { return _weight; } ///< Returns the order weight uint GetVolume() const { return _volume; } ///< Returns the order volume private: uint _weight; uint _volume; }; #endif // ORDER_H_
Fix state_to_draw_t by adding the number of possible mvts
#ifndef __GRAPHICS_H__ #define __GRAPHICS_H__ #include "models.h" typedef struct { int num_goats_to_put; int num_eaten_goats; player_turn_t turn; mvt_t input; mvt_t *possible_mvts; board_t *board; } state_to_draw_t; #endif
#ifndef __GRAPHICS_H__ #define __GRAPHICS_H__ #include "models.h" typedef struct { int num_goats_to_put; int num_eaten_goats; player_turn_t turn; mvt_t input; mvt_t *possible_mvts; size_t num_possible_mvts; board_t *board; } state_to_draw_t; #endif
Remove explicit include of packages_config in here - it is included elsewhere in all routines which use this common
C $Header$ C $Name$ #include "PACKAGES_CONFIG.h" c Alternate grid Mapping Common c ------------------------------ #ifdef ALLOW_FIZHI integer nlperdyn(1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nr,nSx,Nsy) _RL dpphys0(1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nrphys,nSx,nSy) _RL dpphys(1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nrphys,nSx,nSy) _RL dxfalt,dyfalt,drfalt common /gridalt_mapping/ nlperdyn,dpphys0,dpphys, . dxfalt,dyfalt,drfalt #endif
C $Header$ C $Name$ c Alternate grid Mapping Common c ------------------------------ #ifdef ALLOW_FIZHI integer nlperdyn(1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nr,nSx,Nsy) _RL dpphys0(1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nrphys,nSx,nSy) _RL dpphys(1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nrphys,nSx,nSy) _RL dxfalt,dyfalt,drfalt common /gridalt_mapping/ nlperdyn,dpphys0,dpphys, . dxfalt,dyfalt,drfalt #endif
Fix DEBUG_HIGHMEM build break from d4515646699
#ifndef _ASM_POWERPC_KMAP_TYPES_H #define _ASM_POWERPC_KMAP_TYPES_H #ifdef __KERNEL__ /* * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version * 2 of the License, or (at your option) any later version. */ enum km_type { KM_BOUNCE_READ, KM_SKB_SUNRPC_DATA, KM_SKB_DATA_SOFTIRQ, KM_USER0, KM_USER1, KM_BIO_SRC_IRQ, KM_BIO_DST_IRQ, KM_PTE0, KM_PTE1, KM_IRQ0, KM_IRQ1, KM_SOFTIRQ0, KM_SOFTIRQ1, KM_PPC_SYNC_PAGE, KM_PPC_SYNC_ICACHE, KM_TYPE_NR }; #endif /* __KERNEL__ */ #endif /* _ASM_POWERPC_KMAP_TYPES_H */
#ifndef _ASM_POWERPC_KMAP_TYPES_H #define _ASM_POWERPC_KMAP_TYPES_H #ifdef __KERNEL__ /* * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version * 2 of the License, or (at your option) any later version. */ enum km_type { KM_BOUNCE_READ, KM_SKB_SUNRPC_DATA, KM_SKB_DATA_SOFTIRQ, KM_USER0, KM_USER1, KM_BIO_SRC_IRQ, KM_BIO_DST_IRQ, KM_PTE0, KM_PTE1, KM_IRQ0, KM_IRQ1, KM_SOFTIRQ0, KM_SOFTIRQ1, KM_PPC_SYNC_PAGE, KM_PPC_SYNC_ICACHE, KM_TYPE_NR }; /* * This is a temporary build fix that (so they say on lkml....) should no longer * be required after 2.6.33, because of changes planned to the kmap code. * Let's try to remove this cruft then. */ #ifdef CONFIG_DEBUG_HIGHMEM #define KM_NMI (-1) #define KM_NMI_PTE (-1) #define KM_IRQ_PTE (-1) #endif #endif /* __KERNEL__ */ #endif /* _ASM_POWERPC_KMAP_TYPES_H */
Make iPhone simulator build binary compatible between 3.x and 4.x
/* #if defined(__APPLE__) && !(defined(__DARWIN_ONLY_64_BIT_INO_T) && ___DARWIN_ONLY_64_BIT_INO_T) #define __DARWIN_ONLY_64_BIT_INO_T 1 #endif */ #include <sys/stat.h>
#if defined(__APPLE__) && !defined(__arm__) && !defined(__IPHONE_4_0) /* Simulator 3.2 or less */ #define RHO_IPHONE_SIMULATOR_3 #endif #ifdef RHO_IPHONE_SIMULATOR_3 #ifdef stat #undef stat #endif #ifdef lstat #undef lstat #endif #ifdef fstat #undef fstat #endif #endif #include <sys/stat.h> #ifdef RHO_IPHONE_SIMULATOR_3 /* * map stat functions and structure to theirs 64-bit analogues to be binary * compatible with iPhone 4 x86/x86_64 application - in iPhone 4 SDK stat * become 64-bit only so enabling such mapping we could run applications built * with 3.x SDK on iPhone 4 simulator * This is not required for iPhone devices - there stat was always 64-bit. */ #define stat stat64 #define lstat lstat64 #define fstat fstat64 #endif
Handle the 'X-Forwarded-For' HTTP header if present
/*****************************************************************************/ /* */ /* Telize 2.0.0 */ /* Copyright (c) 2013-2018, Frederic Cambus */ /* https://www.telize.com */ /* */ /* Created: 2013-08-15 */ /* Last Updated: 2018-10-04 */ /* */ /* Telize is released under the BSD 2-Clause license. */ /* See LICENSE file for details. */ /* */ /*****************************************************************************/ #include <sys/socket.h> #include <kore/kore.h> #include <kore/http.h> int ip(struct http_request *); int ip(struct http_request *req) { char addr[INET6_ADDRSTRLEN]; if (req->owner->addrtype == AF_INET) { inet_ntop(req->owner->addrtype, &(req->owner->addr.ipv4.sin_addr), addr, sizeof(addr)); } else { inet_ntop(req->owner->addrtype, &(req->owner->addr.ipv6.sin6_addr), addr, sizeof(addr)); } http_response(req, 200, addr, strlen(addr)); return (KORE_RESULT_OK); }
/*****************************************************************************/ /* */ /* Telize 2.0.0 */ /* Copyright (c) 2013-2018, Frederic Cambus */ /* https://www.telize.com */ /* */ /* Created: 2013-08-15 */ /* Last Updated: 2018-10-04 */ /* */ /* Telize is released under the BSD 2-Clause license. */ /* See LICENSE file for details. */ /* */ /*****************************************************************************/ #include <sys/socket.h> #include <kore/kore.h> #include <kore/http.h> int ip(struct http_request *); int ip(struct http_request *req) { const char *visitor_ip; char *ip, addr[INET6_ADDRSTRLEN]; if (req->owner->addrtype == AF_INET) { inet_ntop(req->owner->addrtype, &(req->owner->addr.ipv4.sin_addr), addr, sizeof(addr)); } else { inet_ntop(req->owner->addrtype, &(req->owner->addr.ipv6.sin6_addr), addr, sizeof(addr)); } if (http_request_header(req, "X-Forwarded-For", &visitor_ip)) { ip = kore_strdup(visitor_ip); } else { ip = addr; } http_response(req, 200, ip, strlen(ip)); return (KORE_RESULT_OK); }
Add a testcase to ensure that ctor/dtor attributes work in C
#include <stdio.h> void ctor() __attribute__((constructor)); void ctor() { printf("Create!\n"); } void dtor() __attribute__((destructor)); void dtor() { printf("Create!\n"); } int main() { return 0; }
Use = delete for deleted members.
#ifndef COMMON_INCLUDED #define COMMON_INCLUDED #pragma once #define _WIN32_WINNT _WIN32_WINNT_WINXP #define NOMINMAX #include <Windows.h> #define at_scope_exit(cb) auto CONCAT(scope_exit_, __COUNTER__) = make_scope_guard(cb); #define CONCAT(a, b) CONCAT2(a, b) #define CONCAT2(a, b) a ## b template <class Callback> class scope_guard { public: scope_guard(Callback cb) : cb(cb), valid(true) { } scope_guard(scope_guard&& other) : cb(std::move(other.cb)), valid(std::move(other.valid)) { other.valid = false; } scope_guard& operator = (scope_guard&& other) { cb = std::move(other.cb); valid = std::move(other.valid); other.valid = false; return *this; } ~scope_guard() { if (valid) cb(); } private: scope_guard(const scope_guard& other); scope_guard& operator = (const scope_guard& other); private: Callback cb; bool valid; }; template <class Callback> scope_guard<Callback> make_scope_guard(Callback cb) { return scope_guard<Callback>(cb); } extern HINSTANCE DllInstance; #endif
#ifndef COMMON_INCLUDED #define COMMON_INCLUDED #pragma once #define _WIN32_WINNT _WIN32_WINNT_WINXP #define NOMINMAX #include <Windows.h> #define at_scope_exit(cb) auto CONCAT(scope_exit_, __COUNTER__) = make_scope_guard(cb); #define CONCAT(a, b) CONCAT2(a, b) #define CONCAT2(a, b) a ## b template <class Callback> class scope_guard { public: scope_guard(Callback cb) : cb(cb), valid(true) { } scope_guard(const scope_guard& other) = delete; scope_guard& operator = (const scope_guard& other) = delete; scope_guard(scope_guard&& other) : cb(std::move(other.cb)), valid(std::move(other.valid)) { other.valid = false; } scope_guard& operator = (scope_guard&& other) { cb = std::move(other.cb); valid = std::move(other.valid); other.valid = false; return *this; } ~scope_guard() { if (valid) cb(); } private: Callback cb; bool valid; }; template <class Callback> scope_guard<Callback> make_scope_guard(Callback cb) { return scope_guard<Callback>(cb); } extern HINSTANCE DllInstance; #endif
Add a copyright to this file
#include "vqueue.h" #define ITER_DONE(iter) (iter->buf == iter->end ? hpk_done : hpk_more) struct dynhdr { struct hpk_hdr header; VTAILQ_ENTRY(dynhdr) list; }; VTAILQ_HEAD(dynamic_table,dynhdr); struct hpk_iter { struct hpk_ctx *ctx; char *orig; char *buf; char *end; }; const struct txt * tbl_get_key(const struct hpk_ctx *ctx, uint32_t index); const struct txt * tbl_get_value(const struct hpk_ctx *ctx, uint32_t index); void push_header (struct hpk_ctx *ctx, const struct hpk_hdr *h);
/*- * Copyright (c) 2008-2016 Varnish Software AS * All rights reserved. * * Author: Guillaume Quintard <guillaume.quintard@gmail.com> * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. */ #include "vqueue.h" #define ITER_DONE(iter) (iter->buf == iter->end ? hpk_done : hpk_more) struct dynhdr { struct hpk_hdr header; VTAILQ_ENTRY(dynhdr) list; }; VTAILQ_HEAD(dynamic_table,dynhdr); struct hpk_iter { struct hpk_ctx *ctx; char *orig; char *buf; char *end; }; const struct txt * tbl_get_key(const struct hpk_ctx *ctx, uint32_t index); const struct txt * tbl_get_value(const struct hpk_ctx *ctx, uint32_t index); void push_header (struct hpk_ctx *ctx, const struct hpk_hdr *h);
Add more flags for mmap() to ignore.
/* * Copyright (C) 2014, Galois, Inc. * This sotware is distributed under a standard, three-clause BSD license. * Please see the file LICENSE, distributed with this software, for specific * terms and conditions. */ #ifndef MINLIBC_MMAN_H #define MINLIBC_MMAN_H #include <sys/types.h> #define PROT_NONE 0x0 #define PROT_READ 0x1 #define PROT_WRITE 0x2 #define PROT_EXEC 0x4 #define PROT_NOCACHE 0x8 #define PROT_READWRITE (PROT_READ | PROT_WRITE) #define MAP_ANON 0x20 #define MAP_ANONYMOUS 0x20 #define MAP_PRIVATE 0x02 #define MAP_FAILED ((void *) -1) void *mmap(void *start, size_t length, int prot, int flags, int fd, off_t off); int munmap(void *start, size_t length); void *mremap(void *old_address, size_t old_size, size_t new_size, int flags); int mprotect(void *addr, size_t len, int prot); #endif
/* * Copyright (C) 2014, Galois, Inc. * This sotware is distributed under a standard, three-clause BSD license. * Please see the file LICENSE, distributed with this software, for specific * terms and conditions. */ #ifndef MINLIBC_MMAN_H #define MINLIBC_MMAN_H #include <sys/types.h> #define PROT_NONE 0x0 #define PROT_READ 0x1 #define PROT_WRITE 0x2 #define PROT_EXEC 0x4 #define PROT_NOCACHE 0x8 #define PROT_READWRITE (PROT_READ | PROT_WRITE) #define MAP_SHARED 0x01 #define MAP_PRIVATE 0x02 #define MAP_FIXED 0x10 #define MAP_ANON 0x20 #define MAP_ANONYMOUS 0x20 #define MAP_FAILED ((void *) -1) #define MS_ASYNC 1 #define MS_INVALIDATE 2 #define MS_SYNC 4 #define MADV_NORMAL 0 #define MADV_RANDOM 1 #define MADV_SEQUENTIAL 2 #define MADV_WILLNEED 3 #define MADV_DONTNEED 4 void *mmap(void *start, size_t length, int prot, int flags, int fd, off_t off); int munmap(void *start, size_t length); void *mremap(void *old_address, size_t old_size, size_t new_size, int flags); int mprotect(void *addr, size_t len, int prot); #endif
Implement operator<< with template method
// ============================================================================= // Licensed under the MIT License <http://opensource.org/licenses/MIT>. // Copyright (c) 2017 Kevin T Qi // // 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. // ============================================================================= #pragma once #include "LoggerSink.h" #include <memory> #include <sstream> #include <string> #include <atomic> namespace slogger { class LoggerStreamFlush { public: static const LoggerStreamFlush &end() { static LoggerStreamFlush instance; return instance; } }; class LoggerStream; typedef std::shared_ptr<LoggerStream> LoggerStreamPtr; class LoggerStream { private: std::stringstream mLogStream; ILoggerSinkPtr mSink; std::atomic<bool> mInUse; template<typename T> friend LoggerStreamPtr &operator<<(LoggerStreamPtr &logStrm, const T &value); friend LoggerStreamPtr &operator<<(LoggerStreamPtr &logStrm, const LoggerStreamFlush &el); void flush() { if (mSink) { mLogStream << std::endl; mSink->flush(mLogStream.str()); mLogStream.clear(); mLogStream.str(""); mInUse = false; } } public: LoggerStream(ILoggerSinkPtr sink = nullptr) : mSink(sink), mInUse(false) { } ~LoggerStream() { mInUse = false; } bool inUse() { return mInUse; } }; template<typename T> inline LoggerStreamPtr &operator<<(LoggerStreamPtr &logStrm, const T &value) { if (logStrm && logStrm->mSink) { logStrm->mInUse = true; logStrm->mLogStream << value; } return logStrm; } inline LoggerStreamPtr &operator<<(LoggerStreamPtr &logStrm, const LoggerStreamFlush &el) { if (logStrm && logStrm->mSink) { logStrm->flush(); } return logStrm; } } /* namespace slogger */
Add the RUN: prefix to the start of the run line so this test doesn't fail. BTW .. isn't the date on this funky? We haven't reachec 2005-05-09 yet???
// %llvmgcc %s -S -o - #include <math.h> #define I 1.0iF double __complex test(double X) { return ~-(X*I); } _Bool EQ(double __complex A, double __complex B) { return A == B; } _Bool NE(double __complex A, double __complex B) { return A != B; }
// RUN: %llvmgcc %s -S -o - #include <math.h> #define I 1.0iF double __complex test(double X) { return ~-(X*I); } _Bool EQ(double __complex A, double __complex B) { return A == B; } _Bool NE(double __complex A, double __complex B) { return A != B; }
Make TRACE depend on DEBUG.
#ifndef _TRACE_H_ #define _TRACE_H_ #include <stdio.h> #include <errno.h> #define TRACE ERROR #define ERROR(fmt,arg...) \ fprintf(stderr, "%s: "fmt, program_invocation_short_name, ##arg) #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 #define TRACE(fmt,arg...) ((void) 0) #endif #define ERROR(fmt,arg...) \ fprintf(stderr, "%s: "fmt, program_invocation_short_name, ##arg) #define FATAL(fmt,arg...) do { \ ERROR(fmt, ##arg); \ exit(1); \ } while (0) #endif
Add problematic example with missed must deadlock
// PARAM: --set ana.activated[+] deadlock --set ana.activated[+] threadJoins #include <pthread.h> int x; pthread_mutex_t m1 = PTHREAD_MUTEX_INITIALIZER; pthread_mutex_t m2 = PTHREAD_MUTEX_INITIALIZER; pthread_mutex_t m3 = PTHREAD_MUTEX_INITIALIZER; pthread_mutex_t m4 = PTHREAD_MUTEX_INITIALIZER; pthread_mutex_t m5 = PTHREAD_MUTEX_INITIALIZER; void *thread() { pthread_mutex_lock(&m2); pthread_mutex_lock(&m1); // We forgot to unlock // pthread_mutex_unlock(&m2); pthread_mutex_unlock(&m1); return NULL; } void *noOpThread() { return NULL; } int main() { pthread_t tid1; pthread_t tid2; pthread_create(&tid1, NULL, noOpThread, NULL); pthread_create(&tid2, NULL, thread, NULL); pthread_join(tid2,NULL); pthread_mutex_lock(&m2); //DEADLOCK return 0; }
Add parameters to a test
void change(int *p) { (*p)++; } int a; int main() { a = 5; int *p = &a; change(p); assert(a - 6 == 0); return 0; }
// PARAM: --sets solver td3 --set ana.activated "['base','threadid','threadflag','mallocWrapper','octApron']" void change(int *p) { (*p)++; } int a; int main() { a = 5; int *p = &a; change(p); assert(a - 6 == 0); return 0; }
Add enum constant TrackCollide::ALL with a value 0xFFFF.
// ============================================================================= // PROJECT CHRONO - http://projectchrono.org // // Copyright (c) 2014 projectchrono.org // All right reserved. // // Use of this source code is governed by a BSD-style license that can be found // in the LICENSE file at the top level of the distribution and at // http://projectchrono.org/license-chrono.txt. // // ============================================================================= // Authors: Radu Serban // ============================================================================= // // Various utility classes for tracked vehicle subsystems. // // TODO: combine with ChSubsysDefs.h // // ============================================================================= #ifndef CH_TRACK_SUBSYS_DEFS_H #define CH_TRACK_SUBSYS_DEFS_H namespace chrono { namespace vehicle { namespace TrackCollide { enum Enum { NONE = 0, SPROCKET_LEFT = 1 << 0, SPROCKET_RIGHT = 1 << 1, IDLER_LEFT = 1 << 2, IDLER_RIGHT = 1 << 3, WHEELS_LEFT = 1 << 4, WHEELS_RIGHT = 1 << 5, SHOES_LEFT = 1 << 6, SHOES_RIGHT = 1 << 7 }; } namespace TrackCollisionFamily { enum Enum { CHASSIS, IDLERS, WHEELS, SHOES }; } } // end namespace vehicle } // end namespace chrono #endif
// ============================================================================= // PROJECT CHRONO - http://projectchrono.org // // Copyright (c) 2014 projectchrono.org // All right reserved. // // Use of this source code is governed by a BSD-style license that can be found // in the LICENSE file at the top level of the distribution and at // http://projectchrono.org/license-chrono.txt. // // ============================================================================= // Authors: Radu Serban // ============================================================================= // // Various utility classes for tracked vehicle subsystems. // // TODO: combine with ChSubsysDefs.h // // ============================================================================= #ifndef CH_TRACK_SUBSYS_DEFS_H #define CH_TRACK_SUBSYS_DEFS_H namespace chrono { namespace vehicle { namespace TrackCollide { enum Enum { NONE = 0, SPROCKET_LEFT = 1 << 0, SPROCKET_RIGHT = 1 << 1, IDLER_LEFT = 1 << 2, IDLER_RIGHT = 1 << 3, WHEELS_LEFT = 1 << 4, WHEELS_RIGHT = 1 << 5, SHOES_LEFT = 1 << 6, SHOES_RIGHT = 1 << 7, ALL = 0xFFFF }; } namespace TrackCollisionFamily { enum Enum { CHASSIS, IDLERS, WHEELS, SHOES }; } } // end namespace vehicle } // end namespace chrono #endif
Fix warnings and reorganize file.
// // PKMacros.h // PKToolBox // // Created by Pavel Kunc on 17/07/2013. // Copyright (c) 2013 PKToolBox. All rights reserved. // #define PK_NIL_IF_NULL(obj) ((obj == [NSNull null]) ? nil : obj) #define PK_NULL_IF_NIL(obj) ((obj == nil) ? [NSNull null] : obj) #define PK_BOOL_TO_LOCALIZED_STRING(val) ((val == YES) ? NSLocalizedString(@"Yes", nil) : NSLocalizedString(@"No", nil)) #define PK_IS_WIDESCREEN ( fabs( ( double )[ [ UIScreen mainScreen ] bounds ].size.height - ( double )568 ) < DBL_EPSILON ) #define PK_IS_IPHONE ( UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone ) #define PK_IS_IPHONE_5 ( PK_IS_IPHONE && PK_IS_WIDESCREEN ) #define PK_IS_IOS7 ( floor(NSFoundationVersionNumber) > NSFoundationVersionNumber_iOS_6_1 )
// // PKMacros.h // PKToolBox // // Created by Pavel Kunc on 17/07/2013. // Copyright (c) 2013 PKToolBox. All rights reserved. // #pragma mark - Foundation #define PK_NIL_IF_NULL(obj) ((obj == (id)[NSNull null]) ? nil : obj) #define PK_NULL_IF_NIL(obj) ((obj == nil) ? [NSNull null] : obj) #define PK_DEFAULT_IF_NIL(obj,default) ((obj == nil) ? default : obj) #define PK_BOOL_TO_LOCALIZED_STRING(val) ((val == YES) ? NSLocalizedString(@"Yes", nil) : NSLocalizedString(@"No", nil)) #define PK_DEGREES_TO_RADIANS(degrees) ( degrees * (M_PI / 180.0) ) #define PK_RADIANS_TO_DEGREES(radians) ( radians * (180.0 / M_PI) ) #pragma mark - UI related #define PK_IS_WIDESCREEN ( fabs( ( double )[ [ UIScreen mainScreen ] bounds ].size.height - ( double )568 ) < DBL_EPSILON ) #define PK_IS_IPHONE ( UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone ) #define PK_IS_IPHONE_5 ( PK_IS_IPHONE && PK_IS_WIDESCREEN ) #define PK_IS_IOS7 ( floor(NSFoundationVersionNumber) > NSFoundationVersionNumber_iOS_6_1 )
Change comment into descriptive variable name
#include <math.h> #include "lua5.2/lua.h" #include "lua5.2/lauxlib.h" // Functions exposed to Lua static int l_sin(lua_State *L) { // Verify that the argument is a number double d = luaL_checknumber(L, 1); // Call the function, and return the result lua_pushnumber(L, sin(d)); return 1; // Single result } static int l_cos(lua_State *L) { double d = luaL_checknumber(L, 1); lua_pushnumber(L, cos(d)); return 1; } static int l_tan(lua_State *L) { double d = luaL_checknumber(L, 1); lua_pushnumber(L, tan(d)); return 1; } int main() { // Setup Lua lua_State *L = luaL_newstate(); luaL_openlibs(L); // Expose the functions to Lua lua_pushcfunction(L, l_sin); lua_setglobal(L, "lsin"); lua_pushcfunction(L, l_cos); lua_setglobal(L, "lcos"); lua_pushcfunction(L, l_tan); lua_setglobal(L, "ltan"); // Load and run the debug file luaL_dofile(L, "debug.lua"); printf("Done\n"); return 0; }
#include <math.h> #include "lua5.2/lua.h" #include "lua5.2/lauxlib.h" // Functions exposed to Lua static int l_sin(lua_State *L) { double value_as_number = luaL_checknumber(L, 1); // Call the function, and return the result lua_pushnumber(L, sin(value_as_number)); return 1; // Single result } static int l_cos(lua_State *L) { double value_as_number = luaL_checknumber(L, 1); lua_pushnumber(L, cos(value_as_number)); return 1; } static int l_tan(lua_State *L) { double value_as_number = luaL_checknumber(L, 1); lua_pushnumber(L, tan(value_as_number)); return 1; } int main() { // Setup Lua lua_State *L = luaL_newstate(); luaL_openlibs(L); // Expose the functions to Lua lua_pushcfunction(L, l_sin); lua_setglobal(L, "lsin"); lua_pushcfunction(L, l_cos); lua_setglobal(L, "lcos"); lua_pushcfunction(L, l_tan); lua_setglobal(L, "ltan"); // Load and run the debug file luaL_dofile(L, "debug.lua"); puts("Done"); return 0; }
Add new header file. (or: xcode is stupid)
// // BDSKSearchGroupViewController.h // Bibdesk // // Created by Christiaan Hofman on 1/2/07. /* This software is Copyright (c) 2007 Christiaan Hofman. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: - Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. - Neither the name of Christiaan Hofman nor the names of any contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #import <Cocoa/Cocoa.h> @class BDSKCollapsibleView, BDSKEdgeView, BDSKSearchGroup; @interface BDSKSearchGroupViewController : NSWindowController { IBOutlet BDSKCollapsibleView *view; IBOutlet BDSKEdgeView *edgeView; IBOutlet NSSearchField *searchField; IBOutlet NSButton *searchButton; BDSKSearchGroup *group; } - (NSView *)view; - (BDSKSearchGroup *)group; - (void)setGroup:(BDSKSearchGroup *)newGroup; - (IBAction)changeSearchTerm:(id)sender; - (IBAction)nextSearch:(id)sender; @end
Add missing Yoga headers to umbrella header.
// // Portal.h // Portal // // Created by Guido Marucci Blas on 3/14/17. // Copyright © 2017 Guido Marucci Blas. All rights reserved. // #import <UIKit/UIKit.h> //! Project version number for Portal. FOUNDATION_EXPORT double PortalVersionNumber; //! Project version string for Portal. FOUNDATION_EXPORT const unsigned char PortalVersionString[]; // In this header, you should import all the public headers of your framework using statements like #import <Portal/PublicHeader.h> #import <Portal/YGLayout.h> #import <Portal/UIView+Yoga.h>
// // Portal.h // Portal // // Created by Guido Marucci Blas on 3/14/17. // Copyright © 2017 Guido Marucci Blas. All rights reserved. // #import <UIKit/UIKit.h> //! Project version number for Portal. FOUNDATION_EXPORT double PortalVersionNumber; //! Project version string for Portal. FOUNDATION_EXPORT const unsigned char PortalVersionString[]; // In this header, you should import all the public headers of your framework using statements like #import <Portal/PublicHeader.h> #import <Portal/Yoga.h> #import <Portal/YGNodeList.h> #import <Portal/YGLayout.h> #import <Portal/UIView+Yoga.h>
Fix last-minute certificate subject changes
#include <mongoc.h> #include "mongoc-ssl-private.h" #include "TestSuite.h" #ifdef MONGOC_ENABLE_OPENSSL static void test_extract_subject (void) { char *subject; subject = mongoc_ssl_extract_subject (CERT_SERVER, NULL); ASSERT_CMPSTR (subject, "C=IS,ST=Reykjavik,L=Reykjavik,O=MongoDB,OU=Drivers,CN=server"); bson_free (subject); subject = mongoc_ssl_extract_subject (CERT_CLIENT, NULL); ASSERT_CMPSTR (subject, "C=IS,ST=Kopavogur,L=Kopavogur,O=MongoDB,OU=Drivers,CN=client"); bson_free (subject); } #endif void test_x509_install (TestSuite *suite) { #ifdef MONGOC_ENABLE_OPENSSL TestSuite_Add (suite, "/X509/extract_subject", test_extract_subject); #endif }
#include <mongoc.h> #include "mongoc-ssl-private.h" #include "TestSuite.h" #ifdef MONGOC_ENABLE_OPENSSL static void test_extract_subject (void) { char *subject; subject = mongoc_ssl_extract_subject (CERT_SERVER, NULL); ASSERT_CMPSTR (subject, "C=US,ST=California,L=Palo Alto,O=MongoDB,OU=Drivers,CN=server"); bson_free (subject); subject = mongoc_ssl_extract_subject (CERT_CLIENT, NULL); ASSERT_CMPSTR (subject, "C=NO,ST=Oslo,L=Oslo,O=MongoDB,OU=Drivers,CN=client"); bson_free (subject); } #endif void test_x509_install (TestSuite *suite) { #ifdef MONGOC_ENABLE_OPENSSL TestSuite_Add (suite, "/X509/extract_subject", test_extract_subject); #endif }
Rename printBinary function and write to string instead
#include <stdio.h> #include <string.h> #include <math.h> struct Packet { unsigned int status: 1; unsigned int group: 2; unsigned int plug: 2; }; unsigned int packet_to_binary(struct Packet packet) { unsigned int binary = (packet.status << 7); binary |= ((packet.group & 0x3) << 2); binary |= (packet.plug & 0x3); return binary & 0xFF; } void binary_to_packet(struct Packet *packet, unsigned int binary) { packet->status = (binary >> 7); packet->group = (binary >> 2) & 0x3; packet->plug = binary & 0x3; } void printBinary(int num, int digits) { int shift = digits - 1; int current = pow(2, shift); while (current > 0) { printf("%d", ((num & current) >> shift) & 1); shift--; current /= 2; } printf("\n"); }
#include <stdio.h> #include <string.h> #include <math.h> struct Packet { unsigned int status: 1; unsigned int group: 2; unsigned int plug: 2; }; unsigned int packet_to_binary(struct Packet packet) { unsigned int binary = (packet.status << 7); binary |= ((packet.group & 0x3) << 2); binary |= (packet.plug & 0x3); return binary & 0xFF; } void binary_to_packet(struct Packet *packet, unsigned int binary) { packet->status = (binary >> 7); packet->group = (binary >> 2) & 0x3; packet->plug = binary & 0x3; } void btoa(int num, char *buf, int digits) { int shift = digits - 1; int current = pow(2, shift); char digit[2]; while (current > 0) { sprintf(digit, "%d", ((num & current) >> shift) & 1); strncat(buf, digit, 1); shift--; current /= 2; } strcat(buf, "\0"); }
Fix compile error with missing function declare
/** * @class Client * @brief Factor class for being able to generate connections * * This class will create connections using the common interface ClientBase * which is based on connections strings. The connections should be completly * abstracted from the parent classes other than this entry point. */ class Client { public: static ClientBase *Create(const std::string &ConnectionString); static ClientBase *CreateUnix(const std::string &ConnectionString); static ClientBase *CreateTcp(const std::string &ConnectionString); };
/** * @class Client * @brief Factor class for being able to generate connections * * This class will create connections using the common interface ClientBase * which is based on connections strings. The connections should be completly * abstracted from the parent classes other than this entry point. */ class Client { public: static ClientBase *Create(const std::string &ConnectionString); static ClientBase *CreateUnix(const std::string &ConnectionString); static ClientBase *CreateUnixSelected(const std::string &ConnectionString); static ClientBase *CreateTcp(const std::string &ConnectionString); };
Remove a warning from NBDS.
/* * Written by Josh Dybnis and released to the public domain, as explained at * http://creativecommons.org/licenses/publicdomain */ #ifndef MEM_H #define MEM_H void *nbd_malloc (size_t n) __attribute__((malloc, alloc_size(1))); void nbd_free (void *x) __attribute__((nonnull)); #endif//MEM_H
/* * Written by Josh Dybnis and released to the public domain, as explained at * http://creativecommons.org/licenses/publicdomain */ #ifndef MEM_H #define MEM_H void *nbd_malloc (size_t n) __attribute__((malloc)); void nbd_free (void *x) __attribute__((nonnull)); #endif//MEM_H
Modify KernelGlobal structure; decrease TASK_STACK_SIZE
#ifndef __KERNEL_H__ #define __KERNEL_H__ #include <task.h> typedef struct kernel_global { TaskList *task_list; } KernelGlobal; #define TASK_MAX 30 #define TASK_STACK_SIZE 1000 #define TASK_PRIORITY_MAX 10 #define SWI_ENTRY_POINT 0x28 #define DATA_REGION_BASE 0x218000 #define CPU_MODE_USER 0x10 #define CPU_MODE_SVC 0x13 #define CPU_MODE_SYS 0x1f #endif // __KERNEL_H__
#ifndef __KERNEL_H__ #define __KERNEL_H__ #include <task.h> typedef struct kernel_global { TaskList *tlist; FreeList *flist; } KernelGlobal; #define TASK_MAX 30 #define TASK_STACK_SIZE 512 #define TASK_PRIORITY_MAX 10 #define SWI_ENTRY_POINT 0x28 #define DATA_REGION_BASE 0x218000 #define CPU_MODE_USER 0x10 #define CPU_MODE_SVC 0x13 #define CPU_MODE_SYS 0x1f #endif // __KERNEL_H__
Fix checked_static_cast to allow null pointers.
// For conditions of distribution and use, see copyright notice in license.txt #ifndef incl_CoreDefines_h #define incl_CoreDefines_h // useful defines #define SAFE_DELETE(p) { delete p; p=0; } #define SAFE_DELETE_ARRAY(p) { delete [] p; p=0; } #define NUMELEMS(x) (sizeof(x)/sizeof(x[0])) /// Use this template to downcast from a base class to a derived class when you know by static code analysis what the derived /// type has to be and don't want to pay the runtime performance incurred by dynamic_casting. In debug mode, the proper /// derived type will be assert()ed, but in release mode this be just the same as using static_cast. /// Repeating to make a note: In RELEASE mode, checked_static_cast == static_cast. It is *NOT* a substitute to use in places /// where you really need a dynamic_cast. template<typename Dst, typename Src> inline Dst checked_static_cast(Src src) { assert(dynamic_cast<Dst>(src) != 0); return static_cast<Dst>(src); } //! use to suppress warning C4101 (unreferenced local variable) #define UNREFERENCED_PARAM(P) (P) /// Use for QObjects #define SAFE_DELETE_LATER(p) { if ((p)) (p)->deleteLater(); (p) = 0; } #endif
// For conditions of distribution and use, see copyright notice in license.txt #ifndef incl_CoreDefines_h #define incl_CoreDefines_h // useful defines #define SAFE_DELETE(p) { delete p; p=0; } #define SAFE_DELETE_ARRAY(p) { delete [] p; p=0; } #define NUMELEMS(x) (sizeof(x)/sizeof(x[0])) /// Use this template to downcast from a base class to a derived class when you know by static code analysis what the derived /// type has to be and don't want to pay the runtime performance incurred by dynamic_casting. In debug mode, the proper /// derived type will be assert()ed, but in release mode this be just the same as using static_cast. /// Repeating to make a note: In RELEASE mode, checked_static_cast == static_cast. It is *NOT* a substitute to use in places /// where you really need a dynamic_cast. template<typename Dst, typename Src> inline Dst checked_static_cast(Src src) { assert(src == 0 || dynamic_cast<Dst>(src) != 0); return static_cast<Dst>(src); } //! use to suppress warning C4101 (unreferenced local variable) #define UNREFERENCED_PARAM(P) (P) /// Use for QObjects #define SAFE_DELETE_LATER(p) { if ((p)) (p)->deleteLater(); (p) = 0; } #endif
Fix PARENT_SKILLS declaration; remove NOSKILL
#ifndef SKILLCOMPONENT_H_ #define SKILLCOMPONENT_H_ /** * Data structure to represent an Entity's skill. */ typedef struct { int ranks; ///< Current ranks in the skill int xp; ///< Amount of XP earned towards next rank } SkillComponent; /** * Enumeration for identifying different skills. */ enum skill_t { NOSKILL, Melee, Swords, BastardSword, Maces, SpikedMace, FirstAid }; /** * This array defines our parent skill relationships. * * If a skill's parent is NOSKILL, it has no parent. */ const skill_t* PARENT_SKILLS = { NOSKILL, NOSKILL, Melee, Swords, Melee, Maces, NOSKILL }; #endif
#ifndef SKILLCOMPONENT_H_ #define SKILLCOMPONENT_H_ /** * Data structure to represent an Entity's skill. */ typedef struct { int ranks; ///< Current ranks in the skill int xp; ///< Amount of XP earned towards next rank } SkillComponent; /** * Enumeration for identifying different skills. */ enum skill_t { Melee, Swords, BastardSword, Maces, SpikedMace, FirstAid }; /** * This array defines our parent skill relationships. * * If a skill's parent is itself, it has no parent. */ const skill_t PARENT_SKILLS[] = { Melee, Melee, Swords, Melee, Maces, FirstAid }; #endif
Call ia64_make_proc_info() to ensure that the proc_info is valid.
/* libunwind - a platform-independent unwind library Copyright (C) 2002 Hewlett-Packard Co Contributed by David Mosberger-Tang <davidm@hpl.hp.com> This file is part of libunwind. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "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. */ #include "unwind_i.h" int unw_get_proc_info (unw_cursor_t *cursor, unw_proc_info_t *pi) { struct ia64_cursor *c = (struct ia64_cursor *) cursor; int ret; if ((ret = ia64_make_proc_info (c)) < 0) return ret; *pi = c->pi; return 0; }
Fix the black devtools view.
// Copyright (c) 2013 GitHub, Inc. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef ATOM_BROWSER_UI_ATOM_EVENT_PROCESSING_WINDOW_H_ #define ATOM_BROWSER_UI_ATOM_EVENT_PROCESSING_WINDOW_H_ #import <Cocoa/Cocoa.h> // Override NSWindow to access unhandled keyboard events (for command // processing); subclassing NSWindow is the only method to do // this. @interface AtomEventProcessingWindow : NSWindow { @private BOOL redispatchingEvent_; BOOL eventHandled_; } // Sends a key event to |NSApp sendEvent:|, but also makes sure that it's not // short-circuited to the RWHV. This is used to send keyboard events to the menu // and the cmd-` handler if a keyboard event comes back unhandled from the // renderer. The event must be of type |NSKeyDown|, |NSKeyUp|, or // |NSFlagsChanged|. // Returns |YES| if |event| has been handled. - (BOOL)redispatchKeyEvent:(NSEvent*)event; - (BOOL)performKeyEquivalent:(NSEvent*)theEvent; @end #endif // ATOM_BROWSER_UI_ATOM_EVENT_PROCESSING_WINDOW_H_
// Copyright (c) 2013 GitHub, Inc. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef ATOM_BROWSER_UI_ATOM_EVENT_PROCESSING_WINDOW_H_ #define ATOM_BROWSER_UI_ATOM_EVENT_PROCESSING_WINDOW_H_ #import <Cocoa/Cocoa.h> #import "ui/base/cocoa/underlay_opengl_hosting_window.h" // Override NSWindow to access unhandled keyboard events (for command // processing); subclassing NSWindow is the only method to do // this. @interface AtomEventProcessingWindow : UnderlayOpenGLHostingWindow { @private BOOL redispatchingEvent_; BOOL eventHandled_; } // Sends a key event to |NSApp sendEvent:|, but also makes sure that it's not // short-circuited to the RWHV. This is used to send keyboard events to the menu // and the cmd-` handler if a keyboard event comes back unhandled from the // renderer. The event must be of type |NSKeyDown|, |NSKeyUp|, or // |NSFlagsChanged|. // Returns |YES| if |event| has been handled. - (BOOL)redispatchKeyEvent:(NSEvent*)event; - (BOOL)performKeyEquivalent:(NSEvent*)theEvent; @end #endif // ATOM_BROWSER_UI_ATOM_EVENT_PROCESSING_WINDOW_H_
Revert "original structure is out of sync with github"
/* ----------------------------------------------------------------------------- This source file is part of NLRE (NonLinear Rendering Engine) For the latest info, see https://github.com/AlexandrSachkov/NonLinearRenderingEngine Copyright (c) 2014 NonLinear Rendering Engine Team 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 NLE_MATH_ #define NLE_MATH_ #ifdef _DXMATH_ #include "Math/DXMath/DXMathWrap.h" #endif #endif
Test normal (backend-)allocas inside VLA scope
// RUN: %ocheck 0 %s void abort(void); g() { return 0; } main() { int n = 5; // an unaligned value int vla[n]; vla[0] = 1; vla[1] = 2; vla[2] = 3; vla[3] = 4; { // this alloca is done in order after the vla, // but is coalesced to before the VLA by the stack logic int x = 99; if(x != 99) abort(); if(g()) return 3; // scope-leave/restore vla, but doesn't pop the vla state int y = 35; if(y != 35) abort(); // more scope leave code for(int i = 0; i < 10; i++) if(i == 5) break; if(vla[0] != 1) abort(); if(vla[1] != 2) abort(); if(vla[2] != 3) abort(); if(vla[3] != 4) abort(); if(sizeof vla != n * sizeof(int)) abort(); if(y != 35) abort(); if(x != 99) abort(); } if(vla[0] != 1) abort(); if(vla[1] != 2) abort(); if(vla[2] != 3) abort(); if(vla[3] != 4) abort(); if(sizeof vla != n * sizeof(int)) abort(); return 0; }
Refactor to fix potential buffer overflow.
#ifndef PAPER_H #define PAPER_H #include <stdbool.h> bool paper_is_start_of_first_word(char *ptr) { // Lookback and check if that is a NUL then check that we aren't // currently on a space. return (*(ptr - 1) == KATA_NUL && *ptr != KATA_SPACE); } bool paper_is_start_of_subsequent_word(char *ptr) { // Lookback and see if the prior character was a space then check that // we aren't currently on a space. return (*(ptr - 1) == KATA_SPACE && *ptr != KATA_SPACE); } size_t paper_word_count(char *paper) { size_t count = 0; char *ptr = paper; do { if (!*ptr) { break; } if ( paper_is_start_of_first_word(ptr) || paper_is_start_of_subsequent_word(ptr) ) { count += 1; } } while (*(++ptr)); return count; } #endif // PAPER_H
#ifndef PAPER_H #define PAPER_H #include <stdbool.h> bool paper_is_start_of_first_word(size_t word_count, char *ptr) { return (word_count == 0 && *ptr != KATA_SPACE); } bool paper_is_start_of_subsequent_word(char *ptr) { // Lookback and see if the prior character was a space then check that // we aren't currently on a space. return (*(ptr - 1) == KATA_SPACE && *ptr != KATA_SPACE); } size_t paper_word_count(char *paper) { size_t count = 0; char *ptr = paper; do { if (!*ptr) { break; } if ( paper_is_start_of_first_word(count, ptr) || paper_is_start_of_subsequent_word(ptr) ) { count += 1; } } while (*(++ptr)); return count; } #endif // PAPER_H
Make this pass for CYGWIN.
// RUN: %llvmgcc -O3 -S -o - -emit-llvm %s | grep extern_weak // RUN: %llvmgcc -O3 -S -o - -emit-llvm %s | llvm-as | llc #if !defined(__linux__) && !defined(__FreeBSD__) && !defined(__OpenBSD__) void foo() __attribute__((weak_import)); #else void foo() __attribute__((weak)); #endif void bar() { foo(); }
// RUN: %llvmgcc -O3 -S -o - -emit-llvm %s | grep extern_weak // RUN: %llvmgcc -O3 -S -o - -emit-llvm %s | llvm-as | llc #if !defined(__linux__) && !defined(__FreeBSD__) && \ !defined(__OpenBSD__) && !defined(__CYGWIN__) void foo() __attribute__((weak_import)); #else void foo() __attribute__((weak)); #endif void bar() { foo(); }
Remove the leading hyphen so that grep doesn't parse it as one long option :)
// RUN: clang -### %s -c -o tmp.o -Wa,--noexecstack | grep "-mnoexecstack"
// RUN: clang -### %s -c -o tmp.o -Wa,--noexecstack | grep "mnoexecstack"
Fix default value of PERCENT_SIGN_AS_MOD
// // DDMathParser.h // DDMathParser // // Created by Dave DeLong on 11/20/10. // Copyright 2010 Home. All rights reserved. // #import "DDMathEvaluator.h" #import "DDExpression.h" #import "DDParser.h" #import "DDTypes.h" #import "NSString+DDMathParsing.h" #define DDRuleTemplateAnyNumber @"__num" #define DDRuleTemplateAnyFunction @"__func" #define DDRuleTemplateAnyVariable @"__var" #define DDRuleTemplateAnyExpression @"__exp" #ifdef __clang__ #define DD_STRONG strong #else #define DD_STRONG retain #endif #if __has_feature(objc_arc) #define DD_HAS_ARC 1 #define DD_RETAIN(_o) (_o) #define DD_RELEASE(_o) #define DD_AUTORELEASE(_o) (_o) #else #define DD_HAS_ARC 0 #define DD_RETAIN(_o) [(_o) retain] #define DD_RELEASE(_o) [(_o) release] #define DD_AUTORELEASE(_o) [(_o) autorelease] #endif // change this to 0 if you want the "%" character to mean a percentage // please see the wiki for more information about what this switch means: // https://github.com/davedelong/DDMathParser/wiki #define DD_INTERPRET_PERCENT_SIGN_AS_MOD 0
// // DDMathParser.h // DDMathParser // // Created by Dave DeLong on 11/20/10. // Copyright 2010 Home. All rights reserved. // #import "DDMathEvaluator.h" #import "DDExpression.h" #import "DDParser.h" #import "DDTypes.h" #import "NSString+DDMathParsing.h" #define DDRuleTemplateAnyNumber @"__num" #define DDRuleTemplateAnyFunction @"__func" #define DDRuleTemplateAnyVariable @"__var" #define DDRuleTemplateAnyExpression @"__exp" #ifdef __clang__ #define DD_STRONG strong #else #define DD_STRONG retain #endif #if __has_feature(objc_arc) #define DD_HAS_ARC 1 #define DD_RETAIN(_o) (_o) #define DD_RELEASE(_o) #define DD_AUTORELEASE(_o) (_o) #else #define DD_HAS_ARC 0 #define DD_RETAIN(_o) [(_o) retain] #define DD_RELEASE(_o) [(_o) release] #define DD_AUTORELEASE(_o) [(_o) autorelease] #endif // change this to 0 if you want the "%" character to mean a percentage // please see the wiki for more information about what this switch means: // https://github.com/davedelong/DDMathParser/wiki #define DD_INTERPRET_PERCENT_SIGN_AS_MOD 1
Fix include guards to match new location.
//===------ utils/obj2yaml.hpp - obj2yaml conversion tool -------*- C++ -*-===// // // The LLVM Compiler Infrastructure // // This file is distributed under the University of Illinois Open Source // License. See LICENSE.TXT for details. // // This file declares some helper routines, and also the format-specific // writers. To add a new format, add the declaration here, and, in a separate // source file, implement it. //===----------------------------------------------------------------------===// #ifndef LLVM_UTILS_OBJ2YAML_H #define LLVM_UTILS_OBJ2YAML_H #include "llvm/ADT/ArrayRef.h" #include "llvm/Support/MemoryBuffer.h" #include "llvm/Support/raw_ostream.h" #include "llvm/Support/system_error.h" namespace yaml { // routines for writing YAML // Write a hex stream: // <Prefix> !hex: "<hex digits>" #|<ASCII chars>\n llvm::raw_ostream &writeHexStream (llvm::raw_ostream &Out, const llvm::ArrayRef<uint8_t> arr); // Writes a number in hex; prefix it by 0x if it is >= 10 llvm::raw_ostream &writeHexNumber (llvm::raw_ostream &Out, unsigned long long N); } llvm::error_code coff2yaml(llvm::raw_ostream &Out, llvm::MemoryBuffer *TheObj); #endif
//===------ utils/obj2yaml.hpp - obj2yaml conversion tool -------*- C++ -*-===// // // The LLVM Compiler Infrastructure // // This file is distributed under the University of Illinois Open Source // License. See LICENSE.TXT for details. // // This file declares some helper routines, and also the format-specific // writers. To add a new format, add the declaration here, and, in a separate // source file, implement it. //===----------------------------------------------------------------------===// #ifndef LLVM_TOOLS_OBJ2YAML_H #define LLVM_TOOLS_OBJ2YAML_H #include "llvm/ADT/ArrayRef.h" #include "llvm/Support/MemoryBuffer.h" #include "llvm/Support/raw_ostream.h" #include "llvm/Support/system_error.h" namespace yaml { // routines for writing YAML // Write a hex stream: // <Prefix> !hex: "<hex digits>" #|<ASCII chars>\n llvm::raw_ostream &writeHexStream (llvm::raw_ostream &Out, const llvm::ArrayRef<uint8_t> arr); // Writes a number in hex; prefix it by 0x if it is >= 10 llvm::raw_ostream &writeHexNumber (llvm::raw_ostream &Out, unsigned long long N); } llvm::error_code coff2yaml(llvm::raw_ostream &Out, llvm::MemoryBuffer *TheObj); #endif
Use regular assert for static_assert, it's C++14 compatible
/* * Frozen * Copyright 2016 QuarksLab * * 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. */ #ifndef FROZEN_LETITGO_CONSTEXPR_ASSERT_H #define FROZEN_LETITGO_CONSTEXPR_ASSERT_H #ifdef _MSC_VER // FIXME: find a way to implement that correctly for msvc #define constexpr_assert(cond, msg) #else #define constexpr_assert(cond, msg)\ if(!(cond)) {\ extern void constexpr_assert_helper(char const*);\ constexpr_assert_helper(msg);\ } #endif #endif
/* * Frozen * Copyright 2016 QuarksLab * * 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. */ #ifndef FROZEN_LETITGO_CONSTEXPR_ASSERT_H #define FROZEN_LETITGO_CONSTEXPR_ASSERT_H #include <cassert> #ifdef _MSC_VER // FIXME: find a way to implement that correctly for msvc #define constexpr_assert(cond, msg) #else #define constexpr_assert(cond, msg)\ assert(cond && msg); #endif #endif
Use dynamic_cast in qScriptValueToQObject as qobject_cast fails for some metatypes such as Entity*. However, assert that if dynamic_cast is null, so is qobject_cast.
// For conditions of distribution and use, see copyright notice in license.txt #include <QScriptEngine> #include <QMetaType> // The following functions help register a custom QObject-derived class to a QScriptEngine. // See http://lists.trolltech.com/qt-interest/2007-12/thread00158-0.html . template <typename Tp> QScriptValue qScriptValueFromQObject(QScriptEngine *engine, Tp const &qobject) { return engine->newQObject(qobject); } template <typename Tp> void qScriptValueToQObject(const QScriptValue &value, Tp &qobject) { qobject = qobject_cast<Tp>(value.toQObject()); } template <typename Tp> int qScriptRegisterQObjectMetaType(QScriptEngine *engine, const QScriptValue &prototype = QScriptValue() #ifndef qdoc , Tp * = 0 #endif ) { return qScriptRegisterMetaType<Tp>(engine, qScriptValueFromQObject, qScriptValueToQObject, prototype); }
// For conditions of distribution and use, see copyright notice in license.txt #include <QScriptEngine> #include <QMetaType> // The following functions help register a custom QObject-derived class to a QScriptEngine. // See http://lists.trolltech.com/qt-interest/2007-12/thread00158-0.html . template <typename Tp> QScriptValue qScriptValueFromQObject(QScriptEngine *engine, Tp const &qobject) { return engine->newQObject(qobject); } template <typename Tp> void qScriptValueToQObject(const QScriptValue &value, Tp &qobject) { qobject = dynamic_cast<Tp>(value.toQObject()); if (!qobject) { // qobject_cast has been observed to fail for some metatypes, such as Entity*, so prefer dynamic_cast. // However, to see that there are no regressions from that, check that if dynamic_cast fails, so does qobject_cast Tp ptr = qobject_cast<Tp>(value.toQObject()); assert(!ptr); if (ptr) ::LogError("qScriptValueToQObject: dynamic_cast was null, but qobject_cast was not!"); } } template <typename Tp> int qScriptRegisterQObjectMetaType(QScriptEngine *engine, const QScriptValue &prototype = QScriptValue() #ifndef qdoc , Tp * = 0 #endif ) { return qScriptRegisterMetaType<Tp>(engine, qScriptValueFromQObject, qScriptValueToQObject, prototype); }
Add a small C99 test
/* How to compile for DOS (all mode(l)s: tiny/.COM, small/.EXE, huge/.EXE): smlrcc -dost c99.c -o c99dt.com smlrcc -doss c99.c -o c99ds.exe smlrcc -dosh c99.c -o c99dh.exe How to compile for Windows: smlrcc -win c99.c -o c99w.exe How to compile for Linux: smlrcc -linux c99.c -o c99l */ #include <stdio.h> #include <stdint.h> // C99 uint8_t u8 = -1; uint16_t u16 = -1; #ifdef __SMALLER_C_32__ uint32_t u32 = -1; #endif // C99: // comments // C99: trailing comma allowed in enum declarations enum { EZERO, }; int main(void) { // C99: __func__ predefined identifier printf("Hello from %s()\n", __func__); printf("u8=%u, u16=%u", (unsigned)u8, (unsigned)u16); #ifdef __SMALLER_C_32__ printf(", u32=%u", (unsigned)u32); #endif printf("\n"); // C99: variable declaration(s) in for loop's clause-1 for (int i = 0; i < 10; i++) printf("%d", i); printf("\n"); // C99: mixed declarations and code static int call = EZERO; switch (call) { case 0: for (int i = 0; i < 2; i++) { printf("\ncalling main()...\n\n"); call++; printf("\nmain() returned %d (expected %d)\n", main(), i); } return 0; case 1: break; case 2: return 1; } (void)3; // trying to fool the compiler into returning 3 // C99: reaching the } that terminates the main function returns a value of 0 }
Add prototypes to header (based on code by ramiro)
/* * Principal component analysis * Copyright (c) 2004 Michael Niedermayer <michaelni@gmx.at> * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ /** * @file pca.h * Principal component analysis */ typedef struct PCA{ int count; int n; double *covariance; double *mean; }PCA;
/* * Principal component analysis * Copyright (c) 2004 Michael Niedermayer <michaelni@gmx.at> * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * */ /** * @file pca.h * Principal component analysis */ struct PCA *ff_pca_init(int n); void ff_pca_free(struct PCA *pca); void ff_pca_add(struct PCA *pca, double *v); int ff_pca(struct PCA *pca, double *eigenvector, double *eigenvalue); typedef struct PCA{ int count; int n; double *covariance; double *mean; }PCA;
Add SharedCueSheet to global headers
#ifndef CCADX2Manager_Manager_h #define CCADX2Manager_Manager_h #include "Manager.h" #include "CueSheet.h" #endif
#ifndef CCADX2Manager_Manager_h #define CCADX2Manager_Manager_h #include "Manager.h" #include "CueSheet.h" #include "SharedCueSheet.h" #endif
Replace denormalise macro, broken on recent gcc's.
// Macro for killing denormalled numbers // // Written by Jezar at Dreampoint, June 2000 // http://www.dreampoint.co.uk // Based on IS_DENORMAL macro by Jon Watte // This code is public domain #ifndef _denormals_ #define _denormals_ #if 0 #define undenormalise(sample) if(((*(unsigned int*)&sample)&0x7f800000)==0) sample=0.0f #else #define undenormalise(sample) #endif #endif//_denormals_ //ends
// Macro for killing denormalled numbers // // Written by Jezar at Dreampoint, June 2000 // http://www.dreampoint.co.uk // Based on IS_DENORMAL macro by Jon Watte // This code is public domain #ifndef _denormals_ #define _denormals_ #if defined(i386) #ifdef NOMORE // original code doesn't work on recent gcc compilers #define undenormalise(sample) \ if (((*(unsigned int*)&sample)&0x7f800000) == 0) sample = 0.0f #else // !NOMORE // see <ccrma-mail.stanford.edu/pipermail/planetccrma/2005-January/007868.html> static inline float undenormalise(volatile float s) { s += 9.8607615E-32f; return s - 9.8607615E-32f; } //#define undenormalise(sample) #endif // !NOMORE #else // !defined(i386) #define undenormalise(sample) // nothing #endif // !defined(i386) #endif//_denormals_ //ends
Support RHO_ASSERT in Debug mode
#ifndef _RHOFATALERROR_H_ #define _RHOFATALERROR_H_ #include "RhoPort.h" #ifdef OS_SYMBIAN #include <e32std.h> #endif namespace rho{ namespace common{ class CRhoFatalError{ public: static void processFatalError(){ #ifdef RHO_DEBUG #if defined (OS_WINDOWS) //__debugbreak(); DebugBreak(); #elif defined (OS_WINCE) //NKDbgPrintfW ? DebugBreak(); #elif defined(OS_SYMBIAN) User::Invariant(); // exit(-1); #elif defined(OS_MACOSX) //TODO: debugbreak for OS_MACOSX exit(-1); #else exit(-1); #endif #else //!RHO_DEBUG exit(-1); #endif //!RHO_DEBUG } }; } } #endif //_RHOFATALERROR_H_
#ifndef _RHOFATALERROR_H_ #define _RHOFATALERROR_H_ #include "RhoPort.h" #ifdef OS_SYMBIAN #include <e32std.h> #endif namespace rho{ namespace common{ class CRhoFatalError{ public: static void processFatalError(){ #ifdef RHO_DEBUG #if defined (OS_WINDOWS) //__debugbreak(); DebugBreak(); #elif defined (OS_WINCE) //NKDbgPrintfW ? DebugBreak(); #elif defined(OS_SYMBIAN) User::Invariant(); // exit(-1); #elif defined(OS_MACOSX) __assert_rtn(__func__, __FILE__, __LINE__,"RhoFatalError"); #else exit(-1); #endif #else //!RHO_DEBUG exit(-1); #endif //!RHO_DEBUG } }; } } #endif //_RHOFATALERROR_H_
Add test abortUnless unsound test
// PARAM: --set ana.activated[+] abortUnless #include <goblint.h> int zero(int cond) { return 0; } void assume_abort_if_not(int cond) { if (cond) { cond = zero(cond); } else { abort(); } } int main(void) { int x; assume_abort_if_not(x == 8); __goblint_check(x==8); // UNKNOWN! }
Add function for building request01
#include "../modlib.h" #include "../parser.h" #include "mtypes.h" #include "mcoils.h" //Use external master configuration extern MODBUSMasterStatus MODBUSMaster;
Make it build with gcc 4.1
//********************************************************************* //* C_Base64 - a simple base64 encoder and decoder. //* //* Copyright (c) 1999, Bob Withers - bwit@pobox.com //* //* This code may be freely used for any purpose, either personal //* or commercial, provided the authors copyright notice remains //* intact. //********************************************************************* #ifndef Base64_H #define Base64_H #include <string> using std::string; // comment if your compiler doesn't use namespaces class Base64 { public: static string encode(const string & data); static string decode(const string & data); static string encodeFromArray(const char * data, size_t len); private: static const string Base64::Base64Table; static const string::size_type Base64::DecodeTable[]; }; #endif
//********************************************************************* //* C_Base64 - a simple base64 encoder and decoder. //* //* Copyright (c) 1999, Bob Withers - bwit@pobox.com //* //* This code may be freely used for any purpose, either personal //* or commercial, provided the authors copyright notice remains //* intact. //********************************************************************* #ifndef Base64_H #define Base64_H #include <string> using std::string; // comment if your compiler doesn't use namespaces class Base64 { public: static string encode(const string & data); static string decode(const string & data); static string encodeFromArray(const char * data, size_t len); private: static const string Base64Table; static const string::size_type DecodeTable[]; }; #endif
Add forgotted notification observer header.
// Copyright (c) 2009 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef CHROME_COMMON_NOTIFICATION_OBSERVER_H_ #define CHROME_COMMON_NOTIFICATION_OBSERVER_H_ class NotificationDetails; class NotificationSource; class NotificationType; // This is the base class for notification observers. When a matching // notification is posted to the notification service, Observe is called. class NotificationObserver { public: virtual ~NotificationObserver(); virtual void Observe(NotificationType type, const NotificationSource& source, const NotificationDetails& details) = 0; }; #endif // CHROME_COMMON_NOTIFICATION_OBSERVER_H_
Clarify XPC connection lifecycle for -launch:
// // SQRLShipItLauncher.h // Squirrel // // Created by Justin Spahr-Summers on 2013-08-12. // Copyright (c) 2013 GitHub. All rights reserved. // #import <Foundation/Foundation.h> // The domain for errors originating within SQRLShipItLauncher. extern NSString * const SQRLShipItLauncherErrorDomain; // The ShipIt service could not be started. extern const NSInteger SQRLShipItLauncherErrorCouldNotStartService; // Responsible for launching the ShipIt service to actually install an update. @interface SQRLShipItLauncher : NSObject // Attempts to launch the ShipIt service. // // error - If not NULL, set to any error that occurs. // // Returns the XPC connection established, or NULL if an error occurs. If an // error occurs in the connection, it will be automatically released. Retain it // if you'll still need it after that point. - (xpc_connection_t)launch:(NSError **)error; @end
// // SQRLShipItLauncher.h // Squirrel // // Created by Justin Spahr-Summers on 2013-08-12. // Copyright (c) 2013 GitHub. All rights reserved. // #import <Foundation/Foundation.h> // The domain for errors originating within SQRLShipItLauncher. extern NSString * const SQRLShipItLauncherErrorDomain; // The ShipIt service could not be started. extern const NSInteger SQRLShipItLauncherErrorCouldNotStartService; // Responsible for launching the ShipIt service to actually install an update. @interface SQRLShipItLauncher : NSObject // Attempts to launch the ShipIt service. // // error - If not NULL, set to any error that occurs. // // Returns the XPC connection established, or NULL if an error occurs. The // connection will be automatically released once it has completed or received // an error. Retain the connection if you'll still need it after that point. - (xpc_connection_t)launch:(NSError **)error; @end
Add some more acpi event types that we will handle.
#ifdef E_TYPEDEFS /* enum for various event types */ typedef enum _E_Acpi_Type { E_ACPI_TYPE_UNKNOWN = 0, E_ACPI_TYPE_LID, E_ACPI_TYPE_BATTERY, E_ACPI_TYPE_BUTTON, E_ACPI_TYPE_SLEEP, E_ACPI_TYPE_WIFI } E_Acpi_Type; /* struct used to pass to event handlers */ typedef struct _E_Event_Acpi E_Event_Acpi; #else # ifndef E_ACPI_H # define E_ACPI_H struct _E_Event_Acpi { const char *device, *bus_id; int type, data; }; EAPI int e_acpi_init(void); EAPI int e_acpi_shutdown(void); extern EAPI int E_EVENT_ACPI_LID; extern EAPI int E_EVENT_ACPI_BATTERY; extern EAPI int E_EVENT_ACPI_BUTTON; extern EAPI int E_EVENT_ACPI_SLEEP; extern EAPI int E_EVENT_ACPI_WIFI; # endif #endif
#ifdef E_TYPEDEFS /* enum for various event types */ typedef enum _E_Acpi_Type { E_ACPI_TYPE_UNKNOWN = 0, E_ACPI_TYPE_BATTERY, E_ACPI_TYPE_BUTTON, E_ACPI_TYPE_FAN, E_ACPI_TYPE_LID, E_ACPI_TYPE_PROCESSOR, E_ACPI_TYPE_SLEEP, E_ACPI_TYPE_POWER, E_ACPI_TYPE_THERMAL, E_ACPI_TYPE_VIDEO, E_ACPI_TYPE_WIFI } E_Acpi_Type; /* struct used to pass to event handlers */ typedef struct _E_Event_Acpi E_Event_Acpi; #else # ifndef E_ACPI_H # define E_ACPI_H struct _E_Event_Acpi { const char *device, *bus_id; int type, data; }; EAPI int e_acpi_init(void); EAPI int e_acpi_shutdown(void); extern EAPI int E_EVENT_ACPI_LID; extern EAPI int E_EVENT_ACPI_BATTERY; extern EAPI int E_EVENT_ACPI_BUTTON; extern EAPI int E_EVENT_ACPI_SLEEP; extern EAPI int E_EVENT_ACPI_WIFI; # endif #endif
Modify UnMap function return boolean value that succesfully unmaped.
#pragma once #include "ResourceDX11.h" namespace Mile { class MEAPI BufferDX11 : public ResourceDX11 { public: BufferDX11( RendererDX11* renderer ) : m_buffer( nullptr ), ResourceDX11( renderer ) { } ~BufferDX11( ) { SafeRelease( m_buffer ); } virtual ID3D11Resource* GetResource( ) override; D3D11_BUFFER_DESC GetDesc( ) const { return m_desc; } virtual void* Map( ) { return nullptr; } virtual void UnMap( ) { } protected: ID3D11Buffer* m_buffer; D3D11_BUFFER_DESC m_desc; }; }
#pragma once #include "ResourceDX11.h" namespace Mile { class MEAPI BufferDX11 : public ResourceDX11 { public: BufferDX11( RendererDX11* renderer ) : m_buffer( nullptr ), ResourceDX11( renderer ) { } ~BufferDX11( ) { SafeRelease( m_buffer ); } virtual ID3D11Resource* GetResource( ) override; D3D11_BUFFER_DESC GetDesc( ) const { return m_desc; } virtual void* Map( ) { return nullptr; } virtual bool UnMap( ) { return false; } protected: ID3D11Buffer* m_buffer; D3D11_BUFFER_DESC m_desc; }; }
Update the way of importing CDVViewController to avoid compiler warning when using xFaceLib in 3rd party.
/* This file was modified from or inspired by Apache Cordova. 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. */ // // XViewController.h // xFaceLib // // #import <Foundation/Foundation.h> #import <Cordova/CDVViewController.h> @protocol XApplication; @interface XViewController : CDVViewController @property (nonatomic, assign) BOOL loadFromString; @property (weak, nonatomic) id<XApplication> ownerApp; /**< 关联的app */ @end
/* This file was modified from or inspired by Apache Cordova. 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. */ // // XViewController.h // xFaceLib // // #import <Foundation/Foundation.h> #import "Cordova/CDVViewController.h" @protocol XApplication; @interface XViewController : CDVViewController @property (nonatomic, assign) BOOL loadFromString; @property (weak, nonatomic) id<XApplication> ownerApp; /**< 关联的app */ @end
Add base struct for hasNode.
#include <stdio.h> #include <stdlib.h> #ifndef LINKED_LIST_H #define LINKED_LIST_H #include "linkedList.h" #endif struct Node { int data; struct Node* next; }; int main(int arc, char **argc) { // Create size for the nodes struct Node* head = malloc(sizeof(struct Node)); struct Node* middle = malloc(sizeof(struct Node)); struct Node* tail = malloc(sizeof(struct Node)); // Assign their data head->data = 15; middle->data = 20; tail->data = 25; // Chain them together head->next = middle; middle->next = tail; tail->next = NULL; // Create pointer node for traversal struct Node* n = malloc(sizeof(struct Node)); n = head; // Traverse the linked list while(n != NULL) { printf("data is: %i\n", n->data); n = n->next; } return 0; }
#include <stdio.h> #include <stdlib.h> #ifndef LINKED_LIST_H #define LINKED_LIST_H #include "linkedList.h" #endif struct Node { int data; struct Node* next; }; bool hasNode(struct Node* head, int data) { return true; } int main(int arc, char **argc) { // Create size for the nodes struct Node* head = malloc(sizeof(struct Node)); struct Node* middle = malloc(sizeof(struct Node)); struct Node* tail = malloc(sizeof(struct Node)); // Assign their data head->data = 15; middle->data = 20; tail->data = 25; // Chain them together head->next = middle; middle->next = tail; tail->next = NULL; // Create pointer node for traversal struct Node* n = malloc(sizeof(struct Node)); n = head; // Traverse the linked list while(n != NULL) { printf("data is: %i\n", n->data); n = n->next; } return 0; }
Change the version to `1.0.1`
#ifndef PHP_EXTCSS3_H #define PHP_EXTCSS3_H #include <php.h> #include "extcss3/types.h" #define PHP_EXTCSS3_EXTNAME "extcss3" #define PHP_EXTCSS3_EXTVER "1.0.0" #ifdef HAVE_CONFIG_H #include "config.h" #endif /* HAVE_CONFIG_H */ extern zend_module_entry extcss3_module_entry; #define phpext_extcss3_ptr &extcss3_module_entry; typedef struct _extcss3_object { extcss3_intern *intern; zend_object std; } extcss3_object; #endif /* PHP_EXTCSS3_H */
#ifndef PHP_EXTCSS3_H #define PHP_EXTCSS3_H #include <php.h> #include "extcss3/types.h" #define PHP_EXTCSS3_EXTNAME "extcss3" #define PHP_EXTCSS3_EXTVER "1.0.1" #ifdef HAVE_CONFIG_H #include "config.h" #endif /* HAVE_CONFIG_H */ extern zend_module_entry extcss3_module_entry; #define phpext_extcss3_ptr &extcss3_module_entry; typedef struct _extcss3_object { extcss3_intern *intern; zend_object std; } extcss3_object; #endif /* PHP_EXTCSS3_H */
Change gets to fgets, because gets is unsafe
#include <stdio.h> #include "portable_io.h" char Prbuf[MAXLLEN]; //将输入输出函数包出来. void portable_puts(char* buf){ while((*buf)!=0){ putchar(*buf); buf++; } } void portable_input_int(int* val){ portable_gets(Prbuf); sscanf(Prbuf, "%d", val); } void portable_gets(char* buf){ gets(buf); }
#include <stdio.h> #include "portable_io.h" char Prbuf[MAXLLEN]; //将输入输出函数包出来. void portable_puts(char* buf){ while((*buf)!=0){ putchar(*buf); buf++; } } void portable_input_int(int* val){ portable_gets(Prbuf); sscanf(Prbuf, "%d", val); } void portable_gets(char* buf){ fgets(buf, MAXLLEN, stdin); }
Add stubs for itoa, ltoa
#include <stdlib.h> #include "stdlib_noniso.h" long atol_internal(const char* s) { return 0; } float atof_internal(const char* s) { return 0; } char * itoa (int val, char *s, int radix) { *s = 0; return s; } char * ltoa (long val, char *s, int radix) { *s = 0; return s; } char * utoa (unsigned int val, char *s, int radix) { *s = 0; return s; } char * ultoa (unsigned long val, char *s, int radix) { *s = 0; return s; } char * dtostre (double __val, char *__s, unsigned char __prec, unsigned char __flags) { *__s = 0; return __s; } char * dtostrf (double __val, signed char __width, unsigned char __prec, char *__s) { *__s = 0; return __s; }
#include <stdlib.h> #include "stdlib_noniso.h" extern int ets_sprintf(char*, const char*, ...); #define sprintf ets_sprintf long atol_internal(const char* s) { long result = 0; return result; } float atof_internal(const char* s) { float result = 0; return result; } char * itoa (int val, char *s, int radix) { // todo: radix sprintf(s, "%d", val); return s; } char * ltoa (long val, char *s, int radix) { sprintf(s, "%ld", val); return s; } char * utoa (unsigned int val, char *s, int radix) { sprintf(s, "%u", val); return s; } char * ultoa (unsigned long val, char *s, int radix) { sprintf(s, "%lu", val); return s; } char * dtostre (double __val, char *__s, unsigned char __prec, unsigned char __flags) { *__s = 0; return __s; } char * dtostrf (double __val, signed char __width, unsigned char __prec, char *__s) { *__s = 0; return __s; }
Add information about the module source
//===-- llvm/Bytecode/Reader.h - Reader for VM bytecode files ----*- C++ -*--=// // // This functionality is implemented by the lib/Bytecode/Reader library. // This library is used to read VM bytecode files from an iostream. // // Note that performance of this library is _crucial_ for performance of the // JIT type applications, so we have designed the bytecode format to support // quick reading. // //===----------------------------------------------------------------------===// #ifndef LLVM_BYTECODE_READER_H #define LLVM_BYTECODE_READER_H #include <string> #include <vector> class Module; // Parse and return a class... // Module *ParseBytecodeFile(const std::string &Filename, std::string *ErrorStr = 0); Module *ParseBytecodeBuffer(const unsigned char *Buffer, unsigned BufferSize, std::string *ErrorStr = 0); // ReadArchiveFile - Read bytecode files from the specfied .a file, returning // true on error, or false on success. // bool ReadArchiveFile(const std::string &Filename, std::vector<Module*> &Objects, std::string *ErrorStr = 0); #endif
//===-- llvm/Bytecode/Reader.h - Reader for VM bytecode files ----*- C++ -*--=// // // This functionality is implemented by the lib/Bytecode/Reader library. // This library is used to read VM bytecode files from an iostream. // // Note that performance of this library is _crucial_ for performance of the // JIT type applications, so we have designed the bytecode format to support // quick reading. // //===----------------------------------------------------------------------===// #ifndef LLVM_BYTECODE_READER_H #define LLVM_BYTECODE_READER_H #include <string> #include <vector> class Module; // Parse and return a class... // Module *ParseBytecodeFile(const std::string &Filename, std::string *ErrorStr = 0); Module *ParseBytecodeBuffer(const unsigned char *Buffer, unsigned BufferSize, const std::string &ModuleID, std::string *ErrorStr = 0); // ReadArchiveFile - Read bytecode files from the specfied .a file, returning // true on error, or false on success. // bool ReadArchiveFile(const std::string &Filename, std::vector<Module*> &Objects, std::string *ErrorStr = 0); #endif
Add documentation for NSURL category
// // NSURL+Pinmark.h // Pinmark // // Created by Kyle Stevens on 12/24/13. // Copyright (c) 2013 kilovolt42. All rights reserved. // #import <Foundation/Foundation.h> @interface NSURL (Pinmark) - (NSDictionary *)queryParameters; @end
// // NSURL+Pinmark.h // Pinmark // // Created by Kyle Stevens on 12/24/13. // Copyright (c) 2013 kilovolt42. All rights reserved. // #import <Foundation/Foundation.h> @interface NSURL (Pinmark) /** * Creates a dictionary of the query parameters in which fields are keys for the corresponding values. * Does not support array parameters at this time. * * @return A dictionary of query parameters. */ - (NSDictionary *)queryParameters; @end
Add a rectangle definition for enesim
/* ENESIM - Direct Rendering Library * Copyright (C) 2007-2011 Jorge Luis Zapata * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library. * If not, see <http://www.gnu.org/licenses/>. */ #ifndef ENESIM_RECTANGLE_H_ #define ENESIM_RECTANGLE_H_ /** * @defgroup Enesim_Rectangle_Group Rectangle * @{ * @todo */ typedef struct _Enesim_Rectangle { double x; double y; double w; double h; } Enesim_Rectangle; /** * @} */ #endif
Fix comment to reflect the change in the function name
#ifndef QBLOWFISH_H #define QBLOWFISH_H #include <QByteArray> class QBlowfish { public: QBlowfish(const QByteArray &key); bool init(); // Padding: // // Blowfish works on 8-byte blocks. Padding makes it usable even // in case where the input size is not in exact 8-byte blocks. // // If padding is disabled (the default), encrypt() will work only if the // input size (in bytes) is a multiple of 8. (If it's not a multiple of 8, // encrypt() will return a null bytearray.) // // If padding is enabled, we increase the input length to a multiple of 8 // by padding bytes as per PKCS5 // // If padding was enabled during encryption, it should be enabled during // decryption for correct decryption (and vice versa). void setPaddingEnabled(bool enabled); bool paddingEnabled() const; // Encrypt / decrypt QByteArray encrypted(const QByteArray &clearText); QByteArray decrypted(const QByteArray &cipherText); private: // core encrypt/decrypt methods, encrypts/decrypts in-place void coreEncrypt(char *x); void coreDecrypt(char *x); QByteArray m_key; bool m_initialized; bool m_paddingEnabled; QByteArray m_parray; QByteArray m_sbox1, m_sbox2, m_sbox3, m_sbox4; }; #endif // QBLOWFISH_H
#ifndef QBLOWFISH_H #define QBLOWFISH_H #include <QByteArray> class QBlowfish { public: QBlowfish(const QByteArray &key); bool init(); // Padding: // // Blowfish works on 8-byte blocks. Padding makes it usable even // in case where the input size is not in exact 8-byte blocks. // // If padding is disabled (the default), encrypted() will work only if the // input size (in bytes) is a multiple of 8. (If it's not a multiple of 8, // encrypted() will return a null bytearray.) // // If padding is enabled, we increase the input length to a multiple of 8 // by padding bytes as per PKCS5 // // If padding was enabled during encryption, it should be enabled during // decryption for correct decryption (and vice versa). void setPaddingEnabled(bool enabled); bool paddingEnabled() const; // Encrypt / decrypt QByteArray encrypted(const QByteArray &clearText); QByteArray decrypted(const QByteArray &cipherText); private: // core encrypt/decrypt methods, encrypts/decrypts in-place void coreEncrypt(char *x); void coreDecrypt(char *x); QByteArray m_key; bool m_initialized; bool m_paddingEnabled; QByteArray m_parray; QByteArray m_sbox1, m_sbox2, m_sbox3, m_sbox4; }; #endif // QBLOWFISH_H
Fix another header guard oversight
#ifndef __VARIABLE_H__ #define __VARAIBLE_H__ typedef struct { double weight; double sum; double sum2; } Variable; #define VARIABLE_INIT { 0.0, 0.0, 0.0 } void variable_init (Variable *variable); void variable_add_weighted (Variable *variable, double value, double weight); void variable_add (Variable *variable, double value); double variable_mean (Variable *variable); double variable_standard_deviation (Variable *variable); void variable_reset (Variable *variable); #endif /* __VARIABLE_H__ */
#ifndef __VARIABLE_H__ #define __VARIABLE_H__ typedef struct { double weight; double sum; double sum2; } Variable; #define VARIABLE_INIT { 0.0, 0.0, 0.0 } void variable_init (Variable *variable); void variable_add_weighted (Variable *variable, double value, double weight); void variable_add (Variable *variable, double value); double variable_mean (Variable *variable); double variable_standard_deviation (Variable *variable); void variable_reset (Variable *variable); #endif /* __VARIABLE_H__ */
Add some more acpi event types that we will handle.
#ifdef E_TYPEDEFS /* enum for various event types */ typedef enum _E_Acpi_Type { E_ACPI_TYPE_UNKNOWN = 0, E_ACPI_TYPE_LID, E_ACPI_TYPE_BATTERY, E_ACPI_TYPE_BUTTON, E_ACPI_TYPE_SLEEP, E_ACPI_TYPE_WIFI } E_Acpi_Type; /* struct used to pass to event handlers */ typedef struct _E_Event_Acpi E_Event_Acpi; #else # ifndef E_ACPI_H # define E_ACPI_H struct _E_Event_Acpi { const char *device, *bus_id; int type, data; }; EAPI int e_acpi_init(void); EAPI int e_acpi_shutdown(void); extern EAPI int E_EVENT_ACPI_LID; extern EAPI int E_EVENT_ACPI_BATTERY; extern EAPI int E_EVENT_ACPI_BUTTON; extern EAPI int E_EVENT_ACPI_SLEEP; extern EAPI int E_EVENT_ACPI_WIFI; # endif #endif
#ifdef E_TYPEDEFS /* enum for various event types */ typedef enum _E_Acpi_Type { E_ACPI_TYPE_UNKNOWN = 0, E_ACPI_TYPE_BATTERY, E_ACPI_TYPE_BUTTON, E_ACPI_TYPE_FAN, E_ACPI_TYPE_LID, E_ACPI_TYPE_PROCESSOR, E_ACPI_TYPE_SLEEP, E_ACPI_TYPE_POWER, E_ACPI_TYPE_THERMAL, E_ACPI_TYPE_VIDEO, E_ACPI_TYPE_WIFI } E_Acpi_Type; /* struct used to pass to event handlers */ typedef struct _E_Event_Acpi E_Event_Acpi; #else # ifndef E_ACPI_H # define E_ACPI_H struct _E_Event_Acpi { const char *device, *bus_id; int type, data; }; EAPI int e_acpi_init(void); EAPI int e_acpi_shutdown(void); extern EAPI int E_EVENT_ACPI_LID; extern EAPI int E_EVENT_ACPI_BATTERY; extern EAPI int E_EVENT_ACPI_BUTTON; extern EAPI int E_EVENT_ACPI_SLEEP; extern EAPI int E_EVENT_ACPI_WIFI; # endif #endif
Add regression test for extern function calling/spawning function pointer argument
#include<pthread.h> extern void foo(int (*callback)()); int glob; pthread_mutex_t mutex1 = PTHREAD_MUTEX_INITIALIZER; pthread_mutex_t mutex2 = PTHREAD_MUTEX_INITIALIZER; void *t_fun(void *arg) { pthread_mutex_lock(&mutex2); glob=glob+1; // RACE! pthread_mutex_unlock(&mutex2); return NULL; } int bar() { pthread_mutex_lock(&mutex1); glob=glob+1; // RACE! pthread_mutex_unlock(&mutex1); return 0; } int main() { pthread_t id; pthread_create(&id, NULL, t_fun, NULL); foo(bar); pthread_join (id, NULL); return 0; }
Add the initial NCurses support for the program.
#include <stdio.h> int main(void) { return(0); }
#include <stdio.h> #include <stdlib.h> #include <sys/ioctl.h> #include <ncurses.h> struct winsize terminalSize; void initScreen(void) { initscr(); noecho(); nocbreak(); } void closeScreen(void) { endwin(); } void getScreenSize(void) { if (ioctl(0, TIOCGWINSZ, (char *) &terminalSize) < 0) { printf("The program canno't determine terminal size.\r\n\r\n"); exit(1); } } int main(void) { initScreen(); getScreenSize(); move(10,10); printw("Terminal size is %dx%d", terminalSize.ws_col, terminalSize.ws_row); getch(); closeScreen(); return(0); }
Add incr decr error test
int main() { // Issue: 3: error: operand of increment operator not a modifiable lvalue 4--; int array[5]; // Issue: 7: error: operand of increment operator not a modifiable lvalue array--; }
Change header to C style.
/** * File: control.h * Author: Alex Savarda */ #ifndef CONTROL_H #define CONTROL_H typedef struct { unsigned int d_srcA; unsigned int d_srcB; unsigned int E_dstM; unsigned int e_Cnd; unsigned int D_icode; unsigned int E_icode; unsigned int M_icode; } controlType; #endif /* CONTROL_H */
/* * File: control.h * Author: Alex Savarda */ #ifndef CONTROL_H #define CONTROL_H typedef struct { unsigned int d_srcA; unsigned int d_srcB; unsigned int E_dstM; unsigned int e_Cnd; unsigned int D_icode; unsigned int E_icode; unsigned int M_icode; } controlType; #endif /* CONTROL_H */
Add array of valid commands.
// System #include <unistd.h> #include <stdlib.h> #include <stdio.h> #include <string.h> // Preprocessed #define PROGRAM_EXEC 0 #define COMMAND 1 #define MACHINE_NAME 2 // Commands #define LIST_COMMAND "list" void list_machines() { fprintf(stdout, "Here be a list of machines:\n"); fprintf(stdout, " - default\n"); fprintf(stdout, " - different\n"); } void usage(char **argv) { fprintf(stderr, "Usage: %s <command> <virtual-machine-name> \n", argv[PROGRAM_EXEC]); } void run_command(char *command, char *machine_name) { fprintf(stdout, "%s machine %s\n", command, machine_name); } int main(int argc, char **argv) { if (argv[MACHINE_NAME] && argv[COMMAND]) { run_command(argv[COMMAND], argv[MACHINE_NAME]); } else { list_machines(); usage(argv); exit(EXIT_FAILURE); } exit(EXIT_SUCCESS); }
/** * xhyve-manager * a simple CLI utility to manage xhyve virtual machines. **/ // System #include <unistd.h> #include <stdlib.h> #include <stdio.h> #include <string.h> // Preprocessed #define PROGRAM_EXEC 0 #define COMMAND 1 #define MACHINE_NAME 2 // Valid Commands char *commands[] = { "list", "create", "delete", "start" }; void list_machines() { fprintf(stdout, "Here be a list of machines:\n"); fprintf(stdout, " - default\n"); fprintf(stdout, " - different\n"); } void usage(char **argv) { fprintf(stderr, "Usage: %s <command> <virtual-machine-name> \n", argv[PROGRAM_EXEC]); } void run_command(char *command, char *machine_name) { fprintf(stdout, "%s machine %s\n", command, machine_name); } int main(int argc, char **argv) { if (argv[MACHINE_NAME] && argv[COMMAND]) { run_command(argv[COMMAND], argv[MACHINE_NAME]); } else if (!argv[MACHINE_NAME] && argv[COMMAND]) { list_machines(); } else { usage(argv); exit(EXIT_FAILURE); } exit(EXIT_SUCCESS); }
Test case for aligned attribute on function declaration.
// RUN: %llvmgcc %s -S -emit-llvm -o - | FileCheck %s // rdar://7270273 void foo() __attribute__((aligned (64))); void foo() { // CHECK: define void @foo() {{.*}} align 64 }
Add CCSlider to the UI headers
/* * cocos2d for iPhone: http://www.cocos2d-iphone.org * * Copyright (c) 2013 Apportable Inc. * * 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. */ // Cocos2d-UI #import "CCControl.h" #import "CCButton.h" #import "CCScrollView.h" #import "CCTableView.h" #import "CCTextField.h" // CCBReader #import "CCBuilderReader.h"
/* * cocos2d for iPhone: http://www.cocos2d-iphone.org * * Copyright (c) 2013 Apportable Inc. * * 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. */ // Cocos2d-UI #import "CCControl.h" #import "CCButton.h" #import "CCScrollView.h" #import "CCTableView.h" #import "CCTextField.h" #import "CCSlider.h" // CCBReader #import "CCBuilderReader.h"
Add Vesal's oddness cycle invariant example
extern void __VERIFIER_error() __attribute__ ((__noreturn__)); extern int __VERIFIER_nondet_int(); void __VERIFIER_assert(int cond) { if (!(cond)) { ERROR: __VERIFIER_error(); } return; } void fun() { int i; // Ultimate can't handle i declared in for for (i = 1; i < 1000; i += 2) { __VERIFIER_assert(i < 2000); } // Ultimate benefits from cycle invariant: i % 2 == 1 __VERIFIER_assert(i == 1001); } int main() { fun(); return 0; }
Abort LLVM in debug builds when the IR doesn't verify.
/* * Copyright (C) 2011 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef ART_SRC_UTILS_LLVM_H_ #define ART_SRC_UTILS_LLVM_H_ #include "base/stringprintf.h" #include <llvm/Analysis/Verifier.h> #include <stdint.h> #include <string> namespace art { #ifndef NDEBUG #define VERIFY_LLVM_FUNCTION(func) llvm::verifyFunction(func, llvm::PrintMessageAction) #else #define VERIFY_LLVM_FUNCTION(func) #endif inline static std::string ElfFuncName(uint32_t idx) { return StringPrintf("Art%u", static_cast<unsigned int>(idx)); } class CStringLessThanComparator { public: bool operator()(const char* lhs, const char* rhs) const { return (strcmp(lhs, rhs) < 0); } }; } // namespace art #endif // ART_SRC_UTILS_LLVM_H_
/* * Copyright (C) 2011 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #ifndef ART_SRC_UTILS_LLVM_H_ #define ART_SRC_UTILS_LLVM_H_ #include "base/stringprintf.h" #include <llvm/Analysis/Verifier.h> #include <stdint.h> #include <string> namespace art { #ifndef NDEBUG #define VERIFY_LLVM_FUNCTION(func) llvm::verifyFunction(func, llvm::AbortProcessAction) #else #define VERIFY_LLVM_FUNCTION(func) #endif inline static std::string ElfFuncName(uint32_t idx) { return StringPrintf("Art%u", static_cast<unsigned int>(idx)); } class CStringLessThanComparator { public: bool operator()(const char* lhs, const char* rhs) const { return (strcmp(lhs, rhs) < 0); } }; } // namespace art #endif // ART_SRC_UTILS_LLVM_H_
Fix backspace at start of file.
#include "mode.h" #include <ctype.h> #include <termbox.h> #include "buffer.h" #include "gap.h" #include "editor.h" static void insert_mode_entered(editor_t *editor) { editor_status_msg(editor, "-- INSERT --"); } static void insert_mode_key_pressed(editor_t* editor, struct tb_event* ev) { buffer_t *buffer = editor->window->buffer; gapbuf_t *gb = buffer->text; int *cursor = &editor->window->cursor; char ch; switch (ev->key) { case TB_KEY_ESC: case TB_KEY_CTRL_C: editor_status_msg(editor, ""); editor_pop_mode(editor); return; case TB_KEY_BACKSPACE2: if (cursor > 0) { gb_del(gb, 1, (*cursor)--); buffer->dirty = 1; } return; case TB_KEY_ENTER: ch = '\n'; break; case TB_KEY_SPACE: ch = ' '; break; default: ch = ev->ch; break; } gb_putchar(gb, ch, (*cursor)++); buffer->dirty = 1; } static editing_mode_t impl = { insert_mode_entered, insert_mode_key_pressed }; editing_mode_t *insert_mode(void) { return &impl; }
#include "mode.h" #include <ctype.h> #include <termbox.h> #include "buffer.h" #include "gap.h" #include "editor.h" static void insert_mode_entered(editor_t *editor) { editor_status_msg(editor, "-- INSERT --"); } static void insert_mode_key_pressed(editor_t* editor, struct tb_event* ev) { buffer_t *buffer = editor->window->buffer; gapbuf_t *gb = buffer->text; int *cursor = &editor->window->cursor; char ch; switch (ev->key) { case TB_KEY_ESC: case TB_KEY_CTRL_C: editor_status_msg(editor, ""); editor_pop_mode(editor); return; case TB_KEY_BACKSPACE2: if (*cursor > 0) { gb_del(gb, 1, (*cursor)--); buffer->dirty = 1; } return; case TB_KEY_ENTER: ch = '\n'; break; case TB_KEY_SPACE: ch = ' '; break; default: ch = ev->ch; break; } gb_putchar(gb, ch, (*cursor)++); buffer->dirty = 1; } static editing_mode_t impl = { insert_mode_entered, insert_mode_key_pressed }; editing_mode_t *insert_mode(void) { return &impl; }
Add a TODO to update PacketsDroppedByInterface documentation when it gets supported.
#pragma once #include "PcapDeclarations.h" namespace PcapDotNet { namespace Core { /// <summary> /// Statistics on capture from the start of the run. /// </summary> public ref class PacketTotalStatistics sealed : System::IEquatable<PacketTotalStatistics^> { public: /// <summary> /// Number of packets transited on the network. /// </summary> property unsigned int PacketsReceived { unsigned int get(); } /// <summary> /// Number of packets dropped by the driver. /// </summary> property unsigned int PacketsDroppedByDriver { unsigned int get(); } /// <summary> /// Number of packets dropped by the interface. /// Not yet supported. /// </summary> property unsigned int PacketsDroppedByInterface { unsigned int get(); } /// <summary> /// Win32 specific. Number of packets captured, i.e number of packets that are accepted by the filter, that find place in the kernel buffer and therefore that actually reach the application. /// </summary> property unsigned int PacketsCaptured { unsigned int get(); } virtual bool Equals(PacketTotalStatistics^ other); virtual bool Equals(System::Object^ obj) override; virtual int GetHashCode() override; virtual System::String^ ToString() override; internal: PacketTotalStatistics(const pcap_stat& statistics, int statisticsSize); private: unsigned int _packetsReceived; unsigned int _packetsDroppedByDriver; unsigned int _packetsDroppedByInterface; unsigned int _packetsCaptured; }; }}
#pragma once #include "PcapDeclarations.h" namespace PcapDotNet { namespace Core { /// <summary> /// Statistics on capture from the start of the run. /// </summary> public ref class PacketTotalStatistics sealed : System::IEquatable<PacketTotalStatistics^> { public: /// <summary> /// Number of packets transited on the network. /// </summary> property unsigned int PacketsReceived { unsigned int get(); } /// <summary> /// Number of packets dropped by the driver. /// </summary> property unsigned int PacketsDroppedByDriver { unsigned int get(); } // TODO: Update documentation when support is added. /// <summary> /// Number of packets dropped by the interface. /// Not yet supported. /// </summary> property unsigned int PacketsDroppedByInterface { unsigned int get(); } /// <summary> /// Win32 specific. Number of packets captured, i.e number of packets that are accepted by the filter, that find place in the kernel buffer and therefore that actually reach the application. /// </summary> property unsigned int PacketsCaptured { unsigned int get(); } virtual bool Equals(PacketTotalStatistics^ other); virtual bool Equals(System::Object^ obj) override; virtual int GetHashCode() override; virtual System::String^ ToString() override; internal: PacketTotalStatistics(const pcap_stat& statistics, int statisticsSize); private: unsigned int _packetsReceived; unsigned int _packetsDroppedByDriver; unsigned int _packetsDroppedByInterface; unsigned int _packetsCaptured; }; }}
Use C_IN for class of information
#include <stdio.h> #include <stdlib.h> #include <unistd.h> #include <netinet/in.h> #include <resolv.h> int check_mx(char *domain) { u_char nsbuf[4096]; return res_query(domain, ns_c_any, ns_t_mx, nsbuf, sizeof (nsbuf)) > 0; }
#include <stdio.h> #include <stdlib.h> #include <unistd.h> #include <netinet/in.h> #include <resolv.h> int check_mx(char *domain) { u_char nsbuf[4096]; return res_query(domain, ns_c_in, ns_t_mx, nsbuf, sizeof (nsbuf)) > 0; }
Add macro for defining memory-mapped registers.
//////////////////////////////////////////////////////////////////////////////////////////////// /// /// @file /// @author Kuba Sejdak /// @date 11.12.2016 /// /// @copyright This file is a part of cosmos OS. All rights reserved. /// //////////////////////////////////////////////////////////////////////////////////////////////// #ifndef UTILS_H #define UTILS_H #define REGISTER(type, addr) ((volatile type *) (addr)) #endif
Reduce PWM frequency to 500 Hz.
/* * Supemeca Never Dies 2017 * \file Motor.h * \date 17/03/2017 * \author Romain Reignier */ #pragma once #include "hal.h" #include "Motors.h" class Motor { friend class Motors; public: enum eDirection { FORWARD, BACKWARD }; static constexpr uint32_t kPwmFrequency{1000000}; static constexpr uint16_t kPwmPeriod{125}; // TODO: change direction security, not too often Motor(PWMDriver* _driver, const uint8_t _channel, bool _isComplementaryChannel = false); void begin(); void stop(); void pwm(int16_t _percentage); void pwmI(int16_t _percentage); virtual void brake() = 0; virtual void changeDirection(eDirection _direction) = 0; virtual void setOutputPinsMode() = 0; protected: PWMDriver* m_driver; uint8_t m_channel; bool m_isComplementaryChannel; PWMConfig m_pwmCfg; };
/* * Supemeca Never Dies 2017 * \file Motor.h * \date 17/03/2017 * \author Romain Reignier */ #pragma once #include "hal.h" #include "Motors.h" class Motor { friend class Motors; public: enum eDirection { FORWARD, BACKWARD }; static constexpr uint32_t kPwmFrequency{10000}; static constexpr uint16_t kPwmPeriod{20}; Motor(PWMDriver* _driver, const uint8_t _channel, bool _isComplementaryChannel = false); void begin(); void stop(); void pwm(int16_t _percentage); void pwmI(int16_t _percentage); virtual void brake() = 0; virtual void changeDirection(eDirection _direction) = 0; virtual void setOutputPinsMode() = 0; protected: PWMDriver* m_driver; uint8_t m_channel; bool m_isComplementaryChannel; PWMConfig m_pwmCfg; };
Add newline to end of file
// // PureLayout.h // v2.0.2 // https://github.com/smileyborg/PureLayout // // Copyright (c) 2014 Tyler Fox // // This code is distributed under the terms and conditions of the MIT license. // // 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 PureLayout_h #define PureLayout_h #import "ALView+PureLayout.h" #import "NSArray+PureLayout.h" #import "NSLayoutConstraint+PureLayout.h" #endif /* PureLayout_h */
// // PureLayout.h // v2.0.2 // https://github.com/smileyborg/PureLayout // // Copyright (c) 2014 Tyler Fox // // This code is distributed under the terms and conditions of the MIT license. // // 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 PureLayout_h #define PureLayout_h #import "ALView+PureLayout.h" #import "NSArray+PureLayout.h" #import "NSLayoutConstraint+PureLayout.h" #endif /* PureLayout_h */
Fix compilation on Linux with latest 1.10
// Filename: config_lui.h // Created by: tobspr (28Aug14) // #ifndef CONFIG_LUI_H #define CONFIG_LUI_H #include "pandabase.h" #include "notifyCategoryProxy.h" #include "dconfig.h" // It is convenient to put these here for now. // #if (defined(WIN32_VC) || defined(WIN64_VC)) && !defined(CPPPARSER) && !defined(LINK_ALL_STATIC) // #ifdef BUILDING_LUI // #define EXPCL_LUI __declspec(dllexport) // #define EXPTP_LUI // #else // #define EXPCL_LUI __declspec(dllimport) // #define EXPTP_LUI extern // #endif // #else // #endif #define EXPCL_LUI #define EXPTP_LUI ConfigureDecl(config_lui, EXPCL_LUI, EXPTP_LUI); NotifyCategoryDecl(lui, EXPCL_LUI, EXPTP_LUI); extern EXPCL_LUI void init_lui(); #endif
// Filename: config_lui.h // Created by: tobspr (28Aug14) // #ifndef CONFIG_LUI_H #define CONFIG_LUI_H #include "pandabase.h" #include "notifyCategoryProxy.h" #include "dconfig.h" #define EXPCL_LUI EXPORT_CLASS #define EXPTP_LUI EXPORT_TEMPL ConfigureDecl(config_lui, EXPCL_LUI, EXPTP_LUI); NotifyCategoryDecl(lui, EXPCL_LUI, EXPTP_LUI); extern EXPCL_LUI void init_lui(); #endif
Move gVersionCheck into `ROOT::` (ROOT-10426):
// @(#)root/base:$Id$ // Author: Fons Rademakers 9/5/2007 /************************************************************************* * Copyright (C) 1995-2007, Rene Brun and Fons Rademakers. * * All rights reserved. * * * * For the licensing terms see $ROOTSYS/LICENSE. * * For the list of contributors see $ROOTSYS/README/CREDITS. * *************************************************************************/ #ifndef ROOT_TVersionCheck #define ROOT_TVersionCheck ////////////////////////////////////////////////////////////////////////// // // // TVersionCheck // // // // Used to check if the shared library or plugin is compatible with // // the current version of ROOT. // // // ////////////////////////////////////////////////////////////////////////// #ifdef R__CXXMODULES #ifndef ROOT_TObject #error "Building with modules currently requires this file to be #included through TObject.h" #endif #endif // R__CXXMODULES #include "RVersion.h" class TVersionCheck { public: TVersionCheck(int versionCode); // implemented in TSystem.cxx }; // FIXME: Due to a modules bug: https://llvm.org/bugs/show_bug.cgi?id=31056 // our .o files get polluted with the gVersionCheck symbol despite it was not // visible in this TU. #ifndef R__CXXMODULES #ifndef __CINT__ static TVersionCheck gVersionCheck(ROOT_VERSION_CODE); #endif #endif #endif
// @(#)root/base:$Id$ // Author: Fons Rademakers 9/5/2007 /************************************************************************* * Copyright (C) 1995-2007, Rene Brun and Fons Rademakers. * * All rights reserved. * * * * For the licensing terms see $ROOTSYS/LICENSE. * * For the list of contributors see $ROOTSYS/README/CREDITS. * *************************************************************************/ #ifndef ROOT_TVersionCheck #define ROOT_TVersionCheck ////////////////////////////////////////////////////////////////////////// // // // TVersionCheck // // // // Used to check if the shared library or plugin is compatible with // // the current version of ROOT. // // // ////////////////////////////////////////////////////////////////////////// #ifdef R__CXXMODULES #ifndef ROOT_TObject #error "Building with modules currently requires this file to be #included through TObject.h" #endif #endif // R__CXXMODULES #include "RVersion.h" class TVersionCheck { public: TVersionCheck(int versionCode); // implemented in TSystem.cxx }; // FIXME: Due to a modules bug: https://llvm.org/bugs/show_bug.cgi?id=31056 // our .o files get polluted with the gVersionCheck symbol despite it was not // visible in this TU. #ifndef R__CXXMODULES #ifndef __CINT__ namespace ROOT { static TVersionCheck gVersionCheck(ROOT_VERSION_CODE); } #endif #endif #endif