/* Copyright (C) 2005 Free Software Foundation, Inc.
   This file is part of the GNU C Library.

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

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

   You should have received a copy of the GNU Lesser General Public
   License along with the GNU C Library; if not, write to the Free
   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
   02111-1307 USA.  */

#include <string.h>

libc_hidden_proto(bzero)

/* Clear memory.  Can't alias to bzero because it's not defined in the
   same translation unit.  */
void
__aeabi_memclr (void *dest, size_t n)
{
  bzero (dest, n);
}

/* Versions of the above which may assume memory alignment.  */
strong_alias (__aeabi_memclr, __aeabi_memclr4)
strong_alias (__aeabi_memclr, __aeabi_memclr8)

/* Copyright (C) 2005 Free Software Foundation, Inc.
   This file is part of the GNU C Library.

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

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

   You should have received a copy of the GNU Lesser General Public
   License along with the GNU C Library; if not, write to the Free
   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
   02111-1307 USA.  */

#include <string.h>

libc_hidden_proto(memset)

/* Clear memory.  Can't alias to bzero because it's not defined in the
   same translation unit.  */
void
__aeabi_memclr (void *dest, size_t n)
{
  memset (dest, 0, n);
}

/* Versions of the above which may assume memory alignment.  */
strong_alias (__aeabi_memclr, __aeabi_memclr4)
strong_alias (__aeabi_memclr, __aeabi_memclr8)

Use memset instead of bzero

Use memset instead of bzero


#ifndef CC_ANALYSIS_ANALYSIS_OPTIONS_H_
#define CC_ANALYSIS_ANALYSIS_OPTIONS_H_

#include <cstddef>

struct AnalysisOptions {
    AnalysisOptions() :
        destutter_max_consecutive(3),
        replace_html_entities(true)
    {}

    // Preprocessing.
    size_t destutter_max_consecutive;

    // Tokenization.
    bool replace_html_entities;
};

#endif  // CC_ANALYSIS_ANALYSIS_OPTIONS_H_

#ifndef CC_ANALYSIS_ANALYSIS_OPTIONS_H_
#define CC_ANALYSIS_ANALYSIS_OPTIONS_H_

#include <cstddef>

struct AnalysisOptions {
    AnalysisOptions() :
        track_index_translation(true),
        destutter_max_consecutive(3),
        track_chr2drop(true),
        replace_html_entities(true)
    {}

    // General flags:
    // * Map tokens to spans in the original text.
    bool track_index_translations;

    // Preprocessing flags:
    // * Maximum number of consecutive code points before we start dropping them.
    // * Whether to keep track of code point drop counts from destuttering.
    size_t destutter_max_consecutive;
    bool track_chr2drop;

    // Tokenization flags:
    // * Whether to replace HTML entities in the text with their Unicode
    //   equivalents.
    bool replace_html_entities;
};

#endif  // CC_ANALYSIS_ANALYSIS_OPTIONS_H_

Add track_* flags to analysis options to let caller strip it down.


#include <iconv.h>

#ifdef WIN32
typedef const char ** readstat_iconv_inbuf_t;
#else
typedef char ** readstat_iconv_inbuf_t;
#endif

typedef struct readstat_charset_entry_s {
    int     code;
    char    name[32];
} readstat_charset_entry_t;

#include <iconv.h>

#ifdef WINICONV_CONST
typedef const char ** readstat_iconv_inbuf_t;
#else
typedef char ** readstat_iconv_inbuf_t;
#endif

typedef struct readstat_charset_entry_s {
    int     code;
    char    name[32];
} readstat_charset_entry_t;

Fix iconv warnings on MinGW

Fix iconv warnings on MinGW


// Author: Hong Jen-Yee (PCMan) (pcman.hong@appier.com)

#ifndef __libredisCluster_adapters_libuvadapter_h__
#define __libredisCluster_adapters_libuvadapter_h__

#include "adapter.h"  // for Adapter

extern "C"
{
#include <hiredis/adapters/libuv.h>  // for redisLibeventAttach()
}

namespace RedisCluster
{
    // Wrap hiredis libuv adapter.
    class LibUvAdapter : public Adapter
    {
    public:
        explicit LibUvAdapter( uv_loop_t* loop = uv_default_loop() ) : loop_( loop ) {}
        virtual ~LibUvAdapter() {}

    public:
        virtual int attachContext( redisAsyncContext &ac ) override
        {
            return redisLibuvAttach( &ac, loop_ );
        }

    private:
        uv_loop_t* loop_;
    };  // class Adapter
}  // namespace RedisCluster

#endif  // __libredisCluster_adapters_libuvadapter_h__

Add hiredis libuv adapter support.

Add hiredis libuv adapter support.


/*
 * Copyright (c) 2017, NXP
 *
 * SPDX-License-Identifier: Apache-2.0
 */

#ifndef ZEPHYR_INCLUDE_DT_BINDINGS_CLOCK_KINETIS_SIM_H_
#define ZEPHYR_INCLUDE_DT_BINDINGS_CLOCK_KINETIS_SIM_H_

#define KINETIS_SIM_CORESYS_CLK		0
#define KINETIS_SIM_PLATFORM_CLK	1
#define KINETIS_SIM_BUS_CLK		2
#define KINETIS_SIM_LPO_CLK		19

#endif /* ZEPHYR_INCLUDE_DT_BINDINGS_CLOCK_KINETIS_SIM_H_ */

/*
 * Copyright (c) 2017, NXP
 *
 * SPDX-License-Identifier: Apache-2.0
 */

#ifndef ZEPHYR_INCLUDE_DT_BINDINGS_CLOCK_KINETIS_SIM_H_
#define ZEPHYR_INCLUDE_DT_BINDINGS_CLOCK_KINETIS_SIM_H_

#define KINETIS_SIM_CORESYS_CLK		0
#define KINETIS_SIM_PLATFORM_CLK	1
#define KINETIS_SIM_BUS_CLK		2
#define KINETIS_SIM_FAST_PERIPHERAL_CLK	5
#define KINETIS_SIM_LPO_CLK		19

#endif /* ZEPHYR_INCLUDE_DT_BINDINGS_CLOCK_KINETIS_SIM_H_ */

clock_control: Add support for fast peripheral clock in mcux sim driver

Adds support for getting the fast peripheral clock frequency in the mcux
sim driver.

Signed-off-by: Filip Brozovic <9e406e4eada0a466898ca20f2c830a2e8d7bc324@gmail.com>


#ifndef _WISH_PROMPT
#define _WISH_PROMPT

/*
 * The wish shell prompt has its own format characters, much like how bash,
 * zsh, fish, and ksh all have their own formatting characters.
 *
 * %u       - The username of the current user
 * %h       - The hostname
 * %d~n     - The top n levels of the working directory. If n is not provided
 *            then the entire working directory is displayed. (i.e. %d, %d~2)
 *            This assumes that 0 <= n <= 9.
 * %t       - The time in 24 hour format
 * %T       - The time in 12 hour (AM/PM) format
 * %%       - The percent symbol
 *
 *
 * NOTES:
 *
 * If there is a % at the end of the prompt, it will be implied that it is %%.
 * An unrecognized formatting character will be interpretted literally.
 */

char *PROMPT;

char *get_format_substitution(char *prompt_var);

void load_prompt_defaults();
void load_prompt_config();
void prompt(char *current_working_dir);

#endif

#ifndef HOST_NAME_MAX
#define HOST_NAME_MAX 255
#endif

Fix HOST_NAME_MAX not found error on Mac OSX. POSIX compliance pls.


#ifndef HAL2_H
#define HAL2_H

// Mechanical constants

extern int const MAIN_MOTOR_PWM_TOP = 255;
extern int const MAIN_MOTOR_BRAKE_SPEED = 120;
extern int const MAIN_MOTOR_MIN_SPEED = 150;
extern int const MAIN_MOTOR_MED_SPEED = 254;
extern int const MAIN_MOTOR_MAX_SPEED = 255;
extern int const MAGNET_OPEN_WAIT = 5;		// 10ths of a second

void init(void);

void main_motor_stop();
void main_motor_cw_open(uint8_t speed);
void main_motor_ccw_close(uint8_t speed);
void set_main_motor_speed(int speed);
int get_main_motor_speed();
void aux_motor_stop();
void aux_motor_cw_close();
void aux_motor_ccw_open();
void magnet_off();
void magnet_on();
bool door_nearly_open();
bool door_fully_open();
bool door_fully_closed();

bool sensor_proximity();
bool button_openclose();
bool button_stop();
bool main_encoder();
bool aux_outdoor_limit();
bool aux_indoor_limit();
bool door_nearly_closed();
bool aux_encoder();

#endif

#ifndef HAL2_H
#define HAL2_H

// Mechanical constants

extern int const MAIN_MOTOR_PWM_TOP = 255;
extern int const MAIN_MOTOR_BRAKE_SPEED = 120;
extern int const MAIN_MOTOR_MIN_SPEED = 150;
extern int const MAIN_MOTOR_MED_SPEED = 254;
extern int const MAIN_MOTOR_MAX_SPEED = 255;
extern int const MAGNET_OPEN_WAIT = 5;		// 10ths of a second

void init(void);

void main_motor_stop();
void main_motor_cw_open(uint8_t speed);
void main_motor_ccw_close(uint8_t speed);
void aux_motor_stop();
void aux_motor_cw_close();
void aux_motor_ccw_open();
void magnet_off();
void magnet_on();
bool door_nearly_open();
bool door_fully_open();
bool door_fully_closed();

bool sensor_proximity();
bool button_openclose();
bool button_stop();
bool main_encoder();
bool aux_outdoor_limit();
bool aux_indoor_limit();
bool door_nearly_closed();
bool aux_encoder();

#endif

Remove functions that are private.

Remove functions that are private.


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

#include "api.h"
#include "lib/math.c"
#include "lib/test.c"

static jack_state_t* state;

static intptr_t jack_fib(intptr_t n) {
  jack_new_integer(state, n);
  jack_function_call(state, 1, 1);
  return jack_get_integer(state, -1);
}

int main() {
  for (int j = 0; j < 0x1; ++j) {

    state = jack_new_state(15);
    jack_call(state, jack_math, 0);
    jack_map_get_symbol(state, -1, "fib");
    jack_new_list(state);
    // 1 - fib
    // 2 - list

    for (intptr_t i = 0; i <= 91; ++i) {
      printf("fib(%ld) = %ld\n", i, jack_fib(i));
      jack_list_push(state, 2);
    }
    jack_dump_state(state);

    jack_free_state(state);
  }
  return 0;
}

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

#include "api.h"
#include "lib/math.c"
#include "lib/test.c"

static jack_state_t* state;

static intptr_t jack_fib(intptr_t n) {
  jack_new_integer(state, n);
  jack_function_call(state, 1, 1);
  return jack_get_integer(state, -1);
}

int main() {
  state = jack_new_state(20);
  jack_call(state, jack_math, 0);
  jack_map_get_symbol(state, -1, "fib");
  jack_new_list(state);
  // 1 - fib
  // 2 - list

  for (int j = 0; j < 0x10000; ++j) {

    printf("Generation %d\n", j);
    for (intptr_t i = 0; i <= 91; ++i) {
      jack_fib(i);
      // printf("fib(%ld) = %ld\n", i, jack_fib(i));
      jack_pop(state);
      // jack_list_push(state, 2);
    }

  }
  jack_dump_state(state);
  jack_free_state(state);
  return 0;
}

Tweak for benchmark. fib(0-91) 1987925/second


#include <systemlib/param/param.h>

