//
//  generator.h
//  SequentialSA
//
//  Created by Vincent Ramdhanie on 3/15/15.
//  Copyright (c) 2015 Vincent Ramdhanie. All rights reserved.
//

#ifndef __SequentialSA__generator__
#define __SequentialSA__generator__

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

#endif /* defined(__SequentialSA__generator__) */

#define PLOT_N 5   /*The size of the plot array*/
#define PLOT_M 5
#define TEMPERATURE 1000 /*Initial temperature*/
#define NUMBER_ITERATIONS 1000 /*Total number of iterations to execute*/

/*
  Performs the generation on the data and stores it in a file
 */
void generate(int a[][PLOT_M]);
void print(int a[][PLOT_M]);

//
//  generator.h
//  SequentialSA
//
//  Created by Vincent Ramdhanie on 3/15/15.
//  Copyright (c) 2015 Vincent Ramdhanie. All rights reserved.
//

#ifndef __SequentialSA__generator__
#define __SequentialSA__generator__

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

#endif /* defined(__SequentialSA__generator__) */

#define PLOT_N 5   /*The size of the plot array*/
#define PLOT_M 5
#define TEMPERATURE 1000 /*Initial temperature*/
#define NUMBER_ITERATIONS 1000 /*Total number of iterations to execute*/

/*
  Performs the generation on the data and stores it in a file
 */
void generate(int a[PLOT_N][PLOT_M]);
void print(int a[PLOT_N][PLOT_M]);

Create header file with constants and function definitions


#import <Foundation/Foundation.h>

/**
 Category methods on commonly used types for generating random instances.

 Inspired by Haskell's QuickCheck.
 */

@interface NSString (TDTRandomFixtures)

+ (instancetype)randomString;

@end

@interface NSNumber (TDTRandomFixtures)

+ (instancetype)randomNumber;

@end

@interface NSArray (TDTRandomFixtures)

+ (instancetype)randomArrayOfLength:(NSUInteger)length;

@end

@interface NSURL (TDTRandomFixtures)

+ (instancetype)randomURL;

@end

#import <Foundation/Foundation.h>

/**
 Category methods on commonly used types for generating random instances.

 Inspired by Haskell's QuickCheck.
 */

@interface NSString (TDTRandomFixtures)

/**
 @return A string consisting of random characters.
         It is guranteed to be non empty.
 */
+ (instancetype)randomString;

@end

@interface NSNumber (TDTRandomFixtures)

+ (instancetype)randomNumber;

@end

@interface NSArray (TDTRandomFixtures)

+ (instancetype)randomArrayOfLength:(NSUInteger)length;

@end

@interface NSURL (TDTRandomFixtures)

+ (instancetype)randomURL;

@end

Document that `randomString` will never return an empty string


// Copyright 2008 Wincent Colaiuta
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program.  If not, see <http://www.gnu.org/licenses/>.

#include <ruby/ruby.h>
#include <stdint.h>

// Wikitext
extern VALUE mWikitext;

// Wikitext::Parser
extern VALUE cWikitextParser;

// Wikitext::Parser::Error
// error raised when scanning fails
extern VALUE eWikitextParserError;

// Wikitext::Parser::Token
extern VALUE cWikitextParserToken;

// Copyright 2008 Wincent Colaiuta
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program.  If not, see <http://www.gnu.org/licenses/>.

#include <ruby/ruby.h>
#include <stdint.h>

#define ruby_inspect(obj) rb_funcall(rb_mKernel, rb_intern("p"), 1, obj)

// Wikitext
extern VALUE mWikitext;

// Wikitext::Parser
extern VALUE cWikitextParser;

// Wikitext::Parser::Error
// error raised when scanning fails
extern VALUE eWikitextParserError;

// Wikitext::Parser::Token
extern VALUE cWikitextParserToken;

Add ruby_inspect macro for use when debugging

Just calls Kernel#p passing in the specified Ruby object.

Signed-off-by: Wincent Colaiuta <c76ac2e9cd86441713c7dfae92c451f3e6d17fdc@wincent.com>


/**
 * PHP7 extension for Action Message Format (AMF) encoding and decoding with support for AMF0 and AMF3
 *
 * amfext (http://emilmalinov.com/amfext)
 *
 * @copyright Copyright (c) 2015 Emil Malinov
 * @license   http://www.apache.org/licenses/LICENSE-2.0 Apache License 2.0
 * @link      http://github.com/emilkm/amfext
 * @package   amfext
 *
 * @author    Emanuele Ruffaldi emanuele.ruffaldi@gmail.com - original version for PHP 5.2
 * @author    Emil Malinov - PHP 7.X, PHP 5.X maintenance, unit tests, enhancements, bug fixes
 */

#ifndef PHP_AMF_H
#define PHP_AMF_H 1

#define PHP_AMF_VERSION "0.1"
#define PHP_AMF_WORLD_EXTNAME "amf"

PHP_FUNCTION(amf_encode);
PHP_FUNCTION(amf_decode);

extern zend_module_entry amf_module_entry;
#define phpext_amf_ptr &amf_module_entry

#endif

Add license comment to the header file.

Add license comment to the header file.


#ifdef __CINT__
/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
 * See cxx source for full Copyright notice                               */

/* $Id$ */

#pragma link off all globals;
#pragma link off all classes;
#pragma link off all functions;

#pragma link C++ enum   Process_t;
#pragma link C++ enum   Decay_t;
#pragma link C++ enum   StrucFunc_t;
#pragma link C++ enum   Param_t;

#pragma link C++ class  AliGenHIJINGpara;
#pragma link C++ class  AliGenFixed;
#pragma link C++ class  AliGenBox;
#pragma link C++ class  AliGenParam;
#pragma link C++ class  AliGenPythia;
#pragma link C++ class  AliGenCocktail-;
#pragma link C++ class  AliGenCocktailEntry;
#pragma link C++ class  AliGenExtFile;
#pragma link C++ class  AliGenScan;
#pragma link C++ class  AliPythia;
#pragma link C++ class  AliGenMUONlib;
#pragma link C++ class  AliGenFLUKAsource;
#pragma link C++ class  AliGenHalo;
#pragma link C++ class  AliDimuCombinator;
#endif

#ifdef __CINT__
/* Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
 * See cxx source for full Copyright notice                               */

/* $Id$ */

#pragma link off all globals;
#pragma link off all classes;
#pragma link off all functions;

#pragma link C++ enum   Process_t;
#pragma link C++ enum   Decay_t;
#pragma link C++ enum   StrucFunc_t;
#pragma link C++ enum   Param_t;
#pragma link C++ enum   Weighting_t;

#pragma link C++ class  AliGenHIJINGpara;
#pragma link C++ class  AliGenFixed;
#pragma link C++ class  AliGenBox;
#pragma link C++ class  AliGenParam;
#pragma link C++ class  AliGenPythia;
#pragma link C++ class  AliGenCocktail-;
#pragma link C++ class  AliGenCocktailEntry;
#pragma link C++ class  AliGenExtFile;
#pragma link C++ class  AliGenScan;
#pragma link C++ class  AliPythia;
#pragma link C++ class  AliGenMUONlib;
#pragma link C++ class  AliGenFLUKAsource;
#pragma link C++ class  AliGenHalo;
#pragma link C++ class  AliDimuCombinator;
#endif

Add Weighting_t in the LinkDef

Add Weighting_t in the LinkDef


//
//  EXPDefines.h
//  Expecta
//
//  Created by Luke Redpath on 26/03/2012.
//  Copyright (c) 2012 Peter Jihoon Kim. All rights reserved.
//

#ifndef Expecta_EXPDefines_h
#define Expecta_EXPDefines_h

typedef void (^EXPBasicBlock)();
typedef id (^EXPIdBlock)();
typedef BOOL (^EXPBoolBlock)();
typedef NSString *(^EXPStringBlock)();

#endif

//
//  EXPDefines.h
//  Expecta
//
//  Created by Luke Redpath on 26/03/2012.
//  Copyright (c) 2012 Peter Jihoon Kim. All rights reserved.
//

#ifndef Expecta_EXPDefines_h
#define Expecta_EXPDefines_h

typedef void (^EXPBasicBlock)(void);
typedef id (^EXPIdBlock)(void);
typedef BOOL (^EXPBoolBlock)(void);
typedef NSString *(^EXPStringBlock)(void);

#endif

Fix warning ‘This function declaration is not a prototype’


/*
 * MUSCLE SmartCard Development ( http://www.linuxnet.com )
 *
 * Copyright (C) 2000-2003
 *  David Corcoran <corcoran@linuxnet.com>
 *
 * $Id$
 */

/**
 * @file
 * @brief This provides a search API for hot pluggble devices.
 *
 * Check for platforms that have their own specific support.
 * It's easier and flexible to do it here, rather than
 * with automake conditionals in src/Makefile.am.
 * No, it's still not a perfect solution design wise.
 */

#include "config.h"
#include "pcsclite.h"

#if !defined(__APPLE__) && !defined(HAVE_LIBUSB) && !defined(__linux__)

LONG HPSearchHotPluggables(void)
{
	return 0;
}

ULONG HPRegisterForHotplugEvents(void)
{
	return 0;
}

LONG HPStopHotPluggables(void)
{
	return 0;
}

#endif

/*
 * MUSCLE SmartCard Development ( http://www.linuxnet.com )
 *
 * Copyright (C) 2000-2003
 *  David Corcoran <corcoran@linuxnet.com>
 *
 * $Id$
 */

/**
 * @file
 * @brief This provides a search API for hot pluggble devices.
 *
 * Check for platforms that have their own specific support.
 * It's easier and flexible to do it here, rather than
 * with automake conditionals in src/Makefile.am.
 * No, it's still not a perfect solution design wise.
 */

#include "config.h"
#include "pcsclite.h"

#ifndef TRUE
#define TRUE 1
#define FALSE 0
#endif

#if !defined(__APPLE__) && !defined(HAVE_LIBUSB) && !defined(__linux__)

char ReCheckSerialReaders = FALSE;

LONG HPSearchHotPluggables(void)
{
	return 0;
}

ULONG HPRegisterForHotplugEvents(void)
{
	return 0;
}

LONG HPStopHotPluggables(void)
{
	return 0;
}

void HPReCheckSerialReaders(void)
{
	ReCheckSerialReaders = TRUE;
}

#endif

Add missing ReCheckSerialReaders and HPReCheckSerialReaders() so
pcsc-lite can compile on FreeBSD and others

git-svn-id: f2d781e409b7e36a714fc884bb9b2fc5091ddd28@1786 0ce88b0d-b2fd-0310-8134-9614164e65ea


#include "comm.h"

static void inbox_received_handler(DictionaryIterator *iter, void *context) {
#if defined(PBL_COLOR)
  Tuple *background_t = dict_find(iter, AppKeyColorBackground);
  if(background_t) {
    data_set_color(ColorBackground, (GColor){ .argb = background_t->value->int32 });
  }

  Tuple *sides_t = dict_find(iter, AppKeyColorSides);
  if(sides_t) {
    data_set_color(ColorSides, (GColor){ .argb = sides_t->value->int32 });
  }

  Tuple *face_t = dict_find(iter, AppKeyColorFace);
  if(face_t) {
    data_set_color(ColorFace, (GColor){ .argb = face_t->value->int32 });
  }
#endif

  // Other settings
  Tuple *anim_t = dict_find(iter, AppKeyAnimations);
  if(anim_t) {
    data_set_animations(anim_t->value->int32 == 1);
  }

  Tuple *bluetooth_t = dict_find(iter, AppKeyBluetooth);
  if(bluetooth_t) {
    data_set_bluetooth_alert(bluetooth_t->value->int32 == 1);
  }

  // Quit to be reloaded
  window_stack_pop_all(true);
}

void comm_init(int inbox, int outbox) {
  app_message_register_inbox_received(inbox_received_handler);
  app_message_open(inbox, outbox);
}

#include "comm.h"

static void inbox_received_handler(DictionaryIterator *iter, void *context) {
#if defined(PBL_COLOR)
  Tuple *background_t = dict_find(iter, AppKeyColorBackground);
  if(background_t) {
    data_set_color(ColorBackground, (GColor){ .argb = background_t->value->int8 });
  }

  Tuple *sides_t = dict_find(iter, AppKeyColorSides);
  if(sides_t) {
    data_set_color(ColorSides, (GColor){ .argb = sides_t->value->int8 });
  }

  Tuple *face_t = dict_find(iter, AppKeyColorFace);
  if(face_t) {
    data_set_color(ColorFace, (GColor){ .argb = face_t->value->int8 });
  }
#endif

  // Other settings
  Tuple *anim_t = dict_find(iter, AppKeyAnimations);
  if(anim_t) {
    data_set_animations(anim_t->value->int8 == 1);
  }

  Tuple *bluetooth_t = dict_find(iter, AppKeyBluetooth);
  if(bluetooth_t) {
    data_set_bluetooth_alert(bluetooth_t->value->int8 == 1);
  }

  // Quit to be reloaded
  window_stack_pop_all(true);
}

