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

#include_next <winnt.h>

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

#ifdef _ARM_

// winnt.h includes some ARM intrinsics that aren't supported in
// clang and cause front end compilation breaks. Because of this,
// change the MSC version to be less than what is needed to
// support that option.
#pragma push_macro("_MSC_FULL_VER")

#if (_MSC_FULL_VER >= 170040825)
#undef _MSC_FULL_VER
#define _MSC_FULL_VER 170040824
#endif

#include_next <winnt.h>

#pragma pop_macro("_MSC_FULL_VER")

#else // Not _ARM_

#include_next <winnt.h>

#endif

Fix ARM build in CoreFoundation

Fix ARM build in CoreFoundation

Description:
winnt.h includes some ARM intrinsics that aren't supported in
clang and cause front end compilation breaks. Because of this,
change the MSC version to be less than what is needed to
support that option.

How verified:
Builds now

Reviewed by: jaredh, duhowett, jordansa


#ifndef __CMPTEST_H__
#define __CMPTEST_H__

#include <stdio.h>

#include "sodium.h"

#define TEST_NAME_RES TEST_NAME ".res"
#define TEST_NAME_OUT TEST_SRCDIR "/" TEST_NAME ".exp"

#ifdef HAVE_ARC4RANDOM
# undef rand
# define rand(X) arc4random(X)
#endif

FILE *fp_res;
int   xmain(void);

int main(void)
{
    FILE *fp_out;
    int   c;

    if ((fp_res = fopen(TEST_NAME_RES, "w+")) == NULL) {
        perror("fopen(" TEST_NAME_RES ")");
        return 99;
    }
    if (sodium_init() != 0) {
        return 99;
    }
    if (xmain() != 0) {
        return 99;
    }
    rewind(fp_res);
    if ((fp_out = fopen(TEST_NAME_OUT, "r")) == NULL) {
        perror("fopen(" TEST_NAME_OUT ")");
        return 99;
    }
    do {
        if ((c = fgetc(fp_res)) != fgetc(fp_out)) {
            return 99;
        }
    } while (c != EOF);

    return 0;
}

#undef  printf
#define printf(...) fprintf(fp_res, __VA_ARGS__)
#define main xmain

#endif

#ifndef __CMPTEST_H__
#define __CMPTEST_H__

#include <stdio.h>

#include "sodium.h"

#ifndef TEST_SRCDIR
# define TEST_SRCDIR "."
#endif

#define TEST_NAME_RES TEST_NAME ".res"
#define TEST_NAME_OUT TEST_SRCDIR "/" TEST_NAME ".exp"

#ifdef HAVE_ARC4RANDOM
# undef rand
# define rand(X) arc4random(X)
#endif

FILE *fp_res;
int   xmain(void);

int main(void)
{
    FILE *fp_out;
    int   c;

    if ((fp_res = fopen(TEST_NAME_RES, "w+")) == NULL) {
        perror("fopen(" TEST_NAME_RES ")");
        return 99;
    }
    if (sodium_init() != 0) {
        return 99;
    }
    if (xmain() != 0) {
        return 99;
    }
    rewind(fp_res);
    if ((fp_out = fopen(TEST_NAME_OUT, "r")) == NULL) {
        perror("fopen(" TEST_NAME_OUT ")");
        return 99;
    }
    do {
        if ((c = fgetc(fp_res)) != fgetc(fp_out)) {
            return 99;
        }
    } while (c != EOF);

    return 0;
}

#undef  printf
#define printf(...) fprintf(fp_res, __VA_ARGS__)
#define main xmain

#endif

Add a default value for TEST_SRCDIR

Add a default value for TEST_SRCDIR


#include <inttypes.h>
#include "Effect.h"
#include "Inputs.h"
#include "Output.h"

class Channel {
public:
	Channel(uint8_t _inputId, Output *_output);
	void read(Inputs *inputs);
	void setEffect(Effect *newEffect);
	void runEffect();
	inline Effect *getEffect() {return effect;};
	uint8_t inputId;
	Effect *effect;
private:
	uint16_t level;
	Output *output;
};

#include <inttypes.h>
#include "Effect.h"
#include "Inputs.h"
#include "Output.h"

class Channel {
public:
	Channel(uint8_t _inputId, Output *_output);
	void read(Inputs *inputs);
	void setEffect(Effect *newEffect);
	void runEffect();
	inline Effect *getEffect() {return effect;};
	uint8_t inputId;
	Effect *effect;
	Output *output;
private:
	uint16_t level;
};

Make vu meter react to trigger level

Make vu meter react to trigger level


/**
 * mips.h - all the aliases to MIPS ISA
 * @author Aleksandr Misevich
 * Copyright 2018 MIPT-MIPS
 */

#ifndef MIPS_H_
#define MIPS_H_

#include <infra/instrcache/instr_cache_memory.h>
#include "mips_instr.h"

struct MIPS
{
    using FuncInstr = MIPSInstr;
    using Register = MIPSRegister;
    using Memory = InstrMemory<MIPSInstr>;
    using RegisterUInt = uint32;
    using RegDstUInt = uint64;
};

#endif // MIPS_H_

/**
 * mips.h - all the aliases to MIPS ISA
 * @author Aleksandr Misevich
 * Copyright 2018 MIPT-MIPS
 */

#ifndef MIPS_H_
#define MIPS_H_

#include <infra/instrcache/instr_cache_memory.h>
#include "mips_instr.h"

struct MIPS
{
    using FuncInstr = MIPSInstr;
    using Register = MIPSRegister;
    using Memory = InstrMemory<MIPSInstr>;
    using RegisterUInt = uint32;
    using RegDstUInt = doubled_t<uint32>; // MIPS may produce output to 2x HI/LO register
};

#endif // MIPS_H_

Use doubled_t for MIPS defines

Use doubled_t for MIPS defines


#ifndef PIMPL_IMPL_H
#define PIMPL_IMPL_H

#include <utility>

template<typename T>
pimpl<T>::pimpl() : m{ new T{} } { }

template<typename T>
template<typename ...Args>
pimpl<T>::pimpl( Args&& ...args )
  : m{ new T{ std::forward<Args>(args)... } } { }

template<typename T>
pimpl<T>::~pimpl() { }

template<typename T>
T* pimpl<T>::operator->() { return m.get(); }

template<typename T>
const T* pimpl<T>::operator->() const { return m.get(); }

template<typename T>
T& pimpl<T>::operator*() { return *m.get(); }

#endif

#ifndef PIMPL_IMPL_H
#define PIMPL_IMPL_H

#include "make_unique.h"
#include <utility>

template<typename T>
pimpl<T>::pimpl() : m{ make_unique<T>() } { }

template<typename T>
template<typename ...Args>
pimpl<T>::pimpl( Args&& ...args )
  : m{ make_unique<T>(std::forward<Args>(args)...) } { }

template<typename T>
pimpl<T>::~pimpl() { }

template<typename T>
T* pimpl<T>::operator->() { return m.get(); }

template<typename T>
const T* pimpl<T>::operator->() const { return m.get(); }

template<typename T>
T& pimpl<T>::operator*() { return *m.get(); }

#endif

Use make_unique in pimpl helper

Use make_unique in pimpl helper


//
//  DDMathParserMacros.h
//  DDMathParser
//
//  Created by Dave DeLong on 2/19/11.
//  Copyright 2011 __MyCompanyName__. All rights reserved.
//

#import <Foundation/Foundation.h>

#import "DDTypes.h"

#ifndef ERR_ASSERT
#define ERR_ASSERT(_e) NSAssert((_e) != nil, @"NULL out error")
#endif

#ifndef ERR
#define DD_ERR(_c,_f,...) [NSError errorWithDomain:DDMathParserErrorDomain code:(_c) userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:(_f), ##__VA_ARGS__]}]
#endif

#define DDMathParserDeprecated(_r) __attribute__((deprecated(_r)))

//
//  DDMathParserMacros.h
//  DDMathParser
//
//  Created by Dave DeLong on 2/19/11.
//  Copyright 2011 __MyCompanyName__. All rights reserved.
//

#import <Foundation/Foundation.h>

#import "DDTypes.h"

#ifndef ERR_ASSERT
#define ERR_ASSERT(_e) NSAssert((_e) != nil, @"NULL out error")
#endif

#ifndef DD_ERR
#define DD_ERR(_c,_f,...) [NSError errorWithDomain:DDMathParserErrorDomain code:(_c) userInfo:@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:(_f), ##__VA_ARGS__]}]
#endif

#define DDMathParserDeprecated(_r) __attribute__((deprecated(_r)))

Correct conditional on DD_ERR macro

Correct conditional on DD_ERR macro


/*
 * cabs() wrapper for hypot().
 *
 * Written by J.T. Conklin, <jtc@wimsey.com>
 * Placed into the Public Domain, 1994.
 *
 * Modified by Steven G. Kargl for the long double type.
 */

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

#include <complex.h>
#include <math.h>

long double
cabsl(long double complex z)
{
	return hypotl(creall(z), cimagl(z));
}

Implement cabsl() in terms of hypotl().

Implement cabsl() in terms of hypotl().

Submitted by:	Steve Kargl <sgk@troutmask.apl.washington.edu>


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

static void run(unsigned __int128 x)
{
    unsigned __int128 y = x;

    for (int shift = 0; shift < 128; ++shift) {
        metallic_assert(x >> shift == y);
        y >>= 1;
    }
}

int main(void)
{
    for (unsigned __int128 x = 1; x; x *= 2)
        run(x);

    for (unsigned __int128 x = 1; x >> 104 != 0x313370; x *= 3)
        run(x);
}

Test unsigned __int128 right shift

Test unsigned __int128 right shift


#ifndef _CONDOR_SYSCALLS_H
#define _CONDOR_SYSCALLS_H

#if defined( AIX32)
#	include "syscall.aix32.h"
#else
#	include <syscall.h>
#endif

typedef int BOOL;

static const int 	SYS_LOCAL = 1;
static const int 	SYS_REMOTE = 0;
static const int	SYS_RECORDED = 2;
static const int	SYS_MAPPED = 2;

static const int	SYS_UNRECORDED = 0;
static const int	SYS_UNMAPPED = 0;

#if defined(__cplusplus)
extern "C" {
#endif

int SetSyscalls( int mode );
BOOL LocalSysCalls();
BOOL RemoteSysCalls();
BOOL MappingFileDescriptors();
int REMOTE_syscall( int syscall_num, ... );

#if 0
#if defined(AIX32) && defined(__cplusplus)
	int syscall( ... );
#elif defined(ULTRIX42) && defined(__cplusplus)
	int syscall( ... );
#else
	int syscall( int, ... );
#endif
#endif

#if defined(OSF1)
	int syscall( int, ... );
#endif

#if defined(__cplusplus)
}
#endif

#endif

#ifndef _CONDOR_SYSCALLS_H
#define _CONDOR_SYSCALLS_H

#if defined( AIX32)
#	include "syscall.aix32.h"
#else
#	include <syscall.h>
#endif

typedef int BOOL;

static const int 	SYS_LOCAL = 1;
static const int 	SYS_REMOTE = 0;
static const int	SYS_RECORDED = 2;
static const int	SYS_MAPPED = 2;

static const int	SYS_UNRECORDED = 0;
static const int	SYS_UNMAPPED = 0;

#if defined(__cplusplus)
extern "C" {
#endif

int SetSyscalls( int mode );
BOOL LocalSysCalls();
BOOL RemoteSysCalls();
BOOL MappingFileDescriptors();
int REMOTE_syscall( int syscall_num, ... );

#if defined(OSF1) || defined(HPUX9)
	int syscall( int, ... );
#endif

#if defined(__cplusplus)
}
#endif

#endif

Set up syscall() prototype for HP-UX 9 machines.


/*
 * This file is part of the SDWebImage package.
 * (c) Olivier Poitrey <rs@dailymotion.com>
 * (c) Fabrice Aneche
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

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

typedef NS_ENUM(NSInteger, SDImageFormat) {
    SDImageFormatUndefined = -1,
    SDImageFormatJPEG = 0,
    SDImageFormatPNG,
    SDImageFormatGIF,
    SDImageFormatTIFF,
    SDImageFormatWebP,
    SDImageFormatHEIC
};

@interface NSData (ImageContentType)

/**
 *  Return image format
 *
 *  @param data the input image data
 *
 *  @return the image format as `SDImageFormat` (enum)
 */
