#ifndef __PARSE_GIT_ST_H
#define __PARSE_GIT_ST_H

#include <vector>
#include <string>

const int PIPE_LINE_BUFFER_SIZE = 256;

class GitStatusParser {
    std::vector<std::string*> pipe_buffer;

    std::string* branch;
    std::vector<std::string*> new_files;
    std::vector<std::string*> modified_files;
    std::vector<std::string*> untracked_files;

    public:

    GitStatusParser();
    ~GitStatusParser();
    void parse();

    private:

    void load();
    void parseBranch();
    void parseNewFiles();
    void parseModifiedFiles();
    void parseUntrackedFiles();

};

#endif

#ifndef __PARSE_GIT_ST_H
#define __PARSE_GIT_ST_H

#include <vector>
#include <string>

const int PIPE_LINE_BUFFER_SIZE = 256;

class GitStatusParser {
    std::vector<std::string*> pipe_buffer;

    std::string* branch;
    std::vector<std::string*> new_files;
    std::vector<std::string*> modified_files;
    std::vector<std::string*> untracked_files;

    public:

    GitStatusParser();
    ~GitStatusParser();
    void parse();

    std::string* getBranch() { return branch; }
    std::vector<std::string*> getNewFiles() { return new_files; }
    std::vector<std::string*> getModifiedFiles() { return modified_files; }
    std::vector<std::string*> getUntrackedFiles() { return untracked_files; }

    private:

    void load();
    void parseBranch();
    void parseNewFiles();
    void parseModifiedFiles();
    void parseUntrackedFiles();

};

#endif

Add getters for branch and files.

Add getters for branch and files.


#include "config.h"
#include <util/delay.h>

#include "usart.h"

void send_block(unsigned bytes, char *buff)
{
    for(int i = 0; i < bytes; ++i)
    {
        usart_transmit(buff[i]);
    }
}

int main(int argc, char **argv)
{
    usart_init();

    char msg[] = "Loading bootloader in 3 seconds.";
    send_block(sizeof(msg), msg);
    _delay_ms(3000);

    typedef void (* fn_ptr_t) (void);
    fn_ptr_t my_ptr = (fn_ptr_t)0x1800;
    my_ptr();
}

#include "config.h"
#include <util/delay.h>

#include "usart.h"

void send_block(unsigned bytes, char *buff)
{
    for(int i = 0; i < bytes; ++i)
    {
        usart_transmit(buff[i]);
    }
}

int main(int argc, char **argv)
{
    usart_init();

    char msg[] = "Loading bootloader in 3 seconds.";
    send_block(sizeof(msg), msg);
    _delay_ms(3000);

    typedef void (* fn_ptr_t) (void);
    fn_ptr_t my_ptr = (fn_ptr_t)BOOTLOAD;
    my_ptr();
}

Test application was jumping to a wrong address.


#pragma once

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

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


//===-- llvm/Target/ARMTargetObjectFile.h - ARM Object Info -----*- C++ -*-===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

#ifndef LLVM_TARGET_ARM_TARGETOBJECTFILE_H
#define LLVM_TARGET_ARM_TARGETOBJECTFILE_H

#include "llvm/Target/TargetLoweringObjectFile.h"

namespace llvm {

  class ARMElfTargetObjectFile : public TargetLoweringObjectFileELF {
  public:
    ARMElfTargetObjectFile() : TargetLoweringObjectFileELF(true) {}

    void Initialize(MCContext &Ctx, const TargetMachine &TM) {
      TargetLoweringObjectFileELF::Initialize(Ctx, TM);

      // FIXME: Add new attribute/flag to MCSection for init_array/fini_array.
      // That will allow not treating these as "directives".
      if (TM.getSubtarget<ARMSubtarget>().isAAPCS_ABI()) {
        StaticCtorSection =
          getOrCreateSection("\t.section .init_array,\"aw\",%init_array", false,
                             SectionKind::getDataRel());
        StaticDtorSection =
          getOrCreateSection("\t.section .fini_array,\"aw\",%fini_array", false,
                             SectionKind::getDataRel());
      }
    }
  };
} // end namespace llvm

#endif

//===-- llvm/Target/ARMTargetObjectFile.h - ARM Object Info -----*- C++ -*-===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//

#ifndef LLVM_TARGET_ARM_TARGETOBJECTFILE_H
#define LLVM_TARGET_ARM_TARGETOBJECTFILE_H

#include "llvm/Target/TargetLoweringObjectFile.h"

namespace llvm {

  class ARMElfTargetObjectFile : public TargetLoweringObjectFileELF {
  public:
    ARMElfTargetObjectFile() : TargetLoweringObjectFileELF(true) {}

    void Initialize(MCContext &Ctx, const TargetMachine &TM) {
      TargetLoweringObjectFileELF::Initialize(Ctx, TM);

      // FIXME: Add new attribute/flag to MCSection for init_array/fini_array.
      // That will allow not treating these as "directives".
      if (TM.getSubtarget<ARMSubtarget>().isAAPCS_ABI()) {
        StaticCtorSection =
          getOrCreateSection(".init_array,\"aw\",%init_array", false,
                             SectionKind::getDataRel());
        StaticDtorSection =
          getOrCreateSection(".fini_array,\"aw\",%fini_array", false,
                             SectionKind::getDataRel());
      }
    }
  };
} // end namespace llvm

#endif

Fix a typo - this unbreaks llvm-gcc build on arm

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


#include <stdlib.h>
#ifndef __QUEUE_H__
#define __QUEUE_H__
struct Queue;
typedef struct Queue Queue;

#endif

#include <stdlib.h>
#ifndef __QUEUE_H__
#define __QUEUE_H__
struct Queue;
typedef struct Queue Queue;

Queue* Queue_Create(size_t n);
void Queue_Destroy(Queue* q);
void Queue_Enqueue(Queue* q, void* e);
void* Queue_Dequeue(Queue* q);
#endif

Add basic operation function declaration


/*
 * Driver for VIA PadLock
 *
 * Copyright (c) 2004 Michal Ludvig <michal@logix.cz>
 *
 * 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.
 *
 */

#ifndef _CRYPTO_PADLOCK_H
#define _CRYPTO_PADLOCK_H

#define PADLOCK_ALIGNMENT 16

/* Control word. */
struct cword {
	int __attribute__ ((__packed__))
		rounds:4,
		algo:3,
		keygen:1,
		interm:1,
		encdec:1,
		ksize:2;
} __attribute__ ((__aligned__(PADLOCK_ALIGNMENT)));

#define PFX	"padlock: "

#ifdef CONFIG_CRYPTO_DEV_PADLOCK_AES
int padlock_init_aes(void);
void padlock_fini_aes(void);
#endif

#endif	/* _CRYPTO_PADLOCK_H */

/*
 * Driver for VIA PadLock
 *
 * Copyright (c) 2004 Michal Ludvig <michal@logix.cz>
 *
 * 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.
 *
 */

#ifndef _CRYPTO_PADLOCK_H
#define _CRYPTO_PADLOCK_H

#define PADLOCK_ALIGNMENT 16

/* Control word. */
struct cword {
	unsigned int __attribute__ ((__packed__))
		rounds:4,
		algo:3,
		keygen:1,
		interm:1,
		encdec:1,
		ksize:2;
} __attribute__ ((__aligned__(PADLOCK_ALIGNMENT)));

#define PFX	"padlock: "

#ifdef CONFIG_CRYPTO_DEV_PADLOCK_AES
int padlock_init_aes(void);
void padlock_fini_aes(void);
#endif

#endif	/* _CRYPTO_PADLOCK_H */

[PADLOCK] Fix sparse warning about 1-bit signed bit-field

Change the bit-field in struct cword to unsigned to shut sparse up.

Signed-off-by: Herbert Xu <ef65de1c7be0aa837fe7b25ba9a7739905af6a55@gondor.apana.org.au>


#ifndef GUI_COMPONENTS
#define GUI_COMPONENTS

void typewriterTextEffect() {

}

//reminder: use composition
//reminder: game will be played almost entirely through keyboard

class TextBox {

};

class ContextMenu {};

#endif

#ifndef GUI_COMPONENTS
#define GUI_COMPONENTS

#endif

DELETE USELESS CLASSES -ok that was fun

DELETE USELESS CLASSES -ok that was fun


#include <stdint.h>
#include <stdbool.h>
#include <stdio.h>
#include <time.h>
#include <string.h>

#include <board_driver/uart.h>
#include <board_driver/rtc.h>

int main(void) {
	uart_init();
	printf("Starting\n\n");
	printf("RTC status: %d\n", BSP_RTC_Init());

	struct tm ti;

	char month[3];

	sscanf(__DATE__, "%s %d %d", month, &ti.tm_mday, &ti.tm_year);

	ti.tm_year -= 1900;

	if(!strcmp(month, "Jan"))
		ti.tm_mon = 1;
	else if(!strcmp(month, "Feb"))
		ti.tm_mon = 2;
	else if(!strcmp(month, "Mar"))
		ti.tm_mon = 3;
	else if(!strcmp(month, "Apr"))
		ti.tm_mon = 4;
	else if(!strcmp(month, "May"))
		ti.tm_mon = 5;
	else if(!strcmp(month, "Jun"))
		ti.tm_mon = 6;
	else if(!strcmp(month, "Jul"))
		ti.tm_mon = 7;
	else if(!strcmp(month, "Aug"))
		ti.tm_mon = 8;
	else if(!strcmp(month, "Sep"))
		ti.tm_mon = 9;
	else if(!strcmp(month, "Oct"))
		ti.tm_mon = 10;
	else if(!strcmp(month, "Nov"))
		ti.tm_mon = 11;
	else if(!strcmp(month, "Dec"))
		ti.tm_mon = 12;

	sscanf(__TIME__, "%d:%d:%d", &ti.tm_hour, &ti.tm_min, &ti.tm_sec);

	uint32_t unixTime = mktime(&ti);
	RTC_Update_Date_Time(unixTime);

	while (1) {
		Date_Time_t now;
		RTC_Get_Date_Time(&now);
		printf("time: %02d:%02d:%02d, %02d/%02d/%02d\n", now.hours, now.minutes, now.seconds, now.date, now.month, (now.year + 1900));
		HAL_Delay(1000);
	}
}

Update clock file from other repo

board_driver/rtc: Update clock file from other repo

This contains a main function and need to be rewritten
as a part of the RTC driver.


#pragma once

#include <memory>

#include <nonstd/optional.hpp>

#include "xchainer/array.h"

namespace xchainer {

class OpNode;

class ArrayNode {
public:
    ArrayNode() = default;

    const std::shared_ptr<OpNode>& next_node() { return next_node_; }
    std::shared_ptr<const OpNode> next_node() const { return next_node_; }

    void set_next_node(std::shared_ptr<OpNode> next_node) { next_node_ = std::move(next_node); }

    const nonstd::optional<Array>& grad() const { return grad_; }

    void set_grad(Array grad) { grad_.emplace(std::move(grad)); };

    void ClearGrad() { grad_ = nonstd::nullopt; }

private:
    std::shared_ptr<OpNode> next_node_;
    nonstd::optional<Array> grad_;
};

}  // xchainer

#pragma once

#include <memory>

#include <nonstd/optional.hpp>

#include "xchainer/array.h"

namespace xchainer {

class OpNode;

class ArrayNode {
public:
    ArrayNode() = default;

    const std::shared_ptr<OpNode>& next_node() { return next_node_; }
    std::shared_ptr<const OpNode> next_node() const { return next_node_; }

    void set_next_node(std::shared_ptr<OpNode> next_node) { next_node_ = std::move(next_node); }

    const nonstd::optional<Array>& grad() const { return grad_; }

    void set_grad(Array grad) { grad_.emplace(std::move(grad)); };

    void ClearGrad() { grad_.reset(); }

private:
    std::shared_ptr<OpNode> next_node_;
    nonstd::optional<Array> grad_;
};

}  // xchainer

Use reset() to make optional empty

Use reset() to make optional empty


/*
 * This file is part of wysiwidi
 *
 * Copyright (C) 2014 Intel Corporation.
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
 * 02110-1301 USA
 */

#ifndef DRIVER_H_
#define DRIVER_H_

#include <string>
#include <memory>

#include "scanner.h"
#include "message.h"
#include "payload.h"
#include "parser.tab.hpp"

namespace wfd {

class Driver {
 public:
  ~Driver();

  void Parse(const std::string& input, Message*& message /*out*/);

 private:
  std::unique_ptr<Parser> parser_;
  std::unique_ptr<Scanner> scanner_;
};

}  // namespace wfd

#endif  // DRIVER_H_

