////////////////////////////////////////////////////////////////////////////////
//
//  TYPHOON FRAMEWORK
//  Copyright 2013, Jasper Blues & Contributors
//  All Rights Reserved.
//
//  NOTICE: The authors permit you to use, modify, and distribute this file
//  in accordance with the terms of the license agreement accompanying it.
//
////////////////////////////////////////////////////////////////////////////////

#import <Foundation/Foundation.h>
#import "CreditService.h"
#import "Pizza.h"

@protocol PizzaFactory <NSObject>

@property (nonatomic, strong, readonly) id<CreditService> creditService;

- (id<Pizza>)pizzaWithRadius:(double)radius ingredients:(NSArray *)ingrendients;
- (id<Pizza>)smallPizzaWithIngredients:(NSArray *)ingredients;
- (id<Pizza>)mediumPizzaWithIngredients:(NSArray *)ingredients;
- (id<Pizza>)largePizzaWithIngredients:(NSArray *)ingredients;

@end

////////////////////////////////////////////////////////////////////////////////
//
//  TYPHOON FRAMEWORK
//  Copyright 2013, Jasper Blues & Contributors
//  All Rights Reserved.
//
//  NOTICE: The authors permit you to use, modify, and distribute this file
//  in accordance with the terms of the license agreement accompanying it.
//
////////////////////////////////////////////////////////////////////////////////

#import <Foundation/Foundation.h>
#import "CreditService.h"
#import "Pizza.h"

@protocol PizzaFactory <NSObject>

@property(nonatomic, strong, readonly) id <CreditService> creditService;

- (id <Pizza>)pizzaWithRadius:(double)radius ingredients:(NSArray*)ingredients;

- (id <Pizza>)smallPizzaWithIngredients:(NSArray*)ingredients;

- (id <Pizza>)mediumPizzaWithIngredients:(NSArray*)ingredients;

- (id <Pizza>)largePizzaWithIngredients:(NSArray*)ingredients;

@end

Fix typing mistake. add code formatting.


#include <algorithm>
#include <time.h>

template <typename Container1, typename Container2>
bool sequences_are_equal(const Container1& seq1, const Container2& seq2) {
    typedef typename Container1::const_iterator Iter1;
    typedef typename Container2::const_iterator Iter2;
    typedef std::pair<Iter1, Iter2> IterPair;
    IterPair mismatch_pair = std::mismatch(seq1.begin(), seq1.end(),
                                           seq2.begin());
    return mismatch_pair.first == seq1.end();
}

struct randint {
    int range;
public:
    randint(int range) : range(range) {}

    int operator()() {
        return (rand() / RAND_MAX) * range;
    }
};

#include <algorithm>

template <typename Container1, typename Container2>
bool sequences_are_equal(const Container1& seq1, const Container2& seq2) {
    typedef typename Container1::const_iterator Iter1;
    typedef typename Container2::const_iterator Iter2;
    typedef std::pair<Iter1, Iter2> IterPair;
    IterPair mismatch_pair = std::mismatch(seq1.begin(), seq1.end(),
                                           seq2.begin());
    return mismatch_pair.first == seq1.end();
}

struct randint {
    int start;
    int stop;
public:
    randint(int stop) : start(0), stop(stop) {}
    randint(int start, int stop) : start(start), stop(stop) {}

    int operator()() {
        return rand() % (this->stop - 1) + start;
    }
};

Add start and stop params to randint

Add start and stop params to randint


/**
 * @file test_controller.c
 * @author Travis Lane
 * @version 0.0.1
 * @date 2019-04-21
 */

#include <check.h>

#include "pwm.h"
#include "pwm_internal.h"

START_TEST(test_controller_basic)
{
  struct usp_controller_t *ctrl;
  struct usp_pwm_list_t *lst;

  ctrl = usp_controller_new();
  fail_if(ctrl == NULL, "Failed to create controller.");

  lst = usp_controller_get_pwms(ctrl);
  fail_if(lst == NULL, "Failed to get pwm list.");

  usp_pwm_list_unref(lst);

  usp_controller_delete(ctrl);
}
END_TEST

static Suite *
suite_controller_new()
{
  Suite *suite_controller = suite_create("suite_controller");
  TCase *case_controller = tcase_create("test_controller");

  tcase_add_test(case_controller, test_controller_basic);

  suite_add_tcase(suite_controller, case_controller);
  return suite_controller;
}

int
main()
{
  int failed;
  Suite *suite_controller = suite_controller_new();
  SRunner *runner_controller = srunner_create(suite_controller);
  srunner_run_all(runner_controller, CK_NORMAL);
  failed = srunner_ntests_failed(runner_controller);
  srunner_free(runner_controller);
  return failed;
}

[test] Add simple unit tests for the controller

Add a stupid simple unit test to create/destroy a controller.


/*
 * 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.
 */

#ifndef _GUAC_PARSER_CONSTANTS_H
#define _GUAC_PARSER_CONSTANTS_H

/**
 * Constants related to the Guacamole protocol parser.
 *
 * @file parser-constants.h
 */

/**
 * The maximum number of characters per instruction.
 */
#define GUAC_INSTRUCTION_MAX_LENGTH 8192

/**
 * The maximum number of digits to allow per length prefix.
 */
#define GUAC_INSTRUCTION_MAX_DIGITS 5

/**
 * The maximum number of elements per instruction, including the opcode.
 */
#define GUAC_INSTRUCTION_MAX_ELEMENTS 64

#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.
 */

#ifndef _GUAC_PARSER_CONSTANTS_H
#define _GUAC_PARSER_CONSTANTS_H

/**
 * Constants related to the Guacamole protocol parser.
 *
 * @file parser-constants.h
 */

/**
 * The maximum number of characters per instruction.
 */
#define GUAC_INSTRUCTION_MAX_LENGTH 8192

/**
 * The maximum number of digits to allow per length prefix.
 */
#define GUAC_INSTRUCTION_MAX_DIGITS 5

/**
 * The maximum number of elements per instruction, including the opcode.
 */
#define GUAC_INSTRUCTION_MAX_ELEMENTS 128

#endif

GUACAMOLE-587: Increase max number of elements per instruction.


//
//  AppPreferences.h
//
//

#import <Cordova/CDV.h>
#import <Cordova/CDVViewController.h>

@interface AppSettings : CDVPlugin

- (void)get:(CDVInvokedUrlCommand*)command;

@end

//
//  AppPreferences.h
//
//

#import <Cordova/CDV.h>
#import <Cordova/CDVViewController.h>

@interface AppSettings : CDVPlugin

- (void)fetch:(CDVInvokedUrlCommand*)command;

@end

Update method from get to fetch

Update method from get to fetch


/* mbed Microcontroller Library
 * Copyright (c) 2017 ARM Limited
 * SPDX-License-Identifier: Apache-2.0
 *
 * 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.
 */

#if DEVICE_ITM

#include "hal/itm_api.h"
#include "cmsis.h"
#include "am_bsp.h"

#include <stdbool.h>

/* SWO frequency: 1000 kHz */

// As SWO has to be accessible everywhere, including ISRs, we can't easily
// communicate the dependency on clocks etc. to other components - so this
// function checks that things appear to be set up, and if not re-configures
// everything
void itm_init(void)
{
    am_bsp_itm_printf_enable();
}

#endif

/* mbed Microcontroller Library
 * Copyright (c) 2017 ARM Limited
 * SPDX-License-Identifier: Apache-2.0
 *
 * 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.
 */

#if DEVICE_ITM

#include "hal/itm_api.h"
#include "cmsis.h"
#include "am_bsp.h"

#include <stdbool.h>

/* SWO frequency: 1000 kHz */

#ifndef AM_BSP_GPIO_ITM_SWO
#define AM_GPIO_ITM_SWO             	22

const am_hal_gpio_pincfg_t g_AM_GPIO_ITM_SWO =
{
    .uFuncSel            = AM_HAL_PIN_22_SWO,
    .eDriveStrength      = AM_HAL_GPIO_PIN_DRIVESTRENGTH_2MA
};
#endif

void itm_init(void)
{
    #ifdef AM_BSP_GPIO_ITM_SWO
    am_bsp_itm_printf_enable();
    #else
    am_bsp_itm_printf_enable(AM_GPIO_ITM_SWO,g_AM_GPIO_ITM_SWO);
    #endif
}

#endif

Add default SWO pin number and config if not defined in Ambiq target


#import <FBSnapshotTestCase/FBSnapshotTestCase.h>
#import "UIApplication+VisualTestUtils.h"

/**
 *  @function WMFSnapshotVerifyView
 *
 *  Verify correct appearance of a given view.
 *
 *  Search all folder suffixes, use default naming conventions.
 *
 *  @param view The view to verify.
 */
#define WMFSnapshotVerifyView(view) FBSnapshotVerifyView((view), nil)

/**
 *  @function WMFSnapshotVerifyViewForOSAndWritingDirection
 *
 *  Compares @c view with a reference image matching the current OS version & application writing direction (e.g.
 *  "testLaysOutProperly_9.2_RTL@2x.png").
 *
 *  @param view The view to verify.
 */
#define WMFSnapshotVerifyViewForOSAndWritingDirection(view) \
    FBSnapshotVerifyViewWithOptions((view), [[UIApplication sharedApplication] wmf_systemVersionAndWritingDirection], FBSnapshotTestCaseDefaultSuffixes(), 0.1);

@interface FBSnapshotTestCase (WMFConvenience)

- (void)wmf_verifyMultilineLabelWithText:(id)stringOrAttributedString width:(CGFloat)width;

- (void)wmf_verifyCellWithIdentifier:(NSString *)identifier
                       fromTableView:(UITableView *)tableView
                               width:(CGFloat)width
                 configuredWithBlock:(void (^)(UITableViewCell *))block;

- (void)wmf_verifyView:(UIView *)view width:(CGFloat)width;

- (void)wmf_verifyViewAtWindowWidth:(UIView *)view;

@end

#import <FBSnapshotTestCase/FBSnapshotTestCase.h>
#import "UIApplication+VisualTestUtils.h"

/**
 *  @function WMFSnapshotVerifyView
 *
 *  Verify correct appearance of a given view.
 *
 *  Search all folder suffixes, use default naming conventions.
 *
 *  @param view The view to verify.
 */
#define WMFSnapshotVerifyView(view) FBSnapshotVerifyView((view), nil)

/**
 *  @function WMFSnapshotVerifyViewForOSAndWritingDirection
 *
 *  Compares @c view with a reference image matching the current OS version & application writing direction (e.g.
 *  "testLaysOutProperly_9.2_RTL@2x.png").
 *
 *  @param view The view to verify.
 */
#define WMFSnapshotVerifyViewForOSAndWritingDirection(view) \
    FBSnapshotVerifyView((view), [[UIApplication sharedApplication] wmf_systemVersionAndWritingDirection]);

@interface FBSnapshotTestCase (WMFConvenience)

- (void)wmf_verifyMultilineLabelWithText:(id)stringOrAttributedString width:(CGFloat)width;

- (void)wmf_verifyCellWithIdentifier:(NSString *)identifier
                       fromTableView:(UITableView *)tableView
                               width:(CGFloat)width
                 configuredWithBlock:(void (^)(UITableViewCell *))block;

- (void)wmf_verifyView:(UIView *)view width:(CGFloat)width;

- (void)wmf_verifyViewAtWindowWidth:(UIView *)view;

@end

Revert "Add slight tolerance for image differences to visual test macro."

This reverts commit 13d6d4e18d98f7c2d496f3454216d96a4d8e95d1.


// ----------------------------------------------------------------------------
// pomodoro - Provides data structures and methods for manipulating pomodoros
// Copyright (c) 2013 Jonathan Speicher (jon.speicher@gmail.com)
// Licensed under the MIT license: http://opensource.org/licenses/MIT
// ----------------------------------------------------------------------------

#pragma once

// Defines the number of characters in a pomodoro time left display string. Note
// that this does not account for the terminating NULL character.

#define POMODORO_TIME_LEFT_STRING_NUM_CHARS 5

// Defines a pomodoro. Pomodoros consist primarily of the countdown timer and
// associated display strings.

typedef struct {
  unsigned int total_seconds_left;
  unsigned int minutes_left;
  unsigned int seconds_left;
  char time_left_string[POMODORO_TIME_LEFT_STRING_NUM_CHARS + 1];
} Pomodoro;

// Initializes a pomodoro. This initializes the time remaining and sets the
// display string appropriately.

void pomodoro_init(Pomodoro* pomodoro);

// Decrements the time remaining in the pomodoro by the number of seconds
// specified. If the requested decrement is greater than the number of seconds
// remaining, the time remaining is set to zero.

void pomodoro_decrement_by_seconds(Pomodoro* pomodoro, unsigned int seconds);

