/*
 * Copyright 2018-present Facebook, 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.
 */

#pragma once

#include <type_traits>

#include <folly/Traits.h>

namespace folly {
namespace detail {

struct DefaultTag {};

template <typename T>
struct DefaultMake {
  struct Heap {
    std::unique_ptr<T> ptr{std::make_unique<T>()};
    /* implicit */ operator T&() {
      return *ptr;
    }
  };

  using is_returnable = StrictDisjunction<
      bool_constant<__cplusplus >= 201703ULL>,
      std::is_copy_constructible<T>,
      std::is_move_constructible<T>>;
  using type = std::conditional_t<is_returnable::value, T, Heap>;

  T make(std::true_type) const {
    return T();
  }
  Heap make(std::false_type) const {
    return Heap();
  }

  type operator()() const {
    return make(is_returnable{});
  }
};

template <typename...>
struct TypeTuple {};

} // namespace detail
} // namespace folly

/*
 * Copyright 2018-present Facebook, 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.
 */

#pragma once

#include <type_traits>

#include <folly/Traits.h>

namespace folly {
namespace detail {

struct DefaultTag {};

template <typename T>
struct DefaultMake {
  struct Heap {
    std::unique_ptr<T> ptr{std::make_unique<T>()};
    /* implicit */ operator T&() {
      return *ptr;
    }
  };

  using is_returnable = StrictDisjunction<
      bool_constant<__cplusplus >= 201703ULL>,
      std::is_copy_constructible<T>,
      std::is_move_constructible<T>>;
  using type = std::conditional_t<is_returnable::value, T, Heap>;

  type operator()() const {
    return type();
  }
};

template <typename...>
struct TypeTuple {};

} // namespace detail
} // namespace folly

Remove unnecessary verbosity in DefaultMake

Summary: [Folly] Remove unnecessary verbosity in `DefaultMake`. The shorter version does just as well.

Reviewed By: andriigrynenko

Differential Revision: D13254005

fbshipit-source-id: 6520b813685a4621d8679b7feda24a1a0b75cfd5


//
//  wren_debug.h
//  wren
//
//  Created by Bob Nystrom on 11/29/13.
//  Copyright (c) 2013 Bob Nystrom. All rights reserved.
//

#ifndef wren_wren_debug_h
#define wren_wren_debug_h

#include "wren_value.h"
#include "wren_vm.h"

void wrenDebugPrintStackTrace(WrenVM* vm, ObjFiber* fiber);
int wrenDebugPrintInstruction(WrenVM* vm, ObjFn* fn, int i);
void wrenDebugPrintCode(WrenVM* vm, ObjFn* fn);
void wrenDebugPrintStack(ObjFiber* fiber);

#endif

#ifndef wren_debug_h
#define wren_debug_h

#include "wren_value.h"
#include "wren_vm.h"

void wrenDebugPrintStackTrace(WrenVM* vm, ObjFiber* fiber);
int wrenDebugPrintInstruction(WrenVM* vm, ObjFn* fn, int i);
void wrenDebugPrintCode(WrenVM* vm, ObjFn* fn);
void wrenDebugPrintStack(ObjFiber* fiber);

#endif

Clean up debug header preamble.

Clean up debug header preamble.


#pragma once

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

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

#pragma once

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

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

Increment version number to 1.54

Increment version number to 1.54


/*
 * TODO add copyright notice and GPL licence thingey
 *
 *
 *
 */
#include <nds.h>
#include <stdio.h>
#include <time.h>

#include <dswifi9.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <netdb.h>

#define EMULATOR 1 //TODO automate flipping this in the makefile

/**
 * Interactively lists WiFi connections, allow the user to select one and connect.
 * Supports open connections and WEP secured ones.
 */
int ManualConnect(PrintConsole *top_screen, PrintConsole *bot_screen);
/**
 * Connect using credentials in WFC bank.
 * Writes output to supplied terminal, acts silently if none is provided.
 */
int WFCConnect(PrintConsole *console);

/**
 * Standard keyboard callback placeholder
 */
void OnKeyPressed(int key);

/**
 * Entry point of the application
 */
int main();

Split the main file into .c and .h files to make breaking it up later easier.


//
//  DZVideoPlayerViewControllerConfiguration.h
//  Pods
//
//  Created by Denis Zamataev on 15/07/15.
//
//

#import <Foundation/Foundation.h>

@interface DZVideoPlayerViewControllerConfiguration : NSObject

@property (assign, nonatomic) BOOL isBackgroundPlaybackEnabled; // defaults to NO
@property (strong, nonatomic) NSMutableArray *viewsToHideOnIdle; // has topToolbarView and bottomToolbarView by default
@property (assign, nonatomic) NSTimeInterval delayBeforeHidingViewsOnIdle; // defaults to 3 seconds
@property (assign, nonatomic) BOOL isShowFullscreenExpandAndShrinkButtonsEnabled; // defaults to YES
@property (assign, nonatomic) BOOL isHideControlsOnIdleEnabled; // defaults to YES

@end

//
//  DZVideoPlayerViewControllerConfiguration.h
//  Pods
//
//  Created by Denis Zamataev on 15/07/15.
//
//

#import <Foundation/Foundation.h>

@interface DZVideoPlayerViewControllerConfiguration : NSObject

@property (assign, nonatomic) BOOL isBackgroundPlaybackEnabled; // defaults to YES
@property (strong, nonatomic) NSMutableArray *viewsToHideOnIdle; // has topToolbarView and bottomToolbarView by default
@property (assign, nonatomic) NSTimeInterval delayBeforeHidingViewsOnIdle; // defaults to 3 seconds
@property (assign, nonatomic) BOOL isShowFullscreenExpandAndShrinkButtonsEnabled; // defaults to YES
@property (assign, nonatomic) BOOL isHideControlsOnIdleEnabled; // defaults to YES

@end

Fix wrong comment in configuration

Fix wrong comment in configuration


// Copyright (c) 2006- Facebook
// Distributed under the Thrift Software License
//
// See accompanying file LICENSE or visit the Thrift site at:
// http://developers.facebook.com/thrift/

#ifndef T_ENUM_H
#define T_ENUM_H

#include "t_enum_value.h"
#include <vector>

/**
 * An enumerated type. A list of constant objects with a name for the type.
 *
 * @author Mark Slee <mcslee@facebook.com>
 */
class t_enum : public t_type {
 public:
  t_enum(t_program* program) :
    t_type(program) {}

  void set_name(std::string name) {
    name_ = name;
  }

  void append(t_enum_value* constant) {
    constants_.push_back(constant);
  }

  const std::vector<t_enum_value*>& get_constants() {
    return constants_;
  }

  bool is_enum() const {
    return true;
  }

  virtual std::string get_fingerprint_material() const {
    return "enum";
  }

 private:
  std::vector<t_enum_value*> constants_;
};

#endif

// Copyright (c) 2006- Facebook
// Distributed under the Thrift Software License
//
// See accompanying file LICENSE or visit the Thrift site at:
// http://developers.facebook.com/thrift/

#ifndef T_ENUM_H
#define T_ENUM_H

#include "t_enum_value.h"
#include <vector>

/**
 * An enumerated type. A list of constant objects with a name for the type.
 *
 * @author Mark Slee <mcslee@facebook.com>
 */
class t_enum : public t_type {
 public:
  t_enum(t_program* program) :
    t_type(program) {}

  void set_name(const std::string& name) {
    name_ = name;
  }

  void append(t_enum_value* constant) {
    constants_.push_back(constant);
  }

  const std::vector<t_enum_value*>& get_constants() {
    return constants_;
  }

  bool is_enum() const {
    return true;
  }

  virtual std::string get_fingerprint_material() const {
    return "enum";
  }

 private:
  std::vector<t_enum_value*> constants_;
};

#endif

Fix set_name compiler method signature

Fix set_name compiler method signature

Reviewed By: kholst

Other Notes: Follow up from 78130

git-svn-id: 8d8e29b1fb681c884914062b88f3633e3a187774@665434 13f79535-47bb-0310-9956-ffa450edef68


Add prototype for heap_getattr() to quiet compiler


/*
 * Copyright © 2009 CNRS, INRIA, Université Bordeaux 1
 * Copyright © 2009 Cisco Systems, Inc.  All rights reserved.
 * See COPYING in top-level directory.
 */

#include <hwloc.h>
#include <stdio.h>

int main(int argc, char *argv[])
{
    mytest_hwloc_topology_t topology;
    unsigned depth;
    hwloc_cpuset_t cpu_set;

    /* Just call a bunch of functions to see if we can link and run */

    cpu_set = mytest_hwloc_cpuset_alloc();
    mytest_hwloc_topology_init(&topology);
    mytest_hwloc_topology_load(topology);
    depth = mytest_hwloc_topology_get_depth(topology);
    printf("Max depth: %u\n", depth);
    mytest_hwloc_topology_destroy(topology);
    mytest_hwloc_cpuset_free(cpu_set);

    return 0;
}

/*
 * Copyright © 2009 CNRS, INRIA, Université Bordeaux 1
 * Copyright © 2009 Cisco Systems, Inc.  All rights reserved.
 * See COPYING in top-level directory.
 */

#include <hwloc.h>
#include <stdio.h>

int main(int argc, char *argv[])
{
    mytest_hwloc_topology_t topology;
    unsigned depth;
    hwloc_cpuset_t cpu_set;

    /* Just call a bunch of functions to see if we can link and run */

    printf("*** Test 1: cpuset alloc\n");
    cpu_set = mytest_hwloc_cpuset_alloc();
    printf("*** Test 2: topology init\n");
    mytest_hwloc_topology_init(&topology);
    printf("*** Test 3: topology load\n");
    mytest_hwloc_topology_load(topology);
    printf("*** Test 4: topology get depth\n");
    depth = mytest_hwloc_topology_get_depth(topology);
    printf("    Max depth: %u\n", depth);
    printf("*** Test 5: topology destroy\n");
    mytest_hwloc_topology_destroy(topology);
    printf("*** Test 6: cpuset free\n");
    mytest_hwloc_cpuset_free(cpu_set);

    return 0;
}

Add some more print statements to this test, ju...

Add some more print statements to this test, just to help
differentiate the output when debugging is enabled

This commit was SVN r1752.


#include <stdlib.h>
#include <stdio.h>
#include <time.h>
#include "julina.h"

int main(int argc, char **argv) {
    srand(time(NULL));

    double aa[] = {2, 0, 1,
                   -2, 3, 4,
                   -5, 5, 6};
    Matrix *a = new_matrix(aa, 3, 3);
    Matrix *ain = inverse(a);

    double bb[] = {1, -1, -2,
                   2, 4, 5,
                   6, 0, -3};
    Matrix *b = new_matrix(bb, 3, 3);
    Matrix *bin = inverse(b);

    print_matrix(a);
    if (ain == ERR_SINGULAR_MATRIX_INVERSE) {
        printf("Inverse of singular matrix.\n");
    } else {
        print_matrix(ain);
    }

    print_matrix(b);
    if (bin == ERR_SINGULAR_MATRIX_INVERSE) {
        printf("Inverse of singular matrix.\n");
    } else {
        print_matrix(bin);
    }

    free_matrix(a);
    free_matrix(ain);
    free_matrix(b);
    free_matrix(bin);
}

#include <stdlib.h>
#include <stdio.h>
#include <time.h>
#include "julina.h"

#define VARIABLE_START 'A'
#define VARIABLE_COUNT 26
static Matrix *variables[VARIABLE_COUNT];

Matrix *get_variable(int c) {
    if (c < 0 || c >= VARIABLE_COUNT) {
        return NULL;
    }
    return variables[c - VARIABLE_START];
}

// Returns -1 on failure, 0 on success.
int set_variable(int c, Matrix *a) {
    if (c < 0 || c >= VARIABLE_COUNT) {
        return -1;
    }
    variables[c - VARIABLE_START] = a;
    return 0;
}

/*
 * Format:
 * 3 2 : 1 2 3 4 5 6
 * Yields:
 * [[1 2]
 *  [3 4]
 *  [5 6]]
 */