/*
 * This file is part of wysiwidi
 *
 * Copyright (C) 2014 Intel Corporation.
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
 * 02110-1301 USA
 */

#ifndef DRIVER_H_
#define DRIVER_H_

#include <string>
#include <memory>

#include "scanner.h"
#include "message.h"
#include "payload.h"
#include "parser.tab.hpp"

namespace wfd {

class Driver {
 public:
  Driver() = default;
  ~Driver();

  void Parse(const std::string& input, Message*& message /*out*/);

 private:
  std::unique_ptr<Parser> parser_;
  std::unique_ptr<Scanner> scanner_;
};

}  // namespace wfd

#endif  // DRIVER_H_

Add user-defined constructor to the wfd::Driver class


/* Copyright (c) 2002-2008 Dovecot authors, see the included COPYING file */

#include "common.h"
#include "commands.h"
#include "imap-expunge.h"

bool cmd_close(struct client_command_context *cmd)
{
	struct client *client = cmd->client;
	struct mailbox *mailbox = client->mailbox;
	struct mail_storage *storage;

	if (!client_verify_open_mailbox(cmd))
		return TRUE;

	storage = mailbox_get_storage(mailbox);
	client->mailbox = NULL;

	if (!imap_expunge(mailbox, NULL))
		client_send_untagged_storage_error(client, storage);

	if (mailbox_close(&mailbox) < 0)
                client_send_untagged_storage_error(client, storage);
	client_update_mailbox_flags(client, NULL);

	client_send_tagline(cmd, "OK Close completed.");
	return TRUE;
}

/* Copyright (c) 2002-2008 Dovecot authors, see the included COPYING file */

#include "common.h"
#include "commands.h"
#include "imap-expunge.h"

bool cmd_close(struct client_command_context *cmd)
{
	struct client *client = cmd->client;
	struct mailbox *mailbox = client->mailbox;
	struct mail_storage *storage;

	if (!client_verify_open_mailbox(cmd))
		return TRUE;

	storage = mailbox_get_storage(mailbox);
	client->mailbox = NULL;

	if (!imap_expunge(mailbox, NULL))
		client_send_untagged_storage_error(client, storage);
	else if (mailbox_sync(mailbox, 0, 0, NULL) < 0)
		client_send_untagged_storage_error(client, storage);

	if (mailbox_close(&mailbox) < 0)
                client_send_untagged_storage_error(client, storage);
	client_update_mailbox_flags(client, NULL);

	client_send_tagline(cmd, "OK Close completed.");
	return TRUE;
}

CLOSE: Synchronize the mailbox after expunging messages to actually get them
expunged.

--HG--
branch : HEAD


/* Copyright (c) 2005-2008 Dovecot authors, see the included COPYING file */

#include "lib.h"
#include "istream-internal.h"
#include "istream-zlib.h"

#ifdef HAVE_BZLIB
#include <bzlib.h>

#define BZLIB_INCLUDE

#define gzFile BZFILE
#define gzdopen BZ2_bzdopen
#define gzclose BZ2_bzclose
#define gzread BZ2_bzread
#define gzseek BZ2_bzseek

#define i_stream_create_zlib i_stream_create_bzlib
#include "istream-zlib.c"
#endif

/* Copyright (c) 2005-2008 Dovecot authors, see the included COPYING file */

#include "lib.h"
#include "istream-internal.h"
#include "istream-zlib.h"

#ifdef HAVE_BZLIB
#include <stdio.h>
#include <bzlib.h>

#define BZLIB_INCLUDE

#define gzFile BZFILE
#define gzdopen BZ2_bzdopen
#define gzclose BZ2_bzclose
#define gzread BZ2_bzread
#define gzseek BZ2_bzseek

#define i_stream_create_zlib i_stream_create_bzlib
#include "istream-zlib.c"
#endif

bzlib: Include stdio.h in case bzlib.h needs it.


#include <stdio.h>

#define NUMERO_DE_TENTATIVAS 5

int main() {

  // imprime o cabecalho do nosso jogo
  printf("******************************************\n");
  printf("* Bem vindo ao nosso jogo de adivinhação *\n");
  printf("******************************************\n");

  int numerosecreto = 42;

  int chute;

  for(int i = 1; i <= NUMERO_DE_TENTATIVAS; i++) {

    printf("Tentativa %d de %d\n", i, NUMERO_DE_TENTATIVAS);
    printf("Qual é o seu chute? ");

    scanf("%d", &chute);
    printf("Seu chute foi %d\n", chute);

    int acertou = chute == numerosecreto;
    int maior = chute > numerosecreto;
    int menor = chute < numerosecreto;

    if(acertou) {
      printf("Parabéns! Você acertou!\n");
      printf("Jogue de novo, você é um bom jogador!\n");
      break;
    }

    else if(maior) {
      printf("Seu chute foi maior que o número secreto\n");
    }

    else {
      printf("Seu chute foi menor que o número secreto\n");
    }

  }

  printf("Fim de jogo!\n");

}

#include <stdio.h>

#define NUMERO_DE_TENTATIVAS 5

int main() {

  // imprime o cabecalho do nosso jogo
  printf("******************************************\n");
  printf("* Bem vindo ao nosso jogo de adivinhação *\n");
  printf("******************************************\n");

  int numerosecreto = 42;

  int chute;

  for(int i = 1; i <= NUMERO_DE_TENTATIVAS; i++) {

    printf("Tentativa %d de %d\n", i, NUMERO_DE_TENTATIVAS);
    printf("Qual é o seu chute? ");

    scanf("%d", &chute);
    printf("Seu chute foi %d\n", chute);

    if(chute < 0) {
      printf("Você não pode chutar números negativos!\n");
      i--;

      continue;
    }

    int acertou = chute == numerosecreto;
    int maior = chute > numerosecreto;
    int menor = chute < numerosecreto;

    if(acertou) {
      printf("Parabéns! Você acertou!\n");
      printf("Jogue de novo, você é um bom jogador!\n");

      break;
    }

    else if(maior) {
      printf("Seu chute foi maior que o número secreto\n");
    }

    else {
      printf("Seu chute foi menor que o número secreto\n");
    }

  }

  printf("Fim de jogo!\n");

}

Update files, Alura, Introdução a C, Aula 2.9


//
//  JMAttributedFormat.h
//  JMAttributedFormat
//
//  Created by Jonathon Mah on 2015-04-11.
//  This file is licensed under the MIT License. See LICENSE.txt for full details.
//

#import <Foundation/Foundation.h>

@interface NSObject (JMAttributedFormat_Optional)
- (NSAttributedString *)attributedDescription;
@end

@interface NSAttributedString (JMAttributedFormat)

+ (instancetype)attributedStringWithFormat:(NSString *)formatString, ... NS_FORMAT_FUNCTION(1,2);
+ (instancetype)attributedStringWithBaseAttributes:(NSDictionary *)baseAttributes format:(NSString *)formatString, ... NS_FORMAT_FUNCTION(2,3);
- (instancetype)initWithBaseAttributes:(NSDictionary *)baseAttributes format:(NSString *)formatString, ... NS_FORMAT_FUNCTION(2,3);
- (instancetype)initWithBaseAttributes:(NSDictionary *)baseAttributes format:(NSString *)formatString arguments:(va_list)argList NS_FORMAT_FUNCTION(2,0);

@end

//
//  JMAttributedFormat.h
//  JMAttributedFormat
//
//  Created by Jonathon Mah on 2015-04-11.
//  This file is licensed under the MIT License. See LICENSE.txt for full details.
//

#import <Foundation/Foundation.h>

@interface NSObject (JMAttributedFormat_Optional)
- (nullable NSAttributedString *)attributedDescription;
@end

@interface NSAttributedString (JMAttributedFormat)

+ (nullable instancetype)attributedStringWithFormat:(nonnull NSString *)formatString, ... NS_FORMAT_FUNCTION(1,2);
+ (nullable instancetype)attributedStringWithBaseAttributes:(nullable NSDictionary *)baseAttributes format:(nonnull NSString *)formatString, ... NS_FORMAT_FUNCTION(2,3);
- (nullable instancetype)initWithBaseAttributes:(nullable NSDictionary *)baseAttributes format:(nonnull NSString *)formatString, ... NS_FORMAT_FUNCTION(2,3);
- (nullable instancetype)initWithBaseAttributes:(nullable NSDictionary *)baseAttributes format:(nonnull NSString *)formatString arguments:(va_list)argList NS_FORMAT_FUNCTION(2,0);

@end

Add nullable annotations to header

Add nullable annotations to header


/*
 *  hooks.h
 *  StatusSpec project
 *
 *  Copyright (c) 2014 thesupremecommander
 *  BSD 2-Clause License
 *  http://opensource.org/licenses/BSD-2-Clause
 *
 */

#pragma once

#include "stdafx.h"

#include <map>

#define CLIENT_DLL
#define GLOWS_ENABLE

#include "cdll_int.h"
#include "KeyValues.h"
#include "igameresources.h"
#include "vgui/vgui.h"
#include "vgui/IPanel.h"
#include "cbase.h"
#include "c_basecombatcharacter.h"
#include "glow_outline_effect.h"

#include <sourcehook/sourcehook_impl.h>
#include <sourcehook/sourcehook.h>

using namespace vgui;

class C_TFPlayer;

#if defined _WIN32
#define OFFSET_GETGLOWEFFECTCOLOR 223
#define OFFSET_UPDATEGLOWEFFECT 224
#define OFFSET_DESTROYGLOWEFFECT 225
#endif

static std::map<EHANDLE, int> onDataChangedHooks;

extern SourceHook::ISourceHook *g_SHPtr;
extern int g_PLID;

/*
 *  hooks.h
 *  StatusSpec project
 *
 *  Copyright (c) 2014 thesupremecommander
 *  BSD 2-Clause License
 *  http://opensource.org/licenses/BSD-2-Clause
 *
 */

#pragma once

#include "stdafx.h"

#include <map>

#define CLIENT_DLL
#define GLOWS_ENABLE

#include "cdll_int.h"
#include "KeyValues.h"
#include "igameresources.h"
#include "vgui/vgui.h"
#include "vgui/IPanel.h"
#include "cbase.h"
#include "c_basecombatcharacter.h"
#include "glow_outline_effect.h"

#include <sourcehook/sourcehook_impl.h>
#include <sourcehook/sourcehook.h>

using namespace vgui;

class C_TFPlayer;

#if defined _WIN32
#define OFFSET_GETGLOWEFFECTCOLOR 223
#define OFFSET_UPDATEGLOWEFFECT 224
#define OFFSET_DESTROYGLOWEFFECT 225
#endif

extern SourceHook::ISourceHook *g_SHPtr;
extern int g_PLID;

Remove map not used anymore.

Remove map not used anymore.


//PLEASE INCLUDE THIS FILE ON ANY ANNWVYN HEADER

/*This file conrain macro and symbols definition that have to be
* parsed by precompiler on each file.
* They handle diferencies between compilers
*/

//-------------------------DLL EXPORT -------------------------------//
//DLL management for visual studio compiller.
#undef DLL
#ifdef DLLDIR_EX //Defined in Annwvyn MSVC project file
//To contruct a DLL, The macro __declspec(dllexport) have to be called in front of the exported symbol
   #define DLL  __declspec(dllexport)   // export DLL information
#else
//To reference symbols from a DLL the macro __declspec(dllimport) have to be called the same way
   #define DLL  __declspec(dllimport)   // import DLL information
#endif
//Bypass on GNU/Linux :
#ifdef __gnu_linux__ //All that stuff is handeled by the makefile and the way g++ is called. DLL have to be empty but declared.
	#undef DLL
	#define DLL
#endif
//--------------------------------------------------------------------//

//--------------------Application Entrypoint definition--------------//
//Main definition :
#undef AnnMain()

#if OGRE_PLATFORM == PLATFORM_WIN32 || OGRE_PLATFORM == OGRE_PLATFORM_WIN32
//On windows :
#define WIN32_LEAN_AND_MEAN
#include "windows.h"
#define AnnMain() INT WINAPI WinMain(HINSTANCE hInst, HINSTANCE, LPSTR strCmdLine, INT)

#else
//On others :
#define AnnMain() int main(int argc, char** argv)
#endif
//---------------------------------------------------------------------//

//PLEASE INCLUDE THIS FILE ON ANY ANNWVYN HEADER

/*This file conrain macro and symbols definition that have to be
* parsed by precompiler on each file.
* They handle diferencies between compilers
*/

//-------------------------DLL EXPORT -------------------------------//
//DLL management for visual studio compiller.
#undef DLL
#ifdef DLLDIR_EX //Defined in Annwvyn MSVC project file
//To contruct a DLL, The macro __declspec(dllexport) have to be called in front of the exported symbol
   #define DLL  __declspec(dllexport)   // export DLL information
