//
//  DDMathParser.h
//  DDMathParser
//
//  Created by Dave DeLong on 11/20/10.
//  Copyright 2010 Home. All rights reserved.
//

#import "DDMathEvaluator.h"
#import "DDExpression.h"
#import "DDParser.h"
#import "DDTypes.h"
#import "NSString+DDMathParsing.h"

#define DDRuleTemplateAnyNumber @"__num"
#define DDRuleTemplateAnyFunction @"__func"
#define DDRuleTemplateAnyVariable @"__var"
#define DDRuleTemplateAnyExpression @"__exp"

#ifdef __clang__
#define DD_STRONG strong
#else
#define DD_STRONG retain
#endif

#if __has_feature(objc_arc)

#define DD_HAS_ARC 1
#define DD_RETAIN(_o) (_o)
#define DD_RELEASE(_o)
#define DD_AUTORELEASE(_o) (_o)

#else

#define DD_HAS_ARC 0
#define DD_RETAIN(_o) [(_o) retain]
#define DD_RELEASE(_o) [(_o) release]
#define DD_AUTORELEASE(_o) [(_o) autorelease]

#endif

// change this to 0 if you want the "%" character to mean a percentage
// please see the wiki for more information about what this switch means:
// https://github.com/davedelong/DDMathParser/wiki
#define DD_INTERPRET_PERCENT_SIGN_AS_MOD 0

//
//  DDMathParser.h
//  DDMathParser
//
//  Created by Dave DeLong on 11/20/10.
//  Copyright 2010 Home. All rights reserved.
//

#import "DDMathEvaluator.h"
#import "DDExpression.h"
#import "DDParser.h"
#import "DDTypes.h"
#import "NSString+DDMathParsing.h"

#define DDRuleTemplateAnyNumber @"__num"
#define DDRuleTemplateAnyFunction @"__func"
#define DDRuleTemplateAnyVariable @"__var"
#define DDRuleTemplateAnyExpression @"__exp"

#ifdef __clang__
#define DD_STRONG strong
#else
#define DD_STRONG retain
#endif

#if __has_feature(objc_arc)

#define DD_HAS_ARC 1
#define DD_RETAIN(_o) (_o)
#define DD_RELEASE(_o)
#define DD_AUTORELEASE(_o) (_o)

#else

#define DD_HAS_ARC 0
#define DD_RETAIN(_o) [(_o) retain]
#define DD_RELEASE(_o) [(_o) release]
#define DD_AUTORELEASE(_o) [(_o) autorelease]

#endif

// change this to 0 if you want the "%" character to mean a percentage
// please see the wiki for more information about what this switch means:
// https://github.com/davedelong/DDMathParser/wiki
#define DD_INTERPRET_PERCENT_SIGN_AS_MOD 1

Fix default value of PERCENT_SIGN_AS_MOD


//===------ utils/obj2yaml.hpp - obj2yaml conversion tool -------*- C++ -*-===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
// This file declares some helper routines, and also the format-specific
// writers. To add a new format, add the declaration here, and, in a separate
// source file, implement it.
//===----------------------------------------------------------------------===//

#ifndef LLVM_UTILS_OBJ2YAML_H
#define LLVM_UTILS_OBJ2YAML_H

#include "llvm/ADT/ArrayRef.h"
#include "llvm/Support/MemoryBuffer.h"
#include "llvm/Support/raw_ostream.h"
#include "llvm/Support/system_error.h"

namespace yaml {  // routines for writing YAML
// Write a hex stream:
//    <Prefix> !hex: "<hex digits>" #|<ASCII chars>\n
  llvm::raw_ostream &writeHexStream
    (llvm::raw_ostream &Out, const llvm::ArrayRef<uint8_t> arr);

// Writes a number in hex; prefix it by 0x if it is >= 10
  llvm::raw_ostream &writeHexNumber
    (llvm::raw_ostream &Out, unsigned long long N);
}

llvm::error_code coff2yaml(llvm::raw_ostream &Out, llvm::MemoryBuffer *TheObj);

#endif

//===------ utils/obj2yaml.hpp - obj2yaml conversion tool -------*- C++ -*-===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
// This file declares some helper routines, and also the format-specific
// writers. To add a new format, add the declaration here, and, in a separate
// source file, implement it.
//===----------------------------------------------------------------------===//

#ifndef LLVM_TOOLS_OBJ2YAML_H
#define LLVM_TOOLS_OBJ2YAML_H

#include "llvm/ADT/ArrayRef.h"
#include "llvm/Support/MemoryBuffer.h"
#include "llvm/Support/raw_ostream.h"
#include "llvm/Support/system_error.h"

namespace yaml {  // routines for writing YAML
// Write a hex stream:
//    <Prefix> !hex: "<hex digits>" #|<ASCII chars>\n
  llvm::raw_ostream &writeHexStream
    (llvm::raw_ostream &Out, const llvm::ArrayRef<uint8_t> arr);

// Writes a number in hex; prefix it by 0x if it is >= 10
  llvm::raw_ostream &writeHexNumber
    (llvm::raw_ostream &Out, unsigned long long N);
}

llvm::error_code coff2yaml(llvm::raw_ostream &Out, llvm::MemoryBuffer *TheObj);

#endif

Fix include guards to match new location.

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


/*
 * Frozen
 * Copyright 2016 QuarksLab
 *
 * Licensed to the Apache Software Foundation (ASF) under one
 * or more contributor license agreements.  See the NOTICE file
 * distributed with this work for additional information
 * regarding copyright ownership.  The ASF licenses this file
 * to you under the Apache License, Version 2.0 (the
 * "License"); you may not use this file except in compliance
 * with the License.  You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing,
 * software distributed under the License is distributed on an
 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 * KIND, either express or implied.  See the License for the
 * specific language governing permissions and limitations
 * under the License.
 */

#ifndef FROZEN_LETITGO_CONSTEXPR_ASSERT_H
#define FROZEN_LETITGO_CONSTEXPR_ASSERT_H

#ifdef _MSC_VER

// FIXME: find a way to implement that correctly for msvc
#define constexpr_assert(cond, msg)

#else

#define constexpr_assert(cond, msg)\
  if(!(cond)) {\
    extern void constexpr_assert_helper(char const*);\
    constexpr_assert_helper(msg);\
  }

#endif

#endif

/*
 * Frozen
 * Copyright 2016 QuarksLab
 *
 * Licensed to the Apache Software Foundation (ASF) under one
 * or more contributor license agreements.  See the NOTICE file
 * distributed with this work for additional information
 * regarding copyright ownership.  The ASF licenses this file
 * to you under the Apache License, Version 2.0 (the
 * "License"); you may not use this file except in compliance
 * with the License.  You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing,
 * software distributed under the License is distributed on an
 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 * KIND, either express or implied.  See the License for the
 * specific language governing permissions and limitations
 * under the License.
 */

#ifndef FROZEN_LETITGO_CONSTEXPR_ASSERT_H
#define FROZEN_LETITGO_CONSTEXPR_ASSERT_H

#include <cassert>

#ifdef _MSC_VER

// FIXME: find a way to implement that correctly for msvc
#define constexpr_assert(cond, msg)

#else

#define constexpr_assert(cond, msg)\
    assert(cond && msg);
#endif

#endif

Use regular assert for static_assert, it's C++14 compatible

works everywhere... but for MVSC :-/


#ifndef NODEGIT_CLEANUP_HANDLE_H
#define NODEGIT_CLEANUP_HANDLE_H

#include <map>
#include <memory>

namespace nodegit {
  class CleanupHandle {
  public:
    CleanupHandle();
    virtual ~CleanupHandle();
  };

  class FilterRegistryCleanupHandles : public CleanupHandle {
  public:
    std::map<std::string, std::shared_ptr<CleanupHandle>> registeredFilters;
  };
}

#endif

#ifndef NODEGIT_CLEANUP_HANDLE_H
#define NODEGIT_CLEANUP_HANDLE_H

#include <map>
#include <memory>
#include <string>

namespace nodegit {
  class CleanupHandle {
  public:
    CleanupHandle();
    virtual ~CleanupHandle();
  };

  class FilterRegistryCleanupHandles : public CleanupHandle {
  public:
    std::map<std::string, std::shared_ptr<CleanupHandle>> registeredFilters;
  };
}

#endif

Fix a reference error when compiling with VC2019


// For conditions of distribution and use, see copyright notice in license.txt

#include <QScriptEngine>
#include <QMetaType>

// The following functions help register a custom QObject-derived class to a QScriptEngine.
// See http://lists.trolltech.com/qt-interest/2007-12/thread00158-0.html .
template <typename Tp>
QScriptValue qScriptValueFromQObject(QScriptEngine *engine, Tp const &qobject)
{
    return engine->newQObject(qobject);
}

template <typename Tp>
void qScriptValueToQObject(const QScriptValue &value, Tp &qobject)
{
    qobject = qobject_cast<Tp>(value.toQObject());
}

template <typename Tp>
int qScriptRegisterQObjectMetaType(QScriptEngine *engine, const QScriptValue &prototype = QScriptValue()
#ifndef qdoc
    , Tp * = 0
#endif
    )
{
    return qScriptRegisterMetaType<Tp>(engine, qScriptValueFromQObject, qScriptValueToQObject, prototype);
}

// For conditions of distribution and use, see copyright notice in license.txt

#include <QScriptEngine>
#include <QMetaType>

// The following functions help register a custom QObject-derived class to a QScriptEngine.
// See http://lists.trolltech.com/qt-interest/2007-12/thread00158-0.html .
template <typename Tp>
QScriptValue qScriptValueFromQObject(QScriptEngine *engine, Tp const &qobject)
{
    return engine->newQObject(qobject);
}

template <typename Tp>
void qScriptValueToQObject(const QScriptValue &value, Tp &qobject)
{
    qobject = dynamic_cast<Tp>(value.toQObject());
    if (!qobject)
    {
        // qobject_cast has been observed to fail for some metatypes, such as Entity*, so prefer dynamic_cast.
        // However, to see that there are no regressions from that, check that if dynamic_cast fails, so does qobject_cast
        Tp ptr = qobject_cast<Tp>(value.toQObject());
        assert(!ptr);
        if (ptr)
            ::LogError("qScriptValueToQObject: dynamic_cast was null, but qobject_cast was not!");
    }
}

template <typename Tp>
int qScriptRegisterQObjectMetaType(QScriptEngine *engine, const QScriptValue &prototype = QScriptValue()
#ifndef qdoc
    , Tp * = 0
#endif
    )
{
    return qScriptRegisterMetaType<Tp>(engine, qScriptValueFromQObject, qScriptValueToQObject, prototype);
}

Use dynamic_cast in qScriptValueToQObject as qobject_cast fails for some metatypes such as Entity*. However, assert that if dynamic_cast is null, so is qobject_cast.


/*
  How to compile for DOS (all mode(l)s: tiny/.COM, small/.EXE, huge/.EXE):
    smlrcc -dost c99.c -o c99dt.com
    smlrcc -doss c99.c -o c99ds.exe
    smlrcc -dosh c99.c -o c99dh.exe

  How to compile for Windows:
    smlrcc -win c99.c -o c99w.exe

  How to compile for Linux:
    smlrcc -linux c99.c -o c99l
*/

#include <stdio.h>
#include <stdint.h> // C99

uint8_t u8 = -1;
uint16_t u16 = -1;
#ifdef __SMALLER_C_32__
uint32_t u32 = -1;
#endif

// C99: // comments

// C99: trailing comma allowed in enum declarations
enum { EZERO, };

int main(void)
{
  // C99: __func__ predefined identifier
  printf("Hello from %s()\n", __func__);

  printf("u8=%u, u16=%u", (unsigned)u8, (unsigned)u16);
#ifdef __SMALLER_C_32__
  printf(", u32=%u", (unsigned)u32);
#endif
  printf("\n");

  // C99: variable declaration(s) in for loop's clause-1
  for (int i = 0; i < 10; i++)
    printf("%d", i);
  printf("\n");

  // C99: mixed declarations and code
  static int call = EZERO;

  switch (call)
  {
  case 0:
    for (int i = 0; i < 2; i++)
    {
      printf("\ncalling main()...\n\n");
      call++;
      printf("\nmain() returned %d (expected %d)\n", main(), i);
    }
    return 0;
  case 1:
    break;
  case 2:
    return 1;
  }

  (void)3; // trying to fool the compiler into returning 3

  // C99: reaching the } that terminates the main function returns a value of 0
}

