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

#pragma once

// includes
// std
#include <vector>

// SpaceVecAlg
#include <SpaceVecAlg/SpaceVecAlg>

#include "Jacobian.h"

namespace rbd
{
class MultiBody;
class MultiBodyConfig;

namespace ik {

static constexpr int MAX_ITERATIONS = 50;
static constexpr double LAMBDA = 0.9;
static constexpr double THRESHOLD = 1e-8;
static constexpr double ALMOST_ZERO = 1e-8;

} // ik

/**
	* Inverse Kinematics algorithm.
	*/
class InverseKinematics
{
public:
	InverseKinematics()
	{}
	/// @param mb MultiBody associated with this algorithm.
	InverseKinematics(const MultiBody& mb, int ef_index);
	/**
	* Compute the inverse kinematics.
	* @param mb MultiBody used has model.
	* @param mbc Use q generalized position vector
	* @return bool if computation has converged
	* Fill q with new generalized position, bodyPosW, jointConfig
	* and parentToSon
	*/
	bool inverseKinematics(const MultiBody& mb, MultiBodyConfig& mbc,
			       const sva::PTransformd& ef_target);

	/** safe version of @see inverseKinematics.
	* @throw std::domain_error If mb doesn't match mbc.
	*/
	bool sInverseKinematics(const MultiBody& mb, MultiBodyConfig& mbc,
				const sva::PTransformd& ef_target);
	/**
	* @brief Find q that minimizes the distance between ef and ef_target.
	* @return Bool if convergence has been reached
	*/

	// @brief Maximum number of iterations
	int max_iterations_;
	// @brief Learning rate
	double lambda_;
	// @brief Stopping criterion
	double threshold_;
	// @brief Rounding threshold for the Jacobian
	double almost_zero_;

private:
	// @brief ef_index is the End Effector index used to build jacobian
	int ef_index_;
	Jacobian jac_;
	Eigen::JacobiSVD<Eigen::MatrixXd> svd_;
};

} // namespace rbd

Update documentation for modification of mbc and new properties


// PARAM: --enable ana.int.interval --enable ana.int.congruence --disable ana.int.def_exc
// Overflow information should be passed from the interval domain to congruences
#include <assert.h>
#include <stdio.h>

int main(){
  char r;

  if (r) {
    r = -68;
  } else {
    r = -63;
  }

  char k = r - 80;
  assert (k == 0); //UNKNOWN!

  char non_ov = r - 10;
  assert (non_ov == -78); //UNKNOWN

  char m = r * 2;

  assert (m == 0); //UNKNOWN!

  char l = r + (-80);
  assert (l == 0); //UNKNOWN!

  int g;

  if (g) {
    g = -126;
  } else {
    g = -128;
  }

  char f = g / (-1);
  assert (f == 1); //UNKNOWN!

  char d = -g;
  assert (d == 1); //UNKNOWN!

  return 0;

}

// PARAM: --enable ana.int.interval --enable ana.int.congruence --disable ana.int.def_exc
// Overflow information should be passed from the interval domain to congruences
#include <assert.h>
#include <stdio.h>

int main(){
  signed char r;

  if (r) {
    r = -68;
  } else {
    r = -63;
  }

  signed char k = r - 80;
  assert (k == 0); //UNKNOWN!

  signed char non_ov = r - 10;
  assert (non_ov == -78); //UNKNOWN!

  signed char m = r * 2;

  assert (m == 0); //UNKNOWN!

  signed char l = r + (-80);
  assert (l == 0); //UNKNOWN!

  int g;

  if (g) {
    g = -126;
  } else {
    g = -128;
  }

  signed char f = g / (-1);
  assert (f == 1); //UNKNOWN!

  signed char d = -g;
  assert (d == 1); //UNKNOWN!

  return 0;

}

Change UNKNOWN to UNKNOWN! in 37/03 + chars to signed chars


#include <polygon.h>

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

	Polygon lol;

	lol=createPolygon();
	lol=addPoint(lol, createPoint(12.6,-5.3));
	lol=addPoint(lol, createPoint(-4.1,456.123));

	printf("\n\ntaille : %d", lol.size);

	printf("\n\nx premier point : %f", lol.head->value.x);
	printf("\ny premier point : %f\n\n", lol.head->value.y);

	printf("\n\nx 2eme point : %f", lol.head->next->value.x);
	printf("\ny 2eme point : %f\n\n", lol.head->next->value.y);

	printf("\n\nx 3eme point : %f", lol.head->next->next->value.x);
	printf("\ny 3eme point : %f\n\n", lol.head->next->next->value.y);

	return EXIT_SUCCESS;

}

#include <polygon.h>

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

	Polygon lol;

	lol=createPolygon();
	lol=addPoint(lol, createPoint(12.6,-5.3));
	lol=addPoint(lol, createPoint(-4.1,456.123));
	lol=addPoint(lol, createPoint(23.7,1));

	printf("\n\ntaille : %d", lol.size);

	printf("\n\nx premier point : %f", lol.head->value.x);
	printf("\ny premier point : %f\n\n", lol.head->value.y);

	printf("\n\nx 2eme point : %f", lol.head->next->value.x);
	printf("\ny 2eme point : %f\n\n", lol.head->next->value.y);

	printf("\n\nx 3eme point : %f", lol.head->next->next->value.x);
	printf("\ny 3eme point : %f\n\n", lol.head->next->next->value.y);

	printf("\nSuppression du 2e élément...\n");
	lol=removePoint(lol, 2);

        printf("\n\ntaille : %d", lol.size);

        printf("\n\nx premier point : %f", lol.head->value.x);
        printf("\ny premier point : %f\n\n", lol.head->value.y);

        printf("\n\nx 2eme point : %f", lol.head->next->value.x);
        printf("\ny 2eme point : %f\n\n", lol.head->next->value.y);

        printf("\n\nx 3eme point : %f", lol.head->next->next->value.x);
        printf("\ny 3eme point : %f\n\n", lol.head->next->next->value.y);

	return EXIT_SUCCESS;

}

Add a section which test if the removePoint function work

And it work !


/*
 * Copyright (c) 2011-2013 Graham Edgecombe <graham@grahamedgecombe.com>
 *
 * Permission to use, copy, modify, and/or distribute this software for any
 * purpose with or without fee is hereby granted, provided that the above
 * copyright notice and this permission notice appear in all copies.
 *
 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 */

#ifndef STDNORETURN_H
#define STDNORETURN_H

#define noreturn _Noreturn

#endif

/*
 * Copyright (c) 2011-2013 Graham Edgecombe <graham@grahamedgecombe.com>
 *
 * Permission to use, copy, modify, and/or distribute this software for any
 * purpose with or without fee is hereby granted, provided that the above
 * copyright notice and this permission notice appear in all copies.
 *
 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 */

#ifndef STDNORETURN_H
#define STDNORETURN_H

#if defined(__clang__) && __clang_major__ == 3 && __clang_minor__ == 0
#define noreturn
#else
#define noreturn _Noreturn
#endif

#endif

Fix lack of _Noreturn support in Clang 3.0.


/*
* RFC 6979 Deterministic Nonce Generator
* (C) 2014 Jack Lloyd
*
* Distributed under the terms of the Botan license
*/

#ifndef BOTAN_RFC6979_GENERATOR__
#define BOTAN_RFC6979_GENERATOR__

#include <botan/bigint.h>
#include <string>

namespace Botan {

/**
* @param x the secret (EC)DSA key
* @param q the group order
* @param h the message hash already reduced mod q
* @param hash the hash function used to generate h
*/
BigInt BOTAN_DLL generate_rfc6979_nonce(const BigInt& x,
                                        const BigInt& q,
                                        const BigInt& h,
                                        const std::string& hash);

}

#endif

/*
* RFC 6979 Deterministic Nonce Generator
* (C) 2014 Jack Lloyd
*
* Distributed under the terms of the Botan license
*/

#ifndef BOTAN_RFC6979_GENERATOR_H__
#define BOTAN_RFC6979_GENERATOR_H__

#include <botan/bigint.h>
#include <string>

namespace Botan {

/**
* @param x the secret (EC)DSA key
* @param q the group order
* @param h the message hash already reduced mod q
* @param hash the hash function used to generate h
*/
BigInt BOTAN_DLL generate_rfc6979_nonce(const BigInt& x,
                                        const BigInt& q,
                                        const BigInt& h,
                                        const std::string& hash);

}

#endif

Fix header guard for amalgamation

Fix header guard for amalgamation


#ifndef __KMS_UTILS_H__
#define __KMS_UTILS_H__

#include <gst/gst.h>

GstElement* kms_get_pipeline();

void kms_dynamic_connection(GstElement *orig, GstElement *dest, const gchar *name);

GstElement* kms_utils_get_element_for_caps(GstElementFactoryListType type,
				GstRank rank, const GstCaps *caps,
				GstPadDirection direction, gboolean subsetonly,
				const gchar *name);

#endif /* __KMS_UTILS_H__ */

#ifndef __KMS_UTILS_H__
#define __KMS_UTILS_H__

#include <gst/gst.h>

#define KMS_DEBUG_PIPE(name) GST_DEBUG_BIN_TO_DOT_FILE_WITH_TS(		\
				GST_BIN(kms_get_pipeline()),		\
				GST_DEBUG_GRAPH_SHOW_ALL, name);	\

GstElement* kms_get_pipeline();

void kms_dynamic_connection(GstElement *orig, GstElement *dest, const gchar *name);

GstElement* kms_utils_get_element_for_caps(GstElementFactoryListType type,
				GstRank rank, const GstCaps *caps,
				GstPadDirection direction, gboolean subsetonly,
				const gchar *name);

#endif /* __KMS_UTILS_H__ */

Create a macro for pipeline debugging

Create a macro for pipeline debugging


#ifndef _RSA_SIGN_CONSTANTS_H_
	#define _RSA_SIGN_CONSTANTS_H_

/*
 *  RSA Block length. Used to determine the modulo's size.
 */
#define RSA_SIGN_BLOCK_LEN (1024)
#define RSA_SIGN_HASH_METHOD_SHA_1 ("sha1")
#define RSA_SIGN_HASH_METHOD_SHA_256 ("sha256")

/*
 *	Supported Hashing methods for RSA signature validation
 */
enum rsa_sign_hash_method {SHA1, SHA256 };

#endif /* _RSA_SIGN_CONSTANTS_H_ */

#ifndef _RSA_SIGN_CONSTANTS_H_
	#define _RSA_SIGN_CONSTANTS_H_

/*
 *  RSA Block length. Used to determine the modulo's size.
 */
#define RSA_SIGN_BLOCK_LEN (RSA_SIGN_KEY_BITSIZE/8)
#define RSA_SIGN_KEY_BITSIZE (1024)
#define RSA_SIGN_HASH_METHOD_SHA_1 ("sha1")
#define RSA_SIGN_HASH_METHOD_SHA_256 ("sha256")

/*
 *	Supported Hashing methods for RSA signature validation
 */
enum rsa_sign_hash_method {SHA1, SHA256 };

#endif /* _RSA_SIGN_CONSTANTS_H_ */

Add RSA byte length constant

Add RSA byte length constant

A RSA byte length define was added to disambiguate RSA_KEY_BITLENGTH
(typically 1024 here) from the RSA byte block length.


#ifndef KAI_PLATFORM_GAME_CONTROLLER_H
#define KAI_PLATFORM_GAME_CONTROLLER_H

