// Copyright (c) 2010 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_GPU_GPU_CONFIG_H_
#define CHROME_GPU_GPU_CONFIG_H_

// This file declares common preprocessor configuration for the GPU process.

#include "build/build_config.h"

#if defined(OS_LINUX) && !defined(ARCH_CPU_X86)

// Only define GLX support for Intel CPUs for now until we can get the
// proper dependencies and build setup for ARM.
#define GPU_USE_GLX

#endif

#endif  // CHROME_GPU_GPU_CONFIG_H_

// Copyright (c) 2010 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_GPU_GPU_CONFIG_H_
#define CHROME_GPU_GPU_CONFIG_H_

// This file declares common preprocessor configuration for the GPU process.

#include "build/build_config.h"

#if defined(OS_LINUX) && defined(ARCH_CPU_X86)

// Only define GLX support for Intel CPUs for now until we can get the
// proper dependencies and build setup for ARM.
#define GPU_USE_GLX

#endif

#endif  // CHROME_GPU_GPU_CONFIG_H_

Fix stupid error for Linux build.

Fix stupid error for Linux build.

TEST=none
BUG=none
Review URL: http://codereview.chromium.org/555096

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


/*
 * Copyright (C) 2007
 *  Jacob Berkman
 * Copyright (C) 2008
 *  Ludovic Rousseau <ludovic.rousseau@free.fr>
 */

#ifndef LASSERT_H
#define LASSERT_H

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

#if 0
#define FAIL exit (1)
#else
#define FAIL return 1
#endif

#define LASSERT(cond)                                                   \
    ({                                                                  \
        if (cond)                                                       \
            ;                                                           \
        else {                                                          \
            fprintf (stderr, "%s:%d: assertion FAILED: " #cond "\n",    \
                     __FILE__, __LINE__);                               \
            FAIL;                                                       \
        }                                                               \
    })

#define LASSERTF(cond, fmt, a...)                                       \
    ({                                                                  \
        if (cond)                                                       \
            ;                                                           \
        else {                                                          \
            fprintf (stderr, "%s:%d: assertion FAILED: " #cond ": " fmt, \
                     __FILE__, __LINE__, ## a);                         \
            FAIL;                                                       \
        }                                                               \
    })

#endif /* LASSERT_H */

/*
 * Copyright (C) 2007
 *  Jacob Berkman
 * Copyright (C) 2008
 *  Ludovic Rousseau <ludovic.rousseau@free.fr>
 */

#ifndef LASSERT_H
#define LASSERT_H

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

#if 0
#define FAIL exit (1)
#else
#define FAIL return 1
#endif

#define LASSERT(cond)                                                   \
    ({                                                                  \
        if (! (cond))                                                     \
        {                                                               \
            fprintf (stderr, "%s:%d: assertion FAILED: " #cond "\n",    \
                     __FILE__, __LINE__);                               \
            FAIL;                                                       \
        }                                                               \
    })

#define LASSERTF(cond, fmt, a...)                                       \
    ({                                                                  \
        if (! (cond))                                                     \
        {                                                               \
            fprintf (stderr, "%s:%d: assertion FAILED: " #cond ": " fmt, \
                     __FILE__, __LINE__, ## a);                         \
            FAIL;                                                       \
        }                                                               \
    })

#endif /* LASSERT_H */

Fix splint error
src/pcsc-wirecheck-dist.c:19:164: Body of if clause of if statement is empty

git-svn-id: f2d781e409b7e36a714fc884bb9b2fc5091ddd28@4755 0ce88b0d-b2fd-0310-8134-9614164e65ea


void
delput(float x, float *a, int *l)
{

/* put value in delay line. See delset. x is float */

	*(a + (*l)++) = x;
	if(*(l) >= *(l+1)) *l -= *(l+1);
}

/* put value in delay line. See delset. x is float */
void
delput(float x, float *a, int *l)
{
	int index = l[0];
	a[index] = x;
	l[0]++;
	if (l[0] >= l[2])
		l[0] -= l[2];
}

Update to new bookkeeping array format.

Update to new bookkeeping array format.


#ifndef CPR_ERROR_H
#define CPR_ERROR_H

#include <string>

#include "cprtypes.h"
#include "defines.h"

namespace cpr {

enum class ErrorCode {
    OK = 0,
    CONNECTION_FAILURE,
    EMPTY_RESPONSE,
    HOST_RESOLUTION_FAILURE,
    INTERNAL_ERROR,
    INVALID_URL_FORMAT,
    NETWORK_RECEIVE_ERROR,
    NETWORK_SEND_FAILURE,
    OPERATION_TIMEDOUT,
    PROXY_RESOLUTION_FAILURE,
    SSL_CONNECT_ERROR,
    SSL_LOCAL_CERTIFICATE_ERROR,
    SSL_REMOTE_CERTIFICATE_ERROR,
    SSL_CACERT_ERROR,
    GENERIC_SSL_ERROR,
    UNSUPPORTED_PROTOCOL,
    UNKNOWN_ERROR = 1000,
};

class Error {
  public:
    Error() : code{ErrorCode::OK} {}

    template <typename TextType>
    Error(const ErrorCode& p_error_code, TextType&& p_error_message)
            : code{p_error_code}, message{CPR_FWD(p_error_message)} {}

    explicit operator bool() const {
        return code != ErrorCode::OK;
    }

    ErrorCode code;
    std::string message;

  private:
    static ErrorCode getErrorCodeForCurlError(int curl_code);
};

} // namespace cpr

#endif

#ifndef CPR_ERROR_H
#define CPR_ERROR_H

#include <string>

#include "cprtypes.h"
#include "defines.h"

namespace cpr {

enum class ErrorCode {
    OK = 0,
    CONNECTION_FAILURE,
    EMPTY_RESPONSE,
    HOST_RESOLUTION_FAILURE,
    INTERNAL_ERROR,
    INVALID_URL_FORMAT,
    NETWORK_RECEIVE_ERROR,
    NETWORK_SEND_FAILURE,
    OPERATION_TIMEDOUT,
    PROXY_RESOLUTION_FAILURE,
    SSL_CONNECT_ERROR,
    SSL_LOCAL_CERTIFICATE_ERROR,
    SSL_REMOTE_CERTIFICATE_ERROR,
    SSL_CACERT_ERROR,
    GENERIC_SSL_ERROR,
    UNSUPPORTED_PROTOCOL,
    UNKNOWN_ERROR = 1000,
};

class Error {
  public:
    Error() : code{ErrorCode::OK} {}

    template <typename TextType>
    Error(const int& curl_code, TextType&& p_error_message)
            : code{getErrorCodeForCurlError(curl_code)}, message{CPR_FWD(p_error_message)} {}

    explicit operator bool() const {
        return code != ErrorCode::OK;
    }

    ErrorCode code;
    std::string message;

  private:
    static ErrorCode getErrorCodeForCurlError(int curl_code);
};

} // namespace cpr

#endif

Make constructor for taking in curl code as the first argument


#pragma once

#include <array>

class WaveShape {
  public:
	static const unsigned int granularity = 12;
	static const int16_t size             = 1 << granularity;
	std::array<int16_t, size> table       = {{0}};
};

inline WaveShape MkSineWaveShape() {
	WaveShape waveShape;
	for(unsigned int i = 0; i < WaveShape::size; ++i) {
		double sample = sin(i * 2.0 * 3.14159265358979 / WaveShape::size);
		waveShape.table[i] =
		    static_cast<int16_t>((sample + 1) * 32767.0 - 32768.0);
	}
	return waveShape;
}

inline WaveShape MkSquareWaveShape() {
	WaveShape waveShape;
	for(unsigned int i = 0; i < WaveShape::size; ++i) {
		double sample = i * 2 < WaveShape::size ? 1.0 : -1.0;
		waveShape.table[i] =
		    static_cast<int16_t>((sample + 1) * 32767.0 - 32768.0);
	}
	return waveShape;
}

#pragma once

#include <array>
#include <polar/math/constants.h>

class WaveShape {
  public:
	static const unsigned int granularity = 12;
	static const int16_t size             = 1 << granularity;
	std::array<int16_t, size> table       = {{0}};
};

inline WaveShape MkSineWaveShape() {
	WaveShape waveShape;
	for(unsigned int i = 0; i < WaveShape::size; ++i) {
		double sample = sin(i * polar::math::TWO_PI / WaveShape::size);
		waveShape.table[i] =
		    static_cast<int16_t>((sample + 1) * 32767.0 - 32768.0);
	}
	return waveShape;
}

inline WaveShape MkSquareWaveShape() {
	WaveShape waveShape;
	for(unsigned int i = 0; i < WaveShape::size; ++i) {
		double sample = i * 2 < WaveShape::size ? 1.0 : -1.0;
		waveShape.table[i] =
		    static_cast<int16_t>((sample + 1) * 32767.0 - 32768.0);
	}
	return waveShape;
}

Use TWO_PI constant instead of literal

Use TWO_PI constant instead of literal


#include "hdbc-odbc-helper.h"
#include <sqlext.h>
#include <stdio.h>
#include <stdlib.h>

SQLLEN nullDataHDBC = SQL_NULL_DATA;

int sqlSucceeded(SQLRETURN ret) {
  return SQL_SUCCEEDED(ret);
}

void *getSqlOvOdbc3(void) {
  return (void *)SQL_OV_ODBC3;
}

SQLRETURN simpleSqlTables(SQLHSTMT stmt) {
  return SQLTables(stmt, NULL, 0, NULL, 0, "%", 1, "TABLE", 5);
}

SQLRETURN simpleSqlColumns(SQLHSTMT stmt, SQLCHAR *tablename,
                           SQLSMALLINT tnlen) {
  return SQLColumns(stmt, NULL, 0, NULL, 0, tablename, tnlen, "%", 1);
}

#include "hdbc-odbc-helper.h"
#include <sqlext.h>
#include <stdio.h>
#include <stdlib.h>

SQLLEN nullDataHDBC = SQL_NULL_DATA;

int sqlSucceeded(SQLRETURN ret) {
  return SQL_SUCCEEDED(ret);
}

void *getSqlOvOdbc3(void) {
  return (void *)SQL_OV_ODBC3;
}

SQLRETURN simpleSqlTables(SQLHSTMT stmt) {
  return SQLTables(stmt, NULL, 0, NULL, 0, (SQLCHAR *)"%", 1, (SQLCHAR *)"TABLE", 5);
}

SQLRETURN simpleSqlColumns(SQLHSTMT stmt, SQLCHAR *tablename,
                           SQLSMALLINT tnlen) {
  return SQLColumns(stmt, NULL, 0, NULL, 0, tablename, tnlen, (SQLCHAR *)"%", 1);
}

Add explicit cast from (const char []) to (SQLCHAR *)


/**
 * cpuid.c
 *
 * Checks if CPU has support of SHA instructions
 *
 * @author kryukov@frtk.ru
 * @version 4.0
 *
 * For Putty AES NI project
 * http://putty-aes-ni.googlecode.com/
 */

#ifndef SILENT
#include <stdio.h>
#endif

#if defined(__clang__) || defined(__GNUC__)

#include <cpuid.h>
static int CheckCPUsupportSHA()
{
    unsigned int CPUInfo[4];
    __cpuid_count(7, 0, CPUInfo[0], CPUInfo[1], CPUInfo[2], CPUInfo[3]);
    return CPUInfo[1] & (1 << 29); /* Check SHA */
}

#else /* defined(__clang__) || defined(__GNUC__) */

static int CheckCPUsupportSHA()
{
    unsigned int CPUInfo[4];
    __cpuidex(CPUInfo, 7, 0);
    return CPUInfo[1] & (1 << 29); /* Check SHA */
}

#endif /* defined(__clang__) || defined(__GNUC__) */

int main(int argc, char ** argv)
{
    const int res = !CheckCPUsupportSHA();
#ifndef SILENT
    printf("This CPU %s SHA-NI\n", res ? "does not support" : "supports");
#endif
    return res;
}

/**
 * cpuid.c
 *
 * Checks if CPU has support of SHA instructions
 *
 * @author kryukov@frtk.ru
 * @version 4.0
 *
 * For Putty AES NI project
 * http://putty-aes-ni.googlecode.com/
 */

#ifndef SILENT
#include <stdio.h>
#endif

#if defined(__clang__) || defined(__GNUC__)

#include <cpuid.h>
static int CheckCPUsupportSHA()
{
    unsigned int CPUInfo[4];
    __cpuid(0, CPUInfo[0], CPUInfo[1], CPUInfo[2], CPUInfo[3]);
    if (CPUInfo[0] < 7)
        return 0;

    __cpuid_count(7, 0, CPUInfo[0], CPUInfo[1], CPUInfo[2], CPUInfo[3]);
    return CPUInfo[1] & (1 << 29); /* Check SHA */
}

#else /* defined(__clang__) || defined(__GNUC__) */

static int CheckCPUsupportSHA()
{
    unsigned int CPUInfo[4];
    __cpuid(CPUInfo, 0);
    if (CPUInfo[0] < 7)
        return 0;

    __cpuidex(CPUInfo, 7, 0);
    return CPUInfo[1] & (1 << 29); /* Check SHA */
}

#endif /* defined(__clang__) || defined(__GNUC__) */

int main(int argc, char ** argv)
{
    const int res = !CheckCPUsupportSHA();
#ifndef SILENT
    printf("This CPU %s SHA-NI\n", res ? "does not support" : "supports");
#endif
    return res;
}

Add leaf checks to SHA CPUID checks

Add leaf checks to SHA CPUID checks


/**
 * See Copyright Notice in picrin.h
 */

#ifndef GC_H__
#define GC_H__

#if defined(__cplusplus)
extern "C" {
#endif

enum pic_gc_mark {
  PIC_GC_UNMARK = 0,
  PIC_GC_MARK
};

union header {
  struct {
    union header *ptr;
    size_t size;
    enum pic_gc_mark mark : 1;
  } s;
  long alignment[2];
};

struct heap_page {
  union header *basep, *endp;
  struct heap_page *next;
};

struct pic_heap {
  union header base, *freep;
  struct heap_page *pages;
};

void init_heap(struct pic_heap *);
void finalize_heap(struct pic_heap *);

#if defined(__cplusplus)
}
#endif

#endif

/**
 * See Copyright Notice in picrin.h
 */

#ifndef GC_H__
#define GC_H__

#if defined(__cplusplus)
extern "C" {
#endif

#define PIC_GC_UNMARK 0
#define PIC_GC_MARK 1

union header {
  struct {
    union header *ptr;
    size_t size;
    unsigned int mark : 1;
  } s;
  long alignment[2];
};

struct heap_page {
  union header *basep, *endp;
  struct heap_page *next;
};

struct pic_heap {
  union header base, *freep;
  struct heap_page *pages;
};

void init_heap(struct pic_heap *);
void finalize_heap(struct pic_heap *);

#if defined(__cplusplus)
}
#endif

#endif

Define the type of marking flags as unsigned int.

We could define it as _Bool since we are going to use C99, but unsigned
int is more portable (even in C89!) and extensible (when we decide to
use tri-color marking GC.)

Signed-off-by: OGINO Masanori <c49462fef669560e618607913e6c283f7627123c@gmail.com>


/*
 * Copyright 2016 Google Inc.
 *
 * Use of this source code is governed by a BSD-style license that can be
 * found in the LICENSE file.
 */
#ifndef SK_MILESTONE
#define SK_MILESTONE 63
#endif

/*
 * Copyright 2016 Google Inc.
 *
 * Use of this source code is governed by a BSD-style license that can be
 * found in the LICENSE file.
 */
#ifndef SK_MILESTONE
#define SK_MILESTONE 64
#endif

Update Skia milestone to 64

Update Skia milestone to 64

Bug: skia:
Change-Id: I381323606f92a5388b3fd76c232e35c492a23dc4
Reviewed-on: https://skia-review.googlesource.com/58840
Reviewed-by: Heather Miller <2e22000c5d22374561fe5fba576a31095b72dc2e@google.com>
Commit-Queue: Heather Miller <2e22000c5d22374561fe5fba576a31095b72dc2e@google.com>


/*
 * Copyright (C) 2012 the libgit2 contributors
 *
 * This file is part of libgit2, distributed under the GNU GPL v2 with
 * a Linking Exception. For full terms see the included COPYING file.
 */
#ifndef INCLUDE_git_checkout_h__
#define INCLUDE_git_checkout_h__

#include "common.h"
#include "types.h"
#include "indexer.h"

/**
 * @file git2/checkout.h
 * @brief Git checkout routines
 * @defgroup git_checkout Git checkout routines
 * @ingroup Git
 * @{
 */
GIT_BEGIN_DECL

/**
 * Updates files in the working tree to match the version in the index
 * or HEAD.
 *
 * @param repo repository to check out (must be non-bare)
 * @param origin_url repository to clone from
 * @param workdir_path local directory to clone to
 * @param stats pointer to structure that receives progress information (may be NULL)
 * @return 0 on success, GIT_ERROR otherwise (use git_error_last for information about the error)
 */
GIT_EXTERN(int) git_checkout_force(git_repository *repo, git_indexer_stats *stats);

/** @} */
GIT_END_DECL
#endif

/*
 * Copyright (C) 2012 the libgit2 contributors
 *
 * This file is part of libgit2, distributed under the GNU GPL v2 with
 * a Linking Exception. For full terms see the included COPYING file.
 */
#ifndef INCLUDE_git_checkout_h__
#define INCLUDE_git_checkout_h__

#include "common.h"
#include "types.h"
#include "indexer.h"

/**
 * @file git2/checkout.h
 * @brief Git checkout routines
 * @defgroup git_checkout Git checkout routines
 * @ingroup Git
 * @{
 */
GIT_BEGIN_DECL

/**
 * Updates files in the working tree to match the version in the index.
 *
 * @param repo repository to check out (must be non-bare)
 * @param stats pointer to structure that receives progress information (may be NULL)
 * @return 0 on success, GIT_ERROR otherwise (use git_error_last for information about the error)
 */
GIT_EXTERN(int) git_checkout_force(git_repository *repo, git_indexer_stats *stats);

/** @} */
GIT_END_DECL
#endif

Fix documentation comment to match actual params.


//
//  SocketIOJSONSerialization.h
//  v0.22 ARC
//
//  based on
//  socketio-cocoa https://github.com/fpotter/socketio-cocoa
//  by Fred Potter <fpotter@pieceable.com>
//
//  using
//  https://github.com/square/SocketRocket
//  https://github.com/stig/json-framework/
//
//  reusing some parts of
//  /socket.io/socket.io.js
//
//  Created by Philipp Kyeck http://beta-interactive.de
//
//  Updated by
//    samlown   https://github.com/samlown
//    kayleg    https://github.com/kayleg
//

#import <Foundation/Foundation.h>

@interface SocketIOJSONSerialization

+ (id) objectFromJSONData:(NSData *)data error:(NSError **)error;
+ (NSString *) JSONStringFromObject:(id)object error:(NSError **)error;

@end

//
//  SocketIOJSONSerialization.h
//  v0.22 ARC
//
//  based on
//  socketio-cocoa https://github.com/fpotter/socketio-cocoa
//  by Fred Potter <fpotter@pieceable.com>
//
//  using
//  https://github.com/square/SocketRocket
//  https://github.com/stig/json-framework/
//
//  reusing some parts of
//  /socket.io/socket.io.js
//
//  Created by Philipp Kyeck http://beta-interactive.de
//
//  Updated by
//    samlown   https://github.com/samlown
//    kayleg    https://github.com/kayleg
//

#import <Foundation/Foundation.h>

@interface SocketIOJSONSerialization : NSObject

+ (id) objectFromJSONData:(NSData *)data error:(NSError **)error;
+ (NSString *) JSONStringFromObject:(id)object error:(NSError **)error;

@end

Fix for totally bogus interface declaration

In my rush to refactor JSON serialization, I made a new class that doesn't inherit from NSObject.  Why this
is a) allowed, b) doesn't result in epic failure on OS X is beyond me.


