/*
    Swephelp

    Copyright 2007-2014 Stanislas Marquis <smarquis@astrorigin.ch>

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

    Swephelp 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 Swephelp.  If not, see <http://www.gnu.org/licenses/>.
*/

/** @file swhwin.h
** @brief swephelp windowz specific header
*/

#ifndef SWHWIN_H
#define SWHWIN_H

#ifdef WIN32

#define lround(num) \
        ((long)(num > 0 ? num + 0.5 : ceil(num - 0.5)))

#endif /* WIN32 */
#endif /* SWHWIN_H */
/* vi: set fenc=utf8 ff=unix et sw=4 ts=4 sts=4 : */

/*
    Swephelp

    Copyright 2007-2014 Stanislas Marquis <smarquis@astrorigin.ch>

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

    Swephelp 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 Swephelp.  If not, see <http://www.gnu.org/licenses/>.
*/

/** @file swhwin.h
** @brief swephelp windowz specific header
*/

/* define WIN32 for MSVC compilers */
#ifdef _WIN32
#define WIN32
#endif

#ifndef SWHWIN_H
#define SWHWIN_H

#ifdef WIN32

#define lround(num) \
        ((long)(num > 0 ? num + 0.5 : ceil(num - 0.5)))

#endif /* WIN32 */
#endif /* SWHWIN_H */
/* vi: set fenc=utf8 ff=unix et sw=4 ts=4 sts=4 : */

Define WIN32 for MSVC compilers

Define WIN32 for MSVC compilers

Microsoft Visual C++ compilers define _WIN32 (with underscore) instead
of WIN32 as gcc does when compiling on Windows. Pyswisseph fails to
compile with MSVC compiler.

This patch forces WIN32 to be defined if _WIN32 is defined by the MSVC
compiler.


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

#include <boost/cstdint.hpp>

/**
 * \file macros.h
 *
 * \brief Macros to help manage templates.
 */

