Put disassembly into simple core

Put disassembly into simple core

--- examples/ZXSpectrum/cpusimple.c
+++ examples/ZXSpectrum/cpusimple.c
@@ -12,7 +12,9 @@
 void RESET(void);
 void INTERRUPT(uint8_t);

+extern uint16_t	PC;
 extern uint8_t CYCLES;
+int Disassemble(unsigned int address,int registers);

 void CPU_RESET()
 {
@@ -21,6 +23,10 @@

 int CPU_STEP(int intClocks,int doDebug)
 {
+	if (doDebug)
+	{
+		Disassemble(PC,1);
+	}
 	if (intClocks)
 	{
 		INTERRUPT(0xFF);

<|original_code|>
/*
 * ZXSpectrum
 *
 *  Uses Z80 step core built in EDL
 *  Rest is C for now
 */

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

void STEP(void);
void RESET(void);
void INTERRUPT(uint8_t);

extern uint8_t CYCLES;

void CPU_RESET()
{
	RESET();
}

int CPU_STEP(int intClocks,int doDebug)
{
	if (intClocks)
	{
		INTERRUPT(0xFF);

		if (CYCLES==0)
		{
			STEP();
		}
	}
	else
	{
		STEP();
	}

	return CYCLES;
}

<|edits_diff|>
--- examples/ZXSpectrum/cpusimple.c
+++ examples/ZXSpectrum/cpusimple.c
@@ -12,7 +12,9 @@
 void RESET(void);
 void INTERRUPT(uint8_t);

+extern uint16_t	PC;
 extern uint8_t CYCLES;
+int Disassemble(unsigned int address,int registers);

 void CPU_RESET()
 {
<|current_version|>
/*
 * ZXSpectrum
 *
 *  Uses Z80 step core built in EDL
 *  Rest is C for now
 */

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

void STEP(void);
void RESET(void);
void INTERRUPT(uint8_t);

extern uint16_t	PC;
extern uint8_t CYCLES;
int Disassemble(unsigned int address,int registers);

void CPU_RESET()
{
	RESET();
}

int CPU_STEP(int intClocks,int doDebug)
{
	if (intClocks)
	{
		INTERRUPT(0xFF);

		if (CYCLES==0)
		{
			STEP();
		}
	}
	else
	{
		STEP();
	}

	return CYCLES;
}

<|next_version|>
/*
 * ZXSpectrum
 *
 *  Uses Z80 step core built in EDL
 *  Rest is C for now
 */

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

void STEP(void);
void RESET(void);
void INTERRUPT(uint8_t);

extern uint16_t	PC;
extern uint8_t CYCLES;
int Disassemble(unsigned int address,int registers);

void CPU_RESET()
{
	RESET();
}

int CPU_STEP(int intClocks,int doDebug)
{
	if (doDebug)
	{
		Disassemble(PC,1);
	}
	if (intClocks)
	{
		INTERRUPT(0xFF);

		if (CYCLES==0)
		{
			STEP();
		}
	}
	else
	{
		STEP();
	}

	return CYCLES;
}


Add BASE_EXPORT macros to base ... again.

BUG=90078
TEST=none

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

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

--- base/mac/launchd.h
+++ base/mac/launchd.h
@@ -11,6 +11,8 @@

 #include <string>

+#include "base/base_export.h"
+
 namespace base {
 namespace mac {

@@ -18,11 +20,13 @@
 // mapping |operation| to |job_label|, and returns the result of calling
 // launch_msg to send that message. On failure, returns NULL. The caller
 // assumes ownership of the returned launch_data_t object.
+BASE_EXPORT
 launch_data_t MessageForJob(const std::string& job_label,
                             const char* operation);

 // Returns the process ID for |job_label| if the job is running, 0 if the job
 // is loaded but not running, or -1 on error.
+BASE_EXPORT
 pid_t PIDForJob(const std::string& job_label);

 }  // namespace mac

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

#ifndef BASE_MAC_LAUNCHD_H_
#define BASE_MAC_LAUNCHD_H_
#pragma once

#include <launch.h>
#include <sys/types.h>

#include <string>

namespace base {
namespace mac {

// MessageForJob sends a single message to launchd with a simple dictionary
// mapping |operation| to |job_label|, and returns the result of calling
// launch_msg to send that message. On failure, returns NULL. The caller
// assumes ownership of the returned launch_data_t object.
launch_data_t MessageForJob(const std::string& job_label,
                            const char* operation);

// Returns the process ID for |job_label| if the job is running, 0 if the job
// is loaded but not running, or -1 on error.
pid_t PIDForJob(const std::string& job_label);

}  // namespace mac
}  // namespace base

#endif  // BASE_MAC_LAUNCHD_H_

<|edits_diff|>
--- base/mac/launchd.h
+++ base/mac/launchd.h
@@ -11,6 +11,8 @@

 #include <string>

+#include "base/base_export.h"
+
 namespace base {
 namespace mac {

@@ -18,6 +20,7 @@
 // mapping |operation| to |job_label|, and returns the result of calling
 // launch_msg to send that message. On failure, returns NULL. The caller
 // assumes ownership of the returned launch_data_t object.
+BASE_EXPORT
 launch_data_t MessageForJob(const std::string& job_label,
                             const char* operation);

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

#ifndef BASE_MAC_LAUNCHD_H_
#define BASE_MAC_LAUNCHD_H_
#pragma once

#include <launch.h>
#include <sys/types.h>

#include <string>

#include "base/base_export.h"

namespace base {
namespace mac {

// MessageForJob sends a single message to launchd with a simple dictionary
// mapping |operation| to |job_label|, and returns the result of calling
// launch_msg to send that message. On failure, returns NULL. The caller
// assumes ownership of the returned launch_data_t object.
BASE_EXPORT
launch_data_t MessageForJob(const std::string& job_label,
                            const char* operation);

// Returns the process ID for |job_label| if the job is running, 0 if the job
// is loaded but not running, or -1 on error.
pid_t PIDForJob(const std::string& job_label);

}  // namespace mac
}  // namespace base

#endif  // BASE_MAC_LAUNCHD_H_

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

#ifndef BASE_MAC_LAUNCHD_H_
#define BASE_MAC_LAUNCHD_H_
#pragma once

#include <launch.h>
#include <sys/types.h>

#include <string>

#include "base/base_export.h"

namespace base {
namespace mac {

// MessageForJob sends a single message to launchd with a simple dictionary
// mapping |operation| to |job_label|, and returns the result of calling
// launch_msg to send that message. On failure, returns NULL. The caller
// assumes ownership of the returned launch_data_t object.
BASE_EXPORT
launch_data_t MessageForJob(const std::string& job_label,
                            const char* operation);

// Returns the process ID for |job_label| if the job is running, 0 if the job
// is loaded but not running, or -1 on error.
BASE_EXPORT
pid_t PIDForJob(const std::string& job_label);

}  // namespace mac
}  // namespace base

#endif  // BASE_MAC_LAUNCHD_H_


Allow fpsetmask(3) and friends to be used from a C++ program on the Alpha.

Reviewed by:	dfr

--- include/ieeefp.h
+++ include/ieeefp.h
@@ -14,12 +14,14 @@
 #ifdef __i386__
 #include <machine/floatingpoint.h>
 #else /* !__i386__ */
+__BEGIN_DECLS
 extern fp_rnd    fpgetround __P((void));
 extern fp_rnd    fpsetround __P((fp_rnd));
 extern fp_except fpgetmask __P((void));
 extern fp_except fpsetmask __P((fp_except));
 extern fp_except fpgetsticky __P((void));
 extern fp_except fpsetsticky __P((fp_except));
+__END_DECLS
 #endif /* __i386__ */

 #endif /* _IEEEFP_H_ */

<|original_code|>
/*	$NetBSD: ieeefp.h,v 1.4 1998/01/09 08:03:43 perry Exp $	*/

/*
 * Written by J.T. Conklin, Apr 6, 1995
 * Public domain.
 */

#ifndef _IEEEFP_H_
#define _IEEEFP_H_

#include <sys/cdefs.h>
#include <machine/ieeefp.h>

#ifdef __i386__
#include <machine/floatingpoint.h>
#else /* !__i386__ */
extern fp_rnd    fpgetround __P((void));
extern fp_rnd    fpsetround __P((fp_rnd));
extern fp_except fpgetmask __P((void));
extern fp_except fpsetmask __P((fp_except));
extern fp_except fpgetsticky __P((void));
extern fp_except fpsetsticky __P((fp_except));
#endif /* __i386__ */

#endif /* _IEEEFP_H_ */

<|edits_diff|>
--- include/ieeefp.h
+++ include/ieeefp.h
@@ -14,6 +14,7 @@
 #ifdef __i386__
 #include <machine/floatingpoint.h>
 #else /* !__i386__ */
+__BEGIN_DECLS
 extern fp_rnd    fpgetround __P((void));
 extern fp_rnd    fpsetround __P((fp_rnd));
 extern fp_except fpgetmask __P((void));
<|current_version|>
/*	$NetBSD: ieeefp.h,v 1.4 1998/01/09 08:03:43 perry Exp $	*/

/*
 * Written by J.T. Conklin, Apr 6, 1995
 * Public domain.
 */

#ifndef _IEEEFP_H_
#define _IEEEFP_H_

#include <sys/cdefs.h>
#include <machine/ieeefp.h>

#ifdef __i386__
#include <machine/floatingpoint.h>
#else /* !__i386__ */
__BEGIN_DECLS
extern fp_rnd    fpgetround __P((void));
extern fp_rnd    fpsetround __P((fp_rnd));
extern fp_except fpgetmask __P((void));
extern fp_except fpsetmask __P((fp_except));
extern fp_except fpgetsticky __P((void));
extern fp_except fpsetsticky __P((fp_except));
#endif /* __i386__ */

#endif /* _IEEEFP_H_ */

<|next_version|>
/*	$NetBSD: ieeefp.h,v 1.4 1998/01/09 08:03:43 perry Exp $	*/

/*
 * Written by J.T. Conklin, Apr 6, 1995
 * Public domain.
 */

#ifndef _IEEEFP_H_
#define _IEEEFP_H_

#include <sys/cdefs.h>
#include <machine/ieeefp.h>

#ifdef __i386__
#include <machine/floatingpoint.h>
#else /* !__i386__ */
__BEGIN_DECLS
extern fp_rnd    fpgetround __P((void));
extern fp_rnd    fpsetround __P((fp_rnd));
extern fp_except fpgetmask __P((void));
extern fp_except fpsetmask __P((fp_except));
extern fp_except fpgetsticky __P((void));
extern fp_except fpsetsticky __P((fp_except));
__END_DECLS
#endif /* __i386__ */

#endif /* _IEEEFP_H_ */


Add delegate property for subscription

Add delegate property for subscription

--- AVOS/AVOSCloudLiveQuery/AVSubscription.h
+++ AVOS/AVOSCloudLiveQuery/AVSubscription.h
@@ -12,11 +12,17 @@

 NS_ASSUME_NONNULL_BEGIN

+@protocol AVSubscriptionDelegate <NSObject>
+
+@end
+
 @interface AVSubscriptionOptions : AVDynamicObject

 @end

 @interface AVSubscription : NSObject
+
+@property (nonatomic, weak, nullable) id<AVSubscriptionDelegate> delegate;

 @property (nonatomic, strong, readonly) AVQuery *query;
 @property (nonatomic, strong, readonly, nullable) AVSubscriptionOptions *options;

<|original_code|>
//
//  AVSubscription.h
//  AVOS
//
//  Created by Tang Tianyong on 15/05/2017.
//  Copyright © 2017 LeanCloud Inc. All rights reserved.
//

#import <Foundation/Foundation.h>
#import "AVQuery.h"
#import "AVDynamicObject.h"

NS_ASSUME_NONNULL_BEGIN

@interface AVSubscriptionOptions : AVDynamicObject

@end

@interface AVSubscription : NSObject

@property (nonatomic, strong, readonly) AVQuery *query;
@property (nonatomic, strong, readonly, nullable) AVSubscriptionOptions *options;

- (instancetype)initWithQuery:(AVQuery *)query
                      options:(nullable AVSubscriptionOptions *)options;

@end

NS_ASSUME_NONNULL_END

<|edits_diff|>
--- AVOS/AVOSCloudLiveQuery/AVSubscription.h
+++ AVOS/AVOSCloudLiveQuery/AVSubscription.h
@@ -11,6 +11,10 @@
 #import "AVDynamicObject.h"

 NS_ASSUME_NONNULL_BEGIN
+
+@protocol AVSubscriptionDelegate <NSObject>
+
+@end

 @interface AVSubscriptionOptions : AVDynamicObject

<|current_version|>
//
//  AVSubscription.h
//  AVOS
//
//  Created by Tang Tianyong on 15/05/2017.
//  Copyright © 2017 LeanCloud Inc. All rights reserved.
//

#import <Foundation/Foundation.h>
#import "AVQuery.h"
#import "AVDynamicObject.h"

NS_ASSUME_NONNULL_BEGIN

@protocol AVSubscriptionDelegate <NSObject>

@end

@interface AVSubscriptionOptions : AVDynamicObject

@end

@interface AVSubscription : NSObject

@property (nonatomic, strong, readonly) AVQuery *query;
@property (nonatomic, strong, readonly, nullable) AVSubscriptionOptions *options;

- (instancetype)initWithQuery:(AVQuery *)query
                      options:(nullable AVSubscriptionOptions *)options;

@end

NS_ASSUME_NONNULL_END

<|next_version|>
//
//  AVSubscription.h
//  AVOS
//
//  Created by Tang Tianyong on 15/05/2017.
//  Copyright © 2017 LeanCloud Inc. All rights reserved.
//

#import <Foundation/Foundation.h>
#import "AVQuery.h"
#import "AVDynamicObject.h"

NS_ASSUME_NONNULL_BEGIN

@protocol AVSubscriptionDelegate <NSObject>

@end

@interface AVSubscriptionOptions : AVDynamicObject

@end

@interface AVSubscription : NSObject

@property (nonatomic, weak, nullable) id<AVSubscriptionDelegate> delegate;

@property (nonatomic, strong, readonly) AVQuery *query;
@property (nonatomic, strong, readonly, nullable) AVSubscriptionOptions *options;

- (instancetype)initWithQuery:(AVQuery *)query
                      options:(nullable AVSubscriptionOptions *)options;

@end

NS_ASSUME_NONNULL_END


Add constant for spin increment

Add constant for spin increment

--- Settings/Display.h
+++ Settings/Display.h
@@ -1,6 +1,8 @@
 #pragma once

 #include "Tab.h"
+
+#include <CommCtrl.h>

 class Display : public Tab {
 public:
@@ -50,4 +52,5 @@
     const int MAX_EDGE = 65535;
     const int MIN_MS = USER_TIMER_MINIMUM;
     const int MAX_MS = 60000;
+    const int ANIM_SPIN_INCREMENT = 100;
 };

<|original_code|>
#pragma once

#include "Tab.h"

class Display : public Tab {
public:
    virtual void SaveSettings();

protected:
    virtual void Initialize();
    virtual void LoadSettings();

private:
    bool OnAnimationChanged();
    bool OnAnimationSpin(NMUPDOWN *ud);
    bool OnCustomCheckChanged();
    bool OnPositionChanged();

private:
    /* Controls: */
    Checkbox _onTop;
    Checkbox _hideFullscreen;

    ComboBox _position;
    Label _customX;
    EditBox _positionX;
    Label _customY;
    EditBox _positionY;
    Checkbox _customDistance;
    Spinner _edgeSpinner;
    Label _displayDevLabel;
    ComboBox _displayDevice;

    ComboBox _animation;
    Label _hideDelayLabel;
    Spinner _hideDelay;
    Label _hideSpeedLabel;
    Spinner _hideSpeed;

private:
    /* Strings: */
    std::wstring primaryMonitorStr = L"Primary Monitor";
    std::wstring allMonitorStr = L"All Monitors";
    std::wstring customPositionStr = L"Custom";
    std::wstring noAnimStr = L"None";

private:
    /* Constants: */
    const int MIN_EDGE = -65535;
    const int MAX_EDGE = 65535;
    const int MIN_MS = USER_TIMER_MINIMUM;
    const int MAX_MS = 60000;
};
<|edits_diff|>
--- Settings/Display.h
+++ Settings/Display.h
@@ -1,6 +1,8 @@
 #pragma once

 #include "Tab.h"
+
+#include <CommCtrl.h>

 class Display : public Tab {
 public:
<|current_version|>
#pragma once

#include "Tab.h"

#include <CommCtrl.h>

class Display : public Tab {
public:
    virtual void SaveSettings();

protected:
    virtual void Initialize();
    virtual void LoadSettings();

private:
    bool OnAnimationChanged();
    bool OnAnimationSpin(NMUPDOWN *ud);
    bool OnCustomCheckChanged();
    bool OnPositionChanged();

private:
    /* Controls: */
    Checkbox _onTop;
    Checkbox _hideFullscreen;

    ComboBox _position;
    Label _customX;
    EditBox _positionX;
    Label _customY;
    EditBox _positionY;
    Checkbox _customDistance;
    Spinner _edgeSpinner;
    Label _displayDevLabel;
    ComboBox _displayDevice;

    ComboBox _animation;
    Label _hideDelayLabel;
    Spinner _hideDelay;
    Label _hideSpeedLabel;
    Spinner _hideSpeed;

private:
    /* Strings: */
    std::wstring primaryMonitorStr = L"Primary Monitor";
    std::wstring allMonitorStr = L"All Monitors";
    std::wstring customPositionStr = L"Custom";
    std::wstring noAnimStr = L"None";

private:
    /* Constants: */
    const int MIN_EDGE = -65535;
    const int MAX_EDGE = 65535;
    const int MIN_MS = USER_TIMER_MINIMUM;
    const int MAX_MS = 60000;
};
<|next_version|>
#pragma once

#include "Tab.h"

#include <CommCtrl.h>

class Display : public Tab {
public:
    virtual void SaveSettings();

protected:
    virtual void Initialize();
    virtual void LoadSettings();

private:
    bool OnAnimationChanged();
    bool OnAnimationSpin(NMUPDOWN *ud);
    bool OnCustomCheckChanged();
    bool OnPositionChanged();

private:
    /* Controls: */
    Checkbox _onTop;
    Checkbox _hideFullscreen;

    ComboBox _position;
    Label _customX;
    EditBox _positionX;
    Label _customY;
    EditBox _positionY;
    Checkbox _customDistance;
    Spinner _edgeSpinner;
    Label _displayDevLabel;
    ComboBox _displayDevice;

    ComboBox _animation;
    Label _hideDelayLabel;
    Spinner _hideDelay;
    Label _hideSpeedLabel;
    Spinner _hideSpeed;

private:
    /* Strings: */
    std::wstring primaryMonitorStr = L"Primary Monitor";
    std::wstring allMonitorStr = L"All Monitors";
    std::wstring customPositionStr = L"Custom";
    std::wstring noAnimStr = L"None";

private:
    /* Constants: */
    const int MIN_EDGE = -65535;
    const int MAX_EDGE = 65535;
    const int MIN_MS = USER_TIMER_MINIMUM;
    const int MAX_MS = 60000;
    const int ANIM_SPIN_INCREMENT = 100;
};


Make it print something on session open/close

--- src/pam_unshare.c
+++ src/pam_unshare.c
@@ -5,10 +5,12 @@
 #include <security/pam_modules.h>

 PAM_EXTERN int pam_sm_open_session(pam_handle_t *pamh, int flags, int argc, const char **argv) {
+    printf("pam_unshare pam_sm_open_session\n");
     return PAM_SUCCESS;
 }

 PAM_EXTERN int pam_sm_close_session(pam_handle_t *pamh, int flags, int argc, const char **argv) {
+    printf("pam_unshare pam_sm_close_session\n");
     return PAM_SUCCESS;
 }

<|original_code|>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <security/pam_appl.h>
#include <security/pam_modules.h>

PAM_EXTERN int pam_sm_open_session(pam_handle_t *pamh, int flags, int argc, const char **argv) {
    return PAM_SUCCESS;
}

PAM_EXTERN int pam_sm_close_session(pam_handle_t *pamh, int flags, int argc, const char **argv) {
    return PAM_SUCCESS;
}

<|edits_diff|>
--- src/pam_unshare.c
+++ src/pam_unshare.c
@@ -5,6 +5,7 @@
 #include <security/pam_modules.h>

 PAM_EXTERN int pam_sm_open_session(pam_handle_t *pamh, int flags, int argc, const char **argv) {
+    printf("pam_unshare pam_sm_open_session\n");
     return PAM_SUCCESS;
 }

<|current_version|>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <security/pam_appl.h>
#include <security/pam_modules.h>

PAM_EXTERN int pam_sm_open_session(pam_handle_t *pamh, int flags, int argc, const char **argv) {
    printf("pam_unshare pam_sm_open_session\n");
    return PAM_SUCCESS;
}

PAM_EXTERN int pam_sm_close_session(pam_handle_t *pamh, int flags, int argc, const char **argv) {
    return PAM_SUCCESS;
}

<|next_version|>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <security/pam_appl.h>
#include <security/pam_modules.h>

PAM_EXTERN int pam_sm_open_session(pam_handle_t *pamh, int flags, int argc, const char **argv) {
    printf("pam_unshare pam_sm_open_session\n");
    return PAM_SUCCESS;
}

PAM_EXTERN int pam_sm_close_session(pam_handle_t *pamh, int flags, int argc, const char **argv) {
    printf("pam_unshare pam_sm_close_session\n");
    return PAM_SUCCESS;
}


Add protected persistable property to Node base class.

--- src/node.h
+++ src/node.h
@@ -32,10 +32,17 @@
     return std::shared_ptr<Math::Obb>();
   }

+  bool isPersistable()
+  {
+    return persistable;
+  }
+
  protected:
   Node()
   {
   }
+
+  bool persistable = true;

  private:
   friend class boost::serialization::access;

<|original_code|>
#ifndef SRC_NODE_H_

#define SRC_NODE_H_

#include <boost/serialization/serialization.hpp>
#include <boost/serialization/access.hpp>
#include <boost/serialization/nvp.hpp>
#include <memory>
#include "./render_data.h"
#include "./math/obb.h"

class Gl;

/**
 * \brief Base class for nodes which are managed by the
 * Nodes class
 *
 * The only virtual method which must be implemented is
 * Node::render.
 */
class Node
{
 public:
  virtual ~Node()
  {
  }

  virtual void render(Gl *gl, RenderData renderData) = 0;

  virtual std::shared_ptr<Math::Obb> getObb()
  {
    return std::shared_ptr<Math::Obb>();
  }

 protected:
  Node()
  {
  }

 private:
  friend class boost::serialization::access;
  template <class Archive>
  void serialize(Archive &ar, unsigned int version) const
  {
  }
};

#endif  // SRC_NODE_H_

<|edits_diff|>
--- src/node.h
+++ src/node.h
@@ -32,6 +32,11 @@
     return std::shared_ptr<Math::Obb>();
   }

+  bool isPersistable()
+  {
+    return persistable;
+  }
+
  protected:
   Node()
   {
<|current_version|>
#ifndef SRC_NODE_H_

#define SRC_NODE_H_

#include <boost/serialization/serialization.hpp>
#include <boost/serialization/access.hpp>
#include <boost/serialization/nvp.hpp>
#include <memory>
#include "./render_data.h"
#include "./math/obb.h"

class Gl;

/**
 * \brief Base class for nodes which are managed by the
 * Nodes class
 *
 * The only virtual method which must be implemented is
 * Node::render.
 */
class Node
{
 public:
  virtual ~Node()
  {
  }

  virtual void render(Gl *gl, RenderData renderData) = 0;

  virtual std::shared_ptr<Math::Obb> getObb()
  {
    return std::shared_ptr<Math::Obb>();
  }

  bool isPersistable()
  {
    return persistable;
  }

 protected:
  Node()
  {
  }

 private:
  friend class boost::serialization::access;
  template <class Archive>
  void serialize(Archive &ar, unsigned int version) const
  {
  }
};

#endif  // SRC_NODE_H_

<|next_version|>
#ifndef SRC_NODE_H_

#define SRC_NODE_H_

#include <boost/serialization/serialization.hpp>
#include <boost/serialization/access.hpp>
#include <boost/serialization/nvp.hpp>
#include <memory>
#include "./render_data.h"
#include "./math/obb.h"

class Gl;

/**
 * \brief Base class for nodes which are managed by the
 * Nodes class
 *
 * The only virtual method which must be implemented is
 * Node::render.
 */
class Node
{
 public:
  virtual ~Node()
  {
  }

  virtual void render(Gl *gl, RenderData renderData) = 0;

  virtual std::shared_ptr<Math::Obb> getObb()
  {
    return std::shared_ptr<Math::Obb>();
  }

  bool isPersistable()
  {
    return persistable;
  }

 protected:
  Node()
  {
  }

  bool persistable = true;

 private:
  friend class boost::serialization::access;
  template <class Archive>
  void serialize(Archive &ar, unsigned int version) const
  {
  }
};

#endif  // SRC_NODE_H_


Use the STL's make_unique if available

Use the STL's make_unique if available

Fixes build errors with GCC7.3.1 + LLVM5.0.1 under Centos.

/bcc/src/cc/frontends/b/loader.cc: In member function 'int ebpf::BLoader::parse(llvm::Module*, const string&, const string&, ebpf::TableStorage&, const string&, const string&)':
/bcc/src/cc/frontends/b/loader.cc:39:63: error: call of overloaded 'make_unique<ebpf::cc::Parser>(const string&)' is ambiguous
   proto_parser_ = make_unique<ebpf::cc::Parser>(proto_filename);
                                                               ^
In file included from /bcc/src/cc/frontends/b/node.h:26:0,
                 from /bcc/src/cc/frontends/b/parser.h:20,
                 from /bcc/src/cc/frontends/b/loader.cc:17:
/bcc/src/cc/common.h:28:1: note: candidate: typename std::enable_if<(! std::is_array< <template-parameter-1-1> >::value), std::unique_ptr<_Tp> >::type e/*
bpf::make_unique(Args&& ...) [with T = ebpf::cc::Parser; Args = {const std::basic_string<char, std::char_traits<char>, std::allocator<char> >&}; typename std::enable_if<(! std::is_array< <template-parameter-1-1> >::value), std::unique_ptr<_Tp> >::type = std::unique_ptr<ebpf::cc::Parser>]
 make_unique(Args &&... args) {
 ^~~~~~~~~~~
In file included from /opt/rh/devtoolset-7/root/usr/include/c++/7/memory:80:0,
                 from /bcc/src/cc/frontends/b/node.h:22,
                 from /bcc/src/cc/frontends/b/parser.h:20,
                 from /bcc/src/cc/frontends/b/loader.cc:17:
/opt/rh/devtoolset-7/root/usr/include/c++/7/bits/unique_ptr.h:824:5: note: candidate: typename std::_MakeUniq<_Tp>::__single_object std::make_unique(_Args&& ...) [with _Tp = ebpf::cc::Parser; _Args = {const std::basic_string<char, std::char_traits<char>, std::allocator<char> >&}; typename std::_MakeUniq<_Tp>::__single_object = std::unique_ptr<ebpf::cc::Parser>]
     make_unique(_Args&&... __args)
     ^~~~~~~~~~~

Signed-off-by: Kyle Zhang <3c25b01657254677d3e1a8fd1f0742c5d489bd39@smartx.com>

--- src/cc/common.h
+++ src/cc/common.h
@@ -23,11 +23,15 @@

 namespace ebpf {

+#ifdef __cpp_lib_make_unique
+using std::make_unique;
+#else
 template <class T, class... Args>
 typename std::enable_if<!std::is_array<T>::value, std::unique_ptr<T>>::type
 make_unique(Args &&... args) {
   return std::unique_ptr<T>(new T(std::forward<Args>(args)...));
 }
+#endif

 std::vector<int> get_online_cpus();

<|original_code|>
/*
 * Copyright (c) 2015 PLUMgrid, 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.
 */

#pragma once

#include <memory>
#include <string>
#include <unistd.h>
#include <vector>

namespace ebpf {

template <class T, class... Args>
typename std::enable_if<!std::is_array<T>::value, std::unique_ptr<T>>::type
make_unique(Args &&... args) {
  return std::unique_ptr<T>(new T(std::forward<Args>(args)...));
}

std::vector<int> get_online_cpus();

std::vector<int> get_possible_cpus();

std::string get_pid_exe(pid_t pid);

}  // namespace ebpf

<|edits_diff|>
--- src/cc/common.h
+++ src/cc/common.h
@@ -23,6 +23,9 @@

 namespace ebpf {

+#ifdef __cpp_lib_make_unique
+using std::make_unique;
+#else
 template <class T, class... Args>
 typename std::enable_if<!std::is_array<T>::value, std::unique_ptr<T>>::type
 make_unique(Args &&... args) {
<|current_version|>
/*
 * Copyright (c) 2015 PLUMgrid, 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.
 */

#pragma once

#include <memory>
#include <string>
#include <unistd.h>
#include <vector>

namespace ebpf {

#ifdef __cpp_lib_make_unique
using std::make_unique;
#else
template <class T, class... Args>
typename std::enable_if<!std::is_array<T>::value, std::unique_ptr<T>>::type
make_unique(Args &&... args) {
  return std::unique_ptr<T>(new T(std::forward<Args>(args)...));
}

std::vector<int> get_online_cpus();

std::vector<int> get_possible_cpus();

std::string get_pid_exe(pid_t pid);

}  // namespace ebpf

<|next_version|>
/*
 * Copyright (c) 2015 PLUMgrid, 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.
 */

#pragma once

#include <memory>
#include <string>
#include <unistd.h>
#include <vector>

namespace ebpf {

#ifdef __cpp_lib_make_unique
using std::make_unique;
#else
template <class T, class... Args>
typename std::enable_if<!std::is_array<T>::value, std::unique_ptr<T>>::type
make_unique(Args &&... args) {
  return std::unique_ptr<T>(new T(std::forward<Args>(args)...));
}
#endif

std::vector<int> get_online_cpus();

std::vector<int> get_possible_cpus();

std::string get_pid_exe(pid_t pid);

}  // namespace ebpf


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

--- include/insect.h
+++ include/insect.h
@@ -1,5 +1,9 @@
 #ifndef __INSECT_H__
 #define __INSECT_H__
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* C++ */

 #include "insect/crawler.h"
 #include "insect/records.h"
@@ -11,4 +15,8 @@
 #include "insect/concurrent/thread.h"
 #endif /* USE_THREADS */

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

<|original_code|>
#ifndef __INSECT_H__
#define __INSECT_H__

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

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

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

#endif /* __INSECT_H__ */

<|edits_diff|>
--- include/insect.h
+++ include/insect.h
@@ -1,5 +1,9 @@
 #ifndef __INSECT_H__
 #define __INSECT_H__
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* C++ */

 #include "insect/crawler.h"
 #include "insect/records.h"
<|current_version|>
#ifndef __INSECT_H__
#define __INSECT_H__

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

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

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

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

#endif /* __INSECT_H__ */

<|next_version|>
#ifndef __INSECT_H__
#define __INSECT_H__

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

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

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

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

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

#endif /* __INSECT_H__ */


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

--- ui/reflectionview.h
+++ ui/reflectionview.h
@@ -21,10 +21,16 @@
 	ViewFrame* m_frame;
 	BinaryViewRef m_data;
 	DisassemblyContainer* m_disassemblyContainer;
+	std::map<BNFunctionGraphType, BNFunctionGraphType> m_ilMap;
+	bool m_ilSync;
+	bool m_locationSync;

 public:
 	ReflectionView(ViewFrame* frame, BinaryViewRef data);
 	~ReflectionView();
+
+	void toggleILSync();
+	void toggleLocationSync();

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

<|original_code|>
#pragma once

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

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

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

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

	ViewFrame* m_frame;
	BinaryViewRef m_data;
	DisassemblyContainer* m_disassemblyContainer;

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

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

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

<|edits_diff|>
--- ui/reflectionview.h
+++ ui/reflectionview.h
@@ -21,6 +21,9 @@
 	ViewFrame* m_frame;
 	BinaryViewRef m_data;
 	DisassemblyContainer* m_disassemblyContainer;
+	std::map<BNFunctionGraphType, BNFunctionGraphType> m_ilMap;
+	bool m_ilSync;
+	bool m_locationSync;

 public:
 	ReflectionView(ViewFrame* frame, BinaryViewRef data);
<|current_version|>
#pragma once

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

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

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

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

	ViewFrame* m_frame;
	BinaryViewRef m_data;
	DisassemblyContainer* m_disassemblyContainer;
	std::map<BNFunctionGraphType, BNFunctionGraphType> m_ilMap;
	bool m_ilSync;
	bool m_locationSync;

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

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

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

<|next_version|>
#pragma once

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

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

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

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

	ViewFrame* m_frame;
	BinaryViewRef m_data;
	DisassemblyContainer* m_disassemblyContainer;
	std::map<BNFunctionGraphType, BNFunctionGraphType> m_ilMap;
	bool m_ilSync;
	bool m_locationSync;

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

	void toggleILSync();
	void toggleLocationSync();

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

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


COMMON: Add virtual functions to handle mouse movments and Resize

--- source/common/game_state_manager_base.h
+++ source/common/game_state_manager_base.h
@@ -33,8 +33,16 @@
 	 * of this being called is determined by getUpdatePeriod()
 	 */
 	virtual void Update() = 0;
+
+	virtual void OnResize(int newClientWidth, int newClientHeight) = 0;
+
 	virtual void GamePaused() = 0;
 	virtual void GameUnpaused() = 0;
+
+	virtual void MouseDown(WPARAM buttonState, int x, int y) = 0;
+	virtual void MouseUp(WPARAM buttonState, int x, int y) = 0;
+	virtual void MouseMove(WPARAM buttonState, int x, int y) = 0;
+	virtual void MouseWheel(int zDelta) = 0;
 };

 } // End of namespace Common

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

#ifndef GAME_STATE_MANAGER_H
#define GAME_STATE_MANAGER_H

namespace Common {

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

} // End of namespace Common

#endif

<|edits_diff|>
--- source/common/game_state_manager_base.h
+++ source/common/game_state_manager_base.h
@@ -33,6 +33,9 @@
 	 * of this being called is determined by getUpdatePeriod()
 	 */
 	virtual void Update() = 0;
+
+	virtual void OnResize(int newClientWidth, int newClientHeight) = 0;
+
 	virtual void GamePaused() = 0;
 	virtual void GameUnpaused() = 0;
 };
<|current_version|>
/* The Halfling Project - A Graphics Engine and Projects
 *
 * The Halfling Project is the legal property of Adrian Astley
 * Copyright Adrian Astley 2013
 */

#ifndef GAME_STATE_MANAGER_H
#define GAME_STATE_MANAGER_H

namespace Common {

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

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

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

} // End of namespace Common

#endif

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

#ifndef GAME_STATE_MANAGER_H
#define GAME_STATE_MANAGER_H

namespace Common {

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

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

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

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

} // End of namespace Common

#endif


Include some comments about each method

Include some comments about each method

--- src/MotorShield.h
+++ src/MotorShield.h
@@ -5,23 +5,59 @@
 public:
     MotorShield(uint8_t leftSpeedPin, uint8_t leftDirPin,
                 uint8_t rightSpeedPin, uint8_t rightDirPin);
+
+    // Initialization method. Must be called in Arduino's setup() function.
     void init();
+
+    // Makes left and right motors go in the forward direction.
     void forward();
+
+    // Makes left and right motors go in the backward direction.
     void backward();
+
+    // Stops both left and right motors.
     void stop();
+
+    // Puts both left and right motors at the maximum speed.
     void fullSpeed();
+
+    // Stops left motor.
     void stopLeft();
+
+    // Stops right motor.
     void stopRight();
+
+    // Returns the maximum allowed speed.
     uint8_t getMaxSpeed();
+
+    // Returns the minimum allowed speed.
     uint8_t getMinSpeed();
+
+    // Returns the pin used to control left motor speed.
     uint8_t getLeftSpeedPin();
+
+    // Returns the pin used to control left motor direction.
     uint8_t getLeftDirPin();
+
+    // Returns the pin used to control right motor speed.
     uint8_t getRightSpeedPin();
+
+    // Returns the pin used to control right motor direction.
     uint8_t getRightDirPin();
+
+    // Returns the current speed of the left motor.
     uint8_t getLeftSpeed();
+
+    // Returns the current speed of the right motor.
     uint8_t getRightSpeed();
+
+    // Sets the speed of both left and right motors.
     void setSpeed(uint8_t);
+
+    // Sets the speed of the left motor.
     void setLeftSpeed(uint8_t);
+
+    // Sets the speed of the right motor.
     void setRightSpeed(uint8_t);
 private:
     uint8_t leftSpeedPin,

<|original_code|>
#include <Arduino.h>

class MotorShield
{
public:
    MotorShield(uint8_t leftSpeedPin, uint8_t leftDirPin,
                uint8_t rightSpeedPin, uint8_t rightDirPin);
    void init();
    void forward();
    void backward();
    void stop();
    void fullSpeed();
    void stopLeft();
    void stopRight();
    uint8_t getMaxSpeed();
    uint8_t getMinSpeed();
    uint8_t getLeftSpeedPin();
    uint8_t getLeftDirPin();
    uint8_t getRightSpeedPin();
    uint8_t getRightDirPin();
    uint8_t getLeftSpeed();
    uint8_t getRightSpeed();
    void setSpeed(uint8_t);
    void setLeftSpeed(uint8_t);
    void setRightSpeed(uint8_t);
private:
    uint8_t leftSpeedPin,
            leftDirPin,
            rightSpeedPin,
            rightDirPin,
            maxSpeed,
            minSpeed,
            leftSpeed,
            rightSpeed;
};

<|edits_diff|>
--- src/MotorShield.h
+++ src/MotorShield.h
@@ -5,22 +5,56 @@
 public:
     MotorShield(uint8_t leftSpeedPin, uint8_t leftDirPin,
                 uint8_t rightSpeedPin, uint8_t rightDirPin);
+
+    // Initialization method. Must be called in Arduino's setup() function.
     void init();
+
+    // Makes left and right motors go in the forward direction.
     void forward();
+
+    // Makes left and right motors go in the backward direction.
     void backward();
+
+    // Stops both left and right motors.
     void stop();
+
+    // Puts both left and right motors at the maximum speed.
     void fullSpeed();
+
+    // Stops left motor.
     void stopLeft();
+
+    // Stops right motor.
     void stopRight();
+
+    // Returns the maximum allowed speed.
     uint8_t getMaxSpeed();
+
+    // Returns the minimum allowed speed.
     uint8_t getMinSpeed();
+
+    // Returns the pin used to control left motor speed.
     uint8_t getLeftSpeedPin();
+
+    // Returns the pin used to control left motor direction.
     uint8_t getLeftDirPin();
+
+    // Returns the pin used to control right motor speed.
     uint8_t getRightSpeedPin();
+
+    // Returns the pin used to control right motor direction.
     uint8_t getRightDirPin();
+
+    // Returns the current speed of the left motor.
     uint8_t getLeftSpeed();
+
+    // Returns the current speed of the right motor.
     uint8_t getRightSpeed();
+
+    // Sets the speed of both left and right motors.
     void setSpeed(uint8_t);
+
+    // Sets the speed of the left motor.
     void setLeftSpeed(uint8_t);
     void setRightSpeed(uint8_t);
 private:
<|current_version|>
#include <Arduino.h>

class MotorShield
{
public:
    MotorShield(uint8_t leftSpeedPin, uint8_t leftDirPin,
                uint8_t rightSpeedPin, uint8_t rightDirPin);

    // Initialization method. Must be called in Arduino's setup() function.
    void init();

    // Makes left and right motors go in the forward direction.
    void forward();

    // Makes left and right motors go in the backward direction.
    void backward();

    // Stops both left and right motors.
    void stop();

    // Puts both left and right motors at the maximum speed.
    void fullSpeed();

    // Stops left motor.
    void stopLeft();

    // Stops right motor.
    void stopRight();

    // Returns the maximum allowed speed.
    uint8_t getMaxSpeed();

    // Returns the minimum allowed speed.
    uint8_t getMinSpeed();

    // Returns the pin used to control left motor speed.
    uint8_t getLeftSpeedPin();

    // Returns the pin used to control left motor direction.
    uint8_t getLeftDirPin();

    // Returns the pin used to control right motor speed.
    uint8_t getRightSpeedPin();

    // Returns the pin used to control right motor direction.
    uint8_t getRightDirPin();

    // Returns the current speed of the left motor.
    uint8_t getLeftSpeed();

    // Returns the current speed of the right motor.
    uint8_t getRightSpeed();

    // Sets the speed of both left and right motors.
    void setSpeed(uint8_t);

    // Sets the speed of the left motor.
    void setLeftSpeed(uint8_t);
    void setRightSpeed(uint8_t);
private:
    uint8_t leftSpeedPin,
            leftDirPin,
            rightSpeedPin,
            rightDirPin,
            maxSpeed,
            minSpeed,
            leftSpeed,
            rightSpeed;
};

<|next_version|>
#include <Arduino.h>

class MotorShield
{
public:
    MotorShield(uint8_t leftSpeedPin, uint8_t leftDirPin,
                uint8_t rightSpeedPin, uint8_t rightDirPin);

    // Initialization method. Must be called in Arduino's setup() function.
    void init();

    // Makes left and right motors go in the forward direction.
    void forward();

    // Makes left and right motors go in the backward direction.
    void backward();

    // Stops both left and right motors.
    void stop();

    // Puts both left and right motors at the maximum speed.
    void fullSpeed();

    // Stops left motor.
    void stopLeft();

    // Stops right motor.
    void stopRight();

    // Returns the maximum allowed speed.
    uint8_t getMaxSpeed();

    // Returns the minimum allowed speed.
    uint8_t getMinSpeed();

    // Returns the pin used to control left motor speed.
    uint8_t getLeftSpeedPin();

    // Returns the pin used to control left motor direction.
    uint8_t getLeftDirPin();

    // Returns the pin used to control right motor speed.
    uint8_t getRightSpeedPin();

    // Returns the pin used to control right motor direction.
    uint8_t getRightDirPin();

    // Returns the current speed of the left motor.
    uint8_t getLeftSpeed();

    // Returns the current speed of the right motor.
    uint8_t getRightSpeed();

    // Sets the speed of both left and right motors.
    void setSpeed(uint8_t);

    // Sets the speed of the left motor.
    void setLeftSpeed(uint8_t);

    // Sets the speed of the right motor.
    void setRightSpeed(uint8_t);
private:
    uint8_t leftSpeedPin,
            leftDirPin,
            rightSpeedPin,
            rightDirPin,
            maxSpeed,
            minSpeed,
            leftSpeed,
            rightSpeed;
};


Fix bug in shape yaml emit

Fix bug in shape yaml emit

--- src/lib/PMDPage.h
+++ src/lib/PMDPage.h
@@ -33,7 +33,9 @@

   void emitYaml(yaml_emitter_t *emitter) const
   {
+    yamlBeginMap(emitter);
     yamlIndirectForeach(emitter, "shapes", m_shapes);
+    yamlEndMap(emitter);
   }
 };

<|original_code|>
#pragma once
#include "geometry.h"
#include "yaml_utils.h"

#include <vector>
#include <boost/shared_ptr.hpp>
#include <librevenge/librevenge.h>

namespace libpagemaker
{

class PMDPage
{
  std::vector<boost::shared_ptr<PMDLineSet> > m_shapes;
public:
  PMDPage() : m_shapes()
  { }

  void addShape(boost::shared_ptr<PMDLineSet> shape)
  {
    m_shapes.push_back(shape);
  }

  unsigned numShapes() const
  {
    return m_shapes.size();
  }

  boost::shared_ptr<const PMDLineSet> getShape(unsigned i) const
  {
    return m_shapes.at(i);
  }

  void emitYaml(yaml_emitter_t *emitter) const
  {
    yamlIndirectForeach(emitter, "shapes", m_shapes);
  }
};

}
/* vim:set shiftwidth=2 softtabstop=2 expandtab: */

<|edits_diff|>
--- src/lib/PMDPage.h
+++ src/lib/PMDPage.h
@@ -33,6 +33,7 @@

   void emitYaml(yaml_emitter_t *emitter) const
   {
+    yamlBeginMap(emitter);
     yamlIndirectForeach(emitter, "shapes", m_shapes);
   }
 };
<|current_version|>
#pragma once
#include "geometry.h"
#include "yaml_utils.h"

#include <vector>
#include <boost/shared_ptr.hpp>
#include <librevenge/librevenge.h>

namespace libpagemaker
{

class PMDPage
{
  std::vector<boost::shared_ptr<PMDLineSet> > m_shapes;
public:
  PMDPage() : m_shapes()
  { }

  void addShape(boost::shared_ptr<PMDLineSet> shape)
  {
    m_shapes.push_back(shape);
  }

  unsigned numShapes() const
  {
    return m_shapes.size();
  }

  boost::shared_ptr<const PMDLineSet> getShape(unsigned i) const
  {
    return m_shapes.at(i);
  }

  void emitYaml(yaml_emitter_t *emitter) const
  {
    yamlBeginMap(emitter);
    yamlIndirectForeach(emitter, "shapes", m_shapes);
  }
};

}
/* vim:set shiftwidth=2 softtabstop=2 expandtab: */

<|next_version|>
#pragma once
#include "geometry.h"
#include "yaml_utils.h"

#include <vector>
#include <boost/shared_ptr.hpp>
#include <librevenge/librevenge.h>

namespace libpagemaker
{

class PMDPage
{
  std::vector<boost::shared_ptr<PMDLineSet> > m_shapes;
public:
  PMDPage() : m_shapes()
  { }

  void addShape(boost::shared_ptr<PMDLineSet> shape)
  {
    m_shapes.push_back(shape);
  }

  unsigned numShapes() const
  {
    return m_shapes.size();
  }

  boost::shared_ptr<const PMDLineSet> getShape(unsigned i) const
  {
    return m_shapes.at(i);
  }

  void emitYaml(yaml_emitter_t *emitter) const
  {
    yamlBeginMap(emitter);
    yamlIndirectForeach(emitter, "shapes", m_shapes);
    yamlEndMap(emitter);
  }
};

}
/* vim:set shiftwidth=2 softtabstop=2 expandtab: */


Add TypeSet type as set of Types

Add TypeSet type as set of Types

--- opencog/atoms/base/types.h
+++ opencog/atoms/base/types.h
@@ -30,6 +30,8 @@
 #ifndef _OPENCOG_TYPES_H
 #define _OPENCOG_TYPES_H

+#include <set>
+
 namespace opencog
 {
 /** \addtogroup grp_atomspace
@@ -39,6 +41,9 @@
 //! type of Atoms, represented as short integer (16 bits)
 typedef unsigned short Type;

+//! Set of atom types
+typedef std::set<Type> TypeSet;
+
 /** @}*/
 } // namespace opencog

<|original_code|>
/*
 * opencog/atoms/base/types.h
 *
 * Copyright (C) 2002-2007 Novamente LLC
 * All Rights Reserved
 *
 * Written by Thiago Maia <thiago@vettatech.com>
 *            Andre Senna <senna@vettalabs.com>
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU Affero General Public License v3 as
 * published by the Free Software Foundation and including the exceptions
 * at http://opencog.org/wiki/Licenses
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU Affero General Public License
 * along with this program; if not, write to:
 * Free Software Foundation, Inc.,
 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 */

/**
 * basic type definitions.
 */

#ifndef _OPENCOG_TYPES_H
#define _OPENCOG_TYPES_H

namespace opencog
{
/** \addtogroup grp_atomspace
 *  @{
 */

//! type of Atoms, represented as short integer (16 bits)
typedef unsigned short Type;

/** @}*/
} // namespace opencog

#endif // _OPENCOG_TYPES_H

<|edits_diff|>
--- opencog/atoms/base/types.h
+++ opencog/atoms/base/types.h
@@ -30,6 +30,8 @@
 #ifndef _OPENCOG_TYPES_H
 #define _OPENCOG_TYPES_H

+#include <set>
+
 namespace opencog
 {
 /** \addtogroup grp_atomspace
<|current_version|>
/*
 * opencog/atoms/base/types.h
 *
 * Copyright (C) 2002-2007 Novamente LLC
 * All Rights Reserved
 *
 * Written by Thiago Maia <thiago@vettatech.com>
 *            Andre Senna <senna@vettalabs.com>
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU Affero General Public License v3 as
 * published by the Free Software Foundation and including the exceptions
 * at http://opencog.org/wiki/Licenses
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU Affero General Public License
 * along with this program; if not, write to:
 * Free Software Foundation, Inc.,
 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 */

/**
 * basic type definitions.
 */

#ifndef _OPENCOG_TYPES_H
#define _OPENCOG_TYPES_H

#include <set>

namespace opencog
{
/** \addtogroup grp_atomspace
 *  @{
 */

//! type of Atoms, represented as short integer (16 bits)
typedef unsigned short Type;

/** @}*/
} // namespace opencog

#endif // _OPENCOG_TYPES_H

<|next_version|>
/*
 * opencog/atoms/base/types.h
 *
 * Copyright (C) 2002-2007 Novamente LLC
 * All Rights Reserved
 *
 * Written by Thiago Maia <thiago@vettatech.com>
 *            Andre Senna <senna@vettalabs.com>
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU Affero General Public License v3 as
 * published by the Free Software Foundation and including the exceptions
 * at http://opencog.org/wiki/Licenses
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU Affero General Public License
 * along with this program; if not, write to:
 * Free Software Foundation, Inc.,
 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 */

/**
 * basic type definitions.
 */

#ifndef _OPENCOG_TYPES_H
#define _OPENCOG_TYPES_H

#include <set>

namespace opencog
{
/** \addtogroup grp_atomspace
 *  @{
 */

//! type of Atoms, represented as short integer (16 bits)
typedef unsigned short Type;

//! Set of atom types
typedef std::set<Type> TypeSet;

/** @}*/
} // namespace opencog

#endif // _OPENCOG_TYPES_H


Add passing of information to prepareforsegue method

--- bikepath/ResultsMapViewController.h
+++ bikepath/ResultsMapViewController.h
@@ -8,11 +8,14 @@

 #import <UIKit/UIKit.h>
 #import <GoogleMaps/GoogleMaps.h>
+#import "SearchItem.h"

 @interface ResultsMapViewController : UIViewController <GMSMapViewDelegate>
 @property (strong, nonatomic) IBOutlet GMSMapView *mapView;

 - (IBAction)unwindToSearchPage:(UIStoryboardSegue *)segue;

+@property (nonatomic, strong) SearchItem *item;
+

 @end

<|original_code|>
//
//  ResultsMapViewController.h
//  bikepath
//
//  Created by Farheen Malik on 8/14/14.
//  Copyright (c) 2014 Bike Path. All rights reserved.
//

#import <UIKit/UIKit.h>
#import <GoogleMaps/GoogleMaps.h>

@interface ResultsMapViewController : UIViewController <GMSMapViewDelegate>
@property (strong, nonatomic) IBOutlet GMSMapView *mapView;

- (IBAction)unwindToSearchPage:(UIStoryboardSegue *)segue;

@end

<|edits_diff|>
--- bikepath/ResultsMapViewController.h
+++ bikepath/ResultsMapViewController.h
@@ -8,6 +8,7 @@

 #import <UIKit/UIKit.h>
 #import <GoogleMaps/GoogleMaps.h>
+#import "SearchItem.h"

 @interface ResultsMapViewController : UIViewController <GMSMapViewDelegate>
 @property (strong, nonatomic) IBOutlet GMSMapView *mapView;
<|current_version|>
//
//  ResultsMapViewController.h
//  bikepath
//
//  Created by Farheen Malik on 8/14/14.
//  Copyright (c) 2014 Bike Path. All rights reserved.
//

#import <UIKit/UIKit.h>
#import <GoogleMaps/GoogleMaps.h>
#import "SearchItem.h"

@interface ResultsMapViewController : UIViewController <GMSMapViewDelegate>
@property (strong, nonatomic) IBOutlet GMSMapView *mapView;

- (IBAction)unwindToSearchPage:(UIStoryboardSegue *)segue;

@end

<|next_version|>
//
//  ResultsMapViewController.h
//  bikepath
//
//  Created by Farheen Malik on 8/14/14.
//  Copyright (c) 2014 Bike Path. All rights reserved.
//

#import <UIKit/UIKit.h>
#import <GoogleMaps/GoogleMaps.h>
#import "SearchItem.h"

@interface ResultsMapViewController : UIViewController <GMSMapViewDelegate>
@property (strong, nonatomic) IBOutlet GMSMapView *mapView;

- (IBAction)unwindToSearchPage:(UIStoryboardSegue *)segue;

@property (nonatomic, strong) SearchItem *item;

@end


Add include guard for lambda header

Add include guard for lambda header

--- src/FTDebouncer-Lambda.h
+++ src/FTDebouncer-Lambda.h
@@ -1,5 +1,10 @@
+#ifndef FTDEBOUNCER_LAMBDA_H
+#define FTDEBOUNCER_LAMBDA_H
+
 #include "FTDebouncer.h"

 //Dummy function implementations to satisfy linker when using lambdas
 void onPinActivated(int pinNumber){}
 void onPinDeactivated(int pinNumber){}
+
+#endif

<|original_code|>
#include "FTDebouncer.h"

//Dummy function implementations to satisfy linker when using lambdas
void onPinActivated(int pinNumber){}
void onPinDeactivated(int pinNumber){}
<|edits_diff|>
--- src/FTDebouncer-Lambda.h
+++ src/FTDebouncer-Lambda.h
@@ -3,3 +3,5 @@
 //Dummy function implementations to satisfy linker when using lambdas
 void onPinActivated(int pinNumber){}
 void onPinDeactivated(int pinNumber){}
+
+#endif
<|current_version|>
#include "FTDebouncer.h"

//Dummy function implementations to satisfy linker when using lambdas
void onPinActivated(int pinNumber){}
void onPinDeactivated(int pinNumber){}

#endif
<|next_version|>
#ifndef FTDEBOUNCER_LAMBDA_H
#define FTDEBOUNCER_LAMBDA_H

#include "FTDebouncer.h"

//Dummy function implementations to satisfy linker when using lambdas
void onPinActivated(int pinNumber){}
void onPinDeactivated(int pinNumber){}

#endif


ADD ui and text comps to menustate

ADD ui and text comps to menustate

--- SSPSolution/SSPSolution/MenuState.h
+++ SSPSolution/SSPSolution/MenuState.h
@@ -1,10 +1,14 @@
 #ifndef SSPAPPLICATION_GAMESTATES_MENUSTATE_H
 #define SSPAPPLICATION_GAMESTATES_MENUSTATE_H
 #include "GameState.h"
+#include "../GraphicsDLL/GraphicsComponent.h"
 class MenuState :
 	public GameState
 {
 private:
+	const static int m_NR_OF_MENU_ITEMS = 2;
+	UIComponent* m_uiComps[NR_OF_MENU_ITEMS];
+	TextComponent* m_textComps[NR_OF_MENU_ITEMS];
 public:
 	MenuState();
 	~MenuState();

<|original_code|>
#ifndef SSPAPPLICATION_GAMESTATES_MENUSTATE_H
#define SSPAPPLICATION_GAMESTATES_MENUSTATE_H
#include "GameState.h"
class MenuState :
	public GameState
{
private:
public:
	MenuState();
	~MenuState();

	int ShutDown();
	int Initialize(GameStateHandler* gsh, ComponentHandler* cHandler);
	int Update(float dt, InputHandler * inputHandler);
private:
};

#endif
<|edits_diff|>
--- SSPSolution/SSPSolution/MenuState.h
+++ SSPSolution/SSPSolution/MenuState.h
@@ -1,6 +1,7 @@
 #ifndef SSPAPPLICATION_GAMESTATES_MENUSTATE_H
 #define SSPAPPLICATION_GAMESTATES_MENUSTATE_H
 #include "GameState.h"
+#include "../GraphicsDLL/GraphicsComponent.h"
 class MenuState :
 	public GameState
 {
<|current_version|>
#ifndef SSPAPPLICATION_GAMESTATES_MENUSTATE_H
#define SSPAPPLICATION_GAMESTATES_MENUSTATE_H
#include "GameState.h"
#include "../GraphicsDLL/GraphicsComponent.h"
class MenuState :
	public GameState
{
private:
public:
	MenuState();
	~MenuState();

	int ShutDown();
	int Initialize(GameStateHandler* gsh, ComponentHandler* cHandler);
	int Update(float dt, InputHandler * inputHandler);
private:
};

#endif
<|next_version|>
#ifndef SSPAPPLICATION_GAMESTATES_MENUSTATE_H
#define SSPAPPLICATION_GAMESTATES_MENUSTATE_H
#include "GameState.h"
#include "../GraphicsDLL/GraphicsComponent.h"
class MenuState :
	public GameState
{
private:
	const static int m_NR_OF_MENU_ITEMS = 2;
	UIComponent* m_uiComps[NR_OF_MENU_ITEMS];
	TextComponent* m_textComps[NR_OF_MENU_ITEMS];
public:
	MenuState();
	~MenuState();

	int ShutDown();
	int Initialize(GameStateHandler* gsh, ComponentHandler* cHandler);
	int Update(float dt, InputHandler * inputHandler);
private:
};

#endif


target-helpers: Enable debug helpers only on debug builds.

Some of these helpers use debug_get_option, which works also on releases.

--- src/gallium/auxiliary/target-helpers/inline_debug_helper.h
+++ src/gallium/auxiliary/target-helpers/inline_debug_helper.h
@@ -9,6 +9,8 @@
 /* Helper function to wrap a screen with
  * one or more debug driver: rbug, trace.
  */
+
+#ifdef DEBUG

 #ifdef GALLIUM_TRACE
 #include "trace/tr_public.h"
@@ -26,9 +28,12 @@
 #include "noop/noop_public.h"
 #endif

+#endif /* DEBUG */
+
 static INLINE struct pipe_screen *
 debug_screen_wrap(struct pipe_screen *screen)
 {
+#ifdef DEBUG

 #if defined(GALLIUM_RBUG)
    screen = rbug_screen_create(screen);
@@ -46,6 +51,8 @@
    screen = noop_screen_create(screen);
 #endif

+#endif /* DEBUG */
+
    return screen;
 }

<|original_code|>

#ifndef INLINE_DEBUG_HELPER_H
#define INLINE_DEBUG_HELPER_H

#include "pipe/p_compiler.h"
#include "util/u_debug.h"

/* Helper function to wrap a screen with
 * one or more debug driver: rbug, trace.
 */

#ifdef GALLIUM_TRACE
#include "trace/tr_public.h"
#endif

#ifdef GALLIUM_RBUG
#include "rbug/rbug_public.h"
#endif

#ifdef GALLIUM_GALAHAD
#include "galahad/glhd_public.h"
#endif

#ifdef GALLIUM_NOOP
#include "noop/noop_public.h"
#endif

static INLINE struct pipe_screen *
debug_screen_wrap(struct pipe_screen *screen)
{

#if defined(GALLIUM_RBUG)
   screen = rbug_screen_create(screen);
#endif

#if defined(GALLIUM_TRACE)
   screen = trace_screen_create(screen);
#endif

#if defined(GALLIUM_GALAHAD)
   screen = galahad_screen_create(screen);
#endif

#if defined(GALLIUM_NOOP)
   screen = noop_screen_create(screen);
#endif

   return screen;
}

#endif

<|edits_diff|>
--- src/gallium/auxiliary/target-helpers/inline_debug_helper.h
+++ src/gallium/auxiliary/target-helpers/inline_debug_helper.h
@@ -9,6 +9,8 @@
 /* Helper function to wrap a screen with
  * one or more debug driver: rbug, trace.
  */
+
+#ifdef DEBUG

 #ifdef GALLIUM_TRACE
 #include "trace/tr_public.h"
@@ -26,9 +28,12 @@
 #include "noop/noop_public.h"
 #endif

+#endif /* DEBUG */
+
 static INLINE struct pipe_screen *
 debug_screen_wrap(struct pipe_screen *screen)
 {
+#ifdef DEBUG

 #if defined(GALLIUM_RBUG)
    screen = rbug_screen_create(screen);
<|current_version|>

#ifndef INLINE_DEBUG_HELPER_H
#define INLINE_DEBUG_HELPER_H

#include "pipe/p_compiler.h"
#include "util/u_debug.h"

/* Helper function to wrap a screen with
 * one or more debug driver: rbug, trace.
 */

#ifdef DEBUG

#ifdef GALLIUM_TRACE
#include "trace/tr_public.h"
#endif

#ifdef GALLIUM_RBUG
#include "rbug/rbug_public.h"
#endif

#ifdef GALLIUM_GALAHAD
#include "galahad/glhd_public.h"
#endif

#ifdef GALLIUM_NOOP
#include "noop/noop_public.h"
#endif

#endif /* DEBUG */

static INLINE struct pipe_screen *
debug_screen_wrap(struct pipe_screen *screen)
{
#ifdef DEBUG

#if defined(GALLIUM_RBUG)
   screen = rbug_screen_create(screen);
#endif

#if defined(GALLIUM_TRACE)
   screen = trace_screen_create(screen);
#endif

#if defined(GALLIUM_GALAHAD)
   screen = galahad_screen_create(screen);
#endif

#if defined(GALLIUM_NOOP)
   screen = noop_screen_create(screen);
#endif

   return screen;
}

#endif

<|next_version|>

#ifndef INLINE_DEBUG_HELPER_H
#define INLINE_DEBUG_HELPER_H

#include "pipe/p_compiler.h"
#include "util/u_debug.h"

/* Helper function to wrap a screen with
 * one or more debug driver: rbug, trace.
 */

#ifdef DEBUG

#ifdef GALLIUM_TRACE
#include "trace/tr_public.h"
#endif

#ifdef GALLIUM_RBUG
#include "rbug/rbug_public.h"
#endif

#ifdef GALLIUM_GALAHAD
#include "galahad/glhd_public.h"
#endif

#ifdef GALLIUM_NOOP
#include "noop/noop_public.h"
#endif

#endif /* DEBUG */

static INLINE struct pipe_screen *
debug_screen_wrap(struct pipe_screen *screen)
{
#ifdef DEBUG

#if defined(GALLIUM_RBUG)
   screen = rbug_screen_create(screen);
#endif

#if defined(GALLIUM_TRACE)
   screen = trace_screen_create(screen);
#endif

#if defined(GALLIUM_GALAHAD)
   screen = galahad_screen_create(screen);
#endif

#if defined(GALLIUM_NOOP)
   screen = noop_screen_create(screen);
#endif

#endif /* DEBUG */

   return screen;
}

#endif


Add a class for the settings dialog

Add a class for the settings dialog

--- 3RVX/3RVX.h
+++ 3RVX/3RVX.h
@@ -1,6 +1,7 @@
 #pragma once

 #define CLASS_3RVX L"3RVXv3"
+#define CLASS_3RVX_SETTINGS L"3RVX-Settings"

 static const UINT WM_3RVX_CONTROL
     = RegisterWindowMessage(L"WM_3RVX_CONTROL");
@@ -11,3 +12,4 @@
 #define MSG_SETTINGS WM_APP + 101
 #define MSG_EXIT     WM_APP + 102
 #define MSG_HIDEOSD  WM_APP + 103
+#define MSG_ACTIVATE WM_APP + 104

<|original_code|>
#pragma once

#define CLASS_3RVX L"3RVXv3"

static const UINT WM_3RVX_CONTROL
    = RegisterWindowMessage(L"WM_3RVX_CONTROL");
static const UINT WM_3RVX_SETTINGSCTRL
    = RegisterWindowMessage(L"WM_3RVX_SETTINGSCTRL");

#define MSG_LOAD     WM_APP + 100
#define MSG_SETTINGS WM_APP + 101
#define MSG_EXIT     WM_APP + 102
#define MSG_HIDEOSD  WM_APP + 103
<|edits_diff|>
--- 3RVX/3RVX.h
+++ 3RVX/3RVX.h
@@ -11,3 +11,4 @@
 #define MSG_SETTINGS WM_APP + 101
 #define MSG_EXIT     WM_APP + 102
 #define MSG_HIDEOSD  WM_APP + 103
+#define MSG_ACTIVATE WM_APP + 104
<|current_version|>
#pragma once

#define CLASS_3RVX L"3RVXv3"

static const UINT WM_3RVX_CONTROL
    = RegisterWindowMessage(L"WM_3RVX_CONTROL");
static const UINT WM_3RVX_SETTINGSCTRL
    = RegisterWindowMessage(L"WM_3RVX_SETTINGSCTRL");

#define MSG_LOAD     WM_APP + 100
#define MSG_SETTINGS WM_APP + 101
#define MSG_EXIT     WM_APP + 102
#define MSG_HIDEOSD  WM_APP + 103
#define MSG_ACTIVATE WM_APP + 104
<|next_version|>
#pragma once

#define CLASS_3RVX L"3RVXv3"
#define CLASS_3RVX_SETTINGS L"3RVX-Settings"

static const UINT WM_3RVX_CONTROL
    = RegisterWindowMessage(L"WM_3RVX_CONTROL");
static const UINT WM_3RVX_SETTINGSCTRL
    = RegisterWindowMessage(L"WM_3RVX_SETTINGSCTRL");

#define MSG_LOAD     WM_APP + 100
#define MSG_SETTINGS WM_APP + 101
#define MSG_EXIT     WM_APP + 102
#define MSG_HIDEOSD  WM_APP + 103
#define MSG_ACTIVATE WM_APP + 104


Disable copy and assign on ScriptObject

Disable copy and assign on ScriptObject

--- scriptobject.h
+++ scriptobject.h
@@ -3,6 +3,7 @@

 #include "browser.h"
 #include "npapi-headers/npruntime.h"
+#include "util.h"

 class EmacsInstance;

@@ -35,6 +36,8 @@
     EmacsInstance* emacsInstance();

     NPP npp_;
+
+    DISALLOW_COPY_AND_ASSIGN(ScriptObject);
 };

 #endif  // INCLUDED_SCRIPT_OBJECT_H_

<|original_code|>
#ifndef INCLUDED_SCRIPT_OBJECT_H_
#define INCLUDED_SCRIPT_OBJECT_H_

#include "browser.h"
#include "npapi-headers/npruntime.h"

class EmacsInstance;

class ScriptObject : public NPObject {
public:
    static ScriptObject* create(NPP npp);

    void invalidate();
    bool hasMethod(NPIdentifier name);
    bool invoke(NPIdentifier name,
		const NPVariant *args,
		uint32_t argCount,
		NPVariant *result);
    bool enumerate(NPIdentifier **identifiers, uint32_t *identifierCount);

    static NPObject* allocateThunk(NPP npp, NPClass *aClass);
    static void deallocateThunk(NPObject *npobj);
    static void invalidateThunk(NPObject *npobj);
    static bool hasMethodThunk(NPObject *npobj, NPIdentifier name);
    static bool invokeThunk(NPObject *npobj, NPIdentifier name,
			    const NPVariant *args, uint32_t argCount,
			    NPVariant *result);
    static bool enumerateThunk(NPObject *npobj, NPIdentifier **identifiers,
			       uint32_t *identifierCount);

private:
    ScriptObject(NPP npp);
    ~ScriptObject();

    EmacsInstance* emacsInstance();

    NPP npp_;
};

#endif  // INCLUDED_SCRIPT_OBJECT_H_

<|edits_diff|>
--- scriptobject.h
+++ scriptobject.h
@@ -3,6 +3,7 @@

 #include "browser.h"
 #include "npapi-headers/npruntime.h"
+#include "util.h"

 class EmacsInstance;

<|current_version|>
#ifndef INCLUDED_SCRIPT_OBJECT_H_
#define INCLUDED_SCRIPT_OBJECT_H_

#include "browser.h"
#include "npapi-headers/npruntime.h"
#include "util.h"

class EmacsInstance;

class ScriptObject : public NPObject {
public:
    static ScriptObject* create(NPP npp);

    void invalidate();
    bool hasMethod(NPIdentifier name);
    bool invoke(NPIdentifier name,
		const NPVariant *args,
		uint32_t argCount,
		NPVariant *result);
    bool enumerate(NPIdentifier **identifiers, uint32_t *identifierCount);

    static NPObject* allocateThunk(NPP npp, NPClass *aClass);
    static void deallocateThunk(NPObject *npobj);
    static void invalidateThunk(NPObject *npobj);
    static bool hasMethodThunk(NPObject *npobj, NPIdentifier name);
    static bool invokeThunk(NPObject *npobj, NPIdentifier name,
			    const NPVariant *args, uint32_t argCount,
			    NPVariant *result);
    static bool enumerateThunk(NPObject *npobj, NPIdentifier **identifiers,
			       uint32_t *identifierCount);

private:
    ScriptObject(NPP npp);
    ~ScriptObject();

    EmacsInstance* emacsInstance();

    NPP npp_;
};

#endif  // INCLUDED_SCRIPT_OBJECT_H_

<|next_version|>
#ifndef INCLUDED_SCRIPT_OBJECT_H_
#define INCLUDED_SCRIPT_OBJECT_H_

#include "browser.h"
#include "npapi-headers/npruntime.h"
#include "util.h"

class EmacsInstance;

class ScriptObject : public NPObject {
public:
    static ScriptObject* create(NPP npp);

    void invalidate();
    bool hasMethod(NPIdentifier name);
    bool invoke(NPIdentifier name,
		const NPVariant *args,
		uint32_t argCount,
		NPVariant *result);
    bool enumerate(NPIdentifier **identifiers, uint32_t *identifierCount);

    static NPObject* allocateThunk(NPP npp, NPClass *aClass);
    static void deallocateThunk(NPObject *npobj);
    static void invalidateThunk(NPObject *npobj);
    static bool hasMethodThunk(NPObject *npobj, NPIdentifier name);
    static bool invokeThunk(NPObject *npobj, NPIdentifier name,
			    const NPVariant *args, uint32_t argCount,
			    NPVariant *result);
    static bool enumerateThunk(NPObject *npobj, NPIdentifier **identifiers,
			       uint32_t *identifierCount);

private:
    ScriptObject(NPP npp);
    ~ScriptObject();

    EmacsInstance* emacsInstance();

    NPP npp_;

    DISALLOW_COPY_AND_ASSIGN(ScriptObject);
};

#endif  // INCLUDED_SCRIPT_OBJECT_H_


Update RingOpenGL 1.1 - Add Constant (Source Code) : GL_NONE

--- extensions/ringopengl/opengl11/ring_opengl11.c
+++ extensions/ringopengl/opengl11/ring_opengl11.c
@@ -25,9 +25,15 @@
 	RING_API_RETNUMBER(GL_LOGIC_OP);
 }

+RING_FUNC(ring_get_gl_none)
+{
+	RING_API_RETNUMBER(GL_NONE);
+}
+
 RING_API void ringlib_init(RingState *pRingState)
 {
 	ring_vm_funcregister("get_gl_zero",ring_get_gl_zero);
 	ring_vm_funcregister("get_gl_false",ring_get_gl_false);
 	ring_vm_funcregister("get_gl_logic_op",ring_get_gl_logic_op);
+	ring_vm_funcregister("get_gl_none",ring_get_gl_none);
 }

<|original_code|>
#include "ring.h"

/*
	OpenGL 1.1 Extension
	Copyright (c) 2017 Mahmoud Fayed <msfclipper@yahoo.com>
*/

#include <GL/glew.h>
#include <GL/glut.h>

RING_FUNC(ring_get_gl_zero)
{
	RING_API_RETNUMBER(GL_ZERO);
}

RING_FUNC(ring_get_gl_false)
{
	RING_API_RETNUMBER(GL_FALSE);
}

RING_FUNC(ring_get_gl_logic_op)
{
	RING_API_RETNUMBER(GL_LOGIC_OP);
}

RING_API void ringlib_init(RingState *pRingState)
{
	ring_vm_funcregister("get_gl_zero",ring_get_gl_zero);
	ring_vm_funcregister("get_gl_false",ring_get_gl_false);
	ring_vm_funcregister("get_gl_logic_op",ring_get_gl_logic_op);
}

<|edits_diff|>
--- extensions/ringopengl/opengl11/ring_opengl11.c
+++ extensions/ringopengl/opengl11/ring_opengl11.c
@@ -25,6 +25,11 @@
 	RING_API_RETNUMBER(GL_LOGIC_OP);
 }

+RING_FUNC(ring_get_gl_none)
+{
+	RING_API_RETNUMBER(GL_NONE);
+}
+
 RING_API void ringlib_init(RingState *pRingState)
 {
 	ring_vm_funcregister("get_gl_zero",ring_get_gl_zero);
<|current_version|>
#include "ring.h"

/*
	OpenGL 1.1 Extension
	Copyright (c) 2017 Mahmoud Fayed <msfclipper@yahoo.com>
*/

#include <GL/glew.h>
#include <GL/glut.h>

RING_FUNC(ring_get_gl_zero)
{
	RING_API_RETNUMBER(GL_ZERO);
}

RING_FUNC(ring_get_gl_false)
{
	RING_API_RETNUMBER(GL_FALSE);
}

RING_FUNC(ring_get_gl_logic_op)
{
	RING_API_RETNUMBER(GL_LOGIC_OP);
}

RING_FUNC(ring_get_gl_none)
{
	RING_API_RETNUMBER(GL_NONE);
}

RING_API void ringlib_init(RingState *pRingState)
{
	ring_vm_funcregister("get_gl_zero",ring_get_gl_zero);
	ring_vm_funcregister("get_gl_false",ring_get_gl_false);
	ring_vm_funcregister("get_gl_logic_op",ring_get_gl_logic_op);
}

<|next_version|>
#include "ring.h"

/*
	OpenGL 1.1 Extension
	Copyright (c) 2017 Mahmoud Fayed <msfclipper@yahoo.com>
*/

#include <GL/glew.h>
#include <GL/glut.h>

RING_FUNC(ring_get_gl_zero)
{
	RING_API_RETNUMBER(GL_ZERO);
}

RING_FUNC(ring_get_gl_false)
{
	RING_API_RETNUMBER(GL_FALSE);
}

RING_FUNC(ring_get_gl_logic_op)
{
	RING_API_RETNUMBER(GL_LOGIC_OP);
}

RING_FUNC(ring_get_gl_none)
{
	RING_API_RETNUMBER(GL_NONE);
}

RING_API void ringlib_init(RingState *pRingState)
{
	ring_vm_funcregister("get_gl_zero",ring_get_gl_zero);
	ring_vm_funcregister("get_gl_false",ring_get_gl_false);
	ring_vm_funcregister("get_gl_logic_op",ring_get_gl_logic_op);
	ring_vm_funcregister("get_gl_none",ring_get_gl_none);
}


Make TRACE depend on DEBUG.

Make TRACE depend on DEBUG.

--- trace.h
+++ trace.h
@@ -3,7 +3,11 @@
 #include <stdio.h>
 #include <errno.h>

+#ifdef DEBUG
 #define TRACE ERROR
+#else
+#define TRACE(fmt,arg...) ((void) 0)
+#endif

 #define ERROR(fmt,arg...) \
   fprintf(stderr, "%s: "fmt, program_invocation_short_name, ##arg)

<|original_code|>
#ifndef _TRACE_H_
#define _TRACE_H_
#include <stdio.h>
#include <errno.h>

#define TRACE ERROR

#define ERROR(fmt,arg...) \
  fprintf(stderr, "%s: "fmt, program_invocation_short_name, ##arg)

#define FATAL(fmt,arg...) do { \
    ERROR(fmt, ##arg);         \
    exit(1);                   \
  } while (0)

#endif

<|edits_diff|>
--- trace.h
+++ trace.h
@@ -3,6 +3,7 @@
 #include <stdio.h>
 #include <errno.h>

+#ifdef DEBUG
 #define TRACE ERROR

 #define ERROR(fmt,arg...) \
<|current_version|>
#ifndef _TRACE_H_
#define _TRACE_H_
#include <stdio.h>
#include <errno.h>

#ifdef DEBUG
#define TRACE ERROR

#define ERROR(fmt,arg...) \
  fprintf(stderr, "%s: "fmt, program_invocation_short_name, ##arg)

#define FATAL(fmt,arg...) do { \
    ERROR(fmt, ##arg);         \
    exit(1);                   \
  } while (0)

#endif

<|next_version|>
#ifndef _TRACE_H_
#define _TRACE_H_
#include <stdio.h>
#include <errno.h>

#ifdef DEBUG
#define TRACE ERROR
#else
#define TRACE(fmt,arg...) ((void) 0)
#endif

#define ERROR(fmt,arg...) \
  fprintf(stderr, "%s: "fmt, program_invocation_short_name, ##arg)

#define FATAL(fmt,arg...) do { \
    ERROR(fmt, ##arg);         \
    exit(1);                   \
  } while (0)

#endif


Test long size and timeval to long conversion

--- tests/testTime.c
+++ tests/testTime.c
@@ -4,6 +4,7 @@
 #include <sys/time.h>
 #include <time.h>
 #include <unistd.h>
+#include "../../bluez-5.28/lib/bluetooth.h"

 int main(int argc, char **argv) {
     struct timeval  tv;
@@ -17,4 +18,8 @@
     size_t length = strftime(timestr, 128, "%F %T", tm);
     snprintf(timestr+length, 128-length, ".%ld", tv.tv_usec/1000);
     printf("Time string: %s\n", timestr);
+
+    long ms = htobl(tv.tv_sec)*1000 + htobl(tv.tv_usec)/1000;
+    int64_t ms64 = htobl(tv.tv_sec)*1000 + htobl(tv.tv_usec)/1000;
+    printf("Sizeof(long) = %d, ms=%ld, ms64=%ld\n", sizeof(ms), ms, ms64);
 }

<|original_code|>
#include <stdio.h>
#include <stdint.h>
#include <stdlib.h>
#include <sys/time.h>
#include <time.h>
#include <unistd.h>

int main(int argc, char **argv) {
    struct timeval  tv;
    struct timezone tz;
    struct tm      *tm;

    gettimeofday(&tv, &tz);
    tm = localtime(&tv.tv_sec);

    char timestr[128];
    size_t length = strftime(timestr, 128, "%F %T", tm);
    snprintf(timestr+length, 128-length, ".%ld", tv.tv_usec/1000);
    printf("Time string: %s\n", timestr);
}
<|edits_diff|>
--- tests/testTime.c
+++ tests/testTime.c
@@ -4,6 +4,7 @@
 #include <sys/time.h>
 #include <time.h>
 #include <unistd.h>
+#include "../../bluez-5.28/lib/bluetooth.h"

 int main(int argc, char **argv) {
     struct timeval  tv;
<|current_version|>
#include <stdio.h>
#include <stdint.h>
#include <stdlib.h>
#include <sys/time.h>
#include <time.h>
#include <unistd.h>
#include "../../bluez-5.28/lib/bluetooth.h"

int main(int argc, char **argv) {
    struct timeval  tv;
    struct timezone tz;
    struct tm      *tm;

    gettimeofday(&tv, &tz);
    tm = localtime(&tv.tv_sec);

    char timestr[128];
    size_t length = strftime(timestr, 128, "%F %T", tm);
    snprintf(timestr+length, 128-length, ".%ld", tv.tv_usec/1000);
    printf("Time string: %s\n", timestr);
}
<|next_version|>
#include <stdio.h>
#include <stdint.h>
#include <stdlib.h>
#include <sys/time.h>
#include <time.h>
#include <unistd.h>
#include "../../bluez-5.28/lib/bluetooth.h"

int main(int argc, char **argv) {
    struct timeval  tv;
    struct timezone tz;
    struct tm      *tm;

    gettimeofday(&tv, &tz);
    tm = localtime(&tv.tv_sec);

    char timestr[128];
    size_t length = strftime(timestr, 128, "%F %T", tm);
    snprintf(timestr+length, 128-length, ".%ld", tv.tv_usec/1000);
    printf("Time string: %s\n", timestr);

    long ms = htobl(tv.tv_sec)*1000 + htobl(tv.tv_usec)/1000;
    int64_t ms64 = htobl(tv.tv_sec)*1000 + htobl(tv.tv_usec)/1000;
    printf("Sizeof(long) = %d, ms=%ld, ms64=%ld\n", sizeof(ms), ms, ms64);
}


Add NaN/Inf check for low-pass filter.

Add NaN/Inf check for low-pass filter.

--- include/franka/lowpass_filter.h
+++ include/franka/lowpass_filter.h
@@ -25,10 +25,14 @@
  * @param[in] y Current value of the signal to be filtered
  * @param[in] y_last Value of the signal to be filtered in the previous time step
  * @param[in] cutoff_frequency Cutoff frequency of the low-pass filter
+ * @throw std::invalid_argument if y is infinite or NaN.
  *
  * @return Filtered value.
  */
 inline double lowpassFilter(double sample_time, double y, double y_last, double cutoff_frequency) {
+  if (!std::isfinite(y)){
+    throw std::invalid_argument("Commanding value is infinite or NaN.");
+  }
   double gain = sample_time / (sample_time + (1.0 / (2.0 * M_PI * cutoff_frequency)));
   return gain * y + (1 - gain) * y_last;
 }

<|original_code|>
// Copyright (c) 2017 Franka Emika GmbH
// Use of this source code is governed by the Apache-2.0 license, see LICENSE
#pragma once

#include <cmath>

/**
 * @file lowpass_filter.h
 * Contains functions for filtering signals with a low-pass filter.
 */

namespace franka {
/**
 * Maximum cutoff frequency
 */
constexpr double kMaxCutoffFrequency = 1000.0;
/**
 * Default cutoff frequency
 */
constexpr double kDefaultCutoffFrequency = 100.0;
/**
 * Applies a first-order low-pass filter
 *
 * @param[in] sample_time Sample time constant
 * @param[in] y Current value of the signal to be filtered
 * @param[in] y_last Value of the signal to be filtered in the previous time step
 * @param[in] cutoff_frequency Cutoff frequency of the low-pass filter
 *
 * @return Filtered value.
 */
inline double lowpassFilter(double sample_time, double y, double y_last, double cutoff_frequency) {
  double gain = sample_time / (sample_time + (1.0 / (2.0 * M_PI * cutoff_frequency)));
  return gain * y + (1 - gain) * y_last;
}

}  // namespace franka

<|edits_diff|>
--- include/franka/lowpass_filter.h
+++ include/franka/lowpass_filter.h
@@ -25,6 +25,7 @@
  * @param[in] y Current value of the signal to be filtered
  * @param[in] y_last Value of the signal to be filtered in the previous time step
  * @param[in] cutoff_frequency Cutoff frequency of the low-pass filter
+ * @throw std::invalid_argument if y is infinite or NaN.
  *
  * @return Filtered value.
  */
<|current_version|>
// Copyright (c) 2017 Franka Emika GmbH
// Use of this source code is governed by the Apache-2.0 license, see LICENSE
#pragma once

#include <cmath>

/**
 * @file lowpass_filter.h
 * Contains functions for filtering signals with a low-pass filter.
 */

namespace franka {
/**
 * Maximum cutoff frequency
 */
constexpr double kMaxCutoffFrequency = 1000.0;
/**
 * Default cutoff frequency
 */
constexpr double kDefaultCutoffFrequency = 100.0;
/**
 * Applies a first-order low-pass filter
 *
 * @param[in] sample_time Sample time constant
 * @param[in] y Current value of the signal to be filtered
 * @param[in] y_last Value of the signal to be filtered in the previous time step
 * @param[in] cutoff_frequency Cutoff frequency of the low-pass filter
 * @throw std::invalid_argument if y is infinite or NaN.
 *
 * @return Filtered value.
 */
inline double lowpassFilter(double sample_time, double y, double y_last, double cutoff_frequency) {
  double gain = sample_time / (sample_time + (1.0 / (2.0 * M_PI * cutoff_frequency)));
  return gain * y + (1 - gain) * y_last;
}

}  // namespace franka

<|next_version|>
// Copyright (c) 2017 Franka Emika GmbH
// Use of this source code is governed by the Apache-2.0 license, see LICENSE
#pragma once

#include <cmath>

/**
 * @file lowpass_filter.h
 * Contains functions for filtering signals with a low-pass filter.
 */

namespace franka {
/**
 * Maximum cutoff frequency
 */
constexpr double kMaxCutoffFrequency = 1000.0;
/**
 * Default cutoff frequency
 */
constexpr double kDefaultCutoffFrequency = 100.0;
/**
 * Applies a first-order low-pass filter
 *
 * @param[in] sample_time Sample time constant
 * @param[in] y Current value of the signal to be filtered
 * @param[in] y_last Value of the signal to be filtered in the previous time step
 * @param[in] cutoff_frequency Cutoff frequency of the low-pass filter
 * @throw std::invalid_argument if y is infinite or NaN.
 *
 * @return Filtered value.
 */
inline double lowpassFilter(double sample_time, double y, double y_last, double cutoff_frequency) {
  if (!std::isfinite(y)){
    throw std::invalid_argument("Commanding value is infinite or NaN.");
  }
  double gain = sample_time / (sample_time + (1.0 / (2.0 * M_PI * cutoff_frequency)));
  return gain * y + (1 - gain) * y_last;
}

}  // namespace franka


Add interface for a hash table implementation required for the next stages of the spell checker implementation.

--- spellutil.h
+++ spellutil.h
@@ -6,8 +6,19 @@
     void *data;
 } spell_list_node;

+typedef struct spell_hashtable {
+    char *key;
+    spell_list_node *val;
+} spell_hashtable;
+
 spell_list_node *spell_list_init(void *);
 int spell_list_add(spell_list_node **, void *);
+void spell_list_remove(spell_list_node **, spell_list_node *);
 void spell_list_free(spell_list_node **, void (*) (void *));
+spell_hashtable *spell_hashtable_init(size_t);
+void spell_hashtable_add(spell_hashtable *, char *, void *);
+void spell_hashtable_remove(spell_hashtable *, char *);
+void spell_hashtable_get(spell_hashtable *, char *);
+void spell_hashtable_free(spell_hashtable *, void (*) (void *));

 #endif

<|original_code|>
#ifndef SPELLUTIL_H
#define SPELLUTIL_H

typedef struct spell_list_node {
    struct spell_list_node *next;
    void *data;
} spell_list_node;

spell_list_node *spell_list_init(void *);
int spell_list_add(spell_list_node **, void *);
void spell_list_free(spell_list_node **, void (*) (void *));

#endif

<|edits_diff|>
--- spellutil.h
+++ spellutil.h
@@ -6,8 +6,14 @@
     void *data;
 } spell_list_node;

+typedef struct spell_hashtable {
+    char *key;
+    spell_list_node *val;
+} spell_hashtable;
+
 spell_list_node *spell_list_init(void *);
 int spell_list_add(spell_list_node **, void *);
+void spell_list_remove(spell_list_node **, spell_list_node *);
 void spell_list_free(spell_list_node **, void (*) (void *));

 #endif
<|current_version|>
#ifndef SPELLUTIL_H
#define SPELLUTIL_H

typedef struct spell_list_node {
    struct spell_list_node *next;
    void *data;
} spell_list_node;

typedef struct spell_hashtable {
    char *key;
    spell_list_node *val;
} spell_hashtable;

spell_list_node *spell_list_init(void *);
int spell_list_add(spell_list_node **, void *);
void spell_list_remove(spell_list_node **, spell_list_node *);
void spell_list_free(spell_list_node **, void (*) (void *));

#endif

<|next_version|>
#ifndef SPELLUTIL_H
#define SPELLUTIL_H

typedef struct spell_list_node {
    struct spell_list_node *next;
    void *data;
} spell_list_node;

typedef struct spell_hashtable {
    char *key;
    spell_list_node *val;
} spell_hashtable;

spell_list_node *spell_list_init(void *);
int spell_list_add(spell_list_node **, void *);
void spell_list_remove(spell_list_node **, spell_list_node *);
void spell_list_free(spell_list_node **, void (*) (void *));
spell_hashtable *spell_hashtable_init(size_t);
void spell_hashtable_add(spell_hashtable *, char *, void *);
void spell_hashtable_remove(spell_hashtable *, char *);
void spell_hashtable_get(spell_hashtable *, char *);
void spell_hashtable_free(spell_hashtable *, void (*) (void *));

#endif


Add the default source concept to NoteRepository

--- src/domain/noterepository.h
+++ src/domain/noterepository.h
@@ -24,6 +24,7 @@
 #ifndef DOMAIN_NOTEREPOSITORY_H
 #define DOMAIN_NOTEREPOSITORY_H

+#include "datasource.h"
 #include "note.h"

 class KJob;
@@ -36,6 +37,9 @@
     NoteRepository();
     virtual ~NoteRepository();

+    virtual bool isDefaultSource(DataSource::Ptr source) const = 0;
+    virtual void setDefaultSource(DataSource::Ptr source) = 0;
+
     virtual KJob *save(Note::Ptr note) = 0;
     virtual KJob *remove(Note::Ptr note) = 0;
 };

<|original_code|>
/* This file is part of Zanshin

   Copyright 2014 Kevin Ottens <ervin@kde.org>

   This program is free software; you can redistribute it and/or
   modify it under the terms of the GNU General Public License as
   published by the Free Software Foundation; either version 2 of
   the License or (at your option) version 3 or any later version
   accepted by the membership of KDE e.V. (or its successor approved
   by the membership of KDE e.V.), which shall act as a proxy
   defined in Section 14 of version 3 of the license.

   This program is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
   GNU General Public License for more details.

   You should have received a copy of the GNU General Public License
   along with this program; if not, write to the Free Software
   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
   USA.
*/

#ifndef DOMAIN_NOTEREPOSITORY_H
#define DOMAIN_NOTEREPOSITORY_H

#include "note.h"

class KJob;

namespace Domain {

class NoteRepository
{
public:
    NoteRepository();
    virtual ~NoteRepository();

    virtual KJob *save(Note::Ptr note) = 0;
    virtual KJob *remove(Note::Ptr note) = 0;
};

}

#endif // DOMAIN_NOTEREPOSITORY_H

<|edits_diff|>
--- src/domain/noterepository.h
+++ src/domain/noterepository.h
@@ -24,6 +24,7 @@
 #ifndef DOMAIN_NOTEREPOSITORY_H
 #define DOMAIN_NOTEREPOSITORY_H

+#include "datasource.h"
 #include "note.h"

 class KJob;
<|current_version|>
/* This file is part of Zanshin

   Copyright 2014 Kevin Ottens <ervin@kde.org>

   This program is free software; you can redistribute it and/or
   modify it under the terms of the GNU General Public License as
   published by the Free Software Foundation; either version 2 of
   the License or (at your option) version 3 or any later version
   accepted by the membership of KDE e.V. (or its successor approved
   by the membership of KDE e.V.), which shall act as a proxy
   defined in Section 14 of version 3 of the license.

   This program is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
   GNU General Public License for more details.

   You should have received a copy of the GNU General Public License
   along with this program; if not, write to the Free Software
   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
   USA.
*/

#ifndef DOMAIN_NOTEREPOSITORY_H
#define DOMAIN_NOTEREPOSITORY_H

#include "datasource.h"
#include "note.h"

class KJob;

namespace Domain {

class NoteRepository
{
public:
    NoteRepository();
    virtual ~NoteRepository();

    virtual KJob *save(Note::Ptr note) = 0;
    virtual KJob *remove(Note::Ptr note) = 0;
};

}

#endif // DOMAIN_NOTEREPOSITORY_H

<|next_version|>
/* This file is part of Zanshin

   Copyright 2014 Kevin Ottens <ervin@kde.org>

   This program is free software; you can redistribute it and/or
   modify it under the terms of the GNU General Public License as
   published by the Free Software Foundation; either version 2 of
   the License or (at your option) version 3 or any later version
   accepted by the membership of KDE e.V. (or its successor approved
   by the membership of KDE e.V.), which shall act as a proxy
   defined in Section 14 of version 3 of the license.

   This program is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
   GNU General Public License for more details.

   You should have received a copy of the GNU General Public License
   along with this program; if not, write to the Free Software
   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
   USA.
*/

#ifndef DOMAIN_NOTEREPOSITORY_H
#define DOMAIN_NOTEREPOSITORY_H

#include "datasource.h"
#include "note.h"

class KJob;

namespace Domain {

class NoteRepository
{
public:
    NoteRepository();
    virtual ~NoteRepository();

    virtual bool isDefaultSource(DataSource::Ptr source) const = 0;
    virtual void setDefaultSource(DataSource::Ptr source) = 0;

    virtual KJob *save(Note::Ptr note) = 0;
    virtual KJob *remove(Note::Ptr note) = 0;
};

}

#endif // DOMAIN_NOTEREPOSITORY_H


Set database encoding to UTF8.

Set database encoding to UTF8.

Fixes error when parsing this statement:

SELECT U&'\0441\043B\043E\043D'

The error is:

Unicode escape values cannot be used for code point values above
007F when the server encoding is not UTF8.

Perhapes there could be an API to set the encoding used by the
parser. But I think it makes sense to use UTF8 by default.

--- pg_query.c
+++ pg_query.c
@@ -1,9 +1,11 @@
 #include "pg_query.h"
 #include "pg_query_internal.h"
+#include <mb/pg_wchar.h>

 const char* progname = "pg_query";

 void pg_query_init(void)
 {
 	MemoryContextInit();
+	SetDatabaseEncoding(PG_UTF8);
 }

<|original_code|>
#include "pg_query.h"
#include "pg_query_internal.h"

const char* progname = "pg_query";

void pg_query_init(void)
{
	MemoryContextInit();
}

<|edits_diff|>
--- pg_query.c
+++ pg_query.c
@@ -1,5 +1,6 @@
 #include "pg_query.h"
 #include "pg_query_internal.h"
+#include <mb/pg_wchar.h>

 const char* progname = "pg_query";

<|current_version|>
#include "pg_query.h"
#include "pg_query_internal.h"
#include <mb/pg_wchar.h>

const char* progname = "pg_query";

void pg_query_init(void)
{
	MemoryContextInit();
}

<|next_version|>
#include "pg_query.h"
#include "pg_query_internal.h"
#include <mb/pg_wchar.h>

const char* progname = "pg_query";

void pg_query_init(void)
{
	MemoryContextInit();
	SetDatabaseEncoding(PG_UTF8);
}


Add include guard to fix wincon compile.

--- src/3rdparty/win32_src/pdcurses/wincon/pdcwin.h
+++ src/3rdparty/win32_src/pdcurses/wincon/pdcwin.h
@@ -1,4 +1,7 @@
 /* PDCurses */
+
+#ifndef __PDC_WIN_H__
+#define __PDC_WIN_H__

 #if defined(_MSC_VER) && !defined(_CRT_SECURE_NO_DEPRECATE)
 # define _CRT_SECURE_NO_DEPRECATE 1   /* kill nonsense warnings */
@@ -29,3 +32,5 @@
 extern bool pdc_conemu, pdc_wt, pdc_ansi;

 extern void PDC_blink_text(void);
+
+#endif

<|original_code|>
/* PDCurses */

#if defined(_MSC_VER) && !defined(_CRT_SECURE_NO_DEPRECATE)
# define _CRT_SECURE_NO_DEPRECATE 1   /* kill nonsense warnings */
#endif

#if defined(_MSC_VER) && !defined(_CRT_SECURE_NO_DEPRECATE)
# define _CRT_SECURE_NO_DEPRECATE 1   /* kill nonsense warnings */
#endif

#if defined(PDC_WIDE) && !defined(UNICODE)
# define UNICODE
#endif

#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#undef MOUSE_MOVED
#include <curspriv.h>

typedef struct {short r, g, b; bool mapped;} PDCCOLOR;

extern PDCCOLOR pdc_color[PDC_MAXCOL];

extern HANDLE pdc_con_out, pdc_con_in;
extern DWORD pdc_quick_edit;
extern DWORD pdc_last_blink;
extern short pdc_curstoreal[16], pdc_curstoansi[16];
extern short pdc_oldf, pdc_oldb, pdc_oldu;
extern bool pdc_conemu, pdc_wt, pdc_ansi;

extern void PDC_blink_text(void);

<|edits_diff|>
--- src/3rdparty/win32_src/pdcurses/wincon/pdcwin.h
+++ src/3rdparty/win32_src/pdcurses/wincon/pdcwin.h
@@ -1,4 +1,7 @@
 /* PDCurses */
+
+#ifndef __PDC_WIN_H__
+#define __PDC_WIN_H__

 #if defined(_MSC_VER) && !defined(_CRT_SECURE_NO_DEPRECATE)
 # define _CRT_SECURE_NO_DEPRECATE 1   /* kill nonsense warnings */
<|current_version|>
/* PDCurses */

#ifndef __PDC_WIN_H__
#define __PDC_WIN_H__

#if defined(_MSC_VER) && !defined(_CRT_SECURE_NO_DEPRECATE)
# define _CRT_SECURE_NO_DEPRECATE 1   /* kill nonsense warnings */
#endif

#if defined(_MSC_VER) && !defined(_CRT_SECURE_NO_DEPRECATE)
# define _CRT_SECURE_NO_DEPRECATE 1   /* kill nonsense warnings */
#endif

#if defined(PDC_WIDE) && !defined(UNICODE)
# define UNICODE
#endif

#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#undef MOUSE_MOVED
#include <curspriv.h>

typedef struct {short r, g, b; bool mapped;} PDCCOLOR;

extern PDCCOLOR pdc_color[PDC_MAXCOL];

extern HANDLE pdc_con_out, pdc_con_in;
extern DWORD pdc_quick_edit;
extern DWORD pdc_last_blink;
extern short pdc_curstoreal[16], pdc_curstoansi[16];
extern short pdc_oldf, pdc_oldb, pdc_oldu;
extern bool pdc_conemu, pdc_wt, pdc_ansi;

extern void PDC_blink_text(void);

<|next_version|>
/* PDCurses */

#ifndef __PDC_WIN_H__
#define __PDC_WIN_H__

#if defined(_MSC_VER) && !defined(_CRT_SECURE_NO_DEPRECATE)
# define _CRT_SECURE_NO_DEPRECATE 1   /* kill nonsense warnings */
#endif

#if defined(_MSC_VER) && !defined(_CRT_SECURE_NO_DEPRECATE)
# define _CRT_SECURE_NO_DEPRECATE 1   /* kill nonsense warnings */
#endif

#if defined(PDC_WIDE) && !defined(UNICODE)
# define UNICODE
#endif

#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#undef MOUSE_MOVED
#include <curspriv.h>

typedef struct {short r, g, b; bool mapped;} PDCCOLOR;

extern PDCCOLOR pdc_color[PDC_MAXCOL];

extern HANDLE pdc_con_out, pdc_con_in;
extern DWORD pdc_quick_edit;
extern DWORD pdc_last_blink;
extern short pdc_curstoreal[16], pdc_curstoansi[16];
extern short pdc_oldf, pdc_oldb, pdc_oldu;
extern bool pdc_conemu, pdc_wt, pdc_ansi;

extern void PDC_blink_text(void);

#endif


Fix jade version of class_loader not containing class_loader.hpp

--- csapex_ros/src/ros_boot.h
+++ csapex_ros/src/ros_boot.h
@@ -11,7 +11,11 @@
 /// SYSTEM
 // clang-format off
 #include <csapex/utility/suppress_warnings_start.h>
+#if CLASS_LOADER_USES_HPP
 #include <pluginlib/class_loader.hpp>
+#else
+#include <pluginlib/class_loader.h>
+#endif
 #include <csapex/utility/suppress_warnings_end.h>
 // clang-format on

<|original_code|>
#ifndef ROS_BOOT_H
#define ROS_BOOT_H

/// PROJECT
#include <csapex/core/bootstrap_plugin.h>
#include <csapex/core/core_fwd.h>
#include <csapex/model/model_fwd.h>
#include <csapex/msg/msg_fwd.h>
#include <csapex/view/view_fwd.h>

/// SYSTEM
// clang-format off
#include <csapex/utility/suppress_warnings_start.h>
#include <pluginlib/class_loader.hpp>
#include <csapex/utility/suppress_warnings_end.h>
// clang-format on

namespace csapex
{
class RosBoot : public BootstrapPlugin
{
public:
    RosBoot();
    void boot(csapex::PluginLocator* locator);

private:
    std::vector<std::string> valid_plugin_xml_files_;

    pluginlib::ClassLoader<CorePlugin> loader_core_;
    pluginlib::ClassLoader<MessageProvider> loader_msg_;
    pluginlib::ClassLoader<MessageRenderer> loader_msg_renderer_;
    pluginlib::ClassLoader<Node> loader_node_;
    pluginlib::ClassLoader<NodeAdapterBuilder> loader_node_adapter_;
    pluginlib::ClassLoader<ParameterAdapterBuilder> loader_param_adapter_;
    pluginlib::ClassLoader<DragIOHandler> loader_drag_io_;
};

}  // namespace csapex
#endif  // ROS_BOOT_H

<|edits_diff|>
--- csapex_ros/src/ros_boot.h
+++ csapex_ros/src/ros_boot.h
@@ -11,6 +11,7 @@
 /// SYSTEM
 // clang-format off
 #include <csapex/utility/suppress_warnings_start.h>
+#if CLASS_LOADER_USES_HPP
 #include <pluginlib/class_loader.hpp>
 #include <csapex/utility/suppress_warnings_end.h>
 // clang-format on
<|current_version|>
#ifndef ROS_BOOT_H
#define ROS_BOOT_H

/// PROJECT
#include <csapex/core/bootstrap_plugin.h>
#include <csapex/core/core_fwd.h>
#include <csapex/model/model_fwd.h>
#include <csapex/msg/msg_fwd.h>
#include <csapex/view/view_fwd.h>

/// SYSTEM
// clang-format off
#include <csapex/utility/suppress_warnings_start.h>
#if CLASS_LOADER_USES_HPP
#include <pluginlib/class_loader.hpp>
#include <csapex/utility/suppress_warnings_end.h>
// clang-format on

namespace csapex
{
class RosBoot : public BootstrapPlugin
{
public:
    RosBoot();
    void boot(csapex::PluginLocator* locator);

private:
    std::vector<std::string> valid_plugin_xml_files_;

    pluginlib::ClassLoader<CorePlugin> loader_core_;
    pluginlib::ClassLoader<MessageProvider> loader_msg_;
    pluginlib::ClassLoader<MessageRenderer> loader_msg_renderer_;
    pluginlib::ClassLoader<Node> loader_node_;
    pluginlib::ClassLoader<NodeAdapterBuilder> loader_node_adapter_;
    pluginlib::ClassLoader<ParameterAdapterBuilder> loader_param_adapter_;
    pluginlib::ClassLoader<DragIOHandler> loader_drag_io_;
};

}  // namespace csapex
#endif  // ROS_BOOT_H

<|next_version|>
#ifndef ROS_BOOT_H
#define ROS_BOOT_H

/// PROJECT
#include <csapex/core/bootstrap_plugin.h>
#include <csapex/core/core_fwd.h>
#include <csapex/model/model_fwd.h>
#include <csapex/msg/msg_fwd.h>
#include <csapex/view/view_fwd.h>

/// SYSTEM
// clang-format off
#include <csapex/utility/suppress_warnings_start.h>
#if CLASS_LOADER_USES_HPP
#include <pluginlib/class_loader.hpp>
#else
#include <pluginlib/class_loader.h>
#endif
#include <csapex/utility/suppress_warnings_end.h>
// clang-format on

namespace csapex
{
class RosBoot : public BootstrapPlugin
{
public:
    RosBoot();
    void boot(csapex::PluginLocator* locator);

private:
    std::vector<std::string> valid_plugin_xml_files_;

    pluginlib::ClassLoader<CorePlugin> loader_core_;
    pluginlib::ClassLoader<MessageProvider> loader_msg_;
    pluginlib::ClassLoader<MessageRenderer> loader_msg_renderer_;
    pluginlib::ClassLoader<Node> loader_node_;
    pluginlib::ClassLoader<NodeAdapterBuilder> loader_node_adapter_;
    pluginlib::ClassLoader<ParameterAdapterBuilder> loader_param_adapter_;
    pluginlib::ClassLoader<DragIOHandler> loader_drag_io_;
};

}  // namespace csapex
#endif  // ROS_BOOT_H


Mark string functions unused, in case the header is included in files that only use one of them.

--- string_hash.h
+++ string_hash.h
@@ -4,6 +4,7 @@
 /**
  * Efficient string hash function.
  */
+__attribute__((unused))
 static uint32_t string_hash(const char *str)
 {
 	uint32_t hash = 0;
@@ -18,6 +19,7 @@
 /**
  * Test two strings for equality.
  */
+__attribute__((unused))
 static int string_compare(const char *str1, const char *str2)
 {
 	if (str1 == str2)

<|original_code|>
#include <string.h>
#include <stdint.h>

/**
 * Efficient string hash function.
 */
static uint32_t string_hash(const char *str)
{
	uint32_t hash = 0;
	int32_t c;
	while ((c = *str++))
	{
		hash = c + (hash << 6) + (hash << 16) - hash;
	}
	return hash;
}

/**
 * Test two strings for equality.
 */
static int string_compare(const char *str1, const char *str2)
{
	if (str1 == str2)
	{
		return 1;
	}
	if (str2 == NULL)
	{
		return 0;
	}
	return strcmp(str1, str2) == 0;
}

<|edits_diff|>
--- string_hash.h
+++ string_hash.h
@@ -4,6 +4,7 @@
 /**
  * Efficient string hash function.
  */
+__attribute__((unused))
 static uint32_t string_hash(const char *str)
 {
 	uint32_t hash = 0;
<|current_version|>
#include <string.h>
#include <stdint.h>

/**
 * Efficient string hash function.
 */
__attribute__((unused))
static uint32_t string_hash(const char *str)
{
	uint32_t hash = 0;
	int32_t c;
	while ((c = *str++))
	{
		hash = c + (hash << 6) + (hash << 16) - hash;
	}
	return hash;
}

/**
 * Test two strings for equality.
 */
static int string_compare(const char *str1, const char *str2)
{
	if (str1 == str2)
	{
		return 1;
	}
	if (str2 == NULL)
	{
		return 0;
	}
	return strcmp(str1, str2) == 0;
}

<|next_version|>
#include <string.h>
#include <stdint.h>

/**
 * Efficient string hash function.
 */
__attribute__((unused))
static uint32_t string_hash(const char *str)
{
	uint32_t hash = 0;
	int32_t c;
	while ((c = *str++))
	{
		hash = c + (hash << 6) + (hash << 16) - hash;
	}
	return hash;
}

/**
 * Test two strings for equality.
 */
__attribute__((unused))
static int string_compare(const char *str1, const char *str2)
{
	if (str1 == str2)
	{
		return 1;
	}
	if (str2 == NULL)
	{
		return 0;
	}
	return strcmp(str1, str2) == 0;
}