#else
//To reference symbols from a DLL the macro __declspec(dllimport) have to be called the same way
   #define DLL  __declspec(dllimport)   // import DLL information
#endif
//Bypass on GNU/Linux :
#ifdef __gnu_linux__ //All that stuff is handeled by the makefile and the way g++ is called. DLL have to be empty but declared.
	#undef DLL
	#define DLL
#endif
//--------------------------------------------------------------------//

//--------------------Application Entrypoint definition--------------//
//Main definition :
#undef AnnMain

#ifdef _WIN32
#define WIN32_LEAN_AND_MEAN
#include "windows.h"
#define AnnMain() INT WINAPI WinMain(HINSTANCE hInst, HINSTANCE, LPSTR strCmdLine, INT)

#else
//On others :
#define AnnMain() int main(int argc, char** argv)
#endif
//---------------------------------------------------------------------//

Correct compillation for GCC apparently...


#include <sys/types.h>
#include <stdint.h>

typedef int8_t s8;
typedef uint8_t u8;
typedef int16_t s16;
typedef uint16_t u16;
typedef int32_t s32;
typedef uint32_t u32;
typedef int64_t s64;
typedef uint64_t u64;
typedef signed long sL;
typedef unsigned long uL;
typedef float f32;
typedef double f64;
typedef unsigned long ulong;
typedef void* pointer;

#define GVAR(T) \
    T gvar_##T; \
    T gvar_##T##_get() { return gvar_##T; }; \
    void gvar_##T##_set(T v) { gvar_##T = v; }

GVAR(s8);
GVAR(u8);
GVAR(s16);
GVAR(u16);
GVAR(s32);
GVAR(u32);
GVAR(s64);
GVAR(u64);
GVAR(long);
GVAR(ulong);
GVAR(pointer);

#include <sys/types.h>
#include <stdint.h>

typedef int8_t s8;
typedef uint8_t u8;
typedef int16_t s16;
typedef uint16_t u16;
typedef int32_t s32;
typedef uint32_t u32;
typedef int64_t s64;
typedef uint64_t u64;
typedef signed long sL;
typedef unsigned long uL;
typedef float f32;
typedef double f64;
typedef unsigned long ulong;
typedef void* pointer;

#define GVAR(T) \
    extern T gvar_##T; \
    T gvar_##T = (T) -1; \
    T gvar_##T##_get() { return gvar_##T; }; \
    void gvar_##T##_set(T v) { gvar_##T = v; }

GVAR(s8);
GVAR(u8);
GVAR(s16);
GVAR(u16);
GVAR(s32);
GVAR(u32);
GVAR(s64);
GVAR(u64);
GVAR(long);
GVAR(ulong);
GVAR(pointer);

Initialize all the global vars in the hope it will stop MacOS from complaining


/* There is no include guard here - by purpose. This file can be included
 * after system includes that redefine the assert() macro.
 * The actual problem for which this file got separated from utilities.h
 * happens in the sat-solver code, when local include files include
 * Solver.h which in turn includes the system's assert.h. */

#include "error.h" /* for prt_error() */

#ifndef STRINGIFY
#define STR(x) #x
#define STRINGIFY(x) STR(x)
#endif /* STRINGIFY */

#define FILELINE __FILE__ ":" STRINGIFY(__LINE__)

#ifdef _WIN32
#define DEBUG_TRAP (*((volatile int*) 0x0) = 42)
#else
#define DEBUG_TRAP __builtin_trap()
#endif

#define assert(ex, ...) {                                                   \
	if (!(ex)) {                                                             \
		fprintf(stderr, "Fatal error: \nAssertion (" #ex ") failed at " FILELINE ": " __VA_ARGS__);  \
		fprintf(stderr, "\n");                                                \
		DEBUG_TRAP;  /* leave stack trace in debugger */                      \
	}                                                                        \
}

/* There is no include guard here - by purpose. This file can be included
 * after system includes that redefine the assert() macro.
 * The actual problem for which this file got separated from utilities.h
 * happens in the sat-solver code, when local include files include
 * Solver.h which in turn includes the system's assert.h. */

#include "error.h" /* for prt_error() */

#ifndef STRINGIFY
#define STR(x) #x
#define STRINGIFY(x) STR(x)
#endif /* STRINGIFY */

#define FILELINE __FILE__ ":" STRINGIFY(__LINE__)

#ifdef _WIN32
#define DEBUG_TRAP (*((volatile int*) 0x0) = 42)
#else
#define DEBUG_TRAP __builtin_trap()
#endif

/* FIXME:
 * 1. If the error_handler is not NULL, use prt_error() too (after calling
 *    fprintf()), in order to allow an error_handler to log, produce trace, or
 *    show the assert() message in a (possibly pop-up) window.
 * 2. Don't use DEBUG_TRAP (or exit) directly, but instead call a function
 *    pointer like lg_exit(code) to allow the LG library to be embedded in an
 *    application like an editor. If not set, the default will still be
 *    DEBUG_TRAP. */
#define assert(ex, ...) {                                                   \
	if (!(ex)) {                                                             \
		fprintf(stderr, "Fatal error: \nAssertion (" #ex ") failed at " FILELINE ": " __VA_ARGS__);  \
		fprintf(stderr, "\n");                                                \
		DEBUG_TRAP;  /* leave stack trace in debugger */                      \
	}                                                                        \
}

assert(): Document 2 FIXME's for an app-embedded LG library


#include <stdio.h>
#include <string.h>
#include "chpllaunch.h"
#include "chpl_mem.h"
#include "error.h"

static char* chpl_launch_create_command(int argc, char* argv[],
                                        int32_t numLocales) {
  int i;
  int size;
  char baseCommand[256];
  char* command;

  chpl_compute_real_binary_name(argv[0]);

  sprintf(baseCommand, "zebra -fast -r %s", chpl_get_real_binary_name());

  size = strlen(baseCommand) + 1;

  for (i=1; i<argc; i++) {
    size += strlen(argv[i]) + 3;
  }

  command = chpl_malloc(size, sizeof(char), CHPL_RT_MD_COMMAND_BUFFER, -1, "");

  sprintf(command, "%s", baseCommand);
  for (i=1; i<argc; i++) {
    strcat(command, " '");
    strcat(command, argv[i]);
    strcat(command, "'");
  }

  if (strlen(command)+1 > size) {
    chpl_internal_error("buffer overflow");
  }

  return command;
}

int chpl_launch(int argc, char* argv[], int32_t numLocales) {
  return chpl_launch_using_system(chpl_launch_create_command(argc, argv, numLocales),
                                  argv[0]);
}

int chpl_launch_handle_arg(int argc, char* argv[], int argNum,
                           int32_t lineno, chpl_string filename) {
  return 0;
}

void chpl_launch_print_help(void) {
}

#include <stdio.h>
#include <string.h>
#include "chpllaunch.h"
#include "chpl_mem.h"
#include "error.h"

static char** chpl_launch_create_argv(int argc, char* argv[]) {
  const int largc = 3;
  char *largv[largc];

  largv[0] = (char *) "zebra";
  largv[1] = (char *) "-fast";
  largv[2] = (char *) "-r";

  return chpl_bundle_exec_args(argc, argv, largc, largv);
}

int chpl_launch(int argc, char* argv[], int32_t numLocales) {
  if (numLocales != 1) {
    // This error should be taken care of before we get to this point
    chpl_internal_error("The XMT launcher only supports numLocales==1");
  }

  return chpl_launch_using_exec("zebra",
                                chpl_launch_create_argv(argc, argv),
                                argv[0]);
}

int chpl_launch_handle_arg(int argc, char* argv[], int argNum,
                           int32_t lineno, chpl_string filename) {
  return 0;
}

void chpl_launch_print_help(void) {
}

Update the zebra launcher to use chpl_launch_using_exec() as
implemented in r18010.

git-svn-id: 88467cb1fb04b8a755be7e1ee1026be4190196ef@18032 3a8e244f-b0f2-452b-bcba-4c88e055c3ca


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

#ifdef FCB_PRESENT

#include <fcb/fcb.h>
#include "config/config.h"

struct conf_file {
    struct cf_storage cf_itf;
    struct fcb cf_fcb;
};

int conf_fcb_src(struct conf_fcb *fcb);
int conf_fcb_dst(struct conf_fcb *fcb);

#endif

#endif /* __SYS_CONFIG_FCB_H_ */

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

#ifdef FCB_PRESENT

#include <fcb/fcb.h>
#include "config/config.h"

struct conf_fcb {
    struct conf_store cf_store;
    struct fcb cf_fcb;
};

int conf_fcb_src(struct conf_fcb *fcb);
int conf_fcb_dst(struct conf_fcb *fcb);

#endif

#endif /* __SYS_CONFIG_FCB_H_ */

Update to catch up with renames of internal structures.


#include <fcntl.h>

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

#include <string.h>

#include <sys/mman.h>
#include <sys/stat.h>

#include <unistd.h>

#include "base.h"

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

    srand( 23898645 );

    uint16 blocks = 4;
    uint64 elements = 128;
    if( argc == 3 ) {
        blocks = (uint16) atoi( argv[1] );
        elements = (uint64) atoi( argv[2] );
    }
    print("Making %hu blocks of %lu elements", blocks, elements );

    uint64 block[elements];

    for( uint16 i = 0; i<blocks; i++ ) {

        char filename[255];
        sprintf( filename, "sample_%06hu.block", i);
        print("Generating file: %s", filename);
        uint64 step = rand() % 100; // ensure some collisions between multiple sample files
        block[0] = rand() % 100; // ensure some overlap

        FILE* fp = fopen( filename, "w" );
        if( !fp ) {
            perror("File opening failed");
            exit( EXIT_FAILURE );
        }

        for( uint64 j = 1; j < elements; j++ ) {
            block[j] = block[ j-1 ] + step;
        }
        fwrite( block, sizeof(uint64), elements, fp );

        fclose(fp);
    }

    exit( EXIT_SUCCESS );
}

Make some sample blocks for merging

Make some sample blocks for merging


//
//  iOSKit.h
//  iOSKit
//
//  Created by Yarik Smirnov on 1/23/12.
//  Copyright (c) 2012 e-Legion ltd. All rights reserved.
//

#ifndef Elegion_iOSKit_h
#define Elegion_iOSKit_h

#import "ELIconView.h"
#import "ELInfoView.h"
#import "ELPickerView.h"
#import "ELSwipeController.h"

#endif

Add Drawing Kit header in general header


#ifndef _ASM_POWERPC_KMAP_TYPES_H
#define _ASM_POWERPC_KMAP_TYPES_H

#ifdef __KERNEL__

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

enum km_type {
	KM_BOUNCE_READ,
	KM_SKB_SUNRPC_DATA,
	KM_SKB_DATA_SOFTIRQ,
	KM_USER0,
	KM_USER1,
	KM_BIO_SRC_IRQ,
	KM_BIO_DST_IRQ,
	KM_PTE0,
	KM_PTE1,
	KM_IRQ0,
	KM_IRQ1,
	KM_SOFTIRQ0,
	KM_SOFTIRQ1,
	KM_PPC_SYNC_PAGE,
	KM_PPC_SYNC_ICACHE,
	KM_TYPE_NR
};

#endif	/* __KERNEL__ */
#endif	/* _ASM_POWERPC_KMAP_TYPES_H */

#ifndef _ASM_POWERPC_KMAP_TYPES_H
#define _ASM_POWERPC_KMAP_TYPES_H

#ifdef __KERNEL__

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

enum km_type {
	KM_BOUNCE_READ,
	KM_SKB_SUNRPC_DATA,
	KM_SKB_DATA_SOFTIRQ,
	KM_USER0,
	KM_USER1,
	KM_BIO_SRC_IRQ,
	KM_BIO_DST_IRQ,
	KM_PTE0,
	KM_PTE1,
	KM_IRQ0,
	KM_IRQ1,
	KM_SOFTIRQ0,
	KM_SOFTIRQ1,
	KM_PPC_SYNC_PAGE,
	KM_PPC_SYNC_ICACHE,
	KM_TYPE_NR
};

/*
 * This is a temporary build fix that (so they say on lkml....) should no longer
 * be required after 2.6.33, because of changes planned to the kmap code.
 * Let's try to remove this cruft then.
 */
#ifdef CONFIG_DEBUG_HIGHMEM
#define KM_NMI		(-1)
#define KM_NMI_PTE	(-1)
#define KM_IRQ_PTE	(-1)
#endif

#endif	/* __KERNEL__ */
#endif	/* _ASM_POWERPC_KMAP_TYPES_H */