Matrix *read_matrix(char *s) {
    int rows, cols, size;
    rows = strtol(s, &s, 10);
    cols = strtol(s, &s, 10);
    size = rows * cols;
    double aa[size];
    s += 3; // space colon space
    int i;
    for (i = 0; i < size; i++) {
        aa[i] = strtol(s, &s, 10);
    }
    return new_matrix(aa, rows, cols);
}

int main(int argc, char **argv) {
    srand(time(NULL));

    Matrix *a = read_matrix("6 1 : 1 0 0 0 0 1");
    print_matrix(a);
    free_matrix(a);
}

Add variables and reading from string.

Add variables and reading from string.


#ifndef __LIBCT_ERRORS_H__
#define __LIBCT_ERRORS_H__
/*
 * This file contains errors, that can be returned from various
 * library calls
 */

/* Generic */
#define LCTERR_BADCTSTATE	-2	/* Bad container state */
#define LCTERR_BADFSTYPE	-3	/* Bad FS type */
#define LCTERR_BADNETTYPE	-4	/* Bad Net type */
#define LCTERR_BADOPTION	-5	/* Bad option requested */

/* RPC-specific ones */
#define LCTERR_BADCTRID		-42	/* Bad container remote ID given */
#define LCTERR_BADCTRNAME	-43	/* Bad name on open */
#define LCTERR_RPCUNKNOWN	-44	/* Remote problem , but err is not given */
#define LCTERR_RPCCOMM		-45	/* Error communicating via channel */

#endif /* __LIBCT_ERRORS_H__ */

#ifndef __LIBCT_ERRORS_H__
#define __LIBCT_ERRORS_H__
/*
 * This file contains errors, that can be returned from various
 * library calls
 */

/*
 * -1 is "reserved" for generic "something went wrong" result
 * since this value can be (well, is) widely explicitly used
 * all over the code.
 */

/* Generic */
#define LCTERR_BADCTSTATE	-2	/* Bad container state */
#define LCTERR_BADFSTYPE	-3	/* Bad FS type */
#define LCTERR_BADNETTYPE	-4	/* Bad Net type */
#define LCTERR_BADOPTION	-5	/* Bad option requested */

/* RPC-specific ones */
#define LCTERR_BADCTRID		-42	/* Bad container remote ID given */
#define LCTERR_BADCTRNAME	-43	/* Bad name on open */
#define LCTERR_RPCUNKNOWN	-44	/* Remote problem , but err is not given */
#define LCTERR_RPCCOMM		-45	/* Error communicating via channel */

#endif /* __LIBCT_ERRORS_H__ */

Add comment about "reserved" -1 value

err: Add comment about "reserved" -1 value

Signed-off-by: Pavel Emelyanov <c9a32589e048e044184536f7ac71ef92fe82df3e@parallels.com>


@import Foundation;

NS_ASSUME_NONNULL_BEGIN

/// Allows you to customize the style for the the view
/// controllers for your libraries.

@interface CPDStyle : NSObject

/// HTML provided to the view controller, it's nothing too fancy
/// just a string which has a collection of string replacements on it.
///
/// This is the current default:
/// {{STYLESHEET}}<meta name='viewport' content='width=device-width'>{{HEADER}}
{{BODY}}

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

/// CSS for styling your library
///
/// This is the current default:
///

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

/// HTML specifically for showing the header information about a library
///
/// This is the current default
///
{{SUMMARY}}

{{VERSION}}

{{SHORT_LICENSE}}

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

@end

NS_ASSUME_NONNULL_END

Fix 'HTML start tag prematurely ended' warning


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

#ifndef ST_HW_HC_SR04
#define ST_HW_HC_SR04

#include "Arduino.h"

class ST_HW_HC_SR04 {
    public:
        ST_HW_HC_SR04(byte triggerPin, byte echoPin);
        ST_HW_HC_SR04(byte triggerPin, byte echoPin, unsigned long timeout);
        void setTimeout(unsigned long timeout);
        void setTimeoutToDefaultValue();
        unsigned long getTimeout();
        int getHitTime();

    private:
        byte triggerPin;
        byte echoPin;
        unsigned long timeout;

        void triggerPulse();
};

#endif

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

#ifndef ST_HW_HC_SR04_H
#define ST_HW_HC_SR04_H

#include "Arduino.h"

class ST_HW_HC_SR04 {
    public:
        ST_HW_HC_SR04(byte triggerPin, byte echoPin);
        ST_HW_HC_SR04(byte triggerPin, byte echoPin, unsigned long timeout);
        void setTimeout(unsigned long timeout);
        void setTimeoutToDefaultValue();
        unsigned long getTimeout();
        int getHitTime();

    private:
        byte triggerPin;
        byte echoPin;
        unsigned long timeout;

        void triggerPulse();
};

#endif

Fix include guard conflicting with the class name


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

#ifndef SADIE_LIBS_INCS_AC_BITS_H
#define SADIE_LIBS_INCS_AC_BITS_H

#define AC_BIT(type, n) (((type)1) << n)

#endif

Add AC_BITS to convert a bit number 0..N-1 to a mask.


#ifndef PROPOSER_H
#define PROPOSER_H

#include <boost/shared_ptr.hpp>
#include <vector>
#include <map>
#include "proctor/detector.h"
#include "proctor/database_entry.h"

namespace pcl
{

  namespace proctor
  {

    struct Candidate {
      std::string id;
      float votes;
    };

    class Proposer {
      public:
        typedef boost::shared_ptr<Proposer> Ptr;
        typedef boost::shared_ptr<const Proposer> ConstPtr;

        typedef boost::shared_ptr<std::map<std::string, Entry> > DatabasePtr;
        typedef boost::shared_ptr<const std::map<std::string, Entry> > ConstDatabasePtr;

        Proposer()
        {}

        void
        setDatabase(const DatabasePtr database)
        {
          database_ = database;
        }

        virtual void
        getProposed(int max_num, Entry &query, std::vector<std::string> &input, std::vector<std::string> &output) = 0;

        virtual void
        selectBestCandidates(int max_num, vector<Candidate> &ballot, std::vector<std::string> &output);

      protected:
        DatabasePtr database_;
    };

  }
}

#endif

#ifndef PROPOSER_H
#define PROPOSER_H

#include <boost/shared_ptr.hpp>
#include <vector>
#include <map>
#include "proctor/detector.h"
#include "proctor/database_entry.h"

namespace pcl
{

  namespace proctor
  {

    struct Candidate {
      std::string id;
      double votes;
    };

    class Proposer {
      public:
        typedef boost::shared_ptr<Proposer> Ptr;
        typedef boost::shared_ptr<const Proposer> ConstPtr;

        typedef boost::shared_ptr<std::map<std::string, Entry> > DatabasePtr;
        typedef boost::shared_ptr<const std::map<std::string, Entry> > ConstDatabasePtr;

        Proposer()
        {}

        void
        setDatabase(const DatabasePtr database)
        {
          database_ = database;
        }

        virtual void
        getProposed(int max_num, Entry &query, std::vector<std::string> &input, std::vector<std::string> &output) = 0;

        virtual void
        selectBestCandidates(int max_num, vector<Candidate> &ballot, std::vector<std::string> &output);

      protected:
        DatabasePtr database_;
    };

  }
}

#endif

Change votes to use double.

Change votes to use double.

git-svn-id: 1af002208e930b4d920e7c2b948d1e98a012c795@4320 a9d63959-f2ad-4865-b262-bf0e56cfafb6


#include <stm32f4xx.h>
#include <stm32f4xx_gpio.h>

void delay(uint32_t count)
{
	while(count--);
}

void init_GPIO()
{
	GPIO_InitTypeDef GPIO_InitStruct = {
		.GPIO_Pin = GPIO_Pin_12 | GPIO_Pin_13 | GPIO_Pin_14 | GPIO_Pin_15,
		.GPIO_Mode = GPIO_Mode_OUT,
		.GPIO_Speed = GPIO_Speed_50MHz,
		.GPIO_OType =GPIO_OType_PP,
		.GPIO_PuPd = GPIO_PuPd_DOWN
	};

	RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_GPIOD, ENABLE);

	GPIO_Init(GPIOD, &GPIO_InitStruct);
}

int main()
{
	init_GPIO();

	GPIO_SetBits(GPIOD, GPIO_Pin_12);

	return 0;
}

#include <stm32f4xx.h>
#include <stm32f4xx_gpio.h>

void delay(uint32_t count)
{
	while(count--);
}

void init_GPIO()
{
	GPIO_InitTypeDef GPIO_InitStruct = {
		.GPIO_Pin = GPIO_Pin_12 | GPIO_Pin_13 | GPIO_Pin_14 | GPIO_Pin_15,
		.GPIO_Mode = GPIO_Mode_OUT,
		.GPIO_Speed = GPIO_Speed_50MHz,
		.GPIO_OType =GPIO_OType_PP,
		.GPIO_PuPd = GPIO_PuPd_DOWN
	};

	RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_GPIOD, ENABLE);

	GPIO_Init(GPIOD, &GPIO_InitStruct);
}

int main()
{
	init_GPIO();

	int digitStatus = 1;

	while(1) {
		GPIO_WriteBit(GPIOD, GPIO_Pin_12, digitStatus);
		delay(1000000L);
		GPIO_WriteBit(GPIOD, GPIO_Pin_13, digitStatus);
		delay(1000000L);
		GPIO_WriteBit(GPIOD, GPIO_Pin_14, digitStatus);
		delay(1000000L);
		GPIO_WriteBit(GPIOD, GPIO_Pin_15, digitStatus);
		delay(1000000L);

		digitStatus = (digitStatus + 1) % 2;
	}

	return 0;
}

Add the blink effect to the GPIO demo

Add the blink effect to the GPIO demo


//
//  APIConstant.h
//  PHPHub
//
//  Created by Aufree on 9/30/15.
//  Copyright (c) 2015 ESTGroup. All rights reserved.
//

#define APIAccessTokenURL [NSString stringWithFormat:@"%@%@", APIBaseURL, @"/oauth/access_token"]
#define QiniuUploadTokenIdentifier @"QiniuUploadTokenIdentifier"

#if DEBUG
#define APIBaseURL      @"https://staging_api.phphub.org"
#else
#define APIBaseURL      @"https://api.phphub.org"
#endif

#define PHPHubHost      @"phphub.org"
#define PHPHubUrl       @"https://phphub.org/"
#define GitHubURL       @"https://github.com/"
#define TwitterURL      @"https://twitter.com/"
#define ProjectURL      @"https://github.com/phphub/phphub-ios"
#define AboutPageURL    @"https://phphub.org/about"
#define ESTGroupURL     @"http://est-group.org"
#define PHPHubGuide     @"https://phphub.org/guide"
#define SinaRedirectURL @"http://sns.whalecloud.com/sina2/callback"

//
//  APIConstant.h
//  PHPHub
//
//  Created by Aufree on 9/30/15.
//  Copyright (c) 2015 ESTGroup. All rights reserved.
//

#define APIAccessTokenURL [NSString stringWithFormat:@"%@%@", APIBaseURL, @"/oauth/access_token"]
#define QiniuUploadTokenIdentifier @"QiniuUploadTokenIdentifier"

#if DEBUG
#define APIBaseURL      @"https://staging_api.phphub.org"
#else
#define APIBaseURL      @"https://api.phphub.org"
#endif

#define PHPHubHost      @"phphub.org"
#define PHPHubUrl       @"https://phphub.org/"
#define GitHubURL       @"https://github.com/"
#define TwitterURL      @"https://twitter.com/"
#define ProjectURL      @"https://github.com/phphub/phphub-ios"
#define AboutPageURL    @"https://phphub.org/about"
#define ESTGroupURL     @"http://est-group.org"
#define PHPHubGuide     @"https://phphub.org/helps/qr-login-guide"
#define SinaRedirectURL @"http://sns.whalecloud.com/sina2/callback"

Change QR login guide url

Change QR login guide url


#ifndef _PROJECT_CONFIG_H_
#define _PROJECT_CONFIG_H_

#ifdef USART_DEBUG // this happens by 'make USART_DEBUG=1'
#undef THERMAL_DATA_UART
#else
#define USART_DEBUG
#define THERMAL_DATA_UART
#endif
#define TMP007_OVERLAY
#define SPLASHSCREEN_OVERLAY
#define ENABLE_LEPTON_AGC
// #define Y16

