/* Copyright (c) 2004 Timo Sirainen */

#include "lib.h"
#include "str.h"
#include "str-sanitize.h"

void str_sanitize_append(string_t *dest, const char *src, size_t max_len)
{
	const char *p;

	for (p = src; *p != '\0'; p++) {
		if ((unsigned char)*p < 32)
			break;
	}

	str_append_n(dest, src, (size_t)(p - src));
	for (; *p != '\0' && max_len > 0; p++, max_len--) {
		if ((unsigned char)*p < 32)
			str_append_c(dest, '?');
		else
			str_append_c(dest, *p);
	}

	if (*p != '\0') {
		str_truncate(dest, str_len(dest)-3);
		str_append(dest, "...");
	}
}

const char *str_sanitize(const char *src, size_t max_len)
{
	string_t *str;

	str = t_str_new(I_MIN(max_len, 256));
	str_sanitize_append(str, src, max_len);
	return str_c(str);
}

/* Copyright (c) 2004 Timo Sirainen */

#include "lib.h"
#include "str.h"
#include "str-sanitize.h"

void str_sanitize_append(string_t *dest, const char *src, size_t max_len)
{
	const char *p;

	for (p = src; *p != '\0'; p++) {
		if (((unsigned char)*p & 0x7f) < 32)
			break;
	}

	str_append_n(dest, src, (size_t)(p - src));
	for (; *p != '\0' && max_len > 0; p++, max_len--) {
		if (((unsigned char)*p & 0x7f) < 32)
			str_append_c(dest, '?');
		else
			str_append_c(dest, *p);
	}

	if (*p != '\0') {
		str_truncate(dest, str_len(dest)-3);
		str_append(dest, "...");
	}
}

const char *str_sanitize(const char *src, size_t max_len)
{
	string_t *str;

	str = t_str_new(I_MIN(max_len, 256));
	str_sanitize_append(str, src, max_len);
	return str_c(str);
}

Convert also 0x80..0x9f characters to '?'

--HG--
branch : HEAD


#include <stdlib.h>
#ifndef __LIST_H__
#define __LIST_H__

#endif

#include <stdlib.h>
#ifndef __LIST_H__
#define __LIST_H__
struct ListNode;
struct List;
typedef struct ListNode ListNode;
typedef struct List List;

#endif

Add List & ListNode struct declarations

Add List & ListNode struct declarations


// RUN: %clang_cc1 %s -ast-print -fms-extensions | FileCheck %s

// FIXME: we need to fix the "BoolArgument<"IsMSDeclSpec">"
// hack in Attr.td for attribute "Aligned".

// CHECK: int x __attribute__((aligned(4, 0)));
int x __attribute__((aligned(4)));

// FIXME: Print this at a valid location for a __declspec attr.
// CHECK: int y __declspec(align(4, 1));
__declspec(align(4)) int y;

// CHECK: void foo() __attribute__((const));
void foo() __attribute__((const));

// CHECK: void bar() __attribute__((__const));
void bar() __attribute__((__const));

// FIXME: Print these at a valid location for these attributes.
// CHECK: int *p32 __ptr32;
int * __ptr32 p32;

// CHECK: int *p64 __ptr64;
int * __ptr64 p64;

Test that we print MS keyword attributes without a __declspec(...) adornment.

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


#ifndef HALIDE_TOOLS_IMAGE_H
#define HALIDE_TOOLS_IMAGE_H

/*

This allows code that relied on halide_image.h and Halide::Tools::Image to
continue to work with newer versions of Halide where HalideBuffer.h and
Halide::Buffer are the way to work with data.

Besides mapping Halide::Tools::Image to Halide::Buffer, it defines
USING_HALIDE_BUFFER to allow code to conditionally compile for one or the
other.

It is intended as a stop-gap measure until the code can be updated.

*/

#include "HalideBuffer.h"

namespace Halide {
namespace Tools {

#define USING_HALIDE_BUFFER

template< typename T >
using Image = Buffer<T>;

}   // namespace Tools
}   // mamespace Halide

#endif  // #ifndef HALIDE_TOOLS_IMAGE_H

#ifndef HALIDE_TOOLS_IMAGE_H
#define HALIDE_TOOLS_IMAGE_H

/** \file
 *
 * This allows code that relied on halide_image.h and
 * Halide::Tools::Image to continue to work with newer versions of
 * Halide where HalideBuffer.h and Halide::Buffer are the way to work
 * with data.
 *
 * Besides mapping Halide::Tools::Image to Halide::Buffer, it defines
 * USING_HALIDE_BUFFER to allow code to conditionally compile for one
 * or the other.
 *
 * It is intended as a stop-gap measure until the code can be updated.
 */

#include "HalideBuffer.h"

namespace Halide {
namespace Tools {

#define USING_HALIDE_BUFFER

template< typename T >
using Image = Buffer<T>;

}   // namespace Tools
}   // mamespace Halide

#endif  // #ifndef HALIDE_TOOLS_IMAGE_H

Reformat comment into Doxygen comment for file.

Former-commit-id: f651d51d97b75f12ba68f1cbfca914724136d121


#include "k2pktdef.h"

#define	TRACE2_STA_LEN	7
#define	TRACE2_CHAN_LEN	9  /* 4 bytes plus padding for loc and version */
#define	TRACE2_NET_LEN	9
#define TRACE2_LOC_LEN   3

#define K2INFO_TYPE_STRING "TYPE_K2INFO_PACKET"

typedef struct {
    char    net[TRACE2_NET_LEN];     /* Network name */
    char    sta[TRACE2_STA_LEN];     /* Site name */
    qint16  	data_type;		/* see K2INFO_TYPE #defines below */
    quint32	epoch_sent;	/* local time sent */
    quint16  reserved[5];		/* reserved for future use */
} K2INFO_HEADER;

#define K2INFO_TYPE_HEADER    1		/* k2 header params */
#define K2INFO_TYPE_STATUS    2		/* k2 regular status packet */
#define K2INFO_TYPE_ESTATUS   3		/* k2 extended status packet (old) */
#define K2INFO_TYPE_E2STATUS  4		/* k2 extended status packet v2 */
#define K2INFO_TYPE_COMM      5		/* k2ew packet processing stats */

#define MAX_K2INFOBUF_SIZ 4096

typedef union {
    qint8    msg[MAX_K2INFOBUF_SIZ];
	K2INFO_HEADER k2info;
} K2infoPacket;

#include "k2pktdef.h"

#define	TRACE2_STA_LEN	7
#define	TRACE2_CHAN_LEN	9  /* 4 bytes plus padding for loc and version */
#define	TRACE2_NET_LEN	9
#define TRACE2_LOC_LEN   3
#define K2_TIME_CONV ((unsigned long)315532800)

#define K2INFO_TYPE_STRING "TYPE_K2INFO_PACKET"

typedef struct {
    char    net[TRACE2_NET_LEN];     /* Network name */
    char    sta[TRACE2_STA_LEN];     /* Site name */
    qint16  	data_type;		/* see K2INFO_TYPE #defines below */
    quint32	epoch_sent;	/* local time sent */
    quint16  reserved[5];		/* reserved for future use */
} K2INFO_HEADER;

#define K2INFO_TYPE_HEADER    1		/* k2 header params */
#define K2INFO_TYPE_STATUS    2		/* k2 regular status packet */
#define K2INFO_TYPE_ESTATUS   3		/* k2 extended status packet (old) */
#define K2INFO_TYPE_E2STATUS  4		/* k2 extended status packet v2 */
#define K2INFO_TYPE_COMM      5		/* k2ew packet processing stats */

#define MAX_K2INFOBUF_SIZ 4096

typedef union {
    qint8    msg[MAX_K2INFOBUF_SIZ];
	K2INFO_HEADER k2info;
} K2infoPacket;

Make 64Bit Friendly, NonStatic for Ubuntu 14.04 delete unneeded files


/*
Copyright (c) 2007-2014. The YARA Authors. All Rights Reserved.

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

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

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

#ifndef _SIZEDSTR_H
#define _SIZEDSTR_H

#include <stddef.h>
#include <inttypes.h>

//
// This struct is used to support strings containing null chars. The length of
// the string is stored along the string data. However the string data is also
// terminated with a null char.
//

#define SIZED_STRING_FLAGS_NO_CASE  1
#define SIZED_STRING_FLAGS_DOT_ALL  2

#pragma pack(push)
#pragma pack(8)

typedef struct _SIZED_STRING
{
  uint64_t length;
  uint32_t flags;
  char c_string[1];

} SIZED_STRING;

#pragma pack(pop)

int sized_string_cmp(
  SIZED_STRING* s1,
  SIZED_STRING* s2);

#endif

/*
Copyright (c) 2007-2014. The YARA Authors. All Rights Reserved.

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

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

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

#ifndef _SIZEDSTR_H
#define _SIZEDSTR_H

#include <stddef.h>
#include <inttypes.h>

//
// This struct is used to support strings containing null chars. The length of
// the string is stored along the string data. However the string data is also
// terminated with a null char.
//

#define SIZED_STRING_FLAGS_NO_CASE  1
#define SIZED_STRING_FLAGS_DOT_ALL  2

#pragma pack(push)
#pragma pack(8)

typedef struct _SIZED_STRING
{
  uint32_t length;
  uint32_t flags;

  char c_string[1];

} SIZED_STRING;

#pragma pack(pop)

int sized_string_cmp(
  SIZED_STRING* s1,
  SIZED_STRING* s2);

#endif

Change type of SIZED_STRING's length to uint32_t


// RUN: clang-cc -Wnonnull -fsyntax-only -verify %s

extern void func1 (void (^block1)(), void (^block2)(), int) __attribute__((nonnull));

extern void func3 (void (^block1)(), int, void (^block2)(), int)
  __attribute__((nonnull(1,3)));

extern void func4 (void (^block1)(), void (^block2)()) __attribute__((nonnull(1)))
  __attribute__((nonnull(2)));

void
foo (int i1, int i2, int i3, void (^cp1)(), void (^cp2)(), void (^cp3)())
{
  func1(cp1, cp2, i1);

  func1(0, cp2, i1);  // expected-warning {{argument is null where non-null is required}}
  func1(cp1, 0, i1);  // expected-warning {{argument is null where non-null is required}}
  func1(cp1, cp2, 0);

  func3(0, i2, cp3, i3); // expected-warning {{argument is null where non-null is required}}
  func3(cp3, i2, 0, i3);  // expected-warning {{argument is null where non-null is required}}

  func4(0, cp1); // expected-warning {{argument is null where non-null is required}}
  func4(cp1, 0); // expected-warning {{argument is null where non-null is required}}
}

// RUN: clang-cc -fblocks -Wnonnull -fsyntax-only -verify %s

extern void func1 (void (^block1)(), void (^block2)(), int) __attribute__((nonnull));

extern void func3 (void (^block1)(), int, void (^block2)(), int)
  __attribute__((nonnull(1,3)));

extern void func4 (void (^block1)(), void (^block2)()) __attribute__((nonnull(1)))
  __attribute__((nonnull(2)));

void
foo (int i1, int i2, int i3, void (^cp1)(), void (^cp2)(), void (^cp3)())
{
  func1(cp1, cp2, i1);

  func1(0, cp2, i1);  // expected-warning {{argument is null where non-null is required}}
  func1(cp1, 0, i1);  // expected-warning {{argument is null where non-null is required}}
  func1(cp1, cp2, 0);

  func3(0, i2, cp3, i3); // expected-warning {{argument is null where non-null is required}}
  func3(cp3, i2, 0, i3);  // expected-warning {{argument is null where non-null is required}}

  func4(0, cp1); // expected-warning {{argument is null where non-null is required}}
  func4(cp1, 0); // expected-warning {{argument is null where non-null is required}}
}

Add -fblocks for the test.

Add -fblocks for the test.

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


#import <Foundation/Foundation.h>

@interface NSFileManager (TDTAdditions)

/**
 @return URL to the any directory which matches the given search path in
         the User's domain.
 */
- (NSURL *)userURLForDirectory:(NSSearchPathDirectory)directory;

/**
 Creates a temporary file in a suitable temporary directory.

 The generated file has a name of the form "prefix-random.suffix",
 where "random" denotes a string of random integers to gurantee uniqueness.

 @return URL to the temporary file
 */
- (NSURL *)fileURLToTemporaryFileWithNamePrefix:(NSString *)prefix
                                         suffix:(NSString *)suffix;

@end

#import <Foundation/Foundation.h>

@interface NSFileManager (TDTAdditions)

/**
 @return URL to the any directory which matches the given search path in
         the User's domain.
 */
- (NSURL *)userURLForDirectory:(NSSearchPathDirectory)directory;

/**
 Creates a temporary file in a suitable temporary directory.

 The generated file has a name of the form "prefix-random.suffix",
 where "random" denotes a string of random integers to gurantee uniqueness.

 @return URL to the temporary file.
 */
- (NSURL *)fileURLToTemporaryFileWithNamePrefix:(NSString *)prefix
                                         suffix:(NSString *)suffix;

@end

Remove trailing spaces from documentation comments


#include <unistd.h>

int main() {
	char c;
	while (read(STDIN_FILENO, &c, 1) == 1);
	return 0;
}

Read keypresses from the user

Read keypresses from the user


// xml_lexer.h           see license.txt for copyright and terms of use

#ifndef XML_LEXER_H
#define XML_LEXER_H

#include <stdio.h>
#include "fstream.h"            // ifstream

