// Written by Arthur O'Dwyer

#pragma once

template <class Lambda>
class AtScopeExit {
  Lambda& m_lambda;

 public:
  AtScopeExit(Lambda& action) : m_lambda(action) {}
  ~AtScopeExit() { m_lambda(); }
};

#define Auto_INTERNAL2(lname, aname, ...) \
  auto lname = [&]() { __VA_ARGS__; };    \
  AtScopeExit<decltype(lname)> aname(lname);

#define Auto_TOKENPASTE(x, y) Auto_##x##y

#define Auto_INTERNAL1(ctr, ...)                                               \
  Auto_INTERNAL2(Auto_TOKENPASTE(func_, ctr), Auto_TOKENPASTE(instance_, ctr), \
                 __VA_ARGS__)

#define Auto(...) Auto_INTERNAL1(__COUNTER__, __VA_ARGS__)

FEAT: Add a very simple finalizer implementation


/**
 * Copyright (c) 2015-present, Facebook, Inc.
 * All rights reserved.
 *
 * This source code is licensed under the BSD-style license found in the
 * LICENSE file in the root directory of this source tree. An additional grant
 * of patent rights can be found in the PATENTS file in the same directory.
 */

#import <UIKit/UIKit.h>

#import "../../ReactKit/Base/RCTBridgeModule.h"

@interface RCTPushNotificationManager : NSObject <RCTBridgeModule>

- (instancetype)initWithInitialNotification:(NSDictionary *)initialNotification NS_DESIGNATED_INITIALIZER;

+ (void)application:(UIApplication *)application didRegisterUserNotificationSettings:(UIUserNotificationSettings *)notificationSettings;
+ (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)notification;
+ (BOOL)application:(UIApplication *)application openURL:(NSURL *)url sourceApplication:(NSString *)sourceApplication annotation:(id)annotation;

@end

/**
 * Copyright (c) 2015-present, Facebook, Inc.
 * All rights reserved.
 *
 * This source code is licensed under the BSD-style license found in the
 * LICENSE file in the root directory of this source tree. An additional grant
 * of patent rights can be found in the PATENTS file in the same directory.
 */

#import <UIKit/UIKit.h>

#import "RCTBridgeModule.h"

@interface RCTPushNotificationManager : NSObject <RCTBridgeModule>

- (instancetype)initWithInitialNotification:(NSDictionary *)initialNotification NS_DESIGNATED_INITIALIZER;

+ (void)application:(UIApplication *)application didRegisterUserNotificationSettings:(UIUserNotificationSettings *)notificationSettings;
+ (void)application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)notification;
+ (BOOL)application:(UIApplication *)application openURL:(NSURL *)url sourceApplication:(NSString *)sourceApplication annotation:(id)annotation;

@end

Fix build - remove relative import path

Fix build - remove relative import path


#ifndef LINUX_POWERPC_PERF_HV_COMMON_H_
#define LINUX_POWERPC_PERF_HV_COMMON_H_

#include <linux/types.h>

struct hv_perf_caps {
	u16 version;
	u16 collect_privileged:1,
	    ga:1,
	    expanded:1,
	    lab:1,
	    unused:12;
};

unsigned long hv_perf_caps_get(struct hv_perf_caps *caps);

#endif

#ifndef LINUX_POWERPC_PERF_HV_COMMON_H_
#define LINUX_POWERPC_PERF_HV_COMMON_H_

#include <linux/perf_event.h>
#include <linux/types.h>

struct hv_perf_caps {
	u16 version;
	u16 collect_privileged:1,
	    ga:1,
	    expanded:1,
	    lab:1,
	    unused:12;
};

unsigned long hv_perf_caps_get(struct hv_perf_caps *caps);

#define EVENT_DEFINE_RANGE_FORMAT(name, attr_var, bit_start, bit_end)	\
PMU_FORMAT_ATTR(name, #attr_var ":" #bit_start "-" #bit_end);		\
EVENT_DEFINE_RANGE(name, attr_var, bit_start, bit_end)

#define EVENT_DEFINE_RANGE(name, attr_var, bit_start, bit_end)	\
static u64 event_get_##name##_max(void)					\
{									\
	BUILD_BUG_ON((bit_start > bit_end)				\
		    || (bit_end >= (sizeof(1ull) * 8)));		\
	return (((1ull << (bit_end - bit_start)) - 1) << 1) + 1;	\
}									\
static u64 event_get_##name(struct perf_event *event)			\
{									\
	return (event->attr.attr_var >> (bit_start)) &			\
		event_get_##name##_max();				\
}

#endif

powerpc/perf: Add macros for defining event fields & formats

Add two macros which generate functions to extract the relevent bits
from event->attr.config{,1,2}.

EVENT_DEFINE_RANGE() defines an accessor for a range of bits in the
event, as well as a "max" function that gives the maximum value of the
field based on the bit width.

EVENT_DEFINE_RANGE_FORMAT() defines the accessor & max routine and also
a format attribute for use in the PMU's attr_groups.

Signed-off-by: Cody P Schafer <c4fe2b1d90ef8f2548c8aeabfa633434316f0305@linux.vnet.ibm.com>
[mpe: move to powerpc, ugly but descriptive macro names]
Signed-off-by: Michael Ellerman <864f124608374e06e4da1fa5d2e47ed839b95411@ellerman.id.au>
Signed-off-by: Benjamin Herrenschmidt <a7089bb6e7e92505d88aaff006cbdd60cc9120b6@kernel.crashing.org>


#include <polygon.h>

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

	Polygon lol;

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

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

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

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

	return EXIT_SUCCESS;

}

#include <polygon.h>

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

	Polygon lol;

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

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

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

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

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

	return EXIT_SUCCESS;

}

Print the size of the polygon

Print the size of the polygon


#import <Foundation/Foundation.h>

#ifndef CMHErrors_h
#define CMHErrors_h

static NSString *const CMHErrorDomain = @"CMHErrorDomain";

typedef NS_ENUM(NSUInteger, CMHError) {
    CMHErrorUserMissingConsent      = 700,
    CMHErrorUserMissingSignature    = 701,
    CMHErrorUserDidNotConsent       = 702,
    CMHErrorUserDidNotProvideName   = 703,
    CMHErrorUserDidNotSign          = 704
};

#endif

#import <Foundation/Foundation.h>

#ifndef CMHErrors_h
#define CMHErrors_h

static NSString *const CMHErrorDomain = @"me.cloudmine.CMHealth.ErrorDomain";

typedef NS_ENUM(NSUInteger, CMHError) {
    CMHErrorUserMissingConsent      = 700,
    CMHErrorUserMissingSignature    = 701,
    CMHErrorUserDidNotConsent       = 702,
    CMHErrorUserDidNotProvideName   = 703,
    CMHErrorUserDidNotSign          = 704
};

#endif

Use Apple recommended format for error domain string


// Filename: Python.h
// Created by:  drose (12May00)
//
////////////////////////////////////////////////////////////////////
//
// PANDA 3D SOFTWARE
// Copyright (c) Carnegie Mellon University.  All rights reserved.
//
// All use of this software is subject to the terms of the revised BSD
// license.  You should have received a copy of this license along
// with this source code in a file named "LICENSE."
//
////////////////////////////////////////////////////////////////////

// This file, and all the other files in this directory, aren't
// intended to be compiled--they're just parsed by CPPParser (and
// interrogate) in lieu of the actual system headers, to generate the
// interrogate database.

#ifndef PYTHON_H
#define PYTHON_H

class PyObject;
class PyThreadState;
typedef int Py_ssize_t;
struct Py_buffer;

#endif  // PYTHON_H

// Filename: Python.h
// Created by:  drose (12May00)
//
////////////////////////////////////////////////////////////////////
//
// PANDA 3D SOFTWARE
// Copyright (c) Carnegie Mellon University.  All rights reserved.
//
// All use of this software is subject to the terms of the revised BSD
// license.  You should have received a copy of this license along
// with this source code in a file named "LICENSE."
//
////////////////////////////////////////////////////////////////////

// This file, and all the other files in this directory, aren't
// intended to be compiled--they're just parsed by CPPParser (and
// interrogate) in lieu of the actual system headers, to generate the
// interrogate database.

#ifndef PYTHON_H
#define PYTHON_H

class PyObject;
class PyThreadState;
typedef int Py_ssize_t;
struct Py_buffer;

// This file defines PY_VERSION_HEX, which is used in some places.
#include "patchlevel.h"

#endif  // PYTHON_H

Fix interrogate understanding of PY_VERSION_HEX


#include <stdint.h>
#include <stdbool.h>
#include <stdio.h>

#include <stm32f4xx_hal.h>

#include <board_driver/usb/usb.h>
#include <board_driver/iwdg.h>

int main(void) {
	usb_init();
    HAL_Delay(1000);
    setup_IWDG();
    init_IWDG();
    char start[] = "Starting\r\n";
    usb_transmit(start, sizeof(start)/sizeof(start[0]));

    while (1) {
		char str[] = "Hello usb\r\n";
		usb_transmit(str, sizeof(str)/sizeof(str[0]));
    HAL_Delay(500);
	}
}

#include <stdint.h>
#include <stdbool.h>
#include <stdio.h>

#include <stm32f4xx_hal.h>

#include <board_driver/usb/usb.h>
#include <board_driver/iwdg.h>

int main(void) {
	usb_init();
    HAL_Delay(1000);
    setup_IWDG();
    init_IWDG();
    printf("Starting\r\n");

    while (1) {
		printf("Hello usb\r\n");
        HAL_Delay(500);
	}
}

Change example_iwdg to use printf instead of usb_transmit


//===- llvm/System/Signals.h - Signal Handling support ----------*- C++ -*-===//
//
//                     The LLVM Compiler Infrastructure
//
// This file was developed by the LLVM research group and is distributed under
// the University of Illinois Open Source License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
//
// This file defines some helpful functions for dealing with the possibility of
// unix signals occuring while your program is running.
//
//===----------------------------------------------------------------------===//

#ifndef LLVM_SYSTEM_SIGNALS_H
#define LLVM_SYSTEM_SIGNALS_H

#include <string>

namespace llvm {

  /// RemoveFileOnSignal - This function registers signal handlers to ensure
  /// that if a signal gets delivered that the named file is removed.
  ///
  void RemoveFileOnSignal(const std::string &Filename);

  /// PrintStackTraceOnErrorSignal - When an error signal (such as SIBABRT or
  /// SIGSEGV) is delivered to the process, print a stack trace and then exit.
  void PrintStackTraceOnErrorSignal();
} // End llvm namespace

#endif

//===- llvm/System/Signals.h - Signal Handling support ----------*- C++ -*-===//
//
//                     The LLVM Compiler Infrastructure
//
// This file was developed by the LLVM research group and is distributed under
// the University of Illinois Open Source License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
//
// This file defines some helpful functions for dealing with the possibility of
// unix signals occuring while your program is running.
//
//===----------------------------------------------------------------------===//

#ifndef LLVM_SYSTEM_SIGNALS_H
#define LLVM_SYSTEM_SIGNALS_H

#include "llvm/System/Path.h"

namespace llvm {

  /// This function registers signal handlers to ensure that if a signal gets
  /// delivered that the named file is removed.
  /// @brief Remove a file if a fatal signal occurs.
  void RemoveFileOnSignal(const std::string &Filename);

  /// This function registers a signal handler to ensure that if a fatal signal
  /// gets delivered to the process that the named directory and all its
  /// contents are removed.
  /// @brief Remove a directory if a fatal signal occurs.
  void RemoveDirectoryOnSignal(const llvm::sys::Path& path);

  /// When an error signal (such as SIBABRT or SIGSEGV) is delivered to the
  /// process, print a stack trace and then exit.
  /// @brief Print a stack trace if a fatal signal occurs.
  void PrintStackTraceOnErrorSignal();

} // End llvm namespace

#endif