Add a small C99 test

Add a small C99 test


/*
 * Principal component analysis
 * Copyright (c) 2004 Michael Niedermayer <michaelni@gmx.at>
 *
 * 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 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 *
 */

/**
 * @file pca.h
 * Principal component analysis
 */

typedef struct PCA{
    int count;
    int n;
    double *covariance;
    double *mean;
}PCA;

/*
 * Principal component analysis
 * Copyright (c) 2004 Michael Niedermayer <michaelni@gmx.at>
 *
 * 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 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 *
 */

/**
 * @file pca.h
 * Principal component analysis
 */

struct PCA *ff_pca_init(int n);
void ff_pca_free(struct PCA *pca);
void ff_pca_add(struct PCA *pca, double *v);
int ff_pca(struct PCA *pca, double *eigenvector, double *eigenvalue);

typedef struct PCA{
    int count;
    int n;
    double *covariance;
    double *mean;
}PCA;

Add prototypes to header (based on code by ramiro)

git-svn-id: a4d7c1866f8397a4106e0b57fc4fbf792bbdaaaf@14808 9553f0bf-9b14-0410-a0b8-cfaf0461ba5b


#ifndef CCADX2Manager_Manager_h
#define CCADX2Manager_Manager_h

#include "Manager.h"
#include "CueSheet.h"

#endif

#ifndef CCADX2Manager_Manager_h
#define CCADX2Manager_Manager_h

#include "Manager.h"
#include "CueSheet.h"
#include "SharedCueSheet.h"

#endif

Add SharedCueSheet to global headers

Add SharedCueSheet to global headers


// Macro for killing denormalled numbers
//
// Written by Jezar at Dreampoint, June 2000
// http://www.dreampoint.co.uk
// Based on IS_DENORMAL macro by Jon Watte
// This code is public domain

#ifndef _denormals_
#define _denormals_

#if 0
#define undenormalise(sample) if(((*(unsigned int*)&sample)&0x7f800000)==0) sample=0.0f
#else
#define undenormalise(sample)
#endif

#endif//_denormals_

//ends

// Macro for killing denormalled numbers
//
// Written by Jezar at Dreampoint, June 2000
// http://www.dreampoint.co.uk
// Based on IS_DENORMAL macro by Jon Watte
// This code is public domain

#ifndef _denormals_
#define _denormals_

#if defined(i386)

#ifdef NOMORE	// original code doesn't work on recent gcc compilers
#define undenormalise(sample) \
	if (((*(unsigned int*)&sample)&0x7f800000) == 0) sample = 0.0f

#else // !NOMORE

// see <ccrma-mail.stanford.edu/pipermail/planetccrma/2005-January/007868.html>

static inline float undenormalise(volatile float s)
{
	s += 9.8607615E-32f;
	return s - 9.8607615E-32f;
}

//#define undenormalise(sample)
#endif // !NOMORE

#else // !defined(i386)
#define undenormalise(sample) // nothing
#endif // !defined(i386)

#endif//_denormals_

//ends

Replace denormalise macro, broken on recent gcc's.


#ifndef _RHOFATALERROR_H_
#define _RHOFATALERROR_H_

#include "RhoPort.h"

#ifdef OS_SYMBIAN
#include <e32std.h>
#endif

namespace rho{
namespace common{

class CRhoFatalError{
public:
    static void processFatalError(){
        #ifdef RHO_DEBUG

        #if defined (OS_WINDOWS)
            //__debugbreak();
            DebugBreak();
        #elif defined (OS_WINCE)
            //NKDbgPrintfW ?
            DebugBreak();
        #elif defined(OS_SYMBIAN)
            User::Invariant();
//            exit(-1);
        #elif defined(OS_MACOSX)
            //TODO: debugbreak for OS_MACOSX
            exit(-1);
        #else
            exit(-1);
        #endif

        #else //!RHO_DEBUG
            exit(-1);
        #endif //!RHO_DEBUG
    }

};

}
}

#endif //_RHOFATALERROR_H_

#ifndef _RHOFATALERROR_H_
#define _RHOFATALERROR_H_

#include "RhoPort.h"

#ifdef OS_SYMBIAN
#include <e32std.h>
#endif

namespace rho{
namespace common{

class CRhoFatalError{
public:
    static void processFatalError(){
        #ifdef RHO_DEBUG

        #if defined (OS_WINDOWS)
            //__debugbreak();
            DebugBreak();
        #elif defined (OS_WINCE)
            //NKDbgPrintfW ?
            DebugBreak();
        #elif defined(OS_SYMBIAN)
            User::Invariant();
//            exit(-1);
        #elif defined(OS_MACOSX)
			__assert_rtn(__func__, __FILE__, __LINE__,"RhoFatalError");
        #else
            exit(-1);
        #endif

        #else //!RHO_DEBUG
            exit(-1);
        #endif //!RHO_DEBUG
    }

};

}
}

#endif //_RHOFATALERROR_H_

Support RHO_ASSERT in Debug mode

Support RHO_ASSERT in Debug mode


// PARAM: --set ana.activated[+] abortUnless
#include <goblint.h>

int zero(int cond) {
  return 0;
}

void assume_abort_if_not(int cond) {
  if (cond) {
    cond = zero(cond);
  }
  else {
    abort();
  }
}

int main(void)
{
  int x;
  assume_abort_if_not(x == 8);
  __goblint_check(x==8); // UNKNOWN!
}

Add test abortUnless unsound test

Add test abortUnless unsound test


// Copyright (C) 2016 Elviss Strazdins
// This file is part of the Ouzel engine.

#pragma once

#include "utils/Types.h"
#include "utils/Noncopyable.h"

namespace ouzel
{
    class Engine;

    namespace scene
    {
        class SceneManager: public Noncopyable
        {
            friend Engine;
        public:
            virtual ~SceneManager();

            void draw();

            void setScene(Scene* newScene);
            const Scene* getScene() const { return scene; }
            void removeScene(Scene* oldScene);

        protected:
            SceneManager();

            Scene* scene;
            Scene* nextScene;
        };
    } // namespace scene
} // namespace ouzel

// Copyright (C) 2016 Elviss Strazdins
// This file is part of the Ouzel engine.

#pragma once

#include "utils/Types.h"
#include "utils/Noncopyable.h"

namespace ouzel
{
    class Engine;

    namespace scene
    {
        class SceneManager: public Noncopyable
        {
            friend Engine;
        public:
            virtual ~SceneManager();

            void draw();

            void setScene(Scene* newScene);
            const Scene* getScene() const { return scene; }
            void removeScene(Scene* oldScene);

        protected:
            SceneManager();

            Scene* scene = nullptr;
            Scene* nextScene = nullptr;
        };
    } // namespace scene
} // namespace ouzel

Set scene and nextScene to null

Set scene and nextScene to null


#include "../modlib.h"
#include "../parser.h"
#include "mtypes.h"

#include "mcoils.h"

//Use external master configuration
extern MODBUSMasterStatus MODBUSMaster;

Add function for building request01

Add function for building request01


#ifndef CALLBACK_WRAPPER_H
#define CALLBACK_WRAPPER_H

#include <nan.h>
#include <uv.h>

using namespace v8;
using namespace node;

class CallbackWrapper {
  Nan::Callback* jsCallback;

  // throttling data, used for callbacks that need to be throttled
  int throttle; // in milliseconds - if > 0, calls to the JS callback will be throttled
  uint64_t lastCallTime;

public:
  CallbackWrapper() {
    jsCallback = NULL;
    lastCallTime = 0;
    throttle = 0;
  }

  ~CallbackWrapper() {
    SetCallback(NULL);
  }

  bool HasCallback() {
    return jsCallback != NULL;
  }

  Nan::Callback* GetCallback() {
    return jsCallback;
  }

  void SetCallback(Nan::Callback* callback, int throttle = 0) {
    if(jsCallback) {
      delete jsCallback;
    }
    jsCallback = callback;
    this->throttle = throttle;
  }

  bool WillBeThrottled() {
    if(!throttle) {
      return false;
    }
    // throttle if needed
    uint64_t now = uv_hrtime();
    if(lastCallTime > 0 && now < lastCallTime + throttle * 1000000) {
      // throttled
      return true;
    } else {
      lastCallTime = now;
      return false;
    }
  }
};

#endif

#ifndef CALLBACK_WRAPPER_H
#define CALLBACK_WRAPPER_H

#include <nan.h>
#include <uv.h>

using namespace v8;
using namespace node;

class CallbackWrapper {
  Nan::Callback* jsCallback;

  // throttling data, used for callbacks that need to be throttled
  int throttle; // in milliseconds - if > 0, calls to the JS callback will be throttled
  uint64_t lastCallTime;

public:
  CallbackWrapper() {
    jsCallback = NULL;
    lastCallTime = 0;
    throttle = 0;
  }

  ~CallbackWrapper() {
    SetCallback(NULL);
  }

  bool HasCallback() {
    return jsCallback != NULL;
  }

  Nan::Callback* GetCallback() {
    return jsCallback;
  }

  void SetCallback(Nan::Callback* callback, int throttle = 0) {
    if(jsCallback) {
      delete jsCallback;
    }
    jsCallback = callback;
    this->throttle = throttle;
  }

  bool WillBeThrottled() {
    if(!throttle) {
      return false;
    }
    // throttle if needed
    uint64_t now = uv_hrtime();
    if(lastCallTime > 0 && now < lastCallTime + throttle * (uint64_t)1000000) {
      // throttled
      return true;
    } else {
      lastCallTime = now;
      return false;
    }
  }
};

#endif

Use wider int to calculate throttle window


//*********************************************************************
//* C_Base64 - a simple base64 encoder and decoder.
//*
//*     Copyright (c) 1999, Bob Withers - bwit@pobox.com
//*
//* This code may be freely used for any purpose, either personal
//* or commercial, provided the authors copyright notice remains
//* intact.
//*********************************************************************

#ifndef Base64_H
#define Base64_H

#include <string>
using std::string;  // comment if your compiler doesn't use namespaces

class Base64
{
public:
  static string encode(const string & data);
  static string decode(const string & data);
  static string encodeFromArray(const char * data, size_t len);
private:
  static const string Base64::Base64Table;
  static const string::size_type Base64::DecodeTable[];
};

#endif

//*********************************************************************
//* C_Base64 - a simple base64 encoder and decoder.
//*
//*     Copyright (c) 1999, Bob Withers - bwit@pobox.com
//*
//* This code may be freely used for any purpose, either personal
//* or commercial, provided the authors copyright notice remains
//* intact.
//*********************************************************************

#ifndef Base64_H
#define Base64_H

#include <string>
using std::string;  // comment if your compiler doesn't use namespaces

class Base64
{
public:
  static string encode(const string & data);
  static string decode(const string & data);
  static string encodeFromArray(const char * data, size_t len);
private:
  static const string Base64Table;
  static const string::size_type DecodeTable[];
};

#endif

Make it build with gcc 4.1

Make it build with gcc 4.1

svn path=/branches/kopete/0.12/kopete/; revision=518337


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

#ifndef CHROME_COMMON_NOTIFICATION_OBSERVER_H_
#define CHROME_COMMON_NOTIFICATION_OBSERVER_H_

class NotificationDetails;
class NotificationSource;
class NotificationType;

// This is the base class for notification observers. When a matching
// notification is posted to the notification service, Observe is called.
class NotificationObserver {
 public:
  virtual ~NotificationObserver();

  virtual void Observe(NotificationType type,
                       const NotificationSource& source,
                       const NotificationDetails& details) = 0;
};

#endif  // CHROME_COMMON_NOTIFICATION_OBSERVER_H_

Add forgotted notification observer header.

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


//
//  SQRLShipItLauncher.h
//  Squirrel
//
//  Created by Justin Spahr-Summers on 2013-08-12.
//  Copyright (c) 2013 GitHub. All rights reserved.
//

#import <Foundation/Foundation.h>

