// PARAM: --enable ana.int.congruence
void unsignedCase() {
    unsigned int top;
    unsigned int i = 0;
    if(top % 17 == 3) {
        assert(top%17 ==3);
        if(top %17 != 3) {
            i = 12;
        } else {

        }
    }
    assert(i ==0);

    if(top % 17 == 0) {
        assert(top%17 == 0);
        if(top %17 != 0) {
            i = 12;
        }
    }
    assert(i == 0);

    if(top % 3 == 17) {
        assert(top%17 == 3); //UNKNOWN!
    }
}

int main() {
    int top;
    int i = 0;
    if(top % 17 == 3) {
        assert(top%17 ==3);
        if(top %17 != 3) {
            i = 12;
        } else {

        }
    }
    assert(i ==0);

    if(top % 17 == 0) {
        assert(top%17 == 0);
        if(top %17 != 0) {
            i = 12;
        }
    }
    assert(i == 0);

    if(top % 3 == 17) {
        assert(top%17 == 3); //UNKNOWN!
    }

    unsignedCase();
}

// PARAM: --enable ana.int.congruence
void unsignedCase() {
    unsigned int top;
    unsigned int i = 0;
    if(top % 17 == 3) {
        assert(top%17 ==3);
        if(top %17 != 3) {
            i = 12;
        } else {

        }
    }
    assert(i ==0);

    if(top % 17 == 0) {
        assert(top%17 == 0);
        if(top %17 != 0) {
            i = 12;
        }
    }
    assert(i == 0);

    if(top % 3 == 17) {
        // This is unreachable in the concrete!
        assert(top%17 == 3); //UNKNOWN!
    }
}

int main() {
    int top;
    int i = 0;
    if(top % 17 == 3) {
        assert(top%17 ==3);
        if(top %17 != 3) {
            i = 12;
        } else {

        }
    }
    assert(i ==0);

    if(top % 17 == 0) {
        assert(top%17 == 0);
        if(top %17 != 0) {
            i = 12;
        }
    }
    assert(i == 0);

    if(top % 3 == 17) {
        // This is unreachable in the concrete!
        assert(top%17 == 3); //UNKNOWN!
    }

    unsignedCase();
}

Add comments to confusing test

Add comments to confusing test


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

#import <Foundation/Foundation.h>

#import <ComponentKit/CKComponentInternal.h>
#import <ComponentKit/CKComponentViewConfiguration.h>

@class CKComponent;
@class UIView;

/**
 CKComponentDebugController exposes the functionality needed by the lldb helpers to control the debug behavior for
 components.
 */
@interface CKComponentDebugController : NSObject

+ (BOOL)debugMode;

/**
 Setting the debug mode enables the injection of debug configuration into the component.
 */
+ (void)setDebugMode:(BOOL)debugMode;

/**
 Components are an immutable construct. Whenever we make changes to the parameters on which the components depended,
 the changes won't be reflected in the component hierarchy until we explicitly cause a reflow/update. A reflow
 essentially rebuilds the component hierarchy and mounts it back on the view.

 This is particularly used in reflowing the component hierarchy when we set the debug mode.
 */
+ (void)reflowComponents;

@end

/** Returns an adjusted mount context that inserts a debug view if the viewConfiguration doesn't have a view. */
CK::Component::MountContext CKDebugMountContext(Class componentClass,
                                                const CK::Component::MountContext &context,
                                                const CKComponentViewConfiguration &viewConfiguration,
                                                const CGSize size);

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

#import <Foundation/Foundation.h>

#import <ComponentKit/CKComponentViewConfiguration.h>

@class CKComponent;
@class UIView;

/**
 CKComponentDebugController exposes the functionality needed by the lldb helpers to control the debug behavior for
 components.
 */
@interface CKComponentDebugController : NSObject

+ (BOOL)debugMode;

/**
 Setting the debug mode enables the injection of debug configuration into the component.
 */
+ (void)setDebugMode:(BOOL)debugMode;

/**
 Components are an immutable construct. Whenever we make changes to the parameters on which the components depended,
 the changes won't be reflected in the component hierarchy until we explicitly cause a reflow/update. A reflow
 essentially rebuilds the component hierarchy and mounts it back on the view.

 This is particularly used in reflowing the component hierarchy when we set the debug mode.
 */
+ (void)reflowComponents;

@end

/** Returns an adjusted mount context that inserts a debug view if the viewConfiguration doesn't have a view. */
CK::Component::MountContext CKDebugMountContext(Class componentClass,
                                                const CK::Component::MountContext &context,
                                                const CKComponentViewConfiguration &viewConfiguration,
                                                const CGSize size);

Fix build error when importing debug controller header


//
// Created by dar on 12/22/15.
//

#ifndef C003_CONTACTFILTER_H
#define C003_CONTACTFILTER_H

#include <Box2D/Dynamics/b2WorldCallbacks.h>
#include <Box2D/Dynamics/b2Fixture.h>
#include "../map/entity/Entity.h"

class ContactFilter : public b2ContactFilter {

    bool doesCollide(void *a, void *b) {
        bool collisionAwithB = true, collisionBwithA = true;
        if (Entity *entity = reinterpret_cast<Entity *>(a)) {
            collisionAwithB = entity->doesCollide(reinterpret_cast<IPositionable *>(b));
        }
        if (Entity *entity = reinterpret_cast<Entity *>(b)) {
            collisionBwithA = entity->doesCollide(reinterpret_cast<IPositionable *>(a));
        }
        return collisionAwithB && collisionBwithA;
    }

    virtual bool ShouldCollide(b2Fixture *fixtureA, b2Fixture *fixtureB) override {
        void *bodyDataA = fixtureA->GetBody()->GetUserData();
        void *bodyDataB = fixtureB->GetBody()->GetUserData();
        return doesCollide(bodyDataA, bodyDataB);
    }

};

#endif //C003_CONTACTFILTER_H

//
// Created by dar on 12/22/15.
//

#ifndef C003_CONTACTFILTER_H
#define C003_CONTACTFILTER_H

#include <Box2D/Dynamics/b2WorldCallbacks.h>
#include <Box2D/Dynamics/b2Fixture.h>
#include "../map/entity/Entity.h"

class ContactFilter : public b2ContactFilter {

    bool doesCollide(void *a, void *b) {
        bool collisionAwithB = true, collisionBwithA = true;
        if (Entity *entity = reinterpret_cast<Entity *>(a)) {
            collisionAwithB = entity->doesCollide(static_cast<IPositionable *>(b));
        }
        if (Entity *entity = reinterpret_cast<Entity *>(b)) {
            collisionBwithA = entity->doesCollide(static_cast<IPositionable *>(a));
        }
        return collisionAwithB && collisionBwithA;
    }

    virtual bool ShouldCollide(b2Fixture *fixtureA, b2Fixture *fixtureB) override {
        void *bodyDataA = fixtureA->GetBody()->GetUserData();
        void *bodyDataB = fixtureB->GetBody()->GetUserData();
        return doesCollide(bodyDataA, bodyDataB);
    }

};

#endif //C003_CONTACTFILTER_H

Use static_cast in void* casting

Use static_cast in void* casting


//
//  NSFileHandle+CDZCLIStringReading.h
//  CDZCLIApplication
//
//  Created by Chris Dzombak on 1/13/14.
//  Copyright (c) 2014 Chris Dzombak. All rights reserved.
//

@import Foundation;

@interface NSFileHandle (CDZCLIStringReading)

/// Read this handle's `-availableData` as a string, stripping any trailing newline.
- (NSString *)cdz_availableString;

@end

//
//  NSFileHandle+CDZCLIStringReading.h
//  CDZCLIApplication
//
//  Created by Chris Dzombak on 1/13/14.
//  Copyright (c) 2014 Chris Dzombak. All rights reserved.
//

@import Foundation;

@interface NSFileHandle (CDZCLIStringReading)

/// Read this handle's `-availableData` as a string, stripping a single trailing newline.
/// Useful with +[NSFileHandle fileHandleWithStandardInput].
- (NSString *)cdz_availableString;

@end

Update docs on cdz_availableString NSFileHandle category method


#ifndef BUFFER_H_
#define BUFFER_H_

#define BUFFER_SIZEOF_DESIRED 48

typedef struct Buffer {
    unsigned int pos;
    unsigned int size;
    char* data;
    char fixed[BUFFER_SIZEOF_DESIRED - 2*sizeof(unsigned int) - 1*sizeof(char*)];
} Buffer;

Buffer* buffer_init(Buffer* buffer, unsigned int size);
Buffer* buffer_fini(Buffer* buffer);

Buffer* buffer_wrap(Buffer* buffer, const char* data, unsigned int length);

Buffer* buffer_ensure_total(Buffer* buffer, unsigned int size);
Buffer* buffer_ensure_unused(Buffer* buffer, unsigned int size);

Buffer* buffer_reset(Buffer* buffer);
Buffer* buffer_rewind(Buffer* buffer);
Buffer* buffer_terminate(Buffer* buffer);

Buffer* buffer_append(Buffer* buffer, const char* source, unsigned int length);

#endif

#ifndef BUFFER_H_
#define BUFFER_H_

#define BUFFER_SIZEOF_DESIRED 64
typedef struct Buffer {
    unsigned int pos;
    unsigned int size;
    char* data;
    char fixed[BUFFER_SIZEOF_DESIRED - 2*sizeof(unsigned int) - 1*sizeof(char*)];
} Buffer;

Buffer* buffer_init(Buffer* buffer, unsigned int size);
Buffer* buffer_fini(Buffer* buffer);

Buffer* buffer_wrap(Buffer* buffer, const char* data, unsigned int length);

Buffer* buffer_ensure_total(Buffer* buffer, unsigned int size);
Buffer* buffer_ensure_unused(Buffer* buffer, unsigned int size);

Buffer* buffer_reset(Buffer* buffer);
Buffer* buffer_rewind(Buffer* buffer);
Buffer* buffer_terminate(Buffer* buffer);

Buffer* buffer_append(Buffer* buffer, const char* source, unsigned int length);

#endif

Increase stack array size from 48 to 64

Increase stack array size from 48 to 64


#pragma once

#define WIN32_LEAN_AND_MEAN
#include <Windows.h>

#include <malloc.h>
#include <memory.h>
#include <prsht.h>
#include <stdlib.h>
#include <tchar.h>

#include "../3RVX/3RVX.h"
#include "resource.h"

class SettingsUI : public Window {
public:
    SettingsUI(HINSTANCE hInstance);

    INT_PTR LaunchPropertySheet();

    virtual LRESULT WndProc(HWND hWnd, UINT message,
        WPARAM wParam, LPARAM lParam);

private:

};

/* Forward Declarations */
LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM);
int CALLBACK PropSheetProc(HWND hwndDlg, UINT uMsg, LPARAM lParam);

BOOL CALLBACK GeneralTabProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam);
BOOL CALLBACK DisplayTabProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam);
BOOL CALLBACK OSDTabProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam);
BOOL CALLBACK HotkeyTabProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam);
BOOL CALLBACK AboutTabProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam);

#pragma once

#define WIN32_LEAN_AND_MEAN
#include <Windows.h>

#include <malloc.h>
#include <memory.h>
#include <prsht.h>
#include <stdlib.h>
#include <tchar.h>
#include <vector>

#include "../3RVX/3RVX.h"
#include "resource.h"

class About;
class Display;
class General;
class Hotkeys;
class OSD;
class TabPage;

class SettingsUI : public Window {
public:
    SettingsUI(HINSTANCE hInstance);

    INT_PTR LaunchPropertySheet();

    virtual LRESULT WndProc(HWND hWnd, UINT message,
        WPARAM wParam, LPARAM lParam);

private:
    std::vector<TabPage *> _tabs;
    General *_general;
    Display *_display;
    OSD *_osd;
    Hotkeys *_hotkeys;
    About *_about;

private:
    /* Startup x/y location offsets */
    static const int XOFFSET = 70;
    static const int YOFFSET = 20;

};

/* Forward Declarations */
LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM);
int CALLBACK PropSheetProc(HWND hwndDlg, UINT uMsg, LPARAM lParam);

Add instance variables, remove callbacks


/* Uncomment to compile with tcpd/libwrap support. */
//#define WITH_WRAP

/* Compile with database upgrading support? If disabled, mosquitto won't
 * automatically upgrade old database versions. */
//#define WITH_DB_UPGRADE

/* Compile with memory tracking support? If disabled, mosquitto won't track
 * heap memory usage nor export '$SYS/broker/heap/current size', but will use
 * slightly less memory and CPU time. */
#define WITH_MEMORY_TRACKING