void comm_init(int inbox, int outbox) {
  app_message_register_inbox_received(inbox_received_handler);
  app_message_open(inbox, outbox);
}

Use more reliable union value

Use more reliable union value


/* -*- mode:linux -*- */
/**
 * \file state.h
 *
 *
 *
 * \author Ethan Burns
 * \date 2008-10-08
 */
#if !defined(_STATE_H_)
#define _STATE_H_

#include <iostream>
#include <vector>

#include "search_domain.h"

using namespace std;

class State {
public:
	State(const SearchDomain *d, const State *parent, int g);

	virtual int hash(void) const = 0;
	virtual bool is_goal(void) const = 0;
	virtual State *clone(void) const = 0;
	virtual void print(ostream &o) const = 0;

	virtual vector<const State*> *expand(void) const;

	virtual int get_g(void) const;
	virtual int get_h(void) const;
	virtual void set_parent(const State *);
	virtual const State *get_parent(void) const;
protected:
	const State *parent;
	const SearchDomain *domain;
	int g;
	int h;
};

#endif	/* !_STATE_H_ */

/* -*- mode:linux -*- */
/**
 * \file state.h
 *
 *
 *
 * \author Ethan Burns
 * \date 2008-10-08
 */
#if !defined(_STATE_H_)
#define _STATE_H_

#include <iostream>
#include <vector>

#include "search_domain.h"

using namespace std;

class State {
public:
	State(const SearchDomain *d, const State *parent, int g);

	virtual int hash(void) const = 0;
	virtual bool is_goal(void) const = 0;
	virtual State *clone(void) const = 0;
	virtual void print(ostream &o) const = 0;

	virtual vector<const State*> *expand(void) const;

	virtual int get_g(void) const;
	virtual int get_h(void) const;
	virtual void set_parent(const State *);
	virtual const State *get_parent(void) const;
protected:
	const State *parent;
	const SearchDomain *domain;
	float g;
	float h;
};

#endif	/* !_STATE_H_ */

Use floats for cost and heuristic values.


#ifndef _ASM_X86_NUMA_32_H
#define _ASM_X86_NUMA_32_H

extern int numa_off;

extern int pxm_to_nid(int pxm);

#ifdef CONFIG_NUMA
extern int __cpuinit numa_cpu_node(int apicid);
#else	/* CONFIG_NUMA */
static inline int numa_cpu_node(int cpu)		{ return NUMA_NO_NODE; }
#endif	/* CONFIG_NUMA */

#ifdef CONFIG_HIGHMEM
extern void set_highmem_pages_init(void);
#else
static inline void set_highmem_pages_init(void)
{
}
#endif

#endif /* _ASM_X86_NUMA_32_H */

#ifndef _ASM_X86_NUMA_32_H
#define _ASM_X86_NUMA_32_H

extern int numa_off;

extern int pxm_to_nid(int pxm);

#ifdef CONFIG_NUMA
extern int __cpuinit numa_cpu_node(int cpu);
#else	/* CONFIG_NUMA */
static inline int numa_cpu_node(int cpu)		{ return NUMA_NO_NODE; }
#endif	/* CONFIG_NUMA */

#ifdef CONFIG_HIGHMEM
extern void set_highmem_pages_init(void);
#else
static inline void set_highmem_pages_init(void)
{
}
#endif

#endif /* _ASM_X86_NUMA_32_H */

x86: Rename incorrectly named parameter of numa_cpu_node()

numa_cpu_node() prototype in numa_32.h has wrongly named
parameter @apicid when it actually takes the CPU number.

Change it to @cpu.

Reported-by: Yinghai Lu <0674548f4d596393408a51d6287a76ebba2f42aa@kernel.org>
Signed-off-by: Tejun Heo <546b05909706652891a87f7bfe385ae147f61f91@kernel.org>
LKML-Reference: <f632a7ad4ac6ff59d2c90454ea4e3c237f8c7a30@htj.dyndns.org>
Signed-off-by: Ingo Molnar <9dbbbf0688fedc85ad4da37637f1a64b8c718ee2@elte.hu>


/*
Copyright (c) 2012 Carsten Burstedde, Donna Calhoun
All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:

 * Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
 * Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.

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

#include <fclaw2d_forestclaw.h>

void fclaw2d_after_regrid(fclaw2d_domain_t *domain)
{
    if (fclaw2d_vt()->after_regrid != NULL)
    {
        fclaw2d_vt()->after_regrid(domain);
    }
}

void fclaw2d_problem_setup(fclaw2d_domain_t *domain)
{
    /* User defined problem setup */
    if (fclaw2d_vt()->problem_setup != NULL)
    {
        fclaw2d_vt()->problem_setup(domain);
    }
}

Add function wrappers for forestclaw.c

Add function wrappers for forestclaw.c


// RUN: %clang -c -isysroot /FOO %s 2>&1 | FileCheck --check-prefix=CHECK-SHOW-OPTION-NAMES %s
// CHECK-SHOW-OPTION-NAMES: warning: no such sysroot directory: '{{([A-Za-z]:.*)?}}/FOO' [-Wmissing-sysroot]

// RUN: %clang -c -fno-diagnostics-show-option -isysroot /FOO %s 2>&1 | FileCheck --check-prefix=CHECK-NO-SHOW-OPTION-NAMES %s
// CHECK-NO-SHOW-OPTION-NAMES: warning: no such sysroot directory: '{{([A-Za-z]:.*)?}}/FOO'{{$}}

// REQUIRES: x86-registered-target

// RUN: %clang -target x86_64-apple-darwin -c -isysroot /FOO %s 2>&1 | FileCheck --check-prefix=CHECK-SHOW-OPTION-NAMES %s
// CHECK-SHOW-OPTION-NAMES: warning: no such sysroot directory: '{{([A-Za-z]:.*)?}}/FOO' [-Wmissing-sysroot]

// RUN: %clang -target x86_64-apple-darwin -c -fno-diagnostics-show-option -isysroot /FOO %s 2>&1 | FileCheck --check-prefix=CHECK-NO-SHOW-OPTION-NAMES %s
// CHECK-NO-SHOW-OPTION-NAMES: warning: no such sysroot directory: '{{([A-Za-z]:.*)?}}/FOO'{{$}}

Fix test from r283913 to unbreak bots

[Driver] Fix test from r283913 to unbreak bots

Followup from r283913 & r283827

http://bb.pgr.jp/builders/cmake-clang-x86_64-linux/builds/55135

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


/* -*- c-file-style:"stroustrup"; indent-tabs-mode: nil -*- */
#if !defined INC_PUBNUB_VERSION_INTERNAL
#define INC_PUBNUB_VERSION_INTERNAL

#define PUBNUB_SDK_VERSION "2.2.11"

#endif /* !defined INC_PUBNUB_VERSION_INTERNAL */

Add internal/common version (number) header file.


// RUN: %clang     -target i386-unknown-unknown -fthread-sanitizer %s -S -emit-llvm -o - | FileCheck %s
// RUN: %clang -O1 -target i386-unknown-unknown -fthread-sanitizer %s -S -emit-llvm -o - | FileCheck %s
// RUN: %clang -O2 -target i386-unknown-unknown -fthread-sanitizer %s -S -emit-llvm -o - | FileCheck %s
// RUN: %clang -O3 -target i386-unknown-unknown -fthread-sanitizer %s -S -emit-llvm -o - | FileCheck %s
// RUN: %clang     -target i386-unknown-unknown -fsanitize=thread  %s -S -emit-llvm -o - | FileCheck %s
// Verify that -fthread-sanitizer invokes tsan instrumentation.

int foo(int *a) { return *a; }
// CHECK: __tsan_init

// RUN: %clang     -target i386-unknown-unknown -fsanitize=thread %s -S -emit-llvm -o - | FileCheck %s
// RUN: %clang -O1 -target i386-unknown-unknown -fsanitize=thread %s -S -emit-llvm -o - | FileCheck %s
// RUN: %clang -O2 -target i386-unknown-unknown -fsanitize=thread %s -S -emit-llvm -o - | FileCheck %s
// RUN: %clang -O3 -target i386-unknown-unknown -fsanitize=thread %s -S -emit-llvm -o - | FileCheck %s
// RUN: %clang     -target i386-unknown-unknown -fsanitize=thread  %s -S -emit-llvm -o - | FileCheck %s
// Verify that -fsanitize=thread invokes tsan instrumentation.

int foo(int *a) { return *a; }
// CHECK: __tsan_init

Use the -fsanitize=thread flag to unbreak buildbot.

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


#include "e.h"
#include "e_mod_main.h"
#include "e_mod_config.h"
#include "e_kbd_int.h"

/* local variables */
static E_Kbd_Int *ki = NULL;

EAPI E_Module_Api e_modapi = { E_MODULE_API_VERSION, "Illume Keyboard" };

EAPI void *
e_modapi_init(E_Module *m)
{
   if (!il_kbd_config_init(m)) return NULL;

   ki = e_kbd_int_new(mod_dir, mod_dir, mod_dir);

   return m;
}

EAPI int
e_modapi_shutdown(E_Module *m)
{
   if (ki)
     {
        e_kbd_int_free(ki);
        ki = NULL;
     }
   il_kbd_config_shutdown();
   return 1;
}

EAPI int
e_modapi_save(E_Module *m)
{
   return il_kbd_config_save();
}

#include "e.h"
#include "e_mod_main.h"
#include "e_mod_config.h"
#include "e_kbd_int.h"

/* local variables */
static E_Kbd_Int *ki = NULL;

EAPI E_Module_Api e_modapi = { E_MODULE_API_VERSION, "Illume Keyboard" };

EAPI void *
e_modapi_init(E_Module *m)
{
   if (!il_kbd_config_init(m)) return NULL;

   ki = e_kbd_int_new(il_kbd_cfg->mod_dir,
                      il_kbd_cfg->mod_dir, il_kbd_cfg->mod_dir);

   return m;
}

EAPI int
e_modapi_shutdown(E_Module *m)
{
   if (ki)
     {
        e_kbd_int_free(ki);
        ki = NULL;
     }
   il_kbd_config_shutdown();
   return 1;
}

EAPI int
e_modapi_save(E_Module *m)
{
   return il_kbd_config_save();
}

Use correct module directory when making keyboard.
Previous commit fixed compiler warnings also.

SVN revision: 43875


#include "rtp/kms-rtp-endpoint.h"
#include <glib.h>

#define LOCALNAME "kms/rtp/1"

static KmsEndpoint*
create_endpoint() {
	KmsEndpoint *ep;
	gchar *name;

	name = g_strdup_printf(LOCALNAME);

	ep = g_object_new(KMS_TYPE_RTP_ENDPOINT, "localname", name, NULL);

	g_free(name);
	return ep;
}

static void
check_endpoint(KmsEndpoint *ep) {
	gchar *name;

	g_object_get(ep, "localname", &name, NULL);

	g_assert(g_strcmp0(name, LOCALNAME) == 0);

	g_free(name);
}

gint
main(gint argc, gchar **argv) {
	KmsEndpoint *ep;

	g_type_init();

	ep = create_endpoint();
	check_endpoint(ep);

	g_object_unref(ep);

	return 0;
}

#include "rtp/kms-rtp-endpoint.h"
#include <glib.h>

#define LOCALNAME "kms/rtp/1"

static KmsEndpoint*
create_endpoint() {
	KmsEndpoint *ep;
	gchar *name;

	name = g_strdup_printf(LOCALNAME);

	ep = g_object_new(KMS_TYPE_RTP_ENDPOINT, "localname", name, NULL);

	g_free(name);
	return ep;
}

static void
check_endpoint(KmsEndpoint *ep) {
	gchar *name;

	g_object_get(ep, "localname", &name, NULL);

	g_assert(g_strcmp0(name, LOCALNAME) == 0);

	g_free(name);
}

gint
main(gint argc, gchar **argv) {
	KmsEndpoint *ep;
	KmsConnection *conn;

	g_type_init();

	ep = create_endpoint();
	check_endpoint(ep);

	conn = kms_endpoint_create_connection(ep, KMS_CONNECTION_TYPE_RTP,
									NULL);
	kms_endpoint_delete_connection(ep, conn, NULL);
	g_object_unref(conn);

	check_endpoint(ep);

	g_object_unref(ep);

	return 0;
}

Create and delete rtp connections

Create and delete rtp connections


#pragma once

#include <QtGui/QMouseEvent>
#include <QtGui/QPaintEvent>
#include <QtWidgets/QWidget>

#include "binaryninjaapi.h"
#include "dockhandler.h"
#include "uitypes.h"

class ContextMenuManager;
class DisassemblyContainer;
class Menu;
class ViewFrame;