#include KAI_PLATFORM_INCLUDE(GameController.h)

#endif // SHATTER_PLATFORM_GAME_CONTROLLER_H

//EOF

#ifndef KAI_PLATFORM_GAME_CONTROLLER_H
#define KAI_PLATFORM_GAME_CONTROLLER_H

#include KAI_PLATFORM_INCLUDE(GameController.h)

#endif

//EOF

Add some color for console output

Add some color for console output

Former-commit-id: 315cc71afe5d5245e60ce4564328619c49310b6a
Former-commit-id: 4afa9ab712a2bdbef25bee286ff0bdcf2a8da2b2


// Copyright 2020 Google LLC
//
// 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
//
//      https://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 IREE_COMPILER_TRANSLATION_SPIRV_LINALGTOSPIRV_PASSES_H
#define IREE_COMPILER_TRANSLATION_SPIRV_LINALGTOSPIRV_PASSES_H

#include "mlir/Pass/Pass.h"

namespace mlir {
namespace iree_compiler {

/// Pass to get gpu.module from a gpu.launch operation.
std::unique_ptr<OpPassBase<FuncOp>> createIREEGpuKernelOutliningPass();

}  // namespace iree_compiler
}  // namespace mlir

#endif

// Copyright 2020 Google LLC
//
// 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
//
//      https://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 IREE_COMPILER_TRANSLATION_SPIRV_LINALGTOSPIRV_PASSES_H
#define IREE_COMPILER_TRANSLATION_SPIRV_LINALGTOSPIRV_PASSES_H

#include "mlir/Pass/Pass.h"

namespace mlir {
namespace iree_compiler {

/// Pass to get gpu.module from a gpu.launch operation.
std::unique_ptr<OpPassBase<ModuleOp>> createIREEGpuKernelOutliningPass();

}  // namespace iree_compiler
}  // namespace mlir

#endif

Fix mismatch in function signature and implementation.

PiperOrigin-RevId: 299956663


#ifndef TUVOK_PERF_COUNTER_H
#define TUVOK_PERF_COUNTER_H

/// Valid performance counters the system should track.
/// When adding a new counter, please add a (units) clause so we know how to
/// interpret the value!
enum PerfCounter {
  PERF_DISK_READ=0,    // reading bricks from disk (seconds)
  PERF_DECOMPRESSION,  // decompressing brick data (seconds)
  PERF_COMPRESSION,    // compressing brick data (seconds)
  PERF_BRICKS,         // number of bricks read/processed (counter)
  PERF_END_IO, // invalid; end of IO-based metrics

  PERF_READ_HTABLE=1000, // reading hash table from GPU (seconds)
  PERF_CONDENSE_HTABLE,  // condensing hash table [removing empties] (seconds)
  PERF_RENDER,           // (seconds)
  PERF_UPLOAD_BRICKS,    // uploading bricks to GPU [tex updates] (seconds)
  PERF_END_RENDER, // invalid; end of render-based metrics
  PERF_END // invalid; used for sizing table.
};

/// interface for classes which can be queried in this way.
struct PerfQueryable {
  virtual double PerfQuery(enum PerfCounter) = 0;
};

#endif
/*
   For more information, please see: http://software.sci.utah.edu

   The MIT License

   Copyright (c) 2013 Interactive Visualization and Data Analysis Group

   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.
*/

Add generic perf counter definitions.

Add generic perf counter definitions.

git-svn-id: 0a20d38d1bcdb3210d244a647211d61b0aabf366@284 5b8196f7-c1c0-4be6-8b13-4feed349168d


/** @file
  GUID for PcAtChipsetPkg PCD Token Space

  Copyright (c) 2009, Intel Corporation
  All rights reserved. This program and the accompanying materials
  are licensed and made available under the terms and conditions of the BSD License
  which accompanies this distribution.  The full text of the license may be found at
  http://opensource.org/licenses/bsd-license.php

  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.

**/

#ifndef _PCATCHIPSET_TOKEN_SPACE_GUID_H_
#define _PCATCHIPSET_TOKEN_SPACE_GUID_H_

#define PCATCHIPSET_TOKEN_SPACE_GUID \
  { \
    0x326ae723, 0xae32, 0x4589, { 0x98, 0xb8, 0xca, 0xc2, 0x3c, 0xdc, 0xc1, 0xb1 } \
  }

extern EFI_GUID gPcAtChipsetPkgTokenSpaceGuid;

#endif

Add declaration header file for token space.

git-svn-id: 5648d1bec6962b0a6d1d1b40eba8cf5cdb62da3d@8781 6f19259b-4bc3-4df7-8a09-765794883524


#include <string.h>
#include "../../input.h"

int main(void)
{
    char before[64] = "-2+1";
    char after[64] = "(0-2.000000)+1";

    replace_minus(before);
    if (strcmp(before, after) == 0){
        return (0);
    }
    else {
        return (-1);
    }
}

#include <string.h>
#include "../../input.h"

int main(void)
{
    // a case removable
    char before1[64] = "-2+1";
    char after1[64] = "(0-2.000000)+1";
    replace_minus(before1);
    if (strcmp(before1, after1) != 0){
        return (-1);
    }

    // a case not removable
    char before2[64] = "3-2";
    char after2[64] = "3-2";
    replace_minus(before2);
    if (strcmp(before2, after2) != 0){
        return (-1);
    }

    return (0);
}

Add new test to remove_minus

Add new test to remove_minus


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

#include "core/RecyclerHeapMarkingContext.h"

// Class used to wrap a MarkContext so that calls to MarkObjects during IRecyclerVisitedObject::Trace
// can mark with the correct contextual template parameters
template<bool parallel>
class MarkContextWrapper : public IRecyclerHeapMarkingContext
{
public:
    MarkContextWrapper(MarkContext* context) : markContext(context) {}

    void __stdcall MarkObjects(void** objects, size_t count, void* parent) override
    {
        for (size_t i = 0; i < count; i++)
        {
            // We pass true for interior, since we expect a majority of the pointers being marked by
            // external objects to themselves be external (and thus candidates for interior pointers).
            markContext->Mark<parallel, /*interior*/true, /*doSpecialMark*/ false>(objects[i], parent);
        }
    }

private:
    // Should only be created on the stack
    void* operator new(size_t);
    MarkContext* markContext;
};

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

#include "Core/RecyclerHeapMarkingContext.h"

// Class used to wrap a MarkContext so that calls to MarkObjects during IRecyclerVisitedObject::Trace
// can mark with the correct contextual template parameters
template<bool parallel>
class MarkContextWrapper : public IRecyclerHeapMarkingContext
{
public:
    MarkContextWrapper(MarkContext* context) : markContext(context) {}

    void __stdcall MarkObjects(void** objects, size_t count, void* parent) override
    {
        for (size_t i = 0; i < count; i++)
        {
            // We pass true for interior, since we expect a majority of the pointers being marked by
            // external objects to themselves be external (and thus candidates for interior pointers).
            markContext->Mark<parallel, /*interior*/true, /*doSpecialMark*/ false>(objects[i], parent);
        }
    }

private:
    // Should only be created on the stack
    void* operator new(size_t);
    MarkContext* markContext;
};

Fix casing for relatively included header to fix Linux builds


#include "../src/mesh_obj.h"
#include <stdio.h>
#include <stdlib.h>

int main(int argc, char *args[]) {
    if(argc < 2) {
        printf("test_mesh test-mesh-name.obj\n");
        return 0;
    }
    // read mesh from standard input, push into obj parser
    Mesh *mesh = meshReadOBJ(args[1]);
    if(!mesh) {
        return 0;
    }

    unsigned numFloats = meshGetNumFloats(mesh);
    unsigned numVertices = meshGetNumVertices(mesh);

    float *buf = malloc(sizeof(float) * numFloats);
    meshPackVertices(mesh, buf);

    meshClose(mesh);
    return 0;
}

#include "../src/mesh_obj.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

int main(int argc, char *args[]) {
    if(argc < 2) {
        printf("usage: test_mesh filename.obj\n");
        printf("  pass - (a dash character) as filename to read from stdin\n");
        return 0;
    }
    Mesh *mesh;
    // read mesh from standard input or file, push into obj parser
    if(!strcmp("-", args[1])) {
        mesh = meshReadOBJF(stdin, "(stdin)");
    } else {
        mesh = meshReadOBJ(args[1]);
    }
    if(!mesh) {
        return 0;
    }
    unsigned numFloats   = meshGetNumFloats(mesh);
    unsigned numVertices = meshGetNumVertices(mesh);

    float *buf = malloc(sizeof(float) * numFloats);
    meshPackVertices(mesh, buf);
    meshClose(mesh);
    free(buf);
    return 0;
}

Make mesh loader actually read stdin

tests: Make mesh loader actually read stdin


#pragma once

#include <cuda.h>
#include "cuda/cudautil.h"

namespace idaten {
	void initCuda()
	{
		checkCudaErrors(cuInit(0));
	}
}

#pragma once

#include <cuda.h>
#include "cuda/cudautil.h"

namespace idaten {
	inline void initCuda()
	{
		checkCudaErrors(cuInit(0));
	}
}

Fix a bug that not inlined.

Fix a bug that not inlined.


// Protocol Buffers - Google's data interchange format
// Copyright 2012 Google Inc.  All rights reserved.
// http://code.google.com/p/protobuf/
//
// 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 Google Inc. 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.

// This file is an internal atomic implementation, use atomicops.h instead.

#ifndef GOOGLE_PROTOBUF_ATOMICOPS_INTERNALS_PNACL_H_
#define GOOGLE_PROTOBUF_ATOMICOPS_INTERNALS_PNACL_H_

namespace google {
namespace protobuf {
namespace internal {

inline Atomic32 NoBarrier_CompareAndSwap(volatile Atomic32* ptr,
                                         Atomic32 old_value,
                                         Atomic32 new_value) {
  return __sync_val_compare_and_swap(ptr, old_value, new_value);
}

inline void MemoryBarrier() {
  __sync_synchronize();
}

inline Atomic32 Acquire_CompareAndSwap(volatile Atomic32* ptr,
                                       Atomic32 old_value,
                                       Atomic32 new_value) {
  Atomic32 ret = NoBarrier_CompareAndSwap(ptr, old_value, new_value);
  MemoryBarrier();
  return ret;
}

inline void Release_Store(volatile Atomic32* ptr, Atomic32 value) {
  MemoryBarrier();
  *ptr = value;
}

inline Atomic32 Acquire_Load(volatile const Atomic32* ptr) {
  Atomic32 value = *ptr;
  MemoryBarrier();
  return value;
}

}  // namespace internal
}  // namespace protobuf
}  // namespace google

#endif  // GOOGLE_PROTOBUF_ATOMICOPS_INTERNALS_PNACL_H_

Add the missing PNaCl atomicops support.


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

#include "basic.h"
#include "tuntap_if.h"
#include "utils.h"

int main(int argc, char** argv) {
    int tun_fd;
    char buf[100];
    char *dev = calloc(10, 1);
    CLEAR(buf);
    tun_fd = tun_alloc(dev);

    if (set_if_up(dev) != 0) {
        printf("ERROR when setting up if\n");
    }

    if (set_if_address(dev, "10.0.0.5/24") != 0) {
        printf("ERROR when setting address for if\n");
    };

    if (set_if_route(dev, "10.0.0.0/24") != 0) {
        printf("ERROR when setting route for if\n");
    }

    read(tun_fd, buf, 100);

    print_hexdump(buf, 100);

    free(dev);
}

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