/**
 * \file   os_rmdir.c
 * \brief  Remove a subdirectory.
 * \author Copyright (c) 2002-2008 Jason Perkins and the Premake project
 */

#include <stdlib.h>
#include "premake.h"

int os_rmdir(lua_State* L)
{
	int z;
	const char* path = luaL_checkstring(L, 1);

#if PLATFORM_WINDOWS
	z = RemoveDirectory(path);
#else
	z = rmdir(path);
#endif

	if (!z)
	{
		lua_pushnil(L);
		lua_pushfstring(L, "unable to remove directory '%s'", path);
		return 2;
	}
	else
	{
		lua_pushboolean(L, 1);
		return 1;
	}
}

/**
 * \file   os_rmdir.c
 * \brief  Remove a subdirectory.
 * \author Copyright (c) 2002-2013 Jason Perkins and the Premake project
 */

#include <stdlib.h>
#include "premake.h"

int os_rmdir(lua_State* L)
{
	int z;
	const char* path = luaL_checkstring(L, 1);

#if PLATFORM_WINDOWS
	z = RemoveDirectory(path);
#else
	z = (0 == rmdir(path));
#endif

	if (!z)
	{
		lua_pushnil(L);
		lua_pushfstring(L, "unable to remove directory '%s'", path);
		return 2;
	}
	else
	{
		lua_pushboolean(L, 1);
		return 1;
	}
}

Fix error result handling in os.rmdir()

Fix error result handling in os.rmdir()


#ifndef INOTIFY_EVENT_HANDLER_H
#define INOTIFY_EVENT_HANDLER_H

#include "InotifyEventLoop.h"
#include "InotifyTree.h"
#include <queue>
#include <map>
#include <iostream>

class InotifyEventLoop;
class InotifyTree;

class InotifyService {
public:
  InotifyService(std::string path);
  ~InotifyService();

  void create(int wd, std::string name);
  void createDirectory(int wd, std::string name);
  void modify(int wd, std::string name);
  void remove(int wd, std::string name);
  void removeDirectory(int wd);
  void rename(int wd, std::string oldName, std::string newName);
  void renameDirectory(int wd, std::string oldName, std::string newName);
private:
  void createDirectoryTree(std::string directoryTreePath);

  InotifyEventLoop *mEventLoop;
  InotifyTree *mTree;
  int mInotifyInstance;
  int mAttributes;
};

#endif

#ifndef INOTIFY_EVENT_HANDLER_H
#define INOTIFY_EVENT_HANDLER_H

#include "InotifyEventLoop.h"
#include "InotifyTree.h"
#include <queue>
#include <map>
#include <iostream>

class InotifyEventLoop;
class InotifyTree;

class InotifyService {
public:
  InotifyService(std::string path);
  ~InotifyService();

private:
  void create(int wd, std::string name);
  void createDirectory(int wd, std::string name);
  void createDirectoryTree(std::string directoryTreePath);
  void modify(int wd, std::string name);
  void remove(int wd, std::string name);
  void removeDirectory(int wd);
  void rename(int wd, std::string oldName, std::string newName);
  void renameDirectory(int wd, std::string oldName, std::string newName);

  InotifyEventLoop *mEventLoop;
  InotifyTree *mTree;
  int mInotifyInstance;
  int mAttributes;

  friend class InotifyEventLoop;
};

#endif

Hide internal methods using friend class specifier


#ifndef _gnugol_engines
#define _gnugol_engines 1

#ifdef DEBUG_SHAREDLIBS
#  define GNUGOL_SHAREDLIBDIR "../engines"
#else
#  define GNUGOL_SHAREDLIBDIR "/var/lib/gnugol"
#endif

typedef struct ggengine
{
  Node         node;
  void        *lib;
  const char  *name;
  int        (*setup) (QueryOptions_t *);
  int        (*search)(QueryOptions_t *);
} *GnuGolEngine;

GnuGoldEngine	gnugol_engine_load	(const char *);
int		gnugol_engine_query	(GnuGolEngine,QueryOptions_t *);
void		gnugol_engine_unload	(GnuGolEngine);
int		gnugol_read_key		(char *const,size_t *const,const char *const);

#endif

#ifndef _gnugol_engines
#define _gnugol_engines 1

#include "nodelist.h"

#ifdef DEBUG_SHAREDLIBS
#  define GNUGOL_SHAREDLIBDIR "../engines"
#else
#  define GNUGOL_SHAREDLIBDIR "/var/lib/gnugol"
#endif

typedef struct ggengine
{
  Node         node;
  void        *lib;
  const char  *name;
  int        (*setup) (QueryOptions_t *);
  int        (*search)(QueryOptions_t *);
} *GnuGolEngine;

GnuGolEngine	gnugol_engine_load	(const char *);
int		gnugol_engine_query	(GnuGolEngine,QueryOptions_t *);
void		gnugol_engine_unload	(GnuGolEngine);
int		gnugol_read_key		(char *const,size_t *const,const char *const);

#endif

Include nodelist here, and fix a typo.

Include nodelist here, and fix a typo.


/* Copyright (c) 2013-2015 Dovecot authors, see the included COPYING file */

#include "lib.h"
#include "dict-private.h"

void dict_drivers_register_builtin(void)
{
	dict_driver_register(&dict_driver_client);
	dict_driver_register(&dict_driver_file);
	dict_driver_register(&dict_driver_fs);
	dict_driver_register(&dict_driver_memcached);
	dict_driver_register(&dict_driver_memcached_ascii);
	dict_driver_register(&dict_driver_redis);
}

void dict_drivers_unregister_builtin(void)
{
	dict_driver_unregister(&dict_driver_client);
	dict_driver_unregister(&dict_driver_file);
	dict_driver_unregister(&dict_driver_fs);
	dict_driver_unregister(&dict_driver_memcached);
	dict_driver_unregister(&dict_driver_memcached_ascii);
	dict_driver_unregister(&dict_driver_redis);
}

/* Copyright (c) 2013-2015 Dovecot authors, see the included COPYING file */

#include "lib.h"
#include "dict-private.h"

static int refcount = 0;

