#pragma once

#include "FilterStrategy.h"

class CUsbDkRedirectorStrategy : public CUsbDkFilterStrategy
{
public:
    virtual NTSTATUS Create(CUsbDkFilterDevice *Owner) override
    { return CUsbDkFilterStrategy::Create(Owner); }

    virtual void Delete() override
    {}

    virtual NTSTATUS MakeAvailable() override;
    virtual NTSTATUS PNPPreProcess(PIRP Irp) override;

private:
    static void PatchDeviceID(PIRP Irp);
};

#pragma once

#include "FilterStrategy.h"

class CUsbDkRedirectorStrategy : public CUsbDkFilterStrategy
{
public:
    virtual NTSTATUS MakeAvailable() override;
    virtual NTSTATUS PNPPreProcess(PIRP Irp) override;

private:
    static void PatchDeviceID(PIRP Irp);
};

UsbDk: Drop uneeded members of redirector strategy

Signed-off-by: Pavel Gurvich <2375fa63e2908bb2df59f606483a3aa92321db7a@daynix.com>
Signed-off-by: Dmitry Fleytman <f50f56ffad4b379c2a89812e98b14900ef87e9ea@redhat.com>


struct PureClangType {
  int x;
  int y;
};

#ifndef SWIFT_CLASS_EXTRA
#  define SWIFT_CLASS_EXTRA
#endif

#ifndef SWIFT_CLASS(SWIFT_NAME)
#  define SWIFT_CLASS(SWIFT_NAME) SWIFT_CLASS_EXTRA
#endif

SWIFT_CLASS("SwiftClass")
__attribute__((objc_root_class))
@interface SwiftClass
@end

@interface SwiftClass (Category)
- (void)categoryMethod:(struct PureClangType)arg;
@end

SWIFT_CLASS("BOGUS")
@interface BogusClass
@end

struct PureClangType {
  int x;
  int y;
};

#ifndef SWIFT_CLASS_EXTRA
#  define SWIFT_CLASS_EXTRA
#endif

#ifndef SWIFT_CLASS
#  define SWIFT_CLASS(SWIFT_NAME) SWIFT_CLASS_EXTRA
#endif

SWIFT_CLASS("SwiftClass")
__attribute__((objc_root_class))
@interface SwiftClass
@end

@interface SwiftClass (Category)
- (void)categoryMethod:(struct PureClangType)arg;
@end

SWIFT_CLASS("BOGUS")
@interface BogusClass
@end

Remove useless tokens at the end of a preprocessor directive

Swift SVN r24386


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

void debug(const char* format, ...) {
#ifdef __DEBUG__
    vprintf(format, args);
#endif // __DEBUG__
}

void initializeLogging() { }

#include "log.h"
#include <stdio.h>
#include <stdarg.h>

void debug(const char* format, ...) {
    va_list args;
    va_start(args, format);
    vprintf(format, args);
    va_end(args);
}

void initializeLogging() { }

Enable printf in unit tests regardless of DEBUG flag status.


#ifndef O1DROPBOX_H
#define O1DROPBOX_H

#include "o1.h"

class O1Dropbox: public O1 {
    Q_OBJECT

public:
    explicit O1Dropbox(QObject *parent = 0): O1(parent) {
        setRequestTokenUrl(QUrl("https://api.dropbox.com/1/oauth/request_token"));
        setAuthorizeUrl(QUrl("https://www.dropbox.com/1/oauth/authorize"));
        setAccessTokenUrl(QUrl("https://api.dropbox.com/1/oauth/access_token"));
        setLocalPort(1965);
    }
};

#endif // O1DROPBOX_H

#ifndef O1DROPBOX_H
#define O1DROPBOX_H

#include "o1.h"

class O1Dropbox: public O1 {
    Q_OBJECT

public:
    explicit O1Dropbox(QObject *parent = 0): O1(parent) {
        setRequestTokenUrl(QUrl("https://api.dropbox.com/1/oauth/request_token"));
        setAuthorizeUrl(QUrl("https://www.dropbox.com/1/oauth/authorize?display=mobile"));
        setAccessTokenUrl(QUrl("https://api.dropbox.com/1/oauth/access_token"));
        setLocalPort(1965);
    }
};

#endif // O1DROPBOX_H

Use the mobile authorization page.

Use the mobile authorization page.


/*
 * Determines if an IPv4 address is a palindromic address. Such
 * addresses need no special htonl/ntohl handling, regardless of host
 * versus network byte order. There are relatively few of these on
 * the Internet (65536).
 */

#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>

#include <err.h>
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <sysexits.h>
#include <unistd.h>

void emit_help(void);

bool Flag_Quiet;                /* -q */

int Exit_Status = 1;            /* failed test by default */

int
main(int argc, char *argv[])
{
    int ch, ret;
    struct in_addr ip;

    while ((ch = getopt(argc, argv, "h?q")) != -1) {
        switch (ch) {
        case 'q':
            Flag_Quiet = true;
            break;
        case 'h':
        case '?':
        default:
            /* NOTREACHED */
            emit_help();
        }
    }
    argc -= optind;
    argv += optind;

    if ((ret = inet_pton(AF_INET, *argv, &ip)) != 1) {
        if (ret == -1)
            err(EX_DATAERR, "inet_pton() failed");
        else
            errx(EX_DATAERR, "inet_pton() failed");
    }

    /* PORTABILITY will fail on middle-endian systems such as PDP-11,
     * but not too worried about such. Otherwise, this compares the
     * outer bytes and the inner bytes for symmetry - x.y.y.x */
    if ((ip.s_addr & 255) == (ip.s_addr >> 24 & 255) &&
        (ip.s_addr & 255 >> 8) == (ip.s_addr >> 16 & 255)
        ) {
        if (!Flag_Quiet)
            printf("yes\n");
        Exit_Status = EXIT_SUCCESS;
    }

    exit(Exit_Status);
}

void
emit_help(void)
{
    fprintf(stderr, "Usage: [-q] ipv4-address\n");
    exit(EX_USAGE);
}

Test if address is a palindrome.

Test if address is a palindrome.


/*
 * Copyright 2008-2009 Katholieke Universiteit Leuven
 *
 * Use of this software is governed by the MIT license
 *
 * Written by Sven Verdoolaege, K.U.Leuven, Departement
 * Computerwetenschappen, Celestijnenlaan 200A, B-3001 Leuven, Belgium
 */

#ifndef ISL_SAMPLE_H
#define ISL_SAMPLE

#include <isl/set.h>
#include <isl_tab.h>

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

__isl_give isl_vec *isl_basic_set_sample_vec(__isl_take isl_basic_set *bset);
struct isl_vec *isl_basic_set_sample_bounded(struct isl_basic_set *bset);
__isl_give isl_vec *isl_basic_set_sample_with_cone(
	__isl_take isl_basic_set *bset, __isl_take isl_basic_set *cone);

__isl_give isl_basic_set *isl_basic_set_from_vec(__isl_take isl_vec *vec);

int isl_tab_set_initial_basis_with_cone(struct isl_tab *tab,
	struct isl_tab *tab_cone);
struct isl_vec *isl_tab_sample(struct isl_tab *tab);

#if defined(__cplusplus)
}
#endif

#endif

/*
 * Copyright 2008-2009 Katholieke Universiteit Leuven
 *
 * Use of this software is governed by the MIT license
 *
 * Written by Sven Verdoolaege, K.U.Leuven, Departement
 * Computerwetenschappen, Celestijnenlaan 200A, B-3001 Leuven, Belgium
 */

#ifndef ISL_SAMPLE_H
#define ISL_SAMPLE_H

#include <isl/set.h>
#include <isl_tab.h>

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

__isl_give isl_vec *isl_basic_set_sample_vec(__isl_take isl_basic_set *bset);
struct isl_vec *isl_basic_set_sample_bounded(struct isl_basic_set *bset);
__isl_give isl_vec *isl_basic_set_sample_with_cone(
	__isl_take isl_basic_set *bset, __isl_take isl_basic_set *cone);

__isl_give isl_basic_set *isl_basic_set_from_vec(__isl_take isl_vec *vec);

int isl_tab_set_initial_basis_with_cone(struct isl_tab *tab,
	struct isl_tab *tab_cone);
struct isl_vec *isl_tab_sample(struct isl_tab *tab);

#if defined(__cplusplus)
}
#endif

#endif

Fix typo in header guard

Fix typo in header guard

Signed-off-by: Tobias Grosser <059b8b880f8441509ec8a65b50b4c6ae74ebea76@grosser.es>
Signed-off-by: Sven Verdoolaege <e5350bbed4977f5eb8ae1dc6abd9ae59d21ace75@kotnet.org>


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

#include <arm_neon.h>

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

Add a testcase for Radar 8228022.
Make sure the -Wvector-conversions does not cause unnecessary warnings when
using Neon intrinsics with the correct types.

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


Add contrived example for register alias failure source.


/**
 * \file   os_uuid.c
 * \brief  Create a new UUID.
 * \author Copyright (c) 2002-2008 Jason Perkins and the Premake project
 */

#include "premake.h"
#if PLATFORM_WINDOWS
#include <Objbase.h>
#endif

int os_uuid(lua_State* L)
{
	unsigned char bytes[16];
	char uuid[38];

#if PLATFORM_WINDOWS
	CoCreateGuid((char*)bytes);
#else
	int result;

	/* not sure how to get a UUID here, so I fake it */
	FILE* rnd = fopen("/dev/urandom", "rb");
	result = fread(bytes, 16, 1, rnd);
	fclose(rnd);
	if (!result)
		return 0;
#endif

	sprintf(uuid, "%02X%02X%02X%02X-%02X%02X-%02X%02X-%02X%02X-%02X%02X%02X%02X%02X%02X",
		bytes[0], bytes[1], bytes[2], bytes[3],
		bytes[4], bytes[5],
		bytes[6], bytes[7],
		bytes[8], bytes[9],
		bytes[10], bytes[11], bytes[12], bytes[13], bytes[14], bytes[15]);

	lua_pushstring(L, uuid);
	return 1;
}

/**
 * \file   os_uuid.c
 * \brief  Create a new UUID.
 * \author Copyright (c) 2002-2008 Jason Perkins and the Premake project
 */

#include "premake.h"
#if PLATFORM_WINDOWS
#include <Objbase.h>
#endif

int os_uuid(lua_State* L)
{
	unsigned char bytes[16];
	char uuid[38];

#if PLATFORM_WINDOWS
	CoCreateGuid((GUID*)bytes);
#else
	int result;

	/* not sure how to get a UUID here, so I fake it */
	FILE* rnd = fopen("/dev/urandom", "rb");
	result = fread(bytes, 16, 1, rnd);
	fclose(rnd);
	if (!result)
		return 0;
#endif

	sprintf(uuid, "%02X%02X%02X%02X-%02X%02X-%02X%02X-%02X%02X-%02X%02X%02X%02X%02X%02X",
		bytes[0], bytes[1], bytes[2], bytes[3],
		bytes[4], bytes[5],
		bytes[6], bytes[7],
		bytes[8], bytes[9],
		bytes[10], bytes[11], bytes[12], bytes[13], bytes[14], bytes[15]);

	lua_pushstring(L, uuid);
	return 1;
}

Fix incompatible types warning from VS 2005 (Oliver Schneider)


//
//  NSView+CDAutoLayout.h
//  CDKitt
//
//  Created by Aron Cedercrantz on 04-06-2013.
//  Copyright (c) 2013 Aron Cedercrantz. All rights reserved.
//

#import <Cocoa/Cocoa.h>

@interface NSView (CDAutoLayout)

/**
 * Add the given view to this view as a subview and autoresizes it to fill the
 * receiving view.
 */
- (void)cd_addFillingAutoresizedSubview:(NSView *)subview;

@end

//
//  NSView+CDAutoLayout.h
//  CDKitt
//
//  Created by Aron Cedercrantz on 04-06-2013.
//  Copyright (c) 2013 Aron Cedercrantz. All rights reserved.
//

#import <Cocoa/Cocoa.h>

@interface NSView (CDAutoLayout)

/**
 * Add the given view to this view as a subview and autoresizes it to fill the
 * receiving view.
 *
 * @param subview The view which should be added as a subview of the reciever.
 * May be `nil`.
 */
- (void)cd_addFillingAutoresizedSubview:(NSView *)subview;

@end

Improve NSView auto layout category documentation.

Signed-off-by: Aron Cedercrantz <ce30127eefa07a02d568832e3de6952fb491981c@cedercrantz.se>


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

void testCase(double value, unsigned int expected) {
  unsigned int result = (unsigned int)value;
  if (result != expected) {
    printf("%d\n", result);
    abort();
  }
}

int main() {
  testCase(UINT_MAX, -1);
  testCase(UINT_MAX - 0.03, -2);
  testCase(UINT_MAX - 1, -2);
  testCase(UINT_MAX - 2, -3);
  testCase(UINT_MAX - 5, -6);

  testCase(UINT_MAX - 2.5, -4);
  testCase(UINT_MAX - 2.4, -4);
  testCase(UINT_MAX - 2.6, -4);

  testCase(UINT_MAX / 2, 2147483647);
  testCase(UINT_MAX / 2 + 1, -2147483648);
  testCase(UINT_MAX / 2 - 1.0, 2147483646);
  testCase(UINT_MAX / 2 + 1.999999999, -2147483647);

  testCase(-1, -1);
  testCase(0, 0);
  testCase(1.5, 1);
  testCase(INT_MAX + 1, -2147483648);
  testCase(INT_MAX, 2147483647);
}