#ifndef Y16
// Values from LEP_PCOLOR_LUT_E in Middlewares/lepton_sdk/Inc/LEPTON_VID.h
#define PSUEDOCOLOR_LUT LEP_VID_FUSION_LUT
#endif

#ifndef USART_DEBUG_SPEED
#define USART_DEBUG_SPEED (921600)
#endif

#define WHITE_LED_TOGGLE  (HAL_GPIO_TogglePin(GPIOA, GPIO_PIN_6))

#endif

#ifndef _PROJECT_CONFIG_H_
#define _PROJECT_CONFIG_H_

#ifdef USART_DEBUG // this happens by 'make USART_DEBUG=1'
#undef THERMAL_DATA_UART
#else
#define USART_DEBUG
// #define THERMAL_DATA_UART
#endif
#define TMP007_OVERLAY
#define SPLASHSCREEN_OVERLAY
#define ENABLE_LEPTON_AGC
// #define Y16

#ifndef Y16
// Values from LEP_PCOLOR_LUT_E in Middlewares/lepton_sdk/Inc/LEPTON_VID.h
#define PSUEDOCOLOR_LUT LEP_VID_FUSION_LUT
#endif

#ifndef USART_DEBUG_SPEED
#define USART_DEBUG_SPEED (921600)
#endif

#define WHITE_LED_TOGGLE  (HAL_GPIO_TogglePin(GPIOA, GPIO_PIN_6))

#endif

Disable THERMAL_DATA_UART by default. This is a big CPU sink, and is a pretty non-standard config.


/*
 * Copyright (c) 2015 Wind River Systems, 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.
 */

/**
 * @file
 * @brief Initialize system clock driver
 *
 * Initializing the timer driver is done in this module to reduce code
 * duplication.  Although both nanokernel and microkernel systems initialize
 * the timer driver at the same point, the two systems differ in when the system
 * can begin to process system clock ticks.  A nanokernel system can process
 * system clock ticks once the driver has initialized.  However, in a
 * microkernel system all system clock ticks are deferred (and stored on the
 * kernel server command stack) until the kernel server fiber starts and begins
 * processing any queued ticks.
 */

#include <nanokernel.h>
#include <init.h>
#include <drivers/system_timer.h>

SYS_INIT(_sys_clock_driver_init,
#ifdef CONFIG_MICROKERNEL
	MICROKERNEL,
#else
	NANOKERNEL,
#endif
	CONFIG_SYSTEM_CLOCK_INIT_PRIORITY);

/*
 * Copyright (c) 2015 Wind River Systems, 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.
 */

/**
 * @file
 * @brief Initialize system clock driver
 *
 * Initializing the timer driver is done in this module to reduce code
 * duplication.  Although both nanokernel and microkernel systems initialize
 * the timer driver at the same point, the two systems differ in when the system
 * can begin to process system clock ticks.  A nanokernel system can process
 * system clock ticks once the driver has initialized.  However, in a
 * microkernel system all system clock ticks are deferred (and stored on the
 * kernel server command stack) until the kernel server fiber starts and begins
 * processing any queued ticks.
 */

#include <nanokernel.h>
#include <init.h>
#include <drivers/system_timer.h>

SYS_INIT(_sys_clock_driver_init, NANOKERNEL, CONFIG_SYSTEM_CLOCK_INIT_PRIORITY);

Revert "sys_clock: start the microkernel ticker in the MICROKERNEL init level"

This reverts commit 3c66686a43ffa78932aaa6b1e2338c2f3d347a13.

That commit fixed announcing ticks before the microkernel was up, but
prevented devices initializing before the MICROKERNEL level from having
access to the hi-res part of the system clock, which they could not poll
anymore.

Change-Id: Ia1c55d482e63d295160942f97ebc8e8afd1e8315
Signed-off-by: Benjamin Walsh <578db18f23ec223e50c404886c947386478a464e@windriver.com>


//===--- Algorithm.h - ------------------------------------------*- C++ -*-===//
//
// This source file is part of the Swift.org open source project
//
// Copyright (c) 2014 - 2016 Apple Inc. and the Swift project authors
// Licensed under Apache License v2.0 with Runtime Library Exception
//
// See http://swift.org/LICENSE.txt for license information
// See http://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
//
//===----------------------------------------------------------------------===//
//
//  This file defines helper algorithms, some of which are ported from C++14,
//  which may not be available on all platforms yet.
//
//===----------------------------------------------------------------------===//

#ifndef SWIFT_BASIC_ALGORITHM_H
#define SWIFT_BASIC_ALGORITHM_H

namespace swift {
  /// Returns the minimum of `a` and `b`, or `a` if they are equivalent.
  template <typename T>
  constexpr const T& min(const T &a, const T &b) {
    return !(b < a) ? a : b;
  }
} // end namespace swift

#endif /* SWIFT_BASIC_ALGORITHM_H */

//===--- Algorithm.h - ------------------------------------------*- C++ -*-===//
//
// This source file is part of the Swift.org open source project
//
// Copyright (c) 2014 - 2016 Apple Inc. and the Swift project authors
// Licensed under Apache License v2.0 with Runtime Library Exception
//
// See http://swift.org/LICENSE.txt for license information
// See http://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
//
//===----------------------------------------------------------------------===//
//
//  This file defines helper algorithms, some of which are ported from C++14,
//  which may not be available on all platforms yet.
//
//===----------------------------------------------------------------------===//

#ifndef SWIFT_BASIC_ALGORITHM_H
#define SWIFT_BASIC_ALGORITHM_H

namespace swift {
  /// Returns the minimum of `a` and `b`, or `a` if they are equivalent.
  template <typename T>
  constexpr const T& min(const T &a, const T &b) {
    return !(b < a) ? a : b;
  }

  /// Returns the maximum of `a` and `b`, or `a` if they are equivalent.
  template <typename T>
  constexpr const T& max(const T &a, const T &b) {
    return (a < b) ? b : a;
  }
} // end namespace swift

#endif /* SWIFT_BASIC_ALGORITHM_H */

Add constexpr version of maximum to algorithm

Add the constexpr version of max which is only available in std since c++14.
Besides being a logical addition next to the already implemented constexpr version of min, there are actually other files, even in Swift/Basic itself, which re-implement this functionality, such as PrefixMap.h. Once this is implemented here, the functionality can be re-used in those other locations, instead of re-implemented each time.


C $Header: /u/gcmpack/MITgcm/pkg/dic/DIC_ATMOS.h,v 1.4 2010/04/11 20:59:27 jmc Exp $
C $Name:  $

       COMMON /INTERACT_ATMOS_NEEDS/
     &              co2atmos,
     &              total_atmos_carbon, total_ocean_carbon,
     &              total_atmos_carbon_year,
     &              total_ocean_carbon_year,
     &              total_atmos_carbon_start,
     &              total_ocean_carbon_start,
     &              atpco2,total_atmos_moles

       _RL co2atmos(1000)
       _RL total_atmos_carbon
       _RL total_ocean_carbon
       _RL total_atmos_carbon_year
       _RL total_atmos_carbon_start
       _RL total_ocean_carbon_year
       _RL total_ocean_carbon_start
       _RL atpco2
       _RL total_atmos_moles

C $Header: /u/gcmpack/MITgcm/pkg/dic/DIC_ATMOS.h,v 1.4 2010/04/11 20:59:27 jmc Exp $
C $Name:  $

       COMMON /INTERACT_ATMOS_NEEDS/
     &              co2atmos,
     &              total_atmos_carbon, total_ocean_carbon,
     &              total_atmos_carbon_year,
     &              total_ocean_carbon_year,
     &              total_atmos_carbon_start,
     &              total_ocean_carbon_start,
     &              atpco2,total_atmos_moles

       _RL co2atmos(1002)
       _RL total_atmos_carbon
       _RL total_ocean_carbon
       _RL total_atmos_carbon_year
       _RL total_atmos_carbon_start
       _RL total_ocean_carbon_year
       _RL total_ocean_carbon_start
       _RL atpco2
       _RL total_atmos_moles

Update length of co2atmos variable

Update length of co2atmos variable


//
//  VPUSupport.h
//  QTMultiGPUTextureIssue
//
//  Created by Tom Butterworth on 15/05/2012.
//  Copyright (c) 2012 Tom Butterworth. All rights reserved.
//

#ifndef QTMultiGPUTextureIssue_VPUSupport_h
#define QTMultiGPUTextureIssue_VPUSupport_h

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

#define kVPUSPixelFormatTypeRGB_DXT1 'DXt1'
#define kVPUSPixelFormatTypeRGBA_DXT1 'DXT1'
#define kVPUSPixelFormatTypeRGBA_DXT5 'DXT5'
#define kVPUSPixelFormatTypeYCoCg_DXT5 'DYT5'

BOOL VPUSMovieHasVPUTrack(QTMovie *movie);
CFDictionaryRef VPUCreateCVPixelBufferOptionsDictionary();

#endif

//
//  VPUSupport.h
//  QTMultiGPUTextureIssue
//
//  Created by Tom Butterworth on 15/05/2012.
//  Copyright (c) 2012 Tom Butterworth. All rights reserved.
//

#ifndef QTMultiGPUTextureIssue_VPUSupport_h
#define QTMultiGPUTextureIssue_VPUSupport_h

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

#define kVPUSPixelFormatTypeRGB_DXT1 'DXt1'
#define kVPUSPixelFormatTypeRGBA_DXT1 'DXT1'
#define kVPUSPixelFormatTypeRGBA_DXT5 'DXT5'
#define kVPUSPixelFormatTypeYCoCg_DXT5 'DYt5'

BOOL VPUSMovieHasVPUTrack(QTMovie *movie);
CFDictionaryRef VPUCreateCVPixelBufferOptionsDictionary();

#endif

Update pixel format type for CoreVideo Scaled YCoCg DXT5 to match change in codec


#include <stdio.h>
#include "event_service.h"
#include "touchscreen.h"
#include "device.h"

typedef struct event {
    int32_t device;
    int16_t val;
    // union here for other events like keys
} event;

#define INPUT_QUEUE_SIZE 128
static event input_queue[INPUT_QUEUE_SIZE];
// The next time that needs to be read:
static int input_queue_head = 0;
// The number of items in the queue (tail = (head + length) % len):
static int input_queue_length = 0;

static int mousex = -1; // valuator for touchscreen X
static int mousey = -1; // valuator for touchscreen X

static void enqueue_event(event *e)
{
    if (input_queue_length == INPUT_QUEUE_SIZE) {
        printf("Input queue overflow.");
    } else {
        int tail = (input_queue_head + input_queue_length) % INPUT_QUEUE_SIZE;
        input_queue[tail] = *e;
        input_queue_length++;
    }
}

static void drain_touchscreen()
{
    int x, y;
    float z;

    TouchscreenEvent e;
    event ev;
    while((e = touchscreen_read(&x, &y, &z)) != TOUCHSCREEN_IDLE) {
	switch(e) {
	    case TOUCHSCREEN_START:
		ev.device = LEFTMOUSE;
		ev.val = 1;
		enqueue_event(&ev);
		break;
	    case TOUCHSCREEN_DRAG:
		mousex = x;
		mousey = y;
		break;
	    case TOUCHSCREEN_STOP:
		ev.device = LEFTMOUSE;
		ev.val = 0;
		enqueue_event(&ev);
		break;
	    case TOUCHSCREEN_IDLE:
	    default:
		break;
	}
    }

    // usleep(100000);
}

int32_t events_get_valuator(int32_t device)
{
    drain_touchscreen();
    if(device == MOUSEX)
	return mousex;
    else if(device == MOUSEY)
	return mousey;
    return 0;
}

void events_qdevice(int32_t device)
{
}

uint32_t event_qread_start(int blocking)
{
    drain_touchscreen();
    return input_queue_length;
}

int32_t events_qread_continue(int16_t *value)
{
    *value = input_queue[input_queue_head].val;
    int32_t device = input_queue[input_queue_head].device;
    input_queue_head = (input_queue_head + 1) % INPUT_QUEUE_SIZE;
    input_queue_length--;
    return device;
}

int32_t events_winopen(char *title)
{
    touchscreen_init();
    drain_touchscreen();
    return 0;
}

void events_tie(int32_t button, int32_t val1, int32_t val2)
{
}

Add beginnings of events on hardware

