/* OSEKOS Implementation of an OSEK Scheduler
 * Copyright (C) 2015 Joakim Plate
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.

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

 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
 */

#ifndef OS_CFG_H_
#define OS_CFG_H_

#ifdef OS_CFG_ARCH_POSIX
#include "Os_Arch_Posix.h"
#endif

#ifdef OS_CFG_ARCH_FIBERS
#include "Os_Arch_Fibers.h"
#endif

#define OS_TASK_COUNT 3
#define OS_PRIO_COUNT 3

#define OS_TICK_US    100000U

extern void errorhook(StatusType ret);
#define OS_ERRORHOOK(_ret) errorhook(_ret)

#endif /* OS_CFG_H_ */

/* OSEKOS Implementation of an OSEK Scheduler
 * Copyright (C) 2015 Joakim Plate
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.

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

 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
 */

#ifndef OS_CFG_H_
#define OS_CFG_H_

#ifdef OS_CFG_ARCH_POSIX
#include "Os_Arch_Posix.h"
#endif

#ifdef OS_CFG_ARCH_FIBERS
#include "Os_Arch_Fibers.h"
#endif

#define OS_TASK_COUNT 3
#define OS_PRIO_COUNT 3

#define OS_TICK_US    1000000U

extern void errorhook(StatusType ret);
#define OS_ERRORHOOK(_ret) errorhook(_ret)

#endif /* OS_CFG_H_ */

Increment timer ticks for now

Increment timer ticks for now


//===- MCSymbolXCOFF.h -  ----------------------------------------*- C++ -*-===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
#ifndef LLVM_MC_MCSYMBOLXCOFF_H
#define LLVM_MC_MCSYMBOLXCOFF_H

#include "llvm/BinaryFormat/XCOFF.h"
#include "llvm/MC/MCSymbol.h"
#include "llvm/IR/GlobalValue.h"

namespace llvm {

class MCSymbolXCOFF : public MCSymbol {
  // The IR symbol this MCSymbolXCOFF is based on. It is set on function
  // entry point symbols when they are the callee operand of a direct call
  // SDNode.
  const GlobalValue *GV = nullptr;

public:
  MCSymbolXCOFF(const StringMapEntry<bool> *Name, bool isTemporary)
      : MCSymbol(SymbolKindXCOFF, Name, isTemporary) {}

  void setGlobalValue(const GlobalValue *G) { GV = G; }
  const GlobalValue *getGlobalValue() const { return GV; }

  static bool classof(const MCSymbol *S) { return S->isXCOFF(); }
};

} // end namespace llvm

#endif // LLVM_MC_MCSYMBOLXCOFF_H

//===- MCSymbolXCOFF.h -  ----------------------------------------*- C++ -*-===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
#ifndef LLVM_MC_MCSYMBOLXCOFF_H
#define LLVM_MC_MCSYMBOLXCOFF_H

#include "llvm/BinaryFormat/XCOFF.h"
#include "llvm/MC/MCSymbol.h"

namespace llvm {

class GlobalValue;

class MCSymbolXCOFF : public MCSymbol {
  // The IR symbol this MCSymbolXCOFF is based on. It is set on function
  // entry point symbols when they are the callee operand of a direct call
  // SDNode.
  const GlobalValue *GV = nullptr;

public:
  MCSymbolXCOFF(const StringMapEntry<bool> *Name, bool isTemporary)
      : MCSymbol(SymbolKindXCOFF, Name, isTemporary) {}

  void setGlobalValue(const GlobalValue *G) { GV = G; }
  const GlobalValue *getGlobalValue() const { return GV; }

  static bool classof(const MCSymbol *S) { return S->isXCOFF(); }
};

} // end namespace llvm

#endif // LLVM_MC_MCSYMBOLXCOFF_H

Work around a circular dependency between IR and MC introduced in r362735

I replaced the circular library dependency with a forward declaration,
but it is only a workaround, not a real fix.

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


// RUN: %clang_cc1 -x c++ -g -emit-llvm -triple x86_64-linux-gnu -o - %s | FileCheck %s
// PR23332

// CHECK: MDLocalVariable(tag: DW_TAG_arg_variable, arg: 255
// CHECK: MDLocalVariable(tag: DW_TAG_arg_variable, arg: 256
// CHECK: MDLocalVariable(tag: DW_TAG_arg_variable, arg: 257
void fn1(int, int, int, int, int, int, int, int, int, int, int, int, int, int,
         int, int, int, int, int, int, int, int, int, int, int, int, int, int,
         int, int, int, int, int, int, int, int, int, int, int, int, int, int,
         int, int, int, int, int, int, int, int, int, int, int, int, int, int,
         int, int, int, int, int, int, int, int, int, int, int, int, int, int,
         int, int, int, int, int, int, int, int, int, int, int, int, int, int,
         int, int, int, int, int, int, int, int, int, int, int, int, int, int,
         int, int, int, int, int, int, int, int, int, int, int, int, int, int,
         int, int, int, int, int, int, int, int, int, int, int, int, int, int,
         int, int, int, int, int, int, int, int, int, int, int, int, int, int,
         int, int, int, int, int, int, int, int, int, int, int, int, int, int,
         int, int, int, int, int, int, int, int, int, int, int, int, int, int,
         int, int, int, int, int, int, int, int, int, int, int, int, int, int,
         int, int, int, int, int, int, int, int, int, int, int, int, int, int,
         int, int, int, int, int, int, int, int, int, int, int, int, int, int,
         int, int, int, int, int, int, int, int, int, int, int, int, int, int,
         int, int, int, int, int, int, int, int, int, int, int, int, int, int,
         int, int, int, int, int, int, int, int, int, int, int, int, int, int,
         int, int, int, int, int) {}

DebugInfo: Add a clang test for LLVM fix for PR23332

Add a clang test for LLVM r235955, which added support for up to 2^16
arguments.

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


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

typedef struct Node Node;
struct Node {
	int value;
	Node *next;
};

void addFirst(Node **head, int v) {
	Node *newNode = (Node * )malloc(sizeof(Node));
	newNode->value =  v;
	newNode->next = *head;
	*head = newNode;
}

void printList(Node *head) {
	Node *curr = head;
	while (curr != NULL) {
		printf("%d\n", curr->value);
		curr = curr->next;
	}
}

Node *init(int v) {
	Node *head = (Node *)malloc(sizeof(Node));
	head->value = v;
	head->next = NULL;
	return head;
}

int main() {
	Node *head = init(1);
	addFirst(&head, 2);
	addFirst(&head, 3);
	printList(head);
	return 0;
}

Implement Linked List in C

Implement Linked List in C

C언어로 오랫만에 구현
수업시간에 이중포인터를 설명하기 위해서 구현했다.


/**
 * Generic reservoir sampling.
 */

#ifndef _RS_H
#define _RS_H

/* print actions to the reservoir */
#ifndef PRINT_RS_TRACE
#define PRINT_RS_TRACE 1
#endif

struct reservoir;
struct drand48_data;

struct reservoir *init_reservoir(size_t sz,
#if PRINT_RS_TRACE
		void (*print_fun)(void *it),
#endif
		void *(*clone_fun)(const void *it, size_t sz),
		void (*free_fun)(void *it));
void free_reservoir(struct reservoir *r);

/* Notice one extra parameter when tracing the reservoir */
void add_to_reservoir(struct reservoir *r, const void *it, size_t sz,
		double w, struct drand48_data *randbuffer);
void add_to_reservoir_log(struct reservoir *r, const void *it, size_t sz,
		double logw, struct drand48_data *randbuffer);

#endif

/**
 * Generic reservoir sampling.
 */

#ifndef _RS_H
#define _RS_H

/* print actions to the reservoir */
#ifndef PRINT_RS_TRACE
#define PRINT_RS_TRACE 1
#endif

struct reservoir;
struct drand48_data;

/* Notice one extra parameter when tracing the reservoir */
struct reservoir *init_reservoir(size_t sz,
#if PRINT_RS_TRACE
		void (*print_fun)(void *it),
#endif
		void *(*clone_fun)(const void *it, size_t sz),
		void (*free_fun)(void *it));
void free_reservoir(struct reservoir *r);

void add_to_reservoir(struct reservoir *r, const void *it, size_t sz,
		double w, struct drand48_data *randbuffer);
void add_to_reservoir_log(struct reservoir *r, const void *it, size_t sz,
		double logw, struct drand48_data *randbuffer);

#endif

Move comment to the code it comments on

Move comment to the code it comments on


/***************************************************************************//**
* \file domain.h
* \author Krishnan, A. (anush@bu.edu)
* \brief Definition of the class \c domain
*/

#pragma once

#include "types.h"

/**
* \class domain
* \brief Store the mesh grid information
*/
class domain
{
public:
	int   nx, ///< number of cells in the x-direction
	      ny; ///< number of cells in the y-direction

	vecH  x,  ///< x-coordinates of the nodes
	      y,  ///< y-coordinates of the nodes
	      dx, ///< cell widths in the x-direction
	      dy; ///< cell widths in the y-direction

	vecD  xD,  ///< x-coordinates of the nodes stored on the device
	      yD,  ///< y-coordinates of the nodes stored on the device
	      dxD, ///< x- cell widths stored on the device
	      dyD; ///< y- cell widths stored on the device

	vecH  xu,  ///< x-coordinates of the locations at which the x-component of velocity is evaluated
	      yu,  ///< y-coordinates of the locations at which the x-component of velocity is evaluated
	      xv,  ///< x-coordinates of the locations at which the y-component of velocity is evaluated
	      yv;  ///< y-coordinates of the locations at which the y-component of velocity is evaluated
};

/***************************************************************************//**
 * \file domain.h
 * \author Anush Krishnan (anush@bu.edu)
 * \brief Definition of the class \c domain.
 */

#pragma once

#include "types.h"

/**
 * \class domain
 * \brief Stores information about the computational grid.
 */
class domain
{
public:
	int   nx, ///< number of cells in the x-direction
	      ny; ///< number of cells in the y-direction

	vecH  x,  ///< x-coordinates of the nodes
	      y,  ///< y-coordinates of the nodes
	      dx, ///< cell widths in the x-direction
	      dy; ///< cell widths in the y-direction

	vecD  xD,  ///< x-coordinates of the nodes stored on the device
	      yD,  ///< y-coordinates of the nodes stored on the device
	      dxD, ///< x- cell widths stored on the device
	      dyD; ///< y- cell widths stored on the device

	vecH  xu,  ///< x-coordinates of the locations at which the x-component of velocity is evaluated
	      yu,  ///< y-coordinates of the locations at which the x-component of velocity is evaluated
	      xv,  ///< x-coordinates of the locations at which the y-component of velocity is evaluated
	      yv;  ///< y-coordinates of the locations at which the y-component of velocity is evaluated
};

Update Doxygen documentation with conventions


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

#import <Foundation/Foundation.h>

@interface OCMLocation : NSObject
{
    id          testCase;
    NSString    *file;
    NSUInteger  line;
}

+ (instancetype)locationWithTestCase:(id)aTestCase file:(NSString *)aFile line:(NSUInteger)aLine;

- (instancetype)initWithTestCase:(id)aTestCase file:(NSString *)aFile line:(NSUInteger)aLine;

- (id)testCase;
- (NSString *)file;
- (NSUInteger)line;

@end

extern OCMLocation *OCMMakeLocation(id testCase, const char *file, int line);

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

#import <Foundation/Foundation.h>

@interface OCMLocation : NSObject
{
    id          testCase;
    NSString    *file;
    NSUInteger  line;
}

+ (instancetype)locationWithTestCase:(id)aTestCase file:(NSString *)aFile line:(NSUInteger)aLine;

- (instancetype)initWithTestCase:(id)aTestCase file:(NSString *)aFile line:(NSUInteger)aLine;

- (id)testCase;
- (NSString *)file;
- (NSUInteger)line;

@end

#if defined(__cplusplus)
extern "C"
#else
extern
#endif
OCMLocation *OCMMakeLocation(id testCase, const char *file, int line);

Fix linking in Objective–C++ tests.

Fix linking in Objective–C++ tests.

As detailed in #238, linking tests sometimes fails when OCMock is being used in Objective-C++ (.mm) test case files.
This commit solves that problem by conditionally declaring `OCMMakeLocation` as `extern C` in when included in a C++ compilation unit.


/*
 * Copyright (c) 2012, Nadir Sampaoli
 * See the LICENSE for more information
 */

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

static uint8_t *memory_area;

void allocmemory(void)
{
    while(!memory_area) {
        memory_area = malloc(MEM_SIZE * sizeof(uint8_t));
    }
}

uint8_t getmembyte(uint16_t addr)
{
    return *(memory_area + addr);
}

uint16_t getmemword(uint16_t addr)
{
    return (getmembyte(addr+1) << 8 | getmembyte(addr));
}

void putmembyte(uint16_t addr, uint8_t byte)
{
    // FIXME: must control if addr is readonly (TODO: implement MBC controllers)
    *(memory_area + addr) = byte;
}

void putmemword(uint16_t addr, uint16_t word)
{
    putmembyte(addr, (word >> 8));
    putmembyte(addr+1, (word & 0xFF));
}

