/* Copyright 2013 Google Inc. All Rights Reserved.

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

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

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

   Common types
*/

#ifndef BROTLI_DEC_TYPES_H_
#define BROTLI_DEC_TYPES_H_

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

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

#endif  /* BROTLI_DEC_TYPES_H_ */

/* Copyright 2013 Google Inc. All Rights Reserved.

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

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

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

   Common types
*/

#ifndef BROTLI_DEC_TYPES_H_
#define BROTLI_DEC_TYPES_H_

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

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

#endif  /* BROTLI_DEC_TYPES_H_ */

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


#ifndef __FILTERIMPORTEREXPORTER_H__
#define __FILTERIMPORTEREXPORTER_H__

#include <qvalueList.h>

class KMFilter;
class KConfig;

namespace KMail
{

/**
    @short Utility class that provides persisting of filters to/from KConfig.
    @author Till Adam <till@kdab.net>
 */
class FilterImporterExporter
{
public:
      FilterImporterExporter( bool popFilter = false );
      virtual ~FilterImporterExporter();

      /** Export the given filter rules to a file which
       * is asked from the user. The list to export is also
       * presented for confirmation/selection. */
      void exportFilters( const QValueList<KMFilter*> & );

      /** Import filters. Ask the user where to import them from
       * and which filters to import. */
      QValueList<KMFilter*> importFilters();

      static void writeFiltersToConfig( const QValueList<KMFilter*>& filters, KConfig* config, bool bPopFilter );
      static QValueList<KMFilter*> readFiltersFromConfig( KConfig* config, bool bPopFilter );
private:
      bool mPopFilter;
};

}

#endif /* __FILTERIMPORTEREXPORTER_H__ */

#ifndef __FILTERIMPORTEREXPORTER_H__
#define __FILTERIMPORTEREXPORTER_H__

#include <qvaluelist.h>

class KMFilter;
class KConfig;

namespace KMail
{

/**
    @short Utility class that provides persisting of filters to/from KConfig.
    @author Till Adam <till@kdab.net>
 */
class FilterImporterExporter
{
public:
      FilterImporterExporter( bool popFilter = false );
      virtual ~FilterImporterExporter();

      /** Export the given filter rules to a file which
       * is asked from the user. The list to export is also
       * presented for confirmation/selection. */
      void exportFilters( const QValueList<KMFilter*> & );

      /** Import filters. Ask the user where to import them from
       * and which filters to import. */
      QValueList<KMFilter*> importFilters();

      static void writeFiltersToConfig( const QValueList<KMFilter*>& filters, KConfig* config, bool bPopFilter );
      static QValueList<KMFilter*> readFiltersFromConfig( KConfig* config, bool bPopFilter );
private:
      bool mPopFilter;
};

}

#endif /* __FILTERIMPORTEREXPORTER_H__ */

Fix compilation for case-sensitive file systems.

svn path=/branches/kdepim/enterprise/kdepim/; revision=728559


#include <arpa/inet.h>
#include <endian.h>
#include <netinet/in.h>
#include <netinet/tcp.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/socket.h>
#include <unistd.h>

int main()
{
	struct sockaddr_in serv_addr;
	memset(&serv_addr, 0, sizeof(serv_addr));
	serv_addr.sin_family = AF_INET;
	serv_addr.sin_addr.s_addr = inet_addr("127.0.0.1");
	serv_addr.sin_port = htons(11122);

	int fd = socket(AF_INET, SOCK_STREAM, 0);

	static const int tcp_nodelay_on = 1;
	if (setsockopt(fd, IPPROTO_TCP, TCP_NODELAY, &tcp_nodelay_on, sizeof(tcp_nodelay_on)) < 0) {
		fprintf(stderr, "Could not set TCP_NODELAY\n");
		return EXIT_FAILURE;
	}

	if (connect(fd, (struct sockaddr *)&serv_addr, sizeof(serv_addr)) < 0) {
		fprintf(stderr, "Failed to connect with server\n");
		return EXIT_FAILURE;
	}

	char buffer[1000];
	char *write_ptr = buffer;

	const char msg[] = "bla";

	uint32_t len = strlen(msg);
	len = htobe32(len);
	memcpy(write_ptr, &len, sizeof(len));
	write_ptr += sizeof(len);
	memcpy(write_ptr, msg, strlen(msg));

	int i;
	for (i = 0; i < 1000000; i++) {
		write(fd, buffer, sizeof(len) + strlen(msg));

		uint32_t msg_len;
		ssize_t got = read(fd, &msg_len, sizeof(msg_len));
		if (got != sizeof(msg_len)) {
			fprintf(stderr, "could not read enough for msg_len: %zd\n", got);
			return EXIT_FAILURE;
		}
		msg_len = be32toh(msg_len);
		if (msg_len != be32toh(len)) {
			fprintf(stderr, "msglen != len\n");
		}

		char read_buffer[1000];
		got = read(fd, read_buffer, msg_len);
		if (got != msg_len) {
			fprintf(stderr, "could not read enough of message!\n");
		}
		read_buffer[msg_len] = '\0';
		if (strcmp(read_buffer, msg) != 0) {
			fprintf(stderr, "received message not the same like send!\n");
		}
	}

	close(fd);
	return EXIT_SUCCESS;
}

Add client test program to measure speed of message handling.


/******************************************************************************/
/**
@file
@author		Dana Klamut
@brief		The C++ implementation of a flat file dictionary.
*/
/******************************************************************************/

#if !defined(PROJECT_FLATFILE_H)
#define PROJECT_FLATFILE_H

#include "Dictionary.h"
#include "../key_value/kv_system.h"
#include "../dictionary/flat_file/flat_file_dictionary_handler.h"

template<typename K, typename V>
class FlatFile:public Dictionary<K, V> {
public:
/**
@brief		Registers a specific flat file dictionary instance.

@details	Registers functions for dictionary.

@param		type_key
				The type of keys to be stored in the dictionary.
@param		key_size
				The size of keys to be stored in the dictionary.
@param	  value_size
				The size of the values to be stored in the dictionary.
*/
FlatFile(
	ion_key_type_t	type_key,
	int				key_size,
	int				value_size,
	int				dictionary_size
) {
	ffdict_init(&this->handler);

	this->initializeDictionary(type_key, key_size, value_size, dictionary_size);
}
};

#endif /* PROJECT_FLATFILE_H */

/******************************************************************************/
/**
@file
@author		Dana Klamut
@brief		The C++ implementation of a flat file dictionary.
*/
/******************************************************************************/

#if !defined(PROJECT_FLATFILE_H)
#define PROJECT_FLATFILE_H

#include "Dictionary.h"
#include "../key_value/kv_system.h"
#include "../dictionary/flat_file/flat_file_dictionary_handler.h"

template<typename K, typename V>
class FlatFile:public Dictionary<K, V> {
public:
/**
@brief		Registers a specific flat file dictionary instance.

@details	Registers functions for dictionary.

@param		type_key
				The type of keys to be stored in the dictionary.
@param		key_size
				The size of keys to be stored in the dictionary.
@param	  value_size
				The size of the values to be stored in the dictionary.
@param	  dictionary_size
				The size desired for the dictionary.
*/
FlatFile(
	ion_key_type_t	type_key,
	int				key_size,
	int				value_size,
	int				dictionary_size
) {
	ffdict_init(&this->handler);

	this->initializeDictionary(type_key, key_size, value_size, dictionary_size);
}
};

#endif /* PROJECT_FLATFILE_H */

Update doxygen comments to reflect changes to flat file constructor


#ifndef LYNX_BASE_COMPILER_SPECIFIC_H_
#define LYNX_BASE_COMPILER_SPECIFIC_H_

#if !defined(UNLIKELY)
#if defined(COMPILER_GCC)
#define UNLIKELY(x) __builtin_expect(!!(x), 0)
#else
#define UNLIKELY(x) (x)
#endif
#endif

#endif

Add UNLIKELY for compiler optimization

Add UNLIKELY for compiler optimization

UNLIKELY only used in GCC compiler


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

#ifndef _PC98_INCLUDE_CLOCK_H_
#define _PC98_INCLUDE_CLOCK_H_

#include <i386/clock.h>

#endif /* _PC98_INCLUDE_CLOCK_H_ */

/*-
 * This file is in the public domain.
 */
/* $FreeBSD$ */

#include <i386/clock.h>

Remove my copyright. This file includes simply i386's one now.


#pragma once

#include "onair/okui/config.h"

#if SCRAPS_ANDROID

#include <SDL2/SDL_main.h>

#include <jni.h>

extern "C" {

/* Called before SDL_main() to initialize JNI bindings in SDL library */
extern void SDL_Android_Init(JNIEnv* env, jclass cls);

/* Start up the SDL app */
JNIEXPORT int JNICALL Java_org_libsdl_app_SDLActivity_nativeInit(JNIEnv* env, jclass cls, jobject array)
{
    int i;
    int argc;
    int status;

    /* This interface could expand with ABI negotiation, callbacks, etc. */
    SDL_Android_Init(env, cls);

    SDL_SetMainReady();

    /* Prepare the arguments. */

    int len = env->GetArrayLength((jobjectArray)array);
    char* argv[1 + len + 1];
    argc = 0;
    /* Use the name "app_process" so PHYSFS_platformCalcBaseDir() works.
       https://bitbucket.org/MartinFelis/love-android-sdl2/issue/23/release-build-crash-on-start
     */
    argv[argc++] = SDL_strdup("app_process");
    for (i = 0; i < len; ++i) {
        const char* utf;
        char* arg = NULL;
        jstring string = (jstring)env->GetObjectArrayElement((jobjectArray)array, i);
        if (string) {
            utf = env->GetStringUTFChars(string, 0);
            if (utf) {
                arg = SDL_strdup(utf);
                env->ReleaseStringUTFChars(string, utf);
            }
            env->DeleteLocalRef(string);
        }
        if (!arg) {
            arg = SDL_strdup("");
        }
        argv[argc++] = arg;
    }
    argv[argc] = NULL;

    /* Run the application. */

    status = SDL_main(argc, argv);

    /* Release the arguments. */

    for (i = 0; i < argc; ++i) {
        SDL_free(argv[i]);
    }

    /* Do not issue an exit or the whole application will terminate instead of just the SDL thread */
    /* exit(status); */

    return status;
}

}

#endif

Add android main for sdl

Add android main for sdl

Summary: Needed for the viewer, putting a helper here to be included by the viewer

Test Plan: Run viewer on android

Reviewers: mike.naquin

Reviewed By: mike.naquin

Subscribers: #engineering

Differential Revision: https://phabricator.btlive.tv/D1484

[This commit was only partially migrated from livelib commit 397ac913a235a97fb4bf7f61710a522a0094100e.]


#pragma once

#if !defined( NS_CONCAT_ )
    #define NS_CONCAT_( A, B ) A##B
#endif /* !defined( NS_CONCAT ) */

#if !defined( NS_CONCAT )
    #define NS_CONCAT( A, B ) NS_CONCAT_( A, B )
#endif /* !defined( NS_CONCAT ) */

#if !defined( NAMESPACE )
    #define NAMESPACE
#endif /* !defined( NAMESPACE ) */

#if !defined( NS )
    #define NS(name) NS_CONCAT( NAMESPACE, name )
#endif /* !defined( NS ) */

/* end: sixtracklib/_impl/namespace_begin.h */

#pragma once

#if !defined( NS_CONCAT_ )
    #define NS_CONCAT_( A, B ) A##B
#endif /* !defined( NS_CONCAT ) */

#if !defined( NS_CONCAT )
    #define NS_CONCAT( A, B ) NS_CONCAT_( A, B )
#endif /* !defined( NS_CONCAT ) */

#if !defined( __NAMESPACE )
    #define __NAMESPACE
#endif /* !defined( __NAMESPACE ) */

#if !defined( NS )
    #define NS(name) NS_CONCAT( __NAMESPACE, name )
#endif /* !defined( NS ) */

/* end: sixtracklib/_impl/namespace_begin.h */

Fix not yet corrected NAMESPACE macro

Fix not yet corrected NAMESPACE macro


#ifndef _stdchpl_H_
#define _stdchpl_H_

#include "chplrt.h"

#include <errno.h>
#include <math.h>
#include <float.h>
#include <stddef.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <sys/time.h>

#include <chpl_md.h>

