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

#include "Eina.h"
#include "eina_suite.h"

START_TEST(eina_simple)
{
   fail_if(!eina_init());
   fail_if(eina_shutdown() != 0);
}
END_TEST

void eina_test_main(TCase *tc)
{
   tcase_add_test(tc, eina_simple);
}

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

#include "Eina.h"
#include "eina_suite.h"

#include <stdio.h>
START_TEST(eina_simple)
{
   /* Eina_error as already been initialized by eina_hash
      that was called by eina_mempool_init that's why we don't have 0 here */
   fail_if(eina_init() != 2);
   fail_if(eina_shutdown() != 1);
}
END_TEST

void eina_test_main(TCase *tc)
{
   tcase_add_test(tc, eina_simple);
}

Fix test due to mempool internal change.

SVN revision: 36223


#pragma once
#include <exception>
#include <string>

namespace core {

	class Exception :
		public std::exception
	{
	public:
		Exception();
		virtual ~Exception();

		virtual char const * what() const override;

	protected:
		void setMessage(const std::string& message);
	private:
		std::string _message;
	};

}

#pragma once
#include <exception>
#include <string>

namespace core {

	class Exception :
		public std::exception
	{
	public:
		Exception();
		virtual ~Exception();

		virtual char const * what() const  throw() override;

	protected:
		void setMessage(const std::string& message);
	private:
		std::string _message;
	};

}

Add throw to what() function for linux compile


//
//  SearchItem.h
//  bikepath
//
//  Created by Farheen Malik on 8/15/14.
//  Copyright (c) 2014 Bike Path. All rights reserved.
//

#import <Foundation/Foundation.h>

@interface SearchItem : NSObject

@end

//
//  SearchItem.h
//  bikepath
//
//  Created by Farheen Malik on 8/15/14.
//  Copyright (c) 2014 Bike Path. All rights reserved.
//

#import <Foundation/Foundation.h>

@interface SearchItem : NSObject

@property NSString *searchQuery;
@property (readonly) NSDate *creationDate;

@end

Add property for search item object

Add property for search item object


Solve Distance Between Two Points in c

Solve Distance Between Two Points in c


// Copyright 2013 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 ASH_WM_WINDOW_SELECTOR_DELEGATE_H_
#define ASH_WM_WINDOW_SELECTOR_DELEGATE_H_

#include "base/compiler_specific.h"

namespace aura {
class Window;
}

namespace ash {

// Implement this class to handle the selection event from WindowSelector.
class WindowSelectorDelegate {
 public:
  // Invoked when a window is selected.
  virtual void OnWindowSelected(aura::Window* window) = 0;

  // Invoked if selection is canceled.
  virtual void OnSelectionCanceled() = 0;

 protected:
  virtual ~WindowSelectorDelegate() {}
};

}  // namespace ash

#endif  // ASH_WM_WINDOW_SELECTOR_DELEGATE_H_

// Copyright 2013 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 ASH_WM_WINDOW_SELECTOR_DELEGATE_H_
#define ASH_WM_WINDOW_SELECTOR_DELEGATE_H_

#include "ash/ash_export.h"
#include "base/compiler_specific.h"

namespace aura {
class Window;
}

namespace ash {

// Implement this class to handle the selection event from WindowSelector.
class ASH_EXPORT WindowSelectorDelegate {
 public:
  // Invoked when a window is selected.
  virtual void OnWindowSelected(aura::Window* window) = 0;

  // Invoked if selection is canceled.
  virtual void OnSelectionCanceled() = 0;

 protected:
  virtual ~WindowSelectorDelegate() {}
};

}  // namespace ash

#endif  // ASH_WM_WINDOW_SELECTOR_DELEGATE_H_

Add ASH_EXPORT to base class of exported WindowSelectorController.

TBR=pkotwicz@chromium.org

BUG=263477
TEST=Win Aura Builder compiles.

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

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


// RUN: %clang_cc1 %s -o - -emit-llvm | FileCheck %s
// XFAIL: aarch64, arm64, x86_64-pc-win32, x86_64-w64-mingw32

// PR1513

// AArch64 ABI actually requires the reverse of what this is testing: the callee
// does any extensions and remaining bits are unspecified.

// Win64 ABI does expect extensions for type smaller than 64bits.

// Technically this test wasn't written to test that feature, but it's a
// valuable check nevertheless.

struct s{
long a;
long b;
};

void f(struct s a, char *b, signed char C) {
  // CHECK: i8 signext

}

// RUN: %clang_cc1 %s -o - -emit-llvm | FileCheck %s
// XFAIL: aarch64, arm64, x86_64-pc-win32, x86_64-w64-mingw32, x86_64-pc-windows-gnu

// PR1513

// AArch64 ABI actually requires the reverse of what this is testing: the callee
// does any extensions and remaining bits are unspecified.

// Win64 ABI does expect extensions for type smaller than 64bits.

// Technically this test wasn't written to test that feature, but it's a
// valuable check nevertheless.

struct s{
long a;
long b;
};

void f(struct s a, char *b, signed char C) {
  // CHECK: i8 signext

}

Add expected fail triple x86_64-pc-windows-gnu to test as x86_64-w64-mingw32 is already there

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


//===- BreakConstantGEPs.h - Change constant GEPs into GEP instructions --- --//
//
//                          The SAFECode Compiler
//
// This file was developed by the LLVM research group and is distributed under
// the University of Illinois Open Source License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
//
// This pass changes all GEP constant expressions into GEP instructions.  This
// permits the rest of SAFECode to put run-time checks on them if necessary.
//
//===----------------------------------------------------------------------===//

#ifndef BREAKCONSTANTGEPS_H
#define BREAKCONSTANTGEPS_H

#include "llvm/ADT/StringRef.h"
#include "llvm/IR/Dominators.h"
#include "llvm/IR/Module.h"
#include "llvm/Pass.h"

namespace llvm {

//
// Pass: BreakConstantGEPs
//
// Description:
//  This pass modifies a function so that it uses GEP instructions instead of
//  GEP constant expressions.
//
struct BreakConstantGEPs : public FunctionPass {
  private:
    // Private methods

    // Private variables

  public:
    static char ID;
    BreakConstantGEPs() : FunctionPass(ID) {}
    StringRef getPassName() const override {
      return "Remove Constant GEP Expressions";
    }
    virtual bool runOnFunction (Function & F);
    virtual void getAnalysisUsage(AnalysisUsage &AU) const {
      // This pass does not modify the control-flow graph of the function
      AU.setPreservesCFG();
    }
};

} // namespace llvm

#endif

//===- BreakConstantGEPs.h - Change constant GEPs into GEP instructions --- --//
//
//                          The SAFECode Compiler
//
// This file was developed by the LLVM research group and is distributed under
// the University of Illinois Open Source License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
//
// This pass changes all GEP constant expressions into GEP instructions.  This
// permits the rest of SAFECode to put run-time checks on them if necessary.
//
//===----------------------------------------------------------------------===//

#ifndef BREAKCONSTANTGEPS_H
#define BREAKCONSTANTGEPS_H

#include "llvm/ADT/StringRef.h"
#include "llvm/IR/Dominators.h"
#include "llvm/IR/Module.h"
#include "llvm/Pass.h"

namespace llvm {

//
// Pass: BreakConstantGEPs
//
// Description:
//  This pass modifies a function so that it uses GEP instructions instead of
//  GEP constant expressions.
//
struct BreakConstantGEPs : public FunctionPass {
  private:
    // Private methods

    // Private variables

  public:
    static char ID;
    BreakConstantGEPs() : FunctionPass(ID) {}
    StringRef getPassName() const override {
      return "Remove Constant GEP Expressions";
    }
    virtual bool runOnFunction (Function & F) override;
    virtual void getAnalysisUsage(AnalysisUsage &AU) const override {
      // This pass does not modify the control-flow graph of the function
      AU.setPreservesCFG();
    }
};

} // namespace llvm

#endif

Correct inconsistent use of override.

Correct inconsistent use of override.


#ifndef GST_IMX_COMMON_PHYS_MEM_ADDR_H
#define GST_IMX_COMMON_PHYS_MEM_ADDR_H

#define GST_IMX_PHYS_ADDR_FORMAT "lx"

typedef unsigned long gst_imx_phys_addr_t;

#endif

#ifndef GST_IMX_COMMON_PHYS_MEM_ADDR_H
#define GST_IMX_COMMON_PHYS_MEM_ADDR_H

#define GST_IMX_PHYS_ADDR_FORMAT "#lx"

typedef unsigned long gst_imx_phys_addr_t;

#endif

common: Add 0x prefix to phys mem addr printf conversion specifier

Signed-off-by: Carlos Rafael Giani <d7d2e6b3863b2910d2ca34828bc651c85d88df6f@pseudoterminal.org>


// This is the actual main program

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

// This is the actual main program

#include "lorito.h"
#include "microcode.h"
#include "interp.h"
#include "loader.h"

int
main(int argc, const char *argv[])
{
  int i;
  Lorito_Interp *interp;

  if (argc < 2)
  {
    fprintf(stderr, "Usage: lorito <bytecodefiles>\n");
    return 255;
  }

  interp = lorito_init();

  for (i = 1; i < argc; i++)
  {
    loadbc(interp, argv[i]);
  }

  return lorito_run(interp);
}

Add all the glue together to have an interpreter actually run.


#include <stdio.h>

int main() {
  char palavrasecreta[20];

  sprintf(palavrasecreta, "MELANCIA");

  printf("%s\n", palavrasecreta);

  /*
  palavrasecreta[0] = 'M';
  palavrasecreta[1] = 'E';
  palavrasecreta[2] = 'L';
  palavrasecreta[3] = 'A';
  palavrasecreta[4] = 'N';
  palavrasecreta[5] = 'C';
  palavrasecreta[6] = 'I';
  palavrasecreta[7] = 'A';
  palavrasecreta[8] = '\0';

  printf("%c%c%c%c%c%c%c%c\n", palavrasecreta[0], palavrasecreta[1], palavrasecreta[2], palavrasecreta[3], palavrasecreta[4], palavrasecreta[5], palavrasecreta[6], palavrasecreta[7]);
  */
}

#include <stdio.h>

int main() {
  char palavrasecreta[20];

  sprintf(palavrasecreta, "MELANCIA");

  int acertou = 0;
  int enforcou = 0;

  do {
    // comecar o nosso jogo!!

  } while(!acertou && !enforcou);

}

Update files, Alura, Introdução a C - Parte 2, Aula 2.3


/*
name: TEST008
description: Basic do while loop
output:
F1
G1	F1	main
{
-
A2	I	x
	A2	#I0	:I
	d
L3
	A2	A2	#I1	+I	:I
	j	L3	A2	#IA	<I
	b
L4
	d
L5
	A2	A2	#I1	+I	:I
	j	L5	A2	#I14	<I
	b
L6
	yI	A2	#I14	-I
}
*/

int
main()
{
	int x;

	x = 0;
	do
	  x = x + 1;
	while(x < 10);

	do {
	  x = x + 1;
	} while(x < 20);

	return x - 20;
}

Add basic test for do while statements

Add basic test for do while statements


// cc log_example.c log.c -rdynamic

#include "log.h"

char
make_segmentfault()
{
    char *s = NULL;
    char ch = s[1]; // segment fault
    return ch;
}

int main(int argc, const char *argv[])
{
    /* open global logger to stderr (by setting filename to NULL) */
    log_open("example", NULL, 0);
    /* set log level to info, also the default level */
    log_setlevel(LOG_INFO);
    /* debug mesage won't be seen */
    log_debug("debug message");
    /* but info and warn, error message can be seen */
    log_info("info message");
    log_warn("warn message");
    log_error("error message");
    /* will log trace back on segmentfault automatically */
    make_segmentfault();
    return 0;
}

// cc log_example.c log.c -rdynamic

#include "log.h"

char
make_segmentfault()
{
    char *s = NULL;
    char ch = s[1]; // segment fault
    return ch;
}

int main(int argc, const char *argv[])
{
    /* open global logger to stderr (by setting filename to NULL) */
    log_open("example", NULL, 0);
    /* set log level to info, also the default level */
    log_setlevel(LOG_INFO);
    /* debug mesage won't be seen */
    log_debug("debug message");
    /* but info and warn, error message can be seen */
    log_info("info message");
    log_warn("warn message");
    log_error("error message: %s", "someting wrong");
    /* will log trace back on segmentfault automatically */
    make_segmentfault();
    return 0;
}

Add example for log with formatting args


#pragma once

enum class Opcode {
	INVALID = 0,
	NOP = 1,

	PUSH = 2,
	PUSH_STATIC = 3,
	POP = 4,
	SET = 5,

	CALL = 6,
	CALL_METHOD = 7,
	CALL_INTERNAL = 8,
	RETURN = 9,

	PRINT = 10,

    METHOD_END = 11
};

#pragma once

enum class Opcode {
	INVALID = 0,
	NOP = 1,

	PUSH = 2, // pushes a reference into the stack
	PUSH_STATIC = 3, // pushes static data into the stack
	POP = 4, // pop anything to void

	SET = 5, // pop a reference from the stack and assign it
	SET_STATIC = 6, // set a reference to static data

	CALL = 7,
	CALL_METHOD = 8,
	CALL_INTERNAL = 9,
	RETURN = 10,

