Use an optimized 7 segment table

Use an optimized 7 segment table


#ifndef ALIHLTPHOSVALIDCELLDATASTRUCT_H
#define ALIHLTPHOSVALIDCELLDATASTRUCT_H

/***************************************************************************
 * Copyright(c) 2007, ALICE Experiment at CERN, All rights reserved.       *
 *                                                                         *
 * Author: Per Thomas Hille <perthi@fys.uio.no> for the ALICE HLT Project. *
 * Contributors are mentioned in the code where appropriate.               *
 *                                                                         *
 * Permission to use, copy, modify and distribute this software and its    *
 * documentation strictly for non-commercial purposes is hereby granted    *
 * without fee, provided that the above copyright notice appears in all    *
 * copies and that both the copyright notice and this permission notice    *
 * appear in the supporting documentation. The authors make no claims      *
 * about the suitability of this software for any purpose. It is           *
 * provided "as is" without express or implied warranty.                   *
 **************************************************************************/

#include "AliHLTDataTypes.h"

struct AliHLTPHOSValidCellDataStruct
{
  AliHLTUInt16_t fRow;
  AliHLTUInt16_t fCol;
  AliHLTUInt16_t fGain;
  Float_t fEnergy;
  Float_t fTime;
};

#endif

#ifndef ALIHLTPHOSVALIDCELLDATASTRUCT_H
#define ALIHLTPHOSVALIDCELLDATASTRUCT_H

/***************************************************************************
 * Copyright(c) 2007, ALICE Experiment at CERN, All rights reserved.       *
 *                                                                         *
 * Author: Per Thomas Hille <perthi@fys.uio.no> for the ALICE HLT Project. *
 * Contributors are mentioned in the code where appropriate.               *
 *                                                                         *
 * Permission to use, copy, modify and distribute this software and its    *
 * documentation strictly for non-commercial purposes is hereby granted    *
 * without fee, provided that the above copyright notice appears in all    *
 * copies and that both the copyright notice and this permission notice    *
 * appear in the supporting documentation. The authors make no claims      *
 * about the suitability of this software for any purpose. It is           *
 * provided "as is" without express or implied warranty.                   *
 **************************************************************************/

#include "AliHLTDataTypes.h"
#include "Rtypes.h"

struct AliHLTPHOSValidCellDataStruct
{
  //  AliHLTUInt16_t fRow;
  //  AliHLTUInt16_t fCol;

  //  AliHLTUInt16_t fZ;
  // AliHLTUInt16_t fX;

  //  AliHLTUInt16_t fGain;

  //  int fZ;
  //  int fX;

  //  Int_t fZ;
  //  Int_t fX;
  AliHLTUInt8_t fZ;
  AliHLTUInt8_t fX;

  //  AliHLTUInt16_t fGain;
  ///  int fGain;
  //  Int_t fGain;
  AliHLTUInt8_t fGain;

  Float_t fEnergy;
  Float_t fTime;
};

#endif

Change of types used for RcuX/Z coordinate.


#ifndef __DALI_ADAPTOR_DOC_H__
#define __DALI_ADAPTOR_DOC_H__

/**
 * @defgroup dali_adaptor DALi Adaptor
 *
 * @brief This module is a platform adaptation layer. It initializes and sets up DALi appropriately.
 * The module provides many platform-related services with its internal module,
 * platform abstraction. Several signals can be connected to it to keep you informed when
 * certain platform-related activities occur.
 *
 * @ingroup dali
 * @{
 *   @defgroup dali_adaptor_framework Adaptor Framework
 *   @brief Classes for the adaption layer.
 * @}
 */

#endif  /* __DALI_ADAPTOR_DOC_H__ */

#ifndef __DALI_ADAPTOR_DOC_H__
#define __DALI_ADAPTOR_DOC_H__

/*
 * Copyright (c) 2016 Samsung Electronics Co., Ltd.
 *
 * 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.
 *
 */

/**
 * @defgroup dali_adaptor DALi Adaptor
 *
 * @brief DALi Adaptor is a platform adaptation layer.
 *
 * It initializes and sets up DALi appropriately and
 * provides many platform-related services with its internal module,
 * platform abstraction. Several signals can be connected to it to keep you informed when
 * certain platform-related activities occur.
 *
 * @section dali_adaptor_overview Overview
 *
 * DALi Adaptor consists of the following groups of API:
 *
 *

 *

 *    API Group
 *    Description
 *

 *

 *    @ref dali_adaptor_framework
 *    Classes for the adaption layer.
 *

 *

 *
 * @ingroup dali
 * @{
 *   @defgroup dali_adaptor_framework Adaptor Framework
 *   @brief Classes for the adaption layer.
 * @}
 */

#endif  /* __DALI_ADAPTOR_DOC_H__ */

Update doxygen groups and overview description

- Update overview of DALi adaptor

Change-Id: Iede36ea40f2a8a85acf0fbe00ab886aaecdc0af0


/*
 * Copyright 2016-present Facebook, 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.
 */

#pragma once

// Bring in MAXPATHLEN so kerberos doesn't make up its
// own defintion of it.
#include <folly/portability/Stdlib.h>

#include <folly/portability/Windows.h>

#include <gssapi/gssapi_generic.h>
#include <gssapi/gssapi_krb5.h>
#include <krb5.h> // @manual

// Kerberos defines a bunch of things that we implement as actual
// functions, so undefine whatever mess kerberos has done.
#undef strcasecmp
#undef strncasecmp
#undef strdup
#undef strtok_r

Add a kerberos portability header

Add a kerberos portability header

Summary: Kerberos has issues with include order on Windows, so give it it's own portability header to force the correct include order and undefine the mess it `#define`'s.

Reviewed By: yfeldblum

Differential Revision: D8050238

fbshipit-source-id: 6c718f8f0db9f039734bead5f90cd289ea1dfd78


#pragma once

#include "scratch/bits/concurrency/condition-variable.h"
#include "scratch/bits/concurrency/mutex.h"
#include "scratch/bits/concurrency/unique-lock.h"

#include <utility>

namespace scratch {

class once_flag {
    static constexpr int UNDONE = 0;
    static constexpr int IN_PROGRESS = 1;
    static constexpr int DONE = 2;

    mutex m_mtx;
    condition_variable m_cv;
    int m_flag;
public:
    constexpr once_flag() noexcept : m_flag(UNDONE) {}

    template<class F, class... Args>
    void call_once(F&& f, Args&&... args)
    {
        unique_lock<mutex> lk(m_mtx);
        while (m_flag == IN_PROGRESS) {
            m_cv.wait(lk);
        }
        if (m_flag == UNDONE) {
            m_flag = IN_PROGRESS;
            lk.unlock();
            try {
                std::forward<F>(f)(std::forward<Args>(args)...);
            } catch (...) {
                lk.lock();
                m_flag = UNDONE;
                m_cv.notify_one();
                throw;
            }
            lk.lock();
            m_flag = DONE;
            m_cv.notify_all();
        }
    }
};

template<class F, class... Args>
void call_once(once_flag& flag, F&& f, Args&&... args)
{
    flag.call_once(std::forward<F>(f), std::forward<Args>(args)...);
}

} // namespace scratch

#pragma once

#include "scratch/bits/concurrency/linux-futex.h"

#include <atomic>
#include <utility>

namespace scratch {

class once_flag {
    static constexpr int UNDONE = 0;
    static constexpr int IN_PROGRESS = 1;
    static constexpr int DONE = 2;

    std::atomic<int> m_futex;
public:
    constexpr once_flag() noexcept : m_futex(UNDONE) {}

    template<class F, class... Args>
    void call_once(F&& f, Args&&... args)
    {
        int x = UNDONE;
        while (!m_futex.compare_exchange_weak(x, IN_PROGRESS)) {
            if (x == DONE) return;
            futex_wait(&m_futex, IN_PROGRESS);
            x = UNDONE;
        }
        try {
            std::forward<F>(f)(std::forward<Args>(args)...);
        } catch (...) {
            m_futex = UNDONE;
            futex_wake_one(&m_futex);
            throw;
        }
        m_futex = DONE;
        futex_wake_all(&m_futex);
    }
};

template<class F, class... Args>
void call_once(once_flag& flag, F&& f, Args&&... args)
{
    flag.call_once(std::forward<F>(f), std::forward<Args>(args)...);
}

} // namespace scratch

Reimplement `call_once` in terms of futex.


#ifndef WINDOW_H
#define WINDOW_H

#include <QWidget>
#include <QMainWindow>
#include <QDir>
#include <QLineEdit>
#include <QListWidget>
#include <QComboBox>
#include <QtSql>
#include <map>

class QLabel;
class QPushButton;

class SearchBox: public QLineEdit
{
    Q_OBJECT

public:
    using QLineEdit::QLineEdit;

private:
    void keyPressEvent(QKeyEvent *evt);

signals:
    void inputText(QString searchText);

private slots:
    void recipeFiterChanged(QString newFilter);
};

class Window : public QMainWindow
{
    Q_OBJECT

public:
    Window(QWidget *parent = 0);

private slots:
    void openFile(QListWidgetItem *recipe);
    void updateRecipesDiplay(QString searchText);

private:
    void resizeEvent(QResizeEvent *event);
    void createRecipeList();
    void updateDatabase();
    void cleanDatabase();

    QList<QListWidgetItem*> getRecipeList(QString searchText);
    QList<QListWidgetItem*> getAllRecipes();
    QList<QListWidgetItem*> getMatchingRecipes(QString searchText);
    std::map<double, QStringList> findMatches(QString text);

    QSqlDatabase db = QSqlDatabase::addDatabase("QSQLITE");

    QMenu *optionsMenu;
    QAction *updateDb;
    QAction *cleanDb;

    QWidget *centralWidget;
    SearchBox *searchBox;
    QDir currentDir;
    QListWidget *recipeList;
    QComboBox *recipeBox;
    QLabel *numResults;
    QWebEngineView *webView;
};

#endif

#ifndef WINDOW_H
#define WINDOW_H

#include <QWidget>
#include <QMainWindow>
#include <QDir>
#include <QLineEdit>
#include <QListWidget>
#include <QComboBox>
#include <QtSql>
#include <map>

class QLabel;
class QPushButton;

class SearchBox: public QLineEdit
{
    Q_OBJECT

public:
    using QLineEdit::QLineEdit;

private:
    void keyPressEvent(QKeyEvent *evt);

signals:
    void inputText(QString searchText);

private slots:
    void recipeFiterChanged(QString newFilter);
};

class Window : public QMainWindow
{
    Q_OBJECT

public:
    Window(QWidget *parent = 0);

private slots:
    void openFile(QListWidgetItem *recipe);
    void updateRecipesDiplay(QString searchText);

private:
    void resizeEvent(QResizeEvent *event);
    void createRecipeList();
    void updateDatabase();
    void cleanDatabase();

    QList<QListWidgetItem*> getRecipeList(QString searchText);
    QList<QListWidgetItem*> getAllRecipes();
    QList<QListWidgetItem*> getMatchingRecipes(QString searchText);
    std::map<double, QStringList> findMatches(QString text);

    QSqlDatabase db = QSqlDatabase::addDatabase("QSQLITE");

    QMenu *optionsMenu;
    QAction *updateDb;
    QAction *cleanDb;

    QWidget *centralWidget;
    SearchBox *searchBox;
    QDir currentDir;
    QListWidget *recipeList;
    QComboBox *recipeBox;
    QLabel *numResults;
};

#endif

Remove further references to QWebEngine

Remove further references to QWebEngine


/// \file syscalls-chario.c
/// \brief Sockpuppet API System Call functions for character IO
/// \defgroup SAPI Sockpuppet
//! \addtogroup SAPI
//! @{
///
//
// Copyright(C) 2011-2014 Robert Sexton
//
// Change History.
// API Version 0203.  Add a return code to StreamPutChar for back-pressure.
// Re-organize the code to make it less machine specific.
// More advanced implementations will need to support both
// UARTs and USB and/or networked comms, so this is an intermediate layer
#include <stdint.h>

/// __SAPI_02_PutChar
// The basic putchar, with backpressure.   The called function
// should return 0 if there is room for more, or -1 if the app should
// throttle the output.
void __SAPI_02_PutChar(uint32_t *frame) {
	if (frame[0] < 10 ) {
		putchar_uart(frame);
		}
	// Network ports go here.
	return;
	}

/// __SAPI_03_GetChar
/// Pull a character out of the stream of choice
/// This gets called when CharsAvail says there is work to do.
void __SAPI_03_GetChar(long *frame) {
	if (frame[0] < 10 ) {
		getchar_uart(frame);
		}
	// Network ports go here.
	return;
	}

