#include "leafnode.h"
#include "ln_log.h"

#include <signal.h>
#include <setjmp.h>
#include <unistd.h>

static jmp_buf to;
static void
timer(int sig)
{
    (void)sig;
    longjmp(to, 1);
}

/*
 * call getaline with timeout
 */
char *
timeout_getaline(FILE * f, int timeout)
{
    char *l;

    if (setjmp(to)) {
	ln_log(LNLOG_SERR, LNLOG_CTOP, "timeout reading.");
	return NULL;
    }
    (void)signal(SIGALRM, timer);
    (void)alarm(timeout);
    l = getaline(f);
    (void)alarm(0U);
    return l;
}

char *
mgetaline(FILE * f)
{
    return timeout_getaline(f, 120);
}

#include "leafnode.h"
#include "ln_log.h"

#include <signal.h>
#include <setjmp.h>
#include <unistd.h>

static jmp_buf to;
static void
timer(int sig)
{
    (void)sig;
    longjmp(to, 1);
}

/*
 * call getaline with timeout
 */
char *
timeout_getaline(FILE * f, int timeout)
{
    char *l;

    if (setjmp(to)) {
	ln_log(LNLOG_SERR, LNLOG_CTOP, "timeout reading.");
	return NULL;
    }
    (void)signal(SIGALRM, timer);
    (void)alarm(timeout);
    l = getaline(f);
    (void)alarm(0U);
    return l;
}

char *
mgetaline(FILE * f)
{
    return timeout_getaline(f, 300);
}

Change timeout from 2 to 5 minutes, Jörg Dietrich had suggested to Change timeout from 2 to 5 minutes, Jörg Dietrich had suggested to increase it to 3 minutes, to correspond with current NNTP drafts.


// RUN: %clang -arch armv7 -target thumbv7-apple-darwin-eabi -### -c %s 2>&1 | FileCheck %s --check-prefix=CHECK-AAPCS
// RUN: %clang -arch armv7 -### -c %s 2>&1 | FileCheck %s --check-prefix=CHECK-APCS
// RUN: %clang -arch armv7s -### -c %s 2>&1 | FileCheck %s --check-prefix=CHECK-APCS
// RUN: %clang -arch armv7s -target thumbv7-apple-darwin -### -c %s 2>&1 | FileCheck %s --check-prefix=CHECK-APCS

// CHECK-AAPCS: "-target-abi" "aapcs"
// CHECK-APCS: "-target-abi" "apcs-gnu"

// RUN: %clang -arch armv7 -target thumbv7-apple-darwin-eabi -### -c %s 2>&1 | FileCheck %s --check-prefix=CHECK-AAPCS
// RUN: %clang -arch armv7s -target thumbv7-apple-ios -### -c %s 2>&1 | FileCheck %s --check-prefix=CHECK-APCS
// RUN: %clang -arch armv7s -target thumbv7-apple-darwin -### -c %s 2>&1 | FileCheck %s --check-prefix=CHECK-APCS

// CHECK-AAPCS: "-target-abi" "aapcs"
// CHECK-APCS: "-target-abi" "apcs-gnu"

Fix test to work on Linux hosts by specifying triple.

Thought I'd checked that before

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


// Test to ensure -fdebug-pass-manager works when invoking the
// ThinLTO backend path with the new PM.
// RUN: %clang -O2 %s -flto=thin -c -o %t.o
// RUN: llvm-lto -thinlto -o %t %t.o
// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -emit-obj -O2 -o %t2.o -x ir %t.o -fthinlto-index=%t.thinlto.bc -fdebug-pass-manager -fexperimental-new-pass-manager 2>&1 | FileCheck %s
// CHECK: Running pass:

void foo() {
}

// Test to ensure -fdebug-pass-manager works when invoking the
// ThinLTO backend path with the new PM.
// REQUIRES: x86-registered-target
// RUN: %clang -O2 %s -flto=thin -c -o %t.o
// RUN: llvm-lto -thinlto -o %t %t.o
// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -emit-obj -O2 -o %t2.o -x ir %t.o -fthinlto-index=%t.thinlto.bc -fdebug-pass-manager -fexperimental-new-pass-manager 2>&1 | FileCheck %s
// CHECK: Running pass:

void foo() {
}

Add x86-registered-target to REQUIRES for new test

Should fix test added in r317951.

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


// RUN: %clang -Wunused-parameter -fdiagnostics-show-name %s 2>&1 | grep "\[warn_unused_parameter\]" | count 1
// RUN: %clang -Wunused-parameter -fno-diagnostics-show-name %s 2>&1 | grep "\[warn_unused_parameter\]" | count 0
int main(int argc, char *argv[]) {
  return argc;
}

// RUN: %clang -fsyntax-only -Wunused-parameter -fdiagnostics-show-name %s 2>&1 | grep "\[warn_unused_parameter\]" | count 1
// RUN: %clang -fsyntax-only -Wunused-parameter -fno-diagnostics-show-name %s 2>&1 | grep "\[warn_unused_parameter\]" | count 0
int main(int argc, char *argv[]) {
  return argc;
}

Stop leaving a.out files around.

Stop leaving a.out files around.

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


#ifndef HMLIB_CONFIGVC_INC
#define HMLIB_CONFIGVC_INC 101
#
/*===config_vc===
VisualStudio C/C++の設定用マクロ

config_vc_v1_01/121204 hmIto
	拡張子をhppからhに変更
	インクルードガードマクロの不要なアンダーバーを消去
*/
#ifdef _MSC_VER
#	//windows.hのmin,maxを使わせない
#	ifndef NOMINMAX
#		define NOMINMAX
#	endif
#	//古いunsafeな関数群使用による警告回避
#	define _CRT_SECURE_NO_WARNINGS
#	define _AFX_SECURE_NO_WARNINGS
#	define _ATL_SECURE_NO_WARNINGS
#	define _SCL_SECURE_NO_WARNINGS
#endif
#
#endif

#ifndef HMLIB_CONFIGVC_INC
#define HMLIB_CONFIGVC_INC 101
#
/*===config_vc===
VisualStudio C/C++の設定用マクロ

config_vc_v1_01/121204 hmIto
	拡張子をhppからhに変更
	インクルードガードマクロの不要なアンダーバーを消去
*/
#ifdef _MSC_VER
#	//windows.hのmin,maxを使わせない
#	ifndef NOMINMAX
#		define NOMINMAX
#	endif
#	//古いunsafeな関数群使用による警告回避
#	define _CRT_SECURE_NO_WARNINGS
#	define _AFX_SECURE_NO_WARNINGS
#	define _ATL_SECURE_NO_WARNINGS
#	define _SCL_SECURE_NO_WARNINGS
#	define _SILENCE_CXX17_ITERATOR_BASE_CLASS_DEPRECATION_WARNING
#	define _SILENCE_ALL_CXX17_DEPRECATION_WARNINGS

#endif
#
#endif

Add C++17 depricated error ignore tag.

Add C++17 depricated error ignore tag.


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

#ifndef GrTBackendEffectFactory_DEFINED
#define GrTBackendEffectFactory_DEFINED

#include "GrBackendEffectFactory.h"
#include "GrEffectStage.h"

/**
 * Implements GrBackendEffectFactory for a GrEffect subclass as a singleton.
 */
template <typename EffectClass>
class GrTBackendEffectFactory : public GrBackendEffectFactory {

public:
    typedef typename EffectClass::GLEffect GLEffect;

    /** Returns a human-readable name that is accessible via GrEffect or
        GrGLEffect and is consistent between the two of them.
     */
    virtual const char* name() const SK_OVERRIDE { return EffectClass::Name(); }

    /** Returns a value that identifies the GLSL shader code generated by
        a GrEffect. This enables caching of generated shaders. Part of the
        id identifies the GrEffect subclass. The remainder is based
        on the aspects of the GrEffect object's configuration that affect
        GLSL code generation. */
    virtual EffectKey glEffectKey(const GrEffectStage& stage,
                                  const GrGLCaps& caps) const SK_OVERRIDE {
        GrAssert(kIllegalEffectClassID != fEffectClassID);
        EffectKey effectKey = GLEffect::GenKey(stage, caps);
        EffectKey textureKey = GLEffect::GenTextureKey(*stage.getEffect(), caps);
#if GR_DEBUG
        static const EffectKey kIllegalIDMask = (uint16_t) (~((1U << kEffectKeyBits) - 1));
        GrAssert(!(kIllegalIDMask & effectKey));

        static const EffectKey kIllegalTextureKeyMask = (uint16_t) (~((1U << kTextureKeyBits) - 1));
        GrAssert(!(kIllegalTextureKeyMask & textureKey));
#endif
        return fEffectClassID | (textureKey << kEffectKeyBits) | effectKey;
    }

    /** Returns a new instance of the appropriate *GL* implementation class
        for the given GrEffect; caller is responsible for deleting
        the object. */
    virtual GLEffect* createGLInstance(const GrEffect& effect) const SK_OVERRIDE {
        return SkNEW_ARGS(GLEffect, (*this, effect));
    }

    /** This class is a singleton. This function returns the single instance.
     */
    static const GrBackendEffectFactory& getInstance() {
        static SkAlignedSTStorage<1, GrTBackendEffectFactory> gInstanceMem;
        static const GrTBackendEffectFactory* gInstance;
        if (!gInstance) {
            gInstance = SkNEW_PLACEMENT(gInstanceMem.get(),
                                        GrTBackendEffectFactory);
        }
        return *gInstance;
    }

protected:
    GrTBackendEffectFactory() {
        fEffectClassID = GenID() << (kEffectKeyBits + kTextureKeyBits) ;
    }
};

#endif

Add file accidentally omitted from r6182.

git-svn-id: fe2049e5d81cf1423cb2a2a3211c731fbdf7e559@6186 2bbb7eff-a529-9590-31e7-b0007b416f81


#ifndef BASE_CLASS_H_
#define BASE_CLASS_H_

class BaseAutoFunction {
  public:
    bool Init(CitrusRobot *robot, std::vector<void *>);
    bool Periodic(CitrusRobot *robot, std::vector<void *>);
  private:
    //none
};

#endif

#ifndef BASE_CLASS_H_
#define BASE_CLASS_H_

class CitrusRobot;

class BaseAutoFunction {
  public:
    bool Init(CitrusRobot *robot, std::vector<void *>);
    bool Periodic(CitrusRobot *robot, std::vector<void *>);
  private:
    //none
};

#endif

Fix compilation issue in tests by forward-declaring CitrusRobot


// -*- c++ -*-

#ifndef QT_CAM_IMAGE_MODE_H
#define QT_CAM_IMAGE_MODE_H

#include "qtcammode.h"
#include <gst/pbutils/encoding-profile.h>

class QtCamDevicePrivate;
class QtCamImageModePrivate;
class QtCamImageSettings;

class QtCamImageMode : public QtCamMode {
  Q_OBJECT

public:
  QtCamImageMode(QtCamDevicePrivate *d, QObject *parent = 0);
  ~QtCamImageMode();

  virtual bool canCapture();
  virtual void applySettings();

  bool capture(const QString& fileName);

  bool setSettings(const QtCamImageSettings& settings);

  void setProfile(GstEncodingProfile *profile);

signals:
  void imageSaved(const QString& fileName);

protected:
  virtual void start();
  virtual void stop();

private:
  QtCamImageModePrivate *d_ptr;
};

#endif /* QT_CAM_IMAGE_MODE_H */

// -*- c++ -*-

#ifndef QT_CAM_IMAGE_MODE_H
#define QT_CAM_IMAGE_MODE_H

#include "qtcammode.h"
#include <gst/pbutils/encoding-profile.h>

class QtCamDevicePrivate;
class QtCamImageModePrivate;
class QtCamImageSettings;

class QtCamImageMode : public QtCamMode {
  Q_OBJECT

public:
  QtCamImageMode(QtCamDevicePrivate *d, QObject *parent = 0);
  ~QtCamImageMode();