#include "basic.h"
#include "tuntap_if.h"
#include "utils.h"

int main(int argc, char** argv) {
    int tun_fd;
    char buf[100];
    char *dev = calloc(10, 1);
    CLEAR(buf);
    tun_fd = tun_alloc(dev);

    if (set_if_up(dev) != 0) {
        printf("ERROR when setting up if\n");
    }

    if (set_if_address(dev, "10.0.0.5/24") != 0) {
        printf("ERROR when setting address for if\n");
    };

    if (set_if_route(dev, "10.0.0.0/24") != 0) {
        printf("ERROR when setting route for if\n");
    }

    while (1) {
        read(tun_fd, buf, 100);

        print_hexdump(buf, 100);
    }

    free(dev);
}

Read from tun buffer and print hexdump in loop


//
//  SRDataModel.h
//  Sensorama
//
//  Created by Wojciech Adam Koszek (h) on 19/04/2016.
//  Copyright © 2016 Wojciech Adam Koszek. All rights reserved.
//

#import <Foundation/Foundation.h>
#import "Realm/Realm.h"

@interface SRDataPoint : RLMObject

@property NSNumber<RLMInt> *accX;
@property NSNumber<RLMInt> *accY;
@property NSNumber<RLMInt> *accZ;

@property NSNumber<RLMInt> *magX;
@property NSNumber<RLMInt> *magY;
@property NSNumber<RLMInt> *magZ;

@property NSNumber<RLMInt> *gyroX;
@property NSNumber<RLMInt> *gyroY;
@property NSNumber<RLMInt> *gyroZ;

@property NSInteger fileId;
@property NSInteger curTime;

@end

@interface SRDataFile : RLMObject

@property NSString *username;
@property NSString *desc;
/* need to do something about device_info */

@property NSInteger sampleInterval;
@property BOOL accEnabled;
@property BOOL magEnabled;
@property BOOL gyroEnabled;

@property NSDate *dateStart;
@property NSDate *dateEnd;
@property NSInteger fileId;

@end

//
//  SRDataModel.h
//  Sensorama
//
//  Created by Wojciech Adam Koszek (h) on 19/04/2016.
//  Copyright © 2016 Wojciech Adam Koszek. All rights reserved.
//

#import <Foundation/Foundation.h>
#import "Realm/Realm.h"

@interface SRDataPoint : RLMObject

@property NSNumber<RLMInt> *accX;
@property NSNumber<RLMInt> *accY;
@property NSNumber<RLMInt> *accZ;

@property NSNumber<RLMInt> *magX;
@property NSNumber<RLMInt> *magY;
@property NSNumber<RLMInt> *magZ;

@property NSNumber<RLMInt> *gyroX;
@property NSNumber<RLMInt> *gyroY;
@property NSNumber<RLMInt> *gyroZ;

@property NSInteger fileId;
@property NSInteger curTime;

@end

@interface SRDataFile : RLMObject

@property NSString *username;
@property NSString *desc;
@property NSString *timezone;
/* need to do something about device_info */

@property NSInteger sampleInterval;
@property BOOL accEnabled;
@property BOOL magEnabled;
@property BOOL gyroEnabled;

@property NSDate *dateStart;
@property NSDate *dateEnd;
@property NSInteger fileId;

@end

Add the timezone to the data model.

Add the timezone to the data model.


//===-- enable_execute_stack.c - Implement __enable_execute_stack ---------===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

#include <stdint.h>
#include <sys/mman.h>

//
// The compiler generates calls to __enable_execute_stack() when creating
// trampoline functions on the stack for use with nested functions.
// It is expected to mark the page(s) containing the address
// and the next 48 bytes as executable.  Since the stack is normally rw-
// that means changing the protection on those page(s) to rwx.
//
void __enable_execute_stack(void* addr)
{
#if __APPLE__
	// On Darwin, pagesize is always 4096 bytes
	const uintptr_t pageSize = 4096;
#else
        // FIXME: We should have a configure check for this.
        const uintptr_t pagesize = getpagesize();
#endif
	const uintptr_t pageAlignMask = ~(pageSize-1);
	uintptr_t p = (uintptr_t)addr;
	unsigned char* startPage = (unsigned char*)(p & pageAlignMask);
	unsigned char* endPage = (unsigned char*)((p+48+pageSize) & pageAlignMask);
	mprotect(startPage, endPage-startPage, PROT_READ | PROT_WRITE | PROT_EXEC);
}

//===-- enable_execute_stack.c - Implement __enable_execute_stack ---------===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

#include <stdint.h>
#include <sys/mman.h>
#ifndef __APPLE__
#include <unistd.h>
#endif

//
// The compiler generates calls to __enable_execute_stack() when creating
// trampoline functions on the stack for use with nested functions.
// It is expected to mark the page(s) containing the address
// and the next 48 bytes as executable.  Since the stack is normally rw-
// that means changing the protection on those page(s) to rwx.
//
void __enable_execute_stack(void* addr)
{
#if __APPLE__
	// On Darwin, pagesize is always 4096 bytes
	const uintptr_t pageSize = 4096;
#else
        // FIXME: We should have a configure check for this.
        const uintptr_t pageSize = getpagesize();
#endif
	const uintptr_t pageAlignMask = ~(pageSize-1);
	uintptr_t p = (uintptr_t)addr;
	unsigned char* startPage = (unsigned char*)(p & pageAlignMask);
	unsigned char* endPage = (unsigned char*)((p+48+pageSize) & pageAlignMask);
	mprotect(startPage, endPage-startPage, PROT_READ | PROT_WRITE | PROT_EXEC);
}

Add missing include for getpagesize, and fix a typo.

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


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

int g = 42; // matches write in t_fun
pthread_mutex_t A = PTHREAD_MUTEX_INITIALIZER;
pthread_mutex_t B = PTHREAD_MUTEX_INITIALIZER;

void *t_fun(void *arg) {
  // pthread_mutex_lock(&A);
  // pthread_mutex_lock(&B);
  // g = 42;
  // pthread_mutex_unlock(&B);
  // pthread_mutex_unlock(&A);
  return NULL;
}

int main(void) {
  int r, t;

  pthread_t id;
  pthread_create(&id, NULL, t_fun, NULL);

  pthread_mutex_lock(&A);
  pthread_mutex_lock(&B);
  if (r * r) {
    g = 17;
    pthread_mutex_unlock(&B); // publish to g#prot
    pthread_mutex_lock(&B);
  }
  // locally written g is only in one branch, g == g#prot should be forgotten!
  t = g;
  assert(t == 17); // UNKNOWN!
  pthread_mutex_unlock(&B);
  pthread_mutex_unlock(&A);
  return 0;
}

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

int g = 42; // matches write in t_fun
pthread_mutex_t A = PTHREAD_MUTEX_INITIALIZER;
pthread_mutex_t B = PTHREAD_MUTEX_INITIALIZER;

void *t_fun(void *arg) {
  pthread_mutex_lock(&A);
  pthread_mutex_lock(&B);
  g = 42;
  pthread_mutex_unlock(&B);
  pthread_mutex_unlock(&A);
  return NULL;
}

int main(void) {
  int r, t;

  pthread_t id;
  pthread_create(&id, NULL, t_fun, NULL);

  pthread_mutex_lock(&A);
  pthread_mutex_lock(&B);
  if (r) {
    g = 17;
    pthread_mutex_unlock(&B); // publish to g#prot
    pthread_mutex_lock(&B);
  }
  // locally written g is only in one branch, g == g#prot should be forgotten!
  t = g;
  assert(t == 17); // UNKNOWN!
  pthread_mutex_unlock(&B);
  pthread_mutex_unlock(&A);
  return 0;
}

Remove debugging changes from 36/17

Remove debugging changes from 36/17


#ifndef __INCLUDED_6FCA43F2953F11E6AA6EA088B4D1658C
#define __INCLUDED_6FCA43F2953F11E6AA6EA088B4D1658C

#include <RTypes.h>

class REvent
{
public:
  REvent();

  virtual
  ~REvent();

  void
  accept();

  void
  ignore();

  bool
  isAccepted() const;

  void
  setAccepted(bool accepted);

  virtual rcount
  type() const;
  static rcount
  registerEventType();

private:
  bool mIsAccepted;
};

/**
 * An easy wrapper template for generate type() method and provide auto
 * registered static type variable. So that you could focus on the
 * implementation of event class.
 */
template <class DerivedType, class BaseType>
class TypeRegisteredEvent : public BaseType
{
public:
  rcount
  type() const
  {
    return sType;
  }

  static inline rcount
  staticType()
  {
    return sType;
  }

private:
  static const rcount sType;
};

template <class DerivedType, class BaseType>
const rcount TypeRegisteredEvent<DerivedType,
                                 BaseType>::sType = REvent::registerEventType();

#endif // __INCLUDED_6FCA43F2953F11E6AA6EA088B4D1658C

#ifndef __INCLUDED_6FCA43F2953F11E6AA6EA088B4D1658C
#define __INCLUDED_6FCA43F2953F11E6AA6EA088B4D1658C

#include <RTypes.h>

class REvent
{
public:
  REvent();

  virtual
  ~REvent();

  void
  accept();

  void
  ignore();

  bool
  isAccepted() const;

  void
  setAccepted(bool accepted);

  virtual rcount
  type() const;
  static rcount
  registerEventType();

private:
  bool mIsAccepted;
};

/**
 * An easy wrapper template for generate type() method and provide auto
 * registered static type variable. So that you could focus on the
 * implementation of event class.
 */
template <class DerivedType, class BaseType = REvent>
class TypeRegisteredEvent : public BaseType
{
public:
  // Inherit all constructors
  template <class ... ParamTypes>
  TypeRegisteredEvent(ParamTypes ... params)
    : BaseType(params ...)
  {
  }

  rcount
  type() const
  {
    return sType;
  }

  static inline rcount
  staticType()
  {
    return sType;
  }

private:
  static const rcount sType;
};

template <class DerivedType, class BaseType>
const rcount TypeRegisteredEvent<DerivedType,
                                 BaseType>::sType = REvent::registerEventType();

#endif // __INCLUDED_6FCA43F2953F11E6AA6EA088B4D1658C

Support inhert constructors from BaseType


/*
 * 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 <stdint.h>
#include "native_client/src/trusted/service_runtime/sel_util.h"

uint32_t NaClGetStackPtr(void) {
  uint32_t sp;

  asm("mov %0, %%sp" : "=r" (sp));

  return sp;
}

/*
 * 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 <stdint.h>
#include "native_client/src/trusted/service_runtime/sel_util.h"

uint32_t NaClGetStackPtr(void) {
  uint32_t sp;

  asm("mov %0, sp" : "=r" (sp));

  return sp;
}

arm: Make sel build with clang's built-in assembler.

clang's integrated assembler only supports UAL, where sp is spelled
sp and not %sp. Fixes the following error when building with clang's
integrated assembler enabled:

../../native_client/src/trusted/service_runtime/linux/arm/sel_segments.c:13:7: error: unexpected token in operand
  asm("mov %0, %%sp" : "=r" (sp));
      ^
<inline asm>:1:10: note: instantiated into assembly here
        mov r0, %sp
                ^
1 error generated.

BUG=chromium:124610

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


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

#include "src/headers.h"

int main()
{
    char* taskfilepath = "D:\\zz_exp\\testinggrounds\\tasks.txt";
    task_list* list = gettasks(taskfilepath);

    task_list* traveller = list;
    while ( traveller != NULL ) {
        task_t* task = traveller -> task;
        result_t* result = deliver(task);
        printf("MESSAGE: %s\n", result -> message);
        traveller = traveller -> next;
    }

    return 0;
}

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

#include "src/headers.h"

int main(int argc, char** argv)
{
    for ( int x = 0; x < argc; x++ ) {
        char* taskfilepath = argv[x];
        task_list* list = gettasks(taskfilepath);

        task_list* traveller = list;
        while ( traveller != NULL ) {
            task_t* task = traveller -> task;
            result_t* result = deliver(task);
            printf("MESSAGE: %s\n", result -> message);
            traveller = traveller -> next;
        }
    }
    return 0;
}

v2.0.1: Allow user to indicate filepaths of taskfiles

User can now usee multiple taskfiles and specify via arguments the
location of taskfiles to be used


/*  =========================================================================
    hello_zproto_selftest - run self tests

    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.
    =========================================================================
*/