Add beginnings of events on hardware


//===-- LoopConvert/LoopConvert.h - C++11 for-loop migration ----*- C++ -*-===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
///
/// \file
/// \brief This file provides the definition of the LoopConvertTransform
/// class which is the main interface to the loop-convert transform
/// that tries to make use of range-based for loops where possible.
///
//===----------------------------------------------------------------------===//
#ifndef LLVM_TOOLS_CLANG_TOOLS_EXTRA_CPP11_MIGRATE_LOOP_CONVERT_H
#define LLVM_TOOLS_CLANG_TOOLS_EXTRA_CPP11_MIGRATE_LOOP_CONVERT_H

#include "Transform.h"
#include "llvm/Support/Compiler.h" // For LLVM_OVERRIDE

/// \brief Subclass of Transform that transforms for-loops into range-based
/// for-loops where possible.
class LoopConvertTransform : public Transform {
public:

  /// \brief \see Transform::run().
  virtual int apply(const FileContentsByPath &InputStates,
                    RiskLevel MaxRiskLevel,
                    const clang::tooling::CompilationDatabase &Database,
                    const std::vector<std::string> &SourcePaths,
                    FileContentsByPath &ResultStates) LLVM_OVERRIDE;
};

#endif // LLVM_TOOLS_CLANG_TOOLS_EXTRA_CPP11_MIGRATE_LOOP_CONVERT_H

//===-- LoopConvert/LoopConvert.h - C++11 for-loop migration ----*- C++ -*-===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
///
/// \file
/// \brief This file provides the definition of the LoopConvertTransform
/// class which is the main interface to the loop-convert transform
/// that tries to make use of range-based for loops where possible.
///
//===----------------------------------------------------------------------===//
#ifndef LLVM_TOOLS_CLANG_TOOLS_EXTRA_CPP11_MIGRATE_LOOP_CONVERT_H
#define LLVM_TOOLS_CLANG_TOOLS_EXTRA_CPP11_MIGRATE_LOOP_CONVERT_H

#include "Transform.h"
#include "llvm/Support/Compiler.h" // For LLVM_OVERRIDE

/// \brief Subclass of Transform that transforms for-loops into range-based
/// for-loops where possible.
class LoopConvertTransform : public Transform {
public:

  /// \see Transform::run().
  virtual int apply(const FileContentsByPath &InputStates,
                    RiskLevel MaxRiskLevel,
                    const clang::tooling::CompilationDatabase &Database,
                    const std::vector<std::string> &SourcePaths,
                    FileContentsByPath &ResultStates) LLVM_OVERRIDE;
};

#endif // LLVM_TOOLS_CLANG_TOOLS_EXTRA_CPP11_MIGRATE_LOOP_CONVERT_H

Fix a -Wdocumentation warning (empty paragraph passed to '\brief' command)

git-svn-id: a34e9779ed74578ad5922b3306b3d80a0c825546@172661 91177308-0d34-0410-b5e6-96231b3b80d8


#ifndef SkEdgeBuilder_DEFINED
#define SkEdgeBuilder_DEFINED

#include "SkChunkAlloc.h"
#include "SkRect.h"
#include "SkTDArray.h"

class SkEdge;
class SkEdgeClipper;
class SkPath;

class SkEdgeBuilder {
public:
    SkEdgeBuilder();

    int build(const SkPath& path, const SkIRect* clip, int shiftUp);

    SkEdge** edgeList() { return fList.begin(); }

private:
    SkChunkAlloc        fAlloc;
    SkTDArray<SkEdge*>  fList;
    int                 fShiftUp;

    void addLine(const SkPoint pts[]);
    void addQuad(const SkPoint pts[]);
    void addCubic(const SkPoint pts[]);
    void addClipper(SkEdgeClipper*);
};

#endif

#ifndef SkEdgeBuilder_DEFINED
#define SkEdgeBuilder_DEFINED

#include "SkChunkAlloc.h"
#include "SkRect.h"
#include "SkTDArray.h"

struct SkEdge;
class SkEdgeClipper;
class SkPath;

class SkEdgeBuilder {
public:
    SkEdgeBuilder();

    int build(const SkPath& path, const SkIRect* clip, int shiftUp);

    SkEdge** edgeList() { return fList.begin(); }

private:
    SkChunkAlloc        fAlloc;
    SkTDArray<SkEdge*>  fList;
    int                 fShiftUp;

    void addLine(const SkPoint pts[]);
    void addQuad(const SkPoint pts[]);
    void addCubic(const SkPoint pts[]);
    void addClipper(SkEdgeClipper*);
};

#endif

Fix warning (struct forward-declared as class).

Review URL:  http://codereview.appspot.com/164061


#ifndef CLICKLABEL_H
#define CLICKLABEL_H

#include <QLabel>
#include <QWidget>
#include <Qt>

class ClickLabel:public QLabel
{
    Q_OBJECT
public:
    explicit ClickLabel(QWidget *parent = Q_NULLPTR, Qt::WindowFlags f = Qt::WindowFlags());
    ~ClickLabel();
signals:
    void clicked();
protected:
    void mouseReleaseEvent(QMouseEvent *event);
};

#endif // CLICKLABEL_H

#ifndef CLICKLABEL_H
#define CLICKLABEL_H

#include <QLabel>
#include <QWidget>
#include <Qt>

class ClickLabel:public QLabel
{
    Q_OBJECT
public:
    explicit ClickLabel(QWidget *parent = nullptr, Qt::WindowFlags f = Qt::WindowFlags());
    ~ClickLabel();
signals:
    void clicked();
protected:
    void mouseReleaseEvent(QMouseEvent *event);
};

#endif // CLICKLABEL_H

Use nullptr to stay Qt4 compatible.

Use nullptr to stay Qt4 compatible.


#include "f2c.h"

#define log10e 0.43429448190325182765

#ifdef KR_headers
double log();
double d_lg10(x) doublereal *x;
#else
#undef abs
#include "math.h"
double d_lg10(doublereal *x)
#endif
{
return( log10e * log(*x) );
}

#include "f2c.h"

#ifdef KR_headers
double log10();
double d_lg10(x) doublereal *x;
#else
#undef abs
#include "math.h"
double d_lg10(doublereal *x)
#endif
{
return( log10(*x) );
}

Use the C library version of log10() instead of the inaccurate formula
log10(x) = log10e * log(x).  This fixes some small (one or two ULP)
inaccuracies.

Found by:	ucbtest


/**
 * Add a new map widget to the given parent Elementary (container) object.
 *
 * @param parent The parent object.
 * @return a new map widget handle or @c NULL, on errors.
 *
 * This function inserts a new map widget on the canvas.
 *
 * @ingroup Map
 */
EAPI Evas_Object          *elm_map_add(Evas_Object *parent);

#include "elm_map.eo.legacy.h"

/**
 * Add a new map widget to the given parent Elementary (container) object.
 *
 * @param parent The parent object.
 * @return a new map widget handle or @c NULL, on errors.
 *
 * This function inserts a new map widget on the canvas.
 *
 * @ingroup Map
 */
EAPI Evas_Object          *elm_map_add(Evas_Object *parent);

/**
 * @internal
 *
 * @brief Requests a list of addresses corresponding to a given name.
 *
 * @since 1.8
 *
 * @remarks This is used if you want to search the address from a name.
 *
 * @param obj The map object
 * @param address The address
 * @param name_cb The callback function
 * @param data The user callback data
 *
 * @ingroup Map
 */
EAPI void                  elm_map_name_search(const Evas_Object *obj, const char *address, Elm_Map_Name_List_Cb name_cb, void *data);

#include "elm_map.eo.legacy.h"

map: Add missing legacy API into legacy header

Summary: @fix

Reviewers: raster

Reviewed By: raster

Differential Revision: https://phab.enlightenment.org/D1164


/*
    Copyright (C) 2016 Volker Krause <vkrause@kde.org>

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

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

    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.
*/

#ifndef KSYNTAXHIGHLIGHTING_ABSTRACTHIGHLIGHTERM_P_H
#define KSYNTAXHIGHLIGHTING_ABSTRACTHIGHLIGHTERM_P_H

#include "definition.h"
#include "theme.h"

class QStringList;

namespace KSyntaxHighlighting {

class ContextSwitch;
class StateData;

class AbstractHighlighterPrivate
{
public:
    AbstractHighlighterPrivate();
    virtual ~AbstractHighlighterPrivate();

    void ensureDefinitionLoaded();
    bool switchContext(StateData* data, const ContextSwitch &contextSwitch, const QStringList &captures);

    Definition m_definition;
    Theme m_theme;
};

}

#endif

/*
    Copyright (C) 2016 Volker Krause <vkrause@kde.org>

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

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

    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.
*/

#ifndef KSYNTAXHIGHLIGHTING_ABSTRACTHIGHLIGHTER_P_H
#define KSYNTAXHIGHLIGHTING_ABSTRACTHIGHLIGHTER_P_H

#include "definition.h"
#include "theme.h"

class QStringList;

namespace KSyntaxHighlighting {

class ContextSwitch;
class StateData;

class AbstractHighlighterPrivate
{
public:
    AbstractHighlighterPrivate();
    virtual ~AbstractHighlighterPrivate();

    void ensureDefinitionLoaded();
    bool switchContext(StateData* data, const ContextSwitch &contextSwitch, const QStringList &captures);

    Definition m_definition;
    Theme m_theme;
};

}

#endif

Fix typo in include guard

Fix typo in include guard

Found by krazy.


#ifndef QGC_CONFIGURATION_H
#define QGC_CONFIGURATION_H

#include <QString>

/** @brief Polling interval in ms */
#define SERIAL_POLL_INTERVAL 9

/** @brief Heartbeat emission rate, in Hertz (times per second) */
#define MAVLINK_HEARTBEAT_DEFAULT_RATE 1
#define WITH_TEXT_TO_SPEECH 1

#define QGC_APPLICATION_NAME "APM Planner"
#define QGC_APPLICATION_VERSION "v2.0.0 (beta)"

namespace QGC

{
const QString APPNAME = "APMPLANNER2";
const QString COMPANYNAME = "DIYDRONES";
const int APPLICATIONVERSION = 200; // 1.0.9
}

#endif // QGC_CONFIGURATION_H

#ifndef QGC_CONFIGURATION_H
#define QGC_CONFIGURATION_H

#include <QString>

/** @brief Polling interval in ms */
#define SERIAL_POLL_INTERVAL 9

/** @brief Heartbeat emission rate, in Hertz (times per second) */
#define MAVLINK_HEARTBEAT_DEFAULT_RATE 1
#define WITH_TEXT_TO_SPEECH 1

#define QGC_APPLICATION_NAME "APM Planner"
#define QGC_APPLICATION_VERSION "v2.0.0 (alpha-RC1)"

namespace QGC

{
const QString APPNAME = "APMPLANNER2";
const QString COMPANYNAME = "DIYDRONES";
const int APPLICATIONVERSION = 200; // 1.0.9
}

#endif // QGC_CONFIGURATION_H

Change for alpha-RC1 version name

Change for alpha-RC1 version name


/*
 * Copyright (c) 1997-2004, Index Data
 * See the file LICENSE for details.
 *
 * $Id: atoin.c,v 1.4 2004-12-13 14:21:55 heikki Exp $
 */

/**
 * \file atoin.c
 * \brief Implements atoi_n function.
 */

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

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

/**
 * atoi_n: like atoi but reads at most len characters.
 */
int atoi_n (const char *buf, int len)
{
    int val = 0;

    while (--len >= 0)
    {
        if (isdigit (*(const unsigned char *) buf))
            val = val*10 + (*buf - '0');
	buf++;
    }
    return val;
}

/*
 * Copyright (c) 1997-2004, Index Data
 * See the file LICENSE for details.
 *
 * $Id: atoin.c,v 1.5 2004-12-16 08:59:56 adam Exp $
 */

/**
 * \file atoin.c
 * \brief Implements atoi_n function.
 */

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

#include <string.h>
#include <ctype.h>
#include <yaz/marcdisp.h>

/**
 * atoi_n: like atoi but reads at most len characters.
 */
int atoi_n (const char *buf, int len)
{
    int val = 0;

    while (--len >= 0)
    {
        if (isdigit (*(const unsigned char *) buf))
            val = val*10 + (*buf - '0');
	buf++;
    }
    return val;
}