/* Compile with the ability to upgrade from old style sqlite persistent
 * databases to the new mosquitto format. This means a dependency on sqlite. It
 * isn't needed for new installations. */
#define WITH_SQLITE_UPGRADE

Add compile option for sqlite db upgrades.


/**
 * @file
 *
 * @date Nov 12, 2013
 * @author: Anton Bondarev
 */
#include <stddef.h>
#include <kernel/task.h>
#include <kernel/thread/thread_stack.h>
#include <kernel/panic.h>

struct task *task_alloc(struct task *task, size_t task_size) {
	void *addr;

	assert(task);
	assert(task->main_thread);

	addr = thread_stack_get(task->main_thread);

	if (thread_stack_reserved(task->main_thread, task_size) < 0) {
		panic("Too small thread stack size");
	}

	return addr;
}

taskres: Add newline between comments and includes


#ifndef POPULATION_H
#define POPULATION_H

class POPULATION
{
public:
  int **initializePopulation(int individuals, int genes, bool FILL_ZERO = false);
  int **createRandomPopulation(int **population, int individuals, int genes);
};

#endif

#ifndef POPULATION_H
#define POPULATION_H

class POPULATION
{
public:
  int **initializePopulation(int individuals, int genes, bool FILL_ZERO = false);
  int createRandomPopulation(int **population, int individuals, int genes);
};

#endif

Update return datatype function 'createRandomPopulation'.


#ifndef SINKMANAGER_H
#define SINKMANAGER_H

#include <dsnutil/singleton.h>
#include <dsnutil/log/base.h>

#include <map>
#include <string>
#include <boost/shared_ptr.hpp>
#include <boost/log/sinks.hpp>

namespace dsn {
namespace log {

    class SinkManager : public dsn::Singleton<SinkManager>, public Base<SinkManager> {
        friend class dsn::Singleton<SinkManager>;
        SinkManager();
        ~SinkManager();

    public:
        /// \brief Pointer to a managed log sink
        typedef boost::shared_ptr<boost::log::sinks::sink> sink_ptr;

        bool exists(const std::string& name) const;
        bool add(const std::string& name, const sink_ptr& sink);
        bool remove(const std::string& name);

        std::vector<std::string> sinks() const;
        sink_ptr sink(const std::string& name);

    private:
        /// \brief Storage container type for managed log sinks
        typedef std::map<std::string, sink_ptr> sink_storage;

        /// \brief Storage container for managed log sinks
        sink_storage m_sinks;
    };
}
}

#endif // SINKMANAGER_H

#ifndef SINKMANAGER_H
#define SINKMANAGER_H

#include <dsnutil/dsnutil_cpp_Export.h>
#include <dsnutil/singleton.h>
#include <dsnutil/log/base.h>

#include <map>
#include <string>
#include <boost/shared_ptr.hpp>
#include <boost/log/sinks.hpp>

namespace dsn {
namespace log {

    class dsnutil_cpp_EXPORT SinkManager : public dsn::Singleton<SinkManager>, public Base<SinkManager> {
        friend class dsn::Singleton<SinkManager>;
        SinkManager();
        ~SinkManager();

    public:
        /// \brief Pointer to a managed log sink
        typedef boost::shared_ptr<boost::log::sinks::sink> sink_ptr;

        bool exists(const std::string& name) const;
        bool add(const std::string& name, const sink_ptr& sink);
        bool remove(const std::string& name);

        std::vector<std::string> sinks() const;
        sink_ptr sink(const std::string& name);

    private:
        /// \brief Storage container type for managed log sinks
        typedef std::map<std::string, sink_ptr> sink_storage;

        /// \brief Storage container for managed log sinks
        sink_storage m_sinks;
    };
}
}

#endif // SINKMANAGER_H

Add missing DLL export for log::SinkManager


// CommonFunc.h -- header file
/*
 *
 * Author: septimomend (Ivan Chapkailo)
 *
 * 30.06.2017
 *
 */

#pragma once
#include "stdafx.h"
#include "AllControllers.h"
#include "AdditionalBuffer.h"

class Common : public AllControllers
{
public:
  Common(AllControllers* all); // cstr

  /*
   * draws
   */
  void drawRows(Adbfr* abfr);
  void drawStatusBar(Adbfr* abfr);
  void drawMessageBar(Adbfr* abfr);

  /*
   * operations
   */
  void statusMsg(const char *fmt, ...);
  void updateScreen();
  char *callPrompt(char *prompt, void (*callback)(char *, int));
  void scrolling();

private:
  ConfigurationController* m_cnfg;
  Adbfr m_abfr;
};

// CommonFunc.h -- header file
/*
 *
 * Author: septimomend (Ivan Chapkailo)
 *
 * 30.06.2017
 *
 */

#pragma once
#include "stdafx.h"
#include "AllControllers.h"
#include "AdditionalBuffer.h"

class Common : public AllControllers
{
public:
  Common(AllControllers* all); // cstr

  /*
   * draws
   */
  void drawRows(Adbfr* abfr);
  void drawStatusBar(Adbfr* abfr);
  void drawMessageBar(Adbfr* abfr);

  /*
   * operations
   */
  void statusMsg(const char *fmt, ...);
  void updateScreen();
  char *callPrompt(char *prompt, void (*callback)(char *, int));
  void scrolling();
  /*
   * TODO
   *
   * void moveCursor(int key);
   * void processKeypress();
   */

private:
  ConfigurationController* m_cnfg;
  Adbfr m_abfr;
};

TODO: Add new functions described in TODO comment


/* Include this file in your project
 * if you don't want to build libmypaint as a separate library
 * Note that still need to do -I./path/to/libmypaint/sources
 * for the includes here to succeed. */

#include "mapping.c"
#include "helpers.c"
#include "brushmodes.c"
#include "fifo.c"
#include "operationqueue.c"
#include "rng-double.c"
#include "utils.c"
#include "tilemap.c"

#include "mypaint.c"
#include "mypaint-brush.c"
#include "mypaint-brush-settings.c"
#include "mypaint-fixed-tiled-surface.c"
#include "mypaint-surface.c"
#include "mypaint-tiled-surface.c"
#include "mypaint-rectangle.c"

/* Include this file in your project
 * if you don't want to build libmypaint as a separate library
 * Note that still need to do -I./path/to/libmypaint/sources
 * for the includes here to succeed. */

#include "helpers.c"
#include "brushmodes.c"
#include "fifo.c"
#include "operationqueue.c"
#include "rng-double.c"
#include "utils.c"
#include "tilemap.c"

#include "mypaint.c"
#include "mypaint-brush.c"
#include "mypaint-brush-settings.c"
#include "mypaint-fixed-tiled-surface.c"
#include "mypaint-surface.c"
#include "mypaint-tiled-surface.c"
#include "mypaint-rectangle.c"
#include "mypaint-mapping.c"

Remove a lingering ref to mapping.c

Remove a lingering ref to mapping.c


// RUN: clang -checker-simple -analyzer-store-region -verify %s

char f1() {
  char* s = "abcd";
  return s[4]; // expected-warning{{Load or store into an out-of-bound memory position.}}
}

Add test case for out-of-bound memory access checking.

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


#include <polygon.h>

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

	Polygon lol;
	lol=createPolygon();
	printf("\n\nx premier point : %f", lol->value.x);
	printf("\ny premier point : %f\n\n", lol->value.y);
	return EXIT_SUCCESS;

}

Create the main program with print the coordinates of the first point of a newly generated polygon


/*
 * Copyright 2011-2016 Blender Foundation
 *
 * 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 __UTIL_VERSION_H__
#define __UTIL_VERSION_H__

/* Cycles version number */

CCL_NAMESPACE_BEGIN

#define CYCLES_VERSION_MAJOR 1
#define CYCLES_VERSION_MINOR 12
#define CYCLES_VERSION_PATCH 0

#define CYCLES_MAKE_VERSION_STRING2(a, b, c) #a "." #b "." #c
#define CYCLES_MAKE_VERSION_STRING(a, b, c) CYCLES_MAKE_VERSION_STRING2(a, b, c)
#define CYCLES_VERSION_STRING \
  CYCLES_MAKE_VERSION_STRING(CYCLES_VERSION_MAJOR, CYCLES_VERSION_MINOR, CYCLES_VERSION_PATCH)

CCL_NAMESPACE_END

#endif /* __UTIL_VERSION_H__ */

/*
 * Copyright 2011-2016 Blender Foundation
 *
 * 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 __UTIL_VERSION_H__
#define __UTIL_VERSION_H__

/* Cycles version number */

CCL_NAMESPACE_BEGIN

#define CYCLES_VERSION_MAJOR 1
#define CYCLES_VERSION_MINOR 13
#define CYCLES_VERSION_PATCH 0

#define CYCLES_MAKE_VERSION_STRING2(a, b, c) #a "." #b "." #c
#define CYCLES_MAKE_VERSION_STRING(a, b, c) CYCLES_MAKE_VERSION_STRING2(a, b, c)
#define CYCLES_VERSION_STRING \
  CYCLES_MAKE_VERSION_STRING(CYCLES_VERSION_MAJOR, CYCLES_VERSION_MINOR, CYCLES_VERSION_PATCH)

CCL_NAMESPACE_END

#endif /* __UTIL_VERSION_H__ */

Bump version to 1.13, matching blender 2.90 release cycle


#pragma once

#if _MSC_VER < 1900
    #define round(x) (x >= 0 ? (x + 0.5) : (x - 0.5))
#endif

class WindowFeature {
public:
	WindowFeature();
	virtual ~WindowFeature();
	virtual void apply(double *windowImage, double *descriptorVector) = 0;
	unsigned int descriptorLengthPerWindow;
};

#pragma once

#if defined(_MSC_VER) && _MSC_VER < 1900
    #define round(x) (x >= 0 ? (x + 0.5) : (x - 0.5))
#endif

class WindowFeature {
public:
	WindowFeature();
	virtual ~WindowFeature();
	virtual void apply(double *windowImage, double *descriptorVector) = 0;
	unsigned int descriptorLengthPerWindow;
};

Check _MSC_VER is defined and less than 1900


typedef union {
  unsigned char* ptr;
  unsigned short word[2];
} word_extract_t;

void
PokeBitplanePointers(unsigned short* copper, unsigned char* bitplanes, unsigned offset, unsigned numBitplanes, unsigned screenWidthBytes)
{
  int i;
  copper += offset;

  for (i = 0; i < numBitplanes; i++) {
    word_extract_t extract;
    extract.ptr = bitplanes;
    *(copper+1) = extract.word[1];
    *(copper+3) = extract.word[0];
    bitplanes += screenWidthBytes;
    copper += 4;
  }
}

static unsigned short _copperData;
static unsigned char _bitplaneData;

void
TestCall()
{
  PokeBitplanePointers(&_copperData, &_bitplaneData, 3, 4, 5);
}

typedef union {
  unsigned char* ptr;
  struct {
    unsigned short hi;
    unsigned short lo;
  } words;
} word_extract_t;

void
PokeBitplanePointers(unsigned short* copper, unsigned char* bitplanes, unsigned offset, unsigned numBitplanes, unsigned screenWidthBytes)
{
  int i;
  copper += offset;

  for (i = 0; i < numBitplanes; i++) {
    word_extract_t extract;
    extract.ptr = bitplanes;
    *(copper+1) = extract.words.lo;
    *(copper+3) = extract.words.hi;
    bitplanes += screenWidthBytes;
    copper += 4;
  }
}

static unsigned short _copperData;
static unsigned char _bitplaneData;

void
TestCall()
{
  PokeBitplanePointers(&_copperData, &_bitplaneData, 3, 4, 5);
}

Make C example more C, less asm

Make C example more C, less asm


#ifndef _PPC_BOOT_REG_H
#define _PPC_BOOT_REG_H
/*
 * Copyright 2007 Davud Gibson, IBM Corporation.
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * as published by the Free Software Foundation; either version
 * 2 of the License, or (at your option) any later version.
 */

static inline u32 mfpvr(void)
{
	u32 pvr;
	asm volatile ("mfpvr	%0" : "=r"(pvr));
	return pvr;
}

register void *__stack_pointer asm("r1");
#define get_sp()	(__stack_pointer)

#endif	/* _PPC_BOOT_REG_H */

#ifndef _PPC_BOOT_REG_H
#define _PPC_BOOT_REG_H
/*
 * Copyright 2007 Davud Gibson, IBM Corporation.
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * as published by the Free Software Foundation; either version
 * 2 of the License, or (at your option) any later version.
 */

static inline u32 mfpvr(void)
{
	u32 pvr;
	asm volatile ("mfpvr	%0" : "=r"(pvr));
	return pvr;
}

