/* This work is licensed under a Creative Commons CCZero 1.0 Universal License.
 * See http://creativecommons.org/publicdomain/zero/1.0/ for more information. */

#include "ua_util.h"

#include <ctype.h>
#include <stdio.h>
void UA_dump_hex_pkg(UA_Byte* buffer, size_t bufferLen) {
    printf("--------------- HEX Package Start ---------------\n");
    char ascii[17];
    memset(ascii,0,17);
    for (size_t i = 0; i < bufferLen; i++)
    {
        if (i == 0)
            printf("%08zx ", i);
        else if (i%16 == 0)
            printf("|%s|\n%08zx ", ascii, i);
        if (isprint((int)(buffer[i])))
            ascii[i%16] = (char)buffer[i];
        else
            ascii[i%16] = '.';
        printf("%02X ", (unsigned char)buffer[i]);
    }
    size_t fillPos = bufferLen %16;
    ascii[fillPos] = 0;
    for (size_t i=fillPos; i<16; i++) {
        printf("   ");
    }
    printf("|%s|\n%08zx\n", ascii, bufferLen);
    printf("--------------- HEX Package END ---------------\n");
}

/* This work is licensed under a Creative Commons CCZero 1.0 Universal License.
 * See http://creativecommons.org/publicdomain/zero/1.0/ for more information. */

#include "ua_util.h"

#include <ctype.h>
#include <stdio.h>
void UA_dump_hex_pkg(UA_Byte* buffer, size_t bufferLen) {
    printf("--------------- HEX Package Start ---------------\n");
    char ascii[17];
    memset(ascii,0,17);
    for (size_t i = 0; i < bufferLen; i++)
    {
        if (i == 0)
            printf("%08zx ", i);
        else if (i%16 == 0)
            printf(" |%s|\n%08zx ", ascii, i);
        if (isprint((int)(buffer[i])))
            ascii[i%16] = (char)buffer[i];
        else
            ascii[i%16] = '.';
        if (i%8==0)
            printf(" ");
        printf("%02X ", (unsigned char)buffer[i]);

    }
    size_t fillPos = bufferLen %16;
    ascii[fillPos] = 0;
    for (size_t i=fillPos; i<16; i++) {
        if (i%8==0)
            printf(" ");
        printf("   ");
    }
    printf(" |%s|\n%08zx\n", ascii, bufferLen);
    printf("--------------- HEX Package END ---------------\n");
}

Align format with `hexdump -C`

Align format with `hexdump -C`


//
//  TWTValidationLocalization.h
//  TWTValidation
//
//  Created by Prachi Gauriar on 4/3/2014.
//  Copyright (c) 2014 Two Toasters, LLC. All rights reserved.
//

#define TWTLocalizedString(key) \
    [[NSBundle bundleForClass:[self class]] localizedStringForKey:(key) value:@"" table:@"TWTValidation"]

//
//  TWTValidationLocalization.h
//  TWTValidation
//
//  Created by Prachi Gauriar on 4/3/2014.
//  Copyright (c) 2014 Two Toasters, LLC.
//
//  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.
//

#define TWTLocalizedString(key) \
    [[NSBundle bundleForClass:[self class]] localizedStringForKey:(key) value:@"" table:@"TWTValidation"]

Add license to localization header

Add license to localization header


//
//  BDSKSearchGroupViewController.h
//  Bibdesk
//
//  Created by Christiaan Hofman on 1/2/07.
/*
 This software is Copyright (c) 2007
 Christiaan Hofman. All rights reserved.

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

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

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

 - Neither the name of Christiaan Hofman nor the names of any
 contributors may be used to endorse or promote products derived
 from this software without specific prior written permission.

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

#import <Cocoa/Cocoa.h>

@class BDSKCollapsibleView, BDSKEdgeView, BDSKSearchGroup;

@interface BDSKSearchGroupViewController : NSWindowController {
    IBOutlet BDSKCollapsibleView *view;
    IBOutlet BDSKEdgeView *edgeView;
    IBOutlet NSSearchField *searchField;
    IBOutlet NSButton *searchButton;

    BDSKSearchGroup *group;
}

- (NSView *)view;

- (BDSKSearchGroup *)group;
- (void)setGroup:(BDSKSearchGroup *)newGroup;

- (IBAction)changeSearchTerm:(id)sender;
- (IBAction)nextSearch:(id)sender;

@end

Add new header file. (or: xcode is stupid)


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

#ifndef CHROME_BROWSER_UI_PANELS_PANEL_BROWSER_WINDOW_GTK_H_
#define CHROME_BROWSER_UI_PANELS_PANEL_BROWSER_WINDOW_GTK_H_

#include "chrome/browser/ui/gtk/browser_window_gtk.h"

class Panel;

class PanelBrowserWindowGtk : public BrowserWindowGtk {
 public:
  PanelBrowserWindowGtk(Browser* browser, Panel* panel);
  virtual ~PanelBrowserWindowGtk() {}

  // BrowserWindowGtk overrides
  virtual void Init() OVERRIDE;

  // BrowserWindow overrides
  virtual void SetBounds(const gfx::Rect& bounds) OVERRIDE;

 protected:
  // BrowserWindowGtk overrides
  virtual bool GetWindowEdge(int x, int y, GdkWindowEdge* edge) OVERRIDE;
  virtual bool HandleTitleBarLeftMousePress(
      GdkEventButton* event,
      guint32 last_click_time,
      gfx::Point last_click_position) OVERRIDE;
  virtual void SaveWindowPosition() OVERRIDE;
  virtual void SetGeometryHints() OVERRIDE;
  virtual bool UseCustomFrame() OVERRIDE;

 private:
  void SetBoundsImpl();

  scoped_ptr<Panel> panel_;
  DISALLOW_COPY_AND_ASSIGN(PanelBrowserWindowGtk);
};

#endif  // CHROME_BROWSER_UI_PANELS_PANEL_BROWSER_WINDOW_GTK_H_

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

#ifndef CHROME_BROWSER_UI_PANELS_PANEL_BROWSER_WINDOW_GTK_H_
#define CHROME_BROWSER_UI_PANELS_PANEL_BROWSER_WINDOW_GTK_H_

#include "chrome/browser/ui/gtk/browser_window_gtk.h"

class Panel;

class PanelBrowserWindowGtk : public BrowserWindowGtk {
 public:
  PanelBrowserWindowGtk(Browser* browser, Panel* panel);
  virtual ~PanelBrowserWindowGtk() {}

  // BrowserWindowGtk overrides
  virtual void Init() OVERRIDE;

  // BrowserWindow overrides
  virtual void SetBounds(const gfx::Rect& bounds) OVERRIDE;

 protected:
  // BrowserWindowGtk overrides
  virtual bool GetWindowEdge(int x, int y, GdkWindowEdge* edge) OVERRIDE;
  virtual bool HandleTitleBarLeftMousePress(
      GdkEventButton* event,
      guint32 last_click_time,
      gfx::Point last_click_position) OVERRIDE;
  virtual void SaveWindowPosition() OVERRIDE;
  virtual void SetGeometryHints() OVERRIDE;
  virtual bool UseCustomFrame() OVERRIDE;

 private:
  void SetBoundsImpl();

  Panel* panel_;
  DISALLOW_COPY_AND_ASSIGN(PanelBrowserWindowGtk);
};

#endif  // CHROME_BROWSER_UI_PANELS_PANEL_BROWSER_WINDOW_GTK_H_

Revert 88154 - Use scoped_ptr for Panel in PanelBrowserWindowGTK.
Reason: PanelBrowserWindow dtor is now complex and cannot be inlined.

BUG=None
TEST=Verified WindowOpenPanel test now hits Panel destructor.

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

TBR=jennb@chromium.org
Review URL: http://codereview.chromium.org/7003035

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


/*
** Hook functions for integration with the Floating Temple distributed
** interpreter
*/

#include <stddef.h>

#define floating_temple_c
#define LUA_CORE

#include "lua.h"

#include "floating_temple.h"
#include "lobject.h"
#include "luaconf.h"

static int ft_defaultnewstringhook (lua_State *L, StkId obj, const char *str,
                                    size_t len) {
  return 0;
}

static int ft_defaultnewtablehook (lua_State *L, StkId obj, int b, int c) {
  return 0;
}

#define FT_DEFINE_HOOK_FUNC(install_func, hook_type, hook_var, \
                            default_hook_func) \
  LUAI_DDEF hook_type hook_var = &default_hook_func; \
\
  LUA_API hook_type install_func (hook_type hook) { \
    hook_type old_hook = hook_var; \
    hook_var = hook; \
    return old_hook; \
  }