	PRINT = 11,

    METHOD_END = 12
};

Add SET_STATIC opcode to enum

Add SET_STATIC opcode to enum


#pragma once
#include "../Util/FileClasses.h"
#include "../Util/Util.h"
#include "FileManager.h"

#define ARMIPS_VERSION_MAJOR    0
#define ARMIPS_VERSION_MINOR    8
#define ARMIPS_VERSION_REVISION 0

enum class ArmipsMode { FILE, MEMORY };

struct LabelDefinition
{
	std::wstring name;
	int value;
};

struct EquationDefinition
{
	std::wstring name;
	std::wstring value;
};

struct ArmipsArguments
{
	// common
	ArmipsMode mode;
	int symFileVersion;
	bool errorOnWarning;
	bool silent;
	StringList* errorsResult;
	std::vector<EquationDefinition> equList;
	std::vector<LabelDefinition> labels;

	// file mode
	std::wstring inputFileName;
	std::wstring tempFileName;
	std::wstring symFileName;

	// memory mode
	AssemblerFile* memoryFile;
	std::wstring content;

	ArmipsArguments()
	{
		mode = ArmipsMode::FILE;
		errorOnWarning = false;
		silent = false;
		errorsResult = NULL;
	}
};

bool runArmips(ArmipsArguments& arguments);

#pragma once
#include "../Util/FileClasses.h"
#include "../Util/Util.h"
#include "FileManager.h"

#define ARMIPS_VERSION_MAJOR    0
#define ARMIPS_VERSION_MINOR    9
#define ARMIPS_VERSION_REVISION 0

enum class ArmipsMode { FILE, MEMORY };

struct LabelDefinition
{
	std::wstring name;
	int value;
};

struct EquationDefinition
{
	std::wstring name;
	std::wstring value;
};

struct ArmipsArguments
{
	// common
	ArmipsMode mode;
	int symFileVersion;
	bool errorOnWarning;
	bool silent;
	StringList* errorsResult;
	std::vector<EquationDefinition> equList;
	std::vector<LabelDefinition> labels;

	// file mode
	std::wstring inputFileName;
	std::wstring tempFileName;
	std::wstring symFileName;

	// memory mode
	AssemblerFile* memoryFile;
	std::wstring content;

	ArmipsArguments()
	{
		mode = ArmipsMode::FILE;
		errorOnWarning = false;
		silent = false;
		errorsResult = NULL;
	}
};

bool runArmips(ArmipsArguments& arguments);

Bump version number to 0.9

Bump version number to 0.9


/*
 * 06/21/2016: bigfile2.c
 */
#include <stdio.h>
#include <fcntl.h>
#include <errno.h>
#include <stdlib.h>
#include <unistd.h>

main(int argc, char *argv[])
{
	long val;
	char *buf, *filename;
	int error = 0, readonly = 0;
	size_t i, j, c, fd, seed, size, bsize, nblocks;

	bsize = 5678;
	nblocks = 12345;
	seed = getpid();
	while ((c = getopt(argc, argv, "b:s:n:r")) != -1) {
		switch (c) {
			case 'b':
				bsize = atoi(optarg);
				break;
			case 's':
				seed = atoi(optarg);
				break;
                        case 'n':
				nblocks = atoi(optarg);
				break;
                        case 'r':
				readonly = 1;
				break;
		}
	}
	if (optind > argc - 1) {
		printf("Usage: a.out [-s seed] [-b bsize] [-n nblocks ] filename\n");
		exit(0);
	}
	filename = argv[optind];
	if (readonly)
        	fd = open(filename, O_RDONLY);
	else
        	fd = open(filename, O_RDWR | O_CREAT | O_TRUNC, 0600);
	if (fd < 0) {
		printf("Fail to open file, errno = %d\n", errno);
		exit(0);
	}

	buf = malloc(bsize);
	if (buf == NULL) {
		printf("Fail to allocate memory, errno = %d\n", errno);
		exit(0);
	}
	srandom(seed);
	printf("Seed = %d, file size = %ld\n", seed, nblocks * bsize);
	for (i = 0; i < nblocks; i++) {

		if (readonly)
			size = read(fd, buf, bsize);
		else {
			for (j = 0; j < bsize; j++) {
				val = random();
				//printf("%lx\n", val);
				buf[j] = val & 0xff;
			}
			size = write(fd, buf, bsize);
		}
		if (size != bsize) {
			printf("Fail to %s file, errno = %d\n",
				readonly ? "read" : "write", errno);
			break;
		}
		if (!readonly)
			continue;

		for (j = 0; j < bsize; j++) {
			if (buf[j] != random() & 0xff) {
				printf("Unexpected data at offset = %ld\n",
					i * nblocks * j);
				error++;
				break;
			}
		}
		if (error > 20)
			break;
	}
        close(fd);
}

Add a big file test

Add a big file test


/*!
@file main.c
@brief A simple test program for the C library code.
*/

#include "stdio.h"

#include "verilog_parser.h"

int main(int argc, char ** argv)
{
    if(argc < 2)
    {
        printf("ERROR. Please supply at least one file path argument.\n");
        return 1;
    }
    else
    {
        int F = 0;

        for(F = 1; F < argc; F++)
        {
            // Load the file.
            FILE * fh = fopen(argv[F], "r");

            // Instance the parser.
            verilog_parser parser = verilog_file_parse(fh);

            // Parse the file and store the result.
            int result = verilog_parse_buffer(parser);

            verilog_free_parser(parser);
            fclose(fh);

            if(result == 0)
            {
                printf("Parse successful for %s\n",argv[F]);
            }
            else
            {
                printf("Parse failed for %s\n",argv[F]);
            }
        }
    }
    return 0;
}

/*!
@file main.c
@brief A simple test program for the C library code.
*/

#include "stdio.h"

#include "verilog_parser.h"

int main(int argc, char ** argv)
{
    if(argc < 2)
    {
        printf("ERROR. Please supply at least one file path argument.\n");
        return 1;
    }
    else
    {
        int F = 0;

        for(F = 1; F < argc; F++)
        {
            printf("%s", argv[F]);
            fflush(stdout);

            // Load the file.
            FILE * fh = fopen(argv[F], "r");

            // Instance the parser.
            verilog_parser parser = verilog_file_parse(fh);

            // Parse the file and store the result.
            int result = verilog_parse_buffer(parser);

            verilog_free_parser(parser);
            fclose(fh);

            if(result == 0)
            {
                printf(" - Parse successful\n");
            }
            else
            {
                printf(" - Parse failed for\n");
            }
        }
    }
    return 0;
}

Print name of test before parsing it - easier to identify segfaulting tests.
 On branch master
 Your branch is up-to-date with 'github/master'.

 Changes to be committed:
	modified:   src/main.c

 Changes not staged for commit:
	modified:   src/verilog_ast.c
	modified:   src/verilog_ast.h
	modified:   src/verilog_parser.y


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

void foo();
void bar();

void fold_if(int a, int b) {
  // CHECK: define {{.*}} @fold_if(
  // CHECK-NOT: = phi
  // CHECK: }
  if (a && b)
    foo();
  else
    bar();
}

void fold_for(int a, int b) {
  // CHECK: define {{.*}} @fold_for(
  // CHECK-NOT: = phi
  // CHECK: }
  for (int i = 0; a && i < b; ++i) foo();
  for (int i = 0; a || i < b; ++i) bar();
}

CodeGen: Test that simple expressions are simplified at -O0

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


#ifndef _MATH_MT_H_
#define _MATH_MT_H_

#if defined(_MSC_VER) && (_MSC_VER <= 1300)
typedef unsigned __int32 uint32_t;
#elif defined(__linux__) || defined(__GLIBC__) || defined(__WIN32__)
#include <stdint.h>
#elif defined(__osf__)
#include <inttypes.h>
#else
#include <sys/types.h>
#endif

enum { N = 624, M = 397 };

struct mt {
    uint32_t mt[N];
    int mti;
};

struct mt *mt_setup(uint32_t seed);
struct mt *mt_setup_array(uint32_t *array, int n);
void mt_free(struct mt *self);
double mt_genrand(struct mt *self);

#endif

#ifndef _MATH_MT_H_
#define _MATH_MT_H_

#if defined(_MSC_VER) && (_MSC_VER <= 1300)
typedef unsigned __int32 uint32_t;
#elif defined(__linux__) || defined(__GLIBC__) || defined(__WIN32__) || defined(__APPLE__)
#include <stdint.h>
#elif defined(__osf__)
#include <inttypes.h>
#else
#include <sys/types.h>
#endif

enum { N = 624, M = 397 };

struct mt {
    uint32_t mt[N];
    int mti;
};

struct mt *mt_setup(uint32_t seed);
struct mt *mt_setup_array(uint32_t *array, int n);
void mt_free(struct mt *self);
double mt_genrand(struct mt *self);

#endif

Fix OS X build failure

Fix OS X build failure


#include "bst.h"

static void BST_Transplant(BST* T, BSTNode* u, BSTNode* v);

struct BSTNode
{
	BSTNode* left;
	BSTNode* right;
	BSTNode* p;
	void* k;
};

struct BST
{
	BSTNode* root;
};

BST* BST_Create(void)
{
	BST* T = (BST* )malloc(sizeof(BST));
	T->root = NULL;
	return T;
}

BSTNode* BSTNode_Create(void* k)
{
	BSTNode* n = (BSTNode* )malloc(sizeof(BSTNode));
	n->left = NULL;
	n->right = NULL;
	n->p = NULL;
	n->k = k;
}

void BST_Inorder_Tree_Walk(BSTNode* n, void (f)(void*))
{
	if (n != NULL)
	{
		BST_Inorder_Tree_Walk(n->left, f);
		f(n->k);
		BST_Inorder_Tree_Walk(n->right, f);
	}
}

void BST_Preorder_Tree_Walk(BSTNode* n, void (f)(void*))
{
	if (n != NULL)
	{
		f(n->k);
		BST_Preorder_Tree_Walk(n->left, f);
		BST_Preorder_Tree_Walk(n->right, f);
	}
}

Add BST preorder traversal function implementation


/*
 * cabs() wrapper for hypot().
 *
 * Written by J.T. Conklin, <jtc@wimsey.com>
 * Placed into the Public Domain, 1994.
 */

#include <math.h>

struct complex {
	double x;
	double y;
};

double
cabs(z)
	struct complex z;
{
	return hypot(z.x, z.y);
}

double
z_abs(z)
	struct complex *z;
{
	return hypot(z->x, z->y);
}

Add missing z_abs. In BSD tradition this is in libm.a.


#include <unistd.h>
#include <signal.h>
#include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
#include <sys/wait.h>

char **params;

// double fork to avoid zombies and exec the python server
void signal_handler() {
	if (fork() == 0) {
		execv(params[0], params);
	}

	return;
}

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

	params = (char**)malloc((3+argc-1)*sizeof(char*));
	params[0] = "/usr/bin/python";
	params[1] = "/server.py";
	for (k = 1; k < argc; k++) {
		params[k+1] = argv[k];
	}
	params[argc+1] = NULL;

	signal(SIGURG, signal_handler);
	while (1) {
		pause(); // sleep forever, we're init for the ns
	}

	return 0;
}

#include <unistd.h>
#include <signal.h>
#include <stdio.h>
#include <stdlib.h>
#include <sys/types.h>
#include <sys/wait.h>

char **params;

/*
 * Launch the lambda server.
 */
void signal_handler() {
	if (fork() == 0) {
		execv(params[0], params);
	}

	return;
}

/*
 * Install the handler and block all other signals while handling
 * the signal. Reset the signal handler after caught to default.
 */
void install_handler() {
	struct sigaction setup_action;
	sigset_t block_mask;

	sigfillset(&block_mask);
	setup_action.sa_handler = signal_handler;
	setup_action.sa_mask = block_mask;
	setup_action.sa_flags = SA_RESETHAND;
	sigaction(SIGURG, &setup_action, NULL);
}

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

	params = (char**)malloc((3+argc-1)*sizeof(char*));
	params[0] = "/usr/bin/python";
	params[1] = "/server.py";
	for (k = 1; k < argc; k++) {
		params[k+1] = argv[k];
	}
	params[argc+1] = NULL;

	install_handler();
	while (1) {
		pause(); // sleep forever, we're init for the ns
	}

	return 0;
}

Use sigaction instead of signal

Use sigaction instead of signal

Signal is not portable. It is better to use sigaction so we can also
prevent other signals from interrupting us just in case.


#ifndef __MDAQLED_H
#define __MDAQLED_H

#ifndef MATLAB_MEX_FILE
#include "gpio.h"
#endif

void mdaqled_init(void);
void mdaqled_set(unsigned char led, unsigned char state);

#endif

#ifndef __MDAQLED_H
#define __MDAQLED_H

#if (!defined MATLAB_MEX_FILE) && (!defined MDL_REF_SIM_TGT)
#include "gpio.h"
#endif

void mdaqled_init(void);
void mdaqled_set(unsigned char led, unsigned char state);

#endif

Make LED block compatible with PIL in model reference


#include <stdio.h>
#include <string.h>
#include <X11/Xlib.h>
#include <X11/XKBlib.h>
#include <X11/extensions/XKBrules.h>

