/* Copyright (C) 2002 Timo Sirainen */

#include "common.h"
#include "commands.h"

int cmd_create(Client *client)
{
	const char *mailbox;

	/* <mailbox> */
	if (!client_read_string_args(client, 1, &mailbox))
		return FALSE;

	if (!client_verify_mailbox_name(client, mailbox, FALSE, TRUE))
		return TRUE;

	if (mailbox[strlen(mailbox)-1] == client->storage->hierarchy_sep) {
		/* name ends with hierarchy separator - client is just
		   informing us that it wants to create a mailbox under
		   this name. we don't need that information. */
	} else if (!client->storage->create_mailbox(client->storage, mailbox)) {
		client_send_storage_error(client);
		return TRUE;
	}

	client_send_tagline(client, "OK Create completed.");
	return TRUE;
}

/* Copyright (C) 2002 Timo Sirainen */

#include "common.h"
#include "commands.h"

int cmd_create(Client *client)
{
	const char *mailbox;
	int ignore;

	/* <mailbox> */
	if (!client_read_string_args(client, 1, &mailbox))
		return FALSE;

	ignore = mailbox[strlen(mailbox)-1] == client->storage->hierarchy_sep;
	if (ignore) {
		/* name ends with hierarchy separator - client is just
		   informing us that it wants to create a mailbox under
		   this name. we don't need that information, but verify
		   that the mailbox name is valid */
		mailbox = t_strndup(mailbox, strlen(mailbox)-1);
	}

	if (!client_verify_mailbox_name(client, mailbox, FALSE, !ignore))
		return TRUE;

	if (!ignore &&
	    !client->storage->create_mailbox(client->storage, mailbox)) {
		client_send_storage_error(client);
		return TRUE;
	}

	client_send_tagline(client, "OK Create completed.");
	return TRUE;
}

CREATE mailbox<hierarchy separator> failed always.


#pragma once

#include <spotify/json.hpp>

#include "Tile.h"

using namespace spotify::json::codec;

namespace spotify
{
namespace json
{

template<>
struct default_codec_t<Tile>
{
    static object_t<Tile> codec()
    {
        auto codec = object<Tile>();
        codec.required("corners", &Tile::corners);
        codec.required("filename", &Tile::filename);
        codec.required("x", &Tile::x);
        codec.required("y", &Tile::y);
        return codec;
    }
};

}
}

Add a codec for Tile struct

Add a codec for Tile struct


/*
 * 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_ */

Exynos4: Add missing plat header for IRQ combiner


#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_

Add declarations for StartDevice and StopDevice


/*
 * 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_ */

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).


#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;
    }
};

}
}

Add spotify-json codec for sf::Rect<double>

Not templated for the same reason as the sf::Vector2u codec.


//  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

Test only: Correct id to instancetype

Test only: Correct id to instancetype


// RUN: %clang_cc1 -emit-llvm %s -o - | FileCheck %s

extern int foo_alias (void) __asm ("foo");
inline int foo (void) {
  return foo_alias ();
}
int f(void) {
  return foo();
}

// CHECK-NOT: define
// CHECK: define i32 @f()
// CHECK: %call = call i32 @foo()
// CHECK: ret i32 %call
// CHECK-NOT: define

// RUN: %clang_cc1 -emit-llvm %s -o - | FileCheck %s

extern int foo_alias (void) __asm ("foo");
inline int foo (void) {
  return foo_alias ();
}
int f(void) {
  return foo();
}

// CHECK-NOT: define
// CHECK: define i32 @f()
// CHECK: call i32 @foo()
// CHECK-NEXT: ret i32
// CHECK-NOT: define

Fix this tests on the bots.

Fix this tests on the bots.

git-svn-id: ffe668792ed300d6c2daa1f6eba2e0aa28d7ec6c@143052 91177308-0d34-0410-b5e6-96231b3b80d8


// @(#)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

Add accessor to Director of a FriendProxy


#include "commands.h"

#include <stdio.h>
#include <string.h>

#include "util.h"

static void print_commands_help() {
  puts("  Commands available:\n");
  puts("    :quit   \tExit laco");
  puts("    :help   \tDisplay this list of commands");
}

void handle_command(struct LacoState* laco, char* line) {
  if(laco != NULL && line != NULL) {
    const char* command = line + 1;

    if(strcmp(command, "quit") == 0) {
      laco_kill(laco, 0, "Exiting laco...");
    } else if(strcmp(command, "help") == 0)  {
      print_commands_help();
    }

    /* Make it seem like this was an empty line */
    line[0] = '\0';
  }
}