Add test case for casts from double to unsigned int


#include <kotaka/paths.h>

inherit LIB_INITD;
inherit UTILITY_COMPILE;

static void create()
{
	load_dir("obj", 1);
	load_dir("sys", 1);
}

#include <kotaka/paths.h>
#include <kotaka/privilege.h>
#include <kotaka/bigstruct.h>
#include <kotaka/log.h>

inherit LIB_INITD;
inherit UTILITY_COMPILE;

static void create()
{
	load_dir("obj", 1);
	load_dir("sys", 1);
}

void full_reset()
{
	object turkeylist;
	object cursor;
	object first;
	object this;

	ACCESS_CHECK(PRIVILEGED());

	turkeylist = new_object(BIGSTRUCT_DEQUE_LWO);

	this = this_object();
	cursor = KERNELD->first_link("Help");
	first = cursor;

	do {
		LOGD->post_message("help", LOG_DEBUG, "Listing " + object_name(cursor));
		turkeylist->push_back(cursor);
		cursor = KERNELD->next_link(cursor);
	} while (cursor != first);

	while (!turkeylist->empty()) {
		object turkey;

		turkey = turkeylist->get_front();
		turkeylist->pop_front();

		if (!turkey || turkey == this) {
			/* don't self destruct or double destruct */
			continue;
		}

		destruct_object(turkey);
	}

	load_dir("obj", 1);
	load_dir("sys", 1);
}

Allow help module to be rebooted

Allow help module to be rebooted


#ifndef SRC_TAG_H_
#define SRC_TAG_H_

#include <string>
#include "readtags.h"

class Tag {
 public:
  Tag(tagEntry entry) {
    name = entry.name;
    file = entry.file;
    kind = entry.kind != NULL ? entry.kind : "";
    if (entry.address.pattern != NULL)
      pattern = entry.address.pattern;
    else
      pattern = "";
  }

  std::string name;
  std::string file;
  std::string kind;
  std::string pattern;
};

#endif  // SRC_TAG_H_

#ifndef SRC_TAG_H_
#define SRC_TAG_H_

#include <string>
#include "readtags.h"

class Tag {
 public:
  Tag(tagEntry entry) {
    name = entry.name;
    file = entry.file;
    kind = entry.kind != NULL ? entry.kind : "";
    pattern = entry.address.pattern != NULL ? entry.address.pattern : "";
  }

  std::string name;
  std::string file;
  std::string kind;
  std::string pattern;
};

#endif  // SRC_TAG_H_

Switch pattern's check for NULL to ternary operator

(To be consistent with “kind”’s check)


/*
 * $Id$
 *
 * Storage method based on malloc(3)
 */

#include <assert.h>
#include <stdlib.h>
#include <sys/queue.h>
#include <pthread.h>

#include "cache.h"

struct sma {
	struct storage		s;
};

static struct storage *
sma_alloc(struct stevedore *st __unused, unsigned size)
{
	struct sma *sma;

	sma = calloc(sizeof *sma, 1);
	assert(sma != NULL);
	sma->s.priv = sma;
	sma->s.ptr = malloc(size);
	assert(sma->s.ptr != NULL);
	sma->s.len = size;
	sma->s.space = size;
	return (&sma->s);
}

static void
sma_free(struct storage *s)
{
	struct sma *sma;

	sma = s->priv;
	free(sma->s.ptr);
	free(sma);
}

struct stevedore sma_stevedore = {
	"malloc",
	NULL,			/* init */
	NULL,			/* open */
	sma_alloc,
	NULL,			/* trim */
	sma_free
};

/*
 * $Id$
 *
 * Storage method based on malloc(3)
 */

#include <assert.h>
#include <stdlib.h>
#include <sys/queue.h>
#include <pthread.h>

#include "cache.h"

struct sma {
	struct storage		s;
};

static struct storage *
sma_alloc(struct stevedore *st, unsigned size)
{
	struct sma *sma;

	sma = calloc(sizeof *sma, 1);
	assert(sma != NULL);
	sma->s.priv = sma;
	sma->s.ptr = malloc(size);
	assert(sma->s.ptr != NULL);
	sma->s.len = size;
	sma->s.space = size;
	sma->s.stevedore = st;
	return (&sma->s);
}

static void
sma_free(struct storage *s)
{
	struct sma *sma;

	sma = s->priv;
	free(sma->s.ptr);
	free(sma);
}

struct stevedore sma_stevedore = {
	"malloc",
	NULL,			/* init */
	NULL,			/* open */
	sma_alloc,
	NULL,			/* trim */
	sma_free
};

Make this work again: record the stevedore in the storage object.

git-svn-id: 7d4b18ab7d176792635d6a7a77dd8cbbea8e8daa@236 d4fa192b-c00b-0410-8231-f00ffab90ce4


#ifdef __CINT__

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

#pragma link C++ class THit!+;
#pragma link C++ class TObjHit+;
#pragma link C++ class TSTLhit;
#pragma link C++ class TSTLhitList;
#pragma link C++ class TSTLhitDeque;
#pragma link C++ class TSTLhitSet;
#pragma link C++ class TSTLhitMultiset;
#pragma link C++ class TSTLhitMap;
#pragma link C++ class TSTLhitMultiMap;
//#pragma link C++ class TSTLhitHashSet;
//#pragma link C++ class TSTLhitHashMultiset;
#pragma link C++ class pair<int,THit>;

#pragma link C++ class TSTLhitStar;
#pragma link C++ class TSTLhitStarList;
#pragma link C++ class TSTLhitStarDeque;
#pragma link C++ class TSTLhitStarSet;
#pragma link C++ class TSTLhitStarMultiSet;
#pragma link C++ class TSTLhitStarMap;
#pragma link C++ class TSTLhitStarMultiMap;
#pragma link C++ class pair<int,THit*>;

#pragma link C++ class TCloneshit+;

#endif

#ifdef __CINT__

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

#pragma link C++ class THit!+;
#pragma link C++ class TObjHit+;
#pragma link C++ class TSTLhit+;
#pragma link C++ class TSTLhitList+;
#pragma link C++ class TSTLhitDeque+;
#pragma link C++ class TSTLhitSet+;
#pragma link C++ class TSTLhitMultiset+;
#pragma link C++ class TSTLhitMap+;
#pragma link C++ class TSTLhitMultiMap+;
//#pragma link C++ class TSTLhitHashSet;
//#pragma link C++ class TSTLhitHashMultiset;
#pragma link C++ class pair<int,THit>+;

#pragma link C++ class TSTLhitStar+;
#pragma link C++ class TSTLhitStarList+;
#pragma link C++ class TSTLhitStarDeque+;
#pragma link C++ class TSTLhitStarSet+;
#pragma link C++ class TSTLhitStarMultiSet+;
#pragma link C++ class TSTLhitStarMap+;
#pragma link C++ class TSTLhitStarMultiMap+;
#pragma link C++ class pair<int,THit*>+;

#pragma link C++ class TCloneshit+;

#endif

Use the option "+" to force the new style Streamer for all classes in bench.

git-svn-id: ecbadac9c76e8cf640a0bca86f6bd796c98521e3@10478 27541ba8-7e3a-0410-8455-c3a389f83636


#ifndef SRC_ONIG_RESULT_H_
#define SRC_ONIG_RESULT_H_

#include "oniguruma.h"

class OnigResult {
 public:
  explicit OnigResult(OnigRegion* region, int indexInScanner);
  ~OnigResult();

  int Count();
  int LocationAt(int index);
  int LengthAt(int index);
  int Index() { return indexInScanner; }
  void SetIndex(int newIndex) { indexInScanner = newIndex; }

 private:
  OnigResult(const OnigResult&);  // Disallow copying
  OnigResult &operator=(const OnigResult&);  // Disallow copying

  OnigRegion *region_;
  int indexInScanner;
};

#endif  // SRC_ONIG_RESULT_H_

#ifndef SRC_ONIG_RESULT_H_
#define SRC_ONIG_RESULT_H_

#include "nan.h"
#include "oniguruma.h"

class OnigResult {
 public:
  explicit OnigResult(OnigRegion* region, int indexInScanner);
  ~OnigResult();

  int Count();
  int LocationAt(int index);
  int LengthAt(int index);
  int Index() { return indexInScanner; }
  void SetIndex(int newIndex) { indexInScanner = newIndex; }

 private:
  OnigResult(const OnigResult&);  // Disallow copying
  OnigResult &operator=(const OnigResult&);  // Disallow copying

  OnigRegion *region_;
  int indexInScanner;
};

#endif  // SRC_ONIG_RESULT_H_

Fix compilation on win8 : include nan before oniguruma


#ifndef CLIENTMODEL_H
#define CLIENTMODEL_H

#include <QObject>

class OptionsModel;
class AddressTableModel;
class TransactionTableModel;
class CWallet;

QT_BEGIN_NAMESPACE
class QDateTime;
QT_END_NAMESPACE

// Interface to Bitcoin network client
class ClientModel : public QObject
{
    Q_OBJECT
public:
    // The only reason that this constructor takes a wallet is because
    // the global client settings are stored in the main wallet.
    explicit ClientModel(OptionsModel *optionsModel, QObject *parent = 0);

    OptionsModel *getOptionsModel();

    int getNumConnections() const;
    int getNumBlocks() const;

    QDateTime getLastBlockDate() const;

    // Return true if client connected to testnet
    bool isTestNet() const;
    // Return true if core is doing initial block download
    bool inInitialBlockDownload() const;
    // Return conservative estimate of total number of blocks, or 0 if unknown
    int getTotalBlocksEstimate() const;

    QString formatFullVersion() const;

private:
    OptionsModel *optionsModel;

    int cachedNumConnections;
    int cachedNumBlocks;

signals:
    void numConnectionsChanged(int count);
    void numBlocksChanged(int count);

    // Asynchronous error notification
    void error(const QString &title, const QString &message);

public slots:

private slots:
    void update();
};

#endif // CLIENTMODEL_H

#ifndef CLIENTMODEL_H
#define CLIENTMODEL_H

#include <QObject>

class OptionsModel;
class AddressTableModel;
class TransactionTableModel;
class CWallet;

QT_BEGIN_NAMESPACE
class QDateTime;
QT_END_NAMESPACE

// Interface to Bitcoin network client
class ClientModel : public QObject
{
    Q_OBJECT
public:
    explicit ClientModel(OptionsModel *optionsModel, QObject *parent = 0);

    OptionsModel *getOptionsModel();

    int getNumConnections() const;
    int getNumBlocks() const;

    QDateTime getLastBlockDate() const;

    // Return true if client connected to testnet
    bool isTestNet() const;
    // Return true if core is doing initial block download
    bool inInitialBlockDownload() const;
    // Return conservative estimate of total number of blocks, or 0 if unknown
    int getTotalBlocksEstimate() const;

    QString formatFullVersion() const;

private:
    OptionsModel *optionsModel;

    int cachedNumConnections;
    int cachedNumBlocks;

signals:
    void numConnectionsChanged(int count);
    void numBlocksChanged(int count);

    // Asynchronous error notification
    void error(const QString &title, const QString &message);

public slots:

private slots:
    void update();
};

#endif // CLIENTMODEL_H

Remove no longer valid comment

Remove no longer valid comment


//! Non overloaded function
void simplefunc();

//! Function which takes two int arguments
void f(int, int);

//! Function which takes two double arguments
void f(double, double);

namespace test {

//! Another function which takes two int arguments
void g(int, int);

//! Another function which takes two double arguments
void g(double, double);

}

class MyType {};

class MyOtherType {};

//! Another function which takes a custom type
void h(std::string, MyType);

//! Another function which takes another custom type
void h(std::string, MyOtherType o);

//! Another function which takes a basic type
void h(std::string, float myfloat);

//! Another function which takes a const custom type
void h(std::string, const MyType& mytype);

//! Another function which takes a const basic type
void h(std::string, const int myint);

//! Another function which takes a const basic type
template <typename T>
void h(std::string, const T myType);

//! Another function which takes a const basic type
template <typename T, typename U>
void h(std::string, const T m, const U n);

/**
 * Test function 1.
 */
void j(int);

/**
 * Test function 2.
 */
void j(char);

Add extra function overload example

Add extra function overload example

For some reason this single argument overloaded function reveals a bug
that the more complex examples do not. Thanks to vitaut for providing
it.


/*
 * $Id$
 *
 * Define the tags in the shared memory in a reusable format.
 * Whoever includes this get to define what the SLTM macro does.
 *
 */

SLTM(CLI)
SLTM(SessionOpen)
SLTM(SessionClose)
SLTM(ClientAddr)
SLTM(Request)
SLTM(URL)
SLTM(Protocol)
SLTM(Headers)