// ----------------------------------------------------------------------------
// pomodoro - Provides data structures and methods for manipulating pomodoros
// Copyright (c) 2013 Jonathan Speicher (jon.speicher@gmail.com)
// Licensed under the MIT license: http://opensource.org/licenses/MIT
// ----------------------------------------------------------------------------

#pragma once

// Defines the number of characters in a pomodoro time left display string.
// Note that this does not account for the terminating NULL character.

#define POMODORO_TIME_LEFT_STRING_NUM_CHARS 5

// Defines a pomodoro. Pomodoros consist primarily of the countdown timer and
// associated display strings.

typedef struct {
  unsigned int total_seconds_left;
  unsigned int minutes_left;
  unsigned int seconds_left;
  char time_left_string[POMODORO_TIME_LEFT_STRING_NUM_CHARS + 1];
} Pomodoro;

// Initializes a pomodoro. This initializes the time remaining and sets the
// display string appropriately.

void pomodoro_init(Pomodoro* pomodoro);

// Decrements the time remaining in the pomodoro by the number of seconds
// specified. If the requested decrement is greater than the number of seconds
// remaining, the time remaining is set to zero.

void pomodoro_decrement_by_seconds(Pomodoro* pomodoro, unsigned int seconds);

Fix a long line in a comment

Fix a long line in a comment


#define PIN_GAS_PEDAL A0
#define PIN_BATTERY_VOLTAGE A1

#define PIN_CW 5
#define PIN_CCW 6

#define PIN_SWITCH_FORWARDS 10
#define PIN_SWITCH_BACKWARDS 11

#define GAS_VALUE_MIN 446
#define GAS_VALUE_MAX 510

#define BATTERY_READING_12V 670
#define BATTERY_READING_6V 331

#define BATTERY_VOLTAGE_MIN 11

#define SPEED_MIN 0
#define SPEED_MAX_DIRECTION_CHANGE 15
#define SPEED_MAX_FORWARDS 255
#define SPEED_MAX_BACKWARDS 142
#define SPEED_CHANGE_PACE_DEFAULT 10

#define PIN_GAS_PEDAL A0
#define PIN_BATTERY_VOLTAGE A1

#define PIN_CW 6
#define PIN_CCW 5

#define PIN_SWITCH_FORWARDS 10
#define PIN_SWITCH_BACKWARDS 11

#define GAS_VALUE_MIN 446
#define GAS_VALUE_MAX 490 //510

#define BATTERY_READING_12V 670
#define BATTERY_READING_6V 331

#define BATTERY_VOLTAGE_MIN 11

#define SPEED_MIN 0
#define SPEED_MAX_DIRECTION_CHANGE 15
#define SPEED_MAX_FORWARDS 255
#define SPEED_MAX_BACKWARDS 142
#define SPEED_CHANGE_PACE_DEFAULT 10

Change max gas value Swap CW/CCW pins

Change max gas value
Swap CW/CCW pins


//
// Created by Jake Kinsella on 4/17/17.
//

#include "cpu.h"
#include "registers.h"
#include "ram.h"
#include "matcher/matcher.h"

void initialize()
{
    initialize_registers();
    initialize_ram();
}

void cycle()
{
    uint8_t instruction = read_byte_from_address(pc);
    printf("%d: %d\n", pc, instruction);

    // pc starts at instruction when passed to handle functions

    int index = match(instruction);
    if (index != -1) {
        InstructionTemplate template = get_registered_template(index);

        int dst_code = get_dst_code_from_opcode(instruction);
        int src_code = get_src_code_from_opcode(instruction);
        int rp_code = get_rp_code_from_opcode(instruction);
        run_instruction(dst_code, src_code, rp_code, template);
    }
}

void print_register_status()
{
    printf("A: %d, B: %d, C: %d, D: %d, E: %d, F: %d, H: %d, L: %d, SP: %d\n", a, b, c, d, e, f, h, l, combine_bytes(s, p));
}

//
// Created by Jake Kinsella on 4/17/17.
//

#include "cpu.h"
#include "registers.h"
#include "ram.h"
#include "matcher/matcher.h"

void initialize()
{
    initialize_registers();
    initialize_ram();
}

void cycle()
{
    uint8_t instruction = read_byte_from_address(pc);
    printf("0x%x: 0x%x\n", pc, instruction);

    // pc starts at instruction when passed to handle functions

    int index = match(instruction);
    if (index != -1) {
        InstructionTemplate template = get_registered_template(index);

        int dst_code = get_dst_code_from_opcode(instruction);
        int src_code = get_src_code_from_opcode(instruction);
        int rp_code = get_rp_code_from_opcode(instruction);
        run_instruction(dst_code, src_code, rp_code, template);
    }
}

void print_register_status()
{
    printf("A: 0x%x, B: 0x%x, C: 0x%x, D: 0x%x, E: 0x%x, F: 0x%x, H: 0x%x, L: 0x%x, SP: 0x%x\n", a, b, c, d, e, f, h, l, combine_bytes(s, p));
}

Print hex in debug messages

Print hex in debug messages


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

int main()
{
  int a[100],i,j,n,t;
  printf("Enter the value of n (num. of ints)");
  scanf("%d",&n);
  for(i=0;i<=n-1;i++) {
      printf("Enter a number:");
      scanf("%d",&a[i]);
      printf(" Good, %d to go\n", n-1-i);
  }
  printf(" Start sorting ... \n");
  //
  //Bubble sorting algorithm:
  //
  for(i=0;i<=n-2;i++){
      for(j=0;j<=n-i-2;j++){

	  if(a[j]>a[j+1]){

	      t=a[j];
	      a[j]=a[j+1];
	      a[j+1]=t;
	  }
      }
  }
  for(i=0;i<=n-1;i++){

      printf("%d,",a[i]);
  }
  printf(" Done! \n");
}

Add a C program to github to test

Add a C program to github to test


// from SV-COMP: nla-digbench-scaling/ps6-ll_valuebound5.c
// contains deep integer expressions that shouldn't cause extremely exponential slowdown
// when evaluated by base's eval_rv and EvalInt jointly
// runs (as unknown) under 0.1s

#include <assert.h>
void assume_abort_if_not(int cond) {
  if(!cond) {abort();}
}

int main() {
    short k;
    long long y, x, c;
    assume_abort_if_not(k>=0 && k<=5);
    assume_abort_if_not(k <= 256);

    y = 0;
    x = 0;
    c = 0;

    while (1) {
        assert(-2*y*y*y*y*y*y - 6 * y*y*y*y*y - 5 * y*y*y*y + y*y + 12*x == 0);

        if (!(c < k))
            break;

        c = c + 1;
        y = y + 1;
        x = y * y * y * y * y + x;
    }

    assert(-2*y*y*y*y*y*y - 6 * y*y*y*y*y - 5 * y*y*y*y + y*y + 12*x == 0);
    assert(k*y == y*y);
    return 0;
}

// from SV-COMP: nla-digbench-scaling/ps6-ll_valuebound5.c
// contains deep integer expressions that shouldn't cause extremely exponential slowdown
// when evaluated by base's eval_rv and EvalInt jointly
// runs (as unknown) under 0.1s

#include <assert.h>
void assume_abort_if_not(int cond) {
  if(!cond) {abort();}
}

int main() {
    short k;
    long long y, x, c;
    assume_abort_if_not(k>=0 && k<=5);
    assume_abort_if_not(k <= 256);

    y = 0;
    x = 0;
    c = 0;

    while (1) {
        assert(-2*y*y*y*y*y*y - 6 * y*y*y*y*y - 5 * y*y*y*y + y*y + 12*x == 0); // UNKNOWN (by design)

        if (!(c < k))
            break;

        c = c + 1;
        y = y + 1;
        x = y * y * y * y * y + x;
    }

    assert(-2*y*y*y*y*y*y - 6 * y*y*y*y*y - 5 * y*y*y*y + y*y + 12*x == 0); // UNKNOWN (by design)
    assert(k*y == y*y); // UNKNOWN (by design)
    return 0;
}

Add UNKNOWN annotations to 02/51

Add UNKNOWN annotations to 02/51


// SKIP PARAM: --set ana.activated[+] apron --set ana.apron.privatization dummy
#include <pthread.h>
#include <assert.h>

int g;

void *t_fun(void *arg) {
  // shouldn't have g, x, y in local apron state
  g = 43;
  int *p = arg;
  *p = 11;
  return NULL;
}

int main() {
  g = 42;
  int x = 10;
  int y = 20;

  pthread_t id;
  pthread_create(&id, NULL, t_fun, &x);

  // shouldn't have g, x, y in local apron state
  assert(g == 42); // UNKNOWN!
  assert(x == 10); // UNKNOWN!
  return 0;
}

Add test for apron dummy privatization soundness


#include <X11/X.h>
#include <X11/Xatom.h>
#include <X11/Xlib.h>
#include <stdio.h>

int main() {
  Display *display = XOpenDisplay(NULL);
  if (display == NULL) {
    fprintf(stderr, "Could not connect to $DISPLAY.\n");
    return 1;
  }
  char buf[32];
  snprintf(buf, sizeof(buf), "_NET_WM_CM_S%d", (int)DefaultScreen(display));
  Atom atom = XInternAtom(display, buf, False);
  Window w = XGetSelectionOwner(display, atom);
  if (w == None) {
    fprintf(stderr, "No compositor detected.\n");
    return 1;
  }
  printf("%#llx\n", (unsigned long long)w);
  return 0;
}

#include <X11/X.h>
#include <X11/Xatom.h>
#include <X11/Xlib.h>
#include <stdio.h>

int main() {
  Display *display = XOpenDisplay(NULL);
  if (display == NULL) {
    fprintf(stderr, "Could not connect to $DISPLAY.\n");
    return 1;
  }
  char buf[32];  // Flawfinder: ignore
  snprintf(buf, sizeof(buf), "_NET_WM_CM_S%d",  // Flawfinder: ignore
           (int)DefaultScreen(display));
  buf[sizeof(buf)-1] = 0;
  Atom atom = XInternAtom(display, buf, False);
  Window w = XGetSelectionOwner(display, atom);
  if (w == None) {
    fprintf(stderr, "No compositor detected.\n");
    return 1;
  }
  printf("%#llx\n", (unsigned long long)w);
  return 0;
}

Fix a potentially unportable use of snprintf found by flawfinder.


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

#define QLA4XXX_DRIVER_VERSION	"5.02.00-k10"

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

#define QLA4XXX_DRIVER_VERSION	"5.02.00-k11"

Update driver version to 5.02.00-k11

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

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


#ifndef KAI_PLATFORM_GAME_CONTROLLER_H
#define KAI_PLATFORM_GAME_CONTROLLER_H

#include KAI_PLATFORM_INCLUDE(GameController.h)

#endif // SHATTER_PLATFORM_GAME_CONTROLLER_H

//EOF

#ifndef KAI_PLATFORM_GAME_CONTROLLER_H
#define KAI_PLATFORM_GAME_CONTROLLER_H

#include KAI_PLATFORM_INCLUDE(GameController.h)

#endif

//EOF

Add some color for console output

Add some color for console output


#ifndef PYTHON3ADAPT_H
#define PYTHON3ADAPT_H

#if (PY_VERSION_HEX < 0x03000000)

#define PyBytes_Check               PyString_Check
#define PyBytes_Size                PyString_Size
#define PyBytes_AsString            PyString_AsString
#define PyBytes_FromStringAndSize   PyString_FromStringAndSize
#define PyBytes_FromString          PyString_FromString

#else

#define PyString_Check PyUnicode_Check
#define PyString_Size PyUnicode_GET_SIZE
#define PyString_FromStringAndSize PyUnicode_FromStringAndSize
#define PyString_FromString PyUnicode_FromString

#define PyInt_Check PyLong_Check
#define PyInt_FromLong PyLong_FromLong
#define PyInt_AsLong PyLong_AsLong
#define PyInt_AsUnsignedLongMask PyLong_AsUnsignedLongMask
#define PyInt_AsUnsignedLongLongMask PyLong_AsUnsignedLongLongMask

#define PyFile_Check(x) (1)

#if (PY_VERSION_HEX < 0x03030000)
#define PyString_AsString(x) PyBytes_AsString(PyUnicode_AsUTF8String(x))
#else
#define PyString_AsString PyUnicode_AsUTF8
#endif

#endif  // (PY_VERSION_HEX < 0x03000000)

#endif  //PYTHON3ADAPT_H

#ifndef PYTHON3ADAPT_H
#define PYTHON3ADAPT_H

#if (PY_VERSION_HEX < 0x03000000)