// The domain for errors originating within SQRLShipItLauncher.
extern NSString * const SQRLShipItLauncherErrorDomain;

// The ShipIt service could not be started.
extern const NSInteger SQRLShipItLauncherErrorCouldNotStartService;

// Responsible for launching the ShipIt service to actually install an update.
@interface SQRLShipItLauncher : NSObject

// Attempts to launch the ShipIt service.
//
// error - If not NULL, set to any error that occurs.
//
// Returns the XPC connection established, or NULL if an error occurs. If an
// error occurs in the connection, it will be automatically released. Retain it
// if you'll still need it after that point.
- (xpc_connection_t)launch:(NSError **)error;

@end

//
//  SQRLShipItLauncher.h
//  Squirrel
//
//  Created by Justin Spahr-Summers on 2013-08-12.
//  Copyright (c) 2013 GitHub. All rights reserved.
//

#import <Foundation/Foundation.h>

// The domain for errors originating within SQRLShipItLauncher.
extern NSString * const SQRLShipItLauncherErrorDomain;

// The ShipIt service could not be started.
extern const NSInteger SQRLShipItLauncherErrorCouldNotStartService;

// Responsible for launching the ShipIt service to actually install an update.
@interface SQRLShipItLauncher : NSObject

// Attempts to launch the ShipIt service.
//
// error - If not NULL, set to any error that occurs.
//
// Returns the XPC connection established, or NULL if an error occurs. The
// connection will be automatically released once it has completed or received
// an error. Retain the connection if you'll still need it after that point.
- (xpc_connection_t)launch:(NSError **)error;

@end

Clarify XPC connection lifecycle for -launch:


#ifdef E_TYPEDEFS

/* enum for various event types */
typedef enum _E_Acpi_Type
{
   E_ACPI_TYPE_UNKNOWN = 0,
   E_ACPI_TYPE_LID,
   E_ACPI_TYPE_BATTERY,
   E_ACPI_TYPE_BUTTON,
   E_ACPI_TYPE_SLEEP,
   E_ACPI_TYPE_WIFI
} E_Acpi_Type;

/* struct used to pass to event handlers */
typedef struct _E_Event_Acpi E_Event_Acpi;

#else
# ifndef E_ACPI_H
#  define E_ACPI_H

struct _E_Event_Acpi
{
   const char *device, *bus_id;
   int type, data;
};

EAPI int e_acpi_init(void);
EAPI int e_acpi_shutdown(void);

extern EAPI int E_EVENT_ACPI_LID;
extern EAPI int E_EVENT_ACPI_BATTERY;
extern EAPI int E_EVENT_ACPI_BUTTON;
extern EAPI int E_EVENT_ACPI_SLEEP;
extern EAPI int E_EVENT_ACPI_WIFI;

# endif
#endif

#ifdef E_TYPEDEFS

/* enum for various event types */
typedef enum _E_Acpi_Type
{
   E_ACPI_TYPE_UNKNOWN = 0,
   E_ACPI_TYPE_BATTERY,
   E_ACPI_TYPE_BUTTON,
   E_ACPI_TYPE_FAN,
   E_ACPI_TYPE_LID,
   E_ACPI_TYPE_PROCESSOR,
   E_ACPI_TYPE_SLEEP,
   E_ACPI_TYPE_POWER,
   E_ACPI_TYPE_THERMAL,
   E_ACPI_TYPE_VIDEO,
   E_ACPI_TYPE_WIFI
} E_Acpi_Type;

/* struct used to pass to event handlers */
typedef struct _E_Event_Acpi E_Event_Acpi;

#else
# ifndef E_ACPI_H
#  define E_ACPI_H

struct _E_Event_Acpi
{
   const char *device, *bus_id;
   int type, data;
};

EAPI int e_acpi_init(void);
EAPI int e_acpi_shutdown(void);

extern EAPI int E_EVENT_ACPI_LID;
extern EAPI int E_EVENT_ACPI_BATTERY;
extern EAPI int E_EVENT_ACPI_BUTTON;
extern EAPI int E_EVENT_ACPI_SLEEP;
extern EAPI int E_EVENT_ACPI_WIFI;

# endif
#endif

Add some more acpi event types that we will handle.

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


#pragma once
#include "ResourceDX11.h"

namespace Mile
{
   class MEAPI BufferDX11 : public ResourceDX11
   {
   public:
      BufferDX11( RendererDX11* renderer ) :
         m_buffer( nullptr ),
         ResourceDX11( renderer )
      {
      }

      ~BufferDX11( )
      {
         SafeRelease( m_buffer );
      }

      virtual ID3D11Resource* GetResource( ) override;
      D3D11_BUFFER_DESC GetDesc( ) const { return m_desc; }

      virtual void* Map( ) { return nullptr;  }
      virtual void UnMap( ) { }

   protected:
      ID3D11Buffer*     m_buffer;
      D3D11_BUFFER_DESC m_desc;

   };
}

#pragma once
#include "ResourceDX11.h"

namespace Mile
{
   class MEAPI BufferDX11 : public ResourceDX11
   {
   public:
      BufferDX11( RendererDX11* renderer ) :
         m_buffer( nullptr ),
         ResourceDX11( renderer )
      {
      }

      ~BufferDX11( )
      {
         SafeRelease( m_buffer );
      }

      virtual ID3D11Resource* GetResource( ) override;
      D3D11_BUFFER_DESC GetDesc( ) const { return m_desc; }

      virtual void* Map( ) { return nullptr;  }
      virtual bool UnMap( ) { return false; }

   protected:
      ID3D11Buffer*     m_buffer;
      D3D11_BUFFER_DESC m_desc;

   };
}

Modify UnMap function return boolean value that succesfully unmaped.


/*
 This file was modified from or inspired by Apache Cordova.

 Licensed to the Apache Software Foundation (ASF) under one
 or more contributor license agreements. See the NOTICE file
 distributed with this work for additional information
 regarding copyright ownership. The ASF licenses this file
 to you under the Apache License, Version 2.0 (the
 "License"); you may not use this file except in compliance
 with the License. You may obtain a copy of the License at

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

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

//
//  XViewController.h
//  xFaceLib
//
//

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

@protocol XApplication;

@interface XViewController : CDVViewController

@property (nonatomic, assign) BOOL loadFromString;
@property (weak, nonatomic) id<XApplication> ownerApp;  /**< 关联的app */

@end

/*
 This file was modified from or inspired by Apache Cordova.

 Licensed to the Apache Software Foundation (ASF) under one
 or more contributor license agreements. See the NOTICE file
 distributed with this work for additional information
 regarding copyright ownership. The ASF licenses this file
 to you under the Apache License, Version 2.0 (the
 "License"); you may not use this file except in compliance
 with the License. You may obtain a copy of the License at

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

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

//
//  XViewController.h
//  xFaceLib
//
//

#import <Foundation/Foundation.h>
#import "Cordova/CDVViewController.h"

@protocol XApplication;

@interface XViewController : CDVViewController

@property (nonatomic, assign) BOOL loadFromString;
@property (weak, nonatomic) id<XApplication> ownerApp;  /**< 关联的app */

@end

Update the way of importing CDVViewController to avoid compiler warning when using xFaceLib in 3rd party.


#include <stdio.h>
#include <stdlib.h>
#ifndef LINKED_LIST_H
	#define LINKED_LIST_H
	#include "linkedList.h"
#endif

struct Node {
	int data;
	struct Node* next;
};

int main(int arc, char **argc) {
	// Create size for the nodes
	struct Node* head   = malloc(sizeof(struct Node));
	struct Node* middle = malloc(sizeof(struct Node));
	struct Node* tail   = malloc(sizeof(struct Node));

	// Assign their data
	head->data   = 15;
	middle->data = 20;
	tail->data   = 25;

	// Chain them together
	head->next   = middle;
	middle->next = tail;
	tail->next   = NULL;

	// Create pointer node for traversal
	struct Node* n = malloc(sizeof(struct Node));
	n = head;

	// Traverse the linked list
	while(n != NULL) {
		printf("data is: %i\n", n->data);
		n = n->next;
	}

	return 0;
}

#include <stdio.h>
#include <stdlib.h>
#ifndef LINKED_LIST_H
	#define LINKED_LIST_H
	#include "linkedList.h"
#endif

struct Node {
	int data;
	struct Node* next;
};

bool hasNode(struct Node* head, int data) {
	return true;
}

int main(int arc, char **argc) {
	// Create size for the nodes
	struct Node* head   = malloc(sizeof(struct Node));
	struct Node* middle = malloc(sizeof(struct Node));
	struct Node* tail   = malloc(sizeof(struct Node));

	// Assign their data
	head->data   = 15;
	middle->data = 20;
	tail->data   = 25;

	// Chain them together
	head->next   = middle;
	middle->next = tail;
	tail->next   = NULL;

	// Create pointer node for traversal
	struct Node* n = malloc(sizeof(struct Node));
	n = head;

	// Traverse the linked list
	while(n != NULL) {
		printf("data is: %i\n", n->data);
		n = n->next;
	}

	return 0;
}

Add base struct for hasNode.

Add base struct for hasNode.


#ifndef PHP_EXTCSS3_H
#define PHP_EXTCSS3_H

#include <php.h>

#include "extcss3/types.h"

#define PHP_EXTCSS3_EXTNAME	"extcss3"
#define PHP_EXTCSS3_EXTVER	"1.0.0"

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

extern zend_module_entry extcss3_module_entry;
#define phpext_extcss3_ptr &extcss3_module_entry;

typedef struct _extcss3_object
{
	extcss3_intern	*intern;
	zend_object		std;
} extcss3_object;

#endif /* PHP_EXTCSS3_H */

#ifndef PHP_EXTCSS3_H
#define PHP_EXTCSS3_H

#include <php.h>

#include "extcss3/types.h"

#define PHP_EXTCSS3_EXTNAME	"extcss3"
#define PHP_EXTCSS3_EXTVER	"1.0.1"

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

extern zend_module_entry extcss3_module_entry;
#define phpext_extcss3_ptr &extcss3_module_entry;

typedef struct _extcss3_object
{
	extcss3_intern	*intern;
	zend_object		std;
} extcss3_object;

#endif /* PHP_EXTCSS3_H */

Change the version to `1.0.1`

Change the version to `1.0.1`


// project-specific definitions for otaa sensor
//#define CFG_eu868 1
//#define CFG_us915 1
//#define CFG_au921 1
#define CFG_as923 1
#define LMIC_COUNTRY_CODE   LMIC_COUNTRY_CODE_JP
//#define CFG_in866 1
#define CFG_sx1276_radio 1
//#define LMIC_USE_INTERRUPTS
#define LMIC_DEBUG_LEVEL 2
#define LMIC_DEBUG_PRINTF_FN lmic_printf

Set debug level to 2 and use a suitable printf function


#include <stdio.h>
#include "portable_io.h"

char Prbuf[MAXLLEN];

//将输入输出函数包出来.

void portable_puts(char* buf){
	while((*buf)!=0){
		putchar(*buf);
		buf++;
	}
}

void portable_input_int(int* val){
	portable_gets(Prbuf);
	sscanf(Prbuf, "%d", val);
}

void portable_gets(char* buf){
	gets(buf);
}

#include <stdio.h>
#include "portable_io.h"

char Prbuf[MAXLLEN];

//将输入输出函数包出来.

void portable_puts(char* buf){
	while((*buf)!=0){
		putchar(*buf);
		buf++;
	}
}

void portable_input_int(int* val){
	portable_gets(Prbuf);
	sscanf(Prbuf, "%d", val);
}

void portable_gets(char* buf){
	fgets(buf, MAXLLEN, stdin);
}

Change gets to fgets, because gets is unsafe

We had to make a pull request to a project with some unsafe C code to make it more secure. This project was the lucky one. Have fun with the security improvements :)


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

long atol_internal(const char* s)
{
  return 0;
}

float atof_internal(const char* s)
{
  return 0;
}

char * itoa (int val, char *s, int radix)
{
  *s = 0;
  return s;
}

char * ltoa (long val, char *s, int radix)
{
  *s = 0;
  return s;
}

char * utoa (unsigned int val, char *s, int radix)
{
  *s = 0;
  return s;
}