/*
 * Copyright (c) 2012, Nadir Sampaoli
 * See the LICENSE for more information
 */

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

static uint8_t *memory_area;

void allocmemory(void)
{
    while(!memory_area) {
        memory_area = malloc(MEM_SIZE * sizeof(uint8_t));
    }
}

inline uint8_t getmembyte(uint16_t addr)
{
    return *(memory_area + addr);
}

inline uint16_t getmemword(uint16_t addr)
{
    return (getmembyte(addr+1) << 8 | getmembyte(addr));
}

void putmembyte(uint16_t addr, uint8_t byte)
{
    // FIXME: must control if addr is readonly (TODO: implement MBC controllers)
    *(memory_area + addr) = byte;
}

void putmemword(uint16_t addr, uint16_t word)
{
    putmembyte(addr, (word >> 8));
    putmembyte(addr+1, (word & 0xFF));
}

Change "getmembyte" and "getmemword" to inline functions


//
//  GLGInputParserDelegate.h
//  TwIRCk
//
//  Created by Tim Jarratt on 11/29/13.
//  Copyright (c) 2013 General Linear Group. All rights reserved.
//

#import <Foundation/Foundation.h>

@protocol GLGInputParserDelegate <NSObject>

- (void) didJoinChannel:(NSString *)channel
             rawCommand:(NSString *)rawCommand;
- (void) didPartChannel:(NSString *)channel
             rawCommand:(NSString *)rawCommand;
- (void) didChangeNick:(NSString *)newNick
            rawCommand:(NSString *)rawCommand;
- (void) didChangePassword:(NSString *)newPassword
                rawCommand:(NSString *)rawCommand;
@end

//
//  GLGInputParserDelegate.h
//  TwIRCk
//
//  Created by Tim Jarratt on 11/29/13.
//  Copyright (c) 2013 General Linear Group. All rights reserved.
//

#import <Foundation/Foundation.h>

@protocol GLGInputParserDelegate <NSObject>

- (void) didJoinChannel:(NSString *)channel
             rawCommand:(NSString *)command;
- (void) didPartChannel:(NSString *)channel
             rawCommand:(NSString *)channel;
- (void) didChangeNick:(NSString *)newNick
            rawCommand:(NSString *)channel;
- (void) didChangePassword:(NSString *)newPassword
                rawCommand:(NSString *)channel;
@end

Revert "Name these protocol method variables better"

This reverts commit 0dc63736e1b8398d1fc9692473f285076aa862ee.


#ifndef IDT_H
#define IDT_H

#include <stdint.h>

struct IDTEntry {
	uint16_t base_address_low;
	uint16_t selector;
	uint8_t reserved;
	uint8_t type : 4;
	uint8_t storage_segment : 1;
	uint8_t privilege : 2;
	uint8_t present : 1;
	uint16_t base_address_high;
} __attribute__((packed));

struct IDTDescriptor {
	uint16_t limiter;
	uint32_t base_address;
} __attribute__((packed));

struct IDT {
	struct IDTDescriptor descriptor;
	struct IDTEntry entries[256];
} __attribute__((packed));

void idt_init(struct IDT *);

#endif

#ifndef IDT_H
#define IDT_H

#include <stdint.h>

struct IDTEntry {
	uint16_t base_address_low;
	uint16_t selector;
	uint8_t reserved;
	uint8_t type : 4;
	uint8_t storage_segment : 1;
	uint8_t privilege : 2;
	uint8_t present : 1;
	uint16_t base_address_high;
} __attribute__((packed));

struct IDTDescriptor {
	uint16_t limiter;
	uint32_t base_address;
} __attribute__((packed));

struct IDT {
	struct IDTDescriptor descriptor;
	struct IDTEntry entries[128];
} __attribute__((packed));

void idt_init(struct IDT *);

#endif

Cut space required for IDT in half

Cut space required for IDT in half


// Copyright 2016 Ben Trask
// MIT licensed (see LICENSE for details)

#include <kvstore/db_schema.h>

enum {
	harc_timeid_to_entry = 20,
	harc_url_timeid = 21,
	harc_hash_timeid = 50,
};

#define harc_timeid_to_entry_keypack(val, time, id) \
	DB_VAL_STORAGE(val, DB_VARINT_MAX*3); \
	db_bind_uint64((val), harc_timeid_to_entry); \
	db_bind_uint64((val), (time)); \
	db_bind_uint64((val), (id)); \
	DB_VAL_STORAGE_VERIFY(val);

// TODO: How to pack/unpack list of hashes?

#define harc_hash_timeid_keypack(val, url, time, id) \
	DB_VAL_STORAGE(val, DB_VARINT_MAX*3 + DB_INLINE_MAX); \
	db_bind_uint64((val), harc_url_timeid); \
	db_bind_string((val), (url), 8); \
	db_bind_uint64((val), (time)); \
	db_bind_uint64((val), (id)); \
	DB_VAL_STORAGE_VERIFY(val);

#define harc_hash_timeid_keypack(val, algo, hash, time, id) \
	DB_VAL_STORAGE(val, DB_VARINT_MAX*3 + DB_BLOB_MAX(8)); \
	db_bind_uint64((val), harc_hash_timeid+(algo)); \
	db_bind_blob((val), (hash), 8); \
	db_bind_uint64((val), (time)); \
	db_bind_uint64((val), (id)); \
	DB_VAL_STORAGE_VERIFY(val);

Add beginnings of DB layer.

Add beginnings of DB layer.


/*
 * types.h
 *
 *  Created on: Mar 11, 2014
 *      Author: Chase
 */

#ifndef TYPES_H_
#define TYPES_H_

#include <stdint.h>

//Don't use stdbool.h, we have to make sure bool is only a byte in size!
typedef uint8_t bool;
#define true 1
#define false 0
#define TRUE 1
#define FALSE 0

typedef uint8_t char8_t;
typedef uint16_t char16_t;

#endif /* TYPES_H_ */

/*
 * types.h
 *
 *  Created on: Mar 11, 2014
 *      Author: Chase
 */

#ifndef TYPES_H_
#define TYPES_H_

#include <stdint.h>

//Don't use stdbool.h, we have to make sure bool is only a byte in size!
typedef uint8_t bool;
enum {
	true = 1,
	false = 0,
	TRUE = 1,
	FALSE = 0
};

typedef uint8_t char8_t;
typedef uint16_t char16_t;

#endif /* TYPES_H_ */

Change bool true/false to enum

Change bool true/false to enum


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

#include <unistd.h>

#include "native_client/src/untrusted/nacl/nacl_irt.h"
#include "native_client/src/untrusted/nacl/nacl_thread.h"
#include "native_client/src/untrusted/nacl/tls.h"

/*
 * This initialization happens early in startup with or without libpthread.
 * It must make it safe for vanilla newlib code to run.
 */
void __pthread_initialize_minimal(size_t tdb_size) {
  /* Adapt size for sbrk. */
  /* TODO(robertm): this is somewhat arbitrary - re-examine). */
  size_t combined_size = (__nacl_tls_combined_size(tdb_size) + 15) & ~15;

  /*
   * Use sbrk not malloc here since the library is not initialized yet.
   */
  void *combined_area = sbrk(combined_size);

  /*
   * Fill in that memory with its initializer data.
   */
  void *tp = __nacl_tls_initialize_memory(combined_area, tdb_size);

  /*
   * Set %gs, r9, or equivalent platform-specific mechanism.  Requires
   * a syscall since certain bitfields of these registers are trusted.
   */
  nacl_tls_init(tp);

  /*
   * Initialize newlib's thread-specific pointer.
   */
  __newlib_thread_init();
}

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

#include <unistd.h>

#include "native_client/src/untrusted/nacl/nacl_irt.h"
#include "native_client/src/untrusted/nacl/nacl_thread.h"
#include "native_client/src/untrusted/nacl/tls.h"

/*
 * This initialization happens early in startup with or without libpthread.
 * It must make it safe for vanilla newlib code to run.
 */
void __pthread_initialize_minimal(size_t tdb_size) {
  size_t combined_size = __nacl_tls_combined_size(tdb_size);

  /*
   * Use sbrk not malloc here since the library is not initialized yet.
   */
  void *combined_area = sbrk(combined_size);

  /*
   * Fill in that memory with its initializer data.
   */
  void *tp = __nacl_tls_initialize_memory(combined_area, tdb_size);

  /*
   * Set %gs, r9, or equivalent platform-specific mechanism.  Requires
   * a syscall since certain bitfields of these registers are trusted.
   */
  nacl_tls_init(tp);

  /*
   * Initialize newlib's thread-specific pointer.
   */
  __newlib_thread_init();
}

Cleanup: Remove unnecessary rounding when allocating initial thread block

The other calls to __nacl_tls_combined_size() don't do this.

__nacl_tls_combined_size() should be doing any necessary rounding itself.

BUG=none
TEST=trybots

Review URL: https://codereview.chromium.org/18555008

git-svn-id: 721b910a23eff8a86f00c8fd261a7587cddf18f8@11698 fcba33aa-ac0c-11dd-b9e7-8d5594d729c2


#include <bert/buffer.h>

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

#include "test.h"

#define DATA_SIZE	4

int main()
{
	unsigned char data[4];
	bert_buffer_t buffer;

	bert_buffer_init(&buffer);

	memset(data,'A',DATA_SIZE);

	bert_buffer_write(&buffer,data,DATA_SIZE);
	bert_buffer_write(&buffer,data,DATA_SIZE);
	bert_buffer_write(&buffer,data,DATA_SIZE);

	unsigned char output[DATA_SIZE];
	size_t result;

	if ((result = bert_buffer_read(output,&buffer,DATA_SIZE)) != DATA_SIZE)
	{
		test_fail("bert_buffer_read only read %u bytes, expected %u",result,DATA_SIZE);
	}

	if (memcmp(output,data,DATA_SIZE))
	{
		test_fail("bert_buffer_read return %c%c%c%c, expected AAAA",output[0],output[1],output[2],output[3]);
	}

	return 0;
}

#include <bert/buffer.h>

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

#include "test.h"

#define DATA_SIZE	4

int main()
{
	unsigned char data[4];
	bert_buffer_t buffer;

	bert_buffer_init(&buffer);

	memset(data,'A',DATA_SIZE);

	unsigned int i;

	for (i=0;i<((BERT_CHUNK_SIZE / DATA_SIZE) * 2);i++)
	{
		bert_buffer_write(&buffer,data,DATA_SIZE);
	}

	unsigned char output[DATA_SIZE];
	size_t result;

	if ((result = bert_buffer_read(output,&buffer,DATA_SIZE)) != DATA_SIZE)
	{
		test_fail("bert_buffer_read only read %u bytes, expected %u",result,DATA_SIZE);
	}

	if (memcmp(output,data,DATA_SIZE))
	{
		test_fail("bert_buffer_read return %c%c%c%c, expected AAAA",output[0],output[1],output[2],output[3]);
	}

	return 0;
}

Make sure the buffer small read populates the buffer with multiple chunks.


/*****************************************************************************\
*                                                                             *
*   Filename 	    SysLib.h						      *
*									      *
*   Description     SysLib Library core definitions			      *
*                                                                             *
*   Notes	    Included indirectly by the include files that need it.    *
*		    Do not include directly.				      *
*									      *
*   History								      *
*    2016-04-12 JFL Created this file.					      *
*    2016-04-22 JFL Renamed the MULTIOS library as SYSLIB.		      *
*		    							      *
*         © Copyright 2016 Hewlett Packard Enterprise Development LP          *
* Licensed under the Apache 2.0 license - www.apache.org/licenses/LICENSE-2.0 *
\*****************************************************************************/

#ifndef __SYSLIB_H__   /* Prevent multiple inclusions */
#define __SYSLIB_H__

/* Force linking with the SysLib.lib library */
#if defined(_MSC_VER)
#define _SYSLIB_LIB "SysLib.lib"
#pragma message("Adding pragma comment(lib, \"" _SYSLIB_LIB "\")")
#pragma comment(lib, _SYSLIB_LIB)
#endif /* defined(_MSC_VER) */

#if defined(__unix__)
#define _SYSLIB_LIB "libSysLib.a"
#endif

#endif /* defined(__SYSLIB_H__) */

/*****************************************************************************\
*                                                                             *
*   Filename 	    SysLib.h						      *
*									      *
*   Description     SysLib Library core definitions			      *
*                                                                             *
*   Notes	    Included indirectly by the include files that need it.    *
*		    Do not include directly.				      *
*									      *
*   History								      *
*    2016-04-12 JFL Created this file.					      *
*    2016-04-22 JFL Renamed the MULTIOS library as SYSLIB.		      *
*		    							      *
*         © Copyright 2016 Hewlett Packard Enterprise Development LP          *
* Licensed under the Apache 2.0 license - www.apache.org/licenses/LICENSE-2.0 *
\*****************************************************************************/

#ifndef __SYSLIB_H__   /* Prevent multiple inclusions */
#define __SYSLIB_H__

/* Force linking with the SysLib.lib library */
#if defined(_MSC_VER)

