#include "swap.h"
#include <string.h>

/* Swap generic function */
void swap(void *vp1, void *vp2, int size)
{
  char buffer[size];
  memcpy(buffer, vp1, size);
  memcpy(vp1,vp2,size);
  memcpy(vp2,buffer,size);
}

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

/* Swap generic function */
void swap(void *vp1, void *vp2, int size)
{
  char* buffer = (char*) malloc(size*sizeof(char));
  memcpy(buffer, vp1, size);
  memcpy(vp1,vp2,size);
  memcpy(vp2,buffer,size);
  free(buffer);
}

Use malloc/free as compile failed under MSVC. Ask rpmuller to check if okay.

git-svn-id: 6e15fd90c9d760a7473dfa00402abf17076c345c@188 64417113-1622-0410-aef8-ef15d1a3721e


// SKIP PARAM: --set ana.activated[+] var_eq

void level0(int *p) {

}

void level1(int *p, int *q) {
  level0(p);
  level0(q);
}

void level2(int *p, int *q) {
  level1(p, q);
  level1(q, p);
}

void level3(int *p, int *q) {
  level2(p, q);
  level2(q, p);
}

void level4(int *p, int *q) {
  level3(p, q);
  level3(q, p);
}

void level5(int *p, int *q) {
  level4(p, q);
  level4(q, p);
}

void level6(int *p, int *q) {
  level5(p, q);
  level5(q, p);
}

void level7(int *p, int *q) {
  level6(p, q);
  level6(q, p);
}

void level8(int *p, int *q) {
  level7(p, q);
  level7(q, p);
}

void level9(int *p, int *q) {
  level8(p, q);
  level8(q, p);
}

int main() {
  int i = 0;
  int j = 0;
  level9(&i, &j);
  return 0;
}

Add skipped test where var_eq gets exponentially many contexts

See https://github.com/goblint/bench/issues/16#issuecomment-1100067978.


//******************************************************************************
//
// Copyright (c) 2016 Microsoft Corporation. All rights reserved.
//
// This code is licensed under the MIT License (MIT).
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
//
//******************************************************************************

#pragma once

#import <SafariServices/SafariServicesExport.h>
#import <Foundation/NSObjCRuntime.h>

@class SFSafariViewController;
@class NSURL;
@class NSString;
@class NSArray;

@protocol SFSafariViewControllerDelegate <NSObject>
- (void)safariViewController:(SFSafariViewController*)controller didCompleteInitialLoad:(BOOL)didLoadSuccessfully;
- (NSArray*)safariViewController:(SFSafariViewController*)controller activityItemsForURL:(NSURL*)URL title:(NSString*)title;
- (void)safariViewControllerDidFinish:(SFSafariViewController*)controller;
@end

//******************************************************************************
//
// Copyright (c) 2016 Microsoft Corporation. All rights reserved.
//
// This code is licensed under the MIT License (MIT).
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
//
//******************************************************************************

#pragma once

#import <SafariServices/SafariServicesExport.h>
#import <Foundation/NSObject.h>

@class SFSafariViewController;
@class NSURL;
@class NSString;
@class NSArray;

@protocol SFSafariViewControllerDelegate <NSObject>
- (void)safariViewController:(SFSafariViewController*)controller didCompleteInitialLoad:(BOOL)didLoadSuccessfully;
- (NSArray*)safariViewController:(SFSafariViewController*)controller activityItemsForURL:(NSURL*)URL title:(NSString*)title;
- (void)safariViewControllerDidFinish:(SFSafariViewController*)controller;
@end

Add missing NSObject protocol declaration.


// RUN: %clang_cc1 -emit-llvm %s -o - | FileCheck %s
// This should pass for any endianness combination of host and target.

// This bit is taken from Sema/wchar.c so we can avoid the wchar.h include.
typedef __WCHAR_TYPE__ wchar_t;
#if defined(_WIN32) || defined(_M_IX86) || defined(__CYGWIN__) \
  || defined(_M_X64) || defined(SHORT_WCHAR)
  #define WCHAR_T_TYPE unsigned short
#elif defined(__sun) || defined(__AuroraUX__)
  #define WCHAR_T_TYPE long
#else /* Solaris or AuroraUX. */
  #define WCHAR_T_TYPE int
#endif

// CHECK: @.str = private unnamed_addr constant [72 x i8] c"
extern void foo(const wchar_t* p);
int main (int argc, const char * argv[])
{
 foo(L"This is some text");
 return 0;
}

// RUN: %clang_cc1 -emit-llvm %s -o - -triple i386-pc-win32 | FileCheck %s --check-prefix=WIN
// RUN: %clang_cc1 -emit-llvm %s -o - -triple x86_64-apple-darwin | FileCheck %s --check-prefix=DAR
// This should pass for any endianness combination of host and target.

// This bit is taken from Sema/wchar.c so we can avoid the wchar.h include.
typedef __WCHAR_TYPE__ wchar_t;
#if defined(_WIN32) || defined(_M_IX86) || defined(__CYGWIN__) \
  || defined(_M_X64) || defined(SHORT_WCHAR)
  #define WCHAR_T_TYPE unsigned short
#elif defined(__sun) || defined(__AuroraUX__)
  #define WCHAR_T_TYPE long
#else /* Solaris or AuroraUX. */
  #define WCHAR_T_TYPE int
#endif

// CHECK-DAR: private unnamed_addr constant [72 x i8] c"
// CHECK-WIN: private unnamed_addr constant [36 x i8] c"
extern void foo(const wchar_t* p);
int main (int argc, const char * argv[])
{
 foo(L"This is some text");
 return 0;
}

Handle different sized wchar_t for windows.

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


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

/* Header for tablet_mode.c */

#ifdef CONFIG_TABLET_MODE

/* Return 1 if in tablet mode, 0 otherwise */
int tablet_get_mode(void);
void tablet_set_mode(int mode);

/**
 * Interrupt service routine for hall sensor.
 *
 * HALL_SENSOR_GPIO_L must be defined.
 *
 * @param signal: GPIO signal
 */
void hall_sensor_isr(enum gpio_signal signal);

/**
 * Disables the interrupt on GPIO connected to hall sensor. Additionally, it
 * disables the tablet mode switch sub-system and turns off tablet mode. This is
 * useful when the same firmware is shared between convertible and clamshell
 * devices to turn off hall sensor and tablet mode detection on clamshell.
 */
void hall_sensor_disable(void);

/*
 * This must be defined when CONFIG_HALL_SENSOR_CUSTOM is defined. This allows
 * a board to override the default behavior that determines if the 360 sensor is
 * active: !gpio_get_level(HALL_SENSOR_GPIO_L).
 *
 * Returns 1 if the 360 sensor is active; otherwise 0.
 */
int board_sensor_at_360(void);

#endif

/* Copyright 2016 The Chromium OS 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 __CROS_EC_TABLET_MODE_H
#define __CROS_EC_TABLET_MODE_H

/**
 * Get tablet mode state
 *
 * Return 1 if in tablet mode, 0 otherwise
 */
int tablet_get_mode(void);

/**
 * Set tablet mode state
 *
 * @param mode 1: tablet mode. 0 clamshell mode.
 */
void tablet_set_mode(int mode);

/**
 * Interrupt service routine for hall sensor.
 *
 * HALL_SENSOR_GPIO_L must be defined.
 *
 * @param signal: GPIO signal
 */
void hall_sensor_isr(enum gpio_signal signal);

/**
 * Disables the interrupt on GPIO connected to hall sensor. Additionally, it
 * disables the tablet mode switch sub-system and turns off tablet mode. This is
 * useful when the same firmware is shared between convertible and clamshell
 * devices to turn off hall sensor and tablet mode detection on clamshell.
 */
void hall_sensor_disable(void);

/**
 * This must be defined when CONFIG_HALL_SENSOR_CUSTOM is defined. This allows
 * a board to override the default behavior that determines if the 360 sensor is
 * active: !gpio_get_level(HALL_SENSOR_GPIO_L).
 *
 * Returns 1 if the 360 sensor is active; otherwise 0.
 */
int board_sensor_at_360(void);

#endif  /* __CROS_EC_TABLET_MODE_H */

tablet-mode: Fix header file guard and API definitions

This patch adds a usual inclusion guard (#ifdef __CROS_EC_*_H) and
fixes API descriptions.

Signed-off-by: Daisuke Nojiri <fd5f93af191bf7e8f73ea71cc3c0f66b41b1dd49@chromium.org>

BUG=none
BRANCH=none
TEST=buildall

Change-Id: I96149cfe76cff7ab85be4785252a600b565e4a92
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1696913
Reviewed-by: Daisuke Nojiri <fd5f93af191bf7e8f73ea71cc3c0f66b41b1dd49@chromium.org>
Commit-Queue: Daisuke Nojiri <fd5f93af191bf7e8f73ea71cc3c0f66b41b1dd49@chromium.org>
Tested-by: Daisuke Nojiri <fd5f93af191bf7e8f73ea71cc3c0f66b41b1dd49@chromium.org>
Auto-Submit: Daisuke Nojiri <fd5f93af191bf7e8f73ea71cc3c0f66b41b1dd49@chromium.org>


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

#pragma once

#include <cstdint>

uint32_t DoMath(uint32_t a);

uint32_t DoMath(uint32_t a) {
    return a * 3;
}

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

#pragma once

#include <cstdint>

uint32_t DoMath(uint32_t a);

inline uint32_t DoMath(uint32_t a) {
    return a * 3;
}

Fix another bug in demo

Fix another bug in demo


/*
    This header file contains all definitions needed for compatibility issues
    Most of them should be defined only if corresponding SYSDEF_XXX macro is
    defined (see system/sysdef.h)
 */
#ifndef OSDEFS_H
#define OSDEFS_H

int strcasecmp (const char *str1, const char *str2);
int strncasecmp (char const *dst, char const *src, int maxLen);
char *strdup (const char *str);

#ifdef SYSDEF_ACCESS
int access (const char *path, int mode);
#endif

// The 2D graphics driver used by software renderer on this platform
#define SOFTWARE_2D_DRIVER	"crystalspace.graphics2d.mac"
#define OPENGL_2D_DRIVER	"crystalspace.graphics2d.defaultgl"
#define GLIDE_2D_DRIVER		"crystalspace.graphics3d.glide.2x"

// Sound driver
#define SOUND_DRIVER            "crystalspace.sound.driver.mac"

#if defined (SYSDEF_DIR)
#  define __NEED_GENERIC_ISDIR
#endif

#define PORT_BYTESEX_BIG_ENDIAN     1

#endif // OSDEFS_H

/*
    This header file contains all definitions needed for compatibility issues
    Most of them should be defined only if corresponding SYSDEF_XXX macro is
    defined (see system/sysdef.h)
 */
#ifndef OSDEFS_H
#define OSDEFS_H

int strcasecmp (const char *str1, const char *str2);
int strncasecmp (char const *dst, char const *src, int maxLen);
char *strdup (const char *str);

#ifdef SYSDEF_ACCESS
int access (const char *path, int mode);
#endif

// The 2D graphics driver used by software renderer on this platform
#define SOFTWARE_2D_DRIVER	"crystalspace.graphics2d.mac"
#define OPENGL_2D_DRIVER	"crystalspace.graphics2d.defaultgl"
#define GLIDE_2D_DRIVER		"crystalspace.graphics3d.glide.2x"

// Sound driver
#define SOUND_DRIVER            "crystalspace.sound.driver.mac"

#if defined (SYSDEF_DIR)
#  define __NEED_GENERIC_ISDIR
#endif

#define PORT_BYTESEX_BIG_ENDIAN     1

#ifdef SYSDEF_2DDRIVER_DEFS
#define kArrowCursor				128

#define kGeneralErrorDialog			1026
#define kAskForDepthChangeDialog	1027

#define kErrorStrings				1025
#define kBadDepthString				1
#define kNoDSContext				2
#define kUnableToOpenDSContext		3
#define kUnableToReserveDSContext	4
#define kFatalErrorInGlide			5
#define kFatalErrorInOpenGL2D		6
#define kFatalErrorInOpenGL3D		7
#define kFatalErrorOutOfMemory		8
#define kFatalErrorInDriver2D		9
#endif

#endif // OSDEFS_H

Move defines for error strings and dialogs into this file for central tracking of ids.

git-svn-id: 28d9401aa571d5108e51b194aae6f24ca5964c06@483 8cc4aa7f-3514-0410-904f-f2cc9021211c


#pragma config(Sensor, S1,     gyro,           sensorI2CHiTechnicGyro)

#define TIME_MAX 0xFFFF

bool initialized = false;
unsigned long lastUpdate = 0;

long getTimeDelta() {
	if (!initialized) {
		initialized = true;
		lastUpdate = nSysTime;
		return 0;
	}

	long delta;

	if (nSysTime < lastUpdate) {
		// The time has looped around
		delta = TIME_MAX - lastUpdate + nSysTime;
		lastUpdate = nSysTime;
	} else {
		delta = nSysTime - lastUpdate;
		lastUpdate = nSysTime;
	}

	return delta;
}

task main() {

	int zero = 0;
	float angle = 0;

	// Find the zero
	for (int i = 0; i < 10; i++) {
		zero += SensorValue[gyro];
		wait1Msec(100);
	}
	zero /= 10;

	while(true) {
		angle += ((SensorValue[gyro]) - zero) * getTimeDelta() / 1000.0;

		nxtDisplayTextLine(0, "%d", SensorValue[gyro]);
		nxtDisplayTextLine(1, "%.4f", angle);
		nxtDisplayTextLine(2, "%d", zero);
	}
}

Add gyro sensor debug program

Add gyro sensor debug program


/*-
 * This program is in the public domain.  I couldn't bring myself to
 * declare Copyright on a variant of Hello World.
 */

#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");

#include <sys/types.h>
#include <sys/uio.h>
#include <syslog.h>
#include <unistd.h>

#define	MESSAGE	"This account is currently not available.\n"

int
main(int argc, char *argv[])
{
#ifndef NO_NOLOGIN_LOG
	char *user, *tt;

	if ((tt = ttyname(0)) == NULL)
		tt = "UNKNOWN";
	if ((user = getlogin()) == NULL)
		user = "UNKNOWN";

	openlog("nologin", LOG_CONS, LOG_AUTH);
	syslog(LOG_CRIT, "Attempted login by %s on %s", user, tt);
	closelog();
#endif /* NO_NOLOGIN_LOG */

	write(STDOUT_FILENO, MESSAGE, sizeof(MESSAGE) - 1);
	_exit(1);
}

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

#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");

#include <stdio.h>
#include <syslog.h>
#include <unistd.h>

#define	MESSAGE	"This account is currently not available.\n"

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

	if ((tt = ttyname(0)) == NULL)
		tt = "UNKNOWN";
	if ((user = getlogin()) == NULL)
		user = "UNKNOWN";
	openlog("nologin", LOG_CONS, LOG_AUTH);
	syslog(LOG_CRIT, "Attempted login by %s on %s", user, tt);
	closelog();

	printf("%s", MESSAGE);
	return 1;
}

