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

#include "usb-stm32f3.h"

#include "usb_api.h"

void usb_connect(void)
{
	usb_board_connect();
}

void usb_disconnect(void)
{
	usb_board_connect();
}

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

#include "usb-stm32f3.h"

#include "usb_api.h"

void usb_connect(void)
{
	usb_board_connect();
}

void usb_disconnect(void)
{
	usb_board_disconnect();
}

USB: Fix cut and paste bug for board specific disconnection

Signed-off-by: Anton Staaf <84531b4b964c017023781514a6665b71e84b32bc@chromium.org>

BRANCH=None
BUG=None
TEST=make buildall -j

Change-Id: I8ec4396370b7e3068d29d569b73fddc648e1f76f
Reviewed-on: https://chromium-review.googlesource.com/247720
Trybot-Ready: Anton Staaf <84531b4b964c017023781514a6665b71e84b32bc@chromium.org>
Tested-by: Anton Staaf <84531b4b964c017023781514a6665b71e84b32bc@chromium.org>
Reviewed-by: Vic Yang <5fd92abeee651458f98e2856f4f200ee971cee4d@chromium.org>
Commit-Queue: Anton Staaf <84531b4b964c017023781514a6665b71e84b32bc@chromium.org>


#include <stdio.h>

// Those types are needed but not defined or used in libcurl headers.
typedef size_t header_callback(char *buffer,   size_t size,   size_t nitems, void *userdata);
typedef size_t write_data_callback(void *buffer, size_t size, size_t nmemb, void *userp);

extern void something_using_callback1(header_callback*);
extern void something_using_callback2(write_data_callback*);

#include <stddef.h>

// Those types are needed but not defined or used in libcurl headers.
typedef size_t header_callback(char *buffer,   size_t size,   size_t nitems, void *userdata);
typedef size_t write_data_callback(void *buffer, size_t size, size_t nmemb, void *userp);

Remove some hacks from libcurl sample

Remove some hacks from libcurl sample


// Test that the source manager has the "proper" idea about the include stack
// when using PCH.

// RUN: echo 'int x;' > %t.prefix.h
// RUN: not clang-cc -fsyntax-only -include %t.prefix.h %s 2> %t.diags.no_pch.txt
// RUN: clang-cc -emit-pch -o %t.prefix.pch %t.prefix.h
// RUN: not clang-cc -fsyntax-only -include-pch %t.prefix.pch %s 2> %t.diags.pch.txt
// RUN: diff %t.diags.no_pch.txt %t.diags.pch.txt
// XFAIL: *
// PR5662

float x;

Add test case for PR5662.

Add test case for PR5662.

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


/*ckwg +5
 * Copyright 2011 by Kitware, Inc. All Rights Reserved. Please refer to
 * KITWARE_LICENSE.TXT for licensing information, or contact General Counsel,
 * Kitware, Inc., 28 Corporate Drive, Clifton Park, NY 12065.
 */

#ifndef VISTK_PYTHON_HELPERS_PYTHON_CONVERT_OPTIONAL_H
#define VISTK_PYTHON_HELPERS_PYTHON_CONVERT_OPTIONAL_H

#include <boost/optional.hpp>
#include <boost/python/converter/registry.hpp>

#include <Python.h>

/**
 * \file python_convert_any.h
 *
 * \brief Helpers for working with boost::any in Python.
 */

template <typename T>
class boost_optional_converter
{
  public:
    typedef T type_t;
    typedef boost::optional<T> optional_t;

    boost_optional_converter()
    {
      boost::python::converter::registry::push_back(
        &convertible,
        &construct,
        boost::python::type_id<optional_t>());
    }
    ~boost_optional_converter()
    {
    }

    static void* convertible(PyObject* obj)
    {
      if (obj == Py_None)
      {
        return obj;
      }

      using namespace boost::python::converter;

      registration const& converters(registered<type_t>::converters);

      if (implicit_rvalue_convertible_from_python(obj, converters))
      {
        rvalue_from_python_stage1_data data = rvalue_from_python_stage1(obj, converters);
        return rvalue_from_python_stage2(obj, data, converters);
      }

      return NULL;
    }

    static PyObject* convert(optional_t const& opt)
    {
      if (opt)
      {
        return boost::python::to_python_value<T>()(*opt);
      }
      else
      {
        return boost::python::detail::none();
      }
    }

    static void construct(PyObject* obj, boost::python::converter::rvalue_from_python_stage1_data* data)
    {
      void* storage = reinterpret_cast<boost::python::converter::rvalue_from_python_storage<optional_t>*>(data)->storage.bytes;

#define CONSTRUCT(args)            \
  do                               \
  {                                \
    new (storage) optional_t args; \
    data->convertible = storage;   \
    return;                        \
  } while (false)

      if (obj == Py_None)
      {
        CONSTRUCT(());
      }
      else
      {
        type_t* t = reinterpret_cast<type_t*>(data->convertible);
        CONSTRUCT((*t));
      }

#undef CONSTRUCT
    }
};

#define REGISTER_OPTIONAL_CONVERTER(T)             \
  do                                               \
  {                                                \
    typedef boost_optional_converter<T> converter; \
    typedef typename converter::optional_t opt_t;  \
    to_python_converter<opt_t, converter>();       \
    converter();                                   \
  } while (false)

#endif // VISTK_PYTHON_PIPELINE_PYTHON_CONVERT_OPTIONAL_H

Add boost::optional wrapper for python bindings


#ifndef _ECORE_STR_H
# define _ECORE_STR_H

#ifdef EAPI
#undef EAPI
#endif
#ifdef WIN32
# ifdef BUILDING_DLL
#  define EAPI __declspec(dllexport)
# else
#  define EAPI __declspec(dllimport)
# endif
#else
# ifdef __GNUC__
#  if __GNUC__ >= 4
#   define EAPI __attribute__ ((visibility("default")))
#  else
#   define EAPI
#  endif
# else
#  define EAPI
# endif
#endif

/**
 * @file Ecore_Data.h
 * @brief Contains threading, list, hash, debugging and tree functions.
 */

# ifdef __cplusplus
extern "C" {
# endif

# ifdef __sgi
#  define __FUNCTION__ "unknown"
#  ifndef __cplusplus
#   define inline
#  endif
# endif

   /* strlcpy implementation for libc's lacking it */
   EAPI size_t ecore_strlcpy(char *dst, const char *src, size_t siz);

#ifdef __cplusplus
}
#endif
#endif				/* _ECORE_STR_H */

#ifndef _ECORE_STR_H
# define _ECORE_STR_H

#ifdef EAPI
#undef EAPI
#endif
#ifdef WIN32
# ifdef BUILDING_DLL
#  define EAPI __declspec(dllexport)
# else
#  define EAPI __declspec(dllimport)
# endif
#else
# ifdef __GNUC__
#  if __GNUC__ >= 4
#   define EAPI __attribute__ ((visibility("default")))
#  else
#   define EAPI
#  endif
# else
#  define EAPI
# endif
#endif

/**
 * @file Ecore_Str.h
 * @brief Contains useful C string functions.
 */

# ifdef __cplusplus
extern "C" {
# endif

# ifdef __sgi
#  define __FUNCTION__ "unknown"
#  ifndef __cplusplus
#   define inline
#  endif
# endif

   /* strlcpy implementation for libc's lacking it */
   EAPI size_t ecore_strlcpy(char *dst, const char *src, size_t siz);

#ifdef __cplusplus
}
#endif
#endif				/* _ECORE_STR_H */

Fix doxygen comments for new header.

Fix doxygen comments for new header.

git-svn-id: 70cf712206e5b8426a8d7451e052914a94f8fa22@27891 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33


/*
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) <year>  <name of author>

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 3 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, see <http://www.gnu.org/licenses/>.

*/

///TODO: Make this something entirely different... QVariant wrapped Eigen types, wooh! ;)

#ifndef GLUON_VARIANTTYPES
#define GLUON_VARIANTTYPES

#include <QtCore/QVariant>
#include <QtCore/QMetaType>
#include <Eigen/Geometry>

Q_DECLARE_METATYPE(Eigen::Vector3d)
Q_DECLARE_METATYPE(Eigen::Vector3f)

namespace
{
    struct GluonVariantTypes
    {
        public:
            GluonVariantTypes()
            {
                qRegisterMetaType<Eigen::Vector3d>("Eigen::Vector3d");
                qRegisterMetaType<Eigen::Vector3f>("Eigen::Vector3f");
            }
    };

    GluonVariantTypes gluonVariantTypes;
}
#endif

/*
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) <year>  <name of author>

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 3 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, see <http://www.gnu.org/licenses/>.

*/

///TODO: Make this something entirely different... QVariant wrapped Eigen types, wooh! ;)

#ifndef GLUON_VARIANTTYPES
#define GLUON_VARIANTTYPES

#include <QtCore/QVariant>
#include <QtCore/QMetaType>
#include <Eigen/Geometry>

Q_DECLARE_METATYPE(Eigen::Vector3d);
Q_DECLARE_METATYPE(Eigen::Vector3f);
Q_DECLARE_METATYPE(Eigen::Quaternionf);

namespace
{
    struct GluonVariantTypes
    {
        public:
            GluonVariantTypes()
            {
                qRegisterMetaType<Eigen::Vector3d>("Eigen::Vector3d");
                qRegisterMetaType<Eigen::Vector3f>("Eigen::Vector3f");
                qRegisterMetaType<Eigen::Quaternionf>("Eigen::Quaternionf");
            }
    };

    GluonVariantTypes gluonVariantTypes;
}
#endif

Add Quaternion to variant types, makes Q_PROPERTY support it


/*
* Serpent
* (C) 1999-2007 Jack Lloyd
*
* Distributed under the terms of the Botan license
*/

#ifndef BOTAN_SERPENT_H__
#define BOTAN_SERPENT_H__

#include <botan/block_cipher.h>

namespace Botan {

/**
* Serpent, an AES finalist
*/
class BOTAN_DLL Serpent : public BlockCipher
   {
   public:
      void encrypt_n(const byte in[], byte out[], u32bit blocks) const;
      void decrypt_n(const byte in[], byte out[], u32bit blocks) const;

      void clear() { round_key.clear(); }
      std::string name() const { return "Serpent"; }
      BlockCipher* clone() const { return new Serpent; }
      Serpent() : BlockCipher(16, 16, 32, 8) {}
   protected:
      void key_schedule(const byte key[], u32bit length);

      SecureVector<u32bit, 132> round_key;
   };

}

#endif

/*
* Serpent
* (C) 1999-2007 Jack Lloyd
*
* Distributed under the terms of the Botan license
*/

#ifndef BOTAN_SERPENT_H__
#define BOTAN_SERPENT_H__

#include <botan/block_cipher.h>

namespace Botan {

/**
* Serpent, an AES finalist
*/
class BOTAN_DLL Serpent : public BlockCipher
   {
   public:
      void encrypt_n(const byte in[], byte out[], u32bit blocks) const;
      void decrypt_n(const byte in[], byte out[], u32bit blocks) const;

      void clear() { round_key.clear(); }
      std::string name() const { return "Serpent"; }
      BlockCipher* clone() const { return new Serpent; }
      Serpent() : BlockCipher(16, 16, 32, 8) {}
   protected:
      /**
      * For use by subclasses using SIMD, asm, etc
      * @return const reference to the key schedule
      */
      const SecureVector<u32bit, 132>& get_round_keys() const
         { return round_key; }

      /**
      * For use by subclasses that implement the key schedule
      * @param ks is the new key schedule value to set
      */
      void set_round_keys(const u32bit ks[132])
         { round_key.set(ks, 132); }