#define _SYSLIB_LIB "SysLib.lib"
#pragma message("Adding pragma comment(lib, \"" _SYSLIB_LIB "\")")
#pragma comment(lib, _SYSLIB_LIB)

#else /* GCC, clang, etc. */

#define _SYSLIB_LIB "libSysLib.a"

#endif

#endif /* defined(__SYSLIB_H__) */

Fix compatibility with all non-Microsoft compilers


#ifndef FIFO_H
#define FIFO_H

#include "align.h"

#define FIFO_NODE_SIZE 510

struct _fifo_node_t;

typedef struct DOUBLE_CACHE_ALIGNED {
  volatile size_t enq DOUBLE_CACHE_ALIGNED;
  volatile size_t deq DOUBLE_CACHE_ALIGNED;
  volatile struct {
    int index;
    struct _fifo_node_t * node;
  } head DOUBLE_CACHE_ALIGNED;
  size_t nprocs;
} fifo_t;

typedef struct DOUBLE_CACHE_ALIGNED _fifo_handle_t {
  struct _fifo_handle_t * next;
  struct _fifo_node_t * enq;
  struct _fifo_node_t * deq;
  struct _fifo_node_t * hazard;
  struct _fifo_node_t * retired;
  int winner;
} fifo_handle_t;

void fifo_init(fifo_t * fifo, size_t width);
void fifo_register(fifo_t * fifo, fifo_handle_t * handle);
void * fifo_get(fifo_t * fifo, fifo_handle_t * handle);
void fifo_put(fifo_t * fifo, fifo_handle_t * handle, void * data);

#endif /* end of include guard: FIFO_H */

#ifndef FIFO_H
#define FIFO_H

#include "align.h"

#define FIFO_NODE_SIZE (1 << 20 - 2)

struct _fifo_node_t;

typedef struct DOUBLE_CACHE_ALIGNED {
  volatile size_t enq DOUBLE_CACHE_ALIGNED;
  volatile size_t deq DOUBLE_CACHE_ALIGNED;
  volatile struct {
    size_t index;
    struct _fifo_node_t * node;
  } head DOUBLE_CACHE_ALIGNED;
  size_t nprocs;
} fifo_t;

typedef struct DOUBLE_CACHE_ALIGNED _fifo_handle_t {
  struct _fifo_handle_t * next;
  struct _fifo_node_t * enq;
  struct _fifo_node_t * deq;
  struct _fifo_node_t * hazard;
  struct _fifo_node_t * retired;
  int winner;
} fifo_handle_t;

void fifo_init(fifo_t * fifo, size_t width);
void fifo_register(fifo_t * fifo, fifo_handle_t * handle);
void * fifo_get(fifo_t * fifo, fifo_handle_t * handle);
void fifo_put(fifo_t * fifo, fifo_handle_t * handle, void * data);

#endif /* end of include guard: FIFO_H */

Use the same size of lcrq.

Use the same size of lcrq.


/*
 * $Id$
 *
 * Copyright (c) 2013, Juniper Networks, Inc.
 * All rights reserved.
 * This SOFTWARE is licensed under the LICENSE provided in the
 * ../Copyright file. By downloading, installing, copying, or otherwise
 * using the SOFTWARE, you agree to be bound by the terms of that
 * LICENSE.
 *
 * jsonwriter.h -- turn json-oriented XML into json text
 */

int
slaxJsonWriteNode (slaxWriterFunc_t func, void *data, xmlNodePtr nodep,
		       unsigned flags);

int
slaxJsonWriteDoc (slaxWriterFunc_t func, void *data, xmlDocPtr docp,
		      unsigned flags);

#define JWF_ROOT	(1<<0)	/* Root node */
#define JWF_ARRAY	(1<<1)	/* Inside array */
#define JWF_NODESET	(1<<2)	/* Top of a nodeset */
#define JWF_PRETTY	(1<<3)	/* Pretty print (newlines) */

#define JWF_OPTIONAL_QUOTES (1<<4)	/* Don't use quotes unless needed */

/*
 * Copyright (c) 2013, Juniper Networks, Inc.
 * All rights reserved.
 * This SOFTWARE is licensed under the LICENSE provided in the
 * ../Copyright file. By downloading, installing, copying, or otherwise
 * using the SOFTWARE, you agree to be bound by the terms of that
 * LICENSE.
 *
 * jsonwriter.h -- turn json-oriented XML into json text
 */

int
slaxJsonWriteNode (slaxWriterFunc_t func, void *data, xmlNodePtr nodep,
		       unsigned flags);

int
slaxJsonWriteDoc (slaxWriterFunc_t func, void *data, xmlDocPtr docp,
		      unsigned flags);

#define JWF_ROOT	(1<<0)	/* Root node */
#define JWF_ARRAY	(1<<1)	/* Inside array */
#define JWF_NODESET	(1<<2)	/* Top of a nodeset */
#define JWF_PRETTY	(1<<3)	/* Pretty print (newlines) */

#define JWF_OPTIONAL_QUOTES (1<<4)	/* Don't use quotes unless needed */

Drop $Id$ and update copyright

Drop $Id$ and update copyright


// RUN: clang -checker-simple -verify %s

int* f1() {
  int x = 0;
  return &x; // expected-warning{{Address of stack memory associated with local variable 'x' returned.}} expected-warning{{address of stack memory associated with local variable 'x' returned}}
}

int* f2(int y) {
  return &y;  // expected-warning{{Address of stack memory associated with local variable 'y' returned.}} expected-warning{{address of stack memory associated with local variable 'y' returned}}
}

int* f3(int x, int *y) {
  int w = 0;

  if (x)
    y = &w;

  return y; // expected-warning{{Address of stack memory associated with local variable 'w' returned.}}
}

unsigned short* compound_literal() {
  return &(unsigned short){((unsigned short)0x22EF)}; // expected-warning{{Address of stack memory}}
}

// RUN: clang -checker-simple -verify %s

int* f1() {
  int x = 0;
  return &x; // expected-warning{{Address of stack memory associated with local variable 'x' returned.}} expected-warning{{address of stack memory associated with local variable 'x' returned}}
}

int* f2(int y) {
  return &y;  // expected-warning{{Address of stack memory associated with local variable 'y' returned.}} expected-warning{{address of stack memory associated with local variable 'y' returned}}
}

int* f3(int x, int *y) {
  int w = 0;

  if (x)
    y = &w;

  return y; // expected-warning{{Address of stack memory associated with local variable 'w' returned.}}
}

unsigned short* compound_literal() {
  return &(unsigned short){((unsigned short)0x22EF)}; // expected-warning{{Address of stack memory}} expected-warning{{braces around scalar initializer}}
}

Add 'expected-warning' for braces around scalar initializer

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


/*GDT stands for "Global Descriptor Table".
It is a table available on i386 (ix86?)
processors. The GDT is a list of 64 bit entries.
GRUB (or our boot) loader will install the GDT for us.
If we overwrite the GDT we will cause a 'triple fault'
and the machine will be reset.

Based on the tutorial, we will write a GDT with only 3 fields
and will not concern ourselves with the other fields.

The above was paraphrased from:
http://www.osdever.net/bkerndev/Docs/gdt.htm
*/

typedef unsigned short usort;
typedef unsigned char uchar;
typedef unsigned int uint;

/* the __attribute__((packed))
tells the compiler not to 'optimize' the struct for us by
packing.
*/
struct gdt_entry
{
	ushort limit_low;
	ushort base_low;
	uchar  base_middle;
	uchar  access;
	uchar  granularity;
	uchar  base_high;
}__attribute__((packed));

/* the following is a special pointer representing
the max bytes taken up by the GDT -1 */
struct gdt_ptr
{
	ushort limit;
	uint   base;
}__attribute__((packed));

struct gdt_entry gdt[3];
struct gdt_ptr   gdtp;
/* A function in start.am. Used to properly
reload the new segment registers */
//extern void gdt_flush();

Add structs used in the GDT

Add structs used in the GDT


/*
 * Time stamp of last source code repository commit.
 */

#define ___STAMP_YMD 20131223
#define ___STAMP_HMS 145645

/*
 * Time stamp of last source code repository commit.
 */

#define ___STAMP_YMD 20131223
#define ___STAMP_HMS 172203

Clarify that LD_LIBRARY_PATH must be set when Gambit is build with shared libs


#ifndef _H_SAMSON_QUEUE_TASK_MANAGER
#define _H_SAMSON_QUEUE_TASK_MANAGER

#include "au/list.h"        // au::list

namespace samson {
    namespace stream {

        class QueueTask;

        class QueueTaskManager
        {
            au::list< QueueTask > queueTasks;
            size_t id;                              // Id of the current task

        public:

            void add( QueueTask* task );

            std::string getStatus();

        };

    }

}

#endif

#ifndef _H_SAMSON_QUEUE_TASK_MANAGER
#define _H_SAMSON_QUEUE_TASK_MANAGER

#include "au/list.h"        // au::list
#include <string>           // std::string

namespace samson {
    namespace stream {

        class QueueTask;

        class QueueTaskManager
        {
            au::list< QueueTask > queueTasks;
            size_t id;                              // Id of the current task

        public:

            void add( QueueTask* task );

            std::string getStatus();

        };

    }

}

#endif

Fix broken compilation of Linux for the famous string.h header

git-svn-id: 9714148d14941aebeae8d7f7841217f5ffc02bc5@1260 4143565c-f3ec-42ea-b729-f8ce0cf5cbc3


#ifndef SwitecX25_h
#define SwitecX25_h

class SwitecX25
{
 public:
   static const unsigned char pinCount = 4;
   static const unsigned char stateCount = 6;
   unsigned char pins[pinCount];
   unsigned char currentState;    // 6 steps
   unsigned int currentStep;      // step we are currently at
   unsigned int targetStep;       // target we are moving to
   unsigned int steps;            // total steps available
   unsigned long time0;           // time when we entered this state
   unsigned int microDelay;       // microsecs until next state
   unsigned short (*accelTable)[2]; // accel table can be modified.
   unsigned int maxVel;           // fastest vel allowed
   unsigned int vel;              // steps travelled under acceleration
   char dir;                      // direction -1,0,1
   boolean stopped;               // true if stopped

   SwitecX25(unsigned int steps, unsigned char pin1, unsigned char pin2, unsigned char pin3, unsigned char pin4);

   void stepUp();
   void stepDown();
   void zero();
   void update();
   void setPosition(unsigned int pos);

 private:
   void advance();
   void writeIO();
};

#endif

#ifndef SwitecX25_h
#define SwitecX25_h
#include <Arduino.h>

class SwitecX25
{
 public:
   static const unsigned char pinCount = 4;
   static const unsigned char stateCount = 6;
   unsigned char pins[pinCount];
   unsigned char currentState;    // 6 steps
   unsigned int currentStep;      // step we are currently at
   unsigned int targetStep;       // target we are moving to
   unsigned int steps;            // total steps available
   unsigned long time0;           // time when we entered this state
   unsigned int microDelay;       // microsecs until next state
   unsigned short (*accelTable)[2]; // accel table can be modified.
   unsigned int maxVel;           // fastest vel allowed
   unsigned int vel;              // steps travelled under acceleration
   char dir;                      // direction -1,0,1
   boolean stopped;               // true if stopped

   SwitecX25(unsigned int steps, unsigned char pin1, unsigned char pin2, unsigned char pin3, unsigned char pin4);

   void stepUp();
   void stepDown();
   void zero();
   void update();
   void setPosition(unsigned int pos);

 private:
   void advance();
   void writeIO();
};

#endif

Include Arduino.h to make sure we have types like "boolean"


/* RUN: %clang_cc1  %s -emit-llvm -o - | not grep __builtin_
 *
 * __builtin_longjmp/setjmp should get transformed into llvm.setjmp/longjmp
 * just like explicit setjmp/longjmp calls are.
 */

void jumpaway(int *ptr) {
  __builtin_longjmp(ptr,1);
}

int main(void) {
  __builtin_setjmp(0);
  jumpaway(0);
}

/* RUN: %clang_cc1  %s -emit-llvm -o - | FileCheck %s
 *
 * __builtin_longjmp/setjmp should get transformed into intrinsics.
 */

// CHECK-NOT: builtin_longjmp

void jumpaway(int *ptr) {
  __builtin_longjmp(ptr,1);
}

int main(void) {
  __builtin_setjmp(0);
  jumpaway(0);
}

Fix test in two ways: remove incorrect comment (the intrinsic generated now
is of the llvm.sjlj.* flavore) and convert grep->FileCheck

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


#define _GNU_SOURCE
#define _FILE_OFFSET_BITS 64

#include <fcntl.h>
#include <stdint.h>
#include <linux/falloc.h>

int native_fallocate(int fd, uint64_t len) {
    return fallocate(fd, 0, 0, (off_t)len);
}

#define _GNU_SOURCE
#define _FILE_OFFSET_BITS 64

#include <fcntl.h>
#include <stdint.h>

int native_fallocate(int fd, uint64_t len) {
    return fallocate(fd, 0, 0, (off_t)len);
}

Remove falloc header from linux build

Remove falloc header from linux build