#include "commands.h"

#include <stdbool.h>
#include <stdio.h>

#include "util.h"

static const char* quit_matches[] = {"quit"};
static const char* help_matches[] = {"help"};

static void print_commands_help() {
  puts("  Commands available:\n");
  puts("    :quit   \tExit laco");
  puts("    :help   \tDisplay this list of commands");
}

static inline bool is_quit(const char* command) {
  return laco_is_match(quit_matches, command);
}

static inline bool is_help(const char* command) {
  return laco_is_match(help_matches, command);
}

void handle_command(struct LacoState* laco, char* line) {
  if(laco != NULL && line != NULL) {
    const char* command = line + 1;

    if(is_quit(command)) {
      laco_kill(laco, 0, "Exiting laco...");
    } else if(is_help(command))  {
      print_commands_help();
    }

    /* Make it seem like this was an empty line */
    line[0] = '\0';
  }
}

Use laco_is_match for command handling

Use laco_is_match for command handling


#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_

Disable copy and assign on ScriptObject

Disable copy and assign on ScriptObject


//
//  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

Fix warning about block declaration semantics


#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

Change WINDOWS_YLE_DL_DIR to not have a version number.


#import <CloudMine/CloudMine.h>
#import <CareKit/CareKit.h>

@interface CMHActivityList : CMObject

- (instancetype)init NS_UNAVAILABLE;
- (instancetype)initWithObjectId:(NSString *)theObjectId NS_UNAVAILABLE;

@property (nonatomic, nonnull, readonly) NSArray <OCKCarePlanActivity *> * activities;
- (_Nonnull instancetype)initWithActivities:(NSArray<OCKCarePlanActivity *> *_Nonnull)activities;

@end

#import <CloudMine/CloudMine.h>
#import <CareKit/CareKit.h>

@interface CMHActivityList : CMObject

- (_Null_unspecified instancetype)init NS_UNAVAILABLE;
- (_Null_unspecified instancetype)initWithObjectId:(NSString *_Null_unspecified)theObjectId NS_UNAVAILABLE;

@property (nonatomic, nonnull, readonly) NSArray <OCKCarePlanActivity *> * activities;
- (_Nonnull instancetype)initWithActivities:(NSArray<OCKCarePlanActivity *> *_Nonnull)activities;

@end

Add placeholder nullability annotations to unavailable declarations to prevent warning while building activity list


/*
 * 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");
}

Add http subsystem for later usage and expansion


#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);
            };
        }
    }
}

Fix missing virtual dtor on new type Buddy Michael Chan


#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);
}

Remove hardcoded file path. Still awkward and not generally usable, but _more_ general.


#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

Add initial exported header file

crypto: Add initial exported header file

- Add initial exported header file with relevant structs from
tomcrypt_cipher.h


// ----------------------------------------------------------------------------
// 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);

Fix some comments and type names

Fix some comments and type names


#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");
}

Change MouseWheel deltaWheel field size to one byte. Add compile time size check to Mouse Event.


/*

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

Fix major bug in definition of greatest negative float value

The minimum float value was actually defined as a very small
negative value close to zero, as opposed to a very large negative
value in the direction of minus infinity. This error may have
caused multiple, sometimes hard to pinpoint, bugs.

Also convert the file win32_compat.h to consistent UNIX newlines.


#include "ring.h"

/*
	OpenGL 1.1 Extension
	Copyright (c) 2017 Mahmoud Fayed <msfclipper@yahoo.com>
*/

#include <GL/glew.h>
#include <GL/glut.h>

RING_FUNC(ring_get_gl_zero)
{
	RING_API_RETNUMBER(GL_ZERO);
}

RING_FUNC(ring_get_gl_false)
{
	RING_API_RETNUMBER(GL_FALSE);
}

RING_FUNC(ring_get_gl_logic_op)
{
	RING_API_RETNUMBER(GL_LOGIC_OP);
}

RING_API void ringlib_init(RingState *pRingState)
{
	ring_vm_funcregister("get_gl_zero",ring_get_gl_zero);
	ring_vm_funcregister("get_gl_false",ring_get_gl_false);
	ring_vm_funcregister("get_gl_logic_op",ring_get_gl_logic_op);
}

