/*
Copyright (c) 2016, prpl Foundation

Permission to use, copy, modify, and/or distribute this software for any purpose with or without
fee is hereby granted, provided that the above copyright notice and this permission notice appear
in all copies.

THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE
INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE
FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.

This code was written by Carlos Moratelli at Embedded System Group (GSE) at PUCRS/Brazil.

*/

#ifndef __ARCH_H
#define __ARCH_H

#include <baikal-t1.h>

#endif

/*
Copyright (c) 2016, prpl Foundation

Permission to use, copy, modify, and/or distribute this software for any purpose with or without
fee is hereby granted, provided that the above copyright notice and this permission notice appear
in all copies.

THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE
INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE
FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.

This code was written by Carlos Moratelli at Embedded System Group (GSE) at PUCRS/Brazil.

*/

#ifndef __ARCH_H
#define __ARCH_H

#include <pic32mz.h>

#endif

Fix compilation error for pic32mz platform.


//Skillz dependencies.
#import <MobileCoreServices/MobileCoreServices.h>
#import <PassKit/PassKit.h>
#import <MediaPlayer/MediaPlayer.h>
#import <MessageUI/MessageUI.h>
#import <SystemConfiguration/SystemConfiguration.h>
#import <Social/Social.h>
#import <CoreBluetooth/CoreBluetooth.h>
#import <StoreKit/StoreKit.h>
#import <Accounts/Accounts.h>

//Skillz framework.
#import <SkillzSDK-iOS/SKillz.h>

//Skillz dependencies.
#import <MobileCoreServices/MobileCoreServices.h>
#import <PassKit/PassKit.h>
#import <MediaPlayer/MediaPlayer.h>
#import <MessageUI/MessageUI.h>
#import <SystemConfiguration/SystemConfiguration.h>
#import <Social/Social.h>
#import <CoreBluetooth/CoreBluetooth.h>
#import <StoreKit/StoreKit.h>
#import <Accounts/Accounts.h>

//Skillz framework.
#import <SkillzSDK-iOS/Skillz.h>

Fix typo in Skillz bridging header

Fix typo in Skillz bridging header


//Eventloop->post  (with delay = 0)
TRACEPOINT_EVENT(qi_qi, eventloop_post,
        TP_ARGS(unsigned int, taskId,
                const char*, typeName),
        TP_FIELDS(ctf_integer(int, taskId, taskId)
                  ctf_string(typeName, typeName)
                  )
)

//Eventloop->async && post with delay
TRACEPOINT_EVENT(qi_qi, eventloop_delay,
        TP_ARGS(unsigned int, taskId,
                const char*, typeName,
                unsigned int, usDelay),
        TP_FIELDS(ctf_integer(int, taskId, taskId)
                  ctf_string(typeName, typeName)
                  ctf_integer(int, usDelay, usDelay))
)

//task really start
TRACEPOINT_EVENT(qi_qi, eventloop_task_start,
        TP_ARGS(unsigned int, taskId),
        TP_FIELDS(ctf_integer(int, taskId, taskId))
)

//task stop
TRACEPOINT_EVENT(qi_qi, eventloop_task_stop,
        TP_ARGS(unsigned int, taskId),
        TP_FIELDS(ctf_integer(int, taskId, taskId))
)

//task has been cancelled before running
TRACEPOINT_EVENT(qi_qi, eventloop_task_cancel,
        TP_ARGS(unsigned int, taskId),
        TP_FIELDS(ctf_integer(int, taskId, taskId))
)

//task has been set on error
TRACEPOINT_EVENT(qi_qi, eventloop_task_error,
        TP_ARGS(unsigned int, taskId),
        TP_FIELDS(ctf_integer(int, taskId, taskId))
)

Fix compilation of eventloop with probes

Change-Id: Ia885584363de9070200a53acd80d48e3cbeda6fe
Reviewed-on: http://gerrit.aldebaran.lan/48421
Approved: hcuche <2a0975cc082cedff4d4350e3f6ec187146151bc6@aldebaran-robotics.com>
Reviewed-by: hcuche <2a0975cc082cedff4d4350e3f6ec187146151bc6@aldebaran-robotics.com>
Tested-by: hcuche <2a0975cc082cedff4d4350e3f6ec187146151bc6@aldebaran-robotics.com>


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

int g;

pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER;

void *t_fun(void *arg) {
  g++; // RACE!
  return NULL;
}

int main(void) {
  int x;
  pthread_t id;
  pthread_create(&id, NULL, t_fun, NULL);
  memset(&x, g, sizeof(int)); // RACE!
  pthread_join (id, NULL);
  return 0;
}

Add test with immediate int arg read access


/* Chapter 27, exercise 1: implement versions of strlen(), strcmp() and strcpy()
*/

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

size_t strlen(const char* s)
{
    size_t len = 0;
    while (*s++) ++len;
    return len;
}

int strcmp(const char* s1, const char* s2)
{
    const char* p1 = s1;
    const char* p2 = s2;
    while (*p1 && *p2 && *p1==*p2) {
        ++p1;
        ++p2;
    }
    if (*p1 > *p2)
        return 1;
    else if (*p1 < *p2)
        return -1;
    else    /* *p1 == *p2 */
        return 0;
}

char* strcpy(char* s1, const char* s2)
{
    char* p = s1;
    while (*s1++ = *s2++);
    return p;
}

void test_strcmp(const char* s1, const char* s2)
{
    int res = strcmp(s1,s2);
    if (res == 0)
        printf("'%s' and '%s' are equal\n",s1,s2);
    else if (res < 0)
        printf("'%s' is before '%s'\n",s1,s2);
    else    /* res > 0 */
        printf("'%s' is after '%s'\n",s1,s2);
}

void test_strcpy(char* s1, const char* s2)
{
    printf("Copy '%s' into '%s: ",s2,s1);
    strcpy(s1,s2);
    printf("%s\n",s1);
}

int main()
{
    char* s1 = "This is a string";
    size_t l1 = strlen(s1);
    printf("Length of '%s': %i\n",s1,l1);
    printf("Length of '': %i\n",strlen(""));

    printf("\n");
    char* s2_1 = "abc";
    test_strcmp(s2_1,s2_1);
    test_strcmp(s2_1,"");
    test_strcmp("",s2_1);
    test_strcmp("","");

    char* s2_2 = "abcd";
    test_strcmp(s2_1,s2_2);
    test_strcmp(s2_2,s2_1);

    char* s2_3 = "abd";
    test_strcmp(s2_2,s2_3);
    test_strcmp(s2_1,s2_3);

    printf("\n");
    char* s3_1 = "ABC";
    char* s3_2 = "abc";
    char* s3_3 = "ABCD";
    test_strcpy(s3_1,s3_2);
    test_strcpy(s3_3,s3_2);
    test_strcpy(s3_1,"");
    test_strcpy("","");
}

Add Chapter 27, exercise 1

Add Chapter 27, exercise 1


#ifndef UTILITIES_HLT
#define UTILITIES_HLT

#include <deal.II/base/utilities.h>
#include <deal.II/base/smartpointer.h>
#include <typeinfo>
#include <cxxabi.h>

using namespace dealii;

/**
 * SmartPointers are usually not used to point to objects created with
 * new. However, sometimes this is useful. The distruction of a
 * SmartPointer requires to split the step in two parts. This little
 * utility does precisely this.
 */
template <typename TYPE>
void smart_delete (SmartPointer<TYPE> &sp) {
    if(sp) {
        TYPE * p = sp;
        sp = 0;
        delete p;
    }
}

// Anonymous namespace, to hide implementation detail for the type
// function below
namespace {
struct handle {
    char* p;
    handle(char* ptr) : p(ptr) { }
    ~handle() {
        std::free(p);
    }
};

std::string demangle(const char* name) {
    int status = -4; // some arbitrary value to eliminate the compiler warning
    handle result( abi::__cxa_demangle(name, NULL, NULL, &status) );
    return (status==0) ? result.p : name ;
};
}

/**
 * Return a human readable name of the type passed as argument.
 */
template <class T>
std::string type(const T& t) {
    return demangle(typeid(t).name());
};

#endif

#ifndef UTILITIES_HLT
#define UTILITIES_HLT

#include <deal.II/base/utilities.h>
#include <deal.II/base/smartpointer.h>
#include <typeinfo>
#include <cxxabi.h>

using namespace dealii;

/**
 * SmartPointers are usually not used to point to objects created with
 * new. However, sometimes this is useful. The distruction of a
 * SmartPointer requires to split the step in two parts. This little
 * utility does precisely this.
 */
template <typename TYPE>
void smart_delete (SmartPointer<TYPE> &sp) {
    if(sp) {
        TYPE * p = sp;
        sp = 0;
        delete p;
    }
}

// Anonymous namespace, to hide implementation detail for the type
// function below
namespace {
struct handle {
    char* p;
    handle(char* ptr) : p(ptr) { }
    ~handle() {
        delete p;
    }
};

std::string demangle(const char* name) {
    int status = -4; // some arbitrary value to eliminate the compiler warning
    handle result( abi::__cxa_demangle(name, NULL, NULL, &status) );
    return (status==0) ? result.p : name ;
};
}

/**
 * Return a human readable name of the type passed as argument.
 */
template <class T>
std::string type(const T& t) {
    return demangle(typeid(t).name());
};

#endif

Put delete instead of free

Put delete instead of free


/******************************************************************************\
 * gloperate
 *
 * Copyright (C) 2014 Computer Graphics Systems Group at the
 * Hasso-Plattner-Institut (HPI), Potsdam, Germany.
\******************************************************************************/
#pragma once

#include <gloperate/gloperate_api.h>

#include <gloperate/capabilities/AbstractCapability.h>
#include <gloperate/base/RenderTarget.h>

namespace gloperate {

    enum class RenderTargetType {
        Color,
        Depth,
        Normal,
        Geometry
    };

/**
*  @brief
*
*/
class GLOPERATE_API AbstractTypedRenderTargetCapability  : public AbstractCapability
{

public:
    /**
    *  @brief
    *    Constructor
    */
    AbstractTypedRenderTargetCapability();

    /**
    *  @brief
    *    Destructor
    */
    virtual ~AbstractTypedRenderTargetCapability();

    virtual const RenderTarget & renderTarget(RenderTargetType type) = 0;
    virtual bool hasRenderTarget(RenderTargetType type) = 0;

protected:

};

} // namespace gloperate

/******************************************************************************\
 * gloperate
 *
 * Copyright (C) 2014 Computer Graphics Systems Group at the
 * Hasso-Plattner-Institut (HPI), Potsdam, Germany.
\******************************************************************************/
#pragma once

#include <gloperate/gloperate_api.h>

#include <gloperate/capabilities/AbstractCapability.h>
#include <gloperate/base/RenderTarget.h>

namespace gloperate {

    enum class RenderTargetType {
        Color,
        Depth,
        Normal,
        Geometry,
        ObjectID
    };

/**
*  @brief
*
*/
class GLOPERATE_API AbstractTypedRenderTargetCapability  : public AbstractCapability
{

public:
    /**
    *  @brief
    *    Constructor
    */
    AbstractTypedRenderTargetCapability();

    /**
    *  @brief
    *    Destructor
    */
    virtual ~AbstractTypedRenderTargetCapability();

    virtual const RenderTarget & renderTarget(RenderTargetType type) = 0;
    virtual bool hasRenderTarget(RenderTargetType type) = 0;

protected:

};

} // namespace gloperate

Add ObjectID to RenderTargetType enum

Add ObjectID to RenderTargetType enum


/**
 * @file platform-local.h
 *
 */

#ifndef _ARM_QEMU_PLATFORM_LOCAL_H
#define _ARM_QEMU_PLATFORM_LOCAL_H

/*
 * The fluke-arm platform has so little memory that the global default
 * of 64k for INITSTK is too big. Try something more conservativer.
 */
#define INITSTK (1337)

#endif /* _ARM_QEMU_PLATFORM_LOCAL_H */

/**
 * @file platform-local.h
 *
 */

#ifndef _ARM_QEMU_PLATFORM_LOCAL_H
#define _ARM_QEMU_PLATFORM_LOCAL_H

#endif /* _ARM_QEMU_PLATFORM_LOCAL_H */

Use the default stack size

arm-qeum: Use the default stack size

Because we have a lot more ram than the fluke-arm port had, we can
afford to use the default platform-independent stack size.


//===- llvm/Transforms/PrintModulePass.h - Printing Pass ---------*- C++ -*--=//
//
// This file defines a simple pass to print out methods of a module as they are
// processed.
//
//===----------------------------------------------------------------------===//