powerpc: Fix DEBUG_HIGHMEM build break from d4515646699

Code was added to mm/higmem.c that depends on several
kmap types that powerpc does not support.  We add dummy
invalid definitions for KM_NMI, KM_NM_PTE, and KM_IRQ_PTE.

According to list discussion, this fix should not be needed
anymore starting with 2.6.33.  The code is commented to this
effect so hopefully we will remember to remove this.

Signed-off-by: Becky Bruce <f047d6ac93d5e15bc5478b9d8f9d5417f11532d4@kernel.crashing.org>
Signed-off-by: Benjamin Herrenschmidt <a7089bb6e7e92505d88aaff006cbdd60cc9120b6@kernel.crashing.org>


/* $Id$

	Everything needed by the C demo programs.
	Created to avoid junking up plplot.h with this stuff.
*/

#ifndef __PLCDEMOS_H__
#define __PLCDEMOS_H__

#include "plConfig.h"
#include "plplot.h"
#include <math.h>
#include <string.h>
#include <ctype.h>

/* define PI if not defined by math.h */

/* Actually M_PI seems to be more widely used so we deprecate PI. */
#ifndef PI
#define PI 3.1415926535897932384
#endif

#ifndef M_PI
#define M_PI 3.1415926535897932384
#endif

/* various utility macros */

#ifndef MAX
#define MAX(a,b)    (((a) > (b)) ? (a) : (b))
#endif

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

#ifndef ROUND
#define ROUND(a)    (PLINT)((a)<0. ? ((a)-.5) : ((a)+.5))
#endif

#endif	/* __PLCDEMOS_H__ */

/* $Id$

	Everything needed by the C demo programs.
	Created to avoid junking up plplot.h with this stuff.
*/

#ifndef __PLCDEMOS_H__
#define __PLCDEMOS_H__

#include <math.h>
#include <string.h>
#include <ctype.h>

#include "plConfig.h"
#include "plplot.h"

/* define PI if not defined by math.h */

/* Actually M_PI seems to be more widely used so we deprecate PI. */
#ifndef PI
#define PI 3.1415926535897932384
#endif

#ifndef M_PI
#define M_PI 3.1415926535897932384
#endif

/* various utility macros */

#ifndef MAX
#define MAX(a,b)    (((a) > (b)) ? (a) : (b))
#endif

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

#ifndef ROUND
#define ROUND(a)    (PLINT)((a)<0. ? ((a)-.5) : ((a)+.5))
#endif

#endif	/* __PLCDEMOS_H__ */

Move system header files to top in order to get rid of redefine warnings for Visual C++.

svn path=/trunk/; revision=9609


/******************************************************************************
**
** Copyright (C) 2009-2011 Kyle Lutz <kyle.r.lutz@gmail.com>
**
** This file is part of chemkit. For more information see
** <http://www.chemkit.org>.
**
** chemkit 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 3 of the License, or
** (at your option) any later version.
**
** chemkit 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 chemkit. If not, see <http://www.gnu.org/licenses/>.
**
******************************************************************************/

#ifndef CHEMKIT_POINT3_H
#define CHEMKIT_POINT3_H

#include "chemkit.h"

#include "genericpoint.h"

namespace chemkit {

/// A three-dimensional point.
typedef GenericPoint<Float> Point3;

} // end chemkit namespace

#endif // CHEMKIT_POINT3_H

/******************************************************************************
**
** Copyright (C) 2009-2011 Kyle Lutz <kyle.r.lutz@gmail.com>
**
** This file is part of chemkit. For more information see
** <http://www.chemkit.org>.
**
** chemkit 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 3 of the License, or
** (at your option) any later version.
**
** chemkit 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 chemkit. If not, see <http://www.gnu.org/licenses/>.
**
******************************************************************************/

#ifndef CHEMKIT_POINT3_H
#define CHEMKIT_POINT3_H

#include "chemkit.h"

#include "genericpoint.h"

namespace chemkit {

/// A three-dimensional point.
typedef GenericPoint<Float> Point3;

typedef GenericPoint<float> Point3f;
typedef GenericPoint<double> Point3d;

} // end chemkit namespace

#endif // CHEMKIT_POINT3_H

Add typedefs for Point3f and Point3d

Add typedefs for Point3f and Point3d

This adds two typedefs for Point3f and Point3d.


// RUN: clang-cc -triple i386-unknown-unknown --emit-llvm-bc -o - %s | opt --std-compile-opts | llvm-dis > %t
// RUN: grep "ret i32" %t | count 1
// RUN: grep "ret i32 1" %t | count 1
// PR2001

/* Test that the result of the assignment properly uses the value *in
   the bitfield* as opposed to the RHS. */
static int foo(int i) {
  struct {
    int f0 : 2;
  } x;
  return (x.f0 = i);
}

int bar() {
  return foo(-5) == -1;
}

// RUN: clang-cc -triple i386-unknown-unknown -O3 -emit-llvm -o - %s | FileCheck %s
// PR2001

/* Test that the result of the assignment properly uses the value *in
   the bitfield* as opposed to the RHS. */
static int foo(int i) {
  struct {
    int f0 : 2;
  } x;
  return (x.f0 = i);
}

int bar() {
  // CHECK: ret i32 1
  return foo(-5) == -1;
}

Update a test to FileCheck.

Update a test to FileCheck.

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


/*
* Open Chinese Convert
*
* Copyright 2010 BYVoid <byvoid1@gmail.com>
*
* 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 __OPENCC_CONVERT_H_
#define __OPENCC_CONVERT_H_

#include "opencc_utils.h"

#define SEGMENT_BUFF_SIZE 1048576

wchar_t * words_segmention(wchar_t * dest, const wchar_t * text);
wchar_t * simp_to_trad(wchar_t * dest, const wchar_t * text);

#endif /* __OPENCC_CONVERT_H_ */

/*
* Open Chinese Convert
*
* Copyright 2010 BYVoid <byvoid1@gmail.com>
*
* 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 __OPENCC_CONVERT_H_
#define __OPENCC_CONVERT_H_

#include "opencc_utils.h"

#define SEGMENT_BUFF_SIZE 1048576

#ifdef __cplusplus
extern "C" {
#endif

wchar_t * words_segmention(wchar_t * dest, const wchar_t * text);
wchar_t * simp_to_trad(wchar_t * dest, const wchar_t * text);

#ifdef __cplusplus
};
#endif

#endif /* __OPENCC_CONVERT_H_ */

Check cplusplus in header files.

Check cplusplus in header files.


/*
 * Copyright (C) 2016 Alexander Saprykin <xelfium@gmail.com>
 *
 * 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.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, see <http://www.gnu.org/licenses/>.
 */

#include "perror-private.h"
#include "psysclose-private.h"

#include <unistd.h>
#include <errno.h>

pint
p_sys_close (pint fd)
{
#ifdef EINTR
	pint res, err_code;

	for (;;) {
		res = close (fd);

		if (P_LIKELY (res == 0))
			return 0;

		err_code = p_error_get_last_error ();

		if (err_code == EINTR)
			continue;
		else
			return -1;
	}
#else
	return close (fd);
#endif
}

/*
 * Copyright (C) 2016 Alexander Saprykin <xelfium@gmail.com>
 *
 * 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.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, see <http://www.gnu.org/licenses/>.
 */

#include "perror-private.h"
#include "psysclose-private.h"

#include <unistd.h>
#include <errno.h>

pint
p_sys_close (pint fd)
{
#if defined (EINTR) && defined (P_OS_HPUX)
	pint res, err_code;

	for (;;) {
		res = close (fd);

		if (P_LIKELY (res == 0))
			return 0;

		err_code = p_error_get_last_error ();

		if (err_code == EINTR)
			continue;
		else
			return -1;
	}
#else
	return close (fd);
#endif
}

Handle EINTR when doing close() only on HP-UX


// RUN: %clang_cc1 -verify -fsyntax-only -Wno-private-extern %s

extern int l0 __attribute__((used)); // expected-warning {{used attribute ignored}}
__private_extern__ int l1 __attribute__((used)); // expected-warning {{used attribute ignored}}

struct __attribute__((used)) s { // expected-warning {{'used' attribute only applies to variables and functions}}
  int x;
};

int a __attribute__((used));

static void __attribute__((used)) f0(void) {
}

void f1() {
  static int a __attribute__((used));
  int b __attribute__((used)); // expected-warning {{used attribute ignored}}
}

static void __attribute__((used)) f0(void);

Check that we don't warn on this testcase. This is basically a test that
Decl::isUsed checks the attribute. If the function had a body just the check
is DeclMustBeEmitted would be sufficient.

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


#ifndef __HIREDIS_FMACRO_H
#define __HIREDIS_FMACRO_H

#if defined(__linux__)
#define _BSD_SOURCE
#define _DEFAULT_SOURCE
#endif

#if defined(__sun__)
#define _POSIX_C_SOURCE 200112L
#elif defined(__linux__) || defined(__OpenBSD__) || defined(__NetBSD__)
#define _XOPEN_SOURCE 600
#else
#define _XOPEN_SOURCE
#endif

#if __APPLE__ && __MACH__
#define _OSX
#endif

#endif

#ifndef __HIREDIS_FMACRO_H
#define __HIREDIS_FMACRO_H

#if defined(__linux__)
#define _BSD_SOURCE
#define _DEFAULT_SOURCE
#endif

#if defined(__sun__)
#define _POSIX_C_SOURCE 200112L
#else
#define _XOPEN_SOURCE 600
#endif

#if __APPLE__ && __MACH__
#define _OSX
#endif

#endif

Fix strerror_r on some esoteric platforms

Defining _XOPEN_SOURCE=1 causes strange behavior on Debian kfreebsd
archs (i.e. GNU userspace with FreeBSD kernel) when _GNU_SOURCE is not
defined.

Not sure I fully understand the bizarre semantics, but it seems to
use the XSI-compliant interface
(int strerror_r(int, char*, size_t)) but the GNU implementation
(char *strerror_r(int, char*, size_t)) such that strerror_r returns
32-bits of a 64-bit char * on x86_64 kfreebsd. We would expect
strerror_r to return zero when using the XSI-compliant strerror_r
implementation or a 64-bit char* when using the GNU version. Instead,
we get something in between!

Unless I'm missing something, being more explicit about what version
of _XOPEN_SOURCE we want seems to be the prudent thing to do here --
and if folks want the GNU implementation of strerror_r for some reason
they can always -D_GNU_SOURCE explicitly.


#ifndef UNITTEST_REQUIRED_CHECK_TEST_REPORTER_H
#define UNITTEST_REQUIRED_CHECK_TEST_REPORTER_H

#include "HelperMacros.h"
#include "ThrowingTestReporter.h"

namespace UnitTest {

   class TestResults;

   // This RAII class decorates the current TestReporter with
   // a version that throws after reporting a failure.
   class UNITTEST_LINKAGE RequiredCheckTestReporter
   {
   public:
      explicit RequiredCheckTestReporter(TestResults& results);
      ~RequiredCheckTestReporter();

      bool Next();

   private:
      TestResults& m_results;
      TestReporter* m_originalTestReporter;
      ThrowingTestReporter m_throwingReporter;
      int m_continue;
   };
}

#endif

#ifndef UNITTEST_REQUIRED_CHECK_TEST_REPORTER_H
#define UNITTEST_REQUIRED_CHECK_TEST_REPORTER_H

#include "HelperMacros.h"
#include "ThrowingTestReporter.h"

namespace UnitTest {

   class TestResults;

   // This RAII class decorates the current TestReporter with
   // a version that throws after reporting a failure.
   class UNITTEST_LINKAGE RequiredCheckTestReporter
   {
   public:
      explicit RequiredCheckTestReporter(TestResults& results);
      ~RequiredCheckTestReporter();

      bool Next();

   private:
      RequiredCheckTestReporter(RequiredCheckTestReporter const&);
      RequiredCheckTestReporter& operator =(RequiredCheckTestReporter const&);

      TestResults& m_results;
      TestReporter* m_originalTestReporter;
      ThrowingTestReporter m_throwingReporter;
      int m_continue;
   };
}

#endif

Fix "assignment operator could not be generated" warning

This shows up with /W4 on MSVC. Fixes #107.


#include<stdio.h>

void create(int []);
void down_adjust(int [],int);

