//
//  PKTStubs.h
//  PodioKit
//
//  Created by Romain Briche on 30/01/14.
//  Copyright (c) 2014 Citrix Systems, Inc. All rights reserved.
//

#import <Foundation/Foundation.h>
#import <OHHTTPStubs/OHHTTPStubs.h>

void (^stubResponseFromFile)(NSString *, NSString *) = ^(NSString *path, NSString *responseFilename) {
  NSDictionary *headers = @{@"Content-Type": @"application/json; charset=utf-8"};

	[OHHTTPStubs stubRequestsPassingTest:^BOOL(NSURLRequest *request) {
    return [[[request URL] path] isEqualToString:path];
  } withStubResponse:^OHHTTPStubsResponse *(NSURLRequest *request) {
		return [OHHTTPStubsResponse responseWithFileAtPath:OHPathForFileInDocumentsDir(responseFilename) statusCode:200 headers:headers];
  }];
};

void (^stubResponseFromObject)(NSString *, id) = ^(NSString *path, id responseObject) {
  NSDictionary *headers = @{@"Content-Type": @"application/json; charset=utf-8"};

	[OHHTTPStubs stubRequestsPassingTest:^BOOL(NSURLRequest *request) {
    return [[[request URL] path] isEqualToString:path];
  } withStubResponse:^OHHTTPStubsResponse *(NSURLRequest *request) {
    NSData *data = [NSJSONSerialization dataWithJSONObject:responseObject options:0 error:NULL];
		return [OHHTTPStubsResponse responseWithData:data statusCode:200 headers:headers];
  }];
};

void (^stubResponseWithStatusCode)(NSString *, int) = ^(NSString *path, int statusCode) {
	[OHHTTPStubs stubRequestsPassingTest:^BOOL(NSURLRequest *request) {
    return [[[request URL] path] isEqualToString:path];
  } withStubResponse:^OHHTTPStubsResponse *(NSURLRequest *request) {
		return [OHHTTPStubsResponse responseWithData:[NSData data] statusCode:statusCode headers:nil];
  }];
};

void (^stubResponseWithTime)(NSString *, int, int) = ^(NSString *path, int requestTime, int responseTime) {
	[OHHTTPStubs stubRequestsPassingTest:^BOOL(NSURLRequest *request) {
    return [[[request URL] path] isEqualToString:path];
  } withStubResponse:^OHHTTPStubsResponse *(NSURLRequest *request) {
		return [[OHHTTPStubsResponse responseWithData:[NSData data] statusCode:200 headers:nil] requestTime:requestTime responseTime:responseTime];
  }];
};

Add convenient method to stub API responses


// RUN: touch %t
// RUN: chmod 0 %t
// %clang -E -dependency-file bla -MT %t -MP -o %t -x c /dev/null
// rdar://9286457

// RUN: touch %t
// RUN: chmod 0 %t
// RUN: not %clang_cc1 -E -dependency-file bla -MT %t -MP -o %t -x c /dev/null 2>&1 | FileCheck %s
// RUN: rm -f %t

// CHECK: error: unable to open output file

// rdar://9286457

Fix dependency generation crash test to run clang and clean up after itself.

Previously the test did not have a RUN: prefix for the clang command.
In addition it was leaving behind a tmp file with no permissions causing issues when
deleting the build directory on Windows.

Differential Revision: http://reviews.llvm.org/D7534

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


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

#include "stdio.h"

#if   ( _MSC_VER >= 800  )

#define try                             __try
#define except                          __except
#define finally                         __finally
#define leave                           __leave

#elif defined(__MINGW32__) || defined(__MINGW64__)
#define try
#define except
#define finally
#define leave

#endif

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

#include "stdio.h"

#if   ( _MSC_VER >= 800  )

#define try                             __try
#define except                          __except
#define finally                         __finally
#define leave                           __leave

#endif

Revert "Dirty hack for mingw's exception handler"

This reverts commit f9d6d03cc8a7f00588a7df7ab4b31673521fc193.


#ifndef RPLNN_TEXTURE_H
#define RPLNN_TEXTURE_H

struct texture;

/* Should create a version of this which doesn't malloc (basically just give memory block as a parameter). */
struct texture *texture_create(const char *file_name);

void texture_destroy(struct texture **texture);

/* Just create a stryct vec2_int texture_get_size func */
void texture_get_info(struct texture *texture, uint32_t **buf, struct vec2_int **size);

#endif /* RPLNN_TEXTURE_H */

#ifndef RPLNN_TEXTURE_H
#define RPLNN_TEXTURE_H

struct texture;

/* Should create a version of this which doesn't malloc (basically just give memory block as a parameter). */
struct texture *texture_create(const char *file_name);

void texture_destroy(struct texture **texture);

void texture_get_info(struct texture *texture, uint32_t **buf, struct vec2_int **size);

#endif /* RPLNN_TEXTURE_H */

Clean up 1: Removed old comment and vs fixed some line endings.


// RUN: %ucc -fsyntax-only %s

struct B
{
	int i;
};

struct Global
{
	char *s;
};

f()
{
	struct A
	{
		int i;
		struct Global g;
	} a;

	struct B
	{
		int j, k;
	};

	a.g.s = "hi";

	struct B;

	struct B b;
	b.k = 3;

	{
		struct B x = { .k = 5 };
	}
}

struct R
{
	struct R *next;
};

struct R r = { &r };

Add additional nested struct redefinition test


/******************************************************************************
 * Copyright (c) 2004, 2008 IBM Corporation
 * All rights reserved.
 * This program and the accompanying materials
 * are made available under the terms of the BSD License
 * which accompanies this distribution, and is available at
 * http://www.opensource.org/licenses/bsd-license.php
 *
 * Contributors:
 *     IBM Corporation - initial implementation
 *****************************************************************************/

#ifndef _STDDEF_H
#define _STDDEF_H

#define NULL ((void *)0)

typedef unsigned int size_t;

#endif

/******************************************************************************
 * Copyright (c) 2004, 2008 IBM Corporation
 * All rights reserved.
 * This program and the accompanying materials
 * are made available under the terms of the BSD License
 * which accompanies this distribution, and is available at
 * http://www.opensource.org/licenses/bsd-license.php
 *
 * Contributors:
 *     IBM Corporation - initial implementation
 *****************************************************************************/

#ifndef _STDDEF_H
#define _STDDEF_H

#define NULL ((void *)0)

typedef unsigned long size_t;

#endif

Declare size_t as unsigned long

libc: Declare size_t as unsigned long

If size_t is only "int", memset() and friends are limited
to 4 GB. And ssize_t is already declared as "long", so it
is somewhat inconsequent to define size_t as "int" only.

Signed-off-by: Thomas Huth <9e65be74847981e55b2564b6266c57d86d3bac05@redhat.com>
Signed-off-by: Alexey Kardashevskiy <ac1fc56530d7d037e1ea666f130daca22d72f964@ozlabs.ru>


/*
 * Copyright © 2015 Canonical Limited
 *
 * 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, see <http://www.gnu.org/licenses/>.
 *
 * Author: Ryan Lortie <desrt@desrt.ca>
 */

#if !defined (__GLIB_GOBJECT_H_INSIDE__) && !defined (GOBJECT_COMPILATION)
#error "Only <glib-object.h> can be included directly."
#endif

G_DEFINE_AUTOPTR_CLEANUP_FUNC(GClosure, g_closure_unref)
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GObject, g_object_unref)
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GInitiallyUnowned, g_object_unref)
G_DEFINE_AUTO_CLEANUP_CLEAR_FUNC(GValue, g_value_unset)

/*
 * Copyright © 2015 Canonical Limited
 *
 * 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, see <http://www.gnu.org/licenses/>.
 *
 * Author: Ryan Lortie <desrt@desrt.ca>
 */

#if !defined (__GLIB_GOBJECT_H_INSIDE__) && !defined (GOBJECT_COMPILATION)
#error "Only <glib-object.h> can be included directly."
#endif

G_DEFINE_AUTOPTR_CLEANUP_FUNC(GClosure, g_closure_unref)
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GObject, g_object_unref)
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GInitiallyUnowned, g_object_unref)
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GParamSpec, g_param_spec_unref)
G_DEFINE_AUTO_CLEANUP_CLEAR_FUNC(GValue, g_value_unset)

Add g_autoptr() support for GParamSpec

gobject: Add g_autoptr() support for GParamSpec

Do not add support for its subtypes, since all their constructors return
GParamSpec*, and g_param_spec_unref() takes a GParamSpec* rather than a
gpointer — adding G_DEFINE_AUTOPTR_CLEANUP_FUNC() for subtypes of
GParamSpec results in compiler warnings about mismatched parameter
types (GParamSpecBoolean* vs GParamSpec*, for example).

Signed-off-by: Philip Withnall <withnall@endlessm.com>

https://bugzilla.gnome.org/show_bug.cgi?id=796139


/*
 * The sum of the primes below 10 is 2 + 3 + 5 + 7 = 17.
 *
 * Find the sum of all the primes below two million.
 */

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

#define PROBLEM 10

int
main(int argc, char **argv)
{
    uint64_t sum = 0, number = 0;

    do {
        number++;
        if(is_prime(number)) {
            sum += number;
        }
    } while(number != 2000000);
    printf("%llu\n", sum);
    return(0);
}

Add solution for problem 10

Add solution for problem 10


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

/* We can:
   Set something equal to something
   Function calls
   Function definitions
   Returning things -- delimiter '<'
   Printing things
   Iffing */

struct call parseCall(char* statement);
struct function parseFunction(char* statement);

char* fixSpacing(char* code) {
  char* fixedCode = malloc(sizeof(char) * (strlen(code) + 1));
  fixedCode = strcpy(fixedCode, code);
  char* doubleSpace = strstr(fixedCode, "  ");
  char* movingIndex;
  for( ; doubleSpace; doubleSpace = strstr(fixedCode, "  ")) {
    for(movingIndex = doubleSpace; movingIndex&; movingIndex++) {
      movingIndex[0] = movingIndex[1];
    }
  }
  return fixedCode;
}

char** spcTokenize(char* regCode) {
  int n = 0;
  int i;
  for(i = 0; regCode[i]; i++) {
    if(regCode[i] == ' ') {
      n++;
    }
  }
  char** spcTokens = malloc(sizeof(char*) * (n+1));
  int k;
  for(i = 0; i < n+1; i++) {
    k = strchr(regCode, ' ') - regCode;
    regCode[k] = NULL;
    spcTokens[i] = regCode + k + 1;
  }
}

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

/* We can:
   Set something equal to something
   Function calls
   Function definitions
   Returning things -- delimiter '<'
   Printing things
   Iffing */

char* fixSpacing(char* code) {
  char* fixedCode = malloc(sizeof(char) * (strlen(code) + 1));
  fixedCode = strcpy(fixedCode, code);
  char* doubleSpace = strstr(fixedCode, "  ");
  char* movingIndex;
  for( ; doubleSpace; doubleSpace = strstr(fixedCode, "  ")) {
    for(movingIndex = doubleSpace; movingIndex&; movingIndex++) {
      movingIndex[0] = movingIndex[1];
    }
  }
  return fixedCode;
}

char** spcTokenize(char* regCode) {
  int n = 0;
  int i;
  for(i = 0; regCode[i]; i++) {
    if(regCode[i] == ' ') {
      n++;
    }
  }
  char** spcTokens = malloc(sizeof(char*) * (n+1));
  int k;
  for(i = 0; i < n+1; i++) {
    k = strchr(regCode, ' ') - regCode;
    regCode[k] = NULL;
    spcTokens[i] = regCode + k + 1;
  }
  return spcTokens;
}

Add a return statement to spcTokenize.

Add a return statement to spcTokenize.


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

#include "debug.h"

#ifndef NDEBUG

regex_t _comp;

// Initialize the regular expression used for restricting debug output
static void __attribute__ ((constructor)) premain()
{
	if (regcomp(&_comp, DCOMPONENT, REG_EXTENDED|REG_ICASE|REG_NOSUB))
		die("mayb not a valid regexp: %s", DCOMPONENT);
}

// Print a hexdump of the given block
void hexdump(const void * const ptr, const unsigned len)
{
	const char * const buf = (const char * const)ptr;
	for (unsigned i = 0; i < len; i += 16) {
		fprintf(stderr, "%06x: ", i);
		for (unsigned j = 0; j < 16; j++)
			if (i+j < len)
				fprintf(stderr, "%02hhx ", buf[i+j]);
			else
				fprintf(stderr, "   ");
			fprintf(stderr, " ");
		for (unsigned j = 0; j < 16; j++)
			if (i+j < len)
				fprintf(stderr, "%c",
					isprint(buf[i+j]) ? buf[i+j] : '.');
		fprintf(stderr, "\n");
	}
}

#endif

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

#include "debug.h"

#ifndef NDEBUG

char *col[6] = { MAG, RED, YEL, CYN, BLU, GRN };

regex_t _comp;