Include marcdisp.h so that atoi_n gets public on WIN32


#include "rbuv.h"

ID id_call;

VALUE mRbuv;

void Init_rbuv() {
  id_call = rb_intern("call");

  mRbuv = rb_define_module("Rbuv");
  Init_rbuv_error();
  Init_rbuv_handle();
  Init_rbuv_loop();
  Init_rbuv_timer();
  Init_rbuv_stream();
  Init_rbuv_tcp();
  Init_rbuv_signal();
}

#include "rbuv.h"

ID id_call;

VALUE mRbuv;

VALUE rbuv_version(VALUE self);
VALUE rbuv_version_string(VALUE self);

void Init_rbuv() {
  id_call = rb_intern("call");

  mRbuv = rb_define_module("Rbuv");
  rb_define_singleton_method(mRbuv, "version", rbuv_version, 0);
  rb_define_singleton_method(mRbuv, "version_string", rbuv_version_string, 0);

  Init_rbuv_error();
  Init_rbuv_handle();
  Init_rbuv_loop();
  Init_rbuv_timer();
  Init_rbuv_stream();
  Init_rbuv_tcp();
  Init_rbuv_signal();
}

VALUE rbuv_version(VALUE self) {
  return UINT2NUM(uv_version());
}

VALUE rbuv_version_string(VALUE self) {
  return rb_str_new2(uv_version_string());
}

Add singleton methods to access libuv version


#pragma once

#include "jcon.h"

#include <QString>
#include <QVariant>

namespace jcon {

class JCON_API JsonRpcResult
{
public:
    virtual ~JsonRpcResult() {}

    virtual bool isSuccess() const = 0;
    virtual QVariant result() const = 0;
    virtual QString toString() const = 0;
};

}

#pragma once

#include "jcon.h"

#include <QString>
#include <QVariant>

namespace jcon {

class JCON_API JsonRpcResult
{
public:
    virtual ~JsonRpcResult() {}

    operator bool() const { return isSuccess(); }

    virtual bool isSuccess() const = 0;
    virtual QVariant result() const = 0;
    virtual QString toString() const = 0;
};

}

Add conversion-to-bool operator to JsonRpcResult class


#include "../parse.h"

unsigned parse_stmt_parameter(
	const sparse_t* src, const char* ptr,
	parse_debug_t* debug,
	parse_stmt_t* stmt)
{
	unsigned dpos = parse_debug_position(debug);

	unsigned i = parse_keyword(
		src, ptr, debug,
		PARSE_KEYWORD_PARAMETER);
	if (i == 0) return 0;

	if (ptr[i++] != '(')
	{
		parse_debug_rewind(debug, dpos);
		return 0;
	}

	unsigned l;
	stmt->parameter.list = parse_assign_list(
		src, &ptr[i], debug, &l);
	if (!stmt->parameter.list)
	{
		parse_debug_rewind(debug, dpos);
		return 0;
	}
	i += l;

	if (ptr[i++] != ')')
	{
		parse_assign_list_delete(
			stmt->parameter.list);
		parse_debug_rewind(debug, dpos);
		return 0;
	}

	stmt->type = PARSE_STMT_PARAMETER;
	return i;
}

bool parse_stmt_parameter_print(
	int fd, const parse_stmt_t* stmt)
{
    if (!stmt)
		return false;

	return (dprintf_bool(fd, "PARAMETER ")
		&& parse_assign_list_print(
			fd, stmt->parameter.list));
}

#include "../parse.h"

unsigned parse_stmt_parameter(
	const sparse_t* src, const char* ptr,
	parse_debug_t* debug,
	parse_stmt_t* stmt)
{
	unsigned dpos = parse_debug_position(debug);

	unsigned i = parse_keyword(
		src, ptr, debug,
		PARSE_KEYWORD_PARAMETER);
	if (i == 0) return 0;

	bool has_brackets = (ptr[i] == '(');
	if (has_brackets) i += 1;

	unsigned l;
	stmt->parameter.list = parse_assign_list(
		src, &ptr[i], debug, &l);
	if (!stmt->parameter.list)
	{
		parse_debug_rewind(debug, dpos);
		return 0;
	}
	i += l;

	if (has_brackets)
	{
		if (ptr[i++] != ')')
		{
			parse_assign_list_delete(
				stmt->parameter.list);
			parse_debug_rewind(debug, dpos);
			return 0;
		}
	}

	stmt->type = PARSE_STMT_PARAMETER;
	return i;
}

bool parse_stmt_parameter_print(
	int fd, const parse_stmt_t* stmt)
{
    if (!stmt)
		return false;

	return (dprintf_bool(fd, "PARAMETER ")
		&& parse_assign_list_print(
			fd, stmt->parameter.list));
}

Support DEC style PARAMETER statements

Support DEC style PARAMETER statements

This is a non-standard feature, but it's easy to support.
http://fortranwiki.org/fortran/show/Modernizing+Old+Fortran


#include <arch/x64/port.h>
#include <truth/panic.h>

#define TEST_RESULT_PORT_NUMBER 0xf4

void test_shutdown_status(enum status status) {
    logf(Log_Debug, "Test shutting down with status %s (%d)\n", status_message(status), status);
    write_port(status, TEST_RESULT_PORT_NUMBER);
	//__asm__("movb $0x0, %al; outb %al, $0xf4");
	__asm__("movb $0xf4, %al; outb %al, $0x0");
	__asm__("movb $0x0, %al; outb %al, $0xf4");
	halt();
    //write_port(2, TEST_RESULT_PORT_NUMBER);
    assert(Not_Reached);
}

#include <arch/x64/port.h>
#include <truth/panic.h>

#define TEST_RESULT_PORT_NUMBER 0xf4

void test_shutdown_status(enum status status) {
    logf(Log_Debug, "Test shutting down with status %s (%d)\n", status_message(status), status);
    write_port(status, TEST_RESULT_PORT_NUMBER);
    halt();
    assert(Not_Reached);
}

Remove debug messages and duplicate code


/*===---- stddef.h - Basic type definitions --------------------------------===
 *
 * 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.
 *
 *===-----------------------------------------------------------------------===
 */

static inline int __get_cpuid (unsigned int level, unsigned int *eax,
                               unsigned int *ebx, unsigned int *ecx,
                               unsigned int *edx) {
    asm("cpuid" : "=a"(*eax), "=b" (*ebx), "=c"(*ecx), "=d"(*edx) : "0"(level));
    return 1;
}

/*===---- cpuid.h - Basic type definitions ---------------------------------===
 *
 * 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.
 *
 *===-----------------------------------------------------------------------===
 */

static inline int __get_cpuid (unsigned int level, unsigned int *eax,
                               unsigned int *ebx, unsigned int *ecx,
                               unsigned int *edx) {
    asm("cpuid" : "=a"(*eax), "=b" (*ebx), "=c"(*ecx), "=d"(*edx) : "0"(level));
    return 1;
}

Fix file name in comments.

Fix file name in comments.

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


@interface OBABookmarkV2 : NSObject {
	NSString * _name;
	NSArray * _stopIds;
}

- (id) initWithCoder:(NSCoder*)coder;

@property (nonatomic, retain) NSString * name;
@property (nonatomic, retain) NSArray * stopIds;

@end

Move this class back to onebusaway-iphone


/*
 * Copyright (c) 2012 Israel Jacques
 * See LICENSE for details.
 *
 * Israel Jacques <mrko@eecs.berkeley.edu>
 */

#include "cons.h"

typedef struct {
} cons_vdp1_t;

static struct cons_vdp1_t *cons_vdp1_new(void);
static void cons_vdp1_write(struct cons *, int, uint8_t, uint8_t);

void
cons_vdp1_init(struct cons *cons)
{
        cons_vdp1_t *cons_vdp1;

        cons_vdp1 = cons_vdp1_new();
        cons->driver = cons_vdp1;
        cons->write = cons_vdp1_write;

        cons_reset(cons);
}

static struct cons_vdp1_t *
cons_vdp1_new(void)
{
        static struct cons_vdp1_t cons_vdp1;
        return &cons_vdp1;
}

static void
cons_vdp1_write(struct cons *cons, int c, uint8_t fg, uint8_t bg)
{
}

/*
 * Copyright (c) 2012 Israel Jacques
 * See LICENSE for details.
 *
 * Israel Jacques <mrko@eecs.berkeley.edu>
 */

#include <inttypes.h>
#include <stdbool.h>
#include <ctype.h>
#include <string.h>

#include "cons.h"

typedef struct {
} cons_vdp1_t;

static cons_vdp1_t *cons_vdp1_new(void);
static void cons_vdp1_reset(struct cons *);
static void cons_vdp1_write(struct cons *, int, uint8_t, uint8_t);

void
cons_vdp1_init(struct cons *cons)
{
        cons_vdp1_t *cons_vdp1;

        cons_vdp1 = cons_vdp1_new();

        cons->driver = cons_vdp1;

        cons->write = cons_vdp1_write;
        cons->reset = cons_vdp1_reset;

        cons_reset(cons);
}

static cons_vdp1_t *
cons_vdp1_new(void)
{
        /* XXX Replace with TLSF */
        static cons_vdp1_t cons_vdp1;
        return &cons_vdp1;
}

static void
cons_vdp1_reset(struct cons *cons)
{
        cons_vdp1_t *cons_vdp1;

        cons_vdp1 = cons->driver;

        /* Reset */
}

static void
cons_vdp1_write(struct cons *cons, int c, uint8_t fg, uint8_t bg)
{
        cons_vdp1_t *cons_vdp1;

        cons_vdp1 = cons->driver;
}

Change stubs for VDP1 cons driver

Change stubs for VDP1 cons driver


#include <norby/colortest.h>
#include <norby/gdt.h>
#include <norby/idt.h>
#include <norby/irq.h>
#include <norby/isrs.h>
#include <norby/kernel.h>
#include <norby/keyboard.h>
#include <norby/panic.h>
#include <norby/version.h>
#include <norby/vga.h>
#include <stdio.h>
#include <string.h>

void kmain() {
	//Install descriptor tables
	install_gdt();
	install_idt();
	install_isrs();
	install_irq();
	install_keyboard();
	asm volatile ("sti");

	//Set up VGA text mode, and print a welcome message
	initialize_screen();
	set_text_colors(VGA_COLOR_LIGHT_GRAY, VGA_COLOR_BLACK);
	clear_screen();
	printf("NorbyOS v%s\n", NORBY_VERSION);
	char* buffer;
	while(1) {
		printf("==> ");
		gets_s(buffer, 100);
		if(strcmp(buffer, "colortest") == 0) {
			colortest();
		}
	}

	//Enter an endless loop. If you disable this, another loop in boot.asm will
	//start, but interrupts will be disabled.
	while (1) {}
}

#include <norby/colortest.h>
#include <norby/gdt.h>
#include <norby/idt.h>
#include <norby/irq.h>
#include <norby/isrs.h>
#include <norby/kernel.h>
#include <norby/keyboard.h>
#include <norby/panic.h>
#include <norby/version.h>
#include <norby/vga.h>
#include <stdio.h>
#include <string.h>

void kmain() {
	//Install descriptor tables
	install_gdt();
	install_idt();
	install_isrs();
	install_irq();
	install_keyboard();
	asm volatile ("sti");

	//Set up VGA text mode, and print a welcome message
	initialize_screen();
	set_text_colors(VGA_COLOR_LIGHT_GRAY, VGA_COLOR_BLACK);
	clear_screen();
	printf("NorbyOS v%s\n", NORBY_VERSION);
	char* buffer;
	while(1) {
		printf("==> ");
		gets_s(buffer, 100);
		if(strcmp(buffer, "colortest") == 0) {
			colortest();
		}
		else if(strcmp(buffer, "clear") == 0) {
			clear_screen();
		}
	}

	//Enter an endless loop. If you disable this, another loop in boot.asm will
	//start, but interrupts will be disabled.
	while (1) {}
}

Add "clear" command for clearing screen

Add "clear" command for clearing screen


// RUN: clang -fexceptions -emit-llvm -o - %s | grep "@foo() {" | count 1
// RUN: clang -emit-llvm -o - %s | grep "@foo() nounwind {" | count 1

int foo(void) {
}