Add standard copyright notice; fix style bugs. (Reported by bde) Remove NO_NOLOGIN_LOG option now that we're off the root partition.


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

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

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

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

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

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

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

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

struct statement* parse(char* code) {
  char* regCode = fixSpacing(code);
  int n = 0;
  int i;
  for(i = 0; regCode[i]; i++) {
    if(regCode[i] == ' ') {
      n++;
    }
  }
  char** spcTokens = calloc(sizeof(char*), n+1);

Make parse() count the spaces in the regularized code string.


/* *
 * This file is part of Feng
 *
 * Copyright (C) 2009 by LScube team <team@lscube.org>
 * See AUTHORS for more details
 *
 * feng is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * feng is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with feng; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
 *
 * */

#ifndef FN_UTILS_H
#define FN_UTILS_H

#include "config.h"

#include <time.h>
#include <sys/time.h>
#include <ctype.h>
#include <stdint.h>
#include <sys/types.h>
#include <math.h>
#include <string.h>

/*! autodescriptive error values */
#define ERR_NOERROR              0
#define ERR_GENERIC             -1
#define ERR_ALLOC               -4

#endif // FN_UTILS_H

/* *
 * This file is part of Feng
 *
 * Copyright (C) 2009 by LScube team <team@lscube.org>
 * See AUTHORS for more details
 *
 * feng is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * feng is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with feng; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
 *
 * */

#ifndef FN_UTILS_H
#define FN_UTILS_H

#include "config.h"

#include <time.h>
#include <sys/time.h>
#include <ctype.h>
#include <stdint.h>
#include <sys/types.h>
#include <math.h>
#include <string.h>

#endif // FN_UTILS_H

Remove the remaining ERR_ constants that are never used or tested for.


#include "ruby.h"
#include "rtl-sdr.h"

VALUE m_turtleshell = Qnil;
static VALUE m_rtlsdr;

static VALUE turtleshell_count() {
  return INT2NUM(rtlsdr_get_device_count());
}

static VALUE turtleshell_new_device() {
  char *name;
  rtlsdr_dev_t *device = NULL;
  int count = rtlsdr_get_device_count();

  // ensure we have at least one device
  if (!count) { return Qnil; }

  name = rtlsdr_get_device_name(0);
  device = rtlsdr_open(&device, 0);

  VALUE device_hash = rb_hash_new();
  rb_hash_aset(device_hash, rb_str_new2("name"), rb_str_new2(rtlsdr_get_device_name(0)));
  rb_hash_aset(device_hash, rb_str_new2("device_handle"), device);

  return device_hash;
}

void Init_librtlsdr() {
  m_turtleshell = rb_define_module("TurtleShell");
  m_rtlsdr = rb_define_module_under(m_turtleshell, "RTLSDR");
  rb_define_module_function(m_rtlsdr, "count", turtleshell_count, 0);
  rb_define_module_function(m_rtlsdr, "first_device", turtleshell_new_device, 0);
}

#include "ruby.h"
#include "rtl-sdr.h"

VALUE m_turtleshell = Qnil;
VALUE c_device;
static VALUE m_rtlsdr;

static VALUE turtleshell_count() {
  return INT2NUM(rtlsdr_get_device_count());
}

static VALUE turtleshell_new_device() {
  rtlsdr_dev_t *device = NULL;
  VALUE wrapped_device;
  VALUE hash;
  int count = rtlsdr_get_device_count();

  // ensure we have at least one device
  if (!count) { return Qnil; }

  device = rtlsdr_open(&device, 0);
  wrapped_device = Data_Wrap_Struct(c_device, NULL, NULL, device);

  hash = rb_hash_new();
  rb_hash_aset(hash, rb_str_new2("name"), rb_str_new2(rtlsdr_get_device_name(0)));
  rb_hash_aset(hash, rb_str_new2("device_handle"), wrapped_device);

  return hash;
}

void Init_librtlsdr() {
  m_turtleshell = rb_define_module("TurtleShell");
  m_rtlsdr = rb_define_module_under(m_turtleshell, "RTLSDR");
  c_device = rb_define_class_under(m_rtlsdr, "Device", rb_cObject);
  rb_define_module_function(m_rtlsdr, "count", turtleshell_count, 0);
  rb_define_module_function(m_rtlsdr, "first_device", turtleshell_new_device, 0);
}

Fix a few warnings that prevented Travis from compiling


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

#include "expression.h"
#include "stream.h"
#include "parser.h"
#include "analyze.h"
#include "generator.h"
#include "backend.h"
#include "optimize.h"

int main(int argc, char *argv[]) {
  if (argc < 3) {
    fprintf(stderr, "usage: backend-test <input-file> <output-file>\n");
    exit(1);
  }
  FILE *src = fopen(argv[1], "r");
  if (src == NULL) {
    fprintf(stderr, "backend-test: no such file or directory\n");
    return 1;
  }
  stream *in = open_stream(src);
  block_statement *block = parse(in);
  close_stream(in);
  fclose(src);

  analyze(block);
  code_system *system = generate(block);
  optimize(system);

  FILE *out = fopen(argv[2], "w");
  if (out == NULL) {
    fprintf(stderr, "backend-test: error opening output-file\n");
    return 1;
  }

  backend_write(system, out);

  fflush(out);
  fclose(out);

  return 0;
}

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

#include "expression.h"
#include "stream.h"
#include "parser.h"
#include "analyze.h"
#include "generator.h"
#include "backend.h"
#include "optimize.h"

int main(int argc, char *argv[]) {
  if (argc < 3) {
    fprintf(stderr, "usage: backend-test <input-file> <output-file>\n");
    return 1;
  }
  FILE *src = fopen(argv[1], "r");
  if (src == NULL) {
    fprintf(stderr, "backend-test: no such file or directory\n");
    return 1;
  }
  stream *in = open_stream(src);
  block_statement *block = parse(in);
  close_stream(in);
  fclose(src);

  analyze(block);
  code_system *system = generate(block);
  optimize(system);

  FILE *out = fopen(argv[2], "w");
  if (out == NULL) {
    fprintf(stderr, "backend-test: error opening output-file\n");
    return 1;
  }

  backend_write(system, out);

  fflush(out);
  fclose(out);

  return 0;
}

Return with exit code from main functions

Signed-off-by: Eli Skeggs <5085073edea185966a30aad7f06b91f6997b42e5@gmail.com>


#ifndef COMPAT_H
#define COMPAT_H
#ifndef HAVE_STRCASECMP
extern int strcasecmp(const char*, const char*);
#endif
#ifndef HAVE_STRNCASECMP
extern int strncasecmp(const char*, const char*, unsigned int);
#endif
#endif

Add include file for standard unix functions we have to provide for systems like Windows


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

#define QLA4XXX_DRIVER_VERSION	"5.02.00-k1"

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

#define QLA4XXX_DRIVER_VERSION	"5.02.00-k2"

Update driver version to 5.02.00-k2

[SCSI] qla4xxx: Update driver version to 5.02.00-k2

Signed-off-by: Vikas Chaudhary <c251871a64d7d31888eace0406cb3d4c419d5f73@qlogic.com>
Signed-off-by: Ravi Anand <399b6871085291e2c1578e38a71f59e8d20fafc0@qlogic.com>
Signed-off-by: James Bottomley <407b36959ca09543ccda8f8e06721c791bc53435@suse.de>


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

int main(int argc, char **argv)
{
	printf("#include <stdint.h>\n"
	       "#include \"mako-vm.h\"\n"
	       "char *argv0;\n"
	       "int32_t mem[] = {");
	while(!feof(stdin)) {
		uint8_t buf[4];
		int n = fread(buf, sizeof *buf, 4, stdin);
		if(ferror(stdin)) goto onerr;
		if(n == 0) break;
		if(n != 4) {
			fprintf(stderr, "%s: The file was invalid.\n", argv[0]);
			exit(1);
		}
		printf("0x%04X,", (int32_t)buf[0] << 24 | (int32_t)buf[1] << 16 | (int32_t)buf[2] << 8 | (int32_t)buf[3]);
	}
	printf("0};\n"
	       "int main(int argc, char **argv)\n"
	       "{\n"
	       "\targv0 = argv[0];\n"
	       "\trun_vm(mem);\n"
	       "}\n");
	exit(0);

onerr:
	perror(argv[0]);
	exit(1);
}

Add simple program to generate binaries with a baked-in ROM


/* This file is part of Metallic, a runtime library for WebAssembly.
 *
 * Copyright (C) 2018 Chen-Pang He <chen.pang.he@jdh8.org>
 *
 * This Source Code Form is subject to the terms of the Mozilla
 * Public License v. 2.0. If a copy of the MPL was not distributed
 * with this file, You can obtain one at http://mozilla.org/MPL/2.0/
 */
#include "../../math/reinterpret.h"
#include "../../math/double/normalize.h"
#include <math.h>
#include <stdint.h>

static __int128 _magnitude(int64_t i)
{
    if (i >= 0x7FF0000000000000)
        return (__int128)0x78 << 120 | (__int128)i << 60;

    return i ? ((__int128)0x3C << 120) + ((__int128)_normalize(i) << 60) : 0;
}

long double __extenddftf2(double x)
{
    int64_t i = reinterpret(int64_t, fabs(x));

    return copysignl(reinterpret(long double, _magnitude(i)), x);
}

Implement double to long double conversion


//
//  KWFutureObject.h
//  iOSFalconCore
//
//  Created by Luke Redpath on 13/01/2011.
//  Copyright 2011 LJR Software Limited. All rights reserved.
//

#import <Foundation/Foundation.h>

typedef id (^KWFutureObjectBlock)(void);

@interface KWFutureObject : NSObject {
  __weak id *objectPointer;
  KWFutureObjectBlock block;
}
+ (id)objectWithObjectPointer:(id *)pointer;
+ (id)objectWithReturnValueOfBlock:(KWFutureObjectBlock)block;
- (id)initWithObjectPointer:(id *)pointer;
- (id)initWithBlock:(KWFutureObjectBlock)aBlock;
- (id)object;
@end

//
//  KWFutureObject.h
//  iOSFalconCore
//
//  Created by Luke Redpath on 13/01/2011.
//  Copyright 2011 LJR Software Limited. All rights reserved.
//

#import <Foundation/Foundation.h>

#ifdef __weak
#undef __weak
#define __weak __unsafe_unretained
#endif

typedef id (^KWFutureObjectBlock)(void);

@interface KWFutureObject : NSObject {
  __weak id *objectPointer;
  KWFutureObjectBlock block;
}
+ (id)objectWithObjectPointer:(id *)pointer;
+ (id)objectWithReturnValueOfBlock:(KWFutureObjectBlock)block;
- (id)initWithObjectPointer:(id *)pointer;
- (id)initWithBlock:(KWFutureObjectBlock)aBlock;
- (id)object;
@end

Work arounf use of weak when deployment target it iOS 4


/*
  Copied from mc1322x/dev/cpu.

  This file exists as a work-around for the hardware dependant calls
  to slip_arch_init.

  Current the prototype for slip_arch_init is slip_arch_init(urb)

  and a typical call is something like
  slip_arch_init(BAUD2URB(115200))

  BAUD2UBR is hardware specific, however. Furthermore, for the sky
  platform it's typically defined with #include "dev/uart1.h" (see
  rpl-boarder-router/slip-bridge.c), a sky specific file. dev/uart1.h
  includes msp430.h which includes the sky contiki-conf.h which
  defines BAUD2UBR.

  To me, the correct think to pass is simply the baudrate and have the
  hardware specific conversion happen inside slip_arch_init.

  Notably, most implementations just ignore the passed parameter
  anyway. (except AVR)

 */

#ifndef DEV_UART1_H
#define DEV_UART1_H

#define BAUD2UBR(x) x

#endif

Include file needed for slip rpl-border-router build


// Copyright (c) 2017-2019 The Swipp developers
// Copyright (c) 2019-2020 The Neutron Developers
//
// Distributed under the MIT/X11 software license, see the accompanying
// file COPYING.daemon or http://www.opensource.org/licenses/mit-license.php.

#ifndef NEUTRON_COLLECTIONHASHING_H
#define NEUTRON_COLLECTIONHASHING_H

#include <cstddef>
#include <utility>
#include <tr1/functional>
#include <boost/functional/hash.hpp>

#include "robinhood.h"
#include "uint256.h"

namespace std
{
    template<> struct hash<uint256>
    {
        size_t operator()(const uint256& v) const
        {
            return robin_hood::hash_bytes(v.begin(), v.size());
        }
    };
}

#endif

// Copyright (c) 2017-2019 The Swipp developers
// Copyright (c) 2019-2020 The Neutron Developers
//
// Distributed under the MIT/X11 software license, see the accompanying
// file COPYING.daemon or http://www.opensource.org/licenses/mit-license.php.

#ifndef NEUTRON_COLLECTIONHASHING_H
#define NEUTRON_COLLECTIONHASHING_H

#include <cstddef>
#include <utility>
#include <functional>
#include <boost/functional/hash.hpp>

#include "robinhood.h"
#include "uint256.h"

namespace std
{
    template<> struct hash<uint256>
    {
        size_t operator()(const uint256& v) const
        {
            return robin_hood::hash_bytes(v.begin(), v.size());
        }
    };
}

#endif

Use <functional> instead of <tr/functional>

This is deprecated and adopted by the standard since a long time.


#include <stdio.h>

#define NUMERO_DE_TENTATIVAS 5

int main() {

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

  int numerosecreto = 42;

  int chute;

  for(int i = 1; i <= NUMERO_DE_TENTATIVAS; i++) {

    printf("Tentativa %d de %d\n", i, NUMERO_DE_TENTATIVAS);
    printf("Qual é o seu chute? ");

    scanf("%d", &chute);
    printf("Seu chute foi %d\n", chute);

    if(chute < 0) {
      printf("Você não pode chutar números negativos!\n");
      i--;

      continue;
    }

    int acertou = chute == numerosecreto;
    int maior = chute > numerosecreto;
    int menor = chute < numerosecreto;

    if(acertou) {
      printf("Parabéns! Você acertou!\n");
      printf("Jogue de novo, você é um bom jogador!\n");

      break;
    }

    else if(maior) {
      printf("Seu chute foi maior que o número secreto\n");
    }

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

  }

  printf("Fim de jogo!\n");

}

#include <stdio.h>

int main() {

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

  int numerosecreto = 42;

  int chute;
  int tentativas = 1;

  while(1) {

    printf("Tentativa %d\n", tentativas);
    printf("Qual é o seu chute? ");

    scanf("%d", &chute);
    printf("Seu chute foi %d\n", chute);

    if(chute < 0) {
      printf("Você não pode chutar números negativos!\n");
      continue;
    }

    int acertou = chute == numerosecreto;
    int maior = chute > numerosecreto;

    if(acertou) {
      printf("Parabéns! Você acertou!\n");
      printf("Jogue de novo, você é um bom jogador!\n");

      break;
    }

    else if(maior) {
      printf("Seu chute foi maior que o número secreto\n");
    }

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

    tentativas++;

  }

  printf("Fim de jogo!\n");
  printf("Você acertou em %d tentativas!\n", tentativas);

}

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


// Copyright 2019 Google Inc.
//
// 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.

// Adapter utility from fuzzer input to a temporary file, for fuzzing APIs that
// require a file instead of an input buffer.

#include <cstddef>
#include <cstdint>
#include <cstdlib>

#include "matio.h"

int MatioRead(const char* file_name) {
  mat_t* matfd = Mat_Open(file_name, MAT_ACC_RDONLY);
  if (matfd == nullptr) {
    return 0;
  }

  size_t n = 0;
  Mat_GetDir(matfd, &n);
  Mat_Rewind(matfd);

  matvar_t* matvar = nullptr;
  while ((matvar = Mat_VarReadNextInfo(matfd)) != nullptr) {
    Mat_VarReadDataAll(matfd, matvar);
    Mat_VarGetSize(matvar);
    Mat_VarFree(matvar);
  }

  Mat_Close(matfd);

  return 0;
}

// Copyright 2019 Google Inc.
//
// 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 MATIO_WRAP_H_
#define MATIO_WRAP_H_

#include <cstddef>
#include <cstdint>
#include <cstdlib>

#include "matio.h"

int MatioRead(const char* file_name) {
  mat_t* matfd = Mat_Open(file_name, MAT_ACC_RDONLY);
  if (matfd == nullptr) {
    return 0;
  }

  size_t n = 0;
  Mat_GetDir(matfd, &n);
  Mat_Rewind(matfd);

  matvar_t* matvar = nullptr;
  while ((matvar = Mat_VarReadNextInfo(matfd)) != nullptr) {
    Mat_VarReadDataAll(matfd, matvar);
    Mat_VarGetSize(matvar);
    Mat_VarFree(matvar);
  }

  Mat_Close(matfd);

  return 0;
}

#endif

Remove comment and add include guard

Remove comment and add include guard


#pragma once

#include <cuda_runtime.h>
#include "xchainer/error.h"

namespace xchainer {
namespace cuda {

class RuntimeError : public XchainerError {
public:
    explicit RuntimeError(cudaError_t error);
    cudaError_t error() const noexcept { return error_; }

private:
    cudaError_t error_;
};

void CheckError(cudaError_t error);

// Occupancy
#ifdef __CUDACC__

struct GridBlockSize {
    int grid_size;
    int block_size;
};

template <typename T>
GridBlockSize CudaOccupancyMaxPotentialBlockSize(T&& func, size_t dynamic_smem_size = 0, int block_size_limit = 0) {
    GridBlockSize ret;
    CheckError(
        cudaOccupancyMaxPotentialBlockSize(&ret.grid_size, &ret.block_size, std::forward<T>(func), dynamic_smem_size, block_size_limit));
    return ret;
}

#endif  // __CUDACC__

}  // namespace cuda
}  // namespace xchainer

#pragma once

#include <cuda_runtime.h>
#include "xchainer/error.h"

namespace xchainer {
namespace cuda {

class RuntimeError : public XchainerError {
public:
    explicit RuntimeError(cudaError_t error);
    cudaError_t error() const noexcept { return error_; }

private:
    cudaError_t error_;
};

void CheckError(cudaError_t error);

// Occupancy
#ifdef __CUDACC__

struct GridBlockSize {
    int grid_size;
    int block_size;
};

template <typename T>
GridBlockSize CudaOccupancyMaxPotentialBlockSize(const T& func, size_t dynamic_smem_size = 0, int block_size_limit = 0) {
    GridBlockSize ret = {};
    CheckError(
        cudaOccupancyMaxPotentialBlockSize(&ret.grid_size, &ret.block_size, func, dynamic_smem_size, block_size_limit));
    return ret;
}

#endif  // __CUDACC__

}  // namespace cuda
}  // namespace xchainer

Use const T& instead of T&&

Use const T& instead of T&&


/*-
 * Copyright (c) 1998 Sendmail, Inc.  All rights reserved.
 * Copyright (c) 1990, 1993
 *	The Regents of the University of California.  All rights reserved.
 *
 * By using this file, you agree to the terms and conditions set
 * forth in the LICENSE file which can be found at the top level of
 * the sendmail distribution.
 *
 *
 *	@(#)pathnames.h	8.5 (Berkeley) 5/19/1998
 */
#include <paths.h>

#define _PATH_LOCTMP	"/tmp/local.XXXXXX"

/*-
 * Copyright (c) 1998 Sendmail, Inc.  All rights reserved.
 * Copyright (c) 1990, 1993
 *	The Regents of the University of California.  All rights reserved.
 *
 * By using this file, you agree to the terms and conditions set
 * forth in the LICENSE file which can be found at the top level of
 * the sendmail distribution.
 *
 *
 *	@(#)pathnames.h	8.5 (Berkeley) 5/19/1998
 *	$FreeBSD$
 */
#include <paths.h>

#define _PATH_LOCTMP	"/var/tmp/local.XXXXXX"

Change location of temporary file from /tmp to /var/tmp.  This is a
repeat of an earlier commit which apparently got lost with the last
import.  It helps solve the frequently reported problem