#include "str.h"                // string
#include "sm_flexlexer.h"       // yyFlexLexer
#include "baselexer.h"          // FLEX_OUTPUT_METHOD_DECLS
#include "xml_enum.h"           // XTOK_*

class XmlLexer : private yyFlexLexer {
  public:
  char const *inputFname;       // just for error messages
  int linenumber;
  bool sawEof;

  XmlLexer()
    : inputFname(NULL)
    , linenumber(1)             // file line counting traditionally starts at 1
    , sawEof(false)
  {}

  // this is yylex() but does what I want it to with EOF
  int getToken();
  // have we seen the EOF?
  bool haveSeenEof() { return sawEof; }
  // this is yytext
  char const *currentText() { return this->YYText(); }
  // this is yyrestart
  void restart(istream *in) { this->yyrestart(in); }

  int tok(XmlToken kind);
  int svalTok(XmlToken t);
  void err(char const *msg);

  string tokenKindDesc(int kind) const;

  FLEX_OUTPUT_METHOD_DECLS
};

#endif // XML_LEXER_H

// xml_lexer.h           see license.txt for copyright and terms of use

#ifndef XML_LEXER_H
#define XML_LEXER_H

#include <stdio.h>
#include "fstream.h"            // ifstream

#include "str.h"                // string
#include "sm_flexlexer.h"       // yyFlexLexer
#include "baselexer.h"          // FLEX_OUTPUT_METHOD_DECLS
#include "xml_enum.h"           // XTOK_*

class XmlLexer : private yyFlexLexer {
  public:
  char const *inputFname;       // just for error messages
  int linenumber;
  bool sawEof;

  XmlLexer()
    : inputFname(NULL)
    , linenumber(1)             // file line counting traditionally starts at 1
    , sawEof(false)
  {}

  // this is yylex() but does what I want it to with EOF
  int getToken();
  // have we seen the EOF?
  bool haveSeenEof() { return sawEof; }
  // this is yytext
  char const *currentText() { return this->YYText(); }
  // this is yyrestart
  void restart(istream *in) { this->yyrestart(in); sawEof = false; }

  int tok(XmlToken kind);
  int svalTok(XmlToken t);
  void err(char const *msg);

  string tokenKindDesc(int kind) const;

  FLEX_OUTPUT_METHOD_DECLS
};

#endif // XML_LEXER_H

Fix bug where XmlLexer::restart() doesn't reset sawEof


#ifndef GAMEASSET_H
#define GAMEASSET_H

#include <GL/gl.h>

class GameAsset {
 public:
  virtual void Draw(GLuint) = 0;

};

#endif

#ifndef GAMEASSET_H
#define GAMEASSET_H

#include <iostream>

#include <GL/gl.h>

class GameAsset {
 public:
  virtual void Draw(GLuint) = 0;

};

#endif

Include cerr and endl in CubeAsset

Include cerr and endl in CubeAsset


#include "stdio.h"
#include "stdbool.h"

bool checkPythagoreanTriplet (int a, int b, int c);

bool checkPythagoreanTriplet (int a, int b, int c) {
    if((a*a) + (b*b) == (c*c)) {
        return true;
    } else {
        return false;
    }
}

int main(int argc, char const *argv[]) {
    int i;
    int j;
    int k;

    for(i=1; i < 1000; i++) {
        for(j=i; j < (1000 - i); j++) {
            for(k=j; k < (1000 - j); k++){
                if(checkPythagoreanTriplet(i,j,k) && (i + j + k) == 1000) {
                    printf("%d %d %d\n", i, j, k);
                    printf("%d\n", (i*j*k));
                    break;
                }
            }
        }
    }
    return 0;
}

#include "stdio.h"
#include "stdbool.h"

bool checkPythagoreanTriplet(int a, int b, int c);

bool checkPythagoreanTriplet(int a, int b, int c)
{
  if ((a * a) + (b * b) == (c * c))
    {
      return true;
    }
  else
    {
      return false;
    }
}

int main(int argc, char const *argv[])
{
  int i;
  int j;
  int k;

  for (i = 1; i < 1000; i++)
    {
      for (j = i; j < (1000 - i); j++)
        {
          for (k = j; k < (1000 - j); k++)
            {
              if (checkPythagoreanTriplet(i, j, k) && (i + j + k) == 1000)
                {
                  printf("%d %d %d\n", i, j, k);
                  printf("%d\n", (i * j * k));
                  break;
                }
            }
        }
    }
  return 0;
}

Update format for Problem 9

Update format for Problem 9


// RUN: not %clang_cc1 -O1 %s -emit-llvm
// PR6913

#include <stdio.h>

int main()
{
   int x[10][10];
   int (*p)[] = x; // expected-error {{invalid use of array with unspecified bounds}

   int i;

   for(i = 0; i < 10; ++i)
   {
       p[i][i] = i;
   }
}

Bring over a test from llvm/test/FrontendC that is for Sema and not CodeGen.

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


/*
  Ultrasonick.h - Library for HC-SR04 Ultrasonic Ranging Module in a minimalist way.
  Created by EricK Simoes (@AloErickSimoes), April 3, 2014.
  Released into the Creative Commons Attribution-ShareAlike 4.0 International.
*/

#ifndef Ultrasonick_h
#define Ultrasonick_h

#if (ARDUINO >= 100)
  #include "Arduino.h"
#else
  #include "WProgram.h"
#endif

#define CM 1
#define INC 0

/**
* TODO: Remove the underscore of the private variables name
* and use static keyword
*/
class Ultrasonick {
  public:
    Ultrasonick(uint8_t trigPin, uint8_t echoPin);
    int distanceRead(uint8_t und);
    int distanceRead();

  private:
    uint8_t _trigPin;
    uint8_t _echoPin;
    int timing();
};

#endif // Ultrasonic_h

/*
  Ultrasonick.h - Library for HC-SR04 Ultrasonic Ranging Module in a minimalist way.
  Created by EricK Simoes (@AloErickSimoes), April 3, 2014.
  Released into the Creative Commons Attribution-ShareAlike 4.0 International.
*/

#ifndef Ultrasonick_h
#define Ultrasonick_h

#define CM 1
#define INC 0

/**
* TODO: Remove the underscore of the private variables name
* and use static keyword
*/
class Ultrasonick {
  public:
    Ultrasonick(uint8_t trigPin, uint8_t echoPin);
    int distanceRead(uint8_t und);
    int distanceRead();

  private:
    uint8_t _trigPin;
    uint8_t _echoPin;
    int timing();
};

#endif // Ultrasonic_h

Remove duplicate include from Arduino.h

Fix: Remove duplicate include from Arduino.h

The include is only required in the .cpp file.

Resolves: #18


#ifndef NINJA_WIN32PORT_H_
#define NINJA_WIN32PORT_H_
#pragma once

/// A 64-bit integer type
typedef unsigned long long int64_t;
typedef unsigned long long uint64_t;

#endif // NINJA_WIN32PORT_H_

#ifndef NINJA_WIN32PORT_H_
#define NINJA_WIN32PORT_H_
#pragma once

/// A 64-bit integer type
typedef signed long long int64_t;
typedef unsigned long long uint64_t;

#endif // NINJA_WIN32PORT_H_

Add new line to new file

Add new line to new file


#pragma once
#ifndef COPYFS_LIB_COPYDEVICE_H_
#define COPYFS_LIB_COPYDEVICE_H_

#include <boost/filesystem.hpp>
#include <messmer/fspp/fs_interface/Device.h>

#include "messmer/cpp-utils/macros.h"

namespace copyfs {

namespace bf = boost::filesystem;

class CopyDevice: public fspp::Device {
public:
  CopyDevice(const bf::path &rootdir);
  virtual ~CopyDevice();

  void statfs(const boost::filesystem::path &path, struct ::statvfs *fsstat) override;

  const bf::path &RootDir() const;
private:
  std::unique_ptr<fspp::Node> Load(const bf::path &path) override;

  const bf::path _root_path;

  DISALLOW_COPY_AND_ASSIGN(CopyDevice);
};

inline const bf::path &CopyDevice::RootDir() const {
  return _root_path;
}

}

#endif

#pragma once
#ifndef COPYFS_LIB_COPYDEVICE_H_
#define COPYFS_LIB_COPYDEVICE_H_

#include <boost/filesystem.hpp>
#include <messmer/fspp/fs_interface/Device.h>

#include "messmer/cpp-utils/macros.h"

namespace copyfs {

namespace bf = boost::filesystem;

class CopyDevice: public fspp::Device {
public:
  explicit CopyDevice(const bf::path &rootdir);
  virtual ~CopyDevice();

  void statfs(const boost::filesystem::path &path, struct ::statvfs *fsstat) override;

  const bf::path &RootDir() const;
private:
  std::unique_ptr<fspp::Node> Load(const bf::path &path) override;

  const bf::path _root_path;

  DISALLOW_COPY_AND_ASSIGN(CopyDevice);
};

inline const bf::path &CopyDevice::RootDir() const {
  return _root_path;
}

}

#endif

Make constructors explicit where adequate


#ifndef stdbool_h
#define stdbool_h

#include <wtypes.h>

/* MSVC doesn't define _Bool or bool in C, but does have BOOL */
/* Note this doesn't pass autoconf's test because (bool) 0.5 != true */
typedef BOOL _Bool;

#define bool _Bool
#define true 1
#define false 0

#define __bool_true_false_are_defined 1

#endif /* stdbool_h */

#ifndef stdbool_h
#define stdbool_h

#include <wtypes.h>

/* MSVC doesn't define _Bool or bool in C, but does have BOOL */
/* Note this doesn't pass autoconf's test because (bool) 0.5 != true */
/* Clang-cl uses MSVC headers, so needs msvc_compat, but has _Bool as
 * a built-in type. */
#ifndef __clang__
typedef BOOL _Bool;
#endif

#define bool _Bool
#define true 1
#define false 0

#define __bool_true_false_are_defined 1

#endif /* stdbool_h */

Allow to build with clang-cl

Allow to build with clang-cl


/*   Copyright (c) nasser-sh 2016
*
*   Distributed under BSD-style license. See accompanying LICENSE.txt in project
*   directory.
*/
#pragma once
#include <afxwin.h>
#include "resource.h"

namespace graphics
{
    class CGraphicsApp;

    class CSettingsDialog : public CDialog
    {
    public:
        enum { IDD = IDD_SETTINGS_DIALOG };

        CSettingsDialog(CGraphicsApp *pApp, CWnd *pParent = nullptr);
        virtual ~CSettingsDialog() = default;

        BOOL OnInitDialog() override;
        void OnOK() override;

    private:
        CComboBox *m_pMsaaComboBox;
        CGraphicsApp *m_pApp;

    protected:
        DECLARE_MESSAGE_MAP()
    };
}

/*   Copyright (c) nasser-sh 2016
*
*   Distributed under BSD-style license. See accompanying LICENSE.txt in project
*   directory.
*/
#pragma once
#include <afxwin.h>
#include "resource.h"

namespace graphics
{
    class CGraphicsApp;

    class CSettingsDialog : public CDialog
    {
    public:
        enum { IDD = IDD_SETTINGS_DIALOG };

        CSettingsDialog(CGraphicsApp *pApp, CWnd *pParent = nullptr);
        virtual ~CSettingsDialog() = default;

        BOOL OnInitDialog() override;
        void OnOK() override;

    private:
        CGraphicsApp *m_pApp;

    protected:
        DECLARE_MESSAGE_MAP()
    };
}

Remove unused attribute from Settings Dialog


//
//  HTCopyableLabel.h
//  HotelTonight
//
//  Created by Jonathan Sibley on 2/6/13.
//  Copyright (c) 2013 Hotel Tonight. All rights reserved.
//

#import <UIKit/UIKit.h>

@class HTCopyableLabel;

@protocol HTCopyableLabelDelegate <NSObject>

@optional
- (NSString *)stringToCopyForCopyableLabel:(HTCopyableLabel *)copyableLabel;
- (CGRect)copyMenuTargetRectInCopyableLabelCoordinates:(HTCopyableLabel *)copyableLabel;

@end

@interface HTCopyableLabel : UILabel

@property (nonatomic, assign) BOOL copyingEnabled; // Defaults to YES

@property (nonatomic, weak) id<HTCopyableLabelDelegate> copyableLabelDelegate;

@property (nonatomic, assign) UIMenuControllerArrowDirection copyMenuArrowDirection; // Defaults to UIMenuControllerArrowDefault

// You may want to add longPressGestureRecognizer to a container view
@property (nonatomic, strong, readonly) UILongPressGestureRecognizer *longPressGestureRecognizer;

@end

//
//  HTCopyableLabel.h
//  HotelTonight
//
//  Created by Jonathan Sibley on 2/6/13.
//  Copyright (c) 2013 Hotel Tonight. All rights reserved.
//

@class HTCopyableLabel;

@protocol HTCopyableLabelDelegate <NSObject>

@optional
- (NSString *)stringToCopyForCopyableLabel:(HTCopyableLabel *)copyableLabel;
- (CGRect)copyMenuTargetRectInCopyableLabelCoordinates:(HTCopyableLabel *)copyableLabel;

@end

@interface HTCopyableLabel : UILabel

@property (nonatomic, assign) BOOL copyingEnabled; // Defaults to YES

@property (nonatomic, weak) id<HTCopyableLabelDelegate> copyableLabelDelegate;

@property (nonatomic, assign) UIMenuControllerArrowDirection copyMenuArrowDirection; // Defaults to UIMenuControllerArrowDefault