#define TYPE_CHECK(type, name, function)     \
  if (pixtype == pixtypes::pixtype_##name()) \
  {                                          \
    return &function<type>;                  \
  }

#define SPECIFY_FUNCTION(function)    \
  TYPE_CHECK(bool, bool, function)    \
  TYPE_CHECK(uint8_t, byte, function) \
  TYPE_CHECK(float, float, function)  \
  TYPE_CHECK(double, double, function)

#endif // VISTK_PROCESSES_HELPER_IMAGE_MACROS_H

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

#include <boost/cstdint.hpp>

/**
 * \file macros.h
 *
 * \brief Macros to help manage templates.
 */

#define TYPE_CHECK(type, name, function)     \
  if (pixtype == pixtypes::pixtype_##name()) \
  {                                          \
    return &function<type>;                  \
  }

#define SPECIFY_FUNCTION(function)         \
  TYPE_CHECK(bool, bool, function)         \
  else TYPE_CHECK(uint8_t, byte, function) \
  else TYPE_CHECK(float, float, function)  \
  else TYPE_CHECK(double, double, function)

#endif // VISTK_PROCESSES_HELPER_IMAGE_MACROS_H

Use else in comparison chain

Use else in comparison chain


// RUN: %ucc -fsyntax-only %s

typedef int array[3];

const array yo; // int const yo[3];
//                             ^~ no const here

h(array); // int h(int [3]);

i(const array); // int i(int const [3]);
//                                 ^~ no const here

j(int[const]); // int j(int *const);

_Static_assert(_Generic(yo, const int[3]: 1) == 1, "");

_Static_assert(_Generic(&h, int (*)(int[3]): 1) == 1, "");
_Static_assert(_Generic(&h, int (*)(int const[3]): 1, default: 2) == 2, "");
_Static_assert(_Generic(&h, int (*)(int *const): 1) == 1, "");
_Static_assert(_Generic(&h, int (*)(int *): 1) == 1, "");

_Static_assert(_Generic(&i, int (*)(int const[3]): 1) == 1, "");
_Static_assert(_Generic(&i, int (*)(int      [3]): 1, default: 2) == 2, "");
_Static_assert(_Generic(&i, int (*)(int const *): 1) == 1, "");
_Static_assert(_Generic(&i, int (*)(int const *const): 1) == 1, "");

_Static_assert(_Generic(&j, int (*)(int *const): 1) == 1, "");
_Static_assert(_Generic(&j, int (*)(int [const]): 1) == 1, "");
_Static_assert(_Generic(&j, int (*)(int const *const): 1, default: 2) == 2, "");
_Static_assert(_Generic(&j, int (*)(int const [const]): 1, default: 2) == 2, "");

Add function parameter qualifier type tests


#ifndef AL_EVENT_H
#define AL_EVENT_H

#include "AL/al.h"
#include "AL/alc.h"

struct EffectState;

enum {
    /* End event thread processing. */
    EventType_KillThread = 0,

    /* User event types. */
    EventType_SourceStateChange = 1<<0,
    EventType_BufferCompleted   = 1<<1,
    EventType_Error             = 1<<2,
    EventType_Performance       = 1<<3,
    EventType_Deprecated        = 1<<4,
    EventType_Disconnected      = 1<<5,

    /* Internal events. */
    EventType_ReleaseEffectState = 65536,
};

struct AsyncEvent {
    unsigned int EnumType{0u};
    union {
        char dummy;
        struct {
            ALuint id;
            ALenum state;
        } srcstate;
        struct {
            ALuint id;
            ALsizei count;
        } bufcomp;
        struct {
            ALenum type;
            ALuint id;
            ALuint param;
            ALchar msg[1008];
        } user;
        EffectState *mEffectState;
    } u{};

    AsyncEvent() noexcept = default;
    constexpr AsyncEvent(unsigned int type) noexcept : EnumType{type} { }
};

void StartEventThrd(ALCcontext *ctx);
void StopEventThrd(ALCcontext *ctx);

#endif

#ifndef AL_EVENT_H
#define AL_EVENT_H

#include "AL/al.h"
#include "AL/alc.h"

struct EffectState;

enum {
    /* End event thread processing. */
    EventType_KillThread = 0,

    /* User event types. */
    EventType_SourceStateChange = 1<<0,
    EventType_BufferCompleted   = 1<<1,
    EventType_Error             = 1<<2,
    EventType_Performance       = 1<<3,
    EventType_Deprecated        = 1<<4,
    EventType_Disconnected      = 1<<5,

    /* Internal events. */
    EventType_ReleaseEffectState = 65536,
};

struct AsyncEvent {
    unsigned int EnumType{0u};
    union {
        char dummy;
        struct {
            ALuint id;
            ALenum state;
        } srcstate;
        struct {
            ALuint id;
            ALsizei count;
        } bufcomp;
        struct {
            ALenum type;
            ALuint id;
            ALuint param;
            ALchar msg[232];
        } user;
        EffectState *mEffectState;
    } u{};

    AsyncEvent() noexcept = default;
    constexpr AsyncEvent(unsigned int type) noexcept : EnumType{type} { }
};

void StartEventThrd(ALCcontext *ctx);
void StopEventThrd(ALCcontext *ctx);

#endif

Reduce the AsyncEvent struct size

Reduce the AsyncEvent struct size

The "user" message length is significantly reduced to fit the struct in 256
bytes, rather than 1KB.


/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */

/* Various compiler checks. */

#ifndef mozilla_Compiler_h_
#define mozilla_Compiler_h_

#if !defined(__clang__) && defined(__GNUC__)
   /*
    * This macro should simplify gcc version checking. For example, to check
    * for gcc 4.5.1 or later, check `#ifdef MOZ_GCC_VERSION_AT_LEAST(4, 5, 1)`.
    */
#  define MOZ_GCC_VERSION_AT_LEAST(major, minor, patchlevel)          \
     ((__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__) \
      >= ((major) * 10000 + (minor) * 100 + (patchlevel)))
#if !MOZ_GCC_VERSION_AT_LEAST(4, 4, 0)
#  error "mfbt (and Gecko) require at least gcc 4.4 to build."
#endif
#endif

#endif  /* mozilla_Compiler_h_ */

/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */

/* Various compiler checks. */

#ifndef mozilla_Compiler_h_
#define mozilla_Compiler_h_

#if !defined(__clang__) && defined(__GNUC__)
   /*
    * This macro should simplify gcc version checking. For example, to check
    * for gcc 4.5.1 or later, check `#ifdef MOZ_GCC_VERSION_AT_LEAST(4, 5, 1)`.
    */
#  define MOZ_GCC_VERSION_AT_LEAST(major, minor, patchlevel)          \
     ((__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__) \
      >= ((major) * 10000 + (minor) * 100 + (patchlevel)))
#if !MOZ_GCC_VERSION_AT_LEAST(4, 4, 0)
// RBA: Not true for servo!
//#  error "mfbt (and Gecko) require at least gcc 4.4 to build."
#endif
#endif

#endif  /* mozilla_Compiler_h_ */

Disable error that forbids builds with gcc 4.2


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

#pragma once

#include <limits>

#include <react/components/text/BaseTextShadowNode.h>
#include <react/components/text/TextProps.h>
#include <react/components/view/ViewEventEmitter.h>
#include <react/core/ConcreteShadowNode.h>

namespace facebook {
namespace react {

extern const char TextComponentName[];

using TextEventEmitter = TouchEventEmitter;

class TextShadowNode : public ConcreteShadowNode<
                           TextComponentName,
                           ShadowNode,
                           TextProps,
                           TextEventEmitter>,
                       public BaseTextShadowNode {
 public:
  static ShadowNodeTraits BaseTraits() {
    auto traits = ConcreteShadowNode::BaseTraits();

#ifdef ANDROID
    traits.set(ShadowNodeTraits::Trait::FormsView);
    traits.set(ShadowNodeTraits::Trait::FormsStackingContext);
#endif

    return traits;
  }

  using ConcreteShadowNode::ConcreteShadowNode;

#ifdef ANDROID
  using BaseShadowNode = ConcreteShadowNode<
      TextComponentName,
      ShadowNode,
      TextProps,
      TextEventEmitter>;

  TextShadowNode(
      ShadowNodeFragment const &fragment,
      ShadowNodeFamily::Shared const &family,
      ShadowNodeTraits traits)
      : BaseShadowNode(fragment, family, traits), BaseTextShadowNode() {
    orderIndex_ = std::numeric_limits<decltype(orderIndex_)>::max();
  }
#endif
};

} // namespace react
} // namespace facebook

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

#pragma once

#include <limits>

#include <react/components/text/BaseTextShadowNode.h>
#include <react/components/text/TextProps.h>
#include <react/components/view/ViewEventEmitter.h>
#include <react/core/ConcreteShadowNode.h>

namespace facebook {
namespace react {

extern const char TextComponentName[];

using TextEventEmitter = TouchEventEmitter;

class TextShadowNode : public ConcreteShadowNode<
                           TextComponentName,
                           ShadowNode,
                           TextProps,
                           TextEventEmitter>,
                       public BaseTextShadowNode {
 public:
  static ShadowNodeTraits BaseTraits() {
    auto traits = ConcreteShadowNode::BaseTraits();

#ifdef ANDROID
    traits.set(ShadowNodeTraits::Trait::FormsView);
#endif

    return traits;
  }

  using ConcreteShadowNode::ConcreteShadowNode;

#ifdef ANDROID
  using BaseShadowNode = ConcreteShadowNode<
      TextComponentName,
      ShadowNode,
      TextProps,
      TextEventEmitter>;

  TextShadowNode(
      ShadowNodeFragment const &fragment,
      ShadowNodeFamily::Shared const &family,
      ShadowNodeTraits traits)
      : BaseShadowNode(fragment, family, traits), BaseTextShadowNode() {
    orderIndex_ = std::numeric_limits<decltype(orderIndex_)>::max();
  }
#endif
};

} // namespace react
} // namespace facebook

Fix bug in TextInlineViews when using a deep nested hierarchy of Text and Images

Summary:
This fixes a bug in Android TextInlineViews that was reproducible in ActivityLog screen, see T63438920

Since Text are virtual nodes it is not necessary for these kind of views to stack views during diffing.

changelog: [internal]

Reviewed By: shergin

Differential Revision: D20448085

fbshipit-source-id: 2d852975493bf6bcc7840c80c5de5cb5f7890303


#ifndef KAI_PLATFORM_GAME_CONTROLLER_H
#define KAI_PLATFORM_GAME_CONTROLLER_H

#include KAI_PLATFORM_INCLUDE(GameController.h)

#endif // SHATTER_PLATFORM_GAME_CONTROLLER_H

//EOF

#ifndef KAI_PLATFORM_GAME_CONTROLLER_H
#define KAI_PLATFORM_GAME_CONTROLLER_H

#include KAI_PLATFORM_INCLUDE(GameController.h)

#endif

//EOF

Add some color for console output

Add some color for console output

Former-commit-id: 315cc71afe5d5245e60ce4564328619c49310b6a
Former-commit-id: 4afa9ab712a2bdbef25bee286ff0bdcf2a8da2b2


#pragma once

#include <string>

struct Version {
public:
    const int major;
    const int minor;
    const int revision;

    Version(int major, int minor = 0, int revision = 0) :
    major(major),
    minor(minor),
    revision(revision) {

    }

    std::wstring ToString() {
        return std::to_wstring(major)
            + L"."
            + std::to_wstring(minor)
            + L"."
            + std::to_wstring(revision);
    }
};

#pragma once

#include <string>

struct Version {
public:
    Version(int major = 0, int minor = 0, int revision = 0) :
    _major(major),
    _minor(minor),
    _revision(revision) {

    }

    const int Major() { return _major; }
    const int Minor() { return _minor; }
    const int Revision() { return _revision; }

    }

    std::wstring ToString() {
        return std::to_wstring(_major)
            + L"."
            + std::to_wstring(_minor)
            + L"."
            + std::to_wstring(_revision);
    }

private:
    int _major;
    int _minor;
    int _revision;
};

Update instance variables, add getters

Update instance variables, add getters


#pragma once

//#define ENABLE_HISTORY_LOG
#if !defined(ENABLE_HISTORY_LOG)

void FORCEINLINE ParaNdis_DebugHistory(
    PARANDIS_ADAPTER *pContext,
    eHistoryLogOperation op,
    PVOID pParam1,
    ULONG lParam2,
    ULONG lParam3,
    ULONG lParam4)
{
    UNREFERENCED_PARAMETER(pContext);
    UNREFERENCED_PARAMETER(op);
    UNREFERENCED_PARAMETER(pParam1);
    UNREFERENCED_PARAMETER(lParam2);
    UNREFERENCED_PARAMETER(lParam3);
    UNREFERENCED_PARAMETER(lParam4);
}

#else

void ParaNdis_DebugHistory(
    PARANDIS_ADAPTER *pContext,
    eHistoryLogOperation op,
    PVOID pParam1,
    ULONG lParam2,
    ULONG lParam3,
    ULONG lParam4);

#endif

#pragma once

//#define ENABLE_HISTORY_LOG
//#define KEEP_PENDING_NBL

#if !defined(KEEP_PENDING_NBL)

void FORCEINLINE ParaNdis_DebugNBLIn(PNET_BUFFER_LIST nbl, ULONG& index)
{
    UNREFERENCED_PARAMETER(nbl);
    UNREFERENCED_PARAMETER(index);
}

void FORCEINLINE ParaNdis_DebugNBLOut(ULONG index, PNET_BUFFER_LIST nbl)
{
    UNREFERENCED_PARAMETER(index);
    UNREFERENCED_PARAMETER(nbl);
}

#else

void ParaNdis_DebugNBLIn(PNET_BUFFER_LIST nbl, ULONG& index);
void ParaNdis_DebugNBLOut(ULONG index, PNET_BUFFER_LIST nbl);

#endif

#if !defined(ENABLE_HISTORY_LOG)

void FORCEINLINE ParaNdis_DebugHistory(
    PARANDIS_ADAPTER *pContext,
    eHistoryLogOperation op,
    PVOID pParam1,
    ULONG lParam2,
    ULONG lParam3,
    ULONG lParam4)
{
    UNREFERENCED_PARAMETER(pContext);
    UNREFERENCED_PARAMETER(op);
    UNREFERENCED_PARAMETER(pParam1);
    UNREFERENCED_PARAMETER(lParam2);
    UNREFERENCED_PARAMETER(lParam3);
    UNREFERENCED_PARAMETER(lParam4);
}

#else

void ParaNdis_DebugHistory(
    PARANDIS_ADAPTER *pContext,
    eHistoryLogOperation op,
    PVOID pParam1,
    ULONG lParam2,
    ULONG lParam3,
    ULONG lParam4);

#endif

netkvm: Add ability to keep array of pending TX NBLs

This debug instrumentation is resolved to nothing in
regular release compilation. To enable it, uncomment
KEEP_PENDING_NBL define in ParaNdis_DebugHistory.h

Signed-off-by: Yuri Benditovich <9668326cb042de5d91fd7679dac7ca5ea402812c@daynix.com>


/*
    Copyright (C) 2016 William Hart

    This file is part of FLINT.

    FLINT is free software: you can redistribute it and/or modify it under
    the terms of the GNU Lesser General Public License (LGPL) as published
    by the Free Software Foundation; either version 2.1 of the License, or
    (at your option) any later version.  See <http://www.gnu.org/licenses/>.
*/

#include <stdio.h>
#include <stdlib.h>
#include <gmp.h>
#include "flint.h"
#include "fmpz.h"
#include "fmpz_mpoly.h"
#include "ulong_extras.h"

int
main(void)
{
    int i;
    FLINT_TEST_INIT(state);

    flint_printf("void....");
    fflush(stdout);

    /* Check aliasing of a and c */
    for (i = 0; i < 1000 * flint_test_multiplier(); i++)
    {
    }

    FLINT_TEST_CLEANUP(state);

    flint_printf("PASS\n");
    return 0;
}

Add empty test to prevent build system complaining.


// RUN: %llvmgcc %s -S -emit-llvm -o - | FileCheck %s
// Radar 8026855

int test (void *src) {
  register int w0 asm ("0");
  // CHECK: call i32 asm sideeffect
  asm ("ldr %0, [%1]": "=r" (w0): "r" (src));
  // The asm to read the value of w0 has a sideeffect for a different reason
  // (see 2010-05-18-asmsched.c) but that's not what this is testing for.
  // CHECK: call i32 asm
  return w0;
}

Add a test for llvm-gcc svn r104726.

Add a test for llvm-gcc svn r104726.

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


#ifndef __SCPI_DEF_H_
#define __SCPI_DEF_H_

#include "scpi/scpi.h"

extern scpi_t scpi_context;

size_t SCPI_Write(scpi_t * context, const char * data, size_t len);
int SCPI_Error(scpi_t * context, int_fast16_t err);
scpi_result_t SCPI_Control(scpi_t * context, scpi_ctrl_name_t ctrl, scpi_reg_val_t val);
scpi_result_t SCPI_Reset(scpi_t * context);
scpi_result_t SCPI_Test(scpi_t * context);
scpi_result_t SCPI_Flush(scpi_t * context);

scpi_result_t SCPI_SystemCommTcpipControlQ(scpi_t * context);

#endif // __SCPI_DEF_H_

#ifndef __SCPI_DEF_H_
#define __SCPI_DEF_H_

#include "scpi/scpi.h"

extern scpi_t scpi_context;

size_t SCPI_Write(scpi_t * context, const char * data, size_t len);
int SCPI_Error(scpi_t * context, int_fast16_t err);
scpi_result_t SCPI_Control(scpi_t * context, scpi_ctrl_name_t ctrl, scpi_reg_val_t val);
scpi_result_t SCPI_Reset(scpi_t * context);
int32_t SCPI_Test(scpi_t * context);
scpi_result_t SCPI_Flush(scpi_t * context);

scpi_result_t SCPI_SystemCommTcpipControlQ(scpi_t * context);

#endif // __SCPI_DEF_H_

Correct *TST? callback in header file

Correct *TST? callback in header file


#include <Arika/Arika.h>

///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

int main(int argc, char** argv)
{
	ARFuncs* arFuncs = ar_init("t2-output/macosx-clang-debug-default/libarika-qt.dylib");

	if (!arFuncs)
		return 0;

	arFuncs->window_create_main();

	for (;;)
	{
		if (!arFuncs->update())
			break;
	}

	//arFuncs->close();

	return 0;
}

#include <Arika/Arika.h>

///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

int main(int argc, char** argv)
{
	ARFuncs* arFuncs = ar_init("t2-output/macosx-clang-debug-default/libarika-qt.dylib");

	if (!arFuncs)
		return 0;

	if (!arFuncs->ui_load("examples/minimal/minimal.ar"))
		return 0;

	//arFuncs->window_create_main();

	for (;;)
	{
		if (!arFuncs->update())
			break;
	}

	//arFuncs->close();

	return 0;
}

Use Lua for creating main window

Use Lua for creating main window


/**
 * @file
 * @brief
 *
 * @author  Anton Kozlov
 * @date    30.10.2014
 */

#include <assert.h>
#include <stdint.h>
#include <system_stm32f4xx.h>
#include <framework/mod/options.h>
#include <module/embox/arch/system.h>
#include <hal/arch.h>

void arch_init(void) {
	static_assert(OPTION_MODULE_GET(embox__arch__system, NUMBER, core_freq) == 144000000);
	SystemInit();
}

void arch_idle(void) {

}

void arch_shutdown(arch_shutdown_mode_t mode) {
	while (1);
}

/**
 * @file
 * @brief
 *
 * @author  Anton Kozlov
 * @date    30.10.2014
 */

#include <assert.h>
#include <stdint.h>
#include <system_stm32f4xx.h>
#include <framework/mod/options.h>
#include <module/embox/arch/system.h>
#include <hal/arch.h>

#include <stm32f4xx_wwdg.h>

void arch_init(void) {
	static_assert(OPTION_MODULE_GET(embox__arch__system, NUMBER, core_freq) == 144000000);
	SystemInit();
}

void arch_idle(void) {

}

void arch_shutdown(arch_shutdown_mode_t mode) {
	switch (mode) {
	case ARCH_SHUTDOWN_MODE_HALT:
	case ARCH_SHUTDOWN_MODE_REBOOT:
	case ARCH_SHUTDOWN_MODE_ABORT:
	default:
		NVIC_SystemReset();
	}

	/* NOTREACHED */
	while(1) {

	}
}

Change shutdown to reset the board

stm32: Change shutdown to reset the board


/*
 * the continuation data assigned to each request along side with the functions
 * to manipulate them
 *
 * Vmon: June 2013
 */
#ifndef BANJAX_CONTINUATION_H
#define BANJAX_CONTINUATION_H

#include "banjax.h"
#include "banjax_filter.h"
#include "transaction_muncher.h"

class Banjax;

class TransactionData{
public:
  std::shared_ptr<Banjax> banjax;
  TSHttpTxn txnp;

  TransactionMuncher transaction_muncher;
  FilterResponse response_info;

  ~TransactionData();

  /**
     Constructor to set the default values
   */
  TransactionData(std::shared_ptr<Banjax> banjax, TSHttpTxn cur_txn)
    : banjax(std::move(banjax))
    , txnp(cur_txn)
    , transaction_muncher(cur_txn)
  { }

  static
  int handle_transaction_change(TSCont contp, TSEvent event, void *edata);

private:
  void handle_request();
  void handle_response();
  void handle_http_close(Banjax::TaskQueue& current_queue);

};

#endif /*banjax_continuation.h*/

/*
 * the continuation data assigned to each request along side with the functions
 * to manipulate them
 *
 * Vmon: June 2013
 */
#ifndef BANJAX_CONTINUATION_H
#define BANJAX_CONTINUATION_H

#include "banjax.h"
#include "banjax_filter.h"
#include "transaction_muncher.h"

class Banjax;

class TransactionData{
public:
  /**
     Constructor to set the default values
   */
  TransactionData(std::shared_ptr<Banjax> banjax, TSHttpTxn cur_txn)
    : banjax(std::move(banjax))
    , txnp(cur_txn)
    , transaction_muncher(cur_txn)
  { }

  static
  int handle_transaction_change(TSCont contp, TSEvent event, void *edata);

  ~TransactionData();

private:
  std::shared_ptr<Banjax> banjax;
  TSHttpTxn txnp;

  TransactionMuncher transaction_muncher;
  FilterResponse response_info;

private:
  void handle_request();
  void handle_response();
  void handle_http_close(Banjax::TaskQueue& current_queue);
};

#endif /*banjax_continuation.h*/

Make TransactionData member vars private


#include <math.h>
#include <pal.h>

static const float pi_2 = (float) M_PI / 2.f;

/**
 *
 * Computes the inverse cosine (arc cosine) of the input vector 'a'. Input
 * values to acos must be in the range -1 to 1. The result values are in the
 * range 0 to pi. The function does not check for illegal input values.
 *
 * @param a     Pointer to input vector
 *
 * @param c     Pointer to output vector
 *
 * @param n     Size of 'a' and 'c' vector.
 *
 * @return      None
 *
 */
void p_acos_f32(const float *a, float *c, int n)
{

    int i;
    float tmp;
    /* acos x = pi/2 - asin x */
    p_asin_f32(a, c, n);
    for (i = 0; i < n; i++) {
        tmp = pi_2 - c[i];
        c[i] = tmp;
    }
}

#include <pal.h>

#include "p_asin.h"

/**
 *
 * Computes the inverse cosine (arc cosine) of the input vector 'a'. Input
 * values to acos must be in the range -1 to 1. The result values are in the
 * range 0 to pi. The function does not check for illegal input values.
 *
 * @param a     Pointer to input vector
 *
 * @param c     Pointer to output vector
 *
 * @param n     Size of 'a' and 'c' vector.
 *
 * @return      None
 *
 */
void p_acos_f32(const float *a, float *c, int n)
{

    int i;
    /* acos x = pi/2 - asin x */
    for (i = 0; i < n; i++) {
        c[i] = pi_2 - _p_asin(a[i]);
    }
}

Use the inline inverse sine function.

math:acos: Use the inline inverse sine function.

Signed-off-by: Mansour Moufid <ac5f6b12fab5e0d4efa7215e6c2dac9d55ab77dc@gmail.com>


/*-
 * Copyright (c) 2008 Benjamin Close <Benjamin.Close@clearchain.com>
 * 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.
 */

/**
 * This simple program will output hello world to the serial port
 * and read back a line of input from the port
 */
#include <stdio.h>
#include <stdlib.h>
#include <wcl/serial.h>

#define DEVICE "/dev/ttyS0"
#define BUFSIZE 4096

use namespace wcl;

int main( int argc, char **args )
{
    // Create a serial object
    char buffer[BUFSIZE+1] = {0};
    Serial s;

    // Open the serial port, checking that it opened
    if ( s.open( DEVICE, BAUD_115200, /* Use default for all other arguments */) == false ){
	printf("Failed to open serial port\n");
	exit(EXIT_FAILURE);
    }

    // Send hello world down the serial line
    if ( s.write( "Hello World!") == false ){
	printf("Failed to write hello world\n");
	exit(EXIT_FAILURE);
    }

    // Read back a line (about BUFSIZE characters from the port)
    if ( s.read( buffer, BUFSIZE )){
	printf("Failed to read from device\n");
	exit(EXIT_FAILURE);
    }

    printf("You got a message: %*s\n",  buffer )

    // Close the serial port and restore the previous state of the port
    s.close()

    return 0;
}

Add a simple untested example how to use the basics of the serial port class


#ifndef _CONDOR_SYSCALLS_H
#define _CONDOR_SYSCALLS_H

typedef int BOOL;

static const int 	SYS_LOCAL = 1;
static const int 	SYS_REMOTE = 0;
static const int	SYS_RECORDED = 2;
static const int	SYS_MAPPED = 2;

static const int	SYS_UNRECORDED = 0;
static const int	SYS_UNMAPPED = 0;

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

int SetSyscalls( int mode );
BOOL LocalSysCalls();
BOOL RemoteSysCalls();
BOOL MappingFileDescriptors();
int REMOTE_syscall( int syscall_num, ... );
int syscall( int, ... );

#if defined(__cplusplus)
}
#endif