// Initialize the regular expression used for restricting debug output
static void __attribute__ ((constructor)) premain()
{
	if (regcomp(&_comp, DCOMPONENT, REG_EXTENDED|REG_ICASE|REG_NOSUB))
		die("may not be a valid regexp: %s", DCOMPONENT);
}

// Print a hexdump of the given block
void hexdump(const void * const ptr, const unsigned len)
{
	const char * const buf = (const char * const)ptr;
	for (unsigned i = 0; i < len; i += 16) {
		fprintf(stderr, "%06x: ", i);
		for (unsigned j = 0; j < 16; j++)
			if (i+j < len)
				fprintf(stderr, "%02hhx ", buf[i+j]);
			else
				fprintf(stderr, "   ");
			fprintf(stderr, " ");
		for (unsigned j = 0; j < 16; j++)
			if (i+j < len)
				fprintf(stderr, "%c",
					isprint(buf[i+j]) ? buf[i+j] : '.');
		fprintf(stderr, "\n");
	}
}

#endif

Fix typo in message and add colors

Fix typo in message and add colors


// -*- c++ -*-

/*

 Copyright 2019 Alain Dargelas

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

/*
 * File:   VpiListener.h
 * Author: alaindargelas
 *
 * Created on December 14, 2019, 10:03 PM
 */

#ifndef UHDM_VPILISTENER_CLASS_H
#define UHDM_VPILISTENER_CLASS_H

#include "headers/uhdm_forward_decl.h"

namespace UHDM {

  class VpiListener {
  public:
    // Use implicit constructor to initialize all members
    // VpiListener()

    virtual ~VpiListener() {}

<VPI_LISTENER_METHODS>

  protected:

  };

};

#endif

// -*- c++ -*-

/*

 Copyright 2019 Alain Dargelas

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

/*
 * File:   VpiListener.h
 * Author: alaindargelas
 *
 * Created on December 14, 2019, 10:03 PM
 */

#ifndef UHDM_VPILISTENER_CLASS_H
#define UHDM_VPILISTENER_CLASS_H

#include "headers/uhdm_forward_decl.h"
#include "include/vpi_user.h"

namespace UHDM {
class VpiListener {
public:
  // Use implicit constructor to initialize all members
  // VpiListener()

  virtual ~VpiListener() {}

<VPI_LISTENER_METHODS>
};

}  // namespace UHDM

#endif

Use of vpiHandle requires inclusion of vpi_user.

Signed-off-by: Henner Zeller <259ad50fabbfd39355f36ecd6c0afca541ea66ef@acm.org>


#ifndef _VJ_DEVICE_INTERFACE_H_
#define _VJ_DEVICE_INTERFACE_H_

//: Base class for simplified interfaces
//
// Interfaces provide an easier way to access proxy objects from
// within user applications.

//
// Users can simply declare a local interface variable and use it
// as a smart_ptr for the proxy
//
//! NOTE: The init function should be called in the init function of the user
//+         application

#include <mstring.h>

class vjDeviceInterface
{
public:
   vjDeviceInterface() : mProxyIndex(-1)
   {;}

   //: Initialize the object
   //! ARGS: proxyName - String name of the proxy to connect to
   void init(string proxyName);

   //: Return the index of the proxy
   int getProxyIndex()
   {  return mProxyIndex; }

protected:
   int mProxyIndex;        //: The index of the proxy
};

#endif

#ifndef _VJ_DEVICE_INTERFACE_H_
#define _VJ_DEVICE_INTERFACE_H_

//: Base class for simplified interfaces
//
// Interfaces provide an easier way to access proxy objects from
// within user applications.

//
// Users can simply declare a local interface variable and use it
// as a smart_ptr for the proxy
//
//! NOTE: The init function should be called in the init function of the user
//+         application

#include <vjConfig.h>

class vjDeviceInterface
{
public:
   vjDeviceInterface() : mProxyIndex(-1)
   {;}

   //: Initialize the object
   //! ARGS: proxyName - String name of the proxy to connect to
   void init(string proxyName);

   //: Return the index of the proxy
   int getProxyIndex()
   {  return mProxyIndex; }

protected:
   int mProxyIndex;        //: The index of the proxy
};

#endif

Include vjConfig.h rather than mstring.h to get the basic_string
implmentation.

git-svn-id: 769d22dfa2d22aad706b9a451492fb87c0735f19@596 08b38cba-cd3b-11de-854e-f91c5b6e4272


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

#include <dbus/dbus.h>

void main(int argc, char* argv[]) {
  DBusMessage* m;
  dbus_uint32_t arg_a = 0x11223344;
  char arg_b = 0x42;
  const dbus_uint64_t array[] = {};
  const dbus_uint64_t *arg_c = array;
  char arg_d = 0x23;

  char* wire;
  int len;

  m = dbus_message_new_method_call(NULL,
				   "/",
				   NULL,
				   "Test");
  dbus_message_append_args(m,
			   DBUS_TYPE_UINT32, &arg_a,
			   DBUS_TYPE_BYTE, &arg_b,
			   DBUS_TYPE_ARRAY, DBUS_TYPE_UINT64, &arg_c, 0,
			   DBUS_TYPE_BYTE, &arg_d,
			   DBUS_TYPE_INVALID);
  dbus_message_marshal(m, &wire, &len);

  for (int i = 0; i < len; i++) {
    printf("%02x", wire[i]);
    if ( (i+1) % 8) {
      printf(" ");
    } else {
      printf("\n");
    }
  }

  exit(0);
}

Add sample C code for comparing serializations


#ifndef SAUCE_MEMORY_H_
#define SAUCE_MEMORY_H_

#if SAUCE_STD_SMART_PTR
  #include <sauce/internal/memory/std.h>
#elif SAUCE_STD_TR1_SMART_PTR
  #include <sauce/internal/memory/tr1.h>
#elif SAUCE_BOOST_SMART_PTR
  #include <sauce/internal/memory/boost.h>
#else
  #error Please define SAUCE_STD_SMART_PTR, SAUCE_STD_TR1_SMART_PTR or SAUCE_BOOST_SMART_PTR
#endif

#endif // SAUCE_MEMORY_H_

#ifndef SAUCE_MEMORY_H_
#define SAUCE_MEMORY_H_

#if SAUCE_STD_SMART_PTR
  #include <sauce/internal/memory/std.h>
#elif SAUCE_STD_TR1_SMART_PTR
  #include <sauce/internal/memory/tr1.h>
#elif SAUCE_BOOST_SMART_PTR
  #include <sauce/internal/memory/boost.h>
#else
  #include <sauce/internal/memory/std.h>
#endif

#endif // SAUCE_MEMORY_H_

Use standard smart pointers by default.

Use standard smart pointers by default.


#ifndef WEBDRIVERXX_DETAIL_TIME_H
#define WEBDRIVERXX_DETAIL_TIME_H

#include "error_handling.h"
#include "../types.h"

#ifdef _WIN32

#include <windows.h>

#else

#include <time.h>

#endif

namespace webdriverxx {
namespace detail {

TimePoint Now() {
	#ifdef _WIN32
		FILETIME time;
		::GetSystemTimeAsFileTime(&time);
		return (static_cast<TimePoint>(time.dwHighDateTime) << 32)
			+ time.dwLowDateTime;
	#else
		timeval time = {};
		WEBDRIVERXX_CHECK(0 == gettimeofday(&time, nullptr), "gettimeofday failure");
		return static_cast<TimePoint>(time.tv_sec)*1000 + time.tv_usec/1000;
	#endif
}

void Sleep(Duration milliseconds) {
	#ifdef _WIN32
		::Sleep(static_cast<DWORD>(milliseconds));
	#else
		timespec time = { static_cast<time_t>(milliseconds/1000),
			static_cast<long>(milliseconds%1000)*1000000 };
		while (nanosleep(&time, &time)) {}
	#endif
}

} // namespace detail
} // namespace webdriverxx

#endif

#ifndef WEBDRIVERXX_DETAIL_TIME_H
#define WEBDRIVERXX_DETAIL_TIME_H

#include "error_handling.h"
#include "../types.h"

#ifdef _WIN32

#include <windows.h>

#else

#include <time.h>

#endif

namespace webdriverxx {
namespace detail {

TimePoint Now() {
	#ifdef _WIN32
		FILETIME time;
		::GetSystemTimeAsFileTime(&time);
		return ((static_cast<TimePoint>(time.dwHighDateTime) << 32)
			+ time.dwLowDateTime)/10000;
	#else
		timeval time = {};
		WEBDRIVERXX_CHECK(0 == gettimeofday(&time, nullptr), "gettimeofday failure");
		return static_cast<TimePoint>(time.tv_sec)*1000 + time.tv_usec/1000;
	#endif
}

void Sleep(Duration milliseconds) {
	#ifdef _WIN32
		::Sleep(static_cast<DWORD>(milliseconds));
	#else
		timespec time = { static_cast<time_t>(milliseconds/1000),
			static_cast<long>(milliseconds%1000)*1000000 };
		while (nanosleep(&time, &time)) {}
	#endif
}

} // namespace detail
} // namespace webdriverxx

#endif

Fix Win32 implementation of Now()

Fix Win32 implementation of Now()


#pragma once

#include "sajson.h"
#include <ostream>

namespace sajson {
inline std::ostream& operator<<(std::ostream& os, type t) {
    switch (t) {
    case TYPE_INTEGER:
        return os << "<integer>";
    case TYPE_DOUBLE:
        return os << "<double>";
    case TYPE_NULL:
        return os << "<null>";
    case TYPE_FALSE:
        return os << "<false>";
    case TYPE_TRUE:
        return os << "<true>";
    case TYPE_STRING:
        return os << "<string>";
    case TYPE_ARRAY:
        return os << "<array>";
    case TYPE_OBJECT:
        return os << "<object>";
    default:
        return os << "<unknown type";
    }
}
} // namespace sajson

#pragma once

#include "sajson.h"
#include <ostream>

namespace sajson {
inline std::ostream& operator<<(std::ostream& os, type t) {
    switch (t) {
    case TYPE_INTEGER:
        return os << "<integer>";
    case TYPE_DOUBLE:
        return os << "<double>";
    case TYPE_NULL:
        return os << "<null>";
    case TYPE_FALSE:
        return os << "<false>";
    case TYPE_TRUE:
        return os << "<true>";
    case TYPE_STRING:
        return os << "<string>";
    case TYPE_ARRAY:
        return os << "<array>";
    case TYPE_OBJECT:
        return os << "<object>";
    default:
        return os << "<unknown type>";
    }
}
} // namespace sajson

Add missing closing angle bracket

Add missing closing angle bracket


#ifndef SRC_UTILS_CUDA_HELPER_H_

#define SRC_UTILS_CUDA_HELPER_H_

#include <cuda.h>
#include <cuda_runtime.h>
#include <iostream>
#include <stdexcept>

static void HandleError(cudaError_t error, const char *file, int line)
{
  if (error != cudaSuccess)
  {
    printf("%s in %s at line %d\n", cudaGetErrorString(error), file, line);
    throw std::runtime_error(cudaGetErrorString(error));
  }
}

#define HANDLE_ERROR(error) (HandleError(error, __FILE__, __LINE__))

#define HANDLE_NULL(a)                                                         \
  {                                                                            \
    if (a == NULL)                                                             \
    {                                                                          \
      printf("Host memory failed in %s at line %d\n", __FILE__, __LINE__);     \
      exit(EXIT_FAILURE);                                                      \
    }                                                                          \
  }

#endif  // SRC_UTILS_CUDA_HELPER_H_

#ifndef SRC_UTILS_CUDA_HELPER_H_

#define SRC_UTILS_CUDA_HELPER_H_

#include <cuda.h>
#include <cuda_runtime.h>
#include <iostream>
#include <stdexcept>

#define HANDLE_ERROR(error)                                                    \
  {                                                                            \
    if (error != cudaSuccess)                                                  \
    {                                                                          \
      printf("%s in %s at line %d\n", cudaGetErrorString(error), __FILE__,     \
             __LINE__);                                                        \
      throw std::runtime_error(cudaGetErrorString(error));                     \
    }                                                                          \
  }

#define HANDLE_NULL(a)                                                         \
  {                                                                            \
    if (a == NULL)                                                             \
    {                                                                          \
      printf("Host memory failed in %s at line %d\n", __FILE__, __LINE__);     \
      exit(EXIT_FAILURE);                                                      \
    }                                                                          \
  }

#endif  // SRC_UTILS_CUDA_HELPER_H_

Move static function into macro to circumvent unused function waringn-erros.


//---------------------------------------------------------------------------------------
// This file is part of the Lomse library.
// Do not alter layout. Will affect CMakeLists.txt data extraction code
//
//                             | All values aligned here
#define LOMSE_VERSION_MAJOR    0
#define LOMSE_VERSION_MINOR    16
#define LOMSE_VERSION_TYPE     ' '
#define LOMSE_VERSION_PATCH    2
#define LOMSE_VERSION_REVNO    134
#define LOMSE_VERSION_DATE     "2016-01-25 12:41:25 +01:00"

