#define _GNU_SOURCE
#include <stdio.h>
#include <stddef.h>

#include <unistd.h>
#include <sys/mman.h>

void* malloc(size_t size) {
  printf("malloc... ");
  size += sizeof(size_t);
  int page_size = getpagesize();
  int rem = size % page_size;
  if (rem > 0) {
    size += page_size - rem;
  }
  void* addr = mmap(0, size, PROT_READ|PROT_WRITE, MAP_ANONYMOUS|MAP_PRIVATE, -1, 0);
  if (addr == MAP_FAILED) {
    printf("fail\n");
    return NULL;
  }
  printf("ok\n");
  *(size_t*)addr = size;
  return (size_t*)addr + 1;
}

void free (void *ptr) {
  printf("free... ");
  size_t* real_ptr = (size_t*)ptr - 1;
  if (!munmap(real_ptr, *real_ptr)) {
    printf("ok\n");
  } else {
    printf("fail\n");
  }
}

#define _GNU_SOURCE
#include <stdio.h>
#include <stddef.h>

#include <unistd.h>
#include <sys/mman.h>

void* malloc(size_t size) {
  write(STDOUT_FILENO, "malloc... ", 10);
  size += sizeof(size_t);
  int page_size = getpagesize();
  int rem = size % page_size;
  if (rem > 0) {
    size += page_size - rem;
  }
  void* addr = mmap(0, size, PROT_READ|PROT_WRITE, MAP_ANONYMOUS|MAP_PRIVATE, -1, 0);
  if (addr == MAP_FAILED) {
    write(STDOUT_FILENO, "fail\n", 5);
    return NULL;
  }
  write(STDOUT_FILENO, "ok\n", 3);
  *(size_t*)addr = size;
  return (size_t*)addr + 1;
}

void free (void *ptr) {
  write(STDOUT_FILENO, "free... ", 8);
  size_t* real_ptr = (size_t*)ptr - 1;
  if (!munmap(real_ptr, *real_ptr)) {
    write(STDOUT_FILENO, "ok\n", 3);
  } else {
    write(STDOUT_FILENO, "fail\n", 5);
  }
}

Replace printf with safe write to stdout


//=================================================================================================
/*!
//  \file blaze/util/Misalignment.h
//  \brief Header file for the misalignment function
//
//  Copyright (C) 2013 Klaus Iglberger - All Rights Reserved
//
//  This file is part of the Blaze library. You can redistribute it and/or modify it under
//  the terms of the New (Revised) BSD License. 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.
//  3. Neither the names of the Blaze development group nor the names of its 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 HOLDER 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.
*/
//=================================================================================================

#ifndef _BLAZE_UTIL_MISALIGNMENT_H_
#define _BLAZE_UTIL_MISALIGNMENT_H_

//*************************************************************************************************
// Includes
//*************************************************************************************************

#include <blaze/system/Inline.h>
#include <blaze/util/Types.h>
#include <blaze/util/typetraits/AlignmentOf.h>

namespace blaze {

//=================================================================================================
//
//  SIZETRAIT CLASS DEFINITION
//
//=================================================================================================

//*************************************************************************************************
/*!\brief Computes the misalignment of the given address.
// \ingroup util
//
// \param address The address to be checked.
// \return The number of bytes the given address is misaligned.
//
// This function computes the misalignment of the given address with respect to the given data
// type \a Type and the available instruction set (SSE, AVX, ...). It returns the number of bytes
// the address is larger than the next smaller properly aligned address.
*/
template< typename T >
BLAZE_ALWAYS_INLINE size_t misalignment( const T* address )
{
   return ( reinterpret_cast<size_t>( address ) % AlignmentOf<T>::value );
}
//*************************************************************************************************

} // namespace blaze

#endif

Add the 'misalignment' utitlity function


#include <glib/gprintf.h>

int main (int argc, char **argv) {
    gboolean succ = FALSE;
    gchar *err_msg = NULL;

    succ = bd_swap_mkswap ("/dev/xd1", "SWAP", &err_msg);
    if (succ)
        puts ("Succeded.");
    else
        g_printf ("Not succeded: %s\n", err_msg);

    succ = bd_swap_swapon ("/dev/xd1", 5, &err_msg);
    if (succ)
        puts ("Succeded.");
    else
        g_printf ("Not succeded: %s\n", err_msg);

    return 0;
}

#include <glib/gprintf.h>

int main (int argc, char **argv) {
    gboolean succ = FALSE;
    gchar *err_msg = NULL;

    succ = bd_swap_mkswap ("/dev/xd1", "SWAP", &err_msg);
    if (succ)
        puts ("Succeded.");
    else
        g_printf ("Not succeded: %s", err_msg);

    succ = bd_swap_swapon ("/dev/xd1", 5, &err_msg);
    if (succ)
        puts ("Succeded.");
    else
        g_printf ("Not succeded: %s", err_msg);

    return 0;
}

Remove newlines from the swap test outputs

They are already included in the utility's output.


#include <stdlib.h>

#include "py/lexer.h"
#include "memzip.h"

mp_lexer_t *mp_lexer_new_from_file(const char *filename)
{
    void *data;
    size_t len;

    if (memzip_locate(filename, &data, &len) != MZ_OK) {
        return NULL;
    }

    return mp_lexer_new_from_str_len(qstr_from_str(filename), (const char *)data, (mp_uint_t)len, 0);
}

#include <stdlib.h>

#include "py/lexer.h"
#include "py/runtime.h"
#include "py/mperrno.h"
#include "memzip.h"

mp_lexer_t *mp_lexer_new_from_file(const char *filename)
{
    void *data;
    size_t len;

    if (memzip_locate(filename, &data, &len) != MZ_OK) {
        mp_raise_OSError(MP_ENOENT);
    }

    return mp_lexer_new_from_str_len(qstr_from_str(filename), (const char *)data, (mp_uint_t)len, 0);
}

lib/memzip: Make lexer constructor raise exception when file not found.


#include <string.h>
#include <stdbool.h>

#include "roman_convert_to_int.h"
#include "roman_clusters.h"

static const int ERROR = -1;

static bool starts_with(const char *str, RomanCluster cluster);

int roman_convert_to_int(const char *numeral)
{
	if (!numeral) return ERROR;

	int total = 0;
	for (int cluster_index = 0; cluster_index < ROMAN_CLUSTERS_LENGTH; cluster_index++)
	{
		const RomanCluster cluster = ROMAN_CLUSTERS[cluster_index];
		while (starts_with(numeral, cluster))
		{
			total += cluster.value;
			numeral += cluster.length;
		}
	}

	return *numeral ? ERROR : total;
}

static bool starts_with(const char *str, RomanCluster cluster)
{
	return strncmp(str, cluster.letters, cluster.length) == 0;
}

#include <string.h>
#include <stdbool.h>

#include "roman_convert_to_int.h"
#include "roman_clusters.h"

static const int ERROR = -1;

static bool starts_with(const char *str, RomanCluster cluster);

int roman_convert_to_int(const char *numeral)
{
	if (!numeral) return ERROR;

	int total = 0;
	for (const RomanCluster *cluster = roman_cluster_largest();
			cluster;
			cluster = roman_cluster_next_smaller(cluster)
	    )
	{
		while (starts_with(numeral, *cluster))
		{
			total += cluster->value;
			numeral += cluster->length;
		}
	}

	return *numeral ? ERROR : total;
}

static bool starts_with(const char *str, RomanCluster cluster)
{
	return strncmp(str, cluster.letters, cluster.length) == 0;
}

Use cluster iterator in to_int function

Use cluster iterator in to_int function


#pragma once

#include <spotify/json.hpp>

#include "Options.h"
#include "metaoutput/codecs/FilenamesCodec.h"
#include "TerrainSpecCodec.h"
#include "TileFormatCodec.h"

using namespace spotify::json::codec;

namespace spotify
{
namespace json
{

template<>
struct default_codec_t<Options>
{
    static object_t<Options> codec()
    {
        auto codec = object<Options>();
        codec.required("OutputDirectory", &Options::outputDirectory);
        codec.required("Terrains", &Options::terrains);
        codec.required("TileFormat", &Options::tileFormat);
        codec.required("Cliques", &Options::cliques);
        codec.required("MetaOutput", &Options::outputFilenames);
        codec.required("CalculatorMode", &Options::CalculatorMode,
                       codec::enumeration<tilegen::alpha::CalculatorMode, std::string>({
                           {tilegen::alpha::CalculatorMode::Max, "Max"},
                           {tilegen::alpha::CalculatorMode::Linear, "Linear"}}));

        return codec;
    }
};

}
}

#pragma once

#include <spotify/json.hpp>

#include "Options.h"
#include "metaoutput/codecs/FilenamesCodec.h"
#include "TerrainSpecCodec.h"
#include "TileFormatCodec.h"

using namespace spotify::json::codec;

namespace spotify
{
namespace json
{

template<>
struct default_codec_t<Options>
{
    static object_t<Options> codec()
    {
        auto codec = object<Options>();
        codec.required("OutputDirectory", &Options::outputDirectory);
        codec.required("Terrains", &Options::terrains);
        codec.required("TileFormat", &Options::tileFormat);
        codec.required("Cliques", &Options::cliques);
        codec.required("MetaOutput", &Options::outputFilenames);
        codec.required("AlphaCalculatorMode", &Options::CalculatorMode,
                       codec::enumeration<tilegen::alpha::CalculatorMode, std::string>({
                           {tilegen::alpha::CalculatorMode::Max, "Max"},
                           {tilegen::alpha::CalculatorMode::Linear, "Linear"}}));

        return codec;
    }
};

}
}

Revert to AlphaCalculatorMode in options codec


#include <stddef.h>
#include <kernel/port/data.h>

void enq(Queue *q, List *item) {
	item->next = NULL;
	if(!q->tail) {
		q->head = item;
		q->tail = item;
	} else {
		q->tail->next = item;
	}
}

List *deq(Queue *q) {
	if(!q->head) {
		return NULL;
	}
	List *ret = q->head;
	q->head = q->head->next;
	if(!q->head) {
		q->tail = NULL;
	}
	ret->next = NULL;
	return ret;
}

#include <stddef.h>
#include <kernel/port/data.h>

void enq(Queue *q, List *item) {
	item->next = NULL;
	if(!q->tail) {
		q->head = item;
		q->tail = item;
	} else {
		q->tail->next = item;
		q->tail = item;
	}
}

List *deq(Queue *q) {
	if(!q->head) {
		return NULL;
	}
	List *ret = q->head;
	q->head = q->head->next;
	if(!q->head) {
		q->tail = NULL;
	}
	ret->next = NULL;
	return ret;
}

Fix a bug in the queue implementation

Fix a bug in the queue implementation

Unfortunately this was not the problem with the scheduler. For some
reason we're never getting a second timer interrupt.


#pragma once

#include "preprocessor/llvm_includes_start.h"
#include <llvm/IR/IRBuilder.h>
#include "preprocessor/llvm_includes_end.h"

namespace dev
{
namespace eth
{
namespace jit
{
class RuntimeManager;

/// Base class for compiler helpers like Memory, GasMeter, etc.
class CompilerHelper
{
protected:
	CompilerHelper(llvm::IRBuilder<>& _builder);

	CompilerHelper(const CompilerHelper&) = delete;
	CompilerHelper& operator=(CompilerHelper) = delete;

	/// Reference to the IR module being compiled
	llvm::Module* getModule();

	/// Reference to the main module function
	llvm::Function* getMainFunction();

	/// Reference to parent compiler IR builder
	llvm::IRBuilder<>& m_builder;
	llvm::IRBuilder<>& getBuilder() { return m_builder; }

	llvm::CallInst* createCall(llvm::Function* _func, std::initializer_list<llvm::Value*> const& _args);

	friend class RuntimeHelper;
};

/// Compiler helper that depends on runtime data
class RuntimeHelper : public CompilerHelper
{
protected:
	RuntimeHelper(RuntimeManager& _runtimeManager);

	RuntimeManager& getRuntimeManager() { return m_runtimeManager; }

private:
	RuntimeManager& m_runtimeManager;
};

using InsertPointGuard = llvm::IRBuilderBase::InsertPointGuard;

}
}
}

#pragma once

#include "preprocessor/llvm_includes_start.h"
#include <llvm/IR/IRBuilder.h>
#include "preprocessor/llvm_includes_end.h"

namespace dev
{
namespace eth
{
namespace jit
{
class RuntimeManager;

/// Base class for compiler helpers like Memory, GasMeter, etc.
class CompilerHelper
{
protected:
	CompilerHelper(llvm::IRBuilder<>& _builder);

	CompilerHelper(const CompilerHelper&) = delete;
	CompilerHelper& operator=(CompilerHelper) = delete;

	/// Reference to the IR module being compiled
	llvm::Module* getModule();

	/// Reference to the main module function
	llvm::Function* getMainFunction();

	/// Reference to parent compiler IR builder
	llvm::IRBuilder<>& m_builder;
	llvm::IRBuilder<>& getBuilder() { return m_builder; }

	llvm::CallInst* createCall(llvm::Function* _func, std::initializer_list<llvm::Value*> const& _args);

	friend class RuntimeHelper;
};

/// Compiler helper that depends on runtime data
class RuntimeHelper : public CompilerHelper
{
protected:
	RuntimeHelper(RuntimeManager& _runtimeManager);

	RuntimeManager& getRuntimeManager() { return m_runtimeManager; }

private:
	RuntimeManager& m_runtimeManager;
};

struct InsertPointGuard
{
	explicit InsertPointGuard(llvm::IRBuilderBase& _builder): m_builder(_builder), m_insertPoint(_builder.saveIP()) {}
	~InsertPointGuard() { m_builder.restoreIP(m_insertPoint); }

private:
	llvm::IRBuilderBase& m_builder;
	decltype(m_builder.saveIP()) m_insertPoint;
};

}
}
}