/*
 * Copyright 2013 Mo McRoberts.
 *
 *  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 P_LIBERRNO_H_
# define P_LIBERRNO_H_                 1

# include <ux/cdefs.h>

# include "errno.h"
# undef errno

int *get_errno_ux2003(void) UX_SYM03_(errno);

#endif /*!P_LIBERRNO_H_*/

/*
 * Copyright 2013 Mo McRoberts.
 *
 *  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 P_LIBERRNO_H_
# define P_LIBERRNO_H_                 1

# include <ux/cdefs.h>

# include "errno.h"
# undef errno

int *errno_ux2003(void) UX_SYM03_(errno);

#endif /*!P_LIBERRNO_H_*/

Fix symbol name of errno$UX$2003

Fix symbol name of errno$UX$2003


// A current_time function for use in the tests.  Returns time in
// milliseconds.

#ifdef _WIN32
extern "C" bool QueryPerformanceCounter(uint64_t *);
extern "C" bool QueryPerformanceFrequency(uint64_t *);
double current_time() {
    uint64_t t, freq;
    QueryPerformanceCounter(&t);
    QueryPerformanceFrequency(&freq);
    return (t * 1000.0) / freq;
}
#else
#include <sys/time.h>
double current_time() {
    static bool first_call = true;
    static timeval reference_time;
    if (first_call) {
        first_call = false;
        gettimeofday(&reference_time, NULL);
        return 0.0;
    } else {
        timeval t;
        gettimeofday(&t, NULL);
        return ((t.tv_sec - reference_time.tv_sec)*1000.0 +
                (t.tv_usec - reference_time.tv_usec)/1000.0);
    }
}
#endif

// A current_time function for use in the tests.  Returns time in
// milliseconds.

#ifdef _WIN32
#include <Windows.h>
double current_time() {
    LARGE_INTEGER freq, t;
    QueryPerformanceCounter(&t);
    QueryPerformanceFrequency(&freq);
    return (t.QuadPart * 1000.0) / freq.QuadPart;
}
// Gross, these come from Windows.h
#undef max
#undef min
#else
#include <sys/time.h>
double current_time() {
    static bool first_call = true;
    static timeval reference_time;
    if (first_call) {
        first_call = false;
        gettimeofday(&reference_time, NULL);
        return 0.0;
    } else {
        timeval t;
        gettimeofday(&t, NULL);
        return ((t.tv_sec - reference_time.tv_sec)*1000.0 +
                (t.tv_usec - reference_time.tv_usec)/1000.0);
    }
}
#endif

Fix build of tutorials that require libpng under Visual Studio.


#ifndef BOREUTILS_H
#define BOREUTILS_H

#include <string.h>

static const char *BOREUTILS_VERSION = "0.0.0b1";

int has_arg(int argc, char **argv, char *search);
void bu_missing_argument(char *name);
int bu_handle_version(int argc, char **argv);

// FIXME: Having this in a header is definitely a hack.
int has_arg(int argc, char **argv, char *search)
{
    for (int idx = 1; idx < argc; idx++) {
        if (strcmp(argv[idx], search) == 0) {
            return 1;
        }
    }

    return 0;
}

void bu_missing_argument(char *name) {
    fprintf(stderr, "%s: Missing argument\nSee '%s --help' for more information.\n", name, name);
}

int bu_handle_version(int argc, char **argv) {
    if (has_arg(argc, argv, "--version")) {
        printf("Boreutils %s v%s\n", argv[0], BOREUTILS_VERSION);
        return 1;
    }

    return 0;
}

#endif

#ifndef BOREUTILS_H
#define BOREUTILS_H

#include <string.h>

static const char *BOREUTILS_VERSION = "0.0.0b1";

int has_arg(int argc, char **argv, char *search);
void bu_missing_argument(char *name);
int bu_handle_version(int argc, char **argv);

// FIXME: Having this in a header is definitely a hack.
int has_arg(int argc, char **argv, char *search)
{
    for (int idx = 1; idx < argc; idx++) {
        if (strcmp(argv[idx], search) == 0) {
            return 1;
        }
    }

    return 0;
}

void bu_missing_argument(char *name) {
    fprintf(stderr, "%s: Missing argument\nSee '%s --help' for more information.\n", name, name);
}

int bu_handle_version(int argc, char **argv) {
    if (has_arg(argc, argv, "--version")) {
        printf("%s (Boreutils) %s\n", argv[0], BOREUTILS_VERSION);
        return 1;
    }

    return 0;
}

#endif

Change --version format to "<name> (Boreutils) <version>"


#ifndef _CHAMPLAIN_PERL_H_

#include <clutterperl.h>
#include <champlain/champlain.h>
#include "ppport.h"
#include "champlain-autogen.h"

#ifdef CHAMPLAINPERL_GTK
#include <champlain-gtk/champlain-gtk.h>
#endif

#endif /* _CHAMPLAIN_PERL_H_ */

#ifndef _CHAMPLAIN_PERL_H_

#include <clutterperl.h>

#include <champlain/champlain.h>

#ifdef CHAMPLAINPERL_GTK
#include <champlain-gtk/champlain-gtk.h>
#endif

#include "ppport.h"
#include "champlain-autogen.h"

#endif /* _CHAMPLAIN_PERL_H_ */

Move the include file around.

Move the include file around.


//
//  MagicalRecord for Core Data.
//
//  Created by Saul Mora.
//  Copyright 2011 Magical Panda Software. All rights reserved.
//

// enable to use caches for the fetchedResultsControllers (iOS only)
#if TARGET_OS_IPHONE
#define STORE_USE_CACHE
#endif

#define kCreateNewCoordinatorOnBackgroundOperations     0
#define ENABLE_ACTIVE_RECORD_LOGGING

#ifdef ENABLE_ACTIVE_RECORD_LOGGING
    #define ARLog(...) NSLog(@"%s(%p) %@", __PRETTY_FUNCTION__, self, [NSString stringWithFormat:__VA_ARGS__])
#else
    #define ARLog(...)
#endif

#import <CoreData/CoreData.h>

#import "MagicalRecordHelpers.h"
#import "MRCoreDataAction.h"

#import "NSManagedObject+MagicalRecord.h"
#import "NSManagedObjectContext+MagicalRecord.h"
#import "NSPersistentStoreCoordinator+MagicalRecord.h"
#import "NSManagedObjectModel+MagicalRecord.h"
#import "NSPersistentStore+MagicalRecord.h"
#import "NSManagedObject+MagicalDataImport.h"

//
//  MagicalRecord for Core Data.
//
//  Created by Saul Mora.
//  Copyright 2011 Magical Panda Software. All rights reserved.
//

// enable to use caches for the fetchedResultsControllers (iOS only)
#if TARGET_OS_IPHONE
#define STORE_USE_CACHE
#endif

#define kCreateNewCoordinatorOnBackgroundOperations     0

#ifdef MR_LOGGING
#define ENABLE_ACTIVE_RECORD_LOGGING
#endif

#ifdef DEBUG
#define ENABLE_ACTIVE_RECORD_LOGGING
#endif

#ifdef MR_NO_LOGGING
#undef ENABLE_ACTIVE_RECORD_LOGGING
#endif

#ifdef ENABLE_ACTIVE_RECORD_LOGGING
    #define ARLog(...) NSLog(@"%s(%p) %@", __PRETTY_FUNCTION__, self, [NSString stringWithFormat:__VA_ARGS__])
#else
    #define ARLog(...)
#endif

#import <CoreData/CoreData.h>

#import "MagicalRecordHelpers.h"
#import "MRCoreDataAction.h"

#import "NSManagedObject+MagicalRecord.h"
#import "NSManagedObjectContext+MagicalRecord.h"
#import "NSPersistentStoreCoordinator+MagicalRecord.h"
#import "NSManagedObjectModel+MagicalRecord.h"
#import "NSPersistentStore+MagicalRecord.h"
#import "NSManagedObject+MagicalDataImport.h"

Define MR_NO_LOGGING to force no logging.


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

#ifndef SYSCOIN_POLICY_RBF_H
#define SYSCOIN_POLICY_RBF_H

#include <txmempool.h>

enum class RBFTransactionState {
    UNKNOWN,
    REPLACEABLE_BIP125,
    FINAL
};

// Determine whether an in-mempool transaction is signaling opt-in to RBF
// according to BIP 125
// This involves checking sequence numbers of the transaction, as well
// as the sequence numbers of all in-mempool ancestors.
RBFTransactionState IsRBFOptIn(const CTransaction& tx, const CTxMemPool& pool) EXCLUSIVE_LOCKS_REQUIRED(pool.cs);
// SYSCOIN
RBFTransactionState IsRBFOptIn(const CTransaction& tx, const CTxMemPool& pool, CTxMemPool::setEntries &setAncestors) EXCLUSIVE_LOCKS_REQUIRED(pool.cs);
RBFTransactionState IsRBFOptInEmptyMempool(const CTransaction& tx);

#endif // SYSCOIN_POLICY_RBF_H

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

#ifndef SYSCOIN_POLICY_RBF_H
#define SYSCOIN_POLICY_RBF_H

#include <txmempool.h>

/** The rbf state of unconfirmed transactions */
enum class RBFTransactionState {
    /** Unconfirmed tx that does not signal rbf and is not in the mempool */
    UNKNOWN,
    /** Either this tx or a mempool ancestor signals rbf */
    REPLACEABLE_BIP125,
    /** Neither this tx nor a mempool ancestor signals rbf */
    FINAL,
};

/**
 * Determine whether an unconfirmed transaction is signaling opt-in to RBF
 * according to BIP 125
 * This involves checking sequence numbers of the transaction, as well
 * as the sequence numbers of all in-mempool ancestors.
 *
 * @param tx   The unconfirmed transaction
 * @param pool The mempool, which may contain the tx
 *
 * @return     The rbf state
 */
RBFTransactionState IsRBFOptIn(const CTransaction& tx, const CTxMemPool& pool) EXCLUSIVE_LOCKS_REQUIRED(pool.cs);
// SYSCOIN
RBFTransactionState IsRBFOptIn(const CTransaction& tx, const CTxMemPool& pool, CTxMemPool::setEntries &setAncestors) EXCLUSIVE_LOCKS_REQUIRED(pool.cs);
RBFTransactionState IsRBFOptInEmptyMempool(const CTransaction& tx);

#endif // SYSCOIN_POLICY_RBF_H

Add doxygen comment to IsRBFOptIn

doc: Add doxygen comment to IsRBFOptIn

Former-commit-id: 6c99ae13e834f996721944c8571101bd2c16ba81


/*
Copyright (c) 2013 Microsoft Corporation. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.

Author: Leonardo de Moura
*/
#pragma once
#include <iostream>
#include <time.h>

namespace lean {
/**
   \brief Low tech timer for used for testing.
*/
class timeit {
    std::ostream & m_out;
    std::string    m_msg;
    clock_t        m_start;
public:
    timeit(std::ostream & out, char const * msg):m_out(out), m_msg(msg) {
        m_start = clock();
    }
    ~timeit() {
        clock_t end = clock();
        std::cout << m_msg << " " << ((static_cast<double>(end) - static_cast<double>(m_start)) / CLOCKS_PER_SEC) << " secs\n";
    }
};
}

/*
Copyright (c) 2013 Microsoft Corporation. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.

Author: Leonardo de Moura
*/
#pragma once
#include <iostream>
#include <time.h>

namespace lean {
/**
   \brief Low tech timer for used for testing.
*/
class timeit {
    std::ostream & m_out;
    std::string    m_msg;
    clock_t        m_start;
public:
    timeit(std::ostream & out, char const * msg):m_out(out), m_msg(msg) {
        m_start = clock();
    }
    ~timeit() {
        clock_t end = clock();
        m_out << m_msg << " " << ((static_cast<double>(end) - static_cast<double>(m_start)) / CLOCKS_PER_SEC) << " secs\n";
    }
};
}

Fix problem reported by Soonho

Fix problem reported by Soonho

Signed-off-by: Leonardo de Moura <7610bae85f2b530654cc716772f1fe653373e892@microsoft.com>


/* --------------------------------------------------------------------------
 *    Name: create.c
 * Purpose: Associative array implemented as a hash
 * ----------------------------------------------------------------------- */

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

#include "base/memento/memento.h"

#include "base/errors.h"
#include "utils/utils.h"
#include "utils/primes.h"

#include "datastruct/hash.h"

#include "impl.h"

/* ----------------------------------------------------------------------- */

error hash_create(const void         *default_value,
                  int                 nbins,
                  hash_fn            *fn,
                  hash_compare       *compare,
                  hash_destroy_key   *destroy_key,
                  hash_destroy_value *destroy_value,
                  hash_t            **ph)
{
  hash_t        *h;
  hash__node_t **bins;

  h = malloc(sizeof(*h));
  if (h == NULL)
    return error_OOM;

  nbins = prime_nearest(nbins);

  bins = calloc(nbins, sizeof(*h->bins));
  if (bins == NULL)
    return error_OOM;

  h->bins          = bins;
  h->nbins         = nbins;

  h->count         = 0;

  h->default_value = default_value;

  h->hash_fn       = fn;
  h->compare       = compare;
  h->destroy_key   = destroy_key;
  h->destroy_value = destroy_value;

  *ph = h;

  return error_OK;
}