#include "arg.h"
#include "config.h"
#include "chplcast.h"
#include "chplcgfns.h"
#include "chpl-atomics.h"
#include "chpl-comm.h"
#include "chplcopygc.h"
#include "chplexit.h"
#include <chplfp.h>
#include "chplio.h"
#include "chplmath.h"
#include "chpl-mem.h"
#include "chplmemtrack.h"
#include "chplsys.h"
#include "chpl-tasks.h"
#include "chpltimers.h"
#include "chpltypes.h"
#include "chplgpu.h"
#include "error.h"

#include "chpl-comm-compiler-macros.h"

#endif

#ifndef _stdchpl_H_
#define _stdchpl_H_

#include "chplrt.h"

#include <errno.h>
#include <math.h>
#include <float.h>
#include <stddef.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <sys/time.h>

#include <chpl_md.h>

#include "arg.h"
#include "config.h"
#include "chplcast.h"
#include "chplcgfns.h"
#include "chpl-atomics.h"
#include "chpl-comm.h"
#include "chplcopygc.h"
#include "chplexit.h"
#include <chplfp.h>
#include "chplio.h"
#include "chplmath.h"
#include "chpl-mem.h"
#include "chplmemtrack.h"
#include "chplsys.h"
#include "chpl-tasks.h"
#include "chpltimers.h"
#include "chpltypes.h"
#include "chplgpu.h"
#include "error.h"

#include "chplgmp.h"

#include "chpl-comm-compiler-macros.h"

#endif

Include "chplgmp.h" for the emitted code.

[Not reviewed, because seems obvious (now), small, and safe.]

The r21083 change was a bit overenthusiastic in its removal of the
inclusion of "chplgmp.h" into stdchpl.h and this the emitted code.
Without that, tests that use GMP won't build.  Put it back.

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


//===----------------------------------------------------------------------===//
//
//                         Peloton
//
// index_util.h
//
// Identification: src/include/index/index_util.h
//
// Copyright (c) 2015-16, Carnegie Mellon University Database Group
//
//===----------------------------------------------------------------------===//

#pragma once

#include "index/index.h"

namespace peloton {
namespace index {

void ConstructIntervals(oid_t leading_column_id,
                        const std::vector<Value> &values,
                        const std::vector<oid_t> &key_column_ids,
                        const std::vector<ExpressionType> &expr_types,
                        std::vector<std::pair<Value, Value>> &intervals);

void FindMaxMinInColumns(oid_t leading_column_id,
                         const std::vector<Value> &values,
                         const std::vector<oid_t> &key_column_ids,
                         const std::vector<ExpressionType> &expr_types,
                         std::map<oid_t, std::pair<Value, Value>> &non_leading_columns);

bool HasNonOptimizablePredicate(const std::vector<ExpressionType> &expr_types);

bool IsPointQuery(const IndexMetadata *metadata_p,
                  const std::vector<oid_t> &tuple_column_id_list,
                  const std::vector<ExpressionType> &expr_list);

}  // End index namespace
}  // End peloton namespace

//===----------------------------------------------------------------------===//
//
//                         Peloton
//
// index_util.h
//
// Identification: src/include/index/index_util.h
//
// Copyright (c) 2015-16, Carnegie Mellon University Database Group
//
//===----------------------------------------------------------------------===//

#pragma once

#include "index/index.h"

namespace peloton {
namespace index {

void ConstructIntervals(oid_t leading_column_id,
                        const std::vector<Value> &values,
                        const std::vector<oid_t> &key_column_ids,
                        const std::vector<ExpressionType> &expr_types,
                        std::vector<std::pair<Value, Value>> &intervals);

void FindMaxMinInColumns(oid_t leading_column_id,
                         const std::vector<Value> &values,
                         const std::vector<oid_t> &key_column_ids,
                         const std::vector<ExpressionType> &expr_types,
                         std::map<oid_t, std::pair<Value, Value>> &non_leading_columns);

bool HasNonOptimizablePredicate(const std::vector<ExpressionType> &expr_types);

bool IsPointQuery(const IndexMetadata *metadata_p,
                  const std::vector<oid_t> &tuple_column_id_list,
                  const std::vector<ExpressionType> &expr_list,
                  std::vector<std::pair<oid_t, oid_t>> &value_index_list);

}  // End index namespace
}  // End peloton namespace

Change interface of IsPointQuery() in header file


//
//  Motif.h
//  Motif
//
//  Created by Eric Horacek on 3/29/15.
//  Copyright (c) 2015 Eric Horacek. All rights reserved.
//

#import <Foundation/Foundation.h>

//! Project version number for Motif.
FOUNDATION_EXPORT double MotifVersionNumber;

//! Project version string for Motif.
FOUNDATION_EXPORT const unsigned char MotifVersionString[];

#import "MTFBackwardsCompatableNullability.h"
#import "MTFTheme.h"
#import "MTFThemeClass.h"
#import "MTFThemeClassApplicable.h"
#import "MTFDynamicThemeApplier.h"
#import "MTFThemeParser.h"
#import "NSObject+ThemeClassAppliers.h"
#import "NSObject+ThemeClassName.h"
#import "MTFReverseTransformedValueClass.h"
#import "MTFObjCTypeValueTransformer.h"

#ifdef __IPHONE_OS_VERSION_MIN_REQUIRED
    #import "MTFScreenBrightnessThemeApplier.h"
    #import "MTFColorFromStringTransformer.h"
    #import "MTFEdgeInsetsFromStringTransformer.h"
    #import "MTFPointFromStringTransformer.h"
    #import "MTFRectFromStringTransformer.h"
    #import "MTFSizeFromStringTransformer.h"
#endif

//
//  Motif.h
//  Motif
//
//  Created by Eric Horacek on 3/29/15.
//  Copyright (c) 2015 Eric Horacek. All rights reserved.
//

#import <Foundation/Foundation.h>

//! Project version number for Motif.
FOUNDATION_EXPORT double MotifVersionNumber;

//! Project version string for Motif.
FOUNDATION_EXPORT const unsigned char MotifVersionString[];

#import <Motif/MTFBackwardsCompatableNullability.h>
#import <Motif/MTFTheme.h>
#import <Motif/MTFThemeClass.h>
#import <Motif/MTFThemeClassApplicable.h>
#import <Motif/MTFDynamicThemeApplier.h>
#import <Motif/MTFThemeParser.h>
#import <Motif/NSObject+ThemeClassAppliers.h>
#import <Motif/NSObject+ThemeClassName.h>
#import <Motif/MTFReverseTransformedValueClass.h>
#import <Motif/MTFObjCTypeValueTransformer.h>

#ifdef __IPHONE_OS_VERSION_MIN_REQUIRED
    #import <Motif/MTFScreenBrightnessThemeApplier.h>
    #import <Motif/MTFColorFromStringTransformer.h>
    #import <Motif/MTFEdgeInsetsFromStringTransformer.h>
    #import <Motif/MTFPointFromStringTransformer.h>
    #import <Motif/MTFRectFromStringTransformer.h>
    #import <Motif/MTFSizeFromStringTransformer.h>
#endif

Use <> import syntax for umbrella header


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

#include "nrf51.h"
#include "nrf_delay.h"

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

void radio_event_handler(radio_evt_t * evt)
{

}

int main(void)
{
    uint8_t i = 0;

    radio_packet_t packet;
    packet.len = 4;

    radio_init(radio_event_handler);

    NRF_GPIO->DIR = 1 << 18;

    while (1)
    {
        packet.data[0] = i++;
        packet.data[1] = 0x12;
        radio_send(&packet);

        NRF_GPIO->OUTSET = 1 << 18;
        nrf_delay_us(100000);
        NRF_GPIO->OUTCLR = 1 << 18;
        nrf_delay_us(100000);
    }
}

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

#include "nrf51.h"
#include "nrf_delay.h"

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

void radio_evt_handler(radio_evt_t * evt)
{

}

int main(void)
{
    uint8_t i = 0;

    radio_packet_t packet;
    packet.len = 4;
    packet.flags.ack = 0;

    radio_init(radio_evt_handler);

    NRF_GPIO->DIR = 1 << 18;

    while (1)
    {
        packet.data[0] = i++;
        packet.data[1] = 0x12;
        radio_send(&packet);

        NRF_GPIO->OUTSET = 1 << 18;
        nrf_delay_us(100000);
        NRF_GPIO->OUTCLR = 1 << 18;
        nrf_delay_us(100000);
    }
}

Rename the radio event handler.

Rename the radio event handler.


/*
 * Copyright (c) 2015-2018 Morwenn
 * SPDX-License-Identifier: MIT
 */
#ifndef CPPSORT_TESTSUITE_ALGORITHM_H_
#define CPPSORT_TESTSUITE_ALGORITHM_H_

////////////////////////////////////////////////////////////
// Headers
////////////////////////////////////////////////////////////
#include <functional>
#include <iterator>
#include <cpp-sort/utility/as_function.h>
#include <cpp-sort/utility/functional.h>

namespace helpers
{
    template<
        typename Iterator,
        typename Compare = std::less<>,
        typename Projection = cppsort::utility::identity
    >
    auto is_sorted(Iterator first, Iterator last,
                   Compare compare={}, Projection projection={})
        -> bool
    {
        auto&& comp = cppsort::utility::as_function(compare);
        auto&& proj = cppsort::utility::as_function(projection);

        for (auto it = std::next(first) ; it != last ; ++it) {
            if (comp(proj(*it), proj(*first))) {
                return false;
            }
        }
        return true;
    }

    template<
        typename ForwardIterator,
        typename T,
        typename Projection = cppsort::utility::identity
    >
    auto iota(ForwardIterator first, ForwardIterator last,
              T value, Projection projection={})
        -> void
    {
        auto&& proj = cppsort::utility::as_function(projection);

        while (first != last)
        {
            proj(*first++) = value;
            ++value;
        }
    }
}

#endif // CPPSORT_TESTSUITE_ALGORITHM_H_

/*
 * Copyright (c) 2015-2021 Morwenn
 * SPDX-License-Identifier: MIT
 */
#ifndef CPPSORT_TESTSUITE_ALGORITHM_H_
#define CPPSORT_TESTSUITE_ALGORITHM_H_

////////////////////////////////////////////////////////////
// Headers
////////////////////////////////////////////////////////////
#include <functional>
#include <cpp-sort/utility/as_function.h>
#include <cpp-sort/utility/functional.h>

namespace helpers
{
    template<
        typename Iterator,
        typename Compare = std::less<>,
        typename Projection = cppsort::utility::identity
    >
    constexpr auto is_sorted(Iterator first, Iterator last,
                             Compare compare={}, Projection projection={})
        -> bool
    {
        auto&& comp = cppsort::utility::as_function(compare);
        auto&& proj = cppsort::utility::as_function(projection);

        if (first == last) {
            return true;
        }

        auto next = first;
        while (++next != last) {
            if (comp(proj(*next), proj(*first))) {
                return false;
            }
            ++first;
        }
        return true;
    }

    template<
        typename ForwardIterator,
        typename T,
        typename Projection = cppsort::utility::identity
    >
    auto iota(ForwardIterator first, ForwardIterator last,
              T value, Projection projection={})
        -> void
    {
        auto&& proj = cppsort::utility::as_function(projection);

        while (first != last)
        {
            proj(*first++) = value;
            ++value;
        }
    }
}

#endif // CPPSORT_TESTSUITE_ALGORITHM_H_

Fix incorrect is_sorted implementation in the test suite

I'm not sure how this managed to slip under my radar since 2015, that's
a bit embarrassing.


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

#pragma once

#pragma comment(lib, "Dxva2.lib")

#include <Windows.h>
#include <HighLevelMonitorConfigurationAPI.h>

class Monitor;

class BrightnessController {
public:
    BrightnessController(HMONITOR monitor);
    BrightnessController(Monitor &monitor);

    float Brightness();
    void Brightness(float level);

private:
    bool SupportsBrightnessAPI(PHYSICAL_MONITOR &pm);
};

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

#pragma once

#pragma comment(lib, "Dxva2.lib")

#include <Windows.h>
#include <HighLevelMonitorConfigurationAPI.h>

class Monitor;

class BrightnessController {
public:
    BrightnessController(HMONITOR monitor);
    BrightnessController(Monitor &monitor);

    float Brightness();
    void Brightness(float level);

private:
    bool _useBrightnessAPI;

    bool SupportsBrightnessAPI(PHYSICAL_MONITOR &pm);
};

Add bool for brightness API usage

Add bool for brightness API usage


