#include <pal.h>

/**
 *
 * Calculates the hyperbolic tangent of the input vector 'a'.
 * Angles are specified in radians.
 *
 * @param a     Pointer to input vector
 *
 * @param c     Pointer to output vector
 *
 * @param n     Size of 'a' and 'c' vector.
 *
 * @return      None
 *
 */
#include <math.h>
void p_tanh_f32(const float *a, float *c, int n)
{
    int i;
    for (i = 0; i < n; i++) {
        *(c + i) = tanhf(*(a + i));
    }
}

#include <pal.h>

#include "p_exp.h"

/*
 * tanh z = sinh z / cosh z
 *        = (exp z - exp -z) / (exp z + ezp -z)
 *        = (exp 2z - 1) / (exp 2z + 1)
 */
static inline float _p_tanh(const float z)
{
    float exp_2z = _p_exp(2.f * z);
    return (exp_2z - 1.f) / (exp_2z + 1.f);
}

/**
 *
 * Calculates the hyperbolic tangent of the input vector 'a'.
 * Angles are specified in radians.
 *
 * @param a     Pointer to input vector
 *
 * @param c     Pointer to output vector
 *
 * @param n     Size of 'a' and 'c' vector.
 *
 * @return      None
 *
 */
void p_tanh_f32(const float *a, float *c, int n)
{
    int i;
    for (i = 0; i < n; i++) {
        c[i] = _p_tanh(a[i]);
    }
}

math:tanh: Implement the hyperbolic tangent function.

Signed-off-by: Mansour Moufid <ac5f6b12fab5e0d4efa7215e6c2dac9d55ab77dc@gmail.com>


Add more comments describing Stat_t and Axis_t

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


#pragma once

#include <vector>
#include <boost/multiprecision/cpp_int.hpp>

namespace dev
{
namespace eth
{
namespace jit
{

using byte = uint8_t;
using bytes = std::vector<byte>;
using u256 = boost::multiprecision::uint256_t;
using bigint = boost::multiprecision::cpp_int;

struct NoteChannel {};	// FIXME: Use some log library?

enum class ReturnCode
{
	Stop = 0,
	Return = 1,
	Suicide = 2,

	BadJumpDestination = 101,
	OutOfGas = 102,
	StackTooSmall = 103,
	BadInstruction = 104,

	LLVMConfigError = 201,
	LLVMCompileError = 202,
	LLVMLinkError = 203,
};

/// Representation of 256-bit value binary compatible with LLVM i256
// TODO: Replace with h256
struct i256
{
	uint64_t a;
	uint64_t b;
	uint64_t c;
	uint64_t d;
};
static_assert(sizeof(i256) == 32, "Wrong i265 size");

#define UNTESTED assert(false)

}
}
}

#pragma once

#include <vector>
#include <boost/multiprecision/cpp_int.hpp>

namespace dev
{
namespace eth
{
namespace jit
{

using byte = uint8_t;
using bytes = std::vector<byte>;
using u256 = boost::multiprecision::uint256_t;
using bigint = boost::multiprecision::cpp_int;

struct NoteChannel {};	// FIXME: Use some log library?

enum class ReturnCode
{
	Stop = 0,
	Return = 1,
	Suicide = 2,

	BadJumpDestination = 101,
	OutOfGas = 102,
	StackTooSmall = 103,
	BadInstruction = 104,

	LLVMConfigError = 201,
	LLVMCompileError = 202,
	LLVMLinkError = 203,
};

/// Representation of 256-bit value binary compatible with LLVM i256
// TODO: Replace with h256
struct i256
{
	uint64_t a = 0;
	uint64_t b = 0;
	uint64_t c = 0;
	uint64_t d = 0;
};
static_assert(sizeof(i256) == 32, "Wrong i265 size");

#define UNTESTED assert(false)

}
}
}

Fix some GCC initialization warnings

Fix some GCC initialization warnings


// RUN: %ocheck 0 %s
// RUN: %ocheck 0 %s -fstack-protector-all

extern void abort(void);

as, bs, fs;

static int a(){ as++; return 2; }
static int b(){ bs++; return 2; }

static int f(int p[a()][b()])
{
	fs++;
	return p[0][0] + p[0][1] + p[1][0] + p[1][1];
}

static void assert(_Bool b)
{
	if(!b)
		abort();
}

int main()
{
	int ar[a()][b()];

	assert(as == 1);
	assert(bs == 1);
	assert(fs == 0);

	ar[0][0] = 5;
	ar[0][1] = 4;
	ar[1][0] = 3;
	ar[1][1] = 2;

	assert(as == 1);
	assert(bs == 1);
	assert(fs == 0);

	assert(f(ar) == 14);

	assert(as == 2);
	assert(bs == 2);
	assert(fs == 1);

	return 0;
}

// RUN: %ocheck 0 %s
// RUN: %ocheck 0 %s -fstack-protector-all

extern void abort(void);

as, bs, fs;

static int a(){ as++; return 2; }
static int b(){ bs++; return 2; }

static int f(int p[a()][b()])
{
	fs++;
	return p[0][0] // 5
		+ p[0][1] // 4
		+ p[1][0] // 3
		+ p[1][1] // 2
		+ sizeof(p) // sizeof(T (*)[...]) = 8
		+ sizeof(p[0]) // 2 * sizeof(int) = 8
		+ sizeof(p[1][2]); // sizeof(int) = 4
}

static void assert(_Bool b)
{
	if(!b)
		abort();
}

int main()
{
	int ar[a()][b()];

	assert(as == 1);
	assert(bs == 1);
	assert(fs == 0);

	ar[0][0] = 5;
	ar[0][1] = 4;
	ar[1][0] = 3;
	ar[1][1] = 2;

	assert(as == 1);
	assert(bs == 1);
	assert(fs == 0);

	assert(f(ar) == 34);

	assert(as == 2);
	assert(bs == 2);
	assert(fs == 1);

	return 0;
}

Improve checks for vla-argument test

Improve checks for vla-argument test


/* ===-- int_util.h - internal utility functions ----------------------------===
 *
 *                     The LLVM Compiler Infrastructure
 *
 * This file is dual licensed under the MIT and the University of Illinois Open
 * Source Licenses. See LICENSE.TXT for details.
 *
 * ===-----------------------------------------------------------------------===
 *
 * This file is not part of the interface of this library.
 *
 * This file defines non-inline utilities which are available for use in the
 * library. The function definitions themselves are all contained in int_util.c
 * which will always be compiled into any compiler-rt library.
 *
 * ===-----------------------------------------------------------------------===
 */

#ifndef INT_UTIL_H
#define INT_UTIL_H

/** \brief Trigger a program abort (or panic for kernel code). */
#define compilerrt_abort() compilerrt_abort_impl(__FILE__, __LINE__, \
                                                 __FUNCTION__)
void compilerrt_abort_impl(const char *file, int line,
                           const char *function)
#ifndef KERNEL_USE
  __attribute__((weak))
#endif
  __attribute__((noreturn)) __attribute__((visibility("hidden")));

#endif /* INT_UTIL_H */

/* ===-- int_util.h - internal utility functions ----------------------------===
 *
 *                     The LLVM Compiler Infrastructure
 *
 * This file is dual licensed under the MIT and the University of Illinois Open
 * Source Licenses. See LICENSE.TXT for details.
 *
 * ===-----------------------------------------------------------------------===
 *
 * This file is not part of the interface of this library.
 *
 * This file defines non-inline utilities which are available for use in the
 * library. The function definitions themselves are all contained in int_util.c
 * which will always be compiled into any compiler-rt library.
 *
 * ===-----------------------------------------------------------------------===
 */

#ifndef INT_UTIL_H
#define INT_UTIL_H

/** \brief Trigger a program abort (or panic for kernel code). */
#define compilerrt_abort() compilerrt_abort_impl(__FILE__, __LINE__, \
                                                 __FUNCTION__)

void compilerrt_abort_impl(const char *file, int line,
                           const char *function) __attribute__((noreturn));

#endif /* INT_UTIL_H */

Remove __attribute__((weak)) on function prototype.  It has a different meaning on prototypes then it does on definitions.  It is not needed on the prototype and causes build failures for static codegen

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


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

#include "../lib/libunshield.h"

int main(int argc, char** argv)
{
  unsigned seed = 0;
  FILE* input = NULL;
  FILE* output = NULL;
  size_t size;
  unsigned char buffer[16384];

  if (argc != 3)
  {
    fprintf(stderr,
        "Syntax:\n"
        "  %s INPUT-FILE OUTPUT-FILE\n",
        argv[0]);
    exit(1);
  }

  input = fopen(argv[1], "r");
  if (!input)
  {
    fprintf(stderr,
        "Failed to open %s for reading\n",
        argv[1]);
    exit(2);
  }

  output = fopen(argv[2], "w");
  if (!output)
  {
    fprintf(stderr,
        "Failed to open %s for writing\n",
        argv[2]);
    exit(3);
  }

  while ((size = fread(buffer, 1, sizeof(buffer), input)) != 0)
  {
    unshield_deobfuscate(buffer, size, &seed);
    if (fwrite(buffer, 1, size, output) != size)
    {
      fprintf(stderr,
          "Failed to write %lu bytes to %s\n",
          (unsigned long)size, argv[2]);
      exit(4);
    }
  }

  fclose(input);
  fclose(output);
  return 0;
}

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

#include "../lib/libunshield.h"

int main(int argc, char** argv)
{
  unsigned seed = 0;
  FILE* input = NULL;
  FILE* output = NULL;
  size_t size;
  unsigned char buffer[16384];

  if (argc != 3)
  {
    fprintf(stderr,
        "Syntax:\n"
        "  %s INPUT-FILE OUTPUT-FILE\n",
        argv[0]);
    exit(1);
  }

  input = fopen(argv[1], "rb");
  if (!input)
  {
    fprintf(stderr,
        "Failed to open %s for reading\n",
        argv[1]);
    exit(2);
  }

  output = fopen(argv[2], "wb");
  if (!output)
  {
    fprintf(stderr,
        "Failed to open %s for writing\n",
        argv[2]);
    exit(3);
  }

  while ((size = fread(buffer, 1, sizeof(buffer), input)) != 0)
  {
    unshield_deobfuscate(buffer, size, &seed);
    if (fwrite(buffer, 1, size, output) != size)
    {
      fprintf(stderr,
          "Failed to write %lu bytes to %s\n",
          (unsigned long)size, argv[2]);
      exit(4);
    }
  }

  fclose(input);
  fclose(output);
  return 0;
}

Fix for binary files on Windows

Fix for binary files on Windows

Thanks @Djamana

Closes #46


#ifndef _LISPY_H
#define _LISPY_H

#include "lib/mpc.h"

/* Compile these functions if we're on Windows */
#ifdef _WIN32

static char buffer[2048];

char* readline(char* prompt) {
	fputs(prompt, stdout);
	fgets(buffer, 2048, stdin);
	char* cpy = malloc(strlen(buffer) + 1);
	strcpy(cpy, buffer);
	cpy[strlen(cpy) - 1] = "\0";
	return cpy;
}

void add_history(char* unused) {}

#elif __APPLE__

#include <editline/readline.h>

#else

#include <editline/readline.h>
#include <editline/history.h>

#endif

/***************************
* Macros, Enums, and Structs
***************************/
#define LASSERT(args, cond, err) if (!(cond)) { lval_del(args); return lval_err(err); }

/* lval possible types */
enum { LVAL_NUM, LVAL_ERR, LVAL_SYM, LVAL_SEXPR, LVAL_QEXPR };

/* Lisp Value struct */
typedef struct lval {
    int type;
    long num;
    /* String data for err and sym types */
    char* err;
    char* sym;
    /* Count and pointer to a list of lvals */
    int count;
    struct lval** cell;
} lval;

/**********************
* Function declarations
**********************/

lval* lval_num(long);
lval* lval_err(char*);
lval* lval_sym(char*);
lval* lval_sexpr(void);
lval* lval_qepxr(void);