// RUN: clang -fexceptions -emit-llvm -o - %s | grep "@foo() {" | count 1 &&
// RUN: clang -emit-llvm -o - %s | grep "@foo() nounwind {" | count 1

int foo(void) {
}

Fix test case RUN: line (thanks Argiris)

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


/*
 * nsswitch_internal.h
 * Prototypes for some internal glibc functions that we use.  Shhh.
 */

#ifndef NSSWITCH_INTERNAL_H
#define NSSWITCH_INTERNAL_H

#include "config.h"

/* glibc/config.h.in */
#if defined USE_REGPARMS && !defined PROF && !defined __BOUNDED_POINTERS__
# define internal_function __attribute__ ((regparm (3), stdcall))
#else
# define internal_function
#endif

/* glibc/nss/nsswitch.h */
typedef struct service_user service_user;

extern int __nss_next (service_user **ni, const char *fct_name, void **fctp,
		       int status, int all_values);
extern int __nss_database_lookup (const char *database,
				  const char *alternative_name,
				  const char *defconfig, service_user **ni);
extern void *__nss_lookup_function (service_user *ni, const char *fct_name);

/* glibc/nss/XXX-lookup.c */
extern int __nss_passwd_lookup (service_user **ni, const char *fct_name,
				void **fctp) internal_function;
extern int __nss_group_lookup (service_user **ni, const char *fct_name,
			        void **fctp) internal_function;

#endif /* NSSWITCH_INTERNAL_H */

/*
 * nsswitch_internal.h
 * Prototypes for some internal glibc functions that we use.  Shhh.
 */

#ifndef NSSWITCH_INTERNAL_H
#define NSSWITCH_INTERNAL_H

#include <features.h>
#include "config.h"

/* glibc/config.h.in */
#if __GLIBC_PREREQ(2, 27)
# define internal_function
#elif defined USE_REGPARMS && !defined PROF && !defined __BOUNDED_POINTERS__
# define internal_function __attribute__ ((regparm (3), stdcall))
#else
# define internal_function
#endif

/* glibc/nss/nsswitch.h */
typedef struct service_user service_user;

extern int __nss_next (service_user **ni, const char *fct_name, void **fctp,
		       int status, int all_values);
extern int __nss_database_lookup (const char *database,
				  const char *alternative_name,
				  const char *defconfig, service_user **ni);
extern void *__nss_lookup_function (service_user *ni, const char *fct_name);

/* glibc/nss/XXX-lookup.c */
extern int __nss_passwd_lookup (service_user **ni, const char *fct_name,
				void **fctp) internal_function;
extern int __nss_group_lookup (service_user **ni, const char *fct_name,
			        void **fctp) internal_function;

#endif /* NSSWITCH_INTERNAL_H */

Update internal glibc functions ABI for glibc 2.27

Signed-off-by: Anders Kaseorg <087231934ba8fcf78bc142ce37d193b895ac03c4@mit.edu>


#ifndef CLIENTVERSION_H
#define CLIENTVERSION_H

//
// client versioning
//

// These need to be macros, as version.cpp's and bitcoin-qt.rc's voodoo requires it
#define CLIENT_VERSION_MAJOR       1
#define CLIENT_VERSION_MINOR       0
#define CLIENT_VERSION_REVISION    2
#define CLIENT_VERSION_BUILD       5

// Set to true for release, false for prerelease or test build
#define CLIENT_VERSION_IS_RELEASE  true

// Converts the parameter X to a string after macro replacement on X has been performed.
// Don't merge these into one macro!
#define STRINGIZE(X) DO_STRINGIZE(X)
#define DO_STRINGIZE(X) #X

#endif // CLIENTVERSION_H

#ifndef CLIENTVERSION_H
#define CLIENTVERSION_H

//
// client versioning
//

// These need to be macros, as version.cpp's and bitcoin-qt.rc's voodoo requires it
#define CLIENT_VERSION_MAJOR       1
#define CLIENT_VERSION_MINOR       0
#define CLIENT_VERSION_REVISION    2
#define CLIENT_VERSION_BUILD       6

// Set to true for release, false for prerelease or test build
#define CLIENT_VERSION_IS_RELEASE  true

// Converts the parameter X to a string after macro replacement on X has been performed.
// Don't merge these into one macro!
#define STRINGIZE(X) DO_STRINGIZE(X)
#define DO_STRINGIZE(X) #X

#endif // CLIENTVERSION_H

Increase version to 1.0.2.6 r6

Increase version to 1.0.2.6 r6


#include <stdio.h>

/* print Fahrenheit to Celsius table
 * for Fahrenheit 0, 20, ..., 300 */
int main()
{
    int fahr;
    int cel;
    int lower;
    int upper;
    int step;

    lower = 0; /* lower bound for the table */
    upper = 300; /* upper bound for the table */
    step = 20; /* amount to step by */

    fahr = lower;
    while (fahr <= upper) {
        cel = 5 * (fahr - 32) / 9;
        printf("%3d\t%6d\n", fahr, cel);
        fahr += step;
    }
}

#include <stdio.h>

/* print Fahrenheit to Celsius table
 * for Fahrenheit 0, 20, ..., 300 */
int main()
{
    float fahr;
    float cel;
    int lower;
    int upper;
    int step;

    lower = 0; /* lower bound for the table */
    upper = 300; /* upper bound for the table */
    step = 20; /* amount to step by */

    fahr = lower;
    while (fahr <= upper) {
        cel = (5.0 / 9.0) * (fahr - 32.0);
        printf("%3.0f\t%6.1f\n", fahr, cel);
        fahr += step;
    }
}

Change from `int` to `float`

Change from `int` to `float`


// LAF OS Library
// Copyright (C) 2022  Igara Studio S.A.
// Copyright (C) 2015-2016  David Capello
//
// This file is released under the terms of the MIT license.
// Read LICENSE.txt for more information.

#ifndef OS_GL_CONTEXT_INCLUDED
#define OS_GL_CONTEXT_INCLUDED
#pragma once

namespace os {

class GLContext {
public:
  virtual ~GLContext() { }
  virtual bool isValid() = 0;
  virtual bool createGLContext() = 0;
  virtual void destroyGLContext() = 0;
  virtual void makeCurrent() = 0;
  virtual void swapBuffers() = 0;
};

} // namespace os

#endif

// LAF OS Library
// Copyright (C) 2022  Igara Studio S.A.
// Copyright (C) 2015-2016  David Capello
//
// This file is released under the terms of the MIT license.
// Read LICENSE.txt for more information.

#ifndef OS_GL_CONTEXT_INCLUDED
#define OS_GL_CONTEXT_INCLUDED
#pragma once

namespace os {

class GLContext {
public:
  virtual ~GLContext() { }
  virtual bool isValid() { return false; }
  virtual bool createGLContext() { }
  virtual void destroyGLContext() { }
  virtual void makeCurrent() { }
  virtual void swapBuffers() { }
};

} // namespace os

#endif

Make os::GLContext instantiable (isValid() returns false by default)


/*ckwg +5
 * Copyright 2011 by Kitware, Inc. All Rights Reserved. Please refer to
 * KITWARE_LICENSE.TXT for licensing information, or contact General Counsel,
 * Kitware, Inc., 28 Corporate Drive, Clifton Park, NY 12065.
 */

#ifndef VISTK_SCORING_SCORE_MASK_H
#define VISTK_SCORING_SCORE_MASK_H

#include "scoring-config.h"

#include "scoring_result.h"

#include <vil/vil_image_view.h>

/**
 * \file mask_scoring.h
 *
 * \brief A function for scoring a mask.
 */

namespace vistk
{

/// A typedef for a mask image.
typedef vil_image_view<bool> mask_t;

/**
 * \brief Scores a computed mask against a truth mask.
 *
 * \note The input images are expected to be the same size.
 *
 * \todo Add error handling to the function (invalid sizes, etc.).
 *
 * \param truth The truth mask.
 * \param computed The computed mask.
 *
 * \returns The results of the scoring.
 */
scoring_result_t VISTK_SCORING_EXPORT score_mask(mask_t const& truth_mask, mask_t const& computed_mask);

}

#endif // VISTK_SCORING_SCORE_MASK_H

/*ckwg +5
 * Copyright 2011 by Kitware, Inc. All Rights Reserved. Please refer to
 * KITWARE_LICENSE.TXT for licensing information, or contact General Counsel,
 * Kitware, Inc., 28 Corporate Drive, Clifton Park, NY 12065.
 */

#ifndef VISTK_SCORING_SCORE_MASK_H
#define VISTK_SCORING_SCORE_MASK_H

#include "scoring-config.h"

#include "scoring_result.h"

#include <vil/vil_image_view.h>

#include <boost/cstdint.hpp>

/**
 * \file mask_scoring.h
 *
 * \brief A function for scoring a mask.
 */

namespace vistk
{

/// A typedef for a mask image.
typedef vil_image_view<uint8_t> mask_t;

/**
 * \brief Scores a computed mask against a truth mask.
 *
 * \note The input images are expected to be the same size.
 *
 * \todo Add error handling to the function (invalid sizes, etc.).
 *
 * \param truth The truth mask.
 * \param computed The computed mask.
 *
 * \returns The results of the scoring.
 */
scoring_result_t VISTK_SCORING_EXPORT score_mask(mask_t const& truth_mask, mask_t const& computed_mask);

}

#endif // VISTK_SCORING_SCORE_MASK_H

Use bytes for mask images

Use bytes for mask images


#ifndef KERNEL_H
#define KERNEL_H

void free_write();
extern unsigned int endkernel;

#endif

#ifndef KERNEL_H
#define KERNEL_H

void free_write();
extern unsigned int endkernel;

enum STATUS_CODE
{
    // General
    GENERAL_SUCCESS,
    GENERAL_FAILURE
}

#endif

Create an enum for all posible function return status codes


/*
 * Copyright (C) 2012 Andrew Beekhof <andrew@beekhof.net>
 *
 * libqb 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.
 *
 * libqb 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 libqb.  If not, see <http://www.gnu.org/licenses/>.
 */

#include <qb/qblog.h>

int
main(int argc, char **argv)
{
	int lpc = 0;
	for(lpc = 1; lpc < argc && argv[lpc] != NULL; lpc++) {
		printf("Dumping the contents of %s\n", argv[lpc]);
		qb_log_blackbox_print_from_file(argv[lpc]);
	}
	return 0;
}

/*
 * Copyright (C) 2012 Andrew Beekhof <andrew@beekhof.net>
 *
 * libqb 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.
 *
 * libqb 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 libqb.  If not, see <http://www.gnu.org/licenses/>.
 */

#include <qb/qblog.h>

int
main(int argc, char **argv)
{
	int lpc = 0;

        qb_log_init("qb_blackbox", LOG_USER, LOG_TRACE);
        qb_log_ctl(QB_LOG_STDERR, QB_LOG_CONF_ENABLED, QB_TRUE);
        qb_log_filter_ctl(QB_LOG_STDERR, QB_LOG_FILTER_ADD, QB_LOG_FILTER_FILE, "*", LOG_TRACE);

	for(lpc = 1; lpc < argc && argv[lpc] != NULL; lpc++) {
		printf("Dumping the contents of %s\n", argv[lpc]);
		qb_log_blackbox_print_from_file(argv[lpc]);
	}
	return 0;
}

Enable error logging for the blackbox reader


//
//  RNCallKit.h
//  RNCallKit
//
//  Created by Ian Yu-Hsun Lin on 12/22/16.
//  Copyright © 2016 Ian Yu-Hsun Lin. All rights reserved.
//

#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>
#import <CallKit/CallKit.h>
#import <Intents/Intents.h>
//#import <AVFoundation/AVAudioSession.h>

#import "RCTEventEmitter.h"

@interface RNCallKit : RCTEventEmitter <CXProviderDelegate>

@property (nonatomic, strong) CXCallController *callKitCallController;
@property (nonatomic, strong) CXProvider *callKitProvider;

+ (BOOL)application:(UIApplication *)application
            openURL:(NSURL *)url
            options:(NSDictionary<UIApplicationOpenURLOptionsKey, id> *)options NS_AVAILABLE_IOS(9_0);

+ (BOOL)application:(UIApplication *)application
continueUserActivity:(NSUserActivity *)userActivity
  restorationHandler:(void(^)(NSArray * __nullable restorableObjects))restorationHandler;