#endif

#ifndef _CONDOR_SYSCALLS_H
#define _CONDOR_SYSCALLS_H

#if defined( AIX32)
#	include "syscall.aix32.h"
#else
#	include <syscall.h>
#endif

typedef int BOOL;

static const int 	SYS_LOCAL = 1;
static const int 	SYS_REMOTE = 0;
static const int	SYS_RECORDED = 2;
static const int	SYS_MAPPED = 2;

static const int	SYS_UNRECORDED = 0;
static const int	SYS_UNMAPPED = 0;

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

int SetSyscalls( int mode );
BOOL LocalSysCalls();
BOOL RemoteSysCalls();
BOOL MappingFileDescriptors();
int REMOTE_syscall( int syscall_num, ... );

#if defined(AIX32) && defined(__cplusplus)
	int syscall( ... );
#else
	int syscall( int, ... );
#endif

#if defined(__cplusplus)
}
#endif

#endif

Add inclusion of "syscall.aix32.h" or <syscall.h> depending on whether we are on an AIX machine where there is no <syscall.h>.


#ifndef HTTP_H
#define HTTP_H

#include <stddef.h>

#define HTTP_GET 1
#define HTTP_HEAD 2
#define HTTP_POST 3
#define HTTP_PUT 4
#define HTTP_DELETE 5