// You may want to add longPressGestureRecognizer to a container view
@property (nonatomic, strong, readonly) UILongPressGestureRecognizer *longPressGestureRecognizer;

@end

Remove UIKit import to (hopefully) fix cocoapods travis-CI build


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

#ifndef WEBKIT_FILEAPI_QUOTA_FILE_UTIL_H_
#define WEBKIT_FILEAPI_QUOTA_FILE_UTIL_H_

#include "webkit/fileapi/file_system_file_util.h"
#include "webkit/fileapi/file_system_operation_context.h"
#pragma once

namespace fileapi {

class QuotaFileUtil : public FileSystemFileUtil {
 public:
  static QuotaFileUtil* GetInstance();
  ~QuotaFileUtil() {}

  static const int64 kNoLimit;

  base::PlatformFileError CopyOrMoveFile(
    FileSystemOperationContext* fs_context,
    const FilePath& src_file_path,
    const FilePath& dest_file_path,
    bool copy);

  // TODO(dmikurube): Charge some amount of quota for directories.

  base::PlatformFileError Truncate(
      FileSystemOperationContext* fs_context,
      const FilePath& path,
      int64 length);

  friend struct DefaultSingletonTraits<QuotaFileUtil>;
  DISALLOW_COPY_AND_ASSIGN(QuotaFileUtil);

 protected:
  QuotaFileUtil() {}
};

}  // namespace fileapi

#endif  // WEBKIT_FILEAPI_QUOTA_FILE_UTIL_H_

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

#ifndef WEBKIT_FILEAPI_QUOTA_FILE_UTIL_H_
#define WEBKIT_FILEAPI_QUOTA_FILE_UTIL_H_

#include "webkit/fileapi/file_system_file_util.h"
#include "webkit/fileapi/file_system_operation_context.h"
#pragma once

namespace fileapi {

class QuotaFileUtil : public FileSystemFileUtil {
 public:
  static QuotaFileUtil* GetInstance();
  ~QuotaFileUtil() {}

  static const int64 kNoLimit;

  virtual base::PlatformFileError CopyOrMoveFile(
    FileSystemOperationContext* fs_context,
    const FilePath& src_file_path,
    const FilePath& dest_file_path,
    bool copy);

  // TODO(dmikurube): Charge some amount of quota for directories.

  virtual base::PlatformFileError Truncate(
      FileSystemOperationContext* fs_context,
      const FilePath& path,
      int64 length);

  friend struct DefaultSingletonTraits<QuotaFileUtil>;
  DISALLOW_COPY_AND_ASSIGN(QuotaFileUtil);

 protected:
  QuotaFileUtil() {}
};

}  // namespace fileapi

#endif  // WEBKIT_FILEAPI_QUOTA_FILE_UTIL_H_

Add virtual in QuitaFileUtil to fix the compilation error in r82441.

TBR=dmikurube,kinuko
BUG=none
TEST=none

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

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


/* DO NOT EDIT THIS FILE - it is machine generated */
#include <jni.h>
/* Header for class ru_exlmoto_spout_SpoutNativeLibProxy */

#ifndef _Included_ru_exlmoto_spout_SpoutNativeLibProxy
#define _Included_ru_exlmoto_spout_SpoutNativeLibProxy
#ifdef __cplusplus
extern "C" {
#endif
/*
 * Class:     ru_exlmoto_spout_SpoutNativeLibProxy
 * Method:    SpoutNativeInit
 * Signature: ()V
 */
JNIEXPORT void JNICALL Java_ru_exlmoto_spout_SpoutNativeLibProxy_SpoutNativeInit
  (JNIEnv *, jclass);

/*
 * Class:     ru_exlmoto_spout_SpoutNativeLibProxy
 * Method:    SpoutNativeDeinit
 * Signature: ()V
 */
JNIEXPORT void JNICALL Java_ru_exlmoto_spout_SpoutNativeLibProxy_SpoutNativeDeinit
  (JNIEnv *, jclass);

/*
 * Class:     ru_exlmoto_spout_SpoutNativeLibProxy
 * Method:    SpoutNativeSurfaceChanged
 * Signature: (II)V
 */
JNIEXPORT void JNICALL Java_ru_exlmoto_spout_SpoutNativeLibProxy_SpoutNativeSurfaceChanged
  (JNIEnv *, jclass, jint, jint);

/*
 * Class:     ru_exlmoto_spout_SpoutNativeLibProxy
 * Method:    SpoutNativeDraw
 * Signature: ()V
 */
JNIEXPORT void JNICALL Java_ru_exlmoto_spout_SpoutNativeLibProxy_SpoutNativeDraw
  (JNIEnv *, jclass);

/*
 * Class:     ru_exlmoto_spout_SpoutNativeLibProxy
 * Method:    SpoutNativeKeyDown
 * Signature: (I)V
 */
JNIEXPORT void JNICALL Java_ru_exlmoto_spout_SpoutNativeLibProxy_SpoutNativeKeyDown
  (JNIEnv *, jclass, jint);

/*
 * Class:     ru_exlmoto_spout_SpoutNativeLibProxy
 * Method:    SpoutNativeKeyUp
 * Signature: (I)V
 */
JNIEXPORT void JNICALL Java_ru_exlmoto_spout_SpoutNativeLibProxy_SpoutNativeKeyUp
  (JNIEnv *, jclass, jint);

/*
 * Class:     ru_exlmoto_spout_SpoutNativeLibProxy
 * Method:    SpoutNativePushScore
 * Signature: (II)V
 */
JNIEXPORT void JNICALL Java_ru_exlmoto_spout_SpoutNativeLibProxy_SpoutNativePushScore
  (JNIEnv *, jclass, jint, jint);

/*
 * Class:     ru_exlmoto_spout_SpoutNativeLibProxy
 * Method:    SpoutNativeGetScore
 * Signature: ()[I
 */
JNIEXPORT jintArray JNICALL Java_ru_exlmoto_spout_SpoutNativeLibProxy_SpoutNativeGetScore
  (JNIEnv *, jclass);

#ifdef __cplusplus
}
#endif
#endif

Add machine generated JNI header

Add machine generated JNI header

command:
javah -jni -d jni -classpath src \
ru.exlmoto.spout.SpoutNativeLibProxy


#pragma once

#include <string>

struct Version {
public:
    Version(int major = 0, int minor = 0, int revision = 0) :
    _major(major),
    _minor(minor),
    _revision(revision) {

    }

    const int Major() { return _major; }
    const int Minor() { return _minor; }
    const int Revision() { return _revision; }

    }

    std::wstring ToString() {
        return std::to_wstring(_major)
            + L"."
            + std::to_wstring(_minor)
            + L"."
            + std::to_wstring(_revision);
    }

private:
    int _major;
    int _minor;
    int _revision;
};

#pragma once

#include <string>

struct Version {
public:
    Version(int major = 0, int minor = 0, int revision = 0) :
    _major(major),
    _minor(minor),
    _revision(revision) {

    }

    const int Major() { return _major; }
    const int Minor() { return _minor; }
    const int Revision() { return _revision; }

    unsigned int ToInt() {
        return (_major << 16) | (_minor << 8) | (_revision);
    }

    std::wstring ToString() {
        return std::to_wstring(_major)
            + L"."
            + std::to_wstring(_minor)
            + L"."
            + std::to_wstring(_revision);
    }

private:
    int _major;
    int _minor;
    int _revision;
};

Add convenience function to calculate the integer representation of the version


#ifndef CJET_CONFIG_H
#define CJET_CONFIG_H

#define SERVER_PORT 7899
#define LISTEN_BACKLOG 40

#define MAX_MESSAGE_SIZE 128

/* Linux specific configs */
#define MAX_EPOLL_EVENTS 100

#endif

#ifndef CJET_CONFIG_H
#define CJET_CONFIG_H

#define SERVER_PORT 11122
#define LISTEN_BACKLOG 40

#define MAX_MESSAGE_SIZE 128

/* Linux specific configs */
#define MAX_EPOLL_EVENTS 100

#endif

Change server port to the correct jet port.


#include <uEye.h>
#include "core.h"

#if PY_MAJOR_VERSION >= 3
/*
 * This is only needed for Python3
 * IDS module initialization
 * Based on https://docs.python.org/3/extending/extending.html#the-module-s-method-table-and-initialization-function
 */
static struct PyModuleDef idsModule = {
    PyModuleDef_HEAD_INIT,
    "ids", /* name of module */
    NULL,  /* module documentation */
    -1,    /* size of perinterpreter state of the module,
              or -1 if the module keeps state in global variables. */
    idsMethods
};
#endif

#if PY_MAJOR_VERSION >= 3
PyMODINIT_FUNC PyInit_ids(void)
{
    return PyModule_Create(&idsModule);
}
#else
PyMODINIT_FUNC initids(void)
{
    (void) Py_InitModule("ids", idsMethods);
}
#endif

int main(int argc, char *argv[])
{
#if PY_MAJOR_VERSION >= 3
    wchar_t name[128];
    mbstowcs(name, argv[0], 128);
#else
    char name[128];
    strncpy(name, argv[0], 128);
#endif
    /* Pass argv[0] to the Pythin interpreter */
    Py_SetProgramName(name);

    /* Initialize the Python interpreter */
    Py_Initialize();

    /* Add a static module */
#if PY_MAJOR_VERSION >= 3
    PyInit_ids();
#else
    initids();
#endif
}

#include <uEye.h>
#include "core.h"

#if PY_MAJOR_VERSION >= 3
/*
 * This is only needed for Python3
 * IDS module initialization
 * Based on https://docs.python.org/3/extending/extending.html#the-module-s-method-table-and-initialization-function
 */
static struct PyModuleDef idsModule = {
    PyModuleDef_HEAD_INIT,
    "ids", /* name of module */
    NULL,  /* module documentation */
    -1,    /* size of perinterpreter state of the module,
              or -1 if the module keeps state in global variables. */
    idsMethods
};
#endif

#if PY_MAJOR_VERSION >= 3
PyMODINIT_FUNC PyInit_core(void)
{
    return PyModule_Create(&idsModule);
}
#else
PyMODINIT_FUNC initcore(void)
{
    (void) Py_InitModule("core", idsMethods);
}
#endif

int main(int argc, char *argv[])
{
#if PY_MAJOR_VERSION >= 3
    wchar_t name[128];
    mbstowcs(name, argv[0], 128);
#else
    char name[128];
    strncpy(name, argv[0], 128);
#endif
    /* Pass argv[0] to the Pythin interpreter */
    Py_SetProgramName(name);

    /* Initialize the Python interpreter */
    Py_Initialize();

    /* Add a static module */
#if PY_MAJOR_VERSION >= 3
    PyInit_core();
#else
    initcore();
#endif
}

Fix linker error by changing init function names to represent module names


#ifndef USB_H
#define USB_H

void setup_usb();
void usb_interrupt_handler();

#endif

#ifndef USB_H
#define USB_H

#define PHYS_ADDR(VIRTUAL_ADDR)  (unsigned int)(VIRTUAL_ADDR)

#define EP0_BUFLEN 8
#define EP1_BUFLEN 8

#define USB_PID_SETUP                   0x0d

#define USB_REQ_GET_DESCRIPTOR          0x06
#define USB_GET_DEVICE_DESCRIPTOR       0x01
#define USB_GET_CONFIG_DESCRIPTOR       0x02
#define USB_GET_STRING_DESCRIPTOR       0x03

#define USB_REQ_GET_STATUS              0x00

#define USB_REQ_SET_ADDRESS             0x05
#define USB_REQ_SET_CONFIGURATION       0x09

void reset_usb (  );
void usb_interrupt_handler (  );
bool usb_in_endpoint_busy ( uint8_t ep );
void usb_arm_in_transfert (  );
#endif

Add macros for setting Endpoint buffers length,

Define some USB magic values

Export two fonctions for the main loop


#ifndef DASHBOARD_H
#define DASHBOARD_H

#include <sys/types.h>

#include "src/process/process.h"
#include "src/system/sys_stats.h"

typedef struct {
    int max_x;
    int max_y;
    int prev_x;
    int prev_y;
    char *fieldbar;
    sysaux *system;
    ps_node *process_list;
    Tree *process_tree;
} Board;

void print_usage(void);

char set_sort_option(char *opt);

void dashboard_mainloop(char attr_sort);

void update_process_stats(Tree *ps_tree, ps_node *ps, sysaux *sys);

static int calculate_ln_diff(Board *board, int ln, int prev_ln);

Board *init_board(void);

void free_board(Board *board);

#endif

#ifndef DASHBOARD_H
#define DASHBOARD_H

#include <sys/types.h>

#include "src/process/process.h"
#include "src/system/sys_stats.h"

typedef struct {
    int max_x;
    int max_y;
    int prev_x;
    int prev_y;
    char *fieldbar;
    sysaux *system;
    ps_node *process_list;
    Tree *process_tree;
} Board;

void print_usage(void);

char set_sort_option(char *opt);

void dashboard_mainloop(char attr_sort);

void update_process_stats(Tree *ps_tree, ps_node *ps, sysaux *sys);

Board *init_board(void);

void free_board(Board *board);

#endif

Remove static declaration of line diff

Remove static declaration of line diff


#pragma once

#import "WRLDRoutingQuery.h"
#import "WRLDRoutingQueryOptions.h"

NS_ASSUME_NONNULL_BEGIN