Reimplement InsertPointGuard to avoid LLVM ABI incompatibility.

In general, the NDEBUG flag should match cpp-ethereum and LLVM builds. But this is hard to satisfy as we usually have one system-wide build of LLVM and different builds of cpp-ethereum. This ABI incompatibility hit OSX only in release builds as LLVM is built by homebrew with assertions by default.


//===-- llvm/Instrinsics.h - LLVM Intrinsic Function Handling ---*- C++ -*-===//
//
// This file defines a set of enums which allow processing of intrinsic
// functions.  Values of these enum types are returned by
// Function::getIntrinsicID.
//
//===----------------------------------------------------------------------===//

#ifndef LLVM_INTRINSICS_H
#define LLVM_INTRINSICS_H

/// LLVMIntrinsic Namespace - This namespace contains an enum with a value for
/// every intrinsic/builtin function known by LLVM.  These enum values are
/// returned by Function::getIntrinsicID().
///
namespace LLVMIntrinsic {
  enum ID {
    not_intrinsic = 0,   // Must be zero

    va_start,            // Used to represent a va_start call in C
    va_end,              // Used to represent a va_end call in C
    va_copy,             // Used to represent a va_copy call in C

    setjmp,              // Used to represent a setjmp call in C
    longjmp,             // Used to represent a longjmp call in C
  };
}

#endif

//===-- llvm/Instrinsics.h - LLVM Intrinsic Function Handling ---*- C++ -*-===//
//
// This file defines a set of enums which allow processing of intrinsic
// functions.  Values of these enum types are returned by
// Function::getIntrinsicID.
//
//===----------------------------------------------------------------------===//

#ifndef LLVM_INTRINSICS_H
#define LLVM_INTRINSICS_H

/// LLVMIntrinsic Namespace - This namespace contains an enum with a value for
/// every intrinsic/builtin function known by LLVM.  These enum values are
/// returned by Function::getIntrinsicID().
///
namespace LLVMIntrinsic {
  enum ID {
    not_intrinsic = 0,   // Must be zero

    va_start,       // Used to represent a va_start call in C
    va_end,         // Used to represent a va_end call in C
    va_copy,        // Used to represent a va_copy call in C

    setjmp,         // Used to represent a setjmp call in C
    longjmp,        // Used to represent a longjmp call in C

    //===------------------------------------------------------------------===//
    // This section defines intrinsic functions used to represent Alpha
    // instructions...
    //
    alpha_ctlz,     // CTLZ (count leading zero): counts the number of leading
                    // zeros in the given ulong value
    alpha_cttz,     // CTTZ (count trailing zero): counts the number of trailing
                    // zeros in the given ulong value
    alpha_ctpop,    // CTPOP (count population): counts the number of ones in
                    // the given ulong value
    alpha_umulh,    // UMULH (unsigned multiply quadword high): Takes two 64-bit
                    // (ulong) values, and returns the upper 64 bits of their
                    // 128 bit product as a ulong
  };
}

#endif

Add alpha intrinsics, contributed by Rahul Joshi

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


#pragma once

#include <cassert>
#include <string>

#define assert2(expr, str) \
  ((expr)                  \
   ? __ASSERT_VOID_CAST (0)\
   : __assert_fail ((std::string(__STRING(expr)) + "; " + (str)).c_str(), __FILE__, __LINE__, __ASSERT_FUNCTION))

#pragma once

#include <cassert>
#include <string>

#if __GNUC__
#define assert2(expr, str) \
  ((expr)                  \
   ? __ASSERT_VOID_CAST (0)\
   : __assert_fail ((std::string(__STRING(expr)) + "; " + (str)).c_str(), __FILE__, __LINE__, __ASSERT_FUNCTION))
#elif __clang__
#define assert2(expr, str) \
  ((expr)                  \
   ? (void)(0)\
   : __assert_rtn ((std::string(__STRING(expr)) + "; " + (str)).c_str(), __FILE__, __LINE__, __func__))
#else
#define assert2(expr, str) assert(expr)
#endif

Work better on various versions of clang.


/* $OpenBSD: version.h,v 1.37 2003/04/01 10:56:46 markus Exp $ */
/* $FreeBSD$ */

#ifndef SSH_VERSION

#define SSH_VERSION             (ssh_version_get())
#define SSH_VERSION_BASE        "OpenSSH_3.6.1p1"
#define SSH_VERSION_ADDENDUM    "FreeBSD-20030423"

const char *ssh_version_get(void);
void ssh_version_set_addendum(const char *add);
#endif /* SSH_VERSION */

/* $OpenBSD: version.h,v 1.37 2003/04/01 10:56:46 markus Exp $ */
/* $FreeBSD$ */

#ifndef SSH_VERSION

#define SSH_VERSION             (ssh_version_get())
#define SSH_VERSION_BASE        "OpenSSH_3.6.1p1"
#define SSH_VERSION_ADDENDUM    "FreeBSD-20030916"

const char *ssh_version_get(void);
void ssh_version_set_addendum(const char *add);
#endif /* SSH_VERSION */

Update the OpenSSH addendum string for the buffer handling fix.


#if defined(AIX32) && defined(__cplusplus )
#	include "fix_gnu_fcntl.h"
#elif defined(AIX32) && !defined(__cplusplus )
	typedef unsigned short ushort;
#	include <fcntl.h>
#elif defined(ULTRIX42) && defined(__cplusplus )
#	include "fix_gnu_fcntl.h"
#else
#	include <fcntl.h>
#endif

#if defined(__cplusplus) && !defined(OSF1)	/* GNU G++ */
#	include "fix_gnu_fcntl.h"
#elif defined(AIX32)						/* AIX bsdcc */
#	typedef unsigned short ushort;
#	include <fcntl.h>
#else										/* Everybody else */
#	include <fcntl.h>
#endif

Make things depend on the compiler (G++, bsdcc, others) rather than on specific platforms.


// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef CHROME_BROWSER_EXTENSIONS_EXTENSION_MESSAGE_HANDLER_H_
#define CHROME_BROWSER_EXTENSIONS_EXTENSION_MESSAGE_HANDLER_H_
#pragma once

#include "content/browser/renderer_host/render_view_host_observer.h"

class Profile;
struct ExtensionHostMsg_DomMessage_Params;

// Filters and dispatches extension-related IPC messages that arrive from
// renderer/extension processes.  This object is created for renderers and also
// ExtensionHost/BackgroundContents.  Contrast this with ExtensionTabHelper,
// which is only created for TabContents.
class ExtensionMessageHandler : public RenderViewHostObserver {
 public:
  // |sender| is guaranteed to outlive this object.
  explicit ExtensionMessageHandler(RenderViewHost* render_view_host);
  virtual ~ExtensionMessageHandler();

  // RenderViewHostObserver overrides.
  virtual bool OnMessageReceived(const IPC::Message& message);

 private:
  // Message handlers.
  void OnPostMessage(int port_id, const std::string& message);
  void OnRequest(const ExtensionHostMsg_DomMessage_Params& params);

  DISALLOW_COPY_AND_ASSIGN(ExtensionMessageHandler);
};

#endif  // CHROME_BROWSER_EXTENSIONS_EXTENSION_MESSAGE_HANDLER_H_

// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef CHROME_BROWSER_EXTENSIONS_EXTENSION_MESSAGE_HANDLER_H_
#define CHROME_BROWSER_EXTENSIONS_EXTENSION_MESSAGE_HANDLER_H_
#pragma once

#include "content/browser/renderer_host/render_view_host_observer.h"

class Profile;
struct ExtensionHostMsg_DomMessage_Params;

// Filters and dispatches extension-related IPC messages that arrive from
// renderers. There is one of these objects for each RenderViewHost in Chrome.
// Contrast this with ExtensionTabHelper, which is only created for TabContents.
class ExtensionMessageHandler : public RenderViewHostObserver {
 public:
  // |sender| is guaranteed to outlive this object.
  explicit ExtensionMessageHandler(RenderViewHost* render_view_host);
  virtual ~ExtensionMessageHandler();

  // RenderViewHostObserver overrides.
  virtual bool OnMessageReceived(const IPC::Message& message);

 private:
  // Message handlers.
  void OnPostMessage(int port_id, const std::string& message);
  void OnRequest(const ExtensionHostMsg_DomMessage_Params& params);

  DISALLOW_COPY_AND_ASSIGN(ExtensionMessageHandler);
};

#endif  // CHROME_BROWSER_EXTENSIONS_EXTENSION_MESSAGE_HANDLER_H_

Clarify class comment for ExtensionMessageHandler.

TBR=jam@chromium.org

git-svn-id: de016e52bd170d2d4f2344f9bf92d50478b649e0@82674 0039d316-1c4b-4281-b951-d872f2087c98


//
//  ReactiveAlamofire.h
//  ReactiveAlamofire
//
//  Created by Srdan Rasic on 23/04/16.
//  Copyright © 2016 ReactiveKit. All rights reserved.
//

//! Project version number for ReactiveAlamofire.
FOUNDATION_EXPORT double ReactiveAlamofireVersionNumber;

//! Project version string for ReactiveAlamofire.
FOUNDATION_EXPORT const unsigned char ReactiveAlamofireVersionString[];

// In this header, you should import all the public headers of your framework using statements like #import <ReactiveAlamofire/PublicHeader.h>

//
//  ReactiveAlamofire.h
//  ReactiveAlamofire
//
//  Created by Srdan Rasic on 23/04/16.
//  Copyright © 2016 ReactiveKit. All rights reserved.
//

#import <Foundation/Foundation.h>

//! Project version number for ReactiveAlamofire.
FOUNDATION_EXPORT double ReactiveAlamofireVersionNumber;

//! Project version string for ReactiveAlamofire.
FOUNDATION_EXPORT const unsigned char ReactiveAlamofireVersionString[];

// In this header, you should import all the public headers of your framework using statements like #import <ReactiveAlamofire/PublicHeader.h>

Use Foundation framework instead of UIKit.


#ifndef H_MISCFN
#define H_MISCFN

#include "config.h"

#if HAVE_FNMATCH_H
#include <fnmatch.h>
#else
#include "misc-fnmatch.h"
#endif

#if HAVE_GLOB_H
#include <glob.h>
#else
#include "misc-glob.h"
#endif

#if ! HAVE_S_IFSOCK
#define S_IFSOCK (0)
#endif

#if ! HAVE_S_ISLNK
#define S_ISLNK(mode) ((mode) & S_IFLNK)
#endif

#if ! HAVE_S_ISSOCK
#define S_ISSOCK(mode) ((mode) & S_IFSOCK)
#endif

#if NEED_STRINGS_H
#include <strings.h>
#endif

#if ! HAVE_REALPATH
char *realpath(const char *path, char resolved_path []);
#endif

#if NEED_TIMEZONE
#include <sys/stdtypes.h>
extern time_t timezone;
#endif

#if NEED_MYREALLOC
#include <sys/stdtypes.h>
#define realloc(ptr,size) myrealloc(ptr,size)
extern void *myrealloc(void *, size_t);
#endif

#if HAVE_SYS_SOCKET_H
#include <sys/socket.h>
#endif

#endif

#ifndef H_MISCFN
#define H_MISCFN

#include "config.h"

#if HAVE_FNMATCH_H
#include <fnmatch.h>
#else
#include "misc-fnmatch.h"
#endif

#if HAVE_GLOB_H
#include <glob.h>
#else
#include "misc-glob.h"
#endif

#if ! HAVE_S_IFSOCK
#define S_IFSOCK (0)
#endif

#if ! HAVE_S_ISLNK
#define S_ISLNK(mode) ((mode) & S_IFLNK)
#endif

#if ! HAVE_S_ISSOCK
#define S_ISSOCK(mode) ((mode) & S_IFSOCK)
#endif

#if NEED_STRINGS_H
#include <strings.h>
#endif

#if ! HAVE_REALPATH
char *realpath(const char *path, char resolved_path []);
#endif

#if NEED_TIMEZONE
#include <sys/stdtypes.h>
extern time_t timezone;
#endif

#if NEED_MYREALLOC
#include <sys/stdtypes.h>
#define realloc(ptr,size) myrealloc(ptr,size)
extern void *myrealloc(void *, size_t);
#endif

#if HAVE_SYS_SOCKET_H
#include <sys/socket.h>
#endif

#if HAVE_LIMITS_H
#include <limits.h>
#endif

#endif

Include <limits.h> if it's available.

Include <limits.h> if it's available.


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

#include "nrf51.h"
#include "nrf_delay.h"

#include "error.h"
#include "gpio.h"
#include "leds.h"
#include "radio.h"

void error_handler(uint32_t err_code, uint32_t line_num, char * file_name)
{
    while (1)
    {
        for (uint8_t i = LED_START; i < LED_STOP; i++)
        {
            led_toggle(i);
            nrf_delay_us(50000);
        }
    }
}
void radio_evt_handler(radio_evt_t * evt)
{

}

int main(void)
{
    uint8_t i = 0;
    uint32_t err_code;

    leds_init();

    radio_packet_t packet;
    packet.len = 4;
    packet.flags.ack = 0;

    radio_init(radio_evt_handler);

    while (1)
    {
        packet.data[0] = i++;
        packet.data[1] = 0x12;
        err_code = radio_send(&packet);
        ASSUME_SUCCESS(err_code);

        packet.data[0] = i++;
        packet.data[1] = 0x12;
        err_code = radio_send(&packet);
        ASSUME_SUCCESS(err_code);

        led_toggle(LED0);
        nrf_delay_us(1000000);
    }
}

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