#define FIELD_HOST 1
#define FIELD_LENGTH 2
#define FIELD_TYPE 3

#define ERR_BAD_REQ 0
#define ERR_NOT_FOUND 1
#define ERR_METHOD 2
#define ERR_FORBIDDEN 3
#define ERR_INTERNAL 4

typedef struct
{
    int method;     /* request method */
    char* path;     /* requested path */
    char* host;     /* hostname field */
    char* type;     /* content-type */
    size_t length;  /* content-length */
    int flags;
}
http_request;

/* Write an error page (and header). Returns number of bytes written. */
size_t gen_error_page( int fd, int error );

/*
    Write 200 Ok header with content length and content type.
    Returns the number of bytes written, 0 on failure.
 */
size_t http_ok( int fd, const char* type, unsigned long size );

/* parse a HTTP request, returns non-zero on success, zero on failure */
int http_request_parse( char* buffer, http_request* request );

#endif /* HTTP_H */

#ifndef HTTP_H
#define HTTP_H

#include <stddef.h>

#define HTTP_GET 1
#define HTTP_HEAD 2
#define HTTP_POST 3
#define HTTP_PUT 4
#define HTTP_DELETE 5

#define FIELD_HOST 1
#define FIELD_LENGTH 2
#define FIELD_TYPE 3

#define ERR_BAD_REQ 0
#define ERR_NOT_FOUND 1
#define ERR_METHOD 2
#define ERR_FORBIDDEN 3
#define ERR_INTERNAL 4

typedef struct
{
    int method;     /* request method */
    char* path;     /* requested path */
    char* host;     /* hostname field */
    char* type;     /* content-type */
    size_t length;  /* content-length */
}
http_request;

/* Write an error page (and header). Returns number of bytes written. */
size_t gen_error_page( int fd, int error );

/*
    Write 200 Ok header with content length and content type.
    Returns the number of bytes written, 0 on failure.
 */
size_t http_ok( int fd, const char* type, unsigned long size );

/* parse a HTTP request, returns non-zero on success, zero on failure */
int http_request_parse( char* buffer, http_request* request );

#endif /* HTTP_H */

Remove unused flags field from request

Remove unused flags field from request

Signed-off-by: David Oberhollenzer <ef97309e490485c1bad5018f0617d7fa37bc07ac@tele2.at>


#include <ar.h>
#include <ctype.h>
#include <stdio.h>
#include <sys/types.h>
#include <fcntl.h>
#include <errno.h>
#include <stdlib.h>
#include <stdio.h>
#include <unistd.h>

int main(int argc, char **argv)
{
    int aflag = 0;
    int bflag = 0;
    char *cvalue = NULL;
    int index;
    int c;

    int opterr = 0;

    while ((c = getopt(argc, argv, "abc:")) != -1)
        switch (c)
        {
        case 'a':
            aflag = 1;
            break;
        case 'b':
            bflag = 1;
            break;
        case 'c':
            cvalue = optarg;
            break;
        case '?':
            if (optopt == 'c')
                fprintf (stderr, "Option -%c requires an argument.\n", optopt);
            else if (isprint (optopt))
                fprintf (stderr, "Unknown option `-%c'.\n", optopt);
            else
                fprintf (stderr,
                        "Unknown option character `\\x%x'.\n",
                        optopt);
            return 1;
        default:
            abort();
        }

    printf ("aflag = %d, bflag = %d, cvalue = %s\n",
            aflag, bflag, cvalue);

    for (index = optind; index < argc; index++)
        printf ("Non-option argument %s\n", argv[index]);
    return 0;

}