/*!
 A service which allows you to find routes between locations. Created by the createRoutingService
 method of the WRLDMapView object.

 This is an Objective-c interface to the WRLD Routing REST API (https://github.com/wrld3d/wrld-routing-api).
 */

@interface WRLDRoutingService : NSObject

/*!
 Asynchronously query the routing service.

 The results of the query will be passed
 as a WRLDRoutingQueryResponse to the routingQueryDidComplete method in WRLDMapViewDelegate.

 @param options The parameters of the routing query.
 @returns A handle to the ongoing query, which can be used to cancel it.
 */
- (WRLDRoutingQuery*)findRoutes:(WRLDRoutingQueryOptions*)options;

@end

NS_ASSUME_NONNULL_END

#pragma once

#import "WRLDRoutingQuery.h"
#import "WRLDRoutingQueryOptions.h"

NS_ASSUME_NONNULL_BEGIN

/*!
 A service which allows you to find routes between locations. Created by the createRoutingService
 method of the WRLDMapView object.

 This is an Objective-c interface to the [WRLD Routing REST API](https://github.com/wrld3d/wrld-routing-api).
 */

@interface WRLDRoutingService : NSObject

/*!
 Asynchronously query the routing service.

 The results of the query will be passed
 as a WRLDRoutingQueryResponse to the routingQueryDidComplete method in WRLDMapViewDelegate.

 @param options The parameters of the routing query.
 @returns A handle to the ongoing query, which can be used to cancel it.
 */
- (WRLDRoutingQuery*)findRoutes:(WRLDRoutingQueryOptions*)options;

@end

NS_ASSUME_NONNULL_END

Fix for [MPLY-9800]. Doc string didn't link correctly. Buddy: Sam A.


#include "local.h"

float soluc(float x, float y)
{

  float r;
  r = sqrt(x * x + y * y);
  return r;

}

float radians_degrees(float degrees)
{

  return degrees*180/PI;

}

float degrees_radians(float radians)
{

  return radians*PI/180;

}

Add funcoes para converter graus <-> rad


#ifndef _ASM_X86_MMU_H
#define _ASM_X86_MMU_H

#include <linux/spinlock.h>
#include <linux/mutex.h>

/*
 * The x86 doesn't have a mmu context, but
 * we put the segment information here.
 */
typedef struct {
	void *ldt;
	int size;
	struct mutex lock;
	void *vdso;

#ifdef CONFIG_X86_64
	/* True if mm supports a task running in 32 bit compatibility mode. */
	unsigned short ia32_compat;
#endif

} mm_context_t;

#ifdef CONFIG_SMP
void leave_mm(int cpu);
#else
static inline void leave_mm(int cpu)
{
}
#endif

#endif /* _ASM_X86_MMU_H */

#ifndef _ASM_X86_MMU_H
#define _ASM_X86_MMU_H

#include <linux/spinlock.h>
#include <linux/mutex.h>

/*
 * The x86 doesn't have a mmu context, but
 * we put the segment information here.
 */
typedef struct {
	void *ldt;
	int size;

#ifdef CONFIG_X86_64
	/* True if mm supports a task running in 32 bit compatibility mode. */
	unsigned short ia32_compat;
#endif

	struct mutex lock;
	void *vdso;
} mm_context_t;

#ifdef CONFIG_SMP
void leave_mm(int cpu);
#else
static inline void leave_mm(int cpu)
{
}
#endif

#endif /* _ASM_X86_MMU_H */

x86: Reorder mm_context_t to remove x86_64 alignment padding and thus shrink mm_struct

Reorder mm_context_t to remove alignment padding on 64 bit
builds shrinking its size from 64 to 56 bytes.

This allows mm_struct to shrink from 840 to 832 bytes, so using
one fewer cache lines, and getting more objects per slab when
using slub.

slabinfo mm_struct reports
before :-

    Sizes (bytes)     Slabs
    -----------------------------------
    Object :     840  Total  :       7
    SlabObj:     896  Full   :       1
    SlabSiz:   16384  Partial:       4
    Loss   :      56  CpuSlab:       2
    Align  :      64  Objects:      18

after :-

    Sizes (bytes)     Slabs
    ----------------------------------
    Object :     832  Total  :       7
    SlabObj:     832  Full   :       1
    SlabSiz:   16384  Partial:       4
    Loss   :       0  CpuSlab:       2
    Align  :      64  Objects:      19

Signed-off-by: Richard Kennedy <320bca71fc381a4a025636043ca86e734e31cf8b@rsk.demon.co.uk>
Cc: 3d378e0efa9324a1bec5e3bea0c8445f2cc384d0@start.ca
Cc: Linus Torvalds <69652caca27c8b940640ad396ab71f93cacec34f@linux-foundation.org>
Cc: Andrew Morton <5c1e68b099950c134891f0b6e179498a8ebe9cf9@linux-foundation.org>
Cc: Pekka Enberg <add4fcd06328a394f0ad91feda7ee057316dc5ed@kernel.org>
Link: f96f24409da09dd8fdaa8f3abbce8686f58ad694@castor.rsk
Signed-off-by: Ingo Molnar <9dbbbf0688fedc85ad4da37637f1a64b8c718ee2@elte.hu>


/**
 ******************************************************************************
 * Xenia : Xbox 360 Emulator Research Project                                 *
 ******************************************************************************
 * Copyright 2015 Ben Vanik. All rights reserved.                             *
 * Released under the BSD license - see LICENSE in the root for more details. *
 ******************************************************************************
 */

#ifndef XENIA_BASE_PLATFORM_X11_H_
#define XENIA_BASE_PLATFORM_X11_H_

// NOTE: if you're including this file it means you are explicitly depending
// on Linux headers. Including this file outside of linux platform specific
// source code will break portability

#include "xenia/base/platform.h"

// Xlib is used only for GLX interaction, the window management and input
// events are done with gtk/gdk
#include <X11/Xlib.h>
#include <X11/Xutil.h>
#include <X11/Xos.h>

//Used for window management. Gtk is for GUI and wigets, gdk is for lower
//level events like key presses, mouse events, etc
#include <gtk/gtk.h>
#include <gdk/gdk.h>

#endif  // XENIA_BASE_PLATFORM_X11_H_

/**
 ******************************************************************************
 * Xenia : Xbox 360 Emulator Research Project                                 *
 ******************************************************************************
 * Copyright 2015 Ben Vanik. All rights reserved.                             *
 * Released under the BSD license - see LICENSE in the root for more details. *
 ******************************************************************************
 */

#ifndef XENIA_BASE_PLATFORM_X11_H_
#define XENIA_BASE_PLATFORM_X11_H_

// NOTE: if you're including this file it means you are explicitly depending
// on Linux headers. Including this file outside of linux platform specific
// source code will break portability

#include "xenia/base/platform.h"

// Xlib/Xcb is used only for GLX/Vulkan interaction, the window management
// and input events are done with gtk/gdk
#include <X11/Xlib.h>
#include <X11/Xutil.h>
#include <X11/Xos.h>
#include <xcb/xcb.h>

//Used for window management. Gtk is for GUI and wigets, gdk is for lower
//level events like key presses, mouse events, etc
#include <gtk/gtk.h>
#include <gdk/gdk.h>

#endif  // XENIA_BASE_PLATFORM_X11_H_

Add xcb headers to linux platform, needed for vulkan


#ifndef SRC_GRAPHICS_BUFFER_LOCK_MANAGER_H_

#define SRC_GRAPHICS_BUFFER_LOCK_MANAGER_H_

#include <vector>
#include "./gl.h"

namespace Graphics
{

struct BufferRange
{
  size_t startOffset;
  size_t length;

  size_t endOffset() const
  {
    return startOffset + length;
  }

  bool overlaps(const BufferRange &other) const
  {
    return startOffset < other.endOffset() && other.startOffset < endOffset();
  }
};

struct BufferLock
{
  BufferRange range;
  GLsync syncObject;
};

/**
 * \brief
 *
 *
 */
class BufferLockManager
{
 public:
  explicit BufferLockManager(bool runUpdatesOnCPU);
  ~BufferLockManager();

  void initialize(Gl *gl);

  void waitForLockedRange(size_t lockBeginBytes, size_t lockLength);
  void lockRange(size_t lockBeginBytes, size_t lockLength);

 private:
  void wait(GLsync *syncObject);
  void cleanup(BufferLock *bufferLock);

  std::vector<BufferLock> bufferLocks;
  bool runUpdatesOnCPU;
  Gl *gl;
};

}  // namespace Graphics

#endif  // SRC_GRAPHICS_BUFFER_LOCK_MANAGER_H_

#ifndef SRC_GRAPHICS_BUFFER_LOCK_MANAGER_H_

#define SRC_GRAPHICS_BUFFER_LOCK_MANAGER_H_

#include <vector>
#include "./gl.h"

namespace Graphics
{

/**
 * \brief Encapsulates a locked buffer range
 *
 * It stores the start offset in the buffer and the length of the range.
 * The end offset can be retrieved with #endOffset().
 *
 * The method #overlaps() checks if the range overlaps with the
 * given range.
 */
struct BufferRange
{
  size_t startOffset;
  size_t length;

  size_t endOffset() const
  {
    return startOffset + length;
  }

  bool overlaps(const BufferRange &other) const
  {
    return startOffset < other.endOffset() && other.startOffset < endOffset();
  }
};

/**
 * \brief Lock on a buffer determined by \link BufferRange range \endlink and
 * a sync object
 */
struct BufferLock
{
  BufferRange range;
  GLsync syncObject;
};

/**
 * \brief Manages locks for a buffer
 *
 * Locks can be acquired with #lockRange() and #waitForLockedRange() waits until
 * the range is free again.
 */
class BufferLockManager
{
 public:
  explicit BufferLockManager(bool runUpdatesOnCPU);
  ~BufferLockManager();

  void initialize(Gl *gl);

  void waitForLockedRange(size_t lockBeginBytes, size_t lockLength);
  void lockRange(size_t lockBeginBytes, size_t lockLength);

 private:
  void wait(GLsync *syncObject);
  void cleanup(BufferLock *bufferLock);

  std::vector<BufferLock> bufferLocks;
  bool runUpdatesOnCPU;
  Gl *gl;
};

}  // namespace Graphics

#endif  // SRC_GRAPHICS_BUFFER_LOCK_MANAGER_H_

Add Documentation for BufferLockManger, BufferRange and BufferLock.


#include <objc/runtime.h>
#include <objc/message.h>
#include <stdio.h>
#include <dlfcn.h>
#include <string.h>

static void pyobjc_internal_init() {

    static void *foundation = NULL;
    if ( foundation == NULL ) {
        foundation = dlopen(
        "/Groups/System/Library/Frameworks/Foundation.framework/Versions/Current/Foundation", RTLD_LAZY);
        if ( foundation == NULL ) {
            printf("Got dlopen error on Foundation\n");
            return;
        }
    }
}

id allocAndInitAutoreleasePool() {
  Class NSAutoreleasePoolClass = (Class)objc_getClass("NSAutoreleasePool");
  id pool = class_createInstance(NSAutoreleasePoolClass, 0);
  return objc_msgSend(pool, sel_registerName("init"));
}

void drainAutoreleasePool(id pool) {
  (void)objc_msgSend(pool, sel_registerName("drain"));
}

#include <objc/runtime.h>
#include <objc/message.h>
#include <stdio.h>
#include <dlfcn.h>
#include <string.h>

static void pyobjc_internal_init() {

    static void *foundation = NULL;
    if ( foundation == NULL ) {
        foundation = dlopen(
        "/System/Library/Frameworks/Foundation.framework/Versions/Current/Foundation", RTLD_LAZY);
        if ( foundation == NULL ) {
            foundation = dlopen(
            "/Groups/System/Library/Frameworks/Foundation.framework/Versions/Current/Foundation", RTLD_LAZY);
            if ( foundation == NULL ) {
                printf("Got dlopen error on Foundation\n");
                return;
            }
        }
    }
}

id allocAndInitAutoreleasePool() {
  Class NSAutoreleasePoolClass = (Class)objc_getClass("NSAutoreleasePool");
  id pool = class_createInstance(NSAutoreleasePoolClass, 0);
  return objc_msgSend(pool, sel_registerName("init"));
}

void drainAutoreleasePool(id pool) {
  (void)objc_msgSend(pool, sel_registerName("drain"));
}

Add fallback path for Foundation lookup

Add fallback path for Foundation lookup


//
//  STMRecordingOverlayViewController.h
//  Pods
//
//  Created by Tyler Clemens on 9/14/15.
//
//

#import <UIKit/UIKit.h>
#import "VoiceCmdView.h"

@protocol STMRecordingOverlayDelegate;

@interface STMRecordingOverlayViewController : UIViewController<VoiceCmdViewDelegate, SendShoutDelegate>
@property (atomic) id<STMRecordingOverlayDelegate> delegate;
@property double MaxListeningSeconds;
@property NSString *tags;
@property NSString *topic;

-(void)userRequestsStopListening;
-(id)initWithTags:(NSString *)tags andTopic:(NSString *)topic;
@end

@protocol STMRecordingOverlayDelegate <NSObject>

-(void)shoutCreated:(STMShout*)shout error:(NSError*)err;
-(void)overlayClosed:(BOOL)bDismissed;
@end

//
//  STMRecordingOverlayViewController.h
//  Pods
//
//  Created by Tyler Clemens on 9/14/15.
//
//

#import <UIKit/UIKit.h>
#import "VoiceCmdView.h"

@protocol STMRecordingOverlayDelegate <CreateShoutDelegate>