#include "nrf51.h"
#include "nrf_delay.h"

#include "error.h"
#include "gpio.h"
#include "leds.h"
#include "radio.h"

void error_handler(uint32_t err_code, uint32_t line_num, char * file_name)
{
    while (1)
    {
        for (uint8_t i = LED_START; i < LED_STOP; i++)
        {
            led_toggle(i);
            nrf_delay_us(50000);
        }
    }
}
void radio_evt_handler(radio_evt_t * evt)
{

}

int main(void)
{
    uint8_t i = 0;
    uint32_t err_code;

    leds_init();

    radio_packet_t packet;
    packet.len = 4;
    packet.flags.ack = 0;

    radio_init(radio_evt_handler);

    while (1)
    {
        packet.data[0] = i++;
        packet.data[1] = 0x12;
        err_code = radio_send(&packet);
        ASSUME_SUCCESS(err_code);

        led_toggle(LED0);
        nrf_delay_us(1000000);
    }
}

Send only one packet at a time.

Send only one packet at a time.


//
//  GITBlob.h
//  CocoaGit
//
//  Created by Geoffrey Garside on 29/06/2008.
//  Copyright 2008 ManicPanda.com. All rights reserved.
//

#import <Cocoa/Cocoa.h>
#import "GITObject.h"

@interface GITBlob : GITObject {
    NSData * data;
}

#pragma mark -
#pragma mark Properties
@property(retain) NSData * data;

#pragma mark -
#pragma mark Init Methods
- (id)initWithContentsOfFile:(NSString*)filePath;
- (id)initWithData:(NSData*)dataContent;

#pragma mark -
#pragma mark Instance Methods
- (BOOL)write;
- (BOOL)writeWithError:(NSError**)errorPtr;
@end

//
//  GITBlob.h
//  CocoaGit
//
//  Created by Geoffrey Garside on 29/06/2008.
//  Copyright 2008 ManicPanda.com. All rights reserved.
//

#import <Cocoa/Cocoa.h>
#import "GITObject.h"

@interface GITBlob : GITObject {
    NSData * data;
}

#pragma mark -
#pragma mark Properties
@property(retain) NSData * data;

#pragma mark -
#pragma mark Reading existing Blob objects
- (id)initFromHash:(NSString*)objectHash;

#pragma mark -
#pragma mark Creating new Blob objects
- (id)initWithData:(NSData*)dataContent;
- (id)initWithContentsOfFile:(NSString*)filePath;

#pragma mark -
#pragma mark Instance Methods
- (BOOL)write;
- (BOOL)writeWithError:(NSError**)errorPtr;
@end

Add pragmas to differentiate init method types


#ifndef __ASMARM_ARCH_SCU_H
#define __ASMARM_ARCH_SCU_H

#define SCU_PM_NORMAL	0
#define SCU_PM_DORMANT	2
#define SCU_PM_POWEROFF	3

#ifndef __ASSEMBLER__
unsigned int scu_get_core_count(void __iomem *);
void scu_enable(void __iomem *);
int scu_power_mode(void __iomem *, unsigned int);
#endif

#endif

#ifndef __ASMARM_ARCH_SCU_H
#define __ASMARM_ARCH_SCU_H

#define SCU_PM_NORMAL	0
#define SCU_PM_DORMANT	2
#define SCU_PM_POWEROFF	3

#ifndef __ASSEMBLER__

#include <asm/cputype.h>

static inline bool scu_a9_has_base(void)
{
	return read_cpuid_part_number() == ARM_CPU_PART_CORTEX_A9;
}

static inline unsigned long scu_a9_get_base(void)
{
	unsigned long pa;

	asm("mrc p15, 4, %0, c15, c0, 0" : "=r" (pa));

	return pa;
}

unsigned int scu_get_core_count(void __iomem *);
void scu_enable(void __iomem *);
int scu_power_mode(void __iomem *, unsigned int);
#endif

#endif

ARM: Add API to detect SCU base address from CP15

Add API to detect SCU base address from CP15.

Signed-off-by: Hiroshi Doyu <7e37d737f0c384c0dce297667d084735fade9098@nvidia.com>
Acked-by: Russell King <f6aa0246ff943bfa8602cdf60d40c481b38ed232@arm.linux.org.uk>
Signed-off-by: Stephen Warren <5ef2a23ba3aff51d1cfc8c113c1ec34b608b3b13@nvidia.com>


/*
 * This file is subject to the terms and conditions of the GNU General Public
 * License.  See the file "COPYING" in the main directory of this archive
 * for more details.
 *
 * Copyright (C) 2003 Ralf Baechle
 */
#ifndef __ASM_MACH_IP22_CPU_FEATURE_OVERRIDES_H
#define __ASM_MACH_IP22_CPU_FEATURE_OVERRIDES_H

/*
 * IP22 with a variety of processors so we can't use defaults for everything.
 */
#define cpu_has_mips16		0
#define cpu_has_divec		0
#define cpu_has_cache_cdex_p	1
#define cpu_has_prefetch	0
#define cpu_has_mcheck		0
#define cpu_has_ejtag		0

#define cpu_has_llsc		1
#define cpu_has_vtag_icache	0		/* Needs to change for R8000 */
#define cpu_has_dc_aliases	(PAGE_SIZE < 0x4000)
#define cpu_has_ic_fills_f_dc	0

#define cpu_has_dsp		0

#define cpu_has_nofpuex		0
#define cpu_has_64bits		1

#endif /* __ASM_MACH_IP22_CPU_FEATURE_OVERRIDES_H */

/*
 * This file is subject to the terms and conditions of the GNU General Public
 * License.  See the file "COPYING" in the main directory of this archive
 * for more details.
 *
 * Copyright (C) 2003 Ralf Baechle
 */
#ifndef __ASM_MACH_IP22_CPU_FEATURE_OVERRIDES_H
#define __ASM_MACH_IP22_CPU_FEATURE_OVERRIDES_H

/*
 * IP22 with a variety of processors so we can't use defaults for everything.
 */
#define cpu_has_tlb		1
#define cpu_has_4kex		1
#define cpu_has_4ktlb		1
#define cpu_has_fpu		1
#define cpu_has_32fpr		1
#define cpu_has_counter		1
#define cpu_has_mips16		0
#define cpu_has_divec		0
#define cpu_has_cache_cdex_p	1
#define cpu_has_prefetch	0
#define cpu_has_mcheck		0
#define cpu_has_ejtag		0

#define cpu_has_llsc		1
#define cpu_has_vtag_icache	0		/* Needs to change for R8000 */
#define cpu_has_dc_aliases	(PAGE_SIZE < 0x4000)
#define cpu_has_ic_fills_f_dc	0

#define cpu_has_dsp		0

#define cpu_has_nofpuex		0
#define cpu_has_64bits		1

#endif /* __ASM_MACH_IP22_CPU_FEATURE_OVERRIDES_H */

Define some more common ip22 CPU features.

Signed-off-by: Thiemo Seufer <8e77f49f827b66c39fd886f99e6ef704c1fecc26@networkno.de>
Signed-off-by: Ralf Baechle <92f48d309cda194c8eda36aa8f9ae28c488fa208@linux-mips.org>


#include "cearth_network.h"

void
blob_init(blob *b)
{
        b->size = 0;
}

void
blob_add_int8(blob *b, int8_t i)
{
        b->data[b->size] = i;
        b->size++;
}

void
blob_add_str(blob *b, char *str)
{
        int len = strlen(str);
        strcpy((char *)b->data+b->size, str);
        b->size += len;
}

Remove all trace functions from pre 0.0.1 prototyping


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

typedef struct list_t {
    int data;
    struct list_t *next;
} list_t;

list_t *insert_start(list_t *list, int data) {
	list_t *node = malloc(sizeof(list_t));
	node->data = data;
	node->next = list;
	return node;
}

list_t *insert_end(list_t *list, int data) {
	list_t *node = malloc(sizeof(list_t));
	node->data = data;
	node->next = list;
	if (list == NULL)
		return node;
	list_t *temp = list;
	while (temp->next != NULL)
		temp = temp->next;
	temp->next = node;
	node->next = NULL;
	return list;
}

list_t *remove_first(list_t *list) {
    if (list == NULL)
    	return NULL;
    list_t *next = list->next;
    free(list);
    return next;
}

void print_list(list_t *list) {
	while (list != NULL) {
		printf("%d ", list->data);
		list = list->next;
	}
	printf("\n");
}

int main(void) {
	list_t *list = NULL;
	list = insert_start(list, 6);
	list = insert_start(list, 3);
	list = insert_start(list, 1);
	print_list(list);
	list = remove_first(list);
	print_list(list);
	list = insert_end(list, 12);
	list = insert_end(list, 13);
	list = insert_end(list, 14);
	print_list(list);
}

Add a single linked list

Add a single linked list


#ifndef H_RPM_RB
#define H_RPM_RB

/**
 * \file ruby/rpm-rb.h
 * \ingroup rb_c
 *
 * RPM Ruby bindings "RPM" module
 */

#include "system.h"

#include <rpmiotypes.h>

#include <rpmtypes.h>
#include <rpmtag.h>

#undef  xmalloc
#undef  xcalloc
#undef  xrealloc
#pragma GCC diagnostic ignored "-Wstrict-prototypes"
#include <ruby.h>
#pragma GCC diagnostic warning "-Wstrict-prototypes"

/**
 * The "RPM" Ruby module.
 */
extern VALUE rpmModule;

#ifdef __cplusplus
extern "C" {
#endif

/**
 * Defines the "RPM" Ruby module and makes it known to the Interpreter.
 */
void Init_rpm(void);

/**
 * Raises a Ruby exception (RPM::Error).
 *
 * @param error     The return code leading to the exception
 * @param message   A message to include in the exception.
 */
void rpm_rb_raise(rpmRC error, char *message);

#ifdef __cplusplus
}
#endif

#endif	/* H_RPM_RB */

#ifndef H_RPM_RB
#define H_RPM_RB

/**
 * \file ruby/rpm-rb.h
 * \ingroup rb_c
 *
 * RPM Ruby bindings "RPM" module
 */

#include "system.h"

#include <rpmiotypes.h>

#include <rpmtypes.h>
#include <rpmtag.h>

/**
 * The "RPM" Ruby module.
 */
extern VALUE rpmModule;

#ifdef __cplusplus
extern "C" {
#endif

/**
 * Defines the "RPM" Ruby module and makes it known to the Interpreter.
 */
void Init_rpm(void);

/**
 * Raises a Ruby exception (RPM::Error).
 *
 * @param error     The return code leading to the exception
 * @param message   A message to include in the exception.
 */
void rpm_rb_raise(rpmRC error, char *message);

#ifdef __cplusplus
}
#endif

#endif	/* H_RPM_RB */

Fix header file inclusion/define problems with xmalloc & Co and ruby


#pragma once

namespace cpu {

struct stack_frame {
    uint32_t ebx;
    uint32_t ecx;
    uint32_t edx;
    uint32_t esi;
    uint32_t edi;
    uint32_t ebp;
    uint32_t eax;
    uint16_t ds, __ds;
    uint16_t es, __es;
    uint16_t fs, __fs;
    uint16_t gs, __gs;
    uint32_t eip;
    uint16_t cs, __cs;
    uint32_t eflags;
    uint32_t esp;
    uint16_t ss, __ss;
};

} // namespace cpu

Add structure for stack frame

Add structure for stack frame


#ifndef _RSA_H_
#define _RSA_H_

#include "mpi.h"

/* Everything must be kept private except for n and e.
 * (n,e) is the public key, (n,d) is the private key. */
typedef struct {
	mpi_t	n;		/* modulus n = pq */
	mpi_t	phi;	/* phi = (p-1)(q-1) */
	mpi_t	e;		/* public exponent 1 < e < phi s.t. gcd(e,phi)=1 */
	mpi_t	d;		/* secret exponent 1 < d < phi s.t. ed=1 (mod phi) */
} rsa_ctx;

void rsa_init(rsa_ctx *rsa, unsigned bits, mp_rand_ctx *rand_ctx);
void rsa_free(rsa_ctx *rsa);

/* Transform cleartext into encrypted data. */
void rsa_encrypt(rsa_ctx *ctx, const void *input, unsigned input_size,
				 void *output, unsigned *output_size);
/* Transform encrypted data back to cleartext. */
void rsa_decrypt(rsa_ctx *ctx, const void *input, unsigned input_size,
				 void *output, unsigned *output_size);

#endif /* !_RSA_H_ */

#ifndef _RSA_H_
#define _RSA_H_

#include "mpi.h"

/* Everything must be kept private except for n and e.
 * (n,e) is the public key, (n,d) is the private key. */
typedef struct {
	mpi_t	n;		/* modulus n = pq */
	mpi_t	phi;	/* phi = (p-1)(q-1) */
	mpi_t	e;		/* public exponent 1 < e < phi s.t. gcd(e,phi)=1 */
	mpi_t	d;		/* secret exponent 1 < d < phi s.t. ed=1 (mod phi) */
} rsa_ctx;

void rsa_init(rsa_ctx *rsa, unsigned bits, mt64_context *rand_ctx);
void rsa_free(rsa_ctx *rsa);

/* Transform cleartext into encrypted data. */
void rsa_encrypt(rsa_ctx *ctx, const void *input, unsigned input_size,
				 void *output, unsigned *output_size);
/* Transform encrypted data back to cleartext. */
void rsa_decrypt(rsa_ctx *ctx, const void *input, unsigned input_size,
				 void *output, unsigned *output_size);

