#include "input.h"

#include <ctype.h>
#include <stdio.h>
#include <string.h>

void read_line(char *p)
{
    if (fgets(p, MAX_SIZE, stdin) == NULL){
        p[0] = '\0';
        return;
    }
    remove_space(p);
}

int is_exit(const char* p)
{
    const char* exit_words[] = {
        "exit",
        "quit",
        "bye",
    };
    int len = (int)(sizeof(exit_words) / sizeof(char*));
    int i;

    if (strlen(p) == 0){
        return (1);
    }
    for (i = 0; i < len; i++){
        if (strcmp(p, exit_words[i]) == 0){
            return (1);
        }
    }
    return (0);
}

void remove_space(char* p)
{
    int i, j;

    i = j = 0;
    while (p[i] != '\0'){
        while (isspace(p[j])){
            j++;
        }
        while (!isspace(p[j])){
            p[i] = p[j];
            if (p[i] == '\0'){
                break;
            }
            else {
                i++;
                j++;
            }
        }
    }
}

#include "input.h"

#include <ctype.h>
#include <stdio.h>
#include <string.h>

void read_line(char *p)
{
    if (fgets(p, MAX_SIZE, stdin) == NULL){
        p[0] = '\0';
        return;
    }
    remove_space(p);
}

int is_exit(const char* p)
{
    const char* exit_words[] = {
        "",
        "exit",
        "quit",
        "bye",
    };
    int len = (int)(sizeof(exit_words) / sizeof(char*));
    int i;

    if (strlen(p) == 0){
        return (1);
    }
    for (i = 0; i < len; i++){
        if (strcmp(p, exit_words[i]) == 0){
            return (1);
        }
    }
    return (0);
}

void remove_space(char* p)
{
    int i, j;

    i = j = 0;
    while (p[i] != '\0'){
        while (isspace(p[j])){
            j++;
        }
        while (!isspace(p[j])){
            p[i] = p[j];
            if (p[i] == '\0'){
                break;
            }
            else {
                i++;
                j++;
            }
        }
    }
}

Add empty string to exit words

Add empty string to exit words


#include <stdio.h>

int main() {
  int notas[10];

  notas[0] = 10;
  notas[2] = 9;
  notas[3] = 8;
  notas[9] = 4;

  printf("%d %d %d\n", notas[0], notas[2], notas[9]);
}

#include <stdio.h>

int main() {
  char palavrasecreta[20];

  sprintf(palavrasecreta, "MELANCIA");

  printf("%s\n", palavrasecreta);

  /*
  palavrasecreta[0] = 'M';
  palavrasecreta[1] = 'E';
  palavrasecreta[2] = 'L';
  palavrasecreta[3] = 'A';
  palavrasecreta[4] = 'N';
  palavrasecreta[5] = 'C';
  palavrasecreta[6] = 'I';
  palavrasecreta[7] = 'A';

  printf("%c%c%c%c%c%c%c%c\n", palavrasecreta[0], palavrasecreta[1], palavrasecreta[2], palavrasecreta[3], palavrasecreta[4], palavrasecreta[5], palavrasecreta[6], palavrasecreta[7]);
  */
}

Update files, Alura, Introdução a C - Parte 2, Aula 2.2


// Copyright (c) 2010 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_GLUE_FORM_DATA_H__
#define WEBKIT_GLUE_FORM_DATA_H__

#include <vector>

#include "base/string_util.h"
#include "googleurl/src/gurl.h"
#include "webkit/glue/form_field.h"

namespace webkit_glue {

// Holds information about a form to be filled and/or submitted.
struct FormData {
  // The name of the form.
  string16 name;
  // GET or POST.
  string16 method;
  // The URL (minus query parameters) containing the form.
  GURL origin;
  // The action target of the form.
  GURL action;
  // true if this form was submitted by a user gesture and not javascript.
  bool user_submitted;
  // A vector of all the input fields in the form.
  std::vector<FormField> fields;

  // Used by FormStructureTest.
  inline bool operator==(const FormData& form) const {
    return (name == form.name &&
            StringToLowerASCII(method) == StringToLowerASCII(form.method) &&
            origin == form.origin &&
            action == form.action &&
            user_submitted == form.user_submitted &&
            fields == form.fields);
  }
};

}  // namespace webkit_glue

#endif  // WEBKIT_GLUE_FORM_DATA_H__

// Copyright (c) 2010 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_GLUE_FORM_DATA_H__
#define WEBKIT_GLUE_FORM_DATA_H__

#include <vector>

#include "base/string_util.h"
#include "googleurl/src/gurl.h"
#include "webkit/glue/form_field.h"

namespace webkit_glue {

// Holds information about a form to be filled and/or submitted.
struct FormData {
  // The name of the form.
  string16 name;
  // GET or POST.
  string16 method;
  // The URL (minus query parameters) containing the form.
  GURL origin;
  // The action target of the form.
  GURL action;
  // true if this form was submitted by a user gesture and not javascript.
  bool user_submitted;
  // A vector of all the input fields in the form.
  std::vector<FormField> fields;

  FormData() : user_submitted(false) {}

  // Used by FormStructureTest.
  inline bool operator==(const FormData& form) const {
    return (name == form.name &&
            StringToLowerASCII(method) == StringToLowerASCII(form.method) &&
            origin == form.origin &&
            action == form.action &&
            user_submitted == form.user_submitted &&
            fields == form.fields);
  }
};

}  // namespace webkit_glue

#endif  // WEBKIT_GLUE_FORM_DATA_H__

AutoFill: Add a default constructor for FormData. There are too many places
that create FormDatas, and we shouldn't need to initialize user_submitted for
each call site.

BUG=50423
TEST=none

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

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


#define CGLTF_IMPLEMENTATION
#include "../cgltf.h"

#include <stdio.h>

int main(int argc, char** argv)
{
	if (argc < 2)
	{
		printf("err\n");
		return -1;
	}

	FILE* f = fopen(argv[1], "rb");
	if (!f)
	{
		return -2;
	}

	fseek(f, 0, SEEK_END);
	long size = ftell(f);
	fseek(f, 0, SEEK_SET);

	void* buf = malloc(size);
	fread(buf, size, 1, f);

	fclose(f);

	cgltf_options options = {0};
	cgltf_data* data = NULL;
	cgltf_result result = cgltf_parse(&options, buf, size, &data);

	printf("Result: %d\n", result);
	if (result == cgltf_result_success)
	{
		printf("Type: %u\n", data->file_type);
		printf("Meshes: %lu\n", data->meshes_count);
	}

	free(buf);

	cgltf_free(data);

	return result;
}

#define CGLTF_IMPLEMENTATION
#include "../cgltf.h"

#include <stdio.h>

int main(int argc, char** argv)
{
	if (argc < 2)
	{
		printf("err\n");
		return -1;
	}

	cgltf_options options = {0};
	cgltf_data* data = NULL;
	cgltf_result result = cgltf_parse_file(&options, argv[1], &data);

	if (result == cgltf_result_success)
		result = cgltf_load_buffers(&options, data, argv[1]);

	printf("Result: %d\n", result);

	if (result == cgltf_result_success)
	{
		printf("Type: %u\n", data->file_type);
		printf("Meshes: %lu\n", data->meshes_count);
	}

	cgltf_free(data);

	return result;
}

Add cgltf_parse_file and cgltf_load_buffers to test program

With this CI tests will run almost all of the code on glTF sample models
- this will validate that the code that loads external buffers and
parses Base64 data URIs is correct.


//===-- PPC32TargetMachine.h - PowerPC/Darwin TargetMachine ---*- C++ -*-=//
//
//                     The LLVM Compiler Infrastructure
//
// This file was developed by the LLVM research group and is distributed under
// the University of Illinois Open Source License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
//
// This file declares the PowerPC/Darwin specific subclass of TargetMachine.
//
//===----------------------------------------------------------------------===//

#ifndef POWERPC_DARWIN_TARGETMACHINE_H
#define POWERPC_DARWIN_TARGETMACHINE_H

#include "llvm/Target/TargetMachine.h"
#include "llvm/Target/TargetFrameInfo.h"
#include "llvm/PassManager.h"
#include "PowerPCTargetMachine.h"
#include <set>

namespace llvm {

class GlobalValue;
class IntrinsicLowering;

class PPC32TargetMachine : public PowerPCTargetMachine {
public:
  PPC32TargetMachine(const Module &M, IntrinsicLowering *IL);

  /// addPassesToEmitMachineCode - Add passes to the specified pass manager to
  /// get machine code emitted.  This uses a MachineCodeEmitter object to handle
  /// actually outputting the machine code and resolving things like the address
  /// of functions.  This method should returns true if machine code emission is
  /// not supported.
  ///
  virtual bool addPassesToEmitMachineCode(FunctionPassManager &PM,
                                          MachineCodeEmitter &MCE);

  static unsigned getModuleMatchQuality(const Module &M);
};

} // end namespace llvm

#endif

//===-- PPC32TargetMachine.h - PowerPC/Darwin TargetMachine ---*- C++ -*-=//
//
//                     The LLVM Compiler Infrastructure
//
// This file was developed by the LLVM research group and is distributed under
// the University of Illinois Open Source License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
//
// This file declares the PowerPC/Darwin specific subclass of TargetMachine.
//
//===----------------------------------------------------------------------===//

#ifndef POWERPC_DARWIN_TARGETMACHINE_H
#define POWERPC_DARWIN_TARGETMACHINE_H

#include "llvm/Target/TargetMachine.h"
#include "llvm/Target/TargetFrameInfo.h"
#include "llvm/PassManager.h"
#include "PowerPCTargetMachine.h"

namespace llvm {

class IntrinsicLowering;

class PPC32TargetMachine : public PowerPCTargetMachine {
public:
  PPC32TargetMachine(const Module &M, IntrinsicLowering *IL);

  /// addPassesToEmitMachineCode - Add passes to the specified pass manager to
  /// get machine code emitted.  This uses a MachineCodeEmitter object to handle
  /// actually outputting the machine code and resolving things like the address
  /// of functions.  This method should returns true if machine code emission is
  /// not supported.
  ///
  virtual bool addPassesToEmitMachineCode(FunctionPassManager &PM,
                                          MachineCodeEmitter &MCE);

  static unsigned getModuleMatchQuality(const Module &M);
};

} // end namespace llvm

#endif

Remove an unneeded header and forward declaration

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


/*
  Mace - http://www.macehq.cx
  Copyright 1999-2004
  See the file README for more information
*/

#ifndef GLOBALS_H
#define GLOBALS_H

#ifndef _MaceTypes
#define _MaceTypes
typedef unsigned char U8;
typedef char S8;
typedef unsigned short U16;
typedef signed short S16;

//Note: on 64-bit machines, replace "long" with "int"
typedef unsigned long U32;
typedef signed long S32;
#endif

void App_Exit(void);
 //Same as App_Exit2(), except that this calls setdis()
void App_Exit2(void);
U16 FlipW(U16 a);
U32 FlipL(U32 a);
void HexW (U16 n, char * String);
void HexL (U32 n, char * String);

#endif //GLOBALS_H

/*
  Mace - http://www.macehq.cx
  Copyright 1999-2004
  See the file README for more information
*/

#ifndef GLOBALS_H
#define GLOBALS_H

#ifndef _MaceTypes
#define _MaceTypes
typedef unsigned char U8;
typedef signed char S8;
typedef unsigned short U16;
typedef signed short S16;

//Note: on 64-bit machines, replace "long" with "int"
#if __LP64__
typedef unsigned int U32;
typedef signed int S32;
#else
typedef unsigned long U32;
typedef signed long S32;
#endif
#endif

void App_Exit(void);
 //Same as App_Exit2(), except that this calls setdis()
void App_Exit2(void);
U16 FlipW(U16 a);
U32 FlipL(U32 a);
void HexW (U16 n, char * String);
void HexL (U32 n, char * String);

#endif //GLOBALS_H

Fix U32 and S32 on LP64 architectures.

Fix U32 and S32 on LP64 architectures.


//PARAM: --disable ana.int.interval --enable ana.int.wrap_on_signed_overflow
#include <assert.h>

int main(){
    int a = 0;

    // maximum value for long long
    signed long long s = 9223372036854775807;
    assert(s > 9223372036854775806);

    signed long long t = s + 2;
    // Signed overflow - The following assertion only works with ana.int.wrap_on_signed_overflow enabled
    assert(t == -9223372036854775807);

    return 0;
}