#ifndef RAM_H_
#define RAM_H_

#define RAM_BASE  (1ULL << 12)
#define RAM_END  ((1ULL << 16) - 1)

#endif

#ifndef RAM_H_
#define RAM_H_

#define RAM_BASE  (1ULL << 12)
#define RAM_END  ((1ULL << 14) - 1)

#endif

Make assembly prologue match new memory map


#ifndef _ASM_POWERPC_ABS_ADDR_H
#define _ASM_POWERPC_ABS_ADDR_H
#ifdef __KERNEL__

/*
 * c 2001 PPC 64 Team, IBM Corp
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * as published by the Free Software Foundation; either version
 * 2 of the License, or (at your option) any later version.
 */

#include <linux/memblock.h>

#include <asm/types.h>
#include <asm/page.h>
#include <asm/prom.h>

#define phys_to_abs(pa) (pa)

/* Convenience macros */
#define virt_to_abs(va) __pa(va)
#define abs_to_virt(aa) __va(aa)

#endif /* __KERNEL__ */
#endif /* _ASM_POWERPC_ABS_ADDR_H */

#ifndef _ASM_POWERPC_ABS_ADDR_H
#define _ASM_POWERPC_ABS_ADDR_H
#ifdef __KERNEL__

/*
 * c 2001 PPC 64 Team, IBM Corp
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * as published by the Free Software Foundation; either version
 * 2 of the License, or (at your option) any later version.
 */

#include <linux/memblock.h>

#include <asm/types.h>
#include <asm/page.h>
#include <asm/prom.h>

/* Convenience macros */
#define virt_to_abs(va) __pa(va)
#define abs_to_virt(aa) __va(aa)

#endif /* __KERNEL__ */
#endif /* _ASM_POWERPC_ABS_ADDR_H */

powerpc: Remove phys_to_abs() now all users have been removed

Signed-off-by: Michael Ellerman <17b9e1c64588c7fa6419b4d29dc1f4426279ba01@ellerman.id.au>
Signed-off-by: Benjamin Herrenschmidt <a7089bb6e7e92505d88aaff006cbdd60cc9120b6@kernel.crashing.org>


#include <stdio.h>

/* print Celsius to Fahrenheit  table
 * for Fahrenheit 0, 20, ..., 300 */
int main()
{
    float fahr;
    float cel;
    int lower;
    int upper;
    int step;

    lower = 0; /* lower bound for the table */
    upper = 150; /* upper bound for the table */
    step = 10; /* amount to step by */

    printf(" C \t");
    printf("   F   \n");
    cel = lower;
    while (cel <= upper) {
        fahr = (9.0 / 5.0 * cel) + 32.0;
        /* cel = (5.0 / 9.0) * (fahr - 32.0); */
        printf("%6.0f\t%3.1f\n", cel, fahr);
        cel += step;
    }
}

Add C to F program

Add C to F program


/**
  * Win32 UTF-8 wrapper
  *
  * ----
  *
  * shlwapi.dll functions.
  */

#include <Shlwapi.h>
#include "win32_utf8.h"

BOOL STDAPICALLTYPE PathMatchSpecU(
	__in LPCSTR pszFile,
	__in LPCSTR pszSpec
)
{
	BOOL ret;
	WCHAR_T_DEC(pszFile);
	WCHAR_T_DEC(pszSpec);
	WCHAR_T_CONV(pszFile);
	WCHAR_T_CONV(pszSpec);
	ret = PathMatchSpecW(pszFile_w, pszSpec_w);
	VLA_FREE(pszFile_w);
	VLA_FREE(pszSpec_w);
	return ret;
}

BOOL STDAPICALLTYPE PathFileExistsU(
	__in LPCSTR pszPath
)
{
	BOOL ret;
	WCHAR_T_DEC(pszPath);
	WCHAR_T_CONV(pszPath);
	ret = PathFileExistsW(pszPath_w);
	VLA_FREE(pszPath_w);
	return ret;
}

BOOL STDAPICALLTYPE PathRemoveFileSpecU(
	__inout LPSTR pszPath
)
{
	// Hey, let's re-write the function to also handle forward slashes
	// while we're at it!
	LPSTR newPath = PathFindFileNameA(pszPath);
	if((newPath) && (newPath != pszPath)) {
		newPath[0] = TEXT('\0');
		return 1;
	}
	return 0;
}

/**
  * Win32 UTF-8 wrapper
  *
  * ----
  *
  * shlwapi.dll functions.
  */

#include <Shlwapi.h>
#include "win32_utf8.h"

BOOL STDAPICALLTYPE PathFileExistsU(
	__in LPCSTR pszPath
)
{
	BOOL ret;
	WCHAR_T_DEC(pszPath);
	WCHAR_T_CONV_VLA(pszPath);
	ret = PathFileExistsW(pszPath_w);
	VLA_FREE(pszPath_w);
	return ret;
}

BOOL STDAPICALLTYPE PathMatchSpecU(
	__in LPCSTR pszFile,
	__in LPCSTR pszSpec
)
{
	BOOL ret;
	WCHAR_T_DEC(pszFile);
	WCHAR_T_DEC(pszSpec);
	WCHAR_T_CONV(pszFile);
	WCHAR_T_CONV(pszSpec);
	ret = PathMatchSpecW(pszFile_w, pszSpec_w);
	VLA_FREE(pszFile_w);
	VLA_FREE(pszSpec_w);
	return ret;
}

BOOL STDAPICALLTYPE PathRemoveFileSpecU(
	__inout LPSTR pszPath
)
{
	// Hey, let's re-write the function to also handle forward slashes
	// while we're at it!
	LPSTR newPath = PathFindFileNameA(pszPath);
	if((newPath) && (newPath != pszPath)) {
		newPath[0] = TEXT('\0');
		return 1;
	}
	return 0;
}

Reorder function definitions to match their order in the header file.

This is driving me ma~d.


/* $NetBSD: netisr_dispatch.h,v 1.2 2000/07/02 04:40:47 cgd Exp $ */

/*
 * netisr_dispatch: This file is included by the
 *	machine dependant softnet function.  The
 *	DONETISR macro should be set before including
 *	this file.  i.e.:
 *
 * softintr() {
 *	...do setup stuff...
 *	#define DONETISR(bit, fn) do { ... } while (0)
 *	#include <net/netisr_dispatch.h>
 *	#undef DONETISR
 *	...do cleanup stuff.
 * }
 */

#ifndef _NET_NETISR_H_
#error <net/netisr.h> must be included before <net/netisr_dispatch.h>
#endif

/*
 * When adding functions to this list, be sure to add headers to provide
 * their prototypes in <net/netisr.h> (if necessary).
 */

#ifdef INET
#include "ether.h"
#if NETHER > 0
	DONETISR(NETISR_ARP,arpintr);
#endif
	DONETISR(NETISR_IP,ipintr);
#endif
#ifdef INET6
	DONETISR(NETISR_IPV6,ip6intr);
#endif
#ifdef NETATALK
	DONETISR(NETISR_ATALK,atintr);
#endif
#ifdef IMP
	DONETISR(NETISR_IMP,impintr);
#endif
#ifdef IPX
	DONETISR(NETISR_IPX,ipxintr);
#endif
#ifdef NS
	DONETISR(NETISR_NS,nsintr);
#endif
#ifdef ISO
	DONETISR(NETISR_ISO,clnlintr);
#endif
#ifdef CCITT
	DONETISR(NETISR_CCITT,ccittintr);
#endif
#ifdef NATM
	DONETISR(NETISR_NATM,natmintr);
#endif
#include "ppp.h"
#if NPPP > 0
	DONETISR(NETISR_PPP,pppintr);
#endif
#include "bridge.h"
#if NBRIDGE > 0
        DONETISR(NETISR_BRIDGE,bridgeintr);
#endif

Add a centralized dispatcher for softnet interrupts.
This is so that we won't need to change every arch on a softnet change.

From NetBSD.


/* Copyright (c) 2012 Fritz Grimpen
 *
 * Permission is hereby granted, unalloc of charge, to any person obtaining a copy of
 * this software and associated documentation files (the "Software"), to deal in
 * the Software without restriction, including without limitation the rights to
 * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
 * the Software, and to permit persons to whom the Software is furnished to do so,
 * subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included in all
 * copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
 * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
 * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
 * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 */

#define F_DICT_STRUCTS

#include <f/dict.h>

#define SLOT(h) (((h) * (F_DICT_SLOTS_COUNT - 1)) % F_DICT_SLOTS_COUNT)
#define BUCKET(d, h) ((h) % (d)->buckets_cnt)

/* Copyright (c) 2012 Fritz Grimpen
 *
 * Permission is hereby granted, unalloc of charge, to any person obtaining a copy of
 * this software and associated documentation files (the "Software"), to deal in
 * the Software without restriction, including without limitation the rights to
 * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
 * the Software, and to permit persons to whom the Software is furnished to do so,
 * subject to the following conditions:
 *
 * The above copyright notice and this permission notice shall be included in all
 * copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
 * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
 * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
 * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 */

#define F_DICT_STRUCTS

#include <f/dict.h>

#define SLOT(h) (((h) * (F_DICT_SLOTS_COUNT - 1)) & (F_DICT_SLOTS_COUNT - 1))
#define BUCKET(d, h) ((h) % (d)->buckets_cnt)

Replace modulo by AND gatter

Replace modulo by AND gatter


#pragma once

// assume that visuals and code are the same here....
// and also assuming our screen is square :)

#define VISUALS_WIDTH 504
#define VISUALS_HEIGHT 504

#define CODE_WIDTH VISUALS_WIDTH
#define CODE_HEIGHT VISUALS_HEIGHT

#define CODE_X_POS 520      // via the tech staff

//if this is defined, we will wait for type animation
#define TYPE_ANIMATION

#define USE_MIDI_PARAM_SYNC

// if this is defined, we will disable all sound playback inside this app, and instead send
// OpenSoundControl messages which can be used to trigger sounds in another program (e.g. Ableton Live)
//#define USE_EXTERNAL_SOUNDS

#pragma once

// assume that visuals and code are the same here....
// and also assuming our screen is square :)

#define VISUALS_WIDTH 504
#define VISUALS_HEIGHT 504

#define CODE_WIDTH VISUALS_WIDTH
#define CODE_HEIGHT VISUALS_HEIGHT

#define CODE_X_POS 520      // via the tech staff

//if this is defined, we will wait for type animation
//#define TYPE_ANIMATION

#define USE_MIDI_PARAM_SYNC

// if this is defined, we will disable all sound playback inside this app, and instead send
// OpenSoundControl messages which can be used to trigger sounds in another program (e.g. Ableton Live)
//#define USE_EXTERNAL_SOUNDS

Revert accidental uncommenting of TYPE_ANIMATION


// -*- c++ -*-
#ifndef LOCKS_H
#define LOCKS_H

#include <pthread.h>

namespace locks {

template <typename L>
void unlocker(void* lock_ptr)
{
    L* lock = (L*) lock_ptr;
    lock->unlock();
}

template <typename L>
void unlocker_checked(void* lock_ptr)
{
    L& lock = *((L*) lock_ptr);
    if (lock)
        lock.unlock();
}

}

#endif /* LOCKS_H */

// -*- c++ -*-
#ifndef LOCKS_H
#define LOCKS_H

#include <cstdio>
#include <pthread.h>

namespace locks {

template <typename L>
void unlocker(void* lock_ptr)
{
    L* lock = (L*) lock_ptr;
    fprintf(stderr, "Releasing lock (unchecked) during cancellation!\n");
    lock->unlock();
}

template <typename L>
void unlocker_checked(void* lock_ptr)
{
    L& lock = *((L*) lock_ptr);
    if (lock.owns_lock()) {
        fprintf(stderr, "Releasing lock (checked) during cancellation!\n");
        lock.unlock();
    }
}

}

#endif /* LOCKS_H */

Add logging etc. to lock release code.

Add logging etc. to lock release code.


#ifndef LIST_H
#define LIST_H

#define NEXT_NODE(node) node->next
#define FINDTAILNODE(x) if(x)while(x->next)x=x->next;
#define ADDNODEAFTER(x,t) if(x){t=x->next; x->next=malloc(sizeof(*t)); x->next->next=t;}

#endif

#ifndef LIST_H
#define LIST_H