class BINARYNINJAUIAPI ReflectionView: public QWidget, public DockContextHandler
{
	Q_OBJECT
	Q_INTERFACES(DockContextHandler)

	ViewFrame* m_frame;
	BinaryViewRef m_data;
	DisassemblyContainer* m_disassemblyContainer;

public:
	ReflectionView(ViewFrame* frame, BinaryViewRef data);
	~ReflectionView();

	virtual void notifyOffsetChanged(uint64_t offset) override;
	virtual void notifyViewChanged(ViewFrame* frame) override;
	virtual void notifyVisibilityChanged(bool visible) override;
	virtual bool shouldBeVisible(ViewFrame* frame) override;

protected:
	virtual void contextMenuEvent(QContextMenuEvent* event) override;
};

#pragma once

#include <QtGui/QMouseEvent>
#include <QtGui/QPaintEvent>
#include <QtWidgets/QWidget>

#include "binaryninjaapi.h"
#include "dockhandler.h"
#include "uitypes.h"

class ContextMenuManager;
class DisassemblyContainer;
class Menu;
class ViewFrame;

class BINARYNINJAUIAPI ReflectionView: public QWidget, public DockContextHandler
{
	Q_OBJECT
	Q_INTERFACES(DockContextHandler)

	ViewFrame* m_frame;
	BinaryViewRef m_data;
	DisassemblyContainer* m_disassemblyContainer;

public:
	ReflectionView(ViewFrame* frame, BinaryViewRef data);
	~ReflectionView();

	virtual void notifyViewLocationChanged(View* view, const ViewLocation& viewLocation) override;
	virtual void notifyVisibilityChanged(bool visible) override;
	virtual bool shouldBeVisible(ViewFrame* frame) override;

protected:
	virtual void contextMenuEvent(QContextMenuEvent* event) override;
};

Update reflection view to use view location notification.


#pragma once

#include <unistd.h>
#include <sys/syscall.h>

#ifdef HAVE_LINUX_MODULE_H
#include <linux/module.h>
#endif

#ifndef MODULE_INIT_IGNORE_MODVERSIONS
# define MODULE_INIT_IGNORE_MODVERSIONS 1
#endif

#ifndef MODULE_INIT_IGNORE_VERMAGIC
# define MODULE_INIT_IGNORE_VERMAGIC 2
#endif

#ifndef __NR_finit_module
# define __NR_finit_module -1
#endif

#ifndef HAVE_FINIT_MODULE
#include <errno.h>

static inline int finit_module(int fd, const char *uargs, int flags)
{
	if (__NR_finit_module == -1) {
		errno = ENOSYS;
		return -1;
	}

	return syscall(__NR_finit_module, fd, uargs, flags);
}
#endif

#if !HAVE_DECL_STRNDUPA
#define strndupa(s, length) \
	({ \
		size_t __len = strnlen((s), (length)); \
		strncpy(alloca(__len + 1), (s), __len);  \
	 })
#endif

#pragma once

#include <unistd.h>
#include <sys/syscall.h>

#ifdef HAVE_LINUX_MODULE_H
#include <linux/module.h>
#endif

#ifndef MODULE_INIT_IGNORE_MODVERSIONS
# define MODULE_INIT_IGNORE_MODVERSIONS 1
#endif

#ifndef MODULE_INIT_IGNORE_VERMAGIC
# define MODULE_INIT_IGNORE_VERMAGIC 2
#endif

#ifndef __NR_finit_module
# define __NR_finit_module -1
#endif

#ifndef HAVE_FINIT_MODULE
#include <errno.h>

static inline int finit_module(int fd, const char *uargs, int flags)
{
	if (__NR_finit_module == -1) {
		errno = ENOSYS;
		return -1;
	}

	return syscall(__NR_finit_module, fd, uargs, flags);
}
#endif

#if !HAVE_DECL_STRNDUPA
#define strndupa(s, n)							\
	({								\
		const char *__old = (s);				\
		size_t __len = strnlen(__old, (n));			\
		char *__new = alloca(__len + 1);			\
		__new[__len] = '\0';					\
		memcpy(__new, __old, __len);				\
	 })
#endif

Make sure there's NUL byte at the end of strndupa

Since strcpy() doesn't ensure we have a NUL byte in the resulting
string, use alloca() + memcpy(). Also make sure we don't evaluate "s"
twice.


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

#ifndef _VAL_CLIENT_H_
#define _VAL_CLIENT_H_

#include "val.h"
#include "psa/client.h"
#include "crypto_values.h"

#define INVALID_SID                     0x0000FA20

#ifndef CLIENT_TEST_DISPATCHER_SID
#define CLIENT_TEST_DISPATCHER_SID      0x0
#endif

#ifndef SERVER_TEST_DISPATCHER_SID
#define SERVER_TEST_DISPATCHER_SID      0x0
#endif
#endif /* _VAL_CLIENT_H_ */

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

#ifndef _VAL_CLIENT_H_
#define _VAL_CLIENT_H_

#include "val.h"
#include "psa/client.h"
#include "psa/crypto_types.h"
#include "psa/crypto_values.h"

#define INVALID_SID                     0x0000FA20

#ifndef CLIENT_TEST_DISPATCHER_SID
#define CLIENT_TEST_DISPATCHER_SID      0x0
#endif

#ifndef SERVER_TEST_DISPATCHER_SID
#define SERVER_TEST_DISPATCHER_SID      0x0
#endif
#endif /* _VAL_CLIENT_H_ */

Add missing inclusion of crypto_types.h

psa: Add missing inclusion of crypto_types.h

val_client_defs.h includes crypto_values.h, but the latter requires
type definitions from crypto_types.h.


#include <ctype.h>
#include <stdio.h>
#include <stdlib.h>
#include <termios.h>
#include <unistd.h>

struct termios orig_termios;

void disableRawMode() {
  tcsetattr(STDIN_FILENO, TCSAFLUSH, &orig_termios);
}

void enableRawMode() {
  tcgetattr(STDIN_FILENO, &orig_termios);
  atexit(disableRawMode);

  struct termios raw = orig_termios;
  raw.c_lflag &= ~(ECHO | ICANON);

  tcsetattr(STDIN_FILENO, TCSAFLUSH, &raw);
}

int main() {
  enableRawMode();

  char c;
  while (read(STDIN_FILENO, &c, 1) == 1 && c != 'q') {
    if (iscntrl(c)) {
      printf("%d\n", c);
    } else {
      printf("%d ('%c')\n", c, c);
    }
  }

  return 0;
}

Include a Ruten code, demonstrating keystroke reading


#pragma once

#include "rapidcheck/Shrinkable.h"

namespace rc {
namespace shrinkable {

//! Maps the given shrinkable using the given mapping callable.
template<typename T, typename Mapper>
Shrinkable<typename std::result_of<Mapper(T)>::type>
map(Mapper &&mapper, Shrinkable<T> shrinkable);

//! Returns a shrinkable equal to the given shrinkable but with the shrinks
//! (lazily) mapped by the given mapping callable. Since the value is not mapped
//! also the output type is the same as the output type.
template<typename T, typename Mapper>
Shrinkable<T> mapShrinks(Mapper &&mapper, Shrinkable<T> shrinkable);

//! Recursively filters the given shrinkable using the given predicate. Any
//! subtree with a root for which the predicate returns false is discarded,
//! including the passed in root which is why this function returns a `Maybe`.
template<typename T, typename Predicate>
Maybe<Shrinkable<T>> filter(Predicate pred, Shrinkable<T> shrinkable);

//! Given two `Shrinkables`, returns a `Shrinkable` pair that first shrinks the
//! first element and then the second.
template<typename T1, typename T2>
Shrinkable<std::pair<T1, T2>> pair(Shrinkable<T1> s1, Shrinkable<T2> s2);

} // namespace shrinkable
} // namespace rc

#include "Transform.hpp"

#pragma once

#include "rapidcheck/Shrinkable.h"

namespace rc {
namespace shrinkable {

//! Maps the given shrinkable recursively using the given mapping callable.
template<typename T, typename Mapper>
Shrinkable<typename std::result_of<Mapper(T)>::type>
map(Mapper &&mapper, Shrinkable<T> shrinkable);

//! Returns a shrinkable equal to the given shrinkable but with the shrinks
//! (lazily) mapped by the given mapping callable. Since the value is not mapped
//! also the output type is the same as the output type.
template<typename T, typename Mapper>
Shrinkable<T> mapShrinks(Mapper &&mapper, Shrinkable<T> shrinkable);

//! Recursively filters the given shrinkable using the given predicate. Any
//! subtree with a root for which the predicate returns false is discarded,
//! including the passed in root which is why this function returns a `Maybe`.
template<typename T, typename Predicate>
Maybe<Shrinkable<T>> filter(Predicate pred, Shrinkable<T> shrinkable);

//! Given two `Shrinkables`, returns a `Shrinkable` pair that first shrinks the
//! first element and then the second.
template<typename T1, typename T2>
Shrinkable<std::pair<T1, T2>> pair(Shrinkable<T1> s1, Shrinkable<T2> s2);

} // namespace shrinkable
} // namespace rc

#include "Transform.hpp"

Clarify doc comment about shrinkable::map


/*
    Copyright (c) 2012 250bpm s.r.o.

    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 SP_CONT_INCLUDED
#define SP_CONT_INCLUDED

/*  Takes a pointer to a member variable and computes pointer to the structure
    that contains it. 'type' is type of the structure, not the member. */
#define sp_cont(ptr, type, member) \
    ((type*) (((char*) ptr) - ((size_t) &(((type*) 0)->member))))

#endif

/*
    Copyright (c) 2012 250bpm s.r.o.

    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 SP_CONT_INCLUDED
#define SP_CONT_INCLUDED

#include <stddef.h>

/*  Takes a pointer to a member variable and computes pointer to the structure
    that contains it. 'type' is type of the structure, not the member. */
#define sp_cont(ptr, type, member) \
    ((type*) (((char*) ptr) - offsetof(type, member)))

#endif

Use offsetof() macro instead of expanded form.

Signed-off-by: Martin Sustrik <4dd6061be1198639e8b05ce4fd5ead7a0dcaa0f4@250bpm.com>


/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* libmspub
 * Version: MPL 1.1 / GPLv2+ / LGPLv2+
 *
 * The contents of this file are subject to the Mozilla Public License Version
 * 1.1 (the "License"); you may not use this file except in compliance with
 * the License or as specified alternatively below. You may obtain a copy of
 * the License at http://www.mozilla.org/MPL/
 *
 * Software distributed under the License is distributed on an "AS IS" basis,
 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
 * for the specific language governing rights and limitations under the
 * License.
 *
 * Major Contributor(s):
 * Copyright (C) 2012 Brennan Vincent <brennanv@email.arizona.edu>
 *
 * All Rights Reserved.
 *
 * For minor contributions see the git repository.
 *
 * Alternatively, the contents of this file may be used under the terms of
 * either the GNU General Public License Version 2 or later (the "GPLv2+"), or
 * the GNU Lesser General Public License Version 2 or later (the "LGPLv2+"),
 * in which case the provisions of the GPLv2+ or the LGPLv2+ are applicable
 * instead of those above.
 */

#ifndef __MSPUBCONSTANTS_H__
#define __MSPUBCONSTANTS_H__

namespace libmspub
{
const unsigned EMUS_IN_INCH = 914400;
}

#endif /* __MSPUBCONSTANTS_H__ */
/* vim:set shiftwidth=2 softtabstop=2 expandtab: */

Add license header to the file

Add license header to the file


/*-
 *	JNPR: pltfm.h,v 1.5.2.1 2007/09/10 05:56:11 girish
 * $FreeBSD$
 */

#ifndef _MACHINE_PLTFM_H_
#define	_MACHINE_PLTFM_H_

/*
 * This files contains platform-specific definitions.
 */
#define	SDRAM_ADDR_START	0 /* SDRAM addr space */
#define	SDRAM_ADDR_END		(SDRAM_ADDR_START + (1024*0x100000))
#define	SDRAM_MEM_SIZE		(SDRAM_ADDR_END - SDRAM_ADDR_START)

#define	UART_ADDR_START		0x1ef14000	/* UART */
#define	UART_ADDR_END		0x1ef14fff
#define	UART_MEM_SIZE		(UART_ADDR_END-UART_ADDR_START)

/*
 * NS16550 UART address
 */
#ifdef ADDR_NS16550_UART1
#undef ADDR_NS16550_UART1
#endif
#define	ADDR_NS16550_UART1	0x1ef14000	/* UART */
#define	VADDR_NS16550_UART1	0xbef14000	/* UART */

#endif /* !_MACHINE_PLTFM_H_ */

/*-
 *	JNPR: pltfm.h,v 1.5.2.1 2007/09/10 05:56:11 girish
 * $FreeBSD$
 */

#ifndef _MACHINE_PLTFM_H_
#define	_MACHINE_PLTFM_H_