int main(int argc, char *argv[])
{
    Display *display = XOpenDisplay(NULL);
    XkbEvent event;
    XkbRF_VarDefsRec varDefs;
    XkbStateRec state;
    char *tmp = NULL;
    char *groups[XkbNumKbdGroups];
    int num_groups = 0;
    XkbSelectEventDetails(display, XkbUseCoreKbd, XkbStateNotify, XkbGroupLockMask, XkbGroupLockMask);
    XkbRF_GetNamesProp(display, &tmp, &varDefs);
    groups[num_groups] = strtok(varDefs.layout, ",");
    printf("%s\r\n", groups[num_groups]);
    while(groups[num_groups])
    {
        num_groups++;
        groups[num_groups] = strtok(NULL, ",");
    }
    XkbGetState(display, XkbUseCoreKbd, &state);
    while (1)
    {
        XNextEvent(display, &event.core);
        printf("%s\r\n", groups[event.state.locked_group]);
    }
    return XCloseDisplay(display);
}

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <X11/Xlib.h>
#include <X11/XKBlib.h>
#include <X11/extensions/XKBrules.h>

#define DELIMETER ","
#define LAYOUT_FORMAT "%s\r\n"

int main(int argc, char *argv[])
{
    int rc = EXIT_FAILURE;
    XkbEvent event;
    XkbRF_VarDefsRec vd;
    XkbStateRec state;
    char *groups[XkbNumKbdGroups];
    unsigned char num_groups = 0;
    char *display_name = NULL;
    Display *display = NULL;
    if (!(display = XOpenDisplay(display_name)))
        goto out;
    if (XkbSelectEventDetails(display,
                              XkbUseCoreKbd,
                              XkbStateNotify,
                              XkbGroupLockMask,
                              XkbGroupLockMask) != True)
        goto out_close_display;
    if (XkbRF_GetNamesProp(display, NULL, &vd) != True)
        goto out_close_display;
    while ((groups[num_groups] = strsep(&vd.layout, DELIMETER))) num_groups++;
    if (XkbGetState(display, XkbUseCoreKbd, &state) == Success)
        printf(LAYOUT_FORMAT, groups[state.locked_group]);
    while (1)
        if (XNextEvent(display, &event.core) == Success)
            printf(LAYOUT_FORMAT, groups[event.state.locked_group]);

    XFree(vd.model);
    XFree(vd.layout);
    XFree(vd.variant);
    XFree(vd.options);
out_close_display:
    rc = XCloseDisplay(display);
out:
    return rc;
}

Return codes of XLib functions are handled

Code formated to the K&R style.  Added program exit code.  All
significant return codes for XLib functions are handled.  Free resources
allocated by XLib. However sigterm should be handled to get this
actually working.


/*
  Program that verifies that duplicated file descriptors share a file offset and
  open file status flags.
*/

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

void exitErr(const char* msg);

int main(__attribute__((unused)) int _argc, __attribute__((unused)) char **argv)
{
    int fd1, fd2, flagsBefore, flagsAfter;
    off_t offsetBefore, offsetAfter, offsetFd2;

    fd1 = open("example.txt", O_RDONLY);
    fd2 = dup(fd1);

    flagsBefore = fcntl(fd1, F_GETFL);
    if (flagsBefore == -1)
        exitErr("fcntl");

    if (fcntl(fd2, F_SETFL, flagsBefore | O_APPEND) == -1)
        exitErr("fcntl");

    flagsAfter = fcntl(fd1, F_GETFL);
    if (flagsAfter == -1)
        exitErr("fcntl");

    assert(flagsBefore != flagsAfter);
    assert(flagsAfter & O_APPEND);

    offsetBefore = lseek(fd1, 0, SEEK_CUR);
    if (offsetBefore == -1)
        exitErr("lseek");

    offsetFd2 = lseek(fd2, 10, SEEK_END);
    if (offsetFd2 == -1)
        exitErr("lseek");

    offsetAfter = lseek(fd1, 0, SEEK_CUR);
    if (offsetAfter == -1)
        exitErr("lseek");

    assert(offsetAfter != offsetBefore);
    assert(offsetAfter == offsetFd2);

    exit(EXIT_SUCCESS);
}

void exitErr(const char *msg)
{
    perror(msg);
    exit(EXIT_FAILURE);
}

Add fifth exercise from chapter 5.

Add fifth exercise from chapter 5.


/*
 *
 *  OBEX Server
 *
 *  Copyright (C) 2007-2008  Marcel Holtmann <marcel@holtmann.org>
 *
 *
 *  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, write to the Free Software
 *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 *
 */

#ifdef HAVE_CONFIG_H
#include <config.h>
#endif

#include <plugin.h>
#include <logging.h>

#include <libebook/e-book.h>

static int ebook_init(void)
{
	DBG("");

	return 0;
}

static void ebook_exit(void)
{
	DBG("");
}

OBEX_PLUGIN_DEFINE("ebook", ebook_init, ebook_exit)

Add skeleton for EBook plugin

obexd: Add skeleton for EBook plugin


#ifndef ITERATOR_H
#define ITERATOR_H

struct iterator {
    size_t index;
    void *iterable;
    void *current;
    void *(*next)(struct iterator *this);
    void (*destroy)(struct iterator *this);
};

struct iterator *iterator_create(void *iterable, void *(*next)(struct iterator *));

void iterator_destroy(struct iterator *this);

#endif

#ifndef ITERATOR_H
#define ITERATOR_H

#include <stdlib.h>

struct iterator {
    size_t index;
    void *iterable;
    void *current;
    void *(*next)(struct iterator *this);
    void (*destroy)(struct iterator *this);
};

struct iterator *iterator_create(void *iterable, void *(*next)(struct iterator *));

void iterator_destroy(struct iterator *this);

#endif

Include stdlib to get size_t.

Include stdlib to get size_t.


#if !defined(_CARMIPRO_H)
#define _CARMIPRO_H
#include "pvmsdpro.h"

#define CARMI_FIRST	(SM_LAST+1)

#define CARMI_RESPAWN (CARMI_FIRST+1)
#define CARMI_CHKPT   (CARMI_FIRST+2)
#define CARMI_ADDHOST (CARMI_FIRST+3)
#endif

#if !defined(_CARMIPRO_H)
#define _CARMIPRO_H
#include "pvmsdpro.h"

#define CARMI_FIRST	(SM_LAST+1)

#define CARMI_RESPAWN (CARMI_FIRST+1)
#define CARMI_CHKPT   (CARMI_FIRST+2)
#define CARMI_ADDHOST (CARMI_FIRST+3)
#define CARMI_SPAWN	  (CARMI_FIRST+4)
#define CARMI_CKPT_ON_VACATE (CARMI_FIRST + 5)
#define CARMI_LAST    (CARMI_CKPT_ON_VACATE)

#define CO_CHECK_FIRST (CARMI_LAST+1)
#define CO_CHECK_SIMPLE_CKPT_TASK_TO_FILE (CO_CHECK_FIRST + 1)
#define CO_CHECK_RESTART_TASK_FROM_FILE (CO_CHECK_FIRST + 2)
#define CO_CHECK_SIMPLE_CKPT_TASK (CO_CHECK_FIRST + 3)
#define CO_CHECK_RESTART_TASK (CO_CHECK_FIRST + 4)
#define CO_CHECK_SIMPLE_MIGRATE_TASK_TO_HOST (CO_CHECK_FIRST + 5)
#define CO_CHECK_SIMPLE_MIGRATE_TASK (CO_CHECK_FIRST + 6)
#endif

Define a whole bunch of new message tags for checkpoint and migration functions.


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

float
main(int argc, char **argv)
{
    int opt;
    int debug = 0;
    char *ofile = 0;
    extern char version[];

    opterr = 1;

    while ( (opt=getopt(argc, argv, "do:V")) != EOF ) {
	switch (opt) {
	case 'd':   debug = 1;
		    break;
	case 'V':   printf("markdown %s\n", version);
		    exit(0);
	case 'o':   if ( ofile ) {
			fprintf(stderr, "Too many -o options\n");
			exit(1);
		    }
		    if ( !freopen(ofile = optarg, "w", stdout) ) {
			perror(ofile);
			exit(1);
		    }
		    break;
	default:    fprintf(stderr, "usage: markdown [-V] [-o file] [file]\n");
		    exit(1);
	}
    }
    argc -= optind;
    argv += optind;

    if ( argc && !freopen(argv[0], "r", stdin) ) {
	perror(argv[0]);
	exit(1);
    }
    if ( debug )
	mkd_dump(mkd_in(stdin), stdout, 0);
    else
	markdown(mkd_in(stdin), stdout, 0);
    exit(0);
}

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

float
main(int argc, char **argv)
{
    int opt;
    int debug = 0;
    char *ofile = 0;
    extern char version[];

    opterr = 1;

    while ( (opt=getopt(argc, argv, "do:V")) != EOF ) {
	switch (opt) {
	case 'd':   debug = 1;
		    break;
	case 'V':   printf("markdown %s\n", version);
		    exit(0);
	case 'o':   if ( ofile ) {
			fprintf(stderr, "Too many -o options\n");
			exit(1);
		    }
		    if ( !freopen(ofile = optarg, "w", stdout) ) {
			perror(ofile);
			exit(1);
		    }
		    break;
	default:    fprintf(stderr, "usage: markdown [-dV] [-o file] [file]\n");
		    exit(1);
	}
    }
    argc -= optind;
    argv += optind;

    if ( argc && !freopen(argv[0], "r", stdin) ) {
	perror(argv[0]);
	exit(1);
    }
    if ( debug )
	mkd_dump(mkd_in(stdin), stdout, 0);
    else
	markdown(mkd_in(stdin), stdout, 0);
    exit(0);
}

Put the -d option into the usage: message


/*
 *  cameraautoswitch.h
 *  StatusSpec project
 *
 *  Copyright (c) 2014-2015 Forward Command Post
 *  BSD 2-Clause License
 *  http://opensource.org/licenses/BSD-2-Clause
 *
 */

#include "igameevents.h"

#include "../modules.h"

class CCommand;
class ConCommand;
class ConVar;
class IConVar;

 class CameraAutoSwitch : public Module, IGameEventListener2 {
 public:
	 CameraAutoSwitch();

 	static bool CheckDependencies();

 	virtual void FireGameEvent(IGameEvent *event);
 private:
	 class Panel;
	 Panel *panel;

	 ConVar *enabled;
	 ConVar *killer;
	 ConVar *killer_delay;
	 void ToggleEnabled(IConVar *var, const char *pOldValue, float flOldValue);
	 void ToggleKillerEnabled(IConVar *var, const char *pOldValue, float flOldValue);
 };

/*
 *  cameraautoswitch.h
 *  StatusSpec project
 *
 *  Copyright (c) 2014-2015 Forward Command Post
 *  BSD 2-Clause License
 *  http://opensource.org/licenses/BSD-2-Clause
 *
 */

#pragma once

#include "igameevents.h"

#include "../modules.h"

class CCommand;
class ConCommand;
class ConVar;
class IConVar;

 class CameraAutoSwitch : public Module, IGameEventListener2 {
 public:
	 CameraAutoSwitch();

 	static bool CheckDependencies();

 	virtual void FireGameEvent(IGameEvent *event);
 private:
	 class Panel;
	 Panel *panel;

	 ConVar *enabled;
	 ConVar *killer;
	 ConVar *killer_delay;
	 void ToggleEnabled(IConVar *var, const char *pOldValue, float flOldValue);
	 void ToggleKillerEnabled(IConVar *var, const char *pOldValue, float flOldValue);
 };

Add pragma once to camera auto switch header.


#include <stdio.h>

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;

  printf("Qual é o seu chute? ");
  scanf("%d", &chute);
  printf("Seu chute foi %d\n", chute);

  if(chute == numerosecreto) {
    printf("Parabéns! Você acertou!\n");
    printf("Jogue de novo, você é um bom jogador!\n");
  }
  else {
    printf("Você errou!\n");
    printf("Mas não desanime, tente de novo!\n");
  }

}

#include <stdio.h>

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;

  printf("Qual é o seu chute? ");
  scanf("%d", &chute);
  printf("Seu chute foi %d\n", chute);

  if(chute == numerosecreto) {
    printf("Parabéns! Você acertou!\n");
    printf("Jogue de novo, você é um bom jogador!\n");
  }
  else {
    if(chute > numerosecreto) {
      printf("Seu chute foi maior que o número secreto\n");
    }

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

    printf("Você errou!\n");
    printf("Mas não desanime, tente de novo!\n");
  }

}

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


#define WIKIGLYPH_FORWARD @"\ue954"
#define WIKIGLYPH_BACKWARD @"\ue955"
#define WIKIGLYPH_DOWN @"\ue956"
#define WIKIGLYPH_X @"\ue95e"
#define WIKIGLYPH_FLAG @"\ue963"
#define WIKIGLYPH_USER_SMILE @"\ue964"
#define WIKIGLYPH_USER_SLEEP @"\ue965"
#define WIKIGLYPH_CC @"\ue969"
#define WIKIGLYPH_CITE @"\ue96b"
#define WIKIGLYPH_PUBLIC_DOMAIN @"\ue96c"

