//
//  BRScrollerUtilities.h
//  BRScroller
//
//  Created by Matt on 7/11/13.
//  Copyright (c) 2013 Blue Rocket. Distributable under the terms of the Apache License, Version 2.0.
//

#ifndef BRScroller_BRScrollerUtilities_h
#define BRScroller_BRScrollerUtilities_h

#include <CoreFoundation/CoreFoundation.h>
#include <QuartzCore/QuartzCore.h>

bool BRFloatsAreEqual(CGFloat a, CGFloat b);

CGSize BRAspectSizeToFit(CGSize size, CGSize maxSize);

#endif

//
//  BRScrollerUtilities.h
//  BRScroller
//
//  Created by Matt on 7/11/13.
//  Copyright (c) 2013 Blue Rocket. Distributable under the terms of the Apache License, Version 2.0.
//

#ifndef BRScroller_BRScrollerUtilities_h
#define BRScroller_BRScrollerUtilities_h

#include <CoreGraphics/CoreGraphics.h>

bool BRFloatsAreEqual(CGFloat a, CGFloat b);

CGSize BRAspectSizeToFit(CGSize size, CGSize maxSize);

#endif

Fix import to what's actually needed.

Fix import to what's actually needed.


#include "dirent.h"

typedef DIR* DIRptr;
typedef struct dirent* direntptr;

#define chpl_rt_direntptr_getname(x) ((x)->d_name)

//
// Note: This is not portable; more generally, need to use lstat() or similar;
// see the readdir() man page for notes
//
#define chpl_rt_direntptr_isDir(x)   ((x)->d_type == DT_DIR)

#include "dirent.h"

typedef DIR* DIRptr;

#ifndef __USE_FILE_OFFSET64
typedef struct dirent* direntptr;
#else
#ifdef __REDIRECT
typedef struct dirent* direntptr;
#else
typedef struct dirent64* direntptr;
#endif
#endif

#define chpl_rt_direntptr_getname(x) ((x)->d_name)

//
// Note: This is not portable; more generally, need to use lstat() or similar;
// see the readdir() man page for notes
//
#define chpl_rt_direntptr_isDir(x)   ((x)->d_type == DT_DIR)

Make the filerator test more portable

Make the filerator test more portable

For some reason that I haven't been able to determine, the return type of
readdir() is sometimes dirent64* rather than dirent* as all the man pages and
documentation that I can find suggest.  This happens with prgenv-pgi and
prgenv-cray compilers for example.  Here, I'm guarding our typedef of
'direntptr' for Chapel's use with a similar #ifndef structure as the
/usr/lib/dirent.h file to make this test work on our current systems.  This is
likely be something that we need to understand and resolve better before
putting a filerator into our standard libraries, though... :(

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


//===- llvm/TableGen/TableGenBackend.h - Backend utilities ------*- C++ -*-===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
//
// Useful utilities for TableGen backends.
//
//===----------------------------------------------------------------------===//

#ifndef LLVM_TABLEGEN_TABLEGENBACKEND_H
#define LLVM_TABLEGEN_TABLEGENBACKEND_H

#include "llvm/ADT/StringRef.h"

namespace llvm {

class raw_ostream;

/// emitSourceFileHeader - Output an LLVM style file header to the specified
/// raw_ostream.
void emitSourceFileHeader(StringRef Desc, raw_ostream &OS);

} // End llvm namespace

#endif

//===- llvm/TableGen/TableGenBackend.h - Backend utilities ------*- C++ -*-===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
//
// Useful utilities for TableGen backends.
//
//===----------------------------------------------------------------------===//

#ifndef LLVM_TABLEGEN_TABLEGENBACKEND_H
#define LLVM_TABLEGEN_TABLEGENBACKEND_H

namespace llvm {

class StringRef;
class raw_ostream;

/// emitSourceFileHeader - Output an LLVM style file header to the specified
/// raw_ostream.
void emitSourceFileHeader(StringRef Desc, raw_ostream &OS);

} // End llvm namespace

#endif

[TableGen] Remove unnecessary include and just forward declare. NFC

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


/* Copyright (c) 2011, Jon Maken
 * License: 3-clause BSD
 * Revision: 11/26/2011 7:57:44 PM
 */

#if defined(_WIN32)
#  define TMA_CAPI(type) extern "C" __declspec(dllexport) type
#else
#  define TMA_CAPI(type) extern "C" type
#endif

Add custom code timing DLLs header

Add custom code timing DLLs header


// UIKitExtensions
//
// UIKitExtensions/UIView/Framing.h
//
// Copyright (c) 2013 Stanislaw Pankevich
// Released under the MIT license
//
// Inspired by FrameAccessor
// https://github.com/AlexDenisov/FrameAccessor/

#import <UIKit/UIKit.h>

@interface UIView (Framing)

@property CGPoint viewOrigin;
@property CGSize  viewSize;

@property CGFloat x;
@property CGFloat y;
@property CGFloat height;
@property CGFloat width;

@property CGFloat centerX;
@property CGFloat centerY;

@end

// UIKitExtensions
//
// UIKitExtensions/UIView/Framing.h
//
// Copyright (c) 2013 Stanislaw Pankevich
// Released under the MIT license
//
// Inspired by FrameAccessor
// https://github.com/AlexDenisov/FrameAccessor/

#import <UIKit/UIKit.h>

@interface UIView (Framing)

// http://stackoverflow.com/questions/16118106/uitextview-strange-text-clipping
// https://github.com/genericspecific/CKUITools/issues/8
@property CGPoint viewOrigin;
@property CGSize  viewSize;

@property CGFloat x;
@property CGFloat y;
@property CGFloat height;
@property CGFloat width;

@property CGFloat centerX;
@property CGFloat centerY;

@end

Add links to original problem

Add links to original problem


#ifndef TENYR_VPI_
#define TENYR_VPI_

#include <vpi_user.h>

struct tenyr_sim_state;

typedef int tenyr_sim_cb(p_cb_data data);
typedef int tenyr_sim_call(struct tenyr_sim_state *state, void *userdata);

struct tenyr_sim_state {
    struct {
        tenyr_sim_call *genesis;      ///< beginning of sim
        tenyr_sim_call *posedge;      ///< rising  edge of clock
        tenyr_sim_call *negedge;      ///< falling edge of clock
        tenyr_sim_call *apocalypse;   ///< end of sim
    } cb;
    struct {
        struct {
            vpiHandle genesis, apocalypse;
        } cb;
        struct {
            vpiHandle tenyr_load;
            vpiHandle tenyr_putchar;
#if 0
			// XXX this code is not tenyr-correct -- it can block
            vpiHandle tenyr_getchar;
#endif
        } tf;
    } handle;
    void *extstate; ///< external state possibly used by tenyr_sim_cb's
};

#endif

Mend incorrect whitespace from 3103a58

Mend incorrect whitespace from 3103a58


#pragma once
#include <stdio.h>

#ifdef __cplusplus
extern "C" {
#endif

enum Turbo_Type {TJ_Error, TJ_String, TJ_Number, TJ_Object, TJ_Array, TJ_Boolean, TJ_Null};

struct Turbo_Value{
    enum Turbo_Type type;
    unsigned length;
    union{
        double number;
        int boolean;
        const char *string;
        struct Turbo_Value *array;
        struct Turbo_Property *object;
        struct Turbo_Error *error;
    } value;
};

const char *Turbo_Value(struct Turbo_Value * __restrict__ to, const char *in, const char *const end);
void Turbo_WriteValue(struct Turbo_Value *that, FILE *out, int level);

#ifdef __cplusplus
}
#endif

#pragma once
#include <stdio.h>

#ifdef _MSC_VER
#define __restrict__ __restrict
#elif defined __WATCOMC__
#define __restrict__
#endif

#ifdef __cplusplus
extern "C" {
#endif

enum Turbo_Type {TJ_Error, TJ_String, TJ_Number, TJ_Object, TJ_Array, TJ_Boolean, TJ_Null};

struct Turbo_Value{
    enum Turbo_Type type;
    unsigned length;
    union{
        double number;
        int boolean;
        const char *string;
        struct Turbo_Value *array;
        struct Turbo_Property *object;
        struct Turbo_Error *error;
    } value;
};

const char *Turbo_Value(struct Turbo_Value * __restrict__ to, const char *in, const char *const end);
void Turbo_WriteValue(struct Turbo_Value *that, FILE *out, int level);

#ifdef __cplusplus
}
#endif

Handle restrict on Windows compilers

Handle restrict on Windows compilers


/* Copyright (c) 2012 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.
 *
 * This file has compile assertions for the sizes of types that are dependent
 * on the architecture for which they are compiled (i.e., 32-bit vs 64-bit).
 */

#ifndef PPAPI_TESTS_ARCH_DEPENDENT_SIZES_64_H_
#define PPAPI_TESTS_ARCH_DEPENDENT_SIZES_64_H_

#include "ppapi/tests/test_struct_sizes.c"

PP_COMPILE_ASSERT_SIZE_IN_BYTES(GLintptr, 8);
PP_COMPILE_ASSERT_SIZE_IN_BYTES(GLsizeiptr, 8);
PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_CompletionCallback_Func, 8);
PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_URLLoaderTrusted_StatusCallback, 8);
PP_COMPILE_ASSERT_STRUCT_SIZE_IN_BYTES(PP_CompletionCallback, 24);
PP_COMPILE_ASSERT_SIZE_IN_BYTES(PPB_VideoDecoder_Dev, 64);
PP_COMPILE_ASSERT_SIZE_IN_BYTES(PPP_VideoDecoder_Dev, 32);

#endif  /* PPAPI_TESTS_ARCH_DEPENDENT_SIZES_64_H_ */

/* Copyright (c) 2012 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.
 *
 * This file has compile assertions for the sizes of types that are dependent
 * on the architecture for which they are compiled (i.e., 32-bit vs 64-bit).
 */

#ifndef PPAPI_TESTS_ARCH_DEPENDENT_SIZES_64_H_
#define PPAPI_TESTS_ARCH_DEPENDENT_SIZES_64_H_

#include "ppapi/tests/test_struct_sizes.c"

// TODO(jschuh): Resolve ILP64 to LLP64 issue. crbug.com/177779
#if !defined(_WIN64)
PP_COMPILE_ASSERT_SIZE_IN_BYTES(GLintptr, 8);
PP_COMPILE_ASSERT_SIZE_IN_BYTES(GLsizeiptr, 8);
#endif
PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_CompletionCallback_Func, 8);
PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_URLLoaderTrusted_StatusCallback, 8);
PP_COMPILE_ASSERT_STRUCT_SIZE_IN_BYTES(PP_CompletionCallback, 24);
PP_COMPILE_ASSERT_SIZE_IN_BYTES(PPB_VideoDecoder_Dev, 64);
PP_COMPILE_ASSERT_SIZE_IN_BYTES(PPP_VideoDecoder_Dev, 32);

#endif  /* PPAPI_TESTS_ARCH_DEPENDENT_SIZES_64_H_ */

Disable GL sizes PPAPI tests

Disable GL sizes PPAPI tests

The wrong size is defined for Win64. It needs a real fix, but first I need to unblock the builder.

BUG=177779

Review URL: https://chromiumcodereview.appspot.com/12310080

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


/* $Id$ */
/* Copyright (c) 2006 The DeforaOS Project */

#include "../syscalls.h"
#include "sys/utsname.h"

/* uname */
#ifndef __NetBSD__
syscall1(int, uname, struct utsname *, utsname);
#endif

/* $Id$ */
/* Copyright (c) 2007 The DeforaOS Project */

#include "../syscalls.h"
#include "sys/utsname.h"

/* uname */
#if !defined(__NetBSD__) || defined(NETBSD_USE_LINUX_EMULATION)
syscall1(int, uname, struct utsname *, utsname);
#endif

Allow uname() with linux emulation on NetBSD


#import <ResearchKit/ResearchKit.h>

@class CMHLoginViewController;

@protocol CMHLoginViewControllerDelegate <NSObject>
@optional
- (void)loginViewControllerCancelled:(CMHLoginViewController *_Nonnull)viewController;
- (void)loginViewController:(CMHLoginViewController *_Nonnull)viewController didLogin:(BOOL)success error:(NSError *_Nullable)error;
@end

@interface CMHLoginViewController : ORKTaskViewController

- (_Nonnull instancetype)initWithTitle:(NSString *_Nullable)title text:(NSString *_Nullable)text delegate:(id<CMHLoginViewControllerDelegate>)delegate;

@property (weak, nonatomic, nullable) id<CMHLoginViewControllerDelegate> loginDelegate;

- (instancetype)initWithTask:(nullable id<ORKTask>)task taskRunUUID:(nullable NSUUID *)taskRunUUID NS_UNAVAILABLE;
- (instancetype)initWithCoder:(NSCoder *)aDecoder NS_UNAVAILABLE;
- (instancetype)initWithNibName:(nullable NSString *)nibNameOrNil bundle:(nullable NSBundle *)nibBundleOrNil NS_UNAVAILABLE;
- (instancetype)initWithTask:(nullable id<ORKTask>)task restorationData:(nullable NSData *)data delegate:(nullable id<ORKTaskViewControllerDelegate>)delegate NS_UNAVAILABLE;