#define __stringify_1(x)	#x
#define __stringify(x)		__stringify_1(x)

#define mfspr(rn)	({unsigned long rval; \
			asm volatile("mfspr %0," __stringify(rn) \
				: "=r" (rval)); rval; })
#define mtspr(rn, v)	asm volatile("mtspr " __stringify(rn) ",%0" : : "r" (v))

register void *__stack_pointer asm("r1");
#define get_sp()	(__stack_pointer)

#endif	/* _PPC_BOOT_REG_H */

[POWERPC] 4xx: Add mfspr/mtspr inline macros to 4xx bootwrapper

The 4xx bootwrapper occasionally needs to access SPR registers,
this adds mfspr/mtspr wrappers to it.

Signed-off-by: Benjamin Herrenschmidt <a7089bb6e7e92505d88aaff006cbdd60cc9120b6@kernel.crashing.org>
Signed-off-by: Josh Boyer <94755a79aca753e683bb6d0e796d473b797056eb@linux.vnet.ibm.com>


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

#include "error.h"

static char *pname;

void
setpname(char *name)
{
	pname = name;
}

char *
getpname(void)
{
	return pname;
}

static inline
void
vwarn(const char *fmt, va_list al)
{
	fflush(NULL);
	if (pname != NULL)
		fprintf(stderr, "%s: ", pname);
	vfprintf(stderr, fmt, al);
	if (fmt[0] != '\0' && fmt[strlen(fmt) - 1] == ':')
		fprintf(stderr, " %s", strerror(errno));
	fprintf(stderr, "\n");
}

void
warn(const char *fmt, ...)
{
	va_list al;

	va_start(al, fmt);
	vwarn(fmt, al);
	va_end(al);
}

void
die(const char *fmt, ...)
{
	va_list al;

	va_start(al, fmt);
	vwarn(fmt, al);
	va_end(al);

	exit(0);
}

void
panic(const char *fmt, ...)
{
	va_list al;

	va_start(al, fmt);
	vwarn(fmt, al);
	va_end(al);

	abort();
}

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

#include "error.h"

static char *pname;

void
setpname(char *name)
{
	pname = name;
}

char *
getpname(void)
{
	return pname;
}

static inline
void
vwarn(const char *fmt, va_list al)
{
	fflush(NULL);
	if (pname != NULL)
		fprintf(stderr, "%s: ", pname);
	vfprintf(stderr, fmt, al);
	if (fmt[0] != '\0' && fmt[strlen(fmt) - 1] == ':')
		fprintf(stderr, " %s", strerror(errno));
	fprintf(stderr, "\n");
}

void
warn(const char *fmt, ...)
{
	va_list al;

	va_start(al, fmt);
	vwarn(fmt, al);
	va_end(al);
}

void
die(const char *fmt, ...)
{
	va_list al;

	va_start(al, fmt);
	vwarn(fmt, al);
	va_end(al);

	exit(2);
}

void
panic(const char *fmt, ...)
{
	va_list al;

	va_start(al, fmt);
	vwarn(fmt, al);
	va_end(al);

	abort();
}

Change function die to exit with status 2 instead of 0


#ifndef H_KBD
#define H_KBD

#include <stddef.h>
#include <stdbool.h>

struct keyevent {
  int keycode;
  char character;
  bool release;
  bool shift;
  bool ctrl;
} keybuffer[128];

void kbdinit();
bool kbdavail();
struct keyevent* kbdpoll();

void kbdregsig(bool* b);
void kbdunregsig(bool* b);

#endif

#ifndef H_KBD
#define H_KBD

#include <stddef.h>
#include <stdbool.h>

struct keyevent {
  int keycode;
  char character;
  bool release;
  bool shift;
  bool ctrl;
} keybuffer[256];

void kbdinit();
bool kbdavail();
struct keyevent* kbdpoll();

void kbdregsig(bool* b);
void kbdunregsig(bool* b);

#endif

Raise keyboard event stack size to 256

Raise keyboard event stack size to 256


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

int main() {
  system("/bin/stty raw");

  int i = 0;
  char str[] = "I AM AN IDIOT ";

  while(1){
    for(i = 0; i<14; i++) {
      getchar();
      printf("\b%c", str[i]);
    }
    system("/bin/stty cooked");
    printf("\n");
    system("/bin/stty raw");
  }

  return 0;
}

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

#define STTY "/bin/stty "
const char RAW[] = STTY "raw";
const char COOKED[] = STTY "cooked";

int main() {
  system(RAW);

  int i = 0;
  char str[] = "I AM AN IDIOT ";

  while(1){
    for(i = 0; i<14; i++) {
      getchar();
      printf("\b%c", str[i]);
    }
    system(COOKED);
    printf("\n");
    system(RAW);
  }

  return 0;
}

Make it easier to change stty constant if needed


/*
 * Copyright (c) 2013, Court of the University of Glasgow
 * All rights reserved.

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

 * - Redistributions of source code must retain the above copyright notice,
 *   this list of conditions and the following disclaimer.
 *
 * - Redistributions in binary form must reproduce the above copyright notice,
 *   this list of conditions and the following disclaimer in the documentation
 *   and/or other materials provided with the distribution.
 *
 * - Neither the name of the University of Glasgow nor the names of its
 *   contributors may be used to endorse or promote products derived from this
 *   software without specific prior written permission.
 *
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 * POSSIBILITY OF SUCH DAMAGE.
 */

/*
 * mb.h - publicly accessible entry points for the memory buffer
 */
#ifndef _MB_H_
#define _MB_H_

#include "tuple.h"
#include "table.h"
#include "timestamp.h"

void mb_init();

int mb_insert(unsigned char *buf, long len, Table *table);

tstamp_t mb_insert_tuple(int ncols, char *vals[], Table *table);

tstamp_t heap_insert_tuple(int ncols, char *vals[], Table *table, Node *n);
Node *heap_alloc_node(int ncols, char *vals[], Table *table);
void heap_remove_node(Node *n, Table *tn);
void mb_dump();

#endif /* _MB_H_ */

Add BSD 3-clause open source header

Add BSD 3-clause open source header


#include <arpa/inet.h>
#include <netinet/in.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/socket.h>
#include <unistd.h>

int main()
{
	struct sockaddr_in serv_addr;
	memset(&serv_addr, 0, sizeof(serv_addr));
	serv_addr.sin_family = AF_INET;
	serv_addr.sin_addr.s_addr = inet_addr("127.0.0.1");
	serv_addr.sin_port = htons(7899);

	int fd = socket(AF_INET, SOCK_STREAM, 0);

	if (connect(fd, (struct sockaddr *)&serv_addr, sizeof(serv_addr)) < 0) {
		fprintf(stderr, "Failed to connect with server\n");
		return EXIT_FAILURE;
	}

	char buffer[1000];
	char *write_ptr = buffer;

	const char *msg = "Hello World!";
	uint32_t len = strlen(msg);
	len = htobe32(len);
	memcpy(write_ptr, &len, sizeof(len));
	write_ptr += sizeof(len);
	memcpy(write_ptr, msg, strlen(msg));
	write_ptr += strlen(msg);
	memcpy(write_ptr, &len, sizeof(len));
	write_ptr += sizeof(len);
	memcpy(write_ptr, msg, strlen(msg));
	write_ptr += strlen(msg);

	write(fd, buffer, write_ptr - buffer);
	close(fd);
	return EXIT_SUCCESS;
}

Add some basic test for message handling.


//==================================================================
//	MTextAddOn.h
//	Copyright 1996  Metrowerks Corporation, All Rights Reserved.
//==================================================================
//	This is a proxy class used by Editor add_ons.  It does not inherit from BView
//	but provides an abstract interface to a text engine.

#ifndef _MTEXTADDON_H
#define _MTEXTADDON_H

#include <SupportKit.h>

class MIDETextView;
class BWindow;
struct entry_ref;

class MTextAddOn
{
public:
								MTextAddOn(
									MIDETextView&	inTextView);
	virtual						~MTextAddOn();
	virtual	const char*			Text();
	virtual	int32				TextLength() const;
	virtual	void				GetSelection(
									int32 *start,
									int32 *end) const;
	virtual	void				Select(
									int32 newStart,
									int32 newEnd);
	virtual void				Delete();
	virtual void				Insert(
									const char* inText);
	virtual void				Insert(
									const char* text,
									int32 length);

	virtual	BWindow*			Window();
	virtual status_t			GetRef(
									entry_ref&	outRef);
	virtual bool				IsEditable();

private:

	MIDETextView&				fText;
};

#endif

Add BeIDE header required for building

Add BeIDE header required for building

Copyright 1996  Metrowerks Corporation, All Rights Reserved.


/*
* Super Entity Game Server
* http://segs.sf.net/
* Copyright (c) 2006 Super Entity Game Server Team (see AUTHORS.md)
* This software is licensed under the terms of the 3-clause BSD License. See LICENSE.md for details.
*
*/

#define VersionString "segs v0.5.0 (The Unsilencer)";
#define CopyrightString "Super Entity Game Server\nhttp://github.com/Segs/\nCopyright (c) 2006-2018 Super Entity Game Server Team (see AUTHORS.md)\nThis software is licensed under the terms of the 3-clause BSD License. See LICENSE.md for details.\n";
//const char *AdminVersionString="Undefined";
//const char *AuthVersionString="Undefined";
//const char *GameVersionString="Undefined";
//const char *MapVersionString="Undefined";

// Contains version information for the various server modules
class VersionInfo
{
public:
    static const char *getAdminVersion(void);
    static const char *getAuthVersion(void)
{
        return VersionString;
}

    static const char *getGameVersion(void);
    static const char *getMapVersion(void);
    static const char *getCopyright(void)
{
        return CopyrightString;
}
};

#undef VersionString
#undef CopyrightString

/*
* Super Entity Game Server
* http://segs.sf.net/
* Copyright (c) 2006 Super Entity Game Server Team (see AUTHORS.md)
* This software is licensed under the terms of the 3-clause BSD License. See LICENSE.md for details.
*
*/

#define ProjectName "SEGS"
#define VersionNumber "0.5.0"
#define VersionName "The Unsilencer"
#define VersionString ProjectName " v" VersionNumber " (" VersionName ")"
#define CopyrightString "Super Entity Game Server\nhttp://github.com/Segs/\nCopyright (c) 2006-2018 Super Entity Game Server Team (see AUTHORS.md)\nThis software is licensed under the terms of the 3-clause BSD License. See LICENSE.md for details.\n";
//const char *AdminVersionString="Undefined";
//const char *AuthVersionString="Undefined";
//const char *GameVersionString="Undefined";
//const char *MapVersionString="Undefined";

// Contains version information for the various server modules
class VersionInfo
{
public:
    static const char *getAdminVersion(void);
    static const char *getAuthVersion(void)
{
        return VersionString;
}
    static const char *getAuthVersionNumber(void)
{
        return VersionNumber;
}
    static const char *getGameVersion(void);
    static const char *getMapVersion(void);
    static const char *getCopyright(void)
{
        return CopyrightString;
}
};

#undef ProjectName
#undef VersionName
#undef VersionNumber
#undef VersionString
#undef CopyrightString

Split up VersionString, will be useful for WebUI


#ifndef BIOTOOL_EXIT_STATUS_H
#define BIOTOOL_EXIT_STATUS_H
typedef enum {Success=0, Error_command_line=1, Error_open_file=2, Error_parse_file=3} exit_status;
#endif

#ifndef BIOTOOL_EXIT_STATUS_H
#define BIOTOOL_EXIT_STATUS_H
typedef enum {Success=0, Error_open_file=1, Error_command_line=2, Error_parse_file=3} exit_status;
#endif

Correct c++ exit status values

Correct c++ exit status values


// FIXME: Check IR rather than asm, then triple is not needed.
// RUN: %clang_cc1 -mllvm -asm-verbose -triple %itanium_abi_triple -S -O2 -g %s -o - | FileCheck %s
// Radar 8122864

// Code is not generated for function foo, but preserve type information of
// local variable xyz.
static void foo() {
// CHECK: DW_TAG_structure_type
  struct X { int a; int b; } xyz;
}

int bar() {
  foo();
  return 1;
}

// FIXME: Check IR rather than asm, then triple is not needed.
// RUN: %clang_cc1 -triple %itanium_abi_triple -O2 -g -emit-llvm %s -o - | FileCheck %s
// Radar 8122864

// Code is not generated for function foo, but preserve type information of
// local variable xyz.
static void foo() {
// CHECK: DW_TAG_structure_type
  struct X { int a; int b; } xyz;
}