#endif /* !_RSA_H_ */

Use mt64_context instead of mp_rand_ctx

Use mt64_context instead of mp_rand_ctx


// RUN: %clang %s -Wl,-as-needed -o %t && %run %t
// Regression test for PR15823
// (http://llvm.org/bugs/show_bug.cgi?id=15823).
#include <stdio.h>
#include <time.h>

int main() {
  struct timespec ts;
  clock_gettime(CLOCK_REALTIME, &ts);
  return 0;
}

Add regression test for PR15823

Add regression test for PR15823

git-svn-id: c199f293c43da69278bea8e88f92242bf3aa95f7@215941 91177308-0d34-0410-b5e6-96231b3b80d8


//
//  file_API.h
//  Forge
//
//  Copyright (c) 2020 Trigger Corp. All rights reserved.
//

#import <Foundation/Foundation.h>

@interface file_API : NSObject

+ (void)getImage:(ForgeTask*)task;
+ (void)getVideo:(ForgeTask*)task;

+ (void)getFileFromSourceDirectory:(ForgeTask*)task resource:(NSString*)resource;
+ (void)getURLFromSourceDirectory:(ForgeTask*)task resource:(NSString*)resource;

+ (void)getScriptPath:(ForgeTask*)task file:(NSDictionary*)file;
+ (void)getScriptURL:(ForgeTask*)task file:(NSDictionary*)file;

+ (void)isFile:(ForgeTask*)task file:(NSDictionary*)file;
+ (void)info:(ForgeTask*)task file:(NSDictionary*)file;
+ (void)base64:(ForgeTask*)task file:(NSDictionary*)file;
+ (void)string:(ForgeTask*)task file:(NSDictionary*)file;
+ (void)remove:(ForgeTask*)task file:(NSDictionary*)file;

+ (void)cacheURL:(ForgeTask*)task url:(NSString*)url;
+ (void)saveURL:(ForgeTask*)task url:(NSString*)url;

+ (void)clearCache:(ForgeTask*)task;
+ (void)getStorageSizeInformation:(ForgeTask*)task;

@end

//
//  file_API.h
//  Forge
//
//  Copyright (c) 2020 Trigger Corp. All rights reserved.
//

#import <Foundation/Foundation.h>

@interface file_API : NSObject

+ (void)getImage:(ForgeTask*)task;
+ (void)getVideo:(ForgeTask*)task;

+ (void)getFileFromSourceDirectory:(ForgeTask*)task resource:(NSString*)resource;
+ (void)getURLFromSourceDirectory:(ForgeTask*)task resource:(NSString*)resource;

+ (void)getScriptPath:(ForgeTask*)task file:(NSDictionary*)file;
+ (void)getScriptURL:(ForgeTask*)task file:(NSDictionary*)file;

+ (void)exists:(ForgeTask*)task file:(NSDictionary*)file;
+ (void)info:(ForgeTask*)task file:(NSDictionary*)file;
+ (void)base64:(ForgeTask*)task file:(NSDictionary*)file;
+ (void)string:(ForgeTask*)task file:(NSDictionary*)file;
+ (void)remove:(ForgeTask*)task file:(NSDictionary*)file;

+ (void)cacheURL:(ForgeTask*)task url:(NSString*)url;
+ (void)saveURL:(ForgeTask*)task url:(NSString*)url;

+ (void)clearCache:(ForgeTask*)task;
+ (void)getStorageSizeInformation:(ForgeTask*)task;

@end

Rename isFile -> exists in header file too


//
// Copyright 2011-2014 NimbusKit
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//    http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//

#import "NIMutableTableViewModel.h"

@interface NIMutableTableViewModel (Private)

@property (nonatomic, strong) NSMutableArray* sections; // Array of NITableViewModelSection
@property (nonatomic, strong) NSMutableArray* sectionIndexTitles;
@property (nonatomic, strong) NSMutableDictionary* sectionPrefixToSectionIndex;

@end

@interface NITableViewModelSection (Mutable)

- (NSMutableArray *)mutableRows;

@end

//
// Copyright 2011-2014 NimbusKit
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//    http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//

#import "NIMutableTableViewModel.h"
#import "NITableViewModel+Private.h"

@interface NIMutableTableViewModel (Private)

@property (nonatomic, strong) NSMutableArray* sections; // Array of NITableViewModelSection
@property (nonatomic, strong) NSMutableArray* sectionIndexTitles;
@property (nonatomic, strong) NSMutableDictionary* sectionPrefixToSectionIndex;

@end

@interface NITableViewModelSection (Mutable)

- (NSMutableArray *)mutableRows;

@end

Add proper import for NIMutableViewModel


/*
 * Copyright (c) 2012 The Chromium Authors. All rights reserved.
 * Use of this source code is governed by a BSD-style license that can be
 * found in the LICENSE file.
 */

#ifndef NATIVE_CLIENT_SRC_SHARED_PPAPI_PROXY_PPRUNTIME_H_
#define NATIVE_CLIENT_SRC_SHARED_PPAPI_PROXY_PPRUNTIME_H_

#include "native_client/src/include/portability.h"
#include "native_client/src/untrusted/irt/irt_ppapi.h"

EXTERN_C_BEGIN

// Initialize srpc connection to the browser. Some APIs like manifest file
// opening do not need full ppapi initialization and so can be used after
// this function returns.
int IrtInit(void);

// The entry point for the main thread of the PPAPI plugin process.
int PpapiPluginMain(void);

void PpapiPluginRegisterThreadCreator(
    const struct PP_ThreadFunctions* new_funcs);

EXTERN_C_END

#endif  // NATIVE_CLIENT_SRC_SHARED_PPAPI_PROXY_PPRUNTIME_H_

/*
 * Copyright (c) 2012 The Chromium Authors. All rights reserved.
 * Use of this source code is governed by a BSD-style license that can be
 * found in the LICENSE file.
 */

#ifndef NATIVE_CLIENT_SRC_SHARED_PPAPI_PROXY_PPRUNTIME_H_
#define NATIVE_CLIENT_SRC_SHARED_PPAPI_PROXY_PPRUNTIME_H_

#include "native_client/src/include/portability.h"
#include "native_client/src/untrusted/irt/irt_ppapi.h"

EXTERN_C_BEGIN

// The entry point for the main thread of the PPAPI plugin process.
int PpapiPluginMain(void);

void PpapiPluginRegisterThreadCreator(
    const struct PP_ThreadFunctions* new_funcs);

EXTERN_C_END

#endif  // NATIVE_CLIENT_SRC_SHARED_PPAPI_PROXY_PPRUNTIME_H_

NaCl: Remove declaration of IrtInit(), which is no longer defined anywhere

BUG=https://code.google.com/p/nativeclient/issues/detail?id=3186
TEST=build

Review URL: https://codereview.chromium.org/157803004

git-svn-id: de016e52bd170d2d4f2344f9bf92d50478b649e0@250121 0039d316-1c4b-4281-b951-d872f2087c98


/*
 * Copyright (C) 2018 HAW-Hamburg
 *
 * This file is subject to the terms and conditions of the GNU Lesser
 * General Public License v2.1. See the file LICENSE in the top level
 * directory for more details.
 *
 */

/**
 * @ingroup     drivers_sds011
 * @{
 *
 * @file
 * @brief       SAUL adaption for SDS011 sensor
 *
 * @author      Michel Rottleuthner <michel.rottleuthner@haw-hamburg.de>
 *
 * @}
 */

#include <string.h>

#include "saul.h"
#include "sds011.h"
#include "xtimer.h"

static int _read(const void *dev, phydat_t *res)
{
    sds011_data_t data;

    if (sds011_read((sds011_t *)dev, &data) == SDS011_OK) {
       res->val[0] = data.pm_2_5;
       res->val[1] = data.pm_10;
       res->unit = UNIT_GPM3;
       res->scale = -7;
       return 2;
    }
    return ECANCELED;
}

const saul_driver_t sds011_saul_driver = {
    .read = _read,
    .write = saul_notsup,
    .type = SAUL_SENSE_PM
};

/*
 * Copyright (C) 2018 HAW-Hamburg
 *
 * This file is subject to the terms and conditions of the GNU Lesser
 * General Public License v2.1. See the file LICENSE in the top level
 * directory for more details.
 *
 */

/**
 * @ingroup     drivers_sds011
 * @{
 *
 * @file
 * @brief       SAUL adaption for SDS011 sensor
 *
 * @author      Michel Rottleuthner <michel.rottleuthner@haw-hamburg.de>
 *
 * @}
 */

#include <string.h>

#include "saul.h"
#include "sds011.h"
#include "xtimer.h"

static int _read(const void *dev, phydat_t *res)
{
    sds011_data_t data;

    if (sds011_read((sds011_t *)dev, &data) == SDS011_OK) {
       res->val[0] = data.pm_2_5;
       res->val[1] = data.pm_10;
       res->unit = UNIT_GPM3;
       res->scale = -7;
       return 2;
    }
    return -ECANCELED;
}

const saul_driver_t sds011_saul_driver = {
    .read = _read,
    .write = saul_notsup,
    .type = SAUL_SENSE_PM
};

Fix SAUL read error return

drivers/sds011: Fix SAUL read error return


Add SPI bit modify command definition

Add SPI bit modify command definition


#ifndef CSETTINGS_H
#define CSETTINGS_H

class MdiChild;
#include <QDialog>
#include <QString>
#include "ui_settings.h"

#ifdef HAVE_CONFIG_H
#include "config.h"
#endif

#include "gvc.h"
#include "gvio.h"

class CFrmSettings : public QDialog
{
        Q_OBJECT
public:
    CFrmSettings();
    int runSettings(MdiChild* m);
    int showSettings(MdiChild* m);
    int cur;
    int drawGraph();
    MdiChild* getActiveWindow();
    QString graphData;
private slots:
    void outputSlot();
    void addSlot();
    void helpSlot();
    void cancelSlot();
    void okSlot();
    void newSlot();
    void openSlot();
    void saveSlot();
private:
    //Actions
    Agraph_t* graph;
    MdiChild* activeWindow;
    GVC_t* gvc;
    QAction* outputAct;
    QAction* addAct;
    QAction* helpAct;
    QAction* cancelAct;
    QAction* okAct;
    QAction* newAct;
    QAction* openAct;
    QAction* saveAct;
    //METHODS
    QString buildOutputFile(QString _fileName);
    void addAttribute(QString _scope,QString _name,QString _value);
    bool loadLayouts();
    bool loadRenderers();
    void refreshContent();
    void saveContent();
    void setActiveWindow(MdiChild* m);
    bool loadGraph(MdiChild* m);
    bool createLayout();
    bool renderLayout();

};

#endif

#ifndef CSETTINGS_H
#define CSETTINGS_H

class MdiChild;
#include <QDialog>
#include <QString>
#include "ui_settings.h"

#ifdef HAVE_CONFIG_H
#include "config.h"
#endif

#include "gvc.h"
/* #include "gvio.h" */

class CFrmSettings : public QDialog
{
        Q_OBJECT
public:
    CFrmSettings();
    int runSettings(MdiChild* m);
    int showSettings(MdiChild* m);
    int cur;
    int drawGraph();
    MdiChild* getActiveWindow();
    QString graphData;
private slots:
    void outputSlot();
    void addSlot();
    void helpSlot();
    void cancelSlot();
    void okSlot();
    void newSlot();
    void openSlot();
    void saveSlot();
private:
    //Actions
    Agraph_t* graph;
    MdiChild* activeWindow;
    GVC_t* gvc;
    QAction* outputAct;
    QAction* addAct;
    QAction* helpAct;
    QAction* cancelAct;
    QAction* okAct;
    QAction* newAct;
    QAction* openAct;
    QAction* saveAct;
    //METHODS
    QString buildOutputFile(QString _fileName);
    void addAttribute(QString _scope,QString _name,QString _value);
    bool loadLayouts();
    bool loadRenderers();
    void refreshContent();
    void saveContent();
    void setActiveWindow(MdiChild* m);
    bool loadGraph(MdiChild* m);
    bool createLayout();
    bool renderLayout();

};

#endif

Comment out unnecessary use of gvio.h

Comment out unnecessary use of gvio.h


//----------------------------------------------------------------------------
//
// "Copyright Centre National d'Etudes Spatiales"
//
// License:  LGPL-2
//
// See LICENSE.txt file in the top level directory for more details.
//
//----------------------------------------------------------------------------
// $Id$

#ifndef ossimTraceHelpers_h
#define ossimTraceHelpers_h

#include <ossim/base/ossimTrace.h>
#include <ossim/base/ossimNotify.h>

namespace ossimplugins {
   /** Helper class to log automatically entering and leaving scopes.
    * @warning Not meant to be used directly. Use \c SCOPED_LOG instead.
    */
   struct ScopedLogger
   {
      ScopedLogger(ossimTrace & channel, char const* module, ossimNotifyLevel level = ossimNotifyLevel_DEBUG)
         : m_channel(channel)
         , MODULE(module)
         {
            if (m_channel()) {
               ossimNotify(ossimNotifyLevel_DEBUG) << MODULE << " entered...\n";
            }
         }

      ~ScopedLogger() {
         if (m_channel()) {
            ossimNotify(ossimNotifyLevel_DEBUG) << MODULE << " left...\n";
         }
      }
   private:
      ScopedLogger(ScopedLogger const&);
      ScopedLogger& operator=(ScopedLogger const&);

      ossimTrace & m_channel;
      char const* MODULE;
   };

#define SCOPED_LOG(channel, msg) \
   SCOPED_LOG_NAME(__LINE__)(channel, msg)

#define SCOPED_LOG_NAME(x) \
   SCOPED_LOG_NAME0(x)

#define SCOPED_LOG_NAME0(x) \
   ossimplugins::ScopedLogger slog ## x
} // ossimplugins namespace