FT_DEFINE_HOOK_FUNC(ft_installnewstringhook, ft_NewStringHook, ft_newstringhook,
                    ft_defaultnewstringhook)

FT_DEFINE_HOOK_FUNC(ft_installnewtablehook, ft_NewTableHook, ft_newtablehook,
                    ft_defaultnewtablehook)

#undef FT_DEFINE_HOOK_FUNC

/*
** Hook functions for integration with the Floating Temple distributed
** interpreter
*/

#include <stddef.h>

#define floating_temple_c
#define LUA_CORE

#include "lua.h"

#include "floating_temple.h"
#include "lobject.h"
#include "luaconf.h"

#define FT_DEFINE_HOOK_FUNC(install_func, hook_type, hook_var, hook_params, \
                            default_hook_func) \
  static int default_hook_func hook_params { \
    return 0; \
  } \
\
  LUAI_DDEF hook_type hook_var = &default_hook_func; \
\
  LUA_API hook_type install_func (hook_type hook) { \
    hook_type old_hook = hook_var; \
    hook_var = hook; \
    return old_hook; \
  }

FT_DEFINE_HOOK_FUNC(ft_installnewstringhook, ft_NewStringHook, ft_newstringhook,
                    (lua_State *L, StkId obj, const char *str, size_t len),
                    ft_defaultnewstringhook)

FT_DEFINE_HOOK_FUNC(ft_installnewtablehook, ft_NewTableHook, ft_newtablehook,
                    (lua_State *L, StkId obj, int b, int c),
                    ft_defaultnewtablehook)

#undef FT_DEFINE_HOOK_FUNC

Add the definition of the default hook function to the FT_DEFINE_HOOK_FUNCTION macro.


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

#ifndef CONTENT_BROWSER_RENDERER_HOST_QUOTA_DISPATCHER_HOST_H_
#define CONTENT_BROWSER_RENDERER_HOST_QUOTA_DISPATCHER_HOST_H_

#include "base/basictypes.h"
#include "content/browser/browser_message_filter.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/WebStorageQuotaType.h"

class GURL;

class QuotaDispatcherHost : public BrowserMessageFilter {
 public:
  ~QuotaDispatcherHost();
  bool OnMessageReceived(const IPC::Message& message, bool* message_was_ok);

 private:
  void OnQueryStorageUsageAndQuota(
      int request_id,
      const GURL& origin_url,
      WebKit::WebStorageQuotaType type);
  void OnRequestStorageQuota(
      int request_id,
      const GURL& origin_url,
      WebKit::WebStorageQuotaType type,
      int64 requested_size);
};

#endif  // CONTENT_BROWSER_RENDERER_HOST_QUOTA_DISPATCHER_HOST_H_

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

#ifndef CONTENT_BROWSER_RENDERER_HOST_QUOTA_DISPATCHER_HOST_H_
#define CONTENT_BROWSER_RENDERER_HOST_QUOTA_DISPATCHER_HOST_H_

#include "base/basictypes.h"
#include "content/browser/browser_message_filter.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/WebStorageQuotaType.h"

class GURL;

class QuotaDispatcherHost : public BrowserMessageFilter {
 public:
  ~QuotaDispatcherHost();
  virtual bool OnMessageReceived(const IPC::Message& message,
                                 bool* message_was_ok);

 private:
  void OnQueryStorageUsageAndQuota(
      int request_id,
      const GURL& origin_url,
      WebKit::WebStorageQuotaType type);
  void OnRequestStorageQuota(
      int request_id,
      const GURL& origin_url,
      WebKit::WebStorageQuotaType type,
      int64 requested_size);
};

#endif  // CONTENT_BROWSER_RENDERER_HOST_QUOTA_DISPATCHER_HOST_H_

Fix clang build that have been broken by 81364.

BUG=none
TEST=green tree
TBR=jam

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

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


/**
 * @file
 *
 * @brief
 *
 * @date 09.11.2013
 * @author Anton Bondarev
 */

union idesc_table_entry {
	unsigned int flags;
	struct idesc *idesc;
};

struct idesc_table {
	union idesc_table_entry idesc_entry[TASKS_RES_QUANTITY];
	struct indexator indexator;
};

int idesc_table_add(struct idesc *idesc, int cloexec) {
	struct task task;
	struct idesc_table *idesc_table;
	int idx;

	task = task_self();
	idesc_table = &task->idesc_table;

	idx = index_alloc(&idesc_table->indexator, INDEX_MIN);

	idesc_table->idesc_entry[idx] = idesc;

	return idx;
}

int idesc_table_del(int idx) {
	struct task task;
	struct idesc_table *idesc_table;

	task = task_self();
	idesc_table = &task->idesc_table;

	idesc_table->idesc_entry[idx] = NULL;

	index_free(&idesc_table->indexator, idx);

	return 0;
}

struct idesc *idesc_table_get(int idx) {
	struct task task;
	struct idesc_table *idesc_table;

	task = task_self();
	idesc_table = &task->idesc_table;

	return idesc_table->idesc_entry[idx];
}

int idesc_table_init(struct idesc_table *idesc_table) {
	return 0;
}

Add some stubs for idec_table

desc: Add some stubs for idec_table


#ifndef INSTRUCTION_VISITOR_H_
#define INSTRUCTION_VISITOR_H_

#include "vm/instruction.h"
#include "vm/instructions.h"