/*PARAM_DEFINE_FLOAT(NAME,0.0f);*/
PARAM_DEFINE_FLOAT(KF_V_GYRO, 1.0f);
PARAM_DEFINE_FLOAT(KF_V_ACCEL, 1.0f);
PARAM_DEFINE_FLOAT(KF_R_MAG, 1.0f);
PARAM_DEFINE_FLOAT(KF_R_GPS_VEL, 1.0f);
PARAM_DEFINE_FLOAT(KF_R_GPS_POS, 5.0f);
PARAM_DEFINE_FLOAT(KF_R_GPS_ALT, 5.0f);
PARAM_DEFINE_FLOAT(KF_R_PRESS_ALT, 0.1f);
PARAM_DEFINE_FLOAT(KF_R_ACCEL, 1.0f);
PARAM_DEFINE_FLOAT(KF_FAULT_POS, 10.0f);
PARAM_DEFINE_FLOAT(KF_FAULT_ATT, 10.0f);
PARAM_DEFINE_FLOAT(KF_ENV_G, 9.765f);
PARAM_DEFINE_FLOAT(KF_ENV_MAG_DIP, 60.0f);
PARAM_DEFINE_FLOAT(KF_ENV_MAG_DEC, 0.0f);

#include <systemlib/param/param.h>

/*PARAM_DEFINE_FLOAT(NAME,0.0f);*/
PARAM_DEFINE_FLOAT(KF_V_GYRO, 0.008f);
PARAM_DEFINE_FLOAT(KF_V_ACCEL, 1.0f);
PARAM_DEFINE_FLOAT(KF_R_MAG, 1.0f);
PARAM_DEFINE_FLOAT(KF_R_GPS_VEL, 1.0f);
PARAM_DEFINE_FLOAT(KF_R_GPS_POS, 5.0f);
PARAM_DEFINE_FLOAT(KF_R_GPS_ALT, 5.0f);
PARAM_DEFINE_FLOAT(KF_R_PRESS_ALT, 0.1f);
PARAM_DEFINE_FLOAT(KF_R_ACCEL, 1.0f);
PARAM_DEFINE_FLOAT(KF_FAULT_POS, 10.0f);
PARAM_DEFINE_FLOAT(KF_FAULT_ATT, 10.0f);
PARAM_DEFINE_FLOAT(KF_ENV_G, 9.765f);
PARAM_DEFINE_FLOAT(KF_ENV_MAG_DIP, 60.0f);
PARAM_DEFINE_FLOAT(KF_ENV_MAG_DEC, 0.0f);

Fix gyro measurement noise variance

Fix gyro measurement noise variance


#include <stdio.h>
#include <stdlib.h>
#include <assert.h>
#include <arpa/inet.h>
#include "idx.h"

int main(int argc, char **argv){
   if(argc<2){
      printf("Usage: \n");
      printf("readlabels t10k-labels-idx1-ubyte \n");
      exit(1);
   }

   char *slabelfname = argv[1];

   IDX1_DATA idxdata;
   if(!fread_idx1_file( slabelfname, &idxdata)){
      printf("The datafile '%s' is not a valid IDX_1 file.\n", slabelfname);
      exit(2);
   }
   //printf("Length: %d\n", idxdata.length);
   int i;
   for(i=0;i<idxdata.length;i++){
//      printf("DATA[%05d] = %02d\n", i, idxdata.data[i]);
      printf("%d\n", idxdata.data[i]);
   }

   return 0;
}

#include <stdio.h>
#include <stdlib.h>
#include <assert.h>
#include <arpa/inet.h>
#include "idx.h"

int main(int argc, char **argv){
   if(argc<2){
      printf("Usage: \n");
      printf("readimages t10k-images-idx3-ubyte \n");
      exit(1);
   }

   char *slabelfname = argv[1];

   IDX3_DATA idxdata;
   if(!fread_idx3_file( slabelfname, &idxdata)){
      printf("The datafile '%s' is not a valid IDX3 file.\n", slabelfname);
      exit(2);
   }
   //printf("Length: %d\n", idxdata.length);

   int i;
   int x;
   int y;
   int ibase;
   int rbase;
   unsigned char pxl;
   for(i=0;i<idxdata.nimages;i++){
      ibase = i * idxdata.nrows * idxdata.ncols;
      printf("Image %05d ( %010d ):\n", i + 1, ibase);
      for(y=0;y<idxdata.nrows;y++){
         rbase = ibase + y*idxdata.ncols;
         for(x=0;x<idxdata.ncols;x++){
            //      printf("DATA[%05d] = %02d\n", i, idxdata.data[i]);
            pxl = idxdata.data[ rbase + x ];
            if(pxl){
               printf("%02X", pxl);
            }else{
               printf("  ");
            }
         }
         printf("\n");
      }
      printf("========================================================\n");
   }

   return 0;
}

Implement a simple ASCII text image dumper.


#ifndef UDBM_STUBS_H_
#define UDBM_STUBS_H_

#include <vector>

typedef std::vector<int> carray_t;
#define get_cvector(x) ((carray_t*)Data_custom_val(x))

#define get_dbm_ptr(x) static_cast<dbm_t*>(Data_custom_val(x))

#endif  // UDBM_STUBS_H_

#ifndef UDBM_STUBS_H_
#define UDBM_STUBS_H_

#include <vector>

typedef std::vector<int> carray_t;
#define get_cvector(x) ((carray_t*)Data_custom_val(x))

#define get_dbm_ptr(x) static_cast<dbm_t*>(Data_custom_val(x))

bool
dbm_closure_leq(const raw_t * const dr1, const raw_t * const dr2, cindex_t dim,
                const std::vector<int> &lbounds, const std::vector<int> &ubounds);

#endif  // UDBM_STUBS_H_

Make closure inclusion test visible (to be used from the priced zone part).


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

#ifndef GENERIC_FUNCDRIVER_H
#define GENERIC_FUNCDRIVER_H

#include "subsys/ChDriver.h"

class Generic_FuncDriver : public chrono::ChDriver
{
public:

  Generic_FuncDriver() {}
  ~Generic_FuncDriver() {}

  virtual void Update(double time)
  {
    if (time < 0.5)
      m_throttle = 0;
    else if (time < 1.5)
      m_throttle = 0.4 * (time - 0.5);
    else
      m_throttle = 0.4;

    if (time < 4)
      m_steering = 0;
    else if (time < 6)
      m_steering = 0.25 * (time - 4);
    else if (time < 10)
      m_steering = -0.25 * (time - 6) + 0.5;
    else
      m_steering = -0.5;
  }
};

#endif

Add a generic driver model.

Add a generic driver model.


#pragma once

#include "tock.h"

#ifdef __cplusplus
extern "C" {
#endif

#define DRIVER_NUM_NONVOLATILE_STORAGE 0x1b

int nonvolatile_storage_internal_read_done_subscribe(subscribe_cb cb, void *userdata);
int nonvolatile_storage_internal_write_done_subscribe(subscribe_cb cb, void *userdata);

int nonvolatile_storage_internal_read_buffer(uint8_t* buffer, uint32_t len);
int nonvolatile_storage_internal_write_buffer(uint8_t* buffer, uint32_t len);

int nonvolatile_storage_internal_get_number_bytes(void);
int nonvolatile_storage_internal_read(uint32_t offset, uint32_t length);
int nonvolatile_storage_internal_write(uint32_t offset, uint32_t length);

#ifdef __cplusplus
}
#endif

#pragma once

#include "tock.h"

#define DRIVER_NUM_NONVOLATILE_STORAGE 0x50001

#ifdef __cplusplus
extern "C" {
#endif

int nonvolatile_storage_internal_read_done_subscribe(subscribe_cb cb, void *userdata);
int nonvolatile_storage_internal_write_done_subscribe(subscribe_cb cb, void *userdata);

int nonvolatile_storage_internal_read_buffer(uint8_t* buffer, uint32_t len);
int nonvolatile_storage_internal_write_buffer(uint8_t* buffer, uint32_t len);

int nonvolatile_storage_internal_get_number_bytes(void);
int nonvolatile_storage_internal_read(uint32_t offset, uint32_t length);
int nonvolatile_storage_internal_write(uint32_t offset, uint32_t length);

#ifdef __cplusplus
}
#endif

Revert "weird issue where flash only works when DRIVER_NUM set to 27, hardcoded somewhere?"

This reverts commit 3431f4ed857afb9376a120334e1521aa9a71d483.


#include <stdio.h>
#include <string.h>
#include <stdbool.h>
#include <unistd.h>
#include "firebase.h"
#include "serial.h"
#include "gpio.h"

#define _USE_SERIAL_
#ifdef _USE_SERIAL_
  void (*send_command)(bool, int) = send_command_serial;
  void (*init_sender)() = init_sender_serial;
#else
  void (*send_command)(bool, int) = send_command_gpio;
  void (*init_sender)() = init_sender_gpio;
#endif

void parse_event_string(char* event) {
  bool isOn = (strncmp(event, "on", 2) == 0);

  send_command(isOn, event[strlen(event)-1] - '0');
}

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

  if(argc > 1) {
    printf("Commanding remote\n\n");

    bool isOn = strcmp(argv[1], "on") == 0 ? true : false;

    send_command(isOn, argv[2][0] - '0');
  } else {
    firebase_set_url("https://test.firebaseio.com/me.json");
    firebase_set_callback("/event", parse_event_string);

    sleep(10);
    while (true) {
      firebase_subscribe();
      sleep(30);
    }
  }

  return 0;
}

#include <stdio.h>
#include <string.h>
#include <stdbool.h>
#include <unistd.h>
#include "firebase.h"
#include "serial.h"
#include "gpio.h"

bool useSerial = true;

void init_sender() {
  if (useSerial) {
    init_sender_serial();
  } else {
    init_sender_gpio();
  }
}

void send_command(bool isOn, int device) {
  if (useSerial) {
    send_command_serial(isOn, device);
  } else {
    send_command_gpio(isOn, device);
  }
}

void parse_event_string(char* event) {
  bool isOn = (strncmp(event, "on", 2) == 0);

  send_command(isOn, event[strlen(event)-1] - '0');
}

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

  if(argc > 1) {
    printf("Commanding remote\n\n");

    bool isOn = strcmp(argv[1], "on") == 0 ? true : false;

    send_command(isOn, argv[2][0] - '0');
  } else {
    firebase_set_url("https://test.firebaseio.com/me.json");
    firebase_set_callback("/event", parse_event_string);

    sleep(10);
    while (true) {
      firebase_subscribe();
      sleep(30);
    }
  }

  return 0;
}

Switch to runtime library choice instead of compile time.


// RUN: %llvmgcc -S %s -o - | grep {constant \\\[18 x} | grep { 84, }
// This should pass for any endianness combination of host and target.
#include <ctype.h>
extern void foo(const wchar_t* p);
int main (int argc, const char * argv[])
{
 foo(L"This is some text");
 return 0;
}

// RUN: %llvmgcc -S %s -o - | grep {constant \\\[18 x} | grep { 84, }
// This should pass for any endianness combination of host and target.
#include <wchar.h>
extern void foo(const wchar_t* p);
int main (int argc, const char * argv[])
{
 foo(L"This is some text");
 return 0;
}

Use wchar.h to get wchar_t, not ctype.h.

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


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

#define QLA4XXX_DRIVER_VERSION	"5.02.00-k4"

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

#define QLA4XXX_DRIVER_VERSION	"5.02.00-k5"

Update driver version to 5.02.00-k5

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

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


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

#include <uapi/asm/swab.h>

static __inline__ __u16 ld_le16(const volatile __u16 *addr)
{
	__u16 val;

	__asm__ __volatile__ ("lhbrx %0,0,%1" : "=r" (val) : "r" (addr), "m" (*addr));
	return val;
}

static __inline__ void st_le16(volatile __u16 *addr, const __u16 val)
{
	__asm__ __volatile__ ("sthbrx %1,0,%2" : "=m" (*addr) : "r" (val), "r" (addr));
}

static __inline__ __u32 ld_le32(const volatile __u32 *addr)
{
	__u32 val;

	__asm__ __volatile__ ("lwbrx %0,0,%1" : "=r" (val) : "r" (addr), "m" (*addr));
	return val;
}

static __inline__ void st_le32(volatile __u32 *addr, const __u32 val)
{
	__asm__ __volatile__ ("stwbrx %1,0,%2" : "=m" (*addr) : "r" (val), "r" (addr));
}

#endif /* _ASM_POWERPC_SWAB_H */

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

#include <uapi/asm/swab.h>