   pid 4032 (mail.local), uid 0 on /: file system full

(though there appears to be a lot of space) caused by idiots sending
30 MB mail messages.

Most-recently-reported-by:  jahanur <jahanur@jjsoft.com>

Add $FreeBSD$ so that I can check the file back in.

Rejected-by:	CVS


/*
 * Copyright (c) 2018, ARM Limited and Contributors. All rights reserved.
 *
 * SPDX-License-Identifier: BSD-3-Clause
 */

#include <stdint.h>

#include <arch_helpers.h>
#include <plat/common/platform.h>

#define RANDOM_CANARY_VALUE ((u_register_t) 3288484550995823360ULL)

u_register_t plat_get_stack_protector_canary(void)
{
	/*
	 * Ideally, a random number should be returned instead of the
	 * combination of a timer's value and a compile-time constant.
	 * As the virt platform does not have any random number generator,
	 * this is better than nothing but not necessarily really secure.
	 */
	return RANDOM_CANARY_VALUE ^ read_cntpct_el0();
}

/*
 * Copyright (c) 2021, ARM Limited and Contributors. All rights reserved.
 *
 * SPDX-License-Identifier: BSD-3-Clause
 */

#include <stdint.h>

#include <arch_helpers.h>
#include <arch_features.h>
#include <plat/common/platform.h>

#define RANDOM_CANARY_VALUE ((u_register_t) 3288484550995823360ULL)

u_register_t plat_get_stack_protector_canary(void)
{
#if ENABLE_FEAT_RNG
	/* Use the RNDR instruction if the CPU supports it */
	if (is_armv8_5_rng_present()) {
		return read_rndr();
	}
#endif

	/*
	 * Ideally, a random number should be returned above. If a random
	 * number generator is not supported, return instead a
	 * combination of a timer's value and a compile-time constant.
	 * This is better than nothing but not necessarily really secure.
	 */
	return RANDOM_CANARY_VALUE ^ read_cntpct_el0();
}

Use RNDR in stack protector

plat/qemu: Use RNDR in stack protector

When getting a stack protector canary value, check
if cpu supports FEAT_RNG and use that. Fallback to
old method of using a (hardcoded value ^ timer).

Signed-off-by: Tomas Pilar <2bc6038c3dfca09b2da23c8b6da8ba884dc2dcc2@nuviainc.com>
Change-Id: I8181acf8e31661d4cc82bc3a4078f8751909e725


#include <stdio.h>
#include <pthread.h>
#include <stdlib.h>
#include <stdbool.h>
#include <errno.h>
#include <unistd.h>

pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER;
pthread_cond_t condition = PTHREAD_COND_INITIALIZER;

bool turn = true;
int counter = 0;

void* even_thread(void* arg)
{
	do
	{
		pthread_mutex_lock(&mutex);
		if (counter % 2 == 0)
		{
			pthread_cond_wait(&condition, &mutex);
		}
		fprintf(stdout, "%d\n", counter);
		fflush(stdout);
		counter++;
		pthread_cond_signal(&condition);
		pthread_mutex_unlock(&mutex);
		sleep(3);
	} while (1);
}

void* odd_thread(void* arg)
{
	do
	{
		pthread_mutex_lock(&mutex);
		if (counter % 2 != 0)
		{
			pthread_cond_wait(&condition, &mutex);
		}
		fprintf(stdout, "%d\n", counter);
		fflush(stdout);
		counter++;
		pthread_cond_signal(&condition);
		pthread_mutex_unlock(&mutex);
		sleep(1);
	} while (1);
}

int main(int argc, char** argv)
{
	pthread_t odd_thr, even_thr;

	int rc = 0;

	rc = pthread_create(&odd_thr, NULL, odd_thread, NULL);

	if (rc < 0)
	{
		fprintf(stderr, "Error creating an odd thread! %d\n", errno);
		fflush(stderr);
		exit(EXIT_FAILURE);
	}

	rc = pthread_create(&even_thr, NULL, even_thread, NULL);

	if (rc < 0)
	{
		fprintf(stderr, "Error creating an even thread! %d\n", errno);
		fflush(stderr);
		exit(EXIT_FAILURE);
	}

	rc = pthread_join(odd_thr, NULL);

	if (rc < 0)
	{
		fprintf(stderr, "Error in pthread_join with odd thread! %d\n", errno);
		fflush(stderr);
		exit(EXIT_FAILURE);
	}

	rc = pthread_join(even_thr, NULL);

	if (rc < 0)
	{
		fprintf(stderr, "Error in pthread_join with even thread! %d\n", errno);
		fflush(stderr);
		exit(EXIT_FAILURE);
	}

	return EXIT_SUCCESS;
}

Add printing even and odd numbers in separate threads.


/*
 * waysome - wayland based window manager
 *
 * Copyright in alphabetical order:
 *
 * Copyright (C) 2014-2015 Julian Ganz
 * Copyright (C) 2014-2015 Manuel Messner
 * Copyright (C) 2014-2015 Marcel Müller
 * Copyright (C) 2014-2015 Matthias Beyer
 * Copyright (C) 2014-2015 Nadja Sommerfeld
 *
 * This file is part of waysome.
 *
 * waysome is free software: you can redistribute it and/or modify it under the
 * terms of the GNU Lesser General Public License as published by the Free
 * Software Foundation, either version 2.1 of the License, or (at your option)
 * any later version.
 *
 * waysome is distributed in the hope that it will be useful, but WITHOUT ANY
 * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
 * A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
 * details.
 *
 * You should have received a copy of the GNU Lesser General Public License
 * along with waysome. If not, see <http://www.gnu.org/licenses/>.
 */

#include <stddef.h>
#include <string.h>

#include "serialize/json/keys.h"
#include "serialize/json/states.h"
#include "serialize/json/string_jump_state.h"

/**
 * Map for mapping the current state with a string on the next state
 */
static const struct {
    enum json_backend_state current;
    enum json_backend_state next;
    const char* str;
} MAP[] = {
    { .current = STATE_MSG, .next = STATE_UID,      .str = UID          },
    { .current = STATE_MSG, .next = STATE_TYPE,     .str = TYPE         },
    { .current = STATE_MSG, .next = STATE_COMMANDS, .str = COMMANDS     },

    { .str = NULL },
};

/*
 *
 * Interface implementation
 *
 */

enum json_backend_state
get_next_state_for_string(
    enum json_backend_state current,
    const unsigned char * str
) {
    //!< @todo implement
    return 0;
}

Add string jump state source file including stub


//
//  CLUInteractionObserver.h
//  Clue
//
//  Created by Ahmed Sulaiman on 6/7/16.
//  Copyright © 2016 Ahmed Sulaiman. All rights reserved.
//

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

@protocol CLUInteractionObserverDelegate <NSObject>

@required
- (void)touchesBegan:(NSSet<UITouch *> *)touches;
- (void)touchesMoved:(NSArray<UITouch *> *)touches;
- (void)touchesEnded:(NSSet<UITouch *> *)touches;

@end

//
//  CLUInteractionObserver.h
//  Clue
//
//  Created by Ahmed Sulaiman on 6/7/16.
//  Copyright © 2016 Ahmed Sulaiman. All rights reserved.
//

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

@protocol CLUInteractionObserverDelegate <NSObject>

@required
- (void)touchesBegan:(NSArray<CLUTouch *> *)touches;
- (void)touchesMoved:(NSArray<CLUTouch *> *)touches;
- (void)touchesEnded:(NSArray<CLUTouch *> *)touches;

@end

Change Interaction Observer Delegate to use Clue Touch model and NSArray instead of NSSet


#ifndef	FILE_DESCRIPTOR_H
#define	FILE_DESCRIPTOR_H

#include <io/channel.h>

class FileDescriptor : public Channel {
	LogHandle log_;
protected:
	int fd_;
public:
	FileDescriptor(int);
	~FileDescriptor();