//---------------------------------------------------------------------------------------
// This file is part of the Lomse library.
// Do not alter layout. Will affect CMakeLists.txt data extraction code
//
//                             | All values aligned here
#define LOMSE_VERSION_MAJOR    0
#define LOMSE_VERSION_MINOR    16
#define LOMSE_VERSION_TYPE     ' '
#define LOMSE_VERSION_PATCH    2
#define LOMSE_VERSION_REVNO    139
#define LOMSE_VERSION_DATE     "2016-01-25 13:59:34 +01:00"

Update revno in config file

Update revno in config file


#include <stdlib.h>
#include <stdio.h>
#include <check.h>
#include "check_check.h"

int main (void)
{
  int n;
  SRunner *sr;

  fork_setup();
  setup_fixture();
  sr = srunner_create (make_master_suite());
  srunner_add_suite(sr, make_list_suite());
  srunner_add_suite(sr, make_msg_suite());
  srunner_add_suite(sr, make_log_suite());
  srunner_add_suite(sr, make_limit_suite());
  srunner_add_suite(sr, make_fork_suite());
  srunner_add_suite(sr, make_fixture_suite());
  srunner_add_suite(sr, make_pack_suite());

  setup();
  printf ("Ran %d tests in subordinate suite\n", sub_nfailed);
  srunner_run_all (sr, CK_NORMAL);
  cleanup();
  fork_teardown();
  teardown_fixture();
  n = srunner_ntests_failed(sr);
  srunner_free(sr);
  return (n == 0) ? EXIT_SUCCESS : EXIT_FAILURE;
}

#include <stdlib.h>
#include <stdio.h>
#include <check.h>
#include "check_check.h"

int main (void)
{
  int n;
  SRunner *sr;

  fork_setup();
  setup_fixture();
  sr = srunner_create (make_master_suite());
  srunner_add_suite(sr, make_list_suite());
  srunner_add_suite(sr, make_msg_suite());
  srunner_add_suite(sr, make_log_suite());
  srunner_add_suite(sr, make_limit_suite());
  srunner_add_suite(sr, make_fork_suite());
  srunner_add_suite(sr, make_fixture_suite());
  srunner_add_suite(sr, make_pack_suite());

  setup();
  printf ("Ran %d tests in subordinate suite\n", sub_ntests);
  srunner_run_all (sr, CK_NORMAL);
  cleanup();
  fork_teardown();
  teardown_fixture();
  n = srunner_ntests_failed(sr);
  srunner_free(sr);
  return (n == 0) ? EXIT_SUCCESS : EXIT_FAILURE;
}

Use correct variable for number of tests

git-svn-id: ae38cf1093b87151f738d2b2220cac7742ad2e55@230 64e312b2-a51f-0410-8e61-82d0ca0eb02a


// ucc -g tim.c

_Noreturn void abort()
{
	__builtin_unreachable();
}

void realloc()
{
	int local = 5;
	abort();
}

Debug label inline function bug

Debug label inline function bug


/*! \file
 * \\brief This file is for later use for power management functions as we see fit for them.
 * May not even use at all.
 */

//test test

Revert "added testing comment for testing!"

This reverts commit ffc29b89462973571224e523eaf0c69fef88b1f2.


/*
 * Copyright (c) 2002-2004, Index Data
 * See the file LICENSE for details.
 *
 * $Id: tstnmem.c,v 1.2 2004-09-29 20:15:48 adam Exp $
 */

#if HAVE_CONFIG_H
#include <config.h>
#endif

#include <errno.h>
#include <string.h>
#include <stdlib.h>
#include <ctype.h>

#include <yaz/nmem.h>

int main (int argc, char **argv)
{
    void *cp;
    NMEM n;
    int j;

    nmem_init();
    n = nmem_create();
    if (!n)
        exit (1);
    for (j = 1; j<500; j++)
    {
        cp = nmem_malloc(n, j);
        if (!cp)
            exit(2);
    }

    for (j = 2000; j<20000; j+= 2000)
    {
        cp = nmem_malloc(n, j);
        if (!cp)
            exit(3);
    }
    nmem_destroy(n);
    nmem_exit();
    exit(0);
}

/*
 * Copyright (c) 2002-2004, Index Data
 * See the file LICENSE for details.
 *
 * $Id: tstnmem.c,v 1.3 2005-01-05 10:29:42 adam Exp $
 */

#if HAVE_CONFIG_H
#include <config.h>
#endif

#include <errno.h>
#include <string.h>
#include <stdlib.h>
#include <ctype.h>

#include <yaz/nmem.h>

int main (int argc, char **argv)
{
    void *cp;
    NMEM n;
    int j;

    nmem_init();
    n = nmem_create();
    if (!n)
        exit (1);
    for (j = 1; j<500; j++)
    {
        cp = nmem_malloc(n, j);
        if (!cp)
            exit(2);
	if (sizeof(long) >= j)
	    *(long*) cp = 123L;
#if HAVE_LONG_LONG
	if (sizeof(long long) >= j)
	    *(long long*) cp = 123L;
#endif
	if (sizeof(double) >= j)
	    *(double*) cp = 12.2;
    }

    for (j = 2000; j<20000; j+= 2000)
    {
        cp = nmem_malloc(n, j);
        if (!cp)
            exit(3);
    }
    nmem_destroy(n);
    nmem_exit();
    exit(0);
}

Check that assignments to NMEM memory for some basic types


#define DEFAULT_GETUID		"/lib/udev/scsi_id --whitelisted --device=/dev/%n"
#define DEFAULT_UDEVDIR		"/dev"
#define DEFAULT_MULTIPATHDIR	"/" LIB_STRING "/multipath"
#define DEFAULT_SELECTOR	"round-robin 0"
#define DEFAULT_ALIAS_PREFIX	"mpath"
#define DEFAULT_FEATURES	"0"
#define DEFAULT_HWHANDLER	"0"
#define DEFAULT_MINIO		1000
#define DEFAULT_MINIO_RQ	1
#define DEFAULT_PGPOLICY       FAILOVER
#define DEFAULT_FAILBACK       -FAILBACK_MANUAL
#define DEFAULT_RR_WEIGHT      RR_WEIGHT_NONE
#define DEFAULT_NO_PATH_RETRY  NO_PATH_RETRY_UNDEF
#define DEFAULT_PGTIMEOUT      -PGTIMEOUT_NONE
#define DEFAULT_USER_FRIENDLY_NAMES    0
#define DEFAULT_VERBOSITY	2

#define DEFAULT_CHECKINT	5
#define MAX_CHECKINT(a)		(a << 2)

#define DEFAULT_PIDFILE		"/var/run/multipathd.pid"
#define DEFAULT_SOCKET		"/var/run/multipathd.sock"
#define DEFAULT_CONFIGFILE	"/etc/multipath.conf"
#define DEFAULT_BINDINGS_FILE	"/etc/multipath/bindings"

char * set_default (char * str);

#define DEFAULT_GETUID		"/lib/udev/scsi_id --whitelisted --replace-whitespace --device=/dev/%n"
#define DEFAULT_UDEVDIR		"/dev"
#define DEFAULT_MULTIPATHDIR	"/" LIB_STRING "/multipath"
#define DEFAULT_SELECTOR	"round-robin 0"
#define DEFAULT_ALIAS_PREFIX	"mpath"
#define DEFAULT_FEATURES	"0"
#define DEFAULT_HWHANDLER	"0"
#define DEFAULT_MINIO		1000
#define DEFAULT_MINIO_RQ	1
#define DEFAULT_PGPOLICY       FAILOVER
#define DEFAULT_FAILBACK       -FAILBACK_MANUAL
#define DEFAULT_RR_WEIGHT      RR_WEIGHT_NONE
#define DEFAULT_NO_PATH_RETRY  NO_PATH_RETRY_UNDEF
#define DEFAULT_PGTIMEOUT      -PGTIMEOUT_NONE
#define DEFAULT_USER_FRIENDLY_NAMES    0
#define DEFAULT_VERBOSITY	2

#define DEFAULT_CHECKINT	5
#define MAX_CHECKINT(a)		(a << 2)

#define DEFAULT_PIDFILE		"/var/run/multipathd.pid"
#define DEFAULT_SOCKET		"/var/run/multipathd.sock"
#define DEFAULT_CONFIGFILE	"/etc/multipath.conf"
#define DEFAULT_BINDINGS_FILE	"/etc/multipath/bindings"

char * set_default (char * str);

Use '--replace-whitespace' option for scsi_id

Some SCSI devices will return an identifier with spaces in it.
As we're using this name as the default device-mapper name we
should be reformatting it to replace all spaces with underscores
so as not to confuse device-mapper.

References: bnc#572209

Signed-off-by: Hannes Reinecke <b0d1e9e4a4e27620745ff49be9000da3174a4cc6@suse.de>


#include "lily_impl.h"
#include "lily_symtab.h"
#include "lily_opcode.h"

static void builtin_print(lily_symbol *s)
{
    if (s->val_type == vt_str)
        lily_impl_send_html(((lily_strval *)s->sym_value)->str);
}

void lily_vm_execute(lily_symbol *sym)
{
    lily_symbol **regs;
    int *code, ci;

    regs = lily_impl_malloc(8 * sizeof(lily_symbol *));
    code = sym->code_data->code;
    ci = 0;

    while (1) {
        switch (code[ci]) {
            case o_load_reg:
                regs[code[ci+1]] = (lily_symbol *)code[ci+2];
                ci += 3;
                break;
            case o_builtin_print:
                builtin_print(regs[code[ci+1]]);
                ci += 2;
            case o_assign:
                regs[code[ci]]->sym_value = (void *)code[ci+1];
                regs[code[ci]]->val_type = (lily_val_type)code[ci+2];
                ci += 3;
            case o_vm_return:
                free(regs);
                return;
        }
    }
}

#include "lily_impl.h"
#include "lily_symtab.h"
#include "lily_opcode.h"

static void builtin_print(lily_symbol *s)
{
    if (s->val_type == vt_str)
        lily_impl_send_html(((lily_strval *)s->sym_value)->str);
}

void lily_vm_execute(lily_symbol *sym)
{
    lily_symbol **regs;
    int *code, ci;

    regs = lily_impl_malloc(8 * sizeof(lily_symbol *));
    code = sym->code_data->code;
    ci = 0;

    while (1) {
        switch (code[ci]) {
            case o_load_reg:
                regs[code[ci+1]] = (lily_symbol *)code[ci+2];
                ci += 3;
                break;
            case o_builtin_print:
                builtin_print(regs[code[ci+1]]);
                ci += 2;
                break;
            case o_assign:
                regs[code[ci]]->sym_value = (void *)code[ci+1];
                regs[code[ci]]->val_type = (lily_val_type)code[ci+2];
                ci += 3;
                break;
            case o_vm_return:
                free(regs);
                return;
        }
    }
}

vm: Fix o_builtin_print and o_assign cases not breaking.

This was causing the hello_world.ly test to segfault.


// RUN: %llvmgcc %s -S -fnested-functions -o - | grep {sret *%agg.result}

struct X { int m, n, o, p; };

struct X p(int n) {
  struct X c(int m) {
    struct X x;
    x.m = m;
    x.n = n;
    return x;
  }
  return c(n);
}

// RUN: %llvmgcc %s -S -fnested-functions -o - | grep {sret *%agg.result}

struct X { long m, n, o, p; };

struct X p(int n) {
  struct X c(int m) {
    struct X x;
    x.m = m;
    x.n = n;
    return x;
  }
  return c(n);
}

Make the struct bigger, to ensure it is returned
by struct return.

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


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

void main() {
  // requires bigint, not int64
  unsigned long long x, y, z;
  if (x < y && y < z) {
    assert(x < y);
    assert(y < z);
    assert(x < z);

    if (18446744073709551612ull <= x && z <= 18446744073709551615ull) {
      assert(18446744073709551612ull <= x);
      assert(x <= 18446744073709551613ull);
      assert(18446744073709551613ull <= y);
      assert(y <= 18446744073709551614ull);
      assert(18446744073709551614ull <= z);
      assert(z <= 18446744073709551615ull);

      assert(x >= x - x); // avoid base from answering to check if octApron doesn't say x == -3
      assert(y >= y - y); // avoid base from answering to check if octApron doesn't say y == -3
      assert(z >= z - z); // avoid base from answering to check if octApron doesn't say z == -3
    }
  }
}

Add octApron test where bigint is required


//
//  orbit_platforms.h
//  OrbitVM
//
//  Created by Cesar Parent on 2016-11-14.
//  Copyright © 2016 cesarparent. All rights reserved.
//
#ifndef OrbitPlatforms_h
#define OrbitPlatforms_h

#if __STDC_VERSION__ >= 199901L
#define ORBIT_FLEXIBLE_ARRAY_MEMB
#else
#define ORBIT_FLEXIBLE_ARRRAY_MEMB  0
#endif

#endif /* OrbitPlatforms_h */

//
//  orbit_platforms.h
//  OrbitVM
//
//  Created by Cesar Parent on 2016-11-14.
//  Copyright © 2016 cesarparent. All rights reserved.
//
#ifndef OrbitPlatforms_h
#define OrbitPlatforms_h