namespace grok {
namespace vm {

class InstructionVisitor {
public:
#define DECLARE_VIRTUAL_METHOD(Instr, Class)    \
    virtual void Visit(Class##Instruction *instr) = 0;
INSTRUCTION_LIST_FOR_EACH(DECLARE_VIRTUAL_METHOD)
#undef DECLARE_VIRTUAL_METHOD
};

}
}

#endif

Add InstructionVisitor class for visitor pattern


#define FLT_DIG 	6
#define FLT_MANT_DIG 	24
#define FLT_MAX_10_EXP 	+38
#define FLT_MAX_EXP 	+128
#define FLT_MIN_10_EXP 	-37
#define FLT_MIN_EXP 	-125
#define FLT_RADIX 	2
#define FLT_MAX 	0x1.fffffep127f
#define FLT_MIN 	0x1.0p-126f
#define FLT_EPSILON 	0x1.0p-23f

#ifdef cl_khr_fp64

#define DBL_DIG 	15
#define DBL_MANT_DIG 	53
#define DBL_MAX_10_EXP 	+308
#define DBL_MAX_EXP 	+1024
#define DBL_MIN_10_EXP 	-307
#define DBL_MIN_EXP 	-1021
#define DBL_MAX 	0x1.fffffffffffffp1023
#define DBL_MIN 	0x1.0p-1022
#define DBL_EPSILON 	0x1.0p-52

#endif

#define FLT_DIG 	6
#define FLT_MANT_DIG 	24
#define FLT_MAX_10_EXP 	+38
#define FLT_MAX_EXP 	+128
#define FLT_MIN_10_EXP 	-37
#define FLT_MIN_EXP 	-125
#define FLT_RADIX 	2
#define FLT_MAX 	0x1.fffffep127f
#define FLT_MIN 	0x1.0p-126f
#define FLT_EPSILON 	0x1.0p-23f

#define M_PI_F 0x1.921fb6p+1

#ifdef cl_khr_fp64

#define DBL_DIG 	15
#define DBL_MANT_DIG 	53
#define DBL_MAX_10_EXP 	+308
#define DBL_MAX_EXP 	+1024
#define DBL_MIN_10_EXP 	-307
#define DBL_MIN_EXP 	-1021
#define DBL_MAX 	0x1.fffffffffffffp1023
#define DBL_MIN 	0x1.0p-1022
#define DBL_EPSILON 	0x1.0p-52

#endif

Add definition for M_PI_F v3

Add definition for M_PI_F v3

v2:
  - Use a hexadecimal constant.

v3:
  - Use a hexadecimal constant in floating-point notation.

git-svn-id: e7f1ab7c2a259259587475a3e7520e757882f167@204666 91177308-0d34-0410-b5e6-96231b3b80d8


// REQUIRES: clang-driver
// REQUIRES: powerpc-registered-target
// REQUIRES: nvptx-registered-target

//
// Verify that CUDA device commands do not get OpenMP flags.
//
// RUN: %clang -### -x cuda -target powerpc64le-linux-gnu -std=c++11 --cuda-gpu-arch=sm_35 -fopenmp %s 2>&1 \
// RUN: | FileCheck %s --check-prefix NO-OPENMP-FLAGS-FOR-CUDA-DEVICE
//
// NO-OPENMP-FLAGS-FOR-CUDA-DEVICE:      clang{{.*}}" "-cc1" "-triple" "nvptx64-nvidia-cuda"
// NO-OPENMP-FLAGS-FOR-CUDA-DEVICE-NOT:  -fopenmp
// NO-OPENMP-FLAGS-FOR-CUDA-DEVICE-NEXT: ptxas" "-m64"
// NO-OPENMP-FLAGS-FOR-CUDA-DEVICE-NEXT: fatbinary" "--cuda" "-64"
// NO-OPENMP-FLAGS-FOR-CUDA-DEVICE-NEXT: clang{{.*}}" "-cc1" "-triple" "powerpc64le--linux-gnu"
// NO-OPENMP-FLAGS-FOR-CUDA-DEVICE:      -fopenmp
// NO-OPENMP-FLAGS-FOR-CUDA-DEVICE-NEXT: ld" {{.*}}"-m" "elf64lppc"

// REQUIRES: clang-driver
// REQUIRES: powerpc-registered-target
// REQUIRES: nvptx-registered-target

//
// Verify that CUDA device commands do not get OpenMP flags.
//
// RUN: %clang -### -x cuda -target powerpc64le-linux-gnu -std=c++11 --cuda-gpu-arch=sm_35 -fopenmp=libomp %s 2>&1 \
// RUN: | FileCheck %s --check-prefix NO-OPENMP-FLAGS-FOR-CUDA-DEVICE
//
// NO-OPENMP-FLAGS-FOR-CUDA-DEVICE:      clang{{.*}}" "-cc1" "-triple" "nvptx64-nvidia-cuda"
// NO-OPENMP-FLAGS-FOR-CUDA-DEVICE-NOT:  -fopenmp
// NO-OPENMP-FLAGS-FOR-CUDA-DEVICE-NEXT: ptxas" "-m64"
// NO-OPENMP-FLAGS-FOR-CUDA-DEVICE-NEXT: fatbinary" "--cuda" "-64"
// NO-OPENMP-FLAGS-FOR-CUDA-DEVICE-NEXT: clang{{.*}}" "-cc1" "-triple" "powerpc64le--linux-gnu"
// NO-OPENMP-FLAGS-FOR-CUDA-DEVICE:      -fopenmp
// NO-OPENMP-FLAGS-FOR-CUDA-DEVICE-NEXT: ld" {{.*}}"-m" "elf64lppc"

Make test not fail on hosts where the default omp library is gomp.

This is the case on some linuxes, just force libomp so we get the
desired results.

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


/*
 *  Copyright 2006 The WebRTC Project Authors. All rights reserved.
 *
 *  Use of this source code is governed by a BSD-style license
 *  that can be found in the LICENSE file in the root of the source
 *  tree. An additional intellectual property rights grant can be found
 *  in the file PATENTS.  All contributing project authors may
 *  be found in the AUTHORS file in the root of the source tree.
 */

// This module contains some basic debugging facilities.
// Originally comes from shared/commandlineflags/checks.h

#ifndef WEBRTC_BASE_CHECKS_H_
#define WEBRTC_BASE_CHECKS_H_

namespace rtc {

// Prints an error message to stderr and aborts execution.
void Fatal(const char* file, int line, const char* format, ...);

}  // namespace rtc

// The UNREACHABLE macro is very useful during development.
#define UNREACHABLE()                                   \
  rtc::Fatal(__FILE__, __LINE__, "unreachable code")

#endif  // WEBRTC_BASE_CHECKS_H_

/*
 *  Copyright 2006 The WebRTC Project Authors. All rights reserved.
 *
 *  Use of this source code is governed by a BSD-style license
 *  that can be found in the LICENSE file in the root of the source
 *  tree. An additional intellectual property rights grant can be found
 *  in the file PATENTS.  All contributing project authors may
 *  be found in the AUTHORS file in the root of the source tree.
 */

// This module contains some basic debugging facilities.
// Originally comes from shared/commandlineflags/checks.h

#ifndef WEBRTC_BASE_CHECKS_H_
#define WEBRTC_BASE_CHECKS_H_

namespace rtc {

// Prints an error message to stderr and aborts execution.
void Fatal(const char* file, int line, const char* format, ...);

}  // namespace rtc

// Trigger a fatal error (which aborts the process and prints an error
// message). FATAL_ERROR_IF may seem a lot like assert, but there's a crucial
// difference: it's always "on". This means that it can be used to check for
// regular errors that could actually happen, not just programming errors that
// supposedly can't happen---but triggering a fatal error will kill the process
// in an ugly way, so it's not suitable for catching errors that might happen
// in production.
#define FATAL_ERROR(msg) do { rtc::Fatal(__FILE__, __LINE__, msg); } while (0)
#define FATAL_ERROR_IF(x) do { if (x) FATAL_ERROR("check failed"); } while (0)

// The UNREACHABLE macro is very useful during development.
#define UNREACHABLE() FATAL_ERROR("unreachable code")

#endif  // WEBRTC_BASE_CHECKS_H_

Define convenient FATAL_ERROR() and FATAL_ERROR_IF() macros

R=henrike@webrtc.org

Review URL: https://webrtc-codereview.appspot.com/16079004

git-svn-id: 03ae4fbe531b1eefc9d815f31e49022782c42458@6701 4adac7df-926f-26a2-2b94-8c16560cd09d


// PARAM: --set ana.int.interval true --set solver "'new'"
#include<pthread.h>
#include<assert.h>

int glob1 = 5;
pthread_mutex_t mutex1 = PTHREAD_MUTEX_INITIALIZER;
pthread_mutex_t mutex2 = PTHREAD_MUTEX_INITIALIZER;

void *t_fun(void *arg) {
  int t;
  pthread_mutex_lock(&mutex1);
  t = glob1;
  assert(t == 5);
  glob1 = -10;
  assert(glob1 == -10);
  glob1 = t;
  pthread_mutex_unlock(&mutex1);
  return NULL;
}

int main(void) {
  pthread_t id;
  assert(glob1 == 5);
  pthread_create(&id, NULL, t_fun, NULL);
  pthread_mutex_lock(&mutex1);
  glob1++;
  assert(glob1 == 6);
  glob1--;
  pthread_mutex_unlock(&mutex1);
  pthread_join (id, NULL);
  return 0;
}

// PARAM: --set ana.int.interval true --set solver "'td3'"
#include<pthread.h>
#include<assert.h>

int glob1 = 5;
pthread_mutex_t mutex1 = PTHREAD_MUTEX_INITIALIZER;
pthread_mutex_t mutex2 = PTHREAD_MUTEX_INITIALIZER;

void *t_fun(void *arg) {
  int t;
  pthread_mutex_lock(&mutex1);
  t = glob1;
  assert(t == 5);
  glob1 = -10;
  assert(glob1 == -10);
  glob1 = t;
  pthread_mutex_unlock(&mutex1);
  return NULL;
}

int main(void) {
  pthread_t id;
  assert(glob1 == 5);
  pthread_create(&id, NULL, t_fun, NULL);
  pthread_mutex_lock(&mutex1);
  glob1++;
  assert(glob1 == 6);
  glob1--;
  pthread_mutex_unlock(&mutex1);
  pthread_join (id, NULL);
  return 0;
}

Switch solver for 13-privatized/17-priv_internal.c to td3 to make test case pass


#ifndef _ASM_POWERPC_SPARSEMEM_H
#define _ASM_POWERPC_SPARSEMEM_H 1
#ifdef __KERNEL__

#ifdef CONFIG_SPARSEMEM
/*
 * SECTION_SIZE_BITS		2^N: how big each section will be
 * MAX_PHYSADDR_BITS		2^N: how much physical address space we have
 * MAX_PHYSMEM_BITS		2^N: how much memory we can have in that space
 */
#define SECTION_SIZE_BITS       24

#define MAX_PHYSADDR_BITS       44
#define MAX_PHYSMEM_BITS        44

#endif /* CONFIG_SPARSEMEM */

#ifdef CONFIG_MEMORY_HOTPLUG
extern void create_section_mapping(unsigned long start, unsigned long end);
extern int remove_section_mapping(unsigned long start, unsigned long end);
#ifdef CONFIG_NUMA
extern int hot_add_scn_to_nid(unsigned long scn_addr);
#else
static inline int hot_add_scn_to_nid(unsigned long scn_addr)
{
	return 0;
}
#endif /* CONFIG_NUMA */
#endif /* CONFIG_MEMORY_HOTPLUG */

#endif /* __KERNEL__ */
#endif /* _ASM_POWERPC_SPARSEMEM_H */

#ifndef _ASM_POWERPC_SPARSEMEM_H
#define _ASM_POWERPC_SPARSEMEM_H 1
#ifdef __KERNEL__

#ifdef CONFIG_SPARSEMEM
/*
 * SECTION_SIZE_BITS		2^N: how big each section will be
 * MAX_PHYSADDR_BITS		2^N: how much physical address space we have
 * MAX_PHYSMEM_BITS		2^N: how much memory we can have in that space
 */
#define SECTION_SIZE_BITS       28

#define MAX_PHYSADDR_BITS       44
#define MAX_PHYSMEM_BITS        44

#endif /* CONFIG_SPARSEMEM */

#ifdef CONFIG_MEMORY_HOTPLUG
extern void create_section_mapping(unsigned long start, unsigned long end);
extern int remove_section_mapping(unsigned long start, unsigned long end);
#ifdef CONFIG_NUMA
extern int hot_add_scn_to_nid(unsigned long scn_addr);
#else
static inline int hot_add_scn_to_nid(unsigned long scn_addr)
{
	return 0;
}
#endif /* CONFIG_NUMA */
#endif /* CONFIG_MEMORY_HOTPLUG */

#endif /* __KERNEL__ */
#endif /* _ASM_POWERPC_SPARSEMEM_H */

powerpc/mm: Bump SECTION_SIZE_BITS from 16MB to 256MB

The current setting for SECTION_SIZE_BITS is quite small compared to
everyone else:

arch/powerpc/include/asm/sparsemem.h:#define SECTION_SIZE_BITS  24

arch/sparc/include/asm/sparsemem.h:#define SECTION_SIZE_BITS    30
arch/ia64/include/asm/sparsemem.h:#define SECTION_SIZE_BITS     (30)
arch/s390/include/asm/sparsemem.h:#define SECTION_SIZE_BITS     28
arch/x86/include/asm/sparsemem.h:# define SECTION_SIZE_BITS     27

And it has proven to be an issue during boot on very large machines.
If hotplug memory is enabled, drivers/base/memory.c does this:

       for (i = 0; i < NR_MEM_SECTIONS; i++) {
                if (!present_section_nr(i))
                        continue;
                err = add_memory_block(0, __nr_to_section(i), MEM_ONLINE,
                                        0, BOOT);
                if (!ret)
                        ret = err;
        }

Which creates a sysfs directory for every 16MB of memory. As a result
I'm seeing up to 30 minutes spent here during boot:

c000000000248ee0 .__sysfs_add_one+0x28/0x128
c0000000002492a8 .sysfs_add_one+0x38/0x188
c000000000249c88 .create_dir+0x70/0x138
c000000000249d98 .sysfs_create_dir+0x48/0x78
c00000000032bad8 .kobject_add_internal+0x140/0x308
c00000000032beb4 .kobject_init_and_add+0x4c/0x68
c00000000046c2c0 .sysdev_register+0xa0/0x220
c00000000047b1dc .add_memory_block+0x124/0x1e8
c0000000008d1f28 .memory_dev_init+0xf4/0x168
c0000000008d1b64 .driver_init+0x50/0x64
c000000000890378 .do_basic_setup+0x40/0xd4

I assume there are some O(n^2) issues in sysfs as we add all the memory
nodes. Bumping SECTION_SIZE_BITS to 256 MB drops the time to about 10
seconds and results in a much smaller /sys.

Signed-off-by: Anton Blanchard <14deb5e5e417133e888bf47bb6a3555c9bb7d81c@samba.org>
Signed-off-by: Benjamin Herrenschmidt <a7089bb6e7e92505d88aaff006cbdd60cc9120b6@kernel.crashing.org>


/* Copyright 2015 The TensorFlow Authors. All Rights Reserved.

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

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

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

#ifndef TENSORFLOW_CORE_PLATFORM_DEFAULT_INTEGRAL_TYPES_H_
#define TENSORFLOW_CORE_PLATFORM_DEFAULT_INTEGRAL_TYPES_H_

// IWYU pragma: private, include "third_party/tensorflow/core/platform/types.h"
// IWYU pragma: friend third_party/tensorflow/core/platform/types.h

namespace tensorflow {

typedef signed char int8;
typedef short int16;
typedef int int32;
typedef long long int64;

typedef unsigned char uint8;
typedef unsigned short uint16;
typedef unsigned int uint32;
typedef unsigned long long uint64;

}  // namespace tensorflow

#endif  // TENSORFLOW_CORE_PLATFORM_DEFAULT_INTEGRAL_TYPES_H_

/* Copyright 2015 The TensorFlow Authors. All Rights Reserved.

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

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

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

#ifndef TENSORFLOW_CORE_PLATFORM_DEFAULT_INTEGRAL_TYPES_H_
#define TENSORFLOW_CORE_PLATFORM_DEFAULT_INTEGRAL_TYPES_H_

#include <cstdint>

// IWYU pragma: private, include "third_party/tensorflow/core/platform/types.h"
// IWYU pragma: friend third_party/tensorflow/core/platform/types.h

namespace tensorflow {

typedef signed char int8;
typedef short int16;
typedef int int32;
typedef std::int64_t int64;

typedef unsigned char uint8;
typedef unsigned short uint16;
typedef unsigned int uint32;
typedef std::uint64_t uint64;

}  // namespace tensorflow

#endif  // TENSORFLOW_CORE_PLATFORM_DEFAULT_INTEGRAL_TYPES_H_

Change definition of tensorflow::int64 to std::int64_t.

There is no reason for TensorFlow to have its own special non-standard `int64` type any more; we can use the standard one instead.

PiperOrigin-RevId: 351674712
Change-Id: I82c1d67c07436a3f158a029a3a657fef5a05060e


/*
 * This file is part of Kotaka, a mud library for DGD
 * http://github.com/shentino/kotaka
 *
 * Copyright (C) 2012, 2013, 2014  Raymond Jennings
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Affero General Public License as
 * published by the Free Software Foundation, either version 3 of the
 * License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Affero General Public License for more details.
 *
 * You should have received a copy of the GNU Affero General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
#include <kotaka/paths/algorithm.h>
#include <kotaka/paths/bigstruct.h>
#include <kotaka/paths/system.h>
#include <kotaka/paths/string.h>
#include <kotaka/paths/verb.h>
#include <kernel/access.h>
#include <status.h>

inherit LIB_VERB;

string *query_parse_methods()
{
	return ({ "raw" });
}

int compare(string a, string b)
{
	int na, nb;

	sscanf(a, "%s#%d", a, na);
	sscanf(b, "%s#%d", b, nb);

	if (na > nb) {
		return 1;
	}
	if (na < nb) {
		return -1;
	}
	return 0;
}

void printlist(string path)
{
	mixed st;
	object cinfo;
	object obj;

	st = status(path);

	if (!st) {
		send_out("No such object.\n");
		return;
	}

	cinfo = CLONED->query_clone_info(st[O_INDEX]);

	if (!cinfo) {
		send_out("No clone info for object.\n");
		return;
	}

	obj = cinfo->query_first_clone();

	do {
		send_out(STRINGD->mixed_sprint(obj) + ", with access grants " + STRINGD->mixed_sprint(obj->query_grants()) + "\n");

		obj = obj->query_next_clone();
	} while (obj != cinfo->query_first_clone());
}

void main(object actor, mapping roles)
{
	if (query_user()->query_class() < 2) {
		send_out("You do not have sufficient access rights to do a clone check.\n");
		return;
	}

	printlist("~Bigstruct/obj/array/root");
	printlist("~Bigstruct/obj/deque/root");
	printlist("~Bigstruct/obj/map/root");
}

Add a command to check bigstruct owners, used to check for leaks


// SKIP PARAM: --set ana.activated[+] apron --set ana.activated[-] threadflag
// Minimized from sv-benchmarks/c/systemc/pipeline.cil-1.c
#include <assert.h>

int main_clk_pos_edge;
int main_in1_req_up;

int main()
{
  // main_clk_pos_edge = 2; // TODO: uncomment to unskip apron test
  if (main_in1_req_up == 1) // TODO: both branches are dead
    assert(0); // TODO: uncomment to unskip apron test, FAIL (unreachable)
  else
    assert(1); // reachable
  return (0);
}

Add minimized testcase from both apron branches dead without threadflag


//
//  TRVSDictionaryWithCaseInsensitivity.h
//  TRVSDictionaryWithCaseInsensitivity
//
//  Created by Travis Jeffery on 7/24/14.
//  Copyright (c) 2014 Travis Jeffery. All rights reserved.
//

#import <UIKit/UIKit.h>

//! Project version number for TRVSDictionaryWithCaseInsensitivity.
FOUNDATION_EXPORT double TRVSDictionaryWithCaseInsensitivityVersionNumber;

//! Project version string for TRVSDictionaryWithCaseInsensitivity.
FOUNDATION_EXPORT const unsigned char TRVSDictionaryWithCaseInsensitivityVersionString[];

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

@interface TRVSDictionaryWithCaseInsensitivity : NSDictionary

@end

//
//  TRVSDictionaryWithCaseInsensitivity.h
//  TRVSDictionaryWithCaseInsensitivity
//
//  Created by Travis Jeffery on 7/24/14.
//  Copyright (c) 2014 Travis Jeffery. All rights reserved.
//

#import <Foundation/Foundation.h>

//! Project version number for TRVSDictionaryWithCaseInsensitivity.
FOUNDATION_EXPORT double TRVSDictionaryWithCaseInsensitivityVersionNumber;

//! Project version string for TRVSDictionaryWithCaseInsensitivity.
FOUNDATION_EXPORT const unsigned char TRVSDictionaryWithCaseInsensitivityVersionString[];

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

@interface TRVSDictionaryWithCaseInsensitivity : NSDictionary

@end

Fix import of foundation - no need for uikit


//
//  SDLImageField+ScreenManagerExtensions.h
//  SmartDeviceLink
//
//  Created by Joel Fischer on 5/20/20.
//  Copyright © 2020 smartdevicelink. All rights reserved.
//

#import <SmartDeviceLink/SmartDeviceLink.h>

NS_ASSUME_NONNULL_BEGIN

@interface SDLImageField (ScreenManagerExtensions)

+ (NSArray<SDLImageField *> *)allImageFields;

@end

NS_ASSUME_NONNULL_END

//
//  SDLImageField+ScreenManagerExtensions.h
//  SmartDeviceLink
//
//  Created by Joel Fischer on 5/20/20.
//  Copyright © 2020 smartdevicelink. All rights reserved.
//

#import "SDLImageField.h"

NS_ASSUME_NONNULL_BEGIN

@interface SDLImageField (ScreenManagerExtensions)

+ (NSArray<SDLImageField *> *)allImageFields;

@end

NS_ASSUME_NONNULL_END

Fix failed import in podspec

Fix failed import in podspec


#include <ruby.h>
#include <errno.h>
#include <sys/capability.h>

static VALUE cap2_getpcaps(VALUE self, VALUE pid) {
  cap_t cap_d;
  ssize_t length;
  char *caps;
  VALUE result;

  Check_Type(pid, T_FIXNUM);

  cap_d = cap_get_pid(NUM2INT(pid));

  if (cap_d == NULL) {
    rb_raise(
      rb_eRuntimeError,
      "Failed to get cap's for proccess %d: (%s)\n",
      NUM2INT(pid), strerror(errno)
    );
  } else {
    caps = cap_to_text(cap_d, &length);
    result = rb_str_new(caps, length);
    cap_free(caps);
    cap_free(cap_d);
  }

  return result;
}

void Init_cap2(void) {
  VALUE rb_mCap2;

  rb_mCap2 = rb_define_module("Cap2");

  rb_define_module_function(rb_mCap2, "getpcaps", cap2_getpcaps, 1);
}

#include <ruby.h>
#include <errno.h>
#include <sys/capability.h>

static VALUE cap2_getpcaps(VALUE self, VALUE pid) {
  cap_t cap_d;
  ssize_t length;
  char *caps;
  VALUE result;

  Check_Type(pid, T_FIXNUM);

  cap_d = cap_get_pid(FIX2INT(pid));

  if (cap_d == NULL) {
    rb_raise(
      rb_eRuntimeError,
      "Failed to get cap's for proccess %d: (%s)\n",
      FIX2INT(pid), strerror(errno)
    );
  } else {
    caps = cap_to_text(cap_d, &length);
    result = rb_str_new(caps, length);
    cap_free(caps);
    cap_free(cap_d);
  }

  return result;
}

void Init_cap2(void) {
  VALUE rb_mCap2;

  rb_mCap2 = rb_define_module("Cap2");

  rb_define_module_function(rb_mCap2, "getpcaps", cap2_getpcaps, 1);
}

Use FIX2INT rather than NUM2INT in Cap2.getpcaps


#pragma once

#include <cstddef>

namespace scratch {

template<size_t Index, typename T, typename... Rest> struct nth : nth<Index-1, Rest...> {};
template<typename T, typename... Rest> struct nth<0, T, Rest...> { using type = T; };

template<size_t Index, typename... Ts> using nth_t = typename nth<Index, Ts...>::type;

} // namespace scratch

Add a template type alias `scratch::nth_t<I, Ts...>` for the nth element of a pack.

The equivalent for (perfectly forwarded) values is basically

    std::get<I>(std::forward_as_tuple(std::forward<Vs>(vs)...))

but since I haven't implemented `std::tuple` yet, I'm passing on that one.


#ifndef CCSPEC_CORE_EXAMPLE_GROUP_H_
#define CCSPEC_CORE_EXAMPLE_GROUP_H_

#include <functional>
#include <list>
#include <stack>
#include <string>

namespace ccspec {
namespace core {

class ExampleGroup;

typedef ExampleGroup* Creator(std::string desc, std::function<void ()> spec);

class ExampleGroup {
  public:
    virtual ~ExampleGroup();

    void addChild(ExampleGroup*);

  protected:
    ExampleGroup(std::string desc);

  private:
    std::string desc_;
    std::list<ExampleGroup*> children_;

    friend Creator describe;
    friend Creator context;
};

extern std::stack<ExampleGroup*> groups_being_defined;

Creator describe;
Creator context;

} // namespace core
} // namespace ccspec

#endif // CCSPEC_CORE_EXAMPLE_GROUP_H_

#ifndef CCSPEC_CORE_EXAMPLE_GROUP_H_
#define CCSPEC_CORE_EXAMPLE_GROUP_H_

#include <functional>
#include <list>
#include <stack>
#include <string>

namespace ccspec {
namespace core {

class ExampleGroup;

typedef ExampleGroup* Creator(std::string desc, std::function<void ()> spec);

extern std::stack<ExampleGroup*> groups_being_defined;

class ExampleGroup {
  public:
    virtual ~ExampleGroup();

    void addChild(ExampleGroup*);

  protected:
    ExampleGroup(std::string desc);

  private:
    std::string desc_;
    std::list<ExampleGroup*> children_;

    friend Creator describe;
    friend Creator context;
};

Creator describe;
Creator context;

} // namespace core
} // namespace ccspec

#endif // CCSPEC_CORE_EXAMPLE_GROUP_H_

Move global variable declaration for consistency


/*
    Copyright (c) 2009 Stephen Kelly <steveire@gmail.com>
*/

#ifndef FILTER_H
#define FILTER_H

#include "variable.h"

#include "grantlee_export.h"

namespace Grantlee
{
class Parser;
}

class Token;

namespace Grantlee
{

class GRANTLEE_EXPORT FilterExpression
{
public:
  enum Reversed
  {
    IsNotReversed,
    IsReversed
  };