#include "../include/hello_zproto.h"

int main (int argc, char *argv [])
{
    bool verbose;
    if (argc == 2 && streq (argv [1], "-v"))
        verbose = true;
    else
        verbose = false;

    printf ("Running self tests...\n");
    hello_zproto_msg_test (verbose);
    citizen_msg_test (verbose);
    printf ("Tests passed OK\n");
    return 0;
}

/*  =========================================================================
    hello_zproto_selftest - run self tests

    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.
    =========================================================================
*/

#include "../include/hello_zproto.h"

int main (int argc, char *argv [])
{
    bool verbose;
    if (argc == 2 && streq (argv [1], "-v"))
        verbose = true;
    else
        verbose = false;

    printf ("Running self tests...\n");
    hello_zproto_msg_test (verbose);
    citizen_msg_test (verbose);
    citizen_server_test (verbose);
    printf ("Tests passed OK\n");
    return 0;
}

Add citizen_server self test to overall self test


/*
 * This file is part of Kotaka, a mud library for DGD
 * http://github.com/shentino/kotaka
 *
 * Copyright (C) 2012  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 <kotaka/paths.h>
#include <text/paths.h>

inherit LIB_RAWVERB;

void main(object actor, string args)
{
	object user;

	user = query_user();

	if (user->query_class() < 3) {
		send_out("You do not have sufficient access rights to check for bigstruct orphans.\n");
		return;
	}

	"~Bigstruct/sys/bigstructd"->find_orphaned_nodes();
	"~Bigstruct/sys/bigstructd"->find_orphaned_roots();
}

Add command to clean up orphaned bigstruct objects


#include <stdio.h>

int _findLower(int *vector, int lastIndex, int lowerUntilNow){
		if (lastIndex == 0) {
		return lowerUntilNow;
	} else{
		int current = vector[--lastIndex];
		lowerUntilNow = (lowerUntilNow < current) ? lowerUntilNow : current;
		return _findLower(vector, lastIndex, lowerUntilNow);
	}
}

int findLower(int *vector, int size){
	int lastValue = vector[size-1];
	return _findLower(vector, size, lastValue);
}

int main(){
	int vector[] = {10, 5, 2, -9, 8, 4, 9};
	printf("%d\n", findLower(vector, 7));
	return 0;
}

Create q6: lower by recursion

Create q6: lower by recursion


/*
  This file is part of the Grantlee template system.

  Copyright (c) 2010 Stephen Kelly <steveire@gmail.com>

  This library is free software; you can redistribute it and/or
  modify it under the terms of the GNU Lesser General Public
  License version 3 only, as published by the Free Software Foundation.

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

  You should have received a copy of the GNU Lesser General Public
  License along with this library.  If not, see <http://www.gnu.org/licenses/>.

*/

#ifndef GRANTLEE_GUI_EXPORT_H
#define GRANTLEE_GUI_EXPORT_H

#if defined(_WIN32) || defined(_WIN64)
#  ifndef GRANTLEE_GUI_EXPORT
#    if defined(GRANTLEE_GUI_LIB_MAKEDLL)
#      define GRANTLEE_GUI_EXPORT __declspec(dllexport)
#    else
#      define GRANTLEE_GUI_EXPORT __declspec(dllimport)
#    endif
#  endif
#else
#  define GRANTLEE_GUI_EXPORT __attribute__((visibility("default")))
#endif

#endif

/*
  This file is part of the Grantlee template system.

  Copyright (c) 2010 Stephen Kelly <steveire@gmail.com>

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

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

  You should have received a copy of the GNU Lesser General Public
  License along with this library.  If not, see <http://www.gnu.org/licenses/>.

*/

#ifndef GRANTLEE_GUI_EXPORT_H
#define GRANTLEE_GUI_EXPORT_H

#if defined(_WIN32) || defined(_WIN64)
#  ifndef GRANTLEE_GUI_EXPORT
#    if defined(GRANTLEE_GUI_LIB_MAKEDLL)
#      define GRANTLEE_GUI_EXPORT __declspec(dllexport)
#    else
#      define GRANTLEE_GUI_EXPORT __declspec(dllimport)
#    endif
#  endif
#else
#  define GRANTLEE_GUI_EXPORT __attribute__((visibility("default")))
#endif

#endif

Fix license header in the export header.


//===-- AMDGPUCodeEmitter.h - AMDGPU Code Emitter interface -----------------===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
//
/// \file
/// \brief CodeEmitter interface for R600 and SI codegen.
//
//===----------------------------------------------------------------------===//

#ifndef AMDGPUCODEEMITTER_H
#define AMDGPUCODEEMITTER_H

#include "llvm/MC/MCCodeEmitter.h"
#include "llvm/Support/raw_ostream.h"

namespace llvm {

class MCInst;
class MCOperand;
class MCSubtargetInfo;

class AMDGPUMCCodeEmitter : public MCCodeEmitter {
  virtual void anchor();
public:

  uint64_t getBinaryCodeForInstr(const MCInst &MI,
                                 SmallVectorImpl<MCFixup> &Fixups,
                                 const MCSubtargetInfo &STI) const;

  virtual uint64_t getMachineOpValue(const MCInst &MI, const MCOperand &MO,
                                     SmallVectorImpl<MCFixup> &Fixups,
                                     const MCSubtargetInfo &STI) const {
    return 0;
  }
};

} // End namespace llvm

#endif // AMDGPUCODEEMITTER_H

//===-- AMDGPUCodeEmitter.h - AMDGPU Code Emitter interface -----*- C++ -*-===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
//
/// \file
/// \brief CodeEmitter interface for R600 and SI codegen.
//
//===----------------------------------------------------------------------===//

#ifndef AMDGPUCODEEMITTER_H
#define AMDGPUCODEEMITTER_H

#include "llvm/MC/MCCodeEmitter.h"
#include "llvm/Support/raw_ostream.h"

namespace llvm {

class MCInst;
class MCOperand;
class MCSubtargetInfo;

class AMDGPUMCCodeEmitter : public MCCodeEmitter {
  virtual void anchor();
public:

  uint64_t getBinaryCodeForInstr(const MCInst &MI,
                                 SmallVectorImpl<MCFixup> &Fixups,
                                 const MCSubtargetInfo &STI) const;

  virtual uint64_t getMachineOpValue(const MCInst &MI, const MCOperand &MO,
                                     SmallVectorImpl<MCFixup> &Fixups,
                                     const MCSubtargetInfo &STI) const {
    return 0;
  }
};

} // End namespace llvm

#endif // AMDGPUCODEEMITTER_H

Fix missing C++ mode comment

Fix missing C++ mode comment

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


/*
 * Licensed to the Apache Software Foundation (ASF) under one
 * or more contributor license agreements.  See the NOTICE file
 * distributed with this work for additional information
 * regarding copyright ownership.  The ASF licenses this file
 * to you under the Apache License, Version 2.0 (the
 * "License"); you may not use this file except in compliance
 * with the License.  You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing,
 * software distributed under the License is distributed on an
 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 * KIND, either express or implied.  See the License for the
 * specific language governing permissions and limitations
 * under the License.
 */

#include "config.h"

#include "winpr-stream.h"
#include "winpr-wtypes.h"

/*
 * NOTE: Because the old API did not support local allocation of the buffer
 *       for each stream, these compatibility implementations ignore
 *       the parameters of Stream_New() and Stream_Free() that provide them.
 */

wStream* Stream_New(BYTE* buffer, size_t size) {
    return stream_new(size);
}

void Stream_Free(wStream* s, BOOL bFreeBuffer) {
    stream_free(s);
}

/*
 * Licensed to the Apache Software Foundation (ASF) under one
 * or more contributor license agreements.  See the NOTICE file
 * distributed with this work for additional information
 * regarding copyright ownership.  The ASF licenses this file
 * to you under the Apache License, Version 2.0 (the
 * "License"); you may not use this file except in compliance
 * with the License.  You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing,
 * software distributed under the License is distributed on an
 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 * KIND, either express or implied.  See the License for the
 * specific language governing permissions and limitations
 * under the License.
 */

#include "config.h"

#include "winpr-stream.h"
#include "winpr-wtypes.h"

wStream* Stream_New(BYTE* buffer, size_t size) {

    /* If no buffer is provided, allocate a new stream of the given size */
    if (buffer == NULL)
       return stream_new(size);

    /* Otherwise allocate an empty stream and assign the given buffer */
    wStream* stream = stream_new(0);
    stream_attach(stream, buffer, size);
    return stream;

}

void Stream_Free(wStream* s, BOOL bFreeBuffer) {

    /* Disassociate buffer if it will be freed externally */
    if (!bFreeBuffer)
        stream_detach(s);

    stream_free(s);

}

GUACAMOLE-25: Implement buffer attachment in Stream_New() and Stream_Free() compatibility functions.


#include <stdlib.h>

#include <mqtt3.h>

mqtt3_context *mqtt3_context_init(int sock)
{
	mqtt3_context *context;

	context = malloc(sizeof(mqtt3_context));
	if(!context) return NULL;

	context->next = NULL;
	context->sock = sock;
	context->last_msg_in = time(NULL);
	context->last_msg_out = time(NULL);
	context->keepalive = 60; /* Default to 60s */
	context->last_mid = 0;
	context->id = NULL;
	context->messages = NULL;

	return context;
}

void mqtt3_context_cleanup(mqtt3_context *context)
{
	if(!context) return;

	if(context->sock != -1){
		mqtt3_socket_close(context);
	}
	if(context->id) free(context->id);
	/* FIXME - clean messages and subscriptions */
	free(context);
}

#include <stdlib.h>

#include <mqtt3.h>

mqtt3_context *mqtt3_context_init(int sock)
{
	mqtt3_context *context;

	context = malloc(sizeof(mqtt3_context));
	if(!context) return NULL;

	context->next = NULL;
	context->sock = sock;
	context->last_msg_in = time(NULL);
	context->last_msg_out = time(NULL);
	context->keepalive = 60; /* Default to 60s */
	context->last_mid = 0;
	context->id = NULL;
	context->messages = NULL;

	return context;
}

void mqtt3_context_cleanup(mqtt3_context *context)
{
	if(!context) return;

	if(context->sock != -1){
		mqtt3_socket_close(context);
	}
	if(context->clean_start){
		mqtt3_db_subs_clean_start(context);
		mqtt3_db_client_delete(context);
	}
	if(context->id) free(context->id);
	/* FIXME - clean messages and subscriptions */
	free(context);
}

