Comment on didEndTouchesInRangeSlider and other delegate method

Adding a comment on didEndTouchesInRangeSlider and the other didChange... method to explain it's purpose (fairly explanatory names anyway, but just for completeness)

--- Pod/Classes/TTRangeSliderDelegate.h
+++ Pod/Classes/TTRangeSliderDelegate.h
@@ -11,10 +11,16 @@

 @protocol TTRangeSliderDelegate <NSObject>

+/**
+ * Called when the RangeSlider values are changed
+ */
 -(void)rangeSlider:(TTRangeSlider *)sender didChangeSelectedMinimumValue:(float)selectedMinimum andMaximumValue:(float)selectedMaximum;

 @optional

+/**
+ * Called when the user has finished interacting with the RangeSlider
+ */
 - (void)didEndTouchesInRangeSlider:(TTRangeSlider *)sender;

 @end

<|original_code|>
//
//  YLRangeSliderViewDelegate.h
//  FantasyRealFootball
//
//  Created by Tom Thorpe on 16/04/2014.
//  Copyright (c) 2014 Yahoo inc. All rights reserved.
//

#import <Foundation/Foundation.h>
@class TTRangeSlider;

@protocol TTRangeSliderDelegate <NSObject>

-(void)rangeSlider:(TTRangeSlider *)sender didChangeSelectedMinimumValue:(float)selectedMinimum andMaximumValue:(float)selectedMaximum;

@optional

- (void)didEndTouchesInRangeSlider:(TTRangeSlider *)sender;

@end

<|edits_diff|>
--- Pod/Classes/TTRangeSliderDelegate.h
+++ Pod/Classes/TTRangeSliderDelegate.h
@@ -11,6 +11,9 @@

 @protocol TTRangeSliderDelegate <NSObject>

+/**
+ * Called when the RangeSlider values are changed
+ */
 -(void)rangeSlider:(TTRangeSlider *)sender didChangeSelectedMinimumValue:(float)selectedMinimum andMaximumValue:(float)selectedMaximum;

 @optional
<|current_version|>
//
//  YLRangeSliderViewDelegate.h
//  FantasyRealFootball
//
//  Created by Tom Thorpe on 16/04/2014.
//  Copyright (c) 2014 Yahoo inc. All rights reserved.
//

#import <Foundation/Foundation.h>
@class TTRangeSlider;

@protocol TTRangeSliderDelegate <NSObject>

/**
 * Called when the RangeSlider values are changed
 */
-(void)rangeSlider:(TTRangeSlider *)sender didChangeSelectedMinimumValue:(float)selectedMinimum andMaximumValue:(float)selectedMaximum;

@optional

- (void)didEndTouchesInRangeSlider:(TTRangeSlider *)sender;

@end

<|next_version|>
//
//  YLRangeSliderViewDelegate.h
//  FantasyRealFootball
//
//  Created by Tom Thorpe on 16/04/2014.
//  Copyright (c) 2014 Yahoo inc. All rights reserved.
//

#import <Foundation/Foundation.h>
@class TTRangeSlider;

@protocol TTRangeSliderDelegate <NSObject>

/**
 * Called when the RangeSlider values are changed
 */
-(void)rangeSlider:(TTRangeSlider *)sender didChangeSelectedMinimumValue:(float)selectedMinimum andMaximumValue:(float)selectedMaximum;

@optional

/**
 * Called when the user has finished interacting with the RangeSlider
 */
- (void)didEndTouchesInRangeSlider:(TTRangeSlider *)sender;

@end


Add header guards for test input headers

--- test/Interop/Cxx/class/Inputs/access-specifiers.h
+++ test/Interop/Cxx/class/Inputs/access-specifiers.h
@@ -1,3 +1,6 @@
+#ifndef TEST_INTEROP_CXX_CLASS_INPUTS_ACCESS_SPECIFIERS_H
+#define TEST_INTEROP_CXX_CLASS_INPUTS_ACCESS_SPECIFIERS_H
+
 class PublicPrivate {
 public:
   int PublicMemberVar;
@@ -33,3 +36,5 @@
   } __attribute__((enum_extensibility(open)));
   enum PrivateFlagEnum {} __attribute__((flag_enum));
 };
+
+#endif

<|original_code|>
class PublicPrivate {
public:
  int PublicMemberVar;
  static int PublicStaticMemberVar;
  void publicMemberFunc();

  typedef int PublicTypedef;
  struct PublicStruct {};
  enum PublicEnum { PublicEnumValue1 };
  enum { PublicAnonymousEnumValue };
  enum PublicClosedEnum {
    PublicClosedEnumValue1
  } __attribute__((enum_extensibility(closed)));
  enum PublicOpenEnum {
    PublicOpenEnumValue1
  } __attribute__((enum_extensibility(open)));
  enum PublicFlagEnum {} __attribute__((flag_enum));

private:
  int PrivateMemberVar;
  static int PrivateStaticMemberVar;
  void privateMemberFunc() {}

  typedef int PrivateTypedef;
  struct PrivateStruct {};
  enum PrivateEnum { PrivateEnumValue1 };
  enum { PrivateAnonymousEnumValue1 };
  enum PrivateClosedEnum {
    PrivateClosedEnumValue1
  } __attribute__((enum_extensibility(closed)));
  enum PrivateOpenEnum {
    PrivateOpenEnumValue1
  } __attribute__((enum_extensibility(open)));
  enum PrivateFlagEnum {} __attribute__((flag_enum));
};