char * ultoa (unsigned long val, char *s, int radix)
{
  *s = 0;
  return s;
}

char * dtostre (double __val, char *__s, unsigned char __prec, unsigned char __flags)
{
  *__s = 0;
  return __s;
}

char * dtostrf (double __val, signed char __width, unsigned char __prec, char *__s)
{
   *__s = 0;
   return __s;
}

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

extern int ets_sprintf(char*, const char*, ...);

#define sprintf ets_sprintf

long atol_internal(const char* s)
{
  long result = 0;
  return result;
}

float atof_internal(const char* s)
{
  float result = 0;
  return result;
}

char * itoa (int val, char *s, int radix)
{
  // todo: radix
  sprintf(s, "%d", val);
  return s;
}

char * ltoa (long val, char *s, int radix)
{
  sprintf(s, "%ld", val);
  return s;
}

char * utoa (unsigned int val, char *s, int radix)
{
  sprintf(s, "%u", val);
  return s;
}

char * ultoa (unsigned long val, char *s, int radix)
{
  sprintf(s, "%lu", val);
  return s;
}

char * dtostre (double __val, char *__s, unsigned char __prec, unsigned char __flags)
{
  *__s = 0;
  return __s;
}

char * dtostrf (double __val, signed char __width, unsigned char __prec, char *__s)
{
   *__s = 0;
   return __s;
}

Add stubs for itoa, ltoa

Add stubs for itoa, ltoa


//===-- llvm/Bytecode/Reader.h - Reader for VM bytecode files ----*- C++ -*--=//
//
// This functionality is implemented by the lib/Bytecode/Reader library.
// This library is used to read VM bytecode files from an iostream.
//
// Note that performance of this library is _crucial_ for performance of the
// JIT type applications, so we have designed the bytecode format to support
// quick reading.
//
//===----------------------------------------------------------------------===//

#ifndef LLVM_BYTECODE_READER_H
#define LLVM_BYTECODE_READER_H

#include <string>
#include <vector>

class Module;

// Parse and return a class...
//
Module *ParseBytecodeFile(const std::string &Filename,
                          std::string *ErrorStr = 0);
Module *ParseBytecodeBuffer(const unsigned char *Buffer, unsigned BufferSize,
                            std::string *ErrorStr = 0);

// ReadArchiveFile - Read bytecode files from the specfied .a file, returning
// true on error, or false on success.
//
bool ReadArchiveFile(const std::string &Filename, std::vector<Module*> &Objects,
                     std::string *ErrorStr = 0);

#endif

//===-- llvm/Bytecode/Reader.h - Reader for VM bytecode files ----*- C++ -*--=//
//
// This functionality is implemented by the lib/Bytecode/Reader library.
// This library is used to read VM bytecode files from an iostream.
//
// Note that performance of this library is _crucial_ for performance of the
// JIT type applications, so we have designed the bytecode format to support
// quick reading.
//
//===----------------------------------------------------------------------===//

#ifndef LLVM_BYTECODE_READER_H
#define LLVM_BYTECODE_READER_H

#include <string>
#include <vector>

class Module;

// Parse and return a class...
//
Module *ParseBytecodeFile(const std::string &Filename,
                          std::string *ErrorStr = 0);
Module *ParseBytecodeBuffer(const unsigned char *Buffer, unsigned BufferSize,
                            const std::string &ModuleID,
                            std::string *ErrorStr = 0);

// ReadArchiveFile - Read bytecode files from the specfied .a file, returning
// true on error, or false on success.
//
bool ReadArchiveFile(const std::string &Filename, std::vector<Module*> &Objects,
                     std::string *ErrorStr = 0);

#endif

Add information about the module source

Add information about the module source

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


/* Copyright 2017 The primitiv Authors. All Rights Reserved. */

#ifndef PRIMITIV_C_API_H_
#define PRIMITIV_C_API_H_

#include <primitiv/config.h>

#include <primitiv/c/graph.h>
#include <primitiv/c/initializer_impl.h>
#include <primitiv/c/model.h>
#include <primitiv/c/naive_device.h>
#include <primitiv/c/functions.h>
#include <primitiv/c/parameter.h>
#include <primitiv/c/shape.h>
#include <primitiv/c/status.h>
#include <primitiv/c/tensor.h>
#include <primitiv/c/optimizer_impl.h>

// Header files for specific device classes.
#ifdef PRIMITIV_USE_EIGEN
#include <primitiv/c/eigen_device.h>
#endif  // PRIMITIV_USE_EIGEN
#ifdef PRIMITIV_USE_CUDA
#include <primitiv/c/cuda_device.h>
#endif  // PRIMITIV_USE_CUDA
#ifdef PRIMITIV_USE_OPENCL
#include <primitiv/c/opencl_device.h>

#endif  // PRIMITIV_C_API_H_

/* Copyright 2017 The primitiv Authors. All Rights Reserved. */

#ifndef PRIMITIV_C_API_H_
#define PRIMITIV_C_API_H_

#include <primitiv/config.h>

#include <primitiv/c/graph.h>
#include <primitiv/c/initializer_impl.h>
#include <primitiv/c/model.h>
#include <primitiv/c/naive_device.h>
#include <primitiv/c/functions.h>
#include <primitiv/c/parameter.h>
#include <primitiv/c/shape.h>
#include <primitiv/c/status.h>
#include <primitiv/c/tensor.h>
#include <primitiv/c/optimizer_impl.h>

// Header files for specific device classes.
#ifdef PRIMITIV_USE_EIGEN
#include <primitiv/c/eigen_device.h>
#endif  // PRIMITIV_USE_EIGEN
#ifdef PRIMITIV_USE_CUDA
#include <primitiv/c/cuda_device.h>
#endif  // PRIMITIV_USE_CUDA
#ifdef PRIMITIV_USE_OPENCL
#include <primitiv/c/opencl_device.h>
#endif  // PRIMITIV_USE_OPENCL

#endif  // PRIMITIV_C_API_H_

Add endif statement to the C API header.


//
//  NSURL+Pinmark.h
//  Pinmark
//
//  Created by Kyle Stevens on 12/24/13.
//  Copyright (c) 2013 kilovolt42. All rights reserved.
//

#import <Foundation/Foundation.h>

@interface NSURL (Pinmark)

- (NSDictionary *)queryParameters;

@end

//
//  NSURL+Pinmark.h
//  Pinmark
//
//  Created by Kyle Stevens on 12/24/13.
//  Copyright (c) 2013 kilovolt42. All rights reserved.
//

#import <Foundation/Foundation.h>

@interface NSURL (Pinmark)

/**
 * Creates a dictionary of the query parameters in which fields are keys for the corresponding values.
 * Does not support array parameters at this time.
 *
 * @return A dictionary of query parameters.
 */
- (NSDictionary *)queryParameters;

@end

Add documentation for NSURL category

Add documentation for NSURL category


/* ENESIM - Direct Rendering Library
 * Copyright (C) 2007-2011 Jorge Luis Zapata
 *
 * 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 ENESIM_RECTANGLE_H_
#define ENESIM_RECTANGLE_H_
/**
 * @defgroup Enesim_Rectangle_Group Rectangle
 * @{
 * @todo
 */

typedef struct _Enesim_Rectangle
{
	double x;
	double y;
	double w;
	double h;
} Enesim_Rectangle;

/**
 * @}
 */
#endif

Add a rectangle definition for enesim

Add a rectangle definition for enesim


#ifndef QBLOWFISH_H
#define QBLOWFISH_H

#include <QByteArray>

class QBlowfish
{
public:
    QBlowfish(const QByteArray &key);
    bool init();

    // Padding:
    //
    // Blowfish works on 8-byte blocks. Padding makes it usable even
    // in case where the input size is not in exact 8-byte blocks.
    //
    // If padding is disabled (the default), encrypt() will work only if the
    // input size (in bytes) is a multiple of 8. (If it's not a multiple of 8,
    // encrypt() will return a null bytearray.)
    //
    // If padding is enabled, we increase the input length to a multiple of 8
    // by padding bytes as per PKCS5
    //
    // If padding was enabled during encryption, it should be enabled during
    // decryption for correct decryption (and vice versa).

    void setPaddingEnabled(bool enabled);
    bool paddingEnabled() const;

    // Encrypt / decrypt
    QByteArray encrypted(const QByteArray &clearText);
    QByteArray decrypted(const QByteArray &cipherText);

private:
    // core encrypt/decrypt methods, encrypts/decrypts in-place
    void coreEncrypt(char *x);
    void coreDecrypt(char *x);

    QByteArray m_key;
    bool m_initialized;
    bool m_paddingEnabled;
    QByteArray m_parray;
    QByteArray m_sbox1, m_sbox2, m_sbox3, m_sbox4;
};

#endif // QBLOWFISH_H

#ifndef QBLOWFISH_H
#define QBLOWFISH_H

#include <QByteArray>

class QBlowfish
{
public:
    QBlowfish(const QByteArray &key);
    bool init();

    // Padding:
    //
    // Blowfish works on 8-byte blocks. Padding makes it usable even
    // in case where the input size is not in exact 8-byte blocks.
    //
    // If padding is disabled (the default), encrypted() will work only if the
    // input size (in bytes) is a multiple of 8. (If it's not a multiple of 8,
    // encrypted() will return a null bytearray.)
    //
    // If padding is enabled, we increase the input length to a multiple of 8
    // by padding bytes as per PKCS5
    //
    // If padding was enabled during encryption, it should be enabled during
    // decryption for correct decryption (and vice versa).

    void setPaddingEnabled(bool enabled);
    bool paddingEnabled() const;

    // Encrypt / decrypt
    QByteArray encrypted(const QByteArray &clearText);
    QByteArray decrypted(const QByteArray &cipherText);

private:
    // core encrypt/decrypt methods, encrypts/decrypts in-place
    void coreEncrypt(char *x);
    void coreDecrypt(char *x);

    QByteArray m_key;
    bool m_initialized;
    bool m_paddingEnabled;
    QByteArray m_parray;
    QByteArray m_sbox1, m_sbox2, m_sbox3, m_sbox4;
};

#endif // QBLOWFISH_H

Fix comment to reflect the change in the function name


#ifndef __VARIABLE_H__
#define __VARAIBLE_H__

typedef struct
{
  double weight;
  double sum;
  double sum2;
} Variable;

#define VARIABLE_INIT { 0.0, 0.0, 0.0 }

void   variable_init               (Variable *variable);
void   variable_add_weighted       (Variable *variable,
                                    double    value,
                                    double    weight);
void   variable_add                (Variable *variable,
                                    double    value);
double variable_mean               (Variable *variable);
double variable_standard_deviation (Variable *variable);
void   variable_reset              (Variable *variable);

#endif /* __VARIABLE_H__ */

#ifndef __VARIABLE_H__
#define __VARIABLE_H__

typedef struct
{
  double weight;
  double sum;
  double sum2;
} Variable;

#define VARIABLE_INIT { 0.0, 0.0, 0.0 }

void   variable_init               (Variable *variable);
void   variable_add_weighted       (Variable *variable,
                                    double    value,
                                    double    weight);
void   variable_add                (Variable *variable,
                                    double    value);
double variable_mean               (Variable *variable);
double variable_standard_deviation (Variable *variable);
void   variable_reset              (Variable *variable);

#endif /* __VARIABLE_H__ */

Fix another header guard oversight

Fix another header guard oversight

Pointed out in https://bugzilla.gnome.org/show_bug.cgi?id=741252


Add some more acpi event types that we will handle.

SVN revision: 48916


#include<pthread.h>

extern void foo(int (*callback)());

int glob;
pthread_mutex_t mutex1 = PTHREAD_MUTEX_INITIALIZER;
pthread_mutex_t mutex2 = PTHREAD_MUTEX_INITIALIZER;

void *t_fun(void *arg) {
  pthread_mutex_lock(&mutex2);
  glob=glob+1; // RACE!
  pthread_mutex_unlock(&mutex2);
  return NULL;
}

int bar() {
  pthread_mutex_lock(&mutex1);
  glob=glob+1; // RACE!
  pthread_mutex_unlock(&mutex1);
  return 0;
}