#define PyBytes_Check               PyString_Check
#define PyBytes_Size                PyString_Size
#define PyBytes_AsString            PyString_AsString
#define PyBytes_FromStringAndSize   PyString_FromStringAndSize
#define PyBytes_FromString          PyString_FromString

#else

#define PyString_Check PyUnicode_Check
#define PyString_Size PyUnicode_GET_SIZE
#define PyString_FromStringAndSize PyUnicode_FromStringAndSize
#define PyString_FromString PyUnicode_FromString

#define PyInt_Check PyLong_Check
#define PyInt_FromLong PyLong_FromLong
#define PyInt_AsLong PyLong_AsLong
#define PyInt_AsUnsignedLongMask PyLong_AsUnsignedLongMask
#define PyInt_AsUnsignedLongLongMask PyLong_AsUnsignedLongLongMask

#define PyFile_Check(x) (1)

#if (PY_VERSION_HEX < 0x03030000)
#define PyString_AsString _PyUnicode_AsString
#else
#define PyString_AsString PyUnicode_AsUTF8
#endif

#endif  // (PY_VERSION_HEX < 0x03000000)

#endif  //PYTHON3ADAPT_H

Fix memory leak in Python 3.2

Fix memory leak in Python 3.2


#pragma once

#include <functional>
#include "halley/maths/vector2.h"
#include "halley/core/input/input_device.h"

namespace Halley
{
	class InputJoystick;
	class InputTouch;

	class InputAPI
	{
	public:
		virtual ~InputAPI() {}

		virtual size_t getNumberOfKeyboards() const = 0;
		virtual std::shared_ptr<InputDevice> getKeyboard(int id = 0) const = 0;

		virtual size_t getNumberOfJoysticks() const = 0;
		virtual std::shared_ptr<InputJoystick> getJoystick(int id = 0) const = 0;

		virtual size_t getNumberOfMice() const = 0;
		virtual std::shared_ptr<InputDevice> getMouse(int id = 0) const = 0;

		virtual Vector<std::shared_ptr<InputTouch>> getNewTouchEvents() = 0;
		virtual Vector<std::shared_ptr<InputTouch>> getTouchEvents() = 0;

		virtual void setMouseRemapping(std::function<Vector2f(Vector2i)> remapFunction) = 0;

		virtual void requestControllerSetup(int numControllers, std::function<void(bool)> callback) { callback(true); }
	};
}

#pragma once

#include <functional>
#include "halley/maths/vector2.h"
#include "halley/core/input/input_device.h"
#include "halley/maths/colour.h"
#include "halley/data_structures/maybe.h"

namespace Halley
{
	class InputJoystick;
	class InputTouch;

	class InputControllerData {
	public:
		Colour colour;
		String name;
	};

	class InputAPI
	{
	public:
		virtual ~InputAPI() {}

		virtual size_t getNumberOfKeyboards() const = 0;
		virtual std::shared_ptr<InputDevice> getKeyboard(int id = 0) const = 0;

		virtual size_t getNumberOfJoysticks() const = 0;
		virtual std::shared_ptr<InputJoystick> getJoystick(int id = 0) const = 0;

		virtual size_t getNumberOfMice() const = 0;
		virtual std::shared_ptr<InputDevice> getMouse(int id = 0) const = 0;

		virtual Vector<std::shared_ptr<InputTouch>> getNewTouchEvents() = 0;
		virtual Vector<std::shared_ptr<InputTouch>> getTouchEvents() = 0;

		virtual void setMouseRemapping(std::function<Vector2f(Vector2i)> remapFunction) = 0;

		virtual void requestControllerSetup(int minControllers, int maxControllers, std::function<void(bool)> callback, Maybe<std::vector<InputControllerData>> controllerData = {}) { callback(true); }
	};
}

Support for additional data to be passed for controller support (implemented on consoles).


#include <ruby.h>
#include "client.h"

static VALUE metrics_report_metric(VALUE self, VALUE user_id, VALUE key, VALUE val) {
  char * user_id_str, * key_str;
  int result = 0;

  user_id_str = RSTRING_PTR(user_id);
  key_str = RSTRING_PTR(key);

  /* Figure out what this belongs to and call the apprioriate one. */
  switch(TYPE(val)) {
    case T_FIXNUM:
      result = metrici((const char *)user_id_str, (const char *)key_str, FIX2INT(val));
      break;
    case T_FLOAT:
      result = metricd((const char *)user_id_str, (const char *)key_str, NUM2DBL(val));
      break;
    default:
      rb_raise(rb_eTypeError, "Value is not a valid type. Expecting Fixnum or Float.");
      break;
  }

  return (result > 0) ? T_TRUE : T_FALSE;
}

void Init_metrics(void) {
  VALUE klass = rb_define_class("Metrics", rb_cObject);
  rb_define_singleton_method(klass, "report_metric", metrics_report_metric, 3);
}

#include <ruby.h>
#include "client.h"

static VALUE rb_metrics_report_metric(VALUE self, VALUE user_id, VALUE key, VALUE val) {
  char * user_id_str, * key_str;
  int result = 0;

  user_id_str = RSTRING_PTR(user_id);
  key_str = RSTRING_PTR(key);

  /* Figure out what this belongs to and call the apprioriate one. */
  switch(TYPE(val)) {
    case T_FIXNUM:
      result = metrici((const char *)user_id_str, (const char *)key_str, FIX2INT(val));
      break;
    case T_FLOAT:
      result = metricd((const char *)user_id_str, (const char *)key_str, NUM2DBL(val));
      break;
    default:
      rb_raise(rb_eTypeError, "Value is not a valid type. Expecting Fixnum or Float.");
      break;
  }

  return (result > 0) ? T_TRUE : T_FALSE;
}

static VALUE rb_metrics_initialize(VALUE self, VALUE hostname, VALUE port) {
  if(!FIXNUM_P(port)) {
    rb_raise(rb_eTypeError, "Port is not a Fixnum.");
    return T_FALSE;
  }

  rb_iv_set(self, "hostname", hostname);
  rb_iv_set(self, "port", port);

  return T_TRUE;
}

void Init_metrics(void) {
  VALUE rb_mMetrics = rb_define_module("Metrics");
  VALUE rb_cNativeClient = rb_define_class_under(rb_mMetrics, "NativeClient", rb_cObject);
  rb_define_singleton_method(rb_cNativeClient, "report_metric", rb_metrics_report_metric, 3);
  rb_define_method(rb_cNativeClient, "initialize", rb_metrics_initialize, 2);
}

Move this in to an actual class.

Move this in to an actual class.


#define FLATCC_VERSION_TEXT "0.4.3"
#define FLATCC_VERSION_MAJOR 0
#define FLATCC_VERSION_MINOR 4
#define FLATCC_VERSION_PATCH 3
/* 1 or 0 */
#define FLATCC_VERSION_RELEASED 1

#define FLATCC_VERSION_TEXT "0.5.0-pre"
#define FLATCC_VERSION_MAJOR 0
#define FLATCC_VERSION_MINOR 5
#define FLATCC_VERSION_PATCH 0
/* 1 or 0 */
#define FLATCC_VERSION_RELEASED 0

Prepare for next version version

Prepare for next version version


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

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

#include "gvplugin.h"

extern gvplugin_installed_t gvrender_lasi_types;

static gvplugin_api_t apis[] = {
    {API_render, &gvrender_lasi_types},
    {(api_t)0, 0},
};

gvplugin_library_t gvplugin_lasi_LTX_library = { "lasi", apis };

Add framework for a new lasi plugin, currently disabled. The lasi library provides UTF-8 support in PostScript


#pragma once
#ifndef INCL_NETWORKOS
#define INCL_NETWORKOS

#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <map>
#include <cstdlib>

#ifdef WIN32
#include <WinSock2.h>
#include <WS2tcpip.h>
#include <inaddr.h>
#include <in6addr.h>
#include <mstcpip.h>
#define SHUT_RDWR SD_BOTH
typedef int socklen_t;
#pragma comment(lib, "ws2_32.lib")
#undef SetPort
#else
#include <sys/ioctl.h>
#include <sys/time.h>
#include <sys/types.h>
#include <unistd.h>
#include <errno.h>
#include <fcntl.h>
#include <sys/socket.h>
#include <netinet/ip.h>
#include <netinet/ip6.h>
#include <netinet/tcp.h>
typedef unsigned int socklen_t;
#define INVALID_SOCKET (-1)
#endif

#endif

#pragma once
#ifndef INCL_NETWORKOS
#define INCL_NETWORKOS

#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <map>
#include <cstdlib>

#if defined(_MSC_VER)
#include <WinSock2.h>
#include <WS2tcpip.h>
#include <inaddr.h>
#include <in6addr.h>
#include <mstcpip.h>
#define SHUT_RDWR SD_BOTH
typedef int socklen_t;
#pragma comment(lib, "ws2_32.lib")
#undef SetPort
#else
#include <sys/ioctl.h>
#include <sys/time.h>
#include <sys/types.h>
#include <unistd.h>
#include <errno.h>
#include <fcntl.h>
#include <sys/socket.h>
#include <netinet/ip.h>
#include <netinet/ip6.h>
#include <netinet/tcp.h>
typedef unsigned int socklen_t;
#define INVALID_SOCKET (-1)
#endif

#endif

Use variable that cmake defines instead of specific one


/** @file
  Intrinsic Memory Routines Wrapper Implementation for OpenSSL-based
  Cryptographic Library.

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

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

**/

#include <Base.h>
#include <Library/BaseMemoryLib.h>

/* OpenSSL will use floating point support, and C compiler produces the _fltused
   symbol by default. Simply define this symbol here to satisfy the linker. */
int _fltused = 1;

/* Sets buffers to a specified character */
void * memset (void *dest, char ch, unsigned int count)
{
  //
  // Declare the local variables that actually move the data elements as
  // volatile to prevent the optimizer from replacing this function with
  // the intrinsic memset()
  //
  volatile UINT8  *Pointer;

  Pointer = (UINT8 *)dest;
  while (count-- != 0) {
    *(Pointer++) = ch;
  }

  return dest;
}

/** @file
  Intrinsic Memory Routines Wrapper Implementation for OpenSSL-based
  Cryptographic Library.

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

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

**/

#include <Base.h>
#include <Library/BaseMemoryLib.h>

/* OpenSSL will use floating point support, and C compiler produces the _fltused
   symbol by default. Simply define this symbol here to satisfy the linker. */
int _fltused = 1;

/* Sets buffers to a specified character */
void * memset (void *dest, char ch, unsigned int count)
{
  //
  // NOTE: Here we use one base implementation for memset, instead of the direct
  //       optimized SetMem() wrapper. Because the IntrinsicLib has to be built
  //       without whole program optimization option, and there will be some
  //       potential register usage errors when calling other optimized codes.
  //

  //
  // Declare the local variables that actually move the data elements as
  // volatile to prevent the optimizer from replacing this function with
  // the intrinsic memset()
  //
  volatile UINT8  *Pointer;

  Pointer = (UINT8 *)dest;
  while (count-- != 0) {
    *(Pointer++) = ch;
  }

  return dest;
}

Add comments for clarification about memset implementation.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Long, Qin <qin.long@intel.com>
Reviewed-by: Ye, Ting <ting.ye@intel.com>
Reviewed-by: Fu, Siyuan <siyuan.fu@intel.com>

git-svn-id: 3158a46dfd52e07d1fda3e32e1ab2e353a00b20f@15662 6f19259b-4bc3-4df7-8a09-765794883524


#ifndef Bag_h
#define Bag_h

#include <unordered_set>
#include <vector>
#include <ostream>

//A node in the tree deocomposition
class Bag{
private:
  unsigned long id;
  std::vector<unsigned long> nodes;
  unsigned long parent=0;
  std::vector<unsigned long> children;
public:
  Bag(unsigned long id, std::unordered_set<unsigned long> nodeset){
    this->id = id;
    for(unsigned long node:nodeset) nodes.push_back(node);
  }

  void set_parent(unsigned long parent){
    this->parent = parent;
  }

  void add_to_children(unsigned long node){
    children.push_back(node);
  }

  std::vector<unsigned long>& get_nodes(){
    return nodes;
  }

  friend std::ostream& operator<<(std::ostream& out, Bag& bag);

};

std::ostream& operator<<(std::ostream& out, Bag& bag){
  out << bag.id << std::endl;
  out << bag.nodes.size() << std::endl;
  for(auto node:bag.nodes) out << node << "\t";
  out << std::endl;
  out << bag.parent << std::endl;
  out << bag.children.size() << std::endl;
  for(auto node:bag.children) out << node << "\t";
  if(bag.children.size()>0) out << std::endl;
  return out;
}

#endif /* Bag_h */

#ifndef Bag_h
#define Bag_h

#include <unordered_set>
#include <vector>
#include <ostream>