/*
 * This files contains platform-specific definitions.
 */
#define	SDRAM_ADDR_START	0 /* SDRAM addr space */
#define	SDRAM_ADDR_END		(SDRAM_ADDR_START + (1024*0x100000))
#define	SDRAM_MEM_SIZE		(SDRAM_ADDR_END - SDRAM_ADDR_START)

#endif /* !_MACHINE_PLTFM_H_ */

Trim unreferenced goo. SDRAM likely should be next, but it is still referenced.


#include <assert.h>
#include <string.h>
#include "pocl_cl.h"

/*
 * Provide the ICD loader the specified function to get the pocl platform.
 *
 * TODO: the functionality of this seems the same as that of clGetPlatformIDs.
 * but we cannot call that, as it is defined in the ICD loader itself.
 *
 */
extern struct _cl_platform_id _platforms[1];

CL_API_ENTRY cl_int CL_API_CALL
clIcdGetPlatformIDsKHR(cl_uint           num_entries,
                       cl_platform_id *  platforms,
                       cl_uint *         num_platforms) CL_API_SUFFIX__VERSION_1_0
{
  int const num = 1;
  int i;

  if (platforms != NULL) {
    if (num_entries < num)
      return CL_INVALID_VALUE;

    for (i=0; i<num; ++i)
      platforms[i] = &_platforms[i];
  }

  if (num_platforms != NULL)
    *num_platforms = num;

  return CL_SUCCESS;
}

#include <assert.h>
#include <string.h>
#include "pocl_cl.h"

/*
 * GetPlatformIDs that support ICD.
 * This function is required by the ICD specification.
 */
extern struct _cl_platform_id _platforms[1];

CL_API_ENTRY cl_int CL_API_CALL
clIcdGetPlatformIDsKHR(cl_uint           num_entries,
                       cl_platform_id *  platforms,
                       cl_uint *         num_platforms) CL_API_SUFFIX__VERSION_1_0
{
  return clGetPlatformIDs( num_entries, platforms, num_platforms );
}

Fix nonsense comment + remove duplicate code.


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

#include <stdarg.h>
#include <stdio.h>

#include "log.h"

static char log_buffer[200];

void log_err(const char *format, ...)
{
	va_list args;
	va_start(args, format);
	vsnprintf(log_buffer, sizeof(log_buffer), format, args);
	printf("%s: %s", "Error", log_buffer);
	va_end(args);
}

void log_warn(const char *format, ...)
{
	va_list args;
	va_start(args, format);
	vsnprintf(log_buffer, sizeof(log_buffer), format, args);
	printf("%s: %s", "Warning", log_buffer);
	va_end(args);
}

void log_info(const char *format, ...)
{
	va_list args;
	va_start(args, format);
	vsnprintf(log_buffer, sizeof(log_buffer), format, args);
	printf("%s: %s", "Info", log_buffer);	va_end(args);
}

Add log functions for windows.

Add log functions for windows.


#ifdef EIGEN_WARNINGS_DISABLED
#undef EIGEN_WARNINGS_DISABLED

#ifndef EIGEN_PERMANENTLY_DISABLE_STUPID_WARNINGS
  #ifdef _MSC_VER
    #pragma warning( pop )
  #elif defined __INTEL_COMPILER
    #pragma warning pop
  #elif defined __clang__
    #pragma clang diagnostic pop
  #elif defined __NVCC__
    #pragma diag_warning code_is_unreachable
    #pragma diag_warning initialization_not_reachable
  #endif
#endif

#endif // EIGEN_WARNINGS_DISABLED

#ifdef EIGEN_WARNINGS_DISABLED
#undef EIGEN_WARNINGS_DISABLED

#ifndef EIGEN_PERMANENTLY_DISABLE_STUPID_WARNINGS
  #ifdef _MSC_VER
    #pragma warning( pop )
  #elif defined __INTEL_COMPILER
    #pragma warning pop
  #elif defined __clang__
    #pragma clang diagnostic pop
  #elif defined __NVCC__
    #pragma diag_default code_is_unreachable
    #pragma diag_default initialization_not_reachable
  #endif
#endif

#endif // EIGEN_WARNINGS_DISABLED

Revert the nvcc messages to their default severity instead of the forcing them to be warnings


/*
 * Copyright (C) 2015 Luke San Antonio and Hazza Alkaabi
 * All rights reserved.
 */
#pragma once

#include <string>
#include <vector>
#include "../gen/terrain.h"

#include "common.h"

extern "C"
{
  #include "lua.h"
}
namespace game { namespace luaint
{
  struct Terrain_Gen_Config
  {
    void add_option(std::string const& name, double def) noexcept;
  private:
    enum class Option_Type
    {
      Double
    };
    struct Option
    {
      std::string name;
      Option_Type type;
      union
      {
        double d_num;
      } value;
    };
    std::vector<Option> options_;
  };

  struct Terrain_Gen_Mod
  {
    // Index into registry[naeme] where naeme is some implementation (?)
    // defined string.
    size_t table_index;
    Terrain_Gen_Config config;
  };
  using Terrain_Gen_Mod_Vector = std::vector<Terrain_Gen_Mod>;

  // Use this to initialize a table to return from a lua require call.
  Table terrain_preload_table(Terrain_Gen_Mod_Vector&) noexcept;

  // Use this to push a grid
  void push_grid_table(lua_State*, gen::Grid_Map&) noexcept;
} }

/*
 * Copyright (C) 2015 Luke San Antonio and Hazza Alkaabi
 * All rights reserved.
 */
#pragma once

#include <string>
#include <vector>
#include "../gen/terrain.h"

#include "common.h"

extern "C"
{
  #include "lua.h"
}
namespace game { namespace luaint
{
  struct Terrain_Gen_Config
  {
    void add_option(std::string const& name, double def) noexcept;
  private:
    enum class Option_Type
    {
      Double
    };
    struct Option
    {
      std::string name;
      Option_Type type;
      union
      {
        double d_num;
      } value;
    };
    std::vector<Option> options_;
  };

  struct Terrain_Gen_Mod
  {
    // Index into registry[naeme] where naeme is some implementation (?)
    // defined string.
    // The value of the registry[naeme][table_index] is the mod lua function.
    size_t table_index;
    Terrain_Gen_Config config;
  };
  using Terrain_Gen_Mod_Vector = std::vector<Terrain_Gen_Mod>;

  // Use this to initialize a table to return from a lua require call.
  Table terrain_preload_table(Terrain_Gen_Mod_Vector&) noexcept;

  // Use this to push a grid
  void push_grid_table(lua_State*, gen::Grid_Map&) noexcept;
} }

Add comment to the Terrain_Gen_Mod struct


#pragma once

#include <stdint.h>
#include <stdlib.h>
#include "ewok.h"

enum { N_DIVISIONS = 65536, LOG2_DIVISIONS = 16 };
struct indexed_ewah_map {
    struct ewah_bitmap *map;
    size_t bit_from_division[N_DIVISIONS], ptr_from_division[N_DIVISIONS];
};

/* Build an index on top of an existing libewok EWAH map. */
extern void ewah_build_index(struct indexed_ewah_map *);
/* Test whether a given bit is set in an indexed EWAH map. */
extern bool indexed_ewah_get(struct indexed_ewah_map *, size_t);

#pragma once

#include <stdint.h>
#include <stdlib.h>
#include "ewok.h"

enum { N_DIVISIONS = 1<<14 };
struct indexed_ewah_map {
    struct ewah_bitmap *map;
    size_t bit_from_division[N_DIVISIONS], ptr_from_division[N_DIVISIONS];
};

/* Build an index on top of an existing libewok EWAH map. */
extern void ewah_build_index(struct indexed_ewah_map *);
/* Test whether a given bit is set in an indexed EWAH map. */
extern bool indexed_ewah_get(struct indexed_ewah_map *, size_t);

Change number of divisions in index to 2^14


#ifndef CONVERTER_H
#define CONVERTER_H

#include "alMain.h"
#include "alu.h"

#ifdef __cpluspluc
extern "C" {
#endif

typedef struct SampleConverter {
    enum DevFmtType mSrcType;
    enum DevFmtType mDstType;
    ALsizei mNumChannels;
    ALsizei mSrcTypeSize;
    ALsizei mDstTypeSize;

    ALint mSrcPrepCount;

    ALsizei mFracOffset;
    ALsizei mIncrement;
    ResamplerFunc mResample;

    alignas(16) ALfloat mSrcSamples[BUFFERSIZE+MAX_PRE_SAMPLES+MAX_POST_SAMPLES];
    alignas(16) ALfloat mDstSamples[BUFFERSIZE];

    struct {
        alignas(16) ALfloat mPrevSamples[MAX_PRE_SAMPLES+MAX_POST_SAMPLES];
    } Chan[];
} SampleConverter;

SampleConverter *CreateSampleConverter(enum DevFmtType srcType, enum DevFmtType dstType, ALsizei numchans, ALsizei srcRate, ALsizei dstRate);
void DestroySampleConverter(SampleConverter **converter);

ALsizei SampleConverterInput(SampleConverter *converter, const ALvoid *src, ALsizei *srcframes, ALvoid *dst, ALsizei dstframes);
ALsizei SampleConverterAvailableOut(SampleConverter *converter, ALsizei srcframes);

#ifdef __cpluspluc
}
#endif

#endif /* CONVERTER_H */

#ifndef CONVERTER_H
#define CONVERTER_H

#include "alMain.h"
#include "alu.h"

#ifdef __cpluspluc
extern "C" {
#endif

typedef struct SampleConverter {
    enum DevFmtType mSrcType;
    enum DevFmtType mDstType;
    ALsizei mNumChannels;
    ALsizei mSrcTypeSize;
    ALsizei mDstTypeSize;

    ALint mSrcPrepCount;

    ALsizei mFracOffset;
    ALsizei mIncrement;
    ResamplerFunc mResample;

    alignas(16) ALfloat mSrcSamples[BUFFERSIZE];
    alignas(16) ALfloat mDstSamples[BUFFERSIZE];

    struct {
        alignas(16) ALfloat mPrevSamples[MAX_PRE_SAMPLES+MAX_POST_SAMPLES];
    } Chan[];
} SampleConverter;

SampleConverter *CreateSampleConverter(enum DevFmtType srcType, enum DevFmtType dstType, ALsizei numchans, ALsizei srcRate, ALsizei dstRate);
void DestroySampleConverter(SampleConverter **converter);

ALsizei SampleConverterInput(SampleConverter *converter, const ALvoid *src, ALsizei *srcframes, ALvoid *dst, ALsizei dstframes);
ALsizei SampleConverterAvailableOut(SampleConverter *converter, ALsizei srcframes);

#ifdef __cpluspluc
}
#endif

#endif /* CONVERTER_H */

Reduce the size of the temp input buffer


/*
 * Copyright (C) 2013-2014 Daniel Nicoletti <dantti12@gmail.com>
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Library General Public
 * License as published by the Free Software Foundation; either
 * version 2 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
 * Library General Public License for more details.
 *
 * You should have received a copy of the GNU Library General Public License
 * along with this library; see the file COPYING.LIB. If not, write to
 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
 * Boston, MA 02110-1301, USA.
 */

#ifndef PLUGIN_H
#define PLUGIN_H

#define CUTELYST_MODIFIER1 0

#ifdef __cplusplus
extern "C" {
#endif

struct uwsgi_cutelyst {
    char *app;
    int reload;
};

extern struct uwsgi_cutelyst options;

#ifdef __cplusplus
}
#endif

#endif // PLUGIN_H

/*
 * Copyright (C) 2013-2014 Daniel Nicoletti <dantti12@gmail.com>
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Library General Public
 * License as published by the Free Software Foundation; either
 * version 2 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
 * Library General Public License for more details.
 *
 * You should have received a copy of the GNU Library General Public License
 * along with this library; see the file COPYING.LIB. If not, write to
 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
 * Boston, MA 02110-1301, USA.
 */

#ifndef PLUGIN_H
#define PLUGIN_H

#define CUTELYST_MODIFIER1 0

#ifdef __cplusplus
extern "C" {
#endif

struct uwsgi_cutelyst {
    char *app;
    int reload;
} options;

#ifdef __cplusplus
}
#endif

#endif // PLUGIN_H

Revert "Possibly fixed alignment warning"

This reverts commit 3111a7ae00cf12f0f8e0f357fb122b24470e4051.


#include <metric.h>
#include <gm_mmn.h>

#include <libmetrics.h>

mmodule core_metrics;

/*
** A helper function to determine the number of cpustates in /proc/stat (MKN)
*/

static int core_metrics_init ( apr_pool_t *p )
{
    int i;

    for (i = 0; core_metrics.metrics_info[i].name != NULL; i++) {
        /* Initialize the metadata storage for each of the metrics and then
         *  store one or more key/value pairs.  The define MGROUPS defines
         *  the key for the grouping attribute. */
        MMETRIC_INIT_METADATA(&(core_metrics.metrics_info[i]),p);
        MMETRIC_ADD_METADATA(&(core_metrics.metrics_info[i]),MGROUP,"core");
    }

    return 0;
}