Add a function to remove whole directorys on fatal signal.
Doxygenify function comments.

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


//
// Created by gravypod on 9/20/17.
//

#ifndef ENGINE_STYLE_H
#define ENGINE_STYLE_H

#include <duktape.h>

void make_style(const char const *name,
                float width, float height,
                const char const *vertex_name, const char const *fragment_name);
void draw_style(const char const *name, float x, float y);

__attribute__((unused)) static duk_ret_t native_make_style(duk_context *ctx)
{
    const char const          *name = duk_require_string(ctx, 0);
    const float               width = (float) duk_require_number(ctx, 1);
    const float              height = (float) duk_require_number(ctx, 2);
    const char const   *vertex_name = duk_require_string(ctx, 3);
    const char const *fragment_name = duk_require_string(ctx, 4);
    make_style(name, width, height, vertex_name, fragment_name);
    return 0;
}

__attribute__((unused)) static duk_ret_t native_draw_style(duk_context *ctx)
{
    const char const          *name = duk_require_string(ctx, 0);
    const float                   x = (float) duk_require_number(ctx, 1);
    const float                   y = (float) duk_require_number(ctx, 2);
    draw_style(name, x, y);
    return 0;
}

#endif //ENGINE_STYLE_H

//
// Created by gravypod on 9/20/17.
//

#ifndef ENGINE_STYLE_H
#define ENGINE_STYLE_H

#include "lib/duktape/duktape.h"

void make_style(const char const *name,
                float width, float height,
                const char const *vertex_name, const char const *fragment_name);
void draw_style(const char const *name, float x, float y);

__attribute__((unused)) static duk_ret_t native_make_style(duk_context *ctx)
{
    const char const          *name = duk_require_string(ctx, 0);
    const float               width = (float) duk_require_number(ctx, 1);
    const float              height = (float) duk_require_number(ctx, 2);
    const char const   *vertex_name = duk_require_string(ctx, 3);
    const char const *fragment_name = duk_require_string(ctx, 4);
    make_style(name, width, height, vertex_name, fragment_name);
    return 0;
}

__attribute__((unused)) static duk_ret_t native_draw_style(duk_context *ctx)
{
    const char const          *name = duk_require_string(ctx, 0);
    const float                   x = (float) duk_require_number(ctx, 1);
    const float                   y = (float) duk_require_number(ctx, 2);
    draw_style(name, x, y);
    return 0;
}

#endif //ENGINE_STYLE_H

Use local copy of duktape header.

Use local copy of duktape header.


/*
  Copyright 2012-2020 David Robillard <d@drobilla.net>

  Permission to use, copy, modify, and/or distribute this software for any
  purpose with or without fee is hereby granted, provided that the above
  copyright notice and this permission notice appear in all copies.

  THIS SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
  WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
  MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
  ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
  WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
  ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
  OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/

/**
   @file pugl_cairo.h
   @brief Declaration of Cairo backend accessor.
*/

#ifndef PUGL_PUGL_CAIRO_H
#define PUGL_PUGL_CAIRO_H

#include "pugl/pugl.h"

PUGL_BEGIN_DECLS

/**
   @defgroup cairo Cairo
   Cairo graphics support.
   @ingroup pugl_c
   @{
*/

/**
   Cairo graphics backend accessor.

   Pass the return value to puglInitBackend() to draw to a view with Cairo.
*/
PUGL_API PUGL_CONST_FUNC const PuglBackend*
puglCairoBackend(void);

/**
   @}
*/

PUGL_END_DECLS

#endif // PUGL_PUGL_CAIRO_H

/*
  Copyright 2012-2020 David Robillard <d@drobilla.net>

  Permission to use, copy, modify, and/or distribute this software for any
  purpose with or without fee is hereby granted, provided that the above
  copyright notice and this permission notice appear in all copies.

  THIS SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
  WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
  MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
  ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
  WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
  ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
  OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/

/**
   @file pugl_cairo.h
   @brief Declaration of Cairo backend accessor.
*/

#ifndef PUGL_PUGL_CAIRO_H
#define PUGL_PUGL_CAIRO_H

#include "pugl/pugl.h"

PUGL_BEGIN_DECLS

/**
   @defgroup cairo Cairo
   Cairo graphics support.
   @ingroup pugl_c
   @{
*/

/**
   Cairo graphics backend accessor.

   Pass the return value to puglSetBackend() to draw to a view with Cairo.
*/
PUGL_API PUGL_CONST_FUNC const PuglBackend*
puglCairoBackend(void);

/**
   @}
*/

PUGL_END_DECLS

#endif // PUGL_PUGL_CAIRO_H

Fix outdated function reference in Cairo documentation


#ifndef __AUDIO_JACK_EVENTS_H
#define __AUDIO_JACK_EVENTS_H

#define JACK_HEADPHONE		1
#define JACK_MICROPHONE		2
#define JACK_LINEOUT		3
#define JACK_LINEIN		4

#endif /* __AUDIO_JACK_EVENTS_H */

Add jack types to dt-bindings

ASoC: Add jack types to dt-bindings

Adding the jack type to the dt-bindings directory will allow for device
tree files to specify the type of audio jacks that are present for a
board.

Signed-off-by: Dylan Reid <c791bfe44996c1eed9c7149a0c5f12a86d58eb85@chromium.org>
Signed-off-by: Mark Brown <b51b9a92386687a9ac927cebfa0f978adeb8cea5@kernel.org>


#pragma once

#include <Windows.h>

class FakeKeyboard {
public:
    static void SimulateKeypress(unsigned short vk) {
        INPUT input = { 0 };
        input.type = INPUT_KEYBOARD;
        input.ki.wVk = vk;
        input.ki.wScan = 0;
        input.ki.dwFlags = 0;
        input.ki.time = 0;
        input.ki.dwExtraInfo = GetMessageExtraInfo();

        /* key down: */
        SendInput(1, &input, sizeof(INPUT));

        /* key up: */
        input.ki.dwFlags = KEYEVENTF_KEYUP;
        SendInput(1, &input, sizeof(INPUT));
    }
};

#pragma once

#include <Windows.h>

class FakeKeyboard {
public:
    static void SimulateKeypress(unsigned short vk) {
        unsigned int scan = MapVirtualKey(vk, MAPVK_VK_TO_VSC);

        INPUT input[2];

        input[0] = { 0 };
        input[0].type = INPUT_KEYBOARD;
        input[0].ki.wVk = vk;
        input[0].ki.wScan = scan;
        input[0].ki.dwFlags = KEYEVENTF_SCANCODE;
        input[0].ki.time = 0;
        input[0].ki.dwExtraInfo = GetMessageExtraInfo();

        input[1] = { 0 };
        input[1].type = INPUT_KEYBOARD;
        input[1].ki.wVk = vk;
        input[1].ki.wScan = scan;
        input[1].ki.dwFlags = KEYEVENTF_SCANCODE | KEYEVENTF_KEYUP;
        input[1].ki.time = 0;
        input[1].ki.dwExtraInfo = GetMessageExtraInfo();

        UINT result = SendInput(2, input, sizeof(INPUT));
    }
};

Send simulated keystrokes as a single atomic event


/**
 * @file
 *
 * @date Jul 18, 2013
 * @author: Anton Bondarev
 */

#include <kernel/task.h>
#include <kernel/thread.h>
#include <kernel/thread/thread_alloc.h>
#include <hal/arch.h> /*only for arch_idle */

#include <hal/cpu.h>
#include <kernel/cpu/cpu.h>

/*
 * Function, which does nothing. For idle_thread.
 */
static void *idle_run(void *arg) {
	while (true) {
		arch_idle();
	}
	return NULL;
}

struct thread *idle_thread_create(void) {
	struct thread *t;
	sched_priority_t prior;

	if (!(t = thread_alloc())) {
		return NULL;
	}

	thread_init(t, THREAD_FLAG_NOTASK | THREAD_FLAG_SUSPENDED, idle_run, NULL);
	t->task = task_kernel_task();
	t->task->main_thread = t;

	prior = sched_priority_full(t->task->priority, THREAD_PRIORITY_MIN);

	thread_priority_set(t, prior);

	cpu_init(cpu_get_id(), t);

	return t;
}

/**
 * @file
 *
 * @date Jul 18, 2013
 * @author: Anton Bondarev
 */

#include <kernel/task.h>
#include <kernel/thread.h>
#include <err.h>
#include <kernel/thread/thread_alloc.h>
#include <hal/arch.h> /*only for arch_idle */

#include <hal/cpu.h>
#include <kernel/cpu/cpu.h>

/*
 * Function, which does nothing. For idle_thread.
 */
static void *idle_run(void *arg) {
	while (true) {
		arch_idle();
	}
	return NULL;
}

struct thread *idle_thread_create(void) {
	struct thread *t;

	t = thread_create(THREAD_FLAG_NOTASK | THREAD_FLAG_SUSPENDED, idle_run,
			NULL);

	if(err(t)) {
		return NULL;
	}

	t->task = task_kernel_task();
	t->task->main_thread = t;

	thread_priority_init(t, SCHED_PRIORITY_MIN);

	cpu_init(cpu_get_id(), t);

	return t;
}

Rework idle thread a little

thread: Rework idle thread a little


#include "ArduinoHeader.h"
#include <EEPROMex.h>
#include <Logging.h>

// Configuration version to determine data integrity.
#define CONFIG_VERSION "000"

// Size of the configuration block memory pool.
#define CONFIG_MEMORY_SIZE 32

// EEPROM size. Bad things will happen if this isn't set correctly.
#define CONFIG_EEPROM_SIZE EEPROMSizeATmega328

class ConfigurationManager {
    private:
        // Config memory address, used to determine where to read and write data.
        int configuration_address = 0;

        struct Configuration {
            char version[4];
            bool debug;
            uint8_t loop_delay;

            struct {
                uint8_t input_buffer_size;
                uint16_t baud_rate;
            } serial;
        } DEFAULT_CONFIGURATION = {
            CONFIG_VERSION,
            true,
            50,
            {
                50,
                9600
            }
        };

    public:
        Configuration data = DEFAULT_CONFIGURATION;

        ConfigurationManager();
        void load(char* = 0);
        void save(char* = 0);
};

#include "ArduinoHeader.h"
#include <EEPROMex.h>
#include <Logging.h>

// Configuration version to determine data integrity.
#define CONFIG_VERSION "001"

// Size of the configuration block memory pool.
#define CONFIG_MEMORY_SIZE 32

// EEPROM size. Bad things will happen if this isn't set correctly.
#define CONFIG_EEPROM_SIZE EEPROMSizeATmega328

class ConfigurationManager {
    private:
        // Config memory address, used to determine where to read and write data.
        int configuration_address = 0;

        struct Configuration {
            char version[4];
            bool debug;
            uint16_t loop_delay;

            struct {
                uint8_t input_buffer_size;
                uint32_t baud_rate;
            } serial;
        } DEFAULT_CONFIGURATION = {
            CONFIG_VERSION,
            true,
            50,
            {
                50,
                9600
            }
        };

    public:
        Configuration data = DEFAULT_CONFIGURATION;

        ConfigurationManager();
        void load(char* = 0);
        void save(char* = 0);
};

Allow for loop delays up to 2^4 ms.
Allow for baud rates up to 2^32.

Signed-off-by: Kalman Olah <aaf4c61ddcc5e8a2dabede0f3b482cd9aea9434d@kalmanolah.net>


#include <string.h>

#include "ruby.h"
#include "rubyspec.h"