	Action *close(EventCallback *);
	Action *read(size_t, EventCallback *);
	Action *write(Buffer *, EventCallback *);
};

#endif /* !FILE_DESCRIPTOR_H */

#ifndef	FILE_DESCRIPTOR_H
#define	FILE_DESCRIPTOR_H

#include <io/channel.h>

class FileDescriptor : public Channel {
	LogHandle log_;
protected:
	int fd_;
public:
	FileDescriptor(int);
	~FileDescriptor();

	virtual Action *close(EventCallback *);
	virtual Action *read(size_t, EventCallback *);
	virtual Action *write(Buffer *, EventCallback *);
};

#endif /* !FILE_DESCRIPTOR_H */

Make close, read and write virtual.

Make close, read and write virtual.

git-svn-id: 9e2532540f1574e817ce42f20b9d0fb64899e451@192 4068ffdb-0463-0410-8185-8cc71e3bd399


/******************************************************************************
globus_gass_file_api.h

Description:
    This header contains the GASS File Access API definitions

CVS Information:

    $Source$
    $Date$
    $Revision$
    $Author$
******************************************************************************/
#ifndef _GLOBUS_GASS_INCLUDE_GLOBUS_GASS_FILE_API_H
#define _GLOBUS_GASS_INCLUDE_GLOBUS_GASS_FILE_API_H

#ifndef EXTERN_C_BEGIN
#ifdef __cplusplus
#define EXTERN_C_BEGIN extern "C" {
#define EXTERN_C_END }
#else
#define EXTERN_C_BEGIN
#define EXTERN_C_END
#endif
#endif

#include <stdio.h>

EXTERN_C_BEGIN

int globus_gass_open(char *file, int oflags, ...);
FILE *globus_gass_fopen(char *file, char *mode);
int globus_gass_close(int fd);
int globus_gass_fclose(FILE *f);

/******************************************************************************
 *                    Module Definition
 *****************************************************************************/
extern globus_module_descriptor_t globus_i_gass_file_module;
#define GLOBUS_GASS_FILE_MODULE (&globus_i_gass_file_module)

EXTERN_C_END

#endif

/******************************************************************************
globus_gass_file_api.h

Description:
    This header contains the GASS File Access API definitions

CVS Information:

    $Source$
    $Date$
    $Revision$
    $Author$
******************************************************************************/
#ifndef _GLOBUS_GASS_INCLUDE_GLOBUS_GASS_FILE_API_H
#define _GLOBUS_GASS_INCLUDE_GLOBUS_GASS_FILE_API_H

#ifndef EXTERN_C_BEGIN
#ifdef __cplusplus
#define EXTERN_C_BEGIN extern "C" {
#define EXTERN_C_END }
#else
#define EXTERN_C_BEGIN
#define EXTERN_C_END
#endif
#endif

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

EXTERN_C_BEGIN

int globus_gass_open(char *file, int oflags, ...);
FILE *globus_gass_fopen(char *file, char *mode);
int globus_gass_close(int fd);
int globus_gass_fclose(FILE *f);

/******************************************************************************
 *                    Module Definition
 *****************************************************************************/
extern globus_module_descriptor_t globus_i_gass_file_module;
#define GLOBUS_GASS_FILE_MODULE (&globus_i_gass_file_module)

EXTERN_C_END

#endif

Add inclusion of globus_gass_common.h so end user does not need this inclusion


//
//  SRUtils.h
//  Sensorama
//
//  Created by Wojciech Koszek (home) on 3/1/16.
//  Copyright © 2016 Wojciech Adam Koszek. All rights reserved.
//

@import Foundation;
@import UIKit;

@interface SRUtils : NSObject

+ (UIColor *)mainColor;
+ (NSDictionary *)deviceInfo;
+ (NSString*)computeSHA256DigestForString:(NSString*)input;
+ (BOOL)isSimulator;
+ (NSString *)activityString:(CMMotionActivity *)activity;
+ (NSInteger)activityInteger:(CMMotionActivity *)activity;

@end

//
//  SRUtils.h
//  Sensorama
//
//  Created by Wojciech Koszek (home) on 3/1/16.
//  Copyright © 2016 Wojciech Adam Koszek. All rights reserved.
//

@import Foundation;
@import UIKit;
@import CoreMotion;

@interface SRUtils : NSObject

+ (UIColor *)mainColor;
+ (NSDictionary *)deviceInfo;
+ (NSString*)computeSHA256DigestForString:(NSString*)input;
+ (BOOL)isSimulator;
+ (NSString *)activityString:(CMMotionActivity *)activity;
+ (NSInteger)activityInteger:(CMMotionActivity *)activity;

@end

Add CoreMotion so that types can be detected


//===- Transforms/SampleProfile.h - SamplePGO pass--------------*- C++ -*-===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
/// \file
/// This file provides the interface for the sampled PGO loader pass.
//===----------------------------------------------------------------------===//

#ifndef LLVM_TRANSFORMS_SAMPLEPROFILE_H
#define LLVM_TRANSFORMS_SAMPLEPROFILE_H

#include "llvm/IR/PassManager.h"

namespace llvm {

/// The instrumentation (profile-instr-gen) pass for IR based PGO.
class SampleProfileLoaderPass : public PassInfoMixin<SampleProfileLoaderPass> {
public:
  PreservedAnalyses run(Module &M, AnalysisManager<Module> &AM);
};

} // End llvm namespace
#endif

//===- Transforms/SampleProfile.h - SamplePGO pass--------------*- C++ -*-===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
/// \file
/// This file provides the interface for the sampled PGO loader pass.
//===----------------------------------------------------------------------===//

#ifndef LLVM_TRANSFORMS_SAMPLEPROFILE_H
#define LLVM_TRANSFORMS_SAMPLEPROFILE_H

#include "llvm/IR/PassManager.h"

namespace llvm {

/// The sample profiler data loader pass.
class SampleProfileLoaderPass : public PassInfoMixin<SampleProfileLoaderPass> {
public:
  PreservedAnalyses run(Module &M, AnalysisManager<Module> &AM);
};

} // End llvm namespace
#endif

Fix wrong comment in header /NFC

Fix wrong comment in header /NFC

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


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

int main(int argc, char **argv)
{
	printf("#include <stdint.h>\n"
	       "#include \"mako-vm.h\"\n"
	       "char *argv0;\n"
	       "int32_t mem[] = {");
	while(!feof(stdin)) {
		uint8_t buf[4];
		int n = fread(buf, sizeof *buf, 4, stdin);
		if(ferror(stdin)) goto onerr;
		if(n == 0) break;
		if(n != 4) {
			fprintf(stderr, "%s: The file was invalid.\n", argv[0]);
			exit(1);
		}
		printf("0x%04X,", (int32_t)buf[0] << 24 | (int32_t)buf[1] << 16 | (int32_t)buf[2] << 8 | (int32_t)buf[3]);
	}
	printf("0};\n"
	       "int main(int argc, char **argv)\n"
	       "{\n"
	       "\targv0 = argv[0];\n"
	       "\trun_vm(mem);\n"
	       "}\n");
	exit(0);

onerr:
	perror(argv[0]);
	exit(1);
}

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

int main(int argc, char **argv)
{
	printf("#include <stdint.h>\n"
	       "#include <SDL.h>\n"
	       "#include \"mako-vm.h\"\n"
	       "char *argv0;\n"
	       "int32_t mem[] = {");
	while(!feof(stdin)) {
		uint8_t buf[4];
		int n = fread(buf, sizeof *buf, 4, stdin);
		if(ferror(stdin)) goto onerr;
		if(n == 0) break;
		if(n != 4) {
			fprintf(stderr, "%s: The file was invalid.\n", argv[0]);
			exit(1);
		}
		printf("0x%04X,", (int32_t)buf[0] << 24 | (int32_t)buf[1] << 16 | (int32_t)buf[2] << 8 | (int32_t)buf[3]);
	}
	printf("0};\n"
	       "int main(int argc, char **argv)\n"
	       "{\n"
	       "\targv0 = argv[0];\n"
	       "\trun_vm(mem);\n"
	       "}\n");
	exit(0);

onerr:
	perror(argv[0]);
	exit(1);
}

Include <SDL.h> in the baked VMs, so Windows works.


/*
 *  linux/include/asm-arm/map.h
 *
 *  Copyright (C) 1999-2000 Russell King
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 as
 * published by the Free Software Foundation.
 *
 *  Page table mapping constructs and function prototypes
 */
struct map_desc {
	unsigned long virtual;
	unsigned long pfn;
	unsigned long length;
	unsigned int type;
};

struct meminfo;

#define MT_DEVICE		0
#define MT_CACHECLEAN		1
#define MT_MINICLEAN		2
#define MT_LOW_VECTORS		3
#define MT_HIGH_VECTORS		4
#define MT_MEMORY		5
#define MT_ROM			6
#define MT_IXP2000_DEVICE	7

#define	__phys_to_pfn(paddr)	(paddr >> PAGE_SHIFT)
#define	__pfn_to_phys(pfn)	(pfn << PAGE_SHIFT)

extern void create_memmap_holes(struct meminfo *);
extern void memtable_init(struct meminfo *);
extern void iotable_init(struct map_desc *, int);
extern void setup_io_desc(void);

/*
 *  linux/include/asm-arm/map.h
 *
 *  Copyright (C) 1999-2000 Russell King
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License version 2 as
 * published by the Free Software Foundation.
 *
 *  Page table mapping constructs and function prototypes
 */
struct map_desc {
	unsigned long virtual;
	unsigned long pfn;
	unsigned long length;
	unsigned int type;
};

struct meminfo;

#define MT_DEVICE		0
#define MT_CACHECLEAN		1
#define MT_MINICLEAN		2
#define MT_LOW_VECTORS		3
#define MT_HIGH_VECTORS		4
#define MT_MEMORY		5
#define MT_ROM			6
#define MT_IXP2000_DEVICE	7

#define	__phys_to_pfn(paddr)	((paddr) >> PAGE_SHIFT)
#define	__pfn_to_phys(pfn)	((pfn) << PAGE_SHIFT)

extern void create_memmap_holes(struct meminfo *);
extern void memtable_init(struct meminfo *);
extern void iotable_init(struct map_desc *, int);
extern void setup_io_desc(void);

Fix buggy __phys_to_pfn / __pfn_to_phys

[ARM] Fix buggy __phys_to_pfn / __pfn_to_phys

Macro arguments should _always_ be surrounded by parentheses
when used to prevent unexpected problems with operator precedence.

Signed-off-by: Russell King <f6aa0246ff943bfa8602cdf60d40c481b38ed232@arm.linux.org.uk>


/*
 * 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 65
#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 66
#endif

Update Skia milestone to 66

Update Skia milestone to 66

TBR=reed@google.com

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


/*
 * 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 84
#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 85
#endif

Update Skia milestone to 85

Update Skia milestone to 85

Change-Id: If6f878b896397ec1946a0b29b10764722b35d737
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/289777
Reviewed-by: Heather Miller <2e22000c5d22374561fe5fba576a31095b72dc2e@google.com>
Commit-Queue: Heather Miller <2e22000c5d22374561fe5fba576a31095b72dc2e@google.com>
Auto-Submit: Heather Miller <2e22000c5d22374561fe5fba576a31095b72dc2e@google.com>


#pragma once

#include <ionScene/CSimpleMesh.h>
#include "SVolume.h"

struct SMarchingCubesPoint
{
	f32 Value;
	vec3f Gradient;

	SMarchingCubesPoint()
	{}

	SMarchingCubesPoint(f32 const & value)
		: Value(value)
	{}
};

typedef SVolume<SMarchingCubesPoint> SMarchingCubesVolume;

void CalculateGradient(SMarchingCubesVolume & Volume);
ion::Scene::CSimpleMesh * MarchingCubes(SMarchingCubesVolume & Volume);

#pragma once

#include <ionScene/CSimpleMesh.h>
#include "SVolume.h"

struct SMarchingCubesPoint
{
	f32 Value = 0;
	vec3f Gradient;

	SMarchingCubesPoint()
	{}

	SMarchingCubesPoint(f32 const & value)
		: Value(value)
	{}
};

typedef SVolume<SMarchingCubesPoint> SMarchingCubesVolume;

void CalculateGradient(SMarchingCubesVolume & Volume);
ion::Scene::CSimpleMesh * MarchingCubes(SMarchingCubesVolume & Volume);

Fix marching cubes unitialized variable

[ionScience] Fix marching cubes unitialized variable


#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <netinet/sctp.h>
#include <arpa/inet.h>
#include <string.h>
#include <stdio.h>
#include <unistd.h>
#include <stdlib.h>
#include <errno.h>

#define PORT 5001
#define ADDR "212.201.121.85"

int
main(int argc, char *argv[])
{
	int fd;
	char c;
#if 1
	struct sctp_reset_streams srs;
#else
	sctp_assoc_t assoc_id;
#endif
	struct sockaddr_in addr;

	if ((fd = socket(AF_INET, SOCK_STREAM, IPPROTO_SCTP)) < 0) {
		perror("socket");
	}
	memset(&addr, 0, sizeof(struct sockaddr_in));
	addr.sin_family = AF_INET;
	addr.sin_len = sizeof(struct sockaddr_in);
	addr.sin_addr.s_addr = inet_addr(ADDR);
	addr.sin_port = htons(PORT);
	if (connect(fd, (const struct sockaddr *) &addr, sizeof(struct sockaddr_in)) != 0) {
		perror("connect");
	}
	c = 'A';
	if (send(fd, (const void *)&c, 1, 0) < 0) {
		perror("send 1");
	}
	c = 'B';
	if (send(fd, (const void *)&c, 1, 0) < 0) {
		perror("send 2");
	}
#if 1
	memset(&srs, 0, sizeof(struct sctp_reset_streams));
	srs.srs_flags = SCTP_STREAM_RESET_OUTGOING;
	srs.srs_number_streams = 0;
	if (setsockopt(fd, IPPROTO_SCTP, SCTP_RESET_STREAMS, &srs, (socklen_t)sizeof(struct sctp_reset_streams)) < 0) {
		perror("setsockopt SCTP_RESET_STREAMS");
	}
#else
	if (setsockopt(fd, IPPROTO_SCTP, SCTP_RESET_ASSOC, &assoc_id, (socklen_t)sizeof(sctp_assoc_t)) < 0) {
		perror("setsockopt SCTP_RESET_ASSOC");
	}
#endif
	if (close(fd) < 0) {
		perror("close");
	}
	return (0);
}

Add a simple test client.

Add a simple test client.


#pragma once

#include <pebble.h>

#define BG_COLOR GColorWhite

#define ACTION_BAR_WIDTH_WITH_GAP (ACTION_BAR_WIDTH + 12)

#define BPM_FONT FONT_KEY_BITHAM_42_BOLD
#define BPM_FONT_HEIGHT 42
#define BPM_DEFAULT "---"

#define BPM_HINT_FONT FONT_KEY_GOTHIC_24_BOLD
#define BPM_HINT_FONT_HEIGHT 24
#define BPM_HINT_TEXT "BPM:"

#define BPM_TEXT_BUFFER_SIZE 10

#define TAP_TIMEOUT_SECONDS 2

#pragma once

#include <pebble.h>

#define BG_COLOR GColorWhite

#ifdef PBL_ROUND
#define ACTION_BAR_WIDTH_WITH_GAP (ACTION_BAR_WIDTH + 12)
#else
#define ACTION_BAR_WIDTH_WITH_GAP (ACTION_BAR_WIDTH + 2)
#endif

#define BPM_FONT FONT_KEY_BITHAM_42_BOLD
#define BPM_FONT_HEIGHT 42
#define BPM_DEFAULT "---"

#define BPM_HINT_FONT FONT_KEY_GOTHIC_24_BOLD
#define BPM_HINT_FONT_HEIGHT 24
#define BPM_HINT_TEXT "BPM:"

#define BPM_TEXT_BUFFER_SIZE 10

#define TAP_TIMEOUT_SECONDS 2

Fix cut off BPM on aplite and basalt

Fix cut off BPM on aplite and basalt

Previously, BPMs that rendered wide, specifically 100.0 and simlar, would get
cut off on these platforms. This change decreases border size on square watches
to prevent this from happening.


#ifndef BITCOINADDRESSVALIDATOR_H
#define BITCOINADDRESSVALIDATOR_H

#include <QValidator>

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

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

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

    static const int MaxAddressLength = 35;
};

#endif // BITCOINADDRESSVALIDATOR_H

#ifndef BITCOINADDRESSVALIDATOR_H
#define BITCOINADDRESSVALIDATOR_H

#include <QValidator>

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

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

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

    static const int MaxAddressLength = 35;
};

#endif // BITCOINADDRESSVALIDATOR_H

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


/*
 * The Homework Database
 *
 * SQL Parser
 *
 * Authors:
 *    Oliver Sharma and Joe Sventek
 *     {oliver, joe}@dcs.gla.ac.uk
 *
 * (c) 2009. All rights reserved.
 */
#ifndef HWDB_PARSER_H
#define HWDB_PARSER_H

#include "sqlstmts.h"
#include "gram.h"

/* Places parsed output in externally declared global variable:
 *     sqlstmt stmt
 */
void *sql_parse(char *query);

void reset_statement(void);

void sql_reset_parser(void *bufstate);

void sql_dup_stmt(sqlstmt *dup);

/* Prints externally declared global variable
 *     sqlstmt stmt
 * to standard output
 */
void sql_print();

#endif

/*
 * Copyright (c) 2013, Court of the University of Glasgow
 * All rights reserved.

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

 * - Redistributions of source code must retain the above copyright notice,
 *   this list of conditions and the following disclaimer.
 *
 * - Redistributions in binary form must reproduce the above copyright notice,
 *   this list of conditions and the following disclaimer in the documentation
 *   and/or other materials provided with the distribution.
 *
 * - Neither the name of the University of Glasgow nor the names of its
 *   contributors may be used to endorse or promote products derived from this
 *   software without specific prior written permission.
 *
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 * POSSIBILITY OF SUCH DAMAGE.
 */

/*
 * The Homework Database
 *
 * SQL Parser
 *
 * Authors:
 *    Oliver Sharma and Joe Sventek
 *     {oliver, joe}@dcs.gla.ac.uk
 *
 */
#ifndef HWDB_PARSER_H
#define HWDB_PARSER_H

#include "sqlstmts.h"
#include "gram.h"

/* Places parsed output in externally declared global variable:
 *     sqlstmt stmt
 */
void *sql_parse(char *query);

void reset_statement(void);

void sql_reset_parser(void *bufstate);

void sql_dup_stmt(sqlstmt *dup);

/* Prints externally declared global variable
 *     sqlstmt stmt
 * to standard output
 */
void sql_print();

#endif

Add BSD 3-clause open source header

Add BSD 3-clause open source header


/*
 *The MIT License (MIT)
 *
 * Copyright (c) <2016> <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.
 */

#ifndef CJET_IO_EVENT_H
#define CJET_IO_EVENT_H

#ifdef __cplusplus
extern "C" {
#endif

#include <stdint.h>

union io_context {
	void *ptr;
	int fd;
	uint32_t u32;
	uint64_t u64;
};

struct io_event {
	union io_context context;
	int (*read_function)(union io_context*);
	int (*write_function)(union io_context*);
};

#ifdef __cplusplus
}
#endif

#endif

Add preliminary structure for generic io handling.


#ifndef _CONFIG_H_
#define _CONFIG_H_

#define LOGINDB_FILE "logindb"
#define LOGINDB_MAX 100
#define LOGINDB_MAXLINE 128
#define LOGIN_COOKIEJAR "cookie"
#define LOGIN_COOKIESIZE 32
#define LOGIN_TOKENSIZE  64
#define LOGIN_URLMAXSIZE 256

static const char *haven_authserv    = "moltke.seatribe.se";
static const char *haven_webauth     = "www.havenandhearth.com";
static const char *haven_tokenlink   = "/autohaven";
static const char *cearth_config_dir = "/.cearth/";
static const char *foo               = "test";

#endif

#ifndef _CONFIG_H_
#define _CONFIG_H_

#define LOGINDB_FILE "logindb"
#define LOGINDB_MAX 100
#define LOGINDB_MAXLINE 128
#define LOGIN_COOKIEJAR "cookie"
#define LOGIN_COOKIESIZE 32
#define LOGIN_TOKENSIZE  64
#define LOGIN_URLMAXSIZE 256
#define LOGIN_TOKSTRSTART "<property name=\"jnlp.haven.authck\" value=\""

static const char *haven_authserv    = "moltke.seatribe.se";
static const char *haven_webauth     = "www.havenandhearth.com";
static const char *haven_tokenlink   = "/autohaven";
static const char *cearth_config_dir = "/.cearth/";
static const char *foo               = "test";

#endif

Add the string to search when parsing for token from website


/* Various definitons used the the ARM uClibc assembly code.  */
#ifndef _ARM_ASM_H
#define _ARM_ASM_H

#ifdef __thumb2__
# ifdef __ASSEMBLER__
.thumb
.syntax unified
# endif /* __ASSEMBLER__ */
#define IT(t, cond) i##t cond
#else
/* XXX: This can be removed if/when we require an assembler that supports
   unified assembly syntax.  */
#define IT(t, cond)
/* Code to return from a thumb function stub.  */
#ifdef __ARM_ARCH_4T__
#define POP_RET pop	{r2, pc}
#else
#define POP_RET pop	{r2, r3}; bx	r3
#endif
#endif

#if defined(__ARM_ARCH_6M__)
/* Force arm mode to flush out errors on M profile cores.  */
#undef IT
#define THUMB1_ONLY 1
#endif

#endif /* _ARM_ASM_H */

/* Various definitons used the the ARM uClibc assembly code.  */
#ifndef _ARM_ASM_H
#define _ARM_ASM_H

#ifdef __thumb2__
# ifdef __ASSEMBLER__
.thumb
.syntax unified
# endif /* __ASSEMBLER__ */
#define IT(t, cond) i##t cond
#else
/* XXX: This can be removed if/when we require an assembler that supports
   unified assembly syntax.  */
#define IT(t, cond)
/* Code to return from a thumb function stub.  */
# if defined __ARM_ARCH_4T__ && defined __THUMB_INTERWORK__
#  define POP_RET pop   {r2, r3}; bx    r3
# else
#  define POP_RET pop   {r2, pc}
# endif
#endif /* __thumb2__ */

#if defined(__ARM_ARCH_6M__)
/* Force arm mode to flush out errors on M profile cores.  */
#undef IT
#define THUMB1_ONLY 1
#endif

#endif /* _ARM_ASM_H */

Fix POP_RET for armv4t && interworking

arm: Fix POP_RET for armv4t && interworking

It seems the condition was reversed which lead to e.g. arm-920t being
confused

Signed-off-by: Bernhard Reutner-Fischer <ce1ac9e9ad16abccd7821f371ad381197b4768ac@gmail.com>


#ifndef ARTICLE_ANALYSIS_PROTOCOL_TYPES_H_
#define ARTICLE_ANALYSIS_PROTOCOL_TYPES_H_

#include <string.h>
#include <time.h>

#include <string>
#include <vector>

namespace protocol {

namespace types {

/**
 * Type of the document's title string.
 */
typedef std::wstring DocTitle;

/**
 * Type of the user name string.
 */
typedef std::string User;

/**
 * Type of the document's content string.
 */
typedef std::wstring Content;

/**
 * Type of of the time point.
 */
typedef time_t Time;

/**
 * Type of the board.
 */
typedef std::string Board;

/**
 * Enumerate of the reply mode
 */
enum class ReplyMode : int {
  GOOD = 0,
  NORMAL,
  WOO,
};

/**
 * Number of different reply modes.
 */
static constexpr size_t NUM_REPLY_MODES = 3;

/**
 * Type of a row of reply message.
 */
struct ReplyMessage {
  ReplyMode mode;
  User user;
  Content message;