+ (SDImageFormat)sd_imageFormatForImageData:(nullable NSData *)data;

/**
 Convert SDImageFormat to UTType

 @param format Format as SDImageFormat
 @return The UTType as CFStringRef
 */
+ (nonnull CFStringRef)sd_UTTypeFromSDImageFormat:(SDImageFormat)format;

@end

/*
 * This file is part of the SDWebImage package.
 * (c) Olivier Poitrey <rs@dailymotion.com>
 * (c) Fabrice Aneche
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

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

typedef NS_ENUM(NSInteger, SDImageFormat) {
    SDImageFormatUndefined = -1,
    SDImageFormatJPEG = 0,
    SDImageFormatPNG,
    SDImageFormatGIF,
    SDImageFormatTIFF,
    SDImageFormatWebP,
    SDImageFormatHEIC
};

@interface NSData (ImageContentType)

/**
 *  Return image format
 *
 *  @param data the input image data
 *
 *  @return the image format as `SDImageFormat` (enum)
 */
+ (SDImageFormat)sd_imageFormatForImageData:(nullable NSData *)data;

/**
 Convert SDImageFormat to UTType

 @param format Format as SDImageFormat
 @return The UTType as CFStringRef
 */
+ (nonnull CFStringRef)sd_UTTypeFromSDImageFormat:(SDImageFormat)format CF_RETURNS_NOT_RETAINED;

@end

Mark one function which return value should follow the GET rule


/******************************************************************************
 * Copyright (c) 2020 IBM Corporation
 * All rights reserved.
 * This program and the accompanying materials
 * are made available under the terms of the BSD License
 * which accompanies this distribution, and is available at
 * http://www.opensource.org/licenses/bsd-license.php
 *
 * Contributors:
 *     IBM Corporation - initial implementation
 *****************************************************************************/

#ifndef _SLOF_OF_H
#define _SLOF_OF_H

/* from OF.lds */
extern long _slof_text;
extern long _slof_text_end;

#endif

Make linker script variables accessible

slof: Make linker script variables accessible

Make linker script variables related to 'text' addresses available
to the code so we can measure the static core root of trust contents.

When hashing the 'data' part of SLOF we do not end up with the same
measurements for the same firmware when booting with different
configurations, so we don't make those available.

Signed-off-by: Stefan Berger <5c96973112e540fb909b13997fcd087e5bfbee96@linux.ibm.com>
Signed-off-by: Alexey Kardashevskiy <ac1fc56530d7d037e1ea666f130daca22d72f964@ozlabs.ru>


#define noargs() 1
# define onearg(foo) foo
 # define  twoargs( x , y ) x y
	#	define	threeargs(	a	,	b	,	c	) a b c
noargs ( )
 onearg ( 2 )
	twoargs ( 3 , 4 )
threeargs ( 5 , 6 , 7 )

Add test with extra whitespace in macro defintions and invocations.

This whitespace is not dealt with in an elegant way yet so this test
does not pass currently.


/* Area:		ffi_call
   Purpose:		Test passing pointers in variable argument lists.
   Limitations:	none.
   PR:			none.
   Originator:	        www.frida.re */

/* { dg-do run } */

#include "ffitest.h"
#include <stdarg.h>

typedef void * T;

static T
test_fn (T a, T b, ...)
{
  va_list ap;
  T c;

  va_start (ap, b);
  c = va_arg (ap, T);
  printf ("%p %p %p\n", a, b, c);
  va_end (ap);

  return a + 1;
}

int
main (void)
{
  ffi_cif cif;
  ffi_type* arg_types[3];
  T a, b, c;
  T args[3];
  ffi_arg res;

  arg_types[0] = &ffi_type_pointer;
  arg_types[1] = &ffi_type_pointer;
  arg_types[2] = &ffi_type_pointer;

  CHECK(ffi_prep_cif_var (&cif, FFI_DEFAULT_ABI, 2, 3, &ffi_type_pointer, arg_types) == FFI_OK);

  a = (T)0x11223344;
  b = (T)0x55667788;
  c = (T)0xAABBCCDD;
  args[0] = &a;
  args[1] = &b;
  args[2] = &c;

  ffi_call (&cif, FFI_FN (test_fn), &res, args);
  /* { dg-output "0x11223344 0x55667788 0xAABBCCDD" } */
  printf("res: %p\n", (T)res);
  /* { dg-output "\nres: 0x11223345" } */

  return 0;
}

Add test for variadic invocation with pointers


/*
	OpenLieroX

	physic simulation interface

	code under LGPL
	created on 9/2/2008
*/

#ifndef __PHYSICSLX56_H__
#define __PHYSICSLX56_H__

#include "Physics.h"

PhysicsEngine* CreatePhysicsEngineLX56();

#define	LX56PhysicsFixedFPS	100
#define	LX56PhysicsDT	TimeDiff(1000 / LX56PhysicsFixedFPS)

#endif

/*
	OpenLieroX

	physic simulation interface

	code under LGPL
	created on 9/2/2008
*/

#ifndef __PHYSICSLX56_H__
#define __PHYSICSLX56_H__

#include "Physics.h"

PhysicsEngine* CreatePhysicsEngineLX56();

#define	LX56PhysicsFixedFPS	84
#define	LX56PhysicsDT	TimeDiff(1000 / LX56PhysicsFixedFPS)

#endif

Put physics FPS to 84 - that's the common value in LX .56. So far it seems it behaves exactly like old LX, needs still testing though.

git-svn-id: 0634bf30b6d7a21f2003d4a9f34c102a3ffa6fda@4471 34602234-ff1f-0410-a465-ea8f3b77ab7f


/*************************************************
* SHA1PRNG RNG Header File                       *
* (C) 2007 FlexSecure GmbH / Manuel Hartl        *
* (C) 2008 Jack Lloyd                            *
*************************************************/

#ifndef BOTAN_SHA1PRNG_H__
#define BOTAN_SHA1PRNG_H__

#include <botan/rng.h>
#include <botan/base.h>

namespace Botan {

/*************************************************
* SHA1PRNG                                       *
*************************************************/
class SHA1PRNG : public RandomNumberGenerator
   {
   public:
      void randomize(byte[], u32bit) throw(PRNG_Unseeded);
      bool is_seeded() const;
      void clear() throw();
      std::string name() const;

      SHA1PRNG(RandomNumberGenerator* = 0);
      ~SHA1PRNG();
   private:
      void add_randomness(const byte[], u32bit);
      void update_state(byte[]);

      RandomNumberGenerator* prng;
      HashFunction* hash;
      SecureVector<byte> buffer;
      SecureVector<byte> state;
      int buf_pos;
   };

}

#endif

/*************************************************
* SHA1PRNG RNG Header File                       *
* (C) 2007 FlexSecure GmbH / Manuel Hartl        *
* (C) 2008 Jack Lloyd                            *
*************************************************/

#ifndef BOTAN_SHA1PRNG_H__
#define BOTAN_SHA1PRNG_H__

#include <botan/rng.h>
#include <botan/base.h>

namespace Botan {

/*************************************************
* SHA1PRNG                                       *
*************************************************/
class BOTAN_DLL SHA1PRNG : public RandomNumberGenerator
   {
   public:
      void randomize(byte[], u32bit) throw(PRNG_Unseeded);
      bool is_seeded() const;
      void clear() throw();
      std::string name() const;

      SHA1PRNG(RandomNumberGenerator* = 0);
      ~SHA1PRNG();
   private:
      void add_randomness(const byte[], u32bit);
      void update_state(byte[]);

      RandomNumberGenerator* prng;
      HashFunction* hash;
      SecureVector<byte> buffer;
      SecureVector<byte> state;
      int buf_pos;
   };

}

#endif

Add missing BOTAN_DLL decl to SHA1PRNG class declaration


//
//  OpenPGPPublicKey.h
//  ObjectivePGP
//
//  Created by Marcin Krzyzanowski on 04/05/14.
//  Copyright (c) 2014 Marcin Krzyżanowski. All rights reserved.
//
//  Tag 6

#import <Foundation/Foundation.h>
#import "PGPTypes.h"
#import "PGPPacketFactory.h"
#import "PGPKeyID.h"
#import "PGPFingerprint.h"

@class PGPMPI;

@interface PGPPublicKeyPacket : PGPPacket <NSCopying>

@property (assign, readonly) UInt8 version;
@property (assign, readonly) NSDate *createDate;
@property (assign, readonly) UInt16 V3validityPeriod; // obsolete
@property (assign, readonly) PGPPublicKeyAlgorithm publicKeyAlgorithm;
@property (strong, readwrite) NSArray *publicMPIArray;

@property (assign, readonly) NSUInteger keySize;

@property (strong, nonatomic, readonly) PGPFingerprint *fingerprint;
@property (strong, nonatomic, readonly) PGPKeyID *keyID;

- (NSData *) exportPacket:(NSError *__autoreleasing*)error;
- (NSData *) exportPublicPacketOldStyle;

- (NSData *) buildPublicKeyBodyData:(BOOL)forceV4;

- (PGPMPI *) publicMPI:(NSString *)identifier;
- (NSData *) encryptData:(NSData *)data withPublicKeyAlgorithm:(PGPPublicKeyAlgorithm)publicKeyAlgorithm;

@end

//
//  OpenPGPPublicKey.h
//  ObjectivePGP
//
//  Created by Marcin Krzyzanowski on 04/05/14.
//  Copyright (c) 2014 Marcin Krzyżanowski. All rights reserved.
//
//  Tag 6

#import <Foundation/Foundation.h>
#import "PGPTypes.h"
#import "PGPPacketFactory.h"
#import "PGPKeyID.h"
#import "PGPFingerprint.h"

@class PGPMPI;

@interface PGPPublicKeyPacket : PGPPacket <NSCopying>

@property (assign, readonly) UInt8 version;
@property (strong, readonly) NSDate* createDate;
@property (assign, readonly) UInt16 V3validityPeriod; // obsolete
@property (assign, readonly) PGPPublicKeyAlgorithm publicKeyAlgorithm;
@property (strong, readwrite) NSArray* publicMPIArray;

@property (assign, readonly) NSUInteger keySize;

@property (strong, nonatomic, readonly) PGPFingerprint* fingerprint;
@property (strong, nonatomic, readonly) PGPKeyID* keyID;

- (NSData*)exportPacket:(NSError* __autoreleasing*)error;
- (NSData*)exportPublicPacketOldStyle;

- (NSData*)buildPublicKeyBodyData:(BOOL)forceV4;

- (PGPMPI*)publicMPI:(NSString*)identifier;
- (NSData*)encryptData:(NSData*)data withPublicKeyAlgorithm:(PGPPublicKeyAlgorithm)publicKeyAlgorithm;

@end

Fix NSDate property management attribute assign->strong


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

#define QLA4XXX_DRIVER_VERSION	"5.02.00-k7"

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

#define QLA4XXX_DRIVER_VERSION	"5.02.00-k8"

Update driver version to 5.02.00-k8

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

Signed-off-by: Vikas Chaudhary <c251871a64d7d31888eace0406cb3d4c419d5f73@qlogic.com>
Reviewed-by: Mike Christie <6fe105eefab41990d7ec714c6c25ade3095cdb48@cs.wisc.edu>
Signed-off-by: James Bottomley <1acebbdca565c7b6b638bdc23b58b5610d1a56b8@Parallels.com>


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

#define QLA4XXX_DRIVER_VERSION	"5.04.00-k1"

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

#define QLA4XXX_DRIVER_VERSION	"5.04.00-k2"

Update driver version to 5.04.00-k2

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

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


#ifndef _LA_LOG_H
#define _LA_LOG_H

#include <stdarg.h>
#include <stdint.h>
#include <stdio.h>
#ifndef _WIN32
#include <syslog.h>
#else
#define LOG_INFO 1
#define LOG_ERR 2
#define LOG_CRIT 3
#endif
#include <time.h>

void la_log_syslog_open();
void la_log(int priority, const char *format, ...);
void la_log_unsuppress();