-(void)overlayClosed:(BOOL)bDismissed;

@end

@interface STMRecordingOverlayViewController : UIViewController<VoiceCmdViewDelegate, SendShoutDelegate>
@property (atomic) id<STMRecordingOverlayDelegate> delegate;
@property double MaxListeningSeconds;
@property NSString *tags;
@property NSString *topic;

-(void)userRequestsStopListening;
-(id)initWithTags:(NSString *)tags andTopic:(NSString *)topic;

@end

Refactor STMRecordingOverlayDelegate to inherit from CreateShoutDelegate


// RUN: clang -fsyntax-only -verify %s
// RUN: clang -fsyntax-only -triple x86_64-apple-darwin9 -verify %s

int a[10];

int f0() {
  return __builtin_object_size(&a); // expected-error {{too few arguments to function}}
}
int f1() {
  return (__builtin_object_size(&a, 0) +
          __builtin_object_size(&a, 1) +
          __builtin_object_size(&a, 2) +
          __builtin_object_size(&a, 3));
}
int f2() {
  return __builtin_object_size(&a, -1); // expected-error {{argument should be a value from 0 to 3}}
}
int f3() {
  return __builtin_object_size(&a, 4); // expected-error {{argument should be a value from 0 to 3}}
}

// rdar://6252231 - cannot call vsnprintf with va_list on x86_64
void f4(const char *fmt, ...) {
 __builtin_va_list args;
 __builtin___vsnprintf_chk (0, 42, 0, 11, fmt, args);
}

// RUN: clang -fsyntax-only -verify %s &&
// RUN: clang -fsyntax-only -triple x86_64-apple-darwin9 -verify %s

int a[10];

int f0() {
  return __builtin_object_size(&a); // expected-error {{too few arguments to function}}
}
int f1() {
  return (__builtin_object_size(&a, 0) +
          __builtin_object_size(&a, 1) +
          __builtin_object_size(&a, 2) +
          __builtin_object_size(&a, 3));
}
int f2() {
  return __builtin_object_size(&a, -1); // expected-error {{argument should be a value from 0 to 3}}
}
int f3() {
  return __builtin_object_size(&a, 4); // expected-error {{argument should be a value from 0 to 3}}
}

// rdar://6252231 - cannot call vsnprintf with va_list on x86_64
void f4(const char *fmt, ...) {
 __builtin_va_list args;
 __builtin___vsnprintf_chk (0, 42, 0, 11, fmt, args);
}

Append the test runs with '&&'.

Append the test runs with '&&'.

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


//
//  AsyncTesting.h
//  ContentfulSDK
//
//  Created by Boris Bügling on 05/03/14.
//
//

// Set the flag for a block completion handler
#define StartBlock() __block BOOL waitingForBlock = YES

// Set the flag to stop the loop
#define EndBlock() waitingForBlock = NO

// Wait and loop until flag is set
#define WaitUntilBlockCompletes() WaitWhile(waitingForBlock)

// Macro - Wait for condition to be NO/false in blocks and asynchronous calls
#define WaitWhile(condition) \
do { \
NSDate* __startTime = [NSDate date]; \
while(condition) { \
[[NSRunLoop currentRunLoop] runMode:NSDefaultRunLoopMode beforeDate:[NSDate dateWithTimeIntervalSinceNow:0.1]]; \
if ([[NSDate date] timeIntervalSinceDate:__startTime] > 20.0) { \
XCTAssertFalse(true, @"Asynchronous test timed out."); \
break; \
} \
} \
} while(0)

//
//  AsyncTesting.h
//  ContentfulSDK
//
//  Created by Boris Bügling on 05/03/14.
//
//

// Set the flag for a block completion handler
#define StartBlock() __block BOOL waitingForBlock = YES

// Set the flag to stop the loop
#define EndBlock() waitingForBlock = NO

// Wait and loop until flag is set
#define WaitUntilBlockCompletes() WaitWhile(waitingForBlock)

// Macro - Wait for condition to be NO/false in blocks and asynchronous calls
#define WaitWhile(condition) \
do { \
NSDate* __startTime = [NSDate date]; \
while(condition) { \
[[NSRunLoop currentRunLoop] runMode:NSDefaultRunLoopMode beforeDate:[NSDate dateWithTimeIntervalSinceNow:0.1]]; \
if ([[NSDate date] timeIntervalSinceDate:__startTime] > 30.0) { \
XCTAssertFalse(true, @"Asynchronous test timed out."); \
break; \
} \
} \
} while(0)

Increase the asynchronous testing timeout

Hopefully will resolve Travis issues.


#ifndef _OBJC_MESSAGE_H_
#define _OBJC_MESSAGE_H_

#if defined(__x86_64) || defined(__i386) || defined(__arm__) || \
	defined(__mips_n64) || defined(__mips_n32)
/**
 * Standard message sending function.  This function must be cast to the
 * correct types for the function before use.  The first argument is the
 * receiver and the second the selector.
 *
 * Note that this function is not available on all architectures.  For a more
 * portable solution to sending arbitrary messages, consider using
 * objc_msg_lookup_sender() and then calling the returned IMP directly.
 *
 * This version of the function is used for all messages that return either an
 * integer, a pointer, or a small structure value that is returned in
 * registers.  Be aware that calling conventions differ between operating
 * systems even within the same architecture, so take great care if using this
 * function for small (two integer) structures.
 */
id objc_msgSend(id self, SEL _cmd, ...);
/**
 * Standard message sending function.  This function must be cast to the
 * correct types for the function before use.  The first argument is the
 * receiver and the second the selector.
 *
 * Note that this function is not available on all architectures.  For a more
 * portable solution to sending arbitrary messages, consider using
 * objc_msg_lookup_sender() and then calling the returned IMP directly.
 *
 * This version of the function is used for all messages that return a
 * structure that is not returned in registers.  Be aware that calling
 * conventions differ between operating systems even within the same
 * architecture, so take great care if using this function for small (two
 * integer) structures.
 */
#ifdef __cplusplus
id objc_msgSend_stret(id self, SEL _cmd, ...);
#else
void objc_msgSend_stret(id self, SEL _cmd, ...);
#endif
/**
 * Standard message sending function.  This function must be cast to the
 * correct types for the function before use.  The first argument is the
 * receiver and the second the selector.
 *
 * Note that this function is not available on all architectures.  For a more
 * portable solution to sending arbitrary messages, consider using
 * objc_msg_lookup_sender() and then calling the returned IMP directly.
 *
 * This version of the function is used for all messages that return floating
 * point values.
 */
long double objc_msgSend_fpret(id self, SEL _cmd, ...);

#endif

#endif //_OBJC_MESSAGE_H_

Fix clang's stupid warning to work around a bug in OS X headers...

git-svn-id: f6517e426f81db5247881cd92f7386583ace04fa@35962 72102866-910b-0410-8b05-ffd578937521


#ifndef RADIO_H_INCLUDED
#define RADIO_H_INCLUDED

#include <stdint.h>

#define RADIO_PACKET_MAX_LEN 64
#define RADIO_PACKET_BUFFER_SIZE 1

typedef enum
{
    PACKET_RECEIVED,
} radio_evt_type_t;

typedef struct
{
    uint8_t len;
    uint8_t data[RADIO_PACKET_MAX_LEN];
} radio_packet_t;

typedef struct
{
   radio_evt_type_t type;
   union
   {
       radio_packet_t packet;
   };
} radio_evt_t;

typedef void (radio_evt_handler_t)(radio_evt_t * evt);

uint32_t radio_init(radio_evt_handler_t * evt_handler);
uint32_t radio_send(radio_packet_t * packet);
uint32_t radio_receive_start(void);

#endif

#ifndef RADIO_H_INCLUDED
#define RADIO_H_INCLUDED

#include <stdint.h>

#define RADIO_PACKET_MAX_LEN 64
#define RADIO_PACKET_BUFFER_SIZE 1

typedef enum
{
    PACKET_RECEIVED,
} radio_evt_type_t;

typedef struct
{
    uint8_t len;
    struct __attribute__((packed))
    {
        uint8_t padding : 7;
        uint8_t ack : 1;
    } flags;
    uint8_t data[RADIO_PACKET_MAX_LEN];
} radio_packet_t;

typedef struct
{
   radio_evt_type_t type;
   union
   {
       radio_packet_t packet;
   };
} radio_evt_t;

typedef void (radio_evt_handler_t)(radio_evt_t * evt);

uint32_t radio_init(radio_evt_handler_t * evt_handler);
uint32_t radio_send(radio_packet_t * packet);
uint32_t radio_receive_start(void);

#endif

Add flag byte to packet structure.

Add flag byte to packet structure.


// RUN: %clang_cc1 -O3 -ffp-contract=fast -triple=powerpc-apple-darwin10 -S -o - %s | FileCheck %s
// REQUIRES: powerpc-registered-target

float fma_test1(float a, float b, float c) {
// CHECK: fmadds
  float x = a * b;
  float y = x + c;
  return y;
}

// RUN: %clang_cc1 -O3 -ffp-contract=fast -triple=aarch64-apple-darwin -S -o - %s | FileCheck %s
// REQUIRES: aarch64-registered-target

float fma_test1(float a, float b, float c) {
// CHECK: fmadd
  float x = a * b;
  float y = x + c;
  return y;
}

Change -ffp-contract=fast test to run on Aarch64

(I don't have powerpc enabled in my build and I am changing
how -ffp-contract=fast works.)

git-svn-id: ffe668792ed300d6c2daa1f6eba2e0aa28d7ec6c@298468 91177308-0d34-0410-b5e6-96231b3b80d8
(cherry picked from commit fa33394bb70481412493fcf40d53ebdb2e738058)


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

#ifndef FRUIT_CLASS_CONSTRUCTION_TRACKER_H
#define FRUIT_CLASS_CONSTRUCTION_TRACKER_H

/**
 * This class is useful to keep track of how many instances of a given type are created during the entire program
 * execution.
 *
 * Example use:
 *   class Foo : public ConstructionTracker<Foo> {
 *      ...
 *   };
 *
 *   int main() {
 *     ...
 *     assert(Foo::num_objects_constructed == 3);
 *   }
 */
template <typename T>
struct ConstructionTracker {
  static std::size_t num_objects_constructed;

  ConstructionTracker() {
    ++num_objects_constructed;
  }
};

template <typename T>
std::size_t ConstructionTracker<T>::num_objects_constructed = 0;

#endif // FRUIT_CLASS_CONSTRUCTION_TRACKER_H

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

#ifndef FRUIT_CLASS_CONSTRUCTION_TRACKER_H
#define FRUIT_CLASS_CONSTRUCTION_TRACKER_H

#include <cstddef>

/**
 * This class is useful to keep track of how many instances of a given type are created during the entire program
 * execution.
 *
 * Example use:
 *   class Foo : public ConstructionTracker<Foo> {
 *      ...
 *   };
 *
 *   int main() {
 *     ...
 *     assert(Foo::num_objects_constructed == 3);
 *   }
 */
template <typename T>
struct ConstructionTracker {
  static std::size_t num_objects_constructed;

  ConstructionTracker() {
    ++num_objects_constructed;
  }
};

template <typename T>
std::size_t ConstructionTracker<T>::num_objects_constructed = 0;

#endif // FRUIT_CLASS_CONSTRUCTION_TRACKER_H

Add a missing import to fix compilation of Fruit tests.


Test expsplit with multiple simultaneous splits


/* See LICENSE file for copyright and license details. */
#include <sys/types.h>

#ifndef NDEBUG
extern int debug;
#define DBG(fmt, ...) dbg(fmt, __VA_ARGS__)
#define DBGON() (debug = 1)
#else
#define DBG(...)
#define DBGON()
#endif

#ifndef PREFIX
#define PREFIX "/usr/local/"
#endif

#define TINT        long long
#define TUINT       unsigned long long
#define TFLOAT      double

struct items {
	char **s;
	unsigned n;
};

extern void die(const char *fmt, ...);
extern void dbg(const char *fmt, ...);
extern void newitem(struct items *items, char *item);
extern void *xmalloc(size_t size);
extern void *xcalloc(size_t nmemb, size_t size);
extern char *xstrdup(const char *s);
extern void *xrealloc(void *buff, register size_t size);

/* See LICENSE file for copyright and license details. */
#include <sys/types.h>

#ifndef NDEBUG
extern int debug;
#define DBG(...) dbg(__VA_ARGS__)
#define DBGON() (debug = 1)
#else
#define DBG(...)
#define DBGON()
#endif

#ifndef PREFIX
#define PREFIX "/usr/local/"
#endif

#define TINT        long long
#define TUINT       unsigned long long
#define TFLOAT      double

struct items {
	char **s;
	unsigned n;
};

extern void die(const char *fmt, ...);
extern void dbg(const char *fmt, ...);
extern void newitem(struct items *items, char *item);
extern void *xmalloc(size_t size);
extern void *xcalloc(size_t nmemb, size_t size);
extern char *xstrdup(const char *s);
extern void *xrealloc(void *buff, register size_t size);

Remove first parameter of DBG()

Remove first parameter of DBG()

This first parameter was disallowing use of DBG() without a second
parameter.


// cc dict_example.c dict.c

#include <assert.h>
#include <stdio.h>
#include <string.h>
#include "bool.h"
#include "dict.h"