/*
 * $Id$
 *
 * Define the tags in the shared memory in a reusable format.
 * Whoever includes this get to define what the SLTM macro does.
 *
 */

SLTM(CLI)
SLTM(SessionOpen)
SLTM(SessionClose)
SLTM(ClientAddr)
SLTM(Request)
SLTM(URL)
SLTM(Protocol)
SLTM(H_Unknown)
#define HTTPH(a, b)	SLTM(b)
#include "http_headers.h"
#undef HTTPH

Use http_headers.h to define HTTP header tags for logging

git-svn-id: 7d4b18ab7d176792635d6a7a77dd8cbbea8e8daa@90 d4fa192b-c00b-0410-8231-f00ffab90ce4


#ifndef OOC_ARRAY_H_
#define OOC_ARRAY_H_

#define array_malloc(size) calloc(1, (size))
#define array_free free

#include <stdint.h>

#define _lang_array__Array_new(type, size) ((_lang_array__Array) { size, array_malloc((size) * sizeof(type)) });

#if defined(safe)
#define _lang_array__Array_get(array, index, type) ( \
    ((type*) array.data)[(index < 0 || index >= array.length) ? kean_exception_outOfBoundsException_throw(index, array.length), -1 : index])
#define _lang_array__Array_set(array, index, type, value) \
    (((type*) array.data)[(index < 0 || index >= array.length) ? kean_exception_outOfBoundsException_throw(index, array.length), -1 : index] = value)
#else
#define _lang_array__Array_get(array, index, type) ( \
    ((type*) array.data)[index])
#define _lang_array__Array_set(array, index, type, value) \
    (((type*) array.data)[index] = value)
#endif

#define _lang_array__Array_free(array) { array_free(array.data); array.data = NULL; array.length = 0; }

typedef struct {
    size_t length;
    void* data;
} _lang_array__Array;

#endif

#ifndef OOC_ARRAY_H_
#define OOC_ARRAY_H_

#define array_malloc(size) calloc(1, (size))
#define array_free free

#include <stdint.h>

#define _lang_array__Array_new(type, size) ((_lang_array__Array) { size, array_malloc((size) * sizeof(type)) });

#if defined(safe)
#define _lang_array__Array_get(array, index, type) ( \
    ((type*) array.data)[(index < 0 || index >= array.length) ? kean_exception_outOfBoundsException_throw(index, array.length), -1 : index])
#define _lang_array__Array_set(array, index, type, value) \
    (((type*) array.data)[(index < 0 || index >= array.length) ? kean_exception_outOfBoundsException_throw(index, array.length), -1 : index] = value)
#else
#define _lang_array__Array_get(array, index, type) ( \
    ((type*) array.data)[index])
#define _lang_array__Array_set(array, index, type, value) \
    (((type*) array.data)[index] = value)
#endif

#define _lang_array__Array_free(array) { array_free(array.data); }

typedef struct {
    size_t length;
    void* data;
} _lang_array__Array;

#endif

Revert "Set pointer to array data to null after free"


/* This file is part of the KDE libraries
   Copyright (C) 2010 Christoph Cullmann <cullmann@kde.org>
   Copyright (C) 2005 Hamish Rodda <rodda@kde.org>

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

   This 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
   Library General Public License for more details.

   You should have received a copy of the GNU Library General Public License
   along with this library; see the file COPYING.LIB.  If not, write to
   the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
   Boston, MA 02110-1301, USA.
*/

#ifndef KATE_RANGE_TEST_H
#define KATE_RANGE_TEST_H

#include <QtCore/QObject>

#include <ktexteditor/range.h>

class RangeTest : public QObject
{
  Q_OBJECT;

public:
  RangeTest();
  ~RangeTest();

private Q_SLOTS:
  void testTextEditorRange();
  void testTextRange();
  void testInsertText();
  void testCornerCaseInsertion();

private:
  void rangeCheck ( KTextEditor::Range & valid );
};

#endif

/* This file is part of the KDE libraries
   Copyright (C) 2010 Christoph Cullmann <cullmann@kde.org>
   Copyright (C) 2005 Hamish Rodda <rodda@kde.org>

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

   This 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
   Library General Public License for more details.

   You should have received a copy of the GNU Library General Public License
   along with this library; see the file COPYING.LIB.  If not, write to
   the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
   Boston, MA 02110-1301, USA.
*/

#ifndef KATE_RANGE_TEST_H
#define KATE_RANGE_TEST_H

#include <QtCore/QObject>

#include <ktexteditor/range.h>

class RangeTest : public QObject
{
  Q_OBJECT

public:
  RangeTest();
  ~RangeTest();

private Q_SLOTS:
  void testTextEditorRange();
  void testTextRange();
  void testInsertText();
  void testCornerCaseInsertion();

private:
  void rangeCheck ( KTextEditor::Range & valid );
};

#endif

Fix compilations
Thanks to  tropikhajma
CCMAIL: tropikhajma@gmail.com
BUG: 234775

svn path=/trunk/KDE/kdelibs/kate/; revision=1116300


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

int main()
{
    char *test = "HELLO WORLD. This is a test";
    char out[strlen(test)];
    out[strlen(test)] = '\0';

    rot(test, &out, 13);
    printf("Input: %s\n", test);
    printf("Output: %s", out);

    return 0;
}