void  lval_del(lval*);
lval* lval_add(lval*, lval*);

void lval_expr_print(lval*, char, char);
void lval_print(lval*);
void lval_println(lval*);

lval* lval_read_num(mpc_ast_t*);
lval* lval_read(mpc_ast_t*);

lval* lval_pop(lval*, int);
lval* lval_take(lval*, int);
lval* lval_eval(lval*);
lval* lval_eval_sexpr(lval*);

lval* builtin(lval*, char*);
lval* builtin_op(lval*, char*);
lval* builtin_head(lval*);
lval* builtin_tail(lval*);
lval* builtin_list(lval*);
lval* builtin_eval(lval*);
lval* builtin_join(lval*);
lval* lval_join(lval*, lval*);

#endif

Add header file to git

Add header file to git


//
//  FolderViewControllerDelegate.h
//  arc
//
//  Created by Jerome Cheng on 17/4/13.
//  Copyright (c) 2013 nus.cs3217. All rights reserved.
//

#import <Foundation/Foundation.h>
#import "File.h"
#import "Folder.h"

@class FolderViewController;

@protocol FolderViewControllerDelegate <NSObject>

- (void)folderViewController:(FolderViewController *)sender selectedFile:(id<File>)file;

- (void)folderViewController:(FolderViewController *)sender selectedFolder:(id<Folder>)folder;

@end

//
//  FolderViewControllerDelegate.h
//  arc
//
//  Created by Jerome Cheng on 17/4/13.
//  Copyright (c) 2013 nus.cs3217. All rights reserved.
//

#import <Foundation/Foundation.h>
#import "File.h"
#import "Folder.h"

@class FolderViewController;

@protocol FolderViewControllerDelegate <NSObject>

// Allows delegate to know which file or folder was selected in navigation mode.
- (void)folderViewController:(FolderViewController *)sender selectedFile:(id<File>)file;
- (void)folderViewController:(FolderViewController *)sender selectedFolder:(id<Folder>)folder;

// Allows the delegate to know if the controller has entered or left editing mode.
- (void)folderViewController:(FolderViewController *)folderviewController
     DidEnterEditModeAnimate:(BOOL)animate;
- (void)folderViewController:(FolderViewController *)folderviewController DidExitEditModeAnimate:(BOOL)animate;

@end

Add methods to notify FolderView delegate when edit mode is toggled.


void abort();

int add(int a, int b) { return a + b; }
int sub(int a, int b) { return a - b; }
int mul(int a, int b) { return a * b; }
int div(int a, int b) { return a / b; }

int rem(int a, int b) { return a % b; }

long arr[5] = {(long)&add, (long)&sub, (long)&mul, (long)&div, (long)&rem };

int main() {
  int i;
  int sum = 0;
  for (i = 0; i < 10000; i++) {
    int (*p)(int x, int y) = (int (*)(int x, int y))arr[i % 5];
    sum += p(i, 2);
  }
  if (sum != 44991000) {
    abort();
  }
}

Add test case for casting longs to function pointers


#if (defined(__IPHONE_OS_VERSION_MIN_REQUIRED) && (!defined(__IPHONE_6_0) || __IPHONE_OS_VERSION_MIN_REQUIRED < __IPHONE_6_0)) || \
    (defined(__MAC_OS_X_VERSION_MIN_REQUIRED) && (!defined(__MAC_10_8) || __MAC_OS_X_VERSION_MIN_REQUIRED < __MAC_10_8))
#define PT_DISPATCH_RETAIN_RELEASE 1
#endif

#if (!defined(PT_DISPATCH_RETAIN_RELEASE))
#define PT_PRECISE_LIFETIME __attribute__((objc_precise_lifetime))
#define PT_PRECISE_LIFETIME_UNUSED __attribute__((objc_precise_lifetime, unused))
#else
#define PT_PRECISE_LIFETIME
#define PT_PRECISE_LIFETIME_UNUSED
#endif

#if (defined(__IPHONE_OS_VERSION_MIN_REQUIRED) && (!defined(__IPHONE_6_0) || __IPHONE_OS_VERSION_MIN_REQUIRED < __IPHONE_6_0)) || \
    (defined(__MAC_OS_X_VERSION_MIN_REQUIRED) && (!defined(__MAC_10_8) || __MAC_OS_X_VERSION_MIN_REQUIRED < __MAC_10_8))
#define PT_DISPATCH_RETAIN_RELEASE 1
#else
#define PT_DISPATCH_RETAIN_RELEASE 0
#endif

#if PT_DISPATCH_RETAIN_RELEASE
#define PT_PRECISE_LIFETIME
#define PT_PRECISE_LIFETIME_UNUSED
#else
#define PT_PRECISE_LIFETIME __attribute__((objc_precise_lifetime))
#define PT_PRECISE_LIFETIME_UNUSED __attribute__((objc_precise_lifetime, unused))
#endif

Synchronize logical grouping of defines

Synchronize logical grouping of defines


#ifndef _OBJC_MESSAGE_H_
#define _OBJC_MESSAGE_H_

#if defined(__x86_64) || defined(__i386) || defined(__arm__) || \
	defined(__mips_n64) || defined(__mips_n32)
/**
 * Standard message sending function.  This function must be cast to the
 * correct types for the function before use.  The first argument is the
 * receiver and the second the selector.
 *
 * Note that this function is not available on all architectures.  For a more
 * portable solution to sending arbitrary messages, consider using
 * objc_msg_lookup_sender() and then calling the returned IMP directly.
 *
 * This version of the function is used for all messages that return either an
 * integer, a pointer, or a small structure value that is returned in
 * registers.  Be aware that calling conventions differ between operating
 * systems even within the same architecture, so take great care if using this
 * function for small (two integer) structures.
 */
id objc_msgSend(id self, SEL _cmd, ...);
/**
 * Standard message sending function.  This function must be cast to the
 * correct types for the function before use.  The first argument is the
 * receiver and the second the selector.
 *
 * Note that this function is not available on all architectures.  For a more
 * portable solution to sending arbitrary messages, consider using
 * objc_msg_lookup_sender() and then calling the returned IMP directly.
 *
 * This version of the function is used for all messages that return a
 * structure that is not returned in registers.  Be aware that calling
 * conventions differ between operating systems even within the same
 * architecture, so take great care if using this function for small (two
 * integer) structures.
 */
#ifdef __cplusplus
id objc_msgSend_stret(id self, SEL _cmd, ...);
#else
void objc_msgSend_stret(id self, SEL _cmd, ...);
#endif
/**
 * Standard message sending function.  This function must be cast to the
 * correct types for the function before use.  The first argument is the
 * receiver and the second the selector.
 *
 * Note that this function is not available on all architectures.  For a more
 * portable solution to sending arbitrary messages, consider using
 * objc_msg_lookup_sender() and then calling the returned IMP directly.
 *
 * This version of the function is used for all messages that return floating
 * point values.
 */
long double objc_msgSend_fpret(id self, SEL _cmd, ...);

#endif

#endif //_OBJC_MESSAGE_H_

Fix clang's stupid warning to work around a bug in OS X headers...


#define ACPI_MACHINE_WIDTH 64
#define ACPI_SINGLE_THREADED
#define ACPI_DEBUG_OUTPUT
#define ACPI_DISASSEMBLER
#define ACPI_USE_LOCAL_CACHE
#define ACPI_INLINE inline
#define ACPI_USE_NATIVE_DIVIDE

// Depends on threading support
#define ACPI_DEBUGGER
#define DEBUGGER_THREADING DEBUGGER_SINGLE_THREADED
// Depends on debugger support
//#define ACPI_DBG_TRACK_ALLOCATIONS

#define ACPI_PHYS_BASE 0x100000000