#include "ring.h"

/*
	OpenGL 1.1 Extension
	Copyright (c) 2017 Mahmoud Fayed <msfclipper@yahoo.com>
*/

#include <GL/glew.h>
#include <GL/glut.h>

RING_FUNC(ring_get_gl_zero)
{
	RING_API_RETNUMBER(GL_ZERO);
}

RING_FUNC(ring_get_gl_false)
{
	RING_API_RETNUMBER(GL_FALSE);
}

RING_FUNC(ring_get_gl_logic_op)
{
	RING_API_RETNUMBER(GL_LOGIC_OP);
}

RING_FUNC(ring_get_gl_none)
{
	RING_API_RETNUMBER(GL_NONE);
}

RING_API void ringlib_init(RingState *pRingState)
{
	ring_vm_funcregister("get_gl_zero",ring_get_gl_zero);
	ring_vm_funcregister("get_gl_false",ring_get_gl_false);
	ring_vm_funcregister("get_gl_logic_op",ring_get_gl_logic_op);
	ring_vm_funcregister("get_gl_none",ring_get_gl_none);
}

Update RingOpenGL 1.1 - Add Constant (Source Code) : GL_NONE


/*     __ __              _
 *    / // /_____ ____   (_)
 *   / // // ___// __ \ / /
 *  / // // /__ / /_/ // /
 * /_//_/ \___/ \____//_/
 * 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);

Update signature of quaternion unit inverse.


/**
 * 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;
}

Add another example! (somando dois números)


/*
 * 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 */

Remove implementation details from API comment


#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 Sanyo LM7000 tuner driver

[media] radio: Add Sanyo LM7000 tuner driver

Add very simple driver for Sanyo LM7000 AM/FM tuner chip. Only FM is supported
as there is no known HW with AM implemented.

This will be used by radio-aimslab and radio-sf16fmi.

Signed-off-by: Ondrej Zary <ba324ca7b1c77fc20bb970d5aff6eea9377918a5@rainbow-software.org>
Acked-by: Hans Verkuil <3a513708f73c27e7d36ebc496aa41dad6a3153ea@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <ad86ba2154032c9f55743a190faa2459a9d61d42@redhat.com>


#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);
}

Add bindings for XOpenDisplay and XCloseDisplay


#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

Increase number of stars to 512.

Increase number of stars to 512.


/*
 * The MIT License (MIT)
 *
 * Copyright (c) 2015 Morwenn
 *
 * 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 CPPSORT_UTILITY_FUNCTIONAL_H_
#define CPPSORT_UTILITY_FUNCTIONAL_H_

////////////////////////////////////////////////////////////
// Headers
////////////////////////////////////////////////////////////
#include <cmath>
#include <utility>

namespace cppsort
{
namespace utility
{
    struct half
    {
        template<typename T>
        constexpr auto operator()(T&& value) const
            -> decltype(std::forward<T>(value) / 2)
        {
            return std::forward<T>(value) / 2;
        }
    };

    struct log
    {
        template<typename T>
        constexpr auto operator()(T&& value) const
            -> decltype(auto)
        {
            using std::log;
            return log(std::forward<T>(value));
        }
    };

    struct sqrt
    {
        template<typename T>
        constexpr auto operator()(T&& value) const
            -> decltype(auto)
        {
            using std::sqrt;
            return sqrt(std::forward<T>(value));
        }
    };
}}

#endif // CPPSORT_UTILITY_FUNCTIONAL_H_

Add somewhat useful function objects.

Add somewhat useful function objects.


#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 a bug with copy cctors, iterators and vector erases. Weird bugs are weird.


#pragma once
#include "Point.h"
#include <SDL/include/SDL.h>

struct Sprite
{
	SDL_Rect Rect;
	iPoint Pivot;
};

#ifndef __SPRITE_H__
#define __SPRITE_H__

#include "Point.h"
#include <SDL/include/SDL.h>

struct Sprite
{
	SDL_Rect Rect;
	iPoint Pivot;
};

#endif // __SPRITE_H__

Substitute pragma once for ifndef guards


#include <stdio.h>
#include <stdlib.h>

int main(int argc, char *argv[])
{
    int x, y, *p, **q;

    p = &x;
    q = &p;
    *q = &y;

    /* int *ptr; */

    /* ptr = malloc(sizeof(int)); */

    /* x = 5; */
    /* *ptr = x; */

    /* int y = *ptr; */

    /* if (y != x) */
    /*     return EXIT_FAILURE; */

    /* ptr = &x; */
    /* printf("%d", *ptr); */
    /* ptr = &argc; */

    return EXIT_SUCCESS;
}