void rot(char *in, char *out, int n)
{
    int i;
    char c;
    for (i = 0; i < strlen(in); i++)
    {
        c = in[i];
        if ((c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z'))
        {
            if (c + n > 'z' || (c <= 'Z' && c + n > 'Z'))
            {
                c -= (26 - n);
            }
            else
            {
                c += n;
            }
        }
        out[i] = c;
    }
}

Add RotN implementation in C

Add RotN implementation in C


/*
    Copyright (c) 2011 Volker Krause <vkrause@kde.org>

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

    This 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 Library General Public
    License for more details.

    You should have received a copy of the GNU Library General Public License
    along with this library; see the file COPYING.LIB.  If not, write to the
    Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
    02110-1301, USA.
*/

#ifndef AKTEST_H
#define AKTEST_H

#include "akapplication.h"

#define AKTEST_MAIN( TestObject ) \
int main(int argc, char **argv) \
{ \
  AkCoreApplication app(argc, argv); \
  app.parseCommandLine(); \
  TestObject tc; \
  return QTest::qExec(&tc, argc, argv); \
}

inline void akTestSetInstanceIdentifier( const QString &instanceId )
{
  AkApplication::setInstanceIdentifier( instanceId );
}

#endif

/*
    Copyright (c) 2011 Volker Krause <vkrause@kde.org>

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

    This 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 Library General Public
    License for more details.

    You should have received a copy of the GNU Library General Public License
    along with this library; see the file COPYING.LIB.  If not, write to the
    Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
    02110-1301, USA.
*/

#ifndef AKTEST_H
#define AKTEST_H

#include "akapplication.h"

#define AKTEST_MAIN( TestObject ) \
int main(int argc, char **argv) \
{ \
  qputenv("XDG_DATA_HOME", ".local-unit-test/share"); \
  qputenv("XDG_CONFIG_HOME", ".config-unit-test"); \
  AkCoreApplication app(argc, argv); \
  app.parseCommandLine(); \
  TestObject tc; \
  return QTest::qExec(&tc, argc, argv); \
}

inline void akTestSetInstanceIdentifier( const QString &instanceId )
{
  AkApplication::setInstanceIdentifier( instanceId );
}

#endif

Improve isolation of unit tests.

Improve isolation of unit tests.


/*
   This file is part of KDE
   Copyright (C) 2006 Christian Ehrlicher <ch.ehrlicher@gmx.de>

   This library is free software; you can redistribute it and/or
   modify it under the terms of the GNU Library General Public
   License version 2 as published by the Free Software Foundation.

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

   You should have received a copy of the GNU Library General Public License
   along with this library; see the file COPYING.LIB.  If not, write to
   the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
   Boston, MA 02110-1301, USA.
*/

#ifndef _KDEBASE_EXPORT_H
#define _KDEBASE_EXPORT_H

#include <kdemacros.h>

#ifdef MAKE_KATEINTERFACES_LIB
# define KATEINTERFACES_EXPORT KDE_EXPORT
#else
# if defined _WIN32 || defined _WIN64
#  define KATEINTERFACES_EXPORT KDE_IMPORT
# else
#  define KATEINTERFACES_EXPORT KDE_EXPORT
# endif
#endif

#endif // _KDEBASE_EXPORT_H

/*
   This file is part of KDE
   Copyright (C) 2006 Christian Ehrlicher <ch.ehrlicher@gmx.de>

   This library is free software; you can redistribute it and/or
   modify it under the terms of the GNU Library General Public
   License version 2 as published by the Free Software Foundation.

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

   You should have received a copy of the GNU Library General Public License
   along with this library; see the file COPYING.LIB.  If not, write to
   the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
   Boston, MA 02110-1301, USA.
*/

#ifndef _KATE_EXPORT_H
#define _KATE_EXPORT_H

#include <kdemacros.h>

#ifdef MAKE_KATEINTERFACES_LIB
# define KATEINTERFACES_EXPORT KDE_EXPORT
#else
# if defined _WIN32 || defined _WIN64
#  define KATEINTERFACES_EXPORT KDE_IMPORT
# else
#  define KATEINTERFACES_EXPORT KDE_EXPORT
# endif
#endif

#endif // _KATE_EXPORT_H

Replace the include guard too.

Replace the include guard too.

svn path=/trunk/KDE/kdesdk/kate/; revision=636748


// File:       stdlib/stdio.h
// Author:     vodozhaba
// Created on: Aug 21, 2016
// Purpose:    Provides standard I/O functions.

#pragma once

#include <stdarg.h>
#include "io/disk/file.h"

extern FileDescriptor* stdout;
extern FileDescriptor* stderr;

size_t StdoutWriteOp(FileDescriptor* file, size_t size, const void* buf);
size_t StderrWriteOp(FileDescriptor* file, size_t size, const void* buf);

int putchar(int character);
int _puts(const char* s);
int isspace (int c);
int fprintf(FileDescriptor* file,  const char* fmt, ...);
int printf(const char* fmt, ...);
int sprintf(char* dest, const char* fmt, ...);

// File:       stdlib/stdio.h
// Author:     vodozhaba
// Created on: Aug 21, 2016
// Purpose:    Provides standard I/O functions.

#pragma once

#include <stdarg.h>
#include "io/disk/file.h"

extern FileDescriptor* stdout;
extern FileDescriptor* stderr;

size_t StdoutWriteOp(FileDescriptor* file, size_t size, const void* buf);
size_t StderrWriteOp(FileDescriptor* file, size_t size, const void* buf);

int putchar(int character);
int _puts(const char* s);
int isspace (int c);
int fprintf(FileDescriptor* file,  const char* fmt, ...);
int vfprintf(FileDescriptor* file,  const char* fmt, va_list argss);
int printf(const char* fmt, ...);
int sprintf(char* dest, const char* fmt, ...);

Add vfprintf to the public interface just in case


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

main(int argc, char **argv)
{
  register double width;
  double sum = 0, lsum;
  register int intervals, i;
  int nproc, iproc;
  MPI_Win sum_win;

  if (MPI_Init(&argc, &argv) != MPI_SUCCESS) exit(1);
  MPI_Comm_size(MPI_COMM_WORLD, &nproc);
  MPI_Comm_rank(MPI_COMM_WORLD, &iproc);
  MPI_Win_create(&sum, sizeof(sum), sizeof(sum),
                 0, MPI_COMM_WORLD, &sum_win);
  MPI_Win_fence(0, sum_win);
  intervals = atoi(argv[1]);
  width = 1.0 / intervals;
  lsum = 0;
  for (i=iproc; i<intervals; i+=nproc) {
    register double x = (i + 0.5) * width;
    lsum += 4.0 / (1.0 + x * x);
  }
  lsum *= width;
  MPI_Accumulate(&lsum, 1, MPI_DOUBLE, 0, 0,
                 1, MPI_DOUBLE, MPI_SUM, sum_win);
  MPI_Win_fence(0, sum_win);
  if (iproc == 0) {
    printf("Estimation of pi is %f\n", sum);
  }
  MPI_Finalize();
  return(0);
}

Replace MPI source code instead of executive binary file.
User will compile the source with its own mpi implementation.

git-svn-id: 9146c88ff6d39b48099bf954d15d68f687b3fa69@3133 28e8926c-6b08-0410-baaa-805c5e19b8d6


/* enums.h
 *  Copyright: 2001-2003 The Perl Foundation.  All Rights Reserved.
 *  Overview:
 *     enums shared by much of the stack-handling code
 *  Data Structure and Algorithms:
 *  History:
 *  Notes:
 *  References:
 */

#if !defined(PARROT_ENUMS_H_GUARD)
#define PARROT_ENUMS_H_GUARD

typedef enum {
    NO_STACK_ENTRY_TYPE     = 0,
    STACK_ENTRY_INT         = 1,
    STACK_ENTRY_FLOAT       = 2,
    STACK_ENTRY_STRING      = 3,
    STACK_ENTRY_PMC         = 4,
    STACK_ENTRY_POINTER     = 5,
    STACK_ENTRY_DESTINATION = 6
} Stack_entry_type;

typedef enum {
    NO_STACK_ENTRY_FLAGS     = 0,
    STACK_ENTRY_CLEANUP_FLAG = 1 << 0
} Stack_entry_flags;

typedef enum {
    NO_STACK_CHUNK_FLAGS     = 0,
    STACK_CHUNK_COW_FLAG     = 1 << 0
} Stack_chunk_flags;

#endif

/*
 * Local variables:
 * c-indentation-style: bsd
 * c-basic-offset: 4
 * indent-tabs-mode: nil
 * End:
 *
 * vim: expandtab shiftwidth=4:
*/

Add header and footer comments

Add header and footer comments

git-svn-id: 6e74a02f85675cec270f5d931b0f6998666294a3@3957 d31e2699-5ff4-0310-a27c-f18f2fbe73fe


//
//  OCErrorMsg.h
//  Owncloud iOs Client
//
// Copyright (C) 2014 ownCloud Inc. (http://www.owncloud.org/)
//
// 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.
//

#define kOCErrorServerUnauthorized 401
#define kOCErrorServerForbidden 403
#define kOCErrorServerPathNotFound 404
#define kOCErrorServerMethodNotPermitted 405
#define kOCErrorProxyAuth 407
#define kOCErrorServerTimeout 408
#define kOCErrorServerInternalError 500

Add new code to manage 500 server error

Add new code to manage 500 server error


/* Copyright (c) 2003 Timo Sirainen */

#include "lib.h"
#include "mkdir-parents.h"

#include <sys/stat.h>

int mkdir_parents(const char *path, mode_t mode)
{
	const char *p;

	if (mkdir(path, mode) < 0 && errno != EEXIST) {
		if (errno != ENOENT)
			return -1;

		p = strrchr(path, '/');
		if (p == NULL || p == path)
			return -1; /* shouldn't happen */

		t_push();
		if (mkdir_parents(t_strdup_until(path, p), mode) < 0) {
			t_pop();
			return -1;
		}
		t_pop();

		/* should work now */
		if (mkdir(path, mode) < 0 && errno != EEXIST)
			return -1;
	}

	return 0;
}

/* Copyright (c) 2003 Timo Sirainen */

#include "lib.h"
#include "mkdir-parents.h"

#include <sys/stat.h>

int mkdir_parents(const char *path, mode_t mode)
{
	const char *p;

	/* EISDIR check is for BSD/OS which returns it if path contains '/'
	   at the end and it exists. */
	if (mkdir(path, mode) < 0 && errno != EEXIST && errno != EISDIR) {
		if (errno != ENOENT)
			return -1;

		p = strrchr(path, '/');
		if (p == NULL || p == path)
			return -1; /* shouldn't happen */

		t_push();
		if (mkdir_parents(t_strdup_until(path, p), mode) < 0) {
			t_pop();
			return -1;
		}
		t_pop();

		/* should work now */
		if (mkdir(path, mode) < 0 && errno != EEXIST)
			return -1;
	}

	return 0;
}

Check for EISDIR error as well. Fixed problems with BSD/OS.


//===-- TypeMemberVisitor.h - ASTVisitor specialization ---------*- C++ -*-===//
//
// This source file is part of the Swift.org open source project
//
// Copyright (c) 2014 - 2015 Apple Inc. and the Swift project authors
// Licensed under Apache License v2.0 with Runtime Library Exception
//
// See http://swift.org/LICENSE.txt for license information
// See http://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
//
//===----------------------------------------------------------------------===//
//
// This file defines the curiously-recursive TypeMemberVisitor class
// and a few specializations thereof.
//
//===----------------------------------------------------------------------===//

#ifndef SWIFT_AST_TYPEMEMBERVISITOR_H
#define SWIFT_AST_TYPEMEMBERVISITOR_H

#include "swift/AST/ASTVisitor.h"

namespace swift {

/// TypeMemberVisitor - This is a convenience adapter of DeclVisitor
/// which filters out a few common declaration kinds that are never
/// members of nominal types.
template<typename ImplClass, typename RetTy = void>
class TypeMemberVisitor : public DeclVisitor<ImplClass, RetTy> {
protected:
  ImplClass &asImpl() { return static_cast<ImplClass&>(*this); }

public:
#define BAD_MEMBER(KIND) \
  RetTy visit##KIND##Decl(KIND##Decl *D) { \
    llvm_unreachable(#KIND "Decls cannot be members of nominal types"); \
  }
  BAD_MEMBER(Extension)
  BAD_MEMBER(Import)
  BAD_MEMBER(Protocol)
  BAD_MEMBER(TopLevelCode)

  /// A convenience method to visit all the members.
  void visitMembers(NominalTypeDecl *D) {
    for (Decl *member : D->getMembers()) {
      asImpl().visit(member);
    }
  }
};

template<typename ImplClass, typename RetTy = void>
class ClassMemberVisitor : public TypeMemberVisitor<ImplClass, RetTy> {
public:
  BAD_MEMBER(OneOfElement)

  void visitMembers(ClassDecl *D) {
    TypeMemberVisitor<ImplClass, RetTy>::visitMembers(D);
  }
};

#undef BAD_MEMBER

} // end namespace swift

#endif

Add a visitor for the members of a nominal type.

This really just conveniently filters out all the kinds of
declarations that can't appear in such scopes.

Swift SVN r3473


#ifndef __SimpleITKMacro_h
#define __SimpleITKMacro_h

#include <stdint.h>
#include <itkImageBase.h>
#include <itkImage.h>
#include <itkLightObject.h>
#include <itkSmartPointer.h>

// Define macros to aid in the typeless layer
typedef itk::ImageBase<3> SimpleImageBase;

namespace itk {
  namespace simple {

    // To add a new type you must:
    // 1. Add an entry to ImageDataType
    // 2. Add to the sitkDataTypeSwitch
    // 3. Add the new type to ImageFileReader/ImageFileWriter

    enum ImageDataType {
      sitkUInt8,    // Unsigned 8 bit integer
      sitkInt16,   // Signed 16 bit integer
      sitkInt32,   // Signed 32 bit integer
      sitkFloat32,  // 32 bit float
    };

#define sitkImageDataTypeCase(typeN, type, call ) \
    case typeN: { typedef type DataType; call; }; break

#define sitkImageDataTypeSwitch( call ) \
    sitkImageDataTypeCase ( sitkUInt8, uint8_t, call ); \
    sitkImageDataTypeCase ( sitkInt16, int16_t, call ); \
    sitkImageDataTypeCase ( sitkInt32, int32_t, call ); \
    sitkImageDataTypeCase ( sitkFloat32, float, call );

  }
}

#endif

#ifndef __SimpleITKMacro_h
#define __SimpleITKMacro_h

// Ideally, take the types from the C99 standard.  However,
// VS 8 does not have stdint.h, but they are defined anyway.
#ifndef _MSC_VER
	#include <stdint.h>
#endif

#include <itkImageBase.h>
#include <itkImage.h>
#include <itkLightObject.h>
#include <itkSmartPointer.h>

// Define macros to aid in the typeless layer
typedef itk::ImageBase<3> SimpleImageBase;

namespace itk {
  namespace simple {

    // To add a new type you must:
    // 1. Add an entry to ImageDataType
    // 2. Add to the sitkDataTypeSwitch
    // 3. Add the new type to ImageFileReader/ImageFileWriter

    enum ImageDataType {
      sitkUInt8,    // Unsigned 8 bit integer
      sitkInt16,   // Signed 16 bit integer
      sitkInt32,   // Signed 32 bit integer
      sitkFloat32,  // 32 bit float
    };

#define sitkImageDataTypeCase(typeN, type, call ) \
    case typeN: { typedef type DataType; call; }; break

#define sitkImageDataTypeSwitch( call ) \
    sitkImageDataTypeCase ( sitkUInt8, uint8_t, call ); \
    sitkImageDataTypeCase ( sitkInt16, int16_t, call ); \
    sitkImageDataTypeCase ( sitkInt32, int32_t, call ); \
    sitkImageDataTypeCase ( sitkFloat32, float, call );

  }
}

#endif

Support for MS Visual Studio 2008.

Support for MS Visual Studio 2008.


@import objc;

@interface NSArray : NSObject
- (id)objectAtIndexedSubscript:(unsigned)idx;
@end

@interface Hive
@property __attribute__((iboutletcollection(B))) NSArray *bees;
@end

@import objc;

typedef unsigned long NSUInteger;

@interface NSArray : NSObject
- (id)objectAtIndexedSubscript:(NSUInteger)idx;
@end

@interface Hive
@property __attribute__((iboutletcollection(B))) NSArray *bees;
@end

Use NSUInteger, even in our little tests.

Swift SVN r3555


/*
 *
 * Copyright 2017 gRPC authors.
 *
 * 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 GRPC_IMPL_CODEGEN_FORK_H
#define GRPC_IMPL_CODEGEN_FORK_H

/**
 * gRPC applications should call this before calling fork().  There should be no
 * active gRPC function calls between calling grpc_prefork() and
 * grpc_postfork_parent()/grpc_postfork_child().
 *
 *
 * Typical use:
 * grpc_prefork();
 * int pid = fork();
 * if (pid) {
 *  grpc_postfork_parent();
 *  // Parent process..
 * } else {
 *  grpc_postfork_child();
 *  // Child process...
 * }
 */

void grpc_prefork();

void grpc_postfork_parent();

void grpc_postfork_child();

void grpc_fork_handlers_auto_register();

#endif /* GRPC_IMPL_CODEGEN_FORK_H */

/*
 *
 * Copyright 2017 gRPC authors.
 *
 * 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 GRPC_IMPL_CODEGEN_FORK_H
#define GRPC_IMPL_CODEGEN_FORK_H

/**
 * gRPC applications should call this before calling fork().  There should be no
 * active gRPC function calls between calling grpc_prefork() and
 * grpc_postfork_parent()/grpc_postfork_child().
 *
 *
 * Typical use:
 * grpc_prefork();
 * int pid = fork();
 * if (pid) {
 *  grpc_postfork_parent();
 *  // Parent process..
 * } else {
 *  grpc_postfork_child();
 *  // Child process...
 * }
 */

void grpc_prefork(void);

void grpc_postfork_parent(void);

void grpc_postfork_child(void);

void grpc_fork_handlers_auto_register(void);

#endif /* GRPC_IMPL_CODEGEN_FORK_H */

Resolve Swift warnings by specifying void arguments

The following functions in the `fork.h` file cause a `This function declaration is not a prototype` warning in Swift:
```
void grpc_prefork(void);

void grpc_postfork_parent(void);

void grpc_postfork_child(void);

void grpc_fork_handlers_auto_register(void);
```

Explicitly specifying `void` as the argument resolves the warnings.

Reproducible using Xcode 9.2 with `SwiftGRPC`/`gRPC-Core` via CocoaPods.


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

#include "SkGLContext.h"

#if SK_MESA

class SkMesaGLContext : public SkGLContext {
private:
    typedef intptr_t Context;

public:
    SkMesaGLContext();

    virtual ~SkMesaGLContext();

    virtual void makeCurrent() const SK_OVERRIDE;

    class AutoContextRestore {
    public:
        AutoContextRestore();
        ~AutoContextRestore();

    private:
        Context fOldContext;
        GLint   fOldWidth;
        GLint   fOldHeight;
        GLint   fOldFormat;
        void*   fOldImage;
    };

protected:
    virtual const GrGLInterface* createGLContext() SK_OVERRIDE;
    virtual void destroyGLContext() SK_OVERRIDE;

private:
    Context fContext;
    GrGLubyte *fImage;
};

#endif

#endif

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

#include "SkGLContext.h"

#if SK_MESA

class SkMesaGLContext : public SkGLContext {
private:
    typedef intptr_t Context;

public:
    SkMesaGLContext();

    virtual ~SkMesaGLContext();

    virtual void makeCurrent() const SK_OVERRIDE;

    class AutoContextRestore {
    public:
        AutoContextRestore();
        ~AutoContextRestore();

    private:
        Context fOldContext;
        GrGLint fOldWidth;
        GrGLint fOldHeight;
        GrGLint fOldFormat;
        void*   fOldImage;
    };

protected:
    virtual const GrGLInterface* createGLContext() SK_OVERRIDE;
    virtual void destroyGLContext() SK_OVERRIDE;

private:
    Context fContext;
    GrGLubyte *fImage;
};

#endif

#endif

Fix undefined GLint in Mac builds

Fix undefined GLint in Mac builds

git-svn-id: e8541e15acce502a64c929015570ad1648e548cd@3736 2bbb7eff-a529-9590-31e7-b0007b416f81


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

SQLITE_EXTENSION_INIT1
static void regexp_func(sqlite3_context *context, int argc, sqlite3_value **argv) {
  if (argc >= 2) {
    const char *target  = (const char *)sqlite3_value_text(argv[1]);
    const char *pattern = (const char *)sqlite3_value_text(argv[0]);
    const char* errstr = NULL;
    int erroff = 0;
    int vec[500];
    int n, rc;
    pcre* re = pcre_compile(pattern, 0, &errstr, &erroff, NULL);
    rc = pcre_exec(re, NULL, target, strlen(target), 0, 0, vec, 500);
    if (rc <= 0) {
      sqlite3_result_error(context, errstr, 0);
      return;
    }
    sqlite3_result_int(context, 1);
  }
}
__declspec(dllexport) int sqlite3_extension_init(sqlite3 *db, char **errmsg, const sqlite3_api_routines *api) {
  SQLITE_EXTENSION_INIT2(api);
  return sqlite3_create_function(db, "regexp", 2, SQLITE_UTF8, (void*)db, regexp_func, NULL, NULL);
}

Add example for sqlite3 extension

Add example for sqlite3 extension


#include "test_theft.h"
#include "theft_aux.h"

SUITE(aux) {
    // builtins
}

#include "test_theft.h"
#include "theft_aux.h"

struct a_squared_lte_b_env {
    struct theft_print_trial_result_env print_env;
};

static enum theft_trial_res
prop_a_squared_lte_b(void *arg_a, void *arg_b) {
    int8_t a = *(int8_t *)arg_a;
    uint16_t b = *(uint16_t *)arg_b;

    if (0) {
        fprintf(stdout, "\n$$ checking (%d * %d) < %u => %d ? %d\n",
        a, a, b, a * a, a * a <= b);
    }

    return ((a * a) <= b)
      ? THEFT_TRIAL_PASS
      : THEFT_TRIAL_FAIL;
}

TEST a_squared_lte_b(void) {
    theft_seed seed = theft_seed_of_time();

    struct a_squared_lte_b_env env;
    memset(&env, 0x00, sizeof(env));

    struct theft_run_config cfg = {
        .name = __func__,
        .fun = prop_a_squared_lte_b,
        .type_info = {
            theft_get_builtin_type_info(THEFT_BUILTIN_int8_t),
            theft_get_builtin_type_info(THEFT_BUILTIN_uint16_t),
        },
        .bloom_bits = 20,
        .seed = seed,
        .hooks = {
            .run_pre = theft_hook_run_pre_print_info,
            .run_post = theft_hook_run_post_print_info,
            .env = &env,
        },
    };

    ASSERT_EQ_FMTm("should find counter-examples",
        THEFT_RUN_FAIL, theft_run(&cfg), "%d");
    PASS();
}

SUITE(aux) {
    // builtins
    RUN_TEST(a_squared_lte_b);
}

Add test using built-in generators.

theft_aux: Add test using built-in generators.


/* @(#)root/treeplayer:$Name:  $:$Id: LinkDef.h,v 1.1.1.1 2000/05/16 17:00:44 rdm Exp $ */

/*************************************************************************
 * Copyright (C) 1995-2000, Rene Brun and Fons Rademakers.               *
 * All rights reserved.                                                  *
 *                                                                       *
 * For the licensing terms see $ROOTSYS/LICENSE.                         *
 * For the list of contributors see $ROOTSYS/README/CREDITS.             *
 *************************************************************************/

#ifdef __CINT__

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

#pragma link C++ class TTreePlayer;
#pragma link C++ class TPacketGenerator;
#pragma link C++ class TTreeFormula-;

#endif

/* @(#)root/treeplayer:$Name:  $:$Id: LinkDef.h,v 1.2 2000/07/06 17:20:52 brun Exp $ */

/*************************************************************************
 * Copyright (C) 1995-2000, Rene Brun and Fons Rademakers.               *
 * All rights reserved.                                                  *
 *                                                                       *
 * For the licensing terms see $ROOTSYS/LICENSE.                         *
 * For the list of contributors see $ROOTSYS/README/CREDITS.             *
 *************************************************************************/

#ifdef __CINT__

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

#pragma link C++ class TTreePlayer+;
#pragma link C++ class TPacketGenerator;
#pragma link C++ class TTreeFormula-;

#endif

Declare option "+" for TTreePlayer

Declare option "+" for TTreePlayer

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


#ifndef NRF_SDK_CONF_H__
#define NRF_SDK_CONF_H__

// SD specific configurations.

#if (BLUETOOTH_SD == 100)

#define MICROPY_PY_BLE                  (1)
#define MICROPY_PY_BLE_6LOWPAN          (1)
#define MICROPY_PY_USOCKET              (1)
#define MICROPY_PY_NETWORK              (1)

#elif (BLUETOOTH_SD == 110)

#define MICROPY_PY_BLE                  (1)

#elif (BLUETOOTH_SD == 132)

#define MICROPY_PY_BLE                  (1)
#define MICROPY_PY_BLE_NUS              (0)
#define MICROPY_PY_UBLUEPY              (1)
#define MICROPY_PY_UBLUEPY_PERIPHERAL   (1)

#else
#error "SD not supported"
#endif

// Default defines.

#ifndef MICROPY_PY_BLE_6LOWPAN
#define MICROPY_PY_BLE_6LOWPAN          (0)
#endif

#ifndef MICROPY_PY_BLE
#define MICROPY_PY_BLE                  (0)
#endif

#ifndef MICROPY_PY_BLE_NUS
#define MICROPY_PY_BLE_NUS              (0)
#endif

#endif

#ifndef NRF_SDK_CONF_H__
#define NRF_SDK_CONF_H__

// SD specific configurations.

#if (BLUETOOTH_SD == 100)

#define MICROPY_PY_BLE                  (1)
#define MICROPY_PY_BLE_6LOWPAN          (1)
#define MICROPY_PY_USOCKET              (1)
#define MICROPY_PY_NETWORK              (1)

#elif (BLUETOOTH_SD == 110)

#define MICROPY_PY_BLE                  (1)
#define MICROPY_PY_BLE_NUS              (0)
#define MICROPY_PY_UBLUEPY              (1)
#define MICROPY_PY_UBLUEPY_PERIPHERAL   (1)

#elif (BLUETOOTH_SD == 132)

#define MICROPY_PY_BLE                  (1)
#define MICROPY_PY_BLE_NUS              (0)
#define MICROPY_PY_UBLUEPY              (1)
#define MICROPY_PY_UBLUEPY_PERIPHERAL   (1)

#else
#error "SD not supported"
#endif

// Default defines.

#ifndef MICROPY_PY_BLE_6LOWPAN
#define MICROPY_PY_BLE_6LOWPAN          (0)
#endif

#ifndef MICROPY_PY_BLE
#define MICROPY_PY_BLE                  (0)
#endif

#ifndef MICROPY_PY_BLE_NUS
#define MICROPY_PY_BLE_NUS              (0)
#endif

#endif

nrf5/sdk: Enable ubluepy module if s110 bluetooth stack is enabled.


#ifndef _I2C_H
#define _I2C_H

#define I2C_FREQ 100000

struct i2c_iovec_s {
  uint8_t *base;
  uint8_t len;
};

void i2c_init(void);

void i2c_open(void);

void i2c_close(void);

int8_t i2c_readv(uint8_t address, struct i2c_iovec_s *iov, uint8_t iovcnt);

int8_t i2c_writev(uint8_t address, struct i2c_iovec_s *iov, uint8_t iovcnt);

int8_t i2c_read(uint8_t address, uint8_t *buf, uint8_t len);

int8_t i2c_write(uint8_t address, uint8_t *buf, uint8_t len);

int8_t i2c_read_from(uint8_t address, uint8_t reg, uint8_t *buf, uint8_t len);

int8_t i2c_write_to(uint8_t address, uint8_t reg, uint8_t *buf, uint8_t len);

#endif

#ifndef _I2C_H
#define _I2C_H

#ifndef I2C_FREQ
#define I2C_FREQ 100000
#endif

struct i2c_iovec_s {
  uint8_t *base;
  uint8_t len;
};

void i2c_init(void);

void i2c_open(void);

void i2c_close(void);

int8_t i2c_readv(uint8_t address, struct i2c_iovec_s *iov, uint8_t iovcnt);

int8_t i2c_writev(uint8_t address, struct i2c_iovec_s *iov, uint8_t iovcnt);

int8_t i2c_read(uint8_t address, uint8_t *buf, uint8_t len);

int8_t i2c_write(uint8_t address, uint8_t *buf, uint8_t len);

int8_t i2c_read_from(uint8_t address, uint8_t reg, uint8_t *buf, uint8_t len);

int8_t i2c_write_to(uint8_t address, uint8_t reg, uint8_t *buf, uint8_t len);

#endif

Allow I2C_FREQ to be defined externally

Allow I2C_FREQ to be defined externally


#import <Foundation/Foundation.h>

/**
 Simple wrappers over `[NSDate compare:]` to make comparisons more readable.
 */

@interface NSDate (TDTComparisons)

- (BOOL)isEarlierThanDate:(NSDate *)date;

- (BOOL)isEarlierThanOrEqualToDate:(NSDate *)date;

@end

#import <Foundation/Foundation.h>

/**
 Wrappers over `[NSDate compare:]` to make comparisons more readable.
 */

@interface NSDate (TDTComparisons)

- (BOOL)isEarlierThanDate:(NSDate *)date;

- (BOOL)isEarlierThanOrEqualToDate:(NSDate *)date;

@end

Remove unnecessary adjective from description


//===-- CTargetMachine.h - TargetMachine for the C backend ------*- C++ -*-===//
//
//                     The LLVM Compiler Infrastructure
//
// This file was developed by the LLVM research group and is distributed under
// the University of Illinois Open Source License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
//
// This file declares the TargetMachine that is used by the C backend.
//
//===----------------------------------------------------------------------===//

#ifndef CTARGETMACHINE_H
#define CTARGETMACHINE_H

#include "llvm/Target/TargetMachine.h"

namespace llvm {

struct CTargetMachine : public TargetMachine {
  const TargetData DataLayout;       // Calculates type size & alignment

  CTargetMachine(const Module &M, const std::string &FS)
    : TargetMachine("CBackend", M),
      DataLayout("CBackend") {}

  // This is the only thing that actually does anything here.
  virtual bool addPassesToEmitFile(PassManager &PM, std::ostream &Out,
                                   CodeGenFileType FileType, bool Fast);

  // This class always works, but shouldn't be the default in most cases.
  static unsigned getModuleMatchQuality(const Module &M) { return 1; }

  virtual const TargetData       *getTargetData() const { return &DataLayout; }
};

} // End llvm namespace

#endif

//===-- CTargetMachine.h - TargetMachine for the C backend ------*- C++ -*-===//
//
//                     The LLVM Compiler Infrastructure
//
// This file was developed by the LLVM research group and is distributed under
// the University of Illinois Open Source License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
//
// This file declares the TargetMachine that is used by the C backend.
//
//===----------------------------------------------------------------------===//

#ifndef CTARGETMACHINE_H
#define CTARGETMACHINE_H

#include "llvm/Target/TargetMachine.h"

namespace llvm {

struct CTargetMachine : public TargetMachine {
  const TargetData DataLayout;       // Calculates type size & alignment

  CTargetMachine(const Module &M, const std::string &FS)
    : TargetMachine("CBackend", M),
      DataLayout("CBackend", &M) {}

  // This is the only thing that actually does anything here.
  virtual bool addPassesToEmitFile(PassManager &PM, std::ostream &Out,
                                   CodeGenFileType FileType, bool Fast);

  // This class always works, but shouldn't be the default in most cases.
  static unsigned getModuleMatchQuality(const Module &M) { return 1; }

  virtual const TargetData       *getTargetData() const { return &DataLayout; }
};

} // End llvm namespace

#endif

Fix a bug in Owen's checkin that broke the CBE on all non sparc v9 platforms.

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


// RUN: %llvmgcc %s -c -O3 -m64 -emit-llvm -o - | llc -march=x86-64 -mtriple=x86_64-apple-darwin | FileCheck %s
// XFAIL: *
// XTARGET: x86,i386,i686
// r9 used to be clobbered before its value was moved to r10.  7993104.

void foo(int x, int y) {
// CHECK: bar
// CHECK: movq  %r9, %r10
// CHECK: movq  %rdi, %r9
// CHECK: bar
  register int lr9 asm("r9") = x;
  register int lr10 asm("r10") = y;
  int foo;
  asm volatile("bar" : "=r"(lr9) : "r"(lr9), "r"(lr10));
  foo = lr9;
  lr9 = x;
  lr10 = foo;
  asm volatile("bar" : "=r"(lr9) : "r"(lr9), "r"(lr10));
}

// RUN: %llvmgcc %s -c -O3 -m64 -emit-llvm -o - | llc -march=x86-64 -mtriple=x86_64-apple-darwin | FileCheck %s
// r9 used to be clobbered before its value was moved to r10.  7993104.

void foo(int x, int y) {
// CHECK: bar
// CHECK: movq  %r9, %r10
// CHECK: movq  %rdi, %r9
// CHECK: bar
  register int lr9 asm("r9") = x;
  register int lr10 asm("r10") = y;
  int foo;
  asm volatile("bar" : "=r"(lr9) : "r"(lr9), "r"(lr10));
  foo = lr9;
  lr9 = x;
  lr10 = foo;
  asm volatile("bar" : "=r"(lr9) : "r"(lr9), "r"(lr10));
}

Test passed on ppc, to my surprise; if it worked
there it may work everywhere...

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


/*! \file SwiftParticle.h
 *  \brief header file for the SWIFT particle type.

*/

#ifndef SWIFT_PARTICLE_H
#define SWIFT_PARTICLE_H

#ifdef SWIFTINTERFACE
  /**
 * @brief The default struct alignment in SWIFT.
 */
#define SWIFT_STRUCT_ALIGNMENT 32
#define SWIFT_STRUCT_ALIGN __attribute__((aligned(SWIFT_STRUCT_ALIGNMENT)))

namespace Swift
{

  /* SWIFT enum of part types. Should match VELOCIraptor type values. */
  enum part_type {
    swift_type_gas = 0,
    swift_type_dark_matter = 1,
    swift_type_star = 4,
    swift_type_black_hole = 5,
    swift_type_count
  } __attribute__((packed));

  /* SWIFT/VELOCIraptor particle. */
    struct swift_vel_part {

      /*! Particle ID. If negative, it is the negative offset of the #part with
        which this gpart is linked. */
      long long id;

      /*! Particle position. */
      double x[3];

      /*! Particle velocity. */
      float v[3];

      /*! Particle mass. */
      float mass;

      /*! Gravitational potential */
      float potential;

      /*! Internal energy of gas particle */
      float u;

      /*! Type of the #gpart (DM, gas, star, ...) */
      enum part_type type;

    } SWIFT_STRUCT_ALIGN;

}

#endif

#endif

/*! \file SwiftParticle.h
 *  \brief header file for the SWIFT particle type.

*/

#ifndef SWIFT_PARTICLE_H
#define SWIFT_PARTICLE_H

#ifdef SWIFTINTERFACE

namespace Swift
{

  /* SWIFT enum of part types. Should match VELOCIraptor type values. */
  enum part_type {
    swift_type_gas = 0,
    swift_type_dark_matter = 1,
    swift_type_star = 4,
    swift_type_black_hole = 5,
    swift_type_count
  } __attribute__((packed));

  /* SWIFT/VELOCIraptor particle. */
    struct swift_vel_part {

      /*! Particle ID. */
      long long id;

      /*! Particle position. */
      double x[3];

      /*! Particle velocity. */
      float v[3];

      /*! Particle mass. */
      float mass;

      /*! Gravitational potential */
      float potential;

      /*! Internal energy of gas particle */
      float u;

      /*! Type of the #gpart (DM, gas, star, ...) */
      enum part_type type;

    };

}

#endif

#endif

Use unaligned particle structure to save memory.


//
//  MPConstants.h
//  MoPub
//
//  Created by Nafis Jamal on 2/9/11.
//  Copyright 2011 MoPub, Inc. All rights reserved.
//

#import <UIKit/UIKit.h>

#define MP_DEBUG_MODE               1

#define HOSTNAME                    @"ads.mopub.com"
#define HOSTNAME_FOR_TESTING        @"testing.ads.mopub.com"
#define DEFAULT_PUB_ID              @"agltb3B1Yi1pbmNyDAsSBFNpdGUYkaoMDA"
#define MP_SERVER_VERSION           @"8"
#define MP_SDK_VERSION              @"1.16.0.1"

// Sizing constants.
#define MOPUB_BANNER_SIZE           CGSizeMake(320, 50)
#define MOPUB_MEDIUM_RECT_SIZE      CGSizeMake(300, 250)
#define MOPUB_LEADERBOARD_SIZE      CGSizeMake(728, 90)
#define MOPUB_WIDE_SKYSCRAPER_SIZE  CGSizeMake(160, 600)

// Miscellaneous constants.
#define MINIMUM_REFRESH_INTERVAL            5.0
#define DEFAULT_BANNER_REFRESH_INTERVAL     60
#define BANNER_TIMEOUT_INTERVAL             10
#define INTERSTITIAL_TIMEOUT_INTERVAL       30

// Feature Flags
#define SESSION_TRACKING_ENABLED            1

//
//  MPConstants.h
//  MoPub
//
//  Created by Nafis Jamal on 2/9/11.
//  Copyright 2011 MoPub, Inc. All rights reserved.
//

#import <UIKit/UIKit.h>

#if DEBUG
#define MP_DEBUG_MODE               1
#else
#define MP_DEBUG_MODE               0
#endif

#define HOSTNAME                    @"ads.mopub.com"
#define HOSTNAME_FOR_TESTING        @"testing.ads.mopub.com"
#define DEFAULT_PUB_ID              @"agltb3B1Yi1pbmNyDAsSBFNpdGUYkaoMDA"
#define MP_SERVER_VERSION           @"8"
#define MP_SDK_VERSION              @"1.16.0.1"

// Sizing constants.
#define MOPUB_BANNER_SIZE           CGSizeMake(320, 50)
#define MOPUB_MEDIUM_RECT_SIZE      CGSizeMake(300, 250)
#define MOPUB_LEADERBOARD_SIZE      CGSizeMake(728, 90)
#define MOPUB_WIDE_SKYSCRAPER_SIZE  CGSizeMake(160, 600)

// Miscellaneous constants.
#define MINIMUM_REFRESH_INTERVAL            5.0
#define DEFAULT_BANNER_REFRESH_INTERVAL     60
#define BANNER_TIMEOUT_INTERVAL             10
#define INTERSTITIAL_TIMEOUT_INTERVAL       30

// Feature Flags
#define SESSION_TRACKING_ENABLED            1

Disable MoPub logging for release builds.


#ifndef SIMPLEAMQPCLIENT_VERSION_H
#define SIMPLEAMQPCLIENT_VERSION_H
/*
 * ***** BEGIN LICENSE BLOCK *****
 * Version: MIT
 *
 * Copyright (c) 2013 Alan Antonuk
 *
 * 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.
 * ***** END LICENSE BLOCK *****
 */

#define SIMPLEAMQPCLIENT_VERSION_MAJOR 2
#define SIMPLEAMQPCLIENT_VERSION_MINOR 5
#define SIMPLEAMQPCLIENT_VERSION_PATCH 1

#endif  // SIMPLEAMQPCLIENT_VERSION_H

#ifndef SIMPLEAMQPCLIENT_VERSION_H
#define SIMPLEAMQPCLIENT_VERSION_H
/*
 * ***** BEGIN LICENSE BLOCK *****
 * Version: MIT
 *
 * Copyright (c) 2013 Alan Antonuk
 *
 * 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.
 * ***** END LICENSE BLOCK *****
 */

#define SIMPLEAMQPCLIENT_VERSION_MAJOR 2
#define SIMPLEAMQPCLIENT_VERSION_MINOR 6
#define SIMPLEAMQPCLIENT_VERSION_PATCH 0

#endif  // SIMPLEAMQPCLIENT_VERSION_H

Increment version to v2.6 (take 2)

Increment version to v2.6 (take 2)

v2.5.1 was release to correct a problem with install directories on
Debian.


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

#ifndef WEBKIT_PLUGINS_PPAPI_PPP_PDF_H_
#define WEBKIT_PLUGINS_PPAPI_PPP_PDF_H_

#include "ppapi/c/pp_instance.h"
#include "ppapi/c/pp_point.h"
#include "ppapi/c/pp_var.h"

#define PPP_PDF_INTERFACE_1 "PPP_Pdf;1"

struct PPP_Pdf_1 {
  // Returns an absolute URL if the position is over a link.
  PP_Var (*GetLinkAtPosition)(PP_Instance instance,
                              PP_Point point);
};

typedef PPP_Pdf_1 PPP_Pdf;

#endif  // WEBKIT_PLUGINS_PPAPI_PPP_PDF_H_

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

#ifndef WEBKIT_PLUGINS_PPAPI_PPP_PDF_H_
#define WEBKIT_PLUGINS_PPAPI_PPP_PDF_H_

#include "ppapi/c/pp_instance.h"
#include "ppapi/c/pp_point.h"
#include "ppapi/c/pp_var.h"

#define PPP_PDF_INTERFACE_1 "PPP_Pdf;1"
#define PPP_PDF_INTERFACE PPP_PDF_INTERFACE_1

struct PPP_Pdf_1 {
  // Returns an absolute URL if the position is over a link.
  PP_Var (*GetLinkAtPosition)(PP_Instance instance,
                              PP_Point point);
};

typedef PPP_Pdf_1 PPP_Pdf;

#endif  // WEBKIT_PLUGINS_PPAPI_PPP_PDF_H_

Add missing unversioned interface-name macro for PPP_Pdf.

BUG=107398

Review URL: http://codereview.chromium.org/9114010

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


#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include "mdb.h"

int main(int argc,char * argv[])
{
	int i = 0, rc;
	MDB_env *env;
	MDB_db *db;
	MDB_stat *mst;
	char *envname = argv[1];
	char *subname = NULL;

	if (argc > 2)
		subname = argv[2];

	rc = mdbenv_create(&env, 0);
	rc = mdbenv_open(env, envname, MDB_RDONLY, 0);
	if (rc) {
		printf("mdbenv_open failed, error %d\n", rc);
		exit(1);
	}
	rc = mdb_open(env, NULL, NULL, 0, &db);
	if (rc) {
		printf("mdb_open failed, error %d\n", rc);
		exit(1);
	}

	rc = mdb_stat(db, &mst);
	printf("Created at %s", ctime(&mst->ms_created_at));
	printf("Page size: %u\n", mst->ms_psize);
	printf("Tree depth: %u\n", mst->ms_depth);
	printf("Branch pages: %lu\n", mst->ms_branch_pages);
	printf("Leaf pages: %lu\n", mst->ms_leaf_pages);
	printf("Overflow pages: %lu\n", mst->ms_overflow_pages);
	printf("Revisions: %lu\n", mst->ms_revisions);
	printf("Entries: %lu\n", mst->ms_entries);
	mdb_close(db);
	mdbenv_close(env);

	return 0;
}

Return statistics for a DB

Return statistics for a DB

Eventually this will have to grow up to be like BDB db_stat...


//{{NO_DEPENDENCIES}}
// Microsoft Developer Studio generated include file.
// Used by Glide2x.rc
//

// Next default values for new objects
//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE        101
#define _APS_NEXT_COMMAND_VALUE         40001
#define _APS_NEXT_CONTROL_VALUE         1000
#define _APS_NEXT_SYMED_VALUE           101
#endif
#endif

Add forgotten file. Created when the .rc file was added to provide the dll with a version to keep Red Baron happy.


#include "list.h"

struct ListNode
{
	ListNode* prev;
	ListNode* next;
	void* k;
};

struct List
{
	ListNode* head;
};

List* List_Create(void)
{
	List* l = (List *)malloc(sizeof(List));
	l->head = NULL;
	return l;
}

ListNode* ListNode_Create(void* k)
{
	ListNode* n = (ListNode *)malloc(sizeof(ListNode));
	n->prev = NULL;
	n->next = NULL;
	n->k = k;
	return n;
}

ListNode* List_Search(List* l, void* k, int (f)(void*, void*))
{
	ListNode* n = l->head;
	while (n != NULL && !f(n->k, k))
	{
		n = n->next;
	}
	return n;
}

void List_Insert(List* l, ListNode* n)
{
	n->next = l->head;
	if (l->head != NULL)
	{
		l->head->prev = n;
	}
	l->head = n;
	n->prev = NULL;
}

void List_Delete(List* l, ListNode* n)
{
	if (n->prev != NULL)
	{
		n->prev->next = n->next;
	} else {
		l->head = n->next;
	}
	if (n->next != NULL)
	{
		n->next->prev = n->prev;
	}
}

Add List Delete function implementation

Add List Delete function implementation


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

int main(int argc,char* argv)
{

	return 0;
}

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

int main(int argc,char* argv)
{
	FILE *ps;
	char date_str[32]={0};

	if((ps = popen("date +%Y%m%d-%H%M%S", "r")) == NULL )
	{
		printf("popen() error!\n");
		return 1;
	}

	fgets(date_str, sizeof(date_str),ps);
	printf("%s\n",date_str);

	pclose(ps);

	if((ps = popen("df -h | grep rootfs | awk '{print $5}'", "r")) == NULL )
	{
		printf("popen() error!\n");
		return 1;
	}

	memset(date_str,0,sizeof(date_str));
	fgets(date_str, sizeof(date_str),ps);
	printf("%s\n",date_str);

	pclose(ps);

	return 0;
}

Add date and storage percent functions.

Add date and storage percent functions.


//
//  DKNightVersion.h
//  DKNightVerision
//
//  Created by Draveness on 4/14/15.
//  Copyright (c) 2015 Draveness. All rights reserved.
//

//! Project version string for MyFramework.
FOUNDATION_EXPORT const unsigned char DKNightVersionVersionString[];
//! Project version number for MyFramework.
FOUNDATION_EXPORT double DKNightVersionVersionNumber;

#ifndef _DKNIGHTVERSION_
#define _DKNIGHTVERSION_

#import <Core/DKColor.h>
#import <Core/DKImage.h>
#import <Core/DKNightVersionManager.h>
#import <Core/NSObject+Night.h>

#import <ColorTable/DKColorTable.h>

#import <UIKit/UIKit+Night.h>
#import <CoreAnimation/CoreAnimation+Night.h>

#endif /* _DKNIGHTVERSION_ */

//
//  DKNightVersion.h
//  DKNightVerision
//
//  Created by Draveness on 4/14/15.
//  Copyright (c) 2015 Draveness. All rights reserved.
//

//! Project version string for MyFramework.
FOUNDATION_EXPORT const unsigned char DKNightVersionVersionString[];
//! Project version number for MyFramework.
FOUNDATION_EXPORT double DKNightVersionVersionNumber;

#ifndef _DKNIGHTVERSION_
#define _DKNIGHTVERSION_

#import "Core/DKColor.h"
#import "Core/DKImage.h"
#import "Core/DKNightVersionManager.h"
#import "Core/NSObject+Night.h"

#import "ColorTable/DKColorTable.h"

#import "UIKit/UIKit+Night.h"
#import "CoreAnimation/CoreAnimation+Night.h"

#endif /* _DKNIGHTVERSION_ */

Use " instead of angle bracket

Use " instead of angle bracket


/*************************************************************************
 * Copyright (C) 1995-2017, Rene Brun and Fons Rademakers.               *
 * All rights reserved.                                                  *
 *                                                                       *
 * For the licensing terms see $ROOTSYS/LICENSE.                         *
 * For the list of contributors see $ROOTSYS/README/CREDITS.             *
 *************************************************************************/

#ifdef __CINT__

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

#pragma link C++ class ROOT::Experimental::TWebWindow;
#pragma link C++ class ROOT::Experimental::TWebWindowsManager;

#endif

/*************************************************************************
 * Copyright (C) 1995-2017, Rene Brun and Fons Rademakers.               *
 * All rights reserved.                                                  *
 *                                                                       *
 * For the licensing terms see $ROOTSYS/LICENSE.                         *
 * For the list of contributors see $ROOTSYS/README/CREDITS.             *
 *************************************************************************/

#ifdef __CINT__

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

#pragma link C++ class ROOT::Experimental::TWebWindow+;
#pragma link C++ class ROOT::Experimental::TWebWindowsManager+;

#endif

Add +: use the proper streamer.

Add +: use the proper streamer.


// RUN: %llvmgcc -S -march=armv7a %s

// XFAIL: *
// XTARGET: arm

typedef struct __simd128_uint16_t
{
  __neon_uint16x8_t val;
} uint16x8_t;

void b(uint16x8_t sat, uint16x8_t luma)
{
  __asm__("vmov.16 %1, %0   \n\t"
                                           "vtrn.16 %0, %1   \n\t"
   :"=w"(luma), "=w"(sat)
   :"0"(luma)
   );

}

Add a testcase, enabled only on arm, for llvm-gcc r132366.

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


//
//  main.c
//  converter - Command-line number converter to Mac OS
//
//  Created by Paulo Ricardo Paz Vital on 23/05/15.
//  Copyright (c) 2015 pvital Solutions. All rights reserved.
//

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

void usage(void) {
    printf("usage: convert decimal_number \n");
}

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

    if (argc < 2 || argc > 3) {
        usage();
        return -1;
    }

    decimal = atoi(argv[1]);

    if (decimal < 0) {
        printf("ERROR: decimal number must be greater than zero (0).\n");
        return -1;
    }
    if (decimal > INT_MAX) {
        printf("ERROR: maximum decimal number supported is %d.\n", INT_MAX);
        return -1;
    }

    return 0;
}

//
//  main.c
//  converter - Command-line number converter to Mac OS
//
//  Created by Paulo Ricardo Paz Vital on 23/05/15.
//  Copyright (c) 2015 pvital Solutions. All rights reserved.
//

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

void usage(void) {
    printf("usage: convert decimal_number \n");
}

void dec2bin(int decimal) {
    int remainder[32];
    int quocient = decimal, i = 0;

    while (quocient >= 2) {
        remainder[i] = quocient % 2;
        quocient = quocient / 2;
        i++;
    }

    // add the last quocient in the end of remainder list
    remainder[i] = quocient;

    // print the remainder list in the revert order
    printf ("The decimal number %d in binary is: ", decimal);
    while (i >= 0) {
        printf("%d", remainder[i]);
        i--;
    }
    printf("\n");
}

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

    if (argc < 2 || argc > 3) {
        usage();
        return -1;
    }

    decimal = atoi(argv[1]);

    if (decimal < 0) {
        printf("ERROR: decimal number must be greater than zero (0).\n");
        return -1;
    }
    if (decimal > INT_MAX) {
        printf("ERROR: maximum decimal number supported is %d.\n", INT_MAX);
        return -1;
    }

    dec2bin(decimal);
    return 0;
}

