#ifndef __FEATURES_H
#define __FEATURES_H

/* Major and minor version number of the uCLibc library package.  Use
   these macros to test for features in specific releases.  */
#define	__UCLIBC__		0
#define	__UCLIBC_MAJOR__	9
#define	__UCLIBC_MINOR__	1

#ifdef __STDC__

#define __P(x) x
#define __const const

/* Almost ansi */
#if __STDC__ != 1
#define const
#define volatile
#endif

#else /* K&R */

#define __P(x) ()
#define __const
#define const
#define volatile

#endif

/* No C++ */
#define __BEGIN_DECLS
#define __END_DECLS

/* GNUish things */
#define __CONSTVALUE
#define __CONSTVALUE2

#define __USE_BSD
#define __USE_MISC
#define __USE_POSIX
#define __USE_POSIX2
#define _POSIX_THREAD_SAFE_FUNCTIONS

#include <sys/cdefs.h>

#endif

#ifndef __FEATURES_H
#define __FEATURES_H

/* Major and minor version number of the uCLibc library package.  Use
   these macros to test for features in specific releases.  */
#define	__UCLIBC__		0
#define	__UCLIBC_MAJOR__	9
#define	__UCLIBC_MINOR__	1

/* __restrict is known in EGCS 1.2 and above. */
#if !defined __GNUC__ || __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ <
	92)
# define __restrict     /* Ignore */
#endif

#ifdef __STDC__

#define __P(x) x
#define __const const

/* Almost ansi */
#if __STDC__ != 1
#define const
#define volatile
#endif

#else /* K&R */

#define __P(x) ()
#define __const
#define const
#define volatile

#endif

/* No C++ */
#define __BEGIN_DECLS
#define __END_DECLS

/* GNUish things */
#define __CONSTVALUE
#define __CONSTVALUE2

#define __USE_BSD
#define __USE_MISC
#define __USE_POSIX
#define __USE_POSIX2
#define _POSIX_THREAD_SAFE_FUNCTIONS

#include <sys/cdefs.h>

#endif

Remove __restrict when not supported -Erik


void __VERIFIER_error() { abort(); }

int __VERIFIER_nondet_int() { int val; return val; }

void __VERIFIER_error() { abort(); }

// Some files define __VERIFIER_assume, some declare as extern. What happens when redefined?
void __VERIFIER_assume(int expression) { if (!expression) { LOOP: goto LOOP; }; return; }

// #define __VERIFIER_nondet(X) X __VERIFIER_nondet_##X() { X val; return val; }
#define __VERIFIER_nondet2(X, Y) X __VERIFIER_nondet_##Y() { X val; return val; }
#define __VERIFIER_nondet(X) __VERIFIER_nondet2(X, X)

__VERIFIER_nondet2(_Bool, bool)
__VERIFIER_nondet(char)
__VERIFIER_nondet2(unsigned char, uchar)
// int __VERIFIER_nondet_int() { int val; return val; }
__VERIFIER_nondet(int)
__VERIFIER_nondet2(unsigned int, uint)
__VERIFIER_nondet(long)
__VERIFIER_nondet2(unsigned long, ulong)
// void* __VERIFIER_nondet_pointer() { void* val; return val; }
__VERIFIER_nondet2(void*, pointer)

Add more common __VERIFIER functions

Add more common __VERIFIER functions


// RUN: env QA_OVERRIDE_GCC3_OPTIONS="#+-Os +-Oz +-O +-O3 +-Oignore +a +b +c xb Xa Omagic ^-###  " %clang -target x86_64-apple-darwin %s -O2 b -O3 2>&1 | FileCheck %s
// RUN: env QA_OVERRIDE_GCC3_OPTIONS="x-Werror +-mfoo" %clang -target x86_64-apple-darwin -Werror %s -c -### 2>&1 | FileCheck %s -check-prefix=RM-WERROR

// CHECK: "-cc1"
// CHECK-NOT: "-Oignore"
// CHECK: "-Omagic"
// CHECK-NOT: "-Oignore"

// RM-WERROR: ### QA_OVERRIDE_GCC3_OPTIONS: x-Werror +-mfoo
// RM-WERROR-NEXT: ### Deleting argument -Werror
// RM-WERROR-NEXT: ### Adding argument -mfoo at end
// RM-WERROR: warning: argument unused during compilation: '-mfoo'
// RM-WERROR-NOT: "-Werror"

// RUN: env QA_OVERRIDE_GCC3_OPTIONS="#+-Os +-Oz +-O +-O3 +-Oignore +a +b +c xb Xa Omagic ^-###  " %clang -target x86_64-apple-darwin %s -O2 b -O3 2>&1 | FileCheck %s
// RUN: env QA_OVERRIDE_GCC3_OPTIONS="x-Werror +-msse" %clang -target x86_64-apple-darwin -Werror %s -c -### 2>&1 | FileCheck %s -check-prefix=RM-WERROR

// CHECK: "-cc1"
// CHECK-NOT: "-Oignore"
// CHECK: "-Omagic"
// CHECK-NOT: "-Oignore"

// RM-WERROR: ### QA_OVERRIDE_GCC3_OPTIONS: x-Werror +-msse
// RM-WERROR-NEXT: ### Deleting argument -Werror
// RM-WERROR-NEXT: ### Adding argument -msse at end
// RM-WERROR-NOT: "-Werror"

Use a valid option (-msse) for testing QA_OVERRIDE_GCC3_OPTIONS.

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


// Test that function entry counts are set correctly.

// RUN: llvm-profdata merge %S/Inputs/func-entry.proftext -o %t.profdata
// RUN: %clang %s -o - -mllvm -disable-llvm-optzns -emit-llvm -S -fprofile-instr-use=%t.profdata | FileCheck %s

void foo(void);

// CHECK: define void @foo() #0 !prof [[FOO:![0-9]+]]
void foo() { return; }

// CHECK: define i32 @main() #1 !prof [[MAIN:![0-9]+]]
int main() {
  int i;
  for (i = 0; i < 10000; i++) foo();
  return 0;
}

// CHECK: [[FOO]] = !{!"function_entry_count", i64 1000}
// CHECK: [[MAIN]] = !{!"function_entry_count", i64 1}

// Test that function entry counts are set correctly.

// RUN: llvm-profdata merge %S/Inputs/func-entry.proftext -o %t.profdata
// RUN: %clang %s -o - -mllvm -disable-llvm-optzns -emit-llvm -S -fprofile-instr-use=%t.profdata | FileCheck %s

void foo(void);

// CHECK: @foo() #0 !prof [[FOO:![0-9]+]]
void foo() { return; }

// CHECK: @main() #1 !prof [[MAIN:![0-9]+]]
int main() {
  int i;
  for (i = 0; i < 10000; i++) foo();
  return 0;
}

// CHECK: [[FOO]] = !{!"function_entry_count", i64 1000}
// CHECK: [[MAIN]] = !{!"function_entry_count", i64 1}

Fix PPC failure. Adjust CHECK pattern.

Fix PPC failure. Adjust CHECK pattern.

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


/*
 * Copyright 1995-2016 The OpenSSL Project Authors. All Rights Reserved.
 *
 * Licensed under the OpenSSL license (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
 */

struct lhash_node_st {
    void *data;
    struct lhash_node_st *next;
    unsigned long hash;
};

struct lhash_st {
    LHASH_NODE **b;
    OPENSSL_LH_COMPFUNC comp;
    OPENSSL_LH_HASHFUNC hash;
    unsigned int num_nodes;
    unsigned int num_alloc_nodes;
    unsigned int p;
    unsigned int pmax;
    unsigned long up_load;      /* load times 256 */
    unsigned long down_load;    /* load times 256 */
    unsigned long num_items;
    unsigned long num_expands;
    unsigned long num_expand_reallocs;
    unsigned long num_contracts;
    unsigned long num_contract_reallocs;
    unsigned long num_hash_calls;
    unsigned long num_comp_calls;
    unsigned long num_insert;
    unsigned long num_replace;
    unsigned long num_delete;
    unsigned long num_no_delete;
    unsigned long num_retrieve;
    unsigned long num_retrieve_miss;
    unsigned long num_hash_comps;
    int error;
};

/*
 * Copyright 1995-2016 The OpenSSL Project Authors. All Rights Reserved.
 *
 * Licensed under the OpenSSL license (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
 */

struct lhash_node_st {
    void *data;
    struct lhash_node_st *next;
    unsigned long hash;
};

struct lhash_st {
    OPENSSL_LH_NODE **b;
    OPENSSL_LH_COMPFUNC comp;
    OPENSSL_LH_HASHFUNC hash;
    unsigned int num_nodes;
    unsigned int num_alloc_nodes;
    unsigned int p;
    unsigned int pmax;
    unsigned long up_load;      /* load times 256 */
    unsigned long down_load;    /* load times 256 */
    unsigned long num_items;
    unsigned long num_expands;
    unsigned long num_expand_reallocs;
    unsigned long num_contracts;
    unsigned long num_contract_reallocs;
    unsigned long num_hash_calls;
    unsigned long num_comp_calls;
    unsigned long num_insert;
    unsigned long num_replace;
    unsigned long num_delete;
    unsigned long num_no_delete;
    unsigned long num_retrieve;
    unsigned long num_retrieve_miss;
    unsigned long num_hash_comps;
    int error;
};

Complete the rename of LHASH functions and types

LHASH_NODE was used internally, which doesn't work when configured
'no-deprecated'

Reviewed-by: Rich Salz <c04971a99e5a9ee80eaab4b1deb37e845b0bd697@openssl.org>


#ifndef __SSEG_H
#define __SSEG_H

//  aaa
//  f b
//  ggg
//  e c
//  ddd

const int kSegA = 1;
const int kSegB = 2;
const int kSegC = 4;
const int kSegD = 8;
const int kSegE = 16;
const int kSegF = 32;
const int kSegG = 64;

static char digits[] = {
	~(kSegA | kSegB | kSegC | kSegD | kSegE | kSegF), // 0
	~(kSegB | kSegC), // 1
	~(kSegA | kSegB | kSegD | kSegE | kSegG), // 2
	~(kSegA | kSegB | kSegC | kSegD | kSegG), // 3
	~(kSegB | kSegC | kSegF | kSegG), // 4
	~(kSegA | kSegC | kSegD | kSegF | kSegG), // 5
	~(kSegA | kSegF | kSegG | kSegE | kSegC | kSegG), // 6
	~(kSegA | kSegB | kSegC), // 7
	~(kSegA | kSegB | kSegC | kSegD | kSegE | kSegF | kSegG), // 8
	~(kSegA | kSegB | kSegC | kSegD | kSegF | kSegG), // 9
	~(kSegA | kSegF | kSegB | kSegG | kSegE | kSegC), // A
	~(kSegF | kSegG | kSegE | kSegC | kSegD), // b
	~(kSegA | kSegF | kSegE | kSegD), // C
	~(kSegB | kSegG | kSegE | kSegC | kSegD), // d
	~(kSegA | kSegF | kSegG | kSegE | kSegD), // E
	~(kSegA | kSegF | kSegG | kSegE) // F
};

volatile unsigned int * const kLedRegBase = (volatile unsigned int*) 0xffff0008;

#endif

Add seven segment control code for debugging


/* *
 *  $Id$
 *
 *  This file is part of Fenice
 *
 *  Fenice -- Open Media Server
 *
 *  Copyright (C) 2007 by
 *    - Dario Gallucci      <dario.gallucci@polito.it>
 *
 *  Fenice 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.
 *
 *  Fenice 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 Fenice; if not, write to the Free Software
 *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 *
 * */

#include <fenice/demuxer.h>
#include <fenice/demuxer_module.h>

static DemuxerInfo info = {
    "Skeleton demuxer_module",
    "skel",
    "LScube Team",
    "",
    "skl"
};

FNC_LIB_DEMUXER(skel);

static int skel_probe(InputStream * i_stream)
{
    return RESOURCE_NOT_FOUND;
}

static int skel_init(Resource * r)
{
    return RESOURCE_DAMAGED;
}

static int skel_read_packet(Resource * r)
{
    return RESOURCE_NOT_PARSEABLE;
}

static int skel_seek(Resource * r, double time_sec)
{
    return RESOURCE_NOT_SEEKABLE;
}

static int skel_uninit(Resource * r)
{
    return RESOURCE_OK;
}

Add skeleton for demuxer modules

Add skeleton for demuxer modules


//
//  EZForm
//
//  Copyright 2011-2013 Chris Miles. All rights reserved.
//
//  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.
//

#import "EZFormField.h"