Add a simple example for Andersen's analysis.


#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

Fix state_to_draw_t by adding the number of possible mvts


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

Remove explicit include of packages_config in here - it is included elsewhere in all routines which use this common


#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 */

powerpc: Fix DEBUG_HIGHMEM build break from d4515646699

Code was added to mm/higmem.c that depends on several
kmap types that powerpc does not support.  We add dummy
invalid definitions for KM_NMI, KM_NM_PTE, and KM_IRQ_PTE.

According to list discussion, this fix should not be needed
anymore starting with 2.6.33.  The code is commented to this
effect so hopefully we will remember to remove this.

Signed-off-by: Becky Bruce <f047d6ac93d5e15bc5478b9d8f9d5417f11532d4@kernel.crashing.org>
Signed-off-by: Benjamin Herrenschmidt <a7089bb6e7e92505d88aaff006cbdd60cc9120b6@kernel.crashing.org>


/*
#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

Make iPhone simulator build binary compatible between 3.x and 4.x


/*****************************************************************************/
/*                                                                           */
/* 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);
}

Handle the 'X-Forwarded-For' HTTP header if present


#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; }

Add a testcase to ensure that ctor/dtor attributes work in C

git-svn-id: 0ff597fd157e6f4fc38580e8d64ab130330d2411@6919 91177308-0d34-0410-b5e6-96231b3b80d8


#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

Use = delete for deleted members.

Use = delete for deleted members.

git-svn-id: 43fbdb37a1fde3402d8d2922bf6a94a542354cf8@402 41632dc1-7a16-0410-8441-a1f66f767317


/*-
 * 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 a copyright to this file

Add a copyright to this file


/*
 * 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

Add more flags for mmap() to ignore.

Add more flags for mmap() to ignore.


// =============================================================================
// 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 */

Implement operator<< with template method


// %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; }

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???

git-svn-id: 0ff597fd157e6f4fc38580e8d64ab130330d2411@21432 91177308-0d34-0410-b5e6-96231b3b80d8


#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

Make TRACE depend on DEBUG.

Make TRACE depend on DEBUG.


// 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 problematic example with missed must deadlock


// 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 parameters to a test

Add parameters to a test


// =============================================================================
// 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

Add enum constant TrackCollide::ALL with a value 0xFFFF.

This allows statements such as:
       vehicle.SetCollide(TrackCollide::ALL & ~TrackCollide::IDLER_RIGHT);
to enable contact on all parts except the right idler wheel.


//
//  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 )

Fix warnings and reorganize file.

Fix warnings and reorganize file.


#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;
}

Change comment into descriptive variable name


//
//  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 new header file. (or: xcode is stupid)

git-svn-id: cb3fc60f0f557b927b8032d8a94e869b6f9f230b@318 0fceea05-a30d-0410-8a8b-80ef821fb0a1


//
//  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>

Add missing Yoga headers to umbrella header.

This is needed to avoid warnings.


#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
}

Fix last-minute certificate subject changes


#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");
}

Rename printBinary function and write to string instead

printBinary is now called btoa (binary to ascii)
btoa accepts the number, a buffer and a number of digits
buffer length must be (digits + 1)


/**
 * @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);

};

Fix compile error with missing function declare


/*
 * 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

Remove a warning from NBDS.

Remove a warning from NBDS.


#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__

Modify KernelGlobal structure; decrease TASK_STACK_SIZE


// 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 checked_static_cast to allow null pointers.


#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

Fix PARENT_SKILLS declaration; remove NOSKILL

Why would anyone want to be unskilled anyway?


/* 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;
}

(unw_get_proc_info): Call ia64_make_proc_info() to ensure that the proc_info is
	valid.

2002/12/11 12:26:26-08:00 mostang.com!davidm
Rename: src/ia64/Lget_proc_info.c -> src/ia64/Gget_proc_info.c

(Logical change 1.30)


/**
 * @file
 *
 * @brief tests if compilation works (include and build paths set correct, etc...)
 *
 * @copyright BSD License (see LICENSE.md or https://www.libelektra.org)
 *
 */

#include <gcrypt.h>