  ReplyMessage() {}
  ReplyMessage(ReplyMode mode, User const& user, Content const& message) :
      mode(mode), user(user), message(message) {}
};

/**
 * Type of an array of reply messages.
 */
typedef std::vector<ReplyMessage> ReplyMessages;

/**
 * Meta data of a document.
 */
struct DocMetaData {
  size_t id;
  size_t prev_id;
  DocTitle title;
  User author;
  Time post_time;
  Board board;

  size_t num_reply_rows[NUM_REPLY_MODES];

  DocMetaData() {}
  DocMetaData(size_t id,
              size_t prev_id,
              DocTitle const& title,
              User const& author,
              Time const& post_time,
              Board const& board,
              size_t num_reply_rows[NUM_REPLY_MODES]) :
      id(id), prev_id(prev_id),
      title(title), author(author), post_time(post_time), board(board) {
    memcpy(this->num_reply_rows, num_reply_rows, sizeof(this->num_reply_rows));
  }
};

/**
 * Real document content data.
 */
struct DocRealData {
  Content content;
  ReplyMessages reply_messages;

  DocRealData() {}
  DocRealData(Content const& content, ReplyMessages const& reply_messages) :
      content(content), reply_messages(reply_messages) {}
};

}  // namespace types

}  // namespace protocol

#endif  // ARTICLE_ANALYSIS_PROTOCOL_TYPES_H_

Add type definitions of structure documents

As title.


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

char *
gh_db_path (char *data_dir)
{
  char *db_file = "/ghighlighter.db";

  int length = strlen (data_dir);
  length = length + strlen (db_file);

  char *path = malloc (length + sizeof (char));
  strcat (path, data_dir);
  strcat (path, db_file);

  return path;
}

Add method to return path to db file

Add method to return path to db file


//******************************************************************************
//
// Copyright (c) 2016, Intel Corporation
// Copyright (c) 2016 Microsoft Corporation. All rights reserved.
//
// This code is licensed under the MIT License (MIT).
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
//
//******************************************************************************
#pragma once

@interface ImageSource : NSObject
@property (nonatomic) NSData *data;
- (instancetype)initWithData:(CFDataRef)data;
- (instancetype)initWithURL:(CFURLRef)url;
- (instancetype)initWithDataProvider:(CGDataProviderRef)provider;
- (CFStringRef)getImageType;
@end

//******************************************************************************
//
// Copyright (c) 2016, Intel Corporation
// Copyright (c) 2016 Microsoft Corporation. All rights reserved.
//
// This code is licensed under the MIT License (MIT).
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
//
//******************************************************************************
#pragma once

#import <Foundation/NSObject.h>
#import <CoreFoundation/CFData.h>
#import <CoreFoundation/CFURL.h>
#import <CoreGraphics/CoreGraphicsExport.h>

@class NSData;

@interface ImageSource : NSObject
@property (nonatomic) NSData *data;
- (instancetype)initWithData:(CFDataRef)data;
- (instancetype)initWithURL:(CFURLRef)url;
- (instancetype)initWithDataProvider:(CGDataProviderRef)provider;
- (CFStringRef)getImageType;
@end

Fix ApiAnalyzer complaints about ImageIO headers.


/*
 * waysome - wayland based window manager
 *
 * Copyright in alphabetical order:
 *
 * Copyright (C) 2014-2015 Julian Ganz
 * Copyright (C) 2014-2015 Manuel Messner
 * Copyright (C) 2014-2015 Marcel Müller
 * Copyright (C) 2014-2015 Matthias Beyer
 * Copyright (C) 2014-2015 Nadja Sommerfeld
 *
 * This file is part of waysome.
 *
 * waysome is free software: you can redistribute it and/or modify it under the
 * terms of the GNU Lesser General Public License as published by the Free
 * Software Foundation, either version 2.1 of the License, or (at your option)
 * any later version.
 *
 * waysome is distributed in the hope that it will be useful, but WITHOUT ANY
 * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
 * A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
 * details.
 *
 * You should have received a copy of the GNU Lesser General Public License
 * along with waysome. If not, see <http://www.gnu.org/licenses/>.
 */

/**
 * @addtogroup serializer_module "Serializer module"
 *
 * @{
 */

/**
 * @addtogroup serializer_module_json_backend "Serializer JSON backend"
 *
 * @{
 */

/**
 * @addtogroup serializer_module_json_backend_deser "JSON backend deserializer"
 *
 * Serializer module JSON backend private utilities
 *
 * @{
 */

#ifndef __WS_SERIALIZE_JSON_DESERIALIZER_STRING_JUMP_TAB_COMMON_H__
#define __WS_SERIALIZE_JSON_DESERIALIZER_STRING_JUMP_TAB_COMMON_H__

#include "serialize/json/states.h"

/**
 * Get the next state for the current state and a string
 */
enum json_backend_state
get_next_state_for_string(
    enum json_backend_state current,
    const unsigned char * str
);

#endif //__WS_SERIALIZE_JSON_DESERIALIZER_STRING_JUMP_TAB_COMMON_H__

/**
 * @}
 */

/**
 * @}
 */

/**
 * @}
 */

Add string jump state helper interface definition


/*

	Oxygen Toxicity Unit Calulation

*/

#include <math>

double otu_const(double time,
                 double o2_ratio)

{
	double otu = 0.0;

	otu = time * pow(( 0.5 / (o2_ratio - 0.5)), (-5/6));

	return (otu);
}

double otu_descend(double time,
                   double o2_ratio_i,
                   double o2_ratio_f)
{
	double otu = 0.0;

	otu = ((3/11)*time)/(o2_ratio_f-o2_ratio_i)*((pow((o2_ratio_f - 0.5)/0.5),11/6) - pow((o2_ratio_i - 0.5)/0.5, 11/6));

	return otu;
}

Add the calculations for the Oxygen Toxicity Unit


// =============================================================================
// PROJECT CHRONO - http://projectchrono.org
//
// Copyright (c) 2014 projectchrono.org
// All right 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.
//
// =============================================================================
// Authors: Radu Serban
// =============================================================================
//
// Base class for a single road wheel (template definition).
// A single road wheel is of type LATERAL_PIN.
//
// =============================================================================

#ifndef CH_SINGLE_ROAD_WHEEL_H
#define CH_SINGLE_ROAD_WHEEL_H

#include "chrono_vehicle/ChApiVehicle.h"
#include "chrono_vehicle/ChSubsysDefs.h"

#include "chrono_vehicle/tracked_vehicle/ChRoadWheel.h"

namespace chrono {
namespace vehicle {

///
///
///
class CH_VEHICLE_API ChSingleRoadWheel : public ChRoadWheel {
  public:
    ChSingleRoadWheel(const std::string& name  ///< [in] name of the subsystem
                      );