int main(int argc, const char *argv[])
{
    /* allocate a new dict */
    struct dict *dict = dict();
    /* set key and values to dict */
    char *key1 = "key1";
    char *key2 = "key2";
    char *val1 = "val1";
    char *val2 = "val2";
    assert(dict_set(dict, key1, strlen(key1), val1) == DICT_OK);
    assert(dict_set(dict, key2, strlen(key2), val2) == DICT_OK);
    /* get dict length */
    assert(dict_len(dict) == 2);
    /* get data by key */
    assert(dict_get(dict, key1, strlen(key1)) == val1);
    assert(dict_get(dict, key2, strlen(key2)) == val2);
    /* iterate dict */
    struct dict_iter *iter = dict_iter(dict);
    struct dict_node *node = NULL;
    while ((node = dict_iter_next(iter)) != NULL) {
        printf("%.*s => %s\n", (int)node->len, node->key, node->val);
    }
    /* free dict iterator */
    dict_iter_free(iter);
    /* free the dict */
    dict_free(dict);
    return 0;
}

// cc dict_example.c dict.c md5.c

#include <assert.h>
#include <stdio.h>
#include <string.h>
#include "bool.h"
#include "dict.h"

int main(int argc, const char *argv[])
{
    /* allocate a new dict */
    struct dict *dict = dict();
    /* set key and values to dict */
    char *key1 = "key1";
    char *key2 = "key2";
    char *val1 = "val1";
    char *val2 = "val2";
    assert(dict_set(dict, key1, strlen(key1), val1) == DICT_OK);
    assert(dict_set(dict, key2, strlen(key2), val2) == DICT_OK);
    /* get dict length */
    assert(dict_len(dict) == 2);
    /* get data by key */
    assert(dict_get(dict, key1, strlen(key1)) == val1);
    assert(dict_get(dict, key2, strlen(key2)) == val2);
    /* iterate dict */
    struct dict_iter *iter = dict_iter(dict);
    struct dict_node *node = NULL;
    while ((node = dict_iter_next(iter)) != NULL) {
        printf("%.*s => %s\n", (int)node->len, node->key, (char *)node->val);
    }
    /* free dict iterator */
    dict_iter_free(iter);
    /* free the dict */
    dict_free(dict);
    return 0;
}

Fix void * casting to char * warning

Fix void * casting to char * warning


/*
 * Copyright 2016 Google Inc.
 *
 * Use of this source code is governed by a BSD-style license that can be
 * found in the LICENSE file.
 */
#ifndef SK_MILESTONE
#define SK_MILESTONE 100
#endif

/*
 * Copyright 2016 Google Inc.
 *
 * Use of this source code is governed by a BSD-style license that can be
 * found in the LICENSE file.
 */
#ifndef SK_MILESTONE
#define SK_MILESTONE 101
#endif

Update Skia milestone to 101

Update Skia milestone to 101

Change-Id: I78fd07c10a8dd3ff76b6040109afdf4b47b69eb0
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/510656
Reviewed-by: Heather Miller <2e22000c5d22374561fe5fba576a31095b72dc2e@google.com>
Auto-Submit: Heather Miller <2e22000c5d22374561fe5fba576a31095b72dc2e@google.com>
Reviewed-by: Eric Boren <0e499112533c8544f0505ea0d08394fb5ad7d8fa@google.com>
Commit-Queue: Eric Boren <0e499112533c8544f0505ea0d08394fb5ad7d8fa@google.com>


/*
Problem Statement

There are N integers in an array A. All but one integer occur in pairs. Your task is to find the number that occurs only once.

Input Format

The first line of the input contains an integer N, indicating the number of integers. The next line contains N space-separated integers that form the array A.

Constraints

1≤N<100
N % 2=1 (N is an odd number)
0≤A[i]≤100,∀i∈[1,N]
Output Format

Output S, the number that occurs only once.

Sample Input:1

1
1
Sample Output:1

1
Sample Input:2

3
1 1 2
Sample Output:2

2
Sample Input:3

5
0 0 1 2 1
Sample Output:3

2
Explanation

In the first input, we see only one element (1) and that element is the answer.
In the second input, we see three elements; 1 occurs at two places and 2 only once. Thus, the answer is 2.
In the third input, we see five elements. 1 and 0 occur twice. The element that occurs only once is 2.
*/
#include <stdio.h>
#include <string.h>
#include <math.h>
#include <stdlib.h>
#include <assert.h>
int lonelyinteger(int a_size, int* a) {
    int result;
    result = 0;
    for(int i=0 ; i<a_size ; i++){
        result = result ^ a[i];
    }
return result;

}
int main() {
    int res;

    int _a_size, _a_i;
    scanf("%d", &_a_size);
    int _a[_a_size];
    for(_a_i = 0; _a_i < _a_size; _a_i++) {
        int _a_item;
        scanf("%d", &_a_item);

        _a[_a_i] = _a_item;
    }

    res = lonelyinteger(_a_size, _a);
    printf("%d", res);

    return 0;
}

Add Bit Manipulation to find lonely integer by XOR trick


/**
 * Exposes non-public interfaces between the components of the library for
 * internal use
 */
#ifndef BUGSNAG_PRIVATE_H
#define BUGSNAG_PRIVATE_H

#import "Bugsnag.h"
#import "BugsnagBreadcrumb.h"

@interface BugsnagBreadcrumbs ()
/**
 * Reads and return breadcrumb data currently stored on disk
 */
- (NSArray *_Nullable)cachedBreadcrumbs;
@end

@interface Bugsnag ()

/** Get the current Bugsnag configuration.
 *
 * This method returns nil if called before +startBugsnagWithApiKey: or
 * +startBugsnagWithConfiguration:, and otherwise returns the current
 * configuration for Bugsnag.
 *
 * @return The configuration, or nil.
 */
+ (BugsnagConfiguration *_Nullable)configuration;

@end

#endif // BUGSNAG_PRIVATE_H

Add description to internal header

doc: Add description to internal header


//
//  HLError.h
//  HLSpriteKit
//
//  Created by Karl Voskuil on 6/6/14.
//  Copyright (c) 2014 Hilo Games. All rights reserved.
//

#import <Foundation/Foundation.h>

/**
 The error level for logging non-critical errors using `HLError()`.
*/
typedef NS_ENUM(NSInteger, HLErrorLevel) {
  /**
   Errors.
  */
  HLLevelError,
  /**
   Warnings.
  */
  HLLevelWarning,
  /**
   Information.
  */
  HLLevelInfo,
};

/**
 Logs a non-critical error.
*/
static void
HLError(HLErrorLevel level, NSString *message)
{
  // TODO: This is a placeholder for a better mechanism for non-critical error logging,
  // e.g. CocoaLumberjack.
  NSString *levelLabel;
  switch (level) {
    case HLLevelInfo:
      levelLabel = @"INFO";
      break;
    case HLLevelWarning:
      levelLabel = @"WARNING";
      break;
    case HLLevelError:
      levelLabel = @"ERROR";
      break;
  }
  NSLog(@"%@: %@", levelLabel, message);
}

//
//  HLError.h
//  HLSpriteKit
//
//  Created by Karl Voskuil on 6/6/14.
//  Copyright (c) 2014 Hilo Games. All rights reserved.
//

#import <Foundation/Foundation.h>

/**
 The error level for logging non-critical errors using `HLError()`.
*/
typedef NS_ENUM(NSInteger, HLErrorLevel) {
  /**
   Errors.
  */
  HLLevelError,
  /**
   Warnings.
  */
  HLLevelWarning,
  /**
   Information.
  */
  HLLevelInfo,
};

/**
 Logs a non-critical error.
*/
static inline void
HLError(HLErrorLevel level, NSString *message)
{
  // TODO: This is a placeholder for a better mechanism for non-critical error logging,
  // e.g. CocoaLumberjack.
  NSString *levelLabel;
  switch (level) {
    case HLLevelInfo:
      levelLabel = @"INFO";
      break;
    case HLLevelWarning:
      levelLabel = @"WARNING";
      break;
    case HLLevelError:
      levelLabel = @"ERROR";
      break;
  }
  NSLog(@"%@: %@", levelLabel, message);
}

Fix compiler warning for unused function.


//
//  Set.h
//  Set
//
//  Created by Rob Rix on 2014-06-22.
//  Copyright (c) 2014 Rob Rix. All rights reserved.
//

#import <Cocoa/Cocoa.h>

//! Project version number for Set.
FOUNDATION_EXPORT double SetVersionNumber;

//! Project version string for Set.
FOUNDATION_EXPORT const unsigned char SetVersionString[];

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

//  Copyright (c) 2014 Rob Rix. All rights reserved.

/// Project version number for Set.
extern double SetVersionNumber;

/// Project version string for Set.
extern const unsigned char SetVersionString[];

Tidy up the umbrella header.

Tidy up the umbrella header.


#include <ljit/types.h>

ljit_value ljit_new_value(ljit_types type)
{
    ljit_value val = NULL;

    if ((val = malloc(sizeof(ljit_value))) == NULL)
        return NULL;

    val->type = type;
    val->is_cst = 0;
    val->is_tmp = 0;
    val->index = 0;
    val->data = NULL;

    return val;
}

void ljit_free_value(ljit_value value)
{
    if (!value)
        return;

     free(value->data);
     free(value);
}

ljit_value ljit_new_uchar_cst(ljit_uchar value)
{
    ljit_value cst = ljit_new_value(LJIT_UCHAR);
    ljit_uchar *val = NULL;

    if (!cst)
        return NULL;

    if ((val = malloc(sizeof(ljit_uchar))) == NULL)
    {
        ljit_free_value(cst);
        return NULL;
    }

    *val = value;
    cst->data = val;
    cst->is_cst = 1;

    return cst;
}

#include <ljit/types.h>

ljit_value ljit_new_value(ljit_types type)
{
    ljit_value val = NULL;

    if ((val = malloc(sizeof(struct ljit_value_s))) == NULL)
        return NULL;

    val->type = type;
    val->is_cst = 0;
    val->is_tmp = 0;
    val->index = 0;
    val->data = NULL;

    return val;
}

void ljit_free_value(ljit_value value)
{
    if (!value)
        return;

     free(value->data);
     free(value);
}

ljit_value ljit_new_uchar_cst(ljit_uchar value)
{
    ljit_value cst = ljit_new_value(LJIT_UCHAR);
    ljit_uchar *val = NULL;

    if (!cst)
        return NULL;

    if ((val = malloc(sizeof(ljit_uchar))) == NULL)
    {
        ljit_free_value(cst);
        return NULL;
    }

    *val = value;
    cst->data = val;
    cst->is_cst = 1;

    return cst;
}

[CORE] Fix allocation issues on ljit_new_value()


/* Copyright (c) 2017 Rolf Timmermans */
#pragma once

#include <napi.h>
#include <zmq.h>
#include <node.h>
#include <cassert>
#include <iostream>

#include "inline/arguments.h"
#include "inline/error.h"
#include "inline/util.h"

#ifdef __MSVC__
#define force_inline inline __forceinline
#else
#define force_inline inline __attribute__((always_inline))
#endif

/* Copyright (c) 2017 Rolf Timmermans */
#pragma once

#include <napi.h>

#include <zmq.h>
#if ZMQ_VERSION < ZMQ_MAKE_VERSION(4,1,0)
#   include <zmq_utils.h>
#endif

#include <node.h>
#include <cassert>

#include "inline/arguments.h"
#include "inline/error.h"
#include "inline/util.h"

#ifdef __MSVC__
#define force_inline inline __forceinline
#else
#define force_inline inline __attribute__((always_inline))
#endif

Include zmq utils if necessary.

Include zmq utils if necessary.


#pragma once
#include <stddef.h> // size_t definition

#include <tasm/bytes.h>
#include <tasm/private/execute.h>
#include <tasm/private/byte_string.h>
#include <tasm/private/foldable.h>
#include <tasm/private/label.h>
#include <tasm/private/state.h>

namespace tasm {

/**
    Convert an Asm program into machine code.
*/
template <typename program>
using assemble = typename details::call<
    program,
    state::pass2state<typename details::call<program, state::pass1state>::first>>::second;

/**
    Assembly function wrapper.
*/
template <typename R, typename P>
struct AsmProgram {
    using program = P;

    template <typename... Args>
    R operator()(Args... args) {
        return ((R(*)(std::decay_t<Args>...))P::data)(args...);
    }
};

/**
    Block of assembly code.
*/
template <typename x, typename... xs>
constexpr auto block(x, xs...) {
    return execute::seq<x, xs...>{};
}

/**
    Create a top level assembly function.
*/
template <typename R, typename x, typename... xs>
constexpr auto Asm(x, xs...) {
    return AsmProgram<R, assemble<execute::seq<x, xs...>>>();
}

} // tasm

#pragma once
#include <stddef.h> // size_t definition

#include <tasm/bytes.h>
#include <tasm/private/execute.h>
#include <tasm/private/byte_string.h>
#include <tasm/private/foldable.h>
#include <tasm/private/label.h>
#include <tasm/private/state.h>

namespace tasm {

/**
    Convert an Asm program into machine code.
*/
template <typename program>
using assemble = typename details::call<
    program,
    state::pass2state<typename details::call<program, state::pass1state>::first>>::second;

/**
    Assembly function wrapper.
*/
template <typename R, typename P>
struct AsmProgram {
    using program = P;