Add decimal to binary conversion.

Add decimal to binary conversion.

Add function to convert decimal to binary.

Signed-off-by: Paulo Vital <56235ab4620bb40c4cfee535b2e93f80c23e9ac8@gmail.com>


#ifndef _MAIN_H_
#define _MAIN_H_

#define PROGRAM_MAJOR_VERSION 0
#define PROGRAM_MINOR_VERSION 0
#define PROGRAM_PATCH_VERSION 6

#endif /* _MAIN_H_ */

#ifndef _MAIN_H_
#define _MAIN_H_

#define PROGRAM_MAJOR_VERSION 0
#define PROGRAM_MINOR_VERSION 1
#define PROGRAM_PATCH_VERSION 0

#endif /* _MAIN_H_ */

Increase game version to 0.1.0.

Increase game version to 0.1.0.


task usercontrol(){
	int DY, DT;
	bool armsLocked = false;

	while(true){
		//Driving
		DY = threshold(PAIRED_CH2, 15) + (PAIRED_BTN8U * MAX_POWER) - (PAIRED_BTN8D * MAX_POWER);
		DT = threshold(PAIRED_CH1, 15) + (PAIRED_BTN8R * MAX_POWER) - (PAIRED_BTN8L * MAX_POWER);
		drive(DY, DT);

		//Pistons (toggle)
		if(PAIRED_BTN7R){
			pistons(!PISTON_POS);
			waitUntil(!PAIRED_BTN7R);
		}

		//Arms
		if(PAIRED_BTN7L){
			armsLocked = !armsLocked;
			waitUntil(!PAIRED_BTN7L);
		}
		if(armsLocked){
			arms(ARM_LOCK);
		} else {
			arms(threshold(PAIRED_CH3, 15) + ((PAIRED_BTN5U - PAIRED_BTN5D) * MAX_POWER));
		}

		//Lift
		lift((PAIRED_BTN7U - PAIRED_BTN7D) * MAX_POWER);

		//Intake
		intake((PAIRED_BTN6U - PAIRED_BTN6D) * MAX_POWER);
	}
}