static void core_metrics_cleanup ( void )
{
}

static g_val_t core_metrics_handler ( int metric_index )
{
    g_val_t val;

    /* The metric_index corresponds to the order in which
       the metrics appear in the metric_info array
    */
    switch (metric_index) {
    case 0:
        return gexec_func();
    case 1:
        return heartbeat_func();
    case 2:
        return location_func();
    }

    /* default case */
    val.int32 = 0;
    return val;
}

static Ganglia_25metric core_metrics_info[] =
{
    {0, "gexec",      300, GANGLIA_VALUE_STRING,       "",        "zero", "%s", UDP_HEADER_SIZE+32, "gexec available"},
    {0, "heartbeat",   20, GANGLIA_VALUE_UNSIGNED_INT, "",        "",     "%u", UDP_HEADER_SIZE+8,  "Last heartbeat"},
    {0, "location",  1200, GANGLIA_VALUE_STRING,       "(x,y,z)", "",     "%s", UDP_HEADER_SIZE+12, "Location of the machine"},
    {0, NULL}
};

mmodule core_metrics =
{
    STD_MMODULE_STUFF,
    core_metrics_init,
    core_metrics_cleanup,
    core_metrics_info,
    core_metrics_handler,
};

Move heartbeat, location and gexec metrics to a core module that will always be statically linked


#pragma once

#ifdef NDEBUG
#define XCHAINER_DEBUG false
#else  // NDEBUG
#define XCHAINER_DEBUG true
#endif  // NDEBUG

#ifndef XCHAINER_HOST_DEVICE
#ifdef __CUDACC__
#define XCHAINER_HOST_DEVICE __host__ __device__
#else  // __CUDA__
#define XCHAINER_HOST_DEVICE
#endif  // __CUDACC__
#endif  // XCHAINER_HOST_DEVICE

#ifndef XCHAINER_NEVER_REACH
#ifdef NDEBUG
#include <cstdlib>
#define XCHAINER_NEVER_REACH() (std::abort())
#else  // NDEBUG
#include <cassert>
#define XCHAINER_NEVER_REACH()                    \
    do {                                          \
        assert(false); /* NOLINT(cert-dcl03-c) */ \
        std::abort();                             \
    } while (false)
#endif  // NDEBUG
#endif  // XCHAINER_NEVER_REACH

#pragma once

#include <cassert>

#ifdef NDEBUG
#define XCHAINER_DEBUG false
#else  // NDEBUG
#define XCHAINER_DEBUG true
#endif  // NDEBUG

#define XCHAINER_ASSERT(...)                                   \
    do {                                                       \
        if (XCHAINER_DEBUG) {                                  \
            (void)(false && (__VA_ARGS__)); /* maybe unused */ \
            assert(__VA_ARGS__);                               \
        }                                                      \
    } while (false)

#ifndef XCHAINER_HOST_DEVICE
#ifdef __CUDACC__
#define XCHAINER_HOST_DEVICE __host__ __device__
#else  // __CUDA__
#define XCHAINER_HOST_DEVICE
#endif  // __CUDACC__
#endif  // XCHAINER_HOST_DEVICE

#ifndef XCHAINER_NEVER_REACH
#ifdef NDEBUG
#include <cstdlib>
#define XCHAINER_NEVER_REACH() (std::abort())
#else  // NDEBUG
#include <cassert>
#define XCHAINER_NEVER_REACH()                    \
    do {                                          \
        assert(false); /* NOLINT(cert-dcl03-c) */ \
        std::abort();                             \
    } while (false)
#endif  // NDEBUG
#endif  // XCHAINER_NEVER_REACH

Add XCHAINER_ASSERT, an alternative assert that forcibly uses the expression syntactically


#ifndef __STARTUP_H__
#define __STARTUP_H__

#include "types.h"

#ifndef X
#define X(x) ((x) + 0x81)
#endif

#ifndef Y
#define Y(y) ((y) + 0x2c)
#endif

extern int frameCount;
extern int lastFrameCount;
extern struct List *VBlankEvent;

typedef struct Effect {
  /* AmigaOS is active during this step. Loads resources from disk. */
  void (*Load)(void);
  /* Frees all resources allocated by "Load" step. */
  void (*UnLoad)(void);
  /*
   * Does all initialization steps required to launch the effect.
   * 1) Allocate required memory.
   * 2) Run all precalc routines.
   * 2) Generate copper lists.
   * 3) Set up interrupts and DMA channels.
   */
  void (*Init)(void);
  /* Frees all resources allocated by "Init" step. */
  void (*Kill)(void);
  /* Renders single frame of an effect. */
  void (*Render)(void);
  /* Handles all events and returns false to break the loop. */
  bool (*HandleEvent)(void);
} EffectT;

#endif

#ifndef __STARTUP_H__
#define __STARTUP_H__

#include "types.h"

#ifndef X
#define X(x) ((x) + 0x81)
#endif

#ifndef HP
#define HP(x) (X(x) / 2)
#endif

#ifndef Y
#define Y(y) ((y) + 0x2c)
#endif

#ifndef VP
#define VP(y) (Y(y) & 255)
#endif

extern int frameCount;
extern int lastFrameCount;
extern struct List *VBlankEvent;

typedef struct Effect {
  /* AmigaOS is active during this step. Loads resources from disk. */
  void (*Load)(void);
  /* Frees all resources allocated by "Load" step. */
  void (*UnLoad)(void);
  /*
   * Does all initialization steps required to launch the effect.
   * 1) Allocate required memory.
   * 2) Run all precalc routines.
   * 2) Generate copper lists.
   * 3) Set up interrupts and DMA channels.
   */
  void (*Init)(void);
  /* Frees all resources allocated by "Init" step. */
  void (*Kill)(void);
  /* Renders single frame of an effect. */
  void (*Render)(void);
  /* Handles all events and returns false to break the loop. */
  bool (*HandleEvent)(void);
} EffectT;

#endif

Add default calculation of horizontal & vertical position.


/*	$NetBSD: psl.h,v 1.7 1994/10/26 02:06:31 cgd Exp $	*/

#ifndef _MACHINE_PSL_H_
#define _MACHINE_PSL_H_

#include <m68k/psl.h>

#endif

/*	$NetBSD: psl.h,v 1.7 1994/10/26 02:06:31 cgd Exp $	*/

#ifndef _MACHINE_PSL_H_
#define _MACHINE_PSL_H_

/* Interrupt priority `levels'; not mutually exclusive. */
#define	IPL_NONE	-1
#define	IPL_BIO		3	/* block I/O */
#define	IPL_NET		3	/* network */
#define	IPL_TTY		4	/* terminal */
#define	IPL_CLOCK	4	/* clock */
#define	IPL_IMP		4	/* memory allocation */

/* Interrupt sharing types. */
#define	IST_NONE	0	/* none */
#define	IST_PULSE	1	/* pulsed */
#define	IST_EDGE	2	/* edge-triggered */
#define	IST_LEVEL	3	/* level-triggered */

#include <m68k/psl.h>

#endif

Add IPL_ and IST_ constants in preparation for the Amiga ISA-kit


#pragma once
#define DLLEXPORT

#ifdef DLLEXPORT
#define DLL_OPERATION __declspec(dllexport)
#endif
#include <iostream>

#pragma once

#ifdef RESOURCELIB_EXPORTS
#define DLL_OPERATION __declspec(dllexport)
#else
#define DLL_OPERATION __declspec(dllimport)
#endif
#include <iostream>

FIX dllcondition to use the correct macro name

RESOURCELIB_EXPORTS is a defined preprocessor macro, not DLLEXPORTS


// RUN: %clang_cc1 -triple x86_64-unknown-unknown -emit-llvm -o - %s | FileCheck %s

// Don't include mm_malloc.h, it's system specific.
#define __MM_MALLOC_H
#include <immintrin.h>

int test_bit_scan_forward(int a) {
  return _bit_scan_forward(a);
// CHECK: @test_bit_scan_forward
// CHECK: %[[call:.*]] = call i32 @llvm.cttz.i32(
// CHECK: ret i32 %[[call]]
}

int test_bit_scan_reverse(int a) {
  return _bit_scan_reverse(a);
// CHECK:  %[[call:.*]] = call i32 @llvm.ctlz.i32(
// CHECK:  %[[sub:.*]] = sub nsw i32 31, %2
// CHECK: ret i32 %[[sub]]
}

// RUN: %clang_cc1 -triple x86_64-unknown-unknown -emit-llvm -o - %s | FileCheck %s

// Don't include mm_malloc.h, it's system specific.
#define __MM_MALLOC_H
#include <immintrin.h>

int test_bit_scan_forward(int a) {
  return _bit_scan_forward(a);
// CHECK: @test_bit_scan_forward
// CHECK: %[[call:.*]] = call i32 @llvm.cttz.i32(
// CHECK: ret i32 %[[call]]
}

int test_bit_scan_reverse(int a) {
  return _bit_scan_reverse(a);
// CHECK:  %[[call:.*]] = call i32 @llvm.ctlz.i32(
// CHECK:  %[[sub:.*]] = sub nsw i32 31, %[[call]]
// CHECK: ret i32 %[[sub]]
}

Test fix -- use captured call result instead of hardcoded %2.

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


/*
 * Copyright (c) 2006 KATO Kazuyoshi <kzys@8-p.info>
 * This source code is released under the MIT license.
 */

#import <Cocoa/Cocoa.h>

@interface WildcardPattern : NSObject {
	NSString* pattern_;
}

- (id) initWithString: (NSString*) s;
- (BOOL) isMatch: (NSString*) s;

@end

Add copyright and license header.

Add copyright and license header.


#pragma once
#include "Export.h"

#include <set>
#include <vector>

using namespace std;

class DLLEXPORT SetFunctions {
public:
  static set<int> set_union_two(set<int>& s1, set<int>& s2);

  static set<int> set_intersect_two(set<int>& s1, set<int>& s2);
  static set<int> set_intersect_three(set<int>& s1, set<int>& s2, set<int>& s3);
};

#pragma once
#include "EXPORT.h"

#include <set>
#include <vector>

using namespace std;

class DLLEXPORT SetFunctions {
public:
  static set<int> set_union_two(set<int>& s1, set<int>& s2);

  static set<int> set_intersect_two(set<int>& s1, set<int>& s2);
  static set<int> set_intersect_three(set<int>& s1, set<int>& s2, set<int>& s3);
};

Correct casing of EXPORT.h import

Correct casing of EXPORT.h import


/* Copyright (c) 2005-2011 Dovecot authors, see the included COPYING file */

#include "lib.h"
#include "hex-dec.h"

void dec2hex(unsigned char *hexstr, uintmax_t dec, unsigned int hexstr_size)
{
	unsigned int i;

	for (i = 0; i < hexstr_size; i++) {
		unsigned int value = dec & 0x0f;
		if (value < 10)
			hexstr[hexstr_size-i-1] = value + '0';
		else
			hexstr[hexstr_size-i-1] = value - 10 + 'A';
		dec >>= 4;
	}
}

uintmax_t hex2dec(const unsigned char *data, unsigned int len)
{
	unsigned int i;
	uintmax_t value = 0;

	for (i = 0; i < len; i++) {
		value = value*0x10;
		if (data[i] >= '0' && data[i] <= '9')
			value += data[i]-'0';
		else if (data[i] >= 'A' && data[i] <= 'F')
			value += data[i]-'A' + 10;
		else
			return 0;
	}
	return value;
}

/* Copyright (c) 2005-2011 Dovecot authors, see the included COPYING file */

#include "lib.h"
#include "hex-dec.h"

void dec2hex(unsigned char *hexstr, uintmax_t dec, unsigned int hexstr_size)
{
	unsigned int i;

	for (i = 0; i < hexstr_size; i++) {
		unsigned int value = dec & 0x0f;
		if (value < 10)
			hexstr[hexstr_size-i-1] = value + '0';
		else
			hexstr[hexstr_size-i-1] = value - 10 + 'A';
		dec >>= 4;
	}
}

uintmax_t hex2dec(const unsigned char *data, unsigned int len)
{
	unsigned int i;
	uintmax_t value = 0;

	for (i = 0; i < len; i++) {
		value = value*0x10;
		if (data[i] >= '0' && data[i] <= '9')
			value += data[i]-'0';
		else if (data[i] >= 'A' && data[i] <= 'F')
			value += data[i]-'A' + 10;
		else if (data[i] >= 'a' && data[i] <= 'f')
			value += data[i]-'a' + 10;
		else
			return 0;
	}
	return value;
}

hex2dec(): Allow data to contain also lowercase hex characters.


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