    virtual ~ChSingleRoadWheel() {}

    /// Return the type of track shoe consistent with this road wheel.
    virtual TrackShoeType GetType() const override { return LATERAL_PIN; }

    /// Initialize this road wheel subsystem.
    virtual void Initialize(ChSharedPtr<ChBodyAuxRef> chassis,  ///< [in] handle to the chassis body
                            const ChVector<>& location          ///< [in] location relative to the chassis frame
                            ) override;

    /// Add visualization of the road wheel.
    /// This (optional) function should be called only after a call to Initialize().
    /// It renders the wheel as a textured cylinder.
    void AddWheelVisualization() override;

  protected:
    /// Return the width of the road wheel.
    virtual double GetWheelWidth() const = 0;
};

}  // end namespace vehicle
}  // end namespace chrono

#endif

Fix case of file name

Fix case of file name


/* Copyright © 2001-2014, Canal TP and/or its affiliates. All rights reserved.

This file is part of Navitia,
    the software to build cool stuff with public transport.

Hope you'll enjoy and contribute to this project,
    powered by Canal TP (www.canaltp.fr).
Help us simplify mobility and open public transport:
    a non ending quest to the responsive locomotion way of traveling!

LICENCE: 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/>.

Stay tuned using
twitter @navitia
IRC #navitia on freenode
https://groups.google.com/d/forum/navitia
www.navitia.io
*/
/**
 * this file provide a compatibility layer between zmq 2 and zmq 3
 * by providing a API similar to zmq 2
 */

#pragma once
#include <zmq.hpp>

#if ZMQ_VERSION_MAJOR >= 3
namespace zmq{
    void device(int, void *frontend, void *backend){
        zmq::proxy(frontend, backend, NULL);
    }
}

#endif

Add a compatibility layer for zmq 3

Add a compatibility layer for zmq 3


#include <Elementary.h>
#ifdef HAVE_CONFIG_H
# include "elementary_config.h"
#endif

EAPI int
elm_modapi_init(void *m)
{
   return 1; // succeed always
}

EAPI int
elm_modapi_shutdown(void *m)
{
   return 1; // succeed always
}

EAPI Eina_Bool
obj_hook(Evas_Object *obj)
{
   return EINA_TRUE;
}

EAPI Eina_Bool
obj_unhook(Evas_Object *obj)
{
   return EINA_TRUE;
}

EAPI Eina_Bool
obj_convert_geo_into_coord(const Evas_Object *obj, int zoom, double lon, double lat, int size, int *x, int *y)
{
   return EINA_FALSE;
}

EAPI Eina_Bool
obj_convert_coord_into_geo(const Evas_Object *obj, int zoom, int x, int y, int size, double *lon, double *lat)
{
   return EINA_FALSE;
}

EAPI char*
obj_url_request(Evas_Object *obj, int x, int y, int zoom)
{
   char buf[PATH_MAX];
   snprintf(buf, sizeof(buf), "http://tile.openstreetmap.org/%d/%d/%d.png",
            zoom, x, y);
   return strdup(buf);
}

#include <Elementary.h>
#ifdef HAVE_CONFIG_H
# include "elementary_config.h"
#endif

EAPI int
elm_modapi_init(void *m __UNUSED__)
{
   return 1; // succeed always
}

EAPI int
elm_modapi_shutdown(void *m __UNUSED__)
{
   return 1; // succeed always
}

EAPI Eina_Bool
obj_hook(Evas_Object *obj __UNUSED__)
{
   return EINA_TRUE;
}

EAPI Eina_Bool
obj_unhook(Evas_Object *obj __UNUSED__)
{
   return EINA_TRUE;
}

EAPI Eina_Bool
obj_convert_geo_into_coord(const Evas_Object *obj __UNUSED__, int zoom __UNUSED__, double lon __UNUSED__, double lat __UNUSED__, int size __UNUSED__, int *x __UNUSED__, int *y __UNUSED__)
{
   return EINA_FALSE;
}

EAPI Eina_Bool
obj_convert_coord_into_geo(const Evas_Object *obj __UNUSED__, int zoom __UNUSED__, int x __UNUSED__, int y __UNUSED__, int size __UNUSED__, double *lon __UNUSED__, double *lat __UNUSED__)
{
   return EINA_FALSE;
}

EAPI char*
obj_url_request(Evas_Object *obj __UNUSED__, int x, int y, int zoom)
{
   char buf[PATH_MAX];
   snprintf(buf, sizeof(buf), "http://tile.openstreetmap.org/%d/%d/%d.png",
            zoom, x, y);
   return strdup(buf);
}

Add UNUSED so we get a clean compile.

Add UNUSED so we get a clean compile.

SVN revision: 55786


//
//  GITPackFile.h
//  CocoaGit
//
//  Created by Geoffrey Garside on 05/08/2008.
//  Copyright 2008 ManicPanda.com. All rights reserved.
//

#import <Cocoa/Cocoa.h>

@interface GITPackFile : NSObject
{
    NSData * idxData;
    NSData * packData;

