#ifdef KLEE
#include "klee/klee.h"
#endif
#include <assert.h>
#include <stdio.h>
#include "math.h"

int main() {
  float a;
#ifdef KLEE
  klee_make_symbolic(&a, sizeof(a), "a");
#endif
  float b = a - a;
  assert(sin(b) == 0.0f);
  return 0;
}

#ifdef KLEE
#include "klee/klee.h"
#endif
#include <assert.h>
#include <stdio.h>
#include "math.h"

int main() {
  float a = 0.0f;
#ifdef KLEE
  klee_make_symbolic(&a, sizeof(a), "a");
#endif
  if (isnan(a) || isinf(a)) {
    // assertion won't hold in these cases so exit early
    return 0;
  }
  float b = a - a;
  assert(sin(b) == 0.0f);
  return 0;
}

Fix mistake in example benchmark that is supposed to be correct. The NaN and infinity cases were not considered.


//
//  TrailsKit.h
//  TrailsKit
//
//  Created by Mike Mertsock on 1/1/13.
//  Copyright (c) 2013 Esker Apps. All rights reserved.
//

#ifndef TrailsKit_TrailsKit_h
#define TrailsKit_TrailsKit_h

#import "TrailsKitGeometry.h"
#import "TKGPXPolylineMapper.h"
#import "TrailsKitUI.h"
#import "TrailsKitTypes.h"

#endif

//
//  TrailsKit.h
//  TrailsKit
//
//  Created by Mike Mertsock on 1/1/13.
//  Copyright (c) 2013 Esker Apps. All rights reserved.
//

#ifndef TrailsKit_TrailsKit_h
#define TrailsKit_TrailsKit_h

#import "TrailsKitGeometry.h"
#import "TrailsKitParsers.h"
#import "TrailsKitTypes.h"
#import "TrailsKitUI.h"

#endif

Add parsers header to root header

Add parsers header to root header


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

#define START_WITHOUT_MENU

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

	int ShutDown();

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

	int Update(float dt, InputHandler* inputHandler);

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

#endif

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

//#define START_WITHOUT_MENU

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

	int ShutDown();

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

	int Update(float dt, InputHandler* inputHandler);

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

#endif

REMOVE commented out START_WITHOUT_MENU so we start with a menu


@import CoreData;

static NSString * const HYPPropertyMapperCustomRemoteKey = @"mapper.remote.key";

@interface NSManagedObject (HYPPropertyMapper)

- (void)hyp_fillWithDictionary:(NSDictionary *)dictionary;

- (NSDictionary *)hyp_dictionary;

@end

@import CoreData;

static NSString * const HYPPropertyMapperCustomRemoteKey = @"hyper.remoteKey";

@interface NSManagedObject (HYPPropertyMapper)

- (void)hyp_fillWithDictionary:(NSDictionary *)dictionary;

- (NSDictionary *)hyp_dictionary;

@end

Improve user info name consistency

Improve user info name consistency


/*
 * QLogic iSCSI HBA Driver
 * Copyright (c)  2003-2010 QLogic Corporation
 *
 * See LICENSE.qla4xxx for copyright and licensing details.
 */

#define QLA4XXX_DRIVER_VERSION	"5.02.00-k18"

/*
 * QLogic iSCSI HBA Driver
 * Copyright (c)  2003-2010 QLogic Corporation
 *
 * See LICENSE.qla4xxx for copyright and licensing details.
 */

#define QLA4XXX_DRIVER_VERSION	"5.02.00-k19"

Update driver version to 5.02.00-k19

[SCSI] qla4xxx: Update driver version to 5.02.00-k19

Signed-off-by: Vikas Chaudhary <c251871a64d7d31888eace0406cb3d4c419d5f73@qlogic.com>
Signed-off-by: James Bottomley <1acebbdca565c7b6b638bdc23b58b5610d1a56b8@Parallels.com>


/*
 * AVC helper functions for muxers
 * Copyright (c) 2008 Aurelien Jacobs <aurel@gnuage.org>
 *
 * This file is part of FFmpeg.
 *
 * FFmpeg 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.
 *
 * FFmpeg 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 FFmpeg; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
 */

#ifndef AVC_H
#define AVC_H

#include <stdint.h>
#include "avio.h"

int ff_avc_parse_nal_units(const uint8_t *buf_in, uint8_t **buf, int *size);
int ff_isom_write_avcc(ByteIOContext *pb, const uint8_t *data, int len);
const uint8_t *ff_avc_find_startcode(const uint8_t *p, const uint8_t *end);

#endif /* AVC_H */

/*
 * AVC helper functions for muxers
 * Copyright (c) 2008 Aurelien Jacobs <aurel@gnuage.org>
 *
 * This file is part of FFmpeg.
 *
 * FFmpeg 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.
 *
 * FFmpeg 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 FFmpeg; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
 */

#ifndef FFMPEG_AVC_H
#define FFMPEG_AVC_H

#include <stdint.h>
#include "avio.h"

int ff_avc_parse_nal_units(const uint8_t *buf_in, uint8_t **buf, int *size);
int ff_isom_write_avcc(ByteIOContext *pb, const uint8_t *data, int len);
const uint8_t *ff_avc_find_startcode(const uint8_t *p, const uint8_t *end);

#endif /* FFMPEG_AVC_H */

Add missing FFMPEG_ prefix to multiple inclusion guard.

git-svn-id: a4d7c1866f8397a4106e0b57fc4fbf792bbdaaaf@15047 9553f0bf-9b14-0410-a0b8-cfaf0461ba5b


Set trm inherit signals by default

Set trm inherit signals by default


#include "cycy/stdio.h"

int puts(const char * string) {
    int i = 0;
    while (string[i] != NULL) {
        putchar(string[i++]);
    }
    putc('\n');
    return i + 1;
}

#include "cycy/stdio.h"

int puts(const char * string) {
    int i = 0;
    while (string[i] != NULL) {
        putchar(string[i]);
        i = i + 1;
    }
    putc('\n');
    return i + 1;
}

Make this easier to compile

Make this easier to compile


/*
name: TEST041
description: Test for bug parsing ternary operators
output:
test041.c:36: error: type mismatch in conditional expression
F1	I
G2	F1	main
{
\
A3	I	i
A4	P	p
S6	foo
M7	I	i
A8	S6	foo
	A3	A3	#I0	!I	#W0	#W0	?W	gI	:I
	A4	A3	#I0	!I	#P0	#P0	?P	:P
	A4	A3	#I0	!I	#P0	#P0	?P	:P
	A4	A3	#I0	!I	#P0	#P0	?P	:P
test041.c:36: error: incompatible types when assigning
test041.c:37: error: used struct/union type value where scalar is required
test041.c:38: warning: 'i' defined but not used
test041.c:38: warning: 'foo' defined but not used
*/

int
main(void)
{
	int i;
	void *p;
	struct foo {int i;} foo;

	i = i ? 0 : 0l;
	p = i ? (void *) 0 : 0;
	p = i ? 0 : (void *) 0;
	p = i ? 0 : (const void *) 0;
	p = i ? 2 : p;
	foo ? 1 : 2;
}

Add tests for ugly ternary operator

Add tests for ugly ternary operator


#ifdef __cplusplus
extern "C" {
#endif
    typedef void* COptions;
    COptions newCOptions(const char*, const char*, const char*);
#ifdef __cplusplus
}
#endif

Add back the C++ extern

Add back the C++ extern


/*===
*** test1 (duk_safe_call)
inherited value
top at end: 0
==> rc=0, result='undefined'
===*/

static duk_ret_t my_constructor(duk_context *ctx) {
	return 1;
}

static duk_ret_t test1(duk_context *ctx) {
	duk_push_global_object(ctx);
	duk_push_c_function(ctx, my_constructor, 0);   /* constructor (function) */
	duk_push_object(ctx);                          /* prototype object -> [ global cons proto ] */
	duk_push_string(ctx, "inherited value");
	duk_put_prop_string(ctx, -2, "inherited");     /* set proto.inherited = "inherited value" */
	duk_put_prop_string(ctx, -2, "prototype");     /* set cons.prototype = proto; stack -> [ global cons ] */
	duk_put_prop_string(ctx, -2, "MyConstructor"); /* set global.MyConstructor = cons; stack -> [ global ] */
	duk_pop(ctx);

	duk_eval_string(ctx, "var obj = new MyConstructor(); print(obj.inherited);");
	duk_pop(ctx);

	printf("top at end: %ld\n", (long) duk_get_top(ctx));
	return 0;
}

void test(duk_context *ctx) {
	TEST_SAFE_CALL(test1);
}

/*===
*** test1 (duk_safe_call)
inherited value
top at end: 0
==> rc=0, result='undefined'
===*/

static duk_ret_t my_constructor(duk_context *ctx) {
	return 0;
}

static duk_ret_t test1(duk_context *ctx) {
	duk_push_global_object(ctx);
	duk_push_c_function(ctx, my_constructor, 0);   /* constructor (function) */
	duk_push_object(ctx);                          /* prototype object -> [ global cons proto ] */
	duk_push_string(ctx, "inherited value");
	duk_put_prop_string(ctx, -2, "inherited");     /* set proto.inherited = "inherited value" */
	duk_put_prop_string(ctx, -2, "prototype");     /* set cons.prototype = proto; stack -> [ global cons ] */
	duk_put_prop_string(ctx, -2, "MyConstructor"); /* set global.MyConstructor = cons; stack -> [ global ] */
	duk_pop(ctx);

	duk_eval_string(ctx, "var obj = new MyConstructor(); print(obj.inherited);");
	duk_pop(ctx);

	printf("top at end: %ld\n", (long) duk_get_top(ctx));
	return 0;
}

void test(duk_context *ctx) {
	TEST_SAFE_CALL(test1);
}

Fix invalid return value in API test

Fix invalid return value in API test

No effect on test result because the constructor was not returning an
object anyway.


#ifndef RMC_CORE_H
#define RMC_CORE_H

#include "atomic.h"

#ifdef HAS_RMC
#error "no you don't"
#else

/* Dummy version that should work. */
#define XEDGE(x, y) do { } while (0)
#define VEDGE(x, y) do { } while (0)
/* Just stick a visibility barrier after every label. This isn't good
 * or anything, but it probably works. */
/* This is unhygenic in a nasty way. */
#define L(label, stmt) stmt; vis_barrier()

#endif

#endif

#ifndef RMC_CORE_H
#define RMC_CORE_H

#include "atomic.h"

#ifdef HAS_RMC

/* We signal our labels and edges to our LLVM pass in a *really* hacky
 * way to avoid needing to modify the frontend.  Labelled statements
 * are wrapped in two goto labels to force them into their own basic
 * block (labelled statements don't fundamentally *need* to be in
 * their own basic block, but it makes things convenient) and edges
 * are specified by calling a dummy function __rmc_edge_register with
 * the labels as arguments (using computed goto to get the labels).
 *
 * This is really quite fragile; optimization passes will easily
 * destroy this information. The RMC pass should be run *before* any
 * real optimization passes are run but *after* mem2reg. */

extern void __rmc_edge_register(int is_vis, void *src, void *dst);
#define RMC_EDGE(t, x, y) __rmc_edge_register(t, &&_rmc_##x, &&_rmc_##y)
#define XEDGE(x, y) RMC_EDGE(0, x, y)
#define VEDGE(x, y) RMC_EDGE(1, x, y)
/* This is unhygenic in a nasty way. */
/* The (void)0s are because declarations can't directly follow labels,
 * apparently. */
#define L(label, stmt)                                                  \
    _rmc_##label: (void)0;                                              \
    stmt;                                                               \
    _rmc_end_##label: __attribute__((unused)) (void)0

#else

/* Dummy version that should work. */
#define XEDGE(x, y) do { } while (0)
#define VEDGE(x, y) do { } while (0)
/* Just stick a visibility barrier after every label. This isn't good
 * or anything, but it probably works. */
/* This is unhygenic in a nasty way. */
#define L(label, stmt) stmt; vis_barrier()

#endif /* HAS_RMC */

#endif

Add in a mechanism for interacting with the RMC llvm pass.


#ifndef MISC_H
#define MISC_H

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

#include "types.h"

#define ARR_LEN(a) (sizeof(a) / sizeof(a[0]))

#define LOOKUP(key, table) (assert(key < ARR_LEN(table)), table[key])

static inline void* xmalloc(size_t s)
{
	void* p = malloc(s);
	if (!p) {
		perror("malloc");
		abort();
	}
	return p;
}

static inline void* xcalloc(size_t s)
{
	void* p = calloc(1, s);
	if (!p) {
		perror("calloc");
		abort();
	}
	return p;
}

static inline void xfree(void* p)
{
	free(p);
}

extern struct config* config;

#endif /* MISC_H */

#ifndef MISC_H
#define MISC_H

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

#include "types.h"