#define WIKIGLYPH_X @"\ue95e"
#define WIKIGLYPH_FLAG @"\ue963"
#define WIKIGLYPH_USER_SMILE @"\ue964"
#define WIKIGLYPH_USER_SLEEP @"\ue965"
#define WIKIGLYPH_CC @"\ue969"
#define WIKIGLYPH_PUBLIC_DOMAIN @"\ue96c"

Remove unused glyph font defines.

Remove unused glyph font defines.


/*===- Operator.h - libSimulation -=============================================
*
*                                  DEMON
*
* This file is distributed under the BSD Open Source License. See LICENSE.TXT
* for details.
*
*===-----------------------------------------------------------------------===*/

#ifndef OPERATOR_H
#define OPERATOR_H

#include "Cloud.h"

class Operator {
public:
	Cloud * const cloud;
	Operator(Cloud * const myCloud) : cloud(myCloud) {}
	virtual ~Operator() {}

	virtual void operation1(const double currentTime)=0;
	virtual void operation2(const double currentTime)=0;
	virtual void operation3(const double currentTime)=0;
	virtual void operation4(const double currentTime)=0;
};

#endif // OPERATOR_H

/*===- Operator.h - libSimulation -=============================================
*
*                                  DEMON
*
* This file is distributed under the BSD Open Source License. See LICENSE.TXT
* for details.
*
*===-----------------------------------------------------------------------===*/

#ifndef OPERATOR_H
#define OPERATOR_H

#include "Cloud.h"

typedef unsigned int operator_index;

class Operator {
public:
	Cloud * const cloud;
	Operator(Cloud * const myCloud) : cloud(myCloud) {}
	virtual ~Operator() {}

	virtual void operation1(const double currentTime)=0;
	virtual void operation2(const double currentTime)=0;
	virtual void operation3(const double currentTime)=0;
	virtual void operation4(const double currentTime)=0;
};

#endif // OPERATOR_H

Add typedef to number of operators. This will help inside code to distinguish from counting particles, forces or operators.


/* $Id$ $Revision$ */
/* vim:set shiftwidth=4 ts=8: */

/**********************************************************
*      This software is part of the graphviz package      *
*                http://www.graphviz.org/                 *
*                                                         *
*            Copyright (c) 1994-2004 AT&T Corp.           *
*                and is licensed under the                *
*            Common Public License, Version 1.0           *
*                      by AT&T Corp.                      *
*                                                         *
*        Information and Software Systems Research        *
*              AT&T Research, Florham Park NJ             *
**********************************************************/

#ifndef FILTER_H
#define FILTER_H
#include "btree.h"

typedef struct _tv_filters
{
	tv_filter** filters;
	int filter_count;
}tv_filters;

int clear_filter(tv_filter* f);
int init_filters(tv_filters* filters);
int add_filter_to_filters(tv_filters* filters,tv_filter* filter);
int clear_filters(tv_filters* filters);
int union_filter(tv_filter* f1,tv_filter* f2);
int intersect_filter(tv_filter* f1,tv_filter* f2);

#endif

/* $Id$ $Revision$ */
/* vim:set shiftwidth=4 ts=8: */

/**********************************************************
*      This software is part of the graphviz package      *
*                http://www.graphviz.org/                 *
*                                                         *
*            Copyright (c) 1994-2004 AT&T Corp.           *
*                and is licensed under the                *
*            Common Public License, Version 1.0           *
*                      by AT&T Corp.                      *
*                                                         *
*        Information and Software Systems Research        *
*              AT&T Research, Florham Park NJ             *
**********************************************************/

#ifndef FILTER_H
#define FILTER_H
#include "btree.h"

typedef struct _tv_filters {
    tv_filter **filters;
    int filter_count;
} tv_filters;

int clear_filter(tv_filter * f);
int init_filters(tv_filters * filters);
int add_filter_to_filters(tv_filters * filters, tv_filter * filter);
int clear_filters(tv_filters * filters);
int union_filter(tv_filter * f1, tv_filter * f2);
int intersect_filter(tv_filter * f1, tv_filter * f2);

#endif

Clean up smyrna files: remove unnecessary globals modify libraries not to rely on code in cmd/smyrna remove static declarations from .h files remove unnecessary libraries mark unused code and clean up warnings


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

#include "cem/rocks.h"

static void test_set_rock_blocks(void) {
  const int shape[2] = {10, 20};
  double **z = (double**)malloc(sizeof(double*) * shape[0]);
  char **rock_type = (char**)malloc(sizeof(char*) * shape[0]);
  int i;
  char expected[20] = {
    'f', 'f', 's', 's', 's',
    'f', 'f', 's', 's', 's', 'f', 'f', 's', 's', 's',
    'f', 'f', 's', 's', 's'
  };

  z[0] = (double*)malloc(sizeof(double) * shape[0] * shape[1]);
  rock_type[0] = (char*)malloc(sizeof(char) * shape[0] * shape[1]);
  for (i=1; i < shape[0]; i++) {
    z[i] = z[i-1] + shape[1];
    rock_type[i] = rock_type[i-1] + shape[1];
  }

  set_rock_blocks(rock_type, z, shape[0], shape[1], 2);

  for (i=0; i < shape[0]; i++)
    g_assert_cmpmem(rock_type[i], shape[1], expected, shape[1]);

  free(rock_type[0]);
  free(rock_type);
  free(z[0]);
  free(z);
}

int main(int argc, char* argv[]) {
  g_test_init(&argc, &argv, NULL);
  g_test_add_func("/cem/rocks/set_blocks", &test_set_rock_blocks);

  return g_test_run();
}

Add unit tests for rocks.c.

Add unit tests for rocks.c.


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

#include "../marquise.h"

void test_hash_identifier() {
	const char *id = "hostname:fe1.example.com,metric:BytesUsed,service:memory,";
	size_t id_len = strlen(id);
	uint64_t address = marquise_hash_identifier(id, id_len);
	g_assert_cmpint(address, ==, 7602883380529707052);
}

int main(int argc, char **argv) {
	g_test_init(&argc, &argv, NULL);
	g_test_add_func("/marquise_hash_identifier/hash", test_hash_identifier);
	return g_test_run();
}

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

#include "../marquise.h"

void test_hash_identifier() {
	const char *id = "hostname:fe1.example.com,metric:BytesUsed,service:memory,";
	size_t id_len = strlen(id);
	uint64_t address = marquise_hash_identifier((const unsigned char*) id, id_len);
	g_assert_cmpint(address, ==, 7602883380529707052);
}

int main(int argc, char **argv) {
	g_test_init(&argc, &argv, NULL);
	g_test_add_func("/marquise_hash_identifier/hash", test_hash_identifier);
	return g_test_run();
}

Make a pointer-signedness warning in testing magically disappear~


#ifndef __RSImg_h__
#define __RSImg_h__

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

extern "C" int RSImgFreadPPMP6Header(FILE *file, uint32_t *width, uint32_t *height, uint32_t *headerSize);

#endif

Add a header for use from C++

Add a header for use from C++


#ifndef http_h
#define http_h

typedef struct http_context_s http_context;
typedef struct http_session_s http_session;
typedef struct http_request_s http_request;

/*
 * A Context is bound to a collection of sessions and
 * ongoing requests. Each thread in a process should have its
 * own Context to avoid deadlocks and conflicts.
 */
http_context* http_context_create();
void http_context_release(http_context* ctx);

/*
 * A session represents an active communication line to a server.
 * One or more network sockets may be open to the server to
 * fulfill requests. Pipelining will be used if supported by server.
 */
http_session* http_session_open(http_context* ctx, const char* host, int port);
void http_session_close(http_session* session);

http_request* http_request_create(http_session* session, const char* path, http_method method);
http_request* http_request_get(http_session* session, const char* path);
http_request* http_request_post(http_session* session, const char* path);

#endif

Add primary header with initial API draft.


//codigo para hecer pruebas de como funciona github.
//programa simple que suma, resta, multiplica y divide numeros ingresador por pantalla.

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

void sumar(int a, int b);
void restar(int a,int b);

int main() {

    int a,b;
	printf("Bienvenido... Ingrese 2 numeros");
    printf ("Primer numero: ");   scanf ("%d",&a);
    printf ("Segundo numero: ");  scanf ("%d",&b);
    sumar(a,b);
	restar(a,b);

    //implementar resta, multiplicacion, division

    return (EXIT_SUCCESS);
}
void restar(int a,int b){
	printf("La resta es: %d",a-b);
}
void sumar(int a, int b){
     printf ("La suma es: %d",a+b);
}

//codigo para hecer pruebas de como funciona github.
//programa simple que suma, resta, multiplica y divide numeros ingresador por pantalla.

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

void sumar(int a, int b);
void restar(int a,int b);

int main() {

    int a,b;
    printf ("Primer numero: ");   scanf ("%d",&a);
    printf ("Segundo numero: ");  scanf ("%d",&b);
    sumar(a,b);
	restar(a,b);

    //implementar resta, multiplicacion, division

    return (EXIT_SUCCESS);
}
void restar(int a,int b){
	print("La resta es: %d",a-b);
}
void sumar(int a, int b){
     printf ("La suma es: %d",a+b);
}

Revert "Corregido Error en Funcion restar"

This reverts commit d8e984f0ea7d12526e1069292ed85025178d8d67.


#ifndef SRC_CONFIG_H_S6A1C09K
#define SRC_CONFIG_H_S6A1C09K

/* package name */
#define PACKAGE "pianobar"

#define VERSION "2014.06.08-dev"

/* ffmpeg/libav quirks detection
 * ffmpeg’s micro versions always start at 100, that’s how we can distinguish
 * ffmpeg and libav */
#include <libavfilter/version.h>

/* is "timeout" option present (all versions of ffmpeg, not libav) */
#if LIBAVFILTER_VERSION_MICRO >= 100
#define HAVE_AV_TIMEOUT
#endif

/* does graph_send_command exist (ffmpeg >=2.2) */
#if LIBAVFILTER_VERSION_MAJOR == 4 && \
		LIBAVFILTER_VERSION_MICRO >= 100
#define HAVE_AVFILTER_GRAPH_SEND_COMMAND
#endif

/* need avcodec.h (ffmpeg 1.2) */
#if LIBAVFILTER_VERSION_MAJOR == 3 && \
		LIBAVFILTER_VERSION_MINOR <= 42 && \
		LIBAVFILTER_VERSION_MINOR > 32 && \
		LIBAVFILTER_VERSION_MICRO >= 100
#define HAVE_AV_BUFFERSINK_GET_BUFFER_REF
#define HAVE_LIBAVFILTER_AVCODEC_H
#endif

#endif /* SRC_CONFIG_H_S6A1C09K */

#ifndef SRC_CONFIG_H_S6A1C09K
#define SRC_CONFIG_H_S6A1C09K

/* package name */
#define PACKAGE "pianobar"

#define VERSION "2014.06.08-dev"

/* ffmpeg/libav quirks detection
 * ffmpeg’s micro versions always start at 100, that’s how we can distinguish
 * ffmpeg and libav */
#include <libavfilter/version.h>

/* is "timeout" option present (all versions of ffmpeg, not libav) */
#if LIBAVFILTER_VERSION_MICRO >= 100
#define HAVE_AV_TIMEOUT
#endif

/* does graph_send_command exist (ffmpeg >=2.2) */
#if LIBAVFILTER_VERSION_MAJOR >= 4 && \
		LIBAVFILTER_VERSION_MICRO >= 100
#define HAVE_AVFILTER_GRAPH_SEND_COMMAND
#endif

/* need avcodec.h (ffmpeg 1.2) */
#if LIBAVFILTER_VERSION_MAJOR == 3 && \
		LIBAVFILTER_VERSION_MINOR <= 42 && \
		LIBAVFILTER_VERSION_MINOR > 32 && \
		LIBAVFILTER_VERSION_MICRO >= 100
#define HAVE_AV_BUFFERSINK_GET_BUFFER_REF
#define HAVE_LIBAVFILTER_AVCODEC_H
#endif

#endif /* SRC_CONFIG_H_S6A1C09K */

Fix volume control with ffmpeg 2.3

Fix volume control with ffmpeg 2.3


//
//  BFTaskCenter.h
//  Pods
//
//  Created by Superbil on 2015/8/22.
//
//

#import "Bolts.h"

@interface BFTaskCenter : NSObject

/*!
 A block that can act as a continuation for a task.
 */
typedef void (^BFTaskCenterBlock)(BFTask * _Nonnull task);

+ (nonnull instancetype)defaultCenter;

- (instancetype)initWithExecutor:(BFExecutor *)executor;

- (nullable id)addTaskBlockToCallbacks:(nonnull BFTaskCenterBlock)taskBlock forKey:(nonnull NSString *)key;
- (void)removeTaskBlock:(nonnull id)taskBlock forKey:(nonnull NSString *)key;
- (void)clearAllCallbacksForKey:(nonnull NSString *)key;

- (void)sendToCallbacksWithKey:(nonnull NSString *)key result:(nullable id)result;
- (void)sendToCallbacksWithKey:(nonnull NSString *)key error:(nonnull NSError *)error;

- (nullable BFTaskCompletionSource *)sourceOfSendToCallbacksForKey:(nonnull NSString *)key
                                                          executor:(nonnull BFExecutor *)executor
                                                 cancellationToken:(nullable BFCancellationToken *)cancellationToken;