void main()
{
	int heap[30],n,i,last,temp;
	printf("Enter no. of elements:");
	scanf("%d",&n);
	printf("\nEnter elements:");
	for(i=1;i<=n;i++)
		scanf("%d",&heap[i]);

	//create a heap
	heap[0]=n;
	create(heap);

	//sorting
	while(heap[0] > 1)
	{
		//swap heap[1] and heap[last]
		last=heap[0];
		temp=heap[1];
		heap[1]=heap[last];
		heap[last]=temp;
		heap[0]--;
		down_adjust(heap,1);
	}

	//print sorted data
	printf("\nArray after sorting:\n");
	for(i=1;i<=n;i++)
		printf("%d ",heap[i]);
}

void create(int heap[])
{
	int i,n;
	n=heap[0]; //no. of elements
	for(i=n/2;i>=1;i--)
		down_adjust(heap,i);
}

void down_adjust(int heap[],int i)
{
	int j,temp,n,flag=1;
	n=heap[0];

	while(2*i<=n && flag==1)
	{
		j=2*i;	//j points to left child
		if(j+1<=n && heap[j+1] > heap[j])
			j=j+1;
		if(heap[i] > heap[j])
			flag=0;
		else
		{
			temp=heap[i];
			heap[i]=heap[j];
			heap[j]=temp;
			i=j;
		}
	}
}

Add heap sort in C

Add heap sort in C


/**
 * @file
 * @brief tests proper stack usage (particularly, right handling
 * of window overflow/underflow on SPARC).
 *
 * @date 14.08.09
 * @author Eldar Abusalimov
 */

#include <embox/test.h>
#include <test/misc.h>

#define RECURSION_DEPTH 32

EMBOX_TEST(run);

static int run(void) {
	return test_misc_recursion(RECURSION_DEPTH);
}

/**
 * @file
 * @brief Tests proper stack usage.
 *
 * @date 14.08.09
 * @author Eldar Abusalimov
 */

#include <embox/test.h>
#include <test/misc.h>

EMBOX_TEST_SUITE("Stack usage tests");

static int fib(int k) {
	if (k < 2) {
		return k;
	} else {
		return fib(k - 1) + fib(k - 2);
	}
}

TEST_CASE("Recursively calculating Fibonacci number") {
	test_assert_equal(fib(0), 0);
	test_assert_equal(fib(1), 1);
	test_assert_equal(fib(2), 1);
	test_assert_equal(fib(3), 2);
	test_assert_equal(fib(4), 3);
	test_assert_equal(fib(5), 5);

	/* This is madness. This is SPARC!!! */
	test_assert_equal(fib(17), 1597);
}

Rewrite recursion test to calculate Fibonacci


#pragma once

#define BAUDRATE 115200

#define USE_Servo                                   1
#define USE_Tone                                    0
#define USE_LiquidCrystal                           1
#define USE_Stepper                                 1
#define USE_EEPROM                                  1
#define USE_Define                                  1
#define USE_ArduinoCore                             1
#define USE_Watchdog                                1
#define USE_Register                                1
#define USE_Info                                    1

// conflicts Tone
#define USE_Counter                                 1

// external libraries should be installed for the following features:
#define USE_OneWire                                 1
#define USE_DallasTemperature                       0
#define USE_CapacitiveSensor                        1
#define USE_DHT                                     1

#if USE_Tone
# if USE_Counter
#  error "USE_Tone conflicts with USE_Counter!"
# endif
#endif

#pragma once

#define BAUDRATE 115200

#define USE_Servo                                   1
#define USE_Tone                                    0
#define USE_LiquidCrystal                           1
#define USE_Stepper                                 1
#define USE_EEPROM                                  1
#define USE_Define                                  1
#define USE_ArduinoCore                             1
#define USE_Watchdog                                1
#define USE_Register                                1
#define USE_Info                                    1

// conflicts Tone
#define USE_Counter                                 1

// external libraries should be installed for the following features:
#define USE_OneWire                                 0
#define USE_DallasTemperature                       0
#define USE_CapacitiveSensor                        0
#define USE_DHT                                     0

#if USE_Tone
# if USE_Counter
#  error "USE_Tone conflicts with USE_Counter!"
# endif
#endif

Disable features requiring external libs


/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
/*
 * gnome-window.h: wrappers for setting window properties
 *
 * Author:  Chema Celorio <chema@celorio.com>
 */

/*
 * These functions are a convenience wrapper for gtk_window_set_title
 * This allows all the gnome-apps to have a consitent way of setting
 * the window & dialogs titles. We could also add a configurable way
 * of setting the windows titles in the future..
 *
 * These functions were added with the 1.2.5 release of the GNOME libraries
 * in Oct, 2000.  This means that not all users will have this functionality
 * in the GNOME libraries, and should only be used accordingly.  The header file
 * must be explicitely included, also (#include <libgnomeui/gnome-window.h>).
 */

#ifndef GNOME_WINDOW_H
#define GNOME_WINDOW_H

#include <gtk/gtkwindow.h>

G_BEGIN_DECLS

/* set the window title */
void gnome_window_toplevel_set_title (GtkWindow *w,
				      const gchar *doc_name,
				      const gchar *app_name,
				      const gchar *extension);

G_END_DECLS

#endif /* GNOME_WINDOW_H */

/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
/*
 * gnome-window.h: wrappers for setting window properties
 *
 * Author:  Chema Celorio <chema@celorio.com>
 */

/*
 * These functions are a convenience wrapper for gtk_window_set_title
 * This allows all the gnome-apps to have a consitent way of setting
 * the window & dialogs titles. We could also add a configurable way
 * of setting the windows titles in the future..
 *
 * These functions were added with the 1.2.5 release of the GNOME libraries
 * in Oct, 2000.  This means that not all users will have this functionality
 * in the GNOME libraries, and should only be used accordingly.  The header file
 * must be explicitely included, also (#include <libgnomeui/gnome-window.h>).
 */

#ifndef GNOME_WINDOW_H
#define GNOME_WINDOW_H

#include <gtk/gtkwindow.h>

G_BEGIN_DECLS

/* set the window title */
void gnome_window_toplevel_set_title (GtkWindow *w,
				      const gchar *doc_name,
				      const gchar *app_name,
				      const gchar *extension);

void gnome_window_set_icon (GtkWindow *window,
			    GdkPixbuf *pixbuf,
			    gboolean overwrite);

void gnome_window_set_icon_from_file (GtkWindow *window,
				      const char *filename,
				      gboolean overwrite);

G_END_DECLS

#endif /* GNOME_WINDOW_H */

Use GtkDialog, not GnomeDialog. (GnomeAbout, GnomeAbout): Derive from

2001-04-25  Martin Baulig  <baulig@suse.de>

	* gnome-about.[ch]: Use GtkDialog, not GnomeDialog.
	(GnomeAbout, GnomeAbout): Derive from GtkDialog, not GnomeDialog.

	* gnome-client.[ch]: Likewise.
	(gnome_client_save_any_dialog, gnome_client_save_error_dialog): Take
	a GtkDialog as argument, not a GnomeDialog.

	* gnome-helpsys.c, gnome-href.c, gnome-icon-entry.c, gnome_segv.c: Use
	GtkDialog, not GnomeDialog.

	* gnome-window.c (gnome_window_set_icon, gnome_window_set_icon_from_file):
	Moved here from gnome-app-util.c.


/*
 * LZO 1x decompression
 * copyright (c) 2006 Reimar Doeffinger
 *
 * This file is part of FFmpeg.
 *
 * FFmpeg 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.
 *
 * FFmpeg 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 FFmpeg; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
 */

#ifndef _LZO_H
#define LZO_H

#define LZO_INPUT_DEPLETED 1
#define LZO_OUTPUT_FULL 2
#define LZO_INVALID_BACKPTR 4
#define LZO_ERROR 8

#define LZO_INPUT_PADDING 4
#define LZO_OUTPUT_PADDING 12

int lzo1x_decode(void *out, int *outlen, void *in, int *inlen);

#endif

/*
 * LZO 1x decompression
 * copyright (c) 2006 Reimar Doeffinger
 *
 * This file is part of FFmpeg.
 *
 * FFmpeg 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.
 *
 * FFmpeg 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 FFmpeg; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
 */

#ifndef LZO_H
#define LZO_H

#define LZO_INPUT_DEPLETED 1
#define LZO_OUTPUT_FULL 2
#define LZO_INVALID_BACKPTR 4
#define LZO_ERROR 8

#define LZO_INPUT_PADDING 4
#define LZO_OUTPUT_PADDING 12

int lzo1x_decode(void *out, int *outlen, void *in, int *inlen);

#endif

Fix _LZO_H vs. LZO_H typo

Fix _LZO_H vs. LZO_H typo

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


/**************************************************************************
 *
 * Copyright 2016 Jose Fonseca
 * All Rights Reserved.
 *
 * Permission is hereby granted, free of charge, to any person obtaining a
 * copy of this software and associated documentation files (the
 * "Software"), to deal in the Software without restriction, including
 * without limitation the rights to use, copy, modify, merge, publish,
 * distribute, sub license, and/or sell copies of the Software, and to
 * permit persons to whom the Software is furnished to do so, subject to
 * the following conditions:
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. NO EVENT SHALL
 * THE COPYRIGHT HOLDERS, AUTHORS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM,
 * DAMAGES OR OTHER LIABILITY, WHETHER AN ACTION OF CONTRACT, TORT OR
 * OTHERWISE, ARISING FROM, OF OR CONNECTION WITH THE SOFTWARE OR THE
 * USE OR OTHER DEALINGS THE SOFTWARE.
 *
 * The above copyright notice and this permission notice (including the
 * next paragraph) shall be included in all copies or substantial portions
 * of the Software.
 *
 **************************************************************************/

#pragma once

#include <windows.h>

// http://wiki.winehq.org/DeveloperFaq#detect-wine
static inline BOOL
insideWine(void)
{
    HMODULE hNtDll = GetModuleHandleA("ntdll");
    if (!hNtDll) {
        return FALSE;
    }
    return GetProcAddress(hNtDll, "wine_get_version") != NULL;
}

/**************************************************************************
 *
 * Copyright 2016 Jose Fonseca
 * All Rights Reserved.
 *
 * Permission is hereby granted, free of charge, to any person obtaining a
 * copy of this software and associated documentation files (the
 * "Software"), to deal in the Software without restriction, including
 * without limitation the rights to use, copy, modify, merge, publish,
 * distribute, sub license, and/or sell copies of the Software, and to
 * permit persons to whom the Software is furnished to do so, subject to
 * the following conditions:
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. NO EVENT SHALL
 * THE COPYRIGHT HOLDERS, AUTHORS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM,
 * DAMAGES OR OTHER LIABILITY, WHETHER AN ACTION OF CONTRACT, TORT OR
 * OTHERWISE, ARISING FROM, OF OR CONNECTION WITH THE SOFTWARE OR THE
 * USE OR OTHER DEALINGS THE SOFTWARE.
 *
 * The above copyright notice and this permission notice (including the
 * next paragraph) shall be included in all copies or substantial portions
 * of the Software.
 *
 **************************************************************************/

#pragma once

#include <windows.h>

// http://wiki.winehq.org/DeveloperFaq#detect-wine
static __inline BOOL
insideWine(void)
{
    HMODULE hNtDll = GetModuleHandleA("ntdll");
    if (!hNtDll) {
        return FALSE;
    }
    return GetProcAddress(hNtDll, "wine_get_version") != NULL;
}

Use __inline to fix MSVC build.

tests/apps: Use __inline to fix MSVC build.


#ifndef PRIMITIV_MODEL_H_
#define PRIMITIV_MODEL_H_

#include <string>
#include <vector>
#include <unordered_map>
#include <unordered_set>

namespace primitiv {

class Parameter;

/**
 * Set of parameters and specific algorithms.
 */
class Model {
  Model(const Model &) = delete;
  Model &operator=(const Model &) = delete;

public:
  Model() = default;
  Model(Model &&) = default;
  Model &operator=(Model &&) = default;
  virtual ~Model() = default;

  /**
   * Registers a new parameter.
   * @param name Name of the parameter.
   * @param param Reference to the parameter.
   */
  void add_parameter(const std::string &name, Parameter &param);

  /**
   * Retrieves all parameters in the model which are trainable.
   * @return List of pointers of trainable parameters.
   */
  std::vector<Parameter *>get_trainable_parameters() const;

private:
  std::unordered_map<std::string, Parameter *> param_kv_;
  std::unordered_set<Parameter *> param_set_;  // Shortcut to find parameters.
};

}  // namespace primitiv

#endif  // PRIMITIV_MODEL_H_

#ifndef PRIMITIV_MODEL_H_
#define PRIMITIV_MODEL_H_

#include <string>
#include <vector>
#include <unordered_map>
#include <unordered_set>

#include <primitiv/mixins.h>