int bar() {
  foo();
  return 1;
}

Make this test emit llvm IR rather than assembly.

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


// Copyright 2015 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 SKY_COMPOSITOR_COMPOSITOR_OPTIONS_H_
#define SKY_COMPOSITOR_COMPOSITOR_OPTIONS_H_

#include "base/macros.h"
#include <vector>

namespace sky {
namespace compositor {

class CompositorOptions {
 public:
  using OptionType = unsigned int;
  enum class Option : OptionType {
    DisplayFrameStatistics,

    TerminationSentinel,
  };

  CompositorOptions();
  CompositorOptions(uint64_t mask);

  ~CompositorOptions();

  bool isEnabled(Option option) const;

  void setEnabled(Option option, bool enabled);

 private:
  std::vector<bool> options_;

  DISALLOW_COPY_AND_ASSIGN(CompositorOptions);
};

}  // namespace compositor
}  // namespace sky

#endif  // SKY_COMPOSITOR_COMPOSITOR_OPTIONS_H_

// Copyright 2015 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 SKY_COMPOSITOR_COMPOSITOR_OPTIONS_H_
#define SKY_COMPOSITOR_COMPOSITOR_OPTIONS_H_

#include "base/macros.h"
#include <vector>

namespace sky {
namespace compositor {

class CompositorOptions {
 public:
  using OptionType = unsigned int;
  enum class Option : OptionType {
    DisplayFrameStatistics,

    TerminationSentinel,
  };

  CompositorOptions();
  explicit CompositorOptions(uint64_t mask);

  ~CompositorOptions();

  bool isEnabled(Option option) const;

  void setEnabled(Option option, bool enabled);

 private:
  std::vector<bool> options_;

  DISALLOW_COPY_AND_ASSIGN(CompositorOptions);
};

}  // namespace compositor
}  // namespace sky

#endif  // SKY_COMPOSITOR_COMPOSITOR_OPTIONS_H_

Make the single argument constructor to CompositorOptions explicit


#ifndef USB_COMMANDS_H
#define USB_COMMANDS_H

#define CMD_ACK          0xAF
#define CMD_RESP         0xBF

#define CMD_BL_ON        0x10
#define CMD_BL_OFF       0x11
#define CMD_BL_LEVEL     0x12
#define CMD_BL_UP        0x13
#define CMD_BL_DOWN      0x14
#define CMD_BL_GET_STATE 0x1F

#define CMD_RGB_SET      0x20
#define CMD_RGB_GET      0x2F

#endif

Declare all supported USB commands

Declare all supported USB commands


// Copyright (c) 2020 The Orbit 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 ORBIT_QT_TOP_DOWN_WIDGET_H_
#define ORBIT_QT_TOP_DOWN_WIDGET_H_

#include <QSortFilterProxyModel>
#include <memory>

#include "TopDownView.h"
#include "ui_topdownwidget.h"

class TopDownWidget : public QWidget {
  Q_OBJECT

 public:
  explicit TopDownWidget(QWidget* parent = nullptr)
      : QWidget{parent}, ui_{std::make_unique<Ui::TopDownWidget>()} {
    ui_->setupUi(this);
    connect(ui_->topDownTreeView,
            SIGNAL(customContextMenuRequested(const QPoint&)), this,
            SLOT(onCustomContextMenuRequested(const QPoint&)));
  }

  void SetTopDownView(std::unique_ptr<TopDownView> top_down_view);

 private slots:
  void onCustomContextMenuRequested(const QPoint& point);

 private:
  static const std::string kActionExpandAll;
  static const std::string kActionCollapseAll;

  std::unique_ptr<Ui::TopDownWidget> ui_;
};

#endif  // ORBIT_QT_TOP_DOWN_WIDGET_H_

// Copyright (c) 2020 The Orbit 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 ORBIT_QT_TOP_DOWN_WIDGET_H_
#define ORBIT_QT_TOP_DOWN_WIDGET_H_

#include <QSortFilterProxyModel>
#include <memory>

#include "TopDownView.h"
#include "ui_topdownwidget.h"

class TopDownWidget : public QWidget {
  Q_OBJECT

 public:
  explicit TopDownWidget(QWidget* parent = nullptr)
      : QWidget{parent}, ui_{std::make_unique<Ui::TopDownWidget>()} {
    ui_->setupUi(this);
    connect(ui_->topDownTreeView, &QTreeView::customContextMenuRequested, this,
            &TopDownWidget::onCustomContextMenuRequested);
  }

  void SetTopDownView(std::unique_ptr<TopDownView> top_down_view);

 private slots:
  void onCustomContextMenuRequested(const QPoint& point);

 private:
  static const std::string kActionExpandAll;
  static const std::string kActionCollapseAll;

  std::unique_ptr<Ui::TopDownWidget> ui_;
};

#endif  // ORBIT_QT_TOP_DOWN_WIDGET_H_

Use Qt 5 signal-slot syntax in TopDownWidget


class AdminHook : public Module {
	public:
		virtual ~AdminHook();
		virtual std::vector<std::vector<std::string> > adminCommands();
		virtual void onAdminCommand(std::string server, std::string nick, std::string command, std::string message, bool dcc, bool master);
};

class AdminMod : public Module {
	public:
		virtual ~AdminMod();
		virtual void sendVerbose(int verboseLevel, std::string message);
};

AdminHook::~AdminHook() {}

std::vector<std::vector<std::string> > AdminHook::adminCommands() { return std::vector<std::vector<std::string> > (); }

void AdminHook::onAdminCommand(std::string server, std::string nick, std::string command, std::string message, bool dcc, bool master) {}

AdminMod::~AdminMod() {}

void AdminMod::sendVerbose(int verboseLevel, std::string message) {}

class AdminHook : public Module {
	public:
		virtual ~AdminHook();
		virtual std::vector<std::vector<std::string> > adminCommands();
		virtual void onAdminCommand(std::string server, std::string nick, std::string command, std::string message, bool dcc, bool master);
};

class AdminMod {
	public:
		virtual ~AdminMod();
		virtual void sendVerbose(int verboseLevel, std::string message);
};

AdminHook::~AdminHook() {}

std::vector<std::vector<std::string> > AdminHook::adminCommands() { return std::vector<std::vector<std::string> > (); }

void AdminHook::onAdminCommand(std::string server, std::string nick, std::string command, std::string message, bool dcc, bool master) {}

AdminMod::~AdminMod() {}

void AdminMod::sendVerbose(int verboseLevel, std::string message) {}

Change this so it works. This may be tricky to work through when a lot of modules depend on a lot of other modules.


//
//  RIButtonItem.h
//  Shibui
//
//  Created by Jiva DeVoe on 1/12/11.
//  Copyright 2011 Random Ideas, LLC. All rights reserved.
//

#import <Foundation/Foundation.h>

typedef void (^RISimpleAction)();

@interface RIButtonItem : NSObject
{
    NSString *label;
    RISimpleAction action;
}
@property (retain, nonatomic) NSString *label;
@property (copy, nonatomic) RISimpleAction action;
+(id)item;
+(id)itemWithLabel:(NSString *)inLabel;
@end

//
//  RIButtonItem.h
//  Shibui
//
//  Created by Jiva DeVoe on 1/12/11.
//  Copyright 2011 Random Ideas, LLC. All rights reserved.
//

#import <Foundation/Foundation.h>

@interface RIButtonItem : NSObject
{
    NSString *label;
    void (^action)();
}
@property (retain, nonatomic) NSString *label;
@property (copy, nonatomic) void (^action)();
+(id)item;
+(id)itemWithLabel:(NSString *)inLabel;
@end

Replace typedef with literal type

Replace typedef with literal type

Using the literal typedef makes Xcode's code sense give you a parameter
stand-in that can be expanded with a shift-enter.


#define VT_POINT 1
#define VT_LINE 2
#define VT_POLYGON 3

#define VT_END 0
#define VT_MOVETO 1
#define VT_LINETO 2
#define VT_CLOSEPATH 7

#define VT_STRING 1
#define VT_NUMBER 2
#define VT_BOOLEAN 7

struct pool;

void deserialize_int(char **f, int *n);
struct pool_val *deserialize_string(char **f, struct pool *p, int type);

struct index {
        unsigned long long index;
        long long fpos;
	int maxzoom;
};

long long write_tile(struct index *start, struct index *end, char *metabase, unsigned *file_bbox, int z, unsigned x, unsigned y, int detail, int basezoom, struct pool *file_keys, char *layername, sqlite3 *outdb, double droprate, int buffer);

#define VT_POINT 1
#define VT_LINE 2
#define VT_POLYGON 3

#define VT_END 0
#define VT_MOVETO 1
#define VT_LINETO 2
#define VT_CLOSEPATH 7

#define VT_STRING 1
#define VT_NUMBER 2
#define VT_BOOLEAN 7

struct pool;

void deserialize_int(char **f, int *n);
struct pool_val *deserialize_string(char **f, struct pool *p, int type);

struct index {
	unsigned long long index;
	long long fpos : 56;
	int maxzoom : 8;
};

long long write_tile(struct index *start, struct index *end, char *metabase, unsigned *file_bbox, int z, unsigned x, unsigned y, int detail, int basezoom, struct pool *file_keys, char *layername, sqlite3 *outdb, double droprate, int buffer);

Use a bitfield to make the index 2/3 the size, to save some disk churn


#pragma once

#include "BehaviorTree.hpp"
#include "Blackboard.hpp"
#include "Composite.hpp"
#include "Decorator.hpp"
#include "Leaf.hpp"
#include "Node.hpp"

// CompositeS
#include "Composites/MemSelector.hpp"
#include "Composites/MemSequence.hpp"
#include "Composites/ParallelSequence.hpp"
#include "Composites/Selector.hpp"
#include "Composites/Sequence.hpp"

// Decorators
#include "Decorators/Failer.hpp"
#include "Decorators/Inverter.hpp"
#include "Decorators/Repeater.hpp"
#include "Decorators/Succeeder.hpp"
#include "Decorators/UntilFail.hpp"
#include "Decorators/UntilSuccess.hpp"

#pragma once

#include "BehaviorTree.h"
#include "Blackboard.h"
#include "Composite.h"
#include "Decorator.h"
#include "Leaf.h"
#include "Node.h"

// Composites
#include "composites/MemSelector.h"
#include "composites/MemSequence.h"
#include "composites/ParallelSequence.h"
#include "composites/Selector.h"
#include "composites/Sequence.h"

// Decorators
#include "decorators/Failer.h"
#include "decorators/Inverter.h"
#include "decorators/Repeater.h"
#include "decorators/Succeeder.h"
#include "decorators/UntilFail.h"
#include "decorators/UntilSuccess.h"

// Builders
#include "builders/LeafBuilder.h"

Change headers from *.hpp to *.h, and add LeafBuilder.


//
//  GNETextSearchPrivate.h
//  GNETextSearch
//
//  Created by Anthony Drendel on 11/14/15.
//  Copyright © 2015 Gone East LLC. All rights reserved.
//

#ifndef GNETextSearchPrivate_h
#define GNETextSearchPrivate_h

#ifdef __cplusplus
extern "C" {
#endif

#ifndef TSEARCH_INLINE
    #if defined(_MSC_VER) && !defined(__cplusplus)
        #define TSEARCH_INLINE __inline
    #else
        #define TSEARCH_INLINE inline
    #endif
#endif

TSEARCH_INLINE size_t _tsearch_next_buf_len(size_t *capacity, const size_t size)
{
    if (capacity == NULL) { return 0; }
    size_t count = *capacity;
    size_t nextCount = (count * 3) / 2;
    size_t validCount = (nextCount > count && ((SIZE_MAX / size) > nextCount)) ? nextCount : count;
    *capacity = validCount;
    return validCount * size;
}

#ifdef __cplusplus
}
#endif

#endif /* GNETextSearchPrivate_h */

//
//  GNETextSearchPrivate.h
//  GNETextSearch
//
//  Created by Anthony Drendel on 11/14/15.
//  Copyright © 2015 Gone East LLC. All rights reserved.
//

#ifndef GNETextSearchPrivate_h
#define GNETextSearchPrivate_h

#ifdef __cplusplus
extern "C" {
#endif

#ifndef TSEARCH_INLINE
    #if defined(_MSC_VER) && !defined(__cplusplus)
        #define TSEARCH_INLINE __inline
    #else
        #define TSEARCH_INLINE static inline
    #endif
#endif

TSEARCH_INLINE size_t _tsearch_next_buf_len(size_t *capacity, const size_t size)
{
    if (capacity == NULL) { return 0; }
    size_t count = *capacity;
    size_t nextCount = (count * 3) / 2;
    size_t validCount = (nextCount > count && ((SIZE_MAX / size) > nextCount)) ? nextCount : count;
    *capacity = validCount;
    return validCount * size;
}

#ifdef __cplusplus
}
#endif