@end

//
//  RNCallKit.h
//  RNCallKit
//
//  Created by Ian Yu-Hsun Lin on 12/22/16.
//  Copyright © 2016 Ian Yu-Hsun Lin. All rights reserved.
//

#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>
#import <CallKit/CallKit.h>
#import <Intents/Intents.h>
//#import <AVFoundation/AVAudioSession.h>

#import <React/RCTEventEmitter.h>

@interface RNCallKit : RCTEventEmitter <CXProviderDelegate>

@property (nonatomic, strong) CXCallController *callKitCallController;
@property (nonatomic, strong) CXProvider *callKitProvider;

+ (BOOL)application:(UIApplication *)application
            openURL:(NSURL *)url
            options:(NSDictionary<UIApplicationOpenURLOptionsKey, id> *)options NS_AVAILABLE_IOS(9_0);

+ (BOOL)application:(UIApplication *)application
continueUserActivity:(NSUserActivity *)userActivity
  restorationHandler:(void(^)(NSArray * __nullable restorableObjects))restorationHandler;

@end

Fix incorrect import on React-Native >=0.40

For reference, see here:
https://github.com/facebook/react-native/commit/e1577df1fd70049ce7f288f91f6e2b18d512ff4d


#pragma once
#include "Rendering/RendererDX11.h"

namespace Mile
{
   enum class ERenderResourceType
   {
      VertexBuffer,
      IndexBuffer,
      ConstantBuffer,
      StructuredBuffer,
      ByteAddressBuffer,
      IndirectArgumentsBuffer,
      Texture1D,
      Texture2D,
      Texture3D,
      RenderTarget,
      DepthStencilBuffer,
      Cubemap
   };

   class RendererDX11;
   class MEAPI ResourceDX11
   {
   public:
      ResourceDX11(RendererDX11* renderer) :
         m_bIsInitialized(false),
         m_renderer(renderer)
      {
      }

      virtual ~ResourceDX11()
      {
      }

      virtual ID3D11Resource* GetResource() const = 0;
      virtual ERenderResourceType GetResourceType() const = 0;

      FORCEINLINE bool IsInitialized() const { return m_bIsInitialized; }
      FORCEINLINE bool HasAvailableRenderer() const { return (m_renderer != nullptr); }

      FORCEINLINE RendererDX11* GetRenderer() const { return m_renderer; }

   protected:
      FORCEINLINE void ConfirmInitialize() { m_bIsInitialized = true; }

   private:
      RendererDX11* m_renderer;
      bool m_bIsInitialized;

   };
}

#pragma once
#include "Rendering/RendererDX11.h"
#include "Core/Engine.h"

namespace Mile
{
   enum class ERenderResourceType
   {
      VertexBuffer,
      IndexBuffer,
      ConstantBuffer,
      StructuredBuffer,
      ByteAddressBuffer,
      IndirectArgumentsBuffer,
      Texture1D,
      Texture2D,
      Texture3D,
      RenderTarget,
      DepthStencilBuffer,
      DynamicCubemap
   };

   class RendererDX11;
   class MEAPI ResourceDX11
   {
   public:
      ResourceDX11(RendererDX11* renderer) :
         m_bIsInitialized(false),
         m_renderer(renderer)
      {
      }

      virtual ~ResourceDX11()
      {
         m_renderer = nullptr;
      }

      virtual ID3D11Resource* GetResource() const = 0;
      virtual ERenderResourceType GetResourceType() const = 0;

      FORCEINLINE bool IsInitialized() const { return m_bIsInitialized; }
      FORCEINLINE bool HasAvailableRenderer() const
      {
         return (m_renderer != nullptr) && (Engine::GetRenderer() == m_renderer);
      }

      FORCEINLINE RendererDX11* GetRenderer() const { return m_renderer; }

   protected:
      FORCEINLINE void ConfirmInitialize() { m_bIsInitialized = true; }

   private:
      RendererDX11* m_renderer;
      bool m_bIsInitialized;

   };
}

Modify HasAvailableRenderer method to check actually matched with Engine owned renderer


#ifndef MALLOCCACHE_H
#define MALLOCCACHE_H

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

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

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

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

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

#endif // MALLOCCACHE_H

#ifndef MALLOCCACHE_H
#define MALLOCCACHE_H

// no-op the cache, sometimes useful for debugging memory issues
//#define MALLOCCACHE_PASSTHROUGH

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

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

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

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

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

#endif // MALLOCCACHE_H

Add an ifdef to disable MallocCache for debugging.


#pragma once
#include "Component.h"

enum ENTITY_TYPE {PLAYER};

// Commnets
class InputComponent :
	public Component
{
public:
  InputComponent();
  ~InputComponent();
  void SetEntityType(int entityType);
  void HandleInput();
  void HandlePlayerInput();
private:
  char* m_inputMessage;
  ENTITY_TYPE m_entityType;
}

Handle input by the user

Handle input by the user


#ifndef SC_ADB_PARSER_H
#define SC_ADB_PARSER_H

#include "common.h"

#include "stddef.h"

/**
 * Parse the ip from the output of `adb shell ip route`
 */
char *
sc_adb_parse_device_ip_from_output(char *buf, size_t buf_len);

#endif

#ifndef SC_ADB_PARSER_H
#define SC_ADB_PARSER_H

#include "common.h"

#include "stddef.h"

/**
 * Parse the ip from the output of `adb shell ip route`
 *
 * Warning: this function modifies the buffer for optimization purposes.
 */
char *
sc_adb_parse_device_ip_from_output(char *buf, size_t buf_len);

#endif

Add warning in function documentation

Add warning in function documentation

The function parsing "ip route" output modifies the input buffer to
tokenize in place. This must be mentioned in the function documentation.


startclose: moreInfo
New Window [ Name: "More Info"; Left: Get ( WindowDesktopWidth ) - (Get ( WindowDesktopWidth ) / 2 ) ]
Go to Layout [ “about” (tempSetup) ]
Adjust Window
[ Resize to Fit ]
Pause/Resume Script [ Indefinitely ]
January 23, 平成26 3:39:22 Imagination Quality Management.fp7 - about -1-

startclose: moreInfo
New Window [ Name: "More Info"; Left: Get ( WindowDesktopWidth ) - (Get ( WindowDesktopWidth ) / 2 ) ]
Go to Layout [ “moreinfo” (tempSetup) ]
Adjust Window
[ Resize to Fit ]
Pause/Resume Script [ Indefinitely ]
January 23, 平成26 3:39:22 Imagination Quality Management.fp7 - about -1-

Change more info window layout name

Change more info window layout name


#ifndef __FEATURES_H
#define __FEATURES_H

#ifdef __STDC__

#define __P(x) x
#define __const const

/* Almost ansi */
#if __STDC__ != 1
#define const
#define volatile
#endif

#else /* K&R */

#define __P(x) ()
#define __const
#define const
#define volatile

#endif

/* No C++ */
#define __BEGIN_DECLS
#define __END_DECLS

/* GNUish things */
#define __CONSTVALUE
#define __CONSTVALUE2

#define _POSIX_THREAD_SAFE_FUNCTIONS

#include <sys/cdefs.h>

#endif

#ifndef __FEATURES_H
#define __FEATURES_H

/* Major and minor version number of the uCLibc library package.  Use
   these macros to test for features in specific releases.  */
#define	__UCLIBC__		0
#define	__UCLIBC_MAJOR__	9
#define	__UCLIBC_MINOR__	1

#ifdef __STDC__

#define __P(x) x
#define __const const

/* Almost ansi */
#if __STDC__ != 1
#define const
#define volatile
#endif

#else /* K&R */

#define __P(x) ()
#define __const
#define const
#define volatile

#endif

/* No C++ */
#define __BEGIN_DECLS
#define __END_DECLS

/* GNUish things */
#define __CONSTVALUE
#define __CONSTVALUE2

#define _POSIX_THREAD_SAFE_FUNCTIONS

#include <sys/cdefs.h>

#endif

Add in a version number so apps can tell uclib is being used. -Erik


/* Licensed to the Apache Software Foundation (ASF) under one or more
 * contributor license agreements.  See the NOTICE file distributed with
 * this work for additional information regarding copyright ownership.
 * The ASF licenses this file to You 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.
 */

static MP_INLINE U32 mpxs_APR__OS_current_thread_id(pTHX)
{
#if APR_HAS_THREADS
    return (U32)apr_os_thread_current();
#else
    return 0;
#endif
}

/* Licensed to the Apache Software Foundation (ASF) under one or more
 * contributor license agreements.  See the NOTICE file distributed with
 * this work for additional information regarding copyright ownership.
 * The ASF licenses this file to You 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.
 */

static MP_INLINE unsigned long mpxs_APR__OS_current_thread_id(pTHX)
{
#if APR_HAS_THREADS
    return (unsigned long)apr_os_thread_current();
#else
    return 0;
#endif
}

Fix on fbsd amd64 where U32 is 4 bytes and pthread_t is 8.

 xs/APR/OS/APR__OS.h: In function 'mpxs_APR__OS_current_thread_id':
 xs/APR/OS/APR__OS.h:20: warning: cast from pointer to integer of different size

Consistently cast this to an unsigned long.

git-svn-id: b4be4a41b2a3352907de631eb6da1671a2f7b614@983068 13f79535-47bb-0310-9956-ffa450edef68


#pragma once

#include "cqrs/artifact.h"

namespace cddd {
namespace cqrs {

template<class> class basic_artifact_view;

template<class DomainEventDispatcher, class DomainEventContainer>
class basic_artifact_view<basic_artifact<DomainEventDispatcher, DomainEventContainer>> {
public:
   using id_type = typename basic_artifact<DomainEventDispatcher, DomainEventContainer>::id_type;
   using size_type = typename basic_artifact<DomainEventDispatcher, DomainEventContainer>::size_type;

   const id_type &id() const {
      return artifact_.id();
   }

   size_type revision() const {
      return artifact_.revision();
   }

   template<class Evt>
   inline void apply_change(Evt &&e) {
      using std::forward;
      artifact_.apply_change(forward<Evt>(e));
   }

protected:
   explicit inline basic_artifact_view(basic_artifact<DomainEventDispatcher, DomainEventContainer> &a) :
      artifact_{a}
   {
   }

   template<class Fun>
   void add_handler(Fun f) {
      using std::move;
      artifact_.add_handler(move(f));
   }

private:
   basic_artifact<DomainEventDispatcher, DomainEventContainer> &artifact_;
};

typedef basic_artifact_view<artifact> artifact_view;

}
}

#pragma once

#include "cqrs/artifact.h"

namespace cddd {
namespace cqrs {

template<class> class basic_artifact_view;

template<class DomainEventDispatcher, class DomainEventContainer>
class basic_artifact_view<basic_artifact<DomainEventDispatcher, DomainEventContainer>> {
public:
   using id_type = typename basic_artifact<DomainEventDispatcher, DomainEventContainer>::id_type;
   using size_type = typename basic_artifact<DomainEventDispatcher, DomainEventContainer>::size_type;

   const id_type &id() const {
      return artifact_.id();
   }

   size_type revision() const {
      return artifact_.revision();
   }

   template<class Evt>
   inline auto apply_change(Evt &&e) {
      using std::forward;
      return artifact_.apply_change(forward<Evt>(e));
   }

protected:
   explicit inline basic_artifact_view(basic_artifact<DomainEventDispatcher, DomainEventContainer> &a) :
      artifact_{a}
   {
   }

   template<class Fun>
   void add_handler(Fun f) {
      using std::move;
      artifact_.add_handler(move(f));
   }

private:
   basic_artifact<DomainEventDispatcher, DomainEventContainer> &artifact_;
};

typedef basic_artifact_view<artifact> artifact_view;

}
}

Refactor artifact view to provide event pointer created by the artifact after applying a change


// RUN: clang %s -fsyntax-only -verify -pedantic-errors

int a() {int p; *(1 ? &p : (void*)(0 && (a(),1))) = 10;} // expected-error {{null pointer expression is not an integer constant expression (but is allowed as an extension)}} // expected-note{{C does not permit evaluated commas in an integer constant expression}}

// RUN: clang %s -fsyntax-only -verify