int main() {
  pthread_t id;
  pthread_create(&id, NULL, t_fun, NULL);
  foo(bar);
  pthread_join (id, NULL);
  return 0;
}

Add regression test for extern function calling/spawning function pointer argument

04/19 previously used custom_libc although that was actually unnecessary.


#include <stdio.h>

int main(void) {

	return(0);
}

#include <stdio.h>
#include <stdlib.h>
#include <sys/ioctl.h>
#include <ncurses.h>

struct winsize terminalSize;

void initScreen(void) {
	initscr();
	noecho();
	nocbreak();
}

void closeScreen(void) {
	endwin();
}

void getScreenSize(void) {
	if (ioctl(0, TIOCGWINSZ, (char *) &terminalSize) < 0) {
		printf("The program canno't determine terminal size.\r\n\r\n");
		exit(1);
	}
}

int main(void) {
	initScreen();
	getScreenSize();
	move(10,10);
	printw("Terminal size is %dx%d", terminalSize.ws_col, terminalSize.ws_row);
	getch();
	closeScreen();
	return(0);
}

Add the initial NCurses support for the program.


int main() {
  // Issue: 3: error: operand of increment operator not a modifiable lvalue
  4--;

  int array[5];
  // Issue: 7: error: operand of increment operator not a modifiable lvalue
  array--;
}

Add incr decr error test

Add incr decr error test


/**
 * File:   control.h
 * Author: Alex Savarda
 */

#ifndef CONTROL_H
#define CONTROL_H

typedef struct {
    unsigned int d_srcA;
    unsigned int d_srcB;
    unsigned int E_dstM;
    unsigned int e_Cnd;
    unsigned int D_icode;
    unsigned int E_icode;
    unsigned int M_icode;
} controlType;

#endif /* CONTROL_H */

/*
 * File:   control.h
 * Author: Alex Savarda
 */

#ifndef CONTROL_H
#define CONTROL_H

typedef struct {
    unsigned int d_srcA;
    unsigned int d_srcB;
    unsigned int E_dstM;
    unsigned int e_Cnd;
    unsigned int D_icode;
    unsigned int E_icode;
    unsigned int M_icode;
} controlType;

#endif /* CONTROL_H */

Change header to C style.

Change header to C style.


// System
#include <unistd.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>

// Preprocessed
#define PROGRAM_EXEC 0
#define COMMAND 1
#define MACHINE_NAME 2

// Commands
#define LIST_COMMAND "list"

void list_machines() {
  fprintf(stdout, "Here be a list of machines:\n");
  fprintf(stdout, " - default\n");
  fprintf(stdout, " - different\n");
}

void usage(char **argv) {
  fprintf(stderr, "Usage: %s <command> <virtual-machine-name> \n", argv[PROGRAM_EXEC]);
}

void run_command(char *command, char *machine_name) {
  fprintf(stdout, "%s machine %s\n", command, machine_name);
}

int main(int argc, char **argv) {
  if (argv[MACHINE_NAME] && argv[COMMAND]) {
    run_command(argv[COMMAND], argv[MACHINE_NAME]);
  } else {
    list_machines();
    usage(argv);
    exit(EXIT_FAILURE);
  }
  exit(EXIT_SUCCESS);
}

/**
 * xhyve-manager
 * a simple CLI utility to manage xhyve virtual machines.
 **/

// System
#include <unistd.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>

// Preprocessed
#define PROGRAM_EXEC 0
#define COMMAND 1
#define MACHINE_NAME 2

// Valid Commands
char *commands[] = {
  "list",
  "create",
  "delete",
  "start"
};

void list_machines() {
  fprintf(stdout, "Here be a list of machines:\n");
  fprintf(stdout, " - default\n");
  fprintf(stdout, " - different\n");
}

void usage(char **argv) {
  fprintf(stderr, "Usage: %s <command> <virtual-machine-name> \n", argv[PROGRAM_EXEC]);
}

void run_command(char *command, char *machine_name) {
  fprintf(stdout, "%s machine %s\n", command, machine_name);
}

int main(int argc, char **argv) {
  if (argv[MACHINE_NAME] && argv[COMMAND]) {
    run_command(argv[COMMAND], argv[MACHINE_NAME]);
  } else if (!argv[MACHINE_NAME] && argv[COMMAND]) {
    list_machines();
  } else {
    usage(argv);
    exit(EXIT_FAILURE);
  }
  exit(EXIT_SUCCESS);
}

Add array of valid commands.

Add array of valid commands.


// RUN: %llvmgcc %s -S -emit-llvm -o - | FileCheck %s

// rdar://7270273
void foo() __attribute__((aligned (64)));
void foo() {
// CHECK: define void @foo() {{.*}} align 64
}

Test case for aligned attribute on function declaration.

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


/*
 * cocos2d for iPhone: http://www.cocos2d-iphone.org
 *
 * Copyright (c) 2013 Apportable Inc.
 *
 * 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.
 */

// Cocos2d-UI
#import "CCControl.h"
#import "CCButton.h"
#import "CCScrollView.h"
#import "CCTableView.h"
#import "CCTextField.h"

// CCBReader
#import "CCBuilderReader.h"

/*
 * cocos2d for iPhone: http://www.cocos2d-iphone.org
 *
 * Copyright (c) 2013 Apportable Inc.
 *
 * 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.
 */

// Cocos2d-UI
#import "CCControl.h"
#import "CCButton.h"
#import "CCScrollView.h"
#import "CCTableView.h"
#import "CCTextField.h"
#import "CCSlider.h"

// CCBReader
#import "CCBuilderReader.h"

Add CCSlider to the UI headers

Add CCSlider to the UI headers

Former-commit-id: ea90510d6f80d76b2f53ba1e2bc469e9304eb642


extern void __VERIFIER_error() __attribute__ ((__noreturn__));
extern int __VERIFIER_nondet_int();
void __VERIFIER_assert(int cond) {
    if (!(cond)) {
        ERROR: __VERIFIER_error();
    }
    return;
}

void fun()
{
    int i; // Ultimate can't handle i declared in for
    for (i = 1; i < 1000; i += 2)
    {
        __VERIFIER_assert(i < 2000);
    }
    // Ultimate benefits from cycle invariant: i % 2 == 1
    __VERIFIER_assert(i == 1001);
}

int main()
{
    fun();
    return 0;
}

Add Vesal's oddness cycle invariant example


/*
 * Copyright (C) 2011 The Android Open Source Project
 *
 * 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 ART_SRC_UTILS_LLVM_H_
#define ART_SRC_UTILS_LLVM_H_

#include "base/stringprintf.h"

#include <llvm/Analysis/Verifier.h>

#include <stdint.h>
#include <string>

namespace art {

#ifndef NDEBUG
#define VERIFY_LLVM_FUNCTION(func) llvm::verifyFunction(func, llvm::PrintMessageAction)
#else
#define VERIFY_LLVM_FUNCTION(func)
#endif

inline static std::string ElfFuncName(uint32_t idx) {
  return StringPrintf("Art%u", static_cast<unsigned int>(idx));
}

class CStringLessThanComparator {
 public:
  bool operator()(const char* lhs, const char* rhs) const {
    return (strcmp(lhs, rhs) < 0);
  }
};

}  // namespace art

#endif  // ART_SRC_UTILS_LLVM_H_

/*
 * Copyright (C) 2011 The Android Open Source Project
 *
 * 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 ART_SRC_UTILS_LLVM_H_
#define ART_SRC_UTILS_LLVM_H_

#include "base/stringprintf.h"

#include <llvm/Analysis/Verifier.h>

#include <stdint.h>
#include <string>

namespace art {

#ifndef NDEBUG
#define VERIFY_LLVM_FUNCTION(func) llvm::verifyFunction(func, llvm::AbortProcessAction)
#else
#define VERIFY_LLVM_FUNCTION(func)
#endif

inline static std::string ElfFuncName(uint32_t idx) {
  return StringPrintf("Art%u", static_cast<unsigned int>(idx));
}

class CStringLessThanComparator {
 public:
  bool operator()(const char* lhs, const char* rhs) const {
    return (strcmp(lhs, rhs) < 0);
  }
};

}  // namespace art

#endif  // ART_SRC_UTILS_LLVM_H_

Abort LLVM in debug builds when the IR doesn't verify.

Change-Id: I71a035b260c895adde21ba90c84afa1f0b0ec997


#include "mode.h"

#include <ctype.h>
#include <termbox.h>

#include "buffer.h"
#include "gap.h"
#include "editor.h"

static void insert_mode_entered(editor_t *editor) {
  editor_status_msg(editor, "-- INSERT --");
}

static void insert_mode_key_pressed(editor_t* editor, struct tb_event* ev) {
  buffer_t *buffer = editor->window->buffer;
  gapbuf_t *gb = buffer->text;
  int *cursor = &editor->window->cursor;
  char ch;
  switch (ev->key) {
  case TB_KEY_ESC: case TB_KEY_CTRL_C:
    editor_status_msg(editor, "");
    editor_pop_mode(editor);
    return;
  case TB_KEY_BACKSPACE2:
    if (cursor > 0) {
      gb_del(gb, 1, (*cursor)--);
      buffer->dirty = 1;
    }
    return;
  case TB_KEY_ENTER: ch = '\n'; break;
  case TB_KEY_SPACE: ch = ' '; break;
  default: ch = ev->ch; break;
  }
  gb_putchar(gb, ch, (*cursor)++);
  buffer->dirty = 1;
}

static editing_mode_t impl = {
  insert_mode_entered,
  insert_mode_key_pressed
};

editing_mode_t *insert_mode(void) {
  return &impl;
}

#include "mode.h"

#include <ctype.h>
#include <termbox.h>

#include "buffer.h"
#include "gap.h"
#include "editor.h"

static void insert_mode_entered(editor_t *editor) {
  editor_status_msg(editor, "-- INSERT --");
}

static void insert_mode_key_pressed(editor_t* editor, struct tb_event* ev) {
  buffer_t *buffer = editor->window->buffer;
  gapbuf_t *gb = buffer->text;
  int *cursor = &editor->window->cursor;
  char ch;
  switch (ev->key) {
  case TB_KEY_ESC: case TB_KEY_CTRL_C:
    editor_status_msg(editor, "");
    editor_pop_mode(editor);
    return;
  case TB_KEY_BACKSPACE2:
    if (*cursor > 0) {
      gb_del(gb, 1, (*cursor)--);
      buffer->dirty = 1;
    }
    return;
  case TB_KEY_ENTER: ch = '\n'; break;
  case TB_KEY_SPACE: ch = ' '; break;
  default: ch = ev->ch; break;
  }
  gb_putchar(gb, ch, (*cursor)++);
  buffer->dirty = 1;
}

static editing_mode_t impl = {
  insert_mode_entered,
  insert_mode_key_pressed
};

editing_mode_t *insert_mode(void) {
  return &impl;
}

Fix backspace at start of file.

Fix backspace at start of file.


#pragma once

#include "PcapDeclarations.h"

namespace PcapDotNet { namespace Core
{
    /// <summary>
    /// Statistics on capture from the start of the run.
    /// </summary>
    public ref class PacketTotalStatistics sealed : System::IEquatable<PacketTotalStatistics^>
    {
    public:
        /// <summary>
        /// Number of packets transited on the network.
        /// </summary>
        property unsigned int PacketsReceived
        {
            unsigned int get();
        }

        /// <summary>
        /// Number of packets dropped by the driver.
        /// </summary>
        property unsigned int PacketsDroppedByDriver
        {
            unsigned int get();
        }

        /// <summary>
        /// Number of packets dropped by the interface.
        /// Not yet supported.
        /// </summary>
        property unsigned int PacketsDroppedByInterface
        {
            unsigned int get();
        }

        /// <summary>
        /// Win32 specific. Number of packets captured, i.e number of packets that are accepted by the filter, that find place in the kernel buffer and therefore that actually reach the application.
        /// </summary>
        property unsigned int PacketsCaptured
        {
            unsigned int get();
        }

        virtual bool Equals(PacketTotalStatistics^ other);
        virtual bool Equals(System::Object^ obj) override;

        virtual int GetHashCode() override;

        virtual System::String^ ToString() override;

    internal:
        PacketTotalStatistics(const pcap_stat& statistics, int statisticsSize);

    private:
        unsigned int _packetsReceived;
        unsigned int _packetsDroppedByDriver;
        unsigned int _packetsDroppedByInterface;
        unsigned int _packetsCaptured;
    };
}}

#pragma once

#include "PcapDeclarations.h"

namespace PcapDotNet { namespace Core
{
    /// <summary>
    /// Statistics on capture from the start of the run.
    /// </summary>
    public ref class PacketTotalStatistics sealed : System::IEquatable<PacketTotalStatistics^>
    {
    public:
        /// <summary>
        /// Number of packets transited on the network.
        /// </summary>
        property unsigned int PacketsReceived
        {
            unsigned int get();
        }

        /// <summary>
        /// Number of packets dropped by the driver.
        /// </summary>
        property unsigned int PacketsDroppedByDriver
        {
            unsigned int get();
        }

        // TODO: Update documentation when support is added.
        /// <summary>
        /// Number of packets dropped by the interface.
        /// Not yet supported.
        /// </summary>
        property unsigned int PacketsDroppedByInterface
        {
            unsigned int get();
        }

        /// <summary>
        /// Win32 specific. Number of packets captured, i.e number of packets that are accepted by the filter, that find place in the kernel buffer and therefore that actually reach the application.
        /// </summary>
        property unsigned int PacketsCaptured
        {
            unsigned int get();
        }

        virtual bool Equals(PacketTotalStatistics^ other);
        virtual bool Equals(System::Object^ obj) override;

        virtual int GetHashCode() override;

        virtual System::String^ ToString() override;

    internal:
        PacketTotalStatistics(const pcap_stat& statistics, int statisticsSize);

    private:
        unsigned int _packetsReceived;
        unsigned int _packetsDroppedByDriver;
        unsigned int _packetsDroppedByInterface;
        unsigned int _packetsCaptured;
    };
}}

Add a TODO to update PacketsDroppedByInterface documentation when it gets supported.


#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <netinet/in.h>
#include <resolv.h>

int check_mx(char *domain)
{
  u_char nsbuf[4096];
  return res_query(domain, ns_c_any, ns_t_mx, nsbuf, sizeof (nsbuf)) > 0;
}

#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <netinet/in.h>
#include <resolv.h>

int check_mx(char *domain)
{
  u_char nsbuf[4096];
  return res_query(domain, ns_c_in, ns_t_mx, nsbuf, sizeof (nsbuf)) > 0;
}

Use C_IN for class of information

Use C_IN for class of information


lib: Add macro for defining memory-mapped registers.


/*
 * Supemeca Never Dies 2017
 * \file Motor.h
 * \date 17/03/2017
 * \author Romain Reignier
 */