#endif // ossimTraceHelpers_h

ENH: Add helper macro to log scope entry and exit


/*
 *  linux/include/asm-arm/mach/flash.h
 *
 *  Copyright (C) 2003 Russell King, All Rights Reserved.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 as
 * published by the Free Software Foundation.
 */
#ifndef ASMARM_MACH_FLASH_H
#define ASMARM_MACH_FLASH_H

struct mtd_partition;

/*
 * map_name:	the map probe function name
 * name:	flash device name (eg, as used with mtdparts=)
 * width:	width of mapped device
 * init:	method called at driver/device initialisation
 * exit:	method called at driver/device removal
 * set_vpp:	method called to enable or disable VPP
 * parts:	optional array of mtd_partitions for static partitioning
 * nr_parts:	number of mtd_partitions for static partitoning
 */
struct flash_platform_data {
	const char	*map_name;
	const char	*name;
	unsigned int	width;
	int		(*init)(void);
	void		(*exit)(void);
	void		(*set_vpp)(int on);
	struct mtd_partition *parts;
	unsigned int	nr_parts;
};

#endif

/*
 *  linux/include/asm-arm/mach/flash.h
 *
 *  Copyright (C) 2003 Russell King, All Rights Reserved.
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 as
 * published by the Free Software Foundation.
 */
#ifndef ASMARM_MACH_FLASH_H
#define ASMARM_MACH_FLASH_H

struct mtd_partition;
struct mtd_info;

/*
 * map_name:	the map probe function name
 * name:	flash device name (eg, as used with mtdparts=)
 * width:	width of mapped device
 * init:	method called at driver/device initialisation
 * exit:	method called at driver/device removal
 * set_vpp:	method called to enable or disable VPP
 * mmcontrol:	method called to enable or disable Sync. Burst Read in OneNAND
 * parts:	optional array of mtd_partitions for static partitioning
 * nr_parts:	number of mtd_partitions for static partitoning
 */
struct flash_platform_data {
	const char	*map_name;
	const char	*name;
	unsigned int	width;
	int		(*init)(void);
	void		(*exit)(void);
	void		(*set_vpp)(int on);
	void		(*mmcontrol)(struct mtd_info *mtd, int sync_read);
	struct mtd_partition *parts;
	unsigned int	nr_parts;
};

#endif

[ARM] 3057/1: Add memory control method to support OneNAND sync burst read

Patch from Kyungmin Park

This patch is required for OneNAND MTD to passing the OneNAND sync. burst read

Signed-off-by: Kyungmin Park
Signed-off-by: Russell King <f6aa0246ff943bfa8602cdf60d40c481b38ed232@arm.linux.org.uk>


//
//  GWCollapsibleTable.h
//  CollapsibleTable
//
//  Created by Greg Wang on 13-1-3.
//  Copyright (c) 2013年 Greg Wang. All rights reserved.
//

@protocol GWCollapsibleTableDataSource <NSObject>

- (BOOL)tableView:(UITableView *)tableView canCollapseSection:(NSInteger)section;
- (UITableViewCell *)tableView:(UITableView *)tableView headerCellForCollapsibleSection:(NSInteger)section;
- (UITableViewCell *)tableView:(UITableView *)tableView bodyCellForRowAtIndexPath:(NSIndexPath *)indexPath;
- (NSInteger)tableView:(UITableView *)tableView numberOfBodyRowsInSection:(NSInteger)section;

// TODO: Support Editing & Reordering Methods

@end

@protocol GWCollapsibleTableDelegate <NSObject>

- (void)tableView:(UITableView *)tableView didSelectBodyRowAtIndexPath:(NSIndexPath *)indexPath;
// TODO: Support Extra Selection Management Methods

// TODO: Support Editing & Reordering Methods

@end

//
//  GWCollapsibleTable.h
//  CollapsibleTable
//
//  Created by Greg Wang on 13-1-3.
//  Copyright (c) 2013年 Greg Wang. All rights reserved.
//

#import "NSObject+GWCollapsibleTable.h"
#import "UITableView+GWCollapsibleTable.h"

@protocol GWCollapsibleTableDataSource <NSObject>

- (BOOL)tableView:(UITableView *)tableView canCollapseSection:(NSInteger)section;
- (UITableViewCell *)tableView:(UITableView *)tableView headerCellForCollapsibleSection:(NSInteger)section;
- (UITableViewCell *)tableView:(UITableView *)tableView bodyCellForRowAtIndexPath:(NSIndexPath *)indexPath;
- (NSInteger)tableView:(UITableView *)tableView numberOfBodyRowsInSection:(NSInteger)section;

// TODO: Support Editing & Reordering Methods

@end

@protocol GWCollapsibleTableDelegate <NSObject>

- (void)tableView:(UITableView *)tableView didSelectBodyRowAtIndexPath:(NSIndexPath *)indexPath;

@optional
- (void)tableView:(UITableView *)tableView willExpandSection:(NSInteger)section;
- (void)tableView:(UITableView *)tableView willCollapseSection:(NSInteger)section;

// TODO: Support Extra Selection Management Methods

// TODO: Support Editing & Reordering Methods

@end

Add necessary interfaces Add optional delegate methods


void sink(void *o);
void *user_input(void);

struct AB {
  void *a;
  void *b;
};

struct Outer {
  struct AB nestedAB;
  struct AB *pointerAB;
};

void absink(struct AB *ab) {
  sink(ab->a); // flow x3 [NOT DETECTED]
  sink(ab->b); // no flow
}

int struct_init(void) {
  struct AB ab = { user_input(), 0 };

  sink(ab.a); // flow [NOT DETECTED]
  sink(ab.b); // no flow
  absink(&ab);

  struct Outer outer = {
    { user_input(), 0 },
    &ab,
  };

  sink(outer.nestedAB.a); // flow [NOT DETECTED]
  sink(outer.nestedAB.b); // no flow
  sink(outer.pointerAB->a); // flow [NOT DETECTED]
  sink(outer.pointerAB->b); // no flow

  absink(&outer.nestedAB);
  absink(outer.pointerAB);
}

C++: Test showing no flow through aggregate init


#pragma once
//MathLib.h

#ifndef _MATHLIB_
#define _MATHLIB_

#endif

#pragma once
//MathLib.h

#ifndef _MATHLIB_
#define _MATHLIB_

//Make some change to check if new branch is created.

#endif


//
// Copyright (c) 2012 Daniel Lundin
//

#ifndef MEDIDA_REPORTING_ABSTRACT_POLLING_REPORTER_H_
#define MEDIDA_REPORTING_ABSTRACT_POLLING_REPORTER_H_

#include <memory>

#include "medida/types.h"

namespace medida {
    namespace reporting {
        class AbstractPollingReporter {

        public:
            AbstractPollingReporter();

            virtual ~AbstractPollingReporter();

            virtual void Shutdown();

            virtual void Start(Clock::duration period = std::chrono::seconds(5));

            virtual void Run();

        private:
            class Impl;

            std::unique_ptr<Impl> impl_;
        };
    }
}

#endif // MEDIDA_REPORTING_ABSTRACT_POLLING_REPORTER_H_

//
// Copyright (c) 2012 Daniel Lundin
//

#ifndef MEDIDA_REPORTING_ABSTRACT_POLLING_REPORTER_H_
#define MEDIDA_REPORTING_ABSTRACT_POLLING_REPORTER_H_

#include <memory>

#include "medida/types.h"

namespace medida {
    namespace reporting {
        class AbstractPollingReporter {

        public:
            AbstractPollingReporter();

            virtual ~AbstractPollingReporter();

            virtual void Shutdown();

            // start should never be called after calling shutdown on this class
            //    (behavior if start after shutdown is undefined).
            virtual void Start(Clock::duration period = std::chrono::seconds(5));

            virtual void Run();

        private:
            class Impl;

            std::unique_ptr<Impl> impl_;
        };
    }
}

#endif // MEDIDA_REPORTING_ABSTRACT_POLLING_REPORTER_H_

Comment on abstract-polling-reporter to handle the shutdown followed by start racing to modify thread before it can be joined, it is not a valid usecase anyway, so handling it thru comment.


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

typedef struct list {
    int val;
    struct list *next;
} list_t;

typedef union either {
    int value;
    struct list node;
} either_t;

// void mutate_either(either_t e){
//     list_t *next = e.node.next;
//     next->val = 42;
// }

int main(){
    list_t first;
    list_t second;

    first.next = &second;
    first.val = 1;
    second.next = NULL;
    second.val = 2;

    either_t e;
    e.node = first;

    // When passing a union to an unknown function, reachable memory should be invalidated
    mutate_either(e);
    assert(second.val == 2); //UNKNOWN!
    return 0;
}

Add test that passes union to unknown function


#ifndef ZEPHYR_CEXPORT_H
#define ZEPHYR_CEXPORT_H

#ifdef __cplusplus
#define Z_VAR(ns, n) n
#else
#define Z_VAR(ns, n) ns ## _ ## n
#endif

#ifdef __cplusplus
#define Z_NS_START(n) namespace n {
#define Z_NS_END }
#else
#define Z_NS_START(n)
#define Z_NS_END
#endif

#ifdef __cplusplus
#define Z_ENUM_CLASS(ns, n) enum class n
#else
#define Z_ENUM_CLASS(ns, n) enum Z_VAR(ns, n)
#endif

#ifdef __cplusplus
#define Z_ENUM(ns, n) enum n
#else
#define Z_ENUM(ns, n) enum Z_VAR(ns, n)
#endif

#ifdef __cplusplus
#define Z_STRUCT(ns, n) struct n
#else
#define Z_STRUCT(ns, n) struct Z_VAR(ns, n)
#endif

#endif

#ifndef ZEPHYR_CEXPORT_H
#define ZEPHYR_CEXPORT_H

/* declare a namespaced name */
#ifdef __cplusplus
#define ZD(ns)
#else
#define ZD(ns) ns_
#endif

/* use a namespaced name */
#ifdef __cplusplus
#define ZU(ns) ns::
#else
#define ZU(ns) ns_
#endif

/* declare a namespace */
#ifdef __cplusplus
#define Z_NS_START(n) namespace n {
#define Z_NS_END }
#else
#define Z_NS_START(n)
#define Z_NS_END
#endif

/* enum class vs enum */
#ifdef __cplusplus
#define Z_ENUM_CLASS enum class
#else
#define Z_ENUM_CLASS enum
#endif

#endif

Move to namespace include/use model

Move to namespace include/use model

Now if you want to declare a namespaced name, use ZD()
If you want to use a namesapce name, use ZU()


#ifndef __GRAPH_H__
#define __GRAPH_H__

#include "resources.h"

class graph {
private:	//For data structures
	struct vertex;

	struct edge {
		vertex *endpoint;
		edge *opposite_edge, *next_edge;
		double direction;
		bool in_tree;
		uint index;
		conductor_info elect_info;

		edge();
	};
	struct vertex {
		edge *first_edge;
		bool bfs_mark;

		vertex();
	};

	vertex *vertex_memory_pool;
	edge *edge_memory_pool;
	uint vertex_number, edge_number;

private:	//For internal functions
	void add_edge(edge *, vertex *, vertex *, conductor_info, char, uint);
	void find_tree_path(vertex *, vertex *, std::vector<edge *> &);

	arma::cx_rowvec flow_conservation_equation(vertex *);
	std::pair<arma::cx_rowvec, comp> circular_equation(vertex *, edge *);
	void bfs(vertex *, arma::cx_mat &, arma::cx_vec &, uint &);
	void find_all_circular(arma::cx_mat &, arma::cx_vec &, uint &);

public:	//For user ports
	graph(uint, const std::vector<conductor> &);
	void get_current(std::vector<comp> &);
	~graph();
};

#endif

#ifndef __GRAPH_H__
#define __GRAPH_H__

#include "resources.h"

class graph {
private:	//For data structures
	struct vertex;

	struct edge {
		vertex *endpoint;
		edge *opposite_edge, *next_edge;
		double direction;
		bool in_tree;
		uint index;
		conductor_info elect_info;

		edge();
	};
	struct vertex {
		edge *first_edge;
		bool bfs_mark;

		vertex();
	};

	vertex *vertex_memory_pool;
	edge *edge_memory_pool;
	uint vertex_number, edge_number;

private:	//For internal functions
	void add_edge(edge *, vertex *, vertex *, conductor_info, char, uint);
	void find_tree_path(uint, vertex *, vertex *, std::vector<edge *> &);

	arma::cx_rowvec flow_conservation_equation(vertex *);
	std::pair<arma::cx_rowvec, comp> circular_equation(vertex *, edge *);
	void bfs(vertex *, arma::cx_mat &, arma::cx_vec &, uint &);
	void find_all_circular(arma::cx_mat &, arma::cx_vec &, uint &);

public:	//For user ports
	graph(uint, const std::vector<conductor> &);
	void get_current(std::vector<comp> &);
	~graph();
};

#endif

Change the function of find_tree_path

Change the function of find_tree_path


// RUN: %clang_cc1 -triple thumbv7-apple-darwin10 -target-cpu cortex-a8 -fsyntax-only -Wvector-conversions -verify %s
// RUN: %clang_cc1 -x c++ -triple thumbv7-apple-darwin10 -target-cpu cortex-a8 -fsyntax-only -Wvector-conversions -verify %s

#include <arm_neon.h>

// Radar 8228022: Should not report incompatible vector types.
int32x2_t test(int32x2_t x) {
  return vshr_n_s32(x, 31);
}