#if 0
#define AcpiException(ModName, Line, Status, Format, ...) \
	AcpiOsPrintf(ACPI_MSG_EXCEPTION "%s, " Format, \
		AcpiFormatException(Status), \
		## __VA_ARGS__)
#endif

#include <stdint.h>
#include <stdarg.h>
#define AcpiOsPrintf printf
#define AcpiOsVprintf vprintf

#define ACPI_MACHINE_WIDTH 64
#define ACPI_SINGLE_THREADED
#define ACPI_DEBUG_OUTPUT
#define ACPI_DISASSEMBLER
#define ACPI_USE_LOCAL_CACHE
#define ACPI_INLINE inline
#define ACPI_USE_NATIVE_DIVIDE

// Depends on threading support
#define ACPI_DEBUGGER
#define DEBUGGER_THREADING DEBUGGER_SINGLE_THREADED
// Depends on debugger support
//#define ACPI_DBG_TRACK_ALLOCATIONS

#define ACPI_PHYS_BASE 0x100000000

#if 0
#define AcpiException(ModName, Line, Status, Format, ...) \
	AcpiOsPrintf(ACPI_MSG_EXCEPTION "%s, " Format, \
		AcpiFormatException(Status), \
		## __VA_ARGS__)
#endif

#define ACPI_GET_FUNCTION_NAME __FUNCTION__

#include <stdint.h>
#include <stdarg.h>
#define AcpiOsPrintf printf
#define AcpiOsVprintf vprintf

Use GCC's __FUNCTION__ for ACPI_GET_FUNCTION_NAME


#include <stdlib.h>
#include <ncurses.h>

/**
 * The main function, called when atcso is started (duh).
 */
int main(int argc, char** argv) {
    initscr();
    raw();      // Disable line buffering
    noecho();   // Don't show things the user is typing

    printw("hai wurld");
    refresh();

    while (getch() != 'q');  // Wait for the user to hit `q' to quit
    endwin();

    return EXIT_SUCCESS;
}

#include <stdlib.h>
#include <ncurses.h>
#include <time.h>

typedef struct {
} AtcsoData;

void mainloop();
WINDOW *createRadarWin();
void updateRadarWin(AtcsoData *data, WINDOW *radarWin);

/**
 * The main function, called when atcso is started (duh).
 */
int main(int argc, char **argv) {
    initscr();
    raw();                  // Disable line buffering
    noecho();               // Don't show things the user is typing
    nodelay(stdscr, TRUE);  // Non-blocking getch()

    mainloop();             // Start the game!

    endwin();
    return EXIT_SUCCESS;
}

/**
 * The main loop: runs infinitely until the game is ended.
 */
void mainloop() {
    // get all our windows
    refresh();
    WINDOW *radarWin = createRadarWin();

    // TODO put this somewhere... better
    const int TICK_DELAY = 2;

    // the main loop
    int ch;
    time_t lastTick = time(NULL);
    AtcsoData data;
    for (;;) {
        if (difftime(time(NULL), lastTick) > TICK_DELAY) {
            updateRadarWin(&data, radarWin);

            lastTick += TICK_DELAY;
        }

        if ((ch = getch()) != ERR) {
            switch (ch) {
            case 'q':
            case 'Q':
                goto cleanup;
            }
        }
    }

    cleanup:
    delwin(radarWin);
}

/**
 * Creates the radar window, the biggest one that has all the planes and stuff.
 */
WINDOW *createRadarWin() {
    WINDOW *radarWin = newwin(21, 60, 0, 0);

    for (int i = 0; i < 59; ++i) waddch(radarWin, '-');
    waddch(radarWin, ' ');
    for (int i = 0; i < 19; ++i) {
        waddstr(radarWin, "| ");
        for (int j = 0; j < 28; ++j) waddstr(radarWin, ". ");
        waddstr(radarWin, "| ");
    }
    for (int i = 0; i < 59; ++i) waddch(radarWin, '-');
    waddch(radarWin, ' ');

    wrefresh(radarWin);
    return radarWin;
}

/**
 * Update and refresh the radar window.
 */
void updateRadarWin(AtcsoData *data, WINDOW *radarWin) {
    // TODO do stuff
}

Implement outline of "radar window"

Implement outline of "radar window"

The radar window is simply the "main" window, with all the planes and
stuff.

This commit draws the outline of this window, and it also adds a few
pieces of code that will serve as a framework for future inter-window
communication.


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

#ifndef NSAPI_H
#define NSAPI_H

// entry point for nsapi types
#include "nsapi_types.h"

#ifdef __cplusplus

// entry point for C++ api
#include "netsocket/SocketAddress.h"
#include "netsocket/NetworkStack.h"

#include "netsocket/NetworkInterface.h"
#include "netsocket/EthInterface.h"
#include "netsocket/WiFiInterface.h"
#include "netsocket/CellularBase.h"
#include "netsocket/MeshInterface.h"

#include "netsocket/Socket.h"
#include "netsocket/UDPSocket.h"
#include "netsocket/TCPSocket.h"
#include "netsocket/TCPServer.h"

#endif

#endif

/** @}*/

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

#ifndef NSAPI_H
#define NSAPI_H

// entry point for nsapi types
#include "nsapi_types.h"

#ifdef __cplusplus

// entry point for C++ api
#include "netsocket/SocketAddress.h"
#include "netsocket/NetworkStack.h"

#include "netsocket/NetworkInterface.h"
#include "netsocket/EthInterface.h"
#include "netsocket/WiFiInterface.h"
#include "netsocket/CellularBase.h"
#include "netsocket/MeshInterface.h"

#include "netsocket/Socket.h"
#include "netsocket/UDPSocket.h"
#include "netsocket/TCPSocket.h"
#include "netsocket/TCPServer.h"
#include "netsocket/TLSSocket.h"

#endif

#endif

/** @}*/

Add missing include for TLSSocket

Add missing include for TLSSocket

TCP and UDP sockets are automatically available when mbed.h is
included in an application.

This change lets the TLSSocket be used in the same way.


#include <stdio.h>
#include <signal.h>
#include <unistd.h>
#include <assert.h>
#include <stdlib.h>
#include <setjmp.h>

jmp_buf try;

void handler(int sig) {
  static int i = 0;

  write(2, "stack overflow\n", 15);
  longjmp(try, ++i);
  _exit(1);
}

unsigned recurse(unsigned x) {
    return recurse(x)+1;
}

int main() {
  char* stack;
  stack = malloc(sizeof(stack) * SIGSTKSZ);
  stack_t ss = {
    .ss_size = SIGSTKSZ,
    .ss_sp = stack,
  };
  struct sigaction sa = {
    .sa_handler = handler,
    .sa_flags = SA_ONSTACK
  };

  sigaltstack(&ss, 0);
  sigfillset(&sa.sa_mask);
  sigaction(SIGSEGV, &sa, 0);
  if (setjmp(try) < 3) {
    recurse(0);
  } else {
    printf("caught exception!\n");
  }

  return 0;
}

#include <stdio.h>
#include <signal.h>
#include <unistd.h>
#include <assert.h>
#include <stdlib.h>
#include <setjmp.h>

jmp_buf try;

void handler(int sig) {
  static int i = 0;

  printf("stack overflow %d\n", i);
  longjmp(try, ++i);
  assert(0);
}

unsigned recurse(unsigned x) {
    return recurse(x)+1;
}

int main() {
  char* stack;
  stack = malloc(sizeof(stack) * SIGSTKSZ);
  stack_t ss = {
    .ss_size = SIGSTKSZ,
    .ss_sp = stack,
  };
  struct sigaction sa = {
    .sa_handler = handler,
    .sa_flags = SA_ONSTACK
  };

  sigaltstack(&ss, 0);
  sigfillset(&sa.sa_mask);
  sigaction(SIGSEGV, &sa, 0);

  if (setjmp(try) < 3) {
    recurse(0);
  } else {
    printf("caught exception!\n");
  }

  return 0;
}

Add assert, more print info

Add assert, more print info


// RUN: %clang_cc1 -E -fms-compatibility %s 2>&1 | grep 'doh.c:100:2: error: #import of type library is an unsupported Microsoft feature'
// RUN: %clang_cc1 -E -fms-compatibility %s 2>&1 | grep 'doh.c:200:2: error: #import of type library is an unsupported Microsoft feature'
// RUN: %clang_cc1 -E -fms-compatibility %s 2>&1 | grep 'doh.c:300:2: error: #import of type library is an unsupported Microsoft feature'

#line 100 "doh.c"
#import "pp-record.h" // expected-error {{#import of type library is an unsupported Microsoft feature}}

// Test attributes
#line 200 "doh.c"
#import "pp-record.h" no_namespace, auto_rename // expected-error {{#import of type library is an unsupported Microsoft feature}}

// This will also fire the "#import of type library is an unsupported Microsoft feature"
// error, but we can't use -verify because there's no way to put the comment on the proper line
#line 300 "doh.c"
#import "pp-record.h" no_namespace \
                      auto_rename \
                      auto_search

// RUN: %clang_cc1 -E -verify -fms-compatibility %s

#import "pp-record.h" // expected-error {{#import of type library is an unsupported Microsoft feature}}

// Test attributes
#import "pp-record.h" no_namespace, auto_rename // expected-error {{#import of type library is an unsupported Microsoft feature}}

#import "pp-record.h" no_namespace \
                      auto_rename \
                      auto_search
// expected-error@-3 {{#import of type library is an unsupported Microsoft feature}}

Migrate a test to -verify

Migrate a test to -verify

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


// Upwind updater
void updater_first_order_dimensional_splitting(real* q,
                                               const real* aux,
                                               const int nx,
                                               const int ny,
                                               const real* amdq,
                                               const real* apdq,
                                               const real* wave,
                                               const real* wave_speeds,
                                               const rp_grid_params grid_params
                                               )
{
  int col, row, idx_left, idx_center, idx_up, idx_out_x, idx_out_y;
  const int num_ghost = grid_params.num_ghost;
  const int num_states = grid_params.num_states;
  //  const int num_waves = rp_grid_params.num_waves;

#pragma omp parallel for schedule(runtime) nowait
  for(row = num_ghost; row <= ny + num_ghost; ++row) {
    for(col = num_ghost; col <= nx + num_ghost; ++col) {
      idx_left = col + row*(nx + 2*num_ghost) - 1;
      idx_up = col + (row - 1)*(nx + 2*num_ghost);
      idx_center = idx_left + 1;
      idx_out_x = (col - num_ghost) + (row - num_ghost) * (nx + 1);
      idx_out_y = idx_out_x + ((nx + 1)*(ny + 1));

      for(int state=0; state < num_states; ++state){
        q[idx_left*num_states + state]   -= amdq[idx_out_x*num_states + state];
        q[idx_up*num_states + state]     -= amdq[idx_out_y*num_states + state];
        q[idx_center*num_states + state] -= apdq[idx_out_x*num_states + state];
        q[idx_center*num_states + state] -= apdq[idx_out_y*num_states + state];
      }
    }
  }
}

Add first order dimensional sweep updating


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

//
// Symbols that need to be defined to use C++.  These are stubs and don't
// actually do anything
//

namespace __cxxabiv1
{
	class __class_type_info
	{
	public:
		__class_type_info() {}
		virtual ~__class_type_info() {}
	};

	class __si_class_type_info
	{
	public:
		__si_class_type_info() {}
		virtual ~__si_class_type_info() {}
	};

	__class_type_info cti;
	__si_class_type_info sicti;
}

void operator delete(void *ptr) throw()
{
}

extern "C" void __dso_handle()
{
}

extern "C" void __cxa_atexit()
{
}

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

//
// Symbols that need to be defined to use C++.  These are stubs and don't
// actually do anything
//

namespace __cxxabiv1
{
	class __class_type_info
	{
	public:
		__class_type_info() {}
		virtual ~__class_type_info() {}
	};

	class __si_class_type_info
	{
	public:
		__si_class_type_info() {}
		virtual ~__si_class_type_info() {}
	};

	__class_type_info cti;
	__si_class_type_info sicti;
}

void operator delete(void *ptr) throw()
{
}

void *__dso_handle;

extern "C" void __cxa_atexit(void (*f)(void *), void *objptr, void *dso)
{
}

Make these a bit more correct

Make these a bit more correct


#pragma once

#include <spotify/json.hpp>

#include "Tileset.h"

using namespace spotify::json::codec;

namespace spotify
{
namespace json
{

template<>
struct default_codec_t<Tileset>
{
    static object_t<Tileset> codec()
    {
        auto codec = object<Tileset>();
        codec.required("resolution", &Tileset::resolution);
        codec.required("filename", &Tileset::filename);
        codec.required("x", &Tileset::x);
        codec.required("y", &Tileset::y);
        codec.required("terrains", &Tileset::terrains);
        return codec;
    }
};

}
}

Add a codec for Tileset

Add a codec for Tileset


#ifndef LACO_COMMANDS_H
#define LACO_COMMANDS_H

struct LacoState;

/**
 * Gets passed ever line to see if it matches one of the REPL command. If it
 * does, that command will be executed.
 */
void laco_handle_command(struct LacoState* laco, char* line);

#endif /* LACO_COMMANDS_H */

#ifndef LACO_COMMANDS_H
#define LACO_COMMANDS_H

struct LacoState;

typedef void (*LacoHandler)(struct LacoState* laco, const char** arguments);

struct LacoCommand {
  const char** matches;
  LacoHandler handler;
};

/**
 * Gets passed ever line to see if it matches one of the REPL command. If it
 * does, that command will be executed.
 */
void laco_handle_command(struct LacoState* laco, char* line);

#endif /* LACO_COMMANDS_H */

Define data types for structured command handling


// RUN: %clang_cc1 -analyze -inline-call -analyzer-store region -analyze-function f2 -verify %s

// Test parameter 'a' is registered to LiveVariables analysis data although it
// is not referenced in the function body.
int f1(int a) {
  return 1;
}

void f2() {
  int x;
  x = f1(1);
}

// RUN: %clang_cc1 -analyze -inline-call -analyzer-store region -analyze-function f2 -verify %s

// Test parameter 'a' is registered to LiveVariables analysis data although it
// is not referenced in the function body.
// Before processing 'return 1;', in RemoveDeadBindings(), we query the liveness
// of 'a', because we have a binding for it due to parameter passing.
int f1(int a) {
  return 1;
}

void f2() {
  int x;
  x = f1(1);
}

Add comments to test case.

Add comments to test case.

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


/*
 * Copyright (C) 2015 Luke San Antonio
 * All rights reserved.
 */
#pragma once
#include "glad/glad.h"
#include "../texture.h"
namespace game { namespace gfx { namespace gl
{
  struct GL_Texture : public Texture
  {
    void allocate_(Vec<int> const&, Image_Format) noexcept override;

    inline void blit_data_(Volume<int> const& vol,
                           Color const* data) noexcept override
    {
      // Fuck it, it might work.
      blit_data_(vol, Data_Type::Integer, data);
    }

    inline void blit_data_(Volume<int> const& vol,
                           float const* data) noexcept override
    {
      blit_data_(vol, Data_Type::Float, data);
    }

    void blit_data_(Volume<int> const&, Data_Type,
                    void const*) noexcept override;

    GLuint tex_id;
    GLenum texture_type;

    Image_Format format_;

    void bind(unsigned int loc) const noexcept;
  };
} } }

/*
 * Copyright (C) 2015 Luke San Antonio
 * All rights reserved.
 */
#pragma once
#include "glad/glad.h"
#include "../texture.h"
namespace game { namespace gfx { namespace gl
{
  struct GL_Texture : public Texture
  {
    void allocate_(Vec<int> const&, Image_Format) noexcept override;

    inline void blit_data_(Volume<int> const& vol,
                           Color const* data) noexcept override
    {
      // Fuck it, it might work.
      static_assert(sizeof(Color) == sizeof(Color::c_t) * 4,
                    "Color struct must not have any padding.");
      blit_data_(vol, Data_Type::Integer, data);
    }

    inline void blit_data_(Volume<int> const& vol,
                           float const* data) noexcept override
    {
      blit_data_(vol, Data_Type::Float, data);
    }

    void blit_data_(Volume<int> const&, Data_Type,
                    void const*) noexcept override;

    GLuint tex_id;
    GLenum texture_type;

    Image_Format format_;

    void bind(unsigned int loc) const noexcept;
  };
} } }

Verify array of colors is contigous

Verify array of colors is contigous


#ifndef DISK_H
#define DISK_H

#include "../process/process.h"

#ifdef __i386__
#define IOPRIO_GET 290
#elif __x86_64__
#define IOPRIO_GET 252
#endif

#define IOPRIO_WHO_PROCESS 1

#define IOPRIO_CLASS_SHIFT (13)
#define IOPRIO_PRIO_MASK ((1UL << IOPRIO_CLASS_SHIFT) - 1)

#define PRIOLEN 8

char *filesystem_type(void);

int ioprio_get(int pid);

char *ioprio_class(int pid);

char *ioprio_class_nice(int pid);

void proc_io(proc_t *procs);

#endif

#ifndef DISK_H
#define DISK_H

#include <stdint.h>
#include "../process/process.h"

#ifdef __i386__
#define IOPRIO_GET 290
#elif __x86_64__
#define IOPRIO_GET 252
#endif

#define IOPRIO_WHO_PROCESS 1

#define IOPRIO_CLASS_SHIFT (13)
#define IOPRIO_PRIO_MASK ((1UL << IOPRIO_CLASS_SHIFT) - 1)

#define PRIOLEN 8

char *filesystem_type(void);

int ioprio_get(int pid);

char *ioprio_class(int pid);

char *ioprio_class_nice(int pid);

uint64_t get_process_taskstat_io(int pid, char field);

#endif

Adjust declaration for taskstats io call


#pragma once

struct Point{
  double x,y;
  Point();
  /*
  first double input param: x coordinate.
  second double input param: y coordinate.
  */
  Point(double,double);
  bool operator<(Point)const;
  bool operator==(Point)const;
};

double dist(Point a,Point b);

#pragma once

class Point{
public:
  double x,y;
  Point();
  /*
  first double input param: x coordinate.
  second double input param: y coordinate.
  */
  Point(double,double);
  bool operator<(Point)const;
  bool operator==(Point)const;
};

Remove deprecated function and use class to define a Point


#include <string.h>
#include "proxrcmds.h"
#include "sim-hab.h"

void cb_set_resource(bionet_resource_t *resource, bionet_value_t *value)
{
    double data;
    double content;
    int id;
    bionet_node_t *node;

    bionet_value_get_float(value, &data);
    if(data < 0 || data > 255)
	return;

    node = bionet_resource_get_node(resource);
    // get index of resource
    //FIXME: probably a better way to do this
    for(int i=0; i<16; i++)
    {
        char buf[5];
        char name[24];
        strcpy(name, "Potentiometer\0");
        sprintf(buf,"%d", i);
        int len = strlen(buf);
        buf[len] = '\0';
        strcat(name, buf);

        if(bionet_resource_matches_id(resource, name))
        {
            id = i;
    	    // command proxr to adjust to new value
    	    set_potentiometer(id, (int)data);
	    // set resources datapoint to new value
            content = data*POT_CONVERSION;
            bionet_resource_set_double(resource, content, NULL);
            hab_report_datapoints(node);
            return;
        }
    }
}

#include <string.h>
#include "proxrcmds.h"
#include "sim-hab.h"

void cb_set_resource(bionet_resource_t *resource, bionet_value_t *value)
{
    double data;
    double content;
    int id;
    bionet_node_t *node;

    bionet_value_get_double(value, &data);
    if(data < 0 || data > 255)
	return;

    node = bionet_resource_get_node(resource);
    // get index of resource
    //FIXME: probably a better way to do this
    for(int i=0; i<16; i++)
    {
        char buf[5];
        char name[24];
        strcpy(name, "Potentiometer\0");
        sprintf(buf,"%d", i);
        int len = strlen(buf);
        buf[len] = '\0';
        strcat(name, buf);

        if(bionet_resource_matches_id(resource, name))
        {
            id = i;
    	    // command proxr to adjust to new value
    	    set_potentiometer(id, (int)data);
	    // set resources datapoint to new value
            content = data*POT_CONVERSION;
            bionet_resource_set_double(resource, content, NULL);
            hab_report_datapoints(node);
            return;
        }
    }
}

Change another float to double.

Change another float to double.


#include <assert.h>

#include "fnv_1a.h"

uint128_t fnv_1a(const void * restrict const buf,
                 const size_t                len,
                 const size_t                skip_pos,
                 const size_t                skip_len)
{
    assert((skip_pos <= len) && (skip_pos + skip_len <= len));

    static const uint128_t prime =
        (((uint128_t)0x0000000001000000) << 64) | 0x000000000000013B;
    uint128_t hash =
        (((uint128_t)0x6C62272E07BB0142) << 64) | 0x62B821756295C58D;

    // two consecutive loops should be faster than one loop with an "if"
    const uint8_t * restrict const bytes = buf;
    for (size_t i = 0; i < skip_pos; i++) {
        hash ^= bytes[i];
        hash *= prime;
    }
    for (size_t i = skip_pos + skip_len; i < len; i++) {
        hash ^= bytes[i];
        hash *= prime;
    }
    return hash;
}

#include "fnv_1a.h"
#include "debug.h"

uint128_t fnv_1a(const void * restrict const buf,
                 const size_t                len,
                 const size_t                skip_pos,
                 const size_t                skip_len)
{
    assert((skip_pos <= len) && (skip_pos + skip_len <= len),
           "len %zu, skip_pos %zu, skip_len %zu", len, skip_pos, skip_len);

    static const uint128_t prime =
        (((uint128_t)0x0000000001000000) << 64) | 0x000000000000013B;
    uint128_t hash =
        (((uint128_t)0x6C62272E07BB0142) << 64) | 0x62B821756295C58D;

    // two consecutive loops should be faster than one loop with an "if"
    const uint8_t * restrict const bytes = buf;
    for (size_t i = 0; i < skip_pos; i++) {
        hash ^= bytes[i];
        hash *= prime;
    }
    for (size_t i = skip_pos + skip_len; i < len; i++) {
        hash ^= bytes[i];
        hash *= prime;
    }
    return hash;
}

Use the new assert() macro

Use the new assert() macro


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

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

/**
 This is a dead simple XML parser that uses libxml2 to parse an XML document
 into a dictionary. It is designed specifically for use with RestKit. It
 does not support any fanciness like Namespaces, DTDs, or other nonsense.
 It does not save attributes on tags, it only cares about nested content and text.
 */
@interface RKXMLParserLibXML : NSObject <RKParser> {
}

- (NSDictionary*)parseXML:(NSString*)XML;

@end

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

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

/**
 This is a dead simple XML parser that uses libxml2 to parse an XML document
 into a dictionary. It is designed specifically for use with RestKit. It
 does not support any fanciness like Namespaces, DTDs, or other nonsense.
 It handles text nodes, attributes, and nesting structures and builds key-value
 coding compliant representations of the XML structure.

 It currently does not support XML generation -- only parsing.
 */
@interface RKXMLParserLibXML : NSObject <RKParser> {
}

- (NSDictionary *)parseXML:(NSString *)XML;

@end

Update outdated comments in the XML parser header


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

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

Update Skia milestone to 59

Update Skia milestone to 59

BUG=skia:

Change-Id: Ifa8fa20a838b2899a1230bf51cea7c4cf28971d8
Reviewed-on: https://skia-review.googlesource.com/9139
Reviewed-by: Heather Miller <2e22000c5d22374561fe5fba576a31095b72dc2e@google.com>


/**
 * @file      include/libbad_base.h
 * @author    Bryce Davis
 * @date      19 November 2015
 * @brief     Header file for internal libbad declarations
 * @copyright Copyright (c) 2015, Bryce Davis. Released under the MIT License.
 *            See LICENSE.txt for details.
 */
#ifndef _LIBBAD_BASE_H
#define _LIBBAD_BASE_H

/**
 * @typedef A convenience typedef for long long ints.
 */
typedef long long int llint;
/**
 * @typedef A convenience typedef for long doubles.
 */
typedef long double ldouble;

/**
 * @union DATA
 * @brief A data value for libbad data structures.
 *
 * A DATA can hold either a long long int, a long double, or a pointer. Takes
 * up 16 bytes.
 */
typedef union libbad_data_t {
    llint data_int;
    ldouble data_dbl;
    void* data_ptr;
} DATA;

#endif

/**
 * @file      include/libbad_base.h
 * @author    Bryce Davis
 * @date      19 November 2015
 * @brief     Header file for internal libbad declarations
 * @copyright Copyright (c) 2015, Bryce Davis. Released under the MIT License.
 *            See LICENSE.txt for details.
 */
#ifndef _LIBBAD_BASE_H
#define _LIBBAD_BASE_H

/**
 * A convenience typedef for long long ints.
 */
typedef long long int llint;
/**
 * A convenience typedef for long doubles.
 */
typedef long double ldouble;

/**
 * @union libbad_data_t
 * @brief A data value for libbad data structures.
 *
 * An instance of libbad_data_t can hold either a long long int, a long double,
 * or a pointer. Takes up 16 bytes.
 */
union libbad_data_t {
    llint data_int;		/**< A long long integer value (8 bytes) */
    ldouble data_dbl;	/**< A long double value (16 bytes) */
    void* data_ptr;		/**< A pointer value (8 bytes) */
};

/**
 * Use DATA instead of "union libbad_data_t"
 */
typedef union libbad_data_t DATA;

#endif

Restructure implementation and documentation of DATA/libbad_data_t


#include <vector>
#include <map>
#include <string>

using namespace std;

#ifndef OBJECTS_H
#define OBJECTS_H

	union DataValue {
		string val_s;
		long int val_i;
		float val_f;
		double val_d;
	};

	typedef map<string, DataValue> DataMap;
	typedef map<string, DataValue>::iterator DataIterator;

	class DataInstance {
	private:
		int weight;
		DataMap dataStore;
	public:
		DataInstance();
		~DataInstance();
	};

	class DataObject	{
	private:
		vector<DataInstance> instances;
	public:
		DataObject();
		~DataObject();
	};

#endif

#ifndef OBJECTS_H
#define OBJECTS_H

	#include <vector>
	#include <map>
	#include <string>
	using namespace std;

	class IntDataValue : public DataValue
	{
	private:
	public:
		IntDataValue(int val): value(val);

		void compareWith(DataValue &I) {
			if(I.value < this->value) return -1;
			else if(I.value == this->value) return 0;
			return 1;
		}

		void updateTo(DataValue &I) {
			this->value = I.value;
		}

		int value;
	};

	class DoubleDataValue : public DataValue
	{
	private:
	public:
		DoubleDataValue(double val): value(val);

		void compareWith(DataValue &I) {
			if(this->value < I.value) return -1;
			else if(I.value == this->value) return 0;
			return 1;
		}

		void updateTo(DataValue &I) {
			this->value = I.value;
		}

		double value;
	};

	class DataValue {
	public:
	 	DataValue();
		// CompareWith(I): return -1 if lesser, 0 if equal, 1 if greater
		virtual void compareWith(DataValue &I) = 0;
		// UpdateTo(I): updates value of current object to match I
		virtual void updateTo(DataValue &I) = 0;

		void updateIfLargerThan(DataValue &I) {
			/*Implement : check for typeId matching*/
			if(this->compareWith(I)==1)
				this->updateTo(I);
		}

	 	~DataValue();
	};

	typedef map<string, DataValue> DataMap;
	typedef map<string, DataValue>::iterator DataIterator;

	class DataInstance {
	private:
		int weight;
		DataMap dataStore;
	public:
		DataInstance();
		DataInstance(DataInstance &instance);
		~DataInstance();
	};

	class DataObject {
	private:
		vector<DataInstance> instances;
	public:
		DataObject();
		~DataObject();
	};

#endif

Make an abstract DataValue class, and implement Double and IntegerValues


// email=foo@bar.com
// branch=master
#ifndef __USER_MODULES_H__
#define __USER_MODULES_H__

#define LUA_USE_BUILTIN_STRING		// for string.xxx()
#define LUA_USE_BUILTIN_TABLE		// for table.xxx()
#define LUA_USE_BUILTIN_COROUTINE	// for coroutine.xxx()
#define LUA_USE_BUILTIN_MATH		// for math.xxx(), partially work
// #define LUA_USE_BUILTIN_IO 			// for io.xxx(), partially work

// #define LUA_USE_BUILTIN_OS			// for os.xxx(), not work
// #define LUA_USE_BUILTIN_DEBUG		// for debug.xxx(), not work

#define LUA_USE_MODULES

#ifdef LUA_USE_MODULES
#define LUA_USE_MODULES_NODE
#define LUA_USE_MODULES_FILE
#define LUA_USE_MODULES_GPIO
#define LUA_USE_MODULES_WIFI
#define LUA_USE_MODULES_NET
#define LUA_USE_MODULES_PWM
#define LUA_USE_MODULES_I2C
#define LUA_USE_MODULES_SPI
#define LUA_USE_MODULES_TMR
#define LUA_USE_MODULES_ADC
#define LUA_USE_MODULES_UART
#define LUA_USE_MODULES_OW
#define LUA_USE_MODULES_BIT
#define LUA_USE_MODULES_MQTT
#define LUA_USE_MODULES_COAP
#define LUA_USE_MODULES_U8G
#define LUA_USE_MODULES_WS2812
#define LUA_USE_MODULES_CJSON
#endif /* LUA_USE_MODULES */

#endif	/* __USER_MODULES_H__ */

// email=foo@bar.com
// branch=master
#ifndef __USER_MODULES_H__
#define __USER_MODULES_H__

#define LUA_USE_BUILTIN_STRING		// for string.xxx()
#define LUA_USE_BUILTIN_TABLE		// for table.xxx()
#define LUA_USE_BUILTIN_COROUTINE	// for coroutine.xxx()
#define LUA_USE_BUILTIN_MATH		// for math.xxx(), partially work
// #define LUA_USE_BUILTIN_IO 			// for io.xxx(), partially work

// #define LUA_USE_BUILTIN_OS			// for os.xxx(), not work
// #define LUA_USE_BUILTIN_DEBUG		// for debug.xxx(), not work

#define LUA_USE_MODULES

#ifdef LUA_USE_MODULES
// user modules
#endif /* LUA_USE_MODULES */

#endif	/* __USER_MODULES_H__ */

Replace all user modules with token

Replace all user modules with token


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

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

// expected-no-diagnostics

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

Add a test forgotten in r339088.

[analyzer] Add a test forgotten in r339088.

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

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


/* We can't use the real errno in ldso, since it has not yet
 * been dynamicly linked in yet. */
#include "sys/syscall.h"
extern int _dl_errno;
#undef __set_errno
#define __set_errno(X) {(_dl_errno) = (X);}
#warning !!! __always_inline redefined waiting for the fixed gcc
#ifdef __always_inline
#undef __always_inline
#define __always_inline inline
#endif

Make sh4 build works again adding a temporary work-around
iby redefining __always_inline to inline until gcc 4.x.x will get
fixed.

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


#pragma once

#include "../../includes.h"

namespace MOSS { namespace Interrupts {

void disable_hw_int(void) {
	__asm__ __volatile__("cli");
}
void enable_hw_int(void) {
	__asm__ __volatile__("sti");
}

/*void fire(int n) {
	//Adapted from http://www.brokenthorn.com/Resources/OSDev15.html
	//Self-modifying code!
	asm(
	"	movb  al, [%0]"
	"	movb  [genint+1], al"
	"	jmp   genint"
	"genint:"
	"	int   0"
	: //out
	:"n"(n) //in
	:"%al" //clobbered
	);
}*/
void fire_int13h(void) {
	__asm__ __volatile__("int  $0x13");
}

}}

#pragma once

#include "../../includes.h"

namespace MOSS { namespace Interrupts {

inline void disable_hw_int(void) {
	__asm__ __volatile__("cli");
}
inline void enable_hw_int(void) {
	__asm__ __volatile__("sti");
}

/*inline void fire(int n) {
	//Adapted from http://www.brokenthorn.com/Resources/OSDev15.html
	//Self-modifying code!
	asm(
	"	movb  al, [%0]"
	"	movb  [genint+1], al"
	"	jmp   genint"
	"genint:"
	"	int   0"
	: //out
	:"n"(n) //in
	:"%al" //clobbered
	);
}*/
inline void fire_int13h(void) {
	__asm__ __volatile__("int  $0x13");
}

}}

Make a few things `inline`.

Make a few things `inline`.


/*!
 * Filename: zt_path.h
 * Description: path utils
 *
 * Author: Jason L. Shiffer <jshiffer@zerotao.org>
 * Copyright:
 *      Copyright (C) 2010-2011, Jason L. Shiffer.
 *      See file COPYING for details
 */

#ifndef _ZT_PATH_
#define _ZT_PATH_

#ifdef HAVE_SYS_STAT_H
# include <sys/stat.h>
#endif /* HAVE_SYS_STAT_H */

#include <zt.h>

BEGIN_C_DECLS

typedef enum {
    zt_mkdir_create_parent = 1,
}zt_mkdir_flags;

int zt_mkdir(char * path, mode_t mode, zt_mkdir_flags flags);

END_C_DECLS

#endif /* _ZT_PATH_ */

/*!
 * Filename: zt_path.h
 * Description: path utils
 *
 * Author: Jason L. Shiffer <jshiffer@zerotao.org>
 * Copyright:
 *      Copyright (C) 2010-2011, Jason L. Shiffer.
 *      See file COPYING for details
 */

#ifndef _ZT_PATH_
#define _ZT_PATH_

#ifdef HAVE_SYS_STAT_H
# include <sys/stat.h>
# else
  typedef unsigned int mode_t;
#endif /* HAVE_SYS_STAT_H */

#include <zt.h>

BEGIN_C_DECLS

typedef enum {
    zt_mkdir_create_parent = 1,
}zt_mkdir_flags;

int zt_mkdir(char * path, mode_t mode, zt_mkdir_flags flags);

END_C_DECLS

#endif /* _ZT_PATH_ */

Add mode_t typedef when missing

Add mode_t typedef when missing


#include "system.h"
#include "sccs.h"
#include "logging.h"

extern	int	test_release;
extern	unsigned build_timet;

int
version_main(int ac, char **av)
{
	char buf[100];
	float	exp;

	if (ac == 2 && streq("--help", av[1])) {
		system("bk help version");
		return (0);
	}

	if (sccs_cd2root(0, 0) == -1) {
		getMsg("version", " ", 0, 0, stdout);
		return (0);
	}
	getMsg("version", bk_model(buf, sizeof(buf)), 0, 0, stdout);
	if (test_release) {
		exp = ((time_t)build_timet - time(0)) / (24*3600.0) + 14;
		if (exp > 0) {
			printf("Expires in: %.1f days (test release).\n", exp);
		} else {
			printf("Expired (test release).\n");
		}
	}
	return (0);
}

#include "system.h"
#include "sccs.h"
#include "logging.h"

extern	int	test_release;
extern	unsigned build_timet;

int
version_main(int ac, char **av)
{
	char buf[100];
	float	exp;

	if (ac == 2 && streq("--help", av[1])) {
		system("bk help version");
		return (0);
	}
	lease_check(0);	/* disable lease check */
	if (sccs_cd2root(0, 0) == -1) {
		getMsg("version", " ", 0, 0, stdout);
		return (0);
	}
	getMsg("version", bk_model(buf, sizeof(buf)), 0, 0, stdout);
	if (test_release) {
		exp = ((time_t)build_timet - time(0)) / (24*3600.0) + 14;
		if (exp > 0) {
			printf("Expires in: %.1f days (test release).\n", exp);
		} else {
			printf("Expired (test release).\n");
		}
	}
	return (0);
}

Add some minor cleanups to the lease code.

bk: 3ea98875Om5jc1nUdXM9io0xhbkArA


#ifndef THEFT_CALL_INTERNAL_H
#define THEFT_CALL_INTERNAL_H

#include "theft_call.h"
#include "theft_bloom.h"
#include <assert.h>

#include <unistd.h>
#include <sys/wait.h>
#include <poll.h>
#include <signal.h>
#include <errno.h>

static enum theft_trial_res
theft_call_inner(struct theft_run_info *run_info, void **args);

static enum theft_trial_res
parent_handle_child_call(struct theft_run_info *run_info,
    pid_t pid, int fd);

#endif

#ifndef THEFT_CALL_INTERNAL_H
#define THEFT_CALL_INTERNAL_H

#include "theft_call.h"
#include "theft_bloom.h"
#include <assert.h>

#include <unistd.h>
#include <sys/wait.h>
#include <sys/types.h>
#include <poll.h>
#include <signal.h>
#include <errno.h>

static enum theft_trial_res
theft_call_inner(struct theft_run_info *run_info, void **args);

static enum theft_trial_res
parent_handle_child_call(struct theft_run_info *run_info,
    pid_t pid, int fd);

#endif

Add `sys/types.h` include for `pid_t`.

Add `sys/types.h` include for `pid_t`.


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

#include <stddef.h>
#include "json/cJSON.h"

const cJSON *credentials_ok(const char *user_name, char *passwd)
{
	return NULL;
}

cJSON *change_password(const struct peer *p, const cJSON *request, const char *user_name, char *passwd)
{
	return NULL;
}

Add stub for windows file authentication implementation.


#ifndef NWG_COMMON_SOCKET_INCLUDE_H_
#define NWG_COMMON_SOCKET_INCLUDE_H_

#ifdef __unix__
#include <netinet/in.h>
#include <sys/socket.h>
#endif /* __unix__ */

#ifdef _WIN32
#include <winsock2.h>
#include <windows.h>
typedef int socklen_t;

#undef FD_SETSIZE
#define FD_SETSIZE 2048
#endif /* _WIN32 */

#include <fcntl.h>
#include <unistd.h>

#endif /* NWG_COMMON_SOCKET_INCLUDE_H_ */

#ifndef NWG_COMMON_SOCKET_INCLUDE_H_
#define NWG_COMMON_SOCKET_INCLUDE_H_

#if !defined(__unix__) && (defined(__APPLE__) && defined(__MACH__))
#define __unix__ 1
#endif

#ifdef __unix__
#include <netinet/in.h>
#include <sys/socket.h>
#endif /* __unix__ */

#ifdef _WIN32
#include <winsock2.h>
#include <windows.h>
typedef int socklen_t;

#undef FD_SETSIZE
#define FD_SETSIZE 2048
#endif /* _WIN32 */

#include <fcntl.h>
#include <unistd.h>

#endif /* NWG_COMMON_SOCKET_INCLUDE_H_ */

Add macro to identify apple mac os x as unix


// RUN: %clang_cc1 -O3 -ffp-contract=fast -triple=powerpc-apple-darwin10 -S -o - %s | FileCheck %s
// REQUIRES: powerpc-registered-target

float fma_test1(float a, float b, float c) {
// CHECK: fmadds
  float x = a * b;
  float y = x + c;
  return y;
}

// RUN: %clang_cc1 -O3 -ffp-contract=fast -triple=aarch64-apple-darwin -S -o - %s | FileCheck %s
// REQUIRES: aarch64-registered-target

float fma_test1(float a, float b, float c) {
// CHECK: fmadd
  float x = a * b;
  float y = x + c;
  return y;
}

Change -ffp-contract=fast test to run on Aarch64

(I don't have powerpc enabled in my build and I am changing
how -ffp-contract=fast works.)

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


//
//  OAuthManager.h
//
//  Created by Ari Lerner on 5/31/16.
//  Copyright © 2016 Facebook. All rights reserved.
//

#import <Foundation/Foundation.h>

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

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

@class OAuthClient;

static NSString *kAuthConfig = @"OAuthManager";

@interface OAuthManager : NSObject <RCTBridgeModule, UIWebViewDelegate>

+ (instancetype) sharedManager;
+ (BOOL)setupOAuthHandler:(UIApplication *)application;

+ (BOOL)handleOpenUrl:(UIApplication *)application openURL:(NSURL *)url
    sourceApplication:(NSString *)sourceApplication annotation:(id)annotation;

- (BOOL) _configureProvider:(NSString *) name andConfig:(NSDictionary *) config;
- (NSDictionary *) getConfigForProvider:(NSString *)name;

@property (nonatomic, strong) NSDictionary *providerConfig;
@property (nonatomic, strong) NSArray *callbackUrls;

@end

//
//  OAuthManager.h
//
//  Created by Ari Lerner on 5/31/16.
//  Copyright © 2016 Facebook. All rights reserved.
//

#import <Foundation/Foundation.h>

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

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

@class OAuthClient;

static NSString *kAuthConfig = @"OAuthManager";

@interface OAuthManager : NSObject <RCTBridgeModule, UIWebViewDelegate>

+ (instancetype) sharedManager;
+ (BOOL)setupOAuthHandler:(UIApplication *)application;

+ (BOOL)handleOpenUrl:(UIApplication *)application openURL:(NSURL *)url
    sourceApplication:(NSString *)sourceApplication annotation:(id)annotation;

- (BOOL) _configureProvider:(NSString *) name andConfig:(NSDictionary *) config;
- (NSDictionary *) getConfigForProvider:(NSString *)name;

@property (nonatomic, strong) NSDictionary *providerConfig;
@property (nonatomic, strong) NSArray *callbackUrls;

@end

Fix duplicate React library import error conflict w/certain pods


#include <stdio.h>
#include <string.h>
#define MAX_LENGTH 400

char* find(char*, char);

int main() {

    char input[MAX_LENGTH], symbol, *found;

    fgets(input, MAX_LENGTH + 1, stdin);
    scanf("%c", &symbol);

    found = find(input, symbol);
    printf("%d", (int)(found ? found - input : -1));

    return 0;
}

char* find(char *haystack, char needle) {

    int length = strlen(haystack);

    for (int i = 0; i < length; i++) {
        if (haystack[i] == needle) {
            return &haystack[i];
        }
    }

    return NULL;
}

Add Task 02 for Homework 02

Add Task 02 for Homework 02


#include <mikoto/char_driver.h>
#include <mikoto/uart.h>

static int uart_write(const char *s);

static struct char_driver_operations uart_ops = {
	.write = uart_write,
};

static struct char_driver uart_driver = {
	.name = "UART",
};

void uart_init(void)
{
	struct char_driver *uart = get_uart_driver_instance();
	uart->ops = &uart_ops;
}

struct char_driver *
get_uart_driver_instance(void)
{
	if (!uart_driver.ops)
		uart_init();

	return &uart_driver;
}

static int
uart_write(const char *s)
{
	while (*s) {
		while (*(UART0 + UARTFR) & UARTFR_TXFF)
			;

		*UART0 = *s;
		s++;
	}
	return 0;
}

#include <mikoto/char_driver.h>
#include <mikoto/uart.h>

static int uart_write(const char *s);

static struct char_driver_operations uart_ops = {
	.write = uart_write,
};

static struct char_driver uart_driver = {
	.name = "UART",
};

static void
uart_init(void)
{
	uart_driver.ops = &uart_ops;
}

struct char_driver *
get_uart_driver_instance(void)
{
	if (!uart_driver.ops)
		uart_init();

	return &uart_driver;
}

static int
uart_write(const char *s)
{
	while (*s) {
		while (*(UART0 + UARTFR) & UARTFR_TXFF)
			;

		*UART0 = *s;
		s++;
	}
	return 0;
}

Fix circular reference but in uart_init()

Don't call get_uart_driver_instance() from uart_init().


/*
 * Copyright (C) 2019 Koen Zandberg
 *
 * This file is subject to the terms and conditions of the GNU Lesser
 * General Public License v2.1. See the file LICENSE in the top level
 * directory for more details.
 */

/**
 * @ingroup     boards_common_stm32
 * @{
 *
 * @file
 * @brief       Common configuration for STM32 OTG HS peripheral with FS phy
 *
 * @author      Koen Zandberg <koen@bergzand.net>
 */

#ifndef CFG_USB_OTG_HS_FS_H
#define CFG_USB_OTG_HS_FS_H

#include "periph_cpu.h"

#ifdef __cplusplus
extern "C" {
#endif

/**
 * @brief Enable the full speed USB OTG peripheral
 */
#define STM32_USB_OTG_HS_ENABLED

/**
 * @name common USB OTG FS configuration
 * @{
 */
static const stm32_usb_otg_fshs_config_t stm32_usb_otg_fshs_config[] = {
    {
        .periph   = (uint8_t *)USB_OTG_HS_PERIPH_BASE,
        .rcc_mask = RCC_AHB1ENR_OTGHSEN,
        .phy      = STM32_USB_OTG_PHY_BUILTIN,
        .type     = STM32_USB_OTG_HS,
        .irqn     = OTG_HS_IRQn,
        .ahb      = AHB1,
        .dm       = GPIO_PIN(PORT_B, 14),
        .dp       = GPIO_PIN(PORT_B, 15),
        .af       = GPIO_AF12,
    }
};
/** @} */

/**
 * @brief Number of available USB OTG peripherals
 */
#define USBDEV_NUMOF           ARRAY_SIZE(stm32_usb_otg_fshs_config)

#ifdef __cplusplus
}
#endif

#endif /* CFG_USB_OTG_HS_FS_H */
/** @} */

boards/stm32: Add default config for USB OTG HS peripheral


#ifdef NO_PORT
#include "mono/interpreter/interp.h"

MonoPIFunc
mono_create_trampoline (MonoMethod *method)
{
	g_error ("Unsupported arch");
	return NULL;
}

void *
mono_create_method_pointer (MonoMethod *method)
{
	g_error ("Unsupported arch");
	return NULL;
}

#endif

#ifdef NO_PORT
#include "mono/interpreter/interp.h"

MonoPIFunc
mono_create_trampoline (MonoMethodSignature *sig, gboolean string_ctor)
{
	g_error ("Unsupported arch");
	return NULL;
}

void *
mono_create_method_pointer (MonoMethod *method)
{
	g_error ("Unsupported arch");
	return NULL;
}

#endif

Update to the API change of a while ago.

svn path=/trunk/mono/; revision=10545


// Copyright (c) 2012 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 UI_MESSAGE_CENTER_BASE_FORMAT_VIEW_H_
#define UI_MESSAGE_CENTER_BASE_FORMAT_VIEW_H_

#include "ui/message_center/message_view.h"
#include "ui/message_center/notification_list.h"

namespace views {
class ImageView;
}

namespace message_center {

// A comprehensive message view.
class BaseFormatView : public MessageView {
 public:
  BaseFormatView(NotificationList::Delegate* list_delegate,
                 const NotificationList::Notification& notification);
  virtual ~BaseFormatView();

  // MessageView
  virtual void SetUpView() OVERRIDE;

  // views::ButtonListener
  virtual void ButtonPressed(views::Button* sender, const ui::Event& event);

 protected:
  BaseFormatView();

  DISALLOW_COPY_AND_ASSIGN(BaseFormatView);
};

}  // namespace message_center

#endif // UI_MESSAGE_CENTER_BASE_FORMAT_VIEW_H_

// Copyright (c) 2012 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 UI_MESSAGE_CENTER_BASE_FORMAT_VIEW_H_
#define UI_MESSAGE_CENTER_BASE_FORMAT_VIEW_H_

#include "ui/message_center/message_view.h"
#include "ui/message_center/notification_list.h"

namespace views {
class ImageView;
}

namespace message_center {

// A comprehensive message view.
class BaseFormatView : public MessageView {
 public:
  BaseFormatView(NotificationList::Delegate* list_delegate,
                 const NotificationList::Notification& notification);
  virtual ~BaseFormatView();

  // MessageView
  virtual void SetUpView() OVERRIDE;

  // views::ButtonListener
  virtual void ButtonPressed(views::Button* sender,
                             const ui::Event& event) OVERRIDE;

 protected:
  BaseFormatView();

  DISALLOW_COPY_AND_ASSIGN(BaseFormatView);
};

}  // namespace message_center

#endif  // UI_MESSAGE_CENTER_BASE_FORMAT_VIEW_H_

Add a missing override from r167851. Hopefully this unbreaks the CrOS Clang build.

TBR=miket

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


#include "shared-bindings/board/__init__.h"

STATIC const mp_rom_map_elem_t board_global_dict_table[] = {
    { MP_ROM_QSTR(MP_QSTR_NEOPIXEL), MP_ROM_PTR(&pin_PA04) },
    { MP_ROM_QSTR(MP_QSTR_POTENTIOMETER), MP_ROM_PTR(&pin_PA02) },
    { MP_ROM_QSTR(MP_QSTR_TOUCH), MP_ROM_PTR(&pin_PA07) },
};
MP_DEFINE_CONST_DICT(board_module_globals, board_global_dict_table);

#include "shared-bindings/board/__init__.h"

STATIC const mp_rom_map_elem_t board_global_dict_table[] = {
    { MP_ROM_QSTR(MP_QSTR_NEOPIXEL), MP_ROM_PTR(&pin_PA04) },
    { MP_ROM_QSTR(MP_QSTR_POTENTIOMETER), MP_ROM_PTR(&pin_PA02) },
    { MP_ROM_QSTR(MP_QSTR_A0), MP_ROM_PTR(&pin_PA02) },
    { MP_ROM_QSTR(MP_QSTR_TOUCH), MP_ROM_PTR(&pin_PA07) },
};
MP_DEFINE_CONST_DICT(board_module_globals, board_global_dict_table);

Add A0 as alias to pot pin.

Add A0 as alias to pot pin.


// =============================================================================
// PROJECT CHRONO - http://projectchrono.org
//
// Copyright (c) 2014 projectchrono.org
// All rights reserved.
//
// Use of this source code is governed by a BSD-style license that can be found
// in the LICENSE file at the top level of the distribution and at
// http://projectchrono.org/license-chrono.txt.
//
// =============================================================================

#ifndef CHCHRONO_H
#define CHCHRONO_H

// Definition of the main module and sub-modules in the main Chrono library

/**
    @defgroup chrono Chrono::Engine
    @brief Core Functionality
    @{
        @defgroup chrono_physics Physics objects
        @defgroup chrono_geometry Geometric objects
        @defgroup chrono_collision Collision objects
        @defgroup chrono_assets Asset objects
        @defgroup chrono_solver Solver
        @defgroup chrono_timestepper Time integrators
        @defgroup chrono_functions Function objects
        @defgroup chrono_particles Particle factory
        @defgroup chrono_serialization Serialization
        @defgroup chrono_utils Utility classes

        @defgroup chrono_fea Finite Element Analysis
        @{
           @defgroup fea_nodes Nodes
           @defgroup fea_elements Elements
           @defgroup fea_constraints Constraints
           @defgroup fea_contact Contact
           @defgroup fea_math Mathematical support
           @defgroup fea_utils Utility classes
        @}
    @}
*/

/// @addtogroup chrono
/// @{

/// This is the main namespace for the Chrono package.
namespace chrono {}

/// @} chrono

#endif

// =============================================================================
// PROJECT CHRONO - http://projectchrono.org
//
// Copyright (c) 2014 projectchrono.org
// All rights reserved.
//
// Use of this source code is governed by a BSD-style license that can be found
// in the LICENSE file at the top level of the distribution and at
// http://projectchrono.org/license-chrono.txt.
//
// =============================================================================

#ifndef CHCHRONO_H
#define CHCHRONO_H

// Definition of the main module and sub-modules in the main Chrono library

/**
    @defgroup chrono Chrono::Engine
    @brief Core Functionality
    @{
        @defgroup chrono_physics Physics objects
        @defgroup chrono_geometry Geometric objects
        @defgroup chrono_collision Collision objects
        @defgroup chrono_assets Asset objects
        @defgroup chrono_solver Solver
        @defgroup chrono_timestepper Time integrators
        @defgroup chrono_functions Function objects
        @defgroup chrono_particles Particle factory
        @defgroup chrono_serialization Serialization
        @defgroup chrono_utils Utility classes

        @defgroup chrono_fea Finite Element Analysis
        @{
           @defgroup fea_nodes Nodes
           @defgroup fea_elements Elements
           @defgroup fea_constraints Constraints
           @defgroup fea_contact Contact
           @defgroup fea_math Mathematical support
           @defgroup fea_utils Utility classes
        @}
    @}
*/

/// @addtogroup chrono
/// @{

/// Main namespace for the Chrono package.
namespace chrono {
/// Namespace for FEA classes.
namespace fea {}
}

/// @} chrono

#endif

Add description of the `chrono::fea` namespace


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

#include <account/paths.h>
#include <game/paths.h>
#include <text/paths.h>

inherit LIB_VERB;

void main(object actor, string args)
{
	string *users;
	object user;
	object obj;
	string oname;
	string pname;
	mixed pvalue;

	user = query_user();

	if (user->query_class() < 2) {
		send_out("You do not have sufficient access rights to set object properties.\n");
		return;
	}

	if (sscanf(args, "%s %s %s", oname, pname, pvalue) != 3) {
		send_out("Usage: pset <object> <property name> <value>\n");
		return;
	}

	obj = find_object(oname);

	if (!obj) {
		send_out(oname + ": No such object.\n");
		return;
	}

	pvalue = PARSE_VALUE->parse(pvalue);

	obj->set_property(pname, pvalue);
}

Add prototype for property set command

Add prototype for property set command


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

int main(void)
{
    printf("%016llX", sysflake_generate());
    return 0;
}

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

int main(void)
{
    printf("%016llX\n", sysflake_generate());
    return 0;
}

Add newline after printing flake

Add newline after printing flake


#ifndef SRC_NODE_H_

#define SRC_NODE_H_

#include "./render_data.h"

/**
 * \brief
 *
 *
 */
class Node
{
 public:
  virtual ~Node()
  {
  }

  virtual void render(const RenderData &renderData) = 0;

 protected:
  Node()
  {
  }
};

#endif  // SRC_NODE_H_

#ifndef SRC_NODE_H_

#define SRC_NODE_H_

#include "./render_data.h"
#include <boost/serialization/serialization.hpp>
#include <boost/serialization/access.hpp>
#include <boost/serialization/nvp.hpp>

/**
 * \brief
 *
 *
 */
class Node
{
 public:
  virtual ~Node()
  {
  }

  virtual void render(const RenderData &renderData) = 0;

 protected:
  Node()
  {
  }
 private:
  friend class boost::serialization::access;
  template <class Archive>
  void serialize(Archive &ar, unsigned int version) const {};
};

#endif  // SRC_NODE_H_

Add serialization to Node class.

Add serialization to Node class.


//
//  HLSTextView.h
//  CoconutKit
//
//  Created by Samuel Défago on 03.11.11.
//  Copyright (c) 2011 Hortis. All rights reserved.
//

// TODO: - move automatically with the keyboard
//       - dismiss when tapping outside

@interface HLSTextView : UITextView

/**
 * The text to be displayed when the text view is empty. Default is nil
 */
@property (nonatomic, retain) NSString *placeholderText;

/**
 * The color of the placeholder text. Default is light gray
 */
@property (nonatomic, retain) UIColor *placeholderTextColor;

@end

//
//  HLSTextView.h
//  CoconutKit
//
//  Created by Samuel Défago on 03.11.11.
//  Copyright (c) 2011 Hortis. All rights reserved.
//

/**
 * Lightweight UITextView subclass providing more functionalities
 */
@interface HLSTextView : UITextView

/**
 * The text to be displayed when the text view is empty. Default is nil
 */
@property (nonatomic, retain) NSString *placeholderText;

/**
 * The color of the placeholder text. Default is light gray
 */
@property (nonatomic, retain) UIColor *placeholderTextColor;

@end

Add a small bit of documentation

Add a small bit of documentation


/*	$OpenBSD: iockbcvar.h,v 1.3 2010/12/03 18:29:56 shadchin Exp $	*/

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

int	iockbc_cnattach();

/*	$OpenBSD: iockbcvar.h,v 1.4 2010/12/04 11:23:43 jsing Exp $	*/

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

int	iockbc_cnattach(void);

Make sgi port compile again.

Make sgi port compile again.


////////////////////////////////////////////////////////////////////////////////
#ifdef __linux__

#include <stdio.h>
#include <X11/Xlib.h>
#include <X11/Intrinsic.h>
#include <X11/extensions/XTest.h>

Display *fakekey_dis;

void fakekey_init(void) {
    fakekey_dis = XOpenDisplay(NULL);
}

void fakekey_press(int code) {
    XTestFakeKeyEvent(fakekey_dis, code, True, 0);
    XFlush(fakekey_dis);
}

void fakekey_release(int code) {
    XTestFakeKeyEvent(fakekey_dis, code, False, 0);
    XFlush(fakekey_dis);
}

#else

void fakekey_init(void) {
}

void fakekey_press(int code) {
}

void fakekey_release(int code) {
}

#endif

////////////////////////////////////////////////////////////////////////////////
#ifdef __linux__

#include <stdio.h>
#include <X11/Xlib.h>
#include <X11/Intrinsic.h>
#include <X11/extensions/XTest.h>

Display *fakekey_dis;

void fakekey_init(void) {
    fakekey_dis = XOpenDisplay(NULL);
}

void fakekey_press(int keysym) {
    XTestFakeKeyEvent(fakekey_dis, XKeysymToKeycode(fakekey_dis, keysym), True, 0);
    XFlush(fakekey_dis);
}

void fakekey_release(int keysym) {
    XTestFakeKeyEvent(fakekey_dis, XKeysymToKeycode(fakekey_dis, keysym), False, 0);
    XFlush(fakekey_dis);
}

#else

void fakekey_init(void) {
}

void fakekey_press(int keysym) {
}

void fakekey_release(int keysym) {
}

#endif

Use keysym to keycode mapping in C

Use keysym to keycode mapping in C


#ifndef TGBOT_TGLONGPOLL_H
#define TGBOT_TGLONGPOLL_H

#include "tgbot/Bot.h"
#include "tgbot/Api.h"
#include "tgbot/EventHandler.h"

namespace TgBot {

/**
 * @brief This class handles long polling and updates parsing.
 *
 * @ingroup net
 */
class TgLongPoll {

public:
    TgLongPoll(const Api* api, const EventHandler* eventHandler, int32_t, int32_t, const std::shared_ptr<std::vector<std::string>>&);
    TgLongPoll(const Bot& bot, int32_t = 100, int32_t = 60, const std::shared_ptr<std::vector<std::string>>& = nullptr);

    /**
     * @brief Starts long poll. After new update will come, this method will parse it and send to EventHandler which invokes your listeners. Designed to be executed in a loop.
     */
    void start();

private:
    const Api* _api;
    const EventHandler* _eventHandler;
    int32_t _lastUpdateId = 0;
    int32_t _limit;
    int32_t _timeout;
    std::shared_ptr<std::vector<std::string>> _allowupdates;
};

}

#endif //TGBOT_TGLONGPOLL_H

#ifndef TGBOT_TGLONGPOLL_H
#define TGBOT_TGLONGPOLL_H

#include "tgbot/Bot.h"
#include "tgbot/Api.h"
#include "tgbot/EventHandler.h"

namespace TgBot {

/**
 * @brief This class handles long polling and updates parsing.
 *
 * @ingroup net
 */
class TgLongPoll {

public:
    TgLongPoll(const Api* api, const EventHandler* eventHandler, int32_t, int32_t, const std::shared_ptr<std::vector<std::string>>&);
    TgLongPoll(const Bot& bot, int32_t = 100, int32_t = 10, const std::shared_ptr<std::vector<std::string>>& = nullptr);

    /**
     * @brief Starts long poll. After new update will come, this method will parse it and send to EventHandler which invokes your listeners. Designed to be executed in a loop.
     */
    void start();

private:
    const Api* _api;
    const EventHandler* _eventHandler;
    int32_t _lastUpdateId = 0;
    int32_t _limit;
    int32_t _timeout;
    std::shared_ptr<std::vector<std::string>> _allowupdates;
};

}

#endif //TGBOT_TGLONGPOLL_H

Fix too big timeout in long poller.

Fix too big timeout in long poller.

Make it 10 seconds instead of 60. Old timeout made bots irresponsible.


#import "RCTBridgeModule.h"
#import "RCTEventDispatcher.h"
#import <AWSCore/AWSCore.h>
#import <AWSS3/AWSS3.h>

typedef enum {
  BASIC, COGNITO
} CredentialType;

@interface RNS3TransferUtility : NSObject <RCTBridgeModule>
+ (NSMutableDictionary*)nativeCredentialsOptions;
+ (CredentialType)credentialType: (NSString *)type;
+ (void)interceptApplication: (UIApplication *)application handleEventsForBackgroundURLSession:(NSString *)identifier completionHandler:(void (^)())completionHandler;
@end

#import "RCTBridgeModule.h"
#import "RCTEventDispatcher.h"
#import <AWSCore/AWSCore.h>
#import <AWSS3/AWSS3.h>

typedef NS_ENUM(NSInteger, CredentialType) {
    BASIC,
    COGNITO
};

@interface RNS3TransferUtility : NSObject <RCTBridgeModule>
+ (NSMutableDictionary*)nativeCredentialsOptions;
+ (CredentialType)credentialType: (NSString *)type;
+ (void)interceptApplication: (UIApplication *)application handleEventsForBackgroundURLSession:(NSString *)identifier completionHandler:(void (^)())completionHandler;
@end

Define enum as NSInteger to fix a warning.


//
//  MOAspects.h
//  MOAspects
//
//  Created by Hiromi Motodera on 2015/03/15.
//  Copyright (c) 2015年 MOAI. All rights reserved.
//

#import <Foundation/Foundation.h>

typedef NS_ENUM(NSInteger, MOAspectsPosition)
{
    MOAspectsPositionBefore,
    MOAspectsPositionAfter
};

typedef NS_ENUM(NSInteger, MOAspectsHookRange)
{
    MOAspectsHookRangeAll = -1,
    MOAspectsHookRangeTargetOnly = -2
};

@interface MOAspects : NSObject

+ (BOOL)hookInstanceMethodForClass:(Class)clazz
                          selector:(SEL)selector
                   aspectsPosition:(MOAspectsPosition)aspectsPosition
                        usingBlock:(id)block;

+ (BOOL)hookInstanceMethodForClass:(Class)clazz
                          selector:(SEL)selector
                   aspectsPosition:(MOAspectsPosition)aspectsPosition
                         hookLevel:(MOAspectsHookRange)hookLevel
                        usingBlock:(id)block;

+ (BOOL)hookClassMethodForClass:(Class)clazz
                       selector:(SEL)selector
                aspectsPosition:(MOAspectsPosition)aspectsPosition
                     usingBlock:(id)block;

+ (BOOL)hookClassMethodForClass:(Class)clazz
                       selector:(SEL)selector
                aspectsPosition:(MOAspectsPosition)aspectsPosition
                      hookLevel:(MOAspectsHookRange)hookLevel
                     usingBlock:(id)block;

@end

//
//  MOAspects.h
//  MOAspects
//
//  Created by Hiromi Motodera on 2015/03/15.
//  Copyright (c) 2015年 MOAI. All rights reserved.
//

#import <Foundation/Foundation.h>

typedef NS_ENUM(NSInteger, MOAspectsPosition)
{
    MOAspectsPositionBefore,
    MOAspectsPositionAfter
};

typedef NS_ENUM(NSInteger, MOAspectsHookRange)
{
    MOAspectsHookRangeAll = -1,
    MOAspectsHookRangeTargetOnly = -2
};

@interface MOAspects : NSObject

+ (BOOL)hookInstanceMethodForClass:(Class)clazz
                          selector:(SEL)selector
                   aspectsPosition:(MOAspectsPosition)aspectsPosition
                        usingBlock:(id)block;

+ (BOOL)hookInstanceMethodForClass:(Class)clazz
                          selector:(SEL)selector
                   aspectsPosition:(MOAspectsPosition)aspectsPosition
                         hookLevel:(MOAspectsHookRange)hookRange
                        usingBlock:(id)block;

+ (BOOL)hookClassMethodForClass:(Class)clazz
                       selector:(SEL)selector
                aspectsPosition:(MOAspectsPosition)aspectsPosition
                     usingBlock:(id)block;

+ (BOOL)hookClassMethodForClass:(Class)clazz
                       selector:(SEL)selector
                aspectsPosition:(MOAspectsPosition)aspectsPosition
                      hookLevel:(MOAspectsHookRange)hookRange
                     usingBlock:(id)block;

@end

Change hook level parameter name to hookRange


#ifndef __SETTINGS_H_
#define __SETTINGS_H_
#include <Arduino.h>
#include "Device.h"

// This section is for devices and their configuration
//Kit:
#define HAS_STD_LIGHTS (1)
#define LIGHTS_PIN 5
#define HAS_STD_CAPE (1)
#define HAS_STD_2X1_THRUSTERS (1)
#define HAS_STD_PILOT (1)
#define HAS_STD_CAMERAMOUNT (1)
#define CAMERAMOUNT_PIN 3
#define CAPE_VOLTAGE_PIN 0
#define CAPE_CURRENT_PIN 3

//After Market:
#define HAS_STD_CALIBRATIONLASERS (0)
#define CALIBRATIONLASERS_PIN 6
#define HAS_POLOLU_MINIMUV (1)
#define HAS_MS5803_14BA (0)
#define MS5803_14BA_I2C_ADDRESS 0x76

#define MIDPOINT 1500
#define LOGGING (1)

class Settings : public Device {
  public:
    static int smoothingIncriment; //How aggressive the throttle changes
    static int deadZone_min;
    static int deadZone_max;
    static int capability_bitarray;

    Settings():Device(){};
    void device_setup();
    void device_loop(Command cmd);
};

#endif

#ifndef __SETTINGS_H_
#define __SETTINGS_H_
#include <Arduino.h>
#include "Device.h"

// This section is for devices and their configuration
//Kit:
#define HAS_STD_LIGHTS (1)
#define LIGHTS_PIN 5
#define HAS_STD_CAPE (1)
#define HAS_STD_2X1_THRUSTERS (1)
#define HAS_STD_PILOT (1)
#define HAS_STD_CAMERAMOUNT (1)
#define CAMERAMOUNT_PIN 3
#define CAPE_VOLTAGE_PIN 0
#define CAPE_CURRENT_PIN 3

//After Market:
#define HAS_STD_CALIBRATIONLASERS (0)
#define CALIBRATIONLASERS_PIN 6
#define HAS_POLOLU_MINIMUV (0)
#define HAS_MS5803_14BA (0)
#define MS5803_14BA_I2C_ADDRESS 0x76

#define MIDPOINT 1500
#define LOGGING (1)

class Settings : public Device {
  public:
    static int smoothingIncriment; //How aggressive the throttle changes
    static int deadZone_min;
    static int deadZone_max;
    static int capability_bitarray;

    Settings():Device(){};
    void device_setup();
    void device_loop(Command cmd);
};

#endif

Reset default settings to stock kit configuration


struct eth_hdr
{
    unsigned char dst_mac[6];
    unsigned char src_mac[6];
    short ethertype;
    char* payload;
};

struct eth_hdr* init_eth_hdr(char* buf);
void print_eth_hdr(struct eth_hdr *ehdr);

#ifndef ETHERNET_H_
#define ETHERNET_H_
#include <linux/if_ether.h>

struct eth_hdr
{
    unsigned char dst_mac[6];
    unsigned char src_mac[6];
    unsigned short ethertype;
    unsigned char* payload;
};

struct eth_hdr* init_eth_hdr(char* buf);
void print_eth_hdr(struct eth_hdr *ehdr);

#endif

Make eth header fields unsigned

Make eth header fields unsigned


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

void print_lattice(int * lattice, int rows, int columns, int with_borders)
{
    int i, j;

    for (i = 0; i < rows; i++) {
        if (with_borders) {
            for (j = 0; j < columns; j++) {
                printf("------");
            }
            printf("-\n");
        }
        for (j = 0; j < columns; j++) {
            if (with_borders) {
                putchar('|');
                putchar(' ');
            }
            if (lattice[i*columns + j] == 1) {
                printf(" x ");
            } else if (lattice[i*columns + j] > 1) {
                printf("%03d", lattice[i*columns + j]);
            } else {
                if (with_borders) {
                    putchar(' ');
                    putchar(' ');
                    putchar(' ');
                } else {
                    printf(" o ");
                }
            }
            if (with_borders) {
                putchar(' ');
                if (j == columns - 1) {
                    putchar('|');
                }
            } else {
                if (j < columns - 1) {
                    putchar(' ');
                }
            }
        }
        putchar('\n');
    }
    if (with_borders) {
        for (j = 0; j < columns; j++) {
            printf("------");
        }
        printf("-\n");
    }
}

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

void print_lattice(int * lattice, int rows, int columns, int with_borders)
{
    int i, j;

    for (i = 0; i < rows; i++) {
        if (with_borders) {
            for (j = 0; j < columns; j++) {
                printf("------");
            }
            printf("-\n");
        }
        for (j = 0; j < columns; j++) {
            if (with_borders) {
                putchar('|');
                putchar(' ');
            }
            if (lattice[i*columns + j] == 1) {
                printf(" x ");
            } else if (lattice[i*columns + j] > 1) {
                printf("%03d", lattice[i*columns + j]);
            } else {
                if (with_borders) {
                    putchar(' ');
                    putchar(' ');
                    putchar(' ');
                } else {
                    printf(" o ");
                }
            }
            if (with_borders) {
                putchar(' ');
                if (j == columns - 1) {
                    putchar('|');
                }
            } else {
                if (j < columns - 1) {
                    putchar(' ');
                }
            }
        }
        putchar('\n');
    }
    if (with_borders) {
        for (j = 0; j < columns; j++) {
            printf("------");
        }
        printf("-\n");
    } else {
        putchar('\n');
    }
}

[percolation] Add a newline after printing the lattice


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

#define LENGTH 10

typedef struct arr {
    int *ptrs[LENGTH];
} arr_t;

// int mutate_array(arr_t a){
//     int t = rand();
//     for(int i=0; i<LENGTH; i++) {
//         *(a.ptrs[i]) = t;
//     }
// }

int main(){
    arr_t a;
    int xs[LENGTH];

    for(int i=0; i<LENGTH; i++){
        xs[i] = 0;
        a.ptrs[i] = &xs[0];
    }

    // When passing an arrays to an unknown function, reachable memory should be invalidated
    mutate_array(a);
    assert(xs[0] == 0); //UNKNOWN!
    return 0;
}

Add test case where array is passed to unknown function.


#ifndef HALIDE__generated_pgm_h
#define HALIDE__generated_pgm_h

#include <tiramisu/utils.h>

#ifdef __cplusplus
extern "C" {
#endif

int function0(halide_buffer_t *_p0_buffer);

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

Add wrapper for user tuto 01

Add wrapper for user tuto 01


#ifndef SEQUENCINGRUNWIDGET_H
#define SEQUENCINGRUNWIDGET_H

#include <QWidget>
#include "NGSD.h"

namespace Ui {
class SequencingRunWidget;
}

class SequencingRunWidget : public QWidget
{
	Q_OBJECT

public:
	SequencingRunWidget(QWidget* parent, QString run_id);
	~SequencingRunWidget();

signals:
	void openProcessedSampleTab(QString ps_name);

protected slots:
	void updateGUI();
	void openSelectedSamples();

private:
	Ui::SequencingRunWidget* ui_;
	QString run_id_;
	NGSD db_;
};

#endif // SEQUENCINGRUNWIDGET_H

#ifndef SEQUENCINGRUNWIDGET_H
#define SEQUENCINGRUNWIDGET_H

#include <QWidget>
#include <QAction>
#include "NGSD.h"

namespace Ui {
class SequencingRunWidget;
}

class SequencingRunWidget : public QWidget
{
	Q_OBJECT

public:
	SequencingRunWidget(QWidget* parent, QString run_id);
	~SequencingRunWidget();

signals:
	void openProcessedSampleTab(QString ps_name);

protected slots:
	void updateGUI();
	void openSelectedSamples();

private:
	Ui::SequencingRunWidget* ui_;
	QString run_id_;
	NGSD db_;
};

#endif // SEQUENCINGRUNWIDGET_H

Fix missing include under OSX

[GSvar] Fix missing include under OSX


#ifndef DICT_H_
#define DICT_H_

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

#include <boost/functional/hash.hpp>

#include "wordid.h"

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

#endif

#ifndef DICT_H_
#define DICT_H_

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

#include <boost/functional/hash.hpp>

#include "wordid.h"

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

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

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

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

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

    return Convert(word, frozen);
  }

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

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

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

#endif

Update utility functions to work with pyp-topics.

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


#ifndef ABUF_H
#define ABUF_H

#include <string.h>

#define ABUF_INIT { NULL, 0}

struct abuf{
	char *b;
	int len;
};

void abAppend(struct abuf*, const char*, int);
void abFree(struct abuf*);

#endif

#ifndef ABUF_H
#define ABUF_H

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

#define ABUF_INIT { NULL, 0}

struct abuf{
	char *b;
	int len;
};

void abAppend(struct abuf*, const char*, int);
void abFree(struct abuf*);

#endif

Include stdlib for free and realloc

Include stdlib for free and realloc


/*
	scan: Esitmate length of a mpeg file and compare to length from exact scan.

	copyright 2007 by the mpg123 project - free software under the terms of the LGPL 2.1
	see COPYING and AUTHORS files in distribution or http://mpg123.org
	initially written by Thomas Orgis
*/

#include "mpg123.h"

int main(int argc, char **argv)
{
	mpg123_handle *m;
	int i;
	mpg123_init();
	m = mpg123_new(NULL, NULL);
	for(i = 1; i < argc; ++i)
	{
		off_t a, b;
		mpg123_open(m, argv[i]);
		a = mpg123_length(m);
		mpg123_scan(m);
		b = mpg123_length(m);
		printf("File %i: estimated %li vs. scanned %li\n", i, (long)a, (long)b);
	}
	mpg123_delete(m);
	mpg123_exit();
	return 0;
}

/*
	scan: Estimate length (sample count) of a mpeg file and compare to length from exact scan.

	copyright 2007 by the mpg123 project - free software under the terms of the LGPL 2.1
	see COPYING and AUTHORS files in distribution or http://mpg123.org
	initially written by Thomas Orgis
*/

/* Note the lack of error checking here.
   While it would be nicer to inform the user about troubles, libmpg123 is designed _not_ to bite you on operations with invalid handles , etc.
  You just jet invalid results on invalid operations... */

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

int main(int argc, char **argv)
{
	mpg123_handle *m;
	int i;
	mpg123_init();
	m = mpg123_new(NULL, NULL);
	for(i = 1; i < argc; ++i)
	{
		off_t a, b;
		mpg123_open(m, argv[i]);
		a = mpg123_length(m);
		mpg123_scan(m);
		b = mpg123_length(m);
		printf("File %i: estimated %li vs. scanned %li\n", i, (long)a, (long)b);
	}
	mpg123_delete(m);
	mpg123_exit();
	return 0;
}

Add a note about error checking, fix description and include stdio.h .

git-svn-id: 793bb72743a407948e3701719c462b6a765bc435@1145 35dc7657-300d-0410-a2e5-dc2837fedb53