    template <typename... Args>
    R operator()(Args... args) {
        return reinterpret_cast<R(*)(std::decay_t<Args>...)>(const_cast<char*>(P::data))(args...);
    }
};

/**
    Block of assembly code.
*/
template <typename x, typename... xs>
constexpr auto block(x, xs...) {
    return execute::seq<x, xs...>{};
}

/**
    Create a top level assembly function.
*/
template <typename R, typename x, typename... xs>
constexpr auto Asm(x, xs...) {
    return AsmProgram<R, assemble<execute::seq<x, xs...>>>();
}

} // tasm

Fix remaining cast alignment warnings through the magic of casting


#ifndef GRAPHICSDLL_GRAPHICSCOMPONENT_H
#define GRAPHICSDLL_GRAPHICSCOMPONENT_H

#include <DirectXMath.h>

struct GraphicsComponent
{
	int active = 0;
	int modelID = -1;
	DirectX::XMMATRIX worldMatrix;
};

struct penis
{
	int active = 0;
	int modelID = -1;
	int joints = 0;
	DirectX::XMMATRIX worldMatrix;

	DirectX::XMMATRIX finalTransforms[32];
};

struct UIComponent
{
	int active = 0;
	int spriteID = -1;
	bool wasClicked = false;
	DirectX::XMFLOAT2 position = DirectX::XMFLOAT2(0.0f, 0.0f);
	DirectX::XMFLOAT2 size = DirectX::XMFLOAT2(10.0f, 10.0f);
};
#endif

#ifndef GRAPHICSDLL_GRAPHICSCOMPONENT_H
#define GRAPHICSDLL_GRAPHICSCOMPONENT_H

#include <d3d11.h>
#include <DirectXMath.h>

struct GraphicsComponent
{
	int active = 0;
	int modelID = -1;
	DirectX::XMMATRIX worldMatrix;
};

struct penis
{
	int active = 0;
	int modelID = -1;
	int joints = 0;
	DirectX::XMMATRIX worldMatrix;

	DirectX::XMMATRIX finalTransforms[32];
};

struct UIComponent
{
	int active = 0;
	int spriteID = -1;
	bool wasClicked = false;
	DirectX::XMFLOAT2 position = DirectX::XMFLOAT2(0.0f, 0.0f);
	DirectX::XMFLOAT2 size = DirectX::XMFLOAT2(10.0f, 10.0f);

	void UpdateClicked(DirectX::XMFLOAT2 mousePos, DirectX::XMFLOAT2 windowSize)
	{
		float mouseX = mousePos.x - (GetSystemMetrics(SM_CXSCREEN) - windowSize.x) / 2;
		float mouseY = mousePos.y - (GetSystemMetrics(SM_CYSCREEN) - windowSize.y) / 2;

		if ((mouseX > this->position.x - this->size.x && mouseX < this->position.x + this->size.x)
			&& (mouseY > this->position.y - this->size.y && mouseY < this->position.y + this->size.y)) {
			this->wasClicked = true;
		}
	}
	bool CheckClicked()
	{
		if (this->wasClicked)
		{
			this->wasClicked = false;
			return true;
		}
		else {
			return false;
		}
	}
};
#endif

ADD clicked functionallity in UIComponent


#ifndef __DEBUG_H__
#define __DEBUG_H__

#undef ENABLE_DEBUG

#ifdef ENABLE_DEBUG
#include <sstream>
#define DBG(x...) \
        do {\
            std::cout<< "DBG " << x << std::endl;\
        } while(0)
#define DBGHEXTOSTRING(_b, _size) \
    do { \
        char *b = (char*)(_b);\
        uint64_t size = (uint64_t) (_size);\
        DBG(" size: "<< size); \
        std::stringstream stream; \
        for (uint64_t i = 0; i<size; i++) { \
            stream << std::hex << int(b[i]); \
        } \
        DBG( stream.str() ); \
    } while(0)
#else
#define DBG(x...)
#define DBGHEXTOSTRING(b,size)
#endif

#endif /* __DEBUG_H__ */

#ifndef __DEBUG_H__
#define __DEBUG_H__

#undef ENABLE_DEBUG

#ifdef ENABLE_DEBUG

#include <sstream>

#if __STDC_VERSION__ < 199901L
# if __GNUC__ >= 2
#  define __func__ __FUNCTION__
# else
#  define __func__ "<unknown>"
# endif
#endif

#define DBG(x...) \
        do {\
            std::cout<< "DBG " << __func__ << ": " << x << std::endl;\
        } while(0)

#define DBGHEXTOSTRING(_b, _size) \
    do { \
        char *b = (char*)(_b);\
        uint64_t size = (uint64_t) (_size);\
        DBG(" size: "<< size); \
        std::stringstream stream; \
        for (uint64_t i = 0; i<size; i++) { \
            stream << std::hex << int(b[i]); \
        } \
        DBG( stream.str() ); \
    } while(0)

#else

#define DBG(x...)
#define DBGHEXTOSTRING(b,size)

#endif

#endif /* __DEBUG_H__ */

Print function name at DBG

Print function name at DBG


// SKIP PARAM: --set ana.activated[+] apron
#include <pthread.h>
#include <assert.h>

int g = 1;
int h = 1;
pthread_mutex_t A = PTHREAD_MUTEX_INITIALIZER;

void *t_fun(void *arg) {
  int x, y; // rand
  pthread_mutex_lock(&A);
  g = x;
  h = x;
  pthread_mutex_unlock(&A);
  pthread_mutex_lock(&A);
  pthread_mutex_unlock(&A);
  pthread_mutex_lock(&A);
  if (y)
    g = x;
  assert(g == h); // UNKNOWN?
  pthread_mutex_unlock(&A);
  return NULL;
}

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

  return 0;
}

Add TD3 test where complex self-abort causes verify error


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

namespace tango_helper {
// The minimum Tango Core version required from this application.
const int TANGO_CORE_MINIMUM_VERSION = 11926; // Yildun release.

// Checks the installed version of the TangoCore. If it is too old, then
// it will not support the most up to date features.
// @return returns true if tango version if supported.
bool IsTangoVersionOk(JNIEnv* env, jobject activity);
// Binds to the tango service.
// @return returns true if setting the binder ended successfully.
bool SetBinder(JNIEnv* env, jobject binder);
} // tango_helper

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

// Helper functions that need to be separated from the tango_ros_native package to get rif of the
// jni dependency, so that the tango_ros_native package can be used for Android and Linux.
namespace tango_helper {
// The minimum Tango Core version required from this application.
const int TANGO_CORE_MINIMUM_VERSION = 11926; // Yildun release.

// Checks the installed version of the TangoCore. If it is too old, then
// it will not support the most up to date features.
// @return returns true if tango version if supported.
bool IsTangoVersionOk(JNIEnv* env, jobject activity);
// Binds to the tango service.
// @return returns true if setting the binder ended successfully.
bool SetBinder(JNIEnv* env, jobject binder);
} // tango_helper

Add comment to explain need of separate helper functions


#include <pthread.h>
#include <assert.h>

int g = 0;

pthread_mutex_t A = PTHREAD_MUTEX_INITIALIZER;
pthread_mutex_t B = PTHREAD_MUTEX_INITIALIZER;

void *worker(void *arg )
{
  while (1) {
    pthread_mutex_lock(&A);
    g = 1000;
    assert(g != 0);
    if (g > 0) {
      g--;
    }
    pthread_mutex_unlock(&A);
    // extra mutex makes mine-W more precise than mine-lazy
    pthread_mutex_lock(&B);
    pthread_mutex_unlock(&B);
  }
  return NULL;
}

int main(int argc , char **argv )
{
  pthread_t tid;
  pthread_create(& tid, NULL, & worker, NULL);
  return 0;
}

Add further simplification of 13/51

Add further simplification of 13/51


/*
 * Copyright 2016 Google Inc.
 *
 * Use of this source code is governed by a BSD-style license that can be
 * found in the LICENSE file.
 */

#ifndef SkExchange_DEFINED
#define SkExchange_DEFINED

#include <utility>

namespace skstd {

// std::exchange is in C++14
template<typename T, typename U = T>
inline static T exchange(T& obj, U&& new_val) {
    T old_val = std::move(obj);
    obj = std::forward<U>(new_val);
    return old_val;
}

}

#endif  // SkExchange_DEFINED

Add skstd version of std::exchange

Add skstd version of std::exchange

BUG=skia:
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2381793004

Review-Url: https://codereview.chromium.org/2381793004


#pragma once

#include <cstddef>

namespace util {

// The interface is tuned for reuse and avoids boilerplate length calculations.
// Looking at implementation examples helps understand the decisions behind it.

// Serialization functions should not throw.

// Upon success, serialize functions shall return end of serialized data.
// Otherwise, nullptr shall be returned, indicating insufficinet destination capacity.
using serializeFunc = void* (*)(void* dest, const void* destEnd, const void* obj);

// Upon success, deserialize function shall return end of consumed src. Otherwise, nullptr shall be returned.
using deserializeFunc = const void* (*)(void* sharedDest, const void* src, const void* srcEnd);

} // namespace util

#pragma once

namespace util {
namespace serde {

// The interface is tuned for reuse and avoids boilerplate length calculations.
// Looking at implementation examples helps understand the decisions behind it.

// Serialization functions should not throw.

// Upon success, serialize functions shall return end of serialized data.
// Otherwise, nullptr shall be returned, indicating insufficinet destination capacity.
using serializeFun = void* (*)(void* dest, const void* destEnd, const void* obj);

// Upon success, deserialize function shall return end of consumed src. Otherwise, nullptr shall be returned.
using deserializeFun = const void* (*)(void* sharedDest, const void* src, const void* srcEnd);

} // namespace serde
} // namespace util

Move serialization interface into sub namespace


//----------------------------  tests.h  ---------------------------
//    $Id$
//    Version: $Name$
//
//    Copyright (C) 2004 by the deal.II authors
//
//    This file is subject to QPL and may not be  distributed
//    without copyright and license information. Please refer
//    to the file deal.II/doc/license.html for the  text  and
//    further information on this license.
//
//----------------------------  tests.h  ---------------------------

// common definitions used in all the tests

#include <base/logstream.h>
#include <cmath>

// overload floating point output operators for LogStream so that small
// numbers below a certain threshold are simply printed as zeros. this removes
// a number of possible places where output may differ depending on platform,
// compiler options, etc, simply because round-off is different.
LogStream & operator << (LogStream &logstream,
                         const double d)
{
  if (std::fabs (d) < 1e-10)
    logstream << 0.;
  else
    logstream << d;
  return logstream;
}

LogStream & operator << (LogStream &logstream,
                         const float d)
{
  if (std::fabs (d) < 1e-8)
    logstream << 0.;
  else
    logstream << d;
  return logstream;
}

Add a file with common definitions to be used by all testcases.

git-svn-id: 31d9d2f6432a47c86a3640814024c107794ea77c@8395 0785d39b-7218-0410-832d-ea1e28bc413d


/*
 * Copyright (c) 2017 Contributors as noted in the AUTHORS file
 *
 * This file is part of Solo5, a unikernel base layer.
 *
 * Permission to use, copy, modify, and/or distribute this software
 * for any purpose with or without fee is hereby granted, provided
 * that the above copyright notice and this permission notice appear
 * in all copies.
 *
 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
 * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
 * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
 * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR
 * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
 * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
 * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
 * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 */

#include "../kernel.h"
#include "muen-net.h"

int solo5_poll(uint64_t until_nsecs)
{
    int rc = 0;
    do {
        if (muen_net_pending_data()) {
            rc = 1;
            break;
        }
        __asm__ __volatile__("pause");
    } while (solo5_clock_monotonic() < until_nsecs);

    if (muen_net_pending_data()) {
        rc = 1;
    }

    return rc;
}

Add poll implementation for Muen

Add poll implementation for Muen


#ifndef GENE_H
#define GENE_H

#include <map>
#include <string>
#include <iosfwd>

class Board;
class Piece_Strength_Gene;

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

        void read_from(std::istream& is);

        void mutate();
        double evaluate(const Board& board) const;
        virtual Gene* duplicate() const = 0;

        virtual std::string name() const = 0;
        void print(std::ostream& os) const;

        virtual void reset_piece_strength_gene(const Piece_Strength_Gene* psg);

    protected:
        mutable std::map<std::string, double> properties; // used to simplify reading/writing from/to files
        virtual void reset_properties() const;
        virtual void load_properties();
        void make_priority_non_negative();

    private:
        virtual double score_board(const Board& board) const = 0;
        void throw_on_invalid_line(const std::string& line, const std::string& reason) const;
        virtual void gene_specific_mutation();

        double priority;
        bool priority_non_negative;
};

#endif // GENE_H

#ifndef GENE_H
#define GENE_H

#include <map>
#include <string>
#include <iosfwd>

class Board;
class Piece_Strength_Gene;

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

        void read_from(std::istream& is);

        void mutate();
        double evaluate(const Board& board) const;
        virtual Gene* duplicate() const = 0;

        virtual std::string name() const = 0;
        void print(std::ostream& os) const;

        virtual void reset_piece_strength_gene(const Piece_Strength_Gene* psg);

    protected:
        mutable std::map<std::string, double> properties; // used to simplify reading/writing from/to files
        virtual void reset_properties() const;
        virtual void load_properties();
        void make_priority_non_negative();

    private:
        virtual double score_board(const Board& board) const = 0;
        [[noreturn]] void throw_on_invalid_line(const std::string& line, const std::string& reason) const;
        virtual void gene_specific_mutation();

        double priority;
        bool priority_non_negative;
};

#endif // GENE_H

Add [[noreturn]] to pure throwing method


/* IN DEVELOPMENT.  DO NOT SHIP. */