// RUN: %clang_cc1 -triple thumbv7-apple-darwin10 -target-cpu cortex-a8 -fsyntax-only -Wvector-conversions -verify %s
// RUN: %clang_cc1 -triple thumbv7-apple-darwin10 -target-cpu cortex-a8 -fsyntax-only -fno-lax-vector-conversions -verify %s
// RUN: %clang_cc1 -x c++ -triple thumbv7-apple-darwin10 -target-cpu cortex-a8 -fsyntax-only -Wvector-conversions -verify %s

#include <arm_neon.h>

// Radar 8228022: Should not report incompatible vector types.
int32x2_t test(int32x2_t x) {
  return vshr_n_s32(x, 31);
}

Test use of arm_neon.h with -fno-lax-vector-conversions.

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


#ifndef JIVE_VSDG_TYPES_H
#define JIVE_VSDG_TYPES_H

#include <jive/vsdg/basetype.h>
#include <jive/vsdg/statetype.h>
#include <jive/vsdg/controltype.h>

#endif

#ifndef JIVE_VSDG_TYPES_H
#define JIVE_VSDG_TYPES_H

#include <jive/vsdg/basetype.h>
#include <jive/vsdg/statetype.h>
#include <jive/vsdg/controltype.h>
#include <jive/vsdg/valuetype.h>

#endif

Add valuetype as "standard" type

Add valuetype as "standard" type

Add to vsdg/types.h header to make it available as "standard"
type.


#ifndef	IO_SOCKET_SIMPLE_SERVER_H
#define	IO_SOCKET_SIMPLE_SERVER_H

#include <io/socket/socket.h>

/*
 * XXX
 * This is just one level up from using macros.  Would be nice to use abstract
 * base classes and something a bit tidier.
 */
template<typename A, typename C, typename L>
class SimpleServer {
	LogHandle log_;
	A arg_;
	L *server_;
	Action *accept_action_;
	Action *close_action_;
	Action *stop_action_;
public:
	SimpleServer(LogHandle log, A arg, SocketAddressFamily family, const std::string& interface)
	: log_(log),
	  arg_(arg),
	  server_(NULL),
	  accept_action_(NULL),
	  close_action_(NULL),
	  stop_action_(NULL)
	{
		server_ = L::listen(family, interface);
		if (server_ == NULL)
			HALT(log_) << "Unable to create listener.";

		INFO(log_) << "Listening on: " << server_->getsockname();

		EventCallback *cb = callback(this, &SimpleServer::accept_complete);
		accept_action_ = server_->accept(cb);

		Callback *scb = callback(this, &SimpleServer::stop);
		stop_action_ = EventSystem::instance()->register_interest(EventInterestStop, scb);
	}

	~SimpleServer()
	{
		ASSERT(server_ == NULL);
		ASSERT(accept_action_ == NULL);
		ASSERT(close_action_ == NULL);
		ASSERT(stop_action_ == NULL);
	}

private:
	void accept_complete(Event e)
	{
		accept_action_->cancel();
		accept_action_ = NULL;

		switch (e.type_) {
		case Event::Done:
			break;
		case Event::Error:
			ERROR(log_) << "Accept error: " << e;
			break;
		default:
			ERROR(log_) << "Unexpected event: " << e;
			break;
		}

		if (e.type_ == Event::Done) {
			Socket *client = (Socket *)e.data_;

			INFO(log_) << "Accepted client: " << client->getpeername();

			new C(arg_, client);
		}

		EventCallback *cb = callback(this, &SimpleServer::accept_complete);
		accept_action_ = server_->accept(cb);
	}

	void close_complete(void)
	{
		close_action_->cancel();
		close_action_ = NULL;

		ASSERT(server_ != NULL);
		delete server_;
		server_ = NULL;

		delete this;
	}

	void stop(void)
	{
		stop_action_->cancel();
		stop_action_ = NULL;

		accept_action_->cancel();
		accept_action_ = NULL;

		ASSERT(close_action_ == NULL);

		Callback *cb = callback(this, &SimpleServer::close_complete);
		close_action_ = server_->close(cb);
	}
};

#endif /* !IO_SOCKET_SIMPLE_SERVER_H */

Add a simple server abstraction.

Add a simple server abstraction.

git-svn-id: 9e2532540f1574e817ce42f20b9d0fb64899e451@776 4068ffdb-0463-0410-8185-8cc71e3bd399


#ifndef _NET_EVENT_H
#define _NET_EVENT_H

/*
 *	Generic netevent notifiers
 *
 *	Authors:
 *      Tom Tucker              <tom@opengridcomputing.com>
 *      Steve Wise              <swise@opengridcomputing.com>
 *
 * 	Changes:
 */
#ifdef __KERNEL__

#include <net/dst.h>

struct netevent_redirect {
	struct dst_entry *old;
	struct dst_entry *new;
};

enum netevent_notif_type {
	NETEVENT_NEIGH_UPDATE = 1, /* arg is struct neighbour ptr */
	NETEVENT_PMTU_UPDATE,	   /* arg is struct dst_entry ptr */
	NETEVENT_REDIRECT,	   /* arg is struct netevent_redirect ptr */
};

extern int register_netevent_notifier(struct notifier_block *nb);
extern int unregister_netevent_notifier(struct notifier_block *nb);
extern int call_netevent_notifiers(unsigned long val, void *v);

#endif
#endif

#ifndef _NET_EVENT_H
#define _NET_EVENT_H

/*
 *	Generic netevent notifiers
 *
 *	Authors:
 *      Tom Tucker              <tom@opengridcomputing.com>
 *      Steve Wise              <swise@opengridcomputing.com>
 *
 * 	Changes:
 */
#ifdef __KERNEL__

struct dst_entry;

struct netevent_redirect {
	struct dst_entry *old;
	struct dst_entry *new;
};

enum netevent_notif_type {
	NETEVENT_NEIGH_UPDATE = 1, /* arg is struct neighbour ptr */
	NETEVENT_PMTU_UPDATE,	   /* arg is struct dst_entry ptr */
	NETEVENT_REDIRECT,	   /* arg is struct netevent_redirect ptr */
};

extern int register_netevent_notifier(struct notifier_block *nb);
extern int unregister_netevent_notifier(struct notifier_block *nb);
extern int call_netevent_notifiers(unsigned long val, void *v);

#endif
#endif

Remove unnecessary inclusion of dst.h

[NET]: Remove unnecessary inclusion of dst.h

The file net/netevent.h only refers to struct dst_entry * so it
doesn't need to include dst.h.  I've replaced it with a forward
declaration.

Signed-off-by: Herbert Xu <ef65de1c7be0aa837fe7b25ba9a7739905af6a55@gondor.apana.org.au>
Signed-off-by: David S. Miller <fe08d3c717adf2ae63592e4c9aec6e3e404d8e3e@davemloft.net>


#ifndef LOG_H
#define LOG_H

#include "types.h"
#include <fstream>

class Statement;
class Exp;
class LocationSet;
class RTL;

class Log
{
public:
	Log() { }
	virtual Log &operator<<(const char *str) = 0;
	virtual Log &operator<<(Statement *s);
	virtual Log &operator<<(Exp *e);
	virtual Log &operator<<(RTL *r);
	virtual Log &operator<<(int i);
	virtual Log &operator<<(char c);
	virtual Log &operator<<(double d);
	virtual Log &operator<<(ADDRESS a);
	virtual Log &operator<<(LocationSet *l);
			Log &operator<<(std::string& s) {return operator<<(s.c_str());}
	virtual ~Log() {};
	virtual void tail();
};

class FileLogger : public Log {
protected:
	std::ofstream out;
public:
			FileLogger();		// Implemented in boomerang.cpp
	void	tail();
	virtual Log &operator<<(const char *str) {
		out << str << std::flush;
		return *this;
	}
	virtual ~FileLogger() {};
};

#endif

#ifndef LOG_H
#define LOG_H

#include "types.h"
#include <fstream>

class Statement;
class Exp;
class LocationSet;
class RTL;

class Log
{
public:
	Log() { }
	virtual Log &operator<<(const char *str) = 0;
	virtual Log &operator<<(Statement *s);
	virtual Log &operator<<(Exp *e);
	virtual Log &operator<<(RTL *r);
	virtual Log &operator<<(int i);
	virtual Log &operator<<(char c);
	virtual Log &operator<<(double d);
	virtual Log &operator<<(ADDRESS a);
	virtual Log &operator<<(LocationSet *l);
			Log &operator<<(std::string& s) {return operator<<(s.c_str());}
	virtual ~Log() {};
	virtual void tail();
};

class FileLogger : public Log {
protected:
	std::ofstream out;
public:
			FileLogger();		// Implemented in boomerang.cpp
	void	tail();
	virtual Log &operator<<(const char *str) {
		out << str << std::flush;
		return *this;
	}
	virtual ~FileLogger() {};
};

// For older MSVC compilers
#if defined(_MSC_VER) && (_MSC_VER <= 1200)
static std::ostream& operator<<(std::ostream& s, QWord val)
{
	char szTmp[42]; // overkill, but who counts
	sprintf(szTmp, "%I64u", val);
	s << szTmp;
	return s;
}
#endif

#endif

Fix for older MSVC compilers without operator<< for long longs (not tested on MSVC6)


#ifndef StateMachine_StateMachine_h
#define StateMachine_StateMachine_h

#import "LSStateMachine.h"
#import "LSEvent.h"
#import "LSTransition.h"
#import "LSStateMachineMacros.h"
#endif

#ifndef StateMachine_StateMachine_h
#define StateMachine_StateMachine_h

#import "LSStateMachine.h"
#import "LSStateMachineMacros.h"
#endif

Remove private headers from global public header


#ifndef SANDBOXED_API_SANDBOX2_SYSCALL_DEFS_H_
#define SANDBOXED_API_SANDBOX2_SYSCALL_DEFS_H_

#include <sys/types.h>

#include <cstdint>
#include <string>
#include <vector>

#include "absl/strings/string_view.h"
#include "absl/types/span.h"
#include "sandboxed_api/config.h"
#include "sandboxed_api/sandbox2/syscall.h"

namespace sandbox2 {
namespace syscalls {

constexpr int kMaxArgs = 6;

}  // namespace syscalls

class SyscallTable {
 public:
  struct Entry;

  // Returns the syscall table for the architecture.
  static SyscallTable get(sapi::cpu::Architecture arch);

  int size() { return data_.size(); }

  absl::string_view GetName(int syscall) const;

  std::vector<std::string> GetArgumentsDescription(
      int syscall, const uint64_t values[syscalls::kMaxArgs], pid_t pid) const;

 private:
  constexpr SyscallTable() = default;
  explicit constexpr SyscallTable(absl::Span<const Entry> data) : data_(data) {}

  const absl::Span<const Entry> data_;
};

}  // namespace sandbox2

#endif  // SANDBOXED_API_SANDBOX2_SYSCALL_DEFS_H_

#ifndef SANDBOXED_API_SANDBOX2_SYSCALL_DEFS_H_
#define SANDBOXED_API_SANDBOX2_SYSCALL_DEFS_H_

#include <sys/types.h>

#include <cstdint>
#include <string>
#include <vector>

#include "absl/strings/string_view.h"
#include "absl/types/span.h"
#include "sandboxed_api/config.h"
#include "sandboxed_api/sandbox2/syscall.h"

namespace sandbox2 {
namespace syscalls {

constexpr int kMaxArgs = 6;

}  // namespace syscalls

class SyscallTable {
 public:
  struct Entry;

  // Returns the syscall table for the architecture.
  static SyscallTable get(sapi::cpu::Architecture arch);

  int size() { return data_.size(); }

  absl::string_view GetName(int syscall) const;

  std::vector<std::string> GetArgumentsDescription(int syscall,
                                                   const uint64_t values[],
                                                   pid_t pid) const;

 private:
  constexpr SyscallTable() = default;
  explicit constexpr SyscallTable(absl::Span<const Entry> data) : data_(data) {}

  const absl::Span<const Entry> data_;
};

}  // namespace sandbox2

#endif  // SANDBOXED_API_SANDBOX2_SYSCALL_DEFS_H_

Make code not have a -Warray-parameter warning.

PiperOrigin-RevId: 467842322
Change-Id: Ic262a3f98fa823ef524ac02d08b2f5b8f4adf71d


#ifndef TE_OBSERVER_H
#define TE_OBSERVER_H

namespace te
{
	template <class EventType>
	class Observer
	{
	public:
        virtual ~Observer() {}
        virtual void onNotify(const EventType& evt) = 0;
	};
}

#endif

#ifndef TE_OBSERVER_H
#define TE_OBSERVER_H

#include <vector>
#include <memory>
#include <cassert>

namespace te
{
	template <class EventType>
	class Observer
	{
	public:
        virtual ~Observer() {}
        virtual void onNotify(const EventType& evt) = 0;
	};

    template <class EventType>
    class Notifier
    {
    public:
        virtual ~Notifier() {}
        void addObserver(std::shared_ptr<Observer<EventType>> newObserver)
        {
            assert(newObserver);
            if (std::find(mObservers.begin(), mObservers.end(), newObserver) == mObservers.end()) {
                mObservers.push_back(newObserver);
            }
        }
    protected:
        void notify(const EventType& evt)
        {
            std::for_each(std::begin(mObservers), std::end(mObservers), [&evt](std::shared_ptr<Observer<EventType>>& pObserver) {
                pObserver->onNotify(evt);
            });
        }
    private:
        std::vector<std::shared_ptr<Observer<EventType>>> mObservers;
    };
}

#endif

Add Notifier base class, complements Observer


#include "mruby.h"