    NSString * idxPath;
    NSString * packPath;

    NSArray  * idxOffsets;

    NSUInteger idxVersion;
    NSUInteger packVersion;

    NSUInteger numberOfObjects;
}

@end

@property(readonly,copy) NSString * idxPath;
@property(readonly,copy) NSString * packPath;

//
//  GITPackFile.h
//  CocoaGit
//
//  Created by Geoffrey Garside on 05/08/2008.
//  Copyright 2008 ManicPanda.com. All rights reserved.
//

#import <Cocoa/Cocoa.h>

@interface GITPackFile : NSObject
{
    NSData * idxData;
    NSData * packData;

    NSString * idxPath;
    NSString * packPath;

    NSArray  * idxOffsets;

    NSUInteger idxVersion;
    NSUInteger packVersion;

    NSUInteger numberOfObjects;
}

@property(readonly,copy) NSString * idxPath;
@property(readonly,copy) NSString * packPath;
@property(readonly,assign) NSUInteger idxVersion;
@property(readonly,assign) NSUInteger packVersion;
@property(readonly,assign) NSUInteger numberOfObjects;

- (id)initWithPath:(NSString*)path;
- (void)setPackPath:(NSString*)path;
- (void)setIdxPath:(NSString*)path;
- (void)openIdxAndPackFiles;
- (void)readPack;
- (NSData*)objectAtOffset:(NSUInteger)offset;
- (NSData*)objectAtOffsetVersion1:(NSUInteger)offset;
- (NSData*)objectAtOffsetVersion2:(NSUInteger)offset;
- (void)readIdx;
- (NSData*)dataForSha1:(NSString*)sha1;
- (NSUInteger)offsetForSha1:(NSString*)sha1;

@end

Add more properties and methods to help with git-pack-inspect debugging


#include <stdio.h>
#include "m-string.h"
#include "m-dict.h"
#include "m-array.h"

/* Definition of an associative map string_t --> size_t */
DICT_DEF2(dict_str, string_t, size_t)
#define M_OPL_dict_str_t() DICT_OPLIST(dict_str, STRING_OPLIST, M_DEFAULT_OPLIST)

/* Definition of an array of string_t */
ARRAY_DEF(vector_str, string_t)
#define M_OPL_vector_str_t() ARRAY_OPLIST(vector_str, STRING_OPLIST)

int main(void)
{
    // Construct an array of string, performing a convertion of the C const char *
    // into a proper string_t at real time and push then into a dynamic array
    // that is declared, initialized and cleared.
    M_LET( (words, ("This"), ("is"), ("a"), ("useless"), ("sentence"), ("."),
                    ("It"), ("is"), ("used"), ("a"), ("bit"), ("to"), ("count"), ("words"), (".") ),
                    vector_str_t) {
        // Print the arrays.
        printf("The words are: ");
        vector_str_out_str(stdout, words);
        printf("\n");

        // Count the words.
        M_LET(map, dict_str_t) {
            // Count the words:
            for M_EACH(w, words, vector_str_t) {
                (*dict_str_get_at(map, *w)) ++;
            }

            // Print the count:
            for M_EACH(p, map, dict_str_t) {
                printf ("%zu occurences of %s\n", p->value, string_get_cstr(p->key));
            }
        }
    }
}

Add a new example of the new M_LET feature.


#include "val_interfaces.h"
#include "pal_mbed_os_crypto.h"
#include "lifecycle.h"

#ifdef ITS_TEST
void test_entry_s003(val_api_t *val_api, psa_api_t *psa_api);
#elif PS_TEST
#error [NOT_SUPPORTED] Test is too long for CI, thus always fails on timeout.
void test_entry_p003(val_api_t *val_api, psa_api_t *psa_api);
#endif

int main(void)
{
#ifdef ITS_TEST
    test_start(test_entry_s003);
#elif PS_TEST
    test_start(test_entry_p003);
#endif

}

#include "val_interfaces.h"
#include "pal_mbed_os_crypto.h"
#include "lifecycle.h"

#ifdef ITS_TEST
void test_entry_s003(val_api_t *val_api, psa_api_t *psa_api);
#elif PS_TEST
#ifndef PS_ALLOW_ENTIRE_STORAGE_FILL
#error [NOT_SUPPORTED] Test is too long for CI, thus always fails on timeout.
#endif
void test_entry_p003(val_api_t *val_api, psa_api_t *psa_api);
#endif

int main(void)
{
#ifdef ITS_TEST
    test_start(test_entry_s003);
#elif PS_TEST
    test_start(test_entry_p003);
#endif

}

Allow PS test03 with PS_ALLOW_ENTIRE_STORAGE_FILL flag


/*
  Mace - http://www.macehq.cx
  Copyright 1999-2004
  See the file README for more information
*/

#ifndef GLOBALS_H
#define GLOBALS_H

#ifndef _MaceTypes
#define _MaceTypes
typedef unsigned char U8;
typedef signed char S8;
typedef unsigned short U16;
typedef signed short S16;

//Note: on 64-bit machines, replace "long" with "int"
#if __LP64__
typedef unsigned int U32;
typedef signed int S32;
#else
typedef unsigned long U32;
typedef signed long S32;
#endif
#endif

void App_Exit(void);
 //Same as App_Exit2(), except that this calls setdis()
void App_Exit2(void);
U16 FlipW(U16 a);
U32 FlipL(U32 a);
void HexW (U16 n, char * String);
void HexL (U32 n, char * String);

#endif //GLOBALS_H

/*
  Mace - http://www.macehq.cx
  Copyright 1999-2004
  See the file README for more information
*/

#ifndef GLOBALS_H
#define GLOBALS_H

#ifndef _MaceTypes
#define _MaceTypes

#include <stdint.h>

typedef uint8_t U8;
typedef int8_t S8;
typedef uint16_t U16;
typedef int16_t S16;

typedef uint32_t U32;
typedef int32_t S32;
#endif

void App_Exit(void);
 //Same as App_Exit2(), except that this calls setdis()
void App_Exit2(void);
U16 FlipW(U16 a);
U32 FlipL(U32 a);
void HexW (U16 n, char * String);
void HexL (U32 n, char * String);

#endif //GLOBALS_H

Use C99 stdint.h header for types

Use C99 stdint.h header for types


#include "ecore_xcb_private.h"

EAPI Eina_Bool
ecore_x_input_multi_select(Ecore_X_Window win)
{
    return 0;
}

EAPI void
ecore_x_e_comp_sync_counter_set(Ecore_X_Window win, Ecore_X_Sync_Counter counter)
{
}

EAPI void
ecore_x_e_comp_sync_draw_done_send(Ecore_X_Window root, Ecore_X_Window win)
{
}

EAPI Eina_Bool
ecore_x_e_comp_sync_supported_get(Ecore_X_Window root)
{
    return 0;
}

#include "ecore_xcb_private.h"

EAPI void
ecore_x_icccm_protocol_atoms_set(Ecore_X_Window win, Ecore_X_Atom *protos, int num)
{
}

EAPI Eina_Bool
ecore_x_input_multi_select(Ecore_X_Window win)
{
    return 0;
}

EAPI void
ecore_x_e_comp_sync_counter_set(Ecore_X_Window win, Ecore_X_Sync_Counter counter)
{
}

EAPI void
ecore_x_e_comp_sync_draw_done_send(Ecore_X_Window root, Ecore_X_Window win)
{
}

EAPI Eina_Bool
ecore_x_e_comp_sync_supported_get(Ecore_X_Window root)
{
    return 0;
}

Add one more missing function stub

Add one more missing function stub


// RUN: clang -### -S -x c /dev/null -fblocks -fbuiltin -fmath-errno -fcommon -fpascal-strings -fno-blocks -fno-builtin -fno-math-errno -fno-common -fno-pascal-strings -fblocks -fbuiltin -fmath-errno -fcommon -fpascal-strings %s 2> %t
// RUN: grep -F '"-fblocks"' %t
// RUN: grep -F '"-fpascal-strings"' %t
// RUN: clang -### -S -x c /dev/null -fblocks -fbuiltin -fmath-errno -fcommon -fpascal-strings -fno-blocks -fno-builtin -fno-math-errno -fno-common -fno-pascal-strings -fno-show-source-location -fshort-wchar %s 2> %t
// RUN: grep -F '"-fno-builtin"' %t
// RUN: grep -F '"-fno-common"' %t
// RUN: grep -F '"-fno-math-errno"' %t
// RUN: grep -F '"-fno-show-source-location"' %t
// RUN: grep -F '"-fshort-wchar"' %t
// RUN: clang -fshort-enums -x c /dev/null 2>&1 | FileCheck -check-prefix=CHECK-SHORT-ENUMS %s

// CHECK-SHORT-ENUMS: compiler does not support '-fshort-enums'

// RUN: clang -### -S -x c /dev/null -fblocks -fbuiltin -fmath-errno -fcommon -fpascal-strings -fno-blocks -fno-builtin -fno-math-errno -fno-common -fno-pascal-strings -fblocks -fbuiltin -fmath-errno -fcommon -fpascal-strings %s 2>&1 | FileCheck -check-prefix=CHECK-OPTIONS1 %s
// RUN: clang -### -S -x c /dev/null -fblocks -fbuiltin -fmath-errno -fcommon -fpascal-strings -fno-blocks -fno-builtin -fno-math-errno -fno-common -fno-pascal-strings -fno-show-source-location -fshort-wchar %s 2>&1 | FileCheck -check-prefix=CHECK-OPTIONS2 %s
// RUN: clang -fshort-enums -x c /dev/null 2>&1 | FileCheck -check-prefix=CHECK-SHORT-ENUMS %s

// CHECK-OPTIONS1: -fblocks
// CHECK-OPTIONS1: -fpascal-strings

// CHECK-OPTIONS2: -fno-builtin
// CHECK-OPTIONS2: -fno-common
// CHECK-OPTIONS2: -fno-math-errno
// CHECK-OPTIONS2: -fno-show-source-location
// CHECL-OPTIONS2: -fshort-wchar

// CHECK-SHORT-ENUMS: compiler does not support '-fshort-enums'

Convert the remainder of this test case over to using FileCheck.

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


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

#include "nrf51.h"
#include "nrf_delay.h"

#include "error.h"
#include "gpio.h"
#include "leds.h"
#include "radio.h"

void error_handler(uint32_t err_code, uint32_t line_num, char * file_name)
{
    while (1)
    {
        for (uint8_t i = LED_START; i < LED_STOP; i++)
        {
            led_toggle(i);
            nrf_delay_us(50000);
        }
    }
}
void radio_evt_handler(radio_evt_t * evt)
{

}

int main(void)
{
    uint8_t i = 0;
    uint32_t err_code;

    leds_init();

    radio_packet_t packet;
    packet.len = 4;
    packet.flags.ack = 0;

    radio_init(radio_evt_handler);

    while (1)
    {
        packet.data[0] = i++;
        packet.data[1] = 0x12;
        err_code = radio_send(&packet);
        ASSUME_SUCCESS(err_code);

        led_toggle(LED0);
        nrf_delay_us(1000000);
    }
}

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

#include "nrf51.h"
#include "nrf_delay.h"

#include "error.h"
#include "gpio.h"
#include "leds.h"
#include "radio.h"

void error_handler(uint32_t err_code, uint32_t line_num, char * file_name)
{
    while (1)
    {
        for (uint8_t i = LED_START; i < LED_STOP; i++)
        {
            led_toggle(i);
            nrf_delay_us(50000);
        }
    }
}
void radio_evt_handler(radio_evt_t * evt)
{

}

int main(void)
{
    uint8_t i = 0;
    uint32_t err_code;

    leds_init();

    radio_packet_t packet;
    packet.len = 4;
    packet.flags.ack = 0;

    radio_init(radio_evt_handler);

    while (1)
    {
        packet.data[0] = i++;
        packet.data[1] = 0x12;
        err_code = radio_send(&packet);
        ASSUME_SUCCESS(err_code);

        packet.data[0] = i++;
        packet.data[1] = 0x12;
        err_code = radio_send(&packet);
        ASSUME_SUCCESS(err_code);

        led_toggle(LED0);
        nrf_delay_us(1000000);
    }
}

Send two packet at once.

Send two packet at once.


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

#ifndef BITCOIN_CONSENSUS_AMOUNT_H
#define BITCOIN_CONSENSUS_AMOUNT_H

#include <cstdint>

/** Amount in satoshis (Can be negative) */
typedef int64_t CAmount;

static constexpr CAmount COIN = 100000000;

/** No amount larger than this (in satoshi) is valid.
 *
 * Note that this constant is *not* the total money supply, which in Bitcoin
 * currently happens to be less than 21,000,000 BTC for various reasons, but
 * rather a sanity check. As this sanity check is used by consensus-critical
 * validation code, the exact value of the MAX_MONEY constant is consensus
 * critical; in unusual circumstances like a(nother) overflow bug that allowed
 * for the creation of coins out of thin air modification could lead to a fork.
 * */
static constexpr CAmount MAX_MONEY = 21000000 * COIN;
inline bool MoneyRange(const CAmount& nValue) { return (nValue >= 0 && nValue <= MAX_MONEY); }

#endif //  BITCOIN_CONSENSUS_AMOUNT_H

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

#ifndef BITCOIN_CONSENSUS_AMOUNT_H
#define BITCOIN_CONSENSUS_AMOUNT_H

#include <cstdint>

/** Amount in satoshis (Can be negative) */
typedef int64_t CAmount;

/** The amount of satoshis in one BTC. */
static constexpr CAmount COIN = 100000000;

/** No amount larger than this (in satoshi) is valid.
 *
 * Note that this constant is *not* the total money supply, which in Bitcoin
 * currently happens to be less than 21,000,000 BTC for various reasons, but
 * rather a sanity check. As this sanity check is used by consensus-critical
 * validation code, the exact value of the MAX_MONEY constant is consensus
 * critical; in unusual circumstances like a(nother) overflow bug that allowed
 * for the creation of coins out of thin air modification could lead to a fork.
 * */
static constexpr CAmount MAX_MONEY = 21000000 * COIN;
inline bool MoneyRange(const CAmount& nValue) { return (nValue >= 0 && nValue <= MAX_MONEY); }

#endif //  BITCOIN_CONSENSUS_AMOUNT_H

Add comment to COIN constant.

Add comment to COIN constant.

The COIN constant is critical in understanding Bitcoin's supply, but what it represents isn't clear from the name of the constant. Adding a comment clarifies the meaning of the constant for future readers.


#define DC_BASE_MODE_OFF       0
#define DC_BASE_MODE_NO_GYRO   1
#define DC_BASE_MODE_GYRO      2
#define DC_BASE_MODE_OVER      3

const string dc_base_mode_names[] = {"    OFF", "NO GYRO", "   GYRO"};
int dc_base_mode = DC_BASE_MODE_GYRO;
void dc_base_mode_next(void);

#define DC_SHOOTER_MODE_NONE   0
#define DC_SHOOTER_MODE_DIRECT 1
#define DC_SHOOTER_MODE_SLIP   2
#define DC_SHOOTER_MODE_KICKER 3
#define DC_SHOOTER_MODE_OVER   4

const string dc_shooter_mode_names[] = {"NONE  ", "DIRECT", "SLIP  ", "KICKER"};
int dc_shooter_mode = DC_SHOOTER_MODE_NONE;
void dc_shooter_mode_next(void);

#define DC_BASE_MODE_OFF       0
#define DC_BASE_MODE_NO_GYRO   1
#define DC_BASE_MODE_GYRO      2
#define DC_BASE_MODE_OVER      3

const string dc_base_mode_names[] = {"    OFF", "NO GYRO", "   GYRO"};
int dc_base_mode = DC_BASE_MODE_GYRO;
void dc_base_mode_next(void);

#define DC_SHOOTER_MODE_NONE   0
#define DC_SHOOTER_MODE_DIRECT 1
#define DC_SHOOTER_MODE_SLIP   2
#define DC_SHOOTER_MODE_KICKER 3
#define DC_SHOOTER_MODE_OVER   4

const string dc_shooter_mode_names[] = {"NONE  ", "DIRECT", "SLIP  ", "KICKER"};
int dc_shooter_mode = DC_SHOOTER_MODE_DIRECT; // mode on startup
void dc_shooter_mode_next(void);

Switch to direct drive on startup

Switch to direct drive on startup


#ifndef NUMBA_PY_MODULE_H_
#define NUMBA_PY_MODULE_H_

#define PY_SSIZE_T_CLEAN

#include <Python.h>
#include <structmember.h>
#include <frameobject.h>

#define MOD_ERROR_VAL NULL
#define MOD_SUCCESS_VAL(val) val
#define MOD_INIT(name) PyMODINIT_FUNC PyInit_##name(void)
#define MOD_DEF(ob, name, doc, methods) { \
        static struct PyModuleDef moduledef = { \
          PyModuleDef_HEAD_INIT, name, doc, -1, methods, NULL, NULL, NULL, NULL }; \
        ob = PyModule_Create(&moduledef); }