class LALog {
public:
    LALog() :
        _time_period_start(time(NULL))
    { }
    void syslog_open();

    void log(int priority, const char *format, ...);
    void log_ap(int priority, const char *format, va_list ap);

    void unsupress();
    bool should_suppress();
    bool suppressing() {return _suppressing; }

private:
    // really rough rate limiting for log messages.  We could keep a
    // hash here of formats and selectively supress based on format.
    bool _suppressing = false;
    const uint8_t _time_period = 5; // seconds
    const uint8_t _max_messages_per_time_period = 10;
    uint32_t _suppressed_message_count = 0;
    uint8_t _message_count_this_time_period = 0;
    time_t _time_period_start;

    bool use_syslog = false;
};

#endif

#ifndef _LA_LOG_H
#define _LA_LOG_H

#include <stdarg.h>
#include <stdint.h>
#include <stdio.h>
#ifndef _WIN32
#include <syslog.h>
#else
#define LOG_DEBUG 0
#define LOG_INFO 1
#define LOG_ERR 2
#define LOG_CRIT 3
#endif
#include <time.h>

void la_log_syslog_open();
void la_log(int priority, const char *format, ...);
void la_log_unsuppress();

class LALog {
public:
    LALog() :
        _time_period_start(time(NULL))
    { }
    void syslog_open();

    void log(int priority, const char *format, ...);
    void log_ap(int priority, const char *format, va_list ap);

    void unsupress();
    bool should_suppress();
    bool suppressing() {return _suppressing; }

private:
    // really rough rate limiting for log messages.  We could keep a
    // hash here of formats and selectively supress based on format.
    bool _suppressing = false;
    const uint8_t _time_period = 5; // seconds
    const uint8_t _max_messages_per_time_period = 10;
    uint32_t _suppressed_message_count = 0;
    uint8_t _message_count_this_time_period = 0;
    time_t _time_period_start;

    bool use_syslog = false;
};

#endif

Fix obvious issue which probably broke build on windows.


/*
 * This file is part of the FreeStreamer project,
 * (C)Copyright 2011-2015 Matias Muhonen <mmu@iki.fi>
 * See the file ''LICENSE'' for using the code.
 *
 * https://github.com/muhku/FreeStreamer
 */

#include "FSFrequencyDomainAnalyzer.h"

#define kFSFrequencyPlotViewMaxCount 64

@interface FSFrequencyPlotView : UIView <FSFrequencyDomainAnalyzerDelegate> {
    float _levels[kFSFrequencyPlotViewMaxCount];
    NSUInteger _count;
    BOOL _drawing;
}

- (void)frequenceAnalyzer:(FSFrequencyDomainAnalyzer *)analyzer levelsAvailable:(float *)levels count:(NSUInteger)count;
- (void)reset;

@end

/*
 * This file is part of the FreeStreamer project,
 * (C)Copyright 2011-2015 Matias Muhonen <mmu@iki.fi>
 * See the file ''LICENSE'' for using the code.
 *
 * https://github.com/muhku/FreeStreamer
 */

#import <UIKit/UIKit.h>

#include "FSFrequencyDomainAnalyzer.h"

#define kFSFrequencyPlotViewMaxCount 64

@interface FSFrequencyPlotView : UIView <FSFrequencyDomainAnalyzerDelegate> {
    float _levels[kFSFrequencyPlotViewMaxCount];
    NSUInteger _count;
    BOOL _drawing;
}

- (void)frequenceAnalyzer:(FSFrequencyDomainAnalyzer *)analyzer levelsAvailable:(float *)levels count:(NSUInteger)count;
- (void)reset;

@end

Add a missing UIKit import.

Add a missing UIKit import.


#include "logger.h"

#include <stdio.h>
#include <errno.h>

#include <libpp/map-lists.h>
#include <libpp/separators.h>
#include <libtypes/types.h>

Logger
logger__new_( Logger options )
{
    if ( options.log == NULL ) {
        options.log = logger__default_log;
    }
    return options;
}

int
logger__default_log( Logger const logger,
                     LogLevel const level,
                     char const * const format,
                     va_list var_args )
{
    if ( format == NULL ) {
        return EINVAL;
    } else if ( level.severity < logger.min_severity ) {
        return 0;
    }
    char const * const logger_name = logger.s;
    if ( ( logger_name != NULL && fprintf( stderr, "%s: ", logger_name ) < 0 )
      || ( level.name != NULL && fprintf( stderr, "%s: ", level.name ) < 0 )
      || vfprintf( stderr, format, var_args ) < 0
      || fprintf( stderr, "\n" ) < 0 ) {
        return EIO;
    }
    return 0;
}