int a() {int p; *(1 ? &p : (void*)(0 && (a(),1))) = 10;}

Fix test. (0 && (a(),1)) is a valid I-C-E according to C99.

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


#ifdef E_TYPEDEFS

#define e_error_message_show(args...) \
{ \
   char __tmpbuf[PATH_MAX]; \
 \
   snprintf(__tmpbuf, sizeof(__tmpbuf), ##args); \
   e_error_message_show_internal(__tmpbuf); \
}

#else
#ifndef E_ERROR_H
#define E_ERROR_H

EAPI void e_error_message_show_internal(char *txt);

#endif
#endif

#ifdef E_TYPEDEFS

#define e_error_message_show(args...) do \
{ \
   char __tmpbuf[PATH_MAX]; \
 \
   snprintf(__tmpbuf, sizeof(__tmpbuf), ##args); \
   e_error_message_show_internal(__tmpbuf); \
} while (0)

#else
#ifndef E_ERROR_H
#define E_ERROR_H

EAPI void e_error_message_show_internal(char *txt);

#endif
#endif

e: Fix macro so it can be used as a statement

Should fix devilhorn's compile error.

Signed-off-by: Mike McCormack <mj.mccormack@samsung.com>

git-svn-id: 6ac5796aeae0cef97fb47bcc287d4ce899c6fa6e@61783 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33


#ifndef UTIL_STRING_H
#define UTIL_STRING_H

#include "util/common.h"

char* strndup(const char* start, size_t len);
char* strnrstr(const char* restrict s1, const char* restrict s2, size_t len);

#endif

#ifndef UTIL_STRING_H
#define UTIL_STRING_H

#include "util/common.h"

#ifndef strndup
// This is sometimes a macro
char* strndup(const char* start, size_t len);
#endif

char* strnrstr(const char* restrict s1, const char* restrict s2, size_t len);

#endif

Util: Fix build with strndup on some platforms


#import "MBProgressHUD.h"
#import <SDWebImage/UIImageView+WebCache.h>
#import "JTSImageViewController.h"
#import "JTSImageInfo.h"
#import "UITabBarController+NBUAdditions.h"
#import "KINWebBrowserViewController.h"
#import <SSPullToRefresh/SSPullToRefresh.h>
#import "SVGKit/SVGKit.h"

#import "MBProgressHUD.h"
#import <SDWebImage/UIImageView+WebCache.h>
#import "JTSImageViewController.h"
#import "JTSImageInfo.h"
#import "UITabBarController+NBUAdditions.h"
#import "KINWebBrowserViewController.h"
#import <SSPullToRefresh/SSPullToRefresh.h>
#import <SVGKit/SVGKit.h>

Update import statement for consistency.


#define CGLTF_IMPLEMENTATION
#include "../cgltf.h"

int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size)
{
	cgltf_options options = {0};
	cgltf_data* data = NULL;
	cgltf_result res = cgltf_parse(&options, Data, Size, &data);
	if (res == cgltf_result_success) cgltf_free(data);
	return 0;
}

#define CGLTF_IMPLEMENTATION
#include "../cgltf.h"

int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size)
{
	cgltf_options options = {0};
	cgltf_data* data = NULL;
	cgltf_result res = cgltf_parse(&options, Data, Size, &data);
	if (res == cgltf_result_success)
	{
		cgltf_validate(data);
		cgltf_free(data);
	}
	return 0;
}

Add validation to fuzz target

Add validation to fuzz target

This make sure new validation code is robust by itself.


/** \file common.h
 * \brief Project-wide definitions and macros.
 *
 *
 * SCL; 2012-2015
 */

#ifndef COMMON_H
#define COMMON_H

#define GR1C_VERSION "0.10.2"
#define GR1C_COPYRIGHT "Copyright (c) 2012-2015 by Scott C. Livingston,\n" \
	"California Institute of Technology\n\n" \
	"This is free, open source software, released under a BSD license\n" \
	"and without warranty."

#define GR1C_INTERACTIVE_PROMPT ">>> "

typedef int vartype;
typedef char bool;
#define True 1
#define False 0

typedef unsigned char byte;

#include "util.h"
#include "cudd.h"

#endif

/** \file common.h
 * \brief Project-wide definitions and macros.
 *
 *
 * SCL; 2012-2015
 */

#ifndef COMMON_H
#define COMMON_H

#define GR1C_VERSION "0.10.3"
#define GR1C_COPYRIGHT "Copyright (c) 2012-2015 by Scott C. Livingston,\n" \
	"California Institute of Technology\n\n" \
	"This is free, open source software, released under a BSD license\n" \
	"and without warranty."

#define GR1C_INTERACTIVE_PROMPT ">>> "

typedef int vartype;
typedef char bool;
#define True 1
#define False 0

typedef unsigned char byte;

#include "util.h"
#include "cudd.h"

#endif

Bump version in preparation for next release.


//
//  OCTEntity.h
//  OctoKit
//
//  Created by Josh Abernathy on 1/21/11.
//  Copyright 2011 GitHub. All rights reserved.
//

#import "OCTObject.h"

@class OCTPlan;
@class GHImageRequestOperation;

// Represents any GitHub object which is capable of owning repositories.
@interface OCTEntity : OCTObject

// Returns `login` if no name is explicitly set.
@property (nonatomic, copy) NSString *name;

@property (nonatomic, copy) NSArray *repositories;
@property (nonatomic, copy) NSString *email;
@property (nonatomic, copy) NSURL *avatarURL;
@property (nonatomic, copy) NSString *login;
@property (nonatomic, copy) NSString *blog;
@property (nonatomic, copy) NSString *company;
@property (nonatomic, assign) NSUInteger collaborators;
@property (nonatomic, assign) NSUInteger publicRepoCount;
@property (nonatomic, assign) NSUInteger privateRepoCount;
@property (nonatomic, assign) NSUInteger diskUsage;
@property (nonatomic, readonly, strong) OCTPlan *plan;

// TODO: Fix this to "RemoteCounterparts".
- (void)mergeRepositoriesWithRemoteCountparts:(NSArray *)remoteRepositories;

@end

//
//  OCTEntity.h
//  OctoKit
//
//  Created by Josh Abernathy on 1/21/11.
//  Copyright 2011 GitHub. All rights reserved.
//

#import "OCTObject.h"

@class OCTPlan;

// Represents any GitHub object which is capable of owning repositories.
@interface OCTEntity : OCTObject

// Returns `login` if no name is explicitly set.
@property (nonatomic, copy) NSString *name;

@property (nonatomic, copy) NSArray *repositories;
@property (nonatomic, copy) NSString *email;
@property (nonatomic, copy) NSURL *avatarURL;
@property (nonatomic, copy) NSString *login;
@property (nonatomic, copy) NSString *blog;
@property (nonatomic, copy) NSString *company;
@property (nonatomic, assign) NSUInteger collaborators;
@property (nonatomic, assign) NSUInteger publicRepoCount;
@property (nonatomic, assign) NSUInteger privateRepoCount;
@property (nonatomic, assign) NSUInteger diskUsage;
@property (nonatomic, readonly, strong) OCTPlan *plan;

// TODO: Fix this to "RemoteCounterparts".
- (void)mergeRepositoriesWithRemoteCountparts:(NSArray *)remoteRepositories;

@end

Remove old class forward declaration

Remove old class forward declaration


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

#include "options.h"

static Options *
_new() {
	Options *opts = (Options *)malloc(sizeof(Options));
	if(opts) {
		memset(opts, 0, sizeof(Options));
	}
	return opts;
}

static Options *
make(int argc, char *argv[]) {
	Options *opts = _new();
	int i = 1;

	for(;;) {
		if(i >= (argc - 1)) break;

		if(!strcmp(argv[i], "sdbfile")) {
			opts->sdbFilename = argv[i+1];
			i = i + 2;
		} else if(!strcmp(argv[i], "romfile")) {
			opts->romFilename = argv[i+1];
			i = i + 2;
		} else {
			fprintf(stderr, "Warning: unknown option %s\n", argv[i]);
			i++;
		}
	}

	if (!opts->romFilename) {
		opts->romFilename = "roms/forth";
	}

	return opts;
}

const struct interface_Options module_Options = {
	.make = &make,
};

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

#include "options.h"

static Options *
_new() {
	Options *opts = (Options *)malloc(sizeof(Options));
	if(opts) {
		memset(opts, 0, sizeof(Options));
	}
	return opts;
}

static Options *
make(int argc, char *argv[]) {
	Options *opts = _new();
	int i = 1;

	/* Defaults */
	opts->romFilename = "roms/forth";

	/* Parse the command line */
	for(;;) {
		if(i >= (argc - 1)) break;

		if(!strcmp(argv[i], "sdbfile")) {
			opts->sdbFilename = argv[i+1];
			i = i + 2;
		} else if(!strcmp(argv[i], "romfile")) {
			opts->romFilename = argv[i+1];
			i = i + 2;
		} else {
			fprintf(stderr, "Warning: unknown option %s\n", argv[i]);
			i++;
		}
	}

	return opts;
}

const struct interface_Options module_Options = {
	.make = &make,
};

e: Rework the command line option defaults mechanism


#include <stdio.h>

int main()
{
	puts("Hello, people!");
	return 0;
}

#include <stdio.h>

int main()
{
	puts("Hello, people!"); /* Preferred over printf */
	return 0;
}

Comment the main .c file

Comment the main .c file


#define _XOPEN_SOURCE 500
#include <unistd.h>
#include <stdlib.h>

char *os_find_self(void)
{
    // PATH_MAX (used by readlink(2)) is not necessarily available
    size_t size = 2048, used = 0;
    char *path = NULL;
    do {
        size *= 2;
        path = realloc(path, size);
        used = readlink("/proc/self/exe", path, size);
    } while (used > size && path != NULL);

    return path;
}

#define _XOPEN_SOURCE 500
#include <unistd.h>
#include <stdlib.h>

char *os_find_self(void)
{
    // PATH_MAX (used by readlink(2)) is not necessarily available
    size_t size = 2048, used = 0;
    char *path = NULL;
    do {
        size *= 2;
        path = realloc(path, size);
        used = readlink("/proc/self/exe", path, size);
        path[used - 1] = '\0';
    } while (used >= size && path != NULL);

    return path;
}

Mend loop condition from 344aae0

Mend loop condition from 344aae0


/**
 * Copyright (c) 2011 Jon Maken, All Rights Reserved
 * License: 3-Clause BSD
 * Revision: 07/21/2011 2:44:32 PM
 */
#include <stdio.h>

static void usage(void)
{
	printf("XVal: Validate XML documents\n");
	printf("Usage: xval [--dtd DTD_FILE | --xsd XSD_FILE] XML_FILE ...\n\n");
	printf("  --dtd DTD_FILE  validate against external DTD file\n");
	printf("  --xsd XSD_FILE  validate against external XSD schema file\n");
}

static int process_options(int argc, char **argv)
{
	if (argc == 1) return(1);

	return(0);
}

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

	if ((rv = process_options(argc, argv) != 0))
	{
		usage();
		return(rv);
	}

	/* cleanup function for the XML library */
	/* xmlCleanupParser(); */

	return(0);
}

Add placeholder C code to finish build scripts


/* $Id: t_gc.h,v 1.7 2011/09/04 13:00:54 mit-sato Exp $ */

#ifndef __T_GC__
#define __T_GC__

#ifdef PROF
#	define GC_INIT()		0
#	define GC_MALLOC(s)		malloc(s)
#	define GC_MALLOC_ATOMIC(s)	malloc(s)
#else
#	include <gc.h>
#endif /* PROF */

#endif /* __T_GC__ */

/* $Id: t_gc.h,v 1.7 2011/09/04 13:00:54 mit-sato Exp $ */

#ifndef __T_GC__
#define __T_GC__

#ifdef PROF
#	define GC_INIT()					0
#	define GC_MALLOC(s)					malloc(s)
#	define GC_MALLOC_ATOMIC(s)				malloc(s)
#	define GC_register_finalizer_ignore_self(o,f,c,x,y)	0
#	define GC_add_roots(s,e)				0
#else
#	include <gc.h>
#endif /* PROF */

#endif /* __T_GC__ */

Add dummy macro GC_register_finalizer_ignore_self and GC_add_roots.