extern "C" void RSFatalError(char *message);

extern "C" void* RSMallocOrDie(size_t size);
extern "C" void* RSCallocOrDie(size_t size);

extern "C" void RSFReadOrDie(void *dest, size_t size, FILE *file);
extern "C" void RSFWriteOrDie(void *data, size_t size, FILE *file);
extern "C" FILE* RSFOpenOrDie(char *path, char *mode);
extern "C" void RSFCloseOrDie(FILE *file);
extern "C" void* RSReadFileOrDie(char *path, uint32_t *size);

extern "C" int8_t RSReadInt8(uint8_t *data, uint32_t *offset);
extern "C" uint8_t RSReadUInt8(uint8_t *data, uint32_t *offset);
extern "C" int16_t RSReadInt16(uint8_t *data, uint32_t *offset);
extern "C" uint16_t RSReadUInt16(uint8_t *data, uint32_t *offset);
extern "C" int32_t RSReadInt32(uint8_t *data, uint32_t *offset);
extern "C" uint32_t RSReadUInt32(uint8_t *data, uint32_t *offset);
extern "C" int64_t RSReadInt64(uint8_t *data, uint32_t *offset);
extern "C" uint64_t RSReadUInt64(uint8_t *data, uint32_t *offset);

Add a header for use from C++

Add a header for use from C++


#ifndef MAGICMATCHER_P_H
#define MAGICMATCHER_P_H

#include "magicmatcher.h"
#include "qmimetype.h"

#include <QtCore/QFileInfo>

QT_BEGIN_NAMESPACE

class FileMatchContext
{
    Q_DISABLE_COPY(FileMatchContext)

public:
    // Max data to be read from a file
    enum { MaxData = 2500 };

    explicit FileMatchContext(const QFileInfo &fi);

    inline QString fileName() const { return m_fileName; }
    // Return (cached) first MaxData bytes of file
    QByteArray data();

private:
    const QFileInfo m_fileInfo;
    const QString m_fileName;
    enum State {
        // File cannot be read/does not exist
        NoDataAvailable,
        // Not read yet
        DataNotRead,
        // Available
        DataRead
    } m_state;
    QByteArray m_data;
};

QT_END_NAMESPACE

#endif // MAGICMATCHER_P_H

#ifndef MAGICMATCHER_P_H
#define MAGICMATCHER_P_H

#include "magicmatcher.h"
#include "qmimetype.h"

#include <QtCore/QFileInfo>

QT_BEGIN_NAMESPACE

class FileMatchContext
{
    Q_DISABLE_COPY(FileMatchContext)

public:
    // Max data to be read from a file

    // TODO: hardcoded values are no good, this should be done on demand
    // in order to respect the spec. Use QIODevice-based code from KMimeMagicRule.
    enum { MaxData = 2500 };

    explicit FileMatchContext(const QFileInfo &fi);

    inline QString fileName() const { return m_fileName; }
    // Return (cached) first MaxData bytes of file
    QByteArray data();

private:
    const QFileInfo m_fileInfo;
    const QString m_fileName;
    enum State {
        // File cannot be read/does not exist
        NoDataAvailable,
        // Not read yet
        DataNotRead,
        // Available
        DataRead
    } m_state;
    QByteArray m_data;
};

QT_END_NAMESPACE

#endif // MAGICMATCHER_P_H

Add TODO. But first we need to parse mime.cache


/**
 * @file
 * @brief Tools to work with registers
 */
//@{
#ifndef AVARIX_REGISTER_H__
#define AVARIX_REGISTER_H__

#include <avr/io.h>

/** @brief Set a register with I/O CCP disabled
 *
 * Interrupts are not disabled during the process.
 *
 * @note This can be achieved in less cycles for some I/O registers but this way
 * is generic.
 */
inline void ccp_io_write(volatile uint8_t* addr, uint8_t value)
{
  asm volatile (
      "out  %0, %1\n\t"
      "st   Z, %3\n\t"
      :
      : "i" (&CCP)
      , "r" (CCP_IOREG_gc)
      , "z" ((uint16_t)addr)
      , "r" (value)
      );
}

#endif

/**
 * @file
 * @brief Tools to work with registers
 */
//@{
#ifndef AVARIX_REGISTER_H__
#define AVARIX_REGISTER_H__

#include <avr/io.h>

/** @brief Set a register with I/O CCP disabled
 *
 * Interrupts are not disabled during the process.
 *
 * @note This can be achieved in less cycles for some I/O registers but this way
 * is generic.
 */
static inline void ccp_io_write(volatile uint8_t* addr, uint8_t value)
{
  asm volatile (
      "out  %0, %1\n\t"
      "st   Z, %3\n\t"
      :
      : "i" (&CCP)
      , "r" (CCP_IOREG_gc)
      , "z" ((uint16_t)addr)
      , "r" (value)
      );
}

#endif

Fix ccp_io_write() not being static as it should


//
//  msgpack.h
//  msgpack
//
//  Created by Ricardo Pereira on 13/10/2017.
//
//

#import <UIKit/UIKit.h>

//! Project version number for msgpack.
FOUNDATION_EXPORT double msgpackVersionNumber;

//! Project version string for msgpack.
FOUNDATION_EXPORT const unsigned char msgpackVersionString[];

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

#import "MessagePack.h"

//
//  msgpack.h
//  msgpack
//
//  Created by Ricardo Pereira on 13/10/2017.
//
//

#import <Foundation/Foundation.h>

//! Project version number for msgpack.
FOUNDATION_EXPORT double msgpackVersionNumber;

//! Project version string for msgpack.
FOUNDATION_EXPORT const unsigned char msgpackVersionString[];

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

#import "MessagePack.h"

Remove UIKit usage by replacing it with Foundation


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

#include <env.h>

int main(int argc, char** argv) {
  char** env = malloc(2 * sizeof(char*));
  char* result;

  env[0] = "NAME=value";
  env[1] = NULL;

  result = env_get(env, "NAME");
  printf("NAME=%s\n", result);
  assert(strcmp(result, "value") == 0);

  return 0;
}

Add a test for `env_get`

[test] Add a test for `env_get`


//
//  config.h
//  IRCCloud
//
//  Created by Sam Steele on 7/13/13.
//  Copyright (c) 2013 IRCCloud, Ltd. All rights reserved.
//

#ifndef IRCCloud_config_h
#define IRCCloud_config_h

#define HOCKEYAPP_TOKEN nil
#define CRASHLYTICS_TOKEN nil
#define CRASHLYTICS_SECRET nil

#endif

//
//  config.h
//  IRCCloud
//
//  Created by Sam Steele on 7/13/13.
//  Copyright (c) 2013 IRCCloud, Ltd. All rights reserved.
//

#ifndef IRCCloud_config_h
#define IRCCloud_config_h

#endif

Remove nil tokens from conf

Remove nil tokens from conf


#ifndef GLKUNIT_H
#define GLKUNIT_H

#include <stdio.h>

#define _BEGIN do {
#define _END } while(0);

/* msg must be a string literal */
#define _ASSERT(expr, msg, ...) _BEGIN \
    if( !(expr) ) { \
        fprintf(stderr, "Assertion failed: " msg "\n", __VA_ARGS__); \
        return 0; \
    } _END

#define SUCCEED _BEGIN return 1; _END
#define ASSERT(expr) _ASSERT(expr, "%s", #expr)
#define ASSERT_EQUAL(expected, actual) _ASSERT((expected) == (actual), "%s == %s", #expected, #actual);

struct TestDescription {
    char *name;
    int (*testfunc)(void);
};

#endif /* GLKUNIT_H */

#ifndef GLKUNIT_H
#define GLKUNIT_H

#include <stdio.h>

#define _BEGIN do {
#define _END } while(0);

/* msg must be a string literal */
#define _ASSERT(expr, msg, ...) _BEGIN \
    if( !(expr) ) { \
        fprintf(stderr, "Assertion failed: " msg "\n", __VA_ARGS__); \
        return 0; \
    } _END

#define SUCCEED _BEGIN return 1; _END
#define ASSERT(expr) _ASSERT(expr, "%s", #expr)
/* This macro is meant for int-like things that can print with %d */
#define ASSERT_EQUAL(expected, actual) _ASSERT((expected) == (actual), \
    "%s == %s (expected %d, was %d)", \
    #actual, #expected, expected, actual);

struct TestDescription {
    char *name;
    int (*testfunc)(void);
};

#endif /* GLKUNIT_H */

Print more informative assert message

Print more informative assert message

ASSERT_EQUAL() is for int-like types that will print with %d.


#include "../small1/testharness.h"

// NUMERRORS 1

union {
  struct {
    int *a, *b;
  } f1;
  int f2;
} __TAGGED u;

int i;

int main() {

  u.f2 = 5; // now u.f1.a = 5
  u.f1.b = &i; // now the tag says that u.f1 is active

  i = * u.f1.a; //ERROR(1): Null-pointer
}

#include "../small1/testharness.h"

// NUMERRORS 1

union {
  struct {
    int *a, *b;
  } f1;
  int f2;
} __TAGGED u;

int i;

int main() {

  u.f2 = 5; // now u.f1.a = 5
  u.f1.b = &i; // now the tag says that u.f1 is active

  i = * u.f1.a; //ERROR(1): Null pointer
}

Fix a soundness bug in tagged unions that have fields larger than one word. This fix uses memset to clear such fields, although we could probably optimize this if needed.


// Virvo - Virtual Reality Volume Rendering
// Copyright (C) 1999-2003 University of Stuttgart, 2004-2005 Brown University
// Contact: Jurgen P. Schulze, jschulze@ucsd.edu
//
// This file is part of Virvo.
//
// Virvo 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 (see license.txt); if not, write to the
// Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA

#ifndef VV_PRIVATE_MESSAGES_H
#define VV_PRIVATE_MESSAGES_H

#include "../vvparam.h"
#include "../vvrenderer.h"
#include "../vvvecmath.h"

#include <istream>
#include <ostream>

namespace virvo
{
namespace messages
{

struct CameraMatrix
{
    // The model-view matrix
    vvMatrix view;
    // The projection matrix
    vvMatrix proj;

    CameraMatrix()
    {
    }

    CameraMatrix(vvMatrix const& view, vvMatrix const& proj)
        : view(view)
        , proj(proj)
    {
    }

    template<class A>
    void serialize(A& a, unsigned /*version*/)
    {
        a & view;
        a & proj;
    }
};

struct Param
{
    // The name of the parameter
    vvRenderState::ParameterType name;
    // The actual parameter
    vvParam value;

    Param()
        : name(static_cast<vvRenderState::ParameterType>(0))
        , value()
    {
    }

    Param(vvRenderState::ParameterType name, vvParam const& value)
        : name(name)
        , value(value)
    {
    }

    template<class A>
    void serialize(A& a, unsigned /*version*/)
    {
        int t = 0;

        a & t; /*name*/
        a & value;

        name = static_cast<vvRenderState::ParameterType>(t);
    }
};

struct WindowResize
{
    int w;
    int h;

    WindowResize()
    {
    }

    WindowResize(int w, int h)
        : w(w)
        , h(h)
    {
    }

    template<class A>
    void serialize(A& a, unsigned /*version*/)
    {
        a & w;
        a & h;
    }
};

} // namespace messages
} // namespace virvo

#endif

Add a utility header for virvo::Message.

Defines some structs wrapping multiple objects which make working
with virvo::Message easier.

TODO: Rewrite virvo::Message.


/* This string is written to the output primary header as CAL_VER. */

# define STIS_CAL_VER "2.28 (09-March-2010) cfitsio test"

/* This string is written to the output primary header as CAL_VER. */

# define STIS_CAL_VER "2.29 (24-March-2010) cfitsio test"

Change the version number and date.

Change the version number and date.

git-svn-id: cc674101e2b794ddc2100b657215d55256e3fd48@8968 fe389314-cf27-0410-b35b-8c050e845b92


// RUN: %clang -### -target amdgcn--amdhsa -x assembler -mcpu=kaveri %s 2>&1 | FileCheck -check-prefix=AS_LINK %s
// AS_LINK-LABEL: clang
// AS_LINK: "-cc1as"
// AS_LINK-LABEL: lld
// AS_LINK: "-flavor" "gnu" "-target" "amdgcn--amdhsa"
// REQUIRES: clang-driver

// RUN: %clang -### -target amdgcn--amdhsa -x assembler -mcpu=kaveri %s 2>&1 | FileCheck -check-prefix=AS_LINK %s
// AS_LINK: /clang
// AS_LINK-SAME: "-cc1as"
// AS_LINK: /lld
// AS_LINK-SAME: "-flavor" "gnu" "-target" "amdgcn--amdhsa"

Fix test to pass when the directory name has lld in it.

CHECK-LABEL assumes that there is only one occurrence of the match.

The output looks like:

clang version 3.8.0 (trunk 247999)
....
/path/to/build/dir/bin/clang-3.8 ....