/// __SAPI_04_CharsAvail
/// Check to see if there is a char available
void __SAPI_04_CharsAvail(long *frame) {
	if (frame[0] < 10 ) {
		chars_available_uart(frame);
		}
	// Network ports go here.
	return;
	}

Create a shim layer for platform-independent UARTs.


@import Foundation;
@import CoreGraphics;

@interface FORMFieldValidation : NSObject

@property (nonatomic, getter = isRequired) BOOL required;
@property (nonatomic) NSUInteger minimumLength;
@property (nonatomic) NSInteger maximumLength;
@property (nonatomic) NSString *format;
@property (nonatomic) CGFloat minimumValue;
@property (nonatomic) CGFloat maximumValue;

- (instancetype)initWithDictionary:(NSDictionary *)dictionary;

@end

@import Foundation;
@import CoreGraphics;

@interface FORMFieldValidation : NSObject

@property (nonatomic, getter = isRequired) BOOL required;
@property (nonatomic) NSUInteger minimumLength;
@property (nonatomic) NSInteger maximumLength;
@property (nonatomic) NSString *format;
@property (nonatomic) CGFloat minimumValue;
@property (nonatomic) CGFloat maximumValue;

- (instancetype)initWithDictionary:(NSDictionary *)dictionary NS_DESIGNATED_INITIALIZER;

@end

Add designated initializer macro to field validation


#pragma once

#include "FSMState.h"

#define END_STATE_TABLE {nullptr, 0, false} //!< Append this to the end of your state tables; the init function will recognize it and stop searching the table for states.

namespace ADBLib
{
	class FSMTransition
	{
	public:
		FSMState* currentState;	//!< The current state.
		int input;				//!< If this input is recieved and the FSM state is the currentState, transition.
		FSMState* nextState;	//!< The next state to transition to.
	};
}

#pragma once

#include "FSMState.h"

#define END_STATE_TABLE {nullptr, 0, nullptr} //!< Append this to the end of your state tables; the init function will recognize it and stop searching the table for states.

namespace ADBLib
{
	struct FSMTransition
	{
		FSMState* currentState;	//!< The current state.
		int input;				//!< If this input is received and the FSM state is the currentState, transition.
		FSMState* nextState;	//!< The next state to transition to.
	};
}

Fix END_STATE_TABLE define causing bool -> ptr conversion error


// RUN: touch %t.o
// RUN: %clang -### -target x86_64-apple-darwin10 -fobjc-link-runtime -mmacosx-version-min=10.7 %t.o 2>&1 | FileCheck -check-prefix=CHECK-ARCLITE-OSX %s
// RUN: %clang -### -target x86_64-apple-darwin10 -fobjc-link-runtime -mmacosx-version-min=10.8 %t.o 2>&1 | FileCheck -check-prefix=CHECK-NOARCLITE %s
// RUN: %clang -### -target i386-apple-darwin10 -fobjc-link-runtime -mmacosx-version-min=10.7 %t.o 2>&1 | FileCheck -check-prefix=CHECK-NOARCLITE %s

// CHECK-ARCLITE-OSX: libarclite_macosx.a
// CHECK-ARCLITE-OSX: -lobjc
// CHECK-NOARCLITE-NOT: libarclite

// RUN: touch %t.o
// RUN: %clang -### -target x86_64-apple-darwin10 -fobjc-link-runtime -mmacosx-version-min=10.7 %t.o 2>&1 | FileCheck -check-prefix=CHECK-ARCLITE-OSX %s
// RUN: %clang -### -target x86_64-apple-darwin10 -fobjc-link-runtime -mmacosx-version-min=10.8 %t.o 2>&1 | FileCheck -check-prefix=CHECK-NOARCLITE %s
// RUN: %clang -### -target i386-apple-darwin10 -fobjc-link-runtime -mmacosx-version-min=10.7 %t.o 2>&1 | FileCheck -check-prefix=CHECK-NOARCLITE %s

// CHECK-ARCLITE-OSX: libarclite_macosx.a
// CHECK-ARCLITE-OSX: -framework
// CHECK-ARCLITE-OSX: Foundation
// CHECK-ARCLITE-OSX: -lobjc
// CHECK-NOARCLITE-NOT: libarclite

Add a test for svn r155263.

Add a test for svn r155263.

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


#include "communication/server_stream.h"
#include "communication/stream.h"
#include "communication/stream_backend_interface.h"
#include "communication/stream_tcp.h"
#include "communication/stream_tcp_client.h"
#include "communication/stream_tcp_server.h"
#include "toolbar/print_variables.h"
#include "toolbar/sfgui.h"

#include "communication/server_stream.h"
#include "communication/status.h"
#include "communication/stream.h"
#include "communication/stream_backend_interface.h"
#include "communication/stream_tcp.h"
#include "communication/stream_tcp_client.h"
#include "communication/stream_tcp_server.h"
#include "toolbar/print_variables.h"
#include "toolbar/sfgui.h"

Add status.h among the included headers.


/*	$NetBSD: ieeefp.h,v 1.4 1998/01/09 08:03:43 perry Exp $	*/

/*
 * Written by J.T. Conklin, Apr 6, 1995
 * Public domain.
 */

#ifndef _IEEEFP_H_
#define _IEEEFP_H_

#include <sys/cdefs.h>
#include <machine/ieeefp.h>

#ifdef __i386__
#include <machine/floatingpoint.h>
#else /* !__i386__ */
extern fp_rnd    fpgetround __P((void));
extern fp_rnd    fpsetround __P((fp_rnd));
extern fp_except fpgetmask __P((void));
extern fp_except fpsetmask __P((fp_except));
extern fp_except fpgetsticky __P((void));
extern fp_except fpsetsticky __P((fp_except));
#endif /* __i386__ */

#endif /* _IEEEFP_H_ */

/*	$NetBSD: ieeefp.h,v 1.4 1998/01/09 08:03:43 perry Exp $	*/

/*
 * Written by J.T. Conklin, Apr 6, 1995
 * Public domain.
 */

#ifndef _IEEEFP_H_
#define _IEEEFP_H_

#include <sys/cdefs.h>
#include <machine/ieeefp.h>

#ifdef __i386__
#include <machine/floatingpoint.h>
#else /* !__i386__ */
__BEGIN_DECLS
extern fp_rnd    fpgetround __P((void));
extern fp_rnd    fpsetround __P((fp_rnd));
extern fp_except fpgetmask __P((void));
extern fp_except fpsetmask __P((fp_except));
extern fp_except fpgetsticky __P((void));
extern fp_except fpsetsticky __P((fp_except));
__END_DECLS
#endif /* __i386__ */

#endif /* _IEEEFP_H_ */

Allow fpsetmask(3) and friends to be used from a C++ program on the Alpha.

Reviewed by:	dfr


#pragma once

namespace rc {
namespace detail {

//! We don't want to require C++14 so we make our own version of this.
template<typename T, T ...Ints> struct IntSequence;

//! If T == std::size_t
template<std::size_t ...Ints>
using IndexSequence = IntSequence<std::size_t, Ints...>;

template<typename Sequence, std::size_t N>
struct MakeIntSequenceImpl;

template<typename IntT>
struct MakeIntSequenceImpl<IntSequence<IntT>, 0>
{
    typedef IntSequence<IntT> Sequence;
};

template<typename IntT, IntT ...Ints>
struct MakeIntSequenceImpl<IntSequence<IntT, 0, Ints...>, 0>
{
    typedef IntSequence<IntT, 0, Ints...> Sequence;
};

template<typename IntT, IntT ...Ints, std::size_t N>
struct MakeIntSequenceImpl<IntSequence<IntT, Ints...>, N>
{
    typedef typename MakeIntSequenceImpl<
        IntSequence<IntT, N - 1, Ints...>, N - 1>::Sequence Sequence;
};

//! Creates an `IntSequence` from 0 to N exclusive.
template<typename T, T N>
using MakeIntSequence =
    typename MakeIntSequenceImpl<IntSequence<T>, N>::Sequence;

//! Alias for MakeIntSequence<std::size_t, N>
template<std::size_t N>
using MakeIndexSequence = MakeIntSequence<std::size_t, N>;

} // namespace detail
} // namespace rc

Add integer sequence TMP utilities

Add integer sequence TMP utilities


#ifndef FTS_FILTER_PRIVATE_H
#define FTS_FILTER_PRIVATE_H

#define FTS_FILTER_CLASSES_NR 3

/*
 API that stemming providers (classes) must provide: The register()
 function is called when the class is registered via
 fts_filter_register() The create() function is called to get an
 instance of a registered filter class.  The destroy function is
 called to destroy an instance of a filter.

*/
struct fts_filter_vfuncs {
	int (*create)(const struct fts_language *lang,
	              const char *const *settings,
	              struct fts_filter **filter_r,
	              const char **error_r);
	int (*filter)(struct fts_filter *filter, const char **token,
		      const char **error_r);

	void (*destroy)(struct fts_filter *filter);
};

struct fts_filter {
	const char *class_name; /* name of the class this is based on */
	const struct fts_filter_vfuncs *v;
	int refcount;
	struct fts_filter *parent;
};

#endif

#ifndef FTS_FILTER_PRIVATE_H
#define FTS_FILTER_PRIVATE_H

#define FTS_FILTER_CLASSES_NR 3

/*
 API that stemming providers (classes) must provide: The create()
 function is called to get an instance of a registered filter class.
 The filter() function is called with tokens for the specific filter.
 The destroy function is called to destroy an instance of a filter.

*/
struct fts_filter_vfuncs {
	int (*create)(const struct fts_language *lang,
	              const char *const *settings,
	              struct fts_filter **filter_r,
	              const char **error_r);
	int (*filter)(struct fts_filter *filter, const char **token,
		      const char **error_r);

	void (*destroy)(struct fts_filter *filter);
};

struct fts_filter {
	const char *class_name; /* name of the class this is based on */
	const struct fts_filter_vfuncs *v;
	int refcount;
	struct fts_filter *parent;
};

#endif

Correct comment in filter internal API.

lib-fts: Correct comment in filter internal API.


/**
 */

#include "linkedlist.h"

/**
 * Create a new empty linked list.
 */
LinkedList* createList(void)
{
    LinkedList *list = (LinkedList *) malloc(sizeof(LinkedList));
    /*
     * If no error in allocating, initialise list contents.
     */
    if (list)
        list->head = NULL;

    return list;
}

/**
 * Delete an entire list.
 *
 * TODO: use double pointer to allow setting to NULL from inside?
 */
void deleteList(LinkedList *list)
{
    LinkedListNode *current, *next;
    current = list->head;
    next = current;
    while (next)
    {
        next = current->next;
        free(current);
        current = next;
    }
    free(list);
}

/**
 * Add an element to the start.
 *
 * Precondition: list is a valid pointer
 */
void insertStart(LinkedList *list, LinkedListData data)
{
    LinkedListNode *node = (LinkedListNode *) malloc(sizeof(LinkedListNode));
    /*
     * If no error, proceed to add node to list.
     */
    if (node)
    {
        node->data = data;
        node->next = list->head;
        list->head = node;
    }
}

/**
 * Delete an element at the start.
 *
 * Precondition: list is a valid pointer
 */
void removeStart(LinkedList *list)
{
    if (list->head)
    {
        LinkedListNode *node = list->head;
        list->head = node->next;
        free(node);
    }
}

/**
 */

#include "linkedlist.h"

/**
 * Create a new empty linked list.
 */
LinkedList* createList(void)
{
    LinkedList *list = (LinkedList *) malloc(sizeof(LinkedList));
    /*
     * If no error in allocating, initialise list contents.
     */
    if (list)
        list->head = NULL;

    return list;
}

/**
 * Delete an entire list.
 *
 * TODO: use double pointer to allow setting to NULL from inside?
 */
void deleteList(LinkedList *list)
{
    if (list != NULL)
    {
        LinkedListNode *current, *next;
        current = list->head;
        next = current;
        while (next)
        {
            next = current->next;
            free(current);
            current = next;
        }
        free(list);
    }
}

/**
 * Add an element to the start.
 *
 * Precondition: list is a valid pointer
 */
void insertStart(LinkedList *list, LinkedListData data)
{
    LinkedListNode *node = (LinkedListNode *) malloc(sizeof(LinkedListNode));
    /*
     * If no error, proceed to add node to list.
     */
    if (node)
    {
        node->data = data;
        node->next = list->head;
        list->head = node;
    }
}

/**
 * Delete an element at the start.
 *
 * Precondition: list is a valid pointer
 */