Add getopt working example from gnu.org

Add getopt working example from gnu.org


/**************************************************************************
 * Copyright(c) 2007-2009, ALICE Experiment at CERN, All rights reserved. *
 * See cxx source for full Copyright notice                               *
 **************************************************************************/
#ifndef SORNOTIFIER_H
#define SORNOTIFIER_H

//______________________________________________________________________________
//
// ECS Start-of-Run notifier
//
// This class "listens" to the SOR coming from the ECS.
//

// DIM
#include <dic.hxx>

class AliOnlineRecoTrigger;

class SORNotifier: public DimUpdatedInfo
{
public:
        SORNotifier(AliOnlineRecoTrigger* trigger):
	  DimUpdatedInfo("/LOGBOOK/SUBSCRIBE/ECS_SOR_PHYSICS", -1), fRun(-1), fTrigger(trigger) {}

	void infoHandler();

	void errorHandler(int severity, int code, char *msg);

	int GetRun() const {return fRun;}
private:
	SORNotifier(const SORNotifier& other);
	SORNotifier& operator = (const SORNotifier& other);

	int fRun;

	AliOnlineRecoTrigger* fTrigger;
};

#endif

/**************************************************************************
 * Copyright(c) 2007-2009, ALICE Experiment at CERN, All rights reserved. *
 * See cxx source for full Copyright notice                               *
 **************************************************************************/
#ifndef SORNOTIFIER_H
#define SORNOTIFIER_H

//______________________________________________________________________________
//
// ECS Start-of-Run notifier
//
// This class "listens" to the SOR coming from the ECS.
//

// DIM
#include <dic.hxx>

class AliOnlineRecoTrigger;

class SORNotifier: public DimUpdatedInfo
{
public:
        SORNotifier(AliOnlineRecoTrigger* trigger):
	  DimUpdatedInfo("/LOGBOOK/SUBSCRIBE/DAQ_SOR_PHYSICS", -1), fRun(-1), fTrigger(trigger) {}

	void infoHandler();

	void errorHandler(int severity, int code, char *msg);

	int GetRun() const {return fRun;}
private:
	SORNotifier(const SORNotifier& other);
	SORNotifier& operator = (const SORNotifier& other);

	int fRun;

	AliOnlineRecoTrigger* fTrigger;
};

#endif

Correct DIM service is DAQ_SOR_PHYSICS. In this case we get the trigger config from the logbook.


/* irq.h: FRV IRQ definitions
 *
 * Copyright (C) 2006 Red Hat, Inc. All Rights Reserved.
 * Written by David Howells (dhowells@redhat.com)
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * as published by the Free Software Foundation; either version
 * 2 of the License, or (at your option) any later version.
 */

#ifndef _ASM_IRQ_H_
#define _ASM_IRQ_H_

/* this number is used when no interrupt has been assigned */
#define NO_IRQ				(-1)

#define NR_IRQS				48
#define IRQ_BASE_CPU			(0 * 16)
#define IRQ_BASE_FPGA			(1 * 16)
#define IRQ_BASE_MB93493		(2 * 16)

/* probe returns a 32-bit IRQ mask:-/ */
#define MIN_PROBE_IRQ			(NR_IRQS - 32)

#ifndef __ASSEMBLY__
static inline int irq_canonicalize(int irq)
{
	return irq;
}
#endif

#endif /* _ASM_IRQ_H_ */

/* irq.h: FRV IRQ definitions
 *
 * Copyright (C) 2006 Red Hat, Inc. All Rights Reserved.
 * Written by David Howells (dhowells@redhat.com)
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * as published by the Free Software Foundation; either version
 * 2 of the License, or (at your option) any later version.
 */

#ifndef _ASM_IRQ_H_
#define _ASM_IRQ_H_

#define NR_IRQS				48
#define IRQ_BASE_CPU			(0 * 16)
#define IRQ_BASE_FPGA			(1 * 16)
#define IRQ_BASE_MB93493		(2 * 16)

/* probe returns a 32-bit IRQ mask:-/ */
#define MIN_PROBE_IRQ			(NR_IRQS - 32)

#ifndef __ASSEMBLY__
static inline int irq_canonicalize(int irq)
{
	return irq;
}
#endif

#endif /* _ASM_IRQ_H_ */

Remove bogus NO_IRQ = -1 define

frv: Remove bogus NO_IRQ = -1 define

The old NO_IRQ define some platforms had was long ago declared obsolete
and wrong. FRV should therefore not be re-introducing this, especially as
IRQs are usually unsigned in the kernel. The "no IRQ" case is defined to be
zero and Linus made this rather clear at the time.

arch/frv shows no dependancy on this but it might show up driver fixes
needing doing I guess

Signed-off-by: Alan Cox <91e38e63b890fbb214c8914809fde03c73e7f24d@redhat.com>
Acked-by: David Howells <ebac1d06c1688626821bb0e574a037a7a5354e49@redhat.com>
Signed-off-by: Linus Torvalds <69652caca27c8b940640ad396ab71f93cacec34f@linux-foundation.org>


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

/* I am intentionally not doing the Windows portability stuff here
 since I am doing this for the language-implementation aspect,
 rather than the portability aspect. If it turns out the portability
 stuff is a big deal, I will come back and add in that code. -MAW */

#include <editline/readline.h>

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

    /* Print Version and Exit information */
    puts("Lispy Version 0.0.0.0.1");
    puts("Press Ctrl-C to exit\n");

    while(1) {
        /* prompt: */
        char *input = readline("lispy> ");

        /* add input to command history */
        add_history(input);

        printf("No, you're a %s\n", input);

        /* input was dynamically allocated */
        free(input);
    }
    return 0;
}

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

/* I am intentionally not doing the Windows portability stuff here
 since I am doing this for the language-implementation aspect,
 rather than the portability aspect. If it turns out the portability
 stuff is a big deal, I will come back and add in that code. -MAW */

/* Fun SO link on target platform detection:
   http://stackoverflow.com/a/5920028/3435397 */

#include <editline/readline.h>

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

    /* Print Version and Exit information */
    puts("Lispy Version 0.0.0.0.1");
    puts("Press Ctrl-C to exit\n");

    while(1) {
        /* prompt: */
        char *input = readline("lispy> ");

        /* add input to command history */
        add_history(input);

        printf("No, you're a %s\n", input);

        /* input was dynamically allocated */
        free(input);
    }
    return 0;
}

Add a link to an SO answer about platform detection


/**
 * \file   os_isfile.c
 * \brief  Returns true if the given file exists on the file system.
 * \author Copyright (c) 2002-2008 Jason Perkins and the Premake project
 */

#include <sys/stat.h>
#include "premake.h"

int os_isfile(lua_State* L)
{
	const char* filename = luaL_checkstring(L, 1);
	lua_pushboolean(L, do_isfile(filename));
	return 1;
}

int do_isfile(const char* filename)
{
	struct stat buf;
#if PLATFORM_WINDOWS
	DWORD attrib = GetFileAttributesA(filename);
	if (attrib != INVALID_FILE_ATTRIBUTES)
	{
		return (attrib & FILE_ATTRIBUTE_DIRECTORY) == 0;
	}
#else
	if (stat(filename, &buf) == 0)
	{
		return ((buf.st_mode & S_IFDIR) == 0);
	}
#endif

	return 0;
}

/**
 * \file   os_isfile.c
 * \brief  Returns true if the given file exists on the file system.
 * \author Copyright (c) 2002-2008 Jason Perkins and the Premake project
 */

#include <sys/stat.h>
#include "premake.h"

int os_isfile(lua_State* L)
{
	const char* filename = luaL_checkstring(L, 1);
	lua_pushboolean(L, do_isfile(filename));
	return 1;
}

int do_isfile(const char* filename)
{
#if PLATFORM_WINDOWS
	DWORD attrib = GetFileAttributesA(filename);
	if (attrib != INVALID_FILE_ATTRIBUTES)
	{
		return (attrib & FILE_ATTRIBUTE_DIRECTORY) == 0;
	}
#else
	struct stat buf;
	if (stat(filename, &buf) == 0)
	{
		return ((buf.st_mode & S_IFDIR) == 0);
	}
#endif

	return 0;
}