void dict_drivers_register_builtin(void)
{
	if (refcount++ > 0)
		return;
	dict_driver_register(&dict_driver_client);
	dict_driver_register(&dict_driver_file);
	dict_driver_register(&dict_driver_fs);
	dict_driver_register(&dict_driver_memcached);
	dict_driver_register(&dict_driver_memcached_ascii);
	dict_driver_register(&dict_driver_redis);
}

void dict_drivers_unregister_builtin(void)
{
	if (--refcount > 0)
		return;
	dict_driver_unregister(&dict_driver_client);
	dict_driver_unregister(&dict_driver_file);
	dict_driver_unregister(&dict_driver_fs);
	dict_driver_unregister(&dict_driver_memcached);
	dict_driver_unregister(&dict_driver_memcached_ascii);
	dict_driver_unregister(&dict_driver_redis);
}

lib-dict: Allow registering builtin dict drivers multiple times.


/**
 * http://www.compuphase.com/graphic/scale.htm
 */

void ScaleLine(int *Target, int *Source, int SrcWidth, int TgtWidth)
{
  int NumPixels = TgtWidth;
  int IntPart = SrcWidth / TgtWidth;
  int FractPart = SrcWidth % TgtWidth;
  int E = 0;

  while (NumPixels-- > 0) {
    *Target++ = *Source;
    Source += IntPart;
    E += FractPart;
    if (E >= TgtWidth) {
      E -= TgtWidth;
      Source++;
    } /* if */
  } /* while */
}

void resizeImage(int *Source, int *Target, int SrcWidth, int SrcHeight, int TgtWidth, int TgtHeight)
{
  int NumPixels = TgtHeight;
  int IntPart = (SrcHeight / TgtHeight) * SrcWidth;
  int FractPart = SrcHeight % TgtHeight;
  int E = 0;
  int *PrevSource = NULL;

  while (NumPixels-- > 0) {
    if (Source == PrevSource) {
      memcpy(Target, Target-TgtWidth, TgtWidth*sizeof(*Target));
    } else {
      ScaleLine(Target, Source, SrcWidth, TgtWidth);
      PrevSource = Source;
    } /* if */
    Target += TgtWidth;
    Source += IntPart;
    E += FractPart;
    if (E >= TgtHeight) {
      E -= TgtHeight;
      Source += SrcWidth;
    } /* if */
  } /* while */
}

Add code to do basic image resizing

Add code to do basic image resizing

From: http://www.compuphase.com/graphic/scale.htm


#pragma once

#include <iostream>

// The same as assert, but expression is always evaluated and result returned
#define CHECK(expr) (assert(expr), expr)

#if !defined(NDEBUG) // Debug

namespace dev
{
namespace evmjit
{

std::ostream& getLogStream(char const* _channel);

}
}

#define DLOG(CHANNEL) ::dev::evmjit::getLogStream(#CHANNEL)

#else // Release
	#define DLOG(CHANNEL) true ? std::cerr : std::cerr
#endif

#pragma once

#include <iostream>

// The same as assert, but expression is always evaluated and result returned
#define CHECK(expr) (assert(expr), expr)

#if !defined(NDEBUG) // Debug

namespace dev
{
namespace evmjit
{

std::ostream& getLogStream(char const* _channel);

}
}

#define DLOG(CHANNEL) ::dev::evmjit::getLogStream(#CHANNEL)

#else // Release

namespace dev
{
namespace evmjit
{

struct Voider
{
	void operator=(std::ostream const&) {}
};

}
}

#define DLOG(CHANNEL) true ? (void)0 : ::dev::evmjit::Voider{} = std::cerr

#endif

Reimplement no-op version of DLOG to avoid C++ compiler warning


#ifndef TDCChannel_h
#define TDCChannel_h

#include <fstream>
#include <TObject.h>
#include <TClonesArray.h>
#include <iostream>

#define MAX_FULL_HITS 100

class TDCChannel : public TObject {

protected:
  Int_t channel;

	double leadTime1;
	double trailTime1;
	double tot1;
	double referenceDiff1;

	double leadTimes[MAX_FULL_HITS];
	double trailTimes[MAX_FULL_HITS];
	double tots[MAX_FULL_HITS];
	double referenceDiffs[MAX_FULL_HITS];
	int hitsNum;

public:

  TDCChannel();
  ~TDCChannel();

  void SetChannel(Int_t channel) { this->channel = channel; }
	int GetChannel() { return channel; }

	int GetHitsNum() { return hitsNum; }

	void AddHit(double lead, double trail, double ref);
	void AddHit(double lead, double trail);
	double GetLeadTime1() { return leadTime1; }
	double GetLeadTime(int mult) { return leadTimes[mult]; }
	double GetTrailTime1() { return trailTime1; }
	double GetTrailTime(int mult) { return trailTimes[mult]; }
	double GetTOT1() { return tot1; }
	int GetMult() { return hitsNum; }
	double GetTOT(int mult) { return tots[mult]; }

  ClassDef(TDCChannel,1);
};

#endif

#ifndef TDCChannel_h
#define TDCChannel_h

#include <fstream>
#include <TObject.h>
#include <TClonesArray.h>
#include <iostream>

#define MAX_FULL_HITS 50

class TDCChannel : public TObject {

protected:
  Int_t channel;

	double leadTime1;
	double trailTime1;
	double tot1;
	double referenceDiff1;

	double leadTimes[MAX_FULL_HITS];
	double trailTimes[MAX_FULL_HITS];
	double tots[MAX_FULL_HITS];
	double referenceDiffs[MAX_FULL_HITS];
	int hitsNum;

public:

  TDCChannel();
  ~TDCChannel();

  void SetChannel(Int_t channel) { this->channel = channel; }
	int GetChannel() { return channel; }

	int GetHitsNum() { return hitsNum; }

	void AddHit(double lead, double trail, double ref);
	void AddHit(double lead, double trail);
	double GetLeadTime1() { return leadTime1; }
	double GetLeadTime(int mult) { return leadTimes[mult]; }
	double GetTrailTime1() { return trailTime1; }
	double GetTrailTime(int mult) { return trailTimes[mult]; }
	double GetTOT1() { return tot1; }
	int GetMult() { return hitsNum; }
	double GetTOT(int mult) { return tots[mult]; }

  ClassDef(TDCChannel,1);
};

#endif

Change TDCHits array size from 100 to 50

For consistency with the standalone version
of the Unpacker.


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

// constant
#define ALPHA_NUM 26

int main(int argc, char *argv[]) {

    // check argument number and argument key to be greater than -1
    if (argc != 2 || atoi(argv[1]) < 0) {
        printf("Usage (k >= 0):\n./caesar k \n");
        return 1;
    }

    int key = atoi(argv[1]) % ALPHA_NUM;

    // get plaintext from user
    printf("plaintext: ");
    string plaintext = get_string();
    printf("\n");

    // encode plaintext
    size_t text_len = strlen(plaintext);
    char ciphertext[text_len + 1]; // + 1 for '\0'

    for (int i = 0; i < text_len; i++) {
        if (isalpha(plaintext[i])) {
            if (isupper(plaintext[i])) {
                // Uppercase shift
                ciphertext[i] = (char) (((plaintext[i] + key - 'A') % ALPHA_NUM) + 'A');
            } else {
                // Lowercase shift
                ciphertext[i] = (char) (((plaintext[i] + key - 'a') % ALPHA_NUM) + 'a');
            }
        } else {
            // Skip non alpha
            ciphertext[i] = plaintext[i];
        }
    }

    printf("ciphertext: %s\n", ciphertext);

    return 0;
}

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

// constant
#define ALPHA_NUM 26

int main(int argc, char *argv[]) {

    // check argument number and argument key to be greater than -1
    if (argc != 2 || atoi(argv[1]) < 0) {
        printf("Usage (k >= 0):\n./caesar k \n");
        return 1;
    }

    int key = atoi(argv[1]) % ALPHA_NUM;

    // get plaintext from user
    printf("plaintext: ");
    string plaintext = get_string();

    // encode plaintext
    size_t text_len = strlen(plaintext);
    char ciphertext[text_len + 1]; // + 1 for '\0'

    for (int i = 0; i < text_len; i++) {
        if (isalpha(plaintext[i])) {
            if (isupper(plaintext[i])) {
                // Uppercase shift
                ciphertext[i] = (char) (((plaintext[i] + key - 'A') % ALPHA_NUM) + 'A');
            } else {
                // Lowercase shift
                ciphertext[i] = (char) (((plaintext[i] + key - 'a') % ALPHA_NUM) + 'a');
            }
        } else {
            // Skip non alpha
            ciphertext[i] = plaintext[i];
        }
    }

    printf("ciphertext: %s\n", ciphertext);

    return 0;
}

Remove printf for testing with check50

Remove printf for testing with check50


#ifndef ZEPHYR_CEXPORT_H
#define ZEPHYR_CEXPORT_H

#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 ns ## _ ## n
#endif

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

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

#endif

#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

Add variable name to namespace binding

Add variable name to namespace binding


/**
 * @file    Map.h
 * @ingroup Utils
 * @brief   Template helper functions for std::map
 *
 * Copyright (c) 2017 Sebastien Rombauts (sebastien.rombauts@gmail.com)
 *
 * Distributed under the MIT License (MIT) (See accompanying file LICENSE.txt
 * or copy at http://opensource.org/licenses/MIT)
 */
#pragma once

#include <sstream>
#include <string>

namespace Utils {

/// Tells if a std::map have a specific key (similar to std::map::count())
template <typename Map>
bool hasKey(const Map& aMap, const std::string& aKey) {
    return (aMap.find(aKey) != aMap.end());
}

/// Tells if a std::map have a specific value
template <typename Map>
bool hasValue(const Map& aMap, const std::string& aKey, const std::string& aValue) {
    bool bHaveValue = false;
    const typename Map::const_iterator iPair = aMap.find(aKey);
    if (iPair != aMap.end()) {
        bHaveValue = (iPair->second == aValue);
    }
    return bHaveValue;
}

} // namespace Utils

Add template helper functions for std::map


#ifndef _CHAIR_AFFAIR_NOTE
#define _CHAIR_AFFAIR_NOTE

#include <inttypes.h>
#include <config.h>
#include <FastLED.h>

typedef struct note_range_t {
	uint16_t start;
	uint16_t end;
} note_range_t;

class Note {
public:
	Note(CRGB aColor, uint16_t order, uint16_t ledCount);

	void setColor(CRGB aColor);

private:
	CRGB _color;
	note_range_t _range;
};

#endif

#ifndef _CHAIR_AFFAIR_NOTE
#define _CHAIR_AFFAIR_NOTE

#include <inttypes.h>
#include <config.h>
#include <Arduino.h>

typedef struct note_range_t {
	uint16_t start;
	uint16_t end;
} note_range_t;

class Note {
public:
	Note(uint8_t aHue, uint16_t order, uint16_t ledCount);

	void setHue(uint8_t aHue);
	uint8_t hue();

	void setPlaying(boolean flag);
	boolean isPlaying();

private:
	boolean _playing;
	uint8_t _hue;
	note_range_t _range;
};

#endif

Use hue instead of color.

Use hue instead of color.

Also added a property for activation of the Note


#include "common/time.h"

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

static const double BENCHMARK_TIME = 5.0;
static const int NUM_ALLOCS = 1000000;

int main(int argc, const char** argv) {
  printf("Benchmark: Allocate/free %d memory chunks (4-128 bytes)...\n", NUM_ALLOCS);
  fflush(stdout);

  double best_time = 1e9;
  const double start_t = get_time();
  while (get_time() - start_t < BENCHMARK_TIME) {
    const double t0 = get_time();

    void* addresses[NUM_ALLOCS];

    for (int i = 0; i < NUM_ALLOCS; ++i) {
      const int memory_size = ((i % 32) + 1) * 4;
      addresses[i] = malloc(memory_size);
      ((char*)addresses[i])[0] = 1;
    }

    for (int i = 0; i < NUM_ALLOCS; ++i) {
      free(addresses[i]);
    }

    double dt = get_time() - t0;
    if (dt < best_time) {
      best_time = dt;
    }
  }

  printf("%f ns / alloc\n", (best_time / (double)NUM_ALLOCS) * 1000000000.0);
  fflush(stdout);

  return 0;
}

#include "common/time.h"

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

static const double BENCHMARK_TIME = 5.0;
#define NUM_ALLOCS 1000000

static void* s_addresses[NUM_ALLOCS];

int main(int argc, const char** argv) {
  printf("Benchmark: Allocate/free %d memory chunks (4-128 bytes)...\n", NUM_ALLOCS);
  fflush(stdout);

  double best_time = 1e9;
  const double start_t = get_time();
  while (get_time() - start_t < BENCHMARK_TIME) {
    const double t0 = get_time();

    for (int i = 0; i < NUM_ALLOCS; ++i) {
      const int memory_size = ((i % 32) + 1) * 4;
      s_addresses[i] = malloc(memory_size);
      ((char*)s_addresses[i])[0] = 1;
    }

    for (int i = 0; i < NUM_ALLOCS; ++i) {
      free(s_addresses[i]);
    }

    double dt = get_time() - t0;
    if (dt < best_time) {
      best_time = dt;
    }
  }

  printf("%f ns / alloc\n", (best_time / (double)NUM_ALLOCS) * 1000000000.0);
  fflush(stdout);

  return 0;
}