void removeStart(LinkedList *list)
{
    if (list->head)
    {
        LinkedListNode *node = list->head;
        list->head = node->next;
        free(node);
    }
}

Add check for null pointer in deleteList()


/*******************************************************************************
 * Copyright 2016 IBM Corp.
 *
 * 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 ibmras_common_common_h
#define ibmras_common_common_h

#include <sstream>
namespace ibmras {
namespace common {

template <class T>
std::string itoa(T t) {
#ifdef _WINDOWS
    return std::to_string(static_cast<long long>(t));
#else
	std::stringstream s;
	s << t;
	return s.str();
#endif

std::string ftoa(T t) {
#ifdef _WINDOWS
    return std::to_string(static_cast<long double>(t));
#else
	std::stringstream s;
	s << t;
	return s.str();
#endif
}

}
}

#endif /* ibmras_common_common_h */

/*******************************************************************************
 * Copyright 2016 IBM Corp.
 *
 * 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 ibmras_common_common_h
#define ibmras_common_common_h

#include <sstream>
namespace ibmras {
namespace common {

template <class T>
std::string itoa(T t) {
#ifdef _WINDOWS
    return std::to_string(static_cast<long long>(t));
#else
	std::stringstream s;
	s << t;
	return s.str();
#endif

template <class T>
std::string ftoa(T t) {
#ifdef _WINDOWS
    return std::to_string(static_cast<long double>(t));
#else
	std::stringstream s;
	s << t;
	return s.str();
#endif
}

}
}

#endif /* ibmras_common_common_h */

Make ftoa a template function

Make ftoa a template function


/*******************************************************************************
 * Copyright (C) 2010, Linaro Limited.
 *
 * This file is part of PowerDebug.
 *
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 *     Amit Arora <amit.arora@linaro.org> (IBM Corporation)
 *       - initial API and implementation
 *******************************************************************************/

#define VALUE_MAX 16

WINDOW windows[TOTAL_FEATURE_WINS];

#define PT_COLOR_DEFAULT    1
#define PT_COLOR_HEADER_BAR 2
#define PT_COLOR_ERROR      3
#define PT_COLOR_RED        4
#define PT_COLOR_YELLOW     5
#define PT_COLOR_GREEN      6
#define PT_COLOR_BRIGHT     7
#define PT_COLOR_BLUE       8

/*******************************************************************************
 * Copyright (C) 2010, Linaro Limited.
 *
 * This file is part of PowerDebug.
 *
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 *     Amit Arora <amit.arora@linaro.org> (IBM Corporation)
 *       - initial API and implementation
 *******************************************************************************/

#define PT_COLOR_DEFAULT    1
#define PT_COLOR_HEADER_BAR 2
#define PT_COLOR_ERROR      3
#define PT_COLOR_RED        4
#define PT_COLOR_YELLOW     5
#define PT_COLOR_GREEN      6
#define PT_COLOR_BRIGHT     7
#define PT_COLOR_BLUE       8

Remove unused variables and definitions

Remove unused variables and definitions

Signed-off-by: Daniel Lezcano <e9fa45941f2ebe89c1b9d6c5f339ab42eadb8567@free.fr>
Signed-off-by: Amit Kucheria <f352f8f7e4567da77f569289775ad284524dea88@linaro.org>


// Copyright (c) 2010 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 CHROME_BROWSER_AUTOFILL_AUTOFILL_DIALOG_H_
#define CHROME_BROWSER_AUTOFILL_AUTOFILL_DIALOG_H_

#include <vector>

#include "chrome/browser/autofill/autofill_profile.h"

// Shows the AutoFill dialog, which allows the user to edit profile information.
// |profiles| is a vector of autofill profiles that contains the current profile
// information.  The dialog fills out the profile fields using this data.  Any
// changes made to the profile information through the dialog should be
// transferred back into |profiles|.
void ShowAutoFillDialog(const std::vector<AutoFillProfile>& profiles);

#endif  // CHROME_BROWSER_AUTOFILL_AUTOFILL_DIALOG_H_

Add the AutoFillDialog header, needed by the cross-platform implementations to implement the autofill dialog.

BUG=none
TEST=none
Review URL: http://codereview.chromium.org/549014

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


// Copyright eeGeo Ltd (2012-2015), All Rights Reserved

#pragma once

#include <string>

namespace ExampleApp
{
    //! defines a path to the app config file, which is used to provide the EegeoApiKey and other credentials
    static const std::string ApplicationConfigurationPath = "ApplicationConfigs/standard_config.json";

    //! REQUIRED: You must obtain an API key for the eeGeo SDK from https://www.eegeo.com/developers/ and set is as the value of "EegeoApiKey" in the config file

    //! Optional: If 'useYelp' is true in AppHost you may wish to obtain a Yelp API key from https://www.yelp.com/developers for POI search provision.
    //! If so, set credentials using the following keys in the app config file:
    //! YelpConsumerKey
    //! YelpConsumerSecret
    //! YelpOAuthToken
    //! YelpOAuthTokenSecret
    //! Optional: You may wish to obtain a geonames account key from http://www.geonames.org/export/web-services.html for address/place search provision.
    //! Set it as the value of 'GeoNamesUserName' in the app config file:

    //! Optional: You may wish to obtain an API key for Flurry from https://developer.yahoo.com/analytics/ for metrics.
    //! Set it as the value of 'FlurryApiKey' in the app config file:
}

// Copyright eeGeo Ltd (2012-2015), All Rights Reserved

#pragma once

#include <string>

namespace ExampleApp
{
    //! defines a path to the app config file, which is used to provide the EegeoApiKey and other credentials
    static const std::string ApplicationConfigurationPath = "ApplicationConfigs/standard_config.json";

    //! REQUIRED: You must obtain an API key for the WRLD SDK from https://www.wrld3d.com/developers and set it as the value of "EegeoApiKey" in the config file: "ApplicationConfigs/standard_config.json"
    //! Optional: If 'useYelp' is true in AppHost you may wish to obtain a Yelp API key from https://www.yelp.com/developers for POI search provision.
    //! If so, set credentials using the following keys in the app config file:
    //! YelpConsumerKey
    //! YelpConsumerSecret
    //! YelpOAuthToken
    //! YelpOAuthTokenSecret
    //! Optional: You may wish to obtain a geonames account key from http://www.geonames.org/export/web-services.html for address/place search provision.
    //! Set it as the value of 'GeoNamesUserName' in the app config file:

    //! Optional: You may wish to obtain an API key for Flurry from https://developer.yahoo.com/analytics/ for metrics.
    //! Set it as the value of 'FlurryApiKey' in the app config file:
}

Fix for MPLY-10449 Corrected the message to what the bug report suggests. Buddy: Michael O


#include "riot_arduino_uno.h"
#include "utils.h"

riot_arduino_uno_sinks* riot_arduino_uno_sinks_create() {
  riot_arduino_uno_sinks *sinks = xmalloc(sizeof(riot_arduino_uno_sinks));
  return sinks;
}

riot_arduino_uno_sources* riot_arduino_uno_sources_create() {
  riot_arduino_uno_sources *sources = xmalloc(sizeof(riot_arduino_uno_sources));
  return sources;
};

int riot_arduino_uno_run(riot_arduino_uno_main main) {
  if(main == NULL) {
    return -1;
  }
  riot_arduino_uno_sources *sources = riot_arduino_uno_sources_create();
  if(sources == NULL) {
    return -2;
  }
  riot_arduino_uno_sinks *sinks = main(sources);
  if(sinks == NULL) {
    return -3;
  }
  while(true) {
    // TODO: Read all inputs and map to sources
    // TODO: If all sinks/outputs have completed, break
  }
  return 0;
}

#include "riot_arduino_uno.h"
#include "utils.h"
#include<stdbool.h>

riot_arduino_uno_sinks* riot_arduino_uno_sinks_create() {
  riot_arduino_uno_sinks *sinks = xmalloc(sizeof(riot_arduino_uno_sinks));
  return sinks;
}

riot_arduino_uno_sources* riot_arduino_uno_sources_create() {
  riot_arduino_uno_sources *sources = xmalloc(sizeof(riot_arduino_uno_sources));
  return sources;
};

void riot_arduino_uno_map_sinks_to_write_outputs(riot_arduino_uno_sinks *sinks) {
  // TODO: Map sinks to write outputs
}

void riot_arduino_uno_read_inputs(riot_arduino_uno_sources *sources) {
  // TODO: Read all inputs and map to sources
}

bool riot_arduino_uno_is_sinks_empty(riot_arduino_uno_sinks *sinks) {
  // TODO: Return true if no streams are present in sink, ie no output is required.
}

int riot_arduino_uno_run(riot_arduino_uno_main main) {
  if(main == NULL) {
    return -1;
  }
  riot_arduino_uno_sources *sources = riot_arduino_uno_sources_create();
  if(sources == NULL) {
    return -2;
  }
  riot_arduino_uno_sinks *sinks = main(sources);
  if(sinks == NULL) {
    return -3;
  }
  riot_arduino_uno_map_sinks_to_write_outputs(sinks);
  while (true) {
    riot_arduino_uno_read_inputs(sources);
    if(riot_arduino_uno_is_sinks_empty(sinks))
      break;
  }
  return 0;
}

Add function declarations, usages and TODOs


// RUN: %clang_cc1 -emit-llvm -o - -O0 -triple x86_64-apple-darwin10 %s | FileCheck %s

// Ensure that we don't emit available_externally functions at -O0.
int x;

inline void f0(int y) { x = y; }

// CHECK: define void @test()
// CHECK: declare void @f0(i32)
void test() {
  f0(17);
}

inline int __attribute__((always_inline)) f1(int x) {
  int blarg = 0;
  for (int i = 0; i < x; ++i)
    blarg = blarg + x * i;
  return blarg;
}

int test1(int x) {
  // CHECK: br i1
  // CHECK-NOT: call
  // CHECK: ret i32
  return f1(x);
}

// RUN: %clang_cc1 -emit-llvm -o - -O0 -triple x86_64-apple-darwin10 %s | FileCheck %s

// Ensure that we don't emit available_externally functions at -O0.
int x;

inline void f0(int y) { x = y; }

// CHECK: define void @test()
// CHECK: declare void @f0(i32)
void test() {
  f0(17);
}

inline int __attribute__((always_inline)) f1(int x) {
  int blarg = 0;
  for (int i = 0; i < x; ++i)
    blarg = blarg + x * i;
  return blarg;
}

// CHECK: @test1
int test1(int x) {
  // CHECK: br i1
  // CHECK-NOT: call
  // CHECK: ret i32
  return f1(x);
}

Improve test case. Thanks Eli

Improve test case. Thanks Eli

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


/*
 * Copyright 2013 Mo McRoberts.
 *
 *  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 P_LIBERRNO_H_
# define P_LIBERRNO_H_                 1

# include <ux/cdefs.h>

# include "errno.h"
# undef errno

int *errno_ux2003(void) UX_SYM03_(errno) UX_WEAK_;
int *errno_global_ux2003(void) UX_SYM03_(errno_global_);

#endif /*!P_LIBERRNO_H_*/

/*
 * Copyright 2013 Mo McRoberts.
 *
 *  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 P_LIBERRNO_H_
# define P_LIBERRNO_H_                 1

# include <ux/cdefs.h>

# include "errno.h"
# undef errno

int *errno_ux2003(void) UX_SYM03_(errno) UX_WEAK_;
int *errno_global_ux2003(void) UX_PRIVATE_(errno_global);

#endif /*!P_LIBERRNO_H_*/

Mark errno_global as a private symbol.

Mark errno_global as a private symbol.


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

int myglobal;
pthread_mutex_t mutex1 = PTHREAD_MUTEX_INITIALIZER;
pthread_mutex_t mutex2 = PTHREAD_MUTEX_INITIALIZER;

void *t_fun(void *arg) {
  pthread_mutex_lock(&mutex1);
  myglobal=myglobal+1; // RACE!
  pthread_mutex_unlock(&mutex1);
  return NULL;
}

int main(void) {
  pthread_t id;
  pthread_create(&id, NULL, t_fun, NULL, NULL); // strange pthread_create, should be treated as unknown and spawn (instead of unsoundly bailing)
  pthread_mutex_lock(&mutex2);
  myglobal=myglobal+1; // RACE!
  pthread_mutex_unlock(&mutex2);
  pthread_join (id, NULL);
  return 0;
}

Add test where bailure is unsound

Add test where bailure is unsound


/* Copyright (c) 2013-2014 Jeffrey Pfau
 *
 * 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/. */
#include "util/memory.h"