If the path contains lld, the second CHECK-LABEL matches it and we fail since
there is no -cc1as between clang and lld.

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


// $Id$ -*-c++-*-
//***************************************************************************
// File:
//	TraceValues.h
//
// Purpose:
//      Support for inserting LLVM code to print values at basic block
//      and method exits.  Also exports functions to create a call
//      "printf" instruction with one of the signatures listed below.
//
// History:
//	10/11/01	 -  Vikram Adve  -  Created
//**************************************************************************/

#ifndef LLVM_TRANSFORMS_INSTRUMENTATION_TRACEVALUES_H
#define LLVM_TRANSFORMS_INSTRUMENTATION_TRACEVALUES_H

class Module;
class Method;
class BasicBlock;
class Instruction;
class Value;
class Type;

//************************** External Functions ****************************/

//--------------------------------------------------------------------------
// Function GetPrintMethodForType
//
// Creates an external declaration for "printf".
// The signatures supported are:
//   int printf(sbyte*,  sbyte*,  sbyte*,  sbyte*,  int      intValue)
//   int printf(sbyte*,  sbyte*,  sbyte*,  sbyte*,  unsigned uintValue)
//   int printf(sbyte*,  sbyte*,  sbyte*,  sbyte*,  float    floatValue)
//   int printf(sbyte*,  sbyte*,  sbyte*,  sbyte*,  double   doubleValue)
//   int printf(sbyte*,  sbyte*,  sbyte*,  sbyte*,  char*    stringValue)
//   int printf(sbyte*,  sbyte*,  sbyte*,  sbyte*,  void*    ptrValue)
//
// The invocation should be:
//       call "printf"(fmt, bbName, valueName, valueType, value).
//--------------------------------------------------------------------------

const Method*	GetPrintMethodForType   (Module* module,
                                         Type* vtype);

//--------------------------------------------------------------------------
// Function CreatePrintInstr
//
// Creates an invocation of printf for the value `val' at the exit of the
// basic block `bb'.  isMethodExit specifies if this is a method exit,
//--------------------------------------------------------------------------

Instruction*	CreatePrintInstr        (Value* val,
                                         const BasicBlock* bb,
                                         Module* module,
                                         unsigned int indent,
                                         bool isMethodExit);

//--------------------------------------------------------------------------
// Function InsertCodeToTraceValues
//
// Inserts tracing code for all live values at basic block and/or method exits
// as specified by `traceBasicBlockExits' and `traceMethodExits'.
//--------------------------------------------------------------------------

void            InsertCodeToTraceValues (Method* method,
                                         bool traceBasicBlockExits,
                                         bool traceMethodExits);

//**************************************************************************/

#endif LLVM_TRANSFORMS_INSTRUMENTATION_TRACEVALUES_H

Insert code to trace values at basic block and method exits.

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


#ifndef H_XDICTLIB
 #define H_XDICTLIB
 #ifdef __cplusplus
   extern "C" {
 #endif

#include <stdlib.h>

/*
   The |xdict| interface.
*/

#define XDICT_MAXLENGTH 10  /* 0..9 characters */

struct xdict {
    struct word_entry *words[XDICT_MAXLENGTH];
    size_t cap[XDICT_MAXLENGTH];
    size_t len[XDICT_MAXLENGTH];
    int sorted;
};

struct word_entry {
    char *word;
};

void xdict_init(struct xdict *d);
int xdict_load(struct xdict *d, const char *fname);
  int xdict_addword(struct xdict *d, const char *word, int len);
  int xdict_remword(struct xdict *d, const char *word, int len);
  int xdict_remmatch(struct xdict *d, const char *pat, int len);
void xdict_sort(struct xdict *d);
int xdict_save(struct xdict *d, const char *fname);
void xdict_free(struct xdict *d);
int xdict_find(struct xdict *d, const char *pattern,
               int (*f)(const char *, void *), void *info);
  int xdict_match_simple(const char *w, const char *p);
  int xdict_match(const char *w, const char *p);

 #ifdef __cplusplus
   }
 #endif
#endif

#ifndef H_XDICTLIB
 #define H_XDICTLIB
 #ifdef __cplusplus
   extern "C" {
 #endif

#include <stdlib.h>

/*
   The |xdict| interface.
*/

#define XDICT_MAXLENGTH 16  /* 0..15 characters */

struct xdict {
    struct word_entry *words[XDICT_MAXLENGTH];
    size_t cap[XDICT_MAXLENGTH];
    size_t len[XDICT_MAXLENGTH];
    int sorted;
};

struct word_entry {
    char *word;
};

void xdict_init(struct xdict *d);
int xdict_load(struct xdict *d, const char *fname);
  int xdict_addword(struct xdict *d, const char *word, int len);
  int xdict_remword(struct xdict *d, const char *word, int len);
  int xdict_remmatch(struct xdict *d, const char *pat, int len);
void xdict_sort(struct xdict *d);
int xdict_save(struct xdict *d, const char *fname);
void xdict_free(struct xdict *d);
int xdict_find(struct xdict *d, const char *pattern,
               int (*f)(const char *, void *), void *info);
  int xdict_match_simple(const char *w, const char *p);
  int xdict_match(const char *w, const char *p);

 #ifdef __cplusplus
   }
 #endif
#endif

Increase XDICT_MAXLENGTH from 9+1 to 15+1.


#include <stdio.h>

typedef struct {
    int **y;
    int *x;
} _inner;

typedef _inner inner;

typedef struct {
    int *g;
    inner in[3];
} outer;

void traverse(outer *o) {
    static int sss = 5;

    inner *in = &(o->in[0]);

    for (size_t i = 0; i < 3; i++) {
        in->x = &sss;
        in++;
        sss += 3;
    }
}

int main(int argc, char *argv[])
{
    outer o2;
    traverse(&o2);

    return 0;
}

Add inner struct iteration example

Add inner struct iteration example


#ifndef DIVIDER_H
#define DIVIDER_H

class Divider {
public:
    Divider(int interval = 1) {
	setInterval(interval);
    }
    void setInterval(int interval) {
	this->interval = interval;
	clockCounter = interval - 1;
    }
    void tick() {
	clockCounter++;
	if (clockCounter == interval) {
	    clockCounter = 0;
	}
    }
    bool hasClocked() {
	return clockCounter == 0;
    }

private:
    int interval;
    int clockCounter;
};

#endif

#ifndef DIVIDER_H
#define DIVIDER_H

class Divider {
public:
    Divider(int interval = 1) {
	setInterval(interval);
	reset();
    }
    void setInterval(int interval) {
	if (interval < 1) {
	    resetValue = 0;
	}
	else {
	    resetValue = interval - 1;
	}
    }
    void reset() {
	clockCounter = resetValue;
    }
    void tick() {
	if (clockCounter == 0) {
	    clockCounter = resetValue;
	}
	else {
	    --clockCounter;
	}
    }
    bool hasClocked() {
	return clockCounter == resetValue;
    }

private:
    int resetValue;
    int clockCounter;
};

#endif

Rewrite divider to change interval without resetting it


#pragma once

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

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

#pragma once

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

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

Increment version number to 1.49

Increment version number to 1.49


/*
 * copyright 2015 wink saville
 *
 * licensed under the apache license, version 2.0 (the "license");
 * you may not use this file except in compliance with the license.
 * you may obtain a copy of the license at
 *
 *     http://www.apache.org/licenses/license-2.0
 *
 * unless required by applicable law or agreed to in writing, software
 * distributed under the license is distributed on an "as is" basis,
 * without warranties or conditions of any kind, either express or implied.
 * see the license for the specific language governing permissions and
 * limitations under the license.
 */

#include "poweroff.h"
#include "inttypes.h"

void poweroff(void) {
  uint32_t* pUnlockResetReg = (uint32_t*)0x10000020;
  uint32_t* pResetReg = (uint32_t*)0x10000040;

  // If qemu is executed with -no-reboot option then
  // resetting the board will cause qemu to exit
  // and it won't be necessary to ctrl-a, x to exit.
  // See http://lists.nongnu.org/archive/html/qemu-discuss/2015-10/msg00057.html

  // For arm926ej-s you unlock the reset register
  // then reset the board, I'm resetting to level 6

  *pUnlockResetReg = 0xA05F;
  *pResetReg = 0x106;
}

/*
 * copyright 2015 wink saville
 *
 * licensed under the apache license, version 2.0 (the "license");
 * you may not use this file except in compliance with the license.
 * you may obtain a copy of the license at
 *
 *     http://www.apache.org/licenses/license-2.0
 *
 * unless required by applicable law or agreed to in writing, software
 * distributed under the license is distributed on an "as is" basis,
 * without warranties or conditions of any kind, either express or implied.
 * see the license for the specific language governing permissions and
 * limitations under the license.
 */

#include "poweroff.h"
#include "inttypes.h"

void poweroff(void) {
  volatile uint32_t* pUnlockResetReg = (uint32_t*)0x10000020;
  volatile uint32_t* pResetReg = (uint32_t*)0x10000040;

  // If qemu is executed with -no-reboot option then
  // resetting the board will cause qemu to exit
  // and it won't be necessary to ctrl-a, x to exit.
  // See http://lists.nongnu.org/archive/html/qemu-discuss/2015-10/msg00057.html

  // For arm926ej-s you unlock the reset register
  // then reset the board, I'm resetting to level 6

  *pUnlockResetReg = 0xA05F;
  *pResetReg = 0x106;
}

Make the registers address point to volatile memory.


#ifndef FILESYSTEM_H
#define FILESYSTEM_H

#include "Partition.h"
#include <vector>
#include <string>

class Directory;

enum class FileType {
    File, Directory
};

class File : public HDDBytes {
    std::string _name;
    public:
    std::string getName(){return _name;}
    //virtual void setName(const std::string& name) = 0;
    //virtual Directory * getParent() = 0; // null => root directory
    virtual FileType getType();
    virtual Directory * dir() {return nullptr;};
};

class Directory : public virtual File {
public :
    virtual std::vector<std::string> getFilesName () = 0;
    FileType getType();
    virtual File * operator[](const std::string& name) = 0; // nullptr means it does not exists
    virtual Directory * dir() {return this;};
};

class FileSystem {
protected :
    Partition* _part;
public:
    explicit FileSystem (Partition * part);
    virtual Directory* getRoot() = 0;
    //virtual File* operator [] (const std::string& path) = 0; //return null when path is not valid
};

#endif

#ifndef FILESYSTEM_H
#define FILESYSTEM_H

#include "Partition.h"
#include <vector>
#include <string>

class Directory;

enum class FileType {
    File, Directory
};

class File : public HDDBytes {
    public:
    virtual FileType getType();
    virtual Directory * dir() {return nullptr;};
};

class Directory : public virtual File {
public :
    virtual std::vector<std::string> getFilesName () = 0;
    FileType getType();
    virtual File * operator[](const std::string& name) = 0; // nullptr means it does not exists
    virtual Directory * dir() {return this;};
};

class FileSystem {
protected :
    Partition* _part;
public:
    explicit FileSystem (Partition * part);
    virtual Directory* getRoot() = 0;
    //virtual File* operator [] (const std::string& path) = 0; //return null when path is not valid
};

#endif

Remove unused methods in File

Remove unused methods in File


#ifndef SCC_SYMBOL_HEADER
#define SCC_SYMBOL_HEADER

#include "syntax.h"

typedef struct Symbol
{
    int level;
    char *name;

    // used in semantic analysis
    Syntax * declaration;

    // used in intermediate code generation
    char *var_name;
} Symbol;

Symbol * symbol_new();

void symbol_delete(Symbol * symbol);

#endif

#ifndef SCC_SYMBOL_HEADER
#define SCC_SYMBOL_HEADER

#include "syntax.h"

typedef struct Symbol
{
    int level;
    char *name;

    union
    {
        // used in semantic analysis
        Syntax * declaration;

        // used in intermediate code generation
        char *var_name;

        // used in target code generation
        int address;
    };

} Symbol;

Symbol * symbol_new();

void symbol_delete(Symbol * symbol);

#endif

Add a member for target code generation.


#pragma once

#include <cstdint>
#include "halley/bytes/config_node_serializer.h"

namespace Halley {
	class World;

	struct alignas(8) EntityId {
		int64_t value;

		EntityId() : value(-1) {}

		explicit EntityId(const String& str);

		bool isValid() const { return value != -1; }
		bool operator==(const EntityId& other) const { return value == other.value; }
		bool operator!=(const EntityId& other) const { return value != other.value; }
		bool operator<(const EntityId& other) const { return value < other.value; }
		bool operator>(const EntityId& other) const { return value > other.value; }
		bool operator<=(const EntityId& other) const { return value <= other.value; }
		bool operator>=(const EntityId& other) const { return value >= other.value; }

		String toString() const;

		void serialize(Serializer& s) const;
		void deserialize(Deserializer& s);
	};

