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

#ifndef GRPC_CORE_LIB_GPRPP_OPTIONAL_H
#define GRPC_CORE_LIB_GPRPP_OPTIONAL_H

namespace grpc_core {

/* A make-shift alternative for absl::Optional. This can be removed in favor of
 * that once absl dependencies can be introduced. */
template <typename T>
class Optional {
 public:
  void set(const T& val) {
    value_ = val;
    set_ = true;
  }

  bool has_value() { return set_; }

  void reset() { set_ = false; }

  T value() { return value_; }

 private:
  T value_;
  bool set_ = false;
};

} /* namespace grpc_core */

#endif /* GRPC_CORE_LIB_GPRPP_OPTIONAL_H */

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

#ifndef GRPC_CORE_LIB_GPRPP_OPTIONAL_H
#define GRPC_CORE_LIB_GPRPP_OPTIONAL_H

namespace grpc_core {

/* A make-shift alternative for absl::Optional. This can be removed in favor of
 * that once absl dependencies can be introduced. */
template <typename T>
class Optional {
 public:
  void set(const T& val) {
    value_ = val;
    set_ = true;
  }

  bool has_value() const { return set_; }

  void reset() { set_ = false; }

  T value() const { return value_; }

 private:
  T value_;
  bool set_ = false;
};

} /* namespace grpc_core */

#endif /* GRPC_CORE_LIB_GPRPP_OPTIONAL_H */

Add const qualifiers to member methods in Optional


/*
 * Myr C Utils library
 *
 * Written 2015 by Rickard Närström <rickard@narstrom.se>
 *
 * To the extent possible under law, the author(s) have dedicated all copyright
 * and related and neighboring rights to this software to the public domain worldwide.
 * This software is distributed without any warranty.
 *
 * You should have received a copy of the CC0 Public Domain Dedication along
 * with this software. If not, see <http://creativecommons.org/publicdomain/zero/1.0/>.
 */
#ifndef MYR_COMPILER_H
#define MYR_COMPILER_H

#ifndef __has_attribute
# define __has_attribute(x) 0
#endif

#if defined(__GNUC__) || __has_attribute(noreturn)
# define NORETURN __attribute__((noreturn))
#else
# define NORETURN
#endif

#if defined(__GNUC__) || __has_attribute(format)
# define FORMAT(archtype, string_index, first_to_check) __attribute__((format(archtype, string_index, first_to_check)))
#else
# define FORMAT(archtype, string_index, first_to_check)
#endif

#endif

/*
 * Myr C Utils library
 *
 * Written 2015 by Rickard Närström <rickard@narstrom.se>
 *
 * To the extent possible under law, the author(s) have dedicated all copyright
 * and related and neighboring rights to this software to the public domain worldwide.
 * This software is distributed without any warranty.
 *
 * You should have received a copy of the CC0 Public Domain Dedication along
 * with this software. If not, see <http://creativecommons.org/publicdomain/zero/1.0/>.
 */
#ifndef MYR_COMPILER_H
#define MYR_COMPILER_H

#ifndef __has_attribute
# define __has_attribute(x) 0
#endif

#if __STDC_VERSION__ >= 201112L
# include <stdnoreturn.h>
# define NORETURN noreturn
#elif defined(__GNUC__) || __has_attribute(noreturn)
# define NORETURN __attribute__((noreturn))
#else
# define NORETURN
#endif

#if defined(__GNUC__) || __has_attribute(format)
# define FORMAT(archtype, string_index, first_to_check) __attribute__((format(archtype, string_index, first_to_check)))
#else
# define FORMAT(archtype, string_index, first_to_check)
#endif

#endif

Use standard C11 noreturn if avaiable.

Use standard C11 noreturn if avaiable.


#include <stdio.h>

int main() {
    float a, b, c;

    scanf("%f", &a);
    scanf("%f", &b);
    scanf("%f", &c);

    printf("MEDIA = %.1f\n", (a * 2.0 + b * 3.0 + c * 5.0) / 10.0);

    return 0;
}

Solve Average 2 in c

Solve Average 2 in c


/*
 * Author: Landon Fuller <landonf@plausible.coop>
 *
 * Copyright (c) 2013 Plausible Labs Cooperative, Inc.
 * All rights reserved.
 *
 * Permission is hereby granted, free of charge, to any person
 * obtaining a copy of this software and associated documentation
 * files (the "Software"), to deal in the Software without
 * restriction, including without limitation the rights to use,
 * copy, modify, merge, publish, distribute, sublicense, and/or sell
 * copies of the Software, and to permit persons to whom the
 * Software is furnished to do so, subject to the following
 * conditions:
 *
 * The above copyright notice and this permission notice shall be
 * included in all copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
 * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
 * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
 * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
 * OTHER DEALINGS IN THE SOFTWARE.
 */

#import <Foundation/Foundation.h>

#import "PLClangSourceIndex.h"
#import "PLClangTranslationUnit.h"

/*
 * Author: Landon Fuller <landonf@plausible.coop>
 *
 * Copyright (c) 2013 Plausible Labs Cooperative, Inc.
 * All rights reserved.
 *
 * Permission is hereby granted, free of charge, to any person
 * obtaining a copy of this software and associated documentation
 * files (the "Software"), to deal in the Software without
 * restriction, including without limitation the rights to use,
 * copy, modify, merge, publish, distribute, sublicense, and/or sell
 * copies of the Software, and to permit persons to whom the
 * Software is furnished to do so, subject to the following
 * conditions:
 *
 * The above copyright notice and this permission notice shall be
 * included in all copies or substantial portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
 * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
 * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
 * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
 * OTHER DEALINGS IN THE SOFTWARE.
 */

#import <Foundation/Foundation.h>

#import "PLClang.h"

Use PLClang.h in umbrella header

Use PLClang.h in umbrella header

This includes the error codes and error domain.


// Copyright (C) 2011  Carl Rogers
// Released under MIT License
// Simplied by Weichao Qiu (qiuwch@gmail.com) from https://github.com/rogersce/cnpy
#pragma once
#include <vector>

namespace cnpy {
	template<typename T>
	std::vector<char> create_npy_header(const T* data, const std::vector<int> shape);

	template<typename T>
	std::vector<char>& operator+=(std::vector<char>& lhs, const T rhs) {
		//write in little endian
		for (char byte = 0; byte < sizeof(T); byte++) {
			char val = *((char*)&rhs + byte);
			lhs.push_back(val);
		}
		return lhs;
	}
	template<>
	std::vector<char>& operator+=(std::vector<char>& lhs, const std::string rhs);
	template<>
	std::vector<char>& operator+=(std::vector<char>& lhs, const char* rhs);
}

// Copyright (C) 2011  Carl Rogers
// Released under MIT License
// Simplied by Weichao Qiu (qiuwch@gmail.com) from https://github.com/rogersce/cnpy
#pragma once
#include <vector>
#include <string>

namespace cnpy {
	template<typename T>
	std::vector<char> create_npy_header(const T* data, const std::vector<int> shape);

	template<typename T>
	std::vector<char>& operator+=(std::vector<char>& lhs, const T rhs) {
		//write in little endian
		for (char byte = 0; byte < sizeof(T); byte++) {
			char val = *((char*)&rhs + byte);
			lhs.push_back(val);
		}
		return lhs;
	}
	template<>
	std::vector<char>& operator+=(std::vector<char>& lhs, const std::string rhs);
	template<>
	std::vector<char>& operator+=(std::vector<char>& lhs, const char* rhs);
}

Include <string> to fix a compile issue in 4.12 and 4.13.


/*
 * QLogic iSCSI HBA Driver
 * Copyright (c)  2003-2013 QLogic Corporation
 *
 * See LICENSE.qla4xxx for copyright and licensing details.
 */

#define QLA4XXX_DRIVER_VERSION	"5.04.00-k5"

/*
 * QLogic iSCSI HBA Driver
 * Copyright (c)  2003-2013 QLogic Corporation
 *
 * See LICENSE.qla4xxx for copyright and licensing details.
 */

#define QLA4XXX_DRIVER_VERSION	"5.04.00-k6"

Update driver version to 5.04.00-k6

qla4xxx: Update driver version to 5.04.00-k6

Signed-off-by: Vikas Chaudhary <c251871a64d7d31888eace0406cb3d4c419d5f73@qlogic.com>
Reviewed-by: Mike Christie <6fe105eefab41990d7ec714c6c25ade3095cdb48@cs.wisc.edu>
Signed-off-by: Christoph Hellwig <923f7720577207a44b32e59bbfbea59d27f1ae8e@lst.de>


// Check that -march works for all supported targets.

// RUN: not %clang -target s390x -S -emit-llvm -march=z9 %s -o - 2>&1 | FileCheck --check-prefix=CHECK-Z9 %s
// RUN: %clang -target s390x -S -emit-llvm -march=z10 %s
// RUN: %clang -target s390x -S -emit-llvm -march=z196 %s
// RUN: %clang -target s390x -S -emit-llvm -march=zEC12 %s

// CHECK-Z9: error: unknown target CPU 'z9'
// CHECK-Z10: "-target-cpu" "z10"
// CHECK-Z196: "-target-cpu" "z196"
// CHECK-ZEC12: "-target-cpu" "zEC12"

int x;

// Check that -march works for all supported targets.

// RUN: not %clang -target s390x -S -emit-llvm -march=z9 %s -o - 2>&1 | FileCheck --check-prefix=CHECK-Z9 %s
// RUN: %clang -target s390x -### -S -emit-llvm -march=z10 %s 2>&1 | FileCheck --check-prefix=CHECK-Z10 %s
// RUN: %clang -target s390x -### -S -emit-llvm -march=z196 %s 2>&1 | FileCheck --check-prefix=CHECK-Z196 %s
// RUN: %clang -target s390x -### -S -emit-llvm -march=zEC12 %s 2>&1 | FileCheck --check-prefix=CHECK-ZEC12 %s

// CHECK-Z9: error: unknown target CPU 'z9'
// CHECK-Z10: "-target-cpu" "z10"
// CHECK-Z196: "-target-cpu" "z196"
// CHECK-ZEC12: "-target-cpu" "zEC12"

int x;

Fix test to actually check things.

Fix test to actually check things.

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


//
//  NAPlaybackIndicatorView.h
//  PlaybackIndicator
//
//  Created by Yuji Nakayama on 1/27/14.
//  Copyright (c) 2014 Yuji Nakayama. All rights reserved.
//

#import <UIKit/UIKit.h>

@interface NAPlaybackIndicatorView : UIView

- (void)startAnimating;
- (void)stopAnimating;

@property (nonatomic, readonly, getter=isAnimating) BOOL animating;

@end

//
//  NAPlaybackIndicatorView.h
//  PlaybackIndicator
//
//  Created by Yuji Nakayama on 1/27/14.
//  Copyright (c) 2014 Yuji Nakayama. All rights reserved.
//

#import <UIKit/UIKit.h>

@interface NAPlaybackIndicatorView : UIView

/**
 Starts the oscillating animation of the bars.
 */
- (void)startAnimating;

/**
 Stop the oscillating animation of the bars.
 */
- (void)stopAnimating;

/**
 Whether the receiver is animating.
 */
@property (nonatomic, readonly, getter=isAnimating) BOOL animating;

@end

Add documentation comments for method

Add documentation comments for method


#include <stdio.h>
#include <libusb-1.0/libusb.h>

int main (int argc, char ** argv) {
  char data[] = { 0x01, 0x05, 0, 0, 0, 0, 0, 0, 0 };
  libusb_init(NULL);
  libusb_device_handle* h = libusb_open_device_with_vid_pid(NULL, 0x0a12, 0x100b);
  if (!h) {
    printf("No device in HID mode found\n");
  } else {
    libusb_detach_kernel_driver(h, 0);
    printf("%d\n", libusb_claim_interface(h, 0));
    libusb_control_transfer(h, LIBUSB_ENDPOINT_OUT|LIBUSB_REQUEST_TYPE_CLASS|LIBUSB_RECIPIENT_INTERFACE, LIBUSB_REQUEST_GET_CONFIGURATION, 0x0301, 0, data, 9, 10000);
    libusb_release_interface(h, 0);
    libusb_close(h);
  }
  libusb_exit(NULL);
  return 0;
}

#include <stdio.h>
#include <libusb-1.0/libusb.h>