#ifndef LLVM_TRANSFORMS_PRINTMODULE_H
#define LLVM_TRANSFORMS_PRINTMODULE_H

#include "llvm/Transforms/Pass.h"
#include "llvm/Assembly/Writer.h"

class PrintModulePass : public Pass {
  string Banner;          // String to print before each method
  ostream *Out;           // ostream to print on
  bool DeleteStream;      // Delete the ostream in our dtor?
public:
  inline PrintModulePass(const string &B, ostream *o = &cout, bool DS = false)
    : Banner(B), Out(o), DeleteStream(DS) {}

  ~PrintModulePass() {
    if (DeleteStream) delete Out;
  }

  // doPerMethodWork - This pass just prints a banner followed by the method as
  // it's processed.
  //
  bool doPerMethodWork(Method *M) {
    (*Out) << Banner << M;
    return false;
  }
};

#endif

//===- llvm/Transforms/PrintModulePass.h - Printing Pass ---------*- C++ -*--=//
//
// This file defines a simple pass to print out methods of a module as they are
// processed.
//
//===----------------------------------------------------------------------===//

#ifndef LLVM_TRANSFORMS_PRINTMODULE_H
#define LLVM_TRANSFORMS_PRINTMODULE_H

#include "llvm/Transforms/Pass.h"
#include "llvm/Assembly/Writer.h"
#include "llvm/Bytecode/Writer.h"

class PrintModulePass : public Pass {
  string Banner;          // String to print before each method
  ostream *Out;           // ostream to print on
  bool DeleteStream;      // Delete the ostream in our dtor?
  bool PrintAsBytecode;   // Print as bytecode rather than assembly?
public:
  inline PrintModulePass(const string &B, ostream *o = &cout, bool DS = false,
                         bool printAsBytecode = false)
    : Banner(B), Out(o), DeleteStream(DS), PrintAsBytecode(printAsBytecode) {}

  ~PrintModulePass() {
    if (DeleteStream) delete Out;
  }

  // doPerMethodWork - This pass just prints a banner followed by the method as
  // it's processed.
  //
  bool doPerMethodWork(Method *M) {
    if (! PrintAsBytecode)
      (*Out) << Banner << M;
    return false;
  }

  // doPassFinalization - Virtual method overriden by subclasses to do any post
  // processing needed after all passes have run.
  //
  bool doPassFinalization(Module *M) {
    if (PrintAsBytecode)
      WriteBytecodeToFile(M, *Out);
    return false;
  }
};

#endif

Add option to print as bytecode instead of assembly.

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


// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.

#pragma once

#include "i_hw_info.h"

namespace vespalib {

/*
 * class describing some hardware on the machine.
 */
class HwInfo : public IHwInfo
{
    bool _spinningDisk;
public:
    HwInfo();
    virtual ~HwInfo();
    virtual bool spinningDisk() const override;
};

}

// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.

#pragma once

#include "i_hw_info.h"

namespace vespalib {

/*
 * Class describing some hardware on the machine.
 */
class HwInfo : public IHwInfo
{
    bool _spinningDisk;
public:
    HwInfo();
    virtual ~HwInfo();
    virtual bool spinningDisk() const override;
};

}

Use proper uppercase at start of comment.


/*************************************************************************/
/* Copyright (c) 2004                                                    */
/* Daniel Sleator, David Temperley, and John Lafferty                    */
/* All rights reserved                                                   */
/*                                                                       */
/* Use of the link grammar parsing system is subject to the terms of the */
/* license set forth in the LICENSE file included with this software.    */
/* This license allows free redistribution and use in source and binary  */
/* forms, with or without modification, subject to certain conditions.   */
/*                                                                       */
/*************************************************************************/

#ifndef _EXTERNS_H
#define _EXTERNS_H
/* verbosity global is held in utilities.c */
extern int verbosity;          /* the verbosity level for error messages */
extern char * debug;           /* comma-separated function list to debug */
extern char * test;            /* comma-separated function list to debug */
#endif /* _EXTERNS_H */

/*************************************************************************/
/* Copyright (c) 2004                                                    */
/* Daniel Sleator, David Temperley, and John Lafferty                    */
/* All rights reserved                                                   */
/*                                                                       */
/* Use of the link grammar parsing system is subject to the terms of the */
/* license set forth in the LICENSE file included with this software.    */
/* This license allows free redistribution and use in source and binary  */
/* forms, with or without modification, subject to certain conditions.   */
/*                                                                       */
/*************************************************************************/

#ifndef _EXTERNS_H
#define _EXTERNS_H
/* verbosity global is held in utilities.c */
extern int verbosity;          /* the verbosity level for error messages */
extern char * debug;           /* comma-separated functions/files to debug */
extern char * test;            /* comma-separated features to test */
#endif /* _EXTERNS_H */

Fix global variable description comments.


// bindgen-flags: --default-enum-style rust_non_exhaustive --raw-line '#![cfg(feature = "nightly")]' --raw-line '#![feature(non_exhaustive)]'

enum Planet {
    earth,
    mars
};

// bindgen-flags: --default-enum-style rust_non_exhaustive --rust-target nightly --raw-line '#![cfg(feature = "nightly")]' --raw-line '#![feature(non_exhaustive)]'

enum Planet {
    earth,
    mars
};

Add missing --rust-target flags on test case.

See https://github.com/rust-lang/rust-bindgen/pull/1575#discussion_r293079226


/*
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */

/**
 * @file   linux/include/stdint.h
 * @brief  Define the uintX_t types for the Linux kernel
 * @author Didier Barvaux <didier.barvaux@toulouse.viveris.com>
 */

#ifndef STDINT_H_
#define STDINT_H_

#ifndef __KERNEL__
#	error "for Linux kernel only!"
#endif

#include <linux/types.h>

typedef u_int8_t uint8_t;
typedef u_int16_t uint16_t;
typedef u_int32_t uint32_t;

#endif /* STDINT_H_ */

/*
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */

/**
 * @file   linux/include/stdint.h
 * @brief  Define the uintX_t types for the Linux kernel
 * @author Didier Barvaux <didier.barvaux@toulouse.viveris.com>
 */

#ifndef STDINT_H_
#define STDINT_H_

#ifndef __KERNEL__
#	error "for Linux kernel only!"
#endif

#include <linux/types.h>

#endif /* STDINT_H_ */

Fix build of the Linux kernel module on ARM.


//=================================================================================================
/*!
//  \file blaze/math/proxy/Forward.h
//  \brief Header file for all forward declarations for proxies
//
//  Copyright (C) 2013 Klaus Iglberger - All Rights Reserved
//
//  This file is part of the Blaze library. You can redistribute it and/or modify it under
//  the terms of the New (Revised) BSD License. Redistribution and use in source and binary
//  forms, with or without modification, are permitted provided that the following conditions
//  are met:
//
//  1. Redistributions of source code must retain the above copyright notice, this list of
//     conditions and the following disclaimer.
//  2. Redistributions in binary form must reproduce the above copyright notice, this list
//     of conditions and the following disclaimer in the documentation and/or other materials
//     provided with the distribution.
//  3. Neither the names of the Blaze development group nor the names of its contributors
//     may be used to endorse or promote products derived from this software without specific
//     prior written permission.
//
//  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
//  EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
//  OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
//  SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
//  INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
//  TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
//  BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
//  CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
//  ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
//  DAMAGE.
*/
//=================================================================================================

#ifndef _BLAZE_MATH_PROXY_FORWARD_H_
#define _BLAZE_MATH_PROXY_FORWARD_H_

namespace blaze {

//=================================================================================================
//
//  ::blaze NAMESPACE FORWARD DECLARATIONS
//
//=================================================================================================

template< typename, typename > class ComplexProxy;
template< typename, typename > class DefaultProxy;
template< typename, typename > class DenseMatrixProxy;
template< typename, typename > class DenseVectorProxy;
template< typename, typename > class Proxy;
template< typename, typename > class SparseMatrixProxy;
template< typename, typename > class SparseVectorProxy;

} // namespace blaze

#endif

Add forward declarations for all proxies


#include "widgets.h"
#include "external_ip.h"

static int
widget_external_ip_send_update () {
	char *external_ip = wkline_curl_request(wkline_widget_external_ip_address);

	json_t *json_data_object = json_object();
	char *json_payload;

	json_object_set_new(json_data_object, "ip", json_string("ip"));

	json_payload = json_dumps(json_data_object, 0);

	widget_data_t *widget_data = malloc(sizeof(widget_data_t) + 4096);
	widget_data->widget = "external_ip";
	widget_data->data = json_payload;
	g_idle_add((GSourceFunc)update_widget, widget_data);

	free(external_ip);

	return 0;
}

void
*widget_external_ip () {
	for (;;) {
		widget_external_ip_send_update();

		sleep(600);
	}

	return 0;
}

#include "widgets.h"
#include "external_ip.h"

static int
widget_external_ip_send_update () {
	char *external_ip = wkline_curl_request(wkline_widget_external_ip_address);

	json_t *json_data_object = json_object();
	char *json_payload;

	json_object_set_new(json_data_object, "ip", json_string(external_ip));

	json_payload = json_dumps(json_data_object, 0);

	widget_data_t *widget_data = malloc(sizeof(widget_data_t) + 4096);
	widget_data->widget = "external_ip";
	widget_data->data = json_payload;
	g_idle_add((GSourceFunc)update_widget, widget_data);

	free(external_ip);

	return 0;
}

void
*widget_external_ip () {
	for (;;) {
		widget_external_ip_send_update();

		sleep(600);
	}

	return 0;
}

Fix error in external IP widget

Fix error in external IP widget


#pragma once

#include <QtWidgets>
#include <QMediaPlayer>

class MediaControls : public QWidget
{
    Q_OBJECT

public:
    MediaControls(QWidget *parent = 0);

    QMediaPlayer::State state() const;
    int volume() const;
    bool isMuted();

public slots:
    void setState(QMediaPlayer::State state);
    void setVolume(int volume);
    void setMuted(bool muted);

signals:
    void play();
    void pause();
    void stop();
    void next();
    void previous();
    void changeVolume(int volume);
    void changeMuting(bool muting);

private slots:
    void playClicked();
    void muteClicked();
    void onVolumeSliderValueChanged();

private:
    QMediaPlayer::State playerState;
    bool playerMuted;
    QPushButton *playButton;
    QPushButton *stopButton;
    QPushButton *nextButton;
    QPushButton *previousButton;
    QPushButton *muteButton;
    QSlider *volumeSlider;

};

#pragma once

#include <QtWidgets>
#include <QMediaPlayer>

class MediaControls : public QWidget
{
    Q_OBJECT

public:
    MediaControls(QWidget *parent = 0);

    QMediaPlayer::State state() const;
    int volume() const;
    bool isMuted();

public slots:
    void setState(QMediaPlayer::State state);
    void setVolume(int volume);
    void setMuted(bool muted);

signals:
    void play();
    void pause();
    void stop();
    void next();
    void previous();
    void changeVolume(int volume);
    void changeMuting(bool muting);
    void valueChanged(int);

private slots:
    void playClicked();
    void muteClicked();
    void onVolumeSliderValueChanged();

private:
    QMediaPlayer::State playerState;
    bool playerMuted;
    QPushButton *playButton;
    QPushButton *stopButton;
    QPushButton *nextButton;
    QPushButton *previousButton;
    QPushButton *muteButton;
    QSlider *volumeSlider;

};

Add one slot for changed value

Add one slot for changed value


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

int main (int argc, char *argv[]){
    if(argc != 3){
        printf("Number of parameters should be 2 (filename, cardinality).");
        exit(1);
    }

    //open file and get file length
    FILE *file;
    file = fopen(argv[1],"r");
    if(file == NULL){
        printf("File couldn't be opened.");
        exit(1);
    }
    fseek(file, 0, SEEK_END);
    int fileLength = ftell(file);
    fseek(file, 0, SEEK_SET);

    //save data from file to array
    char inputStream[fileLength];
    //printf("length: %d \n", fileLength);
    int i = 0;
    int character;
    while((character = fgetc(file)) != EOF){
            inputStream[i] = character;
            i++;
            }
    /*int j;
    for(j=0; j < fileLength; j++){
        char a = inputStream[j];
        printf("Znak: %c \n", a);
    }*/

    fclose(file);
}

Read file and save data to array

Read file and save data to array


#ifndef CHC_NARROWPHASE_H
#define CHC_NARROWPHASE_H

#include "chrono_parallel/ChParallelDefines.h"
#include "chrono_parallel/ChDataManager.h"

namespace chrono {
namespace collision {

struct ConvexShape {
   shape_type type;  //type of shape
   real3 A;  //location
   real3 B;  //dimensions
   real3 C;  //extra
   quaternion R;  //rotation
   real3* convex;      // pointer to convex data;
};

}  // end namespace collision
}  // end namespace chrono