extern void altera_piocore_init(mrb_state *mrb);
extern void altera_piocore_final(mrb_state *mrb);

void
mrb_embed_altera_gem_init(mrb_state *mrb)
{
  struct RClass *mod;
  mod = mrb_define_module(mrb, "Altera")

  altera_piocore_init(mrb, mod);
}

void
mrb_embed_altera_gem_final(mrb_state *mrb)
{
  altera_piocore_final(mrb);
}

#include "mruby.h"

extern void altera_piocore_init(mrb_state *mrb, struct RClass *mod);
extern void altera_piocore_final(mrb_state *mrb);

void
mrb_embed_altera_gem_init(mrb_state *mrb)
{
  struct RClass *mod;
  mod = mrb_define_module(mrb, "Altera");

  altera_piocore_init(mrb, mod);
}

void
mrb_embed_altera_gem_final(mrb_state *mrb)
{
  altera_piocore_final(mrb);
}

Fix prototype and syntax mistake

Fix prototype and syntax mistake


// Copyright (c) 2015, Matthew Malensek.
// Distributed under the BSD 2-Clause License (see LICENSE.txt for details)

#pragma once

#include <Windows.h>
#include <CommCtrl.h>

#include "Control.h"

class Slider : public Control {
public:
    Slider(int id, DialogBase &parent) :
    Control(id, parent, false) {

    }

    void Buddy(Control *buddy, bool bottomOrRight = true);

    int Position();
    void Position(int position);

    /// <summary>Sets the range (min, max) for the slider control.</summary>
    /// <param name="lo">Lower bound for the slider.</param>
    /// <param name="hi">Upper bound for the slider.</param>
    void Range(int lo, int hi);

    virtual BOOL CALLBACK Notification(NMHDR *nHdr);

private:
    HWND _buddyWnd;

public:
    /* Event Handlers */
    std::function<void(NMTRBTHUMBPOSCHANGING *pc)> OnSlide;

};

// Copyright (c) 2015, Matthew Malensek.
// Distributed under the BSD 2-Clause License (see LICENSE.txt for details)

#pragma once

#include <Windows.h>
#include <CommCtrl.h>

#include "Control.h"

class Slider : public Control {
public:
    Slider(int id, DialogBase &parent) :
    Control(id, parent, false) {

    }

    void Buddy(Control *buddy, bool bottomOrRight = true);

    int Position();
    void Position(int position);

    /// <summary>Sets the range (min, max) for the slider control.</summary>
    /// <param name="lo">Lower bound for the slider.</param>
    /// <param name="hi">Upper bound for the slider.</param>
    void Range(int lo, int hi);

    virtual BOOL CALLBACK Notification(NMHDR *nHdr);

private:
    HWND _buddyWnd;

public:
    /* Event Handlers */
    std::function<bool()> OnSlide;

};

Update slide event method definition

Update slide event method definition


/*
 * Copyright 2013 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

#ifndef _BDROID_BUILDCFG_H
#define _BDROID_BUILDCFG_H

#define BTA_DISABLE_DELAY 100 /* in milliseconds */

#endif

/*
 * Copyright 2013 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

#ifndef _BDROID_BUILDCFG_H
#define _BDROID_BUILDCFG_H

#define BTA_DISABLE_DELAY 100 /* in milliseconds */

#define BTM_WBS_INCLUDED TRUE
#define BTIF_HF_WBS_PREFERRED TRUE

#endif

Add WBS support on Bluedroid (1/6)

 Add WBS support on Bluedroid (1/6)

 Bug 13764086

Change-Id: Ib861d94b752561392e315ab8f459c30588075a46


#ifndef MLPACK_IO_OPTION_IMPL_H
#define MLPACK_IO_OPTION_IMPL_H

#include "io.h"

namespace mlpack {

/*
 * @brief Registers a parameter with IO.
 *    This allows the registration of parameters at program start.
 */
template<typename N>
Option<N>::Option(bool ignoreTemplate,
                N defaultValue,
                const char* identifier,
                const char* description,
                const char* parent,
                bool required) {
  if (ignoreTemplate)
    IO::Add(identifier, description, parent, required);
  else {
    IO::Add<N>(identifier, description, parent, required);

    //Create the full pathname.
    std::string pathname = IO::SanitizeString(parent) + std::string(identifier);
    IO::GetParam<N>(pathname.c_str()) = defaultValue;
  }
}

/*
 * @brief Registers a flag parameter with IO.
 */
template<typename N>
Option<N>::Option(const char* identifier,
                  const char* description,
                  const char* parent) {
  IO::AddFlag(identifier, description, parent);
}

}; // namespace mlpack

#endif

#ifndef MLPACK_IO_OPTION_IMPL_H
#define MLPACK_IO_OPTION_IMPL_H

#include "io.h"

namespace mlpack {

/*
 * @brief Registers a parameter with IO.
 *    This allows the registration of parameters at program start.
 */
template<typename N>
Option<N>::Option(bool ignoreTemplate,
                N defaultValue,
                const char* identifier,
                const char* description,
                const char* parent,
                bool required) {
  if (ignoreTemplate)
    IO::Add(identifier, description, parent, required);
  else {
    IO::Add<N>(identifier, description, parent, required);

    // Create the full pathname to set the default value.
    std::string pathname = IO::SanitizeString(parent) + std::string(identifier);
    IO::GetParam<N>(pathname.c_str()) = defaultValue;
  }
}

/*
 * @brief Registers a flag parameter with IO.
 */
template<typename N>
Option<N>::Option(const char* identifier,
                  const char* description,
                  const char* parent) {
  IO::AddFlag(identifier, description, parent);

  // Set the default value (false).
  std::string pathname = IO::SanitizeString(parent) + std::string(identifier);
  IO::GetParam<bool>(pathname.c_str()) = false;
}

}; // namespace mlpack

#endif

Set a default value for boolean options (false).


/**
 * @file    nina_b1.c
 * @brief   board ID for the u-blox NINA-B1 EVA maker board
 *
 * DAPLink Interface Firmware
 * Copyright (c) 2009-2016, ARM Limited, All Rights Reserved
 * SPDX-License-Identifier: Apache-2.0
 *
 * Licensed under the Apache License, Version 2.0 (the "License"); you may
 * not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

#include "target_config.h"

const char *board_id = "1238";

void prerun_board_config(void)
{
	// NINA-B1 is based on nrf52
	extern target_cfg_t target_device_nrf52;
	target_device = target_device_nrf52;
}

Convert line endings to unix format

Convert line endings to unix format

Convert the line endings for nina_b1.c to unix format. This matches
the rest of the codebase. This also fixes strange git behavior which
cause this file to show up as modified even when no changes have
been made.


// @(#)root/mc:$Name:  $:$Id: LinkDef.h,v 1.2 2002/04/26 08:46:10 brun Exp $
#ifdef __CINT__

#pragma link off all globals;
#pragma link off all classes;
#pragma link off all functions;

#pragma link C++ global gMC;

#pragma link C++ enum PDG_t;
#pragma link C++ enum TMCProcess;

#pragma link C++ class  TVirtualMC+;
#pragma link C++ class  TVirtualMCApplication+;
#pragma link C++ class  TVirtualMCStack+;
#pragma link C++ class  TVirtualMCDecayer+;

#endif

// @(#)root/mc:$Name:  $:$Id: LinkDef.h,v 1.2 2002/04/26 09:25:02 brun Exp $
#ifdef __CINT__

#pragma link off all globals;
#pragma link off all classes;
#pragma link off all functions;

#pragma link C++ global gMC;

#pragma link C++ enum PDG_t;
#pragma link C++ enum TMCProcess;

#pragma link C++ class  TVirtualMC+;
#pragma link C++ class  TVirtualMCApplication+;
#pragma link C++ class  TVirtualMCStack+;
#pragma link C++ class  TVirtualMCDecayer+;
#pragma link C++ class  TMCVerbose+;

#endif

Add TMCVerbose to the list of mc classes

git-svn-id: acec3fd5b7ea1eb9e79d6329d318e8118ee2e14f@6190 27541ba8-7e3a-0410-8455-c3a389f83636


#ifndef FFTW_HAO_H
#define FFTW_HAO_H

#include "fftw_define.h"

class FFTServer
{
    int  dimen;
    int* n;
    int  L;
    std::complex<double>* inforw;
    std::complex<double>* outforw;
    std::complex<double>* inback;
    std::complex<double>* outback;
    fftw_plan planforw;
    fftw_plan planback;
 public:
    FFTServer();
    FFTServer(int Dc, const int* Nc, char format); //'C' Column-major: fortran style; 'R' Row-major: c style;
    FFTServer(const FFTServer& x);
    ~FFTServer();

    FFTServer& operator  = (const FFTServer& x);

    std::complex<double>* fourier_forw(const std::complex<double>* inarray);
    std::complex<double>* fourier_back(const std::complex<double>* inarray);

    friend void FFTServer_void_construction_test();
    friend void FFTServer_param_construction_test();
    friend void FFTServer_equal_construction_test();
    friend void FFTServer_equal_test();
};

#endif

#ifndef FFTW_HAO_H
#define FFTW_HAO_H

#include "fftw_define.h"

class FFTServer
{
 public:
    int  dimen;
    int* n;
    int  L;
    std::complex<double>* inforw;
    std::complex<double>* outforw;
    std::complex<double>* inback;
    std::complex<double>* outback;
    fftw_plan planforw;
    fftw_plan planback;

    FFTServer();
    FFTServer(int Dc, const int* Nc, char format); //'C' Column-major: fortran style; 'R' Row-major: c style;
    FFTServer(const FFTServer& x);
    ~FFTServer();

    FFTServer& operator  = (const FFTServer& x);

    std::complex<double>* fourier_forw(const std::complex<double>* inarray);
    std::complex<double>* fourier_back(const std::complex<double>* inarray);
};

#endif

Remove friend function in FFTServer.

Remove friend function in FFTServer.


#include <stdarg.h>
#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>

#define ACPI_MACHINE_WIDTH __INTPTR_WIDTH__
#define ACPI_SINGLE_THREADED
#define ACPI_USE_LOCAL_CACHE
#define ACPI_USE_NATIVE_DIVIDE

#define DEBUGGER_THREADING DEBUGGER_SINGLE_THREADED

#undef ACPI_GET_FUNCTION_NAME
#ifdef ACPI_FULL_DEBUG
//#define ACPI_DBG_TRACK_ALLOCATIONS
#define ACPI_GET_FUNCTION_NAME __FUNCTION__
#else
#define ACPI_GET_FUNCTION_NAME ""
#endif

static const uintptr_t ACPI_PHYS_BASE = 0x1000000;

#define AcpiOsPrintf printf
#define AcpiOsVprintf vprintf

struct acpi_table_facs;
uint32_t AcpiOsReleaseGlobalLock(struct acpi_table_facs* facs);
uint32_t AcpiOsAcquireGlobalLock(struct acpi_table_facs* facs);

#define ACPI_ACQUIRE_GLOBAL_LOCK(GLptr, Acquired) Acquired = AcpiOsAcquireGlobalLock(GLptr)
#define ACPI_RELEASE_GLOBAL_LOCK(GLptr, Pending) Pending = AcpiOsReleaseGlobalLock(GLptr)

#define COMPILER_DEPENDENT_UINT64 uint64_t
#define COMPILER_DEPENDENT_UINT32 uint32_t

#include <stdarg.h>
#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>

#define ACPI_MACHINE_WIDTH __INTPTR_WIDTH__
#define ACPI_SINGLE_THREADED
#define ACPI_USE_LOCAL_CACHE
#define ACPI_USE_NATIVE_DIVIDE

#define DEBUGGER_THREADING DEBUGGER_SINGLE_THREADED

#undef ACPI_GET_FUNCTION_NAME
#ifdef ACPI_FULL_DEBUG
//#define ACPI_DBG_TRACK_ALLOCATIONS
#define ACPI_GET_FUNCTION_NAME __FUNCTION__
#else
#define ACPI_GET_FUNCTION_NAME ""
#endif

static const uint64_t ACPI_PHYS_BASE = 0x100000000;

#define AcpiOsPrintf printf
#define AcpiOsVprintf vprintf

struct acpi_table_facs;
uint32_t AcpiOsReleaseGlobalLock(struct acpi_table_facs* facs);
uint32_t AcpiOsAcquireGlobalLock(struct acpi_table_facs* facs);

#define ACPI_ACQUIRE_GLOBAL_LOCK(GLptr, Acquired) Acquired = AcpiOsAcquireGlobalLock(GLptr)
#define ACPI_RELEASE_GLOBAL_LOCK(GLptr, Pending) Pending = AcpiOsReleaseGlobalLock(GLptr)

#define COMPILER_DEPENDENT_UINT64 uint64_t
#define COMPILER_DEPENDENT_UINT32 uint32_t

Remove some of ACPICA's x32 support

Remove some of ACPICA's x32 support

To actually work properly in x32, it would need to manage mappings of
physical memory into the lower 4GB. Let's just require that you build it
in 64-bit mode...


#ifndef _client_h_
#define _client_h_

#define DEFAULT_PORT 4080

void client_enable();
void client_disable();
int get_client_enabled();
void client_connect(char *hostname, int port);
void client_start();
void client_stop();
void client_send(char *data);
char *client_recv();
void client_version(int version);
void client_login(const char *username, const char *identity_token);
void client_position(float x, float y, float z, float rx, float ry);
void client_chunk(int p, int q, int key);
void client_block(int x, int y, int z, int w);
void client_light(int x, int y, int z, int w);
void client_sign(int x, int y, int z, int face, const char *text);
void client_talk(const char *text);

#endif

#ifndef _client_h_
#define _client_h_

#ifdef _MSC_VER
    #define snprintf _snprintf
#endif

#define DEFAULT_PORT 4080

void client_enable();
void client_disable();
int get_client_enabled();
void client_connect(char *hostname, int port);
void client_start();
void client_stop();
void client_send(char *data);
char *client_recv();
void client_version(int version);
void client_login(const char *username, const char *identity_token);
void client_position(float x, float y, float z, float rx, float ry);
void client_chunk(int p, int q, int key);
void client_block(int x, int y, int z, int w);
void client_light(int x, int y, int z, int w);
void client_sign(int x, int y, int z, int face, const char *text);
void client_talk(const char *text);

#endif

Add Visual Studio 2013 fix from omnus

Add Visual Studio 2013 fix from omnus


/*
 * Copyright 2014, General Dynamics C4 Systems
 *
 * This software may be distributed and modified according to the terms of
 * the GNU General Public License version 2. Note that NO WARRANTY is provided.
 * See "LICENSE_GPLv2.txt" for details.
 *
 * @TAG(GD_GPL)
 */