@end

#import <ResearchKit/ResearchKit.h>

@class CMHLoginViewController;

@protocol CMHLoginViewControllerDelegate <NSObject>
@optional
- (void)loginViewControllerCancelled:(CMHLoginViewController *_Nonnull)viewController;
- (void)loginViewController:(CMHLoginViewController *_Nonnull)viewController didLogin:(BOOL)success error:(NSError *_Nullable)error;
@end

@interface CMHLoginViewController : ORKTaskViewController

- (_Nonnull instancetype)initWithTitle:(NSString *_Nullable)title text:(NSString *_Nullable)text delegate:(_Nullable id<CMHLoginViewControllerDelegate>)delegate;

@property (weak, nonatomic, nullable) id<CMHLoginViewControllerDelegate> loginDelegate;

- (_Null_unspecified instancetype)initWithTask:(nullable id<ORKTask>)task taskRunUUID:(nullable NSUUID *)taskRunUUID NS_UNAVAILABLE;
- (_Null_unspecified instancetype)initWithCoder:(NSCoder *_Null_unspecified)aDecoder NS_UNAVAILABLE;
- (_Null_unspecified instancetype)initWithNibName:(nullable NSString *)nibNameOrNil bundle:(nullable NSBundle *)nibBundleOrNil NS_UNAVAILABLE;
- (_Null_unspecified instancetype)initWithTask:(nullable id<ORKTask>)task restorationData:(nullable NSData *)data delegate:(nullable id<ORKTaskViewControllerDelegate>)delegate NS_UNAVAILABLE;

@end

Add nullability annotations to the custom login view controller's public interface


#pragma once

#include "ionTypes.h"

#include <algorithm>
#include <numeric>
#include <iomanip>
#include <iostream>
#include <fstream>
#include <sstream>

using std::move;
using std::ifstream;

template <typename T, typename U>
U * ConditionalMapAccess(map<T, U *> & Map, T const Key)
{
	auto Iterator = Map.find(Key);

	if (Iterator != Map.end())
		return Iterator->second;

	return 0;
}

class File
{

public:

	static bool Exists(string const & FileName)
	{
	  ifstream ifile(FileName);
	  return ifile.good();
	}

	static string && ReadAsString(string const & FileName)
	{
		std::ifstream t(FileName);
		std::string str;

		t.seekg(0, std::ios::end);
		str.reserve((uint) t.tellg());
		t.seekg(0, std::ios::beg);

		str.assign((std::istreambuf_iterator<char>(t)), std::istreambuf_iterator<char>());

		return move(str);
	}
};

#pragma once

#include "ionTypes.h"

#include <algorithm>
#include <numeric>
#include <iomanip>
#include <iostream>
#include <fstream>
#include <sstream>

using std::move;
using std::ifstream;

template <typename T, typename U>
U * ConditionalMapAccess(map<T, U *> & Map, T const Key)
{
	auto Iterator = Map.find(Key);

	if (Iterator != Map.end())
		return Iterator->second;

	return 0;
}

class File
{

public:

	static bool Exists(string const & FileName)
	{
	  ifstream ifile(FileName);
	  return ifile.good();
	}

	static string ReadAsString(string const & FileName)
	{
		std::ifstream t(FileName);
		std::string str;

		t.seekg(0, std::ios::end);
		str.reserve((uint) t.tellg());
		t.seekg(0, std::ios::beg);

		str.assign((std::istreambuf_iterator<char>(t)), std::istreambuf_iterator<char>());

		return str;
	}
};

Fix inappropriate move in ReadAsString

Fix inappropriate move in ReadAsString

--HG--
branch : SceneOverhaul


//-------------------------------------------------------------------------------------------------------
// Copyright (C) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE.txt file in the project root for full license information.
//-------------------------------------------------------------------------------------------------------
// NOTE: If there is a merge conflict the correct fix is to make a new GUID.
// This file was generated with tools\update_bytecode_version.ps1

// {81AEEA4B-AE4E-40C0-848F-6DB7C5F49F55}
const GUID byteCodeCacheReleaseFileVersion =
{ 0x81AEEA4B, 0xAE4E, 0x40C0, { 0x84, 0x8F, 0x6D, 0xB7, 0xC5, 0xF4, 0x9F, 0x55 } };

Update byte code ID for InitConst change


/*******************************************************************
**
** Manage system call mode and do remote system calls.
**
*******************************************************************/

#define _POSIX_SOURCE
#include <stdio.h>
#include "condor_syscall_mode.h"

static int		SyscallMode = 1; /* LOCAL and UNMAPPED */

int
SetSyscalls( int mode )
{
	int	answer;
	answer = SyscallMode;
	SyscallMode = mode;
	return answer;
}

BOOL
LocalSysCalls()
{
	return SyscallMode & SYS_LOCAL;
}

BOOL
RemoteSysCalls()
{
	return (SyscallMode & SYS_LOCAL) == 0;
}

BOOL
MappingFileDescriptors()
{
	return (SyscallMode & SYS_MAPPED);
}

#if defined(AIX32)	/* Just to test linking */
int syscall( int num, ... )
{
	return 0;
}
#endif

/*******************************************************************
**
** Manage system call mode and do remote system calls.
**
*******************************************************************/

#define _POSIX_SOURCE
#include "condor_common.h"
#include "condor_debug.h"
#include "condor_syscall_mode.h"

static int		SyscallMode = 1; /* LOCAL and UNMAPPED */

int
SetSyscalls( int mode )
{
	int	answer;
	answer = SyscallMode;
	SyscallMode = mode;
	return answer;
}

BOOL
LocalSysCalls()
{
	return SyscallMode & SYS_LOCAL;
}

BOOL
RemoteSysCalls()
{
	return (SyscallMode & SYS_LOCAL) == 0;
}

BOOL
MappingFileDescriptors()
{
	return (SyscallMode & SYS_MAPPED);
}

void
DisplaySyscallMode()
{
	dprintf( D_ALWAYS,
		"Syscall Mode is: %s %s\n",
		RemoteSysCalls() ? "REMOTE" : "LOCAL",
		MappingFileDescriptors() ? "MAPPED" : "UNMAPPED"
	);
}

#if defined(AIX32)	/* Just to test linking */
int syscall( int num, ... )
{
	return 0;
}
#endif

Add DisplaySyscallMode() routine for debugging.


//
//  SWXMLDateMapping.h
//  This file is part of the "SWXMLMapping" project, and is distributed under the MIT License.
//
//  Created by Samuel Williams on 13/11/05.
//  Copyright 2005 Samuel Williams. All rights reserved.
//

#import "SWXMLMemberMapping.h"

@class SWXMLMemberMapping;

@interface SWXMLDateMapping : SWXMLMemberMapping {

}

@end

//
//  SWXMLDateMapping.h
//  This file is part of the "SWXMLMapping" project, and is distributed under the MIT License.
//
//  Created by Samuel Williams on 13/11/05.
//  Copyright 2005 Samuel Williams. All rights reserved.
//

#import "SWXMLMemberMapping.h"

@class SWXMLMemberMapping;

// Formats value attribute according to ISO8601 (http://www.w3.org/TR/NOTE-datetime)
@interface SWXMLDateMapping : SWXMLMemberMapping {

}

@end

Comment regarding value serialization of date.


// https://github.com/goblint/analyzer/issues/231#issuecomment-868369123
int main(void) {
  int x = 0;
  while(1) {
    while(1) {
      x++;
    }
    x--;
  }
  x--;
  return x;
}

Add nested infinite loops test

Add nested infinite loops test


#include <stddef.h>

int main() {
  int *r; // rand

  if (r == NULL)
    assert(r == NULL);
  else
    assert(r != NULL); // TODO

  if (r != NULL)
    assert(r != NULL);
  else
    assert(r == NULL); // TODO

  return 0;
}

Add test for NULL pointer invariant refinement


#include <stdio.h>

#define INPUTS 3
#define HIDDEN 5
#define OUTPUTS 2
#define ROWS 5

typedef struct {
    double input[HIDDEN][INPUTS];
    double hidden[ROWS - 3][HIDDEN][HIDDEN];
    double output[OUTPUTS][HIDDEN];
} Links;

typedef struct {
    Links weights;
} ANN;

int main(void)
{
    return 0;
}

#include <stdio.h>

#define INPUTS 3
#define HIDDEN 5
#define OUTPUTS 2
#define ROWS 5

typedef struct {
    double input[HIDDEN][INPUTS];
    double hidden[ROWS - 3][HIDDEN][HIDDEN];
    double output[OUTPUTS][HIDDEN];
} Links;

typedef struct {
    int input[INPUTS];
    int hidden[HIDDEN];
    int output[OUTPUTS];
} Neurons;

typedef struct {
    Links weights;
    Neurons values;
} ANN;

int main(void)
{
    return 0;
}

Allow neuron values (outputs) to be stored


/*
 * free.h
 * Memory usage utility for Darwin & MacOS X (similar to 'free' under Linux)
 *
 * by:  David Cantrell <david.l.cantrell@gmail.com>
 * Copyright (C) 2008, David Cantrell, Honolulu, HI, USA.
 *
 * Licensed under the GNU Lesser General Public License version 2.1 or later.
 * See COPYING.LIB for licensing details.
 */

#define FREE_USAGE "Usage: %s [-b|-k|-m] [-s delay] [-V] [-h|-?]\n"
#define COMBINED_UNIT_OPTIONS "You may only use one of the unit options:  -b, -k, or -m\n"

enum { BYTES, KILOBYTES, MEGABYTES };

typedef struct mem {
    uint64_t total;
    uint64_t used;
    uint64_t free;
    uint64_t active;
    uint64_t inactive;
    uint64_t wired;
} mem_t;

/*
 * free.h
 * Memory usage utility for Darwin & MacOS X (similar to 'free' under Linux)
 *
 * by:  David Cantrell <david.l.cantrell@gmail.com>
 * Copyright (C) 2008, David Cantrell, Honolulu, HI, USA.
 *
 * Licensed under the GNU Lesser General Public License version 2.1 or later.
 * See COPYING.LIB for licensing details.
 */

#define FREE_USAGE "Usage: %s [-b|-k|-m] [-s delay] [-V] [-h|-?]\n"
#define COMBINED_UNIT_OPTIONS "You may only use one of the unit options:  -b, -k, or -m\n"

enum { UNUSED_UNIT, BYTES, KILOBYTES, MEGABYTES };

typedef struct mem {
    uint64_t total;
    uint64_t used;
    uint64_t free;
    uint64_t active;
    uint64_t inactive;
    uint64_t wired;
} mem_t;

Make sure used unit constants are non-zero


#ifdef __BLOCKS__
#undef __BLOCKS__
#endif
#include "gtk2hs_macros.h"
#include <gtksourceview/gtksourcebuffer.h>
#if GTK_MAJOR_VERSION < 3
#include <gtksourceview/gtksourceiter.h>
#endif
#include <gtksourceview/gtksourcelanguage.h>
#include <gtksourceview/gtksourcelanguagemanager.h>
#include <gtksourceview/gtksourcestyle.h>
#include <gtksourceview/gtksourcestylescheme.h>
#include <gtksourceview/gtksourcestyleschememanager.h>
#include <gtksourceview/gtksourceview.h>
#include <gtksourceview/gtksourceview-typebuiltins.h>
#include <gtksourceview/gtksourceundomanager.h>
#include <gtksourceview/gtksourcecompletionitem.h>
#include <gtksourceview/gtksourcegutter.h>
#include <gtksourceview/gtksourcecompletionprovider.h>
#include <gtksourceview/gtksourcecompletionproposal.h>
#include <gtksourceview/gtksourcemark.h>
#include <gtksourceview/gtksourcecompletioninfo.h>

Fix CPP issue on OS X

Fix CPP issue on OS X


#pragma once

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

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

#pragma once

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

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

Increase version to 1.48 in preparation for new release


/**
 * Definition for a binary tree node.
 * struct TreeNode {
 *     int val;
 *     struct TreeNode *left;
 *     struct TreeNode *right;
 * };
 */
int max_v(int a, int b) {
    return a > b ? a : b;
}
int max_value;

int DFS(struct TreeNode* root) {
    int left_sum, right_sum;
    int sum;

    if (root == NULL)
        return 0;

    left_sum = max_v(0, DFS(root->left));
    right_sum= max_v(0, DFS(root->right));
    sum = left_sum + right_sum + root->val;//a path.

    max_value = max_v(sum, max_value);

    return max_v(left_sum, right_sum) + root->val;//return one max path.
}

int maxPathSum(struct TreeNode* root) {
    if (root == NULL)
        return 0;

    max_value = -999999999;
    DFS(root);
    return max_value;
}