#define DEF_FUNC( L, U ) \
    LOG_FUNC_DEF( L, log_level_##L )
PP_MAP_LISTS( DEF_FUNC, PP_SEP_NONE, LOG_LEVELS )
#undef DEF_FUNC

#include "logger.h"

#include <stdio.h>
#include <errno.h>

#include <libpp/map-lists.h>
#include <libpp/separators.h>
#include <libtypes/types.h>

Logger
logger__new_( Logger options )
{
    if ( options.log == NULL ) {
        options.log = logger__default_log;
    }
    return options;
}

int
logger__default_log( Logger const logger,
                     LogLevel const level,
                     char const * const format,
                     va_list var_args )
{
    if ( format == NULL ) {
        return EINVAL;
    } else if ( level.severity < logger.min_severity ) {
        return 0;
    }
    char const * const logger_name = logger.c;
    if ( ( logger_name != NULL && fprintf( stderr, "%s: ", logger_name ) < 0 )
      || ( level.name != NULL && fprintf( stderr, "%s: ", level.name ) < 0 )
      || vfprintf( stderr, format, var_args ) < 0
      || fprintf( stderr, "\n" ) < 0 ) {
        return EIO;
    }
    return 0;
}

#define DEF_FUNC( L, U ) \
    LOG_FUNC_DEF( L, log_level_##L )
PP_MAP_LISTS( DEF_FUNC, PP_SEP_NONE, LOG_LEVELS )
#undef DEF_FUNC

Fix member access issue stopping compile


/* j/3/xeb.c
**
*/
#include "all.h"

/* functions
*/
  u3_noun
  u3qc_xeb(u3_atom a)
  {
    mpz_t a_mp;

    if ( __(u3a_is_dog(a)) ) {
      u3r_mp(a_mp, a);
      size_t log = mpz_sizeinbase(a_mp, 2);
      mpz_t b_mp;
      mpz_init_set_ui(b_mp, log);
      return u3i_mp(b_mp);
    }
    else {
      mpz_init_set_ui(a_mp, a);
      c3_d x = mpz_sizeinbase(a_mp, 2);
      mpz_t b_mp;
      mpz_init_set_ui(b_mp, x);
      return u3i_mp(b_mp);
    }
  }
  u3_noun
  u3wc_xeb(
                  u3_noun cor)
  {
    u3_noun a;

    if ( (u3_none == (a = u3r_at(u3x_sam, cor))) ||
         (c3n == u3ud(a)) )
    {
      return u3m_bail(c3__exit);
    } else {
      return u3qc_xeb(a);
    }
  }

/* j/3/xeb.c
**
*/
#include "all.h"

/* functions
*/
  u3_noun
  u3qc_xeb(u3_atom a)
  {
    mpz_t a_mp;

    if ( __(u3a_is_dog(a)) ) {
      u3r_mp(a_mp, a);
      c3_d x = mpz_sizeinbase(a_mp, 2);
      mpz_t b_mp;
      mpz_init_set_ui(b_mp, x);
      return u3i_mp(b_mp);
    }
    else {
      mpz_init_set_ui(a_mp, a);
      c3_d x = mpz_sizeinbase(a_mp, 2);
      mpz_t b_mp;
      mpz_init_set_ui(b_mp, x);
      return u3i_mp(b_mp);
    }
  }
  u3_noun
  u3wc_xeb(
                  u3_noun cor)
  {
    u3_noun a;

    if ( (u3_none == (a = u3r_at(u3x_sam, cor))) ||
         (c3n == u3ud(a)) )
    {
      return u3m_bail(c3__exit);
    } else {
      return u3qc_xeb(a);
    }
  }

Use urbit types instead of size_t

Use urbit types instead of size_t


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

#ifndef __LIBVIRT_UTILS_H__
# define __LIBVIRT_UTILS_H__

# define STREQ(a,b) (strcmp(a,b) == 0)

#endif /* __LIBVIRT_UTILS_H__ */

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

#ifndef __LIBVIRT_UTILS_H__
# define __LIBVIRT_UTILS_H__

# define STREQ(a,b) (strcmp(a,b) == 0)

# ifndef MIN
#  define MIN(a,b) (((a) < (b)) ? (a) : (b))
# endif

#endif /* __LIBVIRT_UTILS_H__ */

Add decl of MIN macro

Add decl of MIN macro

Signed-off-by: Daniel P. Berrange <bb938cf255e055ff3507f2627d214e8e62118fcf@redhat.com>


// RUN: %llvmgcc -S %s -o - /dev/null
// XFAIL: *

#define ATTR_BITS(N) __attribute__((bitwidth(N)))

typedef int ATTR_BITS( 4) My04BitInt;
typedef int ATTR_BITS(16) My16BitInt;
typedef int ATTR_BITS(17) My17BitInt;
typedef int ATTR_BITS(37) My37BitInt;
typedef int ATTR_BITS(65) My65BitInt;

struct MyStruct {
  My04BitInt i4Field;
  short ATTR_BITS(12) i12Field;
  long ATTR_BITS(17) i17Field;
  My37BitInt i37Field;
};

My37BitInt doit( short ATTR_BITS(23) num) {
  My17BitInt i;
  struct MyStruct strct;
  int bitsize1 = sizeof(My17BitInt);
  int __attribute__((bitwidth(9))) j;
  int bitsize2 = sizeof(j);
  int result = bitsize1 + bitsize2;
  strct.i17Field = result;
  result += sizeof(struct MyStruct);
  return result;
}

int
main ( int argc, char** argv)
{
  return (int ATTR_BITS(32)) doit((short ATTR_BITS(23))argc);
}

Add a test case for bit accurate integer types in llvm-gcc. This is
XFAILed for now until llvm-gcc changes are committed.

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


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

#pragma once

#include <concepts>

namespace sus::ops {

// Type `A` and `B` are `Eq<A, B>` if an object of each type can be compared for
// equality with the `==` operator.
//
// TODO: How do we do PartialEq? Can we even? Can we require Ord to be Eq? But
// then it depends on ::num?
template <class Lhs, class Rhs>
concept Eq = requires(const Lhs& lhs, const Rhs& rhs) {
               { lhs == rhs } -> std::same_as<bool>;
               { rhs == lhs } -> std::same_as<bool>;
             };

}  // namespace sus::ops

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

#pragma once

#include <concepts>

namespace sus::ops {

// Type `A` and `B` are `Eq<A, B>` if an object of each type can be compared for
// equality with the `==` operator.
//
// TODO: How do we do PartialEq? Can we even? Can we require Ord to be Eq? But
// then it depends on ::num?
template <class Lhs, class Rhs>
concept Eq = requires(const Lhs& lhs, const Rhs& rhs) {
               { lhs == rhs } -> std::same_as<bool>;
             };

}  // namespace sus::ops

Remove redundant == in Eq

Remove redundant == in Eq


/*
 * Copyright 2005 The Apache Software Foundation or its licensors,
 * as applicable.
 *
 *  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.
 *
 * $Id$
 */

#ifndef _ARCH_I386_DEFINITIONS_H_
#define _ARCH_I386_DEFINITIONS_H_

#if !defined(__i386__)
#error "This include file is for the i386 architecture only"
#endif

#define	_JC_PAGE_SHIFT		12		/* 4096 byte pages */

#define _JC_STACK_ALIGN		2

#define _JC_BIG_ENDIAN		0

#ifdef __CYGWIN__
#undef _JC_LIBRARY_FMT
#define _JC_LIBRARY_FMT		"cyg%s.dll"
#endif

#endif	/* _ARCH_I386_DEFINITIONS_H_ */

/*
 * Copyright 2005 The Apache Software Foundation or its licensors,
 * as applicable.
 *
 *  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.
 *
 * $Id$
 */

#ifndef _ARCH_I386_DEFINITIONS_H_
#define _ARCH_I386_DEFINITIONS_H_

#if !defined(__i386__)
#error "This include file is for the i386 architecture only"
#endif

#define	_JC_PAGE_SHIFT		12		/* 4096 byte pages */

#define _JC_STACK_ALIGN		2

#define _JC_BIG_ENDIAN		0

/* Fixes for Cygwin */
#ifdef __CYGWIN__
#undef _JC_LIBRARY_FMT
#define _JC_LIBRARY_FMT		"cyg%s.dll"
#define sched_get_priority_max(x)	(15)
#define sched_get_priority_min(x)	(1)
#endif

#endif	/* _ARCH_I386_DEFINITIONS_H_ */

Add Cygwin fixes for sched_get_priority_min() and sched_get_priority_max().

svn path=/incubator/harmony/enhanced/jchevm/; revision=379838


/* vim: set filetype=cpp: */

/** Header file for canonpy.
 *
 * Currently it merely contains the definition of the object structure of the
 * classes defined in canonpy.  They are put here in case a C API is intended
 * to be added for canonpy.
 */

#ifndef DRUDGE_CANONPY_H
#define DRUDGE_CANONPY_H

#include <Python.h>

#include <memory>

#include <libcanon/perm.h>
#include <libcanon/sims.h>

using libcanon::Simple_perm;
using libcanon::Sims_transv;

//
// Permutation type
// ----------------
//

/** Object type for canonpy Perm objects.
 */

// clang-format off
typedef struct {
    PyObject_HEAD
    Simple_perm perm;
} Perm_object;
// clang-format on

//
// Permutation group type
// ----------------------
//

// clang-format off
typedef struct {
    PyObject_HEAD
    std::unique_ptr<Sims_transv<Simple_perm>> transv;
} Group_object;
// clang-format on

#endif

/* vim: set filetype=cpp: */

/** Header file for canonpy.
 *
 * Currently it merely contains the definition of the object structure of the
 * classes defined in canonpy.  They are put here in case a C API is intended
 * to be added for canonpy.
 */

#ifndef DRUDGE_CANONPY_H
#define DRUDGE_CANONPY_H

#include <Python.h>

#include <memory>

#include <libcanon/perm.h>
#include <libcanon/sims.h>

using libcanon::Simple_perm;
using libcanon::Sims_transv;

//
// Permutation type
// ----------------
//

/** Object type for canonpy Perm objects.
 */

// clang-format off
typedef struct {
    PyObject_HEAD
    Simple_perm perm;
} Perm_object;
// clang-format on

//
// Permutation group type
// ----------------------
//

using Transv = Sims_transv<Simple_perm>;
using Transv_ptr = std::unique_ptr<Transv>;

// clang-format off
typedef struct {
    PyObject_HEAD
    Transv_ptr transv;
} Group_object;
// clang-format on

#endif

Add type aliases for Group

Add type aliases for Group

With these aliases, the code for permutation group manipulation can be
written more succinctly.


#ifndef APPJS_WINDOW_H
#define APPJS_WINDOW_H
#pragma once

#include "appjs.h"

// GTK+ binding for linux
#if defined(__LINUX__)

#include "linux/mainwindow.h"

// Mac files
#elif defined(__MAC__)

#include "mac/mainwindow.h"

// Windows necessary files
#elif defined(__WIN__)

#include "windows/mainwindow.h"

#endif

namespace appjs {

using namespace v8;

class Window : public node::ObjectWrap {

  DECLARE_NODE_OBJECT_FACTORY(Window);

  DEFINE_CPP_METHOD(OpenDevTools);
  DEFINE_CPP_METHOD(CloseDevTools);
  DEFINE_CPP_METHOD(Show);
  DEFINE_CPP_METHOD(Hide);
  DEFINE_CPP_METHOD(Destroy);
  DEFINE_CPP_METHOD(RunInBrowser);
  DEFINE_CPP_METHOD(SendSync);

  DEFINE_CPP_METHOD(SetMaximize);
  DEFINE_CPP_METHOD(SetMinimize);

};

} /* appjs */
#endif /* end of APPJS_WINDOW_H */

#ifndef APPJS_WINDOW_H
#define APPJS_WINDOW_H
#pragma once

#include "appjs.h"

// GTK+ binding for linux
#if defined(__LINUX__)

#include "linux/mainwindow.h"

// Mac files
#elif defined(__MAC__)

#include "mac/mainwindow.h"

// Windows necessary files
#elif defined(__WIN__)

#include "windows/mainwindow.h"

#endif

namespace appjs {

using namespace v8;

class Window : public node::ObjectWrap {

  DECLARE_NODE_OBJECT_FACTORY(Window);

  DEFINE_CPP_METHOD(OpenDevTools);
  DEFINE_CPP_METHOD(CloseDevTools);
  DEFINE_CPP_METHOD(Show);
  DEFINE_CPP_METHOD(Hide);
  DEFINE_CPP_METHOD(Destroy);
  DEFINE_CPP_METHOD(RunInBrowser);
  DEFINE_CPP_METHOD(SendSync);
  DEFINE_CPP_METHOD(SetMaximize);
  DEFINE_CPP_METHOD(SetMinimize);

  DEFINE_CPP_METHOD(SetMaximize);
  DEFINE_CPP_METHOD(SetMinimize);

};

} /* appjs */
#endif /* end of APPJS_WINDOW_H */

Add minimize and maximize function on Linux


/**
 * An efficient c++ simulation demo
 *
 * @author Skylar Kelty <skylarkelty@gmail.com>
 */

#pragma once

#include "src/common.h"

/**
 * A linked list
 */
template <typename T>
class LinkedList {
private:
	LLNode<T> *head;
	LLNode<T> *tail;

public:
	LinkedList();
	~LinkedList();

	void append(LLNode<T> *node);

	/**
	 * Get the first element of the list
	 */
	inline LLNode<T> *first() {
		return this->head;
	}

	/**
	 * Get the last element of the list
	 */
	inline LLNode<T> *last() {
		return this->tail;
	}

	/**
	 * Get the length of the list
	 */
	inline int length() {
		return this->head->length();
	}
};

/**
 * An efficient c++ simulation demo
 *
 * @author Skylar Kelty <skylarkelty@gmail.com>
 */

#pragma once

#include "src/common.h"

/**
 * A linked list
 */
template <typename T>
class LinkedList {
friend class Engine;

private:
	LLNode<T> *head;
	LLNode<T> *tail;

protected:
	void append(LLNode<T> *node);

public:
	LinkedList();
	~LinkedList();

	/**
	 * Get the first element of the list
	 */
	inline LLNode<T> *first() {
		return this->head;
	}

	/**
	 * Get the last element of the list
	 */
	inline LLNode<T> *last() {
		return this->tail;
	}

	/**
	 * Get the length of the list
	 */
	inline int length() {
		return this->head->length();
	}
};

Enforce actor addition through Engine

Enforce actor addition through Engine


/*
 * Copyright 2014, NICTA
 *
 * This software may be distributed and modified according to the terms of
 * the BSD 2-Clause license. Note that NO WARRANTY is provided.
 * See "LICENSE_BSD2.txt" for details.
 *
 * @TAG(NICTA_BSD)
 */
#ifndef _PLATSUPPORT_PIT_H
#define _PLATSUPPORT_PIT_H

#include <platsupport/timer.h>
#include <platsupport/io.h>

#define PIT_INTERRUPT       0

/*
 * Get the pit interface. This may only be called once.
 *
 * @param io_port_ops io port operations. This is all the pit requires.
 * @return initialised interface, NULL on error.
 */
pstimer_t * pit_get_timer(ps_io_port_ops_t *io_port_ops);

#endif /* _PLATSUPPORT_PIT_H */

/*
 * Copyright 2014, NICTA
 *
 * This software may be distributed and modified according to the terms of
 * the BSD 2-Clause license. Note that NO WARRANTY is provided.
 * See "LICENSE_BSD2.txt" for details.
 *
 * @TAG(NICTA_BSD)
 */
#ifndef _PLATSUPPORT_PIT_H
#define _PLATSUPPORT_PIT_H

#include <autoconf.h>
#include <platsupport/timer.h>
#include <platsupport/io.h>

#ifdef CONFIG_IRQ_PIC
#define PIT_INTERRUPT       0
#else
#define PIT_INTERRUPT       2
#endif

/*
 * Get the pit interface. This may only be called once.
 *
 * @param io_port_ops io port operations. This is all the pit requires.
 * @return initialised interface, NULL on error.
 */
pstimer_t * pit_get_timer(ps_io_port_ops_t *io_port_ops);

#endif /* _PLATSUPPORT_PIT_H */

libplatsupport: Define PIT interrupt more correctly if using the IOAPIC

The definition is not really correct as you cannot really talk about
interrupts by a single number. But this does provide the path of least
resistance for legacy code using the PIT when the IOAPIC is enabled


#include <stdlib.h>

int y;
int *g = &y;

int* arr[100];

void f(int *p) {
  g = p;
}

int main() {
  y = rand();
  /* y = 1; */
  /* y *= 10; */
  f(&arr[y]);
  y = y / 4;
  return 0;
}

#include <stdlib.h>

int y;
int *g = &y;

int arr[100];

void f(int *p) {
  g = p;
}

int main() {
  y = rand();
  /* y = 1; */
  /* y *= 10; */
  f(&arr[y]);
  y = y / 4;
  return 0;
}

Fix types in this test case

Fix types in this test case


#define _GNU_SOURCE
#include <cblas.h>
#include <lapacke.h>

int main(int argc, char **argv)
{
  int N = 3;
  double X[] = { 1, 2, 3 };
  int INCX = 1;
	double res = cblas_dnrm2(N, X, INCX);
  return 0;
}

conf-openblas: Fix alpine (cblas bug fixed in 0.3.16. cpu_set_t isn't defined unless _GNU_SOURCE is)


#include "scanner.h"

void scanner_init() {
	scanner_token_init();

	current_symbol = T_EOF;
	scanner_get_symbol();
}

void scanner_token_init() {
	T_EOF = -1;
}

void scanner_get_symbol() {

}

Add first (dummy) implementation of functions to make it compile


/** @file
    @brief Header declaring device callback types

    Must be c-safe!

    @date 2014

    @author
    Ryan Pavlik
    <ryan@sensics.com>
    <http://sensics.com>
*/

/*
// Copyright 2014 Sensics, Inc.
//
// All rights reserved.
//
// (Final version intended to be licensed under
// the Apache License, Version 2.0)
*/

#ifndef INCLUDED_DeviceCallbackTypesC_h_GUID_46F72CEE_3327_478F_2DED_ADAAF2EC783C
#define INCLUDED_DeviceCallbackTypesC_h_GUID_46F72CEE_3327_478F_2DED_ADAAF2EC783C

/* Internal Includes */
#include <ogvr/Util/ReturnCodesC.h>

/* Library/third-party includes */
/* none */

/* Standard includes */
/* none */

OGVR_EXTERN_C_BEGIN

/** @addtogroup PluginKit
    @{
*/
/** @brief Function type of a Sync Device Update callback */
typedef OGVR_ReturnCode (*OGVR_SyncDeviceUpdateCallback)(void *userData);

/** @brief Function type of an Async Device Wait callback */
typedef OGVR_ReturnCode (*OGVR_AsyncDeviceWaitCallback)(void *userData);
/** @} */

OGVR_EXTERN_C_END

#endif

/** @file
    @brief Header declaring device callback types

    Must be c-safe!

    @date 2014

    @author
    Ryan Pavlik
    <ryan@sensics.com>
    <http://sensics.com>
*/

/*
// Copyright 2014 Sensics, Inc.
//
// All rights reserved.
//
// (Final version intended to be licensed under
// the Apache License, Version 2.0)
*/

#ifndef INCLUDED_DeviceCallbackTypesC_h_GUID_46F72CEE_3327_478F_2DED_ADAAF2EC783C
#define INCLUDED_DeviceCallbackTypesC_h_GUID_46F72CEE_3327_478F_2DED_ADAAF2EC783C

/* Internal Includes */
#include <ogvr/Util/APIBaseC.h>
#include <ogvr/Util/ReturnCodesC.h>

/* Library/third-party includes */
/* none */

/* Standard includes */
/* none */

OGVR_EXTERN_C_BEGIN

/** @addtogroup PluginKit
    @{
*/
/** @brief Function type of a Sync Device Update callback */
typedef OGVR_ReturnCode (*OGVR_SyncDeviceUpdateCallback)(void *userData);

/** @brief Function type of an Async Device Wait callback */
typedef OGVR_ReturnCode (*OGVR_AsyncDeviceWaitCallback)(void *userData);
/** @} */

OGVR_EXTERN_C_END

#endif

Include a header we use.

Include a header we use.


//
//  NSData+YZLibrary.h
//  YZLibrary
//
//  Copyright (c) 2016 Yichi Zhang
//  https://github.com/yichizhang
//  zhang-yi-chi@hotmail.com
//
//  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.
//

#import <Foundation/Foundation.h>

@interface NSData (YZLibrary)

- (NSString *)yz_MD5String;

@end

//
//  NSData+YZLibrary.h
//  YZLibrary
//
//  Copyright (c) 2016 Yichi Zhang
//  https://github.com/yichizhang
//  zhang-yi-chi@hotmail.com
//
//  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.
//

#import <Foundation/Foundation.h>

@interface NSData (YZLibrary)

/**
 *  Returns the MD5 hash of data contained in the receiver.
 */
- (NSString *)yz_MD5String;

@end

Add comment to NSData's MD5 category method


/******************************************************************************

  This source file is part of the Avogadro project.

  Copyright 2013 Kitware, Inc.

  This source code is released under the New BSD License, (the "License").

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

#include "avogadrocore.h"

namespace Avogadro {
namespace Core {

/**
 * @class Mutex mutex.h <avogadro/core/mutex.h>
 * @brief The Mutex class provides a simple wrapper for the C++11 or Boost mutex
 * class
 * @author Marcus D. Hanwell
 *
 * A very simple, and thin wrapper around the C++11 (or Boost fallback) mutex
 * class, allowing for lock, tryLock and unlock.
 */

class AVOGADROCORE_EXPORT Mutex
{
public:
  Mutex();
  ~Mutex();

  /**
   * @brief Obtain an exclusive lock.
   */
  void lock();

  /**
   * @brief Attempt to obtain an exclusive lock.
   * @return True on success, false on failure.
   */
  bool tryLock();

  /**
   * @brief Unlocks the lock.
   */
  void unlock();

private:
  class PIMPL;
  PIMPL* d;
};
}
}

#endif // AVOGADRO_CORE_MUTEX_H

/******************************************************************************

  This source file is part of the Avogadro project.

  Copyright 2013 Kitware, Inc.

  This source code is released under the New BSD License, (the "License").

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

#include "avogadrocore.h"

namespace Avogadro {
namespace Core {

/**
 * @class Mutex mutex.h <avogadro/core/mutex.h>
 * @brief The Mutex class provides a simple wrapper for the C++11 mutex
 * class
 * @author Marcus D. Hanwell
 *
 * A very simple, and thin wrapper around the C++11 mutex class, allowing for
 * lock, tryLock and unlock.
 */

class AVOGADROCORE_EXPORT Mutex
{
public:
  Mutex();
  ~Mutex();

  /**
   * @brief Obtain an exclusive lock.
   */
  void lock();

  /**
   * @brief Attempt to obtain an exclusive lock.
   * @return True on success, false on failure.
   */
  bool tryLock();

  /**
   * @brief Unlocks the lock.
   */
  void unlock();

private:
  class PIMPL;
  PIMPL* d;
};
}
}