  virtual bool canCapture();
  virtual void applySettings();

  bool capture(const QString& fileName);

  bool setSettings(const QtCamImageSettings& settings);

  void setProfile(GstEncodingProfile *profile);

protected:
  virtual void start();
  virtual void stop();

private:
  QtCamImageModePrivate *d_ptr;
};

#endif /* QT_CAM_IMAGE_MODE_H */

Remove imageSaved() signal as it is old code.


// Copyright (c) 2014, Facebook, Inc.  All rights reserved.
// This source code is licensed under the BSD-style license found in the
// LICENSE file in the root directory of this source tree. An additional grant
// of patent rights can be found in the PATENTS file in the same directory.

#pragma once

#include "utilities/pragma_error.h"

// TODO(agiardullo):  need to figure out how to make this portable
// ROCKSDB_WARNING("This file was moved to rocksdb/convenience.h")

#include "rocksdb/convenience.h"

// Copyright (c) 2014, Facebook, Inc.  All rights reserved.
// This source code is licensed under the BSD-style license found in the
// LICENSE file in the root directory of this source tree. An additional grant
// of patent rights can be found in the PATENTS file in the same directory.

#pragma once

// #include "utilities/pragma_error.h"
// TODO(agiardullo):  need to figure out how to make this portable
// ROCKSDB_WARNING("This file was moved to rocksdb/convenience.h")

#include "rocksdb/convenience.h"

Fix mongo build -take 2

Fix mongo build -take 2

Summary: quick fix for now.  will figure out a better fix soon

Test Plan: build

Reviewers: sdong, igor, kradhakrishnan

Subscribers: dhruba, leveldb

Differential Revision: https://reviews.facebook.net/D42381


// RUN: %llvmgcc -c -emit-llvm 2004-11-27-StaticFunctionRedeclare.c -o - | \
// RUN:   opt -std-compile-opts | llvm-dis | not grep {declare int.*func}

// There should not be an unresolved reference to func here.  Believe it or not,
// the "expected result" is a function named 'func' which is internal and
// referenced by bar().

// This is PR244

static int func();
void bar() {
  int func();
  foo(func);
}
static int func(char** A, char ** B) {}

// RUN: %llvmgcc -c -emit-llvm %s -o - | \
// RUN:   opt -std-compile-opts | llvm-dis | not grep {declare int.*func}

// There should not be an unresolved reference to func here.  Believe it or not,
// the "expected result" is a function named 'func' which is internal and
// referenced by bar().

// This is PR244

static int func();
void bar() {
  int func();
  foo(func);
}
static int func(char** A, char ** B) {}

Use %s, not explicit name.

Use %s, not explicit name.

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


int range0(int a)
{
	return 0 <= a && a < 10;
}

int range1(int a)
{
	return 1 <= a && a < 10;
}

int test_lt_and_lt(int a)
{
	return a < 5 && a < 10;
}

int test_lt_and_eq(int a)
{
	return a < 5 && a == 10;
}

int test_lt_and_gt(int a)
{
	return a < 5 && a > 10;
}

int test_eq_and_lt(int a)
{
	return a == 5 && a < 10;
}

int test_eq_and_eq(int a)
{
	return a == 5 && a == 10;
}

int test_eq_and_gt(int a)
{
	return a == 5 && a > 10;
}

int test_ge_and_lt(int a)
{
	return a >= 5 && a < 6;
}

int test_gt_and_lt(int a)
{
	return a > 5 && a < 6;
}

int test_lt_or_lt(int a)
{
	return a < 5 || a < 10;
}

int test_lt_or_eq(int a)
{
	return a < 5 || a == 5;
}

int test_ne_or_ne(int a)
{
	return a != 5 || a != 10;
}

int main(void)
{
	return 0;
}

Add crude tests for bool simplifications.

[r16494]


#include <stdio.h>
#include "TM4C123GH6PM.h"
#include "lm4f120h5qr.h"
#include "interrupt.h"
#include "larson.h"
#include "led.h"
#include "UART.h"

int main(void){
	UART_Init();	// Initialize UART before outputting...
	printf("%s\n", "Initializing...");

	LED_Init();				// Initialize LEDs on GPIOF
	Larson_Init();			// Initialize Larson scanner on GPIOB.
	GPIOA_Pin_Init();		// Initialize GPIOA Pins and interrupts.
	SysTick_Init();			// Initialize SysTick interrupts.

	// Loop forever.
	while (1) {}
}

#include <stdio.h>
#include "TM4C123GH6PM.h"
#include "lm4f120h5qr.h"
#include "interrupt.h"
#include "larson.h"
#include "led.h"
#include "UART.h"

int main(void){
	UART_Init();	// Initialize UART before outputting...
	printf("%s\n", "Initializing...");

	LED_Init();				// Initialize LEDs on GPIOF
	Larson_Init();			// Initialize Larson scanner on GPIOB.
	GPIOA_Pin_Init();		// Initialize GPIOA Pins and interrupts.
	SysTick_Init();			// Initialize SysTick interrupts.

	// Loop forever.
	while (1) {
		/* AAPCS Demo */
		__asm volatile (
				"    mov r0,#0x11111111\n\t"
				"    mov r1,#0x22222222\n\t"
				"    mov r2,#0x33333333\n\t"
				"    mov r3,#0x44444444\n\t"
		);
	}
}

Add unique and obvious register values for AAPCS demo.


#include "stdio.h"
#include "stdlib.h"

#define TRIALS 4
#define MATRIX_SIZE 2048

short A[MATRIX_SIZE][MATRIX_SIZE],
      B[MATRIX_SIZE][MATRIX_SIZE],
      C[MATRIX_SIZE][MATRIX_SIZE] = {{0}};

int main(int argc, char*  argv[])
{
	// Initalize array A and B with '1's
	for (int i = 0; i < MATRIX_SIZE; ++i)
		for (int k = 0; k < MATRIX_SIZE; ++k)
			A[i][k] = B[i][k] = 1;

	// Iterate through the block sizes
	for (int block_size = 4; block_size <= 256; block_size *= 2)
	{
		// Run TRIALS number of trials for each block size
		for (int trial = 0; trial < TRIALS; ++trial)
		{
			printf("size: %d\n", block_size);
		}
	}

	return 0;
}

#include "stdio.h"
#include "stdlib.h"
#include "sys/time.h"

#define TRIALS 4
#define MATRIX_SIZE 2048

short A[MATRIX_SIZE][MATRIX_SIZE],
      B[MATRIX_SIZE][MATRIX_SIZE],
      C[MATRIX_SIZE][MATRIX_SIZE] = {{0}};

int main(int argc, char*  argv[])
{
	// Initalize array A and B with '1's
	for (int i = 0; i < MATRIX_SIZE; ++i)
		for (int k = 0; k < MATRIX_SIZE; ++k)
			A[i][k] = B[i][k] = 1;

	// Show headings
	for (int trial = 0; trial < TRIALS; ++trial)
		printf(" run%d ,", trial);
	puts(" avrg ");

	// Iterate through the block sizes
	for (int block_size = 4; block_size <= 256; block_size *= 2)
	{
		// Keep track of the times for this block
		time_t block_times[TRIALS];

		// Run TRIALS number of trials for each block size
		for (int trial = 0; trial < TRIALS; ++trial)
		{
			struct timeval time_start;
			gettimeofday(&time_start, NULL);

			// Do work..

			struct timeval time_end;
			gettimeofday(&time_end, NULL);

			// Keep track of the time to do statistics on
			block_times[trial] = time_end.tv_usec - time_start.tv_usec;
			printf("%06d,", (int) block_times[trial]);
		}

		int average = 0;
		for (int i = 0; i < TRIALS; ++i)
			average += (int) block_times[i];

		printf("%06d\n", average / TRIALS);
	}

	return 0;
}

Add timing and formating for times

Add timing and formating for times


/* INCLUDES */
#include <stdio.h>
#include "commands.h"

#define MAX_MSG_LENGTH          200              //For the receiving frame... (circular buffer)

int main(int argc, char *argv[]) {
    char input_buffer[MAX_MSG_LENGTH];
    int  input_argc;
    char *input_argv[CMD_MAX_N_OPTIONS+CMD_MAX_N_OPTIONS_WITH_ARGS];
    int i;
    char command_available = 0;

    if (argc > 1) {
        execute_command(argc-1, &argv[1]);
    } else {
        while (TRUE) {
            // Terminal prompt
            printf("\n> ");

            // Terminal input
            fgets(input_buffer, MAX_MSG_LENGTH-3, stdin);

            // Detect end of the command
            for (i=0; input_buffer[i]; i++) {
                if (input_buffer[i] == '\n' || input_buffer[i] == '\r')
                    input_buffer[i] = 0;
                    command_available = 1;
            }

            if (command_available) {
                // Get the command and the arguments in a list
                input_argc = separate_args(input_buffer, input_argv);

                // Execute the command
                if (input_argc) execute_command(input_argc, input_argv);

                command_available = 0;
            }
        }
    }

    return 0;
}

/* INCLUDES */
#include <stdio.h>
#include "commands.h"

#define MAX_MSG_LENGTH          200              //For the receiving frame... (circular buffer)

int main(int argc, char *argv[]) {
    char input_buffer[MAX_MSG_LENGTH];
    int  input_argc;
    char *input_argv[CMD_MAX_N_OPTIONS+CMD_MAX_N_OPTIONS_WITH_ARGS];
    int i;
    char command_available = 0;

    if (argc > 1) {
        execute_command(argc-1, &argv[1]);
    } else {
        while (TRUE) {
            // Terminal prompt
            printf("\n> ");

            // Terminal input
            fgets(input_buffer, MAX_MSG_LENGTH-3, stdin);

            // Detect end of the command
            for (i=0; input_buffer[i]; i++) {
                if (input_buffer[i] == '\n' || input_buffer[i] == '\r') {}
                    input_buffer[i] = 0;
                    command_available = 1;
                }
            }

            if (command_available) {
                // Get the command and the arguments in a list
                input_argc = separate_args(input_buffer, input_argv);

                // Execute the command
                if (input_argc) execute_command(input_argc, input_argv);

                command_available = 0;
            }
        }
    }

    return 0;
}

Solve a bug with line endings

Solve a bug with line endings


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

/* K&R C (Dennis M. Ritchie & Brian W. Kernighan)
 Exercise 2-4. Write an alternative version of squeeze(s1,s2)
 that deletes each character in s1 that matches any character
 in the string s2.

 */

// O(n) solution
int Squeeze(char* s1, const char* s2) {
    if (!s1 || !s2) {
        errno = EINVAL;
        return EINVAL;
    }

    // dictionary for O(1) char lookup
    int chars[UCHAR_MAX] = { 0 };

    // save chars in s2 to the dictionary
    const char* pchar2 = &s2[0];
    while (*pchar2) {
        chars[(unsigned char)(*pchar2)] = 1;
        ++pchar2;
    }

    char* pchar0 = &s1[0];
    char* pchar1 = &s1[0];
    while (*pchar1) {

        // do not be tempted to move ++pchar1 out of the if-else
        // blocks, if you do, make sure you test pchar1 for zero
        // char and break out on zero char immediately or else
        // you will go past the end of the string corrupting
        // memory as you go

        if (chars[(unsigned char)(*pchar1)]) {
            ++pchar1;
        } else {
            *pchar0 = *pchar1;
            ++pchar0;
            ++pchar1;
        }
    }
    *pchar0 = '\0';

    return 0;
}

int main(void) {

    char s1[] = "C provides six operators for bit manipulation;"
                "these may only be applied to integral operands,"
                "that is, char, short, int, and long, whether signed or unsigned.";
    const char* s2 = "aeiou";

    // remove vowels
    Squeeze(s1, s2);
    printf("%s\n", s1);

    getchar();

    return 0;
}

Remove all chars from s2 in s1 O(n)