#ifndef __MACHINE_HARDWARE_H
#define __MACHINE_HARDWARE_H

#include <types.h>
#include <arch/machine/hardware.h>
#include <plat/machine/hardware.h>
#include <plat/machine.h>

void handleReservedIRQ(irq_t irq);
void handleSpuriousIRQ(void);

/** MODIFIES: [*] */
void ackInterrupt(irq_t irq);

/** MODIFIES: [*] */
irq_t getActiveIRQ(void);

/** MODIFIES: [*] */
bool_t isIRQPending(void);

/** MODIFIES: [*] */
void maskInterrupt(bool_t enable, irq_t irq);
#endif

/*
 * Copyright 2014, General Dynamics C4 Systems
 *
 * This software may be distributed and modified according to the terms of
 * the GNU General Public License version 2. Note that NO WARRANTY is provided.
 * See "LICENSE_GPLv2.txt" for details.
 *
 * @TAG(GD_GPL)
 */

#ifndef __MACHINE_HARDWARE_H
#define __MACHINE_HARDWARE_H

#include <types.h>
#include <arch/machine/hardware.h>
#include <plat/machine/hardware.h>
#include <plat/machine.h>

void handleReservedIRQ(irq_t irq);
void handleSpuriousIRQ(void);

/** MODIFIES: [*] */
void ackInterrupt(irq_t irq);

/** MODIFIES: [*] */
irq_t getActiveIRQ(void);

/** MODIFIES: [*] */
bool_t isIRQPending(void);

/** MODIFIES: [*] */
void maskInterrupt(bool_t disable, irq_t irq);

#endif

Update prototype of maskInterrupt to match implementations.

The prototype will ultimately be removed, but the mismatch is presently
breaking verification.


#include "parser.h"
#include "ast.h"
#include "tests.h"

void test_parse_number();

int main() {
    test_parse_number();
    return 0;
}

struct token *make_token(enum token_type tk_type, char* str, double dbl,
        int number) {
    struct token *tk = malloc(sizeof(struct token));
    tk->type = tk_type;
    if (tk_type == tok_dbl) {
        tk->value.dbl = dbl;
    } else if (tk_type == tok_number) {
        tk->value.num = number;
    } else {
        tk->value.string = str;
    }
    return tk;
}

void test_parse_number() {
    struct token_list *tkl = make_token_list();
    tkl.append(make_token(tok_number, NULL, 0.0, 42);
    struct ast_node *result = parse_number(tkl);
    EXPECT_EQ(result->val, tkl->head);
    EXPECT_EQ(result->num_children, 0);
    destroy_token_list(tkl);
}

#include "parser.h"
#include "ast.h"
#include "tests.h"

void test_parse_number();

int main() {
    test_parse_number();
    return 0;
}

struct token *make_token(enum token_type tk_type, char* str, double dbl,
        int number) {
    struct token *tk = malloc(sizeof(struct token));
    tk->type = tk_type;
    if (tk_type == tok_dbl) {
        tk->value.dbl = dbl;
    } else if (tk_type == tok_number) {
        tk->value.num = number;
    } else {
        tk->value.string = str;
    }
    return tk;
}

void test_parse_number() {
    struct token_list *tkl = make_token_list();
    struct token *tk = make_token(tok_number, NULL, 0.0, 42);
    append_token_list(tkl, tk);
    struct ast_node *result = parse_number(tkl);
    EXPECT_EQ(result->val, tk);
    EXPECT_EQ(result->num_children, 0);
    destroy_token_list(tkl);
}

Fix bug in parser tests

Fix bug in parser tests

The act of parsing the ast pops the token from the token list, so we need
a pointer to the token for our assertion.


// Copyright (c) 2012 The WebM project authors. All Rights Reserved.
//
// Use of this source code is governed by a BSD-style license
// that can be found in the LICENSE file in the root of the source
// tree. An additional intellectual property rights grant can be found
// in the file PATENTS.  All contributing project authors may
// be found in the AUTHORS file in the root of the source tree.
#ifndef CLIENT_ENCODER_WIN_DSHOW_UTIL_H_
#define CLIENT_ENCODER_WIN_DSHOW_UTIL_H_

#include <ios>

#include "webmdshow/common/hrtext.hpp"
#include "webmdshow/common/odbgstream.hpp"

// Extracts error from the HRESULT, and outputs its hex and decimal values.
#define HRLOG(X) \
    " {" << #X << "=" << X << "/" << std::hex << X << std::dec << " (" << \
    hrtext(X) << ")}"

#endif  // CLIENT_ENCODER_WIN_DSHOW_UTIL_H_

// Copyright (c) 2012 The WebM project authors. All Rights Reserved.
//
// Use of this source code is governed by a BSD-style license
// that can be found in the LICENSE file in the root of the source
// tree. An additional intellectual property rights grant can be found
// in the file PATENTS.  All contributing project authors may
// be found in the AUTHORS file in the root of the source tree.
#ifndef CLIENT_ENCODER_WIN_DSHOW_UTIL_H_
#define CLIENT_ENCODER_WIN_DSHOW_UTIL_H_

#include <ios>

#include "webmdshow/common/odbgstream.hpp"  // NOLINT
// Above include NOLINT'd because it *must always* come before hrtext.
#include "webmdshow/common/hrtext.hpp"

// Extracts error from the HRESULT, and outputs its hex and decimal values.
#define HRLOG(X) \
    " {" << #X << "=" << X << "/" << std::hex << X << std::dec << " (" << \
    hrtext(X) << ")}"

#endif  // CLIENT_ENCODER_WIN_DSHOW_UTIL_H_

Fix release mode compile error.

Fix release mode compile error.

odbgstream must always be included before hrtext.

Change-Id: I184e8e9ec61c51b8f7e3f5d38135dfa85405d69e


#ifdef __CINT__
#pragma link off all globals;
#pragma link off all classes;
#pragma link off all functions;
#pragma link C++ nestedclasses;
#pragma link C++ struct JPetTreeHeader::ProcessingStageInfo+;
#pragma link C++ class JPetTreeHeader;
#endif

Add list LinkDef file for JPetTreeHeader

Former-commit-id: d29d9e972116a48db9d1c60dc16d6f69a010a693


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

void reverse_string(char *str){
    // skip null
    if (str == 0){ return; }
    // skip empty string
    if (*str == 0){ return; }
    // get range
    char *start = str;
    char *end = start + strlen(str) - 1; // -1 for \0
    char temp;
    // reverse
    while (end > start){
    	temp = *start;
    	*start = *end;
    	*end = temp;
    	++start;
    	--end;
    }
}

int is_palindrome_number(int n){
  char n_str[10], r_str[10];
  snprintf(n_str, sizeof(n_str), "%d", n); // convert int to str
  snprintf(r_str, sizeof(r_str), "%d", n);
  reverse_string(0);
  reverse_string(r_str);
  if(strcmp(n_str, r_str) == 0){
    return 0;
  }else{
    return -1;
  }
}

int main(int argc, char *argv[]){
  int x, y, v, largest_number;
  for(x = 100; x < 999; x++){
    for(y = 100; y < 999; y++){
      v = x * y;
      if(v > largest_number){
        if(is_palindrome_number(v) == 0){
          largest_number = v;
        }
      }
    }
  }
  printf("%d\n", largest_number);
}

Add C implementation for problem 4.

Add C implementation for problem 4.


// RUN: %clang -O0 -S -mno-red-zone -fprofile-arcs -ftest-coverage -emit-llvm %s -o - | FileCheck %s
// <rdar://problem/12843084>

int test1(int a) {
  switch (a % 2) {
  case 0:
    ++a;
  case 1:
    a /= 2;
  }
  return a;
}

// Check tha the `-mno-red-zone' flag is set here on the generated functions.

// CHECK: void @__llvm_gcov_indirect_counter_increment(i32* %{{.*}}, i64** %{{.*}}) unnamed_addr noinline noredzone
// CHECK: void @__llvm_gcov_writeout() unnamed_addr noinline noredzone
// CHECK: void @__llvm_gcov_init() unnamed_addr noinline noredzone
// CHECK: void @__gcov_flush() unnamed_addr noinline noredzone

// RUN: %clang_cc1 -O0 -emit-llvm -disable-red-zone -femit-coverage-notes -femit-coverage-data %s -o - | FileCheck %s

// <rdar://problem/12843084>

int test1(int a) {
  switch (a % 2) {
  case 0:
    ++a;
  case 1:
    a /= 2;
  }
  return a;
}

// Check tha the `-mno-red-zone' flag is set here on the generated functions.

// CHECK: void @__llvm_gcov_indirect_counter_increment(i32* %{{.*}}, i64** %{{.*}}) unnamed_addr noinline noredzone
// CHECK: void @__llvm_gcov_writeout() unnamed_addr noinline noredzone
// CHECK: void @__llvm_gcov_init() unnamed_addr noinline noredzone
// CHECK: void @__gcov_flush() unnamed_addr noinline noredzone

Use correct flags for this test.

Use correct flags for this test.

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


#ifndef AT_TIME_H
#define AT_TIME_H

// Under Windows, define the gettimeofday() function with corresponding types
#ifdef _MSC_VER
    #include <windows.h>
    #include <time.h>

    // TYPES
    struct timezone
    {
       int   tz_minuteswest;
       int   tz_dsttime;
    };

    // FUNCTIONS
    int gettimeofday(struct timeval * tv, struct timezone * tz);
#else
   #include <sys/time.h>
#endif

#endif

#ifndef AT_TIME_H
#define AT_TIME_H

// Under Windows, define the gettimeofday() function with corresponding types
#ifdef _MSC_VER
    #include <windows.h>
    #include <time.h>
    #include "atSymbols.h"

    // TYPES
    struct timezone
    {
       int   tz_minuteswest;
       int   tz_dsttime;
    };

    // FUNCTIONS
    ATLAS_SYM int gettimeofday(struct timeval * tv, struct timezone * tz);
#else
   #include <sys/time.h>
#endif

#endif

Add the atSymbols to this so the getTimeOfDay function was usable outside of the windows dll.


#pragma once

#include "OSD\OSD.h"
#include "MeterWnd\MeterWnd.h"

class VolumeSlider : public OSD {
public:
    VolumeSlider(HINSTANCE hInstance, Settings &settings);

    void Hide();

private:
    MeterWnd _mWnd;

};

#pragma once

#include "OSD\OSD.h"
#include "SliderWnd.h"

class VolumeSlider : public OSD {
public:
    VolumeSlider(HINSTANCE hInstance, Settings &settings);

    void Hide();

private:
    SliderWnd _sWnd;

};

Use a sliderwnd instance to implement the volume slider


#ifndef __DEBUG_H__
#define __DEBUG_H__

// Not using extern, define your own static dbflags in each file
// extern unsigned int dbflags;

/*
 * Bit flags for DEBUG()
 */
#define DB_PLIO        0x001
#define DB_TIMER       0x002
#define DB_USER_INPUT  0x004
#define DB_TRAIN_CTRL  0x008
// #define DB_THREADS     0x010
// #define DB_VM          0x020
// #define DB_EXEC        0x040
// #define DB_VFS         0x080
// #define DB_SFS         0x100
// #define DB_NET         0x200
// #define DB_NETFS       0x400
// #define DB_KMALLOC     0x800

#if 0
#define DEBUG(d, fmt, ...) (((dbflags) & (d)) ? plprintf(COM2, fmt, __VA_ARGS__) : 0)
#else
#define DEBUG(d, fmt, args...) (((dbflags) & (d)) ? plprintf(COM2, fmt, ##args) : 0)
#endif

#endif // __DEBUG_H__

#ifndef __DEBUG_H__
#define __DEBUG_H__

// Not using extern, define your own static dbflags in each file
// extern unsigned int dbflags;

/*
 * Bit flags for DEBUG()
 */
#define DB_IO        0x001
#define DB_TIMER       0x002
#define DB_USER_INPUT  0x004
#define DB_TRAIN_CTRL  0x008
// #define DB_THREADS     0x010
// #define DB_VM          0x020
// #define DB_EXEC        0x040
// #define DB_VFS         0x080
// #define DB_SFS         0x100
// #define DB_NET         0x200
// #define DB_NETFS       0x400
// #define DB_KMALLOC     0x800

#if 0
#define DEBUG(d, fmt, ...) (((dbflags) & (d)) ? plprintf(COM2, fmt, __VA_ARGS__) : 0)
#else
#define DEBUG(d, fmt, args...) (((dbflags) & (d)) ? plprintf(COM2, fmt, ##args) : 0)
#endif

#endif // __DEBUG_H__

Rename DB_PLIO to DB_IO, indicate general IO Debugging