int main (int argc, char ** argv) {
  char data[] = { 0x01, 0x05, 0, 0, 0, 0, 0, 0, 0 };
  libusb_init(NULL);
  /* using the default pskeys, devices from the factory are a12:100d in HID mode */
  libusb_device_handle* h = libusb_open_device_with_vid_pid(NULL, 0x0a12, 0x100b);
  if (!h)
    /* Alternatively, a12:100c can be set by the dongler to prevent CSR's software
       stack from auto-switching to HCI mode */
    h = libusb_open_device_with_vid_pid(NULL, 0x0a12, 0x100c);
  if (!h) {
    printf("No device in HID mode found\n");
  } else {
    libusb_detach_kernel_driver(h, 0);
    printf("This should say 0: %d\n", libusb_claim_interface(h, 0));
    libusb_control_transfer(h, LIBUSB_ENDPOINT_OUT|LIBUSB_REQUEST_TYPE_CLASS|LIBUSB_RECIPIENT_INTERFACE, LIBUSB_REQUEST_SET_CONFIGURATION, 0x0301, 0, data, 9, 10000);
    libusb_release_interface(h, 0);
    libusb_close(h);
  }
  libusb_exit(NULL);
  return 0;
}

Fix the constants so it will work correctly. Also add the possibility of a different Product ID so the dongles can be set to a mode that Windows machines with the CSR drivers won't switch them to HCI mode.


//===-- llvm/CodeGen/GlobalISel/CallLowering.h - Call lowering --*- C++ -*-===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
///
/// \file
/// This file describes how to lower LLVM calls to machine code calls.
///
//===----------------------------------------------------------------------===//

#ifndef LLVM_CODEGEN_GLOBALISEL_CALLLOWERING_H
#define LLVM_CODEGEN_GLOBALISEL_CALLLOWERING_H

#include "llvm/ADT/SmallVector.h"
#include "llvm/IR/Function.h"

namespace llvm {
// Forward declarations.
class MachineIRBuilder;
class TargetLowering;
class Value;

class CallLowering {
  const TargetLowering *TLI;
 protected:
  /// Getter for generic TargetLowering class.
  const TargetLowering *getTLI() const {
    return TLI;
  }

  /// Getter for target specific TargetLowering class.
  template <class XXXTargetLowering>
    const XXXTargetLowering *getTLI() const {
    return static_cast<const XXXTargetLowering *>(TLI);
  }
 public:
  CallLowering(const TargetLowering *TLI) : TLI(TLI) {}
  virtual ~CallLowering() {}

  /// This hook must be implemented to lower outgoing return values, described
  /// by \p Val, into the specified virtual register \p VReg.
  /// This hook is used by GlobalISel.
  ///
  /// \return True if the lowering succeeds, false otherwise.
  virtual bool LowerReturn(MachineIRBuilder &MIRBuilder, const Value *Val,
                           unsigned VReg) const {
    return false;
  }

  /// This hook must be implemented to lower the incoming (formal)
  /// arguments, described by \p Args, for GlobalISel. Each argument
  /// must end up in the related virtual register described by VRegs.
  /// In other words, the first argument should end up in VRegs[0],
  /// the second in VRegs[1], and so on.
  /// \p MIRBuilder is set to the proper insertion for the argument
  /// lowering.
  ///
  /// \return True if the lowering succeeded, false otherwise.
  virtual bool
  LowerFormalArguments(MachineIRBuilder &MIRBuilder,
                       const Function::ArgumentListType &Args,
                       const SmallVectorImpl<unsigned> &VRegs) const {
    return false;
  }
};
} // End namespace llvm.

#endif

Add missing file in previous commit.

[GlobalISel] Add missing file in previous commit.

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


/*
 * $Id$
 *
 * Copyright (c) 2013, Juniper Networks, Inc.
 * All rights reserved.
 * This SOFTWARE is licensed under the LICENSE provided in the
 * ../Copyright file. By downloading, installing, copying, or otherwise
 * using the SOFTWARE, you agree to be bound by the terms of that
 * LICENSE.
 *
 * jsonwriter.h -- turn json-oriented XML into json text
 */

int
slaxJsonWriteNode (slaxWriterFunc_t func, void *data, xmlNodePtr nodep,
		       unsigned flags);

int
slaxJsonWriteDoc (slaxWriterFunc_t func, void *data, xmlDocPtr docp,
		      unsigned flags);

#define JWF_ROOT	(1<<0)	/* Root node */
#define JWF_ARRAY	(1<<1)	/* Inside array */
#define JWF_NODESET	(1<<2)	/* Top of a nodeset */
#define JWF_PRETTY	(1<<3)	/* Pretty print (newlines) */

#define JWF_OPTIONAL_QUOTES (1<<4)	/* Don't use quotes unless needed */

Move JSON parser into libslax

Move JSON parser into libslax


/*
** Author(s):
**  - Cedric GESTES <gestes@aldebaran-robotics.com>
**
** Copyright (C) 2010 Aldebaran Robotics
*/

#include <qi/qi.h>
#include <stdio.h>

int main(int argc, char **argv)
{
  qi_client_t *client = qi_client_create("simplecli", argv[1]);

  qi_message_t *message = qi_message_create();
  qi_message_t *ret = qi_message_create();

  qi_message_write_string(message, "master.locateService::s:s");
  qi_message_write_string(message, "master.listServices::{ss}:");

  qi_client_call(client, "master.locateService::s:s", message, ret);

  char *result = qi_message_read_string(ret);
  printf("locate returned: %s\n", result);
  return 0;
}

/*
** Author(s):
**  - Cedric GESTES <gestes@aldebaran-robotics.com>
**
** Copyright (C) 2010 Aldebaran Robotics
*/

#include <qi/qi.h>
#include <stdio.h>

int main(int argc, char **argv)
{
  char *result;

  qi_client_t *client = qi_client_create("simplecli", argv[1]);

  qi_message_t *message = qi_message_create();
  qi_message_t *ret = qi_message_create();

  qi_message_write_string(message, "master.locateService::s:s");
  qi_message_write_string(message, "master.listServices::{ss}:");

  qi_client_call(client, "master.locateService::s:s", message, ret);

  result = qi_message_read_string(ret);
  printf("locate returned: %s\n", result);
  return 0;
}

Make c bindings compile on strict compilers


//
//  SloppySwiperViewControllerProtocol.h
//  Pods
//
//  Created by Yu Sugawara on 7/8/15.
//
//

#import <UIKit/UIKit.h>

@protocol SloppySwiperViewControllerProtocol <NSObject>

- (UIBarStyle)ssw_navigationBarStyle;
- (UIColor *)ssw_navigationBarColor;
- (UIColor *)ssw_navigationBarItemColor;
- (UIImage *)ssw_navigationBarShadowImage;

@end

//
//  SloppySwiperViewControllerProtocol.h
//  Pods
//
//  Created by Yu Sugawara on 7/8/15.
//
//

#import <UIKit/UIKit.h>

@protocol SloppySwiperViewControllerProtocol <NSObject>

- (UIBarStyle)ssw_navigationBarStyle;
- (UIColor *)ssw_navigationBarColor;
- (UIColor *)ssw_navigationBarItemColor;

@optional
- (UIImage *)ssw_navigationBarShadowImage;

@end

Change the ssw_navigationBarShadowImage to the @optional


//-------------------------------------------------------------------------------------------------------
// Copyright (C) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE.txt file in the project root for full license information.
//-------------------------------------------------------------------------------------------------------
#pragma once

#define CHAKRA_CORE_MAJOR_VERSION 1
#define CHAKRA_CORE_MINOR_VERSION 2
#define CHAKRA_CORE_VERSION_RELEASE 0
#define CHAKRA_CORE_VERSION_PRERELEASE 0
#define CHAKRA_CORE_VERSION_RELEASE_QFE 0

#define CHAKRA_VERSION_RELEASE 0

// NOTE: need to update the GUID in ByteCodeCacheReleaseFileVersion.h as well

//-------------------------------------------------------------------------------------------------------
// Copyright (C) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE.txt file in the project root for full license information.
//-------------------------------------------------------------------------------------------------------
#pragma once

#define CHAKRA_CORE_MAJOR_VERSION 1
#define CHAKRA_CORE_MINOR_VERSION 3
#define CHAKRA_CORE_VERSION_RELEASE 0
#define CHAKRA_CORE_VERSION_PRERELEASE 0
#define CHAKRA_CORE_VERSION_RELEASE_QFE 0

#define CHAKRA_VERSION_RELEASE 0

// NOTE: need to update the GUID in ByteCodeCacheReleaseFileVersion.h as well

Update master branch version to 1.3

Update master branch version to 1.3


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

Add stub for XYZ coordinates.

Add stub for XYZ coordinates.


#ifndef SUBSCRIPTION_H
#define SUBSCRIPTION_H

#include <memory>
#include <sstream>
#include <string>

#include "../../message.h"
#include "../../result.h"

class WindowsWorkerPlatform;

class Subscription
{
public:
  Subscription(ChannelID channel,
    HANDLE root,
    const std::wstring &path,
    bool recursive,
    WindowsWorkerPlatform *platform);

  ~Subscription();

  Result<bool> schedule(LPOVERLAPPED_COMPLETION_ROUTINE fn);

  Result<> use_network_size();

  BYTE *get_written(DWORD written_size);

  Result<std::string> get_root_path();

  std::wstring make_absolute(const std::wstring &sub_path);

  Result<> stop(const CommandID command);

  CommandID get_command_id() const { return command; }

  ChannelID get_channel() const { return channel; }

  WindowsWorkerPlatform *get_platform() const { return platform; }

  bool is_terminating() const { return terminating; }

private:
  CommandID command;
  ChannelID channel;
  WindowsWorkerPlatform *platform;

  std::wstring path;
  HANDLE root;
  OVERLAPPED overlapped;
  bool recursive;
  bool terminating;

  DWORD buffer_size;
  std::unique_ptr<BYTE[]> buffer;
  std::unique_ptr<BYTE[]> written;
};

#endif

#ifndef SUBSCRIPTION_H
#define SUBSCRIPTION_H

#include <memory>
#include <sstream>
#include <string>

#include "../../message.h"
#include "../../result.h"

class WindowsWorkerPlatform;

class Subscription
{
public:
  Subscription(ChannelID channel,
    HANDLE root,
    const std::wstring &path,
    bool recursive,
    WindowsWorkerPlatform *platform);

  ~Subscription();

  Result<bool> schedule(LPOVERLAPPED_COMPLETION_ROUTINE fn);

  Result<> use_network_size();

  BYTE *get_written(DWORD written_size);

  Result<std::string> get_root_path();

  std::wstring make_absolute(const std::wstring &sub_path);

  Result<> stop(const CommandID command);

  const CommandID &get_command_id() const { return command; }

  const ChannelID &get_channel() const { return channel; }

  WindowsWorkerPlatform *get_platform() const { return platform; }

  const bool &is_recursive() const { return recursive; }

  const bool &is_terminating() const { return terminating; }

private:
  CommandID command;
  ChannelID channel;
  WindowsWorkerPlatform *platform;

  std::wstring path;
  HANDLE root;
  OVERLAPPED overlapped;
  bool recursive;
  bool terminating;

  DWORD buffer_size;
  std::unique_ptr<BYTE[]> buffer;
  std::unique_ptr<BYTE[]> written;
};

#endif

Return const & from getters

Return const & from getters


Use version with replaced \177

Use version with replaced \177


Use printf without puts again to save one more byte


#include <stdio.h>
#include <math.h>

#include "euler.h"

#define PROBLEM 6
#define ANSWER 25164150

int
main(int argc, char **argv)
{
    double sum = 0, square = 0;
    for(double x = 0; x <= 100; x++) {
        sum += pow(x, 2.0);
        square += x;
    }
    square = pow(square, 2.0);
    double result = square - sum;
    return check(PROBLEM, ANSWER, result);
}

Add solution for problem 6

Add solution for problem 6


// RUN: rm -fr %t.prof
// RUN: %clang_pgogen=%t.prof/ -o %t.gen.cs -O2 %s
// RUN: %t.gen.cs
// RUN: llvm-profdata merge -o %t.cs.profdata %t.prof/
// Check context sensitive profile
// RUN: %clang_profuse=%t.cs.profdata  -O2 -emit-llvm -S %s -o - | FileCheck %s --check-prefix=CS
//
// RUN: %clang_profgen=%t.profraw -o %t.gen.cis -O2 %s
// RUN: %t.gen.cis
// RUN: llvm-profdata merge -o %t.cis.profdata %t.profraw
// Check context insenstive profile
// RUN: %clang_profuse=%t.cis.profdata  -O2 -emit-llvm -S %s -o - | FileCheck %s --check-prefix=CIS
int g1 = 1;
int g2 = 2;
static void toggle(int t) {
  if (t & 1)
    g1 *= t;
  else
    g2 *= t;
}