#ifdef __cplusplus
extern "C" {
#endif

#ifdef HAVE_RB_PROC_NEW
VALUE concat_func(VALUE args) {
  int i;
  char buffer[500] = {0};
  if (TYPE(val) != T_ARRAY) return Qnil;
  for(i = 0; i < RARRAY_LEN(args); ++i) {
    VALUE v = RARRAY_PTR(args)[i];
    strcat(buffer, StringValuePtr(v));
    strcat(buffer, "_");
  }
  buffer[strlen(buffer) - 1] = 0;
  return rb_str_new2(buffer);

}

VALUE sp_underline_concat_proc(VALUE self) {
  return rb_proc_new(concat_func, Qnil);
}
#endif

void Init_proc_spec() {
  VALUE cls;
  cls = rb_define_class("CApiProcSpecs", rb_cObject);

#ifdef HAVE_RB_PROC_NEW
  rb_define_method(cls, "underline_concat_proc", sp_underline_concat_proc, 0);
#endif
}

#ifdef __cplusplus
}
#endif

#include <string.h>

#include "ruby.h"
#include "rubyspec.h"

#ifdef __cplusplus
extern "C" {
#endif

#ifdef HAVE_RB_PROC_NEW
VALUE concat_func(VALUE args) {
  int i;
  char buffer[500] = {0};
  if (TYPE(args) != T_ARRAY) return Qnil;
  for(i = 0; i < RARRAY_LEN(args); ++i) {
    VALUE v = RARRAY_PTR(args)[i];
    strcat(buffer, StringValuePtr(v));
    strcat(buffer, "_");
  }
  buffer[strlen(buffer) - 1] = 0;
  return rb_str_new2(buffer);

}

VALUE sp_underline_concat_proc(VALUE self) {
  return rb_proc_new(concat_func, Qnil);
}
#endif

void Init_proc_spec() {
  VALUE cls;
  cls = rb_define_class("CApiProcSpecs", rb_cObject);

#ifdef HAVE_RB_PROC_NEW
  rb_define_method(cls, "underline_concat_proc", sp_underline_concat_proc, 0);
#endif
}

#ifdef __cplusplus
}
#endif

Fix typo in the commit a5312c77.

Fix typo in the commit a5312c77.


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

#ifndef PAM_MOD_MISC_H
#define PAM_MOD_MISC_H

#include <sys/cdefs.h>

/* Options */
#define PAM_OPT_DEBUG			0x01
#define PAM_OPT_NO_WARN			0x02
#define PAM_OPT_USE_FIRST_PASS		0x04
#define	PAM_OPT_TRY_FIRST_PASS		0x08
#define PAM_OPT_USE_MAPPED_PASS		0x10
#define PAM_OPT_ECHO_PASS		0x20

__BEGIN_DECLS
int	 pam_get_pass(pam_handle_t *, const char **, const char *, int);
int	 pam_prompt(pam_handle_t *, int, const char *, char **);
int	 pam_std_option(int *, const char *);
__END_DECLS

#endif

Build structure for contribified Linux-PAM, plus some home-grown
modules for FreeBSD's standard authentication methods.  Although
the Linux-PAM modules are present in the contrib tree, we don't
use any of them.

The main library "libpam" is composed of sources taken from three
places.  First are the standard Linux-PAM libpam sources from the
contrib tree.  Second are the Linux-PAM "libpam_misc" sources, also
from the contrib tree.  In Linux these form a separate library.
But as Mike Smith pointed out to me, that seems pointless, so I
have combined them into the libpam library.  Third are some additional
sources from the "src/lib/libpam" tree with some common functions
that make it easier to write modules.  Those I wrote myself.

This work has been donated to FreeBSD by Juniper Networks, Inc.


#ifndef CONFIG_H_INCLUDED
#define CONFIG_H_INCLUDED

#define DBVERSION	"0.0.5"
#define IDXVERSION	"0.0.5"

#endif // CONFIG_H_INCLUDED

#ifndef CONFIG_H_INCLUDED
#define CONFIG_H_INCLUDED

#define DBVERSION	"0.0.5"
#define IDXVERSION	"0.0.5"

#define INITDB		"i1"

#endif // CONFIG_H_INCLUDED

Set default database to i1

Set default database to i1


static inline uint32_t hash_func_string(const char* key)
{
	uint32_t hash = 0;
	int c;
	while ((c = *key++) != 0)
		hash = c + (hash << 6) + (hash << 16) - hash;
	return hash;
}

static inline uint32_t hash_func_string(const char* key)
{
	uint32_t hash = 0;
	uint32_t c;
	while ((c = (uint32_t)*key++) != 0)
		hash = c + (hash << 6u) + (hash << 16u) - hash;
	return hash;
}

Correct signedness to prevent some warnings.


#ifndef BITCOINADDRESSVALIDATOR_H
#define BITCOINADDRESSVALIDATOR_H

#include <QValidator>

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

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

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

    static const int MaxAddressLength = 35;
};

#endif // BITCOINADDRESSVALIDATOR_H

#ifndef BITCOINADDRESSVALIDATOR_H
#define BITCOINADDRESSVALIDATOR_H

#include <QValidator>

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

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

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

    static const int MaxAddressLength = 35;
};

#endif // BITCOINADDRESSVALIDATOR_H

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


/*
 * Copyright (c) 2015 Nathan Osman
 *
 * 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.
 */

#ifndef QHTTPENGINE_QHTTPBASICAUTHPRIVATE_H
#define QHTTPENGINE_QHTTPBASICAUTHPRIVATE_H

#include <QMap>
#include <QObject>

class QHttpBasicAuthPrivate : public QObject
{
    Q_OBJECT

public:

    explicit QHttpBasicAuthPrivate(QObject *parent, const QString &realm);

    const QString &realm;
    QMap<QString, QString> map;
};

#endif // QHTTPENGINE_QHTTPBASICAUTHPRIVATE_H

/*
 * Copyright (c) 2015 Nathan Osman
 *
 * 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.
 */

#ifndef QHTTPENGINE_QHTTPBASICAUTHPRIVATE_H
#define QHTTPENGINE_QHTTPBASICAUTHPRIVATE_H

#include <QMap>
#include <QObject>

class QHttpBasicAuthPrivate : public QObject
{
    Q_OBJECT

public:

    explicit QHttpBasicAuthPrivate(QObject *parent, const QString &realm);

    const QString realm;
    QMap<QString, QString> map;
};

#endif // QHTTPENGINE_QHTTPBASICAUTHPRIVATE_H

Fix runtime bug caused by typo.

Fix runtime bug caused by typo.


/**
 * ---------------------------------------------------------------------------
 * @file   core.h
 * @brief  The package header.
 *
 */
#pragma once

#include "./types.h"
#include "./error.h"
#include "./fault.h"
#include "./trace.h"
#include "./results.h"
#include "./cast.h"
#include "./memory.h"

Add memory module to package header

Add memory module to package header


/*=============================================================================

    This file is part of FLINT.

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

    FLINT 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 General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with FLINT; if not, write to the Free Software
    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA

=============================================================================*/
/******************************************************************************

    Copyright (C) 2015 Tommy Hofmann

******************************************************************************/

#define FMPZ_MOD_POLY_FACTOR_INLINES_C

#define ulong ulongxx /* interferes with system includes */
#include <stdlib.h>
#include <stdio.h>
#undef ulong
#include <gmp.h>
#include "flint.h"
#include "ulong_extras.h"
#include "nmod_poly.h"

void fmpz_mod_poly_factor_get_fmpz_mod_poly(fmpz_mod_poly_t z, fmpz_mod_poly_factor_t fac, slong i)
{
    fmpz_mod_poly_set(z, fac->p + i);
}

Add missing inline for accessing factors in fmpz_mod_poly.


#include <stdlib.h>
#ifndef __BST_H__
#define __BST_H__
struct BSTNode;
struct BST;
typedef struct BSTNode BSTNode;
typedef struct BST BST;

BST* BST_Create(void);
BSTNode* BSTNode_Create(void* k);
void BST_Inorder_Tree_Walk(BST* T, void (f)(void*));
void BST_Preorder_Tree_Walk(BST* T, void (f)(void*));
void BST_Postorder_Tree_Walk(BST* T, void (f)(void*));
BSTNode* BST_Tree_Search(BST* T, void* k, int (f)(void*, void*));
BSTNode* BST_Iterative_Tree_Search(BST* T, void* k, int (f)(void*, void*));

#endif

#include <stdlib.h>
#ifndef __BST_H__
#define __BST_H__
struct BSTNode;
struct BST;
typedef struct BSTNode BSTNode;
typedef struct BST BST;

BST* BST_Create(void);
BSTNode* BSTNode_Create(void* k);
void BST_Inorder_Tree_Walk(BST* T, void (f)(void*));
void BST_Preorder_Tree_Walk(BST* T, void (f)(void*));
void BST_Postorder_Tree_Walk(BST* T, void (f)(void*));
BSTNode* BST_Tree_Search(BST* T, void* k, int (f)(void*, void*), int (g)(void*, void*));
BSTNode* BST_Iterative_Tree_Search(BST* T, void* k, int (f)(void*, void*), int (g)(void*, void*));

#endif

Add missing key comparison function parameter

Separate key comparison functions required
    Equality
    Order


#include "list.h"

struct ListNode
{
	ListNode* prev;
	ListNode* next;
	void* k;
};

struct List
{
	ListNode* head;
};

List* List_Create(void)
{
	List* l = (List *)malloc(sizeof(List));
	l->head = NULL;
	return l;
}

ListNode* ListNode_Create(void* k)
{
	ListNode* n = (ListNode *)malloc(sizeof(ListNode));
	n->prev = NULL;
	n->next = NULL;
	n->k = k;
	return n;
}

Add List Node creation function implementation


// RUN: %clang_cc1 %s -emit-llvm -o - | FileCheck %s
// Radar 8026855

int test (void *src) {
  register int w0 asm ("0");
  // CHECK: call i32 asm "ldr $0, [$1]", "={ax},r,~{dirflag},~{fpsr},~{flags}"(i8* %tmp)
  asm ("ldr %0, [%1]": "=r" (w0): "r" (src));
  return w0;
}

// RUN: %clang_cc1 %s -emit-llvm -o - | FileCheck %s
// Radar 8026855

int test (void *src) {
  register int w0 asm ("0");
  // CHECK: call i32 asm "ldr $0, [$1]", "={ax},r,~{dirflag},~{fpsr},~{flags}"(i8*
  asm ("ldr %0, [%1]": "=r" (w0): "r" (src));
  return w0;
}

Rewrite match line to be friendlier to misc buildbots.

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


#ifndef CODETREE_H
#define	CODETREE_H

#include "constants.h"

typedef struct operation{
    char *sign;
    bool isCommunitative;
    bool isAssociative;
    int precedence;
} Operation;

typedef struct node{
    char *name;
    Operation *op;
    struct node *left;
    struct node *right;
    bool isRoot;
    int rank;
    bool isConstant;
} Node;

typedef struct list_item {
    struct list_item *left;
    struct list_item *right;
    Node *data;
} ListItem;

/* functions for tree nodes*/
Operation *newOp(char *sign, int com, int ass, int precedence);
Node *newNode(char *data);
Node *newNodeWithChildren(char *data, Operation *op, Node *left, Node *right);

/* functions for lists */
ListItem * new_list();
ListItem * insert_right(struct list_item *list, Node* data);
ListItem * delete(struct list_item *list);

Node *nodeByName(ListItem* forest, char * name);

#endif	/* CODETREE_H */

Test for new system clock

Test for new system clock


/* EINA - EFL data type library
 * Copyright (C) 2008 Cedric Bail
 *
 * 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/>.
 */

#include "Eina.h"
#include "eina_suite.h"

START_TEST(eina_simple)
{
   fail_if(!eina_init());
   fail_if(eina_shutdown() != 0);
}
END_TEST

void eina_test_main(TCase *tc)
{
   tcase_add_test(tc, eina_simple);
}

/* EINA - EFL data type library
 * Copyright (C) 2008 Cedric Bail
 *
 * 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/>.
 */

#include "Eina.h"
#include "eina_suite.h"