@end

//
//  BFTaskCenter.h
//  Pods
//
//  Created by Superbil on 2015/8/22.
//
//

#import "Bolts.h"

NS_ASSUME_NONNULL_BEGIN

@interface BFTaskCenter : NSObject

/*!
 A block that can act as a continuation for a task.
 */
typedef void (^BFTaskCenterBlock)(BFTask * _Nonnull task);

+ (instancetype)defaultCenter;

- (instancetype)initWithExecutor:(nonnull BFExecutor *)executor;

- (nullable id)addTaskBlockToCallbacks:(nonnull BFTaskCenterBlock)taskBlock forKey:(nonnull NSString *)key;
- (void)removeTaskBlock:(nonnull id)taskBlock forKey:(nonnull NSString *)key;
- (void)clearAllCallbacksForKey:(nonnull NSString *)key;

- (void)sendToCallbacksWithKey:(nonnull NSString *)key result:(nullable id)result;
- (void)sendToCallbacksWithKey:(nonnull NSString *)key error:(nonnull NSError *)error;

- (nullable BFTaskCompletionSource *)sourceOfSendToCallbacksForKey:(nonnull NSString *)key
                                                          executor:(nonnull BFExecutor *)executor
                                                 cancellationToken:(nullable BFCancellationToken *)cancellationToken;

@end

NS_ASSUME_NONNULL_END

Fix compiler warning for nullable check

Fix compiler warning for nullable check


#pragma once

#include "cal3d/global.h"
#include "cal3d/vector.h"

typedef unsigned long CalColor32; // 32-bit integer, compatible with NSPR

inline CalColor32 CalMakeColor(CalVector cv) {
    return
      ( ( unsigned int ) ( cv.z * 0xff ) << 0) +
      ( ( ( unsigned int ) ( cv.y * 0xff ) ) << 8 ) +
      ( ( ( unsigned int ) ( cv.x * 0xff ) ) << 16 ) +
      0xff000000;
}

inline CalVector CalVectorFromColor(CalColor32 color) {
    return CalVector(
        ((color >> 16) & 0xff) / float(0xff),
        ((color >> 8) & 0xff) / float(0xff),
        ((color >> 0) & 0xff) / float(0xff));
}

#pragma once

#include "cal3d/global.h"
#include "cal3d/vector.h"

typedef unsigned int CalColor32; // 32-bit integer, compatible with NSPR

inline CalColor32 CalMakeColor(CalVector cv) {
    return
      ( ( unsigned int ) ( cv.z * 0xff ) << 0) +
      ( ( ( unsigned int ) ( cv.y * 0xff ) ) << 8 ) +
      ( ( ( unsigned int ) ( cv.x * 0xff ) ) << 16 ) +
      0xff000000;
}

inline CalVector CalVectorFromColor(CalColor32 color) {
    return CalVector(
        ((color >> 16) & 0xff) / float(0xff),
        ((color >> 8) & 0xff) / float(0xff),
        ((color >> 0) & 0xff) / float(0xff));
}

Unify and simplify a lot of pixomatic code

git-svn-id: febc42a3fd39fb08e5ae2b2182bc5ab0a583559c@51002 07c76cb3-cb09-0410-85de-c24d39f1912e


/** @file
  This file defines the data structures that are architecturally defined for file
  images loaded via the FirmwareVolume protocol.  The Firmware Volume specification
  is the basis for these definitions.

  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:  FrameworkFimrwareVolumeImageFormat.h

  @par Revision Reference:
  These definitions are from Firmware Volume Spec 0.9.

**/

#ifndef __FRAMEWORK_FIRMWARE_VOLUME_IMAGE_FORMAT_H__
#define __FRAMEWORK_FIRMWARE_VOLUME_IMAGE_FORMAT_H__

//
// Bit values for AuthenticationStatus
//
#define EFI_AGGREGATE_AUTH_STATUS_PLATFORM_OVERRIDE 0x000001
#define EFI_AGGREGATE_AUTH_STATUS_IMAGE_SIGNED      0x000002
#define EFI_AGGREGATE_AUTH_STATUS_NOT_TESTED        0x000004
#define EFI_AGGREGATE_AUTH_STATUS_TEST_FAILED       0x000008
#define EFI_AGGREGATE_AUTH_STATUS_ALL               0x00000f

#define EFI_LOCAL_AUTH_STATUS_PLATFORM_OVERRIDE     0x010000
#define EFI_LOCAL_AUTH_STATUS_IMAGE_SIGNED          0x020000
#define EFI_LOCAL_AUTH_STATUS_NOT_TESTED            0x040000
#define EFI_LOCAL_AUTH_STATUS_TEST_FAILED           0x080000
#define EFI_LOCAL_AUTH_STATUS_ALL                   0x0f0000

#endif

Add some definitions in Framework FV 0.9 spec but not in PI 1.0.

git-svn-id: 5648d1bec6962b0a6d1d1b40eba8cf5cdb62da3d@2901 6f19259b-4bc3-4df7-8a09-765794883524


#ifndef __YANIMATED__
#define __YANIMATED__

typedef struct YFrame
{
	int current;
	int first;
	int last;
	int width;
	int height;
	int fps;
	YFrame(){};
	YFrame(int a_current,
		   int a_first,
		   int a_last,
		   int a_width,
		   int a_height,
		   int a_fps):
		   current(a_current),
		   first(a_first),
		   last(a_last),
		   width(a_width),
		   height(a_height),
		   fps(a_fps){};
} YFrame;

#endif /** __YANIMATED__ **/

#ifndef __YANIMATED__
#define __YANIMATED__

/*!
  Store animation frame indexes
*/
typedef struct YFrame
{
	//! Default Constructor
	YFrame(): current(0),
			  first(0),
			  last(0){};
	//! Constructor with parameters
	/*!
	  \param Current animation frame index
	  \param First animation frame index
	  \param Last animation frame index
	*/
	YFrame(int a_current,
		   int a_first,
		   int a_last):
		   current(a_current),
		   first(a_first),
		   last(a_last){};
	int current; //! Current frame index
	int first; //! First frame index
	int last; //! Last frame index
} YFrame;

#endif /** __YANIMATED__ **/

Remove width, height and fps variable from YFrame struct


/*
 * Use and distribution licensed under the Apache license version 2.
 *
 * See the COPYING file in the root project directory for full text.
 */

#ifndef SQLTOAST_DATA_TYPE_H
#define SQLTOAST_DATA_TYPE_H

namespace sqltoast {

typedef enum data_type {
    DATA_TYPE_CHAR,
    DATA_TYPE_VARCHAR,
    DATA_TYPE_NCHAR,
    DATA_TYPE_VARNCHAR,
    DATA_TYPE_BIT,
    DATA_TYPE_VARBIT,
    DATA_TYPE_NUMERIC,
    DATA_TYPE_DECIMAL,
    DATA_TYPE_INT,
    DATA_TYPE_SMALLINT,
    DATA_TYPE_FLOAT,
    DATA_TYPE_DOUBLE,
    DATA_TYPE_DATE,
    DATA_TYPE_TIME,
    DATA_TYPE_TIMESTAMP,
    DATA_TYPE_INTERVAL
} data_type_t;

} // namespace sqltoast

#endif /* SQLTOAST_DATA_TYPE_H */

Add standard ANSI-92 data types

Add standard ANSI-92 data types


#ifndef BITCOIN_TIMESTAMPS_H
#define BITCOIN_TIMESTAMPS_H

static const unsigned int ENTROPY_SWITCH_TIME = 1362791041; // Sat, 09 Mar 2013 01:04:01 GMT
static const unsigned int STAKE_SWITCH_TIME = 1371686400; // Thu, 20 Jun 2013 00:00:00 GMT
static const unsigned int TARGETS_SWITCH_TIME = 1374278400; // Sat, 20 Jul 2013 00:00:00 GMT
static const unsigned int CHAINCHECKS_SWITCH_TIME = 1379635200; // Fri, 20 Sep 2013 00:00:00 GMT
static const unsigned int STAKECURVE_SWITCH_TIME = 1382227200; // Sun, 20 Oct 2013 00:00:00 GMT
static const unsigned int FEE_SWITCH_TIME = 1405814400; // Sun, 20 Jul 2014 00:00:00 GMT

static const unsigned int VALIDATION_SWITCH_TIME = 1408492800; // Wed, 20 Aug 2014 00:00:00 GMT

#endif

#ifndef BITCOIN_TIMESTAMPS_H
#define BITCOIN_TIMESTAMPS_H

static const unsigned int ENTROPY_SWITCH_TIME = 1362791041; // Sat, 09 Mar 2013 01:04:01 GMT
static const unsigned int STAKE_SWITCH_TIME = 1371686400; // Thu, 20 Jun 2013 00:00:00 GMT
static const unsigned int TARGETS_SWITCH_TIME = 1374278400; // Sat, 20 Jul 2013 00:00:00 GMT
static const unsigned int CHAINCHECKS_SWITCH_TIME = 1379635200; // Fri, 20 Sep 2013 00:00:00 GMT
static const unsigned int STAKECURVE_SWITCH_TIME = 1382227200; // Sun, 20 Oct 2013 00:00:00 GMT
static const unsigned int FEE_SWITCH_TIME = 1405814400; // Sun, 20 Jul 2014 00:00:00 GMT

static const unsigned int VALIDATION_SWITCH_TIME = 1408492800; // Wed, 20 Aug 2014 00:00:00 GMT
static const unsigned int SIG_SWITCH_TIME = 1411171200; // Sat, 20 Sep 2014 00:00:00 GMT

#endif

Add SIG_SWITCH_TIME at Sat, 20 Sep 2014

Add SIG_SWITCH_TIME at Sat, 20 Sep 2014


// Copyright (c) 2009-2010 Satoshi Nakamoto
// Copyright (c) 2009-2015 The Bitcoin Core developers
// Copyright (c) 2014-2017 The Dash Core developers
// Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.

#ifndef BITCOIN_VALIDATION_H
#define BITCOIN_VALIDATION_H

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

static const int64_t DEFAULT_MAX_TIP_AGE = 1 * 60 * 60; // ~45 blocks behind -> 2 x fork detection time, was 24 * 60 * 60 in bitcoin

extern int64_t nMaxTipAge;

class CBlockIndex;

FILE* OpenBlockFile(unsigned int nFile, unsigned int nBlockPos, const char* pszMode="rb");
FILE* AppendBlockFile(unsigned int& nFileRet);

bool IsInitialBlockDownload();

/** Guess verification progress (as a fraction between 0.0=genesis and 1.0=current tip). */
double GuessVerificationProgress(CBlockIndex* pindex);

#endif // BITCOIN_VALIDATION_H

// Copyright (c) 2009-2010 Satoshi Nakamoto
// Copyright (c) 2009-2015 The Bitcoin Core developers
// Copyright (c) 2014-2017 The Dash Core developers
// Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.

#ifndef BITCOIN_VALIDATION_H
#define BITCOIN_VALIDATION_H

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

static const int64_t DEFAULT_MAX_TIP_AGE = 120; // ~45 blocks behind -> 2 x fork detection time, was 24 * 60 * 60 in bitcoin

extern int64_t nMaxTipAge;

class CBlockIndex;

FILE* OpenBlockFile(unsigned int nFile, unsigned int nBlockPos, const char* pszMode="rb");
FILE* AppendBlockFile(unsigned int& nFileRet);

bool IsInitialBlockDownload();

/** Guess verification progress (as a fraction between 0.0=genesis and 1.0=current tip). */
double GuessVerificationProgress(CBlockIndex* pindex);

#endif // BITCOIN_VALIDATION_H

Update default max tip age

Update default max tip age


//===-- xray_emulate_tsc.h --------------------------------------*- C++ -*-===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
//
// This file is a part of XRay, a dynamic runtime instrumentation system.
//
//===----------------------------------------------------------------------===//
#ifndef XRAY_EMULATE_TSC_H
#define XRAY_EMULATE_TSC_H

#include "sanitizer_common/sanitizer_internal_defs.h"
#include "xray_defs.h"
#include <cstdint>
#include <time.h>

namespace __xray {

static constexpr uint64_t NanosecondsPerSecond = 1000ULL * 1000 * 1000;

ALWAYS_INLINE uint64_t readTSC(uint8_t &CPU) XRAY_NEVER_INSTRUMENT {
  timespec TS;
  int result = clock_gettime(CLOCK_REALTIME, &TS);
  if (result != 0) {
    Report("clock_gettime(2) returned %d, errno=%d.", result, int(errno));
    TS.tv_sec = 0;
    TS.tv_nsec = 0;
  }
  CPU = 0;
  return TS.tv_sec * NanosecondsPerSecond + TS.tv_nsec;
}
}

#endif // XRAY_EMULATE_TSC_H

//===-- xray_emulate_tsc.h --------------------------------------*- C++ -*-===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
//
// This file is a part of XRay, a dynamic runtime instrumentation system.
//
//===----------------------------------------------------------------------===//
#ifndef XRAY_EMULATE_TSC_H
#define XRAY_EMULATE_TSC_H

#include "sanitizer_common/sanitizer_internal_defs.h"
#include "xray_defs.h"
#include <cerrno>
#include <cstdint>
#include <time.h>