int main() {
  int i;
  // CS: br i1 %{{.*}}, label %{{.*}}, label %{{.*}}, !prof ![[PD1:[0-9]+]]
  // CIS: br i1 %{{.*}}, label %{{.*}}, label %{{.*}}, !prof ![[PD:[0-9]+]]
  toggle(g1);
  // CS: br i1 %{{.*}}, label %{{.*}}, label %{{.*}}, !prof ![[PD2:[0-9]+]]
  // CIS: br i1 %{{.*}}, label %{{.*}}, label %{{.*}}, !prof ![[PD:[0-9]+]]
  toggle(g2);
  return 0;
}

// CS: ![[PD1]] = !{!"branch_weights", i32 0, i32 1}
// CS: ![[PD2]] = !{!"branch_weights", i32 1, i32 0}
// CIS: ![[PD]] = !{!"branch_weights", i32 2, i32 2}

Add a new test case

[Profile] Add a new test case

The end-end test checks that cs-profile counter update
is obtained as expected.

git-svn-id: c199f293c43da69278bea8e88f92242bf3aa95f7@277276 91177308-0d34-0410-b5e6-96231b3b80d8


//
//  RZFReleaseNotes.h
//  FreshAir
//
//  Created by Brian King on 1/26/16.
//  Copyright © 2016 Raizlabs. All rights reserved.
//

#import <Foundation/Foundation.h>

NS_ASSUME_NONNULL_BEGIN

@class RZFRelease, RZFFeature;

@interface RZFReleaseNotes : NSObject

+ (instancetype)releaseNotesWithURL:(NSURL *)URL error:(NSError **)error;
+ (instancetype)releaseNotesWithData:(NSData *)data error:(NSError **)error;

@property (strong, nonatomic) NSArray<RZFRelease *> *releases;
@property (strong, nonatomic) NSURL *upgradeURL;
@property (strong, nonatomic) NSString * __nullable minimumVersion;
@property (strong, nonatomic, readonly) NSArray<RZFFeature *> *features;

- (BOOL)isUpgradeRequiredForVersion:(NSString *)version;

- (NSArray<RZFRelease *> *)releasesSupportingSystemVersion:(NSString *)systemVersion;
- (NSArray<RZFFeature *> *)featuresFromVersion:(NSString *)lastVersion toVersion:(NSString *)currentVersion;

@end

NS_ASSUME_NONNULL_END

//
//  RZFReleaseNotes.h
//  FreshAir
//
//  Created by Brian King on 1/26/16.
//  Copyright © 2016 Raizlabs. All rights reserved.
//

#import <Foundation/Foundation.h>

NS_ASSUME_NONNULL_BEGIN

@class RZFRelease, RZFFeature;

@interface RZFReleaseNotes : NSObject

+ (instancetype)releaseNotesWithURL:(NSURL *)URL error:(NSError **)error;
+ (instancetype)releaseNotesWithData:(NSData *)data error:(NSError **)error;

@property (strong, nonatomic) NSArray<RZFRelease *> *releases;
@property (strong, nonatomic) NSURL *upgradeURL;
@property (strong, nonatomic, nullable) NSString *minimumVersion;
@property (strong, nonatomic, readonly) NSArray<RZFFeature *> *features;

- (BOOL)isUpgradeRequiredForVersion:(NSString *)version;

- (NSArray<RZFRelease *> *)releasesSupportingSystemVersion:(NSString *)systemVersion;
- (NSArray<RZFFeature *> *)featuresFromVersion:(NSString *)lastVersion toVersion:(NSString *)currentVersion;

@end

NS_ASSUME_NONNULL_END

Move nullable to the property attributes


#include <assert.h>
#include <string.h>
#include <errno.h>

#include "pt_error.h"

static struct {
	const enum pt_error err;
	const char* const str;
} pt_error_map[PT_LAST] = {
	{ PT_SUCCESS, "Success" },
};

static char* pt_strncpy(char* dst, const char* src, size_t n)
{
	if(n > 0) {
		int len = strnlen(src, n);

		(void) memcpy(dst, src, len - 1);
		dst[len] = '\0';
	}

	return dst;
}

int pt_strerror_r(enum pt_error err, char* buf, size_t len)
{
	int ret = 0;

	if(len > 0) {
		if(err < PT_LAST && err >= PT_SUCCESS) {
			assert(err == pt_error_map[err].err);
			(void) pt_strncpy(buf, pt_error_map[err].str, len);

			if(strlen(pt_error_map[err].str) >= len) {
				errno = EOVERFLOW;
				ret = 1;
			}
		} else {
			errno = EINVAL;
			ret = 1;
		}
	}

	return ret;
}

#include <assert.h>
#include <string.h>
#include <errno.h>

#include "pt_error.h"

static struct {
	const enum pt_error err;
	const char* const str;
} pt_error_map[PT_LAST] = {
	{ PT_SUCCESS, "Success" },
};

static char*
pt_strncpy(char* dst, const char* src, size_t n)
{
	if(n > 0) {
		int len = strnlen(src, n);

		(void) memcpy(dst, src, len - 1);
		dst[len] = '\0';
	}

	return dst;
}

int
pt_strerror_r(enum pt_error err, char* buf, size_t len)
{
	int ret = 0;

	if(len > 0) {
		if(err < PT_LAST && err >= PT_SUCCESS) {
			assert(err == pt_error_map[err].err);
			(void) pt_strncpy(buf, pt_error_map[err].str, len);

			if(strlen(pt_error_map[err].str) >= len) {
				errno = ERANGE;
				ret = 1;
			}
		} else {
			errno = EINVAL;
			ret = 1;
		}
	}

	return ret;
}

Change to a more standard errno in pt_strerror_r()

Reformat pt_error.c


/* Computation of the dynamic aspect for a humanoid robot.

Copyright (c) 2008
@author Olivier Stasse.

JRL-Japan, CNRS/AIST

All rights reserved.

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

* Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
* Neither the name of the CNRS and AIST nor the names of its contributors
may be used to endorse or promote products derived from this software without specific prior written permission.

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

#ifndef _DYN_JRL_JAPAN_CONFIG_H_IN_
#define _DYN_JRL_JAPAN_CONFIG_H_IN_

#if defined (WIN32)
#  ifdef dynamicsJRLJapan_EXPORTS
#    define DYN_JRL_JAPAN_EXPORT __declspec(dllexport)
#  else
#    define DYN_JRL_JAPAN_EXPORT __declspec(dllimport)
#  endif
#else
#  define DYN_JRL_JAPAN_EXPORT
#endif

#endif

Add an API for Windows

Add an API for Windows


file4.c - r1
Test checkin in master1-updated
Test checkin in master2

file4.c - r1
Test checkin in master1-updated - updated2
Test checkin in master2
Test checkin in master3

Test commit in feature branch

Test commit in feature branch


//
//  BFTaskCenter.h
//  Pods
//
//  Created by Superbil on 2015/8/22.
//
//

#import "Bolts.h"

@interface BFTaskCenter : NSObject

/*!
 A block that can act as a continuation for a task.
 */
typedef void (^BFTaskCenterBlock)(BFTask * _Nonnull task);

+ (nonnull instancetype)defaultCenter;

- (instancetype)initWithExecutor:(BFExecutor *)executor;

- (nullable id)addTaskBlockToCallbacks:(nonnull BFTaskCenterBlock)taskBlock forKey:(nonnull NSString *)key;
- (void)removeTaskBlock:(nonnull id)taskBlock forKey:(nonnull NSString *)key;
- (void)clearAllCallbacksForKey:(nonnull NSString *)key;

- (void)sendToCallbacksWithKey:(nonnull NSString *)key result:(nullable id)result;
- (void)sendToCallbacksWithKey:(nonnull NSString *)key error:(nonnull NSError *)error;

- (nullable BFTaskCompletionSource *)sourceOfSendToCallbacksForKey:(nonnull NSString *)key
                                                          executor:(nonnull BFExecutor *)executor
                                                 cancellationToken:(nullable BFCancellationToken *)cancellationToken;

@end

//
//  BFTaskCenter.h
//  Pods
//
//  Created by Superbil on 2015/8/22.
//
//

#import "Bolts.h"

@interface BFTaskCenter : NSObject

/*!
 A block that can act as a continuation for a task.
 */
typedef void (^BFTaskCenterBlock)(BFTask * _Nonnull task);

+ (nullable instancetype)defaultCenter;

- (nullable instancetype)initWithExecutor:(nonnull BFExecutor *)executor;

- (nullable id)addTaskBlockToCallbacks:(nonnull BFTaskCenterBlock)taskBlock forKey:(nonnull NSString *)key;
- (void)removeTaskBlock:(nonnull id)taskBlock forKey:(nonnull NSString *)key;
- (void)clearAllCallbacksForKey:(nonnull NSString *)key;

- (void)sendToCallbacksWithKey:(nonnull NSString *)key result:(nullable id)result;
- (void)sendToCallbacksWithKey:(nonnull NSString *)key error:(nonnull NSError *)error;

- (nullable BFTaskCompletionSource *)sourceOfSendToCallbacksForKey:(nonnull NSString *)key
                                                          executor:(nonnull BFExecutor *)executor
                                                 cancellationToken:(nullable BFCancellationToken *)cancellationToken;

@end

Fix compiler warning for nullable check

Fix compiler warning for nullable check


#include <stdlib.h>

volatile int func() {
	return 4;
}
volatile int func2() __attribute__ ((visibility ("hidden"), alias ("func")));

int main() {
	if (func2() != 4) {
		abort();
	}
}

Add test case for hidden alias

Add test case for hidden alias


#pragma once

namespace turbodbc {

/**
 * This enumeration assigns integer values to certain database types
 */
enum class type_code : int {
	boolean = 0,			///< boolean type
	integer = 10,			///< integer types
	floating_point = 20,	///< floating point types
	string = 30,			///< string types
	timestamp = 40,			///< timestamp types
	date = 41				///< date type
};

}

#pragma once

namespace turbodbc {

/**
 * This enumeration assigns integer values to certain database types
 */
enum class type_code : int {
	boolean = 0,            ///< boolean type
	integer = 10,           ///< integer types
	floating_point = 20,    ///< floating point types
	string = 30,            ///< string types
	unicode = 31,           ///< unicode types
	timestamp = 40,         ///< timestamp types
	date = 41               ///< date type
};

}

Add unicode to supported type codes

Add unicode to supported type codes


// RUN: %clang_cc1 -emit-llvm < %s | grep 'fastcallcc' | count 6
// RUN: %clang_cc1 -emit-llvm < %s | grep 'stdcallcc' | count 6

void __attribute__((fastcall)) f1(void);
void __attribute__((stdcall)) f2(void);
void __attribute__((fastcall)) f3(void) {
  f1();
}
void __attribute__((stdcall)) f4(void) {
  f2();
}

// PR5280
void (__attribute__((fastcall)) *pf1)(void) = f1;
void (__attribute__((stdcall)) *pf2)(void) = f2;
void (__attribute__((fastcall)) *pf3)(void) = f3;
void (__attribute__((stdcall)) *pf4)(void) = f4;

int main(void) {
    f3(); f4();
    pf1(); pf2(); pf3(); pf4();
    return 0;
}

// RUN: %clang_cc1 -emit-llvm < %s | FileCheck %s

void __attribute__((fastcall)) f1(void);
void __attribute__((stdcall)) f2(void);
void __attribute__((fastcall)) f3(void) {
// CHECK: define x86_fastcallcc void @f3()
  f1();
// CHECK: call x86_fastcallcc void @f1()
}
void __attribute__((stdcall)) f4(void) {
// CHECK: define x86_stdcallcc void @f4()
  f2();
// CHECK: call x86_stdcallcc void @f2()
}

// PR5280
void (__attribute__((fastcall)) *pf1)(void) = f1;
void (__attribute__((stdcall)) *pf2)(void) = f2;
void (__attribute__((fastcall)) *pf3)(void) = f3;
void (__attribute__((stdcall)) *pf4)(void) = f4;

int main(void) {
    f3(); f4();
    // CHECK: call x86_fastcallcc void @f3()
    // CHECK: call x86_stdcallcc void @f4()
    pf1(); pf2(); pf3(); pf4();
    // CHECK: call x86_fastcallcc void %tmp()
    // CHECK: call x86_stdcallcc void %tmp1()
    // CHECK: call x86_fastcallcc void %tmp2()
    // CHECK: call x86_stdcallcc void %tmp3()
    return 0;
}

Convert this test to FileCheck instead of grepping LLVM IR.

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


#include "server/client.h"
#include "server/packet.h"
#include "blocks/items.h"