void* anonymousMemoryMap(size_t size) {
	return malloc(size);
}

void mappedMemoryFree(void* memory, size_t size) {
	free(memory);
}

/* Copyright (c) 2013-2014 Jeffrey Pfau
 *
 * 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/. */
#include "util/memory.h"

#include <3ds.h>

void* anonymousMemoryMap(size_t size) {
	return linearAlloc(size);
}

void mappedMemoryFree(void* memory, size_t size) {
	UNUSED(size);
	linearFree(memory);
}

Use linearAlloc instead of malloc

3DS: Use linearAlloc instead of malloc


/* $FreeBSD$ */
/* From: NetBSD: ieeefp.h,v 1.2 1997/04/06 08:47:28 cgd Exp */

/*
 * Written by J.T. Conklin, Apr 28, 1995
 * Public domain.
 */

#ifndef _ALPHA_IEEEFP_H_
#define _ALPHA_IEEEFP_H_

typedef int fp_except;
#define	FP_X_INV	(1LL << 1)	/* invalid operation exception */
#define	FP_X_DZ		(1LL << 2)	/* divide-by-zero exception */
#define	FP_X_OFL	(1LL << 3)	/* overflow exception */
#define	FP_X_UFL	(1LL << 4)	/* underflow exception */
#define	FP_X_IMP	(1LL << 5)	/* imprecise(inexact) exception */
#if 0
#define	FP_X_IOV	(1LL << 6)	/* integer overflow XXX? */
#endif

typedef enum {
    FP_RZ=0,			/* round to zero (truncate) */
    FP_RM=1,			/* round toward negative infinity */
    FP_RN=2,			/* round to nearest representable number */
    FP_RP=3			/* round toward positive infinity */
} fp_rnd;

#endif /* _ALPHA_IEEEFP_H_ */

/* $FreeBSD$ */
/* From: NetBSD: ieeefp.h,v 1.2 1997/04/06 08:47:28 cgd Exp */

/*
 * Written by J.T. Conklin, Apr 28, 1995
 * Public domain.
 */

#ifndef _ALPHA_IEEEFP_H_
#define _ALPHA_IEEEFP_H_

typedef int fp_except_t;
#define	FP_X_INV	(1LL << 1)	/* invalid operation exception */
#define	FP_X_DZ		(1LL << 2)	/* divide-by-zero exception */
#define	FP_X_OFL	(1LL << 3)	/* overflow exception */
#define	FP_X_UFL	(1LL << 4)	/* underflow exception */
#define	FP_X_IMP	(1LL << 5)	/* imprecise(inexact) exception */
#if 0
#define	FP_X_IOV	(1LL << 6)	/* integer overflow XXX? */
#endif

typedef enum {
    FP_RZ=0,			/* round to zero (truncate) */
    FP_RM=1,			/* round toward negative infinity */
    FP_RN=2,			/* round to nearest representable number */
    FP_RP=3			/* round toward positive infinity */
} fp_rnd;

#endif /* _ALPHA_IEEEFP_H_ */

Change floating point exception type to match the i386 one.

Submitted by:	Mark Abene <phiber@radicalmedia.com>


/*
 *
 *  BlueZ - Bluetooth protocol stack for Linux
 *
 *  Copyright (C) 2014  Intel Corporation. All rights reserved.
 *
 *
 *  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.
 *
 */

#include <stdlib.h>

#include "timeout.h"

#include "monitor/mainloop.h"

struct timeout_data {
	int id;
	timeout_func_t func;
	timeout_destroy_func_t destroy;
	unsigned int timeout;
	void *user_data;
};

static void timeout_callback(int id, void *user_data)
{
	struct timeout_data *data = user_data;

	if (data->func(data->user_data) &&
		!mainloop_modify_timeout(data->id, data->timeout))
		return;

	mainloop_remove_timeout(data->id);
}

static void timeout_destroy(void *user_data)
{
	struct timeout_data *data = user_data;

	if (data->destroy)
		data->destroy(data->user_data);

	free(data);
}

int timeout_add(unsigned int t, timeout_func_t func, void *user_data,
						timeout_destroy_func_t destroy)
{
	struct timeout_data *data = malloc(sizeof(*data));

	data->func = func;
	data->user_data = user_data;
	data->timeout = t;

	data->id = mainloop_add_timeout(t, timeout_callback, data,
							timeout_destroy);
	if (!data->id) {
		free(data);
		return 0;
	}

	return data->id;
}

void timeout_remove(unsigned int id)
{
	if (id)
		mainloop_remove_timeout(id);
}

shared: Add timeout handling with mainloop support


/**
 * @file
 *
 * @date 17.03.2017
 * @author Anton Bondarev
 */

#ifndef STM32F7CUBE_ETH_H_
#define STM32F7CUBE_ETH_H_

#include <stm32f7xx_hal_conf.h>
#include <stm32f7xx.h>
#include <stm32f7xx_hal.h>
#include <stm32f7xx_hal_eth.h>

#define PHY_ADDRESS       0x00

#endif /* STM32F7CUBE_ETH_H_ */

/**
 * @file
 *
 * @date 17.03.2017
 * @author Anton Bondarev
 */

#ifndef STM32F7CUBE_ETH_H_
#define STM32F7CUBE_ETH_H_

#include <stm32f7xx_hal.h>

#define PHY_ADDRESS       0x00

#endif /* STM32F7CUBE_ETH_H_ */

Build fix eth for stm32 f7

drivers: Build fix eth for stm32 f7


#include <openssl/conf.h>
#include <openssl/bio.h>
#include <openssl/evp.h>
#include "shared.h"

int un_base64
(char *in, char **out, int **len)
{
	BIO *bio, *b64;

}
bool saltystring_is_salty (

Remove forgotten broken line of code lel


Add another test for pretty printing if-then-else

Ignore-this: c0cab673ec9d716deb4154ae5599ed74

darcs-hash:20100720212917-c1f02-512056f55df6186193f854d96821b4a589d19d04


//
// Toolkit header to include the main headers of the 'AFToolkit' library.
//

#import "AFDefines.h"
#import "AFLogHelper.h"
#import "AFFileHelper.h"
#import "AFPlatformHelper.h"
#import "AFReachability.h"
#import "AFKVO.h"
#import "AFArray.h"
#import "AFMutableArray.h"
#import "NSBundle+Universal.h"
#import "UITableViewCell+Universal.h"
#import "AFDBClient.h"
#import "AFView.h"
#import "AFViewController.h"

//
// Toolkit header to include the main headers of the 'AFToolkit' library.
//

#import "AFDefines.h"
#import "AFLogHelper.h"
#import "AFFileHelper.h"
#import "AFPlatformHelper.h"
#import "AFReachability.h"
#import "AFKVO.h"
#import "AFArray.h"
#import "AFMutableArray.h"
#import "NSBundle+Universal.h"
#import "UITableViewCell+Universal.h"
#import "UIView+Render.h"
#import "AFDBClient.h"
#import "AFView.h"
#import "AFViewController.h"

Add UIView+Render header to toolkit include.


/**
 * Copyright (c) 2016-present, Facebook, 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 CAFFE2_UTILS_PTHREADPOOL_IMPL_H_
#define CAFFE2_UTILS_PTHREADPOOL_IMPL_H_

#include "ThreadPoolCommon.h"

#ifndef CAFFE2_THREADPOOL_MOBILE
#error "mobile build state not defined"
#endif

#if CAFFE2_THREADPOOL_MOBILE

namespace caffe2 {

struct ThreadPool;

} // namespace caffe2

extern "C" {

// Wrapper for the caffe2 threadpool for the usage of NNPACK
struct pthreadpool {
  pthreadpool(caffe2::ThreadPool* pool) : pool_(pool) {}
  caffe2::ThreadPool* pool_;
};

} // extern "C"

#endif // CAFFE2_THREADPOOL_MOBILE

#endif  // CAFFE2_UTILS_PTHREADPOOL_IMPL_H_

/**
 * Copyright (c) 2016-present, Facebook, 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 CAFFE2_UTILS_PTHREADPOOL_IMPL_H_
#define CAFFE2_UTILS_PTHREADPOOL_IMPL_H_

#include "ThreadPoolCommon.h"

#ifndef CAFFE2_THREADPOOL_MOBILE
#error "mobile build state not defined"
#endif

#if CAFFE2_THREADPOOL_MOBILE

namespace caffe2 {

class ThreadPool;

} // namespace caffe2

extern "C" {

// Wrapper for the caffe2 threadpool for the usage of NNPACK
struct pthreadpool {
  pthreadpool(caffe2::ThreadPool* pool) : pool_(pool) {}
  caffe2::ThreadPool* pool_;
};

} // extern "C"

#endif // CAFFE2_THREADPOOL_MOBILE

#endif  // CAFFE2_UTILS_PTHREADPOOL_IMPL_H_

Fix ThreadPool class/struct forward declaration mixup

Summary: `ThreadPool` is a class, but it is forward-declared as a struct, which produces an error when compiled with clang 5.

Reviewed By: Maratyszcza

Differential Revision: D6399594

fbshipit-source-id: e8e81006f484b38e60389c659e9500ec9cfab731


/*************************************************************************
> File Name: SoundManager.h
> Project Name: Hearthstone++
> Author: Chan-Ho Chris Ohk
> Purpose: Sound manager of Hearthstone++ GUI program.
> Created Time: 2018/06/05
> Copyright (c) 2018, Chan-Ho Chris Ohk
*************************************************************************/
#ifndef HEARTHSTONEPP_GUI_SOUND_MANAGER_H
#define HEARTHSTONEPP_GUI_SOUND_MANAGER_H

#include <SFML/Audio/Music.hpp>

#include <optional>

namespace Hearthstonepp
{
class SoundManager
{
 public:
    SoundManager(const SoundManager& other) = delete;
    ~SoundManager() = delete;

    static SoundManager* GetInstance();

    //! Play Music.
    void PlayMusic(const char* musicFileName, bool isForceToPlay = false);

    //! Stop Music.
    void StopMusic();

    //! Returns whether the music is playing.
    bool IsMusicPlaying() const;

    //! Returns the name of the currently playing music.
    std::string GetPlayingMusicName() const;

 private:
    SoundManager() = default;

    static SoundManager* m_instance;

    sf::Music m_music;
    std::string m_musicName;
};
}

#endif

/*************************************************************************
> File Name: SoundManager.h
> Project Name: Hearthstone++
> Author: Chan-Ho Chris Ohk
> Purpose: Sound manager of Hearthstone++ GUI program.
> Created Time: 2018/06/05
> Copyright (c) 2018, Chan-Ho Chris Ohk
*************************************************************************/
#ifndef HEARTHSTONEPP_GUI_SOUND_MANAGER_H
#define HEARTHSTONEPP_GUI_SOUND_MANAGER_H

#include <SFML/Audio/Music.hpp>

namespace Hearthstonepp
{
class SoundManager
{
 public:
    SoundManager(const SoundManager& other) = delete;
    ~SoundManager() = delete;

    static SoundManager* GetInstance();

    //! Play Music.
    void PlayMusic(const char* musicFileName, bool isForceToPlay = false);

    //! Stop Music.
    void StopMusic();

    //! Returns whether the music is playing.
    bool IsMusicPlaying() const;

    //! Returns the name of the currently playing music.
    std::string GetPlayingMusicName() const;

 private:
    SoundManager() = default;

    static SoundManager* m_instance;

    sf::Music m_music;
    std::string m_musicName;
};
}

#endif

Fix compile error on MacOS (unsupported <optional>)


// RUN: %llvmgcc -c -emit-llvm %s -o - | llvm-dis | grep llvm.ptr.annotation | count 3

#include <stdio.h>

/* Struct with element X being annotated */
struct foo {
    int X  __attribute__((annotate("StructAnnotation")));
    int Y;
    int Z;
};

void test(struct foo *F) {
    F->X = 42;
    F->Z = 1;
    F->Y = F->X;
}

Add test case for ptr annotation.

Add test case for ptr annotation.

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


// extracted from 01/22
#include <assert.h>

int main() {
  int a = 1;
  int b = 1;
  int *x;
  int rnd;

  if (rnd)
    x = &a;
  else
    x = &b;

  assert(*x == 1);
  b = 2;

  assert(a == 1);
  if (*x != 0) { // TODO: invariant makes less precise!
    assert(a == 1); // TODO
  }
  return 0;
}

Add test where base invariant worsens precision


//
//  main.c
//  v6502
//
//  Created by Daniel Loffgren on H.25/03/28.
//  Copyright (c) 平成25年 Hello-Channel, LLC. All rights reserved.
//

#include <stdio.h>
#include "cpu.h"
#include "mem.h"

int main(int argc, const char * argv[])
{
	printf("Allocating virtual memory of size 2k…\n");

    return 0;
}

//
//  main.c
//  v6502
//
//  Created by Daniel Loffgren on H.25/03/28.
//  Copyright (c) 平成25年 Hello-Channel, LLC. All rights reserved.
//

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

#include "cpu.h"
#include "mem.h"
#include "core.h"

int main(int argc, const char * argv[])
{
	printf("Creating 1 virtual CPU…\n");
	v6502_cpu *cpu = v6502_createCPU();

	printf("Allocating virtual memory of size 2k…\n");
	cpu->memory = v6502_createMemory(2048);

	char command[10];
	for (;;) {
		printf("] ");
		scanf("%s", command);

		if (!strncmp(command, "!", 2)) {
			v6502_printCpuState(cpu);
		}
	}

    return 0;
}

Create a CPU and start REPLing

Create a CPU and start REPLing

git-svn-id: dd14d189f2554b0b3f4c2209a95c13d2029e3fe8@6 96dfbd92-d197-e211-9ca9-00110a534b34


/* Copyright 2016 Vanderbilt University

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

/** \file
* Autogenerated public API
*/

#ifndef ACCRE_GOP_HP_PRIVATE_H_INCLUDED
#define ACCRE_GOP_HP_PRIVATE_H_INCLUDED

#include <apr_time.h>
#include <gop/visibility.h>
#include <gop/types.h>

#ifdef __cplusplus
extern "C" {
#endif

int gop_op_sync_exec_enabled(gop_op_generic_t *gop);
void gop_op_sync_exec(gop_op_generic_t *gop);
void gop_op_submit(gop_op_generic_t *gop);

#ifdef __cplusplus
}
#endif

#endif /* ^ ACCRE_GOP_HP_PRIVATE_H_INCLUDED ^ */

Add missing internal Hportal header

Add missing internal Hportal header


#define BLACK   0x000000
#define GREEN   0x001000
#define BLUE    0x000010
#define CYAN    0x001010
#define RED     0x100000
#define ORANGE  0x100800
#define YELLOW  0x101000
#define PURPLE  0x100010
#define WHITE   0x101010

#define BOOT_RUNNING BLUE
#define MAIN_RUNNING GREEN
#define SAFE_MODE    YELLOW
#define ALL_DONE     GREEN
#define REPL_RUNNING WHITE

#define ACTIVE_WRITE 0x200000

#define ALL_GOOD_CYCLE_MS 2000u

#define LINE_NUMBER_TOGGLE_LENGTH 300u
#define EXCEPTION_TYPE_LENGTH_MS 1000u

#define THOUSANDS WHITE
#define HUNDREDS  BLUE
#define TENS      YELLOW
#define ONES      CYAN

#define INDENTATION_ERROR GREEN
#define SYNTAX_ERROR      CYAN
#define NAME_ERROR        WHITE
#define OS_ERROR          ORANGE
#define VALUE_ERROR       PURPLE
#define OTHER_ERROR       YELLOW

#define BLACK   0x000000
#define GREEN   0x003000
#define BLUE    0x000030
#define CYAN    0x003030
#define RED     0x300000
#define ORANGE  0x302000
#define YELLOW  0x303000
#define PURPLE  0x300030
#define WHITE   0x303030

#define BOOT_RUNNING BLUE
#define MAIN_RUNNING GREEN
#define SAFE_MODE    YELLOW
#define ALL_DONE     GREEN
#define REPL_RUNNING WHITE

#define ACTIVE_WRITE 0x200000

#define ALL_GOOD_CYCLE_MS 2000u

#define LINE_NUMBER_TOGGLE_LENGTH 300u
#define EXCEPTION_TYPE_LENGTH_MS 1000u

#define THOUSANDS WHITE
#define HUNDREDS  BLUE
#define TENS      YELLOW
#define ONES      CYAN

#define INDENTATION_ERROR GREEN
#define SYNTAX_ERROR      CYAN
#define NAME_ERROR        WHITE
#define OS_ERROR          ORANGE
#define VALUE_ERROR       PURPLE
#define OTHER_ERROR       YELLOW

Increase the status LED brightness a bit so that newer DotStars aren't super dim. This will make status NeoPixels a bit bright but one can use samd.set_rgb_status_brightness() to dim them.


#pragma once

#include <vector>
#include <boost/multiprecision/cpp_int.hpp>

namespace dev
{
namespace eth
{
namespace jit
{

using byte = uint8_t;
using bytes = std::vector<byte>;
using u256 = boost::multiprecision::uint256_t;
using bigint = boost::multiprecision::cpp_int;

struct NoteChannel {};	// FIXME: Use some log library?

enum class ReturnCode
{
	Stop = 0,
	Return = 1,
	Suicide = 2,

	BadJumpDestination = 101,
	OutOfGas = 102,
	StackTooSmall = 103,
	BadInstruction = 104,

	LLVMConfigError = 201,
	LLVMCompileError = 202,
	LLVMLinkError = 203,
};

/// Representation of 256-bit value binary compatible with LLVM i256
// TODO: Replace with h256
struct i256
{
	uint64_t a;
	uint64_t b;
	uint64_t c;
	uint64_t d;
};
static_assert(sizeof(i256) == 32, "Wrong i265 size");

#define UNTESTED assert(false)

}
}
}

#pragma once

#include <vector>
#include <boost/multiprecision/cpp_int.hpp>

namespace dev
{
namespace eth
{
namespace jit
{

using byte = uint8_t;
using bytes = std::vector<byte>;
using u256 = boost::multiprecision::uint256_t;
using bigint = boost::multiprecision::cpp_int;

struct NoteChannel {};	// FIXME: Use some log library?

enum class ReturnCode
{
	Stop = 0,
	Return = 1,
	Suicide = 2,

	BadJumpDestination = 101,
	OutOfGas = 102,
	StackTooSmall = 103,
	BadInstruction = 104,

	LLVMConfigError = 201,
	LLVMCompileError = 202,
	LLVMLinkError = 203,
};

/// Representation of 256-bit value binary compatible with LLVM i256
// TODO: Replace with h256
struct i256
{
	uint64_t a = 0;
	uint64_t b = 0;
	uint64_t c = 0;
	uint64_t d = 0;
};
static_assert(sizeof(i256) == 32, "Wrong i265 size");

#define UNTESTED assert(false)

}
}
}

Fix some GCC initialization warnings

Fix some GCC initialization warnings


/* SPDX-License-Identifier: BSD-2-Clause */

#pragma once

#include <tilck/kernel/paging.h>
#include <tilck/kernel/hal.h>

size_t stackwalk32(void **frames, size_t count,
                   void *ebp, pdir_t *pdir);

void dump_stacktrace(void);
void dump_regs(regs *r);

void validate_stack_pointer_int(const char *file, int line);

#ifdef DEBUG
#  define DEBUG_VALIDATE_STACK_PTR() validate_stack_pointer_int(__FILE__, \
                                                                __LINE__)