/* --------------------------------------------------------------------------
 *    Name: create.c
 * Purpose: Associative array implemented as a hash
 * ----------------------------------------------------------------------- */

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

#include "base/memento/memento.h"

#include "base/errors.h"
#include "utils/utils.h"
#include "utils/primes.h"

#include "datastruct/hash.h"

#include "impl.h"

/* ----------------------------------------------------------------------- */

error hash_create(const void         *default_value,
                  int                 nbins,
                  hash_fn            *fn,
                  hash_compare       *compare,
                  hash_destroy_key   *destroy_key,
                  hash_destroy_value *destroy_value,
                  hash_t            **ph)
{
  hash_t        *h;
  hash__node_t **bins;

  h = malloc(sizeof(*h));
  if (h == NULL)
    return error_OOM;

  nbins = prime_nearest(nbins);

  bins = calloc(nbins, sizeof(*h->bins));
  if (bins == NULL)
  {
    free(h);
    return error_OOM;
  }

  h->bins          = bins;
  h->nbins         = nbins;

  h->count         = 0;

  h->default_value = default_value;

  h->hash_fn       = fn;
  h->compare       = compare;
  h->destroy_key   = destroy_key;
  h->destroy_value = destroy_value;

  *ph = h;

  return error_OK;
}

Fix leak in calloc failure path.

Fix leak in calloc failure path.


/*-------------------------------------------------------------------------
 *
 *   FILE
 *	pqxx/util.h
 *
 *   DESCRIPTION
 *      Various utility definitions for libpqxx
 *
 * Copyright (c) 2001-2004, Jeroen T. Vermeulen <jtv@xs4all.nl>
 *
 * See COPYING for copyright license.  If you did not receive a file called
 * COPYING with this source code, please notify the distributor of this mistake,
 * or contact the author.
 *
 *-------------------------------------------------------------------------
 */
#ifndef PQXX_UTIL_H
#define PQXX_UTIL_H

#if defined(PQXX_HAVE_CPP_WARNING)
#warning "Deprecated libpqxx header included.  Use headers without '.h'"
#elif defined(PQXX_HAVE_CPP_PRAGMA_MESSAGE)
#pragma message("Deprecated libpqxx header included.  Use headers without '.h'")
#endif

#define PQXX_DEPRECATED_HEADERS
#include "pqxx/util"

#endif

/*-------------------------------------------------------------------------
 *
 *   FILE
 *	pqxx/util.h
 *
 *   DESCRIPTION
 *      Various utility definitions for libpqxx
 *
 * Copyright (c) 2001-2004, Jeroen T. Vermeulen <jtv@xs4all.nl>
 *
 * See COPYING for copyright license.  If you did not receive a file called
 * COPYING with this source code, please notify the distributor of this mistake,
 * or contact the author.
 *
 *-------------------------------------------------------------------------
 */
#ifndef PQXX_UTIL_H
#define PQXX_UTIL_H

#if !defined(PQXXYES_I_KNOW_DEPRECATED_HEADER)
#define PQXXYES_I_KNOW_DEPRECATED_HEADER
#if defined(PQXX_HAVE_CPP_WARNING)
#warning "Deprecated libpqxx header included.  Use headers without '.h'"
#elif defined(PQXX_HAVE_CPP_PRAGMA_MESSAGE)
#pragma message("Deprecated libpqxx header included.  Use headers without '.h'")
#endif
#endif

#define PQXX_DEPRECATED_HEADERS
#include "pqxx/util"

#endif

Allow suppression of "deprecated header" warning

git-svn-id: 27238e37a5eae711b76ec703b45445819ea9563e@600 c3353b84-d008-0410-9ed9-b55c4f7fa7e8


#include <avr/io.h>

int main (void) {

	//Set pin 3 as output to source current?
	PORTB = 1<<PORTB3;
	DDRB = 1<<DDB3;

}

#include <avr/io.h>
#include <avr/wdt.h>
#include <avr/interrupt.h>

int main ( void ) {

	//Disable interrupts and reset WDT timer
	cli();
	wdt_reset();

	//Reset MCU status register
	MCUSR &= ~(1<<WDRF);

	//Disable watchdog
	WDTCR |= (1<<WDCE) | (1<<WDE);
	WDTCR = 0;

	//Enable LED
	DDRB = 1<<DDB3;
	PORTB = 1<<PORTB3;

	//Start watchdog
	WDTCR |= (1<<WDCE) | (1<<WDE);
	WDTCR =  (1<<WDTIE) | (1<<WDP2) | (1<<WDP1);

	//Enable interrupts
	sei();

	while(1);

}

//Catching WatchDog interrupts
ISR ( WDT_vect ) {

	PORTB ^= 1<<PORTB3;

}

Make a watchdog timer blink a LED

Make a watchdog timer blink a LED


//===----------------------------------------------------------------------===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is dual licensed under the MIT and the University of Illinois Open
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

#ifndef _LIBCPP_SUPPORT_NEWLIB_XLOCALE_H
#define _LIBCPP_SUPPORT_NEWLIB_XLOCALE_H

#if defined(_NEWLIB_VERSION)

#include <cstdlib>
#include <clocale>
#include <cwctype>
#include <ctype.h>
#if !defined(__NEWLIB__) || __NEWLIB__ < 2 || \
    __NEWLIB__ == 2 && __NEWLIB_MINOR__ < 5
#include <support/xlocale/__nop_locale_mgmt.h>
#endif
#include <support/xlocale/__posix_l_fallback.h>
#include <support/xlocale/__strtonum_fallback.h>

#endif // _NEWLIB_VERSION

#endif

//===----------------------------------------------------------------------===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is dual licensed under the MIT and the University of Illinois Open
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

#ifndef _LIBCPP_SUPPORT_NEWLIB_XLOCALE_H
#define _LIBCPP_SUPPORT_NEWLIB_XLOCALE_H

#if defined(_NEWLIB_VERSION)

#include <cstdlib>
#include <clocale>
#include <cwctype>
#include <ctype.h>
#if !defined(__NEWLIB__) || __NEWLIB__ < 2 || \
    __NEWLIB__ == 2 && __NEWLIB_MINOR__ < 5
#include <support/xlocale/__nop_locale_mgmt.h>
#include <support/xlocale/__posix_l_fallback.h>
#include <support/xlocale/__strtonum_fallback.h>
#endif

#endif // _NEWLIB_VERSION

#endif

[libc++] Exclude posix_l/strtonum fallback inclusion for newlib > 2.4

Summary:
[libc++] Exclude posix_l/strtonum fallback inclusion for newlib > 2.4