void packet_send_entity_equipment(struct client *client, struct client *c, uint16_t slot, struct item *item, uint16_t damage)
{
	bedrock_packet packet;
	struct item_stack stack;

	stack.id = item->id;
	stack.count = 1;
	stack.metadata = damage;

	packet_init(&packet, SERVER_ENTITY_EQUIPMENT);

	packet_pack_int(&packet, &c->id, sizeof(c->id));
	packet_pack_int(&packet, &slot, sizeof(slot));
	packet_pack_slot(&packet, &stack);

	client_send_packet(client, &packet);
}

#include "server/client.h"
#include "server/packet.h"
#include "blocks/items.h"

void packet_send_entity_equipment(struct client *client, struct client *c, uint16_t slot, struct item *item, uint16_t damage)
{
	bedrock_packet packet;
	struct item_stack stack;

	stack.id = item->id ? item->id : -1;
	stack.count = 1;
	stack.metadata = damage;

	packet_init(&packet, SERVER_ENTITY_EQUIPMENT);

	packet_pack_int(&packet, &c->id, sizeof(c->id));
	packet_pack_int(&packet, &slot, sizeof(slot));
	packet_pack_slot(&packet, &stack);

	client_send_packet(client, &packet);
}

Fix client crash from changing item to nothing


//
//  ApptentiveJSONSerialization.h
//  Apptentive
//
//  Created by Andrew Wooster on 6/22/13.
//  Copyright (c) 2013 Apptentive, Inc. All rights reserved.
//

#import <Foundation/Foundation.h>

extern NSInteger ApptentiveJSONDeserializationErrorCode;

@interface ApptentiveJSONSerialization : NSObject

+ (NSData *)dataWithJSONObject:(id)obj options:(NSJSONWritingOptions)opt error:(NSError **)error;
+ (id)JSONObjectWithData:(NSData *)data error:(NSError **)error;

@end

//
//  ApptentiveJSONSerialization.h
//  Apptentive
//
//  Created by Andrew Wooster on 6/22/13.
//  Copyright (c) 2013 Apptentive, Inc. All rights reserved.
//

#import <Foundation/Foundation.h>

extern NSInteger ApptentiveJSONDeserializationErrorCode;
extern NSInteger ApptentiveJSONSerializationErrorCode;

@interface ApptentiveJSONSerialization : NSObject

+ (NSData *)dataWithJSONObject:(id)obj options:(NSJSONWritingOptions)opt error:(NSError **)error;
+ (id)JSONObjectWithData:(NSData *)data error:(NSError **)error;

@end

Add serialization error code extern

Add serialization error code extern


#pragma once

template<class T, size_t BufferSize, class StarvationCallbacks>
class AllocationPool {
	public:

		~AllocationPool()
		{
			while (!m_FreeList.empty())
			{
				delete m_FreeList.front();
				m_FreeList.pop_front();
			}
		}

		T* Allocate()
		{
			if (m_FreeList.Size() <= BufferSize)
			{
				try
				{
					return new T;
				}
				catch (std::bad_alloc& ex)
				{
					if (m_FreeList.size() == BufferSize)
					{
						StarvationCallbacks.OnStartingUsingBuffer();
					}
					else if (m_FreeList.empty())
					{
						StarvationCallbacks.OnBufferEmpty();
						// Try again until the memory is avalable
						return Allocate();
					}
				}
			}
			T* ret = m_FreeList.front();
			m_FreeList.pop_front();
			return ret;
		}
		void Free(T* ptr)
		{
			m_FreeList.push_front(ptr);
			if (m_FreeList.size() == BufferSize)
			{
				StarvationCallbacks.OnStopUsingBuffer();
			}
		}

	private:
		std::list<T*> m_FreeList;
}

#pragma once

template<class T, size_t BufferSize, class StarvationCallbacks>
class AllocationPool {
	public:

		~AllocationPool()
		{
			while (!m_FreeList.empty())
			{
				delete m_FreeList.front();
				m_FreeList.pop_front();
			}
		}

		T* Allocate()
		{
			if (m_FreeList.Size() <= BufferSize)
			{
				try
				{
					return new T;
				}
				catch (std::bad_alloc& ex)
				{
					if (m_FreeList.size() == BufferSize)
					{
						StarvationCallbacks.OnStartingUsingBuffer();
					}
					else if (m_FreeList.empty())
					{
						StarvationCallbacks.OnBufferEmpty();
						// Try again until the memory is avalable
						return Allocate();
					}
				}
			}
			// placement new, used to initalize the object
			T* ret = new (m_FreeList.front()) T;
			m_FreeList.pop_front();
			return ret;
		}
		void Free(T* ptr)
		{
			// placement destruct.
			ptr->~T();
			m_FreeList.push_front(ptr);
			if (m_FreeList.size() == BufferSize)
			{
				StarvationCallbacks.OnStopUsingBuffer();
			}
		}

	private:
		std::list<void *> m_FreeList;
}

Use placement new to initalise objects

Use placement new to initalise objects


#ifndef CORRCHECK_H
#define CORRCHECK_H

#include <cassert>
#include <cstdio>
#include <cstdlib>
#include <dirent.h>
#include <iostream>
#include <map>
#include <openssl/ssl.h>
#include <string>
#include <sys/stat.h>
#include <vector>

#include "corrcheck_defines.h"
#include "File.h"

int create_database(const std::string& directory);
int update_database();
int verify_database(const std::string& directory);
int write_database(const std::string& directory, const File* file_list);

#endif

#ifndef CORRCHECK_H
#define CORRCHECK_H

#include <cassert>
#include <cstdio>
#include <cstdlib>
#include <dirent.h>
#include <iostream>
#include <map>
#include <openssl/ssl.h>
#include <string>
#include <sys/stat.h>
#include <vector>

#include "corrcheck_defines.h"
#include "File.h"

/*
  Create a .corrcheckdb of the files in a directory given by 'directory'.
  Returns SUCCESS (0) if no errors occur; returns FAILURE (1) otherwise.
 */
int create_database(const std::string& directory);

/*
  ---NOT IMPLEMENTED---
  Rewrite the .corrcheckdb of the files in a directory while notifying of
apparent changes since creation or last update.
 */
int update_database();

/*
  Check the .corrcheckdb of the files in a directory given by 'directory' and
notify of apparent changes since creation or last update. This function does not
modify the .corrcheckdb file.
 */
int verify_database(const std::string& directory);

/*
  Write a .corrcheckdb in the directory given by 'directory' based on the list of
files given as 'file_list', overwriting any that may already be present.
 */
int write_database(const std::string& directory, const File* file_list);

#endif

Write more brief function descriptions.

Write more brief function descriptions.


// Copyright 2013 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 IOS_WEB_PUBLIC_BROWSER_STATE_H_
#define IOS_WEB_PUBLIC_BROWSER_STATE_H_

#include "base/supports_user_data.h"

namespace net {
class URLRequestContextGetter;
}

namespace web {

// This class holds the context needed for a browsing session.
// It lives on the UI thread. All these methods must only be called on the UI
// thread.
class BrowserState : public base::SupportsUserData {
 public:
  ~BrowserState() override;

  // Return whether this BrowserState is incognito. Default is false.
  virtual bool IsOffTheRecord() const = 0;

  // Returns the request context information associated with this
  // BrowserState.
  virtual net::URLRequestContextGetter* GetRequestContext() = 0;

 protected:
  BrowserState();
};

}  // namespace web

#endif  // IOS_WEB_PUBLIC_BROWSER_STATE_H_

// Copyright 2013 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 IOS_WEB_PUBLIC_BROWSER_STATE_H_
#define IOS_WEB_PUBLIC_BROWSER_STATE_H_

#include "base/supports_user_data.h"

namespace base {
class FilePath;
}

namespace net {
class URLRequestContextGetter;
}

namespace web {

// This class holds the context needed for a browsing session.
// It lives on the UI thread. All these methods must only be called on the UI
// thread.
class BrowserState : public base::SupportsUserData {
 public:
  ~BrowserState() override;

  // Return whether this BrowserState is incognito. Default is false.
  virtual bool IsOffTheRecord() const = 0;

  // Retrieves the path where the BrowserState data is stored.
  virtual base::FilePath GetPath() const = 0;

  // Returns the request context information associated with this
  // BrowserState.
  virtual net::URLRequestContextGetter* GetRequestContext() = 0;

 protected:
  BrowserState();
};

}  // namespace web

#endif  // IOS_WEB_PUBLIC_BROWSER_STATE_H_

Expand web::BrowserState to add GetPath() method

Add a method to web::BrowserState returning the path where the
BrowserState data is stored.

BUG=429756

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

Cr-Commit-Position: 972c6d2dc6dd5efdad1377c0d224e03eb8f276f7@{#305191}


#ifndef SCORE_H_INCLUDED
#define SCORE_H_INCLUDED

#define FOOD1_SCORE 15	//Titik
#define FOOD2_SCORE 100	//Sedap Malam
#define FOOD3_SCORE 300	//Menyan
#define FOOD4_SCORE 500	//Melati
#define FOOD5_SCORE 700	//Kopi Hitam

typedef struct{
	char *name;
	int score;
	int lives;
	int foodCount;
	pacmanController peciman;
	ghostController ghost1;
	ghostController ghost2;
	ghostController ghost3;
	ghostController ghost4;

} playerControl;

void initScore(playerControl *player);
void initLives(playerControl *player);
void incScore(int food, playerControl *player);
void eatFood(playerControl *player);
void incLives(playerControl *player, int *liveGiven);
int randomise(int min, int max);
int foodType(int x);
void spawnFood(MapController *map, int posX, int posY);
void despawnFood(MapController *map, int posX, int posY);
void randFoodPos();
void drawNumber(int x, int posX, int posY, int posisi);
void printScore(int score, int posX, int posY);
void printLives(int lives, int posX, int posY);

#endif // SCORE_H_INCLUDED

#ifndef SCORE_H_INCLUDED
#define SCORE_H_INCLUDED

#define FOOD1_SCORE 15	//Titik
#define FOOD2_SCORE 100	//Sedap Malam
#define FOOD3_SCORE 300	//Menyan
#define FOOD4_SCORE 500	//Melati
#define FOOD5_SCORE 700	//Kopi Hitam

typedef struct{
	char *name;
	int score;
	int lives;
	int foodCount;
	int level;
	pacmanController peciman;
	ghostController ghost1;
	ghostController ghost2;
	ghostController ghost3;
	ghostController ghost4;

} playerControl;

void initScore(playerControl *player);
void initLives(playerControl *player);
void incScore(int food, playerControl *player);
void eatFood(playerControl *player);
void incLives(playerControl *player, int *liveGiven);
int randomise(int min, int max);
int foodType(int x);
void spawnFood(MapController *map, int posX, int posY);
void despawnFood(MapController *map, int posX, int posY);
void randFoodPos();
void drawNumber(int x, int posX, int posY, int posisi);
void printScore(int score, int posX, int posY);
void printLives(int lives, int posX, int posY);

#endif // SCORE_H_INCLUDED

Add level field in playercontroller

Add level field in playercontroller


#pragma once

#include <cstdint>

inline uint16_t compose_bytes(const uint8_t low, const uint8_t high) {
    return (high << 8) + low;
};

inline bool check_bit(const uint8_t value, int bit) {
    return (value & (1 << bit)) != 0;
};

inline uint8_t set_bit(const uint8_t value, int bit) {
    return static_cast<uint8_t>(value | (1 << bit));
}

#pragma once

#include <cstdint>

inline uint16_t compose_bytes(const uint8_t low, const uint8_t high) {
    return (high << 8) + low;
}

inline bool check_bit(const uint8_t value, int bit) {
    return (value & (1 << bit)) != 0;
}

inline uint8_t set_bit(const uint8_t value, int bit) {
    return static_cast<uint8_t>(value | (1 << bit));
}

Remove extraneous ; on function definition


// RUN: %clang_cc1 %s -triple i386-unknown-unknown -fasm-blocks -emit-llvm -o - | FileCheck %s

// CHECK: .byte 64
// CHECK: .byte 64
// CHECK: .byte 64
// CHECK:  .even
void t1() {
  __asm {
    .byte 64
    .byte 64
    .byte 64
    EVEN
    mov eax, ebx
  }
}

// REQUIRES: x86-registered-target
// RUN: %clang_cc1 %s -triple i386-apple-darwin10 -fasm-blocks -emit-llvm -o - | FileCheck %s

// CHECK: .byte 64
// CHECK: .byte 64
// CHECK: .byte 64
// CHECK:  .even
void t1() {
  __asm {
    .byte 64
    .byte 64
    .byte 64
    EVEN
    mov eax, ebx
  }
}

Add support for MS 'EVEN' directive

[fixup][X86][inline-asm] Add support for MS 'EVEN' directive

refining tested targets resolution, to amend failures caused by rL299454

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


/* Chapter 27, exercise 14: write a function that takes an array of int as input
   and finds the smallest and the largest elements as well as the median and
   mean; return the result in a struct holding the values */

#include<stddef.h>
#include<string.h>
#include<stdlib.h>
#include<assert.h>
#include<stdio.h>

struct Result {
    int min;
    int max;
    double median;
    double mean;
};

int cmpint(const void* a, const void* b)
{
    int aa = *(int*)a;
    int bb = *(int*)b;
    if (aa<bb)
        return -1;
    else if (bb<aa)
        return 1;
    else
        return 0;
}

int array_sum(int* int_array, size_t size)
{
    int sum = 0;
    int i;
    for (i = 0; i<size; ++i)
        sum += int_array[i];
    return sum;
}

struct Result* array_data(int* int_array, size_t size)
{
    assert(int_array);
    assert(size > 0);
    {
        int* array_cpy = (int*)malloc(size*sizeof(int));    /* copy to play with */
        struct Result* res = (struct Result*)malloc(sizeof(struct Result));
        memcpy(array_cpy,int_array,size*sizeof(int));
        qsort(array_cpy,size,sizeof(int),cmpint);

        res->min = array_cpy[0];
        res->max = array_cpy[size-1];
        if (size % 2)   /* odd number of elements */
            res->median = array_cpy[size/2];
        else    /* even number - median is mean of two elements */
            res->median = (array_cpy[size/2-1] + array_cpy[size/2]) / 2.0;
        res->mean = (double)array_sum(int_array,size) / size;
        free(array_cpy);
        return res;
    }
}

void print_result(struct Result* res)
{
    printf("min: %d\nmax: %d\nmean: %f\nmedian: %f\n",
           res->min,res->max,res->mean,res->median);
}

int main()
{
    int arr1[] = { 3, 2, 5, 4, 1 };
    int arr2[] = { 5, 1, 7, 4, 8, 4 };
    struct Result* res1 = array_data(arr1,sizeof(arr1)/sizeof(int));
    struct Result* res2 = array_data(arr2,sizeof(arr2)/sizeof(int));
    printf("arr1:\n");
    print_result(res1);
    printf("\narr2:\n");
    print_result(res2);

    free(res1);
    free(res2);
}

Add Chapter 27, exercise 14

Add Chapter 27, exercise 14


#include <stdio.h>
#ifdef WIN32
#include <io.h>
#include <fcntl.h>
#endif

int
gethost_main()
{
	extern	char	*sccs_gethost();
	char 	*host;

#ifdef WIN32
	setmode(1, _O_BINARY);
#endif
	host = sccs_gethost();
	if ((host == NULL) || (*host == '\0')) return (1);
	printf("%s\n", host);
	return (0);
}

#include <stdio.h>
#ifdef WIN32
#include <io.h>
#include <fcntl.h>
#endif

int
gethost_main()
{
	extern	char	*sccs_gethost();
	char 	*host;

#ifdef WIN32
	setmode(1, _O_BINARY);
#endif
	host = sccs_gethost();
	if ((host == NULL) || (*host == '\0')) return (1);
	printf("%s\n", host);
	/* make isure we have a good domain name */
	if (strchr(host, '.') == NULL) return (1);
	return (0);
}

Add two more check to x.chk_env
a) make sure host name have at least one dot
b) add a http test