Delete client info / subscription info on disconnect for clean_start == true.


// PARAM: --enable kernel
#include <linux/module.h>
#include <linux/mutex.h>
#include <linux/init.h>
#include <linux/device.h>
#include <linux/compat.h>

struct ipmi_file_private
{
    struct file *file;
};

static DEFINE_MUTEX(ipmi_mutex);

static int ipmi_open(struct inode *inode, struct file *file)
{
    struct ipmi_file_private *priv;
    priv = kmalloc(sizeof(*priv), GFP_KERNEL);
    mutex_lock(&ipmi_mutex);
    priv->file = file; // should reach fixpoint from priv side effect from here
    return 0;
}

static const struct file_operations ipmi_fops = {
    .open = ipmi_open,
};

static int __init init_ipmi_devintf(void)
{
    register_chrdev(0, "ipmidev", &ipmi_fops);
    return 0;
}
module_init(init_ipmi_devintf);

Add minimized bench ipmi_devintf fixpoint error test

Incomparability between struct and blob in side effect.


Reset motor encoders in pre_auton

Reset motor encoders in pre_auton


#ifndef ENGINE_RENDER_RENDERSYSTEM_H
#define ENGINE_RENDER_RENDERSYSTEM_H

#include "engine/scene/SceneSystem.h"
#include "engine/UI/UISystem.h"

#include "engine/math/vec3.h"

namespace engine {
namespace render {

	/**
	 * RenderSystem is a parent class for the actual rendering systems.
	 *
	 * RenderSystem gets pointers to the sceneSystem and uiSystem and will build the visuals from that.
	 */
	class RenderSystem : public EngineSystem {
	protected:
		vec3 cameraPos;
	public:
		~RenderSystem() {};

		vec3 getCameraPos(){
			return cameraPos;
		}

		void setCameraPos(vec3 pos){
			cameraPos = pos;
		}
	};

}
}

#endif

#ifndef ENGINE_RENDER_RENDERSYSTEM_H
#define ENGINE_RENDER_RENDERSYSTEM_H

#include "engine/scene/SceneSystem.h"
#include "engine/UI/UISystem.h"

#include "engine/math/vec3.h"

namespace engine {
namespace render {

	/**
	 * RenderSystem is a parent class for the actual rendering systems.
	 *
	 * RenderSystem gets pointers to the sceneSystem and uiSystem and will build the visuals from that.
	 */
	class RenderSystem : public EngineSystem {
	protected:
		vec3 cameraPos;
	public:
		~RenderSystem() {};

		vec3 getCameraPos(){
			return cameraPos;
		}

		void setCameraPos(vec3 pos){
			cameraPos = pos;
		}

		virtual void uninit() = 0;
		virtual void update() = 0;

	};

}
}

#endif

Update is an abstract base function.

Update is an abstract base function.


/*==================================================================*
 |		dfltsys.h
 |	Copyright (c) 1995, Applied Logic Systems, Inc.
 |
 |		-- Default system settings for property tags
 |
 |	Author: Ken Bowen
 |	Date: 04/10/95
 *==================================================================*/

#define BCINTER		1
#define LIBBRK		1
#define SYS_OBP		1
#define HASH		1
#define GENSYM		1
#define OSACCESS	1
#define REXEC		1
#define WINIOBASIS	1
#define XPANDTM		1
#define FSACCESS	1

#define OLDLEXAN	1
#define OLDFIO		1
#define OLDCIO		1

#define OLDCLOAD	1

#define PRIM_DBG	1

#undef OLDCONSULT

#define FREEZE 0

/*==================================================================*
 |		dfltsys.h
 |	Copyright (c) 1995, Applied Logic Systems, Inc.
 |
 |		-- Default system settings for property tags
 |
 |	Author: Ken Bowen
 |	Date: 04/10/95
 *==================================================================*/

#define BCINTER		1
#define LIBBRK		1
#define SYS_OBP		1
#define HASH		1
#define GENSYM		1
#define OSACCESS	1
#define REXEC		1
#define WINIOBASIS	1
#define XPANDTM		1
#define FSACCESS	1

#define OLDLEXAN	1
#define OLDFIO		1
#define OLDCIO		1

#define OLDCLOAD	1

#define PRIM_DBG	1

#undef OLDCONSULT

#define FREEZE	1

Reset FREEZE to 1 to avoid confusion

Reset FREEZE to 1 to avoid confusion

Back in 1998, there was clearly confusion about #if vs #ifdef when FREEZE got set to 0, which is a no-op because FREEZE is always used with #ifdef. Offending commit: 62f68f19fc8f64b7e3003001ee2710d0c90e2554


// RUN: %clang_cc1 -std=c11 %s -verify

typedef int type;
typedef type type;
typedef int type;

void f(int N) {
  typedef int type2;
  typedef type type2;
  typedef int type2;

  typedef int vla[N]; // expected-note{{previous definition is here}}
  typedef int vla[N]; // expected-error{{redefinition of typedef for variably-modified type 'int [N]'}}
}

// RUN: %clang_cc1 -std=c11 %s -verify

typedef int type;
typedef type type;
typedef int type;

void f(int N) {
  typedef int type2;
  typedef type type2;
  typedef int type2;

  typedef int vla[N]; // expected-note{{previous definition is here}}
  typedef int vla[N]; // expected-error{{redefinition of typedef for variably-modified type 'int [N]'}}

  typedef int vla2[N];
  typedef vla2 vla3; // expected-note{{previous definition is here}}
  typedef vla2 vla3; // expected-error{{redefinition of typedef for variably-modified type 'vla2' (aka 'int [N]')}}
}

Extend test-case as requested by Eli

Extend test-case as requested by Eli

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


/**************************************************************************/
/*                                                                        */
/*                                OCaml                                   */
/*                                                                        */
/*                  Jeremie Dimino, Jane Street Europe                    */
/*                                                                        */
/*   Copyright 2015 Institut National de Recherche en Informatique et     */
/*     en Automatique.                                                    */
/*                                                                        */
/*   All rights reserved.  This file is distributed under the terms of    */
/*   the GNU Lesser General Public License version 2.1, with the          */
/*   special exception on linking described in the file LICENSE.          */
/*                                                                        */
/**************************************************************************/

#include <caml/mlvalues.h>
#include <bigarray.h>

char *ocaml_buffer;
char *c_buffer;

value test_set_buffers(value v_ocaml_buffer, value v_c_buffer)
{
  ocaml_buffer = Caml_ba_data_val(v_ocaml_buffer);
  c_buffer = Caml_ba_data_val(v_c_buffer);
  return Val_unit;
}

value test_cleanup_normal(void)
{
  return Val_int(0);
}

double test_cleanup_float(void)
{
  return 0.;
}

/**************************************************************************/
/*                                                                        */
/*                                OCaml                                   */
/*                                                                        */
/*                  Jeremie Dimino, Jane Street Europe                    */
/*                                                                        */
/*   Copyright 2015 Institut National de Recherche en Informatique et     */
/*     en Automatique.                                                    */
/*                                                                        */
/*   All rights reserved.  This file is distributed under the terms of    */
/*   the GNU Lesser General Public License version 2.1, with the          */
/*   special exception on linking described in the file LICENSE.          */
/*                                                                        */
/**************************************************************************/

#include <caml/mlvalues.h>
#include <caml/bigarray.h>

char *ocaml_buffer;
char *c_buffer;

value test_set_buffers(value v_ocaml_buffer, value v_c_buffer)
{
  ocaml_buffer = Caml_ba_data_val(v_ocaml_buffer);
  c_buffer = Caml_ba_data_val(v_c_buffer);
  return Val_unit;
}

value test_cleanup_normal(void)
{
  return Val_int(0);
}

double test_cleanup_float(void)
{
  return 0.;
}

Update tests/unboxed-primitive-args: bigarray.h is now in caml/


#include "legato.h"
#include "interfaces.h"
#include "mcp970x.h"

static int WpAdcFunction(int32_t *valueUv)
{
    return le_adc_ReadValue("EXT_ADC0", valueUv);
}

le_result_t mangOH_ambientTemperature_Read(double *temperature)
{
    int32_t tempInt;
    int res = mcp970x_read_temperature(MCP970X_CHIP_9700A, WpAdcFunction, &tempInt);
    if (res != 0)
    {
        return LE_FAULT;
    }

    *temperature = tempInt / 1000.0;
    return LE_OK;
}

COMPONENT_INIT
{
}

#include "legato.h"
#include "interfaces.h"
#include "mcp970x.h"

static int WpAdcFunction(int32_t *valueUv)
{
    int32_t valueMv;
    le_result_t res = le_adc_ReadValue("EXT_ADC0", &valueMv);
    if (res == LE_OK)
    {
        *valueUv = valueMv * 1000;
    }

    LE_DEBUG("Read %d uV from the ADC during ambient temperature measurement", *valueUv);

    return res;
}

le_result_t mangOH_ambientTemperature_Read(double *temperature)
{
    int32_t tempInt;
    int res = mcp970x_read_temperature(MCP970X_CHIP_9700A, WpAdcFunction, &tempInt);
    if (res != 0)
    {
        return LE_FAULT;
    }

    *temperature = tempInt / 1000.0;
    LE_DEBUG("Read ambient temperature %f C", *temperature);
    return LE_OK;
}

COMPONENT_INIT
{
}

Add in some logs for the MCP9700A

Add in some logs for the MCP9700A

The temperatures being read back are higher than expected.  Add some
logs until the issue is resolved.


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

#include <gibber/gibber-xmpp-node.h>

#include <check.h>

START_TEST (test_instantiation)
{
  GibberXmppNode *node;
  node = gibber_xmpp_node_new ("test");
  fail_unless (node != NULL);
}
END_TEST

TCase *
make_gibber_xmpp_node_tcase (void)
{
    TCase *tc = tcase_create ("XMPP Node");
    tcase_add_test (tc, test_instantiation);
    return tc;
}

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

#include <gibber/gibber-xmpp-node.h>

#include <check.h>

START_TEST (test_instantiation)
{
  GibberXmppNode *node;
  node = gibber_xmpp_node_new ("test");
  fail_unless (node != NULL);

  node = gibber_xmpp_node_new (NULL);
  fail_unless (node != NULL);
}
END_TEST

START_TEST (test_language)
{
  GibberXmppNode *node;
  const gchar *lang;

  node = gibber_xmpp_node_new ("test");
  lang = gibber_xmpp_node_get_language (node);
  fail_unless (lang == NULL);

  gibber_xmpp_node_set_language (node, "us");
  lang = gibber_xmpp_node_get_language (node);
  fail_unless (strcmp(lang, "us") == 0);
}
END_TEST

TCase *
make_gibber_xmpp_node_tcase (void)
{
    TCase *tc = tcase_create ("XMPP Node");
    tcase_add_test (tc, test_instantiation);
    tcase_add_test (tc, test_language);
    return tc;
}

Test gibber_xmpp_node_[gs]et_language() and node creation with a NULL name

20070609084741-f974e-602d6f3a4ba28432895c80518d5ea7daa5c85389.gz