Create Binary Tree Maximum Path Sum.c

Create Binary Tree Maximum Path Sum.c


//
//  JLNRGravityImageView.h
//  JLNRGravityImageViewExample
//
//  Created by Julian Raschke on 17.02.15.
//  Copyright (c) 2015 Julian Raschke. All rights reserved.
//

#import <UIKit/UIKit.h>

IB_DESIGNABLE
@interface JLNRGravityImageView : UIImageView

@property (nonatomic) IBInspectable BOOL alignTop;
@property (nonatomic) IBInspectable BOOL alignBottom;
@property (nonatomic) IBInspectable BOOL alignLeft;
@property (nonatomic) IBInspectable BOOL alignRight;

@end

//
//  JLNRGravityImageView.h
//  JLNRGravityImageViewExample
//
//  Created by Julian Raschke on 17.02.15.
//  Copyright (c) 2015 Julian Raschke. All rights reserved.
//

#import <UIKit/UIKit.h>

// IB_DESIGNABLE does not work by default with CocoaPods:
// https://github.com/CocoaPods/CocoaPods/issues/2792
#ifndef COCOAPODS
IB_DESIGNABLE
#endif
@interface JLNRGravityImageView : UIImageView

@property (nonatomic) IBInspectable BOOL alignTop;
@property (nonatomic) IBInspectable BOOL alignBottom;
@property (nonatomic) IBInspectable BOOL alignLeft;
@property (nonatomic) IBInspectable BOOL alignRight;

@end

Disable IB_DESIGNABLE when using CocoaPods


#ifndef __CONFIG_H
#define __CONFIG_H

enum {
	CONFIG_KEY_RESOLUTION = 0,
	CONFIG_KEY_BLEND_USER1,
	CONFIG_KEY_BLEND_USER2,
	CONFIG_KEY_BLEND_USER3,
	CONFIG_KEY_BLEND_USER4,

	CONFIG_KEY_COUNT
};

#define CONFIG_DEFAULTS { 9, 1, 2, 3, 4 }

void config_init(void);
void config_write_all(void);
unsigned char config_get(unsigned char key);
void config_set(unsigned char key, unsigned char value);

#endif /* __CONFIG_H */

#ifndef __CONFIG_H
#define __CONFIG_H

enum {
	CONFIG_KEY_RESOLUTION = 0,
	CONFIG_KEY_BLEND_USER1,
	CONFIG_KEY_BLEND_USER2,
	CONFIG_KEY_BLEND_USER3,
	CONFIG_KEY_BLEND_USER4,

	CONFIG_KEY_COUNT
};

#ifdef BOARD_MINISPARTAN6
#define CONFIG_DEFAULTS { 5, 1, 2, 3, 4 }
#else
#define CONFIG_DEFAULTS { 9, 1, 2, 3, 4 }
#endif

void config_init(void);
void config_write_all(void);
unsigned char config_get(unsigned char key);
void config_set(unsigned char key, unsigned char value);

#endif /* __CONFIG_H */

firmware/lm32: Make 800x600 the default mode for the minispartan6+


#include "num2words.h"

// Language strings for Dutch
const Language LANG_DUTCH = {
	.hours = {
		"een",
		"twee",
		"drie",
		"vier",
		"vijf",
		"zes",
		"zeven",
		"acht",
		"negen",
		"tien",
		"elf",
		"twaalf"
	},

	.phrases = {
		"*$1 uur ",
		"vijf over *$1 ",
		"tien over *$1 ",
		"kwart over *$1 ",
		"tien voor half *$2 ",
		"vijf voor half *$2 ",
		"half *$2 ",
		"vijf over half *$2 ",
		"tien over half *$2 ",
		"kwart voor *$2 ",
		"tien voor *$2 ",
		"vijf voor *$2 "
	},

#ifdef PBL_PLATFORM_CHALK
	.greetings = {
		"Goede- morgen ",
		"Goede- middag ",
		"Goede- avond ",
		"Goede- nacht "
	},
#else
	.greetings = {
		"Goede- mor- gen ",
		"Goede- middag ",
		"Goede- avond ",
		"Goede- nacht "
	},
#endif
	.connection_lost = "Waar  is je tele- foon? "
};

#include "num2words.h"

// Language strings for Dutch
const Language LANG_DUTCH = {
	.hours = {
		"een",
		"twee",
		"drie",
		"vier",
		"vijf",
		"zes",
		"zeven",
		"acht",
		"negen",
		"tien",
		"elf",
		"twaalf"
	},

	.phrases = {
		"*$1 uur ",
		"vijf over *$1 ",
		"tien over *$1 ",
		"kwart over *$1 ",
		"tien voor half *$2 ",
		"vijf voor half *$2 ",
		"half *$2 ",
		"vijf over half *$2 ",
		"tien over half *$2 ",
		"kwart voor *$2 ",
		"tien voor *$2 ",
		"vijf voor *$2 "
	},

#ifdef PBL_PLATFORM_CHALK
	.greetings = {
		"Goede morgen ",
		"Goede middag ",
		"Goede avond ",
		"Goede nacht "
	},
#else
	.greetings = {
		"Goede mor- gen ",
		"Goede middag ",
		"Goede avond ",
		"Goede nacht "
	},
#endif
	.connection_lost = "Waar  is je tele- foon? "
};

Remove hyphens from dutch greetings as per recommendation from @eddyh


// Copyright (C) 2016 Elviss Strazdins
// This file is part of the Ouzel engine.

#pragma once

#include "CompileConfig.h"

namespace ouzel
{
    struct Settings
    {
        video::Renderer::Driver driver =
#if defined(OUZEL_PLATFORM_OSX) || defined(OUZEL_PLATFORM_IOS) || defined(OUZEL_PLATFORM_TVOS) || defined(OUZEL_PLATFORM_ANDROID) || defined(OUZEL_PLATFORM_LINUX)
        video::Renderer::Driver::OPENGL;
#elif defined(SUPPORTS_DIRECT3D11)
        video::Renderer::Driver::DIRECT3D11;
#endif

        Size2 size;
        bool resizable = false;
        bool fullscreen = false;
        float targetFPS = 60.0f;
        std::string title = "ouzel";
    };
}

// Copyright (C) 2016 Elviss Strazdins
// This file is part of the Ouzel engine.

#pragma once

#include "CompileConfig.h"

namespace ouzel
{
    struct Settings
    {
        video::Renderer::Driver driver =
#if defined(OUZEL_PLATFORM_OSX) || defined(OUZEL_PLATFORM_IOS) || defined(OUZEL_PLATFORM_TVOS) || defined(OUZEL_PLATFORM_ANDROID) || defined(OUZEL_PLATFORM_LINUX)
        video::Renderer::Driver::OPENGL;
#elif defined(SUPPORTS_DIRECT3D11)
        video::Renderer::Driver::DIRECT3D11;
#endif

        Size2 size;
        uint32_t sampleCount = 1; // MSAA sample count
        bool resizable = false;
        bool fullscreen = false;
        float targetFPS = 60.0f;
        std::string title = "ouzel";
    };
}

Add setting for MSAA sample count

Add setting for MSAA sample count


/**
  * Touhou Community Reliant Automatic Patcher
  * Main DLL
  *
  * ----
  *
  * Logging functions.
  * Log to both a file and, if requested, an on-screen console.
  *
  * As of now, we do not enforce char strings to be in UTF-8.
  */

#pragma once

/// ---------------
/// Standard output
/// ---------------
// Basic
void log_print(const char *text);
// Specific length
void log_nprint(const char *text, size_t n);
// Formatted
void log_vprintf(const char *text, va_list va);
void log_printf(const char *text, ...);