#define ARR_LEN(a) (sizeof(a) / sizeof(a[0]))

#define LOOKUP(key, table) (assert(key < ARR_LEN(table)), \
                            assert(key >= 0), \
                            table[key])

static inline void* xmalloc(size_t s)
{
	void* p = malloc(s);
	if (!p) {
		perror("malloc");
		abort();
	}
	return p;
}

static inline void* xcalloc(size_t s)
{
	void* p = calloc(1, s);
	if (!p) {
		perror("calloc");
		abort();
	}
	return p;
}

static inline void xfree(void* p)
{
	free(p);
}

extern struct config* config;

#endif /* MISC_H */

Add a greater-than-or-equal-to-zero assert to LOOKUP().


// RUN: %check -e %s

void init(int (*p)[])
{
	p[0][0] = 1; // CHECK: error: arithmetic on pointer to incomplete type int[]
}

Test for arithmetic on pointer to vla

Test for arithmetic on pointer to vla


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

#ifndef CHROME_BROWSER_COCOA_NSOBJECT_ZOMBIE_H_
#define CHROME_BROWSER_COCOA_NSOBJECT_ZOMBIE_H_
#pragma once

#import <Foundation/Foundation.h>

// You should think twice every single time you use anything from this
// namespace.
namespace ObjcEvilDoers {

// Enable zombies.  Returns NO if it fails to enable.
//
// When |zombieAllObjects| is YES, all objects inheriting from
// NSObject become zombies on -dealloc.  If NO, -shouldBecomeCrZombie
// is queried to determine whether to make the object a zombie.
//
// |zombieCount| controls how many zombies to store before freeing the
// oldest.  Set to 0 to free objects immediately after making them
// zombies.
BOOL ZombieEnable(BOOL zombieAllObjects, size_t zombieCount);

// Disable zombies.
void ZombieDisable();

}  // namespace ObjcEvilDoers

@interface NSObject (CrZombie)
- (BOOL)shouldBecomeCrZombie;
@end

#endif  // CHROME_BROWSER_COCOA_NSOBJECT_ZOMBIE_H_

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

#ifndef CHROME_BROWSER_COCOA_NSOBJECT_ZOMBIE_H_
#define CHROME_BROWSER_COCOA_NSOBJECT_ZOMBIE_H_
#pragma once

#import <Foundation/Foundation.h>

// You should think twice every single time you use anything from this
// namespace.
namespace ObjcEvilDoers {

// Enable zombie object debugging. This implements a variant of Apple's
// NSZombieEnabled which can help expose use-after-free errors where messages
// are sent to freed Objective-C objects in production builds.
//
// Returns NO if it fails to enable.
//
// When |zombieAllObjects| is YES, all objects inheriting from
// NSObject become zombies on -dealloc.  If NO, -shouldBecomeCrZombie
// is queried to determine whether to make the object a zombie.
//
// |zombieCount| controls how many zombies to store before freeing the
// oldest.  Set to 0 to free objects immediately after making them
// zombies.
BOOL ZombieEnable(BOOL zombieAllObjects, size_t zombieCount);

// Disable zombies.
void ZombieDisable();

}  // namespace ObjcEvilDoers

@interface NSObject (CrZombie)
- (BOOL)shouldBecomeCrZombie;
@end

#endif  // CHROME_BROWSER_COCOA_NSOBJECT_ZOMBIE_H_

Add link to explanation of what we mean by zombie
The person triaging / debugging a zombie crash may never have heard of this before.

BUG=None
TEST=None

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

git-svn-id: dd90618784b6a4b323ea0c23a071cb1c9e6f2ac7@62723 4ff67af0-8c30-449e-8e8b-ad334ec8d88c


#define exit_with_code(code) { result = code; goto _exit; }

int compile_files(
  YR_COMPILER* compiler,
  int argc,
  const char** argv)
{
  for (int i = 0; i < argc - 1; i++)
  {
    const char* ns;
    const char* file_name;
    char* colon = (char*) strchr(argv[i], ':');

    // Namespace delimiter must be a colon not followed by a slash or backslash
    if (colon && *(colon + 1) != '\\' && *(colon + 1) != '/')
    {
      file_name = colon + 1;
      *colon = '\0';
      ns = argv[i];
    }
    else
    {
      file_name = argv[i];
      ns = NULL;
    }

    FILE* rule_file = fopen(file_name, "r");

    if (rule_file == NULL)
    {
      fprintf(stderr, "error: could not open file: %s\n", file_name);
      fclose(rule_file);
      return 0;
    }

    yr_compiler_add_file(compiler, rule_file, ns, file_name);

    fclose(rule_file);
  }

  return 1;
}

#define exit_with_code(code) { result = code; goto _exit; }

int compile_files(
  YR_COMPILER* compiler,
  int argc,
  const char** argv)
{
  for (int i = 0; i < argc - 1; i++)
  {
    const char* ns;
    const char* file_name;
    char* colon = (char*) strchr(argv[i], ':');

    // Namespace delimiter must be a colon not followed by a slash or backslash
    if (colon && *(colon + 1) != '\\' && *(colon + 1) != '/')
    {
      file_name = colon + 1;
      *colon = '\0';
      ns = argv[i];
    }
    else
    {
      file_name = argv[i];
      ns = NULL;
    }

    FILE* rule_file = fopen(file_name, "r");

    if (rule_file == NULL)
    {
      fprintf(stderr, "error: could not open file: %s\n", file_name);
      return 0;
    }

    yr_compiler_add_file(compiler, rule_file, ns, file_name);

    fclose(rule_file);
  }

  return 1;
}

Remove unnecessary call to fclose.

Remove unnecessary call to fclose.


// emitcode.h            see license.txt for copyright and terms of use
// track state of emitted code so I can emit #line too

#ifndef EMITCODE_H
#define EMITCODE_H

#include <fstream.h>      // ofstream
#include "str.h"          // stringBuffer
#include "srcloc.h"       // SourceLoc

class EmitCode : public stringBuilder {
private:     // data
  ofstream os;         // stream to write to
  string fname;        // filename for emitting #line
  int line;            // current line number

public:      // funcs
  EmitCode(rostring fname);
  ~EmitCode();

  string const &getFname() const { return fname; }

  // get current line number; flushes internally
  int getLine();

  // flush data in stringBuffer to 'os'
  void flush();
};

// return a #line directive for the given location
string lineDirective(SourceLoc loc);

// emit a #line directive to restore reporting to the
// EmitCode file itself (the 'sb' argument must be an EmitFile object)
stringBuilder &restoreLine(stringBuilder &sb);

#endif // EMITCODE_H

// emitcode.h            see license.txt for copyright and terms of use
// track state of emitted code so I can emit #line too

#ifndef EMITCODE_H
#define EMITCODE_H

#include "str.h"          // stringBuffer
#include "srcloc.h"       // SourceLoc
#include "ofstreamts.h"   // ofstreamTS

class EmitCode : public stringBuilder {
private:     // data
  ofstreamTS os;       // stream to write to
  string fname;        // filename for emitting #line
  int line;            // current line number

public:      // funcs
  EmitCode(rostring fname);
  ~EmitCode();

  string const &getFname() const { return fname; }

  // get current line number; flushes internally
  int getLine();

  // flush data in stringBuffer to 'os'
  void flush();
};

// return a #line directive for the given location
string lineDirective(SourceLoc loc);

// emit a #line directive to restore reporting to the
// EmitCode file itself (the 'sb' argument must be an EmitFile object)
stringBuilder &restoreLine(stringBuilder &sb);

#endif // EMITCODE_H

Use ofstreamTS to avoid touching the .gen.cc, .gen.h output if unchanged.


#ifndef __INSECT_H__
#define __INSECT_H__

#include "insect/crawler.h"
#include "insect/records.h"

/* basic file API */
#include "insect/file/stat.h"

#ifdef USE_THREADS
#include "insect/concurrent/thread.h"
#endif /* USE_THREADS */

#endif /* __INSECT_H__ */

#ifndef __INSECT_H__
#define __INSECT_H__

#ifdef __cplusplus
extern "C" {
#endif /* C++ */

#include "insect/crawler.h"
#include "insect/records.h"

/* basic file API */
#include "insect/file/stat.h"

#ifdef USE_THREADS
#include "insect/concurrent/thread.h"
#endif /* USE_THREADS */

#ifdef __cplusplus
} /* extern "C" */
#endif /* C++ */

#endif /* __INSECT_H__ */

Add extern "C" wrapper to main header, for C++


/*
 * Copyright (c) 2011-2013 libbitcoin developers (see AUTHORS)
 *
 * This file is part of libbitcoin.
 *
 * libbitcoin is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Affero General Public License with
 * additional permissions to the one published by the Free Software
 * Foundation, either version 3 of the License, or (at your option)
 * any later version. For more information see LICENSE.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Affero General Public License for more details.
 *
 * You should have received a copy of the GNU Affero General Public License
 * along with this program. If not, see <http://www.gnu.org/licenses/>.
 */
#ifndef LIBBITCOIN_COMPAT_H
#define LIBBITCOIN_COMPAT_H

#ifdef _MSC_VER
    // There is no <endian.h> for MSVC but it is always little endian.
    #ifndef __LITTLE_ENDIAN__
        # undef __BIG_ENDIAN__
        # define __LITTLE_ENDIAN__
    #endif
#endif

#ifdef _MSC_VER
    // For SET_BINARY_FILE_MODE
    #include <fcntl.h>
    #include <io.h>
    #include <stdio.h>
#endif

// Sets the _fmode global variable, which controls the default translation
// mode for file I/O operations.
#ifdef _MSC_VER
    #define BC_SET_BINARY_FILE_MODE(mode) \
        _setmode(_fileno(stdin), if_else(mode, _O_BINARY, _O_TEXT))
#else
    #define BC_SET_BINARY_FILE_MODE(mode)
#endif

#endif

/*
 * Copyright (c) 2011-2013 libbitcoin developers (see AUTHORS)
 *
 * This file is part of libbitcoin.
 *
 * libbitcoin is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Affero General Public License with
 * additional permissions to the one published by the Free Software
 * Foundation, either version 3 of the License, or (at your option)
 * any later version. For more information see LICENSE.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Affero General Public License for more details.
 *
 * You should have received a copy of the GNU Affero General Public License
 * along with this program. If not, see <http://www.gnu.org/licenses/>.
 */
#ifndef LIBBITCOIN_COMPAT_H
#define LIBBITCOIN_COMPAT_H

#ifdef _MSC_VER
    // There is no <endian.h> for MSVC but it is always little endian.
    #ifndef __LITTLE_ENDIAN__
        # undef __BIG_ENDIAN__
        # define __LITTLE_ENDIAN__
    #endif
#endif

#endif

Remove unused code, keep in bx.

Remove unused code, keep in bx.


#pragma once

#include <Arduino.h>

#include "stepper.h"

enum StepMode : uint8_t {
	StepHalf = 1,
	StepFull = 2,
	StepBoth = 3
};

enum BrakeMode : uint8_t {
	BrakeNone = 0,
	BrakeAlways = 1,
	BrakeSmart = 2
};

struct Config {
	StepMode stepMode;
	BrakeMode brakeMode;

	uint32_t tickTime;
	uint32_t homeTime;
	uint32_t fixTime;

	int16_t maxSteps; // Maximale Anzahl an Schritten die die Firmware maximal machen darf (nach unten)
	int16_t homeSteps;
	int16_t fixSteps; // Anzahl an Schritten die die Firmware macht um eine Kugel nach unten zu fahren (ignoriert dabei maxSteps)

	uint16_t brakeTicks;

	uint16_t minStepDelta; // Unterschied zwischen derzeitiger Hhe und Zielhhe ab wann die Kugel bewegt werden soll
};

extern Config config;

// setzt die Standard Config
void setDefaultConfig();

// prft Config auf invalide Werte
boolean checkConfig(Config* config);

#pragma once

#include <Arduino.h>

#include "stepper.h"

enum StepMode : uint8_t {
	StepHalf = 1,
	StepFull = 2,
	StepBoth = 3
};

enum BrakeMode : uint8_t {
	BrakeNone = 0,
	BrakeAlways = 1,
	BrakeSmart = 2
};

struct Config {
	StepMode stepMode;
	BrakeMode brakeMode;

	uint32_t tickTime;
	uint32_t homeTime;
	uint32_t fixTime;

	int16_t maxSteps; // Maximale Anzahl an Schritten die die Firmware maximal machen darf (nach unten)
	int16_t homeSteps;
	int16_t fixSteps; // Anzahl an Schritten die die Firmware macht um eine Kugel nach unten zu fahren (ignoriert dabei maxSteps)

	uint16_t brakeTicks;

	uint16_t minStepDelta; // Unterschied zwischen derzeitiger Hhe und Zielhhe ab wann die Kugel bewegt werden soll
} __attribute__((__packed__));

extern Config config;