#endif /* GNETextSearchPrivate_h */

Define TSEARCH_INLINE as static inline

Define TSEARCH_INLINE as static inline


/**
 * @file
 *
 * @brief
 *
 * @copyright BSD License (see LICENSE.md or https://www.libelektra.org)
 */

#include <kdb.h>

#include <stdio.h>

int main (void)
{
	KeySet * config = ksNew (0, KS_END);
	Key * root = keyNew ("user/test", KEY_END);

	printf ("Open key database\n");
	KDB * handle = kdbOpen (root);

	printf ("Retrieve key set\n");
	kdbGet (handle, config, root);

	printf ("Number of key-value pairs: %zu\n", ksGetSize (config));

	Key * key = keyNew ("user/test/hello", KEY_VALUE, "elektra", KEY_END);
	printf ("Add key %s\n", keyName (key));
	ksAppendKey (config, key);
	printf ("Number of key-value pairs: %zu\n", ksGetSize (config));
	printf ("\n%s, %s\n\n", keyBaseName (key), keyString (key));

	// If you want to store the key database on disk, then please uncomment the following two lines
	// printf ("Write key set to disk\n");
	// kdbSet (handle, config, root);

	printf ("Delete mappings inside memory\n");
	ksDel (config);
	printf ("Close key database\n");
	kdbClose (handle, 0);

	return 0;
}

/**
 * @file
 *
 * @brief
 *
 * @copyright BSD License (see LICENSE.md or https://www.libelektra.org)
 */

#include <kdb.h>

#include <stdio.h>

int main (void)
{
	KeySet * config = ksNew (0, KS_END);
	Key * root = keyNew ("user/test", KEY_END);

	printf ("Open key database\n");
	KDB * handle = kdbOpen (root);

	printf ("Retrieve key set\n");
	kdbGet (handle, config, root);

	printf ("Number of key-value pairs: %zu\n", ksGetSize (config));

	Key * key = keyNew ("user/test/hello", KEY_VALUE, "elektra", KEY_END);
	printf ("Add key %s\n", keyName (key));
	ksAppendKey (config, key);
	printf ("Number of key-value pairs: %zu\n", ksGetSize (config));
	printf ("\n%s, %s\n\n", keyBaseName (key), keyString (key));

	// If you want to store the key database on disk, then please uncomment the following two lines
	// printf ("Write key set to disk\n");
	// kdbSet (handle, config, root);

	printf ("Delete key-value pairs inside memory\n");
	ksDel (config);
	printf ("Close key database\n");
	kdbClose (handle, 0);

	return 0;
}

Use more common technical term

Examples: Use more common technical term


#ifndef VKALLOC_VKALLOC_H
#define VKALLOC_VKALLOC_H

#include <stdlib.h>
#include <stdint.h>
#include <vulkan/vulkan.h>

#ifndef VKA_ALLOC_SIZE
#define VKA_ALLOC_SIZE 1024*1024*4
#endif

struct VkAllocation {
    VkDeviceMemory deviceMemory;
    uint64_t offset;
    uint64_t size;
};

void vkaInit(VkPhysicalDevice physicalDevice, VkDevice device);
void vkaTerminate();

VkAllocation vkAlloc(VkMemoryRequirements requirements);
void vkFree(VkAllocation allocation);

VkAllocation vkHostAlloc(VkMemoryRequirements requirements);
void vkHostFree(VkAllocation allocation);

#endif //VKALLOC_VKALLOC_H

#ifndef VKALLOC_VKALLOC_H
#define VKALLOC_VKALLOC_H

#include <stdlib.h>
#include <stdint.h>
#include <vulkan/vulkan.h>

#ifndef VKA_ALLOC_SIZE
#define VKA_ALLOC_SIZE 1024*1024*4
#endif

struct VkAllocation {
    VkDeviceMemory deviceMemory = VK_NULL_HANDLE;
    uint64_t offset = 0;
    uint64_t size = 0;
};

void vkaInit(VkPhysicalDevice physicalDevice, VkDevice device);
void vkaTerminate();

VkAllocation vkAlloc(VkMemoryRequirements requirements);
void vkFree(VkAllocation allocation);

VkAllocation vkHostAlloc(VkMemoryRequirements requirements);
void vkHostFree(VkAllocation allocation);

#endif //VKALLOC_VKALLOC_H

Add default values to VkAllocation

Add default values to VkAllocation


/*
 * Copyright (C) 2015 Eistec AB
 *
 * This file is subject to the terms and conditions of the GNU Lesser General
 * Public License v2.1. See the file LICENSE in the top level directory for more
 * details.
 */

/**
 * @ingroup     nvram
 * @{
 *
 * @file
 *
 * @brief       Device interface for various SPI connected NVRAM.
 *
 * Tested on:
 * - Cypress/Ramtron FM25L04B.
 *
 * @author      Joakim Gebart <joakim.gebart@eistec.se>
 */

#ifndef DRIVERS_NVRAM_SPI_H_
#define DRIVERS_NVRAM_SPI_H_

#include <stdint.h>
#include "nvram.h"
#include "periph/spi.h"
#include "periph/gpio.h"

#ifdef __cplusplus
extern "C" {
#endif

/**
 * @brief Bus parameters for SPI NVRAM.
 */
typedef struct nvram_spi_params {
    /** @brief RIOT SPI device */
    spi_t spi;
    /** @brief Chip select pin */
    gpio_t cs;
    /** @brief Number of address bytes following each read/write command. */
    uint8_t address_count;
} nvram_spi_params_t;

/**
 * @brief Initialize an nvram_t structure with SPI settings.
 *
 * This will also initialize the CS pin as a GPIO output, without pull resistors.
 *
 * @param[out] dev          Pointer to NVRAM device descriptor
 * @param[out] spi_params   Pointer to SPI settings
 * @param[in]  size         Device capacity
 *
 * @return                  0 on success
 * @return                  <0 on errors
 */
int nvram_spi_init(nvram_t *dev, nvram_spi_params_t *spi_params, size_t size);

#ifdef __cplusplus
}
#endif

#endif /* DRIVERS_NVRAM_SPI_H_ */
/** @} */

nvram: Add generic SPI connected NVRAM interface.


// RUN: clang -checker-simple -verify %s &&
// RUN: clang -checker-simple -analyzer-store-region -verify %s

struct s {
  int data;
  int data_array[10];
};

typedef struct {
  int data;
} STYPE;

void g1(struct s* p);

void f(void) {
  int a[10];
  int (*p)[10];
  p = &a;
  (*p)[3] = 1;

  struct s d;
  struct s *q;
  q = &d;
  q->data = 3;
  d.data_array[9] = 17;
}

void f2() {
  char *p = "/usr/local";
  char (*q)[4];
  q = &"abc";
}

void f3() {
  STYPE s;
}

void f4() {
  int a[] = { 1, 2, 3};
  int b[3] = { 1, 2 };
}

void f5() {
  struct s data;
  g1(&data);
}

void f6() {
  char *p;
  p = __builtin_alloca(10);
  p[1] = 'a';
}

struct s2;

void g2(struct s2 *p);

void f7() {
  struct s2 *p = __builtin_alloca(10);
  g2(p);
}

Add test for incomplete struct pointer.

Add test for incomplete struct pointer.

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


// RUN: %clang_cc1 -S -emit-llvm -debug-info-kind=limited  %s -o - | FileCheck %s
// CHECK: !DIGlobalVariable({{.*}}
// CHECK-NOT: expr:

static const __uint128_t ro = 18446744073709551615;

void bar(__uint128_t);
void foo() { bar(ro); }

// RUN: %clang_cc1 -triple x86_64-unknown-linux -S -emit-llvm -debug-info-kind=limited  %s -o - | FileCheck %s
// CHECK: !DIGlobalVariable({{.*}}
// CHECK-NOT: expr:

static const __uint128_t ro = 18446744073709551615;

void bar(__uint128_t);
void foo() { bar(ro); }

Add explicit triple to test to fix arm bots.

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


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

int test() {
  void *vp;
  int *ip;
  char *cp;
  struct foo *fp;
  struct bar *bp;
  short sint = 7;

  if (ip < cp) {} // expected-warning {{comparison of distinct pointer types ('int *' and 'char *')}}
  if (cp < fp) {} // expected-warning {{comparison of distinct pointer types ('char *' and 'struct foo *')}}
  if (fp < bp) {} // expected-warning {{comparison of distinct pointer types ('struct foo *' and 'struct bar *')}}
  if (ip < 7) {} // expected-warning {{comparison between pointer and integer ('int *' and 'int')}}
  if (sint < ip) {} // expected-warning {{comparison between pointer and integer ('int' and 'int *')}}
  if (ip == cp) {} // expected-warning {{comparison of distinct pointer types ('int *' and 'char *')}}
}

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

void test() {
  void *vp;
  int *ip;
  char *cp;
  struct foo *fp;
  struct bar *bp;
  short sint = 7;

  if (ip < cp) {} // expected-warning {{comparison of distinct pointer types ('int *' and 'char *')}}
  if (cp < fp) {} // expected-warning {{comparison of distinct pointer types ('char *' and 'struct foo *')}}
  if (fp < bp) {} // expected-warning {{comparison of distinct pointer types ('struct foo *' and 'struct bar *')}}
  if (ip < 7) {} // expected-warning {{comparison between pointer and integer ('int *' and 'int')}}
  if (sint < ip) {} // expected-warning {{comparison between pointer and integer ('int' and 'int *')}}
  if (ip == cp) {} // expected-warning {{comparison of distinct pointer types ('int *' and 'char *')}}
}

Fix test case, which has a control-reaches-end-of-non-void warning that was
being masked by previous bug.

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