#define log_func_printf(text, ...) \
	log_printf("["__FUNCTION__"]: "##text, __VA_ARGS__)
/// ---------------

/// -------------
/// Message boxes
// Technically not a "logging function", but hey, it has variable arguments.
/// -------------
// Basic
int log_mbox(const char *caption, const UINT type, const char *text);
// Formatted
int log_vmboxf(const char *caption, const UINT type, const char *text, va_list va);
int log_mboxf(const char *caption, const UINT type, const char *text, ...);
/// -------------

void log_init(int console);
void log_exit(void);

/**
  * Touhou Community Reliant Automatic Patcher
  * Main DLL
  *
  * ----
  *
  * Logging functions.
  * Log to both a file and, if requested, an on-screen console.
  *
  * As of now, we do not enforce char strings to be in UTF-8.
  */

#pragma once

/// ---------------
/// Standard output
/// ---------------
// Basic
void log_print(const char *text);
// Specific length
void log_nprint(const char *text, size_t n);
// Formatted
void log_vprintf(const char *text, va_list va);
void log_printf(const char *text, ...);

#ifdef _MSC_VER
# define log_func_printf(text, ...) \
	log_printf("["__FUNCTION__"]: "text, __VA_ARGS__)
#else
# define log_func_printf(text, ...) \
	log_printf("[%s]: "text, __func__, ##__VA_ARGS__)
#endif
/// ---------------

/// -------------
/// Message boxes
// Technically not a "logging function", but hey, it has variable arguments.
/// -------------
// Basic
int log_mbox(const char *caption, const UINT type, const char *text);
// Formatted
int log_vmboxf(const char *caption, const UINT type, const char *text, va_list va);
int log_mboxf(const char *caption, const UINT type, const char *text, ...);
/// -------------

void log_init(int console);
void log_exit(void);

Use C99 __func__ instead of __FUNCTION__ when not compiling with Visual C++.

Couldn't they standardize __FUNCTION__ instead? A string literal that can be
concatenated with other string literals is much more flexible than a char[]
variable.


/*
 * File:   robots.h
 * Author: m79lol
 *
 */

#ifndef ROBOT_MODULE_H
#define	ROBOT_MODULE_H

#define ROBOT_COMMAND_FREE 0
#define ROBOT_COMMAND_HAND_CONTROL_BEGIN -1
#define ROBOT_COMMAND_HAND_CONTROL_END -2

class Robot {
    protected:
        Robot() {}
    public:
        virtual FunctionResult* executeFunction(regval command_index, regval *args) = 0;
        virtual void axisControl(regval axis_index, regval value) = 0;
        virtual ~Robot() {}
};

class RobotModule {
    protected:
        RobotModule() {}
    public:
        virtual const char *getUID() = 0;
        virtual int init() = 0;
        virtual FunctionData** getFunctions(int *count_functions) = 0;
        virtual AxisData** getAxis(int *count_axis) = 0;
        virtual Robot* robotRequire() = 0;
        virtual void robotFree(Robot *robot) = 0;
        virtual void final() = 0;
        virtual void destroy() = 0;
        virtual ~RobotModule() {}
};

typedef RobotModule* (*getRobotModuleObject_t)();
extern "C" {
    __declspec(dllexport) RobotModule* getRobotModuleObject();
}

#endif	/* ROBOT_MODULE_H */

/*
 * File:   robots.h
 * Author: m79lol
 *
 */

#ifndef ROBOT_MODULE_H
#define	ROBOT_MODULE_H

#define ROBOT_COMMAND_FREE 0
#define ROBOT_COMMAND_HAND_CONTROL_BEGIN -1
#define ROBOT_COMMAND_HAND_CONTROL_END -2

typedef std::function<void(unsigned short int, const char*, va_list)> t_printf_color_module;

class Robot {
    protected:
        Robot() {}
    public:
        virtual FunctionResult* executeFunction(regval command_index, regval *args) = 0;
        virtual void axisControl(regval axis_index, regval value) = 0;
        virtual ~Robot() {}
};

class RobotModule {
    protected:
        RobotModule() {}
    public:
        virtual const char *getUID() = 0;
        virtual void prepare(t_printf_color_module f_printf) = 0;
        virtual int init() = 0;
        virtual FunctionData** getFunctions(int *count_functions) = 0;
        virtual AxisData** getAxis(int *count_axis) = 0;
        virtual Robot* robotRequire() = 0;
        virtual void robotFree(Robot *robot) = 0;
        virtual void final() = 0;
        virtual void destroy() = 0;
        virtual ~RobotModule() {}
};

typedef RobotModule* (*getRobotModuleObject_t)();
extern "C" {
    __declspec(dllexport) RobotModule* getRobotModuleObject();
}

#endif	/* ROBOT_MODULE_H */

Prepare function added for Robot modules.


// Copyright (c) 2012-2013, the scalloc Project Authors.  All rights reserved.
// Please see the AUTHORS file for details.  Use of this source code is governed
// by a BSD license that can be found in the LICENSE file.

#ifndef SCALLOC_BLOCK_HEADER_H_
#define SCALLOC_BLOCK_HEADER_H_

#include "common.h"
#include "freelist.h"

enum BlockType {
  kSlab,
  kLargeObject,
  kForward
};

class BlockHeader {
 public:
  static BlockHeader* GetFromObject(void* p);

  BlockType type;
};

class ForwardHeader : public BlockHeader {
 public:
  BlockHeader* forward;
};

class SlabHeader : public BlockHeader {
 public:
  // read-only properties

  size_t size_class;
  size_t remote_flist;

  // mostly read properties

  bool active;
  size_t owner;

  // thread-local read/write properties

  uint64_t in_use;
  Freelist flist;
} cache_aligned;

class LargeObjectHeader : public BlockHeader {
 public:
  size_t size;

  inline void Reset(size_t size) {
    this->type = kLargeObject;
    this->size = size;
  }
} cache_aligned;

always_inline BlockHeader* BlockHeader::GetFromObject(void* p) {
  uintptr_t ptr = reinterpret_cast<uintptr_t>(p);
  if (UNLIKELY(ptr % kSystemPageSize == 0)) {
    BlockHeader* bh = reinterpret_cast<BlockHeader*>(ptr - kSystemPageSize);
    if (bh->type == kForward) {
      bh = reinterpret_cast<ForwardHeader*>(bh)->forward;
    }
  }
  uintptr_t page_ptr = ptr & ~(kSystemPageSize - 1);
  BlockHeader* bh = reinterpret_cast<BlockHeader*>(page_ptr);
  switch (bh->type) {
  case kForward:
    return reinterpret_cast<ForwardHeader*>(bh)->forward;
  case kSlab:
  case kLargeObject:
    return bh;
  default:
    ErrorOut("unknown block header. type: %d, ptr: %p, page_ptr: %p",
             bh->type, p, reinterpret_cast<void*>(page_ptr));
  }
  // unreachable...
  return NULL;
}

#endif  // SCALLOC_BLOCK_HEADER_H_

Add definitions for block headers.

Add definitions for block headers.

Signed-off-by: Michael Lippautz <0d543840881a2c189b4f7636b15eebd6a8f60ace@gmail.com>


// SKIP PARAM: --sets ana.activated[+] octApron
#include <assert.h>

int f(int x) {
  return x + 1;
}

int main(void) {
  int y, z;

  z = y;
  y = f(y);

  // local is: y == z
  // fun is: #ret == x' + 1
  // fun args subst (x' -> y) is: #ret == y + 1
  // local forget y is: top
  // fun forget y is: top
  // fun subst (#ret -> y) is: top
  // unify is: top

  // WANT:
  // local is: y == z
  // fun is: #ret == x' + 1
  // fun args subst (x' -> y) is: #ret == y + 1
  // unify is: y == z && #ret == y + 1 (&& #ret == z + 1)
  // assign (y = #ret) is:
    // 1. y == z && #ret == y + 1 && y#new == #ret (&& #ret == z + 1 && y#new == z + 1)
    // 2. y#new == #ret && #ret == z + 1 (&& y#new == z + 1)
    // 3. y == #ret && #ret == z + 1 (&& y == z + 1)
  // forget #ret is: y == z + 1

  assert(y == z + 1); // TODO
  return 0;
}

Add test for octApron combine where forgetting lval is too imprecise


/** \file
 * This file only exists to contain the front-page of the documentation
 */

/** \mainpage Documentation of the API if the Tiramisu Compiler
 *
 * Tiramisu provides few classes to enable users to represent their program:
 * - The \ref tiramisu::function class: a function in Tiramisu is equivalent to a function in C. It is composed of multiple computations. Each computation is the equivalent of a statement in C.
 * - The \ref tiramisu::input class: an input is used to represent inputs passed to Tiramisu.  An input can represent a buffer or a scalar.
 * - The \ref tiramisu::constant class: a constant is designed to represent constants that are supposed to be declared at the beginning of a Tiramisu function.
 * - The \ref tiramisu::computation class: a computation in Tiramisu is the equivalent of a statement in C. It is composed of an expression and an iteration domain.
 * - The \ref tiramisu::buffer class: a class to represent memory buffers.
 *
 */

/** \file
 * This file only exists to contain the front-page of the documentation
 */

/** \mainpage Documentation of the API if the Tiramisu Compiler
 *
 * Tiramisu provides few classes to enable users to represent their program:
 * - The \ref tiramisu::function class: a function in Tiramisu is equivalent to a function in C. It is composed of multiple computations. Each computation is the equivalent of a statement in C.
 * - The \ref tiramisu::input class: an input is used to represent inputs passed to Tiramisu.  An input can represent a buffer or a scalar.
 * - The \ref tiramisu::constant class: a constant is designed to represent constants that are supposed to be declared at the beginning of a Tiramisu function.
 * - The \ref tiramisu::var class: used to represent loop iterators. Usually we declare a var (a loop iterator) and then use it for the declaration of computations. The range of that variable defines the loop range. When use witha buffer it defines the buffer size and when used with an input it defines the input size.
 * - The \ref tiramisu::computation class: a computation in Tiramisu is the equivalent of a statement in C. It is composed of an expression and an iteration domain.
 * - The \ref tiramisu::buffer class: a class to represent memory buffers.
 */

Fix the documentation main page

Fix the documentation main page


/* mbed Microcontroller Library
 * Copyright (c) 2015-2017 Nuvoton
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
#include "cmsis_nvic.h"

void NVIC_SetVector(IRQn_Type IRQn, uint32_t vector)
{
    //static volatile uint32_t *vectors = (uint32_t *) NVIC_RAM_VECTOR_ADDRESS;

    // Put the vectors in SRAM
    //vectors[IRQn + 16] = vector;
}

uint32_t NVIC_GetVector(IRQn_Type IRQn)
{
    uint32_t *vectors = (uint32_t*) NVIC_FLASH_VECTOR_ADDRESS;

    // Return the vector
    return vectors[IRQn + 16];
}

/* mbed Microcontroller Library
 * Copyright (c) 2015-2017 Nuvoton
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
#include "cmsis_nvic.h"
#include "platform/mbed_error.h"

void NVIC_SetVector(IRQn_Type IRQn, uint32_t vector)
{
    // NOTE: On NANO130, relocating vector table is not supported due to just 16KB small SRAM.
    //       Add guard code to prevent from unsupported relocating.
    uint32_t vector_static = NVIC_GetVector(IRQn);
    if (vector_static != vector) {
        error("No support for relocating vector table");
    }
}

uint32_t NVIC_GetVector(IRQn_Type IRQn)
{
    uint32_t *vectors = (uint32_t*) NVIC_FLASH_VECTOR_ADDRESS;

    // Return the vector
    return vectors[IRQn + 16];
}

[NANO130] Add guard code to prevent from relocating vector table


#ifndef EMULATOR_REGISTER_H
#define EMULATOR_REGISTER_H

#include <cstdint>

template <typename T>
class Register {
public:
    Register() {};

    void set(const T new_value) { val = new_value; };
    T value() const { return val; };

    void increment() { val += 1; };
    void decrement() { val -= 1; };

private:
    T val;
};

typedef Register<uint8_t> ByteRegister;
typedef Register<uint16_t> WordRegister;

class RegisterPair {
public:
    RegisterPair(ByteRegister& low, ByteRegister& high);

    void set_low(const uint8_t byte);
    void set_high(const uint8_t byte);

    void set_low(const ByteRegister& byte);
    void set_high(const ByteRegister& byte);

    void set(const uint16_t word);

    uint8_t low() const;
    uint8_t high() const;

    uint16_t value() const;

    void increment();
    void decrement();

private:
    ByteRegister& low_byte;
    ByteRegister& high_byte;
};

#endif

#ifndef EMULATOR_REGISTER_H
#define EMULATOR_REGISTER_H

#include <cstdint>

template <typename T>
class Register {
public:
    Register() {};

    void set(const T new_value) { val = new_value; };
    T value() const { return val; };

    void increment() { val += 1; };
    void decrement() { val -= 1; };

private:
    T val;
};

typedef Register<uint8_t> ByteRegister;
typedef Register<uint16_t> WordRegister;

class RegisterPair {
public:
    RegisterPair(ByteRegister& low, ByteRegister& high);

    void set_low(const uint8_t byte);
    void set_high(const uint8_t byte);

    void set_low(const ByteRegister& byte);
    void set_high(const ByteRegister& byte);

    void set(const uint16_t word);

    uint8_t low() const;
    uint8_t high() const;

    uint16_t value() const;

    void increment();
    void decrement();

private:
    ByteRegister& low_byte;
    ByteRegister& high_byte;
};

class Offset {
public:
    Offset(uint8_t val) : val(val) {};
    Offset(ByteRegister& reg) : val(reg.value()) {};

    uint8_t value() { return val; }

private:
    uint8_t val;
};

#endif

Add the mini offset utility class

Add the mini offset utility class


//
// Created by James Telfer on 30/07/2017.
//

#ifndef C_11_FEATURE_DEMO_DYNAMICMEMORY_H
#define C_11_FEATURE_DEMO_DYNAMICMEMORY_H

#include "Thing.h"

class DynamicMemory {
public:
    DynamicMemory();
    void uniquePointers();
    void sharedPointers();
    void makeShared();
private:
    void outputThing(const Thing* thing) const;
    void outputSharedPtr(std::shared_ptr<Thing> thing) const;

    std::unique_ptr<Thing> uniquePtrMember;
    std::shared_ptr<Thing> sharedPtrMember;
};

#endif //C_11_FEATURE_DEMO_DYNAMICMEMORY_H

//
// Created by James Telfer on 30/07/2017.
//

#ifndef C_11_FEATURE_DEMO_DYNAMICMEMORY_H
#define C_11_FEATURE_DEMO_DYNAMICMEMORY_H

#include <memory>
#include "Thing.h"

class DynamicMemory {
public:
    DynamicMemory();
    void uniquePointers();
    void sharedPointers();
    void makeShared();
private:
    void outputThing(const Thing* thing) const;
    void outputSharedPtr(std::shared_ptr<Thing> thing) const;

    std::unique_ptr<Thing> uniquePtrMember;
    std::shared_ptr<Thing> sharedPtrMember;
};

#endif //C_11_FEATURE_DEMO_DYNAMICMEMORY_H

Add header for smart pointers

Add header for smart pointers


/*
 * Copyright (c) 2013 Thomas Adam <thomas@xteddy.org>
 *
 * Permission to use, copy, modify, and distribute this software for any
 * purpose with or without fee is hereby granted, provided that the above
 * copyright notice and this permission notice appear in all copies.
 *
 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
 * WHATSOEVER RESULTING FROM LOSS OF MIND, USE, DATA OR PROFITS, WHETHER
 * IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
 * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 */

/* Provides some wrappers around various syscalls to handle things like
 * memory/error checking, etc.
 */

#include <errno.h>
#include <stdarg.h>
#include <stdio.h>
#include "lswm.h"

/* Wrapper around asprintf() to handle error code returns. */
int
xasprintf(char **out, const char *fmt, ...)
{
	va_list	 ap;
	int	 i;

	va_start(ap, fmt);
	i = asprintf(out, fmt, ap);

	if (i == -1) {
		/* Then there were problems allocating memory. */
		log_fatal("Couldn't allocate memory for asprintf()");
	}

	va_end(ap);

	return (i);
}

/* Wrapper for malloc() to handle memory */
void *
xmalloc(size_t s)
{
	void	*mem;

	if (s == 0)
		log_fatal("Cannot pass zero size to malloc()");

	if ((mem = malloc(s)) == NULL)
		log_fatal("malloc() returned NULL");

	return (mem);
}

Add a wrapper lib for common functions

Add a wrapper lib for common functions

Certain functions such as malloc/realloc/asprintf need special handling for
their errors, often erroring out or providing the same error message, etc.

This therefore introduces such a wrapper.  Not used too much at the moment.


//
// Created by monty on 23/11/15.
//

#ifndef LESSON02_GLES2LESSON_H
#define LESSON02_GLES2LESSON_H

namespace odb {

    class GLES2Lesson {

        void fetchShaderLocations();

        void setPerspective();

        void prepareShaderProgram();

        void clearBuffers();

        void resetTransformMatrices();

        void printVerboseDriverInformation();

        GLuint createProgram(const char *pVertexSource, const char *pFragmentSource);

        GLuint loadShader(GLenum shaderType, const char *pSource);

        void drawTrig(Trig &trig, const glm::mat4 &transform);

        glm::mat4 projectionMatrix;
        glm::mat4 viewMatrix;

        GLuint vertexAttributePosition;
        GLuint modelMatrixAttributePosition;
        GLuint viewMatrixAttributePosition;
        GLuint samplerUniformPosition;
        GLuint textureCoordinatesAttributePosition;
        GLuint projectionMatrixAttributePosition;
        GLuint gProgram;

        GLuint textureId;

        int *textureData;
        int textureWidth;
        int textureHeight;
        std::vector<Trig> mTrigs;
        glm::vec3 camera;
    public:
        GLES2Lesson();

        ~GLES2Lesson();

        bool init(float w, float h, const std::string &vertexShader,
                  const std::string &fragmentShader);

        void setTexture(int *bitmapData, int width, int height, int format);

        void render();

        void shutdown();

        void tick();

        void reset();

        void addTrigs(std::vector<Trig> vector);
    };
}
#endif //LESSON02_GLES2LESSON_H

//
// Created by monty on 23/11/15.
//

#ifndef LESSON02_GLES2LESSON_H
#define LESSON02_GLES2LESSON_H

namespace odb {

    class GLES2Lesson {

        void fetchShaderLocations();

        void setPerspective();

        void prepareShaderProgram();

        void clearBuffers();

        void resetTransformMatrices();

        void printVerboseDriverInformation();

        GLuint createProgram(const char *pVertexSource, const char *pFragmentSource);

        GLuint loadShader(GLenum shaderType, const char *pSource);

        void drawTrig(Trig &trig, const glm::mat4 &transform);

        glm::mat4 projectionMatrix;
        glm::mat4 viewMatrix;

        GLuint vertexAttributePosition;
        GLuint modelMatrixAttributePosition;
        GLuint viewMatrixAttributePosition;
        GLuint samplerUniformPosition;
        GLuint textureCoordinatesAttributePosition;
        GLuint projectionMatrixAttributePosition;
        GLuint gProgram;

        GLuint textureId;

        int *textureData;
        int textureWidth;
        int textureHeight;
        std::vector<Trig> mTrigs;
        glm::vec3 camera;

    public:
        explicit GLES2Lesson();

        ~GLES2Lesson();

        bool init(float w, float h, const std::string &vertexShader,
                  const std::string &fragmentShader);

        void setTexture(int *bitmapData, int width, int height, int format);

        void render();

        void shutdown();

        void tick();

        void reset();

        void addTrigs(std::vector<Trig> vector);
    };
}
#endif //LESSON02_GLES2LESSON_H

Make the constructor for the Lesson 10 explicit

While this has little effect here, it's a good practice worth getting
used to. I still have to do the same with all the other classes.


/* encrypted keys */

static const uint32_t internal_device_number = 0;

static const uint8_t internal_dk_list[][21] = {
  {
  },
};

static const uint8_t internal_pk_list[][16] = {
  {
  },
};

static const uint8_t internal_hc_list[][112] = {
  {
  },
};

/* customize this function to "hide" the keys in the binary */

static void decrypt_key(uint8_t *out, const uint8_t *in, size_t size)
{
    memcpy(out, in, size);
}

/* encrypted keys */

static const uint32_t internal_device_number = 0;

static const uint8_t internal_dk_list[][21] = {
  { 0 },
};

static const uint8_t internal_pk_list[][16] = {
  { 0 },
};

static const uint8_t internal_hc_list[][112] = {
  { 0 },
};

/* customize this function to "hide" the keys in the binary */

static void decrypt_key(uint8_t *out, const uint8_t *in, size_t size)
{
    memcpy(out, in, size);
}

Fix MSVC error C2133 : unknown size of multi-dimensional static const arrays (despite supposed support of C99). Have not confirmed if this breaks anything yet.


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

#include "const.h"

extern void logop(int32_t, int32_t);
extern void dbg_trace(void);

#define dbg_log(...) { if(DEBUG) { printf(__VA_ARGS__); } }
#define dbg_assert(condition) { if(DEBUG) { if(!(condition)) dbg_log(#condition); assert(condition); } }
#define dbg_assert_message(condition, message) { if(DEBUG && !(condition)) { dbg_log(message); assert(false); } }

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

#include "const.h"

extern void logop(int32_t, int32_t);
extern void dbg_trace(void);

#define dbg_log(...) { if(DEBUG) { printf(__VA_ARGS__); } }
#define dbg_trace(...) { if(DEBUG) { dbg_trace(__VA_ARGS__); } }
#define dbg_assert(condition) { if(DEBUG) { if(!(condition)) dbg_log(#condition); assert(condition); } }
#define dbg_assert_message(condition, message) { if(DEBUG && !(condition)) { dbg_log(message); assert(false); } }

Remove dbg_trace from non-debug builds

Remove dbg_trace from non-debug builds


// RUN: %check %s

// extern
extern inline int f()
{
	static int i;
	return i++;
}

// static
static inline int h()
{
	static int i;
	return i++;
}

// neither
inline int g()
{
	static int i; // CHECK: warning: static variable in pure-inline function - may differ per file
	return i++;
}

// neither, but const
inline int g2()
{
	static const int i = 3; // CHECK: !/warn/
	return i;
}

main()
{
	return f() + g() + h();
}

// RUN: %check %s

// extern
extern inline int f()
{
	static int i;
	return i++;
}

// static
static inline int h()
{
	static int i;
	return i++;
}

// neither
inline int g()
{
	static int i; // CHECK: warning: mutable static variable in pure-inline function - may differ per file
	return i++;
}

// neither, but const
inline int g2()
{
	static const int i = 3; // CHECK: !/warn/
	return i;
}

main()
{
	return f() + g() + h();
}

Fix inline static local warning

Fix inline static local warning


/*
 * This file is part of buxton.
 *
 * Copyright (C) 2013 Intel Corporation
 *
 * buxton 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.
 */

#pragma once

#ifdef HAVE_CONFIG_H
    #include "config.h"
#endif

#ifdef DEBUG
#define buxton_debug(...) buxton_log(__VA_ARGS__)
#else
#define buxton_debug(...) do {} while(0);
#endif /* DEBUG */

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

/*
 * Editor modelines  -  http://www.wireshark.org/tools/modelines.html
 *
 * Local variables:
 * c-basic-offset: 8
 * tab-width: 8
 * indent-tabs-mode: t
 * End:
 *
 * vi: set shiftwidth=8 tabstop=8 noexpandtab:
 * :indentSize=8:tabSize=8:noTabs=false:
 */

/*
 * This file is part of buxton.
 *
 * Copyright (C) 2013 Intel Corporation
 *
 * buxton 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.
 */

#pragma once

#ifdef HAVE_CONFIG_H
    #include "config.h"
#endif

#ifdef DEBUG
#define buxton_debug(...) do { \
	buxton_log("%s():[%d]: %s",  __func__, __LINE__ , __VA_ARGS__); \
} while(0);
#else
#define buxton_debug(...) do {} while(0);
#endif /* DEBUG */

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

/*
 * Editor modelines  -  http://www.wireshark.org/tools/modelines.html
 *
 * Local variables:
 * c-basic-offset: 8
 * tab-width: 8
 * indent-tabs-mode: t
 * End:
 *
 * vi: set shiftwidth=8 tabstop=8 noexpandtab:
 * :indentSize=8:tabSize=8:noTabs=false:
 */

Add line and function details to buxton_debug()


#ifndef QGC_CONFIGURATION_H
#define QGC_CONFIGURATION_H

#include <QString>

/** @brief Polling interval in ms */
#define SERIAL_POLL_INTERVAL 9

/** @brief Heartbeat emission rate, in Hertz (times per second) */
#define MAVLINK_HEARTBEAT_DEFAULT_RATE 1
#define WITH_TEXT_TO_SPEECH 1

#define QGC_APPLICATION_NAME "APM Planner"
#define QGC_APPLICATION_VERSION "v2.0.0 (beta)"

namespace QGC

{
const QString APPNAME = "APMPLANNER";
const QString COMPANYNAME = "3DROBOTICS";
const int APPLICATIONVERSION = 200; // 1.0.9
}

#endif // QGC_CONFIGURATION_H

#ifndef QGC_CONFIGURATION_H
#define QGC_CONFIGURATION_H

#include <QString>

/** @brief Polling interval in ms */
#define SERIAL_POLL_INTERVAL 9

/** @brief Heartbeat emission rate, in Hertz (times per second) */
#define MAVLINK_HEARTBEAT_DEFAULT_RATE 1
#define WITH_TEXT_TO_SPEECH 1

#define QGC_APPLICATION_NAME "APM Planner"
#define QGC_APPLICATION_VERSION "v2.0.0 (beta)"

namespace QGC

{
const QString APPNAME = "APMPLANNER2";
const QString COMPANYNAME = "DIYDRONES";
const int APPLICATIONVERSION = 200; // 1.0.9
}

#endif // QGC_CONFIGURATION_H

Change from 3drobotics to diydrones for COMPANYNAME


#ifndef RADIOMULT_H
#define RADIOMULT_H

#include "NdbMF.h"

/* ========= NdbRadioMult ============ */
class NdbRad  ioMult : public NdbMF
{
protected:

public:
   NdbRadioMult()
      : NdbMF(9, "Multiplicities for radioactive nuclide production") {}
   ~NdbRadioMult() {}

   ClassDef(NdbRadioMult,1)
}; // NdbRadioMult

#endif

#ifndef RADIOMULT_H
#define RADIOMULT_H

#include "NdbMF.h"

/* ========= NdbRadioMult ============ */
class NdbRadioMult : public NdbMF
{
protected:

public:
   NdbRadioMult()
      : NdbMF(9, "Multiplicities for radioactive nuclide production") {}
   ~NdbRadioMult() {}

   ClassDef(NdbRadioMult,1)
}; // NdbRadioMult

#endif

Fix typo in tab removal

Fix typo in tab removal


// Copyright (c) 2017 The Bitcoin Core developers
// Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.

#ifndef BITCOIN_QT_MODALOVERLAY_H
#define BITCOIN_QT_MODALOVERLAY_H

#include <QDateTime>
#include <QWidget>

//! The required delta of headers to the estimated number of available headers until we show the IBD progress
static constexpr int HEADER_HEIGHT_SYNC_DELTA = 24;

namespace Ui
{
class ModalOverlay;
}

/** Modal overlay to display information about the chain-sync state */
class ModalOverlay : public QWidget
{
    Q_OBJECT

public:
    explicit ModalOverlay(QWidget *parent);
    ~ModalOverlay();

public Q_SLOTS:
    void tipUpdate(int count, const QDateTime &blockDate, double nVerificationProgress);
    void setKnownBestHeight(int count, const QDateTime &blockDate);

    // will show or hide the modal layer
    void showHide(bool hide = false, bool userRequested = false);
    void closeClicked();

protected:
    bool eventFilter(QObject *obj, QEvent *ev);
    bool event(QEvent *ev);

private:
    Ui::ModalOverlay *ui;
    std::atomic<int> bestBlockHeight{0}; // best known height (based on the headers)
    QVector<QPair<qint64, double> > blockProcessTime;
    bool layerIsVisible;
    bool userClosed;
};

#endif // BITCOIN_QT_MODALOVERLAY_H

// Copyright (c) 2017 The Bitcoin Core developers
// Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.

#ifndef BITCOIN_QT_MODALOVERLAY_H
#define BITCOIN_QT_MODALOVERLAY_H

#include <QDateTime>
#include <QWidget>
#include <atomic>

//! The required delta of headers to the estimated number of available headers until we show the IBD progress
static constexpr int HEADER_HEIGHT_SYNC_DELTA = 24;

namespace Ui
{
class ModalOverlay;
}

/** Modal overlay to display information about the chain-sync state */
class ModalOverlay : public QWidget
{
    Q_OBJECT

public:
    explicit ModalOverlay(QWidget *parent);
    ~ModalOverlay();

public Q_SLOTS:
    void tipUpdate(int count, const QDateTime &blockDate, double nVerificationProgress);
    void setKnownBestHeight(int count, const QDateTime &blockDate);

    // will show or hide the modal layer
    void showHide(bool hide = false, bool userRequested = false);
    void closeClicked();

protected:
    bool eventFilter(QObject *obj, QEvent *ev);
    bool event(QEvent *ev);

private:
    Ui::ModalOverlay *ui;
    std::atomic<int> bestBlockHeight{0}; // best known height (based on the headers)
    QVector<QPair<qint64, double> > blockProcessTime;
    bool layerIsVisible;
    bool userClosed;
};

#endif // BITCOIN_QT_MODALOVERLAY_H

Add a missing atomic include

Add a missing atomic include

This prevent this error in Ubuntu xenial and trusty while compling bitcoin-qt:

In file included from qt/modaloverlay.cpp:5:0:
qt/modaloverlay.h:42:10: error: ‘atomic’ in namespace ‘std’ does not name a template type
     std::atomic<int> bestBlockHeight{0}; // best known height (based on the headers)
                   ^


#ifndef ipcrypt_H
#define ipcrypt_H

#define IPCRYPT_BYTES 4
#define IPCRYPT_KEYBYTES 16

int ipcrypt_encrypt(unsigned char out[IPCRYPT_BYTES],
                    const unsigned char in[IPCRYPT_BYTES],
                    const unsigned char key[IPCRYPT_KEYBYTES]);

int ipcrypt_decrypt(unsigned char out[IPCRYPT_BYTES],
                    const unsigned char in[IPCRYPT_BYTES],
                    const unsigned char key[IPCRYPT_KEYBYTES]);
#endif

#ifndef ipcrypt_H
#define ipcrypt_H

#define IPCRYPT_BYTES 4
#define IPCRYPT_KEYBYTES 16

#ifdef __cplusplus
extern "C" {
#endif

int ipcrypt_encrypt(unsigned char out[IPCRYPT_BYTES],
                    const unsigned char in[IPCRYPT_BYTES],
                    const unsigned char key[IPCRYPT_KEYBYTES]);

int ipcrypt_decrypt(unsigned char out[IPCRYPT_BYTES],
                    const unsigned char in[IPCRYPT_BYTES],
                    const unsigned char key[IPCRYPT_KEYBYTES]);

#ifdef __cplusplus
}  /* End of the 'extern "C"' block */
#endif

#endif

Make inclusion from C++ projects easier

Make inclusion from C++ projects easier

This code adds a conditional extern "C" statement - which most C libraries do as a courtesy for C++ users.


#ifndef _INCLUDE_VM_INTERNAL_H
#define _INCLUDE_VM_INTERNAL_H

#include "vm.h"
#include "defs.h"
#include "heap.h"

typedef struct {
  vm_value reg[num_regs];
  int return_address;
  int result_register;

  //TODO type for this should be heap_address
  int spilled_arguments; // Used for over-saturated calls.
} stack_frame ;

typedef struct {
  stack_frame stack[stack_size];
  int stack_pointer;
  int program_pointer;
  vm_value *const_table;
  int const_table_length;
} vm_state;

#define current_frame (state->stack[state->stack_pointer])
#define next_frame (state->stack[state->stack_pointer + 1])

vm_value new_heap_string(char *content);

char *read_string(vm_state *state, vm_value string_value);
char *value_to_type_string(vm_value value);

#endif

#ifndef _INCLUDE_VM_INTERNAL_H
#define _INCLUDE_VM_INTERNAL_H

#include "vm.h"
#include "defs.h"
#include "heap.h"

typedef struct {
  vm_value reg[num_regs];
  int return_address;
  int result_register;

  heap_address spilled_arguments; // Used for over-saturated calls.
} stack_frame ;

typedef struct {
  stack_frame stack[stack_size];
  int stack_pointer;
  int program_pointer;
  vm_value *const_table;
  int const_table_length;
} vm_state;

#define current_frame (state->stack[state->stack_pointer])
#define next_frame (state->stack[state->stack_pointer + 1])

vm_value new_heap_string(char *content);

char *read_string(vm_state *state, vm_value string_value);
char *value_to_type_string(vm_value value);

#endif

Fix type for spilled arguments

Fix type for spilled arguments


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

#include <stddef.h>

#include "compiler.h"
#include "socket.h"

cjet_ssize_t socket_read(socket_type sock, void *buf, size_t count)
{
	return 0;
}

cjet_ssize_t socket_writev_with_prefix(socket_type sock, void *buf, size_t len, struct socket_io_vector *io_vec, unsigned int count)
{
	return 0;
}

int socket_close(socket_type sock)
{
	return 0;
}

enum cjet_system_error get_socket_error(void)
{
	return 0;
}

const char *get_socket_error_msg(enum cjet_system_error err)
{
	return "Hello";
}

Add stub for windows socket implementation.


/*
 * Author: Brendan Le Foll <brendan.le.foll@intel.com>
 * Copyright (c) 2014 Intel Corporation.
 *
 * SPDX-License-Identifier: MIT
 */

#pragma once

#ifdef __cplusplus
extern "C" {
#endif

const char* gVERSION;
const char* gVERSION_SHORT;

#ifdef __cplusplus
}
#endif

/*
 * Author: Brendan Le Foll <brendan.le.foll@intel.com>
 * Copyright (c) 2014 Intel Corporation.
 *
 * SPDX-License-Identifier: MIT
 */

#pragma once

#ifdef __cplusplus
extern "C" {
#endif

extern const char* gVERSION;
extern const char* gVERSION_SHORT;

#ifdef __cplusplus
}
#endif

Declare gVERSION global as 'extern'.

include: Declare gVERSION global as 'extern'.

Fixes build with '-fno-common'.

Signed-off-by: Thomas Ingleby <bb80a585db4bdbe09547a7483d1a31841fd0e0e8@intel.com>


#import <FBSnapshotTestCase/FBSnapshotTestCase.h>
#import "UIApplication+VisualTestUtils.h"

/**
 *  @function WMFSnapshotVerifyView
 *
 *  Verify correct appearance of a given view.
 *
 *  Search all folder suffixes, use default naming conventions.
 *
 *  @param view The view to verify.
 */
#define WMFSnapshotVerifyView(view) FBSnapshotVerifyView((view), nil)

/**
 *  @function WMFSnapshotVerifyViewForOSAndWritingDirection
 *
 *  Compares @c view with a reference image matching the current OS version & application writing direction (e.g.
 *  "testLaysOutProperly_9.2_RTL@2x.png").
 *
 *  @param view The view to verify.
 */
#define WMFSnapshotVerifyViewForOSAndWritingDirection(view) \
    FBSnapshotVerifyView((view), [[UIApplication sharedApplication] wmf_systemVersionAndWritingDirection]);

@interface FBSnapshotTestCase (WMFConvenience)

- (void)wmf_verifyMultilineLabelWithText:(id)stringOrAttributedString width:(CGFloat)width;

- (void)wmf_verifyCellWithIdentifier:(NSString *)identifier
                       fromTableView:(UITableView *)tableView
                               width:(CGFloat)width
                 configuredWithBlock:(void (^)(UITableViewCell *))block;

- (void)wmf_verifyView:(UIView *)view width:(CGFloat)width;

- (void)wmf_verifyViewAtWindowWidth:(UIView *)view;

@end

#import <FBSnapshotTestCase/FBSnapshotTestCase.h>
#import "UIApplication+VisualTestUtils.h"

/**
 *  @function WMFSnapshotVerifyView
 *
 *  Verify correct appearance of a given view.
 *
 *  Search all folder suffixes, use default naming conventions.
 *
 *  @param view The view to verify.
 */
#define WMFSnapshotVerifyView(view) FBSnapshotVerifyView((view), nil)

/**
 *  @function WMFSnapshotVerifyViewForOSAndWritingDirection
 *
 *  Compares @c view with a reference image matching the current OS version & application writing direction (e.g.
 *  "testLaysOutProperly_9.2_RTL@2x.png").
 *
 *  @param view The view to verify.
 */
#define WMFSnapshotVerifyViewForOSAndWritingDirection(view) \
    FBSnapshotVerifyViewWithOptions((view), [[UIApplication sharedApplication] wmf_systemVersionAndWritingDirection], FBSnapshotTestCaseDefaultSuffixes(), 0.1);

@interface FBSnapshotTestCase (WMFConvenience)

- (void)wmf_verifyMultilineLabelWithText:(id)stringOrAttributedString width:(CGFloat)width;

- (void)wmf_verifyCellWithIdentifier:(NSString *)identifier
                       fromTableView:(UITableView *)tableView
                               width:(CGFloat)width
                 configuredWithBlock:(void (^)(UITableViewCell *))block;

- (void)wmf_verifyView:(UIView *)view width:(CGFloat)width;

- (void)wmf_verifyViewAtWindowWidth:(UIView *)view;

@end

Add slight tolerance for image differences to visual test macro.


// GoogleAnalyticsIntegration.h
// Copyright (c) 2014 Segment.io. All rights reserved.

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

@interface SEGGoogleAnalyticsIntegration : SEGAnalyticsIntegration

@property(nonatomic, copy) NSString *name;
@property(nonatomic, assign) BOOL valid;
@property(nonatomic, assign) BOOL initialized;
@property(nonatomic, copy) NSDictionary *settings;

@end

// GoogleAnalyticsIntegration.h
// Copyright (c) 2014 Segment.io. All rights reserved.

#import <Foundation/Foundation.h>
#import "SEGAnalyticsIntegration.h"
#import "SEGEcommerce.h"

@interface SEGGoogleAnalyticsIntegration : SEGAnalyticsIntegration <SEGEcommerce>

@property(nonatomic, copy) NSString *name;
@property(nonatomic, assign) BOOL valid;
@property(nonatomic, assign) BOOL initialized;
@property(nonatomic, copy) NSDictionary *settings;

@end

Add ecommerce protocol to ga

Add ecommerce protocol to ga


//
//  process.h
//  Project3
//
//  Created by Stratton Aguilar on 7/3/14.
//  Copyright (c) 2014 Stratton Aguilar. All rights reserved.
//

#ifndef Project3_process_h
#define Project3_process_h

typedef struct {
    int processNum;
    int arrivalTime;
    int lifeTime;
    int memReq;
} PROCESS;
#endif

//
//  process.h
//  Project3
//
//  Created by Stratton Aguilar on 7/3/14.
//  Copyright (c) 2014 Stratton Aguilar. All rights reserved.
//

#ifndef Project3_process_h
#define Project3_process_h

typedef struct {
    int processNum;
    int arrivalTime;
    int lifeTime;
    int memReq;

    int time_left;
    int is_active;
} PROCESS;
#endif

Add time_left and is_active to the proc struct


Remove cost from empty ammoboxes till they can be recycled


#include <time.h>

#include "clock.h"

#include "clock_type.h"

extern int clock_init(struct SPDR_Clock **clockp, struct SPDR_Allocator *allocator)
{
        struct timespec res;

        if (clock_getres(CLOCK_MONOTONIC, &res) != 0 || res.tv_nsec > 1000) {
                /* unknown clock or insufficient resolution */
                return -1;
        }

        return clock_init_base(clockp, allocator, 1, 1000);
}

extern uint64_t clock_ticks(struct SPDR_Clock const *const clock)
{
        struct timespec ts;
        clock_gettime(CLOCK_MONOTONIC, &ts);

        (void)clock;

        return ts.tv_sec * 1000000000LL + ts.tv_nsec;
}

Fix signature of clock_init for posix

Fix signature of clock_init for posix


#ifndef STRACE_XLAT_H

struct xlat {
	unsigned int val;
	const char *str;
};

# define XLAT(val)			{ (unsigned)(val), #val }
# define XLAT_PAIR(val, str)		{ (unsigned)(val), str  }
# define XLAT_END			{		0, 0    }

#endif

#ifndef STRACE_XLAT_H

struct xlat {
	unsigned int val;
	const char *str;
};

# define XLAT(val)			{ (unsigned)(val), #val }
# define XLAT_PAIR(val, str)		{ (unsigned)(val), str  }
# define XLAT_TYPE(type, val)		{     (type)(val), #val }
# define XLAT_TYPE_PAIR(val, str)	{     (type)(val), str  }
# define XLAT_END			{		0, 0    }

#endif

Introduce XLAT_TYPE and XLAT_TYPE_PAIR macros

* xlat.h (XLAT_TYPE): New macro, similar to XLAT but casts
to the specified type instead of unsigned int.
(XLAT_TYPE_PAIR): New macro, similar to XLAT_PAIR but casts
to the specified type instead of unsigned int.


//
//  SRDataModel.h
//  Sensorama
//
//  Created by Wojciech Adam Koszek (h) on 19/04/2016.
//  Copyright © 2016 Wojciech Adam Koszek. All rights reserved.
//

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

@interface SRDataPoint : RLMObject

@property NSNumber<RLMInt> *accX;
@property NSNumber<RLMInt> *accY;
@property NSNumber<RLMInt> *accZ;

@property NSNumber<RLMInt> *magX;
@property NSNumber<RLMInt> *magY;
@property NSNumber<RLMInt> *magZ;

@property NSNumber<RLMInt> *gyroX;
@property NSNumber<RLMInt> *gyroY;
@property NSNumber<RLMInt> *gyroZ;

@property NSInteger fileId;
@property NSInteger curTime;

@end

@interface SRDataFile : RLMObject

@property NSString *username;
@property NSString *desc;
@property NSString *timezone;
/* need to do something about device_info */

@property NSInteger sampleInterval;
@property BOOL accEnabled;
@property BOOL magEnabled;
@property BOOL gyroEnabled;

@property NSDate *dateStart;
@property NSDate *dateEnd;
@property NSInteger fileId;

@end

//
//  SRDataModel.h
//  Sensorama
//
//  Created by Wojciech Adam Koszek (h) on 19/04/2016.
//  Copyright © 2016 Wojciech Adam Koszek. All rights reserved.
//

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

@interface SRDataPoint : RLMObject

@property NSNumber<RLMInt> *accX;
@property NSNumber<RLMInt> *accY;
@property NSNumber<RLMInt> *accZ;

@property NSNumber<RLMInt> *magX;
@property NSNumber<RLMInt> *magY;
@property NSNumber<RLMInt> *magZ;

@property NSNumber<RLMInt> *gyroX;
@property NSNumber<RLMInt> *gyroY;
@property NSNumber<RLMInt> *gyroZ;

@property NSInteger fileId;
@property NSInteger curTime;

@end
RLM_ARRAY_TYPE(SRDataPoint)

@interface SRDataFile : RLMObject

@property NSString *username;
@property NSString *desc;
@property NSString *timezone;
/* need to do something about device_info */

@property NSInteger sampleInterval;
@property BOOL accEnabled;
@property BOOL magEnabled;
@property BOOL gyroEnabled;

@property NSDate *dateStart;
@property NSDate *dateEnd;
@property NSInteger fileId;

@property RLMArray<SRDataPoint> *dataPoints;

@end
RLM_ARRAY_TYPE(SRDataFile)

Add arrays to the data model.

Add arrays to the data model.


// Copyright (c) 2022 The Bitcoin Core developers
// Distributed under the MIT software license, see the accompanying
// file COPYING or https://www.opensource.org/licenses/mit-license.php.

#ifndef BITCOIN_UTIL_RESULT_H
#define BITCOIN_UTIL_RESULT_H

#include <util/translation.h>
#include <variant>

/*
 * 'BResult' is a generic class useful for wrapping a return object
 * (in case of success) or propagating the error cause.
*/
template<class T>
class BResult {
private:
    std::variant<bilingual_str, T> m_variant;

public:
    BResult() : m_variant(Untranslated("")) {}
    BResult(const T& _obj) : m_variant(_obj) {}
    BResult(const bilingual_str& error) : m_variant(error) {}

    /* Whether the function succeeded or not */
    bool HasRes() const { return std::holds_alternative<T>(m_variant); }

    /* In case of success, the result object */
    const T& GetObj() const {
        assert(HasRes());
        return std::get<T>(m_variant);
    }

    /* In case of failure, the error cause */
    const bilingual_str& GetError() const {
        assert(!HasRes());
        return std::get<bilingual_str>(m_variant);
    }

    explicit operator bool() const { return HasRes(); }
};

#endif // BITCOIN_UTIL_RESULT_H

// Copyright (c) 2022 The Bitcoin Core developers
// Distributed under the MIT software license, see the accompanying
// file COPYING or https://www.opensource.org/licenses/mit-license.php.

#ifndef BITCOIN_UTIL_RESULT_H
#define BITCOIN_UTIL_RESULT_H

#include <util/translation.h>

#include <variant>

/*
 * 'BResult' is a generic class useful for wrapping a return object
 * (in case of success) or propagating the error cause.
*/
template<class T>
class BResult {
private:
    std::variant<bilingual_str, T> m_variant;

public:
    BResult() : m_variant{Untranslated("")} {}
    BResult(T obj) : m_variant{std::move(obj)} {}
    BResult(bilingual_str error) : m_variant{std::move(error)} {}

    /* Whether the function succeeded or not */
    bool HasRes() const { return std::holds_alternative<T>(m_variant); }

    /* In case of success, the result object */
    const T& GetObj() const {
        assert(HasRes());
        return std::get<T>(m_variant);
    }
    T ReleaseObj()
    {
        assert(HasRes());
        return std::move(std::get<T>(m_variant));
    }

    /* In case of failure, the error cause */
    const bilingual_str& GetError() const {
        assert(!HasRes());
        return std::get<bilingual_str>(m_variant);
    }

    explicit operator bool() const { return HasRes(); }
};

#endif // BITCOIN_UTIL_RESULT_H

Prepare BResult for non-copyable types

Prepare BResult for non-copyable types


/*
 * BDSup2Sub++ (C) 2012 Adam T.
 * Based on code from BDSup2Sub by Copyright 2009 Volker Oth (0xdeadbeef)
 * and Copyright 2012 Miklos Juhasz (mjuhasz)
 *
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *    http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

#ifndef PALETTEINFO_H
#define PALETTEINFO_H

class PaletteInfo
{
public:
    PaletteInfo();
    PaletteInfo(const PaletteInfo* other);
    PaletteInfo(const PaletteInfo& other);

    int paletteOffset() { return offset; }
    void setPaletteOffset(int paletteOffset) { offset = paletteOffset; }
    int paletteSize() { return size; }
    void setPaletteSize(int paletteSize) { size = paletteSize; }

private:
    int offset = 0;
    int size = 0;
};

#endif // PALETTEINFO_H

/*
 * BDSup2Sub++ (C) 2012 Adam T.
 * Based on code from BDSup2Sub by Copyright 2009 Volker Oth (0xdeadbeef)
 * and Copyright 2012 Miklos Juhasz (mjuhasz)
 *
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *    http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

#ifndef PALETTEINFO_H
#define PALETTEINFO_H

class PaletteInfo
{
public:
    PaletteInfo();
    PaletteInfo(const PaletteInfo* other);
    PaletteInfo(const PaletteInfo& other);

    int paletteOffset() { return offset; }
    void setPaletteOffset(int paletteOffset) { offset = paletteOffset; }
    int paletteSize() { return size; }
    void setPaletteSize(int paletteSize) { size = paletteSize; }

private:
    int offset = -1;
    int size = -1;
};

#endif // PALETTEINFO_H

Change default values to -1.

Change default values to -1.


/** @file
  GUID for IntelFrameworkModulePkg PCD Token Space

  Copyright (c) 2009, Intel Corporation
  All rights reserved. This program and the accompanying materials
  are licensed and made available under the terms and conditions of the BSD License
  which accompanies this distribution.  The full text of the license may be found at
  http://opensource.org/licenses/bsd-license.php

  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.

**/

#ifndef _INTEL_FRAMEWOKR_MODULEPKG_TOKEN_SPACE_GUID_H_
#define _INTEL_FRAMEWOKR_MODULEPKG_TOKEN_SPACE_GUID_H_

#define INTEL_FRAMEWORK_MODULEPKG_TOKEN_SPACE_GUID \
  { \
    0x914AEBE7, 0x4635, 0x459b, { 0xAA, 0x1C, 0x11, 0xE2, 0x19, 0xB0, 0x3A, 0x10 } \
  }

extern EFI_GUID gEfiIntelFrameworkModulePkgTokenSpaceGuid;

#endif

Add the missing Token Space Guid

Add the missing Token Space Guid

git-svn-id: 5648d1bec6962b0a6d1d1b40eba8cf5cdb62da3d@8500 6f19259b-4bc3-4df7-8a09-765794883524


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

// Multiply-included file, hence no include guard.
// Inclusion of all message files present in the system.  Keep this file
// up-to-date when adding a new value to enum IPCMessageStart in
// ipc/ipc_message_utils.h to include the corresponding message file.
#include "chrome/browser/importer/profile_import_process_messages.h"
#include "chrome/common/automation_messages.h"
#include "chrome/common/common_message_generator.h"
#include "chrome/common/nacl_messages.h"
#include "content/common/content_message_generator.h"
#include "ppapi/proxy/ppapi_messages.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.

// Multiply-included file, hence no include guard.
// Inclusion of all message files present in the system.  Keep this file
// up-to-date when adding a new value to enum IPCMessageStart in
// ipc/ipc_message_utils.h to include the corresponding message file.
#include "chrome/browser/importer/profile_import_process_messages.h"
#include "chrome/common/common_message_generator.h"
#include "chrome/common/nacl_messages.h"
#include "content/common/content_message_generator.h"
#include "content/common/pepper_messages.h"
#include "ppapi/proxy/ppapi_messages.h"

Fix build break from bad merge

Fix build break from bad merge

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


/*
 * Copyright (C) 2013 Klaus Reimer (k@ailis.de)
 * See COPYING file for copying conditions
 */

#include "DeviceList.h"
#include "Device.h"

void setDeviceList(JNIEnv* env, libusb_device** list, int size, jobject object)
{
    SET_POINTER(env, list, object, "deviceListPointer");

    jclass cls = (*env)->GetObjectClass(env, object);
    jfieldID field = (*env)->GetFieldID(env, cls, "size", "I");
    (*env)->SetIntField(env, object, field, size);
}

libusb_device** unwrapDeviceList(JNIEnv* env, jobject list)
{
    UNWRAP_POINTER(env, list, libusb_device**, "deviceListPointer");
}

void resetDeviceList(JNIEnv* env, jobject obj)
{
    RESET_POINTER(env, obj, "deviceListPointer");
}

/**
 * Device get(index)
 */
JNIEXPORT jobject JNICALL METHOD_NAME(DeviceList, get)
(
    JNIEnv *env, jobject this, jint index
)
{
    jclass cls = (*env)->GetObjectClass(env, this);
    jfieldID field = (*env)->GetFieldID(env, cls, "size", "I");
    int size = (*env)->GetIntField(env, this, field);
    if (index < 0 || index >= size) return NULL;
    return wrapDevice(env, unwrapDeviceList(env, this)[index]);
}

/*
 * Copyright (C) 2013 Klaus Reimer (k@ailis.de)
 * See COPYING file for copying conditions
 */

#include "DeviceList.h"
#include "Device.h"

void setDeviceList(JNIEnv* env, libusb_device** list, int size, jobject object)
{
    SET_POINTER(env, list, object, "deviceListPointer");

    jclass cls = (*env)->GetObjectClass(env, object);
    jfieldID field = (*env)->GetFieldID(env, cls, "size", "I");
    (*env)->SetIntField(env, object, field, size);
}

libusb_device** unwrapDeviceList(JNIEnv* env, jobject list)
{
    UNWRAP_POINTER(env, list, libusb_device**, "deviceListPointer");
}

void resetDeviceList(JNIEnv* env, jobject obj)
{
    RESET_POINTER(env, obj, "deviceListPointer");

    // Reset size to zero too.
    jclass cls = (*env)->GetObjectClass(env, obj);
    jfieldID field = (*env)->GetFieldID(env, cls, "size", "I");
    (*env)->SetIntField(env, object, field, 0);
}

/**
 * Device get(index)
 */
JNIEXPORT jobject JNICALL METHOD_NAME(DeviceList, get)
(
    JNIEnv *env, jobject this, jint index
)
{
    jclass cls = (*env)->GetObjectClass(env, this);
    jfieldID field = (*env)->GetFieldID(env, cls, "size", "I");
    int size = (*env)->GetIntField(env, this, field);
    if (index < 0 || index >= size) return NULL;
    return wrapDevice(env, unwrapDeviceList(env, this)[index]);
}

Set size to zero on reset. Else getting the size is incorrect, and later when checking in get() it would pass the check and you'd access a NULL ptr.


/*
 * Exported interface to downloadable microcode for AdvanSys SCSI Adapters
 *
 * $FreeBSD$
 *
 * Obtained from:
 *
 * Copyright (c) 1995-1999 Advanced System Products, Inc.
 * All Rights Reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that redistributions of source
 * code retain the above copyright notice and this comment without
 * modification.
 */

extern u_int16_t adv_mcode[];
extern u_int16_t adv_mcode_size;
extern u_int32_t adv_mcode_chksum;

/*
 * Exported interface to downloadable microcode for AdvanSys SCSI Adapters
 *
 * $FreeBSD$
 *
 * Obtained from:
 *
 * Copyright (c) 1995-1999 Advanced System Products, Inc.
 * All Rights Reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that redistributions of source
 * code retain the above copyright notice and this comment without
 * modification.
 */

extern u_int8_t adv_mcode[];
extern u_int16_t adv_mcode_size;
extern u_int32_t adv_mcode_chksum;

Make the extern for adv_mcode match the reality: it's u_int8_t, but probably unendiansafely used as u_int16_t.


#include <pthread.h>

int myglobal;

void *t_fun(void *arg) {
  myglobal=1; // RACE!
  return NULL;
}

int main(void) {
  pthread_t id;
  pthread_create(&id, NULL, t_fun, NULL);
  myglobal = myglobal+1; // RACE!
  return 0;
}

Add regression test where TD3 aborting with self-dependency and fixed switch to Narrow is unsound


/* Exercise 5-2 */

#include <unistd.h>
#include <fcntl.h>
#include "tlpi_hdr.h"

int main (int argc, char *argv[]) {
  if (argc != 2) {
    usageErr("%s filename", argv[0]);
  }

  int fd = open(argv[1], O_WRONLY | O_APPEND | O_CREAT | O_TRUNC, S_IWUSR | S_IRUSR);
  if (fd == -1) { errExit("open"); }
  char s[] = "abcdefghi";
  char t[] = "jklmnopqr";
  if (write(fd, s, strlen(s)) != strlen(s)) { errExit("write 1"); }
  if (lseek(fd, 0, SEEK_SET) == -1) { errExit("seeking"); }
  if (write(fd, t, strlen(t)) != strlen(t)) { errExit("write 2"); }
  exit(EXIT_SUCCESS);
}

/* Exercise 5-2 */

#include <unistd.h>
#include <fcntl.h>
#include "tlpi_hdr.h"

int main (int argc, char *argv[]) {
  if (argc != 2) {
    usageErr("%s filename", argv[0]);
  }

  int fd = open(argv[1], O_WRONLY | O_APPEND | O_CREAT | O_TRUNC, S_IWUSR | S_IRUSR);
  if (fd == -1) { errExit("open"); }
  char s[] = "abcdefghi";
  char t[] = "jklmnopqr";
  if (write(fd, s, strlen(s)) != strlen(s)) { errExit("write 1"); }
  if (lseek(fd, 0, SEEK_SET) == -1) { errExit("seeking"); }
  if (write(fd, t, strlen(t)) != strlen(t)) { errExit("write 2"); }
  if (close(fd) == -1) { errExit("close output"); }
  exit(EXIT_SUCCESS);
}

Add missing close for file descriptor

Add missing close for file descriptor


#include <config.h>

#include <dlfcn.h>

#include <test-fixtures/test-unit.h>

int
main (int argc, char **argv)
{
  const CoglUnitTest *unit_test;
  int i;

  if (argc != 2)
    {
      g_printerr ("usage %s UNIT_TEST\n", argv[0]);
      exit (1);
    }

  /* Just for convenience in case people try passing the wrapper
   * filenames for the UNIT_TEST argument we normalize '-' characters
   * to '_' characters... */
  for (i = 0; argv[1][i]; i++)
    {
      if (argv[1][i] == '-')
        argv[1][i] = '_';
    }

  unit_test = dlsym (RTLD_DEFAULT, argv[1]);
  if (!unit_test)
    {
      g_printerr ("Unknown test name \"%s\"\n", argv[1]);
      return 1;
    }

  test_utils_init (unit_test->requirement_flags,
                   unit_test->known_failure_flags);
  unit_test->run ();
  test_utils_fini ();

  return 0;
}

#include <config.h>

#include <gmodule.h>

#include <test-fixtures/test-unit.h>

int
main (int argc, char **argv)
{
  GModule *main_module;
  const CoglUnitTest *unit_test;
  int i;

  if (argc != 2)
    {
      g_printerr ("usage %s UNIT_TEST\n", argv[0]);
      exit (1);
    }

  /* Just for convenience in case people try passing the wrapper
   * filenames for the UNIT_TEST argument we normalize '-' characters
   * to '_' characters... */
  for (i = 0; argv[1][i]; i++)
    {
      if (argv[1][i] == '-')
        argv[1][i] = '_';
    }

  main_module = g_module_open (NULL, /* use main module */
                               0 /* flags */);

  if (!g_module_symbol (main_module, argv[1], (void **) &unit_test))
    {
      g_printerr ("Unknown test name \"%s\"\n", argv[1]);
      return 1;
    }

  test_utils_init (unit_test->requirement_flags,
                   unit_test->known_failure_flags);
  unit_test->run ();
  test_utils_fini ();

  return 0;
}

Use GModule instead of libdl to load unit test symbols

Previously the unit tests were using libdl without directly linking to
it. It looks like this ends up working because one of Cogl's
dependencies ends up pulling adding -ldl via libtool. However in some
configurations it looks like this wasn't happening.

To avoid this problem we can just use GModule to resolve the symbols.
g_module_open is documented to return a handle to the ‘main program’
when NULL is passed as the filename and looking at the code it seems
that this ends up using RTLD_DEFAULT so it will have the same effect.

The in-tree copy of glib already has the code for gmodule so this
shouldn't cause problems for --disable-glib.

Reviewed-by: Robert Bragg <12e9293ec6b30c7fa8a0926af42807e929c1684f@linux.intel.com>


// Copyright 2019 Oath Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.

// Disable warnings emitted by protoc generated files
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wsuggest-override"

#include "feed.pb.h"
#include "visiting.pb.h"
#include "maintenance.pb.h"

#pragma GCC diagnostic pop

// Copyright 2019 Oath Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.

#pragma once

// Disable warnings emitted by protoc generated files
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wsuggest-override"

#include "feed.pb.h"
#include "visiting.pb.h"
#include "maintenance.pb.h"

#pragma GCC diagnostic pop

Add missing header pragma directive

Add missing header pragma directive


// Copyright (c) 2009 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_APP_SCOPED_OLE_INITIALIZER_H_
#define CHROME_APP_SCOPED_OLE_INITIALIZER_H_

// Wraps OLE initialization in a cross-platform class meant to be used on the
// stack so init/uninit is done with scoping. This class is ok for use by
// non-windows platforms; it just doesn't do anything.

#if defined(OS_WIN)

#include <ole2.h>

class ScopedOleInitializer {
 public:
  ScopedOleInitializer() {
    int ole_result = OleInitialize(NULL);
    DCHECK(ole_result == S_OK);
  }
  ~ScopedOleInitializer() {
    OleUninitialize();
  }
};

#else

class ScopedOleInitializer {
 public:
  // Empty, this class does nothing on non-win32 systems. Empty ctor is
  // necessary to avoid "unused variable" warning on gcc.
  ScopedOleInitializer() { }
};

#endif

#endif  // CHROME_APP_SCOPED_OLE_INITIALIZER_H_

// Copyright (c) 2009 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_APP_SCOPED_OLE_INITIALIZER_H_
#define CHROME_APP_SCOPED_OLE_INITIALIZER_H_

#include "base/logging.h"
#include "build/build_config.h"

// Wraps OLE initialization in a cross-platform class meant to be used on the
// stack so init/uninit is done with scoping. This class is ok for use by
// non-windows platforms; it just doesn't do anything.

#if defined(OS_WIN)

#include <ole2.h>

class ScopedOleInitializer {
 public:
  ScopedOleInitializer() {
    int ole_result = OleInitialize(NULL);
    DCHECK(ole_result == S_OK);
  }
  ~ScopedOleInitializer() {
    OleUninitialize();
  }
};

#else

class ScopedOleInitializer {
 public:
  // Empty, this class does nothing on non-win32 systems. Empty ctor is
  // necessary to avoid "unused variable" warning on gcc.
  ScopedOleInitializer() { }
};

#endif

#endif  // CHROME_APP_SCOPED_OLE_INITIALIZER_H_

Make ScopedOleInitializer work on windows if you aren't including
build_config already.

BUG=none
TEST=none

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

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


/* gp-proc.c -- Information extracted from /proc
--  Copyright (C) 2014 Stephane Carrez
--  Written by Stephane Carrez (Stephane.Carrez@gmail.com)
--
--  Licensed under the Apache License, Version 2.0 (the "License");
--  you may not use this file except in compliance with the License.
--  You may obtain a copy of the License at
--
--      http://www.apache.org/licenses/LICENSE-2.0
--
--  Unless required by applicable law or agreed to in writing, software
--  distributed under the License is distributed on an "AS IS" BASIS,
--  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
--  See the License for the specific language governing permissions and
--  limitations under the License.
*/
#ifndef _GP_PROC_H
#define _GP_PROC_H

#define MAP_R_OK 0x01
#define MAP_W_OK 0x02
#define MAP_X_OK 0x04
#define MAP_PRIV 0x08

typedef struct map_info
{
  void* start;
  void* end;
  int   flags;
  char* name;
} map_info_t;

typedef void (* gp_extract_map_callback) (map_info_t* map, void* data);

/**
 * @brief Read the process /proc/<pid>/maps file.
 *
 * @param pid the process id.
 * @param callback the callback execute for each map entry.
 * @param data the callback data.
 */
extern void
gp_read_proc_maps (int pid, gp_extract_map_callback callback, void *data);

#endif

Support to read and extract information from /proc/<pid>/maps


/*
    The Breakout class holds all of the game logic. It is derived from the QWidget class to allow it to display in a Qt window.
    It handles all input events, game updates, and painting events. It also handles the current game state.
*/
#ifndef BREAKOUT_H
#define BREAKOUT_H

#include "ball.h"
#include "brick.h"
#include "paddle.h"
#include <QWidget>
#include <QKeyEvent>

class Breakout : public QWidget
{
    Q_OBJECT

public:
    //Constructor and Destructor
    Breakout(QWidget *parent = 0);
    ~Breakout();
protected:
    //Events
    void paintEvent(QPaintEvent* event);
    void timerEvent(QTimerEvent* event);
    void keyPressEvent(QKeyEvent* event);

    //Functions dependent on the current game state
    void startGame();
    void pauseGame();
    void stopGame();
    void victory();

    //Function to check for collision of GameObjects
    void checkCollision();
private:
    //Variable to keep track of QTimerId
    int timerId;

    //The GameObjects
    Ball* ball;
    Paddle* paddle;
    Brick* bricks[30];

    //The game states
    bool gameOver, gameWon, gameStarted, paused;
};

#endif // BREAKOUT_H

/*
    The Breakout class holds all of the game logic. It is derived from the QWidget class to allow it to display in a Qt window.
    It handles all input events, game updates, and painting events. It also handles the current game state.
*/
#ifndef BREAKOUT_H
#define BREAKOUT_H

#include "ball.h"
#include "brick.h"
#include "paddle.h"
#include <QWidget>
#include <QKeyEvent>

class Breakout : public QWidget
{
    Q_OBJECT

public:
    //Constructor and Destructor
    Breakout(QWidget *parent = 0);
    ~Breakout();
protected:
    //Events
    void paintEvent(QPaintEvent* event);
    void timerEvent(QTimerEvent* event);
    void keyPressEvent(QKeyEvent* event);

    //Functions dependent on the current game state
    void startGame();
    void pauseGame();
    void stopGame();
    void victory();

    //Function to check for collision of GameObjects
    void checkCollision();
private:
    //Variable to keep track of QTimerId
    int timerId;

    //The GameObjects
    Ball* ball;
    Paddle* paddle;
    std::vector<Brick*> bricks;

    //The game states
    bool gameOver, gameWon, gameStarted, paused;
};

#endif // BREAKOUT_H

Convert bricks to a std::vector

Convert bricks to a std::vector


/*!
 * @brief Template C-header file
 *
 * This is a template C-header file
 * @author  <+AUTHOR+>
 * @date    <+DATE+>
 * @file    <+FILE+>
 * @version 0.1
 */
#ifndef <+FILE_CAPITAL+>_H
#define <+FILE_CAPITAL+>_H

#if defined(_MSC_VER)
#  define <+FILE_CAPITAL+>_DLLEXPORT  __declspec(dllexport)
#elif defined(__GNUC__)
#  define <+FILE_CAPITAL+>_DLLEXPORT  __attribute__((dllexport))
#else
#  define DLLEXPORT
#endif

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

<+CURSOR+>

#ifdef __cplusplus
}  /* extern "C" */
#endif  /* __cplusplus */
#endif  /* <+FILE_CAPITAL+>_H */