#else
#  define DEBUG_VALIDATE_STACK_PTR()
#endif

void debug_qemu_turn_off_machine(void);
void register_debug_kernel_keypress_handler(void);
void init_extra_debug_features();
void set_sched_alive_thread_enabled(bool enabled);

/* SPDX-License-Identifier: BSD-2-Clause */

#pragma once

#include <tilck/kernel/paging.h>
#include <tilck/kernel/hal.h>

size_t stackwalk32(void **frames, size_t count,
                   void *ebp, pdir_t *pdir);

void dump_stacktrace(void);
void dump_regs(regs *r);

void validate_stack_pointer_int(const char *file, int line);

#if defined(DEBUG) && !defined(UNIT_TEST_ENVIRONMENT)
#  define DEBUG_VALIDATE_STACK_PTR() validate_stack_pointer_int(__FILE__, \
                                                                __LINE__)
#else
#  define DEBUG_VALIDATE_STACK_PTR()
#endif

void debug_qemu_turn_off_machine(void);
void register_debug_kernel_keypress_handler(void);
void init_extra_debug_features();
void set_sched_alive_thread_enabled(bool enabled);

[debug] Make DEBUG_VALIDATE_STACK_PTR() a no-op in unit tests


#include <stdlib.h>
#ifndef __LIST_H__
#define __LIST_H__
struct ListNode;
struct List;
typedef struct ListNode ListNode;
typedef struct List List;

List* List_Create(void);
void List_Destroy(List* l);
ListNode* ListNode_Create(void *);
void ListNode_Destroy(ListNode* n);
ListNode* List_Search(List* l, void* k, int (f)(void*, void*));
void List_Insert(List* l, ListNode* n);
void List_Delete(List* l, ListNode* n);
#endif

#include <stdlib.h>
#ifndef __LIST_H__
#define __LIST_H__
struct ListNode;
struct List;
typedef struct ListNode ListNode;
typedef struct List List;

List* List_Create(void);
void List_Destroy(List* l);
ListNode* ListNode_Create(void * k);
void ListNode_Destroy(ListNode* n);
ListNode* List_Search(List* l, void* k, int (f)(void*, void*));
void List_Insert(List* l, ListNode* n);
void List_Delete(List* l, ListNode* n);
#endif

Add missing parameter variable name 'k'

Add missing parameter variable name 'k'


#include <sys/prctl.h>
#include <linux/seccomp.h>

int
main(void)
{

	prctl(PR_SET_SECCOMP, SECCOMP_MODE_FILTER, 0);
	return(EFAULT == errno ? 0 : 1);
}

Add thusfar-unused Linux seccomp filter test.


#define ACPI_MACHINE_WIDTH 64
#define ACPI_SINGLE_THREADED
#define ACPI_USE_LOCAL_CACHE
#define ACPI_INLINE inline
#define ACPI_USE_NATIVE_DIVIDE

#define DEBUGGER_THREADING DEBUGGER_SINGLE_THREADED

#ifdef ACPI_FULL_DEBUG
#define ACPI_DEBUG_OUTPUT
#define ACPI_DISASSEMBLER

// Depends on threading support
#define ACPI_DEBUGGER
#define ACPI_DBG_TRACK_ALLOCATIONS

#define ACPI_GET_FUNCTION_NAME __FUNCTION__
#else
#define ACPI_GET_FUNCTION_NAME ""
#endif

#define ACPI_PHYS_BASE 0x100000000

#include <stdint.h>
#include <stdarg.h>
#define AcpiOsPrintf printf
#define AcpiOsVprintf vprintf

struct acpi_table_facs;
uint32_t AcpiOsReleaseGlobalLock(struct acpi_table_facs* facs);
uint32_t AcpiOsAcquireGlobalLock(struct acpi_table_facs* facs);

#define ACPI_ACQUIRE_GLOBAL_LOCK(GLptr, Acquired) Acquired = AcpiOsAcquireGlobalLock(GLptr)
#define ACPI_RELEASE_GLOBAL_LOCK(GLptr, Pending) Pending = AcpiOsReleaseGlobalLock(GLptr)

#define ACPI_MACHINE_WIDTH 64
#define ACPI_SINGLE_THREADED
#define ACPI_USE_LOCAL_CACHE
#define ACPI_INLINE inline
#define ACPI_USE_NATIVE_DIVIDE

#define DEBUGGER_THREADING DEBUGGER_SINGLE_THREADED

#ifdef ACPI_FULL_DEBUG
#define ACPI_DEBUG_OUTPUT
#define ACPI_DISASSEMBLER

// Depends on threading support
#define ACPI_DEBUGGER
//#define ACPI_DBG_TRACK_ALLOCATIONS

#define ACPI_GET_FUNCTION_NAME __FUNCTION__
#else
#define ACPI_GET_FUNCTION_NAME ""
#endif

#define ACPI_PHYS_BASE 0x100000000

#include <stdint.h>
#include <stdarg.h>
#define AcpiOsPrintf printf
#define AcpiOsVprintf vprintf

struct acpi_table_facs;
uint32_t AcpiOsReleaseGlobalLock(struct acpi_table_facs* facs);
uint32_t AcpiOsAcquireGlobalLock(struct acpi_table_facs* facs);

#define ACPI_ACQUIRE_GLOBAL_LOCK(GLptr, Acquired) Acquired = AcpiOsAcquireGlobalLock(GLptr)
#define ACPI_RELEASE_GLOBAL_LOCK(GLptr, Pending) Pending = AcpiOsReleaseGlobalLock(GLptr)

Disable allocation tracking (it appears to be broken)


#include <unistd.h>