	template <>
    class ConfigNodeSerializer<EntityId> {
    public:
		ConfigNode serialize(EntityId id, const EntitySerializationContext& context);
		EntityId deserialize(const EntitySerializationContext& context, const ConfigNode& node);
    };
}

namespace std {
	template<>
	struct hash<Halley::EntityId>
	{
		size_t operator()(const Halley::EntityId& v) const noexcept
		{
			return std::hash<int64_t>()(v.value);
		}
	};
}

#pragma once

#include <cstdint>
#include "halley/bytes/config_node_serializer.h"

namespace Halley {
	class World;

	struct alignas(8) EntityId {
		int64_t value;

		EntityId(int64_t value = -1) : value(value) {}

		explicit EntityId(const String& str);

		bool isValid() const { return value != -1; }
		bool operator==(const EntityId& other) const { return value == other.value; }
		bool operator!=(const EntityId& other) const { return value != other.value; }
		bool operator<(const EntityId& other) const { return value < other.value; }
		bool operator>(const EntityId& other) const { return value > other.value; }
		bool operator<=(const EntityId& other) const { return value <= other.value; }
		bool operator>=(const EntityId& other) const { return value >= other.value; }

		String toString() const;

		void serialize(Serializer& s) const;
		void deserialize(Deserializer& s);
	};

	template <>
    class ConfigNodeSerializer<EntityId> {
    public:
		ConfigNode serialize(EntityId id, const EntitySerializationContext& context);
		EntityId deserialize(const EntitySerializationContext& context, const ConfigNode& node);
    };
}

namespace std {
	template<>
	struct hash<Halley::EntityId>
	{
		size_t operator()(const Halley::EntityId& v) const noexcept
		{
			return std::hash<int64_t>()(v.value);
		}
	};
}

Allow creating EntityId directly from int64_t


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

#ifndef BRPC_SESSION_LOG_H
#define BRPC_SESSION_LOG_H

#include "butil/containers/flat_map.h"

namespace brpc {

class SessionLog {
public:
    class Formatter {
    public:
        virtual ~Formatter() {}
        virtual void Print(std::ostream&, const SessionLog&) = 0;
    };

    typedef butil::FlatMap<std::string, std::string> Map;
    typedef Map::const_iterator Iterator;

    SessionLog() {}

    // Exchange internal fields with another SessionLog.
    void Swap(SessionLog &rhs) { _entries.swap(rhs._entries); }

    // Reset internal fields as if they're just default-constructed.
    void Clear() { _entries.clear(); }

    // Get value of a key(case-sensitive)
    // Return pointer to the value, NULL on not found.
    const std::string* Get(const char* key) const { return _entries.seek(key); }
    const std::string* Get(const std::string& key) const { return _entries.seek(key); }

    // Set value of a key
    void Set(const std::string& key, const std::string& value) { GetOrAdd(key) = value; }
    void Set(const std::string& key, const char* value) { GetOrAdd(key) = value; }
    // Convert other types to string as well
    template <typename T>
    void Set(const std::string& key, const T& value) { GetOrAdd(key) = std::to_string(value); }

    // Remove a key
    void Remove(const char* key) { _entries.erase(key); }
    void Remove(const std::string& key) { _entries.erase(key); }

    // Get iterators to iterate key/value
    Iterator Begin() const { return _entries.begin(); }
    Iterator End() const { return _entries.end(); }

    // number of key/values
    size_t Count() const { return _entries.size(); }

private:
    std::string& GetOrAdd(const std::string& key) {
        if (!_entries.initialized()) {
            _entries.init(29);
        }
        return _entries[key];
    }

    Map _entries;
};

} // namespace brpc

#endif // BRPC_SESSION_LOG_H

Add SessionLog to remember session-level kv


#include "base/base.h"

class Graph {
 public:
  typedef int16_t Node;
  typedef int16_t Degree;

  Graph(Node order, Degree degree)
      : order_(order),
        degree_(degree),
        edges_(order * degree, -1) {}

  inline Node order() { return order_; }
  inline Degree degree() { return degree_; }

  // Returns the de
  Node GetEdge(Node order_index, Degree degree_index);

 private:
  const Node order_;
  const Degree degree_;
  vector<Node> edges_;
};

#include "base/base.h"

class Graph {
 public:
  typedef int16_t Node;
  typedef int16_t Degree;

  Graph(Node order, Degree degree)
      : order_(order),
        degree_(degree),
        edges_(order * degree, -1) {}

  inline Node order() { return order_; }
  inline Degree degree() { return degree_; }

  // Returns the order_index node's degree_index-th edge's node.  Returns -1 if
  // there is no such an edge.
  Node GetEdge(Node order_index, Degree degree_index);

 private:
  const Node order_;
  const Degree degree_;
  vector<Node> edges_;
};

Update the comment for Graph::GetEdge.

Update the comment for Graph::GetEdge.


#ifndef CJET_CONFIG_H
#define CJET_CONFIG_H

#define SERVER_PORT \
	11122
#define LISTEN_BACKLOG \
	40

#define MAX_MESSAGE_SIZE \
	250

/* Linux specific configs */
#define MAX_EPOLL_EVENTS \
	100

#endif

#ifndef CJET_CONFIG_H
#define CJET_CONFIG_H

#define SERVER_PORT \
	11122
#define LISTEN_BACKLOG \
	40

#define MAX_MESSAGE_SIZE \
	256

/* Linux specific configs */
#define MAX_EPOLL_EVENTS \
	100

#endif

Change MAX_BUFFER_SIZE to something that is 32 bit aligned.


#ifndef _STDIO_H_
#define _STDIO_H_

/**
 * \file    stdio.h
 * \brief   This file handle the output to the terminal for the user.
 */

#ifdef __cplusplus
extern "C" {
#endif

#ifndef EOF
    #define EOF -1      /*!<    End of file value   */
#endif

/**
 * \brief   Print a formatted string
 *
 * \param[in]   format  Format of the string
 * \param[in]   ...     Arguments for format specification
 *
 * \return  Number of characters written
 */
int printf(const char* __restrict format, ...);

/**
 * \brief   Print a single char
 *
 * \param   c   Character to print
 *
 * \return The character written
 */
int putchar(int c);

/**
 * \brief   Print a string
 *
 * \param   string  The string to print
 *
 * \return The number of characters written
 */
int puts(const char* string);

#ifdef __cplusplus
}
#endif

#endif

#ifndef _STDIO_H_
#define _STDIO_H_

/**
 * \file    stdio.h
 * \brief   This file handle the output to the terminal for the user.
 */

#ifdef __cplusplus
extern "C" {
#endif

#ifndef EOF
    #define EOF -1      /*!<    End of file value   */
#endif

/**
 * \brief   Print a formatted string
 *
 * \param[in]   format  Format of the string
 * \param[in]   ...     Arguments for format specification
 *
 * \return  Number of characters written
 */
int printf(const char* __restrict format, ...);

/**
 * \brief   Print a formatted string into another string
 *
 * \param[out]  out     String we want to write in
 * \param[in]   format  Format of the string
 * \param[in]   ...     Arguments for format specification
 *
 * \return  Number of characters written
 */
int sprintf(char* out, const char* __restrict format, ...);

/**
 * \brief   Print a single char
 *
 * \param   c   Character to print
 *
 * \return The character written
 */
int putchar(int c);

/**
 * \brief   Print a string
 *
 * \param   string  The string to print
 *
 * \return The number of characters written
 */
int puts(const char* string);

#ifdef __cplusplus
}
#endif

#endif

Add signature for sprintf function

feat(sprintf): Add signature for sprintf function


#ifndef MCLISP_CONS_H_
#define MCLISP_CONS_H_

#include <string>

namespace mclisp
{

class ConsCell
{
public:
    ConsCell(): car(nullptr), cdr(nullptr) {}
    ConsCell(ConsCell* car, ConsCell* cdr): car(car), cdr(cdr) {}

    ConsCell* car;
    ConsCell* cdr;
};

bool operator==(const ConsCell& lhs, const ConsCell& rhs);
bool operator!=(const ConsCell& lhs, const ConsCell& rhs);
bool operator< (const ConsCell& lhs, const ConsCell& rhs);
bool operator> (const ConsCell& lhs, const ConsCell& rhs);
bool operator<=(const ConsCell& lhs, const ConsCell& rhs);
bool operator>=(const ConsCell& lhs, const ConsCell& rhs);

std::ostream& operator<<(std::ostream& os, const ConsCell& cons);

extern const ConsCell* kNil;
extern const ConsCell* kT;

void HackToFixNil();

const ConsCell* MakeSymbol(const std::string& name);
const ConsCell* MakeCons(const ConsCell* car, const ConsCell* cdr);

inline bool Symbolp(const ConsCell* c);
inline bool Consp(const ConsCell* c);

const std::string SymbolName(const ConsCell* symbol);

} // namespace mclisp

#endif // MCLISP_CONS_H_

#ifndef MCLISP_CONS_H_
#define MCLISP_CONS_H_

#include <string>

namespace mclisp
{

struct ConsCell
{
  ConsCell* car;
  ConsCell* cdr;
};

typedef struct ConsCell ConsCell;

bool operator==(const ConsCell& lhs, const ConsCell& rhs);
bool operator!=(const ConsCell& lhs, const ConsCell& rhs);
bool operator< (const ConsCell& lhs, const ConsCell& rhs);
bool operator> (const ConsCell& lhs, const ConsCell& rhs);
bool operator<=(const ConsCell& lhs, const ConsCell& rhs);
bool operator>=(const ConsCell& lhs, const ConsCell& rhs);

std::ostream& operator<<(std::ostream& os, const ConsCell& cons);

extern const ConsCell* kNil;
extern const ConsCell* kT;

void HackToFixNil();

const ConsCell* MakeSymbol(const std::string& name);
const ConsCell* MakeCons(const ConsCell* car, const ConsCell* cdr);

inline bool Symbolp(const ConsCell* c);
inline bool Consp(const ConsCell* c);

const std::string SymbolName(const ConsCell* symbol);

} // namespace mclisp

#endif // MCLISP_CONS_H_

Convert ConsCell from class to POD.

Convert ConsCell from class to POD.


#include "config.h"
#include "core/pwm.h"
#include "core/usart.h"

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

void delayms(uint16_t millis) {
	while ( millis ) {
		_delay_ms(1);
		millis--;
	}
}

int main(void) {
	DDRB |= 1<<PB0;
	usart_init();
	pwm_init();
	pwm_set(0);

	while(1) {
		if(char_fifo_is_empty(usart_recv_fifo()))
			usart_send_char(char_fifo_pop(usart_recv_fifo()));
	}
	return 0;
}

#include "config.h"
#include "core/pwm.h"
#include "core/usart.h"
#include "utils/char_fifo.h"

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

void delayms(uint16_t millis) {
	while ( millis ) {
		_delay_ms(1);
		millis--;
	}
}

int main(void) {
	DDRB |= 1<<PB0;
	usart_init();
	pwm_init();
	pwm_set(0);
	char ch;

	while(1) {
		if(char_fifo_is_empty(usart_recv_fifo()))
			char_fifo_pop(usart_recv_fifo(), &ch);
			usart_send_char(ch);
	}
	return 0;
}

Use correct args in usart test

Use correct args in usart test


#include <Python.h>

int main(int argc, char *argv[]) {
  PyObject *expr[3];
  int i, s, e, r;
  char *res;

  if(argc<5) {
    fprintf(stderr,"Usage: <string> <start> <end> <repeat>\n\n\
Print string[start:end]*repeat");
    exit(0);
  }
  s = atoi(argv[2]);
  e = atoi(argv[3]);
  r = atoi(argv[4]);
  expr[0] = PyString_FromString(argv[1]);
  expr[1] = PySequence_GetSlice(expr[0], s, e);
  expr[2] = PySequence_Repeat(expr[1], r);
  res=PyString_AsString(expr[2]);
  printf("'%s'\n",res);
  for(i=0; i<3; i++) Py_CLEAR(expr[i]);
  return 0;
}

#include <Python.h>

int main(int argc, char *argv[]) {
  PyObject *expr[3];
  int i, s, e, r;
  char *res;

  if(argc<5) {
    fprintf(stderr,"Usage: <string> <start> <end> <repeat>\n\n\
Print string[start:end]*repeat\n");
    exit(0);
  }
  s = atoi(argv[2]);
  e = atoi(argv[3]);
  r = atoi(argv[4]);
  expr[0] = PyString_FromString(argv[1]);
  expr[1] = PySequence_GetSlice(expr[0], s, e);
  expr[2] = PySequence_Repeat(expr[1], r);
  res=PyString_AsString(expr[2]);
  printf("'%s'\n",res);
  for(i=0; i<3; i++) Py_CLEAR(expr[i]);
  return 0;
}

Add newline end end of usage

Add newline end end of usage