<|edits_diff|>
--- test/Interop/Cxx/class/Inputs/access-specifiers.h
+++ test/Interop/Cxx/class/Inputs/access-specifiers.h
@@ -1,3 +1,6 @@
+#ifndef TEST_INTEROP_CXX_CLASS_INPUTS_ACCESS_SPECIFIERS_H
+#define TEST_INTEROP_CXX_CLASS_INPUTS_ACCESS_SPECIFIERS_H
+
 class PublicPrivate {
 public:
   int PublicMemberVar;
<|current_version|>
#ifndef TEST_INTEROP_CXX_CLASS_INPUTS_ACCESS_SPECIFIERS_H
#define TEST_INTEROP_CXX_CLASS_INPUTS_ACCESS_SPECIFIERS_H

class PublicPrivate {
public:
  int PublicMemberVar;
  static int PublicStaticMemberVar;
  void publicMemberFunc();

  typedef int PublicTypedef;
  struct PublicStruct {};
  enum PublicEnum { PublicEnumValue1 };
  enum { PublicAnonymousEnumValue };
  enum PublicClosedEnum {
    PublicClosedEnumValue1
  } __attribute__((enum_extensibility(closed)));
  enum PublicOpenEnum {
    PublicOpenEnumValue1
  } __attribute__((enum_extensibility(open)));
  enum PublicFlagEnum {} __attribute__((flag_enum));

private:
  int PrivateMemberVar;
  static int PrivateStaticMemberVar;
  void privateMemberFunc() {}

  typedef int PrivateTypedef;
  struct PrivateStruct {};
  enum PrivateEnum { PrivateEnumValue1 };
  enum { PrivateAnonymousEnumValue1 };
  enum PrivateClosedEnum {
    PrivateClosedEnumValue1
  } __attribute__((enum_extensibility(closed)));
  enum PrivateOpenEnum {
    PrivateOpenEnumValue1
  } __attribute__((enum_extensibility(open)));
  enum PrivateFlagEnum {} __attribute__((flag_enum));
};

<|next_version|>
#ifndef TEST_INTEROP_CXX_CLASS_INPUTS_ACCESS_SPECIFIERS_H
#define TEST_INTEROP_CXX_CLASS_INPUTS_ACCESS_SPECIFIERS_H

class PublicPrivate {
public:
  int PublicMemberVar;
  static int PublicStaticMemberVar;
  void publicMemberFunc();

  typedef int PublicTypedef;
  struct PublicStruct {};
  enum PublicEnum { PublicEnumValue1 };
  enum { PublicAnonymousEnumValue };
  enum PublicClosedEnum {
    PublicClosedEnumValue1
  } __attribute__((enum_extensibility(closed)));
  enum PublicOpenEnum {
    PublicOpenEnumValue1
  } __attribute__((enum_extensibility(open)));
  enum PublicFlagEnum {} __attribute__((flag_enum));

private:
  int PrivateMemberVar;
  static int PrivateStaticMemberVar;
  void privateMemberFunc() {}

  typedef int PrivateTypedef;
  struct PrivateStruct {};
  enum PrivateEnum { PrivateEnumValue1 };
  enum { PrivateAnonymousEnumValue1 };
  enum PrivateClosedEnum {
    PrivateClosedEnumValue1
  } __attribute__((enum_extensibility(closed)));
  enum PrivateOpenEnum {
    PrivateOpenEnumValue1
  } __attribute__((enum_extensibility(open)));
  enum PrivateFlagEnum {} __attribute__((flag_enum));
};

#endif


Add the decoder and field decoder headers to plugin.h

This header file is included by plugins.

--- plugins.h
+++ plugins.h
@@ -22,8 +22,14 @@
 #ifdef __arm__
   #include "api/emit_thumb.h"
   #include "api/emit_arm.h"
+  #include "pie/pie-arm-field-decoder.h"
+  #include "pie/pie-arm-decoder.h"
+  #include "pie/pie-thumb-field-decoder.h"
+  #include "pie/pie-thumb-decoder.h"
 #elif __aarch64__
   #include "api/emit_a64.h"
+  #include "pie/pie-a64-field-decoder.h"
+  #include "pie/pie-a64-decoder.h"
 #endif
 #include "api/helpers.h"
 #include "scanner_common.h"

<|original_code|>
/*
  This file is part of MAMBO, a low-overhead dynamic binary modification tool:
      https://github.com/beehive-lab/mambo

  Copyright 2013-2016 Cosmin Gorgovan <cosmin at linux-geek dot org>

  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 "dbm.h"
#include "scanner_public.h"
#ifdef __arm__
  #include "api/emit_thumb.h"
  #include "api/emit_arm.h"
#elif __aarch64__
  #include "api/emit_a64.h"
#endif
#include "api/helpers.h"
#include "scanner_common.h"

<|edits_diff|>
--- plugins.h
+++ plugins.h
@@ -22,6 +22,10 @@
 #ifdef __arm__
   #include "api/emit_thumb.h"
   #include "api/emit_arm.h"
+  #include "pie/pie-arm-field-decoder.h"
+  #include "pie/pie-arm-decoder.h"
+  #include "pie/pie-thumb-field-decoder.h"
+  #include "pie/pie-thumb-decoder.h"
 #elif __aarch64__
   #include "api/emit_a64.h"
 #endif
<|current_version|>
/*
  This file is part of MAMBO, a low-overhead dynamic binary modification tool:
      https://github.com/beehive-lab/mambo

  Copyright 2013-2016 Cosmin Gorgovan <cosmin at linux-geek dot org>

  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 "dbm.h"
#include "scanner_public.h"
#ifdef __arm__
  #include "api/emit_thumb.h"
  #include "api/emit_arm.h"
  #include "pie/pie-arm-field-decoder.h"
  #include "pie/pie-arm-decoder.h"
  #include "pie/pie-thumb-field-decoder.h"
  #include "pie/pie-thumb-decoder.h"
#elif __aarch64__
  #include "api/emit_a64.h"
#endif
#include "api/helpers.h"
#include "scanner_common.h"

<|next_version|>
/*
  This file is part of MAMBO, a low-overhead dynamic binary modification tool:
      https://github.com/beehive-lab/mambo

  Copyright 2013-2016 Cosmin Gorgovan <cosmin at linux-geek dot org>

  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 "dbm.h"
#include "scanner_public.h"
#ifdef __arm__
  #include "api/emit_thumb.h"
  #include "api/emit_arm.h"
  #include "pie/pie-arm-field-decoder.h"
  #include "pie/pie-arm-decoder.h"
  #include "pie/pie-thumb-field-decoder.h"
  #include "pie/pie-thumb-decoder.h"
#elif __aarch64__
  #include "api/emit_a64.h"
  #include "pie/pie-a64-field-decoder.h"
  #include "pie/pie-a64-decoder.h"
#endif
#include "api/helpers.h"
#include "scanner_common.h"


Add Cygwin fixes for sched_get_priority_min() and sched_get_priority_max().

svn path=/incubator/harmony/enhanced/jchevm/; revision=379838

--- libjc/arch/i386/i386_definitions.h
+++ libjc/arch/i386/i386_definitions.h
@@ -31,9 +31,12 @@

 #define _JC_BIG_ENDIAN		0

+/* Fixes for Cygwin */
 #ifdef __CYGWIN__
 #undef _JC_LIBRARY_FMT
 #define _JC_LIBRARY_FMT		"cyg%s.dll"
+#define sched_get_priority_max(x)	(15)
+#define sched_get_priority_min(x)	(1)
 #endif

 #endif	/* _ARCH_I386_DEFINITIONS_H_ */

<|original_code|>

/*
 * Copyright 2005 The Apache Software Foundation or its licensors,
 * as applicable.
 *
 *  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.
 *
 * $Id$
 */

#ifndef _ARCH_I386_DEFINITIONS_H_
#define _ARCH_I386_DEFINITIONS_H_

#if !defined(__i386__)
#error "This include file is for the i386 architecture only"
#endif

#define	_JC_PAGE_SHIFT		12		/* 4096 byte pages */

#define _JC_STACK_ALIGN		2

#define _JC_BIG_ENDIAN		0

#ifdef __CYGWIN__
#undef _JC_LIBRARY_FMT
#define _JC_LIBRARY_FMT		"cyg%s.dll"
#endif

#endif	/* _ARCH_I386_DEFINITIONS_H_ */

<|edits_diff|>
--- libjc/arch/i386/i386_definitions.h
+++ libjc/arch/i386/i386_definitions.h
@@ -31,6 +31,7 @@

 #define _JC_BIG_ENDIAN		0

+/* Fixes for Cygwin */
 #ifdef __CYGWIN__
 #undef _JC_LIBRARY_FMT
 #define _JC_LIBRARY_FMT		"cyg%s.dll"
<|current_version|>

/*
 * Copyright 2005 The Apache Software Foundation or its licensors,
 * as applicable.
 *
 *  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.
 *
 * $Id$
 */

#ifndef _ARCH_I386_DEFINITIONS_H_
#define _ARCH_I386_DEFINITIONS_H_

#if !defined(__i386__)
#error "This include file is for the i386 architecture only"
#endif

#define	_JC_PAGE_SHIFT		12		/* 4096 byte pages */

#define _JC_STACK_ALIGN		2

#define _JC_BIG_ENDIAN		0

/* Fixes for Cygwin */
#ifdef __CYGWIN__
#undef _JC_LIBRARY_FMT
#define _JC_LIBRARY_FMT		"cyg%s.dll"
#endif

#endif	/* _ARCH_I386_DEFINITIONS_H_ */

<|next_version|>

/*
 * Copyright 2005 The Apache Software Foundation or its licensors,
 * as applicable.
 *
 *  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.
 *
 * $Id$
 */

#ifndef _ARCH_I386_DEFINITIONS_H_
#define _ARCH_I386_DEFINITIONS_H_

#if !defined(__i386__)
#error "This include file is for the i386 architecture only"
#endif

#define	_JC_PAGE_SHIFT		12		/* 4096 byte pages */

#define _JC_STACK_ALIGN		2

#define _JC_BIG_ENDIAN		0

/* Fixes for Cygwin */
#ifdef __CYGWIN__
#undef _JC_LIBRARY_FMT
#define _JC_LIBRARY_FMT		"cyg%s.dll"
#define sched_get_priority_max(x)	(15)
#define sched_get_priority_min(x)	(1)
#endif

#endif	/* _ARCH_I386_DEFINITIONS_H_ */


Enable use of stub from C++

equeue: Enable use of stub from C++

Add extern "C" to the equeue_stub declaration to avoid an error when a C
file implements the equeue_stub symbol (as we do in equeue_stub.c).

    Undefined symbols for architecture x86_64:
      "_equeue_stub", referenced from:
          Test_LoRaWANTimer_start_Test::TestBody() in Test_LoRaWANTimer.cpp.o
    ld: symbol(s) not found for architecture x86_64
    clang: error: linker command failed with exit code 1 (use -v to see invocation)

--- events/tests/UNITTESTS/doubles/equeue_stub.h
+++ events/tests/UNITTESTS/doubles/equeue_stub.h
@@ -21,6 +21,10 @@
 #include "stdint.h"
 #include "stdbool.h"

+#ifdef __cplusplus
+extern "C" {
+#endif
+
 typedef struct {
     void *void_ptr;
     bool call_cb_immediately;
@@ -28,4 +32,8 @@

 extern equeue_stub_def equeue_stub;

+#ifdef __cplusplus
+}
 #endif
+
+#endif

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

#ifndef __EQUEUE_STUB_H__
#define __EQUEUE_STUB_H__

#include "stdint.h"
#include "stdbool.h"

typedef struct {
    void *void_ptr;
    bool call_cb_immediately;
} equeue_stub_def;

extern equeue_stub_def equeue_stub;

#endif

<|edits_diff|>
--- events/tests/UNITTESTS/doubles/equeue_stub.h
+++ events/tests/UNITTESTS/doubles/equeue_stub.h
@@ -21,6 +21,10 @@
 #include "stdint.h"
 #include "stdbool.h"

+#ifdef __cplusplus
+extern "C" {
+#endif
+
 typedef struct {
     void *void_ptr;
     bool call_cb_immediately;
@@ -28,4 +32,6 @@

 extern equeue_stub_def equeue_stub;

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

#ifndef __EQUEUE_STUB_H__
#define __EQUEUE_STUB_H__

#include "stdint.h"
#include "stdbool.h"

#ifdef __cplusplus
extern "C" {
#endif

typedef struct {
    void *void_ptr;
    bool call_cb_immediately;
} equeue_stub_def;

extern equeue_stub_def equeue_stub;

#ifdef __cplusplus
}
#endif

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

#ifndef __EQUEUE_STUB_H__
#define __EQUEUE_STUB_H__

#include "stdint.h"
#include "stdbool.h"

#ifdef __cplusplus
extern "C" {
#endif

typedef struct {
    void *void_ptr;
    bool call_cb_immediately;
} equeue_stub_def;

extern equeue_stub_def equeue_stub;

#ifdef __cplusplus
}
#endif

#endif


Add timestamp to output in the beginning of output.

--- libs/console/src/cons_fmt.c
+++ libs/console/src/cons_fmt.c
@@ -16,6 +16,7 @@
 #include <stdarg.h>
 #include <stdio.h>
 #include <console/console.h>
+#include <os/os_time.h>

 #define CONS_OUTPUT_MAX_LINE	128

@@ -24,6 +25,9 @@
     va_list args;
     char buf[CONS_OUTPUT_MAX_LINE];
     int len;
+
+    len = snprintf(buf, sizeof(buf), "%lu:", os_time_get());
+    console_write(buf, len);

     va_start(args, fmt);
     len = vsnprintf(buf, sizeof(buf), fmt, args);

<|original_code|>
/**
 * Copyright (c) 2015 Runtime Inc.
 *
 * 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 <stdarg.h>
#include <stdio.h>
#include <console/console.h>

#define CONS_OUTPUT_MAX_LINE	128

void console_printf(const char *fmt, ...)
{
    va_list args;
    char buf[CONS_OUTPUT_MAX_LINE];
    int len;

    va_start(args, fmt);
    len = vsnprintf(buf, sizeof(buf), fmt, args);
    va_end(args);

    if (len >= sizeof(buf)) {
        len = sizeof(buf) - 1;
    }
    if (buf[len - 1] != '\n') {
        if (len != sizeof(buf) - 1) {
            len++;
        }
        buf[len - 1] = '\n';
    }
    console_write(buf, len);
}

<|edits_diff|>
--- libs/console/src/cons_fmt.c
+++ libs/console/src/cons_fmt.c
@@ -16,6 +16,7 @@
 #include <stdarg.h>
 #include <stdio.h>
 #include <console/console.h>
+#include <os/os_time.h>

 #define CONS_OUTPUT_MAX_LINE	128

<|current_version|>
/**
 * Copyright (c) 2015 Runtime Inc.
 *
 * 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 <stdarg.h>
#include <stdio.h>
#include <console/console.h>
#include <os/os_time.h>

#define CONS_OUTPUT_MAX_LINE	128

void console_printf(const char *fmt, ...)
{
    va_list args;
    char buf[CONS_OUTPUT_MAX_LINE];
    int len;

    va_start(args, fmt);
    len = vsnprintf(buf, sizeof(buf), fmt, args);
    va_end(args);

    if (len >= sizeof(buf)) {
        len = sizeof(buf) - 1;
    }
    if (buf[len - 1] != '\n') {
        if (len != sizeof(buf) - 1) {
            len++;
        }
        buf[len - 1] = '\n';
    }
    console_write(buf, len);
}

<|next_version|>
/**
 * Copyright (c) 2015 Runtime Inc.
 *
 * 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 <stdarg.h>
#include <stdio.h>
#include <console/console.h>
#include <os/os_time.h>

#define CONS_OUTPUT_MAX_LINE	128

void console_printf(const char *fmt, ...)
{
    va_list args;
    char buf[CONS_OUTPUT_MAX_LINE];
    int len;

    len = snprintf(buf, sizeof(buf), "%lu:", os_time_get());
    console_write(buf, len);

    va_start(args, fmt);
    len = vsnprintf(buf, sizeof(buf), fmt, args);
    va_end(args);

    if (len >= sizeof(buf)) {
        len = sizeof(buf) - 1;
    }
    if (buf[len - 1] != '\n') {
        if (len != sizeof(buf) - 1) {
            len++;
        }
        buf[len - 1] = '\n';
    }
    console_write(buf, len);
}


Fix C++ compilation on windows.

Fix C++ compilation on windows.

svn path=/incubator/harmony/enhanced/classlib/trunk/; revision=423414

--- modules/luni/src/main/native/include/shared/exceptions.h
+++ modules/luni/src/main/native/include/shared/exceptions.h
@@ -18,6 +18,11 @@

 #include <string.h>
 #include "vmi.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 void throwNewExceptionByName(JNIEnv* env,
                              const char* name, const char* message);
 void throwNewOutOfMemoryError(JNIEnv* env, const char* message);
@@ -26,4 +31,8 @@
 void throwNPException(JNIEnv* env, const char* message);
 void throwIndexOutOfBoundsException(JNIEnv* env);

+#ifdef __cplusplus
+}
 #endif
+
+#endif

<|original_code|>
/* Copyright 1998, 2005 The Apache Software Foundation or its licensors, as applicable
 *
 * 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 EXCEPTIONS_H
#define EXCEPTIONS_H

#include <string.h>
#include "vmi.h"
void throwNewExceptionByName(JNIEnv* env,
                             const char* name, const char* message);
void throwNewOutOfMemoryError(JNIEnv* env, const char* message);
void throwJavaIoIOException(JNIEnv* env, const char* message);
void throwJavaIoIOExceptionClosed(JNIEnv* env);
void throwNPException(JNIEnv* env, const char* message);
void throwIndexOutOfBoundsException(JNIEnv* env);

#endif

<|edits_diff|>
--- modules/luni/src/main/native/include/shared/exceptions.h
+++ modules/luni/src/main/native/include/shared/exceptions.h
@@ -18,6 +18,11 @@

 #include <string.h>
 #include "vmi.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 void throwNewExceptionByName(JNIEnv* env,
                              const char* name, const char* message);
 void throwNewOutOfMemoryError(JNIEnv* env, const char* message);
@@ -26,4 +31,6 @@
 void throwNPException(JNIEnv* env, const char* message);
 void throwIndexOutOfBoundsException(JNIEnv* env);

+#ifdef __cplusplus
+}
 #endif
<|current_version|>
/* Copyright 1998, 2005 The Apache Software Foundation or its licensors, as applicable
 *
 * 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 EXCEPTIONS_H
#define EXCEPTIONS_H

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

#ifdef __cplusplus
extern "C" {
#endif

void throwNewExceptionByName(JNIEnv* env,
                             const char* name, const char* message);
void throwNewOutOfMemoryError(JNIEnv* env, const char* message);
void throwJavaIoIOException(JNIEnv* env, const char* message);
void throwJavaIoIOExceptionClosed(JNIEnv* env);
void throwNPException(JNIEnv* env, const char* message);
void throwIndexOutOfBoundsException(JNIEnv* env);

#ifdef __cplusplus
}
#endif

<|next_version|>
/* Copyright 1998, 2005 The Apache Software Foundation or its licensors, as applicable
 *
 * 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 EXCEPTIONS_H
#define EXCEPTIONS_H

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

#ifdef __cplusplus
extern "C" {
#endif

void throwNewExceptionByName(JNIEnv* env,
                             const char* name, const char* message);
void throwNewOutOfMemoryError(JNIEnv* env, const char* message);
void throwJavaIoIOException(JNIEnv* env, const char* message);
void throwJavaIoIOExceptionClosed(JNIEnv* env);
void throwNPException(JNIEnv* env, const char* message);
void throwIndexOutOfBoundsException(JNIEnv* env);

#ifdef __cplusplus
}
#endif

#endif


Make this header file self-contained

Make this header file self-contained

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

--- include/llvm/Transforms/Utils/FunctionUtils.h
+++ include/llvm/Transforms/Utils/FunctionUtils.h
@@ -14,8 +14,11 @@
 #ifndef LLVM_TRANSFORMS_UTILS_FUNCTION_H
 #define LLVM_TRANSFORMS_UTILS_FUNCTION_H

+#include <vector>
+
 namespace llvm {

+  class BasicBlock;
 class Function;
 class Loop;

<|original_code|>
//===-- Transform/Utils/FunctionUtils.h - Function Utils --------*- C++ -*-===//
//
//                     The LLVM Compiler Infrastructure
//
// This file was developed by the LLVM research group and is distributed under
// the University of Illinois Open Source License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
//
// This family of transformations manipulate LLVM functions.
//
//===----------------------------------------------------------------------===//

#ifndef LLVM_TRANSFORMS_UTILS_FUNCTION_H
#define LLVM_TRANSFORMS_UTILS_FUNCTION_H

namespace llvm {

class Function;
class Loop;

/// ExtractCodeRegion - rip out a sequence of basic blocks into a new function
///
Function* ExtractCodeRegion(const std::vector<BasicBlock*> &code);

/// ExtractLoop - rip out a natural loop into a new function
///
Function* ExtractLoop(Loop *L);

/// ExtractBasicBlock - rip out a basic block into a new function
///
Function* ExtractBasicBlock(BasicBlock *BB);

}

#endif

<|edits_diff|>
--- include/llvm/Transforms/Utils/FunctionUtils.h
+++ include/llvm/Transforms/Utils/FunctionUtils.h
@@ -13,6 +13,8 @@

 #ifndef LLVM_TRANSFORMS_UTILS_FUNCTION_H
 #define LLVM_TRANSFORMS_UTILS_FUNCTION_H
+
+#include <vector>

 namespace llvm {

<|current_version|>
//===-- Transform/Utils/FunctionUtils.h - Function Utils --------*- C++ -*-===//
//
//                     The LLVM Compiler Infrastructure
//
// This file was developed by the LLVM research group and is distributed under
// the University of Illinois Open Source License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
//
// This family of transformations manipulate LLVM functions.
//
//===----------------------------------------------------------------------===//

#ifndef LLVM_TRANSFORMS_UTILS_FUNCTION_H
#define LLVM_TRANSFORMS_UTILS_FUNCTION_H

#include <vector>

namespace llvm {

class Function;
class Loop;

/// ExtractCodeRegion - rip out a sequence of basic blocks into a new function
///
Function* ExtractCodeRegion(const std::vector<BasicBlock*> &code);

/// ExtractLoop - rip out a natural loop into a new function
///
Function* ExtractLoop(Loop *L);

/// ExtractBasicBlock - rip out a basic block into a new function
///
Function* ExtractBasicBlock(BasicBlock *BB);

}

#endif

<|next_version|>
//===-- Transform/Utils/FunctionUtils.h - Function Utils --------*- C++ -*-===//
//
//                     The LLVM Compiler Infrastructure
//
// This file was developed by the LLVM research group and is distributed under
// the University of Illinois Open Source License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
//
// This family of transformations manipulate LLVM functions.
//
//===----------------------------------------------------------------------===//

#ifndef LLVM_TRANSFORMS_UTILS_FUNCTION_H
#define LLVM_TRANSFORMS_UTILS_FUNCTION_H

#include <vector>

namespace llvm {

  class BasicBlock;
class Function;
class Loop;

/// ExtractCodeRegion - rip out a sequence of basic blocks into a new function
///
Function* ExtractCodeRegion(const std::vector<BasicBlock*> &code);

/// ExtractLoop - rip out a natural loop into a new function
///
Function* ExtractLoop(Loop *L);

/// ExtractBasicBlock - rip out a basic block into a new function
///
Function* ExtractBasicBlock(BasicBlock *BB);

}

#endif


Fix build breakage caused by memory leaks in llvm-c-test

I accidently introduced those in r227319.

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

--- tools/llvm-c-test/metadata.c
+++ tools/llvm-c-test/metadata.c
@@ -22,6 +22,8 @@
   // This used to trigger an assertion
   LLVMAddNamedMetadataOperand(m, "name", LLVMMDNode(values, 1));

+  LLVMDisposeModule(m);
+
   return 0;
 }

@@ -35,5 +37,7 @@
       LLVMGetMDKindID("kind", 4),
       LLVMMDNode(values, 1));

+  LLVMDisposeBuilder(b);
+
   return 0;
 }

<|original_code|>
/*===-- object.c - tool for testing libLLVM and llvm-c API ----------------===*\
|*                                                                            *|
|*                     The LLVM Compiler Infrastructure                       *|
|*                                                                            *|
|* This file is distributed under the University of Illinois Open Source      *|
|* License. See LICENSE.TXT for details.                                      *|
|*                                                                            *|
|*===----------------------------------------------------------------------===*|
|*                                                                            *|
|* This file implements the --add-named-metadata-operand and --set-metadata   *|
|* commands in llvm-c-test.                                                   *|
|*                                                                            *|
\*===----------------------------------------------------------------------===*/

#include "llvm-c-test.h"
#include "llvm-c/Core.h"

int add_named_metadata_operand(void) {
  LLVMModuleRef m = LLVMModuleCreateWithName("Mod");
  LLVMValueRef values[] = { LLVMConstInt(LLVMInt32Type(), 0, 0) };

  // This used to trigger an assertion
  LLVMAddNamedMetadataOperand(m, "name", LLVMMDNode(values, 1));

  return 0;
}

int set_metadata(void) {
  LLVMBuilderRef b = LLVMCreateBuilder();
  LLVMValueRef values[] = { LLVMConstInt(LLVMInt32Type(), 0, 0) };

  // This used to trigger an assertion
  LLVMSetMetadata(
      LLVMBuildRetVoid(b),
      LLVMGetMDKindID("kind", 4),
      LLVMMDNode(values, 1));

  return 0;
}

<|edits_diff|>
--- tools/llvm-c-test/metadata.c
+++ tools/llvm-c-test/metadata.c
@@ -22,6 +22,8 @@
   // This used to trigger an assertion
   LLVMAddNamedMetadataOperand(m, "name", LLVMMDNode(values, 1));

+  LLVMDisposeModule(m);
+
   return 0;
 }

<|current_version|>
/*===-- object.c - tool for testing libLLVM and llvm-c API ----------------===*\
|*                                                                            *|
|*                     The LLVM Compiler Infrastructure                       *|
|*                                                                            *|
|* This file is distributed under the University of Illinois Open Source      *|
|* License. See LICENSE.TXT for details.                                      *|
|*                                                                            *|
|*===----------------------------------------------------------------------===*|
|*                                                                            *|
|* This file implements the --add-named-metadata-operand and --set-metadata   *|
|* commands in llvm-c-test.                                                   *|
|*                                                                            *|
\*===----------------------------------------------------------------------===*/

#include "llvm-c-test.h"
#include "llvm-c/Core.h"

int add_named_metadata_operand(void) {
  LLVMModuleRef m = LLVMModuleCreateWithName("Mod");
  LLVMValueRef values[] = { LLVMConstInt(LLVMInt32Type(), 0, 0) };

  // This used to trigger an assertion
  LLVMAddNamedMetadataOperand(m, "name", LLVMMDNode(values, 1));

  LLVMDisposeModule(m);

  return 0;
}

int set_metadata(void) {
  LLVMBuilderRef b = LLVMCreateBuilder();
  LLVMValueRef values[] = { LLVMConstInt(LLVMInt32Type(), 0, 0) };

  // This used to trigger an assertion
  LLVMSetMetadata(
      LLVMBuildRetVoid(b),
      LLVMGetMDKindID("kind", 4),
      LLVMMDNode(values, 1));

  return 0;
}

<|next_version|>
/*===-- object.c - tool for testing libLLVM and llvm-c API ----------------===*\
|*                                                                            *|
|*                     The LLVM Compiler Infrastructure                       *|
|*                                                                            *|
|* This file is distributed under the University of Illinois Open Source      *|
|* License. See LICENSE.TXT for details.                                      *|
|*                                                                            *|
|*===----------------------------------------------------------------------===*|
|*                                                                            *|
|* This file implements the --add-named-metadata-operand and --set-metadata   *|
|* commands in llvm-c-test.                                                   *|
|*                                                                            *|
\*===----------------------------------------------------------------------===*/

#include "llvm-c-test.h"
#include "llvm-c/Core.h"

int add_named_metadata_operand(void) {
  LLVMModuleRef m = LLVMModuleCreateWithName("Mod");
  LLVMValueRef values[] = { LLVMConstInt(LLVMInt32Type(), 0, 0) };

  // This used to trigger an assertion
  LLVMAddNamedMetadataOperand(m, "name", LLVMMDNode(values, 1));

  LLVMDisposeModule(m);

  return 0;
}

int set_metadata(void) {
  LLVMBuilderRef b = LLVMCreateBuilder();
  LLVMValueRef values[] = { LLVMConstInt(LLVMInt32Type(), 0, 0) };

  // This used to trigger an assertion
  LLVMSetMetadata(
      LLVMBuildRetVoid(b),
      LLVMGetMDKindID("kind", 4),
      LLVMMDNode(values, 1));

  LLVMDisposeBuilder(b);

  return 0;
}


Add missing property for WebUtils mock

[sailfish-browser] Add missing property for WebUtils mock

A warning was printed when running unit tests.

--- tests/auto/common/declarativewebutils.h
+++ tests/auto/common/declarativewebutils.h
@@ -21,6 +21,7 @@
 {
     Q_OBJECT
     Q_PROPERTY(QString homePage READ homePage NOTIFY homePageChanged FINAL)
+    Q_PROPERTY(bool firstUseDone READ firstUseDone NOTIFY firstUseDoneChanged FINAL)

 public:
     explicit DeclarativeWebUtils(QObject *parent = 0);
@@ -36,6 +37,7 @@

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

 private:
     QString m_homePage;

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

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

#ifndef DECLARATIVEWEBUTILS_H
#define DECLARATIVEWEBUTILS_H

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

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

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

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

    static DeclarativeWebUtils *instance();

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

signals:
    void homePageChanged();

private:
    QString m_homePage;
    bool m_firstUseDone;
};

QML_DECLARE_TYPE(DeclarativeWebUtils)

#endif

<|edits_diff|>
--- tests/auto/common/declarativewebutils.h
+++ tests/auto/common/declarativewebutils.h
@@ -21,6 +21,7 @@
 {
     Q_OBJECT
     Q_PROPERTY(QString homePage READ homePage NOTIFY homePageChanged FINAL)
+    Q_PROPERTY(bool firstUseDone READ firstUseDone NOTIFY firstUseDoneChanged FINAL)

 public:
     explicit DeclarativeWebUtils(QObject *parent = 0);
<|current_version|>
/****************************************************************************
**
** Copyright (C) 2014 Jolla Ltd.
** Contact: Raine Makelainen <raine.makelainen@jolla.com>
**
****************************************************************************/

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

#ifndef DECLARATIVEWEBUTILS_H
#define DECLARATIVEWEBUTILS_H

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

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

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

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

    static DeclarativeWebUtils *instance();

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

signals:
    void homePageChanged();

private:
    QString m_homePage;
    bool m_firstUseDone;
};

QML_DECLARE_TYPE(DeclarativeWebUtils)

#endif

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

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

#ifndef DECLARATIVEWEBUTILS_H
#define DECLARATIVEWEBUTILS_H

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

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

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

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

    static DeclarativeWebUtils *instance();

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

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

private:
    QString m_homePage;
    bool m_firstUseDone;
};

QML_DECLARE_TYPE(DeclarativeWebUtils)

#endif


Comment on Backend member functions

Comment on Backend member functions

--- xchainer/backend.h
+++ xchainer/backend.h
@@ -12,8 +12,16 @@
 public:
     virtual ~Backend() = default;

+    // Allocates a memory chunk on the specified device.
     virtual std::shared_ptr<void> Allocate(const Device& device, size_t bytesize) = 0;
+
+    // Copies the data between two memory chunks.
     virtual void MemoryCopy(void* dst_ptr, const void* src_ptr, size_t bytesize) = 0;
+
+    // Creates a data buffer filled with the specified data on the specified device.
+    //
+    // It may allocate a new memory or return an alias.
+    // src_ptr is guaranteed to reside in the main RAM.
     virtual std::shared_ptr<void> FromBuffer(const Device& device, const std::shared_ptr<void>& src_ptr, size_t bytesize) = 0;

     virtual void Fill(Array& out, Scalar value) = 0;

<|original_code|>
#pragma once

#include <memory>

#include "xchainer/array.h"
#include "xchainer/device.h"
#include "xchainer/scalar.h"

namespace xchainer {

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

    virtual std::shared_ptr<void> Allocate(const Device& device, size_t bytesize) = 0;
    virtual void MemoryCopy(void* dst_ptr, const void* src_ptr, size_t bytesize) = 0;
    virtual std::shared_ptr<void> FromBuffer(const Device& device, const std::shared_ptr<void>& src_ptr, size_t bytesize) = 0;

    virtual void Fill(Array& out, Scalar value) = 0;

    virtual void Add(const Array& lhs, const Array& rhs, Array& out) = 0;
    virtual void Mul(const Array& lhs, const Array& rhs, Array& out) = 0;

    virtual void Synchronize() = 0;
};

}  // namespace xchainer

<|edits_diff|>
--- xchainer/backend.h
+++ xchainer/backend.h
@@ -12,7 +12,10 @@
 public:
     virtual ~Backend() = default;

+    // Allocates a memory chunk on the specified device.
     virtual std::shared_ptr<void> Allocate(const Device& device, size_t bytesize) = 0;
+
+    // Copies the data between two memory chunks.
     virtual void MemoryCopy(void* dst_ptr, const void* src_ptr, size_t bytesize) = 0;
     virtual std::shared_ptr<void> FromBuffer(const Device& device, const std::shared_ptr<void>& src_ptr, size_t bytesize) = 0;

<|current_version|>
#pragma once

#include <memory>

#include "xchainer/array.h"
#include "xchainer/device.h"
#include "xchainer/scalar.h"

namespace xchainer {

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

    // Allocates a memory chunk on the specified device.
    virtual std::shared_ptr<void> Allocate(const Device& device, size_t bytesize) = 0;

    // Copies the data between two memory chunks.
    virtual void MemoryCopy(void* dst_ptr, const void* src_ptr, size_t bytesize) = 0;
    virtual std::shared_ptr<void> FromBuffer(const Device& device, const std::shared_ptr<void>& src_ptr, size_t bytesize) = 0;

    virtual void Fill(Array& out, Scalar value) = 0;

    virtual void Add(const Array& lhs, const Array& rhs, Array& out) = 0;
    virtual void Mul(const Array& lhs, const Array& rhs, Array& out) = 0;

    virtual void Synchronize() = 0;
};

}  // namespace xchainer