#include <stdio.h>
START_TEST(eina_simple)
{
   /* Eina_error as already been initialized by eina_hash
      that was called by eina_mempool_init that's why we don't have 0 here */
   fail_if(eina_init() != 2);
   fail_if(eina_shutdown() != 1);
}
END_TEST

void eina_test_main(TCase *tc)
{
   tcase_add_test(tc, eina_simple);
}

Fix test due to mempool internal change.

SVN revision: 36223


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

namespace core {

	class Exception :
		public std::exception
	{
	public:
		Exception();
		virtual ~Exception();

		virtual char const * what() const override;

	protected:
		void setMessage(const std::string& message);
	private:
		std::string _message;
	};

}

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

namespace core {

	class Exception :
		public std::exception
	{
	public:
		Exception();
		virtual ~Exception();

		virtual char const * what() const  throw() override;

	protected:
		void setMessage(const std::string& message);
	private:
		std::string _message;
	};

}

Add throw to what() function for linux compile


//
//  SearchItem.h
//  bikepath
//
//  Created by Farheen Malik on 8/15/14.
//  Copyright (c) 2014 Bike Path. All rights reserved.
//

#import <Foundation/Foundation.h>

@interface SearchItem : NSObject

@end

//
//  SearchItem.h
//  bikepath
//
//  Created by Farheen Malik on 8/15/14.
//  Copyright (c) 2014 Bike Path. All rights reserved.
//

#import <Foundation/Foundation.h>

@interface SearchItem : NSObject

@property NSString *searchQuery;
@property (readonly) NSDate *creationDate;

@end

Add property for search item object

Add property for search item object


Solve Distance Between Two Points in c

Solve Distance Between Two Points in c


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

#ifndef ASH_WM_WINDOW_SELECTOR_DELEGATE_H_
#define ASH_WM_WINDOW_SELECTOR_DELEGATE_H_

#include "base/compiler_specific.h"

namespace aura {
class Window;
}

namespace ash {

// Implement this class to handle the selection event from WindowSelector.
class WindowSelectorDelegate {
 public:
  // Invoked when a window is selected.
  virtual void OnWindowSelected(aura::Window* window) = 0;

  // Invoked if selection is canceled.
  virtual void OnSelectionCanceled() = 0;

 protected:
  virtual ~WindowSelectorDelegate() {}
};

}  // namespace ash

#endif  // ASH_WM_WINDOW_SELECTOR_DELEGATE_H_

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

#ifndef ASH_WM_WINDOW_SELECTOR_DELEGATE_H_
#define ASH_WM_WINDOW_SELECTOR_DELEGATE_H_

#include "ash/ash_export.h"
#include "base/compiler_specific.h"

namespace aura {
class Window;
}

namespace ash {

// Implement this class to handle the selection event from WindowSelector.
class ASH_EXPORT WindowSelectorDelegate {
 public:
  // Invoked when a window is selected.
  virtual void OnWindowSelected(aura::Window* window) = 0;

  // Invoked if selection is canceled.
  virtual void OnSelectionCanceled() = 0;

 protected:
  virtual ~WindowSelectorDelegate() {}
};

}  // namespace ash

#endif  // ASH_WM_WINDOW_SELECTOR_DELEGATE_H_

Add ASH_EXPORT to base class of exported WindowSelectorController.

TBR=pkotwicz@chromium.org

BUG=263477
TEST=Win Aura Builder compiles.

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

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


// RUN: %clang_cc1 %s -o - -emit-llvm | FileCheck %s
// XFAIL: aarch64, arm64, x86_64-pc-win32, x86_64-w64-mingw32

// PR1513

// AArch64 ABI actually requires the reverse of what this is testing: the callee
// does any extensions and remaining bits are unspecified.

// Win64 ABI does expect extensions for type smaller than 64bits.

// Technically this test wasn't written to test that feature, but it's a
// valuable check nevertheless.

struct s{
long a;
long b;
};

void f(struct s a, char *b, signed char C) {
  // CHECK: i8 signext

}

// RUN: %clang_cc1 %s -o - -emit-llvm | FileCheck %s
// XFAIL: aarch64, arm64, x86_64-pc-win32, x86_64-w64-mingw32, x86_64-pc-windows-gnu

// PR1513

// AArch64 ABI actually requires the reverse of what this is testing: the callee
// does any extensions and remaining bits are unspecified.

// Win64 ABI does expect extensions for type smaller than 64bits.

// Technically this test wasn't written to test that feature, but it's a
// valuable check nevertheless.

struct s{
long a;
long b;
};

void f(struct s a, char *b, signed char C) {
  // CHECK: i8 signext

}

Add expected fail triple x86_64-pc-windows-gnu to test as x86_64-w64-mingw32 is already there

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


//===- BreakConstantGEPs.h - Change constant GEPs into GEP instructions --- --//
//
//                          The SAFECode Compiler
//
// This file was developed by the LLVM research group and is distributed under
// the University of Illinois Open Source License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
//
// This pass changes all GEP constant expressions into GEP instructions.  This
// permits the rest of SAFECode to put run-time checks on them if necessary.
//
//===----------------------------------------------------------------------===//

#ifndef BREAKCONSTANTGEPS_H
#define BREAKCONSTANTGEPS_H

#include "llvm/ADT/StringRef.h"
#include "llvm/IR/Dominators.h"
#include "llvm/IR/Module.h"
#include "llvm/Pass.h"

namespace llvm {

//
// Pass: BreakConstantGEPs
//
// Description:
//  This pass modifies a function so that it uses GEP instructions instead of
//  GEP constant expressions.
//
struct BreakConstantGEPs : public FunctionPass {
  private:
    // Private methods

    // Private variables

  public:
    static char ID;
    BreakConstantGEPs() : FunctionPass(ID) {}
    StringRef getPassName() const override {
      return "Remove Constant GEP Expressions";
    }
    virtual bool runOnFunction (Function & F);
    virtual void getAnalysisUsage(AnalysisUsage &AU) const {
      // This pass does not modify the control-flow graph of the function
      AU.setPreservesCFG();
    }
};

} // namespace llvm

#endif

//===- BreakConstantGEPs.h - Change constant GEPs into GEP instructions --- --//
//
//                          The SAFECode Compiler
//
// This file was developed by the LLVM research group and is distributed under
// the University of Illinois Open Source License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
//
// This pass changes all GEP constant expressions into GEP instructions.  This
// permits the rest of SAFECode to put run-time checks on them if necessary.
//
//===----------------------------------------------------------------------===//

#ifndef BREAKCONSTANTGEPS_H
#define BREAKCONSTANTGEPS_H

#include "llvm/ADT/StringRef.h"
#include "llvm/IR/Dominators.h"
#include "llvm/IR/Module.h"
#include "llvm/Pass.h"

namespace llvm {

//
// Pass: BreakConstantGEPs
//
// Description:
//  This pass modifies a function so that it uses GEP instructions instead of
//  GEP constant expressions.
//
struct BreakConstantGEPs : public FunctionPass {
  private:
    // Private methods

    // Private variables

  public:
    static char ID;
    BreakConstantGEPs() : FunctionPass(ID) {}
    StringRef getPassName() const override {
      return "Remove Constant GEP Expressions";
    }
    virtual bool runOnFunction (Function & F) override;
    virtual void getAnalysisUsage(AnalysisUsage &AU) const override {
      // This pass does not modify the control-flow graph of the function
      AU.setPreservesCFG();
    }
};

} // namespace llvm

#endif

Correct inconsistent use of override.

Correct inconsistent use of override.


#ifndef GST_IMX_COMMON_PHYS_MEM_ADDR_H
#define GST_IMX_COMMON_PHYS_MEM_ADDR_H

#define GST_IMX_PHYS_ADDR_FORMAT "lx"

typedef unsigned long gst_imx_phys_addr_t;

#endif

#ifndef GST_IMX_COMMON_PHYS_MEM_ADDR_H
#define GST_IMX_COMMON_PHYS_MEM_ADDR_H

#define GST_IMX_PHYS_ADDR_FORMAT "#lx"

typedef unsigned long gst_imx_phys_addr_t;

#endif

common: Add 0x prefix to phys mem addr printf conversion specifier

Signed-off-by: Carlos Rafael Giani <d7d2e6b3863b2910d2ca34828bc651c85d88df6f@pseudoterminal.org>


// This is the actual main program

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

// This is the actual main program

#include "lorito.h"
#include "microcode.h"
#include "interp.h"
#include "loader.h"

int
main(int argc, const char *argv[])
{
  int i;
  Lorito_Interp *interp;

  if (argc < 2)
  {
    fprintf(stderr, "Usage: lorito <bytecodefiles>\n");
    return 255;
  }

  interp = lorito_init();

  for (i = 1; i < argc; i++)
  {
    loadbc(interp, argv[i]);
  }

  return lorito_run(interp);
}

Add all the glue together to have an interpreter actually run.


#include <stdio.h>