//A node in the tree deocomposition
class Bag{
private:
  unsigned long id;
  std::vector<unsigned long> nodes;
  unsigned long parent=0;
  std::vector<unsigned long> children;
public:
  Bag(unsigned long id, const std::unordered_set<unsigned long> &nodeset){
    this->id = id;
    for(unsigned long node:nodeset) nodes.push_back(node);
  }

  void set_parent(unsigned long parent){
    this->parent = parent;
  }

  void add_to_children(unsigned long node){
    children.push_back(node);
  }

  std::vector<unsigned long>& get_nodes(){
    return nodes;
  }

  friend std::ostream& operator<<(std::ostream& out, Bag& bag);

};

std::ostream& operator<<(std::ostream& out, Bag& bag){
  out << bag.id << std::endl;
  out << bag.nodes.size() << std::endl;
  for(auto node:bag.nodes) out << node << "\t";
  out << std::endl;
  out << bag.parent << std::endl;
  out << bag.children.size() << std::endl;
  for(auto node:bag.children) out << node << "\t";
  if(bag.children.size()>0) out << std::endl;
  return out;
}

#endif /* Bag_h */

Make get_nodes return a const&, and optimize uses of this function


//
//  riscv-processor-logging.h
//

#ifndef riscv_processor_logging_h
#define riscv_processor_logging_h

namespace riscv {

	/* Processor logging flags */

	enum {
		proc_log_inst =            1<<0,       /* Log instructions */
		proc_log_operands =        1<<1,       /* Log instruction operands */
		proc_log_memory =          1<<2,       /* Log memory mapping information */
		proc_log_mmio =            1<<3,       /* Log memory mapped IO */
		proc_log_csr_mmode =       1<<4,       /* Log machine status and control registers */
		proc_log_csr_hmode =       1<<5,       /* Log hypervisor status and control registers */
		proc_log_csr_smode =       1<<6,       /* Log supervisor status and control registers */
		proc_log_csr_umode =       1<<7,       /* Log user status and control registers */
		proc_log_int_reg =         1<<8,       /* Log integer registers */
		proc_log_trap =            1<<9,       /* Log processor traps */
		proc_log_pagewalk =        1<<10,      /* Log virtual memory page walks */
		proc_log_ebreak_cli =      1<<11,      /* Log virtual memory page walks */
		proc_log_no_pseudo =       1<<12       /* Don't decode pseudoinstructions */
	};

}

#endif

//
//  riscv-processor-logging.h
//

#ifndef riscv_processor_logging_h
#define riscv_processor_logging_h

namespace riscv {

	/* Processor logging flags */

	enum {
		proc_log_inst =            1<<0,       /* Log instructions */
		proc_log_operands =        1<<1,       /* Log instruction operands */
		proc_log_memory =          1<<2,       /* Log memory mapping information */
		proc_log_mmio =            1<<3,       /* Log memory mapped IO */
		proc_log_csr_mmode =       1<<4,       /* Log machine status and control registers */
		proc_log_csr_hmode =       1<<5,       /* Log hypervisor status and control registers */
		proc_log_csr_smode =       1<<6,       /* Log supervisor status and control registers */
		proc_log_csr_umode =       1<<7,       /* Log user status and control registers */
		proc_log_int_reg =         1<<8,       /* Log integer registers */
		proc_log_trap =            1<<9,       /* Log processor traps */
		proc_log_pagewalk =        1<<10,      /* Log virtual memory page walks */
		proc_log_ebreak_cli =      1<<11,      /* Switch to debug CLI on ebreak */
		proc_log_no_pseudo =       1<<12       /* Don't decode pseudoinstructions */
	};

}

#endif

Update comment for enum proc_log_ebreak_cli


#define CONSOLE_CMD		      /* Console command */
#define DIGEST_CMD            /* Image crypto digest commands */
#define DOWNLOAD_PROTO_HTTPS  /* Secure Hypertext Transfer Protocol */
#define IMAGE_COMBOOT         /* COMBOOT */
#define IMAGE_TRUST_CMD	      /* Image trust management commands */
#define NET_PROTO_IPV6        /* IPv6 protocol */
#define NSLOOKUP_CMD          /* DNS resolving command */
#define NTP_CMD               /* NTP commands */
#define PCI_CMD               /* PCI commands */
#define REBOOT_CMD            /* Reboot command */
#define TIME_CMD              /* Time commands */
#define VLAN_CMD              /* VLAN commands */

#define CONSOLE_CMD           /* Console command */
#define DIGEST_CMD            /* Image crypto digest commands */
#define DOWNLOAD_PROTO_HTTPS  /* Secure Hypertext Transfer Protocol */
#define IMAGE_COMBOOT         /* COMBOOT */
#define IMAGE_TRUST_CMD       /* Image trust management commands */
#define IMAGE_GZIP            /* GZIP image support */
#define IMAGE_ZLIB            /* ZLIB image support */
#define NET_PROTO_IPV6        /* IPv6 protocol */
#define NSLOOKUP_CMD          /* DNS resolving command */
#define NTP_CMD               /* NTP commands */
#define PCI_CMD               /* PCI commands */
#define REBOOT_CMD            /* Reboot command */
#define TIME_CMD              /* Time commands */
#define VLAN_CMD              /* VLAN commands */

Enable GZIP and ZLIB options in iPXE

Enable GZIP and ZLIB options in iPXE


// @(#)root/base:$Id$
// Author: Philippe Canal 09/2014

/*************************************************************************
 * Copyright (C) 1995-2000, Rene Brun and Fons Rademakers.               *
 * All rights reserved.                                                  *
 *                                                                       *
 * For the licensing terms see $ROOTSYS/LICENSE.                         *
 * For the list of contributors see $ROOTSYS/README/CREDITS.             *
 *************************************************************************/

#ifndef ROOT_TQObjectEmitVA
#define ROOT_TQObjectEmitVA

// TQObject::EmitVA is implemented in its own header to break the
// circular dependency between TQObject and TQConnection.

#ifndef ROOT_TQObject
#include "TQObject.h"
#endif
#ifndef ROOT_TQConnection
#include "TQConnection.h"
#endif

template <typename... T> inline
void TQObject::EmitVA(const char *signal_name, Int_t /* nargs */, const T&... params)
{
   // Activate signal with variable argument list.
   // For internal use and for var arg EmitVA() in RQ_OBJECT.h.

   if (fSignalsBlocked || fgAllSignalsBlocked) return;

   TList classSigLists;
   CollectClassSignalLists(classSigLists, IsA());

   if (classSigLists.IsEmpty() && !fListOfSignals)
      return;

   TString signal = CompressName(signal_name);

   TQConnection *connection = 0;

   // execute class signals
   TList *sigList;
   TIter  nextSigList(&classSigLists);
   while ((sigList = (TList*) nextSigList()))
   {
      TIter nextcl((TList*) sigList->FindObject(signal));
      while ((connection = (TQConnection*)nextcl())) {
         gTQSender = GetSender();
         connection->ExecuteMethod(params...);
      }
   }
   if (!fListOfSignals)
      return;

   // execute object signals
   TIter next((TList*) fListOfSignals->FindObject(signal));
   while (fListOfSignals && (connection = (TQConnection*)next())) {
      gTQSender = GetSender();
      connection->ExecuteMethod(params...);
   }
}

#endif

Add missing file for variadic template version of TQObject::EmitVA


#include <glib.h>
#include <glib/gstdio.h>

#include <uuid/uuid.h>

#include <wizbit/file.h>

int main()
{
	{
		struct wiz_file *file;
		wiz_vref vref;
		FILE *fp;

		/*
		   Open up a new versioned file and create a couple
		   of revisions
		*/

		file = wiz_file_open(WIZ_FILE_NEW, 0, 0);
		fp = wiz_file_get_handle(file);

		fprintf(fp, "I BELIEVE");
		wiz_file_snapshot(file, vref);

		fprintf(fp, "\nNO RLY");
		wiz_file_add_parent(file, vref);
		wiz_file_snapshot(file, vref);

		fprintf(fp, "\nI CAN HAS BELIEVE!?");
		wiz_file_add_parent(file, vref);
		wiz_file_snapshot(file, vref);

		wiz_file_close(file);
	}

	return 0;
}

#include <glib.h>
#include <glib/gstdio.h>

#include <uuid/uuid.h>

#include <wizbit/vref.h>
#include <wizbit/file.h>

int main()
{
	{
		wiz_vref_hexbuffer buffer;
		struct wiz_file *file;
		wiz_vref vref;
		FILE *fp;

		/*
		   Open up a new versioned file and create a couple
		   of revisions
		*/

		file = wiz_file_open(WIZ_FILE_NEW, 0, 0);
		fp = wiz_file_get_handle(file);

		fprintf(fp, "I BELIEVE");
		wiz_file_snapshot(file, vref);

		fprintf(fp, "\nNO RLY");
		wiz_file_add_parent(file, vref);
		wiz_file_snapshot(file, vref);

		fprintf(fp, "\nI CAN HAS BELIEVE!?");
		wiz_file_add_parent(file, vref);
		wiz_file_snapshot(file, vref);

		printf("%s\n", wiz_vref_to_hex(vref, buffer));

		wiz_file_close(file);
	}

	return 0;
}

Print sha1 of last commit

Print sha1 of last commit


//
// Copyright (c) 2017 The ANGLE Project Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
// draw_call_perf_utils.h:
//   Common utilities for performance tests that need to do a large amount of draw calls.
//

#ifndef TESTS_TEST_UTILS_DRAW_CALL_PERF_UTILS_H_
#define TESTS_TEST_UTILS_DRAW_CALL_PERF_UTILS_H_

#include "angle_gl.h"

// Returns program ID. The program is left in use and the uniforms are set to default values:
// uScale = 0.5, uOffset = -0.5
GLuint SetupSimpleScaleAndOffsetProgram();

// Returns buffer ID filled with 2-component triangle coordinates. The buffer is left as bound.
// Generates triangles like this with 2-component coordinates:
//    A
//   / \
//  /   \
// B-----C
GLuint Create2DTriangleBuffer(size_t numTris, GLenum usage);

// Creates an FBO with a texture color attachment. The texture is GL_RGBA and has dimensions
// width/height. The FBO and texture ids are written to the out parameters.
void CreateColorFBO(GLsizei width, GLsizei height, GLuint *fbo, GLuint *texture);

#endif  // TESTS_TEST_UTILS_DRAW_CALL_PERF_UTILS_H_

//
// Copyright (c) 2017 The ANGLE Project Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
// draw_call_perf_utils.h:
//   Common utilities for performance tests that need to do a large amount of draw calls.
//

#ifndef TESTS_TEST_UTILS_DRAW_CALL_PERF_UTILS_H_
#define TESTS_TEST_UTILS_DRAW_CALL_PERF_UTILS_H_

#include <stddef.h>

#include "angle_gl.h"

// Returns program ID. The program is left in use and the uniforms are set to default values:
// uScale = 0.5, uOffset = -0.5
GLuint SetupSimpleScaleAndOffsetProgram();

// Returns buffer ID filled with 2-component triangle coordinates. The buffer is left as bound.
// Generates triangles like this with 2-component coordinates:
//    A
//   / \
//  /   \
// B-----C
GLuint Create2DTriangleBuffer(size_t numTris, GLenum usage);

// Creates an FBO with a texture color attachment. The texture is GL_RGBA and has dimensions
// width/height. The FBO and texture ids are written to the out parameters.
void CreateColorFBO(GLsizei width, GLsizei height, GLuint *fbo, GLuint *texture);

#endif  // TESTS_TEST_UTILS_DRAW_CALL_PERF_UTILS_H_

Fix angle_perftests compilation on Linux

BUG=angleproject:1669

Change-Id: Iec4ed1be1e17d86a095d8c35bddc48aa85effa39
Reviewed-on: https://chromium-review.googlesource.com/424967
Reviewed-by: Yuly Novikov <36f5580f63d0a3eacc17e89a61d11e2f646630d2@chromium.org>
Commit-Queue: Yuly Novikov <36f5580f63d0a3eacc17e89a61d11e2f646630d2@chromium.org>


// RUN: %clang -ccc-host-triple i386 -S -o - %s | \
// RUN:   FileCheck --check-prefix=DEFAULT %s
// DEFAULT: f0:
// DEFAULT: pushl %ebp
// DEFAULT: ret
// DEFAULT: f1:
// DEFAULT: pushl %ebp
// DEFAULT: ret

// RUN: %clang -ccc-host-triple i386 -S -o - -fomit-frame-pointer %s | \
// RUN:   FileCheck --check-prefix=OMIT_ALL %s
// OMIT_ALL: f0:
// OMIT_ALL-NOT: pushl %ebp
// OMIT_ALL: ret
// OMIT_ALL: f1:
// OMIT_ALL-NOT: pushl %ebp
// OMIT_ALL: ret