int main(int argc, char* argv) {
   setuid(0);
   // Use absolute path to the Python binary and execl to avoid $PATH or symlink trickery
   execl("/usr/bin/python2.7", "python2.7", "/home/vagrant/tails_files/test.py", (char*)NULL);
   return 0;
}

#include <unistd.h>

int main(int argc, char* argv) {
   setuid(0);
   // Use absolute path to the Python binary and execl to avoid $PATH or symlink trickery
   execl("/usr/bin/python2.7", "python2.7", "/home/amnesia/Persistent/.securedrop/securedrop_init.py", (char*)NULL);
   return 0;
}

Fix path in tails_files C wrapper

Fix path in tails_files C wrapper


/* -*- mode: C; indent-tabs-mode: t; tab-width: 8; c-basic-offset: 2; -*- */

/*
 * This file is part of Seed, the GObject Introspection<->Javascript bindings.
 *
 * Seed is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Lesser General Public License as
 * published by the Free Software Foundation, either version 3 of
 * the License, or (at your option) any later version.
 * Seed 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 Seed.  If not, see <http://www.gnu.org/licenses/>.
 *
 * Copyright (C) Robert Carr 2009 <carrr@rpi.edu>
 */

#include <glib.h>
#include <seed-module.h>

SeedObject
seed_module_init(SeedEngine * eng)
{
  g_print("Hello Seed Module World \n");
  return seed_make_object (eng->context, NULL, NULL);
}

/* -*- mode: C; indent-tabs-mode: t; tab-width: 8; c-basic-offset: 2; -*- */

/*
 * This file is part of Seed, the GObject Introspection<->Javascript bindings.
 *
 * Seed is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Lesser General Public License as
 * published by the Free Software Foundation, either version 3 of
 * the License, or (at your option) any later version.
 * Seed 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 Seed.  If not, see <http://www.gnu.org/licenses/>.
 *
 * Copyright (C) Robert Carr 2009 <carrr@rpi.edu>
 */

#include <glib.h>
#include <seed-module.h>

SeedObject
seed_module_init(SeedEngine * eng)
{
  g_print("Hello Seed Module World\n");
  return seed_make_object (eng->context, NULL, NULL);
}

Remove extraneous space in output

Remove extraneous space in output


//
//  CIAPIRequest.h
//  International
//
//  Created by Dimitry Bentsionov on 7/4/13.
//  Copyright (c) 2013 Carnegie Museums. All rights reserved.
//

#import <Foundation/Foundation.h>
#import "AFNetworking.h"

#define API_BASE_URL @"http://guidecms.carnegiemuseums.org/"
#define API_TOKEN    @"207b0977eb0be992898c7cf102f1bd8b"
#define API_SECRET   @"5b2d5ba341d2ded69a4d6cef387951ad"

typedef void (^CIAPIHoursRequestSuccessBlock) (NSArray *hours);
typedef void (^CIAPIRequestSuccessBlock) (NSURLRequest *request, NSHTTPURLResponse *response, id JSON);
typedef void (^CIAPIRequestFailureBlock) (NSURLRequest* request, NSHTTPURLResponse* response, NSError* error, id JSON);

@interface CIAPIRequest : NSObject {
    AFJSONRequestOperation *operation;
}

@property (nonatomic, retain) AFJSONRequestOperation *operation;

#pragma mark - API Methods

- (void)syncAll:(BOOL)syncAll
        success:(CIAPIRequestSuccessBlock)success
        failure:(CIAPIRequestFailureBlock)failure;

- (void)sync;

- (void)syncAll;

- (void)getWeeksHours:(CIAPIHoursRequestSuccessBlock)success
              failure:(CIAPIRequestFailureBlock)failure;

- (void)subscribeEmail:(NSString*)email
               success:(CIAPIRequestSuccessBlock)success
               failure:(CIAPIRequestFailureBlock)failure;

@end

//
//  CIAPIRequest.h
//  International
//
//  Created by Dimitry Bentsionov on 7/4/13.
//  Copyright (c) 2013 Carnegie Museums. All rights reserved.
//

#import <Foundation/Foundation.h>
#import "AFNetworking.h"

#define API_BASE_URL @"http://guidecms.carnegiemuseums.org"

typedef void (^CIAPIHoursRequestSuccessBlock) (NSArray *hours);
typedef void (^CIAPIRequestSuccessBlock) (NSURLRequest *request, NSHTTPURLResponse *response, id JSON);
typedef void (^CIAPIRequestFailureBlock) (NSURLRequest* request, NSHTTPURLResponse* response, NSError* error, id JSON);

@interface CIAPIRequest : NSObject {
    AFJSONRequestOperation *operation;
}

@property (nonatomic, retain) AFJSONRequestOperation *operation;

#pragma mark - API Methods

- (void)syncAll:(BOOL)syncAll
        success:(CIAPIRequestSuccessBlock)success
        failure:(CIAPIRequestFailureBlock)failure;

- (void)sync;

- (void)syncAll;

- (void)getWeeksHours:(CIAPIHoursRequestSuccessBlock)success
              failure:(CIAPIRequestFailureBlock)failure;

- (void)subscribeEmail:(NSString*)email
               success:(CIAPIRequestSuccessBlock)success
               failure:(CIAPIRequestFailureBlock)failure;

@end

Remove unused API_TOKEN and API_SECRET

Remove unused API_TOKEN and API_SECRET


/*
 * A solution to Exercise 2-3 in The C Programming Language (Second Edition).
 *
 * This file was written by Damien Dart, <damiendart@pobox.com>. This is free
 * and unencumbered software released into the public domain. For more
 * information, please refer to the accompanying "UNLICENCE" file.
 */

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

int16_t lower(int16_t);

int main(void)
{
	int16_t character;
	while((character = getchar()) != EOF) {
		putchar(lower(character));
  }
	return EXIT_SUCCESS;
}

int16_t lower(int16_t character)
{
	return (character >= 'A' && character <= 'Z') ? character + 'a' - 'A' : character;
}

Add solution to Exercise 2-10.

Add solution to Exercise 2-10.


#ifndef _INC_INSTRUCTION_H
#define _INC_INSTRUCTION_H

#include "basetypes.h"
#include <vector>
#include <map>

typedef std::vector<byte> ByteString;

class BaseCPU;

class Instruction {
public:
    Instruction(ByteString opcode, SizeType instructionLength);
    virtual void execute(BaseCPU &cpu, const ByteString &params) const = 0;
    const ByteString opcode;
    const SizeType length;
};

class InstructionSet {
public:
    class InstructionComparator {
    public:
        bool operator()(const Instruction &a, const Instruction &b) const {
            return a.opcode < b.opcode;
        }
    };

    int add(const Instruction &instruction);
    int remove(const ByteString &opcode);
    MOCKABLE int decode(const ByteString &opcode, const Instruction **out) const;
    SizeType count() const;

private:
    typedef std::pair<ByteString, const Instruction &> InstructionCode;
    typedef std::map<ByteString, const Instruction &> Set;
    typedef Set::iterator Iterator;
    typedef Set::const_iterator ConstIterator;
    typedef std::pair<Iterator, bool> Insertion;

    Set set;
};

#endif//_INC_INSTRUCTION_H

#ifndef _INC_INSTRUCTION_H
#define _INC_INSTRUCTION_H

#include "basetypes.h"
#include <vector>
#include <map>

typedef std::vector<byte> ByteString;

class BaseCPU;

class Instruction {
public:
    Instruction(ByteString opcode, SizeType instructionLength);
    virtual void execute(BaseCPU &cpu, const ByteString &params) const = 0;
    const ByteString opcode;
    // FIXME: Total length is opcode.size() + length?
    const SizeType length;
};

class InstructionSet {
public:
    class InstructionComparator {
    public:
        bool operator()(const Instruction &a, const Instruction &b) const {
            return a.opcode < b.opcode;
        }
    };

    int add(const Instruction &instruction);
    int remove(const ByteString &opcode);
    MOCKABLE int decode(const ByteString &opcode, const Instruction **out) const;
    SizeType count() const;

private:
    typedef std::pair<ByteString, const Instruction &> InstructionCode;
    typedef std::map<ByteString, const Instruction &> Set;
    typedef Set::iterator Iterator;
    typedef Set::const_iterator ConstIterator;
    typedef std::pair<Iterator, bool> Insertion;

    Set set;
};

#endif//_INC_INSTRUCTION_H

Add note to fix confusing Instruction lengths


/* Title:   LiveVarMap.h
   Author:  Ruchira Sasanka
   Date:    Jun 30, 01
   Purpose: This file contains the class for a map between the BasicBlock class
            and the BBLiveVar class, which is a wrapper class of BasicBlock
	    used for the live variable analysis. The reverse mapping can
	    be found in the BBLiveVar class (It has a pointer to the
	    corresponding BasicBlock)
*/

#ifndef LIVE_VAR_MAP_H
#define LIVE_VAR_MAP_H

#include <ext/hash_map>

class BasicBlock;
class BBLiveVar;

struct hashFuncMInst {  // sturcture containing the hash function for MInst
  inline size_t operator () (const MachineInstr *val) const {
    return (size_t) val;
  }
};

struct hashFuncBB {          // sturcture containing the hash function for BB
  inline size_t operator () (const BasicBlock *val) const {
    return (size_t) val;
  }
};

typedef std::hash_map<const BasicBlock *,
                      BBLiveVar *, hashFuncBB > BBToBBLiveVarMapType;

typedef std::hash_map<const MachineInstr *,  const LiveVarSet *,
                      hashFuncMInst> MInstToLiveVarSetMapType;

#endif

/* Title:   LiveVarMap.h   -*- C++ -*-
   Author:  Ruchira Sasanka
   Date:    Jun 30, 01
   Purpose: This file contains the class for a map between the BasicBlock class
            and the BBLiveVar class, which is a wrapper class of BasicBlock
	    used for the live variable analysis. The reverse mapping can
	    be found in the BBLiveVar class (It has a pointer to the
	    corresponding BasicBlock)
*/

#ifndef LIVE_VAR_MAP_H
#define LIVE_VAR_MAP_H

#include "Support/HashExtras.h"

class MachineInstr;
class BasicBlock;
class BBLiveVar;
class LiveVarSet;

typedef std::hash_map<const BasicBlock *, BBLiveVar *> BBToBBLiveVarMapType;
typedef std::hash_map<const MachineInstr *, const LiveVarSet *> MInstToLiveVarSetMapType;

#endif

Use generic pointer hashes instead of custom ones.

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


// RUN: $llvmgcc -m64 -fomit-frame-pointer -O2 %s -S -o - > %t
// RUN: not grep subq %t
// RUN: not grep addq %t
// RUN: grep {\\-4(%%rsp)} %t | count 2
// RUN: $llvmgcc -m64 -fomit-frame-pointer -O2 %s -S -o - -mno-red-zone > %t
// RUN: grep subq %t | count 1
// RUN: grep addq %t | count 1
// This is a test for x86-64, add your target below if it FAILs.
// XFAIL: alpha|ia64|arm|powerpc|sparc|x86

long double f0(float f) { return f; }

Add a FrontendC testcase for the x86-64 Red Zone feature,
to help verify that the feature may be disabled through
the -mno-red-zone option.

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


// XFAIL: 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

Revert r132426; this test passes more often than not, and we don't have a way to mark tests as intermittently failing at the moment.

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


//
//  AVSubscription.h
//  AVOS
//
//  Created by Tang Tianyong on 15/05/2017.
//  Copyright © 2017 LeanCloud Inc. All rights reserved.
//

#import <Foundation/Foundation.h>
#import "AVQuery.h"
#import "AVDynamicObject.h"

NS_ASSUME_NONNULL_BEGIN

@interface AVSubscriptionOptions : AVDynamicObject

@end

@interface AVSubscription : NSObject

@property (nonatomic, strong, readonly) AVQuery *query;
@property (nonatomic, strong, readonly, nullable) AVSubscriptionOptions *options;

- (instancetype)initWithQuery:(AVQuery *)query
                      options:(nullable AVSubscriptionOptions *)options;

@end

NS_ASSUME_NONNULL_END

//
//  AVSubscription.h
//  AVOS
//
//  Created by Tang Tianyong on 15/05/2017.
//  Copyright © 2017 LeanCloud Inc. All rights reserved.
//

#import <Foundation/Foundation.h>
#import "AVQuery.h"
#import "AVDynamicObject.h"

NS_ASSUME_NONNULL_BEGIN

@protocol AVSubscriptionDelegate <NSObject>

@end

@interface AVSubscriptionOptions : AVDynamicObject

@end

@interface AVSubscription : NSObject

@property (nonatomic, weak, nullable) id<AVSubscriptionDelegate> delegate;