#endif

#ifndef CHC_NARROWPHASE_H
#define CHC_NARROWPHASE_H

#include "chrono_parallel/ChParallelDefines.h"
#include "chrono_parallel/ChDataManager.h"

namespace chrono {
namespace collision {

struct ConvexShape {
   shape_type type;  //type of shape
   real3 A;  //location
   real3 B;  //dimensions
   real3 C;  //extra
   quaternion R;  //rotation
   real3* convex;      // pointer to convex data;
   real margin;
   ConvexShape():margin(0.04){}
};

}  // end namespace collision
}  // end namespace chrono

#endif

Add a collision margin to each shape Margins are one way to improve stability of contacts. Only the GJK solver will use these initially


// RUN: clang-cc %s -E | grep "movl %eax"

#define R1E %eax
#define epilogue(r1) movl r1;
epilogue(R1E)

// RUN: clang-cc %s -E | grep "movl %eax"
// PR4132
#define R1E %eax
#define epilogue(r1) movl r1 ## E;
epilogue(R1)

Fix the testcase for PR4132.

Fix the testcase for PR4132.

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


//===- llvm/Bytecode/WriteBytecodePass.h - Bytecode Writer Pass --*- C++ -*--=//
//
// This file defines a simple pass to write the working module to a file after
// pass processing is completed.
//
//===----------------------------------------------------------------------===//

#ifndef LLVM_BYTECODE_WRITEBYTECODEPASS_H
#define LLVM_BYTECODE_WRITEBYTECODEPASS_H

#include "llvm/Pass.h"
#include "llvm/Bytecode/Writer.h"
#include <iostream>

class WriteBytecodePass : public Pass {
  std::ostream *Out;           // ostream to print on
  bool DeleteStream;
public:
  inline WriteBytecodePass(std::ostream *o = &std::cout, bool DS = false)
    : Out(o), DeleteStream(DS) {
  }

  const char *getPassName() const { return "Bytecode Writer"; }

  inline ~WriteBytecodePass() {
    if (DeleteStream) delete Out;
  }

  bool run(Module &M) {
    WriteBytecodeToFile(&M, *Out);
    return false;
  }
};

#endif

//===- llvm/Bytecode/WriteBytecodePass.h - Bytecode Writer Pass --*- C++ -*--=//
//
// This file defines a simple pass to write the working module to a file after
// pass processing is completed.
//
//===----------------------------------------------------------------------===//

#ifndef LLVM_BYTECODE_WRITEBYTECODEPASS_H
#define LLVM_BYTECODE_WRITEBYTECODEPASS_H

#include "llvm/Pass.h"
#include "llvm/Bytecode/Writer.h"
#include <iostream>

class WriteBytecodePass : public Pass {
  std::ostream *Out;           // ostream to print on
  bool DeleteStream;
public:
  WriteBytecodePass() : Out(&std::cout), DeleteStream(false) {}
  WriteBytecodePass(std::ostream *o, bool DS = false)
    : Out(o), DeleteStream(DS) {
  }

  inline ~WriteBytecodePass() {
    if (DeleteStream) delete Out;
  }

  bool run(Module &M) {
    WriteBytecodeToFile(&M, *Out);
    return false;
  }
};

#endif

Add a version of the bytecode writer pass that has a default ctor

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


/*
 * 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 68
#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 69
#endif

Update Skia milestone to 69

Update Skia milestone to 69

TBR=reed@google.com

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


#ifndef SAUCE_SAUCE_EXCEPTIONS_H_
#define SAUCE_SAUCE_EXCEPTIONS_H_

#include <stdexcept>

namespace sauce {

/**
 * Raised when no binding can be found for a given interface.
 *
 * TODO sure would be nice to know who..
 */
struct UnboundException:
  public std::runtime_error {
  UnboundException():
    std::runtime_error("Request for unbound interface.") {}
};

}

#endif // ifndef SAUCE_SAUCE_EXCEPTIONS_H_

#ifndef SAUCE_SAUCE_EXCEPTIONS_H_
#define SAUCE_SAUCE_EXCEPTIONS_H_

#include <string>
#include <stdexcept>

namespace sauce {

/**
 * Base class for all sauce exceptions.
 */
struct Exception: std::runtime_error {
  Exception(std::string message):
    std::runtime_error(message) {}
};

/**
 * Raised when no binding can be found for a given interface.
 *
 * TODO sure would be nice to know who..
 */
struct UnboundException: Exception {
  UnboundException():
    Exception("Request for unbound interface.") {}
};

/**
 * Raised when a cycle is found in the interface's dependencies.
 *
 * TODO sure would be nice to know what the cycle is..
 */
struct CircularDependencyException: Exception {
  CircularDependencyException():
    Exception("Request for unbound interface.") {}
};

}

#endif // ifndef SAUCE_SAUCE_EXCEPTIONS_H_

Add a circular dependency exception.

Add a circular dependency exception.

Also break out an exception base type.


//
// Created by Hippo on 9/13/2016.
//

#ifndef IMAGE_IMAGE_DECODER_H
#define IMAGE_IMAGE_DECODER_H

#include "com_hippo_image_BitmapDecoder.h"

#define IMAGE_CONFIG_INVALID   -1;
#define IMAGE_CONFIG_AUTO      com_hippo_image_BitmapDecoder_CONFIG_AUTO
#define IMAGE_CONFIG_RGB_565   com_hippo_image_BitmapDecoder_CONFIG_RGB_565
#define IMAGE_CONFIG_RGBA_8888 com_hippo_image_BitmapDecoder_CONFIG_RGBA_8888

inline bool is_explicit_config(int32_t config) {
  return config == IMAGE_CONFIG_RGB_565 || config == IMAGE_CONFIG_RGBA_8888;
}

inline uint32_t get_depth_for_config(int32_t config) {
  switch (config) {
    case IMAGE_CONFIG_RGB_565:
      return 2;
    case IMAGE_CONFIG_RGBA_8888:
      return 4;
    default:
      return 0;
  }
}

#endif //IMAGE_IMAGE_DECODER_H

//
// Created by Hippo on 9/13/2016.
//

#ifndef IMAGE_IMAGE_DECODER_H
#define IMAGE_IMAGE_DECODER_H

#include "com_hippo_image_BitmapDecoder.h"

#define IMAGE_CONFIG_INVALID   -1;
#define IMAGE_CONFIG_AUTO      com_hippo_image_BitmapDecoder_CONFIG_AUTO
#define IMAGE_CONFIG_RGB_565   com_hippo_image_BitmapDecoder_CONFIG_RGB_565
#define IMAGE_CONFIG_RGBA_8888 com_hippo_image_BitmapDecoder_CONFIG_RGBA_8888

static inline bool is_explicit_config(int32_t config) {
  return config == IMAGE_CONFIG_RGB_565 || config == IMAGE_CONFIG_RGBA_8888;
}

static inline uint32_t get_depth_for_config(int32_t config) {
  switch (config) {
    case IMAGE_CONFIG_RGB_565:
      return 2;
    case IMAGE_CONFIG_RGBA_8888:
      return 4;
    default:
      return 0;
  }
}

#endif //IMAGE_IMAGE_DECODER_H

Fix undefined references in linker

Fix undefined references in linker


#pragma once

#define PRINT_QUEUE_INFOS 0
#define PRINT_FRAME_UPLOAD_INFOS 0
#define PRINT_MEMORY_STATS 0
#define PRINT_FRAME_DROPS 0
#define PRINT_VIDEO_REFRESH 0
#define PRINT_VIDEO_DELAY 0
#define PRINT_CLOCKS 0
#define PRINT_PTS 0
#define PRINT_FPS 0

// Rendering mode (Hardware or Software)
#define USE_HARDWARE_RENDERING 1

// Hardware rendering
#define USE_GLSL_IMAGE_FORMAT_DECODING 1 // Use GLSL to decode image planes (Much faster than software decoding)
#define USE_GL_PBO 1 // Use OpenGL Pixel Buffer Objects (Faster CPU -> GPU transfer)
#define USE_GL_BLENDING 1 // Use OpenGL Blending (Only useful to disable, when debugging text rendering)
#define USE_GL_RECTANGLE_TEXTURES 1 // Use GL_TEXTURE_RECTANGLE instead of GL_TEXTURE_2D

// Software rendering
#define USE_FLIP_V_PICTURE_IN_SOFTWARE 0 // We need to detect this, when to flip and when not to flip

// Global
#define USE_FFMPEG_STATIC_LINKING 0 // Use static or runtime linking of FFMPEG (Useful to test if function signatures has been changed)
#define USE_FFMPEG_SOFTWARE_CONVERSION 1 // Convert video frames using sws_scale or using our own implementation, which is limited to type AV_PIX_FMT_YUV420P

#pragma once

#define PRINT_QUEUE_INFOS 0
#define PRINT_FRAME_UPLOAD_INFOS 0
#define PRINT_MEMORY_STATS 0
#define PRINT_FRAME_DROPS 0
#define PRINT_VIDEO_REFRESH 0
#define PRINT_VIDEO_DELAY 0
#define PRINT_CLOCKS 0
#define PRINT_PTS 0
#define PRINT_FPS 0

// Rendering mode (Hardware or Software)
#define USE_HARDWARE_RENDERING 1

// Hardware rendering
#define USE_GLSL_IMAGE_FORMAT_DECODING 1 // Use GLSL to decode image planes (Much faster than software decoding)
#define USE_GL_PBO 1 // Use OpenGL Pixel Buffer Objects (Faster CPU -> GPU transfer)
#define USE_GL_BLENDING 1 // Use OpenGL Blending (Only useful to disable, when debugging text rendering)
#define USE_GL_RECTANGLE_TEXTURES 1 // Use GL_TEXTURE_RECTANGLE instead of GL_TEXTURE_2D

// Software rendering
#define USE_FLIP_V_PICTURE_IN_SOFTWARE 0 // We need to detect this, when to flip and when not to flip

// Global
#define USE_FFMPEG_STATIC_LINKING 0 // Use static or runtime linking of FFMPEG (Useful to test if function signatures has been changed)
#define USE_FFMPEG_SOFTWARE_CONVERSION 0 // Convert video frames using sws_scale or using our own implementation, which is limited to type AV_PIX_FMT_YUV420P

Disable ffmpeg software conversion in define


#include <stdio.h>
#include <stdlib.h>
#include "chpl_rt_utils_static.h"
#include "chpl-comm.h"
#include "chplexit.h"
#include "chpl-mem.h"
#include "chplmemtrack.h"
#include "chplrt.h"
#include "gdb.h"

#undef exit

static void chpl_exit_common(int status, int all) {
  fflush(stdout);
  fflush(stderr);
  if (status != 0) {
    gdbShouldBreakHere();
  }
  if (all) {
    chpl_comm_barrier("chpl_comm_exit_all");
    chpl_comm_stopPollingTask();
    chpl_task_exit();
    chpl_reportMemInfo();
    chpl_mem_exit();
    chpl_comm_exit_all(status);
  } else {
    chpl_mem_exit();
    chpl_comm_exit_any(status);
  }
  exit(status);
}

void chpl_exit_all(int status) {
  chpl_exit_common(status, 1);
}

void chpl_exit_any(int status) {
  chpl_exit_common(status, 0);
}

#include <stdio.h>
#include <stdlib.h>
#include "chpl_rt_utils_static.h"
#include "chpl-comm.h"
#include "chplexit.h"
#include "chpl-mem.h"
#include "chplmemtrack.h"
#include "chplrt.h"
#include "gdb.h"

#undef exit

static void chpl_exit_common(int status, int all) {
  fflush(stdout);
  fflush(stderr);
  if (status != 0) {
    gdbShouldBreakHere();
  }
  if (all) {
    chpl_comm_barrier("chpl_exit_common");
    chpl_comm_stopPollingTask();
    chpl_task_exit();
    chpl_reportMemInfo();
    chpl_mem_exit();
    chpl_comm_exit_all(status);
  } else {
    chpl_mem_exit();
    chpl_comm_exit_any(status);
  }
  exit(status);
}

void chpl_exit_all(int status) {
  chpl_exit_common(status, 1);
}

void chpl_exit_any(int status) {
  chpl_exit_common(status, 0);
}

Clarify the debug message that may be generated by the
chpl_comm_barrier() call in chpl_exit_common().

git-svn-id: 88467cb1fb04b8a755be7e1ee1026be4190196ef@19217 3a8e244f-b0f2-452b-bcba-4c88e055c3ca


#ifndef LOGGING_H
#define LOGGING_H