task usercontrol(){
	int DY, DT;
	bool armsLocked = false;

	while(true){
		//Driving
		DY = threshold(PAIRED_CH2, 15) + (PAIRED_BTN8U * MAX_POWER) - (PAIRED_BTN8D * MAX_POWER);
		DT = threshold(PAIRED_CH1, 15) + (PAIRED_BTN8R * MAX_POWER) - (PAIRED_BTN8L * MAX_POWER);
		drive(DY, DT);

		//Pistons (toggle)
		if(PAIRED_BTN7R){
			pistons(!PISTON_POS);
			waitUntil(!PAIRED_BTN7R);
		}

		//Arms
		if(PAIRED_BTN7L){
			armsLocked = !armsLocked;
			waitUntil(!PAIRED_BTN7L);
		}
		if(armsLocked){
			arms(ARM_LOCK);
		} else {
			arms(threshold(PAIRED_CH3, 15) + ((PAIRED_BTN6U - PAIRED_BTN6D) * MAX_POWER));
		}

		//Lift
		lift((PAIRED_BTN7U - PAIRED_BTN7D) * MAX_POWER);

		//Intake
		intake((PAIRED_BTN5U - PAIRED_BTN5D) * MAX_POWER);
	}
}

Swap back the arm and intake buttons

Swap back the arm and intake buttons