   private:
      void key_schedule(const byte key[], u32bit length);
      SecureVector<u32bit, 132> round_key;
   };

}

#endif

Make Serpent's key_schedule and actual round keys private. Add protected accessor functions for get and set. Set is needed by the x86 version since it implements the key schedule directly.


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

static void (*fp0)(void) __attribute__((noreturn));

static void __attribute__((noreturn)) f0(void) {
  fatal();
} // expected-warning {{function declared 'noreturn' should not return}}

// On K&R
int f1() __attribute__((noreturn));

int g0 __attribute__((noreturn)); // expected-warning {{'noreturn' attribute only applies to function types}}

int f2() __attribute__((noreturn(1, 2))); // expected-error {{attribute requires 0 argument(s)}}

void f3() __attribute__((noreturn));
void f3() {
  return;  // expected-warning {{function 'f3' declared 'noreturn' should not return}}
}

#pragma clang diagnostic error "-Winvalid-noreturn"

void f4() __attribute__((noreturn));
void f4() {
  return;  // expected-error {{function 'f4' declared 'noreturn' should not return}}
}

// PR4685
extern void f5 (unsigned long) __attribute__ ((__noreturn__));

void
f5 (unsigned long size)
{

}

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

static void (*fp0)(void) __attribute__((noreturn));

static void __attribute__((noreturn)) f0(void) {
  fatal();
} // expected-warning {{function declared 'noreturn' should not return}}

// On K&R
int f1() __attribute__((noreturn));

int g0 __attribute__((noreturn)); // expected-warning {{'noreturn' attribute only applies to function types}}

int f2() __attribute__((noreturn(1, 2))); // expected-error {{attribute requires 0 argument(s)}}

void f3() __attribute__((noreturn));
void f3() {
  return;  // expected-warning {{function 'f3' declared 'noreturn' should not return}}
}

#pragma clang diagnostic error "-Winvalid-noreturn"

void f4() __attribute__((noreturn));
void f4() {
  return;  // expected-error {{function 'f4' declared 'noreturn' should not return}}
}

// PR4685
extern void f5 (unsigned long) __attribute__ ((__noreturn__));

void
f5 (unsigned long size)
{

}

// PR2461
__attribute__((noreturn)) void f(__attribute__((noreturn)) void (*x)(void)) {
  x();
}

Add testcase for recent checkin.

Add testcase for recent checkin.

Patch by Chip Davis.

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


#ifndef KMER_UTIL_H
#define KMER_UTIL_H
#include <assert.h>
#include "logging_util.h"
// Largest odd kmer that can be held in a uint64_t
#define MAX_KMER 31
#define DEFAULT_KMER 21

#ifndef num2nuc
# ifndef NUM2NUC_STR
#  define NUM2NUC_STR "ACGTN"
# endif
# define num2nuc(x) NUM2NUC_STR[(uint8_t)x]
#endif

#ifdef __cplusplus
namespace dlib {
#endif

    inline void kmer2cstr(uint64_t kmer, int k, char *buf)
    {
        buf[k] = '\0';
        while(k) *buf++ = num2nuc((kmer >> (2 * --k)) & 0x3u);
        //LOG_DEBUG("kmer %lu has now become string '%s'.\n", kmer, start);
    }

#ifdef __cplusplus
}
#endif

#endif

#ifndef KMER_UTIL_H
#define KMER_UTIL_H
#include <assert.h>
#include "logging_util.h"
// Largest odd kmer that can be held in a uint64_t
#define MAX_KMER 31
#define DEFAULT_KMER 21

#ifndef num2nuc
# ifndef NUM2NUC_STR
#  define NUM2NUC_STR "ACGTN"
# endif
# define num2nuc(x) NUM2NUC_STR[(uint8_t)x]
#endif

#ifdef __cplusplus
namespace dlib {
#endif

    inline void kmer2cstr(uint64_t kmer, int k, char *buf)
    {
        buf[k] = '\0';
        while(k) *buf++ = num2nuc((kmer >> (2 * --k)) & 0x3u);
        //LOG_DEBUG("kmer %lu has now become string '%s'.\n", kmer, start);
    }

    // Used to determine the direction in which to encode a kmer
    inline int cstr_rc_lt(char *seq, int k, int cpos) {
        char *_seq1 = cpos + seq, *_seq2 = _seq1 + k - 1;
        for(;k;--k) {
            if(*_seq1 != nuc_cmpl(*_seq2)) return *_seq1 < nuc_cmpl(*_seq2);
            ++_seq1, --_seq2;
        }
        return 0; // This is reverse-complementarily palindromic. Doesn't matter: it's the same string.
    }

#ifdef __cplusplus
}
#endif

#endif

Move kmer functionality from kmei to dlib.


// =============================================================================
// PROJECT CHRONO - http://projectchrono.org
//
// Copyright (c) 2014 projectchrono.org
// All right reserved.
//
// Use of this source code is governed by a BSD-style license that can be found
// in the LICENSE file at the top level of the distribution and at
// http://projectchrono.org/license-chrono.txt.
//
// =============================================================================
// Authors: Radu Serban
// =============================================================================
//
//
// =============================================================================

#ifndef GENERIC_FUNCDRIVER_H
#define GENERIC_FUNCDRIVER_H

#include "subsys/ChDriver.h"

class Generic_FuncDriver : public chrono::ChDriver
{
public:

  Generic_FuncDriver() {}
  ~Generic_FuncDriver() {}

  virtual void Update(double time)
  {
    if (time < 0.5)
      m_throttle = 0;
    else if (time < 1.5)
      m_throttle = 0.4 * (time - 0.5);
    else
      m_throttle = 0.4;

    if (time < 4)
      m_steering = 0;
    else if (time < 6)
      m_steering = 0.25 * (time - 4);
    else if (time < 10)
      m_steering = -0.25 * (time - 6) + 0.5;
    else
      m_steering = -0.5;
  }
};

#endif

Add a generic driver model.

Add a generic driver model.


C $Header$
C $Name$

C The physics state uses the dynamics dimensions in the horizontal
C     and the land dimensions in the horizontal for turbulence variables
c
c Secret Hiding Place - Use to compute gridalt correction term diagnostics
c ------------------------------------------------------------------------
      common /fizhi_SHP/ ubef,vbef,thbef,sbef,
     .                   udynbef,vdynbef,thdynbef,sdynbef

      _RL ubef(1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nrphys,Nsx,Nsy)
      _RL vbef(1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nrphys,Nsx,Nsy)
      _RL thbef(1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nrphys,Nsx,Nsy)
      _RL sbef(1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nrphys,Nsx,Nsy)
      _RL udynbef(1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nr,Nsx,Nsy)
      _RL vdynbef(1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nr,Nsx,Nsy)
      _RL thdynbef(1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nr,Nsx,Nsy)
      _RL sdynbef(1-OLx:sNx+OLx,1-OLy:sNy+OLy,Nr,Nsx,Nsy)

Add new common block to compute some diagnostics when needed


/*
 *  Copyright 2006 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.
 */

// This module contains some basic debugging facilities.
// Originally comes from shared/commandlineflags/checks.h

#ifndef WEBRTC_BASE_CHECKS_H_
#define WEBRTC_BASE_CHECKS_H_

namespace rtc {

// Prints an error message to stderr and aborts execution.
void Fatal(const char* file, int line, const char* format, ...);

}  // namespace rtc

// The UNREACHABLE macro is very useful during development.
#define UNREACHABLE()                                   \
  rtc::Fatal(__FILE__, __LINE__, "unreachable code")

#endif  // WEBRTC_BASE_CHECKS_H_

/*
 *  Copyright 2006 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.
 */

// This module contains some basic debugging facilities.
// Originally comes from shared/commandlineflags/checks.h

#ifndef WEBRTC_BASE_CHECKS_H_
#define WEBRTC_BASE_CHECKS_H_

namespace rtc {

// Prints an error message to stderr and aborts execution.
void Fatal(const char* file, int line, const char* format, ...);

}  // namespace rtc

// Trigger a fatal error (which aborts the process and prints an error
// message). FATAL_ERROR_IF may seem a lot like assert, but there's a crucial
// difference: it's always "on". This means that it can be used to check for
// regular errors that could actually happen, not just programming errors that
// supposedly can't happen---but triggering a fatal error will kill the process
// in an ugly way, so it's not suitable for catching errors that might happen
// in production.
#define FATAL_ERROR(msg) do { rtc::Fatal(__FILE__, __LINE__, msg); } while (0)
#define FATAL_ERROR_IF(x) do { if (x) FATAL_ERROR("check failed"); } while (0)

// The UNREACHABLE macro is very useful during development.
#define UNREACHABLE() FATAL_ERROR("unreachable code")

#endif  // WEBRTC_BASE_CHECKS_H_

Define convenient FATAL_ERROR() and FATAL_ERROR_IF() macros

R=henrike@webrtc.org

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

git-svn-id: 917f5d3ca488f358c4d40eaec14422cf392ccec9@6701 4adac7df-926f-26a2-2b94-8c16560cd09d


#pragma once

#include <iostream>

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

#if !defined(NDEBUG) // Debug

namespace dev
{
namespace evmjit
{

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

}
}

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

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

#pragma once

#include <iostream>

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

#if !defined(NDEBUG) // Debug

namespace dev
{
namespace evmjit
{

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

}
}

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

#else // Release

namespace dev
{
namespace evmjit
{

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

}
}

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

#endif

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


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

/*
 * XFAIL: linux
 */
struct s {
  unsigned long long u33: 33;
  unsigned long long u40: 40;
};

struct s a = { 1, 2};

int foo() {
  return a.u40;
}

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

/*
 * XFAIL: *
 */
struct s {
  unsigned long long u33: 33;
  unsigned long long u40: 40;
};

struct s a = { 1, 2};

int foo() {
  return a.u40;
}

Test fails on all platforms, not just linux

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


//===- lib/ReaderWriter/PECOFF/PDBPass.h ----------------------------------===//
//
//                             The LLVM Linker
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

#ifndef LLD_READER_WRITER_PE_COFF_PDB_PASS_H
#define LLD_READER_WRITER_PE_COFF_PDB_PASS_H

#include "lld/Core/Pass.h"
#include "llvm/ADT/StringRef.h"

#if !defined(_MSC_VER) && !defined(__MINGW32__)
#include <unistd.h>
#else
#include <io.h>
#endif

namespace lld {
namespace pecoff {

class PDBPass : public lld::Pass {
public:
  PDBPass(PECOFFLinkingContext &ctx) : _ctx(ctx) {}

  void perform(std::unique_ptr<MutableFile> &file) override {
    if (_ctx.getDebug())
      touch(_ctx.getPDBFilePath());
  }

private:
  void touch(StringRef path) {
    int fd;
    if (llvm::sys::fs::openFileForWrite(path, fd, llvm::sys::fs::F_Append))
      llvm::report_fatal_error("failed to create a PDB file");
    ::close(fd);
  }

  PECOFFLinkingContext &_ctx;
};

} // namespace pecoff
} // namespace lld

#endif

//===- lib/ReaderWriter/PECOFF/PDBPass.h ----------------------------------===//
//
//                             The LLVM Linker
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

#ifndef LLD_READER_WRITER_PE_COFF_PDB_PASS_H
#define LLD_READER_WRITER_PE_COFF_PDB_PASS_H

#include "lld/Core/Pass.h"
#include "llvm/ADT/StringRef.h"
#include "llvm/Support/Process.h"

namespace lld {
namespace pecoff {

class PDBPass : public lld::Pass {
public:
  PDBPass(PECOFFLinkingContext &ctx) : _ctx(ctx) {}