namespace __xray {

static constexpr uint64_t NanosecondsPerSecond = 1000ULL * 1000 * 1000;

ALWAYS_INLINE uint64_t readTSC(uint8_t &CPU) XRAY_NEVER_INSTRUMENT {
  timespec TS;
  int result = clock_gettime(CLOCK_REALTIME, &TS);
  if (result != 0) {
    Report("clock_gettime(2) returned %d, errno=%d.", result, int(errno));
    TS.tv_sec = 0;
    TS.tv_nsec = 0;
  }
  CPU = 0;
  return TS.tv_sec * NanosecondsPerSecond + TS.tv_nsec;
}
}

#endif // XRAY_EMULATE_TSC_H

Fix missing include of <cerrno>

[XRay][compiler-rt] Fix missing include of <cerrno>

Futher attempt to un-break ARM and AArch64 build.

Follow-up on D25360.

git-svn-id: c199f293c43da69278bea8e88f92242bf3aa95f7@290083 91177308-0d34-0410-b5e6-96231b3b80d8


/*
 * Copyright (C) 2000  Internet Software Consortium.
 *
 * Permission to use, copy, modify, and distribute this software for any
 * purpose with or without fee is hereby granted, provided that the above
 * copyright notice and this permission notice appear in all copies.
 *
 * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS
 * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
 * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE
 * CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
 * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
 * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
 * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
 * SOFTWARE.
 */

#include <stdio.h>
#include <sys/socket.h>
#include <lwres/netdb.h>

static void
print_he(struct hostent *he, int error, const char *fun, const char *name) {
	char **c;
	int i;

	if (he != NULL) {
		 printf("%s(%s):\n", fun, name);
		 printf("\tname = %s\n", he->h_name);
		 printf("\taddrtype = %d\n", he->h_addrtype);
		 printf("\tlength = %d\n", he->h_length);
		 c = he->h_aliases;
		 i = 1;
		 while (*c != NULL) {
			printf("\talias[%d] = %s\n", i, *c);
			i++;
			c++;
		 }
		 c = he->h_addr_list;
		 i = 1;
		 while (*c != NULL) {
			char buf[128];
			inet_ntop(he->h_addrtype, c, buf, sizeof (buf));
			printf("\taddress[%d] = %s\n", i, buf);
			c++;
			i++;
		}
	} else {
		printf("%s(%s): error = %d\n", fun, name, error);
	}
}

int
main(int argc, char **argv) {
	struct hostent *he;
	char **c;
	int error;

	while (argv[1] != NULL) {
		he = gethostbyname(argv[1]);
		print_he(he, 0 /* XXX h_errno */, "gethostbyname", argv[1]);

		he = getipnodebyname(argv[1], AF_INET, AI_DEFAULT|AI_ALL,
				     &error);
		print_he(he, error, "getipnodebyname", argv[1]);
		if (he != NULL)
			freehostent(he);
		argv++;
	}
	exit(0);
}

Test getipnodebyname() & gethostbyname() implementations.


// RUN: %clang -target i386-unknown-unknown -static -dM -E -o - %s \
// RUN:   | FileCheck --check-prefix=CHECK-STATIC %s
// CHECK-STATIC-NOT: #define __PIC__
// CHECK-STATIC-NOT: #define __pic__
// RUN: %clang -target i386-unknown-unknown -fpic -dM -E -o - %s \
// RUN:   | FileCheck --check-prefix=CHECK-LOWERPIC %s
// CHECK-LOWERPIC: #define __PIC__ 1
// CHECK-LOWERPIC: #define __pic__ 1
// RUN: %clang -target i386-unknown-unknown -fPIC -dM -E -o - %s \
// RUN:   | FileCheck --check-prefix=CHECK-UPPERPIC %s
// CHECK-UPPERPIC: #define __PIC__ 2
// CHECK-UPPERPIC: #define __pic__ 2

// RUN: %clang_cc1 -dM -E -o - %s \
// RUN:   | FileCheck %s
// CHECK-NOT: #define __PIC__
// CHECK-NOT: #define __pic__
// RUN: %clang_cc1 -pic-level 1 -dM -E -o - %s \
// RUN:   | FileCheck --check-prefix=CHECK-PIC1 %s
// CHECK-PIC1: #define __PIC__ 1
// CHECK-PIC1: #define __pic__ 1
// RUN: %clang_cc1 -pic-level 2 -dM -E -o - %s \
// RUN:   | FileCheck --check-prefix=CHECK-PIC2 %s
// CHECK-PIC2: #define __PIC__ 2
// CHECK-PIC2: #define __pic__ 2

Rephrase the preprocessor test to directly use CC1 and not bother
testing any of the strange driver behavior. We already have some tiny
tests for the driver behavior, and I'm going to expand them greatly in
the next commit.

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


// Compile with:
// $ gcc -Wall -Werror -o putc_example putc_example.c
//
// 1. Warm up: Make the program print out the string backwards
// 2. $ rm -f putc_example  (remove the compiled program)
//    Comment out all of the #include headers in this file and re-run the
//    compile command.  You should see warnings, and no ouput file is generated.
//    Try to get the program to compile/generate an output file without
//    adding the include files back in.  (There are two different ways that
//    I can think of to do this).
// 3. In C, arrays and pointers are the same thing.  Rewrite the "loop"
//    section below using pointers instead of arrays (ie, dont use the [ ]
//    syntax).
//    See: http://www.google.com/search?q=c+pointers+arrays

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

int main(int argc, char* argv[]) {
  if (argc != 2) {
    printf("Usage: %s <string>\n", argv[0]);
    return 0;
  }

  // This code is equivalent to printf("%s\n", argv[1]);
  const char* string_argument = argv[1];
  int length = strlen(string_argument);
  int i;
  for (i = 0; i < length; i++) {
    char c = string_argument[i];
    putchar(c);
  }
  putchar('\n');

  return 0;
}

// Compile with:
// $ gcc -Wall -Werror -o putc_example putc_example.c
//
// 1. Warm up: Make the program print out the string backwards
// 2. $ rm -f putc_example  (remove the compiled program)
//    Comment out all of the #include headers in this file and re-run the
//    compile command.  You should see warnings, and no ouput file is generated.
//    Try to get the program to compile/generate an output file without
//    adding the include files back in.  (There are two different ways that
//    I can think of to do this).
// 3. In C, arrays and pointers are the same thing.  Rewrite the "loop"
//    section below using pointers instead of arrays (ie, dont use the [ ]
//    syntax).
//    See: http://www.google.com/search?q=c+pointers+arrays

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

int main(int argc, char* argv[]) {
  if (argc != 2) {
    printf("Usage: %s <string>\n", argv[0]);
    return 0;
  }

  // This code is equivalent to printf("%s\n", argv[1]);
  const char* string_argument = argv[1];
  size_t length = strlen(string_argument);
  int i;
  for (i = 0; i < length; i++) {
    char c = string_argument[i];
    putchar(c);
  }
  putchar('\n');

  return 0;
}

Use size_t for strlen result, so it matches the man page.


#ifndef FILE_UTILS_H
#define FILE_UTILS_H

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

#define PATHLEN 32
#define MAXPATH 1024

#define PROC "/proc/"

#define MEMINFO "/proc/meminfo"
#define STATUS "/proc/%s/status"

#define IO_STAT "/proc/%s/io"

#define STAT "/proc/%s/stat"
#define STAT_BUFFER 4096

#define COMM "/proc/%s/comm"
#define COMM_LEN strlen(COMM)

#define FD "/proc/%s/fd"

#define UID "Uid:\t"

char *parse_stat(char *pid, int field);

char *parse_proc(char *path, char *field);

int is_pid(const struct dirent *directory);

char *strip(char *stat);

char *calculate_size(char *field_total, int byte_idx);

uint64_t value_from_string(char *ps_field_value);

#endif

#ifndef FILE_UTILS_H
#define FILE_UTILS_H

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

#define PATHLEN 32
#define MAXPATH 1024
#define PROC_SIZE 1024

#define PROC "/proc/"

#define MEMINFO "/proc/meminfo"
#define STATUS "/proc/%s/status"

#define IO_STAT "/proc/%s/io"

#define STAT "/proc/%s/stat"
#define STAT_BUFFER 4096

#define COMM "/proc/%s/comm"
#define COMM_LEN strlen(COMM)

#define FD "/proc/%s/fd"

#define UID "Uid:\t"

char *parse_stat(char *pid, int field);

char *parse_proc(char *path, char *field);

int is_pid(const struct dirent *directory);

char *strip(char *stat);

char *calculate_size(char *field_total, int byte_idx);

uint64_t value_from_string(char *ps_field_value);

#endif

Define macro for size of proc parser

Define macro for size of proc parser


//
//  UIAlertView+RACCommandSupport.h
//  ReactiveCocoa
//
//  Created by Henrik Hodne on 6/16/13.
//  Copyright (c) 2013 GitHub, Inc. All rights reserved.
//

#import <UIKit/UIKit.h>

@class RACCommand;

@interface UIAlertView (RACCommandSupport)

// Sets the alert view's command. When a button on the alert view is pressed,
// the command is executed with the index of the button that was pressed.
@property (nonatomic, strong) RACCommand *rac_command;

@end

//
//  UIAlertView+RACCommandSupport.h
//  ReactiveCocoa
//
//  Created by Henrik Hodne on 6/16/13.
//  Copyright (c) 2013 GitHub, Inc. All rights reserved.
//

#import <UIKit/UIKit.h>

@class RACCommand;

@interface UIAlertView (RACCommandSupport)

// Sets the alert view's command. When a button on the alert view is pressed,
// the command is executed with the index of the button that was pressed.
//
// This will override the alert view's delegate, so you can't use this together
// with a custom delegate.
@property (nonatomic, strong) RACCommand *rac_command;

@end

Document that UIAlertView.rac_command overrides the delegate


// RUN: clang-cc -fsyntax-only -fixit-at=fixit-at.c:3:1 %s -o - | clang-cc -verify -x c -

_Complex cd;

int i0 = { 17 }; // expected-warning{{braces}}

// RUN: clang-cc -fsyntax-only -fixit-at=fixit-at.c:3:1 %s -o - | clang-cc -verify -x c -

_Complex cd;

int i0[1] = { { 17 } }; // expected-warning{{braces}}

Update test case; I'm confused why this wasn't failing on the buildbot
though?

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


//
//  HTMLKit.h
//  HTMLKit
//
//  Created by Iska on 15/09/14.
//  Copyright (c) 2014 BrainCookie. All rights reserved.
//

#import <Foundation/Foundation.h>

//! Project version number for HTMLKit.
extern double HTMLKitVersionNumber;

//! Project version string for HTMLKit.
extern const unsigned char HTMLKitVersionString[];

#import "HTMLDOM.h"
#import "HTMLParser.h"
#import "HTMLKitErrorDomain.h"
#import "HTMLOrderedDictionary.h"

#import "CSSSelectors.h"
#import "CSSSelectorParser.h"
#import "CSSNthExpressionParser.h"

#import "NSString+HTMLKit.h"
#import "NSCharacterSet+HTMLKit.h"

Add imports for the public categories in the umbrella header


#ifndef JOINABLE_IMPL
#define JOINABLE_IMPL

#include "joinable_types.h"
#include "types/MediaObjectImpl.h"

using ::com::kurento::kms::api::Joinable;
using ::com::kurento::kms::api::Direction;
using ::com::kurento::kms::api::StreamType;

namespace com { namespace kurento { namespace kms {

class JoinableImpl : public virtual Joinable, public virtual MediaObjectImpl {
public:
	JoinableImpl();
	~JoinableImpl() throw() {};

	std::vector<StreamType::type> getStreams(const Joinable& joinable);

	void join(const JoinableImpl& to, const Direction::type direction);
	void unjoin(const JoinableImpl& to);

	void join(const JoinableImpl& to, const StreamType::type stream, const Direction::type direction);
	void unjoin(const JoinableImpl& to, const StreamType::type stream);

	std::vector<Joinable> &getJoinees();
	std::vector<Joinable> &getDirectionJoiness(const Direction::type direction);

	std::vector<Joinable> &getJoinees(const StreamType::type stream);
	std::vector<Joinable> &getDirectionJoiness(const StreamType::type stream, const Direction::type direction);
};

}}} // com::kurento::kms

#endif /* JOINABLE_IMPL */

Add new line at end of file

Add new line at end of file


// SKIP PARAM: --set ana.activated[+] apron
extern int __VERIFIER_nondet_int();

#include <pthread.h>
#include <assert.h>

int g = 5;
int h = 5;
pthread_mutex_t m = PTHREAD_MUTEX_INITIALIZER;

void *t_fun(void *arg) {
  return NULL;
}

int main() {
  int r = __VERIFIER_nondet_int();
  pthread_t id;

  if (r) {
    pthread_create(&id, NULL, t_fun, NULL);
  }
  else {
    h = 10;
  }
  // sync join needs to publish globals also to protected/mutex_inits like enter_multithreaded
  // might need join strengthening to reveal unsoundness instead of going to top directly

  pthread_mutex_lock(&m);
  assert(g == h); // UNKNOWN!
  pthread_mutex_unlock(&m);

  return 0;
}

Add Apron branched thread creation privatization test, where protected is unsound


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