#ifdef _WIN32
#define ORBIT_PLATFORM "Windows"
#elif __APPLE__
#include "TargetConditionals.h"
#if TARGET_IPHONE_SIMULATOR
#define ORBIT_PLATFORM "iOS-x86"
#elif TARGET_OS_IPHONE
#define ORBIT_PLATFORM "iOS-arm"
#elif TARGET_OS_MAC
#define ORBIT_PLATFORM "macOS"
#endif
#elif __linux__
#define ORBIT_PLATFORM "Linux"
#elif __unix__
#define ORBIT_PLATFORM "UNIX"
#else
#define ORBIT_PLATFORM "Unknown Platform"
#endif

#if __STDC_VERSION__ >= 199901L
#define ORBIT_FLEXIBLE_ARRAY_MEMB
#else
#define ORBIT_FLEXIBLE_ARRRAY_MEMB  0
#endif

#endif /* OrbitPlatforms_h */

Add platform names in orbit_platform.h

Add platform names in orbit_platform.h


/* Stub file provided for C extensions that expect it. All regular
 * defines and prototypes are in ruby.h
 */

#define RUBY

/* These are defines directly related to MRI C-API symbols that the
 * mkmf.rb discovery code (e.g. have_func("rb_str_set_len")) would
 * attempt to find by linking against libruby. Rubinius does not
 * have an appropriate lib to link against, so we are adding these
 * explicit defines for now.
 */
#define HAVE_RB_STR_SET_LEN
#define HAVE_RB_DEFINE_ALLOC_FUNC

Define HAVE_RB_DEFINE_ALLOC_FUNC for postgres gem.


#if __GNUC__ >= 4 && __GNUC_MINOR__ >= 6
#define ACQUIRE_IMAGE_PIXELS(im, x, y, w, h, ex) ({ \
    _Pragma("GCC diagnostic push") \
    _Pragma("GCC diagnostic ignored \"-Wdeprecated-declarations\"") \
    AcquireImagePixels(im, x, y, w, h, ex); \
    _Pragma("GCC diagnostic pop") \
})
#else
#define ACQUIRE_IMAGE_PIXELS(im, x, y, w, h, ex) AcquireImagePixels(im, x, y, w, h, ex)
#endif

#if (__GNUC__ == 4 && __GNUC_MINOR__ >= 6) || (__GNUC__ > 4)
#define ACQUIRE_IMAGE_PIXELS(im, x, y, w, h, ex) ({ \
    _Pragma("GCC diagnostic push") \
    _Pragma("GCC diagnostic ignored \"-Wdeprecated-declarations\"") \
    AcquireImagePixels(im, x, y, w, h, ex); \
    _Pragma("GCC diagnostic pop") \
})
#else
#define ACQUIRE_IMAGE_PIXELS(im, x, y, w, h, ex) AcquireImagePixels(im, x, y, w, h, ex)
#endif

Fix warnings building with GCC 5

Fix warnings building with GCC 5


typedef NS_ENUM(NSInteger, StatsSection) {
    StatsSectionGraph,
    StatsSectionPeriodHeader,
    StatsSectionEvents,
    StatsSectionPosts,
    StatsSectionReferrers,
    StatsSectionClicks,
    StatsSectionCountry,
    StatsSectionVideos,
    StatsSectionComments,
    StatsSectionTagsCategories,
    StatsSectionFollowers,
    StatsSectionPublicize,
    StatsSectionWebVersion
};

typedef NS_ENUM(NSInteger, StatsSubSection) {
    StatsSubSectionCommentsByAuthor = 100,
    StatsSubSectionCommentsByPosts,
    StatsSubSectionFollowersDotCom,
    StatsSubSectionFollowersEmail,
    StatsSubSectionNone
};

typedef NS_ENUM(NSInteger, StatsSection) {
    StatsSectionGraph,
    StatsSectionPeriodHeader,
    StatsSectionEvents,
    StatsSectionPosts,
    StatsSectionReferrers,
    StatsSectionClicks,
    StatsSectionCountry,
    StatsSectionVideos,
    StatsSectionAuthors,
    StatsSectionSearchTerms,
    StatsSectionComments,
    StatsSectionTagsCategories,
    StatsSectionFollowers,
    StatsSectionPublicize,
    StatsSectionWebVersion
};

typedef NS_ENUM(NSInteger, StatsSubSection) {
    StatsSubSectionCommentsByAuthor = 100,
    StatsSubSectionCommentsByPosts,
    StatsSubSectionFollowersDotCom,
    StatsSubSectionFollowersEmail,
    StatsSubSectionNone
};

Add search terms and authors section to enum


/// \file task_graph.h
/// Defines the TaskGraph class
/// \author A0112054Y

#pragma once
#ifndef YOU_QUERYENGINE_INTERNAL_TASK_GRAPH_H_
#define YOU_QUERYENGINE_INTERNAL_TASK_GRAPH_H_

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

namespace You {
namespace QueryEngine {
namespace Internal {

/// Defines the task dependency graph
class TaskGraph {
};

}  // namespace Internal
}  // namespace QueryEngine
}  // namespace You

#endif  // YOU_QUERYENGINE_INTERNAL_TASK_GRAPH_H_

Add the stub for task graph

Add the stub for task graph


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

#include "../marquise.h"

void test_hash_identifier() {
	const char *id = "hostname:fe1.example.com,metric:BytesUsed,service:memory,";
	size_t id_len = strlen(id);
	uint64_t address = marquise_hash_identifier((const unsigned char*) id, id_len);
	g_assert_cmpint(address, ==, 7602883380529707052);
}

int main(int argc, char **argv) {
	g_test_init(&argc, &argv, NULL);
	g_test_add_func("/marquise_hash_identifier/hash", test_hash_identifier);
	return g_test_run();
}

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

#include "../marquise.h"

void test_hash_identifier() {
	const char *id = "hostname:fe1.example.com,metric:BytesUsed,service:memory,";
	size_t id_len = strlen(id);
	uint64_t address = marquise_hash_identifier((const unsigned char*) id, id_len);
	g_assert_cmpint(address, ==, 7602883380529707052);
}

void test_hash_clear_lsb() {
	const char *id = "bytes:tx,collection_point:syd1,ip:110.173.152.33,";
	size_t id_len = strlen(id);
	uint64_t address = marquise_hash_identifier((const unsigned char*) id, id_len);
	g_assert_cmpint(address, ==, -8873247187777138600);
}

int main(int argc, char **argv) {
	g_test_init(&argc, &argv, NULL);
	g_test_add_func("/marquise_hash_identifier/hash", test_hash_identifier);
	g_test_add_func("/marquise_hash_identifier/clear_lsb", test_hash_clear_lsb);
	return g_test_run();
}

Add test for LSB-clearing in marquise_hash_identifier