  void perform(std::unique_ptr<MutableFile> &file) override {
    if (_ctx.getDebug())
      touch(_ctx.getPDBFilePath());
  }

private:
  void touch(StringRef path) {
    int fd;
    if (llvm::sys::fs::openFileForWrite(path, fd, llvm::sys::fs::F_Append))
      llvm::report_fatal_error("failed to create a PDB file");
    llvm::sys::Process::SafelyCloseFileDescriptor(fd);
  }

  PECOFFLinkingContext &_ctx;
};

} // namespace pecoff
} // namespace lld

#endif

Use SafelyCloseFileDescriptor instead of close.

Opening a file using openFileForWrite and closing it using close
was asymmetric. It also had a subtle portability problem (details are
described in the commit message for r219189).

git-svn-id: f6089bf0e6284f307027cef4f64114ee9ebb0424@222802 91177308-0d34-0410-b5e6-96231b3b80d8


static int
parent_main(pid_t child_pid)
{
	pid_t pid;
	int status;

	pid = wait4(child_pid, &status, WNOHANG, NULL);
	if (pid != 0)
		return (1);

	return (0);
}

static void
signal_handler(int sig)
{
}

int
main(int argc, const char *argv[])
{
	struct sigaction act;
	struct timespec t;
	pid_t child_pid;
	int retval;

	act.sa_handler = signal_handler;
	act.sa_flags = 0;
	if (sigfillset(&act.sa_mask) == -1)
		return (16);
	if (sigaction(SIGTERM, &act, NULL) == -1)
		return (17);

	child_pid = fork();
	switch (child_pid) {
	case -1:
		return (18);
	case 0:
		t.tv_sec = 8;
		t.tv_nsec = 0;
		nanosleep(&t, NULL);
		return (0);
	default:
		break;
	}

	retval = parent_main(child_pid);

	kill(child_pid, SIGTERM);

	return (retval);
}

static int
parent_main(pid_t child_pid)
{
	pid_t pid;
	int status;

	pid = wait4(child_pid, &status, WNOHANG, NULL);
	if (pid != 0)
		return (1);

	return (0);
}

int
main(int argc, const char *argv[])
{
	pid_t child_pid;
	int retval;

	child_pid = fork();
	switch (child_pid) {
	case -1:
		return (18);
	case 0:
		for (;;)
			;
		return (0);
	default:
		break;
	}

	retval = parent_main(child_pid);

	kill(child_pid, SIGKILL);

	return (retval);
}

Simplify the test for wait4(2) with WNOHANG.


// 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 DeviceEnabled() = 0;

    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;

};

// 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 bool DeviceEnabled() = 0;

    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;

};