@class EZForm;

@interface EZFormField (Private)

@property (nonatomic, assign, readwrite) EZForm *form;

@end

//
//  EZForm
//
//  Copyright 2011-2013 Chris Miles. All rights reserved.
//
//  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.
//

#import "EZFormField.h"

@class EZForm;

@interface EZFormField (Private)

@property (nonatomic, weak, readwrite) EZForm *form;

@end

Update project to Xcode 11 beta 7

Update project to Xcode 11 beta 7

Only update required is to replace `assign` with `weak`


// Copyright 2018 Dennis Decker Jensen
// Date: 29 April 2018
// Purpose: Minimum difference of pentagon numbers.
// Tectonics: cc -std=c11 -pedantic -Wall -O2 -o euler044 euler044.c
//

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

enum { npentagons = 10000 }; // N.B! Trial and error
unsigned pentagon[npentagons];

int
cmp(const void *a, const void *b)
{
	unsigned ua = *(unsigned *)a, ub = *(unsigned *)b;
	if (ua < ub) return -1;
	else if (ua > ub) return 1;
	else return 0;
}

int
main()
{
	size_t i, j, m = 0, n = 0, si = 0, di = 0;
	unsigned sum = 0, difference = 0, min = UINT_MAX, s, *b;

	for (i = 0; i < npentagons; ++i)
		pentagon[i] = i * (3 * i - 1) / 2;

	for (i = 1; i < npentagons; ++i)
		for (j = i + 1; j < npentagons
			&& (s = pentagon[i] + pentagon[j])
				<= pentagon[npentagons - 1]; ++j) {
			b = bsearch(&s, pentagon, npentagons,
					sizeof(unsigned), cmp);
			if (b == NULL)
				continue;
			si = b - pentagon;

			difference = pentagon[j] - pentagon[i];
			b = bsearch(&difference, pentagon, npentagons,
					sizeof(unsigned), cmp);
			if (b == NULL)
				continue;
			di = b - pentagon;

			if (difference < min) {
				min = difference;
				sum = s;
				m = i;
				n = j;
				printf(">P%zu - P%zu = %u\n", m, n, min);
				printf(">P%zu + P%zu = %u\n", m, n, sum);
			}
		}
	printf("Minimum, P%zu - P%zu = P%zu (%u)\n", m, n, di, min);
	printf("         P%zu + P%zu = P%zu (%u)\n", m, n, si, sum);
	return 0;
}

Solve Euler problem 44 on min. pentagon numbers.


/*
 * User address space access functions.
 *
 *  For licencing details see kernel-base/COPYING
 */

#include <linux/highmem.h>
#include <linux/module.h>

#include <asm/word-at-a-time.h>

/*
 * best effort, GUP based copy_from_user() that is NMI-safe
 */
unsigned long
copy_from_user_nmi(void *to, const void __user *from, unsigned long n)
{
	unsigned long offset, addr = (unsigned long)from;
	unsigned long size, len = 0;
	struct page *page;
	void *map;
	int ret;

	do {
		ret = __get_user_pages_fast(addr, 1, 0, &page);
		if (!ret)
			break;

		offset = addr & (PAGE_SIZE - 1);
		size = min(PAGE_SIZE - offset, n - len);

		map = kmap_atomic(page);
		memcpy(to, map+offset, size);
		kunmap_atomic(map);
		put_page(page);

		len  += size;
		to   += size;
		addr += size;

	} while (len < n);

	return len;
}
EXPORT_SYMBOL_GPL(copy_from_user_nmi);

/*
 * User address space access functions.
 *
 *  For licencing details see kernel-base/COPYING
 */

#include <linux/highmem.h>
#include <linux/module.h>

#include <asm/word-at-a-time.h>
#include <linux/sched.h>

/*
 * best effort, GUP based copy_from_user() that is NMI-safe
 */
unsigned long
copy_from_user_nmi(void *to, const void __user *from, unsigned long n)
{
	unsigned long offset, addr = (unsigned long)from;
	unsigned long size, len = 0;
	struct page *page;
	void *map;
	int ret;

	if (__range_not_ok(from, n, TASK_SIZE) == 0)
		return len;

	do {
		ret = __get_user_pages_fast(addr, 1, 0, &page);
		if (!ret)
			break;

		offset = addr & (PAGE_SIZE - 1);
		size = min(PAGE_SIZE - offset, n - len);

		map = kmap_atomic(page);
		memcpy(to, map+offset, size);
		kunmap_atomic(map);
		put_page(page);

		len  += size;
		to   += size;
		addr += size;

	} while (len < n);

	return len;
}
EXPORT_SYMBOL_GPL(copy_from_user_nmi);

perf/x86: Check user address explicitly in copy_from_user_nmi()

Signed-off-by: Arun Sharma <c2cb8b536bb785a11a9303a3d5590407e9ac6d77@fb.com>
Cc: Linus Torvalds <69652caca27c8b940640ad396ab71f93cacec34f@linux-foundation.org>
Cc: 2578944098299abf708b08eff6fcf60565553586@vger.kernel.org
Signed-off-by: Peter Zijlstra <645ca7d3a8d3d4f60557176cd361ea8351edc32b@chello.nl>
Link: http://lkml.kernel.org/r/1334961696-19580-5-git-send-email-c2cb8b536bb785a11a9303a3d5590407e9ac6d77@fb.com
Signed-off-by: Ingo Molnar <9dbbbf0688fedc85ad4da37637f1a64b8c718ee2@kernel.org>


#include "commands.h"

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

#include "util.h"

static const char* quit_matches[] = {"quit"};
static const char* help_matches[] = {"help"};

static void print_commands_help() {
  puts("  Commands available:\n");
  puts("    :quit   \tExit laco");
  puts("    :help   \tDisplay this list of commands");
}

static inline bool is_quit(const char* command) {
  return laco_is_match(quit_matches, command);
}

static inline bool is_help(const char* command) {
  return laco_is_match(help_matches, command);
}

void handle_command(struct LacoState* laco, char* line) {
  if(laco != NULL && line != NULL) {
    const char* command = line + 1;

    if(is_quit(command)) {
      laco_kill(laco, 0, "Exiting laco...");
    } else if(is_help(command))  {
      print_commands_help();
    }

    /* Make it seem like this was an empty line */
    line[0] = '\0';
  }
}

#include "commands.h"

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

#include "util.h"

static const char* quit_matches[] = {"quit"};
static const char* help_matches[] = {"help", "?"};

static void print_commands_help() {
  puts("  Commands available:\n");
  puts("    :quit      \tExit laco");
  puts("    :help, :?  \tDisplay this list of commands");
}

static inline bool is_quit(const char* command) {
  return laco_is_match(quit_matches, command);
}

static inline bool is_help(const char* command) {
  return laco_is_match(help_matches, command);
}

void handle_command(struct LacoState* laco, char* line) {
  if(laco != NULL && line != NULL) {
    const char* command = line + 1;

    if(is_quit(command)) {
      laco_kill(laco, 0, "Exiting laco...");
    } else if(is_help(command))  {
      print_commands_help();
    }

    /* Make it seem like this was an empty line */
    line[0] = '\0';
  }
}

Add short hand for help command

Add short hand for help command


//
//  TATLayout.h
//  TATLayout
//
//  An expressive, simple yet poweful way for coding layout constraints in iOS.
//
//  Copyright (c) 2014 Claudio Romandini.
//
//  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.
//

#import "NSLayoutConstraint+TATConstraintFactory.h"
#import "UIView+TATViewConstraints.h"
#import "TATLayoutManager.h"
#import "TATLayoutHelper.h"

Add imports in main library header

Add imports in main library header


#ifndef TEST_GUEST_TUPLE_ITERATOR_H
#define TEST_GUEST_TUPLE_ITERATOR_H

#include <cxxtest/TestSuite.h>
#include <unordered_set>
#include <vector>

#include "teams.h"
#include "guest_tuple_iterator.h"

class TestSeenTable : public CxxTest::TestSuite
{
	private:
		std::vector<mue::Team> make_testteams(int num)
		{
			std::vector<mue::Team> teams;

			for (mue::Team_id i = 0; i < num; ++i)
				teams.push_back(mue::Team(i));
			return teams;
		}

	public:
		void testFooBar(void)
		{

		}
};

#endif

Add test Skel for guest_tuple_iterator.h

Signed-off-by: Jan Losinski <577c4104c61edf9f052c616c0c23e67bef4a9955@wh2.tu-dresden.de>


#ifndef INCLUDE_GUARD_CUPY_CUDA_THRUST_H
#define INCLUDE_GUARD_CUPY_CUDA_THRUST_H

#ifndef CUPY_NO_CUDA

namespace cupy {

namespace thrust {

template <typename T>
void _sort(void *, size_t *, const std::vector<ptrdiff_t>&, size_t, void *);

template <typename T>
void _lexsort(size_t *, void *, size_t, size_t, size_t, void *);

template <typename T>
void _argsort(size_t *, void *, void *, const std::vector<ptrdiff_t>&, size_t,
              void *);

} // namespace thrust

} // namespace cupy

#else // CUPY_NO_CUDA

#include "cupy_common.h"

namespace cupy {

namespace thrust {

template <typename T> void _sort(...) { return; }

template <typename T> void _lexsort(...) { return; }

template <typename T> void _argsort(...) { return; }

} // namespace thrust

} // namespace cupy

#endif // #ifndef CUPY_NO_CUDA

#endif // INCLUDE_GUARD_CUPY_CUDA_THRUST_H

#ifndef INCLUDE_GUARD_CUPY_CUDA_THRUST_H
#define INCLUDE_GUARD_CUPY_CUDA_THRUST_H

#ifndef CUPY_NO_CUDA

namespace cupy {

namespace thrust {

template <typename T>
void _sort(void *, size_t *, const std::vector<ptrdiff_t>&, size_t, void *);

template <typename T>
void _lexsort(size_t *, void *, size_t, size_t, size_t, void *);

template <typename T>
void _argsort(size_t *, void *, void *, const std::vector<ptrdiff_t>&, size_t,
              void *);

} // namespace thrust

} // namespace cupy

#else // CUPY_NO_CUDA

#include "cupy_common.h"

namespace cupy {

namespace thrust {

template <typename T>
void _sort(void *, size_t *, const std::vector<ptrdiff_t>&, size_t, void *) {
    return;
}

template <typename T>
void _lexsort(size_t *, void *, size_t, size_t, size_t, void *) {
    return;
}

template <typename T>
void _argsort(size_t *, void *, void *, const std::vector<ptrdiff_t>&, size_t,
              void *) {
    return;
}

} // namespace thrust

} // namespace cupy

#endif // #ifndef CUPY_NO_CUDA

#endif // INCLUDE_GUARD_CUPY_CUDA_THRUST_H

Fix for no cuda environment

Fix for no cuda environment


#ifndef	CONFIG_CLASS_H
#define	CONFIG_CLASS_H

#include <map>

class Config;
class ConfigObject;
class ConfigType;
class ConfigValue;

class ConfigClass {
	friend class Config;

	std::string name_;
	std::map<std::string, ConfigType *> members_;
protected:
	ConfigClass(const std::string& name)
	: name_(name),
	  members_()
	{ }
private:
	~ConfigClass();

	virtual bool activate(ConfigObject *)
	{
		return (true);
	}

	bool set(ConfigObject *, const std::string&, ConfigValue *);

	ConfigType *member(const std::string& mname) const
	{
		std::map<std::string, ConfigType *>::const_iterator it;

		it = members_.find(mname);
		if (it == members_.end())
			return (NULL);
		return (it->second);
	}
};

#endif /* !CONFIG_CLASS_H */

#ifndef	CONFIG_CLASS_H
#define	CONFIG_CLASS_H

#include <map>

class Config;
class ConfigObject;
class ConfigType;
class ConfigValue;

class ConfigClass {
	friend class Config;

	std::string name_;
	std::map<std::string, ConfigType *> members_;
protected:
	ConfigClass(const std::string& name)
	: name_(name),
	  members_()
	{ }
private:
	~ConfigClass();

protected:
	void add_member(const std::string& mname, ConfigType *type)
	{
		ASSERT(members_.find(mname) == members_.end());
		members_[mname] = type;
	}

private:
	virtual bool activate(ConfigObject *)
	{
		return (true);
	}

	bool set(ConfigObject *, const std::string&, ConfigValue *);

	ConfigType *member(const std::string& mname) const
	{
		std::map<std::string, ConfigType *>::const_iterator it;

		it = members_.find(mname);
		if (it == members_.end())
			return (NULL);
		return (it->second);
	}
};