#define NEXT_NODE(node) node->next
#define FINDTAILNODE(x) if(x)while(x->next)x=x->next;
#define ADDNODE(x,t) if(x){t=x; x=malloc(sizeof(*x)); x->next=t;}
#define ADDNODEAFTER(x,t) if(x){t=x->next; x->next=malloc(sizeof(*t)); x->next->next=t;}

#endif

Add missing macro from last commit.

Add missing macro from last commit.


#ifndef UTIL_H
#define UTIL_H

#include <chrono>
#include <numeric>
#include <iterator>
#include <array>
#include <algorithm>

namespace util
{

class Timer
{
public:
  Timer() = default;
  Timer(bool start_running);
  ~Timer() = default;

  void start();
  void stop();
  float stop_seconds();
  float seconds();

private:
  std::chrono::high_resolution_clock::time_point start_time;
  std::chrono::high_resolution_clock::time_point stop_time;
};

namespace math
{

template<typename T> int mean(T collection)
{
  return std::accumulate(std::begin(collection), std::end(collection), 0) / std::size(collection);
}

}  // namespace math

}  // namespace util

#endif  // UTIL_H

#ifndef UTIL_H
#define UTIL_H

#include <chrono>
#include <numeric>
#include <iterator>
#include <array>
#include <algorithm>

namespace util
{

class Timer
{
public:
  Timer() = default;
  Timer(bool start_running);
  ~Timer() = default;

  void start();
  void stop();
  float stop_seconds();
  float seconds();

private:
  std::chrono::high_resolution_clock::time_point start_time;
  std::chrono::high_resolution_clock::time_point stop_time;
};

namespace math
{

template<typename T> int mean(T collection)
{
  if (std::size(collection) == 0)
    return 0;
  return std::accumulate(std::begin(collection), std::end(collection), 0) / std::size(collection);
}

}  // namespace math

}  // namespace util

#endif  // UTIL_H

Fix possible divide by zero error

Fix possible divide by zero error


// Copyright 2012 Rui Ueyama <rui314@gmail.com>
// This program is free software licensed under the MIT license.

#include "test.h"

#define stringify(x) #x

void digraph(void) {
    expect_string("[", stringify(<:));
    expect_string("]", stringify(:>));
    expect_string("{", stringify(<%));
    expect_string("}", stringify(%>));
    expect_string("#", stringify(%:));
    expect_string("% :", stringify(% :));
    expect_string("##", stringify(%:%:));
    expect_string("#%", stringify(%:%));
}

void escape(void) {
    int value = 10;
    expect(10, val\
ue);
}

void whitespace(void) {
    expect_string("x y", stringify(xy));
}

void testmain(void) {
    print("lexer");
    digraph();
    escape();
    whitespace();
}

// Copyright 2012 Rui Ueyama <rui314@gmail.com>
// This program is free software licensed under the MIT license.

#include "test.h"

#define stringify(x) #x

void digraph(void) {
    expect_string("[", stringify(<:));
    expect_string("]", stringify(:>));
    expect_string("{", stringify(<%));
    expect_string("}", stringify(%>));
    expect_string("#", stringify(%:));
    expect_string("% :", stringify(% :));
    expect_string("##", stringify(%:%:));
    expect_string("#%", stringify(%:%));
}

void escape(void) {
    int value = 10;
    expect(10, val\
ue);
}

void whitespace(void) {
    expect_string("x y", stringify(xy));
}

void newline(void) {

#
}

void testmain(void) {
    print("lexer");
    digraph();
    escape();
    whitespace();
    newline();
}

Add a test for line separator characters.


#ifndef AL_MATH_DEFS_H
#define AL_MATH_DEFS_H

#include <math.h>

#ifndef M_PI
#define M_PI (3.14159265358979323846)
#endif

#define F_PI    (3.14159265358979323846f)
#define F_PI_2  (1.57079632679489661923f)
#define F_TAU   (6.28318530717958647692f)

#define SQRTF_3 1.73205080756887719318f

constexpr inline float Deg2Rad(float x) noexcept { return x * float{M_PI/180.0}; }
constexpr inline float Rad2Deg(float x) noexcept { return x * float{180.0/M_PI}; }

#endif /* AL_MATH_DEFS_H */

#ifndef AL_MATH_DEFS_H
#define AL_MATH_DEFS_H

#include <math.h>

#ifndef M_PI
#define M_PI (3.14159265358979323846)
#endif

#define F_PI    (3.14159265358979323846f)
#define F_PI_2  (1.57079632679489661923f)
#define F_TAU   (6.28318530717958647692f)

#define SQRTF_3 1.73205080756887719318f

constexpr inline float Deg2Rad(float x) noexcept { return x * static_cast<float>(M_PI/180.0); }
constexpr inline float Rad2Deg(float x) noexcept { return x * static_cast<float>(180.0/M_PI); }

#endif /* AL_MATH_DEFS_H */

Fix narrowing conversion from double to float


#ifndef PLATFORM_HW_H__
#define PLATFORM_HW_H__

#include <stdbool.h>
#include "color.h"
#include "stm32f0xx_hal.h"
#include "stm32f0xx_hal_gpio.h"

#define LED_CHAIN_LENGTH       10

#define  USER_BUTTON_PORT        (GPIOA)
#define  USER_BUTTON_PIN         (GPIO_PIN_0)

#define  LED_SPI_INSTANCE        (SPI1)

#pragma pack(push)  /* push current alignment to stack */
#pragma pack(1)     /* set alignment to 1 byte boundary */
union platformHW_LEDRegister {
   uint8_t  raw[4];
   struct {
      //header/global brightness is 0bAAABBBBB
      //A = 1
      //B = integer brightness divisor from 0x0 -> 0x1F

      uint8_t const                 header      :3;

      //3 bits always, 5 bits global brightness, 8B, 8G, 8R
      //Glob = 0xE1 = min bright
      //uint8_t const           globalHeader      :8;
      uint8_t                 globalBrightness  :5;
      struct color_ColorRGB   color;
   };
};
#pragma pack(pop)   /* restore original alignment from stack */

bool platformHW_Init(void);
bool platformHW_SpiInit(SPI_HandleTypeDef * const spi, SPI_TypeDef* spiInstance);

void platformHW_UpdateLEDs(SPI_HandleTypeDef* spi);

#endif//PLATFORM_HW_H__

#ifndef PLATFORM_HW_H__
#define PLATFORM_HW_H__

#include <stdbool.h>
#include "color.h"
#include "stm32f0xx_hal.h"
#include "stm32f0xx_hal_gpio.h"

#define LED_CHAIN_LENGTH       10

#define  USER_BUTTON_PORT        (GPIOA)
#define  USER_BUTTON_PIN         (GPIO_PIN_0)

#define  LED_SPI_INSTANCE        (SPI1)

#pragma pack(push)  /* push current alignment to stack */
#pragma pack(1)     /* set alignment to 1 byte boundary */
union platformHW_LEDRegister {
   uint8_t  raw[4];
   struct {
      //3 bits always, 5 bits global brightness, 8B, 8G, 8R
      //Glob = 0xE1 = min bright
      uint8_t                 globalBrightness  :5;

      //header/global brightness is 0bAAABBBBB
      //A = 1
      //B = integer brightness divisor from 0x0 -> 0x1F
      uint8_t const                 header      :3;

      struct color_ColorRGB   color;
   };
};
#pragma pack(pop)   /* restore original alignment from stack */

bool platformHW_Init(void);
bool platformHW_SpiInit(SPI_HandleTypeDef * const spi, SPI_TypeDef* spiInstance);

void platformHW_UpdateLEDs(SPI_HandleTypeDef* spi);

#endif//PLATFORM_HW_H__

Fix incorrect LED header bit order

Fix incorrect LED header bit order


#ifndef CJET_STRING_H
#define CJET_STRING_H

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

static inline char *duplicate_string(const char *s)
{
	size_t length = strlen(s);
	char *new_string = malloc(length + 1);
	if (unlikely(new_string == NULL)) {
		return NULL;
	}
	strncpy(new_string, s, length + 1);
	return new_string;
}

#endif

#ifndef CJET_STRING_H
#define CJET_STRING_H

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

static inline char *duplicate_string(const char *s)
{
	size_t length = strlen(s);
	char *new_string = malloc(length + 1);
	if (unlikely(new_string != NULL)) {
		strncpy(new_string, s, length + 1);
	}
	return new_string;
}

#endif

Simplify string duplication function a bit.


/*
    usart0s.h - C interface to routine written in assembler
    Compile the corresponding assembler file with
        #define C_COMPAT_ASM_CODE  1
    Copyright (c) 2015 Igor Mikolic-Torreira.  All right reserved.

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

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.
*/

#ifndef usart0s_h
#define usart0s_h

#include <stdint.h>

#ifdef __cplusplus
extern "C" {
#endif

void sendUSART0( uint8_t byteToSend );

#ifdef __cplusplus
}
#endif

#endif

/*
    usart0s.h - C interface to routine written in assembler

    The MIT License (MIT)

    Copyright (c) 2015 Igor Mikolic-Torreira

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

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

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

#ifndef usart0s_h
#define usart0s_h

#include <stdint.h>

#ifdef __cplusplus
extern "C" {
#endif

void enableUSART0();

void sendUSART0( uint8_t byteToSend );

#ifdef __cplusplus
}
#endif

#endif

Revise license and add missing prototype


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

This file is part of libunwind.

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

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

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

#include "unwind_i.h"

PROTECTED int
unw_set_caching_policy (unw_addr_space_t as, unw_caching_policy_t policy)
{
  if (unw.needs_initialization)
    ia64_init ();

#ifndef HAVE___THREAD
  if (policy == UNW_CACHE_PER_THREAD)
    policy = UNW_CACHE_GLOBAL;
#endif

  if (policy == as->caching_policy)
    return 0;	/* no change */

  as->caching_policy = policy;
  /* Ensure caches are empty (and initialized).  */
  unw_flush_cache (as, 0, 0);
  return 0;
}

Declare libunwind-entry-points as PROTECTED to ensure local uses get
resolved within the library itself.

2004/01/03 00:25:12-08:00 hp.com!davidm
Rename: src/ia64/set_caching_policy-ia64.c -> src/ia64/Gset_caching_policy-ia64.c

(Logical change 1.151)


//
// Created by monty on 27/08/16.
//

#ifndef BLANKSLATE_COMMON_H
#define BLANKSLATE_COMMON_H

namespace odb {

#ifdef LOWRES
    using FixP = fixed_point<int16_t, -4>;
#else
    using FixP = fixed_point<int32_t, -16>;
#endif

    class Vec3 {
    public:
        FixP mX;
        FixP mY;
        FixP mZ;
    };

    Vec3 operator+(const Vec3 &v1, const Vec3 &v2);

    Vec3 operator-(const Vec3 &v1, const Vec3 &v2);

    Vec3 &operator+=(Vec3 &v1, const Vec3 &v2);

    Vec3 &operator-=(Vec3 &v1, const Vec3 &v2);

    class Vec2 {
    public:
        FixP mX;
        FixP mY;
    };
}
#endif //BLANKSLATE_COMMON_H

//
// Created by monty on 27/08/16.
//

#ifndef BLANKSLATE_COMMON_H
#define BLANKSLATE_COMMON_H

namespace odb {

#ifdef LOWRES
    using FixP = fixed_point<int16_t, -3>;
#else
    using FixP = fixed_point<int32_t, -16>;
#endif

    class Vec3 {
    public:
        FixP mX;
        FixP mY;
        FixP mZ;
    };

    Vec3 operator+(const Vec3 &v1, const Vec3 &v2);

    Vec3 operator-(const Vec3 &v1, const Vec3 &v2);

    Vec3 &operator+=(Vec3 &v1, const Vec3 &v2);

    Vec3 &operator-=(Vec3 &v1, const Vec3 &v2);

    class Vec2 {
    public:
        FixP mX;
        FixP mY;
    };
}
#endif //BLANKSLATE_COMMON_H

Bring the lower resolution version back from the dead

Some textures look warped, but it mostly works.


// RUN: clang -checker-simple -verify %s

void f(void) {
  void (*p)(void);
  p = f;
  p = &f;
  p();
  (*p)();
}

void g(void (*fp)(void));

void f2() {
  g(f);
}

Add test for SCA region store.

Add test for SCA region store.

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


#ifndef QTCSVFILECHECKER_H
#define QTCSVFILECHECKER_H

#include <QString>
#include <QFileInfo>