r338122 changed the linkage of some methods which revealed an existing ODR violation, e.g.:
projects/libcxx/include/support/xlocale/__posix_l_fallback.h:83:38: error: 'internal_linkage' attribute does not appear on the first declaration of 'iswcntrl_l'
inline _LIBCPP_INLINE_VISIBILITY int iswcntrl_l(wint_t c, locale_t) {
                                     ^
lib/include/wctype.h:55:12: note: previous definition is here
extern int      iswcntrl_l (wint_t, locale_t);

These were added to newlib in 2.4 [1] [2], so move them to the already existing include guard.

[1] https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;a=commit;h=238455adfab4f8070ac65400aac22bb8a9e502fc
[2] https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;a=commit;h=8493c1631643fada62384768408852bc0fa6ff44

Reviewers: ldionne, rsmith, EricWF

Subscribers: christof, cfe-commits

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

git-svn-id: 756ef344af921d95d562d9e9f9389127a89a6314@338157 91177308-0d34-0410-b5e6-96231b3b80d8


#ifndef FTS_COMMON_H
#define FTS_COMMON_H

#define IS_NONASCII_APOSTROPHE(c) \
	((c) == 0x2019 || (c) == 0xFF07)
#define IS_APOSTROPHE(c) \
	((c) == 0x0027 || IS_NONASCII_APOSTROPHE(c))

#endif

#ifndef FTS_COMMON_H
#define FTS_COMMON_H

/* Some might consider 0x02BB an apostrophe also. */
#define IS_NONASCII_APOSTROPHE(c) \
	((c) == 0x2019 || (c) == 0xFF07)
#define IS_APOSTROPHE(c) \
	((c) == 0x0027 || IS_NONASCII_APOSTROPHE(c))

#endif

lib-fts: Add note about possible additional apostrophe.


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

typedef struct list {
    int data;
    struct list * next;
} list;

list * make_elem(void) {
    list * pe;

    if(NULL == (pe = malloc(sizeof(list)))) {
        fprintf(stderr, "Erreur d'allocation memoire\n");
        exit(EXIT_FAILURE);
    }

    return pe;
}

int main() {

    list *pl, *pe1, *pe2, *pe3, *pe4;

    pe1 = make_elem();
    pe2 = make_elem();
    pe3 = make_elem();
    pe4 = make_elem();

    pe1->data = 2;
    pe2->data = 3;
    pe3->data = 5;
    pe4->data = 7;

    pl = pe1;

    pe1->next = pe2;
    pe2->next = pe3;
    pe3->next = pe4;
    pe4->next = NULL;

    list * c;

    for(c=pl ; c ; c=c->next) {
        printf("%d\n", c->data);
    }

    free(pe1);
    free(pe2);
    free(pe3);
    free(pe4);

    return 0;
}

Add a snippet (lang C).

Add a snippet (lang C).


#include <stdio.h>

typedef struct {
    int *x;
    int **y;
} inner ;

typedef struct {
    int *g;
    inner in[3];
} outer;

int *ep;

int main(int argc, char *argv[])
{
    outer o;
    int z = 5;

    printf("%d\n" , z);

    ep = &z;

    o.in[2].x = ep;

    *o.in[2].x = 3;
    printf("%d\n" , z);

    outer oo[4];

    oo[2].in[2].y = &ep;
    return 0;
}

#include <stdio.h>

typedef struct {
    int *x;
    int **y;
} inner ;

typedef struct {
    int *g;
    inner in[3];
} outer;

int *ep;

int main(int argc, char *argv[])
{
    outer o;
    int z = 5;
    int zzz;

    printf("%d\n" , z);

    ep = &z;

    o.in[2].x = ep;

    *o.in[2].x = 3;
    printf("%d\n" , z);

    inner i;
    i.x = &zzz;
    o.in[1] = i;

    int **ptr = &o.in[0].x;
    int *p = *ptr;
    /* outer oo[4]; */

    /* oo[2].in[2].y = &ep; */
    return 0;
}

Add bitwise copy of struct to complex struct example.


#import <Foundation/Foundation.h>

// Motivation:
// JSON responses frequently contain 'null'. For our purposes, a JSON object with
// a null property is equivalent to the same object with that property missing.
// However, JSON parsers treat the former as `NSNull` and the latter as nil;
// This leads to problems for the subsequent code because NSNull is a bona-fide
// object while messages to nil are discarded. Furthermore, Objective C truthy
// checks work for NSNull and fail for nil.

@interface NSDictionary (TDTNullNormalization)

/**
 @return NSDictionary created by removing all enteries whose @p value is an
 instance of @p NSNull.

 @see NSArray+TDTNullNormalization
 */
- (NSDictionary *)tdt_dictionaryByRemovingNulls;

@end

#import <Foundation/Foundation.h>

@interface NSDictionary (TDTNullNormalization)

/**
 @return NSDictionary created by removing all enteries whose @p value is an
 instance of @p NSNull.

 @see NSArray+TDTNullNormalization
 */
- (NSDictionary *)tdt_dictionaryByRemovingNulls;

@end

Remove now irrelevant motivation section


//
//  BDSKSearchGroupViewController.h
//  Bibdesk
//
//  Created by Christiaan Hofman on 1/2/07.
/*
 This software is Copyright (c) 2007
 Christiaan Hofman. All rights reserved.

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

 - Redistributions of source code must retain the above copyright
 notice, this list of conditions and the following disclaimer.

 - Redistributions in binary form must reproduce the above copyright
 notice, this list of conditions and the following disclaimer in
 the documentation and/or other materials provided with the
 distribution.

 - Neither the name of Christiaan Hofman nor the names of any
 contributors may be used to endorse or promote products derived
 from this software without specific prior written permission.

 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
 "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
 LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
 A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
 OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
 SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
 LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
 DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
 THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */

#import <Cocoa/Cocoa.h>

@class BDSKCollapsibleView, BDSKEdgeView, BDSKSearchGroup;

@interface BDSKSearchGroupViewController : NSWindowController {
    IBOutlet BDSKCollapsibleView *view;
    IBOutlet BDSKEdgeView *edgeView;
    IBOutlet NSSearchField *searchField;
    IBOutlet NSButton *searchButton;

    BDSKSearchGroup *group;
}

- (NSView *)view;

- (BDSKSearchGroup *)group;
- (void)setGroup:(BDSKSearchGroup *)newGroup;

- (IBAction)changeSearchTerm:(id)sender;
- (IBAction)nextSearch:(id)sender;

@end

Add new header file. (or: xcode is stupid)


// MIT License

// Copyright (c) 2017 Zhuhao Wang

// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:

// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.

// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.

#pragma once

#include <boost/asio.hpp>

namespace nekit {
namespace utils {

class AsyncIoInterface {
 public:
  AsyncIoInterface(boost::asio::io_service& io) : io_{&io} {};
  ~AsyncIoInterface() = default;

  boost::asio::io_service& io() const { return *io_; }

 private:
  boost::asio::io_service* io_;
};

}  // namespace utils
}  // namespace nekit

FEAT: Make things based on Asio `service_io` inherite from same base


#include "listHelper.h"

int isIdentical(struct linkList *head1, struct linkList *head2)
{
	/* list1 and list2 has to have same data and length
	 * even if length or data mismatch , we return
	 * list as non identical.
	 */
	while(head1 != NULL && head2 != NULL) {
		if(head1->data != head2->data)
			return 0;
		head1 = head1->next;
		head2 = head2->next;
	}
	if(head1 == NULL && head2 == NULL)
		return 1;
	else
		return 0;
}

void
main() {

        int dat;
        struct linkList *list1 = NULL, *list2 = NULL;

        InsertLinkedList(&list1, 21, 1);         /*Insert node in Beginning */
        InsertLinkedList(&list1, 31, 2);         /*Insert at position 2 */
        InsertLinkedList(&list1, 41, 3);
        InsertLinkedList(&list1, 51, 4);
        InsertLinkedList(&list1, 61, 5);
        InsertLinkedList(&list1, 72, 6);
        InsertLinkedList(&list1, 87, 7);
        InsertLinkedList(&list1, 98, 8);

        InsertLinkedList(&list2, 21, 1);         /*Insert node in Beginning */
        InsertLinkedList(&list2, 31, 2);         /*Insert at position 2 */
        InsertLinkedList(&list2, 41, 3);
        InsertLinkedList(&list2, 51, 4);
        InsertLinkedList(&list2, 61, 5);
        InsertLinkedList(&list2, 72, 6);
        InsertLinkedList(&list2, 87, 7);
        InsertLinkedList(&list2, 98, 8);

        InsertLinkedList(&list2, 2014, 9);

	if(isIdentical(list1, list2))
		printf("isIdentical\n");
	else
		printf("Not Identical\n");
}

Check if two linked lists are identical or same.


//
//  YSProcessTimer.h
//  YSProcessTimeExample
//
//  Created by Yu Sugawara on 2014/02/21.
//  Copyright (c) 2014年 Yu Sugawara. All rights reserved.
//

#import <Foundation/Foundation.h>

#ifndef DEBUG
    #define kYSProcessTimerInvalid 1
#endif

@interface YSProcessTimer : NSObject

+ (instancetype)sharedInstance;
- (instancetype)initWithProcessName:(NSString*)processName;
@property (nonatomic) NSString *processName;

- (void)startWithComment:(NSString*)comment;
- (NSTimeInterval)currentRapTime;
- (void)addRapWithComment:(NSString *)comment;
- (void)stopWithComment:(NSString*)stopComment;

@end

//
//  YSProcessTimer.h
//  YSProcessTimeExample
//
//  Created by Yu Sugawara on 2014/02/21.
//  Copyright (c) 2014年 Yu Sugawara. All rights reserved.
//

#import <Foundation/Foundation.h>

#ifndef DEBUG
    #define kYSProcessTimerInvalid 1
#endif

@interface YSProcessTimer : NSObject

+ (instancetype)sharedInstance;
- (instancetype)initWithProcessName:(NSString*)processName;
@property (nonatomic, copy) NSString *processName;

- (void)startWithComment:(NSString*)comment;
- (NSTimeInterval)currentRapTime;
- (void)addRapWithComment:(NSString *)comment;
- (void)stopWithComment:(NSString*)stopComment;

@end

Change NSString property to copy

Change NSString property to copy


// SyncTools.h
// This file is part of the EScript programming language (https://github.com/EScript)
//
// Copyright (C) 2015 Claudius Jhn <ClaudiusJ@live.de>
//
// Licensed under the MIT License. See LICENSE file for details.
// ---------------------------------------------------------------------------------
#ifndef SYNCTOOLS_H_INCLUDED
#define SYNCTOOLS_H_INCLUDED

#include <thread>
#include <mutex>
#include <atomic>

namespace EScript{
namespace SyncTools{
namespace _Internals{
//! \see http://en.cppreference.com/w/cpp/atomic/atomic_flag
class SpinLock{
	private:
		std::atomic_flag f;
	public:
		SpinLock():f(ATOMIC_FLAG_INIT){}

		void lock()		{	while(!f.test_and_set(std::memory_order_acquire));	}
		bool try_lock()	{	return !f.test_and_set(std::memory_order_acquire);	}
		void unlock()	{	f.clear(std::memory_order_release);		}
};
}

typedef std::atomic<int> atomicInt;
typedef std::atomic<bool> atomicBool;
//typedef std::mutex  FastLock;
typedef _Internals::SpinLock FastLock;
typedef std::unique_lock<FastLock> FastLockHolder;

}
}

#endif // SYNCTOOLS_H_INCLUDED

// SyncTools.h
// This file is part of the EScript programming language (https://github.com/EScript)
//
// Copyright (C) 2015 Claudius Jhn <ClaudiusJ@live.de>
//
// Licensed under the MIT License. See LICENSE file for details.
// ---------------------------------------------------------------------------------
#ifndef SYNCTOOLS_H_INCLUDED
#define SYNCTOOLS_H_INCLUDED

#include <thread>
#include <mutex>
#include <atomic>

namespace EScript{
namespace SyncTools{
namespace _Internals{
//! \see http://en.cppreference.com/w/cpp/atomic/atomic_flag
class SpinLock{
		std::atomic_flag f;
	public:
		SpinLock():f(ATOMIC_FLAG_INIT){}

		void lock()		{	while(f.test_and_set(std::memory_order_acquire));	}
		bool try_lock()	{	return !f.test_and_set(std::memory_order_acquire);	}
		void unlock()	{	f.clear(std::memory_order_release);		}
};
}

typedef std::atomic<int> atomicInt;
typedef std::atomic<bool> atomicBool;
//typedef std::mutex  FastLock;
typedef _Internals::SpinLock FastLock;
//typedef std::mutex FastLock;
typedef std::unique_lock<FastLock> FastLockHolder;

inline SyncTools::FastLockHolder tryLock(FastLock& lock){
	return std::move(FastLockHolder(lock, std::try_to_lock) );
}

}
}

#endif // SYNCTOOLS_H_INCLUDED

Fix SpinLock and add tryLock.

Fix SpinLock and add tryLock.


#ifndef TAILPRODUCE_UTILS_H
#define TAILPRODUCE_UTILS_H

#include <string>
#include <sstream>
#include <memory>
#include <unordered_map>
#include <utility>

#include <cereal/cereal.hpp>
#include <cereal/archives/json.hpp>
#include <cereal/types/string.hpp>

#include "helpers.h"
#include "stream.h"
#include "dbm_iterator.h"
#include "config_values.h"
#include "stream_persist.h"

namespace TailProduce {
    // This block of code is used to create a stream and a producer pair from the stream persist objects in the db
    template<typename ORDER_KEY, typename STORAGE>
    auto
    RestorePersistedStreams(TailProduce::StreamsRegistry& registry,
                            STORAGE& storage,
                            TailProduce::ConfigValues const& cv) ->
        std::unordered_map< std::string, std::shared_ptr<TailProduce::Stream<ORDER_KEY>>>
    {
        typedef TailProduce::Stream<ORDER_KEY> STREAM;
        typedef std::shared_ptr<STREAM> STREAM_PTR;

        std::unordered_map<std::string, STREAM_PTR> results;
        auto knownStreamsKey = cv.GetStreamsRegister(""); // passing an empty string will allow creating an iterator of all known streams
        auto iterator = storage.GetIterator(knownStreamsKey);
        while(!iterator.Done()) {
            std::string streamValues = antibytes(iterator.Value());
            TailProduce::StreamPersist persisted;
            std::istringstream is(streamValues);  // make the string a stream
            cereal::JSONInputArchive ar(is);      // make a JSON Input Archive from the string
            ar(persisted);                        // populate Persisted
            auto stream = STREAM_PTR(new STREAM(registry,
                                                cv,
                                                persisted.stream_name,
                                                persisted.entry_type_name,
                                                persisted.order_key_type_name));

            results.insert(std::make_pair(stream->GetId(), stream));
            iterator.Next();
        }
        return results;
    }

    template<typename STORAGE>
    void
    PersistStream(STORAGE storage,
                  TailProduce::StreamPersist &sp,
                  TailProduce::ConfigValues& cv)
    {
        // The reverse of this is to store the known streams in the DB.
        std::ostringstream os;
        (cereal::JSONOutputArchive(os))(sp);
        std::string objStr = os.str();
        TailProduce::Storage::KEY_TYPE skey = cv.GetStreamsRegister(sp.stream_name);
        storage.AdminSet(skey, TailProduce::bytes(objStr));
    }

};
#endif

Add missing file. Remove debuggig statements


#ifndef SPIRALLINESGLWIDGET_H
#define SPIRALLINESGLWIDGET_H

#include "GLWidget.h"
#include <cmath>

class SpiralLinesGLWidget : public GLWidget
{
public:
	SpiralLinesGLWidget(QWidget* parent = 0);
protected:
	void initializeGL();
	void render();
};

SpiralLinesGLWidget::SpiralLinesGLWidget(QWidget* parent) : GLWidget(parent) {}

void SpiralLinesGLWidget::initializeGL()
{
	GLWidget::initializeGL();
	setXRotation(-45);
	setYRotation(15);
	setZRotation(45);
}

void SpiralLinesGLWidget::render()
{
	// How many revolutions of the spiral are rendered.
	static const float REVOLUTIONS = 10;
	static const float PI = 3.14159;

	glBegin(GL_LINE_STRIP);
	for (float angle = 0; angle < 2*PI*REVOLUTIONS; angle +=  PI / (2 * REVOLUTIONS * 10)) {
		glVertex2f(
			angle * (float) sin(angle),
			angle * (float) cos(angle));
	}
	glEnd();
}

#endif // SPIRALLINESGLWIDGET_H

#ifndef SPIRALLINESGLWIDGET_H
#define SPIRALLINESGLWIDGET_H

#include "GLWidget.h"
#include <cmath>

class SpiralLinesGLWidget : public GLWidget
{
public:
	SpiralLinesGLWidget(QWidget* parent = 0);
protected:
	void initializeGL();
	void render();
};

SpiralLinesGLWidget::SpiralLinesGLWidget(QWidget* parent) : GLWidget(parent) {}

void SpiralLinesGLWidget::initializeGL()
{
	GLWidget::initializeGL();
	setXRotation(-45);
	setYRotation(15);
	setZRotation(45);
}

void SpiralLinesGLWidget::render()
{
	// How many revolutions of the spiral are rendered.
	static const float REVOLUTIONS = 10;
	static const float PI = 3.14159;

	// How many vertices per revolution.
	static const float SLICES = 10;

	glBegin(GL_LINE_STRIP);
	for (int i = 0; i <= REVOLUTIONS * SLICES; i++) {
		const float angle = i * 2 * PI / SLICES;
		glVertex2f(
			angle * (float) sin(angle),
			angle * (float) cos(angle));
	}
	glEnd();
}

#endif // SPIRALLINESGLWIDGET_H

Use integers instead of floats in for-loop

While this adds a few more lines to the program, I think it makes it
more explicit where the constants come from. It also faciliates
easier modification of the example.

It's also safer to use an integer instead of a float as a conditional
in a for-loop. This is because floating point values are imprecise.
As a result, you may end up with one more or one fewer iteration than
you anticipated. Integers don't have this disadvantage.


#pragma once

#include <pthread.h>
#include <glb-lib/output.h>

#include <kmq.h>
#include <knd_shard.h>

struct kndLearnerService;

struct kndLearnerOptions
{
    char *config_file;
    struct addrinfo *address;
};

struct kndLearnerService
{
    struct kmqKnode *knode;
    struct kmqEndPoint *entry_point;

    struct kndShard *shard;

    char name[KND_NAME_SIZE];
    size_t name_size;

    char path[KND_NAME_SIZE];
    size_t path_size;

    char schema_path[KND_NAME_SIZE];
    size_t schema_path_size;

    char delivery_addr[KND_NAME_SIZE];
    size_t delivery_addr_size;

    size_t max_users;

    const struct kndLearnerOptions *opts;

    /*********************  public interface  *********************************/
    int (*start)(struct kndLearnerService *self);
    void (*del)(struct kndLearnerService *self);
};

int kndLearnerService_new(struct kndLearnerService **service, const struct kndLearnerOptions *opts);

#pragma once

#include <pthread.h>
#include <glb-lib/output.h>

#include <kmq.h>
#include <knd_shard.h>

struct kndLearnerService;

struct kndLearnerOptions
{
    char *config_file;
    struct addrinfo *address;
};

struct kndLearnerService
{
    struct kmqKnode *knode;
    struct kmqEndPoint *entry_point;

    struct kndShard *shard;

    char name[KND_NAME_SIZE];
    size_t name_size;

//    char path[KND_NAME_SIZE];
//    size_t path_size;
//
//    char schema_path[KND_NAME_SIZE];
//    size_t schema_path_size;
//
//    char delivery_addr[KND_NAME_SIZE];
//    size_t delivery_addr_size;

//    size_t max_users;

    const struct kndLearnerOptions *opts;

    /*********************  public interface  *********************************/
    int (*start)(struct kndLearnerService *self);
    void (*del)(struct kndLearnerService *self);
};

int kndLearnerService_new(struct kndLearnerService **service, const struct kndLearnerOptions *opts);

Comment out unused fields in kndLearnerService


#ifndef HTTPD_PLATFORM_H
#define HTTPD_PLATFORM_H

void httpdPlatSendData(ConnTypePtr conn, char *buff, int len);
void httpdPlatDisconnect(ConnTypePtr conn);
void httpdPlatInit(int port, int maxConnCt);

#endif

#ifndef HTTPD_PLATFORM_H
#define HTTPD_PLATFORM_H

int httpdPlatSendData(ConnTypePtr conn, char *buff, int len);
void httpdPlatDisconnect(ConnTypePtr conn);
void httpdPlatInit(int port, int maxConnCt);

#endif

Change to send routine: return status

Change to send routine: return status


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

#include <X11/Xlib.h>
#include <X11/XKBlib.h>

#define CAPSLOCK 2

void setcaps(int on)
{
   Display* display = XOpenDisplay(NULL);
   XkbLockModifiers(display, XkbUseCoreKbd, CAPSLOCK, on ? CAPSLOCK : 0);
   XCloseDisplay(display);
}

void usage(const char* program_name)
{
    printf("Usage: %s [on|off]\n\n", program_name);
    printf("Use '%s' to disable your caps key");
}

int main(int argc, char** argv)
{
    if (argc > 2) {
        usage(argv[0]);
        return 1;
    }

    int on = 1;
    if (argc == 2) {
        if (strcmp(argv[1], "on") == 0) {
            on = 1;
        }
        else if (strcmp(argv[1], "off") == 0) {
            on = 0;
        }
        else {
            usage(argv[0]);
            return 1;
        }
    }

    setcaps(on);
    return 0;
}

#include <stdio.h>

#include <strings.h>

#include <X11/Xlib.h>
#include <X11/XKBlib.h>

#define CAPSLOCK 2

void setcaps(int on)
{
   Display* display = XOpenDisplay(NULL);
   XkbLockModifiers(display, XkbUseCoreKbd, CAPSLOCK, on ? CAPSLOCK : 0);
   XCloseDisplay(display);
}

void usage(const char* program_name)
{
    printf("Usage: %s [on|off]\n\n", program_name);
    printf("Use '%s' to disable your caps key");
}

int main(int argc, char** argv)
{
    if (argc > 2) {
        usage(argv[0]);
        return 1;
    }

    int on = 1;
    if (argc == 2) {
        if (strcasecmp(argv[1], "on") == 0) {
            on = 1;
        }
        else if (strcasecmp(argv[1], "off") == 0) {
            on = 0;
        }
        else {
            usage(argv[0]);
            return 1;
        }
    }

    setcaps(on);
    return 0;
}

Make command line argument case insensitive


#! /usr/bin/tcc -run

/*** construct scroll ready screen buffer ***/

//  y = 0,1,2 ... (text buffer   first line, second line, ...)
//  x = 0,1,2 ... (screen buffer first character in line y, ...)

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

    size_t linecap;
    FILE *fp;

typedef struct slot
{
    ssize_t size;
    char *row;
    int count;
}   slot;

    slot  line;
    slot* text;

void screenBuffer(int star, int stop)
{
    printf("%s","entering screenBuffer\n");
    slot* display = (slot *) malloc(     (25)*sizeof(slot));
    for (int i=0; i<25; i++) {display[i].size  =   1;
                              display[i].row   = "~";
                              display[i].count =   0;}
    int i; int dy = -1;
    for (int i = star; i<(stop+1); i++)
         {dy++ ; display[dy] = text[i];}

    dy = -1 ;
    for (int i = star; i<(stop+1); i++)
         {
          dy++ ;
          int stringLength = display[dy].size;
          char* pointerToString = display[dy].row;
          printf("%.*s", stringLength, pointerToString);
         }

}

int readAline(void)
{
    line.row = NULL; linecap = 0;
    line.size = getline (&line.row, &linecap, fp);

    if (line.size == -1) {return line.size;}

    if((line.count == 0))
         { text = (slot *) malloc(     (1+line.count)*sizeof(slot));}
    else { text = (slot *)realloc(text,(1+line.count)*sizeof(slot));}

    char * ptr = malloc(line.size*sizeof(char));
    text[line.count].row = ptr  ;
    text[line.count].size = line.size;
    memcpy(ptr,line.row,line.size);

    line.count++;
    return 0;
}

int main(int arc, char** argv)
{
    printf("\n%s executing\n\n",argv[0]);

    char *filename = "NDEX.dat"; fp = fopen(filename,"r");
    int lastline;

    line.count = 0;
    while((readAline() != -1)) {lastline = line.count;}

    for (int y = 0; y < lastline;      y++)
   {
    for (int x = 0; x < text[y].size;  x++)
    {char ch = text[y].row[x];    printf("%c",ch);}
   }

   printf("%s","here i should be\n");
   screenBuffer(1,3);

}

Add routine screenBuffer to enable scrolling view and to enable syntax highlighting.


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

user_t* NewUser(int fd,char *addr,unsigned short port,char *name){
    user_t *user = malloc(sizeof(user_t));
    if(user == NULL){
        goto ret;
    }

    if(fd < 0 || addr == NULL || name == NULL){
        free(user);
        user = NULL;
        goto ret;
    }

    user->fd = fd;
    strcpy(user->addr,addr);
    user->port = port;
    strcpy(user->name,name);
    user->next = NULL;

ret:
    return user;
}

void AddUserToList(user_t *root,user_t *newUser){
    user_t *cur = root;
    while(cur->next != NULL){
        cur = cur->next;
    }
    cur->next = newUser;
}

int CheckUserValid(user_t *root,char *name){
    user_t *cur=root;
    int len = strlen(name);
    if(len < 2 || len > 12){
        return 0;
    }
    if(strcmp(name,"anonymous") == 0){
        return 0;
    }
    while(cur != NULL){
        if(strcmp(cur->name,name) == 0){
            return 0;
        }
        cur = cur->next;
    }
    return 1;
}

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

user_t* NewUser(int fd,char *addr,unsigned short port,char *name){
    user_t *user = malloc(sizeof(user_t));
    if(user == NULL){
        goto ret;
    }

    if(fd < 0 || addr == NULL || name == NULL){
        free(user);
        user = NULL;
        goto ret;
    }

    user->fd = fd;
    strcpy(user->addr,addr);
    user->port = port;
    strcpy(user->name,name);
    user->next = NULL;

ret:
    return user;
}

void AddUserToList(user_t *root,user_t *newUser){
    user_t *cur = root;
    if(root == NULL){
        return;
    }
    while(cur->next != NULL){
        cur = cur->next;
    }
    cur->next = newUser;
}

int CheckUserValid(user_t *root,char *name){
    user_t *cur=root;
    int len = strlen(name);
    if(len < 2 || len > 12){
        return 0;
    }
    if(strcmp(name,"anonymous") == 0){
        return 0;
    }
    while(cur != NULL){
        if(strcmp(cur->name,name) == 0){
            return 0;
        }
        cur = cur->next;
    }
    return 1;
}

Fix AddUserToList bug when root is NULL

Fix AddUserToList bug when root is NULL


// KMail Version Information
//
#ifndef kmversion_h
#define kmversion_h

#define KMAIL_VERSION "1.9.8"

#endif /*kmversion_h*/

// KMail Version Information
//
#ifndef kmversion_h
#define kmversion_h

#define KMAIL_VERSION "1.9.9"

#endif /*kmversion_h*/

Increase version number for KDE 3.5.9.

Increase version number for KDE 3.5.9.

svn path=/branches/KDE/3.5/kdepim/; revision=771811


// Copyright (c) 2015, Galaxy Authors. All Rights Reserved
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
// Author: yuanyi03@baidu.com

#ifndef _DOWNLOAD_H
#define _DOWNLOAD_H

#include <string>

namespace galaxy {

class Downloader {
public:
    virtual int Fetch(const std::string& uri, const std::string& dir) = 0;
    virtual void Stop() = 0;
};

}   // ending namespace galaxy

#endif  //_DOWNLOAD_H

/* vim: set ts=4 sw=4 sts=4 tw=100 */

// Copyright (c) 2015, Galaxy Authors. All Rights Reserved
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
// Author: yuanyi03@baidu.com

#ifndef _DOWNLOAD_H
#define _DOWNLOAD_H

#include <string>

namespace galaxy {

class Downloader {
public:
    virtual ~Downloader() {}
    virtual int Fetch(const std::string& uri, const std::string& dir) = 0;
    virtual void Stop() = 0;
};

}   // ending namespace galaxy

#endif  //_DOWNLOAD_H

/* vim: set ts=4 sw=4 sts=4 tw=100 */

Add virtual deconstructor for abstract class Downloader


#include <string.h>

#include "luv.h"
#include "luv_functions.c"

int luv_newindex(lua_State* L) {
  lua_getfenv(L, 1);
  lua_pushvalue(L, 2);
  lua_pushvalue(L, 3);
  lua_rawset(L, -3);
  lua_pop(L, 1);
  return 0;
}

LUALIB_API int luaopen_luv (lua_State *L) {

  luv_main_thread = L;

  luaL_newmetatable(L, "luv_handle");
  lua_pushcfunction(L, luv_newindex);
  lua_setfield(L, -2, "__newindex");
  lua_pop(L, 1);

  // Module exports
  lua_newtable (L);
  luv_setfuncs(L, luv_functions);
  return 1;
}

#include <string.h>

#include "luv.h"
#include "luv_functions.c"

static int luv_newindex(lua_State* L) {
  lua_getfenv(L, 1);
  lua_pushvalue(L, 2);
  lua_pushvalue(L, 3);
  lua_rawset(L, -3);
  lua_pop(L, 1);
  return 0;
}

static int luv_index(lua_State* L) {
#ifdef LUV_STACK_CHECK
  int top = lua_gettop(L);
#endif
  lua_getfenv(L, 1);
  lua_pushvalue(L, 2);
  lua_rawget(L, -2);
  lua_remove(L, -2);
#ifdef LUV_STACK_CHECK
  assert(lua_gettop(L) == top + 1);
#endif
  return 1;
}

LUALIB_API int luaopen_luv (lua_State *L) {

  luv_main_thread = L;

  luaL_newmetatable(L, "luv_handle");
  lua_pushcfunction(L, luv_newindex);
  lua_setfield(L, -2, "__newindex");
  lua_pushcfunction(L, luv_index);
  lua_setfield(L, -2, "__index");
  lua_pop(L, 1);

  // Module exports
  lua_newtable (L);
  luv_setfuncs(L, luv_functions);
  return 1;
}

Allow reading back callbacks set to handles


/* Copyright (C) 2004       Manuel Novoa III    <mjn3@codepoet.org>
 *
 * GNU Library General Public License (LGPL) version 2 or later.
 *
 * Dedicated to Toni.  See uClibc/DEDICATION.mjn3 for details.
 */

#include "_stdio.h"

link_warning(gets, "the 'gets' function is dangerous and should not be used.")

/* UNSAFE FUNCTION -- do not bother optimizing */

libc_hidden_proto(getchar_unlocked)
libc_hidden_proto(__fgetc_unlocked)
libc_hidden_proto(__stdin)

char *gets(char *s)
{
	register char *p = s;
	int c;
	__STDIO_AUTO_THREADLOCK_VAR;

	__STDIO_AUTO_THREADLOCK(stdin);

	/* Note: don't worry about performance here... this shouldn't be used!
	 * Therefore, force actual function call. */
	while (((c = getchar_unlocked()) != EOF) && ((*p = c) != '\n')) {
		++p;
	}
	if ((c == EOF) || (s == p)) {
		s = NULL;
	} else {
		*p = 0;
	}

	__STDIO_AUTO_THREADUNLOCK(stdin);

	return s;
}

/* Copyright (C) 2004       Manuel Novoa III    <mjn3@codepoet.org>
 *
 * GNU Library General Public License (LGPL) version 2 or later.
 *
 * Dedicated to Toni.  See uClibc/DEDICATION.mjn3 for details.
 */

#include "_stdio.h"

link_warning(gets, "the 'gets' function is dangerous and should not be used.")

/* UNSAFE FUNCTION -- do not bother optimizing */

libc_hidden_proto(getchar_unlocked)
libc_hidden_proto(__fgetc_unlocked)
#ifdef __STDIO_GETC_MACRO
libc_hidden_proto(__stdin)
#else
#define __stdin stdin
#endif

char *gets(char *s)
{
	register char *p = s;
	int c;
	__STDIO_AUTO_THREADLOCK_VAR;

	__STDIO_AUTO_THREADLOCK(stdin);

	/* Note: don't worry about performance here... this shouldn't be used!
	 * Therefore, force actual function call. */
	while (((c = getchar_unlocked()) != EOF) && ((*p = c) != '\n')) {
		++p;
	}
	if ((c == EOF) || (s == p)) {
		s = NULL;
	} else {
		*p = 0;
	}

	__STDIO_AUTO_THREADUNLOCK(stdin);

	return s;
}

Build if GETC_MACRO use is disabled

Build if GETC_MACRO use is disabled


#pragma once

#define NOMINMAX
#include <windows.h>

#include <streams.h>

#include <audioclient.h>
#include <comdef.h>
#include <malloc.h>
#include <mmdeviceapi.h>
#include <process.h>

#include <algorithm>
#include <array>
#include <cassert>
#include <deque>
#include <functional>
#include <future>
#include <map>
#include <memory>

#include "Utils.h"

namespace SaneAudioRenderer
{
    _COM_SMARTPTR_TYPEDEF(IMMDeviceEnumerator, __uuidof(IMMDeviceEnumerator));
    _COM_SMARTPTR_TYPEDEF(IMMDevice, __uuidof(IMMDevice));

    _COM_SMARTPTR_TYPEDEF(IAudioClient, __uuidof(IAudioClient));
    _COM_SMARTPTR_TYPEDEF(IAudioRenderClient, __uuidof(IAudioRenderClient));
    _COM_SMARTPTR_TYPEDEF(IAudioClock, __uuidof(IAudioClock));

    _COM_SMARTPTR_TYPEDEF(IMediaSample, __uuidof(IMediaSample));
}

#pragma once

#ifndef NOMINMAX
#   define NOMINMAX
#endif

#include <windows.h>

#include <streams.h>

#include <audioclient.h>
#include <comdef.h>
#include <malloc.h>
#include <mmdeviceapi.h>
#include <process.h>

#include <algorithm>
#include <array>
#include <cassert>
#include <deque>
#include <functional>
#include <future>
#include <map>
#include <memory>

#include "Utils.h"

namespace SaneAudioRenderer
{
    _COM_SMARTPTR_TYPEDEF(IMMDeviceEnumerator, __uuidof(IMMDeviceEnumerator));
    _COM_SMARTPTR_TYPEDEF(IMMDevice, __uuidof(IMMDevice));

    _COM_SMARTPTR_TYPEDEF(IAudioClient, __uuidof(IAudioClient));
    _COM_SMARTPTR_TYPEDEF(IAudioRenderClient, __uuidof(IAudioRenderClient));
    _COM_SMARTPTR_TYPEDEF(IAudioClock, __uuidof(IAudioClock));

    _COM_SMARTPTR_TYPEDEF(IMediaSample, __uuidof(IMediaSample));
}

Make sure NOMINMAX is not redefined

Make sure NOMINMAX is not redefined


#ifndef ALIVERTEXERHYPERTRITON3BODY_H
#define ALIVERTEXERHYPERTRITON3BODY_H

#include <AliVertexerTracks.h>

class AliESDVertex;
class AliESDtrack;
class AliExternalTrackParam;

class AliVertexerHyperTriton3Body
{
public:
  AliVertexerHyperTriton3Body();

  AliESDVertex* GetCurrentVertex() { return mCurrentVertex; }

  bool FindDecayVertex(AliESDtrack *track1, AliESDtrack *track2, AliESDtrack* track3, float b);
  static void Find2ProngClosestPoint(AliExternalTrackParam *track1, AliExternalTrackParam *track2, float b, float* pos);

  void SetMaxDinstanceInit(float maxD) { mMaxDistanceInitialGuesses = maxD; }
  void SetToleranceGuessCompatibility(int tol) { mToleranceGuessCompatibility = tol; }

  AliVertexerTracks mVertexerTracks;

private:
  AliESDVertex* mCurrentVertex;

  float mPosition[3];
  float mCovariance[6];

  float mMaxDistanceInitialGuesses;
  int mToleranceGuessCompatibility;
};

#endif

#ifndef ALIVERTEXERHYPERTRITON3BODY_H
#define ALIVERTEXERHYPERTRITON3BODY_H

class TClonesArray; /// This will be removed as soon as alisw/AliRoot#898 is merged and a new tag is available

#include <AliVertexerTracks.h>

class AliESDVertex;
class AliESDtrack;
class AliExternalTrackParam;

class AliVertexerHyperTriton3Body
{
public:
  AliVertexerHyperTriton3Body();

  AliESDVertex* GetCurrentVertex() { return mCurrentVertex; }

  bool FindDecayVertex(AliESDtrack *track1, AliESDtrack *track2, AliESDtrack* track3, float b);
  static void Find2ProngClosestPoint(AliExternalTrackParam *track1, AliExternalTrackParam *track2, float b, float* pos);

  void SetMaxDinstanceInit(float maxD) { mMaxDistanceInitialGuesses = maxD; }
  void SetToleranceGuessCompatibility(int tol) { mToleranceGuessCompatibility = tol; }

  AliVertexerTracks mVertexerTracks;

private:
  AliESDVertex* mCurrentVertex;

  float mPosition[3];
  float mCovariance[6];

  float mMaxDistanceInitialGuesses;
  int mToleranceGuessCompatibility;
};

#endif

Fix for missing forward declaration in AliROOT


/* $FreeBSD$ */

#include <sys/param.h>
#include <sys/assym.h>

#include <i386/linux/linux.h>

ASSYM(LINUX_SIGF_HANDLER, offsetof(struct l_sigframe, sf_handler));
ASSYM(LINUX_SIGF_SC, offsetof(struct l_sigframe, sf_sc));
ASSYM(LINUX_SC_GS, offsetof(struct l_sigcontext, sc_gs));
ASSYM(LINUX_SC_EFLAGS, offsetof(struct l_sigcontext, sc_eflags));
ASSYM(LINUX_RT_SIGF_HANDLER, offsetof(struct l_rt_sigframe, sf_handler));
ASSYM(LINUX_RT_SIGF_UC, offsetof(struct l_rt_sigframe, sf_sc));

/* $FreeBSD$ */

#include <sys/param.h>
#include <sys/assym.h>
#include <sys/systm.h>

#include <i386/linux/linux.h>

ASSYM(LINUX_SIGF_HANDLER, offsetof(struct l_sigframe, sf_handler));
ASSYM(LINUX_SIGF_SC, offsetof(struct l_sigframe, sf_sc));
ASSYM(LINUX_SC_GS, offsetof(struct l_sigcontext, sc_gs));
ASSYM(LINUX_SC_EFLAGS, offsetof(struct l_sigcontext, sc_eflags));
ASSYM(LINUX_RT_SIGF_HANDLER, offsetof(struct l_rt_sigframe, sf_handler));
ASSYM(LINUX_RT_SIGF_UC, offsetof(struct l_rt_sigframe, sf_sc));

Include <sys/systm.h> for the definition of offsetof() instead of depending on the definition being misplaced in <sys/types.h>. The definition probably belongs in <sys/stddef.h>.


#ifndef RUTIL2_RALLOC_H
#define RUTIL2_RALLOC_H

#include "OO.h"

void* RAlloc(int Size);
void* RAlign(int Align, int Size);

#if defined(__MINGW32__)
#define _aligned_malloc __mingw_aligned_malloc
#define _aligned_free  __mingw_aligned_free
#define memalign(align, size) _aligned_malloc(size, align)
#endif //For MinGW

#define RFree(...) __RFree(__VA_ARGS__, (void*)(- 1))
void __RFree(void* a, ...);

#define RAlloc_Class(Name, Size) \
    (Name*)__RAlloc_Class(Size, sizeof(Name), _C(__ClassID_, Name, __));
void* __RAlloc_Class(int Size, int UnitSize, int ClassID);

#if 0
#include "_RAlloc.h"
#endif
#ifdef __RUtil2_Install
#define _RTAddress "RUtil2/Core/_RAlloc.h"
#else
#define _RTAddress "Core/_RAlloc.h"
#endif

#define _ClassName
#define _Attr 1

#include "Include_T1AllTypes.h"

#endif //RUTIL2_RALLOC_H

#ifndef RUTIL2_RALLOC_H
#define RUTIL2_RALLOC_H

#include <memory.h>

#include "OO.h"

void* RAlloc(int Size);
void* RAlign(int Align, int Size);

#if defined(__MINGW32__)
#define _aligned_malloc __mingw_aligned_malloc
#define _aligned_free  __mingw_aligned_free
#define memalign(align, size) _aligned_malloc(size, align)
#endif //For MinGW

#define RClean(Ptr) memset(Ptr, 0, sizeof(Ptr));

#define RFree(...) __RFree(__VA_ARGS__, (void*)(- 1))
void __RFree(void* a, ...);

#define RAlloc_Class(Name, Size) \
    (Name*)__RAlloc_Class(Size, sizeof(Name), _C(__ClassID_, Name, __));
void* __RAlloc_Class(int Size, int UnitSize, int ClassID);

#if 0
#include "_RAlloc.h"
#endif
#ifdef __RUtil2_Install
#define _RTAddress "RUtil2/Core/_RAlloc.h"
#else
#define _RTAddress "Core/_RAlloc.h"
#endif

#define _ClassName
#define _Attr 1

#include "Include_T1AllTypes.h"

#endif //RUTIL2_RALLOC_H

Add method 'RClean' for clean memory

Add method 'RClean' for clean memory


#ifndef BITCOINADDRESSVALIDATOR_H
#define BITCOINADDRESSVALIDATOR_H

#include <QValidator>

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

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

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

    static const int MaxAddressLength = 35;
};