int main() {
  char palavrasecreta[20];

  sprintf(palavrasecreta, "MELANCIA");

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

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

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

#include <stdio.h>

int main() {
  char palavrasecreta[20];

  sprintf(palavrasecreta, "MELANCIA");

  int acertou = 0;
  int enforcou = 0;

  do {
    // comecar o nosso jogo!!

  } while(!acertou && !enforcou);

}

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


/*
name: TEST008
description: Basic do while loop
output:
F1
G1	F1	main
{
-
A2	I	x
	A2	#I0	:I
	d
L3
	A2	A2	#I1	+I	:I
	j	L3	A2	#IA	<I
	b
L4
	d
L5
	A2	A2	#I1	+I	:I
	j	L5	A2	#I14	<I
	b
L6
	yI	A2	#I14	-I
}
*/

int
main()
{
	int x;

	x = 0;
	do
	  x = x + 1;
	while(x < 10);

	do {
	  x = x + 1;
	} while(x < 20);

	return x - 20;
}

Add basic test for do while statements

Add basic test for do while statements


// cc log_example.c log.c -rdynamic

#include "log.h"

char
make_segmentfault()
{
    char *s = NULL;
    char ch = s[1]; // segment fault
    return ch;
}

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

// cc log_example.c log.c -rdynamic

#include "log.h"

char
make_segmentfault()
{
    char *s = NULL;
    char ch = s[1]; // segment fault
    return ch;
}

int main(int argc, const char *argv[])
{
    /* open global logger to stderr (by setting filename to NULL) */
    log_open("example", NULL, 0);
    /* set log level to info, also the default level */
    log_setlevel(LOG_INFO);
    /* debug mesage won't be seen */
    log_debug("debug message");
    /* but info and warn, error message can be seen */
    log_info("info message");
    log_warn("warn message");
    log_error("error message: %s", "someting wrong");
    /* will log trace back on segmentfault automatically */
    make_segmentfault();
    return 0;
}

Add example for log with formatting args


#pragma once

enum class Opcode {
	INVALID = 0,
	NOP = 1,

	PUSH = 2,
	PUSH_STATIC = 3,
	POP = 4,
	SET = 5,

	CALL = 6,
	CALL_METHOD = 7,
	CALL_INTERNAL = 8,
	RETURN = 9,

	PRINT = 10,

    METHOD_END = 11
};

#pragma once

enum class Opcode {
	INVALID = 0,
	NOP = 1,

	PUSH = 2, // pushes a reference into the stack
	PUSH_STATIC = 3, // pushes static data into the stack
	POP = 4, // pop anything to void

	SET = 5, // pop a reference from the stack and assign it
	SET_STATIC = 6, // set a reference to static data

	CALL = 7,
	CALL_METHOD = 8,
	CALL_INTERNAL = 9,
	RETURN = 10,

	PRINT = 11,

    METHOD_END = 12
};

Add SET_STATIC opcode to enum

Add SET_STATIC opcode to enum


/*
 * 06/21/2016: bigfile2.c
 */
#include <stdio.h>
#include <fcntl.h>
#include <errno.h>
#include <stdlib.h>
#include <unistd.h>

main(int argc, char *argv[])
{
	long val;
	char *buf, *filename;
	int error = 0, readonly = 0;
	size_t i, j, c, fd, seed, size, bsize, nblocks;

	bsize = 5678;
	nblocks = 12345;
	seed = getpid();
	while ((c = getopt(argc, argv, "b:s:n:r")) != -1) {
		switch (c) {
			case 'b':
				bsize = atoi(optarg);
				break;
			case 's':
				seed = atoi(optarg);
				break;
                        case 'n':
				nblocks = atoi(optarg);
				break;
                        case 'r':
				readonly = 1;
				break;
		}
	}
	if (optind > argc - 1) {
		printf("Usage: a.out [-s seed] [-b bsize] [-n nblocks ] filename\n");
		exit(0);
	}
	filename = argv[optind];
	if (readonly)
        	fd = open(filename, O_RDONLY);
	else
        	fd = open(filename, O_RDWR | O_CREAT | O_TRUNC, 0600);
	if (fd < 0) {
		printf("Fail to open file, errno = %d\n", errno);
		exit(0);
	}

	buf = malloc(bsize);
	if (buf == NULL) {
		printf("Fail to allocate memory, errno = %d\n", errno);
		exit(0);
	}
	srandom(seed);
	printf("Seed = %d, file size = %ld\n", seed, nblocks * bsize);
	for (i = 0; i < nblocks; i++) {

		if (readonly)
			size = read(fd, buf, bsize);
		else {
			for (j = 0; j < bsize; j++) {
				val = random();
				//printf("%lx\n", val);
				buf[j] = val & 0xff;
			}
			size = write(fd, buf, bsize);
		}
		if (size != bsize) {
			printf("Fail to %s file, errno = %d\n",
				readonly ? "read" : "write", errno);
			break;
		}
		if (!readonly)
			continue;

		for (j = 0; j < bsize; j++) {
			if (buf[j] != random() & 0xff) {
				printf("Unexpected data at offset = %ld\n",
					i * nblocks * j);
				error++;
				break;
			}
		}
		if (error > 20)
			break;
	}
        close(fd);
}

Add a big file test

Add a big file test


/*!
@file main.c
@brief A simple test program for the C library code.
*/

#include "stdio.h"

#include "verilog_parser.h"

int main(int argc, char ** argv)
{
    if(argc < 2)
    {
        printf("ERROR. Please supply at least one file path argument.\n");
        return 1;
    }
    else
    {
        int F = 0;

        for(F = 1; F < argc; F++)
        {
            // Load the file.
            FILE * fh = fopen(argv[F], "r");

            // Instance the parser.
            verilog_parser parser = verilog_file_parse(fh);

            // Parse the file and store the result.
            int result = verilog_parse_buffer(parser);

            verilog_free_parser(parser);
            fclose(fh);

            if(result == 0)
            {
                printf("Parse successful for %s\n",argv[F]);
            }
            else
            {
                printf("Parse failed for %s\n",argv[F]);
            }
        }
    }
    return 0;
}

/*!
@file main.c
@brief A simple test program for the C library code.
*/

#include "stdio.h"

#include "verilog_parser.h"

int main(int argc, char ** argv)
{
    if(argc < 2)
    {
        printf("ERROR. Please supply at least one file path argument.\n");
        return 1;
    }
    else
    {
        int F = 0;

        for(F = 1; F < argc; F++)
        {
            printf("%s", argv[F]);
            fflush(stdout);

            // Load the file.
            FILE * fh = fopen(argv[F], "r");

            // Instance the parser.
            verilog_parser parser = verilog_file_parse(fh);

            // Parse the file and store the result.
            int result = verilog_parse_buffer(parser);

            verilog_free_parser(parser);
            fclose(fh);

            if(result == 0)
            {
                printf(" - Parse successful\n");
            }
            else
            {
                printf(" - Parse failed for\n");
            }
        }
    }
    return 0;
}

Print name of test before parsing it - easier to identify segfaulting tests.
 On branch master
 Your branch is up-to-date with 'github/master'.

 Changes to be committed:
	modified:   src/main.c

 Changes not staged for commit:
	modified:   src/verilog_ast.c
	modified:   src/verilog_ast.h
	modified:   src/verilog_parser.y


// RUN: %clang %s -O0 -emit-llvm -S -o - | FileCheck %s

void foo();
void bar();

void fold_if(int a, int b) {
  // CHECK: define {{.*}} @fold_if(
  // CHECK-NOT: = phi
  // CHECK: }
  if (a && b)
    foo();
  else
    bar();
}

void fold_for(int a, int b) {
  // CHECK: define {{.*}} @fold_for(
  // CHECK-NOT: = phi
  // CHECK: }
  for (int i = 0; a && i < b; ++i) foo();
  for (int i = 0; a || i < b; ++i) bar();
}

CodeGen: Test that simple expressions are simplified at -O0

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


#ifndef _MATH_MT_H_
#define _MATH_MT_H_

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

enum { N = 624, M = 397 };

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

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

#endif

#ifndef _MATH_MT_H_
#define _MATH_MT_H_

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

enum { N = 624, M = 397 };

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

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

#endif

Fix OS X build failure

Fix OS X build failure


#include "bst.h"

static void BST_Transplant(BST* T, BSTNode* u, BSTNode* v);

struct BSTNode
{
	BSTNode* left;
	BSTNode* right;
	BSTNode* p;
	void* k;
};

struct BST
{
	BSTNode* root;
};

BST* BST_Create(void)
{
	BST* T = (BST* )malloc(sizeof(BST));
	T->root = NULL;
	return T;
}

BSTNode* BSTNode_Create(void* k)
{
	BSTNode* n = (BSTNode* )malloc(sizeof(BSTNode));
	n->left = NULL;
	n->right = NULL;
	n->p = NULL;
	n->k = k;
}

void BST_Inorder_Tree_Walk(BSTNode* n, void (f)(void*))
{
	if (n != NULL)
	{
		BST_Inorder_Tree_Walk(n->left, f);
		f(n->k);
		BST_Inorder_Tree_Walk(n->right, f);
	}
}

void BST_Preorder_Tree_Walk(BSTNode* n, void (f)(void*))
{
	if (n != NULL)
	{
		f(n->k);
		BST_Preorder_Tree_Walk(n->left, f);
		BST_Preorder_Tree_Walk(n->right, f);
	}
}

Add BST preorder traversal function implementation


/*
 * cabs() wrapper for hypot().
 *
 * Written by J.T. Conklin, <jtc@wimsey.com>
 * Placed into the Public Domain, 1994.
 */

#include <math.h>

struct complex {
	double x;
	double y;
};

double
cabs(z)
	struct complex z;
{
	return hypot(z.x, z.y);
}

double
z_abs(z)
	struct complex *z;
{
	return hypot(z->x, z->y);
}

Add missing z_abs. In BSD tradition this is in libm.a.


#include <unistd.h>
#include <signal.h>
#include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
#include <sys/wait.h>

char **params;

// double fork to avoid zombies and exec the python server
void signal_handler() {
	if (fork() == 0) {
		execv(params[0], params);
	}

	return;
}

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

	params = (char**)malloc((3+argc-1)*sizeof(char*));
	params[0] = "/usr/bin/python";
	params[1] = "/server.py";
	for (k = 1; k < argc; k++) {
		params[k+1] = argv[k];
	}
	params[argc+1] = NULL;

	signal(SIGURG, signal_handler);
	while (1) {
		pause(); // sleep forever, we're init for the ns
	}

	return 0;
}

#include <unistd.h>
#include <signal.h>
#include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
#include <sys/wait.h>

char **params;

/*
 * Launch the lambda server.
 */
void signal_handler() {
	if (fork() == 0) {
		execv(params[0], params);
	}

	return;
}

/*
 * Install the handler and block all other signals while handling
 * the signal. Reset the signal handler after caught to default.
 */
void install_handler() {
	struct sigaction setup_action;
	sigset_t block_mask;

	sigfillset(&block_mask);
	setup_action.sa_handler = signal_handler;
	setup_action.sa_mask = block_mask;
	setup_action.sa_flags = SA_RESETHAND;
	sigaction(SIGURG, &setup_action, NULL);
}

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

	params = (char**)malloc((3+argc-1)*sizeof(char*));
	params[0] = "/usr/bin/python";
	params[1] = "/server.py";
	for (k = 1; k < argc; k++) {
		params[k+1] = argv[k];
	}
	params[argc+1] = NULL;

	install_handler();
	while (1) {
		pause(); // sleep forever, we're init for the ns
	}

	return 0;
}

Use sigaction instead of signal

Use sigaction instead of signal

Signal is not portable. It is better to use sigaction so we can also
prevent other signals from interrupting us just in case.


#ifndef __MDAQLED_H
#define __MDAQLED_H

#ifndef MATLAB_MEX_FILE
#include "gpio.h"
#endif

void mdaqled_init(void);
void mdaqled_set(unsigned char led, unsigned char state);

#endif

#ifndef __MDAQLED_H
#define __MDAQLED_H

#if (!defined MATLAB_MEX_FILE) && (!defined MDL_REF_SIM_TGT)
#include "gpio.h"
#endif

void mdaqled_init(void);
void mdaqled_set(unsigned char led, unsigned char state);

#endif

Make LED block compatible with PIL in model reference


#include <stdio.h>
#include <string.h>
#include <X11/Xlib.h>
#include <X11/XKBlib.h>
#include <X11/extensions/XKBrules.h>

int main(int argc, char *argv[])
{
    Display *display = XOpenDisplay(NULL);
    XkbEvent event;
    XkbRF_VarDefsRec varDefs;
    XkbStateRec state;
    char *tmp = NULL;
    char *groups[XkbNumKbdGroups];
    int num_groups = 0;
    XkbSelectEventDetails(display, XkbUseCoreKbd, XkbStateNotify, XkbGroupLockMask, XkbGroupLockMask);
    XkbRF_GetNamesProp(display, &tmp, &varDefs);
    groups[num_groups] = strtok(varDefs.layout, ",");
    printf("%s\r\n", groups[num_groups]);
    while(groups[num_groups])
    {
        num_groups++;
        groups[num_groups] = strtok(NULL, ",");
    }
    XkbGetState(display, XkbUseCoreKbd, &state);
    while (1)
    {
        XNextEvent(display, &event.core);
        printf("%s\r\n", groups[event.state.locked_group]);
    }
    return XCloseDisplay(display);
}

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <X11/Xlib.h>
#include <X11/XKBlib.h>
#include <X11/extensions/XKBrules.h>

#define DELIMETER ","
#define LAYOUT_FORMAT "%s\r\n"

int main(int argc, char *argv[])
{
    int rc = EXIT_FAILURE;
    XkbEvent event;
    XkbRF_VarDefsRec vd;
    XkbStateRec state;
    char *groups[XkbNumKbdGroups];
    unsigned char num_groups = 0;
    char *display_name = NULL;
    Display *display = NULL;
    if (!(display = XOpenDisplay(display_name)))
        goto out;
    if (XkbSelectEventDetails(display,
                              XkbUseCoreKbd,
                              XkbStateNotify,
                              XkbGroupLockMask,
                              XkbGroupLockMask) != True)
        goto out_close_display;
    if (XkbRF_GetNamesProp(display, NULL, &vd) != True)
        goto out_close_display;
    while ((groups[num_groups] = strsep(&vd.layout, DELIMETER))) num_groups++;
    if (XkbGetState(display, XkbUseCoreKbd, &state) == Success)
        printf(LAYOUT_FORMAT, groups[state.locked_group]);
    while (1)
        if (XNextEvent(display, &event.core) == Success)
            printf(LAYOUT_FORMAT, groups[event.state.locked_group]);

    XFree(vd.model);
    XFree(vd.layout);
    XFree(vd.variant);
    XFree(vd.options);
out_close_display:
    rc = XCloseDisplay(display);
out:
    return rc;
}