bk: 39466063LfKperUt13MbGKJrzx5juA


/*
 * $Id$
 *
 * Define the tags in the shared memory in a reusable format.
 * Whoever includes this get to define what the SLTM macro does.
 *
 */

SLTM(Debug)
SLTM(Error)
SLTM(CLI)
SLTM(SessionOpen)
SLTM(SessionReuse)
SLTM(SessionClose)
SLTM(BackendOpen)
SLTM(BackendXID)
SLTM(BackendReuse)
SLTM(BackendClose)
SLTM(HttpError)
SLTM(ClientAddr)
SLTM(Backend)
SLTM(Request)
SLTM(Response)
SLTM(Length)
SLTM(Status)
SLTM(URL)
SLTM(Protocol)
SLTM(Header)
SLTM(BldHdr)
SLTM(LostHeader)
SLTM(VCL_call)
SLTM(VCL_trace)
SLTM(VCL_return)
SLTM(XID)
SLTM(ExpBan)
SLTM(ExpPick)
SLTM(ExpKill)

/*
 * $Id$
 *
 * Define the tags in the shared memory in a reusable format.
 * Whoever includes this get to define what the SLTM macro does.
 *
 */

SLTM(Debug)
SLTM(Error)
SLTM(CLI)
SLTM(SessionOpen)
SLTM(SessionReuse)
SLTM(SessionClose)
SLTM(BackendOpen)
SLTM(BackendXID)
SLTM(BackendReuse)
SLTM(BackendClose)
SLTM(HttpError)
SLTM(ClientAddr)
SLTM(Backend)
SLTM(Request)
SLTM(Response)
SLTM(Length)
SLTM(Status)
SLTM(URL)
SLTM(Protocol)
SLTM(Header)
SLTM(BldHdr)
SLTM(LostHeader)
SLTM(VCL_call)
SLTM(VCL_trace)
SLTM(VCL_return)
SLTM(XID)
SLTM(Hit)
SLTM(ExpBan)
SLTM(ExpPick)
SLTM(ExpKill)

Add shmem tag for Hits

Add shmem tag for Hits

git-svn-id: 2c9807fa3ff65b17195bd55dc8a6c4261e10127b@361 d4fa192b-c00b-0410-8231-f00ffab90ce4


#ifndef RASTERIZER_H
#define RASTERIZER_H

#include <string>

#include "Renderer.h"

class Rasterizer : public Renderer {
private:
  const float k_a = 0.1;
  const RGBColor AMBIENT_COLOR = RGBColor(1.0f, 1.0f, 1.0f);
public:
  Rasterizer();
  Rasterizer(World* world, const uint16_t image_width, const uint16_t image_height);
  ~Rasterizer();

  const RGBColor shade(const GeometryObject& object, const Triangle3D& triangle, const Point3D point_in_triangle) const override;
  void render(const std::string output_path) override;
private:
  const RGBColor phongShading(const Material& material, const RGBColor& base_color, const Triangle3D& triangle, const Point3D& point_in_triangle) const;
  const RGBColor blinnPhongShading(const Material& material, const RGBColor& base_color, const Triangle3D& triangle, const Point3D& point_in_triangle) const;

};

#endif /* RASTERIZER_H */

#ifndef RASTERIZER_H
#define RASTERIZER_H

#include <string>

#include "Renderer.h"

class Rasterizer : public Renderer {
private:
  const float k_a = 0.1;
  const RGBColor AMBIENT_COLOR = RGBColor(1.0f, 1.0f, 1.0f);
public:
  Rasterizer();
  Rasterizer(World* world, const uint16_t image_width, const uint16_t image_height);
  ~Rasterizer();

  const RGBColor shade(const GeometryObject& object, const Triangle3D& triangle, const Point3D point_in_triangle) const override;
  void render(const std::string output_path) override;
private:
  const Triangle2D toRaster(const Triangle3D& triangle_world) const;
  const float getDepth(const Triangle3D& triangle_world, const Triangle2D& triangle_raster, const Point2D& pixel_raster) const;
  const RGBColor phongShading(const Material& material, const RGBColor& base_color, const Triangle3D& triangle, const Point3D& point_in_triangle) const;
  const RGBColor blinnPhongShading(const Material& material, const RGBColor& base_color, const Triangle3D& triangle, const Point3D& point_in_triangle) const;

};

#endif /* RASTERIZER_H */

Refactor render method to make it simpler


/* -*- mode:C; c-file-style: "bsd" -*- */
/*
 * Copyright (c) 2008-2019 Yubico AB
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions are
 * met:
 *
 *     * Redistributions of source code must retain the above copyright
 *       notice, this list of conditions and the following disclaimer.
 *
 *     * Redistributions in binary form must reproduce the above
 *       copyright notice, this list of conditions and the following
 *       disclaimer in the documentation and/or other materials provided
 *       with the distribution.
 *
 * 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.
 */

#ifndef	__YKBZERO_H_INCLUDED__
#define	__YKBZERO_H_INCLUDED__

#ifdef _WIN32
#include <windows.h>
#else
#include <string.h>
#endif

#ifdef _WIN32
#define insecure_memzero(buf, len) SecureZeroMemory(buf, len)
#elif HAVE_MEMSET_S
#define insecure_memzero(buf, len) memset_s(buf, len, 0, len)
#elif HAVE_EXPLICIT_BZERO
#define insecure_memzero(buf, len) explicit_bzero(buf, len)
#elif HAVE_EXPLICIT_MEMSET
#define insecure_memzero(buf, len) explicit_memset(buf, 0, len)
#elif HAVE_INLINE_ASM
#define insecure_memzero(buf, len) do {                                 \
                memset(buf, 0, len);                                    \
                __asm__ __volatile__ ("" : : "r"(buf) : "memory");      \
        } while (0)
#else
#define insecure_memzero(buf, len) do {                                 \
                volatile unsigned char *volatile __buf_ =               \
                        (volatile unsigned char *volatile)buf;          \
                size_t __i_ = 0;                                        \
                while (__i_ < len) __buf_[__i_++] = 0;                  \
        } while (0)
#endif

#endif	/* __YKBZERO_H_INCLUDED__ */

Add missing header file missing in the last commit


/* shadowVIC – Copyright (c) 2015 Sven Michael Klose <pixel@hugbox.org> */

#include <stdio.h>

#include "types.h"
#include "config.h"
#include "6502.h"
#include "shadowvic.h"
#include "joystick.h"
#include "video.h"
#include "sync.h"

#define FALSE   0
#define TRUE    1

int
main (int argc, char * argv[])
{
    struct vic20_config config = {
        .is_expanded = FALSE,
        .use_paddles = FALSE,
        .manual_screen_updates = FALSE,
        .frames_per_second = 50,
        .frame_interceptor = NULL
    };

    printf ("shadowVIC – https://github.com/SvenMichaelKlose/shadowvic/");

    joystick_open ();
    video_open ();
    video_map ();
    vic20_open (&config);
    vic20_emulate (m[0xfffc] + (m[0xfffd] << 8));
    vic20_close ();
    video_close ();
    joystick_close ();

    return 0;
}

/* shadowVIC – Copyright (c) 2015 Sven Michael Klose <pixel@hugbox.org> */

#include <stdio.h>

#include "types.h"
#include "config.h"
#include "6502.h"
#include "shadowvic.h"
#include "joystick.h"
#include "video.h"
#include "sync.h"

#define FALSE   0
#define TRUE    1

int
main (int argc, char * argv[])
{
    struct vic20_config config = {
        .is_expanded = FALSE,
        .use_paddles = FALSE,
        .manual_screen_updates = FALSE,
        .frames_per_second = 50,
        .frame_interceptor = NULL
    };

    printf ("picoVIC – https://github.com/SvenMichaelKlose/shadowvic/\n");

    joystick_open ();
    video_open ();
    video_map ();
    vic20_open (&config);
    vic20_emulate (m[0xfffc] + (m[0xfffd] << 8));
    vic20_close ();
    video_close ();
    joystick_close ();

    return 0;
}

Print welcome message with application name and newline.


#include "main.h"
#include <msp430.h>

#include "led_driver.h"

int main(void)
{
	WDTCTL = WDTPW + WDTHOLD;

	led_initialize((led_addresses_s*)P1IN_);

	P1DIR = 0x04;
	P1SEL = 0x06;

	UCA0CTL0 = 0x00;
	UCA0CTL1 = UCSSEL_3;
	UCA0BR0 = 104;
	UCA0BR1 = 0x00;
	UCA0MCTL = 0x03 << 4;

	set_led_color(LED_GREEN);

	while(1)
	{
		if(UCA0STAT & 0x01 == 0x00)
		{
			UCA0TXBUF = 0x5a;
		}
	}
}

#include "main.h"
#include <msp430.h>

#include "led_driver.h"

void main(void)
{
	WDTCTL = WDTPW + WDTHOLD;

	//Set clock to 1MHz
	BCSCTL1 = CALBC1_1MHZ;
	DCOCTL = CALDCO_1MHZ;

	led_initialize((led_addresses_s*)P1IN_);

	P1DIR |= 0x04;
	P1SEL |= 0x06;
	P1SEL2 |= 0x06;

	UCA0CTL0 |= 0x00;
	UCA0CTL1 |= UCSSEL_2;
	UCA0BR0 = 104;
	UCA0BR1 = 0x00;
	UCA0MCTL = UCBRS0;

	UCA0CTL1 &= ~UCSWRST;

	set_led_color(LED_GREEN);

	while(1)
	{

		if((IFG2 & UCA0TXIFG) == UCA0TXIFG)
		{
			UCA0TXBUF = 0x5a;
		}

		//IE2 |= UCA0TXIE;                                 // Enable USCI_A0 TX interrupt
		//__bis_SR_register(LPM0_bits + GIE); // Enter LPM0, interrupts enabled
	}
}