#ifndef __ANDROID__
#define ELPP_STACKTRACE_ON_CRASH
#endif

#define ELPP_NO_DEFAULT_LOG_FILE

#include "vendor/easylogging++.h"

#define INITIALIZE_LOGGING INITIALIZE_EASYLOGGINGPP

namespace sensekit {
    void initialize_logging(const char* logFilePath);
}

#endif /* LOGGING_H */

#ifndef LOGGING_H
#define LOGGING_H

#ifdef __ANDROID__
#define ELPP_DISABLE_DEFAULT_CRASH_HANDLING
#else // not android
#define ELPP_STACKTRACE_ON_CRASH
#endif

#define ELPP_NO_DEFAULT_LOG_FILE

#include "vendor/easylogging++.h"

#define INITIALIZE_LOGGING INITIALIZE_EASYLOGGINGPP

namespace sensekit {
    void initialize_logging(const char* logFilePath);
}

#endif /* LOGGING_H */

Disable logger crash handling on Android


#include <check.h>
#include "../src/stack_using_array/stack.h"

stack st;

void setup() {
    init(&st);
}

void teardown() {
}

START_TEST( test_push_pop_normal_ops )
{
    push( &st, 10 );
    push( &st, 12 );
    ck_assert_int_eq( pop( &st ), 12 );
    ck_assert_int_eq( pop( &st ), 10 );
}
END_TEST

START_TEST( test_pop_underflow )
{
    push( &st, 12 );
    ck_assert_int_eq( pop( &st ), 12 );
    ck_assert_int_eq( pop( &st ), -2 );
}
END_TEST

START_TEST( test_push_overflow )
{
    push( &st, 2 );
    push( &st, 3 );
    push( &st, 4 );
    push( &st, 5 );
    push( &st, 6 );
    ck_assert_int_eq( push( &st, 7 ), -3 );
}
END_TEST

START_TEST( test_null_pointer )
{
    ck_assert_int_eq( init( NULL ), -1 );
    ck_assert_int_eq( push( NULL, 10 ), -1 );
    ck_assert_int_eq( pop( NULL ), -1 );
    ck_assert_int_eq( peek( NULL ), -1 );
}
END_TEST

Suite * stack_suite(void)
{
    Suite *s;
    TCase *tc_core, *tc_abnormal;

    s = suite_create("Stack");

    /* Core test case */
    tc_core = tcase_create("Core");
    /* Abnormal test case */
    tc_abnormal = tcase_create("Abnormal");

    tcase_add_checked_fixture(tc_core, setup, teardown);
    tcase_add_checked_fixture(tc_abnormal, setup, teardown);
    tcase_add_test(tc_core, test_push_pop_normal_ops);
    tcase_add_test(tc_abnormal, test_push_overflow);
    tcase_add_test(tc_abnormal, test_pop_underflow);
    tcase_add_test(tc_abnormal, test_null_pointer);
    suite_add_tcase(s, tc_core);
    suite_add_tcase(s, tc_abnormal);

    return s;
}

int main()
{
    int number_failed;
    Suite *s;
    SRunner *sr;

    s = stack_suite();
    sr = srunner_create(s);

    srunner_run_all(sr, CK_NORMAL);
    number_failed = srunner_ntests_failed(sr);
    srunner_free(sr);
    return (number_failed == 0) ? EXIT_SUCCESS : EXIT_FAILURE;
}

Test for stack using array

Test for stack using array


#pragma once

#include <cstddef>
#include <condition_variable>
#include <mutex>
#include <queue>

namespace log {

template<typename T>
class LogQueue final {
public:
    explicit LogQueue(size_t capacity) : m_capacity(capacity) {}
    ~LogQueue() = default;
    LogQueue(const LogQueue&) = delete;
    LogQueue& operator=(const LogQueue&) = delete;

    void Push(T&& element) {
        std::unique_lock<std::mutex> lock(m_mutex);
        while (m_queue.size() + 1 > m_capacity) { // is full
            m_notfull.wait(lock);
        }
        m_queue.push(std::move(element));
        m_notempty.notify_one();
    }

    void Pop(T* element) {
        std::unique_lock<std::mutex> lock(m_mutex);
        while (m_queue.empty()) { // is empty
            m_notempty.wait(lock);
        }
        if (element != nullptr) {
            *element = std::move(m_queue.front());
        }
        m_queue.pop();
        m_notfull.notify_one();
    }

private:
    const size_t m_capacity;
    std::queue<T> m_queue;
    std::mutex m_mutex;
    std::condition_variable m_notfull;
    std::condition_variable m_notempty;
};

} // namespace log

#pragma once

#include <cstddef>
#include <condition_variable>
#include <mutex>
#include <queue>

namespace log {

template<typename T>
class LogQueue final {
public:
    explicit LogQueue(size_t capacity) : m_capacity(capacity) {}
    ~LogQueue() = default;
    LogQueue(const LogQueue&) = delete;
    LogQueue& operator=(const LogQueue&) = delete;

    void Push(T&& element) {
        std::unique_lock<std::mutex> lock(m_mutex);
        while (isFull()) {
            m_notfull.wait(lock);
        }
        bool wasEmpty = isEmpty();
        m_queue.push(std::move(element));
        if (wasEmpty) {
            m_notempty.notify_one();
        }
    }

    void Pop(T* element) {
        std::unique_lock<std::mutex> lock(m_mutex);
        while (isEmpty()) {
            m_notempty.wait(lock);
        }
        bool wasFull = isFull();
        if (element != nullptr) {
            *element = std::move(m_queue.front());
        }
        m_queue.pop();
        if (wasFull) {
            m_notfull.notify_one();
        }
    }

private:
    const size_t m_capacity;
    std::queue<T> m_queue;
    std::mutex m_mutex;
    std::condition_variable m_notfull;
    std::condition_variable m_notempty;

    bool isEmpty() {
        return m_queue.empty();
    }

    bool isFull() {
        return m_queue.size() + 1 > m_capacity;
    }
};

} // namespace log

Decrease the number of notify_one calls

optimize: Decrease the number of notify_one calls


#ifndef __CR_ASM_GENERIC_STRING_H__
#define __CR_ASM_GENERIC_STRING_H__

#include "compiler.h"

#ifndef HAS_BUILTIN_MEMCPY
static always_inline void *builtin_memcpy(void *to, const void *from, unsigned int n)
{
	int i;
	unsigned char *cto = to;
	const unsigned char *cfrom = from;

	for (i = 0; i < n; ++i, ++cto, ++cfrom) {
		*cto = *cfrom;
	}

	return to;
}
#endif

#endif /* __CR_ASM_GENERIC_STRING_H__ */

#ifndef __CR_ASM_GENERIC_STRING_H__
#define __CR_ASM_GENERIC_STRING_H__

#include "compiler.h"

#ifndef HAS_BUILTIN_MEMCPY
static always_inline void *builtin_memcpy(void *to, const void *from, unsigned int n)
{
	int i;
	unsigned char *cto = to;
	const unsigned char *cfrom = from;

	for (i = 0; i < n; ++i, ++cto, ++cfrom) {
		*cto = *cfrom;
	}

	return to;
}
#endif

#ifndef HAS_BUILTIN_MEMCMP
static always_inline int builtin_memcmp(const void *cs, const void *ct, size_t count)
{
	const unsigned char *su1, *su2;
	int res = 0;

	for (su1 = cs, su2 = ct; 0 < count; ++su1, ++su2, count--)
		if ((res = *su1 - *su2) != 0)
			break;
	return res;
}
#endif

#ifndef HAS_BUILTIN_STRCMP
static always_inline int builtin_strcmp(const char *cs, const char *ct)
{
	unsigned char c1, c2;

	while (1) {
		c1 = *cs++;
		c2 = *ct++;
		if (c1 != c2)
			return c1 < c2 ? -1 : 1;
		if (!c1)
			break;
	}
	return 0;
}
#endif

#endif /* __CR_ASM_GENERIC_STRING_H__ */

asm: Add builtin_memcpy, builtin_memcmp generic helpers

Will need them in pie code soon.

Signed-off-by: Cyrill Gorcunov <7a1ea01eee6961eb1e372e3508c2670446d086f4@openvz.org>
Signed-off-by: Pavel Emelyanov <c9a32589e048e044184536f7ac71ef92fe82df3e@parallels.com>


/*
  Copied from mc1322x/dev/cpu.

  This file exists as a work-around for the hardware dependant calls
  to slip_arch_init.

  Current the prototype for slip_arch_init is slip_arch_init(urb)

  and a typical call is something like
  slip_arch_init(BAUD2URB(115200))

  BAUD2UBR is hardware specific, however. Furthermore, for the sky
  platform it's typically defined with #include "dev/uart1.h" (see
  rpl-boarder-router/slip-bridge.c), a sky specific file. dev/uart1.h
  includes msp430.h which includes the sky contiki-conf.h which
  defines BAUD2UBR.

  To me, the correct think to pass is simply the baudrate and have the
  hardware specific conversion happen inside slip_arch_init.

  Notably, most implementations just ignore the passed parameter
  anyway. (except AVR)

 */

#ifndef DEV_UART1_H
#define DEV_UART1_H

#define BAUD2UBR(x) x

#endif

Add file needed for rpl border router

Add file needed for rpl border router


/* dtkComposerSceneNodeLeaf.h ---
 *
 * Author: Julien Wintz
 * Copyright (C) 2008-2011 - Julien Wintz, Inria.
 * Created: Fri Feb  3 12:34:45 2012 (+0100)
 * Version: $Id$
 * Last-Updated: Thu Feb 16 14:47:09 2012 (+0100)
 *           By: Julien Wintz
 *     Update #: 10
 */

/* Commentary:
 *
 */

/* Change log:
 *
 */

#ifndef DTKCOMPOSERSCENENODELEAF_H
#define DTKCOMPOSERSCENENODELEAF_H

#include "dtkComposerSceneNode.h"

class dtkComposerNode;
class dtkComposerSceneNodeLeafPrivate;

class dtkComposerSceneNodeLeaf : public dtkComposerSceneNode
{
public:
     dtkComposerSceneNodeLeaf(void);
    ~dtkComposerSceneNodeLeaf(void);

public:
    void wrap(dtkComposerNode *node);

public:
    void layout(void);

public:
    void resize(qreal width, qreal height);

public:
    QRectF boundingRect(void) const;

public:
    void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0);

private:
    dtkComposerSceneNodeLeafPrivate *d;
};

#endif

/* dtkComposerSceneNodeLeaf.h ---
 *
 * Author: Julien Wintz
 * Copyright (C) 2008-2011 - Julien Wintz, Inria.
 * Created: Fri Feb  3 12:34:45 2012 (+0100)
 * Version: $Id$
 * Last-Updated: Thu May 31 09:45:52 2012 (+0200)
 *           By: tkloczko
 *     Update #: 11
 */

/* Commentary:
 *
 */

/* Change log:
 *
 */

#ifndef DTKCOMPOSERSCENENODELEAF_H
#define DTKCOMPOSERSCENENODELEAF_H

#include "dtkComposerExport.h"

#include "dtkComposerSceneNode.h"

class dtkComposerNode;
class dtkComposerSceneNodeLeafPrivate;

class DTKCOMPOSER_EXPORT dtkComposerSceneNodeLeaf : public dtkComposerSceneNode
{
public:
     dtkComposerSceneNodeLeaf(void);
    ~dtkComposerSceneNodeLeaf(void);

public:
    void wrap(dtkComposerNode *node);

public:
    void layout(void);

public:
    void resize(qreal width, qreal height);

public:
    QRectF boundingRect(void) const;

public:
    void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget = 0);

private:
    dtkComposerSceneNodeLeafPrivate *d;
};

#endif

Add export rules for scene node leaf.

Add export rules for scene node leaf.


#include <string.h>
#include <openssl/sha.h>
#include "password.h"

void key_from_password(const char *a_password, char *a_key)
{
	unsigned char digest[256 / 8] = {0};	// SHA 256 uses 256/8 bytes.
	int i;

	SHA256((const unsigned char *)a_password, strlen(a_password), digest);
	for (i = 0; i < 40872; i++) {
		SHA256(digest, 32, digest);
	}

	memcpy(a_key, digest, sizeof(digest));
}

void key_hash(const char *a_key, char *a_hash)
{
	unsigned char digest[256 / 8];
	int i;

	memcpy(digest, a_key, sizeof(digest));
	for (i = 0; i < 30752; i++) {
		SHA256(digest, 32, digest);
	}

	memcpy(a_hash, digest, sizeof(digest));
}

Convert tabs to spaces and indent

Convert tabs to spaces and indent