#pragma once

#include "hal.h"

#include "Motors.h"

class Motor
{
  friend class Motors;
public:
  enum eDirection
  {
    FORWARD,
    BACKWARD
  };
  static constexpr uint32_t kPwmFrequency{1000000};
  static constexpr uint16_t kPwmPeriod{125};
  // TODO: change direction security, not too often
  Motor(PWMDriver* _driver, const uint8_t _channel,
        bool _isComplementaryChannel = false);
  void begin();
  void stop();
  void pwm(int16_t _percentage);
  void pwmI(int16_t _percentage);
  virtual void brake() = 0;
  virtual void changeDirection(eDirection _direction) = 0;
  virtual void setOutputPinsMode() = 0;

protected:
  PWMDriver* m_driver;
  uint8_t m_channel;
  bool m_isComplementaryChannel;
  PWMConfig m_pwmCfg;
};

/*
 * Supemeca Never Dies 2017
 * \file Motor.h
 * \date 17/03/2017
 * \author Romain Reignier
 */

#pragma once

#include "hal.h"

#include "Motors.h"

class Motor
{
  friend class Motors;
public:
  enum eDirection
  {
    FORWARD,
    BACKWARD
  };
  static constexpr uint32_t kPwmFrequency{10000};
  static constexpr uint16_t kPwmPeriod{20};
  Motor(PWMDriver* _driver, const uint8_t _channel,
        bool _isComplementaryChannel = false);
  void begin();
  void stop();
  void pwm(int16_t _percentage);
  void pwmI(int16_t _percentage);
  virtual void brake() = 0;
  virtual void changeDirection(eDirection _direction) = 0;
  virtual void setOutputPinsMode() = 0;

protected:
  PWMDriver* m_driver;
  uint8_t m_channel;
  bool m_isComplementaryChannel;
  PWMConfig m_pwmCfg;
};

Reduce PWM frequency to 500 Hz.

Reduce PWM frequency to 500 Hz.


//
//  PureLayout.h
//  v2.0.2
//  https://github.com/smileyborg/PureLayout
//
//  Copyright (c) 2014 Tyler Fox
//
//  This code is distributed under the terms and conditions of the MIT license.
//
//  Permission is hereby granted, free of charge, to any person obtaining a copy
//  of this software and associated documentation files (the "Software"), to
//  deal in the Software without restriction, including without limitation the
//  rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
//  sell copies of the Software, and to permit persons to whom the Software is
//  furnished to do so, subject to the following conditions:
//
//  The above copyright notice and this permission notice shall be included in
//  all copies or substantial portions of the Software.
//
//  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
//  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
//  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
//  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
//  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
//  FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
//  IN THE SOFTWARE.
//

#ifndef PureLayout_h
#define PureLayout_h

#import "ALView+PureLayout.h"
#import "NSArray+PureLayout.h"
#import "NSLayoutConstraint+PureLayout.h"

#endif /* PureLayout_h */

Add newline to end of file

Add newline to end of file


// Filename: config_lui.h
// Created by:  tobspr (28Aug14)
//

#ifndef CONFIG_LUI_H
#define CONFIG_LUI_H

#include "pandabase.h"
#include "notifyCategoryProxy.h"
#include "dconfig.h"

// It is convenient to put these here for now.
// #if (defined(WIN32_VC) || defined(WIN64_VC)) && !defined(CPPPARSER) && !defined(LINK_ALL_STATIC)
// #ifdef BUILDING_LUI
//   #define EXPCL_LUI __declspec(dllexport)
//   #define EXPTP_LUI
// #else
//   #define EXPCL_LUI __declspec(dllimport)
//   #define EXPTP_LUI extern
// #endif
// #else
// #endif
#define EXPCL_LUI
#define EXPTP_LUI

ConfigureDecl(config_lui, EXPCL_LUI, EXPTP_LUI);
NotifyCategoryDecl(lui, EXPCL_LUI, EXPTP_LUI);

extern EXPCL_LUI void init_lui();

#endif

// Filename: config_lui.h
// Created by:  tobspr (28Aug14)
//

#ifndef CONFIG_LUI_H
#define CONFIG_LUI_H

#include "pandabase.h"
#include "notifyCategoryProxy.h"
#include "dconfig.h"

#define EXPCL_LUI EXPORT_CLASS
#define EXPTP_LUI EXPORT_TEMPL

ConfigureDecl(config_lui, EXPCL_LUI, EXPTP_LUI);
NotifyCategoryDecl(lui, EXPCL_LUI, EXPTP_LUI);

extern EXPCL_LUI void init_lui();

#endif

Fix compilation on Linux with latest 1.10


// @(#)root/base:$Id$
// Author: Fons Rademakers   9/5/2007

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

#ifndef ROOT_TVersionCheck
#define ROOT_TVersionCheck

//////////////////////////////////////////////////////////////////////////
//                                                                      //
// TVersionCheck                                                        //
//                                                                      //
// Used to check if the shared library or plugin is compatible with     //
// the current version of ROOT.                                         //
//                                                                      //
//////////////////////////////////////////////////////////////////////////

#ifdef R__CXXMODULES
#ifndef ROOT_TObject
#error "Building with modules currently requires this file to be #included through TObject.h"
#endif
#endif // R__CXXMODULES

#include "RVersion.h"

class TVersionCheck {
public:
   TVersionCheck(int versionCode);  // implemented in TSystem.cxx
};

// FIXME: Due to a modules bug: https://llvm.org/bugs/show_bug.cgi?id=31056
// our .o files get polluted with the gVersionCheck symbol despite it was not
// visible in this TU.
#ifndef R__CXXMODULES
#ifndef __CINT__
static TVersionCheck gVersionCheck(ROOT_VERSION_CODE);
#endif
#endif

#endif

// @(#)root/base:$Id$
// Author: Fons Rademakers   9/5/2007

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

#ifndef ROOT_TVersionCheck
#define ROOT_TVersionCheck

//////////////////////////////////////////////////////////////////////////
//                                                                      //
// TVersionCheck                                                        //
//                                                                      //
// Used to check if the shared library or plugin is compatible with     //
// the current version of ROOT.                                         //
//                                                                      //
//////////////////////////////////////////////////////////////////////////

#ifdef R__CXXMODULES
#ifndef ROOT_TObject
#error "Building with modules currently requires this file to be #included through TObject.h"
#endif
#endif // R__CXXMODULES

#include "RVersion.h"

class TVersionCheck {
public:
   TVersionCheck(int versionCode);  // implemented in TSystem.cxx
};

// FIXME: Due to a modules bug: https://llvm.org/bugs/show_bug.cgi?id=31056
// our .o files get polluted with the gVersionCheck symbol despite it was not
// visible in this TU.
#ifndef R__CXXMODULES
#ifndef __CINT__
namespace ROOT {
static TVersionCheck gVersionCheck(ROOT_VERSION_CODE);
}
#endif
#endif

#endif

Move gVersionCheck into `ROOT::` (ROOT-10426):

This avoids deserializing the declaration when iterating over globals,
which in turn avoids jitting the global needed by static init.


struct stack_node {
    struct stack_node *cdr;
    int data;
    char type;
}

struct subroutine {
    struct stack_node *nodes;
    int num_nodes;
}

#define T_INT 0
#define T_CHAR 1
#define T_SBRTN 2

struct stack_node {
    struct stack_node *cdr;
    union node_data data;
}

union node_data {
    struct subroutine srtine;
    int numval;
    char type;
}

struct subroutine {
    struct stack_node *nodes;
    int num_nodes;
}

Add types, allow for subroutines.

Add types, allow for subroutines.