#pragma vector=USCIAB0TX_VECTOR
__interrupt void TX_Ready(void)
{
	if((IFG2 & UCA0TXIFG) == UCA0TXIFG)
	{
		UCA0TXBUF = 0x5a;
	}
}

Send '0x5A' across UART continuously.

Send '0x5A' across UART continuously.


//===--- StringSet.h - The LLVM Compiler Driver -----------------*- C++ -*-===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open
// Source License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
//
//  StringSet - A set-like wrapper for the StringMap.
//
//===----------------------------------------------------------------------===//

#ifndef LLVM_ADT_STRINGSET_H
#define LLVM_ADT_STRINGSET_H

#include "llvm/ADT/StringMap.h"

#include <cassert>

namespace llvm {

  /// StringSet - A wrapper for StringMap that provides set-like
  /// functionality.  Only insert() and count() methods are used by my
  /// code.
  template <class AllocatorTy = llvm::MallocAllocator>
  class StringSet : public llvm::StringMap<char, AllocatorTy> {
    typedef llvm::StringMap<char, AllocatorTy> base;
  public:
    bool insert (const std::string& InLang) {
      assert(!InLang.empty());
      const char* KeyStart = &InLang[0];
      const char* KeyEnd = KeyStart + InLang.size();
      return base::insert(llvm::StringMapEntry<char>::
                          Create(KeyStart, KeyEnd, base::getAllocator(), '+'));
    }
  };
}

#endif // LLVM_ADT_STRINGSET_H

//===--- StringSet.h - The LLVM Compiler Driver -----------------*- C++ -*-===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open
// Source License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
//
//  StringSet - A set-like wrapper for the StringMap.
//
//===----------------------------------------------------------------------===//

#ifndef LLVM_ADT_STRINGSET_H
#define LLVM_ADT_STRINGSET_H

#include "llvm/ADT/StringMap.h"
#include <cassert>

namespace llvm {

  /// StringSet - A wrapper for StringMap that provides set-like
  /// functionality.  Only insert() and count() methods are used by my
  /// code.
  template <class AllocatorTy = llvm::MallocAllocator>
  class StringSet : public llvm::StringMap<char, AllocatorTy> {
    typedef llvm::StringMap<char, AllocatorTy> base;
  public:
    bool insert(const std::string& InLang) {
      assert(!InLang.empty());
      const char* KeyStart = &InLang[0];
      const char* KeyEnd = KeyStart + InLang.size();
      return base::insert(llvm::StringMapEntry<char>::
                          Create(KeyStart, KeyEnd, base::getAllocator(), '+'));
    }
  };
}

#endif // LLVM_ADT_STRINGSET_H

Remove extra blank line and space.

Remove extra blank line and space.

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


void UpdateVScrollBar();
void save_label_comment_edited();
void refresh_label_comment( void );
void clear_label_comment();
void autorize_prevnext_buttons(int Yes);
void ShowMessageBox(const char * title, const char * text, const char * button);
void ShowConfirmationBoxWithChoiceOrNot(const char * title, const char * text, void * function_if_yes, char HaveTheChoice);
void ShowConfirmationBox(const char * title, const char * text, void * function_if_yes);
void RefreshOneBoolVar( int Type, int Num, int Val );
void RefreshAllBoolsVars( );
void UpdateAllLabelsBoolsVars( );
void DoQuitGtkApplication( void );
void DoReset( );
void MessageInStatusBar( char * msg );
void InitGtkWindows( int argc, char *argv[] );
void UpdateAllGtkWindows( void );
void UpdateWindowTitleWithProjectName( void );
void ShowErrorMessage(const char * title, const char * text, const char * button);
void CheckForErrors (void);

Add a message window to display %E variable controlled errors with out grabing focus


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

inherit LIB_INITD;
inherit UTILITY_COMPILE;

static void create()
{
	KERNELD->set_global_access("String", 1);

	load_dir("sys", 1);
}

Create String subsystem to handle all string related stuff


// Copyright (c) 2006-2009 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 NET_SOCKET_SSL_CLIENT_SOCKET_H_
#define NET_SOCKET_SSL_CLIENT_SOCKET_H_

#include "net/socket/client_socket.h"

namespace net {

class SSLCertRequestInfo;
class SSLInfo;

// A client socket that uses SSL as the transport layer.
//
// NOTE: The SSL handshake occurs within the Connect method after a TCP
// connection is established.  If a SSL error occurs during the handshake,
// Connect will fail.
//
class SSLClientSocket : public ClientSocket {
 public:
  // Gets the SSL connection information of the socket.
  virtual void GetSSLInfo(SSLInfo* ssl_info) = 0;

  // Gets the SSL CertificateRequest info of the socket after Connect failed
  // with ERR_SSL_CLIENT_AUTH_CERT_NEEDED.
  virtual void GetSSLCertRequestInfo(
      SSLCertRequestInfo* cert_request_info) = 0;
};

}  // namespace net

#endif  // NET_SOCKET_SSL_CLIENT_SOCKET_H_

// Copyright (c) 2006-2009 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 NET_SOCKET_SSL_CLIENT_SOCKET_H_
#define NET_SOCKET_SSL_CLIENT_SOCKET_H_

#include "net/socket/client_socket.h"

namespace net {

class SSLCertRequestInfo;
class SSLInfo;

// A client socket that uses SSL as the transport layer.
//
// NOTE: The SSL handshake occurs within the Connect method after a TCP
// connection is established.  If a SSL error occurs during the handshake,
// Connect will fail.
//
class SSLClientSocket : public ClientSocket {
 public:
  // Next Protocol Negotiation (NPN), if successful, results in agreement on an
  // application-level string that specifies the application level protocol to
  // use over the TLS connection. NextProto enumerates the application level
  // protocols that we recognise.
  enum NextProto {
    kProtoUnknown = 0,
    kProtoHTTP11 = 1,
    kProtoSPDY = 2,
  };

  // Gets the SSL connection information of the socket.
  virtual void GetSSLInfo(SSLInfo* ssl_info) = 0;

  // Gets the SSL CertificateRequest info of the socket after Connect failed
  // with ERR_SSL_CLIENT_AUTH_CERT_NEEDED.
  virtual void GetSSLCertRequestInfo(
      SSLCertRequestInfo* cert_request_info) = 0;

  static NextProto NextProtoFromString(const std::string& proto_string) {
    if (proto_string == "http1.1") {
      return kProtoHTTP11;
    } else if (proto_string == "spdy") {
      return kProtoSPDY;
    } else {
      return kProtoUnknown;
    }
  }
};

}  // namespace net

#endif  // NET_SOCKET_SSL_CLIENT_SOCKET_H_

Add static function to convert NPN strings to an enum.

http://codereview.chromium.org/487012

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


#include <stdio.h>

int main(int argc, char const *argv[]) {
    printf("Hello world.\n"); // Set break point at this line.
    if (argc == 1)
        return 0;

    // Waiting to be attached by the debugger, otherwise.
    char line[100];
    while (fgets(line, sizeof(line), stdin)) { // Waiting to be attached...
        printf("input line=>%s\n", line);
    }

    printf("Exiting now\n");
}

#include <stdio.h>

#if defined(__linux__)
#include <sys/prctl.h>
#endif

int main(int argc, char const *argv[]) {

#if defined(__linux__)
    // Immediately enable any ptracer so that we can allow the stub attach
    // operation to succeed.  Some Linux kernels are locked down so that
    // only an ancestor process can be a ptracer of a process.  This disables that
    // restriction.  Without it, attach-related stub tests will fail.
#if defined(PR_SET_PTRACER) && defined(PR_SET_PTRACER_ANY)
    int prctl_result;

    // For now we execute on best effort basis.  If this fails for
    // some reason, so be it.
    prctl_result = prctl(PR_SET_PTRACER, PR_SET_PTRACER_ANY, 0, 0, 0);
    (void) prctl_result;
#endif
#endif

    printf("Hello world.\n"); // Set break point at this line.
    if (argc == 1)
        return 0;

    // Waiting to be attached by the debugger, otherwise.
    char line[100];
    while (fgets(line, sizeof(line), stdin)) { // Waiting to be attached...
        printf("input line=>%s\n", line);
    }

    printf("Exiting now\n");
}

Fix HelloWorld attach test for Linux kernels with ptrace ancestor lockdown.

Similar to a recent test I fixed for gdb-remote attach scenarios, this
fix is for Linux kernels, such as Ubuntu's stock setup on 11.04-ish and
later, where ptrace starts requiring a ptracer to be an ancestor of the
inferior to be ptraced.  This change checks for Linux and the ptrace-related
flags.  If they're found, it tries to switch on the "allow any ptracer" mode
for the inferior as the first statements in the program.  It's a best-effort
solution - if the prctl call fails, the failure is ignored, and probably will
lead to the test failing.

The ptrace security behavior can be modified system-wide, but is outside the
scope of the test to address.  Hence I went with this particular solution.

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


#ifndef MODINCLUDE_H
#define MODINCLUDE_H
#include "../main.h"

class ConfigReader;
class ModuleInterface; // forward-declare so it can be used in modules and server
#include "../connection.h" // declare other classes that use it
#include "../modules.h"
#include "../config.h"
#include "../modules.h"
#endif

#ifndef MODINCLUDE_H
#define MODINCLUDE_H
#include "../main.h"

class ConfigReader;
class ModuleInterface; // forward-declare so it can be used in modules and server
#include "../connection.h" // declare other classes that use it
#include "../modules.h"
#include "../config.h"
#endif

Remove double include of a file

Remove double include of a file


#include <stdlib.h>
#include "lb_vector.h"

Vector lb_create_vector(Scalar* data, unsigned int length) {
	Vector v;
	v.data = data;
	v.length = length;
	return v;
}

Vector lb_allocate_vector(unsigned int length) {
	Scalar* ptr = (Scalar*)malloc(sizeof(Scalar) * length);
	return lb_create_vector(ptr, length);
}

// Result = Vector dot Vector
void lbdp(Vector a, Vector b, Scalar* result) {
	*result = 0.0;
	int i;
	for(i = 0; i < a.length; i++) *result += a.data[i] * b.data[i];
}

// Result = Scalar * Vector
void lbstv(Scalar s, Vector v, Vector result) {
	int i;
	for(i = 0; i < v.length; i++) result.data[i] = s * v.data[i];
}

Include stdlib.h for malloc not to bail

Include stdlib.h for malloc not to bail


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

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

Update Skia milestone to 72

Update Skia milestone to 72

No API changes
TBR=reed
NOTRY=TRUE

Bug: skia:
Change-Id: I1ffde14bc6ebf0cf3d89735f70fb9a385b35d167
Reviewed-on: https://skia-review.googlesource.com/c/161940
Commit-Queue: Heather Miller <2e22000c5d22374561fe5fba576a31095b72dc2e@google.com>
Reviewed-by: Heather Miller <2e22000c5d22374561fe5fba576a31095b72dc2e@google.com>


#ifndef _ANDROIDCONFIGURATIONEVENT_H_
#define _ANDROIDCONFIGURATIONEVENT_H_

#include <ConfigurationEvent.h>
#include <android/native_window.h>

class AndroidConfigurationEvent : public ConfigurationEvent {
public:
 AndroidConfigurationEvent(double _timestamp, ANativeWindow * _window)
   : ConfigurationEvent(_timestamp), window(_window) { }

  ANativeWindow * getWindow() { return window; }
  std::shared_ptr<EventBase> dup() const { return NULL; }
  void dispatch(Element & element);

 private:
  ANativeWindow * window = 0;
};

#endif

#ifndef _ANDROIDCONFIGURATIONEVENT_H_
#define _ANDROIDCONFIGURATIONEVENT_H_

#include <ConfigurationEvent.h>
#include <android/native_window.h>

class AndroidConfigurationEvent : public ConfigurationEvent {
public:
 AndroidConfigurationEvent(double _timestamp, ANativeWindow * _window)
   : ConfigurationEvent(_timestamp), window(_window) { }

  ANativeWindow * getWindow() { return window; }
  std::shared_ptr<EventBase> dup() const { return  std::make_shared<AndroidConfigurationEvent>(*this); }
  void dispatch(Element & element);

 private:
  ANativeWindow * window = 0;
};

#endif