#endif /* !CONFIG_CLASS_H */

Add an add_member method for adding members.  Change visibility of everything.

git-svn-id: 9e2532540f1574e817ce42f20b9d0fb64899e451@156 4068ffdb-0463-0410-8185-8cc71e3bd399


/*
  High_Temp.h

  2014 Copyright (c) Seeed Technology Inc.  All right reserved.

  Loovee
  2013-4-14

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

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

  You should have received a copy of the GNU Lesser General Public
  License along with this library; if not, write to the Free Software
  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
*/
#ifndef __HIGH_TEMP_MCP320x_H__
#define __HIGH_TEMP_MCPx320x_H__

#include <MCP3208.h>
#include <High_Temp.h>

class HighTempMCP320x: public HighTemp{

public:

    HighTempMCP320x(int _spiCS, int _pinTmp, int _pinThmc);

private:
    int spiChipSelect;
    MCP3208 adc;

public:
    int getAnalog(int pin);
};

#endif

/*
  High_Temp.h

  2014 Copyright (c) Seeed Technology Inc.  All right reserved.

  Loovee
  2013-4-14

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

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

  You should have received a copy of the GNU Lesser General Public
  License along with this library; if not, write to the Free Software
  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
*/
#ifndef __HIGH_TEMP_MCP320x_H__
#define __HIGH_TEMP_MCPx320x_H__

#include <MCP3208.h>
#include <High_Temp.h>

class HighTempMCP320x: public HighTemp{

public:

    HighTempMCP320x(int _spiCS, int _pinTmp, int _pinThmc);

private:
    MCP3208 adc;

public:
    int getAnalog(int pin);
};

#endif

Remove chipselect member - not needed

Remove chipselect member - not needed


#ifndef GPIOLIB_H
#define GPIOLIB_H

#define FORWARD 1
#define BACKWARD 0

namespace GPIO
{
	int init();

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

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

	void delay(int milliseconds);
}
#endif

Remove texts for understanding to Wiki pages


/* Licensed to the Apache Software Foundation (ASF) under one or more
 * contributor license agreements.  See the NOTICE file distributed with
 * this work for additional information regarding copyright ownership.
 * The ASF licenses this file to You 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.
 */

#include "xs/XSBind.h"
#include "KinoSearch/Util/StringHelper.h"

// TODO: replace with code from ICU in common/ucnv_u8.c.
chy_bool_t
kino_StrHelp_utf8_valid(const char *ptr, size_t size)
{
    const U8 *uptr = (const U8*)ptr;
    return is_utf8_string(uptr, size);
}

/* Licensed to the Apache Software Foundation (ASF) under one or more
 * contributor license agreements.  See the NOTICE file distributed with
 * this work for additional information regarding copyright ownership.
 * The ASF licenses this file to You 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.
 */

#include "xs/XSBind.h"
#include "KinoSearch/Util/StringHelper.h"

// TODO: replace with code from ICU in common/ucnv_u8.c.
chy_bool_t
kino_StrHelp_utf8_valid(const char *ptr, size_t size)
{
    const U8 *uptr = (const U8*)ptr;
    return size == 0 ? true : !!is_utf8_string(uptr, size);
}

Work around undocumented feature/bug in perlapi function is_utf8_string() by
short-circuiting StrHelp_utf8_valid() to return true when the length of the
string is 0.

git-svn-id: 0e6074679e66e8f1cc73dfc755b08bab367f805b@1027787 13f79535-47bb-0310-9956-ffa450edef68


/****************************************************************************
**
** Copyright (C) 2014 Jolla Ltd.
** Contact: Raine Makelainen <raine.makelainen@jolla.com>
**
****************************************************************************/

/* This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this file,
 * You can obtain one at http://mozilla.org/MPL/2.0/. */

#ifndef DECLARATIVEWEBUTILS_H
#define DECLARATIVEWEBUTILS_H

#include <QObject>
#include <QString>
#include <QColor>
#include <qqml.h>

class DeclarativeWebUtils : public QObject
{
    Q_OBJECT
    Q_PROPERTY(QString homePage READ homePage NOTIFY homePageChanged FINAL)

public:
    explicit DeclarativeWebUtils(QObject *parent = 0);

    Q_INVOKABLE int getLightness(QColor color) const;
    Q_INVOKABLE QString displayableUrl(QString fullUrl) const;

    static DeclarativeWebUtils *instance();

    QString homePage() const;
    bool firstUseDone() const;
    void setFirstUseDone(bool firstUseDone);

signals:
    void homePageChanged();

private:
    QString m_homePage;
    bool m_firstUseDone;
};

QML_DECLARE_TYPE(DeclarativeWebUtils)

#endif

/****************************************************************************
**
** Copyright (C) 2014 Jolla Ltd.
** Contact: Raine Makelainen <raine.makelainen@jolla.com>
**
****************************************************************************/

/* This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this file,
 * You can obtain one at http://mozilla.org/MPL/2.0/. */

#ifndef DECLARATIVEWEBUTILS_H
#define DECLARATIVEWEBUTILS_H

#include <QObject>
#include <QString>
#include <QColor>
#include <qqml.h>

class DeclarativeWebUtils : public QObject
{
    Q_OBJECT
    Q_PROPERTY(QString homePage READ homePage NOTIFY homePageChanged FINAL)
    Q_PROPERTY(bool firstUseDone READ firstUseDone NOTIFY firstUseDoneChanged FINAL)

public:
    explicit DeclarativeWebUtils(QObject *parent = 0);

    Q_INVOKABLE int getLightness(QColor color) const;
    Q_INVOKABLE QString displayableUrl(QString fullUrl) const;

    static DeclarativeWebUtils *instance();

    QString homePage() const;
    bool firstUseDone() const;
    void setFirstUseDone(bool firstUseDone);

signals:
    void homePageChanged();
    void firstUseDoneChanged();

private:
    QString m_homePage;
    bool m_firstUseDone;
};

QML_DECLARE_TYPE(DeclarativeWebUtils)

#endif

Add missing property for WebUtils mock

[sailfish-browser] Add missing property for WebUtils mock

A warning was printed when running unit tests.


#include <fcntl.h>
#include <stdio.h>

int
main(void)
{
    printf("F_GETFL=%d\n", F_GETFL);
    printf("F_SETFL=%d\n", F_SETFL);
    printf("O_NONBLOCK=%d\n", O_NONBLOCK);

    return 0;
}

Add helper program to lookup C constants


#include "decode_time.h"
#include <stdio.h>

int
main(int argc, char *argv[])
{
	 /* start with 2000-01-01 = Saturday (matches `ncal 2000`) */
	uint8_t century, lday, co;
	struct tm time;
	time.tm_wday = 6; /* Saturday */
	/* check for every date if it matches */
	for (century = 0; century <  4; century++)
		for (time.tm_year = 0; time.tm_year < 100; time.tm_year++)
			for (time.tm_mon = 1; time.tm_mon < 13; time.tm_mon++) {
				time.tm_year += 2000 + century * 100;
				lday = lastday(time);
				time.tm_year -= 2000 + century * 100;
				for (time.tm_mday = 1; time.tm_mday <= lday; time.tm_mday++) {
					co = century_offset(time);
					if (co != century)
						printf("%d-%d-%d,%d : %d should be %d\n", time.tm_year, time.tm_mon, time.tm_mday, time.tm_wday, co, century);
					time.tm_wday++;
					if (time.tm_wday == 8)
						time.tm_wday = 1;
				}
			}
	printf("done\n");
	return 0;
}

Add a small test program for century_offset(), passes.


#include <errno.h>
#include <sys/poll.h>
#include "iobuf.h"

int iobuf_timeout(iobuf* io, int poll_out)
{
  struct pollfd pfd;
  int result;

  if (!io->timeout) return 1;

  pfd.fd = io->fd;
  pfd.events = poll_out ? POLLOUT : POLLIN;
  while ((result = poll(&pfd, 1, io->timeout)) == -1) {
    if (errno == EAGAIN) continue;
    IOBUF_SET_ERROR(io);
  }
  if (result) return 1;
  io->flags |= IOBUF_TIMEOUT;
  return 0;
}

#include <errno.h>
#include "iobuf.h"
#include "iopoll.h"

int iobuf_timeout(iobuf* io, int poll_out)
{
  iopoll_fd pfd;
  int result;

  if (!io->timeout) return 1;

  pfd.fd = io->fd;
  pfd.events = poll_out ? IOPOLL_WRITE : IOPOLL_READ;
  while ((result = iopoll(&pfd, 1, io->timeout)) == -1) {
    if (errno == EAGAIN) continue;
    IOBUF_SET_ERROR(io);
  }
  if (result) return 1;
  io->flags |= IOBUF_TIMEOUT;
  return 0;
}

Use iopoll instead of poll directly.

Use iopoll instead of poll directly.


///////////////////////////////////////////////////////////////////////////////
// This source file is part of Zeroth.
//
// Copyright (c) 2016 Colin Hill
//
///////////////////////////////////////////////////////////////////////////////
#pragma once

#include <Hect/Core/Export.h>

#ifdef HECT_WINDOWS_BUILD

#ifdef ZEROTH_EXPORTS
#define ZEROTH_EXPORT __declspec(dllexport)
#else
#define ZEROTH_EXPORT __declspec(dllimport)
#endif

#else
#define ZEROTH_EXPORTS
#endif

///////////////////////////////////////////////////////////////////////////////
// This source file is part of Zeroth.
//
// Copyright (c) 2016 Colin Hill
//
///////////////////////////////////////////////////////////////////////////////
#pragma once

#include <Hect/Core/Export.h>

#ifdef HECT_WINDOWS_BUILD

#ifdef ZEROTH_EXPORTS
#define ZEROTH_EXPORT __declspec(dllexport)
#else
#define ZEROTH_EXPORT __declspec(dllimport)
#endif

#else
#define ZEROTH_EXPORT
#endif

Fix export macro for non-MS compilers

Fix export macro for non-MS compilers


/* @author: Samuel G samuel.genois@mail.mcgill.ca

Modification Log:
Date                  Author                  Modification
-----------------------------------------------------------------
31-Oct-2018           Samuel G                Created the file
==================================================================*/

#define HDC1000_CONFIG_TEMPERATURE_RESOLUTION_14BIT 0x0000
#define HDC1000_CONFIG_HUMIDITY_RESOLUTION_14BIT 0x0000

typedef struct {
    //TODO
} HDC1000;

int HDC1000_init(HDC1000 *handle);

void setTemperatureResolution(int resolution);

void setHumidityResolution(int resolution);

int readTemperature(HDC1000 *handle, int *data);

int readHumidity(HDC1000 *handle, int *data);

/* @author: Samuel G samuel.genois@mail.mcgill.ca

Modification Log:
Date                  Author                  Modification
-----------------------------------------------------------------
31-Oct-2018           Samuel G                Created the file
07-Nov-2018           Matthew L-K             Switch to file descriptor design
==================================================================*/

#define HDC1000_CONFIG_TEMPERATURE_RESOLUTION_14BIT 0x0000
#define HDC1000_CONFIG_HUMIDITY_RESOLUTION_14BIT 0x0000

int HDC1000_temp_open();

int HDC1000_humid_open();

int read_temperature(int *data);

int read_humidity(int *data);

int HDC1000_temp_close();

int HDC1000_humid_close();

Switch HDC1000 to file descriptor design


#pragma once

#include <truth/cpu.h>
#include <truth/types.h>
#include <truth/log.h>

#define Not_Reached false