/*
 * Copyright (C) 2009 Apple Inc. All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 * 1. Redistributions of source code must retain the above copyright
 *    notice, this list of conditions and the following disclaimer.
 * 2. Redistributions in binary form must reproduce the above copyright
 *    notice, this list of conditions and the following disclaimer in the
 *    documentation and/or other materials provided with the distribution.
 *
 * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``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 APPLE INC. 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 FontSmoothingMode_h
#define FontSmoothingMode_h

namespace WebCore {

    enum FontSmoothingMode { AutoSmoothing, NoSmoothing, Antialiased, SubpixelAntialiased };

} // namespace WebCore

#endif // FontSmoothingMode_h

Add file that was missing from the last change

git-svn-id: bf5cd6ccde378db821296732a091cfbcf5285fbd@48475 bbb929c8-8fbe-4397-9dbb-9b2b20218538


#ifndef _JAPLAY_H_
#define _JAPLAY_H_

#include <stdbool.h> /* bool */

struct song;
struct playlist_entry;
struct playlist;

struct playlist_entry *get_cursor(void);

extern struct playlist *japlay_queue, *japlay_history;

int get_song_info(struct song *song);

struct playlist_entry *add_file_playlist(struct playlist *playlist,
					 const char *filename);
int add_dir_or_file_playlist(struct playlist *playlist, const char *path);

int load_playlist(struct playlist *playlist, const char *filename);

void japlay_play(void);
void japlay_set_autovol(bool enabled);
void japlay_seek_relative(long msecs);
void japlay_seek(long msecs);
void japlay_stop(void);
void japlay_pause(void);
void japlay_skip(void);

int japlay_init(int *argc, char **argv);
void japlay_exit(void);

#endif

#ifndef _JAPLAY_H_
#define _JAPLAY_H_

#include <stdbool.h> /* bool */

struct song;
struct playlist_entry;
struct playlist;

struct playlist_entry *get_cursor(void);

extern struct playlist *japlay_queue, *japlay_history;

int get_song_info(struct song *song);

struct playlist_entry *add_file_playlist(struct playlist *playlist,
					 const char *filename);
int add_dir_or_file_playlist(struct playlist *playlist, const char *path);

int load_playlist(struct playlist *playlist, const char *filename);

void start_playlist_scan(void);

void japlay_play(void);
void japlay_set_autovol(bool enabled);
void japlay_seek_relative(long msecs);
void japlay_seek(long msecs);
void japlay_stop(void);
void japlay_pause(void);
void japlay_skip(void);

int japlay_init(int *argc, char **argv);
void japlay_exit(void);

#endif

Add missing declaration for start_playlist_scan() [CORRECTIVE]


#ifndef AT_OS_DEFS_H
#define AT_OS_DEFS_H

// Include the window files if this is the windows version.
#ifdef _MSC_VER
    #include <windows.h>
#endif

// Include other files to give OS-independent interfaces
#include "atSleep.h"
#include "atStrCaseCmp.h"
#include "atSymbols.h"
#include "atTime.h"

#endif

#ifndef AT_OS_DEFS_H
#define AT_OS_DEFS_H

// Include the window files if this is the windows version.
#ifdef _MSC_VER
    #include <windows.h>
#endif

// Include other files to give OS-independent interfaces
#include "atSleep.h"
#include "atStr.h"
#include "atSymbols.h"
#include "atTime.h"

#endif

Change to new name atStr.h.

Change to new name atStr.h.


#include <cgreen/cgreen.h>
#include <cgreen/mocks.h>

static int reader(void *stream) {
    return (int)mock(stream);
}

static void writer(void *stream, char *paragraph) {
    mock(stream, paragraph);
}

char *read_paragraph(int (*read)(void *), void *stream);

void by_paragraph(int (*read)(void *), void *in, void (*write)(void *, char *), void *out) {
    while (1) {
        char *line = read_paragraph(read, in);
        if ((line == NULL) || (strlen(line) == 0)) {
            return;
        }
        (*write)(out, line);
        free(line);
    }
}

static int stub_stream(void *stream) {
    return (int)mock(stream);
}

static void update_counter(void * counter) {
    *(int*)counter = *(int*)counter + 1;
}

Ensure(using_side_effect) {
    int number_of_times_reader_was_called = 0;
    expect(reader, will_return('\n'));
    always_expect(reader,
                  will_return(EOF),
                  with_side_effect(&update_counter,
                                  &number_of_times_reader_was_called));
    expect_never(writer);
    by_paragraph(&reader, NULL, &writer, NULL);

    assert_that(number_of_times_reader_was_called, is_equal_to(1));
}

#include <cgreen/cgreen.h>
#include <cgreen/mocks.h>

static int reader(void *stream) {
    return (int)mock(stream);
}

static void writer(void *stream, char *paragraph) {
    mock(stream, paragraph);
}

char *read_paragraph(int (*read)(void *), void *stream);

void by_paragraph(int (*read)(void *), void *in, void (*write)(void *, char *), void *out) {
    while (1) {
        char *line = read_paragraph(read, in);
        if ((line == NULL) || (strlen(line) == 0)) {
            return;
        }
        (*write)(out, line);
        free(line);
    }
}

static int stub_stream(void *stream) {
    return (int)mock(stream);
}

static void update_counter(void * counter) {
    *(int*)counter = *(int*)counter + 1;
}

Ensure(using_side_effect) {
    int number_of_times_reader_was_called = 0;
    expect(reader, will_return('\n'));
    always_expect(reader,
                  will_return(EOF),
                  with_side_effect(&update_counter,
                                  &number_of_times_reader_was_called));
    never_expect(writer);
    by_paragraph(&reader, NULL, &writer, NULL);

    assert_that(number_of_times_reader_was_called, is_equal_to(1));
}

[doc] Update expect_never -> never_expect in doc

The file of side_effect.c in the tutorial used the old version of
`never_expect` function. This commit updates the side-effect file to
have the new version of the function.


/*
 * Copyright (C) 2017 The Android Open Source Project
 *
 * 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 INCLUDE_PERFETTO_PROTOZERO_CONTIGUOUS_MEMORY_RANGE_H_
#define INCLUDE_PERFETTO_PROTOZERO_CONTIGUOUS_MEMORY_RANGE_H_

#include <assert.h>
#include <stddef.h>
#include <stdint.h>

namespace protozero {

// Keep this struct trivially constructible (no ctors, no default initializers).
struct ContiguousMemoryRange {
  uint8_t* begin;
  uint8_t* end;  // STL style: one byte past the end of the buffer.

  inline bool is_valid() const { return begin != nullptr; }
  inline void reset() { begin = nullptr; }
  inline size_t size() { return static_cast<size_t>(end - begin); }
};

}  // namespace protozero

#endif  // INCLUDE_PERFETTO_PROTOZERO_CONTIGUOUS_MEMORY_RANGE_H_

/*
 * Copyright (C) 2017 The Android Open Source Project
 *
 * 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 INCLUDE_PERFETTO_PROTOZERO_CONTIGUOUS_MEMORY_RANGE_H_
#define INCLUDE_PERFETTO_PROTOZERO_CONTIGUOUS_MEMORY_RANGE_H_

#include <assert.h>
#include <stddef.h>
#include <stdint.h>

namespace protozero {

// Keep this struct trivially constructible (no ctors, no default initializers).
struct ContiguousMemoryRange {
  uint8_t* begin;
  uint8_t* end;  // STL style: one byte past the end of the buffer.

  inline bool is_valid() const { return begin != nullptr; }
  inline void reset() { begin = nullptr; }
  inline size_t size() const { return static_cast<size_t>(end - begin); }
};

}  // namespace protozero

#endif  // INCLUDE_PERFETTO_PROTOZERO_CONTIGUOUS_MEMORY_RANGE_H_

Mark ContiguousMemoryRange::size as const. am: f2c28cd765 am: 1b5ab79b0b am: 69614c4761 am: e447d8a1c2 am: b0149a850e

Change-Id: If4c99f80ffc05a66167073f15cf83e73e7329f4b


#ifndef OI_H
#define OI_H

#include "WPILib.h"
#include "RobotMap.h"
#include <math.h>

class OI
{
private:
	Joystick Joystick;

public:
	OI();
	inline float GetStickX(){ return FractionOmitted(Joystick.GetX()); }
	inline float GetStickY(){ return FractionOmitted(Joystick.GetY()); }
	inline float GetStickZ(){ return FractionOmitted(Joystick.GetZ()); }

	inline float FractionOmitted(float original){
		if(fabsf(original) < 0.01 ){
			original = 0;
		}
		return original;
	}
};

#endif

#ifndef OI_H
#define OI_H

#include "WPILib.h"
#include "RobotMap.h"
#include <math.h>

class OI
{
private:
	Joystick Joystick;

public:
	OI();
	inline float GetXplusY(){
		float val;
		val = FractionOmitted(Joystick.GetY() + Joystick.GetX());
		if(val > 1.2) val = 1.2;
		if(val < -1.2) val = -1.2;
		return val;
	}
	inline float GetXminusY(){
		float val;
		val = FractionOmitted(Joystick.GetY() - Joystick.GetX());
		if(val > 1.2) val = 1.2;
		if(val < -1.2) val = -1.2;
		return val;
	}

	inline float GetStickX(){ return FractionOmitted(Joystick.GetX()); }
	inline float GetStickY(){ return FractionOmitted(Joystick.GetY()); }
	inline float GetStickZ(){ return FractionOmitted(Joystick.GetZ()); }

	inline float FractionOmitted(float original){
		if(fabsf(original) < 0.01 ){
			original = 0;
		}
		return original;
	}
};

#endif

Create GetXplusY function and GetXminusY function


/**
@file
@brief Import the entire library

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

#include "core/basis.h"
#include "core/evaluate.h"
#include "core/check.h"
#include "core/modify.h"
#include "geometry/curve.h"
#include "geometry/surface.h"
#include "io/obj.h"

Add header for importing entire library

Add header for importing entire library


// Defining some necessary symbols just to make the linker happy.

void kernel_yield() { }
void arch_specific_new_task_setup() { }
void arch_specific_free_task() { }

#include <common/basic_defs.h>

// Defining some necessary symbols just to make the linker happy.

void *kernel_initial_stack = NULL;

void kernel_yield() { NOT_REACHED(); }
void arch_specific_new_task_setup() { NOT_REACHED(); }
void arch_specific_free_task() { NOT_REACHED(); }
void switch_to_initial_kernel_stack() { NOT_REACHED(); }

Fix build error (missing mocks)

[gtests] Fix build error (missing mocks)


#ifndef YGO_DATA_CARDDATA_H
#define YGO_DATA_CARDDATA_H

#include <string>

#include "CardType.h"

namespace ygo
{
namespace data
{

struct StaticCardData
{
    std::string name;
    CardType cardType;
    // monster only
    Attribute attribute;
    MonsterType monsterType;
    Type type;
    MonsterType monsterAbility;
    int level;
    int attack;
    int defense;
    int lpendulum;
    int rpendulum;
    // spell and trap only
    SpellType spellType;
    TrapType trapType;
};

}
}

#endif

#ifndef YGO_DATA_CARDDATA_H
#define YGO_DATA_CARDDATA_H

#include <string>

#include "CardType.h"

namespace ygo
{
namespace data
{

struct StaticCardData
{
    std::string name;
    CardType cardType;
    // monster only
    Attribute attribute;
    MonsterType monsterType;
    Type type;
    MonsterType monsterAbility;
    int level;
    int attack;
    int defense;
    int lpendulum;
    int rpendulum;
    // spell and trap only
    SpellType spellType;
    TrapType trapType;
    std::string text;
};

}
}

#endif

Add text to static card data

Add text to static card data


#include "sys/select.h"
#include "bits/mac_esp8266.h"

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

int select(SOCKET nfds, fd_set *__readfds, fd_set *__writefds,
			fd_set *__exceptfds, struct timeval *__timeout) {
	SOCKET i;
	int c;

	c = 0;
	/* Go through interested sockets. */
	for(i = SOCKET_BASE; i < nfds; i++) {
		if((__readfds != NULL) && FD_ISSET(i, __readfds)) {
			if(IsSocketReady2Read(i)) {
				/* The interested socket is ready to be read. */
				c++;
			}
			else {
				/* The interested socket is not ready to be read. */
				FD_CLR(i, __readfds);
			}
		}
		if((__writefds != NULL) && FD_ISSET(i, __writefds)) {
			if(IsSocketReady2Write(i)) {
				/* The interested socket is ready to be written. */
				c++;
			}
			else {
				/* The interested socket is not ready to be written. */
				FD_CLR(i, __writefds);
			}
		}
		if((__exceptfds != NULL) && FD_ISSET(i, __exceptfds)) {
			// To do: List exception sockets.
			/* Zero __exceptfds for now. */
			FD_ZERO(__exceptfds);
		}
	}

	return c;
}