#ifndef __XGLINTELEXT_H__
#define __XGLINTELEXT_H__

#include <xcb/xcb.h>
#include <xcb/randr.h>
#include "xgl.h"

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

typedef enum _XGL_INTEL_STRUCTURE_TYPE
{
    XGL_INTEL_STRUCTURE_TYPE_SHADER_CREATE_INFO             = 1000,
} XGL_INTEL_STRUCTURE_TYPE;

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

#endif // __XGLINTELEXT_H__

/* IN DEVELOPMENT.  DO NOT SHIP. */

#ifndef __XGLINTELEXT_H__
#define __XGLINTELEXT_H__

#include <xcb/xcb.h>
#include <xcb/randr.h>
#include "xgl.h"

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

typedef enum _XGL_INTEL_STRUCTURE_TYPE
{
    XGL_INTEL_STRUCTURE_TYPE_SHADER_CREATE_INFO             = 1000,
} XGL_INTEL_STRUCTURE_TYPE;

typedef struct _XGL_INTEL_COMPILE_GLSL
{
    XGL_PIPELINE_SHADER_STAGE       stage;
    const char                     *pCode;
} XGL_INTEL_COMPILE_GLSL;

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

#endif // __XGLINTELEXT_H__

intel: Add shader structure for GLSL compile extension


//
//  LJSStop.h
//  LJSYourNextBus
//
//  Created by Luke Stringer on 29/01/2014.
//  Copyright (c) 2014 Luke Stringer. All rights reserved.
//

#import <Foundation/Foundation.h>

@interface LJSStop : NSObject <NSCopying>

@property (nonatomic, copy, readonly) NSString *NaPTANCode;
@property (nonatomic, copy, readonly) NSString *title;
@property (nonatomic, copy, readonly) NSDate *liveDate;
@property (nonatomic, copy, readonly) NSArray *services;

- (BOOL)isEqualToStop:(LJSStop *)stop;

@end

//
//  LJSStop.h
//  LJSYourNextBus
//
//  Created by Luke Stringer on 29/01/2014.
//  Copyright (c) 2014 Luke Stringer. All rights reserved.
//

#import <Foundation/Foundation.h>

@interface LJSStop : NSObject <NSCopying>

/**
 *  An 8 digit stop number starting with e.g. 450 for West Yorkshire or 370 for South Yorkshire
 */
@property (nonatomic, copy, readonly) NSString *NaPTANCode;
@property (nonatomic, copy, readonly) NSString *title;
@property (nonatomic, copy, readonly) NSDate *liveDate;
@property (nonatomic, copy, readonly) NSArray *services;

- (BOOL)isEqualToStop:(LJSStop *)stop;

@end

Comment explaining what a valid NaPTAN code is.


// Copyright 2016 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 MINI_CHROMIUM_BASE_METRICS_HISTOGRAM_FUNCTIONS_H_
#define MINI_CHROMIUM_BASE_METRICS_HISTOGRAM_FUNCTIONS_H_

#include <string>

// These are no-op stub versions of a subset of the functions from Chromium's
// base/metrics/histogram_functions.h. This allows us to instrument the Crashpad
// code as necessary, while not affecting out-of-Chromium builds.
namespace base {

void UmaHistogramSparse(const std::string& name, int sample) {}

}  // namespace base

#endif  // MINI_CHROMIUM_BASE_METRICS_HISTOGRAM_FUNCTIONS_H_

Add missing newline at EOF after d1943e187f47

Change-Id: I7d7735791aa565edca162d8c683bd272bbcfaa52
Reviewed-on: https://chromium-review.googlesource.com/827592
Reviewed-by: Mark Mentovai <f1b5a91d4d6ad523f2610114591c007e75d15084@chromium.org>


#ifndef MICROPYTHON_WRAP_UTIL_H
#define MICROPYTHON_WRAP_UTIL_H

#include "detail/micropython.h"

namespace upywrap
{
  inline std::string ExceptionToString( mp_obj_t ex )
  {
    std::string exMessage;
    const mp_print_t mp_my_print{ &exMessage, [] ( void* data, const char* str, mp_uint_t len ) { ( (std::string*) data )->append( str, len ); } };
    mp_obj_print_exception( &mp_my_print, ex );
    return exMessage;
  }
}

#endif //#ifndef MICROPYTHON_WRAP_UTIL_H

#ifndef MICROPYTHON_WRAP_UTIL_H
#define MICROPYTHON_WRAP_UTIL_H

#include "detail/micropython.h"

namespace upywrap
{
  inline mp_print_t PrintToString( std::string& dest )
  {
    return mp_print_t{ &dest, [] ( void* data, const char* str, mp_uint_t len ) { ( (std::string*) data )->append( str, len ); } };
  }

  inline std::string ExceptionToString( mp_obj_t ex )
  {
    std::string exMessage;
    const auto mp_my_print( PrintToString( exMessage ) );
    mp_obj_print_exception( &mp_my_print, ex );
    return exMessage;
  }

  inline std::string VariableValueToString( mp_obj_t obj, mp_print_kind_t kind = PRINT_REPR )
  {
    std::string var;
    const auto mp_my_print( PrintToString( var ) );
    mp_obj_print_helper( &mp_my_print, obj, kind );
    return var;
  }
}

#endif //#ifndef MICROPYTHON_WRAP_UTIL_H

Add function for getting a variable's string representation


// Copyright 2014 Tanel Lebedev

#ifndef SRC_EXPLICIT_SCOPED_LOCK_H_
#define SRC_EXPLICIT_SCOPED_LOCK_H_

#include <string>
#include <sstream>

#include "Poco/Logger.h"

namespace kopsik {

class ExplicitScopedLock : public Poco::Mutex::ScopedLock {
   public:
    ExplicitScopedLock(
      const std::string context,
      Poco::Mutex& mutex) :
        Poco::Mutex::ScopedLock(mutex),
        context_(context) {
      std::stringstream text;
      text << context_ << " locking";
      logger().debug(text.str());
    }

    ~ExplicitScopedLock() {
      std::stringstream text;
      text << context_ << " unlocking";
      logger().debug(text.str());
    }

   private:
    Poco::Logger &logger() { return Poco::Logger::get("lock"); }

    std::string context_;
};

}  // namespace kopsik

#endif  // SRC_EXPLICIT_SCOPED_LOCK_H_

// Copyright 2014 Tanel Lebedev

#ifndef SRC_EXPLICIT_SCOPED_LOCK_H_
#define SRC_EXPLICIT_SCOPED_LOCK_H_

#include <string>
#include <sstream>

#include "Poco/Logger.h"

namespace kopsik {

class ExplicitScopedLock : public Poco::Mutex::ScopedLock {
   public:
    ExplicitScopedLock(
      const std::string context,
      Poco::Mutex& mutex) :
        Poco::Mutex::ScopedLock(mutex),
        context_(context) {
      std::stringstream text;
      text << context_ << " locking";
      logger().trace(text.str());
    }

    ~ExplicitScopedLock() {
      std::stringstream text;
      text << context_ << " unlocking";
      logger().trace(text.str());
    }

   private:
    Poco::Logger &logger() { return Poco::Logger::get("lock"); }

    std::string context_;
};

}  // namespace kopsik

#endif  // SRC_EXPLICIT_SCOPED_LOCK_H_

Print out locking/unlocking with trace only


#ifndef __TYPES_H__
#define __TYPES_H__

typedef long        off_t;
typedef unsigned long size_t;
typedef signed long   ssize_t;      /* Used for a count of bytes or an error indication. */

typedef unsigned char  u_char;
typedef unsigned short u_short;
typedef unsigned int   u_int;
typedef unsigned long  u_long;

typedef int mode_t;

typedef unsigned long clockid_t;
typedef int pid_t;

#ifndef NULL
#define NULL        (0)
#endif

#define __u_char_defined

#endif

#ifndef __TYPES_H__
#define __TYPES_H__

typedef long        off_t;
typedef unsigned long size_t;
typedef signed long   ssize_t;      /* Used for a count of bytes or an error indication. */

typedef unsigned char  u_char;
typedef unsigned short u_short;
typedef unsigned int   u_int;
typedef unsigned long  u_long;

typedef int mode_t;

typedef unsigned long clockid_t;
typedef int pid_t;

typedef	unsigned long clock_t; /* clock() */

#ifndef NULL
#define NULL        (0)
#endif

#define __u_char_defined

#endif

Add type 'clock_t' to minilibc.

[Libc][Minilibc] Add type 'clock_t' to minilibc.


#pragma once

#include <libevm/VMFace.h>
#include <evmjit/libevmjit/ExecutionEngine.h>

namespace dev
{
namespace eth
{

class JitVM: public VMFace
{
public:
	virtual bytesConstRef execImpl(u256& io_gas, ExtVMFace& _ext, OnOpFunc const& _onOp = {}, uint64_t _steps = (uint64_t)-1) override final;

private:
	jit::RuntimeData m_data;
	jit::ExecutionEngine m_engine;
	std::unique_ptr<VMFace> m_fallbackVM; ///< VM used in case of input data rejected by JIT
};

}
}

#pragma once

#include <libevm/VMFace.h>
#include <evmjit/libevmjit/ExecutionEngine.h>

namespace dev
{
namespace eth
{

class JitVM: public VMFace
{
public:
	virtual bytesConstRef execImpl(u256& io_gas, ExtVMFace& _ext, OnOpFunc const& _onOp, uint64_t _steps) override final;

private:
	jit::RuntimeData m_data;
	jit::ExecutionEngine m_engine;
	std::unique_ptr<VMFace> m_fallbackVM; ///< VM used in case of input data rejected by JIT
};

}
}

Change the way execution results are collected.

Changes handling ExecutionResult by Executive. From now execution results are collected on if a storage for results (ExecutionResult) is provided to an Executiove instance up front. This change allow better output management for calls - VM interface improved.


#include <wiringPi.h>
#include <stdio.h>
#include <stdlib.h>
#include "PCD8544.h"

int pin_sclk = 4;
int pin_din = 3;
int pin_dc = 2;
int pin_rst = 0;
int pin_ce = 1;

// This is already tuned
int lcd_contrast = 60;
char timeString[9];

void cleanup(void)
{
    pinMode(pin_sclk, INPUT);
    pinMode(pin_din, INPUT);
    pinMode(pin_dc, INPUT);
    pinMode(pin_rst, INPUT);
    pinMode(pin_ce, INPUT);
}

char * get_time(void)
{
    time_t current_time;
    struct tm * time_info;
    time(&current_time);
    time_info = localtime(&current_time);
    strftime(timeString, sizeof(timeString), "%H:%M:%S", time_info);
    // printf("%s\n", &timeString);
    return &timeString;
}

int main(int argc, char const *argv[])
{
    printf("nLCD tool\n");
    printf("Pin definations:\n");
    printf("CLK on %i\n", pin_sclk);
    printf("DIN on %i\n", pin_din);
    printf("DC on %i\n", pin_dc);
    printf("CE on %i\n", pin_ce);
    printf("RST on %i\n", pin_rst);

    if (wiringPiSetup() == -1)
    {
        printf("wiringPi error\n");
        exit(1);
    }

    LCDInit(pin_sclk, pin_din, pin_dc, pin_ce, pin_rst, lcd_contrast);
    LCDcommand(PCD8544_DISPLAYCONTROL | PCD8544_DISPLAYALLON);
    LCDdisplay();
    LCDclear();
    LCDcommand(PCD8544_DISPLAYCONTROL | PCD8544_DISPLAYNORMAL);

    while (1)
    {
        LCDdrawrect(6 - 1, 6 - 1, LCDWIDTH - 6, LCDHEIGHT - 6, BLACK);
        LCDdrawstring(12, 12, get_time());
        LCDdisplay();
        delay(1000);
        // LCDclear();
    }

    LCDclear();
    cleanup();
    return 0;
}

Add simple digital clock example

Add simple digital clock example


/**
 * Copyright (c) 2015, Chao Wang <hit9@icloud.com>
 *
 * md5 hash function.
 */

/*
 * This is an OpenSSL-compatible implementation of the RSA Data Security, Inc.
 * MD5 Message-Digest Algorithm (RFC 1321).
 *
 * Homepage: http://openwall.info/wiki/people/solar/software/public-domain-source-code/md5
 *
 * Author: Alexander Peslyak, better known as Solar Designer <solar at openwall.com>
 */

#ifndef _CW_MD5_H
#define _CW_MD5_H 1

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

void md5_signature(unsigned char *key, unsigned long length, unsigned char *result);
uint32_t hash_md5(const char *key, size_t key_length);

#if defined(__cplusplus)
}
#endif

#endif

/**
 * Copyright (c) 2015, Chao Wang <hit9@icloud.com>
 *
 * md5 hash function.
 */

/*
 * This is an OpenSSL-compatible implementation of the RSA Data Security, Inc.
 * MD5 Message-Digest Algorithm (RFC 1321).
 *
 * Homepage: http://openwall.info/wiki/people/solar/software/public-domain-source-code/md5
 *
 * Author: Alexander Peslyak, better known as Solar Designer <solar at openwall.com>
 */

#ifndef _CW_MD5_H
#define _CW_MD5_H 1

#include <stdint.h>

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

void md5_signature(unsigned char *key, unsigned long length, unsigned char *result);
uint32_t hash_md5(const char *key, size_t key_length);

#if defined(__cplusplus)
}
#endif

#endif

Add missing header file `stdint.h`

Add missing header file `stdint.h`