<|next_version|>
#pragma once

#include <memory>

#include "xchainer/array.h"
#include "xchainer/device.h"
#include "xchainer/scalar.h"

namespace xchainer {

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

    // Allocates a memory chunk on the specified device.
    virtual std::shared_ptr<void> Allocate(const Device& device, size_t bytesize) = 0;

    // Copies the data between two memory chunks.
    virtual void MemoryCopy(void* dst_ptr, const void* src_ptr, size_t bytesize) = 0;

    // Creates a data buffer filled with the specified data on the specified device.
    //
    // It may allocate a new memory or return an alias.
    // src_ptr is guaranteed to reside in the main RAM.
    virtual std::shared_ptr<void> FromBuffer(const Device& device, const std::shared_ptr<void>& src_ptr, size_t bytesize) = 0;

    virtual void Fill(Array& out, Scalar value) = 0;

    virtual void Add(const Array& lhs, const Array& rhs, Array& out) = 0;
    virtual void Mul(const Array& lhs, const Array& rhs, Array& out) = 0;

    virtual void Synchronize() = 0;
};

}  // namespace xchainer


Fix invalid delete[] calls in ~Problem

Fix invalid delete[] calls in ~Problem

If objcnt is 0, then no memory has been allocated.

--- src/problem.h
+++ src/problem.h
@@ -15,12 +15,17 @@
     int* conind;
     char* consense;