#include "sys/select.h"
#include "bits/mac_esp8266.h"

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

int select(SOCKET nfds, fd_set *__readfds, fd_set *__writefds,
			fd_set *__exceptfds, struct timeval *__timeout) {
	SOCKET i;
	/* Count the ready socket. */
	int count;

	count = 0;
	/* Go through interested sockets. */
	for(i = SOCKET_BASE; i < nfds; i++) {
		if((__readfds != NULL) && FD_ISSET(i, __readfds)) {
			if(IsSocketReady2Read(i)) {
				/* The interested socket is ready to be read. */
				count++;
			}
			else {
				/* The interested socket is not ready to be read. */
				FD_CLR(i, __readfds);
			}
		}
		if((__writefds != NULL) && FD_ISSET(i, __writefds)) {
			if(IsSocketReady2Write(i)) {
				/* The interested socket is ready to be written. */
				count++;
			}
			else {
				/* The interested socket is not ready to be written. */
				FD_CLR(i, __writefds);
			}
		}
		if((__exceptfds != NULL) && FD_ISSET(i, __exceptfds)) {
			// To do: List exception sockets.
			/* Zero __exceptfds for now. */
			FD_ZERO(__exceptfds);
		}
	}

	return count;
}

Change the variable name for more meaningful.


/*
 * libopensync - A synchronization framework
 * Copyright (C) 2008  Daniel Gollub <dgollub@suse.de>
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307  USA
 *
 */

#ifndef _OPENSYNC_PLUGIN_CONNECTION_INTERNALS_H_
#define _OPENSYNC_PLUGIN_CONNECTION_INTERNALS_H_

/*! @brief OSyncPluginConnectionType String Map
 *
 * @ingroup OSyncPluginConnectionInternalsAPI
 **/

typedef struct {
	OSyncPluginConnectionType type;
	const char *string;
} OSyncPluginConnectionTypeString;

const char *osync_plugin_connection_get_type_string(OSyncPluginConnectionType conn_type);

#endif /*_OPENSYNC_PLUGIN_CONNECTION_INTERNALS_H_*/

Add missing file from previous commit.

Add missing file from previous commit.

git-svn-id: e31799a7ad59d6ea355ca047c69e0aee8a59fcd3@4287 53f5c7ee-bee3-0310-bbc5-ea0e15fffd5e


/**@file
  Setup Variable data structure for Unix platform.

Copyright (c) 2009, Intel Corporation
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution.  The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php

THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.

**/

#ifndef __UNIX_SYSTEM_CONFIGUE_H__
#define __UNIX_SYSTEM_CONFIGUE_H__

#define EFI_UXIX_SYSTEM_CONFIG_GUID  \
  {0x375ea976, 0x3ccd, 0x4e74, {0xa8, 0x45, 0x26, 0xb9, 0xb3, 0x24, 0xb1, 0x3c}}

#pragma pack(1)
typedef struct {
  //
  // Console output mode
  //
  UINT32        ConOutColumn;
  UINT32        ConOutRow;
} WIN_NT_SYSTEM_CONFIGURATION;
#pragma pack()

extern EFI_GUID   gEfiUnixSystemConfigGuid;

#endif

/**@file
  Setup Variable data structure for Unix platform.

Copyright (c) 2009, Intel Corporation
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution.  The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php

THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.

**/

#ifndef __UNIX_SYSTEM_CONFIGUE_H__
#define __UNIX_SYSTEM_CONFIGUE_H__

#define EFI_UXIX_SYSTEM_CONFIG_GUID  \
  {0x375ea976, 0x3ccd, 0x4e74, {0xa8, 0x45, 0x26, 0xb9, 0xb3, 0x24, 0xb1, 0x3c}}

#pragma pack(1)
typedef struct {
  //
  // Console output mode
  //
  UINT32        ConOutColumn;
  UINT32        ConOutRow;
} UNIX_SYSTEM_CONFIGURATION;
#pragma pack()

extern EFI_GUID   gEfiUnixSystemConfigGuid;

#endif

Fix typo in data structure

Fix typo in data structure

git-svn-id: 5648d1bec6962b0a6d1d1b40eba8cf5cdb62da3d@7589 6f19259b-4bc3-4df7-8a09-765794883524


#include <iostream>
#include <vector>
#include <stdlib.h>

template <typename T>
void swap(T& a, T& b) {
    T tmp = b;
    b = a;
    a = tmp;
}

template <typename T>
void bubblesort(T& vec) {
    auto f = vec.begin();
    auto s = vec.begin();
    ++s;
    bool swapped = false;
    while (s != vec.end()) {
	if (*f > *s) {
	    swap(*f, *s);
	    swapped = true;
	}
	++f; ++s;
    }
    if (swapped) {
	bubblesort(vec);
    }
}

#include <iostream>
#include <vector>
#include <stdlib.h>

template <typename T>
void swap(T& a, T& b) {
    T tmp = b;
    b = a;
    a = tmp;
}

template <typename T>
T bubblesort(T& vec) {
    auto f = vec.begin();
    auto s = vec.begin();
    ++s;
    bool swapped = false;
    while (s != vec.end()) {
	if (*f > *s) {
	    swap(*f, *s);
	    swapped = true;
	}
	++f; ++s;
    }
    if (swapped) {
	bubblesort(vec);
    }
    return vec;
}

Bubblesort: Return the sorted object as well as sort it in-place


#pragma once

#include <SFML/Graphics.hpp>

class DrawableInterface {
    public:
        virtual ~DrawableInterface() {}
        virtual void draw(sf::RenderWindow *window) = 0;
};

Add graphics module and drawable interface


#ifndef ALI_MISALIGNER_H
#define ALI_MISALIGNER_H

#include "TObject.h"
#include "TString.h"
#include "AliCDBMetaData.h"

class TClonesArray;
class AliCDBManager;

// Base class for creating a TClonesArray of simulated misalignment objects
// for a given subdetector of type ideal,residual or full
//

class AliMisAligner : public TObject {

  public:
    AliMisAligner();
    virtual TClonesArray* MakeAlObjsArray() const =0;
    virtual AliCDBMetaData* GetCDBMetaData() const =0;
    void SetMisalType(const char* misalType)
    {
      fMisalType=misalType;
    }
    const char* GetMisalType() const
    {
      return fMisalType.Data();
    }

  protected:
    TString fMisalType;

  private:
    ClassDef(AliMisAligner,0);
};

#endif

#ifndef ALI_MISALIGNER_H
#define ALI_MISALIGNER_H

#include "TObject.h"
#include "TString.h"
#include "AliCDBMetaData.h"

class TClonesArray;
class AliCDBManager;

// Base class for creating a TClonesArray of simulated misalignment objects
// for a given subdetector of type ideal,residual or full
//

class AliMisAligner : public TObject {

  public:
    AliMisAligner();
    virtual TClonesArray* MakeAlObjsArray() =0;
    virtual AliCDBMetaData* GetCDBMetaData() const =0;
    void SetMisalType(const char* misalType)
    {
      fMisalType=misalType;
    }
    const char* GetMisalType() const
    {
      return fMisalType.Data();
    }

  protected:
    TString fMisalType;

  private:
    ClassDef(AliMisAligner,0);
};

#endif

Allow methods called inside MakeAlObjsArray to modify data members


#ifndef __DEBUG_H
#define __DEBUG_H

#ifdef DEBUG
extern bool debug;
extern bool debug_z;

#define DBG if (debug)
#define MSG(x) DBG msg x
#else
#define DBG if (0)
#define MSG(x)
#endif

#if defined(DEBUG) || defined(PRECON)
#define PRECONDITION(x) if (x); else precondition( #x , __FILE__, __LINE__)
#else
#define PRECONDITION(x) // nothing
#endif

#endif

#ifndef __DEBUG_H
#define __DEBUG_H

#ifdef DEBUG
extern bool debug;
extern bool debug_z;

#define DBG if (debug)
#define MSG(x) DBG tlog x
#else
#define DBG if (0)
#define MSG(x)
#endif

#if defined(DEBUG) || defined(PRECON)
#define PRECONDITION(x) if (x); else precondition( #x , __FILE__, __LINE__)
#else
#define PRECONDITION(x) // nothing
#endif

#endif

Use tlog for MSG reports.

Use tlog for MSG reports.


#ifndef INCLUDE_revwalk_h__
#define INCLUDE_revwalk_h__

#include "git/common.h"
#include "git/revwalk.h"

struct git_revpool {
	git_odb *db;

	git_commit_list iterator;
	git_commit *(*next_commit)(git_commit_list *);

	git_commit_list roots;
	git_revpool_table *commits;

	unsigned walking:1;
	unsigned char sorting;
};

void gitrp__prepare_walk(git_revpool *pool);
int gitrp__enroot(git_revpool *pool, git_commit *commit);

#endif /* INCLUDE_revwalk_h__ */

#ifndef INCLUDE_revwalk_h__
#define INCLUDE_revwalk_h__

#include "git/common.h"
#include "git/revwalk.h"

struct git_revpool {
	git_odb *db;

	git_commit_list iterator;
	git_commit *(*next_commit)(git_commit_list *);

	git_commit_list roots;
	git_revpool_table *commits;

	unsigned walking:1;
	unsigned int sorting;
};

void gitrp__prepare_walk(git_revpool *pool);
int gitrp__enroot(git_revpool *pool, git_commit *commit);

#endif /* INCLUDE_revwalk_h__ */

msvc: Fix an "conversion, loss of data" compiler warning

In particular, the compiler issues the following warning:

    src/revwalk.c(61) : warning C4244: '=' : conversion from \
        'unsigned int' to 'unsigned char', possible loss of data

In order to suppress the warning, we change the type of the
sorting "enum" field of the git_revpool structure to be consistent
with the sort_mode parameter of the gitrp_sorting() function.

Note that if the size of the git_revpool structure is an issue,
then we could change the type of the sort_mode parameter instead.

Signed-off-by: Ramsay Jones <3e74413778ce9c8bebbbaedfd56741f6850faeaf@ramsay1.demon.co.uk>
Signed-off-by: Andreas Ericsson <1eabdaf488b3a3682bbca94c5f468f065cdfaf13@op5.se>


#ifndef VAST_QUERY_PARSER_SKIPPER_H
#define VAST_QUERY_PARSER_SKIPPER_H

#include <boost/spirit/include/qi.hpp>