#include "some_struct.h"
void foo() {
  struct X x;
  x.

// RUN: CINDEXTEST_EDITING=1 c-index-test -code-completion-at=%s:4:5 -Xclang -code-completion-patterns  %s | FileCheck -check-prefix=CHECK-CC1 %s
// CHECK-CC1: FieldDecl:{ResultType int}{TypedText m} (35) (parent: StructDecl 'X')

#include "some_struct.h"
void foo() {
  struct X x;
  x.

// RUN: env CINDEXTEST_EDITING=1 c-index-test -code-completion-at=%s:4:5 -Xclang -code-completion-patterns  %s | FileCheck -check-prefix=CHECK-CC1 %s
// CHECK-CC1: FieldDecl:{ResultType int}{TypedText m} (35) (parent: StructDecl 'X')

Add 'env' in hopes of making this test pass on Windows.

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


/** Author : Paul TREHIOU & Victor SENE
 *  Date : November 2014
 **/

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

/**
 * Declaration Point structure
 * x - real wich is the abscisse of the point
 * y - real wich is the ordinate of the point
 */
typedef struct
{
	double x;
 	double y;
}Point;

/**
 * Declaration of the Element structure
 * value - value of the point of the current element of the polygon
 * next - pointer on the next element
 * previous - pointer on the previous element
 */
typedef struct pointelem{

	Point value;
	struct pointelem* next;
	struct pointelem* previous;

}PointElement;

/**
 * Declaration of the Polygon
 */
typedef struct {

	PointElement* head;
	int size;

}Polygon;

/**
 * Function wich create a point with a specified abscisse and ordinate
 * abscisse - real
 * ordinate - real
 * return a new point
 */
Point createPoint(double abscisse, double ordinate);

/**
 * Function wich create a new empty Polygon
 * return the new empty polygon
 */
Polygon createPolygon();

/**
 * Function wich add a point at the end of an existing polygon
 * inpoly - Polygon
 * inpoint - Point
 * return a new polygon
 */
Polygon addPoint(Polygon inpoly, Point inpoint);

/**
 * Function wich remove a point at a given place in an existing polygon
 * inpoly - Polygon
 * index - int
 * return a new polygon
 */
Polygon removePoint(Polygon inpoly, int index);

Add the prototype for removePoint

Add the prototype for removePoint


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

#ifndef WEBKIT_GLUE_WEBKIT_CONSTANTS_H_
#define WEBKIT_GLUE_WEBKIT_CONSTANTS_H_

namespace webkit_glue {

// Chromium sets the minimum interval timeout to 4ms, overriding the
// default of 10ms.  We'd like to go lower, however there are poorly
// coded websites out there which do create CPU-spinning loops.  Using
// 4ms prevents the CPU from spinning too busily and provides a balance
// between CPU spinning and the smallest possible interval timer.
const double kForegroundTabTimerInterval = 0.004;

// Provides control over the minimum timer interval for background tabs.
const double kBackgroundTabTimerInterval = 1.0;

} // namespace webkit_glue

#endif  // WEBKIT_GLUE_WEBKIT_CONSTANTS_H_

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

#ifndef WEBKIT_GLUE_WEBKIT_CONSTANTS_H_
#define WEBKIT_GLUE_WEBKIT_CONSTANTS_H_

namespace webkit_glue {

// Chromium sets the minimum interval timeout to 4ms, overriding the
// default of 10ms.  We'd like to go lower, however there are poorly
// coded websites out there which do create CPU-spinning loops.  Using
// 4ms prevents the CPU from spinning too busily and provides a balance
// between CPU spinning and the smallest possible interval timer.
const double kForegroundTabTimerInterval = 0.004;

// Provides control over the minimum timer interval for background tabs.
const double kBackgroundTabTimerInterval = 0.004;

} // namespace webkit_glue

#endif  // WEBKIT_GLUE_WEBKIT_CONSTANTS_H_

Revert 75430 because it's causing failures in dom_checker_tests.
: Increase the minimum interval for timers on background tabs to reduce
their CPU consumption.

The new interval is 1000 ms, or once per second. We can easily adjust
this value up or down, but this seems like a reasonable value to judge
the compatibility impact of this change.

BUG=66078
TEST=none (tested manually with minimal test case)

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

TBR=kbr@google.com
Review URL: http://codereview.chromium.org/6538073

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


// ext/foo/foo_vector.h

// Declarations for wrapped struct

#ifndef FOO_VECTOR_H
#define FOO_VECTOR_H

#include <ruby.h>
#include <math.h>

// Ruby 1.8.7 compatibility patch
#ifndef DBL2NUM
#define DBL2NUM( dbl_val ) rb_float_new( dbl_val )
#endif

void init_foo_vector( VALUE parent_module );

// This is the struct that the rest of the code wraps
typedef struct _fv {
    double x;
    double y;
    double z;
  } FVStruct;

#endif

// ext/foo/foo_vector.h

// Declarations for wrapped struct

#ifndef FOO_VECTOR_H
#define FOO_VECTOR_H

#include <ruby.h>
#include <math.h>

// Ruby 1.8.7 compatibility patch
#ifndef DBL2NUM
#define DBL2NUM( dbl_val ) rb_float_new( dbl_val )
#endif

void init_foo_vector( VALUE parent_module );

// This is the struct that the rest of the code wraps
typedef struct _fv {
    double x;
    double y;
    double z;
  } FVStruct;

FVStruct *create_fv_struct();
void destroy_fv_struct( FVStruct *fv );
FVStruct *copy_fv_struct( FVStruct *orig );
double fv_magnitude( FVStruct *fv );

#endif

Add sharable methods to header file

Add sharable methods to header file


#ifdef USE_INSTANT_OSX

#include "hitimes_interval.h"
#include <mach/mach.h>
#include <mach/mach_time.h>

/* All this OSX code is adapted from http://developer.apple.com/library/mac/#qa/qa1398/_index.html */

/*
 * returns the conversion factor, this value is used to convert
 * the value from hitimes_get_current_instant() into seconds
 */
long double hitimes_instant_conversion_factor()
{
    static mach_timebase_info_data_t  s_timebase_info;
    static long double                conversion_factor;

    /**
     * If this is the first time we've run, get the timebase.
     * We can use denom == 0 to indicate that s_timebase_info is
     * uninitialised because it makes no sense to have a zero
     * denominator is a fraction.
     */

    if ( s_timebase_info.denom == 0 ) {
        (void) mach_timebase_info(&s_timebase_info);
        uint64_t nano_conversion = s_timebase_info.numer / s_timebase_info.denom;
        conversion_factor        = (long double) (nano_conversion) * (1e9l);
    }

    return conversion_factor;
}

/*
 * returns the mach absolute time, which has no meaning outside of a conversion
 * factor.
 */
hitimes_instant_t hitimes_get_current_instant()
{
    return mach_absolute_time();
}

#endif

#ifdef USE_INSTANT_OSX

#include "hitimes_interval.h"
#include <mach/mach.h>
#include <mach/mach_time.h>

/* All this OSX code is adapted from http://developer.apple.com/library/mac/#qa/qa1398/_index.html */

/*
 * returns the conversion factor, this value is used to convert
 * the value from hitimes_get_current_instant() into seconds
 */
long double hitimes_instant_conversion_factor()
{
    static mach_timebase_info_data_t  s_timebase_info;
    static long double                conversion_factor;
    static uint64_t                   nano_conversion;

    /**
     * If this is the first time we've run, get the timebase.
     * We can use denom == 0 to indicate that s_timebase_info is
     * uninitialised because it makes no sense to have a zero
     * denominator is a fraction.
     */

    if ( s_timebase_info.denom == 0 ) {
        mach_timebase_info(&s_timebase_info);
        nano_conversion   = s_timebase_info.numer / s_timebase_info.denom;
        conversion_factor = (long double) (nano_conversion) * (1e9l);
    }

    return conversion_factor;
}

/*
 * returns the mach absolute time, which has no meaning outside of a conversion
 * factor.
 */
hitimes_instant_t hitimes_get_current_instant()
{
    return mach_absolute_time();
}

#endif

Clean up C Compiler warning about declaration of variables.


/* r-svd-impute.h
 */

#ifndef _R_SVD_IMPUTE_H
#define _R_SVD_IMPUTE_H

SEXP R_svd_impute (SEXP xx, SEXP KK, SEXP tol, SEXP maxiter);

#endif /* _R_SVD_IMPUTE_H */

/* r-svd-impute.h
 */

#ifndef _R_SVD_IMPUTE_H
#define _R_SVD_IMPUTE_H

SEXP R_svd_impute (SEXP x, SEXP k, SEXP tol, SEXP maxiter);

#endif /* _R_SVD_IMPUTE_H */

Fix parameter names for svd.impute

Fix parameter names for svd.impute


/**
 *  machina
 *
 *  Copyright (c) 2011, drmats
 *  All rights reserved.
 *
 *  https://github.com/drmats/machina
 */

#ifndef __PLATFORM_H_
#define __PLATFORM_H_ 1

#if defined(linux) || defined(__linux) || defined(__linux__)
#undef __LINUX__
#define __LINUX__   1
#endif
#if defined(WIN32) || defined(_WIN32)
#undef __WIN32__
#define __WIN32__   1
#endif

#ifdef __WIN32__
#pragma warning( disable : 4290 )
#endif

#endif

/**
 *  machina
 *
 *  Copyright (c) 2011, drmats
 *  All rights reserved.
 *
 *  https://github.com/drmats/machina
 */

#ifndef __PLATFORM_H_
#define __PLATFORM_H_ 1

#if defined(linux) || defined(__linux) || defined(__linux__)
#undef __LINUX__
#define __LINUX__   1
#endif
#if defined(WIN32) || defined(_WIN32)
#undef __WIN32__
#define __WIN32__   1
#endif

#if defined(__WIN32__) && defined(_MSC_VER)
#pragma warning( disable : 4290 )
#endif

#endif

Disable function exception specification warning only in cl (Visual Studio).


#include <Python.h>

static PyObject* websocket_mask(PyObject* self, PyObject* args) {
    const char* mask;
    int mask_len;
    const char* data;
    int data_len;
    int i;

    if (!PyArg_ParseTuple(args, "s#s#", &mask, &mask_len, &data, &data_len)) {
        return NULL;
    }

    PyObject* result = PyBytes_FromStringAndSize(NULL, data_len);
    if (!result) {
        return NULL;
    }
    char* buf = PyBytes_AsString(result);
    for (i = 0; i < data_len; i++) {
        buf[i] = data[i] ^ mask[i % 4];
    }

    return result;
}

static PyMethodDef methods[] = {
    {"websocket_mask",  websocket_mask, METH_VARARGS, ""},
    {NULL, NULL, 0, NULL}
};

#if PY_MAJOR_VERSION >= 3
static struct PyModuleDef speedupsmodule = {
   PyModuleDef_HEAD_INIT,
   "speedups",
   NULL,
   -1,
   methods
};

PyMODINIT_FUNC
PyInit_speedups() {
    return PyModule_Create(&speedupsmodule);
}
#else  // Python 2.x
PyMODINIT_FUNC
initspeedups() {
    Py_InitModule("tornado.speedups", methods);
}
#endif

#define PY_SSIZE_T_CLEAN
#include <Python.h>

static PyObject* websocket_mask(PyObject* self, PyObject* args) {
    const char* mask;
    Py_ssize_t mask_len;
    const char* data;
    Py_ssize_t data_len;
    Py_ssize_t i;
    PyObject* result;
    char* buf;

    if (!PyArg_ParseTuple(args, "s#s#", &mask, &mask_len, &data, &data_len)) {
        return NULL;
    }

    result = PyBytes_FromStringAndSize(NULL, data_len);
    if (!result) {
        return NULL;
    }
    buf = PyBytes_AsString(result);
    for (i = 0; i < data_len; i++) {
        buf[i] = data[i] ^ mask[i % 4];
    }

    return result;
}

static PyMethodDef methods[] = {
    {"websocket_mask",  websocket_mask, METH_VARARGS, ""},
    {NULL, NULL, 0, NULL}
};

#if PY_MAJOR_VERSION >= 3
static struct PyModuleDef speedupsmodule = {
   PyModuleDef_HEAD_INIT,
   "speedups",
   NULL,
   -1,
   methods
};

PyMODINIT_FUNC
PyInit_speedups() {
    return PyModule_Create(&speedupsmodule);
}
#else  // Python 2.x
PyMODINIT_FUNC
initspeedups() {
    Py_InitModule("tornado.speedups", methods);
}
#endif

Fix msvc compile error and improve 64 bit compatibility


/* Return the copyright string.  This is updated manually. */

#include "Python.h"

static char cprt[] =
"Copyright (c) 2000 BeOpen.com.\n\
All Rights Reserved.\n\
\n\
Copyright (c) 1995-2000 Corporation for National Research Initiatives.\n\
All Rights Reserved.\n\
\n\
Copyright (c) 1991-1995 Stichting Mathematisch Centrum, Amsterdam.\n\
All Rights Reserved.";

const char *
Py_GetCopyright(void)
{
	return cprt;
}

/* Return the copyright string.  This is updated manually. */

#include "Python.h"

static char cprt[] =
"\
Copyright (c) 2000, 2001 Guido van Rossum.\n\
All Rights Reserved.\n\
\n\
Copyright (c) 2000 BeOpen.com.\n\
All Rights Reserved.\n\
\n\
Copyright (c) 1995-2000 Corporation for National Research Initiatives.\n\
All Rights Reserved.\n\
\n\
Copyright (c) 1991-1995 Stichting Mathematisch Centrum, Amsterdam.\n\
All Rights Reserved.";

const char *
Py_GetCopyright(void)
{
	return cprt;
}

Add my name to the copyright notice.

Add my name to the copyright notice.


/*
Copyright (c) 2013 Daniele Bartolini, Michele Rossi
Copyright (c) 2012 Daniele Bartolini, Simone Boscaratto

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

#pragma once

#include "Types.h"

namespace crown
{

/// Represents an event fired by the OS
enum OsEventType
{
	OSET_NONE				= 0,

	OSET_KEY_PRESS			= 1,
	OSET_KEY_RELEASE		= 2,

	OSET_BUTTON_PRESS		= 3,
	OSET_BUTTON_RELEASE		= 4,

	OSET_MOTION_NOTIFY		= 5,
	OSET_TOUCH_DOWN			= 6,
	OSET_TOUCH_MOVE			= 7,
	OSET_TOUCH_UP			= 8,

	OSET_ACCELEROMETER		= 9
};

/// Represents an event fired by mouse.
struct OsMouseEvent
{
	uint32_t button;
	uint32_t x;
	uint32_t y;
};

/// Represents an event fired by keyboard.
struct OsKeyboardEvent
{
	uint32_t key;
	uint32_t modifier;
};

/// Represents an event fired by touch screen.
struct OsTouchEvent
{
	uint32_t pointer_id;
	uint32_t x;
	uint32_t y;
};

/// Represents an event fired by accelerometer.
struct OsAccelerometerEvent
{
	float x;
	float y;
	float z;
};

} // namespace crown

Fix documentation: DO NOT USE __ to emphasize text


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

#ifndef OZONE_PLATFORM_OZONE_PLATFORM_WAYLAND_H_
#define OZONE_PLATFORM_OZONE_PLATFORM_WAYLAND_H_

namespace ui {

class OzonePlatform;

// Constructor hook for use in ozone_platform_list.cc
OzonePlatform* CreateOzonePlatformWayland();

}  // namespace ui

#endif  // OZONE_PLATFORM_OZONE_PLATFORM_WAYLAND_H_

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

#ifndef OZONE_PLATFORM_OZONE_PLATFORM_WAYLAND_H_
#define OZONE_PLATFORM_OZONE_PLATFORM_WAYLAND_H_

#include "ozone/platform/ozone_export_wayland.h"

namespace ui {

class OzonePlatform;

// Constructor hook for use in ozone_platform_list.cc
OZONE_WAYLAND_EXPORT OzonePlatform* CreateOzonePlatformWayland();

}  // namespace ui

#endif  // OZONE_PLATFORM_OZONE_PLATFORM_WAYLAND_H_

Fix shared_component build for Ozone platform.

This patch makes necessary changes in Ozone Wayland code base to fix
shared_component build.


/*
 * Describes all ncp_lib kernel functions
 *
 * $FreeBSD$
 */
#ifndef _NCP_MOD_H_
#define _NCP_MOD_H_

/* order of calls in syscall table relative to offset in system table */
#define	NCP_SE(callno)		(callno+sysentoffset)
#define	NCP_CONNSCAN		NCP_SE(0)
#define	NCP_CONNECT		NCP_SE(1)
#define	NCP_INTFN		NCP_SE(2)
#define	SNCP_REQUEST		NCP_SE(3)

#endif /* !_NCP_MOD_H_ */

Add missing newline at end of file.

Add missing newline at end of file.


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

#ifndef CONTENT_COMMON_GPU_SURFACE_HANDLE_TYPES_MAC_H_
#define CONTENT_COMMON_GPU_SURFACE_HANDLE_TYPES_MAC_H_

#include <OpenGL/CGLIOSurface.h>

#include "base/basictypes.h"
#include "ui/base/cocoa/remote_layer_api.h"

namespace content {

// The surface handle passed between the GPU and browser process may refer to
// an IOSurface or a CAContext. These helper functions must be used to identify
// and translate between the types.
enum SurfaceHandleType {
  kSurfaceHandleTypeInvalid,
  kSurfaceHandleTypeIOSurface,
  kSurfaceHandleTypeCAContext,
};

SurfaceHandleType GetSurfaceHandleType(uint64 surface_handle);

CAContextID CAContextIDFromSurfaceHandle(uint64 surface_handle);
IOSurfaceID IOSurfaceIDFromSurfaceHandle(uint64 surface_handle);

uint64 SurfaceHandleFromIOSurfaceID(IOSurfaceID io_surface_id);
uint64 SurfaceHandleFromCAContextID(CAContextID ca_context_id);

}  //  namespace content

#endif // CONTENT_COMMON_GPU_HANDLE_TYPES_MAC_H_

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

#ifndef CONTENT_COMMON_GPU_SURFACE_HANDLE_TYPES_MAC_H_
#define CONTENT_COMMON_GPU_SURFACE_HANDLE_TYPES_MAC_H_

#include <IOSurface/IOSurface.h>
#include <OpenGL/CGLIOSurface.h>

#include "base/basictypes.h"
#include "ui/base/cocoa/remote_layer_api.h"

namespace content {

// The surface handle passed between the GPU and browser process may refer to
// an IOSurface or a CAContext. These helper functions must be used to identify
// and translate between the types.
enum SurfaceHandleType {
  kSurfaceHandleTypeInvalid,
  kSurfaceHandleTypeIOSurface,
  kSurfaceHandleTypeCAContext,
};

SurfaceHandleType GetSurfaceHandleType(uint64 surface_handle);

CAContextID CAContextIDFromSurfaceHandle(uint64 surface_handle);
IOSurfaceID IOSurfaceIDFromSurfaceHandle(uint64 surface_handle);

uint64 SurfaceHandleFromIOSurfaceID(IOSurfaceID io_surface_id);
uint64 SurfaceHandleFromCAContextID(CAContextID ca_context_id);

}  //  namespace content

#endif // CONTENT_COMMON_GPU_HANDLE_TYPES_MAC_H_

Fix build on OSX 10.9.

Fix build on OSX 10.9.

This fixes a build error on OSX 10.9 introduced by
https://codereview.chromium.org/347653005/

BUG=388160
TBR=ccameron@chromium.org,piman@chromium.org,avi@chromium.org

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

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


#pragma once

// const float in a header file can lead to duplication of the storage
// but I don't really care in this case. Just don't do it with a header
// that is included hundreds of times.
const float kCurrentVersion = 1.45f;

// Put a "#define VERSION_SUFFIX 'b'" line here to add a minor version
// increment that won't trigger the new-version checks, handy for minor
// releases that I don't want to bother users about.
//#define VERSION_SUFFIX 'b'

#pragma once

// const float in a header file can lead to duplication of the storage
// but I don't really care in this case. Just don't do it with a header
// that is included hundreds of times.
const float kCurrentVersion = 1.46f;

// Put a "#define VERSION_SUFFIX 'b'" line here to add a minor version
// increment that won't trigger the new-version checks, handy for minor
// releases that I don't want to bother users about.
//#define VERSION_SUFFIX 'b'

Increase version to 1.46 in preparation for new release


#ifndef __parse_type_h__
#define __parse_type_h__

typedef enum
{
	PARSE_TYPE_NONE,
	PARSE_TYPE_LOGICAL,
	PARSE_TYPE_CHARACTER,
	PARSE_TYPE_INTEGER,
	PARSE_TYPE_REAL,
	PARSE_TYPE_COMPLEX,
	PARSE_TYPE_BYTE,
} parse_type_e;

typedef struct
{
	parse_type_e type;
	unsigned     kind;
	unsigned     count;
} parse_type_t;

static const parse_type_t PARSE_TYPE_INTEGER_DEFAULT =
{
	.type  = PARSE_TYPE_INTEGER,
	.kind  = 0,
	.count = 0,
};

static const parse_type_t PARSE_TYPE_REAL_DEFAULT =
{
	.type  = PARSE_TYPE_REAL,
	.kind  = 0,
	.count = 0,
};

unsigned parse_type(
	const sparse_t* src, const char* ptr,
	parse_type_t* type);

#endif

#ifndef __parse_type_h__
#define __parse_type_h__

typedef enum
{
	PARSE_TYPE_NONE,
	PARSE_TYPE_LOGICAL,
	PARSE_TYPE_CHARACTER,
	PARSE_TYPE_INTEGER,
	PARSE_TYPE_REAL,
	PARSE_TYPE_COMPLEX,
	PARSE_TYPE_BYTE,
} parse_type_e;

typedef struct
{
	parse_type_e type;
	unsigned     kind;
	unsigned     count;
} parse_type_t;

#define PARSE_TYPE_INTEGER_DEFAULT (parse_type_t)\
{\
	.type  = PARSE_TYPE_INTEGER,\
	.kind  = 0,\
	.count = 0,\
}

#define PARSE_TYPE_REAL_DEFAULT (parse_type_t)\
{\
	.type  = PARSE_TYPE_REAL,\
	.kind  = 0,\
	.count = 0,\
}

unsigned parse_type(
	const sparse_t* src, const char* ptr,
	parse_type_t* type);

#endif

Fix issue with static consts

Fix issue with static consts


#pragma once

#include <core.h>

#define DHT22_PIN 6
#define DHT22_SAMPLE_RATE 3000

#define TEMPORATURE_TARGET (204)

#define HEATER_PIN 10
#define HEATER_ACTION_DELAY (15*60) // minimal seconds to open/close heater, prevent switch heater too frequently.

// pin connect to 315/433 transmitter
#define TRANSMIT_PIN 8

// Log temperature and humidity every 5mins
#define TEMPE_HUMI_LOG_INTERVAL ((uint32_t)5 * 60 * 1000)

#define DISPLAY_PIN1 5
#define DISPLAY_PIN2 4
#define DISPLAY_PIN3 3
#define DISPLAY_PIN4 2
#define DISPLAY_PIN5 11
#define DISPLAY_PIN6 12

extern core::idType idTempe, idHumi;

// Set digital value idHeaterReq to turn on/off, heater module
// has a throttle inside to prevent turn on/off too frequently,
// idHeaterAct digtial value is the heater actual state.
extern core::idType idHeaterReq, idHeaterAct;

#define KEY_MODE_PIN 7
#define KEY_UP_PIN 9
#define KEY_DOWN_PIN 10
#define KEY_SETUP_PIN 13

extern core::idType idKeyMode, idKeyUp, idKeyDown, idKeySetup;

#pragma once

#include <core.h>

#define DHT22_PIN 6
#define DHT22_SAMPLE_RATE 3000

#define TEMPORATURE_TARGET (204)

#define HEATER_PIN 10
#define HEATER_ACTION_DELAY (15*60) // minimal seconds to open/close heater, prevent switch heater too frequently.

// pin connect to 315/433 transmitter
#define TRANSMIT_PIN 8

// Log temperature and humidity every 5mins
#define TEMPE_HUMI_LOG_INTERVAL ((uint32_t)5 * 60 * 1000)

#define DISPLAY_PIN1 5
#define DISPLAY_PIN2 4
#define DISPLAY_PIN3 3
#define DISPLAY_PIN4 2
#define DISPLAY_PIN5 11
#define DISPLAY_PIN6 12

extern core::idType idTempe, idHumi;

// Set digital value idHeaterReq to turn on/off, heater module
// has a throttle inside to prevent turn on/off too frequently,
// idHeaterAct digtial value is the heater actual state.
extern core::idType idHeaterReq, idHeaterAct;

#define KEY_MODE_PIN 7
#define KEY_UP_PIN 9
#define KEY_DOWN_PIN A0
#define KEY_SETUP_PIN 13

extern core::idType idKeyMode, idKeyUp, idKeyDown, idKeySetup;

Use A0 instead 10 as button down input PIN

All digital pins are used, 10 used by heater relay, so borrow an analog
input pin.


// PARAM: --set trans.activated[+] "assert"

// Running the assert transformation on this test yields in code that is not compilable by gcc
struct s {
    int a;
    int b;
};

union u {
    struct s str;
    int i;
};

int main(){
    union u un;

    struct s* ptr;

    un.str.a = 1;
    un.str.b = 2;

    ptr = &un.str;
    int r;
    int x;
    if(r){
        x = 2;
    } else {
        x = 3;
    }

    return 0;
}

Add test case for invariant generation for unions.


#ifndef CONSTANTS_H
#define CONSTANTS_H

#if !defined(__STDC__) && !defined(__cplusplus)
#define const
#endif

/*
	Set up a boolean variable type.  Since this definition could conflict
	with other reasonable definition of BOOLEAN, i.e. using an enumeration,
	it is conditional.
*/
#ifndef BOOLEAN_TYPE_DEFINED
typedef int BOOLEAN;
#endif

#if defined(TRUE)
#	undef TRUE
#	undef FALSE
#endif

static const int	TRUE = 1;
static const int	FALSE = 0;

/*
	Useful constants for turning seconds into larger units of time.  Since
	these constants may have already been defined elsewhere, they are
	conditional.
*/
#ifndef TIME_CONSTANTS_DEFINED
static const int	MINUTE = 60;
static const int	HOUR = 60 * 60;
static const int	DAY = 24 * 60 * 60;
#endif

/*
  This is for use with strcmp() and related functions which will return
  0 upon a match.
*/
#ifndef MATCH
static const int	MATCH = 0;
#endif
#endif

#ifndef CONSTANTS_H
#define CONSTANTS_H

#if !defined(__STDC__) && !defined(__cplusplus)
#define const
#endif

/*
	Set up a boolean variable type.  Since this definition could conflict
	with other reasonable definition of BOOLEAN, i.e. using an enumeration,
	it is conditional.
*/
#ifndef BOOLEAN_TYPE_DEFINED
typedef int BOOLEAN;
typedef int BOOL;
#endif

#if defined(TRUE)
#	undef TRUE
#	undef FALSE
#endif

static const int	TRUE = 1;
static const int	FALSE = 0;

/*
	Useful constants for turning seconds into larger units of time.  Since
	these constants may have already been defined elsewhere, they are
	conditional.
*/
#ifndef TIME_CONSTANTS_DEFINED
static const int	MINUTE = 60;
static const int	HOUR = 60 * 60;
static const int	DAY = 24 * 60 * 60;
#endif

/*
  This is for use with strcmp() and related functions which will return
  0 upon a match.
*/
#ifndef MATCH
static const int	MATCH = 0;
#endif
#endif

Add BOOL typedef becuase BOOLEAN is too verbose.


/* Copyright 2020 The TensorFlow Authors. All Rights Reserved.

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

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

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

#include "tensorflow/lite/kernels/register.h"

#endif  // TENSORFLOW_LITE_CORE_SHIMS_CC_KERNELS_REGISTER_H_

/* Copyright 2020 The TensorFlow Authors. All Rights Reserved.

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

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

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

#include "tensorflow/lite/kernels/register.h"

namespace tflite_shims {
namespace ops {
namespace builtin {
using BuiltinOpResolver = ::tflite::ops::builtin::BuiltinOpResolver;
}  // namespace builtin
}  // namespace ops
}  // namespace tflite_shims

#endif  // TENSORFLOW_LITE_CORE_SHIMS_CC_KERNELS_REGISTER_H_

Fix wrong namespace in recently-added shim header.

PiperOrigin-RevId: 344072784
Change-Id: I8e1de38f2bb932afd9e905551953f45046db45c9


#ifdef GNU_VARIADIC
#  define FOO(args...)    do { foo(args); } while (0)
#else
#  define FOO(...)    do { foo(__VA_ARGS__); } while (0)
#endif

#define BAR(x)  FOO("x"); FOO(")");

void
foo(char *a)
{
	BAR();
}

Add cpp comment stripping bug

Add cpp comment stripping bug


struct S {
    int a;
};

struct S foo () {
    struct S s;
    int i;
    s.a = i;
    return s;
}

int main()
{
    int u;
    u = foo().a;
}

Test case for returning structs by value (missing from previous checkin)


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

typedef  int32_t s32_t;
typedef uint32_t u32_t;
typedef  int16_t s16_t;
typedef uint16_t u16_t;
typedef   int8_t s8_t;
typedef  uint8_t u8_t;
typedef long long ptrdiff_t;

#define offsetof(type, member)  __builtin_offsetof (type, member)

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

typedef  int32_t s32_t;
typedef uint32_t u32_t;
typedef  int16_t s16_t;
typedef uint16_t u16_t;
typedef   int8_t s8_t;
typedef  uint8_t u8_t;

#ifndef __CYGWIN__
typedef long long ptrdiff_t;
#define offsetof(type, member)  __builtin_offsetof (type, member)
#endif

Add cygwin support for compiling spiffsimg


Add Hamming weigth in C

Add Hamming weigth in C


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

#ifndef CHROME_BROWSER_EXTENSIONS_EXTENSION_MESSAGE_HANDLER_H_
#define CHROME_BROWSER_EXTENSIONS_EXTENSION_MESSAGE_HANDLER_H_
#pragma once

#include "content/browser/renderer_host/render_view_host_observer.h"

class Profile;
struct ExtensionHostMsg_DomMessage_Params;

// Filters and dispatches extension-related IPC messages that arrive from
// renderer/extension processes.  This object is created for renderers and also
// ExtensionHost/BackgroundContents.  Contrast this with ExtensionTabHelper,
// which is only created for TabContents.
class ExtensionMessageHandler : public RenderViewHostObserver {
 public:
  // |sender| is guaranteed to outlive this object.
  explicit ExtensionMessageHandler(RenderViewHost* render_view_host);
  virtual ~ExtensionMessageHandler();

  // RenderViewHostObserver overrides.
  virtual bool OnMessageReceived(const IPC::Message& message);

 private:
  // Message handlers.
  void OnPostMessage(int port_id, const std::string& message);
  void OnRequest(const ExtensionHostMsg_DomMessage_Params& params);

  DISALLOW_COPY_AND_ASSIGN(ExtensionMessageHandler);
};

#endif  // CHROME_BROWSER_EXTENSIONS_EXTENSION_MESSAGE_HANDLER_H_

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

#ifndef CHROME_BROWSER_EXTENSIONS_EXTENSION_MESSAGE_HANDLER_H_
#define CHROME_BROWSER_EXTENSIONS_EXTENSION_MESSAGE_HANDLER_H_
#pragma once

#include "content/browser/renderer_host/render_view_host_observer.h"

class Profile;
struct ExtensionHostMsg_DomMessage_Params;

// Filters and dispatches extension-related IPC messages that arrive from
// renderers. There is one of these objects for each RenderViewHost in Chrome.
// Contrast this with ExtensionTabHelper, which is only created for TabContents.
class ExtensionMessageHandler : public RenderViewHostObserver {
 public:
  // |sender| is guaranteed to outlive this object.
  explicit ExtensionMessageHandler(RenderViewHost* render_view_host);
  virtual ~ExtensionMessageHandler();

  // RenderViewHostObserver overrides.
  virtual bool OnMessageReceived(const IPC::Message& message);

 private:
  // Message handlers.
  void OnPostMessage(int port_id, const std::string& message);
  void OnRequest(const ExtensionHostMsg_DomMessage_Params& params);

  DISALLOW_COPY_AND_ASSIGN(ExtensionMessageHandler);
};

#endif  // CHROME_BROWSER_EXTENSIONS_EXTENSION_MESSAGE_HANDLER_H_

Clarify class comment for ExtensionMessageHandler.

TBR=jam@chromium.org

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


// RUN: not %clang -o /dev/null -v -fxray-instrument -c %s
// XFAIL: -linux-
// REQUIRES-ANY: amd64, x86_64, x86_64h, arm, aarch64, arm64
typedef int a;

// RUN: not %clang -o /dev/null -v -fxray-instrument -c %s
// XFAIL: -linux-
// REQUIRES: amd64 || x86_64 || x86_64h || arm || aarch64 || arm64
typedef int a;

[test] Replace `REQUIRES-ANY: a, b, c` with `REQUIRES: a || b || c`.

Requires the new `lit` boolean expressions in LLVM r292896.

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


#pragma once

class VolumeTransformation {
public:
    /// <summary>
    /// Transforms a given volume level to a new ("virtual") level based on a
    /// formula or set of rules (e.g., a volume curve transformation).
    /// </summary>
    virtual float Apply(float vol) = 0;

    /// <summary>
    /// Given a transformed ("virtual") volume value, this function reverts it
    /// back to its original value (assuming the given value was produced
    /// by the ToVirtual() function).
    /// </summary>
    virtual float Revert(float vol) = 0;
};

#pragma once

class VolumeTransformation {
public:
    /// <summary>
    /// Transforms a given volume level to a new ("virtual") level based on a
    /// formula or set of rules (e.g., a volume curve transformation).
    /// </summary>
    virtual float Apply(float vol) = 0;

    /// <summary>
    /// Given a transformed ("virtual") volume value, this function reverts it
    /// back to its original value (assuming the given value was produced
    /// by the ToVirtual() function).
    /// </summary>
    virtual float Revert(float vol) = 0;

    /// <summary>
    /// Applies several transformations supplied as a vector to the initial
    /// value provided. The transformations are applied in order of appearance
    /// in the vector.
    /// </summary>
    static float ApplyTransformations(
            std::vector<VolumeTransformation *> &transforms, float initialVal) {
        float newVal = initialVal;
        for (VolumeTransformation *trans : transforms) {
            newVal = trans->Apply(newVal);
        }
        return newVal;
    }

    /// <summary>
    /// Reverts several transformations, starting with a transformed ("virtual")
    /// value. This method reverts the transformations in reverse order.
    /// </summary>
    static float RevertTransformations(
            std::vector<VolumeTransformation *> &transforms, float virtVal) {
        float newVal = virtVal;
        for (auto it = transforms.rbegin(); it != transforms.rend(); ++it) {
            newVal = (*it)->Revert(newVal);
        }
        return newVal;
    }
};

Add methods to apply multiple transformations


//Declarations for master types

typedef enum
{
	Register = 0
} MODBUSDataType; //MODBUS data types enum (coil, register, input, etc.)

typedef struct
{
	uint8_t Address; //Device address
	uint8_t Code; //Exception code
} MODBUSExceptionLog; //Parsed exception data

typedef struct
{
	uint8_t Address; //Device address
	MODBUSDataType DataType; //Data type
	uint16_t Register; //Register, coil, input ID
	uint16_t Value; //Value of data
} MODBUSData;

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

typedef struct
{
	MODBUSData *Data; //Data read from slave
	MODBUSExceptionLog Exception; //Optional exception read
	MODBUSRequestStatus Request; //Formatted request for slave
	uint8_t DataLength; //Count of data type instances read from slave
	uint8_t Error; //Have any error occured?
} MODBUSMasterStatus; //Type containing master device configuration data

//Declarations for master types

typedef enum
{
	Register = 0
} MODBUSDataType; //MODBUS data types enum (coil, register, input, etc.)

typedef struct
{
	uint8_t Address; //Device address
	uint8_t Function; //Function called, in which exception occured
	uint8_t Code; //Exception code
} MODBUSExceptionLog; //Parsed exception data

typedef struct
{
	uint8_t Address; //Device address
	MODBUSDataType DataType; //Data type
	uint16_t Register; //Register, coil, input ID
	uint16_t Value; //Value of data
} MODBUSData;

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

typedef struct
{
	MODBUSData *Data; //Data read from slave
	MODBUSExceptionLog Exception; //Optional exception read
	MODBUSRequestStatus Request; //Formatted request for slave
	uint8_t DataLength; //Count of data type instances read from slave
	uint8_t Error; //Have any error occured?
} MODBUSMasterStatus; //Type containing master device configuration data

Add function ID member in MODBUSExceptionLog structure


// RUN: %clang_analyze_cc1 -analyzer-checker=unix.StdCLibraryFunctions -verify %s
// RUN: %clang_analyze_cc1 -triple i686-unknown-linux -analyzer-checker=unix.StdCLibraryFunctions -verify %s
// RUN: %clang_analyze_cc1 -triple x86_64-unknown-linux -analyzer-checker=unix.StdCLibraryFunctions -verify %s
// RUN: %clang_analyze_cc1 -triple armv7-a15-linux -analyzer-checker=unix.StdCLibraryFunctions -verify %s
// RUN: %clang_analyze_cc1 -triple thumbv7-a15-linux -analyzer-checker=unix.StdCLibraryFunctions -verify %s

// This test tests crashes that occur when standard functions are available
// for inlining.

// expected-no-diagnostics

int isdigit(int _) { return !0; }
void test_redefined_isdigit(int x) {
  int (*func)(int) = isdigit;
  for (; func(x);) // no-crash
    ;
}

Add a test forgotten in r339088.

[analyzer] Add a test forgotten in r339088.

Differential Revision: https://reviews.llvm.org/D50363

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


#ifndef DICT_H_
#define DICT_H_

#include <cassert>
#include <cstring>
#include <tr1/unordered_map>
#include <string>
#include <vector>

#include <boost/functional/hash.hpp>

#include "wordid.h"

class Dict {
 typedef std::tr1::unordered_map<std::string, WordID, boost::hash<std::string> > Map;
 public:
  Dict() : b0_("<bad0>") { words_.reserve(1000); }
  inline int max() const { return words_.size(); }
  inline WordID Convert(const std::string& word, bool frozen = false) {
    Map::iterator i = d_.find(word);
    if (i == d_.end()) {
      if (frozen)
        return 0;
      words_.push_back(word);
      d_[word] = words_.size();
      return words_.size();
    } else {
      return i->second;
    }
  }
  inline const std::string& Convert(const WordID& id) const {
    if (id == 0) return b0_;
    assert(id <= words_.size());
    return words_[id-1];
  }
  void clear() { words_.clear(); d_.clear(); }
 private:
  const std::string b0_;
  std::vector<std::string> words_;
  Map d_;
};

#endif

#ifndef DICT_H_
#define DICT_H_

#include <cassert>
#include <cstring>
#include <tr1/unordered_map>
#include <string>
#include <vector>

#include <boost/functional/hash.hpp>

#include "wordid.h"

class Dict {
 typedef std::tr1::unordered_map<std::string, WordID, boost::hash<std::string> > Map;

 public:
  Dict() : b0_("<bad0>") { words_.reserve(1000); }

  inline int max() const { return words_.size(); }

  inline WordID Convert(const std::string& word, bool frozen = false) {
    Map::iterator i = d_.find(word);
    if (i == d_.end()) {
      if (frozen)
        return 0;
      words_.push_back(word);
      d_[word] = words_.size();
      return words_.size();
    } else {
      return i->second;
    }
  }

  inline WordID Convert(const std::vector<std::string>& words, bool frozen = false) {
    std::string word= "";
    for (std::vector<std::string>::const_iterator it=words.begin();
         it != words.end(); ++it) {
      if (it != words.begin()) word += "__";
      word += *it;
    }

    return Convert(word, frozen);
  }

  inline const std::string& Convert(const WordID& id) const {
    if (id == 0) return b0_;
    assert(id <= words_.size());
    return words_[id-1];
  }

  void clear() { words_.clear(); d_.clear(); }

 private:
  const std::string b0_;
  std::vector<std::string> words_;
  Map d_;
};

#endif

Update utility functions to work with pyp-topics.

git-svn-id: 357248c53bdac2d7b36f7ee045286eb205fcf757@49 ec762483-ff6d-05da-a07a-a48fb63a330f


#include "bayesian.h"
namespace baysian {

class bayesianNetwork : public bayesian {
 private:
  long double ***cpt;
  double *classCount;  // this array store the total number of each
                       // decision's class in training data
  int *discrete;
  int *classNum;  // this array store the number of classes of each attribute
  int **parent;

 public:
  bayesianNetwork(char *);
  ~bayesianNetwork();
  // initialize all the information we need from training data
  void predict(char *);
  // calculate the probability of each choice and choose the greatest one as our
  // prediction
  void train(char *);
};

template <class Type>
struct data {
  double key;
  Type value1;
  Type value2;
};

}  // namespace baysian

#include "bayesian.h"
namespace baysian {

class bayesianNetwork : public bayesian {
 private:
  long double ***cpt;
  int **parent;

 public:
  bayesianNetwork(char *);
  ~bayesianNetwork();
  // initialize all the information we need from training data
  void predict(char *);
  // calculate the probability of each choice and choose the greatest one as our
  // prediction
  void train(char *);
};

template <class Type>
struct data {
  double key;
  Type value1;
  Type value2;
};

}  // namespace baysian

Move variable to base class

Move variable to base class


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

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

Update Skia milestone to 98

Update Skia milestone to 98

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


// rdar://6533411
// RUN: %clang -MD -MF %t.d -S -x c -o %t.o %s
// RUN: grep '.*dependency-gen.*:' %t.d
// RUN: grep 'dependency-gen.c' %t.d

// RUN: %clang -S -M -x c %s -o %t.d
// RUN: grep '.*dependency-gen.*:' %t.d
// RUN: grep 'dependency-gen.c' %t.d

// PR8974
// XFAIL: win32
// RUN: rm -rf %t.dir
// RUN: mkdir %t.dir
// RUN: echo > %t.dir/x.h
// RUN: %clang -include %t.dir/x.h -MD -MF %t.d -S -x c -o %t.o %s
// RUN: grep ' %t.dir/x.h' %t.d

// rdar://6533411
// RUN: %clang -MD -MF %t.d -S -x c -o %t.o %s
// RUN: grep '.*dependency-gen.*:' %t.d
// RUN: grep 'dependency-gen.c' %t.d

// RUN: %clang -S -M -x c %s -o %t.d
// RUN: grep '.*dependency-gen.*:' %t.d
// RUN: grep 'dependency-gen.c' %t.d

// PR8974
// XFAIL: win32
// RUN: rm -rf %t.dir
// RUN: mkdir -p %t.dir/a/b
// RUN: echo > %t.dir/a/b/x.h
// RUN: cd %t.dir
// RUN: %clang -include a/b/x.h -MD -MF %t.d -S -x c -o %t.o %s
// RUN: grep ' a/b/x\.h' %t.d

Tweak this test a bit further to make it easier on grep. Who knows what
characters get dropped into the regular expression from %t.

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


#ifndef MALLOCCACHE_H
#define MALLOCCACHE_H

template <size_t blockSize, size_t blockCount>
class MallocCache
{
public:
    MallocCache()
       : m_blocksCached(0)
    {
    }

    ~MallocCache()
    {
        assert(m_blocksCached >= 0 && m_blocksCached <= blockCount);
        for (size_t i = 0; i < m_blocksCached; i++) {
            ::free(m_blocks[i]);
        }
    }

    void *allocate()
    {
        assert(m_blocksCached >= 0 && m_blocksCached <= blockCount);
        if (m_blocksCached) {
            return m_blocks[--m_blocksCached];
        } else {
            return ::malloc(blockSize);
        }
    }

    void free(void *allocation)
    {
        assert(m_blocksCached >= 0 && m_blocksCached <= blockCount);
        if (m_blocksCached < blockCount) {
            m_blocks[m_blocksCached++] = allocation;
        } else {
            ::free(allocation);
        }
    }

private:
    void *m_blocks[blockCount];
    size_t m_blocksCached;
};

#endif MALLOCCACHE_H

#ifndef MALLOCCACHE_H
#define MALLOCCACHE_H

template <size_t blockSize, size_t blockCount>
class MallocCache
{
public:
    MallocCache()
       : m_blocksCached(0)
    {
    }

    ~MallocCache()
    {
        assert(m_blocksCached >= 0 && m_blocksCached <= blockCount);
        for (size_t i = 0; i < m_blocksCached; i++) {
            ::free(m_blocks[i]);
        }
    }

    void *allocate()
    {
        assert(m_blocksCached >= 0 && m_blocksCached <= blockCount);
        if (m_blocksCached) {
            return m_blocks[--m_blocksCached];
        } else {
            return ::malloc(blockSize);
        }
    }

    void free(void *allocation)
    {
        assert(m_blocksCached >= 0 && m_blocksCached <= blockCount);
        if (m_blocksCached < blockCount) {
            m_blocks[m_blocksCached++] = allocation;
        } else {
            ::free(allocation);
        }
    }

private:
    void *m_blocks[blockCount];
    size_t m_blocksCached;
};

#endif // MALLOCCACHE_H

Fix a preprocessor syntax error. Strangely, the file still compiled.


#ifndef HALIDE__build___wrapper_fusion_o_h
#define HALIDE__build___wrapper_fusion_o_h

#include <coli/utils.h>

#ifdef __cplusplus
extern "C" {
#endif

int fusion_coli(buffer_t *_b_input_buffer, buffer_t *_b_output_f_buffer, buffer_t *_b_output_g_buffer) HALIDE_FUNCTION_ATTRS;
int fusion_coli_argv(void **args) HALIDE_FUNCTION_ATTRS;
int fusion_ref(buffer_t *_b_input_buffer, buffer_t *_b_output_f_buffer, buffer_t *_b_output_g_buffer) HALIDE_FUNCTION_ATTRS;
int fusion_ref_argv(void **args) HALIDE_FUNCTION_ATTRS;
// Result is never null and points to constant static data
const struct halide_filter_metadata_t *fusion_coli_metadata() HALIDE_FUNCTION_ATTRS;
const struct halide_filter_metadata_t *fusion_ref_metadata() HALIDE_FUNCTION_ATTRS;

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

#ifndef HALIDE__build___wrapper_fusion_o_h
#define HALIDE__build___wrapper_fusion_o_h

#include <coli/utils.h>

#ifdef __cplusplus
extern "C" {
#endif

int fusion_coli(buffer_t *_b_input_buffer, buffer_t *_b_output_f_buffer, buffer_t *_b_output_g_buffer, buffer_t *_b_output_h_buffer, buffer_t *_b_output_k_buffer) HALIDE_FUNCTION_ATTRS;
int fusion_coli_argv(void **args) HALIDE_FUNCTION_ATTRS;
int fusion_ref(buffer_t *_b_input_buffer, buffer_t *_b_output_f_buffer, buffer_t *_b_output_g_buffer, buffer_t *_b_output_h_buffer, buffer_t *_b_output_k_buffer) HALIDE_FUNCTION_ATTRS;
int fusion_ref_argv(void **args) HALIDE_FUNCTION_ATTRS;
// Result is never null and points to constant static data
const struct halide_filter_metadata_t *fusion_coli_metadata() HALIDE_FUNCTION_ATTRS;
const struct halide_filter_metadata_t *fusion_ref_metadata() HALIDE_FUNCTION_ATTRS;

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

Update wrapper fusion header file

Update wrapper fusion header file


#ifndef _TSLIB_PRIVATE_H_
#define _TSLIB_PRIVATE_H_
/*
 *  tslib/src/tslib-private.h
 *
 *  Copyright (C) 2001 Russell King.
 *
 * This file is placed under the LGPL.
 *
 *
 * Internal touch screen library definitions.
 */
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */

#include "tslib.h"
#include "tslib-filter.h"

struct tsdev {
	int fd;
	struct tslib_module_info *list;
	struct tslib_module_info *list_raw; /* points to position in 'list' where raw reads
					       come from.  default is the position of the
					       ts_read_raw module. */
	unsigned int res_x;
	unsigned int res_y;
	int rotation;
};

int __ts_attach(struct tsdev *ts, struct tslib_module_info *info);
int __ts_attach_raw(struct tsdev *ts, struct tslib_module_info *info);
int ts_load_module(struct tsdev *dev, const char *module, const char *params);
int ts_load_module_raw(struct tsdev *dev, const char *module, const char *params);
int ts_error(const char *fmt, ...);

#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* _TSLIB_PRIVATE_H_ */

#ifndef _TSLIB_PRIVATE_H_
#define _TSLIB_PRIVATE_H_
/*
 *  tslib/src/tslib-private.h
 *
 *  Copyright (C) 2001 Russell King.
 *
 * This file is placed under the LGPL.
 *
 *
 * Internal touch screen library definitions.
 */
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */

#include "tslib.h"
#include "tslib-filter.h"

#define DEBUG

struct tsdev {
	int fd;
	struct tslib_module_info *list;
	struct tslib_module_info *list_raw; /* points to position in 'list' where raw reads
					       come from.  default is the position of the
					       ts_read_raw module. */
	unsigned int res_x;
	unsigned int res_y;
	int rotation;
};

int __ts_attach(struct tsdev *ts, struct tslib_module_info *info);
int __ts_attach_raw(struct tsdev *ts, struct tslib_module_info *info);
int ts_load_module(struct tsdev *dev, const char *module, const char *params);
int ts_load_module_raw(struct tsdev *dev, const char *module, const char *params);
int ts_error(const char *fmt, ...);

#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* _TSLIB_PRIVATE_H_ */

Enable debug option for all components

Enable debug option for all components


#ifndef OS_COMMON_H_
#define OS_COMMON_H_

#include <stddef.h>
#include <fcntl.h>
#include <io.h>
#include <stdio.h>

/*
 * MinGW lfind() and friends use `unsigned int *` where they should use a
 * `size_t *` according to the man page.
 */
typedef unsigned int lfind_size_t;

// timeradd doesn't exist on MinGW
#ifndef timeradd
#define timeradd(a, b, result) \
    do { \
        (result)->tv_sec  = (a)->tv_sec  + (b)->tv_sec; \
        (result)->tv_usec = (a)->tv_usec + (b)->tv_usec; \
        (result)->tv_sec += (result)->tv_usec / 1000000; \
        (result)->tv_usec %= 1000000; \
    } while (0) \
    //
#endif

struct param_state;

char *os_find_self(const char *);
FILE *os_fopen(const char *, const char *);
int os_get_tsimrc_path(char buf[], size_t sz);
long os_getpagesize(void);
int os_preamble(void);
int os_set_buffering(FILE *stream, int mode);

#endif

/* vi: set ts=4 sw=4 et: */

#ifndef OS_COMMON_H_
#define OS_COMMON_H_

#include <stddef.h>
#include <fcntl.h>
#include <io.h>
#include <stdio.h>
#include <sys/time.h>

/*
 * MinGW lfind() and friends use `unsigned int *` where they should use a
 * `size_t *` according to the man page.
 */
typedef unsigned int lfind_size_t;

// timeradd doesn't exist on MinGW
#ifndef timeradd
#define timeradd timeradd

static inline void timeradd(struct timeval *a, struct timeval *b,
                            struct timeval *result)
{
    result->tv_sec  = a->tv_sec  + b->tv_sec;
    result->tv_usec = a->tv_usec + b->tv_usec;
    result->tv_sec += result->tv_usec / 1000000;
    result->tv_usec %= 1000000;
}

#endif

struct param_state;

char *os_find_self(const char *);
FILE *os_fopen(const char *, const char *);
int os_get_tsimrc_path(char buf[], size_t sz);
long os_getpagesize(void);
int os_preamble(void);
int os_set_buffering(FILE *stream, int mode);

#endif

/* vi: set ts=4 sw=4 et: */

Implement timeradd as an inline function


// Copyright 2019 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
//
//     http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

#import <Foundation/Foundation.h>

#import <GoogleMobileAds/GADAdNetworkExtras.h>

@interface VungleAdNetworkExtras : NSObject<GADAdNetworkExtras>

/*!
 * @brief NSString with user identifier that will be passed if the ad is incentivized.
 * @discussion Optional. The value passed as 'user' in the an incentivized server-to-server call.
 */
@property(nonatomic, copy) NSString *_Nullable userId;

/*!
 * @brief Controls whether presented ads will start in a muted state or not.
 */
@property(nonatomic, assign) BOOL muted;

@property(nonatomic, assign) NSUInteger ordinal;

@property(nonatomic, assign) NSTimeInterval flexViewAutoDismissSeconds;

@property(nonatomic, copy) NSArray<NSString *> *_Nullable allPlacements;

@property(nonatomic, copy) NSString *_Nullable playingPlacement;

@end

// Copyright 2019 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
//
//     http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

#import <Foundation/Foundation.h>

#import <GoogleMobileAds/GADAdNetworkExtras.h>

@interface VungleAdNetworkExtras : NSObject<GADAdNetworkExtras>

/*!
 * @brief NSString with user identifier that will be passed if the ad is incentivized.
 * @discussion Optional. The value passed as 'user' in the an incentivized server-to-server call.
 */
@property(nonatomic, copy) NSString *_Nullable userId;

/*!
 * @brief Controls whether presented ads will start in a muted state or not.
 */
@property(nonatomic, assign) BOOL muted;

@property(nonatomic, assign) NSUInteger ordinal;

@property(nonatomic, assign) NSTimeInterval flexViewAutoDismissSeconds;

@property(nonatomic, copy) NSArray<NSString *> *_Nullable allPlacements;

@property(nonatomic, copy) NSString *_Nullable playingPlacement;

@property(nonatomic, copy) NSNumber *_Nullable orientations;

@end

Add video orientation to play ad option

Add video orientation to play ad option


#ifndef HELLOW_IOCTL_H
#define HELLOW_IOCTL_H

#define HWM_LOG_OFF  0xff00
#define HWM_LOG_ON   0xff01

#endif

#ifndef HELLOW_IOCTL_H
#define HELLOW_IOCTL_H

#define HWM_LOG_OFF           0xff00
#define HWM_LOG_ON            0xff01
#define HWM_GET_LOG_ENT_SIZE  0xff02
#define HWM_GET_LOG_ENT       0xff03

#endif

Add macros for ioctl fetching of log data.


#import "ARArtworkMasonryModule.h"
#import "ARArtworkViewController.h"

typedef NS_ENUM(NSInteger, ARRelatedArtworksSubviewOrder) {
    ARRelatedArtworksSameShow = 1,
    ARRelatedArtworksSameFair,
    ARRelatedArtworksSameAuction,
    ARRelatedArtworksArtistArtworks,
    ARRelatedArtworks,
};

@class ARArtworkRelatedArtworksView;

@protocol ARArtworkRelatedArtworksViewParentViewController <NSObject>

@required
- (void)relatedArtworksView:(ARArtworkRelatedArtworksView *)view shouldShowViewController:(UIViewController *)viewController;
- (void)relatedArtworksView:(ARArtworkRelatedArtworksView *)view didAddSection:(UIView *)section;
@optional

- (Fair *)fair;
@end

@interface ARArtworkRelatedArtworksView : ORTagBasedAutoStackView <ARArtworkMasonryLayoutProvider>

@property (nonatomic, weak) ARArtworkViewController<ARArtworkRelatedArtworksViewParentViewController> *parentViewController;

- (void)cancelRequests;

- (void)updateWithArtwork:(Artwork *)artwork;
- (void)updateWithArtwork:(Artwork *)artwork withCompletion:(void(^)())completion;

// TODO make all these private

// Use this when showing an artwork in the context of a fair.
- (void)addSectionsForFair:(Fair *)fair;

// Use this when showing an artwork in the context of a show.
- (void)addSectionsForShow:(PartnerShow *)show;

// Use this when showing an artwork in the context of an auction.
- (void)addSectionsForAuction:(Sale *)auction;

// In all other cases, this should be used to simply show related artworks.
- (void)addSectionWithRelatedArtworks;

@end

#import "ARArtworkMasonryModule.h"
#import "ARArtworkViewController.h"

typedef NS_ENUM(NSInteger, ARRelatedArtworksSubviewOrder) {
    ARRelatedArtworksSameShow = 1,
    ARRelatedArtworksSameFair,
    ARRelatedArtworksSameAuction,
    ARRelatedArtworksArtistArtworks,
    ARRelatedArtworks,
};

@class ARArtworkRelatedArtworksView;

@protocol ARArtworkRelatedArtworksViewParentViewController <NSObject>

@required
- (void)relatedArtworksView:(ARArtworkRelatedArtworksView *)view shouldShowViewController:(UIViewController *)viewController;
- (void)relatedArtworksView:(ARArtworkRelatedArtworksView *)view didAddSection:(UIView *)section;
@optional

- (Fair *)fair;
@end

@interface ARArtworkRelatedArtworksView : ORTagBasedAutoStackView <ARArtworkMasonryLayoutProvider>

@property (nonatomic, weak) ARArtworkViewController<ARArtworkRelatedArtworksViewParentViewController> *parentViewController;

- (void)cancelRequests;

- (void)updateWithArtwork:(Artwork *)artwork;
- (void)updateWithArtwork:(Artwork *)artwork withCompletion:(void(^)())completion;

@end

[Artwork] Make adding related works sections private.