Fix AConfigurationEvent dup() return value


#ifndef BITCOINADDRESSVALIDATOR_H
#define BITCOINADDRESSVALIDATOR_H

#include <QValidator>

/** Base48 entry widget validator.
   Corrects near-miss characters and refuses characters that are no part of base48.
 */
class BitcoinAddressValidator : public QValidator
{
    Q_OBJECT

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

    State validate(QString &input, int &pos) const;

    static const int MaxAddressLength = 35;
};

#endif // BITCOINADDRESSVALIDATOR_H

#ifndef BITCOINADDRESSVALIDATOR_H
#define BITCOINADDRESSVALIDATOR_H

#include <QValidator>

/** Base58 entry widget validator.
   Corrects near-miss characters and refuses characters that are not part of base58.
 */
class BitcoinAddressValidator : public QValidator
{
    Q_OBJECT

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

    State validate(QString &input, int &pos) const;

    static const int MaxAddressLength = 35;
};

#endif // BITCOINADDRESSVALIDATOR_H

Fix typo in a comment: it's base58, not base48.


/*
 * Copyright (c) 2012 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.
 */

#include <errno.h>
#include <pthread.h>
#include <unistd.h>

#include "native_client/src/untrusted/nacl/tls.h"

/*
 * libstdc++ makes minimal use of pthread_key_t stuff.
 */

#undef  PTHREAD_KEYS_MAX
#define PTHREAD_KEYS_MAX        16

#define NC_TSD_NO_MORE_KEYS     irt_tsd_no_more_keys()
static void irt_tsd_no_more_keys(void) {
  static const char msg[] = "IRT: too many pthread keys\n";
  write(2, msg, sizeof msg - 1);
}

#define NACL_IN_IRT

/* @IGNORE_LINES_FOR_CODE_HYGIENE[2] */
#include "native_client/src/untrusted/pthread/nc_init_private.c"
#include "native_client/src/untrusted/pthread/nc_thread.c"

/*
 * Copyright (c) 2012 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.
 */

#include <errno.h>
#include <pthread.h>
#include <unistd.h>

#include "native_client/src/untrusted/nacl/tls.h"

/*
 * libstdc++ makes minimal use of pthread_key_t stuff.
 */

#undef  PTHREAD_KEYS_MAX
#define PTHREAD_KEYS_MAX        32

#define NC_TSD_NO_MORE_KEYS     irt_tsd_no_more_keys()
static void irt_tsd_no_more_keys(void) {
  static const char msg[] = "IRT: too many pthread keys\n";
  write(2, msg, sizeof msg - 1);
}

#define NACL_IN_IRT

/* @IGNORE_LINES_FOR_CODE_HYGIENE[2] */
#include "native_client/src/untrusted/pthread/nc_init_private.c"
#include "native_client/src/untrusted/pthread/nc_thread.c"

Increase the number of pthread keys available to the IRT

The Mojo EDK uses an additional key for thread-local storage
and is now necessary to bring up IPC in Chrome. This is apparently
enough to push us over the 16 key limit in some cases.

Doubling to 32 to leave some room for further expansion.

BUG=https://code.google.com/p/chromium/issues/detail?id=612500

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


/*
Copyright © 2018 Atlas Engineer LLC.
Use of this file is governed by the license that can be found in LICENSE.
*/

#include <gtk/gtk.h>
#include "server.h"

int main(int argc, char *argv[]) {
	// TODO: Use GtkApplication?
	gtk_init(&argc, &argv);

	// TODO: Start the xmlrpc server first?  If GUI is started, then we can
	// report xmlrpc startup issue graphically.
	start_server();
	start_client();

	gtk_main();

	stop_server();
	return 0;
}

/*
Copyright © 2018 Atlas Engineer LLC.
Use of this file is governed by the license that can be found in LICENSE.
*/

#include <gtk/gtk.h>
#include <stdlib.h>
#include "server.h"

int main(int argc, char *argv[]) {
	// TODO: Use GtkApplication?
	gtk_init(&argc, &argv);

	// TODO: Start the xmlrpc server first?  If GUI is started, then we can
	// report xmlrpc startup issue graphically.
	start_server();
	start_client();

	gtk_main();

	stop_server();
	return EXIT_SUCCESS;
}

Use stdlib and return EXIT_SUCCESS

ports/gtk-webkit: Use stdlib and return EXIT_SUCCESS


/*
* CECPQ1 (x25519 + NewHope)
* (C) 2016 Jack Lloyd
*
* Botan is released under the Simplified BSD License (see license.txt)
*/

#ifndef BOTAN_CECPQ1_H__
#define BOTAN_CECPQ1_H__

#include <botan/secmem.h>
#include <botan/newhope.h>

namespace Botan {

struct CECPQ1_key {
   secure_vector<uint8_t> m_x25519;
   newhope_poly m_newhope;
};

void BOTAN_DLL CECPQ1_offer(uint8_t* offer_message,
                            CECPQ1_key* offer_key_output,
                            RandomNumberGenerator& rng);

void BOTAN_DLL CECPQ1_accept(uint8_t* shared_key,
                             uint8_t* accept_message,
                             const uint8_t* offer_message,
                             RandomNumberGenerator& rng);

void BOTAN_DLL CECPQ1_finish(uint8_t* shared_key,
                             const CECPQ1_key& offer_key,
                             const uint8_t* accept_message);

}

#endif

/*
* CECPQ1 (x25519 + NewHope)
* (C) 2016 Jack Lloyd
*
* Botan is released under the Simplified BSD License (see license.txt)
*/

#ifndef BOTAN_CECPQ1_H__
#define BOTAN_CECPQ1_H__

#include <botan/secmem.h>
#include <botan/newhope.h>

namespace Botan {

class CECPQ1_key
   {
   public:
      secure_vector<uint8_t> m_x25519;
      newhope_poly m_newhope;
   };

void BOTAN_DLL CECPQ1_offer(uint8_t* offer_message,
                            CECPQ1_key* offer_key_output,
                            RandomNumberGenerator& rng);

void BOTAN_DLL CECPQ1_accept(uint8_t* shared_key,
                             uint8_t* accept_message,
                             const uint8_t* offer_message,
                             RandomNumberGenerator& rng);

void BOTAN_DLL CECPQ1_finish(uint8_t* shared_key,
                             const CECPQ1_key& offer_key,
                             const uint8_t* accept_message);

}

#endif

Fix class vs struct declaration.

Fix class vs struct declaration.

Recent Clang complains about forward decl as 'class X' when X was
actually declared as a struct.


/* keeps track of bans */

mapping username_bans;
mapping ip_bans;

static void create()
{
	username_bans = ([ ]);
}

void ban_username(string username)
{
	ACCESS_CHECK(GAME());

	if (username_bans[username]) {
		error("Username already banned");
	}

	username_bans[username] = 1;
}

void unban_username(string username)
{
	ACCESS_CHECK(GAME());

	if (!username_bans[username]) {
		error("Username not banned");
	}

	username_bans[username] = nil;
}

int query_is_banned(string username)
{
	return !!username_bans(username);
}

#include <kotaka/privilege.h>

/* keeps track of bans */

mapping username_bans;

private void save();
private void restore();

static void create()
{
	username_bans = ([ ]);
	restore();
}

void ban_username(string username)
{
	ACCESS_CHECK(GAME());

	if (username == "admin") {
		error("Cannot ban admin");
	}

	if (username_bans[username]) {
		error("Username already banned");
	}

	username_bans[username] = 1;
	save();
}

void unban_username(string username)
{
	ACCESS_CHECK(GAME());

	if (!username_bans[username]) {
		error("Username not banned");
	}

	username_bans[username] = nil;
	save();
}

int query_is_banned(string username)
{
	return !!username_bans[username];
}

private void save()
{
	save_object("band.o");
}

private void restore()
{
	restore_object("band.o");
}

Allow ban manager to save state

Allow ban manager to save state


// RUN: %clang_cc1 -emit-llvm %s -o - | FileCheck %s
struct A { short s; short t; int i; };
// CHECK: %a = alloca %struct.A, align 4
// CHECK: call void @llvm.memset.p0i8.i64(i8* %tmp, i8 0, i64 8, i32 4, i1 false)
void q() { struct A a = {0}; }

// RUN: %clang_cc1 -emit-llvm %s -o - | FileCheck %s
struct A { short s; short t; int i; };
// CHECK: %a = alloca %struct.A, align 4
// CHECK: call void @llvm.memset.p0i8.i64{{.*}}i32 4, i1 false)
void q() { struct A a = {0}; }

Rework the match here to silence release mode windows buildbots.

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


#include "GRT/GRT.h"
#include "istream.h"

using namespace GRT;

// Normalize by dividing each dimension by the total magnitude.
// Also add the magnitude as an additional feature.
vector<double> normalize(vector<double> input) {
    double magnitude;

    for (int i = 0; i < input.size(); i++) magnitude += (input[i] * input[i]);
    magnitude = sqrt(magnitude);
    for (int i = 0; i < input.size(); i++) input[i] /= magnitude;

    input.push_back(magnitude);

    return input;
}

ASCIISerialStream stream(9600, 3);
GestureRecognitionPipeline pipeline;

void setup() {
    stream.useUSBPort(0);
    stream.useNormalizer(normalize);
    useStream(stream);

    pipeline.addPreProcessingModule(MovingAverageFilter(5, 4));
    //pipeline.addFeatureExtractionModule(TimeDomainFeatures(10, 1, 3, false, true, true, false, false));
    pipeline.setClassifier(ANBC());
    usePipeline(pipeline);
}

#include "GRT/GRT.h"
#include "istream.h"

using namespace GRT;

// Normalize by dividing each dimension by the total magnitude.
// Also add the magnitude as an additional feature.
vector<double> normalize(vector<double> input) {
    double magnitude = 0.0;

    for (int i = 0; i < input.size(); i++) magnitude += (input[i] * input[i]);
    magnitude = sqrt(magnitude);
    for (int i = 0; i < input.size(); i++) input[i] /= magnitude;

    input.push_back(magnitude);

    return input;
}

ASCIISerialStream stream(9600, 3);
GestureRecognitionPipeline pipeline;

void setup() {
    stream.useUSBPort(0);
    stream.useNormalizer(normalize);
    useStream(stream);

    pipeline.addPreProcessingModule(MovingAverageFilter(5, 4));
    //pipeline.addFeatureExtractionModule(TimeDomainFeatures(10, 1, 3, false, true, true, false, false));
    pipeline.setClassifier(ANBC());
    usePipeline(pipeline);
}

Initialize double variable before use.

Initialize double variable before use.

Also removed trailing spaces.


#ifndef LOG_H
#define LOG_H

#include <string>
#include <iostream>
#include <SFML/Graphics.hpp>

inline void Log(std::string str)
{
	std::cout << "[" << __LINE__ << "] " << __FUNCTION__ << " : " << str << std::endl;
}

inline void LogFnStart()
{
	Log("Entered");
}

inline void LogFnEnd()
{
	Log("Finished");
}

inline void NestedLog(std::string str)
{
	std::cout << "\n\t" << str << "\n" << std::endl;
}

namespace CppChart
{
	std::ostream& operator<<(std::ostream& stream, const sf::Vector2f& v);
	std::ostream& operator<<(std::ostream& stream, const sf::Vector2u& v);
	std::ostream& operator<<(std::ostream& stream, const sf::Color& c);

	template <typename T>
	std::string ToString(const T& val);
}

#endif

#ifndef LOG_H
#define LOG_H

#include <string>
#include <iostream>
#include <SFML/Graphics.hpp>

inline void Log(std::string str)
{
	std::cout << "[" << __LINE__ << "] " << __FUNCTION__ << " : " << str << std::endl;
}

inline void LogFnStart()
{
	Log("Entered");
}

inline void LogFnEnd()
{
	Log("Finished");
}

inline void NestedLog(std::string str)
{
	std::cout << "\n\t" << str << "\n" << std::endl;
}

namespace CppChart
{
	std::ostream& operator<<(std::ostream&, const sf::Vector2f&);
	std::ostream& operator<<(std::ostream&, const sf::Vector2u&);
	std::ostream& operator<<(std::ostream&, const sf::Color&);

	template <typename T>
	std::string ToString(const T&);
}

#endif

Delete argument names of function

Delete argument names of function


// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.

#pragma once

#include "blueprint.h"
#include <vespa/searchlib/fef/matchdatalayout.h>

namespace search::queryeval {

class EquivBlueprint : public ComplexLeafBlueprint
{
private:
    FieldSpecBaseList          _fields;
    HitEstimate                _estimate;
    fef::MatchDataLayout       _layout;
    std::vector<Blueprint::UP> _terms;
    std::vector<double>        _exactness;

public:
    EquivBlueprint(const FieldSpecBaseList &fields, fef::MatchDataLayout subtree_mdl);
    virtual ~EquivBlueprint();