/*
 * Copyright (C) 2011 The Android Open Source Project
 *
 * 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 ART_SRC_UTILS_LLVM_H_
#define ART_SRC_UTILS_LLVM_H_

#include "stringprintf.h"

#include <llvm/Analysis/Verifier.h>

#include <stdint.h>
#include <string>

namespace art {

#ifndef NDEBUG
#define VERIFY_LLVM_FUNCTION(func) llvm::verifyFunction(func, llvm::PrintMessageAction)
#else
#define VERIFY_LLVM_FUNCTION(func)
#endif

inline static std::string ElfFuncName(uint16_t idx) {
  return StringPrintf("Art%u", static_cast<unsigned int>(idx));
}

class CStringLessThanComparator {
 public:
  bool operator()(const char* lhs, const char* rhs) const {
    return (strcmp(lhs, rhs) < 0);
  }
};

}  // namespace art

#endif  // ART_SRC_UTILS_LLVM_H_

/*
 * Copyright (C) 2011 The Android Open Source Project
 *
 * 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 ART_SRC_UTILS_LLVM_H_
#define ART_SRC_UTILS_LLVM_H_

#include "stringprintf.h"

#include <llvm/Analysis/Verifier.h>

#include <stdint.h>
#include <string>

namespace art {

#ifndef NDEBUG
#define VERIFY_LLVM_FUNCTION(func) llvm::verifyFunction(func, llvm::PrintMessageAction)
#else
#define VERIFY_LLVM_FUNCTION(func)
#endif

inline static std::string ElfFuncName(uint32_t idx) {
  return StringPrintf("Art%u", static_cast<unsigned int>(idx));
}

class CStringLessThanComparator {
 public:
  bool operator()(const char* lhs, const char* rhs) const {
    return (strcmp(lhs, rhs) < 0);
  }
};

}  // namespace art

#endif  // ART_SRC_UTILS_LLVM_H_

Use uint32_t for compilation unit index instead of uint16_t.

Change-Id: If89246e35c16a6b50942e0fe7dcc289234bbdfad


#ifndef EMBEDDEDHELPERLIBRARY_ISR_WRITTEN_VARIABLE_H
#define EMBEDDEDHELPERLIBRARY_ISR_WRITTEN_VARIABLE_H

#include "rvalue.h"

namespace ehl
{
	template<typename T>
	class isr_written_variable
	{
	private:
		mutable volatile bool modified;
		volatile T value;

	public:
		isr_written_variable() = default;

		isr_written_variable(T initial_value)
			:value{as_rvalue(initial_value)}
		{
		}

		isr_written_variable& operator=(isr_written_variable const& other)
		{
			value = other.value;
			modified = true;
			return *this;
		}

		isr_written_variable<T>& operator=(T new_value)
		{
			value = as_rvalue(new_value);
			modified = true;
			return *this;
		}

		operator T() const
		{
			modified = false;
			T v = value;
			while(modified)
			{
				modified = false;
				v = value;
			}
			return v;
		}
	};
}

#endif //EMBEDDEDHELPERLIBRARY_ISR_WRITTEN_VARIABLE_H

#ifndef EMBEDDEDHELPERLIBRARY_ISR_WRITTEN_VARIABLE_H
#define EMBEDDEDHELPERLIBRARY_ISR_WRITTEN_VARIABLE_H

#include "rvalue.h"

namespace ehl
{
	template<typename T>
	class isr_written_variable
	{
	private:
		mutable volatile bool modified;
		volatile T value;

	public:
		isr_written_variable() = default;

		isr_written_variable(T initial_value)
			:value{as_rvalue(initial_value)}
		{
		}

		isr_written_variable& operator=(isr_written_variable const& other)
		{
			value = other.value;
			modified = true;
			return *this;
		}

		isr_written_variable<T>& operator=(T new_value)
		{
			value = as_rvalue(new_value);
			modified = true;
			return *this;
		}

		operator T() const
		{
			while(true)
			{
				modified = false;
				T v = value;
				if(!modified)
					return v;
			}
		}
	};
}

#endif //EMBEDDEDHELPERLIBRARY_ISR_WRITTEN_VARIABLE_H

Refactor to clean up isr written variable


#ifndef OPTITRACK_WIRE_H_
#define OPTITRACK_WIRE_H_

#include <stdint.h>

typedef enum {
    NAT_PING = 0,
    NAT_PINGRESPONSE = 1,
    NAT_REQUEST = 2,
    NAT_RESPONSE = 3,
    NAT_REQUEST_MODELDEF = 4,
    NAT_MODELDEF = 5,
    NAT_REQUEST_FRAMEOFDATA = 6,
    NAT_FRAMEOFDATA = 7,
    NAT_MESSAGESTRING = 8,
    NAT_UNRECOGNIZED_REQUEST = 100
} natnet_msg_id_t;

typedef struct {
    uint16_t type;
    uint16_t sz;
} natnet_msg_header_t;

#define MAX_NAMELENGTH 256
typedef struct {
    char name[MAX_NAMELENGTH];
    char app_version[4];
    char natnet_version[4];
} natnet_sender_t;

#endif//OPTITRACK_WIRE_H_

#ifndef OPTITRACK_WIRE_H_
#define OPTITRACK_WIRE_H_

#include <stdint.h>

typedef enum {
    NAT_PING = 0,
    NAT_PINGRESPONSE = 1,
    NAT_REQUEST = 2,
    NAT_RESPONSE = 3,
    NAT_REQUEST_MODELDEF = 4,
    NAT_MODELDEF = 5,
    NAT_REQUEST_FRAMEOFDATA = 6,
    NAT_FRAMEOFDATA = 7,
    NAT_MESSAGESTRING = 8,
    NAT_UNRECOGNIZED_REQUEST = 100
} natnet_msg_id_t;

typedef struct {
    uint16_t type;
    uint16_t sz;
} natnet_msg_header_t;

#define MAX_NAMELENGTH 256
#define MAX_PACKETSIZE 100000
typedef struct {
    char name[MAX_NAMELENGTH];
    unsigned char app_version[4];
    unsigned char natnet_version[4];
} natnet_sender_t;

typedef struct {
    natnet_msg_header_t header;
    union {
        unsigned char   byteData [MAX_PACKETSIZE];
        unsigned int    intData  [MAX_PACKETSIZE / sizeof(unsigned int)];
        float           floatData[MAX_PACKETSIZE / sizeof(float)];
        natnet_sender_t sender;
    } data;
} natnet_packet_t;

#endif//OPTITRACK_WIRE_H_

Fix uchar vs. char in natnet_sender_t; add natnet_packet_t


//
//  LumberjackLogger.h
//  Pods
//
//  Created by jiakai lian on 29/09/2015.
//
//

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

//If you set the log level to DDLogLevelError, then you will only see Error statements.
//If you set the log level to DDLogLevelWarn, then you will only see Error and Warn statements.
//If you set the log level to DDLogLevelInfo, you'll see Error, Warn and Info statements.
//If you set the log level to DDLogLevelDebug, you'll see Error, Warn, Info and Debug statements.
//If you set the log level to DDLogLevelVerbose, you'll see all DDLog statements.
//If you set the log level to DDLogLevelOff, you won't see any DDLog statements.

#ifdef DEBUG
static const DDLogLevel ddLogLevel = DDLogLevelVerbose;
#else
static const DDLogLevel ddLogLevel = DDLogLevelWarn;
#endif

@interface LumberjackLogger : NSObject

@end

//
//  LumberjackLogger.h
//  Pods
//
//  Created by jiakai lian on 29/09/2015.
//
//

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

//If you set the log level to DDLogLevelError, then you will only see Error statements.
//If you set the log level to DDLogLevelWarn, then you will only see Error and Warn statements.
//If you set the log level to DDLogLevelInfo, you'll see Error, Warn and Info statements.
//If you set the log level to DDLogLevelDebug, you'll see Error, Warn, Info and Debug statements.
//If you set the log level to DDLogLevelVerbose, you'll see all DDLog statements.
//If you set the log level to DDLogLevelOff, you won't see any DDLog statements.

#ifdef DEBUG
static const DDLogLevel ddLogLevel = DDLogLevelVerbose;
#else
static const DDLogLevel ddLogLevel = DDLogLevelWarning;
#endif

@interface LumberjackLogger : NSObject

@end

Update the release log level

Update the release log level


#pragma once

#include <cstddef>

namespace scratch {

template<class T>
struct counted_copying_iterator {
    using value_type = T;
    using difference_type = ptrdiff_t;
    using pointer = const T *;
    using reference = const T&;
    using iterator_category = random_access_iterator_tag;

    explicit counted_copying_iterator() noexcept = default;
    explicit counted_copying_iterator(size_t c, const T& t) noexcept : m_count(c), m_t(&t) {}

    const T& operator*() const noexcept { return *m_t; }
    const T *operator->() const noexcept { return m_t; }
    const T& operator[](difference_type) const noexcept { return m_t; }

    auto& operator+=(int i) noexcept { m_count -= i; return *this; }
    auto& operator++() noexcept { return *this += 1; }
    auto operator++(int) noexcept { auto old = *this; ++*this; return old; }

    auto& operator-=(int i) noexcept { m_count += i; return *this; }
    auto& operator--() noexcept { return *this -= 1; }
    auto operator--(int) noexcept { auto old = *this; --*this; return old; }

    difference_type operator-(const counted_copying_iterator& rhs) const noexcept { return rhs.m_count - m_count; }

    bool operator==(const counted_copying_iterator& rhs) const noexcept { return m_count == rhs.m_count; }
    bool operator!=(const counted_copying_iterator& rhs) const noexcept { return m_count != rhs.m_count; }

private:
    size_t m_count = 0;
    const T *m_t = nullptr;
};

template<class T> auto operator-(counted_copying_iterator<T> a, ptrdiff_t b) noexcept { a -= b; return a; }
template<class T> auto operator+(counted_copying_iterator<T> a, ptrdiff_t b) noexcept { a += b; return a; }
template<class T> auto operator+(ptrdiff_t b, counted_copying_iterator<T> a) noexcept { a += b; return a; }

} // namespace scratch

Add a "counted copying iterator".

Add a "counted copying iterator".

Most STL containers have a method `assign(size_t, const T&)` and another
method `assign(It, It)` that works with input iterators. By creating an
iterator that yields exactly `n` copies of a `const T&`, we can make it
really easy to implement the former in terms of the latter.


#ifndef __COMMONS_H
#define __COMMONS_H

#ifdef __APPLE__
#define ENDLINE '\r'
#else
#define ENDLINE '\n'
#endif

#endif

Add line endings for Mac OS.

Add line endings for Mac OS.


#ifndef TRN_RGB_COLOR_H
#define TRN_RGB_COLOR_H

#include <stdbool.h>

typedef struct {
  float red;
  float green;
  float blue;
} TrnColor;

extern TrnColor const TRN_WHITE;
extern TrnColor const TRN_RED;
extern TrnColor const TRN_GREEN;
extern TrnColor const TRN_BLUE;
extern TrnColor const TRN_YELLOW;
extern TrnColor const TRN_ORANGE;
extern TrnColor const TRN_TURQUOISE;
extern TrnColor const TRN_PURPLE;
extern TrnColor const TRN_CYAN;

bool trn_color_equal(TrnColor const left, TrnColor const right);

#endif

#ifndef TRN_COLOR_H
#define TRN_COLOR_H

#include <stdbool.h>

typedef struct {
  float red;
  float green;
  float blue;
} TrnColor;

extern TrnColor const TRN_WHITE;
extern TrnColor const TRN_RED;
extern TrnColor const TRN_GREEN;
extern TrnColor const TRN_BLUE;
extern TrnColor const TRN_YELLOW;
extern TrnColor const TRN_ORANGE;
extern TrnColor const TRN_TURQUOISE;
extern TrnColor const TRN_PURPLE;
extern TrnColor const TRN_CYAN;

bool trn_color_equal(TrnColor const left, TrnColor const right);

#endif

Make include guard name for color.h be compliant with our standard


#include <netdb.h>

#include "asyncaddrinfo.h"
#include "peer.h"

#include "resolve.h"

void resolve_init() {
	asyncaddrinfo_init(2);
}

void resolve_cleanup() {
	asyncaddrinfo_cleanup();
}

void resolve(struct peer *peer, const char *node, const char *service, int flags) {
	struct addrinfo hints = {
		.ai_flags = AI_V4MAPPED | AI_ADDRCONFIG | flags,
		.ai_family = AF_UNSPEC,
		.ai_socktype = SOCK_STREAM,
	};

	peer->fd = asyncaddrinfo_resolve(node, service, &hints);
	peer_epoll_add(peer, EPOLLIN);
}

int resolve_result(struct peer *peer, struct addrinfo **addrs) {
	int err = asyncaddrinfo_result(peer->fd, addrs);
	peer->fd = -1;
	return err;
}

#include <netdb.h>

#include "asyncaddrinfo.h"
#include "peer.h"

#include "resolve.h"

void resolve_init() {
	asyncaddrinfo_init(2);
}

void resolve_cleanup() {
	asyncaddrinfo_cleanup();
}

void resolve(struct peer *peer, const char *node, const char *service, int flags) {
	struct addrinfo hints = {
		.ai_flags = AI_V4MAPPED | flags,
		.ai_family = AF_UNSPEC,
		.ai_socktype = SOCK_STREAM,
	};

	peer->fd = asyncaddrinfo_resolve(node, service, &hints);
	peer_epoll_add(peer, EPOLLIN);
}

int resolve_result(struct peer *peer, struct addrinfo **addrs) {
	int err = asyncaddrinfo_result(peer->fd, addrs);
	peer->fd = -1;
	return err;
}

Remove AI_ADDRCONFIG, since the netlink socket is missing CLOEXEC and gets inherited by children.


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

#define PI 3.14

float soluc (float, float);
float radians_degrees (float);
float degrees_radians (float);

Add cabecalho para as funcoes (modularizando)


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

inherit LIB_VERB;

string *query_parse_methods()
{
	return ({ "raw" });
}

void main(object actor, mapping roles)
{
	object user;
	float interval;

	user = query_user();

	if (user->query_class() < 2) {
		send_out("You do not have sufficient access rights to query the bulk sync system.\n");
		return;
	}

	send_out(BULKD->query_pending() + " objects pending.\n");
	return;
}

Add command to check bulk sync stats

Add command to check bulk sync stats


#ifndef __GTK_COMPAT_H__
#define __GTK_COMPAT_H__

#include <gtk/gtk.h>

/* Provide a compatibility layer for accessor functions introduced
 * in GTK+ 2.22 which we need to build with sealed GDK.
 * That way it is still possible to build with GTK+ 2.20.
 */