namespace QtCSV
{
    // Check if path to csv file is valid
    // @input:
    // - filePath - string with absolute path to csv-file
    // @output:
    // - bool - True if file is OK, else False
    inline bool CheckFile(const QString& filePath)
    {
        QFileInfo fileInfo(filePath);
        if ( fileInfo.isAbsolute() && "csv" == fileInfo.suffix() )
        {
            return true;
        }

        return false;
    }
}

#endif // QTCSVFILECHECKER_H

#ifndef QTCSVFILECHECKER_H
#define QTCSVFILECHECKER_H

#include <QString>
#include <QFileInfo>
#include <QDebug>

namespace QtCSV
{
    // Check if path to csv file is valid
    // @input:
    // - filePath - string with absolute path to csv-file
    // @output:
    // - bool - True if file is OK, else False
    inline bool CheckFile(const QString& filePath)
    {
        QFileInfo fileInfo(filePath);
        if ( fileInfo.isAbsolute() && fileInfo.isFile() )
        {
            if ( "csv" != fileInfo.suffix() )
            {
                qDebug() << __FUNCTION__  <<
                            "Warning - file suffix is not .csv";
            }

            return true;
        }

        return false;
    }
}

#endif // QTCSVFILECHECKER_H

Remove requirement for a .csv suffix. Print warning if working with file that have suffix other than .csv


#pragma once

#define TINYFORMAT_USE_VARIADIC_TEMPLATES
#include "dependencies/tinyformat/tinyformat.h"
#include "library/strings.h"
namespace OpenApoc
{

template <typename... Args> static UString format(const UString &fmt, Args &&... args)
{
	return tfm::format(fmt.cStr(), std::forward<Args>(args)...);
}

UString tr(const UString &str, const UString domain = "ufo_string");

} // namespace OpenApoc

#pragma once

#define TINYFORMAT_USE_VARIADIC_TEMPLATES

#ifdef __GNUC__
// Tinyformat has a number of non-annotated switch fallthrough cases
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wimplicit-fallthrough"
#endif

#include "dependencies/tinyformat/tinyformat.h"

#ifdef __GNUC__
#pragma GCC diagnostic pop
#endif

#include "library/strings.h"
namespace OpenApoc
{

template <typename... Args> static UString format(const UString &fmt, Args &&... args)
{
	return tfm::format(fmt.cStr(), std::forward<Args>(args)...);
}

UString tr(const UString &str, const UString domain = "ufo_string");

} // namespace OpenApoc

Disable -Wimplicit-fallthrough when including tinyformat

We assume anything that defines __GNUC__ also copes with GCC #pragmas


// PARAM: --enable ana.int.interval
#include <stdlib.h>
#include <assert.h>

int main() {
  unsigned long ul;

  if (ul <= 0UL) {
    __goblint_check(ul == 0UL);
  } else {
    __goblint_check(ul != 0UL);
  }

  if (ul > 0UL) {
    __goblint_check(ul != 0UL);
  } else {
    __goblint_check(ul == 0UL);
  }

  if (! (ul > 0UL)) {
    __goblint_check(ul == 0UL);
  } else {
    __goblint_check(ul != 0UL);
  }

  unsigned int iu;
  if (iu <= 0UL) {
    __goblint_check(iu == 0UL);
  } else {
    __goblint_check(iu != 0UL);
  }

  if (iu > 0UL) {
    __goblint_check(iu != 0UL);
  } else {
    __goblint_check(iu == 0UL);
  }

  if (! (iu > 0UL)) {
    __goblint_check(iu == 0UL);
  } else {
    __goblint_check(iu != 0UL);
  }

  int i;
  if (! (i > 0)) {

  } else {
    __goblint_check(i != 0);
  }

  return 0;
}

Remove trailing spaces in test case.

Remove trailing spaces in test case.


#ifndef WSGI_VERSION_H
#define WSGI_VERSION_H

/* ------------------------------------------------------------------------- */

/*
 * Copyright 2007-2021 GRAHAM DUMPLETON
 *
 * 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.
 */

/* ------------------------------------------------------------------------- */

/* Module version information. */

#define MOD_WSGI_MAJORVERSION_NUMBER 4
#define MOD_WSGI_MINORVERSION_NUMBER 9
#define MOD_WSGI_MICROVERSION_NUMBER 0
#define MOD_WSGI_VERSION_STRING "4.9.0"

/* ------------------------------------------------------------------------- */

#endif

/* vi: set sw=4 expandtab : */

#ifndef WSGI_VERSION_H
#define WSGI_VERSION_H

/* ------------------------------------------------------------------------- */

/*
 * Copyright 2007-2021 GRAHAM DUMPLETON
 *
 * 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.
 */

/* ------------------------------------------------------------------------- */

/* Module version information. */

#define MOD_WSGI_MAJORVERSION_NUMBER 4
#define MOD_WSGI_MINORVERSION_NUMBER 9
#define MOD_WSGI_MICROVERSION_NUMBER 1
#define MOD_WSGI_VERSION_STRING "4.9.1.dev1"

/* ------------------------------------------------------------------------- */

#endif

/* vi: set sw=4 expandtab : */

Increment version to 4.9.1 for new development work.


/*
 * statistic_histogram.h
 *
 */

#ifndef STATISTIC_HISTOGRAM_H_
#define STATISTIC_HISTOGRAM_H_

#include <stdio.h>
#include <vector>

class Statistic_histogram
{
public:
    Statistic_histogram(std::string h_name, const ssize_t domain_start, const ssize_t domain_end, const size_t range_size);

    void inc_val(uint64_t val);
    size_t report(char * report_buffer, size_t report_buffer_size);

private:
    std::string  name;
    ssize_t dstart;
    ssize_t dend;
    size_t  rsize;

    typedef std::vector<uint64_t>::iterator hv_iterator;
    std::vector<uint64_t> hval;
};

#endif /* STATISTIC_HISTOGRAM_H_ */

/*
Copyright (c) 2015, Edward Haas
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 st_histogram nor the names of its
  contributors may be used to endorse or promote products derived from
  this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

statistic_histogram.h

*/

#ifndef STATISTIC_HISTOGRAM_H_
#define STATISTIC_HISTOGRAM_H_

#include <stdio.h>
#include <vector>

class Statistic_histogram
{
public:
    Statistic_histogram(std::string h_name, const ssize_t domain_start, const ssize_t domain_end, const size_t range_size);

    void inc_val(uint64_t val);
    size_t report(char * report_buffer, size_t report_buffer_size);

private:
    std::string  name;
    ssize_t dstart;
    ssize_t dend;
    size_t  rsize;

    typedef std::vector<uint64_t>::iterator hv_iterator;
    std::vector<uint64_t> hval;
};

#endif /* STATISTIC_HISTOGRAM_H_ */

Update license in header file

Update license in header file


#include <stdio.h>

int main() {
    unsigned int a, b;

    while (scanf("%u %u", &a, &b) != EOF) {
        printf("%u\n", a ^ b);
    }

    return 0;
}

Solve To Carry or not to Carry in c

Solve To Carry or not to Carry in c


#ifndef FRAMEGRAB_H_
#define FRAMEGRAB_H_

#include <unistd.h>

typedef void *fg_handle;

/* fourcc constants */
#define FG_FORMAT_YUYV	0x56595559
#define FG_FORMAT_RGB24	0x33424752

struct fg_image {
	int width;
	int height;
	int format;
};

fg_handle fg_init(char *, int);
int fg_deinit(fg_handle);
int fg_start(fg_handle);
int fg_stop(fg_handle);
int fg_set_format(fg_handle, struct fg_image *);
int fg_get_format(fg_handle, struct fg_image *);
int fg_get_frame(fg_handle, void *, size_t len);
int fg_write_jpeg(char *, int, struct fg_image *, void *);

#endif

#ifndef FRAMEGRAB_H_
#define FRAMEGRAB_H_

#ifdef __cplusplus
extern "C" {
#endif

#include <stdlib.h>

#if defined(_WIN32) && !defined(__CYGWIN__)
# ifdef BUILDING_DLL
#  define EXPORT __declspec(dllexport)
# else
#  define EXPORT __declspec(dllimport)
# endif
#elif __GNUC__ >= 4 || defined(__HP_cc)
# define EXPORT __attribute__((visibility ("default")))
#elif defined(__SUNPRO_C)
# define EXPORT __global
#else
# define EXPORT
#endif

typedef void *fg_handle;

/* fourcc constants */
#define FG_FORMAT_YUYV	0x56595559
#define FG_FORMAT_RGB24	0x33424752

struct fg_image {
	int width;
	int height;
	int format;
};

EXPORT fg_handle fg_init(char *, int);
EXPORT int fg_deinit(fg_handle);
EXPORT int fg_start(fg_handle);
EXPORT int fg_stop(fg_handle);
EXPORT int fg_set_format(fg_handle, struct fg_image *);
EXPORT int fg_get_format(fg_handle, struct fg_image *);
EXPORT int fg_get_frame(fg_handle, void *, size_t len);
EXPORT int fg_write_jpeg(char *, int, struct fg_image *, void *);

#ifdef __cplusplus
}
#endif

#endif

Add C++ and shared library stuff to header file

We're not using it yet, but it's a nice thing to have.

Signed-off-by: Claudio Matsuoka <ef7f691d9947ca9adbfeb1538a53a661ec9f041b@gmail.com>


// Check that --sysroot= also applies to header search paths.
// RUN: %clang -ccc-host-triple unknown --sysroot=/FOO -### -E %s 2> %t1
// RUN: FileCheck --check-prefix=CHECK-SYSROOTEQ < %t1 %s
// CHECK-SYSROOTEQ: "-cc1"{{.*}} "-isysroot" "/FOO"

// Apple Darwin uses -isysroot as the syslib root, too.
// RUN: touch %t2.o
// RUN: %clang -ccc-host-triple i386-apple-darwin10 \
// RUN:   -isysroot /FOO -### %t2.o 2> %t2
// RUN: FileCheck --check-prefix=CHECK-APPLE-ISYSROOT < %t2 %s
// CHECK-APPLE-ISYSROOT: "-arch" "i386"{{.*}} "-syslibroot" "/FOO"

// Check that honor --sysroot= over -isysroot, for Apple Darwin.
// RUN: touch %t3.o
// RUN: %clang -ccc-host-triple i386-apple-darwin10 \
// RUN:   -isysroot /FOO --sysroot=/BAR -### %t3.o 2> %t3
// RUN: FileCheck --check-prefix=CHECK-APPLE-SYSROOT < %t3 %s
// CHECK-APPLE-SYSROOT: "-arch" "i386"{{.*}} "-syslibroot" "/BAR"

// Check that --sysroot= also applies to header search paths.
// RUN: %clang -ccc-host-triple i386-unk-unk --sysroot=/FOO -### -E %s 2> %t1
// RUN: FileCheck --check-prefix=CHECK-SYSROOTEQ < %t1 %s
// CHECK-SYSROOTEQ: "-cc1"{{.*}} "-isysroot" "/FOO"

// Apple Darwin uses -isysroot as the syslib root, too.
// RUN: touch %t2.o
// RUN: %clang -ccc-host-triple i386-apple-darwin10 \
// RUN:   -isysroot /FOO -### %t2.o 2> %t2
// RUN: FileCheck --check-prefix=CHECK-APPLE-ISYSROOT < %t2 %s
// CHECK-APPLE-ISYSROOT: "-arch" "i386"{{.*}} "-syslibroot" "/FOO"

// Check that honor --sysroot= over -isysroot, for Apple Darwin.
// RUN: touch %t3.o
// RUN: %clang -ccc-host-triple i386-apple-darwin10 \
// RUN:   -isysroot /FOO --sysroot=/BAR -### %t3.o 2> %t3
// RUN: FileCheck --check-prefix=CHECK-APPLE-SYSROOT < %t3 %s
// CHECK-APPLE-SYSROOT: "-arch" "i386"{{.*}} "-syslibroot" "/BAR"

tests: Tweak test to at least use a standard arch, to ensure we try to invoke
Clang.

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


#ifndef __TYPES_H__
#define __TYPES_H__

typedef long        off_t;
typedef unsigned long size_t;
typedef signed long   ssize_t;      /* Used for a count of bytes or an error indication. */

typedef unsigned char  u_char;
typedef unsigned short u_short;
typedef unsigned int   u_int;
typedef unsigned long  u_long;

typedef int mode_t;

typedef unsigned long clockid_t;
typedef int pid_t;

typedef	unsigned long clock_t; /* clock() */