    // used by create visitor
    EquivBlueprint& addTerm(Blueprint::UP term, double exactness);

    SearchIteratorUP createLeafSearch(const fef::TermFieldMatchDataArray &tfmda, bool strict) const override;
    SearchIteratorUP createFilterSearch(bool strict, FilterConstraint constraint) const override;

    void visitMembers(vespalib::ObjectVisitor &visitor) const override;
    void fetchPostings(const ExecuteInfo &execInfo) override;
    bool isEquiv() const override { return true; }
};

}

// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.

#pragma once

#include "blueprint.h"
#include <vespa/searchlib/fef/matchdatalayout.h>

namespace search::queryeval {

class EquivBlueprint : public ComplexLeafBlueprint
{
private:
    FieldSpecBaseList          _fields;
    HitEstimate                _estimate;
    fef::MatchDataLayout       _layout;
    std::vector<Blueprint::UP> _terms;
    std::vector<double>        _exactness;

public:
    EquivBlueprint(const FieldSpecBaseList &fields, fef::MatchDataLayout subtree_mdl);
    ~EquivBlueprint() override;

    // used by create visitor
    EquivBlueprint& addTerm(Blueprint::UP term, double exactness);

    SearchIteratorUP createLeafSearch(const fef::TermFieldMatchDataArray &tfmda, bool strict) const override;
    SearchIteratorUP createFilterSearch(bool strict, FilterConstraint constraint) const override;

    void visitMembers(vespalib::ObjectVisitor &visitor) const override;
    void fetchPostings(const ExecuteInfo &execInfo) override;
    bool isEquiv() const override { return true; }
};

}

Use override specifier for EquivBlueprint destructor.


#include <stdio.h>
#include <string.h>
#include "zf_log.h"

#define LOG_FILENAME "test.log"

FILE *log_file;

static void log_file_write(zf_log_output_ctx *ctx) {
    *ctx->p = '\n';

    fwrite(ctx->buf, 1, (ctx->p + 1) - ctx->buf, log_file);

    fflush(log_file);
}

int main(int argc, char *argv[])
{
    log_file = fopen(LOG_FILENAME, "a+");
    if (NULL == log_file) {
        printf("Failed to open log file.\n");
    }

    zf_log_set_output_callback(log_file_write);

    ZF_LOGI("You will see the number of arguments: %i", argc);
    ZF_LOGI_MEM(argv, argc * sizeof(*argv), "argv pointers:");

    fclose(log_file);

    return 0;
}

Add example which outputs log to a file.


// -*- Mode: ObjC; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
//
// This file is part of the LibreOffice project.
//
// 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/.

#import "MLOViewController.h"
#import "MLOTestingTileSubviewControllerProtocol.h"

static const CGFloat CONTEXT_WIDTH_DEFAULT = 450;
static const CGFloat CONTEXT_HEIGHT_DEFAULT = 450;
static const CGFloat TILE_POS_X_DEFAULT = 400;
static const CGFloat TILE_POS_Y_DEFAULT = 420;
static const CGFloat TILE_WIDTH_DEFAULT = 250;
static const CGFloat TILE_HEIGHT_DEFAULT = 250;

@interface MLOTestingTileParametersViewController : MLOViewController<MLOTestingTileSubviewControllerProtocol>
@property CGFloat contextWidth, contextHeight, tilePosX, tilePosY, tileWidth, tileHeight;
-(void)renderTile;
@end

// -*- Mode: ObjC; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
//
// This file is part of the LibreOffice project.
//
// 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/.

#import "MLOViewController.h"
#import "MLOTestingTileSubviewControllerProtocol.h"

// The size of the actual pixel tile
static const CGFloat CONTEXT_WIDTH_DEFAULT = 450;
static const CGFloat CONTEXT_HEIGHT_DEFAULT = 450;

// In our "decatwips"
static const CGFloat TILE_POS_X_DEFAULT = 0;
static const CGFloat TILE_POS_Y_DEFAULT = 0;

// "Tile" size here means the decatwip size of the part of the document
// rendered into the pixel tile
static const CGFloat TILE_WIDTH_DEFAULT = 500;
static const CGFloat TILE_HEIGHT_DEFAULT = 500;

@interface MLOTestingTileParametersViewController : MLOViewController<MLOTestingTileSubviewControllerProtocol>
@property CGFloat contextWidth, contextHeight, tilePosX, tilePosY, tileWidth, tileHeight;
-(void)renderTile;
@end

Adjust parameter defaults to give pleasant result

Change-Id: Ifee900344547ef25b2041d25c13fcbc50428485e


#define QUOTE_(x) #x
#define QUOTE(x) QUOTE_(x)

inline void f(int a, char *);

__typeof(f) orig_f asm(QUOTE(__USER_LABEL_PREFIX__) "f");

inline void f(int a, char *p) asm(QUOTE(__USER_LABEL_PREFIX__) "f_wrapper_thunk");
inline void f(int a, char *p)
{
	orig_f(a+1, p+1);
}

int main()
{
	f(0, "hi");
}

Add example of using __asm__() to rewrite calls to a function


#pragma once
typedef uint64_t msgid_t;
typedef uint64_t msec_t;
typedef uint64_t usec_t;

Fix compile error on CentOS

Fix compile error on CentOS


#pragma once
#include <string>
#include <iostream>
#include <fstream>
#include <exception>

#include <boost/format.hpp>
using boost::format;

class LogFile
{
public:
    LogFile();
    explicit LogFile(const std::string& filename);
    ~LogFile();

    void open(const std::string& filename);
    void close();

    template <class T>
    void write(const T& other, bool newline=true) {
        if (haveFile) {
            file << other;
            if (newline) {
                file << std::endl;
            }
        } else {
            std::cout << other;
            if (newline) {
                std::cout << std::endl;
            }
        }
    }

private:
    bool haveFile;
    std::ofstream file;
};

class debugParameters
{
public:
    static bool debugAdapt;
    static bool debugRegrid;
    static bool debugTimesteps;
    static bool debugFlameRadiusControl;
    static bool veryVerbose;
};

extern LogFile logFile;

class debugException : public std::exception
{
public:
    std::string errorString;
    debugException(void);
    ~debugException(void) throw() {}
    debugException(const std::string& error);
    virtual const char* what() throw();
};

#pragma once
#include <string>
#include <iostream>
#include <fstream>
#include <exception>

#include <boost/format.hpp>
using boost::format;

class LogFile
{
public:
    LogFile();
    explicit LogFile(const std::string& filename);
    ~LogFile();

    void open(const std::string& filename);
    void close();

    template <class T>
    void write(const T& other, bool newline=true) {
        if (haveFile) {
            file << other;
            if (newline) {
                file << std::endl;
            }
        } else {
            std::cout << other;
            if (newline) {
                std::cout << std::endl;
            }
#ifndef NDEBUG
            std::cout.flush();
            std::cerr.flush();
#endif
        }
    }

private:
    bool haveFile;
    std::ofstream file;
};

class debugParameters
{
public:
    static bool debugAdapt;
    static bool debugRegrid;
    static bool debugTimesteps;
    static bool debugFlameRadiusControl;
    static bool veryVerbose;
};

extern LogFile logFile;

class debugException : public std::exception
{
public:
    std::string errorString;
    debugException(void);
    ~debugException(void) throw() {}
    debugException(const std::string& error);
    virtual const char* what() throw();
};

Synchronize logging to stderr and stdout in debug mode


// Ensure we support the various CPU names.
//
// RUN: %clang_cc1 -triple aarch64-unknown-unknown -target-cpu cortex-a35 -verify %s
// RUN: %clang_cc1 -triple aarch64-unknown-unknown -target-cpu cortex-a53 -verify %s
// RUN: %clang_cc1 -triple aarch64-unknown-unknown -target-cpu cortex-a57 -verify %s
// RUN: %clang_cc1 -triple aarch64-unknown-unknown -target-cpu cortex-a72 -verify %s
// RUN: %clang_cc1 -triple aarch64-unknown-unknown -target-cpu cortex-a73 -verify %s
// RUN: %clang_cc1 -triple aarch64-unknown-unknown -target-cpu cyclone -verify %s
// RUN: %clang_cc1 -triple aarch64-unknown-unknown -target-cpu exynos-m1 -verify %s
// RUN: %clang_cc1 -triple aarch64-unknown-unknown -target-cpu generic -verify %s
// RUN: %clang_cc1 -triple aarch64-unknown-unknown -target-cpu kryo -verify %s
// RUN: %clang_cc1 -triple aarch64-unknown-unknown -target-cpu vulcan -verify %s
//
// expected-no-diagnostics

test/Frontend: Add a test for aarch64 target CPU names.

Nothing else checked the target cpu names for aarch64 yet.
Add a test in the spirit of x86-target-cpu.c.

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


/*
 * Copyright (c) 2019 Oticon A/S
 *
 * SPDX-License-Identifier: Apache-2.0
 */

/**
 * This header exists solely to allow drivers meant for the native_posix board
 * to be used directly in the nrf52_bsim board.
 * Note that such reuse should be done with great care.
 *
 * The command line arguments parsing logic from native_posix was born as a copy
 * of the one from the BabbleSim's libUtil library
 * They are therefore mostly equal except for types and functions names.
 *
 * This header converts these so the native_posix call to dynamically register
 * command line arguments is passed to the nrf52_bsim one
 */

#include "../native_posix/cmdline_common.h"

static inline void native_add_command_line_opts(struct args_struct_t *args)
{
	void bs_add_extra_dynargs(struct args_struct_t *args);
	bs_add_extra_dynargs(args);
}

nrf52_bsim: Add header to allow reusing native_posix drivers

This board and the native_posix board share the POSIX architecture.
Some of the native_posix drivers/backends only rely on the
underlaying operating system API, and do not require any special
HW model to operate.
Therefore it is quite easy to reuse some of them into this board.

Currently the only limitation for some, is the interface they use
in the board to register their command line arguments.
This header provides a minimal shim to rename the, otherwise
equivalent, call.

Signed-off-by: Alberto Escolar Piedras <52be3174920ed06cbdfbcf9622a1a6c68e942617@oticon.com>


/****************************************************************/
/* MOOSE - Multiphysics Object Oriented Simulation Environment  */
/*                                                              */
/*          All contents are licensed under LGPL V2.1           */
/*             See LICENSE for full restrictions                */
/****************************************************************/

#ifndef NOEVAPFREEENERGY_H
#define NOEVAPFREEENERGY_H

#include "DerivativeFunctionMaterialBase.h"

//Forward Declarations
class NoEvapFreeEnergy;

template<>
InputParameters validParams<NoEvapFreeEnergy>();

/**
 * Material class that creates a piecewise free energy with supressed evaporation and its derivatives
 * for use with CHParsed and SplitCHParsed. F = .
 */
class NoEvapFreeEnergy : public DerivativeFunctionMaterialBase
{
public:
  NoEvapFreeEnergy(const InputParameters & parameters);

protected:
  virtual Real computeF();
  virtual Real computeDF(unsigned int j_var);
  virtual Real computeD2F(unsigned int j_var, unsigned int k_var);

private:
  /// Coupled variable value for the concentration \f$ \c \f$.
  VariableValue & _c;
  unsigned int _c_var;
};

#endif //NOEVAPFREEENERGY_H

/****************************************************************/
/* MOOSE - Multiphysics Object Oriented Simulation Environment  */
/*                                                              */
/*          All contents are licensed under LGPL V2.1           */
/*             See LICENSE for full restrictions                */
/****************************************************************/

#ifndef NOEVAPFREEENERGY_H
#define NOEVAPFREEENERGY_H

#include "DerivativeFunctionMaterialBase.h"

//Forward Declarations
class NoEvapFreeEnergy;

template<>
InputParameters validParams<NoEvapFreeEnergy>();

/**
 * Material class that creates a piecewise free energy with supressed evaporation and its derivatives
 * for use with CHParsed and SplitCHParsed. F = .
 */
class NoEvapFreeEnergy : public DerivativeFunctionMaterialBase
{
public:
  NoEvapFreeEnergy(const InputParameters & parameters);

protected:
  virtual Real computeF();
  virtual Real computeDF(unsigned int j_var);
  virtual Real computeD2F(unsigned int j_var, unsigned int k_var);

private:
  /// Coupled variable value for the concentration \f$ \c \f$.
  const VariableValue & _c;
  unsigned int _c_var;
};

#endif //NOEVAPFREEENERGY_H

Add const in newly-added file.

Add const in newly-added file.