#endif // AVOGADRO_CORE_MUTEX_H

Update the documentation - no more Boost

This was missed when moving away from the Boost fallback - it is just a
simple wrapper for the C++11 class now.

Signed-off-by: Marcus D. Hanwell <cf7042e2e8eee958b5bcde1ae2cbefef82efc184@kitware.com>


#include <stdio.h>

int main()
{
  unsigned int bit_array = 0;
  unsigned int a = 1;
  unsigned int result;

  FILE *fr;
  FILE *fw;
  char row[10];

  fr = fopen("out/testdata", "r");
  if (!fr) {
    puts("read error");
    exit(1);
  }

  while(fgets(row, sizeof(row), fr) != NULL) {
    int x = atoi(row);
    bit_array = bit_array | (a << x);
  }

  fclose(fr);

  fw = fopen("out/output_bit_array_sort", "w");
  unsigned i;
  for (i = 0; i < 1000000; i++) {
    if(fprintf(fw , "%07u\n", bit_array & i) < 0) {
      puts("write error");
      exit(1);
    }
  }

  fclose(fw);

  return 0;
}

Add sort of numerical sequence by bit array


#ifndef HunspellContext_H
#define HunspellContext_H

#include <hunspell.hxx>
#include <napi.h>
#include <mutex>
#include <shared_mutex>

class HunspellContext {
 public:
  Hunspell* instance;

  HunspellContext(Hunspell* instance): instance(instance) {};

  ~HunspellContext() {
      if (instance) {
        delete instance;
        instance = NULL;
      }
  }

  void lockRead() {
    rwLock.lock_shared();
  }

  void unlockRead() {
    rwLock.unlock_shared();
  }

  void lockWrite() {
    rwLock.lock();
  }

  void unlockWrite() {
    rwLock.unlock();
  }

 private:
  /*
   * The Hunspell instance is not thread safe, so we use a mutex
   * to manage asynchronous usage.
   */
  std::shared_mutex rwLock;
};

#endif

#ifndef HunspellContext_H
#define HunspellContext_H

#include <hunspell.hxx>
#include <napi.h>
#include <mutex>
#include <shared_mutex>
#include <uv.h>

class HunspellContext {
 public:
  Hunspell* instance;

  HunspellContext(Hunspell* instance): instance(instance) {
    uv_rwlock_init(&rwLock);
  };

  ~HunspellContext() {
      if (instance) {
        delete instance;
        instance = NULL;
      }

      uv_rwlock_destroy(&rwLock);
  }

  void lockRead() {
    uv_rwlock_rdlock(&rwLock);
  }

  void unlockRead() {
    uv_rwlock_rdunlock(&rwLock);
  }

  void lockWrite() {
    uv_rwlock_wrlock(&rwLock);
  }

  void unlockWrite() {
    uv_rwlock_wrunlock(&rwLock);
  }

 private:
  /*
   * The Hunspell instance is not thread safe, so we use a mutex
   * to manage asynchronous usage.
   */
  uv_rwlock_t rwLock;
};

#endif

Switch from std::shared_mutex to libuv's uv_rwlock


#ifndef SRC_NODE_H_

#define SRC_NODE_H_

#include <boost/serialization/serialization.hpp>
#include <boost/serialization/access.hpp>
#include <boost/serialization/nvp.hpp>
#include <memory>
#include "./graphics/render_data.h"
#include "./math/obb.h"
#include "./graphics/gl.h"

/**
 * \brief Base class for nodes which are managed by the
 * Nodes class
 *
 * The only virtual method which must be implemented is
 * Node::render.
 */
class Node
{
 public:
  virtual ~Node()
  {
  }

  virtual void render(Graphics::Gl *gl, RenderData renderData) = 0;

  virtual std::shared_ptr<Math::Obb> getObb()
  {
    return std::shared_ptr<Math::Obb>();
  }

  bool isPersistable()
  {
    return persistable;
  }

 protected:
  Node()
  {
  }

  bool persistable = true;

 private:
  friend class boost::serialization::access;
  template <class Archive>
  void serialize(Archive &ar, unsigned int version) const
  {
  }
};

#endif  // SRC_NODE_H_

#ifndef SRC_NODE_H_

#define SRC_NODE_H_

#include <boost/serialization/serialization.hpp>
#include <boost/serialization/access.hpp>
#include <boost/serialization/nvp.hpp>
#include <memory>
#include "./graphics/render_data.h"
#include "./math/obb.h"
#include "./graphics/gl.h"
#include "./graphics/ha_buffer.h"

/**
 * \brief Base class for nodes which are managed by the
 * Nodes class
 *
 * The only virtual method which must be implemented is
 * Node::render.
 */
class Node
{
 public:
  virtual ~Node()
  {
  }

  virtual void render(Graphics::Gl *gl, RenderData renderData) = 0;

  void render(Graphics::Gl *gl, std::shared_ptr<Graphics::HABuffer> haBuffer,
              RenderData renderData)
  {
    this->haBuffer = haBuffer;
    render(gl, renderData);
  }

  virtual std::shared_ptr<Math::Obb> getObb()
  {
    return std::shared_ptr<Math::Obb>();
  }

  bool isPersistable()
  {
    return persistable;
  }

 protected:
  Node()
  {
  }

  bool persistable = true;
  std::shared_ptr<Graphics::HABuffer> haBuffer;

 private:
  friend class boost::serialization::access;
  template <class Archive>
  void serialize(Archive &ar, unsigned int version) const
  {
  }
};

#endif  // SRC_NODE_H_

Store haBuffer shared_ptr in Node.

Store haBuffer shared_ptr in Node.


/* Copyright (C) 2002 Timo Sirainen */

#include "common.h"
#include "commands.h"

int cmd_create(struct client *client)
{
	struct mail_storage *storage;
	const char *mailbox;
	int directory;
	size_t len;

	/* <mailbox> */
	if (!client_read_string_args(client, 1, &mailbox))
		return FALSE;

	storage = client_find_storage(client, &mailbox);
	if (storage == NULL)
		return TRUE;

	len = strlen(mailbox);
	if (mailbox[len-1] != mail_storage_get_hierarchy_sep(storage))
		directory = FALSE;
	else {
		/* name ends with hierarchy separator - client is just
		   informing us that it wants to create children under this
		   mailbox. */
                directory = TRUE;
		mailbox = t_strndup(mailbox, len-1);
	}

	if (!client_verify_mailbox_name(client, mailbox, FALSE, TRUE))
		return TRUE;

	if (mail_storage_mailbox_create(storage, mailbox, directory) < 0)
		client_send_storage_error(client, storage);
	else
		client_send_tagline(client, "OK Create completed.");
	return TRUE;
}

/* Copyright (C) 2002 Timo Sirainen */

#include "common.h"
#include "commands.h"

int cmd_create(struct client *client)
{
	struct mail_storage *storage;
	const char *mailbox, *full_mailbox;
	int directory;
	size_t len;

	/* <mailbox> */
	if (!client_read_string_args(client, 1, &mailbox))
		return FALSE;
	full_mailbox = mailbox;

	storage = client_find_storage(client, &mailbox);
	if (storage == NULL)
		return TRUE;

	len = strlen(mailbox);
	if (mailbox[len-1] != mail_storage_get_hierarchy_sep(storage))
		directory = FALSE;
	else {
		/* name ends with hierarchy separator - client is just
		   informing us that it wants to create children under this
		   mailbox. */
                directory = TRUE;
		mailbox = t_strndup(mailbox, len-1);
	}

	if (!client_verify_mailbox_name(client, full_mailbox, FALSE, TRUE))
		return TRUE;

	if (mail_storage_mailbox_create(storage, mailbox, directory) < 0)
		client_send_storage_error(client, storage);
	else
		client_send_tagline(client, "OK Create completed.");
	return TRUE;
}

CREATE was broken if namespace prefixes were set. Patch by Andreas Fuchs.