/*
*The MIT License (MIT)
*
* Copyright (c) <2017> <Stephan Gatzka>
*
* 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 <stddef.h>
#include <Windows.h>
#include <Wincrypt.h>

#include "jet_random.h"

void cjet_get_random_bytes(void *bytes, size_t num_bytes)
{
	HCRYPTPROV hCryptProv = 0;
	CryptGenRandom(hCryptProv, (DWORD)num_bytes, bytes);
}

Add stub for windows random implementation.


/**
 * @file
 * @brief Command registry and invocation code.
 *
 * @date 01.03.11
 * @author Eldar Abusalimov
 */

#include <framework/cmd/api.h>
#include <framework/cmd/types.h>

#include <ctype.h>
#include <stddef.h>
#include <errno.h>
#include <string.h>

#include <util/array.h>
#include <util/getopt.h>

ARRAY_SPREAD_DEF(const struct cmd * const, __cmd_registry);

int cmd_exec(const struct cmd *cmd, int argc, char **argv) {
	int err;

	if (!cmd)
		return -EINVAL;

	err = mod_activate_app(cmd2mod(cmd));
	if (err)
		return err;

	getopt_init();

	return cmd->exec(argc, argv);
}

const struct cmd *cmd_lookup(const char *name) {
	const struct cmd *cmd = NULL;

	if (!strncmp(name, "/bin/", strlen("/bin/"))) {
		name += strlen("/bin/");
	}

	cmd_foreach(cmd) {
		if (strcmp(cmd_name(cmd), name) == 0) {
			return cmd;
		}
	}

	return NULL;
}

/**
 * @file
 * @brief Command registry and invocation code.
 *
 * @date 01.03.11
 * @author Eldar Abusalimov
 */

#include <framework/cmd/api.h>
#include <framework/cmd/types.h>

#include <ctype.h>
#include <stddef.h>
#include <errno.h>
#include <string.h>

#include <util/array.h>
#include <util/getopt.h>

ARRAY_SPREAD_DEF(const struct cmd * const, __cmd_registry);

int cmd_exec(const struct cmd *cmd, int argc, char **argv) {
	int err;

	if (!cmd)
		return -EINVAL;

	err = mod_activate_app(cmd2mod(cmd));
	if (err)
		return err;

	getopt_init();

	err = cmd->exec(argc, argv);

	/* FIXME Here we make app's data and bss as they was
	 * before app execution. It's required because we call all
	 * C++ ctors on every app launch. When we will call only ctors
	 * of the running app, this workaround can be removed. */
	mod_activate_app(cmd2mod(cmd));

	return err;
}

const struct cmd *cmd_lookup(const char *name) {
	const struct cmd *cmd = NULL;

	if (!strncmp(name, "/bin/", strlen("/bin/"))) {
		name += strlen("/bin/");
	}

	cmd_foreach(cmd) {
		if (strcmp(cmd_name(cmd), name) == 0) {
			return cmd;
		}
	}

	return NULL;
}

Fix running of c++ apps when there are multiple apps in mods.conf


// REQUIRES: x86_64-linux
// RUN: %host_cc -O0 -g %s -o %t 2>&1
// RUN: %t 2>&1 | llvm-symbolizer -print-source-context-lines=5 -obj=%t | FileCheck %s

#include <stdio.h>

int inc(int a) {
  return a + 1;
}

int main() {
  printf("%p\n", inc);
  return 0;
}

// CHECK: inc
// CHECK: print_context.c:7
// CHECK: 5  : #include
// CHECK: 6  :
// CHECK: 7 >: int inc
// CHECK: 8  :   return
// CHECK: 9  : }

// REQUIRES: x86_64-linux
// RUN: %host_cc -O0 -g %s -o %t 2>&1
// RUN: %t 2>&1 | llvm-symbolizer -print-source-context-lines=5 -obj=%t | FileCheck %s

// CHECK: inc
// CHECK: print_context.c:[[@LINE+9]]
// CHECK: [[@LINE+6]]  : #include
// CHECK: [[@LINE+6]]  :
// CHECK: [[@LINE+6]] >: int inc
// CHECK: [[@LINE+6]]  :   return
// CHECK: [[@LINE+6]]  : }

#include <stdio.h>

int inc(int a) {
  return a + 1;
}

int main() {
  printf("%p\n", inc);
  return 0;
}

Make test robust to changes in prefix/avoid hardcoded line numbers

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


/*
* Three files to show how to put a typedef struct and
*   functions into a header file.
*
* Copyright 2017 Dave Cuthbert, MIT license
*/

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

int main(int argc, char *argv[])
{
    Node *root;
    root = new_node();
    root->value = 1;

    printf("ROOT: %d\n", root->value);

    Node *node_ptr = new_node();
    node_ptr = root;

    printf("NODE PTR: %d\n", root->value);

    /* Add another node */
    node_ptr->next = new_node();

    /* Move forward to new node */
    node_ptr = node_ptr->next;
    node_ptr->next = 0;
    node_ptr->value = 2;
    printf("NEW NODE: %d\n", node_ptr->value);

    return 0;
}

Add typdef in header main()

Add typdef in header main()


/**
 *
 * @date 23.11.2012
 * @author Alexander Kalmuk
 */

#ifndef DIRENT_H_
#define DIRENT_H_

#include <sys/types.h>
#include <sys/cdefs.h>

__BEGIN_DECLS

#define DIRENT_DNAME_LEN 40

struct dirent {
	ino_t  d_ino;      /* File serial number. */
	char   d_name[DIRENT_DNAME_LEN]; /* Name of entry. */
};

struct node;
struct directory {
	struct dirent current;
	struct node *node;
	//struct tree_link *child_lnk;
};
typedef struct directory DIR;

extern int            closedir(DIR *);

extern DIR           *opendir(const char *);

extern struct dirent *readdir(DIR *);

extern int            readdir_r(DIR *, struct dirent *, struct dirent **);

__END_DECLS

#endif /* DIRENT_H_ */

/**
 *
 * @date 23.11.2012
 * @author Alexander Kalmuk
 */

#ifndef DIRENT_H_
#define DIRENT_H_

#include <sys/types.h>
#include <sys/cdefs.h>

__BEGIN_DECLS

#define DIRENT_DNAME_LEN 40

struct dirent {
	ino_t  d_ino;      /* File serial number. */
	char   d_name[DIRENT_DNAME_LEN]; /* Name of entry. */
};

struct node;
typedef struct {
	struct dirent current;
	struct node *node;
	//struct tree_link *child_lnk;
} DIR;

extern int            closedir(DIR *);

extern DIR           *opendir(const char *);

extern struct dirent *readdir(DIR *);

extern int            readdir_r(DIR *, struct dirent *, struct dirent **);

__END_DECLS

#endif /* DIRENT_H_ */

extbld-porting: Fix multiply difination of the struct directory


#include <Python.h>
#include <arrayobject.h>
#include "plplot/plplot.h"
#include "plplot/plplotP.h"

#if defined(PL_DOUBLE) || defined(DOUBLE)
#define PL_ARGS(a, b) (a)
#define PyArray_PLFLT PyArray_DOUBLE
#else
#define PL_ARGS(a, b) (b)
#define PyArray_PLFLT PyArray_FLOAT
#endif

#define TRY(E) if(! (E)) return NULL

int pl_PyArray_AsFloatArray (PyObject **, PLFLT **, PLINT *);
int pl_PyArray_AsIntArray (PyObject **, PLINT **, PLINT *);
int pl_PyArray_AsFloatMatrix (PyObject **, PLINT*, PLINT*, PLFLT ***);
int pl_PyList_AsStringArray (PyObject *, char ***, int *);
int pl_PyList_SetFromStringArray (PyObject *, char **, int);

PLFLT pyf2eval2( PLINT ix, PLINT iy, PLPointer plf2eval_data );

#include <Python.h>
/* Change this to the recommended
#include <Numeric/arrayobject.h>
 once we no longer support python1.5 */
#include <arrayobject.h>
#include "plplot/plplot.h"
#include "plplot/plplotP.h"

#if defined(PL_DOUBLE) || defined(DOUBLE)
#define PL_ARGS(a, b) (a)
#define PyArray_PLFLT PyArray_DOUBLE
#else
#define PL_ARGS(a, b) (b)
#define PyArray_PLFLT PyArray_FLOAT
#endif

#define TRY(E) if(! (E)) return NULL

int pl_PyArray_AsFloatArray (PyObject **, PLFLT **, PLINT *);
int pl_PyArray_AsIntArray (PyObject **, PLINT **, PLINT *);
int pl_PyArray_AsFloatMatrix (PyObject **, PLINT*, PLINT*, PLFLT ***);
int pl_PyList_AsStringArray (PyObject *, char ***, int *);
int pl_PyList_SetFromStringArray (PyObject *, char **, int);

PLFLT pyf2eval2( PLINT ix, PLINT iy, PLPointer plf2eval_data );

Comment the current arrayobject.h situation.  Right now for Numpy packages
that are consistent with python-1.5, this file could be a number of places
relative to /usr/include/python$version so configure must look specifically
for it. However, later Numpy packages consistent with python2.x always put
it in a standard location of /usr/include/python$version/Numeric.  Thus, the
relative location of arrayobject.h to the normal python includes is
consistent, and we will no longer have to look specifically for this file
once we stop supporting python-1.5.

svn path=/trunk/; revision=3687


#include "AceUnitLogging.h"

#ifdef ACEUNIT_LOG_RUNNER
/** @see TestLogger_t.runnerStarted */
void logRunnerStarted()
{
}
#endif

#ifdef ACEUNIT_LOG_SUITE
/** @see TestLogger_t.suiteStarted */
void logSuiteStarted()
{
}
#endif

#ifdef ACEUNIT_LOG_FIXTURE
/** @see TestLogger_t.fixtureStarted */
void logFixtureStarted(const FixtureId_t fixture)
{
}
#endif

#ifdef ACEUNIT_LOG_TESTCASE
/** @see TestLogger_t.testCaseStarted */
void logTestCaseStarted(TestCaseId_t testCase)
{
}
#endif

/** @see TestLogger_t.testCaseCailed */
void logTestCaseFailed(const AssertionError_t *error)
{
}

#ifdef ACEUNIT_LOG_TESTCASE
/** @see TestLogger_t.testCaseEnded */
void logTestCaseEnded(TestCaseId_t testCase)
{
}
#endif

#ifdef ACEUNIT_LOG_FIXTURE
void logFixtureEnded(const FixtureId_t fixture)
{
}
#endif

#ifdef ACEUNIT_LOG_SUITE
/** @see TestLogger_t.suiteEnded */
void logSuiteEnded()
{
}
#endif

#ifdef ACEUNIT_LOG_RUNNER
/** @see TestLogger_t.runnerEnded */
void logRunnerEnded()
{
}
#endif

/** This Logger. */
AceUnitNewLogger(
    loggerStub, /* CHANGE THIS NAME!!! */
    logRunnerStarted,
    logSuiteStarted,
    logFixtureStarted,
    logTestCaseStarted,
    logTestCaseFailed,
    logTestCaseEnded,
    logFixtureEnded,
    logSuiteEnded,
    logRunnerEnded
);

TestLogger_t *globalLogger = &loggerStub; /* XXX Hack. Remove. */

#include "AceUnitLogging.h"

#ifdef ACEUNIT_LOG_RUNNER
/** @see TestLogger_t.runnerStarted */
void logRunnerStarted()
{
}
#endif

#ifdef ACEUNIT_LOG_RUNNER
/** @see TestLogger_t.runnerEnded */
void logRunnerEnded()
{
}
#endif

/** This Logger. */
AceUnitNewLogger(
    loggerStub, /* CHANGE THIS NAME!!! */
    logRunnerStarted,
    NULL,
    NULL,
    NULL,
    NULL,
    NULL,
    NULL,
    NULL,
    logRunnerEnded
);

TestLogger_t *globalLogger = &loggerStub; /* XXX Hack. Remove. */

Remove some compiler warnings for C251.

Remove some compiler warnings for C251.


#ifndef pybind_extension_vtk_source_VTKTypeCaster_h
#define pybind_extension_vtk_source_VTKTypeCaster_h

#include <pybind11/pybind11.h>

#include <type_traits>

#include "vtkObjectBase.h"
#include "vtkPythonUtil.h"