/*!
 * @brief Template C-header file
 *
 * This is a template C-header file
 * @author  <+AUTHOR+>
 * @date    <+DATE+>
 * @file    <+FILE+>
 * @version 0.1
 */
#ifndef <+FILE_CAPITAL+>_H
#define <+FILE_CAPITAL+>_H

#if defined(_MSC_VER)
#  define <+FILE_CAPITAL+>_DLLEXPORT  __declspec(dllexport)
#elif defined(__GNUC__)
#  define <+FILE_CAPITAL+>_DLLEXPORT  __attribute__((dllexport))
#else
#  define <+FILE_CAPITAL+>_DLLEXPORT
#endif

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

<+CURSOR+>

#ifdef __cplusplus
}  /* extern "C" */
#endif  /* __cplusplus */
#undef <+FILE_CAPITAL+>_DLLEXPORT
#endif  /* <+FILE_CAPITAL+>_H */

Add macro for DLL exportation

Add macro for DLL exportation


// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.

#pragma once

#include <vespa/eval/eval/tensor_function.h>

namespace vespalib::eval {

/**
 * Tensor function that will count the number of cells in the result
 * of a join between two tensors with full mapped overlap consisting
 * of a single dimension.
 **/
class SimpleJoinCount : public tensor_function::Op2
{
private:
    uint64_t _dense_factor;
public:
    SimpleJoinCount(const TensorFunction &lhs_in, const TensorFunction &rhs_in, size_t dense_factor_in);
    InterpretedFunction::Instruction compile_self(const ValueBuilderFactory &factory, Stash &stash) const override;
    bool result_is_mutable() const override { return true; }
    uint64_t dense_factor() const { return _dense_factor; }
    static const TensorFunction &optimize(const TensorFunction &expr, Stash &stash);
};

} // namespace

// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.

#pragma once

#include <vespa/eval/eval/tensor_function.h>

namespace vespalib::eval {

/**
 * Tensor function that will count the number of cells in the result
 * of a join between two tensors with full mapped overlap consisting
 * of a single dimension.
 **/
class SimpleJoinCount : public tensor_function::Op2
{
private:
    uint64_t _dense_factor;
public:
    SimpleJoinCount(const TensorFunction &lhs_in, const TensorFunction &rhs_in, uint64_t dense_factor_in);
    InterpretedFunction::Instruction compile_self(const ValueBuilderFactory &factory, Stash &stash) const override;
    bool result_is_mutable() const override { return true; }
    uint64_t dense_factor() const { return _dense_factor; }
    static const TensorFunction &optimize(const TensorFunction &expr, Stash &stash);
};

} // namespace

Adjust SimpleJoinCount constructor argument type.