#endif // BITCOINADDRESSVALIDATOR_H

#ifndef BITCOINADDRESSVALIDATOR_H
#define BITCOINADDRESSVALIDATOR_H

#include <QValidator>

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

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

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

    static const int MaxAddressLength = 35;
};

#endif // BITCOINADDRESSVALIDATOR_H

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


#ifndef CUTELYST_GLOBAL_H
#define CUTELYST_GLOBAL_H

#include <QtCore/QtGlobal>

#if defined(CUTELYST_LIBRARY)
#  define CUTELYST_LIBRARY Q_DECL_EXPORT
#else
#  define CUTELYST_LIBRARY Q_DECL_IMPORT
#endif

#endif // CUTELYST_GLOBAL_H

#ifndef CUTELYST_GLOBAL_H
#define CUTELYST_GLOBAL_H

#include <QtCore/QtGlobal>

// defined by cmake when building this library
#if defined(cutelyst_qt5_EXPORTS)
#  define CUTELYST_LIBRARY Q_DECL_EXPORT
#else
#  define CUTELYST_LIBRARY Q_DECL_IMPORT
#endif

#endif // CUTELYST_GLOBAL_H

Make sure export macro is properly set

Make sure export macro is properly set


/*
 * Copyright (c) 2017 Lech Kulina
 *
 * This file is part of the Realms Of Steel.
 * For conditions of distribution and use, see copyright details in the LICENSE file.
 */