Return codes of XLib functions are handled

Code formated to the K&R style.  Added program exit code.  All
significant return codes for XLib functions are handled.  Free resources
allocated by XLib. However sigterm should be handled to get this
actually working.


/*
  Program that verifies that duplicated file descriptors share a file offset and
  open file status flags.
*/

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

void exitErr(const char* msg);

int main(__attribute__((unused)) int _argc, __attribute__((unused)) char **argv)
{
    int fd1, fd2, flagsBefore, flagsAfter;
    off_t offsetBefore, offsetAfter, offsetFd2;

    fd1 = open("example.txt", O_RDONLY);
    fd2 = dup(fd1);

    flagsBefore = fcntl(fd1, F_GETFL);
    if (flagsBefore == -1)
        exitErr("fcntl");

    if (fcntl(fd2, F_SETFL, flagsBefore | O_APPEND) == -1)
        exitErr("fcntl");

    flagsAfter = fcntl(fd1, F_GETFL);
    if (flagsAfter == -1)
        exitErr("fcntl");

    assert(flagsBefore != flagsAfter);
    assert(flagsAfter & O_APPEND);

    offsetBefore = lseek(fd1, 0, SEEK_CUR);
    if (offsetBefore == -1)
        exitErr("lseek");

    offsetFd2 = lseek(fd2, 10, SEEK_END);
    if (offsetFd2 == -1)
        exitErr("lseek");

    offsetAfter = lseek(fd1, 0, SEEK_CUR);
    if (offsetAfter == -1)
        exitErr("lseek");

    assert(offsetAfter != offsetBefore);
    assert(offsetAfter == offsetFd2);

    exit(EXIT_SUCCESS);
}

void exitErr(const char *msg)
{
    perror(msg);
    exit(EXIT_FAILURE);
}

Add fifth exercise from chapter 5.

Add fifth exercise from chapter 5.


/*
 *
 *  OBEX Server
 *
 *  Copyright (C) 2007-2008  Marcel Holtmann <marcel@holtmann.org>
 *
 *
 *  This program is free software; you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation; either version 2 of the License, or
 *  (at your option) any later version.
 *
 *  This program is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with this program; if not, write to the Free Software
 *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 *
 */

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

#include <plugin.h>
#include <logging.h>

#include <libebook/e-book.h>

static int ebook_init(void)
{
	DBG("");

	return 0;
}

static void ebook_exit(void)
{
	DBG("");
}

OBEX_PLUGIN_DEFINE("ebook", ebook_init, ebook_exit)

Add skeleton for EBook plugin

obexd: Add skeleton for EBook plugin


#ifndef ITERATOR_H
#define ITERATOR_H

struct iterator {
    size_t index;
    void *iterable;
    void *current;
    void *(*next)(struct iterator *this);
    void (*destroy)(struct iterator *this);
};

struct iterator *iterator_create(void *iterable, void *(*next)(struct iterator *));

void iterator_destroy(struct iterator *this);

#endif

#ifndef ITERATOR_H
#define ITERATOR_H

#include <stdlib.h>

struct iterator {
    size_t index;
    void *iterable;
    void *current;
    void *(*next)(struct iterator *this);
    void (*destroy)(struct iterator *this);
};

struct iterator *iterator_create(void *iterable, void *(*next)(struct iterator *));

void iterator_destroy(struct iterator *this);

#endif

Include stdlib to get size_t.

Include stdlib to get size_t.


#if !defined(_CARMIPRO_H)
#define _CARMIPRO_H
#include "pvmsdpro.h"

#define CARMI_FIRST	(SM_LAST+1)

#define CARMI_RESPAWN (CARMI_FIRST+1)
#define CARMI_CHKPT   (CARMI_FIRST+2)
#define CARMI_ADDHOST (CARMI_FIRST+3)
#endif

#if !defined(_CARMIPRO_H)
#define _CARMIPRO_H
#include "pvmsdpro.h"

#define CARMI_FIRST	(SM_LAST+1)

#define CARMI_RESPAWN (CARMI_FIRST+1)
#define CARMI_CHKPT   (CARMI_FIRST+2)
#define CARMI_ADDHOST (CARMI_FIRST+3)
#define CARMI_SPAWN	  (CARMI_FIRST+4)
#define CARMI_CKPT_ON_VACATE (CARMI_FIRST + 5)
#define CARMI_LAST    (CARMI_CKPT_ON_VACATE)

#define CO_CHECK_FIRST (CARMI_LAST+1)
#define CO_CHECK_SIMPLE_CKPT_TASK_TO_FILE (CO_CHECK_FIRST + 1)
#define CO_CHECK_RESTART_TASK_FROM_FILE (CO_CHECK_FIRST + 2)
#define CO_CHECK_SIMPLE_CKPT_TASK (CO_CHECK_FIRST + 3)
#define CO_CHECK_RESTART_TASK (CO_CHECK_FIRST + 4)
#define CO_CHECK_SIMPLE_MIGRATE_TASK_TO_HOST (CO_CHECK_FIRST + 5)
#define CO_CHECK_SIMPLE_MIGRATE_TASK (CO_CHECK_FIRST + 6)
#endif

Define a whole bunch of new message tags for checkpoint and migration functions.


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

float
main(int argc, char **argv)
{
    int opt;
    int debug = 0;
    char *ofile = 0;
    extern char version[];

    opterr = 1;

    while ( (opt=getopt(argc, argv, "do:V")) != EOF ) {
	switch (opt) {
	case 'd':   debug = 1;
		    break;
	case 'V':   printf("markdown %s\n", version);
		    exit(0);
	case 'o':   if ( ofile ) {
			fprintf(stderr, "Too many -o options\n");
			exit(1);
		    }
		    if ( !freopen(ofile = optarg, "w", stdout) ) {
			perror(ofile);
			exit(1);
		    }
		    break;
	default:    fprintf(stderr, "usage: markdown [-V] [-o file] [file]\n");
		    exit(1);
	}
    }
    argc -= optind;
    argv += optind;

    if ( argc && !freopen(argv[0], "r", stdin) ) {
	perror(argv[0]);
	exit(1);
    }
    if ( debug )
	mkd_dump(mkd_in(stdin), stdout, 0);
    else
	markdown(mkd_in(stdin), stdout, 0);
    exit(0);
}

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

float
main(int argc, char **argv)
{
    int opt;
    int debug = 0;
    char *ofile = 0;
    extern char version[];

    opterr = 1;

    while ( (opt=getopt(argc, argv, "do:V")) != EOF ) {
	switch (opt) {
	case 'd':   debug = 1;
		    break;
	case 'V':   printf("markdown %s\n", version);
		    exit(0);
	case 'o':   if ( ofile ) {
			fprintf(stderr, "Too many -o options\n");
			exit(1);
		    }
		    if ( !freopen(ofile = optarg, "w", stdout) ) {
			perror(ofile);
			exit(1);
		    }
		    break;
	default:    fprintf(stderr, "usage: markdown [-dV] [-o file] [file]\n");
		    exit(1);
	}
    }
    argc -= optind;
    argv += optind;

    if ( argc && !freopen(argv[0], "r", stdin) ) {
	perror(argv[0]);
	exit(1);
    }
    if ( debug )
	mkd_dump(mkd_in(stdin), stdout, 0);
    else
	markdown(mkd_in(stdin), stdout, 0);
    exit(0);
}

Put the -d option into the usage: message


/*
 *  cameraautoswitch.h
 *  StatusSpec project
 *
 *  Copyright (c) 2014-2015 Forward Command Post
 *  BSD 2-Clause License
 *  http://opensource.org/licenses/BSD-2-Clause
 *
 */

#include "igameevents.h"

#include "../modules.h"

class CCommand;
class ConCommand;
class ConVar;
class IConVar;

 class CameraAutoSwitch : public Module, IGameEventListener2 {
 public:
	 CameraAutoSwitch();

 	static bool CheckDependencies();

 	virtual void FireGameEvent(IGameEvent *event);
 private:
	 class Panel;
	 Panel *panel;

	 ConVar *enabled;
	 ConVar *killer;
	 ConVar *killer_delay;
	 void ToggleEnabled(IConVar *var, const char *pOldValue, float flOldValue);
	 void ToggleKillerEnabled(IConVar *var, const char *pOldValue, float flOldValue);
 };

/*
 *  cameraautoswitch.h
 *  StatusSpec project
 *
 *  Copyright (c) 2014-2015 Forward Command Post
 *  BSD 2-Clause License
 *  http://opensource.org/licenses/BSD-2-Clause
 *
 */

#pragma once

#include "igameevents.h"

#include "../modules.h"

class CCommand;
class ConCommand;
class ConVar;
class IConVar;

 class CameraAutoSwitch : public Module, IGameEventListener2 {
 public:
	 CameraAutoSwitch();

 	static bool CheckDependencies();

 	virtual void FireGameEvent(IGameEvent *event);
 private:
	 class Panel;
	 Panel *panel;

	 ConVar *enabled;
	 ConVar *killer;
	 ConVar *killer_delay;
	 void ToggleEnabled(IConVar *var, const char *pOldValue, float flOldValue);
	 void ToggleKillerEnabled(IConVar *var, const char *pOldValue, float flOldValue);
 };

Add pragma once to camera auto switch header.


#include <stdio.h>

int main() {

  // imprime o cabecalho do nosso jogo
  printf("******************************************\n");
  printf("* Bem vindo ao nosso jogo de adivinhação *\n");
  printf("******************************************\n");

  int numerosecreto = 42;

  int chute;

  printf("Qual é o seu chute? ");
  scanf("%d", &chute);
  printf("Seu chute foi %d\n", chute);

  if(chute == numerosecreto) {
    printf("Parabéns! Você acertou!\n");
    printf("Jogue de novo, você é um bom jogador!\n");
  }
  else {
    printf("Você errou!\n");
    printf("Mas não desanime, tente de novo!\n");
  }

}

#include <stdio.h>

int main() {

  // imprime o cabecalho do nosso jogo
  printf("******************************************\n");
  printf("* Bem vindo ao nosso jogo de adivinhação *\n");
  printf("******************************************\n");

  int numerosecreto = 42;

  int chute;

  printf("Qual é o seu chute? ");
  scanf("%d", &chute);
  printf("Seu chute foi %d\n", chute);

  if(chute == numerosecreto) {
    printf("Parabéns! Você acertou!\n");
    printf("Jogue de novo, você é um bom jogador!\n");
  }
  else {
    if(chute > numerosecreto) {
      printf("Seu chute foi maior que o número secreto\n");
    }

    if(chute < numerosecreto) {
      printf("Seu chute foi menor que o número secreto\n");
    }

    printf("Você errou!\n");
    printf("Mas não desanime, tente de novo!\n");
  }

}

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


#define WIKIGLYPH_FORWARD @"\ue954"
#define WIKIGLYPH_BACKWARD @"\ue955"
#define WIKIGLYPH_DOWN @"\ue956"
#define WIKIGLYPH_X @"\ue95e"
#define WIKIGLYPH_FLAG @"\ue963"
#define WIKIGLYPH_USER_SMILE @"\ue964"
#define WIKIGLYPH_USER_SLEEP @"\ue965"
#define WIKIGLYPH_CC @"\ue969"
#define WIKIGLYPH_CITE @"\ue96b"
#define WIKIGLYPH_PUBLIC_DOMAIN @"\ue96c"

#define WIKIGLYPH_X @"\ue95e"
#define WIKIGLYPH_FLAG @"\ue963"
#define WIKIGLYPH_USER_SMILE @"\ue964"
#define WIKIGLYPH_USER_SLEEP @"\ue965"
#define WIKIGLYPH_CC @"\ue969"
#define WIKIGLYPH_PUBLIC_DOMAIN @"\ue96c"

Remove unused glyph font defines.

Remove unused glyph font defines.