namespace primitiv {

class Parameter;

/**
 * Set of parameters and specific algorithms.
 */
class Model : mixins::Nonmovable<Model> {
public:
  Model() = default;
  virtual ~Model() = default;

  /**
   * Registers a new parameter.
   * @param name Name of the parameter.
   * @param param Reference to the parameter.
   */
  void add_parameter(const std::string &name, Parameter &param);

  /**
   * Retrieves all parameters in the model which are trainable.
   * @return List of pointers of trainable parameters.
   */
  std::vector<Parameter *>get_trainable_parameters() const;

private:
  std::unordered_map<std::string, Parameter *> param_kv_;
  std::unordered_set<Parameter *> param_set_;  // Shortcut to find parameters.
};

}  // namespace primitiv

#endif  // PRIMITIV_MODEL_H_

Add Nonmovable inheritance to Model.

Add Nonmovable inheritance to Model.


#ifndef SSPAPPLICATION_ENTITIES_LEVERENTITY_H
#define SSPAPPLICATION_ENTITIES_LEVERENTITY_H
#include "Entity.h"

struct LeverSyncState {

};

class LeverEntity :
	public Entity
{
private:
	//Variables
	bool m_isActive;
	float m_range;
public:
	LeverEntity();
	virtual ~LeverEntity();

	int Initialize(int entityID, PhysicsComponent* pComp, GraphicsComponent* gComp);

	int Update(float dT, InputHandler* inputHandler);
	int React(int entityID, EVENT reactEvent);

	//For now we check only if the player is close enough
	int CheckPressed(DirectX::XMFLOAT3 playerPos);

private:
	//Functions
};

#endif

#ifndef SSPAPPLICATION_ENTITIES_LEVERENTITY_H
#define SSPAPPLICATION_ENTITIES_LEVERENTITY_H
#include "Entity.h"

struct LeverSyncState {
	int entityID;
	bool iActive;
};

class LeverEntity :
	public Entity
{
private:
	//Variables
	bool m_isActive;
	float m_range;

	bool m_needSync;
public:
	LeverEntity();
	virtual ~LeverEntity();

	int Initialize(int entityID, PhysicsComponent* pComp, GraphicsComponent* gComp);

	int Update(float dT, InputHandler* inputHandler);
	int React(int entityID, EVENT reactEvent);

	//For now we check only if the player is close enough
	int CheckPressed(DirectX::XMFLOAT3 playerPos);

private:
	//Functions
};

#endif

UPDATE Lever entity sync state

UPDATE Lever entity sync state


/** @file
  Defines for the EFI Capsule functionality.

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

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

  Module Name:  Capsule.h

  @par Revision Reference:
  These definitions are from Uefi Spec.

**/

#ifndef _EFI_CAPSULE_H_
#define _EFI_CAPSULE_H_

typedef struct {
  EFI_GUID          CapsuleGuid;
  UINT32            HeaderSize;
  UINT32            Flags;
  UINT32            CapsuleImageSize;
} EFI_CAPSULE_HEADER;

#define CAPSULE_FLAGS_PERSIST_ACROSS_RESET          0x00010000
#define CAPSULE_FLAGS_POPULATE_SYSTEM_TABLE         0x00020000

#endif // #ifndef _EFI_CAPSULE_H_

Add Uefi Capsule Definition header file.

git-svn-id: f3880c1fc5096ce2109c8aec392d8e07f619f417@357 c2973edb-eda0-4c78-bc6a-9341b269661f


#ifndef APIMOCK_IOC_H
#define	APIMOCK_IOC_H

#include <unordered_map>
#include <string>

namespace ApiMock {
	class ServiceRegistry {
		static std::unordered_map<std::string, void*> container;

	public:
		template<typename T>
		static void Register(T* object) {
			container[typeid(T).name()] = reinterpret_cast<void*>(object);
		}

		template<typename T>
		static T* Resolve() {
			return static_cast<T*>(container[typeid(T).name()]);
		}
	};

	std::unordered_map<std::string, void*> ServiceRegistry::container;
};

#endif

#ifndef APIMOCK_IOC_H
#define	APIMOCK_IOC_H

#include <unordered_map>
#include <typeinfo>
#include <string>

namespace ApiMock {
	class ServiceRegistry {
		static std::unordered_map<std::string, void*> container;

	public:
		template<typename T>
		static void Register(T* object) {
			container[typeid(T).name()] = reinterpret_cast<void*>(object);
		}

		template<typename T>
		static T* Resolve() {
			return static_cast<T*>(container[typeid(T).name()]);
		}
	};

	std::unordered_map<std::string, void*> ServiceRegistry::container;
};

#endif

Include typeinfo header for RTTI

Include typeinfo header for RTTI


// RUN: clang-cc -analyze -checker-cfref -analyzer-store=region -verify %s

struct s {
  int data;
};

struct s global;

void g(int);

void f4() {
  int a;
  if (global.data == 0)
    a = 3;
  if (global.data == 0) // When the true branch is feasible 'a = 3'.
    g(a); // no-warning
}

// Test uninitialized value due to part of the structure being uninitialized.
struct TestUninit { int x; int y; };
struct TestUninit test_uninit_aux();
void test_uninit_pos() {
  struct TestUninit v1 = { 0, 0 };
  struct TestUninit v2 = test_uninit_aux();
  int z;
  v1.y = z;
  test_unit_aux2(v2.x + v1.y);  // expected-warning{{Pass-by-value argument in function call is undefined}}
}
void test_uninit_neg() {
  struct TestUninit v1 = { 0, 0 };
  struct TestUninit v2 = test_uninit_aux();
  test_unit_aux2(v2.x + v1.y); // no-warning
}

Add uninitialized values test case.

Add uninitialized values test case.

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


#ifndef MONSOON_METRIC_VALUE_INL_H
#define MONSOON_METRIC_VALUE_INL_H

#include <utility>

namespace monsoon {

inline metric_value::metric_value(metric_value&& other) noexcept
: value_(std::move(other.value_))
{}

inline auto metric_value::operator=(metric_value&& other) noexcept
->  metric_value& {
  value_ = std::move(other.value_);
  return *this;
}

inline metric_value::metric_value(bool v) noexcept
: value_(types::create<0>(v))
{}

inline metric_value::metric_value(long v) noexcept
: value_(types::create<1>(v))
{}

inline metric_value::metric_value(unsigned long v) noexcept
: value_(types::create<2>(v))
{}

inline metric_value::metric_value(double v) noexcept
: value_(types::create<3>(v))
{}

inline metric_value::metric_value(std::string v) noexcept
: value_(types::create<4>(std::move(v)))
{}

inline auto metric_value::operator!=(const metric_value& other) const noexcept
->  bool {
  return !(*this == other);
}

inline auto metric_value::get() const noexcept -> const optional<types>& {
  return value_;
}

} /* namespace monsoon */

#endif /* MONSOON_METRIC_VALUE_INL_H */

#ifndef MONSOON_METRIC_VALUE_INL_H
#define MONSOON_METRIC_VALUE_INL_H

#include <utility>

namespace monsoon {

inline metric_value::metric_value(metric_value&& other) noexcept
: value_(std::move(other.value_))
{}

inline auto metric_value::operator=(metric_value&& other) noexcept
->  metric_value& {
  value_ = std::move(other.value_);
  return *this;
}

inline metric_value::metric_value(bool v) noexcept
: value_(types::create<0>(v))
{}

inline metric_value::metric_value(long v) noexcept
: value_(v >= 0 ? types::create<2>(v) : types::create<1>(v))
{}

inline metric_value::metric_value(unsigned long v) noexcept
: value_(types::create<2>(v))
{}

inline metric_value::metric_value(double v) noexcept
: value_(types::create<3>(v))
{}

inline metric_value::metric_value(std::string v) noexcept
: value_(types::create<4>(std::move(v)))
{}

inline auto metric_value::operator!=(const metric_value& other) const noexcept
->  bool {
  return !(*this == other);
}

inline auto metric_value::get() const noexcept -> const optional<types>& {
  return value_;
}

} /* namespace monsoon */

#endif /* MONSOON_METRIC_VALUE_INL_H */

Use an unsigned long for non-negative longs.


// Part of FoundationKit http://foundationk.it

#import <mach/mach_time.h>
#import "FKInternal.h"

/**
 If we are in Debug-Mode this functions benchmarks the given block and logs
 information about it's duration. Otherwise the block is just executed.

 @param title the name of the benchmark
 @param block the block to benchmark
 */
NS_INLINE void FKBenchmark(NSString *title, dispatch_block_t block) {
  if (block == nil) {
    return;
  }
  if (title == nil) {
    title = @"<untitled>";
  }

#ifdef FK_DEBUG
  ^{
    FKLogAlways(@"'%@' benchmark started...", title);

    const uint64_t start = mach_absolute_time();
    block();
    const uint64_t end = mach_absolute_time();
    const uint64_t elapsedMTU = end - start;

    // Get information for converting from MTU to nanoseconds
    mach_timebase_info_data_t info;
    mach_timebase_info(&info);

    // Get elapsed time in nanoseconds:
    const double elapsedNS = (double)elapsedMTU * (double)info.numer / (double)info.denom;
    FKLogAlways(@"'%@' benchmark finished: %fs (%fns)", title, elapsedNS / NSEC_PER_SEC, elapsedNS);
  }();
#else
  block();
#endif
}

// Part of FoundationKit http://foundationk.it

#import <mach/mach_time.h>
#import "FKInternal.h"

/**
 If we are in Debug-Mode this functions benchmarks the given block and logs
 information about it's duration. Otherwise the block is just executed.

 @param title the name of the benchmark
 @param block the block to benchmark
 */
NS_INLINE void FKBenchmark(NSString *title, dispatch_block_t block) {
  if (block == nil) {
    return;
  }

#ifdef FK_DEBUG
  ^{
    if (title == nil) {
      title = @"<untitled>";
    }

    FKLogAlways(@"'%@' benchmark started...", title);

    const uint64_t start = mach_absolute_time();
    block();
    const uint64_t end = mach_absolute_time();
    const uint64_t elapsedMTU = end - start;

    // Get information for converting from MTU to nanoseconds
    mach_timebase_info_data_t info;
    mach_timebase_info(&info);

    // Get elapsed time in nanoseconds:
    const double elapsedNS = (double)elapsedMTU * (double)info.numer / (double)info.denom;
    FKLogAlways(@"'%@' benchmark finished: %fs (%fns)", title, elapsedNS / NSEC_PER_SEC, elapsedNS);
  }();
#else
  block();
#endif
}

Fix analyzer warning that title is not read


/**
 * Phase 01 - Get a Window that works and can be closed.
 *
 * This code won't be structured very well, just trying to get stuff working.
 */
#include <stdlib.h>

int main(int argc, char *argv[])
{
  return EXIT_SUCCESS;
}

Add a little header explaining the purpose of phase-01


/*
 * tools.h
 *
 *  Created on: May 4, 2011
 *      Author: wozniak
 */

#ifndef TOOLS_H
#define TOOLS_H

/**
   Determine the length of an array of pointers
 */
int array_length(void** array);

#define append(string, args...) string += sprintf(string, ## args)

#endif /* TOOLS_H_ */

/*
 * tools.h
 *
 *  Created on: May 4, 2011
 *      Author: wozniak
 */

#ifndef TOOLS_H
#define TOOLS_H

/**
   Determine the length of an array of pointers
 */
int array_length(void** array);

#define append(string,  args...) string += sprintf(string, ## args)
#define vappend(string, args...) string += vsprintf(string, ## args)

#endif

Check in new macro vappend()- not actually used

git-svn-id: 4403cc1077de9de61ebbb06aa07b0a825c555f62@1737 dc4e9af1-7f46-4ead-bba6-71afc04862de


#ifndef ENGPAR_SIDES_H
#define ENGPAR_SIDES_H

#include <ngraph.h>
#include <PCU.h>
#include "engpar_container.h"
#include <engpar_metrics.h>
#include "engpar_diffusive_input.h"

namespace engpar {
  class Sides : public Container<int>  {
  public:
    Sides(agi::Ngraph* g, agi::etype t) {
      agi::Ngraph* graph = g;
      agi::GraphEdge* edge;
      agi::EdgeIterator* eitr = graph->begin(t);
      while ((edge = graph->iterate(eitr))) {
        agi::Peers res;
        g->getResidence(edge,res);
        if (res.size()>1) {
          agi::Peers::iterator itr;
          for (itr=res.begin();itr!=res.end();itr++) {
            if (*itr!=PCU_Comm_Self()) {
              increment2(*itr);
            }
          }
          my_total++;
        }
      }
      g->destroy(eitr);
    }
  };

  Sides* makeSides(DiffusiveInput* in);
  Sides* makeSides(agi::Ngraph* g, agi::etype t);

}