Use static memory for mem pointers

Use static memory for mem pointers


#include <ctype.h>
#include <stdio.h>
#include <stdlib.h>
#include <termios.h>
#include <unistd.h>

struct termios orig_termios;

void disable_raw_mode() {
	tcsetattr(STDIN_FILENO, TCSAFLUSH, &orig_termios);
}

void enable_raw_mode() {
	tcgetattr(STDIN_FILENO, &orig_termios);
	atexit(disable_raw_mode);

	struct termios raw = orig_termios;
	raw.c_iflag &= ~(IXON);
	raw.c_lflag &= ~(ECHO | ICANON | ISIG);

	tcsetattr(STDIN_FILENO, TCSAFLUSH, &raw);
}

int main() {
	enable_raw_mode();

	char c;
	while (read(STDIN_FILENO, &c, 1) == 1 && c != 'q') {
		if (iscntrl(c)) {
			printf("%d\n", c);
		} else {
			printf("%d ('%c')\n", c, c);
		}
	}
	return 0;
}

#include <ctype.h>
#include <stdio.h>
#include <stdlib.h>
#include <termios.h>
#include <unistd.h>

struct termios orig_termios;

void disable_raw_mode() {
	tcsetattr(STDIN_FILENO, TCSAFLUSH, &orig_termios);
}

void enable_raw_mode() {
	tcgetattr(STDIN_FILENO, &orig_termios);
	atexit(disable_raw_mode);

	struct termios raw = orig_termios;
	raw.c_iflag &= ~(IXON);
	raw.c_lflag &= ~(ECHO | ICANON | IEXTEN | ISIG);

	tcsetattr(STDIN_FILENO, TCSAFLUSH, &raw);
}

int main() {
	enable_raw_mode();

	char c;
	while (read(STDIN_FILENO, &c, 1) == 1 && c != 'q') {
		if (iscntrl(c)) {
			printf("%d\n", c);
		} else {
			printf("%d ('%c')\n", c, c);
		}
	}
	return 0;
}

Disable Ctrl-V (and Ctrl-O on macOS)

Disable Ctrl-V (and Ctrl-O on macOS)


#include <stdlib.h>
#ifndef __LIST_H__
#define __LIST_H__
struct ListNode;
struct List;
typedef struct ListNode ListNode;
typedef struct List List;

List* List_Create(void);
void List_Destroy(List* l);
ListNode* ListNode_Create(void *);
void ListNode_Destroy(ListNode* n);

#endif

#include <stdlib.h>
#ifndef __LIST_H__
#define __LIST_H__
struct ListNode;
struct List;
typedef struct ListNode ListNode;
typedef struct List List;

List* List_Create(void);
void List_Destroy(List* l);
ListNode* ListNode_Create(void *);
void ListNode_Destroy(ListNode* n);
ListNode* List_Search(List* l, void* k, int f(void*, void*));

#endif

Add List Search function declaration

Add List Search function declaration


#include <stdio.h>
#include "forsyth.h"

int main(int argc, char* argv[])
{
    FILE * stream;
    int FEN_status;

    if (argc < 2)
        FEN_status = load_FEN(
            "rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1"
        );
    else
        FEN_status = load_FEN(argv[1]);

#if defined(TEST_MATE_IN_ONE)
    memcpy(&square(a8), "nk....bq", 8);
    memcpy(&square(a7), "ppp.r...", 8);
    memcpy(&square(a6), "........", 8);
    memcpy(&square(a5), "........", 8);
    memcpy(&square(a4), "........", 8);
    memcpy(&square(a3), "........", 8);
    memcpy(&square(a2), "...R.PPP", 8);
    memcpy(&square(a1), "QB....KN", 8);
#endif

    if (FEN_status != FEN_OK)
    {
        fprintf(stderr, "(%i):  FEN record is corrupt!\n\n", FEN_status);
        return (FEN_status);
    }

    stream = (argc < 3) ? stdout : fopen(argv[2], "w");
    load_Forsyth(stream);
    fclose(stream);
    return 0;
}

#include <stdio.h>
#include "forsyth.h"

#include "check.h"

int main(int argc, char* argv[])
{
    FILE * stream;
    int FEN_status;

    if (argc < 2)
        FEN_status = load_FEN(
            "rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1"
        );
    else
        FEN_status = load_FEN(argv[1]);

#if defined(TEST_MATE_IN_ONE)
    memcpy(&square(a8), "nk....bq", 8);
    memcpy(&square(a7), "ppp.r...", 8);
    memcpy(&square(a6), "........", 8);
    memcpy(&square(a5), "........", 8);
    memcpy(&square(a4), "........", 8);
    memcpy(&square(a3), "........", 8);
    memcpy(&square(a2), "...R.PPP", 8);
    memcpy(&square(a1), "QB....KN", 8);
#endif

    if (FEN_status != FEN_OK)
    {
        fprintf(stderr, "(%i):  FEN record is corrupt!\n\n", FEN_status);
        return (FEN_status);
    }

    stream = (argc < 3) ? stdout : fopen(argv[2], "w");
    load_Forsyth(stream);
    fclose(stream);

    if (in_check(WHITE))
        puts("White is in check.");
    if (in_check(BLACK))
        puts("Black is in check.");
    return 0;
}

Debug check analysis for both sides.

Debug check analysis for both sides.


// This is a queue that can be accessed from multiple threads safely.
//
// It's not well optimized, and requires obtaining a lock every time you check for a new value.

#pragma once

#include <mutex>
#include <optional>
#include <queue>

template <class T>
class SynchronizedQueue {
    std::condition_variable cv_;
    std::mutex lock_;
    std::queue<T> q_;
public:

    void push(T && t) {
        std::unique_lock l(lock_);
        q_.push(std::move(t));
        cv_.notify_one();
    }

    std::optional<T> get() {
        std::unique_lock l(lock_);
        if(q_.empty()) {
            return std::nullopt;
        }

        T t = std::move(q_.front());
        q_.pop();
        return t;
    }

    T get_blocking() {
        std::unique_lock l(lock_);
        while(q_.empty()) {
            cv_.wait(l);
        }

        T t = std::move(q_.front());
        q_.pop();
        return std::move(t);
    }
};

// This is a queue that can be accessed from multiple threads safely.
//
// It's not well optimized, and requires obtaining a lock every time you check for a new value.

#pragma once

#include <condition_variable>
#include <mutex>
#include <optional>
#include <queue>

template <class T>
class SynchronizedQueue {
    std::condition_variable cv_;
    std::mutex lock_;
    std::queue<T> q_;
public:

    void push(T && t) {
        std::unique_lock l(lock_);
        q_.push(std::move(t));
        cv_.notify_one();
    }

    std::optional<T> get() {
        std::unique_lock l(lock_);
        if(q_.empty()) {
            return std::nullopt;
        }

        T t = std::move(q_.front());
        q_.pop();
        return t;
    }

    T get_blocking() {
        std::unique_lock l(lock_);
        while(q_.empty()) {
            cv_.wait(l);
        }

        T t = std::move(q_.front());
        q_.pop();
        return std::move(t);
    }
};

Fix compilation on Linux / Windows

Fix compilation on Linux / Windows


#include <stdio.h>

int c;
__thread int d;
register int R1 __asm__ ("%" "i5");

int main(void)
{
	c = 3;
	R1 = 5;
	d = 4;
	printf("C: %d\n", c);
	printf("D: %d\n", d);
	printf("R1: %d\n", R1);
	R1 *= 2;
	printf("R1: %d\n", R1);
	return 0;
}

#include <stdio.h>

int c;
__thread int d;
register int R1 __asm__ ("%" "r15");

int main(void)
{
	c = 3;
	R1 = 5;
	d = 4;
	printf("C: %d\n", c);
	printf("D: %d\n", d);
	printf("R1: %d\n", R1);
	R1 *= 2;
	printf("R1: %d\n", R1);
	return 0;
}

Fix gcc global reg extension test to work.

Had wrong register before.


/*
 *
 *  BlueZ - Bluetooth protocol stack for Linux
 *
 *  Copyright (C) 2012  Intel Corporation. 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 as published by
 *  the Free Software Foundation; either version 2 of the License, or
 *  (at your option) any later version.
 *
 *  This program is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with this program; if not, write to the Free Software
 *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 *
 */

#define COLOR_OFF	"\x1B[0m"
#define COLOR_BLUE	"\x1B[0;34m"

static inline void begin_message(void)
{
	rl_message("");
	printf("\r%*c\r", rl_end, ' ');
}

static inline void end_message(void)
{
	rl_clear_message();
}

void rl_printf(const char *fmt, ...) __attribute__((format(printf, 1, 2)));

/*
 *
 *  BlueZ - Bluetooth protocol stack for Linux
 *
 *  Copyright (C) 2012  Intel Corporation. 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 as published by
 *  the Free Software Foundation; either version 2 of the License, or
 *  (at your option) any later version.
 *
 *  This program is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with this program; if not, write to the Free Software
 *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 *
 */

#define COLOR_OFF	"\x1B[0m"
#define COLOR_BLUE	"\x1B[0;34m"

void rl_printf(const char *fmt, ...) __attribute__((format(printf, 1, 2)));

Remove broken helper for message blocks

client: Remove broken helper for message blocks


/*===================================================================

The Medical Imaging Interaction Toolkit (MITK)

Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.

This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.

See LICENSE.txt or http://www.mitk.org for details.

===================================================================*/

#ifndef MITKCESTDICOMReaderService_H
#define MITKCESTDICOMReaderService_H

#include <mitkBaseDICOMReaderService.h>

namespace mitk {

  /**
  Service wrapper that auto selects (using the mitk::DICOMFileReaderSelector) the best DICOMFileReader from
  the DICOMReader module and loads additional meta data for CEST data.
  */
  class CESTDICOMReaderService : public BaseDICOMReaderService
  {
  public:
    CESTDICOMReaderService();
    CESTDICOMReaderService(const std::string& description);

    /** Uses the BaseDICOMReaderService Read function and add extra steps for CEST meta data */
    virtual std::vector<itk::SmartPointer<BaseData> > Read() override;

  protected:
    /** Returns the reader instance that should be used. The decision may be based
    * one the passed relevant file list.*/
    virtual mitk::DICOMFileReader::Pointer GetReader(const mitk::StringList& relevantFiles) const override;

  private:

    virtual CESTDICOMReaderService* Clone() const override;
  };

}

#endif // MITKDICOMSERIESREADERSERVICE_H

/*===================================================================

The Medical Imaging Interaction Toolkit (MITK)

Copyright (c) German Cancer Research Center,
Division of Medical and Biological Informatics.
All rights reserved.

This software is distributed WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR
A PARTICULAR PURPOSE.

See LICENSE.txt or http://www.mitk.org for details.

===================================================================*/

#ifndef MITKCESTDICOMReaderService_H
#define MITKCESTDICOMReaderService_H

#include <mitkBaseDICOMReaderService.h>

namespace mitk {

  /**
  Service wrapper that auto selects (using the mitk::DICOMFileReaderSelector) the best DICOMFileReader from
  the DICOMReader module and loads additional meta data for CEST data.
  */
  class CESTDICOMReaderService : public BaseDICOMReaderService
  {
  public:
    CESTDICOMReaderService();
    CESTDICOMReaderService(const std::string& description);

    /** Uses the BaseDICOMReaderService Read function and add extra steps for CEST meta data */
    using AbstractFileReader::Read;
    virtual std::vector<itk::SmartPointer<BaseData> > Read() override;

  protected:
    /** Returns the reader instance that should be used. The decision may be based
    * one the passed relevant file list.*/
    virtual mitk::DICOMFileReader::Pointer GetReader(const mitk::StringList& relevantFiles) const override;

  private:

    virtual CESTDICOMReaderService* Clone() const override;
  };

}

#endif // MITKDICOMSERIESREADERSERVICE_H

Fix warnings in CEST module

Fix warnings in CEST module


#import <Foundation/Foundation.h>

#import <Foundation/NSEnumerator.h>
#import "BSNullabilityCompat.h"

NS_ASSUME_NONNULL_BEGIN

/**
 * A BSPropertySet represents the set of a Class' properties that will be injected into class instances after
 * the instances are created.
 *
 * If a
 */
@interface BSPropertySet : NSObject<NSFastEnumeration>

/**
 * Returns a BSPropertySet for the given class, representing the properties named in the argument list. This
 * method is for use by classes within their implementation of bsProperties.
 *
 * For example, suppose there is a class that has a property called "eventLogger" of type EventLogger *.
 *
 * Suppose we want to inject two of the properties - address and color. We could implement bsProperties
 * like this:
 *
 * \code
 *
 * + (BSPropertySet *)bsProperties {
 *      BSPropertySet *propertySet = [BSPropertySet propertySetWithClass:self propertyNames:@"address" @"color", nil];
 *      [propertySet bind:@"address" toKey:@"my home address"
 *
 * }
 *
 * \endcode
 */