Erik didn't like the change since he was very used to the old
layout. It made sense at the time to put the arm joystick and
buttons on the same side, but I guess not.


#pragma once

// std headers
#include <string>
#include <vector>
#include <set>
#include <functional>

// windows header
#ifdef _WIN32
#define NOMINMAX
#include <windows.h>
#endif

// common ogre headers
#include "OgrePrerequisites.h"
#include "OgreString.h"
#include "OgreRoot.h"
#include "OgreRenderWindow.h"
#include "OgreCamera.h"
#include "OgreItem.h"

#include "OgreHlmsManager.h"
#include "OgreHlmsTextureManager.h"

// common qt headers
#include <QString>
#include <QWidget>
#include <QDebug>

#include "scopeguard.h"

#pragma once

// std headers
#include <string>
#include <vector>
#include <functional>

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

// common ogre headers
#include "OgrePrerequisites.h"
#include "OgreString.h"
#include "OgreRoot.h"
#include "OgreRenderWindow.h"
#include "OgreCamera.h"
#include "OgreItem.h"

#include "OgreHlmsManager.h"
#include "OgreHlmsTextureManager.h"

// common qt headers
#include <QString>
#include <QWidget>
#include <QDebug>

#include "scopeguard.h"

Define WIN32_LEAN_AND_MEAN to reduce the pre-compiled header size


/*
 * main.c
 *
 * Created: 4/3/2014 8:36:43 AM
 *  Author: razius
 */

#include <avr/io.h>
#include <avr/interrupt.h>

int main(void){
    // Clear Timer on Compare Match (CTC) Mode with OCRnA as top.
    TCCR4B |= _BV(WGM42);

    // Toggle OCnA on compare match
    TCCR4A |= _BV(COM4A0);

    // clk / (2 * prescaler * (1 + OCRnA))
    OCR4AH = 0x7A;
    OCR4AL = 0x12;

    // Setup Timer 0 pre-scaler to clk/256
    TCCR4B |= _BV(CS42);

    // Setup PH3 to output
    DDRH |= _BV(DDH3);

    // Enable MCU interrupt (set I-flag)
    sei();

    while (1) {
    }

    return 0;
}

/*
 * main.c
 *
 * Created: 4/3/2014 8:36:43 AM
 *  Author: razius
 */

#include <avr/io.h>
#include <avr/interrupt.h>

uint8_t SECONDS = 0x00;

int main(void){
    // Clear Timer on Compare Match (CTC) Mode with OCRnA as top.
    TCCR1A |= _BV(WGM12);

    // clk / (2 * prescaler * (1 + OCRnA))
    OCR1AH = 0x7A;
    OCR1AL = 0x12;

    // Setup Timer 0 pre-scaler to clk/256
    TCCR1B |= _BV(CS12);

    // Enable Timer/Counter4 overflow interrupt.
    TIMSK1 = _BV(TOIE1);

    // Setup PH3 to output
    DDRH = 0xFF;

    // Enable MCU interrupt (set I-flag)
    sei();

    while (1) {
        PORTH = ~SECONDS;
    }

    return 0;
}

ISR(TIMER1_OVF_vect){
    // Setup PH3 to output
    // DDRH |= _BV(DDH3);
    // PORTH = PORTH << 1;
    if (SECONDS < 60) {
        SECONDS++;
    }
    else {
        SECONDS = 0x00;
    }
}

Increment seconds and show them using LED's.


/*
 * main.c - where it all begins
 */

#include <std.h>
#include <io.h>
#include <vt100.h>
#include <clock.h>

void function( ) {
    kprintf_string( "Interrupt!\n" );
    vt_flush();
    __asm__ ( "movs pc, lr" );
}

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

    UNUSED(argc);
    UNUSED(argv);

    uart_init();
    vt_blank();
    vt_hide();

    debug_message("Welcome to ferOS v%u", __BUILD__);
    debug_message("Built %s %s", __DATE__, __TIME__);

    // tell the CPU where to handle software interrupts
    //    void** irq_handler = (void**)0x28;
    //    *irq_handler = (void*)function;

    /*
      int i;
      for( i = 8; i < 255; i += 4 ) {
      irq_handler[i/4] = (void*)function;
      }
    */

    //    __asm__ ("swi 1");
    //    kprintf_string( "RETURNED" );
    //    vt_flush();

    bool done = false;
    while (1) {
    	vt_read();
    	vt_write();

	if (!done) {
	    kprintf_cpsr();
	    done = true;
	}
    }

    vt_blank();
    vt_flush();

    return 0;
}

/*
 * main.c - where it all begins
 */

#include <std.h>
#include <io.h>
#include <vt100.h>
#include <clock.h>

void function( ) {
    kprintf_string( "Interrupt!\n" );
    vt_flush();
    __asm__ ( "movs pc, lr" );
}

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

    UNUSED(argc);
    UNUSED(argv);

    uart_init();
    vt_blank();
    vt_hide();

    debug_message("Welcome to ferOS build %u", __BUILD__);
    debug_message("Built %s %s", __DATE__, __TIME__);

    // tell the CPU where to handle software interrupts
    //    void** irq_handler = (void**)0x28;
    //    *irq_handler = (void*)function;

    /*
      int i;
      for( i = 8; i < 255; i += 4 ) {
      irq_handler[i/4] = (void*)function;
      }
    */

    //    __asm__ ("swi 1");
    //    kprintf_string( "RETURNED" );
    //    vt_flush();

    bool done = false;
    while (1) {
    	vt_read();
    	vt_write();

	if (!done) {
	    kprintf_cpsr();
	    done = true;
	}
    }

    vt_blank();
    vt_flush();

    return 0;
}