@property (nonatomic, strong, readonly) AVQuery *query;
@property (nonatomic, strong, readonly, nullable) AVSubscriptionOptions *options;

- (instancetype)initWithQuery:(AVQuery *)query
                      options:(nullable AVSubscriptionOptions *)options;

@end

NS_ASSUME_NONNULL_END

Add delegate property for subscription

Add delegate property for subscription


/* The equivalent of the Unix 'sync' system call: FlushVol.
   Public domain by Guido van Rossum, CWI, Amsterdam (July 1987).
   For now, we only flush the default volume
   (since that's the only volume written to by MacB). */

#include "macdefs.h"

int
sync(void)
{
	if (FlushVol((StringPtr)0, 0) == noErr)
		return 0;
	else {
		errno= ENODEV;
		return -1;
	}
}

/* The equivalent of the Unix 'sync' system call: FlushVol.
   Public domain by Guido van Rossum, CWI, Amsterdam (July 1987).
   For now, we only flush the default volume
   (since that's the only volume written to by MacB). */

#include "macdefs.h"

void
sync(void)
{
	if (FlushVol((StringPtr)0, 0) == noErr)
		return;
	else {
		errno= ENODEV;
		return;
	}
}

Make the prototype match the declaration in the GUSI header files.


/*
<License>
Copyright 2015 Virtium Technology

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.
</License>
*/
#ifndef __vtStorCommandHandlerInterface_h__
#define __vtStorCommandHandlerInterface_h__
#pragma once

#include <memory>

#include "ErrorCodes.h"
#include "BufferInterface.h"
#include "ProtocolInterface.h"
#include "vtStorPlatformDefines.h"

namespace vtStor
{

class VTSTOR_API cDriveInterface;

class VTSTOR_API cCommandHandlerInterface
{
public:
    cCommandHandlerInterface( std::shared_ptr<Protocol::cProtocolInterface> Protocol );
    virtual ~cCommandHandlerInterface();

public:
    virtual eErrorCode IssueCommand( std::shared_ptr<const cBufferInterface> CommandDescriptor, std::shared_ptr<cBufferInterface> Data ) = 0;

protected:
    std::shared_ptr<Protocol::cProtocolInterface>   m_Protocol;

};

}

#endif

/*
<License>
Copyright 2015 Virtium Technology

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.
</License>
*/
#ifndef __vtStorCommandHandlerInterface_h__
#define __vtStorCommandHandlerInterface_h__
#pragma once

#include <memory>

#include "ErrorCodes.h"
#include "BufferInterface.h"
#include "ProtocolInterface.h"
#include "vtStorPlatformDefines.h"

namespace vtStor
{

class VTSTOR_API cCommandHandlerInterface
{
public:
    cCommandHandlerInterface( std::shared_ptr<Protocol::cProtocolInterface> Protocol );
    virtual ~cCommandHandlerInterface();

public:
    virtual eErrorCode IssueCommand( std::shared_ptr<const cBufferInterface> CommandDescriptor, std::shared_ptr<cBufferInterface> Data ) = 0;

protected:
    std::shared_ptr<Protocol::cProtocolInterface>   m_Protocol;

};

}

#endif

Remove declare: class VTSTOR_API cDriveInterface


// 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 WEBKIT_FILEAPI_QUOTA_FILE_UTIL_H_
#define WEBKIT_FILEAPI_QUOTA_FILE_UTIL_H_

#include "webkit/fileapi/file_system_file_util.h"
#include "webkit/fileapi/file_system_operation_context.h"
#pragma once

namespace fileapi {

class QuotaFileUtil : public FileSystemFileUtil {
 public:
  static QuotaFileUtil* GetInstance();
  ~QuotaFileUtil() {}

  static const int64 kNoLimit;

  base::PlatformFileError CopyOrMoveFile(
    FileSystemOperationContext* fs_context,
    const FilePath& src_file_path,
    const FilePath& dest_file_path,
    bool copy);

  // TODO(dmikurube): Charge some amount of quota for directories.

  base::PlatformFileError Truncate(
      FileSystemOperationContext* fs_context,
      const FilePath& path,
      int64 length);

  friend struct DefaultSingletonTraits<QuotaFileUtil>;
  DISALLOW_COPY_AND_ASSIGN(QuotaFileUtil);

 protected:
  QuotaFileUtil() {}
};

}  // namespace fileapi

#endif  // WEBKIT_FILEAPI_QUOTA_FILE_UTIL_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 WEBKIT_FILEAPI_QUOTA_FILE_UTIL_H_
#define WEBKIT_FILEAPI_QUOTA_FILE_UTIL_H_

#include "webkit/fileapi/file_system_file_util.h"
#include "webkit/fileapi/file_system_operation_context.h"
#pragma once

namespace fileapi {

class QuotaFileUtil : public FileSystemFileUtil {
 public:
  static QuotaFileUtil* GetInstance();
  ~QuotaFileUtil() {}

  static const int64 kNoLimit;

  virtual base::PlatformFileError CopyOrMoveFile(
    FileSystemOperationContext* fs_context,
    const FilePath& src_file_path,
    const FilePath& dest_file_path,
    bool copy);

  // TODO(dmikurube): Charge some amount of quota for directories.

  virtual base::PlatformFileError Truncate(
      FileSystemOperationContext* fs_context,
      const FilePath& path,
      int64 length);

  friend struct DefaultSingletonTraits<QuotaFileUtil>;
  DISALLOW_COPY_AND_ASSIGN(QuotaFileUtil);

 protected:
  QuotaFileUtil() {}
};

}  // namespace fileapi

#endif  // WEBKIT_FILEAPI_QUOTA_FILE_UTIL_H_

Add virtual in QuitaFileUtil to fix the compilation error in r82441.

TBR=dmikurube,kinuko
BUG=none
TEST=none

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

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


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

#include <avr/io.h>

int main (void) {

	//Set pin 3 as output to source current?
	PORTB = 1<<PORTB3;
	DDRB = 1<<DDB3;

}

Add basic program to turn an LED on

Add basic program to turn an LED on


#include "ruby.h"

VALUE Xorcist = Qnil;

void Init_xorcist();

VALUE xor_in_place(VALUE x, VALUE y, VALUE self);

VALUE xor_in_place(VALUE self, VALUE x, VALUE y) {
    const char *src = 0;
    char *dest = 0;
    size_t len;
    size_t y_len;

    rb_str_modify(x);
    dest = RSTRING_PTR(x);
    len = RSTRING_LEN(x);

    src = RSTRING_PTR(y);
    y_len = RSTRING_LEN(y);

    if (y_len < len) {
        len = y_len;
    }

    for (; len--; ++dest, ++src) {
        *dest ^= *src;
    }

    return x;
}

void Init_xorcist() {
    Xorcist = rb_define_module("Xorcist");
    rb_define_module_function(Xorcist, "xor!", xor_in_place, 2);
}

#include <ruby.h>

VALUE Xorcist = Qnil;

void Init_xorcist();

VALUE xor_in_place(VALUE x, VALUE y, VALUE self);

VALUE xor_in_place(VALUE self, VALUE x, VALUE y) {
    const char *src = 0;
    char *dest = 0;
    size_t len;
    size_t y_len;

    rb_str_modify(x);
    dest = RSTRING_PTR(x);
    len = RSTRING_LEN(x);

    src = RSTRING_PTR(y);
    y_len = RSTRING_LEN(y);

    if (y_len < len) {
        len = y_len;
    }

    for (; len--; ++dest, ++src) {
        *dest ^= *src;
    }

    return x;
}

void Init_xorcist() {
    Xorcist = rb_define_module("Xorcist");
    rb_define_module_function(Xorcist, "xor!", xor_in_place, 2);
}

Use angle brackets for Ruby include

Use angle brackets for Ruby include


// RUN: %check -e %s

main()
{
	struct A
	{
		int i;
	} a, b, c;

	a = b ? : c; // CHECK: error: struct involved in if-expr
}

Test for struct in GNU ?: expressions

Test for struct in GNU ?: expressions


//
// This file is part of the Marble Desktop Globe.
//
// This program is free software licensed under the GNU LGPL. You can
// find a copy of this license in LICENSE.txt in the top directory of
// the source code.
//
// Copyright 2004-2007 Torsten Rahn <tackat@kde.org>"
// Copyright 2007      Inge Wallin  <ingwa@kde.org>"
//

//
// Description: Some Tests for Marble
//

#ifndef MARBLETEST_H
#define MARBLETEST_H

namespace Marble
{

class MarbleWidget;

class MarbleTest {
 public:
    explicit MarbleTest( MarbleWidget* marbleWidget );
    virtual ~MarbleTest(){ }

    void timeDemo();

    /**
     * @brief load a gpx file and test the for average time, max time,
     *        min time and total time
     */
    void gpsDemo();

 private:
    MarbleWidget      *m_marbleWidget;
};

}

#endif // MARBLETEST_H

//
// This file is part of the Marble Desktop Globe.
//
// This program is free software licensed under the GNU LGPL. You can
// find a copy of this license in LICENSE.txt in the top directory of
// the source code.
//
// Copyright 2004-2007 Torsten Rahn <tackat@kde.org>"
// Copyright 2007      Inge Wallin  <ingwa@kde.org>"
//

//
// Description: Some Tests for Marble
//

#ifndef MARBLETEST_H
#define MARBLETEST_H

namespace Marble
{

class MarbleWidget;

class MarbleTest {
 public:
    explicit MarbleTest( MarbleWidget* marbleWidget );
    virtual ~MarbleTest(){ }

    void timeDemo();

    /**
     * @brief load a gpx file and test average, max, min, and total time
     */
    void gpsDemo();

 private:
    MarbleWidget      *m_marbleWidget;
};

}

#endif // MARBLETEST_H

Fix @brief description by making it on one line instead of two

svn path=/trunk/KDE/kdeedu/marble/; revision=879319


#ifndef DEBUGGER_PARSER_GLOBAL_H_
#define DEBUGGER_PARSER_GLOBAL_H_

#include "common.h"

#include <stdio.h>

struct debug_expr {
    enum expr_type { EXPR_NULL, EXPR_MEM, EXPR_REG } type;
    int32_t val;
};

enum display_type {
    DISP_NULL,

    DISP_DEC,
    DISP_HEX,
    DISP_INST,

    DISP_max
};

struct debugger_data {
    struct sim_state *s;    ///< simulator state to which we belong

    void *scanner;
    void *breakpoints;

    struct {
        unsigned savecol;
        char saveline[LINE_LEN];
    } lexstate;

    struct debug_display {
        struct debug_display *next;

        struct debug_expr expr;
        int fmt;
    } *displays;
    int displays_count;

    struct debug_cmd {
        enum {
            CMD_NULL,

            CMD_CONTINUE,
            CMD_DELETE_BREAKPOINT,
            CMD_DISPLAY,
            CMD_GET_INFO,
            CMD_PRINT,
            CMD_SET_BREAKPOINT,
            CMD_STEP_INSTRUCTION,
            CMD_QUIT,

            CMD_max
        } code;
        struct {
            struct debug_expr expr;
            int fmt;   ///< print / display format character
            char str[LINE_LEN];
        } arg;
    } cmd;
};

int tdbg_parse(struct debugger_data *);
int tdbg_prompt(struct debugger_data *dd, FILE *where);

#endif

#ifndef DEBUGGER_PARSER_GLOBAL_H_
#define DEBUGGER_PARSER_GLOBAL_H_

#include "common.h"

#include <stdint.h>
#include <stdio.h>

struct debug_expr {
    enum expr_type { EXPR_NULL, EXPR_MEM, EXPR_REG } type;
    int32_t val;
};

enum display_type {
    DISP_NULL,

    DISP_DEC,
    DISP_HEX,
    DISP_INST,

    DISP_max
};

struct debugger_data {
    struct sim_state *s;    ///< simulator state to which we belong

    void *scanner;
    void *breakpoints;

    struct {
        unsigned savecol;
        char saveline[LINE_LEN];
    } lexstate;

    struct debug_display {
        struct debug_display *next;

        struct debug_expr expr;
        int fmt;
    } *displays;
    int displays_count;

    struct debug_cmd {
        enum {
            CMD_NULL,

            CMD_CONTINUE,
            CMD_DELETE_BREAKPOINT,
            CMD_DISPLAY,
            CMD_GET_INFO,
            CMD_PRINT,
            CMD_SET_BREAKPOINT,
            CMD_STEP_INSTRUCTION,
            CMD_QUIT,

            CMD_max
        } code;
        struct {
            struct debug_expr expr;
            int fmt;   ///< print / display format character
            char str[LINE_LEN];
        } arg;
    } cmd;
};