+ (BSPropertySet *)propertySetWithClass:(Class)owningClass propertyNames:(NSString *)property1, ... NS_REQUIRES_NIL_TERMINATION;

- (void)bindProperty:(NSString *)propertyName toKey:(id)key;

@end

NS_ASSUME_NONNULL_END

#import <Foundation/Foundation.h>

#import <Foundation/NSEnumerator.h>
#import "BSNullabilityCompat.h"

NS_ASSUME_NONNULL_BEGIN

/**
 * A BSPropertySet represents the set of a Class' properties that will be injected into class instances after
 * the instances are created.
 *
 * If a
 */
@interface BSPropertySet : NSObject<NSFastEnumeration>

/**
 * Returns a BSPropertySet for the given class, representing the properties named in the argument list. This
 * method is for use by classes within their implementation of bsProperties.
 *
 * For example, suppose there is a class that has a property called "eventLogger" of type EventLogger *.
 *
 * Suppose we want to inject two of the properties - address and color. We could implement bsProperties
 * like this:
 *
 * \code
 *
 * + (BSPropertySet *)bsProperties {
 *      BSPropertySet *propertySet = [BSPropertySet propertySetWithClass:self propertyNames:@"address" @"color", nil];
 *      [propertySet bind:@"address" toKey:@"my home address"];
 *      return propertySet;
 * }
 *
 * \endcode
 */
+ (BSPropertySet *)propertySetWithClass:(Class)owningClass propertyNames:(NSString *)property1, ... NS_REQUIRES_NIL_TERMINATION;

- (void)bindProperty:(NSString *)propertyName toKey:(id)key;

@end

NS_ASSUME_NONNULL_END

Fix code in header documentation

Fix code in header documentation


// Copyright(c) 2016 artopantone.
// Distributed under the MIT License (http://opensource.org/licenses/MIT)

#pragma once

#include <kompositum/visitor.h>

namespace Kompositum {

class Printer : public Visitor {
public:
    void visit(Leaf* leaf) override {
        doIndentation();
        printf("- Leaf (%lu)\n", leaf->getID());
    }

    void visit(Composite* composite) override {
        doIndentation();
        indent++;

        if (!composite->hasChildren()) {
            printf("- Composite (%lu): empty\n", composite->getID());
        } else {
            printf("+ Composite (%lu):\n", composite->getID());
            composite->visitChildren(*this);
        }

        indent--;
    }

private:
    void doIndentation() const {
        for (auto i = 0u; i < indent; ++i)
            printf("+--");
    }

    unsigned int indent = 0;
};

} // namespace Kompositum

// Copyright(c) 2016 artopantone.
// Distributed under the MIT License (http://opensource.org/licenses/MIT)

#pragma once

#include <kompositum/visitor.h>
#include <cstdio>

namespace Kompositum {

class Printer : public Visitor {
public:
    void visit(Leaf* leaf) override {
        doIndentation();
        printf("- Leaf (%lu)\n", leaf->getID());
    }

    void visit(Composite* composite) override {
        doIndentation();
        indent++;

        if (!composite->hasChildren()) {
            printf("- Composite (%lu): empty\n", composite->getID());
        } else {
            printf("+ Composite (%lu):\n", composite->getID());
            composite->visitChildren(*this);
        }

        indent--;
    }

private:
    void doIndentation() const {
        for (auto i = 0u; i < indent; ++i)
            printf("+--");
    }

    unsigned int indent = 0;
};

} // namespace Kompositum

Add missing header for printf

Add missing header for printf


// ----------------------------------------------------------------------------
// pomodoro_config - Defines the parameters for various pomodoro technique bits
// Copyright (c) 2013 Jonathan Speicher (jon.speicher@gmail.com)
// Licensed under the MIT license: http://opensource.org/licenses/MIT
// ----------------------------------------------------------------------------

#pragma once

// Defines the duration of a pomodoro.

#define POMODORO_MINUTES 0
#define POMODORO_SECONDS 10

// Defines the duration of a break.

#define BREAK_MINUTES 0
#define BREAK_SECONDS 5

// ----------------------------------------------------------------------------
// pomodoro_config - Defines the parameters for various pomodoro technique bits
// Copyright (c) 2013 Jonathan Speicher (jon.speicher@gmail.com)
// Licensed under the MIT license: http://opensource.org/licenses/MIT
// ----------------------------------------------------------------------------

#pragma once

// Defines the duration of a pomodoro.

#define POMODORO_MINUTES 25
#define POMODORO_SECONDS 0

// Defines the duration of a break.

#define BREAK_MINUTES 5
#define BREAK_SECONDS 0

Change back to real-length pomodoros and breaks


/*
 * Copyright (C) 2012, Parrot Foundation.
 */

/*

=head1 NAME

src/platform/win32/num_cpus.c

=head1 DESCRIPTION

Returns the number of CPUs for win32 systems

=head2 Functions

=cut

*/

#include "parrot/parrot.h"

#ifdef _WIN32
#  define WIN32_LEAN_AND_MEAN
#  include <windows.h>
#endif

/* HEADERIZER HFILE: none */

/*

=over 4

=item C<INTVAL Parrot_get_num_cpus(Parrot_Interp)>

Returns the number of CPUs

=back

=cut

*/

INTVAL
Parrot_get_num_cpus(Parrot_Interp interp)
{
    INTVAL nprocs = -1;
    SYSTEM_INFO info;

    GetSystemInfo(&info);
    nprocs = (INTVAL)info.dwNumberOfProcessors;
    return nprocs;
}

/*
 * Local variables:
 *   c-file-style: "parrot"
 * End:
 * vim: expandtab shiftwidth=4 cinoptions='\:2=2' :
 */

/*
 * Copyright (C) 2012, Parrot Foundation.
 */

/*

=head1 NAME

src/platform/win32/num_cpus.c

=head1 DESCRIPTION

Returns the number of CPUs for win32 systems

=head2 Functions

=cut

*/

#include "parrot/parrot.h"

#ifdef _WIN32
#  define WIN32_LEAN_AND_MEAN
#  include <windows.h>
#endif

/* HEADERIZER HFILE: none */

/*

=over 4

=item C<INTVAL Parrot_get_num_cpus(Parrot_Interp interp)>

Returns the number of CPUs

=back

=cut

*/

INTVAL
Parrot_get_num_cpus(Parrot_Interp interp)
{
    INTVAL nprocs = -1;
    SYSTEM_INFO info;

    GetSystemInfo(&info);
    nprocs = (INTVAL)info.dwNumberOfProcessors;
    return nprocs;
}

/*
 * Local variables:
 *   c-file-style: "parrot"
 * End:
 * vim: expandtab shiftwidth=4 cinoptions='\:2=2' :
 */

Correct documentation of C function.

[codingstd] Correct documentation of C function.


#ifdef __CINT__

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

#pragma link C++ function Roo* ;

#pragma link C++ class RooLinkedList- ;
#pragma link C++ class RooRealVar- ;
#pragma link C++ class RooAbsBinning- ;
#pragma link off class RooErrorHandler ;
#pragma link C++ class RooRandomizeParamMCSModule::UniParam ;
#pragma link C++ class RooRandomizeParamMCSModule::GausParam ;

#endif

#ifdef __CINT__

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

#pragma link C++ function Roo* ;

#pragma link C++ class RooLinkedList- ;
#pragma link C++ class RooRealVar- ;
#pragma link C++ class RooAbsBinning- ;
#pragma link off class RooErrorHandler ;

#endif

Disable attempt to generate dictionary for private classes

The following warning was generated by rootcling:

Warning: Class or struct RooRandomizeParamMCSModule::UniParam was
selected but its dictionary cannot be generated: this is a private or
protected class and this is not supported. No direct I/O operation of
RooRandomizeParamMCSModule::UniParam instances will be possible.

Reference:
http://cdash.cern.ch/viewBuildError.php?type=1&buildid=393839


#pragma once

#include <QtWidgets/QDialog>
#include "binaryninjaapi.h"
#include "uitypes.h"

class BINARYNINJAUIAPI TextDialog: public QDialog
{
	Q_OBJECT
	QWidget* m_parent;
	QString m_title;
	QString m_msg;
	QStringList m_options;
	Qt::WindowFlags m_flags;
	QString m_qSettingsListName;
	int m_historySize;
	QString m_historyEntry;
	QString m_initialText;

public:
	TextDialog(QWidget* parent, const QString& title, const QString& msg, const QString& qSettingsListName,
		const std::string& initialText = "");
	TextDialog(QWidget* parent, const QString& title, const QString& msg, const QString& qSettingsListName,
		const QString& initialText);
	QString getItem(bool& ok);
	void setInitialText(const std::string& initialText) { m_initialText = QString::fromStdString(initialText); }
	void commitHistory();
};

#pragma once

#include <QtWidgets/QDialog>
#include <QtWidgets/QComboBox>
#include <QtWidgets/QLabel>

#include "binaryninjaapi.h"
#include "uitypes.h"
#include "binaryninjaapi.h"

class BINARYNINJAUIAPI TextDialog: public QDialog
{
	Q_OBJECT
	QString m_qSettingsListName;
	int m_historySize;
	QString m_historyEntry;
	QString m_initialText;
	QStringList m_historyEntries;
	QLabel* m_messageText;
	QComboBox* m_combo;

public:
	TextDialog(QWidget* parent, const QString& title, const QString& msg, const QString& qSettingsListName,
		const std::string& initialText = "");
	TextDialog(QWidget* parent, const QString& title, const QString& msg, const QString& qSettingsListName,
		const QString& initialText);
	QString getItem();
	void setInitialText(const std::string& initialText) { m_initialText = QString::fromStdString(initialText); }
	void commitHistory();
};

Fix case sensitivity issue with the rename dialog


typedef struct {
	int		cluster;				/* Condor Cluster # */
	int		proc;					/* Condor Proc # */
	int		job_class;				/* STANDARD, VANILLA, PVM, PIPE, ... */
	uid_t	uid;					/* Execute job under this UID */
	gid_t	gid;					/* Execute job under this pid */
	pid_t	virt_pid;				/* PVM virt pid of this process */
	int		soft_kill_sig;			/* Use this signal for a soft kill */
	char	*a_out_name;			/* Where to get executable file */
	char	*cmd;					/* Command name given by the user */
	char	*args;					/* Command arguments given by the user */
	char	*env;					/* Environment variables */
	char	*iwd;					/* Initial working directory */
	BOOLEAN	ckpt_wanted;			/* Whether user wants checkpointing */
	BOOLEAN	is_restart;				/* Whether this run is a restart */
	BOOLEAN	coredump_limit_exists;	/* Whether user wants to limit core size */
	int		coredump_limit;			/* Limit in bytes */
} STARTUP_INFO;

/*
Should eliminate starter knowing the a.out name.  Should go to
shadow for instructions on how to fetch the executable - e.g. local file
with name <name> or get it from TCP port <x> on machine <y>.
*/

typedef struct {
	int		version_num;			/* version of this structure */
	int		cluster;				/* Condor Cluster # */
	int		proc;					/* Condor Proc # */
	int		job_class;				/* STANDARD, VANILLA, PVM, PIPE, ... */
	uid_t	uid;					/* Execute job under this UID */
	gid_t	gid;					/* Execute job under this gid */
	pid_t	virt_pid;				/* PVM virt pid of this process */
	int		soft_kill_sig;			/* Use this signal for a soft kill */
	char	*cmd;					/* Command name given by the user */
	char	*args;					/* Command arguments given by the user */
	char	*env;					/* Environment variables */
	char	*iwd;					/* Initial working directory */
	BOOLEAN	ckpt_wanted;			/* Whether user wants checkpointing */
	BOOLEAN	is_restart;				/* Whether this run is a restart */
	BOOLEAN	coredump_limit_exists;	/* Whether user wants to limit core size */
	int		coredump_limit;			/* Limit in bytes */
} STARTUP_INFO;

#define STARTUP_VERSION 1

/*
Should eliminate starter knowing the a.out name.  Should go to
shadow for instructions on how to fetch the executable - e.g. local file
with name <name> or get it from TCP port <x> on machine <y>.
*/

Add version number and get rid if a.out name.


#pragma once

#include <minwindef.h>
//#include <ntstatus.h>

// Can't include ntdef.h because it clashes with winnt.h
//#include <ntdef.h>
typedef _Return_type_success_(return >= 0) LONG NTSTATUS;
typedef void* POBJECT_ATTRIBUTES;
typedef enum _TIMER_TYPE {
	NotificationTimer,
	SynchronizationTimer
} TIMER_TYPE;

#pragma comment(lib, "ntdll.lib")