#if !GTK_CHECK_VERSION(2, 21, 0)

#define gdk_drag_context_get_actions(context)          (context)->actions
#define gdk_drag_context_get_suggested_action(context) (context)->suggested_action
#define gdk_drag_context_get_selected_action(context)  (context)->action

#endif /* GTK_CHECK_VERSION(2, 21, 0) */

#endif /* __GTK_COMPAT_H__ */

#ifndef __GTK_COMPAT_H__
#define __GTK_COMPAT_H__

#include <gtk/gtk.h>

/* Provide a compatibility layer for accessor functions introduced
 * in GTK+ 2.22 which we need to build with sealed GDK.
 * That way it is still possible to build with GTK+ 2.20.
 */

#if !GTK_CHECK_VERSION(2,21,2)

#define gdk_drag_context_get_actions(context)          (context)->actions
#define gdk_drag_context_get_suggested_action(context) (context)->suggested_action
#define gdk_drag_context_get_selected_action(context)  (context)->action

#endif /* GTK_CHECK_VERSION(2, 21, 0) */

#endif /* __GTK_COMPAT_H__ */

Set the GTK+ backward compatibility check to 2.21.2.


/*
 Copyright 2019 The Matrix.org Foundation C.I.C

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

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

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

#import <Foundation/Foundation.h>

#import "MXReplyEventParts.h"
#import "MXEvent.h"

NS_ASSUME_NONNULL_BEGIN

/**
 Reply event parser.
 */
@interface MXReplyEventParser : NSObject

- (MXReplyEventParts*)parse:(MXEvent*)replyEvent;

@end

NS_ASSUME_NONNULL_END

/*
 Copyright 2019 The Matrix.org Foundation C.I.C

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

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

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

#import <Foundation/Foundation.h>

#import "MXReplyEventParts.h"
#import "MXEvent.h"

NS_ASSUME_NONNULL_BEGIN

/**
 Reply event parser.
 */
@interface MXReplyEventParser : NSObject

- (nullable MXReplyEventParts*)parse:(MXEvent*)replyEvent;

@end

NS_ASSUME_NONNULL_END

Make reply parser result optional

Make reply parser result optional


//
//  Use this file to import your target's public headers that you would like to expose to Swift.
//

#import <Parse/Parse.h>
#import <Bolts/Bolts.h>
#import <AWSiOSSDKv2/AWSCore.h>
#import <AWSiOSSDKv2/S3.h>
#import <AWSiOSSDKv2/DynamoDB.h>
#import <AWSiOSSDKv2/SQS.h>
#import <AWSiOSSDKv2/SNS.h>

Add imports to Bridging Header.

Add imports to Bridging Header.


// Copied & modified from 28/42.
#include <pthread.h>
#include <assert.h>

int g1,g2;
pthread_mutex_t mutex1 = PTHREAD_MUTEX_INITIALIZER;
pthread_mutex_t mutex2 = PTHREAD_MUTEX_INITIALIZER;
pthread_mutex_t __global_lock = PTHREAD_MUTEX_INITIALIZER;

void *t_fun(void *arg) {
  pthread_mutex_lock(&mutex1);
  pthread_mutex_lock(&__global_lock);
  g1++;
  pthread_mutex_unlock(&__global_lock);
  pthread_mutex_lock(&__global_lock);
  g1--;
  pthread_mutex_unlock(&__global_lock);
  pthread_mutex_unlock(&mutex1);

  pthread_mutex_lock(&mutex2);
  pthread_mutex_lock(&__global_lock);
  g2++;
  pthread_mutex_unlock(&__global_lock);
  pthread_mutex_lock(&__global_lock);
  g2--;
  pthread_mutex_unlock(&__global_lock);
  pthread_mutex_unlock(&mutex2);
  return NULL;
}

int main(void) {
  pthread_t id;
  pthread_create(&id, NULL, t_fun, NULL);

  pthread_mutex_lock(&mutex1);
  pthread_mutex_lock(&__global_lock);
  assert(g1 == 0);
  pthread_mutex_unlock(&__global_lock);

  pthread_mutex_lock(&mutex2);
  pthread_mutex_lock(&__global_lock);
  assert(g1 == 0);
  pthread_mutex_unlock(&__global_lock);
  pthread_mutex_lock(&__global_lock);
  assert(g2 == 0);
  pthread_mutex_unlock(&__global_lock);
  pthread_mutex_unlock(&mutex2);

  pthread_mutex_lock(&__global_lock);
  assert(g1 == 0);
  pthread_mutex_unlock(&__global_lock);
  pthread_mutex_unlock(&mutex1);

  pthread_join(id, NULL);
  return 0;
}

Add privatization test where mutex-oplus fails

Previously mutex-oplus failed on 28/42, which uses trylock.
Apparently the problem isn't trylock but multiple protecting mutexes.


#ifndef MACDOCKICONHANDLER_H
#define MACDOCKICONHANDLER_H

#include <QtCore/QObject>

class QMenu;
class QIcon;
class QWidget;
class objc_object;

/** Macintosh-specific dock icon handler.
 */
class MacDockIconHandler : public QObject
{
    Q_OBJECT
public:
    ~MacDockIconHandler();

    QMenu *dockMenu();
    void setIcon(const QIcon &icon);

    static MacDockIconHandler *instance();

    void handleDockIconClickEvent();

signals:
    void dockIconClicked();

public slots:

private:
    MacDockIconHandler();

    objc_object *m_dockIconClickEventHandler;
    QWidget *m_dummyWidget;
    QMenu *m_dockMenu;
};

#endif // MACDOCKICONCLICKHANDLER_H

#ifndef MACDOCKICONHANDLER_H
#define MACDOCKICONHANDLER_H

#include <QtCore/QObject>

class QMenu;
class QIcon;
class QWidget;

#ifdef __OBJC__
@class DockIconClickEventHandler;
#else
class DockIconClickEventHandler;
#endif

/** Macintosh-specific dock icon handler.
 */
class MacDockIconHandler : public QObject
{
    Q_OBJECT
public:
    ~MacDockIconHandler();

    QMenu *dockMenu();
    void setIcon(const QIcon &icon);

    static MacDockIconHandler *instance();

    void handleDockIconClickEvent();

signals:
    void dockIconClicked();

public slots:

private:
    MacDockIconHandler();

    DockIconClickEventHandler *m_dockIconClickEventHandler;
    QWidget *m_dummyWidget;
    QMenu *m_dockMenu;
};

#endif // MACDOCKICONCLICKHANDLER_H

Fix for legacy QT compatibility

Fix for legacy QT compatibility


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

#ifndef __MBEDTLS_DEVICE__
#define __MBEDTLS_DEVICE__

#define MBEDTLS_PLATFORM_SETUP_TEARDOWN_ALT
#define MBEDTLS_SHA1_ALT
#define MBEDTLS_SHA256_ALT
#define MBEDTLS_CCM_ALT
#define MBEDTLS_CMAC_ALT
#define MBEDTLS_ECDSA_VERIFY_ALT
#define MBEDTLS_ECDSA_SIGN_ALT
#define MBEDTLS_ECDSA_GENKEY_ALT
#define MBEDTLS_ECDH_GEN_PUBLIC_ALT
#define MBEDTLS_ECDH_COMPUTE_SHARED_ALT

#endif //__MBEDTLS_DEVICE__

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

#ifndef __MBEDTLS_DEVICE__
#define __MBEDTLS_DEVICE__

#define MBEDTLS_PLATFORM_SETUP_TEARDOWN_ALT
#define MBEDTLS_SHA1_ALT
#define MBEDTLS_SHA256_ALT
#define MBEDTLS_CCM_ALT
//#define MBEDTLS_CMAC_ALT
#define MBEDTLS_ECDSA_VERIFY_ALT
#define MBEDTLS_ECDSA_SIGN_ALT
#define MBEDTLS_ECDSA_GENKEY_ALT
#define MBEDTLS_ECDH_GEN_PUBLIC_ALT
#define MBEDTLS_ECDH_COMPUTE_SHARED_ALT

#endif //__MBEDTLS_DEVICE__

Make the alternative cmac optional

Make the alternative cmac optional

Have the alternative cmac undefined by default,
in order not to break backwards compatability.


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

#include "uv.h"

static uv_mutex_t mutex;
static uv_thread_t thread;

static int crit_data = 0;

static void thread_cb(void* arg) {
  uv_mutex_lock(&mutex);
  printf("thread mutex start\n");
  crit_data = 2;
  printf("thread mutex end\n");
  uv_mutex_unlock(&mutex);
}

int main() {
  assert(0 == uv_mutex_init(&mutex));
  assert(0 == uv_thread_create(&thread, thread_cb, NULL));

  uv_mutex_lock(&mutex);
  printf("main mutex start\n");
  sleep(1);
  crit_data = 1;
  printf("main mutex end\n");
  uv_mutex_unlock(&mutex);

  uv_thread_join(&thread);
  uv_mutex_destroy(&mutex);

  return 0;
}

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

#include "uv.h"

static uv_mutex_t mutex;
static uv_thread_t thread;

static void thread_cb(void* arg) {
  printf("thread_cb\n");
  uv_mutex_lock(&mutex);
  printf("thread mutex\n");
  uv_mutex_unlock(&mutex);
}

int main() {
  assert(0 == uv_mutex_init(&mutex));
  assert(0 == uv_thread_create(&thread, thread_cb, NULL));

  uv_mutex_lock(&mutex);
  printf("main mutex start\n");
  sleep(1);
  printf("main mutex end\n");
  uv_mutex_unlock(&mutex);

  uv_thread_join(&thread);
  uv_mutex_destroy(&mutex);

  return 0;
}

Make use of mutex easier to see

Make use of mutex easier to see

With the access to the data, the use of the actual mutex could have been
confused. By simply using the mutex the example is a lot more clear.


/**
 * @file
 * @brief Stubs for standard signals.
 *
 * @date 07.10.2013
 * @author Eldar Abusalimov
 */

#ifndef KERNEL_THREAD_SIGSTD_STUB_H_
#define KERNEL_THREAD_SIGSTD_STUB_H_

#include <errno.h>

#define SIGSTD_MIN     0
#define SIGSTD_MAX     -1

struct sigstd_data { };  /* stub */

static inline struct sigstd_data * sigstd_data_init(
		struct sigstd_data *sigstd_data) {
	return sigstd_data;
}

static inline int sigstd_raise(struct sigstd_data *data, int sig) {
	return -ENOSYS;
}

static inline void sigstd_handle(struct sigstd_data *data,
		struct sigaction *sig_table) {
	/* no-op */
}

#endif /* KERNEL_THREAD_SIGSTD_STUB_H_ */

/**
 * @file
 * @brief Stubs for standard signals.
 *
 * @date 07.10.2013
 * @author Eldar Abusalimov
 */

#ifndef KERNEL_THREAD_SIGSTD_STUB_H_
#define KERNEL_THREAD_SIGSTD_STUB_H_

#include <errno.h>
#include <signal.h>

#define SIGSTD_MIN     0
#define SIGSTD_MAX     -1

struct sigstd_data { };  /* stub */

static inline struct sigstd_data * sigstd_data_init(
		struct sigstd_data *sigstd_data) {
	return sigstd_data;
}

static inline int sigstd_raise(struct sigstd_data *data, int sig) {
	return -ENOSYS;
}

static inline void sigstd_handle(struct sigstd_data *data,
		struct sigaction *sig_table) {
	/* no-op */
}

#endif /* KERNEL_THREAD_SIGSTD_STUB_H_ */

signal: Fix stub implementation (add missing sigaction decl)