#import "OpenMRSAPIManager.h"
#import "LocationListTableViewController.h"
#import "UIAlertView+Blocks.h"
#import "MRSHelperFunctions.h"

Add MRSHelper functions to Bridging Header


//! \file CommandLineParser.h

#ifndef _COMMANDLINEPARSER_H
#define _COMMANDLINEPARSER_H

#include <string>

//! Abstract base class for parsing command line arguments
class CommandLineParser
{
public:
    /*! Parses command line args and stores results internally.
     * May throw an exception in case of error
     * \param argc number of arguments
     * \param argv arguments as passed to main
     */
    virtual void parse(int argc, char** argv) = 0;

    /*! Query whether a specific flag was set on command line.
     * \param flag Command line switch without leading dash
     * \return whether specified flag was set on command line
     */
    virtual bool hasSet(std::string flag) = 0;

    /*! get argument of switch (if available)
     * \param option command line switch without leading dash
     * \returns value as string
    */
    virtual std::string getValue(std::string option) = 0;

    /*! Print usage help
     */
    virtual void printHelp() = 0;
};

#endif // _COMMANDLINEPARSER_H

//! \file CommandLineParser.h

#ifndef _COMMANDLINEPARSER_H
#define _COMMANDLINEPARSER_H

#include <string>

//! Abstract base class for parsing command line arguments
class CommandLineParser
{
public:
    virtual ~CommandLineParser() {};

    /*! Parses command line args and stores results internally.
     * May throw an exception in case of error
     * \param argc number of arguments
     * \param argv arguments as passed to main
     */
    virtual void parse(int argc, char** argv) = 0;

    /*! Query whether a specific flag was set on command line.
     * \param flag Command line switch without leading dash
     * \return whether specified flag was set on command line
     */
    virtual bool hasSet(std::string flag) = 0;

    /*! get argument of switch (if available)
     * \param option command line switch without leading dash
     * \returns value as string
    */
    virtual std::string getValue(std::string option) = 0;

    /*! Print usage help
     */
    virtual void printHelp() = 0;
};

#endif // _COMMANDLINEPARSER_H

Make Command line parser d'tor virtual

Make Command line parser d'tor virtual


/*
PubSubClient_JSON.h - ArduinoJson support for PubSubClient
Copyright (C) 2016 Ian Tester

This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.

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

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

#pragma once

#include <ArduinoJson.h>

namespace MQTT {
  class PublishJSON : public Publish {
  public:
    //! Publish a JSON object from the ArduinoJson library
    /*!
      \param topic Topic of the message
      \param payload Object of the message
    */
    PublishJSON(String topic, ArduinoJson::JsonObject& object) :
      Publish(topic, NULL, object.measureLength() + 1)
    {
      _payload = new uint8_t[_payload_len];
      if (_payload != NULL)
	object.printTo((char*)_payload, _payload_len);
    }

    //! Publish a JSON array from the ArduinoJson library
    /*!
      \param topic Topic of the message
      \param payload Array of the message
    */
    PublishJSON(String topic, ArduinoJson::JsonArray& array) :
      Publish(topic, NULL, array.measureLength() + 1)
    {
      _payload = new uint8_t[_payload_len];
      if (_payload != NULL)
	array.printTo((char*)_payload, _payload_len);
    }

  };

};

Add header file for publishing ArduinoJson objects and arrays


inline string
get_file_contents(char *filename)
{
	ifstream file(filename, ios::in | ios::ate);
	if (!file.is_open())
		return string();
	streampos sz = file.tellg();
	file.seekg(0, ios::beg);
	vector<char> v(sz);
	file.read(&v[0], sz);
	file.close();
	string data(v.empty() ? string() : string (v.begin(), v.end()).c_str());
	return data;
}

inline string
get_file_contents(const char *filename)
{
	ifstream file(filename, ios::in | ios::ate);
	if (!file.is_open())
		return string();
	streampos sz = file.tellg();
	file.seekg(0, ios::beg);
	vector<char> v(sz);
	file.read(&v[0], sz);
	file.close();
	string data(v.empty() ? string() : string (v.begin(), v.end()).c_str());
	return data;
}

Fix compiler warnings in the test suite

Fix compiler warnings in the test suite


//===--- FormatVersion.h - Symbol Graph Format Version 00------------------===//
//
// This source file is part of the Swift.org open source project
//
// Copyright (c) 2014 - 2017 Apple Inc. and the Swift project authors
// Licensed under Apache License v2.0 with Runtime Library Exception
//
// See https://swift.org/LICENSE.txt for license information
// See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
//
//===----------------------------------------------------------------------===//

#ifndef SWIFT_SYMBOLGRAPHGEN_FORMATVERSION_H
#define SWIFT_SYMBOLGRAPHGEN_FORMATVERSION_H

#define SWIFT_SYMBOLGRAPH_FORMAT_MAJOR 0
#define SWIFT_SYMBOLGRAPH_FORMAT_MINOR 3
#define SWIFT_SYMBOLGRAPH_FORMAT_PATCH 0

#endif // SWIFT_SYMBOLGRAPHGEN_FORMATVERSION_H

//===--- FormatVersion.h - Symbol Graph Format Version 00------------------===//
//
// This source file is part of the Swift.org open source project
//
// Copyright (c) 2014 - 2017 Apple Inc. and the Swift project authors
// Licensed under Apache License v2.0 with Runtime Library Exception
//
// See https://swift.org/LICENSE.txt for license information
// See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
//
//===----------------------------------------------------------------------===//

#ifndef SWIFT_SYMBOLGRAPHGEN_FORMATVERSION_H
#define SWIFT_SYMBOLGRAPHGEN_FORMATVERSION_H

#define SWIFT_SYMBOLGRAPH_FORMAT_MAJOR 0
#define SWIFT_SYMBOLGRAPH_FORMAT_MINOR 4
#define SWIFT_SYMBOLGRAPH_FORMAT_PATCH 0

#endif // SWIFT_SYMBOLGRAPHGEN_FORMATVERSION_H

Bump format version to 0.4.0 NFC

[SymbolGraph] Bump format version to 0.4.0 NFC

rdar://60541965


#ifndef __NEW_ITERATOR_PYWRAP_H
#define __NEW_ITERATOR_PYWRAP_H

NPY_NO_EXPORT PyObject *
NpyIter_NestedIters(PyObject *NPY_UNUSED(self),
                    PyObject *args, PyObject *kwds);

#endif

#ifndef __NDITER_PYWRAP_H
#define __NDITER_PYWRAP_H

NPY_NO_EXPORT PyObject *
NpyIter_NestedIters(PyObject *NPY_UNUSED(self),
                    PyObject *args, PyObject *kwds);

#endif

Make include flag name match file name.

STY: Make include flag name match file name.


#ifndef __PLAYER_H__
#define __PLAYER_H__

#include<iostream>
#include"GameObject.h"

class PLayer: public GameObject
{
    public:
        void update();
        void clean()
        {
            GameObject::clean();
            std::cout << "clean PLayer";
        }
};

#endif

#ifndef __PLAYER_H__
#define __PLAYER_H__

#include<iostream>
#include"GameObject.h"

class Player: public GameObject
{
    public:
        void update();
        void clean()
        {
            std::cout << "clean PLayer";
        }
};

#endif

Fix class name and remove GameObject::clean call.


//===-- DIContext.h ---------------------------------------------*- C++ -*-===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
//
// This file defines DIContext, and abstract data structure that holds
// debug information data.
//
//===----------------------------------------------------------------------===//

#ifndef LLVM_DEBUGINFO_DICONTEXT_H
#define LLVM_DEBUGINFO_DICONTEXT_H

#include "llvm/ADT/StringRef.h"
#include "llvm/DebugInfo/DILineInfo.h"

namespace llvm {

class raw_ostream;

class DIContext {
public:
  virtual ~DIContext();

  /// getDWARFContext - get a context for binary DWARF data.
  static DIContext *getDWARFContext(bool isLittleEndian,
                                    StringRef infoSection,
                                    StringRef abbrevSection,
                                    StringRef aRangeSection = StringRef(),
                                    StringRef lineSection = StringRef(),
                                    StringRef stringSection = StringRef());

  virtual void dump(raw_ostream &OS) = 0;
};

}

#endif

//===-- DIContext.h ---------------------------------------------*- C++ -*-===//
//
//                     The LLVM Compiler Infrastructure
//
// This file is distributed under the University of Illinois Open Source
// License. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
//
// This file defines DIContext, and abstract data structure that holds
// debug information data.
//
//===----------------------------------------------------------------------===//

#ifndef LLVM_DEBUGINFO_DICONTEXT_H
#define LLVM_DEBUGINFO_DICONTEXT_H

#include "llvm/ADT/StringRef.h"

namespace llvm {

class raw_ostream;

class DIContext {
public:
  virtual ~DIContext();

  /// getDWARFContext - get a context for binary DWARF data.
  static DIContext *getDWARFContext(bool isLittleEndian,
                                    StringRef infoSection,
                                    StringRef abbrevSection,
                                    StringRef aRangeSection = StringRef(),
                                    StringRef lineSection = StringRef(),
                                    StringRef stringSection = StringRef());

  virtual void dump(raw_ostream &OS) = 0;
};

}

#endif

Remove include of header that doesn't exist (yet).

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


/*
 * mhcachesbr.h -- definitions for manipulating MIME content cache
 */

/*
 * various cache policies
 */
static struct swit caches[] = {
#define CACHE_NEVER    0
    { "never", 0, 0 },
#define CACHE_PRIVATE  1
    { "private", 0, 0 },
#define CACHE_PUBLIC   2
    { "public", 0, 0 },
#define CACHE_ASK      3
    { "ask", 0, 0 },
    { NULL, 0, 0 }
};

/*
 * mhcachesbr.h -- definitions for manipulating MIME content cache
 */

/*
 * various cache policies
 */

#define CACHE_SWITCHES \
    X("never", 0, CACHE_NEVER) \
    X("private", 0, CACHE_PRIVATE) \
    X("public", 0, CACHE_PUBLIC) \
    X("ask", 0, CACHE_ASK) \

#define X(sw, minchars, id) id,
DEFINE_SWITCH_ENUM(CACHE);
#undef X

#define X(sw, minchars, id) { sw, minchars, id },
DEFINE_SWITCH_ARRAY(CACHE, caches);
#undef X

Convert the MIME content cache switches over to the smatch() New World Order.


// InstructionCounter.h (Oclgrind)
// Copyright (c) 2013-2016, James Price and Simon McIntosh-Smith,
// University of Bristol. All rights reserved.
//
// This program is provided under a three-clause BSD license. For full
// license terms please see the LICENSE file distributed with this
// source code.

#include "core/Plugin.h"

namespace llvm
{
  class Function;
}

namespace oclgrind
{
  class InstructionCounter : public Plugin
  {
  public:
    InstructionCounter(const Context *context) : Plugin(context){};

    virtual void instructionExecuted(const WorkItem *workItem,
                                     const llvm::Instruction *instruction,
                                     const TypedValue& result) override;
    virtual void kernelBegin(const KernelInvocation *kernelInvocation) override;
    virtual void kernelEnd(const KernelInvocation *kernelInvocation) override;
    virtual void workGroupBegin(const WorkGroup *workGroup) override;
    virtual void workGroupComplete(const WorkGroup *workGroup) override;

  private:
    std::vector<size_t> m_instructionCounts;
    std::vector<size_t> m_memopBytes;
    std::vector<const llvm::Function*> m_functions;

    struct WorkerState
    {
      std::vector<size_t> *instCounts;
      std::vector<size_t> *memopBytes;
      std::vector<const llvm::Function*> *functions;
    };
    static THREAD_LOCAL WorkerState m_state;

    std::mutex m_mtx;

    std::string getOpcodeName(unsigned opcode) const;
  };
}

// InstructionCounter.h (Oclgrind)
// Copyright (c) 2013-2016, James Price and Simon McIntosh-Smith,
// University of Bristol. All rights reserved.
//
// This program is provided under a three-clause BSD license. For full
// license terms please see the LICENSE file distributed with this
// source code.

#include "core/Plugin.h"

#include <mutex>

namespace llvm
{
  class Function;
}

namespace oclgrind
{
  class InstructionCounter : public Plugin
  {
  public:
    InstructionCounter(const Context *context) : Plugin(context){};

    virtual void instructionExecuted(const WorkItem *workItem,
                                     const llvm::Instruction *instruction,
                                     const TypedValue& result) override;
    virtual void kernelBegin(const KernelInvocation *kernelInvocation) override;
    virtual void kernelEnd(const KernelInvocation *kernelInvocation) override;
    virtual void workGroupBegin(const WorkGroup *workGroup) override;
    virtual void workGroupComplete(const WorkGroup *workGroup) override;

  private:
    std::vector<size_t> m_instructionCounts;
    std::vector<size_t> m_memopBytes;
    std::vector<const llvm::Function*> m_functions;

    struct WorkerState
    {
      std::vector<size_t> *instCounts;
      std::vector<size_t> *memopBytes;
      std::vector<const llvm::Function*> *functions;
    };
    static THREAD_LOCAL WorkerState m_state;

    std::mutex m_mtx;

    std::string getOpcodeName(unsigned opcode) const;
  };
}

Add missing mutex header include

Add missing mutex header include


#ifndef _NODE_H_
#define _NODE_H_