/* guiddatabase.h

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

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

#ifndef GUID_DATABASE_H
#define GUID_DATABASE_H

#include <map>
#include <string>

#include "basetypes.h"
#include "ustring.h"
#include "ffsparser.h"
#include "ffs.h"
#include "utility.h"

struct OperatorLessForGuids : public std::binary_function<EFI_GUID, EFI_GUID, bool>
{
    bool operator()(const EFI_GUID& lhs, const EFI_GUID& rhs) const
    {
        return (memcmp(&lhs, &rhs, sizeof(EFI_GUID)) < 0);
    }
};

typedef std::map<EFI_GUID, UString, OperatorLessForGuids> GuidDatabase;

UString guidDatabaseLookup(const EFI_GUID & guid);
void initGuidDatabase(const UString & path = "", UINT32* numEntries = NULL);
GuidDatabase guidDatabaseFromTreeRecursive(TreeModel * model, const UModelIndex index);
USTATUS guidDatabaseExportToFile(const UString & outPath, GuidDatabase & db);

#endif // GUID_DATABASE_H

/* guiddatabase.h

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

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

#ifndef GUID_DATABASE_H
#define GUID_DATABASE_H

#include <map>
#include <string>

#include "basetypes.h"
#include "ustring.h"
#include "ffsparser.h"
#include "ffs.h"
#include "utility.h"

struct OperatorLessForGuids
{
    bool operator()(const EFI_GUID& lhs, const EFI_GUID& rhs) const
    {
        return (memcmp(&lhs, &rhs, sizeof(EFI_GUID)) < 0);
    }
};

typedef std::map<EFI_GUID, UString, OperatorLessForGuids> GuidDatabase;

UString guidDatabaseLookup(const EFI_GUID & guid);
void initGuidDatabase(const UString & path = "", UINT32* numEntries = NULL);
GuidDatabase guidDatabaseFromTreeRecursive(TreeModel * model, const UModelIndex index);
USTATUS guidDatabaseExportToFile(const UString & outPath, GuidDatabase & db);

#endif // GUID_DATABASE_H

Fix CMAKE_CXX_STANDARD 17 build on Windows


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

/* daemons */

#define MATHD		(USR_DIR + "/Utility/sys/mathd")
#define SORTD		(USR_DIR + "/Utility/sys/sortd")
#define SUBD		(USR_DIR + "/Utility/sys/subd")

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

/* daemons */

#define SUBD		(USR_DIR + "/Utility/sys/subd")

Remove MATHD and SORTD macros

Remove MATHD and SORTD macros


/* vi: set sw=4 ts=4: */
/*
 * getgid() for uClibc
 *
 * Copyright (C) 2000-2006 Erik Andersen <andersen@uclibc.org>
 *
 * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
 */

#include "syscalls.h"
#include <unistd.h>

#if defined __NR_getxgid
# define __NR_getgid __NR_getxgid
#endif
_syscall0(gid_t, getgid);
libc_hidden_proto(getgid)
libc_hidden_def(getgid)

/* vi: set sw=4 ts=4: */
/*
 * getgid() for uClibc
 *
 * Copyright (C) 2000-2006 Erik Andersen <andersen@uclibc.org>
 *
 * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
 */

#include "syscalls.h"
#include <unistd.h>

#if defined __NR_getxgid
# define __NR_getgid __NR_getxgid
#endif
libc_hidden_proto(getgid)
_syscall0(gid_t, getgid);
libc_hidden_def(getgid)

Make gcc4 happy as well

Make gcc4 happy as well


#pragma once
#include "../main.h"

class Socket {
	public:
		virtual ~Socket() {}
		virtual unsigned int apiVersion() = 0;
		virtual void connect(const std::string& server, const std::string& port, const std::string& bindAddr = "") {}
		virtual std::string receive() { return ""; }
		virtual void send(const std::string& data) {}
		virtual void closeConnection() {}
		bool isConnected() { return connected; }
	protected:
		bool connected;
};

#pragma once
#include "../main.h"

class Socket {
	public:
		virtual ~Socket() {}
		virtual unsigned int apiVersion() = 0;
		virtual void connectServer(const std::string& server, const std::string& port, const std::string& bindAddr = "") {}
		virtual std::string receive() { return ""; }
		virtual void send(const std::string& data) {}
		virtual void closeConnection() {}
		bool isConnected() { return connected; }
	protected:
		bool connected;
};

Rename function to not be the same as another function that does the actual job


#ifndef PICTUS_ACTIONMAP_H
#define PICTUS_ACTIONMAP_H

#include <boost/function.hpp>
#include <map>

namespace App {
	template <typename _key, typename _param>
	class ActionMapParam {
	public:
		typedef boost::function<void(_param)> Function_Type;
		void AddAction(_key id, Function_Type f) {
			m_map[id] = f;
		}

		bool Execute(_key id, _param e) {
			auto i = m_map.find(id);
			if(i == m_map.end())
				return false;

			(i->second)(e);
			return true;
		}

	private:
		typedef std::map<_key, Function_Type> FunctionMap;
		FunctionMap m_map;
	};

	template <typename _key>
	class ActionMapNoParam {
	public:
		typedef boost::function<void()> Function_Type;
		void AddAction(_key id, Function_Type f) {
			m_map[id] = f;
		}

		bool Execute(_key id) {
			auto i = m_map.find(id);
			if(i == m_map.end())
				return false;

			(i->second)();
			return true;
		}

	private:
		typedef std::map<_key, Function_Type> FunctionMap;
		FunctionMap m_map;
	};
}

#endif

#ifndef PICTUS_ACTIONMAP_H
#define PICTUS_ACTIONMAP_H

#include <functional>
#include <map>

namespace App {
	template <typename _key, typename _param>
	class ActionMapParam {
	public:
		typedef typename std::function<void(_param)> Function_Type;
		void AddAction(_key id, Function_Type f) {
			m_map[id] = f;
		}

		bool Execute(_key id, _param e) {
			auto i = m_map.find(id);
			if(i == m_map.end())
				return false;

			(i->second)(e);
			return true;
		}

	private:
		typedef std::map<_key, Function_Type> FunctionMap;
		FunctionMap m_map;
	};

	template <typename _key>
	class ActionMapNoParam {
	public:
		typedef std::function<void()> Function_Type;
		void AddAction(_key id, Function_Type f) {
			m_map[id] = f;
		}

		bool Execute(_key id) {
			auto i = m_map.find(id);
			if(i == m_map.end())
				return false;

			(i->second)();
			return true;
		}

	private:
		typedef std::map<_key, Function_Type> FunctionMap;
		FunctionMap m_map;
	};
}

#endif

Use std::function instead of boost::function


#pragma once

#include "invocation_log.h"

namespace shk {

class DummyInvocationLog : public InvocationLog {
 public:
  void createdDirectory(const std::string &path) throw(IoError) {}

  void removedDirectory(const std::string &path) throw(IoError) {}

  void ranCommand(
      const Hash &build_step_hash,
      std::unordered_set<std::string> &&output_files,
      std::unordered_map<std::string, DependencyType> &&input_files)
          throw(IoError) {}

  void cleanedCommand(
      const Hash &build_step_hash) throw(IoError) {}
};

}  // namespace shk

#pragma once

#include "invocation_log.h"

namespace shk {

class DummyInvocationLog : public InvocationLog {
 public:
  void createdDirectory(const std::string &path)
      throw(IoError) override {}

  void removedDirectory(const std::string &path)
      throw(IoError) override {}

  void ranCommand(
      const Hash &build_step_hash,
      std::unordered_set<std::string> &&output_files,
      std::unordered_map<std::string, DependencyType> &&input_files)
          throw(IoError) override {}

  void cleanedCommand(
      const Hash &build_step_hash) throw(IoError) override {}
};

}  // namespace shk

Use override keyword on methods in DummyInvocationLog


/*
 * mjs copyright
 */

/*
 * Obtain memory configuration information from the BIOS
 *
 * Note that we don't try too hard here; knowing the size of
 * base memory and extended memory out to 16 or 64M is enough for
 * the requirements of the bootstrap.
 *
 * We also maintain a pointer to the top of physical memory
 * once called to allow rangechecking of load/copy requests.
 */
#include <stand.h>
#include "btxv86.h"

vm_offset_t	memtop;

/*
 * Return base memory size in kB.
 */
int
getbasemem(void)
{
    v86.ctl = 0;
    v86.addr = 0x1a;		/* int 0x12 */
    v86int();

    return(v86.eax & 0xffff);
}

/*
 * Return extended memory size in kB
 */
int
getextmem(void)
{
    int		extkb;

    v86.ctl = 0;
    v86.addr = 0x15;		/* int 0x12 function 0x88*/
    v86.eax = 0x8800;
    v86int();
    extkb = v86.eax & 0xffff;

    /* Set memtop to actual top or 16M, whicheve is less */
    memtop = min((0x100000 + (extkb * 1024)), (16 * 1024 * 1024));

    return(extkb);
}

/*
 * mjs copyright
 */

/*
 * Obtain memory configuration information from the BIOS
 *
 * Note that we don't try too hard here; knowing the size of
 * base memory and extended memory out to 16 or 64M is enough for
 * the requirements of the bootstrap.
 *
 * We also maintain a pointer to the top of physical memory
 * once called to allow rangechecking of load/copy requests.
 */
#include <stand.h>
#include "btxv86.h"

vm_offset_t	memtop;

/*
 * Return base memory size in kB.
 */
int
getbasemem(void)
{
    v86.ctl = 0;
    v86.addr = 0x12;		/* int 0x12 */
    v86int();

    return(v86.eax & 0xffff);
}

/*
 * Return extended memory size in kB
 */
int
getextmem(void)
{
    int		extkb;

    v86.ctl = 0;
    v86.addr = 0x15;		/* int 0x15 function 0x88*/
    v86.eax = 0x8800;
    v86int();
    extkb = v86.eax & 0xffff;

    /* Set memtop to actual top or 16M, whicheve is less */
    memtop = min((0x100000 + (extkb * 1024)), (16 * 1024 * 1024));

    return(extkb);
}

Fix typos.. The vector for "int 0x12" (get base mem) is not written in hex as "0x1a". :-) Fix a comment about the extended memory checks, that's int 0x15.


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

/*! \file casts.h
 *  \brief Unsafe casts for internal use.
 */

#pragma once

#include <thrust/iterator/iterator_traits.h>

namespace thrust
{

namespace detail
{

namespace dispatch
{

template<typename TrivialIterator>
  typename thrust::iterator_traits<TrivialIterator>::value_type *
    raw_pointer_cast(TrivialIterator i,
                     thrust::random_access_host_iterator_tag)
{
  typedef typename thrust::iterator_traits<TrivialIterator>::value_type * Pointer;

  // cast away constness
  return const_cast<Pointer>(&*i);
} // end raw_pointer_cast()

// this path will work for device_ptr & device_vector::iterator
template<typename TrivialIterator>
  typename thrust::iterator_traits<TrivialIterator>::value_type *
    raw_pointer_cast(TrivialIterator i,
                     thrust::random_access_device_iterator_tag)
{
  typedef typename thrust::iterator_traits<TrivialIterator>::value_type * Pointer;

  // cast away constness
  return const_cast<Pointer>((&*i).get());
} // end raw_pointer_cast()

} // end dispatch

template<typename TrivialIterator>
  typename thrust::iterator_traits<TrivialIterator>::value_type *raw_pointer_cast(TrivialIterator i)
{
  return detail::dispatch::raw_pointer_cast(i, thrust::iterator_traits<TrivialIterator>::iterator_category());
} // end raw_pointer_cast()

} // end detail

} // end thrust

Add git r done version of detail::raw_pointer_cast

--HG--
extra : convert_revision : svn%3A83215879-3e5a-4751-8c9d-778f44bb06a5/trunk%40150


/*******************************************************************
**
** Manage system call mode and do remote system calls.
**
*******************************************************************/

#define _POSIX_SOURCE
#include <stdio.h>
#include "condor_syscalls.h"

static int		SyscallMode;

int
SetSyscalls( int mode )
{
	int	answer;
	answer = SyscallMode;
	SyscallMode = mode;
	return answer;
}

BOOL
LocalSysCalls()
{
	return SyscallMode & SYS_LOCAL;
}

BOOL
RemoteSysCalls()
{
	return (SyscallMode & SYS_LOCAL) == 0;
}

BOOL
MappingFileDescriptors()
{
	return (SyscallMode & SYS_MAPPED);
}

int
REMOTE_syscall( int syscall_num, ... )
{
	fprintf(
		stderr,
		"Don't know how to do system call %d remotely - yet\n",
		syscall_num
	);
	abort();
	return -1;
}

#if defined(AIX32)	/* Just to test linking */
int syscall( int num, ... )
{
	return 0;
}
#endif

Add dummy "syscall()" routine for AIX so we can at least test compiling and linking.