Add test for signed wrap-around with ana.int.wrap_on_signed_overflow


/* -*- Mode: C; tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*- */
#ifndef DISABLE_OPTIMIZE_H
#define DISABLE_OPTIMIZE_H 1

/* avoid wasting time trying to optimize those countless test functions */
#if defined(__clang__)

/*
 * Works for Alk since clang-3.5.
 * Unfortunately it looks like Apple have their own versioning scheme for
 * clang, because mine (Trond) reports itself as 5.1 and does not have
 * the pragma.
 */

#if ((__clang_major__ * 0x100 + __clang_minor) >= 0x305) && !defined(__APPLE__)
#pragma clang optimize off
#endif

#elif defined(__GNUC__)
/*
 * gcc docs indicate that pragma optimize is supported since 4.4. Earlier
 * versions will emit harmless warning.
 */
#if ((__GNUC__ * 0x100 + __GNUC_MINOR__) >= 0x0404)
#pragma GCC optimize ("O0")
#endif

#endif /* __GNUC__ */

#endif

/* -*- Mode: C; tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*- */
#ifndef DISABLE_OPTIMIZE_H
#define DISABLE_OPTIMIZE_H 1

/* According to MB-11846 we have some misconfigured vm's unable to
 * compile the source code without enabling optimization. Add a workaround
 * for those vm's until they're fixed
 */
#ifndef COUCHBASE_OPTIMIZE_BREAKDANCER_TEST

/* avoid wasting time trying to optimize those countless test functions */
#if defined(__clang__)

/*
 * Works for Alk since clang-3.5.
 * Unfortunately it looks like Apple have their own versioning scheme for
 * clang, because mine (Trond) reports itself as 5.1 and does not have
 * the pragma.
 */

#if ((__clang_major__ * 0x100 + __clang_minor) >= 0x305) && !defined(__APPLE__)
#pragma clang optimize off
#endif

#elif defined(__GNUC__)
/*
 * gcc docs indicate that pragma optimize is supported since 4.4. Earlier
 * versions will emit harmless warning.
 */
#if ((__GNUC__ * 0x100 + __GNUC_MINOR__) >= 0x0404)
#pragma GCC optimize ("O0")
#endif

#endif /* __GNUC__ */

#endif /* COUCHBASE_OPTIMIZE_BREAKDANCER_TEST */

#endif

Add workaround for broken builders

MB-11846: Add workaround for broken builders

According to MB-11846 we have some misconfigured vm's unable to
compile the source code without enabling optimization. This
patch introduce a workaround to enable the optimization of the
breakdancer tests until the vm's is fixed. To use the workaround
define COUCHBASE_OPTIMIZE_BREAKDANCER_TEST during compilation.

Add -D CMAKE_C_FLAGS=-DCOUCHBASE_OPTIMIZE_BREAKDANCER_TEST to
the command line when invoking cmake.

Change-Id: I067548b39be9f52951afed0c30221e1d77926b93
Reviewed-on: http://review.couchbase.org/40165
Reviewed-by: Trond Norbye <60edd2ef23891a753f231b0c6f161dc634079a93@gmail.com>
Tested-by: Trond Norbye <60edd2ef23891a753f231b0c6f161dc634079a93@gmail.com>


// Copyright (c) 2010 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 PPAPI_CPP_MODULE_IMPL_H_
#define PPAPI_CPP_MODULE_IMPL_H_

#include "ppapi/cpp/module.h"

namespace {

template <typename T> class DeviceFuncs {
 public:
  explicit DeviceFuncs(const char* ifname) : ifname_(ifname) {}

  operator T const*() {
    if (!funcs_) {
      funcs_ = reinterpret_cast<T const*>(
          pp::Module::Get()->GetBrowserInterface(ifname_));
    }
    return funcs_;
  }

  // This version doesn't check for existence of the function object. It is
  // used so that, for DeviceFuncs f, the expression:
  // if (f) f->doSomething();
  // checks the existence only once.
  T const* operator->() const { return funcs_; }

 private:
  DeviceFuncs(const DeviceFuncs&other);
  DeviceFuncs &operator=(const DeviceFuncs &other);

  const char* ifname_;
  T const* funcs_;
};

}  // namespace

#endif  // PPAPI_CPP_MODULE_IMPL_H_

// Copyright (c) 2010 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 PPAPI_CPP_MODULE_IMPL_H_
#define PPAPI_CPP_MODULE_IMPL_H_

#include "ppapi/cpp/module.h"

namespace {

template <typename T> class DeviceFuncs {
 public:
  explicit DeviceFuncs(const char* ifname) : ifname_(ifname), funcs_(NULL) {}

  operator T const*() {
    if (!funcs_) {
      funcs_ = reinterpret_cast<T const*>(
          pp::Module::Get()->GetBrowserInterface(ifname_));
    }
    return funcs_;
  }

  // This version doesn't check for existence of the function object. It is
  // used so that, for DeviceFuncs f, the expression:
  // if (f) f->doSomething();
  // checks the existence only once.
  T const* operator->() const { return funcs_; }

 private:
  DeviceFuncs(const DeviceFuncs&other);
  DeviceFuncs &operator=(const DeviceFuncs &other);

  const char* ifname_;
  T const* funcs_;
};

}  // namespace

#endif  // PPAPI_CPP_MODULE_IMPL_H_

Initialize DeviceFuncs::ifuncs_ to zero in constructor


#define WOCKY_XMPP_NS_STREAM \
  (const gchar *)"http://etherx.jabber.org/streams"

#define WOCKY_XMPP_NS_TLS \
  (const gchar *)"urn:ietf:params:xml:ns:xmpp-tls"

#define WOCKY_XMPP_NS_SASL_AUTH \
  (const gchar *)"urn:ietf:params:xml:ns:xmpp-sasl"

#define WOCKY_XMPP_NS_XHTML_IM \
  (const gchar *)"http://jabber.org/protocol/xhtml-im"

#define WOCKY_W3C_NS_XHTML \
  (const gchar *)"http://www.w3.org/1999/xhtml"

Add xhtml-im and w3c xhtml namespace

Add xhtml-im and w3c xhtml namespace

20070316212630-93b9a-bcdbd042585561b0f20076b5e7f5f1c41c1e2867.gz


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

#import <Foundation/Foundation.h>
#import <GData/GData.h>
#import "GPSyncProtocol.h"

// Source for documents, spreadsheets, and presentations in Google Docs.
// Note: presentations currently won't have content data.
@interface GPDocsSync : NSObject <GPSyncSource> {
  id<GPSyncManager>              manager_;  // weak reference
  GDataServiceGoogleDocs*        docService_;
  GDataServiceGoogleSpreadsheet* spreadsheetService_;
  NSMutableArray*                docsToInflate_;
}

@end

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

#import <Foundation/Foundation.h>
#import <GData/GData.h>
#import "GPSyncProtocol.h"

// Source for documents, spreadsheets, presentations, and PDFs in Google Docs.
// Note: PDFs currently won't have content data.
@interface GPDocsSync : NSObject <GPSyncSource> {
  id<GPSyncManager>              manager_;  // weak reference
  GDataServiceGoogleDocs*        docService_;
  GDataServiceGoogleSpreadsheet* spreadsheetService_;
  NSMutableArray*                docsToInflate_;
}

@end

Update header comment to reflect the current state of the source.

git-svn-id: c46e06cb57945f24bc44ee3ee8f795d5b6e634f5@64 c4e13eb7-e550-0410-89ee-d7df1d48aa01


// RUN: %llvmgcc -S -O0 -g %s -o - | FileCheck %s
// Insure that dbg.declare lines for locals refer to correct line number records.
// Radar 8152866.
void foo() {
  int l = 0;    // line #4: CHECK: {{call.*llvm.dbg.declare.*%l.*\!dbg }}[[variable_l:![0-9]+]]
  int p = 0;    // line #5: CHECK: {{call.*llvm.dbg.declare.*%p.*\!dbg }}[[variable_p:![0-9]+]]
}
// Now match the line number records:
// CHECK: {{^}}[[variable_l]]{{ = metadata ![{]i32 5,}}
// CHECK: {{^}}[[variable_p]]{{ = metadata ![{]i32 6,}}

Test case for r107843. Radar 8152866.

Test case for r107843.  Radar 8152866.

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


/**
 *  The login information to access a server
 *
 *  This class combines login, password and vhost
 *
 *  @copyright 2014 Copernica BV
 */

/**
 *  Set up namespace
 */
namespace AMQP {

/**
 *  Class definition
 */
class Login
{
private:
    /**
     *  The username
     *  @var string
     */
    std::string _user;

    /**
     *  The password
     *  @var string
     */
    std::string _password;

public:
    /**
     *  Constructor
     *  @param  user
     *  @param  password
     */
    Login(const std::string &user, const std::string &password) :
        _user(user), _password(password) {}

    /**
     *  Constructor
     */
    Login() :
        _user("guest"), _password("guest") {}

    /**
     *  Destructor
     */
    virtual ~Login() {}

    /**
     *  String representation in SASL PLAIN mode
     *  @return string
     */
    std::string saslPlain()
    {
        // we need an initial string
        std::string result("\0", 1);

        // append other elements
        return result.append(_user).append("\0",1).append(_password);
    }
};

/**
 *  End of namespace
 */
}

/**
 *  The login information to access a server
 *
 *  This class combines login, password and vhost
 *
 *  @copyright 2014 Copernica BV
 */

/**
 *  Set up namespace
 */
namespace AMQP {

/**
 *  Class definition
 */
class Login
{
private:
    /**
     *  The username
     *  @var string
     */
    std::string _user;

    /**
     *  The password
     *  @var string
     */
    std::string _password;

public:
    /**
     *  Constructor
     *  @param  user
     *  @param  password
     */
    Login(const std::string &user, const std::string &password) :
        _user(user), _password(password) {}

    /**
     *  Copy constructor
     *  @param  login
     */
    Login(const Login &login) :
        _user(login._user), _password(login._password) {}

    /**
     *  Constructor
     */
    Login() :
        _user("guest"), _password("guest") {}

    /**
     *  Destructor
     */
    virtual ~Login() {}

    /**
     *  String representation in SASL PLAIN mode
     *  @return string
     */
    std::string saslPlain()
    {
        // we need an initial string
        std::string result("\0", 1);

        // append other elements
        return result.append(_user).append("\0",1).append(_password);
    }
};

/**
 *  End of namespace
 */
}

Copy constructor added to Login class

Copy constructor added to Login class


// @(#)root/base:$Id$
// Author: Fons Rademakers   9/5/2007

/*************************************************************************
 * Copyright (C) 1995-2007, Rene Brun and Fons Rademakers.               *
 * All rights reserved.                                                  *
 *                                                                       *
 * For the licensing terms see $ROOTSYS/LICENSE.                         *
 * For the list of contributors see $ROOTSYS/README/CREDITS.             *
 *************************************************************************/

#ifndef ROOT_TVersionCheck
#define ROOT_TVersionCheck

//////////////////////////////////////////////////////////////////////////
//                                                                      //
// TVersionCheck                                                        //
//                                                                      //
// Used to check if the shared library or plugin is compatible with     //
// the current version of ROOT.                                         //
//                                                                      //
//////////////////////////////////////////////////////////////////////////

#ifdef R__CXXMODULES
#ifndef ROOT_TObject
#error "Building with modules currently requires this file to be #included through TObject.h"
#endif
#endif // R__CXXMODULES

#include "RVersion.h"

class TVersionCheck {
public:
   TVersionCheck(int versionCode);  // implemented in TSystem.cxx
};

// FIXME: Due to a modules bug: https://llvm.org/bugs/show_bug.cgi?id=31056
// our .o files get polluted with the gVersionCheck symbol despite it was not
// visible in this TU.
#ifndef R__CXXMODULES
#ifndef __CINT__
namespace ROOT {
static TVersionCheck gVersionCheck(ROOT_VERSION_CODE);
}
#endif
#endif

#endif

// @(#)root/base:$Id$
// Author: Fons Rademakers   9/5/2007

/*************************************************************************
 * Copyright (C) 1995-2007, Rene Brun and Fons Rademakers.               *
 * All rights reserved.                                                  *
 *                                                                       *
 * For the licensing terms see $ROOTSYS/LICENSE.                         *
 * For the list of contributors see $ROOTSYS/README/CREDITS.             *
 *************************************************************************/