#ifndef NULL
#define NULL        (0)
#endif

#define __u_char_defined

#endif

#ifndef __TYPES_H__
#define __TYPES_H__

typedef long        off_t;
typedef unsigned long size_t;
typedef signed long   ssize_t;      /* Used for a count of bytes or an error indication. */

typedef unsigned char  u_char;
typedef unsigned short u_short;
typedef unsigned int   u_int;
typedef unsigned long  u_long;

typedef int mode_t;

typedef unsigned long clockid_t;
typedef int pid_t;

typedef int gid_t;
typedef int uid_t;
typedef int dev_t;
typedef int ino_t;
typedef int mode_t;
typedef int caddr_t;

typedef unsigned int wint_t;
typedef unsigned long useconds_t;

typedef	unsigned long clock_t; /* clock() */

#ifndef NULL
#define NULL        (0)
#endif

#define __u_char_defined

#endif

Add more typedef in minilibc.

[libc] Add more typedef in minilibc.


/*
 OLEContainerScrollView

 Copyright (c) 2014 Ole Begemann.
 https://github.com/ole/OLEContainerScrollView
 */

void swizzleUICollectionViewLayoutFinalizeCollectionViewUpdates();
void swizzleUITableView();

/*
 OLEContainerScrollView

 Copyright (c) 2014 Ole Begemann.
 https://github.com/ole/OLEContainerScrollView
 */

void swizzleUICollectionViewLayoutFinalizeCollectionViewUpdates(void);
void swizzleUITableView(void);

Fix compiler warning in Xcode 9

Fix compiler warning in Xcode 9


//
//  INVector3.h
//  DominantColor
//
//  Created by Indragie on 12/21/14.
//  Copyright (c) 2014 Indragie Karunaratne. All rights reserved.
//

#import <GLKit/GLKit.h>

// Wrapping GLKVector3 values in a struct so that it can be used from Swift.

typedef struct {
    float x;
    float y;
    float z;
} INVector3;

GLKVector3 INVector3ToGLKVector3(INVector3 vector);
INVector3 GLKVector3ToINVector3(GLKVector3 vector);

INVector3 INVector3Add(INVector3 v1, INVector3 v2);
INVector3 INVector3DivideScalar(INVector3 vector, float scalar);

Remove function declarations from header


/* * This file is part of meego-im-framework *
 *
 * Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 * All rights reserved.
 * Contact: Nokia Corporation (directui@nokia.com)
 *
 * If you have questions regarding the use of this file, please contact
 * Nokia at directui@nokia.com.
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License version 2.1 as published by the Free Software Foundation
 * and appearing in the file LICENSE.LGPL included in the packaging
 * of this file.
 */

#ifndef CORE_UTILS_H__
#define CORE_UTILS_H__

#include <QString>
#include <QObject>

namespace MaliitTestUtils {

    bool isTestingInSandbox();
    QString getTestPluginPath();
    QString getTestDataPath();
    void waitForSignal(const QObject* object, const char* signal, int timeout);
    void waitAndProcessEvents(int waitTime);
}

#endif // CORE_UTILS_H__

/* * This file is part of meego-im-framework *
 *
 * Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
 * All rights reserved.
 * Contact: Nokia Corporation (directui@nokia.com)
 *
 * If you have questions regarding the use of this file, please contact
 * Nokia at directui@nokia.com.
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License version 2.1 as published by the Free Software Foundation
 * and appearing in the file LICENSE.LGPL included in the packaging
 * of this file.
 */

#ifndef CORE_UTILS_H__
#define CORE_UTILS_H__

#include <QString>
#include <QObject>

#include "abstractsurfacegroup.h"
#include "abstractsurfacegroupfactory.h"

namespace MaliitTestUtils {

    bool isTestingInSandbox();
    QString getTestPluginPath();
    QString getTestDataPath();
    void waitForSignal(const QObject* object, const char* signal, int timeout);
    void waitAndProcessEvents(int waitTime);

    class TestSurfaceGroup : public Maliit::Server::AbstractSurfaceGroup {
    public:
        TestSurfaceGroup() {}

        Maliit::Plugins::AbstractSurfaceFactory *factory() { return 0; }

        void activate() {}
        void deactivate() {}

        void setRotation(Maliit::OrientationAngle) {}
    };

    class TestSurfaceGroupFactory : public Maliit::Server::AbstractSurfaceGroupFactory {
    public:
        TestSurfaceGroupFactory() {}

        QSharedPointer<Maliit::Server::AbstractSurfaceGroup> createSurfaceGroup()
        {
            return QSharedPointer<Maliit::Server::AbstractSurfaceGroup>(new TestSurfaceGroup);
        }
    };
}

#endif // CORE_UTILS_H__

Add surface server side implementation for tests

Add a TestSurfaceGroup and TestSurfaceGroupFactory class for tests.

RevBy: TrustMe.

Full, original commit at 4dc9c4567301f2481b12965bdcf02a7281963b61 in maliit-framework


#ifndef QTIPCSERVER_H
#define QTIPCSERVER_H

// Define Bitcoin-Qt message queue name
#define BITCOINURI_QUEUE_NAME "BitcoinURI"

void ipcScanRelay(int argc, char *argv[]);
void ipcInit(int argc, char *argv[]);

#endif // QTIPCSERVER_H

#ifndef QTIPCSERVER_H
#define QTIPCSERVER_H

// Define Bitcoin-Qt message queue name
#define BITCOINURI_QUEUE_NAME "NovaCoinURI"

void ipcScanRelay(int argc, char *argv[]);
void ipcInit(int argc, char *argv[]);

#endif // QTIPCSERVER_H

Set correct name for boost IPC

Set correct name for boost IPC


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

#include <unistd.h>

#include "sample.h"

int
main (int argc, char ** argv)
{
  printf ("%d\n", compute_sample (5));
  exit (0);
}

#include "sample.h"
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>

int
main (int argc, char ** argv)
{
  printf ("%d\n", compute_sample (5));
  exit (0);
}

Clean up the sample include orderings, not that it really matters...

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


// RUN: clang -emit-llvm-bc -o - %s | opt -std-compile-opts | llvm-dis | grep "ret i32 1" | count 3
// <rdr://6115726>

int f0() {
  int x;
  unsigned short n = 1;
  int *a = &x;
  int *b = &x;
  a = a - n;
  b -= n;
  return a == b;
}

int f1(int *a) {
  int b = a - (int*) 1;
  a -= (int*) 1;
  return b == (int) a;
}

int f2(int n) {
  int *b = n + (int*) 1;
  n += (int*) 1;
  return b == (int*) n;
}

// RUN: clang -emit-llvm-bc -o - %s | opt -std-compile-opts | llvm-dis | grep "ret i32 1" | count 3
// <rdr://6115726>

int f0() {
  int x;
  unsigned short n = 1;
  int *a = &x;
  int *b = &x;
  a = a - n;
  b -= n;
  return a == b;
}

int f1(int *a) {
  long b = a - (int*) 1;
  a -= (int*) 1;
  return b == (long) a;
}

int f2(long n) {
  int *b = n + (int*) 1;
  n += (int*) 1;
  return b == (int*) n;
}

Fix testcase for 64-bit systems.

Fix testcase for 64-bit systems.

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


typedef CI_Config void*;

CI_Result CI_submit(char const* input);

/*
 * C Interface between calcterm and a calculator.
 * A shared library must implement this interface
 * to be loadable by calcterm.
 */

extern "C" {

struct CI_Config {
    int flag;
};

struct CI_Result {
    char*  one_line;
    char** grid;
    int    y;
};

void         CI_init( CI_Config* config );
CI_Result*   CI_submit( char const* input );
void         CI_result_release( CI_Result* result );

} /* extern "C" */

Add a basic interface for calcterm

Add a basic interface for calcterm


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

#ifndef __ZEPHYR_CHROME_I2C_MAP_H
#define __ZEPHYR_CHROME_I2C_MAP_H

#include <devicetree.h>

#include "config.h"

/* We need registers.h to get the chip specific defines for now */
#include "registers.h"

#define I2C_PORT_ACCEL          I2C_PORT_SENSOR
#define I2C_PORT_SENSOR         NPCX_I2C_PORT0_0
#define I2C_PORT_USB_C0		NPCX_I2C_PORT1_0
#define I2C_PORT_USB_C1		NPCX_I2C_PORT2_0
#define I2C_PORT_USB_1_MIX	NPCX_I2C_PORT3_0
#define I2C_PORT_POWER		NPCX_I2C_PORT5_0
#define I2C_PORT_EEPROM		NPCX_I2C_PORT7_0

#define I2C_ADDR_EEPROM_FLAGS	0x50

#endif /* __ZEPHYR_CHROME_I2C_MAP_H */

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

#ifndef __ZEPHYR_CHROME_I2C_MAP_H
#define __ZEPHYR_CHROME_I2C_MAP_H

#include <devicetree.h>

#include "config.h"

/* We need registers.h to get the chip specific defines for now */
#include "i2c/i2c.h"

#define I2C_PORT_ACCEL          I2C_PORT_SENSOR
#define I2C_PORT_SENSOR         NAMED_I2C(sensor)
#define I2C_PORT_USB_C0		NAMED_I2C(usb_c0)
#define I2C_PORT_USB_C1		NAMED_I2C(usb_c1)
#define I2C_PORT_USB_1_MIX	NAMED_I2C(usb1_mix)
#define I2C_PORT_POWER		NAMED_I2C(power)
#define I2C_PORT_EEPROM		NAMED_I2C(eeprom)

#define I2C_ADDR_EEPROM_FLAGS	0x50

#endif /* __ZEPHYR_CHROME_I2C_MAP_H */

volteer: Remove dependency on npcx specific registers

This change removes the dependency on the npcx specific headers
which are normally included via registers.h. It instead transitions
to relying on i2c/i2c.h which defines various enums and the
NAMED_I2C macro.

BUG=b:175249000
TEST=zmake testall

Cq-Depend: chromium:2582819
Change-Id: I7d8e98cc4228496b0c7603c0794eb92e0f79c01d
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/zephyr-chrome/+/2583272
Tested-by: Jack Rosenthal <d3f605bef1867f59845d4ce6e4f83b8dc9e4e0ae@chromium.org>
Reviewed-by: Jack Rosenthal <d3f605bef1867f59845d4ce6e4f83b8dc9e4e0ae@chromium.org>
Commit-Queue: Jack Rosenthal <d3f605bef1867f59845d4ce6e4f83b8dc9e4e0ae@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2630155
Reviewed-by: Simon Glass <c00b0378376498bd9cd974c388df8854c0131d27@chromium.org>


#include <tinyara/config.h>
#include <tinyara/kmalloc.h>

/****************************************************************************
 * Name: up_addregion
 *
 * Description:
 *   Memory may be added in non-contiguous chunks.  Additional chunks are
 *   added by calling this function.
 *
 ****************************************************************************/

#if CONFIG_MM_REGIONS > 1
void up_addregion(void)
{
    kumm_addregion((FAR void *)CONFIG_HEAP2_BASE, CONFIG_HEAP2_SIZE);

}
#endif

Add RDA5981x D_SRAM for heap usage, test program also attached

Signed-off-by: Tianfu Huang <51883963465061bbce1ec7188dc31b693276da5b@samsung.com>


// PARAM: --set ana.activated[+] thread
#include <pthread.h>
#include <stdio.h>

int myglobal;
pthread_mutex_t A = PTHREAD_MUTEX_INITIALIZER;
pthread_mutex_t B = PTHREAD_MUTEX_INITIALIZER;

void *f1(void *arg) {
  pthread_mutex_lock(&A);
  myglobal=1; // RACE! (with just 4)
  pthread_mutex_unlock(&A);
  pthread_mutex_lock(&B);
  myglobal=2; // RACE! (with just 3)
  pthread_mutex_unlock(&B);
  return NULL;
}

void *f2(void *arg) {
  pthread_mutex_lock(&A);
  myglobal=3; // RACE! (with just 2)
  pthread_mutex_unlock(&A);
  pthread_mutex_lock(&B);
  myglobal=4; // RACE! (with just 1)
  pthread_mutex_unlock(&B);
  return NULL;
}

int main(void) {
  pthread_t t1, t2;
  pthread_create(&t1, NULL, f1, NULL);
  pthread_create(&t2, NULL, f2, NULL);
  return 0;
}

Add test where race warnings can be grouped