// RUN: %clang -ccc-host-triple i386 -S -o - -momit-leaf-frame-pointer %s | \
// RUN:   FileCheck --check-prefix=OMIT_LEAF %s
// OMIT_LEAF: f0:
// OMIT_LEAF-NOT: pushl %ebp
// OMIT_LEAF: ret
// OMIT_LEAF: f1:
// OMIT_LEAF: pushl %ebp
// OMIT_LEAF: ret

void f0() {}
void f1() { f0(); }

// RUN: %clang -ccc-host-triple i386-apple-darwin -S -o - %s | \
// RUN:   FileCheck --check-prefix=DARWIN %s
// DARWIN: f0:
// DARWIN: pushl %ebp
// DARWIN: ret
// DARWIN: f1:
// DARWIN: pushl %ebp
// DARWIN: ret

// RUN: %clang -ccc-host-triple i386-pc-linux-gnu -S -o - %s | \
// RUN:   FileCheck --check-prefix=LINUX %s
// LINUX: f0:
// LINUX-NOT: pushl %ebp
// LINUX: ret
// LINUX: f1:
// LINUX: pushl %ebp
// LINUX: ret

// RUN: %clang -ccc-host-triple i386-darwin -S -o - -fomit-frame-pointer %s | \
// RUN:   FileCheck --check-prefix=OMIT_ALL %s
// OMIT_ALL: f0:
// OMIT_ALL-NOT: pushl %ebp
// OMIT_ALL: ret
// OMIT_ALL: f1:
// OMIT_ALL-NOT: pushl %ebp
// OMIT_ALL: ret

// RUN: %clang -ccc-host-triple i386-darwin -S -o - -momit-leaf-frame-pointer %s | \
// RUN:   FileCheck --check-prefix=OMIT_LEAF %s
// OMIT_LEAF: f0:
// OMIT_LEAF-NOT: pushl %ebp
// OMIT_LEAF: ret
// OMIT_LEAF: f1:
// OMIT_LEAF: pushl %ebp
// OMIT_LEAF: ret

void f0() {}
void f1() { f0(); }

Fix test by fully specifying the platform.

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


/*
 * Copyright (c) Meta Platforms, Inc. and affiliates.
 *
 * 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 <folly/experimental/io/AsyncIoUringSocket.h>

namespace folly {

class AsyncIoUringSocketFactory {
 public:
  static bool supports(FOLLY_MAYBE_UNUSED folly::EventBase* eb) {
#if __has_include(<liburing.h>)
    return AsyncIoUringSocket::supports(eb);
#else
    return false;
#endif
  }

  template <class TWrapper, class... Args>
  static TWrapper create(FOLLY_MAYBE_UNUSED Args&&... args) {
#if __has_include(<liburing.h>)
    return TWrapper(new AsyncIoUringSocket(std::forward<Args>(args)...));
#else
    throw std::runtime_error("AsyncIoUringSocket not supported");
#endif
  }
};

} // namespace folly

io_uring: Add portability helper for AsyncIoUringSocket

Summary:
To help support platform independence, wrap up the IoUring socket in a helper factory
This allows platforms without io_uring to still use this include, and just receive false
for supports()

Reviewed By: NiteshKant

Differential Revision: D37925315

fbshipit-source-id: 5ac18a99ecdd4364377eb90db6ee652aea0182f6


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

#import <Foundation/Foundation.h>

@protocol FileSystemObject <NSObject>

@required

// The name of this object.
@property (strong, nonatomic) NSString *name;

// This should be able to be used to reconstruct whatever is needed
// to actually access the file/folder.
@property (strong, nonatomic) NSString *identifier;

// The parent of this object.
@property (weak, nonatomic) id<FileSystemObject> parent;

// Whether or not this object can be removed.
@property BOOL isRemovable;

// The size of this object. Folders should return the number of objects
// within, Files their size in bytes.
@property float size;

// Initialises this object with the given name, path, and parent.
- (id)initWithName:(NSString *)name path:(NSString *)path parent:(id<FileSystemObject>)parent;

// Returns the contents of this object.
- (id<NSObject>)contents;

// Removes this object.
// Returns YES if successful, NO otherwise.
// If NO is returned, the state of the object or its contents is unstable.
- (BOOL)remove;

@end

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

#import <Foundation/Foundation.h>

@protocol FileSystemObject <NSObject>

@required

// The name of this object.
@property (strong, nonatomic) NSString *name;

// This should be able to be used to reconstruct whatever is needed
// to actually access the file/folder.
@property (strong, nonatomic) NSString *identifier;

// The parent of this object.
@property (weak, nonatomic) id<FileSystemObject> parent;

// Whether or not this object can be removed.
@property BOOL isRemovable;

// The size of this object. Folders should return the number of objects
// within, Files their size in bytes.
@property float size;

// Returns the contents of this object.
- (id<NSObject>)contents;

@optional
// Removes this object.
// Returns YES if successful, NO otherwise.
// If NO is returned, the state of the object or its contents is unstable.
- (BOOL)remove;

// Initialises this object with the given name, path, and parent.
- (id)initWithName:(NSString *)name path:(NSString *)path parent:(id<FileSystemObject>)parent;

@end

Make remove and initWithName:path:parent optional.


/*
 * Copyright (c) 2004-2005 Silicon Graphics, Inc.
 * All Rights Reserved.
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License as
 * published by the Free Software Foundation.
 *
 * This program is distributed in the hope that it would be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write the Free Software Foundation,
 * Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 */
#ifndef __XFS_IOCTL32_H__
#define __XFS_IOCTL32_H__

extern long xfs_file_compat_ioctl(struct file *, unsigned, unsigned long);
extern long xfs_file_compat_invis_ioctl(struct file *, unsigned, unsigned);

#endif /* __XFS_IOCTL32_H__ */

/*
 * Copyright (c) 2004-2005 Silicon Graphics, Inc.
 * All Rights Reserved.
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License as
 * published by the Free Software Foundation.
 *
 * This program is distributed in the hope that it would be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write the Free Software Foundation,
 * Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 */
#ifndef __XFS_IOCTL32_H__
#define __XFS_IOCTL32_H__

extern long xfs_file_compat_ioctl(struct file *, unsigned, unsigned long);
extern long xfs_file_compat_invis_ioctl(struct file *, unsigned, unsigned long);

#endif /* __XFS_IOCTL32_H__ */

[XFS] Fix compiler warning from xfs_file_compat_invis_ioctl prototype.

SGI-PV: 904196
SGI-Modid: xfs-linux-melb:xfs-kern:25509a

Signed-off-by: Andrew Morton <5c1e68b099950c134891f0b6e179498a8ebe9cf9@osdl.org>
Signed-off-by: Nathan Scott <e2e3f1f24cbc439f8c1ba9b08f9954237d64be64@sgi.com>


// 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) {
}

Add test case for -fexceptions

Add test case for -fexceptions

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


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

#define QLA4XXX_DRIVER_VERSION	"5.03.00-k2"

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

#define QLA4XXX_DRIVER_VERSION	"5.03.00-k3"

Update driver version to 5.03.00-k3

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

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


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

int main(){
    unsigned char header[44];
    FILE * wavfile;
    wavfile = fopen("test.wav", "r");
    for(int i = 0; i < 44; i++){
        fscanf(wavfile, "%c", &header[i]);
    }
    fclose(wavfile);
    for(int i = 0; i < 44; i++){
        printf("%x\n", header[i]);
    }
    return 0;
}

Add wave header analyzer test

Add wave header analyzer test

This code will analyze the header of a wav file to determine if the
header is correct.


/* Copyright 2022 The TensorFlow Authors. All Rights Reserved.

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

#include "tensorflow/core/config/flags.h"

namespace tensorflow {
namespace flags {

class Flags {
 public:
  // Test only flags. See flags_test.cc for example usage.
  TF_DECLARE_FLAG(test_only_experiment_1, true, "Test only experiment 1.");
  TF_DECLARE_FLAG(test_only_experiment_2, false, "Test only experiment 2.");

  // Declare flags below here.
  // LINT.IfChange
  TF_DECLARE_FLAG(graph_building_optimization, false,
                  "Optimize graph building for faster tf.function tracing.");
  // LINT.ThenChange(//tensorflow/core/config/flag_defs.h)
};

Flags& Global();

}  // namespace flags
}  // namespace tensorflow

#endif  // TENSORFLOW_CORE_CONFIG_FLAG_DEFS_H_

/* Copyright 2022 The TensorFlow Authors. All Rights Reserved.

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

#include "tensorflow/core/config/flags.h"

namespace tensorflow {
namespace flags {

class Flags {
 public:
  // Test only flags. See flags_test.cc for example usage.
  TF_DECLARE_FLAG(test_only_experiment_1, true, "Test only experiment 1.");
  TF_DECLARE_FLAG(test_only_experiment_2, false, "Test only experiment 2.");

  // Declare flags below here.
  // LINT.IfChange
  TF_DECLARE_FLAG(graph_building_optimization, false,
                  "Optimize graph building for faster tf.function tracing.");
  // LINT.ThenChange(//tensorflow/core/config/flags_api_wrapper.cc)
};

Flags& Global();

}  // namespace flags
}  // namespace tensorflow

#endif  // TENSORFLOW_CORE_CONFIG_FLAG_DEFS_H_

Update the files referred to by the linter.

PiperOrigin-RevId: 438129536


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

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

Update Skia milestone to 82

Update Skia milestone to 82

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


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

#include "turing.h"

#define MAX_PROGRAM_LENGTH 32

int main() {
    int status;
    Turing *turing;

    status = 0;
    turing = init_turing();
    status = execute_instruction(turing, "0 110\n1 110");
    if (TURING_ERROR == status) {
        fprintf(stderr, "Exiting\n");
        return 1;
    } else if (TURING_HALT) {
        printf("Program reached halt state!\n");
    }

    free_turing(turing);

    return 0;
}

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

#include "turing.h"

#define MAX_PROGRAM_LENGTH 32

#define turing_try(statement) status = statement;\
                                       if (TURING_ERROR == status) {\
                                           return 1;\
                                       }

int main() {
    int status;
    Turing *turing;

    status = 0;
    turing = init_turing();
    status = execute_instruction(turing, "0 110\n1 110");
    if (TURING_ERROR == status) {
        fprintf(stderr, "Exiting\n");
        return 1;
    } else if (TURING_HALT) {
        printf("Program reached halt state!\n");
    }

    free_turing(turing);

    return 0;
}

Add turing_try function for handling errors


//
//  TBAViewController.h
//  the-blue-alliance
//
//  Created by Zach Orr on 4/28/16.
//  Copyright © 2016 The Blue Alliance. All rights reserved.
//

#import <UIKit/UIKit.h>

@class TBAPersistenceController, TBARefreshViewController;

@interface TBAViewController : UIViewController

@property (nonnull, readonly) TBAPersistenceController *persistenceController;

@property (nullable, nonatomic, strong) NSArray<TBARefreshViewController *> *refreshViewControllers;
@property (nullable, nonatomic, strong) NSArray<UIView *> *containerViews;

@property (nullable, nonatomic, strong) IBOutlet UISegmentedControl *segmentedControl;
@property (nullable, nonatomic, strong) IBOutlet UIView *segmentedControlView;

@property (nullable, nonatomic, strong) IBOutlet UILabel *navigationTitleLabel;
@property (nullable, nonatomic, strong) IBOutlet UILabel *navigationSubtitleLabel;

- (void)showView:(nonnull UIView *)showView;
- (void)updateInterface;
- (void)cancelRefreshes;

@end

//
//  TBAViewController.h
//  the-blue-alliance
//
//  Created by Zach Orr on 4/28/16.
//  Copyright © 2016 The Blue Alliance. All rights reserved.
//

#import <UIKit/UIKit.h>

@class TBAPersistenceController, TBARefreshViewController;

@interface TBAViewController : UIViewController

@property (nonnull, readonly) TBAPersistenceController *persistenceController;

@property (nullable, nonatomic, strong) NSArray<TBARefreshViewController *> *refreshViewControllers;
@property (nullable, nonatomic, strong) NSArray<UIView *> *containerViews;

@property (nullable, nonatomic, strong) IBOutlet UISegmentedControl *segmentedControl;
@property (nullable, nonatomic, strong) IBOutlet UIView *segmentedControlView;

@property (nullable, nonatomic, strong) IBOutlet UILabel *navigationTitleLabel;
@property (nullable, nonatomic, strong) IBOutlet UILabel *navigationSubtitleLabel;

- (void)cancelRefreshes;

@end

Remove methods from TBAVC that we no longer want to expose publically


#ifndef __IDRIS_DIRECTORY_H
#define __IDRIS_DIRECTORY_H

char* idris2_currentDirectory();
int idris2_changeDir(char* dir);
int idris2_createDir(char* dir);
void* idris2_openDir(char* dir);
void idris2_closeDIr(void* d);
int idris2_removeDir(char* path);
char* idris2_nextDirEntry(void* d);

#endif

#ifndef __IDRIS_DIRECTORY_H
#define __IDRIS_DIRECTORY_H

char* idris2_currentDirectory();
int idris2_changeDir(char* dir);
int idris2_createDir(char* dir);
void* idris2_openDir(char* dir);
void idris2_closeDir(void* d);
int idris2_removeDir(char* path);
char* idris2_nextDirEntry(void* d);

#endif

Fix forward declaration of idris_closeDir


inherit "/lib/string/sprint";
inherit "../support";

static string thing_form(object obj)
{
	string buffer;

	buffer = "
Fun little boxes:
\n";

	buffer += "<form action=\"object.lpc?obj=" + object2string(obj) + "\" method=\"post\">\n";
	buffer += "Mass: <input type=\"text\" name=\"mass\" value=\"" + mixed_sprint(obj->query_mass()) + "\"/>\n";
	buffer += "<input type=\"submit\" value=\"change mass\" />\n";
	buffer += "</form>\n";

	buffer += "<form action=\"object.lpc?obj=" + object2string(obj) + "\" method=\"post\">\n";
	buffer += "Local mass: <input type=\"text\" name=\"localmass\" value=\"" + mixed_sprint(obj->query_local_mass()) + "\"/>\n";
	buffer += "<input type=\"submit\" value=\"change local mass\" />\n";
	buffer += "</form>\n";

	return oinfobox("Configuration", 2, buffer);
}

inherit "/lib/string/sprint";
inherit "../support";

static string thing_form(object obj)
{
	string buffer;

	buffer = "
Fun little boxes:
\n";

	buffer += "<form action=\"object.lpc?obj=" + object2string(obj) + "\" method=\"post\">\n";
	buffer += "Local mass: <input type=\"text\" name=\"localmass\" value=\"" + mixed_sprint(obj->query_local_mass()) + "\"/>\n";
	buffer += "<input type=\"submit\" value=\"change local mass\" />\n";
	buffer += "</form>\n";

	return oinfobox("Configuration", 2, buffer);
}

Remove http form for mass, only manipulate local mass


//
//  RocksDBCuckooTableOptions.h
//  ObjectiveRocks
//
//  Created by Iska on 04/01/15.
//  Copyright (c) 2015 BrainCookie. All rights reserved.
//

#import <Foundation/Foundation.h>

@interface RocksDBCuckooTableOptions : NSObject

@property (nonatomic, assign) double hashTableRatio;
@property (nonatomic, assign) uint32_t maxSearchDepth;
@property (nonatomic, assign) uint32_t cuckooBlockSize;
@property (nonatomic, assign) BOOL identityAsFirstHash;
@property (nonatomic, assign) BOOL useModuleHash;

@end

//
//  RocksDBCuckooTableOptions.h
//  ObjectiveRocks
//
//  Created by Iska on 04/01/15.
//  Copyright (c) 2015 BrainCookie. All rights reserved.
//

#import <Foundation/Foundation.h>

@interface RocksDBCuckooTableOptions : NSObject

/**
 @brief
  Determines the utilization of hash tables. Smaller values
  result in larger hash tables with fewer collisions.
 */