  FilterExpression();
  FilterExpression(const QString &varString, Grantlee::Parser *parser = 0);

  int error();

//   QList<QPair<QString, QString> > filters();
  Variable variable();

  QVariant resolve(Context *c);

  bool isTrue(Context *c);

  QVariantList toList(Context *c);

private:
  Variable m_variable;
  int m_error;

};

}

#endif

/*
    Copyright (c) 2009 Stephen Kelly <steveire@gmail.com>
*/

#ifndef FILTEREXPRESSION_H
#define FILTEREXPRESSION_H

#include "variable.h"

#include "grantlee_export.h"

namespace Grantlee
{
class Parser;
}

class Token;

namespace Grantlee
{

class GRANTLEE_EXPORT FilterExpression
{
public:
  enum Reversed
  {
    IsNotReversed,
    IsReversed
  };

  FilterExpression();
  FilterExpression(const QString &varString, Grantlee::Parser *parser = 0);

  int error();

//   QList<QPair<QString, QString> > filters();
  Variable variable();

  QVariant resolve(Context *c);

  bool isTrue(Context *c);

  QVariantList toList(Context *c);

private:
  Variable m_variable;
  int m_error;

};

}

#endif

Use a correct include guard

Use a correct include guard


/**
   \file
   Particle property interface

   \author Lukas Nellen
   \version $Id$
   \date 03 Apr 2004
*/

#pragma once
#include <string>

namespace corsika
{

  /**
     \class VParticleProperties VParticleProperties.h "corsika/VParticleProperties.h"

     \brief Internal interface for particle properties. This is
     intended to be implemented for elementary particles and nuclei.

     \note This is an internal interface and not available for user code.

     \author Lukas Nellen
     \date 03 Apr 2004
     \ingroup particles
  */