#ifndef SSPAPPLICATION_GAMESTATES_GAMESTATEHANDLER_H
#define SSPAPPLICATION_GAMESTATES_GAMESTATEHANDLER_H
#include "GameState.h"
#include "StartState.h"
#include "LevelSelectState.h"
#include <vector>

//#define START_WITHOUT_MENU

class GameStateHandler
{
private:
	std::vector<GameState*> m_stateStack;
	std::vector<GameState*> m_statesToRemove;
public:
	GameStateHandler();
	~GameStateHandler();

	int ShutDown();

	int Initialize(ComponentHandler* cHandler, Camera* cameraRef);

	int Update(float dt, InputHandler* inputHandler);

	//Push a state to the stack
	int PushStateToStack(GameState* state);
private:
};

#endif

#ifndef SSPAPPLICATION_GAMESTATES_GAMESTATEHANDLER_H
#define SSPAPPLICATION_GAMESTATES_GAMESTATEHANDLER_H
#include "GameState.h"
#include "StartState.h"
#include "LevelSelectState.h"
#include <vector>

#define START_WITHOUT_MENU

class GameStateHandler
{
private:
	std::vector<GameState*> m_stateStack;
	std::vector<GameState*> m_statesToRemove;
public:
	GameStateHandler();
	~GameStateHandler();

	int ShutDown();

	int Initialize(ComponentHandler* cHandler, Camera* cameraRef);

	int Update(float dt, InputHandler* inputHandler);

	//Push a state to the stack
	int PushStateToStack(GameState* state);
private:
};

#endif

UPDATE defined start without menu

UPDATE defined start without menu


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

#include <stdlib.h>

#include "native_client/src/include/portability.h"
#include "native_client/src/shared/platform/nacl_exit.h"
#include "native_client/src/trusted/service_runtime/nacl_signal.h"

void NaClAbort(void) {
#ifdef COVERAGE
  /* Give coverage runs a chance to flush coverage data */
  exit((-SIGABRT) & 0xFF);
#else
  /* Return an 8 bit value for SIGABRT */
  TerminateProcess(GetCurrentProcess(),(-SIGABRT) & 0xFF);
#endif
}

void NaClExit(int err_code) {
#ifdef COVERAGE
  /* Give coverage runs a chance to flush coverage data */
  exit(err_code);
#else
  TerminateProcess(GetCurrentProcess(), err_code);
#endif
}

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

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

#include "native_client/src/include/portability.h"
#include "native_client/src/shared/platform/nacl_exit.h"
#include "native_client/src/trusted/service_runtime/nacl_signal.h"

void NaClAbort(void) {
  NaClExit(-SIGABRT);
}

void NaClExit(int err_code) {
#ifdef COVERAGE
  /* Give coverage runs a chance to flush coverage data */
  exit(err_code);
#else
  /* If the process is scheduled for termination, wait for it.*/
  if (TerminateProcess(GetCurrentProcess(), err_code)) {
    printf("Terminate passed, but returned.\n");
    while(1);
  }
  printf("Terminate failed with %d.\n", GetLastError());

  /* Otherwise use the standard C process exit to bybass destructors. */
  ExitProcess(err_code);
#endif
}

Fix exit issue on Vista/Win7Atom

Fix exit issue on Vista/Win7Atom

TerminateProcess returns causing "exit" to fall through.   This is causing the buildbots
to go red.  To fix this, We must add a check to verify termination was scheduled, then
loop.  As a seperate CL we should find a way to do this without allowing a return
on an untrusted stack.

BUG= nacl1618
TEST= buildbot
Review URL: http://codereview.chromium.org/6804029

git-svn-id: 721b910a23eff8a86f00c8fd261a7587cddf18f8@4774 fcba33aa-ac0c-11dd-b9e7-8d5594d729c2


//
//  INPopoverControllerDefines.h
//  Copyright 2011-2014 Indragie Karunaratne. All rights reserved.
//

typedef NS_ENUM(NSUInteger, INPopoverArrowDirection) {
	INPopoverArrowDirectionUndefined = 0,
	INPopoverArrowDirectionLeft = NSMaxXEdge,
	INPopoverArrowDirectionRight = NSMinXEdge,
	INPopoverArrowDirectionUp = NSMaxYEdge,
	INPopoverArrowDirectionDown = NSMinYEdge
};

typedef NS_ENUM(NSInteger, INPopoverAnimationType) {
	INPopoverAnimationTypePop = 0,	// Pop animation similar to NSPopover
	INPopoverAnimationTypeFadeIn,	// Fade in only, no fade out
	INPopoverAnimationTypeFadeOut,	// Fade out only, no fade in
	INPopoverAnimationTypeFadeInOut // Fade in and out
};

//
//  INPopoverControllerDefines.h
//  Copyright 2011-2014 Indragie Karunaratne. All rights reserved.
//

typedef NS_ENUM(NSUInteger, INPopoverArrowDirection) {
	INPopoverArrowDirectionUndefined = 0,
	INPopoverArrowDirectionLeft,
	INPopoverArrowDirectionRight,
	INPopoverArrowDirectionUp,
	INPopoverArrowDirectionDown
};

typedef NS_ENUM(NSInteger, INPopoverAnimationType) {
	INPopoverAnimationTypePop = 0,	// Pop animation similar to NSPopover
	INPopoverAnimationTypeFadeIn,	// Fade in only, no fade out
	INPopoverAnimationTypeFadeOut,	// Fade out only, no fade in
	INPopoverAnimationTypeFadeInOut // Fade in and out
};

Remove references to NS...Edge in enum

Remove references to NS...Edge in enum


#import <Foundation/Foundation.h>

/**
 STWServiceCall is the domain model class which represents the Straw Service Call from Browser.
 */
@interface STWServiceCall : NSObject

/** Service name to call */
@property (nonatomic, retain) NSString *service;

/** Service Method name to call */
@property (nonatomic, retain) NSString *method;

/** Service Method paramter to call */
@property (nonatomic, retain) NSDictionary *params;

/** id of the Service Method call */
@property (nonatomic, retain) NSNumber *callId;

/**
 Return the selector's name.

 @return the selector's name
 */
- (NSString *)selectorName;

/**
 Return the selector corresponding to the method.

 @return the selector corresponding to the method
 */
- (SEL)selector;

@end

#import <Foundation/Foundation.h>

/**
 STWServiceCall is the domain model class which represents the Straw Service Call from Browser.
 */
@interface STWServiceCall : NSObject

/** Service name to call */
@property (nonatomic, retain) NSString *service;

/** Service Method name to call */
@property (nonatomic, retain) NSString *method;

/** Service Method paramter to call */
@property (nonatomic, retain) NSDictionary *params;

/** id of the Service Method call */
@property (nonatomic, retain) NSString *callId;

/**
 Return the selector's name.

 @return the selector's name
 */
- (NSString *)selectorName;

/**
 Return the selector corresponding to the method.

 @return the selector corresponding to the method
 */
- (SEL)selector;

@end

Change the type of callId property

Change the type of callId property


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

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

Update Skia milestone to 76

Update Skia milestone to 76

Change-Id: I146f97bd27d17bffd51fc572ecee84552b238e20
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/209160
Reviewed-by: Heather Miller <2e22000c5d22374561fe5fba576a31095b72dc2e@google.com>
Commit-Queue: Heather Miller <2e22000c5d22374561fe5fba576a31095b72dc2e@google.com>
Auto-Submit: Heather Miller <2e22000c5d22374561fe5fba576a31095b72dc2e@google.com>


//
//  BFTaskCenter.h
//  Pods
//
//  Created by Superbil on 2015/8/22.
//
//

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

@interface BFTaskCenter : NSObject

+ (nonnull instancetype)defaultCenter;

- (nullable id)addTaskBlockToCallbacks:(nonnull BFContinuationBlock)taskBlock forKey:(nonnull NSString *)key;
- (void)removeTaskBlock:(nonnull id)taskBlock forKey:(nonnull NSString *)key;
- (void)clearAllCallbacksForKey:(nonnull NSString *)key;

- (void)sendToCallbacksWithKey:(nonnull NSString *)key result:(nullable id)result;
- (void)sendToCallbacksWithKey:(nonnull NSString *)key error:(nonnull NSError *)error;

- (nonnull BFTaskCompletionSource *)sourceOfSendToCallbacksForKey:(nonnull NSString *)key
                                                         executor:(nonnull BFExecutor *)executor
                                                cancellationToken:(nullable BFCancellationToken *)cancellationToken;

@end

//
//  BFTaskCenter.h
//  Pods
//
//  Created by Superbil on 2015/8/22.
//
//

#import "Bolts.h"

@interface BFTaskCenter : NSObject

+ (nonnull instancetype)defaultCenter;

- (nullable id)addTaskBlockToCallbacks:(nonnull BFContinuationBlock)taskBlock forKey:(nonnull NSString *)key;
- (void)removeTaskBlock:(nonnull id)taskBlock forKey:(nonnull NSString *)key;
- (void)clearAllCallbacksForKey:(nonnull NSString *)key;

- (void)sendToCallbacksWithKey:(nonnull NSString *)key result:(nullable id)result;
- (void)sendToCallbacksWithKey:(nonnull NSString *)key error:(nonnull NSError *)error;

- (nullable BFTaskCompletionSource *)sourceOfSendToCallbacksForKey:(nonnull NSString *)key
                                                          executor:(nonnull BFExecutor *)executor
                                                 cancellationToken:(nullable BFCancellationToken *)cancellationToken;

@end

Fix wrong header for sourceOfSendToCallbacksForKey


#pragma once
#ifndef YOU_DATASTORE_DATASTORE_H_
#define YOU_DATASTORE_DATASTORE_H_

#include <deque>
#include <functional>
#include "boost/variant.hpp"
#include "task_typedefs.h"
#include "internal/operation.h"
#include "transaction.h"

namespace You {
namespace DataStore {
namespace UnitTests {}

class DataStore {
public:
	Transaction&& begin();

	// Modifying methods
	bool post(TaskId, SerializedTask&);
	bool put(TaskId, SerializedTask&);
	bool erase(TaskId);

	std::vector<SerializedTask> getAllTask();

private:
	static DataStore& get();
	bool isServing = false;
	std::deque<Internal::IOperation> operationsQueue;
};
}  // namespace DataStore
}  // namespace You
#endif  // YOU_DATASTORE_DATASTORE_H_

#pragma once
#ifndef YOU_DATASTORE_DATASTORE_H_
#define YOU_DATASTORE_DATASTORE_H_

#include <deque>
#include <functional>
#include "boost/variant.hpp"
#include "task_typedefs.h"
#include "internal/operation.h"
#include "transaction.h"

namespace You {
namespace DataStore {
namespace UnitTests {}

class DataStore {
public:
	Transaction && begin();

	// Modifying methods
	bool post(TaskId, SerializedTask&);
	bool put(TaskId, SerializedTask&);
	bool erase(TaskId);

	std::vector<SerializedTask> getAllTask();

private:
	static DataStore& get();
	bool isServing = false;
	std::deque<Internal::IOperation> operationsQueue;
};
}  // namespace DataStore
}  // namespace You
#endif  // YOU_DATASTORE_DATASTORE_H_

Fix lint error, whitespace around &&

Fix lint error, whitespace around &&


#pragma once

#include <boost/variant.hpp>
#include <atomic>
#include <vector>

namespace grml
{
    enum class BasicType
    {
        INT,
        BOOL,
        REAL
    };

    struct TypeVariable
    {
        int64_t id;

        TypeVariable() : id(counter++) {}
        TypeVariable(int64_t i) : id(i) {}

        friend bool operator==(const TypeVariable& lhs, const TypeVariable& rhs)
        {
            return lhs.id == rhs.id;
        }
    private:
        static std::atomic_int64_t counter;
    };

    struct FunctionType;

    using Type = boost::variant<
        BasicType,
        TypeVariable,
        boost::recursive_wrapper<FunctionType>
    >;

    struct FunctionType
    {
        using Parameters = std::vector<Type>;

        Type result;
        Parameters parameters;

        FunctionType(Type r, Parameters ps) : result(std::move(r)), parameters(std::move(ps)) {}

        friend bool operator==(const FunctionType& lhs, const FunctionType& rhs)
        {
            return lhs.result == rhs.result && lhs.parameters == rhs.parameters;
        }
    };
}

#pragma once

#include <boost/variant.hpp>
#include <atomic>
#include <vector>
#include <unordered_map>