#endif

#ifndef ENGPAR_SIDES_H
#define ENGPAR_SIDES_H

#include <ngraph.h>
#include <PCU.h>
#include "engpar_container.h"
#include <engpar_metrics.h>
#include "engpar_diffusive_input.h"

namespace engpar {
  class Sides : public Container<int>  {
  public:
    Sides(agi::Ngraph* g, agi::etype t) {
      agi::Ngraph* graph = g;
      agi::GraphEdge* edge;
      agi::EdgeIterator* eitr = graph->begin(t);
      while ((edge = graph->iterate(eitr))) {
        agi::Peers res;
        g->getResidence(edge,res);
        if (res.size()>1) {
          agi::Peers::iterator itr;
          for (itr=res.begin();itr!=res.end();itr++) {
            if (*itr != PCU_Comm_Self()) {
              (*this)[*itr]+=g->weight(edge);
            }
          }
          my_total+= g->weight(edge);
        }
      }
      g->destroy(eitr);
    }
  };

  Sides* makeSides(DiffusiveInput* in);
  Sides* makeSides(agi::Ngraph* g, agi::etype t);

}

#endif

Add edge weights to side calculations

Add edge weights to side calculations


// ext/baz/baz_vector_ruby.h

#ifndef BAZ_VECTOR_RUBY_H
#define BAZ_VECTOR_RUBY_H

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

void init_baz_vector( VALUE parent_module );

#endif

// ext/baz/baz_vector_ruby.h

#ifndef BAZ_VECTOR_RUBY_H
#define BAZ_VECTOR_RUBY_H

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

// Ruby 1.8.7 compatibility patch
#ifndef DBL2NUM
#define DBL2NUM( dbl_val ) rb_float_new( dbl_val )
#endif

void init_baz_vector( VALUE parent_module );

#endif

Add definition of DBL2NUM for 1.8.7

Add definition of DBL2NUM for 1.8.7


// 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 CONTENT_BROWSER_RENDERER_HOST_QUOTA_DISPATCHER_HOST_H_
#define CONTENT_BROWSER_RENDERER_HOST_QUOTA_DISPATCHER_HOST_H_

#include "base/basictypes.h"
#include "content/browser/browser_message_filter.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/WebStorageQuotaType.h"

class GURL;

class QuotaDispatcherHost : public BrowserMessageFilter {
 public:
  ~QuotaDispatcherHost();
  bool OnMessageReceived(const IPC::Message& message, bool* message_was_ok);

 private:
  void OnQueryStorageUsageAndQuota(
      int request_id,
      const GURL& origin_url,
      WebKit::WebStorageQuotaType type);
  void OnRequestStorageQuota(
      int request_id,
      const GURL& origin_url,
      WebKit::WebStorageQuotaType type,
      int64 requested_size);
};

#endif  // CONTENT_BROWSER_RENDERER_HOST_QUOTA_DISPATCHER_HOST_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 CONTENT_BROWSER_RENDERER_HOST_QUOTA_DISPATCHER_HOST_H_
#define CONTENT_BROWSER_RENDERER_HOST_QUOTA_DISPATCHER_HOST_H_

#include "base/basictypes.h"
#include "content/browser/browser_message_filter.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/WebStorageQuotaType.h"

class GURL;

class QuotaDispatcherHost : public BrowserMessageFilter {
 public:
  ~QuotaDispatcherHost();
  virtual bool OnMessageReceived(const IPC::Message& message,
                                 bool* message_was_ok);

 private:
  void OnQueryStorageUsageAndQuota(
      int request_id,
      const GURL& origin_url,
      WebKit::WebStorageQuotaType type);
  void OnRequestStorageQuota(
      int request_id,
      const GURL& origin_url,
      WebKit::WebStorageQuotaType type,
      int64 requested_size);
};

#endif  // CONTENT_BROWSER_RENDERER_HOST_QUOTA_DISPATCHER_HOST_H_

Fix clang build that have been broken by 81364.

BUG=none
TEST=green tree
TBR=jam

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

git-svn-id: http://src.chromium.org/svn/trunk/src@81368 4ff67af0-8c30-449e-8e8b-ad334ec8d88c

Former-commit-id: 72f86cdd70ccbe468222911d421f064981d34746


#pragma once

#include <cstdio>

// HACK: No idea where this should actually be defined
#define nullptr 0x0
#pragma GCC diagnostic ignored "-Wattributes"
#include "openvr.h"
#pragma GCC diagnostic warning "-Wattributes"
using namespace vr;

#ifdef __x86_64__
// MS instead of SysV ABI for 64bit
#define WOVR_ENTRY __attribute__((ms_abi))
#else
// Thispointer-in-ECX for 32bit
#define WOVR_ENTRY __attribute__((thiscall))
#endif

#pragma once

#include <cstdio>

// HACK: No idea where this should actually be defined
#define nullptr 0x0
// If _WIN32 is defined, openvr.h will decorate the exported functions with __declspec(dllimport) which implies
// __attribute__((ms_abi)). This makes things explode, as we need to call them with SysV ABI.
#undef _WIN32
#include "openvr.h"
using namespace vr;

#ifdef __x86_64__
// MS instead of SysV ABI for 64bit
#define WOVR_ENTRY __attribute__((ms_abi))
#else
// Thispointer-in-ECX for 32bit
#define WOVR_ENTRY __attribute__((thiscall))
#endif

Fix implied ms_abi where it shouldn't be


// Copyright (c) 2012-2013, the scalloc Project Authors.  All rights reserved.
// Please see the AUTHORS file for details.  Use of this source code is governed
// by a BSD license that can be found in the LICENSE file.

#ifndef SCALLOC_COMMON_H_
#define SCALLOC_COMMON_H_

#include <stddef.h>  // size_t

#include "config.h"

#define UNLIKELY(x)   __builtin_expect((x), 0)
#define LIKELY(x)     __builtin_expect((x), 1)

#define cache_aligned __attribute__((aligned(64)))

#define always_inline inline __attribute__((always_inline))
#define no_inline __attribute__((noinline))

const size_t kSystemPageSize = PAGE_SIZE;

// Prohibit reordering of instructions by the compiler.
inline void CompilerBarrier() {
  __asm__ __volatile__("" : : : "memory");
}

// Full memory fence on x86-64
inline void MemoryBarrier() {
  __asm__ __volatile__("mfence" : : : "memory");
}

always_inline size_t PadSize(size_t size, size_t multiple) {
  return (size + multiple - 1) / multiple * multiple;
}

#endif  // SCALLOC_COMMON_H_

// Copyright (c) 2012-2013, the scalloc Project Authors.  All rights reserved.
// Please see the AUTHORS file for details.  Use of this source code is governed
// by a BSD license that can be found in the LICENSE file.

#ifndef SCALLOC_COMMON_H_
#define SCALLOC_COMMON_H_

#include <stddef.h>  // size_t

#include "config.h"

#define UNLIKELY(x)   __builtin_expect((x), 0)
#define LIKELY(x)     __builtin_expect((x), 1)

#define cache_aligned __attribute__((aligned(64)))

#define always_inline inline __attribute__((always_inline))
#define no_inline __attribute__((noinline))

const size_t kSystemPageSize = PAGE_SIZE;

const size_t kMinAlignment = 16;

const size_t kMaxSmallSize = 512;

const size_t kNumClasses = kMaxSmallSize / kMinAlignment;

// Prohibit reordering of instructions by the compiler.
inline void CompilerBarrier() {
  __asm__ __volatile__("" : : : "memory");
}

// Full memory fence on x86-64
inline void MemoryBarrier() {
  __asm__ __volatile__("mfence" : : : "memory");
}

always_inline size_t PadSize(size_t size, size_t multiple) {
  return (size + multiple - 1) / multiple * multiple;
}

#endif  // SCALLOC_COMMON_H_

Add some allocator constants like minimum alignment or maximum small size.

Signed-off-by: Michael Lippautz <0d543840881a2c189b4f7636b15eebd6a8f60ace@gmail.com>


#include <cmath>

class ShinyeiPPD42NS {
  public:
    ShinyeiPPD42NS(unsigned long sampling_interval_ms) {
	  _sampling_interval_ms = sampling_interval_ms;
	  _is_sampling_complete = false;
	}
    void startSampling(unsigned long stms);
    float getConcentration(unsigned long duration, unsigned long current_time_ms);
    bool isSamplingComplete();
  private:
    ShinyeiPPD42NS() { }
    unsigned long _start_time_ms;
    unsigned long _low_pulse_occupancy;
    unsigned long _sampling_interval_ms;
    float _concentration;
    bool _is_sampling_complete;
};

#include <cmath>

class ShinyeiPPD42NS {
  public:
    ShinyeiPPD42NS(float sampling_interval_ms) {
	  _sampling_interval_ms = sampling_interval_ms;
	  _is_sampling_complete = false;
	}
    void startSampling(unsigned long stms);
    float getConcentration(unsigned long duration, unsigned long current_time_ms);
    bool isSamplingComplete();
  private:
    ShinyeiPPD42NS() { }
    unsigned long _start_time_ms;
    unsigned long _low_pulse_occupancy;
    float _sampling_interval_ms;
    float _concentration;
    bool _is_sampling_complete;
};

Improve precision for dust particle counts


//
//  AshtonObjcMixedContentPreprocessor.h
//  Ashton
//
//  Created by Michael Schwarz on 15.01.18.
//  Copyright © 2018 Michael Schwarz. All rights reserved.
//

#import <Foundation/Foundation.h>

NS_ASSUME_NONNULL_BEGIN

@interface AshtonObjcMixedContentPreprocessor: NSObject

- (NSString *)preprocessHTMLString:(NSString *)htmlString;

@end

NS_ASSUME_NONNULL_END

//
//  AshtonObjcMixedContentPreprocessor.h
//  Ashton
//
//  Created by Michael Schwarz on 15.01.18.
//  Copyright © 2018 Michael Schwarz. All rights reserved.
//

#import <Foundation/Foundation.h>

NS_ASSUME_NONNULL_BEGIN

/// TBXML parser cannot handle html mixed content, therefore we have to preprocess it
/// mixedContent = "test sample", will be processed to
/// "<wrapped>test </wrapped><wrapped>sample</wrapped>
@interface AshtonObjcMixedContentPreprocessor: NSObject

- (NSString *)preprocessHTMLString:(NSString *)htmlString;

@end

NS_ASSUME_NONNULL_END

Add comment regarding mixed content preprocessor


/*!
 * This file defines an interface to fold preprocessor strings into one token.
 *
 * @author Louis Dionne
 */

#ifndef JOY_INTERNAL_STRCAT_H
#define JOY_INTERNAL_STRCAT_H

#include <chaos/preprocessor/recursion/expr.h>
#include <chaos/preprocessor/algorithm/fold_right.h>
#include <chaos/preprocessor/string/core.h>

#define JOY_STRING_CAT(string) \
    JOY_STRING_CAT_S(CHAOS_PP_STATE(), string)

#define JOY_STRING_CAT_S(state, string)                                        \
    CHAOS_PP_EXPR_S(state) (                                                   \
        CHAOS_PP_FOLD_RIGHT_S(state,                                           \
            JOY_I_STRING_CAT_TWO,                                              \
            (CHAOS_PP_STRING) string,                                          \
            /* no initial state of accumulation */                             \
        )                                                                      \
    )                                                                          \
/**/

#define JOY_I_STRING_CAT_TWO(state, head, tail) \
    CHAOS_PP_CAT(head, tail)

#endif /* !JOY_INTERNAL_STRCAT_H */

Add a facility to concatenate preprocessor strings.


// RUN: %clang -fsyntax-only %s
// RUN: %clang -fsyntax-only -fno-lax-vector-conversions %s
// RUN: %clang -fsyntax-only -x c++ %s

#if defined(i386) || defined(__x86_64__)

#  if defined(__MMX__)
#include <emmintrin.h>
#include <mm_malloc.h>
#  endif

#  if defined(__SSE__)
#include <xmmintrin.h>
#  endif

#  if defined(__SSE3__)
#include <pmmintrin.h>
#  endif

#  if defined(__SSSE3__)
#include <tmmintrin.h>
#  endif

#endif

// RUN: %clang -fsyntax-only %s
// RUN: %clang -fsyntax-only -fno-lax-vector-conversions %s
// RUN: %clang -fsyntax-only -x c++ %s

#if defined(i386) || defined(__x86_64__)

#  if defined(__MMX__)
#include <emmintrin.h>
#include <mm_malloc.h>
#  endif

#  if defined(__SSE__)
#include <xmmintrin.h>
#  endif