Fix a new Visual Studio unused variable build warning


/* Copyright (c) 2002-2008 Dovecot authors, see the included COPYING file */

#include "common.h"
#include "commands.h"
#include "imap-expunge.h"

bool cmd_close(struct client_command_context *cmd)
{
	struct client *client = cmd->client;
	struct mailbox *mailbox = client->mailbox;
	struct mail_storage *storage;

	if (!client_verify_open_mailbox(cmd))
		return TRUE;

	storage = mailbox_get_storage(mailbox);
	client->mailbox = NULL;

	if (!imap_expunge(mailbox, NULL))
		client_send_untagged_storage_error(client, storage);

	if (mailbox_close(&mailbox) < 0)
                client_send_untagged_storage_error(client, storage);
	client_update_mailbox_flags(client, NULL);

	client_send_tagline(cmd, "OK Close completed.");
	return TRUE;
}

/* Copyright (c) 2002-2008 Dovecot authors, see the included COPYING file */

#include "common.h"
#include "commands.h"
#include "imap-expunge.h"

bool cmd_close(struct client_command_context *cmd)
{
	struct client *client = cmd->client;
	struct mailbox *mailbox = client->mailbox;
	struct mail_storage *storage;

	if (!client_verify_open_mailbox(cmd))
		return TRUE;

	storage = mailbox_get_storage(mailbox);
	client->mailbox = NULL;

	if (!imap_expunge(mailbox, NULL))
		client_send_untagged_storage_error(client, storage);
	else if (mailbox_sync(mailbox, 0, 0, NULL) < 0)
		client_send_untagged_storage_error(client, storage);

	if (mailbox_close(&mailbox) < 0)
                client_send_untagged_storage_error(client, storage);
	client_update_mailbox_flags(client, NULL);

	client_send_tagline(cmd, "OK Close completed.");
	return TRUE;
}

CLOSE: Synchronize the mailbox after expunging messages to actually get them
expunged.

--HG--
branch : HEAD


#ifndef GPIOLIB_H
#define GPIOLIB_H

#define FORWARD 1
#define BACKWARD 0

namespace GPIO
{
	int init();

	int controlLeft(int direction,int speed);
	int controlRight(int direction,int speed);
	int stopLeft();
	int stopRight();

	int resetCounter();
	void getCounter(int *countLeft,int *countRight);
	int turnTo(int angle);

	void delay(int milliseconds);
}
#endif

#ifndef GPIOLIB_H
#define GPIOLIB_H

#define FORWARD 1
#define BACKWARD 0

namespace GPIO
{
	int init();

	//direction is either FORWARD or BACKWARD. speed can be an integer ranging from 0 to 100.
	int controlLeft(int direction,int speed);
	int controlRight(int direction,int speed);
	int stopLeft();
	int stopRight();

	int resetCounter();
	void getCounter(int *countLeft,int *countRight);
	//angle is available in the range of -90 to 90.
	int turnTo(int angle);

	void delay(int milliseconds);
}
#endif

Add some comments in the header file for understanding


/*
 * Utilities for working with hash values.
 *
 * Portions Copyright (c) 2017, PostgreSQL Global Development Group
 */

#ifndef HASHUTILS_H
#define HASHUTILS_H

/*
 * Combine two hash values, resulting in another hash value, with decent bit
 * mixing.
 *
 * Similar to boost's hash_combine().
 */
static inline uint32
hash_combine(uint32 a, uint32 b)
{
	a ^= b + 0x9e3779b9 + (a << 6) + (a >> 2);
	return a;
}

#endif							/* HASHUTILS_H */

Add a hash_combine function for mixing hash values.

This hash function is derived from Boost's function of the same name.

Author: Andres Freund, Thomas Munro
Discussion: https://postgr.es/m/CAEepm%3D3rdgjfxW4cKvJ0OEmya2-34B0qHNG1xV0vK7TGPJGMUQ%40mail.gmail.com
Discussion: https://postgr.es/m/20170731210844.3cwrkmsmbbpt4rjc%40alap3.anarazel.de


/* Dummy file used for nothing at this point
 *
 * see alpha.h
 * $PostgreSQL: pgsql/src/backend/port/dynloader/osf.c,v 1.2 2006/03/11 04:38:31 momjian Exp $
 */

/*
 * $PostgreSQL: pgsql/src/backend/port/dynloader/osf.c,v 1.3 2009/04/21 21:05:25 tgl Exp $
 *
 * Dummy file used for nothing at this point
 *
 * see osf.h
 */