Use proper return type X-(

Use proper return type X-(


/**
 * Project
 * #    #     #     ######   ######
 * #   #     # #    #     #  #     #
 * #  #     #   #   #     #  #     #
 * ###     #     #  ######   ######
 * #  #    #######  #   #    #   #
 * #   #   #     #  #    #   #    #
 * #    #  #     #  #     #  #     #
 *
 * Copyright (c) 2014, Project KARR
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions are met:
 *
 * 1. Redistributions of source code must retain the above copyright notice,
 * this list of conditions and the following disclaimer.
 *
 * 2. Redistributions in binary form must reproduce the above copyright notice,
 * this list of conditions and the following disclaimer in the documentation
 * and/or other materials provided with the distribution.
 *
 * THIS SOFTWARE IS PROVIDED BY THE 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 HAVE_KARR_ARDUINO_DATA_PACKET_H
#define HAVE_KARR_ARDUINO_DATA_PACKET_H

struct ArduinoDataPacket {
    int version;
    int counter;
    int analog[5];
    int flags;
};

#endif

Add Arduino Data packet header.

Add Arduino Data packet header.


#pragma once

// const float in a header file can lead to duplication of the storage
// but I don't really care in this case. Just don't do it with a header
// that is included hundreds of times.
const float kCurrentVersion = 1.49f;

// Put a "#define VERSION_SUFFIX 'b'" line here to add a minor version
// increment that won't trigger the new-version checks, handy for minor
// releases that I don't want to bother users about.
//#define VERSION_SUFFIX 'b'

#pragma once

// const float in a header file can lead to duplication of the storage
// but I don't really care in this case. Just don't do it with a header
// that is included hundreds of times.
const float kCurrentVersion = 1.50f;

// Put a "#define VERSION_SUFFIX 'b'" line here to add a minor version
// increment that won't trigger the new-version checks, handy for minor
// releases that I don't want to bother users about.
//#define VERSION_SUFFIX 'b'

Change version number to 1.50

Change version number to 1.50


#import <UIKit/UIKit.h>

//! Project version number for EasyImagy.
FOUNDATION_EXPORT double EasyImagyVersionNumber;

//! Project version string for EasyImagy.
FOUNDATION_EXPORT const unsigned char EasyImagyVersionString[];

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

#import <Foundation/Foundation.h>

//! Project version number for EasyImagy.
FOUNDATION_EXPORT double EasyImagyVersionNumber;

//! Project version string for EasyImagy.
FOUNDATION_EXPORT const unsigned char EasyImagyVersionString[];

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

Replace unnecessary import of UIKit with Foundation


/* This source file is part of the Tomviz project, https://tomviz.org/.
  It is released under the 3-Clause BSD License, see "LICENSE". */

#ifndef tomvizPresetDialog_h
#define tomvizPresetDialog_h

#include <QDialog>
#include <QScopedPointer>

class QTableView;
class vtkSMProxy;

namespace Ui {
class PresetDialog;
}

namespace tomviz {

class PresetModel;

class PresetDialog : public QDialog
{
  Q_OBJECT

public:
  explicit PresetDialog(QWidget* parent);
  QString presetName();
  void addNewPreset(const QJsonObject& newPreset);
  QJsonObject jsonObject();
  ~PresetDialog() override;

signals:
  void applyPreset();
  void resetToDefaults();

private slots:
  void warning();

private:
  QScopedPointer<Ui::PresetDialog> m_ui;
  PresetModel* m_model;
  QTableView* m_view;
  void customMenuRequested(const QModelIndex& Index);
};
} // namespace tomviz

#endif

/* This source file is part of the Tomviz project, https://tomviz.org/.
  It is released under the 3-Clause BSD License, see "LICENSE". */

#ifndef tomvizPresetDialog_h
#define tomvizPresetDialog_h

#include <QDialog>
#include <QScopedPointer>

class QTableView;
class vtkSMProxy;

namespace Ui {
class PresetDialog;
}

namespace tomviz {

class PresetModel;

class PresetDialog : public QDialog
{
  Q_OBJECT

public:
  explicit PresetDialog(QWidget* parent);
  ~PresetDialog() override;
  QString presetName();
  void addNewPreset(const QJsonObject& newPreset);
  QJsonObject jsonObject();

signals:
  void applyPreset();
  void resetToDefaults();

private slots:
  void warning();

private:
  QScopedPointer<Ui::PresetDialog> m_ui;
  PresetModel* m_model;
  QTableView* m_view;
  void customMenuRequested(const QModelIndex& Index);
};
} // namespace tomviz

#endif

Move destructor to be below constructor

Move destructor to be below constructor

Signed-off-by: Marcus D. Hanwell <cf7042e2e8eee958b5bcde1ae2cbefef82efc184@kitware.com>


// SKIP PARAM: --sets ana.activated[+] octApron
#include <pthread.h>
#include <assert.h>

int g = 17; // matches write in t_fun
int h = 14; // matches write in t_fun
pthread_mutex_t A = PTHREAD_MUTEX_INITIALIZER;
pthread_mutex_t B = PTHREAD_MUTEX_INITIALIZER;

void *t_fun(void *arg) {
  int t;
  pthread_mutex_lock(&A);
  pthread_mutex_lock(&B);
  g = 17;
  t = g;
  h = t - 3;
  pthread_mutex_unlock(&B);
  pthread_mutex_unlock(&A);
  return NULL;
}

void *t2_fun(void *arg) {
  int t;
  pthread_mutex_lock(&B);
  t = h;
  t--;
  h = t;
  pthread_mutex_unlock(&B);
  return NULL;
}

void *t3_fun(void *arg) {
  int t;
  pthread_mutex_lock(&A);
  t = g;
  t++;
  g = t;
  pthread_mutex_unlock(&A);
  return NULL;
}

int main(void) {
  int t;

  pthread_t id, id2, id3;
  pthread_create(&id, NULL, t_fun, NULL);
  pthread_create(&id2, NULL, t2_fun, NULL);
  pthread_create(&id3, NULL, t3_fun, NULL);

  pthread_mutex_lock(&A);
  pthread_mutex_lock(&B);
  assert(g >= h); // UNKNOWN?
  pthread_mutex_unlock(&B);
  pthread_mutex_unlock(&A);
  return 0;
}

Add relational traces even-more-rpb example


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

#ifndef _MACHINE_BWX_H_
#define	_MACHINE_BWX_H_

static __inline u_int8_t
ldbu(vm_offset_t va)
{
    u_int64_t r;
    __asm__ __volatile__ ("ldbu %0,%1" : "=r"(r) : "m"(*(u_int8_t*)va));
    return r;
}

static __inline u_int16_t
ldwu(vm_offset_t va)
{
    u_int64_t r;
    __asm__ __volatile__ ("ldwu %0,%1" : "=r"(r) : "m"(*(u_int16_t*)va));
    return r;
}

static __inline u_int32_t
ldl(vm_offset_t va)
{
    return *(u_int32_t*) va;
}

static __inline void
stb(vm_offset_t va, u_int64_t r)
{
    __asm__ __volatile__ ("stb %1,%0" : "=m"(*(u_int8_t*)va) : "r"(r));
    __asm__ __volatile__ ("mb");
}

static __inline void
stw(vm_offset_t va, u_int64_t r)
{
    __asm__ __volatile__ ("stw %1,%0" : "=m"(*(u_int16_t*)va) : "r"(r));
    __asm__ __volatile__ ("mb");
}

static __inline void
stl(vm_offset_t va, u_int64_t r)
{
    __asm__ __volatile__ ("stl %1,%0" : "=m"(*(u_int32_t*)va) : "r"(r));
    __asm__ __volatile__ ("mb");
}

#endif /* !_MACHINE_BWX_H_ */

Add macros for byte/word sized load and store instructions.


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

#ifndef UI_AURA_AURA_SWITCHES_H_
#define UI_AURA_AURA_SWITCHES_H_
#pragma once

namespace switches {

extern const char kAuraHostWindowSize[];
extern const char kAuraWindows[];

}  // namespace switches

#endif  // UI_AURA_AURA_SWITCHES_H_

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

#ifndef UI_AURA_AURA_SWITCHES_H_
#define UI_AURA_AURA_SWITCHES_H_
#pragma once

#include "ui/aura/aura_export.h"

namespace switches {

AURA_EXPORT extern const char kAuraHostWindowSize[];
AURA_EXPORT extern const char kAuraWindows[];

}  // namespace switches

#endif  // UI_AURA_AURA_SWITCHES_H_

Fix shared library build for aura.

Fix shared library build for aura.

TBR=ben@chromium.org,derat@chromium.org
R=ben@chromium.org,derat@chromium.org
BUG=none
TEST=none

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

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


void multiply_by_diagonal(const int rows, const int cols,
                          double* restrict diagonal, double* restrict matrix) {
        /*
         * Multiply a matrix by a diagonal matrix (represented as a flat array
         * of n values). The diagonal structure is exploited (so that we use
         * n^2 multiplications instead of n^3); the product looks something
         * like
         *
         *     sage: A = matrix([[a,b,c], [d,e,f],[g,h,i]]);
         *     sage: w = matrix([[z1,0,0],[0,z2,0],[0,0,z3]]);
         *     sage: A * w
         *      => [a*z1 b*z2 c*z3]
         *         [d*z1 e*z2 f*z3]
         *         [g*z1 h*z2 i*z3]
         */
        int i, j;
        /* traverse the matrix in the correct order. */
#ifdef USE_COL_MAJOR
        for (j = 0; j < cols; j++)
                for (i = 0; i < rows; i++)
#else
        for (i = 0; i < rows; i++)
                for (j = 0; j < cols; j++)
#endif
                        matrix[ORDER(i, j, rows, cols)] *= diagonal[j];
}

REFACTOR removed duplicates and created own file for this


//
//  FBTweak+Dictionary.h
//  FBTweak
//
//  Created by John McIntosh on 11/5/14.
//  Copyright (c) 2014 Facebook. All rights reserved.
//

#import <FBTweak/FBTweak.h>

/**
 Implementation works by storing the dictionary in the tweak's `stepValue`.
 */
@interface FBTweak (Dictionary)

@property (nonatomic, copy, readonly) NSArray *allKeys;
@property (nonatomic, copy, readonly) NSArray *allValues;
@property (nonatomic, copy, readwrite) NSDictionary *dictionaryValue;

- (BOOL)isDictionary;

@end

FBTweakValue FBDictionaryTweak(NSString *categoryName, NSString *collectionName, NSString *tweakName, NSDictionary *dictionary, id defaultKey);

//
//  FBTweak+Dictionary.h
//  FBTweak
//
//  Created by John McIntosh on 11/5/14.
//  Copyright (c) 2014 Facebook. All rights reserved.
//

#import "FBTweak.h"

/**
 Implementation works by storing the dictionary in the tweak's `stepValue`.
 */
@interface FBTweak (Dictionary)

@property (nonatomic, copy, readonly) NSArray *allKeys;
@property (nonatomic, copy, readonly) NSArray *allValues;
@property (nonatomic, copy, readwrite) NSDictionary *dictionaryValue;

- (BOOL)isDictionary;

@end

FBTweakValue FBDictionaryTweak(NSString *categoryName, NSString *collectionName, NSString *tweakName, NSDictionary *dictionary, id defaultKey);

Update syntax for import statement

Update syntax for import statement


#include "nb_simp.c"

struct arrayProb* gibbsC_shim(struct arrayProb* topic_prior_b,
                struct arrayProb* word_prior_c,
                struct arrayNat* z_d,
                struct arrayNat* w_e,
                struct arrayNat* doc_f,
                unsigned int docUpdate_g)
{
  struct arrayProb* res = (struct arrayProb*)malloc(sizeof(struct arrayProb*));
  *res = gibbsC(*topic_prior_b, *word_prior_c, *z_d, *w_e, *doc_f, docUpdate_g);
  return res;
}

#include "nb_simp.c"

struct arrayProb* gibbsC_shim(struct arrayProb* topic_prior_b,
                struct arrayProb* word_prior_c,
                struct arrayNat* z_d,
                struct arrayNat* w_e,
                struct arrayNat* doc_f,
                unsigned int docUpdate_g)
{
  struct arrayProb* res = (struct arrayProb*)malloc(sizeof(struct arrayProb));
  *res = gibbsC(*topic_prior_b, *word_prior_c, *z_d, *w_e, *doc_f, docUpdate_g);
  return res;
}

Fix size error in malloc call

Fix size error in malloc call


//
//  MLMediaLibrary.h
//  MobileMediaLibraryKit
//
//  Created by Pierre d'Herbemont on 7/14/10.
//  Copyright 2010 __MyCompanyName__. All rights reserved.
//

#import <CoreData/CoreData.h>

@interface MLMediaLibrary : NSObject {
    NSManagedObjectContext *_managedObjectContext;
    NSManagedObjectModel   *_managedObjectModel;

    BOOL _allowNetworkAccess;
}

+ (id)sharedMediaLibrary;

- (void)addFilePaths:(NSArray *)filepaths;
- (void)updateDatabase; // Removes missing files

// May be internal
- (NSFetchRequest *)fetchRequestForEntity:(NSString *)entity;
- (id)createObjectForEntity:(NSString *)entity;
- (NSString *)thumbnailFolderPath;

- (void)applicationWillStart;
- (void)applicationWillExit;

- (void)save;
- (void)libraryDidDisappear;
- (void)libraryDidAppear;
@end

//
//  MLMediaLibrary.h
//  MobileMediaLibraryKit
//
//  Created by Pierre d'Herbemont on 7/14/10.
//  Copyright 2010 __MyCompanyName__. All rights reserved.
//

#import <CoreData/CoreData.h>

@interface MLMediaLibrary : NSObject {
    NSManagedObjectContext *_managedObjectContext;
    NSManagedObjectModel   *_managedObjectModel;

    BOOL _allowNetworkAccess;
}

+ (id)sharedMediaLibrary;

- (void)addFilePaths:(NSArray *)filepaths;

// May be internal
- (NSFetchRequest *)fetchRequestForEntity:(NSString *)entity;
- (id)createObjectForEntity:(NSString *)entity;
- (NSString *)thumbnailFolderPath;

- (void)applicationWillStart;
- (void)applicationWillExit;

- (void)save;
- (void)libraryDidDisappear;
- (void)libraryDidAppear;
@end

Revert "Adding a public method to be able to update the database"

This reverts commit 0c6bfc6ec7f63d468b0222c00ab1e31d69c62d40.

Conflicts:
	Sources/MLMediaLibrary.m


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

// Common IPC messages used for child processes.
// Multiply-included message file, hence no include guard.

#include "googleurl/src/gurl.h"
#include "ipc/ipc_message_macros.h"

#define IPC_MESSAGE_START ChildProcessMsgStart

// Messages sent from the browser to the child process.

// Tells the child process it should stop.
IPC_MESSAGE_CONTROL0(ChildProcessMsg_AskBeforeShutdown)

// Sent in response to ChildProcessHostMsg_ShutdownRequest to tell the child
// process that it's safe to shutdown.
IPC_MESSAGE_CONTROL0(ChildProcessMsg_Shutdown)

#if defined(IPC_MESSAGE_LOG_ENABLED)
// Tell the child process to begin or end IPC message logging.
IPC_MESSAGE_CONTROL1(ChildProcessMsg_SetIPCLoggingEnabled,
                     bool /* on or off */)
#endif

// Messages sent from the child process to the browser.

IPC_MESSAGE_CONTROL0(ChildProcessHostMsg_ShutdownRequest)

// Get the list of proxies to use for |url|, as a semicolon delimited list
// of "<TYPE> <HOST>:<PORT>" | "DIRECT".
IPC_SYNC_MESSAGE_CONTROL1_2(ChildProcessHostMsg_ResolveProxy,
                            GURL /* url */,
                            int /* network error */,
                            std::string /* proxy list */)

Add newline at end of file

Add newline at end of file

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


/*
 * waysome - wayland based window manager
 *
 * Copyright in alphabetical order:
 *
 * Copyright (C) 2014-2015 Julian Ganz
 * Copyright (C) 2014-2015 Manuel Messner
 * Copyright (C) 2014-2015 Marcel Müller
 * Copyright (C) 2014-2015 Matthias Beyer
 * Copyright (C) 2014-2015 Nadja Sommerfeld
 *
 * This file is part of waysome.
 *
 * waysome is free software: you can redistribute it and/or modify it under the
 * terms of the GNU Lesser General Public License as published by the Free
 * Software Foundation, either version 2.1 of the License, or (at your option)
 * any later version.
 *
 * waysome is distributed in the hope that it will be useful, but WITHOUT ANY
 * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
 * A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
 * details.
 *
 * You should have received a copy of the GNU Lesser General Public License
 * along with waysome. If not, see <http://www.gnu.org/licenses/>.
 */

#ifndef __WS_SESSION_MANAGER_H__
#define __WS_SESSION_MANAGER_H__

#endif // __WS_SESSION_MANAGER_H__

/*
 * waysome - wayland based window manager
 *
 * Copyright in alphabetical order:
 *
 * Copyright (C) 2014-2015 Julian Ganz
 * Copyright (C) 2014-2015 Manuel Messner
 * Copyright (C) 2014-2015 Marcel Müller
 * Copyright (C) 2014-2015 Matthias Beyer
 * Copyright (C) 2014-2015 Nadja Sommerfeld
 *
 * This file is part of waysome.
 *
 * waysome is free software: you can redistribute it and/or modify it under the
 * terms of the GNU Lesser General Public License as published by the Free
 * Software Foundation, either version 2.1 of the License, or (at your option)
 * any later version.
 *
 * waysome is distributed in the hope that it will be useful, but WITHOUT ANY
 * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
 * A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
 * details.
 *
 * You should have received a copy of the GNU Lesser General Public License
 * along with waysome. If not, see <http://www.gnu.org/licenses/>.
 */

/**
 * @addtogroup session "Session manager"
 *
 * @{
 */

#ifndef __WS_SESSION_MANAGER_H__
#define __WS_SESSION_MANAGER_H__

#endif // __WS_SESSION_MANAGER_H__

/**
 * @}
 */

Add session files to session doc group

Add session files to session doc group


#if defined(__APPLE__) && defined(__MACH__)
/* for OSX */
#   define Fprefix "_"
#else
/* Default to linux */
#   define Fprefix ""
#endif
#define Assembler "as --32 -g -o %s -"

#if defined(__APPLE__) && defined(__MACH__)
/* for OSX */
#   define Assembler "as -arch i386 -g -o %s -"
#   define Fprefix "_"
#else
/* Default to linux */
#   define Assembler "as --32 -g -o %s -"
#   define Fprefix ""
#endif

Use the appropriate assembler for OSX.

Use the appropriate assembler for OSX.


#ifndef SSPAPPLICATION_ENTITIES_DOORENTITY_H
#define SSPAPPLICATION_ENTITIES_DOORENTITY_H

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

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

	std::vector<ElementState> m_elementStates;

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

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

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

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

#endif

#ifndef SSPAPPLICATION_ENTITIES_DOORENTITY_H
#define SSPAPPLICATION_ENTITIES_DOORENTITY_H

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

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

	std::vector<ElementState> m_elementStates;

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

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

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

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

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

#endif

UPDATE Door rotation standard of 90 degrees


// RUN: mkdir -p %t.dir
// RUN: echo '#include "header2.h"' > %t.dir/header1.h
// RUN: echo > %t.dir/header2.h
// RUN: cp %s %t.dir/t.c
// RUN: %clang_cc1 -x c-header %t.dir/header1.h -emit-pch -o %t.pch
// RUN: echo >> %t.dir/header2.h
// RUN: %clang_cc1 %t.dir/t.c -include-pch %t.pch -fsyntax-only 2>&1 | FileCheck %s

#include "header2.h"

// CHECK: fatal error: file {{.*}} has been modified since the precompiled header was built
// DISABLE: win32

// RUN: mkdir -p %t.dir
// RUN: echo '#include "header2.h"' > %t.dir/header1.h
// RUN: echo > %t.dir/header2.h
// RUN: cp %s %t.dir/t.c
// RUN: %clang_cc1 -x c-header %t.dir/header1.h -emit-pch -o %t.pch
// RUN: echo >> %t.dir/header2.h
// RUN: %clang_cc1 %t.dir/t.c -include-pch %t.pch -fsyntax-only 2>&1 | FileCheck %s

#include "header2.h"

// CHECK: fatal error: file {{.*}} has been modified since the precompiled header was built
// REQUIRES: shell

Disable on Windows, for real.

Disable on Windows, for real.

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


#pragma once

#include <math.h>

struct Vector3 {
    union {
        float v[3];
        struct {
            float x;
            float y;
            float z;
        };
        struct {
            float azimuth;
            float pitch;
            float roll;
        };
    };

    Vector3() {
        x = 0;
        y = 0;
        z = 0;
    }

    float norm() {
        return sqrt(x*x + y*y + z*z);
    }

    void normalize() {
        float n = norm();

        if(n > 0) {
            x /= n;
            y /= n;
            z /= n;
        }
    }
};

#pragma once

#include <math.h>

struct Vector3 {
    union {
        float v[3];
        struct {
            float x;
            float y;
            float z;
        };
        struct {
            union {
                float azimuth;
                float yaw;
            };
            float pitch;
            float roll;
        };
    };

    Vector3() {
        x = 0;
        y = 0;
        z = 0;
    }

    float norm() {
        return sqrt(x*x + y*y + z*z);
    }

    void normalize() {
        float n = norm();

        if(n > 0) {
            x /= n;
            y /= n;
            z /= n;
        }
    }
};

Allow both yaw and azimuth

Allow both yaw and azimuth


#include <cgreen/slurp.h>
#include <stdlib.h>
#include <stdio.h>

static char *read_all(FILE *file, int gulp);

char *slurp(const char *file_name, int gulp) {
    FILE *file = fopen(file_name, "r");
    if (file == NULL) {
        return NULL;
    }
    char *content = read_all(file, gulp);
    fclose(file);
    return content;
}

static char *read_all(FILE *file, int gulp) {
    char *content = (char *)malloc((gulp + 1) * sizeof(char));
    char *block = content;
    for ( ; ; ) {
        if (fgets(block, gulp + 1, file) == NULL) {
            break;
        }
        block += gulp;
        content = (char *)realloc(content, (block - content + 1) * sizeof(char));
    }
    return content;
}

#include <cgreen/slurp.h>
#include <stdlib.h>
#include <stdio.h>
#include <strings.h>

static char *read_all(FILE *file, int gulp);

char *slurp(const char *file_name, int gulp) {
    FILE *file = fopen(file_name, "r");
    if (file == NULL) {
        return NULL;
    }
    char *content = read_all(file, gulp);
    fclose(file);
    return content;
}

static char *read_all(FILE *file, int gulp) {
    char *content = (char *)malloc(0);
    int sblock = (gulp + 1) * sizeof(char);
    char *block = (char *)malloc(sblock);
    int len = 0;
    int add = 0;
    char *p;
    for ( ; ; ) {
        if (fgets(block, sblock, file) == NULL) {
            break;
        }

        len  = strlen(block);
	add += len;

        p = (char *)realloc(content, add + 1);
	if (p == NULL) {
		exit(1);
	}
        content = p;

	strncat(content, block, len);
    }
    content[add + 1] = '\0';
    free(block);
    return content;
}

Fix read_all and return content without segment fault


/**
 *  tapcfg - A cross-platform configuration utility for TAP driver
 *  Copyright (C) 2008  Juho Vähä-Herttua
 *
 *  This library is free software; you can redistribute it and/or
 *  modify it under the terms of the GNU Lesser General Public
 *  License as published by the Free Software Foundation; either
 *  version 2.1 of the License, or (at your option) any later version.
 *
 *  This library is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 *  Lesser General Public License for more details.
 */

#ifndef SERVERSOCK_H
#define SERVERSOCK_H

#include "tapcfg.h"

typedef struct serversock_s serversock_t;

serversock_t *serversock_tcp(unsigned short *local_port, int use_ipv6, int public);
int serversock_get_fd(serversock_t *server);
int serversock_accept(serversock_t *server);
void serversock_destroy(serversock_t *server);

#endif

Add missing header from last commit

Add missing header from last commit


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

void spawn_again(int signum)
{
	(void) signum; /* unused */

	pid_t pid = fork();
	if (pid == 0) {
		setsid();
		return;
	}
	exit(EXIT_SUCCESS);
}

int main(int argc, char **argv)
{
	struct sigaction new_action = { 0 };
	new_action.sa_handler = &spawn_again;
	sigaction (SIGTERM, &new_action, NULL);

	/* do something */
	while(1) {};
}

#include <signal.h>
#include <unistd.h>
#include <stdlib.h>
#include <stdio.h>
#include <sys/shm.h>

#define NUMBER_OF_THE_BEAST 666

struct shared {
	pid_t pid;
};

static struct shared *shared;

void spawn_again(int signum)
{
	(void) signum; /* unused */

	pid_t pid = fork();
	if (pid == 0) {
		/* signalize change of pid ...
		 * don't bother with atomicity here...
		 * */
		shared->pid = getpid();
		setsid();
		return;
	}
	exit(EXIT_SUCCESS);
}

int main(int argc, char **argv)
{
	/* Initialize shard memory */
	const int shmid = shmget(NUMBER_OF_THE_BEAST, sizeof(struct shared), IPC_CREAT | 0666);
	if (shmid == -1) {
		perror("shmget failed!");
		exit(EXIT_FAILURE);
	}
	shared = (struct shared*) shmat(shmid, NULL, 0);
	if (shared == NULL) {
		perror("shmat failed!");
		exit(EXIT_FAILURE);
	}
	shared->pid = getpid();

	/* Set signal handlers */
	struct sigaction new_action = { 0 };
	new_action.sa_handler = &spawn_again;
	sigaction (SIGTERM, &new_action, NULL);

	/* do something */
	while(1) {};
}

Add basic support for shared memory

userspace: Add basic support for shared memory

Basic communication protocol between daemons.


#include <assert.h>
#include <stdio.h>
#include <stdlib.h>
#include "noreturn.h"

// Because assert_fail is marked as noreturn, the call to it is not followed
// by another instruction in this function.
// This test ensures that "thisFunctionWontReturn is on the dumped stack.
int thisFunctionWontReturn(int x)
{
    if (x) {
        for (int i = 0; i < 10; ++i) {
            printf("%d green bottles hanging on the wall", 10 - i);
        }
        thisFunctionTerminatesTheProcess();
    }
    return 0;
}

int
main()
{
    thisFunctionWontReturn(1);
}

#include <assert.h>
#include <stdio.h>
#include <stdlib.h>
#include "noreturn.h"

// Because assert_fail is marked as noreturn, the call to it is not followed
// by another instruction in this function.
// This test ensures that "thisFunctionWontReturn is on the dumped stack.
__attribute__((noinline, weak)) // avoid inlining or IPO.
int thisFunctionWontReturn(int x)
{
    if (x) {
        for (int i = 0; i < 10; ++i) {
            printf("%d green bottles hanging on the wall\n", 10 - i);
        }
        thisFunctionTerminatesTheProcess();
    }
    return 0;
}

int
main()
{
    thisFunctionWontReturn(1);
}

Make tests work in gcc11/clang

Make tests work in gcc11/clang

When inlined, we lose our stackframe for our trampoline function in this
test - disallow the optimisations that break the test.


#define CGLTF_IMPLEMENTATION
#include "../cgltf.h"

#include <stdio.h>

int main(int argc, char** argv)
{
	if (argc < 2)
	{
		printf("err\n");
		return -1;
	}

	cgltf_options options = {0};
	cgltf_data* data = NULL;
	cgltf_result result = cgltf_parse_file(&options, argv[1], &data);

	if (result == cgltf_result_success)
		result = cgltf_load_buffers(&options, data, argv[1]);

	printf("Result: %d\n", result);

	if (result == cgltf_result_success)
	{
		printf("Type: %u\n", data->file_type);
		printf("Meshes: %lu\n", data->meshes_count);
	}

	cgltf_free(data);

	return result;
}

#define CGLTF_IMPLEMENTATION
#include "../cgltf.h"

#include <stdio.h>

int main(int argc, char** argv)
{
	if (argc < 2)
	{
		printf("err\n");
		return -1;
	}

	cgltf_options options = {0};
	cgltf_data* data = NULL;
	cgltf_result result = cgltf_parse_file(&options, argv[1], &data);

	if (result == cgltf_result_success)
		result = cgltf_load_buffers(&options, data, argv[1]);

	if (result == cgltf_result_success)
		result = cgltf_validate(data);

	printf("Result: %d\n", result);

	if (result == cgltf_result_success)
	{
		printf("Type: %u\n", data->file_type);
		printf("Meshes: %lu\n", data->meshes_count);
	}

	cgltf_free(data);

	return result;
}

Add validation to test program

Add validation to test program

This makes sure we exercise this code during CI for all test models.


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

#ifndef BRPC_SERVER_NODE_H
#define BRPC_SERVER_NODE_H

#include <string>
#include "butil/endpoint.h"

namespace brpc {

// Representing a server inside a NamingService.
struct ServerNode {
    ServerNode() {}

    explicit ServerNode(const butil::EndPoint& pt) : addr(pt) {}

    ServerNode(butil::ip_t ip, int port, const std::string& tag2)
        : addr(ip, port), tag(tag2) {}

    ServerNode(const butil::EndPoint& pt, const std::string& tag2)
        : addr(pt), tag(tag2) {}

    ServerNode(butil::ip_t ip, int port) : addr(ip, port) {}

    butil::EndPoint addr;
    std::string tag;
};

inline bool operator<(const ServerNode& n1, const ServerNode& n2)
{ return n1.addr != n2.addr ? (n1.addr < n2.addr) : (n1.tag < n2.tag); }

inline bool operator==(const ServerNode& n1, const ServerNode& n2)
{ return n1.addr == n2.addr && n1.tag == n2.tag; }

inline bool operator!=(const ServerNode& n1, const ServerNode& n2)
{ return !(n1 == n2); }

inline std::ostream& operator<<(std::ostream& os, const ServerNode& n) {
    os << n.addr;
    if (!n.tag.empty()) {
        os << "(tag=" << n.tag << ')';
    }
    return os;
}

} // namespace brpc

#endif  // BRPC_SERVER_NODE_H

Move ServerNode into separate file

Move ServerNode into separate file


/* Siconos-Numerics, Copyright INRIA 2005-2011.
 * Siconos is a program dedicated to modeling, simulation and control
 * of non smooth dynamical systems.
 * Siconos is a 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.
 * Siconos 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 Siconos; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 *
 * Contact: Vincent ACARY, siconos-team@lists.gforge.inria.fr
 */

//#include "SolverOptions.h"
//#include "MixedComplementarityProblem.h"

#include <assert.h>

#include "MCP_Solvers.h"
#include "MCP_cst.h"

char SICONOS_MCP_NEWTON_FBLSA_STR[] = "Newton FBLSA";
char SICONOS_MCP_NEWTON_MINFBLSA_STR[] = "Newton minFBLSA";

int mcp_driver2(MixedComplementarityProblem2* problem, double *z , double *Fmcp, SolverOptions* options, NumericsOptions* global_options)
{
  assert(options != NULL);

  /* Set global options */
  if (global_options)
    setNumericsOptions(global_options);

  /* Checks inputs */
  assert(problem != NULL);
  assert(z != NULL);
  assert(Fmcp != NULL);
  /* Output info. : 0: ok -  >0: error (which depends on the chosen solver) */
  int info = -1;

  switch (options->solverId)
  {
  case SICONOS_MCP_NEWTON_FBLSA: // Fischer-Burmeister/Newton -- new version
    mcp_newton_FBLSA(problem, z, Fmcp, &info, options);
    break;

  case SICONOS_MCP_NEWTON_MINFBLSA: // Fischer-Burmeister/Newton + min descent direction
    mcp_newton_minFBLSA(problem, z, Fmcp, &info, options);
    break;

  default:
    fprintf(stderr, "mcp_driver error: unknown solver id: %d\n", options->solverId);
    exit(EXIT_FAILURE);
  }

  return info;
}

Fix lower/uppercase file name stuff. Please remember Macos users and do not change filename from upper to lowercase ...


#include <firestorm.h>
#include <isl29035.h>
#include <stdio.h>
#include <stdbool.h>

void print_intensity(int intensity) {
  printf("Intensity: %d\n", intensity);
}

void intensity_cb(int intensity, int unused1, int unused2, void* ud) {
  print_intensity(intensity);
}

void temp_callback(int temp_value, int err, int unused, void* ud) {
  gpio_toggle(LED_0);
  printf("Current Temp (%d) [0x%X]\n", temp_value, err);
}

void timer_fired(int arg0, int arg1, int arg2, void* ud) {
  isl29035_start_intensity_reading();
}

int main() {
  printf("Hello\n");
  gpio_enable_output(LED_0);

  isl29035_subscribe(intensity_cb, NULL);
  // Setup periodic timer
  timer_subscribe(timer_fired, NULL);
  timer_start_repeating(1000);

  tmp006_start_sampling(0x2, temp_callback, NULL);

  return 0;
}

#include <firestorm.h>
#include <isl29035.h>
#include <stdio.h>
#include <stdbool.h>

void print_intensity(int intensity) {
  printf("Intensity: %d\n", intensity);
}

void intensity_cb(int intensity, int unused1, int unused2, void* ud) {
  print_intensity(intensity);
}

void temp_callback(int temp_value, int err, int unused, void* ud) {
  printf("Current Temp (%d) [0x%X]\n", temp_value, err);
}

void timer_fired(int arg0, int arg1, int arg2, void* ud) {
  isl29035_start_intensity_reading();
}

int main() {
  printf("Hello\n");

  isl29035_subscribe(intensity_cb, NULL);
  // Setup periodic timer
  timer_subscribe(timer_fired, NULL);
  timer_start_repeating(1000);

  tmp006_start_sampling(0x2, temp_callback, NULL);

  return 0;
}

Remove blink functionality from "sensors" app

Now that we can run multiple apps simultaneously, it's easier to test
things if the sensors app doesn't clobber the blink app.


/**
 * @file
 * @brief A convenience header
 *
 * A header which includes all headers needed for a front-end
 */

#include "boot-loader.h"
#include "drives.h"
#include "install.h"
#include "lickdir.h"
#include "llist.h"
#include "menu.h"
#include "system-info.h"
#include "utils.h"

/**
 * @file
 * @brief A convenience header
 *
 * A header which includes all headers needed for a front-end
 */

#ifdef __cplusplus
extern "C" {
#endif

#include "boot-loader.h"
#include "drives.h"
#include "install.h"
#include "lickdir.h"
#include "llist.h"
#include "menu.h"
#include "system-info.h"
#include "utils.h"

#ifdef __cplusplus
}
#endif

Add `extern "C"' to convenience headers

Add `extern "C"' to convenience headers


/*
 * ====================================================
 * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
 *
 * Developed at SunPro, a Sun Microsystems, Inc. business.
 * Permission to use, copy, modify, and distribute this
 * software is freely granted, provided that this notice
 * is preserved.
 * ====================================================
 */

/*
 * isnan(x) returns 1 is x is nan, else 0;
 * no branching!
 */

#include "math.h"
#include "math_private.h"

int __isnan(double x)
{
	int32_t hx,lx;
	EXTRACT_WORDS(hx,lx,x);
	hx &= 0x7fffffff;
	hx |= (u_int32_t)(lx|(-lx))>>31;
	hx = 0x7ff00000 - hx;
	return (int)(((u_int32_t)hx)>>31);
}
libm_hidden_def(__isnan)

/*
 * ====================================================
 * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
 *
 * Developed at SunPro, a Sun Microsystems, Inc. business.
 * Permission to use, copy, modify, and distribute this
 * software is freely granted, provided that this notice
 * is preserved.
 * ====================================================
 */

/*
 * isnan(x) returns 1 is x is nan, else 0;
 * no branching!
 */

#include "math.h"
#include "math_private.h"

int __isnan(double x)
{
	int32_t hx,lx;
	EXTRACT_WORDS(hx,lx,x);
	hx &= 0x7fffffff;
	hx |= (u_int32_t)(lx|(-lx))>>31;
	hx = 0x7ff00000 - hx;
	return (int)(((u_int32_t)hx)>>31);
}
weak_alias(__isnan, isnan)
libm_hidden_def(__isnan)

Add isnan weak alias to __isnan

isnan: Add isnan weak alias to __isnan

	* libm/s_isnan.c: Add isnan weak alias.

Signed-off-by: Mickaël Guêné <fd4c850767532186e170673aca49b5c51d48c53c@st.com>
Signed-off-by: Christophe Lyon <0ec1b8ee85d9250d253c392c5d5101068ac5d5d3@st.com>


#pragma once
#include "Services\MenuManager\ServiceMenuManager.h"
#include "InternalLogger.h"

namespace AIMP
{
	namespace SDK
	{
		using namespace System;
		using namespace AIMP::SDK::Interfaces;

		public ref class AimpPlugin abstract : public AimpPluginBase
		{
		public:
			AimpPlugin()
			{

			}

			property IAimpCore^ AimpCore
			{
				IAimpCore^ get()
				{
					return _aimpCore;
				}
			}

			property IAimpPlayer^ Player
			{
				IAimpPlayer^ get()
				{
					return (IAimpPlayer^) AimpPlayer;
				}
			}

			property AIMP::SDK::Logger::ILogger ^LoggerManager
			{
				AIMP::SDK::Logger::ILogger ^get()
				{
					return AIMP::SDK::InternalLogger::Instance;
				}
			}

		private:
			IAimpCore^ _aimpCore;
			ServiceMenuManager^ _menuManager;
		};
	}
}

#pragma once
#include "Services\MenuManager\ServiceMenuManager.h"
#include "InternalLogger.h"

namespace AIMP
{
	namespace SDK
	{
		using namespace System;
		using namespace AIMP::SDK::Interfaces;

		public ref class AimpPlugin abstract : public AimpPluginBase
		{
		public:
			AimpPlugin()
			{

			}

			property IAimpCore^ AimpCore
			{
				IAimpCore^ get()
				{
					return Player->Core;
				}
			}

			property IAimpPlayer^ Player
			{
				IAimpPlayer^ get()
				{
					return (IAimpPlayer^) AimpPlayer;
				}
			}

			property AIMP::SDK::Logger::ILogger ^LoggerManager
			{
				AIMP::SDK::Logger::ILogger ^get()
				{
					return AIMP::SDK::InternalLogger::Instance;
				}
			}

		private:
			ServiceMenuManager^ _menuManager;
		};
	}
}

Fix AimpPlugin.AimpCore property which was never initialized.

Remove the _aimpCore field and use Player instead.


#ifndef CPR_RESPONSE_H
#define CPR_RESPONSE_H

#include <string>

#include "cookies.h"
#include "cprtypes.h"

namespace cpr {
    class Response {
      public:
        Response(const long& status_code, const std::string& text, const Header& header, const Url& url,
                 const double& elapsed)
            : status_code{status_code}, text{text}, header{header}, url{url}, elapsed{elapsed} {};
        Response(const long& status_code, const std::string& text, const Header& header, const Url& url,
                 const double& elapsed, const Cookies& cookies)
            : status_code{status_code}, text{text}, header{header}, url{url}, elapsed{elapsed},
              cookies{cookies} {};
        Response() = default;

        long status_code;
        std::string text;
        Header header;
        Url url;
        double elapsed;
        Cookies cookies;
    };

}

#endif

#ifndef CPR_RESPONSE_H
#define CPR_RESPONSE_H

#include <string>

#include "cookies.h"
#include "cprtypes.h"

namespace cpr {
    class Response {
      public:
        Response() = default;
        Response(const long& status_code, const std::string& text, const Header& header, const Url& url,
                 const double& elapsed)
            : status_code{status_code}, text{text}, header{header}, url{url}, elapsed{elapsed} {};
        Response(const long& status_code, const std::string& text, const Header& header, const Url& url,
                 const double& elapsed, const Cookies& cookies)
            : status_code{status_code}, text{text}, header{header}, url{url}, elapsed{elapsed},
              cookies{cookies} {};

        long status_code;
        std::string text;
        Header header;
        Url url;
        double elapsed;
        Cookies cookies;
    };

}

#endif

Put the default constructor first

Put the default constructor first


/*-
 * Copyright (c) 1992, 1993, 1994 Henry Spencer.
 * Copyright (c) 1992, 1993, 1994
 *	The Regents of the University of California.  All rights reserved.
 *
 * This code is derived from software contributed to Berkeley by
 * Henry Spencer.
 *
 * 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. All advertising materials mentioning features or use of this software
 *    must display the following acknowledgement:
 *	This product includes software developed by the University of
 *	California, Berkeley and its contributors.
 * 4. Neither the name of the University 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 REGENTS 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 REGENTS 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.
 *
 *	@(#)utils.h	8.3 (Berkeley) 3/20/94
 */

/* utility definitions */
#ifndef _POSIX2_RE_DUP_MAX
#define _POSIX2_RE_DUP_MAX 255
#endif
#define	DUPMAX		_POSIX2_RE_DUP_MAX	/* xxx is this right? */
#define	INFINITY	(DUPMAX + 1)
#define	NC		(CHAR_MAX - CHAR_MIN + 1)
typedef unsigned char uch;

/* switch off assertions (if not already off) if no REDEBUG */
#ifndef REDEBUG
#ifndef NDEBUG
#define	NDEBUG	/* no assertions please */
#endif
#endif
#include <assert.h>

/* for old systems with bcopy() but no memmove() */
#ifdef USEBCOPY
#define	memmove(d, s, c)	bcopy(s, d, c)
#endif

Add smyrna to main graphviz tree

Add smyrna to main graphviz tree


#ifndef _SEED_MODULE_H_
#define _SEED_MODULE_H_

#include "../libseed/seed.h"

// TODO: Move [example sqlite canvas Multiprocessing
//             os sandbox dbus libxml cairo]
//       towards utilization of this header.

// Check that the required number of arguments were passed into a seed callback.
// If this is not true, raise an exception and return null.
// This requires the callback to use "argument_count", "ctx", and "exception"
// as the names of the various function arguments.
#define CHECK_ARG_COUNT(name, argnum) \
	if ( argument_count != argnum ) \
	{ \
		seed_make_exception (ctx, exception, "ArgumentError", \
		                     "wrong number of arguments; wanted %s, got %Zd", \
		                     #argnum, argument_count); \
		return seed_make_undefined (ctx); \
	}

// Defines a property on holder for the given enum member
#define DEFINE_ENUM_MEMBER(holder, member) \
	seed_object_set_property(ctx, holder, #member, \
	                         seed_value_from_long(ctx, member, NULL))

// Defines a property on holder for the given enum member, with the given name
#define DEFINE_ENUM_MEMBER_EXT(holder, name, val) \
	seed_object_set_property(ctx, holder, name, \
	                         seed_value_from_long(ctx, val, NULL))

#endif

#ifndef _SEED_MODULE_H_
#define _SEED_MODULE_H_

#include "../libseed/seed.h"

// TODO: Move [example sqlite canvas Multiprocessing
//             os sandbox dbus libxml cairo]
//       towards utilization of this header.

// Check that the required number of arguments were passed into a seed callback.
// If this is not true, raise an exception and return null.
// This requires the callback to use "argument_count", "ctx", and "exception"
// as the names of the various function arguments.
#define CHECK_ARG_COUNT(name, argnum) \
	if ( argument_count != argnum ) \
	{ \
		seed_make_exception (ctx, exception, "ArgumentError", \
		                     "wrong number of arguments; expected %s, got %Zd", \
		                     #argnum, argument_count); \
		return seed_make_undefined (ctx); \
	}

// Defines a property on holder for the given enum member
#define DEFINE_ENUM_MEMBER(holder, member) \
	seed_object_set_property(ctx, holder, #member, \
	                         seed_value_from_long(ctx, member, NULL))

// Defines a property on holder for the given enum member, with the given name
#define DEFINE_ENUM_MEMBER_EXT(holder, name, val) \
	seed_object_set_property(ctx, holder, name, \
	                         seed_value_from_long(ctx, val, NULL))

#endif

Change wording of argument count check

[modules] Change wording of argument count check


// REQUIRES: mips-registered-target
// RUN: %clang_cc1 -triple mips-linux-gnu -emit-obj -o - %s | \
// RUN:   llvm-readobj -h - | FileCheck %s

// CHECK: EF_MIPS_ABI_O32

__asm__(
"bar:\n"
"  nop\n"
);

void foo() {}

[mips] Add test case to check ABI flag emissions in case of inline assembler

Follow up to r247546. The test case reproduces the problem fixed by this commit.

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


/* vim:set shiftwidth=4 ts=8: */

/**********************************************************
*      This software is part of the graphviz package      *
*                http://www.graphviz.org/                 *
*                                                         *
*            Copyright (c) 1994-2004 AT&T Corp.           *
*                and is licensed under the                *
*            Common Public License, Version 1.0           *
*                      by AT&T Corp.                      *
*                                                         *
*        Information and Software Systems Research        *
*              AT&T Research, Florham Park NJ             *
**********************************************************/

#ifndef TOPVIEWDEFS_H
#define TOPVIEWDEFS_H
#include "smyrnadefs.h"
#include "gui.h"
#include "tvnodes.h"
#include "glcompset.h"

#endif

Clean up smyrna files: remove unnecessary globals modify libraries not to rely on code in cmd/smyrna remove static declarations from .h files remove unnecessary libraries mark unused code and clean up warnings


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

#ifndef VK_VIRTUAL_SWAPCHAIN_PLATFORM_H_
#define VK_VIRTUAL_SWAPCHAIN_PLATFORM_H_

#include "vulkan/vulkan.h"

#include "layer.h"

namespace swapchain {

void CreateSurface(const InstanceData* functions, VkInstance instance,
                   const void* data, const VkAllocationCallbacks* pAllocator,
                   VkSurfaceKHR* pSurface);

}

#endif  // VK_VIRTUAL_SWAPCHAIN_PLATFORM_H_

Fix clang-format with different clang-format version


#ifndef SOCKS5UDPREQUESTMESSAGE_H
#define SOCKS5UDPREQUESTMESSAGE_H

#include <QHostAddress>

#include "SocksProtocolMessage.h"

class Socks5UDPRequestMessage : public SocksProtocolMessage
{
public:
    Socks5UDPRequestMessage(QHostAddress dst, quint16 dstPort, QByteArray data, quint8 fragID=0);
    Socks5UDPRequestMessage(QString domainName, quint16 dstPort, QByteArray data, quint8 fragID=0);
    Socks5UDPRequestMessage();

    //pure-virtual from SocksProtocolMessage
    virtual ParseResult parse(QByteArray& bytes,QString * error =0);

    //pure-virtual from SocksProtocolMessage
    virtual bool toBytes(QByteArray * output,QString * error=0);

    //pure-virtual from SocksProtocolMessage
    virtual qint64 minimumMessageLength() const;

    SocksProtocolMessage::AddressType addressType() const;
    QHostAddress address() const;
    QString domainName() const;
    quint16 port() const;
    QByteArray data() const;

private:
    QHostAddress _address;
    QString _domainName;
    SocksProtocolMessage::AddressType _addressType;
    quint16 _port;
    quint8 _fragID;
    QByteArray _data;
};

#endif // SOCKS5UDPREQUESTMESSAGE_H

#ifndef SOCKS5UDPREQUESTMESSAGE_H
#define SOCKS5UDPREQUESTMESSAGE_H

#include <QHostAddress>

#include "SocksProtocolMessage.h"

class Socks5UDPRequestMessage : public SocksProtocolMessage
{
public:
    Socks5UDPRequestMessage(QHostAddress dst, quint16 dstPort, QByteArray data, quint8 fragID=0);
    Socks5UDPRequestMessage(QString domainName, quint16 dstPort, QByteArray data, quint8 fragID=0);
    Socks5UDPRequestMessage();

    //pure-virtual from SocksProtocolMessage
    virtual ParseResult parse(QByteArray& bytes,QString * error =0);

    //pure-virtual from SocksProtocolMessage
    virtual bool toBytes(QByteArray * output,QString * error=0);

    //pure-virtual from SocksProtocolMessage
    virtual qint64 minimumMessageLength() const;

    SocksProtocolMessage::AddressType addressType() const;
    QHostAddress address() const;
    QString domainName() const;
    quint16 port() const;
    QByteArray data() const;

private:
    QHostAddress _address;
    QString _domainName;
    SocksProtocolMessage::AddressType _addressType;
    quint16 _port;
    QByteArray _data;
    quint8 _fragID;
};

#endif // SOCKS5UDPREQUESTMESSAGE_H

Fix warning about initialization order (GCC/Clang, -Wreorder)


/** @file
  MSR Definitions.

  Provides defines for Machine Specific Registers(MSR) indexes. Data structures
  are provided for MSRs that contain one or more bit fields.  If the MSR value
  returned is a single 32-bit or 64-bit value, then a data structure is not
  provided for that MSR.

  Copyright (c) 2016, Intel Corporation. All rights reserved.<BR>
  This program and the accompanying materials
  are licensed and made available under the terms and conditions of the BSD License
  which accompanies this distribution.  The full text of the license may be found at
  http://opensource.org/licenses/bsd-license.php

  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.

  @par Specification Reference:
  Intel(R) 64 and IA-32 Architectures Software Developer's Manual, Volume 3,
  December 2015, Chapter 35 Model-Specific-Registers (MSR), Chapter 35.

**/

#ifndef __MSR_H__
#define __MSR_H__

#include <Register/ArchitecturalMsr.h>
#include <Register/Msr/Core2Msr.h>
#include <Register/Msr/AtomMsr.h>
#include <Register/Msr/SilvermontMsr.h>
#include <Register/Msr/NehalemMsr.h>
#include <Register/Msr/Xeon5600Msr.h>
#include <Register/Msr/XeonE7Msr.h>
#include <Register/Msr/SandyBridgeMsr.h>
#include <Register/Msr/IvyBridgeMsr.h>
#include <Register/Msr/HaswellMsr.h>
#include <Register/Msr/HaswellEMsr.h>
#include <Register/Msr/BroadwellMsr.h>
#include <Register/Msr/XeonDMsr.h>
#include <Register/Msr/SkylakeMsr.h>
#include <Register/Msr/XeonPhiMsr.h>
#include <Register/Msr/Pentium4Msr.h>
#include <Register/Msr/CoreMsr.h>
#include <Register/Msr/PentiumMMsr.h>
#include <Register/Msr/P6Msr.h>
#include <Register/Msr/PentiumMsr.h>

#endif

Add top level MSR include file

UefiCpuPkg/Include: Add top level MSR include file

Add top level MSR include file that includes the Architecural MSR
include file and all family specific MSR files from the Msr
subdirectory

Intel(R) 64 and IA-32 Architectures Software Developer's
Manual, Volume 3, December 2015, Chapter 35
Model-Specific-Registers (MSR).

Cc: Jeff Fan <7d6fed0251a47076d6e691789131f22f07d057b4@intel.com>
Cc: Jiewen Yao <364a90bfebd1f362ebb7b48e4bf8ec010adef203@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Michael Kinney <fd20bc543a9f65bb633fac7d08a403c1f1c8eb6c@intel.com>
Reviewed-by: Jeff Fan <7d6fed0251a47076d6e691789131f22f07d057b4@intel.com>


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

void swap(char *i, char *j) {
    char saved = *i;
    *i = *j;
    *j = saved;
}

void generate_permutations(char* a, int n) {
    if (n == 0) {
        printf("%s\n", a);
    } else {
        for (int i = 0; i < n; i++) {
            generate_permutations(a, n-1);
            swap(&a[n % 2 == 0 ? 0 : i], &a[n]);
        }
        generate_permutations(a, n-1);
    }
}

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

    if (argc != 2) {
        fprintf(stderr, "Need exactly one argument!\n");
        return 1;
    }

    size_t len = strlen(argv[1]);
    char *word = malloc(len + 1);
    word = strncpy(word, argv[1], len);

    generate_permutations(word, len-1);

    free(word);
    return 0;
}

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

void swap(char *i, char *j) {
    char saved = *i;
    *i = *j;
    *j = saved;
}

void generate_permutations(char* a, int n) {
    if (n == 0) {
        printf("%s\n", a);
    } else {
        for (int i = 0; i < n; i++) {
            generate_permutations(a, n-1);
            swap(&a[n % 2 == 0 ? 0 : i], &a[n]);
        }
        generate_permutations(a, n-1);
    }
}

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

    if (argc != 2) {
        fprintf(stderr, "Exactly one argument is required\n");
        return 1;
    }

    size_t len = strlen(argv[1]);
    char *word = malloc(len + 1);
    word = strncpy(word, argv[1], len);

    generate_permutations(word, len-1);

    free(word);
    return 0;
}

Make the error message consistent with all of the other languages


/*
 * QLogic Fibre Channel HBA Driver
 * Copyright (c)  2003-2014 QLogic Corporation
 *
 * See LICENSE.qla2xxx for copyright and licensing details.
 */
/*
 * Driver version
 */
#define QLA2XXX_VERSION      "8.07.00.08-k"

#define QLA_DRIVER_MAJOR_VER	8
#define QLA_DRIVER_MINOR_VER	7
#define QLA_DRIVER_PATCH_VER	0
#define QLA_DRIVER_BETA_VER	0

/*
 * QLogic Fibre Channel HBA Driver
 * Copyright (c)  2003-2014 QLogic Corporation
 *
 * See LICENSE.qla2xxx for copyright and licensing details.
 */
/*
 * Driver version
 */
#define QLA2XXX_VERSION      "8.07.00.16-k"

#define QLA_DRIVER_MAJOR_VER	8
#define QLA_DRIVER_MINOR_VER	7
#define QLA_DRIVER_PATCH_VER	0
#define QLA_DRIVER_BETA_VER	0

qla2xxx: Update the driver version to 8.07.00.16-k.

Signed-off-by: Giridhar Malavali <799b6491fce2c7a80b5fedcf9a728560cc9eb954@qlogic.com>
Signed-off-by: Saurav Kashyap <88d6fd94e71a9ac276fc44f696256f466171a3c0@qlogic.com>
Signed-off-by: Christoph Hellwig <923f7720577207a44b32e59bbfbea59d27f1ae8e@lst.de>


int initial_connection(char *ip_addr, int port) {

    int socket_desc;
    struct sockaddr_in server;

    //Create socket
    socket_desc = socket(AF_INET , SOCK_STREAM , 0);
    if (socket_desc == -1)
    {
        puts("Could not create socket");
        return 1;
    }

    server.sin_addr.s_addr = inet_addr(ip_addr); // set IP ADDRESS of server
    server.sin_family = AF_INET;
    server.sin_port = htons(port); // set port of chat service

    //Connect to remote server
    if (connect(socket_desc , (struct sockaddr *)&server , sizeof(server)) < 0)
    {
        puts("connect error");
        return 1;
    }

}

int recieve_data(int lenght, char *message_buffer){

    char server_reply[lenght];
    int read_size;

    // recieve packet from server
    read_size = recv(socket_desc, server_reply , lenght , 0);

    if (read_size > 0) {
        /*
            set end point string on last character by calculate read_size
            In normal, recv don't clear last buffer string
            So we must set end of string to prevent bug from last buffer string
        */
        server_reply[read_size] = '\0';
        strcpy(message_buffer, server_reply);
        return 1;
    }
    else {
        puts("Receive failed.");
        return 0;
    }

}

int send_data(char *text) {

    return send(socket_desc , text , strlen(text) , 0) > 0;

}

Add function recv and send

Add function recv and send

Improve function to use easier


/* $Id$ */
static char const _copyright[] =
"Copyright (c) 2006-2013 Pierre Pronchery <khorben@defora.org>";
/* This file is part of DeforaOS Desktop Mailer */
static char const _license[] =
"This program is free software: you can redistribute it and/or modify\n"
"it under the terms of the GNU General Public License as published by\n"
"the Free Software Foundation, version 3 of the License.\n"
"\n"
"This program is distributed in the hope that it will be useful,\n"
"but WITHOUT ANY WARRANTY; without even the implied warranty of\n"
"MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n"
"GNU General Public License for more details.\n"
"\n"
"You should have received a copy of the GNU General Public License\n"
"along with this program.  If not, see <http://www.gnu.org/licenses/>.\n";

static char const * _authors[] =
{
	"Pierre Pronchery <khorben@defora.org>",
	NULL
};

static char const * _comments =
N_("e-mail client for the DeforaOS desktop");

/* $Id$ */
static char const _copyright[] =
"Copyright © 2006-2013 Pierre Pronchery <khorben@defora.org>";
/* This file is part of DeforaOS Desktop Mailer */
static char const _license[] =
"This program is free software: you can redistribute it and/or modify\n"
"it under the terms of the GNU General Public License as published by\n"
"the Free Software Foundation, version 3 of the License.\n"
"\n"
"This program is distributed in the hope that it will be useful,\n"
"but WITHOUT ANY WARRANTY; without even the implied warranty of\n"
"MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n"
"GNU General Public License for more details.\n"
"\n"
"You should have received a copy of the GNU General Public License\n"
"along with this program.  If not, see <http://www.gnu.org/licenses/>.\n";

static char const * _authors[] =
{
	"Pierre Pronchery <khorben@defora.org>",
	NULL
};

static char const * _comments =
N_("e-mail client for the DeforaOS desktop");

Use the copyright character for the about dialogs


#include "packet_queue.h"

#include "error.h"
#include "radio.h"

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

uint32_t packet_queue_init(packet_queue_t * queue)
{
    queue->head = 0;
    queue->tail = 0;

    return SUCCESS;
}

bool packet_queue_is_empty(packet_queue_t * queue)
{
    return queue->head == queue->tail;
}

bool packet_queue_is_full(packet_queue_t * queue)
{
    return abs(queue->head - queue->tail) == PACKET_QUEUE_SIZE;
}

uint32_t packet_queue_add(packet_queue_t * queue, radio_packet_t * packet)
{
    if (packet_queue_is_full(queue))
        return NO_MEMORY;

    memcpy(&queue->packets[0], packet, sizeof(*packet));

    queue->tail++;

    return SUCCESS;
}

uint32_t packet_queue_get(packet_queue_t * queue, radio_packet_t ** packet)
{
    if (packet_queue_is_empty(queue))
        return NOT_FOUND;

    *packet = &queue->packets[queue->head];

    queue->head++;

    return SUCCESS;
}

#include "packet_queue.h"

#include "error.h"
#include "radio.h"

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

uint32_t packet_queue_init(packet_queue_t * queue)
{
    queue->head = 0;
    queue->tail = 0;

    return SUCCESS;
}

bool packet_queue_is_empty(packet_queue_t * queue)
{
    return queue->head == queue->tail;
}

bool packet_queue_is_full(packet_queue_t * queue)
{
    return abs(queue->head - queue->tail) == PACKET_QUEUE_SIZE;
}

uint32_t packet_queue_add(packet_queue_t * queue, radio_packet_t * packet)
{
    if (packet_queue_is_full(queue))
        return NO_MEMORY;

    memcpy(&queue->packets[queue->tail], packet, sizeof(*packet));

    queue->tail = (queue->tail + 1u) % PACKET_QUEUE_SIZE;

    return SUCCESS;
}

uint32_t packet_queue_get(packet_queue_t * queue, radio_packet_t ** packet)
{
    if (packet_queue_is_empty(queue))
        return NOT_FOUND;

    *packet = &queue->packets[queue->head];

    queue->head = (queue->head + 1u) % PACKET_QUEUE_SIZE;

    return SUCCESS;
}

Increment head and tail properly.

Increment head and tail properly.


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

const char *board_id = "C005";

// URL_NAME and DRIVE_NAME must be 11 characters excluding
// the null terminated character
// Note - 4 byte alignemnt required as workaround for ARMCC compiler bug with weak references
__attribute__((aligned(4)))
const char daplink_url_name[11] =   "HELP    HTM";
__attribute__((aligned(4)))
const char daplink_drive_name[11] = "MTCONNEC04S";
__attribute__((aligned(4)))
const char *const daplink_target_url = "https://blog.mtmtech.com.tw/mtconnect04s/";

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

const char *board_id = "C005";

// URL_NAME and DRIVE_NAME must be 11 characters excluding
// the null terminated character
// Note - 4 byte alignemnt required as workaround for ARMCC compiler bug with weak references
__attribute__((aligned(4)))
const char daplink_url_name[11] =   "HELP    HTM";
__attribute__((aligned(4)))
const char daplink_drive_name[11] = "MTCONNEC04S";
__attribute__((aligned(4)))
const char *const daplink_target_url = "https://developer.mbed.org/platforms/MtConnect04S/";

Update target page url of MtConnect04S

Update target page url of MtConnect04S


#include "queue.h"

struct Queue
{
	size_t head;
	size_t tail;
	size_t size;
	void** e;
};

Queue* Queue_Create(size_t n)
{
	Queue* q = (Queue *)malloc(sizeof(Queue));
	q->size = n;
	q->head = q->tail = 1;
	q->e = (void **)malloc(sizeof(void*) * (n + 1));
	return q;
}

int Queue_Empty(Queue* q)
{
	return (q->head == q->tail);
}

int Queue_Full(Queue* q)
{
	return (q->head == q->tail + 1) || (q->head == 1 && q->tail == q->size);
}

Add helper function Queue Full implementation


#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "parsing.h"
#include "shutility.h"

int main(int argc, char **argv)
{
        int status = 1;
        int read;
        size_t len;
        char *buffer = NULL;

        printf("----- C O N S O L E\t S I M U L A T I O N -----\n\n");
        while (status) {
                /* Get & display username and hostname */
                display_info();
                /* Get user input, strtok to remove newline */
                read = getline(&buffer, &len, stdin);
                strtok(buffer, "\n");
                status = parsing(buffer);
        }
        if (read)
                free(buffer);

        return 0;
}

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <signal.h>
#include "parsing.h"
#include "shutility.h"

/*
void sig_handler(int signo)
{
    	if (signo == SIGUSR1)
		printf("Received SIGUSR1\n");
	else if (signo == SIGTERM)
		printf("Received SIGTERM\n");
	else if (signo == SIGINT)
		printf("Received SIGINT\n");
	else if (signo == SIGFPE)
		printf("Received SIGFPE\n");
	else if (signo == SIGABRT)
		printf("Received SIGABRT\n");
}
*/

int main(int argc, char **argv)
{
	int status = 1;
	int read;
	size_t len;
	char *buffer = NULL;

	/* Example of signal handling
	*
	*if (signal(SIGUSR1, sig_handler) == SIG_ERR)
	*	printf("\ncan't catch SIGUSR1\n");
	*if (signal(SIGTERM, sig_handler) == SIG_ERR)
	*	printf("\ncan't catch SIGTERM\n");
	*if (signal(SIGINT, sig_handler) == SIG_ERR)
	*	printf("\ncan't catch SIGINT\n");
	*if (signal(SIGFPE, sig_handler) == SIG_ERR)
	*	printf("\ncan't catch SIGFPE\n");
	*if (signal(SIGABRT, sig_handler) == SIG_ERR)
	*	printf("\ncan't catch SIGABRT\n");
	*/

	printf("----- C O N S O L E\t S I M U L A T I O N -----\n\n");
	while (status) {
		/* Get & display username and hostname */
		display_info();
		/* Get user input, strtok to remove newline */
		read = getline(&buffer, &len, stdin);
		strtok(buffer, "\n");
		status = parsing(buffer);
	}
	if (read)
		free(buffer);

	return 0;
}

Add example of signal handling

Add example of signal handling


#include <stdlib.h>

/**
 * @author: Hendrik Werner
 */

#define BOARD_HEIGHT 50
#define BOARD_WIDTH 50

typedef struct Position {
	int row;
	int col;
} Position;

int main() {
	return EXIT_SUCCESS;
}

#include <stdlib.h>

/**
 * @author: Hendrik Werner
 */

#define BOARD_HEIGHT 50
#define BOARD_WIDTH 50

typedef struct Position {
	int row;
	int col;
} Position;

typedef enum Cell {
	EMPTY
	,SNAKE
	,FOOD
} Cell;

int main() {
	return EXIT_SUCCESS;
}

Enumerate possible values for cells.

Enumerate possible values for cells.


// RUN: %llvmgcc %s -o /dev/null -S
// Note:
//  We fail this on Sparc because the C library seems to be missing complex.h
//  and the corresponding C99 complex support.
//
//  We could modify the test to use only GCC extensions, but I don't know if
//  that would change the nature of the test.
//
// XFAIL: sparc

#include <complex.h>

int foo(complex float c) {
    return creal(c);
}

// RUN: %llvmgcc %s -o /dev/null -S
// Note:
//  We fail this on Sparc because the C library seems to be missing complex.h
//  and the corresponding C99 complex support.
//
//  We could modify the test to use only GCC extensions, but I don't know if
//  that would change the nature of the test.
//
// XFAIL: sparc

#ifdef __CYGWIN__
  #include <mingw/complex.h>
#else
  #include <complex.h>
#endif

int foo(complex float c) {
    return creal(c);
}

Make this testcase compatible with CYGWIN.

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


#include "test_parser_p.h"

void empty_success(void **state) {
  grammar_t *grammar = grammar_init(
    non_terminal("Start"),
    rule_init("Start", empty()), 1);

  parse_t *result = parse("hello", grammar);
  assert_non_null(result);
  assert_int_equal(result->length, 0);
  assert_int_equal(result->n_children, 0);
}

#include "test_parser_p.h"

void empty_success(void **state) {
  grammar_t *grammar = grammar_init(
    non_terminal("Start"),
    rule_init("Start", empty()), 1);

  parse_result_t *result = parse("hello", grammar);
  assert_non_null(result);

  parse_t *suc = result->data.result;
  assert_int_equal(suc->length, 0);
  assert_int_equal(suc->n_children, 0);
}

Use new API on empty tests

Use new API on empty tests