#  if defined(__SSE3__)
#include <pmmintrin.h>
#  endif

#  if defined(__SSSE3__)
#include <tmmintrin.h>
#  endif

#  if defined(__SSE4_1__)
#include <smmintrin.h>
#  endif

#endif

Add include for smmintrin.h to this test.

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


#include "v3p_f2c.h"

#ifdef KR_headers
extern double sqrt(), f__cabs();

VOID c_sqrt(r, z) complex *r, *z;
#else
#undef abs
#include "math.h"
#ifdef __cplusplus
extern "C" {
#endif
extern double f__cabs(double, double);

void c_sqrt(complex *r, complex *z)
#endif
{
        double mag, t;
        double zi = z->i, zr = z->r;

        if( (mag = f__cabs(zr, zi)) == 0.)
                r->r = r->i = 0.;
        else if(zr > 0)
                {
                r->r = t = sqrt(0.5 * (mag + zr) );
                t = zi / t;
                r->i = 0.5 * t;
                }
        else
                {
                t = sqrt(0.5 * (mag - zr) );
                if(zi < 0)
                        t = -t;
                r->i = t;
                t = zi / t;
                r->r = 0.5 * t;
                }
        }
#ifdef __cplusplus
}
#endif

#include "v3p_f2c.h"

#ifdef KR_headers
extern double sqrt(), f__cabs();

VOID c_sqrt(r, z) complex *r, *z;
#else
#undef abs
#include "math.h"
#ifdef __cplusplus
extern "C" {
#endif
extern double f__cabs(double, double);

#undef complex
#define complex v3p_netlib_complex

void c_sqrt(complex *r, complex *z)
#endif
{
        double mag, t;
        double zi = z->i, zr = z->r;

        if( (mag = f__cabs(zr, zi)) == 0.)
                r->r = r->i = 0.;
        else if(zr > 0)
                {
                r->r = t = sqrt(0.5 * (mag + zr) );
                t = zi / t;
                r->i = 0.5 * t;
                }
        else
                {
                t = sqrt(0.5 * (mag - zr) );
                if(zi < 0)
                        t = -t;
                r->i = t;
                t = zi / t;
                r->r = 0.5 * t;
                }
        }
#ifdef __cplusplus
}
#endif

Fix for complex reference on Mac.

COMP: Fix for complex reference on Mac.


#pragma once

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

/**
 * Fork a number of child processes, to run in parallel multiple
 * times.
 *
 * @param nProcesses the number of processes to fork, at least 2
 *
 * @return the process ID from 0..nProcesses or -1 on failure
 */
extern int coincident_fork(int n);

extern int coincident_set_run_limit(int n_runs);

extern int coincident_set_time_limit(int n_ms);

#if defined(__cplusplus)
};
#endif

Add a public C-based API

API: Add a public C-based API

Not implemented yet though...


#ifndef OPTIONSDIALOG_H
#define OPTIONSDIALOG_H

#include <QDialog>

namespace Ui {
class OptionsDialog;
}
class OptionsModel;
class MonitoredDataMapper;
class QValidatedLineEdit;

/** Preferences dialog. */
class OptionsDialog : public QDialog
{
    Q_OBJECT

public:
    explicit OptionsDialog(QWidget *parent = 0);
    ~OptionsDialog();

    void setModel(OptionsModel *model);
    void setMapper();

protected:
    bool eventFilter(QObject *object, QEvent *event);

private slots:
    /* enable only apply button */
    void enableApplyButton();
    /* disable only apply button */
    void disableApplyButton();
    /* enable apply button and OK button */
    void enableSaveButtons();
    /* disable apply button and OK button */
    void disableSaveButtons();
    /* set apply button and OK button state (enabled / disabled) */
    void setSaveButtonState(bool fState);
    void on_okButton_clicked();
    void on_cancelButton_clicked();
    void on_applyButton_clicked();

    void showRestartWarning_Proxy();
    void showRestartWarning_fDark();
    void showRestartWarning_Lang();
    void updateDisplayUnit();
    void handleProxyIpValid(QValidatedLineEdit *object, bool fState);

signals:
    void proxyIpValid(QValidatedLineEdit *object, bool fValid);

private:
    Ui::OptionsDialog *ui;
    OptionsModel *model;
    MonitoredDataMapper *mapper;
    bool fRestartWarningDisplayed_Proxy;
    bool fRestartWarningDisplayed_fDark;
    bool fRestartWarningDisplayed_Lang;
    bool fProxyIpValid;
};

#endif // OPTIONSDIALOG_H

#ifndef OPTIONSDIALOG_H
#define OPTIONSDIALOG_H

#include <QDialog>

namespace Ui {
class OptionsDialog;
}
class OptionsModel;
class MonitoredDataMapper;
class QValidatedLineEdit;

/** Preferences dialog. */
class OptionsDialog : public QDialog
{
    Q_OBJECT

public:
    explicit OptionsDialog(QWidget *parent = 0);
    ~OptionsDialog();

    void setModel(OptionsModel *model);
    void setMapper();

protected:
    bool eventFilter(QObject *object, QEvent *event);

private slots:
    /* enable only apply button */
    void enableApplyButton();
    /* disable only apply button */
    void disableApplyButton();
    /* enable apply button and OK button */
    void enableSaveButtons();
    /* disable apply button and OK button */
    void disableSaveButtons();
    /* set apply button and OK button state (enabled / disabled) */
    void setSaveButtonState(bool fState);
    void on_okButton_clicked();
    void on_cancelButton_clicked();
    void on_applyButton_clicked();

    void showRestartWarning_Proxy();
    void showRestartWarning_fTor();
    void showRestartWarning_Lang();
    void updateDisplayUnit();
    void handleProxyIpValid(QValidatedLineEdit *object, bool fState);

signals:
    void proxyIpValid(QValidatedLineEdit *object, bool fValid);

private:
    Ui::OptionsDialog *ui;
    OptionsModel *model;
    MonitoredDataMapper *mapper;
    bool fRestartWarningDisplayed_Proxy;
    bool fRestartWarningDisplayed_fTor;
    bool fRestartWarningDisplayed_Lang;
    bool fProxyIpValid;
};

#endif // OPTIONSDIALOG_H

Use Tor refs - options headers

Use Tor refs - options headers


#ifndef SIMPLEAT_H
#define SIMPLEAT_H
#include <stdint.h>

#define AT_MAX_NUMBER_OF_ARGS 4
#define CLIENT_FUNCTION_TYPE uint16_t
#define ECHO_MODE_ON 1

#define AT_NO_ARGS {0}
#define AT_ARGS(...) {__VA_ARGS__, -1}
#define AT_ARG(x) ((uint8_t) sizeof (x))
#define AT_COMMAND(name, args, client) {(char*)#name, 0, args , 0, client}

#define ATReplyByteArray(x) ((uint8_t *) &x), sizeof(x)

typedef struct {
    char *command;
    uint8_t sizeOfCommand;
    int8_t argsSize[AT_MAX_NUMBER_OF_ARGS];
    uint8_t numberOfArgs;
    void (*client)(const CLIENT_FUNCTION_TYPE*);
} ATCommandDescriptor;

void ATEngineDriverInit(uint8_t (*open)(void),
                        uint8_t (*read)(void),
                        void (*write)(uint8_t),
                        uint8_t (*available)(void));

void ATEngineInit(ATCommandDescriptor *engine,  uint8_t sizeOfEngine);
uint8_t ATEngineRun();
void ATReplyWithByteArray(uint8_t *data, int size);
void ATReplyWithByte(uint8_t data);
void ATReplyWithString(char *str);

#endif // SIMPLEAT_H

#ifndef SIMPLEAT_H
#define SIMPLEAT_H
#include <stdint.h>

#define AT_MAX_NUMBER_OF_ARGS 4
#define CLIENT_FUNCTION_TYPE uint16_t
#define ECHO_MODE_ON 1

#define AT_NO_ARGS {0}
#define AT_ARGS(...) {__VA_ARGS__, -1}
#define AT_TYPE(x) ((uint8_t) sizeof (x))
#define AT_COMMAND(name, args, client) {(char*)#name, 0, args , 0, client}

#define ATReplyByteArray(x) ((uint8_t *) &x), sizeof(x)

typedef struct {
    char *command;
    uint8_t sizeOfCommand;
    int8_t argsSize[AT_MAX_NUMBER_OF_ARGS];
    uint8_t numberOfArgs;
    void (*client)(const CLIENT_FUNCTION_TYPE*);
} ATCommandDescriptor;

void ATEngineDriverInit(uint8_t (*open)(void),
                        uint8_t (*read)(void),
                        void (*write)(uint8_t),
                        uint8_t (*available)(void));

void ATEngineInit(ATCommandDescriptor *engine,  uint8_t sizeOfEngine);
uint8_t ATEngineRun();
void ATReplyWithByteArray(uint8_t *data, int size);
void ATReplyWithByte(uint8_t data);
void ATReplyWithString(char *str);

#endif // SIMPLEAT_H

Improve name AT_ARG changed to AT_TYPE

Improve name AT_ARG changed to AT_TYPE

Signed-off-by: rodrigopex <3b2e0cd8e32147e0545aeecd8920e147dee7f189@gmail.com>


/*
 * Copyright 2016, General Dynamics C4 Systems
 *
 * This software may be distributed and modified according to the terms of
 * the GNU General Public License version 2. Note that NO WARRANTY is provided.
 * See "LICENSE_GPLv2.txt" for details.
 *
 * @TAG(GD_GPL)
 */

#ifndef __PLAT_MACHINE_HARDWARE_H
#define __PLAT_MACHINE_HARDWARE_H

#define physBase          0x80000000
#define kernelBase        0xe0000000
#define physMappingOffset (kernelBase - physBase)
#define BASE_OFFSET       physMappingOffset
#define PPTR_TOP          0xfff00000
#define PADDR_TOP         (PPTR_TOP - BASE_OFFSET)

#endif

/*
 * Copyright 2016, General Dynamics C4 Systems
 *
 * This software may be distributed and modified according to the terms of
 * the GNU General Public License version 2. Note that NO WARRANTY is provided.
 * See "LICENSE_GPLv2.txt" for details.
 *
 * @TAG(GD_GPL)
 */

#ifndef __PLAT_MACHINE_HARDWARE_H
#define __PLAT_MACHINE_HARDWARE_H

#include <plat/machine/hardware_gen.h>

#define physBase          0x80000000
#define kernelBase        0xe0000000
#define physMappingOffset (kernelBase - physBase)
#define BASE_OFFSET       physMappingOffset
#define PPTR_TOP          0xfff00000
#define PADDR_TOP         (PPTR_TOP - BASE_OFFSET)

#endif

Correct previous merge with master

arm-hyp: Correct previous merge with master


/*
 * Copyright 2021 Scott Vokes
 *
 * See LICENCE for the full copyright terms.
 */

#ifndef LIBFSM_COMMON_H
#define LIBFSM_COMMON_H

#if defined(__clang__)
/* Newer versions of clang's UBSan emit warnings about *all* unsigned
 * integer overflows. While they are defined behavior, overflow can
 * cause bugs. This macro ignores them for a particular function.
 * Overflow/rollover is expected in when hashing, for example. */
#define SUPPRESS_EXPECTED_UNSIGNED_INTEGER_OVERFLOW()		\
	__attribute__((no_sanitize("integer")))
#else
#define SUPPRESS_EXPECTED_UNSIGNED_INTEGER_OVERFLOW()
#endif

#endif

Add a header w/ macro to suppress unsigned integer UBSan warnings.

This header can be included by all of the various src/* codebases.


/*
 * wdt.h  --  Watchdog Driver for Wolfson WM8350 PMIC
 *
 * Copyright 2007 Wolfson Microelectronics PLC
 *
 *  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.
 */

#ifndef __LINUX_MFD_WM8350_WDT_H_
#define __LINUX_MFD_WM8350_WDT_H_

#define WM8350_WDOG_HIB_MODE                    0x0080
#define WM8350_WDOG_DEBUG                       0x0040
#define WM8350_WDOG_MODE_MASK                   0x0030
#define WM8350_WDOG_TO_MASK                     0x0007

#define WM8350_IRQ_SYS_WDOG_TO			24

#endif

mfd: Add WM8350 watchdog register definitions

Signed-off-by: Mark Brown <b51b9a92386687a9ac927cebfa0f978adeb8cea5@opensource.wolfsonmicro.com>
Acked-by: Samuel Ortiz <0ba86cb3f08bbb861958e54bd3438887adb4263c@openedhand.com>
Signed-off-by: Liam Girdwood <a57ef363056e61beffa2efa59c68550d40db03b0@slimlogic.co.uk>