template <class T>
struct Node
{
	T data;
	Node<T> *left;
	Node<T> *right;

	Node(const T& data, Node<T> *left = nullptr, Node<T> *right = nullptr)
		: data(data), left(left), right(right) {}
};

#endif // _NODE_H_

#ifndef _NODE_H_
#define _NODE_H_

template <class T>
struct Node
{
	T data;
	Node<T> *left;
	Node<T> *right;
	Node<T> *parent;

	Node(const T& data, Node<T> *left = nullptr, Node<T> *right = nullptr, Node<T> *parent = nullptr)
		: data(data), left(left), right(right), parent(parent) {}
};

#endif // _NODE_H_

Update Trees/Node structure to have parent


// Derived from blog post at http://www.ermicro.com/blog/?p=1239

#ifndef __MCP23008_H__
#define __MCP23008_H__

#include <compat/twi.h>
#include "i2c_utils.h"

#define MCP23008_ID    0x40  // MCP23008 I2C Device Identifier (0100, fixed)
#define MCP23008_ADDR  0x00  // MCP23008 I2C Address (000-111 in bits 3..1)
#define MCP23008_IODIR 0x00  // MCP23008 I/O Direction Register
#define MCP23008_GPIO  0x09  // MCP23008 General Purpose I/O Register
#define MCP23008_OLAT  0x0A  // MCP23008 Output Latch Register

void write_mcp23008(unsigned char reg_addr,unsigned char data);
unsigned char read_mcp23008(unsigned char reg_addr);

#endif /*__MCP23008_H__*/

// I/O functions for MCP23008 port expander using I2C/TWI protocol
// Derived from blog post at http://www.ermicro.com/blog/?p=1239

#ifndef __MCP23008_H__
#define __MCP23008_H__

#include <compat/twi.h>
#include "i2c_utils.h"

// About the 7-bit I2C slave address MCP23008:
//  - The high bits 7..4 are fixed at 0100.
//  - Bits 3..1 are for further addressing (e.g. eeprom page, jumpered pads)
//  - Bit 0 is disregarded (the R/W direction is handled separately).
// See http://www.avrbeginners.net/architecture/twi/twi.html#addressing

#define MCP23008       0x40  // MCP23008 I2C device address
#define MCP23008_IODIR 0x00  // MCP23008 I/O Direction Register
#define MCP23008_GPIO  0x09  // MCP23008 General Purpose I/O Register
#define MCP23008_OLAT  0x0A  // MCP23008 Output Latch Register

void write_mcp23008(uint8_t reg_addr, uint8_t data);
uint8_t read_mcp23008(uint8_t reg_addr);

#endif /*__MCP23008_H__*/

Add info on I2C address

Add info on I2C address


#pragma once

#include <string>
#include <ostream>
#include <iomanip>
#include <iostream>

struct Hex
{
    Hex(char *buffer, size_t size)
        : m_buffer(buffer)
        , m_size(size)
    {
    }

    friend std::ostream& operator <<(std::ostream &os, const Hex &obj)
    {
        unsigned char* aschar = (unsigned char*)obj.m_buffer;
        for (size_t i = 0; i < obj.m_size; ++i) {
            if (isprint(aschar[i]))  {
                os << aschar[i];
            } else {
                os << std::hex << std::setw(2) << std::setfill('0') << static_cast<unsigned int> (aschar[i]);
            }
        }
        return os;
    }

private:
    char *m_buffer;
    size_t m_size;
};

#pragma once

#include <string>
#include <ostream>
#include <iomanip>
#include <iostream>

struct Hex
{
    Hex(char *buffer, size_t size)
        : m_buffer(buffer)
        , m_size(size)
    {
    }

    friend std::ostream& operator <<(std::ostream &os, const Hex &obj)
    {
        unsigned char* aschar = (unsigned char*)obj.m_buffer;
        for (size_t i = 0; i < obj.m_size; ++i) {
            if (isprint(aschar[i]))  {
                os << aschar[i];
            } else {
                os << "\\x" << std::hex << std::setw(2) << std::setfill('0') << static_cast<unsigned int> (aschar[i]);
            }
        }
        return os;
    }

private:
    char *m_buffer;
    size_t m_size;
};

Add "\x" for hex part.

Add "\x" for hex part.


#include "gdt.h"
#include "idt.h"
#include "vga.h"
#include "term_printf.h"

void kernel_main()
{
	init_term();
	term_puts(NAME " booting...");

	term_puts("Initializing GDT...");
	init_gdt();
	term_puts("Initializing IDT...");
	init_idt();

	term_printf("term_printf is %d%% p%cre %s\n", 100, 'u', "awesome");

	__asm__ volatile ("int $2");
}

#include "gdt.h"
#include "idt.h"
#include "vga.h"
#include "term_printf.h"

void notify(void (*func)(), char *str)
{
	term_putsn(str);
	func();
	term_puts(" done");
}

void kernel_main()
{
	init_term();
	term_puts(NAME " booting...");

	notify(init_gdt, "Initializing GDT...");
	notify(init_idt, "Initializing IDT...");

	term_printf("term_printf is %d%% p%cre %s\n", 100, 'u', "awesome");

	__asm__ volatile ("int $2");
}

Add notify() function to print message around function call


// test for r305179
// RUN: %clang_cc1 -emit-llvm -O -mllvm -print-after-all %s -o %t 2>&1 | grep '*** IR Dump After Function Integration/Inlining ***'
void foo() {}

// test for r305179
// RUN: %clang_cc1 -emit-llvm -O -mllvm -print-after-all %s -o %t 2>&1 | FileCheck %s
// CHECK: *** IR Dump After Function Integration/Inlining ***
void foo() {}

Address David Blaikie comment by replacing grep with FileCheck.

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


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

#ifndef PPAPI_CPP_MODULE_IMPL_H_
#define PPAPI_CPP_MODULE_IMPL_H_

#include "ppapi/cpp/module.h"

namespace {

template <typename T> class DeviceFuncs {
 public:
  explicit DeviceFuncs(const char* ifname) : ifname_(ifname) {}

  operator T const*() {
    if (!funcs_) {
      funcs_ = reinterpret_cast<T const*>(
          pp::Module::Get()->GetBrowserInterface(ifname_));
    }
    return funcs_;
  }

  // This version doesn't check for existence of the function object. It is
  // used so that, for DeviceFuncs f, the expression:
  // if (f) f->doSomething();
  // checks the existence only once.
  T const* operator->() const { return funcs_; }

 private:
  DeviceFuncs(const DeviceFuncs&other);
  DeviceFuncs &operator=(const DeviceFuncs &other);

  const char* ifname_;
  T const* funcs_;
};

}  // namespace

#endif  // PPAPI_CPP_MODULE_IMPL_H_

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

#ifndef PPAPI_CPP_MODULE_IMPL_H_
#define PPAPI_CPP_MODULE_IMPL_H_

#include "ppapi/cpp/module.h"

namespace {

template <typename T> class DeviceFuncs {
 public:
  explicit DeviceFuncs(const char* ifname) : ifname_(ifname), funcs_(NULL) {}

  operator T const*() {
    if (!funcs_) {
      funcs_ = reinterpret_cast<T const*>(
          pp::Module::Get()->GetBrowserInterface(ifname_));
    }
    return funcs_;
  }

  // This version doesn't check for existence of the function object. It is
  // used so that, for DeviceFuncs f, the expression:
  // if (f) f->doSomething();
  // checks the existence only once.
  T const* operator->() const { return funcs_; }

 private:
  DeviceFuncs(const DeviceFuncs&other);
  DeviceFuncs &operator=(const DeviceFuncs &other);

  const char* ifname_;
  T const* funcs_;
};

}  // namespace

#endif  // PPAPI_CPP_MODULE_IMPL_H_

Initialize DeviceFuncs::ifuncs_ to zero in constructor


int getCursorPosition(int *rows, int *cols)
{
}

//
// Use the ESC [6n escape sequence to query the horizontal cursor position
// and return it. On error -1 is returned, on success the position of the
// cursor is stored at *rows and *cols and 0 is returned.
//

int getCursorPosition(int ifd, int ofd, int *rows, int *cols) {
    char buf[32];
    unsigned int i = 0;

    /* Report cursor location */
    if (write(ofd, "\x1b[6n", 4) != 4) return -1;

    /* Read the response: ESC [ rows ; cols R */
    while (i < sizeof(buf)-1) {
        if (read(ifd,buf+i,1) != 1) break;
        if (buf[i] == 'R') break;
        i++;
    }
    buf[i] = '\0';

    /* Parse it. */
    if (buf[0] != ESC || buf[1] != '[') return -1;
    if (sscanf(buf+2,"%d;%d",rows,cols) != 2) return -1;
    return 0;
}

Add changes to correct changes

Add changes to correct changes


/**
 * @file
 * @brief
 *
 * @date 16.05.12
 * @author Anton Bondarev
 * @author Ilia Vaprol
 */
#include <limits.h>
#include <stdint.h>

#define MASK_DWORD  (uint64_t)1 << ((WORD_BIT * 2) - 1)

uint64_t __udivdi3(uint64_t num, uint64_t den) {
	uint64_t result = 0;
	int steps;

	if (den == 0) {
		return 0;
	}

	steps = 0;
	result = 0;

	while (!(den & MASK_DWORD)) {
		den <<= 1;
		++steps;
	}

	do {
		result <<= 1;
		if (num >= den) {
			result |= 1;
			num -= den;
		}
		den >>= 1;
	} while (steps--);

	return result;
}

/**
 * @file
 * @brief
 *
 * @date 16.05.12
 * @author Anton Bondarev
 * @author Ilia Vaprol
 */

#include <stdint.h>

uint64_t __udivdi3(uint64_t num, uint64_t den) {
	uint64_t result = 0;
	int steps;

	if (den == 0) {
		return 0;
	}

	steps = 0;
	result = 0;

	while (!(den & 0x8000000000000000)) {
		den <<= 1;
		++steps;
	}

	do {
		result <<= 1;
		if (num >= den) {
			result |= 1;
			num -= den;
		}
		den >>= 1;
	} while (steps--);

	return result;
}

Revert __udivi3 (word in compiler always 32 bit)


/*
 * Author: hx1997
 * Desc: жһȻǷΪƽԸβ
 */

#include <stdio.h>

int is_automorphic(long int num) {
	long int sqrd = num * num;
	int lsig_digit, lsig_digit_sqrd;

	if(num > 44720) return -1;

	for(; num > 0; num /= 10, sqrd /= 10) {
		lsig_digit = num % 10;
		lsig_digit_sqrd = sqrd % 10;
		if(lsig_digit != lsig_digit_sqrd) return 0;
	}

	return 1;
}

int main(void) {
	int num_to_check;

	printf("Input a non-negative integer less than 44720: ");
	scanf(" %d", &num_to_check);

	if(num_to_check > 44720)
		printf("Invalid input.\n");
	else
		printf("%d is%s an automorphic number.\n", num_to_check, (is_automorphic(num_to_check) ? "" : " not"));

	return 0;
}

/*
 * Author: hx1997
 * Desc: жһȻǷΪƽԸβ
 */

#include <stdio.h>

int is_automorphic(int num) {
	int sqrd = num * num;
	int lsig_digit; int lsig_digit_sqrd;

	if(num > 44720) return -1;

	for(; num > 0; num /= 10, sqrd /= 10) {
		lsig_digit = num % 10;
		lsig_digit_sqrd = sqrd % 10;
		if(lsig_digit != lsig_digit_sqrd) return 0;
	}

	return 1;
}

int main(void) {
	int num_to_check;

	printf("Input a non-negative integer less than 44720: ");
	scanf(" %d", &num_to_check);

	if(num_to_check > 44720)
		printf("Invalid input.\n");
	else
		printf("%d is%s an automorphic number.\n", num_to_check, (is_automorphic(num_to_check) ? "" : " not"));

	return 0;
}

Change long int to int

Automorphic: Change long int to int


// RUN: %clang_cc1 -analyze -analyzer-checker=core -analyzer-config suppress-null-return-paths=true -analyzer-output=text -verify %s
// expected-no-diagnostics

int *returnNull() { return 0; }
int coin();

// Use a float parameter to ensure that the value is unknown. This will create
// a cycle in the generated ExplodedGraph.
void testCycle(float i) {
  int *x = returnNull();
  int y;
  while (i > 0) {
    x = returnNull();
    y = 2;
    i -= 1;
  }
  *x = 1; // no-warning
  y += 1;
}

[analyzer] Add a test case for diagnostic suppression on a graph with cycles.

(see previous commit)

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


//
//  SideMenu.h
//  PlayPlan
//
//  Created by Zeacone on 15/11/19.
//  Copyright © 2015年 Zeacone. All rights reserved.
//

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

@interface SideMenu : UIView

@end

//
//  SideMenu.h
//  PlayPlan
//
//  Created by Zeacone on 15/11/19.
//  Copyright © 2015年 Zeacone. All rights reserved.
//

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

@protocol SideMenuDelegate <NSObject>

- (void)sideMenu:(UIButton *)menu title:(NSString *)title;

@end

@interface SideMenu : UIView

@property (nonatomic, assign) id<SideMenuDelegate> delegate;

@end

Add delegate for side menu.

Add delegate for side menu.