// setzt die Standard Config
void setDefaultConfig();

// prft Config auf invalide Werte
boolean checkConfig(Config* config);

Add packed attribute to Config

Add packed attribute to Config


Test for arithmetic on pointer to vla

Test for arithmetic on pointer to vla


# define RAD_TO_DEG 57.29577951308232087 /* 180/PI */
# define DEG_TO_RAD 0.0174532925199433 /* PI/180 */

VALUE mgrs_to_lat_long(VALUE klass) {
  VALUE mgrs_grid = rb_iv_get(klass, "@grid");
  char* grid = StringValuePtr(mgrs_grid);

  double lat, lng;

  Convert_MGRS_To_Geodetic(grid, &lat, &lng);

  VALUE lat_lng_array = rb_ary_new();
  rb_ary_push(lat_lng_array, rb_float_new(lat*RAD_TO_DEG));
  rb_ary_push(lat_lng_array, rb_float_new(lng*RAD_TO_DEG));
  return lat_lng_array;
}

VALUE lat_long_to_mgrs(VALUE klass) {
  VALUE iv_latitude  = rb_funcall(rb_iv_get(klass, "@latitude" ), rb_intern("to_s"), 0),
        iv_longitude = rb_funcall(rb_iv_get(klass, "@longitude"), rb_intern("to_s"), 0);

  double latitude  = rb_str_to_dbl(iv_latitude,  Qfalse),
         longitude = rb_str_to_dbl(iv_longitude, Qfalse);

  char grid[15];
  Convert_Geodetic_To_MGRS(latitude*DEG_TO_RAD, longitude*DEG_TO_RAD, 5, grid);

  return rb_str_new2(grid);
}

# define RAD_TO_DEG 57.29577951308232087 /* 180/PI */
# define DEG_TO_RAD 0.0174532925199433 /* PI/180 */

VALUE mgrs_to_lat_long(VALUE klass) {
  VALUE mgrs_grid = rb_iv_get(klass, "@grid");
  char* grid = StringValuePtr(mgrs_grid);
  double lat, lng;

  Convert_MGRS_To_Geodetic(grid, &lat, &lng);

  VALUE lat_lng_array = rb_ary_new();
  rb_ary_push(lat_lng_array, rb_float_new(lat*RAD_TO_DEG));
  rb_ary_push(lat_lng_array, rb_float_new(lng*RAD_TO_DEG));
  return lat_lng_array;
}

VALUE lat_long_to_mgrs(VALUE klass) {
  double latitude  = rb_num2dbl(rb_iv_get(klass, "@latitude")),
         longitude = rb_num2dbl(rb_iv_get(klass, "@longitude"));

  char grid[15];
  Convert_Geodetic_To_MGRS(latitude*DEG_TO_RAD, longitude*DEG_TO_RAD, 5, grid);

  return rb_str_new2(grid);
}

Clean up converting float to double

Clean up converting float to double


#include "syshead.h"
#include "tcp_socket.h"

#define MAX_TCP_SOCKETS 128
static int cur_fd = 3;
static struct tcp_socket tcp_sockets[MAX_TCP_SOCKETS];

void init_tcp_sockets()
{
    memset(tcp_sockets, 0, sizeof(struct tcp_socket) * MAX_TCP_SOCKETS);
}

struct tcp_socket *alloc_tcp_socket()
{
    struct tcp_socket *sock;
    for (int i = 0; i<MAX_TCP_SOCKETS; i++) {
        sock = &tcp_sockets[i];
        if (sock->fd == 0) {
            sock->fd = cur_fd++;
            sock->state = CLOSED;
            return sock;
        }
    }

    /* No space left, error case */
    return NULL;
}

void free_tcp_socket(struct tcp_socket *sock)
{

}

struct tcp_socket *get_tcp_socket(int sockfd)
{
    struct tcp_socket sk;
    for (int i = 0; i<MAX_TCP_SOCKETS; i++) {
        sk = tcp_sockets[i];

        if (sk.fd == sockfd) return &sk;
    }

    return NULL;
}

#include "syshead.h"
#include "tcp_socket.h"

#define MAX_TCP_SOCKETS 128
static int cur_fd = 3;
static struct tcp_socket tcp_sockets[MAX_TCP_SOCKETS];

void init_tcp_sockets()
{
    memset(tcp_sockets, 0, sizeof(struct tcp_socket) * MAX_TCP_SOCKETS);
}

struct tcp_socket *alloc_tcp_socket()
{
    struct tcp_socket *sock;
    for (int i = 0; i<MAX_TCP_SOCKETS; i++) {
        sock = &tcp_sockets[i];
        if (sock->fd == 0) {
            sock->fd = cur_fd++;
            sock->state = CLOSED;
            return sock;
        }
    }

    /* No space left, error case */
    return NULL;
}

void free_tcp_socket(struct tcp_socket *sock)
{

}

struct tcp_socket *get_tcp_socket(int sockfd)
{
    struct tcp_socket *sk;
    for (int i = 0; i<MAX_TCP_SOCKETS; i++) {
        sk = &tcp_sockets[i];

        if (sk->fd == sockfd) return sk;
    }

    return NULL;
}

Fix ugly pointer return bug

Fix ugly pointer return bug


//
//  CMIDISequence+Debug.h
//  CMIDI
//
//  Created by CHARLES GILLINGHAM on 9/20/15.
//  Copyright (c) 2015 CharlesGillingham. All rights reserved.
//

#import "CMIDISequence.h"

@interface CMIDISequence (Debug)
+ (BOOL) testWithMessageList: (NSArray *) msgs;
+ (BOOL) testWithMIDIFile: (NSURL *) fileName;
@end

Rebuild with alias -- trying to fix commit error message


#ifndef _ASM_CRIS_ARCH_CACHE_H
#define _ASM_CRIS_ARCH_CACHE_H

#include <arch/hwregs/dma.h>

/* A cache-line is 32 bytes. */
#define L1_CACHE_BYTES 32
#define L1_CACHE_SHIFT 5

#define __read_mostly __attribute__((__section__(".data.read_mostly")))

void flush_dma_list(dma_descr_data *descr);
void flush_dma_descr(dma_descr_data *descr, int flush_buf);

#define flush_dma_context(c) \
  flush_dma_list(phys_to_virt((c)->saved_data));

void cris_flush_cache_range(void *buf, unsigned long len);
void cris_flush_cache(void);

#endif /* _ASM_CRIS_ARCH_CACHE_H */

#ifndef _ASM_CRIS_ARCH_CACHE_H
#define _ASM_CRIS_ARCH_CACHE_H

#include <arch/hwregs/dma.h>

/* A cache-line is 32 bytes. */
#define L1_CACHE_BYTES 32
#define L1_CACHE_SHIFT 5

#define __read_mostly __attribute__((__section__(".data..read_mostly")))

void flush_dma_list(dma_descr_data *descr);
void flush_dma_descr(dma_descr_data *descr, int flush_buf);

#define flush_dma_context(c) \
  flush_dma_list(phys_to_virt((c)->saved_data));

void cris_flush_cache_range(void *buf, unsigned long len);
void cris_flush_cache(void);

#endif /* _ASM_CRIS_ARCH_CACHE_H */

Correct name of read_mostly section.

CRISv32: Correct name of read_mostly section.

54cb27a71f51d304342c79e62fd7667f2171062b renamed .data.read_mostly to
.data..read_mostly for all architectures for 2.6.33.

Reported-by: Ralf Baechle <92f48d309cda194c8eda36aa8f9ae28c488fa208@linux-mips.org>
Signed-off-by: Jesper Nilsson <987a7dbc972893e93e5578401bedc3a0f2ccb5e3@axis.com>


/*
 * QLogic Fibre Channel HBA Driver
 * Copyright (c)  2003-2008 QLogic Corporation
 *
 * See LICENSE.qla2xxx for copyright and licensing details.
 */
/*
 * Driver version
 */
#define QLA2XXX_VERSION      "8.02.01-k5"

#define QLA_DRIVER_MAJOR_VER	8
#define QLA_DRIVER_MINOR_VER	2
#define QLA_DRIVER_PATCH_VER	1
#define QLA_DRIVER_BETA_VER	0

/*
 * QLogic Fibre Channel HBA Driver
 * Copyright (c)  2003-2008 QLogic Corporation
 *
 * See LICENSE.qla2xxx for copyright and licensing details.
 */
/*
 * Driver version
 */
#define QLA2XXX_VERSION      "8.02.01-k6"

#define QLA_DRIVER_MAJOR_VER	8
#define QLA_DRIVER_MINOR_VER	2
#define QLA_DRIVER_PATCH_VER	1
#define QLA_DRIVER_BETA_VER	0

Update version number to 8.02.01-k6.

[SCSI] qla2xxx: Update version number to 8.02.01-k6.

Signed-off-by: Andrew Vasquez <67840a4977006af7f584bdc4c86d7243c1629cad@qlogic.com>
Signed-off-by: James Bottomley <407b36959ca09543ccda8f8e06721c791bc53435@HansenPartnership.com>


/* Path handling. This was copied from Lua, with some minor adjustments.
   The biggest one is the lack of Windows support, because I don't have
   my Windows box setup for Lily yet (I'd rather make sure Windows works
   all at once). */
#define LILY_MAJOR "0"
#define LILY_MINOR "13"
#define LILY_VERSION_DIR   LILY_MAJOR "." LILY_MINOR

#define LILY_BASE_DIR	"/usr/local/"
#define LILY_SHARE_DIR	LILY_ROOT "share/lua/" LUA_VDIR "/"
#define LILY_CDIR	LILY_ROOT "lib/lua/" LUA_VDIR "/"

/* So, by default, Lily will attempt to load .lly files from these
   directories. */
#define LILY_PATH_SEED \
        LILY_BASE_DIR "share/" LILY_VERSION_DIR "/;" \
        LILY_BASE_DIR "lib/" LILY_VERSION_DIR "/;" \
        "./;"

/* Path handling. This was copied from Lua, with some minor adjustments.
   The biggest one is the lack of Windows support, because I don't have
   my Windows box setup for Lily yet (I'd rather make sure Windows works
   all at once). */
#define LILY_MAJOR          "0"
#define LILY_MINOR          "13"
#define LILY_VERSION_DIR    LILY_MAJOR "_" LILY_MINOR

#define LILY_BASE_DIR       "/usr/local/"
#define LILY_SHARE_DIR      LILY_BASE_DIR "share/lily/" LILY_VERSION_DIR "/"
#define LILY_LIB_DIR        LILY_BASE_DIR "lib/lily/"   LILY_VERSION_DIR "/"

/* This is where Lily will attempt to import new files from. If the parser is
   loading from a file, then the directory of the first file is added as the
   very last path to search. */
#define LILY_PATH_SEED \
        LILY_SHARE_DIR ";" \
        LILY_LIB_DIR ";" \
        "./;"