/*===- Operator.h - libSimulation -=============================================
*
*                                  DEMON
*
* This file is distributed under the BSD Open Source License. See LICENSE.TXT
* for details.
*
*===-----------------------------------------------------------------------===*/

#ifndef OPERATOR_H
#define OPERATOR_H

#include "Cloud.h"

class Operator {
public:
	Cloud * const cloud;
	Operator(Cloud * const myCloud) : cloud(myCloud) {}
	virtual ~Operator() {}

	virtual void operation1(const double currentTime)=0;
	virtual void operation2(const double currentTime)=0;
	virtual void operation3(const double currentTime)=0;
	virtual void operation4(const double currentTime)=0;
};

#endif // OPERATOR_H

/*===- Operator.h - libSimulation -=============================================
*
*                                  DEMON
*
* This file is distributed under the BSD Open Source License. See LICENSE.TXT
* for details.
*
*===-----------------------------------------------------------------------===*/

#ifndef OPERATOR_H
#define OPERATOR_H

#include "Cloud.h"

typedef unsigned int operator_index;

class Operator {
public:
	Cloud * const cloud;
	Operator(Cloud * const myCloud) : cloud(myCloud) {}
	virtual ~Operator() {}

	virtual void operation1(const double currentTime)=0;
	virtual void operation2(const double currentTime)=0;
	virtual void operation3(const double currentTime)=0;
	virtual void operation4(const double currentTime)=0;
};

#endif // OPERATOR_H

Add typedef to number of operators. This will help inside code to distinguish from counting particles, forces or operators.


/* $Id$ $Revision$ */
/* vim:set shiftwidth=4 ts=8: */

/**********************************************************
*      This software is part of the graphviz package      *
*                http://www.graphviz.org/                 *
*                                                         *
*            Copyright (c) 1994-2004 AT&T Corp.           *
*                and is licensed under the                *
*            Common Public License, Version 1.0           *
*                      by AT&T Corp.                      *
*                                                         *
*        Information and Software Systems Research        *
*              AT&T Research, Florham Park NJ             *
**********************************************************/

#ifndef FILTER_H
#define FILTER_H
#include "btree.h"

typedef struct _tv_filters
{
	tv_filter** filters;
	int filter_count;
}tv_filters;

int clear_filter(tv_filter* f);
int init_filters(tv_filters* filters);
int add_filter_to_filters(tv_filters* filters,tv_filter* filter);
int clear_filters(tv_filters* filters);
int union_filter(tv_filter* f1,tv_filter* f2);
int intersect_filter(tv_filter* f1,tv_filter* f2);

#endif

/* $Id$ $Revision$ */
/* vim:set shiftwidth=4 ts=8: */

/**********************************************************
*      This software is part of the graphviz package      *
*                http://www.graphviz.org/                 *
*                                                         *
*            Copyright (c) 1994-2004 AT&T Corp.           *
*                and is licensed under the                *
*            Common Public License, Version 1.0           *
*                      by AT&T Corp.                      *
*                                                         *
*        Information and Software Systems Research        *
*              AT&T Research, Florham Park NJ             *
**********************************************************/

#ifndef FILTER_H
#define FILTER_H
#include "btree.h"

typedef struct _tv_filters {
    tv_filter **filters;
    int filter_count;
} tv_filters;

int clear_filter(tv_filter * f);
int init_filters(tv_filters * filters);
int add_filter_to_filters(tv_filters * filters, tv_filter * filter);
int clear_filters(tv_filters * filters);
int union_filter(tv_filter * f1, tv_filter * f2);
int intersect_filter(tv_filter * f1, tv_filter * f2);

#endif

Clean up smyrna files: remove unnecessary globals modify libraries not to rely on code in cmd/smyrna remove static declarations from .h files remove unnecessary libraries mark unused code and clean up warnings


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

#include "cem/rocks.h"

static void test_set_rock_blocks(void) {
  const int shape[2] = {10, 20};
  double **z = (double**)malloc(sizeof(double*) * shape[0]);
  char **rock_type = (char**)malloc(sizeof(char*) * shape[0]);
  int i;
  char expected[20] = {
    'f', 'f', 's', 's', 's',
    'f', 'f', 's', 's', 's', 'f', 'f', 's', 's', 's',
    'f', 'f', 's', 's', 's'
  };

  z[0] = (double*)malloc(sizeof(double) * shape[0] * shape[1]);
  rock_type[0] = (char*)malloc(sizeof(char) * shape[0] * shape[1]);
  for (i=1; i < shape[0]; i++) {
    z[i] = z[i-1] + shape[1];
    rock_type[i] = rock_type[i-1] + shape[1];
  }

  set_rock_blocks(rock_type, z, shape[0], shape[1], 2);

  for (i=0; i < shape[0]; i++)
    g_assert_cmpmem(rock_type[i], shape[1], expected, shape[1]);

  free(rock_type[0]);
  free(rock_type);
  free(z[0]);
  free(z);
}

int main(int argc, char* argv[]) {
  g_test_init(&argc, &argv, NULL);
  g_test_add_func("/cem/rocks/set_blocks", &test_set_rock_blocks);

  return g_test_run();
}

Add unit tests for rocks.c.

Add unit tests for rocks.c.


#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(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);
}

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();
}

Make a pointer-signedness warning in testing magically disappear~


#ifndef __RSImg_h__
#define __RSImg_h__

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

extern "C" int RSImgFreadPPMP6Header(FILE *file, uint32_t *width, uint32_t *height, uint32_t *headerSize);

#endif

Add a header for use from C++

Add a header for use from C++


#ifndef http_h
#define http_h

typedef struct http_context_s http_context;
typedef struct http_session_s http_session;
typedef struct http_request_s http_request;

/*
 * A Context is bound to a collection of sessions and
 * ongoing requests. Each thread in a process should have its
 * own Context to avoid deadlocks and conflicts.
 */
http_context* http_context_create();
void http_context_release(http_context* ctx);

/*
 * A session represents an active communication line to a server.
 * One or more network sockets may be open to the server to
 * fulfill requests. Pipelining will be used if supported by server.
 */
http_session* http_session_open(http_context* ctx, const char* host, int port);
void http_session_close(http_session* session);

http_request* http_request_create(http_session* session, const char* path, http_method method);
http_request* http_request_get(http_session* session, const char* path);
http_request* http_request_post(http_session* session, const char* path);

#endif

Add primary header with initial API draft.


//codigo para hecer pruebas de como funciona github.
//programa simple que suma, resta, multiplica y divide numeros ingresador por pantalla.

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

void sumar(int a, int b);
void restar(int a,int b);

int main() {

    int a,b;
	printf("Bienvenido... Ingrese 2 numeros");
    printf ("Primer numero: ");   scanf ("%d",&a);
    printf ("Segundo numero: ");  scanf ("%d",&b);
    sumar(a,b);
	restar(a,b);

    //implementar resta, multiplicacion, division

    return (EXIT_SUCCESS);
}
void restar(int a,int b){
	printf("La resta es: %d",a-b);
}
void sumar(int a, int b){
     printf ("La suma es: %d",a+b);
}

//codigo para hecer pruebas de como funciona github.
//programa simple que suma, resta, multiplica y divide numeros ingresador por pantalla.

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

void sumar(int a, int b);
void restar(int a,int b);

int main() {

    int a,b;
    printf ("Primer numero: ");   scanf ("%d",&a);
    printf ("Segundo numero: ");  scanf ("%d",&b);
    sumar(a,b);
	restar(a,b);

    //implementar resta, multiplicacion, division

    return (EXIT_SUCCESS);
}
void restar(int a,int b){
	print("La resta es: %d",a-b);
}
void sumar(int a, int b){
     printf ("La suma es: %d",a+b);
}

Revert "Corregido Error en Funcion restar"

This reverts commit d8e984f0ea7d12526e1069292ed85025178d8d67.


#ifndef SRC_CONFIG_H_S6A1C09K
#define SRC_CONFIG_H_S6A1C09K

/* package name */
#define PACKAGE "pianobar"

#define VERSION "2014.06.08-dev"

/* ffmpeg/libav quirks detection
 * ffmpeg’s micro versions always start at 100, that’s how we can distinguish
 * ffmpeg and libav */
#include <libavfilter/version.h>

/* is "timeout" option present (all versions of ffmpeg, not libav) */
#if LIBAVFILTER_VERSION_MICRO >= 100
#define HAVE_AV_TIMEOUT
#endif

/* does graph_send_command exist (ffmpeg >=2.2) */
#if LIBAVFILTER_VERSION_MAJOR == 4 && \
		LIBAVFILTER_VERSION_MICRO >= 100
#define HAVE_AVFILTER_GRAPH_SEND_COMMAND
#endif

/* need avcodec.h (ffmpeg 1.2) */
#if LIBAVFILTER_VERSION_MAJOR == 3 && \
		LIBAVFILTER_VERSION_MINOR <= 42 && \
		LIBAVFILTER_VERSION_MINOR > 32 && \
		LIBAVFILTER_VERSION_MICRO >= 100
#define HAVE_AV_BUFFERSINK_GET_BUFFER_REF
#define HAVE_LIBAVFILTER_AVCODEC_H
#endif

#endif /* SRC_CONFIG_H_S6A1C09K */

#ifndef SRC_CONFIG_H_S6A1C09K
#define SRC_CONFIG_H_S6A1C09K

/* package name */
#define PACKAGE "pianobar"

#define VERSION "2014.06.08-dev"

/* ffmpeg/libav quirks detection
 * ffmpeg’s micro versions always start at 100, that’s how we can distinguish
 * ffmpeg and libav */
#include <libavfilter/version.h>

/* is "timeout" option present (all versions of ffmpeg, not libav) */
#if LIBAVFILTER_VERSION_MICRO >= 100
#define HAVE_AV_TIMEOUT
#endif

/* does graph_send_command exist (ffmpeg >=2.2) */
#if LIBAVFILTER_VERSION_MAJOR >= 4 && \
		LIBAVFILTER_VERSION_MICRO >= 100
#define HAVE_AVFILTER_GRAPH_SEND_COMMAND
#endif

/* need avcodec.h (ffmpeg 1.2) */
#if LIBAVFILTER_VERSION_MAJOR == 3 && \
		LIBAVFILTER_VERSION_MINOR <= 42 && \
		LIBAVFILTER_VERSION_MINOR > 32 && \
		LIBAVFILTER_VERSION_MICRO >= 100
#define HAVE_AV_BUFFERSINK_GET_BUFFER_REF
#define HAVE_LIBAVFILTER_AVCODEC_H
#endif

#endif /* SRC_CONFIG_H_S6A1C09K */

Fix volume control with ffmpeg 2.3

Fix volume control with ffmpeg 2.3


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

#import "Bolts.h"

@interface BFTaskCenter : NSObject

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

+ (nonnull instancetype)defaultCenter;

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

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

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

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

@end

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

#import "Bolts.h"

NS_ASSUME_NONNULL_BEGIN

@interface BFTaskCenter : NSObject

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

+ (instancetype)defaultCenter;

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

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

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

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

@end

NS_ASSUME_NONNULL_END

Fix compiler warning for nullable check

Fix compiler warning for nullable check


#pragma once

#include "cal3d/global.h"
#include "cal3d/vector.h"

typedef unsigned long CalColor32; // 32-bit integer, compatible with NSPR

inline CalColor32 CalMakeColor(CalVector cv) {
    return
      ( ( unsigned int ) ( cv.z * 0xff ) << 0) +
      ( ( ( unsigned int ) ( cv.y * 0xff ) ) << 8 ) +
      ( ( ( unsigned int ) ( cv.x * 0xff ) ) << 16 ) +
      0xff000000;
}

inline CalVector CalVectorFromColor(CalColor32 color) {
    return CalVector(
        ((color >> 16) & 0xff) / float(0xff),
        ((color >> 8) & 0xff) / float(0xff),
        ((color >> 0) & 0xff) / float(0xff));
}