Remove all chars from s2 in s1 O(n)


#ifndef SSPAPPLICATION_ENTITIES_DOORENTITY_H
#define SSPAPPLICATION_ENTITIES_DOORENTITY_H

#include "Entity.h"
#include <vector>

class DoorEntity :
	public Entity
{
private:
	/*struct ElementState {
		int entityID;
		EVENT desiredState;
		bool desiredStateReached;
	};

	std::vector<ElementState> m_elementStates;*/

	bool m_isOpened;
	float m_minRotation;
	float m_maxRotation;
	float m_rotateTime;
	float m_rotatePerSec;

public:
	DoorEntity();
	virtual ~DoorEntity();

	int Initialize(int entityID, PhysicsComponent* pComp, GraphicsComponent* gComp, float rotateTime = 1.0f, float minRotation = 0.0f, float maxRotation = DirectX::XM_PI / 2.0f);

	int Update(float dT, InputHandler* inputHandler);
	int React(int entityID, EVENT reactEvent);

	bool SetIsOpened(bool isOpened);
	bool GetIsOpened();
};

#endif

#ifndef SSPAPPLICATION_ENTITIES_DOORENTITY_H
#define SSPAPPLICATION_ENTITIES_DOORENTITY_H

#include "Entity.h"
#include <vector>

class DoorEntity :
	public Entity
{
private:
	struct ElementState {
		int entityID;
		EVENT desiredState;
		bool desiredStateReached;
	};

	std::vector<ElementState> m_elementStates;

	bool m_isOpened;
	float m_minRotation;
	float m_maxRotation;
	float m_rotateTime;
	float m_rotatePerSec;

public:
	DoorEntity();
	virtual ~DoorEntity();

	int Initialize(int entityID, PhysicsComponent* pComp, GraphicsComponent* gComp, float rotateTime = 1.0f, float minRotation = 0.0f, float maxRotation = DirectX::XM_PI / 2.0f);

	int Update(float dT, InputHandler* inputHandler);
	int React(int entityID, EVENT reactEvent);

	bool SetIsOpened(bool isOpened);
	bool GetIsOpened();
};

#endif

UPDATE Uncommented door variables for reacting


#include <stdio.h>

#define LIST_SIZE 1000

int divisible_by(int x, int y){
  return x % y == 0;
}

int sum_multiples_of(int n1, int n2){
  int list[LIST_SIZE], i, s;
  s = 0;
  for(i = 0; i < LIST_SIZE; i++){
    if(divisible_by(i, n1) == 1 || divisible_by(i, n2) == 1){
      list[i] = i;
      s += i;
    }
  }
  return s;
}

int main(int argc, char *argv[]){
  printf("%d\n", sum_multiples_of(3, 5));
}

Add C implementation for problem 1

Add C implementation for problem 1


#pragma once

#include <ionMath.h>

//---- Define constructor and implicit cast operators to convert back<>forth from your math types and ImVec2/ImVec4.

#define IM_VEC2_CLASS_EXTRA                                                 \
        ImVec2(const ion::vec2f& f) { x = f.X; y = f.Y; }                       \
        operator ion::vec2f() const { return ion::vec2f(x,y); }

#define IM_VEC4_CLASS_EXTRA                                                 \
        ImVec4(const ion::vec4f& f) { x = f.X; y = f.Y; z = f.Z; w = f.W; }     \
        operator ion::vec4f() const { return ion::vec4f(x,y,z,w); }

#include <imgui.h>

#pragma once

#include <ionCore.h>

//---- Define constructor and implicit cast operators to convert back<>forth from your math types and ImVec2/ImVec4.
#define IM_VEC2_CLASS_EXTRA                                                   \
        ImVec2(const ion::vec2f& f) { x = f.X; y = f.Y; }                     \
        operator ion::vec2f() const { return ion::vec2f(x,y); }

#define IM_VEC4_CLASS_EXTRA                                                   \
        ImVec4(const ion::vec4f& f) { x = f.X; y = f.Y; z = f.Z; w = f.W; }   \
        operator ion::vec4f() const { return ion::vec4f(x,y,z,w); }

//---- Use 32-bit vertex indices (instead of default: 16-bit) to allow meshes with more than 64K vertices
#define ImDrawIdx unsigned int

#include <imgui.h>

[ionGUI] Switch to 32bit indices for gui rendering


/* Copyright 2013 Google Inc. All Rights Reserved.

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

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

   Unless required by applicable law or agreed to in writing, software
   distributed under the License is distributed on an "AS IS" BASIS,
   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   See the License for the specific language governing permissions and
   limitations under the License.

   Common types
*/

#ifndef BROTLI_DEC_TYPES_H_
#define BROTLI_DEC_TYPES_H_

#include <stddef.h>  /* for size_t */

#ifndef _MSC_VER
#include <inttypes.h>
#ifdef __STRICT_ANSI__
#define BROTLI_INLINE
#else  /* __STRICT_ANSI__ */
#define BROTLI_INLINE inline
#endif
#else
typedef signed   char int8_t;
typedef unsigned char uint8_t;
typedef signed   short int16_t;
typedef unsigned short uint16_t;
typedef signed   int int32_t;
typedef unsigned int uint32_t;
typedef unsigned long long int uint64_t;
typedef long long int int64_t;
#define BROTLI_INLINE __forceinline
#endif  /* _MSC_VER */

#endif  /* BROTLI_DEC_TYPES_H_ */

/* Copyright 2013 Google Inc. All Rights Reserved.

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

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

   Unless required by applicable law or agreed to in writing, software
   distributed under the License is distributed on an "AS IS" BASIS,
   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   See the License for the specific language governing permissions and
   limitations under the License.

   Common types
*/

#ifndef BROTLI_DEC_TYPES_H_
#define BROTLI_DEC_TYPES_H_

#include <stddef.h>  /* for size_t */

#ifndef _MSC_VER
#include <inttypes.h>
#if defined(__cplusplus) || !defined(__STRICT_ANSI__) \
    || __STDC_VERSION__ >= 199901L
#define BROTLI_INLINE inline
#else
#define BROTLI_INLINE
#endif
#else
typedef signed   char int8_t;
typedef unsigned char uint8_t;
typedef signed   short int16_t;
typedef unsigned short uint16_t;
typedef signed   int int32_t;
typedef unsigned int uint32_t;
typedef unsigned long long int uint64_t;
typedef long long int int64_t;
#define BROTLI_INLINE __forceinline
#endif  /* _MSC_VER */

#endif  /* BROTLI_DEC_TYPES_H_ */

Allow use of inline keyword in c++/c99 mode.


/**
 * Copyright (c) 2015 Google Inc.
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions are met:
 * 1. Redistributions of source code must retain the above copyright notice,
 * this list of conditions and the following disclaimer.
 * 2. Redistributions in binary form must reproduce the above copyright notice,
 * this list of conditions and the following disclaimer in the documentation
 * and/or other materials provided with the distribution.
 * 3. Neither the name of the copyright holder nor the names of its
 * contributors may be used to endorse or promote products derived from this
 * software without specific prior written permission.
 *
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
 * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */

#ifndef __COMMON_SPECIAL_TEST_H
#define __COMMON_SPECIAL_TEST_H

/* Special tests always require GPIO handshaking */
#if (defined _SPECIAL_TEST) && !(defined __HANDSHAKE)
#define _HANDSHAKE  1
#endif

/*
 * Special test identifiers for bootrom testing:
 */

/* Allow 3rd stage FW to try to put the chip into standby. */
#define SPECIAL_STANDBY_TEST            1

/*
 * STANDBY_TEST plus 3rd stage FW waits for the server to put UniPro to
 * hibern8 mode before suspend
 * */
#define SPECIAL_GBBOOT_SERVER_STANDBY   2

/* Run the SpiRom at different gear speeds */
#define SPECIAL_GEAR_CHANGE_TEST        3

#endif /* __COMMON_SPECIAL_TEST_H */

Bootrom: Build Tools: Moved special test flags into -spec