extern "C" {

	NTSYSAPI
		NTSTATUS
		NTAPI
		NtCancelTimer(
			IN HANDLE               TimerHandle,
			OUT PBOOLEAN            CurrentState OPTIONAL);

	NTSYSAPI
		NTSTATUS
		NTAPI
		NtCreateTimer(
			OUT PHANDLE             TimerHandle,
			IN ACCESS_MASK          DesiredAccess,
			IN POBJECT_ATTRIBUTES   ObjectAttributes OPTIONAL,
			IN TIMER_TYPE           TimerType);

	typedef void(CALLBACK * PTIMER_APC_ROUTINE)(
		IN PVOID TimerContext,
		IN ULONG TimerLowValue,
		IN LONG TimerHighValue
		);

	NTSYSAPI
		NTSTATUS
		NTAPI
		NtSetTimer(
			IN HANDLE               TimerHandle,
			IN PLARGE_INTEGER       DueTime,
			IN PTIMER_APC_ROUTINE   TimerApcRoutine OPTIONAL,
			IN PVOID                TimerContext OPTIONAL,
			IN BOOLEAN              ResumeTimer,
			IN LONG                 Period OPTIONAL,
			OUT PBOOLEAN            PreviousState OPTIONAL);

	NTSYSAPI
		NTSTATUS
		NTAPI
		NtSetTimerResolution(
			IN ULONG RequestedResolution,
			IN BOOLEAN Set,
			OUT PULONG ActualResolution
		);

	NTSYSAPI
		NTSTATUS
		NTAPI
		NtQueryTimerResolution(
			OUT PULONG MinimumResolution,
			OUT PULONG MaximumResolution,
			OUT PULONG ActualResolution
		);

}

Add header file with declarations for NT timers


#if defined(_MSC_VER) && !defined(NDEBUG) && defined(_CRTDBG_MAP_ALLOC) && !defined(MSVCDBG_H)
#define MSVCDBG_H
/*!
 * @file msvcdbg.h
 * @brief Memory debugger for msvc
 * @author koturn
 */
#include <crtdbg.h>

static void
__msvc_init_memory_check__(void);

#pragma section(".CRT$XCU", read)
__declspec(allocate(".CRT$XCU"))
void (* __msvc_init_memory_check___)(void) = __msvc_init_memory_check__;

/*!
 * @brief Enable heap management
 */
static void
__msvc_init_memory_check__(void)
{
  _CrtSetDbgFlag(_CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF | _CRTDBG_DELAY_FREE_MEM_DF);
  _CrtSetReportMode(_CRT_WARN, _CRTDBG_MODE_FILE);
  _CrtSetReportFile(_CRT_WARN, _CRTDBG_FILE_STDOUT);
}

#endif

#if defined(_MSC_VER) && !defined(NDEBUG) && defined(_CRTDBG_MAP_ALLOC) && !defined(MSVCDBG_H)
#define MSVCDBG_H
/*!
 * @file msvcdbg.h
 * @brief Memory debugger for msvc
 * @author koturn
 */
#include <crtdbg.h>

#define MSVCDBG_NEW  new(_NORMAL_BLOCK, __FILE__, __LINE__)
#ifdef MSVCDBG_REPLACE_NEW
#  define new  MSVCDBG_NEW
#endif

static void
__msvc_init_memory_check__(void);

#pragma section(".CRT$XCU", read)
__declspec(allocate(".CRT$XCU"))
void (* __msvc_init_memory_check___)(void) = __msvc_init_memory_check__;

/*!
 * @brief Enable heap management
 */
static void
__msvc_init_memory_check__(void)
{
  _CrtSetDbgFlag(_CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF | _CRTDBG_DELAY_FREE_MEM_DF);
  _CrtSetReportMode(_CRT_WARN, _CRTDBG_MODE_FILE);
  _CrtSetReportFile(_CRT_WARN, _CRTDBG_FILE_STDOUT);
}

#endif

Enable to replace "new" operator

Enable to replace "new" operator


#pragma once

#include <QtWidgets/QLabel>

class BINARYNINJAUIAPI ClickableLabel: public QLabel
{
	Q_OBJECT

public:
	ClickableLabel(QWidget* parent = nullptr, const QString& name = ""): QLabel(parent) { setText(name); }

signals:
	void clicked();

protected:
	void mouseReleaseEvent(QMouseEvent* event) override { if (event->button() == Qt::LeftButton) emit clicked(); }
};

#pragma once

#include <QtWidgets/QLabel>

class BINARYNINJAUIAPI ClickableLabel: public QLabel
{
	Q_OBJECT

public:
	ClickableLabel(QWidget* parent = nullptr, const QString& name = ""): QLabel(parent) { setText(name); }

Q_SIGNALS:
	void clicked();

protected:
	void mouseReleaseEvent(QMouseEvent* event) override { if (event->button() == Qt::LeftButton) Q_EMIT clicked(); }
};

Use Q_SIGNALS / Q_EMIT macros instead of signals / emit


#include <hwloc.h>
#include <stdio.h>

/* The body of the test is in a separate .c file and a separate
   library, just to ensure that hwloc didn't force compilation with
   visibility flags enabled. */

int do_test(void)
{
    mytest_hwloc_topology_t topology;
    unsigned depth;
    hwloc_cpuset_t cpu_set;

    /* Just call a bunch of functions to see if we can link and run */

    printf("*** Test 1: cpuset alloc\n");
    cpu_set = mytest_hwloc_cpuset_alloc();
    if (NULL == cpu_set) return 1;
    printf("*** Test 2: topology init\n");
    if (0 != mytest_hwloc_topology_init(&topology)) return 1;
    printf("*** Test 3: topology load\n");
    if (0 != mytest_hwloc_topology_load(topology)) return 1;
    printf("*** Test 4: topology get depth\n");
    depth = mytest_hwloc_topology_get_depth(topology);
    if (depth < 0) return 1;
    printf("    Max depth: %u\n", depth);
    printf("*** Test 5: topology destroy\n");
    mytest_hwloc_topology_destroy(topology);
    printf("*** Test 6: cpuset free\n");
    mytest_hwloc_cpuset_free(cpu_set);

    return 0;
}

#include <hwloc.h>
#include <stdio.h>

/* The body of the test is in a separate .c file and a separate
   library, just to ensure that hwloc didn't force compilation with
   visibility flags enabled. */

int do_test(void)
{
    mytest_hwloc_topology_t topology;
    unsigned depth;
    hwloc_bitmap_t cpu_set;

    /* Just call a bunch of functions to see if we can link and run */

    printf("*** Test 1: bitmap alloc\n");
    cpu_set = mytest_hwloc_bitmap_alloc();
    if (NULL == cpu_set) return 1;
    printf("*** Test 2: topology init\n");
    if (0 != mytest_hwloc_topology_init(&topology)) return 1;
    printf("*** Test 3: topology load\n");
    if (0 != mytest_hwloc_topology_load(topology)) return 1;
    printf("*** Test 4: topology get depth\n");
    depth = mytest_hwloc_topology_get_depth(topology);
    if (depth < 0) return 1;
    printf("    Max depth: %u\n", depth);
    printf("*** Test 5: topology destroy\n");
    mytest_hwloc_topology_destroy(topology);
    printf("*** Test 6: bitmap free\n");
    mytest_hwloc_bitmap_free(cpu_set);

    return 0;
}

Convert the embedded test to the bitmap API

This commit was SVN r2512.


/*
    Copyright (c) 2009 Stephen Kelly <steveire@gmail.com>
*/

#ifndef PARSER_H
#define PARSER_H

#include <QStringList>

#include "token.h"
#include "node.h"

namespace Grantlee
{
class AbstractNodeFactory;

class TagLibraryInterface;
class Filter;
}

class ParserPrivate;

namespace Grantlee
{

class GRANTLEE_EXPORT Parser : public QObject
{
  Q_OBJECT
public:
  Parser( QList<Token> tokenList, QStringList pluginDirs, QObject *parent );
  ~Parser();

  NodeList parse(QStringList stopAt, QObject *parent);

  NodeList parse(QObject *parent);

  Filter *getFilter(const QString &name);

  void skipPast(const QString &tag);

  Token nextToken();
  bool hasNextToken();

  void loadLib(const QString &name);

  void emitError(int errorNumber, const QString &message);

protected:
  void addTag(QObject *);
  void getBuiltInLibrary();
  void getDefaultLibrary();

  void prependToken(Token token);

signals:
  void error(int type, const QString &message);

private:
  Q_DECLARE_PRIVATE(Parser);
  ParserPrivate *d_ptr;

};

}

#endif

/*
    Copyright (c) 2009 Stephen Kelly <steveire@gmail.com>
*/

#ifndef PARSER_H
#define PARSER_H

#include <QStringList>

#include "token.h"
#include "node.h"

namespace Grantlee
{
class Filter;
}

class ParserPrivate;

namespace Grantlee
{

class GRANTLEE_EXPORT Parser : public QObject
{
  Q_OBJECT
public:
  Parser( QList<Token> tokenList, QStringList pluginDirs, QObject *parent );
  ~Parser();

  NodeList parse(QStringList stopAt, QObject *parent);

  NodeList parse(QObject *parent);

  Filter *getFilter(const QString &name);

  void skipPast(const QString &tag);

  Token nextToken();
  bool hasNextToken();

  void loadLib(const QString &name);

  void emitError(int errorNumber, const QString &message);

protected:
  void prependToken(Token token);

signals:
  void error(int type, const QString &message);

private:
  Q_DECLARE_PRIVATE(Parser);
  ParserPrivate *d_ptr;

};

}

#endif

Remove some unused classes and methods.

Remove some unused classes and methods.


/* Wrapper around clone system call.
   Copyright (C) 1997, 1998, 1999, 2000 Free Software Foundation, Inc.
   This file is part of the GNU C Library.

   The GNU C Library is free software; you can redistribute it and/or
   modify it under the terms of the GNU Lesser General Public
   License as published by the Free Software Foundation; either
   version 2.1 of the License, or (at your option) any later version.

   The GNU C Library is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
   Lesser General Public License for more details.

   You should have received a copy of the GNU Lesser General Public
   License along with the GNU C Library; if not, write to the Free
   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
   02111-1307 USA.  */

#include <errno.h>

/* This routine is jumped to by all the syscall handlers, to stash
 * an error number into errno.  */
int attribute_hidden __syscall_error (int err_no)
{
	__set_errno (err_no);
	return -1;
}

Add missing file needed for arm to compile


#ifndef FORMAT_H
#define FORMAT_H

#include <cstddef>
#include <cstring>  // memmove

class Format
{
public:
    Format(void *p, size_t s = 0) : fp((char *)p), size(s) {};

    virtual size_t Leanify(size_t size_leanified = 0)
    {
        if (size_leanified)
        {
            memmove(fp - size_leanified, fp, size);
            fp -= size_leanified;
        }

        return size;
    }

protected:
    // pointer to the file content
    char *fp;
    // size of the file
    size_t size;
};

#endif

#ifndef FORMAT_H
#define FORMAT_H

#include <cstddef>
#include <cstring>  // memmove

class Format
{
public:
    Format(void *p, size_t s = 0) : fp((char *)p), size(s) {};

    virtual ~Format() {};

    virtual size_t Leanify(size_t size_leanified = 0)
    {
        if (size_leanified)
        {
            memmove(fp - size_leanified, fp, size);
            fp -= size_leanified;
        }

        return size;
    }

protected:
    // pointer to the file content
    char *fp;
    // size of the file
    size_t size;
};

#endif

Fix warning of non-virtual destructor

Fix warning of non-virtual destructor


/********************************************************************
 *                                                                  *
 * THIS FILE IS PART OF THE OggTheora SOFTWARE CODEC SOURCE CODE.   *
 * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS     *
 * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
 * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.       *
 *                                                                  *
 * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2002             *
 * by the Xiph.Org Foundation http://www.xiph.org/                  *
 *                                                                  *
 ********************************************************************

  function:
  last mod: $Id: toplevel.h,v 1.1 2003/06/04 01:31:46 mauricio Exp $

 ********************************************************************/

/*from dbm huffman pack patch*/

extern void write_Qtables(oggpack_buffer* opb);
extern void write_HuffmanSet(oggpack_buffer* opb, HUFF_ENTRY **hroot);
extern void read_Qtables(oggpack_buffer* opb);
extern void read_HuffmanSet(oggpack_buffer* opb);
extern void InitHuffmanSetPlay( PB_INSTANCE *pbi );

/********************************************************************
 *                                                                  *
 * THIS FILE IS PART OF THE OggTheora SOFTWARE CODEC SOURCE CODE.   *
 * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS     *
 * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE *
 * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING.       *
 *                                                                  *
 * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2002             *
 * by the Xiph.Org Foundation http://www.xiph.org/                  *
 *                                                                  *
 ********************************************************************

  function:
  last mod: $Id: toplevel.h,v 1.2 2003/06/07 23:34:56 giles Exp $

 ********************************************************************/

/*from dbm huffman pack patch*/

extern void write_Qtables(oggpack_buffer* opb);
extern void write_HuffmanSet(oggpack_buffer* opb, HUFF_ENTRY **hroot);
extern void read_Qtables(oggpack_buffer* opb);
extern void read_HuffmanSet(oggpack_buffer* opb);
extern void InitHuffmanSetPlay( PB_INSTANCE *pbi );

Add newline at the end of the file.

Add newline at the end of the file.