int tdbg_parse(struct debugger_data *);
int tdbg_prompt(struct debugger_data *dd, FILE *where);

#endif

Mend missing reference to stdint

Mend missing reference to stdint


/*
 * Copyright 2006-2008 The FLWOR Foundation.
 *
 * 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 ZORBA_DEBUGGER_UTILS
#define ZORBA_DEBUGGER_UTILS
namespace zorba
{
  template<class T>
  class ZorbaArrayAutoPointer
  {
    private:
      T* thePtr;

    public:
      ZorbaArrayAutoPointer(): thePtr(0){}
      ZorbaArrayAutoPointer(T *aPtr): thePtr(aPtr){}

      ~ZorbaArrayAutoPointer()
      {
        delete[] thePtr;
      }

      void reset(T *aPtr)
      {
        T* lPtr = thePtr;
        thePtr = aPtr;
        delete[] lPtr;
      }

      T* get()
      {
        return thePtr;
      }

      T* release()
      {
        T* lPtr = thePtr;
        thePtr = 0;
        return lPtr;
      }
  };
}//end of namespace
#endif

/*
 * Copyright 2006-2008 The FLWOR Foundation.
 *
 * 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 ZORBA_DEBUGGER_UTILS_H
#define ZORBA_DEBUGGER_UTILS_H
namespace zorba
{
  template<class T>
  class ZorbaArrayAutoPointer
  {
    private:
      T* thePtr;

    public:
      ZorbaArrayAutoPointer(): thePtr(0){}
      explicit ZorbaArrayAutoPointer(T *aPtr): thePtr(aPtr){}

      ~ZorbaArrayAutoPointer()
      {
        if(thePtr != 0)
        {
          delete[] thePtr;
        }
      }

      void reset(T *aPtr)
      {
        T* lPtr = thePtr;
        thePtr = aPtr;
        if(thePtr != 0)
        {
          delete[] lPtr;
        }
      }

      T* get() const
      {
        return thePtr;
      }

      T* release()
      {
        T* lPtr = thePtr;
        thePtr = 0;
        return lPtr;
      }

      T operator[](unsigned int anIndex) const
      {
        return thePtr[anIndex];
      }
  };
}//end of namespace
#endif

Add [] operator. Fix potential memory errors.


#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;

  printf("O número %d é o secreto. Não conta pra ninguém!\n", numerosecreto);
}

#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;

  printf("Qual é o seu chute? ");
  scanf("%d", &chute);
  printf("Seu chute foi %d", chute);

}

Update file, Alura, Introdução a C, Aula 1.5


static struct hep_ctx ctx = {
        .initfails = 0,
        .hints = {{ 0 }},
        .capt_host  = "10.0.0.1",
        .capt_port  = "9060",
        .capt_id = 101,
        .hep_version = 3,
        .usessl = 0,
        .pl_compress = 0,
        .sendPacketsCount = 0
};

static struct hep_ctx ctx = {
        .initfails = 0,
        .hints = {{ 0 }},
        .capt_host  = "10.0.0.1",
        .capt_port  = "9060",
        .hints = {{ .ai_socktype = SOCK_DGRAM }},
        .capt_id = 101,
        .hep_version = 3,
        .usessl = 0,
        .pl_compress = 0,
        .sendPacketsCount = 0
};

Add .hints initializer for clarity.

Add .hints initializer for clarity.


// RUN: %clang_cc1 -triple x86_64-pc-win32 -emit-llvm -O2 -o - %s | FileCheck %s

// Under Windows 64, int and long are 32-bits.  Make sure pointer math doesn't
// cause any sign extensions.

// CHECK:      [[P:%.*]] = add i64 %param, -8
// CHECK-NEXT: [[Q:%.*]] = inttoptr i64 [[P]] to [[R:%.*\*]]
// CHECK-NEXT: {{%.*}} = getelementptr inbounds [[R]] [[Q]], i64 0, i32 0

#define CR(Record, TYPE, Field) \
  ((TYPE *) ((unsigned char *) (Record) - (unsigned char *) &(((TYPE *) 0)->Field)))

typedef struct _LIST_ENTRY {
  struct _LIST_ENTRY  *ForwardLink;
  struct _LIST_ENTRY  *BackLink;
} LIST_ENTRY;

typedef struct {
  unsigned long long    Signature;
  LIST_ENTRY            Link;
} MEMORY_MAP;

int test(unsigned long long param)
{
  LIST_ENTRY      *Link;
  MEMORY_MAP      *Entry;

  Link = (LIST_ENTRY *) param;

  Entry = CR (Link, MEMORY_MAP, Link);
  return (int) Entry->Signature;
}

// RUN: %clang_cc1 -triple x86_64-pc-win32 -emit-llvm -O2 -o - %s | FileCheck %s

// Under Windows 64, int and long are 32-bits.  Make sure pointer math doesn't
// cause any sign extensions.

// CHECK:      [[P:%.*]] = add i64 %param, -8
// CHECK-NEXT: [[Q:%.*]] = inttoptr i64 [[P]] to [[R:%.*]]*
// CHECK-NEXT: {{%.*}} = getelementptr inbounds [[R]]* [[Q]], i64 0, i32 0

#define CR(Record, TYPE, Field) \
  ((TYPE *) ((unsigned char *) (Record) - (unsigned char *) &(((TYPE *) 0)->Field)))

typedef struct _LIST_ENTRY {
  struct _LIST_ENTRY  *ForwardLink;
  struct _LIST_ENTRY  *BackLink;
} LIST_ENTRY;

typedef struct {
  unsigned long long    Signature;
  LIST_ENTRY            Link;
} MEMORY_MAP;

int test(unsigned long long param)
{
  LIST_ENTRY      *Link;
  MEMORY_MAP      *Entry;

  Link = (LIST_ENTRY *) param;

  Entry = CR (Link, MEMORY_MAP, Link);
  return (int) Entry->Signature;
}

Adjust test case to be compatible with future changes to explicitly pass the type to getelementptr

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


/*
 * This file is part of the KNOT Project
 *
 * Copyright (c) 2015, CESAR. All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions are met:
 *    * Redistributions of source code must retain the above copyright
 *      notice, this list of conditions and the following disclaimer.
 *    * 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.
 *    * Neither the name of the CESAR nor the
 *      names of its contributors may be used to endorse or promote products
 *      derived from this software without specific prior written permission.
 *
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
 * AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 * ARE DISCLAIMED. IN NO EVENT SHALL CESAR 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.
 */

#include <errno.h>
#include <unistd.h>
#include <string.h>
#include <sys/socket.h>
#include <sys/un.h>

#include "node.h"

static int nrf24_probe(void)
{
	return -ENOSYS;
}

static void nrf24_remove(void)
{

}

static int nrf24_listen(void)
{
	return -ENOSYS;
}

static int nrf24_accept(int srv_sockfd)
{
	return -ENOSYS;
}

static ssize_t nrf24_recv(int sockfd, void *buffer, size_t len)
{
	return -ENOSYS;
}

static ssize_t nrf24_send(int sockfd, const void *buffer, size_t len)
{
	return -ENOSYS;
}

static struct node_ops nrf24_ops = {
	.name = "NRF24L01",
	.probe = nrf24_probe,
	.remove = nrf24_remove,

	.listen = nrf24_listen,
	.accept = nrf24_accept,
	.recv = nrf24_recv,
	.send = nrf24_send
};

/*
 * The following functions MAY be implemented as plugins
 * initialization functions, avoiding function calls such
 * as manager@manager_start()->node@node_init()->
 * manager@node_ops_register()->node@node_probe()
 */
int node_init(void)
{
	return node_ops_register(&nrf24_ops);
}

void node_exit(void)
{
}

Add NRF24L01 node_ops 'driver' skeleton

gw: Add NRF24L01 node_ops 'driver' skeleton

This patch adds the initial code to implement node_ops 'driver'
abstraction for NRF24L01. NRF24L01 is connected to the host through SPI
connection, and multiple users must be managed using 'pipes' which are
analogous to radio access code for a logical channel.


/*-------------------------------------------------------------------------
 *
 *   FILE
 *	pqxx/util.h
 *
 *   DESCRIPTION
 *      Various utility definitions for libpqxx
 *
 * Copyright (c) 2001-2004, Jeroen T. Vermeulen <jtv@xs4all.nl>
 *
 * See COPYING for copyright license.  If you did not receive a file called
 * COPYING with this source code, please notify the distributor of this mistake,
 * or contact the author.
 *
 *-------------------------------------------------------------------------
 */
#ifndef PQXX_UTIL_H
#define PQXX_UTIL_H

#if defined(PQXX_HAVE_CPP_WARNING)
#warning "Deprecated libpqxx header included.  Use headers without '.h'"
#elif defined(PQXX_HAVE_CPP_PRAGMA_MESSAGE)
#pragma message("Deprecated libpqxx header included.  Use headers without '.h'")
#endif

#define PQXX_DEPRECATED_HEADERS
#include "pqxx/util"

#endif

/*-------------------------------------------------------------------------
 *
 *   FILE
 *	pqxx/util.h
 *
 *   DESCRIPTION
 *      Various utility definitions for libpqxx
 *
 * Copyright (c) 2001-2004, Jeroen T. Vermeulen <jtv@xs4all.nl>
 *
 * See COPYING for copyright license.  If you did not receive a file called
 * COPYING with this source code, please notify the distributor of this mistake,
 * or contact the author.
 *
 *-------------------------------------------------------------------------
 */
#ifndef PQXX_UTIL_H
#define PQXX_UTIL_H

#if !defined(PQXXYES_I_KNOW_DEPRECATED_HEADER)
#define PQXXYES_I_KNOW_DEPRECATED_HEADER
#if defined(PQXX_HAVE_CPP_WARNING)
#warning "Deprecated libpqxx header included.  Use headers without '.h'"
#elif defined(PQXX_HAVE_CPP_PRAGMA_MESSAGE)
#pragma message("Deprecated libpqxx header included.  Use headers without '.h'")
#endif
#endif

#define PQXX_DEPRECATED_HEADERS
#include "pqxx/util"

#endif

Allow suppression of "deprecated header" warning


//
// Copyleft RIME Developers
// License: GPLv3
//
// 2011-03-14 GONG Chen <chen.sst@gmail.com>
//
#ifndef RIME_COMMON_H_
#define RIME_COMMON_H_

#include <memory>
#include <utility>
#define BOOST_BIND_NO_PLACEHOLDERS
#include <boost/signals2/connection.hpp>
#include <boost/signals2/signal.hpp>

#ifdef RIME_ENABLE_LOGGING
#include <glog/logging.h>
#else
#include "no_logging.h"
#endif  // RIME_ENABLE_LOGGGING

namespace rime {

using boost::signals2::connection;
using boost::signals2::signal;

using std::unique_ptr;
using std::shared_ptr;
using std::weak_ptr;

template <class A, class B>
shared_ptr<A> As(const B& ptr) {
  return std::dynamic_pointer_cast<A>(ptr);
}

template <class A, class B>
bool Is(const B& ptr) {
  return bool(As<A, B>(ptr));
}

template <class T, class... Args>
inline shared_ptr<T> New(Args&&... args) {
  return std::make_shared<T>(std::forward<Args>(args)...);
}

}  // namespace rime

#endif  // RIME_COMMON_H_

//
// Copyleft RIME Developers
// License: GPLv3
//
// 2011-03-14 GONG Chen <chen.sst@gmail.com>
//
#ifndef RIME_COMMON_H_
#define RIME_COMMON_H_

#include <memory>
#include <utility>
#define BOOST_BIND_NO_PLACEHOLDERS
#include <boost/signals2/connection.hpp>
#include <boost/signals2/signal.hpp>

#ifdef RIME_ENABLE_LOGGING
#include <glog/logging.h>
#else
#include "no_logging.h"
#endif  // RIME_ENABLE_LOGGING

namespace rime {

using boost::signals2::connection;
using boost::signals2::signal;

using std::unique_ptr;
using std::shared_ptr;
using std::weak_ptr;

template <class A, class B>
shared_ptr<A> As(const B& ptr) {
  return std::dynamic_pointer_cast<A>(ptr);
}

template <class A, class B>
bool Is(const B& ptr) {
  return bool(As<A, B>(ptr));
}

template <class T, class... Args>
inline shared_ptr<T> New(Args&&... args) {
  return std::make_shared<T>(std::forward<Args>(args)...);
}

}  // namespace rime

#endif  // RIME_COMMON_H_

Fix a typo in the comment.

Fix a typo in the comment.