#include <stdio.h>
#include <CUnit/CUnit.h>
#include <CUnit/Basic.h>
#include "hashtable/hashtable.h"
#include "dll/dll.h"

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

    CU_initialize_registry();

    test_hashtable_init();
    test_dll_init();

    CU_basic_set_mode(CU_BRM_VERBOSE);
    CU_basic_run_tests();

    unsigned int nr_of_fails = CU_get_number_of_tests_failed();
    nr_of_fails += CU_get_number_of_failures();

    CU_cleanup_registry();

    return nr_of_fails > 0 ? 1 : 0;
}

#include <stdio.h>
#include <CUnit/CUnit.h>
#include <CUnit/Basic.h>
#include "hashtable/hashtable.h"
#include "dll/dll.h"

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

    CU_initialize_registry();

    test_hashtable_init();
    test_dll_init();

    CU_basic_set_mode(CU_BRM_VERBOSE);
    CU_basic_run_tests();

    unsigned int nr_of_fails = CU_get_number_of_tests_failed();
    nr_of_fails += CU_get_number_of_failures();

    CU_cleanup_registry();

    if(nr_of_fails == 0) {
        printf("\n\x1b[1;37;42m\x1b[2K%s\n\x1b[0m\x1b[37;41m\x1b[0m\x1b[2K\n", "Success!");
    } else {
        printf("\n\x1b[1;37;41m\x1b[2K%s\n\x1b[0m\x1b[37;41m\x1b[2K\x1b[0m\x1b[2K\n", "FAILURES!");
    }

    return nr_of_fails > 0 ? 1 : 0;
}

Add success / error message

unittests: Add success / error message


#ifndef ELOG_THREAD_WIN32_H_
#define ELOG_THREAD_WIN32_H_

#include <functional>
#include <process.h>
#include <windows.h>
#include "util.h"

namespace LOG {

class ScopedThreadHandle : NonCopyable {
 public:
  explicit ScopedThreadHandle(HANDLE handle = NULL)
      : handle_(handle) {
  }

  ~ScopedThreadHandle() {
    Reset();
  }

  HANDLE Get() const {
    return handle_;
  }

  void Reset(HANDLE handle = NULL) {
    if (handle_) {
      CloseHandle(handle_);
    }
    handle_ = handle;
  }

 private:
  HANDLE handle_;
};

class Thread : NonCopyable {
 public:
  Thread() {
  }

  template <typename ThreadBody>
  explicit Thread(ThreadBody thread_body)
      : thread_body_(thread_body) {
  }

  ~Thread() {
  }

  template <typename ThreadBody>
  void set_thread_body(ThreadBody thread_body) {
    thread_body_ = thread_body;
  }

  void Run() {
    HANDLE handle = reinterpret_cast<HANDLE>(
            _beginthreadex(NULL, 0, StaticThreadBody, NULL, 0, NULL));
    thread_handle_.Reset(handle);
  }

  void Detach() {
    // do nothing
  }

  void Join() {
    HANDLE handle = thread_handle_.Get();
    if (handle) {
      WaitForSingleObject(handle, INFINITE);
    }
  }

 private:
  static int WINAPI StaticThreadBody(LPVOID self_ptr) {
    Thread& self = *reinterpret_cast<Thread*>(self_ptr);
    self.thread_body_();
    return NULL;
  }

  ScopedThreadHandle thread_handle_;
  std::tr1::function<void ()> thread_body_;
};

}  // namespace LOG

#endif  // ELOG_THREAD_WIN32_H_

Add Thread support on Win32 API

Add Thread support on Win32 API


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

char* Input(char *buffer){
    unsigned int size = 10;
    unsigned int len = 0;
    int ch;

    buffer = malloc(sizeof(char)*size);
    if(!buffer){
        printf("Error allocating memory");
        return buffer;
    }
    while((ch = fgetc(stdin)) != EOF && ch != '\n'){
        buffer[len] = ch;
        if(len == size-1){
            size = size << 4;
            buffer = realloc(buffer,sizeof(char)*size);
            if(!buffer){
                printf("Error reallocating memory");
                return buffer;
            }
        }
        len++;
    }
    buffer[len] = '\0';
    buffer = realloc(buffer,sizeof(buffer));
    return buffer;
}

Fix OOB indexing, buffer check, realloc size


/**
 * rvalue_wrapper.h
 */
#ifndef UTIL_RVALUE_WRAPPER_H_
#define UTIL_RVALUE_WRAPPER_H_

/**
 * A wrapper for holding and passing rvalues through std::bind. The rvalue wrapped will be stored
 * inside the wrapper until the functor returned by std::bind is invoked, at when the stored rvalue
 * will be moved from. The functor can be invoked ONLY ONCE.
 */
template<typename T>
struct RValueWrapper {
public:
    template<typename = typename std::enable_if<std::is_rvalue_reference<T&&>::value>::type>
    explicit RValueWrapper(T &&t) noexcept :
    t(std::move(t)) {
    }
    RValueWrapper(const RValueWrapper &rhs) = default;
    RValueWrapper(RValueWrapper &&rhs) = default;
    RValueWrapper& operator=(const RValueWrapper &rhs) = default;
    RValueWrapper& operator=(RValueWrapper &&rhs) = default;

    template <class ...Args>
    T &&operator()(Args ...) {
        return std::move(t);
    }
private:
    T t;
};

namespace std {
template<typename T>
struct is_bind_expression<RValueWrapper<T>> : std::true_type {
};
}

template<typename T,
        typename = typename std::enable_if<std::is_rvalue_reference<T&&>::value>::type>
RValueWrapper<T> rval(T &&t) {
    return RValueWrapper<T>(std::move(t));
}

template<typename T>
RValueWrapper<T> rval(T &t) {
    return RValueWrapper<T>(T(t));
}

#endif /* UTIL_RVALUE_WRAPPER_H_ */

Add RValueWrapper, a wrapper for passing rvalue through std::bind and allow binding to function with rvalue reference parameters.


// Copyright 2012-2014 UX Productivity Pty Ltd
//
// 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 DocFormats_DFCommon_h
#define DocFormats_DFCommon_h

#include <assert.h>
#include <ctype.h>
#include <dirent.h>
#include <errno.h>
#include <fcntl.h>
#include <iconv.h>
#include <limits.h>
#include <math.h>
#include <stdarg.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <unistd.h>

#endif

// Copyright 2012-2014 UX Productivity Pty Ltd
//
// 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 DocFormats_DFCommon_h
#define DocFormats_DFCommon_h

#include "DFTypes.h"

#include <assert.h>
#include <ctype.h>
#include <errno.h>
#include <fcntl.h>
#include <iconv.h>
#include <limits.h>
#include <math.h>
#include <stdarg.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/stat.h>
#include <sys/types.h>

#ifdef WIN32
#include <io.h>
#define open _open
#define creat _creat
#define read _read
#define write _write
#define close _close
#define snprintf _snprintf
#define vsnprintf _vsnprintf
#define strcasecmp _stricmp
#define strncasecmp _strnicmp
#define strdup _strdup
#else // not WIN32
#include <dirent.h>
#include <unistd.h>
#endif

#endif

Win32: Add macros for common functions like strdup

For some reason, Microsoft have an aversion to including functions like
strdup, open, read, write, and close that are part of the POSIX
standard, but still keep them present with a _ prefix.

This commit adds #defines for some of these functions so that we can
keep using the existing code without having to add all lots of ugly
underscores everywhere.


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

#include <boost/cstdint.hpp>

#define VISTK_IMAGE_INSTANTIATE(cls) \
  template class cls<bool>;          \
  template class cls<uint8_t>;       \
  template class cls<float>;         \
  template class cls<double>

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

#ifndef VISTK_IMAGE_INSTANTIATE_H
#define VISTK_IMAGE_INSTANTIATE_H

#include <boost/cstdint.hpp>

/**
 * \file image/instantiate.h
 *
 * \brief Types for instantiation of image library templates.
 */

#define VISTK_IMAGE_INSTANTIATE_INT(cls) \
  template class cls<bool>;              \
  template class cls<uint8_t>

#define VISTK_IMAGE_INSTANTIATE_FLOAT(cls) \
  template class cls<float>;               \
  template class cls<double>

#define VISTK_IMAGE_INSTANTIATE(cls) \
  VISTK_IMAGE_INSTANTIATE_INT(cls);  \
  VISTK_IMAGE_INSTANTIATE_FLOAT(cls)

#endif // VISTK_IMAGE_INSTANTIATE_H

Split int from float instantiations

Split int from float instantiations


#ifndef __testing__
#define __testing__

extern void ct_init(const char * module_name);

extern void ct_report(const char * test_name, int success);

extern void ct_terminate(void);

#endif

#ifndef __ctest__
#define __ctest__

extern void ct_init(const char * module_name);

extern void ct_report(const char * test_name, int success);

extern void ct_print_stats(void);

extern void ct_terminate(void);

extern void ct_print_stats_and_terminate(void);

#endif

Split statistics printing from memory cleanup

Created ct_print_stats that outputs stats without freeing
memory, and ct_print_stats_and_terminate which does both, along with
ct_terminate which only frees memory.


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

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
==============================================================================*/

#ifndef TENSORFLOW_CORE_PLATFORM_INIT_MAIN_H_
#define TENSORFLOW_CORE_PLATFORM_INIT_MAIN_H_

namespace tensorflow {
namespace port {

// Platform-specific initialization routine that may be invoked by a
// main() program that uses TensorFlow.
//
// Default implementation does nothing.
void InitMain(const char* usage, int* argc, char*** argv);

}  // namespace port
}  // namespace tensorflow

#endif  // TENSORFLOW_CORE_PLATFORM_INIT_MAIN_H_

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

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
==============================================================================*/

#ifndef TENSORFLOW_CORE_PLATFORM_INIT_MAIN_H_
#define TENSORFLOW_CORE_PLATFORM_INIT_MAIN_H_

namespace tensorflow {
namespace port {

// Platform-specific initialization routine that should be invoked by a
// main() program that uses TensorFlow.
// This performs necessary initialization on some platforms; TensorFlow
// may not work unless it has been called.
void InitMain(const char* usage, int* argc, char*** argv);

}  // namespace port
}  // namespace tensorflow

#endif  // TENSORFLOW_CORE_PLATFORM_INIT_MAIN_H_

Clarify the need for calling tensorflow::port::InitMain() before using the rest of TensorFlow.

PiperOrigin-RevId: 219185259


/*
Copyright © 2018-2019 Atlas Engineer LLC.
Use of this file is governed by the license that can be found in LICENSE.
*/

#include <gtk/gtk.h>
#include <stdlib.h>
#include "server.h"

static void on_name_acquired(GDBusConnection *connection,
	const gchar *name,
	gpointer user_data) {
	g_message("Starting platform port");
}

static void on_name_lost(GDBusConnection *_connection,
	const gchar *_name,
	gpointer _user_data) {
	g_message("Platform port disconnected");
	// TODO: Call stop_server here?
	exit(1);
}

int main(int argc, char *argv[]) {
	// TODO: Use GtkApplication?
	guint owner_id = g_bus_own_name(G_BUS_TYPE_SESSION,
			PLATFORM_PORT_NAME,
			G_BUS_NAME_OWNER_FLAGS_NONE,
			start_server,
			on_name_acquired,
			on_name_lost,
			NULL,
			NULL);

	// TODO: Start the RPC server first?  If GUI is started, then we can
	// report RPC startup issues graphically.

	gtk_main();

	stop_server();

	g_bus_unown_name(owner_id);
	return EXIT_SUCCESS;
}

/*
Copyright © 2018-2019 Atlas Engineer LLC.
Use of this file is governed by the license that can be found in LICENSE.
*/

#include <gtk/gtk.h>
#include <stdlib.h>
#include "server.h"

static void on_name_acquired(GDBusConnection *connection,
	const gchar *name,
	gpointer user_data) {
	g_message("Starting platform port");
}

static void on_name_lost(GDBusConnection *_connection,
	const gchar *_name,
	gpointer _user_data) {
	g_message("Platform port disconnected");
	// TODO: Call stop_server here?
	exit(1);
}