Converted the gear_change_test and suspend/resume tests from individual
compile flags into the special-test (-spec <num>) mechanism. (includes
file missing from original commit.

Testing Done: multiple builds and compile tests to ensure that the right
flags were being set at the compiler level.
Bug Number: SW-1205
Review URL: https://reviews.leaflabs.com/r/1843/
Reviewed by: Olin Sibert, Jun Li

Signed-off-by:  Morgan Girling <980e61e2e2b82c453db57c2e8646c01fbd3318cd@bsquare.com>


#ifndef BERRY_COMMON_COMMON_H
#define BERRY_COMMON_COMMON_H

#if defined(__APPLE__)
    #include "TargetConditionals.h"
    #if ANGEL_MOBILE
        #include <sys/time.h>
        #import <Availability.h>
        #ifndef __IPHONE_5_0
            #warning "This project uses features only available in iPhone SDK 5.0 and later."
        #endif
        #ifdef __OBJC__
            #import <Foundation/Foundation.h>
            #import <UIKit/UIKit.h>
        #else
            #include <CoreFoundation/CoreFoundation.h>
        #endif
    #else
        #ifndef __OBJC__
            #include <CoreFoundation/CoreFoundation.h>
        #endif
    #endif
#endif
#if defined(__APPLE__) || defined(__linux__)
    #include <ext/hash_map>

    //GCC is picky about what types are allowed to be used as indices to hashes.
    // Defining this here lets us use std::strings to index, which is useful.
    #define hashmap_ns __gnu_cxx
    namespace hashmap_ns
    {
        template<> struct hash< std::string >
        {
            size_t operator()( const std::string& x ) const
            {
                return hash< const char* >()( x.c_str() );
            }
        };
    }
#endif

#endif

#ifndef BERRY_COMMON_COMMON_H
#define BERRY_COMMON_COMMON_H

#if defined(__APPLE__)
    #include "TargetConditionals.h"
    #if ANGEL_MOBILE
        #include <sys/time.h>
        #import <Availability.h>
        #ifndef __IPHONE_5_0
            #warning "This project uses features only available in iPhone SDK 5.0 and later."
        #endif
        #ifdef __OBJC__
            #import <Foundation/Foundation.h>
            #import <UIKit/UIKit.h>
        #else
            #include <CoreFoundation/CoreFoundation.h>
        #endif
    #else
        #ifndef __OBJC__
            #include <CoreFoundation/CoreFoundation.h>
        #endif
    #endif
#endif
#if defined(__APPLE__)
    #include <unordered_map>
#elif defined(__linux__)
    #include <ext/hash_map>

    //GCC is picky about what types are allowed to be used as indices to hashes.
    // Defining this here lets us use std::strings to index, which is useful.
    #define hashmap_ns __gnu_cxx
    namespace hashmap_ns
    {
        template<> struct hash< std::string >
        {
            size_t operator()( const std::string& x ) const
            {
                return hash< const char* >()( x.c_str() );
            }
        };
    }
#endif

#endif

Fix compile warning of hash_map in OS X

Fix compile warning of hash_map in OS X


///
/// Copyright (c) 2016 Dropbox, Inc. All rights reserved.
///

#import <Foundation/Foundation.h>

#import "DBHandlerTypes.h"

///
/// Keychain class for storing OAuth tokens.
///
@interface DBSDKKeychain : NSObject

/// Stores a key / value pair in the keychain.
+ (BOOL)storeValueWithKey:(NSString * _Nonnull)key value:(NSString * _Nonnull)value;

/// Retrieves a value from the corresponding key from the keychain.
+ (NSString * _Nullable)retrieveTokenWithKey:(NSString * _Nonnull)key;

/// Retrieves all token uids from the keychain.
+ (NSArray<NSString *> * _Nonnull)retrieveAllTokenIds;

/// Deletes a key / value pair in the keychain.
+ (BOOL)deleteTokenWithKey:(NSString * _Nonnull)key;

/// Deletes all key / value pairs in the keychain.
+ (BOOL)clearAllTokens;

/// Checks if performing a v1 token migration is necessary, and if so, performs it.
+ (BOOL)checkAndPerformV1TokenMigration:(DBTokenMigrationResponseBlock _Nonnull)responseBlock
                                  queue:(NSOperationQueue * _Nullable)queue
                                 appKey:(NSString * _Nonnull)appKey
                              appSecret:(NSString * _Nonnull)appSecret;

@end

///
/// Copyright (c) 2016 Dropbox, Inc. All rights reserved.
///

#import <Foundation/Foundation.h>

#import "DBHandlerTypes.h"

NS_ASSUME_NONNULL_BEGIN

///
/// Keychain class for storing OAuth tokens.
///
@interface DBSDKKeychain : NSObject

/// Stores a key / value pair in the keychain.
+ (BOOL)storeValueWithKey:(NSString *)key value:(NSString *)value;

/// Retrieves a value from the corresponding key from the keychain.
+ (NSString * _Nullable)retrieveTokenWithKey:(NSString *)key;

/// Retrieves all token uids from the keychain.
+ (NSArray<NSString *> *)retrieveAllTokenIds;

/// Deletes a key / value pair in the keychain.
+ (BOOL)deleteTokenWithKey:(NSString *)key;

/// Deletes all key / value pairs in the keychain.
+ (BOOL)clearAllTokens;

/// Checks if performing a v1 token migration is necessary, and if so, performs it.
+ (BOOL)checkAndPerformV1TokenMigration:(DBTokenMigrationResponseBlock)responseBlock
                                  queue:(NSOperationQueue * _Nullable)queue
                                 appKey:(NSString *)appKey
                              appSecret:(NSString *)appSecret;

@end

NS_ASSUME_NONNULL_END

Switch to NS_ASSUME_NONNULL_BEGIN and _END

This leaves us free to only define the nullable parameters in each method signature.


#ifndef WINDOW_H
#define WINDOW_H

#include <ncurses.h>
#include <array>

#include "../game.h"

// Used to define a datatype for calls to wborder
struct Border {
    chtype ls, rs, ts, bs;
    chtype tl, tr, bl, br;
};

class Window {
    public:
        Window(rect dim); // ctor
       ~Window();         // dtor

        void bindWin(WINDOW *newW);

        int getChar();

        void refresh();
        void update();
        void clear();
        void close();

        void cursorPos(vec2ui pos);

        void draw(vec2ui pos, char ch, chtype colo);
        void draw(vec2ui pos, char ch, chtype colo, int attr);
        void drawBorder();
        void drawBox();
        void write(std::string str);
        void write(vec2ui pos, std::string str);
        void coloSplash(chtype colo);

        rect getDim() { return dim; }

        void setBorder(Border b);

    protected:
        WINDOW *w;
        rect dim;
        Border border { 0,0,0,0,0,0,0,0 };  // Init to default

};

#endif

#ifndef WINDOW_H
#define WINDOW_H

#include <ncurses.h>
#include <string>
#include <array>

#include "../game.h"

// Used to define a datatype for calls to wborder
struct Border {
    chtype ls, rs, ts, bs;
    chtype tl, tr, bl, br;
};

class Window {
    public:
        Window(rect dim); // ctor
       ~Window();         // dtor

        void bindWin(WINDOW *newW);

        int getChar();

        void refresh();
        void update();
        void clear();
        void close();

        void cursorPos(vec2ui pos);

        void draw(vec2ui pos, char ch, chtype colo);
        void draw(vec2ui pos, char ch, chtype colo, int attr);
        void drawBorder();
        void drawBox();
        void write(std::string str);
        void write(vec2ui pos, std::string str);
        void coloSplash(chtype colo);

        rect getDim() { return dim; }

        void setBorder(Border b);

    protected:
        WINDOW *w;
        rect dim;
        Border border { 0,0,0,0,0,0,0,0 };  // Init to default

};

#endif

Fix missing string in namespace std compiler error

On some systems


// RUN: cp %s %t &&
// RUN: xcc -x c-header %t -o %t.pth &&
// RUN: xcc -### -S -include %t -x c /dev/null &> %t.log &&
// RUN: grep '"-token-cache" ".*/pth.c.out.tmp.pth"' %t.log
// RUN: true

Test case for transparent PTH support.

ccc: Test case for transparent PTH support.

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


//
//  UIView+CLUViewRecordableAdditions.h
//  Clue
//
//  Created by Ahmed Sulaiman on 5/27/16.
//  Copyright © 2016 Ahmed Sulaiman. All rights reserved.
//

#import <UIKit/UIKit.h>
#import "CLUViewRecordableProperties.h"

@interface UIView (CLUViewRecordableAdditions) <CLUViewRecordableProperties>

- (NSDictionary *)clue_colorPropertyDictionaryForColor:(UIColor *)color;
- (NSDictionary *)clue_sizePropertyDictionaryForSize:(CGSize)size;
- (NSDictionary *)clue_fontPropertyDictionaryForFont:(UIFont *)font;
- (NSDictionary *)clue_attributedTextPropertyDictionaryForAttributedString:(NSAttributedString *)attributedText;

@end

//
//  UIView+CLUViewRecordableAdditions.h
//  Clue
//
//  Created by Ahmed Sulaiman on 5/27/16.
//  Copyright © 2016 Ahmed Sulaiman. All rights reserved.
//

#import <UIKit/UIKit.h>
#import "CLUViewRecordableProperties.h"

@interface UIView (CLUViewRecordableAdditions) <CLUViewRecordableProperties>

- (NSDictionary *)clue_colorPropertyDictionaryForColor:(UIColor *)color;
- (NSDictionary *)clue_sizePropertyDictionaryForSize:(CGSize)size;
- (NSDictionary *)clue_fontPropertyDictionaryForFont:(UIFont *)font;
- (NSDictionary *)clue_attributedTextPropertyDictionaryForAttributedString:(NSAttributedString *)attributedText;

- (NSDictionary *)clue_layoutMarginsPropertyDictionary;
- (NSDictionary *)clue_frameProprtyDictionary;

@end

Move layoutMargin method and Frame method to public interface of UIView additions category. (mostly for testing purposes and those method should be public IMO anyway)


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

#ifndef WEBRTC_EXPERIMENTS_H_
#define WEBRTC_EXPERIMENTS_H_

#include "webrtc/typedefs.h"

namespace webrtc {
struct RemoteBitrateEstimatorMinRate {
  RemoteBitrateEstimatorMinRate() : min_rate(30000) {}
  RemoteBitrateEstimatorMinRate(uint32_t min_rate) : min_rate(min_rate) {}

  uint32_t min_rate;
};

struct SkipEncodingUnusedStreams {
  SkipEncodingUnusedStreams() : enabled(false) {}
  explicit SkipEncodingUnusedStreams(bool set_enabled)
    : enabled(set_enabled) {}
  virtual ~SkipEncodingUnusedStreams() {}

  const bool enabled;
};

struct AimdRemoteRateControl {
  AimdRemoteRateControl() : enabled(false) {}
  explicit AimdRemoteRateControl(bool set_enabled)
    : enabled(set_enabled) {}
  virtual ~AimdRemoteRateControl() {}

  const bool enabled;
};
}  // namespace webrtc
#endif  // WEBRTC_EXPERIMENTS_H_

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

#ifndef WEBRTC_EXPERIMENTS_H_
#define WEBRTC_EXPERIMENTS_H_

#include "webrtc/typedefs.h"

namespace webrtc {
struct RemoteBitrateEstimatorMinRate {
  RemoteBitrateEstimatorMinRate() : min_rate(30000) {}
  RemoteBitrateEstimatorMinRate(uint32_t min_rate) : min_rate(min_rate) {}

  uint32_t min_rate;
};

struct AimdRemoteRateControl {
  AimdRemoteRateControl() : enabled(false) {}
  explicit AimdRemoteRateControl(bool set_enabled)
    : enabled(set_enabled) {}
  virtual ~AimdRemoteRateControl() {}

  const bool enabled;
};
}  // namespace webrtc
#endif  // WEBRTC_EXPERIMENTS_H_

Remove no longer used SkipEncodingUnusedStreams.

R=andrew@webrtc.org

Review URL: https://webrtc-codereview.appspot.com/18829004

Cr-Mirrored-From: https://chromium.googlesource.com/external/webrtc
Cr-Mirrored-Commit: b0c8228755e6d86a77f3a74999216b31feb44a6b


#pragma once

#include <string>

#include "Program.h"
#include "ThingInstance.h"

class NumberInstance : public ThingInstance {
public:

	NumberInstance(int val) : val(val), ThingInstance(NumberInstance::methods) {};

	virtual std::string text() const override {
		return std::to_string(val);
	}

	const int val;
	static const std::vector<InternalMethod> methods;

};

#pragma once

#include <string>

#include "Program.h"
#include "ThingInstance.h"

class NumberInstance : public ThingInstance {
public:

	NumberInstance(int val) : val(val), ThingInstance(NumberInstance::methods) {};

	virtual std::string text() const override {
		return std::to_string(val);
	}

	static void add() {
		auto lhs = static_cast<NumberInstance*>(Program::pop().get());
		auto rhs = static_cast<NumberInstance*>(Program::pop().get());
		auto ptr = PThingInstance(new NumberInstance(lhs->val + rhs->val));
		Program::push(ptr);
	}

	const int val;
	static const std::vector<InternalMethod> methods;

};

Implement + support in numbers

Implement + support in numbers


/**
* MDx Hash Function
* (C) 1999-2008 Jack Lloyd
*
* Distributed under the terms of the Botan license
*/

#ifndef BOTAN_MDX_BASE_H__
#define BOTAN_MDX_BASE_H__

#include <botan/hash.h>

namespace Botan {

/**
* MDx Hash Function Base Class
*/
class BOTAN_DLL MDx_HashFunction : public HashFunction
   {
   public:
      MDx_HashFunction(u32bit, u32bit, bool, bool, u32bit = 8);
      virtual ~MDx_HashFunction() {}
   protected:
      void clear() throw();
      SecureVector<byte> buffer;
      u64bit count;
      u32bit position;
   private:
      void add_data(const byte[], u32bit);
      void final_result(byte output[]);

      virtual void compress_n(const byte block[], u32bit block_n) = 0;

      virtual void copy_out(byte[]) = 0;
      virtual void write_count(byte[]);

      const bool BIG_BYTE_ENDIAN, BIG_BIT_ENDIAN;
      const u32bit COUNT_SIZE;
   };

}

#endif

/**
* MDx Hash Function
* (C) 1999-2008 Jack Lloyd
*
* Distributed under the terms of the Botan license
*/

#ifndef BOTAN_MDX_BASE_H__
#define BOTAN_MDX_BASE_H__

#include <botan/hash.h>

namespace Botan {

/**
* MDx Hash Function Base Class
*/
class BOTAN_DLL MDx_HashFunction : public HashFunction
   {
   public:
      MDx_HashFunction(u32bit, u32bit, bool, bool, u32bit = 8);
      virtual ~MDx_HashFunction() {}
   protected:
      void add_data(const byte[], u32bit);
      void final_result(byte output[]);
      virtual void compress_n(const byte block[], u32bit block_n) = 0;

      void clear() throw();
      virtual void copy_out(byte[]) = 0;
      virtual void write_count(byte[]);
   private:
      SecureVector<byte> buffer;
      u64bit count;
      u32bit position;

      const bool BIG_BYTE_ENDIAN, BIG_BIT_ENDIAN;
      const u32bit COUNT_SIZE;
   };

}

#endif

Make the member variables of MDx_HashFunction private instead of protected - no subclass needs access to any of these variables.


//===---- MipsABIInfo.h - Information about MIPS ABI's --------------------===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

#ifndef MIPSABIINFO_H
#define MIPSABIINFO_H

namespace llvm {
class MipsABIInfo {
public:
  enum class ABI { Unknown, O32, N32, N64, EABI };

protected:
  ABI ThisABI;

public:
  MipsABIInfo(ABI ThisABI) : ThisABI(ThisABI) {}

  static MipsABIInfo Unknown() { return MipsABIInfo(ABI::Unknown); }
  static MipsABIInfo O32() { return MipsABIInfo(ABI::O32); }
  static MipsABIInfo N32() { return MipsABIInfo(ABI::N32); }
  static MipsABIInfo N64() { return MipsABIInfo(ABI::N64); }
  static MipsABIInfo EABI() { return MipsABIInfo(ABI::EABI); }

  bool IsKnown() const { return ThisABI != ABI::Unknown; }
  bool IsO32() const { return ThisABI == ABI::O32; }
  bool IsN32() const { return ThisABI == ABI::N32; }
  bool IsN64() const { return ThisABI == ABI::N64; }
  bool IsEABI() const { return ThisABI == ABI::EABI; }
  ABI GetEnumValue() const { return ThisABI; }

  /// Ordering of ABI's
  /// MipsGenSubtargetInfo.inc will use this to resolve conflicts when given
  /// multiple ABI options.
  bool operator<(const MipsABIInfo Other) const {
    return ThisABI < Other.GetEnumValue();
  }
};
}

#endif

Add file that should have been in r223027

git-svn-id: 1a981f132218c5d985e5b5a896e7a8b8201781d6@223028 91177308-0d34-0410-b5e6-96231b3b80d8


//
//  SVNetworking.h
//  SVNetworking
//
//  Created by Nate Stedman on 3/14/14.
//  Copyright (c) 2014 Svpply. All rights reserved.
//

#import "NSObject+SVBindings.h"
#import "NSObject+SVMultibindings.h"
#import "SVDataRequest.h"
#import "SVDiskCache.h"
#import "SVFunctional.h"
#import "SVImageView.h"
#import "SVJSONRequest.h"
#import "SVRemoteImage.h"
#import "SVRemoteImageProtocol.h"
#import "SVRemoteDataRequestResource.h"
#import "SVRemoteDataResource.h"
#import "SVRemoteJSONRequestResource.h"
#import "SVRemoteJSONResource.h"
#import "SVRemoteProxyResource.h"
#import "SVRemoteResource.h"
#import "SVRemoteRetainedScaledImage.h"
#import "SVRemoteScaledImage.h"
#import "SVRemoteScaledImageProtocol.h"
#import "SVRequest.h"

//
//  SVNetworking.h
//  SVNetworking
//
//  Created by Nate Stedman on 3/14/14.
//  Copyright (c) 2014 Svpply. All rights reserved.
//

#import "NSObject+SVBindings.h"
#import "NSObject+SVMultibindings.h"
#import "SVDataRequest.h"
#import "SVDiskCache.h"
#import "SVFunctional.h"
#import "SVImageView.h"
#import "SVJSONRequest.h"
#import "SVRemoteArray.h"
#import "SVRemoteImage.h"
#import "SVRemoteImageProtocol.h"
#import "SVRemoteDataRequestResource.h"
#import "SVRemoteDataResource.h"
#import "SVRemoteJSONArray.h"
#import "SVRemoteJSONRequestResource.h"
#import "SVRemoteJSONResource.h"
#import "SVRemoteProxyResource.h"
#import "SVRemoteResource.h"
#import "SVRemoteRetainedScaledImage.h"
#import "SVRemoteScaledImage.h"
#import "SVRemoteScaledImageProtocol.h"
#import "SVRequest.h"

Add remote array classes to headers.

Add remote array classes to headers.


/*
 * UIOMux: a conflict manager for system resources, including UIO devices.
 * Copyright (C) 2009 Renesas Technology Corp.
 *
 * 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; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA  02110-1301 USA
 */

#include "config.h"

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

#define INFO(str) \
  { printf ("----  %s ...\n", (str)); }

#define WARN(str) \
  { printf ("%s:%d: warning: %s\n", __FILE__, __LINE__, (str)); }

#define FAIL(str) \
  { printf ("%s:%d: %s\n", __FILE__, __LINE__, (str)); exit(1); }

/*
 * UIOMux: a conflict manager for system resources, including UIO devices.
 * Copyright (C) 2009 Renesas Technology Corp.
 *
 * 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; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA  02110-1301 USA
 */

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

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

#define INFO(str) \
  { printf ("----  %s ...\n", (str)); }

#define WARN(str) \
  { printf ("%s:%d: warning: %s\n", __FILE__, __LINE__, (str)); }

#define FAIL(str) \
  { printf ("%s:%d: %s\n", __FILE__, __LINE__, (str)); exit(1); }

Apply HAVE_CONFIG_H condition in src/tests/uiomux_test.h

config.h should be included only if HAVE_CONFIG_H defined
when autoconf used.


#include <stdio.h>

float K_5_BY_9 = 5.0 / 9.0;
float K_32 = 32;

int SUCCESS = 0;

int main(void)
{
    float fahrenheit, celsius;
    int lower, upper, step;

    lower = 0;
    upper = 300;
    step = 20;

    printf("|-----------|\n");
    printf("|%4s|%6s|\n", "F", "C");
    printf("|-----------|\n");

    fahrenheit = lower;
    while (fahrenheit <= upper) {
        celsius = K_5_BY_9 * (fahrenheit - K_32);
        printf("|%4.0f|%6.1f|\n", fahrenheit, celsius);
        fahrenheit = fahrenheit + step;
    }

    printf("|-----------|\n");

    return SUCCESS;
}

#include <stdio.h>

float K_5_BY_9 = 5.0 / 9.0;
float K_32 = 32.0;

int SUCCESS = 0;

int main(void)
{
    float fahrenheit, celsius;
    int lower, upper, step;

    lower = 0;
    upper = 300;
    step = 20;

    printf("|-----------|\n");
    printf("|%4s|%6s|\n", "F", "C");
    printf("|-----------|\n");

    fahrenheit = lower;
    while (fahrenheit <= upper) {
        celsius = K_5_BY_9 * (fahrenheit - K_32);
        printf("|%4.0f|%6.1f|\n", fahrenheit, celsius);
        fahrenheit = fahrenheit + step;
    }

    printf("|-----------|\n");

    return SUCCESS;
}

Change K_32 const value to more readable (with floating point)


#include "cowgol-cgen.h"

static i8 ram[0x10000 / 8];

i8* __top = (i8*) ram;
i8* __himem = (i8*) ((i1*)ram + sizeof(ram));
i8* global_argv;

extern void cmain(void);
int main(int argc, const char* argv[])
{
	/* Remember that Cowgol is built for 64-bit systems, so we need
	 * to copy the argv array as we could be running on a 32-bit system. */

	global_argv = calloc(argc+1, 8);
	for (int i=0; i<argc; i++)
		global_argv[i] = (i8)(intptr_t)argv[i];

    cmain();
    return 0;
}

#include "cowgol-cgen.h"

/* Really we should only have 64kB of RAM, but cgen intptr is 8 bytes which
 * quickly gobbles through it (cowlink can't load the entire compiler at
 * once). So, use 128kB. */
static i8 ram[0x20000 / 8];

i8* __top = (i8*) ram;
i8* __himem = (i8*) ((i1*)ram + sizeof(ram));
i8* global_argv;

extern void cmain(void);
int main(int argc, const char* argv[])
{
	/* Remember that Cowgol is built for 64-bit systems, so we need
	 * to copy the argv array as we could be running on a 32-bit system. */

	global_argv = calloc(argc+1, 8);
	for (int i=0; i<argc; i++)
		global_argv[i] = (i8)(intptr_t)argv[i];

    cmain();
    return 0;
}

Increase the amount of memory available to cgen --- those 8-byte pointers really add up.


// LAF Base Library
// Copyright (c) 2001-2016 David Capello
//
// This file is released under the terms of the MIT license.
// Read LICENSE.txt for more information.

#ifndef BASE_SHA1_H_INCLUDED
#define BASE_SHA1_H_INCLUDED
#pragma once

#include <vector>
#include <string>

extern "C" struct SHA1Context;

namespace base {

  class Sha1 {
  public:
    enum { HashSize = 20 };

    Sha1();
    explicit Sha1(const std::vector<uint8_t>& digest);

    // Calculates the SHA1 of the given file or string.
    static Sha1 calculateFromFile(const std::string& fileName);
    static Sha1 calculateFromString(const std::string& text);

    bool operator==(const Sha1& other) const;
    bool operator!=(const Sha1& other) const;

    uint8_t operator[](int index) const {
      return m_digest[index];
    }

  private:
    std::vector<uint8_t> m_digest;
  };

} // namespace base

#endif  // BASE_SHA1_H_INCLUDED

// LAF Base Library
// Copyright (c) 2001-2016 David Capello
//
// This file is released under the terms of the MIT license.
// Read LICENSE.txt for more information.

#ifndef BASE_SHA1_H_INCLUDED
#define BASE_SHA1_H_INCLUDED
#pragma once

#include <vector>
#include <string>

extern "C" struct SHA1Context;

namespace base {

  class Sha1 {
  public:
    enum { HashSize = 20 };

    Sha1();
    explicit Sha1(const std::vector<uint8_t>& digest);

    // Calculates the SHA1 of the given file or string.
    static Sha1 calculateFromFile(const std::string& fileName);
    static Sha1 calculateFromString(const std::string& text);

    bool operator==(const Sha1& other) const;
    bool operator!=(const Sha1& other) const;

    uint8_t operator[](int index) const {
      return m_digest[index];
    }

    const uint8_t *digest() const {
      return m_digest.data();
    }

    size_t size() const {
      return m_digest.size();
    }

  private:
    std::vector<uint8_t> m_digest;
  };

} // namespace base

#endif  // BASE_SHA1_H_INCLUDED

Add Sha1 class methods digest() and size()


/*
Copyright (C) 2011 by Mike McQuaid

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
*/

#include <Foundation/NSString.h>
#include <QString>

static NSString* fromQString(const QString &string)
{
    char* cString = string.toUtf8().data();
    return [[NSString alloc] initWithUTF8String:cString];
}

static QString toQString(NSString *string)
{
    if (!string)
        return QString();
    return QString::fromUtf8([string UTF8String]);
}

/*
Copyright (C) 2011 by Mike McQuaid

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
*/

#include <Foundation/NSString.h>
#include <QString>

static inline NSString* fromQString(const QString &string)
{
    char* cString = string.toUtf8().data();
    return [[NSString alloc] initWithUTF8String:cString];
}

static inline QString toQString(NSString *string)
{
    if (!string)
        return QString();
    return QString::fromUtf8([string UTF8String]);
}

Make shared functions inline to avoid warnings.


/* Defines common to all versions of NSS */

#define NSPR20 1
#define MP_API_COMPATIBLE 1
#define NSS_3_4_CODE 1 /* Remove this when we start building NSS 4.0 by default */

Define NSS_3_4 so that we get the right code and not Stan code that isn't quite ready.


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

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

Update Skia milestone to 52

Update Skia milestone to 52

BUG=skia:
GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1868893003

TBR=reed@google.com

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


#ifndef MISC__H__
#define MISC__H__

#include <sysdeps.h>
extern void random_init(uint32 seed);
extern uint32 random_int(void);
#define random_float() (random_int() * (double)(1.0/4294967296.0))
#define random_scale(S) ((unsigned int)(random_float() * (S)))

unsigned long strtou(const char* str, const char** end);
const char* utoa(unsigned long);
char* utoa2(unsigned long, char*);

#endif

#ifndef MISC__H__
#define MISC__H__

#include <sysdeps.h>
extern void random_init(uint32 seed);
extern uint32 random_int(void);
#define random_float() (random_int() * (double)(1.0/4294967296.0))
#define random_scale(S) ((unsigned int)(random_float() * (S)))
#define random_trunc(T) (random_int() % (T))

unsigned long strtou(const char* str, const char** end);
const char* utoa(unsigned long);
char* utoa2(unsigned long, char*);

#endif

Add random_trunc function, which truncates (with integer modulus) instead of scaling (with floating point divide and multiply) the base random number.


/* Egueb_Dom - DOM
 * Copyright (C) 2011 - 2013 Jorge Luis Zapata
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library.
 * If not, see <http://www.gnu.org/licenses/>.
 */
#ifndef _EGUEB_DOM_PRIVATE_H
#define _EGUEB_DOM_PRIVATE_H

/* This file is subject of ABI/API change, use at your own risk
 * It is needed in case a lib wants to inherit from the different
 * DOM interfaces
 */

#include "private/egueb_dom_node_private.h"
#include "private/egueb_dom_element_private.h"
#include "private/egueb_dom_document_private.h"

#endif

Add a private header for user-provided dom libs


/*
 *  Licensed to the Apache Software Foundation (ASF) under one or more
 *  contributor license agreements.  See the NOTICE file distributed with
 *  this work for additional information regarding copyright ownership.
 *  The ASF licenses this file to You under the Apache License, Version 2.0
 *  (the "License"); you may not use this file except in compliance with
 *  the License.  You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 *  Unless required by applicable law or agreed to in writing, software
 *  distributed under the License is distributed on an "AS IS" BASIS,
 *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *  See the License for the specific language governing permissions and
 *  limitations under the License.
 */

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

int port_get_utf8_converted_system_message_length(char *system_message)
{
    return strlen(system_message) + 1;
}

void port_convert_system_error_message_to_utf8(char *converted_message,
    int buffer_size,
    char *system_message)
{
    strncpy(converted_message, system_message, buffer_size - 1);
}

/*
 *  Licensed to the Apache Software Foundation (ASF) under one or more
 *  contributor license agreements.  See the NOTICE file distributed with
 *  this work for additional information regarding copyright ownership.
 *  The ASF licenses this file to You under the Apache License, Version 2.0
 *  (the "License"); you may not use this file except in compliance with
 *  the License.  You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 *  Unless required by applicable law or agreed to in writing, software
 *  distributed under the License is distributed on an "AS IS" BASIS,
 *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *  See the License for the specific language governing permissions and
 *  limitations under the License.
 */

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

int port_get_utf8_converted_system_message_length(char *system_message)
{
    return strlen(system_message) + 1;
}

void port_convert_system_error_message_to_utf8(char *converted_message,
    int buffer_size,
    char *system_message)
{
    strncpy(converted_message, system_message, buffer_size - 1);
    converted_message[buffer_size - 1] = '\0';
}

Make sure that the copy of the string is always null terminated

svn path=/harmony/; revision=601274


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

  Program: DICOM for VTK

  Copyright (c) 2012-2015 David Gobbi
  All rights reserved.
  See Copyright.txt or http://dgobbi.github.io/bsd3.txt for details.

     This software is distributed WITHOUT ANY WARRANTY; without even
     the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
     PURPOSE.  See the above copyright notice for more information.

=========================================================================*/
#ifndef __readquery_h
#define __readquery_h

#include "vtkDICOMItem.h"
#include "vtkDICOMTagPath.h"

#include <vector>

typedef std::vector<vtkDICOMTagPath> QueryTagList;

//! Read a query file, return 'true' on success.
/*!
 *  The query file is read into the supplied vtkDICOMItem as a set of
 *  attribute values.  If the ordering within the file is important,
 *  then a QueryTagList can also be provided.  The tags will be pushed
 *  onto the QueryTagList in the same order as they are encountered in
 *  the file.
 */
bool dicomcli_readquery(
  const char *fname, vtkDICOMItem *query, QueryTagList *ql=0);

//! Read a single query key, return 'true' on success.
bool dicomcli_readkey(
  const char *key, vtkDICOMItem *query, QueryTagList *ql=0);

#endif /* __readquery_h */

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

  Program: DICOM for VTK

  Copyright (c) 2012-2015 David Gobbi
  All rights reserved.
  See Copyright.txt or http://dgobbi.github.io/bsd3.txt for details.

     This software is distributed WITHOUT ANY WARRANTY; without even
     the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
     PURPOSE.  See the above copyright notice for more information.

=========================================================================*/
#ifndef readquery_h
#define readquery_h

#include "vtkDICOMItem.h"
#include "vtkDICOMTagPath.h"

#include <vector>

typedef std::vector<vtkDICOMTagPath> QueryTagList;

//! Read a query file, return 'true' on success.
/*!
 *  The query file is read into the supplied vtkDICOMItem as a set of
 *  attribute values.  If the ordering within the file is important,
 *  then a QueryTagList can also be provided.  The tags will be pushed
 *  onto the QueryTagList in the same order as they are encountered in
 *  the file.
 */
bool dicomcli_readquery(
  const char *fname, vtkDICOMItem *query, QueryTagList *ql=0);

//! Read a single query key, return 'true' on success.
bool dicomcli_readkey(
  const char *key, vtkDICOMItem *query, QueryTagList *ql=0);

#endif /* readquery_h */

Remove double underscore from include guard.


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

#include "SampleCode.h"
#include "gm.h"

class GMSampleView : public SampleView {
private:
    typedef skiagm::GM GM;

public:
    GMSampleView(GM* gm)
    : fGM(gm) {}

    virtual ~GMSampleView() {
        delete fGM;
    }

protected:
    virtual bool onQuery(SkEvent* evt) {
        if (SampleCode::TitleQ(*evt)) {
            SkString name("GM ");
            name.append(fGM->shortName());
            SampleCode::TitleR(evt, name.c_str());
            return true;
        }
        return this->INHERITED::onQuery(evt);
    }

    virtual void onDrawContent(SkCanvas* canvas) {
        fGM->drawContent(canvas);
    }

    virtual void onDrawBackground(SkCanvas* canvas) {
        fGM->drawBackground(canvas);
    }

private:
    GM* fGM;
    typedef SampleView INHERITED;
};

#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 GMSampleView_DEFINED
#define GMSampleView_DEFINED

#include "SampleCode.h"
#include "gm.h"

class GMSampleView : public SampleView {
private:
    typedef skiagm::GM GM;

public:
    GMSampleView(GM* gm)
    : fGM(gm) {}

    virtual ~GMSampleView() {
        delete fGM;
    }

protected:
    virtual bool onQuery(SkEvent* evt) {
        if (SampleCode::TitleQ(*evt)) {
            SkString name("GM:");
            name.append(fGM->shortName());
            SampleCode::TitleR(evt, name.c_str());
            return true;
        }
        return this->INHERITED::onQuery(evt);
    }

    virtual void onDrawContent(SkCanvas* canvas) {
        fGM->drawContent(canvas);
    }

    virtual void onDrawBackground(SkCanvas* canvas) {
        fGM->drawBackground(canvas);
    }

private:
    GM* fGM;
    typedef SampleView INHERITED;
};

#endif

Use : as separator between "GM" and slide name in SampleApp. This makes it easier to jump to a GM slide using command line args on windows.

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


// RUN: %ocheck 0 %s

struct A
{
	int x, y, z;
	int e, f;
};

void clobber_args()
{
}

struct A f(void)
{
	clobber_args(0, 1, 2); // clobber the stret pointer
	return (struct A){ 1, 2, 3, 4, 5};
}

int main()
{
	struct A a;

	a = f();

	if(a.x != 1
	|| a.y != 2
	|| a.z != 3
	|| a.e != 4
	|| a.f != 5)
	{
		abort();
	}

	return 0;
}

Test for struct return-by-value, both caller and callee


/*****************************************************************************/
/*                                                                           */
/* Logswan 2.0.2                                                             */
/* Copyright (c) 2015-2018, Frederic Cambus                                  */
/* https://www.logswan.org                                                   */
/*                                                                           */
/* Created:      2015-05-31                                                  */
/* Last Updated: 2018-08-05                                                  */
/*                                                                           */
/* Logswan is released under the BSD 2-Clause license.                       */
/* See LICENSE file for details.                                             */
/*                                                                           */
/*****************************************************************************/

#ifndef CONFIG_H
#define CONFIG_H

#define VERSION "Logswan 2.0.2"

enum {
	HLL_BITS = 20,
	LINE_LENGTH_MAX = 65536,
	STATUS_CODE_MAX = 512,

	CONTINENTS = 7,
	COUNTRIES = 251,
	METHODS = 9,
	PROTOCOLS = 2
};

extern char *continentsId[];
extern char *continentsNames[];
extern char *countriesId[];
extern char *countriesNames[];
extern char *methodsNames[];
extern char *protocolsNames[];

#endif /* CONFIG_H */

/*****************************************************************************/
/*                                                                           */
/* Logswan 2.0.2                                                             */
/* Copyright (c) 2015-2018, Frederic Cambus                                  */
/* https://www.logswan.org                                                   */
/*                                                                           */
/* Created:      2015-05-31                                                  */
/* Last Updated: 2018-08-05                                                  */
/*                                                                           */
/* Logswan is released under the BSD 2-Clause license.                       */
/* See LICENSE file for details.                                             */
/*                                                                           */
/*****************************************************************************/

#ifndef CONFIG_H
#define CONFIG_H

#define VERSION "Logswan 2.0.2"

enum {
	HLL_BITS = 20,
	LINE_LENGTH_MAX = 65536,
	STATUS_CODE_MAX = 512,

	CONTINENTS = 7,
	COUNTRIES = 251,
	METHODS = 9,
	PROTOCOLS = 3
};

extern char *continentsId[];
extern char *continentsNames[];
extern char *countriesId[];
extern char *countriesNames[];
extern char *methodsNames[];
extern char *protocolsNames[];

#endif /* CONFIG_H */

Enable support for parsing HTTP/2.0 requests, for real this time


/*
 * Copyright (c) Facebook, Inc. and its affiliates.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 */

#include <stdbool.h>
#include <stdlib.h>

#ifdef __cplusplus
extern "C" {
#endif

/* allocation that cannot fail */
void* __llair_alloc(unsigned size);

/* non-deterministic choice */
int __llair_choice();

/* executions that call __llair_unreachable are assumed to be impossible */
__attribute__((noreturn)) void __llair_unreachable();

/* assume a condition */
#define __llair_assume(condition) \
  if (!(condition))               \
  __llair_unreachable()

/* throw an exception */
__attribute__((noreturn)) void __llair_throw(void* thrown_exception);

/* glibc version */
#define __assert_fail(assertion, file, line, function) abort()

/* macos version */
#define __assert_rtn(function, file, line, assertion) abort()

/*
 * threads
 */

typedef int thread_t;

typedef int (*thread_create_routine)(void*);

thread_t sledge_thread_create(thread_create_routine entry, void* arg);

void sledge_thread_resume(thread_t thread);

int sledge_thread_join(thread_t thread);

/*
 * cct
 */

void cct_point(void);

#ifdef __cplusplus
}
#endif

/*
 * Copyright (c) Facebook, Inc. and its affiliates.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 */

#include <stdbool.h>
#include <stdlib.h>

#ifdef __cplusplus
extern "C" {
#endif

/* allocation that cannot fail */
void* __llair_alloc(long size);

/* non-deterministic choice */
long __llair_choice();

/* executions that call __llair_unreachable are assumed to be impossible */
__attribute__((noreturn)) void __llair_unreachable();

/* assume a condition */
#define __llair_assume(condition) \
  if (!(condition))               \
  __llair_unreachable()

/* throw an exception */
__attribute__((noreturn)) void __llair_throw(void* thrown_exception);

/* glibc version */
#define __assert_fail(assertion, file, line, function) abort()

/* macos version */
#define __assert_rtn(function, file, line, assertion) abort()

/*
 * threads
 */

typedef int thread_t;

typedef int (*thread_create_routine)(void*);

thread_t sledge_thread_create(thread_create_routine entry, void* arg);

void sledge_thread_resume(thread_t thread);

int sledge_thread_join(thread_t thread);

/*
 * cct
 */

void cct_point(void);

#ifdef __cplusplus
}
#endif

[sledge] Adjust declared types of llair intrinsics

Summary:
Internally __llair_alloc and __llair_choice are treated as full-width
signed integers, so use the `long` C type.

Differential Revision: D39136450

fbshipit-source-id: 1ebeff4fe2dcd3cb75d7d13e2798a82c275218a4


//
//  FileObject.h
//  arc
//
//  Created by Jerome Cheng on 19/3/13.
//  Copyright (c) 2013 nus.cs3217. All rights reserved.
//

#import <Foundation/Foundation.h>

@interface FileObject : NSObject {
    @protected
    NSURL* _url;
    id _contents;
    BOOL _needsRefresh;
}

// The name of this object.
@property (strong, nonatomic) NSString* name;

// The full file path of this object.
@property (strong, nonatomic) NSString* path;

// The parent of this object (if any.)
@property (weak, nonatomic) FileObject* parent;

// Creates a FileObject to represent the given URL.
// url should be an object on the file system.
- (id)initWithURL:(NSURL*)url;

// Creates a FileObject to represent the given URL,
// with its parent set to the given FileObject.
- (id)initWithURL:(NSURL*)url parent:(FileObject*)parent;

// Refreshes the contents of this object by reloading
// them from the file system.
// Returns the contents when done.
- (id)refreshContents;

// Flags this object as needing its contents refreshed.
- (void)flagForRefresh;

// Gets the contents of this object.
- (id)getContents;

// Removes this object from the file system.
// Returns YES if successful, NO otherwise.
- (BOOL)remove;

@end

//
//  FileObject.h
//  arc
//
//  Created by Jerome Cheng on 19/3/13.
//  Copyright (c) 2013 nus.cs3217. All rights reserved.
//

#import <Foundation/Foundation.h>

@interface FileObject : NSObject {
    @protected
    NSURL* _url;
    id _contents;
    BOOL _needsRefresh;
}

// The name of this object.
@property (strong, nonatomic) NSString* name;

// The full file path of this object. Can be used
// to recreate an NSURL.
@property (strong, nonatomic) NSString* path;

// The parent of this object (if any.)
@property (weak, nonatomic) FileObject* parent;

// Creates a FileObject to represent the given URL.
// url should be an object on the file system.
- (id)initWithURL:(NSURL*)url;

// Creates a FileObject to represent the given URL,
// with its parent set to the given FileObject.
- (id)initWithURL:(NSURL*)url parent:(FileObject*)parent;

// Refreshes the contents of this object by reloading
// them from the file system.
// Returns the contents when done.
- (id)refreshContents;

// Flags this object as needing its contents refreshed.
- (void)flagForRefresh;

// Gets the contents of this object.
- (id)getContents;

// Removes this object from the file system.
// Returns YES if successful, NO otherwise.
- (BOOL)remove;

@end

Add explaining comment for path property.


/**
 * File:   status.h
 * Author: Alex Savarda
 */

#ifndef STATUS_H
#define STATUS_H

typedef struct {
    unsigned int m_stat;
    unsigned int W_stat;
} statusType;

#endif  /* STATUS_H */

/*
 * File:   status.h
 * Author: Alex Savarda
 */

#ifndef STATUS_H
#define STATUS_H

typedef struct {
    unsigned int m_stat;
    unsigned int W_stat;
} statusType;

#endif  /* STATUS_H */

Change file header to C style

Change file header to C style


// Global configuration information
//

// Connection information

#define SERIAL_BAUD 115200

// Global configuration information
//

// Connection information

#define SERIAL_BAUD 9600

FIX - Lowered baud rates to 9600

FIX - Lowered baud rates to 9600


/* libunwind - a platform-independent unwind library
   Copyright (C) 2003-2004 Hewlett-Packard Co
	Contributed by David Mosberger-Tang <davidm@hpl.hp.com>

This file is part of libunwind.

Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:

The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.  */

#define UNW_LOCAL_ONLY

#include <assert.h>
#include <libunwind.h>
#include <setjmp.h>
#include <signal.h>
#include <stdlib.h>

#include "jmpbuf.h"
#include "setjmp_i.h"

void
_longjmp (jmp_buf env, int val)
{
  extern int _UI_longjmp_cont;
  unw_context_t uc;
  unw_cursor_t c;
  unw_word_t sp;
  unw_word_t *wp = (unw_word_t *) env;

  if (unw_getcontext (&uc) < 0 || unw_init_local (&c, &uc) < 0)
    abort ();

  do
    {
      if (unw_get_reg (&c, UNW_REG_SP, &sp) < 0)
	abort ();
      if (sp != wp[JB_SP])
	continue;

      if (!bsp_match (&c, wp))
	continue;

      /* found the right frame: */

      assert (UNW_NUM_EH_REGS >= 2);

      if (unw_set_reg (&c, UNW_REG_EH + 0, wp[JB_RP]) < 0
	  || unw_set_reg (&c, UNW_REG_EH + 1, val) < 0
	  || unw_set_reg (&c, UNW_REG_IP,
			  (unw_word_t) &_UI_longjmp_cont))
	abort ();

      unw_resume (&c);

      abort ();
    }
  while (unw_step (&c) >= 0);

  abort ();
}

#ifdef __GNUC__
void longjmp (jmp_buf env, int val) __attribute__ ((alias ("_longjmp")));
#else

void
longjmp (jmp_buf env, int val)
{
  _longjmp (env, val);
}

#endif

Include "setjmp_i.h".
Abstract ia64-specific code into bsp_match() routine.
Support any platform with at least 2 EH argument registers.

2004/12/06 01:33:16-08:00 mostang.com!davidm
Rename: src/longjmp.c -> src/setjmp/longjmp.c

(Logical change 1.290)


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

extern void foo_alias (void) __asm ("foo");
inline void foo (void) {
  return foo_alias ();
}
extern void bar_alias (void) __asm ("bar");
inline __attribute__ ((__always_inline__)) void bar (void) {
  return bar_alias ();
}
void f(void) {
  foo();
  bar();
}

// CHECK: define void @f()
// CHECK-NEXT: entry:
// CHECK-NEXT: call void @foo()
// CHECK-NEXT: call void @bar()
// CHECK-NEXT: ret void

// CHECK: declare void @foo()
// CHECK: declare void @bar()

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

extern void foo_alias (void) __asm ("foo");
inline void foo (void) {
  return foo_alias ();
}
extern void bar_alias (void) __asm ("bar");
inline __attribute__ ((__always_inline__)) void bar (void) {
  return bar_alias ();
}
void f(void) {
  foo();
  bar();
}

// CHECK: define void @f()
// CHECK: call void @foo()
// CHECK-NEXT: call void @bar()
// CHECK-NEXT: ret void

// CHECK: declare void @foo()
// CHECK: declare void @bar()

Fix this on the bots and make the test more complete by enabling optimizations.

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


// RUN: clang-cc -fsyntax-only -verify -triple x86_64-apple-darwin9 %s
typedef int i128 __attribute__((__mode__(TI)));
typedef unsigned u128 __attribute__((__mode__(TI)));

int a[((i128)-1 ^ (i128)-2) == 1 ? 1 : -1];
int a[(u128)-1 > 1LL ? 1 : -1];

// PR5435
__uint128_t b = (__uint128_t)-1;

Add a triple to try to fix the buildbot error.

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


//
//  DMNotificationObserver.h
//  Library
//
//  Created by Jonathon Mah on 2011-07-11.
//  Copyright 2011 Delicious Monster Software. All rights reserved.
//

#import <Foundation/Foundation.h>

/* The action block is passed the notification, the owner as a parameter (to avoid retain cycles),
 * and the triggering observer (so it can easiliy invalidate it if it needs to). */
@class DMNotificationObserver;
typedef void(^DMNotificationActionBlock)(NSNotification *notification, id localOwner, DMNotificationObserver *observer);

@interface DMNotificationObserver : NSObject

+ (id)observerForName:(NSString *)notificationName
               object:(id)notificationSender
                owner:(id)owner
               action:(DMNotificationActionBlock)actionBlock
                      __attribute__((__nonnull__(1,3,4)));

- (id)initWithName:(NSString *)notificationName
            object:(id)notificationSender
             owner:(id)owner
            action:(DMNotificationActionBlock)actionBlock
                   __attribute__((__nonnull__(1,3,4)));

- (void)fireAction:(NSNotification *)notification;
- (void)invalidate;

@end

//
//  DMNotificationObserver.h
//  Library
//
//  Created by Jonathon Mah on 2011-07-11.
//  Copyright 2011 Delicious Monster Software. All rights reserved.
//

#import <Foundation/Foundation.h>

/* The action block is passed the notification, the owner as a parameter (to avoid retain cycles),
 * and the triggering observer (so it can easiliy invalidate it if it needs to). */
@class DMNotificationObserver;
typedef void(^DMNotificationActionBlock)(NSNotification *notification, id localOwner, DMNotificationObserver *observer);

@interface DMNotificationObserver : NSObject

+ (id)observerForName:(NSString *)notificationName
               object:(id)notificationSender
                owner:(id)owner
               action:(DMNotificationActionBlock)actionBlock
                      __attribute__((nonnull(1,3,4)));

- (id)initWithName:(NSString *)notificationName
            object:(id)notificationSender
             owner:(id)owner
            action:(DMNotificationActionBlock)actionBlock
                   __attribute__((nonnull(1,3,4)));

- (void)fireAction:(NSNotification *)notification;
- (void)invalidate;

@end

Standardize on nonnull attribute (vs __nonnull__)


/* hello.c

build with:

 gcc -nostartfiles -fno-asynchronous-unwind-tables -Os -static -o hello hello.c
 strip -R .comment -s hello

*/

#include <unistd.h>

const char message[] = "\n"
"Hello from Docker.\n"
"This message shows that your installation appears to be working correctly.\n"
"\n"
"To generate this message, Docker took the following steps:\n"
" 1. The Docker client contacted the Docker daemon.\n"
" 2. The Docker daemon pulled the \"hello-world\" image from the Docker Hub.\n"
" 3. The Docker daemon created a new container from that image which runs the\n"
"    executable that produces the output you are currently reading.\n"
" 4. The Docker daemon streamed that output to the Docker client, which sent it\n"
"    to your terminal.\n"
"\n"
"To try something more ambitious, you can run an Ubuntu container with:\n"
" $ docker run -it ubuntu bash\n"
"\n"
"Share images, automate workflows, and more with a free Docker Hub account:\n"
" https://hub.docker.com\n"
"\n"
"For more examples and ideas, visit:\n"
" https://docs.docker.com/userguide/\n"
"\n";

void _start()
{
	write(1, message, sizeof(message)-1);
	_exit(0);
}

Replace with portable version in C

Replace with portable version in C

Build a minimal version in C instead of assembly so it easily can be
ported to other archs.

This statically linked C version builds a binary that is 1472 bytes.

fixes #7


#ifndef ENTRYTESTSUITE
#define ENTRYTESTSUITE

#include <cxxtest/TestSuite.h>
#include "../src/entry.h"

class EntryTestSuite : public CxxTest::TestSuite
{
public:
    void testEntryHasGivenTitle(void)
    {
        testEntry.setTitle("testTitle");
        TS_ASSERT_SAME_DATA(testEntry.title().c_str(), "testTitle", 9);
    }

    diaryengine::Entry testEntry;
};

#endif // ENTRYTESTSUITE

#ifndef ENTRYTESTSUITE
#define ENTRYTESTSUITE

#include <cxxtest/TestSuite.h>
#include <qt5/QtCore/QDateTime>
#include "../src/entry.h"

class EntryTestSuite : public CxxTest::TestSuite
{
public:
    void testTitleCanBeSetCorrectly(void)
    {
      testEntry.setTitle("testTitle");
      TS_ASSERT_SAME_DATA(testEntry.title().c_str(), "testTitle", 9);
    }

    void testDateCanBeSetCorrectlyWithISOString(void)
    {
      testEntry.setDate("2007-03-01T13:00:00Z");
      TS_ASSERT(testEntry.date() == "2007-03-01T13:00:00Z");
    }

    void testDateUnderstandsTimeZone(void)
    {
      testEntry.setDate("2007-03-01T13:00:00+02:00");
      TS_ASSERT(testEntry.date() == "2007-03-01T13:00:00+02:00");
    }

    void testIdRegenerationGeneratesDifferentUUID()
    {
      testEntry.regenerateId();
      long id = testEntry.id();
      testEntry.regenerateId();
      TS_ASSERT_DIFFERS(testEntry.id(), id);
    }

    diaryengine::Entry testEntry;
};

#endif // ENTRYTESTSUITE

Add tests for id generation and ISO date strings


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

// All these are there for the autoloading
#pragma link C++ class ROOT::Experimental::TDataFrame-;
#pragma link C++ class ROOT::Experimental::TDataFrameInterface<ROOT::Detail::TDataFrameFilterBase>-;
#pragma link C++ class ROOT::Experimental::TDataFrameInterface<ROOT::Detail::TDataFrameBranchBase>-;

#endif

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

// All these are there for the autoloading
#pragma link C++ class ROOT::Experimental::TDataFrame-;
#pragma link C++ class ROOT::Experimental::TDataFrameInterface<ROOT::Detail::TDataFrameFilterBase>-;
#pragma link C++ class ROOT::Experimental::TDataFrameInterface<ROOT::Detail::TDataFrameBranchBase>-;
#pragma link C++ class ROOT::Detail::TDataFrameImpl-;

#endif

[TDF] Add another autoload key for TDataFrameImpl'


// RUN: mkdir -p %t.dir
// RUN: %clang_cc1 -analyze -analyzer-output=html -analyzer-checker=core -o %t.dir
// RUN: ls %t.dir | not grep report
// RUN: rm -fR %t.dir

// This tests that we do not currently emit HTML diagnostics for reports that
// cross file boundaries.

#include "html-diags-multifile.h"

#define CALL_HAS_BUG(q) has_bug(q)

void test_call_macro() {
  CALL_HAS_BUG(0);
}

// RUN: mkdir -p %t.dir
// RUN: %clang_cc1 -analyze -analyzer-output=html -analyzer-checker=core -o %t.dir %s
// RUN: ls %t.dir | not grep report
// RUN: rm -fR %t.dir

// This tests that we do not currently emit HTML diagnostics for reports that
// cross file boundaries.

#include "html-diags-multifile.h"

#define CALL_HAS_BUG(q) has_bug(q)

void test_call_macro() {
  CALL_HAS_BUG(0);
}

Fix test that wasn't testing anything

Fix test that wasn't testing anything

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


#include <stdio.h>
#include <unistd.h>
#include <errno.h>
#include <signal.h>
#include <stdlib.h>

#include "mraa.h"

#define thumb_f 8
#define index_f 9
#define middle_f 10
#define ring_f 11
#define pinky_f 12

int running = 0;

int
main(int argc, char** argv)
{
    mraa_result_t r = MRAA_SUCCESS;

    mraa_init();
    fprintf(stdout, "MRAA Version: %s\n", mraa_get_version());

    mraa_gpio_context gpio[5];
    gpio[0] = mraa_gpio_init(thumb_f);
    gpio[1] = mraa_gpio_init(index_f);
    gpio[2] = mraa_gpio_init(middle_f);
    gpio[3] = mraa_gpio_init(ring_f);
    gpio[4] = mraa_gpio_init(pinky_f);

    // set direction to OUT
    r = mraa_gpio_dir(gpio[0], MRAA_GPIO_OUT);
    r = mraa_gpio_dir(gpio[1], MRAA_GPIO_OUT);
    r = mraa_gpio_dir(gpio[2], MRAA_GPIO_OUT);
    r = mraa_gpio_dir(gpio[3], MRAA_GPIO_OUT);
    r = mraa_gpio_dir(gpio[4], MRAA_GPIO_OUT);

    while (running == 0) {
        mraa_gpio_write(gpio[0], 0);
        mraa_gpio_write(gpio[1], 0);
        mraa_gpio_write(gpio[2], 0);
        mraa_gpio_write(gpio[3], 0);
        mraa_gpio_write(gpio[4], 0);
        printf("off\n");

        sleep(1);
        mraa_gpio_write(gpio[0], 1);
        mraa_gpio_write(gpio[1], 1);
        mraa_gpio_write(gpio[2], 1);
        mraa_gpio_write(gpio[3], 1);
        mraa_gpio_write(gpio[4], 1);
        printf("on\n");

        sleep(1);
    }

    return r;
}

ADD - Added functional GPIO code to IMU folder


/*

 PKRevealController - Copyright (C) 2012 Philip Kluz (Philip.Kluz@zuui.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.

 */

#import <UIKit/UIKit.h>

@class PKRevealController;

@interface PKAppDelegate : UIResponder <UIApplicationDelegate>

@property (nonatomic, strong, readwrite) PKRevealController *revealController;
@property (strong, nonatomic) UIWindow *window;

@end

/*

 PKRevealController - Copyright (C) 2012 Philip Kluz (Philip.Kluz@zuui.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.

 */

#import <UIKit/UIKit.h>

@class PKRevealController;

@interface PKAppDelegate : UIResponder <UIApplicationDelegate>

@property (nonatomic, strong, readwrite) PKRevealController *revealController;
@property (nonatomic, strong) UIWindow *window;

@end

Use right order of nonatomic and strong

Use right order of nonatomic and strong


//
//  string.h
//  pgf+
//
//  Created by Emil Djupfeldt on 2012-06-25.
//  Copyright (c) 2012 Chalmers University of Technology. All rights reserved.
//

#ifndef pgf__string_h
#define pgf__string_h

#include <string>
#include <vector>

namespace gf {

    static inline std::vector<std::string> split(const std::string& str, char ch) {
        std::vector<std::string> ret;
        size_t last;
        size_t next;

        last = 0;
        while (true) {
            next = str.find(ch, last);
            if (next == std::string::npos) {
                ret.push_back(str.substr(last));
                break;
            }

            ret.push_back(str.substr(last, next - last));
            last = next + 1;
        }

        return ret;
    }

    static inline bool isWhiteSpace(char ch) {
        return ch == '\r' || ch == '\n' || ch == '\t' || ch == ' ';
    }

    static inline std::string trim(const std::string& str) {
        size_t start;
        size_t end;

        for (start = 0; start < str.size() ; start++) {
            if (!isWhiteSpace(str.at(start))) {
                break;
            }
        }

        for (end = str.size(); end > start; end--) {
            if (!isWhiteSpace(str.at(end - 1))) {
                end--;
                break;
            }
        }

        return str.substr(start, end - start);
    }

}

#endif

Add some string utility functions.

Add some string utility functions.


/*-
 * Copyright (c) 1998 David E. O'Brien
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 * 1. Redistributions of source code must retain the above copyright
 *    notice, this list of conditions and the following disclaimer.
 * 2. Redistributions in binary form must reproduce the above copyright
 *    notice, this list of conditions and the following disclaimer in the
 *    documentation and/or other materials provided with the distribution.
 *
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 * SUCH DAMAGE.
 *
 *	$Id$
 */

int dsinit(int, struct statinfo *, struct statinfo *, struct statinfo *);
int dscmd(char *, char *, int, struct statinfo *);

Add copyright and RCS/CVS Id.

Add copyright and RCS/CVS Id.

Noticed by:	ken


#include "org_bitcoin_NativeSecp256k1.h"
#include "include/secp256k1.h"

JNIEXPORT jint JNICALL Java_org_bitcoin_NativeSecp256k1_secp256k1_1ecdsa_1verify
  (JNIEnv* env, jclass classObject, jobject byteBufferObject)
{
	unsigned char* data = (unsigned char*) env->GetDirectBufferAddress(byteBufferObject);
	int sigLen = *((int*)(data + 32));
	int pubLen = *((int*)(data + 32 + 4));

	return secp256k1_ecdsa_verify(data, 32, data+32+8, sigLen, data+32+8+sigLen, pubLen);
}

static void __javasecp256k1_attach(void) __attribute__((constructor));
static void __javasecp256k1_detach(void) __attribute__((destructor));

static void __javasecp256k1_attach(void) {
	secp256k1_start();
}

static void __javasecp256k1_detach(void) {
	secp256k1_stop();
}

#include "org_bitcoin_NativeSecp256k1.h"
#include "include/secp256k1.h"

JNIEXPORT jint JNICALL Java_org_bitcoin_NativeSecp256k1_secp256k1_1ecdsa_1verify
  (JNIEnv* env, jclass classObject, jobject byteBufferObject)
{
	unsigned char* data = (unsigned char*) (*env)->GetDirectBufferAddress(env, byteBufferObject);
	int sigLen = *((int*)(data + 32));
	int pubLen = *((int*)(data + 32 + 4));

	return secp256k1_ecdsa_verify(data, 32, data+32+8, sigLen, data+32+8+sigLen, pubLen);
}

static void __javasecp256k1_attach(void) __attribute__((constructor));
static void __javasecp256k1_detach(void) __attribute__((destructor));

static void __javasecp256k1_attach(void) {
	secp256k1_start();
}

static void __javasecp256k1_detach(void) {
	secp256k1_stop();
}

Fix JNI for C instead of C++

Fix JNI for C instead of C++

(because apparently there is a significant difference...)


#pragma once

#include "MyImage.h"
#define MASK_SIZE 5

class Pixel {

private:
	BYTE blue;
	BYTE green;
	BYTE red;

public:
	Pixel(){
		blue;
		green;
		red;
	}
	~Pixel(){}

	BYTE GetBlue()	{ return blue;	}
	BYTE GetGreen() { return green;	}
	BYTE GetRed()	{ return red;	}
	void Set(int _b, int _g, int _r)
	{
		blue = _b;
		green = _g;
		red = _r;
	}
};

class CPixelProcessing
{
public:
	CPixelProcessing(CMyImage*, int, BYTE, BYTE);
	~CPixelProcessing(void){}

	CMyImage* start(BYTE**);

private:
	int nWidth;
	int nHeight;
	int nBitDepth;
	int nOutput;
	BYTE nHotVal;
	BYTE nDeadVal;

	CMyImage *pResult;

	BYTE** szResult;
	BYTE *temp;

	void _8bitImageCorrection(BYTE**);
	void _24bitImageCorrection(BYTE**);

	int GetMedian(vector<BYTE>);
	bool GetPixelState(int, int, int);
	bool GetPixelState(int, int, Pixel);
};

#pragma once

#include "MyImage.h"
#define MASK_SIZE 3

class Pixel {

private:
	BYTE blue;
	BYTE green;
	BYTE red;

public:
	Pixel(){
		blue;
		green;
		red;
	}
	~Pixel(){}

	BYTE GetBlue()	{ return blue;	}
	BYTE GetGreen() { return green;	}
	BYTE GetRed()	{ return red;	}
	void Set(int _b, int _g, int _r)
	{
		blue = _b;
		green = _g;
		red = _r;
	}
};

class CPixelProcessing
{
public:
	CPixelProcessing(CMyImage*, int, BYTE, BYTE);
	~CPixelProcessing(void){}

	CMyImage* start(BYTE**);

private:
	int nWidth;
	int nHeight;
	int nBitDepth;
	int nOutput;
	BYTE nHotVal;
	BYTE nDeadVal;

	CMyImage *pResult;

	BYTE** szResult;
	BYTE *temp;

	void _8bitImageCorrection(BYTE**);
	void _24bitImageCorrection(BYTE**);

	int GetMedian(vector<BYTE>);
	bool GetPixelState(int, int, int);
	bool GetPixelState(int, int, Pixel);
};

Change mask size from 5 to 3

Change mask size from 5 to 3