#define MOD_INIT_EXEC(name) PyInit_##name();

#define PyString_AsString PyUnicode_AsUTF8
#define PyString_Check PyUnicode_Check
#define PyString_FromFormat PyUnicode_FromFormat
#define PyString_FromString PyUnicode_FromString
#define PyString_InternFromString PyUnicode_InternFromString
#define PyInt_Type PyLong_Type
#define PyInt_Check PyLong_Check
#define PyInt_CheckExact PyLong_CheckExact

#define PyMem_RawMalloc malloc
#define PyMem_RawRealloc realloc
#define PyMem_RawFree free

#endif /* NUMBA_PY_MODULE_H_ */

#ifndef NUMBA_PY_MODULE_H_
#define NUMBA_PY_MODULE_H_

#define PY_SSIZE_T_CLEAN

#include <Python.h>
#include <structmember.h>
#include <frameobject.h>

#define MOD_ERROR_VAL NULL
#define MOD_SUCCESS_VAL(val) val
#define MOD_INIT(name) PyMODINIT_FUNC PyInit_##name(void)
#define MOD_DEF(ob, name, doc, methods) { \
        static struct PyModuleDef moduledef = { \
          PyModuleDef_HEAD_INIT, name, doc, -1, methods, NULL, NULL, NULL, NULL }; \
        ob = PyModule_Create(&moduledef); }
#define MOD_INIT_EXEC(name) PyInit_##name();

#define PyString_AsString PyUnicode_AsUTF8
#define PyString_Check PyUnicode_Check
#define PyString_FromFormat PyUnicode_FromFormat
#define PyString_FromString PyUnicode_FromString
#define PyString_InternFromString PyUnicode_InternFromString
#define PyInt_Type PyLong_Type
#define PyInt_Check PyLong_Check
#define PyInt_CheckExact PyLong_CheckExact

#endif /* NUMBA_PY_MODULE_H_ */

Remove accidental definitions of MyMem_*

These were guarded to only be defined on Python < 3.4.

This should fix test_snapshot on the 32-bit build.


/**
 * \file fixed_point.h
 *
 *
 *
 * \author Ethan Burns
 * \date 2009-01-16
 */

#include "stdint.h"

#include <limits>

/* The type of a fixed point value.  This should never be larger than
 * the size of the type for the 'value' field in the AtomicInt
 * class. */
typedef unsigned long fp_type;

#define fp_sqrt2 14142
#define fp_one 10000
#define fp_infinity (numeric_limits<fp_type>::max())

/**
 * \file fixed_point.h
 *
 *
 *
 * \author Ethan Burns
 * \date 2009-01-16
 */

#include "stdint.h"

#include <limits>

/* The type of a fixed point value.  This should never be larger than
 * the size of the type for the 'value' field in the AtomicInt
 * class. */
typedef unsigned long fp_type;

#define fp_sqrt2 1414
#define fp_one 1000
#define fp_infinity (numeric_limits<fp_type>::max())

Use 3 decimal places, the sun uses 32-bit fp_type which chokes with 4.