#endif /* _ASM_POWERPC_SWAB_H */

powerpc: Remove unused st_le*() and ld_le* functions

The powerpc specific st_le*() and ld_le*() functions in
arch/powerpc/asm/swab.h no longer have any users.  They are also
misleadingly named, since they always byteswap, even on a little-endian
host.

This patch removes them.

Signed-off-by: David Gibson <aa743a0aaec8f7d7a1f01442503957f4d7a2d634@gibson.dropbear.id.au>
Signed-off-by: Benjamin Herrenschmidt <a7089bb6e7e92505d88aaff006cbdd60cc9120b6@kernel.crashing.org>


/**
 * \file   os_rmdir.c
 * \brief  Remove a subdirectory.
 * \author Copyright (c) 2002-2008 Jason Perkins and the Premake project
 */

#include <stdlib.h>
#include "premake.h"

int os_rmdir(lua_State* L)
{
	int z;
	const char* path = luaL_checkstring(L, 1);

#if PLATFORM_WINDOWS
	z = RemoveDirectory(path);
#else
	z = rmdir(path);
#endif

	if (!z)
	{
		lua_pushnil(L);
		lua_pushfstring(L, "unable to remove directory '%s'", path);
		return 2;
	}
	else
	{
		lua_pushboolean(L, 1);
		return 1;
	}
}

/**
 * \file   os_rmdir.c
 * \brief  Remove a subdirectory.
 * \author Copyright (c) 2002-2013 Jason Perkins and the Premake project
 */

#include <stdlib.h>
#include "premake.h"

int os_rmdir(lua_State* L)
{
	int z;
	const char* path = luaL_checkstring(L, 1);

#if PLATFORM_WINDOWS
	z = RemoveDirectory(path);
#else
	z = (0 == rmdir(path));
#endif

	if (!z)
	{
		lua_pushnil(L);
		lua_pushfstring(L, "unable to remove directory '%s'", path);
		return 2;
	}
	else
	{
		lua_pushboolean(L, 1);
		return 1;
	}
}

Fix error result handling in os.rmdir()

Fix error result handling in os.rmdir()


#ifndef SAXBOPHONE_RISKY_RISKY_H
#define SAXBOPHONE_RISKY_RISKY_H

#include <stdint.h>