Fix obsolete cross-reference (this file isn't called alpha.c anymore)


#ifndef SRC_FORCES_LABEL_STATE_H_

#define SRC_FORCES_LABEL_STATE_H_

#include <Eigen/Core>
#include <string>

namespace Forces
{
/**
 * \brief
 *
 *
 */
class LabelState
{
 public:
  EIGEN_MAKE_ALIGNED_OPERATOR_NEW

  LabelState(int id, std::string text, Eigen::Vector3f anchorPosition);

  const int id;
  const Eigen::Vector3f anchorPosition;
  Eigen::Vector3f labelPosition;

  Eigen::Vector2f anchorPosition2D;
  Eigen::Vector2f labelPosition2D;
  float labelPositionDepth;
 private:
  std::string text;

};
}  // namespace Forces

#endif  // SRC_FORCES_LABEL_STATE_H_

#ifndef SRC_FORCES_LABEL_STATE_H_

#define SRC_FORCES_LABEL_STATE_H_

#include <Eigen/Core>
#include <string>

namespace Forces
{
/**
 * \brief
 *
 *
 */
class LabelState
{
 public:
  EIGEN_MAKE_ALIGNED_OPERATOR_NEW

  LabelState(int id, std::string text, Eigen::Vector3f anchorPosition);

  const int id;
  const Eigen::Vector3f anchorPosition;
  Eigen::Vector3f labelPosition;

  Eigen::Vector2f anchorPosition2D;
  Eigen::Vector2f labelPosition2D;
  float labelPositionDepth;

  const std::string text;
};
}  // namespace Forces

#endif  // SRC_FORCES_LABEL_STATE_H_

Make text in LabelState public.

Make text in LabelState public.


Use puts again in a better position, save one byte (143)


#ifndef DICT2_CLASSN_H
#define DICT2_CLASSN_H

#include "ClassI.h"
#include "ClassL.h"

class ClassN: /* public ClassI, */ public ClassL {
 public:
  ClassN() : fN('n') {}
  virtual ~ClassN() {}
  int n() { return fN; }
  void setN(int v) { fN = v; }
 private:
  int fN;
};

#endif // DICT2_CLASSN_H

Test class to check for ambiguities in the dictionary source code in case of
non virtual diamonds

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


/* Exercise 5-3 */

#include <unistd.h>
#include <fcntl.h>
#include "tlpi_hdr.h"

int main (int argc, char *argv[]) {
  if (argc < 3 || argc > 4) {
    usageErr("%s filename num-bytes [x]", argv[0]);
  }

  long n = getLong(argv[2], GN_NONNEG | GN_ANY_BASE, "num-bytes");
  Boolean x = argc == 4 && strcmp(argv[3], "x") == 0;
  int flags = O_WRONLY | O_CREAT;
  if (!x) { flags |= O_APPEND; }
  int fd = open(argv[1], flags, S_IWUSR | S_IRUSR);
  if (fd == -1) { errExit("open"); }

  while (n-- > 0) {
    if (x) {
      if (lseek(fd, 0, SEEK_END) == -1) { errExit("seek"); }
    }
    if (write(fd, "a", 1) == -1) {
      errExit("write byte a");
    }
  }
}

/* Exercise 5-3 */

#include <unistd.h>
#include <fcntl.h>
#include "tlpi_hdr.h"

int main (int argc, char *argv[]) {
  if (argc < 3 || argc > 4) {
    usageErr("%s filename num-bytes [x]", argv[0]);
  }

  long n = getLong(argv[2], GN_NONNEG | GN_ANY_BASE, "num-bytes");
  Boolean x = argc == 4 && strcmp(argv[3], "x") == 0;
  int flags = O_WRONLY | O_CREAT;
  if (!x) { flags |= O_APPEND; }
  int fd = open(argv[1], flags, S_IWUSR | S_IRUSR);
  if (fd == -1) { errExit("open"); }

  while (n-- > 0) {
    if (x) {
      if (lseek(fd, 0, SEEK_END) == -1) { errExit("seek"); }
    }
    if (write(fd, "a", 1) == -1) {
      errExit("write byte a");
    }
  }

  if (close(fd) == -1) {
      errExit("close output");
  }

  exit(EXIT_SUCCESS);
}

Add missing close for file descriptor

Add missing close for file descriptor


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

#pragma once

#import <dispatch/dispatch.h>

namespace facebook {
  namespace flipper {
    class DispatchQueue
    {
    public:
      virtual void async(dispatch_block_t block) = 0;
    };

    class GCDQueue: public DispatchQueue
    {
    public:
      GCDQueue(dispatch_queue_t underlyingQueue)
      :_underlyingQueue(underlyingQueue) { }

      void async(dispatch_block_t block) override
      {
        dispatch_async(_underlyingQueue, block);
      }

      virtual ~GCDQueue() { }

    private:
      dispatch_queue_t _underlyingQueue;
    };
  }
}

#endif

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

#pragma once

#import <dispatch/dispatch.h>

namespace facebook {
  namespace flipper {
    class DispatchQueue
    {
    public:
      virtual void async(dispatch_block_t block) = 0;
      virtual ~DispatchQueue() { }
    };

    class GCDQueue: public DispatchQueue
    {
    public:
      GCDQueue(dispatch_queue_t underlyingQueue)
      :_underlyingQueue(underlyingQueue) { }

      void async(dispatch_block_t block) override
      {
        dispatch_async(_underlyingQueue, block);
      }

      virtual ~GCDQueue() { }

    private:
      dispatch_queue_t _underlyingQueue;
    };
  }
}

#endif

Add virtual destructor to class with virtual functions but non-virtual destructor

Reviewed By: jdthomas

Differential Revision: D16954508

fbshipit-source-id: 958118843687145c1147ac5beeb2857b21332702


/*
 * vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
 */
#ifdef E_TYPEDEFS
#else
#ifndef E_INT_CONFIG_MODULES_H
#define E_INT_CONFIG_MODULES_H

EAPI E_Config_Dialog *e_int_config_modules(E_Container *con, const char *params __UNUSED__);

#endif
#endif

/*
 * vim:ts=8:sw=3:sts=8:noexpandtab:cino=>5n-3f0^-2{2
 */
#ifdef E_TYPEDEFS
#else
#ifndef E_INT_CONFIG_MODULES_H
#define E_INT_CONFIG_MODULES_H

EAPI E_Config_Dialog *e_int_config_modules(E_Container *con, const char *params);

#endif
#endif

Remove __UNUSED__ as it doesn't make sense here.

git-svn-id: 6ac5796aeae0cef97fb47bcc287d4ce899c6fa6e@38188 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33


#include "freertos_task_wrapper.h"

#include <FreeRTOS.h>
#include <task.h>

void ivory_freertos_task_create(void (*tsk)(void),
        uint32_t stacksize, uint8_t priority)
{
    xTaskCreate((void (*)(void*)) tsk, /* this cast is undefined behavior */
            NULL, stacksize, NULL, priority, NULL);
}

void ivory_freertos_task_delay(uint32_t time_ms)
{   vTaskDelay(time_ms);
}

void ivory_freertos_task_delayuntil(uint32_t *lastwaketime, uint32_t dt)
{
    vTaskDelayUntil(lastwaketime, dt);
}

uint32_t ivory_freertos_task_getmilliscount(void) {
    return xTaskGetTickCount() / portTICK_RATE_MS;
}

uint32_t ivory_freertos_task_gettickcount(void) {
    return xTaskGetTickCount();
}

uint32_t ivory_freertos_millistoticks(uint32_t ms)
{
  return time * portTICK_RATE_MS;
}

#include "freertos_task_wrapper.h"

#include <FreeRTOS.h>
#include <task.h>

void ivory_freertos_task_create(void (*tsk)(void),
        uint32_t stacksize, uint8_t priority)
{
    xTaskCreate((void (*)(void*)) tsk, /* this cast is undefined behavior */
            NULL, stacksize, NULL, priority, NULL);
}

void ivory_freertos_task_delay(uint32_t time_ms)
{   vTaskDelay(time_ms);
}

void ivory_freertos_task_delayuntil(uint32_t *lastwaketime, uint32_t dt)
{
    vTaskDelayUntil(lastwaketime, dt);
}

uint32_t ivory_freertos_task_getmilliscount(void) {
    return xTaskGetTickCount() / portTICK_RATE_MS;
}

uint32_t ivory_freertos_task_gettickcount(void) {
    return xTaskGetTickCount();
}

uint32_t ivory_freertos_millistoticks(uint32_t ms)
{
  return ms * portTICK_RATE_MS;
}

Fix bug in ivory wrapper.

Fix bug in ivory wrapper.


#include <stdio.h>

int main() {

  // imprime o cabecalho do nosso jogo
  printf("******************************************\n");
  printf("* Bem vindo ao nosso jogo de adivinhação *\n");
  printf("******************************************\n");

  int numerosecreto = 42;

  int chute;

  for(int i = 1; i <= 3; i++) {

    printf("Tentativa %d de 3\n", i);
    printf("Qual é o seu chute? ");

    scanf("%d", &chute);
    printf("Seu chute foi %d\n", chute);

    int acertou = chute == numerosecreto;

    if(acertou) {
      printf("Parabéns! Você acertou!\n");
      printf("Jogue de novo, você é um bom jogador!\n");

      break;
    } else {

      int maior = chute > numerosecreto;

      if(maior) {
        printf("Seu chute foi maior que o número secreto\n");
      } else {
        printf("Seu chute foi menor que o número secreto\n");
      }

      printf("Você errou!\n");
      printf("Mas não desanime, tente de novo!\n");
    }

  }

  printf("Fim de jogo!\n");

}

#include <stdio.h>

#define NUMERO_DE_TENTATIVAS 5

int main() {

  // imprime o cabecalho do nosso jogo
  printf("******************************************\n");
  printf("* Bem vindo ao nosso jogo de adivinhação *\n");
  printf("******************************************\n");

  int numerosecreto = 42;

  int chute;

  for(int i = 1; i <= NUMERO_DE_TENTATIVAS; i++) {

    printf("Tentativa %d de %d\n", i, NUMERO_DE_TENTATIVAS);
    printf("Qual é o seu chute? ");

    scanf("%d", &chute);
    printf("Seu chute foi %d\n", chute);

    int acertou = chute == numerosecreto;

    if(acertou) {
      printf("Parabéns! Você acertou!\n");
      printf("Jogue de novo, você é um bom jogador!\n");

      break;
    } else {

      int maior = chute > numerosecreto;

      if(maior) {
        printf("Seu chute foi maior que o número secreto\n");
      } else {
        printf("Seu chute foi menor que o número secreto\n");
      }

      printf("Você errou!\n");
      printf("Mas não desanime, tente de novo!\n");
    }

  }

  printf("Fim de jogo!\n");

}

Update files, Alura, Introdução a C, Aula 2.7


#ifndef __SODIUM_EXPORT_H__
#define __SODIUM_EXPORT_H__

#ifndef __GNUC__
# ifdef __attribute__
#  undef __attribute__
# endif
# define __attribute__(a)
#endif

#ifndef SODIUM_STATIC
# if defined(_MSC_VER)
#  ifdef DLL_EXPORT
#   define SODIUM_EXPORT __declspec(dllexport)
#  else
#   define SODIUM_EXPORT __declspec(dllimport)
#  endif
# else
#  if defined(__SUNPRO_C)
#   define SODIUM_EXPORT __attribute__ __global
#  elif defined(_MSG_VER)
#   define SODIUM_EXPORT extern __declspec(dllexport)
#  else
#   define SODIUM_EXPORT __attribute__ ((visibility ("default")))
#  endif
# endif
#endif

#endif

#ifndef __SODIUM_EXPORT_H__
#define __SODIUM_EXPORT_H__

#ifndef __GNUC__
# ifdef __attribute__
#  undef __attribute__
# endif
# define __attribute__(a)
#endif

#ifdef SODIUM_STATIC
# define SODIUM_EXPORT
#else
# if defined(_MSC_VER)
#  ifdef DLL_EXPORT
#   define SODIUM_EXPORT __declspec(dllexport)
#  else
#   define SODIUM_EXPORT __declspec(dllimport)
#  endif
# else
#  if defined(__SUNPRO_C)
#   define SODIUM_EXPORT __attribute__ __global
#  elif defined(_MSG_VER)
#   define SODIUM_EXPORT extern __declspec(dllexport)
#  else
#   define SODIUM_EXPORT __attribute__ ((visibility ("default")))
#  endif
# endif
#endif

#endif

Define an empty SODIUM_EXPORT if SODIUM_STATIC is defined.


//
//  FTMutableDataSource.h
//  Fountain
//
//  Created by Tobias Kraentzer on 15.09.15.
//  Copyright © 2015 Tobias Kräntzer. All rights reserved.
//

#import "FTDataSource.h"

@protocol FTMutableDataSource <FTDataSource>

#pragma mark Insertion
- (BOOL)canInsertItem:(id)item;
- (NSIndexPath *)insertItem:(id)item atProposedIndexPath:(NSIndexPath *)proposedIndexPath error:(NSError **)error;

#pragma mark Editing
- (BOOL)canEditItemAtIndexPath:(NSIndexPath *)indexPath;

#pragma mark Deletion
- (BOOL)canDeleteItemAtIndexPath:(NSIndexPath *)indexPath;
- (void)deleteItemAtIndexPath:(NSIndexPath *)indexPath __attribute__((deprecated));
- (BOOL)deleteItemAtIndexPath:(NSIndexPath *)indexPath error:(NSError **)error;

@end

//
//  FTMutableDataSource.h
//  Fountain
//
//  Created by Tobias Kraentzer on 15.09.15.
//  Copyright © 2015 Tobias Kräntzer. All rights reserved.
//

#import "FTDataSource.h"

@protocol FTMutableDataSource <FTDataSource>

#pragma mark Insertion
- (BOOL)canInsertItem:(id)item;
- (NSIndexPath *)insertItem:(id)item atProposedIndexPath:(NSIndexPath *)proposedIndexPath error:(NSError **)error;

#pragma mark Editing
- (BOOL)canEditItemAtIndexPath:(NSIndexPath *)indexPath;

#pragma mark Deletion
- (BOOL)canDeleteItemAtIndexPath:(NSIndexPath *)indexPath;
- (BOOL)deleteItemAtIndexPath:(NSIndexPath *)indexPath error:(NSError **)error;

@end

Remove leftover method in protocol

Remove leftover method in protocol


//===-- llvm/CodeGen/MachineLocation.h --------------------------*- C++ -*-===//
//
//                     The LLVM Compiler Infrastructure
//
// This file was developed by James M. Laskey and is distributed under
// the University of Illinois Open Source License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// The MachineLocation class is used to represent a simple location in a machine
// frame.  Locations will be one of two forms; a register or an address formed
// from a base address plus an offset.
//===----------------------------------------------------------------------===//

#ifndef LLVM_CODEGEN_MACHINELOCATION_H
#define LLVM_CODEGEN_MACHINELOCATION_H

namespace llvm {

class MachineLocation {
private:
  bool IsRegister;                      // True if location is a register.
  unsigned Register;                    // gcc/gdb register number.
  int Offset;                           // Displacement if not register.

public:
  MachineLocation()
  : IsRegister(false)
  , Register(0)
  , Offset(0)
  {}
  MachineLocation(unsigned R)
  : IsRegister(true)
  , Register(R)
  , Offset(0)
  {}
  MachineLocation(unsigned R, int O)
  : IsRegister(false)
  , Register(R)
  , Offset(0)
  {}

  // Accessors
  bool isRegister()      const { return IsRegister; }
  unsigned getRegister() const { return Register; }
  int getOffset()        const { return Offset; }
  void setIsRegister(bool Is)  { IsRegister = Is; }
  void setRegister(unsigned R) { Register = R; }
  void setOffset(int O)        { Offset = O; }
  void set(unsigned R) {
    IsRegister = true;
    Register = R;
    Offset = 0;
  }
  void set(unsigned R, int O) {
    IsRegister = false;
    Register = R;
    Offset = O;
  }
};

} // End llvm namespace

#endif

Support for locating of debug items in frames.

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


//===--- TargetBuiltins.h - Target specific builtin IDs -------------------===//
//
//                     The LLVM Compiler Infrastructure
//
// This file was developed by Anders Carlsson and is distributed under
// the University of Illinois Open Source License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

#ifndef LLVM_CLANG_AST_TARGET_BUILTINS_H
#define LLVM_CLANG_AST_TARGET_BUILTINS_H

#include "clang/AST/Builtins.h"

namespace clang {

/// X86 builtins
namespace X86 {
    enum {
        LastTIBuiltin = clang::Builtin::FirstTSBuiltin-1,
#define BUILTIN(ID, TYPE, ATTRS) BI##ID,
#include "X86Builtins.def"
        LastTSBuiltin
    };
}

/// PPC builtins
namespace PPC {
    enum {
        LastTIBuiltin = clang::Builtin::FirstTSBuiltin-1,
#define BUILTIN(ID, TYPE, ATTRS) BI##ID,
#include "PPCBuiltins.def"
        LastTSBuiltin
    };
}

}

#endif

//===--- TargetBuiltins.h - Target specific builtin IDs -------------------===//
//
//                     The LLVM Compiler Infrastructure
//
// This file was developed by Anders Carlsson and is distributed under
// the University of Illinois Open Source License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

#ifndef LLVM_CLANG_AST_TARGET_BUILTINS_H
#define LLVM_CLANG_AST_TARGET_BUILTINS_H

#include "clang/AST/Builtins.h"

/// X86 builtins
namespace X86 {
    enum {
        LastTIBuiltin = clang::Builtin::FirstTSBuiltin-1,
#define BUILTIN(ID, TYPE, ATTRS) BI##ID,
#include "X86Builtins.def"
        LastTSBuiltin
    };
}

/// PPC builtins
namespace PPC {
    enum {
        LastTIBuiltin = clang::Builtin::FirstTSBuiltin-1,
#define BUILTIN(ID, TYPE, ATTRS) BI##ID,
#include "PPCBuiltins.def"
        LastTSBuiltin
    };
}

#endif

Revert change that broke the build.

Revert change that broke the build.

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


#ifndef LOG_H
#define LOG_H

#include <time.h>

typedef struct data_struct {
    time_t time;
    char *string;
} data_t;

int addmsg(data_t data);
void clearlog(void);
char *getlog(void);
int savelog(char *filename);

#endif

#ifndef LOG_H
#define LOG_H

#include <time.h>

typedef struct data_struct {
    time_t time;
    char *string;
} data_t;

int addmsg(data_t data);
void clearlog(void);
char *getlog(void);
int savelog(const char *filename);

#endif

Make the char * parameter as const char *


/**
 * @file
 * @brief
 *
 * @date 06.03.2013
 * @author Anton Bulychev
 */

#ifndef KERNEL_THREAD_SCHED_STRATEGY_H_
#define KERNEL_THREAD_SCHED_STRATEGY_H_

#include <kernel/sched/affinity.h>
#include <kernel/sched/runq.h>
#include <kernel/sched/sched_timing.h>
#include <kernel/sched/sched_priority.h>

struct runq {
	runq_t queue;
};

struct sched_attr {
	runq_item_t runq_link;
	affinity_t affinity;
	sched_timing_t sched_time;
	thread_priority_t thread_priority;
};

#endif /* KERNEL_THREAD_SCHED_STRATEGY_H_ */

/**
 * @file
 * @brief
 *
 * @date 06.03.2013
 * @author Anton Bulychev
 */

#ifndef KERNEL_THREAD_SCHED_STRATEGY_H_
#define KERNEL_THREAD_SCHED_STRATEGY_H_

#include <kernel/spinlock.h>
#include <kernel/sched/affinity.h>
#include <kernel/sched/runq.h>
#include <kernel/sched/sched_timing.h>
#include <kernel/sched/sched_priority.h>

struct runq {
	runq_t     queue;
	spinlock_t lock;
};

struct sched_attr {
	runq_item_t runq_link;
	affinity_t affinity;
	sched_timing_t sched_time;
	thread_priority_t thread_priority;
};

#endif /* KERNEL_THREAD_SCHED_STRATEGY_H_ */

Add lock to runq struct

sched: Add lock to runq struct