/* vim: set ts=4 sw=4 tw=79 et :*/
/* This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#ifndef gfxShader_h__
#define gfxShader_h__

#include "GL/glew.h"

class OpenGLShader {
    public:

        /// The OpenGL Resource ID
        GLuint mGLResource;

        /// True if the shader compiled successfully
        bool mSuccessfullyCompiled;

        OpenGLShader(const char* aShaderSource, GLenum aShaderType) :
            mSuccessfullyCompiled(false),
            mShaderSource(aShaderSource),
            mShaderType(aShaderType) {
        }

        ~OpenGLShader() {
            if (mGLResource) {
                glDeleteShader(mGLResource);
            }
        }

        bool compile();
    private:
        const char* mShaderSource;
        GLenum mShaderType;
};
#endif

/* vim: set ts=4 sw=4 tw=79 et :*/
/* This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#ifndef gfxShader_h__
#define gfxShader_h__

#include "GL/glew.h"

class OpenGLShader {
    public:

        /// The OpenGL Resource ID
        GLuint mGLResource;

        /// True if the shader compiled successfully
        bool mSuccessfullyCompiled;

        OpenGLShader(const char* aShaderSource, GLenum aShaderType) :
            mSuccessfullyCompiled(false),
            mShaderSource(aShaderSource),
            mShaderType(aShaderType),
			mGLResource(0) {
        }

        ~OpenGLShader() {
            if (mGLResource) {
                glDeleteShader(mGLResource);
            }
        }

        bool compile();
    private:
        const char* mShaderSource;
        GLenum mShaderType;
};
#endif

Make sure the memory is zero when initialising. This caused failing tests on Windows where mGLResource would already be populated with random stuff.


#ifndef TAG_H
#define TAG_H

#include <QString>
#include <QStringList>
#include "favorite.h"
#include "profile.h"

class Tag
{
	public:
		Tag();
		explicit Tag(QString text, QString type = "unknown", int count = 1, QStringList related = QStringList());
		~Tag();
		static Tag FromCapture(QStringList caps, QStringList order = QStringList());
		static QList<Tag> Tag::FromRegexp(QString rx, QStringList order, const QString &source);
		QString stylished(Profile *profile, QStringList ignored = QStringList(), QStringList blacklisted = QStringList(), bool count = false, bool nounderscores = false) const;
		void setText(QString);
		void setType(QString);
		void setCount(int);
		void setRelated(QStringList);
		QString		text()		const;
		QString		type()		const;
		int			shortType()	const;
		int			count()		const;
		QStringList	related()	const;
		QString		typedText()	const;

	private:
		QString		m_text, m_type;
		int			m_count;
		QStringList	m_related;
};

bool sortByFrequency(Tag, Tag);
bool operator==(const Tag &t1, const Tag &t2);

Q_DECLARE_METATYPE(Tag)

#endif // TAG_H

#ifndef TAG_H
#define TAG_H

#include <QString>
#include <QStringList>
#include "favorite.h"
#include "profile.h"

class Tag
{
	public:
		Tag();
		explicit Tag(QString text, QString type = "unknown", int count = 1, QStringList related = QStringList());
		~Tag();
		static Tag FromCapture(QStringList caps, QStringList order = QStringList());
		static QList<Tag> FromRegexp(QString rx, QStringList order, const QString &source);
		QString stylished(Profile *profile, QStringList ignored = QStringList(), QStringList blacklisted = QStringList(), bool count = false, bool nounderscores = false) const;
		void setText(QString);
		void setType(QString);
		void setCount(int);
		void setRelated(QStringList);
		QString		text()		const;
		QString		type()		const;
		int			shortType()	const;
		int			count()		const;
		QStringList	related()	const;
		QString		typedText()	const;

	private:
		QString		m_text, m_type;
		int			m_count;
		QStringList	m_related;
};

bool sortByFrequency(Tag, Tag);
bool operator==(const Tag &t1, const Tag &t2);

Q_DECLARE_METATYPE(Tag)

#endif // TAG_H

Fix extra qualifier on Tag.FromRegexp breaking build


// RUN: %clang_cc1 %s -m32 -emit-llvm -o - | grep {i32 32} | count 3
// XFAIL: *
// XTARGET: powerpc
//  Every printf has 'i32 0' for the GEP of the string; no point counting those.
typedef unsigned int Foo __attribute__((aligned(32)));
typedef union{Foo:0;}a;
typedef union{int x; Foo:0;}b;
extern int printf(const char*, ...);
main() {
  printf("%ld\n", sizeof(a));
  printf("%ld\n", __alignof__(a));
  printf("%ld\n", sizeof(b));
  printf("%ld\n", __alignof__(b));
}

// RUN: %clang_cc1 %s -triple powerpc-pc-linux -emit-llvm -o - | grep {i32 32} | count 3
// XFAIL: *
//  Every printf has 'i32 0' for the GEP of the string; no point counting those.
typedef unsigned int Foo __attribute__((aligned(32)));
typedef union{Foo:0;}a;
typedef union{int x; Foo:0;}b;
extern int printf(const char*, ...);
main() {
  printf("%ld\n", sizeof(a));
  printf("%ld\n", __alignof__(a));
  printf("%ld\n", sizeof(b));
  printf("%ld\n", __alignof__(b));
}

Fix test so that it XFAILs consistently.

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


//
// Copyright (c) 2012 Juan Palacios juan.palacios.puyana@gmail.com
// This file is part of minimathlibs.
// Subject to the BSD 2-Clause License
// - see < http://opensource.org/licenses/BSD-2-Clause>
//

#ifndef MATH_UTILS_H__
#define MATH_UTILS_H__

namespace Math {

template <typename T>
struct CompareWithTolerance
{
  CompareWithTolerance() : tol_() {}
  CompareWithTolerance(T tolerance) : tol_(tolerance) {}
  bool operator()(const T& lhs, const T& rhs) const
  {
    return std::abs(rhs-lhs) <= tol_; // <= to allow for 0 tolerance.
  }
 private:
  T tol_;
};

} // namespace Math

#endif // MATH_UTILS_H__

//
// Copyright (c) 2012 Juan Palacios juan.palacios.puyana@gmail.com
// This file is part of minimathlibs.
// Subject to the BSD 2-Clause License
// - see < http://opensource.org/licenses/BSD-2-Clause>
//

#ifndef MATH_UTILS_H_
#define MATH_UTILS_H_

#include <cstdlib>
#include <cmath>

namespace Math {

template <typename T>
bool compareWithTolerance(const T& rhs, const T& lhs, const T& tol)
{
  using std::abs;
  return abs(rhs-lhs) <= tol; // <= to allow for 0 tolerance.
}

template <typename T>
struct CompareWithTolerance
{
  CompareWithTolerance() : tol_() {}
  CompareWithTolerance(T tolerance) : tol_(tolerance) {}
  bool operator()(const T& lhs, const T& rhs) const
  {
    return compareWithTolerance(rhs, lhs, tol_);
  }
 private:
  T tol_;
};

} // namespace Math

#endif // MATH_UTILS_H_

Add missing includes for std::abs.

Add missing includes for std::abs.


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

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

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

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

#ifndef THIRD_PARTY_HWLOC_STATIC_COMPONENTS_H_
#define THIRD_PARTY_HWLOC_STATIC_COMPONENTS_H_

#include <private/internal-components.h>
static const struct hwloc_component* hwloc_static_components[] = {
    &hwloc_noos_component,
    &hwloc_xml_component,
    &hwloc_synthetic_component,
    &hwloc_xml_nolibxml_component,
    &hwloc_linux_component,
    &hwloc_linuxio_component,
#if defined(__x86_64__) || defined(__amd64__) || defined(_M_IX86) || \
    defined(_M_X64)
    &hwloc_x86_component,
#endif
    NULL};

#endif  // THIRD_PARTY_HWLOC_STATIC_COMPONENTS_H_

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

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

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

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

#ifndef THIRD_PARTY_HWLOC_STATIC_COMPONENTS_H_
#define THIRD_PARTY_HWLOC_STATIC_COMPONENTS_H_

#include <private/internal-components.h>
static const struct hwloc_component* hwloc_static_components[] = {
    &hwloc_noos_component,
    &hwloc_xml_component,
    &hwloc_synthetic_component,
    &hwloc_xml_nolibxml_component,
#ifdef __Linux__
    &hwloc_linux_component,
    &hwloc_linuxio_component,
#endif
#ifdef __FreeBSD__
    &hwloc_freebsd_component,
#endif
#if defined(__x86_64__) || defined(__amd64__) || defined(_M_IX86) || \
    defined(_M_X64)
    &hwloc_x86_component,
#endif
    NULL};

#endif  // THIRD_PARTY_HWLOC_STATIC_COMPONENTS_H_

hwloc: Include Linux or FreeBSD symbols depending on OS we are compiling on.


#ifndef UTIL_EITHER_H
#define UTIL_EITHER_H

#include <utility>

namespace util
{

template <typename L, typename R>
class Either
{
public:
    bool left(L& x)
    {
        if (isLeft) x = l;
        return isLeft;
    }

    bool right(R& x)
    {
        if (!isLeft) x = r;
        return !isLeft;
    }

private:
    template <typename L_, typename R_>
    friend Either<L_, R_> Left(L_ x);

    template <typename L_, typename R_>
    friend Either<L_, R_> Right(R_ x);

    bool isLeft;
    union
    {
        L l;
        R r;
    };
};

template <typename L, typename R>
Either<L, R> Left(L x)
{
    Either<L, R> e;
    e.isLeft = true;
    e.l = std::move(x);
    return e;
}

template <typename L, typename R>
Either <L, R> Right(R x)
{
    Either<L, R> e;
    e.isLeft = false;
    e.r = std::move(x);
    return e;
}

}

#endif

Add either class for trivially constructable types


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

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

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

Update for checkpoint66j and internal consistency


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

/* migrated from chrome/src/skia/ext/SkFontHost_fontconfig_direct.cpp */

#include "SkFontConfigInterface.h"

#include <fontconfig/fontconfig.h>

class SkFontConfigInterfaceDirect : public SkFontConfigInterface {
public:
    SkFontConfigInterfaceDirect();
    ~SkFontConfigInterfaceDirect() override;

    bool matchFamilyName(const char familyName[],
                         SkFontStyle requested,
                         FontIdentity* outFontIdentifier,
                         SkString* outFamilyName,
                         SkFontStyle* outStyle) override;

    SkStreamAsset* openStream(const FontIdentity&) override;

protected:
    virtual bool isAccessible(const char* filename);

private:
    bool isValidPattern(FcPattern* pattern);
    FcPattern* MatchFont(FcFontSet* font_set, const char* post_config_family,
                         const SkString& family);
    typedef SkFontConfigInterface INHERITED;
};

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

/* migrated from chrome/src/skia/ext/SkFontHost_fontconfig_direct.cpp */
#ifndef SKFONTCONFIGINTERFACE_DIRECT_H_
#define SKFONTCONFIGINTERFACE_DIRECT_H_

#include "SkFontConfigInterface.h"

#include <fontconfig/fontconfig.h>

class SkFontConfigInterfaceDirect : public SkFontConfigInterface {
public:
    SkFontConfigInterfaceDirect();
    ~SkFontConfigInterfaceDirect() override;

    bool matchFamilyName(const char familyName[],
                         SkFontStyle requested,
                         FontIdentity* outFontIdentifier,
                         SkString* outFamilyName,
                         SkFontStyle* outStyle) override;

    SkStreamAsset* openStream(const FontIdentity&) override;

protected:
    virtual bool isAccessible(const char* filename);

private:
    bool isValidPattern(FcPattern* pattern);
    FcPattern* MatchFont(FcFontSet* font_set, const char* post_config_family,
                         const SkString& family);
    typedef SkFontConfigInterface INHERITED;
};

#endif

Add include guard to SkFontConfigInterface.h

BUG=skia:7137

Change-Id: I29536a21211eae8b075d43984f3677f64ff9f481
Reviewed-on: https://skia-review.googlesource.com/57820
Reviewed-by: Ben Wagner <53965154ffeecc4a10886eab9259e95965f2979a@google.com>
Commit-Queue: Ben Wagner <53965154ffeecc4a10886eab9259e95965f2979a@google.com>


// RUN: %llvmgcc %s -S -O0 -o - | FileCheck %s
// Radar 8288710: A small aggregate can be passed as an integer.  Make sure
// we don't get an error with "input constraint with a matching output
// constraint of incompatible type!"

struct wrapper {
  int i;
};

// CHECK: xyz
int test(int i) {
  struct wrapper w;
  w.i = i;
  __asm__("xyz" : "=r" (w) : "0" (w));
  return w.i;
}

Add a test for llvm-gcc svn 110632.

Add a test for llvm-gcc svn 110632.

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


/*
 * Copyright (C) 2000-2006 Erik Andersen <andersen@uclibc.org>
 *
 * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
 */
#ifndef _BITS_UCLIBC_ERRNO_H
#define _BITS_UCLIBC_ERRNO_H 1

#ifdef IS_IN_rtld
# undef errno
# define errno _dl_errno
extern int _dl_errno; // attribute_hidden;
#elif defined __UCLIBC_HAS_THREADS__
# include <tls.h>
# if defined USE___THREAD && USE___THREAD
#  undef errno
#  ifndef NOT_IN_libc
#   define errno __libc_errno
#  else
#   define errno errno
#  endif
extern __thread int errno __attribute_tls_model_ie;
# endif /* USE___THREAD */
#endif /* IS_IN_rtld */

#define __set_errno(val) (errno = (val))

#ifndef __ASSEMBLER__
extern int *__errno_location (void) __THROW __attribute__ ((__const__))
# ifdef IS_IN_rtld
	attribute_hidden
# endif
;
# if defined __UCLIBC_HAS_THREADS__
#  include <tls.h>
#  if defined USE___THREAD && USE___THREAD
libc_hidden_proto(__errno_location)
#  endif
# endif

#endif /* !__ASSEMBLER__ */

#endif

/*
 * Copyright (C) 2000-2006 Erik Andersen <andersen@uclibc.org>
 *
 * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
 */
#ifndef _BITS_UCLIBC_ERRNO_H
#define _BITS_UCLIBC_ERRNO_H 1

#ifdef IS_IN_rtld
# undef errno
# define errno _dl_errno
extern int _dl_errno; // attribute_hidden;
#elif defined __UCLIBC_HAS_THREADS__
# include <tls.h>
# if defined USE___THREAD && USE___THREAD
#  undef errno
#  ifndef NOT_IN_libc
#   define errno __libc_errno
#  else
#   define errno errno
#  endif
extern __thread int errno attribute_tls_model_ie;
# endif /* USE___THREAD */
#endif /* IS_IN_rtld */

#define __set_errno(val) (errno = (val))

#ifndef __ASSEMBLER__
extern int *__errno_location (void) __THROW __attribute__ ((__const__))
# ifdef IS_IN_rtld
	attribute_hidden
# endif
;
# if defined __UCLIBC_HAS_THREADS__
#  include <tls.h>
#  if defined USE___THREAD && USE___THREAD
libc_hidden_proto(__errno_location)
#  endif
# endif

#endif /* !__ASSEMBLER__ */

#endif

Fix typo in macro for tls access model

Fix typo in macro for tls access model