+    Problem();
     ~Problem();

 };

+inline Problem::Problem() : objcnt(0) { }

 inline Problem::~Problem() {
+  // If objcnt == 0, then no problem has been assigned and no memory allocated
+  if (objcnt == 0)
+    return;
   for(int j = 0; j < objcnt; ++j) {
     delete[] objind[j];
     delete[] objcoef[j];

<|original_code|>
#ifndef PROBLEM_H
#define PROBLEM_H

#include "sense.h"

class Problem {
  public:
    int objcnt; // Number of objectives
    double* rhs;
    int** objind; // Objective indices
    double** objcoef; // Objective coefficients
    Sense objsen; // Objective sense. Note that all objectives must have the same
                // sense (i.e., either all objectives are to be minimised, or
                // all objectives are to be maximised).
    int* conind;
    char* consense;

    ~Problem();

};

inline Problem::~Problem() {
  for(int j = 0; j < objcnt; ++j) {
    delete[] objind[j];
    delete[] objcoef[j];
  }
  delete[] objind;
  delete[] objcoef;
  delete[] rhs;
  delete[] conind;
  delete[] consense;
}
#endif /* PROBLEM_H */

<|edits_diff|>
--- src/problem.h
+++ src/problem.h
@@ -15,10 +15,12 @@
     int* conind;
     char* consense;

+    Problem();
     ~Problem();

 };

+inline Problem::Problem() : objcnt(0) { }

 inline Problem::~Problem() {
   for(int j = 0; j < objcnt; ++j) {
<|current_version|>
#ifndef PROBLEM_H
#define PROBLEM_H

#include "sense.h"

class Problem {
  public:
    int objcnt; // Number of objectives
    double* rhs;
    int** objind; // Objective indices
    double** objcoef; // Objective coefficients
    Sense objsen; // Objective sense. Note that all objectives must have the same
                // sense (i.e., either all objectives are to be minimised, or
                // all objectives are to be maximised).
    int* conind;
    char* consense;

    Problem();
    ~Problem();

};

inline Problem::Problem() : objcnt(0) { }

inline Problem::~Problem() {
  for(int j = 0; j < objcnt; ++j) {
    delete[] objind[j];
    delete[] objcoef[j];
  }
  delete[] objind;
  delete[] objcoef;
  delete[] rhs;
  delete[] conind;
  delete[] consense;
}
#endif /* PROBLEM_H */

<|next_version|>
#ifndef PROBLEM_H
#define PROBLEM_H

#include "sense.h"

class Problem {
  public:
    int objcnt; // Number of objectives
    double* rhs;
    int** objind; // Objective indices
    double** objcoef; // Objective coefficients
    Sense objsen; // Objective sense. Note that all objectives must have the same
                // sense (i.e., either all objectives are to be minimised, or
                // all objectives are to be maximised).
    int* conind;
    char* consense;

    Problem();
    ~Problem();

};

inline Problem::Problem() : objcnt(0) { }

inline Problem::~Problem() {
  // If objcnt == 0, then no problem has been assigned and no memory allocated
  if (objcnt == 0)
    return;
  for(int j = 0; j < objcnt; ++j) {
    delete[] objind[j];
    delete[] objcoef[j];
  }
  delete[] objind;
  delete[] objcoef;
  delete[] rhs;
  delete[] conind;
  delete[] consense;
}
#endif /* PROBLEM_H */


Add training_error to utils namespace.

Add training_error to utils namespace.

The training_error is used by binary_encoder, which includes only
utils/common.h -- that opens std only in utils namespace, not in
whole ufal::udpipe.

--- src/trainer/training_failure.h
+++ src/trainer/training_failure.h
@@ -16,6 +16,7 @@

 namespace ufal {
 namespace udpipe {
+namespace utils {

 class training_error : public runtime_error {
  public:
@@ -26,5 +27,6 @@

 #define training_failure(message) throw (training_error::message_collector << message, training_error())

+} // namespace utils
 } // namespace udpipe
 } // namespace ufal

<|original_code|>
// This file is part of UDPipe <http://github.com/ufal/udpipe/>.
//
// Copyright 2016 Institute of Formal and Applied Linguistics, Faculty of
// Mathematics and Physics, Charles University in Prague, Czech Republic.
//
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/.

#pragma once

#include <sstream>
#include <stdexcept>

#include "common.h"

namespace ufal {
namespace udpipe {

class training_error : public runtime_error {
 public:
  training_error();

  static ostringstream message_collector;
};

#define training_failure(message) throw (training_error::message_collector << message, training_error())

} // namespace udpipe
} // namespace ufal

<|edits_diff|>
--- src/trainer/training_failure.h
+++ src/trainer/training_failure.h
@@ -16,6 +16,7 @@

 namespace ufal {
 namespace udpipe {
+namespace utils {

 class training_error : public runtime_error {
  public:
<|current_version|>
// This file is part of UDPipe <http://github.com/ufal/udpipe/>.
//
// Copyright 2016 Institute of Formal and Applied Linguistics, Faculty of
// Mathematics and Physics, Charles University in Prague, Czech Republic.
//
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/.

#pragma once

#include <sstream>
#include <stdexcept>

#include "common.h"

namespace ufal {
namespace udpipe {
namespace utils {

class training_error : public runtime_error {
 public:
  training_error();

  static ostringstream message_collector;
};

#define training_failure(message) throw (training_error::message_collector << message, training_error())

} // namespace udpipe
} // namespace ufal

<|next_version|>
// This file is part of UDPipe <http://github.com/ufal/udpipe/>.
//
// Copyright 2016 Institute of Formal and Applied Linguistics, Faculty of
// Mathematics and Physics, Charles University in Prague, Czech Republic.
//
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/.

#pragma once

#include <sstream>
#include <stdexcept>

#include "common.h"

namespace ufal {
namespace udpipe {
namespace utils {

class training_error : public runtime_error {
 public:
  training_error();

  static ostringstream message_collector;
};

#define training_failure(message) throw (training_error::message_collector << message, training_error())

} // namespace utils
} // namespace udpipe
} // namespace ufal


Enable C++ support for socket debug transport

--- examples/debug-trans-socket/duk_trans_socket.h
+++ examples/debug-trans-socket/duk_trans_socket.h
@@ -2,6 +2,10 @@
 #define DUK_TRANS_SOCKET_H_INCLUDED

 #include "duktape.h"
+
+#if defined(__cplusplus)
+extern "C" {
+#endif

 void duk_trans_socket_init(void);
 void duk_trans_socket_finish(void);
@@ -12,4 +16,8 @@
 void duk_trans_socket_read_flush_cb(void *udata);
 void duk_trans_socket_write_flush_cb(void *udata);

+#if defined(__cplusplus)
+}
+#endif  /* end 'extern "C"' wrapper */
+
 #endif  /* DUK_TRANS_SOCKET_H_INCLUDED */

<|original_code|>
#if !defined(DUK_TRANS_SOCKET_H_INCLUDED)
#define DUK_TRANS_SOCKET_H_INCLUDED

#include "duktape.h"

void duk_trans_socket_init(void);
void duk_trans_socket_finish(void);
void duk_trans_socket_waitconn(void);
duk_size_t duk_trans_socket_read_cb(void *udata, char *buffer, duk_size_t length);
duk_size_t duk_trans_socket_write_cb(void *udata, const char *buffer, duk_size_t length);
duk_size_t duk_trans_socket_peek_cb(void *udata);
void duk_trans_socket_read_flush_cb(void *udata);
void duk_trans_socket_write_flush_cb(void *udata);

#endif  /* DUK_TRANS_SOCKET_H_INCLUDED */

<|edits_diff|>
--- examples/debug-trans-socket/duk_trans_socket.h
+++ examples/debug-trans-socket/duk_trans_socket.h
@@ -2,6 +2,10 @@
 #define DUK_TRANS_SOCKET_H_INCLUDED

 #include "duktape.h"
+
+#if defined(__cplusplus)
+extern "C" {
+#endif

 void duk_trans_socket_init(void);
 void duk_trans_socket_finish(void);
<|current_version|>
#if !defined(DUK_TRANS_SOCKET_H_INCLUDED)
#define DUK_TRANS_SOCKET_H_INCLUDED

#include "duktape.h"

#if defined(__cplusplus)
extern "C" {
#endif

void duk_trans_socket_init(void);
void duk_trans_socket_finish(void);
void duk_trans_socket_waitconn(void);
duk_size_t duk_trans_socket_read_cb(void *udata, char *buffer, duk_size_t length);
duk_size_t duk_trans_socket_write_cb(void *udata, const char *buffer, duk_size_t length);
duk_size_t duk_trans_socket_peek_cb(void *udata);
void duk_trans_socket_read_flush_cb(void *udata);
void duk_trans_socket_write_flush_cb(void *udata);

#endif  /* DUK_TRANS_SOCKET_H_INCLUDED */

<|next_version|>
#if !defined(DUK_TRANS_SOCKET_H_INCLUDED)
#define DUK_TRANS_SOCKET_H_INCLUDED

#include "duktape.h"

#if defined(__cplusplus)
extern "C" {
#endif

void duk_trans_socket_init(void);
void duk_trans_socket_finish(void);
void duk_trans_socket_waitconn(void);
duk_size_t duk_trans_socket_read_cb(void *udata, char *buffer, duk_size_t length);
duk_size_t duk_trans_socket_write_cb(void *udata, const char *buffer, duk_size_t length);
duk_size_t duk_trans_socket_peek_cb(void *udata);
void duk_trans_socket_read_flush_cb(void *udata);
void duk_trans_socket_write_flush_cb(void *udata);

#if defined(__cplusplus)
}
#endif  /* end 'extern "C"' wrapper */

#endif  /* DUK_TRANS_SOCKET_H_INCLUDED */


Add illegal member access and undefined function name error.

--- tests/full_semantic_errors.c
+++ tests/full_semantic_errors.c
@@ -52,10 +52,16 @@
     // incomplete type
     struct b incomplete_type;
     bar.a = 1;
+    // illegal member access
+    bar.abc = 2;
     // '.' used on non-struct variables
     aaa.abc = 2;
     // undefined variable 'a'
     func(2.5, a, aaa[0]);
+    // undefined function name
+    b_func(1);
+    // '()' used on non-function
+    aaa(2);
     return;
 }

<|original_code|>

int global_a;
struct foo
{
    // redefinition in struct declaration
    int a;
    int a;
    float b;
};
// redefinition of foo
struct foo
{
    float a;
    int b;
};
// redefinition in function arguments
int a_func(int a, int a)
{
    return 1;
}

int func(int c, int d, float f)
{
    int b = 1;
    float test_array[10];
    b = c;
    b = c * d + 6 * 7.0;
    // undefined variable 'h'
    h = !f;
    // '[]' used on non-array variable
    b[1] = 2;
    // undefine variable 'nono'
    nono[0] = 3;

    return c * d;
}

// redefinition of func
int func()
{
    return 1;
}

void main()
{
    int aaa[10];
    // redefinition of 'duplicate'
    int duplicate[1];
    int duplicate;
    struct foo bar;
    // incomplete type
    struct b incomplete_type;
    bar.a = 1;
    // '.' used on non-struct variables
    aaa.abc = 2;
    // undefined variable 'a'
    func(2.5, a, aaa[0]);
    return;
}

<|edits_diff|>
--- tests/full_semantic_errors.c
+++ tests/full_semantic_errors.c
@@ -52,6 +52,8 @@
     // incomplete type
     struct b incomplete_type;
     bar.a = 1;
+    // illegal member access
+    bar.abc = 2;
     // '.' used on non-struct variables
     aaa.abc = 2;
     // undefined variable 'a'
<|current_version|>

int global_a;
struct foo
{
    // redefinition in struct declaration
    int a;
    int a;
    float b;
};
// redefinition of foo
struct foo
{
    float a;
    int b;
};
// redefinition in function arguments
int a_func(int a, int a)
{
    return 1;
}

int func(int c, int d, float f)
{
    int b = 1;
    float test_array[10];
    b = c;
    b = c * d + 6 * 7.0;
    // undefined variable 'h'
    h = !f;
    // '[]' used on non-array variable
    b[1] = 2;
    // undefine variable 'nono'
    nono[0] = 3;

    return c * d;
}

// redefinition of func
int func()
{
    return 1;
}

void main()
{
    int aaa[10];
    // redefinition of 'duplicate'
    int duplicate[1];
    int duplicate;
    struct foo bar;
    // incomplete type
    struct b incomplete_type;
    bar.a = 1;
    // illegal member access
    bar.abc = 2;
    // '.' used on non-struct variables
    aaa.abc = 2;
    // undefined variable 'a'
    func(2.5, a, aaa[0]);
    return;
}

<|next_version|>

int global_a;
struct foo
{
    // redefinition in struct declaration
    int a;
    int a;
    float b;
};
// redefinition of foo
struct foo
{
    float a;
    int b;
};
// redefinition in function arguments
int a_func(int a, int a)
{
    return 1;
}

int func(int c, int d, float f)
{
    int b = 1;
    float test_array[10];
    b = c;
    b = c * d + 6 * 7.0;
    // undefined variable 'h'
    h = !f;
    // '[]' used on non-array variable
    b[1] = 2;
    // undefine variable 'nono'
    nono[0] = 3;

    return c * d;
}

// redefinition of func
int func()
{
    return 1;
}

void main()
{
    int aaa[10];
    // redefinition of 'duplicate'
    int duplicate[1];
    int duplicate;
    struct foo bar;
    // incomplete type
    struct b incomplete_type;
    bar.a = 1;
    // illegal member access
    bar.abc = 2;
    // '.' used on non-struct variables
    aaa.abc = 2;
    // undefined variable 'a'
    func(2.5, a, aaa[0]);
    // undefined function name
    b_func(1);
    // '()' used on non-function
    aaa(2);
    return;
}


Add another case to qualifier-removal test

--- test2/casts/rm_qual.c
+++ test2/casts/rm_qual.c
@@ -4,6 +4,8 @@
 {
 	int i;
 };
+
+void take(void *);

 int f(const void *p)
 {
@@ -12,4 +14,7 @@

 	(void)a;
 	(void)b;
+
+	const char c = 5;
+	take(&c); // CHECK: warning: implicit cast removes qualifiers (const)
 }

<|original_code|>
// RUN: %check %s

struct A
{
	int i;
};

int f(const void *p)
{
	struct A *a = p; // CHECK: warning: implicit cast removes qualifiers (const)
	struct A *b = (struct A *)p; // CHECK: !/warning:.*cast removes qualifiers/

	(void)a;
	(void)b;
}

<|edits_diff|>
--- test2/casts/rm_qual.c
+++ test2/casts/rm_qual.c
@@ -4,6 +4,8 @@
 {
 	int i;
 };
+
+void take(void *);

 int f(const void *p)
 {
<|current_version|>
// RUN: %check %s

struct A
{
	int i;
};

void take(void *);

int f(const void *p)
{
	struct A *a = p; // CHECK: warning: implicit cast removes qualifiers (const)
	struct A *b = (struct A *)p; // CHECK: !/warning:.*cast removes qualifiers/

	(void)a;
	(void)b;
}

<|next_version|>
// RUN: %check %s

struct A
{
	int i;
};

void take(void *);

int f(const void *p)
{
	struct A *a = p; // CHECK: warning: implicit cast removes qualifiers (const)
	struct A *b = (struct A *)p; // CHECK: !/warning:.*cast removes qualifiers/

	(void)a;
	(void)b;

	const char c = 5;
	take(&c); // CHECK: warning: implicit cast removes qualifiers (const)
}


Add some comments, clean up the code, and add extern "C".

--- lib/uart.h
+++ lib/uart.h
@@ -3,6 +3,10 @@
  */

 #pragma once
+
+#ifdef __cplusplus
+extern "C" {
+#endif

 #include <avr/io.h>

@@ -13,6 +17,10 @@

 #define BAUDRATE ((F_CPU)/(BAUD*16UL)-1)

+/**
+ * @brief Enables the UART device for 8-bit data at
+ * the specified {@see BAUDRATE}.
+ */
 static inline void uart_enable(void) {
   UBRR0H = BAUDRATE >> 8;
   UBRR0L = BAUDRATE;
@@ -25,12 +33,24 @@
   UCSR0C |= _BV(USBS0) | _BV(UCSZ01) | _BV(UCSZ00);
 }

+/**
+ * @brief Transmits a character through the UART device.
+ * @param data The data to be sent.
+ */
 static inline void uart_transmit(unsigned char data) {
   while (!(UCSR0A & _BV(UDRE0)));
   UDR0 = data;
 }

+/**
+ * @brief Receives a character from the UART device.
+ * @return Received character from the UART.
+ */
 static inline unsigned char uart_receive(void) {
   while (!(UCSR0A & _BV(RXC0)));
   return UDR0;
 }
+
+#ifdef __cplusplus
+} // extern "C"
+#endif

<|original_code|>
/**
 * This is used to setup the UART device on an AVR unit.
 */

#pragma once

#include <avr/io.h>

#ifndef BAUD
#  define BAUD 9600
#  warning BAUD rate not set.  Setting BAUD rate to 9600.
#endif // BAUD

#define BAUDRATE ((F_CPU)/(BAUD*16UL)-1)

static inline void uart_enable(void) {
  UBRR0H = BAUDRATE >> 8;
  UBRR0L = BAUDRATE;

  // Set RX/TN enabled
  UCSR0B |= _BV(TXEN0) | _BV(RXEN0);

  // Set asynchronous USART
  // Set frame format: 8-bit data, 2-stop bit
  UCSR0C |= _BV(USBS0) | _BV(UCSZ01) | _BV(UCSZ00);
}

static inline void uart_transmit(unsigned char data) {
  while (!(UCSR0A & _BV(UDRE0)));
  UDR0 = data;
}

static inline unsigned char uart_receive(void) {
  while (!(UCSR0A & _BV(RXC0)));
  return UDR0;
}

<|edits_diff|>
--- lib/uart.h
+++ lib/uart.h
@@ -3,6 +3,10 @@
  */

 #pragma once
+
+#ifdef __cplusplus
+extern "C" {
+#endif

 #include <avr/io.h>

@@ -13,6 +17,10 @@

 #define BAUDRATE ((F_CPU)/(BAUD*16UL)-1)

+/**
+ * @brief Enables the UART device for 8-bit data at
+ * the specified {@see BAUDRATE}.
+ */
 static inline void uart_enable(void) {
   UBRR0H = BAUDRATE >> 8;
   UBRR0L = BAUDRATE;
@@ -25,11 +33,19 @@
   UCSR0C |= _BV(USBS0) | _BV(UCSZ01) | _BV(UCSZ00);
 }

+/**
+ * @brief Transmits a character through the UART device.
+ * @param data The data to be sent.
+ */
 static inline void uart_transmit(unsigned char data) {
   while (!(UCSR0A & _BV(UDRE0)));
   UDR0 = data;
 }

+/**
+ * @brief Receives a character from the UART device.
+ * @return Received character from the UART.
+ */
 static inline unsigned char uart_receive(void) {
   while (!(UCSR0A & _BV(RXC0)));
   return UDR0;
<|current_version|>
/**
 * This is used to setup the UART device on an AVR unit.
 */

#pragma once

#ifdef __cplusplus
extern "C" {
#endif

#include <avr/io.h>

#ifndef BAUD
#  define BAUD 9600
#  warning BAUD rate not set.  Setting BAUD rate to 9600.
#endif // BAUD

#define BAUDRATE ((F_CPU)/(BAUD*16UL)-1)

/**
 * @brief Enables the UART device for 8-bit data at
 * the specified {@see BAUDRATE}.
 */
static inline void uart_enable(void) {
  UBRR0H = BAUDRATE >> 8;
  UBRR0L = BAUDRATE;

  // Set RX/TN enabled
  UCSR0B |= _BV(TXEN0) | _BV(RXEN0);

  // Set asynchronous USART
  // Set frame format: 8-bit data, 2-stop bit
  UCSR0C |= _BV(USBS0) | _BV(UCSZ01) | _BV(UCSZ00);
}

/**
 * @brief Transmits a character through the UART device.
 * @param data The data to be sent.
 */
static inline void uart_transmit(unsigned char data) {
  while (!(UCSR0A & _BV(UDRE0)));
  UDR0 = data;
}

/**
 * @brief Receives a character from the UART device.
 * @return Received character from the UART.
 */
static inline unsigned char uart_receive(void) {
  while (!(UCSR0A & _BV(RXC0)));
  return UDR0;
}

<|next_version|>
/**
 * This is used to setup the UART device on an AVR unit.
 */

#pragma once

#ifdef __cplusplus
extern "C" {
#endif

#include <avr/io.h>

#ifndef BAUD
#  define BAUD 9600
#  warning BAUD rate not set.  Setting BAUD rate to 9600.
#endif // BAUD

#define BAUDRATE ((F_CPU)/(BAUD*16UL)-1)

/**
 * @brief Enables the UART device for 8-bit data at
 * the specified {@see BAUDRATE}.
 */
static inline void uart_enable(void) {
  UBRR0H = BAUDRATE >> 8;
  UBRR0L = BAUDRATE;

  // Set RX/TN enabled
  UCSR0B |= _BV(TXEN0) | _BV(RXEN0);

  // Set asynchronous USART
  // Set frame format: 8-bit data, 2-stop bit
  UCSR0C |= _BV(USBS0) | _BV(UCSZ01) | _BV(UCSZ00);
}

/**
 * @brief Transmits a character through the UART device.
 * @param data The data to be sent.
 */
static inline void uart_transmit(unsigned char data) {
  while (!(UCSR0A & _BV(UDRE0)));
  UDR0 = data;
}

/**
 * @brief Receives a character from the UART device.
 * @return Received character from the UART.
 */
static inline unsigned char uart_receive(void) {
  while (!(UCSR0A & _BV(RXC0)));
  return UDR0;
}

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


Add SDK IF_ELSE and USAGE macros

Add SDK IF_ELSE and USAGE macros

--- src/util/sdk.h
+++ src/util/sdk.h
@@ -4,6 +4,14 @@

 #ifdef PBL_SDK_3
 #define SDK_SELECT(sdk3, sdk2) sdk3
+#define IF_SDK_3_ELSE(sdk3, other) sdk3
+#define IF_SDK_2_ELSE(sdk2, other) other
+#define SDK_3_USAGE
+#define SDK_2_USAGE __attribute__((unused))
 #elif PBL_SDK_2
 #define SDK_SELECT(sdk3, sdk2) sdk2
+#define IF_SDK_3_ELSE(sdk3, other) other
+#define IF_SDK_2_ELSE(sdk2, other) sdk2
+#define SDK_3_USAGE __attribute__((unused))
+#define SDK_2_USAGE
 #endif

<|original_code|>
#pragma once

#include "util/none.h"

#ifdef PBL_SDK_3
#define SDK_SELECT(sdk3, sdk2) sdk3
#elif PBL_SDK_2
#define SDK_SELECT(sdk3, sdk2) sdk2
#endif

<|edits_diff|>
--- src/util/sdk.h
+++ src/util/sdk.h
@@ -4,6 +4,10 @@

 #ifdef PBL_SDK_3
 #define SDK_SELECT(sdk3, sdk2) sdk3
+#define IF_SDK_3_ELSE(sdk3, other) sdk3
+#define IF_SDK_2_ELSE(sdk2, other) other
+#define SDK_3_USAGE
+#define SDK_2_USAGE __attribute__((unused))
 #elif PBL_SDK_2
 #define SDK_SELECT(sdk3, sdk2) sdk2
 #endif
<|current_version|>
#pragma once

#include "util/none.h"

#ifdef PBL_SDK_3
#define SDK_SELECT(sdk3, sdk2) sdk3
#define IF_SDK_3_ELSE(sdk3, other) sdk3
#define IF_SDK_2_ELSE(sdk2, other) other
#define SDK_3_USAGE
#define SDK_2_USAGE __attribute__((unused))
#elif PBL_SDK_2
#define SDK_SELECT(sdk3, sdk2) sdk2
#endif

<|next_version|>
#pragma once

#include "util/none.h"

#ifdef PBL_SDK_3
#define SDK_SELECT(sdk3, sdk2) sdk3
#define IF_SDK_3_ELSE(sdk3, other) sdk3
#define IF_SDK_2_ELSE(sdk2, other) other
#define SDK_3_USAGE
#define SDK_2_USAGE __attribute__((unused))
#elif PBL_SDK_2
#define SDK_SELECT(sdk3, sdk2) sdk2
#define IF_SDK_3_ELSE(sdk3, other) other
#define IF_SDK_2_ELSE(sdk2, other) sdk2
#define SDK_3_USAGE __attribute__((unused))
#define SDK_2_USAGE
#endif


Fix debugging printouts when running tests.

--- src/tests/log_mock.c
+++ src/tests/log_mock.c
@@ -1,9 +1,13 @@
 #include "log.h"
 #include <stdio.h>
+#include <stdarg.h>

 void debug(const char* format, ...) {
 #ifdef __DEBUG__
+    va_list args;
+    va_start(args, format);
     vprintf(format, args);
+    va_end(args);
 #endif // __DEBUG__
 }

<|original_code|>
#include "log.h"
#include <stdio.h>

void debug(const char* format, ...) {
#ifdef __DEBUG__
    vprintf(format, args);
#endif // __DEBUG__
}

void initializeLogging() { }

<|edits_diff|>
--- src/tests/log_mock.c
+++ src/tests/log_mock.c
@@ -1,8 +1,11 @@
 #include "log.h"
 #include <stdio.h>
+#include <stdarg.h>

 void debug(const char* format, ...) {
 #ifdef __DEBUG__
+    va_list args;
+    va_start(args, format);
     vprintf(format, args);
 #endif // __DEBUG__
 }
<|current_version|>
#include "log.h"
#include <stdio.h>
#include <stdarg.h>

void debug(const char* format, ...) {
#ifdef __DEBUG__
    va_list args;
    va_start(args, format);
    vprintf(format, args);
#endif // __DEBUG__
}

void initializeLogging() { }

<|next_version|>
#include "log.h"
#include <stdio.h>
#include <stdarg.h>

void debug(const char* format, ...) {
#ifdef __DEBUG__
    va_list args;
    va_start(args, format);
    vprintf(format, args);
    va_end(args);
#endif // __DEBUG__
}

void initializeLogging() { }


[sync] Address a warning from the generated swig code

--- include/uwhd/sync/ModelSync.h
+++ include/uwhd/sync/ModelSync.h
@@ -17,6 +17,7 @@
 #include <vector>

 struct ModelSync {
+  virtual ~ModelSync() = 0;
   virtual void Init() = 0;
   virtual void setMgr(GameModelManager *M) = 0;
   virtual GameModelManager &getMgr() = 0;
@@ -28,6 +29,7 @@
 //};

 struct ModelSyncServer : public ModelSync {
+  virtual ~ModelSyncServer() = 0;
   //virtual std::vector<ModelSyncPeer*> peers() = 0;
   //virtual void claimPeer(const ModelSyncPeer *P) = 0;
   //virtual void getPeerWallClock(const ModelSyncPeer *P) = 0;

<|original_code|>
//===-- ModelSync.h - Wireless Syncing of GameModel ---------------- c++ --===//
//
//                               UWH Timer
//
//           This file is distributed under the BSD 3-Clause License.
//                      See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

#ifndef MODELSYNC_H
#define MODELSYNC_H

#include "uwhd/model/GameModel.h"

#include <string>
#include <vector>

struct ModelSync {
  virtual void Init() = 0;
  virtual void setMgr(GameModelManager *M) = 0;
  virtual GameModelManager &getMgr() = 0;
};

//struct ModelSyncPeer {
//  virtual std::string name() const = 0;
//  virtual std::string addr() const = 0;
//};

struct ModelSyncServer : public ModelSync {
  //virtual std::vector<ModelSyncPeer*> peers() = 0;
  //virtual void claimPeer(const ModelSyncPeer *P) = 0;
  //virtual void getPeerWallClock(const ModelSyncPeer *P) = 0;
  //virtual void setPeerWallClock(const ModelSyncPeer *P) = 0;
  //virtual void adjustPeerWallClock(const ModelSyncPeer *P, int Delta) = 0;
};

ModelSync *CreateSocketServer(const std::string &Port);
ModelSync *CreateSocketClient(const std::string &Host, const std::string &Port);
ModelSyncServer *CreateXBeeSyncServer();
ModelSync *CreateXBeeSyncClient();

#endif

<|edits_diff|>
--- include/uwhd/sync/ModelSync.h
+++ include/uwhd/sync/ModelSync.h
@@ -17,6 +17,7 @@
 #include <vector>

 struct ModelSync {
+  virtual ~ModelSync() = 0;
   virtual void Init() = 0;
   virtual void setMgr(GameModelManager *M) = 0;
   virtual GameModelManager &getMgr() = 0;
<|current_version|>
//===-- ModelSync.h - Wireless Syncing of GameModel ---------------- c++ --===//
//
//                               UWH Timer
//
//           This file is distributed under the BSD 3-Clause License.
//                      See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

#ifndef MODELSYNC_H
#define MODELSYNC_H

#include "uwhd/model/GameModel.h"

#include <string>
#include <vector>

struct ModelSync {
  virtual ~ModelSync() = 0;
  virtual void Init() = 0;
  virtual void setMgr(GameModelManager *M) = 0;
  virtual GameModelManager &getMgr() = 0;
};

//struct ModelSyncPeer {
//  virtual std::string name() const = 0;
//  virtual std::string addr() const = 0;
//};

struct ModelSyncServer : public ModelSync {
  //virtual std::vector<ModelSyncPeer*> peers() = 0;
  //virtual void claimPeer(const ModelSyncPeer *P) = 0;
  //virtual void getPeerWallClock(const ModelSyncPeer *P) = 0;
  //virtual void setPeerWallClock(const ModelSyncPeer *P) = 0;
  //virtual void adjustPeerWallClock(const ModelSyncPeer *P, int Delta) = 0;
};

ModelSync *CreateSocketServer(const std::string &Port);
ModelSync *CreateSocketClient(const std::string &Host, const std::string &Port);
ModelSyncServer *CreateXBeeSyncServer();
ModelSync *CreateXBeeSyncClient();

#endif

<|next_version|>
//===-- ModelSync.h - Wireless Syncing of GameModel ---------------- c++ --===//
//
//                               UWH Timer
//
//           This file is distributed under the BSD 3-Clause License.
//                      See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

#ifndef MODELSYNC_H
#define MODELSYNC_H

#include "uwhd/model/GameModel.h"

#include <string>
#include <vector>

struct ModelSync {
  virtual ~ModelSync() = 0;
  virtual void Init() = 0;
  virtual void setMgr(GameModelManager *M) = 0;
  virtual GameModelManager &getMgr() = 0;
};

//struct ModelSyncPeer {
//  virtual std::string name() const = 0;
//  virtual std::string addr() const = 0;
//};

struct ModelSyncServer : public ModelSync {
  virtual ~ModelSyncServer() = 0;
  //virtual std::vector<ModelSyncPeer*> peers() = 0;
  //virtual void claimPeer(const ModelSyncPeer *P) = 0;
  //virtual void getPeerWallClock(const ModelSyncPeer *P) = 0;
  //virtual void setPeerWallClock(const ModelSyncPeer *P) = 0;
  //virtual void adjustPeerWallClock(const ModelSyncPeer *P, int Delta) = 0;
};

ModelSync *CreateSocketServer(const std::string &Port);
ModelSync *CreateSocketClient(const std::string &Host, const std::string &Port);
ModelSyncServer *CreateXBeeSyncServer();
ModelSync *CreateXBeeSyncClient();

#endif


Fix compilation waring on Mac

Fix compilation waring on Mac

--- atom/utility/atom_content_utility_client.h
+++ atom/utility/atom_content_utility_client.h
@@ -21,8 +21,10 @@
   ~AtomContentUtilityClient() override;

  private:
+#if defined(OS_WIN)
   typedef ScopedVector<UtilityMessageHandler> Handlers;
   Handlers handlers_;
+#endif

   DISALLOW_COPY_AND_ASSIGN(AtomContentUtilityClient);
 };

<|original_code|>
// Copyright (c) 2015 GitHub, Inc.
// Use of this source code is governed by the MIT license that can be
// found in the LICENSE file.

#ifndef ATOM_UTILITY_ATOM_CONTENT_UTILITY_CLIENT_H_
#define ATOM_UTILITY_ATOM_CONTENT_UTILITY_CLIENT_H_

#include <vector>

#include "base/compiler_specific.h"
#include "base/memory/scoped_vector.h"
#include "content/public/utility/content_utility_client.h"

class UtilityMessageHandler;

namespace atom {

class AtomContentUtilityClient : public content::ContentUtilityClient {
 public:
  AtomContentUtilityClient();
  ~AtomContentUtilityClient() override;

 private:
  typedef ScopedVector<UtilityMessageHandler> Handlers;
  Handlers handlers_;

  DISALLOW_COPY_AND_ASSIGN(AtomContentUtilityClient);
};

}  // namespace atom

#endif  // ATOM_UTILITY_ATOM_CONTENT_UTILITY_CLIENT_H_

<|edits_diff|>
--- atom/utility/atom_content_utility_client.h
+++ atom/utility/atom_content_utility_client.h
@@ -21,6 +21,7 @@
   ~AtomContentUtilityClient() override;

  private:
+#if defined(OS_WIN)
   typedef ScopedVector<UtilityMessageHandler> Handlers;
   Handlers handlers_;

<|current_version|>
// Copyright (c) 2015 GitHub, Inc.
// Use of this source code is governed by the MIT license that can be
// found in the LICENSE file.

#ifndef ATOM_UTILITY_ATOM_CONTENT_UTILITY_CLIENT_H_
#define ATOM_UTILITY_ATOM_CONTENT_UTILITY_CLIENT_H_

#include <vector>

#include "base/compiler_specific.h"
#include "base/memory/scoped_vector.h"
#include "content/public/utility/content_utility_client.h"

class UtilityMessageHandler;

namespace atom {

class AtomContentUtilityClient : public content::ContentUtilityClient {
 public:
  AtomContentUtilityClient();
  ~AtomContentUtilityClient() override;

 private:
#if defined(OS_WIN)
  typedef ScopedVector<UtilityMessageHandler> Handlers;
  Handlers handlers_;

  DISALLOW_COPY_AND_ASSIGN(AtomContentUtilityClient);
};

}  // namespace atom

#endif  // ATOM_UTILITY_ATOM_CONTENT_UTILITY_CLIENT_H_

<|next_version|>
// Copyright (c) 2015 GitHub, Inc.
// Use of this source code is governed by the MIT license that can be
// found in the LICENSE file.

#ifndef ATOM_UTILITY_ATOM_CONTENT_UTILITY_CLIENT_H_
#define ATOM_UTILITY_ATOM_CONTENT_UTILITY_CLIENT_H_

#include <vector>

#include "base/compiler_specific.h"
#include "base/memory/scoped_vector.h"
#include "content/public/utility/content_utility_client.h"

class UtilityMessageHandler;

namespace atom {

class AtomContentUtilityClient : public content::ContentUtilityClient {
 public:
  AtomContentUtilityClient();
  ~AtomContentUtilityClient() override;

 private:
#if defined(OS_WIN)
  typedef ScopedVector<UtilityMessageHandler> Handlers;
  Handlers handlers_;
#endif

  DISALLOW_COPY_AND_ASSIGN(AtomContentUtilityClient);
};

}  // namespace atom

#endif  // ATOM_UTILITY_ATOM_CONTENT_UTILITY_CLIENT_H_


Fix build issue on windows

Fix build issue on windows

export function

--- rosidl_typesupport_opensplice_cpp/include/rosidl_typesupport_opensplice_cpp/u__instanceHandle.h
+++ rosidl_typesupport_opensplice_cpp/include/rosidl_typesupport_opensplice_cpp/u__instanceHandle.h
@@ -20,6 +20,9 @@
 #ifndef ROSIDL_TYPESUPPORT_OPENSPLICE_CPP__U__INSTANCEHANDLE_H_
 #define ROSIDL_TYPESUPPORT_OPENSPLICE_CPP__U__INSTANCEHANDLE_H_

+// Provides visibility macros like ROSIDL_TYPESUPPORT_OPENSPLICE_CPP_PUBLIC.
+#include <rosidl_typesupport_opensplice_cpp/visibility_control.h>
+
 #if __cplusplus
 extern "C"
 {
@@ -28,6 +31,7 @@
 #include "u_instanceHandle.h"  // NOLINT
 #include "v_collection.h"  // NOLINT

+ROSIDL_TYPESUPPORT_OPENSPLICE_CPP_PUBLIC
 v_gid
 u_instanceHandleToGID(
   u_instanceHandle _this);

<|original_code|>
/*
 *                         OpenSplice DDS
 *
 *   This software and documentation are Copyright 2006 to TO_YEAR PrismTech
 *   Limited, its affiliated companies and licensors. 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 ROSIDL_TYPESUPPORT_OPENSPLICE_CPP__U__INSTANCEHANDLE_H_
#define ROSIDL_TYPESUPPORT_OPENSPLICE_CPP__U__INSTANCEHANDLE_H_

#if __cplusplus
extern "C"
{
#endif

#include "u_instanceHandle.h"  // NOLINT
#include "v_collection.h"  // NOLINT

v_gid
u_instanceHandleToGID(
  u_instanceHandle _this);

#ifdef __cplusplus
}
#endif

#endif  // ROSIDL_TYPESUPPORT_OPENSPLICE_CPP__U__INSTANCEHANDLE_H_

<|edits_diff|>
--- rosidl_typesupport_opensplice_cpp/include/rosidl_typesupport_opensplice_cpp/u__instanceHandle.h
+++ rosidl_typesupport_opensplice_cpp/include/rosidl_typesupport_opensplice_cpp/u__instanceHandle.h
@@ -20,6 +20,9 @@
 #ifndef ROSIDL_TYPESUPPORT_OPENSPLICE_CPP__U__INSTANCEHANDLE_H_
 #define ROSIDL_TYPESUPPORT_OPENSPLICE_CPP__U__INSTANCEHANDLE_H_

+// Provides visibility macros like ROSIDL_TYPESUPPORT_OPENSPLICE_CPP_PUBLIC.
+#include <rosidl_typesupport_opensplice_cpp/visibility_control.h>
+
 #if __cplusplus
 extern "C"
 {
<|current_version|>
/*
 *                         OpenSplice DDS
 *
 *   This software and documentation are Copyright 2006 to TO_YEAR PrismTech
 *   Limited, its affiliated companies and licensors. 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 ROSIDL_TYPESUPPORT_OPENSPLICE_CPP__U__INSTANCEHANDLE_H_
#define ROSIDL_TYPESUPPORT_OPENSPLICE_CPP__U__INSTANCEHANDLE_H_

// Provides visibility macros like ROSIDL_TYPESUPPORT_OPENSPLICE_CPP_PUBLIC.
#include <rosidl_typesupport_opensplice_cpp/visibility_control.h>

#if __cplusplus
extern "C"
{
#endif

#include "u_instanceHandle.h"  // NOLINT
#include "v_collection.h"  // NOLINT

v_gid
u_instanceHandleToGID(
  u_instanceHandle _this);

#ifdef __cplusplus
}
#endif

#endif  // ROSIDL_TYPESUPPORT_OPENSPLICE_CPP__U__INSTANCEHANDLE_H_

<|next_version|>
/*
 *                         OpenSplice DDS
 *
 *   This software and documentation are Copyright 2006 to TO_YEAR PrismTech
 *   Limited, its affiliated companies and licensors. 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 ROSIDL_TYPESUPPORT_OPENSPLICE_CPP__U__INSTANCEHANDLE_H_
#define ROSIDL_TYPESUPPORT_OPENSPLICE_CPP__U__INSTANCEHANDLE_H_

// Provides visibility macros like ROSIDL_TYPESUPPORT_OPENSPLICE_CPP_PUBLIC.
#include <rosidl_typesupport_opensplice_cpp/visibility_control.h>

#if __cplusplus
extern "C"
{
#endif

#include "u_instanceHandle.h"  // NOLINT
#include "v_collection.h"  // NOLINT

ROSIDL_TYPESUPPORT_OPENSPLICE_CPP_PUBLIC
v_gid
u_instanceHandleToGID(
  u_instanceHandle _this);

#ifdef __cplusplus
}
#endif

#endif  // ROSIDL_TYPESUPPORT_OPENSPLICE_CPP__U__INSTANCEHANDLE_H_


Fix compatibility with some modules

Fix compatibility with some modules

--- include/psp2/update.h
+++ include/psp2/update.h
@@ -22,6 +22,8 @@
  */
 int sceSblUsGetUpdateMode(SceUpdateMode *mode);

+#define sceSblSsUpdateMgrGetBootMode sceSblUsGetUpdateMode
+
 /**
  * Setting system update mode on boot
  *
@@ -30,6 +32,8 @@
  * @return 0 on success, < 0 on error.
  */
 int sceSblUsSetUpdateMode(SceUpdateMode mode);
+
+#define sceSblSsUpdateMgrSetBootMode sceSblUsSetUpdateMode

 /**
  * Verify PUP

<|original_code|>
/**
 * \usergroup{SceUpdateMgr}
 * \usage{psp2/update.h,SceSblSsUpdateMgr_stub}
 */

#ifndef _PSP2_UPDATE_MGR_H_
#define _PSP2_UPDATE_MGR_H_

#include <psp2/types.h>

typedef char SceUpdateMode;

#define SCE_UPDATE_MODE_SWU_GUI 0x10
#define SCE_UPDATE_MODE_SWU_CUI 0x30

/**
 * Getting system update mode on boot
 *
 * @param[out] mode - The pointer of SceUpdateMode variable
 *
 * @return 0 on success, < 0 on error.
 */
int sceSblUsGetUpdateMode(SceUpdateMode *mode);

/**
 * Setting system update mode on boot
 *
 * @param[in] mode - The update mode
 *
 * @return 0 on success, < 0 on error.
 */
int sceSblUsSetUpdateMode(SceUpdateMode mode);

/**
 * Verify PUP
 *
 * @param[in] path - The PUP path
 *
 * @return 0 on success, < 0 on error.
 *
 * note - If verify CEX PUP on Devkit system, got error.
 */
int sceSblUsVerifyPup(const char *path);

#endif /* _PSP2_UPDATE_MGR_H_ */

<|edits_diff|>
--- include/psp2/update.h
+++ include/psp2/update.h
@@ -22,6 +22,8 @@
  */
 int sceSblUsGetUpdateMode(SceUpdateMode *mode);

+#define sceSblSsUpdateMgrGetBootMode sceSblUsGetUpdateMode
+
 /**
  * Setting system update mode on boot
  *
<|current_version|>
/**
 * \usergroup{SceUpdateMgr}
 * \usage{psp2/update.h,SceSblSsUpdateMgr_stub}
 */

#ifndef _PSP2_UPDATE_MGR_H_
#define _PSP2_UPDATE_MGR_H_

#include <psp2/types.h>

typedef char SceUpdateMode;

#define SCE_UPDATE_MODE_SWU_GUI 0x10
#define SCE_UPDATE_MODE_SWU_CUI 0x30

/**
 * Getting system update mode on boot
 *
 * @param[out] mode - The pointer of SceUpdateMode variable
 *
 * @return 0 on success, < 0 on error.
 */
int sceSblUsGetUpdateMode(SceUpdateMode *mode);

#define sceSblSsUpdateMgrGetBootMode sceSblUsGetUpdateMode

/**
 * Setting system update mode on boot
 *
 * @param[in] mode - The update mode
 *
 * @return 0 on success, < 0 on error.
 */
int sceSblUsSetUpdateMode(SceUpdateMode mode);

/**
 * Verify PUP
 *
 * @param[in] path - The PUP path
 *
 * @return 0 on success, < 0 on error.
 *
 * note - If verify CEX PUP on Devkit system, got error.
 */
int sceSblUsVerifyPup(const char *path);

#endif /* _PSP2_UPDATE_MGR_H_ */

<|next_version|>
/**
 * \usergroup{SceUpdateMgr}
 * \usage{psp2/update.h,SceSblSsUpdateMgr_stub}
 */

#ifndef _PSP2_UPDATE_MGR_H_
#define _PSP2_UPDATE_MGR_H_

#include <psp2/types.h>

typedef char SceUpdateMode;

#define SCE_UPDATE_MODE_SWU_GUI 0x10
#define SCE_UPDATE_MODE_SWU_CUI 0x30

/**
 * Getting system update mode on boot
 *
 * @param[out] mode - The pointer of SceUpdateMode variable
 *
 * @return 0 on success, < 0 on error.
 */
int sceSblUsGetUpdateMode(SceUpdateMode *mode);

#define sceSblSsUpdateMgrGetBootMode sceSblUsGetUpdateMode

/**
 * Setting system update mode on boot
 *
 * @param[in] mode - The update mode
 *
 * @return 0 on success, < 0 on error.
 */
int sceSblUsSetUpdateMode(SceUpdateMode mode);

#define sceSblSsUpdateMgrSetBootMode sceSblUsSetUpdateMode

/**
 * Verify PUP
 *
 * @param[in] path - The PUP path
 *
 * @return 0 on success, < 0 on error.
 *
 * note - If verify CEX PUP on Devkit system, got error.
 */
int sceSblUsVerifyPup(const char *path);

#endif /* _PSP2_UPDATE_MGR_H_ */


Add documentation to Vector3 typedefs

Add documentation to Vector3 typedefs

This adds documentation for the Vector3f and Vector3d
typedefs.

--- src/chemkit/vector3.h
+++ src/chemkit/vector3.h
@@ -32,7 +32,10 @@
 /// A three-dimensional vector.
 typedef GenericVector<Float> Vector3;

+/// A three-dimensional vector containing \c float values.
 typedef GenericVector<float> Vector3f;
+
+/// A three-dimensional vector containing \c double values.
 typedef GenericVector<double> Vector3d;

 } // end chemkit namespace

<|original_code|>
/******************************************************************************
**
** Copyright (C) 2009-2011 Kyle Lutz <kyle.r.lutz@gmail.com>
**
** This file is part of chemkit. For more information see
** <http://www.chemkit.org>.
**
** chemkit 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 3 of the License, or
** (at your option) any later version.
**
** chemkit 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 chemkit. If not, see <http://www.gnu.org/licenses/>.
**
******************************************************************************/

#ifndef CHEMKIT_VECTOR3_H
#define CHEMKIT_VECTOR3_H

#include "chemkit.h"

#include "genericvector.h"

namespace chemkit {

/// A three-dimensional vector.
typedef GenericVector<Float> Vector3;

typedef GenericVector<float> Vector3f;
typedef GenericVector<double> Vector3d;

} // end chemkit namespace

#endif // CHEMKIT_VECTOR3_H

<|edits_diff|>
--- src/chemkit/vector3.h
+++ src/chemkit/vector3.h
@@ -32,6 +32,7 @@
 /// A three-dimensional vector.
 typedef GenericVector<Float> Vector3;

+/// A three-dimensional vector containing \c float values.
 typedef GenericVector<float> Vector3f;
 typedef GenericVector<double> Vector3d;

<|current_version|>
/******************************************************************************
**
** Copyright (C) 2009-2011 Kyle Lutz <kyle.r.lutz@gmail.com>
**
** This file is part of chemkit. For more information see
** <http://www.chemkit.org>.
**
** chemkit 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 3 of the License, or
** (at your option) any later version.
**
** chemkit 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 chemkit. If not, see <http://www.gnu.org/licenses/>.
**
******************************************************************************/

#ifndef CHEMKIT_VECTOR3_H
#define CHEMKIT_VECTOR3_H

#include "chemkit.h"

#include "genericvector.h"

namespace chemkit {

/// A three-dimensional vector.
typedef GenericVector<Float> Vector3;

/// A three-dimensional vector containing \c float values.
typedef GenericVector<float> Vector3f;
typedef GenericVector<double> Vector3d;

} // end chemkit namespace

#endif // CHEMKIT_VECTOR3_H

<|next_version|>
/******************************************************************************
**
** Copyright (C) 2009-2011 Kyle Lutz <kyle.r.lutz@gmail.com>
**
** This file is part of chemkit. For more information see
** <http://www.chemkit.org>.
**
** chemkit 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 3 of the License, or
** (at your option) any later version.
**
** chemkit 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 chemkit. If not, see <http://www.gnu.org/licenses/>.
**
******************************************************************************/

#ifndef CHEMKIT_VECTOR3_H
#define CHEMKIT_VECTOR3_H

#include "chemkit.h"

#include "genericvector.h"

namespace chemkit {

/// A three-dimensional vector.
typedef GenericVector<Float> Vector3;

/// A three-dimensional vector containing \c float values.
typedef GenericVector<float> Vector3f;

/// A three-dimensional vector containing \c double values.
typedef GenericVector<double> Vector3d;

} // end chemkit namespace

#endif // CHEMKIT_VECTOR3_H


MinGW: Add a missing prototype (callGetLocaleInfoEx())

--- link-grammar/dict-common/dict-impl.h
+++ link-grammar/dict-common/dict-impl.h
@@ -1,5 +1,6 @@

 #include "link-includes.h"
+#include "utilities.h"

 // Already declared in link-includes.h
 // const char * linkgrammar_get_dict_locale(Dictionary dict);
@@ -11,3 +12,8 @@
 void afclass_init(Dictionary dict);
 bool afdict_init(Dictionary dict);
 void affix_list_add(Dictionary afdict, Afdict_class *, const char *);
+
+#ifdef __MINGW32__
+int callGetLocaleInfoEx(LPCWSTR, LCTYPE, LPWSTR, int);
+
+#endif /* __MINGW32__ */

<|original_code|>

#include "link-includes.h"

// Already declared in link-includes.h
// const char * linkgrammar_get_dict_locale(Dictionary dict);
// const char * linkgrammar_get_version(void);
// const char * linkgrammar_get_dict_version(Dictionary dict);

void dictionary_setup_locale(Dictionary dict);
void dictionary_setup_defines(Dictionary dict);
void afclass_init(Dictionary dict);
bool afdict_init(Dictionary dict);
void affix_list_add(Dictionary afdict, Afdict_class *, const char *);

<|edits_diff|>
--- link-grammar/dict-common/dict-impl.h
+++ link-grammar/dict-common/dict-impl.h
@@ -1,5 +1,6 @@

 #include "link-includes.h"
+#include "utilities.h"

 // Already declared in link-includes.h
 // const char * linkgrammar_get_dict_locale(Dictionary dict);
<|current_version|>

#include "link-includes.h"
#include "utilities.h"

// Already declared in link-includes.h
// const char * linkgrammar_get_dict_locale(Dictionary dict);
// const char * linkgrammar_get_version(void);
// const char * linkgrammar_get_dict_version(Dictionary dict);

void dictionary_setup_locale(Dictionary dict);
void dictionary_setup_defines(Dictionary dict);
void afclass_init(Dictionary dict);
bool afdict_init(Dictionary dict);
void affix_list_add(Dictionary afdict, Afdict_class *, const char *);

<|next_version|>

#include "link-includes.h"
#include "utilities.h"

// Already declared in link-includes.h
// const char * linkgrammar_get_dict_locale(Dictionary dict);
// const char * linkgrammar_get_version(void);
// const char * linkgrammar_get_dict_version(Dictionary dict);

void dictionary_setup_locale(Dictionary dict);
void dictionary_setup_defines(Dictionary dict);
void afclass_init(Dictionary dict);
bool afdict_init(Dictionary dict);
void affix_list_add(Dictionary afdict, Afdict_class *, const char *);

#ifdef __MINGW32__
int callGetLocaleInfoEx(LPCWSTR, LCTYPE, LPWSTR, int);

#endif /* __MINGW32__ */


Add a copy constructor and * overload

Add a copy constructor and * overload

--- Tests/testing_util.h
+++ Tests/testing_util.h
@@ -17,6 +17,10 @@
 public:
     py_ptr() : m_ptr(nullptr) {}
     py_ptr(T* ptr) : m_ptr(ptr) {}
+    py_ptr(const py_ptr& copy) {
+        m_ptr = copy.get();
+        Py_INCREF(m_ptr);
+    }

     ~py_ptr() {
         Py_XDECREF(m_ptr);
@@ -34,6 +38,10 @@
     T* operator->() {
         return m_ptr;
     }
+
+    T* operator*() {
+        return m_ptr;
+    }
 };

 /**

<|original_code|>
#pragma once

#ifndef TESTING_UTIL_H
#define TESTING_UTIL_H 1

#include <Python.h>

/**
    Use RAII to Py_XDECREF a pointer.

    Inspired by std::unique_ptr.
*/
template <class T> class py_ptr {
private:
    T* m_ptr;

public:
    py_ptr() : m_ptr(nullptr) {}
    py_ptr(T* ptr) : m_ptr(ptr) {}

    ~py_ptr() {
        Py_XDECREF(m_ptr);
    }

    void reset(T* ptr) {
        Py_XDECREF(m_ptr);
        m_ptr = ptr;
    }

    T* get() {
        return m_ptr;
    }

    T* operator->() {
        return m_ptr;
    }
};

/**
    A concrete PyObject instance of py_ptr.
*/
class PyObject_ptr : public py_ptr<PyObject> {
public:
    PyObject_ptr(PyObject *ptr) : py_ptr(ptr) {}
};

PyCodeObject* CompileCode(const char*);

#endif // !TESTING_UTIL_H

<|edits_diff|>
--- Tests/testing_util.h
+++ Tests/testing_util.h
@@ -17,6 +17,10 @@
 public:
     py_ptr() : m_ptr(nullptr) {}
     py_ptr(T* ptr) : m_ptr(ptr) {}
+    py_ptr(const py_ptr& copy) {
+        m_ptr = copy.get();
+        Py_INCREF(m_ptr);
+    }

     ~py_ptr() {
         Py_XDECREF(m_ptr);
<|current_version|>
#pragma once

#ifndef TESTING_UTIL_H
#define TESTING_UTIL_H 1

#include <Python.h>

/**
    Use RAII to Py_XDECREF a pointer.

    Inspired by std::unique_ptr.
*/
template <class T> class py_ptr {
private:
    T* m_ptr;

public:
    py_ptr() : m_ptr(nullptr) {}
    py_ptr(T* ptr) : m_ptr(ptr) {}
    py_ptr(const py_ptr& copy) {
        m_ptr = copy.get();
        Py_INCREF(m_ptr);
    }

    ~py_ptr() {
        Py_XDECREF(m_ptr);
    }

    void reset(T* ptr) {
        Py_XDECREF(m_ptr);
        m_ptr = ptr;
    }

    T* get() {
        return m_ptr;
    }

    T* operator->() {
        return m_ptr;
    }
};

/**
    A concrete PyObject instance of py_ptr.
*/
class PyObject_ptr : public py_ptr<PyObject> {
public:
    PyObject_ptr(PyObject *ptr) : py_ptr(ptr) {}
};

PyCodeObject* CompileCode(const char*);

#endif // !TESTING_UTIL_H

<|next_version|>
#pragma once

#ifndef TESTING_UTIL_H
#define TESTING_UTIL_H 1

#include <Python.h>

/**
    Use RAII to Py_XDECREF a pointer.

    Inspired by std::unique_ptr.
*/
template <class T> class py_ptr {
private:
    T* m_ptr;

public:
    py_ptr() : m_ptr(nullptr) {}
    py_ptr(T* ptr) : m_ptr(ptr) {}
    py_ptr(const py_ptr& copy) {
        m_ptr = copy.get();
        Py_INCREF(m_ptr);
    }

    ~py_ptr() {
        Py_XDECREF(m_ptr);
    }

    void reset(T* ptr) {
        Py_XDECREF(m_ptr);
        m_ptr = ptr;
    }

    T* get() {
        return m_ptr;
    }

    T* operator->() {
        return m_ptr;
    }

    T* operator*() {
        return m_ptr;
    }
};

/**
    A concrete PyObject instance of py_ptr.
*/
class PyObject_ptr : public py_ptr<PyObject> {
public:
    PyObject_ptr(PyObject *ptr) : py_ptr(ptr) {}
};

PyCodeObject* CompileCode(const char*);

#endif // !TESTING_UTIL_H