@property (nonatomic, assign) double hashTableRatio;

/**
 @brief
  A property used by builder to determine the depth to go to
  to search for a path to displace elements in case of
  collision. Higher values result in more efficient hash tables
  with fewer lookups but take more time to build.
 */
@property (nonatomic, assign) uint32_t maxSearchDepth;

/**
 @brief
  In case of collision while inserting, the builder
  attempts to insert in the next `cuckooBlockSize`
  locations before skipping over to the next Cuckoo hash
  function. This makes lookups more cache friendly in case
  of collisions.
 */
@property (nonatomic, assign) uint32_t cuckooBlockSize;

/**
 @brief
  If this option is enabled, user key is treated as uint64_t and its value
  is used as hash value directly. This option changes builder's behavior.
  Reader ignore this option and behave according to what specified in table
  property.
 */
@property (nonatomic, assign) BOOL identityAsFirstHash;

/**
 @brief
  If this option is set to true, module is used during hash calculation.
  This often yields better space efficiency at the cost of performance.
  If this optino is set to false, # of entries in table is constrained to be
  power of two, and bit and is used to calculate hash, which is faster in
  general.
 */
@property (nonatomic, assign) BOOL useModuleHash;

@end

Add source code documentation for the RocksDB Cuckoo Table Options class


/*
 * lock_driver_lockd.h: Locking for domain lifecycle operations
 *
 * Copyright (C) 2010-2011 Red Hat, Inc.
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library.  If not, see
 * <http://www.gnu.org/licenses/>.
 *
 */

#ifndef __VIR_LOCK_DRIVER_LOCKD_H__
# define __VIR_LOCK_DRIVER_LOCKD_H__

enum virLockSpaceProtocolAcquireResourceFlags {
        VIR_LOCK_SPACE_PROTOCOL_ACQUIRE_RESOURCE_SHARED = 1,
        VIR_LOCK_SPACE_PROTOCOL_ACQUIRE_RESOURCE_AUTOCREATE = 2,
};

#endif /* __VIR_LOCK_DRIVER_LOCKD_H__ */

/*
 * lock_driver_lockd.h: Locking for domain lifecycle operations
 *
 * Copyright (C) 2010-2011 Red Hat, Inc.
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library.  If not, see
 * <http://www.gnu.org/licenses/>.
 *
 */

#ifndef __VIR_LOCK_DRIVER_LOCKD_H__
# define __VIR_LOCK_DRIVER_LOCKD_H__

enum virLockSpaceProtocolAcquireResourceFlags {
        VIR_LOCK_SPACE_PROTOCOL_ACQUIRE_RESOURCE_SHARED = (1 << 0),
        VIR_LOCK_SPACE_PROTOCOL_ACQUIRE_RESOURCE_AUTOCREATE = (1 << 1),
};

#endif /* __VIR_LOCK_DRIVER_LOCKD_H__ */

locking: Use bit shift for flag values not constant values.

So far it hasn't bitten us, but if the next value wasn't 4, then
the logic used to check flag bits would have issues.


#include <stdio.h>

int is_prime(int *);

int main()
{
	int answer;
	int number;
	int *refernce_of_a = &number;

	scanf("%d",refernce_of_a);

	answer = is_prime(&number);

	printf("%d",answer);
}

int is_prime(int *numb)
{
	int counter;

	for(counter =  0; counter <= *numb/2; counter++)
	{
		if(counter * counter == *numb)
		{
			return 0;
		}
	}
	return 1;
}

Add folder with is prime program Krastian Tomov No 21 10g


extern void print_int(int i);
extern void print_string(char c[]);

int return1(void) {
    return 1;
}

void main(void){

    int myInt;
    int intArr[3];

    /* need assignToArry to work for this to work */
    intArr[0] = 999;
    intArr[1] = 100;
    intArr[2] = 200;

    /* test index from a variable */
    myInt = 1;
    print_string("should get 100\ngot: ");
    print_int(intArr[myInt]);
    print_string("\n\n");

    /* test index from a function call */
    print_string("should get 100\ngot: ");
    print_int(intArr[return1()]);
    print_string("\n\n");

    /* test index from a complex expr */
    print_string("should get 100\ngot: ");
    print_int(intArr[return1() + 4 / 8]);
    print_string("\n\n");

    intArr[return1()] = 77;
    print_string("should get 77\ngot: ");
    print_int(intArr[1]);
    print_string("\n\n");
}

Add test case for indexing into an array, since the array index can be an expression


/**
 * @file
 *
 * @brief Tests for mini plugin
 *
 * @copyright BSD License (see doc/LICENSE.md or http://www.libelektra.org)
 *
 */

#include "values.h"

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

#include <kdbconfig.h>

#include <tests_plugin.h>

static void test_basics ()
{
	printf ("• Test basic functionality of plugin\n");

	Key * parentKey = keyNew ("system/elektra/modules/mini", KEY_END);
	KeySet * conf = ksNew (0, KS_END);
	PLUGIN_OPEN ("mini");

	KeySet * ks = ksNew (0, KS_END);

	succeed_if (plugin->kdbGet (plugin, ks, parentKey) == KEYSET_MODIFIED, "Could not retrieve plugin contract");

	keyDel (parentKey);
	ksDel (ks);
	PLUGIN_CLOSE ();
}

int main (int argc, char ** argv)
{
	printf ("mINI Tests 🚙\n");
	printf ("==============\n\n");

	init (argc, argv);

	test_basics ();

	printf ("\nResults: %d Test%s done — %d error%s.\n", nbTest, nbTest != 1 ? "s" : "", nbError, nbError != 1 ? "s" : "");

	return nbError;
}

/**
 * @file
 *
 * @brief Tests for mini plugin
 *
 * @copyright BSD License (see doc/LICENSE.md or http://www.libelektra.org)
 *
 */

/* -- Imports --------------------------------------------------------------------------------------------------------------------------- */

#include "values.h"

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

#include <kdbconfig.h>

#include <tests_plugin.h>

/* -- Functions ------------------------------------------------------------------------------------------------------------------------- */

static void test_basics ()
{
	printf ("• Test basic functionality of plugin\n");

	Key * parentKey = keyNew ("system/elektra/modules/mini", KEY_END);
	KeySet * conf = ksNew (0, KS_END);
	PLUGIN_OPEN ("mini");

	KeySet * ks = ksNew (0, KS_END);

	succeed_if (plugin->kdbGet (plugin, ks, parentKey) == KEYSET_MODIFIED, "Could not retrieve plugin contract");

	keyDel (parentKey);
	ksDel (ks);
	PLUGIN_CLOSE ();
}

/* -- Main ------------------------------------------------------------------------------------------------------------------------------ */

int main (int argc, char ** argv)
{
	printf ("mINI Tests 🚙\n");
	printf ("==============\n\n");

	init (argc, argv);

	test_basics ();

	printf ("\nResults: %d Test%s done — %d error%s.\n", nbTest, nbTest != 1 ? "s" : "", nbError, nbError != 1 ? "s" : "");

	return nbError;
}

Use comments to structure file

mINI: Use comments to structure file


#ifndef QTPROMISE_QPROMISEHELPERS_H
#define QTPROMISE_QPROMISEHELPERS_H

// QtPromise
#include "qpromise_p.h"

namespace QtPromise {

template <typename T>
typename QtPromisePrivate::PromiseDeduce<T>::Type qPromise(T&& value)
{
    using namespace QtPromisePrivate;
    using Promise = typename PromiseDeduce<T>::Type;
    return Promise([&](
        const QPromiseResolve<typename Promise::Type>& resolve,
        const QPromiseReject<typename Promise::Type>& reject) {
        PromiseFulfill<T>::call(std::forward<T>(value), resolve, reject);
    });
}

QPromise<void> qPromise()
{
    return QPromise<void>([](
        const QPromiseResolve<void>& resolve) {
        resolve();
    });
}

template <typename T>
QPromise<QVector<T> > qPromiseAll(const QVector<QPromise<T> >& promises)
{
    return QPromise<T>::all(promises);
}

QPromise<void> qPromiseAll(const QVector<QPromise<void> >& promises)
{
    return QPromise<void>::all(promises);
}

} // namespace QtPromise

#endif // QTPROMISE_QPROMISEHELPERS_H

#ifndef QTPROMISE_QPROMISEHELPERS_H
#define QTPROMISE_QPROMISEHELPERS_H

// QtPromise
#include "qpromise_p.h"

namespace QtPromise {

template <typename T>
static inline typename QtPromisePrivate::PromiseDeduce<T>::Type qPromise(T&& value)
{
    using namespace QtPromisePrivate;
    using Promise = typename PromiseDeduce<T>::Type;
    return Promise([&](
        const QPromiseResolve<typename Promise::Type>& resolve,
        const QPromiseReject<typename Promise::Type>& reject) {
        PromiseFulfill<T>::call(std::forward<T>(value), resolve, reject);
    });
}

static inline QPromise<void> qPromise()
{
    return QPromise<void>([](
        const QPromiseResolve<void>& resolve) {
        resolve();
    });
}

template <typename T>
static inline QPromise<QVector<T> > qPromiseAll(const QVector<QPromise<T> >& promises)
{
    return QPromise<T>::all(promises);
}

static inline QPromise<void> qPromiseAll(const QVector<QPromise<void> >& promises)
{
    return QPromise<void>::all(promises);
}

} // namespace QtPromise