namespace grml
{
    enum class BasicType
    {
        INT,
        BOOL,
        REAL
    };

    struct TypeVariable
    {
        int64_t id;

        TypeVariable() : id(counter++) {}
        TypeVariable(int64_t i) : id(i) {}

        friend bool operator==(const TypeVariable& lhs, const TypeVariable& rhs)
        {
            return lhs.id == rhs.id;
        }
    private:
        static std::atomic_int64_t counter;
    };

    struct FunctionType;

    using Type = boost::variant<
        BasicType,
        TypeVariable,
        boost::recursive_wrapper<FunctionType>
    >;

    struct FunctionType
    {
        using Parameters = std::vector<Type>;

        Type result;
        Parameters parameters;

        FunctionType(Type r, Parameters ps) : result(std::move(r)), parameters(std::move(ps)) {}

        friend bool operator==(const FunctionType& lhs, const FunctionType& rhs)
        {
            return lhs.result == rhs.result && lhs.parameters == rhs.parameters;
        }
    };

    struct TypeVariableHasher
    {
        std::size_t operator()(const TypeVariable& tv) const
        {
            return tv.id;
        }
    };

    using Substitution = std::unordered_map<TypeVariable, Type, TypeVariableHasher>;

    Substitution unify(const Type& lhs, const Type& rhs);
    Substitution combine(const Substitution& lhs, const Substitution& rhs);
    Type substitute(const Type& type, const Substitution& substitution);
}

Add unify combine substitute stubs

Add unify combine substitute stubs


#ifndef CMDLINE_H
#define CMDLINE_H

typedef struct cmdOptions{
  int populationSize;
  int geneSize;
}cmdoptions_t;

class CMDLINE
{
  int argc;
  char *argv[];
public:
  CMDLINE (int, char**);    // Constructor
  int parseCommandLine(cmdoptions_t *CMDoptions);

private:
  // Function like help and version
  int help();
  int version();
};

#endif

Add the class 'CMDLINE'. So the user is able to change default setting.


#include <arch/x64/port.h>
#include <truth/panic.h>

#define TEST_RESULT_PORT_NUMBER 0xf4

void test_shutdown_status(enum status status) {
    logf(Log_Debug, "Test shutting down with status %s (%d)\n", status_message(status), status);
    write_port(status, TEST_RESULT_PORT_NUMBER);
    halt();
    assert(Not_Reached);
}

#include <arch/x64/port.h>
#include <truth/panic.h>

#define Test_Result_Port_Number 0xf4

void test_shutdown_status(enum status status) {
    logf(Log_Debug, "Test shutting down with status %s (%d)\n", status_message(status), status);
    write_port(status, Test_Result_Port_Number);
}

Exit with a code in debug builds

Exit with a code in debug builds


#include <errno.h>
#include <signal.h>
#include <string.h>
#include <unistd.h>
#include <stdbool.h>

#include <arpa/inet.h>
#include <netinet/in.h>
#include <sys/socket.h>
#include <sys/types.h>

#include <glib.h>

#include "td-radio.h"
#include "td-radio-scan.h"

/*
 * Send the RESPONDER message to the radio.
 */
int radio_read(int fd, char* buffer)
{
	bool debug = true;
	int bytes = 0;

	memset(buffer, '\0', BUFFER_SZ);

	if (debug) {
		g_message("radio_read(): enter");
		g_message("\ts_addr = %d", radio_address.sin_addr.s_addr);
		g_message("\tsin_port = %d", radio_address.sin_port);
	}

	socklen_t socklen = sizeof(radio_address);

	bytes = recvfrom(fd, buffer, BUFFER_SZ, 0,
		(struct sockaddr *) &radio_address, &socklen);

	if (debug) {
		g_message("bytes = %d", bytes);
	}

	if (bytes < 0) {
		g_warning("\tradio_read(): recvfrom failed, %s", strerror(errno));
		g_message("\tradio_read(): exit");
	}

	if (debug) {
		g_message("radio_read(): exit");
	}

	return bytes;
}

#include <errno.h>
#include <signal.h>
#include <string.h>
#include <unistd.h>
#include <stdbool.h>

#include <arpa/inet.h>
#include <netinet/in.h>
#include <sys/socket.h>
#include <sys/types.h>

#include <glib.h>

#include "td-radio.h"
#include "td-radio-scan.h"

/*
 * Send the RESPONDER message to the radio.
 */
int radio_read(int fd, char* buffer)
{
	bool debug = false;
	int bytes = 0;

	memset(buffer, '\0', BUFFER_SZ);

	socklen_t socklen = sizeof(radio_address);

	bytes = recvfrom(fd, buffer, BUFFER_SZ, 0, 0, 0);

	if (bytes < 0) {
		g_warning("\tradio_read(): recvfrom failed, %s", strerror(errno));
		g_error("\tradio_read(): exiting...");
	}

	return bytes;
}

Clean up some debugging cruft.

Clean up some debugging cruft.


#define ASSERT(x) \
    do{ \
        if(!(x)){ \
            printf("failed assert (%d): %s\n", __LINE__,  #x); \
            exit(1); \
        }\
    }while(0)

#define INIT_SOCKETS_FOR_WINDOWS \
    { \
        WSADATA out; \
        WSAStartup(MAKEWORD(2,2), &out); \
    }

#include <stdlib.h>

#define ASSERT(x) \
    do{ \
        if(!(x)){ \
            printf("failed assert (%d): %s\n", __LINE__,  #x); \
            exit(1); \
        }\
    }while(0)

#ifdef _WIN32
#define INIT_SOCKETS_FOR_WINDOWS \
    do{ \
        WSADATA out; \
        WSAStartup(MAKEWORD(2,2), &out); \
    } while(0)
#else
#define INIT_SOCKETS_FOR_WINDOWS do {} while(0)
#endif

Make everything work on linux again

Make everything work on linux again


#ifndef RANDOM_HAO
#define RANDOM_HAO

#define SIMPLE_SPRNG

#ifdef MPI_HAO
#include <mpi.h>
#define USE_MPI
#endif

#include "sprng.h"

void random_hao_init(int seed=985456376, int gtype=1);
double uniform_hao();
double gaussian_hao();

#endif

#ifndef RANDOM_HAO_H
#define RANDOM_HAO_H

#define SIMPLE_SPRNG

#ifdef MPI_HAO
#include <mpi.h>
#define USE_MPI
#endif

#include "sprng.h"

void random_hao_init(int seed=985456376, int gtype=1);
double uniform_hao();
double gaussian_hao();

#endif

Set the header protection to end with _H.


/*
 * Copyright 2019-2020 The OpenSSL Project Authors. All Rights Reserved.
 *
 * Licensed under the Apache License 2.0 (the "License").  You may not use
 * this file except in compliance with the License.  You can obtain a copy
 * in the file LICENSE in the source distribution or at
 * https://www.openssl.org/source/license.html
 */

#include <openssl/rc5.h>
#include "prov/ciphercommon.h"

typedef struct prov_blowfish_ctx_st {
    PROV_CIPHER_CTX base;      /* Must be first */
    union {
        OSSL_UNION_ALIGN;
        RC5_32_KEY ks;         /* key schedule */
    } ks;
    unsigned int rounds;       /* number of rounds */
} PROV_RC5_CTX;

const PROV_CIPHER_HW *ossl_prov_cipher_hw_rc5_cbc(size_t keybits);
const PROV_CIPHER_HW *ossl_prov_cipher_hw_rc5_ecb(size_t keybits);
const PROV_CIPHER_HW *ossl_prov_cipher_hw_rc5_ofb64(size_t keybits);
const PROV_CIPHER_HW *ossl_prov_cipher_hw_rc5_cfb64(size_t keybits);

/*
 * Copyright 2019-2020 The OpenSSL Project Authors. All Rights Reserved.
 *
 * Licensed under the Apache License 2.0 (the "License").  You may not use
 * this file except in compliance with the License.  You can obtain a copy
 * in the file LICENSE in the source distribution or at
 * https://www.openssl.org/source/license.html
 */

#include <openssl/rc5.h>
#include "prov/ciphercommon.h"

typedef struct prov_rc5_ctx_st {
    PROV_CIPHER_CTX base;      /* Must be first */
    union {
        OSSL_UNION_ALIGN;
        RC5_32_KEY ks;         /* key schedule */
    } ks;
    unsigned int rounds;       /* number of rounds */
} PROV_RC5_CTX;

const PROV_CIPHER_HW *ossl_prov_cipher_hw_rc5_cbc(size_t keybits);
const PROV_CIPHER_HW *ossl_prov_cipher_hw_rc5_ecb(size_t keybits);
const PROV_CIPHER_HW *ossl_prov_cipher_hw_rc5_ofb64(size_t keybits);
const PROV_CIPHER_HW *ossl_prov_cipher_hw_rc5_cfb64(size_t keybits);

Fix PROV_RC5_CTX's original structure name

It looks like a typo when copy & pasting the structure from blowfish.

Reviewed-by: Shane Lontis <452ce16516ceed26291fe7de3f8b53540d83864e@oracle.com>
Reviewed-by: Richard Levitte <5fb523282dd7956571c80524edc2dccfa0bd8234@openssl.org>
Reviewed-by: Tomas Mraz <2bc6038c3dfca09b2da23c8b6da8ba884dc2dcc2@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/19186)


/* liblouis Braille Translation and Back-Translation  Library

   Copyright (C) 2014 ViewPlus Technologies, Inc. www.viewplus.com
   and the liblouis team. http://liblouis.org
   All rights reserved

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

   This file 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
   Library GNU General Public License for more details.

   You should have received a copy of the Library GNU General Public
   License along with this program; see the file COPYING.  If not, write to
   the Free Software Foundation, 51 Franklin Street, Fifth Floor,
   Boston, MA 02110-1301, USA.
   */

#define PACKAGE_VERSION "liblouis-2.5.2"

/* liblouis Braille Translation and Back-Translation  Library

   Copyright (C) 2014 ViewPlus Technologies, Inc. www.viewplus.com
   and the liblouis team. http://liblouis.org
   All rights reserved

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

   This file 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
   Library GNU General Public License for more details.

   You should have received a copy of the Library GNU General Public
   License along with this program; see the file COPYING.  If not, write to
   the Free Software Foundation, 51 Franklin Street, Fifth Floor,
   Boston, MA 02110-1301, USA.
   */

#define PACKAGE_VERSION "liblouis-2.6.3"

Update the version number in the windows directory


#include <glib/gtestutils.h>
#include <json-glib/json-types.h>
#include <string.h>

static void
test_null (void)
{
  JsonNode *node = json_node_new (JSON_NODE_NULL);

  g_assert_cmpint (node->type, ==, JSON_NODE_NULL);
  g_assert_cmpint (json_node_get_value_type (node), ==, G_TYPE_INVALID);
  g_assert_cmpstr (json_node_type_name (node), ==, "NULL");

  json_node_free (node);
}

int
main (int   argc,
      char *argv[])
{
  g_type_init ();
  g_test_init (&argc, &argv, NULL);

  g_test_add_func ("/nodes/null-node", test_null);

  return g_test_run ();
}

#include <glib/gtestutils.h>
#include <json-glib/json-types.h>
#include <string.h>

static void
test_copy (void)
{
  JsonNode *node = json_node_new (JSON_NODE_NULL);
  JsonNode *copy = json_node_copy (node);

  g_assert_cmpint (node->type, ==, copy->type);
  g_assert_cmpint (json_node_get_value_type (node), ==, json_node_get_value_type (copy));
  g_assert_cmpstr (json_node_type_name (node), ==, json_node_type_name (copy));

  json_node_free (copy);
  json_node_free (node);
}

static void
test_null (void)
{
  JsonNode *node = json_node_new (JSON_NODE_NULL);

  g_assert_cmpint (node->type, ==, JSON_NODE_NULL);
  g_assert_cmpint (json_node_get_value_type (node), ==, G_TYPE_INVALID);
  g_assert_cmpstr (json_node_type_name (node), ==, "NULL");

  json_node_free (node);
}

int
main (int   argc,
      char *argv[])
{
  g_type_init ();
  g_test_init (&argc, &argv, NULL);

  g_test_add_func ("/nodes/null-node", test_null);
  g_test_add_func ("/nodes/copy-node", test_copy);

  return g_test_run ();
}

Add a JsonNode copy test unit

Add a JsonNode copy test unit

The test unit copies a NULL JsonNode and checks that the copy and the
original nodes are equivalent.