gcry_cipher_hd_t nothing ()
{
	gcry_cipher_hd_t elektraCryptoHandle = NULL;
	return elektraCryptoHandle;
}

int main (void)
{
	nothing ();
	return 0;
}

/**
 * @file
 *
 * @brief tests if compilation works (include and build paths set correct, etc...)
 *
 * @copyright BSD License (see LICENSE.md or https://www.libelektra.org)
 *
 */

#include <gcrypt.h>

gcry_cipher_hd_t nothing (void)
{
	gcry_cipher_hd_t elektraCryptoHandle = NULL;
	return elektraCryptoHandle;
}

int main (void)
{
	nothing ();
	return 0;
}

Fix warning in GCrypt test program

Crypto: Fix warning in GCrypt test program


// PARAM: --set ana.activated "['base','threadid','threadflag','escape','malloc_null','mallocWrapper']" --set ana.base.privatization none
#include <stdlib.h>
#include <stdio.h>
#include <assert.h>

int main(void) {
  int *v, *u, r;

  u = (int*)malloc(sizeof(*u));
  v = (int*)malloc(sizeof(*v));

  *u = 10; // WARN
  *v = 10; // WARN

  if (v == 0)
    exit(-1);

  *u = 15; // WARN
  *v = 15; // NOWARN

  if (u == 0)
    exit(-1);

  *u = 20; // NOWARN
  *v = 20; // NOWARN

  if (r){
    u = (int*)malloc(sizeof(*u));
    v = (int*)malloc(sizeof(*v));
  }

  *u = 30; // WARN
  *v = 30; // WARN

  printf("???");

  if (r){
    if (u == 0 || v == 0)
      exit(-1);
  }

  assert(0); // FAIL
  *u = 40; // NOWARN
  *v = 40; // NOWARN

  return 0;
}

// PARAM: --set ana.activated "['base','threadid','threadflag','escape','malloc_null','mallocWrapper']" --set ana.base.privatization none
#include <stdlib.h>
#include <stdio.h>
#include <assert.h>

int main(void) {
  int *v, *u, r;

  u = (int*)malloc(sizeof(*u));
  v = (int*)malloc(sizeof(*v));

  *u = 10; // WARN
  *v = 10; // WARN

  if (v == 0)
    exit(-1);

  *u = 15; // WARN
  *v = 15; // NOWARN

  if (u == 0)
    exit(-1);

  *u = 20; // NOWARN
  *v = 20; // NOWARN

  if (r){
    u = (int*)malloc(sizeof(*u));
    v = (int*)malloc(sizeof(*v));
  }

  *u = 30; // WARN
  *v = 30; // WARN

  printf("???");

  if (r){
    if (u == 0 || v == 0)
      exit(-1);
  }

  *u = 40; // NOWARN
  *v = 40; // NOWARN

  return 0;
}

Remove unnecessary assert(0) from 08/02

Remove unnecessary assert(0) from 08/02


#include <assert.h>

int main()
{
	struct
	{
		struct { int *a; int b; } a[2];
	} b = { .a[1].b = 1 };
	assert(sizeof b.a == 32);
	assert(sizeof b.a[0] == 16);
	assert(b.a[1].b == 1);

	return 0;
}

Add a similar test to the previous one, with arrays this time.


// 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_

Fix the black devtools view.

Fix the black devtools view.

Without using UnderlayOpenGLHostingWindow the devtools view would just
be black.


/*
-----------------------------------------------------------------------------
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

Revert "original structure is out of sync with github"

This reverts commit 8a793e097c75856b7fdd55a5f9d4ed1984e81cae.


// 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;
}

Test normal (backend-)allocas inside VLA scope


#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

Refactor to fix potential buffer overflow.


// 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(); }

Make this pass for CYGWIN.

Make this pass for CYGWIN.

git-svn-id: 0ff597fd157e6f4fc38580e8d64ab130330d2411@44354 91177308-0d34-0410-b5e6-96231b3b80d8


// RUN: clang -### %s -c -o tmp.o -Wa,--noexecstack | grep "-mnoexecstack"

// RUN: clang -### %s -c -o tmp.o -Wa,--noexecstack | grep "mnoexecstack"

Remove the leading hyphen so that grep doesn't parse it as one long option :)

git-svn-id: ffe668792ed300d6c2daa1f6eba2e0aa28d7ec6c@133491 91177308-0d34-0410-b5e6-96231b3b80d8