#if defined __clang__
	#pragma clang push
	#pragma clang diagnostic ignored "-Wignored-attributes"
#elif defined __GNUC__
	#pragma GCC diagnostic push
	#pragma GCC diagnostic ignored "-Wattributes"
#endif

#include <amx/amx.h>
#include <amx/amxaux.h>
#include <amx/amxdbg.h>

#if defined __clang_
	#pragma clang pop
#elif defined __GNUC__
	#pragma GCC pop
#endif

#if defined __clang__
	#pragma clang push
	#pragma clang diagnostic ignored "-Wignored-attributes"
#elif defined __GNUC__
	#pragma GCC diagnostic push
	#pragma GCC diagnostic ignored "-Wattributes"
#endif

#ifdef _WIN32
	#include <malloc.h>
#endif

#include <amx/amx.h>
#include <amx/amxaux.h>
#include <amx/amxdbg.h>

#if defined __clang_
	#pragma clang pop
#elif defined __GNUC__
	#pragma GCC pop
#endif

Fix alloca() redefinition warning on Windows


/*
 * A solution to Exercise 2-5 in The C Programming Language (Second Edition).
 *
 * This file was written by Damien Dart, <damiendart@pobox.com>. This is free
 * and unencumbered software released into the public domain. For more
 * information, please refer to the accompanying "UNLICENCE" file.
 */

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

int32_t any(char *, char *);

int main(void)
{
	char *test_string_one = "Gooseberries.";
	char *test_string_two = "Kiwis.";
	printf("%d", any(test_string_one, test_string_two));
	return EXIT_SUCCESS;
}

int32_t any(char *string_one, char *string_two)
{
	for (uint32_t i = 0; string_one[i] != '\0'; i++) {
		for (uint32_t j = 0; string_two[j] != '\0'; j++) {
			if (string_one[i] == string_two[j]) {
				return i;
			}
    }
  }
  return -1;
}

Add solution to Exercise 2-5.

Add solution to Exercise 2-5.


#import <UIKit/UIKit.h>
#import "GPUImageContext.h"

typedef enum {
    kGPUImageFillModeStretch,                       // Stretch to fill the full view, which may distort the image outside of its normal aspect ratio
    kGPUImageFillModePreserveAspectRatio,           // Maintains the aspect ratio of the source image, adding bars of the specified background color
    kGPUImageFillModePreserveAspectRatioAndFill     // Maintains the aspect ratio of the source image, zooming in on its center to fill the view
} GPUImageFillModeType;

/**
 UIView subclass to use as an endpoint for displaying GPUImage outputs
 */
@interface GPUImageView : UIView <GPUImageInput>
{
    GPUImageRotationMode inputRotation;
}

/** The fill mode dictates how images are fit in the view, with the default being kGPUImageFillModePreserveAspectRatio
 */
@property(readwrite, nonatomic) GPUImageFillModeType fillMode;

/** This calculates the current display size, in pixels, taking into account Retina scaling factors
 */
@property(readonly, nonatomic) CGSize sizeInPixels;

@property(nonatomic) BOOL enabled;

/** Handling fill mode

 @param redComponent Red component for background color
 @param greenComponent Green component for background color
 @param blueComponent Blue component for background color
 @param alphaComponent Alpha component for background color
 */
- (void)setBackgroundColorRed:(GLfloat)redComponent green:(GLfloat)greenComponent blue:(GLfloat)blueComponent alpha:(GLfloat)alphaComponent;

- (void)setCurrentlyReceivingMonochromeInput:(BOOL)newValue;

@end

#import <UIKit/UIKit.h>
#import "GPUImageContext.h"

typedef NS_ENUM(NSUInteger, GPUImageFillModeType) {
    kGPUImageFillModeStretch,                       // Stretch to fill the full view, which may distort the image outside of its normal aspect ratio
    kGPUImageFillModePreserveAspectRatio,           // Maintains the aspect ratio of the source image, adding bars of the specified background color
    kGPUImageFillModePreserveAspectRatioAndFill     // Maintains the aspect ratio of the source image, zooming in on its center to fill the view
};

/**
 UIView subclass to use as an endpoint for displaying GPUImage outputs
 */
@interface GPUImageView : UIView <GPUImageInput>
{
    GPUImageRotationMode inputRotation;
}

/** The fill mode dictates how images are fit in the view, with the default being kGPUImageFillModePreserveAspectRatio
 */
@property(readwrite, nonatomic) GPUImageFillModeType fillMode;

/** This calculates the current display size, in pixels, taking into account Retina scaling factors
 */
@property(readonly, nonatomic) CGSize sizeInPixels;

@property(nonatomic) BOOL enabled;

/** Handling fill mode

 @param redComponent Red component for background color
 @param greenComponent Green component for background color
 @param blueComponent Blue component for background color
 @param alphaComponent Alpha component for background color
 */
- (void)setBackgroundColorRed:(GLfloat)redComponent green:(GLfloat)greenComponent blue:(GLfloat)blueComponent alpha:(GLfloat)alphaComponent;

- (void)setCurrentlyReceivingMonochromeInput:(BOOL)newValue;

@end

Update GPUImageFillModeType enum to use NS_ENUM


// Copyright (c) 2011 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 UI_AURA_EVENT_FILTER_H_
#define UI_AURA_EVENT_FILTER_H_
#pragma once

#include "base/logging.h"
#include "ui/gfx/point.h"

namespace aura {

class Window;
class MouseEvent;

// An object that filters events sent to an owner window, potentially performing
// adjustments to the window's position, size and z-index.
class EventFilter {
 public:
  explicit EventFilter(Window* owner);
  virtual ~EventFilter();

  // Try to handle |event| (before the owner's delegate gets a chance to).
  // Returns true if the event was handled by the WindowManager and should not
  // be forwarded to the owner's delegate.
  virtual bool OnMouseEvent(Window* target, MouseEvent* event);

 protected:
  Window* owner() { return owner_; }

 private:
  Window* owner_;

  DISALLOW_COPY_AND_ASSIGN(EventFilter);
};

}  // namespace aura

#endif  // UI_AURA_EVENT_FILTER_H_

// Copyright (c) 2011 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 UI_AURA_EVENT_FILTER_H_
#define UI_AURA_EVENT_FILTER_H_
#pragma once

#include "base/basictypes.h"

namespace aura {

class Window;
class MouseEvent;

// An object that filters events sent to an owner window, potentially performing
// adjustments to the window's position, size and z-index.
class EventFilter {
 public:
  explicit EventFilter(Window* owner);
  virtual ~EventFilter();

  // Try to handle |event| (before the owner's delegate gets a chance to).
  // Returns true if the event was handled by the WindowManager and should not
  // be forwarded to the owner's delegate.
  virtual bool OnMouseEvent(Window* target, MouseEvent* event);

 protected:
  Window* owner() { return owner_; }

 private:
  Window* owner_;

  DISALLOW_COPY_AND_ASSIGN(EventFilter);
};

}  // namespace aura

#endif  // UI_AURA_EVENT_FILTER_H_

aura: Include basictypes.h for DISALLOW macro.

R=ben@chromium.org

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

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


/***************************************************************************************
 * MAIN.C
 *
 * Description: Converts raw ADC reads given via character device to time of flight
 *
 * (C) 2016 Visaoni
 * Licensed under the MIT License.
 **************************************************************************************/

#include <stdint.h>
#include <stdio.h>
//#include <unistd.h>
//#include <string.h>
#include <fcntl.h>
#include <sys/poll.h>

// TODO: Get these value from a shared source along with the firmware
#define TIME_BETWEEN_READS_NS    166.7
#define DELAY_TIME_NS            0
#define READS_PER_TX             2000
#define BYTES_PER_READ           2

#define CHARACTER_DEVICE_PATH    "/dev/rpmsg_pru31"
#define MAX_BUFFER_SIZE          (BYTES_PER_READ * READS_PER_TX)

double find_tof( uint16_t reads[] )
{
   size_t max = 0;
   size_t i;
   for( i = 0; i < READS_PER_TX; i++ )
   {
      if( reads[i] > reads[max] )
      {
         max = i;
      }
   }

   return DELAY_TIME_NS + max * TIME_BETWEEN_READS_NS;
}

int main(void)
{
   uint8_t buffer[ MAX_BUFFER_SIZE ];
   uint16_t* reads = (uint16_t*)buffer;   // Assumes little-endian

   struct pollfd pollfds[1];

   pollfds[0].fd = open( CHARACTER_DEVICE_PATH, O_RDWR );

   if( pollfds[0].fd < 0 )
   {
      printf( "Unable to open char device." );
      return -1;
   }

   // Firmware needs an initial write to grab metadata
      // msg contents irrelevant
   // TODO: Should probably handle errors better
   while( write( pollfds[0].fd, "s", 1 ) < 0 )
   {
      printf( "Problem with initial send. Retrying..." );
   }

   while(1)
   {
      // Grab a whole run and then process
      // TODO: Figure out of this is sufficient or if incremental processing is required for performance
      size_t total_bytes = 0;
      while( total_bytes < MAX_BUFFER_SIZE )
      {
         total_bytes += read( pollfds[0].fd, buffer + total_bytes, MAX_BUFFER_SIZE - total_bytes );
      }

      // reads and buffer are aliased
      double tof = find_tof( reads );
      printf( "Time of flight: %d ns", tof );
   }

	return 0;
}

Set up basic processing framework

Set up basic processing framework

Constructs read values from character device and passes it through the
most basic processing to find time of flight.


Add rows and cols assignment.

Add rows and cols assignment.


#include <kotaka/paths.h>
#include <game/paths.h>

inherit LIB_BIN;

void main(string args)
{
	object user;

	user = query_user();

	if (user->query_class() < 3) {
		send_out("You do not have sufficient access rights to reboot the help system.\n");
		return;
	}

	"~Help/initd"->full_reset();
}

Add command to reboot help system

Add command to reboot help system


/* EINA - EFL data type library
 * Copyright (C) 2008 Cedric Bail
 *
 * 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/>.
 */

#include "Eina.h"

EAPI int
eina_init(void)
{
   int r;

   r = eina_error_init();
   r += eina_hash_init();
   r += eina_stringshare_init();
   r += eina_list_init();
   r += eina_array_init();

   return r;
}

EAPI int
eina_shutdown(void)
{
   int r;

   eina_array_shutdown();
   eina_list_shutdown();
   r = eina_stringshare_shutdown();
   r += eina_hash_shutdown();
   r += eina_error_shutdown();

   return r;
}

/* EINA - EFL data type library
 * Copyright (C) 2008 Cedric Bail
 *
 * 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/>.
 */

#include "eina_error.h"
#include "eina_hash.h"
#include "eina_stringshare.h"
#include "eina_list.h"
#include "eina_array.h"

EAPI int
eina_init(void)
{
   int r;

   r = eina_error_init();
   r += eina_hash_init();
   r += eina_stringshare_init();
   r += eina_list_init();
   r += eina_array_init();

   return r;
}

EAPI int
eina_shutdown(void)
{
   int r;

   eina_array_shutdown();
   eina_list_shutdown();
   r = eina_stringshare_shutdown();
   r += eina_hash_shutdown();
   r += eina_error_shutdown();

   return r;
}

Remove warning and only include needed stuff.

git-svn-id: b99a075ee42e317ef7d0e499fd315684e5f6d838@35456 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33


#ifdef E_TYPEDEFS

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

#else
#ifndef E_ERROR_H
#define E_ERROR_H

EAPI void e_error_message_show_internal(char *txt);

#endif
#endif

#ifdef E_TYPEDEFS

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

#else
#ifndef E_ERROR_H
#define E_ERROR_H

EAPI void e_error_message_show_internal(char *txt);

#endif
#endif

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

Should fix devilhorn's compile error.

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

SVN revision: 61783


#include <tree_sitter/parser.h>

enum {
  EXTERNAL_A,
  EXTERNAL_B
};

void *tree_sitter_test_grammar_external_scanner_create() {
  return NULL;
}

void tree_sitter_test_grammar_external_scanner_destroy(void *payload) {
}

bool tree_sitter_test_grammar_external_scanner_scan(void *payload, TSLexer *lexer, const bool *valid_symbols) {
  while (lexer->lookahead == ' ') {
    lexer->advance(lexer, true);
  }

  if (lexer->lookahead == 'a') {
    lexer->advance(lexer, false);
    lexer->result_symbol = EXTERNAL_A;
    return true;
  }

  if (lexer->lookahead == 'b') {
    lexer->advance(lexer, false);
    lexer->result_symbol = EXTERNAL_B;
    return true;
  }

  return false;
}