#ifndef ROOT_TVersionCheck
#define ROOT_TVersionCheck

//////////////////////////////////////////////////////////////////////////
//                                                                      //
// TVersionCheck                                                        //
//                                                                      //
// Used to check if the shared library or plugin is compatible with     //
// the current version of ROOT.                                         //
//                                                                      //
//////////////////////////////////////////////////////////////////////////

#include "RVersion.h"

class TVersionCheck {
public:
   TVersionCheck(int versionCode);  // implemented in TSystem.cxx
};

namespace ROOT {
static TVersionCheck gVersionCheck(ROOT_VERSION_CODE);
}
#endif

[core] Remove special cxxmodules case now that gVersionCheck is on ROOT::.


//
//  RNUnifiedContacts.h
//  RNUnifiedContacts
//
//  Created by Joshua Pinter on 2016-03-23.
//  Copyright © 2016 Joshua Pinter. All rights reserved.
//

#ifndef RNUnifiedContacts_Bridging_Header_h
#define RNUnifiedContacts_Bridging_Header_h

#import <React/RCTBridgeModule.h>

#endif /* RNUnifiedContacts_Bridging_Header_h */

//
//  RNUnifiedContacts.h
//  RNUnifiedContacts
//
//  Created by Joshua Pinter on 2016-03-23.
//  Copyright © 2016 Joshua Pinter. All rights reserved.
//

#ifndef RNUnifiedContacts_Bridging_Header_h
#define RNUnifiedContacts_Bridging_Header_h

#if __has_include("RCTBridgeModule.h")
#import "RCTBridgeModule.h"
#else
#import <React/RCTBridgeModule.h>
#endif

#endif /* RNUnifiedContacts_Bridging_Header_h */

Support Pre 0.40 and Post 0.40 React Native.

Handle if else for importing `React/RCTBridgeModule.h`.


#pragma once
#ifndef YOU_DATASTORE_OPERATION_H_
#define YOU_DATASTORE_OPERATION_H_

#include <unordered_map>
#include "datastore.h"

namespace You {
namespace DataStore {

/// A pure virtual class of operations to be put into transaction stack
class IOperation {
public:
	IOperation() = default;
	~IOperation() = default;

	/// Executes the operation
	virtual void run(DataStore::STask) = 0;
};

}   // namespace DataStore
}   // namespace You

#endif  // YOU_DATASTORE_OPERATION_H_

#pragma once
#ifndef YOU_DATASTORE_OPERATION_H_
#define YOU_DATASTORE_OPERATION_H_

#include <unordered_map>
#include "datastore.h"

namespace You {
namespace DataStore {

/// A pure virtual class of operations to be put into transaction stack
class IOperation {
public:
	IOperation();
	virtual ~IOperation();

	/// Executes the operation
	virtual void run(DataStore::STask) = 0;
};

}   // namespace DataStore
}   // namespace You

#endif  // YOU_DATASTORE_OPERATION_H_

Make IOperation destructor virtual, remove redundant default


/*
 * Copyright (c) 2011 The Native Client 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 NATIVE_CLIENT_SRC_UNTRUSTED_IRT_IRT_PPAPI_H_
#define NATIVE_CLIENT_SRC_UNTRUSTED_IRT_IRT_PPAPI_H_ 1

#include <stddef.h>

#include "ppapi/c/ppp.h"

struct PP_StartFunctions {
  int32_t (*PPP_InitializeModule)(PP_Module module_id,
                                  PPB_GetInterface get_browser_interface);
  void (*PPP_ShutdownModule)();
  const void *(*PPP_GetInterface)(const char *interface_name);
};

struct PP_ThreadFunctions {
  /*
   * This is a cut-down version of pthread_create()/pthread_join().
   * We omit thread creation attributes and the thread's return value.
   *
   * We use uintptr_t as the thread ID type because pthread_t is not
   * part of the stable ABI; a user thread library might choose an
   * arbitrary size for its own pthread_t.
   */
  int (*thread_create)(uintptr_t *tid,
                       void (*func)(void *thread_argument),
                       void *thread_argument);
  int (*thread_join)(uintptr_t tid);
};

typedef void (*PP_StartFunc)(const struct PP_StartFunctions *funcs);
typedef void (*PP_RegisterThreadFuncs)(const struct PP_ThreadFunctions *funcs);

#endif

/*
 * Copyright (c) 2011 The Native Client 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 NATIVE_CLIENT_SRC_UNTRUSTED_IRT_IRT_PPAPI_H_
#define NATIVE_CLIENT_SRC_UNTRUSTED_IRT_IRT_PPAPI_H_ 1

#include <stddef.h>

#include "ppapi/c/ppp.h"

struct PP_StartFunctions {
  int32_t (*PPP_InitializeModule)(PP_Module module_id,
                                  PPB_GetInterface get_browser_interface);
  void (*PPP_ShutdownModule)();
  const void *(*PPP_GetInterface)(const char *interface_name);
};

struct PP_ThreadFunctions {
  /*
   * This is a cut-down version of pthread_create()/pthread_join().
   * We omit thread creation attributes and the thread's return value.
   *
   * We use uintptr_t as the thread ID type because pthread_t is not
   * part of the stable ABI; a user thread library might choose an
   * arbitrary size for its own pthread_t.
   */
  int (*thread_create)(uintptr_t *tid,
                       void (*func)(void *thread_argument),
                       void *thread_argument);
  int (*thread_join)(uintptr_t tid);
};

#endif

Remove two unused PPAPI-related typedefs

These typedefs are left over from an earlier iteration of the IRT
interface (prior to the interface being stabilised) which was removed
in r5108.

BUG=none
TEST=build

Review URL: https://codereview.chromium.org/11016034

git-svn-id: 721b910a23eff8a86f00c8fd261a7587cddf18f8@9913 fcba33aa-ac0c-11dd-b9e7-8d5594d729c2


//===-- GetOpt.h ------------------------------------------------*- C++ -*-===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
#pragma once

#ifndef _MSC_VER

#include <unistd.h>
#include <getopt.h>

#else

#include <lldb/Host/windows/GetOptInc.h>

#endif

Add newline at end of file, clang compiler warning.

git-svn-id: 4c4cc70b1ef44ba2b7963015e681894188cea27e@201743 91177308-0d34-0410-b5e6-96231b3b80d8


Fix a typo (thanks to Robert Hatcher)

Fix a typo (thanks to Robert Hatcher)

git-svn-id: acec3fd5b7ea1eb9e79d6329d318e8118ee2e14f@10919 27541ba8-7e3a-0410-8455-c3a389f83636


// For License please refer to LICENSE file in the root of FastEasyMapping project

#import "FEMObjectStore.h"

@class NSManagedObjectContext;

@interface FEMManagedObjectStore : FEMObjectStore

- (nonnull instancetype)initWithContext:(nonnull NSManagedObjectContext *)context NS_DESIGNATED_INITIALIZER;
@property (nonatomic, strong, readonly, nonnull) NSManagedObjectContext *context;

@property (nonatomic) BOOL saveContextOnCommit;

@end

// For License please refer to LICENSE file in the root of FastEasyMapping project

#import "FEMObjectStore.h"

NS_ASSUME_NONNULL_BEGIN

@class NSManagedObjectContext;

@interface FEMManagedObjectStore : FEMObjectStore

- (instancetype)init NS_UNAVAILABLE;

- (instancetype)initWithContext:(NSManagedObjectContext *)context NS_DESIGNATED_INITIALIZER;
@property (nonatomic, strong, readonly) NSManagedObjectContext *context;

@property (nonatomic) BOOL saveContextOnCommit;

@end

NS_ASSUME_NONNULL_END

Mark init as unavailable for ObjectStore


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

Add empty header to fix internal project.

BUG=None
TBR=tommi@webrtc.org