  class VParticleProperties {

  public:
    virtual ~VParticleProperties() { }

    /// Get particle type (using PDG particle codes)
    virtual int GetType() const = 0;

    /// Get particle name
    virtual std::string GetName() const = 0;

    /// Get particle mass (in Auger units)
    virtual double GetMass() const = 0;

  };

  typedef std::shared_ptr<const VParticleProperties> ParticlePropertiesPtr;

}

/**
   \file
   Particle property interface

   \author Lukas Nellen
   \version $Id$
   \date 03 Apr 2004
*/

#pragma once
#include <string>
#include <memory.h>

namespace corsika
{

  /**
     \class VParticleProperties VParticleProperties.h "corsika/VParticleProperties.h"

     \brief Internal interface for particle properties. This is
     intended to be implemented for elementary particles and nuclei.

     \note This is an internal interface and not available for user code.

     \author Lukas Nellen
     \date 03 Apr 2004
     \ingroup particles
  */

  class VParticleProperties {

  public:
    virtual ~VParticleProperties() { }

    /// Get particle type (using PDG particle codes)
    virtual int GetType() const = 0;

    /// Get particle name
    virtual std::string GetName() const = 0;

    /// Get particle mass (in Auger units)
    virtual double GetMass() const = 0;

  };

  typedef std::shared_ptr<const VParticleProperties> ParticlePropertiesPtr;

}

Add one more memory include

Add one more memory include


#pragma once

#include <memory>
#include <vector>
#include "halley/core/game/main_loop.h"

#ifdef _WIN32
#define HALLEY_STDCALL __stdcall
#else
#define HALLEY_STDCALL
#endif

namespace Halley
{
	class Game;
	class Core;
	class HalleyStatics;

	constexpr static uint32_t HALLEY_DLL_API_VERSION = 23;

	class IHalleyEntryPoint
	{
	public:
		virtual ~IHalleyEntryPoint() = default;

		void initSharedStatics(const HalleyStatics& parent);
		virtual uint32_t getApiVersion() { return HALLEY_DLL_API_VERSION; }

		virtual std::unique_ptr<Core> createCore(const std::vector<std::string>& args) = 0;
		virtual std::unique_ptr<Game> createGame() = 0;
	};

	template <typename GameType>
	class HalleyEntryPoint final : public IHalleyEntryPoint
	{
	public:
		std::unique_ptr<Game> createGame() override
		{
			return std::make_unique<GameType>();
		}

		std::unique_ptr<Core> createCore(const std::vector<std::string>& args) override
		{
			Expects(args.size() >= 1);
			Expects(args.size() < 1000);
			return std::make_unique<Core>(std::make_unique<GameType>(), args);
		}
	};
}

#pragma once

#include <memory>
#include <vector>
#include "halley/core/game/main_loop.h"

#ifdef _WIN32
#define HALLEY_STDCALL __stdcall
#else
#define HALLEY_STDCALL
#endif

namespace Halley
{
	class Game;
	class Core;
	class HalleyStatics;

	constexpr static uint32_t HALLEY_DLL_API_VERSION = 24;

	class IHalleyEntryPoint
	{
	public:
		virtual ~IHalleyEntryPoint() = default;

		virtual uint32_t getApiVersion() { return HALLEY_DLL_API_VERSION; }
		virtual std::unique_ptr<Core> createCore(const std::vector<std::string>& args) = 0;
		virtual std::unique_ptr<Game> createGame() = 0;
		void initSharedStatics(const HalleyStatics& parent);
	};

	template <typename GameType>
	class HalleyEntryPoint final : public IHalleyEntryPoint
	{
	public:
		std::unique_ptr<Game> createGame() override
		{
			return std::make_unique<GameType>();
		}

		std::unique_ptr<Core> createCore(const std::vector<std::string>& args) override
		{
			Expects(args.size() >= 1);
			Expects(args.size() < 1000);
			return std::make_unique<Core>(std::make_unique<GameType>(), args);
		}
	};
}

Move new method on interface further down to avoid messing with vtable compatibility


#ifndef SRC_PLACEMENT_APOLLONIUS_LABELS_ARRANGER_H_

#define SRC_PLACEMENT_APOLLONIUS_LABELS_ARRANGER_H_

#include <Eigen/Core>
#include <memory>
#include <vector>
#include "./labels_arranger.h"

class CudaArrayProvider;

namespace Placement
{

/**
 * \brief Returns the labels in an order defined by the apollonius graph
 *
 */
class ApolloniusLabelsArranger : public LabelsArranger
{
 public:
  ApolloniusLabelsArranger() = default;
  virtual ~ApolloniusLabelsArranger();

  void
  initialize(std::shared_ptr<CudaArrayProvider> distanceTransformTextureMapper,
             std::shared_ptr<CudaArrayProvider> apolloniusTextureMapper);

  virtual std::vector<Label>
  getArrangement(const LabellerFrameData &frameData,
                 std::shared_ptr<LabelsContainer> labels);

 private:
  std::shared_ptr<CudaArrayProvider> distanceTransformTextureMapper;
  std::shared_ptr<CudaArrayProvider> apolloniusTextureMapper;

  std::vector<Eigen::Vector4f>
  createLabelSeeds(Eigen::Vector2i size, Eigen::Matrix4f viewProjection,
                   std::shared_ptr<LabelsContainer> labels);
};

}  // namespace Placement

#endif  // SRC_PLACEMENT_APOLLONIUS_LABELS_ARRANGER_H_

#ifndef SRC_PLACEMENT_APOLLONIUS_LABELS_ARRANGER_H_

#define SRC_PLACEMENT_APOLLONIUS_LABELS_ARRANGER_H_

#include <Eigen/Core>
#include <memory>
#include <vector>
#include "./labels_arranger.h"

class CudaArrayProvider;

namespace Placement
{

/**
 * \brief Returns the labels in an order defined by the apollonius graph
 *
 */
class ApolloniusLabelsArranger : public LabelsArranger
{
 public:
  ApolloniusLabelsArranger() = default;

  void
  initialize(std::shared_ptr<CudaArrayProvider> distanceTransformTextureMapper,
             std::shared_ptr<CudaArrayProvider> apolloniusTextureMapper);

  virtual std::vector<Label>
  getArrangement(const LabellerFrameData &frameData,
                 std::shared_ptr<LabelsContainer> labels);

 private:
  std::shared_ptr<CudaArrayProvider> distanceTransformTextureMapper;
  std::shared_ptr<CudaArrayProvider> apolloniusTextureMapper;