#ifndef ROS_VERTEX_H
#define ROS_VERTEX_H

#include <glm/vec2.hpp>
#include <glm/vec3.hpp>
#include <glm/vec4.hpp>
#include <core/Common.h>
#include <core/Environment.h>

namespace ros {
    struct ROS_API Vertex {
        glm::vec3 position;
        glm::vec3 normal;
        glm::vec3 tangent;
        glm::vec3 bitangent;
        glm::vec2 textureCoordinates;
        glm::vec4 color;
    };

    typedef std::vector<Vertex> VertexVector;
    typedef std::vector<U32> IndexVector;
}

#endif // ROS_VERTEX_H

/*
 * Copyright (c) 2017 Lech Kulina
 *
 * This file is part of the Realms Of Steel.
 * For conditions of distribution and use, see copyright details in the LICENSE file.
 */
#ifndef ROS_VERTEX_H
#define ROS_VERTEX_H

#include <glm/vec2.hpp>
#include <glm/vec3.hpp>
#include <glm/vec4.hpp>
#include <core/Common.h>
#include <core/Environment.h>

namespace ros {
    struct ROS_API Vertex {
        static const U32 MAX_COLORS = 3;
        static const U32 MAX_TEXTURE_COORDS = 3;

        glm::vec4 colors[MAX_COLORS];
        glm::vec3 textureCoords[MAX_TEXTURE_COORDS];
        glm::vec3 position;
        glm::vec3 normal;
        glm::vec3 tangent;
        glm::vec3 bitangent;
    };

    typedef std::vector<Vertex> VerticesVector;
}

#endif // ROS_VERTEX_H

Support several texture coords and colors per vertex


/* $Id: ruby_xml_ns.h 612 2008-11-21 08:01:29Z cfis $ */

/* Please see the LICENSE file for copyright and distribution information */

#ifndef __RXML_NAMESPACES__
#define __RXML_NAMESPACES__

extern VALUE cXMLNamespaces;

void ruby_init_xml_namespaces(void);
#endif

/* $Id: ruby_xml_ns.h 612 2008-11-21 08:01:29Z cfis $ */

/* Please see the LICENSE file for copyright and distribution information */

#ifndef __RXML_NAMESPACES__
#define __RXML_NAMESPACES__

extern VALUE cXMLNamespaces;

void rxml_init_namespaces(void);
#endif

Fix up name of init_namespaces method.

Fix up name of init_namespaces method.