git-svn-id: 8dbf393e6e9ab8d4979d29f9a341a98016792aa6@4891 0101bb08-14d6-0310-b084-bc0e0c8e3800


#pragma once

#include "MeterWnd.h"

class Animation {
public:
    Animation(MeterWnd &meterWnd) :
    _meterWnd(meterWnd) {

    }

    virtual bool Animate() = 0;
    virtual void Reset() = 0;

protected:
    MeterWnd &_meterWnd;
};

Add new abstract animation class

Add new abstract animation class


#ifndef MAINWINDOW_H
#define MAINWINDOW_H

#include <QMainWindow>

namespace Ui {
class MainWindow;
}

class MainWindow : public QMainWindow
{
    Q_OBJECT

public:
    explicit MainWindow(QWidget *parent = 0);
    ~MainWindow();

private:
    Ui::MainWindow *ui;
};

#endif // MAINWINDOW_H

#pragma once

#include <QMainWindow>

namespace Ui {
class MainWindow;
}

class MainWindow : public QMainWindow
{
    Q_OBJECT

public:
    explicit MainWindow(QWidget *parent = 0);
    ~MainWindow();

private:
    Ui::MainWindow *ui;
};

Use pragma once instead of ifdef

Use pragma once instead of ifdef


#define MICROPY_HW_BOARD_NAME "Raspberry Pi Zero 2W"

#define DEFAULT_I2C_BUS_SCL         (&pin_GPIO3)
#define DEFAULT_I2C_BUS_SDA         (&pin_GPIO2)

#define CIRCUITPY_CONSOLE_UART_TX   (&pin_GPIO14)
#define CIRCUITPY_CONSOLE_UART_RX   (&pin_GPIO15)

#define MICROPY_HW_BOARD_NAME "Raspberry Pi Zero 2W"

#define DEFAULT_I2C_BUS_SCL         (&pin_GPIO3)
#define DEFAULT_I2C_BUS_SDA         (&pin_GPIO2)

#define MICROPY_HW_LED_STATUS       (&pin_GPIO29)

#define CIRCUITPY_CONSOLE_UART_TX   (&pin_GPIO14)
#define CIRCUITPY_CONSOLE_UART_RX   (&pin_GPIO15)

Add HW_LED_STATUS pin to Zero 2W board

Add HW_LED_STATUS pin to Zero 2W board


#include "kputs.c"

void abort(void)
{
	// TODO: Add proper kernel panic.
	kputs("Kernel Panic! abort()\n");
	while ( 1 ) { }
}

#ifndef KABORT_C
#define KABORT_C
#include "kputs.c"

void kabort(void)
{
	// TODO: Add proper kernel panic.
	kputs("Kernel Panic! abort()\n");
	while ( 1 ) { }
}

#endif

Add header guards. Properly name function.


/**************************************************************************
 *
 * Copyright 2013-2014 RAD Game Tools and Valve Software
 * All Rights Reserved.
 *
 * Permission is hereby granted, free of charge, to any person obtaining a copy
 * of this software and associated documentation files (the "Software"), to deal
 * in the Software without restriction, including without limitation the rights
 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
 * copies of the Software, and to permit persons to whom the Software is
 * furnished to do so, subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included in
 * all copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
 * THE SOFTWARE.
 *
 **************************************************************************/

#if defined(__GNUC__)
  #define GCC_DIAGNOSTIC_STR(s)       #s
  #define GCC_DIAGNOSTIC_JOINSTR(x,y) GCC_DIAGNOSTIC_STR(x ## y)
  #define GCC_DIAGNOSTIC_DO_PRAGMA(x) _Pragma (#x)
  #define GCC_DIAGNOSTIC_PRAGMA(x)    GCC_DIAGNOSTIC_DO_PRAGMA(GCC diagnostic x)

  #define GCC_DIAGNOSTIC_PUSH()       GCC_DIAGNOSTIC_PRAGMA(push)
  #define GCC_DIAGNOSTIC_IGNORED(x)   GCC_DIAGNOSTIC_PRAGMA(ignored GCC_DIAGNOSTIC_JOINSTR(-W,x))
  #define GCC_DIAGNOSTIC_POP()        GCC_DIAGNOSTIC_PRAGMA(pop)
#else
  #define GCC_DIAGNOSTIC_PUSH()
  #define GCC_DIAGNOSTIC_IGNORED(x)
  #define GCC_DIAGNOSTIC_POP()
#endif

Add GCC diagnostic warning macros

Add GCC diagnostic warning macros


Fix format ptr from unsigned int to unsigned long


/* Based on msp430g2xx3_wdt_02.c from the TI Examples */

#include <msp430.h>

int main(void)
{
    WDTCTL = WDT_ADLY_250;                    // WDT 250ms, ACLK, interval timer
    IE1 |= WDTIE;                             // Enable WDT interrupt
    P1DIR |= BIT0;                            // Set P1.0 to output direction

    __bis_SR_register(GIE);                   // Enable interrupts
    while (1) {
        __bis_SR_register(LPM3_bits);   // Enter LPM3 w/interrupt
        P1OUT ^= BIT0;
    }
}

// Watchdog Timer interrupt service routine
#if defined(__TI_COMPILER_VERSION__) || defined(__IAR_SYSTEMS_ICC__)
#pragma vector=WDT_VECTOR
__interrupt void watchdog_timer(void)
#elif defined(__GNUC__)
void __attribute__ ((interrupt(WDT_VECTOR))) watchdog_timer (void)
#else
#error Compiler not supported!
#endif
{
    __bic_SR_register_on_exit(LPM3_bits);
}

/* Based on msp430g2xx3_wdt_02.c from the TI Examples */

#include <msp430.h>

int main(void)
{
    BCSCTL3 |= LFXT1S_2;                      // ACLK = VLO
    WDTCTL = WDT_ADLY_250;                    // WDT 250ms, ACLK, interval timer
    IE1 |= WDTIE;                             // Enable WDT interrupt
    P1DIR |= BIT0;                            // Set P1.0 to output direction

    __bis_SR_register(GIE);                   // Enable interrupts
    while (1) {
        __bis_SR_register(LPM3_bits);   // Enter LPM3 w/interrupt
        P1OUT ^= BIT0;
    }
}

// Watchdog Timer interrupt service routine
#if defined(__TI_COMPILER_VERSION__) || defined(__IAR_SYSTEMS_ICC__)
#pragma vector=WDT_VECTOR
__interrupt void watchdog_timer(void)
#elif defined(__GNUC__)
void __attribute__ ((interrupt(WDT_VECTOR))) watchdog_timer (void)
#else
#error Compiler not supported!
#endif
{
    __bic_SR_register_on_exit(LPM3_bits);
}

Update lab3 skeleton code to properly source ACLK from VLO


#pragma once

extern void _service_interrupt(void);

extern void isr0(void);
extern void isr1(void);
extern void isr2(void);
extern void isr3(void);
extern void isr4(void);
extern void isr5(void);
extern void isr6(void);
extern void isr7(void);
extern void isr8(void);
extern void isr9(void);
extern void isr10(void);
extern void isr11(void);
extern void isr12(void);
extern void isr13(void);
extern void isr14(void);
extern void isr15(void);
extern void isr16(void);
extern void isr17(void);
extern void isr18(void);
extern void isr19(void);
extern void isr20(void);
extern void isr21(void);
extern void isr22(void);
extern void isr23(void);
extern void isr24(void);
extern void isr25(void);
extern void isr26(void);
extern void isr27(void);
extern void isr28(void);
extern void isr29(void);
extern void isr30(void);
extern void isr31(void);
extern void isr32(void);
extern void isr33(void);
extern void isr34(void);

#pragma once

extern void _service_interrupt(void);
typedef void (*isr_f)(void);

extern void isr0(void);
extern void isr1(void);
extern void isr2(void);
extern void isr3(void);
extern void isr4(void);
extern void isr5(void);
extern void isr6(void);
extern void isr7(void);
extern void isr8(void);
extern void isr9(void);
extern void isr10(void);
extern void isr11(void);
extern void isr12(void);
extern void isr13(void);
extern void isr14(void);
extern void isr15(void);
extern void isr16(void);
extern void isr17(void);
extern void isr18(void);
extern void isr19(void);
extern void isr20(void);
extern void isr21(void);
extern void isr22(void);
extern void isr23(void);
extern void isr24(void);
extern void isr25(void);
extern void isr26(void);
extern void isr27(void);
extern void isr28(void);
extern void isr29(void);
extern void isr30(void);
extern void isr31(void);
extern void isr32(void);
extern void isr33(void);
extern void isr34(void);

Define convenient ISR function pointer type


/* Copyright 2022 The TensorFlow Authors. All Rights Reserved.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by 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 TENSORFLOW_CORE_GRAPPLER_OPTIMIZERS_TFG_PASSES_BUILDER_H_
#define TENSORFLOW_CORE_GRAPPLER_OPTIMIZERS_TFG_PASSES_BUILDER_H_

#include "mlir/Pass/PassManager.h"  // from @llvm-project

namespace mlir {
namespace tfg {

// Constructs the default graph/function-level TFG pass pipeline.
void DefaultGrapplerPipeline(PassManager& mgr);

// Constructs the default module-level TFG pass pipeline.
void DefaultModuleGrapplerPipeline(PassManager& mgr);

// Add a remapper pass to the given pass manager.
void RemapperPassBuilder(PassManager& mgr);

}  // namespace tfg
}  // namespace mlir

#endif  // TENSORFLOW_CORE_GRAPPLER_OPTIMIZERS_TFG_PASSES_BUILDER_H_

/* Copyright 2022 The TensorFlow Authors. All Rights Reserved.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by 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 TENSORFLOW_CORE_GRAPPLER_OPTIMIZERS_TFG_PASSES_BUILDER_H_
#define TENSORFLOW_CORE_GRAPPLER_OPTIMIZERS_TFG_PASSES_BUILDER_H_

#include "mlir/Pass/PassManager.h"  // from @llvm-project

namespace mlir {
namespace tfg {

// Constructs the default graph/function-level TFG pass pipeline.
void DefaultGrapplerPipeline(PassManager& manager);

// Constructs the default module-level TFG pass pipeline.
void DefaultModuleGrapplerPipeline(PassManager& manager);

// Add a remapper pass to the given pass manager.
void RemapperPassBuilder(PassManager& manager);

}  // namespace tfg
}  // namespace mlir

#endif  // TENSORFLOW_CORE_GRAPPLER_OPTIMIZERS_TFG_PASSES_BUILDER_H_

[tfg] Make function parameter names consistent between header and impl.

PiperOrigin-RevId: 446807976


#pragma once

#include <sched.h> /* sched_getcpu() */
#include <stdio.h> /* printf() */

/**
 **************************************************************************
 *  \brief
 *   preprocessor conditional printf formatter output
 *
 * \details
 *   Input arguments are equivalent to printf.  referrence printf man pages
 *   for api details
 *
 **************************************************************************
 */