namespace vast {
namespace query {
namespace parser {

namespace qi = boost::spirit::qi;
namespace ascii = boost::spirit::ascii;

template <typename Iterator>
struct skipper : qi::grammar<Iterator>
{
    skipper()
      : skipper::base_type(start)
    {
        qi::char_type char_;
        ascii::space_type space;

        start =
                char_                           // Tab, space, CR, LF
            |   "/*" >> *(space - "*/") >> "*/" // C-style comments
            ;
    }

    qi::rule<Iterator> start;
};

} // namespace ast
} // namespace query
} // namespace vast

#endif

#ifndef VAST_QUERY_PARSER_SKIPPER_H
#define VAST_QUERY_PARSER_SKIPPER_H

#include <boost/spirit/include/qi.hpp>

namespace vast {
namespace query {
namespace parser {

namespace qi = boost::spirit::qi;
namespace ascii = boost::spirit::ascii;

template <typename Iterator>
struct skipper : qi::grammar<Iterator>
{
    skipper()
      : skipper::base_type(start)
    {
        qi::char_type char_;
        ascii::space_type space;

        start =
                space                           // Tab, space, CR, LF
            |   "/*" >> *(char_ - "*/") >> "*/" // C-style comments
            ;
    }

    qi::rule<Iterator> start;
};

} // namespace ast
} // namespace query
} // namespace vast

#endif

Fix skip grammar of query parser.

Fix skip grammar of query parser.


#define _SLAVETYPES

#include <inttypes.h>

//Declarations for slave types

typedef struct
{
	uint8_t Length; //Length of frame, if it's equal to 0, frame is not ready
	uint8_t *Frame; //Response frame content
} MODBUSResponseStatus; //Type containing information about frame that is set up at slave side

typedef struct
{
	uint8_t Address; //Slave address
	uint16_t *Registers; //Slave holding registers
	uint16_t RegisterCount; //Slave register count
	uint8_t *RegisterMask; //Masks for write protection (bit of value 1 - write protection)
	uint16_t RegisterMaskLength; //Masks length (each mask covers 8 registers)
	MODBUSResponseStatus Response; //Slave response formatting status
} MODBUSSlaveStatus; //Type containing slave device configuration data

#define _SLAVETYPES

#include <inttypes.h>

//Declarations for slave types

typedef struct
{
	uint8_t Length; //Length of frame, if it's equal to 0, frame is not ready
	uint8_t *Frame; //Response frame content
} MODBUSResponseStatus; //Type containing information about frame that is set up at slave side

typedef struct
{
	uint8_t Address; //Slave address
	uint16_t *Registers; //Slave holding registers
	uint16_t RegisterCount; //Slave register count
	uint8_t *Coils; //Slave coils
	uint16_t CoilCount; //Slave coil count
	uint8_t *RegisterMask; //Masks for write protection (bit of value 1 - write protection)
	uint16_t RegisterMaskLength; //Masks length (each mask covers 8 registers)
	MODBUSResponseStatus Response; //Slave response formatting status
} MODBUSSlaveStatus; //Type containing slave device configuration data

Add coil variables to type definitions

Add coil variables to type definitions


#ifndef MIT_Mobile_MITAdditions_h
#define MIT_Mobile_MITAdditions_h

#import "Foundations+MITAdditions.h"
#import "UIKit+MITAdditions.h"
#import "CoreLocation+MITAdditions.h"
#import "UIImage+Resize.h"
#import "NSDateFormatter+RelativeString.h"
#import "MFMailComposeController+RFC2368.h"
#import "NSData+MGTwitterBase64.h"
#import "NSMutableAttributedString+MITAdditions.h"

#endif

#ifndef MIT_Mobile_MITAdditions_h
#define MIT_Mobile_MITAdditions_h

#import "Foundation+MITAdditions.h"
#import "UIKit+MITAdditions.h"
#import "CoreLocation+MITAdditions.h"
#import "UIImage+Resize.h"
#import "NSDateFormatter+RelativeString.h"
#import "MFMailComposeViewController+RFC2368.h"
#import "NSData+MGTwitterBase64.h"
#import "NSMutableAttributedString+MITAdditions.h"

#endif

Fix up the header names as several are not correct


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

long hash(char*);

int main() {

    char word[200];
    fgets(word, 201, stdin);

    printf("%ld", hash(word));

    return 0;
}

long hash(char *word) {

    long result = 42;
    int length = strlen(word);

    for (int i = 0; i < length; i++) {
        result += word[i] * (i + 1);
    }

    return result;
}

Add Task 01 for Homework 01

Add Task 01 for Homework 01


/* socktypetab.h --
 * Copyright 2012 Red Hat Inc., Durham, North Carolina.
 * All Rights Reserved.
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 *
 * Authors:
 *      Steve Grubb <sgrubb@redhat.com>
 */

_S(1, "SOCK_STREAM")
_S(2, "SOCK_DGRAM")
_S(3, "SOCK_RAW")
_S(4, "SOCK_RDM")
_S(5, "SOCK_SEQPACKET")
_S(6, "SOCK_DCCP")
_S(10, "SOCK_PACKET")

Add some interpretations to ausearch for syscall parameters

git-svn-id: b2ed898cf2cd3316b62ee1cc50465f4560571194@673 03a675c2-f56d-4096-908f-63dba836b7e4


/**
 * Copyright (c) 2015-present, Facebook, Inc.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 */

#pragma once

#include <fabric/components/image/ImageShadowNode.h>
#include <fabric/core/ConcreteComponentDescriptor.h>
#include <fabric/imagemanager/ImageManager.h>
#include <fabric/uimanager/ContextContainer.h>

namespace facebook {
namespace react {

/*
 * Descriptor for <Image> component.
 */
class ImageComponentDescriptor final:
  public ConcreteComponentDescriptor<ImageShadowNode> {

public:
  ImageComponentDescriptor(SharedEventDispatcher eventDispatcher, const SharedContextContainer &contextContainer):
    ConcreteComponentDescriptor(eventDispatcher),
    imageManager_(contextContainer->getInstance<SharedImageManager>()) {}

  void adopt(UnsharedShadowNode shadowNode) const override {
    ConcreteComponentDescriptor::adopt(shadowNode);

    assert(std::dynamic_pointer_cast<ImageShadowNode>(shadowNode));
    auto imageShadowNode = std::static_pointer_cast<ImageShadowNode>(shadowNode);

    // `ImageShadowNode` uses `ImageManager` to initiate image loading and
    // communicate the loading state and results to mounting layer.
    imageShadowNode->setImageManager(imageManager_);
  }

private:
  const SharedImageManager imageManager_;
};

} // namespace react
} // namespace facebook

Implement the update of props in the MountingManager layer

Summary: This diff implements the update of props in Fabric C++. The props values are passed to java in a ReadableMap and they are integrated into the current implementation of ViewManagers. In the fututre we will replace the ReadableMap for typed objects.

Reviewed By: shergin

Differential Revision: D9093560

fbshipit-source-id: da58326cfadb0665dac3349a8cf24cde2d401aaa


extern void __VERIFIER_error() __attribute__ ((__noreturn__));
extern int __VERIFIER_nondet_int();

int main()
{
    int x, y;
    if (__VERIFIER_nondet_int())
    {
        x = 0;
        y = 1;
    }
    else
    {
        x = 1;
        y = 0;
    }

    // if (!(x + y == 1))
    if (x + y != 1)
        __VERIFIER_error();
    return 0;
}

// ./goblint --enable ana.sv-comp --enable ana.wp --enable exp.uncilwitness --disable ana.int.trier --enable ana.int.interval --set ana.activated '["base"]' --set phases '[{}, {"ana": {"activated": ["base", "observer"], "path_sens": ["observer"]}}]' --html tests/sv-comp/observer/path_nofun_true-unreach-call.c

extern void __VERIFIER_error() __attribute__ ((__noreturn__));
extern int __VERIFIER_nondet_int();

int main()
{
    int x, y;
    if (__VERIFIER_nondet_int())
    {
        x = 0;
        y = 1;
    }
    else
    {
        x = 1;
        y = 0;
    }

    // if (!(x + y == 1))
    if (x + y != 1)
        __VERIFIER_error();
    return 0;
}

// ./goblint --enable ana.sv-comp --enable ana.wp --enable exp.uncilwitness --disable ana.int.def_exc --enable ana.int.interval --set ana.activated '["base"]' --set phases '[{}, {"ana": {"activated": ["base", "observer"], "path_sens": ["observer"]}}]' --html tests/sv-comp/observer/path_nofun_true-unreach-call.c

Fix trier -> def_exc in observer test comment


int f(int a), g(int a), a;

int
main()
{
	return f(1) - g(1);
}

int
f(int a)
{
	return a;
}

int
g(int a)
{
	return a;
}

Add test for function declarations

[tests] Add test for function declarations

This test is intended for mixing several function
definitions and variables in the same declaration list.


#pragma once

#include <Windows.h>
#include <vector>

class UIContext;
///
/// Abstract class that encapsulates functionality for dealing with
/// property sheet pages (tabs).
///
class Tab {
public:
    Tab();
    ~Tab();

    /// Processes messages sent to the tab page.
    virtual DLGPROC TabProc(
        HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam);

    /// Persists changes made on the tab page
    virtual void SaveSettings() = 0;

protected:
    HWND _hWnd;
    UIContext *_ctxt;

    ///
    /// Performs intitialization for the tab page, similar to a constructor.
    /// Since tab page windows are created on demand, this method could be
    /// called much later than the constructor for the tab.
    ///
    virtual void Initialize() = 0;

    /// Applies the current settings state to the tab page.
    virtual void LoadSettings() = 0;

    /// Handles WM_COMMAND messages.
    /// <param name="nCode">Control-defined notification code</param>
    /// <param name="ctrlId">Control identifier</param>
    virtual DLGPROC Command(unsigned short nCode, unsigned short ctrlId) = 0;

    /// Handles WM_NOTIFY messages.
    /// <param name="nHdr">Notification header structure</param>
    virtual DLGPROC Notification(NMHDR *nHdr) = 0;
};

#pragma once

#include <Windows.h>
#include <vector>

#include "Control.h"

class UIContext;
///
/// Abstract class that encapsulates functionality for dealing with
/// property sheet pages (tabs).
///
class Tab {
public:
    Tab();
    ~Tab();

    /// Processes messages sent to the tab page.
    virtual DLGPROC TabProc(
        HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam);

    /// Persists changes made on the tab page
    virtual void SaveSettings() = 0;

protected:
    /// Window handle of this tab.
    HWND _hWnd;
    UIContext *_ctxt;

    /// A vector of all the controls present on this tab.
    std::vector<Control *> _controls;

    ///
    /// Performs intitialization for the tab page, similar to a constructor.
    /// Since tab page windows are created on demand, this method could be
    /// called much later than the constructor for the tab.
    ///
    virtual void Initialize() = 0;

    /// Applies the current settings state to the tab page.
    virtual void LoadSettings() = 0;

    /// Handles WM_COMMAND messages.
    /// <param name="nCode">Control-defined notification code</param>
    /// <param name="ctrlId">Control identifier</param>
    virtual DLGPROC Command(unsigned short nCode, unsigned short ctrlId) = 0;

    /// Handles WM_NOTIFY messages.
    /// <param name="nHdr">Notification header structure</param>
    virtual DLGPROC Notification(NMHDR *nHdr) = 0;
};

Add vector to keep track of controls

Add vector to keep track of controls