#define PYBIND11_VTK_TYPECASTER(VTK_OBJ)                                \
  namespace pybind11 {                                                  \
    namespace detail {                                                  \
    template <>                                                         \
  struct type_caster<VTK_OBJ> {                                         \
  protected:                                                            \
VTK_OBJ *value;                                                         \
public:                                                                 \
static PYBIND11_DESCR name() { return type_descr(_(#VTK_OBJ)); }        \
static handle cast(const VTK_OBJ *src, return_value_policy policy,      \
                   handle parent) {                                     \
  return cast(*src, policy, parent);                                    \
}                                                                       \
operator VTK_OBJ *() { return value; }                                  \
operator VTK_OBJ &() { return *value; }                                 \
template <typename _T> using cast_op_type =                             \
  pybind11::detail::cast_op_type<_T>;                                   \
bool load(handle src, bool) {                                           \
  value = dynamic_cast< VTK_OBJ *>(                                     \
    vtkPythonUtil::GetPointerFromObject(src.ptr(), #VTK_OBJ));          \
  if (!value) {                                                         \
    PyErr_Clear();                                                      \
    throw reference_cast_error();                                       \
  }                                                                     \
  return value != nullptr;                                              \
}                                                                       \
static handle cast(const VTK_OBJ& src, return_value_policy, handle) {   \
  return vtkPythonUtil::GetObjectFromPointer(                           \
    const_cast< VTK_OBJ *>(&src));                                      \
}                                                                       \
};                                                                      \
}}

#endif

Add VTK type caster to convert VTK wrapped classes

This type caster from SMTK manages converting VTK wrapped class into
the appropriate VTK class on the C++ side.


#ifndef ARBITER_HASH_H
#define ARBITER_HASH_H

#ifndef __cplusplus
#error "This file must be compiled as C++."
#endif

#include <functional>
#include <type_traits>

namespace Arbiter {

template<typename T>
size_t hashOf (const T &value)
{
  return std::hash<T>()(value);
}

}

#endif

Add convenience function for hashing arbitrary types


// RUN: %ocheck 3 %s

g()
{
	return 3;
}

main()
{
	if(0){
		f(); // shouldn't hit a linker error here - dead code
a:
		return g();
	}

	goto a;
}

// RUN: %ocheck 3 %s -g
// test debug emission too

g()
{
	return 3;
}

main()
{
	if(0){
		int i;
		f(); // shouldn't hit a linker error here - dead code
a:
		i = 2;
		return g(i);
	}

	goto a;
}

Test debug label emission with local variables


/*
**  Copyright (C) - Triton
**
**  This program is under the terms of the LGPLv3 License.
*/

#ifndef   TRITONTYPES_H
#define   TRITONTYPES_H
#include <boost/multiprecision/cpp_int.hpp>
#include <boost/numeric/conversion/cast.hpp>
#define BIT_MAX 512

typedef unsigned char                       uint8;
typedef unsigned short                      uint16;
typedef unsigned int                        uint32;
typedef unsigned long long                  uint64;
typedef boost::multiprecision::uint128_t    uint128;
typedef boost::multiprecision::uint512_t    uint512;

typedef signed char                         sint8;
typedef signed short                        sint16;
typedef signed int                          sint32;
typedef signed long long                    sint64;
typedef boost::multiprecision::int128_t     sint128;
typedef boost::multiprecision::int512_t     sint512;

#endif     /* !TRITONTYPES_H */

/*
**  Copyright (C) - Triton
**
**  This program is under the terms of the LGPLv3 License.
*/

#ifndef   TRITONTYPES_H
#define   TRITONTYPES_H

#include <boost/multiprecision/cpp_int.hpp>
#include <boost/numeric/conversion/cast.hpp>

#define BIT_MAX 512

typedef unsigned char                       uint8;
typedef unsigned short                      uint16;
typedef unsigned int                        uint32;
typedef boost::multiprecision::uint64 _t    uint64;
typedef boost::multiprecision::uint128_t    uint128;
typedef boost::multiprecision::uint256_t    uint256;
typedef boost::multiprecision::uint512_t    uint512;

typedef signed char                         sint8;
typedef signed short                        sint16;
typedef signed int                          sint32;
typedef boost::multiprecision::int64 _t     sint64;
typedef boost::multiprecision::int128_t     sint128;
typedef boost::multiprecision::int256_t     sint256;
typedef boost::multiprecision::int512_t     sint512;

#endif     /* !TRITONTYPES_H */

Use boost multiprecision even for 64b

Use boost multiprecision even for 64b


/* Headers needed for multiprocess communication through boost interprocess.
 * This needs to be included BEFORE anything referencing machine.h,
 * or macro definitions from machine.h would mess template args.
 */

#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wnarrowing"
#pragma GCC diagnostic ignored "-Wunused-local-typedefs"
#pragma GCC diagnostic ignored "-Wmaybe-uninitialized"

#include <boost/interprocess/containers/deque.hpp>
#include <boost/interprocess/containers/string.hpp>
#include <boost/interprocess/containers/map.hpp>
#include <boost/interprocess/containers/vector.hpp>
#include <boost/unordered_map.hpp>

#include <boost/interprocess/managed_shared_memory.hpp>
#include <boost/interprocess/managed_mapped_file.hpp>
#include <boost/interprocess/shared_memory_object.hpp>
#include <boost/interprocess/allocators/allocator.hpp>
#include <boost/interprocess/interprocess_fwd.hpp>
#include <boost/interprocess/sync/named_mutex.hpp>

#pragma GCC diagnostic pop

#include "shared_map.h"
#include "shared_unordered_map.h"

/* Headers needed for multiprocess communication through boost interprocess.
 * This needs to be included BEFORE anything referencing machine.h,
 * or macro definitions from machine.h would mess template args.
 */

#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wnarrowing"
#pragma GCC diagnostic ignored "-Wunused-local-typedefs"
#pragma GCC diagnostic ignored "-Wmaybe-uninitialized"
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"

#include <boost/interprocess/containers/deque.hpp>
#include <boost/interprocess/containers/string.hpp>
#include <boost/interprocess/containers/map.hpp>
#include <boost/interprocess/containers/vector.hpp>
#include <boost/unordered_map.hpp>

#include <boost/interprocess/managed_shared_memory.hpp>
#include <boost/interprocess/managed_mapped_file.hpp>
#include <boost/interprocess/shared_memory_object.hpp>
#include <boost/interprocess/allocators/allocator.hpp>
#include <boost/interprocess/interprocess_fwd.hpp>
#include <boost/interprocess/sync/named_mutex.hpp>

#pragma GCC diagnostic pop

#include "shared_map.h"
#include "shared_unordered_map.h"

Add ignore warning pragma for deprecated declarations.


// RUN: %llvmgcc -S %s -o - /dev/null
// XFAIL: *

#define ATTR_BITS(N) __attribute__((bitwidth(N)))

typedef int ATTR_BITS( 4) My04BitInt;
typedef int ATTR_BITS(16) My16BitInt;
typedef int ATTR_BITS(17) My17BitInt;
typedef int ATTR_BITS(37) My37BitInt;
typedef int ATTR_BITS(65) My65BitInt;

struct MyStruct {
  My04BitInt i4Field;
  short ATTR_BITS(12) i12Field;
  long ATTR_BITS(17) i17Field;
  My37BitInt i37Field;
};

My37BitInt doit( short ATTR_BITS(23) num) {
  My17BitInt i;
  struct MyStruct strct;
  int bitsize1 = sizeof(My17BitInt);
  int __attribute__((bitwidth(9))) j;
  int bitsize2 = sizeof(j);
  int result = bitsize1 + bitsize2;
  strct.i17Field = result;
  result += sizeof(struct MyStruct);
  return result;
}

int
main ( int argc, char** argv)
{
  return (int ATTR_BITS(32)) doit((short ATTR_BITS(23))argc);
}

// RUN: %llvmgcc -S %s -o - /dev/null 2>&1 > /dev/null | \
// RUN:   not grep warning
// XFAIL: *

#define ATTR_BITS(N) __attribute__((bitwidth(N)))

typedef int ATTR_BITS( 4) My04BitInt;
typedef int ATTR_BITS(16) My16BitInt;
typedef int ATTR_BITS(17) My17BitInt;
typedef int ATTR_BITS(37) My37BitInt;
typedef int ATTR_BITS(65) My65BitInt;

struct MyStruct {
  My04BitInt i4Field;
  short ATTR_BITS(12) i12Field;
  long ATTR_BITS(17) i17Field;
  My37BitInt i37Field;
};

My37BitInt doit( short ATTR_BITS(23) num) {
  My17BitInt i;
  struct MyStruct strct;
  int bitsize1 = sizeof(My17BitInt);
  int __attribute__((bitwidth(9))) j;
  int bitsize2 = sizeof(j);
  int result = bitsize1 + bitsize2;
  strct.i17Field = result;
  result += sizeof(struct MyStruct);
  return result;
}

int
main ( int argc, char** argv)
{
  return (int ATTR_BITS(32)) doit((short ATTR_BITS(23))argc);
}

Make this test actually test what its supposed to test.

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


/*
 * 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 92
#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 93
#endif

Update Skia milestone to 93

Update Skia milestone to 93

Change-Id: Ib9a9832dbd63b6a306f5c955f4528b195c29c71f
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/411278
Reviewed-by: Eric Boren <0e499112533c8544f0505ea0d08394fb5ad7d8fa@google.com>


#ifndef ZOMBIE_STATE_H
#define ZOMBIE_STATE_H

#include "box2ddef.h"

namespace zombie {

	struct State {
		Position position_{0, 0};
		Velocity velocity_{0, 0};
		float angle_{0.f};
		float anglularVelocity_{0.f};
	};

}

#endif

#ifndef ZOMBIE_STATE_H
#define ZOMBIE_STATE_H

#include "box2ddef.h"

namespace zombie {

	struct State {
		Position position_;
		Velocity velocity_;
		float angle_;
		float anglularVelocity_;
	};

}

#endif

Make State struct a clean POD strcut

Make State struct a clean POD strcut


#ifndef Version_h
#define Version_h

#define BFARCHIVE_COMMA_SEPARATED_VERSION 3,0,0,0
#define BFARCHIVE_VERSION_STRING "3.0.0"

#endif

#ifndef Version_h
#define Version_h

#define BFARCHIVE_COMMA_SEPARATED_VERSION 9,1,0,0
#define BFARCHIVE_VERSION_STRING "9.1.0"

#endif

Bump version to 9.1.0 to avoid confusion


//===-- GenericValue.h - Represent any type of LLVM value -------*- C++ -*-===//
//
//                     The LLVM Compiler Infrastructure
//
// This file was developed by the LLVM research group and is distributed under
// the University of Illinois Open Source License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
//
// The GenericValue class is used to represent an LLVM value of arbitrary type.
//
//===----------------------------------------------------------------------===//

#ifndef GENERIC_VALUE_H
#define GENERIC_VALUE_H

#include "llvm/Support/DataTypes.h"

namespace llvm {

typedef uintptr_t PointerTy;

union GenericValue {
  bool            Int1Val;
  unsigned char   Int8Val;
  unsigned short  Int16Val;
  unsigned int    Int32Val;
  uint64_t        Int64Val;
  double          DoubleVal;
  float           FloatVal;
  struct { unsigned int first; unsigned int second; } UIntPairVal;
  PointerTy       PointerVal;
  unsigned char   Untyped[8];

  GenericValue() {}
  GenericValue(void *V) {
    PointerVal = (PointerTy)(intptr_t)V;
  }
};

inline GenericValue PTOGV(void *P) { return GenericValue(P); }
inline void* GVTOP(const GenericValue &GV) {
  return (void*)(intptr_t)GV.PointerVal;
}

} // End llvm namespace
#endif

//===-- GenericValue.h - Represent any type of LLVM value -------*- C++ -*-===//
//
//                     The LLVM Compiler Infrastructure
//
// This file was developed by the LLVM research group and is distributed under
// the University of Illinois Open Source License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
//
// The GenericValue class is used to represent an LLVM value of arbitrary type.
//
//===----------------------------------------------------------------------===//

#ifndef GENERIC_VALUE_H
#define GENERIC_VALUE_H

#include "llvm/Support/DataTypes.h"

namespace llvm {

typedef uintptr_t PointerTy;
class APInt;
class Type;

union GenericValue {
  bool            Int1Val;
  unsigned char   Int8Val;
  unsigned short  Int16Val;
  unsigned int    Int32Val;
  uint64_t        Int64Val;
  APInt          *APIntVal;
  double          DoubleVal;
  float           FloatVal;
  struct { unsigned int first; unsigned int second; } UIntPairVal;
  PointerTy       PointerVal;
  unsigned char   Untyped[8];

  GenericValue() {}
  GenericValue(void *V) {
    PointerVal = (PointerTy)(intptr_t)V;
  }
};

inline GenericValue PTOGV(void *P) { return GenericValue(P); }
inline void* GVTOP(const GenericValue &GV) {
  return (void*)(intptr_t)GV.PointerVal;
}

} // End llvm namespace
#endif

Add APIntVal as a possible GenericeValue.

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


/*
Problem Statement

John has discovered various rocks. Each rock is composed of various elements, and each element is represented by a lower-case Latin letter from 'a' to 'z'. An element can be present multiple times in a rock. An element is called a gem-element if it occurs at least once in each of the rocks.

Given the list of N rocks with their compositions, display the number of gem-elements that exist in those rocks.

Input Format

The first line consists of an integer, N, the number of rocks.
Each of the next N lines contains a rock's composition. Each composition consists of lower-case letters of English alphabet.

Constraints
1≤N≤100
Each composition consists of only lower-case Latin letters ('a'-'z').
1≤ length of each composition ≤100
Output Format

Print the number of gem-elements that are common in these rocks. If there are none, print 0.

Sample Input

3
abcdde
baccd
eeabg
Sample Output

2
Explanation

Only "a" and "b" are the two kinds of gem-elements, since these are the only characters that occur in every rock's composition.
*/

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

int main() {
    int n;
    scanf("%d",&n);
    char rock [n][101];
    int i,j;

    for(i=0; i<n; i++){
        scanf("%s",rock[i]);
    }

    int array[26];
    for(j=0 ; j<26; j++){
        array[j]=0;
    }
    char char_int = 97;
    char* result = NULL;
    for (j = 0 ; j<26 ; j++){
        for(i =0 ; i<n ; i++){
            result = strchr(rock[i],char_int);
            if(result != NULL){
                array[j]++;
            }

        }
            char_int ++;
    }
    int count =0;
    for(j=0 ; j<26; j++){
        if (array[j]== n){
            count++;
        }
    }
    printf("%d",count);

    return 0;
}

Add Gemstone which makes use of alphabet array and strchr


#include <stdlib.h>
#ifndef __BST_H__
#define __BST_H__
struct BSTNode;
struct BST;
typedef struct BSTNode BSTNode;
typedef struct BST BST;

BST* BST_Create(void);
BSTNode* BSTNode_Create(void* k);
void BST_Inorder_Tree_Walk(BST* T, void (f)(void*));
void BST_Preorder_Tree_Walk(BST* T, void (f)(void*));
void BST_Postorder_Tree_Walk(BST* T, void (f)(void*));
BSTNode* BST_Tree_Search(BST* T, void* k, int (f)(void*, void*), int (g)(void*, void*));
BSTNode* BST_Iterative_Tree_Search(BST* T, void* k, int (f)(void*, void*), int (g)(void*, void*));

#endif

#include <stdlib.h>
#ifndef __BST_H__
#define __BST_H__
struct BSTNode;
struct BST;
typedef struct BSTNode BSTNode;
typedef struct BST BST;

BST* BST_Create(void);
BSTNode* BSTNode_Create(void* k);
void BST_Inorder_Tree_Walk(BST* T, void (f)(void*));
void BST_Preorder_Tree_Walk(BST* T, void (f)(void*));
void BST_Postorder_Tree_Walk(BST* T, void (f)(void*));
BSTNode* BST_Tree_Search(BST* T, void* k, int (f)(void*, void*), int (g)(void*, void*));
BSTNode* BST_Iterative_Tree_Search(BST* T, void* k, int (f)(void*, void*), int (g)(void*, void*));
BSTNode* BST_Tree_Minimum(BSTNode* n);
BSTNode* BST_Tree_Maximum(BSTNode* n);

#endif

Add BST Tree Min/Max function declaration


#pragma once
#include <v8.h>
#include "isolate/holder.h"
#include "transferable_handle.h"
#include <memory>

namespace ivm {

class ScriptHandle : public TransferableHandle {
	private:
		class ScriptHandleTransferable : public Transferable {
			private:
				std::shared_ptr<IsolateHolder> isolate;
				std::shared_ptr<v8::Persistent<v8::UnboundScript>> script;
			public:
				ScriptHandleTransferable(
					std::shared_ptr<IsolateHolder> isolate,
					std::shared_ptr<v8::Persistent<v8::UnboundScript>> script
				);
				v8::Local<v8::Value> TransferIn() final;
		};

		std::shared_ptr<IsolateHolder> isolate;
		std::shared_ptr<v8::Persistent<v8::UnboundScript>> script;

	public:
		ScriptHandle(
			std::shared_ptr<IsolateHolder> isolate,
			std::shared_ptr<v8::Persistent<v8::UnboundScript>> script
		);

		static IsolateEnvironment::IsolateSpecific<v8::FunctionTemplate>& TemplateSpecific();
		static v8::Local<v8::FunctionTemplate> Definition();
		std::unique_ptr<Transferable> TransferOut() final;

		template <bool async>
		v8::Local<v8::Value> Run(class ContextHandle* context_handle, v8::MaybeLocal<v8::Object> maybe_options);
};

} // namespace ivm

#pragma once
#include <v8.h>
#include "isolate/holder.h"
#include "transferable_handle.h"
#include <memory>

namespace ivm {

class ContextHandle;

class ScriptHandle : public TransferableHandle {
	private:
		class ScriptHandleTransferable : public Transferable {
			private:
				std::shared_ptr<IsolateHolder> isolate;
				std::shared_ptr<v8::Persistent<v8::UnboundScript>> script;
			public:
				ScriptHandleTransferable(
					std::shared_ptr<IsolateHolder> isolate,
					std::shared_ptr<v8::Persistent<v8::UnboundScript>> script
				);
				v8::Local<v8::Value> TransferIn() final;
		};

		std::shared_ptr<IsolateHolder> isolate;
		std::shared_ptr<v8::Persistent<v8::UnboundScript>> script;

	public:
		ScriptHandle(
			std::shared_ptr<IsolateHolder> isolate,
			std::shared_ptr<v8::Persistent<v8::UnboundScript>> script
		);

		static IsolateEnvironment::IsolateSpecific<v8::FunctionTemplate>& TemplateSpecific();
		static v8::Local<v8::FunctionTemplate> Definition();
		std::unique_ptr<Transferable> TransferOut() final;

		template <bool async>
		v8::Local<v8::Value> Run(ContextHandle* context_handle, v8::MaybeLocal<v8::Object> maybe_options);
};

} // namespace ivm

Fix stupid msvc compile error

Fix stupid msvc compile error

It thinks the forward declaration defines a template. Clang and GCC do
not agree.


//===------ llvm/MC/MCAsmParserUtils.h - Asm Parser Utilities ---*- C++ -*-===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

#ifndef LLVM_MC_MCPARSER_MCASMPARSERUTILS_H
#define LLVM_MC_MCPARSER_MCASMPARSERUTILS_H

namespace llvm {
namespace MCParserUtils {

/// Parse a value expression and return whether it can be assigned to a symbol
/// with the given name.
///
/// On success, returns false and sets the Symbol and Value output parameters.
bool parseAssignmentExpression(StringRef Name, bool allow_redef,
                               MCAsmParser &Parser, MCSymbol *&Symbol,
                               const MCExpr *&Value);

} // namespace MCParserUtils
} // namespace llvm

#endif

//===------ llvm/MC/MCAsmParserUtils.h - Asm Parser Utilities ---*- C++ -*-===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

#ifndef LLVM_MC_MCPARSER_MCASMPARSERUTILS_H
#define LLVM_MC_MCPARSER_MCASMPARSERUTILS_H

namespace llvm {

class MCAsmParser;
class MCExpr;
class MCSymbol;
class StringRef;

namespace MCParserUtils {

/// Parse a value expression and return whether it can be assigned to a symbol
/// with the given name.
///
/// On success, returns false and sets the Symbol and Value output parameters.
bool parseAssignmentExpression(StringRef Name, bool allow_redef,
                               MCAsmParser &Parser, MCSymbol *&Symbol,
                               const MCExpr *&Value);

} // namespace MCParserUtils
} // namespace llvm

#endif

Make header parse standalone. NFC.

Make header parse standalone. NFC.

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


#include <stdio.h>

typedef unsigned int fixed_t;

fixed_t multiplyFixed(fixed_t a, fixed_t b)
{
    return ((long long) a * (long long) b) >> 16;
}

int main(int argc, const char *argv[])
{
	printf("%08x\n", multiplyFixed(0xffffe350, 0x009fe0c6)); // CHECK: e0b4157f
}

Add 64 bit multiplication test

Add 64 bit multiplication test


/*
 * 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 55
#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 57
#endif

Update Skia milestone to 57

Update Skia milestone to 57

Milestone that we typically update, but note that change from 55->56 was missed, will cherry pick to branch.
This change gets current file caught up to show working milestone after branch.

GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=4927

Change-Id: If10e0db2d4acc908f5da7c4e9d30497deef6a2ff
Reviewed-on: https://skia-review.googlesource.com/4927
Reviewed-by: Brian Salomon <61fabaaf0876044aeedfd8e351e485c028d69e7b@google.com>
Reviewed-by: Heather Miller <2e22000c5d22374561fe5fba576a31095b72dc2e@google.com>
Commit-Queue: Heather Miller <2e22000c5d22374561fe5fba576a31095b72dc2e@google.com>


#include "direction.h"

#include <assert.h>
#include <base/base.h>

enum direction
direction_90_degrees_left(enum direction direction)
{
    assert(direction_is_valid(direction));
    return (direction + 270) % 360;
}

enum direction
direction_90_degrees_right(enum direction direction)
{
    assert(direction_is_valid(direction));
    return (direction + 90) % 360;
}

extern inline bool
direction_is_valid(unsigned direction);

char const *
direction_name(enum direction direction)
{
    assert(direction_is_valid(direction));
    switch (direction) {
        case direction_north: return "north";
        case direction_northeast: return "northeast";
        case direction_east: return "east";
        case direction_southeast: return "southeast";
        case direction_south: return "south";
        case direction_southwest: return "southwest";
        case direction_west: return "west";
        case direction_northwest: return "northwest";
    }
}

enum direction
direction_opposite(enum direction direction)
{
    assert(direction_is_valid(direction));
    return (direction + 180) % 360;
}

enum direction
direction_random(struct rnd *rnd)
{
    return rnd_next_uniform_value(rnd, 8) * 45;
}

#include "direction.h"

#include <assert.h>
#include <base/base.h>

enum direction
direction_90_degrees_left(enum direction direction)
{
    assert(direction_is_valid(direction));
    return (direction + 270) % 360;
}

enum direction
direction_90_degrees_right(enum direction direction)
{
    assert(direction_is_valid(direction));
    return (direction + 90) % 360;
}

extern inline bool
direction_is_valid(unsigned direction);

char const *
direction_name(enum direction direction)
{
    assert(direction_is_valid(direction));
    switch (direction) {
        case direction_north: return "north";
        case direction_northeast: return "northeast";
        case direction_east: return "east";
        case direction_southeast: return "southeast";
        case direction_south: return "south";
        case direction_southwest: return "southwest";
        case direction_west: return "west";
        case direction_northwest: return "northwest";
    }
    return "north";
}

enum direction
direction_opposite(enum direction direction)
{
    assert(direction_is_valid(direction));
    return (direction + 180) % 360;
}

enum direction
direction_random(struct rnd *rnd)
{
    return rnd_next_uniform_value(rnd, 8) * 45;
}

Fix "control reaches end of non-void function" warning.

On the Debian / GCC build with `-Wall` set, the `direction_name()`
function causes this warning.  Add a catch-all return value after the
exhaustive `switch`.


#define _XOPEN_SOURCE 700

#include <stdio.h>
#include <signal.h>
#include <unistd.h>
#include <assert.h>
#include <stdlib.h>
#include <setjmp.h>

jmp_buf try;

void handler(int sig) {
  static int i = 0;

  printf("stack overflow %d\n", i);
  longjmp(try, ++i);
  assert(0);
}

unsigned recurse(unsigned x) {
    return recurse(x)+1;
}

int main() {
  char* stack;
  stack = malloc(sizeof(stack) * SIGSTKSZ);
  stack_t ss = {
    .ss_size = SIGSTKSZ,
    .ss_sp = stack,
  };
  struct sigaction sa = {
    .sa_handler = handler,
    .sa_flags = SA_ONSTACK
  };

  sigaltstack(&ss, 0);
  sigfillset(&sa.sa_mask);
  sigaction(SIGSEGV, &sa, 0);

  if (setjmp(try) < 3) {
    recurse(0);
  } else {
    printf("caught exception!\n");
  }

  return 0;
}

#define _XOPEN_SOURCE 700

#include <stdio.h>
#include <signal.h>
#include <unistd.h>
#include <assert.h>
#include <stdlib.h>
#include <setjmp.h>

jmp_buf try;

void handler(int sig) {
  static int i = 0;

  printf("stack overflow %d\n", i);
  longjmp(try, ++i);
  assert(0);
}

unsigned recurse(unsigned x) {
    return recurse(x)+1;
}

int main() {
  char* stack;
  stack = malloc(sizeof(stack) * SIGSTKSZ);
  stack_t ss = {
    .ss_size = SIGSTKSZ,
    .ss_sp = stack,
  };
  struct sigaction sa = {
    .sa_handler = handler,
    .sa_flags = SA_ONSTACK
  };

  sigaltstack(&ss, 0);
  sigfillset(&sa.sa_mask);
  sigaction(SIGALRM, &sa, 0);

  raise(SIGALRM);
  return 0;

  if (setjmp(try) < 3) {
    recurse(0);
  } else {
    printf("caught exception!\n");
  }

  return 0;
}

Switch to SIGLARM, to allow seamless gdb usage


// RUN: c-index-test -test-load-source local %s 2>&1 | FileCheck %s

// This is invalid source.  Previously a double-free caused this
// example to crash c-index-test.

int foo(int x) {
  int y[x * 3];
  help
};

// CHECK: 8:3: error: use of undeclared identifier 'help'
// CHECK:  help
// CHECK: 12:102: error: expected '}'

// RUN: %clang-cc1 -fsyntax-only %s 2>&1 | FileCheck %s

// IMPORTANT: This test case intentionally DOES NOT use --disable-free.  It
// tests that we are properly reclaiming the ASTs and we do not have a double free.
// Previously we tried to free the size expression of the VLA twice.

int foo(int x) {
  int y[x * 3];
  help
};

// CHECK: 9:3: error: use of undeclared identifier 'help'
// CHECK:  help
// CHECK: 14:102: error: expected '}'

Change test case to use 'clang -cc1' (without --disable-free) instead of c-index-test (whose memory management behavior may change in the future).

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


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

#pragma once

class VolumeTransformation;

class VolumeController {
public:
    struct DeviceInfo {
        std::wstring name;
        std::wstring id;
    };

    /// <summary>
    /// Retrieves the current volume level as a float, ranging from 0.0 - 1.0
    /// </summary>
    virtual float Volume() = 0;

    /// <summary>Sets the volume level. Valid range: 0.0 - 1.0</summary>
    virtual void Volume(float vol) = 0;

    virtual bool Muted() = 0;
    virtual void Muted(bool mute) = 0;
    virtual void ToggleMute() {
        (Muted() == true) ? Muted(false) : Muted(true);
    }

    virtual void Transformation(VolumeTransformation *transform) = 0;
    virtual VolumeTransformation* Transformation() = 0;

public:
    static const int MSG_VOL_CHNG = WM_APP + 1080;
    static const int MSG_VOL_DEVCHNG = WM_APP + 1081;

};

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

#pragma once

class VolumeTransformation;

class VolumeController {
public:
    struct DeviceInfo {
        std::wstring name;
        std::wstring id;
    };

    /// <summary>
    /// Retrieves the current volume level as a float, ranging from 0.0 - 1.0
    /// </summary>
    virtual float Volume() = 0;

    /// <summary>Sets the volume level. Valid range: 0.0 - 1.0</summary>
    virtual void Volume(float vol) = 0;

    virtual bool Muted() = 0;
    virtual void Muted(bool mute) = 0;
    virtual void ToggleMute() {
        (Muted() == true) ? Muted(false) : Muted(true);
    }

    virtual void AddTransformation(VolumeTransformation *transform) = 0;
    virtual void RemoveTransformation(VolumeTransformation *transform) = 0;

public:
    static const int MSG_VOL_CHNG = WM_APP + 1080;
    static const int MSG_VOL_DEVCHNG = WM_APP + 1081;

};

Change transform interface to add/remove

This allows support for multiple transformations


/*

The MIT License (MIT)

Copyright (c) 2015 Alexander Zazhigin mykeich@yandex.ru

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 "broadcasttalk.h"
#include "threadsocket.h"
#include "threadoutaudio.h"
#include "threadinaudio.h"
#include "maindata.h"
#include "udpsocket.h"

#ifdef __ANDROID__
#else

/* Main application */
void main(void * arg){
	LOGI("Enter: main\n");

	LOGI("Exit: main\n");
}
#endif

Add test file for testing func

Add test file for testing func


#ifndef ROUTER_H
#define ROUTER_H

#include <apr_queue.h>

#include "operator/operator.h"
#include "planner/planner.h"
#include "types/tuple.h"

typedef struct C4Router C4Router;

C4Router *router_make(C4Runtime *c4, apr_queue_t *queue);
void router_main_loop(C4Router *router);
apr_queue_t *router_get_queue(C4Router *router);

void router_enqueue_program(apr_queue_t *queue, const char *src);
void router_enqueue_tuple(apr_queue_t *queue, Tuple *tuple,
                          TableDef *tbl_def);

char *router_enqueue_dump_table(apr_queue_t *queue, const char *table,
                                apr_pool_t *pool);

/* Internal APIs: XXX: clearer naming */
void router_install_tuple(C4Router *router, Tuple *tuple,
                          TableDef *tbl_def);
void router_enqueue_internal(C4Router *router, Tuple *tuple,
                             TableDef *tbl_def);
void router_enqueue_net(C4Router *router, Tuple *tuple,
                        TableDef *tbl_def);

OpChainList *router_get_opchain_list(C4Router *router, const char *tbl_name);
void router_add_op_chain(C4Router *router, OpChain *op_chain);

#endif  /* ROUTER_H */

#ifndef ROUTER_H
#define ROUTER_H

#include <apr_queue.h>

#include "operator/operator.h"
#include "planner/planner.h"
#include "types/tuple.h"

typedef struct C4Router C4Router;

C4Router *router_make(C4Runtime *c4, apr_queue_t *queue);
void router_main_loop(C4Router *router);
apr_queue_t *router_get_queue(C4Router *router);

void router_enqueue_program(apr_queue_t *queue, const char *src);
void router_enqueue_tuple(apr_queue_t *queue, Tuple *tuple,
                          TableDef *tbl_def);

char *router_enqueue_dump_table(apr_queue_t *queue, const char *tbl_name,
                                apr_pool_t *pool);

/* Internal APIs: XXX: clearer naming */
void router_install_tuple(C4Router *router, Tuple *tuple,
                          TableDef *tbl_def);
void router_enqueue_internal(C4Router *router, Tuple *tuple,
                             TableDef *tbl_def);
void router_enqueue_net(C4Router *router, Tuple *tuple,
                        TableDef *tbl_def);

OpChainList *router_get_opchain_list(C4Router *router, const char *tbl_name);
void router_add_op_chain(C4Router *router, OpChain *op_chain);

#endif  /* ROUTER_H */

Tweak a function prototype in header.

Tweak a function prototype in header.


#include "interface.h"
#include "ecg.h"
#include "AFE4400.h"

SPI_Interface afe4400_spi(spi_c2);

ECG ecg = ECG(1,1,4,9,PB0,4096,RA8875_BLUE,RA8875_BLACK,1000,tim3,&tft);
PulseOx spo2 = PulseOx(6,1,3,3,&afe4400_spi,PC8,PA9,PA8,PB7,&tft);

void enableSignalAcquisition(void) {
    spo2.enable();
    ecg.enable();
}

void connectSignalsToScreen(Screen& s) {
    s.add(ecg.signalTrace);
    s.add((ScreenElement*) &spo2);
}

#include "interface.h"
#include "ecg.h"
#include "AFE4400.h"

SPI_Interface afe4400_spi(spi_c2);

ECG ecg = ECG(1,1,4,9,PB0,4096,RA8875_BLUE,RA8875_BLACK,1000,tim3,&tft);
PulseOx spo2 = PulseOx(5,1,4,9,&afe4400_spi,PC8,PA9,PA8,PB7,&tft);

void enableSignalAcquisition(void) {
    spo2.enable();
    ecg.enable();
}

void connectSignalsToScreen(Screen& s) {
    s.add(ecg.signalTrace);
    s.add((ScreenElement*) &spo2);
}

Adjust display position for pulse ox

Adjust display position for pulse ox


/*
 *  Copyright (c) 2015 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 COMMON_VIDEO_INTERFACE_TEXTURE_VIDEO_FRAME_H
#define COMMON_VIDEO_INTERFACE_TEXTURE_VIDEO_FRAME_H

#include "webrtc/common_video/interface/i420_video_frame.h"

// TODO(magjed): Remove this when all external dependencies are updated.
namespace webrtc {

typedef I420VideoFrame TextureVideoFrame;

}  // namespace webrtc

#endif  // COMMON_VIDEO_INTERFACE_TEXTURE_VIDEO_FRAME_H

Add intermediate TextureVideoFrame typedef for Chromium

BUG=1128
R=perkj@webrtc.org
TBR=stefan

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

Cr-Original-Commit-Position: 972c6d2dc6dd5efdad1377c0d224e03eb8f276f7@{#8630}
Cr-Mirrored-From: https://chromium.googlesource.com/external/webrtc
Cr-Mirrored-Commit: f98030b029edad449a75309546d7bf4803dfa750


//
//  libPhoneNumber-iOS.h
//  libPhoneNumber-iOS
//
//  Created by Roy Marmelstein on 04/08/2015.
//  Copyright (c) 2015 ohtalk.me. All rights reserved.
//

#import <UIKit/UIKit.h>

//! Project version number for libPhoneNumber-iOS.
FOUNDATION_EXPORT double libPhoneNumber_iOSVersionNumber;

//! Project version string for libPhoneNumber-iOS.
FOUNDATION_EXPORT const unsigned char libPhoneNumber_iOSVersionString[];

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

#import "NBPhoneNumberDefines.h"

// Features
#import "NBAsYouTypeFormatter.h"
#import "NBPhoneNumberUtil.h"

// Metadata
#import "NBMetadataHelper.h"

// Model
#import "NBNumberFormat.h"
#import "NBPhoneMetaData.h"
#import "NBPhoneNumber.h"
#import "NBPhoneNumberDesc.h"

//
//  libPhoneNumber-iOS.h
//  libPhoneNumber-iOS
//
//  Created by Roy Marmelstein on 04/08/2015.
//  Copyright (c) 2015 ohtalk.me. All rights reserved.
//

#import <UIKit/UIKit.h>

//! Project version number for libPhoneNumber-iOS.
FOUNDATION_EXPORT double libPhoneNumber_iOSVersionNumber;

//! Project version string for libPhoneNumber-iOS.
FOUNDATION_EXPORT const unsigned char libPhoneNumber_iOSVersionString[];

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

#import "NBPhoneNumberDefines.h"

// Features
#import "NBAsYouTypeFormatter.h"
#import "NBPhoneNumberUtil.h"

// Metadata
#import "NBMetadataHelper.h"
#import "NBGeocoderMetadataHelper.h"

// Model
#import "NBNumberFormat.h"
#import "NBPhoneMetaData.h"
#import "NBPhoneNumber.h"
#import "NBPhoneNumberDesc.h"

Fix 'umbrella header for module does not include...' error


#include <stdio.h>

int simpleloop (int x, int y) {
  while (x < y) {
    if (x < 3)
      x++;
    else
      x+=2;
  }
  return x;
}

int main () {
  printf("%i", simpleloop(0, 10), stdout);
}

Add Pagai's invariants extraction, fix various typos.


//
//  SNPBlockUserOperation.h
//  Snapper
//
//  Created by Paul Schifferer on 5/12/13.
//  Copyright (c) 2013 Pilgrimage Software. All rights reserved.
//

#import <Snapper/Snapper.h>
#import "SNPUserParameters.h"

@interface SNPBlockUserOperation : SNPBaseUserTokenOperation
<SNPUserParameters>

// -- Properties --
@property (nonatomic, assign) NSUInteger userId;

// -- Initialization --
- (id)initWithUserId:(NSUInteger)userId
           accountId:(NSString*)accountId
         finishBlock:(void (^)(SNPResponse* response))finishBlock;

@end

//
//  SNPBlockUserOperation.h
//  Snapper
//
//  Created by Paul Schifferer on 5/12/13.
//  Copyright (c) 2013 Pilgrimage Software. All rights reserved.
//

#import "SNPBaseUserTokenOperation.h"
#import "SNPUserParameters.h"

@interface SNPBlockUserOperation : SNPBaseUserTokenOperation
<SNPUserParameters>

// -- Properties --
@property (nonatomic, assign) NSUInteger userId;

// -- Initialization --
- (id)initWithUserId:(NSUInteger)userId
           accountId:(NSString*)accountId
         finishBlock:(void (^)(SNPResponse* response))finishBlock;

@end

Use the right import type.

Use the right import type.