#pragma once

#include "cal3d/global.h"
#include "cal3d/vector.h"

typedef unsigned int CalColor32; // 32-bit integer, compatible with NSPR

inline CalColor32 CalMakeColor(CalVector cv) {
    return
      ( ( unsigned int ) ( cv.z * 0xff ) << 0) +
      ( ( ( unsigned int ) ( cv.y * 0xff ) ) << 8 ) +
      ( ( ( unsigned int ) ( cv.x * 0xff ) ) << 16 ) +
      0xff000000;
}

inline CalVector CalVectorFromColor(CalColor32 color) {
    return CalVector(
        ((color >> 16) & 0xff) / float(0xff),
        ((color >> 8) & 0xff) / float(0xff),
        ((color >> 0) & 0xff) / float(0xff));
}

Unify and simplify a lot of pixomatic code

git-svn-id: febc42a3fd39fb08e5ae2b2182bc5ab0a583559c@51002 07c76cb3-cb09-0410-85de-c24d39f1912e


/** @file
  This file defines the data structures that are architecturally defined for file
  images loaded via the FirmwareVolume protocol.  The Firmware Volume specification
  is the basis for these definitions.

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

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

  Module Name:  FrameworkFimrwareVolumeImageFormat.h

  @par Revision Reference:
  These definitions are from Firmware Volume Spec 0.9.

**/

#ifndef __FRAMEWORK_FIRMWARE_VOLUME_IMAGE_FORMAT_H__
#define __FRAMEWORK_FIRMWARE_VOLUME_IMAGE_FORMAT_H__

//
// Bit values for AuthenticationStatus
//
#define EFI_AGGREGATE_AUTH_STATUS_PLATFORM_OVERRIDE 0x000001
#define EFI_AGGREGATE_AUTH_STATUS_IMAGE_SIGNED      0x000002
#define EFI_AGGREGATE_AUTH_STATUS_NOT_TESTED        0x000004
#define EFI_AGGREGATE_AUTH_STATUS_TEST_FAILED       0x000008
#define EFI_AGGREGATE_AUTH_STATUS_ALL               0x00000f

#define EFI_LOCAL_AUTH_STATUS_PLATFORM_OVERRIDE     0x010000
#define EFI_LOCAL_AUTH_STATUS_IMAGE_SIGNED          0x020000
#define EFI_LOCAL_AUTH_STATUS_NOT_TESTED            0x040000
#define EFI_LOCAL_AUTH_STATUS_TEST_FAILED           0x080000
#define EFI_LOCAL_AUTH_STATUS_ALL                   0x0f0000

#endif

Add some definitions in Framework FV 0.9 spec but not in PI 1.0.

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


#ifndef __YANIMATED__
#define __YANIMATED__

typedef struct YFrame
{
	int current;
	int first;
	int last;
	int width;
	int height;
	int fps;
	YFrame(){};
	YFrame(int a_current,
		   int a_first,
		   int a_last,
		   int a_width,
		   int a_height,
		   int a_fps):
		   current(a_current),
		   first(a_first),
		   last(a_last),
		   width(a_width),
		   height(a_height),
		   fps(a_fps){};
} YFrame;

#endif /** __YANIMATED__ **/

#ifndef __YANIMATED__
#define __YANIMATED__

/*!
  Store animation frame indexes
*/
typedef struct YFrame
{
	//! Default Constructor
	YFrame(): current(0),
			  first(0),
			  last(0){};
	//! Constructor with parameters
	/*!
	  \param Current animation frame index
	  \param First animation frame index
	  \param Last animation frame index
	*/
	YFrame(int a_current,
		   int a_first,
		   int a_last):
		   current(a_current),
		   first(a_first),
		   last(a_last){};
	int current; //! Current frame index
	int first; //! First frame index
	int last; //! Last frame index
} YFrame;

#endif /** __YANIMATED__ **/

Remove width, height and fps variable from YFrame struct


/*
 * Use and distribution licensed under the Apache license version 2.
 *
 * See the COPYING file in the root project directory for full text.
 */

#ifndef SQLTOAST_DATA_TYPE_H
#define SQLTOAST_DATA_TYPE_H

namespace sqltoast {

typedef enum data_type {
    DATA_TYPE_CHAR,
    DATA_TYPE_VARCHAR,
    DATA_TYPE_NCHAR,
    DATA_TYPE_VARNCHAR,
    DATA_TYPE_BIT,
    DATA_TYPE_VARBIT,
    DATA_TYPE_NUMERIC,
    DATA_TYPE_DECIMAL,
    DATA_TYPE_INT,
    DATA_TYPE_SMALLINT,
    DATA_TYPE_FLOAT,
    DATA_TYPE_DOUBLE,
    DATA_TYPE_DATE,
    DATA_TYPE_TIME,
    DATA_TYPE_TIMESTAMP,
    DATA_TYPE_INTERVAL
} data_type_t;

} // namespace sqltoast

#endif /* SQLTOAST_DATA_TYPE_H */

Add standard ANSI-92 data types

Add standard ANSI-92 data types


#ifndef BITCOIN_TIMESTAMPS_H
#define BITCOIN_TIMESTAMPS_H

static const unsigned int ENTROPY_SWITCH_TIME = 1362791041; // Sat, 09 Mar 2013 01:04:01 GMT
static const unsigned int STAKE_SWITCH_TIME = 1371686400; // Thu, 20 Jun 2013 00:00:00 GMT
static const unsigned int TARGETS_SWITCH_TIME = 1374278400; // Sat, 20 Jul 2013 00:00:00 GMT
static const unsigned int CHAINCHECKS_SWITCH_TIME = 1379635200; // Fri, 20 Sep 2013 00:00:00 GMT
static const unsigned int STAKECURVE_SWITCH_TIME = 1382227200; // Sun, 20 Oct 2013 00:00:00 GMT
static const unsigned int FEE_SWITCH_TIME = 1405814400; // Sun, 20 Jul 2014 00:00:00 GMT

static const unsigned int VALIDATION_SWITCH_TIME = 1408492800; // Wed, 20 Aug 2014 00:00:00 GMT

#endif

#ifndef BITCOIN_TIMESTAMPS_H
#define BITCOIN_TIMESTAMPS_H

static const unsigned int ENTROPY_SWITCH_TIME = 1362791041; // Sat, 09 Mar 2013 01:04:01 GMT
static const unsigned int STAKE_SWITCH_TIME = 1371686400; // Thu, 20 Jun 2013 00:00:00 GMT
static const unsigned int TARGETS_SWITCH_TIME = 1374278400; // Sat, 20 Jul 2013 00:00:00 GMT
static const unsigned int CHAINCHECKS_SWITCH_TIME = 1379635200; // Fri, 20 Sep 2013 00:00:00 GMT
static const unsigned int STAKECURVE_SWITCH_TIME = 1382227200; // Sun, 20 Oct 2013 00:00:00 GMT
static const unsigned int FEE_SWITCH_TIME = 1405814400; // Sun, 20 Jul 2014 00:00:00 GMT

static const unsigned int VALIDATION_SWITCH_TIME = 1408492800; // Wed, 20 Aug 2014 00:00:00 GMT
static const unsigned int SIG_SWITCH_TIME = 1411171200; // Sat, 20 Sep 2014 00:00:00 GMT

#endif

Add SIG_SWITCH_TIME at Sat, 20 Sep 2014

Add SIG_SWITCH_TIME at Sat, 20 Sep 2014


// Copyright (c) 2009-2010 Satoshi Nakamoto
// Copyright (c) 2009-2015 The Bitcoin Core developers
// Copyright (c) 2014-2017 The Dash Core developers
// Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.

#ifndef BITCOIN_VALIDATION_H
#define BITCOIN_VALIDATION_H

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

static const int64_t DEFAULT_MAX_TIP_AGE = 1 * 60 * 60; // ~45 blocks behind -> 2 x fork detection time, was 24 * 60 * 60 in bitcoin

extern int64_t nMaxTipAge;

class CBlockIndex;

FILE* OpenBlockFile(unsigned int nFile, unsigned int nBlockPos, const char* pszMode="rb");
FILE* AppendBlockFile(unsigned int& nFileRet);

bool IsInitialBlockDownload();

/** Guess verification progress (as a fraction between 0.0=genesis and 1.0=current tip). */
double GuessVerificationProgress(CBlockIndex* pindex);

#endif // BITCOIN_VALIDATION_H

// Copyright (c) 2009-2010 Satoshi Nakamoto
// Copyright (c) 2009-2015 The Bitcoin Core developers
// Copyright (c) 2014-2017 The Dash Core developers
// Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.

#ifndef BITCOIN_VALIDATION_H
#define BITCOIN_VALIDATION_H

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

static const int64_t DEFAULT_MAX_TIP_AGE = 120; // ~45 blocks behind -> 2 x fork detection time, was 24 * 60 * 60 in bitcoin

extern int64_t nMaxTipAge;

class CBlockIndex;

FILE* OpenBlockFile(unsigned int nFile, unsigned int nBlockPos, const char* pszMode="rb");
FILE* AppendBlockFile(unsigned int& nFileRet);

bool IsInitialBlockDownload();

/** Guess verification progress (as a fraction between 0.0=genesis and 1.0=current tip). */
double GuessVerificationProgress(CBlockIndex* pindex);

#endif // BITCOIN_VALIDATION_H

Update default max tip age

Update default max tip age


//===-- xray_emulate_tsc.h --------------------------------------*- C++ -*-===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
//
// This file is a part of XRay, a dynamic runtime instrumentation system.
//
//===----------------------------------------------------------------------===//
#ifndef XRAY_EMULATE_TSC_H
#define XRAY_EMULATE_TSC_H

#include "sanitizer_common/sanitizer_internal_defs.h"
#include "xray_defs.h"
#include <cstdint>
#include <time.h>

namespace __xray {

static constexpr uint64_t NanosecondsPerSecond = 1000ULL * 1000 * 1000;

ALWAYS_INLINE uint64_t readTSC(uint8_t &CPU) XRAY_NEVER_INSTRUMENT {
  timespec TS;
  int result = clock_gettime(CLOCK_REALTIME, &TS);
  if (result != 0) {
    Report("clock_gettime(2) returned %d, errno=%d.", result, int(errno));
    TS.tv_sec = 0;
    TS.tv_nsec = 0;
  }
  CPU = 0;
  return TS.tv_sec * NanosecondsPerSecond + TS.tv_nsec;
}
}

#endif // XRAY_EMULATE_TSC_H

//===-- xray_emulate_tsc.h --------------------------------------*- C++ -*-===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
//
// This file is a part of XRay, a dynamic runtime instrumentation system.
//
//===----------------------------------------------------------------------===//
#ifndef XRAY_EMULATE_TSC_H
#define XRAY_EMULATE_TSC_H

#include "sanitizer_common/sanitizer_internal_defs.h"
#include "xray_defs.h"
#include <cerrno>
#include <cstdint>
#include <time.h>

namespace __xray {

static constexpr uint64_t NanosecondsPerSecond = 1000ULL * 1000 * 1000;

ALWAYS_INLINE uint64_t readTSC(uint8_t &CPU) XRAY_NEVER_INSTRUMENT {
  timespec TS;
  int result = clock_gettime(CLOCK_REALTIME, &TS);
  if (result != 0) {
    Report("clock_gettime(2) returned %d, errno=%d.", result, int(errno));
    TS.tv_sec = 0;
    TS.tv_nsec = 0;
  }
  CPU = 0;
  return TS.tv_sec * NanosecondsPerSecond + TS.tv_nsec;
}
}

#endif // XRAY_EMULATE_TSC_H

Fix missing include of <cerrno>

[XRay][compiler-rt] Fix missing include of <cerrno>

Futher attempt to un-break ARM and AArch64 build.

Follow-up on D25360.

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