#define assert(x) \
    if (!(x)) { \
        logf("Assertion failed: (%s) function %s, file %s, line %d.", \
             (#x), __func__, __FILE__, __LINE__); \
        panic(); \
    }

#define assert_ok(x) \
    if (x != Ok) { \
        logf("Assertion failed (%s) status: %s, function %s, file %s, " \
             "line %d.", (#x), status_message(x), __func__, __FILE__, \
             __LINE__); \
        panic(); \
    }

static inline void no_return panic() {
    disable_interrupts();
    halt();
}

#pragma once

#include <truth/cpu.h>
#include <truth/types.h>
#include <truth/log.h>

#define Not_Reached false

#define assert(x) \
    if (!(x)) { \
        logf("Assertion failed: (%s) function %s, file %s, line %d.", \
             (#x), __func__, __FILE__, __LINE__); \
        panic(); \
    }

#define assert_ok(x) \
    if (x != Ok) { \
        logf("Assertion failed (%s) status: %s, function %s, file %s, " \
             "line %d.", (#x), status_message(x), __func__, __FILE__, \
             __LINE__); \
        panic(); \
    }

static inline void panic() {
    disable_interrupts();
    halt();
}

Remove attribute ignored by compiler

Remove attribute ignored by compiler


// Test if PGO sample use passes are invoked.
//
// Ensure Pass PGOInstrumentationGenPass is invoked.
// RUN: %clang_cc1 -O2 -fprofile-sample-use=%S/Inputs/pgo-sample.prof %s -mllvm -debug-pass=Structure -emit-llvm -o - 2>&1 | FileCheck %s
// CHECK: Remove unused exception handling info
// CHECK: Sample profile pass

// Test if PGO sample use passes are invoked.
//
// Ensure Pass PGOInstrumentationGenPass is invoked.
// RUN: %clang_cc1 -O2 -fno-experimental-new-pass-manager -fprofile-sample-use=%S/Inputs/pgo-sample.prof %s -mllvm -debug-pass=Structure -emit-llvm -o - 2>&1 | FileCheck %s --check-prefix=LEGACY
// RUN: %clang_cc1 -O2 -fexperimental-new-pass-manager -fprofile-sample-use=%S/Inputs/pgo-sample.prof %s -fdebug-pass-manager -emit-llvm -o - 2>&1 | FileCheck %s --check-prefix=NEWPM

// LEGACY: Remove unused exception handling info
// LEGACY: Sample profile pass

// NEWPM: SimplifyCFGPass
// NEWPM: SampleProfileLoaderPass

int func(int a) { return a; }

[clang][NewPM] Remove exception handling before loading pgo sample profile data

This patch ensures that SimplifyCFGPass comes before SampleProfileLoaderPass
on PGO runs in the new PM and fixes clang/test/CodeGen/pgo-sample.c.

Differential Revision: https://reviews.llvm.org/D63626

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


#include <netinet/in.h>
#include "defs.h"  /* for MAXDISPARGS */
#define MAXTEXTARGS ((MAXDISPARGS*sizeof(double))/512)

#define MYPORT (IPPORT_RESERVED + 78)
/* IPPORT_RESERVED is 1024, so this is socket 1102
   IPPORT_MAXPORT is 65535 on SGIs */

typedef struct sockdata {
  char name[100];		/* the cmix command name */
  union {
    double p[MAXDISPARGS];	/* the p-fields */
    char text[MAXTEXTARGS][512];     /* or text arrays  */
  } data;
  int n_args;		/* number of p-fields used */
} RTsockstr;

#include <netinet/in.h>
#include "maxdispargs.h"

#define MAXTEXTARGS ((MAXDISPARGS*sizeof(double))/512)

#define MYPORT (IPPORT_RESERVED + 78)
/* IPPORT_RESERVED is 1024, so this is socket 1102
   IPPORT_MAXPORT is 65535 on SGIs */

typedef struct sockdata {
  char name[100];		/* the cmix command name */
  union {
    double p[MAXDISPARGS];	/* the p-fields */
    char text[MAXTEXTARGS][512];     /* or text arrays  */
  } data;
  int n_args;		/* number of p-fields used */
} RTsockstr;

Include maxdispargs.h instead of defs.h.


#ifndef GRIDINF_INCLUDE_ESTIMATORS_H
#define GRIDINF_INCLUDE_ESTIMATORS_H

#include "core.h"

namespace ginf {
	// Find the labeling where every node chooses the label that minimizes the data cost
	template <typename T>
	void decodeMaxPrior(Grid<T> *grid, Matrix<int> *result) {
		for (int y = 0; y < grid->getHeight(); y++) {
			for (int x = 0; x < grid->getWidth(); x++) {
				int minLabel = 0;
				for (int i = 1; i < grid->getNumLabels(); i++) {
					if (grid->getDataCost(x, y, i) < grid->getDataCost(x, y, minLabel)) {
						result->get(x, y) = i;
						minLabel = i;
					}
				}
			}
		}
	}
}

#endif

Add functions to perform simple approximate inference


#include "csdl.h"
#include <math.h>

void tanhtable(FUNC *ftp, FGDATA *ff)
{
    MYFLT *fp = ftp->ftable;
    MYFLT range = ff->e.p[5];
    double step = (double)range/(ff->e.p[3]);
    int i;
    double x;
    for (i=0, x=FL(0.0); i<ff->e.p[3]; i++, x+=step)
      *fp++ = (MYFLT)tanh(x);
}

static void gentune(FUNC *ftp, FGDATA *ff)             /* Gab 1/3/2005 */
{
    int j;
    int notenum;
    int grade;
    int numgrades;
    int basekeymidi;
    MYFLT basefreq, factor,interval;

    MYFLT	*fp = ftp->ftable, *pp = &(ff->e.p[5]);
    int	nvals = ff->e.pcnt - 4;

    numgrades = (int) *pp++;
    interval  = *pp++;
    basefreq  = *pp++;
    basekeymidi=  (int) *pp++;

    nvals = ff->flenp1 - 1;

    for (j =0; j < nvals; j++) {
      notenum = j;
      if (notenum < basekeymidi) {
        notenum = basekeymidi - notenum;
        grade  = (numgrades-(notenum % numgrades)) % numgrades;
        factor = - (MYFLT)(int) ((notenum+numgrades-1) / numgrades) ;
      }
      else {
        notenum = notenum - basekeymidi;
        grade  = notenum % numgrades;
        factor = (MYFLT)(int) (notenum / numgrades);
      }
      factor = (MYFLT)pow((double)interval, (double)factor);
      fp[j] = pp[grade] * factor * basefreq;

    }
}

static NGFENS localfgens[] = {
   { "tanh", (void(*)(void))tanhtable},
   { "cpstune", (void(*)(void))gentune},
   { NULL, NULL}
};

#define S       sizeof

static OENTRY localops[] = {};

FLINKAGE

#include "csdl.h"
#include <math.h>

void tanhtable(FUNC *ftp, FGDATA *ff)
{
    MYFLT *fp = ftp->ftable;
    MYFLT range = ff->e.p[5];
    double step = (double)range/(ff->e.p[3]);
    int i;
    double x;
    for (i=0, x=FL(0.0); i<ff->e.p[3]; i++, x+=step)
      *fp++ = (MYFLT)tanh(x);
}

static NGFENS localfgens[] = {
   { "tanh", (void(*)(void))tanhtable},
   { NULL, NULL}
};

#define S       sizeof

static OENTRY localops[] = {};

FLINKAGE

Remove gen from loadable code

Remove gen from loadable code


#include "src/math/reinterpret.h"
#include <math.h>
#include <stdint.h>
#include <assert.h>

static _Bool run(uint64_t a)
{
    return a == truncl(a);
}

int main(void)
{
    const uint64_t delta = 0x0008D46BA87B5A22;

    for (uint64_t i = 0x3FFFFFFFFFFFFFFF; i < 0x4340000000000000; i += delta)
        assert(run(reinterpret(double, i)));

    for (uint64_t i = 0; i <= UINT64_MAX / delta; ++i)
        assert(run(i * delta));
}

#include "src/math/reinterpret.h"
#include <math.h>
#include <stdint.h>
#include <assert.h>

int main(void)
{
    const __int128 delta = (__int128)0x17E93193 << 64 | 0xC0605887B0E6B634;

    for (__int128 i = reinterpret(__int128, 0.9L); i < reinterpret(__int128, 0x1p64L); i += delta) {
        long double x = reinterpret(long double, i);
        assert((uint64_t)x == truncl(x));
    }
}

Test truncation of long double -> uint64_t


// Copyright lowRISC contributors.
// Licensed under the Apache License, Version 2.0, see LICENSE for details.
// SPDX-License-Identifier: Apache-2.0`

#ifndef OPENTITAN_SW_DEVICE_LIB_RUNTIME_CHECK_H_
#define OPENTITAN_SW_DEVICE_LIB_RUNTIME_CHECK_H_

#include <stdbool.h>

#include "sw/device/lib/base/log.h"
#include "sw/device/lib/runtime/abort.h"

/**
 * Runtime assertion macros with log.h integration.
 */

/**
 * Checks that the given condition is true. If the condition is false, this
 * function logs and then aborts.
 *
 * @param condition an expression to check.
 * @param ... arguments to a LOG_* macro, which are evaluated if the check
 * fails.
 */
#define CHECK(condition, ...)                \
  do {                                       \
    if (!(condition)) {                      \
      LOG_ERROR("CHECK-fail: " __VA_ARGS__); \
      abort();                               \
    }                                        \
  } while (false)

/**
 * Shorthand for CHECK(value == 0).
 *
 * @param condition a value to check.
 * @param ... arguments to a LOG_* macro, which are evaluated if the check
 * fails.
 */
#define CHECKZ(value, ...) CHECK((value) == 0, ...)

#endif  // OPENTITAN_SW_DEVICE_LIB_RUNTIME_CHECK_H_

// Copyright lowRISC contributors.
// Licensed under the Apache License, Version 2.0, see LICENSE for details.
// SPDX-License-Identifier: Apache-2.0`

#ifndef OPENTITAN_SW_DEVICE_LIB_RUNTIME_CHECK_H_
#define OPENTITAN_SW_DEVICE_LIB_RUNTIME_CHECK_H_

#include <stdbool.h>

#include "sw/device/lib/base/log.h"
#include "sw/device/lib/runtime/hart.h"

/**
 * Runtime assertion macros with log.h integration.
 */

/**
 * Checks that the given condition is true. If the condition is false, this
 * function logs and then aborts.
 *
 * @param condition an expression to check.
 * @param ... arguments to a LOG_* macro, which are evaluated if the check
 * fails.
 */
#define CHECK(condition, ...)                \
  do {                                       \
    if (!(condition)) {                      \
      LOG_ERROR("CHECK-fail: " __VA_ARGS__); \
      abort();                               \
    }                                        \
  } while (false)

/**
 * Shorthand for CHECK(value == 0).
 *
 * @param condition a value to check.
 * @param ... arguments to a LOG_* macro, which are evaluated if the check
 * fails.
 */
#define CHECKZ(value, ...) CHECK((value) == 0, ##__VA_ARGS__)

#endif  // OPENTITAN_SW_DEVICE_LIB_RUNTIME_CHECK_H_

Fix a couple typos in the CHECK macros.

[sw] Fix a couple typos in the CHECK macros.

Signed-off-by: Miguel Young de la Sota <71b8e7f4945fd97b98544cf897992af89646547a@google.com>


/**
 * \file   string_hash.c
 * \brief  Computes a hash value for a string.
 * \author Copyright (c) 2012-2014 Jason Perkins and the Premake project
 */

#include "premake.h"
#include <string.h>

int string_hash(lua_State* L)
{
	const char* str = luaL_checkstring(L, 1);
	unsigned long seed = luaL_optint(L, 2, 0);
	lua_pushnumber(L, do_hash(str, seed));
	return 1;
}

unsigned long do_hash(const char* str, int seed)
{
	/* DJB2 hashing; see http://www.cse.yorku.ca/~oz/hash.html */

	unsigned long hash = 5381;

	if (seed != 0) {
		hash = hash * 33 + seed;
	}

	while (*str) {
		hash = hash * 33 + (*str);
		str++;
	}

	return hash;
}

/**
 * \file   string_hash.c
 * \brief  Computes a hash value for a string.
 * \author Copyright (c) 2012-2014 Jason Perkins and the Premake project
 */

#include "premake.h"
#include <string.h>

int string_hash(lua_State* L)
{
	const char* str = luaL_checkstring(L, 1);
	unsigned long seed = luaL_optint(L, 2, 0);
	lua_pushnumber(L, (lua_Number)do_hash(str, seed));
	return 1;
}

unsigned long do_hash(const char* str, int seed)
{
	/* DJB2 hashing; see http://www.cse.yorku.ca/~oz/hash.html */

	unsigned long hash = 5381;

	if (seed != 0) {
		hash = hash * 33 + seed;
	}

	while (*str) {
		hash = hash * 33 + (*str);
		str++;
	}

	return hash;
}

Fix implicit conversion warning when building with floating point Lua


/*
 * types.h
 * Ansilove 4.1.0
 * https://www.ansilove.org
 *
 * Copyright (c) 2011-2020 Stefan Vogt, Brian Cassidy, and Frederic Cambus
 * All rights reserved.
 *
 * Ansilove is licensed under the BSD 2-Clause License.
 * See LICENSE file for details.
 */

#ifndef TYPES_H
#define TYPES_H

#define ANSILOVE_FILETYPE_ANS	1
#define ANSILOVE_FILETYPE_ADF	2
#define ANSILOVE_FILETYPE_BIN	3
#define ANSILOVE_FILETYPE_IDF	4
#define ANSILOVE_FILETYPE_PCB	5
#define ANSILOVE_FILETYPE_TND	6
#define ANSILOVE_FILETYPE_XB	7

extern char *types[];
extern int filetypes[];
extern int (*loaders[])(struct ansilove_ctx *, struct ansilove_options *);

#endif /* TYPES_H */

/*
 * types.h
 * Ansilove 4.1.0
 * https://www.ansilove.org
 *
 * Copyright (c) 2011-2020 Stefan Vogt, Brian Cassidy, and Frederic Cambus
 * All rights reserved.
 *
 * Ansilove is licensed under the BSD 2-Clause License.
 * See LICENSE file for details.
 */

#ifndef TYPES_H
#define TYPES_H

#define ANSILOVE_FILETYPE_ANS	1
#define ANSILOVE_FILETYPE_ADF	2
#define ANSILOVE_FILETYPE_BIN	3
#define ANSILOVE_FILETYPE_IDF	4
#define ANSILOVE_FILETYPE_PCB	5
#define ANSILOVE_FILETYPE_TND	6
#define ANSILOVE_FILETYPE_XB	7

struct ansilove_ctx;
struct ansilove_options;

extern char *types[];
extern int filetypes[];
extern int (*loaders[])(struct ansilove_ctx *, struct ansilove_options *);

#endif /* TYPES_H */

Add forward declarations for ansilove_ctx and ansilove_options structs.


#ifndef EFDL_RANGE_H
#define EFDL_RANGE_H

#include <QPair>
#include <QDebug>

namespace efdl {
  typedef QPair<qint64, qint64> Range; // (start, end)
}

QDebug operator<<(QDebug dbg, const efdl::Range &r);

#endif // EFDL_RANGE_H

#ifndef EFDL_RANGE_H
#define EFDL_RANGE_H

#include <QPair>
#include <QDebug>

namespace efdl {
  /**
   * Encapsulates a file data range of the form [start, end[
   *
   * Note that "end" is not inclusive!
   */
  typedef QPair<qint64, qint64> Range;
}

QDebug operator<<(QDebug dbg, const efdl::Range &r);

#endif // EFDL_RANGE_H

Make it explicit that the 'end' in a range [start, end[ is _not_ inclusive.


#ifndef GUICONSTANTS_H
#define GUICONSTANTS_H

/* Milliseconds between model updates */
static const int MODEL_UPDATE_DELAY = 500;

/* Maximum  passphrase length */
static const int MAX_PASSPHRASE_SIZE = 1024;

/* Size of icons in status bar */
static const int STATUSBAR_ICONSIZE = 16;

/* Invalid field background style */
#define STYLE_INVALID "background:#FF8080"

/* Transaction list -- unconfirmed transaction */
#define COLOR_UNCONFIRMED QColor(128, 128, 128)
/* Transaction list -- negative amount */
#define COLOR_NEGATIVE QColor(136, 0, 21)
/* Table List -- negative amount */
#define COLOR_NEGATIVE_TABLE QColor(224, 0, 0)
/* Transaction list -- positive amount */
#define COLOR_POSITIVE QColor(0, 128, 0)
/* Transaction list -- bare address (without label) */
#define COLOR_BAREADDRESS QColor(140, 140, 140)

/* Colors for minting tab for each coin age group */
#define COLOR_MINT_YOUNG QColor(127, 127, 240)
#define COLOR_MINT_MATURE QColor(127, 240, 127)
#define COLOR_MINT_OLD QColor(240, 127, 127)

#endif // GUICONSTANTS_H

#ifndef GUICONSTANTS_H
#define GUICONSTANTS_H

/* Milliseconds between model updates */
static const int MODEL_UPDATE_DELAY = 500;

/* Maximum  passphrase length */
static const int MAX_PASSPHRASE_SIZE = 1024;

/* Size of icons in status bar */
static const int STATUSBAR_ICONSIZE = 16;

/* Invalid field background style */
#define STYLE_INVALID "background:#FF8080"

/* Transaction list -- unconfirmed transaction */
#define COLOR_UNCONFIRMED QColor(128, 128, 128)
/* Transaction list -- negative amount */
#define COLOR_NEGATIVE QColor(136, 0, 21)
/* Table List -- negative amount */
#define COLOR_NEGATIVE_TABLE QColor(255, 80, 80)
/* Transaction list -- positive amount */
#define COLOR_POSITIVE QColor(0, 128, 0)
/* Transaction list -- bare address (without label) */
#define COLOR_BAREADDRESS QColor(140, 140, 140)

/* Colors for minting tab for each coin age group */
#define COLOR_MINT_YOUNG QColor(128, 64, 64)
#define COLOR_MINT_MATURE QColor(64, 128, 64)
#define COLOR_MINT_OLD QColor(26, 77, 26)

#endif // GUICONSTANTS_H

Improve colors of minting tab and transactions tab.


/*
* kinetic-c
* Copyright (C) 2014 Seagate Technology.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
*/
#include <unistd.h>
#include <err.h>

#include "system_test_fixture.h"
#include "kinetic_client.h"

static SystemTestFixture Fixture;

#define IDLE_SECONDS 10

void setUp(void)
{
}

void tearDown(void)
{
}

static void child_task(void) {
    SystemTestSetup(&Fixture, 0);

    sleep(IDLE_SECONDS);

    SystemTestTearDown(&Fixture);
    exit(0);
}

void test_idle_system_should_go_dormant(void)
{
    const int children = 16;
    for (int i = 0; i < children; i++) {
        pid_t pid = fork();
        if (pid == 0) {
            child_task();
        } else if (pid == -1) {
            err(1, "fork");
        } else {
            /* nop */
        }
    }

    sleep(IDLE_SECONDS);

    for (int i = 0; i < children; i++) {
        int stat_loc = 0;
        wait(&stat_loc);
    }
}

Add idle multiprocess system test.

Add idle multiprocess system test.


#include <string.h>
#include "number.h"

/** Format padding for a signed number. */
unsigned fmt_sign_pad(char* buffer, int sign, unsigned width, char pad)
{
  char* s = buffer;
  if (buffer == 0)
    return width + (sign != 0);
  if (!width) {
    if (sign)
      *s++ = '-';
  }
  else {
    if (pad != '0') {
      memset(s, pad, width);
      s += width;
    }
    if (sign)
      *s++ = '-';
    if (pad == '0') {
      memset(s, pad, width);
      s += width;
    }
  }
  return s - buffer;
}

#ifdef SELFTEST_MAIN
#include "selftest.c"
void test(int sign, unsigned width, char pad)
{
  char buf[10];
  buf[fmt_sign_pad(buf, sign, width, pad)] = 0;
  obuf_puts(&outbuf, buf);
  NL();
}

MAIN
{
  test(0, 0,   0);
  test(1, 0,   0);
  test(0, 4, 'x');
  test(1, 4, 'x');
  test(0, 4, '0');
  test(1, 4, '0');
}
#endif
#ifdef SELFTEST_EXP

-
xxxx
xxxx-
0000
-0000
#endif

#include <string.h>
#include "number.h"

/** Format padding for a signed number. */
unsigned fmt_sign_pad(char* buffer, int sign, unsigned width, char pad)
{
  char* s = buffer;
  if (buffer == 0)
    return width + (sign != 0);
  if (!width) {
    if (sign)
      *s++ = '-';
  }
  else {
    if (pad != '0') {
      memset(s, pad, width);
      s += width;
    }
    if (sign)
      *s++ = '-';
    if (pad == '0') {
      memset(s, pad, width);
      s += width;
    }
  }
  return s - buffer;
}

#ifdef SELFTEST_MAIN
#include "selftest.c"
void test(int sign, unsigned width, char pad)
{
  char buf[10];
  obuf_putu(&outbuf, fmt_sign_pad(0, sign, width, pad));
  obuf_putc(&outbuf, ':');
  buf[fmt_sign_pad(buf, sign, width, pad)] = 0;
  obuf_puts(&outbuf, buf);
  NL();
}

MAIN
{
  test(0, 0,   0);
  test(1, 0,   0);
  test(0, 4, 'x');
  test(1, 4, 'x');
  test(0, 4, '0');
  test(1, 4, '0');
}
#endif
#ifdef SELFTEST_EXP
0:
1:-
4:xxxx
5:xxxx-
4:0000
5:-0000
#endif

Include the no-buffer length when testing this function.


#include "assertive.h"
#include <VSScript.h>
#include <VapourSynth.h>
#include <VSHelper.h>
#include <climits>
#include <cstdint>
#include <cstdarg>
#include <cstring>
#include <cstdlib>
#include <wchar.h>
#include <cstdio>
#include <algorithm>
#include <new>
#include <codecvt>
#include <string>
#include <fstream>
#include <vector>
#define WIN32_LEAN_AND_MEAN		// Exclude rarely-used stuff from Windows headers
#define NOMINMAX
#include <windows.h>
#include <vfw.h>
#include <aviriff.h>
#include "ss.h"
#pragma warning(disable: 4244) // size conversion warning
#pragma warning(disable: 4245) // sign conversion warning
#include "avisynth.h"
#pragma warning(default: 4244)
#pragma warning(default: 4245)
#include "avfspfm.h"
#include "xxfs.h"
#include "avfs.h"
#include "vsfs.h"
#include "videoinfoadapter.h"
#include "../common/p2p_api.h"
#include "../common/fourcc.h"

#include "assertive.h"
#include <VSScript.h>
#include <VapourSynth.h>
#include <VSHelper.h>
#include <climits>
#include <cstdint>
#include <cstdarg>
#include <cstring>
#include <cstdlib>
#include <wchar.h>
#include <cstdio>
#include <algorithm>
#include <new>
#include <codecvt>
#include <string>
#include <fstream>
#include <vector>
#define WIN32_LEAN_AND_MEAN		// Exclude rarely-used stuff from Windows headers
#define NOMINMAX
#include <windows.h>
#include "ss.h"
#pragma warning(disable: 4244) // size conversion warning
#pragma warning(disable: 4245) // sign conversion warning
#include "avisynth.h"
#pragma warning(default: 4244)
#pragma warning(default: 4245)
#include "avfspfm.h"
#include "xxfs.h"
#include "avfs.h"
#include "vsfs.h"
#include "videoinfoadapter.h"
#include "../common/p2p_api.h"
#include "../common/fourcc.h"
// Common vfw defines
#define WAVE_FORMAT_PCM               1
#define WAVE_FORMAT_IEEE_FLOAT   0x0003

Reduce the number of windows specific includes in AVFS


#ifndef UTIL_H
#define UTIL_H

void set_verbose_on();
void set_debug_on();

void error(const char * fmt, ...);

void verbose(const char * fmt, ...);
void debug(const char * fmt, ...);

#endif

#ifndef UTIL_H
#define UTIL_H

void set_verbose_on();
void set_debug_on();

void error(const char * fmt, ...);

void verbose(const char * fmt, ...);
void debug(const char * fmt, ...);

void run_command(char * const argv[]);

#endif

Allow run_command to be accessed from other files


#include <stdio.h>
#include <stdlib.h>
#include <string.h>
struct node {
        int data;
        struct node *next;
};
struct node *createNode (int value) {
        struct node *newNode = (struct node *) malloc (sizeof (struct node));
        newNode -> data = value;
        newNode -> next = NULL;
        return newNode;
}
void insertNode (struct node **head_ref, struct node **tail_ref, int value) {
        struct node *newNode = createNode (value);
        if (*head_ref == NULL) {
                *head_ref = newNode;
                *tail_ref = newNode;
}
        else {
                (*tail_ref) -> next = newNode;
                *tail_ref = newNode;
}
}
void  printList (struct node *head) {
        while (head != NULL) {
                printf ("%d -> ", head->data);
                head = head->next;
}
        printf ("NULL\n");
}
void destroyList (struct node *head) {
        struct node *nextNode = head;
        while (head != NULL) {
                nextNode = head -> next;
                free (head);
                head = nextNode;
}
        printf("Killed off all her feelings\n" );
}
struct node *mergeTwoSortedRecursive (struct node *head1, struct node *head2) {
        if (head1 == NULL) {
                return head2;
        }
        if (head2 == NULL) {
                return head1;
        }
        if (head1->data < head2->data) {
                head1->next = mergeTwoSortedRecursive (head1->next, head2);
                return head1;
        }
        else {
                head2->next = mergeTwoSortedRecursive (head1, head2->next);
                return head2;
        }
}
int main (int argc, char *argv[]) {
        int value;
        struct node *head1 = NULL;
        struct node *tail1 = NULL;
        struct node *head2 = NULL;
        struct node *tail2 = NULL;
        struct node *resultHead = NULL;
        char buffer[2048];
        char *p = NULL;

        fgets (buffer, 2048, stdin);
        p = strtok (buffer, "NULL > | \n");
        while (p != NULL) {
                sscanf (p, "%d", &value);
                insertNode (&head1, &tail1, value);
                p = strtok (NULL, "NULL null | > \n");
}
        fgets (buffer, 2048, stdin);
        p = strtok (buffer, "NULL > | \n");
        while (p != NULL) {
        sscanf (p, "%d", &value);
        insertNode (&head2, &tail2, value);
        p = strtok (NULL, "NULL null | > \n");
}
        printList (head1);
        printList (head2);
        resultHead = mergeTwoSortedRecursive (head1, head2);
        printList (resultHead);
        destroyList (resultHead);
        head1 = NULL;
        tail1 = NULL;
        head2 = NULL;
        tail2 = NULL;
        return 0;
}

Merge two sorted lists - recursive

Added: Merge two sorted lists - recursive

say
1 2
3 4
are the given sorted lists.
the smallest element will be one of the head nodes' data.
say head1.
thus, keep it aside and update it's next by assigning it to the next smaller element in both the lists. this element would also be at either of the head nodes. so, head1->next = (head1->next, head2);
proceed further in the same way.


#ifndef CPR_BODY_H
#define CPR_BODY_H

#include <string>

#include "defines.h"

namespace cpr {

class Body : public std::string {
  public:
    Body() = default;
    Body(const Body& rhs) = default;
    Body(Body&& rhs) = default;
    Body& operator=(const Body& rhs) = default;
    Body& operator=(Body&& rhs) = default;
    explicit Body(const char* raw_string) : std::string(raw_string) {}
    explicit Body(const char* raw_string, size_t length) : std::string(raw_string, length) {}
    explicit Body(size_t to_fill, char character) : std::string(to_fill, character) {}
    explicit Body(const std::string& std_string) : std::string(std_string) {}
    explicit Body(const std::string& std_string, size_t position, size_t length = std::string::npos)
            : std::string(std_string, position, length) {}
    explicit Body(std::initializer_list<char> il) : std::string(il) {}
    template <class InputIterator>
    explicit Body(InputIterator first, InputIterator last)
            : std::string(first, last) {}
};

} // namespace cpr

#endif

#ifndef CPR_BODY_H
#define CPR_BODY_H

#include <cstring>

#include <initializer_list>
#include <string>

#include "defines.h"

namespace cpr {

class Body : public std::string {
  public:
    Body() = default;
    Body(const Body& rhs) = default;
    Body(Body&& rhs) = default;
    Body& operator=(const Body& rhs) = default;
    Body& operator=(Body&& rhs) = default;
    explicit Body(const char* raw_string) : std::string(raw_string) {}
    explicit Body(const char* raw_string, size_t length) : std::string(raw_string, length) {}
    explicit Body(size_t to_fill, char character) : std::string(to_fill, character) {}
    explicit Body(const std::string& std_string) : std::string(std_string) {}
    explicit Body(const std::string& std_string, size_t position, size_t length = std::string::npos)
            : std::string(std_string, position, length) {}
    explicit Body(std::initializer_list<char> il) : std::string(il) {}
    template <class InputIterator>
    explicit Body(InputIterator first, InputIterator last)
            : std::string(first, last) {}
};

} // namespace cpr

#endif

Add specific headers for used symbols in Body


#pragma once

#include <QObject>
#include <QQmlParserStatus>
#include "qslistmodel.h"

class QSJsonListModel : public QSListModel, public QQmlParserStatus
{
    Q_OBJECT
    Q_PROPERTY(QString keyField READ keyField WRITE setKeyField NOTIFY keyFieldChanged)
    Q_PROPERTY(QVariantList source READ source WRITE setSource NOTIFY sourceChanged)
    Q_PROPERTY(QStringList fields READ fields WRITE setFields NOTIFY fieldsChanged)
    Q_INTERFACES(QQmlParserStatus)

public:
    explicit QSJsonListModel(QObject *parent = 0);

    QString keyField() const;

    void setKeyField(const QString &keyField);

    QVariantList source() const;

    void setSource(const QVariantList &source);

    QStringList fields() const;

    void setFields(const QStringList &roleNames);

signals:

    void keyFieldChanged();

    void sourceChanged();

    void fieldsChanged();

public slots:

protected:
    virtual void classBegin();
    virtual void componentComplete();

private:
    void sync();

    QString m_keyField;

    QVariantList m_source;

    QStringList m_fields;

    bool componentCompleted;
};

#pragma once

#include <QObject>
#include <QQmlParserStatus>
#include "qslistmodel.h"

/* QSJsonListModel is a data model that combine QSListModel and QSDiffRunner
 * into a single class. It may take a Javascript array object as source input,
 * it will compare with previous input then update the model according to
 * the diff.
 */

class QSJsonListModel : public QSListModel, public QQmlParserStatus
{
    Q_OBJECT
    Q_PROPERTY(QString keyField READ keyField WRITE setKeyField NOTIFY keyFieldChanged)
    Q_PROPERTY(QVariantList source READ source WRITE setSource NOTIFY sourceChanged)
    Q_PROPERTY(QStringList fields READ fields WRITE setFields NOTIFY fieldsChanged)
    Q_INTERFACES(QQmlParserStatus)

public:
    explicit QSJsonListModel(QObject *parent = 0);

    QString keyField() const;

    void setKeyField(const QString &keyField);

    QVariantList source() const;

    void setSource(const QVariantList &source);

    QStringList fields() const;

    void setFields(const QStringList &roleNames);

signals:

    void keyFieldChanged();

    void sourceChanged();

    void fieldsChanged();

public slots:

protected:
    virtual void classBegin();
    virtual void componentComplete();

private:
    void sync();

    QString m_keyField;

    QVariantList m_source;

    QStringList m_fields;

    bool componentCompleted;
};

Add description to QSJsonListModel in source file.


/*
 * Copyright (c) 2012-2014 Israel Jacquez
 * See LICENSE for details.
 *
 * Israel Jacquez <mrkotfw@gmail.com>
 */

#ifndef _LIBYAUL_H_
#define _LIBYAUL_H_

/* CPU */
#include <cpu.h>

/* SCU */
#include <scu.h>

/* CS0 */
#include <arp.h>
#include <dram-cartridge.h>
#include <usb-cartridge.h>

/* CS2 */
#include <cd-block.h>

/* VDP1 */
#include <vdp1.h>

/* VDP2 */
#include <vdp2.h>

/* SMPC */
#include <smpc.h>

/* Kernel */
#include <common.h>
#include <irq-mux.h>
#include <cons.h>

#include <fs/iso9660/iso9660.h>
#include <fs/romdisk/romdisk.h>

#include <gdb.h>

#endif /* !_LIBYAUL_H_ */

/*
 * Copyright (c) 2012-2014 Israel Jacquez
 * See LICENSE for details.
 *
 * Israel Jacquez <mrkotfw@gmail.com>
 */

#ifndef _LIBYAUL_H_
#define _LIBYAUL_H_

/* CPU-bus CPU */
#include <cpu.h>

/* CPU-bus SMPC */
#include <smpc.h>

/* SCU */
#include <scu.h>

/* CS0 */
#include <arp.h>
#include <dram-cartridge.h>
#include <usb-cartridge.h>

/* CS2 */
#include <cd-block.h>

/* B-bus VDP1 */
#include <vdp1.h>

/* B-bus VDP2 */
#include <vdp2.h>

/* B-bus SCSP */
#include <scsp.h>

/* Kernel */
#include <common.h>
#include <irq-mux.h>
#include <cons.h>

#include <fs/iso9660/iso9660.h>
#include <fs/romdisk/romdisk.h>

#include <gdb.h>

#endif /* !_LIBYAUL_H_ */

Add missing header (for SCSP)

Add missing header (for SCSP)


#ifndef _IP_ADDRESS_H_
#define _IP_ADDRESS_H_

#include <iostream>

// An IPv4 address has the following form:
// "A.B.C.D", where A, B, C and D are bytes
class IPAddress {
 public:
     IPAddress (unsigned char a = 0, unsigned char b = 0, unsigned char c = 0, unsigned char d = 0);

     IPAddress operator& (const IPAddress& addr) const;
     IPAddress operator| (const IPAddress& addr) const;
     IPAddress operator~ () const;

     bool operator== (const IPAddress& addr) const;
     bool operator!= (const IPAddress& addr) const;

     friend std::ostream& operator<< (std::ostream& os, const IPAddress& addr);
     friend std::istream& operator>> (std::istream& is, IPAddress& addr);

     void setAddress (unsigned char a, unsigned char b, unsigned char c, unsigned char d);

 private:
     unsigned char m_a;
     unsigned char m_b;
     unsigned char m_c;
     unsigned char m_d;
};

#endif // _IPADDRESS_H_

Add header guard to prevent multiple inclusion errors


#include "../common.c"
#include "m-dict.h"

static inline bool oor_equal_p(unsigned int k, unsigned char n)
{
  return k == (unsigned int)n;
}
static inline void oor_set(unsigned int *k, unsigned char n)
{
  *k = (unsigned int)n;
}

DICT_OA_DEF2(dict_oa_uint,
	     unsigned int, M_OPEXTEND(M_DEFAULT_OPLIST, OOR_EQUAL(oor_equal_p), OOR_SET(oor_set M_IPTR)),
	     unsigned int, M_DEFAULT_OPLIST)

uint32_t test_int(uint32_t n, uint32_t x0)
{
  uint32_t i, x, z = 0;
  dict_oa_uint_t h;
  dict_oa_uint_init(h);
  for (i = 0, x = x0; i < n; ++i) {
    x = hash32(x);
    unsigned int key = get_key(n, x);
    unsigned int *ptr = dict_oa_uint_get_at(h, key);
    (*ptr)++;
    z += *ptr;
  }
  fprintf(stderr, "# unique keys: %d; checksum: %u\n", (int) dict_oa_uint_size(h), z);
  z = dict_oa_uint_size(h);
  dict_oa_uint_clear(h);
  return z;
}

#include "../common.c"
#define DICTI_OA_PROBING(s) 1
#include "m-dict.h"

static inline bool oor_equal_p(unsigned int k, unsigned char n)
{
  return k == (unsigned int)n;
}
static inline void oor_set(unsigned int *k, unsigned char n)
{
  *k = (unsigned int)n;
}

DICT_OA_DEF2(dict_oa_uint,
	     unsigned int, M_OPEXTEND(M_DEFAULT_OPLIST, HASH(hash_fn), OOR_EQUAL(oor_equal_p), OOR_SET(oor_set M_IPTR)),
	     unsigned int, M_DEFAULT_OPLIST)

uint32_t test_int(uint32_t n, uint32_t x0)
{
  uint32_t i, x, z = 0;
  dict_oa_uint_t h;
  dict_oa_uint_init(h);
  for (i = 0, x = x0; i < n; ++i) {
    x = hash32(x);
    unsigned int key = get_key(n, x);
    unsigned int *ptr = dict_oa_uint_get_at(h, key);
    (*ptr)++;
    z += *ptr;
  }
  fprintf(stderr, "# unique keys: %d; checksum: %u\n", (int) dict_oa_uint_size(h), z);
  z = dict_oa_uint_size(h);
  dict_oa_uint_clear(h);
  return z;
}

Use of linear probing and the same hash function as other libraries


#include "e.h"

/* local subsystem functions */

/* local subsystem globals */

/* externally accessible functions */
EAPI void
e_error_message_show_internal(char *txt)
{
   /* FIXME: maybe log these to a file and display them at some point */
   printf("<<<< Enlightenment Error >>>>\n"
	  "%s\n",
	  txt);
}

/* local subsystem functions */

#include "e.h"

/* local subsystem functions */

/* local subsystem globals */

/* externally accessible functions */
EAPI void
e_error_message_show_internal(char *txt)
{
   /* FIXME: maybe log these to a file and display them at some point */
   printf("<<<< Enlightenment Error >>>>\n%s\n", txt);
}

/* local subsystem functions */

E: Fix formatting. (Really ??? 3 lines for something that can fit on
one ?)

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


#ifndef CONSTANTS_H
#define CONSTANTS_H

#if !defined(__STDC__) && !defined(__cplusplus)
#define const
#endif

/*
	Set up a boolean variable type.  Since this definition could conflict
	with other reasonable definition of BOOLEAN, i.e. using an enumeration,
	it is conditional.
*/
#ifndef BOOLEAN_TYPE_DEFINED
typedef int BOOLEAN;
typedef int BOOL;
#endif

#if defined(TRUE)
#	undef TRUE
#	undef FALSE
#endif

static const int	TRUE = 1;
static const int	FALSE = 0;

/*
	Useful constants for turning seconds into larger units of time.  Since
	these constants may have already been defined elsewhere, they are
	conditional.
*/
#ifndef TIME_CONSTANTS_DEFINED
static const int	MINUTE = 60;
static const int	HOUR = 60 * 60;
static const int	DAY = 24 * 60 * 60;
#endif

/*
  This is for use with strcmp() and related functions which will return
  0 upon a match.
*/
#ifndef MATCH
static const int	MATCH = 0;
#endif
#endif

#ifndef CONSTANTS_H
#define CONSTANTS_H

#if !defined(__STDC__) && !defined(__cplusplus)
#define const
#endif

/*
	Set up a boolean variable type.  Since this definition could conflict
	with other reasonable definition of BOOLEAN, i.e. using an enumeration,
	it is conditional.
*/
#ifndef BOOLEAN_TYPE_DEFINED
typedef int BOOLEAN;
typedef int BOOL_T;
#endif

#if defined(TRUE)
#	undef TRUE
#	undef FALSE
#endif

static const int	TRUE = 1;
static const int	FALSE = 0;

/*
	Useful constants for turning seconds into larger units of time.  Since
	these constants may have already been defined elsewhere, they are
	conditional.
*/
#ifndef TIME_CONSTANTS_DEFINED
static const int	MINUTE = 60;
static const int	HOUR = 60 * 60;
static const int	DAY = 24 * 60 * 60;
#endif

/*
  This is for use with strcmp() and related functions which will return
  0 upon a match.
*/
#ifndef MATCH
static const int	MATCH = 0;
#endif
#endif

Change BOOL to BOOL_T to avoid confilct with "condor_expr.h".


/* workaround for building with old glibc / kernel headers */
#ifdef __linux__
#include <linux/types.h>
#else
#include <sys/types.h>
#endif
#ifndef __kernel_long_t
#define __kernel_long_t long
#endif

#include <alsa/sound/uapi/asound.h>

Fix build error with old kernel headers

header: Fix build error with old kernel headers

Old development environment doesn't necessarily contain the headers
defining __kernel_long_t that is recently used for y2038 timespec
conditional.  Define it explicitly in such a case.

Signed-off-by: Takashi Iwai <4596b3305151c7ee743192a95d394341e3d3b644@suse.de>


#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 default start without menu

UPDATE default start without menu


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

#ifndef BROWSER_BRIGHTRAY_PATHS_H_
#define BROWSER_BRIGHTRAY_PATHS_H_

#include "base/compiler_specific.h"

#if defined(OS_WIN)
#include "base/base_paths_win.h"
#elif defined(OS_MACOSX)
#include "base/base_paths_mac.h"
#endif

#if defined(OS_POSIX)
#include "base/base_paths_posix.h"
#endif

namespace brightray {

enum {
  PATH_START = 1000,

  DIR_USER_DATA = PATH_START,  // Directory where user data can be written.
  DIR_USER_CACHE,  // Directory where user cache can be written.

#if defined(OS_LINUX)
  DIR_APP_DATA,  // Application Data directory under the user profile.
#else
  DIR_APP_DATA = base::DIR_APP_DATA,
#endif

#if defined(OS_POSIX)
  DIR_CACHE = base::DIR_CACHE,  // Directory where to put cache data.
#else
  DIR_CACHE = base::DIR_APP_DATA,
#endif

  PATH_END
};

}  // namespace brightray

#endif  // BROWSER_BRIGHTRAY_PATHS_H_

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

#ifndef BROWSER_BRIGHTRAY_PATHS_H_
#define BROWSER_BRIGHTRAY_PATHS_H_

#include "base/compiler_specific.h"

#if defined(OS_WIN)
#include "base/base_paths_win.h"
#elif defined(OS_MACOSX)
#include "base/base_paths_mac.h"
#endif

#if defined(OS_POSIX)
#include "base/base_paths_posix.h"
#endif

namespace brightray {

enum {
  PATH_START = 11000,

  DIR_USER_DATA = PATH_START,  // Directory where user data can be written.
  DIR_USER_CACHE,  // Directory where user cache can be written.

#if defined(OS_LINUX)
  DIR_APP_DATA,  // Application Data directory under the user profile.
#else
  DIR_APP_DATA = base::DIR_APP_DATA,
#endif

#if defined(OS_POSIX)
  DIR_CACHE = base::DIR_CACHE,  // Directory where to put cache data.
#else
  DIR_CACHE = base::DIR_APP_DATA,
#endif

  PATH_END
};

}  // namespace brightray

#endif  // BROWSER_BRIGHTRAY_PATHS_H_

Change our PATH_START to 11000

Change our PATH_START to 11000


/*
 * A sphere which can be added
 * Author: Dino Wernli
 */

#ifndef SPHERE_H_
#define SPHERE_H_

#include "scene/element.h"
#include "util/point3.h"
#include "util/random.h"

class Material;

class Sphere : public Element {
 public:
  // Does not take ownership of material.
  Sphere(const Point3& center, Scalar radius, const Material& material);
  virtual ~Sphere();

  virtual bool Intersect(const Ray& ray, IntersectionData* data = NULL) const;

  // Returns a uniformly distributed random point on the surface of the sphere.
  // This guarantees that "point" is visible from the returned point.
  Point3 Sample(const Point3& point) const;

 private:
  Point3 center_;
  Scalar radius_;

  static Random random_;
};

#endif  /* SPHERE_H_ */

/*
 * A sphere which can be added
 * Author: Dino Wernli
 */

#ifndef SPHERE_H_
#define SPHERE_H_

#include "scene/element.h"
#include "util/point3.h"
#include "util/random.h"

class Material;

class Sphere : public Element {
 public:
  // Does not take ownership of material.
  Sphere(const Point3& center, Scalar radius, const Material& material);
  virtual ~Sphere();

  virtual bool Intersect(const Ray& ray, IntersectionData* data = NULL) const;

  // Returns a uniformly distributed random point on the surface of the sphere.
  // This guarantees that "point" is visible from the returned point.
  // TODO(dinow): This is not true, replace this my a method taking a normal.
  Point3 Sample(const Point3& point) const;

 private:
  Point3 center_;
  Scalar radius_;

  static Random random_;
};

#endif  /* SPHERE_H_ */

Add todo because comment is wrong.

Add todo because comment is wrong.


#include <dhblock_srv.h>

class pmaint;
struct block_info;

struct adb_keyaux_t;
enum adb_status;

// Internal implementation of content hash repair_job logic.
class rjchash;

class dhblock_chash_srv : public dhblock_srv {
  friend class rjchash;
  ptr<adb> cache_db;

  pmaint *pmaint_obj;

  void localqueue (u_int32_t frags, clnt_stat err, adb_status stat, vec<block_info> keys);

public:
  dhblock_chash_srv (ptr<vnode> node, ptr<dhashcli> cli, str dbname, str dbext,
      str desc, cbv donecb);
  ~dhblock_chash_srv ();

  void start (bool randomize);
  void stop  ();

  void store (chordID k, str d, cb_dhstat cb);
  void offer (user_args *sbp, dhash_offer_arg *arg);
  void stats (vec<dstat> &s);
  void generate_repair_jobs ();
};

#include <dhblock_srv.h>

class pmaint;
struct block_info;

struct adb_keyaux_t;
enum adb_status;

// Internal implementation of content hash repair_job logic.
class rjchash;

class dhblock_chash_srv : public dhblock_srv {
  friend class rjchash;
  ptr<adb> cache_db;

  pmaint *pmaint_obj;

  void localqueue (u_int32_t frags, clnt_stat err, adb_status stat, vec<block_info> keys);

public:
  dhblock_chash_srv (ptr<vnode> node, ptr<dhashcli> cli,
      str desc, str dbname, str dbext, cbv donecb);
  ~dhblock_chash_srv ();

  void start (bool randomize);
  void stop  ();

  void store (chordID k, str d, cb_dhstat cb);
  void offer (user_args *sbp, dhash_offer_arg *arg);
  void stats (vec<dstat> &s);
  void generate_repair_jobs ();
};

Fix mis-named parameters in header.

Fix mis-named parameters in header.


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

int main(int argc, char * argv[]) {
    unsigned int i;
    unsigned int a;
    unsigned int l;

    if (argc != 2) {
        printf("Usage: %s <iterations>\n", argv[0]);
        exit(-1);
    }

    l = (unsigned int) atoi(argv[1]);

    for (i = 0; i < l; i++) {
        a++;
    }

    printf("Finished!\n");

    return 0;
}

Add binary sample (add missing file)

Add binary sample (add missing file)


/*
 * Copyright (c) 2012 Rob Hoelz <rob at hoelz.ro>
 *
 * 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 ROSE_MEMORY_H
#define ROSE_MEMORY_H

void memory_init_gdt(void);
void memory_init_paging(void *kernel_start, void *kernel_end);

#endif

/*
 * Copyright (c) 2012 Rob Hoelz <rob at hoelz.ro>
 *
 * 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 ROSE_MEMORY_H
#define ROSE_MEMORY_H

void memory_init_gdt(void);
void memory_init_paging(void *kernel_start, void *kernel_end);

#define MEMORY_PAGE_ALIGN(addr)\
    ((void *) (((long)addr) & ~0xFFF))

#define MEMORY_IS_PAGE_ALIGNED(addr)\
    ((((long)addr) & 0xFFF) == 0)

#endif

Add macros for page aligning

Add macros for page aligning


#ifndef	IO_PIPE_PAIR_SIMPLE_H
#define	IO_PIPE_PAIR_SIMPLE_H

#include <io/pipe_simple.h>
#include <io/pipe_simple_wrapper.h>

class PipePairSimple : public PipePair {
	PipeSimpleWrapper<PipePairSimple> *incoming_pipe_;
	PipeSimpleWrapper<PipePairSimple> *outgoing_pipe_;
protected:
	PipePairSimple(void)
	: incoming_pipe_(NULL),
	  outgoing_pipe_(NULL)
	{ }
public:
	virtual ~PipePairSimple()
	{
		if (incoming_pipe_ != NULL) {
			delete incoming_pipe_;
			incoming_pipe_ = NULL;
		}

		if (outgoing_pipe_ != NULL) {
			delete outgoing_pipe_;
			outgoing_pipe_ = NULL;
		}
	}

protected:
	virtual bool incoming_process(Buffer *, Buffer *) = 0;
	virtual bool outgoing_process(Buffer *, Buffer *) = 0;

public:
	Pipe *get_incoming(void)
	{
		ASSERT(incoming_pipe_ == NULL);
		incoming_pipe_ = new PipeSimpleWrapper<PipePairSimple>(this, &PipePairSimple::incoming_process);
		return (incoming_pipe_);
	}

	Pipe *get_outgoing(void)
	{
		ASSERT(outgoing_pipe_ == NULL);
		outgoing_pipe_ = new PipeSimpleWrapper<PipePairSimple>(this, &PipePairSimple::outgoing_process);
		return (outgoing_pipe_);
	}
};

#endif /* !IO_PIPE_PAIR_SIMPLE_H */

Add PipePairSimple which allows a user to simply construct a single object which
implements a PipePair.

git-svn-id: 9e2532540f1574e817ce42f20b9d0fb64899e451@486 4068ffdb-0463-0410-8185-8cc71e3bd399


//
//  RXBufferMacros.h
//  rivenx
//

#if !defined(RX_BUFFER_MACROS_H)
#define RX_BUFFER_MACROS_H

#define BUFFER_OFFSET(buffer, bytes) (__typeof__(buffer))((uintptr_t)buffer + (bytes))
#define BUFFER_NOFFSET(buffer, bytes) (__typeof__(buffer))((uintptr_t)buffer - (bytes))
#define BUFFER_ADD_OFFSET(buffer, bytes) (buffer) = BUFFER_OFFSET((buffer), (bytes))

#define BUFFER_DELTA(head_ptr, read_ptr) ((size_t)(((uintptr_t)read_ptr) - ((uintptr_t)head_ptr)))

#define BUFFER_ALIGN(buffer, a) (__typeof__(buffer))(((uintptr_t)(buffer) + (a-1ul)) & ~(a-1ul))
#define BUFFER_ALIGN_SIZE(buffer, a) (size_t)((uintptr_t)BUFFER_ALIGN((buffer), a) - (uintptr_t)(buffer))

#define BUFFER_ALIGN2(buffer) BUFFER_ALIGN(buffer, 2ul)
#define BUFFER_ALIGN4(buffer) BUFFER_ALIGN(buffer, 4ul)
#define BUFFER_ALIGN8(buffer) BUFFER_ALIGN(buffer, 8ul)
#define BUFFER_ALIGN16(buffer) BUFFER_ALIGN(buffer, 16ul)

#endif // RX_BUFFER_MACROS_H

//
//  RXBufferMacros.h
//  rivenx
//

#if !defined(RX_BUFFER_MACROS_H)
#define RX_BUFFER_MACROS_H

#define BUFFER_OFFSET(buffer, bytes) (__typeof__(buffer))((uintptr_t)(buffer) + (bytes))
#define BUFFER_NOFFSET(buffer, bytes) (__typeof__(buffer))((uintptr_t)(buffer) - (bytes))
#define BUFFER_ADD_OFFSET(buffer, bytes) (buffer) = BUFFER_OFFSET((buffer), (bytes))

#define BUFFER_DELTA(head_ptr, read_ptr) ((size_t)(((uintptr_t)(read_ptr)) - ((uintptr_t)(head_ptr))))

#define BUFFER_ALIGN(buffer, a) (__typeof__(buffer))(((uintptr_t)(buffer) + (a-1ul)) & ~(a-1ul))
#define BUFFER_ALIGN_SIZE(buffer, a) (size_t)((uintptr_t)BUFFER_ALIGN((buffer), (a)) - (uintptr_t)(buffer))

#define BUFFER_ALIGN2(buffer) BUFFER_ALIGN(buffer, 2ul)
#define BUFFER_ALIGN4(buffer) BUFFER_ALIGN(buffer, 4ul)
#define BUFFER_ALIGN8(buffer) BUFFER_ALIGN(buffer, 8ul)
#define BUFFER_ALIGN16(buffer) BUFFER_ALIGN(buffer, 16ul)

#endif // RX_BUFFER_MACROS_H

Fix the new buffer macros by ensuring macro arguments are evaluated first.


/*
 * This file is part of Kotaka, a mud library for DGD
 * http://github.com/shentino/kotaka
 *
 * Copyright (C) 2012  Raymond Jennings
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Affero 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 Affero General Public License for more details.
 *
 * You should have received a copy of the GNU Affero General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
#include <kotaka/paths.h>
#include <text/paths.h>

inherit LIB_RAWVERB;

void main(object actor, string args)
{
	object user;
	object *users;
	int i, sz;

	user = query_user();

	if (user->query_class() < 3) {
		send_out("You do not have sufficient access rights to reload properties.\n");
		return;
	}

	"~Game/initd"->configure_properties();
}

Add command to reload property configuration


//-----------------------------------------------------------------------------
// MurmurHash3 was written by Austin Appleby, and is placed in the public
// domain. The author hereby disclaims copyright to this source code.

#ifndef _MURMURHASH3_H_
#define _MURMURHASH3_H_

//-----------------------------------------------------------------------------
// Platform-specific functions and macros

// Microsoft Visual Studio

#if defined(_MSC_VER)

typedef unsigned char uint8_t;
typedef unsigned long uint32_t;
typedef unsigned __int64 uint64_t;

// Other compilers

#else   // defined(_MSC_VER)

#include <stdint.h>

#endif // !defined(_MSC_VER)

//-----------------------------------------------------------------------------

void MurmurHash3_x86_32 (const void * key, int len, uint32_t seed,
                         void * out);

/**
 * The following 2 functions have been altered to just return the
 * 64 most significant bits.
 */
void MurmurHash3_x86_128 (const void * key, int len, uint32_t seed,
                          void * out);

void MurmurHash3_x64_128 (const void * key, int len, uint32_t seed,
                          void * out);

//-----------------------------------------------------------------------------

#endif // _MURMURHASH3_H_

//-----------------------------------------------------------------------------
// MurmurHash3 was written by Austin Appleby, and is placed in the public
// domain. The author hereby disclaims copyright to this source code.

#ifndef _MURMURHASH3_H_
#define _MURMURHASH3_H_

//-----------------------------------------------------------------------------
// Platform-specific functions and macros

#include <stdint.h>

//-----------------------------------------------------------------------------

void MurmurHash3_x86_32 (const void * key, int len, uint32_t seed,
                         void * out);

/**
 * The following 2 functions have been altered to just return the
 * 64 most significant bits.
 */
void MurmurHash3_x86_128 (const void * key, int len, uint32_t seed,
                          void * out);

void MurmurHash3_x64_128 (const void * key, int len, uint32_t seed,
                          void * out);

//-----------------------------------------------------------------------------

#endif // _MURMURHASH3_H_

Fix build break on WIN32

Fix build break on WIN32

New versions of MSVC have stdint.h

Change-Id: Ica591b67c9e09541648d3a47e6c8fc98afde2547
Reviewed-on: http://review.couchbase.org/42716
Tested-by: Trond Norbye <60edd2ef23891a753f231b0c6f161dc634079a93@gmail.com>
Reviewed-by: Chiyoung Seo <fcffc23db27b19ee4ebba46695ee6b50e09216a2@couchbase.com>


/**
 * @file    res_vfork.c
 * @brief   Task resource for vfork
 * @date    May 16, 2014
 * @author  Anton Bondarev
 */

#include <stddef.h>
#include <setjmp.h>

#include <kernel/task.h>
#include <kernel/task/resource.h>
#include <kernel/task/resource/task_vfork.h>

TASK_RESOURCE_DEF(task_vfork_desc, struct task_vfork);

static void task_vfork_init(const struct task *task, void *vfork_buff) {
	task_vfork_end((struct task *)task);
}

static int task_vfork_inherit(const struct task *task,
		const struct task *parent) {
	return 0;
}

static size_t task_vfork_offset;

static const struct task_resource_desc task_vfork_desc = {
	.init = task_vfork_init,
	.inherit = task_vfork_inherit,
	.resource_size = sizeof(struct task_vfork),
	.resource_offset = &task_vfork_offset
};

struct task_vfork *task_resource_vfork(const struct task *task) {
	assert(task != NULL);
	return (void *)task->resources + task_vfork_offset;
}

/**
 * @file    res_vfork.c
 * @brief   Task resource for vfork
 * @date    May 16, 2014
 * @author  Anton Bondarev
 */

#include <stddef.h>
#include <setjmp.h>

#include <util/binalign.h>

#include <kernel/task.h>
#include <kernel/task/resource.h>
#include <kernel/task/resource/task_vfork.h>

TASK_RESOURCE_DEF(task_vfork_desc, struct task_vfork);

static void task_vfork_init(const struct task *task, void *vfork_buff) {
	task_vfork_end((struct task *)task);
}

static int task_vfork_inherit(const struct task *task,
		const struct task *parent) {
	return 0;
}

static size_t task_vfork_offset;

static const struct task_resource_desc task_vfork_desc = {
	.init = task_vfork_init,
	.inherit = task_vfork_inherit,
	.resource_size = sizeof(struct task_vfork),
	.resource_offset = &task_vfork_offset,
};

struct task_vfork *task_resource_vfork(const struct task *task) {
	size_t offset;
	assert(task != NULL);

	offset = (size_t)((void *)task->resources + task_vfork_offset);
#ifdef PT_REGS_ALIGN
	return (void *)binalign_bound(offset, PT_REGS_ALIGN);
#else
	return (void *)offset;
#endif
}

Add alignment for 'vfork' task resource

kernel: Add alignment for 'vfork' task resource


// RUN: %clang_cc1 %s -fblocks -verify -fsyntax-only

#if !__has_attribute(noescape)
#  error "missing noescape attribute"
#endif

int *global_var __attribute((noescape)); // expected-warning{{'noescape' attribute only applies to parameters}}

void foo(__attribute__((noescape)) int *int_ptr,
         __attribute__((noescape)) int (^block)(int),
         __attribute((noescape)) int integer) { // expected-warning{{'noescape' attribute ignored on parameter of non-pointer type 'int'}}
}

// RUN: %clang_cc1 %s -fblocks -verify -fsyntax-only

#if !__has_attribute(noescape)
#  error "missing noescape attribute"
#endif

int *global_var __attribute((noescape)); // expected-warning{{'noescape' attribute only applies to parameters}}

void foo(__attribute__((noescape)) int *int_ptr,
         __attribute__((noescape)) int (^block)(int),
         __attribute((noescape)) int integer) { // expected-warning{{'noescape' attribute only applies to pointer arguments}}
}

Fix expected warning after r313945.

Fix expected warning after r313945.


//
//  Use this file to import your target's public headers that you would like to expose to Swift.
//

#import "UIViewController+FullScreenLoading.h"
#import "ArtsyAPI+Sales.h"

#import "ARScrollNavigationChief.h"
#import "ARWhitespaceGobbler.h"
#import "ARCountdownView.h"
#import "UIView+HitTestExpansion.h"
#import "ARSeparatorViews.h"
#import "ArtsyAPI+CurrentUserFunctions.h"

// Perhaps in the future we could use https://github.com/orta/ar_dispatch/ for now though eigen does more than this lib
#import "ARDispatchManager.h"

// Models.
#import "Sale.h"

#import "Artwork.h"
#import "AREmbeddedModelsViewController.h"
#import "ARArtworkMasonryModule.h"

#import "UIViewController+SimpleChildren.h"
#import "UIViewController+ARUserActivity.h"

// For building out Auction Information VC

#import "ARNavigationButtonsViewController.h"
#import "ARNavigationButton.h"

#import "ARSerifNavigationViewController.h"

#import "ARTextView.h"

#import "ARThemedFactory.h"
#import "ARFonts.h"

// Temporary for building out auctionVC
#import "ARArtistNetworkModel.h"
#import "ARGeneArtworksNetworkModel.h"

// Libraries
#import <Aerodramus/Aerodramus.h>

//
//  Use this file to import your target's public headers that you would like to expose to Swift.
//

#import "UIViewController+FullScreenLoading.h"
#import "ArtsyAPI+Sales.h"

#import "ARScrollNavigationChief.h"
#import "ARWhitespaceGobbler.h"
#import "ARCountdownView.h"
#import "UIView+HitTestExpansion.h"
#import "ARSeparatorViews.h"
#import "ArtsyAPI+CurrentUserFunctions.h"

// Perhaps in the future we could use https://github.com/orta/ar_dispatch/ for now though eigen does more than this lib
#import "ARDispatchManager.h"

// Models.
#import "Sale.h"

#import "Artwork.h"
#import "AREmbeddedModelsViewController.h"
#import "ARArtworkMasonryModule.h"

#import "UIViewController+SimpleChildren.h"
#import "UIViewController+ARUserActivity.h"

// For building out Auction Information VC

#import "ARNavigationButtonsViewController.h"
#import "ARNavigationButton.h"

#import "ARSerifNavigationViewController.h"

#import "ARTextView.h"
#import "ARFonts.h"

// Temporary for building out auctionVC
#import "ARArtistNetworkModel.h"
#import "ARGeneArtworksNetworkModel.h"

Remove unused imports from the swift bridging header


/*
  This file is part of the Grantlee template system.

  Copyright (c) 2009 Stephen Kelly <steveire@gmail.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 3 only, as published by the Free Software Foundation.

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

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

*/

#ifndef GRANTLEE_EXPORT_H
#define GRANTLEE_EXPORT_H

#ifndef GRANTLEE_EXPORT
#  if defined(GRANTLEE_CORE_LIB_MAKEDLL)
#    define GRANTLEE_EXPORT __declspec(dllexport)
#  else
#    define GRANTLEE_EXPORT __declspec(dllimport)
#  endif
#endif

#endif

/*
  This file is part of the Grantlee template system.

  Copyright (c) 2009 Stephen Kelly <steveire@gmail.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 3 only, as published by the Free Software Foundation.

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

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

*/

#ifndef GRANTLEE_EXPORT_H
#define GRANTLEE_EXPORT_H

#if defined(_WIN32) || defined(_WIN64)
#  ifndef GRANTLEE_EXPORT
#    if defined(GRANTLEE_CORE_LIB_MAKEDLL)
#      define GRANTLEE_EXPORT __declspec(dllexport)
#    else
#      define GRANTLEE_EXPORT __declspec(dllimport)
#    endif
#  endif
#else
#  define GRANTLEE_EXPORT
#endif

#endif

Disable the export stuff on non-windows.