#if defined(__ADTS_DISPLAY)
    #define CDISPLAY(_format, ...)                                      \
    do {                                                                \
        char _buffer[256] = {0};                                        \
                                                                        \
        sprintf(_buffer, _format, ## __VA_ARGS__);                      \
        printf("%3d %4d %-25.25s %-30.30s %s\n",                        \
            sched_getcpu(), __LINE__, __FILE__, __FUNCTION__, _buffer); \
                                                                        \
        /* Serialize console output on exit/error */                    \
        fflush(stdout);                                                 \
    } while(0);
#else
    #define CDISPLAY(_format, ...) /* compile disabled */
#endif

/**
 **************************************************************************
 * \details
 *   Count digits in decimal number
 *
 **************************************************************************
 */
inline size_t
adts_digits_decimal( int32_t val )
{
    size_t digits = 0;

    while (val) {
        val /= 10;
        digits++;
    }

    return digits;
} /* adts_digits_decimal() */

#pragma once

#include <sched.h> /* sched_getcpu() */
#include <stdio.h> /* printf() */

/**
 **************************************************************************
 *  \brief
 *   preprocessor conditional printf formatter output
 *
 * \details
 *   Input arguments are equivalent to printf.  referrence printf man pages
 *   for api details
 *
 **************************************************************************
 */
#if defined(__ADTS_DISPLAY)
    #define CDISPLAY(_format, ...)                                         \
    do {                                                                   \
        char   _buffer[256] = {0};                                         \
        size_t _limit       = sizeof(_buffer) - 1;                         \
                                                                           \
        snprintf(_buffer, _limit, _format, ## __VA_ARGS__);                \
        printf("%3d %4d %-25.25s %-30.30s %s\n",                           \
            sched_getcpu(), __LINE__, __FILE__, __FUNCTION__, _buffer);    \
                                                                           \
        /* Serialize console output on exit/error */                       \
        fflush(stdout);                                                    \
    } while(0);
#else
    #define CDISPLAY(_format, ...) /* compile disabled */
#endif

/**
 **************************************************************************
 * \details
 *   Count digits in decimal number
 *
 **************************************************************************
 */
inline size_t
adts_digits_decimal( int32_t val )
{
    size_t digits = 0;

    while (val) {
        val /= 10;
        digits++;
    }

    return digits;
} /* adts_digits_decimal() */

Add buffer overflow safety to CDISPLAY

Add buffer overflow safety to CDISPLAY


#import <Foundation/Foundation.h>
#define API_VERSION "1"
#define BASE_URL "https://www.cine.io/api/"
#define SDK_VERSION "0.6.1"
#define USER_AGENT "cineio-ios"

extern NSString* const BaseUrl;
extern NSString* const UserAgent;

Add line break after import

Add line break after import


#define TINT        long long
#define TUINT       unsigned long long
#define TFLOAT      double

#define L_SCHAR     L_INT8
#define L_UCHAR     L_UINT8
#define L_CHAR      L_INT8
#define L_SHORT     L_INT16
#define L_USHORT    L_UINT16
#define L_INT       L_INT32
#define L_UINT      L_UINT32
#define L_LONG      L_INT32
#define L_ULONG     L_UINT32
#define L_LLONG     L_INT64
#define L_ULLONG    L_UINT64
#define L_BOOL      'B'
#define L_FLOAT     'J'
#define L_DOUBLE    'D'
#define L_LDOUBLE   'H'
#define L_ENUM      L_INT

Add support for i386 in cc1

Add support for i386 in cc1

We only need to configure the types, and the rest of the code
will work without problems.


#include <cgreen/cgreen.h>
#include <cgreen/mocks.h>

void convert_to_uppercase(char *converted_string, const char *original_string) {
    mock(converted_string, original_string);
}

Ensure(setting_content_of_out_parameter) {
    expect(convert_to_uppercase,
           when(original_string, is_equal_to_string("upper case")),
           will_set_content_of_parameter(&converted_string,
                                         "UPPER CASE", 11));

}

#include <cgreen/cgreen.h>
#include <cgreen/mocks.h>

void convert_to_uppercase(char *converted_string, const char *original_string) {
    mock(converted_string, original_string);
}

Ensure(setting_content_of_out_parameter) {
    expect(convert_to_uppercase,
           when(original_string, is_equal_to_string("upper case")),
           will_set_content_of_parameter(converted_string,
                                         "UPPER CASE", 11));

}

Fix error in example code

[doc][set_parameter] Fix error in example code


// Copyright 2014-2015 Project Vogue. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef ELANG_HIR_INSTRUCTION_VISITOR_H_
#define ELANG_HIR_INSTRUCTION_VISITOR_H_

#include "base/macros.h"
#include "elang/hir/instructions_forward.h"

namespace elang {
namespace hir {

//////////////////////////////////////////////////////////////////////
//
// InstructionVisitor
//
class InstructionVisitor {
 public:
#define V(Name, ...) virtual void Visit##Name(Name##Instruction* instruction);
  FOR_EACH_HIR_INSTRUCTION(V)
#undef V

 protected:
  InstructionVisitor();
  virtual ~InstructionVisitor();

  virtual void DoDefaultVisit(Instruction* instruction);

 private:
  DISALLOW_COPY_AND_ASSIGN(InstructionVisitor);
};

}  // namespace hir
}  // namespace elang

#endif  // ELANG_HIR_INSTRUCTION_VISITOR_H_

// Copyright 2014-2015 Project Vogue. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef ELANG_HIR_INSTRUCTION_VISITOR_H_
#define ELANG_HIR_INSTRUCTION_VISITOR_H_

#include "base/macros.h"
#include "elang/hir/hir_export.h"
#include "elang/hir/instructions_forward.h"

namespace elang {
namespace hir {

//////////////////////////////////////////////////////////////////////
//
// InstructionVisitor
//
class ELANG_HIR_EXPORT InstructionVisitor {
 public:
  virtual ~InstructionVisitor();

#define V(Name, ...) virtual void Visit##Name(Name##Instruction* instruction);
  FOR_EACH_HIR_INSTRUCTION(V)
#undef V

 protected:
  InstructionVisitor();

  virtual void DoDefaultVisit(Instruction* instruction);

 private:
  DISALLOW_COPY_AND_ASSIGN(InstructionVisitor);
};

}  // namespace hir
}  // namespace elang

#endif  // ELANG_HIR_INSTRUCTION_VISITOR_H_

elang/hir: Add DLL export attribute to |hir::InstructionVisitor| to use it in compiler.


// C SUGAR
#define unless(condition) if(!(condition))

// OBJC SUGAR
#import "NSNumber+ObjectiveSugar.h"
#import "NSArray+ObjectiveSugar.h"
#import "NSMutableArray+ObjectiveSugar.h"
#import "NSDictionary+ObjectiveSugar.h"
#import "NSSet+ObjectiveSugar.h"
#import "NSString+ObjectiveSugar.h"

Fix GCC_WARN_ABOUT_MISSING_NEWLINE in header file


// PARAM: --sets solver td3 --enable ana.int.interval --enable exp.partition-arrays.enabled  --enable exp.fast_global_inits  --set ana.activated "['base','expRelation','mallocWrapper']"
// Without fast_global_inits this takes >150s, when it is enabled < 0.1s
int global_array[50][500][20];

int main(void) {
  for(int i =0; i < 50; i++) {
      assert(global_array[i][42][7] == 0);
  }
}

// PARAM: --sets solver td3 --enable ana.int.interval --enable exp.partition-arrays.enabled  --enable exp.fast_global_inits  --set ana.activated "['base','threadid','threadflag','expRelation','mallocWrapper']"
// Without fast_global_inits this takes >150s, when it is enabled < 0.1s
int global_array[50][500][20];

int main(void) {
  for(int i =0; i < 50; i++) {
      assert(global_array[i][42][7] == 0);
  }
}

Fix 30/03 by adding threadid and threadflag analyses


// RUN: %clang_cc1 -verify -E -frewrite-includes %s -o - | FileCheck -strict-whitespace %s

#include "foobar.h" // expected-error {{'foobar.h' file not found}}
// CHECK: {{^}}#if 0 /* expanded by -frewrite-includes */{{$}}
// CHECK-NEXT: {{^}}#include "foobar.h"
// CHECK-NEXT: {{^}}#endif /* expanded by -frewrite-includes */{{$}}
// CHECK-NEXT: {{^}}# 4 "/usr/local/google/home/blaikie/Development/llvm/src/tools/clang/test/Frontend/rewrite-includes-missing.c" 2{{$}}

// RUN: %clang_cc1 -verify -E -frewrite-includes %s -o - | FileCheck -strict-whitespace %s

#include "foobar.h" // expected-error {{'foobar.h' file not found}}
// CHECK: {{^}}#if 0 /* expanded by -frewrite-includes */{{$}}
// CHECK-NEXT: {{^}}#include "foobar.h"
// CHECK-NEXT: {{^}}#endif /* expanded by -frewrite-includes */{{$}}
// CHECK-NEXT: {{^}}# 4 "{{.*}}rewrite-includes-missing.c" 2{{$}}

Remove absolute path form include test.

Remove absolute path form include test.

Review feedback/bot failure from r158459 by Simon Atanasyan and Benjamin Kramer (on IRC).

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


#ifndef __MESSAGES__MESSAGE_CONTEXT_H__
#define __MESSAGES__MESSAGE_CONTEXT_H__

#include "request_message.h"
#include "reply_message.h"
#include "backend.h"

namespace traffic {

class SessionContext : public RequestVisitor
{
private:
	std::unique_ptr<ReplyMessage> _message;
	DataProvider::ptr_t _data_provider;

protected:
	void visit(StatisticRequest const &request);
	void visit(SummaryRequest const &request);
	void visit(ErrorRequest const &request);

public:
	bool process_data(void const *data, size_t const size);
	void encode_result(std::string &out);

	SessionContext(DataProvider::ptr_t provider);
	virtual ~SessionContext() { }
};

}

#endif

#ifndef __MESSAGES__MESSAGE_CONTEXT_H__
#define __MESSAGES__MESSAGE_CONTEXT_H__

#include "request_message.h"
#include "reply_message.h"
#include "backend.h"

namespace traffic {

/**
 * \brief This is the context for a request/reply session.
 *
 * This context is allocated for each request to process the data. It represents
 * the glue between the server, the messages and the backend. It uses the
 * RequestMessage interface to parse data to a request, implements the
 * RequestVisitor interface to select the correct backend method to query and
 * provide a interface to serialize the result to the wire format.
 */
class SessionContext : public RequestVisitor
{
private:
	std::unique_ptr<ReplyMessage> _message;
	DataProvider::ptr_t _data_provider;

protected:
	void visit(StatisticRequest const &request);
	void visit(SummaryRequest const &request);
	void visit(ErrorRequest const &request);

public:
	/**
	 * \brief Process raw request data in wire format.
	 *
	 * This is the entry point for the context to process its request. It
	 * gets the wire data of the request, transforms it to a request
	 * instance and give it to the backend. The result from the backend will
	 * be stored internally.
	 *
	 * \param data The pointer to the raw request data.
	 * \param size The size of the request data.
	 * \return false in case of error.
	 */
	bool process_data(void const *data, size_t const size);

	/**
	 * \brief Encode the current reply data to the wire format.
	 *
	 * This serialize the current state (result from the backend or error
	 * message) to the reply wire format and put the result into the given
	 * string reference.
	 *
	 * \param out The string to write the result to.
	 */
	void encode_result(std::string &out);

	/**
	 * \brief Creat a session context.
	 *
	 * This is done for every incomming data packet.
	 *
	 * \param provider The DataProvider to use for this request.
	 */
	SessionContext(DataProvider::ptr_t provider);
	virtual ~SessionContext() { }
};

}

#endif

Add documentation to the SessionContext

Add documentation to the SessionContext

Signed-off-by: Jan Losinski <577c4104c61edf9f052c616c0c23e67bef4a9955@wh2.tu-dresden.de>


// Print formatted output to the VGA terminal

#include "vga.h"
#include <stdarg.h>

void term_print_dec(int x)
{
    int divisor = 1;

    for (; divisor < x; divisor *= 10)
	;

    for (; divisor > 0; divisor /= 10)
	term_putchar(((x / divisor) % 10) + '0');
}

void term_printf(const char *fmt, ...)
{
    va_list args;
    va_start(args, fmt);

    for (int i = 0; fmt[i] != '\0'; i++) {
	if (fmt[i] != '%') {
	    term_putchar(fmt[i]);
	} else {
	    char fmt_type = fmt[++i];
	    switch (fmt_type) {
	    case '%':
		term_putchar('%');
		break;
	    case 'd':
		term_print_dec(va_arg(args, int));
		break;
	    case 's':
		term_putsn(va_arg(args, char*));
		break;
	    case 'c':
		term_putchar(va_arg(args, int));
		break;
	    default:
		break;
	    }
	}
    }

    va_end(args);
}

// Print formatted output to the VGA terminal

#include "vga.h"
#include <stdarg.h>

static void term_print_dec(int x)
{
    int divisor = 1;

    for (; divisor <= x; divisor *= 10)
	;

    divisor /= 10;

    for (; divisor > 0; divisor /= 10)
	term_putchar(((x / divisor) % 10) + '0');
}

void term_printf(const char *fmt, ...)
{
    va_list args;
    va_start(args, fmt);

    for (int i = 0; fmt[i] != '\0'; i++) {
	if (fmt[i] != '%') {
	    term_putchar(fmt[i]);
	} else {
	    char fmt_type = fmt[++i];
	    switch (fmt_type) {
	    case '%':
		term_putchar('%');
		break;
	    case 'd':
		term_print_dec(va_arg(args, int));
		break;
	    case 's':
		term_putsn(va_arg(args, char*));
		break;
	    case 'c':
		term_putchar(va_arg(args, int));
		break;
	    default:
		break;
	    }
	}
    }

    va_end(args);
}

Fix term_print_dec Would print a leading 0 if number wasn't a power of 10


#include <linux/module.h>
#include <asm/ocp.h>

struct ocp_sys_info_data ocp_sys_info = {
	.opb_bus_freq	=	50000000,	/* OPB Bus Frequency (Hz) */
	.ebc_bus_freq	=	33333333,	/* EBC Bus Frequency (Hz) */
};

EXPORT_SYMBOL(ocp_sys_info);

#include <linux/module.h>
#include <asm/ibm4xx.h>
#include <asm/ocp.h>

struct ocp_sys_info_data ocp_sys_info = {
	.opb_bus_freq	=	50000000,	/* OPB Bus Frequency (Hz) */
	.ebc_bus_freq	=	33333333,	/* EBC Bus Frequency (Hz) */
};

EXPORT_SYMBOL(ocp_sys_info);

[POWERPC] Fix compile breakage for IBM/AMCC 4xx arch/ppc platforms

The IBM/AMCC 405 platforms don't compile anymore in the current
kernel version.  This fixes the compile breakage.

Signed-off-by: Stefan Roese <44b7497c4bb5f3e8c071b12b7ece82766a88068d@denx.de>
Signed-off-by: Paul Mackerras <19a0ba370c443ba08d20b5061586430ab449ee8c@samba.org>