Use build number instead of version number in startup message


/*
 * Copyright 2014, NICTA
 *
 * This software may be distributed and modified according to the terms of
 * the BSD 2-Clause license. Note that NO WARRANTY is provided.
 * See "LICENSE_BSD2.txt" for details.
 *
 * @TAG(NICTA_BSD)
 */

#define STDOUT_FD     1
#define STDERR_FD     2
#define FIRST_USER_FD 3

#define FILE_TYPE_CPIO    0
#define FILE_TYPE_SOCKET  1

#define FD_TABLE_SIZE(x) (sizeof(muslcsys_fd_t) * (x))
/* this implementation does not allow users to close STDOUT or STDERR, so they can't be freed */
#define FREE_FD_TABLE_SIZE(x) (sizeof(int) * ((x) - FIRST_USER_FD))

#define PAGE_SIZE_4K 4096
typedef struct muslcsys_fd {
    int filetype;
    void *data;
} muslcsys_fd_t;

int allocate_fd(void);

muslcsys_fd_t *get_fd_struct(int fd);

/*
 * Copyright 2014, NICTA
 *
 * This software may be distributed and modified according to the terms of
 * the BSD 2-Clause license. Note that NO WARRANTY is provided.
 * See "LICENSE_BSD2.txt" for details.
 *
 * @TAG(NICTA_BSD)
 */

#ifndef __LIBSEL4MUSLCCAMKES_H__
#define __LIBSEL4MUSLCCAMKES_H__

#include <utils/page.h>

#define STDOUT_FD     1
#define STDERR_FD     2
#define FIRST_USER_FD 3

#define FILE_TYPE_CPIO    0
#define FILE_TYPE_SOCKET  1

#define FD_TABLE_SIZE(x) (sizeof(muslcsys_fd_t) * (x))
/* this implementation does not allow users to close STDOUT or STDERR, so they can't be freed */
#define FREE_FD_TABLE_SIZE(x) (sizeof(int) * ((x) - FIRST_USER_FD))

typedef struct muslcsys_fd {
    int filetype;
    void *data;
} muslcsys_fd_t;

int allocate_fd(void);

muslcsys_fd_t *get_fd_struct(int fd);

#endif

Add include guard and retrieve PAGE_SIZE_4K definition from libutils


/*
 *	Copyright 2019 Andrey Terekhov, Victor Y. Fadeev
 *
 *	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.
 */

#ifdef _MSC_VER
	#pragma comment(linker, "/STACK:268435456")
#endif

#include "compiler.h"
#include "workspace.h"

const char *name = "../tests/executable/structures/SELECT_9459.c";
// "../tests/mips/0test.c";

int main(int argc, const char *argv[])
{
	workspace ws = ws_parse_args(argc, argv);

	if (argc < 2)
	{
		ws_add_file(&ws, name);
		ws_set_output(&ws, "export.txt");
	}

#ifdef TESTING_EXIT_CODE
	return compile(&ws) ? TESTING_EXIT_CODE : 0;
#else
	return compile(&ws);
#endif
}

/*
 *	Copyright 2019 Andrey Terekhov, Victor Y. Fadeev
 *
 *	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.
 */

#ifdef _MSC_VER
	#pragma comment(linker, "/STACK:268435456")
#endif

#include "compiler.h"
#include "workspace.h"

const char *name = "../tests/executable/structures/SELECT_9459.c";
// "../tests/mips/0test.c";

int main(int argc, const char *argv[])
{
	workspace ws = ws_parse_args(argc, argv);

	if (argc < 2)
	{
		ws_add_file(&ws, name);
		ws_add_flag(&ws, "-Wno");
		ws_set_output(&ws, "export.txt");
	}

#ifdef TESTING_EXIT_CODE
	return compile(&ws) ? TESTING_EXIT_CODE : 0;
#else
	return compile(&ws);
#endif
}

Add default flag for Xcode usage

Add default flag for Xcode usage


#ifndef EXTTEXTCAT_VERSION_H
#define EXTTEXTCAT_VERSION_H

#define EXTTEXTCAT_VERSION "3.1.0"
#define EXTTEXTCAT_VERSION_MAJOR 3
#define EXTTEXTCAT_VERSION_MINOR 1
#define EXTTEXTCAT_VERSION_MICRO 0

#endif

Revert "Don't put under source control generated file"

This reverts commit 482955edc082c5aac04176194150c0fa5ff1d247.


#ifndef UWATEC_H
#define UWATEC_H

#include "device.h"

#define UWATEC_SUCCESS         0
#define UWATEC_ERROR          -1
#define UWATEC_ERROR_IO       -2
#define UWATEC_ERROR_MEMORY   -3
#define UWATEC_ERROR_PROTOCOL -4
#define UWATEC_ERROR_TIMEOUT  -5

#include "uwatec_aladin.h"
#include "uwatec_memomouse.h"
#include "uwatec_smart.h"

#endif /* UWATEC_H */

#ifndef UWATEC_H
#define UWATEC_H

#include "uwatec_aladin.h"
#include "uwatec_memomouse.h"
#include "uwatec_smart.h"

#endif /* UWATEC_H */

Remove all remaining pieces of the legacy api from the Uwatec code.


#ifndef AL_EVTQUEUE_H
#define AL_EVTQUEUE_H

#include "AL/al.h"

typedef struct MidiEvent {
    ALuint time;
    ALuint event;
    ALuint param[2];
} MidiEvent;

typedef struct EvtQueue {
    MidiEvent *events;
    ALsizei pos;
    ALsizei size;
    ALsizei maxsize;
} EvtQueue;

void InitEvtQueue(EvtQueue *queue);
void ResetEvtQueue(EvtQueue *queue);
ALenum InsertEvtQueue(EvtQueue *queue, const MidiEvent *evt);

#endif /* AL_EXTQUEUE_H */

#ifndef AL_EVTQUEUE_H
#define AL_EVTQUEUE_H

#include "AL/al.h"

#include "alMain.h"

typedef struct MidiEvent {
    ALuint64 time;
    ALuint event;
    ALuint param[2];
} MidiEvent;

typedef struct EvtQueue {
    MidiEvent *events;
    ALsizei pos;
    ALsizei size;
    ALsizei maxsize;
} EvtQueue;

void InitEvtQueue(EvtQueue *queue);
void ResetEvtQueue(EvtQueue *queue);
ALenum InsertEvtQueue(EvtQueue *queue, const MidiEvent *evt);

#endif /* AL_EVTQUEUE_H */

Use a 64-bit uint for MIDI event times

Use a 64-bit uint for MIDI event times


#ifndef SCOPE_DEF
#define SCOPE_DEF

#include "hashmap.h"

#include <stdint.h>

typedef struct Scope
{
	V file;
	V func;
	V parent;
	int index;
	bool is_func_scope;
	bool is_error_handler;
	uint32_t linenr;
	uint32_t* pc;
	struct HashMap hm;
} Scope;

typedef struct
{
	Value v;
	Scope sc;
} ValueScope;

#define MAXCACHE 1024
ValueScope SCOPECACHE[MAXCACHE];
int MAXSCOPE;

V new_scope(V);
V new_function_scope(V);
V new_file_scope(V);
V new_global_scope(void);

#endif

#ifndef SCOPE_DEF
#define SCOPE_DEF

#include "hashmap.h"

#include <stdint.h>

typedef struct Scope
{
	V file;
	V func;
	V parent;
	int index;
	uint32_t is_func_scope : 4;
	uint32_t is_error_handler : 4;
	uint32_t linenr : 24;
	uint32_t* pc;
	struct HashMap hm;
} Scope;

typedef struct
{
	Value v;
	Scope sc;
} ValueScope;

#define MAXCACHE 1024
ValueScope SCOPECACHE[MAXCACHE];
int MAXSCOPE;

V new_scope(V);
V new_function_scope(V);
V new_file_scope(V);
V new_global_scope(void);

#endif

Make Scope 8 bytes smaller

Make Scope 8 bytes smaller


#include <stdio.h>

static char input[2048]; //declaring buffer for user input, size 2048

int main(int argc, char** argv) {
	puts("zuzeelik Version 0.0.0-0.0.1");
	puts("Press Ctrl+c to Exit \n");

	/* Starting REPL */

	while(1){
		/* output from the prompt*/
		fputs("zuzeelik> ", stdout);

		/* read a line of the user of max size 2048 */
		fgets(input, 2048, stdin);

		/* Echo the input back to the user */
		printf("Got Input: %s", input);
	}

	return 0;
}

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

#include <editline/readline.h>
#include <editline/history.h>

int main(int argc, char** argv) {
	puts("zuzeelik [version: v0.0.0-0.0.2]");
	puts("Press Ctrl+C to Exit \n");

	/* Starting REPL */

	while(1){
		/* output from the prompt*/
		char* input = readline("zuzeelik> ");

		/*Add input to history */
		add_history(input);

		/* Echo the input back to the user */
		printf("Got Input: %s \n", input);

		free(input);
	}

	return 0;
}

Add support for line editing and arrow keys

Added support for line editing in REPL and also added support for
arrow keys.


// This file is part of MorphoDiTa.
//
// Copyright 2013 by Institute of Formal and Applied Linguistics, Faculty of
// Mathematics and Physics, Charles University in Prague, Czech Republic.
//
// MorphoDiTa 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 3 of
// the License, or (at your option) any later version.
//
// MorphoDiTa 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 MorphoDiTa.  If not, see <http://www.gnu.org/licenses/>.

#pragma once

#include <cstring>

#include "common.h"

namespace ufal {
namespace morphodita {

struct string_piece {
  const char* str;
  size_t len;

  string_piece() : str(nullptr), len(0) {}
  string_piece(const char* str) : str(str), len(strlen(str)) {}
  string_piece(const char* str, size_t len) : str(str), len(len) {}
  string_piece(const std::string& str) : str(str.c_str()), len(str.size()) {}
};

} // namespace morphodita
} // namespace ufal

Add forgotten comment on namespace closing.


#ifndef MUE__TEAM_CONTAINER
#define MUE__TEAM_CONTAINER

#include <array>
#include <vector>

#include <string.h>

#include <boost/assert.hpp>

#include "config.h"

namespace mue {

template <typename T, std::size_t NUM>
class Limited_array
{
	private:
		using _Value_type = T;
		using _Array = std::array<_Value_type, NUM>;

		std::size_t _len;
		_Array _array;

	public:
		Limited_array() : _len(0) { }

		Limited_array(std::size_t len) : _len(len) { BOOST_ASSERT( _len <= NUM); }

		Limited_array(Limited_array<_Value_type, NUM> const &other)
		:
			_len(other._len),
			_array(other._array)
		{ }

		Limited_array(std::initializer_list<_Value_type> const &values)
		:
			_len(values.size())
		{
			std::size_t idx(0);
			for (const _Value_type& value : values)
				_array[idx++] = value;
		}

		Limited_array(std::vector<_Value_type> const &other)
		:
			_len(other.size())
		{
			BOOST_ASSERT( _len <= NUM );
			memcpy(_array.data(), other.data(), sizeof(_Value_type) * _len);
		}

		std::size_t size() const noexcept { return _len; }

		typedef typename _Array::iterator iterator;
		typedef typename _Array::const_iterator const_iterator;
		typedef typename _Array::value_type value_type;

		const_iterator begin() const noexcept { return _array.begin(); }
		iterator begin() noexcept { return _array.begin(); }

		const_iterator end() const noexcept { return _array.begin() + _len; }
		iterator end() noexcept { return _array.begin() + _len; }

		const value_type& operator[](std::size_t elem) const noexcept
		{
			BOOST_ASSERT( elem < _len );
			return _array[elem];
		}
		value_type& operator[](std::size_t elem) noexcept
		{
			BOOST_ASSERT( elem < _len );
			return _array[elem];
		}
};

typedef Limited_array<Team_id, MAX_TEAMS / 3>       Hosts;
typedef Limited_array<Team_id, (MAX_TEAMS / 3) * 2> Guests;
typedef Limited_array<Team_id, MAX_TEAMS>           Teams;

}

#endif

Add a simple wrapper around std::array

Add a simple wrapper around std::array

This is a simple container backed by a std::array that can be limited
in it length. It should be faster that std::vector because it has no
need for dynamic memory management.

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


// RUN: clang %s -verify -fsyntax-only

int test1() {
  typedef int x[test1()];  // vla
  static int y = sizeof(x);  // expected-error {{not constant}}
}

// PR2347
void f (unsigned int m)
{
  extern int e[2][m];

  e[0][0] = 0;
}

// RUN: clang %s -verify -fsyntax-only

int test1() {
  typedef int x[test1()];  // vla
  static int y = sizeof(x);  // expected-error {{not constant}}
}

// PR2347
void f (unsigned int m)
{
  int e[2][m];

  e[0][0] = 0;
}

Fix this test so that it's valid; the point is to test for the crash,
not the missing diagnostic.

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