#endif // QTPROMISE_QPROMISEHELPERS_H

Fix helpers multiple defined symbols

Fix helpers multiple defined symbols


struct inner {
  int field;
};

struct outer {
  const struct inner inner;
};

int main()
{
  struct outer outer = { { 0 } };
  return outer.inner.field;
}

Add a test case showing that CIL forgets to remove the "const" qualifier on structures within structures. When it subsequently converts initializations of such structures into assignments, the resulting C code appears to be assigning into a const field. That produces warnings or errors from the C compiler.


#include <stdint.h>

void outb(uint16_t port, uint8_t value) {
  asm volatile ("outb %1, %0" : : "dN" (port), "a" (value));
}

unsigned char inb(uint16_t port) {
  unsigned char ret;
  asm volatile ("inb %1, %0" : "=a" (ret) : "dN" (port));
  return ret;
}

void outl(uint16_t port, uint32_t value) {
  asm volatile ("outl %1, %0" : : "dN" (port), "a" (value));
}

uint32_t inl(uint16_t port) {
  uint32_t ret;
  asm volatile ("inl %1, %0" : "=a" (ret) : "dN" (port));
  return ret;
}

Add inl and outl functions

Add inl and outl functions


// -*- C++ -*-
#ifndef _writer_verilog_axi_master_controller_h_
#define _writer_verilog_axi_master_controller_h_

#include "writer/verilog/axi/axi_controller.h"

namespace iroha {
namespace writer {
namespace verilog {
namespace axi {

class MasterController : public AxiController {
public:
  MasterController(const IResource &res,
		   bool reset_polarity);
  ~MasterController();

  void Write(ostream &os);

  static void AddPorts(Module *mod, bool r, bool w,
		       string *s);

private:
  void OutputFsm(ostream &os);
  void ReaderFsm(ostream &os);
  void WriterFsm(ostream &os);

  unique_ptr<Ports> ports_;
  bool r_, w_;
  int burst_len_;
};

}  // namespace axi
}  // namespace verilog
}  // namespace writer
}  // namespace iroha

#endif // _writer_verilog_axi_master_controller_h_

// -*- C++ -*-
#ifndef _writer_verilog_axi_master_controller_h_
#define _writer_verilog_axi_master_controller_h_

#include "writer/verilog/axi/axi_controller.h"

namespace iroha {
namespace writer {
namespace verilog {
namespace axi {

class MasterController : public AxiController {
public:
  MasterController(const IResource &res,
		   bool reset_polarity);
  ~MasterController();

  void Write(ostream &os);

  static void AddPorts(Module *mod, bool r, bool w,
		       string *s);

private:
  void OutputFsm(ostream &os);
  void ReaderFsm(ostream &os);
  void WriterFsm(ostream &os);

  bool r_, w_;
  int burst_len_;
};

}  // namespace axi
}  // namespace verilog
}  // namespace writer
}  // namespace iroha

#endif // _writer_verilog_axi_master_controller_h_

Fix wrong member declaration which shadows parent class.


#define JOIN_(a, b) a ## b
#define JOIN(a, b) JOIN_(a, b)

#define SYMBL(x) JOIN(__USER_LABEL_PREFIX__, x)

#if defined(__linux__)
#  define SECTION_NAME_TEXT .text
#  define SECTION_NAME_BSS .bss
#elif defined(__DARWIN__)
#  define SECTION_NAME_TEXT __TEXT,__text
#  define SECTION_NAME_BSS __BSS,__bss
#else
#  error unknown target
#endif

#define JOIN_(a, b) a ## b
#define JOIN(a, b) JOIN_(a, b)

#define SYMBL(x) JOIN(__USER_LABEL_PREFIX__, x)

#if defined(__linux__)
#  define SECTION_NAME_TEXT .text
#  define SECTION_NAME_BSS .bss

.section .note.GNU-stack,"",@progbits

#elif defined(__DARWIN__)
#  define SECTION_NAME_TEXT __TEXT,__text
#  define SECTION_NAME_BSS __BSS,__bss
#else
#  error unknown target
#endif

Enable noexecstack for local-lib builds

Enable noexecstack for local-lib builds


/*
 * fibmap - List blocks of a file
 *
 * Written in 2012 by Prashant P Shah <pshah.mumbai@gmail.com>
 *
 * To the extent possible under law, the author(s) have dedicated
 * all copyright and related and neighboring rights to this software
 * to the public domain worldwide. This software is distributed
 * without any warranty.
 *
 * You should have received a copy of the CC0 Public Domain Dedication
 * along with this software.
 * If not, see <http://creativecommons.org/publicdomain/zero/1.0/>.
 */

#include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
#include <fcntl.h>
#include <linux/fs.h>
#include <assert.h>

int main(int argc, char **argv)
{
	int fd, i, block, blocksize, blkcnt;
	struct stat st;

	assert(argv[1] != NULL);

	fd = open(argv[1], O_RDONLY);
	if (fd <= 0) {
		perror("error opening file");
		goto end;
	}

	if (ioctl(fd, FIGETBSZ, &blocksize)) {
		perror("FIBMAP ioctl failed");
		goto end;
	}

	if (fstat(fd, &st)) {
		perror("fstat error");
		goto end;
	}

	blkcnt = (st.st_size + blocksize - 1) / blocksize;
	printf("File %s size %d blocks %d blocksize %d\n",
			argv[1], (int)st.st_size, blkcnt, blocksize);

	for (i = 0; i < blkcnt; i++) {
		block = i;
		if (ioctl(fd, FIBMAP, &block)) {
			perror("FIBMAP ioctl failed");
		}
		printf("%3d %10d\n", i, block);
	}

end:
	close(fd);
	return 0;
}

Add program to list blocks of a file

Add program to list blocks of a file

Signed-off-by: Prashant Shah <80f978b5ac27fb318171799f0fb6a277863f2bf5@gmail.com>


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

#include <efivar.h>

#define TEST_GUID EFI_GUID(0x84be9c3e,0x8a32,0x42c0,0x891c,0x4c,0xd3,0xb0,0x72,0xbe,0xcc)

static void
clean_test_environment(void)
{
	efi_del_variable(TEST_GUID, "small");
	efi_del_variable(TEST_GUID, "large");
}

#define report_error(str) ({fprintf(stderr, str); goto fail;})

int main(void)
{
	if (!efi_variables_supported()) {
		printf("UEFI variables not supported on this machine.\n");
		return 0;
	}

	clean_test_environment();

	int ret = 1;

	char smallvalue[] = "smallvalue";

	int rc;
	rc = efi_set_variable(TEST_GUID, "small",
			      smallvalue, strlen(smallvalue)+1,
			      EFI_VARIABLE_RUNTIME_ACCESS);
	if (rc < 0)
		report_error("small value test failed: %m\n");

	ret = 0;
fail:
	return ret;
}

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

#include <efivar.h>

#define TEST_GUID EFI_GUID(0x84be9c3e,0x8a32,0x42c0,0x891c,0x4c,0xd3,0xb0,0x72,0xbe,0xcc)

static void
clean_test_environment(void)
{
	efi_del_variable(TEST_GUID, "small");
	efi_del_variable(TEST_GUID, "large");
}

#define report_error(str) ({fprintf(stderr, str); goto fail;})

int main(void)
{
	if (!efi_variables_supported()) {
		printf("UEFI variables not supported on this machine.\n");
		return 0;
	}

	clean_test_environment();

	int ret = 1;

	char smallvalue[] = "smallvalue";

	int rc;
	rc = efi_set_variable(TEST_GUID, "small",
			      smallvalue, strlen(smallvalue)+1,
			      EFI_VARIABLE_BOOTSERVICE_ACCESS |
			      EFI_VARIABLE_RUNTIME_ACCESS |
			      EFI_VARIABLE_NON_VOLATILE);
	if (rc < 0)
		report_error("small value test failed: %m\n");

	ret = 0;
fail:
	return ret;
}

Use flags that will actually work when testing.


// REQUIRES: x86_64-linux
// RUN: %host_cc -O0 -g %s -o %t 2>&1
// RUN: %t 2>&1 | llvm-symbolizer -print-source-context-lines=5 -obj=%t | FileCheck %s

#include <stdio.h>

int inc(int a) {
  return a + 1;
}

int main() {
  printf("%p\n", inc);
  return 0;
}

// CHECK: inc
// CHECK: print_context.c:7
// CHECK: 5  : #include
// CHECK: 6  :
// CHECK: 7 >: int inc
// CHECK: 8  :   return
// CHECK: 9  : }

// REQUIRES: x86_64-linux
// RUN: %host_cc -O0 -g %s -o %t 2>&1
// RUN: %t 2>&1 | llvm-symbolizer -print-source-context-lines=5 -obj=%t | FileCheck %s

// CHECK: inc
// CHECK: print_context.c:[[@LINE+9]]
// CHECK: [[@LINE+6]]  : #include
// CHECK: [[@LINE+6]]  :
// CHECK: [[@LINE+6]] >: int inc
// CHECK: [[@LINE+6]]  :   return
// CHECK: [[@LINE+6]]  : }

#include <stdio.h>

int inc(int a) {
  return a + 1;
}

int main() {
  printf("%p\n", inc);
  return 0;
}

Make test robust to changes in prefix/avoid hardcoded line numbers

git-svn-id: 0ff597fd157e6f4fc38580e8d64ab130330d2411@309516 91177308-0d34-0410-b5e6-96231b3b80d8
(cherry picked from commit 429be9362d598d3b7b3ea6e19b1be2dca867aa0a)


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

#ifndef SkUserConfigManual_DEFINED
#define SkUserConfigManual_DEFINED
  #define GR_GL_CUSTOM_SETUP_HEADER "gl/GrGLConfig_chrome.h"
  #define GR_TEST_UTILS 1
  #define SKIA_DLL
  #define SK_BUILD_FOR_ANDROID_FRAMEWORK
  #define SK_DEFAULT_FONT_CACHE_LIMIT   (768 * 1024)
  #define SK_DEFAULT_GLOBAL_DISCARDABLE_MEMORY_POOL_SIZE (512 * 1024)
  #define SK_USE_FREETYPE_EMBOLDEN

  // Legacy flags
  #define SK_IGNORE_GPU_DITHER
  #define SK_IGNORE_LINEONLY_AA_CONVEX_PATH_OPTS
  #define SK_LEGACY_SWEEP_GRADIENT
  #define SK_SUPPORT_DEPRECATED_CLIPOPS
  #define SK_SUPPORT_LEGACY_BILERP_IGNORING_HACK
  // Needed until we fix https://bug.skia.org/2440
  #define SK_SUPPORT_LEGACY_CLIPTOLAYERFLAG
  #define SK_SUPPORT_LEGACY_DRAWFILTER
  #define SK_SUPPORT_LEGACY_EMBOSSMASKFILTER
  #define SK_SUPPORT_LEGACY_GRADIENT_DITHERING
  #define SK_SUPPORT_LEGACY_SHADER_ISABITMAP
  #define SK_SUPPORT_LEGACY_TILED_BITMAPS
#endif // SkUserConfigManual_DEFINED

Add file to replace android_framework_defines.gni

SkUserConfig.h will continue to be generated by gn_to_bp.py, and it
will include all the #defines that were pulled from our GN files. But it
will also include this new file, SkUserConfigManual.h, which contains
all the #defines that were previously stored in gn_to_bp.py and
android_framework_defines.gni. This allows us

Does not actually change anything until
https://skia-review.googlesource.com/c/22072/ lands. (It still should
not change the build in practice, since this file contains the defines
that are no longer added to SkUserConfig.h.)

Test: No test necessary.
Bug: 63429612
Change-Id: I9f6e85ad6d714c3763136303faf7564c3a9cc933


#ifndef GRAPH_H
#define GRAPH_H

#include <unordered_map>
#include <unordered_set>

template<typename T>
class Graph {

public:
    void connect(const T &a, const T &b);
    const std::unordered_set<T>& get_vertex_ids() const;

    inline const std::unordered_set<T>& get_neighbors(const T &vertex_id) const {
        return vertices_.at(vertex_id)->adjacent_ids_;
    }

    ~Graph();

private:
    struct Vertex {
        T id_;
        std::unordered_set<Vertex*> adjacent_;
        std::unordered_set<T> adjacent_ids_;
        Vertex(T id) {
           id_ = id;
        }

        bool has_neighbor(Vertex *v) {
            return adjacent_.find(v) != adjacent_.end();
        }

        void add_neighbor(Vertex* v) {
            adjacent_.insert(v);
            adjacent_ids_.insert(v->id_);
        }
    };

    std::unordered_map<T, Vertex*> vertices_;
    std::unordered_set<T> vertex_ids;