Fix up the embarassing mess of path seeding. Yikes. :(


#ifndef __HTTP_TUNNEL_H__
#define __HTTP_TUNNEL_H__
// Copyright (c) 2009 - Decho Corp.

#include "auth.h"

namespace HTTP
{
    template <class T>
    Stream::ptr tunnel(T &conn, const std::string &proxy, const std::string &target)
    {
        Request requestHeaders;
        requestHeaders.requestLine.method = CONNECT;
        requestHeaders.requestLine.uri = target;
        requestHeaders.request.host = proxy;
        requestHeaders.general.connection.insert("Proxy-Connection");
        requestHeaders.general.proxyConnection.insert("Keep-Alive");
        ClientRequest::ptr request = conn.request(requestHeaders);
        if (request->response().status.status == HTTP::OK) {
            return request->stream();
        } else {
            throw std::runtime_error("proxy connection failed");
        }
    }
}

#endif

#ifndef __HTTP_TUNNEL_H__
#define __HTTP_TUNNEL_H__
// Copyright (c) 2009 - Decho Corp.

#include "auth.h"

namespace HTTP
{
    template <class T>
    Stream::ptr tunnel(T &conn, const std::string &proxy, const std::string &target)
    {
        Request requestHeaders;
        requestHeaders.requestLine.method = CONNECT;
        requestHeaders.requestLine.uri = target;
        requestHeaders.request.host = proxy;
        requestHeaders.general.connection.insert("Proxy-Connection");
        requestHeaders.general.proxyConnection.insert("Keep-Alive");
        ClientRequest::ptr request = conn.request(requestHeaders);
        if (request->response().status.status == HTTP::OK) {
            return request->stream();
        } else {
            throw InvalidResponseException("proxy connection failed",
                request->response());
        }
    }
}

#endif

Throw a more useful exceptoin when proxy connection fails.


Add more comments describing Stat_t and Axis_t

git-svn-id: ecbadac9c76e8cf640a0bca86f6bd796c98521e3@3097 27541ba8-7e3a-0410-8455-c3a389f83636


namespace Shiboken
{
inline bool Converter<QStringList>::isConvertible(PyObject* pyObj)
{
    return StdListConverter<QStringList>::isConvertible(pyObj);
}

inline QStringList Converter<QStringList>::toCpp(PyObject* pyObj)
{
    return StdListConverter<QStringList>::toCpp(pyObj);
}

inline PyObject* Converter<QStringList>::toPython(const QStringList& cppObj)
{
    return StdListConverter<QStringList>::toPython(cppObj);
}
}

namespace Shiboken
{
inline bool Converter<QStringList>::isConvertible(PyObject* pyObj)
{
    return StdListConverter<QStringList>::isConvertible(pyObj);
}

inline QStringList Converter<QStringList>::toCpp(PyObject* pyObj)
{
    return StdListConverter<QStringList>::toCpp(pyObj);
}

inline PyObject* Converter<QStringList>::toPython(const QStringList& cppObj)
{
    return ValueTypeConverter<QStringList>::toPython(cppObj);
}
}

Return a QStringList wrapper instead of a python list in Converter::toPython.


//
//  UIAlertViewBlocksKitTest.h
//  BlocksKit
//
//  Created by Zachary Waldowski on 12/20/11.
//  Copyright (c) 2011 Dizzy Technology. All rights reserved.
//

#import <GHUnitIOS/GHUnit.h>
#import "BlocksKit/BlocksKit.h"

@interface UIAlertViewBlocksKitTest : GHTestCase

@end

//
//  UIAlertViewBlocksKitTest.h
//  BlocksKit Unit Tests
//

#import <GHUnitIOS/GHUnit.h>
#import "BlocksKit/BlocksKit.h"

@interface UIAlertViewBlocksKitTest : GHTestCase

- (void)testInit;
- (void)testAddButtonWithHandler;
- (void)testSetCancelButtonWithHandler;
- (void)testDelegationBlocks;

@end

Make the UIAlertView unit test header consistent.


//=== MipsELFStreamer.h - MipsELFStreamer ------------------------------===//
//
//                    The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENCE.TXT for details.
//
//===-------------------------------------------------------------------===//
#ifndef MIPSELFSTREAMER_H_
#define MIPSELFSTREAMER_H_

#include "llvm/MC/MCELFStreamer.h"

namespace llvm {
class MipsSubtarget;

class MipsELFStreamer : public MCELFStreamer {
private:
  unsigned EFlags;
public:
  MipsELFStreamer(MCContext &Context, MCAsmBackend &TAB,
                  raw_ostream &OS, MCCodeEmitter *Emitter,
                  bool RelaxAll, bool NoExecStack)
    : MCELFStreamer(Context, TAB, OS, Emitter), EFlags(0) {
  }

  ~MipsELFStreamer() {}
  void emitELFHeaderFlagsCG(const MipsSubtarget &Subtarget);
//  void emitELFHeaderFlagCG(unsigned Val);
};

  MCELFStreamer* createMipsELFStreamer(MCContext &Context, MCAsmBackend &TAB,
                                       raw_ostream &OS, MCCodeEmitter *Emitter,
                                       bool RelaxAll, bool NoExecStack);
}

#endif /* MIPSELFSTREAMER_H_ */

//=== MipsELFStreamer.h - MipsELFStreamer ------------------------------===//
//
//                    The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENCE.TXT for details.
//
//===-------------------------------------------------------------------===//
#ifndef MIPSELFSTREAMER_H_
#define MIPSELFSTREAMER_H_

#include "llvm/MC/MCELFStreamer.h"

namespace llvm {
class MipsSubtarget;

class MipsELFStreamer : public MCELFStreamer {
public:
  MipsELFStreamer(MCContext &Context, MCAsmBackend &TAB,
                  raw_ostream &OS, MCCodeEmitter *Emitter,
                  bool RelaxAll, bool NoExecStack)
    : MCELFStreamer(Context, TAB, OS, Emitter), EFlags(0) {
  }

  ~MipsELFStreamer() {}
  void emitELFHeaderFlagsCG(const MipsSubtarget &Subtarget);
//  void emitELFHeaderFlagCG(unsigned Val);
};

  MCELFStreamer* createMipsELFStreamer(MCContext &Context, MCAsmBackend &TAB,
                                       raw_ostream &OS, MCCodeEmitter *Emitter,
                                       bool RelaxAll, bool NoExecStack);
}

#endif /* MIPSELFSTREAMER_H_ */

Remove unused variable (introduced in r173884) to clear clang -Werror build

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


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

#ifdef HAVE_CONFIG_H
#include <config.h>
#endif

int main(int argc, char *argv[])
{
	return 0;
}

obexd: Add skeleton for OBEX client implementation


/*
 * $Id: thinp.h,v 1.2 2001-05-17 17:58:56 thep Exp $
 * thinp.h - Thai string input sequence filtering
 * Created: 2001-05-17
 */

#ifndef THAI_THINP_H
#define THAI_THINP_H

#include <thai/thailib.h>

BEGIN_CDECL

/*
 * strictness of input sequence checking, according to WTT 2.0
 */
typedef enum {
    ISC_PASSTHROUGH = 0,
    ISC_BASICCHECK  = 1,
    ISC_STRICT      = 2
} strict_t;

/*
 * Is c2 allowed to be placed after c1?
 * Returns: non-zero if yes, 0 otherwise
 */
extern int th_iscompose(thchar_t c1, thchar_t c2, strict_t s);

/*
 * Is c2 allowed to be placed after c1? And if not, swap them.
 * Returns: non-zero if the swap happenned, 0 otherwise
 */
extern int th_validate(thchar_t *c1, thchar_t *c2, strict_t s);

END_CDECL

#endif  /* THAI_THINP_H */

/*
 * $Id: thinp.h,v 1.3 2001-05-17 18:15:04 thep Exp $
 * thinp.h - Thai string input sequence filtering
 * Created: 2001-05-17
 */

#ifndef THAI_THINP_H
#define THAI_THINP_H

#include <thai/thailib.h>

BEGIN_CDECL

/*
 * strictness of input sequence checking, according to WTT 2.0
 */
typedef enum {
    ISC_PASSTHROUGH = 0,
    ISC_BASICCHECK  = 1,
    ISC_STRICT      = 2
} strict_t;

/*
 * Is c2 allowed to be placed after c1?
 * Returns: non-zero if yes, 0 otherwise
 */
extern int th_iscompose(thchar_t c1, thchar_t c2, strict_t s);

/*
 * Is *c2 allowed to be placed after *c1? And if not, and if swapping
 * them makes it valid, do it.
 * Returns: 1 if (*c1, *c2) is a valid sequence in the first place
 *          2 if (*c1, *c2) has been swapped and the sequence becomes valid
 *          0 if (*c1, *c2) is invalid, no matter how
 */
extern int th_validate(thchar_t *c1, thchar_t *c2, strict_t s);

END_CDECL

#endif  /* THAI_THINP_H */

Change the spec (comment) of th_validate()


#if __has_include("RCTBridgeModule.h")
  #import "RCTBridgeModule.h"
#else
  #import <React/RCTBridgeModule.h>
#endif

#if __has_include("RCTEventEmitter.h")
  #import "RCTEventEmitter.h"
#else
  #import <React/RCTEventEmitter.h>
#endif

@interface KontaktBeacons : RCTEventEmitter <RCTBridgeModule>

@end

#if __has_include(<React/RCTBridgeModule.h>)
  #import <React/RCTBridgeModule.h>
#else
  #import "RCTBridgeModule.h"
#endif

#if __has_include(<React/RCTEventEmitter.h>)
  #import <React/RCTEventEmitter.h>
#else
  #import "RCTEventEmitter.h"
#endif

@interface KontaktBeacons : RCTEventEmitter <RCTBridgeModule>

@end

Fix imports for React Native 0.48.x.

Fix imports for React Native 0.48.x.


/*
 * rand_linux_kernel.c
 *
 * implements a random source using Linux kernel functions
 *
 * Marcus Sundberg
 * Ingate Systems AB
 */
/*
 *
 * Copyright(c) 2005 Ingate Systems AB
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 *
 *   Redistributions of source code must retain the above copyright
 *   notice, this list of conditions and the following disclaimer.
 *
 *   Redistributions in binary form must reproduce the above
 *   copyright notice, this list of conditions and the following
 *   disclaimer in the documentation and/or other materials provided
 *   with the distribution.
 *
 *   Neither the name of the author(s) nor the names of its
 *   contributors may be used to endorse or promote products derived
 *   from this software without specific prior written permission.
 *
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
 * COPYRIGHT HOLDERS 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 "config.h"
#include "rand_source.h"

err_status_t
rand_source_init(void) {
  return err_status_ok;
}

err_status_t
rand_source_get_octet_string(void *dest, uint32_t len) {

  get_random_bytes(dest, len);

  return err_status_ok;
}

err_status_t
rand_source_deinit(void) {
  return err_status_ok;
}

Implement a random source using Linux kernel functions.


#ifndef CLIENTVERSION_H
#define CLIENTVERSION_H

//
// client versioning and copyright year
//

// These need to be macros, as version.cpp's and bitcoin-qt.rc's voodoo requires it
#define CLIENT_VERSION_MAJOR       0
#define CLIENT_VERSION_MINOR       8
#define CLIENT_VERSION_REVISION    6
#define CLIENT_VERSION_BUILD       2

// Set to true for release, false for prerelease or test build
#define CLIENT_VERSION_IS_RELEASE  true

// Copyright year (2009-this)
// Todo: update this when changing our copyright comments in the source
#define COPYRIGHT_YEAR 2013

// Converts the parameter X to a string after macro replacement on X has been performed.
// Don't merge these into one macro!
#define STRINGIZE(X) DO_STRINGIZE(X)
#define DO_STRINGIZE(X) #X

#endif // CLIENTVERSION_H

#ifndef CLIENTVERSION_H
#define CLIENTVERSION_H

//
// client versioning and copyright year
//

// These need to be macros, as version.cpp's and bitcoin-qt.rc's voodoo requires it
#define CLIENT_VERSION_MAJOR       0
#define CLIENT_VERSION_MINOR       9
#define CLIENT_VERSION_REVISION    0
#define CLIENT_VERSION_BUILD       0

// Set to true for release, false for prerelease or test build
#define CLIENT_VERSION_IS_RELEASE  false

// Copyright year (2009-this)
// Todo: update this when changing our copyright comments in the source
#define COPYRIGHT_YEAR 2014

// Converts the parameter X to a string after macro replacement on X has been performed.
// Don't merge these into one macro!
#define STRINGIZE(X) DO_STRINGIZE(X)
#define DO_STRINGIZE(X) #X

#endif // CLIENTVERSION_H

Update the version number to 0.9 for a beta build.


// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -analyze -analyzer-checker=core -analyzer-store=region -analyzer-output=text -verify %s

// This file is for testing enhanced diagnostics produced by the default BugReporterVisitors.

int getPasswordAndItem()
{
  int err = 0;
  int *password; // expected-note {{Variable 'password' declared without an initial value}}
  if (password == 0) { // expected-warning {{The left operand of '==' is a garbage value}} // expected-note {{The left operand of '==' is a garbage value}}
    err = *password;
  }
  return err;
}

Add a test for checking that custom diagnostic visitors are working.

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


struct gcm_args {
  unsigned char* plaintext;
  unsigned int   plain_len;
  unsigned char* additional_data;
  unsigned int   additional_data_len;
  unsigned char* iv;
  unsigned char* expanded_key_ptr;
  unsigned char* ciphertext_ptr;
  unsigned char* tag_ptr;
  unsigned char* tmp_ptr;   // Should point to a buffer of (at least) 8*64 bits
};

extern void gcm_encrypt(struct gcm_args* args);

Add a small C header file to wrap our assembly.


//===--- LLVMARCOpts.h - LLVM level ARC Opts Utility Declarations ---------===//
//
// This source file is part of the Swift.org open source project
//
// Copyright (c) 2014 - 2015 Apple Inc. and the Swift project authors
// Licensed under Apache License v2.0 with Runtime Library Exception
//
// See http://swift.org/LICENSE.txt for license information
// See http://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
//
//===----------------------------------------------------------------------===//

#include "swift/Basic/LLVM.h"
#include "llvm/IR/Instructions.h"
#include "llvm/IR/Function.h"
#include "llvm/ADT/StringSwitch.h"

namespace swift {

enum RT_Kind {
  /// An instruction with this classification is known to not access (read or
  /// write) memory.
  RT_NoMemoryAccessed,

  /// SwiftHeapObject *swift_retain(SwiftHeapObject *object)
  RT_Retain,

  // void swift_retain_noresult(SwiftHeapObject *object)
  RT_RetainNoResult,

  // (i64,i64,i64) swift_retainAndReturnThree(SwiftHeapObject *obj, i64,i64,i64)
  RT_RetainAndReturnThree,

  /// void swift_release(SwiftHeapObject *object)
  RT_Release,

  /// SwiftHeapObject *swift_allocObject(SwiftHeapMetadata *metadata,
  ///                                    size_t size, size_t alignment)
  RT_AllocObject,

  /// void objc_release(%objc_object* %P)
  RT_ObjCRelease,
  /// %objc_object* objc_retain(%objc_object* %P)
  RT_ObjCRetain,

  /// This is not a runtime function that we support.  Maybe it is not a call,
  /// or is a call to something we don't care about.
  RT_Unknown,
};

/// classifyInstruction - Take a look at the specified instruction and classify
/// it into what kind of runtime entrypoint it is, if any.
inline RT_Kind classifyInstruction(const llvm::Instruction &I) {
  if (!I.mayReadOrWriteMemory())
    return RT_NoMemoryAccessed;

  // Non-calls or calls to indirect functions are unknown.
  auto *CI = dyn_cast<llvm::CallInst>(&I);
  if (CI == 0) return RT_Unknown;
  llvm::Function *F = CI->getCalledFunction();
  if (F == 0) return RT_Unknown;

  return llvm::StringSwitch<RT_Kind>(F->getName())
    .Case("swift_retain", RT_Retain)
    .Case("swift_retain_noresult", RT_RetainNoResult)
    .Case("swift_release", RT_Release)
    .Case("swift_allocObject", RT_AllocObject)
    .Case("swift_retainAndReturnThree", RT_RetainAndReturnThree)
    .Case("objc_release", RT_ObjCRelease)
    .Case("objc_retain", RT_ObjCRetain)
    .Default(RT_Unknown);
}

} // end namespace swift

Add missing file from OptimizeARC => LLVMPasses transition.

Swift SVN r21657


#include <check.h>
#include "bitfield.h"

START_TEST (test_foo)
{
    fail_unless(1 == 2);
}
END_TEST

Suite* bitfieldSuite(void) {
    Suite* s = suite_create("bitfield");
    TCase *tc_core = tcase_create("core");
    tcase_add_test(tc_core, test_foo);
    suite_add_tcase(s, tc_core);

    return s;
}

int main(void) {
    int numberFailed;
    Suite* s = bitfieldSuite();
    SRunner *sr = srunner_create(s);
    srunner_run_all(sr, CK_NORMAL);
    numberFailed = srunner_ntests_failed(sr);
    srunner_free(sr);
    return (numberFailed == 0) ? 0 : 1;
}

#include <check.h>
#include <stdint.h>
#include "bitfield.h"

START_TEST (test_size)
{
    uint8_t data = 0xFF;
    fail_unless(getBitField(&data, 0, 4) == 0xF);
}
END_TEST

Suite* bitfieldSuite(void) {
    Suite* s = suite_create("bitfield");
    TCase *tc_core = tcase_create("core");
    tcase_add_test(tc_core, test_size);
    suite_add_tcase(s, tc_core);

    return s;
}

int main(void) {
    int numberFailed;
    Suite* s = bitfieldSuite();
    SRunner *sr = srunner_create(s);
    srunner_run_all(sr, CK_NORMAL);
    numberFailed = srunner_ntests_failed(sr);
    srunner_free(sr);
    return (numberFailed == 0) ? 0 : 1;
}

Add a real test case for bitfield.

Add a real test case for bitfield.

This currently fails because we're not linking the test with the objects we want
to test. I tried adding the $(OBJS) variable to the build line, but because
those objects are all compiled with pic32-gcc it's not going to work.

I think the solution is to either:

Manually list the objects we want to recompile and link with (boo)

Compile our non-Arduino code into a static library that we link with.


/*  Author: 		Dan Wilder
 *
 *  School:		University of Missouri - St. Louis
 *  Semester:		Fall 2015
 *  Class: 		CS 3130 - Design and Analysis of Algorithms
 *  Instructor:		Galina N. Piatnitskaia
 */

#include "sort_algorithms.h"

void swap(int *x, int *y) {
  int temp = *x;
  *x = *y
  *y = temp;
}

void bubbleSort(int arr[], int size) {
/* with swaps counting.
 */
  int i, j;
  for (i = 0; i <= size-1; ++i)
    for (j = size; j >= i+1; --j)
      if (arr[j] < arr[j-1])
        swap(&arr[j], &arr[j-1]);
}

/*  Author: 		Dan Wilder
 *
 *  School:		University of Missouri - St. Louis
 *  Semester:		Fall 2015
 *  Class: 		CS 3130 - Design and Analysis of Algorithms
 *  Instructor:		Galina N. Piatnitskaia
 */

#include "sort_algorithms.h"

void swap(int *x, int *y) {
  int temp = *x;
  *x = *y
  *y = temp;
}

void bubbleSort(int arr[], int size) {
/* with swaps counting.
 */
  int i, j, swaps;

  for (i = 0; i <= size-1; ++i) {
    swaps = 0;

    for (j = size; j >= i+1; --j)
      if (arr[j] < arr[j-1]) {
        swap(&arr[j], &arr[j-1]);
        ++swaps;
      }

    if (swaps == 0)
      break;
  }
}

Add swap counting in bubbleSort

Add swap counting in bubbleSort


#ifndef ARCH_CACHE_H
#define ARCH_CACHE_H 1
#include "uuid.h"
#include "record.h"

#define ARCH_CACHE_MIN 31
typedef struct arch_cache_bucket {
  arch_uuid_t uuid;
  arch_record_t *record;
  struct arch_cache_bucket *next;
} arch_cache_bucket_t;

typedef struct arch_cache {
  struct arch_cache *old;
  size_t size, entries;
  arch_cache_bucket_t *slots[];
} arch_cache_t;

arch_record_t *arch_cache_get(arch_cache_t *cache, arch_uuid_t uuid);
bool arch_cache_set(arch_cache_t *cache, arch_record_t *record);
#endif

#ifndef ARCH_CACHE_H
#define ARCH_CACHE_H 1
#include "uuid.h"
#include "record.h"

#define ARCH_CACHE_MIN 31
typedef struct arch_cache_bucket {
  arch_uuid_t uuid;
  arch_record_t *record;
  struct arch_cache_bucket *next;
} arch_cache_bucket_t;

typedef struct arch_cache {
  struct arch_cache *old;
  size_t size, entries;
  arch_cache_bucket_t *slots[];
} arch_cache_t;

#define ARCH_CACHE_BYTES(elts) (sizeof(arch_cache_t) + sizeof(arch_cache_bucket_t) * elts)

arch_record_t *arch_cache_get(arch_cache_t *cache, arch_uuid_t uuid);
bool arch_cache_set(arch_cache_t *cache, arch_record_t *record);
#endif

Add allocation helper macro ARCH_CACHE_BYTES()


#pragma once

#include <ionMath.h>

#include "CWindow.h"
#undef CreateWindow

enum class EWindowType
{
	Fullscreen,
	Windowed
};

class CWindowManager : public Singleton<CWindowManager>, public IEventListener
{

public:

	void Init();
	void PollEvents();
	bool ShouldClose() const;
	bool Run();

	CWindow * CreateWindow(vec2i const & Size, std::string const & Title, EWindowType const Type);

protected:

	CWindow * PrimaryWindow;
	std::map<GLFWwindow *, CWindow *> Windows;

	static void KeyCallback(GLFWwindow * window, int key, int scancode, int action, int mods);
	static void MouseButtonCallback(GLFWwindow * window, int button, int action, int mods);
	static void MouseScrollCallback(GLFWwindow * window, double xoffset, double yoffset);
	static void MouseCursorCallback(GLFWwindow * window, double xpos, double ypos);
	static void CharCallback(GLFWwindow * window, unsigned int c);

private:

	friend class Singleton<CWindowManager>;
	CWindowManager();

};

#pragma once

#include <ionMath.h>

#include "CWindow.h"

enum class EWindowType
{
	Fullscreen,
	Windowed
};

class CWindowManager : public Singleton<CWindowManager>, public IEventListener
{

public:

	void Init();
	void PollEvents();
	bool ShouldClose() const;
	bool Run();

#undef CreateWindow
	CWindow * CreateWindow(vec2i const & Size, std::string const & Title, EWindowType const Type);

protected:

	CWindow * PrimaryWindow;
	std::map<GLFWwindow *, CWindow *> Windows;

	static void KeyCallback(GLFWwindow * window, int key, int scancode, int action, int mods);
	static void MouseButtonCallback(GLFWwindow * window, int button, int action, int mods);
	static void MouseScrollCallback(GLFWwindow * window, double xoffset, double yoffset);
	static void MouseCursorCallback(GLFWwindow * window, double xpos, double ypos);
	static void CharCallback(GLFWwindow * window, unsigned int c);

private:

	friend class Singleton<CWindowManager>;
	CWindowManager();

};

Move CreateWindow undef to make its purpose more clear


/******************************************************************************
 * This file is part of the Gluon Development Platform
 * Copyright (c) 2011 Laszlo Papp <lpapp@kde.org>
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
 */

#ifndef GLUON_CREATOR_VCSTOOLPLUGIN_H
#define GLUON_CREATOR_VCSTOOLPLUGIN_H

#include <creator/lib/toolplugin.h>

namespace GluonCreator
{

    class VcsToolPlugin : public ToolPlugin
    {
            Q_OBJECT
        public:
            VcsToolPlugin( QObject* parent, const QList<QVariant>& params );
            ~VcsToolPlugin();

        protected:
            QWidget* createTool( KXmlGuiWindow* parent );
    };

}

#endif // GLUON_CREATOR_MESSAGEDOCKPLUGIN_H

/******************************************************************************
 * This file is part of the Gluon Development Platform
 * Copyright (c) 2011 Laszlo Papp <lpapp@kde.org>
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
 */

#ifndef GLUON_CREATOR_VCSTOOLPLUGIN_H
#define GLUON_CREATOR_VCSTOOLPLUGIN_H

#include <creator/lib/toolplugin.h>

namespace GluonCreator
{

    class VcsToolPlugin : public ToolPlugin
    {
            Q_OBJECT
        public:
            VcsToolPlugin( QObject* parent, const QList<QVariant>& params );
            ~VcsToolPlugin();

            void initialize() {}

        protected:
            QWidget* createTool( KXmlGuiWindow* parent );
    };

}

#endif // GLUON_CREATOR_MESSAGEDOCKPLUGIN_H

Add an empty initialize implementation in order to avoid the compilation error

CCMAIL: ashwin_rajeev@hotmail.com

Commit "17496753" added a pure virtual initialize method to the plugin interface
without extending the vcstoolplugin subclass even just with an empty body, so
that is the reason why it got broken. It was not probably tested with the VCS
option enabled and kdevplatform installed.


#pragma once

#include "misc/welcome.hpp"
#include "misc/ota.hpp"

#include "Bme280Node.hpp"
#include "ContactNode.hpp"
#include "DHT22Node.hpp"
#include "RelayNode.hpp"

#pragma once

#include "misc/welcome.hpp"
#include "misc/ota.hpp"

#include "Bme280Node.hpp"
#include "ButtonNode.hpp"
#include "ContactNode.hpp"
#include "DHT22Node.hpp"
#include "RelayNode.hpp"

Include ButtonNode in header file

Include ButtonNode in header file


/* Unit tests for small utility routines.
 *
 * SCL; 2016
 */

#include <stdlib.h>

#include "common.h"
#include "tests_common.h"
#include "gr1c_util.h"

int main( int argc, char **argv )
{
    vartype bv[] = {0,1,0,1};

    if (bitvec_to_int( bv, 4 ) != 0xA) {
        ERRPRINT( "bitvec_to_int( [0,1,0,1], 4) != 0xA" );
        abort();
    }

    return 0;
}

/* Unit tests for small utility routines.
 *
 * SCL; 2016
 */

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

#include "common.h"
#include "tests_common.h"
#include "gr1c_util.h"

void print_arr( FILE *fp, vartype *arr, int len )
{
    int k;
    assert( len > 0 );
    fprintf( fp, "[" );
    for (k = 0; k < len; k++) {
        fprintf( fp, "%d", arr[k] );
        if (k < len-1)
            fprintf( fp, "," );
    }
    fprintf( fp, "]" );
}

void check_bitvec_to_int( vartype *bv, int len, int expected )
{
    if (bitvec_to_int( bv, len ) != expected) {
        ERRPRINT( "Unexpected return value of bitvec_to_int" );
        fprintf( stderr, "bitvec_to_int( " );
        print_arr( stderr, bv, len );
        fprintf( stderr, ", %d ) != 0x%X\n\n", len, expected );
        abort();
    }
}

int main( int argc, char **argv )
{
    vartype bv_A[] = {0,1,0,1};

    check_bitvec_to_int( bv_A, 4, 0xA );

    return 0;
}

TEST: Implement generic check of bitvec_to_int()


#ifndef VAST_UTIL_HASH_COMBINE_H
#define VAST_UTIL_HASH_COMBINE_H

#include <cstddef>

namespace vast {
namespace util {

// Hashes 128-bit input down to 64 bits.
// @note Taken from Google's CityHash; licence: MIT
inline size_t hash_128_to_64(size_t upper, size_t lower)
{
  static size_t const k_mul = 0x9ddfea08eb382d69ull;

  auto a = (lower ^ upper) * k_mul;
  a ^= (a >> 47);

  auto b = (upper ^ a) * k_mul;
  b ^= (b >> 47);
  b *= k_mul;

  return b;
}

/// Convenience function to combine multiple hash digests.
/// @param x The value to hash.
/// @returns The hash value of *x*.
template <typename T>
size_t hash_combine(T const& x)
{
  return std::hash<T>{}(x);
}

/// Combines multiple hash digests.
/// @param x The first value to hash.
/// @param xs The remaining values to hash and combine with *x*.
/// @returns The combined hash value of *x* and all *xs*.
template <typename T, typename... Ts>
size_t hash_combine(T const& x, Ts const&... xs)
{
  return hash_128_to_64(hash_combine(x), hash_combine(xs...));
}

} // namespace util
} // namespace vast

#endif

Add function to combine multiple hash digests.


// RUN: %llvmgcc %s -c -Os -m32 -emit-llvm -o - | llc -march=x86 -mtriple=i386-apple-darwin10 | FileCheck %s -check-prefix=DARWIN32
// RUN: %llvmgcc %s -c -Os -m64 -emit-llvm -o - | llc -march=x86_64 -mtriple=x86_64-apple-darwin10 | FileCheck %s -check-prefix=DARWIN64

extern void func(const char *, const char *);

void long_function_name() {
  func("%s: the function name", __func__);
}

// DARWIN64: .align 3
// DARWIN64: ___func__.
// DARWIN64: .asciz "long_function_name"

// DARWIN32: .align 2
// DARWIN32: ___func__.
// DARWIN32: .asciz "long_function_name"

// RUN: %llvmgcc %s -c -Os -m32 -emit-llvm -o - | llc -march=x86 -mtriple=i386-apple-darwin10 | FileCheck %s -check-prefix=DARWIN32
// RUN: %llvmgcc %s -c -Os -m64 -emit-llvm -o - | llc -march=x86-64 -mtriple=x86_64-apple-darwin10 | FileCheck %s -check-prefix=DARWIN64

extern void func(const char *, const char *);

void long_function_name() {
  func("%s: the function name", __func__);
}

// DARWIN64: .align 3
// DARWIN64: ___func__.
// DARWIN64: .asciz "long_function_name"

// DARWIN32: .align 2
// DARWIN32: ___func__.
// DARWIN32: .asciz "long_function_name"

Fix -march= name for x86-64.

Fix -march= name for x86-64.

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


#include <opencog/atomspace/AtomSpace.h>

namespace opencog
{

// This type is returned from the agent_finder_api when loading a python module
// containing agents or requests
struct requests_and_agents_t {
    std::vector<std::string> agents;
    std::vector<std::string> requests;
    std::vector<std::string> req_summary;
    std::vector<std::string> req_description;
    std::vector<bool> req_is_shell;
    std::string err_string;
};

}

Add missing include; fixes build break

Add missing include; fixes build break


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

// Exercise 5-11
#define MAX 1000

int pop(void);
void push(int n);

int main(int argc, char *argv[])
{
  while (--argc > 0 && argv++ != NULL)
  {
    printf("%s\n", *argv);
    if(*argv[0] == '+')
    {
      push(pop() + pop());
    }
    else if(*argv[0] == '-')
    {
      int x = pop();
      push(pop() - x);
    }
    // else if(*argv[0] == '*')
    // {
    //   int x = pop();
    //   push(pop() * x);
    // }
    else if(*argv[0] == '/')
    {
      int x = pop();
      push(pop() / x);
    }
    else
    {
      push(atoi(*argv));
    }
  }

  printf("%i\n", pop());
  return 0;
}

// Push & Pop Functions
static int stack[MAX];
int *sp = stack;

int pop(void)
{
  return *--sp;
}

void push(int n)
{
  *sp++ = n;
}

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

// Exercise 5-11
#define MAX 1000

int pop(void);
void push(int n);

int main(int argc, char *argv[])
{
  while (--argc > 0 && argv++ != NULL)
  {
    printf("%s\n", *argv);
    if(*argv[0] == '+')
    {
      push(pop() + pop());
    }
    else if(*argv[0] == '-')
    {
      int x = pop();
      push(pop() - x);
    }
    // * needed to be entered as '*' in the command line
    else if(*argv[0] == '*')
    {
      int x = pop();
      push(pop() * x);
    }
    else if(*argv[0] == '/')
    {
      int x = pop();
      push(pop() / x);
    }
    else
    {
      push(atoi(*argv));
    }
  }

  printf("%i\n", pop());
  return 0;
}

// Push & Pop Functions
static int stack[MAX];
int *sp = stack;

int pop(void)
{
  return *--sp;
}

void push(int n)
{
  *sp++ = n;
}

Implement Exercise 5-10 for multiplication


#ifndef _LOG_H
#define _LOG_H

#include "_global.h"

void Log(const char* format, ...);

#endif

#ifndef _LOG_H
#define _LOG_H

#include "_global.h"

#if defined(__RESHARPER__)
#define PRINTF_ATTR(FormatIndex, FirstToCheck) \
    [[gnu::format(printf, FormatIndex, FirstToCheck)]]
#elif defined(__GNUC__)
#define PRINTF_ATTR(FormatIndex, FirstToCheck) \
    __attribute__((format(printf, FormatIndex, FirstToCheck)))
#else
#define PRINTF_ATTR(FormatIndex, FirstToCheck)
#endif

PRINTF_ATTR(1, 2) void Log(const char* format, ...);

#endif

Add Resharper printf argument type checking and formatting to Log()


#define _XOPEN_SOURCE 500
#include <stdlib.h>
#include <stdio.h>
#include <unistd.h>

#include "arg.h"

char *argv0;

void usage() {
	printf("usage: %s [-t usec] [-F]\n", argv0);
	exit(EXIT_FAILURE);
}

int main(int argc, char *argv[]) {
	char		buffer;
	size_t		nread;
	useconds_t	useconds	= 1000000; // default 1 second
	unsigned int	flush		= 0;

	ARGBEGIN {
	case 't':
		useconds = atoi(EARGF(usage()));
		break;
	case 'F':
		flush = 1;
		break;
	default:
		usage();
	} ARGEND;

	while((nread = fread(&buffer, 1, sizeof buffer, stdin)) > 0) {
		usleep(useconds);
		fwrite(&buffer, 1, nread, stdout);
		if(flush) {
			fflush(stdout);
		}
	}

	return EXIT_SUCCESS;
}

#define _XOPEN_SOURCE 500
#include <stdlib.h>
#include <stdio.h>
#include <unistd.h>

#include "arg.h"

char *argv0;

void usage() {
	fprintf(stderr, "usage: %s [-t usec] [-F]\n", argv0);
	exit(EXIT_FAILURE);
}

int main(int argc, char *argv[]) {
	char		buffer;
	size_t		nread;
	useconds_t	useconds	= 1000000; // default 1 second
	unsigned int	flush		= 0;

	ARGBEGIN {
	case 't':
		useconds = atoi(EARGF(usage()));
		break;
	case 'F':
		flush = 1;
		break;
	default:
		usage();
	} ARGEND;

	while((nread = fread(&buffer, 1, sizeof buffer, stdin)) > 0) {
		usleep(useconds);
		fwrite(&buffer, 1, nread, stdout);
		if(flush) {
			fflush(stdout);
		}
	}

	return EXIT_SUCCESS;
}

Write usage() message on stderr.

Write usage() message on stderr.


int main() {
  // Issue: 3: error: empty character constant
  '';

  // Issue: 6: error: multiple characters in character constant
  'ab';
}

int main() {
  // Issue: 3: error: empty character constant
  '';

  // Issue: 6: error: multiple characters in character constant
  'ab';

  // Issue: 9: error: multiple characters in character constant
  '/*';
}

Add character string comment test

Add character string comment test


#ifndef __EULER__
#define __EULER__

#define KNRM  "\x1B[0m"
#define KRED  "\x1B[31m"
#define KGRN  "\x1B[32m"

int check(int, int, int);
void error(const char *str);

#endif

#ifndef __EULER__
#define __EULER__

#define KNRM  "\x1B[0m"
#define KRED  "\x1B[31m"
#define KGRN  "\x1B[32m"

#define min(a, b) ((a) < (b) ? (a) : (b))
#define max(a, b) ((a) > (b) ? (a) : (b))

int check(int, int, int);
void error(const char *str);

#endif

Add macros for min and max

Add macros for min and max


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

#include "spellutil.h"
#include "dictionary.h"

typedef struct word_count {
    int value;
} count;

int
parse_file(const char *filename, spell_hashtable *table)
{
    FILE *file = fopen(filename, "r");
    int _errno;
    char *line = NULL;
    size_t len = 0;
    ssize_t read;
    char *word;
    count *c;
    count default_count;
    default_count.value = 1;

    if (file == NULL) {
        _errno = errno;
        fprintf(stderr, "fopen failed for file %s", filename);
        return errno;
    }

    while ((read = getline(&line, &len, file)) != -1) {
        while ((word = strchr(line, ' ')) != NULL) {
            c = (count *) spell_hashtable_get(table, word);
            if (c == NULL) {
                spell_hashtable_add(table, word, &default_count);
            } else {
                c->value++;
                spell_hashtable_add(table, word, c);
            }
            free(line);
        }
    }
    fclose(file);
    return 0;
}

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

#include "spellutil.h"

typedef struct word_count {
    int value;
} count;

int
parse_file(const char *filename, spell_hashtable *table)
{
    FILE *file = fopen(filename, "r");
    int _errno;
    char *line = NULL;
    size_t len = 0;
    ssize_t read;
    char *word;
    count *c;
    count default_count;
    default_count.value = 1;

    if (file == NULL) {
        _errno = errno;
        fprintf(stderr, "fopen failed for file %s", filename);
        return errno;
    }

    while ((read = getline(&line, &len, file)) != -1) {
        while ((word = strchr(line, ' ')) != NULL) {
            c = (count *) spell_hashtable_get(table, word);
            if (c == NULL) {
                spell_hashtable_add(table, word, &default_count);
            } else {
                c->value++;
                spell_hashtable_add(table, word, c);
            }
            free(line);
        }
    }
    fclose(file);
    return 0;
}

Remove inclusion of a non-existing header file


#include <irq.h>

void irq_enable()
{
	__asm__ __volatile__ (
		"mrs r0, cpsr\n"
		"bic r0, r0, #0x80\n"
		"msr cpsr, r0\n"
	);
}

void irq_disable()
{
	__asm__ __volatile__ (
		"mrs r0, cpsr\n"
		"orr r0, #0xc0\n"
		"msr cpsr, r0\n"
	);
}

void handler_swi()
{
	uart0_send("In SWI!\n");
	irq_enable();
}

void handler_irq()
{
	volatile unsigned int *reg = (unsigned int *) PIC_IRQ_STATUS;

	switch (*reg) {
		case PIC_UART0_BIT:
			uart0_irq_handler();
		break;

	}
#if 0
	__asm__ __volatile__ (
		"mrs r0, cpsr\n"
		"bic r0, r0, #0x1F\n"
		"orr r0, r0, #0x12\n" // enter SVC mode
		"msr cpsr, r0\n"
		"subs pc, lr, #4\n"
	);
#endif
}

#include <irq.h>
#include <uart.h>

void (*pl190_isr_vectors[IRQ_COUNT])(void) =
{
	0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
	uart0_irq_handler,
	0, 0, 0
};

void irq_enable()
{
	__asm__ __volatile__ (
		"mrs r0, cpsr\n"
		"bic r0, r0, #0x80\n"
		"msr cpsr, r0\n"
	);
}

void irq_disable()
{
	__asm__ __volatile__ (
		"mrs r0, cpsr\n"
		"orr r0, #0xc0\n"
		"msr cpsr, r0\n"
	);
}

void handler_swi()
{
	uart0_send("In SWI!\n");
	irq_enable();
}

void handler_irq()
{
	unsigned int reg_irq_status = *((volatile unsigned int *) PIC_IRQ_STATUS);
	int irq_n = 0;

	while (reg_irq_status >>= 1)
		irq_n++;

	pl190_isr_vectors[irq_n]();

}

Remove conditional branch in IRQ handler


// RUN: %clang_cc1 -flto=thin -emit-llvm-bc < %s | llvm-bcanalyzer -dump | FileCheck %s
// CHECK: <FUNCTION_SUMMARY_BLOCK
// CHECK-NEXT: <PERMODULE_ENTRY
// CHECK-NEXT: <PERMODULE_ENTRY
// CHECK-NEXT: </FUNCTION_SUMMARY_BLOCK

__attribute__((noinline)) void foo() {}

int main() { foo(); }

// RUN: %clang_cc1 -flto=thin -emit-llvm-bc < %s | llvm-bcanalyzer -dump | FileCheck %s
// CHECK: <GLOBALVAL_SUMMARY_BLOCK
// CHECK-NEXT: <PERMODULE
// CHECK-NEXT: <PERMODULE
// CHECK-NEXT: </GLOBALVAL_SUMMARY_BLOCK

__attribute__((noinline)) void foo() {}

int main() { foo(); }

Update test case for llvm summary format changes in D17592.

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


#pragma once

#include "AbsWrapperCodec.h"
#include "AddWrapperCodec.h"
#include "BillowWrapperCodec.h"
#include "BlendWrapperCodec.h"
#include "CacheWrapperCodec.h"
#include "CheckerboardWrapperCodec.h"
#include "ClampWrapperCodec.h"
#include "ConstWrapperCodec.h"
#include "CornerCombinerBaseWrapperCodec.h"
#include "CurveWrapperCodec.h"
#include "CylindersWrapperCodec.h"
#include "DisplaceWrapperCodec.h"
#include "ExpWrapperCodec.h"
#include "ExponentWrapperCodec.h"
#include "ForwardWrapperCodec.h"
#include "InvertWrapperCodec.h"
#include "MaxWrapperCodec.h"
#include "MinWrapperCodec.h"
#include "MultiplyWrapperCodec.h"
#include "NormLPQWrapperCodec.h"
#include "NoiseSourcesCodec.h"
#include "PerlinWrapperCodec.h"
#include "PowWrapperCodec.h"
#include "PowerWrapperCodec.h"
#include "RidgedMultiWrapperCodec.h"
#include "RotatePointWrapperCodec.h"
#include "ScaleBiasWrapperCodec.h"
#include "ScalePointCodec.h"
#include "SelectWrapperCodec.h"
#include "SpheresWrapperCodec.h"
#include "TerraceWrapperCodec.h"
#include "TranslatePointWrapperCodec.h"
#include "TurbulenceWrapperCodec.h"
#include "VoronoiWrapperCodec.h"

#pragma once

#include "AbsWrapperCodec.h"
#include "AddWrapperCodec.h"
#include "BillowWrapperCodec.h"
#include "BlendWrapperCodec.h"
#include "CacheWrapperCodec.h"
#include "CheckerboardWrapperCodec.h"
#include "ClampWrapperCodec.h"
#include "ConstWrapperCodec.h"
#include "CornerCombinerBaseWrapperCodec.h"
#include "CurveWrapperCodec.h"
#include "CylindersWrapperCodec.h"
#include "DisplaceWrapperCodec.h"
#include "ExpWrapperCodec.h"
#include "ExponentWrapperCodec.h"
#include "ForwardWrapperCodec.h"
#include "GradientWrapperCodec.h"
#include "InvertWrapperCodec.h"
#include "MaxWrapperCodec.h"
#include "MinWrapperCodec.h"
#include "MultiplyWrapperCodec.h"
#include "NormLPQWrapperCodec.h"
#include "NoiseSourcesCodec.h"
#include "PerlinWrapperCodec.h"
#include "PowWrapperCodec.h"
#include "PowerWrapperCodec.h"
#include "RidgedMultiWrapperCodec.h"
#include "RotatePointWrapperCodec.h"
#include "ScaleBiasWrapperCodec.h"
#include "ScalePointCodec.h"
#include "SelectWrapperCodec.h"
#include "SpheresWrapperCodec.h"
#include "TerraceWrapperCodec.h"
#include "TranslatePointWrapperCodec.h"
#include "TurbulenceWrapperCodec.h"
#include "VoronoiWrapperCodec.h"

Add Gradient* codec header to all-codecs header


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

#ifndef WEBKIT_GLUE_WEBKIT_CONSTANTS_H_
#define WEBKIT_GLUE_WEBKIT_CONSTANTS_H_

namespace webkit_glue {

// Chromium sets the minimum interval timeout to 4ms, overriding the
// default of 10ms.  We'd like to go lower, however there are poorly
// coded websites out there which do create CPU-spinning loops.  Using
// 4ms prevents the CPU from spinning too busily and provides a balance
// between CPU spinning and the smallest possible interval timer.
const double kForegroundTabTimerInterval = 0.004;

// Provides control over the minimum timer interval for background tabs.
const double kBackgroundTabTimerInterval = 1.0;

} // namespace webkit_glue

#endif  // WEBKIT_GLUE_WEBKIT_CONSTANTS_H_

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

#ifndef WEBKIT_GLUE_WEBKIT_CONSTANTS_H_
#define WEBKIT_GLUE_WEBKIT_CONSTANTS_H_

namespace webkit_glue {

// Chromium sets the minimum interval timeout to 4ms, overriding the
// default of 10ms.  We'd like to go lower, however there are poorly
// coded websites out there which do create CPU-spinning loops.  Using
// 4ms prevents the CPU from spinning too busily and provides a balance
// between CPU spinning and the smallest possible interval timer.
const double kForegroundTabTimerInterval = 0.004;

// Provides control over the minimum timer interval for background tabs.
const double kBackgroundTabTimerInterval = 0.004;

} // namespace webkit_glue

#endif  // WEBKIT_GLUE_WEBKIT_CONSTANTS_H_

Revert 75430 because it's causing failures in dom_checker_tests.
: Increase the minimum interval for timers on background tabs to reduce
their CPU consumption.

The new interval is 1000 ms, or once per second. We can easily adjust
this value up or down, but this seems like a reasonable value to judge
the compatibility impact of this change.

BUG=66078
TEST=none (tested manually with minimal test case)

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

TBR=kbr@google.com
Review URL: http://codereview.chromium.org/6538073

git-svn-id: dd90618784b6a4b323ea0c23a071cb1c9e6f2ac7@75490 4ff67af0-8c30-449e-8e8b-ad334ec8d88c


#include <stdio.h>

#include "decode.h"
#include "event_detection.h"
#include "fast5_interface.h"
#include "homopolymer.h"
#include "kseq.h"
#include "layers.h"
#include "networks.h"
#include "nnfeatures.h"
#include "scrappie_common.h"
#include "scrappie_licence.h"
#include "scrappie_matrix.h"
#include "scrappie_seq_helpers.h"
#include "scrappie_stdlib.h"
#include "scrappie_structures.h"
#include "scrappie_subcommands.h"
#include "sse_mathfun.h"
#include "util.h"

#include "../python/pyscrap.h"

int main(void){
    return EXIT_SUCCESS;
}

#include <stdio.h>

#include "decode.h"
#include "event_detection.h"
#include "fast5_interface.h"
#include "homopolymer.h"
#include "kseq.h"
#include "layers.h"
#include "networks.h"
#include "nnfeatures.h"
#include "scrappie_common.h"
#include "scrappie_matrix.h"
#include "scrappie_seq_helpers.h"
#include "scrappie_stdlib.h"
#include "scrappie_structures.h"
#include "scrappie_subcommands.h"
#include "sse_mathfun.h"
#include "util.h"

#include "../python/pyscrap.h"

int main(void){
    return EXIT_SUCCESS;
}

Remove licence from interface test

Remove licence from interface test


#include "openflow_flowtable.h"
#include "mut.h"
#include <stdint.h>

#include "common_def.h"

extern void openflow_flowtable_set_defaults(void);
extern uint8_t openflow_flowtable_ip_compare(uint32_t ip_1, uint32_t ip_2,
        uint8_t ip_len);

TESTSUITE_BEGIN

TEST_BEGIN("Flowtable Modification")
	openflow_flowtable_init();
	ofp_flow_mod mod;
  uint16_t error_code, error_type;
  mod.flags = OFPFF_SEND_FLOW_REM;
	mod.command = OFPFC_ADD;
	mod.match.wildcards = OFPFW_ALL;
	mod.out_port = OFPP_NONE;

	openflow_flowtable_modify(&mod, &error_type, &error_code);
	openflow_flowtable_release();
TEST_END

TESTSUITE_END

#include "openflow_flowtable.h"
#include "mut.h"
#include <stdint.h>

#include "common_def.h"

extern void openflow_flowtable_set_defaults(void);
extern uint8_t openflow_flowtable_ip_compare(uint32_t ip_1, uint32_t ip_2,
        uint8_t ip_len);

TESTSUITE_BEGIN

TEST_BEGIN("Flowtable Modification")
	openflow_flowtable_init();
	ofp_flow_mod mod;
  uint16_t error_code, error_type;
  memset(&mod, 0, sizeof(ofp_flow_mod));
  mod.flags = htons(OFPFF_SEND_FLOW_REM);
	mod.command = htons(OFPFC_ADD);
	mod.match.wildcards = htons(OFPFW_ALL);
	mod.out_port = htons(OFPP_NONE);
  mod.header.length = htons(0);
  mod.priority = htons(19);

	openflow_flowtable_modify(&mod, &error_type, &error_code);
	openflow_flowtable_release();
TEST_END

TESTSUITE_END

Clean up test, use proper structuring functions


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

#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;
	std::map<BNFunctionGraphType, BNFunctionGraphType> m_ilMap;
	bool m_ilSync;
	bool m_locationSync;

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

	void toggleILSync();
	void toggleLocationSync();

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

Add some synchronization modes to reflection view along with a context menu.


/*
 * driver - driver for loading mruby source code
 */

#include <stdio.h>

#include "mruby.h"
#include "mruby/compile.h"
#include "mruby/irep.h"

/* The generated mruby bytecodes are stored in this array */
extern const char app_irep[];

int webruby_internal_run(mrb_state* mrb)
{
  mrb_load_irep(mrb, app_irep);
  return (mrb->exc == NULL) ? (0) : (1);
}

int webruby_internal_run_bytecode(mrb_state* mrb, const char *bc)
{
  mrb_load_irep(mrb, bc);
  return (mrb->exc == NULL) ? (0) : (1);
}

int webruby_internal_run_source(mrb_state* mrb, const char *s)
{
  mrb_load_string(mrb, s);
  return (mrb->exc == NULL) ? (0) : (1);
}

/*
 * driver - driver for loading mruby source code
 */

#include <stdio.h>

#include "mruby.h"
#include "mruby/compile.h"
#include "mruby/irep.h"

/* The generated mruby bytecodes are stored in this array */
extern const char app_irep[];

static int check_and_print_errors(mrb_state* mrb)
{
  if (mrb->exc) {
    mrb_p(mrb, mrb_obj_value(mrb->exc));
    return 1;
  }
  return 0;
}

int webruby_internal_run(mrb_state* mrb)
{
  mrb_load_irep(mrb, app_irep);
  return check_and_print_errors(mrb);
}

int webruby_internal_run_bytecode(mrb_state* mrb, const char *bc)
{
  mrb_load_irep(mrb, bc);
  return check_and_print_errors(mrb);
}

int webruby_internal_run_source(mrb_state* mrb, const char *s)
{
  mrb_load_string(mrb, s);
  return check_and_print_errors(mrb);
}

Print exceptions to console if exist.

Print exceptions to console if exist.


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

#include <detest/detest.h>
#include <disco/time.h>

void test_zero_milliseconds_to_timeval() {
    size_t milliseconds = 0;

    struct timeval t = milliseconds_to_timeval(milliseconds);

    expect(t.tv_sec == 0 && t.tv_usec == 0);
}

void test_one_millisecond_to_timeval() {
    size_t milliseconds = 1;

    struct timeval t = milliseconds_to_timeval(milliseconds);

    expect(t.tv_sec == 0 && t.tv_usec == 1000);
}

void test_one_thousand_milliseconds_to_timeval() {
    size_t milliseconds = 1000;

    struct timeval t = milliseconds_to_timeval(milliseconds);

    expect(t.tv_sec == 1 && t.tv_usec == 0);
}

int main() {
    add_test(test_zero_milliseconds_to_timeval);
    add_test(test_one_millisecond_to_timeval);
    add_test(test_one_thousand_milliseconds_to_timeval);

    return run_tests();
}

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

#include <detest/detest.h>
#include <disco/time.h>

void test_zero_milliseconds_to_timeval() {
    size_t milliseconds = 0;

    struct timeval t = milliseconds_to_timeval(milliseconds);

    expect(t.tv_sec == 0 && t.tv_usec == 0);
}

void test_one_millisecond_to_timeval() {
    size_t milliseconds = 1;

    struct timeval t = milliseconds_to_timeval(milliseconds);

    expect(t.tv_sec == 0 && t.tv_usec == 1000);
}

void test_one_thousand_milliseconds_to_timeval() {
    size_t milliseconds = 1000;

    struct timeval t = milliseconds_to_timeval(milliseconds);

    expect(t.tv_sec == 1 && t.tv_usec == 0);
}

void test_one_thousand_and_one_milliseconds_to_timeval() {
    size_t milliseconds = 1001;

    struct timeval t = milliseconds_to_timeval(milliseconds);

    expect(t.tv_sec == 1 && t.tv_usec == 1000);
}

int main() {
    add_test(test_zero_milliseconds_to_timeval);
    add_test(test_one_millisecond_to_timeval);
    add_test(test_one_thousand_milliseconds_to_timeval);
    add_test(test_one_thousand_and_one_milliseconds_to_timeval);

    return run_tests();
}

Add milliseconds to timeval test

Add milliseconds to timeval test


/*
 * This file is part of GreatFET
 */

#include "usb_api_dac.h"
#include "usb.h"
#include "usb_queue.h"
#include "usb_endpoint.h"

#include <stddef.h>
#include <greatfet_core.h>
#include <dac.h>
#include <pins_greatfet.h>

usb_request_status_t usb_vendor_request_dac_set(
		usb_endpoint_t* const endpoint, const usb_transfer_stage_t stage) {
	usb_endpoint_init(&usb0_endpoint_bulk_in);
	if (stage == USB_TRANSFER_STAGE_SETUP) {

		// set J2_P5 up as a DAC pin
		scu_pinmux(SCU_PINMUX_GPIO2_3, SCU_GPIO_FAST | SCU_GPIO_PUP | SCU_CONF_FUNCTION0);
		static struct gpio_t dac_pin = GPIO(2, 3);
		gpio_input(&dac_pin);

		DAC_CR = DAC_CR_VALUE(endpoint->setup.value);
		DAC_CTRL = DAC_CTRL_DMA_ENA(1);

		usb_transfer_schedule_ack(endpoint->in);
	}
	return USB_REQUEST_STATUS_OK;
}

/*
 * This file is part of GreatFET
 */

#include "usb_api_dac.h"
#include "usb.h"
#include "usb_queue.h"
#include "usb_endpoint.h"

#include <stddef.h>
#include <greatfet_core.h>
#include <dac.h>
#include <pins.h>

usb_request_status_t usb_vendor_request_dac_set(
		usb_endpoint_t* const endpoint, const usb_transfer_stage_t stage) {
	usb_endpoint_init(&usb0_endpoint_bulk_in);
	if (stage == USB_TRANSFER_STAGE_SETUP) {

		// set J2_P5 up as a DAC pin
		scu_pinmux(SCU_PINMUX_GPIO2_3, SCU_GPIO_FAST | SCU_GPIO_PUP | SCU_CONF_FUNCTION0);
		static struct gpio_t dac_pin = GPIO(2, 3);
		gpio_input(&dac_pin);

		DAC_CR = DAC_CR_VALUE(endpoint->setup.value) && DAC_CR_VALUE_MASK;
		DAC_CTRL = DAC_CTRL_DMA_ENA(1);

		usb_transfer_schedule_ack(endpoint->in);
	}
	return USB_REQUEST_STATUS_OK;
}

Fix wrong pins header from being included, add mask to DAC control register


#include "image.h"

#include <inttypes.h>

static unsigned char* read_pgm(const char* filename, size_t* width, size_t* height, size_t* nimages) {
	*nimages = 1;
	unsigned char* image = NULL;
	FILE* f = strcmp(filename,"-") ? fopen(filename,"r") : stdin;
	uint16_t depth;
	if(
		f &&
		fscanf(f,"P5 %zu %zu %" PRIu16,width,height,&depth) == 3 &&
		fgetc(f) != EOF &&
		depth < 256 &&
		*width && *height &&
		!(*width > PIXEL_MAX / *height) &&
		(image = malloc(*width * *height)) &&
		fread(image,1,*width * *height,f) == *width * *height
	)
		return image;
	free(image);
	return NULL;
}

struct image_reader resdet_image_reader_pgm = {
	.read = read_pgm
};

#include "image.h"

#include <inttypes.h>

static unsigned char* read_pgm(const char* filename, size_t* width, size_t* height, size_t* nimages) {
	*nimages = 1;
	unsigned char* image = NULL;
	FILE* f = strcmp(filename,"-") ? fopen(filename,"r") : stdin;
	uint16_t depth;
	if(
		f &&
		fscanf(f,"P5 %zu %zu %" SCNu16,width,height,&depth) == 3 &&
		fgetc(f) != EOF &&
		depth < 256 &&
		*width && *height &&
		!(*width > PIXEL_MAX / *height) &&
		(image = malloc(*width * *height)) &&
		fread(image,1,*width * *height,f) == *width * *height
	)
		return image;
	free(image);
	return NULL;
}

struct image_reader resdet_image_reader_pgm = {
	.read = read_pgm
};

Use proper u16 macro for scanf

Use proper u16 macro for scanf

The PRIu16 macro only guarantees that the resulting conversion
specifier will be suitable for printing, not scanning.
SCNu16 provides the appropriate specifier for the latter.

Some libcs define PRIu16 to just "%u" rather than defining both as
"%hu", which is makes sense but results in undefined behavior when
used with scanf.


/**
 * @file       BlynkWidgets.h
 * @author     Volodymyr Shymanskyy
 * @license    This project is released under the MIT License (MIT)
 * @copyright  Copyright (c) 2015 Volodymyr Shymanskyy
 * @date       Mar 2015
 * @brief
 */

#include "WidgetLED.h"
#include "WidgetLCD.h"
//#include <WidgetTerminal.h> // No Print.h on Spark?
#include "WidgetBridge.h"
// Cannot auto-include WidgetSD, as it has library dependency

/**
 * @file       BlynkWidgets.h
 * @author     Volodymyr Shymanskyy
 * @license    This project is released under the MIT License (MIT)
 * @copyright  Copyright (c) 2015 Volodymyr Shymanskyy
 * @date       Mar 2015
 * @brief
 */

#include "WidgetLED.h"
#include "WidgetLCD.h"
#include "WidgetTerminal.h"
#include "WidgetBridge.h"
// Cannot auto-include WidgetSD, as it has library dependency

Add terminal to common widgets

Add terminal to common widgets


#ifndef _NPY_PRIVATE_BUFFER_H_
#define _NPY_PRIVATE_BUFFER_H_

#ifdef NPY_ENABLE_MULTIPLE_COMPILATION
extern NPY_NO_EXPORT PyBufferProcs array_as_buffer;
#else
NPY_NO_EXPORT PyBufferProcs array_as_buffer;
#endif

#endif

#ifndef _NPY_PRIVATE_BUFFER_H_
#define _NPY_PRIVATE_BUFFER_H_

#ifdef NPY_ENABLE_SEPARATE_COMPILATION
extern NPY_NO_EXPORT PyBufferProcs array_as_buffer;
#else
NPY_NO_EXPORT PyBufferProcs array_as_buffer;
#endif

#endif

Fix mispelled separate compilation macro.

git-svn-id: 77a43f9646713b91fea7788fad5dfbf67e151ece@6965 94b884b6-d6fd-0310-90d3-974f1d3f35e1


/*
Copyright (c) 2008, Stig Brautaset. All rights reserved.

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

  * Redistributions of source code must retain the above copyright notice,
    this list of conditions and the following disclaimer.

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

  * Neither the name of the author nor the names of its contributors may be
    used to endorse or promote products derived from this software without
    specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER 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.
*/

#import <Statistics/SBStatistics.h>

/*
Copyright (c) 2008, Stig Brautaset. All rights reserved.

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

  * Redistributions of source code must retain the above copyright notice,
    this list of conditions and the following disclaimer.

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

  * Neither the name of the author nor the names of its contributors may be
    used to endorse or promote products derived from this software without
    specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER 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.
*/

#import "SBStatistics.h"

Fix for include path slighlty incorrect

Fix for include path slighlty incorrect


/* The Halfling Project - A Graphics Engine and Projects
 *
 * The Halfling Project is the legal property of Adrian Astley
 * Copyright Adrian Astley 2013
 */

#ifndef GAME_STATE_MANAGER_H
#define GAME_STATE_MANAGER_H

namespace Common {

class GameStateManagerBase
{
public:
	virtual bool Initialize() = 0;
	virtual void Shutdown() = 0;
	/**
	 * Return the wanted period of time between update() calls.
	 *
	 * IE: If you want update to be called 20 times a second, this
	 * should return 50.
	 *
	 * NOTE: This should probably be inlined.
	 * NOTE: This will only be called at the beginning of HalflingEngine::Run()
	 * TODO: Contemplate the cost/benefit of calling this once per frame
	 *
	 * @return    The period in milliseconds
	 */
	virtual double GetUpdatePeriod() = 0;
	/**
	 * Called every time the game logic should be updated. The frequency
	 * of this being called is determined by getUpdatePeriod()
	 */
	virtual void Update() = 0;
	virtual void GamePaused() = 0;
	virtual void GameUnpaused() = 0;
};

} // End of namespace Common

#endif

/* The Halfling Project - A Graphics Engine and Projects
 *
 * The Halfling Project is the legal property of Adrian Astley
 * Copyright Adrian Astley 2013
 */

#ifndef GAME_STATE_MANAGER_H
#define GAME_STATE_MANAGER_H

namespace Common {

class GameStateManagerBase
{
public:
	virtual bool Initialize() = 0;
	virtual void Shutdown() = 0;
	/**
	 * Return the wanted period of time between update() calls.
	 *
	 * IE: If you want update to be called 20 times a second, this
	 * should return 50.
	 *
	 * NOTE: This should probably be inlined.
	 * NOTE: This will only be called at the beginning of HalflingEngine::Run()
	 * TODO: Contemplate the cost/benefit of calling this once per frame
	 *
	 * @return    The period in milliseconds
	 */
	virtual double GetUpdatePeriod() = 0;
	/**
	 * Called every time the game logic should be updated. The frequency
	 * of this being called is determined by getUpdatePeriod()
	 */
	virtual void Update() = 0;

	virtual void OnResize(int newClientWidth, int newClientHeight) = 0;

	virtual void GamePaused() = 0;
	virtual void GameUnpaused() = 0;

	virtual void MouseDown(WPARAM buttonState, int x, int y) = 0;
	virtual void MouseUp(WPARAM buttonState, int x, int y) = 0;
	virtual void MouseMove(WPARAM buttonState, int x, int y) = 0;
	virtual void MouseWheel(int zDelta) = 0;
};

} // End of namespace Common

#endif

COMMON: Add virtual functions to handle mouse movments and Resize


#pragma once

/// Tags the current test case if the specified condition is true. If any tags
/// are specified after the condition, those will be used. Otherwise, a string
/// version of the condition itself will be used as the tag.
#define RC_CLASSIFY(condition, ...)                                            \
  do {                                                                         \
    if (condition) {                                                           \
      detail::classify(#condition, {__VA_ARGS__});                             \
    }                                                                          \
  } while (false)

/// Tags the current test case with the given values which will be converted to
/// strings.
#define RC_TAG(...) detail::tag({__VA_ARGS__})

#include "Classify.hpp"

#pragma once

/// Tags the current test case if the specified condition is true. If any tags
/// are specified after the condition, those will be used. Otherwise, a string
/// version of the condition itself will be used as the tag.
#define RC_CLASSIFY(condition, ...)                                            \
  do {                                                                         \
    if (condition) {                                                           \
      ::rc::detail::classify(#condition, {__VA_ARGS__});                       \
    }                                                                          \
  } while (false)

/// Tags the current test case with the given values which will be converted to
/// strings.
#define RC_TAG(...) ::rc::detail::tag({__VA_ARGS__})

#include "Classify.hpp"

Fix missing namespace qualification in classify macros


/**
    Copyright (c) 2017 Ryan Porter
    You may use, distribute, or modify this code under the terms of the MIT license.
*/

#ifndef POLY_CHECKSUM_H
#define POLY_CHECKSUM_H

// based on code found at http://www.relisoft.com/science/CrcOptim.html

class PolyChecksum
{
public:
                        PolyChecksum();
    virtual void        putBytes(void* bytes, size_t dataSize);
    virtual int         getResult();

public:
	unsigned long       _table[256];
	unsigned long       _register = 0;
	unsigned long       _key = 0x04c11db7;
};

#endif

/**
    Copyright (c) 2017 Ryan Porter
    You may use, distribute, or modify this code under the terms of the MIT license.
*/

#ifndef POLY_CHECKSUM_H
#define POLY_CHECKSUM_H

#include <cstddef>

// based on code found at http://www.relisoft.com/science/CrcOptim.html

class PolyChecksum
{
public:
                        PolyChecksum();
    virtual void        putBytes(void* bytes, size_t dataSize);
    virtual int         getResult();

public:
	unsigned long       _table[256];
	unsigned long       _register = 0;
	unsigned long       _key = 0x04c11db7;
};

#endif

Add include required to compile on linux.