Review-Url: https://codereview.webrtc.org/2790493006
Cr-Commit-Position: 972c6d2dc6dd5efdad1377c0d224e03eb8f276f7@{#17492}


//
//  SEEngineProtocol.h
//  Pods
//
//  Created by Danil Tulin on 3/14/16.
//
//

#import <Foundation/Foundation.h>

@protocol EngineProtocol <NSObject>

@required

- (void)feedBGRAImageData:(u_int8_t *)data
					width:(NSUInteger)width
				   height:(NSUInteger)height;

@property (nonatomic) float progress;
@property (nonatomic) BOOL isAbleToProcess;

@end

//
//  SEEngineProtocol.h
//  Pods
//
//  Created by Danil Tulin on 3/14/16.
//
//

#import <Foundation/Foundation.h>

@protocol EngineProtocol <NSObject>

@required

- (void)feedBGRAImageData:(u_int8_t *)data
					width:(NSUInteger)width
				   height:(NSUInteger)height;

@property (nonatomic) float progress;
@property (nonatomic) BOOL isAbleToProcess;

- (void)startSession;
- (void)stopSession;

@end

Add start / stop session methods

Add start / stop session methods


/* Various definitions needed for compatibility with various
   compilers (MSC) and platforms (Windows).  */
#ifndef BASE_DEFS_H
#define BASE_DEFS_H

#ifdef _MSC_VER

#if !defined(__cplusplus)
#define inline __inline
#endif

#define __attribute__(x)

#endif

#ifdef _WIN32
/* Target Windows XP */
#define WINVER 0x0501
#define _WIN32_WINNT 0x0501
#endif

#endif

Add macros for targeting Windows XP

Add macros for targeting Windows XP


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

//
//  GTLBatchQuery.h
//

#import "GTLQuery.h"

@interface GTLBatchQuery : NSObject <GTLQueryProtocol> {
 @private
  NSMutableArray *queries_;
  NSMutableDictionary *requestIDMap_;
  BOOL skipAuthorization_;
}

// Queries included in this batch.  Each query should have a unique requestID.
@property (retain) NSArray *queries;

// Clients may set this to NO to disallow authorization. Defaults to YES.
@property (assign) BOOL shouldSkipAuthorization;

+ (id)batchQuery;
+ (id)batchQueryWithQueries:(NSArray *)array;

- (void)addQuery:(GTLQuery *)query;

- (GTLQuery *)queryForRequestID:(NSString *)requestID;

@end

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

//
//  GTLBatchQuery.h
//

#import "GTLQuery.h"

@interface GTLBatchQuery : NSObject <GTLQueryProtocol> {
 @private
  NSMutableArray *queries_;
  NSMutableDictionary *requestIDMap_;
  BOOL skipAuthorization_;
}

// Queries included in this batch.  Each query should have a unique requestID.
@property (retain) NSArray *queries;

// Clients may set this to YES to disallow authorization. Defaults to NO.
@property (assign) BOOL shouldSkipAuthorization;

+ (id)batchQuery;
+ (id)batchQueryWithQueries:(NSArray *)array;

- (void)addQuery:(GTLQuery *)query;

- (GTLQuery *)queryForRequestID:(NSString *)requestID;

@end

Fix comment on shouldSkipAuthorization property


//Compile this program with -O0
#include <stdlib.h>
#include <unistd.h>

int main(void) {
    char *in_data_segment[] = "0xC0xA0xF0xE";

    char in_stack[] = {0xd, 0xe, 0xa, 0xd, 0xb, 0xe, 0xe, 0xf};

    char *in_heap = malloc(7 * sizeof(char));
    in_heap[0] = 0xb;
    in_heap[1] = 0xe;
    in_heap[2] = 0xb;
    in_heap[3] = 0xe;
    in_heap[4] = 0xf;
    in_heap[5] = 0xe;
    in_heap[6] = 0x0;

    for (;;) sleep(1);

    return 0;
}

Add a sample program for testing memory search.

This program places known bytes sequences in the process' stack, heap
and data segment.

NOTE: This is not exhaustive.


#ifndef _MATH_MT_H_
#define _MATH_MT_H_

//#if defined(_MSC_VER) && (_MSC_VER <= 1600) // sufficient
#if defined(_MSC_VER)                         // better?
typedef unsigned __int32 uint32_t;
#elif defined(__linux__) || defined(__GLIBC__) || defined(__WIN32__) || defined(__APPLE__)
#include <stdint.h>
#elif defined(__osf__)
#include <inttypes.h>
#else
#include <sys/types.h>
#endif

enum { N = 624, M = 397 };

struct mt {
    uint32_t mt[N];
    int mti;
    uint32_t seed;
};

struct mt *mt_init(void);
void mt_free(struct mt *self);
uint32_t mt_get_seed(struct mt *self);
void mt_init_seed(struct mt *self, uint32_t seed);
void mt_setup_array(struct mt *self, uint32_t *array, int n);
double mt_genrand(struct mt *self);

#endif

#ifndef _MATH_MT_H_
#define _MATH_MT_H_

#if defined(_MSC_VER) && (_MSC_VER < 1600) // for MS Visual Studio prior to 2010
typedef unsigned __int32 uint32_t;
#elif defined(__linux__) || defined(__GLIBC__) || defined(__WIN32__) || defined(_MSC_VER) || defined(__APPLE__)
#include <stdint.h>
#elif defined(__osf__)
#include <inttypes.h>
#else
#include <sys/types.h>
#endif

enum { N = 624, M = 397 };

struct mt {
    uint32_t mt[N];
    int mti;
    uint32_t seed;
};

struct mt *mt_init(void);
void mt_free(struct mt *self);
uint32_t mt_get_seed(struct mt *self);
void mt_init_seed(struct mt *self, uint32_t seed);
void mt_setup_array(struct mt *self, uint32_t *array, int n);
double mt_genrand(struct mt *self);

#endif

Include <stdint.h> for MS Visual Studio 2010 and above


/**
* Copyright (c) 2015, Trellis-Logic
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this
*   list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice,
*   this list of conditions and the following disclaimer in the documentation
*   and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/

/**
* The datasheet specifies this location should be on a dword boundary
*/
#define HARDWARE_WIDGET_BASE_REGISTER_LOCATION 0x1000

struct hardware_widget
{
    void *base_register_location;
};

struct hardware_widget  g_hardware_widget;

/**
 * Initializes structure with parameters for access of the hardware widget
 * @param hardware_widget The structure to initialize
 */
#if ((HARDWARE_WIDGET_BASE_REGISTER_LOCATION & 0x3) != 0 )
    #error "Hardware widget datatsheet specifies the base register should be at a DWORD boundary!"
#endif
static void init_hardware(struct hardware_widget *widget)
{
   widget->base_register_location=(void *)HARDWARE_WIDGET_BASE_REGISTER_LOCATION;
}

int main(void)
{
    init_hardware(&g_hardware_widget);
}

Add preprocessor if check example

Add preprocessor if check example


#ifndef QGC_CONFIGURATION_H
#define QGC_CONFIGURATION_H

#include <QString>

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

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

#define QGC_APPLICATION_NAME "QGroundControl"
#define QGC_APPLICATION_VERSION "v. 2.0.3 (beta)"

namespace QGC

{
const QString APPNAME = "QGROUNDCONTROL";
const QString ORG_NAME = "QGROUNDCONTROL.ORG"; //can be customized by forks to e.g. mycompany.com to maintain separate Settings for customized apps
const QString ORG_DOMAIN = "org.qgroundcontrol";//can be customized by forks
const int APPLICATIONVERSION = 203; // 2.0.3
}

#endif // QGC_CONFIGURATION_H

#ifndef QGC_CONFIGURATION_H
#define QGC_CONFIGURATION_H

#include <QString>

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

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

#define QGC_APPLICATION_NAME "QGroundControl"
#define QGC_APPLICATION_VERSION_BASE "v2.0.3"

#define QGC_APPLICATION_VERSION_SUFFIX ".234 (Daily Build)"
#ifdef QGC_APPLICATION_VERSION_SUFFIX
    #define QGC_APPLICATION_VERSION QGC_APPLICATION_VERSION_BASE QGC_APPLICATION_VERSION_SUFFIX
#else
    #define QGC_APPLICATION_VERSION QGC_APPLICATION_VERSION_BASE " (Developer Build)"
#endif

namespace QGC

{
const QString APPNAME = "QGROUNDCONTROL";
const QString ORG_NAME = "QGROUNDCONTROL.ORG"; //can be customized by forks to e.g. mycompany.com to maintain separate Settings for customized apps
const QString ORG_DOMAIN = "org.qgroundcontrol";//can be customized by forks
const int APPLICATIONVERSION = 203; // 2.0.3
}

#endif // QGC_CONFIGURATION_H

Allow version suffix from command line

Allow version suffix from command line


#ifndef CJET_FETCH_H
#define CJET_FETCH_H

#include "json/cJSON.h"
#include "list.h"
#include "peer.h"

typedef int (*match_func)(const char *fetch_path, const char *state_path);

struct path_matcher {
	char *fetch_path;
	match_func match_function;
};

struct fetch {
	char *fetch_id;
	const struct peer *peer;
	struct list_head next_fetch;
	struct path_matcher matcher[12];
};

cJSON *add_fetch_to_peer(struct peer *p, cJSON *params);
void remove_all_fetchers_from_peer(struct peer *p);

#endif

#ifndef CJET_FETCH_H
#define CJET_FETCH_H

#include "json/cJSON.h"
#include "list.h"
#include "peer.h"

typedef int (*match_func)(const char *fetch_path, const char *state_path);

struct path_matcher {
	char *fetch_path;
	match_func match_function;
	uintptr_t cookie;
};

struct fetch {
	char *fetch_id;
	const struct peer *peer;
	struct list_head next_fetch;
	struct path_matcher matcher[12];
};

cJSON *add_fetch_to_peer(struct peer *p, cJSON *params);
void remove_all_fetchers_from_peer(struct peer *p);

#endif

Add cookie entry for auxilary match data.


#ifndef _H_STREAM_QUEUE_MANAGER
#define _H_STREAM_QUEUE_MANAGER

/* ****************************************************************************
 *
 * FILE                      QueuesManager.h
 *
 * AUTHOR                    Andreu Urruela Planas
 *
 * All the queues contained in the system
 *
 */

#include "au/map.h"     // au::map

namespace samson {
    namespace stream
    {

        class Queue;
        class Block;

        class QueuesManager
        {
            au::map< std::string , Queue > queues;  // Map with the current queues

        public:

            QueuesManager();
            std::string getStatus();

            void addBlock( std::string queue , Block *b);

        };
    }
}

#endif

#ifndef _H_STREAM_QUEUE_MANAGER
#define _H_STREAM_QUEUE_MANAGER

/* ****************************************************************************
 *
 * FILE                      QueuesManager.h
 *
 * AUTHOR                    Andreu Urruela Planas
 *
 * All the queues contained in the system
 *
 */

#include "au/map.h"     // au::map
#include <string>

namespace samson {
    namespace stream
    {

        class Queue;
        class Block;

        class QueuesManager
        {
            au::map< std::string , Queue > queues;  // Map with the current queues

        public:

            QueuesManager();
            std::string getStatus();

            void addBlock( std::string queue , Block *b);

        };
    }
}

#endif

Fix compilation broken for linux

Fix compilation broken for linux

git-svn-id: 9714148d14941aebeae8d7f7841217f5ffc02bc5@1242 4143565c-f3ec-42ea-b729-f8ce0cf5cbc3


#ifndef OW_SOLVER_CONTAINER
#define OW_SOLVER_CONTAINER
#include "ow_isolver.h"
#include "ow_cl_const.h"
#include <string>
#include <vector>
namespace x_engine
{
namespace solver
{
enum SOLVER_TYPE
{
  OCL = 1,
  CUDA,
  SINGLE,
  PARALLEL
};
enum DEVICE
{
  CPU = 0,
  GPU = 1,
  ALL = 2
};
struct device
{
  DEVICE type;
  std::string name;
  bool is_buisy;
};
class solver_container
{
public:
  solver_container(size_t devices_number = 1, SOLVER_TYPE s_t = OCL);
  ~solver_container() {}

private:
  std::vector<std::shared_ptr<i_solver>> _solvers;
  std::vector<std::shared_ptr<device>> devices;
};
}
}

#endif

#ifndef OW_SOLVER_CONTAINER
#define OW_SOLVER_CONTAINER
#include "ow_isolver.h"
#include "ow_cl_const.h"
#include <string>
#include <vector>
namespace x_engine
{
namespace solver
{
enum SOLVER_TYPE
{
  OCL = 1,
  CUDA,
  SINGLE,
  PARALLEL
};
enum DEVICE
{
  CPU = 0,
  GPU = 1,
  ALL = 2
};
struct device
{
  DEVICE type;
  std::string name;
  bool is_buisy;
};
class solver_container
{
public:
  solver_container(const solver_container &) = delete;
  solver_container &operator=(const solver_container &) = delete;
  /** Classic Maer's singleton
   */
  static solver_container &instance(size_t devices_number = 1, SOLVER_TYPE s_t = OCL)
  {
    static solver_container s(size_t devices_number, SOLVER_TYPE s_t);
    return s;
  }

private:
  solver_container(size_t devices_number = 1, SOLVER_TYPE s_t = OCL);
  ~solver_container() {}
  std::vector<std::shared_ptr<i_solver>> _solvers;
  std::vector<std::shared_ptr<device>> devices;
};
}
}

#endif

Change solver_container is singleton now.


template <typename T> struct S;

template<typename T> void c(T)
{
}

template <> struct S <int>
{
  void a()
  {
    c(&S<int>::b);
  }
  void b() {}
};

Add missing part of test

Add missing part of test

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


//
//  OCHamcrest - HCSelfDescribing.h
//  Copyright 2013 hamcrest.org. See LICENSE.txt
//
//  Created by: Jon Reid, http://qualitycoding.org/
//  Docs: http://hamcrest.github.com/OCHamcrest/
//  Source: https://github.com/hamcrest/OCHamcrest
//

#import <Foundation/Foundation.h>

@protocol HCDescription;

/**
    The ability of an object to describe itself.

    @ingroup core
 */
@protocol HCSelfDescribing <NSObject>

/**
    Generates a description of the object.

    The description may be part of a description of a larger object of which this is just a
    component, so it should be worded appropriately.

    @param description  The description to be built or appended to.
 */
- (void)describeTo:(id<HCDescription>)description;

@end

//
//  OCHamcrest - HCSelfDescribing.h
//  Copyright 2013 hamcrest.org. See LICENSE.txt
//
//  Created by: Jon Reid, http://qualitycoding.org/
//  Docs: http://hamcrest.github.com/OCHamcrest/
//  Source: https://github.com/hamcrest/OCHamcrest
//

#import <Foundation/Foundation.h>

#import "HCDescription.h"

/**
    The ability of an object to describe itself.

    @ingroup core
 */
@protocol HCSelfDescribing <NSObject>

/**
    Generates a description of the object.

    The description may be part of a description of a larger object of which this is just a
    component, so it should be worded appropriately.

    @param description  The description to be built or appended to.
 */
- (void)describeTo:(id<HCDescription>)description;

@end

Change forward declaration to import for convenience.

https://github.com/hamcrest/OCHamcrest/issues/31


#pragma once
#include "../Util/FileClasses.h"
#include "../Util/Util.h"
#include "FileManager.h"

#define ARMIPS_VERSION_MAJOR    0
#define ARMIPS_VERSION_MINOR    10
#define ARMIPS_VERSION_REVISION 0

enum class ArmipsMode { FILE, MEMORY };

struct LabelDefinition
{
	std::wstring name;
	int64_t value;
};

struct EquationDefinition
{
	std::wstring name;
	std::wstring value;
};

struct ArmipsArguments
{
	// common
	ArmipsMode mode;
	int symFileVersion;
	bool errorOnWarning;
	bool silent;
	StringList* errorsResult;
	std::vector<EquationDefinition> equList;
	std::vector<LabelDefinition> labels;

	// file mode
	std::wstring inputFileName;
	std::wstring tempFileName;
	std::wstring symFileName;
	bool useAbsoluteFileNames;

	// memory mode
	std::shared_ptr<AssemblerFile> memoryFile;
	std::wstring content;

	ArmipsArguments()
	{
		mode = ArmipsMode::FILE;
		errorOnWarning = false;
		silent = false;
		errorsResult = nullptr;
		useAbsoluteFileNames = true;
	}
};

bool runArmips(ArmipsArguments& arguments);

#pragma once
#include "../Util/FileClasses.h"
#include "../Util/Util.h"
#include "FileManager.h"

#define ARMIPS_VERSION_MAJOR    0
#define ARMIPS_VERSION_MINOR    10
#define ARMIPS_VERSION_REVISION 0

enum class ArmipsMode { FILE, MEMORY };

struct LabelDefinition
{
	std::wstring name;
	int64_t value;
};

struct EquationDefinition
{
	std::wstring name;
	std::wstring value;
};

struct ArmipsArguments
{
	// common
	ArmipsMode mode;
	int symFileVersion;
	bool errorOnWarning;
	bool silent;
	StringList* errorsResult;
	std::vector<EquationDefinition> equList;
	std::vector<LabelDefinition> labels;

	// file mode
	std::wstring inputFileName;
	std::wstring tempFileName;
	std::wstring symFileName;
	bool useAbsoluteFileNames;

	// memory mode
	std::shared_ptr<AssemblerFile> memoryFile;
	std::wstring content;

	ArmipsArguments()
	{
		mode = ArmipsMode::FILE;
		symFileVersion = 0;
		errorOnWarning = false;
		silent = false;
		errorsResult = nullptr;
		useAbsoluteFileNames = true;
	}
};

bool runArmips(ArmipsArguments& arguments);

Fix symFileVersion not being initialized in ArmipsArguments constructor


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

#ifndef _COMPILER_H
#define _COMPILER_H

#if __STDC_VERSION__ < 201112L
#define _Static_assert(cond, msg) \
	extern char navi_static_assert_fail[1/(cond)]
#define _Noreturn
#define _Alignas(n) __attribute__((aligned(n)))
#endif

/*
 * GCC 2.96 or compatible required
 */
#if defined(__GNUC__)

#if __GNUC__ > 3
#undef offsetof
#define offsetof(type, member) __builtin_offsetof(type, member)
#endif

/* Optimization: Condition @x is likely */
#define likely(x) __builtin_expect(!!(x), 1)
/* Optimization: Condition @x is unlikely */
#define unlikely(x) __builtin_expect(!!(x), 0)

#define __used   __attribute__((used))
#define __unused __attribute__((unused))
#else

#define likely(x) (x)
#define unlikely(x) (x)

#define __used
#define __unused

#endif /* defined(__GNUC__) */
#endif /* _COMPILER_H */

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

#ifndef _COMPILER_H
#define _COMPILER_H

#if __STDC_VERSION__ < 201112L
#define _Static_assert(cond, msg) \
	extern char navi_static_assert_fail[1/(cond)]
#ifdef __GNUC__
#define _Noreturn __attribute__((noreturn))
#define _Alignas(n) __attribute__((aligned(n)))
#else
#define _Noreturn
#define _Alignas(n)
#pragma message "*** WARNING: _Alignas defined as NOP ***"
#endif
#endif

/*
 * GCC 2.96 or compatible required
 */
#if defined(__GNUC__)
/* Optimization: Condition @x is likely */
#define likely(x) __builtin_expect(!!(x), 1)
/* Optimization: Condition @x is unlikely */
#define unlikely(x) __builtin_expect(!!(x), 0)

#define __used   __attribute__((used))
#define __unused __attribute__((unused))
#else
#define likely(x) (x)
#define unlikely(x) (x)

#define __used
#define __unused
#endif /* defined(__GNUC__) */
#endif /* _COMPILER_H */

Use __attribute__s if __GNUC__ defined

Use __attribute__s if __GNUC__ defined

Otherwise, define _Noreturn and _Alignas as NOPs, and issue a warning
message.


//PARAM: --enable witness.yaml.enabled --enable ana.int.interval
#include <stdlib.h>

int foo(int* ptr1, int* ptr2){
    int result;
    if(ptr1 == ptr2){
        result = 0;
    } else {
        result = 1;
    }
    // Look at the generated witness.yml to check whether there contradictory precondition_loop_invariant[s]
    return result;
}

int main(){
    int five = 5;
    int five2 = 5;
    int y = foo(&five, &five);
    int z = foo(&five, &five2);
    assert(y != z);
    return 0;
}

//PARAM: --enable witness.yaml.enabled --enable ana.int.interval
#include <stdlib.h>

int foo(int* ptr1, int* ptr2){
    int result;
    if(ptr1 == ptr2){
        result = 0;
    } else {
        result = 1;
    }
    // Look at the generated witness.yml to check whether there are contradictory precondition_loop_invariant[s]
    return result;
}

int main(){
    int five = 5;
    int five2 = 5;
    int y = foo(&five, &five);
    int z = foo(&five, &five2);
    assert(y != z);
    return 0;
}

Add missing word in comment

Add missing word in comment


/*
    This is a simple C program which is a stub for the FS monitor.
    It takes one argument which would be a directory to monitor. In this case,
    the filename is discarded after argument validation.
    Every minute the
*/

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

int main (int argc, char **argv) {
    if (argc != 2) {
        fprintf(stderr, "Not enough arguments");
        exit(EXIT_FAILURE);
    }

    while (1) {
        fprintf(stdout, "{ \"key\": \"value\" }\n");
        fflush(stdout);
        fprintf(stderr, "tick\n");
        sleep(1);
    }
}

/*
    This is a simple C program which is a stub for the FS monitor.
    It takes one argument which would be a directory to monitor. In this case,
    the filename is discarded after argument validation.
    Every minute the
*/

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

int main (int argc, char **argv) {
    if (argc < 2) {
        fprintf(stderr, "Not enough arguments");
        exit(EXIT_FAILURE);
    }

    while (1) {
        fprintf(stdout, "{ \"key\": \"value\" }\n");
        fflush(stdout);
        fprintf(stderr, "tick\n");
        sleep(1);
    }
}

Fix arguments count check in test inotify program


/***************************************************************************
*   Copyright (C) 2006                                                    *
*                                                                         *
*   Jason Kivlighn (jkivlighn@gmail.com)                                  *
*                                                                         *
*   This program is free software; you can redistribute it and/or modify  *
*   it under the terms of the GNU General Public License as published by  *
*   the Free Software Foundation; either version 2 of the License, or     *
*   (at your option) any later version.                                   *
***************************************************************************/

#ifndef USDA_UNIT_DATA_H
#define USDA_UNIT_DATA_H

#include <klocale.h>

#include <qstring.h>

struct unit_data {
	const char *name;
	const char *plural;
};

static unit_data unit_data_list[] = {
            {"bag","bags"},
            {"block","blocks"},
            {"bottle","bottles"},
            {"box","boxes"},
            {"bunch","bunches"},
            {"can","cans"},
            {"cone","cones"},
            {"container","containers"},
            {"cube","cubes"},
            {"cup","cups"},
            {"fl oz","fl oz"},
            {"glass","glasses"},
            {"item","items"},
            {"loaf","loaves"},
            {"large","large"},
            {"lb","lbs"},
            {"junior","junior"},
            {"leaf","leaves"},
            {"medium","medium"},
            {"oz","oz"},
            {"pack","packs"},
            {"package","packages"},
            {"packet","packets"},
            {"piece","pieces"},
            {"pouch","pouches"},
            {"quart","quarts"},
            {"scoop","scoops"},
            {"sheet","sheets"},
            {"slice","slices"},
            {"small","small"},
            {"spear","spears"},
            {"sprout","spouts"},
            {"sprig","sprigs"},
            {"square","squares"},
            {"stalk","stalks"},
            {"stem","stems"},
            {"strip","strips"},
            {"tablespoon","tablespoons"},
            {"tbsp","tbsp"},
            {"teaspoon","teaspoons"},
            {"tsp","tsp"},
            {"tube","tubes"},
            {"unit","units"},
            {0,0}
};

static const char * prep_data_list[] = {
            "chopped",
            "diced",
            "sliced",
            "crumbled",
            "crushed",
            "ground",
            "grated",
            "mashed",
            "melted",
            "packed",
            "pureed",
            "quartered",
            "thawed",
            "shredded",
            "sifted",
            "pared",
            "flaked",
            "unpacked",
            "unsifted",
            "unthawed",
            "pitted",
            "peeled",
            "cooked",
            "hulled",
            "shelled",
            "raw",
            "whipped",
            0
};

bool parseUSDAUnitAndPrep( const QString &string, QString &unit, QString &prep );

#endif //USDA_UNIT_DATA_H

Add a missing file... fix that compile error.

svn path=/trunk/extragear/utils/krecipes/; revision=570474


// modified from 27/09
#include <assert.h>

int main() {
  int a = 1;
  int b = 1;
  int *x;
  int rnd;

  if (rnd)
    x = &a;
  else
    x = &b;

  assert(*x == 1);
  b = 2;

  assert(a == 1);
  if (*x > 1) { // invariant rules out x == &a
    assert(x == &b); // TODO
    assert(*x == 2); // TODO
  }
  return 0;
}

Add TODO test where ambiguous pointer invariant could refine pointer


/*
 * Part of Jari Komppa's zx spectrum suite
 * https://github.com/jarikomppa/speccy
 * released under the unlicense, see http://unlicense.org
 * (practically public domain)
*/

// xxxsmbbb
// where b = border color, m is mic, s is speaker
void port254(const unsigned char color) __z88dk_fastcall
{
    color; // color is in l
    // Direct border color setting
    __asm
        ld a,l
        ld hl, #_port254tonebit
        or a, (hl)
        out (254),a
    __endasm;
}

// practically waits for retrace
void do_halt()
{
    __asm
        halt
    __endasm;
}

/*
 * Part of Jari Komppa's zx spectrum suite
 * https://github.com/jarikomppa/speccy
 * released under the unlicense, see http://unlicense.org
 * (practically public domain)
*/

// xxxsmbbb
// where b = border color, m is mic, s is speaker
void port254(const unsigned char color) __z88dk_fastcall
{
    color; // color is in l
    // Direct border color setting
    __asm
        ld a,l
        ld hl, #_port254tonebit
        or a, (hl)
        out (254),a
    __endasm;
}

// practically waits for retrace
void do_halt()
{
    __asm
        ei
        halt
    __endasm;
}

Make sure we've enabled interrupts before calling halt..


//
//  SGCachePromise.h
//  Pods
//
//  Created by James Van-As on 13/05/15.
//
//

#import "Promise.h"
#import "MGEvents.h"

typedef void(^SGCacheFetchCompletion)(id obj);
typedef void(^SGCacheFetchFail)(NSError *error, BOOL wasFatal);
typedef void(^SGCacheFetchOnRetry)();

@interface SGCachePromise : PMKPromise
@property (nonatomic, copy) SGCacheFetchOnRetry onRetry;
@property (nonatomic, copy) SGCacheFetchFail onFail;
@end

//
//  SGCachePromise.h
//  Pods
//
//  Created by James Van-As on 13/05/15.
//
//

#import <PromiseKit/Promise.h>
#import <MGEvents/MGEvents.h>

typedef void(^SGCacheFetchCompletion)(id obj);
typedef void(^SGCacheFetchFail)(NSError *error, BOOL wasFatal);
typedef void(^SGCacheFetchOnRetry)();

@interface SGCachePromise : PMKPromise
@property (nonatomic, copy) SGCacheFetchOnRetry onRetry;
@property (nonatomic, copy) SGCacheFetchFail onFail;
@end

Use Framework style import statements for pod Framework compatibility


typedef enum { FALSE, TRUE } flagT;

struct Word
{
  short bar;
  short baz;
  flagT final:1;
  short quux;
} *word_limit;

void foo ()
{
  word_limit->final = (word_limit->final && word_limit->final);
}

Test case distilled from sed.

Test case distilled from sed.

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


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

// Author: gagansingh@google.com (Gagan Singh)

#ifndef NET_INSTAWEB_UTIL_PUBLIC_RE2_H_
#define NET_INSTAWEB_UTIL_PUBLIC_RE2_H_

#include "net/instaweb/util/public/string_util.h"

#include "third_party/re2/src/re2/re2.h"

using re2::RE2;

// Converts a Google StringPiece into an RE2 StringPiece.  These are of course
// the same basic thing but are declared in distinct namespaces and as far as
// C++ type-checking is concerned they are incompatible.
//
// TODO(jmarantz): In the re2 code itself there are no references to
// re2::StringPiece, always just plain StringPiece, so if we can
// arrange to get the right definition #included we should be all set.
// We could somehow rewrite '#include "re2/stringpiece.h"' to
// #include Chromium's stringpiece then everything would just work.
inline re2::StringPiece StringPieceToRe2(StringPiece sp) {
  return re2::StringPiece(sp.data(), sp.size());
}

#endif  // NET_INSTAWEB_UTIL_PUBLIC_RE2_H_

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

// Author: gagansingh@google.com (Gagan Singh)

#ifndef NET_INSTAWEB_UTIL_PUBLIC_RE2_H_
#define NET_INSTAWEB_UTIL_PUBLIC_RE2_H_

// TODO(morlovich): Remove this forwarding header and change all references.
#include "pagespeed/kernel/util/re2.h"

#endif  // NET_INSTAWEB_UTIL_PUBLIC_RE2_H_

Make this a proper forwarding header rather than a duplication what's under pagespeed/util/


#include "ring.h"

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

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

RING_FUNC(ring_get_gl_zero)
{
	RING_API_RETNUMBER(GL_ZERO);
}

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

#include "ring.h"

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

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

RING_FUNC(ring_get_gl_zero)
{
	RING_API_RETNUMBER(GL_ZERO);
}

RING_FUNC(ring_get_gl_false)
{
	RING_API_RETNUMBER(GL_FALSE);
}

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

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


//
//  WeakUniqueCollection.h
//  book-shelf
//
//  Created by Artem Gladkov on 28.06.16.
//  Copyright © 2016 Sibext Ltd. All rights reserved.
//

#import <Foundation/Foundation.h>

@interface WeakUniqueCollection<ObjectType> : NSObject

@property(readonly)NSUInteger count;

- (void)addObject:(ObjectType)object;
- (void)removeObject:(ObjectType)object;
- (void)removeAllObjects;

- (ObjectType)anyObject;
- (NSArray <ObjectType> *)allObjects;
- (BOOL)member:(ObjectType)object;

@end

//
//  WeakUniqueCollection.h
//  book-shelf
//
//  Created by Artem Gladkov on 28.06.16.
//  Copyright © 2016 Sibext Ltd. All rights reserved.
//

#import <Foundation/Foundation.h>

NS_ASSUME_NONNULL_BEGIN

/**
 WeakUniqueCollection keeps weak references to the objects and maintains uniqueness.
 It's public API is fully thread safe.

 WeakUniqueCollection is not optimized for working with large amount of objects.
 */
@interface WeakUniqueCollection<ObjectType> : NSObject

@property(readonly)NSUInteger count;

/**
 Adds object to the collection

 @param object ObjectType to be added to the collection
 */
- (void)addObject:(ObjectType)object;

/**
 Removes object from the collection (if collection contains it).

 @param object ObjectType to be removed from the collection
 */
- (void)removeObject:(ObjectType)object;

/**
 Removes all objects from the collection.
 */
- (void)removeAllObjects;

/**
 Returns any object from the collection.

 @return ObjectType or nil (if the collection is empty).
 */
- (nullable ObjectType)anyObject;

/**
 Returns array with all objects from the collection.

 @return NSArray with objects (cound be empty if the collection is empty).
 */
- (NSArray <ObjectType> *)allObjects;

/**
 Determines if the object is already contained in the collection.

 @param object ObjectType to be verified
 @return YES if object is in the collection
         NO if object is not in the collection
 */
- (BOOL)member:(ObjectType)object;

@end

NS_ASSUME_NONNULL_END

Add documentation for public API and nullability specification.


#include "stack.h"

struct Stack
{
	size_t size;
	size_t top;
	void** e;
}

Stack* Stack_Create(size_t n)
{
	Stack* s = (Stack *)malloc(sizeof(Stack));
	s->size = n;
	s->top = 0;
	s->e = (void**)malloc(sizeof(void*) * (n + 1));
	return s;
}

int Stack_Empty(Stack* s)
{
	if (s->top == 0)
	{
		return 1;
	} else {
		return 0;
	}
}

void Stack_Push(Stack* s, void* e)
{
	if (s == NULL) return;
	if (s->top == s->size) return;
	s->top = s->top + 1;
	s->e[s->top] = e;
}

void* Stack_Pop(Stack* s)
{
	if (Stack_Empty(s)) return;
	s->top = s->top - 1;
	return s->e[s->top];
}

void Stack_Destroy(Stack* s)
{
	if (s == NULL) return;
	free(s->e);
	free(s);
}

#include "stack.h"

struct Stack
{
	size_t size;
	size_t top;
	void** e;
}

Stack* Stack_Create(size_t n)
{
	Stack* s = (Stack *)malloc(sizeof(Stack));
	s->size = n;
	s->top = 0;
	s->e = (void**)malloc(sizeof(void*) * (n + 1));
	return s;
}

int Stack_Empty(Stack* s)
{
	if (s->top == 0)
	{
		return 1;
	} else {
		return 0;
	}
}

void Stack_Push(Stack* s, void* e)
{
	if (s == NULL) return;
	if (s->top == s->size) return;
	s->top = s->top + 1;
	s->e[s->top] = e;
}

void* Stack_Pop(Stack* s)
{
	if (Stack_Empty(s)) return;
	s->top = s->top - 1;
	return s->e[s->top+1];
}

void Stack_Destroy(Stack* s)
{
	if (s == NULL) return;
	free(s->e);
	free(s);
}

Fix incorrect return in pop operation

Fix incorrect return in pop operation


// CppUtils.h

#pragma once

#include <algorithm>
#include <functional>
#include <vector>
#include <random>

using namespace System;

namespace CppUtils {

	public ref class Random
	{
    public:
        double Random::random_double()
        {
            return Random::random_in_range(0.0, 1.0);
        }

        double Random::random_in_range(double min, double max)
        {
            std::uniform_real_distribution<float> distribution(min, max);
            std::random_device rd;
            std::default_random_engine e(rd());

            return distribution(e);
        }

        std::vector<double> Random::random_vector(double len, double min, double max)
        {
            auto result = std::vector<double>();

            std::uniform_real_distribution<float> distribution(min, max);
            std::mt19937 engine;
            auto generator = bind(distribution, engine);
            generate(result.begin(), result.end(), generator);

            return result;
        }
	};
}

// CppUtils.h

#pragma once

#ifdef DEBUG
#define SEED(x) 100
#else
#define SEED(x) x
#endif

#include <algorithm>
#include <functional>
#include <vector>
#include <random>

using namespace System;

namespace CppUtils {

	public ref class Random
	{
    public:
        double Random::random_double()
        {
            return Random::random_in_range(0.0, 1.0);
        }

        double Random::random_in_range(double min, double max)
        {
            std::uniform_real_distribution<float> distribution(min, max);
            std::random_device rd;
            std::default_random_engine e(SEED(rd()));

            return distribution(e);
        }

        std::vector<double> Random::random_vector(double len, double min, double max)
        {
            auto result = std::vector<double>();

            std::uniform_real_distribution<float> distribution(min, max);
            std::random_device rd;
            std::default_random_engine engine(SEED(rd()));
            auto generator = bind(distribution, engine);
            std::generate(result.begin(), result.end(), generator);

            return result;
        }
	};
}

Debug macro for seeding random generator.


// This uses a headermap with this entry:
//   someheader.h -> Product/someheader.h

// RUN: %clang_cc1 -fsyntax-only %s -iquote %S/Inputs/headermap-rel2/project-headers.hmap -isysroot %S/Inputs/headermap-rel2/system -I %S/Inputs/headermap-rel2 -H 2> %t.out
// RUN: FileCheck %s -input-file %t.out

// CHECK: Product/someheader.h
// CHECK: system/usr/include/someheader.h
// CHECK: system/usr/include/someheader.h

#include "someheader.h"
#include <someheader.h>
#include <someheader.h>

// This uses a headermap with this entry:
//   someheader.h -> Product/someheader.h

// RUN: %clang_cc1 -v -fsyntax-only %s -iquote %S/Inputs/headermap-rel2/project-headers.hmap -isysroot %S/Inputs/headermap-rel2/system -I %S/Inputs/headermap-rel2 -H
// RUN: %clang_cc1 -fsyntax-only %s -iquote %S/Inputs/headermap-rel2/project-headers.hmap -isysroot %S/Inputs/headermap-rel2/system -I %S/Inputs/headermap-rel2 -H 2> %t.out
// RUN: FileCheck %s -input-file %t.out

// CHECK: Product/someheader.h
// CHECK: system/usr/include/someheader.h
// CHECK: system/usr/include/someheader.h

#include "someheader.h"
#include <someheader.h>
#include <someheader.h>

[test] Add a RUN line to get a hint on why the test is failing at the buildbots.

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


#include "estimator.h"
#include <stdio.h>

int main(int argc, char** argv) {
    void* estimator = create_estimator(argv[1]);
    candidates_t* candidates = estimate(estimator, argv[2]);

    for(unsigned int i = 0; i < candidates->candidates[0]->size; i++) {
        printf("x: %4lu  y: %4lu  confidence: %.4f \n",
                candidates->candidates[0]->parts[i]->x,
                candidates->candidates[0]->parts[i]->y,
                candidates->candidates[0]->confidence[i]);
    }
    printf("\n");

    destroy_estimator(estimator);
    free_candidates(candidates);
}

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

#include "estimator.h"

int main(int argc, char** argv) {
    //test();

    if(argc < 3) {
        printf("Usage: PartsBasedDetector1 model_file image_file\n");
        exit(0);
    }

    void* estimator = create_estimator(argv[1]);
    candidates_t* candidates = estimate(estimator, argv[2]);
    print_candidate(candidates->candidates[0]);

    destroy_estimator(estimator);
    free_candidates(candidates);
}

Delete printing, show usage if arguments are not enough


/* Copyright (C) 2003 Free Software Foundation, Inc.
   This file is part of the GNU C Library.

   The GNU C Library is free software; you can redistribute it and/or
   modify it under the terms of the GNU Lesser General Public
   License as published by the Free Software Foundation; either
   version 2.1 of the License, or (at your option) any later version.

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

   You should have received a copy of the GNU Lesser General Public
   License along with the GNU C Library; if not, write to the Free
   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
   02111-1307 USA.  */

#include "pthreadP.h"

int
pthread_spin_lock (lock)
     pthread_spinlock_t *lock;
{
  unsigned int val;

  do
    __asm__ volatile ("tas.b @%1; movt %0"
		  : "=&r" (val)
		  : "r" (lock)
		  : "memory");
  while (val == 0);

  return 0;
}

/* Copyright (C) 2003 Free Software Foundation, Inc.
   This file is part of the GNU C Library.

   The GNU C Library is free software; you can redistribute it and/or
   modify it under the terms of the GNU Lesser General Public
   License as published by the Free Software Foundation; either
   version 2.1 of the License, or (at your option) any later version.

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

   You should have received a copy of the GNU Lesser General Public
   License along with the GNU C Library; if not, write to the Free
   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
   02111-1307 USA.  */

#include "pthreadP.h"

int
pthread_spin_lock (pthread_spinlock_t *lock)
{
  unsigned int val;

  do
    __asm__ volatile ("tas.b @%1; movt %0"
		  : "=&r" (val)
		  : "r" (lock)
		  : "memory");
  while (val == 0);

  return 0;
}

nptl: Remove compiler warning due to old-style function definition

Signed-off-by: Carmelo Amoroso <532378793705a04edd56deb76ad8c0442834d55d@st.com>


/*
 *  Minimal configuration for using TLS in the bootloader
 *
 *  Copyright (C) 2006-2015, ARM Limited, All Rights Reserved
 *  Copyright (C) 2016, Linaro Ltd
 *  SPDX-License-Identifier: Apache-2.0
 *
 *  Licensed under the Apache License, Version 2.0 (the "License"); you may
 *  not use this file except in compliance with the License.
 *  You may obtain a copy of the License at
 *
 *  http://www.apache.org/licenses/LICENSE-2.0
 *
 *  Unless required by applicable law or agreed to in writing, software
 *  distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
 *  WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *  See the License for the specific language governing permissions and
 *  limitations under the License.
 *
 *  This file is part of mbed TLS (https://tls.mbed.org)
 */

/*
 * Minimal configuration for using TLS in the bootloader
 *
 * - RSA or ECDSA signature verification
 */

#ifndef MCUBOOT_MBEDTLS_CONFIG_KW
#define MCUBOOT_MBEDTLS_CONFIG_KW

#ifdef CONFIG_MCUBOOT_SERIAL
/* Mcuboot uses mbedts-base64 for serial protocol encoding. */
#define MBEDTLS_BASE64_C
#endif

/* System support */
#define MBEDTLS_PLATFORM_C
#define MBEDTLS_PLATFORM_MEMORY
#define MBEDTLS_MEMORY_BUFFER_ALLOC_C
#define MBEDTLS_PLATFORM_NO_STD_FUNCTIONS
#define MBEDTLS_PLATFORM_EXIT_ALT
#define MBEDTLS_NO_PLATFORM_ENTROPY
#define MBEDTLS_NO_DEFAULT_ENTROPY_SOURCES
#define MBEDTLS_PLATFORM_PRINTF_ALT

#if !defined(CONFIG_ARM)
#define MBEDTLS_HAVE_ASM
#endif

#define MBEDTLS_SHA256_C
#define MBEDTLS_AES_C
#define MBEDTLS_CIPHER_C
#define MBEDTLS_NIST_KW_C

#include "mbedtls/check_config.h"

#endif /* MCUBOOT_MBEDTLS_CONFIG_KW */

Add mbedtls config with nist_kw enabled

Add mbedtls config with nist_kw enabled

This adds a mbedtls config that will enable the simulator to run tests
for the kw based encrypted images.

Signed-off-by: Fabio Utzig <66676b1ceaf93296e098708c09494361103aa635@apache.org>


#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

#ifndef CJET_CONFIG_H
#define CJET_CONFIG_H

#define SERVER_PORT 11122
#define LISTEN_BACKLOG 40

#define MAX_MESSAGE_SIZE 250

/* Linux specific configs */
#define MAX_EPOLL_EVENTS 100

#endif

Increase the size of the read buffer fpo testing.


/*
 * atlstd.h
 *
 * Created: 3/31/2017 12:29:59 AM
 *  Author: Vadim Zabavnov
 */

#ifndef ATLSTD_H_
#define ATLSTD_H_

#include <atlport.h>

namespace atl {
namespace std {

using namespace atl;

// standard ports

#ifdef PORTA
const Port PortA = Port(_SFR_IO_ADDR(PORTA), _SFR_IO_ADDR(DDRA), _SFR_IO_ADDR(PINA));
#endif

#ifdef PORTB
const Port PortB = Port(_SFR_IO_ADDR(PORTB), _SFR_IO_ADDR(DDRB), _SFR_IO_ADDR(PINB));
#endif

#ifdef PORTC
const Port PortC = Port(_SFR_IO_ADDR(PORTC), _SFR_IO_ADDR(DDRC), _SFR_IO_ADDR(PINC));
#endif

#ifdef PORTD
const Port PortD = Port(_SFR_IO_ADDR(PORTD), _SFR_IO_ADDR(DDRD), _SFR_IO_ADDR(PIND));
#endif

}
}

#endif /* ATLSTD_H_ */

/*
 * atlstd.h
 *
 * Created: 3/31/2017 12:29:59 AM
 *  Author: Vadim Zabavnov
 */

#ifndef ATLSTD_H_
#define ATLSTD_H_

#include <atlport.h>

namespace atl {
namespace std {

using namespace atl;

// standard ports

#ifdef PORTA
constexpr Port PortA = Port(_SFR_IO_ADDR(PORTA), _SFR_IO_ADDR(DDRA), _SFR_IO_ADDR(PINA));
#endif

#ifdef PORTB
constexpr Port PortB = Port(_SFR_IO_ADDR(PORTB), _SFR_IO_ADDR(DDRB), _SFR_IO_ADDR(PINB));
#endif

#ifdef PORTC
constexpr Port PortC = Port(_SFR_IO_ADDR(PORTC), _SFR_IO_ADDR(DDRC), _SFR_IO_ADDR(PINC));
#endif

#ifdef PORTD
constexpr Port PortD = Port(_SFR_IO_ADDR(PORTD), _SFR_IO_ADDR(DDRD), _SFR_IO_ADDR(PIND));
#endif

}
}

#endif /* ATLSTD_H_ */

Make ports constexpr to further reduce binary size


// cc log_example.c log.c

#include "log.h"

int main(int argc, const char *argv[])
{
    log_open("example", NULL, 0);
    /* set log level to info, also the default level */
    log_setlevel(LOG_INFO);
    /* debug mesage won't be seen */
    log_debug("debug message");
    /* but info and warn message can be seen */
    log_info("info message");
    log_warn("warn message");
    return 0;
}

// cc log_example.c log.c

#include "log.h"

int main(int argc, const char *argv[])
{
    /* open global logger to stderr (by setting filename to NULL) */
    log_open("example", NULL, 0);
    /* set log level to info, also the default level */
    log_setlevel(LOG_INFO);
    /* debug mesage won't be seen */
    log_debug("debug message");
    /* but info and warn message can be seen */
    log_info("info message");
    log_warn("warn message");
    return 0;
}

Add minor comment for log_open

Add minor comment for log_open


#include <stdio.h>
#include <stdlib.h>
#include "apricosterm.h"
#include "screen.h"

int main(int argc, char** argv) {
    SDL_Event event;
    initScreen("Potato", SCREEN_WIDTH, SCREEN_HEIGHT);
    char done = 0;

    while(!done) {
        while(SDL_PollEvent(&event)) {
            switch(event.key.keysym.sym) {
                case SDLK_ESCAPE:
                    done = 1;
                    break;
            }
        }
        SDL_Delay(100);
        updateWindow();
    }
    destroyScreen();

    return EXIT_SUCCESS;
}

#include <stdio.h>
#include <stdlib.h>
#include "apricosterm.h"
#include "screen.h"
#include "terminalrenderer.h"
#include "managedtextures.h"

int main(int argc, char** argv) {
    SDL_Event event;
    initScreen("Potato", SCREEN_WIDTH, SCREEN_HEIGHT);
    char done = 0;
    termRendererInit();

    SDL_StartTextInput();
    while(!done) {
        while(SDL_PollEvent(&event)) {
            switch(event.type) {
                case SDL_KEYDOWN:
                    switch(event.key.keysym.sym) {
                        case SDLK_ESCAPE:
                            done = 1;
                            break;
                        case SDLK_RETURN:
                            terminalNewLine(1, 1);
                            break;
                        case SDLK_BACKSPACE:
                            terminalBackspace(1);
                            break;
                        default:
                            break;
                    }
                    break;
                case SDL_TEXTINPUT:
                    terminalPutStr(event.text.text);
                    break;
                case SDL_QUIT:
                    done = 1;
                    break;
                default:
                    break;
            }
        }
        SDL_Delay(10);
        terminalRefresh();
    }

    SDL_StopTextInput();
    destroyAllTextures();
    destroyScreen();

    return EXIT_SUCCESS;
}

Integrate terminal renderer for testing

Integrate terminal renderer for testing


/**
 * repo.c
 *
 * Copyright (C) 2017 Nickolas Burr <nickolasburr@gmail.com>
 */

#include "repo.h"

/**
 * Get all stashes for a repository.
 */
struct stash *get_stashes (struct repo *r) {
	return r->stashes;
}

/**
 * Set a copy of all stashes for a repository in memory.
 */
void set_stashes (struct repo *r) {
	// @todo: Build this function out.
	char *cmd;
	FILE *fp;

	printf("set_stashes -> r->path -> %s\n", r->path);

	sprintf(cmd, "/usr/bin/git -C %s -- stash list", r->path);

	fp = popen(cmd, "r");

	if (!fp) {
		printf("Could not open pipe!\n");

		exit(EXIT_FAILURE);
	}

	while (fgets(r->stashes->entries, (sizeof(r->stashes->entries) - 1), fp) != NULL) {
		printf("%s\n", r->stashes->entries);
	}

	pclose(fp);
}

/**
 * Check if the worktree has changed since our last check.
 */
int has_worktree_changed (struct repo *r) {
	return 1;
}

/**
 * repo.c
 *
 * Copyright (C) 2017 Nickolas Burr <nickolasburr@gmail.com>
 */
#include "repo.h"

/**
 * Get all stash entries for a repository.
 */
struct stash *get_stash (struct repo *r) {
	return r->stash;
}

/**
 * Set a copy of all stash entries for a repository.
 */
void set_stash (struct repo *r) {
	char *cmd;
	FILE *fp;

	// Allocate space for command string
	cmd = ALLOC(sizeof(char) * (strlen(r->path) + 100));

	sprintf(cmd, "/usr/bin/git -C %s stash list", r->path);
	printf("set_stashes -> cmd -> %s\n", cmd);

	fp = popen(cmd, "r");

	if (!fp) {
		printf("Could not open pipe!\n");

		exit(EXIT_FAILURE);
	}

	while (fgets(r->stash->entries, (sizeof(r->stash->entries) - 1), fp) != NULL) {
		printf("%s\n", r->stash->entries);
	}

	// Free space allocated for commnad string
	FREE(cmd);
	pclose(fp);
}

/**
 * Check if the worktree has changed since the last check.
 */
int has_worktree_changed (struct repo *r) {
	return 1;
}

Work on stash retrieval, memory allocation


task usercontrol(){
	int DY, DT;
	bool armsLocked = false;

	while(true){
		//Driving
		DY = threshold(PAIRED_CH2, 15);
		DT = threshold(PAIRED_CH1, 15);
		drive(DY, DT);

		//Pistons (toggle)
		if(PAIRED_BTN7R){
			pistons(!PISTON_POS);
			waitUntil(!PAIRED_BTN7R);
		}

		//Arms
		if(PAIRED_BTN7L){
			armsLocked = !armsLocked;
			waitUntil(!PAIRED_BTN7L);
		}
		if(armsLocked){
			arms(ARM_LOCK);
		} else {
			arms((PAIRED_BTN6U - PAIRED_BTN6D) * MAX_POWER);
		}

		//Lift
		lift((PAIRED_BTN7U - PAIRED_BTN7D) * MAX_POWER);

		//Intake
		intake((PAIRED_BTN5U - PAIRED_BTN5D) * MAX_POWER);
	}
}

task usercontrol(){
	int DY, DT;
	bool armsLocked = false;

	while(true){
		//Driving
		DY = threshold(PAIRED_CH2, 15) + (PAIRED_BTN8U * MAX_POWER) - (PAIRED_BTN8D * MAX_POWER);
		DT = threshold(PAIRED_CH1, 15) + (PAIRED_BTN8R * MAX_POWER) - (PAIRED_BTN8L * MAX_POWER);
		drive(DY, DT);

		//Pistons (toggle)
		if(PAIRED_BTN7R){
			pistons(!PISTON_POS);
			waitUntil(!PAIRED_BTN7R);
		}

		//Arms
		if(PAIRED_BTN7L){
			armsLocked = !armsLocked;
			waitUntil(!PAIRED_BTN7L);
		}
		if(armsLocked){
			arms(ARM_LOCK);
		} else {
			arms(threshold(PAIRED_CH3, 15) + ((PAIRED_BTN5U - PAIRED_BTN5D) * MAX_POWER));
		}

		//Lift
		lift((PAIRED_BTN7U - PAIRED_BTN7D) * MAX_POWER);

		//Intake
		intake((PAIRED_BTN6U - PAIRED_BTN6D) * MAX_POWER);
	}
}

Add buttons for driving, and swap intake and arm buttons


//
//  SMLTextViewPrivate.h
//  Fragaria
//
//  Created by Daniele Cattaneo on 26/02/15.
//
//

#import <Cocoa/Cocoa.h>
#import "SMLTextView.h"
#import "SMLAutoCompleteDelegate.h"

@interface SMLTextView ()

/** The autocomplete delegate for this text view. This property is private
 * because it is set to an internal object when MGSFragaria's autocomplete
 * delegate is set to nil. */
@property id<SMLAutoCompleteDelegate> autocompleteDelegate;

/** The controller which manages the accessory user interface for this text
 * view. */
@property (readonly) MGSExtraInterfaceController *interfaceController;

/** Instances of this class will perform syntax highlighting in text views. */
@property (readonly) SMLSyntaxColouring *syntaxColouring;

@end

//
//  SMLTextViewPrivate.h
//  Fragaria
//
//  Created by Daniele Cattaneo on 26/02/15.
//
//

#import <Cocoa/Cocoa.h>
#import "SMLTextView.h"
#import "SMLAutoCompleteDelegate.h"

@interface SMLTextView ()

/** The autocomplete delegate for this text view. This property is private
 * because it is set to an internal object when MGSFragaria's autocomplete
 * delegate is set to nil. */
@property (weak) id<SMLAutoCompleteDelegate> autocompleteDelegate;

/** The controller which manages the accessory user interface for this text
 * view. */
@property (readonly) MGSExtraInterfaceController *interfaceController;

/** Instances of this class will perform syntax highlighting in text views. */
@property (readonly) SMLSyntaxColouring *syntaxColouring;

@end

Use weak attribute for the autocompleteDelegate property of SMLTextView.


#include <jni.h>
#include <android/log.h>

JNIEXPORT jint JNICALL JNI_OnLoad(JavaVM* vm, void* reserved)
{
    __android_log_print(ANDROID_LOG_VERBOSE, "Scavenger Jni", "JNI_OnLoad is called");
}

#include <jni.h>
#include <signal.h>
#include <android/log.h>

#define CATCHSIG(X) sigaction(X, &handler, &old_sa[X])

static struct sigaction old_sa[NSIG];

void android_sigaction(int signal, siginfo_t *info, void *reserved) {
    // TODO invoke java method
}

JNIEXPORT jint JNICALL JNI_OnLoad(JavaVM* vm, void* reserved)
{
    __android_log_print(ANDROID_LOG_VERBOSE, "Scavenger Jni", "JNI_OnLoad is called");
    struct sigaction handler;
    memset(&handler, 0, sizeof(sigaction));
    handler.sa_sigaction = android_sigaction;
    handler.sa_flags = SA_RESETHAND;
    CATCHSIG(SIGILL);
    CATCHSIG(SIGABRT);
    CATCHSIG(SIGBUS);
    CATCHSIG(SIGFPE);
    CATCHSIG(SIGSEGV);
    CATCHSIG(SIGPIPE);
    return JNI_VERSION_1_4;
}

Add jni code to catch crash signal

Add jni code to catch crash signal


/*
 *  Copyright (c) 2012 The WebM project authors. All Rights Reserved.
 *
 *  Use of this source code is governed by a BSD-style license
 *  that can be found in the LICENSE file in the root of the source
 *  tree. An additional intellectual property rights grant can be found
 *  in the file PATENTS.  All contributing project authors may
 *  be found in the AUTHORS file in the root of the source tree.
 */

#ifndef LIBVPX_TEST_ACM_RANDOM_H_
#define LIBVPX_TEST_ACM_RANDOM_H_

#include <stdint.h>
#include <stdlib.h>

namespace libvpx_test {

class ACMRandom {
 public:
  explicit ACMRandom(int seed) {
    Reset(seed);
  }

  void Reset(int seed) {
    srand(seed);
  }

  uint8_t Rand8(void) {
    return (rand() >> 8) & 0xff;
  }

  int PseudoUniform(int range) {
    return (rand() >> 8) % range;
  }

  int operator()(int n) {
    return PseudoUniform(n);
  }

  static int DeterministicSeed(void) {
    return 0xbaba;
  }
};

}  // namespace libvpx_test

#endif  // LIBVPX_TEST_ACM_RANDOM_H_

/*
 *  Copyright (c) 2012 The WebM project authors. All Rights Reserved.
 *
 *  Use of this source code is governed by a BSD-style license
 *  that can be found in the LICENSE file in the root of the source
 *  tree. An additional intellectual property rights grant can be found
 *  in the file PATENTS.  All contributing project authors may
 *  be found in the AUTHORS file in the root of the source tree.
 */

#ifndef LIBVPX_TEST_ACM_RANDOM_H_
#define LIBVPX_TEST_ACM_RANDOM_H_

#include <stdlib.h>

#include "vpx/vpx_integer.h"

namespace libvpx_test {

class ACMRandom {
 public:
  explicit ACMRandom(int seed) {
    Reset(seed);
  }

  void Reset(int seed) {
    srand(seed);
  }

  uint8_t Rand8(void) {
    return (rand() >> 8) & 0xff;
  }

  int PseudoUniform(int range) {
    return (rand() >> 8) % range;
  }

  int operator()(int n) {
    return PseudoUniform(n);
  }

  static int DeterministicSeed(void) {
    return 0xbaba;
  }
};

}  // namespace libvpx_test

#endif  // LIBVPX_TEST_ACM_RANDOM_H_

Use vpx_integer.h instead of stdint.h

Use vpx_integer.h instead of stdint.h

vpx_integer accounts for win32, which does not have stdint.h

Change-Id: I0ecf243ba56ed2e920e1293a6876c2e1ef1af99e


#ifndef COMMAND_LINE_FLAGS_H_
#define COMMAND_LINE_FLAGS_H_

#include "kinetic/kinetic.h"

#include "gflags/gflags.h"

DEFINE_string(host, "localhost", "Kinetic Host");
DEFINE_uint64(port, 8123, "Kinetic Port");
DEFINE_uint64(timeout, 30, "Timeout");

void parse_flags(int *argc, char*** argv, std::unique_ptr<kinetic::ConnectionHandle>& connection) {
    google::ParseCommandLineFlags(argc, argv, true);

    kinetic::ConnectionOptions options;
    options.host = FLAGS_host;
    options.port = FLAGS_port;
    options.user_id = 1;
    options.hmac_key = "asdfasdf";

    kinetic::KineticConnectionFactory kinetic_connection_factory = kinetic::NewKineticConnectionFactory();

    if (!kinetic_connection_factory.NewConnection(options, FLAGS_timeout, connection).ok()) {
        printf("Unable to connect\n");
        exit(1);
    }
}

#endif  // COMMAND_LINE_FLAGS_H_

#ifndef COMMAND_LINE_FLAGS_H_
#define COMMAND_LINE_FLAGS_H_

#include "kinetic/kinetic.h"

#include "gflags/gflags.h"

DEFINE_string(host, "localhost", "Kinetic Host");
DEFINE_uint64(port, 8123, "Kinetic Port");
DEFINE_uint64(timeout, 30, "Timeout");
DEFINE_uint64(user_id, 1, "Kinetic User ID");
DEFINE_string(hmac_key, "asdfasdf", "Kinetic User HMAC key");

void parse_flags(int *argc, char*** argv, std::unique_ptr<kinetic::ConnectionHandle>& connection) {
    google::ParseCommandLineFlags(argc, argv, true);

    kinetic::ConnectionOptions options;
    options.host = FLAGS_host;
    options.port = FLAGS_port;
    options.user_id = FLAGS_user_id;
    options.hmac_key = FLAGS_hmac_key;

    kinetic::KineticConnectionFactory kinetic_connection_factory = kinetic::NewKineticConnectionFactory();

    if (!kinetic_connection_factory.NewConnection(options, FLAGS_timeout, connection).ok()) {
        printf("Unable to connect\n");
        exit(1);
    }
}

#endif  // COMMAND_LINE_FLAGS_H_

Allow setting user id/hmac key via command line params for setpin


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

main(int argc, char **argv)
{
  register double width;
  double sum = 0, lsum;
  register int intervals, i;
  int nproc, iproc;
  MPI_Win sum_win;

  if (MPI_Init(&argc, &argv) != MPI_SUCCESS) exit(1);
  MPI_Comm_size(MPI_COMM_WORLD, &nproc);
  MPI_Comm_rank(MPI_COMM_WORLD, &iproc);
  MPI_Win_create(&sum, sizeof(sum), sizeof(sum),
                 0, MPI_COMM_WORLD, &sum_win);
  MPI_Win_fence(0, sum_win);
  intervals = atoi(argv[1]);
  width = 1.0 / intervals;
  lsum = 0;
  for (i=iproc; i<intervals; i+=nproc) {
    register double x = (i + 0.5) * width;
    lsum += 4.0 / (1.0 + x * x);
  }
  lsum *= width;
  MPI_Accumulate(&lsum, 1, MPI_DOUBLE, 0, 0,
                 1, MPI_DOUBLE, MPI_SUM, sum_win);
  MPI_Win_fence(0, sum_win);
  if (iproc == 0) {
    printf("Estimation of pi is %f\n", sum);
  }
  MPI_Finalize();
  return(0);
}

Replace MPI source code instead of executive binary file.
User will compile the source with its own mpi implementation.

git-svn-id: 9146c88ff6d39b48099bf954d15d68f687b3fa69@3133 28e8926c-6b08-0410-baaa-805c5e19b8d6


#pragma once

#include <QObject>
#include <QProcess>
#include <QString>

#include "Config/AmigaUAEConfig.h"

class QTemporaryDir;

namespace prodbg {

///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

class AmigaUAE : public QObject
{
    Q_OBJECT

public:
    AmigaUAE(QObject* parent);
    ~AmigaUAE();

    bool openFile();
    void runExecutable(const QString& filename);
    bool validateSettings();
    void launchUAE();
    void killProcess();

    // TODO: Structure this better

    QProcess* m_uaeProcess;
    uint16_t m_setFileId;
    uint16_t m_setHddPathId;
    QString m_uaeExe;
    QString m_config;
    QString m_cmdLineArgs;
    QString m_dh0Path;
    QString m_fileToRun;
    QString m_localExeToRun;
    QString m_romPath;
    bool m_copyFiles;
    bool m_skipUAELaunch;
    AmigaUAEConfig::ConfigMode m_configMode;

private:
    Q_SLOT void started();
    Q_SLOT void errorOccurred(QProcess::ProcessError error);

    QTemporaryDir* m_tempDir;

    void readSettings();

    bool m_running = false;
};

///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
}

#pragma once

#include <QObject>
#include <QProcess>
#include <QString>

#include "Config/AmigaUAEConfig.h"

class QTemporaryDir;

namespace prodbg {

///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

class AmigaUAE : public QObject
{
    Q_OBJECT

public:
    AmigaUAE(QObject* parent);
    ~AmigaUAE();

    bool openFile();
    void runExecutable(const QString& filename);
    bool validateSettings();
    void launchUAE();
    void killProcess();

    // TODO: Structure this better

    QProcess* m_uaeProcess;
    uint16_t m_setFileId;
    uint16_t m_setHddPathId;
    QString m_uaeExe;
    QString m_config;
    QString m_cmdLineArgs;
    QString m_dh0Path;
    QString m_fileToRun;
    QString m_localExeToRun;
    QString m_romPath;
    bool m_copyFiles;
    bool m_skipUAELaunch;
    AmigaUAEConfig::ConfigMode m_configMode;

private:
    Q_SLOT void started();
    Q_SLOT void errorOccurred(QProcess::ProcessError error);

    QTemporaryDir* m_tempDir = nullptr;

    void readSettings();

    bool m_running = false;
};

///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
}

Set tempdir to null by default

Set tempdir to null by default


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

#ifndef ATOM_BROWSER_API_ATOM_API_MENU_VIEWS_H_
#define ATOM_BROWSER_API_ATOM_API_MENU_VIEWS_H_

#include <map>
#include <memory>

#include "atom/browser/api/atom_api_menu.h"
#include "base/memory/weak_ptr.h"
#include "ui/display/screen.h"
#include "ui/views/controls/menu/menu_runner.h"

namespace atom {

namespace api {

class MenuViews : public Menu {
 public:
  MenuViews(v8::Isolate* isolate, v8::Local<v8::Object> wrapper);

 protected:
  void PopupAt(
      Window* window, int x, int y, int positioning_item) override;
  void ClosePopupAt(int32_t window_id) override;

 private:
  // window ID -> open context menu
  std::map<int32_t, std::unique_ptr<views::MenuRunner>> menu_runners_;

  base::WeakPtrFactory<MenuViews> weak_factory_;

  DISALLOW_COPY_AND_ASSIGN(MenuViews);
};

}  // namespace api

}  // namespace atom

#endif  // ATOM_BROWSER_API_ATOM_API_MENU_VIEWS_H_

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

#ifndef ATOM_BROWSER_API_ATOM_API_MENU_VIEWS_H_
#define ATOM_BROWSER_API_ATOM_API_MENU_VIEWS_H_

#include <map>
#include <memory>

#include "atom/browser/api/atom_api_menu.h"
#include "base/memory/weak_ptr.h"
#include "ui/display/screen.h"
#include "ui/views/controls/menu/menu_runner.h"

namespace atom {

namespace api {

class MenuViews : public Menu {
 public:
  MenuViews(v8::Isolate* isolate, v8::Local<v8::Object> wrapper);

 protected:
  void PopupAt(
      Window* window, int x, int y, int positioning_item,
      CloseCallback callback) override;
  void ClosePopupAt(int32_t window_id) override;

 private:
  // window ID -> open context menu
  std::map<int32_t, std::unique_ptr<views::MenuRunner>> menu_runners_;

  base::WeakPtrFactory<MenuViews> weak_factory_;

  DISALLOW_COPY_AND_ASSIGN(MenuViews);
};

}  // namespace api

}  // namespace atom

#endif  // ATOM_BROWSER_API_ATOM_API_MENU_VIEWS_H_

Fix missing PopupAt overrides on windows/linux

Auditors: 47e4a4954d6a66edd1210b9b46e0a144c1078e87@bsclifton