  std::vector<Eigen::Vector4f>
  createLabelSeeds(Eigen::Vector2i size, Eigen::Matrix4f viewProjection,
                   std::shared_ptr<LabelsContainer> labels);
};

}  // namespace Placement

#endif  // SRC_PLACEMENT_APOLLONIUS_LABELS_ARRANGER_H_

Remove unused and not implement ApolloniusLabelsArranger destructor.


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

#pragma once

#include "Stdafx.h"

using namespace CefSharp;

namespace CefSharp
{
    namespace Internals
    {
        public ref class CefRequestCallbackWrapper : public IRequestCallback
        {
        private:
            MCefRefPtr<CefRequestCallback> _callback;
            IFrame^ _frame;
            IRequest^ _request;

        internal:
            CefRequestCallbackWrapper(CefRefPtr<CefRequestCallback> &callback)
                : _callback(callback)
            {
            }

            CefRequestCallbackWrapper(
                CefRefPtr<CefRequestCallback> &callback,
                IFrame^ frame,
                IRequest^ request)
                : _callback(callback), _frame(frame), _request(request)
            {
            }

            !CefRequestCallbackWrapper()
            {
                _callback = NULL;
            }

            ~CefRequestCallbackWrapper()
            {
                this->!CefRequestCallbackWrapper();
                delete _requestWrapper;
                _requestWrapper = nullptr;
                delete _frame;
                _frame = nullptr;
            }

        public:
            virtual void Continue(bool allow)
            {
                _callback->Continue(allow);
                delete this;
            }

            virtual void Cancel()
            {
                _callback->Cancel();
                delete this;
            }
        };
    }
}

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

#pragma once

#include "Stdafx.h"

using namespace CefSharp;

namespace CefSharp
{
    namespace Internals
    {
        public ref class CefRequestCallbackWrapper : public IRequestCallback
        {
        private:
            MCefRefPtr<CefRequestCallback> _callback;
            IFrame^ _frame;
            IRequest^ _request;

        internal:
            CefRequestCallbackWrapper(CefRefPtr<CefRequestCallback> &callback)
                : _callback(callback)
            {
            }

            CefRequestCallbackWrapper(
                CefRefPtr<CefRequestCallback> &callback,
                IFrame^ frame,
                IRequest^ request)
                : _callback(callback), _frame(frame), _request(request)
            {
            }

            !CefRequestCallbackWrapper()
            {
                _callback = NULL;
            }

            ~CefRequestCallbackWrapper()
            {
                this->!CefRequestCallbackWrapper();
                delete _request;
                _request = nullptr;
                delete _frame;
                _frame = nullptr;
            }

        public:
            virtual void Continue(bool allow)
            {
                _callback->Continue(allow);
                delete this;
            }

            virtual void Cancel()
            {
                _callback->Cancel();
                delete this;
            }
        };
    }
}

Fix build issue from prev. merge.

Fix build issue from prev. merge.


/*
 * factory.c for Linsys SDI consumer
*/

#include <framework/mlt.h>
#include <string.h>

extern mlt_consumer consumer_SDIstream_init( mlt_profile profile, mlt_service_type type, const char *id, char *arg );

MLT_REPOSITORY
{
	MLT_REGISTER( consumer_type, "linsys_sdi", consumer_SDIstream_init );
}

/*
 * factory.c for Linsys SDI consumer
*/

#include <framework/mlt.h>
#include <string.h>

extern mlt_consumer consumer_SDIstream_init( mlt_profile profile, mlt_service_type type, const char *id, char *arg );

MLT_REPOSITORY
{
	MLT_REGISTER( consumer_type, "sdi", consumer_SDIstream_init );
}

Change linssys_sdi consumer to just "sdi"


#import "Expecta.h"

EXPMatcherInterface(beIdenticalTo, (void *expected));

#import "Expecta.h"

EXPMatcherInterface(_beIdenticalTo, (void *expected));

#if __has_feature(objc_arc)
#define beIdenticalTo(expected) _beIdenticalTo((__bridge void*)expected)
#else
#define beIdenticalTo _beIdenticalTo
#endif

Fix ARC warning and avoid having to bridge id objects


/*-------------------------------------------------------------------------
 *
 * copydir.h
 *	  Header for src/port/copydir.c compatibility functions.
 *
 * Portions Copyright (c) 1996-2010, PostgreSQL Global Development Group
 * Portions Copyright (c) 1994, Regents of the University of California
 *
 * src/include/storage/copydir.h
 *
 *-------------------------------------------------------------------------
 */
#ifndef COPYDIR_H
#define COPYDIR_H

extern void copydir(char *fromdir, char *todir, bool recurse);

#endif   /* COPYDIR_H */

/*-------------------------------------------------------------------------
 *
 * copydir.h
 *	  Copy a directory.
 *
 * Portions Copyright (c) 1996-2010, PostgreSQL Global Development Group
 * Portions Copyright (c) 1994, Regents of the University of California
 *
 * src/include/storage/copydir.h
 *
 *-------------------------------------------------------------------------
 */
#ifndef COPYDIR_H
#define COPYDIR_H

extern void copydir(char *fromdir, char *todir, bool recurse);

#endif   /* COPYDIR_H */

Fix copy-and-pasteo a little more completely.

copydir.c is no longer in src/port


#include <stdio.h>
#include <stdlib.h>
#include <vl/ib.h>

int main()
{
    vl_node nrows = 30;
    vl_node ncols = 3;
    vl_prob * Pic = malloc(sizeof(vl_prob)*nrows*ncols);
    int r,c;
    printf("Pic = [");
    for(r=0; r<nrows; r++)
    {
        for(c=0; c<ncols; c++)
        {
            Pic[r*ncols+c] = rand() % 100;
            printf("%f ", Pic[r*ncols+c]);
        }
        printf("; ...\n");
    }
    printf("];\n");

    printf("IB starting\n");
    // parents always has size 2*nrows-1
    vl_node * parents = vl_ib(Pic, nrows, ncols);
    for(r=0; r<2*nrows-1; r++)
        printf("%d => %d\n", r, parents[r]);

    free(parents);
    free(Pic);

    printf("IB done\n");
    return 0;
}

Add a simple IB test program

Add a simple IB test program


// RUN: not %llvmgcc -mssse3 -S -o /dev/null %s |& grep "error: mask must be an immediate"
// XFAIL: *
// XTARGET: x86,i386,i686

#include <tmmintrin.h>

extern int i;

int main ()
{
#if defined( __SSSE3__ )

  typedef int16_t     vSInt16         __attribute__ ((__vector_size__ (16)));

  short   dtbl[] = {1,2,3,4,5,6,7,8};
  vSInt16 *vdtbl = (vSInt16*) dtbl;

  vSInt16 v0;
  v0 = *vdtbl;
  v0 = _mm_alignr_epi8(v0, v0, i);

  return 0;
#endif
}

Add a test for the llvm-gcc commit in r90200.

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


/* Each new term in the Fibonacci sequence is generated by adding the previous
 * two terms. By starting with 1 and 2, the first 10 terms will be:
 *
 * 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, ...
 *
 * By considering the terms in the Fibonacci sequence whose values do not
 * exceed four million, find the sum of the even-valued terms.
 */

#include <stdio.h>

#define LIMIT 4000000

int
main(int argc, char **argv)
{
    int prev = 0, next = 1, sum = 0, cur = 0;

    do {
        cur = prev + next;
        if(cur % 2 == 0) {
            sum += cur;
        }
        prev = next;
        next = cur;
    } while (cur < LIMIT);
    printf("%i", sum);
    return 0;
}

Add solution for problem 2

Add solution for problem 2


/*
 *  Copyright (c) 2014-present, Facebook, Inc.
 *  All rights reserved.
 *
 *  This source code is licensed under the BSD-style license found in the
 *  LICENSE file in the root directory of this source tree. An additional grant
 *  of patent rights can be found in the PATENTS file in the same directory.
 *
 */

#import <Foundation/Foundation.h>

#import <ComponentKit/CKComponentViewConfiguration.h>

@class CKComponent;
@class UIView;

/**
 CKComponentHierarchyDebugHelper allows
 */
@interface CKComponentHierarchyDebugHelper : NSObject
/**
 Describe the component hierarchy starting from the window. This recursively searches downwards in the view hierarchy to
 find views which have a lifecycle manager, from which we can get the component layout hierarchies.
 @return A string with a description of the hierarchy.
 */
+ (NSString *)componentHierarchyDescription;

@end

/*
 *  Copyright (c) 2014-present, Facebook, Inc.
 *  All rights reserved.
 *
 *  This source code is licensed under the BSD-style license found in the
 *  LICENSE file in the root directory of this source tree. An additional grant
 *  of patent rights can be found in the PATENTS file in the same directory.
 *
 */

#import <Foundation/Foundation.h>

#import <ComponentKit/CKComponentViewConfiguration.h>

@class CKComponent;
@class UIView;

/**
 CKComponentHierarchyDebugHelper allows
 */
@interface CKComponentHierarchyDebugHelper : NSObject
/**
 Describe the component hierarchy starting from the window. This recursively searches downwards in the view hierarchy to
 find views which have a lifecycle manager, from which we can get the component layout hierarchies.
 @return A string with a description of the hierarchy.
 */
+ (NSString *)componentHierarchyDescription NS_EXTENSION_UNAVAILABLE("Recursively describes components using -[UIApplication keyWindow]");

@end

Mark remaining APIs unsafe in extensions

This is a follow up to #534 that should help us close out #390.


#define KNRM  "\x1B[0m"
#define KRED  "\x1B[31m"
#define KGRN  "\x1B[32m"
#define KYEL  "\x1B[33m"
#define KBLU  "\x1B[34m"
#define KMAG  "\x1B[35m"
#define KCYN  "\x1B[36m"
#define KWHT  "\x1B[37m"

#define PRINT_RED(...) \
	printf("%s", KRED);  \
  printf(__VA_ARGS__); \
	printf("%s", KNRM);  \

#define PRINT_GREEN(...) \
	printf("%s", KGRN);  \
  printf(__VA_ARGS__); \
	printf("%s", KNRM);  \

Add pretty (color) printing macros. Unused currently.


/*
 * Medical Image Registration ToolKit (MIRTK)
 *
 * Copyright 2013-2015 Imperial College London
 * Copyright 2013-2015 Andreas Schuh
 *
 * 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 MIRTK_Status_H
#define MIRTK_Status_H

namespace mirtk {

// -----------------------------------------------------------------------------
/// Enumeration of common states for entities such as objective function parameters
enum Status
{
  Active,
  Passive,
};

} // namespace mirtk

#endif // MIRTK_Status_H

/*
 * Medical Image Registration ToolKit (MIRTK)
 *
 * Copyright 2013-2015 Imperial College London
 * Copyright 2013-2015 Andreas Schuh
 *
 * 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 MIRTK_Status_H
#define MIRTK_Status_H

namespace mirtk {

// -----------------------------------------------------------------------------
/// Enumeration of common states for entities such as objective function parameters
enum Status
{
  Active,
  Passive
};

} // namespace mirtk

#endif // MIRTK_Status_H

style: Remove needless comma after last enumeration value [Common]


/*
 * libopensync - A synchronization framework
 * Copyright (C) 2008  Daniel Gollub <dgollub@suse.de>
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307  USA
 *
 */

#ifndef _OPENSYNC_PLUGIN_CONNECTION_INTERNALS_H_
#define _OPENSYNC_PLUGIN_CONNECTION_INTERNALS_H_

/*! @brief OSyncPluginConnectionType String Map
 *
 * @ingroup OSyncPluginConnectionInternalsAPI
 **/

typedef struct {
	OSyncPluginConnectionType type;
	const char *string;
} OSyncPluginConnectionTypeString;

const char *osync_plugin_connection_get_type_string(OSyncPluginConnectionType conn_type);

#endif /*_OPENSYNC_PLUGIN_CONNECTION_INTERNALS_H_*/

Add missing file from previous commit.

Add missing file from previous commit.

git-svn-id: e31799a7ad59d6ea355ca047c69e0aee8a59fcd3@4287 53f5c7ee-bee3-0310-bbc5-ea0e15fffd5e


#ifndef __ENTITY_H__
#define __ENTITY_H__

#include "ModuleCollision.h"

class Entity
{
public:

	Entity() : parent(nullptr) {}

	Entity(Entity* parent) : parent(parent) {}

	virtual ~Entity() {}

	// Entity lifecycle methods

	virtual bool Start()
	{
		return true;
	}

	virtual bool Start(bool active)
	{
		this->active = active;
		return true;
	}

	bool Enable()
	{
		if (!active)
			return active = Start();
		return true;
	}

	bool Disable()
	{
		if (active)
			return active = !CleanUp();
		return false;
	}

	virtual void PreUpdate() {}

	virtual void Update() {}

	virtual void PostUpdate() {}

	virtual bool CleanUp()
	{
		return true;
	}

	// Callbacks
	virtual bool OnCollision(Collider origin, Collider other)
	{
		return true;
	}

private:
	bool active = true;
	Entity* parent;
};

#endif // __ENTITY_H__

#ifndef __ENTITY_H__
#define __ENTITY_H__

#include "ModuleCollision.h"

class Entity
{
public:

	Entity() : Parent(nullptr) {}

	Entity(Entity* parent) : Parent(parent) {}

	virtual ~Entity() {}

	// Entity lifecycle methods

	virtual bool Start()
	{
		return true;
	}

	virtual bool Start(bool active)
	{
		this->_active = active;
		return true;
	}

	bool Enable()
	{
		if (!_active)
			return _active = Start();
		return true;
	}

	bool Disable()
	{
		if (_active)
			return _active = !CleanUp();
		return false;
	}

	virtual void PreUpdate() {}

	virtual void Update() {}

	virtual void PostUpdate() {}

	virtual bool CleanUp()
	{
		return true;
	}

	// Callbacks
	virtual bool OnCollision(Collider origin, Collider other)
	{
		return true;
	}

public:
	Entity* Parent;

private:
	bool _active = true;
};

#endif // __ENTITY_H__

Adjust entity class to naming conventions

references #3


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

int check_date(struct tm *date, time_t time, char *name) {
    if( date == NULL ) {
        printf("%s(%lld) returned null\n", name, (long long)time);
        return 1;
    }
    else {
        printf("%s(%lld): %s\n", name, (long long)time, asctime(date));
        return 0;
    }
}

int main(int argc, char *argv[]) {
    long long number;
    time_t time;
    struct tm *localdate;
    struct tm *gmdate;

    if( argc <= 1 ) {
        printf("usage: %s <time>\n", argv[0]);
        return 1;
    }

    number = strtoll(argv[1], NULL, 0);
    time = (time_t)number;

    printf("input: %lld, time: %lld\n", number, (long long)time);
    if( time != number ) {
        printf("time_t overflowed\n");
        return 0;
    }

    localdate = localtime(&time);
    gmdate    = gmtime(&time);

    check_date(localdate, time, "localtime");
    check_date(gmdate,    time, "gmtime");

    return 0;
}

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

int check_date(struct tm *date, time_t time, char *name) {
    if( date == NULL ) {
        printf("%s(%lld) returned null\n", name, (long long)time);
        return 1;
    }
    else {
        printf("%s(%lld): %s\n", name, (long long)time, asctime(date));
        return 0;
    }
}

int main(int argc, char *argv[]) {
    long long number;
    time_t time;
    struct tm *localdate;
    struct tm *gmdate;

    if( argc <= 1 ) {
        printf("usage: %s <time>\n", argv[0]);
        return 1;
    }

    printf("sizeof time_t: %ld, tm.tm_year: %ld\n", sizeof(time_t), sizeof(gmdate->tm_year));

    number = strtoll(argv[1], NULL, 0);
    time = (time_t)number;

    printf("input: %lld, time: %lld\n", number, (long long)time);
    if( time != number ) {
        printf("time_t overflowed\n");
        return 0;
    }

    localdate = localtime(&time);
    gmdate    = gmtime(&time);

    check_date(localdate, time, "localtime");
    check_date(gmdate,    time, "gmtime");

    return 0;
}

Print out the size of time_t and tm.tm_year for debugging porpuses.


#import <Foundation/Foundation.h>

NS_ASSUME_NONNULL_BEGIN

@protocol WMFAnalyticsLogging <NSObject>

- (NSString*)analyticsName;

@end

NS_ASSUME_NONNULL_END

#import <Foundation/Foundation.h>

NS_ASSUME_NONNULL_BEGIN

@protocol WMFAnalyticsContextProviding <NSObject>

- (NSString*)analyticsContext;

@end

@protocol WMFAnalyticsContentTypeProviding <NSObject>

- (NSString*)analyticsContentType;

@end

@protocol WMFAnalyticsViewNameProviding <NSObject>

- (NSString*)analyticsName;

@end

NS_ASSUME_NONNULL_END

Add additional protocols for tracking context, content type, and analytics name


//PARAM: --set ana.activated[+] threadJoins --disable ana.thread.include-node --set ana.thread.domain plain
#include <pthread.h>
#include <assert.h>

int g = 0;

void *t_fun(void *arg) {
  g++; // RACE!
  return NULL;
}

int main() {
  pthread_t id;
  pthread_create(&id, NULL, t_fun, NULL);

  __goblint_assume_join(id); // should add to must-joined

  pthread_create(&id, NULL, t_fun, NULL); // should remove from must-joined again

  g++; // RACE!

  return 0;
}

Add threadJoins test where recreated threads should be removed from must-join set


/*
 * TEST: Run copyin and copyout on a user-defined type with two members
 * DIM: 3
 * PRIORITY: 1
 */

#include <stdio.h>
#include "physis/physis.h"

#define N 32
#define ITER 10

struct Point {
  float x;
  float y;
};

DeclareGrid3D(Point, struct Point);

void check(struct Point *in, struct Point *out) {
  int x = 0;
  size_t nelms = N*N*N;
  for (x = 0; x < nelms; ++x) {
    if (in[x].x != out[x].x) {
      fprintf(stderr, "Error: x mismatch at %d, in: %f, out: %f\n",
              x, in[x].x, out[x].x);
      exit(1);
    }
    if (in[x].y != out[x].y) {
      fprintf(stderr, "Error: y mismatch at %d, in: %f, out: %f\n",
              x, in[x].y, out[x].y);
      exit(1);
    }
  }
}

int main(int argc, char *argv[]) {
  PSInit(&argc, &argv, 3, N, N, N);
  PSGrid3DPoint g1 = PSGrid3DPointNew(N, N, N);
  size_t nelms = N*N*N;
  struct Point *indata = (struct Point *)malloc(
      sizeof(struct Point) * nelms);
  int i;
  for (i = 0; i < nelms; i++) {
    indata[i].x = i;
    indata[i].y = i+1;
  }
  struct Point *outdata = (struct Point *)malloc(
      sizeof(struct Point) * nelms);

  PSGridCopyin(g1, indata);
  PSGridCopyout(g1, outdata);

  check(indata, outdata);

  PSGridFree(g1);
  PSFinalize();
  free(indata);
  free(outdata);
  return 0;
}

Add a new simple test case for user-defined types