void tree_sitter_test_grammar_external_scanner_reset(void *payload) {
}

bool tree_sitter_test_grammar_external_scanner_serialize(void *payload, TSExternalTokenState state) {
  return true;
}

void tree_sitter_test_grammar_external_scanner_deserialize(void *payload, TSExternalTokenState state) {
}

#include <tree_sitter/parser.h>

enum {
  EXTERNAL_A,
  EXTERNAL_B
};

void *tree_sitter_test_grammar_external_scanner_create() {
  return NULL;
}

void tree_sitter_test_grammar_external_scanner_destroy(void *payload) {
}

bool tree_sitter_test_grammar_external_scanner_scan(void *payload, TSLexer *lexer, const bool *valid_symbols) {
  while (lexer->lookahead == ' ') {
    lexer->advance(lexer, true);
  }

  if (lexer->lookahead == 'a') {
    lexer->advance(lexer, false);
    lexer->result_symbol = EXTERNAL_A;
    return true;
  }

  if (lexer->lookahead == 'b') {
    lexer->advance(lexer, false);
    lexer->result_symbol = EXTERNAL_B;
    return true;
  }

  return false;
}

void tree_sitter_test_grammar_external_scanner_reset(void *payload) {
}

unsigned tree_sitter_test_grammar_external_scanner_serialize(
  void *payload,
  char *buffer
) { return 0; }

void tree_sitter_test_grammar_external_scanner_deserialize(
  void *payload,
  const char *buffer,
  unsigned length) {}

Fix signature of fixture external scanner functions


#pragma once

#ifdef __gl_h_
    #error "glbinding is not compatible with gl.h"
#else
    #define __gl_h_
#endif

#ifdef __gl_h_
    #error "glbinding is not compatible with gl.h"
#endif

Revert gl.h emulation using __gl_h_ include guard


#include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>
/* This is Stack Implementation using a Linked list */
#define MAXSIZE 101
#define BOOL_PRINT(bool_expr) "%s\n", (bool_expr) ? "true" : "false"

typedef struct node{
	int data;
	struct node* link;
} node;

node* head; //global variable

node* create_newnode(int x){
		node* temp;
		temp = (node*) malloc (sizeof(node));
		temp->data =x;
		temp->link=NULL;
		return temp;

}

void push(int data){
	//this is equivalent to add a node at begining of the linked list
	node* temp;
	temp =create_newnode(data);
	temp->link = head;
	head = temp;
}

int pop(){
	//this is equivalent to delete a node at begining of the linked list
	if(head != NULL ){
	node* temp = head;
	head = temp->link;
	return temp->data;
	}

	else{
		printf("Error: Stack is empty \n");
		return -1;
	}
}

int isEmpty(){
	//this is equivalent to checking if the linked list is empty
	if(head != NULL) return false;
	else return true;
}

void stack_print(){

	//this is equivalent to printing a linked list while traversing
	printf("Stack is : ");

	node* temp = head;
	while(temp != NULL){
		printf("%d ", temp->data);
		temp = temp->link;
	}
	printf("\n");
}

int main(){

	int i;
	printf("is stack empty? \n");
	printf(BOOL_PRINT(isEmpty()));

	push(10);
	push(11);
	push(12);
	push(15);

	i = pop();
	printf("Popped data is %d\n",i );

	stack_print();

	return 0;
}

Add Linked List implementation of stack

Add Linked List implementation of stack


#include <pal.h>

/**
 *
 * Calculates the hyperbolic sine of the vector 'a'. Angles are specified
 * in radians.
 *
 * @param a     Pointer to input vector
 *
 * @param c     Pointer to output vector
 *
 * @param n     Size of 'a' and 'c' vector.
 *
 * @return      None
 *
 */
#include <math.h>
void p_sinh_f32(const float *a, float *c, int n)
{
    int i;
    for (i = 0; i < n; i++) {
        *(c + i) = sinhf(*(a + i));
    }
}

#include <pal.h>

/*
 * sinh z = (exp z - exp(-z)) / 2
 */
static inline float _p_sinh(const float z)
{
    float exp_z;
    p_exp_f32(&z, &exp_z, 1);
    return 0.5f * (exp_z - 1.f / exp_z);
}

/**
 *
 * Calculates the hyperbolic sine of the vector 'a'. Angles are specified
 * in radians.
 *
 * @param a     Pointer to input vector
 *
 * @param c     Pointer to output vector
 *
 * @param n     Size of 'a' and 'c' vector.
 *
 * @return      None
 *
 */
void p_sinh_f32(const float *a, float *c, int n)
{
    int i;
    for (i = 0; i < n; i++) {
        c[i] = _p_sinh(a[i]);
    }
}

Implement the hyperbolic sine function.

math:sinh: Implement the hyperbolic sine function.

Signed-off-by: Mansour Moufid <ac5f6b12fab5e0d4efa7215e6c2dac9d55ab77dc@gmail.com>


/**
 *  Internal MD/hash functions - no crypto, just data.
 *  This is used to avoid depending on MD_C just to query a length.
 *
 *  Copyright The Mbed TLS Contributors
 *  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_MD_INTERNAL_H
#define MBEDTLS_MD_INTERNAL_H

#include "common.h"

#include "mbedtls/md.h"

/** Get the output length of the given hash type
 *
 * \param md_type   The hash type.
 *
 * \return          The output length in bytes, or 0 if not known
 */
static inline unsigned char mbedtls_md_internal_get_size( mbedtls_md_type_t md_type )
{
    switch( md_type )
    {
#if defined(MBEDTLS_MD5_C) || defined(PSA_WANT_ALG_MD5)
        case MBEDTLS_MD_MD5:
            return( 16 );
#endif
#if defined(MBEDTLS_RIPEMD160_C) || defined(PSA_WANT_ALG_RIPEMD160) || \
    defined(MBEDTLS_SHA1_C) || defined(PSA_WANT_ALG_SHA_1)
        case MBEDTLS_MD_RIPEMD160:
        case MBEDTLS_MD_SHA1:
            return( 20 );
#endif
#if defined(MBEDTLS_SHA224_C) || defined(PSA_WANT_ALG_SHA_224)
        case MBEDTLS_MD_SHA224:
            return( 28 );
#endif
#if defined(MBEDTLS_SHA256_C) || defined(PSA_WANT_ALG_SHA_256)
        case MBEDTLS_MD_SHA256:
            return( 32 );
#endif
#if defined(MBEDTLS_SHA384_C) || defined(PSA_WANT_ALG_SHA_384)
        case MBEDTLS_MD_SHA384:
            return( 48 );
#endif
#if defined(MBEDTLS_SHA512_C) || defined(PSA_WANT_ALG_SHA_512)
        case MBEDTLS_MD_SHA512:
            return( 64 );
#endif
        default:
            return( 0 );
    }
}

#endif /* MBEDTLS_MD_INTERNAL_H */

Add internal MD size getter

Add internal MD size getter

Modules / tests that only need to get the size of a hash from its type,
without actually computing a hash, need not depend on MD_C.

Signed-off-by: Manuel Pégourié-Gonnard <4ba0d615aeeda88e422ca8fba28fe2938485facf@arm.com>


/**
 * Example of a typical library providing a C-interface
 */

#pragma once

#include "ivi-main-loop-c.h"

#ifdef __cplusplus
extern "C" {
#endif

static IVIMainLoop_EventSource_ReportStatus callbackMyCLibrary(const void *data)
{
    printf("callbackMyCLibrary\n");
    return IVI_MAIN_LOOP_KEEP_ENABLED;
}

/**
 * Initialize the library using the given source manager object where the library is going to add its event sources
 */
inline void my_c_library_init_function(IVIMainLoop_EventSourceManager *sourceManager)
{
    IVIMainLoop_TimeOut_CallBack callback = {.function = callbackMyCLibrary, .data = NULL};
    IVIMainLoop_TimeOutEventSource *source = ivi_main_loop_timeout_source_new(sourceManager, callback, 300);
    ivi_main_loop_timeout_source_enable(source);
}

#ifdef __cplusplus
}
#endif

/**
 * Example of a typical library providing a C-interface
 */

#pragma once

#include "ivi-main-loop-c.h"

#ifdef __cplusplus
extern "C" {
#endif

static IVIMainLoop_EventSource_ReportStatus callbackMyCLibrary(const void *data)
{
    printf("callbackMyCLibrary\n");
    return IVI_MAIN_LOOP_KEEP_ENABLED;
}

/**
 * Initialize the library using the given source manager object where the library is going to add its event sources
 */
static inline void my_c_library_init_function(IVIMainLoop_EventSourceManager *sourceManager)
{
    IVIMainLoop_TimeOut_CallBack callback = {.function = callbackMyCLibrary, .data = NULL};
    IVIMainLoop_TimeOutEventSource *source = ivi_main_loop_timeout_source_new(sourceManager, callback, 300);
    ivi_main_loop_timeout_source_enable(source);
}

#ifdef __cplusplus
}
#endif

Add missing static for inline functions (GCC 5)


#include <pthread.h>
#include <time.h>

#include "ws-eventing.h"
#include "wsman-debug.h"

static char g_event_source_url[] = "http://www.otc_event.com/event_source";
static EventingH  g_event_handler;

static void *publish_events(void *soap_handler);

void start_event_source(SoapH soap)
{
   pthread_t  publiser_thread;

   g_event_handler = wse_initialize_server(soap, g_event_source_url);
   pthread_create(&publiser_thread, NULL, publish_events, soap);

   printf("Eventing source started...\n");
}

void *publish_events(void *soap_handler)
{
   char            *action_list[] = {"random_event"};
   WsePublisherH   publisher_handler;
   WsXmlDocH       event_doc;
   struct timespec time_val = {10, 0};

   publisher_handler = wse_publisher_initialize((EventingH)g_event_handler, 1, action_list, NULL, NULL);

   while(1)
   {
      nanosleep(&time_val, NULL);
      event_doc = ws_xml_create_doc((SoapH)soap_handler, "rootNsUri", "rootName");  //TBD
      wse_send_notification(publisher_handler, event_doc, "http://otc.eventing.org/");
   }
}

Test code for ws-eventing server side

Test code for ws-eventing server side


// Copyright (c) 2010 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_BROWSER_COCOA_NSOBJECT_ZOMBIE_H_
#define CHROME_BROWSER_COCOA_NSOBJECT_ZOMBIE_H_
#pragma once

#import <Foundation/Foundation.h>

// You should think twice every single time you use anything from this
// namespace.
namespace ObjcEvilDoers {

// Enable zombies.  Returns NO if it fails to enable.
//
// When |zombieAllObjects| is YES, all objects inheriting from
// NSObject become zombies on -dealloc.  If NO, -shouldBecomeCrZombie
// is queried to determine whether to make the object a zombie.
//
// |zombieCount| controls how many zombies to store before freeing the
// oldest.  Set to 0 to free objects immediately after making them
// zombies.
BOOL ZombieEnable(BOOL zombieAllObjects, size_t zombieCount);

// Disable zombies.
void ZombieDisable();

}  // namespace ObjcEvilDoers

@interface NSObject (CrZombie)
- (BOOL)shouldBecomeCrZombie;
@end

#endif  // CHROME_BROWSER_COCOA_NSOBJECT_ZOMBIE_H_

// Copyright (c) 2010 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_BROWSER_COCOA_NSOBJECT_ZOMBIE_H_
#define CHROME_BROWSER_COCOA_NSOBJECT_ZOMBIE_H_
#pragma once

#import <Foundation/Foundation.h>

// You should think twice every single time you use anything from this
// namespace.
namespace ObjcEvilDoers {

// Enable zombie object debugging. This implements a variant of Apple's
// NSZombieEnabled which can help expose use-after-free errors where messages
// are sent to freed Objective-C objects in production builds.
//
// Returns NO if it fails to enable.
//
// When |zombieAllObjects| is YES, all objects inheriting from
// NSObject become zombies on -dealloc.  If NO, -shouldBecomeCrZombie
// is queried to determine whether to make the object a zombie.
//
// |zombieCount| controls how many zombies to store before freeing the
// oldest.  Set to 0 to free objects immediately after making them
// zombies.
BOOL ZombieEnable(BOOL zombieAllObjects, size_t zombieCount);

// Disable zombies.
void ZombieDisable();

}  // namespace ObjcEvilDoers

@interface NSObject (CrZombie)
- (BOOL)shouldBecomeCrZombie;
@end

#endif  // CHROME_BROWSER_COCOA_NSOBJECT_ZOMBIE_H_

Add link to explanation of what we mean by zombie
The person triaging / debugging a zombie crash may never have heard of this before.

BUG=None
TEST=None

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

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