int main(int argc, char *argv[]) {
	// It's safer to initialize GTK before the server is started.  In particular,
	// without it the program would crash if hardware acceleration is disabled
	// (e.g. with the WEBKIT_DISABLE_COMPOSITING_MODE=1 environment variable).
	gtk_init(NULL, NULL);
	// TODO: Use GtkApplication?

	guint owner_id = g_bus_own_name(G_BUS_TYPE_SESSION,
			PLATFORM_PORT_NAME,
			G_BUS_NAME_OWNER_FLAGS_NONE,
			start_server,
			on_name_acquired,
			on_name_lost,
			NULL,
			NULL);

	// TODO: Start the RPC server first?  If GUI is started, then we can
	// report RPC startup issues graphically.

	gtk_main();

	stop_server();

	g_bus_unown_name(owner_id);
	return EXIT_SUCCESS;
}

ports/gtk-webkit: Fix crash when hardware acceleration is disabled.


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

/*
 * gc_noinst.c : Functions that shouldn't be instrumented by the compiler
 */

__thread unsigned int thread_suspend_if_needed_count = 0;

/* TODO(elijahtaylor): This will need to be changed
 *  when the compiler instrumentation changes.
 */
void __nacl_suspend_thread_if_needed() {
  thread_suspend_if_needed_count++;
}

/*
 * Copyright (c) 2011 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.
 */

/*
 * gc_noinst.c : Functions that shouldn't be instrumented by the compiler
 */

__thread unsigned int thread_suspend_if_needed_count = 0;

/* TODO(elijahtaylor): This will need to be changed
 *  when the compiler instrumentation changes.
 */
volatile int __nacl_thread_suspension_needed = 1;

void __nacl_suspend_thread_if_needed() {
  thread_suspend_if_needed_count++;
}

Fix the gc_instrumentation test on toolchain bots.

The compiler now inserts explicit references to the suspension flag, which then
fails to link when the flag is not present.

BUG=none
TEST=run_gc_instrumentation_test # with freshly uploaded toolchain

Review URL: http://codereview.chromium.org/8336018

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


/*
 *  Copyright (c) 2004-present, Facebook, Inc.
 *
 *  This source code is licensed under the MIT license found in the LICENSE
 *  file in the root directory of this source tree.
 *
 */
#ifndef FB_SK_MACROS_H
 #define FB_SK_MACROS_H
     #define FB_LINK_REQUIRE_(NAME, UNIQUE)
    #define FB_LINKABLE(NAME)
    #define FB_LINK_REQUIRE(NAME)
 #endif

/*
 *  Copyright (c) 2004-present, Facebook, Inc.
 *
 *  This source code is licensed under the MIT license found in the LICENSE
 *  file in the root directory of this source tree.
 *
 */
#ifndef FB_SK_MACROS_H
 #define FB_SK_MACROS_H
    #define FB_LINK_REQUIRE_(NAME)
    #define FB_LINKABLE(NAME)
    #define FB_LINK_REQUIRE(NAME)
 #endif

Delete second argument to FB_LINK_REQUIRE_

Summary: It is now always NAME.

Reviewed By: adamjernst

Differential Revision: D13577665

fbshipit-source-id: 9d9330fd17b7e214ef807760d0314c34bd06ebd5


/* strdump.c -- similar to hexdump but with ascii strings */

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

int
strdump(FILE *fo, FILE *fi)
{
    int c, n;

    n = 0;
    fputs("\"", fo);
    c = fgetc(fi);
    while (c != -1)
    {
	if (c == '\n' || c == '\r')
	    fputs("\\n\"\n\"", fo);
	else
	    putc(c, fo);
	c = fgetc(fi);
	n ++;
    }
    fputs("\"\n", fo);
    return n;
}

int
main(int argc, char **argv)
{
    FILE *fo;
    FILE *fi;
    char name[256];
    char *realname;
    char *p;
    int i, len;

    if (argc < 3)
    {
	fprintf(stderr, "usage: hexdump output.c input.dat\n");
	return 1;
    }

    fo = fopen(argv[1], "wb");
    if (!fo)
    {
	fprintf(stderr, "hexdump: could not open output file\n");
	return 1;
    }

    for (i = 2; i < argc; i++)
    {
	fi = fopen(argv[i], "rb");
	if (!fi)
	{
	    fprintf(stderr, "hexdump: could not open input file\n");
	    return 1;
	}

	realname = strrchr(argv[i], '/');
	if (!realname)
	    realname = strrchr(argv[i], '\\');
	if (realname)
	    realname ++;
	else
	    realname = argv[i];

	strcpy(name, argv[i]);
	p = name;
	while (*p)
	{
	    if ((*p == '/') || (*p == '.') || (*p == '\\') || (*p == '-'))
		*p = '_';
	    p ++;
	}

	fprintf(fo, "const char %s_name[] = \"%s\";\n", name, realname);
	fprintf(fo, "const char %s_buf[] = {\n", name);

	len = strdump(fo, fi);

	fprintf(fo, "};\n");
	fprintf(fo, "const int %s_len = %d;\n", name, len);
	fprintf(fo, "\n");

	fclose(fi);
    }

    return 0;
}

Add a tool similar to hexdump, but for text files.


/*
 *  Copyright (c) 2016, Facebook, Inc.
 *  All rights reserved.
 *
 *  This source code is licensed under the BSD-style license found in the
 *  LICENSE file in the root directory of this source tree. An additional grant
 *  of patent rights can be found in the PATENTS file in the same directory.
 *
 */

#pragma once

#include <folly/experimental/fibers/FiberManagerMap.h>
#include <wangle/concurrent/IOExecutor.h>

namespace wangle {

/**
 * @class FiberIOExecutor
 * @brief An IOExecutor that executes funcs under mapped fiber context
 *
 * A FiberIOExecutor wraps an IOExecutor, but executes funcs on the FiberManager
 * mapped to the underlying IOExector's event base.
 */
class FiberIOExecutor : public IOExecutor {
 public:
  explicit FiberIOExecutor(
      const std::shared_ptr<IOExecutor>& ioExecutor)
      : ioExecutor_(ioExecutor) {}

  virtual void add(std::function<void()> f) override {
    auto eventBase = ioExecutor_->getEventBase();
    getFiberManager(*eventBase).add(std::move(f));
  }

  virtual EventBase* getEventBase() override {
    return ioExecutor_->getEventBase();
  }

 private:
  std::shared_ptr<IOExecutor> ioExecutor_;
};

} // namespace wangle

/*
 *  Copyright (c) 2016, Facebook, Inc.
 *  All rights reserved.
 *
 *  This source code is licensed under the BSD-style license found in the
 *  LICENSE file in the root directory of this source tree. An additional grant
 *  of patent rights can be found in the PATENTS file in the same directory.
 *
 */

#pragma once

#include <folly/fibers/FiberManagerMap.h>
#include <wangle/concurrent/IOExecutor.h>

namespace wangle {

/**
 * @class FiberIOExecutor
 * @brief An IOExecutor that executes funcs under mapped fiber context
 *
 * A FiberIOExecutor wraps an IOExecutor, but executes funcs on the FiberManager
 * mapped to the underlying IOExector's event base.
 */
class FiberIOExecutor : public IOExecutor {
 public:
  explicit FiberIOExecutor(
      const std::shared_ptr<IOExecutor>& ioExecutor)
      : ioExecutor_(ioExecutor) {}

  virtual void add(std::function<void()> f) override {
    auto eventBase = ioExecutor_->getEventBase();
    getFiberManager(*eventBase).add(std::move(f));
  }

  virtual EventBase* getEventBase() override {
    return ioExecutor_->getEventBase();
  }

 private:
  std::shared_ptr<IOExecutor> ioExecutor_;
};

} // namespace wangle

Move fibers out of experimental

Move fibers out of experimental

Summary: folly::fibers have been used by mcrouter for more than 2 years, so not really experimental.

Reviewed By: pavlo-fb

Differential Revision: D3320595

fbshipit-source-id: 68188f92b71a4206d57222993848521ca5437ef5


/* JSON_checker.h */

#ifdef JSON_checker_EXPORTS

#if defined (__SUNPRO_C) && (__SUNPRO_C >= 0x550)
#define JSON_CHECKER_PUBLIC_API __global
#elif defined __GNUC__
#define JSON_CHECKER_PUBLIC_API __attribute__ ((visibility("default")))
#elif defined(_MSC_VER)
#define JSON_CHECKER_PUBLIC_API __declspec(dllexport)
#else
/* unknown compiler */
#define JSON_CHECKER_PUBLIC_API
#endif

#else

#if defined(_MSC_VER)
#define JSON_CHECKER_PUBLIC_API __declspec(dllimport)
#else
#define JSON_CHECKER_PUBLIC_API
#endif

#endif

#ifdef __cplusplus
extern "C" {
#endif

JSON_CHECKER_PUBLIC_API
int checkUTF8JSON(const unsigned char* data, size_t size);

#ifdef __cplusplus
}
#endif

/* JSON_checker.h */

#pragma once

#ifdef JSON_checker_EXPORTS

#if defined (__SUNPRO_C) && (__SUNPRO_C >= 0x550)
#define JSON_CHECKER_PUBLIC_API __global
#elif defined __GNUC__
#define JSON_CHECKER_PUBLIC_API __attribute__ ((visibility("default")))
#elif defined(_MSC_VER)
#define JSON_CHECKER_PUBLIC_API __declspec(dllexport)
#else
/* unknown compiler */
#define JSON_CHECKER_PUBLIC_API
#endif

#else

#if defined(_MSC_VER)
#define JSON_CHECKER_PUBLIC_API __declspec(dllimport)
#else
#define JSON_CHECKER_PUBLIC_API
#endif

#endif

#ifdef __cplusplus
extern "C" {
#endif

JSON_CHECKER_PUBLIC_API
int checkUTF8JSON(const unsigned char* data, size_t size);

#ifdef __cplusplus
}
#endif

Fix 'redundant redeclaration' warning due to missing include guard

Change-Id: Ifa8273d9e95ec4d16e52fec64db2d3ebd50e4e4b
Reviewed-on: http://review.couchbase.org/51690
Tested-by: buildbot <80754af91bfb6d1073585b046fe0a474ce868509@couchbase.com>
Reviewed-by: Trond Norbye <60edd2ef23891a753f231b0c6f161dc634079a93@gmail.com>


//
//  HauteStreamsController.h
//  Hauth
//
//  Created by Rizwan Sattar on 11/7/15.
//  Copyright © 2015 Rizwan Sattar. All rights reserved.
//

#import <Foundation/Foundation.h>

@interface HauthStreamsController : NSObject

@property (strong, nonatomic, nullable) NSInputStream *inputStream;
@property (strong, nonatomic, nullable) NSOutputStream *outputStream;
@property (assign, nonatomic) NSUInteger streamOpenCount;

- (void)openStreams;
- (void)closeStreams;

- (void)sendData:(nonnull NSData *)data;
- (void)handleReceivedData:(nonnull NSData *)data;

- (void)handleStreamEnd:(NSStream *)stream;

@end

//
//  HauteStreamsController.h
//  Hauth
//
//  Created by Rizwan Sattar on 11/7/15.
//  Copyright © 2015 Rizwan Sattar. All rights reserved.
//

#import <Foundation/Foundation.h>

@interface HauthStreamsController : NSObject

@property (strong, nonatomic, nullable) NSInputStream *inputStream;
@property (strong, nonatomic, nullable) NSOutputStream *outputStream;
@property (assign, nonatomic) NSUInteger streamOpenCount;

- (void)openStreams;
- (void)closeStreams;

- (void)sendData:(nonnull NSData *)data;
- (void)handleReceivedData:(nonnull NSData *)data;

- (void)handleStreamEnd:(nonnull NSStream *)stream;

@end

Fix warning for a missing nonnull

Fix warning for a missing nonnull


#pragma once

namespace std {
template <typename T> auto cbegin(const T &c) { return c.cbegin(); }
template <typename T> auto crbegin(const T &c) { return c.crbegin(); }
template <typename T> auto cend(const T &c) { return c.crbegin(); }
template <typename T> auto crend(const T &c) { return c.crbegin(); }
}

Add {c|r}{begin|end} since gcc doesnt know it.