    Vertex* get_vertex(const T &a) const;
    Vertex* get_or_insert(const T &a);
};

template class Graph<int>;

#endif

#ifndef GRAPH_H
#define GRAPH_H

#include <unordered_map>
#include <unordered_set>

template<typename T>
class Graph {

public:
    void connect(const T &a, const T &b);
    const std::unordered_set<T>& get_vertex_ids() const;

    inline const std::unordered_set<T>& get_neighbors(const T &vertex_id) const {
        return vertices_.at(vertex_id)->adjacent_ids_;
    }

    ~Graph();

private:
    struct Vertex {
        T id_;
        std::unordered_set<Vertex*> adjacent_;
        std::unordered_set<T> adjacent_ids_;
        Vertex(const T &id) : id_(id) {}

        bool has_neighbor(Vertex *v) {
            return adjacent_.find(v) != adjacent_.end();
        }

        void add_neighbor(Vertex* v) {
            adjacent_.insert(v);
            adjacent_ids_.insert(v->id_);
        }
    };

    std::unordered_map<T, Vertex*> vertices_;
    std::unordered_set<T> vertex_ids;

    Vertex* get_vertex(const T &a) const;
    Vertex* get_or_insert(const T &a);
};

template class Graph<int>;

#endif

Move id initialization to initialization list


//
// Created by patrick on 31/03/17.
//

#ifndef PELOTON_HASH_UTIL_H
#define PELOTON_HASH_UTIL_H

#endif //PELOTON_HASH_UTIL_H

Add hashing for AbstractExpression, TupleValueExpression, ConstValueExpression


// Parse diagnostic arguments in the driver
// PR12181

// RUN: not %clang -target x86_64-apple-darwin10 \
// RUN:   -fsyntax-only -fzyzzybalubah \
// RUN:   -Werror=unused-command-line-argument %s

// RUN: not %clang -target x86_64-apple-darwin10 \
// RUN:   -fsyntax-only -fzyzzybalubah -Werror %s

Remove trailing whitespace (especially after a \ which should be trailing)

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


#ifndef __gcd_h_included__
#define __gcd_h_included__

// Euclid's algorithm for computing the greatest common divisor

template<typename I> I gcd(I a, I b)
{
	while (a > 0 && b > 0) {
		if (a > b)
			a -= b;
		else
			b -= a;
	}

	return a == 0 ? b : a;
}

#endif

Add algorithm for greatest common divisor


/*
 *  Copyright 2008 Markus Prinz
 *  Released unter an MIT licence
 *
 */

#include <ruby.h>
#include <CoreMIDI/CoreMIDI.h>

VALUE callback_proc = Qnil;

MIDIPortRef inPort = NULL;
MIDIClientRef client = NULL;

static void RbMIDIReadProc(const MIDIPacketList* packetList, void* readProcRefCon, void* srcConnRefCon)
{

}

void Init_rbcoremidi (void)
{
  // Add the initialization code of your module here.
}

/*
 *  Copyright 2008 Markus Prinz
 *  Released unter an MIT licence
 *
 */

#include <ruby.h>
#include <CoreMIDI/CoreMIDI.h>

VALUE callback_proc = Qnil;

MIDIPortRef inPort = NULL;
MIDIClientRef client = NULL;

static void RbMIDIReadProc(const MIDIPacketList* packetList, void* readProcRefCon, void* srcConnRefCon)
{

}

static VALUE t_sources(VALUE self)
{
    int number_of_sources = MIDIGetNumberOfSources();

    VALUE source_ary = rb_ary_new2(number_of_sources);

    for(int idx = 0; idx < number_of_sources; ++idx)
    {
        MIDIEndpointRef src = MIDIGetSource(idx);
        CFStringRef pname;
        char name[64];

        MIDIObjectGetStringProperty(src, kMIDIPropertyName, pname);
        CFStringGetCString(pname, name, sizeof(name), 0);
        CFRelease(pname);

        rb_ary_push(source_ary, rb_str_new2(name));
    }

    return source_ary;
}

void Init_rbcoremidi (void)
{
  // Add the initialization code of your module here.
}

Add best guess at a method that returns an array with the names of all sources


/* Exercise 1-11: How would you test the word count program? What kinds of
 * input are most likely to uncover bugs if there are any? */

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

int main(int argc, char **argv)
{
  /* This is such a cheat. */
  printf("Types of input that could be used to test a word counting program:\n");
  printf(" - Input with no characters,\n");
  printf(" - input with just one massive word that's MAX_INT letters long,\n");
  printf(" - input with more than MAX_INT words,\n");
  printf(" - input with varying whitespace to delimit words,\n");
  printf(" - binary input (such as an image file),\n");
  printf(" - and Unicode input.\n");
  return EXIT_SUCCESS;
}

Add incredibly lame solution to Exercise 1-11.


#ifdef E_TYPEDEFS
#else
# ifndef E_SMART_RANDR_H
#  define E_SMART_RANDR_H

Evas_Object *e_smart_randr_add(Evas *evas);
void e_smart_randr_virtual_size_calc(Evas_Object *obj);
void e_smart_randr_monitors_create(Evas_Object *obj);

# endif
#endif

#ifdef E_TYPEDEFS
#else
# ifndef E_SMART_RANDR_H
#  define E_SMART_RANDR_H

Evas_Object *e_smart_randr_add(Evas *evas);
void e_smart_randr_virtual_size_calc(Evas_Object *obj);
void e_smart_randr_monitors_create(Evas_Object *obj);
void e_smart_randr_min_size_get(Evas_Object *obj, Evas_Coord *mw, Evas_Coord *mh);

# endif
#endif

Add function prototype for min_size_get.

Signed-off-by: Christopher Michael <cp.michael@samsung.com>

SVN revision: 84149


//
//  Core.h
//  BRStyle
//
//  Created by Matt on 24/07/15.
//  Copyright (c) 2015 Blue Rocket. Distributable under the terms of the Apache License, Version 2.0.
//

#import <BRStyle/BRUIStyle.h>
#import <BRStyle/BRUIStyleObserver.h>
#import <BRStyle/BRUIStyleSettings.h>
#import <BRStyle/BRUIStylishHost.h>
#import <BRStyle/NSObject+BRUIStyle.h>
#import <BRStyle/UIBarButtonItem+BRUIStyle.h>
#import <BRStyle/UIFont+BRUIStyle.h>
#import <BRStyle/UIView+BRUIStyle.h>
#import <BRStyle/UIViewController+BRUIStyle.h>

//
//  Core.h
//  BRStyle
//
//  Created by Matt on 24/07/15.
//  Copyright (c) 2015 Blue Rocket. Distributable under the terms of the Apache License, Version 2.0.
//

#import <BRStyle/BRUIStyle.h>
#import <BRStyle/BRUIStyleObserver.h>
#import <BRStyle/BRUIStyleSettings.h>
#import <BRStyle/BRUIStylishHost.h>
#import <BRStyle/NSObject+BRUIStyle.h>
#import <BRStyle/UIBarButtonItem+BRUIStyle.h>
#import <BRStyle/UIView+BRUIStyle.h>
#import <BRStyle/UIViewController+BRUIStyle.h>

Remove import that no longer exists.

Remove import that no longer exists.


#ifndef _LIBADT_CL_LIST_H
#define _LIBADT_CL_LIST_H

#include <adt_commons.h>

#include <list.h>

typedef list_root cl_list_root;

struct _list_node {
	list_node *prev;	// Pointer to prev list_node element.
	list_node *next;	// Pointer to next list_node element.
	void *data;			// Pointer to the element added on the list.
};

/*
 * Create a empty list structure and set a destroy function for its elements.
 * The destroy argument gives a way to free the entire structure when we
 * call dl_list_destroy. For malloc/calloc data, free must be used. If data
 * is a struct with other members, a function designed to free its memory
 * must be provided. If the data is static or have another way to free its
 * memory, NULL must be set.
 * Complexity: O(1).
 */
cl_list_root * cl_list_create(t_destroyfunc destroyfunc);

/*
 * Insert an element in the list after the current element indicated.
 * If *current is NULL, *data is appended on the head.
 * Complexity: O(1).
 */
int cl_list_insert_el_next(cl_list_root *list, list_node *current, void *data);

/*
 * Insert an element in the list before the current element indicated.
 * If *current is NULL, *data is appended on the tail.
 * Complexity: O(1).
 */
int cl_list_insert_el_prev(cl_list_root *list, list_node *current, void *data);

/*
 * Move an element after the newpos element indicated.
 * Complexity: O(1).
 */
int cl_list_move_el_next(cl_list_root *list, list_node *current, list_node *newpos);

/*
 * Move an element before the newpos element indicated.
 * Complexity: O(1).
 */
int cl_list_move_el_prev(cl_list_root *list, list_node *current, list_node *newpos);

/*
 * Change positions of the two elements on the list.
 * Complexity: O(1).
 */
int cl_list_swap_el(cl_list_root *list, list_node *el1, list_node *el2);

/*
 * Remove the element in the head and save the respective data in **data.
 * Compĺexity: O(1).
 */
void * cl_list_rem_el(cl_list_root *list);

/*
 * Destroy the list and its elements, if have any. If destroy function is provided,
 * it will be used.
 * Complexity: O(n).
 */
void cl_list_destroy(cl_list_root *list);

#endif

Add function declarations for Circular Lists.


#ifndef	BLOCK_CHANNEL_H
#define	BLOCK_CHANNEL_H

class Action;
class Buffer;

class BlockChannel {
protected:
	BlockChannel(void)
	{ }

public:
	virtual ~BlockChannel()
	{ }

	virtual Action *close(EventCallback *) = 0;
	virtual Action *read(off_t, EventCallback *) = 0;
	virtual Action *write(off_t, Buffer *, EventCallback *) = 0;
};

#endif /* !BLOCK_CHANNEL_H */

#ifndef	BLOCK_CHANNEL_H
#define	BLOCK_CHANNEL_H

class Action;
class Buffer;

class BlockChannel {
protected:
	size_t bsize_;

	BlockChannel(size_t bsize)
	: bsize_(bsize)
	{ }

public:
	virtual ~BlockChannel()
	{ }

	virtual Action *close(EventCallback *) = 0;
	virtual Action *read(off_t, EventCallback *) = 0;
	virtual Action *write(off_t, Buffer *, EventCallback *) = 0;
};

#endif /* !BLOCK_CHANNEL_H */

Make block size a protected member of a block channel.

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


/* Tuple object interface */

#ifndef Py_STRUCTSEQ_H
#define Py_STRUCTSEQ_H
#ifdef __cplusplus
extern "C" {
#endif

typedef struct PyStructSequence_Field {
	char *name;
	char *doc;
} PyStructSequence_Field;

typedef struct PyStructSequence_Desc {
	char *name;
	char *doc;
	struct PyStructSequence_Field *fields;
	int n_in_sequence;
} PyStructSequence_Desc;

extern char* PyStructSequence_UnnamedField;

PyAPI_FUNC(void) PyStructSequence_InitType(PyTypeObject *type,
						 PyStructSequence_Desc *desc);

PyAPI_FUNC(PyObject *) PyStructSequence_New(PyTypeObject* type);

typedef struct {
	PyObject_VAR_HEAD
	PyObject *ob_item[1];
} PyStructSequence;

/* Macro, *only* to be used to fill in brand new objects */
#define PyStructSequence_SET_ITEM(op, i, v) \
	(((PyStructSequence *)(op))->ob_item[i] = v)

#ifdef __cplusplus
}
#endif
#endif /* !Py_STRUCTSEQ_H */

Clean up some whitespace to be consistent with Python's C style.


#import <Foundation/Foundation.h>

@interface NSURL (Directories)

/** Returns an NSURL representing the first path found matching the specified constants or nil if none */
+ (NSURL *)URLForDirectory:(NSSearchPathDirectory)directoryConstant domainMask:(NSSearchPathDomainMask)domainMask;

/** Returns the application support directory with the app's bundle id appended.  As recommended in the Fil System Programming Guide */
+ (NSURL *)URLForApplicationSupportDataDirectory;

/** Append a subfolder/file path onto the app data directory */
+ (NSURL *)URLForApplicationSupportWithAppendedPath:(NSString *)pathToAppend;

/** Returns the user directory */
+ (NSURL *)URLForUserDirectory;

/** Append a subfolder/file path onto the user directory */
+ (NSURL *)URLForUserDirectoryWithAppendedPath:(NSString *)pathToAppend;

/** Returns the user's document directory */
+ (NSURL *)URLForDocumentDirectory;

/** Append a subfolder/file path onto the user's document directory */
+ (NSURL *)URLForDocumentDirectoryWithAppendedPath:(NSString *)pathToAppend;

@end

Add shortcuts to create NSURL's for various app folders