#ifdef __cplusplus
extern "C"{
#endif

typedef struct version_t {
    uint8_t major;
    uint8_t minor;
    uint8_t patch;
} version_t;

extern const version_t VERSION;

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

// end of header file
#endif

#ifndef SAXBOPHONE_RISKY_RISKY_H
#define SAXBOPHONE_RISKY_RISKY_H

#include <stdint.h>

#ifdef __cplusplus
extern "C"{
#endif

// struct for representing version of RISKY
typedef struct version_t {
    uint8_t major;
    uint8_t minor;
    uint8_t patch;
} version_t;

// enum for storing information about the error status of a function
typedef enum status_t {
    UNKNOWN = 0,
    MALLOC_REFUSED,
    IMPOSSIBLE_CONDITION,
    SUCCESS,
} status_t;

extern const version_t VERSION;

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

// end of header file
#endif

Add a function return status enum

Add a function return status enum


/*
name: TEST018
description: Basic test for arrays
output:
F1
G1	F1	main
{
-
V2	M	#4
V3	V2	#2
A4	V3	arr
A6	P	p
A8	P	q
V9	I	#4
A10	V9	v
	A6	A4	'P	:P
	A8	A4	'P	#P4	+P	#P3	+P	:P
	A4	'P	#P4	+P	#P3	+P	@M	#M2	:M
	A10	'P	@I	#I2	:I
	j	L12	A4	'P	#P4	+P	#P3	+P	@M	MI	#I2	=I
	yI	#I1
L12
	j	L13	A6	#P4	+P	#P3	+P	@M	MI	#I2	=I
	yI	#I1
L13
	j	L14	A8	@M	MI	#I2	=I
	yI	#I1
L14
	j	L15	A10	@I	#I2	=I
	yI	#I1
L15
	yI	#I0
}
*/

#line 1

int
main()
{
	char arr[2][4], (*p)[4], *q;
	int v[4];

	p = arr;
	q = &arr[1][3];
	arr[1][3] = 2;
	v[0] = 2;

	if (arr[1][3] != 2)
		return 1;
	if (p[1][3] != 2)
		return 1;
	if (*q != 2)
		return 1;
	if (*v != 2)
		return 1;

	return 0;
}

Add basic test for arrays

Add basic test for arrays


//
//  KPTableSection.h
//  KSPFetchedResultsController
//
//  Created by Konstantin Pavlikhin on 05.09.14.
//  Copyright (c) 2015 Konstantin Pavlikhin. All rights reserved.
//

#import <Foundation/Foundation.h>

// * * *.

@class NSManagedObject;

// * * *.

@interface KSPTableSection : NSObject

- (nullable instancetype) initWithSectionName: (nonnull NSObject*) sectionName nestedObjects: (nullable NSArray<NSManagedObject*>*) nestedObjects;

@property(readwrite, copy, nonatomic, nonnull) NSObject* sectionName;

// Collection KVO-compatible property.
@property(readonly, nullable) NSArray<__kindof NSManagedObject*>* nestedObjects;

- (void) insertObject: (nonnull NSManagedObject*) object inNestedObjectsAtIndex: (NSUInteger) index;

@end

//
//  KPTableSection.h
//  KSPFetchedResultsController
//
//  Created by Konstantin Pavlikhin on 05.09.14.
//  Copyright (c) 2015 Konstantin Pavlikhin. All rights reserved.
//

#import <Foundation/Foundation.h>

// * * *.

@class NSManagedObject;

// * * *.

@interface KSPTableSection : NSObject

- (nullable instancetype) initWithSectionName: (nonnull NSObject*) sectionName nestedObjects: (nullable NSArray<NSManagedObject*>*) nestedObjects;

@property(readwrite, copy, nonatomic, nonnull) NSObject* sectionName;

// Collection KVO-compatible property.
@property(readonly, nonatomic, nullable) NSArray<__kindof NSManagedObject*>* nestedObjects;

- (void) insertObject: (nonnull NSManagedObject*) object inNestedObjectsAtIndex: (NSUInteger) index;

@end

Add a missing 'nonatomic' keyword in a property declaration.


#pragma once
#ifndef YOU_DATASTORE_DATASTORE_H_
#define YOU_DATASTORE_DATASTORE_H_

#include <memory>
#include "task_typedefs.h"
#include "transaction.h"

namespace You {
namespace DataStore {
namespace UnitTests {}

class DataStore {
public:
	Transaction && begin();

	static DataStore& get();

	// Modifying methods
	void post(TaskId, SerializedTask&);
	void put(TaskId, SerializedTask&);
	void erase(TaskId);

	std::vector<SerializedTask> getAllTask();

	void notify();

private:
	bool isServing = false;
	std::unique_ptr<Transaction> activeTransaction;
};
}  // namespace DataStore
}  // namespace You
#endif  // YOU_DATASTORE_DATASTORE_H_

#pragma once
#ifndef YOU_DATASTORE_DATASTORE_H_
#define YOU_DATASTORE_DATASTORE_H_

#include <stack>
#include <memory>
#include "task_typedefs.h"
#include "transaction.h"

namespace You {
namespace DataStore {
namespace UnitTests {}

class DataStore {
public:
	Transaction && begin();

	static DataStore& get();

	// Modifying methods
	void post(TaskId, SerializedTask&);
	void put(TaskId, SerializedTask&);
	void erase(TaskId);

	std::vector<SerializedTask> getAllTask();

	void notify();

private:
	bool isServing = false;
	std::shared_ptr<Transaction> activeTransaction;
	std::stack<std::shared_ptr<Transaction> > transactionStack;
};
}  // namespace DataStore
}  // namespace You
#endif  // YOU_DATASTORE_DATASTORE_H_

Add member variable: transaction stack

Add member variable: transaction stack


#import <Foundation/Foundation.h>

FOUNDATION_EXPORT double NimbleVersionNumber;
FOUNDATION_EXPORT const unsigned char NimbleVersionString[];

#import "DSL.h"
#import "NMBExceptionCapture.h"

Add Objective-C headers to umbrella header to make project compile


/*  XMMS2 - X Music Multiplexer System
 *  Copyright (C) 2003-2009 XMMS2 Team
 *
 *  PLUGINS ARE NOT CONSIDERED TO BE DERIVED WORK !!!
 *
 *  This library is free software; you can redistribute it and/or
 *  modify it under the terms of the GNU Lesser General Public
 *  License as published by the Free Software Foundation; either
 *  version 2.1 of the License, or (at your option) any later version.
 *
 *  This library is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 *  Lesser General Public License for more details.
 */

#ifndef __XMMS_COLLSYNC_H__
#define __XMMS_COLLSYNC_H__

#include "xmmspriv/xmms_collection.h"

void xmms_coll_sync_init (xmms_coll_dag_t *dag);
void xmms_coll_sync_shutdown ();
void xmms_coll_sync_schedule_sync ();

#endif

/*  XMMS2 - X Music Multiplexer System
 *  Copyright (C) 2003-2009 XMMS2 Team
 *
 *  PLUGINS ARE NOT CONSIDERED TO BE DERIVED WORK !!!
 *
 *  This library is free software; you can redistribute it and/or
 *  modify it under the terms of the GNU Lesser General Public
 *  License as published by the Free Software Foundation; either
 *  version 2.1 of the License, or (at your option) any later version.
 *
 *  This library is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 *  Lesser General Public License for more details.
 */

#ifndef __XMMS_COLLSYNC_H__
#define __XMMS_COLLSYNC_H__

#include "xmmspriv/xmms_collection.h"

void xmms_coll_sync_init (xmms_coll_dag_t *dag);
void xmms_coll_sync_shutdown (void);
void xmms_coll_sync_schedule_sync (void);

#endif

OTHER: Make function declarations proper prototypes in collsync.h


#ifndef MAPPER_1_H
#define MAPPER_1_H

#include <Mapper.h>

enum PrgMode {
    PRG_32KB,
    FIX_FIRST_16KB,
    FIX_LAST_16KB,
};

enum ChrMode {
    CHR_8KB,
    CHR_4KB,
};

class Mapper1: public Mapper {
public:
    uint8_t readPrg(uint16_t addr);
    void writePrg(uint16_t addr, uint8_t value);
    uint8_t readChr(uint16_t addr);
    void writeChr(uint16_t addr, uint8_t value);

private:
    void loadRegister(uint16_t addr, uint8_t value);
    void updateBankAddresses();
    int decodePrgRomAddress(uint16_t addr);
    int decodeChrRomAddress(uint16_t addr);

    int shiftRegister = 0x10;

    int prgRomBank = 0;
    bool prgRamDisable = false;
    int chrRomBank0 = 0;
    int chrRomBank1 = 0;

    PrgMode prgMode = PrgMode::PRG_32KB;
    ChrMode chrMode = ChrMode::CHR_8KB;

    int prg16kBankAddresses[2];
    int chr4kBankAddresses[2];
};

#endif

#ifndef MAPPER_1_H
#define MAPPER_1_H

#include <Mapper.h>

enum PrgMode {
    PRG_32KB,
    FIX_FIRST_16KB,
    FIX_LAST_16KB,
};

enum ChrMode {
    CHR_8KB,
    CHR_4KB,
};

class Mapper1: public Mapper {
public:
    uint8_t readPrg(uint16_t addr);
    void writePrg(uint16_t addr, uint8_t value);
    uint8_t readChr(uint16_t addr);
    void writeChr(uint16_t addr, uint8_t value);

private:
    void loadRegister(uint16_t addr, uint8_t value);
    void updateBankAddresses();
    int decodePrgRomAddress(uint16_t addr);
    int decodeChrRomAddress(uint16_t addr);

    int shiftRegister = 0x10;

    int prgRomBank = 0;
    bool prgRamDisable = false;
    int chrRomBank0 = 0;
    int chrRomBank1 = 0;

    PrgMode prgMode = PrgMode::FIX_LAST_16KB;
    ChrMode chrMode = ChrMode::CHR_8KB;

    int prg16kBankAddresses[2];
    int chr4kBankAddresses[2];
};

#endif

Update mapper 1 default mapping on boot

Update mapper 1 default mapping on boot


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

#ifndef ASH_SHELL_EXAMPLE_FACTORY_H_
#define ASH_SHELL_EXAMPLE_FACTORY_H_
#pragma once

namespace app_list {
class AppListModel;
class AppListViewDelegate;
}

namespace views {
class View;
}

namespace ash {
namespace shell {

void CreatePointyBubble(views::View* anchor_view);

void CreateLockScreen();

// Creates a window showing samples of commonly used widgets.
void CreateWidgetsWindow();

void BuildAppListModel(app_list::AppListModel* model);

app_list::AppListViewDelegate* CreateAppListViewDelegate();

}  // namespace shell
}  // namespace ash

#endif  // ASH_SHELL_EXAMPLE_FACTORY_H_

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

#ifndef ASH_SHELL_EXAMPLE_FACTORY_H_
#define ASH_SHELL_EXAMPLE_FACTORY_H_
#pragma once

namespace app_list {
class AppListViewDelegate;
}

namespace views {
class View;
}

namespace ash {
namespace shell {

void CreatePointyBubble(views::View* anchor_view);

void CreateLockScreen();

// Creates a window showing samples of commonly used widgets.
void CreateWidgetsWindow();

app_list::AppListViewDelegate* CreateAppListViewDelegate();

}  // namespace shell
}  // namespace ash

#endif  // ASH_SHELL_EXAMPLE_FACTORY_H_

ash: Remove unused declaration of BuildAppListModel() function.

R=xiyuan@chromium.org
TBR=ben@chromium.org

Review URL: https://chromiumcodereview.appspot.com/10377097

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


/*
 *  Copyright 2008 Michael Ellerman, IBM Corporation.
 *
 *  This program is free software; you can redistribute it and/or
 *  modify it under the terms of the GNU General Public License
 *  as published by the Free Software Foundation; either version
 *  2 of the License, or (at your option) any later version.
 */

#include <linux/kernel.h>
#include <asm/code-patching.h>

void patch_instruction(unsigned int *addr, unsigned int instr)
{
	*addr = instr;
	asm ("dcbst 0, %0; sync; icbi 0,%0; sync; isync" : : "r" (addr));
}

void patch_branch(unsigned int *addr, unsigned long target, int flags)
{
	patch_instruction(addr, create_branch(addr, target, flags));
}

unsigned int create_branch(const unsigned int *addr,
			   unsigned long target, int flags)
{
	unsigned int instruction;

	if (! (flags & BRANCH_ABSOLUTE))
		target = target - (unsigned long)addr;

	/* Mask out the flags and target, so they don't step on each other. */
	instruction = 0x48000000 | (flags & 0x3) | (target & 0x03FFFFFC);

	return instruction;
}

/*
 *  Copyright 2008 Michael Ellerman, IBM Corporation.
 *
 *  This program is free software; you can redistribute it and/or
 *  modify it under the terms of the GNU General Public License
 *  as published by the Free Software Foundation; either version
 *  2 of the License, or (at your option) any later version.
 */

#include <linux/kernel.h>
#include <asm/code-patching.h>

void patch_instruction(unsigned int *addr, unsigned int instr)
{
	*addr = instr;
	asm ("dcbst 0, %0; sync; icbi 0,%0; sync; isync" : : "r" (addr));
}

void patch_branch(unsigned int *addr, unsigned long target, int flags)
{
	patch_instruction(addr, create_branch(addr, target, flags));
}

unsigned int create_branch(const unsigned int *addr,
			   unsigned long target, int flags)
{
	unsigned int instruction;
	long offset;

	offset = target;
	if (! (flags & BRANCH_ABSOLUTE))
		offset = offset - (unsigned long)addr;

	/* Check we can represent the target in the instruction format */
	if (offset < -0x2000000 || offset > 0x1fffffc || offset & 0x3)
		return 0;

	/* Mask out the flags and target, so they don't step on each other. */
	instruction = 0x48000000 | (flags & 0x3) | (offset & 0x03FFFFFC);

	return instruction;
}

powerpc: Make create_branch() return errors if the branch target is too large

If you pass a target value to create_branch() which is more than 32MB - 4,
or - 32MB away from the branch site, then it's impossible to create an
immediate branch.  The current code doesn't check, which will lead to us
creating a branch to somewhere else - which is bad.

For code that cares to check we return 0, which is easy to check for, and
for code that doesn't at least we'll be creating an illegal instruction,
rather than a branch to some random address.

Signed-off-by: Michael Ellerman <17b9e1c64588c7fa6419b4d29dc1f4426279ba01@ellerman.id.au>
Acked-by: Kumar Gala <383ef5577c6e1178b93f59ec8d0936f76d2a98c4@kernel.crashing.org>
Signed-off-by: Paul Mackerras <19a0ba370c443ba08d20b5061586430ab449ee8c@samba.org>


/*
 *  arch/x86_64/kernel/bugs.c
 *
 *  Copyright (C) 1994  Linus Torvalds
 *  Copyright (C) 2000  SuSE
 */

#include <linux/kernel.h>
#include <linux/init.h>
#include <asm/alternative.h>
#include <asm/processor.h>

void __init check_bugs(void)
{
	identify_cpu(&boot_cpu_data);
	mtrr_bp_init();
#if !defined(CONFIG_SMP)
	printk("CPU: ");
	print_cpu_info(&boot_cpu_data);
#endif
	alternative_instructions();
}

/*
 *  arch/x86_64/kernel/bugs.c
 *
 *  Copyright (C) 1994  Linus Torvalds
 *  Copyright (C) 2000  SuSE
 */

#include <linux/kernel.h>
#include <linux/init.h>
#include <asm/alternative.h>
#include <asm/processor.h>
#include <asm/mtrr.h>

void __init check_bugs(void)
{
	identify_cpu(&boot_cpu_data);
	mtrr_bp_init();
#if !defined(CONFIG_SMP)
	printk("CPU: ");
	print_cpu_info(&boot_cpu_data);
#endif
	alternative_instructions();
}

Add asm/mtrr.h include for some builds

x86_64: Add asm/mtrr.h include for some builds

The earlier change to call the bp mtrr init from bugs.c broke
on some configurations due to missing includes.  Noticed
by "Avuton Olrich" <avuton@gmail.com>

Signed-off-by: Andi Kleen <0474aee45985f5ae829f53849df476200e876990@suse.de>
Signed-off-by: Linus Torvalds <69652caca27c8b940640ad396ab71f93cacec34f@linux-foundation.org>


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

#define QLA4XXX_DRIVER_VERSION	"5.03.00-k7"

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

#define QLA4XXX_DRIVER_VERSION	"5.03.00-k8"

Update driver version to 5.03.00-k8

[SCSI] qla4xxx: Update driver version to 5.03.00-k8

Signed-off-by: Vikas Chaudhary <c251871a64d7d31888eace0406cb3d4c419d5f73@qlogic.com>
Signed-off-by: James Bottomley <1acebbdca565c7b6b638bdc23b58b5610d1a56b8@Parallels.com>


/* Copyright (c) 2013 Wildfire Games
 *
 * 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.
 */

/*
 * Bring in the TinyGettext header file.
 */

#ifndef INCLUDED_TINYGETTEXT
#define INCLUDED_TINYGETTEXT

#if MSC_VERSION
# pragma warning(push)
# pragma warning(disable:4251) // "class X needs to have dll-interface to be used by clients of class Y"
# pragma warning(disable:4800) // "forcing value to bool 'true' or 'false' (performance warning)"
#endif

#include <tinygettext/tinygettext.hpp>
#include <tinygettext/po_parser.hpp>
#include <tinygettext/log.hpp>

#if MSC_VERSION
# pragma warning(pop)
#endif

#endif	// INCLUDED_TINYGETTEXT

Bring in the TinyGettext header file.

Bring in the TinyGettext header file.


#include <stdio.h>

#define INPUTS 3
#define HIDDEN 5
#define OUTPUTS 2
#define ROWS 5

typedef struct {
    double input[HIDDEN][INPUTS];
    double hidden[ROWS - 3][HIDDEN][HIDDEN];
    double output[OUTPUTS][HIDDEN];
} Links;

typedef struct {
    int input[INPUTS];
    int hidden[ROWS - 3][HIDDEN];
    int output[OUTPUTS];
} Neurons;

typedef struct {
    Links weights;
    Neurons values;
} ANN;

int main(void)
{
    return 0;
}

#include <stdio.h>

#define INPUTS 3
#define HIDDEN 5
#define OUTPUTS 2
#define ROWS 5

typedef struct {
    double input[HIDDEN][INPUTS];
    double hidden[ROWS - 3][HIDDEN][HIDDEN];
    double output[OUTPUTS][HIDDEN];
} Links;

typedef struct {
    int input[INPUTS];
    int hidden[ROWS - 2][HIDDEN];
    int output[OUTPUTS];
} Neurons;

typedef struct {
    Links weights;
    Neurons values;
} ANN;

int main(void)
{
    return 0;
}

Fix number of hidden rows in Neurons struct


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

inherit "emit";

Make emit explicit inherit for now

Make emit explicit inherit for now


//
//  LGHTTPRequest.h
//  AutoPkgr
//
//  Created by Eldon Ahrold on 8/9/14.
//  Copyright 2014-2015 The Linde Group, 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.
//

#import <Foundation/Foundation.h>

@class LGHTTPCredential;

@interface LGHTTPRequest : NSObject

- (void)retrieveDistributionPoints:(LGHTTPCredential *)credential
                              reply:(void (^)(NSDictionary *distributionPoints, NSError *error))reply;

- (void)retrieveDistributionPoints:(LGHTTPCredential *)credential
                          redirect:(void (^)(NSString *redirect))redirect
                             reply:(void (^)(NSDictionary *distributionPoints, NSError *error))reply;

- (void)retrieveDistributionPoints2:(LGHTTPCredential *)credential
                              reply:(void (^)(NSDictionary *distributionPoints, NSError *error))reply;

@end

//
//  LGHTTPRequest.h
//  AutoPkgr
//
//  Created by Eldon Ahrold on 8/9/14.
//  Copyright 2014-2015 The Linde Group, 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.
//

#import <Foundation/Foundation.h>

@class LGHTTPCredential;

@interface LGHTTPRequest : NSObject

- (void)retrieveDistributionPoints:(LGHTTPCredential *)credential
                              reply:(void (^)(NSDictionary *distributionPoints, NSError *error))reply;

- (void)retrieveDistributionPoints2:(LGHTTPCredential *)credential
                              reply:(void (^)(NSDictionary *distributionPoints, NSError *error))reply;

@end

Remove unused method from header.

Remove unused method from header.


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

#ifdef HAVE_CONFIG_H
#include "config.h"
#endif

#include "swfdec_as_internal.h"
#include "swfdec_debug.h"

SWFDEC_AS_NATIVE (2205, 0, swfdec_file_reference_list_browse)
void
swfdec_file_reference_list_browse (SwfdecAsContext *cx, SwfdecAsObject *object,
    guint argc, SwfdecAsValue *argv, SwfdecAsValue *ret)
{
  SWFDEC_STUB ("FileReference.browse");
}

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

#ifdef HAVE_CONFIG_H
#include "config.h"
#endif

#include "swfdec_as_internal.h"
#include "swfdec_debug.h"

SWFDEC_AS_NATIVE (2205, 0, swfdec_file_reference_list_browse)
void
swfdec_file_reference_list_browse (SwfdecAsContext *cx, SwfdecAsObject *object,
    guint argc, SwfdecAsValue *argv, SwfdecAsValue *ret)
{
  SWFDEC_STUB ("FileReferenceList.browse");
}

Fix stub message having a wrong name

Fix stub message having a wrong name


/*
 * tré – Copyright (c) 2005–2007,2009,2012 Sven Michael Klose <pixel@copei.de>
 */

#ifndef TRE_APPLY_H
#define TRE_APPLY_H

extern treptr function_arguments (treptr);

extern treptr trefuncall (treptr func, treptr args);
extern treptr trebuiltin_call_compiled (void * fun, treptr args);

extern bool   trebuiltin_is_compiled_funcall (treptr);
extern treptr trefuncall_compiled (treptr func, treptr args, bool do_eval);

void treapply_init ();

#endif	/* #ifndef TRE_APPLY_H */

/*
 * tré – Copyright (c) 2005–2007,2009,2012 Sven Michael Klose <pixel@copei.de>
 */

#ifndef TRE_APPLY_H
#define TRE_APPLY_H

extern treptr function_arguments (treptr);

extern treptr trefuncall (treptr func, treptr args);
extern treptr trebuiltin_call_compiled (void * fun, treptr args);

extern bool   trebuiltin_is_compiled_funcall (treptr);
extern bool   trebuiltin_is_compiled_closure (treptr);
extern treptr trefuncall_compiled (treptr func, treptr args, bool do_eval);

void treapply_init ();

#endif	/* #ifndef TRE_APPLY_H */

Fix declarations for file-by-file compile.


#ifndef APIMOCK_H
#define APIMOCK_H

#include "core/server.h"
#include "core/exceptions.h"
#include "http/requestdata.h"
#endif

#ifndef APIMOCK_H
#define APIMOCK_H

#include "core/server.h"
#include "core/exceptions.h"
#include "http/requestdata.h"
#include "http/requestdata.h"
#include "http/statuscodes.h"

#endif

Include request data and status codes

Include request data and status codes


#ifndef VRPSOLVER_CUSTOMER_H
#define VRPSOLVER_CUSTOMER_H

#include <utility>

namespace VrpSolver {

    class Customer {
    public:
        Customer(std::size_t id, std::size_t demand)
            : id_(id), demand_(demand), vertex_(std::make_pair(0, 0))
        { }

        Customer(std::size_t id, std::size_t demand, std::pair<int, int> vertex)
            : id_(id), demand_(demand), vertex_(vertex)
        { }

        Customer(std::size_t id, std::size_t demand, int x, int y)
            : id_(id), demand_(demand), vertex_(std::make_pair(x, y))
        { }

        std::size_t id() const {
            return id_;
        }

        std::size_t demand() const {
            return demand_;
        }

        void demand(std::size_t demand) {
            demand_ = demand;
        }

        int x() const {
            return vertex_.first;
        }

        void x(int x) {
            vertex_.first = x;
        }

        int y() const {
            return vertex_.second;
        }

        void y(int y) {
            vertex_.second = y;
        }

    private:
        std::size_t id_;
        std::size_t demand_;
        std::pair<int, int> vertex_;
    };

} // namespace VrpSolver

#endif // VRPSOLVER_CUSTOMER_H

#ifndef VRPSOLVER_CUSTOMER_H
#define VRPSOLVER_CUSTOMER_H

#include <utility>

namespace VrpSolver {

    class Customer {
    public:
        Customer(std::size_t id, std::size_t demand)
            : id_(id), demand_(demand), vertex_(std::make_pair(0, 0))
        { }

        Customer(std::size_t id, std::size_t demand, std::pair<int, int> vertex)
            : id_(id), demand_(demand), vertex_(vertex)
        { }

        Customer(std::size_t id, std::size_t demand, int x, int y)
            : id_(id), demand_(demand), vertex_(std::make_pair(x, y))
        { }

        std::size_t id() const {
            return id_;
        }

        std::size_t demand() const {
            return demand_;
        }

        void demand(std::size_t demand) {
            demand_ = demand;
        }

        int x() const {
            return vertex_.first;
        }

        void x(int x) {
            vertex_.first = x;
        }

        int y() const {
            return vertex_.second;
        }

        void y(int y) {
            vertex_.second = y;
        }

        bool operator==(const Customer &c) const {
            return id_ == c.id_;
        }

        bool operator!=(const Customer &c) const {
            return !(*this == c);
        }

    private:
        std::size_t id_;
        std::size_t demand_;
        std::pair<int, int> vertex_;
    };

} // namespace VrpSolver

#endif // VRPSOLVER_CUSTOMER_H

Add operator== and != to Customer class

Add operator== and != to Customer class

顧客の同値性は顧客番号のみに依存するようにした
顧客番号は同じだが、需要や座標が異なる顧客は存在しないと
考えたからである.


/*
    Copyright (c) 2009 Stephen Kelly <steveire@gmail.com>
*/

#ifndef TEMPLATE_H
#define TEMPLATE_H

#include "context.h"

#include "node.h"

#include "grantlee_export.h"

class GRANTLEE_EXPORT Template //: public QObject
{
//   Q_OBJECT
public:
  Template(const QString &templateString, QStringList dirs );

  QString render( Context *c );

  NodeList nodeList();

  // TODO: Remove this.  ??
  void setNodeList(const NodeList &list);

private:
  void parse();
  NodeList compileString(const QString &str);
  QStringList m_pluginDirs;
  NodeList m_nodelist;
};

class GRANTLEE_EXPORT TemplateLoader
{
public:
  static TemplateLoader* instance();

  void setTemplateDirs(const QStringList &dirs);
  void setPluginDirs(const QStringList &dirs);

  void setTheme(const QString &themeName);

  void injectTemplate(const QString &name, const QString &content);

  Template loadFromString(const QString &content);

  Template loadByName(const QString &name);

  TemplateLoader();

private:
  Template loadFromFile(const QString &fileName);

  QString m_themeName;
  QStringList m_templateDirs;
  QStringList m_pluginDirs;
  static TemplateLoader* m_instance;
  QHash<QString, QString> m_namedTemplates;
};

#endif

/*
    Copyright (c) 2009 Stephen Kelly <steveire@gmail.com>
*/

#ifndef TEMPLATE_H
#define TEMPLATE_H

#include "context.h"

#include "node.h"

#include "grantlee_export.h"

class GRANTLEE_EXPORT Template //: public QObject
{
//   Q_OBJECT
public:
  Template(const QString &templateString, QStringList dirs );

  QString render( Context *c );

  NodeList nodeList();

  // TODO: Remove this.  ??
  void setNodeList(const NodeList &list);

private:
  void parse();
  NodeList compileString(const QString &str);
  QStringList m_pluginDirs;
  NodeList m_nodelist;
};

class GRANTLEE_EXPORT TemplateLoader
{
public:
  static TemplateLoader* instance();

  void setTemplateDirs(const QStringList &dirs);
  void setPluginDirs(const QStringList &dirs);

  void setTheme(const QString &themeName);

  void injectTemplate(const QString &name, const QString &content);

  Template loadFromString(const QString &content);

  Template loadByName(const QString &name);

private:
  TemplateLoader();
  Template loadFromFile(const QString &fileName);

  QString m_themeName;
  QStringList m_templateDirs;
  QStringList m_pluginDirs;
  static TemplateLoader* m_instance;
  QHash<QString, QString> m_namedTemplates;
};

#endif

Make the TemplateLoader constructor private for the Singleton pattern.


// REQUIRES: x86-registered-target
// REQUIRES: arm-registered-target
// RUN: %clang -target i386-apple-darwin10 -miphonesimulator-version-min=7.0 -arch i386 -S -o - %s | FileCheck %s
// RUN: %clang -target i386-apple-darwin10 -miphoneos-version-min=7.0 -arch armv7s -S -o - %s | FileCheck %s

int main() { return 0; }
// CHECK: .ios_version_min 7, 0

// REQUIRES: x86-registered-target
// REQUIRES: arm-registered-target
// RUN: %clang -target i386-apple-darwin10 -miphonesimulator-version-min=7.0 -arch i386 -S -o - %s | FileCheck %s
// RUN: %clang -target armv7s-apple-darwin10 -miphoneos-version-min=7.0 -arch armv7s -S -o - %s | FileCheck %s

int main() { return 0; }
// CHECK: .ios_version_min 7, 0

Fix the test added in r240710.

Fix the test added in r240710.

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


/*
 *  linux/include/asm-arm/arch-ebsa110/uncompress.h
 *
 *  Copyright (C) 1996,1997,1998 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.
 */

#include <linux/serial_reg.h>

#define SERIAL_BASE	((unsigned char *)0xfe000be0)

/*
 * This does not append a newline
 */
static inline void putc(int c)
{
	unsigned char v, *base = SERIAL_BASE;

	do {
		v = base[UART_LSR << 2];
		barrier();
	} while (!(v & UART_LSR_THRE));

	base[UART_TX << 2] = c;
}

static inline void flush(void)
{
	unsigned char v, *base = SERIAL_BASE;

	do {
		v = base[UART_LSR << 2];
		barrier();
	} while ((v & (UART_LSR_TEMT|UART_LSR_THRE)) !=
		 (UART_LSR_TEMT|UART_LSR_THRE));
}

/*
 * nothing to do
 */
#define arch_decomp_setup()
#define arch_decomp_wdog()

/*
 *  linux/include/asm-arm/arch-ebsa110/uncompress.h
 *
 *  Copyright (C) 1996,1997,1998 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.
 */

#include <linux/serial_reg.h>

#define SERIAL_BASE	((unsigned char *)0xf0000be0)

/*
 * This does not append a newline
 */
static inline void putc(int c)
{
	unsigned char v, *base = SERIAL_BASE;

	do {
		v = base[UART_LSR << 2];
		barrier();
	} while (!(v & UART_LSR_THRE));

	base[UART_TX << 2] = c;
}

static inline void flush(void)
{
	unsigned char v, *base = SERIAL_BASE;

	do {
		v = base[UART_LSR << 2];
		barrier();
	} while ((v & (UART_LSR_TEMT|UART_LSR_THRE)) !=
		 (UART_LSR_TEMT|UART_LSR_THRE));
}

/*
 * nothing to do
 */
#define arch_decomp_setup()
#define arch_decomp_wdog()

Fix incorrect serial port address

[ARM] ebsa110: Fix incorrect serial port address

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


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

inherit LIB_INITD;

static void create()
{
	LOGD->post_message("test", LOG_DEBUG, "Test subsystem loaded");
}

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

inherit LIB_INITD;
inherit UTILITY_COMPILE;

static void create()
{
	LOGD->post_message("test", LOG_DEBUG, "Test subsystem loading...");

	load_dir("obj", 1);
	load_dir("sys", 1);

	LOGD->post_message("test", LOG_DEBUG, "Test subsystem loaded");
}

Make test subsystem load itself properly


// RUN: %ocheck 0 %s

struct bit
{
	int bit : 1;
};

struct bits
{
	struct bit; // `second' is not packed into this
	unsigned second : 1;
};

main()
{
	struct bits bs;

	bs.bit = 1;
	bs.second = 1;

	if(0[(int *)&bs] != 1)
		return 1;
	if(1[(int *)&bs] != 1) // ensure it's packed to an int spacing
		return 1;

	return 0;
}

Test for bitfields separated by an anonymous struct


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

 The MIT License

 Copyright (c) 2012 Scientific Computing and Imaging Institute,
 University of Utah.

 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 CORE_COMMAND_COMMANDFACTORY_H
#define CORE_COMMAND_COMMANDFACTORY_H

#include <Core/Command/Share.h>

namespace SCIRun
{
  namespace Core
  {
    namespace GlobalCommands
    {
      class GlobalCommand;
      enum Commands;

      class SCISHARE CommandFactory
      {
      public:
        virtual ~CommandFactory();
        virtual GlobalCommand* create(Commands command) = 0;
      };
    }
  }
}

#endif

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

 The MIT License

 Copyright (c) 2012 Scientific Computing and Imaging Institute,
 University of Utah.

 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 CORE_COMMAND_COMMANDFACTORY_H
#define CORE_COMMAND_COMMANDFACTORY_H

#include <Core/Command/Command.h>
#include <Core/Command/Share.h>

namespace SCIRun
{
  namespace Core
  {
    namespace GlobalCommands
    {
      class GlobalCommand;

      class SCISHARE CommandFactory
      {
      public:
        virtual ~CommandFactory();
        virtual GlobalCommand* create(Commands command) = 0;
      };
    }
  }
}

#endif

Remove nonstandard enum forward decl.

Remove nonstandard enum forward decl.


#include "m-dict.h"
#include "m-array.h"
#include "m-algo.h"
#include "m-string.h"

DICT_DEF2(dict, string_t, int)
#define M_OPL_dict_t() DICT_OPLIST(dict, STRING_OPLIST, M_DEFAULT_OPLIST)

ARRAY_DEF(vector_int, int)
#define M_OPL_vector_int_t() ARRAY_OPLIST(vector_int)

#define start_with(pattern, item)                \
  string_start_with_str_p((item).key, (pattern))
#define get_value(out, item) ((out) = (item).value)

int main(void)
{
  int s;
  M_LET(keys, vector_int_t)
    M_LET( (m, (STRING_CTE("foo"), 1), (STRING_CTE("bar"), 42), (STRING_CTE("bluez"), 7), (STRING_CTE("stop"), 789) ), tmp, dict_t) {

    /* Extract all elements of 'm' that starts with 'b' */
    ALGO_EXTRACT(tmp, dict_t, m, dict_t, start_with, "b");
    /* Extract the values of theses elements */
    ALGO_TRANSFORM(keys, vector_int_t, tmp, dict_t, get_value);
    /* Sum theses values */
    ALGO_REDUCE(s, keys, vector_int_t, sum);
    printf("Sum of elements starting with 'b' is: %d\n", s);
  }
  return 0;
}

Add new example for algorithm

Add new example for algorithm


extern "C" {
  #include "ruby.h"
}

void Define_Document();
void Define_Page();
void Define_PageSet();

#ifndef __PDFIUM_RUBY_H__
#define __PDFIUM_RUBY_H__

extern "C" {
  #include "ruby.h"
}

// Inspired by https://github.com/jasonroelofs/rice/blob/1740a6d12c99fce8c21eda3c5385738318ab9172/rice/detail/ruby.hpp#L33-L37
// Casts C functions into a type that C++ is happy calling
extern "C" typedef VALUE (*CPP_RUBY_METHOD_FUNC)(ANYARGS);

void Define_Document();
void Define_Page();
void Define_PageSet();

#endif

Create a type to cast Ruby's C functions to a thing C++ is happy with.


// RUN: %check %s

struct A
{
	int i;
};

int f(const void *p)
{
	struct A *a = p; // CHECK: warning: implicit cast removes qualifiers (const)
	struct A *b = (struct A *)p; // CHECK: !/warning:.*cast removes qualifiers/

	(void)a;
	(void)b;
}

// RUN: %check %s

struct A
{
	int i;
};

void take(void *);

int f(const void *p)
{
	struct A *a = p; // CHECK: warning: implicit cast removes qualifiers (const)
	struct A *b = (struct A *)p; // CHECK: !/warning:.*cast removes qualifiers/

	(void)a;
	(void)b;

	const char c = 5;
	take(&c); // CHECK: warning: implicit cast removes qualifiers (const)
}

Add another case to qualifier-removal test


// RUN: %clang -S -v -o %t %s        2>&1 | not grep -w -- -g
// RUN: %clang -S -v -o %t %s -g     2>&1 | grep -w -- -g
// RUN: %clang -S -v -o %t %s -g0    2>&1 | not grep -w -- -g
// RUN: %clang -S -v -o %t %s -g -g0 2>&1 | not grep -w -- -g
// RUN: %clang -S -v -o %t %s -g0 -g 2>&1 | grep -w -- -g

// RUN: %clang -S -v -o %t %s        2>&1 | FileCheck %s
// CHECK-NOT: -g

// RUN: %clang -S -v -o %t %s -g     2>&1 | FileCheck %s
// CHECK: -g

// RUN: %clang -S -v -o %t %s -g0    2>&1 | FileCheck %s
// CHECK-NOT: -g

// RUN: %clang -S -v -o %t %s -g -g0 2>&1 | FileCheck %s
// CHECK-NOT: -g

// RUN: %clang -S -v -o %t %s -g0 -g 2>&1 | FileCheck %s
// CHECK: -g

Move a non portable test to FileCheck, from Jonathan Gray!

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


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

inherit LIB_RAWVERB;

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

	if (query_user()->query_class() < 2) {
		send_out("You have insufficient access to post on the DGD channel.\n");
		return;
	}

	name = query_user()->query_name();

	CHANNELD->post_message("dgd", name, args);
}

Add command to use it

Add command to use it


//------------------------------------------------------------------------------
// Enum.h
// Various enum utilities.
//
// File is under the MIT license; see LICENSE for details.
//------------------------------------------------------------------------------
#pragma once

#define UTIL_ENUM_ELEMENT(x) x,
#define UTIL_ENUM_STRING(x) #x,
#define ENUM(name, elements)                                           \
    enum class name { elements(UTIL_ENUM_ELEMENT) };                   \
    inline string_view toString(name e) {                              \
        static const char* strings[] = { elements(UTIL_ENUM_STRING) }; \
        return strings[static_cast<std::underlying_type_t<name>>(e)];  \
    }                                                                  \
    inline std::ostream& operator<<(std::ostream& os, name e) { return os << toString(e); }

#define ENUM_MEMBER(name, elements)                                    \
    enum name { elements(UTIL_ENUM_ELEMENT) };                         \
    friend string_view toString(name e) {                              \
        static const char* strings[] = { elements(UTIL_ENUM_STRING) }; \
        return strings[static_cast<std::underlying_type_t<name>>(e)];  \
    }

Work around more GCC nonsense

Work around more GCC nonsense


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

#include "SkGLContext.h"

#if SK_MESA

class SkMesaGLContext : public SkGLContext {
private:
    typedef intptr_t Context;

public:
    SkMesaGLContext();

    virtual ~SkMesaGLContext();

    virtual void makeCurrent() const SK_OVERRIDE;

    class AutoContextRestore {
    public:
        AutoContextRestore();
        ~AutoContextRestore();

    private:
        Context fOldContext;
        GLint   fOldWidth;
        GLint   fOldHeight;
        GLint   fOldFormat;
        void*   fOldImage;
    };

protected:
    virtual const GrGLInterface* createGLContext() SK_OVERRIDE;
    virtual void destroyGLContext() SK_OVERRIDE;

private:
    Context fContext;
    GrGLubyte *fImage;
};

#endif

#endif

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

#include "SkGLContext.h"

#if SK_MESA

class SkMesaGLContext : public SkGLContext {
private:
    typedef intptr_t Context;

public:
    SkMesaGLContext();

    virtual ~SkMesaGLContext();

    virtual void makeCurrent() const SK_OVERRIDE;

    class AutoContextRestore {
    public:
        AutoContextRestore();
        ~AutoContextRestore();

    private:
        Context fOldContext;
        GrGLint fOldWidth;
        GrGLint fOldHeight;
        GrGLint fOldFormat;
        void*   fOldImage;
    };

protected:
    virtual const GrGLInterface* createGLContext() SK_OVERRIDE;
    virtual void destroyGLContext() SK_OVERRIDE;

private:
    Context fContext;
    GrGLubyte *fImage;
};

#endif

#endif

Fix undefined GLint in Mac builds

Fix undefined GLint in Mac builds

git-svn-id: e8541e15acce502a64c929015570ad1648e548cd@3736 2bbb7eff-a529-9590-31e7-b0007b416f81


#ifndef CPR_ERROR_H
#define CPR_ERROR_H

#include <string>

#include "cprtypes.h"
#include "defines.h"

namespace cpr {

enum class ErrorCode {
    OK = 0,
    CONNECTION_FAILURE,
    EMPTY_RESPONSE,
    HOST_RESOLUTION_FAILURE,
    INTERNAL_ERROR,
    INVALID_URL_FORMAT,
    NETWORK_RECEIVE_ERROR,
    NETWORK_SEND_FAILURE,
    OPERATION_TIMEDOUT,
    PROXY_RESOLUTION_FAILURE,
    SSL_CONNECT_ERROR,
    SSL_LOCAL_CERTIFICATE_ERROR,
    SSL_REMOTE_CERTIFICATE_ERROR,
    SSL_CACERT_ERROR,
    GENERIC_SSL_ERROR,
    UNSUPPORTED_PROTOCOL,
    UNKNOWN_ERROR = 1000,
};

class Error {
  public:
    Error() : code{ErrorCode::OK} {}

    template <typename TextType>
    Error(const ErrorCode& p_error_code, TextType&& p_error_message)
            : code{p_error_code}, message{CPR_FWD(p_error_message)} {}

    explicit operator bool() const {
        return code != ErrorCode::OK;
    }

    ErrorCode code;
    std::string message;

    static ErrorCode getErrorCodeForCurlError(int curl_code);
};

} // namespace cpr

#endif

#ifndef CPR_ERROR_H
#define CPR_ERROR_H

#include <string>

#include "cprtypes.h"
#include "defines.h"

namespace cpr {

enum class ErrorCode {
    OK = 0,
    CONNECTION_FAILURE,
    EMPTY_RESPONSE,
    HOST_RESOLUTION_FAILURE,
    INTERNAL_ERROR,
    INVALID_URL_FORMAT,
    NETWORK_RECEIVE_ERROR,
    NETWORK_SEND_FAILURE,
    OPERATION_TIMEDOUT,
    PROXY_RESOLUTION_FAILURE,
    SSL_CONNECT_ERROR,
    SSL_LOCAL_CERTIFICATE_ERROR,
    SSL_REMOTE_CERTIFICATE_ERROR,
    SSL_CACERT_ERROR,
    GENERIC_SSL_ERROR,
    UNSUPPORTED_PROTOCOL,
    UNKNOWN_ERROR = 1000,
};

class Error {
  public:
    Error() : code{ErrorCode::OK} {}

    template <typename TextType>
    Error(const ErrorCode& p_error_code, TextType&& p_error_message)
            : code{p_error_code}, message{CPR_FWD(p_error_message)} {}

    explicit operator bool() const {
        return code != ErrorCode::OK;
    }

    ErrorCode code;
    std::string message;

  private:
    static ErrorCode getErrorCodeForCurlError(int curl_code);
};

} // namespace cpr

#endif

Make static member method private

Make static member method private


//
//  RNInstabugSDK.h
//  RNInstabugSDK
//
//  Created by Mark Miyashita on 10/11/16.
//  Copyright © 2016 Mark Miyashita. All rights reserved.
//

#import "RCTBridgeModule.h"
#import "RCTConvert.h"
#import "RCTUtils.h"

@interface RNInstabugSDK : NSObject <RCTBridgeModule>
@end

//
//  RNInstabugSDK.h
//  RNInstabugSDK
//
//  Created by Mark Miyashita on 10/11/16.
//  Copyright © 2016 Mark Miyashita. All rights reserved.
//

#if __has_include("RCTBridgeModule.h")
  #import "RCTBridgeModule.h"
  #import "RCTConvert.h"
  #import "RCTUtils.h"
#else
  #import "React/RCTBridgeModule.h"
  #import "React/RCTConvert.h"
  #import "React/RCTUtils.h"
#endif

@interface RNInstabugSDK : NSObject <RCTBridgeModule>
@end

Update import style to add RN 40.0+ compatibility


#include <stdlib.h>
#include <stdbool.h>
#include <stdio.h>
#include <string.h>
#include <unistd.h>
#include "cmd.h"

void sh_exit() {
  exit(0);
}

void sh_pid() {
  printf("%d\n", getpid());
}

void sh_ppid() {
  printf("%d\n", getppid());
}

void sh_cd(cmd_args_t args) {
  char* dir;
  if (args.size == 1) {
    dir = getenv("HOME");
  } else {
    dir = args.args[1];
  }

  chdir(dir);
}

void sh_pwd() {
  char* cwd = getcwd(NULL, 0);
  printf("%s\n", cwd);
  free(cwd);
}

void sh_set(cmd_args_t args) {
  setenv(args.args[0], args.args[1], true);
}

void sh_get(cmd_args_t args) {
  char* val = getenv(args.args[0]);

  if (val == NULL) {
    printf("(NULL)\n");
  } else {
    printf("%s\n", val);
  }

}

#include <stdlib.h>
#include <stdbool.h>
#include <stdio.h>
#include <string.h>
#include <unistd.h>
#include "cmd.h"

void sh_exit() {
  exit(0);
}

void sh_pid() {
  printf("%d\n", getpid());
}

void sh_ppid() {
  printf("%d\n", getppid());
}

void sh_cd(cmd_args_t args) {
  char* dir;
  if (args.size == 1) {
    dir = getenv("HOME");
  } else {
    dir = args.args[1];
  }

  chdir(dir);
}

void sh_pwd() {
  char* cwd = getcwd(NULL, 0);
  printf("%s\n", cwd);
  free(cwd);
}

void sh_set(cmd_args_t args) {
  setenv(args.args[1], args.args[2], true);
}

void sh_get(cmd_args_t args) {
  char* val = getenv(args.args[1]);

  if (val == NULL) {
    printf("(NULL)\n");
  } else {
    printf("%s\n", val);
  }

}

Fix issue in options index.

Fix issue in options index.


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

#include "rpm-helper.h"

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

int rpmErrorCb (rpmlogRec rec, rpmlogCallbackData data)
{
	dE("RPM: %s", rpmlogRecMessage(rec));
	return RPMLOG_EXIT; // don't perform default logging

void rpmLibsPreload()
{
	rpmReadConfigFiles(NULL, NULL);
}

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

#include "rpm-helper.h"

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

int rpmErrorCb (rpmlogRec rec, rpmlogCallbackData data)
{
	dE("RPM: %s", rpmlogRecMessage(rec));
	return RPMLOG_DEFAULT;
}

void rpmLibsPreload()
{
	rpmReadConfigFiles(NULL, NULL);
}

Fix erro cb return value

probes/rpm: Fix erro cb return value

We have to use RPMLOG_DEFAULT, because RPMLOG_EXIT
cause exit of whole probe.


/**
 * utils.h
 *
 * Copyright (C) 2017 Nickolas Burr <nickolasburr@gmail.com>
 */

#ifndef GIT_STASHD_UTILS_H
#define GIT_STASHD_UTILS_H

#include <dirent.h>
#include <sys/stat.h>
#include <sys/types.h>
#include "common.h"
#include "signals.h"

#ifdef __APPLE__
#include <limits.h>
#else
#include <linux/limits.h>
#endif

/**
 * String utilities
 */

int compare(char *one, char *two);
char *concat(char *buf, char *str);
char *copy(char *buf, char *str);

/**
 * Filesystem utilities
 */

DIR *get_dir(const char *path);
FILE *get_file(const char *filename, const char *filemode);

int is_dir(const char *path);
int is_file(const char *path);
int is_link(const char *path);
int is_sock(const char *path);
int is_fifo(const char *path);
int is_block(const char *path);
int is_char(const char *path);

/**
 * Type utilities
 */

int is_null(void *ptr);

#endif /* GIT_STASHD_UTILS_H */

/**
 * utils.h
 *
 * Copyright (C) 2017 Nickolas Burr <nickolasburr@gmail.com>
 */

#ifndef GIT_STASHD_UTILS_H
#define GIT_STASHD_UTILS_H

#include <dirent.h>
#include <sys/stat.h>
#include <sys/types.h>
#include "common.h"
#include "signals.h"

#ifdef __APPLE__
#include <limits.h>
#else
#include <linux/limits.h>
#endif

/**
 * String utilities
 */

int compare(char *one, char *two);
char *concat(char *buf, char *str);
char *copy(char *buf, char *str);

/**
 * Filesystem utilities
 */

DIR *get_dir(const char *path, int *error);
FILE *get_file(const char *filename, const char *filemode, int *error);
FILE *get_pipe(char *command, char *mode, int *error);

int is_dir(const char *path);
int is_file(const char *path);
int is_link(const char *path);
int is_sock(const char *path);
int is_fifo(const char *path);
int is_block(const char *path);
int is_char(const char *path);

/**
 * Type utilities
 */

int is_null(void *ptr);

#endif /* GIT_STASHD_UTILS_H */

Update get_dir, get_file decls, add get_pipe decl


#ifndef FIX_TYPES_H
#define FIX_TYPES_H

#include <sys/types.h>

/*
The system include file defines this in terms of bzero(), but ANSI says
we should use memset().
*/
#if defined(OSF1)
#undef FD_ZERO
#define FD_ZERO(p)     memset((char *)(p), 0, sizeof(*(p)))
#endif

/*
Various non-POSIX conforming files which depend on sys/types.h will
need these extra definitions...
*/

typedef unsigned int u_int;

#if defined(AIX32)
typedef unsigned short ushort;
#endif

#if defined(ULTRIX42) ||  defined(ULTRIX43)
typedef char * caddr_t;
#endif

#if defined(AIX32)
typedef unsigned long rlim_t;
#endif

#endif

#ifndef FIX_TYPES_H
#define FIX_TYPES_H

	// OSF/1 has this as an "unsigned long", but this is incorrect.  It
	// is used by lseek(), and must be able to hold negative values.
#if defined(OSF1)
#define off_t _hide_off_t
#endif

#include <sys/types.h>

#if defined(OSF1)
#undef off_t
typedef long off_t;
#endif

/*
The system include file defines this in terms of bzero(), but ANSI says
we should use memset().
*/
#if defined(OSF1)
#undef FD_ZERO
#define FD_ZERO(p)     memset((char *)(p), 0, sizeof(*(p)))
#endif

/*
Various non-POSIX conforming files which depend on sys/types.h will
need these extra definitions...
*/

typedef unsigned int u_int;

#if defined(AIX32)
typedef unsigned short ushort;
#endif

#if defined(ULTRIX42) ||  defined(ULTRIX43)
typedef char * caddr_t;
#endif

#if defined(AIX32)
typedef unsigned long rlim_t;
#endif

#endif

Fix up definition of off_t for DecAlpha OSF/1 v1.3.


// RUN: %clang_cc1 -triple i386-apple-darwin9 -verify %s
// <rdar://problem/12415959>

typedef unsigned int u_int32_t;
typedef u_int32_t uint32_t;

typedef unsigned long long u_int64_t;
typedef u_int64_t uint64_t;

int main () {
  uint32_t msr = 0x8b;
  uint64_t val = 0;
  __asm__ volatile("wrmsr"
                   :
                   : "c" (msr),
                     "a" ((val & 0xFFFFFFFFUL)), // expected-error {{invalid input size for constraint 'a'}}
                     "d" (((val >> 32) & 0xFFFFFFFFUL)));
}

// RUN: %clang_cc1 -triple i386-apple-darwin9 -verify %s
// <rdar://problem/12415959>

typedef unsigned int u_int32_t;
typedef u_int32_t uint32_t;

typedef unsigned long long u_int64_t;
typedef u_int64_t uint64_t;

int main () {
  // Error out if size is > 32-bits.
  uint32_t msr = 0x8b;
  uint64_t val = 0;
  __asm__ volatile("wrmsr"
                   :
                   : "c" (msr),
                     "a" ((val & 0xFFFFFFFFUL)), // expected-error {{invalid input size for constraint 'a'}}
                     "d" (((val >> 32) & 0xFFFFFFFFUL)));

  // Don't error out if the size of the destination is <= 32 bits.
  unsigned char data;
  unsigned int port;
  __asm__ volatile("outb %0, %w1" : : "a" (data), "Nd" (port)); // No error expected.
}

Update testcase to show that we don't emit an error for sizes <= 32-bits.

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


#include <uuid/uuid.h>
#include "httpd.h"
#include "http_config.h"

static int generate_uuid(request_rec *r)
{
  char *uuid_str;
  uuid_t uuid;
  uuid_generate_random(uuid);

  uuid_str = (char *)apr_palloc(r->pool, sizeof(char)*37);
  uuid_unparse_lower(uuid, uuid_str);
  apr_table_setn(r->subprocess_env, "UUID", uuid_str);

  return DECLINED;
}

static void register_hooks(apr_pool_t *p)
{
    ap_hook_post_read_request(generate_uuid, NULL, NULL, APR_HOOK_MIDDLE);
}

module AP_MODULE_DECLARE_DATA uuid_module = {
    STANDARD20_MODULE_STUFF,
    NULL,                       /* dir config creater */
    NULL,                       /* dir merger --- default is to override */
    NULL,                       /* server config */
    NULL,                       /* merge server configs */
    NULL,                       /* command apr_table_t */
    register_hooks              /* register hooks */
};

#include <uuid/uuid.h>
#include "httpd.h"
#include "http_config.h"
#include "http_protocol.h"

static int generate_uuid(request_rec *r)
{
  char *uuid_str;
  uuid_t uuid;
  uuid_generate_random(uuid);

  uuid_str = (char *)apr_palloc(r->pool, sizeof(char)*37);
  uuid_unparse_lower(uuid, uuid_str);
  apr_table_setn(r->subprocess_env, "UUID", uuid_str);

  return DECLINED;
}

static void register_hooks(apr_pool_t *p)
{
    ap_hook_post_read_request(generate_uuid, NULL, NULL, APR_HOOK_MIDDLE);
}

module AP_MODULE_DECLARE_DATA uuid_module = {
    STANDARD20_MODULE_STUFF,
    NULL,                       /* dir config creater */
    NULL,                       /* dir merger --- default is to override */
    NULL,                       /* server config */
    NULL,                       /* merge server configs */
    NULL,                       /* command apr_table_t */
    register_hooks              /* register hooks */
};

Add header file for ap_hook_post_read_request to suppress compiler warnings


#include <stdio.h>
#include "libsass/sass_interface.h"

int main(int argc, char** argv)
{
	int ret;

	if (argc < 2) {
		printf("Usage: sassc [INPUT FILE]\n");
		return 0;
	}

	struct sass_file_context* ctx = sass_new_file_context();
	ctx->options.include_paths = "";
	ctx->options.image_path = "images";
	ctx->options.output_style = SASS_STYLE_NESTED;
	ctx->input_path = argv[1];

	sass_compile_file(ctx);

	if (ctx->error_status) {
		if (ctx->error_message)
			printf("%s", ctx->error_message);
		else
			printf("An error occured; no error message available.\n");
		ret = 1;
	}
	else if (ctx->output_string) {
		printf("%s", ctx->output_string);
		ret = 0;
	}
	else {
		printf("Unknown internal error.\n");
		ret = 2;
	}

	sass_free_file_context(ctx);
	return ret;
}

#include <stdio.h>
#include "libsass/sass_interface.h"

int main(int argc, char** argv)
{
	int ret;

	if (argc < 2) {
		printf("Usage: sassc [INPUT FILE]\n");
		return 0;
	}

	struct sass_file_context* ctx = sass_new_file_context();
	ctx->options.include_paths = "";
	ctx->options.image_path = "images";
	ctx->options.output_style = SASS_STYLE_NESTED;
	ctx->input_path = argv[1];

	sass_compile_file(ctx);

	if (ctx->error_status) {
		if (ctx->error_message)
			fprintf(stderr, "%s", ctx->error_message);
		else
			fprintf(stderr, "An error occured; no error message available.\n");
		ret = 1;
	}
	else if (ctx->output_string) {
		printf("%s", ctx->output_string);
		ret = 0;
	}
	else {
		fprintf(stderr, "Unknown internal error.\n");
		ret = 2;
	}

	sass_free_file_context(ctx);
	return ret;
}

Print error messages to stderr.

Print error messages to stderr.


/*****************************************************************************
 * Media Library
 *****************************************************************************
 * Copyright (C) 2021 Hugo Beauzée-Luyssen, Videolabs, VideoLAN
 *
 * Authors: Hugo Beauzée-Luyssen <hugo@beauzee.fr>
 *
 * This program is free software; you can redistribute it and/or modify it
 * under the terms of the GNU Lesser General Public License as published by
 * the Free Software Foundation; either version 2.1 of the License, or
 * (at your option) any later version.
 *
 * This 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 Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public License
 * along with this program; if not, write to the Free Software Foundation,
 * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
 *****************************************************************************/

#pragma once

#include <type_traits>
#include <string>

namespace medialibrary
{
namespace utils
{

template <typename T>
std::string enum_to_string( T value )
{
    static_assert( std::is_enum<T>::value, "This must be used with enum types" );
    return std::to_string( static_cast<std::underlying_type_t<T>>( value ) );
}

}
}

Add an enum_to_string util function

utils: Add an enum_to_string util function

In order to avoid sprinkling 2+ line std::to_string invocations each
time we need to convert an enum value to a string in a SQL request


#include <sys/types.h>
#include <linux/unistd.h>
#include <gettid.h>
#include <errno.h>

/* Patch from Adam Conrad / Ubuntu: Don't use _syscall macro */

#ifdef __NR_gettid
pid_t gettid (void)
{
	return syscall(__NR_gettid);
}
#else

#warn "gettid not available -- substituting with pthread_self()"

#include <pthread.h>
pid_t gettid (void)
{
	return (pid_t)pthread_self();
}
#endif

#include <sys/types.h>
#include <sys/syscall.h>
#include <linux/unistd.h>
#include <gettid.h>
#include <errno.h>
#include <unistd.h>

/* Patch from Adam Conrad / Ubuntu: Don't use _syscall macro */

#ifdef __NR_gettid
pid_t gettid (void)
{
	return syscall(__NR_gettid);
}
#else

#warn "gettid not available -- substituting with pthread_self()"

#include <pthread.h>
pid_t gettid (void)
{
	return (pid_t)pthread_self();
}
#endif

Patch from Fabio Massimo Di Nitto: Fix includes


typedef int myint;
myint x = (myint)1;

int
main(void)
{
	return x-1;
}

Fix test added in 6fe29dd

[tests] Fix test added in 6fe29dd

Tests must have a main function which returns 0.


#ifndef SIMULATOR_H
#define SIMULATOR_H
#include "ros/ros.h"

#include "dynamics.h"
#include "sensor_msgs/Imu.h"
#include "sensor_msgs/FluidPressure.h"
#include "nav_msgs/Odometry.h"
#include "geometry_msgs/Wrench.h"
#include "geometry_msgs/Pose.h"
#include "vortex_msgs/Float64ArrayStamped.h"
#include </usr/include/armadillo>

typedef std::vector<double> stdvec;

class Simulator {
  public:
  	Simulator(unsigned int f,
              ros::NodeHandle nh);
  	void thrustCallback(const vortex_msgs::Float64ArrayStamped &msg);
   void spin();
  private:
    void poseArmaToMsg(const arma::vec &e,
                       geometry_msgs::Pose &m);
    void twistArmaToMsg(const arma::vec &e,
                        geometry_msgs::Twist &m);
  	unsigned int    frequency;
  	ros::NodeHandle nh;
  	ros::Subscriber wrenchSub;
    ros::Publisher  posePub;
    ros::Publisher  twistPub;
    ros::Publisher  imuPub;
    ros::Publisher  pressurePub;
  	Dynamics        *dynamics;
  	arma::vec       u;
};

#endif

Change any tabs to spaces

Change any tabs to spaces


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

int main(int argc, char **argv)
{
    int port;
    char *directory;

    // Command Line Arguments //
    if (argc < 3) {
        printf("usage: %s <port> <dir>\n", argv[0]);
        return 1;
    }
    port = atoi(argv[1]);
    directory = argv[2];

    if (port <= 0) {
        printf("Invalid port provided.\n");
        return 1;
    }

    // TODO server

    return 0;
}

Add the begginning of lab1

Add the begginning of lab1


/* liblouis Braille Translation and Back-Translation Library

Copyright (C) 2014 Mesar Hameed <mesar.hameed@gmail.com>

Copying and distribution of this file, with or without modification,
are permitted in any medium without royalty provided the copyright
notice and this notice are preserved. This file is offered as-is,
without any warranty. */

#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include "liblouis.h"
#include "brl_checks.h"

/* Demonstrates infinite translation loop.
*  Originally reported at: http://www.freelists.org/post/liblouis-liblouisxml/Translating-com-with-UEBCg2ctb-causes-infinite-loop
*/

int main(int argc, char **argv)
{
  int result = 0;
  const char *text = "---.com";
  const char *expected = "";

  result |= check_translation("UEBC-g2.ctb", text, NULL, expected);

  lou_free();

  return result;
}

/* liblouis Braille Translation and Back-Translation Library

Copyright (C) 2014 Mesar Hameed <mesar.hameed@gmail.com>

Copying and distribution of this file, with or without modification,
are permitted in any medium without royalty provided the copyright
notice and this notice are preserved. This file is offered as-is,
without any warranty. */

#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include "liblouis.h"
#include "brl_checks.h"

/* Demonstrates infinite translation loop.
*  Originally reported at: http://www.freelists.org/post/liblouis-liblouisxml/Translating-com-with-UEBCg2ctb-causes-infinite-loop
*/

int main(int argc, char **argv)
{
  int result = 0;
  const char *text = "---.com";
  const char *expected = "";

  result |= check_translation("tables/UEBC-g2.ctb", text, NULL, expected);

  lou_free();

  return result;
}

Fix a path in the translation loop test

Fix a path in the translation loop test


Fix for last commit: adding new test file forgotten.

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


#include <stdio.h>
#include <datastructs.h>

int main(){

    typedef struct user_data {
        char name[100];
        char email[100];
    } user_data;

    user_data a = {"John Doe", "john.doe@mail_server.com"};
    user_data b = {"Jack Smith", "jack.smith@mail_server.com"};
    user_data c = {"Jane Plain", "jane.plain@mail_server.com"};
    user_data d = {"Mary Merry", "mary.merry@mail_server.com"};

    user_data* data = NULL;

    // list creation:
    ds_linked_list* list = ds_linked_list_create();

    ds_linked_list_insert_at(list, &a, 0);
    ds_linked_list_add(list, &b);
    ds_linked_list_add(list, &c);
    ds_linked_list_add(list, &d);

    int i;
    for (i = 0; i < list->size; i ++){
        data = ds_linked_list_get(list, i);
        printf("Name: %s, Email: %s\n", data->name, data->email );
    }

    ds_linked_list_delete(&list);

}

#include <stdio.h>
#include <datastructs.h>

int main(){

    typedef struct user_data {
        char name[100];
        char email[100];
    } user_data;

    user_data a = {"John Doe", "john.doe@mail_server.com"};
    user_data b = {"Jack Smith", "jack.smith@mail_server.com"};
    user_data c = {"Jane Plain", "jane.plain@mail_server.com"};
    user_data d = {"Mary Merry", "mary.merry@mail_server.com"};

    user_data* data = NULL;

    // list creation:
    ds_linked_list* list = ds_linked_list_create();

    ds_linked_list_insert_at(list, &a, 0);
    ds_linked_list_add(list, &b);
    ds_linked_list_add(list, &c);
    ds_linked_list_add(list, &d);

    int i;
    for (i = 0; i < ds_linked_list_length(list); i ++){
        data = ds_linked_list_get(list, i);
        printf("Name: %s, Email: %s\n", data->name, data->email );
    }

    ds_linked_list_delete(&list);

}

Examples: Use ds_linked_list_length() instead of the size struct member.


#include <stdio.h>
#include <string.h>
int getRomanValue(char number);
int checkRomanValue(char romanNumber[20]);
int main()
{
	char romanNumber[20];
	int i, curNum;
	while(1)
	{
		curNum=0;
		printf("Input roman number: ");
		scanf("%s", romanNumber);
		if(checkRomanN(romanNumber)==0)
		{
			printf("Input a valid roman number\n");
			continue;
		}
		for(i=0; i<strlen(romanNumber); i++)
		{
			if(getRomanValue(romanNumber[i])<getRomanValue(romanNumber[i+1]))
			{
				curNum+=getRomanValue(romanNumber[i+1]) - getRomanValue(romanNumber[i]);
				i++;
			}
			else
				curNum+=getRomanValue(romanNumber[i]);
		}
		if(curNum>256)
		{
			printf("Number is larger than 256\n");
			continue;
		}
		else
		{
			printf("Roman number in decimal is: %d\n", curNum);
			break;
		}
	}
	return 1;
}

int getRomanValue(char number)
{
	int value;
	switch(number){
	case 'I':
		value=1;
		break;
	case 'V':
		value=5;
		break;
	case 'X':
		value=10;
		break;
	case 'L':
		value=50;
		break;
	case 'C':
		value=100;
		break;
	}
	return value;
}
int checkRomanN(char romanNumber[20]) //Function to check if inputted string is valid with roman numerals rules
{
	int numerals[5]={0}, correct=1, i; // 0 - I 1 - V 2 - X 3 - L 4 - C XIX
	for(i=0;i<strlen(romanNumber);i++)
	{
		if(romanNumber[i]!='I' && romanNumber[i]!='V' && romanNumber[i]!='X' && romanNumber[i]!='L' && romanNumber[i]!='C')
		{
			switch(romanNumber[i]){
			case 'I':
				numerals[0]++;
				break;
			case 'V':
				numerals[1]++;
				break;
			case 'X':
				numerals[2]++;
				break;
			case 'L':
				numerals[3]++;
				break;
			case 'C':
				numerals[4]++;
				break;
			}
		}
	}
	for(i=0;i<5;i++)
	{
		if(numerals[i]>3)
			return 0;
	}
	return 1;
}

Add Roman Numerals to homework

Add Roman Numerals to homework


#ifndef COMPAT_H
#define COMPAT_H

#include "lua.h"
#include "lauxlib.h"

#if LUA_VERSION_NUM==501
void luaL_setfuncs (lua_State *L, const luaL_Reg *l, int nup);
void *luaL_testudata ( lua_State *L, int arg, const char *tname);
#endif

#endif

#ifndef COMPAT_H
#define COMPAT_H

#include "lua.h"
#include "lauxlib.h"

#if LUA_VERSION_NUM==501
#define luaL_setfuncs socket_setfuncs
#define luaL_testudata socket_testudata
void luaL_setfuncs (lua_State *L, const luaL_Reg *l, int nup);
void *luaL_testudata ( lua_State *L, int arg, const char *tname);
#endif

#endif

Fix static linking problem with LuaJIT

Fix static linking problem with LuaJIT

LuaJIT and LuaSocket both define new Lua APIs from Lua 5.2 (in
particular `luaL_setfuncs` and `luaL_testudata`). When linking both
statically, the one definition rule strikes and linking fails. This
commit fixes the issue by renaming the LuaSocket versions of those
functions behind the scenes using the C preprocessor.

Closes #214


#include "test.h"
#include "app.h"

TEST(app_new) {
  app_t * app = app_new();

  assert(app->running == 0);
  assert(app->io      == 0);

  app_free(app);
}

TEST(current_app_set_to) {
  app_t * app = app_new();

  assert(current_app == 0);

  current_app_set_to(app);

  assert(current_app == app);

  app_free(app);
  current_app_set_to(0);
}

static test_t app_test_suite[] = {
  TEST_REF(app_new),
  0
};

#include <string.h>
#include "test.h"
#include "io.h"
#include "app.h"

TEST(app_new) {
  app_t * app = app_new();

  assert(app->running == 0);
  assert(app->io      == 0);

  app_free(app);
}

TEST(current_app_set_to) {
  app_t * app = app_new();

  assert(current_app == 0);

  current_app_set_to(app);

  assert(current_app == app);

  app_free(app);
  current_app_set_to(0);
}

TEST(app_parse_command_line) {
  app_t * app = app_new();
  int     argc = 3;
  char  * argv[] = {"chip8", "--io", "terminal"};

  app_parse_command_line(app, argc, argv);
  assert(app->io && strcmp(app->io->name, "terminal") == 0);

  app_free(app);
}

static test_t app_test_suite[] = {
  TEST_REF(app_new),
  TEST_REF(app_parse_command_line),
  0
};

Add a failing test for app_parse_command_line